VERSION, Source/Include/swigver.h.in: New files.

Source/Include/swigver.h: Deleted from repo, now generated by
configure from swigver.h.in same directory.

configure.in: Source ./VERSION to get var definitions.
(PACKAGE, VERSION, SWIG_VERSION, SWIG_SPIN): New vars, @-substituted.
Also do `AC_OUTPUT' on Source/Include/swigver.h.

Makefile.in (dd): New var, the distribution directory.
(dist, dist-suggested): New targets.

Source/SWIG1.1/emit.cxx (emit_banner): Use `SWIG_VERSION' instead
of integers `SWIG_VERSION_MAJOR' and `SWIG_VERSION_MINOR' (which are
deleted).

Source/SWIG1.1/main.cxx (SWIG_main): Likewise.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@235 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Thien-Thi Nguyen 2000-02-12 02:21:22 +00:00
commit e0957d51e2
6 changed files with 150 additions and 82 deletions

View file

@ -56,7 +56,7 @@ Modules1.1:
Swig: Swig:
@cd $(SOURCE)/Swig; $(MAKE) @cd $(SOURCE)/Swig; $(MAKE)
Preprocessor: Preprocessor:
@cd $(SOURCE)/Preprocessor; $(MAKE) @cd $(SOURCE)/Preprocessor; $(MAKE)
LParse: LParse:
@ -95,7 +95,7 @@ clean:
@cd Runtime; $(MAKE) clean @cd Runtime; $(MAKE) clean
rm -f swig rm -f swig
##################################################################### #####################################################################
# TARGETS: install & friends # TARGETS: install & friends
##################################################################### #####################################################################
@ -173,3 +173,24 @@ install-lib:
install-runtime: install-runtime:
@cd Runtime; $(MAKE) install @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

View file

@ -0,0 +1,5 @@
/* SWIG version information */
#define SWIG_VERSION "@SWIG_VERSION@"
#define SWIG_SPIN "@SWIG_SPIN@"

View file

@ -1,15 +1,15 @@
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
* emit.cxx * emit.cxx
* *
* Useful functions for emitting various pieces of code. * Useful functions for emitting various pieces of code.
* *
* Author(s) : David Beazley (beazley@cs.uchicago.edu) * Author(s) : David Beazley (beazley@cs.uchicago.edu)
* *
* Copyright (C) 1998-2000. The University of Chicago * Copyright (C) 1998-2000. The University of Chicago
* Copyright (C) 1995-1998. The University of Utah and The Regents of the * Copyright (C) 1995-1998. The University of Utah and The Regents of the
* University of California. * 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" #include "internal.h"
@ -18,7 +18,7 @@ static char cvsroot[] = "$Header$";
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// void emit_banner(FILE *f) // void emit_banner(FILE *f)
// //
// Emits the SWIG identifying banner in the wrapper file // Emits the SWIG identifying banner in the wrapper file
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -32,7 +32,7 @@ void emit_banner(FILE *f) {
* FILE : %s\n\ * FILE : %s\n\
* \n\ * \n\
* This file was automatically generated by SWIG (http://www.swig.org).\n\ * This file was automatically generated by SWIG (http://www.swig.org).\n\
* Version %d.%d %s\n\ * Version %s %s\n\
* \n\ * \n\
* Portions Copyright (c) 1995-1999\n\ * Portions Copyright (c) 1995-1999\n\
* The University of Utah, The Regents of the University of California, and\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\ * changes to this file unless you know what you are doing--modify the SWIG \n\
* interface file instead. \n\ * interface file instead. \n\
*\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"); 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) // emit_extern_var(char *decl, DataType *t, int extern_type, FILE *f)
// //
// Emits an external variables declaration. Extern_type defines the // Emits an external variables declaration. Extern_type defines the
// type of external declaration. Currently, only C/C++ declarations // type of external declaration. Currently, only C/C++ declarations
// are allowed, but this might be extended to allow Fortran linkage // 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) // FILE *f)
// //
// Emits an external function declaration (similiar to emit_extern_var). // Emits an external function declaration (similiar to emit_extern_var).
// //
// Inputs : // Inputs :
// decl = Name of declaration // decl = Name of declaration
// t = Return datatype // t = Return datatype
// L = parameter list // L = parameter list
@ -140,7 +140,7 @@ void emit_extern_func(char *decl, DataType *t, ParmList *L, int extern_type, FIL
} else { } else {
fprintf(f,"%s", t->print_full()); fprintf(f,"%s", t->print_full());
} }
fprintf(f,"%s(", decl); fprintf(f,"%s(", decl);
L->print_types(f); L->print_types(f);
fprintf(f,");\n"); fprintf(f,");\n");
@ -182,7 +182,7 @@ void emit_extern_func(char *decl, DataType *t, ParmList *L, int extern_type, FIL
} else { } else {
fprintf(f,"%s", t->print_full()); fprintf(f,"%s", t->print_full());
} }
fprintf(f,"%s(", decl); fprintf(f,"%s(", decl);
L->print_args(f); L->print_args(f);
fprintf(f,")\n"); fprintf(f,")\n");
@ -190,7 +190,7 @@ void emit_extern_func(char *decl, DataType *t, ParmList *L, int extern_type, FIL
default: default:
break; break;
} }
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// char *emit_local(int i) // char *emit_local(int i)
@ -253,7 +253,7 @@ int emit_args(DataType *rt, ParmList *l, FILE *f) {
if (p->defvalue) { if (p->defvalue) {
if ((p->t->is_reference) || ((p->t->type == T_USER) && (p->call_type == CALL_REFERENCE))) 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); 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); fprintf(f,"\t %s _arg%d = %s;\n", p->t->print_type(),i, p->defvalue);
} else { } else {
fprintf(f,"\t %s _arg%d;\n", p->t->print_type(),i); 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 // Check for ignore or default typemaps
tm = typemap_lookup("default",typemap_lang,p->t,p->name,"",temp); tm = typemap_lookup("default",typemap_lang,p->t,p->name,"",temp);
if (tm) if (tm)
def << tm; def << tm;
tm = typemap_lookup("ignore",typemap_lang,p->t,p->name,"",temp); 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()); fprintf(f,"%s",def.get());
// i now contains number of parameters // i now contains number of parameters
return(i); 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)) { if ((p->t->type != T_VOID) || (p->t->is_pointer)) {
char *temp = emit_local(i); char *temp = emit_local(i);
// Figure out default values // 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))) { ((p->t->type == T_USER) && (p->call_type == CALL_REFERENCE) && (p->defvalue))) {
String deftmp; String deftmp;
deftmp << "(" << p->t->print_type() << ") &" << p->defvalue; 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 // Check for ignore or default typemaps
tm = typemap_lookup("default",typemap_lang,p->t,p->name,"",temp,&f); tm = typemap_lookup("default",typemap_lang,p->t,p->name,"",temp,&f);
if (tm) if (tm)
f.code << tm << "\n"; f.code << tm << "\n";
tm = typemap_lookup("ignore",typemap_lang,p->t,p->name,"",temp,&f); tm = typemap_lookup("ignore",typemap_lang,p->t,p->name,"",temp,&f);
if (tm) { 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()); fprintf(f,"%s& _result_ref = ", t->print_full());
t->is_pointer++; t->is_pointer++;
} else { } else {
// Normal return values // Normal return values
fprintf(f,"_result = %s", t->print_cast()); 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) // int emit_func_call(char *decl, DataType *t, ParmList *l, WrapperFunction &f)
// //
// Emits code for a function call (new version). // Emits code for a function call (new version).
// //
// Exception handling support : // Exception handling support :
// //
// - This function checks to see if any sort of exception mechanism // - 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) // void emit_hex(FILE *f)
// //
// Emits the default C-code to handle pointers. This is normally contained // Emits the default C-code to handle pointers. This is normally contained
// in the SWIG library file 'swigptr.swg' // in the SWIG library file 'swigptr.swg'
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void emit_hex(FILE *f) { void emit_hex(FILE *f) {
int stat; int stat;
// Look for a pointer configuration file // 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. // 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 // This should be used as backup in case the target language can't
// provide variable linking. // provide variable linking.
// //
// double foo; // double foo;
// //
// Gets translated into the following : // Gets translated into the following :
@ -603,7 +603,7 @@ void emit_hex(FILE *f) {
// } // }
// //
// Need to handle special cases for char * and for user // Need to handle special cases for char * and for user
// defined types. // defined types.
// //
// 1. char * // 1. char *
// //
@ -612,7 +612,7 @@ void emit_hex(FILE *f) {
// natural thing to do. // natural thing to do.
// //
// 2. User_Defined // 2. User_Defined
// Will assign value from a pointer. // Will assign value from a pointer.
// Will return a pointer to current value. // 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", fprintf(f_header,"static %s %s(%s val) {\n",
t->print_type(), name_set(name), t->print_type()); t->print_type(), name_set(name), t->print_type());
} }
if ((t->type != T_VOID) || (t->is_pointer)) { if ((t->type != T_VOID) || (t->is_pointer)) {
if (!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. // If it's a user defined type, we'll do something special.
// Otherwise, just assign it. // Otherwise, just assign it.
if (t->type != T_USER) { if (t->type != T_USER) {
fprintf(f_header,"\t return (%s) (%s = val);\n", t->print_type(), name); fprintf(f_header,"\t return (%s) (%s = val);\n", t->print_type(), name);
} else { } else {
@ -653,10 +653,10 @@ void emit_set_get(char *name, char *iname, DataType *t) {
t->is_pointer--; t->is_pointer--;
} }
} else { } else {
// Is a pointer type here. If string, we do something // Is a pointer type here. If string, we do something
// special. Otherwise. No problem. // special. Otherwise. No problem.
if ((t->type == T_CHAR) && (t->is_pointer == 1)) { if ((t->type == T_CHAR) && (t->is_pointer == 1)) {
if (CPlusPlus) { if (CPlusPlus) {
fprintf(f_header,"\t if (%s) delete %s;\n", name,name); 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 = new char[1];
p->name[0] = 0; p->name[0] = 0;
l->append(p); l->append(p);
new_name = name_set(name); new_name = name_set(name);
new_iname = name_set(iname); new_iname = name_set(iname);
if ((t->type == T_USER) && (!t->is_pointer)) { if ((t->type == T_USER) && (!t->is_pointer)) {
t->is_pointer++; t->is_pointer++;
lang->create_function(new_name, new_iname, t, l); 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"); fprintf(f_header,"}\n");
// Wrap this function // Wrap this function
l = new ParmList; l = new ParmList;
@ -732,7 +732,7 @@ void emit_set_get(char *name, char *iname, DataType *t) {
} }
delete l; delete l;
} }

View file

@ -1,15 +1,15 @@
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
* main.cxx * main.cxx
* *
* Main entry point to the SWIG core. * Main entry point to the SWIG core.
* *
* Author(s) : David Beazley (beazley@cs.uchicago.edu) * Author(s) : David Beazley (beazley@cs.uchicago.edu)
* *
* Copyright (C) 1998-2000. The University of Chicago * Copyright (C) 1998-2000. The University of Chicago
* Copyright (C) 1995-1998. The University of Utah and The Regents of the * Copyright (C) 1995-1998. The University of Utah and The Regents of the
* University of California. * 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$"; static char cvsroot[] = "$Header$";
@ -24,7 +24,7 @@ static char cvsroot[] = "$Header$";
#include "preprocessor.h" #include "preprocessor.h"
#ifndef SWIG_LIB #ifndef SWIG_LIB
#define SWIG_LIB "/usr/local/lib/swig1.3" #define SWIG_LIB "/usr/local/lib/swig1.3"
#endif #endif
@ -34,14 +34,14 @@ static char cvsroot[] = "$Header$";
// Global variables // Global variables
FILE *f_runtime; FILE *f_runtime;
FILE *f_header; // Some commonly used FILE *f_header; // Some commonly used
FILE *f_wrappers; // FILE pointers FILE *f_wrappers; // FILE pointers
FILE *f_init; FILE *f_init;
FILE *f_input; FILE *f_input;
char InitName[256]; char InitName[256];
char LibDir[512]; // Library directory char LibDir[512]; // Library directory
int Status; int Status;
Language *lang; // Language method Language *lang; // Language method
int CPlusPlus = 0; int CPlusPlus = 0;
int ObjC = 0; int ObjC = 0;
@ -131,7 +131,7 @@ int SWIG_main(int argc, char *argv[], Language *l) {
lang = l; lang = l;
Status = 0; Status = 0;
DataType::init_typedef(); // Initialize the type handler DataType::init_typedef(); // Initialize the type handler
// Set up some default symbols (available in both SWIG interface files // 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 #ifdef SWIGWIN32
Preprocessor_define((DOH *) "SWIGWIN32 1", 0); Preprocessor_define((DOH *) "SWIGWIN32 1", 0);
#endif #endif
// Check for SWIG_LIB environment variable // Check for SWIG_LIB environment variable
if ((c = getenv("SWIG_LIB")) == (char *) 0) { if ((c = getenv("SWIG_LIB")) == (char *) 0) {
@ -153,7 +153,7 @@ int SWIG_main(int argc, char *argv[], Language *l) {
} else { } else {
strcpy(LibDir,c); strcpy(LibDir,c);
} }
SwigLib = copy_string(LibDir); // Make a copy of the real library location SwigLib = copy_string(LibDir); // Make a copy of the real library location
sprintf(temp,"%s/config", LibDir); sprintf(temp,"%s/config", LibDir);
@ -169,7 +169,7 @@ int SWIG_main(int argc, char *argv[], Language *l) {
for (i = 1; i < argc; i++) { for (i = 1; i < argc; i++) {
if (argv[i]) { if (argv[i]) {
if (strncmp(argv[i],"-I",2) == 0) { 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); includefiles[includecount++] = copy_string(argv[i]+2);
Swig_mark_arg(i); Swig_mark_arg(i);
} else if (strncmp(argv[i],"-D",2) == 0) { } 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); Swig_mark_arg(i);
} else if (strcmp(argv[i],"-c++") == 0) { } else if (strcmp(argv[i],"-c++") == 0) {
CPlusPlus=1; CPlusPlus=1;
Swig_mark_arg(i); Swig_mark_arg(i);
} else if (strcmp(argv[i],"-objc") == 0) { } else if (strcmp(argv[i],"-objc") == 0) {
ObjC = 1; ObjC = 1;
Swig_mark_arg(i); Swig_mark_arg(i);
@ -208,14 +208,14 @@ int SWIG_main(int argc, char *argv[], Language *l) {
Swig_arg_error(); Swig_arg_error();
} }
} else if (strcmp(argv[i],"-version") == 0) { } else if (strcmp(argv[i],"-version") == 0) {
fprintf(stderr,"\nSWIG Version %d.%d %s\n", SWIG_MAJOR_VERSION, fprintf(stderr,"\nSWIG Version %s %s\n",
SWIG_MINOR_VERSION, SWIG_SPIN); SWIG_VERSION, SWIG_SPIN);
fprintf(stderr,"Copyright (c) 1995-98\n"); fprintf(stderr,"Copyright (c) 1995-98\n");
fprintf(stderr,"University of Utah and the Regents of the University of California\n"); fprintf(stderr,"University of Utah and the Regents of the University of California\n");
fprintf(stderr,"\nCompiled with %s\n", SWIG_CC); fprintf(stderr,"\nCompiled with %s\n", SWIG_CC);
SWIG_exit(0); SWIG_exit(0);
} else if (strncmp(argv[i],"-l",2) == 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); Append(libfiles,argv[i]+2);
Swig_mark_arg(i); Swig_mark_arg(i);
} else if (strcmp(argv[i],"-co") == 0) { } else if (strcmp(argv[i],"-co") == 0) {
@ -264,7 +264,7 @@ int SWIG_main(int argc, char *argv[], Language *l) {
char *outfile = input_file; char *outfile = input_file;
if (outfile_name) if (outfile_name)
outfile = outfile_name; outfile = outfile_name;
s = Swig_include(input_file); s = Swig_include(input_file);
if (!s) { if (!s) {
fprintf(stderr,"Unable to locate '%s' in the SWIG library.\n", input_file); 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 { } 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" // declare everything we see as "extern"
ForceExtern = check_suffix(infilename); ForceExtern = check_suffix(infilename);
// Strip off suffix // Strip off suffix
c = infilename + strlen(infilename); c = infilename + strlen(infilename);
while (c != infilename) { while (c != infilename) {
if (*c == '.') { if (*c == '.') {
@ -300,7 +300,7 @@ int SWIG_main(int argc, char *argv[], Language *l) {
c--; c--;
} }
} }
if (!outfile_name) { if (!outfile_name) {
sprintf(fn_runtime,"%s_wrap.c",infilename); sprintf(fn_runtime,"%s_wrap.c",infilename);
strcpy(infile,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_header,"%s%s_wrap.head", output_dir,infile);
sprintf(fn_wrapper,"%s%s_wrap.wrap",output_dir,infile); sprintf(fn_wrapper,"%s%s_wrap.wrap",output_dir,infile);
sprintf(fn_init,"%s%s_wrap.init",output_dir,infile); sprintf(fn_init,"%s%s_wrap.init",output_dir,infile);
// Define the __cplusplus symbol // Define the __cplusplus symbol
if (CPlusPlus) if (CPlusPlus)
Preprocessor_define((DOH *) "__cplusplus 1", 0); Preprocessor_define((DOH *) "__cplusplus 1", 0);
// Run the preprocessor // Run the preprocessor
@ -368,12 +368,12 @@ int SWIG_main(int argc, char *argv[], Language *l) {
fwrite(Char(cpps),1, Len(cpps), f); fwrite(Char(cpps),1, Len(cpps), f);
fclose(f); fclose(f);
} }
if ((f_input = fopen(fn_cpp,"r")) == 0) { if ((f_input = fopen(fn_cpp,"r")) == 0) {
fprintf(stderr,"Unable to open %s\n", fn_cpp); fprintf(stderr,"Unable to open %s\n", fn_cpp);
SWIG_exit(0); SWIG_exit(0);
} }
// Initialize the scanner // Initialize the scanner
LEX_in = f_input; LEX_in = f_input;
scanner_file(LEX_in); 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); fprintf(stderr,"Unable to open %s\n",fn_init);
exit(0); exit(0);
} }
// Set up the typemap for handling new return strings // Set up the typemap for handling new return strings
{ {
DataType *temp_t = new DataType(T_CHAR); DataType *temp_t = new DataType(T_CHAR);
temp_t->is_pointer++; temp_t->is_pointer++;
if (CPlusPlus) if (CPlusPlus)
typemap_register("newfree",typemap_lang,temp_t,"","delete [] $source;\n",0); typemap_register("newfree",typemap_lang,temp_t,"","delete [] $source;\n",0);
else else
typemap_register("newfree",typemap_lang,temp_t,"","free($source);\n",0); typemap_register("newfree",typemap_lang,temp_t,"","free($source);\n",0);
delete temp_t; 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(); lang->parse();
@ -435,11 +435,11 @@ int SWIG_main(int argc, char *argv[], Language *l) {
insert_file(fn_header, f_runtime); insert_file(fn_header, f_runtime);
insert_file(fn_wrapper,f_runtime); insert_file(fn_wrapper,f_runtime);
insert_file(fn_init,f_runtime); insert_file(fn_init,f_runtime);
fclose(f_runtime); fclose(f_runtime);
// Remove temporary files // Remove temporary files
remove(fn_cpp); remove(fn_cpp);
remove(fn_header); remove(fn_header);
remove(fn_wrapper); remove(fn_wrapper);
@ -491,7 +491,7 @@ void SWIG_exit(int) {
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
void swig_pragma(char *name, char *value) { void swig_pragma(char *name, char *value) {
if (strcmp(name,"make_default") == 0) { if (strcmp(name,"make_default") == 0) {
GenerateDefault = 1; GenerateDefault = 1;
} }

26
SWIG/VERSION Normal file
View file

@ -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

View file

@ -1,6 +1,11 @@
dnl Process this file with autoconf to produce a configure script. dnl Process this file with autoconf to produce a configure script.
AC_INIT(Source/Swig/swig.h) AC_INIT(Source/Swig/swig.h)
AC_PREREQ(2.0) 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 # Set name for machine-dependent library files
AC_SUBST(MACHDEP) AC_SUBST(MACHDEP)
@ -78,7 +83,7 @@ then
hp*|HP*) LDSHARED="ld -b";; hp*|HP*) LDSHARED="ld -b";;
OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";; OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
DYNIX/ptx*) LDSHARED="ld -G";; DYNIX/ptx*) LDSHARED="ld -G";;
next/*) next/*)
if test "$ns_dyld" if test "$ns_dyld"
then LDSHARED='$(CC) $(LDFLAGS) -bundle -prebind' then LDSHARED='$(CC) $(LDFLAGS) -bundle -prebind'
else LDSHARED='$(CC) $(CFLAGS) -nostdlib -r'; else LDSHARED='$(CC) $(CFLAGS) -nostdlib -r';
@ -135,7 +140,7 @@ then
case $ac_sys_system/$ac_sys_release in case $ac_sys_system/$ac_sys_release in
SunOS/5*) RPATH="-R. -R$(exec_prefix)/lib";; SunOS/5*) RPATH="-R. -R$(exec_prefix)/lib";;
IRIX*) RPATH="-rpath .:$(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="";; *) RPATH="";;
esac esac
fi fi
@ -354,7 +359,7 @@ AC_SUBST(TCLLIB)
PYINCLUDE=nope PYINCLUDE=nope
PYLIB=nope PYLIB=nope
PYPACKAGE=nope PYPACKAGE=nope
PYLINK="-lModules -lPython -lObjects -lParser" PYLINK="-lModules -lPython -lObjects -lParser"
AC_ARG_WITH(py,[ --with-py=path Set location of Python],[ AC_ARG_WITH(py,[ --with-py=path Set location of Python],[
PYPACKAGE="$withval"], [PYPACKAGE=nope]) PYPACKAGE="$withval"], [PYPACKAGE=nope])
@ -399,7 +404,7 @@ for i in $dirs ; do
AC_MSG_RESULT($i) AC_MSG_RESULT($i)
PYLIB="$i" PYLIB="$i"
PYINCLUDE="$PYINCLUDE -I$i" PYINCLUDE="$PYINCLUDE -I$i"
PYLINK="-lpython1.5" PYLINK="-lpython1.5"
break break
fi fi
if test -r $i/libPython.a; then if test -r $i/libPython.a; then
@ -447,11 +452,11 @@ if test "$PERL" != nope; then
PERL5EXT="$i" PERL5EXT="$i"
break; break;
fi fi
done done
if test "$PERL5EXT" = none; then if test "$PERL5EXT" = none; then
PERL5EXT="$PERL5DIR/CORE" PERL5EXT="$PERL5DIR/CORE"
AC_MSG_RESULT(could not locate perl.h...using $PERL5EXT) AC_MSG_RESULT(could not locate perl.h...using $PERL5EXT)
fi fi
else else
AC_MSG_RESULT(unable to determine perl5 configuration) AC_MSG_RESULT(unable to determine perl5 configuration)
PERL5EXT=$PERL5DIR PERL5EXT=$PERL5DIR
@ -480,11 +485,22 @@ if test -d Source/SWILL/SWILL; then
fi fi
cd Tools; ./ltconfig --enable-dlopen ltmain.sh; cd .. cd Tools; ./ltconfig --enable-dlopen ltmain.sh; cd ..
AC_CONFIG_SUBDIRS(Source/SWILL Source/DOH) AC_CONFIG_SUBDIRS(Source/SWILL Source/DOH)
AC_OUTPUT(Makefile Source/Swig/Makefile AC_OUTPUT(
Source/Preprocessor/Makefile Source/SWIG1.1/Makefile Examples/Makefile
Source/Modules1.1/Makefile Source/LParse/Makefile Makefile
Source/Experiment/Makefile Source/Swim/Makefile Examples/Makefile Source/Include/swigconfig.h Runtime/Makefile
Source/Expat/Makefile Source/Xmlparse/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
)