// parse.h // Class for parsing of c++ programms with $command line$ part. #ifndef __parse_h #define __parse_h extern "C" { #include #include #include #include void exit(int); } #ifndef SEEK_SET #define SEEK_SET 0 #endif // Parses the command line and defines the variables which are known // from the command line part. int ParseCommandLine(int, char**); class Parse { private: unsigned long StartPos; // where does it start unsigned long EndPos; // where does it end char *FileName; // of the file to insert the parser FILE *FD; // File Descriptor FILE *CL; // " " for writing the include file int Valid; // is the parser or file valid? 0 yes -1 no int NumOfVar; // number of variables int NumOfLines; // how many lines to parse in the source char *Line; // for reading a complete line unsigned long PosInLine; // where are we in the line char **VarArg; // variable name in command line char **VarNam; // variable name in program char **VarType; // variable type char **Default; // default of the variable char **Description; // description which appears in the usage message char *Author; // author of the file char *Usage; // a usage text char *Version; // of the program int Compare(char*); // compares the string with the following input data int BuiltInclude(char *name="commandline"); // the intro of the include int BuiltH(char*, char*); // the .h file int BuiltCC(char*, char*); // the .cc file int BuiltUsageCode(void); // for a variable int BuiltParserCode(void); // for scanning the command line int BuiltEventParser(void);// for scanning the event part of the command line int ReadString(char*&); // within " " int WriteCodeArg(int); // write parsing code for argument y public: Parse(char*); ~Parse(void); char GetC(void); int ReadText(void); int ReadWhiteSpace(void); // 0 means ok, otherwise -1 int ReadToEndOfLine(void); int FindBeginEnd(void); int Status(void); int ScanArguments(void); int ReadVarArg(int); int ReadVarNam(int); int ReadVarType(int); int ReadDefault(int); int ReadDescription(int); int ReadDefDesString(int); int DetNumOfArg(int); // determines the number of arguments of a type int ReadLine(void); int Info(void); }; #endif