diff options
-rw-r--r-- | Makefile.in | 25 | ||||
-rw-r--r-- | Source/Include/swigver.h.in | 5 | ||||
-rw-r--r-- | Source/SWIG1.1/emit.cxx | 70 | ||||
-rw-r--r-- | Source/SWIG1.1/main.cxx | 66 | ||||
-rw-r--r-- | VERSION | 26 | ||||
-rw-r--r-- | configure.in | 40 |
6 files changed, 150 insertions, 82 deletions
diff --git a/Makefile.in b/Makefile.in index 64b0e40fa..174d74239 100644 --- a/Makefile.in +++ b/Makefile.in @@ -56,7 +56,7 @@ Modules1.1: Swig: @cd $(SOURCE)/Swig; $(MAKE) -Preprocessor: +Preprocessor: @cd $(SOURCE)/Preprocessor; $(MAKE) LParse: @@ -95,7 +95,7 @@ clean: @cd Runtime; $(MAKE) clean rm -f swig - + ##################################################################### # TARGETS: install & friends ##################################################################### @@ -173,3 +173,24 @@ install-lib: install-runtime: @cd Runtime; $(MAKE) install + +############################################################################ +# DIST and other maintenance +############################################################################ + +# distribution directory +dd = @PACKAGE@-@VERSION@ + +dist: + @echo 'Dave, what do you want to do w/ "make dist"?' + @echo 'See Makefile.in target "dist-suggested" for an idea.' + @echo ' --thi' + false + +dist-suggested: + rm -rf $(dd) $(dd).tar.gz + cvs export -d $(dd) -r HEAD SWIG + tar cf - $(dd) | gzip --best > $(dd).tar.gz + rm -rf $(dd) + +# Makefile ends here diff --git a/Source/Include/swigver.h.in b/Source/Include/swigver.h.in new file mode 100644 index 000000000..fda2c2956 --- /dev/null +++ b/Source/Include/swigver.h.in @@ -0,0 +1,5 @@ + +/* SWIG version information */ + +#define SWIG_VERSION "@SWIG_VERSION@" +#define SWIG_SPIN "@SWIG_SPIN@" diff --git a/Source/SWIG1.1/emit.cxx b/Source/SWIG1.1/emit.cxx index d08927646..dcf5d0775 100644 --- a/Source/SWIG1.1/emit.cxx +++ b/Source/SWIG1.1/emit.cxx @@ -1,15 +1,15 @@ -/* ----------------------------------------------------------------------------- +/* ----------------------------------------------------------------------------- * emit.cxx * * Useful functions for emitting various pieces of code. - * + * * Author(s) : David Beazley (beazley@cs.uchicago.edu) * * Copyright (C) 1998-2000. The University of Chicago * Copyright (C) 1995-1998. The University of Utah and The Regents of the * University of California. * - * See the file LICENSE for information on usage and redistribution. + * See the file LICENSE for information on usage and redistribution. * ----------------------------------------------------------------------------- */ #include "internal.h" @@ -18,7 +18,7 @@ static char cvsroot[] = "$Header$"; // ----------------------------------------------------------------------------- // void emit_banner(FILE *f) -// +// // Emits the SWIG identifying banner in the wrapper file // ----------------------------------------------------------------------------- @@ -32,7 +32,7 @@ void emit_banner(FILE *f) { * FILE : %s\n\ * \n\ * This file was automatically generated by SWIG (http://www.swig.org).\n\ - * Version %d.%d %s\n\ + * Version %s %s\n\ * \n\ * Portions Copyright (c) 1995-1999\n\ * The University of Utah, The Regents of the University of California, and\n\ @@ -44,7 +44,7 @@ void emit_banner(FILE *f) { * changes to this file unless you know what you are doing--modify the SWIG \n\ * interface file instead. \n\ *\n\ - */\n\n", fn_runtime, SWIG_MAJOR_VERSION, SWIG_MINOR_VERSION, SWIG_SPIN); + */\n\n", fn_runtime, SWIG_VERSION, SWIG_SPIN); fprintf(f,"\n#define SWIGCODE\n"); @@ -52,7 +52,7 @@ void emit_banner(FILE *f) { // ----------------------------------------------------------------------------- // emit_extern_var(char *decl, DataType *t, int extern_type, FILE *f) -// +// // Emits an external variables declaration. Extern_type defines the // type of external declaration. Currently, only C/C++ declarations // are allowed, but this might be extended to allow Fortran linkage @@ -116,8 +116,8 @@ void emit_extern_var(char *decl, DataType *t, int extern_type, FILE *f) { // FILE *f) // // Emits an external function declaration (similiar to emit_extern_var). -// -// Inputs : +// +// Inputs : // decl = Name of declaration // t = Return datatype // L = parameter list @@ -140,7 +140,7 @@ void emit_extern_func(char *decl, DataType *t, ParmList *L, int extern_type, FIL } else { fprintf(f,"%s", t->print_full()); } - + fprintf(f,"%s(", decl); L->print_types(f); fprintf(f,");\n"); @@ -182,7 +182,7 @@ void emit_extern_func(char *decl, DataType *t, ParmList *L, int extern_type, FIL } else { fprintf(f,"%s", t->print_full()); } - + fprintf(f,"%s(", decl); L->print_args(f); fprintf(f,")\n"); @@ -190,7 +190,7 @@ void emit_extern_func(char *decl, DataType *t, ParmList *L, int extern_type, FIL default: break; } -} +} // ----------------------------------------------------------------------------- // char *emit_local(int i) @@ -253,7 +253,7 @@ int emit_args(DataType *rt, ParmList *l, FILE *f) { if (p->defvalue) { if ((p->t->is_reference) || ((p->t->type == T_USER) && (p->call_type == CALL_REFERENCE))) fprintf(f,"\t %s _arg%d = &%s;\n", p->t->print_type(),i, p->defvalue); - else + else fprintf(f,"\t %s _arg%d = %s;\n", p->t->print_type(),i, p->defvalue); } else { fprintf(f,"\t %s _arg%d;\n", p->t->print_type(),i); @@ -264,9 +264,9 @@ int emit_args(DataType *rt, ParmList *l, FILE *f) { } // Check for ignore or default typemaps - + tm = typemap_lookup("default",typemap_lang,p->t,p->name,"",temp); - if (tm) + if (tm) def << tm; tm = typemap_lookup("ignore",typemap_lang,p->t,p->name,"",temp); @@ -286,7 +286,7 @@ int emit_args(DataType *rt, ParmList *l, FILE *f) { fprintf(f,"%s",def.get()); // i now contains number of parameters - + return(i); } @@ -335,7 +335,7 @@ int emit_args(DataType *rt, ParmList *l, WrapperFunction &f) { if ((p->t->type != T_VOID) || (p->t->is_pointer)) { char *temp = emit_local(i); // Figure out default values - if (((p->t->is_reference) && (p->defvalue)) || + if (((p->t->is_reference) && (p->defvalue)) || ((p->t->type == T_USER) && (p->call_type == CALL_REFERENCE) && (p->defvalue))) { String deftmp; deftmp << "(" << p->t->print_type() << ") &" << p->defvalue; @@ -355,7 +355,7 @@ int emit_args(DataType *rt, ParmList *l, WrapperFunction &f) { } // Check for ignore or default typemaps tm = typemap_lookup("default",typemap_lang,p->t,p->name,"",temp,&f); - if (tm) + if (tm) f.code << tm << "\n"; tm = typemap_lookup("ignore",typemap_lang,p->t,p->name,"",temp,&f); if (tm) { @@ -414,7 +414,7 @@ void emit_func_call(char *decl, DataType *t, ParmList *l, FILE *f) { fprintf(f,"%s& _result_ref = ", t->print_full()); t->is_pointer++; } else { - + // Normal return values fprintf(f,"_result = %s", t->print_cast()); } @@ -460,7 +460,7 @@ void emit_func_call(char *decl, DataType *t, ParmList *l, FILE *f) { // int emit_func_call(char *decl, DataType *t, ParmList *l, WrapperFunction &f) // // Emits code for a function call (new version). -// +// // Exception handling support : // // - This function checks to see if any sort of exception mechanism @@ -564,13 +564,13 @@ void emit_func_call(char *decl, DataType *t, ParmList *l, WrapperFunction &f) { // ----------------------------------------------------------------------------- // void emit_hex(FILE *f) -// +// // Emits the default C-code to handle pointers. This is normally contained // in the SWIG library file 'swigptr.swg' // ----------------------------------------------------------------------------- void emit_hex(FILE *f) { - + int stat; // Look for a pointer configuration file @@ -589,7 +589,7 @@ void emit_hex(FILE *f) { // Emits a pair of functions to set/get the value of a variable. // This should be used as backup in case the target language can't // provide variable linking. -// +// // double foo; // // Gets translated into the following : @@ -603,7 +603,7 @@ void emit_hex(FILE *f) { // } // // Need to handle special cases for char * and for user -// defined types. +// defined types. // // 1. char * // @@ -612,7 +612,7 @@ void emit_hex(FILE *f) { // natural thing to do. // // 2. User_Defined -// Will assign value from a pointer. +// Will assign value from a pointer. // Will return a pointer to current value. // ----------------------------------------------------------------------------- @@ -636,14 +636,14 @@ void emit_set_get(char *name, char *iname, DataType *t) { fprintf(f_header,"static %s %s(%s val) {\n", t->print_type(), name_set(name), t->print_type()); } - + if ((t->type != T_VOID) || (t->is_pointer)) { if (!t->is_pointer) { - - // Have a real value here + + // Have a real value here // If it's a user defined type, we'll do something special. // Otherwise, just assign it. - + if (t->type != T_USER) { fprintf(f_header,"\t return (%s) (%s = val);\n", t->print_type(), name); } else { @@ -653,10 +653,10 @@ void emit_set_get(char *name, char *iname, DataType *t) { t->is_pointer--; } } else { - + // Is a pointer type here. If string, we do something // special. Otherwise. No problem. - + if ((t->type == T_CHAR) && (t->is_pointer == 1)) { if (CPlusPlus) { fprintf(f_header,"\t if (%s) delete %s;\n", name,name); @@ -685,10 +685,10 @@ void emit_set_get(char *name, char *iname, DataType *t) { p->name = new char[1]; p->name[0] = 0; l->append(p); - + new_name = name_set(name); new_iname = name_set(iname); - + if ((t->type == T_USER) && (!t->is_pointer)) { t->is_pointer++; lang->create_function(new_name, new_iname, t, l); @@ -715,7 +715,7 @@ void emit_set_get(char *name, char *iname, DataType *t) { } fprintf(f_header,"}\n"); - + // Wrap this function l = new ParmList; @@ -732,7 +732,7 @@ void emit_set_get(char *name, char *iname, DataType *t) { } delete l; } - + diff --git a/Source/SWIG1.1/main.cxx b/Source/SWIG1.1/main.cxx index 03e3885db..75a8a26e9 100644 --- a/Source/SWIG1.1/main.cxx +++ b/Source/SWIG1.1/main.cxx @@ -1,15 +1,15 @@ -/* ----------------------------------------------------------------------------- +/* ----------------------------------------------------------------------------- * main.cxx * * Main entry point to the SWIG core. - * + * * Author(s) : David Beazley (beazley@cs.uchicago.edu) * * Copyright (C) 1998-2000. The University of Chicago * Copyright (C) 1995-1998. The University of Utah and The Regents of the * University of California. * - * See the file LICENSE for information on usage and redistribution. + * See the file LICENSE for information on usage and redistribution. * ----------------------------------------------------------------------------- */ static char cvsroot[] = "$Header$"; @@ -24,7 +24,7 @@ static char cvsroot[] = "$Header$"; #include "preprocessor.h" -#ifndef SWIG_LIB +#ifndef SWIG_LIB #define SWIG_LIB "/usr/local/lib/swig1.3" #endif @@ -34,14 +34,14 @@ static char cvsroot[] = "$Header$"; // Global variables - FILE *f_runtime; + FILE *f_runtime; FILE *f_header; // Some commonly used FILE *f_wrappers; // FILE pointers FILE *f_init; FILE *f_input; - char InitName[256]; + char InitName[256]; char LibDir[512]; // Library directory - int Status; + int Status; Language *lang; // Language method int CPlusPlus = 0; int ObjC = 0; @@ -131,7 +131,7 @@ int SWIG_main(int argc, char *argv[], Language *l) { lang = l; Status = 0; - + DataType::init_typedef(); // Initialize the type handler // Set up some default symbols (available in both SWIG interface files @@ -145,7 +145,7 @@ int SWIG_main(int argc, char *argv[], Language *l) { #ifdef SWIGWIN32 Preprocessor_define((DOH *) "SWIGWIN32 1", 0); #endif - + // Check for SWIG_LIB environment variable if ((c = getenv("SWIG_LIB")) == (char *) 0) { @@ -153,7 +153,7 @@ int SWIG_main(int argc, char *argv[], Language *l) { } else { strcpy(LibDir,c); } - + SwigLib = copy_string(LibDir); // Make a copy of the real library location sprintf(temp,"%s/config", LibDir); @@ -169,7 +169,7 @@ int SWIG_main(int argc, char *argv[], Language *l) { for (i = 1; i < argc; i++) { if (argv[i]) { if (strncmp(argv[i],"-I",2) == 0) { - // Add a new directory search path + // Add a new directory search path includefiles[includecount++] = copy_string(argv[i]+2); Swig_mark_arg(i); } else if (strncmp(argv[i],"-D",2) == 0) { @@ -185,7 +185,7 @@ int SWIG_main(int argc, char *argv[], Language *l) { Swig_mark_arg(i); } else if (strcmp(argv[i],"-c++") == 0) { CPlusPlus=1; - Swig_mark_arg(i); + Swig_mark_arg(i); } else if (strcmp(argv[i],"-objc") == 0) { ObjC = 1; Swig_mark_arg(i); @@ -208,14 +208,14 @@ int SWIG_main(int argc, char *argv[], Language *l) { Swig_arg_error(); } } else if (strcmp(argv[i],"-version") == 0) { - fprintf(stderr,"\nSWIG Version %d.%d %s\n", SWIG_MAJOR_VERSION, - SWIG_MINOR_VERSION, SWIG_SPIN); + fprintf(stderr,"\nSWIG Version %s %s\n", + SWIG_VERSION, SWIG_SPIN); fprintf(stderr,"Copyright (c) 1995-98\n"); fprintf(stderr,"University of Utah and the Regents of the University of California\n"); fprintf(stderr,"\nCompiled with %s\n", SWIG_CC); SWIG_exit(0); } else if (strncmp(argv[i],"-l",2) == 0) { - // Add a new directory search path + // Add a new directory search path Append(libfiles,argv[i]+2); Swig_mark_arg(i); } else if (strcmp(argv[i],"-co") == 0) { @@ -264,7 +264,7 @@ int SWIG_main(int argc, char *argv[], Language *l) { char *outfile = input_file; if (outfile_name) outfile = outfile_name; - + s = Swig_include(input_file); if (!s) { fprintf(stderr,"Unable to locate '%s' in the SWIG library.\n", input_file); @@ -285,12 +285,12 @@ int SWIG_main(int argc, char *argv[], Language *l) { } } } else { - // Check the suffix for a .c file. If so, we're going to + // Check the suffix for a .c file. If so, we're going to // declare everything we see as "extern" - + ForceExtern = check_suffix(infilename); - // Strip off suffix - + // Strip off suffix + c = infilename + strlen(infilename); while (c != infilename) { if (*c == '.') { @@ -300,7 +300,7 @@ int SWIG_main(int argc, char *argv[], Language *l) { c--; } } - + if (!outfile_name) { sprintf(fn_runtime,"%s_wrap.c",infilename); strcpy(infile,infilename); @@ -338,9 +338,9 @@ int SWIG_main(int argc, char *argv[], Language *l) { sprintf(fn_header,"%s%s_wrap.head", output_dir,infile); sprintf(fn_wrapper,"%s%s_wrap.wrap",output_dir,infile); sprintf(fn_init,"%s%s_wrap.init",output_dir,infile); - + // Define the __cplusplus symbol - if (CPlusPlus) + if (CPlusPlus) Preprocessor_define((DOH *) "__cplusplus 1", 0); // Run the preprocessor @@ -368,12 +368,12 @@ int SWIG_main(int argc, char *argv[], Language *l) { fwrite(Char(cpps),1, Len(cpps), f); fclose(f); } - + if ((f_input = fopen(fn_cpp,"r")) == 0) { fprintf(stderr,"Unable to open %s\n", fn_cpp); SWIG_exit(0); } - + // Initialize the scanner LEX_in = f_input; scanner_file(LEX_in); @@ -399,14 +399,14 @@ int SWIG_main(int argc, char *argv[], Language *l) { fprintf(stderr,"Unable to open %s\n",fn_init); exit(0); } - + // Set up the typemap for handling new return strings { DataType *temp_t = new DataType(T_CHAR); temp_t->is_pointer++; - if (CPlusPlus) + if (CPlusPlus) typemap_register("newfree",typemap_lang,temp_t,"","delete [] $source;\n",0); - else + else typemap_register("newfree",typemap_lang,temp_t,"","free($source);\n",0); delete temp_t; @@ -424,7 +424,7 @@ int SWIG_main(int argc, char *argv[], Language *l) { */ } - // Pass control over to the specific language interpreter + // Pass control over to the specific language interpreter lang->parse(); @@ -435,11 +435,11 @@ int SWIG_main(int argc, char *argv[], Language *l) { insert_file(fn_header, f_runtime); insert_file(fn_wrapper,f_runtime); insert_file(fn_init,f_runtime); - + fclose(f_runtime); - + // Remove temporary files - + remove(fn_cpp); remove(fn_header); remove(fn_wrapper); @@ -491,7 +491,7 @@ void SWIG_exit(int) { // -------------------------------------------------------------------------- void swig_pragma(char *name, char *value) { - + if (strcmp(name,"make_default") == 0) { GenerateDefault = 1; } diff --git a/VERSION b/VERSION new file mode 100644 index 000000000..71ffe0263 --- /dev/null +++ b/VERSION @@ -0,0 +1,26 @@ +# This is a -*- shell-script -*- sourced by configure + +# Commentary: +# +# This file is included in the distribution. +# +# The variable `devrelease_today' is the version suffix "u-DATE-TIME". +# This ensures a version w/ second resolution, great for developers, but +# unnecessary for release. The "u" is for "unstable". For release, +# remove (or comment out) the `devrelease_today' component of var +# `SWIG_MINOR_VERSION', do "make dist", and then add `devrelease_today' +# back again. + +devrelease_today=u-`date +%Y%m%d-%H%M` + +SWIG_MAJOR_VERSION=1 +SWIG_MINOR_VERSION=3$devrelease_today + +SWIG_VERSION=$SWIG_MAJOR_VERSION.$SWIG_MINOR_VERSION +SWIG_SPIN='(Alpha 1)' + +# For autoconf. +VERSION=$SWIG_VERSION +PACKAGE=swig + +# VERSION ends here diff --git a/configure.in b/configure.in index 4fee1668d..ad4b76069 100644 --- a/configure.in +++ b/configure.in @@ -1,6 +1,11 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT(Source/Swig/swig.h) AC_PREREQ(2.0) +. $srcdir/VERSION +AC_SUBST(PACKAGE) +AC_SUBST(VERSION) +AC_SUBST(SWIG_VERSION) +AC_SUBST(SWIG_SPIN) # Set name for machine-dependent library files AC_SUBST(MACHDEP) @@ -78,7 +83,7 @@ then hp*|HP*) LDSHARED="ld -b";; OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";; DYNIX/ptx*) LDSHARED="ld -G";; - next/*) + next/*) if test "$ns_dyld" then LDSHARED='$(CC) $(LDFLAGS) -bundle -prebind' else LDSHARED='$(CC) $(CFLAGS) -nostdlib -r'; @@ -135,7 +140,7 @@ then case $ac_sys_system/$ac_sys_release in SunOS/5*) RPATH="-R. -R$(exec_prefix)/lib";; IRIX*) RPATH="-rpath .:$(exec_prefix)/lib";; - Linux*) RPATH="-Xlinker -rpath $(exec_prefix)/lib -Xlinker -rpath .";; + Linux*) RPATH="-Xlinker -rpath $(exec_prefix)/lib -Xlinker -rpath .";; *) RPATH="";; esac fi @@ -354,7 +359,7 @@ AC_SUBST(TCLLIB) PYINCLUDE=nope PYLIB=nope PYPACKAGE=nope -PYLINK="-lModules -lPython -lObjects -lParser" +PYLINK="-lModules -lPython -lObjects -lParser" AC_ARG_WITH(py,[ --with-py=path Set location of Python],[ PYPACKAGE="$withval"], [PYPACKAGE=nope]) @@ -399,7 +404,7 @@ for i in $dirs ; do AC_MSG_RESULT($i) PYLIB="$i" PYINCLUDE="$PYINCLUDE -I$i" - PYLINK="-lpython1.5" + PYLINK="-lpython1.5" break fi if test -r $i/libPython.a; then @@ -447,11 +452,11 @@ if test "$PERL" != nope; then PERL5EXT="$i" break; fi - done + done if test "$PERL5EXT" = none; then PERL5EXT="$PERL5DIR/CORE" AC_MSG_RESULT(could not locate perl.h...using $PERL5EXT) - fi + fi else AC_MSG_RESULT(unable to determine perl5 configuration) PERL5EXT=$PERL5DIR @@ -480,11 +485,22 @@ if test -d Source/SWILL/SWILL; then fi cd Tools; ./ltconfig --enable-dlopen ltmain.sh; cd .. - + AC_CONFIG_SUBDIRS(Source/SWILL Source/DOH) -AC_OUTPUT(Makefile Source/Swig/Makefile - Source/Preprocessor/Makefile Source/SWIG1.1/Makefile - Source/Modules1.1/Makefile Source/LParse/Makefile - Source/Experiment/Makefile Source/Swim/Makefile Examples/Makefile Source/Include/swigconfig.h - Source/Expat/Makefile Source/Xmlparse/Makefile Runtime/Makefile) +AC_OUTPUT( + Examples/Makefile + Makefile + Runtime/Makefile + Source/Expat/Makefile + Source/Experiment/Makefile + Source/Include/swigconfig.h + Source/Include/swigver.h + Source/LParse/Makefile + Source/Modules1.1/Makefile + Source/Preprocessor/Makefile + Source/SWIG1.1/Makefile + Source/Swig/Makefile + Source/Swim/Makefile + Source/Xmlparse/Makefile + ) |