From 11561b24991eab5aaf1d0a6f9ed0fa5e02315f7e Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Thu, 22 Jan 2004 22:42:18 +0000 Subject: [PATCH] Eric Sunshine patch - Mods to work on NextStep git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5674 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/DOH/string.c | 4 +++- Source/Modules/browser.cxx | 3 --- Source/Modules/chicken.cxx | 10 ++++------ Source/Modules/csharp.cxx | 9 ++++----- Source/Modules/guile.cxx | 9 ++++----- Source/Modules/java.cxx | 9 ++++----- Source/Modules/main.cxx | 3 --- Source/Modules/mzscheme.cxx | 10 ++++------ Source/Modules/ocaml.cxx | 10 ++++------ Source/Modules/perl5.cxx | 10 ++++------ Source/Modules/php4.cxx | 13 +++++-------- Source/Modules/pike.cxx | 9 ++++----- Source/Modules/python.cxx | 10 ++++------ Source/Modules/ruby.cxx | 10 ++++------ Source/Modules/s-exp.cxx | 6 ++++-- Source/Modules/swigmain.cxx | 4 ---- Source/Modules/tcl8.cxx | 10 ++++------ Source/Modules/xml.cxx | 6 ++++-- Source/Swig/misc.c | 3 --- Source/Swig/swig.h | 10 ++++++++++ 20 files changed, 70 insertions(+), 88 deletions(-) diff --git a/Source/DOH/string.c b/Source/DOH/string.c index 406b2bdd7..a965f53d7 100644 --- a/Source/DOH/string.c +++ b/Source/DOH/string.c @@ -1030,7 +1030,9 @@ int DohStrncmp(const DOHString_or_char *s1, const DOHString_or_char *s2, int n) } char *DohStrstr(const DOHString_or_char *s1, const DOHString_or_char *s2) { - return strstr(Char(s1),Char(s2)); + char* p1 = Char(s1); + char* p2 = Char(s2); + return p2 == 0 || *p2 == '\0' ? p1 : strstr(p1,p2); } char *DohStrchr(const DOHString_or_char *s1, int ch) { diff --git a/Source/Modules/browser.cxx b/Source/Modules/browser.cxx index 8fed270d7..4b2e69633 100644 --- a/Source/Modules/browser.cxx +++ b/Source/Modules/browser.cxx @@ -12,9 +12,6 @@ char cvsroot_browser_cxx[] = "$Header$"; -#ifndef MACSWIG -#include "swigconfig.h" -#endif #include "swigmod.h" #ifdef SWIG_SWILL diff --git a/Source/Modules/chicken.cxx b/Source/Modules/chicken.cxx index ae61d7d36..71361fbe9 100644 --- a/Source/Modules/chicken.cxx +++ b/Source/Modules/chicken.cxx @@ -23,10 +23,6 @@ char cvsroot_chicken_cxx[] = "$Header$"; #include "swigmod.h" -#ifndef MACSWIG -#include "swigconfig.h" -#endif - #include static const char *chicken_usage = (char*)"\ @@ -134,10 +130,12 @@ protected: * swig_chicken() - Instantiate module * ----------------------------------------------------------------------- */ -extern "C" Language * -swig_chicken(void) { +static Language * new_swig_chicken() { return new CHICKEN(); } +extern "C" Language * swig_chicken(void) { + return new_swig_chicken(); +} void CHICKEN::main(int argc, char *argv[]) diff --git a/Source/Modules/csharp.cxx b/Source/Modules/csharp.cxx index 4c39b1b9f..4e0fb8d4b 100644 --- a/Source/Modules/csharp.cxx +++ b/Source/Modules/csharp.cxx @@ -14,9 +14,6 @@ char cvsroot_csharp_cxx[] = "$Header$"; #include // for INT_MAX #include "swigmod.h" -#ifndef MACSWIG -#include "swigconfig.h" -#endif #include class CSHARP : public Language { @@ -2021,10 +2018,12 @@ class CSHARP : public Language { * swig_csharp() - Instantiate module * ----------------------------------------------------------------------------- */ -extern "C" Language * -swig_csharp(void) { +static Language * new_swig_csharp() { return new CSHARP(); } +extern "C" Language * swig_csharp(void) { + return new_swig_csharp(); +} /* ----------------------------------------------------------------------------- * Static member variables diff --git a/Source/Modules/guile.cxx b/Source/Modules/guile.cxx index 809f56ed7..8e0522f39 100644 --- a/Source/Modules/guile.cxx +++ b/Source/Modules/guile.cxx @@ -30,9 +30,6 @@ char cvsroot_guile_cxx[] = "$Header$"; #include "swigmod.h" -#ifndef MACSWIG -#include "swigconfig.h" -#endif #include // Note string broken in half for compilers that can't handle long strings @@ -1766,7 +1763,9 @@ public: * swig_guile() - Instantiate module * ----------------------------------------------------------------------------- */ -extern "C" Language * -swig_guile(void) { +static Language * new_swig_guile() { return new GUILE(); } +extern "C" Language * swig_guile(void) { + return new_swig_guile(); +} diff --git a/Source/Modules/java.cxx b/Source/Modules/java.cxx index b27305662..3b48ffc84 100644 --- a/Source/Modules/java.cxx +++ b/Source/Modules/java.cxx @@ -14,9 +14,6 @@ char cvsroot_java_cxx[] = "$Header$"; #include // for INT_MAX #include "swigmod.h" -#ifndef MACSWIG -#include "swigconfig.h" -#endif #include /* Hash type used for JNI upcall data */ @@ -3281,10 +3278,12 @@ class JAVA : public Language { * swig_java() - Instantiate module * ----------------------------------------------------------------------------- */ -extern "C" Language * -swig_java(void) { +static Language * new_swig_java() { return new JAVA(); } +extern "C" Language * swig_java(void) { + return new_swig_java(); +} /* ----------------------------------------------------------------------------- * Static member variables diff --git a/Source/Modules/main.cxx b/Source/Modules/main.cxx index 5ddee5e43..0a53da3be 100644 --- a/Source/Modules/main.cxx +++ b/Source/Modules/main.cxx @@ -20,9 +20,6 @@ char cvsroot_main_cxx[] = "$Header$"; #endif #include "swigmod.h" -#ifndef MACSWIG -#include "swigconfig.h" -#endif #include "swigwarn.h" #include "cparse.h" diff --git a/Source/Modules/mzscheme.cxx b/Source/Modules/mzscheme.cxx index fc2b9803f..027d7bb78 100644 --- a/Source/Modules/mzscheme.cxx +++ b/Source/Modules/mzscheme.cxx @@ -25,10 +25,6 @@ char cvsroot_mzscheme_cxx[] = "$Header$"; #include "swigmod.h" -#ifndef MACSWIG -#include "swigconfig.h" -#endif - #include static const char *usage = (char*)"\ @@ -690,9 +686,11 @@ public: * swig_mzscheme() - Instantiate module * ----------------------------------------------------------------------------- */ -extern "C" Language * -swig_mzscheme(void) { +static Language * new_swig_mzscheme() { return new MZSCHEME(); } +extern "C" Language * swig_mzscheme(void) { + return new_swig_mzscheme(); +} diff --git a/Source/Modules/ocaml.cxx b/Source/Modules/ocaml.cxx index fac808f7c..956b095b4 100755 --- a/Source/Modules/ocaml.cxx +++ b/Source/Modules/ocaml.cxx @@ -20,10 +20,6 @@ char cvsroot_ocaml_cxx[] = "$Header$"; #include "swigmod.h" -#ifndef MACSWIG -#include "swigconfig.h" -#endif - #include static const char *usage = (char*) @@ -1898,8 +1894,10 @@ public: * swig_ocaml() - Instantiate module * ------------------------------------------------------------------------- */ -extern "C" Language * -swig_ocaml(void) { +static Language * new_swig_ocaml() { return new OCAML(); } +extern "C" Language * swig_ocaml(void) { + return new_swig_ocaml(); +} diff --git a/Source/Modules/perl5.cxx b/Source/Modules/perl5.cxx index e013bbfba..33b132b58 100644 --- a/Source/Modules/perl5.cxx +++ b/Source/Modules/perl5.cxx @@ -17,10 +17,6 @@ char cvsroot_perl5_cxx[] = "$Header$"; #include "swigmod.h" -#ifndef MACSWIG -#include "swigconfig.h" -#endif - static const char *usage = (char*)"\ Perl5 Options (available with -perl5)\n\ -ldflags - Print runtime libraries to link with\n\ @@ -1436,7 +1432,9 @@ public: * swig_perl5() - Instantiate module * ----------------------------------------------------------------------------- */ -extern "C" Language * -swig_perl5(void) { +static Language * new_swig_perl5() { return new PERL5(); } +extern "C" Language * swig_perl5(void) { + return new_swig_perl5(); +} diff --git a/Source/Modules/php4.cxx b/Source/Modules/php4.cxx index db74b6271..d4fa408a7 100644 --- a/Source/Modules/php4.cxx +++ b/Source/Modules/php4.cxx @@ -17,10 +17,6 @@ char cvsroot_php4_cxx[] = "$Header$"; #include "swigmod.h" -#ifndef MACSWIG -#include "swigconfig.h" -#endif - #include @@ -894,7 +890,7 @@ public: */ void create_command(char *cname, char *iname) { -// char *lower_cname = strdup(cname); +// char *lower_cname = Swig_copy_string(cname); // char *c; // for(c = lower_cname; *c != '\0'; c++) { @@ -2115,8 +2111,7 @@ void typetrace(SwigType *ty, String *mangled, String *clientdata) { if (r_prevtracefunc) (*r_prevtracefunc)(ty, mangled, (String *) clientdata); } -extern "C" Language * -swig_php(void) { +static Language * new_swig_php() { maininstance=new PHP4(); if (! r_prevtracefunc) { r_prevtracefunc=SwigType_remember_trace(typetrace); @@ -2126,4 +2121,6 @@ swig_php(void) { } return maininstance; } - +extern "C" Language * swig_php(void) { + return new_swig_php(); +} diff --git a/Source/Modules/pike.cxx b/Source/Modules/pike.cxx index 5f3aae262..be0573b6c 100644 --- a/Source/Modules/pike.cxx +++ b/Source/Modules/pike.cxx @@ -21,9 +21,6 @@ char cvsroot_pike_cxx[] = "$Header$"; #include "swigmod.h" -#ifndef MACSWIG -#include "swigconfig.h" -#endif #include // for isalnum() @@ -880,7 +877,9 @@ public: * swig_pike() - Instantiate module * ----------------------------------------------------------------------------- */ -extern "C" Language * -swig_pike(void) { +static Language * new_swig_pike() { return new PIKE(); } +extern "C" Language * swig_pike(void) { + return new_swig_pike(); +} diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx index ed36b9c48..8f898dc6a 100644 --- a/Source/Modules/python.cxx +++ b/Source/Modules/python.cxx @@ -13,10 +13,6 @@ char cvsroot_python_cxx[] = "$Header$"; #include "swigmod.h" -#ifndef MACSWIG -#include "swigconfig.h" -#endif - #include #define PYSHADOW_MEMBER 0x2 @@ -2187,7 +2183,9 @@ public: * swig_python() - Instantiate module * ----------------------------------------------------------------------------- */ -extern "C" Language * -swig_python(void) { +static Language * new_swig_python() { return new PYTHON(); } +extern "C" Language * swig_python(void) { + return new_swig_python(); +} diff --git a/Source/Modules/ruby.cxx b/Source/Modules/ruby.cxx index 3833bfb6b..653dd90b4 100644 --- a/Source/Modules/ruby.cxx +++ b/Source/Modules/ruby.cxx @@ -15,10 +15,6 @@ char cvsroot_ruby_cxx[] = "$Header$"; #include "swigmod.h" #define SWIG_PROTECTED_TARGET_METHODS 1 -#ifndef MACSWIG -#include "swigconfig.h" -#endif - #include #include #include /* for INT_MAX */ @@ -2357,10 +2353,12 @@ public: * swig_ruby() - Instantiate module * ----------------------------------------------------------------------------- */ -extern "C" Language * -swig_ruby(void) { +static Language * new_swig_ruby() { return new RUBY(); } +extern "C" Language * swig_ruby(void) { + return new_swig_ruby(); +} /* diff --git a/Source/Modules/s-exp.cxx b/Source/Modules/s-exp.cxx index 5d332dc29..cd8d53718 100644 --- a/Source/Modules/s-exp.cxx +++ b/Source/Modules/s-exp.cxx @@ -406,7 +406,9 @@ public: }; -extern "C" Language * -swig_sexp( void ) { +static Language * new_swig_sexp() { return new Sexp(); } +extern "C" Language * swig_sexp( void ) { + return new_swig_sexp(); +} diff --git a/Source/Modules/swigmain.cxx b/Source/Modules/swigmain.cxx index 8785c1ad3..afc706af5 100644 --- a/Source/Modules/swigmain.cxx +++ b/Source/Modules/swigmain.cxx @@ -22,10 +22,6 @@ char cvsroot_swigmain_cxx[] = "$Header$"; -#ifndef MACSWIG -#include "swigconfig.h" -#endif - #include "swigmod.h" /* Module factories. These functions are used to instantiate diff --git a/Source/Modules/tcl8.cxx b/Source/Modules/tcl8.cxx index 439f1e8b2..25e8b3e3e 100644 --- a/Source/Modules/tcl8.cxx +++ b/Source/Modules/tcl8.cxx @@ -24,10 +24,6 @@ char cvsroot_tcl8_cxx[] = "$Header$"; #include "swigmod.h" -#ifndef MACSWIG -#include "swigconfig.h" -#endif - static const char *usage = (char*)"\ Tcl 8 Options (available with -tcl)\n\ -itcl - Enable ITcl support\n\ @@ -1220,10 +1216,12 @@ public: * swig_tcl() - Instantiate module * ---------------------------------------------------------------------- */ -extern "C" Language * -swig_tcl(void) { +static Language * new_swig_tcl() { return new TCL8(); } +extern "C" Language * swig_tcl(void) { + return new_swig_tcl(); +} diff --git a/Source/Modules/xml.cxx b/Source/Modules/xml.cxx index 040e86c11..60a3e8982 100644 --- a/Source/Modules/xml.cxx +++ b/Source/Modules/xml.cxx @@ -332,7 +332,9 @@ public: }; -extern "C" Language * -swig_xml( void ) { +static Language * new_swig_xml() { return new XML(); } +extern "C" Language * swig_xml( void ) { + return new_swig_xml(); +} diff --git a/Source/Swig/misc.c b/Source/Swig/misc.c index 72e8488d8..b05c6bdaa 100644 --- a/Source/Swig/misc.c +++ b/Source/Swig/misc.c @@ -12,9 +12,6 @@ char cvsroot_misc_c[] = "$Header$"; #include "swig.h" -#ifndef MACSWIG -#include "swigconfig.h" -#endif #include /* ----------------------------------------------------------------------------- diff --git a/Source/Swig/swig.h b/Source/Swig/swig.h index 1e95a3cbb..c378026fd 100644 --- a/Source/Swig/swig.h +++ b/Source/Swig/swig.h @@ -24,6 +24,16 @@ extern "C" { #endif +#ifndef MACSWIG +#include "swigconfig.h" +#endif + +#if defined(__cplusplus) && !defined(HAVE_BOOL) +typedef int bool; +#define true ((bool)1) +#define false ((bool)0) +#endif + #include "doh.h" /* Status codes */