Debian Codegraph @

src/GUI_impl_readline.cc

raw symbols SCIP
1 #include "gvars3/GUI.h"
2 #include "src/GUI_impl.h"
3 #include "gvars3/GStringUtil.h"
4
5 #include <gvars3/GUI_readline.h>
6
7 #include <pthread.h>
8
9 #include <cctype>
10 #include <sstream>
11 #include <fstream>
12 #include <unistd.h>
13 #include <sys/wait.h>
14 #include <stdlib.h>
15 #include <algorithm>
16
17 #include <readline/readline.h>
18 #include <readline/history.h>
19
20 using namespace std;
21
22 namespace GVars3
23 {
24
25 void GUI_impl::SetupReadlineCompletion()
26 {
27 mpReadlineCompleterGUI = this;
28 rl_attempted_completion_function = ReadlineCompletionFunction;
29 rl_basic_word_break_characters = " \t\n\"\\'`@$><;|&{(";
30 }
31
32 char ** GUI_impl::ReadlineCompletionFunction (const char *text, int /*start*/, int /*end*/)
33 {
34 rl_completion_append_character=0;
35 char **matches;
36 matches = (char **)NULL;
37 matches = rl_completion_matches (text, ReadlineCommandGeneratorCB);
38 return (matches);
39 }
40
41 void print_history(ostream &ost)
42 {
43 HIST_ENTRY **apHistEntries = history_list();
44 if(apHistEntries)
45 while((*apHistEntries)!=NULL)
46 {
47 ost << (*apHistEntries)->line << endl;
48 apHistEntries++;
49 }
50 };
51
52
53 void GUI_impl::StartParserThread()
54 {
55 if(mpParserThread) // Only makes sense to have one instance of the parser thread.
56 return;
57
58 mpParserThread = new spawn_readline_thread("");
59 }
60
61 void GUI_impl::StopParserThread()
62 {
63 if(!mpParserThread)
64 return;
65
66 delete( (spawn_readline_thread*) mpParserThread);
67 mpParserThread = NULL;
68 }
69
70
71 }