#include <JobCInterpreter.h>
Public Member Functions | |
| JobCInterpreter () | |
| JobCInterpreter (bool echo) | |
| ~JobCInterpreter () | |
| void | ReadFile (const string &filename) |
| void | EchoOn () |
| void | EchoOff () |
| JobCommand * | PopJobCommand () |
Private Member Functions | |
| void | Interp (const char *cmd) |
| void | PushJobCommand (JobCommand *c) |
Private Attributes | |
| bool | fEchoCommand |
| string | fBuffer |
| unsigned int | fCmdIndx |
| vector< JobCommand * > | fCmdList |
Friends | |
| class JobCInterpreter & | operator<< (JobCInterpreter &jci, const char *c) |
Definition at line 21 of file JobCInterpreter.h.
| JobCInterpreter::JobCInterpreter | ( | ) |
Definition at line 22 of file JobCInterpreter.cxx.
00022 : 00023 fEchoCommand(false),fBuffer(""), fCmdIndx(0) { }
| JobCInterpreter::JobCInterpreter | ( | bool | echo | ) |
Definition at line 27 of file JobCInterpreter.cxx.
00027 : 00028 fEchoCommand(echo),fBuffer(""), fCmdIndx(0) { }
| JobCInterpreter::~JobCInterpreter | ( | ) |
Definition at line 32 of file JobCInterpreter.cxx.
References fCmdList.
00033 { 00034 // Delete the job commands in the history list 00035 vector<JobCommand*>::iterator itrend(fCmdList.end()); 00036 vector<JobCommand*>::iterator itr; 00037 for (itr = fCmdList.begin(); itr != itrend; ++itr) { 00038 delete *itr; 00039 } 00040 }
| void JobCInterpreter::EchoOff | ( | ) |
Definition at line 52 of file JobCInterpreter.cxx.
References fEchoCommand.
Referenced by JobController::ControllerCommand().
00052 { fEchoCommand = false; }
| void JobCInterpreter::EchoOn | ( | ) |
Definition at line 48 of file JobCInterpreter.cxx.
References fEchoCommand.
Referenced by JobController::ControllerCommand().
00048 { fEchoCommand = true; }
| void JobCInterpreter::Interp | ( | const char * | cmd | ) | [private] |
Definition at line 80 of file JobCInterpreter.cxx.
References fBuffer, and PushJobCommand().
Referenced by operator<<().
00081 { 00082 const char *c = cmd; 00083 00084 // Skip lines starting with '#' 00085 if (*c == '#') return; 00086 00087 // Skip leading white space 00088 if (fBuffer.length()==0) while (*c == ' ') ++c; 00089 00090 // Add to current string buffer 00091 for (; *c!='\0'; ++c) { 00092 // Don't read pass continuation flags 00093 if (*c=='\\') return; 00094 00095 // Don't read pass comments 00096 if (*c=='/' && *(c+1)=='/') { 00097 if (fBuffer.length()>0) { 00098 JobCommand *jcmd = new JobCommand(fBuffer.c_str()); 00099 this->PushJobCommand(jcmd); 00100 fBuffer = ""; 00101 } 00102 return; 00103 } 00104 00105 // Parse what we have 00106 if (*c=='\n' || *c==';') { 00107 if (fBuffer.length()>0) { 00108 JobCommand *jcmd = new JobCommand(fBuffer.c_str()); 00109 this->PushJobCommand(jcmd); 00110 fBuffer = ""; 00111 } 00112 } 00113 else { 00114 if (*c == ' ' && fBuffer.length()==0) continue; 00115 else fBuffer += (*c); 00116 } 00117 } 00118 }
| JobCommand * JobCInterpreter::PopJobCommand | ( | ) |
Definition at line 56 of file JobCInterpreter.cxx.
References fCmdIndx, fCmdList, fEchoCommand, jc, Msg::kInfo, and MSG.
Referenced by JobController::ProcessCommands().
00057 { 00058 //====================================================================== 00059 // Return the next command in the list 00060 //====================================================================== 00061 if (fCmdIndx<fCmdList.size()) { 00062 JobCommand *jc = fCmdList[fCmdIndx++]; 00063 if (jc) { 00064 if (fEchoCommand) MSG("JobC",Msg::kInfo) << "jobc> " << (*jc) << "\n"; 00065 return jc; 00066 } 00067 } 00068 return 0; 00069 }
| void JobCInterpreter::PushJobCommand | ( | JobCommand * | c | ) | [private] |
Definition at line 73 of file JobCInterpreter.cxx.
References fCmdList.
Referenced by Interp().
00074 { 00075 fCmdList.push_back(c); 00076 }
| void JobCInterpreter::ReadFile | ( | const string & | filename | ) |
| class JobCInterpreter& operator<< | ( | JobCInterpreter & | jci, | |
| const char * | c | |||
| ) | [friend] |
Definition at line 14 of file JobCInterpreter.cxx.
00015 { 00016 jci.Interp(c); 00017 return jci; 00018 }
string JobCInterpreter::fBuffer [private] |
unsigned int JobCInterpreter::fCmdIndx [private] |
vector<JobCommand*> JobCInterpreter::fCmdList [private] |
Definition at line 41 of file JobCInterpreter.h.
Referenced by PopJobCommand(), PushJobCommand(), and ~JobCInterpreter().
bool JobCInterpreter::fEchoCommand [private] |
Definition at line 38 of file JobCInterpreter.h.
Referenced by EchoOff(), EchoOn(), and PopJobCommand().
1.4.7