Commit d3b80b5c authored by Pierre Aubert's avatar Pierre Aubert
Browse files

Update error check and argument output

parent 3b8b2f9c
......@@ -113,7 +113,7 @@ std::string cpp_backendProxyLoaderParseArchFileSource(const PVecArchLib & vecArc
body += "bool "+className+"::parseArchFile(const std::string & archfileName){\n";
body += "\tFILE * fp = fopen(archfileName.c_str(), \"r\");\n";
body += "\tif(fp == NULL){\n";
body += "\t\tstd::cerr << \"Cannot open file '/proc/cpuinfo'\" << std::endl;\n";
body += "\t\tstd::cerr << \"Cannot open file '\" << archfileName << \"'\" << std::endl;\n";
body += "\t\treturn false;\n";
body += "\t}\n";
body += "\t//Let's get the file size\n";
......@@ -128,6 +128,7 @@ std::string cpp_backendProxyLoaderParseArchFileSource(const PVecArchLib & vecArc
body += "\t//And load the file\n";
body += "\tif(fread(procCpuInfo, sizeof(char), fileSize, fp) != fileSize){return false;}\n";
body += "\t//Let's check the avalaible architectures\n";
body += "\tbool isLibFound(true);\n";
std::string strElse("\t");
for(PVecArchLib::const_reverse_iterator it(vecArchLib.rbegin()); it != vecArchLib.rend(); ++it){
body += strElse + "if(strstr(procCpuInfo, \""+it->getArchitecture()+"\") != NULL){\n";
......@@ -136,10 +137,11 @@ std::string cpp_backendProxyLoaderParseArchFileSource(const PVecArchLib & vecArc
body += "\t}";
strElse = "else ";
}
body += "else{\n\t\tisLibFound = false;\n\t}\n";
body += "\n";
body += "\tfclose(fp);\n";
body += "\tdelete [] procCpuInfo;\n";
body += "\treturn true;\n";
body += "\treturn isLibFound;\n";
body += "}\n\n";
return body;
}
......@@ -226,7 +228,7 @@ std::string cpp_backendProxyLoaderSource(const PVecSource & vecSource, const PVe
body += "\n#include \""+className+".h\"\n\n";
body += "///Variable which will load automatically the right library by respect to the given architecture\n";
body += className + " PROXY_LOADER;\n\n";
std::string defaultLib(getLibraryFile(vecArchLib));
std::string defaultLib(getFileName(getLibraryFile(vecArchLib)));
body += cpp_backendProxyLoaderConstructorSource(className, defaultLib);
body += cpp_backendProxyLoaderDesonstructorSource(className);
body += cpp_backendProxyLoaderLoadSource(className);
......
......@@ -33,7 +33,7 @@ PArchLib createArchLib(const std::string & arch, const std::string & libName){
*/
void addArch(PVecArchLib & vecArch, const std::string & arch, const std::string & libName){
if(libName != ""){
vecArch.push_back(createArchLib("anyarch", libName));
vecArch.push_back(createArchLib(arch, libName));
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment