Commit fd3ef7da authored by Ben Boeckel's avatar Ben Boeckel
Browse files

ClientServer: always use the basename for the dummy function name

parent fe4e12c5
...@@ -1107,14 +1107,18 @@ int extractOtherClassesUsed(NewClassInfo* data, const char* classes[]) ...@@ -1107,14 +1107,18 @@ int extractOtherClassesUsed(NewClassInfo* data, const char* classes[])
* @param fp file to write into * @param fp file to write into
* @param data data which will be used to write into file * @param data data which will be used to write into file
*/ */
void output_DummyInitFunction(FILE* fp, const char* name) void output_DummyInitFunction(FILE* fp, const char* filename)
{ {
char* basename = strrchr(filename, '/');
char* basename_dup = strdup(basename + 1);
*strchr(basename_dup, '.') = '\0';
fprintf(fp, "#include \"vtkSystemIncludes.h\"\n" fprintf(fp, "#include \"vtkSystemIncludes.h\"\n"
"#include \"vtkClientServerInterpreter.h\"\n" "#include \"vtkClientServerInterpreter.h\"\n"
"void VTK_EXPORT %s_Init(vtkClientServerInterpreter* /*csi*/)\n" "void VTK_EXPORT %s_Init(vtkClientServerInterpreter* /*csi*/)\n"
"{\n" "{\n"
"}\n", "}\n",
name); basename_dup);
free(basename_dup);
} }
//--------------------------------------------------------------------------nix //--------------------------------------------------------------------------nix
...@@ -1265,18 +1269,14 @@ int main(int argc, char* argv[]) ...@@ -1265,18 +1269,14 @@ int main(int argc, char* argv[])
if (!data) if (!data)
{ {
char* basename = strrchr(fileInfo->FileName, '/'); output_DummyInitFunction(fp, fileInfo->FileName);
char* basename_dup = strdup(basename);
*strchr(basename_dup, '.') = '\0';
output_DummyInitFunction(fp, basename_dup + 1);
free(basename_dup);
fclose(fp); fclose(fp);
exit(0); exit(0);
} }
if (data->Template) if (data->Template)
{ {
output_DummyInitFunction(fp, data->Name); output_DummyInitFunction(fp, fileInfo->FileName);
fclose(fp); fclose(fp);
exit(0); exit(0);
} }
...@@ -1285,7 +1285,7 @@ int main(int argc, char* argv[]) ...@@ -1285,7 +1285,7 @@ int main(int argc, char* argv[])
{ {
if (strchr(data->SuperClasses[i], '<')) if (strchr(data->SuperClasses[i], '<'))
{ {
output_DummyInitFunction(fp, data->Name); output_DummyInitFunction(fp, fileInfo->FileName);
fclose(fp); fclose(fp);
exit(0); exit(0);
} }
...@@ -1309,7 +1309,7 @@ int main(int argc, char* argv[]) ...@@ -1309,7 +1309,7 @@ int main(int argc, char* argv[])
{ {
if (!vtkWrap_IsTypeOf(hierarchyInfo, data->Name, "vtkObjectBase")) if (!vtkWrap_IsTypeOf(hierarchyInfo, data->Name, "vtkObjectBase"))
{ {
output_DummyInitFunction(fp, data->Name); output_DummyInitFunction(fp, fileInfo->FileName);
fclose(fp); fclose(fp);
exit(0); exit(0);
} }
......
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