Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

PropertyCompiler.h

Go to the documentation of this file.
00001 // $Header: /nfs/slac/g/glast/ground/cvs/GaudiSvc/src/JobOptionsSvc/PropertyCompiler.h,v 1.1.1.2 2001/04/18 18:32:50 tlindner Exp $     //
00002 
00003 #if !defined(PROPERTYCOMPILER_INCLUDED)
00004    #define PROPERTYCOMPILER_INCLUDED
00005 
00006 // Include files
00007 #include <string>
00008 #include <fstream>
00009 #include "JobOptionsCatalogue.h"
00010 #include "GaudiKernel/StatusCode.h"
00011 #include "GaudiKernel/MsgStream.h"
00012 #include "UnitsExtension.h"
00013 
00014 //
00015 // ClassName:   PropertyCompiler 
00016 //  
00017 // Description: The PropertyCompiler class reads in a Job-Option-File and initilizes
00018 //              the job's entire configuration.
00019 //              The Property-Compiler is setting up the job's entire configuration
00020 //              by reading in a Job-Option-File, compile this file and execute the
00021 //              commands in there.
00022 //              The compiler starts with one file (the initial file) and from there
00023 //              can serveral other Job-Option-Files be included.
00024 //
00025 // Author:      Stefan Probst
00026 //
00027 class PropertyCompiler
00028 {
00029    public:
00030       // default constructor
00031       PropertyCompiler(std::string sourcefile,      // file to be compiled (initial file)
00032                        MsgStream& my_log,           // Message stream to do the output
00033                        JobOptionsCatalogue& myCat,  // JobOptionsCatalogue to be filled
00034                        PropertyCompiler* parent=0); // Parent property compiler
00035       // virtual destructor
00036       virtual ~PropertyCompiler();
00037 
00038       // main routine which starts the compiler
00039       StatusCode startCompiler();
00040 
00041    private:
00042       // vector which contains all included files (for checking double includation)
00043       std::vector <std::string>* includeFiles;
00044       bool unitsDefined, hasParent;
00045       UnitsExtension* units;
00046 
00047       // Set of all possible symbols known by the compiler
00048       enum Symbols { BOFSy, EOFSy, assignSy, semicolonSy, commaSy, stringSy, numberSy, realSy, dotSy, noSy, 
00049                      identifierSy, booleanSy, includeSy, minusSy, plusSy, vectorStartSy, vectorEndSy, appendSy,
00050                      ifDefSy, ifNDefSy, endIfSy, elseSy, unitsSy, envSy, propSy };
00051       // Set of all possible operations known by the compiler
00052       enum Operations { assign, append, noOperation, clear };
00053 
00054       char m_ch;                       // current Character
00055       unsigned int m_lnr,m_cnr;        // line and columnumber for lexical analysator
00056       unsigned int m_tokenlnr,m_tokencnr;// last token number for error detection
00057       std::string m_identStr;          // Identifier
00058       std::string m_srcName;           // Sourcefile
00059       std::string m_srcLine;           // Line to be compiled
00060       std::string m_compiledLine;      // token to be read
00061       Symbols m_sy;                    // current Symbol
00062       bool m_error;                    // is there an error in the line?
00063       int m_errorCount,m_warningCount; // count errors
00064       std::ifstream *m_in;             // file stream
00065       MsgStream* m_log;                // output
00066       JobOptionsCatalogue* m_Cat;      // JobOptionsCatalogue
00067 
00068       // Resolve sourcefile (add enviornment-variables, replace correct slash)
00069       std::string resolveEnv(const std::string& sourcefile);
00070 
00071       // Ignore platform dependend lines
00072       void ignorePlatformDependendLines();
00073       void getEntryPointOfDependendLines();
00074 
00075       // Getting the next character of the input-stream
00076       void newCh();
00077       // Getting the next symbol by merging the characters
00078       std::string newSy();
00079       // Test, if current position is a entry point for the next command
00080       bool isNextEntryPoint();
00081       // Get the type of the used value
00082       Symbols getValueType(std::string& valueStr);
00083       // Routine which is checking the used syntax
00084       StatusCode checkSyntax();
00085 };
00086 #endif

Generated at Wed Nov 21 12:22:31 2001 by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000