From 62653fd529d429bdef650ccaa42ae87ace6d2976 Mon Sep 17 00:00:00 2001 From: Dave Beazley Date: Wed, 12 Jan 2000 23:49:22 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@73 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/Modules1.1/guile.cxx | 2 +- Source/Modules1.1/java.cxx | 2 +- Source/Modules1.1/perl5.cxx | 4 ++-- Source/Modules1.1/python.cxx | 2 +- Source/Modules1.1/tcl8.cxx | 4 ++-- Source/SWIG1.1/main.cxx | 24 ++++++++++++------------ Source/SWIG1.1/swig.h | 2 ++ Source/SWIG1.1/symbol.cxx | 1 + 8 files changed, 22 insertions(+), 19 deletions(-) diff --git a/Source/Modules1.1/guile.cxx b/Source/Modules1.1/guile.cxx index 7fcafb224..96ec54e89 100644 --- a/Source/Modules1.1/guile.cxx +++ b/Source/Modules1.1/guile.cxx @@ -55,7 +55,7 @@ void GUILE::parse_args(int argc, char *argv[]) { } // Add a symbol for this module - add_symbol("SWIGGUILE",0,0); + SWIG_cpp_define((void *) "SWIGGUILE",0); // Set name of typemaps diff --git a/Source/Modules1.1/java.cxx b/Source/Modules1.1/java.cxx index ad25fbe84..de1dc2c52 100644 --- a/Source/Modules1.1/java.cxx +++ b/Source/Modules1.1/java.cxx @@ -346,7 +346,7 @@ void JAVA::parse_args(int argc, char *argv[]) { // Add a symbol to the parser for conditional compilation // cpp::define("SWIGJAVA"); - add_symbol("SWIGJAVA", 0, 0); + SWIG_cpp_define((void *) "SWIGJAVA 1",0); // Add typemap definitions typemap_lang = "java"; diff --git a/Source/Modules1.1/perl5.cxx b/Source/Modules1.1/perl5.cxx index 126f8ecae..124aa97aa 100644 --- a/Source/Modules1.1/perl5.cxx +++ b/Source/Modules1.1/perl5.cxx @@ -186,8 +186,8 @@ PERL5::parse_args(int argc, char *argv[]) { } // Add a symbol for this module - add_symbol("SWIGPERL",0,0); - add_symbol("SWIGPERL5",0,0); + SWIG_cpp_define((void *) "SWIGPERL 1", 0); + SWIG_cpp_define((void *) "SWIGPERL5 1", 0); // Set name of typemaps diff --git a/Source/Modules1.1/python.cxx b/Source/Modules1.1/python.cxx index d9e64e855..c7df562ec 100644 --- a/Source/Modules1.1/python.cxx +++ b/Source/Modules1.1/python.cxx @@ -99,7 +99,7 @@ void PYTHON::parse_args(int argc, char *argv[]) { } } // Create a symbol for this language - add_symbol("SWIGPYTHON",0,0); + SWIG_cpp_define((void *) "SWIGPYTHON", 0); // Set name of typemaps diff --git a/Source/Modules1.1/tcl8.cxx b/Source/Modules1.1/tcl8.cxx index 450fee087..0082b066b 100644 --- a/Source/Modules1.1/tcl8.cxx +++ b/Source/Modules1.1/tcl8.cxx @@ -105,8 +105,8 @@ void TCL8::parse_args(int argc, char *argv[]) { // Create a symbol SWIGTCL - add_symbol("SWIGTCL",0,0); - add_symbol("SWIGTCL8",0,0); + SWIG_cpp_define((void *) "SWIGTCL 1",0); + SWIG_cpp_define((void *) "SWIGTCL8 1", 0); // Set name of typemaps diff --git a/Source/SWIG1.1/main.cxx b/Source/SWIG1.1/main.cxx index 5215cfb67..dc45f1288 100644 --- a/Source/SWIG1.1/main.cxx +++ b/Source/SWIG1.1/main.cxx @@ -101,6 +101,9 @@ int SWIG_main(int argc, char *argv[], Language *l, Documentation *d) { try { #endif + // Initialize the preprocessor + SWIG_cpp_init(); + f_wrappers = 0; f_init = 0; f_header = 0; @@ -117,12 +120,12 @@ int SWIG_main(int argc, char *argv[], Language *l, Documentation *d) { // Set up some default symbols (available in both SWIG interface files // and C files) - add_symbol("SWIG",0,0); // Define the SWIG symbol + SWIG_cpp_define((DOH *) "SWIG 1", 0); #ifdef MACSWIG - add_symbol("SWIGMAC",0,0); + SWIG_cpp_define((DOH *) "SWIGMAC 1", 0); #endif #ifdef SWIGWIN32 - add_symbol("SWIGWIN32",0,0); + SWIG_cpp_define((DOH *) "SWIGWIN32 1", 0); #endif // Check for SWIG_LIB environment variable @@ -135,6 +138,7 @@ int SWIG_main(int argc, char *argv[], Language *l, Documentation *d) { SwigLib = copy_string(LibDir); // Make a copy of the real library location #ifdef MACSWIG + /* This needs to be fixed */ sprintf(temp,"%s:config", LibDir); add_directory(temp); add_directory(":swig_lib:config"); @@ -154,9 +158,6 @@ int SWIG_main(int argc, char *argv[], Language *l, Documentation *d) { libfiles = NewList(); - // Initialize the preprocessor - SWIG_cpp_init(); - // Get options for (i = 1; i < argc; i++) { if (argv[i]) { @@ -167,9 +168,8 @@ int SWIG_main(int argc, char *argv[], Language *l, Documentation *d) { } else if (strncmp(argv[i],"-D",2) == 0) { DOH *d = NewString(argv[i]+2); String_replace(d,"="," ", DOH_REPLACE_ANY | DOH_REPLACE_FIRST); - SWIG_cpp_define(d,0); + SWIG_cpp_define((DOH *) d,0); // Create a symbol - add_symbol(argv[i]+2, (DataType *) 0, (char *) 0); SWIG_mark_arg(i); } else if (strcmp(argv[i],"-strict") == 0) { if (argv[i+1]) { @@ -384,6 +384,10 @@ int SWIG_main(int argc, char *argv[], Language *l, Documentation *d) { sprintf(title,"%s", fn_runtime); + // Define the __cplusplus symbol + if (CPlusPlus) + SWIG_cpp_define((DOH *) "__cplusplus 1", 0); + // Open up files /* Preprocess. Ugh */ @@ -461,10 +465,6 @@ int SWIG_main(int argc, char *argv[], Language *l, Documentation *d) { delete temp_t; } - // Define the __cplusplus symbol - if (CPlusPlus) - add_symbol("__cplusplus",0,0); - // If in Objective-C mode. Load in a configuration file if (ObjC) { diff --git a/Source/SWIG1.1/swig.h b/Source/SWIG1.1/swig.h index 936d43aa1..30b90d7ad 100644 --- a/Source/SWIG1.1/swig.h +++ b/Source/SWIG1.1/swig.h @@ -569,6 +569,8 @@ extern "C" { extern void SWIG_mark_arg(int n); extern void SWIG_check_options(); extern void SWIG_arg_error(); + + extern void *SWIG_cpp_define(void *, int); } // ----------------------------------------------------------------------- diff --git a/Source/SWIG1.1/symbol.cxx b/Source/SWIG1.1/symbol.cxx index 393817b1c..84f137849 100644 --- a/Source/SWIG1.1/symbol.cxx +++ b/Source/SWIG1.1/symbol.cxx @@ -153,3 +153,4 @@ int update_symbol(char *name, DataType *type, char *value) { void remove_symbol(char *name) { SymHash.remove(name); } +