[Compbench-devel] CompBenchmarks++/libcompbenchmarks/CEL CEL-Reader.cpp, 1.1, 1.2 CEL-Reader.h, 1.1
Brought to you by:
xfred
From: Frederic T. <xf...@us...> - 2007-03-06 19:32:39
|
Update of /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/CEL In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv31227 Modified Files: CEL-Reader.cpp CEL-Reader.h Log Message: Updated to parse all CEL elements. Index: CEL-Reader.h =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/CEL/CEL-Reader.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CEL-Reader.h 5 Mar 2007 20:32:40 -0000 1.1 --- CEL-Reader.h 6 Mar 2007 19:32:33 -0000 1.2 *************** *** 14,29 **** /** \brief Interface to CEL XML files ? */ ! class CELReader { protected: XMLNode *root; public: /** Constructor */ ! CELReader(std::string _filename); ! class CELAtom *parse(void); /** Destructor */ ! virtual ~CELReader(); }; } --- 14,30 ---- /** \brief Interface to CEL XML files ? */ ! class CelReader { protected: XMLNode *root; + virtual void parse(XMLNode *from, class CelAtom *into); public: /** Constructor */ ! CelReader(std::string _filename); ! virtual class CelAtom *parse(void); /** Destructor */ ! virtual ~CelReader(); }; } Index: CEL-Reader.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/CEL/CEL-Reader.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CEL-Reader.cpp 5 Mar 2007 20:32:40 -0000 1.1 --- CEL-Reader.cpp 6 Mar 2007 19:32:33 -0000 1.2 *************** *** 9,17 **** #include <CEL/CEL-Atom.h> #include <Base/XMLReader.h> using namespace CBM; ! CELReader::CELReader(std::string _filename) { CBM::XMLReader r; --- 9,31 ---- #include <CEL/CEL-Atom.h> + #include <CEL/CEL-Str.h> + #include <CEL/CEL-Logic.h> + #include <CEL/CEL-Version.h> + #include <CEL/CEL-Math.h> + #include <CEL/CEL-Cmp.h> + #include <CEL/CEL-Cond.h> + #include <CEL/CEL-Var.h> + #include <CEL/CEL-Array.h> + #include <CEL/CEL-Block.h> + #include <CEL/CEL-Loop.h> + #include <CEL/CEL-Function.h> + #include <CEL/CEL-Stack.h> + #include <CEL/CEL-Include.h> + #include <Base/XMLReader.h> using namespace CBM; ! CelReader::CelReader(std::string _filename) { CBM::XMLReader r; *************** *** 20,42 **** } ! CELAtom *CELReader::parse(void) { CBM::XMLNode *N; int i; int n; ! if (!root) ! return(0); ! n=root->nodeNumber(); for(i=0;i<n;i++) { ! N=root->getNode(i); if (N->Name()=="cel-str") { } } } ! CELReader::~CELReader() { } --- 34,178 ---- } ! void CelReader::parse(CBM::XMLNode *from, CBM::CelAtom *into) { CBM::XMLNode *N; + CBM::CelAtom *current; + int i; int n; ! if (!from) ! return; ! n=from->nodeNumber(); for(i=0;i<n;i++) { ! current=0; ! ! N=from->getNode(i); ! if (N->Name()=="cel-str") { + current=new CBM::CelStr(N->Value()); + } + + if (N->Name()=="cel-logic-true") { + current=new CBM::CelLogicTrue(); + } + if (N->Name()=="cel-logic-false") { + current=new CBM::CelLogicFalse(); + } + if (N->Name()=="cel-logic-or") { + current=new CBM::CelLogicOr(); + } + if (N->Name()=="cel-logic-and") { + current=new CBM::CelLogicAnd(); + } + if (N->Name()=="cel-logic-not") { + current=new CBM::CelLogicNot(); + } + + if (N->Name()=="cel-version") { + current=new CBM::CelVersion(N->Value()); + } + + if (N->Name()=="cel-math-inc") { + current=new CBM::CelMathInc(); + } + if (N->Name()=="cel-math-dec") { + current=new CBM::CelMathDec(); + } + + if (N->Name()=="cel-cmp-eq") { + current=new CBM::CelCmpEq(); + } + if (N->Name()=="cel-cmp-ae") { + current=new CBM::CelCmpAE(); + } + + if (N->Name()=="cel-cond-if") { + current=new CBM::CelCondIf(); + } + + + if (N->Name()=="cel-var-set") { + current=new CBM::CelVarSet(); + } + if (N->Name()=="cel-var-get") { + current=new CBM::CelVarGet(); + } + if (N->Name()=="cel-var-undef") { + current=new CBM::CelVarUndef(); + } + + if (N->Name()=="cel-array-def") { + current=new CBM::CelArrayDef(); + } + if (N->Name()=="cel-array-add") { + current=new CBM::CelArrayAdd(); + } + if (N->Name()=="cel-array-get") { + current=new CBM::CelArrayGet(); + } + if (N->Name()=="cel-array-size") { + current=new CBM::CelArraySize(); + } + if (N->Name()=="cel-array-undef") { + current=new CBM::CelArrayUndef(); + } + + + if (N->Name()=="cel-block") { + current=new CBM::CelBlock(); + } + + if (N->Name()=="cel-loop") { + current=new CBM::CelLoop(); + } + + if (N->Name()=="cel-loop-break") { + current=new CBM::CelLoopBreak(); + } + + if (N->Name()=="cel-function-def") { + current=new CBM::CelFunctionDef(); + } + if (N->Name()=="cel-function-call") { + current=new CBM::CelFunctionCall(); + } + if (N->Name()=="cel-function-return") { + current=new CBM::CelFunctionReturn(); + } + + if (N->Name()=="cel-stack-push") { + current=new CBM::CelStackPush(); + } + if (N->Name()=="cel-stack-pop") { + current=new CBM::CelStackPop(); + } + + if (N->Name()=="cel-include") { + current=new CBM::CelInclude(); + } + + if (current) { + into->add(current); + parse(N, current); } } } ! CelAtom *CelReader::parse(void) ! { ! CBM::CelContainer *C; ! ! if (!root) ! return(0); ! ! C=new CBM::CelContainer(); ! parse(root, C); ! return(C); ! } ! ! CelReader::~CelReader() { } |