Files Classes Functions Hierarchy
#include <mkerrorsconfig.h>
Public Member Functions | |
| boolc | read () |
| Read the configuration file. | |
| mkerrorsconfig () | |
| Load default compiler tags. | |
| boolc | find (mkerrorscompiletag &ct, stringc &id) const |
| Find first compiletag matching the id. | |
Public Attributes | |
| bool | globalconfigfile_exists |
| deque< mkerrorscompiletag > | vi |
| Unique list of compiler tags. | |
Static Public Attributes | |
| static string | globalconfigfile = "../mkerrorsconfig.txt" |
| Name of configuration file in top directory. | |
Loads compilertag configuration.
<mkerrorsconfig> <vi> <compilertag> <id>debug_example1</id> <command>CC="g++ -fno-implicit-inline-templates -fno-rtti"</command> <libraries></libraries> .... </vi> </mkerrorsconfig>
The order of settings is important. By definition a tag closer to the front overrides a previous tag with the same name. So you can override a default tag.
Merged tags NOT supported, except for libraries which is handled in mkerrorscompile class. If the libraries file is present the contents overwrites the libraries setting.
Definition at line 35 of file mkerrorsconfig.h.
| mkerrorsconfig::mkerrorsconfig | ( | ) |
Load default compiler tags.
Definition at line 10 of file mkerrorsconfig.cpp.
References globalconfigfile_exists, and vi.
00011 { 00012 globalconfigfile_exists=false; 00013 00014 string lib; 00015 vi.push_back( mkerrorscompiletag("debug","make",lib) ); 00016 vi.push_back( mkerrorscompiletag("gdb","make CC=\"g++ -g -Wall\"",lib) ); 00017 vi.push_back( mkerrorscompiletag("gprof","make CC=\"g++ -pg -g -Wall\"",lib) ); 00018 vi.push_back( mkerrorscompiletag("release","make CC=\"g++ -DNDEBUG -O3 -Wall\"",lib) ); 00019 vi.push_back( mkerrorscompiletag("clean","make clean","") ); 00020 }
| boolc mkerrorsconfig::find | ( | mkerrorscompiletag & | ct, | |
| stringc & | id | |||
| ) | const |
Find first compiletag matching the id.
Definition at line 99 of file mkerrorsconfig.cpp.
Referenced by mkerrorscompile::eval2(), and mkerrorstest::unittest01().
00103 { 00104 // Reset. 00105 ct=mkerrorscompiletag(); 00106 00107 // Find first match and return. 00108 uint imax=vi.size(); 00109 for (uint i=0; i<imax; ++i) 00110 { 00111 if (vi[i].id==id) 00112 { 00113 ct=vi[i]; 00114 return true; 00115 } 00116 } 00117 00118 return false; 00119 }
| boolc mkerrorsconfig::read | ( | ) |
Read the configuration file.
Can override defaults.
Definition at line 22 of file mkerrorsconfig.cpp.
References globalconfigfile, globalconfigfile_exists, tokenizerlocal::read(), tokenizerlocal::reset(), tokenizerlocal::scope(), filestring::serialize(), and vi.
Referenced by mkerrorscompile::eval2(), and mkerrorstest::unittest01().
00023 { 00024 // Look for global config file 00025 // if present load it. 00026 00027 // Overwrite default settings. 00028 // e.g. if same tag then replace 00029 00030 globalconfigfile_exists=true; 00031 string str; 00032 globalconfigfile_exists &= filestring::serialize(str,globalconfigfile); 00033 00034 //cout << "read" << endl; 00035 //cout << SHOW3(str) << endl; 00036 00037 if (globalconfigfile_exists==false) 00038 return false; 00039 00040 tokenizer tk(str); 00041 tokenizerlocal tl1(tk); 00042 tl1.scope("vi"); 00043 //cout << SHOW3(tl1.debug01()) << endl; 00044 00045 // for (tl1.reset(); !tl1; ++tl1) 00046 // { 00047 // cout << SHOW3(tl1()) << endl; 00048 // } 00049 00050 string id; 00051 string command; 00052 string libraries; 00053 00054 // Have the compiler tags inserted in order that client would expect. 00055 // i.e. first to last are inserted in front as first to last. 00056 00057 deque<mkerrorscompiletag> vi2; 00058 00059 // Make robust and have the tags read order independent 00060 00061 tokenizerlocalvar tl2(tl1,"compiletag"); 00062 //cout << SHOW3(tl2.debug01()) << endl; 00063 // tl2.reset(); 00064 // for ( ; tl2.scope("compiletag"); ++tl2) 00065 for ( ; !tl2; ++tl2) 00066 { 00067 //cout << SHOW3(tl2.debug01()) << endl; 00068 00069 id.clear(); 00070 command.clear(); 00071 libraries.clear(); 00072 00073 // Have a valid data structure 00074 // e.g. id and command required (at present, could do merging...) 00075 00076 tokenizerlocal tl3(tl2); 00077 if (tl3.read(id,"id")==false) 00078 continue; 00079 tl3.reset(); 00080 if (tl3.read(command,"command")==false) 00081 continue; 00082 tl3.reset(); 00083 tl3.read(libraries,"libraries"); 00084 00085 vi2.push_front( mkerrorscompiletag(id,command,libraries) ); 00086 } 00087 00088 if (vi2.empty()==false) 00089 { 00090 uint imax=vi2.size(); 00091 for (uint i=0; i<imax; ++i) 00092 vi.push_front( vi2[i] ); 00093 } 00094 00095 return true; 00096 }
string mkerrorsconfig::globalconfigfile = "../mkerrorsconfig.txt" [static] |
Name of configuration file in top directory.
Definition at line 43 of file mkerrorsconfig.h.
Referenced by read(), and mkerrorstest::unittest01().
Definition at line 40 of file mkerrorsconfig.h.
Referenced by mkerrorsconfig(), read(), and mkerrorstest::unittest01().
Unique list of compiler tags.
Definition at line 52 of file mkerrorsconfig.h.
Referenced by mkerrorscompile::eval2(), mkerrorsconfig(), read(), and mkerrorstest::unittest01().
1.5.8