#include <CmdContextCCA.h>
Public Member Functions | |
CmdContextCCA (CmdLineBuilderView *bv_, DefaultBuilderModel *bm) | |
CmdContextCCA (FILE *out, CmdLineBuilderView *bv_, DefaultBuilderModel *bm) | |
virtual void | pn (char *s) |
virtual void | p (char *s) |
virtual void | pn (char s) |
virtual void | p (char s) |
virtual char * | prompt () |
virtual CFREE char * | readLine (int &err) |
virtual char * | getInstance (char *instanceName) |
virtual char * | getClass (char *className) |
char * | getRCInfo (int &linesRead, int &lineErr) |
Public Attributes | |
DefaultBuilderModel * | bm |
CmdLineBuilderView * | bv |
Protected Member Functions | |
void | setup () |
void | trim_blanks (char *str) |
virtual CFREE char * | _readLine (int &readerr) |
virtual int | initRC () |
int | rcLine (char *buf, int bufSize) |
int | badMagic (FILE *file, const char *fname) |
bool | isFakeEOF (char *line) |
Protected Attributes | |
FILE * | in |
char * | rcFileName |
FILE * | rc |
int | lineCount |
int | lastErr |
int | rcUnknown |
Private Attributes | |
char * | tmpString |
CmdContextCCA::CmdContextCCA | ( | CmdLineBuilderView * | bv_, | |
DefaultBuilderModel * | bm | |||
) |
instantiation of interpreters has specific details. In this cca parser, we need a builderview.
CmdContextCCA::CmdContextCCA | ( | FILE * | out, | |
CmdLineBuilderView * | bv_, | |||
DefaultBuilderModel * | bm | |||
) |
instantiation of interpreters has specific details. In this cca parser, we need a builderview and an output channel.
virtual void CmdContextCCA::pn | ( | char * | s | ) | [virtual] |
Write a line from a null-terminated string.
Implements CmdContext.
virtual void CmdContextCCA::p | ( | char * | s | ) | [virtual] |
Write a line fraction from a null-terminated string.
Implements CmdContext.
virtual void CmdContextCCA::pn | ( | char | s | ) | [virtual] |
Write a character and a carriage return.
Implements CmdContext.
virtual void CmdContextCCA::p | ( | char | s | ) | [virtual] |
Write a character.
Implements CmdContext.
virtual char* CmdContextCCA::prompt | ( | ) | [virtual] |
cca>
Implements CmdContext.
virtual CFREE char* CmdContextCCA::readLine | ( | int & | err | ) | [virtual] |
Read lines using _readLine. If the line ends in \, read another line and append it before returning the combined line.
Implements CmdContext.
virtual char* CmdContextCCA::getInstance | ( | char * | instanceName | ) | [virtual] |
Checks the name given against the arena list in the buildermodel. Uses an ugly fuzzy match algorithm.
Implements CmdContext.
virtual char* CmdContextCCA::getClass | ( | char * | className | ) | [virtual] |
Checks the name given against the class list in the buildermodel. Uses an ugly fuzzy match algorithm.
Implements CmdContext.
char* CmdContextCCA::getRCInfo | ( | int & | linesRead, | |
int & | lineErr | |||
) |
Returns the rcfile name and lines read statistics. If none returns will be null/0
void CmdContextCCA::setup | ( | ) | [protected] |
constructor args independent initializations.
void CmdContextCCA::trim_blanks | ( | char * | str | ) | [protected] |
remove trailing blanks from strings.
virtual CFREE char* CmdContextCCA::_readLine | ( | int & | readerr | ) | [protected, virtual] |
In our version of _readLine, we have overloaded to handle an rc file. We look for lines in files env(CCAFE_RC_FILE), env(HOME)/.ccaferc, and a compiled in path /cxx/dc/user_iface/CcaffeineRC to return before we start parsing the regular input obtained from bv. The advisability of this on a global file system is not investigated here. GFS Hint: if it's a problem, have each node run with a different env(CCAFE_RC_FILE) value.
Reimplemented in CmdContextCCAMPI.
virtual int CmdContextCCA::initRC | ( | ) | [protected, virtual] |
Returns 1 if rcfile apparently found and 0 if not. rcFile is set up for reading if 1 returned.
Reimplemented in CmdContextCCAMPI.
int CmdContextCCA::rcLine | ( | char * | buf, | |
int | bufSize | |||
) | [protected] |
Reads a line from the rcfile into buf. status out is 0 if ok, 1 if no more lines or other fatal error. rcFile is closed before a return of 1.
int CmdContextCCA::badMagic | ( | FILE * | file, | |
const char * | fname | |||
) | [protected] |
Checks for magic word at start of rc file. avoids accidentally parsing dumb files. returns 0 if ok, 1 if bad magic. The magic word is #!ccaffeine.
bool CmdContextCCA::isFakeEOF | ( | char * | line | ) | [protected] |
checks for #!eof marker to interrupt file read before end of file. use is to turn off every thing in a .ccaferc after the #!eof if you're using the gui and want only to go as far in your usual .ccaferc as loading classes.
Where all the real goop is hidden, including the framework. we create this.
Where we send stuff and get stuff. We extract bm from it.
Reimplemented in CmdContextCCAMPI.
FILE* CmdContextCCA::in [protected] |
Found from bv or given in constructor.
char* CmdContextCCA::rcFileName [protected] |
The rc filename we found and read.
FILE* CmdContextCCA::rc [protected] |
File pointer of rcfile, or 0 if none.
int CmdContextCCA::lineCount [protected] |
Number of rc lines read so far.
int CmdContextCCA::lastErr [protected] |
Most recent rc error, possibly nothing, eof, or something exotic.
int CmdContextCCA::rcUnknown [protected] |
Flag for whether or not we've tried opening the rc file.