@@ -27,27 +27,6 @@ Library::Library() : allocid(0)
2727{
2828}
2929
30- Library::Library (const Library &lib) :
31- use(lib.use),
32- leakignore(lib.leakignore),
33- argumentChecks(lib.argumentChecks),
34- returnuninitdata(lib.returnuninitdata),
35- allocid(lib.allocid),
36- _alloc(lib._alloc),
37- _dealloc(lib._dealloc),
38- _noreturn(lib._noreturn),
39- _ignorefunction(lib._ignorefunction),
40- _reporterrors(lib._reporterrors),
41- _fileextensions(lib._fileextensions),
42- _keywords(lib._keywords),
43- _executableblocks(lib._executableblocks),
44- _importers(lib._importers),
45- _reflection(lib._reflection)
46- {
47- }
48-
49- Library::~Library () { }
50-
5130bool Library::load (const char exename[], const char path[])
5231{
5332 tinyxml2::XMLDocument doc;
@@ -77,9 +56,7 @@ bool Library::load(const char exename[], const char path[])
7756
7857 if (fp==NULL ) {
7958 // Try to locate the library configuration in the installation folder..
80- std::string temp = exename;
81- std::replace (temp.begin (), temp.end (), ' \\ ' , ' /' );
82- const std::string installfolder = Path::getPathFromFilename (temp);
59+ const std::string installfolder = Path::fromNativeSeparators (Path::getPathFromFilename (exename));
8360 const std::string filename = installfolder + " cfg/" + fullfilename;
8461 fp = fopen (filename.c_str (), " rb" );
8562 }
@@ -169,13 +146,9 @@ bool Library::load(const char exename[], const char path[])
169146 for (const tinyxml2::XMLElement *functionnode = node->FirstChildElement (); functionnode; functionnode = functionnode->NextSiblingElement ()) {
170147 if (strcmp (functionnode->Name (), " library" ) == 0 ) {
171148 const char * const extension = functionnode->Attribute (" extension" );
172- if (_keywords.find (extension) == _keywords.end ()) {
173- std::list<std::string> list;
174- _keywords[extension] = list;
175- }
176149 for (const tinyxml2::XMLElement *librarynode = functionnode->FirstChildElement (); librarynode; librarynode = librarynode->NextSiblingElement ()) {
177150 if (strcmp (librarynode->Name (), " keyword" ) == 0 ) {
178- _keywords. at ( extension) .push_back (librarynode->Attribute (" name" ));
151+ _keywords[ extension] .push_back (librarynode->Attribute (" name" ));
179152 } else
180153 return false ;
181154 }
@@ -188,15 +161,7 @@ bool Library::load(const char exename[], const char path[])
188161 for (const tinyxml2::XMLElement *functionnode = node->FirstChildElement (); functionnode; functionnode = functionnode->NextSiblingElement ()) {
189162 if (strcmp (functionnode->Name (), " exporter" ) == 0 ) {
190163 const char * prefix = (functionnode->Attribute (" prefix" ));
191- if (prefix) {
192- std::map<std::string, ExportedFunctions>::const_iterator
193- it = _exporters.find (prefix);
194- if (it == _exporters.end ()) {
195- // add the missing list for later on
196- ExportedFunctions exporter;
197- _exporters[prefix] = exporter;
198- }
199- } else
164+ if (!prefix)
200165 return false ;
201166
202167 for (const tinyxml2::XMLElement *enode = functionnode->FirstChildElement (); enode; enode = enode->NextSiblingElement ()) {
@@ -216,13 +181,9 @@ bool Library::load(const char exename[], const char path[])
216181 for (const tinyxml2::XMLElement *functionnode = node->FirstChildElement (); functionnode; functionnode = functionnode->NextSiblingElement ()) {
217182 if (strcmp (functionnode->Name (), " library" ) == 0 ) {
218183 const char * const extension = functionnode->Attribute (" extension" );
219- if (_importers.find (extension) == _importers.end ()) {
220- std::list<std::string> list;
221- _importers[extension] = list;
222- }
223184 for (const tinyxml2::XMLElement *librarynode = functionnode->FirstChildElement (); librarynode; librarynode = librarynode->NextSiblingElement ()) {
224185 if (strcmp (librarynode->Name (), " importer" ) == 0 ) {
225- _importers. at ( extension) .push_back (librarynode->Attribute (" name" ));
186+ _importers[ extension] .push_back (librarynode->Attribute (" name" ));
226187 } else
227188 return false ;
228189 }
@@ -234,15 +195,11 @@ bool Library::load(const char exename[], const char path[])
234195 for (const tinyxml2::XMLElement *functionnode = node->FirstChildElement (); functionnode; functionnode = functionnode->NextSiblingElement ()) {
235196 if (strcmp (functionnode->Name (), " library" ) == 0 ) {
236197 const char * const extension = functionnode->Attribute (" extension" );
237- if (_reflection.find (extension) == _reflection.end ()) {
238- std::map<std::string,int > map;
239- _reflection[extension] = map;
240- }
241198 for (const tinyxml2::XMLElement *librarynode = functionnode->FirstChildElement (); librarynode; librarynode = librarynode->NextSiblingElement ()) {
242199 if (strcmp (librarynode->Name (), " call" ) == 0 ) {
243200 const char * const argString = librarynode->Attribute (" arg" );
244201 if (argString) {
245- _reflection. at ( extension) [librarynode->Attribute (" name" )]
202+ _reflection[ extension] [librarynode->Attribute (" name" )]
246203 = atoi (argString);
247204 }
248205 } else
@@ -257,23 +214,19 @@ bool Library::load(const char exename[], const char path[])
257214 for (const tinyxml2::XMLElement *functionnode = node->FirstChildElement (); functionnode; functionnode = functionnode->NextSiblingElement ()) {
258215 if (strcmp (functionnode->Name (), " library" ) == 0 ) {
259216 const char * const extension = functionnode->Attribute (" extension" );
260- if (_executableblocks.find (extension) == _executableblocks.end ()) {
261- CodeBlock blockInfo;
262- _executableblocks[extension] = blockInfo;
263- }
264217 for (const tinyxml2::XMLElement *librarynode = functionnode->FirstChildElement (); librarynode; librarynode = librarynode->NextSiblingElement ()) {
265218 if (strcmp (librarynode->Name (), " block" ) == 0 ) {
266- _executableblocks. at ( extension) .addBlock (librarynode->Attribute (" name" ));
219+ _executableblocks[ extension] .addBlock (librarynode->Attribute (" name" ));
267220 } else if (strcmp (librarynode->Name (), " structure" ) == 0 ) {
268221 const char * start = librarynode->Attribute (" start" );
269222 if (start)
270- _executableblocks. at ( extension) .setStart (start);
223+ _executableblocks[ extension] .setStart (start);
271224 const char * end = librarynode->Attribute (" end" );
272225 if (end)
273- _executableblocks. at ( extension) .setEnd (end);
226+ _executableblocks[ extension] .setEnd (end);
274227 const char * offset = librarynode->Attribute (" offset" );
275228 if (offset)
276- _executableblocks. at ( extension) .setOffset (atoi (offset));
229+ _executableblocks[ extension] .setOffset (atoi (offset));
277230 } else
278231 return false ;
279232 }
0 commit comments