Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef CBACKEND_HPP
00031 #define CBACKEND_HPP
00032
00033 #include <stdio.h>
00034 #include "glue.h"
00035 #include <list>
00036 #include <map>
00037 #include <string>
00038
00039 using namespace std;
00040
00041 class CNode;
00042 class CModule;
00043 class CInstance;
00044 class CObstack;
00045
00178 class CElement
00179 {
00180 private:
00181 string filename;
00182 int filenameValid;
00183 CNode* code;
00184 public:
00191 CElement( const char* filename, int filenameValid, CNode* code ) :
00192 filename(filename),
00193 filenameValid( filenameValid ),
00194 code(code ) {}
00200 const char* Filename() { return filenameValid ? filename.c_str() : NULL; }
00205 CNode* Code() { return code; }
00210 void Code( CNode* code ) { this->code = code; }
00211 };
00212
00216 class CBackendException {};
00221 class CBackendAbort : CBackendException {};
00226 class CBackendExit : CBackendException {};
00231 class CBackendFail : CBackendException {};
00232
00249 class CBackend
00250 {
00251 protected:
00252 list<string> switches;
00253 map<string,string> switchDescription;
00254 public:
00259 virtual char* GetToolName( void ) = 0;
00264 virtual char* GetToolDescription( void ) = 0;
00271 virtual int AcceptAllPlusArgs( void ) { return FALSE; }
00277 virtual list<string>& GetSwitches( void ) {return switches;}
00284 virtual const char* GetSwitchDescription( const char* sw )
00285 {
00286 MASSERT( switchDescription.find(sw) !=
00287 switchDescription.end() );
00288 return switchDescription[sw].c_str();
00289 }
00296 virtual void RegisterSwitch( const char* switchName,
00297 const char* description )
00298 {
00299 switches.push_back( switchName );
00300 switchDescription[switchName] = description;
00301 }
00308 virtual int ResolveModules() = 0;
00316 virtual int ResolveInstance( CModule* module, CInstance* inst ) = 0;
00325 virtual int HideTool() { return FALSE; }
00336 virtual int IgnoreVrqComments() { return FALSE; }
00341 virtual void Activate() = 0;
00354 virtual void Process( list<CElement>& inputList,
00355 list<CElement>& outputList ) = 0;
00356 };
00357
00358 #endif // CBACKEND_HPP