diff --git a/SWIG/Source/Modules/browser.cxx b/SWIG/Source/Modules/browser.cxx index 317426f9c..31f9249f4 100644 --- a/SWIG/Source/Modules/browser.cxx +++ b/SWIG/Source/Modules/browser.cxx @@ -177,8 +177,8 @@ void exit_handler(FILE *f) { static void display(FILE *f, Node *n) { /* Print standard HTML header */ - Printf(f, "SWIG-%s\n", PACKAGE_VERSION); - Printf(f, "SWIG-%s
\n", PACKAGE_VERSION); + Printf(f, "SWIG-%s\n", Swig_package_version()); + Printf(f, "SWIG-%s
\n", Swig_package_version()); Printf(f, "[ Exit ]"); Printf(f, " [ Top ]", tree_top); if (n != tree_top) { @@ -296,8 +296,8 @@ void data_handler(FILE *f) { if (!swill_getargs("p(n)", &n)) { n = 0; } - Printf(f, "SWIG-%s\n", PACKAGE_VERSION); - Printf(f, "SWIG-%s
\n", PACKAGE_VERSION); + Printf(f, "SWIG-%s\n", Swig_package_version()); + Printf(f, "SWIG-%s
\n", Swig_package_version()); Printf(f, "[ Exit ]"); Printf(f, " [ Top ]", tree_top); Printf(f, "

\n"); @@ -312,8 +312,8 @@ void symbol_handler(FILE *f) { Symtab *sym; char *name = 0; - Printf(f, "SWIG-%s\n", PACKAGE_VERSION); - Printf(f, "SWIG-%s
\n", PACKAGE_VERSION); + Printf(f, "SWIG-%s\n", Swig_package_version()); + Printf(f, "SWIG-%s
\n", Swig_package_version()); Printf(f, "[ Exit ]"); Printf(f, " [ Top ]", tree_top); Printf(f, " [ Symbols ]"); diff --git a/SWIG/Source/Modules/csharp.cxx b/SWIG/Source/Modules/csharp.cxx index fd26ab908..293e097e5 100644 --- a/SWIG/Source/Modules/csharp.cxx +++ b/SWIG/Source/Modules/csharp.cxx @@ -590,7 +590,7 @@ public: void emitBanner(File *f) { Printf(f, "/* ----------------------------------------------------------------------------\n"); Printf(f, " * This file was automatically generated by SWIG (http://www.swig.org).\n"); - Printf(f, " * Version %s\n", PACKAGE_VERSION); + Printf(f, " * Version %s\n", Swig_package_version()); Printf(f, " *\n"); Printf(f, " * Do not make changes to this file unless you know what you are doing--modify\n"); Printf(f, " * the SWIG interface file instead.\n"); diff --git a/SWIG/Source/Modules/java.cxx b/SWIG/Source/Modules/java.cxx index bea066c3c..356750eb0 100644 --- a/SWIG/Source/Modules/java.cxx +++ b/SWIG/Source/Modules/java.cxx @@ -655,7 +655,7 @@ public: void emitBanner(File *f) { Printf(f, "/* ----------------------------------------------------------------------------\n"); Printf(f, " * This file was automatically generated by SWIG (http://www.swig.org).\n"); - Printf(f, " * Version %s\n", PACKAGE_VERSION); + Printf(f, " * Version %s\n", Swig_package_version()); Printf(f, " *\n"); Printf(f, " * Do not make changes to this file unless you know what you are doing--modify\n"); Printf(f, " * the SWIG interface file instead.\n"); diff --git a/SWIG/Source/Modules/main.cxx b/SWIG/Source/Modules/main.cxx index 3fccfbb99..0b3b8496b 100644 --- a/SWIG/Source/Modules/main.cxx +++ b/SWIG/Source/Modules/main.cxx @@ -166,13 +166,6 @@ static String *dependencies_file = 0; static File *f_dependencies_file = 0; static int external_runtime = 0; static String *external_runtime_name = 0; -static char *fake_version = 0; - -static const char *swig_package_version() { - return fake_version ? fake_version : PACKAGE_VERSION; -} - - // ----------------------------------------------------------------------------- // check_suffix(char *name) @@ -249,14 +242,7 @@ static void set_outdir(const String *c_wrapper_file_dir) { outdir = NewString(c_wrapper_file_dir); } -//----------------------------------------------------------------- -// main() -// -// Main program. Initializes the files and starts the parser. -//----------------------------------------------------------------- - /* This function sets the name of the configuration file */ - void SWIG_config_file(const String_or_char *filename) { lang_config = NewString(filename); } @@ -554,19 +540,19 @@ void SWIG_getoptions(int argc, char *argv[]) { } else if (strcmp(argv[i], "-fakeversion") == 0) { Swig_mark_arg(i); if (argv[i + 1]) { - fake_version = Swig_copy_string(argv[i + 1]); + Swig_set_fakeversion(argv[i + 1]); Swig_mark_arg(i + 1); i++; } else { Swig_arg_error(); } } else if (strcmp(argv[i], "-version") == 0) { - fprintf(stdout, "\nSWIG Version %s\n", swig_package_version()); + fprintf(stdout, "\nSWIG Version %s\n", Swig_package_version()); fprintf(stdout, "\nCompiled with %s [%s]\n", SWIG_CXX, SWIG_PLATFORM); fprintf(stdout, "Please see %s for reporting bugs and further information\n", PACKAGE_BUGREPORT); SWIG_exit(EXIT_SUCCESS); } else if (strcmp(argv[i], "-copyright") == 0) { - fprintf(stdout, "\nSWIG Version %s\n", swig_package_version()); + fprintf(stdout, "\nSWIG Version %s\n", Swig_package_version()); fprintf(stdout, "Copyright (c) 1995-1998\n"); fprintf(stdout, "University of Utah and the Regents of the University of California\n"); fprintf(stdout, "Copyright (c) 1998-2005\n"); @@ -763,7 +749,7 @@ int SWIG_main(int argc, char *argv[], Language *l) { #endif // Set the SWIG version value in format 0xAABBCC from package version expected to be in format A.B.C - String *package_version = NewString(swig_package_version()); + String *package_version = NewString(PACKAGE_VERSION); /* Note that the fakeversion has not been set at this point */ char *token = strtok(Char(package_version), "."); String *vers = NewString("SWIG_VERSION 0x"); int count = 0; diff --git a/SWIG/Source/Modules/modula3.cxx b/SWIG/Source/Modules/modula3.cxx index 680983d73..614dd9e81 100644 --- a/SWIG/Source/Modules/modula3.cxx +++ b/SWIG/Source/Modules/modula3.cxx @@ -1171,7 +1171,7 @@ MODULA3(): *\n\ * Do not make changes to this file unless you know what you are doing --\n\ * modify the SWIG interface file instead.\n\ - *******************************************************************************)\n\n", PACKAGE_VERSION); + *******************************************************************************)\n\n", Swig_package_version()); } /* ---------------------------------------------------------------------- diff --git a/SWIG/Source/Modules/perl5.cxx b/SWIG/Source/Modules/perl5.cxx index 8a6f2509f..7def7b93c 100644 --- a/SWIG/Source/Modules/perl5.cxx +++ b/SWIG/Source/Modules/perl5.cxx @@ -285,8 +285,11 @@ public: Delete(tmp); } - Printv(f_pm, - "# This file was created automatically by SWIG ", PACKAGE_VERSION, ".\n", "# Don't modify this file, modify the SWIG interface instead.\n", NIL); + Printf(f_pm, "# This file was automatically generated by SWIG (http://www.swig.org).\n"); + Printf(f_pm, "# Version %s\n", Swig_package_version()); + Printf(f_pm, "#\n"); + Printf(f_pm, "# Don't modify this file, modify the SWIG interface instead.\n"); + Printf(f_pm, "\n"); Printf(f_pm, "package %s;\n", fullmodule); diff --git a/SWIG/Source/Modules/python.cxx b/SWIG/Source/Modules/python.cxx index 93159f0a4..115576a48 100644 --- a/SWIG/Source/Modules/python.cxx +++ b/SWIG/Source/Modules/python.cxx @@ -674,8 +674,10 @@ public: Swig_register_filebyname("shadow", f_shadow); Swig_register_filebyname("python", f_shadow); - Printv(f_shadow, - "# This file was created automatically by SWIG ", PACKAGE_VERSION, ".\n", "# Don't modify this file, modify the SWIG interface instead.\n", NIL); + Printf(f_shadow, "# This file was automatically generated by SWIG (http://www.swig.org).\n"); + Printf(f_shadow, "# Version %s\n", Swig_package_version()); + Printf(f_shadow, "#\n"); + Printf(f_shadow, "# Don't modify this file, modify the SWIG interface instead.\n"); if (!modern) { Printv(f_shadow, "# This file is compatible with both classic and new-style classes.\n", NIL); diff --git a/SWIG/Source/Modules/tcl8.cxx b/SWIG/Source/Modules/tcl8.cxx index 4b8fd438f..76e700c9e 100644 --- a/SWIG/Source/Modules/tcl8.cxx +++ b/SWIG/Source/Modules/tcl8.cxx @@ -186,8 +186,10 @@ public: Swig_register_filebyname("shadow", f_shadow); Swig_register_filebyname("itcl", f_shadow); - Printv(f_shadow, - "# This file was created automatically by SWIG ", PACKAGE_VERSION, ".\n", "# Don't modify this file, modify the SWIG interface instead.\n", NIL); + Printf(f_shadow, "# This file was automatically generated by SWIG (http://www.swig.org).\n"); + Printf(f_shadow, "# Version %s\n", Swig_package_version()); + Printf(f_shadow, "#\n"); + Printf(f_shadow, "# Don't modify this file, modify the SWIG interface instead.\n"); Printv(f_shadow, "\npackage require Itcl\n\n", NIL); Delete(filen); diff --git a/SWIG/Source/Swig/misc.c b/SWIG/Source/Swig/misc.c index 3affdbc1e..3eda9991b 100644 --- a/SWIG/Source/Swig/misc.c +++ b/SWIG/Source/Swig/misc.c @@ -15,6 +15,7 @@ char cvsroot_misc_c[] = "$Header$"; #include #include +static char *fake_version = 0; /* ----------------------------------------------------------------------------- * Swig_copy_string() @@ -31,6 +32,26 @@ char *Swig_copy_string(const char *s) { return c; } +/* ----------------------------------------------------------------------------- + * Swig_set_fakeversion() + * + * Version string override + * ----------------------------------------------------------------------------- */ + +void Swig_set_fakeversion(const char *version) { + fake_version = Swig_copy_string(version); +} + +/* ----------------------------------------------------------------------------- + * Swig_package_version() + * + * Return the package string containing the version number + * ----------------------------------------------------------------------------- */ + +const char *Swig_package_version(void) { + return fake_version ? fake_version : PACKAGE_VERSION; +} + /* ----------------------------------------------------------------------------- * Swig_banner() * @@ -45,7 +66,7 @@ void Swig_banner(File *f) { * This file is not intended to be easily readable and contains a number of \n\ * coding conventions designed to improve portability and efficiency. Do not make\n\ * changes to this file unless you know what you are doing--modify the SWIG \n\ - * interface file instead. \n", PACKAGE_VERSION); + * interface file instead. \n", Swig_package_version()); /* String too long for ISO compliance */ Printf(f, " * ----------------------------------------------------------------------------- */\n\n"); diff --git a/SWIG/Source/Swig/swig.h b/SWIG/Source/Swig/swig.h index 426906c47..376acb1d4 100644 --- a/SWIG/Source/Swig/swig.h +++ b/SWIG/Source/Swig/swig.h @@ -441,6 +441,8 @@ extern "C" { /* --- Misc --- */ extern char *Swig_copy_string(const char *c); + extern void Swig_set_fakeversion(const char *version); + extern const char *Swig_package_version(void); extern void Swig_banner(File *f); extern String *Swig_string_escape(String *s); extern String *Swig_string_mangle(const String *s);