10 #include <boost/version.hpp> 11 #include <boost/filesystem.hpp> 26 #if BOOST_VERSION < 104600 27 const string n = boost::filesystem::path(name).stem();
29 const string n = boost::filesystem::path(name).stem().string();
32 out <<
kBlue <<
kBold <<
kUnderline <<
"\n Master Control Program (compiled " __DATE__
" " __TIME__ <<
") " << endl;
37 " TELESCOPE CONTROL PROGRAM: " << n <<
"\n" 38 " ANNEXED BY FACT COLLABORATION\n" 39 " ORIGINAL PROGRAM WRITTEN BY T.BRETZ\n" 40 " THIS INFORMATION " <<
kUnderline <<
"PRIORITY ONE" 42 out <<
kBlue <<
" END OF LINE\n" << endl;
47 out <<
"Enter 'h' for help." << endl;
61 out <<
" " <<
kUnderline <<
" Commands:" << endl;
62 out <<
" No application specific commands defined." << endl;
78 out <<
" Attributes:" << endl;
79 out <<
" " <<
kReset <<
"kReset" << endl;
80 out <<
" " <<
kNormal <<
"kNormal" << endl;
81 out <<
" " <<
kHighlight <<
"kHighlight" << endl;
82 out <<
" " <<
kReverse <<
"kReverse" << endl;
83 out <<
" " <<
kUnderline <<
"kUnderline" << endl;
84 out <<
" " <<
kBlink <<
"kBlink" << endl;
85 out <<
" " <<
kDim <<
"kDim" << endl;
86 out <<
" " <<
kBold <<
"kBold" << endl;
87 out <<
" " <<
kProtect <<
"kProtect" << endl;
88 out <<
" " <<
kInvisible <<
"kInvisible" << endl;
91 out <<
" Colors:" << endl;
92 out <<
" " <<
kDefault <<
"kDefault " <<
kBold <<
"+ kBold" << endl;
93 out <<
" " <<
kRed <<
"kRed " <<
kBold <<
"+ kBold" << endl;
94 out <<
" " <<
kGreen <<
"kGreen " <<
kBold <<
"+ kBold" << endl;
95 out <<
" " <<
kYellow <<
"kYellow " <<
kBold <<
"+ kBold" << endl;
96 out <<
" " <<
kBlue <<
"kBlue " <<
kBold <<
"+ kBold" << endl;
97 out <<
" " <<
kMagenta <<
"kMagenta " <<
kBold <<
"+ kBold" << endl;
98 out <<
" " <<
kCyan <<
"kCyan " <<
kBold <<
"+ kBold" << endl;
99 out <<
" " <<
kWhite <<
"kWhite " <<
kBold <<
"+ kBold" << endl;
118 out <<
" " <<
kUnderline <<
"Key bindings:" << endl << endl;;
119 out <<
" Default key-bindings are identical with your bash." << endl;
121 out <<
kBold <<
" Page-up " <<
kReset <<
"Search backward in history" << endl;
122 out <<
kBold <<
" Page-dn " <<
kReset <<
"Search forward in history" << endl;
123 out <<
kBold <<
" Ctrl-left " <<
kReset <<
"One word backward" << endl;
124 out <<
kBold <<
" Ctrl-right " <<
kReset <<
"One word forward" << endl;
125 out <<
kBold <<
" Home " <<
kReset <<
"Beginning of line" << endl;
126 out <<
kBold <<
" End " <<
kReset <<
"End of line" << endl;
127 out <<
kBold <<
" Ctrl-d " <<
kReset <<
"Quit" << endl;
128 out <<
kBold <<
" Ctrl-y " <<
kReset <<
"Delete line" << endl;
129 out <<
kBold <<
" Alt-end/Ctrl-k " <<
kReset <<
"Delete until the end of the line" << endl;
149 out <<
" " <<
kUnderline <<
"General help:" << endl << endl;
150 out <<
" The command history is automatically loaded and saves to" << endl;
151 out <<
" and from " << name << endl;
153 out <<
kBold <<
" h,help " <<
kReset <<
"Print this help message\n";
154 out <<
kBold <<
" clear " << kReset <<
"Clear history buffer\n";
155 out <<
kBold <<
" lh,history " << kReset <<
"Dump the history buffer to the screen\n";
156 out <<
kBold <<
" v,variable " << kReset <<
"Dump readline variables\n";
157 out <<
kBold <<
" f,function " << kReset <<
"Dump readline functions\n";
158 out <<
kBold <<
" m,funmap " << kReset <<
"Dump readline funmap\n";
159 out <<
kBold <<
" c,command " << kReset <<
"Dump available commands\n";
160 out <<
kBold <<
" k,keylist " << kReset <<
"Dump key bindings\n";
161 out <<
kBold <<
" a,attrs " << kReset <<
"Dump available stream attributes\n";
162 out <<
kBold <<
" .! command " << kReset <<
"Execute a shell command\n";
163 out <<
kBold <<
" .w n " << kReset <<
"Sleep n milliseconds\n";
164 out <<
kBold <<
" .x filename " << kReset <<
"Execute a script of commands (+optional arguments)\n";
165 out <<
kBold <<
" .x file:N " << kReset <<
"Execute a script of commands, start at label N\n";
166 out <<
kBold <<
" .j N " << kReset <<
"Forward jump to label N\n";
167 out <<
kBold <<
" .lt f0 f1 N " << kReset <<
"If float f0 lower than float f1, jump to label N\n";
168 out <<
kBold <<
" .gt f0 f1 N " << kReset <<
"If float f0 greater than float f1, jump to label N\n";
169 out <<
kBold <<
" .eq i0 i1 N " << kReset <<
"If int i0 equal int i1, jump to label N\n";
170 out <<
kBold <<
" : N " << kReset <<
"Defines a label (N=number)\n";
171 out <<
kBold <<
" # comment " << kReset <<
"Ignored\n";
172 out <<
kBold <<
" .q,quit " << kReset <<
"Quit" << endl;
190 FILE *pipe = popen(cmd.c_str(),
"r");
193 out <<
kRed <<
"ERROR - Could not create pipe '" << cmd <<
"': " << strerror(errno) <<
" [" << errno <<
"]" << endl;
201 const size_t sz = fread(buf, 1, 1024, pipe);
204 if (feof(pipe) || ferror(pipe))
211 out <<
kRed <<
"ERROR - Reading from pipe '" << cmd <<
"': " << strerror(errno) <<
" [" << errno <<
"]" << endl;
223 if (str.substr(0, 2)==
".!")
226 if (str==
"lh" || str==
"history")
228 out << endl <<
kBold <<
"History:" << endl;
232 if (str==
"v" || str==
"variable")
234 out << endl <<
kBold <<
"Variables:" << endl;
238 if (str==
"f" || str==
"function")
240 out << endl <<
kBold <<
"Functions:" << endl;
244 if (str==
"m" || str==
"funmap")
246 out << endl <<
kBold <<
"Funmap:" << endl;
252 if (str==
"a" || str==
"attrs")
bool PrintGeneralHelp(std::ostream &out, const std::string &name)
bool PrintAttributes(std::ostream &out)
Set attribute Alternative charset.
static bool DumpHistory()
Adds some functionality to boost::posix_time::ptime for our needs.
static bool RedirectionWrapper(std::ostream &out, bool(*function)())
static const _time_format reset
bool PrintCommands(std::ostream &out)
static bool DumpFunctions()
bool ExecuteShellCommand(std::ostream &out, const std::string &cmd)
static const _time_format fmt(const char *txt=0)
A stream manipulator to set the output/input format.
bool PrintBootMsg(std::ostream &out, const std::string &name, bool interactive=true)
bool Process(std::ostream &out, const std::string &str)
bool PrintKeyBindings(std::ostream &out)
static bool DumpVariables()