[Compbench-devel] CompBenchmarks++/libcompbenchmarks/Compiler Compiler.cpp, 1.10, 1.11 Compiler.h,
Brought to you by:
xfred
From: Frederic T. <xf...@us...> - 2007-04-12 19:55:42
|
Update of /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Compiler In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv14255 Modified Files: Compiler.cpp Compiler.h Compiler-Option-Description.cpp Compiler-Option-Description.h Compiler-Option-Logic.cpp Compiler-Option-Logic.h Log Message: CEL obsoleted. Logic is integrated within descriptions. Many improvements in 'option logic' related API. Index: Compiler.h =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Compiler/Compiler.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Compiler.h 9 Apr 2007 10:07:12 -0000 1.10 --- Compiler.h 12 Apr 2007 19:55:37 -0000 1.11 *************** *** 20,33 **** #include <Plan/Plan.h> #include <Compiler/Compiler-Option-Description.h> - #include <CEL/CEL-Atom.h> %} #define CBM_PLAN CBM::Plan #define CBM_COD CBM::CompilerOptionDescriptions - #define CBM_CEL CBM::CelAtom - #else # define CBM_PLAN class Plan # define CBM_COD class CompilerOptionDescriptions - # define CBM_CEL class CelAtom #endif --- 20,29 ---- *************** *** 36,39 **** --- 32,42 ---- + + typedef struct CompilerOptionLogicVar { + std::string id; + std::string value; + std::string lastWriter; + }; + /** \brief Abstraction layer for handling compilers. * *************** *** 65,68 **** --- 68,76 ---- int supportedVersionInitialized; + std::vector<CompilerOptionLogicVar*> colVariables; + std::vector<std::string> colOptions; + + CBM_COD *cacheOptionDescriptions; + protected: /** Used internally to get information on compiler's binary */ *************** *** 110,113 **** --- 118,124 ---- virtual void supportedVersions(void); + virtual void colDestroy(void); + + public: *************** *** 146,150 **** virtual CBM_COD *OptionDescriptions(void); ! virtual CBM_CEL *OptionLogics(void); virtual int supportedVersionNumber(void); --- 157,173 ---- virtual CBM_COD *OptionDescriptions(void); ! ! virtual CompilerOptionLogicVar* colVarGet(std::string _id); ! ! /** _writerOption is the option (ID) that sets the value */ ! virtual void colVarSet(std::string _id, ! std::string _value, ! std::string _writerOption); ! ! virtual std::string colVarWriter(std::string _id); ! ! virtual int colOptionHas(std::string _option); ! ! virtual std::string analyzeOptions(std::string _options); virtual int supportedVersionNumber(void); Index: Compiler-Option-Description.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Compiler/Compiler-Option-Description.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Compiler-Option-Description.cpp 5 Apr 2007 17:09:09 -0000 1.5 --- Compiler-Option-Description.cpp 12 Apr 2007 19:55:37 -0000 1.6 *************** *** 8,24 **** #include <Compiler/Compiler-Option-Description.h> ! #include <CEL/CEL-Include.h> ! #include <CEL/CEL-Reader.h> ! // #include <CEL/CEL-Stack.h> ! // #include <CEL/CEL-Function.h> ! // #include <CEL/CEL-Version.h> ! // #include <CEL/CEL-Block.h> ! // #include <CEL/CEL-Str.h> #include <Base/XMLReader.h> using namespace CBM; ! CompilerOptionDescription::CompilerOptionDescription(CBM::XMLNode *_from) { int i; --- 8,46 ---- #include <Compiler/Compiler-Option-Description.h> ! #include <Compiler/Compiler-Option-Logic.h> ! #include <Compiler/Compiler.h> + #include <System/System.h> #include <Base/XMLReader.h> using namespace CBM; ! std::vector<std::string> CBM::descriptionIncludePaths; ! ! void CBM::descriptionIncludePathAdd(std::string _path) ! { ! descriptionIncludePaths.push_back(_path); ! } ! ! std::string CBM::descriptionFullIncludeName(std::string _relativeFN) ! { ! int i; ! int n = descriptionIncludePaths.size(); ! std::string r; ! ! for(i=0; i<n; i++) { ! r=descriptionIncludePaths[i]; ! r+="/"; ! r+=_relativeFN; ! if (cbmSystem->fileExists(r)) { ! return(r); ! } ! } ! return(_relativeFN); ! } ! ! ! CompilerOptionDescription::CompilerOptionDescription(CBM::XMLNode *_from, ! CompilerOptionDescriptions *_parent) { int i; *************** *** 27,30 **** --- 49,54 ---- CBM::XMLAttribute *A; + logic=0; + parent=_parent; A=_from->getAttribute("id"); if (A) *************** *** 39,42 **** --- 63,71 ---- if (N->Name() == "editor-description") editorDescription=N->Value(); + if (N->Name() == "logic") { + logic=new CBM::CompilerOptionLogic(_parent, + this, + N); + } } } *************** *** 62,65 **** --- 91,108 ---- } + std::string CompilerOptionDescription::Use(void) + { + std::string tmp; + + if (logic) + return(logic->use()); + else { + tmp="Logic for option "; + tmp+=Id(); + tmp+=" not implemented. Ignored."; + return(tmp); + } + } + CompilerOptionDescription::~CompilerOptionDescription() *************** *** 67,72 **** } ! CompilerOptionDescriptions::CompilerOptionDescriptions(std::string _baseDir) { descriptionFile = _baseDir; descriptionFile+="/description.xml"; --- 110,118 ---- } ! CompilerOptionDescriptions::CompilerOptionDescriptions(CBM::Compiler *_compiler, ! std::string _baseDir) { + compiler=_compiler; + descriptionFile = _baseDir; descriptionFile+="/description.xml"; *************** *** 87,91 **** std::string tmp; ! _fileName=CBM::CelFullIncludeName(_fileName); root=R.read(_fileName); --- 133,137 ---- std::string tmp; ! _fileName=CBM::descriptionFullIncludeName(_fileName); root=R.read(_fileName); *************** *** 104,117 **** N=root->getNode(i); if (N->Name() == "option") { ! D=new CompilerOptionDescription(N); ! options.push_back(D); continue; } if (N->Name() == "include") { ! A=N->getAttribute("description-path"); if (A) { tmp=A->Value(); - tmp+="/description.xml"; parse(tmp); } --- 150,162 ---- N=root->getNode(i); if (N->Name() == "option") { ! D=new CompilerOptionDescription(N, this); ! descriptions.push_back(D); continue; } if (N->Name() == "include") { ! A=N->getAttribute("file"); if (A) { tmp=A->Value(); parse(tmp); } *************** *** 128,132 **** int CompilerOptionDescriptions::DescriptionNumber(void) { ! return(options.size()); } --- 173,177 ---- int CompilerOptionDescriptions::DescriptionNumber(void) { ! return(descriptions.size()); } *************** *** 134,138 **** { if (_index<DescriptionNumber()) ! return(options[_index]); else return(0); --- 179,183 ---- { if (_index<DescriptionNumber()) ! return(descriptions[_index]); else return(0); *************** *** 146,150 **** for(i=0; i<n; i++) { ! D=options[i]; if (D->Id() == _id) return(D); --- 191,195 ---- for(i=0; i<n; i++) { ! D=descriptions[i]; if (D->Id() == _id) return(D); *************** *** 153,156 **** --- 198,221 ---- } + #include <iostream> + CompilerOptionDescription *CompilerOptionDescriptions::DescriptionLitteral(std::string _litt) + { + CompilerOptionDescription *D; + int i; + int n = DescriptionNumber(); + + for(i=0; i<n; i++) { + D=descriptions[i]; + if (D->Option() == _litt) + return(D); + } + return(0); + } + + CBM::Compiler *CompilerOptionDescriptions::Compiler(void) + { + return(compiler); + } + CompilerOptionDescriptions::~CompilerOptionDescriptions() { *************** *** 163,165 **** --- 228,231 ---- delete(D); } + descriptions.clear(); } Index: Compiler-Option-Logic.h =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Compiler/Compiler-Option-Logic.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Compiler-Option-Logic.h 11 Apr 2007 20:31:13 -0000 1.1 --- Compiler-Option-Logic.h 12 Apr 2007 19:55:37 -0000 1.2 *************** *** 14,24 **** namespace CBM { typedef enum CompilerOptionLogicCommandID { ! Unknown, Exclusive, ImpliedBy, Requires, FlagSet, FlagAssert }; typedef struct CompilerOptionLogicCommand { CompilerOptionLogicCommandID id; ! std::string argumentOption; ! std::string extraValue; }; --- 14,26 ---- namespace CBM { typedef enum CompilerOptionLogicCommandID { ! Unknown, Exclusive, ImpliedBy, Requires }; typedef struct CompilerOptionLogicCommand { CompilerOptionLogicCommandID id; ! int testOption; /* 1 for option, 0 internal */ ! std::string internalVarName; /* argumentOption; */ ! std::string internalVarValue; ! std::string optionReferred; }; Index: Compiler-Option-Description.h =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Compiler/Compiler-Option-Description.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Compiler-Option-Description.h 5 Apr 2007 17:08:03 -0000 1.5 --- Compiler-Option-Description.h 12 Apr 2007 19:55:37 -0000 1.6 *************** *** 12,16 **** --- 12,38 ---- #include <Base/XML.h> + #ifdef SWIG + /* !!! If in SWIG parser, we need to define CBM::Plan so that all methods get + * correctly wrapped. Hope there's a better solution... */ + %module CBM + %{ + #include <Compiler/Compiler.h> + #include <Compiler/Compiler-Option-Logic.h> + %} + #define CBM_COM CBM::Compiler + #define CBM_COL CBM::CompilerOptionLogic + #define CBM_CODs CBM::CompilerOptionDescriptions + #else + # define CBM_COM class Compiler + # define CBM_COL class CompilerOptionLogic + # define CBM_CODs class CompilerOptionDescriptions + #endif + namespace CBM { + + extern std::vector<std::string> descriptionIncludePaths; + void descriptionIncludePathAdd(std::string _path); + std::string descriptionFullIncludeName(std::string _relativeFN); + /** \brief Interface helping to describe compiler' option. * Compiler options can be described through XML files to provide both *************** *** 34,37 **** --- 56,62 ---- std::string option; + CBM_CODs *parent; + CBM_COL *logic; + protected: *************** *** 40,44 **** \param _from XML node to initialise object */ ! CompilerOptionDescription(XMLNode *_from); /** Get option's internal ID --- 65,70 ---- \param _from XML node to initialise object */ ! CompilerOptionDescription(XMLNode *_from, ! CBM_CODs *_parent); /** Get option's internal ID *************** *** 58,61 **** --- 84,89 ---- virtual std::string Option(void); + virtual std::string Use(void); + virtual ~CompilerOptionDescription(); }; *************** *** 69,74 **** { private: ! /** Known options */ ! std::vector<CompilerOptionDescription*> options; std::string descriptionFile; --- 97,104 ---- { private: ! /** Descriptions read */ ! std::vector<CompilerOptionDescription*> descriptions; ! CBM_COM *compiler; ! std::string descriptionFile; *************** *** 83,87 **** * \param _baseDir Directory containings description.xml for the compiler */ ! CompilerOptionDescriptions(std::string _baseDir); virtual std::string DescriptionFile(void); --- 113,118 ---- * \param _baseDir Directory containings description.xml for the compiler */ ! CompilerOptionDescriptions(CBM_COM *_compiler, ! std::string _baseDir); virtual std::string DescriptionFile(void); *************** *** 103,106 **** --- 134,141 ---- virtual CompilerOptionDescription *Description(std::string _id); + virtual CompilerOptionDescription *DescriptionLitteral(std::string _litt); + + virtual CBM_COM *Compiler(void); + /** Destructor */ virtual ~CompilerOptionDescriptions(); Index: Compiler.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Compiler/Compiler.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Compiler.cpp 9 Apr 2007 10:07:12 -0000 1.10 --- Compiler.cpp 12 Apr 2007 19:55:37 -0000 1.11 *************** *** 11,19 **** #include <Compiler/Compiler-TCC/Compiler-TCC.h> #include <Compiler/Compiler-Option-Description.h> #include <Plan/Plan.h> ! #include <CEL/CEL-Include.h> ! #include <CEL/CEL-Version.h> ! #include <CEL/CEL-Reader.h> #include <System/System.h> --- 11,23 ---- #include <Compiler/Compiler-TCC/Compiler-TCC.h> #include <Compiler/Compiler-Option-Description.h> + #include <Compiler/Compiler-Version.h> + #include <Plan/Plan.h> ! /* #include <CEL/CEL-Include.h> ! #include <CEL/CEL-Version.h> ! #include <CEL/CEL-Reader.h> ! */ ! #include <System/System.h> *************** *** 31,34 **** --- 35,39 ---- compilerBinary=_compilerBinary; plan=0; + cacheOptionDescriptions=0; } *************** *** 113,117 **** std::string Compiler::relativeDescriptionDirectory(void) { ! CBM::CelVersion V("0.0.0"); int differences; std::string result; --- 118,122 ---- std::string Compiler::relativeDescriptionDirectory(void) { ! CBM::CompilerVersion V; int differences; std::string result; *************** *** 128,143 **** return("!!! no supported version found"); ! V.setInternal(_version); ! v_int=V.AsInteger(); result=supportedVersionDirectories[0]; ! V.setInternal(result); ! c_int=V.AsInteger(); differences=v_int-c_int; for(i=1; i<n; i++) { ! V.setInternal(supportedVersionDirectories[i]); ! c_int=V.AsInteger(); ! if (v_int<c_int) continue; --- 133,144 ---- return("!!! no supported version found"); ! v_int=V.AsInteger(_version); result=supportedVersionDirectories[0]; ! c_int=V.AsInteger(result); differences=v_int-c_int; for(i=1; i<n; i++) { ! c_int=V.AsInteger(supportedVersionDirectories[i]); if (v_int<c_int) continue; *************** *** 148,152 **** } } ! if (differences<0) return("!!! this version is not supported and no compatibility found."); --- 149,153 ---- } } ! if (differences<0) return("!!! this version is not supported and no compatibility found."); *************** *** 157,185 **** CBM::CompilerOptionDescriptions *Compiler::OptionDescriptions(void) { ! std::string tmp = compiler(); ! tmp+="/"; ! tmp+=relativeDescriptionDirectory(); ! return(new CBM::CompilerOptionDescriptions(tmp)); } ! #include <iostream> ! CBM::CelAtom *Compiler::OptionLogics(void) { ! std::string tmp = compiler(); ! CBM::CelReader *R; ! CBM::CelAtom *A; ! tmp+="/"; ! tmp+=relativeDescriptionDirectory(); ! tmp+="/options.xml"; ! R=new CBM::CelReader(tmp); ! std::cerr << "CEL : " << tmp << std::endl; ! A=R->parse(); ! delete(R); ! if (A) ! A->Evaluate(); ! return(A); } --- 158,272 ---- CBM::CompilerOptionDescriptions *Compiler::OptionDescriptions(void) { ! std::string tmp; ! ! if (!cacheOptionDescriptions) { ! tmp = compiler(); ! tmp+="/"; ! tmp+=relativeDescriptionDirectory(); ! cacheOptionDescriptions=new CBM::CompilerOptionDescriptions(this, tmp); ! } ! ! return(cacheOptionDescriptions); } ! CompilerOptionLogicVar* Compiler::colVarGet(std::string _id) { ! int i = 0; ! int n = colVariables.size(); ! CompilerOptionLogicVar *tmp; ! ! for(i=0; i<n; i++) { ! tmp=colVariables[i]; ! if (tmp->id==_id) ! return(tmp); ! } ! return(0); ! } ! void Compiler::colVarSet(std::string _id, ! std::string _value, ! std::string _writerOption) ! { ! CompilerOptionLogicVar *tmp = colVarGet(_id); ! if (!tmp) { ! tmp=new CompilerOptionLogicVar; ! tmp->id=_id; ! colVariables.push_back(tmp); ! } ! tmp->value=_value; ! tmp->lastWriter=_writerOption; ! } ! ! std::string Compiler::colVarWriter(std::string _id) ! { ! CompilerOptionLogicVar *tmp = colVarGet(_id); ! ! if (tmp) ! return(tmp->lastWriter); ! else ! return("undef"); ! } ! ! int Compiler::colOptionHas(std::string _option) ! { ! int i = 0; ! int n = colOptions.size(); ! ! for(i=0; i<n; i++) { ! if (colOptions[i] == _option) ! return(1); ! } ! return(0); ! } ! ! std::string Compiler::analyzeOptions(std::string _options) ! { ! int i = 0; ! std::string o = "!"; ! CompilerOptionDescriptions *OD; ! CompilerOptionDescription *D; ! std::string r; ! int times = 0; ! int lastOk = 0; ! std::string tmp; ! ! while (o!="") { ! o=cbmSystem->Split(_options, " ", i++); ! if (o=="") ! break; ! times++; ! OD=OptionDescriptions(); ! D=OD->DescriptionLitteral(o); ! if (!D) { ! r+="Ignored option "; ! r+=o; ! r+=" (not supported)\n"; ! lastOk=1; ! } else { ! tmp=D->Use(); ! lastOk=(tmp=="1"); ! r+=tmp; ! r+="\n"; ! } ! if (lastOk) ! if (colOptionHas(D->Id())) { ! tmp="Option "; ! tmp+=o; ! tmp+=" given multiple times"; ! r+=tmp; ! r+="\n"; ! } else { ! colOptions.push_back(D->Id()); ! } ! } ! ! colDestroy(); ! ! if (!times) ! r="1\n"; ! ! return(r); } *************** *** 187,191 **** { int i; ! int n = CBM::celincludespaths.size(); std::string dum; --- 274,278 ---- { int i; ! int n = CBM::descriptionIncludePaths.size(); std::string dum; *************** *** 195,199 **** supportedVersionInitialized=1; for(i=0; i<n; i++) { ! dum=CBM::celincludespaths[i]; dum+="/"; dum+=compiler(); --- 282,286 ---- supportedVersionInitialized=1; for(i=0; i<n; i++) { ! dum=CBM::descriptionIncludePaths[i]; dum+="/"; dum+=compiler(); *************** *** 202,209 **** } int Compiler::supportedVersionNumber(void) { ! if (!supportedVersionInitialized) ! supportedVersions(); return(supportedVersionDirectories.size()); --- 289,309 ---- } + void Compiler::colDestroy(void) + { + std::vector<std::string> ncolOptions; + int i; + int n; + + colOptions=ncolOptions; + + n=colVariables.size(); + for(i=0;i<n;i++) + delete(colVariables[i]); + colVariables.clear(); + } + int Compiler::supportedVersionNumber(void) { ! supportedVersions(); return(supportedVersionDirectories.size()); *************** *** 212,217 **** std::string Compiler::supportedVersion(int _index) { ! if (!supportedVersionInitialized) ! supportedVersions(); if (_index<supportedVersionNumber()) --- 312,316 ---- std::string Compiler::supportedVersion(int _index) { ! supportedVersions(); if (_index<supportedVersionNumber()) *************** *** 224,227 **** --- 323,328 ---- { setPlan(0, 1); + if (cacheOptionDescriptions) + delete(cacheOptionDescriptions); } Index: Compiler-Option-Logic.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Compiler/Compiler-Option-Logic.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Compiler-Option-Logic.cpp 11 Apr 2007 20:31:13 -0000 1.1 --- Compiler-Option-Logic.cpp 12 Apr 2007 19:55:37 -0000 1.2 *************** *** 34,39 **** cmd=new CompilerOptionLogicCommand; cmd->id=Exclusive; ! cmd->argumentOption=A->Value(); ! cmd->extraValue=_description->Id(); commands.push_back(cmd); continue; --- 34,48 ---- cmd=new CompilerOptionLogicCommand; cmd->id=Exclusive; ! ! cmd->internalVarName=A->Value(); ! A=N->getAttribute("value"); ! ! if (!A) { ! cmd->testOption=1; ! cmd->optionReferred=_description->Id(); ! } else { ! cmd->testOption=0; ! cmd->internalVarValue=A->Value(); ! } commands.push_back(cmd); continue; *************** *** 46,51 **** cmd=new CompilerOptionLogicCommand; cmd->id=ImpliedBy; ! cmd->argumentOption=A->Value(); ! cmd->extraValue=""; commands.push_back(cmd); continue; --- 55,60 ---- cmd=new CompilerOptionLogicCommand; cmd->id=ImpliedBy; ! cmd->optionReferred=A->Value(); ! cmd->testOption=1; commands.push_back(cmd); continue; *************** *** 58,108 **** cmd=new CompilerOptionLogicCommand; cmd->id=Requires; ! cmd->argumentOption=A->Value(); ! cmd->extraValue=""; ! commands.push_back(cmd); ! continue; ! } ! ! ! if (N->Name() == "logic-flag-set") { ! A=N->getAttribute("id"); ! if (!A) ! continue; ! cmd=new CompilerOptionLogicCommand; ! cmd->id=FlagSet; ! cmd->argumentOption=A->Value(); ! ! A=N->getAttribute("value"); ! if (!A) ! cmd->extraValue="0"; ! else ! cmd->extraValue=A->Value(); ! ! commands.push_back(cmd); ! continue; ! } ! ! if (N->Name() == "logic-flag-assert") { ! A=N->getAttribute("id"); ! if (!A) ! continue; ! cmd=new CompilerOptionLogicCommand; ! cmd->id=FlagAssert; ! cmd->argumentOption=A->Value(); ! ! A=N->getAttribute("value"); ! if (!A) ! cmd->extraValue="0"; ! else ! cmd->extraValue=A->Value(); ! commands.push_back(cmd); continue; } - } - } std::string CompilerOptionLogic::use(void) { --- 67,79 ---- cmd=new CompilerOptionLogicCommand; cmd->id=Requires; ! cmd->optionReferred=A->Value(); ! cmd->testOption=1; commands.push_back(cmd); continue; } } } + #include <iostream> std::string CompilerOptionLogic::use(void) { *************** *** 111,133 **** CBM::CompilerOptionLogicCommand *cmd; CBM::Compiler *C = context->Compiler(); ! ! CBM::CompilerOptionLogicFlag *flag; CBM::CompilerOptionLogicVar *var; std::string tmp; ! for(i=0; i<n; i++) { cmd=commands[i]; switch(cmd->id) { case Exclusive: ! var=C->colVarGet(cmd->argumentOption); if (!var) { ! C->colVarSet(cmd->argumentOption, ! cmd->extraValue); } else { ! if (var->value!=cmd->extraValue) { tmp="Option "; ! tmp+=context->Description(cmd->extraValue)->Option(), tmp+=" is incompatible with "; ! tmp+=context->Description(var->value)->Option(); return(tmp); } --- 82,120 ---- CBM::CompilerOptionLogicCommand *cmd; CBM::Compiler *C = context->Compiler(); ! CBM::CompilerOptionDescription *D; CBM::CompilerOptionLogicVar *var; std::string tmp; ! ! std::string varname; ! std::string varvalue; ! for(i=0; i<n; i++) { cmd=commands[i]; switch(cmd->id) { case Exclusive: ! varname=cmd->internalVarName; ! var=C->colVarGet(varname); ! ! if (cmd->testOption) ! varvalue=cmd->optionReferred; ! else ! varvalue=cmd->internalVarValue; ! if (!var) { ! C->colVarSet(varname, ! varvalue, ! description->Id()); } else { ! if (var->value!=varvalue) { tmp="Option "; ! tmp+=description->Option(); ! tmp+=" is incompatible with "; ! if (cmd->testOption) { ! D=context->Description(var->value); ! tmp+=D->Option(); ! } else { ! tmp+=context->Description(var->lastWriter)->Option(); ! } return(tmp); } *************** *** 135,181 **** break; case ImpliedBy: ! if (C->colOptionHas(cmd->argumentOption)) { tmp="Option "; tmp+=description->Option(); tmp+=" is implied by "; ! tmp+=context->Description(cmd->argumentOption)->Option(); return(tmp); } break; case Requires: ! if (!C->colOptionHas(cmd->argumentOption)) { tmp="Option "; tmp+=description->Option(); ! tmp+=" requieres "; ! tmp+=context->Description(cmd->argumentOption)->Option(); ! return(tmp); ! } ! break; ! case FlagSet: ! C->colFlagSet(cmd->argumentOption, ! cmd->extraValue); ! break; ! case FlagAssert: ! flag=C->colFlagGet(cmd->argumentOption); ! if ((!flag) && (cmd->extraValue=="0")) ! return("1"); ! ! if (((flag) && (flag->value!=cmd->extraValue)) || ! (!flag)) { ! tmp="Check failed : "; ! tmp+=context->Description(cmd->argumentOption)->Option(); ! tmp+=" must be "; ! tmp+=cmd->extraValue; ! if (flag) { ! tmp+=" (has "; ! tmp+=flag->value; ! tmp+=")"; ! } else { ! tmp+=" (not defined)"; ! } return(tmp); } break; - default: return("Unknown command in option analyzing"); --- 122,142 ---- break; case ImpliedBy: ! if (C->colOptionHas(cmd->optionReferred)) { tmp="Option "; tmp+=description->Option(); tmp+=" is implied by "; ! tmp+=context->Description(cmd->optionReferred)->Option(); return(tmp); } break; case Requires: ! if (!C->colOptionHas(cmd->optionReferred)) { tmp="Option "; tmp+=description->Option(); ! tmp+=" requires "; ! tmp+=context->Description(cmd->optionReferred)->Option(); return(tmp); } break; default: return("Unknown command in option analyzing"); |