FIX: la commande créait du code C++. Du code C devrait faire l'affaire.

This commit is contained in:
Sebastien Barre 2002-07-30 10:23:39 -04:00
parent 7dffa485f6
commit f87057813d
1 changed files with 11 additions and 8 deletions

View File

@ -159,13 +159,14 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& argsIn)
"\n"
"char* lowercase(const char *string)\n"
"{\n"
" char *new_string = new char[strlen(string) + 1];\n"
" char *new_string, *p;\n"
" new_string = new char[strlen(string) + 1];\n"
" if (!new_string)\n"
" {\n"
" return NULL;\n"
" }\n"
" strcpy(new_string, string);\n"
" char *p = new_string;\n"
" p = new_string;\n"
" while (*p != 0)\n"
" {\n"
" *p = tolower(*p);\n"
@ -176,8 +177,10 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& argsIn)
"\n"
"int main(int ac, char** av)\n"
"{\n"
" int NumTests = " << numTests << ";\n"
" int i;\n"
" int NumTests, i, testNum, partial_match;\n"
" char *arg, *test_name;\n"
" \n"
" NumTests = " << numTests << ";\n"
" \n"
" // If no test name was given\n";
if(function.size())
@ -202,7 +205,7 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& argsIn)
" printf(\"%3d. %s\\n\", i, cmakeGeneratedFunctionMapEntries[i].name);\n"
" }\n"
" printf(\"To run a test, enter the test number: \");\n"
" int testNum = 0;\n"
" testNum = 0;\n"
" scanf(\"%d\", &testNum);\n"
" if (testNum >= NumTests)\n"
" {\n"
@ -213,17 +216,17 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& argsIn)
" }\n"
" \n"
" // If partial match is requested\n"
" int partial_match = (strcmp(av[1], \"-R\") == 0) ? 1 : 0;\n"
" partial_match = (strcmp(av[1], \"-R\") == 0) ? 1 : 0;\n"
" if (partial_match && ac < 3)\n"
" {\n"
" printf(\"-R needs an additional parameter.\\n\");\n"
" return -1;\n"
" }\n"
" \n"
" char *arg = lowercase(av[1 + partial_match]);\n"
" arg = lowercase(av[1 + partial_match]);\n"
" for (i =0; i < NumTests; ++i)\n"
" {\n"
" char *test_name = lowercase(cmakeGeneratedFunctionMapEntries[i].name);\n"
" test_name = lowercase(cmakeGeneratedFunctionMapEntries[i].name);\n"
" if (partial_match && strstr(test_name, arg) != NULL)\n"
" {\n"
" return (*cmakeGeneratedFunctionMapEntries[i].func)(ac - 2, av + 2);\n"