From: <wsf...@us...> - 2008-11-03 12:51:51
|
Revision: 10898 http://swig.svn.sourceforge.net/swig/?rev=10898&view=rev Author: wsfulton Date: 2008-11-03 12:51:45 +0000 (Mon, 03 Nov 2008) Log Message: ----------- customised ccache support: read the CCACHE_OUTFILES env variable and if exists, the names of all generated files are written to the filename specified in the env variable Modified Paths: -------------- trunk/Source/DOH/README trunk/Source/DOH/doh.h trunk/Source/DOH/file.c trunk/Source/Modules/allegrocl.cxx trunk/Source/Modules/cffi.cxx trunk/Source/Modules/chicken.cxx trunk/Source/Modules/clisp.cxx trunk/Source/Modules/csharp.cxx trunk/Source/Modules/guile.cxx trunk/Source/Modules/java.cxx trunk/Source/Modules/lua.cxx trunk/Source/Modules/main.cxx trunk/Source/Modules/modula3.cxx trunk/Source/Modules/mzscheme.cxx trunk/Source/Modules/ocaml.cxx trunk/Source/Modules/octave.cxx trunk/Source/Modules/perl5.cxx trunk/Source/Modules/php.cxx trunk/Source/Modules/pike.cxx trunk/Source/Modules/python.cxx trunk/Source/Modules/r.cxx trunk/Source/Modules/ruby.cxx trunk/Source/Modules/s-exp.cxx trunk/Source/Modules/swigmod.h trunk/Source/Modules/tcl8.cxx trunk/Source/Modules/uffi.cxx trunk/Source/Modules/xml.cxx Modified: trunk/Source/DOH/README =================================================================== --- trunk/Source/DOH/README 2008-11-01 23:09:26 UTC (rev 10897) +++ trunk/Source/DOH/README 2008-11-03 12:51:45 UTC (rev 10898) @@ -92,12 +92,12 @@ Currently Available datatypes ------------------------------ -NewString(char *initial) Strings -NewHash() Hash -NewList() List -NewVoid(void *ptr, void (*del)(void *)) Void -NewFile(char *file, char *mode) File -NewCallable(DOH *(*func)(DOH *, DOH *)) Callable object +NewString(char *initial) Strings +NewHash() Hash +NewList() List +NewVoid(void *ptr, void (*del)(void *)) Void +NewFile(char *filename, char *mode, List *newfiles) File +NewCallable(DOH *(*func)(DOH *, DOH *)) Callable object Odds and ends: Modified: trunk/Source/DOH/doh.h =================================================================== --- trunk/Source/DOH/doh.h 2008-11-01 23:09:26 UTC (rev 10897) +++ trunk/Source/DOH/doh.h 2008-11-03 12:51:45 UTC (rev 10898) @@ -297,7 +297,7 @@ * Files * ----------------------------------------------------------------------------- */ -extern DOHFile *DohNewFile(DOH *file, const char *mode); +extern DOHFile *DohNewFile(DOH *filename, const char *mode, DOHList *outfiles); extern DOHFile *DohNewFileFromFile(FILE *f); extern DOHFile *DohNewFileFromFd(int fd); extern void DohFileErrorDisplay(DOHString * filename); Modified: trunk/Source/DOH/file.c =================================================================== --- trunk/Source/DOH/file.c 2008-11-01 23:09:26 UTC (rev 10897) +++ trunk/Source/DOH/file.c 2008-11-03 12:51:45 UTC (rev 10898) @@ -228,15 +228,16 @@ * NewFile() * * Create a new file from a given filename and mode. + * If newfiles is non-zero, the filename is added to the list of new files. * ----------------------------------------------------------------------------- */ -DOH *DohNewFile(DOH *fn, const char *mode) { +DOH *DohNewFile(DOH *filename, const char *mode, DOHList *newfiles) { DohFile *f; FILE *file; - char *filename; + char *filen; - filename = Char(fn); - file = fopen(filename, mode); + filen = Char(filename); + file = fopen(filen, mode); if (!file) return 0; @@ -245,6 +246,8 @@ fclose(file); return 0; } + if (newfiles) + Append(newfiles, filename); f->filep = file; f->fd = 0; f->closeondel = 1; Modified: trunk/Source/Modules/allegrocl.cxx =================================================================== --- trunk/Source/Modules/allegrocl.cxx 2008-11-01 23:09:26 UTC (rev 10897) +++ trunk/Source/Modules/allegrocl.cxx 2008-11-03 12:51:45 UTC (rev 10898) @@ -1590,7 +1590,7 @@ Printf(cl_filename, "%s%s.cl", SWIG_output_directory(), module_name); - f_cl = NewFile(cl_filename, "w"); + f_cl = NewFile(cl_filename, "w", SWIG_output_files()); if (!f_cl) { Printf(stderr, "Unable to open %s for writing\n", cl_filename); SWIG_exit(EXIT_FAILURE); @@ -1599,7 +1599,7 @@ Generate_Wrapper = CPlusPlus || CWrap; if (Generate_Wrapper) { - f_cxx = NewFile(cxx_filename, "w"); + f_cxx = NewFile(cxx_filename, "w", SWIG_output_files()); if (!f_cxx) { Close(f_cl); Delete(f_cl); Modified: trunk/Source/Modules/cffi.cxx =================================================================== --- trunk/Source/Modules/cffi.cxx 2008-11-01 23:09:26 UTC (rev 10897) +++ trunk/Source/Modules/cffi.cxx 2008-11-03 12:51:45 UTC (rev 10898) @@ -119,15 +119,14 @@ Printf(lisp_filename, "%s%s.lisp", SWIG_output_directory(), module); - File *f_lisp = NewFile(lisp_filename, "w"); - NewFile(lisp_filename, "w"); + File *f_lisp = NewFile(lisp_filename, "w", SWIG_output_files()); if (!f_lisp) { FileErrorDisplay(lisp_filename); SWIG_exit(EXIT_FAILURE); } if (CPlusPlus || CWrap) { - f_cxx = NewFile(cxx_filename, "w"); + f_cxx = NewFile(cxx_filename, "w", SWIG_output_files()); if (!f_cxx) { Close(f_lisp); Delete(f_lisp); @@ -137,7 +136,7 @@ String *clos_filename = NewString(""); Printf(clos_filename, "%s%s-clos.lisp", SWIG_output_directory(), module); - f_clos = NewFile(clos_filename, "w"); + f_clos = NewFile(clos_filename, "w", SWIG_output_files()); if (!f_clos) { Close(f_lisp); Delete(f_lisp); Modified: trunk/Source/Modules/chicken.cxx =================================================================== --- trunk/Source/Modules/chicken.cxx 2008-11-01 23:09:26 UTC (rev 10897) +++ trunk/Source/Modules/chicken.cxx 2008-11-03 12:51:45 UTC (rev 10898) @@ -188,7 +188,7 @@ /* Initialize all of the output files */ String *outfile = Getattr(n, "outfile"); - f_runtime = NewFile(outfile, "w"); + f_runtime = NewFile(outfile, "w", SWIG_output_files()); if (!f_runtime) { FileErrorDisplay(outfile); SWIG_exit(EXIT_FAILURE); @@ -251,7 +251,7 @@ Printf(f_init, "#endif\n"); Printf(chicken_filename, "%s%s.scm", SWIG_output_directory(), module); - if ((f_scm = NewFile(chicken_filename, "w")) == 0) { + if ((f_scm = NewFile(chicken_filename, "w", SWIG_output_files())) == 0) { FileErrorDisplay(chicken_filename); SWIG_exit(EXIT_FAILURE); } Modified: trunk/Source/Modules/clisp.cxx =================================================================== --- trunk/Source/Modules/clisp.cxx 2008-11-01 23:09:26 UTC (rev 10897) +++ trunk/Source/Modules/clisp.cxx 2008-11-03 12:51:45 UTC (rev 10898) @@ -79,7 +79,7 @@ Printf(output_filename, "%s%s.lisp", SWIG_output_directory(), module); } - f_cl = NewFile(output_filename, "w+"); + f_cl = NewFile(output_filename, "w+", SWIG_output_files()); if (!f_cl) { FileErrorDisplay(output_filename); SWIG_exit(EXIT_FAILURE); Modified: trunk/Source/Modules/csharp.cxx =================================================================== --- trunk/Source/Modules/csharp.cxx 2008-11-01 23:09:26 UTC (rev 10897) +++ trunk/Source/Modules/csharp.cxx 2008-11-03 12:51:45 UTC (rev 10898) @@ -286,7 +286,7 @@ SWIG_exit(EXIT_FAILURE); } - f_runtime = NewFile(outfile, "w"); + f_runtime = NewFile(outfile, "w", SWIG_output_files()); if (!f_runtime) { FileErrorDisplay(outfile); SWIG_exit(EXIT_FAILURE); @@ -297,7 +297,7 @@ Printf(stderr, "Unable to determine outfile_h\n"); SWIG_exit(EXIT_FAILURE); } - f_runtime_h = NewFile(outfile_h, "w"); + f_runtime_h = NewFile(outfile_h, "w", SWIG_output_files()); if (!f_runtime_h) { FileErrorDisplay(outfile_h); SWIG_exit(EXIT_FAILURE); @@ -396,7 +396,7 @@ // Generate the intermediary class { String *filen = NewStringf("%s%s.cs", SWIG_output_directory(), imclass_name); - File *f_im = NewFile(filen, "w"); + File *f_im = NewFile(filen, "w", SWIG_output_files()); if (!f_im) { FileErrorDisplay(filen); SWIG_exit(EXIT_FAILURE); @@ -440,7 +440,7 @@ // Generate the C# module class { String *filen = NewStringf("%s%s.cs", SWIG_output_directory(), module_class_name); - File *f_module = NewFile(filen, "w"); + File *f_module = NewFile(filen, "w", SWIG_output_files()); if (!f_module) { FileErrorDisplay(filen); SWIG_exit(EXIT_FAILURE); @@ -1155,7 +1155,7 @@ } else { // Global enums are defined in their own file String *filen = NewStringf("%s%s.cs", SWIG_output_directory(), symname); - File *f_enum = NewFile(filen, "w"); + File *f_enum = NewFile(filen, "w", SWIG_output_files()); if (!f_enum) { FileErrorDisplay(filen); SWIG_exit(EXIT_FAILURE); @@ -1734,7 +1734,7 @@ } String *filen = NewStringf("%s%s.cs", SWIG_output_directory(), proxy_class_name); - f_proxy = NewFile(filen, "w"); + f_proxy = NewFile(filen, "w", SWIG_output_files()); if (!f_proxy) { FileErrorDisplay(filen); SWIG_exit(EXIT_FAILURE); @@ -2960,7 +2960,7 @@ void emitTypeWrapperClass(String *classname, SwigType *type) { String *swigtype = NewString(""); String *filen = NewStringf("%s%s.cs", SWIG_output_directory(), classname); - File *f_swigtype = NewFile(filen, "w"); + File *f_swigtype = NewFile(filen, "w", SWIG_output_files()); if (!f_swigtype) { FileErrorDisplay(filen); SWIG_exit(EXIT_FAILURE); Modified: trunk/Source/Modules/guile.cxx =================================================================== --- trunk/Source/Modules/guile.cxx 2008-11-01 23:09:26 UTC (rev 10897) +++ trunk/Source/Modules/guile.cxx 2008-11-03 12:51:45 UTC (rev 10898) @@ -174,7 +174,7 @@ } } else if (strcmp(argv[i], "-procdoc") == 0) { if (argv[i + 1]) { - procdoc = NewFile(argv[i + 1], (char *) "w"); + procdoc = NewFile(argv[i + 1], "w", SWIG_output_files()); if (!procdoc) { FileErrorDisplay(argv[i + 1]); SWIG_exit(EXIT_FAILURE); @@ -299,7 +299,7 @@ /* Initialize all of the output files */ String *outfile = Getattr(n, "outfile"); - f_runtime = NewFile(outfile, "w"); + f_runtime = NewFile(outfile, "w", SWIG_output_files()); if (!f_runtime) { FileErrorDisplay(outfile); SWIG_exit(EXIT_FAILURE); @@ -499,7 +499,7 @@ SWIG_output_directory(), primitive_name); Delete(primitive_name); - File *scmstubfile = NewFile(fname, (char *) "w"); + File *scmstubfile = NewFile(fname, "w", SWIG_output_files()); if (!scmstubfile) { FileErrorDisplay(fname); SWIG_exit(EXIT_FAILURE); @@ -530,7 +530,7 @@ String *fname = NewStringf("%s%s.scm", SWIG_output_directory(), module_name); - File *goopsfile = NewFile(fname, (char *) "w"); + File *goopsfile = NewFile(fname, "w", SWIG_output_files()); if (!goopsfile) { FileErrorDisplay(fname); SWIG_exit(EXIT_FAILURE); Modified: trunk/Source/Modules/java.cxx =================================================================== --- trunk/Source/Modules/java.cxx 2008-11-01 23:09:26 UTC (rev 10897) +++ trunk/Source/Modules/java.cxx 2008-11-03 12:51:45 UTC (rev 10898) @@ -293,7 +293,7 @@ SWIG_exit(EXIT_FAILURE); } - f_runtime = NewFile(outfile, "w"); + f_runtime = NewFile(outfile, "w", SWIG_output_files()); if (!f_runtime) { FileErrorDisplay(outfile); SWIG_exit(EXIT_FAILURE); @@ -304,7 +304,7 @@ Printf(stderr, "Unable to determine outfile_h\n"); SWIG_exit(EXIT_FAILURE); } - f_runtime_h = NewFile(outfile_h, "w"); + f_runtime_h = NewFile(outfile_h, "w", SWIG_output_files()); if (!f_runtime_h) { FileErrorDisplay(outfile_h); SWIG_exit(EXIT_FAILURE); @@ -420,7 +420,7 @@ // Generate the intermediary class { String *filen = NewStringf("%s%s.java", SWIG_output_directory(), imclass_name); - File *f_im = NewFile(filen, "w"); + File *f_im = NewFile(filen, "w", SWIG_output_files()); if (!f_im) { FileErrorDisplay(filen); SWIG_exit(EXIT_FAILURE); @@ -471,7 +471,7 @@ // Generate the Java module class { String *filen = NewStringf("%s%s.java", SWIG_output_directory(), module_class_name); - File *f_module = NewFile(filen, "w"); + File *f_module = NewFile(filen, "w", SWIG_output_files()); if (!f_module) { FileErrorDisplay(filen); SWIG_exit(EXIT_FAILURE); @@ -523,7 +523,7 @@ // Generate the Java constants interface if (Len(module_class_constants_code) != 0) { String *filen = NewStringf("%s%sConstants.java", SWIG_output_directory(), module_class_name); - File *f_module = NewFile(filen, "w"); + File *f_module = NewFile(filen, "w", SWIG_output_files()); if (!f_module) { FileErrorDisplay(filen); SWIG_exit(EXIT_FAILURE); @@ -1210,7 +1210,7 @@ } else { // Global enums are defined in their own file String *filen = NewStringf("%s%s.java", SWIG_output_directory(), symname); - File *f_enum = NewFile(filen, "w"); + File *f_enum = NewFile(filen, "w", SWIG_output_files()); if (!f_enum) { FileErrorDisplay(filen); SWIG_exit(EXIT_FAILURE); @@ -1742,7 +1742,7 @@ } String *filen = NewStringf("%s%s.java", SWIG_output_directory(), proxy_class_name); - f_proxy = NewFile(filen, "w"); + f_proxy = NewFile(filen, "w", SWIG_output_files()); if (!f_proxy) { FileErrorDisplay(filen); SWIG_exit(EXIT_FAILURE); @@ -2798,7 +2798,7 @@ void emitTypeWrapperClass(String *classname, SwigType *type) { String *swigtype = NewString(""); String *filen = NewStringf("%s%s.java", SWIG_output_directory(), classname); - File *f_swigtype = NewFile(filen, "w"); + File *f_swigtype = NewFile(filen, "w", SWIG_output_files()); if (!f_swigtype) { FileErrorDisplay(filen); SWIG_exit(EXIT_FAILURE); Modified: trunk/Source/Modules/lua.cxx =================================================================== --- trunk/Source/Modules/lua.cxx 2008-11-01 23:09:26 UTC (rev 10897) +++ trunk/Source/Modules/lua.cxx 2008-11-03 12:51:45 UTC (rev 10898) @@ -213,7 +213,7 @@ String *outfile = Getattr(n, "outfile"); /* Open the output file */ - f_runtime = NewFile(outfile, "w"); + f_runtime = NewFile(outfile, "w", SWIG_output_files()); if (!f_runtime) { FileErrorDisplay(outfile); SWIG_exit(EXIT_FAILURE); Modified: trunk/Source/Modules/main.cxx =================================================================== --- trunk/Source/Modules/main.cxx 2008-11-01 23:09:26 UTC (rev 10897) +++ trunk/Source/Modules/main.cxx 2008-11-03 12:51:45 UTC (rev 10898) @@ -180,6 +180,7 @@ static int external_runtime = 0; static String *external_runtime_name = 0; enum { STAGE1=1, STAGE2=2, STAGE3=4, STAGE4=8, STAGEOVERFLOW=16 }; +static List *all_output_files = 0; // ----------------------------------------------------------------------------- // check_suffix(char *name) @@ -300,6 +301,11 @@ cpp_extension = (char *) ext; } +List *SWIG_output_files() { + assert(all_output_files); + return all_output_files; +} + void SWIG_setfeature(const char *cfeature, const char *cvalue) { Hash *features_hash = Swig_cparse_features(); String *name = NewString(""); @@ -363,7 +369,7 @@ } } - runtime = NewFile(outfile, "w"); + runtime = NewFile(outfile, "w", SWIG_output_files()); if (!runtime) { FileErrorDisplay(outfile); SWIG_exit(EXIT_FAILURE); @@ -867,6 +873,7 @@ } libfiles = NewList(); + all_output_files = NewList(); /* Check for SWIG_FEATURES environment variable */ @@ -940,20 +947,21 @@ if (!s) { fprintf(stderr, "Unable to locate '%s' in the SWIG library.\n", input_file); } else { - FILE *f = fopen(outfile, "r"); + FILE *f = Swig_open(outfile); if (f) { fclose(f); fprintf(stderr, "File '%s' already exists. Checkout aborted.\n", outfile); } else { - f = fopen(outfile, "w"); - if (!f) { - fprintf(stderr, "Unable to create file '%s'\n", outfile); - } else { - if (Verbose) - fprintf(stdout, "'%s' checked out from the SWIG library.\n", input_file); - fputs(Char(s), f); - fclose(f); - } + File *f_outfile = NewFile(outfile, "w", SWIG_output_files()); + if (!f_outfile) { + FileErrorDisplay(outfile); + SWIG_exit(EXIT_FAILURE); + } else { + if (Verbose) + fprintf(stdout, "'%s' checked out from the SWIG library.\n", outfile); + Printv(f_outfile, s, NIL); + Close(f_outfile); + } } } } else { @@ -1019,14 +1027,14 @@ outfile = NewString(outfile_name); } if (dependencies_file && Len(dependencies_file) != 0) { - f_dependencies_file = NewFile(dependencies_file, "w"); + f_dependencies_file = NewFile(dependencies_file, "w", SWIG_output_files()); if (!f_dependencies_file) { FileErrorDisplay(dependencies_file); SWIG_exit(EXIT_FAILURE); } } else if (!depend_only) { String *filename = NewStringf("%s_wrap.%s", Swig_file_basename(input_file), depends_extension); - f_dependencies_file = NewFile(filename, "w"); + f_dependencies_file = NewFile(filename, "w", SWIG_output_files()); if (!f_dependencies_file) { FileErrorDisplay(filename); SWIG_exit(EXIT_FAILURE); @@ -1173,6 +1181,21 @@ if (memory_debug) DohMemoryDebug(); + char *outfiles = getenv("CCACHE_OUTFILES"); + if (outfiles) { + File *f_outfiles = NewFile(outfiles, "w", 0); + if (!f_outfiles) { + Printf(stderr, "Failed to write list of output files to the filename '%s' specified in CCACHE_OUTFILES environment variable - ", outfiles); + FileErrorDisplay(f_outfiles); + SWIG_exit(EXIT_FAILURE); + } else { + int i; + for (i = 0; i < Len(all_output_files); i++) + Printf(f_outfiles, "%s\n", Getitem(all_output_files, i)); + Close(f_outfiles); + } + } + // Deletes Delete(libfiles); Preprocessor_delete(); Modified: trunk/Source/Modules/modula3.cxx =================================================================== --- trunk/Source/Modules/modula3.cxx 2008-11-01 23:09:26 UTC (rev 10897) +++ trunk/Source/Modules/modula3.cxx 2008-11-03 12:51:45 UTC (rev 10898) @@ -542,7 +542,7 @@ * ----------------------------------------------------------------------------- */ File *openWriteFile(String *name) { - File *file = NewFile(name, "w"); + File *file = NewFile(name, "w", SWIG_output_files()); if (!file) { FileErrorDisplay(name); SWIG_exit(EXIT_FAILURE); @@ -902,7 +902,7 @@ /* Initialize all of the output files */ outfile = Getattr(n, "outfile"); - f_runtime = NewFile(outfile, "w"); + f_runtime = NewFile(outfile, "w", SWIG_output_files()); if (!f_runtime) { FileErrorDisplay(outfile); SWIG_exit(EXIT_FAILURE); @@ -2382,7 +2382,7 @@ } String *filen = NewStringf("%s%s.m3", Swig_file_dirname(outfile), proxy_class_name); - f_proxy = NewFile(filen, "w"); + f_proxy = NewFile(filen, "w", SWIG_output_files()); if (!f_proxy) { FileErrorDisplay(filen); SWIG_exit(EXIT_FAILURE); @@ -3762,7 +3762,7 @@ void emitTypeWrapperClass(String *classname, SwigType *type) { String *filen = NewStringf("%s%s.m3", Swig_file_dirname(outfile), classname); - File *f_swigtype = NewFile(filen, "w"); + File *f_swigtype = NewFile(filen, "w", SWIG_output_files()); if (!f_swigtype) { FileErrorDisplay(filen); SWIG_exit(EXIT_FAILURE); Modified: trunk/Source/Modules/mzscheme.cxx =================================================================== --- trunk/Source/Modules/mzscheme.cxx 2008-11-01 23:09:26 UTC (rev 10897) +++ trunk/Source/Modules/mzscheme.cxx 2008-11-03 12:51:45 UTC (rev 10898) @@ -129,7 +129,7 @@ /* Initialize all of the output files */ String *outfile = Getattr(n, "outfile"); - f_runtime = NewFile(outfile, "w"); + f_runtime = NewFile(outfile, "w", SWIG_output_files()); if (!f_runtime) { FileErrorDisplay(outfile); SWIG_exit(EXIT_FAILURE); Modified: trunk/Source/Modules/ocaml.cxx =================================================================== --- trunk/Source/Modules/ocaml.cxx 2008-11-01 23:09:26 UTC (rev 10897) +++ trunk/Source/Modules/ocaml.cxx 2008-11-03 12:51:45 UTC (rev 10898) @@ -214,7 +214,7 @@ /* Initialize all of the output files */ String *outfile = Getattr(n, "outfile"); - f_runtime = NewFile(outfile, "w"); + f_runtime = NewFile(outfile, "w", SWIG_output_files()); if (!f_runtime) { FileErrorDisplay(outfile); SWIG_exit(EXIT_FAILURE); @@ -293,12 +293,12 @@ Printv(mlifile, module, ".mli", NIL); String *mlfilen = NewStringf("%s%s", SWIG_output_directory(), mlfile); - if ((f_mlout = NewFile(mlfilen, "w")) == 0) { + if ((f_mlout = NewFile(mlfilen, "w", SWIG_output_files())) == 0) { FileErrorDisplay(mlfilen); SWIG_exit(EXIT_FAILURE); } String *mlifilen = NewStringf("%s%s", SWIG_output_directory(), mlifile); - if ((f_mliout = NewFile(mlifilen, "w")) == 0) { + if ((f_mliout = NewFile(mlifilen, "w", SWIG_output_files())) == 0) { FileErrorDisplay(mlifilen); SWIG_exit(EXIT_FAILURE); } Modified: trunk/Source/Modules/octave.cxx =================================================================== --- trunk/Source/Modules/octave.cxx 2008-11-01 23:09:26 UTC (rev 10897) +++ trunk/Source/Modules/octave.cxx 2008-11-03 12:51:45 UTC (rev 10898) @@ -87,7 +87,7 @@ String *module = Getattr(n, "name"); String *outfile = Getattr(n, "outfile"); - f_runtime = NewFile(outfile, "w"); + f_runtime = NewFile(outfile, "w", SWIG_output_files()); if (!f_runtime) { FileErrorDisplay(outfile); SWIG_exit(EXIT_FAILURE); Modified: trunk/Source/Modules/perl5.cxx =================================================================== --- trunk/Source/Modules/perl5.cxx 2008-11-01 23:09:26 UTC (rev 10897) +++ trunk/Source/Modules/perl5.cxx 2008-11-03 12:51:45 UTC (rev 10898) @@ -222,7 +222,7 @@ /* Initialize all of the output files */ String *outfile = Getattr(n, "outfile"); - f_runtime = NewFile(outfile, "w"); + f_runtime = NewFile(outfile, "w", SWIG_output_files()); if (!f_runtime) { FileErrorDisplay(outfile); SWIG_exit(EXIT_FAILURE); @@ -315,7 +315,7 @@ pmfile = NewStringf("%s.pm", m); } String *filen = NewStringf("%s%s", SWIG_output_directory(), pmfile); - if ((f_pm = NewFile(filen, "w")) == 0) { + if ((f_pm = NewFile(filen, "w", SWIG_output_files())) == 0) { FileErrorDisplay(filen); SWIG_exit(EXIT_FAILURE); } Modified: trunk/Source/Modules/php.cxx =================================================================== --- trunk/Source/Modules/php.cxx 2008-11-01 23:09:26 UTC (rev 10897) +++ trunk/Source/Modules/php.cxx 2008-11-03 12:51:45 UTC (rev 10898) @@ -258,7 +258,7 @@ String *outfile = Getattr(n, "outfile"); /* main output file */ - f_runtime = NewFile(outfile, "w"); + f_runtime = NewFile(outfile, "w", SWIG_output_files()); if (!f_runtime) { FileErrorDisplay(outfile); SWIG_exit(EXIT_FAILURE); @@ -302,7 +302,7 @@ Printv(filen, SWIG_output_directory(), module, ".php", NIL); phpfilename = NewString(filen); - f_phpcode = NewFile(filen, "w"); + f_phpcode = NewFile(filen, "w", SWIG_output_files()); if (!f_phpcode) { FileErrorDisplay(filen); SWIG_exit(EXIT_FAILURE); @@ -381,7 +381,7 @@ /* Create the .h file too */ filen = NewStringEmpty(); Printv(filen, SWIG_output_directory(), "php_", module, ".h", NIL); - f_h = NewFile(filen, "w"); + f_h = NewFile(filen, "w", SWIG_output_files()); if (!f_h) { FileErrorDisplay(filen); SWIG_exit(EXIT_FAILURE); Modified: trunk/Source/Modules/pike.cxx =================================================================== --- trunk/Source/Modules/pike.cxx 2008-11-01 23:09:26 UTC (rev 10897) +++ trunk/Source/Modules/pike.cxx 2008-11-03 12:51:45 UTC (rev 10898) @@ -123,7 +123,7 @@ String *outfile = Getattr(n, "outfile"); /* Open the output file */ - f_runtime = NewFile(outfile, "w"); + f_runtime = NewFile(outfile, "w", SWIG_output_files()); if (!f_runtime) { FileErrorDisplay(outfile); SWIG_exit(EXIT_FAILURE); Modified: trunk/Source/Modules/python.cxx =================================================================== --- trunk/Source/Modules/python.cxx 2008-11-01 23:09:26 UTC (rev 10897) +++ trunk/Source/Modules/python.cxx 2008-11-03 12:51:45 UTC (rev 10898) @@ -513,7 +513,7 @@ String *outfile = Getattr(n, "outfile"); String *outfile_h = !no_header_file ? Getattr(n, "outfile_h") : 0; - f_runtime = NewFile(outfile, "w"); + f_runtime = NewFile(outfile, "w", SWIG_output_files()); if (!f_runtime) { FileErrorDisplay(outfile); SWIG_exit(EXIT_FAILURE); @@ -521,7 +521,7 @@ if (directorsEnabled()) { if (!no_header_file) { - f_runtime_h = NewFile(outfile_h, "w"); + f_runtime_h = NewFile(outfile_h, "w", SWIG_output_files()); if (!f_runtime_h) { FileErrorDisplay(outfile_h); SWIG_exit(EXIT_FAILURE); @@ -662,7 +662,7 @@ module = interface; else Insert(module, 0, "_"); - if ((f_shadow_py = NewFile(filen, "w")) == 0) { + if ((f_shadow_py = NewFile(filen, "w", SWIG_output_files())) == 0) { FileErrorDisplay(filen); SWIG_exit(EXIT_FAILURE); } Modified: trunk/Source/Modules/r.cxx =================================================================== --- trunk/Source/Modules/r.cxx 2008-11-01 23:09:26 UTC (rev 10897) +++ trunk/Source/Modules/r.cxx 2008-11-03 12:51:45 UTC (rev 10898) @@ -878,7 +878,7 @@ Printf(stderr, "Writing S code to %s\n", output_filename); #endif - File *scode = NewFile(output_filename, "w"); + File *scode = NewFile(output_filename, "w", SWIG_output_files()); if (!scode) { FileErrorDisplay(output_filename); SWIG_exit(EXIT_FAILURE); @@ -893,7 +893,7 @@ Close(scode); // Delete(scode); String *outfile = Getattr(n,"outfile"); - File *runtime = NewFile(outfile,"w"); + File *runtime = NewFile(outfile,"w", SWIG_output_files()); if (!runtime) { FileErrorDisplay(outfile); SWIG_exit(EXIT_FAILURE); @@ -920,7 +920,7 @@ if(outputNamespaceInfo) { output_filename = NewString(""); Printf(output_filename, "%sNAMESPACE", SWIG_output_directory()); - File *ns = NewFile(output_filename, "w"); + File *ns = NewFile(output_filename, "w", SWIG_output_files()); if (!ns) { FileErrorDisplay(output_filename); SWIG_exit(EXIT_FAILURE); Modified: trunk/Source/Modules/ruby.cxx =================================================================== --- trunk/Source/Modules/ruby.cxx 2008-11-01 23:09:26 UTC (rev 10897) +++ trunk/Source/Modules/ruby.cxx 2008-11-03 12:51:45 UTC (rev 10898) @@ -992,7 +992,7 @@ SWIG_exit(EXIT_FAILURE); } - f_runtime = NewFile(outfile, "w"); + f_runtime = NewFile(outfile, "w", SWIG_output_files()); if (!f_runtime) { FileErrorDisplay(outfile); SWIG_exit(EXIT_FAILURE); @@ -1003,7 +1003,7 @@ Printf(stderr, "Unable to determine outfile_h\n"); SWIG_exit(EXIT_FAILURE); } - f_runtime_h = NewFile(outfile_h, "w"); + f_runtime_h = NewFile(outfile_h, "w", SWIG_output_files()); if (!f_runtime_h) { FileErrorDisplay(outfile_h); SWIG_exit(EXIT_FAILURE); Modified: trunk/Source/Modules/s-exp.cxx =================================================================== --- trunk/Source/Modules/s-exp.cxx 2008-11-01 23:09:26 UTC (rev 10897) +++ trunk/Source/Modules/s-exp.cxx 2008-11-03 12:51:45 UTC (rev 10898) @@ -59,7 +59,7 @@ String *outfile = Getattr(n, "outfile"); Replaceall(outfile, "_wrap.cxx", ".lisp"); Replaceall(outfile, "_wrap.c", ".lisp"); - out = NewFile(outfile, "w"); + out = NewFile(outfile, "w", SWIG_output_files()); if (!out) { FileErrorDisplay(outfile); SWIG_exit(EXIT_FAILURE); Modified: trunk/Source/Modules/swigmod.h =================================================================== --- trunk/Source/Modules/swigmod.h 2008-11-01 23:09:26 UTC (rev 10897) +++ trunk/Source/Modules/swigmod.h 2008-11-03 12:51:45 UTC (rev 10898) @@ -317,6 +317,9 @@ const String *SWIG_output_directory(); void SWIG_config_cppext(const char *ext); +/* get the list of generated files */ +List *SWIG_output_files(); + void SWIG_library_directory(const char *); int emit_num_arguments(ParmList *); int emit_num_required(ParmList *); Modified: trunk/Source/Modules/tcl8.cxx =================================================================== --- trunk/Source/Modules/tcl8.cxx 2008-11-01 23:09:26 UTC (rev 10897) +++ trunk/Source/Modules/tcl8.cxx 2008-11-03 12:51:45 UTC (rev 10898) @@ -136,7 +136,7 @@ /* Initialize all of the output files */ String *outfile = Getattr(n, "outfile"); - f_runtime = NewFile(outfile, "w"); + f_runtime = NewFile(outfile, "w", SWIG_output_files()); if (!f_runtime) { FileErrorDisplay(outfile); SWIG_exit(EXIT_FAILURE); @@ -177,7 +177,7 @@ Insert(module, 0, "_"); - if ((f_shadow = NewFile(filen, "w")) == 0) { + if ((f_shadow = NewFile(filen, "w", SWIG_output_files())) == 0) { FileErrorDisplay(filen); SWIG_exit(EXIT_FAILURE); } Modified: trunk/Source/Modules/uffi.cxx =================================================================== --- trunk/Source/Modules/uffi.cxx 2008-11-01 23:09:26 UTC (rev 10897) +++ trunk/Source/Modules/uffi.cxx 2008-11-03 12:51:45 UTC (rev 10898) @@ -229,7 +229,7 @@ Printf(output_filename, "%s%s.cl", SWIG_output_directory(), module); - f_cl = NewFile(output_filename, "w"); + f_cl = NewFile(output_filename, "w", SWIG_output_files()); if (!f_cl) { FileErrorDisplay(output_filename); SWIG_exit(EXIT_FAILURE); Modified: trunk/Source/Modules/xml.cxx =================================================================== --- trunk/Source/Modules/xml.cxx 2008-11-01 23:09:26 UTC (rev 10897) +++ trunk/Source/Modules/xml.cxx 2008-11-03 12:51:45 UTC (rev 10898) @@ -47,7 +47,7 @@ iX++; Swig_mark_arg(iX); String *outfile = NewString(argv[iX]); - out = NewFile(outfile, "w"); + out = NewFile(outfile, "w", SWIG_output_files()); if (!out) { FileErrorDisplay(outfile); SWIG_exit(EXIT_FAILURE); @@ -82,7 +82,7 @@ Replaceall(outfile, ".cxx", ".xml"); Replaceall(outfile, ".cpp", ".xml"); Replaceall(outfile, ".c", ".xml"); - out = NewFile(outfile, "w"); + out = NewFile(outfile, "w", SWIG_output_files()); if (!out) { FileErrorDisplay(outfile); SWIG_exit(EXIT_FAILURE); @@ -301,7 +301,7 @@ if (!filename) { out = stdout; } else { - out = NewFile(filename, "w"); + out = NewFile(filename, "w", SWIG_output_files()); if (!out) { FileErrorDisplay(filename); SWIG_exit(EXIT_FAILURE); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wsf...@us...> - 2008-11-11 22:17:45
|
Revision: 10926 http://swig.svn.sourceforge.net/swig/?rev=10926&view=rev Author: wsfulton Date: 2008-11-11 22:17:40 +0000 (Tue, 11 Nov 2008) Log Message: ----------- add parameter list (or void) to all C functions Modified Paths: -------------- trunk/Source/CParse/cparse.h trunk/Source/DOH/doh.h trunk/Source/DOH/hash.c trunk/Source/DOH/list.c trunk/Source/DOH/string.c trunk/Source/Swig/getopt.c trunk/Source/Swig/include.c trunk/Source/Swig/scanner.c trunk/Source/Swig/swigfile.h trunk/Source/Swig/swigopt.h trunk/Source/Swig/swigscan.h trunk/Source/Swig/swigwrap.h trunk/Source/Swig/wrapfunc.c Modified: trunk/Source/CParse/cparse.h =================================================================== --- trunk/Source/CParse/cparse.h 2008-11-10 21:53:15 UTC (rev 10925) +++ trunk/Source/CParse/cparse.h 2008-11-11 22:17:40 UTC (rev 10926) @@ -38,12 +38,12 @@ extern void Swig_cparse_follow_locators(int); extern void start_inline(char *, int); extern String *scanner_ccode; - extern int yylex(); + extern int yylex(void); /* parser.y */ extern SwigType *Swig_cparse_type(String *); extern Node *Swig_cparse(File *); - extern Hash *Swig_cparse_features(); + extern Hash *Swig_cparse_features(void); extern void SWIG_cparse_set_compact_default_args(int defargs); extern int SWIG_cparse_template_reduce(int treduce); Modified: trunk/Source/DOH/doh.h =================================================================== --- trunk/Source/DOH/doh.h 2008-11-10 21:53:15 UTC (rev 10925) +++ trunk/Source/DOH/doh.h 2008-11-11 22:17:40 UTC (rev 10926) @@ -271,7 +271,7 @@ * Strings. * ----------------------------------------------------------------------------- */ -extern DOHString *DohNewStringEmpty(); +extern DOHString *DohNewStringEmpty(void); extern DOHString *DohNewString(const DOH *c); extern DOHString *DohNewStringWithSize(const DOH *c, int len); extern DOHString *DohNewStringf(const DOH *fmt, ...); @@ -309,14 +309,14 @@ * List * ----------------------------------------------------------------------------- */ -extern DOHList *DohNewList(); +extern DOHList *DohNewList(void); extern void DohSortList(DOH *lo, int (*cmp) (const DOH *, const DOH *)); /* ----------------------------------------------------------------------------- * Hash * ----------------------------------------------------------------------------- */ -extern DOHHash *DohNewHash(); +extern DOHHash *DohNewHash(void); /* ----------------------------------------------------------------------------- * Void Modified: trunk/Source/DOH/hash.c =================================================================== --- trunk/Source/DOH/hash.c 2008-11-10 21:53:15 UTC (rev 10925) +++ trunk/Source/DOH/hash.c 2008-11-11 22:17:40 UTC (rev 10926) @@ -535,7 +535,7 @@ * Create a new hash table. * ----------------------------------------------------------------------------- */ -DOH *DohNewHash() { +DOH *DohNewHash(void) { Hash *h; int i; h = (Hash *) DohMalloc(sizeof(Hash)); Modified: trunk/Source/DOH/list.c =================================================================== --- trunk/Source/DOH/list.c 2008-11-10 21:53:15 UTC (rev 10925) +++ trunk/Source/DOH/list.c 2008-11-11 22:17:40 UTC (rev 10926) @@ -345,7 +345,7 @@ #define MAXLISTITEMS 8 -DOH *DohNewList() { +DOH *DohNewList(void) { List *l; int i; l = (List *) DohMalloc(sizeof(List)); Modified: trunk/Source/DOH/string.c =================================================================== --- trunk/Source/DOH/string.c 2008-11-10 21:53:15 UTC (rev 10925) +++ trunk/Source/DOH/string.c 2008-11-11 22:17:40 UTC (rev 10926) @@ -1056,7 +1056,7 @@ * NewStringEmpty() - Create a new string * ----------------------------------------------------------------------------- */ -DOHString *DohNewStringEmpty() { +DOHString *DohNewStringEmpty(void) { int max = INIT_MAXSIZE; String *str = (String *) DohMalloc(sizeof(String)); str->hashkey = 0; Modified: trunk/Source/Swig/getopt.c =================================================================== --- trunk/Source/Swig/getopt.c 2008-11-10 21:53:15 UTC (rev 10925) +++ trunk/Source/Swig/getopt.c 2008-11-11 22:17:40 UTC (rev 10926) @@ -100,7 +100,7 @@ * Generates a generic error message and exits. * ----------------------------------------------------------------------------- */ -void Swig_arg_error() { +void Swig_arg_error(void) { Printf(stderr, "SWIG : Unable to parse command line options.\n"); Printf(stderr, "Use 'swig -help' for available options.\n"); exit(1); Modified: trunk/Source/Swig/include.c =================================================================== --- trunk/Source/Swig/include.c 2008-11-10 21:53:15 UTC (rev 10925) +++ trunk/Source/Swig/include.c 2008-11-11 22:17:40 UTC (rev 10926) @@ -73,7 +73,7 @@ * the preprocessor. * ----------------------------------------------------------------------------- */ -void Swig_pop_directory() { +void Swig_pop_directory(void) { if (!Swig_get_push_dir()) return; if (!pdirectories) @@ -87,7 +87,7 @@ * Returns the full pathname of the last file opened. * ----------------------------------------------------------------------------- */ -String *Swig_last_file() { +String *Swig_last_file(void) { assert(lastpath); return lastpath; } Modified: trunk/Source/Swig/scanner.c =================================================================== --- trunk/Source/Swig/scanner.c 2008-11-10 21:53:15 UTC (rev 10925) +++ trunk/Source/Swig/scanner.c 2008-11-11 22:17:40 UTC (rev 10926) @@ -36,7 +36,7 @@ * Create a new scanner object * ----------------------------------------------------------------------------- */ -Scanner *NewScanner() { +Scanner *NewScanner(void) { Scanner *s; s = (Scanner *) malloc(sizeof(Scanner)); s->line = 1; Modified: trunk/Source/Swig/swigfile.h =================================================================== --- trunk/Source/Swig/swigfile.h 2008-11-10 21:53:15 UTC (rev 10925) +++ trunk/Source/Swig/swigfile.h 2008-11-11 22:17:40 UTC (rev 10926) @@ -11,9 +11,9 @@ extern List *Swig_add_directory(const String_or_char *dirname); extern void Swig_push_directory(const String_or_char *dirname); -extern void Swig_pop_directory(); -extern String *Swig_last_file(); -extern List *Swig_search_path(); +extern void Swig_pop_directory(void); +extern String *Swig_last_file(void); +extern List *Swig_search_path(int syspathvoid); extern FILE *Swig_open(const String_or_char *name); extern String *Swig_read_file(FILE *f); extern String *Swig_include(const String_or_char *name); Modified: trunk/Source/Swig/swigopt.h =================================================================== --- trunk/Source/Swig/swigopt.h 2008-11-10 21:53:15 UTC (rev 10925) +++ trunk/Source/Swig/swigopt.h 2008-11-11 22:17:40 UTC (rev 10926) @@ -13,4 +13,4 @@ extern void Swig_mark_arg(int n); extern int Swig_check_marked(int n); extern void Swig_check_options(int check_input); - extern void Swig_arg_error(); + extern void Swig_arg_error(void); Modified: trunk/Source/Swig/swigscan.h =================================================================== --- trunk/Source/Swig/swigscan.h 2008-11-10 21:53:15 UTC (rev 10925) +++ trunk/Source/Swig/swigscan.h 2008-11-11 22:17:40 UTC (rev 10926) @@ -11,7 +11,7 @@ typedef struct Scanner Scanner; -extern Scanner *NewScanner(); +extern Scanner *NewScanner(void); extern void DelScanner(Scanner *); extern void Scanner_clear(Scanner *); extern void Scanner_push(Scanner *, String *); Modified: trunk/Source/Swig/swigwrap.h =================================================================== --- trunk/Source/Swig/swigwrap.h 2008-11-10 21:53:15 UTC (rev 10925) +++ trunk/Source/Swig/swigwrap.h 2008-11-11 22:17:40 UTC (rev 10926) @@ -16,7 +16,7 @@ String *code; } Wrapper; -extern Wrapper *NewWrapper(); +extern Wrapper *NewWrapper(void); extern void DelWrapper(Wrapper *w); extern void Wrapper_compact_print_mode_set(int flag); extern void Wrapper_pretty_print(String *str, File *f); Modified: trunk/Source/Swig/wrapfunc.c =================================================================== --- trunk/Source/Swig/wrapfunc.c 2008-11-10 21:53:15 UTC (rev 10925) +++ trunk/Source/Swig/wrapfunc.c 2008-11-11 22:17:40 UTC (rev 10926) @@ -23,7 +23,7 @@ * Create a new wrapper function object. * ----------------------------------------------------------------------------- */ -Wrapper *NewWrapper() { +Wrapper *NewWrapper(void) { Wrapper *w; w = (Wrapper *) malloc(sizeof(Wrapper)); w->localh = NewHash(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wsf...@us...> - 2008-11-11 22:28:23
|
Revision: 10927 http://swig.svn.sourceforge.net/swig/?rev=10927&view=rev Author: wsfulton Date: 2008-11-11 22:28:18 +0000 (Tue, 11 Nov 2008) Log Message: ----------- fix Swig_search_path declaration Modified Paths: -------------- trunk/Source/CParse/parser.y trunk/Source/Swig/include.c trunk/Source/Swig/swigfile.h Modified: trunk/Source/CParse/parser.y =================================================================== --- trunk/Source/CParse/parser.y 2008-11-11 22:17:40 UTC (rev 10926) +++ trunk/Source/CParse/parser.y 2008-11-11 22:28:18 UTC (rev 10927) @@ -203,7 +203,7 @@ static String *resolve_node_scope(String *cname); -Hash *Swig_cparse_features() { +Hash *Swig_cparse_features(void) { static Hash *features_hash = 0; if (!features_hash) features_hash = NewHash(); return features_hash; Modified: trunk/Source/Swig/include.c =================================================================== --- trunk/Source/Swig/include.c 2008-11-11 22:17:40 UTC (rev 10926) +++ trunk/Source/Swig/include.c 2008-11-11 22:28:18 UTC (rev 10927) @@ -93,7 +93,7 @@ } /* ----------------------------------------------------------------------------- - * Swig_search_path() + * Swig_search_path_any() * * Returns a list of the current search paths. * ----------------------------------------------------------------------------- */ Modified: trunk/Source/Swig/swigfile.h =================================================================== --- trunk/Source/Swig/swigfile.h 2008-11-11 22:17:40 UTC (rev 10926) +++ trunk/Source/Swig/swigfile.h 2008-11-11 22:28:18 UTC (rev 10927) @@ -13,7 +13,7 @@ extern void Swig_push_directory(const String_or_char *dirname); extern void Swig_pop_directory(void); extern String *Swig_last_file(void); -extern List *Swig_search_path(int syspathvoid); +extern List *Swig_search_path(void); extern FILE *Swig_open(const String_or_char *name); extern String *Swig_read_file(FILE *f); extern String *Swig_include(const String_or_char *name); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wsf...@us...> - 2008-12-12 21:10:58
|
Revision: 10980 http://swig.svn.sourceforge.net/swig/?rev=10980&view=rev Author: wsfulton Date: 2008-12-12 21:10:48 +0000 (Fri, 12 Dec 2008) Log Message: ----------- fix display of garbage where it should display an error message in error situations of unterminated string, comment etc within %inline, nested struct etc Modified Paths: -------------- trunk/Source/CParse/cscanner.c trunk/Source/Swig/scanner.c Modified: trunk/Source/CParse/cscanner.c =================================================================== --- trunk/Source/CParse/cscanner.c 2008-12-09 22:27:32 UTC (rev 10979) +++ trunk/Source/CParse/cscanner.c 2008-12-12 21:10:48 UTC (rev 10980) @@ -264,10 +264,8 @@ while (1) { if ((tok = Scanner_token(scan)) == 0) return 0; - if (tok == SWIG_TOKEN_ERROR) { - Swig_error(Scanner_file(scan), Scanner_errline(scan), Scanner_errmsg(scan)); - continue; - } + if (tok == SWIG_TOKEN_ERROR) + return 0; cparse_start_line = Scanner_start_line(scan); cparse_line = Scanner_line(scan); cparse_file = Scanner_file(scan); Modified: trunk/Source/Swig/scanner.c =================================================================== --- trunk/Source/Swig/scanner.c 2008-12-09 22:27:32 UTC (rev 10979) +++ trunk/Source/Swig/scanner.c 2008-12-12 21:10:48 UTC (rev 10980) @@ -15,6 +15,9 @@ #include "swig.h" #include <ctype.h> +extern String *cparse_file; +extern int cparse_start_line; + struct Scanner { String *text; /* Current token value */ List *scanobjs; /* Objects being scanned */ @@ -536,7 +539,7 @@ break; case 10: /* C++ style comment */ if ((c = nextchar(s)) == 0) { - set_error(s,s->start_line,"Unterminated comment"); + Swig_error(cparse_file, cparse_start_line, "Unterminated comment\n"); return SWIG_TOKEN_ERROR; } if (c == '\n') { @@ -548,7 +551,7 @@ break; case 11: /* C style comment block */ if ((c = nextchar(s)) == 0) { - set_error(s,s->start_line,"Unterminated comment"); + Swig_error(cparse_file, cparse_start_line, "Unterminated comment\n"); return SWIG_TOKEN_ERROR; } if (c == '*') { @@ -559,7 +562,7 @@ break; case 12: /* Still in C style comment */ if ((c = nextchar(s)) == 0) { - set_error(s,s->start_line,"Unterminated comment"); + Swig_error(cparse_file, cparse_start_line, "Unterminated comment\n"); return SWIG_TOKEN_ERROR; } if (c == '*') { @@ -573,7 +576,7 @@ case 2: /* Processing a string */ if ((c = nextchar(s)) == 0) { - set_error(s,s->start_line, "Unterminated string"); + Swig_error(cparse_file, cparse_start_line, "Unterminated string\n"); return SWIG_TOKEN_ERROR; } if (c == '\"') { @@ -656,7 +659,7 @@ case 40: /* Process an include block */ if ((c = nextchar(s)) == 0) { - set_error(s,s->start_line,"Unterminated code block"); + Swig_error(cparse_file, cparse_start_line, "Unterminated block\n"); return SWIG_TOKEN_ERROR; } if (c == '%') @@ -933,7 +936,7 @@ /* A character constant */ case 9: if ((c = nextchar(s)) == 0) { - set_error(s,s->start_line,"Unterminated character constant"); + Swig_error(cparse_file, cparse_start_line, "Unterminated character constant\n"); return SWIG_TOKEN_ERROR; } if (c == '\'') { @@ -1048,7 +1051,7 @@ /* Reverse string */ case 900: if ((c = nextchar(s)) == 0) { - set_error(s,s->start_line,"Unterminated character constant"); + Swig_error(cparse_file, cparse_start_line, "Unterminated character constant\n"); return SWIG_TOKEN_ERROR; } if (c == '`') { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wsf...@us...> - 2008-12-24 13:19:59
|
Revision: 11000 http://swig.svn.sourceforge.net/swig/?rev=11000&view=rev Author: wsfulton Date: 2008-12-24 13:19:55 +0000 (Wed, 24 Dec 2008) Log Message: ----------- fix input filename containing a path on windows Modified Paths: -------------- trunk/Source/Modules/main.cxx trunk/Source/Swig/include.c trunk/Source/Swig/misc.c trunk/Source/Swig/swig.h Modified: trunk/Source/Modules/main.cxx =================================================================== --- trunk/Source/Modules/main.cxx 2008-12-23 22:47:58 UTC (rev 10999) +++ trunk/Source/Modules/main.cxx 2008-12-24 13:19:55 UTC (rev 11000) @@ -1002,7 +1002,7 @@ if (lang_config) { Printf(fs, "\n%%include <%s>\n", lang_config); } - Printf(fs, "%%include(maininput=\"%s\") \"%s\"\n", input_file, Swig_last_file()); + Printf(fs, "%%include(maininput=\"%s\") \"%s\"\n", Swig_filename_escape(NewString(input_file)), Swig_last_file()); for (i = 0; i < Len(libfiles); i++) { Printf(fs, "\n%%include \"%s\"\n", Getitem(libfiles, i)); } Modified: trunk/Source/Swig/include.c =================================================================== --- trunk/Source/Swig/include.c 2008-12-23 22:47:58 UTC (rev 10999) +++ trunk/Source/Swig/include.c 2008-12-24 13:19:55 UTC (rev 11000) @@ -183,12 +183,8 @@ Delete(spath); } if (f) { -#if defined(_WIN32) /* Note not on Cygwin else filename is displayed with double '/' */ - Replaceall(filename, "\\\\", "\\"); /* remove double '\' in case any already present */ - Replaceall(filename, "\\", "\\\\"); -#endif Delete(lastpath); - lastpath = Copy(filename); + lastpath = Swig_filename_escape(filename); } Delete(filename); return f; Modified: trunk/Source/Swig/misc.c =================================================================== --- trunk/Source/Swig/misc.c 2008-12-23 22:47:58 UTC (rev 10999) +++ trunk/Source/Swig/misc.c 2008-12-24 13:19:55 UTC (rev 11000) @@ -118,6 +118,21 @@ /* ----------------------------------------------------------------------------- + * Swig_filename_escape() + * + * Escapes backslashes in filename - for Windows + * ----------------------------------------------------------------------------- */ + +String *Swig_filename_escape(String *filename) { + String *adjusted_filename = Copy(filename); +#if defined(_WIN32) /* Note not on Cygwin else filename is displayed with double '/' */ + Replaceall(adjusted_filename, "\\\\", "\\"); /* remove double '\' in case any already present */ + Replaceall(adjusted_filename, "\\", "\\\\"); +#endif + return adjusted_filename; +} + +/* ----------------------------------------------------------------------------- * Swig_string_escape() * * Takes a string object and produces a string with escape codes added to it. Modified: trunk/Source/Swig/swig.h =================================================================== --- trunk/Source/Swig/swig.h 2008-12-23 22:47:58 UTC (rev 10999) +++ trunk/Source/Swig/swig.h 2008-12-24 13:19:55 UTC (rev 11000) @@ -286,6 +286,7 @@ extern const char *Swig_package_version(void); extern void Swig_banner(File *f); extern String *Swig_strip_c_comments(const String *s); + extern String *Swig_filename_escape(String *filename); extern String *Swig_string_escape(String *s); extern String *Swig_string_mangle(const String *s); extern void Swig_scopename_split(String *s, String **prefix, String **last); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wsf...@us...> - 2008-12-24 14:50:30
|
Revision: 11001 http://swig.svn.sourceforge.net/swig/?rev=11001&view=rev Author: wsfulton Date: 2008-12-24 14:50:26 +0000 (Wed, 24 Dec 2008) Log Message: ----------- accept unix directory separators on windows for input file Modified Paths: -------------- trunk/Source/Modules/lang.cxx trunk/Source/Modules/main.cxx trunk/Source/Modules/modula3.cxx trunk/Source/Modules/php.cxx trunk/Source/Modules/swigmod.h trunk/Source/Preprocessor/cpp.c trunk/Source/Swig/misc.c trunk/Source/Swig/swig.h Modified: trunk/Source/Modules/lang.cxx =================================================================== --- trunk/Source/Modules/lang.cxx 2008-12-24 13:19:55 UTC (rev 11000) +++ trunk/Source/Modules/lang.cxx 2008-12-24 14:50:26 UTC (rev 11001) @@ -61,7 +61,7 @@ static String *AttributeFunctionSet = 0; static Node *CurrentClass = 0; int line_number = 0; -char *input_file = 0; +String *input_file = 0; int SmartPointer = 0; static Hash *classhash; @@ -352,7 +352,7 @@ Extend = 1; line_number = Getline(n); - input_file = Char(Getfile(n)); + input_file = Getfile(n); /* symtab = Getattr(n,"symtab"); Modified: trunk/Source/Modules/main.cxx =================================================================== --- trunk/Source/Modules/main.cxx 2008-12-24 13:19:55 UTC (rev 11000) +++ trunk/Source/Modules/main.cxx 2008-12-24 14:50:26 UTC (rev 11001) @@ -185,12 +185,13 @@ static List *all_output_files = 0; // ----------------------------------------------------------------------------- -// check_suffix(char *name) +// check_suffix() // // Checks the suffix of a file to see if we should emit extern declarations. // ----------------------------------------------------------------------------- -static int check_suffix(const char *name) { +static int check_suffix(String *filename) { + const char *name = Char(filename); const char *c; if (!name) return 0; @@ -936,12 +937,13 @@ // If we made it this far, looks good. go for it.... - input_file = argv[argc - 1]; + input_file = NewString(argv[argc - 1]); + Swig_filename_correct(input_file); // If the user has requested to check out a file, handle that if (checkout) { DOH *s; - char *outfile = input_file; + String *outfile = Char(input_file); if (outfile_name) outfile = outfile_name; @@ -1002,7 +1004,7 @@ if (lang_config) { Printf(fs, "\n%%include <%s>\n", lang_config); } - Printf(fs, "%%include(maininput=\"%s\") \"%s\"\n", Swig_filename_escape(NewString(input_file)), Swig_last_file()); + Printf(fs, "%%include(maininput=\"%s\") \"%s\"\n", Swig_filename_escape(input_file), Swig_last_file()); for (i = 0; i < Len(libfiles); i++) { Printf(fs, "\n%%include \"%s\"\n", Getitem(libfiles, i)); } Modified: trunk/Source/Modules/modula3.cxx =================================================================== --- trunk/Source/Modules/modula3.cxx 2008-12-24 13:19:55 UTC (rev 11000) +++ trunk/Source/Modules/modula3.cxx 2008-12-24 14:50:26 UTC (rev 11001) @@ -3174,8 +3174,7 @@ Clear(result_m3wraptype); Printv(result_m3wraptype, tm, NIL); } else { - Swig_warning(WARN_MODULA3_TYPEMAP_MULTIPLE_RETURN, - input_file, line_number, + Swig_warning(WARN_MODULA3_TYPEMAP_MULTIPLE_RETURN, input_file, line_number, "Typemap m3wrapargdir set to 'out' for %s implies a RETURN value, but the routine %s has already one.\nUse %%multiretval feature.\n", SwigType_str(Getattr(p, "type"), 0), raw_name); } Modified: trunk/Source/Modules/php.cxx =================================================================== --- trunk/Source/Modules/php.cxx 2008-12-24 13:19:55 UTC (rev 11000) +++ trunk/Source/Modules/php.cxx 2008-12-24 14:50:26 UTC (rev 11001) @@ -1489,8 +1489,7 @@ Replaceall(tm, "$symname", iname); Printf(f_c->code, "%s\n", tm); } else { - Printf(stderr,"%s: Line %d, Unable to link with type %s\n", - input_file, line_number, SwigType_str(t, 0)); + Printf(stderr,"%s: Line %d, Unable to link with type %s\n", input_file, line_number, SwigType_str(t, 0)); } */ /* Now generate C -> PHP sync blocks */ @@ -1502,8 +1501,7 @@ Replaceall(tm, "$symname", iname); Printf(f_php->code, "%s\n", tm); } else { - Printf(stderr,"%s: Line %d, Unable to link with type %s\n", - input_file, line_number, SwigType_str(t, 0)); + Printf(stderr,"%s: Line %d, Unable to link with type %s\n", input_file, line_number, SwigType_str(t, 0)); } } */ Modified: trunk/Source/Modules/swigmod.h =================================================================== --- trunk/Source/Modules/swigmod.h 2008-12-24 13:19:55 UTC (rev 11000) +++ trunk/Source/Modules/swigmod.h 2008-12-24 14:50:26 UTC (rev 11001) @@ -26,7 +26,7 @@ #define PLAIN_VIRTUAL 1 #define PURE_VIRTUAL 2 -extern char *input_file; +extern String *input_file; extern int line_number; extern int start_line; extern int CPlusPlus; // C++ mode Modified: trunk/Source/Preprocessor/cpp.c =================================================================== --- trunk/Source/Preprocessor/cpp.c 2008-12-24 13:19:55 UTC (rev 11000) +++ trunk/Source/Preprocessor/cpp.c 2008-12-24 14:50:26 UTC (rev 11001) @@ -650,14 +650,7 @@ if (isspace(c)) Ungetc(c, str); } -#if defined(_WIN32) || defined(MACSWIG) - /* accept Unix path separator on non-Unix systems */ - Replaceall(fn, "/", SWIG_FILE_DELIMITER); -#endif -#if defined(__CYGWIN__) - /* accept Windows path separator in addition to Unix path separator */ - Replaceall(fn, "\\", SWIG_FILE_DELIMITER); -#endif + Swig_filename_correct(fn); Seek(fn, 0, SEEK_SET); return fn; } Modified: trunk/Source/Swig/misc.c =================================================================== --- trunk/Source/Swig/misc.c 2008-12-24 13:19:55 UTC (rev 11000) +++ trunk/Source/Swig/misc.c 2008-12-24 14:50:26 UTC (rev 11001) @@ -118,6 +118,23 @@ /* ----------------------------------------------------------------------------- + * Swig_filename_correct() + * + * Corrects filenames on non-unix systems + * ----------------------------------------------------------------------------- */ + +void Swig_filename_correct(String *filename) { +#if defined(_WIN32) || defined(MACSWIG) + /* accept Unix path separator on non-Unix systems */ + Replaceall(filename, "/", SWIG_FILE_DELIMITER); +#endif +#if defined(__CYGWIN__) + /* accept Windows path separator in addition to Unix path separator */ + Replaceall(filename, "\\", SWIG_FILE_DELIMITER); +#endif +} + +/* ----------------------------------------------------------------------------- * Swig_filename_escape() * * Escapes backslashes in filename - for Windows Modified: trunk/Source/Swig/swig.h =================================================================== --- trunk/Source/Swig/swig.h 2008-12-24 13:19:55 UTC (rev 11000) +++ trunk/Source/Swig/swig.h 2008-12-24 14:50:26 UTC (rev 11001) @@ -287,6 +287,7 @@ extern void Swig_banner(File *f); extern String *Swig_strip_c_comments(const String *s); extern String *Swig_filename_escape(String *filename); + extern void Swig_filename_correct(String *filename); extern String *Swig_string_escape(String *s); extern String *Swig_string_mangle(const String *s); extern void Swig_scopename_split(String *s, String **prefix, String **last); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wsf...@us...> - 2008-12-29 22:56:31
|
Revision: 11016 http://swig.svn.sourceforge.net/swig/?rev=11016&view=rev Author: wsfulton Date: 2008-12-29 22:56:25 +0000 (Mon, 29 Dec 2008) Log Message: ----------- create a common banner header for all target language specific files Modified Paths: -------------- trunk/Source/Modules/allegrocl.cxx trunk/Source/Modules/cffi.cxx trunk/Source/Modules/chicken.cxx trunk/Source/Modules/clisp.cxx trunk/Source/Modules/csharp.cxx trunk/Source/Modules/guile.cxx trunk/Source/Modules/java.cxx trunk/Source/Modules/modula3.cxx trunk/Source/Modules/mzscheme.cxx trunk/Source/Modules/ocaml.cxx trunk/Source/Modules/octave.cxx trunk/Source/Modules/perl5.cxx trunk/Source/Modules/python.cxx trunk/Source/Modules/r.cxx trunk/Source/Modules/s-exp.cxx trunk/Source/Modules/tcl8.cxx trunk/Source/Modules/uffi.cxx trunk/Source/Swig/misc.c trunk/Source/Swig/swig.h Modified: trunk/Source/Modules/allegrocl.cxx =================================================================== --- trunk/Source/Modules/allegrocl.cxx 2008-12-29 22:25:55 UTC (rev 11015) +++ trunk/Source/Modules/allegrocl.cxx 2008-12-29 22:56:25 UTC (rev 11016) @@ -21,7 +21,7 @@ static File *f_cl = 0; String *f_clhead = NewString(""); String *f_clwrap = NewString("(swig-in-package ())\n\n"); -static File *f_cxx; +static File *f_runtime; static File *f_cxx_header = 0; static File *f_cxx_wrapper = 0; @@ -1599,27 +1599,29 @@ Generate_Wrapper = CPlusPlus || CWrap; if (Generate_Wrapper) { - f_cxx = NewFile(cxx_filename, "w", SWIG_output_files()); - if (!f_cxx) { + f_runtime = NewFile(cxx_filename, "w", SWIG_output_files()); + if (!f_runtime) { Close(f_cl); Delete(f_cl); Printf(stderr, "Unable to open %s for writing\n", cxx_filename); SWIG_exit(EXIT_FAILURE); } } else - f_cxx = NewString(""); + f_runtime = NewString(""); - f_cxx_header = f_cxx; + f_cxx_header = f_runtime; f_cxx_wrapper = NewString(""); Swig_register_filebyname("header", f_cxx_header); Swig_register_filebyname("wrapper", f_cxx_wrapper); - Swig_register_filebyname("runtime", f_cxx); + Swig_register_filebyname("runtime", f_runtime); Swig_register_filebyname("lisp", f_clwrap); Swig_register_filebyname("lisphead", f_cl); - Printf(f_cl, ";; This is an automatically generated file. Make changes in\n" - ";; the definition file, not here.\n\n" + Swig_banner(f_runtime); + Swig_banner_target_lang(f_cl, ";;"); + + Printf(f_cl, "\n" "(defpackage :%s\n" " (:use :common-lisp :ff :excl)\n" " (:export #:*swig-identifier-converter* #:*swig-module-name*\n" @@ -1636,7 +1638,7 @@ Language::top(n); - // SwigType_emit_type_table(f_cxx,f_cxx_wrapper); + // SwigType_emit_type_table(f_runtime,f_cxx_wrapper); // Swig_print_tree(n); #ifdef ALLEGROCL_TYPE_DEBUG @@ -1659,10 +1661,10 @@ Delete(f_clhead); Delete(f_clwrap); - Printf(f_cxx, "%s\n", f_cxx_wrapper); + Printf(f_runtime, "%s\n", f_cxx_wrapper); - Close(f_cxx); - Delete(f_cxx); + Close(f_runtime); + Delete(f_runtime); Delete(f_cxx_wrapper); // Swig_print_tree(n); @@ -2803,8 +2805,8 @@ SwigType_add_qualifier(const_type, "static"); String *ppcname = NewStringf("ACLppc_%s", Getattr(n, "sym:name")); - // Printf(f_cxx, "static const %s = %s;\n", SwigType_lstr(const_type, ppcname), const_val); - Printf(f_cxx, "%s = %s;\n", SwigType_lstr(const_type, ppcname), const_val); + // Printf(f_runtime, "static const %s = %s;\n", SwigType_lstr(const_type, ppcname), const_val); + Printf(f_runtime, "%s = %s;\n", SwigType_lstr(const_type, ppcname), const_val); Setattr(n, "name", ppcname); SetFlag(n, "feature:immutable"); @@ -2861,7 +2863,7 @@ ctype = SwigType_str(type, 0); // EXPORT <SwigType_str> <mangled_name>; // <SwigType_str> <mangled_name> = <name>; - // Printf(f_cxx, "EXPORT %s %s;\n%s %s = %s%s;\n", ctype, mangled_name, + // Printf(f_runtime, "EXPORT %s %s;\n%s %s = %s%s;\n", ctype, mangled_name, // ctype, mangled_name, (pointer_added ? "&" : ""), name); Printf(f_clwrap, "(swig-defvar \"%s\" \"%s\" :type %s)\n", @@ -2900,12 +2902,12 @@ // EXPORT <SwigType_str> <mangled_name>; // <SwigType_str> <mangled_name> = <name>; - Printf(f_cxx, "EXPORT %s %s;\n%s %s = %s%s;\n", ctype, mangled_name, ctype, mangled_name, (pointer_added ? "&" : ""), name); + Printf(f_runtime, "EXPORT %s %s;\n%s %s = %s%s;\n", ctype, mangled_name, ctype, mangled_name, (pointer_added ? "&" : ""), name); Printf(f_cl, "(swig-defvar \"%s\" :type %s)\n", mangled_name, ((SwigType_isconst(type)) ? ":constant" : ":variable")); /* - Printf(f_cxx, "// swigtype: %s\n", SwigType_typedef_resolve_all(Getattr(n,"type"))); - Printf(f_cxx, "// vwrap: %s\n", compose_foreign_type(SwigType_strip_qualifiers(Copy(rtype)))); + Printf(f_runtime, "// swigtype: %s\n", SwigType_typedef_resolve_all(Getattr(n,"type"))); + Printf(f_runtime, "// vwrap: %s\n", compose_foreign_type(SwigType_strip_qualifiers(Copy(rtype)))); */ Printf(stderr,"***\n"); Modified: trunk/Source/Modules/cffi.cxx =================================================================== --- trunk/Source/Modules/cffi.cxx 2008-12-29 22:25:55 UTC (rev 11015) +++ trunk/Source/Modules/cffi.cxx 2008-12-29 22:56:25 UTC (rev 11016) @@ -22,7 +22,7 @@ String *f_clhead; String *f_clwrap; bool CWrap; // generate wrapper file for C code? - File *f_cxx; + File *f_runtime; File *f_cxx_header; File *f_cxx_wrapper; File *f_clos; @@ -126,8 +126,8 @@ } if (CPlusPlus || CWrap) { - f_cxx = NewFile(cxx_filename, "w", SWIG_output_files()); - if (!f_cxx) { + f_runtime = NewFile(cxx_filename, "w", SWIG_output_files()); + if (!f_runtime) { Close(f_lisp); Delete(f_lisp); Printf(stderr, "Unable to open %s for writing\n", cxx_filename); @@ -144,22 +144,25 @@ SWIG_exit(EXIT_FAILURE); } } else { - f_cxx = NewString(""); + f_runtime = NewString(""); f_clos = NewString(""); } - f_cxx_header = f_cxx; + f_cxx_header = f_runtime; f_cxx_wrapper = NewString(""); Swig_register_filebyname("header", f_cxx_header); Swig_register_filebyname("wrapper", f_cxx_wrapper); - Swig_register_filebyname("runtime", f_cxx); + Swig_register_filebyname("runtime", f_runtime); Swig_register_filebyname("lisphead", f_clhead); if (!no_swig_lisp) Swig_register_filebyname("swiglisp", f_cl); else Swig_register_filebyname("swiglisp", f_null); + Swig_banner(f_runtime); + Swig_banner_target_lang(f_lisp, ";;;"); + Language::top(n); Printf(f_lisp, "%s\n", f_clhead); Printf(f_lisp, "%s\n", f_cl); @@ -170,8 +173,8 @@ Delete(f_cl); Delete(f_clhead); Delete(f_clwrap); - Close(f_cxx); - Delete(f_cxx); + Close(f_runtime); + Delete(f_runtime); Delete(f_cxx_wrapper); Delete(f_null); @@ -454,7 +457,7 @@ Printf(f->code, "}\n"); if (CPlusPlus) - Wrapper_print(f, f_cxx); + Wrapper_print(f, f_runtime); if (CPlusPlus) { emit_defun(n, wname); Modified: trunk/Source/Modules/chicken.cxx =================================================================== --- trunk/Source/Modules/chicken.cxx 2008-12-29 22:25:55 UTC (rev 11015) +++ trunk/Source/Modules/chicken.cxx 2008-12-29 22:56:25 UTC (rev 11016) @@ -215,7 +215,6 @@ clos_methods = NewString(""); scm_const_defs = NewString(""); - Printf(f_runtime, "/* -*- buffer-read-only: t -*- vi: set ro: */\n"); Swig_banner(f_runtime); Printf(f_runtime, "/* Implementation : CHICKEN */\n\n"); @@ -256,9 +255,9 @@ SWIG_exit(EXIT_FAILURE); } - Printv(f_scm, - ";; -*- buffer-read-only: t -*- vi: set ro:\n", - ";; This file was created automatically by SWIG.\n", ";; Don't modify this file, modify the SWIG interface instead.\n", NIL); + Swig_banner_target_lang(f_scm, ";;"); + Printf(f_scm, "\n"); + if (declare_unit) Printv(f_scm, "(declare (unit ", scmmodule, "))\n\n", NIL); Printv(f_scm, "(declare \n", Modified: trunk/Source/Modules/clisp.cxx =================================================================== --- trunk/Source/Modules/clisp.cxx 2008-12-29 22:25:55 UTC (rev 11015) +++ trunk/Source/Modules/clisp.cxx 2008-12-29 22:56:25 UTC (rev 11016) @@ -89,11 +89,12 @@ Swig_register_filebyname("runtime", f_null); Swig_register_filebyname("wrapper", f_null); - String *header = - NewStringf - (";; This is an automatically generated file. \n;;Make changes as you feel are necessary (but remember if you try to regenerate this file, your changes will be lost). \n\n(defpackage :%s\n (:use :common-lisp :ffi)", - module); + String *header = NewString(""); + Swig_banner_target_lang(header, ";;"); + + Printf(header, "\n(defpackage :%s\n (:use :common-lisp :ffi)", module); + Language::top(n); Iterator i; Modified: trunk/Source/Modules/csharp.cxx =================================================================== --- trunk/Source/Modules/csharp.cxx 2008-12-29 22:25:55 UTC (rev 11015) +++ trunk/Source/Modules/csharp.cxx 2008-12-29 22:56:25 UTC (rev 11016) @@ -601,11 +601,7 @@ 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", 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"); + Swig_banner_target_lang(f, " *"); Printf(f, " * ----------------------------------------------------------------------------- */\n\n"); } Modified: trunk/Source/Modules/guile.cxx =================================================================== --- trunk/Source/Modules/guile.cxx 2008-12-29 22:25:55 UTC (rev 11015) +++ trunk/Source/Modules/guile.cxx 2008-12-29 22:56:25 UTC (rev 11016) @@ -322,7 +322,6 @@ goopscode = NewString(""); goopsexport = NewString(""); - Printf(f_runtime, "/* -*- buffer-read-only: t -*- vi: set ro: */\n"); Swig_banner(f_runtime); Printf(f_runtime, "/* Implementation : GUILE */\n\n"); @@ -506,8 +505,8 @@ } Delete(fname); - Printf(scmstubfile, ";;; -*- buffer-read-only: t -*- vi: set ro: */\n"); - Printf(scmstubfile, ";;; Automatically generated by SWIG; do not edit.\n\n"); + Swig_banner_target_lang(scmstubfile, ";;;"); + Printf(scmstubfile, "\n"); if (linkage == GUILE_LSTYLE_SIMPLE || linkage == GUILE_LSTYLE_PASSIVE) Printf(scmstubfile, "(define-module (%s))\n\n", mod); Delete(mod); @@ -536,8 +535,8 @@ SWIG_exit(EXIT_FAILURE); } Delete(fname); - Printf(goopsfile, ";;; -*- buffer-read-only: t -*- vi: set ro: */\n"); - Printf(goopsfile, ";;; Automatically generated by SWIG; do not edit.\n\n"); + Swig_banner_target_lang(goopsfile, ";;;"); + Printf(goopsfile, "\n"); Printf(goopsfile, "(define-module (%s))\n", mod); Printf(goopsfile, "%s\n", goopstext); Printf(goopsfile, "(use-modules (oop goops) (Swig common))\n"); Modified: trunk/Source/Modules/java.cxx =================================================================== --- trunk/Source/Modules/java.cxx 2008-12-29 22:25:55 UTC (rev 11015) +++ trunk/Source/Modules/java.cxx 2008-12-29 22:56:25 UTC (rev 11016) @@ -673,11 +673,7 @@ 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", 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"); + Swig_banner_target_lang(f, " *"); Printf(f, " * ----------------------------------------------------------------------------- */\n\n"); } Modified: trunk/Source/Modules/modula3.cxx =================================================================== --- trunk/Source/Modules/modula3.cxx 2008-12-29 22:25:55 UTC (rev 11015) +++ trunk/Source/Modules/modula3.cxx 2008-12-29 22:56:25 UTC (rev 11016) @@ -1159,14 +1159,9 @@ * ----------------------------------------------------------------------------- */ void emitBanner(File *f) { - Printf(f, "\ -(*******************************************************************************\n\ - * This file was automatically generated by SWIG (http://www.swig.org/).\n\ - * Version %s\n\ - *\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", Swig_package_version()); + Printf(f, "(*******************************************************************************\n"); + Swig_banner_target_lang(f, " *"); + Printf(f, "*******************************************************************************)\n\n"); } /* ---------------------------------------------------------------------- Modified: trunk/Source/Modules/mzscheme.cxx =================================================================== --- trunk/Source/Modules/mzscheme.cxx 2008-12-29 22:25:55 UTC (rev 11015) +++ trunk/Source/Modules/mzscheme.cxx 2008-12-29 22:56:25 UTC (rev 11016) @@ -146,7 +146,6 @@ init_func_def = NewString(""); Swig_register_filebyname("init", init_func_def); - Printf(f_runtime, "/* -*- buffer-read-only: t -*- vi: set ro: */\n"); Swig_banner(f_runtime); module = Getattr(n, "name"); Modified: trunk/Source/Modules/ocaml.cxx =================================================================== --- trunk/Source/Modules/ocaml.cxx 2008-12-29 22:25:55 UTC (rev 11015) +++ trunk/Source/Modules/ocaml.cxx 2008-12-29 22:56:25 UTC (rev 11016) @@ -262,7 +262,8 @@ Swig_name_register("get", "%v__get__"); } - Printf(f_runtime, "/* -*- buffer-read-only: t -*- vi: set ro: */\n"); + Swig_banner(f_runtime); + Printf(f_runtime, "#define SWIG_MODULE \"%s\"\n", module); /* Module name */ Printf(f_mlbody, "let module_name = \"%s\"\n", module); @@ -276,8 +277,6 @@ Printf(f_int_to_enum, "let int_to_enum x y =\n" " match (x : c_enum_type) with\n" " `unknown -> C_enum (`Int y)\n"); - Swig_banner(f_runtime); - if (directorsEnabled()) { Printf(f_runtime, "#define SWIG_DIRECTORS\n"); } Modified: trunk/Source/Modules/octave.cxx =================================================================== --- trunk/Source/Modules/octave.cxx 2008-12-29 22:25:55 UTC (rev 11015) +++ trunk/Source/Modules/octave.cxx 2008-12-29 22:56:25 UTC (rev 11016) @@ -108,7 +108,9 @@ Swig_register_filebyname("initbeforefunc", f_initbeforefunc); Swig_register_filebyname("director", f_directors); Swig_register_filebyname("director_h", f_directors_h); + Swig_banner(f_runtime); + Printf(f_runtime, "#define SWIG_name_d \"%s\"\n", module); Printf(f_runtime, "#define SWIG_name %s\n", module); Modified: trunk/Source/Modules/perl5.cxx =================================================================== --- trunk/Source/Modules/perl5.cxx 2008-12-29 22:25:55 UTC (rev 11015) +++ trunk/Source/Modules/perl5.cxx 2008-12-29 22:56:25 UTC (rev 11016) @@ -332,10 +332,7 @@ Delete(boot_name); } - 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"); + Swig_banner_target_lang(f_pm, "#"); Printf(f_pm, "\n"); Printf(f_pm, "package %s;\n", module); Modified: trunk/Source/Modules/python.cxx =================================================================== --- trunk/Source/Modules/python.cxx 2008-12-29 22:25:55 UTC (rev 11015) +++ trunk/Source/Modules/python.cxx 2008-12-29 22:56:25 UTC (rev 11016) @@ -676,10 +676,7 @@ Swig_register_filebyname("shadow", f_shadow); Swig_register_filebyname("python", f_shadow); - 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"); + Swig_banner_target_lang(f_shadow, "#"); if (!modern) { Printv(f_shadow, "# This file is compatible with both classic and new-style classes.\n", NIL); Modified: trunk/Source/Modules/r.cxx =================================================================== --- trunk/Source/Modules/r.cxx 2008-12-29 22:25:55 UTC (rev 11015) +++ trunk/Source/Modules/r.cxx 2008-12-29 22:56:25 UTC (rev 11016) @@ -819,8 +819,7 @@ Swig_register_filebyname("sclasses", s_classes); - - Printf(s_init, "# This is an automatically generated file by the R module for SWIG.\n\n"); + Swig_banner_target_lang(s_init, "#"); outputCommandLineArguments(s_init); Printf(f_wrapper, "#ifdef __cplusplus\n"); @@ -2659,7 +2658,7 @@ if(Argc < 1 || !Argv || !Argv[0]) return(-1); - Printf(out, "## Generated via the command line invocation:\n##\t"); + Printf(out, "\n## Generated via the command line invocation:\n##\t"); for(int i = 0; i < Argc ; i++) { Printf(out, " %s", Argv[i]); } Modified: trunk/Source/Modules/s-exp.cxx =================================================================== --- trunk/Source/Modules/s-exp.cxx 2008-12-29 22:25:55 UTC (rev 11015) +++ trunk/Source/Modules/s-exp.cxx 2008-12-29 22:56:25 UTC (rev 11016) @@ -71,7 +71,10 @@ Swig_register_filebyname("runtime", f_sink); Swig_register_filebyname("init", f_sink); + Swig_banner_target_lang(out, ";;;"); + Language::top(n); + Printf(out, "\n"); Printf(out, ";;; Lisp parse tree produced by SWIG\n"); print_circle_hash = DohNewHash(); print_circle_count = 0; Modified: trunk/Source/Modules/tcl8.cxx =================================================================== --- trunk/Source/Modules/tcl8.cxx 2008-12-29 22:25:55 UTC (rev 11015) +++ trunk/Source/Modules/tcl8.cxx 2008-12-29 22:56:25 UTC (rev 11016) @@ -186,10 +186,7 @@ Swig_register_filebyname("shadow", f_shadow); Swig_register_filebyname("itcl", f_shadow); - 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"); + Swig_banner_target_lang(f_shadow, "#"); Printv(f_shadow, "\npackage require Itcl\n\n", NIL); Delete(filen); Modified: trunk/Source/Modules/uffi.cxx =================================================================== --- trunk/Source/Modules/uffi.cxx 2008-12-29 22:25:55 UTC (rev 11015) +++ trunk/Source/Modules/uffi.cxx 2008-12-29 22:56:25 UTC (rev 11016) @@ -239,8 +239,10 @@ Swig_register_filebyname("runtime", f_null); Swig_register_filebyname("wrapper", f_cl); - Printf(f_cl, - ";; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10; package: %s -*-\n;; This is an automatically generated file. Make changes in\n;; the definition file, not here.\n\n(defpackage :%s\n (:use :common-lisp :uffi))\n\n(in-package :%s)\n", + Swig_banner_target_lang(f_cl, ";;"); + + Printf(f_cl, "\n" + ";; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10; package: %s -*-\n\n(defpackage :%s\n (:use :common-lisp :uffi))\n\n(in-package :%s)\n", module, module, module); Printf(f_cl, "(eval-when (compile load eval)\n (defparameter *swig-identifier-converter* '%s))\n", identifier_converter); Modified: trunk/Source/Swig/misc.c =================================================================== --- trunk/Source/Swig/misc.c 2008-12-29 22:25:55 UTC (rev 11015) +++ trunk/Source/Swig/misc.c 2008-12-29 22:56:25 UTC (rev 11016) @@ -54,7 +54,7 @@ /* ----------------------------------------------------------------------------- * Swig_banner() * - * Emits the SWIG identifying banner. + * Emits the SWIG identifying banner for the C/C++ wrapper file. * ----------------------------------------------------------------------------- */ void Swig_banner(File *f) { @@ -72,6 +72,20 @@ } /* ----------------------------------------------------------------------------- + * Swig_banner_target_lang() + * + * Emits a SWIG identifying banner in the target language + * ----------------------------------------------------------------------------- */ + +void Swig_banner_target_lang(File *f, const String_or_char *commentchar) { + Printf(f, "%s This file was automatically generated by SWIG (http://www.swig.org).\n", commentchar); + Printf(f, "%s Version %s\n", commentchar, Swig_package_version()); + Printf(f, "%s\n", commentchar); + Printf(f, "%s Do not make changes to this file unless you know what you are doing--modify\n", commentchar); + Printf(f, "%s the SWIG interface file instead.\n", commentchar); +} + +/* ----------------------------------------------------------------------------- * Swig_strip_c_comments() * * Return a new string with C comments stripped from the input string. Null is @@ -124,6 +138,7 @@ * ----------------------------------------------------------------------------- */ void Swig_filename_correct(String *filename) { + (void)filename; #if defined(_WIN32) || defined(MACSWIG) /* accept Unix path separator on non-Unix systems */ Replaceall(filename, "/", SWIG_FILE_DELIMITER); Modified: trunk/Source/Swig/swig.h =================================================================== --- trunk/Source/Swig/swig.h 2008-12-29 22:25:55 UTC (rev 11015) +++ trunk/Source/Swig/swig.h 2008-12-29 22:56:25 UTC (rev 11016) @@ -285,6 +285,7 @@ extern void Swig_set_fakeversion(const char *version); extern const char *Swig_package_version(void); extern void Swig_banner(File *f); + extern void Swig_banner_target_lang(File *f, const String_or_char *commentchar); extern String *Swig_strip_c_comments(const String *s); extern String *Swig_filename_escape(String *filename); extern void Swig_filename_correct(String *filename); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bh...@us...> - 2009-01-24 13:15:58
|
Revision: 11080 http://swig.svn.sourceforge.net/swig/?rev=11080&view=rev Author: bhy Date: 2009-01-24 13:15:51 +0000 (Sat, 24 Jan 2009) Log Message: ----------- Replaced all [const] String_or_char * to const_String_or_char_ptr, by the following command: sed -i "s/\(const \)\?String_or_char \*/const_String_or_char_ptr /g" CParse/* Include/* Modules/* Preprocessor/* Swig/* This is a preparation for moving to new DOH, since for strong typed objects we need the const_String_or_char_ptr class to implicit convert to and from String * or const char *. Modified Paths: -------------- trunk/Source/CParse/cparse.h trunk/Source/CParse/cscanner.c trunk/Source/CParse/parser.y trunk/Source/DOH/doh.h trunk/Source/Modules/allegrocl.cxx trunk/Source/Modules/chicken.cxx trunk/Source/Modules/csharp.cxx trunk/Source/Modules/directors.cxx trunk/Source/Modules/guile.cxx trunk/Source/Modules/java.cxx trunk/Source/Modules/main.cxx trunk/Source/Modules/overload.cxx trunk/Source/Modules/php.cxx trunk/Source/Modules/pike.cxx trunk/Source/Modules/ruby.cxx trunk/Source/Modules/swigmod.h trunk/Source/Modules/uffi.cxx trunk/Source/Preprocessor/cpp.c trunk/Source/Preprocessor/preprocessor.h trunk/Source/Swig/cwrap.c trunk/Source/Swig/error.c trunk/Source/Swig/include.c trunk/Source/Swig/misc.c trunk/Source/Swig/naming.c trunk/Source/Swig/parms.c trunk/Source/Swig/scanner.c trunk/Source/Swig/stype.c trunk/Source/Swig/swig.h trunk/Source/Swig/swigfile.h trunk/Source/Swig/swigparm.h trunk/Source/Swig/swigscan.h trunk/Source/Swig/swigtree.h trunk/Source/Swig/swigwrap.h trunk/Source/Swig/symbol.c trunk/Source/Swig/tree.c trunk/Source/Swig/typemap.c trunk/Source/Swig/typeobj.c trunk/Source/Swig/typesys.c trunk/Source/Swig/wrapfunc.c Modified: trunk/Source/CParse/cparse.h =================================================================== --- trunk/Source/CParse/cparse.h 2009-01-24 07:59:46 UTC (rev 11079) +++ trunk/Source/CParse/cparse.h 2009-01-24 13:15:51 UTC (rev 11080) @@ -34,7 +34,7 @@ extern void scanner_ignore_typedef(void); extern void scanner_last_id(int); extern void scanner_clear_rename(void); - extern void scanner_set_location(String_or_char *file, int line); + extern void scanner_set_location(const_String_or_char_ptr file, int line); extern void scanner_set_main_input_file(String *file); extern String *scanner_get_main_input_file(); extern void Swig_cparse_follow_locators(int); Modified: trunk/Source/CParse/cscanner.c =================================================================== --- trunk/Source/CParse/cscanner.c 2009-01-24 07:59:46 UTC (rev 11079) +++ trunk/Source/CParse/cscanner.c 2009-01-24 13:15:51 UTC (rev 11080) @@ -442,7 +442,7 @@ static int check_typedef = 0; -void scanner_set_location(String_or_char *file, int line) { +void scanner_set_location(const_String_or_char_ptr file, int line) { Scanner_set_location(scan,file,line-1); } Modified: trunk/Source/CParse/parser.y =================================================================== --- trunk/Source/CParse/parser.y 2009-01-24 07:59:46 UTC (rev 11079) +++ trunk/Source/CParse/parser.y 2009-01-24 13:15:51 UTC (rev 11080) @@ -66,7 +66,7 @@ (void)e; } -static Node *new_node(const String_or_char *tag) { +static Node *new_node(const_String_or_char_ptr tag) { Node *n = NewHash(); set_nodeType(n,tag); Setfile(n,cparse_file); @@ -1425,7 +1425,7 @@ * Used by the parser to mark subtypes with extra information. * ----------------------------------------------------------------------------- */ -static void tag_nodes(Node *n, const String_or_char *attrname, DOH *value) { +static void tag_nodes(Node *n, const_String_or_char_ptr attrname, DOH *value) { while (n) { Setattr(n, attrname, value); tag_nodes(firstChild(n), attrname, value); Modified: trunk/Source/DOH/doh.h =================================================================== --- trunk/Source/DOH/doh.h 2009-01-24 07:59:46 UTC (rev 11079) +++ trunk/Source/DOH/doh.h 2009-01-24 13:15:51 UTC (rev 11080) @@ -144,6 +144,9 @@ #define DOHString_or_char DOH #define DOHObj_or_char DOH +typedef const DOHString_or_char * const_String_or_char_ptr; +typedef const DOHString_or_char * DOHconst_String_or_char_ptr; + #define DOH_BEGIN -1 #define DOH_END -2 #define DOH_CUR -3 Modified: trunk/Source/Modules/allegrocl.cxx =================================================================== --- trunk/Source/Modules/allegrocl.cxx 2009-01-24 07:59:46 UTC (rev 11079) +++ trunk/Source/Modules/allegrocl.cxx 2009-01-24 13:15:51 UTC (rev 11080) @@ -625,7 +625,7 @@ add_defined_foreign_type(0, 0, t, t, implicit_ns ? implicit_ns : current_namespace); } -String *get_ffi_type(SwigType *ty, const String_or_char *name) { +String *get_ffi_type(SwigType *ty, const_String_or_char_ptr name) { /* lookup defined foreign type. if it exists, it will return a form suitable for placing into lisp code to generate the def-foreign-type name */ @@ -1962,7 +1962,7 @@ return 0; } -String *get_lisp_type(SwigType *ty, const String_or_char *name) { +String *get_lisp_type(SwigType *ty, const_String_or_char_ptr name) { Hash *typemap = Swig_typemap_search("lisptype", ty, name, 0); if (typemap) { String *typespec = Getattr(typemap, "code"); Modified: trunk/Source/Modules/chicken.cxx =================================================================== --- trunk/Source/Modules/chicken.cxx 2009-01-24 07:59:46 UTC (rev 11079) +++ trunk/Source/Modules/chicken.cxx 2009-01-24 13:15:51 UTC (rev 11080) @@ -101,12 +101,12 @@ int isPointer(SwigType *t); void dispatchFunction(Node *n); - String *chickenNameMapping(String *, String_or_char *); + String *chickenNameMapping(String *, const_String_or_char_ptr ); String *chickenPrimitiveName(String *); String *runtimeCode(); String *defaultExternalRuntimeFilename(); - String *buildClosFunctionCall(List *types, String_or_char *closname, String_or_char *funcname); + String *buildClosFunctionCall(List *types, const_String_or_char_ptr closname, const_String_or_char_ptr funcname); }; /* ----------------------------------------------------------------------- @@ -1234,7 +1234,7 @@ return Language::importDirective(n); } -String *CHICKEN::buildClosFunctionCall(List *types, String_or_char *closname, String_or_char *funcname) { +String *CHICKEN::buildClosFunctionCall(List *types, const_String_or_char_ptr closname, const_String_or_char_ptr funcname) { String *method_signature = NewString(""); String *func_args = NewString(""); String *func_call = NewString(""); @@ -1508,7 +1508,7 @@ * If class_name = "" that means the mapping is for a function or * variable not attached to any class. * ------------------------------------------------------------ */ -String *CHICKEN::chickenNameMapping(String *name, String_or_char *class_name) { +String *CHICKEN::chickenNameMapping(String *name, const_String_or_char_ptr class_name) { String *n = NewString(""); if (Strcmp(class_name, "") == 0) { Modified: trunk/Source/Modules/csharp.cxx =================================================================== --- trunk/Source/Modules/csharp.cxx 2009-01-24 07:59:46 UTC (rev 11079) +++ trunk/Source/Modules/csharp.cxx 2009-01-24 13:15:51 UTC (rev 11080) @@ -85,7 +85,7 @@ enum EnumFeature { SimpleEnum, TypeunsafeEnum, TypesafeEnum, ProperEnum }; - static Parm *NewParmFromNode(SwigType *type, const String_or_char *name, Node *n) { + static Parm *NewParmFromNode(SwigType *type, const_String_or_char_ptr name, Node *n) { Parm *p = NewParm(type, name); Setfile(p, Getfile(n)); Setline(p, Getline(n)); Modified: trunk/Source/Modules/directors.cxx =================================================================== --- trunk/Source/Modules/directors.cxx 2009-01-24 07:59:46 UTC (rev 11079) +++ trunk/Source/Modules/directors.cxx 2009-01-24 13:15:51 UTC (rev 11080) @@ -84,7 +84,7 @@ } -String *Swig_method_call(String_or_char *name, ParmList *parms) { +String *Swig_method_call(const_String_or_char_ptr name, ParmList *parms) { String *func; int i = 0; int comma = 0; @@ -128,7 +128,7 @@ * */ -String *Swig_method_decl(SwigType *returntype, SwigType *decl, const String_or_char *id, List *args, int strip, int values) { +String *Swig_method_decl(SwigType *returntype, SwigType *decl, const_String_or_char_ptr id, List *args, int strip, int values) { String *result; List *elements; String *element = 0, *nextelement; Modified: trunk/Source/Modules/guile.cxx =================================================================== --- trunk/Source/Modules/guile.cxx 2009-01-24 07:59:46 UTC (rev 11079) +++ trunk/Source/Modules/guile.cxx 2009-01-24 13:15:51 UTC (rev 11080) @@ -1654,7 +1654,7 @@ * If class_name = "" that means the mapping is for a function or * variable not attached to any class. * ------------------------------------------------------------ */ - String *goopsNameMapping(String *name, String_or_char *class_name) { + String *goopsNameMapping(String *name, const_String_or_char_ptr class_name) { String *n = NewString(""); if (Strcmp(class_name, "") == 0) { Modified: trunk/Source/Modules/java.cxx =================================================================== --- trunk/Source/Modules/java.cxx 2009-01-24 07:59:46 UTC (rev 11079) +++ trunk/Source/Modules/java.cxx 2009-01-24 13:15:51 UTC (rev 11080) @@ -82,7 +82,7 @@ enum EnumFeature { SimpleEnum, TypeunsafeEnum, TypesafeEnum, ProperEnum }; - static Parm *NewParmFromNode(SwigType *type, const String_or_char *name, Node *n) { + static Parm *NewParmFromNode(SwigType *type, const_String_or_char_ptr name, Node *n) { Parm *p = NewParm(type, name); Setfile(p, Getfile(n)); Setline(p, Getline(n)); Modified: trunk/Source/Modules/main.cxx =================================================================== --- trunk/Source/Modules/main.cxx 2009-01-24 07:59:46 UTC (rev 11079) +++ trunk/Source/Modules/main.cxx 2009-01-24 13:15:51 UTC (rev 11080) @@ -285,7 +285,7 @@ } /* This function sets the name of the configuration file */ -void SWIG_config_file(const String_or_char *filename) { +void SWIG_config_file(const_String_or_char_ptr filename) { lang_config = NewString(filename); } Modified: trunk/Source/Modules/overload.cxx =================================================================== --- trunk/Source/Modules/overload.cxx 2009-01-24 07:59:46 UTC (rev 11079) +++ trunk/Source/Modules/overload.cxx 2009-01-24 13:15:51 UTC (rev 11080) @@ -316,7 +316,7 @@ * ReplaceFormat() * ----------------------------------------------------------------------------- */ -static String *ReplaceFormat(const String_or_char *fmt, int j) { +static String *ReplaceFormat(const_String_or_char_ptr fmt, int j) { String *lfmt = NewString(fmt); char buf[50]; sprintf(buf, "%d", j); @@ -352,7 +352,7 @@ /* Cast dispatch mechanism. */ -String *Swig_overload_dispatch_cast(Node *n, const String_or_char *fmt, int *maxargs) { +String *Swig_overload_dispatch_cast(Node *n, const_String_or_char_ptr fmt, int *maxargs) { int i, j; *maxargs = 1; @@ -536,7 +536,7 @@ /* Fast dispatch mechanism, provided by Salvador Fandi~no Garc'ia (#930586). */ -String *Swig_overload_dispatch_fast(Node *n, const String_or_char *fmt, int *maxargs) { +String *Swig_overload_dispatch_fast(Node *n, const_String_or_char_ptr fmt, int *maxargs) { int i, j; *maxargs = 1; @@ -695,7 +695,7 @@ return f; } -String *Swig_overload_dispatch(Node *n, const String_or_char *fmt, int *maxargs) { +String *Swig_overload_dispatch(Node *n, const_String_or_char_ptr fmt, int *maxargs) { if (fast_dispatch_mode || GetFlag(n, "feature:fastdispatch")) { return Swig_overload_dispatch_fast(n, fmt, maxargs); Modified: trunk/Source/Modules/php.cxx =================================================================== --- trunk/Source/Modules/php.cxx 2009-01-24 07:59:46 UTC (rev 11079) +++ trunk/Source/Modules/php.cxx 2009-01-24 13:15:51 UTC (rev 11080) @@ -1934,7 +1934,7 @@ return NewStringEmpty(); } - String *PhpTypeFromTypemap(char *op, Node *n, String_or_char *lname) { + String *PhpTypeFromTypemap(char *op, Node *n, const_String_or_char_ptr lname) { String *tms = Swig_typemap_lookup(op, n, lname, 0); if (!tms) return 0; Modified: trunk/Source/Modules/pike.cxx =================================================================== --- trunk/Source/Modules/pike.cxx 2009-01-24 07:59:46 UTC (rev 11079) +++ trunk/Source/Modules/pike.cxx 2009-01-24 13:15:51 UTC (rev 11080) @@ -224,7 +224,7 @@ * name (i.e. "enum_test"). * ------------------------------------------------------------ */ - String *strip(const DOHString_or_char *name) { + String *strip(const DOHconst_String_or_char_ptr name) { String *s = Copy(name); if (Strncmp(name, PrefixPlusUnderscore, Len(PrefixPlusUnderscore)) != 0) { return s; @@ -237,7 +237,7 @@ * add_method() * ------------------------------------------------------------ */ - void add_method(const DOHString_or_char *name, const DOHString_or_char *function, const DOHString_or_char *description) { + void add_method(const DOHconst_String_or_char_ptr name, const DOHconst_String_or_char_ptr function, const DOHconst_String_or_char_ptr description) { String *rename = NULL; switch (current) { case NO_CPP: Modified: trunk/Source/Modules/ruby.cxx =================================================================== --- trunk/Source/Modules/ruby.cxx 2009-01-24 07:59:46 UTC (rev 11079) +++ trunk/Source/Modules/ruby.cxx 2009-01-24 13:15:51 UTC (rev 11080) @@ -78,7 +78,7 @@ Delete(temp); } - void set_name(const String_or_char *cn, const String_or_char *rn, const String_or_char *valn) { + void set_name(const_String_or_char_ptr cn, const_String_or_char_ptr rn, const_String_or_char_ptr valn) { /* Original C/C++ class (or struct) name */ Clear(cname); Append(cname, cn); @@ -104,7 +104,7 @@ Printv(prefix, (rn ? rn : cn), "_", NIL); } - char *strip(const String_or_char *s) { + char *strip(const_String_or_char_ptr s) { Clear(temp); Append(temp, s); if (Strncmp(s, prefix, Len(prefix)) == 0) { @@ -1228,7 +1228,7 @@ /** * Process the comma-separated list of aliases (if any). */ - void defineAliases(Node *n, const String_or_char *iname) { + void defineAliases(Node *n, const_String_or_char_ptr iname) { String *aliasv = Getattr(n, "feature:alias"); if (aliasv) { List *aliases = Split(aliasv, ',', INT_MAX); @@ -1262,7 +1262,7 @@ * as another instance of the same class. * --------------------------------------------------------------------- */ - void create_command(Node *n, const String_or_char *iname) { + void create_command(Node *n, const_String_or_char_ptr iname) { String *alloc_func = Swig_name_wrapper(iname); String *wname = Swig_name_wrapper(iname); @@ -2566,7 +2566,7 @@ /* First wrap the allocate method */ current = CONSTRUCTOR_ALLOCATE; - Swig_name_register((String_or_char *) "construct", (String_or_char *) "%c_allocate"); + Swig_name_register((const_String_or_char_ptr ) "construct", (const_String_or_char_ptr ) "%c_allocate"); Language::constructorHandler(n); @@ -2601,7 +2601,7 @@ Delete(docs); current = CONSTRUCTOR_INITIALIZE; - Swig_name_register((String_or_char *) "construct", (String_or_char *) "new_%c"); + Swig_name_register((const_String_or_char_ptr ) "construct", (const_String_or_char_ptr ) "new_%c"); Language::constructorHandler(n); /* Restore original parameter list */ @@ -2609,7 +2609,7 @@ Swig_restore(n); /* Done */ - Swig_name_unregister((String_or_char *) "construct"); + Swig_name_unregister((const_String_or_char_ptr ) "construct"); current = NO_CPP; klass->constructor_defined = 1; return SWIG_OK; @@ -2623,7 +2623,7 @@ /* First wrap the allocate method */ current = CONSTRUCTOR_ALLOCATE; - Swig_name_register((String_or_char *) "construct", (String_or_char *) "%c_allocate"); + Swig_name_register((const_String_or_char_ptr ) "construct", (const_String_or_char_ptr ) "%c_allocate"); return Language::copyconstructorHandler(n); } Modified: trunk/Source/Modules/swigmod.h =================================================================== --- trunk/Source/Modules/swigmod.h 2009-01-24 07:59:46 UTC (rev 11079) +++ trunk/Source/Modules/swigmod.h 2009-01-24 13:15:51 UTC (rev 11080) @@ -313,7 +313,7 @@ void emit_parameter_variables(ParmList *l, Wrapper *f); void emit_return_variable(Node *n, SwigType *rt, Wrapper *f); void SWIG_exit(int); /* use EXIT_{SUCCESS,FAILURE} */ -void SWIG_config_file(const String_or_char *); +void SWIG_config_file(const_String_or_char_ptr ); const String *SWIG_output_directory(); void SWIG_config_cppext(const char *ext); @@ -329,17 +329,17 @@ String *emit_action(Node *n); int emit_action_code(Node *n, String *wrappercode, String *action); void Swig_overload_check(Node *n); -String *Swig_overload_dispatch(Node *n, const String_or_char *fmt, int *); -String *Swig_overload_dispatch_cast(Node *n, const String_or_char *fmt, int *); -String *Swig_overload_dispatch_fast(Node *n, const String_or_char *fmt, int *); +String *Swig_overload_dispatch(Node *n, const_String_or_char_ptr fmt, int *); +String *Swig_overload_dispatch_cast(Node *n, const_String_or_char_ptr fmt, int *); +String *Swig_overload_dispatch_fast(Node *n, const_String_or_char_ptr fmt, int *); SwigType *cplus_value_type(SwigType *t); /* directors.cxx start */ String *Swig_csuperclass_call(String *base, String *method, ParmList *l); String *Swig_class_declaration(Node *n, String *name); String *Swig_class_name(Node *n); -String *Swig_method_call(String_or_char *name, ParmList *parms); -String *Swig_method_decl(SwigType *rtype, SwigType *decl, const String_or_char *id, List *args, int strip, int values); +String *Swig_method_call(const_String_or_char_ptr name, ParmList *parms); +String *Swig_method_decl(SwigType *rtype, SwigType *decl, const_String_or_char_ptr id, List *args, int strip, int values); String *Swig_director_declaration(Node *n); void Swig_director_emit_dynamic_cast(Node *n, Wrapper *f); /* directors.cxx end */ Modified: trunk/Source/Modules/uffi.cxx =================================================================== --- trunk/Source/Modules/uffi.cxx 2009-01-24 07:59:46 UTC (rev 11079) +++ trunk/Source/Modules/uffi.cxx 2009-01-24 13:15:51 UTC (rev 11080) @@ -131,7 +131,7 @@ } -static String *get_ffi_type(SwigType *ty, const String_or_char *name) { +static String *get_ffi_type(SwigType *ty, const_String_or_char_ptr name) { Hash *typemap = Swig_typemap_search("ffitype", ty, name, 0); if (typemap) { String *typespec = Getattr(typemap, "code"); @@ -167,7 +167,7 @@ return 0; } -static String *get_lisp_type(SwigType *ty, const String_or_char *name) { +static String *get_lisp_type(SwigType *ty, const_String_or_char_ptr name) { Hash *typemap = Swig_typemap_search("lisptype", ty, name, 0); if (typemap) { String *typespec = Getattr(typemap, "code"); Modified: trunk/Source/Preprocessor/cpp.c =================================================================== --- trunk/Source/Preprocessor/cpp.c 2009-01-24 07:59:46 UTC (rev 11079) +++ trunk/Source/Preprocessor/cpp.c 2009-01-24 13:15:51 UTC (rev 11080) @@ -74,7 +74,7 @@ Setline(s2, Getline((DOH *) s1)); } -static String *cpp_include(String_or_char *fn, int sysfile) { +static String *cpp_include(const_String_or_char_ptr fn, int sysfile) { String *s = sysfile ? Swig_include_sys(fn) : Swig_include(fn); if (s && single_include) { String *file = Getfile(s); @@ -261,8 +261,9 @@ * ----------------------------------------------------------------------------- */ -String_or_char *Macro_vararg_name(String_or_char *str, String_or_char *line) { - String_or_char *argname, *varargname; +const_String_or_char_ptr Macro_vararg_name(const_String_or_char_ptr str, const_String_or_char_ptr line) { + String *argname; + String *varargname; char *s, *dots; argname = Copy(str); @@ -288,13 +289,13 @@ return varargname; } -Hash *Preprocessor_define(const String_or_char *_str, int swigmacro) { +Hash *Preprocessor_define(const_String_or_char_ptr _str, int swigmacro) { String *macroname = 0, *argstr = 0, *macrovalue = 0, *file = 0, *s = 0; Hash *macro = 0, *symbols = 0, *m1; List *arglist = 0; int c, line; int varargs = 0; - String_or_char *str = (String_or_char *) _str; + const_String_or_char_ptr str = (const_String_or_char_ptr ) _str; assert(cpp); assert(str); @@ -532,7 +533,7 @@ * * Undefines a macro. * ----------------------------------------------------------------------------- */ -void Preprocessor_undef(const String_or_char *str) { +void Preprocessor_undef(const_String_or_char_ptr str) { Hash *symbols; assert(cpp); symbols = Getattr(cpp, kpp_symbols); Modified: trunk/Source/Preprocessor/preprocessor.h =================================================================== --- trunk/Source/Preprocessor/preprocessor.h 2009-01-24 07:59:46 UTC (rev 11079) +++ trunk/Source/Preprocessor/preprocessor.h 2009-01-24 13:15:51 UTC (rev 11080) @@ -19,8 +19,8 @@ #endif extern int Preprocessor_expr(String *s, int *error); extern char *Preprocessor_expr_error(void); - extern Hash *Preprocessor_define(const String_or_char *str, int swigmacro); - extern void Preprocessor_undef(const String_or_char *name); + extern Hash *Preprocessor_define(const_String_or_char_ptr str, int swigmacro); + extern void Preprocessor_undef(const_String_or_char_ptr name); extern void Preprocessor_init(void); extern void Preprocessor_delete(void); extern String *Preprocessor_parse(String *s); Modified: trunk/Source/Swig/cwrap.c =================================================================== --- trunk/Source/Swig/cwrap.c 2009-01-24 07:59:46 UTC (rev 11079) +++ trunk/Source/Swig/cwrap.c 2009-01-24 13:15:51 UTC (rev 11080) @@ -45,7 +45,7 @@ * and user defined types to pointers. * ----------------------------------------------------------------------------- */ -static String *Swig_clocal(SwigType *t, const String_or_char *name, const String_or_char *value) { +static String *Swig_clocal(SwigType *t, const_String_or_char_ptr name, const_String_or_char_ptr value) { String *decl; decl = NewStringEmpty(); @@ -147,7 +147,7 @@ } -static String *Swig_wrapped_var_deref(SwigType *t, String_or_char *name, int varcref) { +static String *Swig_wrapped_var_deref(SwigType *t, const_String_or_char_ptr name, int varcref) { if (SwigType_isclass(t)) { if (varcref) { if (cparse_cplusplus) { @@ -163,7 +163,7 @@ } } -static String *Swig_wrapped_var_assign(SwigType *t, const String_or_char *name, int varcref) { +static String *Swig_wrapped_var_assign(SwigType *t, const_String_or_char_ptr name, int varcref) { if (SwigType_isclass(t)) { if (varcref) { return NewStringf("%s", name); @@ -251,7 +251,7 @@ * function call. * ----------------------------------------------------------------------------- */ -String *Swig_cresult(SwigType *t, const String_or_char *name, const String_or_char *decl) { +String *Swig_cresult(SwigType *t, const_String_or_char_ptr name, const_String_or_char_ptr decl) { String *fcall; fcall = NewStringEmpty(); @@ -309,7 +309,7 @@ * * ----------------------------------------------------------------------------- */ -String *Swig_cfunction_call(String_or_char *name, ParmList *parms) { +String *Swig_cfunction_call(const_String_or_char_ptr name, ParmList *parms) { String *func; int i = 0; int comma = 0; @@ -376,7 +376,7 @@ * set to "(*this)->" or some similar sequence. * ----------------------------------------------------------------------------- */ -static String *Swig_cmethod_call(String_or_char *name, ParmList *parms, String_or_char *self, String *explicit_qualifier, SwigType *director_type) { +static String *Swig_cmethod_call(const_String_or_char_ptr name, ParmList *parms, const_String_or_char_ptr self, String *explicit_qualifier, SwigType *director_type) { String *func, *nname; int i = 0; Parm *p = parms; @@ -468,7 +468,7 @@ * calloc(1,sizeof(name)); * ----------------------------------------------------------------------------- */ -String *Swig_cconstructor_call(String_or_char *name) { +String *Swig_cconstructor_call(const_String_or_char_ptr name) { DOH *func; func = NewStringEmpty(); @@ -487,7 +487,7 @@ * * ----------------------------------------------------------------------------- */ -String *Swig_cppconstructor_base_call(String_or_char *name, ParmList *parms, int skip_self) { +String *Swig_cppconstructor_base_call(const_String_or_char_ptr name, ParmList *parms, int skip_self) { String *func; String *nname; int i = 0; @@ -532,15 +532,15 @@ return func; } -String *Swig_cppconstructor_call(String_or_char *name, ParmList *parms) { +String *Swig_cppconstructor_call(const_String_or_char_ptr name, ParmList *parms) { return Swig_cppconstructor_base_call(name, parms, 0); } -String *Swig_cppconstructor_nodirector_call(String_or_char *name, ParmList *parms) { +String *Swig_cppconstructor_nodirector_call(const_String_or_char_ptr name, ParmList *parms) { return Swig_cppconstructor_base_call(name, parms, 1); } -String *Swig_cppconstructor_director_call(String_or_char *name, ParmList *parms) { +String *Swig_cppconstructor_director_call(const_String_or_char_ptr name, ParmList *parms) { return Swig_cppconstructor_base_call(name, parms, 0); } @@ -683,7 +683,7 @@ * * ----------------------------------------------------------------------------- */ -String *Swig_cmemberset_call(String_or_char *name, SwigType *type, String_or_char *self, int varcref) { +String *Swig_cmemberset_call(const_String_or_char_ptr name, SwigType *type, const_String_or_char_ptr self, int varcref) { String *func; String *pname0 = Swig_cparm_name(0, 0); String *pname1 = Swig_cparm_name(0, 1); @@ -718,7 +718,7 @@ * * ----------------------------------------------------------------------------- */ -String *Swig_cmemberget_call(const String_or_char *name, SwigType *t, String_or_char *self, int varcref) { +String *Swig_cmemberget_call(const_String_or_char_ptr name, SwigType *t, const_String_or_char_ptr self, int varcref) { String *func; String *call; String *pname0 = Swig_cparm_name(0, 0); Modified: trunk/Source/Swig/error.c =================================================================== --- trunk/Source/Swig/error.c 2009-01-24 07:59:46 UTC (rev 11079) +++ trunk/Source/Swig/error.c 2009-01-24 13:15:51 UTC (rev 11080) @@ -50,7 +50,7 @@ static char err_line_fmt[64]; static char err_eof_fmt[64]; -static String *format_filename(const String_or_char *filename); +static String *format_filename(const_String_or_char_ptr filename); /* ----------------------------------------------------------------------------- * Swig_warning() @@ -58,7 +58,7 @@ * Issue a warning message * ----------------------------------------------------------------------------- */ -void Swig_warning(int wnum, const String_or_char *filename, int line, const char *fmt, ...) { +void Swig_warning(int wnum, const_String_or_char_ptr filename, int line, const char *fmt, ...) { String *out; char *msg; int wrn = 1; @@ -121,7 +121,7 @@ * Issue an error message * ----------------------------------------------------------------------------- */ -void Swig_error(const String_or_char *filename, int line, const char *fmt, ...) { +void Swig_error(const_String_or_char_ptr filename, int line, const char *fmt, ...) { va_list ap; String *formatted_filename = NULL; @@ -170,7 +170,7 @@ * Takes a comma separate list of warning numbers and puts in the filter. * ----------------------------------------------------------------------------- */ -void Swig_warnfilter(const String_or_char *wlist, int add) { +void Swig_warnfilter(const_String_or_char_ptr wlist, int add) { char *c; char *cw; String *s; @@ -268,7 +268,7 @@ * * Remove double backslashes in Windows filename paths for display * ----------------------------------------------------------------------------- */ -static String *format_filename(const String_or_char *filename) { +static String *format_filename(const_String_or_char_ptr filename) { String *formatted_filename = NewString(filename); #if defined(_WIN32) Replaceall(formatted_filename, "\\\\", "\\"); Modified: trunk/Source/Swig/include.c =================================================================== --- trunk/Source/Swig/include.c 2009-01-24 07:59:46 UTC (rev 11079) +++ trunk/Source/Swig/include.c 2009-01-24 13:15:51 UTC (rev 11080) @@ -33,7 +33,7 @@ * Adds a directory to the SWIG search path. * ----------------------------------------------------------------------------- */ -List *Swig_add_directory(const String_or_char *dirname) { +List *Swig_add_directory(const_String_or_char_ptr dirname) { String *adirname; if (!directories) directories = NewList(); @@ -53,7 +53,7 @@ * the preprocessor to grab files in the same directory as other included files. * ----------------------------------------------------------------------------- */ -void Swig_push_directory(const String_or_char *dirname) { +void Swig_push_directory(const_String_or_char_ptr dirname) { String *pdirname; if (!Swig_get_push_dir()) return; @@ -155,7 +155,7 @@ * FILE * on success. * ----------------------------------------------------------------------------- */ -static FILE *Swig_open_file(const String_or_char *name, int sysfile, int use_include_path) { +static FILE *Swig_open_file(const_String_or_char_ptr name, int sysfile, int use_include_path) { FILE *f; String *filename; List *spath = 0; @@ -191,12 +191,12 @@ } /* Open a file - searching the include paths to find it */ -FILE *Swig_include_open(const String_or_char *name) { +FILE *Swig_include_open(const_String_or_char_ptr name) { return Swig_open_file(name, 0, 1); } /* Open a file - does not use include paths to find it */ -FILE *Swig_open(const String_or_char *name) { +FILE *Swig_open(const_String_or_char_ptr name) { return Swig_open_file(name, 0, 0); } @@ -233,7 +233,7 @@ * Opens a file and returns it as a string. * ----------------------------------------------------------------------------- */ -static String *Swig_include_any(const String_or_char *name, int sysfile) { +static String *Swig_include_any(const_String_or_char_ptr name, int sysfile) { FILE *f; String *str; String *file; @@ -251,11 +251,11 @@ return str; } -String *Swig_include(const String_or_char *name) { +String *Swig_include(const_String_or_char_ptr name) { return Swig_include_any(name, 0); } -String *Swig_include_sys(const String_or_char *name) { +String *Swig_include_sys(const_String_or_char_ptr name) { return Swig_include_any(name, 1); } @@ -265,7 +265,7 @@ * Copies the contents of a file into another file * ----------------------------------------------------------------------------- */ -int Swig_insert_file(const String_or_char *filename, File *outfile) { +int Swig_insert_file(const_String_or_char_ptr filename, File *outfile) { char buffer[4096]; int nbytes; FILE *f = Swig_include_open(filename); @@ -289,7 +289,7 @@ static Hash *named_files = 0; -void Swig_register_filebyname(const String_or_char *filename, File *outfile) { +void Swig_register_filebyname(const_String_or_char_ptr filename, File *outfile) { if (!named_files) named_files = NewHash(); Setattr(named_files, filename, outfile); @@ -301,7 +301,7 @@ * Get a named file * ----------------------------------------------------------------------------- */ -File *Swig_filebyname(const String_or_char *filename) { +File *Swig_filebyname(const_String_or_char_ptr filename) { if (!named_files) return 0; return Getattr(named_files, filename); @@ -313,7 +313,7 @@ * Returns the suffix of a file * ----------------------------------------------------------------------------- */ -char *Swig_file_suffix(const String_or_char *filename) { +char *Swig_file_suffix(const_String_or_char_ptr filename) { char *d; char *c = Char(filename); int len = Len(filename); @@ -335,7 +335,7 @@ * Returns the filename with no suffix attached. * ----------------------------------------------------------------------------- */ -char *Swig_file_basename(const String_or_char *filename) { +char *Swig_file_basename(const_String_or_char_ptr filename) { static char tmp[1024]; char *c; strcpy(tmp, Char(filename)); @@ -349,7 +349,7 @@ * * Return the file with any leading path stripped off * ----------------------------------------------------------------------------- */ -char *Swig_file_filename(const String_or_char *filename) { +char *Swig_file_filename(const_String_or_char_ptr filename) { static char tmp[1024]; const char *delim = SWIG_FILE_DELIMITER; char *c; @@ -367,7 +367,7 @@ * * Return the name of the directory associated with a file * ----------------------------------------------------------------------------- */ -char *Swig_file_dirname(const String_or_char *filename) { +char *Swig_file_dirname(const_String_or_char_ptr filename) { static char tmp[1024]; const char *delim = SWIG_FILE_DELIMITER; char *c; Modified: trunk/Source/Swig/misc.c =================================================================== --- trunk/Source/Swig/misc.c 2009-01-24 07:59:46 UTC (rev 11079) +++ trunk/Source/Swig/misc.c 2009-01-24 13:15:51 UTC (rev 11080) @@ -77,7 +77,7 @@ * Emits a SWIG identifying banner in the target language * ----------------------------------------------------------------------------- */ -void Swig_banner_target_lang(File *f, const String_or_char *commentchar) { +void Swig_banner_target_lang(File *f, const_String_or_char_ptr commentchar) { Printf(f, "%s This file was automatically generated by SWIG (http://www.swig.org).\n", commentchar); Printf(f, "%s Version %s\n", commentchar, Swig_package_version()); Printf(f, "%s\n", commentchar); Modified: trunk/Source/Swig/naming.c =================================================================== --- trunk/Source/Swig/naming.c 2009-01-24 07:59:46 UTC (rev 11079) +++ trunk/Source/Swig/naming.c 2009-01-24 13:15:51 UTC (rev 11080) @@ -27,13 +27,13 @@ * Register a new naming format. * ----------------------------------------------------------------------------- */ -void Swig_name_register(const String_or_char *method, const String_or_char *format) { +void Swig_name_register(const_String_or_char_ptr method, const_String_or_char_ptr format) { if (!naming_hash) naming_hash = NewHash(); Setattr(naming_hash, method, format); } -void Swig_name_unregister(const String_or_char *method) { +void Swig_name_unregister(const_String_or_char_ptr method) { if (naming_hash) { Delattr(naming_hash, method); } @@ -127,7 +127,7 @@ * Converts all of the non-identifier characters of a string to underscores. * ----------------------------------------------------------------------------- */ -String *Swig_name_mangle(const String_or_char *s) { +String *Swig_name_mangle(const_String_or_char_ptr s) { #if 0 String *r = NewString(s); name_mangle(r); @@ -143,7 +143,7 @@ * Returns the name of a wrapper function. * ----------------------------------------------------------------------------- */ -String *Swig_name_wrapper(const String_or_char *fname) { +String *Swig_name_wrapper(const_String_or_char_ptr fname) { String *r; String *f; @@ -168,7 +168,7 @@ * Returns the name of a class method. * ----------------------------------------------------------------------------- */ -String *Swig_name_member(const String_or_char *classname, const String_or_char *mname) { +String *Swig_name_member(const_String_or_char_ptr classname, const_String_or_char_ptr mname) { String *r; String *f; String *rclassname; @@ -201,7 +201,7 @@ * Returns the name of the accessor function used to get a variable. * ----------------------------------------------------------------------------- */ -String *Swig_name_get(const String_or_char *vname) { +String *Swig_name_get(const_String_or_char_ptr vname) { String *r; String *f; @@ -229,7 +229,7 @@ * Returns the name of the accessor function used to set a variable. * ----------------------------------------------------------------------------- */ -String *Swig_name_set(const String_or_char *vname) { +String *Swig_name_set(const_String_or_char_ptr vname) { String *r; String *f; @@ -253,7 +253,7 @@ * Returns the name of the accessor function used to create an object. * ----------------------------------------------------------------------------- */ -String *Swig_name_construct(const String_or_char *classname) { +String *Swig_name_construct(const_String_or_char_ptr classname) { String *r; String *f; String *rclassname; @@ -286,7 +286,7 @@ * Returns the name of the accessor function used to copy an object. * ----------------------------------------------------------------------------- */ -String *Swig_name_copyconstructor(const String_or_char *classname) { +String *Swig_name_copyconstructor(const_String_or_char_ptr classname) { String *r; String *f; String *rclassname; @@ -319,7 +319,7 @@ * Returns the name of the accessor function used to destroy an object. * ----------------------------------------------------------------------------- */ -String *Swig_name_destroy(const String_or_char *classname) { +String *Swig_name_destroy(const_String_or_char_ptr classname) { String *r; String *f; String *rclassname; @@ -351,7 +351,7 @@ * Returns the name of the accessor function used to disown an object. * ----------------------------------------------------------------------------- */ -String *Swig_name_disown(const String_or_char *classname) { +String *Swig_name_disown(const_String_or_char_ptr classname) { String *r; String *f; String *rclassname; @@ -727,7 +727,7 @@ * concatenating the feature name plus ':' plus the attribute name. * ----------------------------------------------------------------------------- */ -void Swig_feature_set(Hash *features, const String_or_char *name, SwigType *decl, const String_or_char *featurename, String *value, Hash *featureattribs) { +void Swig_feature_set(Hash *features, const_String_or_char_ptr name, SwigType *decl, const_String_or_char_ptr featurename, String *value, Hash *featureattribs) { Hash *n; Hash *fhash; @@ -1436,7 +1436,7 @@ * * ----------------------------------------------------------------------------- */ -String *Swig_name_make(Node *n, String *prefix, String_or_char *cname, SwigType *decl, String *oldname) { +String *Swig_name_make(Node *n, String *prefix, const_String_or_char_ptr cname, SwigType *decl, String *oldname) { String *nname = 0; String *result = 0; String *name = NewString(cname); Modified: trunk/Source/Swig/parms.c =================================================================== --- trunk/Source/Swig/parms.c 2009-01-24 07:59:46 UTC (rev 11079) +++ trunk/Source/Swig/parms.c 2009-01-24 13:15:51 UTC (rev 11080) @@ -17,7 +17,7 @@ * Create a new parameter from datatype 'type' and name 'name'. * ------------------------------------------------------------------------ */ -Parm *NewParm(SwigType *type, const String_or_char *name) { +Parm *NewParm(SwigType *type, const_String_or_char_ptr name) { Parm *p = NewHash(); set_nodeType(p, "parm"); if (type) { Modified: trunk/Source/Swig/scanner.c =================================================================== --- trunk/Source/Swig/scanner.c 2009-01-24 07:59:46 UTC (rev 11079) +++ trunk/Source/Swig/scanner.c 2009-01-24 13:15:51 UTC (rev 11080) @@ -118,7 +118,7 @@ * call to Scanner_token(). * ----------------------------------------------------------------------------- */ -void Scanner_pushtoken(Scanner * s, int nt, const String_or_char *val) { +void Scanner_pushtoken(Scanner * s, int nt, const_String_or_char_ptr val) { assert(s); assert((nt >= 0) && (nt < SWIG_MAXTOKENS)); s->nexttoken = nt; @@ -212,7 +212,7 @@ * Sets error information on the scanner. * ----------------------------------------------------------------------------- */ -static void set_error(Scanner *s, int line, String_or_char *msg) { +static void set_error(Scanner *s, int line, const_String_or_char_ptr msg) { s->error_line = line; s->error = NewString(msg); } Modified: trunk/Source/Swig/stype.c =================================================================== --- trunk/Source/Swig/stype.c 2009-01-24 07:59:46 UTC (rev 11079) +++ trunk/Source/Swig/stype.c 2009-01-24 13:15:51 UTC (rev 11080) @@ -537,7 +537,7 @@ * Create a C string representation of a datatype. * ----------------------------------------------------------------------------- */ -String *SwigType_str(SwigType *s, const String_or_char *id) { +String *SwigType_str(SwigType *s, const_String_or_char_ptr id) { String *result; String *element = 0, *nextelement; List *elements; @@ -732,7 +732,7 @@ * with an equivalent assignable version. * -------------------------------------------------------------------- */ -String *SwigType_lstr(SwigType *s, const String_or_char *id) { +String *SwigType_lstr(SwigType *s, const_String_or_char_ptr id) { String *result; SwigType *tc; @@ -749,7 +749,7 @@ * datatype printed by str(). * ----------------------------------------------------------------------------- */ -String *SwigType_rcaststr(SwigType *s, const String_or_char *name) { +String *SwigType_rcaststr(SwigType *s, const_String_or_char_ptr name) { String *result, *cast; String *element = 0, *nextelement; SwigType *td, *rs, *tc = 0; @@ -892,7 +892,7 @@ * Casts a variable from the real type to the local datatype. * ----------------------------------------------------------------------------- */ -String *SwigType_lcaststr(SwigType *s, const String_or_char *name) { +String *SwigType_lcaststr(SwigType *s, const_String_or_char_ptr name) { String *result; result = NewStringEmpty(); Modified: trunk/Source/Swig/swig.h =================================================================== --- trunk/Source/Swig/swig.h 2009-01-24 07:59:46 UTC (rev 11079) +++ trunk/Source/Swig/swig.h 2009-01-24 13:15:51 UTC (rev 11080) @@ -110,15 +110,15 @@ extern SwigType *NewSwigType(int typecode); extern SwigType *SwigType_del_element(SwigType *t); extern SwigType *SwigType_add_pointer(SwigType *t); - extern SwigType *SwigType_add_memberpointer(SwigType *t, const String_or_char *qual); + extern SwigType *SwigType_add_memberpointer(SwigType *t, const_String_or_char_ptr qual); extern SwigType *SwigType_del_memberpointer(SwigType *t); extern SwigType *SwigType_del_pointer(SwigType *t); - extern SwigType *SwigType_add_array(SwigType *t, const String_or_char *size); + extern SwigType *SwigType_add_array(SwigType *t, const_String_or_char_ptr size); extern SwigType *SwigType_del_array(SwigType *t); extern SwigType *SwigType_pop_arrays(SwigType *t); extern SwigType *SwigType_add_reference(SwigType *t); extern SwigType *SwigType_del_reference(SwigType *t); - extern SwigType *SwigType_add_qualifier(SwigType *t, const String_or_char *qual); + extern SwigType *SwigType_add_qualifier(SwigType *t, const_String_or_char_ptr qual); extern SwigType *SwigType_del_qualifier(SwigType *t); extern SwigType *SwigType_add_function(SwigType *t, ParmList *parms); extern SwigType *SwigType_add_template(SwigType *t, ParmList *parms); @@ -129,10 +129,10 @@ extern void SwigType_push(SwigType *t, SwigType *s); extern List *SwigType_parmlist(const SwigType *p); extern String *SwigType_parm(String *p); - extern String *SwigType_str(SwigType *s, const String_or_char *id); - extern String *SwigType_lstr(SwigType *s, const String_or_char *id); - extern String *SwigType_rcaststr(SwigType *s, const String_or_char *id); - extern String *SwigType_lcaststr(SwigType *s, const String_or_char *id); + extern String *SwigType_str(SwigType *s, const_String_or_char_ptr id); + extern String *SwigType_lstr(SwigType *s, const_String_or_char_ptr id); + extern String *SwigType_rcaststr(SwigType *s, const_String_or_char_ptr id); + extern String *SwigType_lcaststr(SwigType *s, const_String_or_char_ptr id); extern String *SwigType_manglestr(SwigType *t); extern SwigType *SwigType_ltype(SwigType *t); extern int SwigType_ispointer(SwigType *t); @@ -151,7 +151,7 @@ extern int SwigType_isvarargs(const SwigType *t); extern int SwigType_istemplate(const SwigType *t); extern int SwigType_isenum(SwigType *t); - extern int SwigType_check_decl(SwigType *t, const String_or_char *decl); + extern int SwigType_check_decl(SwigType *t, const_String_or_char_ptr decl); extern SwigType *SwigType_strip_qualifiers(SwigType *t); extern SwigType *SwigType_functionpointer_decompose(SwigType *t); extern String *SwigType_base(const SwigType *t); @@ -162,7 +162,7 @@ extern String *SwigType_prefix(const SwigType *t); extern int SwigType_array_ndim(SwigType *t); extern String *SwigType_array_getdim(SwigType *t, int n); - extern void SwigType_array_setdim(SwigType *t, int n, const String_or_char *rep); + extern void SwigType_array_setdim(SwigType *t, int n, const_String_or_char_ptr rep); extern SwigType *SwigType_array_type(SwigType *t); extern String *SwigType_default(SwigType *t); extern void SwigType_typename_replace(SwigType *t, String *pat, String *rep); @@ -173,14 +173,14 @@ /* --- Type-system managment --- */ extern void SwigType_typesystem_init(void); - extern int SwigType_typedef(SwigType *type, String_or_char *name); - extern int SwigType_typedef_class(String_or_char *name); - extern int SwigType_typedef_using(String_or_char *qname); + extern int SwigType_typedef(SwigType *type, const_String_or_char_ptr name); + extern int SwigType_typedef_class(const_String_or_char_ptr name); + extern int SwigType_typedef_using(const_String_or_char_ptr qname); extern void SwigType_inherit(String *subclass, String *baseclass, String *cast, String *conversioncode); extern int SwigType_issubtype(SwigType *subtype, SwigType *basetype); extern void SwigType_scope_alias(String *aliasname, Typetab *t); extern void SwigType_using_scope(Typetab *t); - extern void SwigType_new_scope(const String_or_char *name); + extern void SwigType_new_scope(const_String_or_char_ptr name); extern void SwigType_inherit_scope(Typetab *scope); extern Typetab *SwigType_pop_scope(void); extern Typetab *SwigType_set_scope(Typetab *h); @@ -192,8 +192,8 @@ extern int SwigType_isclass(SwigType *t); extern void SwigType_attach_symtab(Symtab *syms); extern void SwigType_remember(SwigType *t); - extern void SwigType_remember_clientdata(SwigType *t, const String_or_char *clientdata); - extern void SwigType_remember_mangleddata(String *mangled, const String_or_char *clientdata); + extern void SwigType_remember_clientdata(SwigType *t, const_String_or_char_ptr clientdata); + extern void SwigType_remember_mangleddata(String *mangled, const_String_or_char_ptr clientdata); extern void (*SwigType_remember_trace(void (*tf) (SwigType *, String *, String *))) (SwigType *, String *, String *); extern void SwigType_emit_type_table(File *f_headers, File *f_table); extern int SwigType_type(SwigType *t); @@ -201,25 +201,25 @@ /* --- Symbol table module --- */ extern void Swig_symbol_init(void); - extern void Swig_symbol_setscopename(const String_or_char *name); + extern void Swig_symbol_setscopename(const_String_or_char_ptr name); extern String *Swig_symbol_getscopename(void); extern String *Swig_symbol_qualifiedscopename(Symtab *symtab); extern Symtab *Swig_symbol_newscope(void); extern Symtab *Swig_symbol_setscope(Symtab *); - extern Symtab *Swig_symbol_getscope(const String_or_char *symname); + extern Symtab *Swig_symbol_getscope(const_String_or_char_ptr symname); extern Symtab *Swig_symbol_current(void); extern Symtab *Swig_symbol_popscope(void); - extern Node *Swig_symbol_add(String_or_char *symname, Node *node); - extern void Swig_symbol_cadd(String_or_char *symname, Node *node); - extern Node *Swig_symbol_clookup(String_or_char *symname, Symtab *tab); - extern Node *Swig_symbol_clookup_check(String_or_char *symname, Symtab *tab, int (*check) (Node *)); - extern Symtab *Swig_symbol_cscope(String_or_char *symname, Symtab *tab); - extern Node *Swig_symbol_clookup_local(String_or_char *symname, Symtab *tab); - extern Node *Swig_symbol_clookup_local_check(String_or_char *symname, Symtab *tab, int (*check) (Node *)); + extern Node *Swig_symbol_add(const_String_or_char_ptr symname, Node *node); + extern void Swig_symbol_cadd(const_String_or_char_ptr symname, Node *node); + extern Node *Swig_symbol_clookup(const_String_or_char_ptr symname, Symtab *tab); + extern Node *Swig_symbol_clookup_check(const_String_or_char_ptr symname, Symtab *tab, int (*check) (Node *)); + extern Symtab *Swig_symbol_cscope(const_String_or_char_ptr symname, Symtab *tab); + extern Node *Swig_symbol_clookup_local(const_String_or_char_ptr symname, Symtab *tab); + extern Node *Swig_symbol_clookup_local_check(const_String_or_char_ptr symname, Symtab *tab, int (*check) (Node *)); extern String *Swig_symbol_qualified(Node *node); extern Node *Swig_symbol_isoverloaded(Node *node); extern void Swig_symbol_remove(Node *node); - extern void Swig_symbol_alias(String_or_char *aliasname, Symtab *tab); + extern void Swig_symbol_alias(const_String_or_char_ptr aliasname, Symtab *tab); extern void Swig_symbol_inherit(Symtab *tab); extern SwigType *Swig_symbol_type_qualify(const SwigType *ty, Symtab *tab); extern String *Swig_symbol_string_qualify(String *s, Symtab *tab); @@ -246,17 +246,17 @@ /* --- Naming functions --- */ - extern void Swig_name_register(const String_or_char *method, const String_or_char *format); - extern void Swig_name_unregister(const String_or_char *method); - extern String *Swig_name_mangle(const String_or_char *s); - extern String *Swig_name_wrapper(const String_or_char *fname); - extern String *Swig_name_member(const String_or_char *classname, const String_or_char *mname); - extern String *Swig_name_get(const String_or_char *vname); - extern String *Swig_name_set(const String_or_char *vname); - extern String *Swig_name_construct(const String_or_char *classname); - extern String *Swig_name_copyconstructor(const String_or_char *classname); - extern String *Swig_name_destroy(const String_or_char *classname); - extern String *Swig_name_disown(const String_or_char *classname); + extern void Swig_name_register(const_String_or_char_ptr method, const_String_or_char_ptr format); + extern void Swig_name_unregister(const_String_or_char_ptr method); + extern String *Swig_name_mangle(const_String_or_char_ptr s); + extern String *Swig_name_wrapper(const_String_or_char_ptr fname); + extern String *Swig_name_member(const_String_or_char_ptr classname, const_String_or_char_ptr mname); + extern String *Swig_name_get(const_String_or_char_ptr vname); + extern String *Swig_name_set(const_String_or_char_ptr vname); + extern String *Swig_name_construct(const_String_or_char_ptr classname); + extern String *Swig_name_copyconstructor(const_String_or_char_ptr classname); + extern String *Swig_name_destroy(const_String_or_char_ptr classname); + extern String *Swig_name_disown(const_String_or_char_ptr classname); extern void Swig_naming_init(void); extern void Swig_name_namewarn_add(String *prefix, String *name, SwigType *decl, Hash *namewrn); @@ -267,25 +267,25 @@ extern int Swig_need_name_warning(Node *n); extern int Swig_need_redefined_warn(Node *a, Node *b, int InClass); - extern String *Swig_name_make(Node *n, String *prefix, String_or_char *cname, SwigType *decl, String *oldname); + extern String *Swig_name_make(Node *n, String *prefix, const_String_or_char_ptr cname, SwigType *decl, String *oldname); extern String *Swig_name_warning(Node *n, String *prefix, String *name, SwigType *decl); extern String *Swig_name_decl(Node *n); extern String *Swig_name_fulldecl(Node *n); /* --- parameterized rename functions --- */ - extern void Swig_name_object_set(Hash *namehash, String_or_char *name, SwigType *decl, DOH *object); - extern DOH *Swig_name_object_get(Hash *namehash, String_or_char *prefix, String_or_char *name, SwigType *decl); + extern void Swig_name_object_set(Hash *namehash, String *name, SwigType *decl, DOH *object); + extern DOH *Swig_name_object_get(Hash *namehash, String *prefix, String *name, SwigType *decl); extern void Swig_name_object_inherit(Hash *namehash, String *base, String *derived); - extern void Swig_features_get(Hash *features, String_or_char *prefix, String_or_char *name, SwigType *decl, Node *n); - extern void Swig_feature_set(Hash *features, const String_or_char *name, SwigType *decl, const String_or_char *featurename, String *value, Hash *featureattribs); + extern void Swig_features_get(Hash *features, String *prefix, String *name, SwigType *decl, Node *n); + extern void Swig_feature_set(Hash *features, const_String_or_char_ptr name, SwigType *decl, const_String_or_char_ptr featurename, String *value, Hash *featureattribs); /* --- 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 void Swig_banner_target_lang(File *f, const String_or_char *commentchar); + extern void Swig_banner_target_lang(File *f, const_String_or_char_ptr commentchar); extern String *Swig_strip_c_comments(const String *s); extern String *Swig_filename_escape(String *filename); extern void Swig_filename_correct(String *filename); @@ -311,11 +311,11 @@ typedef enum { EMF_STANDARD, EMF_MICROSOFT } ErrorMessageFormat; - extern void Swig_warning(int num, const String_or_char *filename, int line, const char *fmt, ...); - extern void Swig_error(const String_or_char *filename, int line, const char *fmt, ...); + extern void Swig_warning(int num, const_String_or_char_ptr filename, int line, const char *fmt, ...); + extern void Swig_error(const_String_or_char_ptr filename, int line, const char *fmt, ...); extern int Swig_error_count(void); extern void Swig_error_silent(int s); - extern void Swig_warnfilter(const String_or_char *wlist, int val); + extern void Swig_warnfilter(const_String_or_char_ptr wlist, int val); extern void Swig_warnall(void); extern int Swig_warn_count(void); extern void Swig_error_msg_format(ErrorMessageFormat format); @@ -324,17 +324,17 @@ extern String *Swig_cparm_name(Parm *p, int i); extern String *Swig_wrapped_var_type(SwigType *t, int varcref); extern int Swig_cargs(Wrapper *w, ParmList *l); - extern String *Swig_cresult(SwigType *t, const String_or_char *name, const String_or_char *decl); + extern String *Swig_cresult(SwigType *t, const_String_or_char_ptr name, const_String_or_char_ptr decl); - extern String *Swig_cfunction_call(String_or_char *name, ParmList *parms); - extern String *Swig_cconstructor_call(String_or_char *name); - extern String *Swig_cppconstructor_call(String_or_char *name, ParmList *parms); + extern String *Swig_cfunction_call(const_String_or_char_ptr name, ParmList *parms); + extern String *Swig_cconstructor_call(const_String_or_char_ptr name); + extern String *Swig_cppconstructor_call(const_String_or_char_ptr name, ParmList *parms); extern String *Swig_unref_call(Node *n); extern String *Swig_ref_call(Node *n, const String *lname); extern String *Swig_cdestructor_call(Node *n); extern String *Swig_cppdestructor_call(Node *n); - extern String *Swig_cmemberset_call(String_or_char *name, SwigType *type, String_or_char *self, int varcref); - extern String *Swig_cmemberget_call(const String_or_char *name, SwigType *t, String_or_char *self, int varcref); + extern String *Swig_cmemberset_call(const_String_or_char_ptr name, SwigType *type, const_String_or_char_ptr self, int varcref); + extern String *Swig_cmemberget_call(const_String_or_char_ptr name, SwigType *t, const_String_or_char_ptr self, int varcref); extern int Swig_add_extension_code(Node *n, const String *function_name, ParmList *parms, SwigType *return_type, const String *code, int cplusplus, const String *self); @@ -363,22 +363,22 @@ /* --- Legacy Typemap API (somewhat simplified, ha!) --- */ extern void Swig_typemap_init(void); - extern void Swig_typemap_register(const String_or_char *op, ParmList *pattern, String_or_char *code, ParmList *locals, ParmList *kwargs); - extern int Swig_typemap_copy(const String_or_char *op, ParmList *srcpattern, ParmList *pattern); - extern void Swig_typemap_clear(const String_or_char *op, ParmList *pattern); + extern void Swig_typemap_register(const_String_or_char_ptr op, ParmList *pattern, const_String_or_char_ptr code, ParmList *locals, ParmList *kwargs); + extern int Swig_typemap_copy(const_String_or_char_ptr op, ParmList *srcpattern, ParmList *pattern); + extern void Swig_typemap_clear(const_String_or_char_ptr op, ParmList *pattern); extern int Swig_typemap_apply(ParmList *srcpat, ParmList *destpat); extern void Swig_typemap_clear_apply(ParmList *pattern); extern void Swig_typemap_debug(void); - extern Hash *Swig_typemap_search(const String_or_char *op, SwigType *type, const String_or_char *pname, SwigType **matchtype); - extern Hash *Swig_typemap_search_multi(const String_or_char *op, ParmList *parms, int *nmatch); - extern String *Swig_typemap_lookup(const String_or_char *op, Node *n, const String_or_char *lname, Wrapper *f); - extern String *Swig_typemap_lookup_out(const String_or_char *op, Node *n, const String_or_char *lname, Wrapper *f, String *actioncode); - extern void Swig_typemap_attach_kwargs(Hash *tm, const String_or_char *op, Parm *p); + extern Hash *Swig_typemap_search(const_String_or_char_ptr op, SwigType *type, const_String_or_char_ptr pname, SwigType **matchtype); + extern Hash *Swig_typemap_search_multi(const_String_or_char_ptr op, ParmList *parms, int *nmatch); + extern String *Swig_typemap_lookup(const_String_or_char_ptr op, Node *n, const_String_or_char_ptr lname, Wrapper *f); + extern String *Swig_typemap_lookup_out(const_String_or_char_ptr op, Node *n, const_String_or_char_ptr lname, Wrapper *f, String *actioncode); + extern void Swig_typemap_attach_kwargs(Hash *tm, const_String_or_char_ptr op, Parm *p); extern void Swig_typemap_new_scope(void); extern Hash *Swig_typemap_pop_scope(void); - extern void Swig_typemap_attach_parms(const String_or_char *op, ParmList *parms, Wrapper *f); + extern void Swig_typemap_attach_parms(const_String_or_char_ptr op, ParmList *parms, Wrapper *f); /* --- Code fragment support --- */ Modified: trunk/Source/Swig/swigfile.h =================================================================== --- trunk/Source/Swig/swigfile.h 2009-01-24 07:59:46 UTC (rev 11079) +++ trunk/Source/Swig/swigfile.h 2009-01-24 13:15:51 UTC (rev 11080) @@ -9,25 +9,25 @@ /* $Id: swig.h 9603 2006-12-05 21:47:01Z beazley $ */ -extern List *Swig_add_directory(const String_or_char *dirname); -extern void Swig_push_directory(const String_or_char *dirname); +extern List *Swig_add_directory(const_String_or_char_ptr dirname); +extern void Swig_push_directory(const_String_or_char_ptr dirname); extern void Swig_pop_directory(void); extern String *Swig_last_file(void); extern List *Swig_search_path(void); -extern FILE *Swig_include_open(const String_or_char *name); -extern FILE *Swig_open(const String_or_char *name); +extern FILE *Swig_include_open(const_String_or_char_ptr name); +extern FILE *Swig_open(const_String_or_char_ptr name); extern String *Swig_read_file(FILE *f); -extern String *Swig_include(const String_or_char *name); -extern String *Swig_include_sys(const String_or_char *name); -extern int ... [truncated message content] |
From: <bh...@us...> - 2009-01-30 10:33:06
|
Revision: 11098 http://swig.svn.sourceforge.net/swig/?rev=11098&view=rev Author: bhy Date: 2009-01-30 10:32:59 +0000 (Fri, 30 Jan 2009) Log Message: ----------- Fix broken caused by merge Modified Paths: -------------- trunk/Source/Preprocessor/cpp.c trunk/Source/Swig/cwrap.c Modified: trunk/Source/Preprocessor/cpp.c =================================================================== --- trunk/Source/Preprocessor/cpp.c 2009-01-30 10:27:37 UTC (rev 11097) +++ trunk/Source/Preprocessor/cpp.c 2009-01-30 10:32:59 UTC (rev 11098) @@ -86,7 +86,7 @@ } if (!s) { /* XXX(bhy) may not need the seek */ - // Seek(fn, 0, SEEK_SET); + /* Seek(fn, 0, SEEK_SET); */ if (ignore_missing) { Swig_warning(WARN_PP_MISSING_FILE, Getfile(fn), Getline(fn), "Unable to find '%s'\n", fn); } else { Modified: trunk/Source/Swig/cwrap.c =================================================================== --- trunk/Source/Swig/cwrap.c 2009-01-30 10:27:37 UTC (rev 11097) +++ trunk/Source/Swig/cwrap.c 2009-01-30 10:32:59 UTC (rev 11098) @@ -683,7 +683,7 @@ * * ----------------------------------------------------------------------------- */ -String *Swig_cmemberset_call(const_String_or_char_ptr name, SwigType *type, String *self, int varcref) { +String *Swig_cmemberset_call(const_String_or_char_ptr name, SwigType *type, const_String_or_char_ptr self, int varcref) { String *func; String *pname0 = Swig_cparm_name(0, 0); String *pname1 = Swig_cparm_name(0, 1); @@ -718,7 +718,7 @@ * * ----------------------------------------------------------------------------- */ -String *Swig_cmemberget_call(const_String_or_char_ptr name, SwigType *t, String *self, int varcref) { +String *Swig_cmemberget_call(const_String_or_char_ptr name, SwigType *t, const_String_or_char_ptr self, int varcref) { String *func; String *call; String *pname0 = Swig_cparm_name(0, 0); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wsf...@us...> - 2009-07-08 12:57:48
|
Revision: 11380 http://swig.svn.sourceforge.net/swig/?rev=11380&view=rev Author: wsfulton Date: 2009-07-08 12:17:45 +0000 (Wed, 08 Jul 2009) Log Message: ----------- Typemap API changes to facilitate more uniform typemap handling across language modules - in particular some typemaps usage did not respect the warning attribute and other warning handling and $typemap special variable (which will be refined in future commit) as well as local typemap variable handling: - remove Swig_typemap_search, Swig_typemap_search_multi and Swig_typemap_attach_kwargs from access outside of typemaps.c (made static) - all static methods in typemap.c renamed dropping Swig_ prefix Modified Paths: -------------- trunk/Source/Modules/allegrocl.cxx trunk/Source/Modules/cffi.cxx trunk/Source/Modules/clisp.cxx trunk/Source/Modules/csharp.cxx trunk/Source/Modules/java.cxx trunk/Source/Modules/modula3.cxx trunk/Source/Modules/uffi.cxx trunk/Source/Swig/swig.h trunk/Source/Swig/typemap.c Modified: trunk/Source/Modules/allegrocl.cxx =================================================================== --- trunk/Source/Modules/allegrocl.cxx 2009-07-08 10:24:31 UTC (rev 11379) +++ trunk/Source/Modules/allegrocl.cxx 2009-07-08 12:17:45 UTC (rev 11380) @@ -626,7 +626,7 @@ add_defined_foreign_type(0, 0, t, t, implicit_ns ? implicit_ns : current_namespace); } -String *get_ffi_type(SwigType *ty, const_String_or_char_ptr name) { +String *get_ffi_type(Node *n, SwigType *ty, const_String_or_char_ptr name) { /* lookup defined foreign type. if it exists, it will return a form suitable for placing into lisp code to generate the def-foreign-type name */ @@ -641,18 +641,20 @@ #ifdef ALLEGROCL_TYPE_DEBUG Printf(stderr, "found_type '%s'\n", found_type); #endif - return (Strcmp(found_type, "forward-reference") ? Copy(found_type) : - get_ffi_type(fwdref_ffi_type, "")); + return (Strcmp(found_type, "forward-reference") ? Copy(found_type) : get_ffi_type(n, fwdref_ffi_type, "")); } else { - Hash *typemap = Swig_typemap_search("ffitype", ty, name, 0); + Node *node = NewHash(); + Setattr(node, "type", ty); + Setfile(node, Getfile(n)); + Setline(node, Getline(n)); + const String *tm = Swig_typemap_lookup("ffitype", node, name, 0); + Delete(node); - if (typemap) { - String *typespec = Getattr(typemap, "code"); - + if (tm) { #ifdef ALLEGROCL_TYPE_DEBUG - Printf(stderr, "g-f-t: found ffitype typemap '%s'\n%s\n", typespec, typemap); + Printf(stderr, "g-f-t: found ffitype typemap '%s'\n", tm); #endif - return NewString(typespec); + return NewString(tm); } if (SwigType_istemplate(ty)) { @@ -673,7 +675,7 @@ /* walk type and return string containing lisp version. recursive. */ -String *internal_compose_foreign_type(SwigType *ty) { +String *internal_compose_foreign_type(Node *n, SwigType *ty) { SwigType *tok; String *ffiType = NewString(""); @@ -691,18 +693,18 @@ Printf(ffiType, "("); // start parm list for (Iterator i = First(pl); i.item; i = Next(i)) { SwigType *f_arg = SwigType_strip_qualifiers(i.item); - Printf(ffiType, "%s ", internal_compose_foreign_type(f_arg)); + Printf(ffiType, "%s ", internal_compose_foreign_type(n, f_arg)); Delete(f_arg); } Printf(ffiType, ")"); // end parm list. // do function return type. - Printf(ffiType, " %s)", internal_compose_foreign_type(ty)); + Printf(ffiType, " %s)", internal_compose_foreign_type(n, ty)); break; } else if (SwigType_ispointer(tok) || SwigType_isreference(tok)) { - Printf(ffiType, "(* %s)", internal_compose_foreign_type(ty)); + Printf(ffiType, "(* %s)", internal_compose_foreign_type(n, ty)); } else if (SwigType_isarray(tok)) { - Printf(ffiType, "(:array %s", internal_compose_foreign_type(ty)); + Printf(ffiType, "(:array %s", internal_compose_foreign_type(n, ty)); String *atype = NewString("int"); String *dim = convert_literal(SwigType_array_getdim(tok, 0), atype); Delete(atype); @@ -713,18 +715,18 @@ } } else if (SwigType_ismemberpointer(tok)) { // temp - Printf(ffiType, "(* %s)", internal_compose_foreign_type(ty)); + Printf(ffiType, "(* %s)", internal_compose_foreign_type(n, ty)); } else { - String *res = get_ffi_type(tok, ""); + String *res = get_ffi_type(n, tok, ""); if (res) { Printf(ffiType, "%s", res); } else { SwigType *resolved_type = SwigType_typedef_resolve(tok); if (resolved_type) { - res = get_ffi_type(resolved_type, ""); + res = get_ffi_type(n, resolved_type, ""); if (res) { } else { - res = internal_compose_foreign_type(resolved_type); + res = internal_compose_foreign_type(n, resolved_type); } if (res) Printf(ffiType, "%s", res); @@ -762,7 +764,7 @@ add_forward_referenced_type(nn, 0); // tok_name is dangling here, unused. ouch. why? - Printf(ffiType, "%s", get_ffi_type(tok, ""), tok_name); + Printf(ffiType, "%s", get_ffi_type(n, tok, ""), tok_name); } } } @@ -770,10 +772,8 @@ return ffiType; } -String *compose_foreign_type(SwigType *ty, String * /*id*/ = 0) { +String *compose_foreign_type(Node *n, SwigType *ty, String * /*id*/ = 0) { -/* Hash *lookup_res = Swig_typemap_search("ffitype", ty, id, 0); */ - #ifdef ALLEGROCL_TYPE_DEBUG Printf(stderr, "compose_foreign_type: ENTER (%s)...\n ", ty); // Printf(stderr, "compose_foreign_type: ENTER (%s)(%s)...\n ", ty, (id ? id : 0)); @@ -802,7 +802,7 @@ */ SwigType *temp = SwigType_strip_qualifiers(ty); - String *res = internal_compose_foreign_type(temp); + String *res = internal_compose_foreign_type(n, temp); Delete(temp); #ifdef ALLEGROCL_TYPE_DEBUG @@ -1239,7 +1239,7 @@ #ifdef ALLEGROCL_WRAP_DEBUG Printf(stderr, "slot name = '%s' ns = '%s' class-of '%s' and type = '%s'\n", cname, ns, name, childType); #endif - Printf(slotdefs, "(#.(swig-insert-id \"%s\" %s :type :slot :class \"%s\") %s)", cname, ns, name, compose_foreign_type(childType)); + Printf(slotdefs, "(#.(swig-insert-id \"%s\" %s :type :slot :class \"%s\") %s)", cname, ns, name, compose_foreign_type(n, childType)); Delete(ns); if (access && Strcmp(access, "public")) Printf(slotdefs, " ;; %s member", access); @@ -1322,7 +1322,7 @@ String *name; String *sym_name = Getattr(n, "sym:name"); String *type = NewStringf("%s%s", Getattr(n, "decl"), Getattr(n, "type")); - String *lisp_type = compose_foreign_type(type); + String *lisp_type = compose_foreign_type(n, type); Delete(type); Node *in_class = Getattr(n, "allegrocl:typedef:in-class"); @@ -1371,9 +1371,13 @@ name = unnamed ? Getattr(n, "allegrocl:name") : Getattr(n, "sym:name"); SwigType *tmp = NewStringf("enum %s", unnamed ? unnamed : name); - Hash *typemap = Swig_typemap_search("ffitype", tmp, 0, 0); - String *enumtype = Getattr(typemap, "code"); - // enumtype = compose_foreign_type(tmp); + Node *node = NewHash(); + Setattr(node, "type", tmp); + Setfile(node, Getfile(n)); + Setline(node, Getline(n)); + const String *enumtype = Swig_typemap_lookup("ffitype", node, "", 0); + Delete(node); + Delete(tmp); if (name) { @@ -1427,12 +1431,14 @@ name = unnamed ? Getattr(n, "allegrocl:name") : Getattr(n, "sym:name"); SwigType *tmp = NewStringf("enum %s", unnamed ? unnamed : name); - // SwigType *tmp = NewStringf("enum ACL_SWIG_ENUM_NAME"); - Hash *typemap = Swig_typemap_search("ffitype", tmp, 0, 0); - String *enumtype = Getattr(typemap, "code"); + Node *node = NewHash(); + Setattr(node, "type", tmp); + Setfile(node, Getfile(n)); + Setline(node, Getline(n)); + const String *enumtype = Swig_typemap_lookup("ffitype", node, "", 0); + Delete(node); - // enumtype = compose_foreign_type(tmp); Delete(tmp); if (name) { @@ -1979,14 +1985,16 @@ return 0; } -String *get_lisp_type(SwigType *ty, const_String_or_char_ptr name) { - Hash *typemap = Swig_typemap_search("lisptype", ty, name, 0); - if (typemap) { - String *typespec = Getattr(typemap, "code"); - return NewString(typespec); - } else { - return NewString(""); - } +String *get_lisp_type(Node *n, SwigType *ty, const_String_or_char_ptr name) { + Node *node = NewHash(); + Setattr(node, "type", ty); + Setattr(node, "name", name); + Setfile(node, Getfile(n)); + Setline(node, Getline(n)); + const String *tm = Swig_typemap_lookup("lisptype", node, "", 0); + Delete(node); + + return tm ? NewString(tm) : NewString(""); } Node *parent_node_skipping_extends(Node *n) { @@ -2274,18 +2282,21 @@ return SWIG_OK; } -String *dispatching_type(Parm *p) { +String *dispatching_type(Node *n, Parm *p) { String *result = 0; String *parsed = Getattr(p, "type"); //Swig_cparse_type(Getattr(p,"tmap:ctype")); String *cl_t = SwigType_typedef_resolve_all(parsed); - Hash *typemap = Swig_typemap_search("lispclass", parsed, Getattr(p, "name"), 0); - // Printf(stderr,"inspecting type '%s' for class\n", parsed); - // Printf(stderr," cfcocr = '%s' res_all = '%s'\n", - // class_from_class_or_class_ref(parsed), cl_t); - if (typemap) { - result = Copy(Getattr(typemap, "code")); + Node *node = NewHash(); + Setattr(node, "type", parsed); + Setfile(node, Getfile(n)); + Setline(node, Getline(n)); + const String *tm = Swig_typemap_lookup("lispclass", node, Getattr(p, "name"), 0); + Delete(node); + + if (tm) { + result = Copy(tm); } else { String *lookup_type = class_from_class_or_class_ref(parsed); if (lookup_type) @@ -2305,24 +2316,6 @@ return result; } -String *defmethod_lambda_list(Node *overload) { - String *result = NewString(""); - - ParmList *parms = Getattr(overload, "wrap:parms"); - Parm *p; - int a; - - for (a = 0, p = parms; p; p = nextSibling(p), ++a) { - if (a != 0) - Printf(result, " "); - Printf(result, "(arg%d ", a); - Printf(result, "%s", dispatching_type(p)); - Printf(result, ")"); - } - - return result; -} - int ALLEGROCL::emit_dispatch_defun(Node *n) { #ifdef ALLEGROCL_WRAP_DEBUG Printf(stderr, "emit_dispatch_defun: ENTER... "); @@ -2429,9 +2422,9 @@ String *argname = NewStringf("PARM%d_%s", largnum, Getattr(p, "name")); // Printf(stderr,"%s\n", Getattr(p,"tmap:lin")); - String *ffitype = compose_foreign_type(argtype, Getattr(p,"name")); + String *ffitype = compose_foreign_type(n, argtype, Getattr(p,"name")); String *deref_ffitype = dereference_ffitype(ffitype); - String *lisptype = get_lisp_type(parmtype, Getattr(p, "name")); + String *lisptype = get_lisp_type(n, parmtype, Getattr(p, "name")); #ifdef ALLEGROCL_DEBUG Printf(stderr, "lisptype of '%s' '%s' = '%s'\n", parmtype, @@ -2454,7 +2447,7 @@ Replaceall(wrap->code, "$body", parm_code); } - String *dispatchtype = Getattr(n, "sym:overloaded") ? dispatching_type(p) : NewString(""); + String *dispatchtype = Getattr(n, "sym:overloaded") ? dispatching_type(n, p) : NewString(""); // if this parameter has been removed from the C/++ wrapper // it shouldn't be in the lisp wrapper either. @@ -2485,13 +2478,13 @@ SwigType *parsed = Swig_cparse_type(Getattr(n, "tmap:ctype")); // SwigType *cl_t = SwigType_typedef_resolve_all(parsed); SwigType *cl_t = class_from_class_or_class_ref(parsed); - String *out_ffitype = compose_foreign_type(parsed); + String *out_ffitype = compose_foreign_type(n, parsed); String *deref_out_ffitype; String *out_temp = Copy(parsed); if (SwigType_ispointer(out_temp)) { SwigType_pop(out_temp); - deref_out_ffitype = compose_foreign_type(out_temp); + deref_out_ffitype = compose_foreign_type(n, out_temp); } else { deref_out_ffitype = Copy(out_ffitype); } @@ -2547,7 +2540,7 @@ ///////////////////////////////////////////////////// // Lisp foreign call return type and optimizations // ///////////////////////////////////////////////////// - Printf(fcl, " (:returning (%s %s)", compose_foreign_type(result_type), get_lisp_type(Getattr(n, "type"), "result")); + Printf(fcl, " (:returning (%s %s)", compose_foreign_type(n, result_type), get_lisp_type(n, Getattr(n, "type"), "result")); for (Iterator option = First(n); option.item; option = Next(option)) { if (Strncmp("feature:ffargs:", option.key, 15)) @@ -2926,10 +2919,6 @@ Printf(f_runtime, "EXPORT %s %s;\n%s %s = %s%s;\n", ctype, mangled_name, ctype, mangled_name, (pointer_added ? "&" : ""), name); Printf(f_cl, "(swig-defvar \"%s\" :type %s)\n", mangled_name, ((SwigType_isconst(type)) ? ":constant" : ":variable")); - /* - Printf(f_runtime, "// swigtype: %s\n", SwigType_typedef_resolve_all(Getattr(n,"type"))); - Printf(f_runtime, "// vwrap: %s\n", compose_foreign_type(SwigType_strip_qualifiers(Copy(rtype)))); - */ Printf(stderr,"***\n"); Delete(mangled_name); @@ -2971,7 +2960,7 @@ SwigType *typedef_type = Getattr(n,"type"); // has the side-effect of noting any implicit // template instantiations in type. - String *ff_type = compose_foreign_type(typedef_type); + String *ff_type = compose_foreign_type(n, typedef_type); String *sym_name = Getattr(n, "sym:name"); @@ -3132,7 +3121,7 @@ Printf(stderr, "looking at child '%x' of type '%s'\n", c, childType); #endif if (!SwigType_isfunction(childType)) - Delete(compose_foreign_type(childType)); + Delete(compose_foreign_type(n, childType)); Delete(childType); } Modified: trunk/Source/Modules/cffi.cxx =================================================================== --- trunk/Source/Modules/cffi.cxx 2009-07-08 10:24:31 UTC (rev 11379) +++ trunk/Source/Modules/cffi.cxx 2009-07-08 12:17:45 UTC (rev 11380) @@ -819,21 +819,24 @@ // Getattr(c, "type")); // SWIG_exit(EXIT_FAILURE); } else { - SwigType *childType = NewStringf("%s%s", Getattr(c, "decl"), - Getattr(c, "type")); + SwigType *childType = NewStringf("%s%s", Getattr(c, "decl"), Getattr(c, "type")); - Hash *typemap = Swig_typemap_search("cin", childType, "", 0); - String *typespec = NewString(""); - if (typemap) { - typespec = NewString(Getattr(typemap, "code")); - } + Node *node = NewHash(); + Setattr(node, "type", childType); + Setfile(node, Getfile(n)); + Setline(node, Getline(n)); + const String *tm = Swig_typemap_lookup("cin", node, "", 0); + String *typespec = tm ? NewString(tm) : NewString(""); + String *slot_name = lispify_name(c, Getattr(c, "sym:name"), "'slotname"); if (Strcmp(slot_name, "t") == 0 || Strcmp(slot_name, "T") == 0) - slot_name = NewStringf("t_var"); + slot_name = NewStringf("t_var"); Printf(f_cl, "\n\t(%s %s)", slot_name, typespec); + Delete(node); + Delete(childType); Delete(typespec); } } Modified: trunk/Source/Modules/clisp.cxx =================================================================== --- trunk/Source/Modules/clisp.cxx 2009-07-08 10:24:31 UTC (rev 11379) +++ trunk/Source/Modules/clisp.cxx 2009-07-08 12:17:45 UTC (rev 11380) @@ -25,7 +25,7 @@ virtual int typedefHandler(Node *n); List *entries; private: - String *get_ffi_type(SwigType *ty); + String *get_ffi_type(Node *n, SwigType *ty); String *convert_literal(String *num_param, String *type); String *strip_parens(String *string); int extern_all_flag; @@ -167,7 +167,7 @@ String *argname = Getattr(p, "name"); // SwigType *argtype; - String *ffitype = get_ffi_type(Getattr(p, "type")); + String *ffitype = get_ffi_type(n, Getattr(p, "type")); int tempargname = 0; @@ -190,7 +190,7 @@ if (ParmList_len(pl) != 0) { Printf(f_cl, ")\n"); /* finish arg list */ } - String *ffitype = get_ffi_type(Getattr(n, "type")); + String *ffitype = get_ffi_type(n, Getattr(n, "type")); if (Strcmp(ffitype, "NIL")) { //when return type is not nil Printf(f_cl, "\t(:return-type %s)\n", ffitype); } @@ -222,7 +222,7 @@ return SWIG_OK; String *var_name = Getattr(n, "sym:name"); - String *lisp_type = get_ffi_type(Getattr(n, "type")); + String *lisp_type = get_ffi_type(n, Getattr(n, "type")); Printf(f_cl, "\n(ffi:def-c-var %s\n (:name \"%s\")\n (:type %s)\n", var_name, var_name, lisp_type); Printf(f_cl, "\t(:library +library-name+))\n"); Append(entries, var_name); @@ -234,7 +234,7 @@ int CLISP::typedefHandler(Node *n) { if (generate_typedef_flag) { is_function = 0; - Printf(f_cl, "\n(ffi:def-c-type %s %s)\n", Getattr(n, "name"), get_ffi_type(Getattr(n, "type"))); + Printf(f_cl, "\n(ffi:def-c-type %s %s)\n", Getattr(n, "name"), get_ffi_type(n, Getattr(n, "type"))); } return Language::typedefHandler(n); @@ -290,7 +290,7 @@ String *temp = Copy(Getattr(c, "decl")); Append(temp, Getattr(c, "type")); //appending type to the end, otherwise wrong type - String *lisp_type = get_ffi_type(temp); + String *lisp_type = get_ffi_type(n, temp); Delete(temp); String *slot_name = Getattr(c, "sym:name"); @@ -371,15 +371,20 @@ return res; } -String *CLISP::get_ffi_type(SwigType *ty) { - Hash *typemap = Swig_typemap_search("in", ty, "", 0); - if (typemap) { - String *typespec = Getattr(typemap, "code"); - return NewString(typespec); +String *CLISP::get_ffi_type(Node *n, SwigType *ty) { + Node *node = NewHash(); + Setattr(node, "type", ty); + Setfile(node, Getfile(n)); + Setline(node, Getline(n)); + const String *tm = Swig_typemap_lookup("in", node, "", 0); + Delete(node); + + if (tm) { + return NewString(tm); } else if (SwigType_ispointer(ty)) { SwigType *cp = Copy(ty); SwigType_del_pointer(cp); - String *inner_type = get_ffi_type(cp); + String *inner_type = get_ffi_type(n, cp); if (SwigType_isfunction(cp)) { return inner_type; @@ -409,12 +414,12 @@ Delete(array_dim); SwigType_del_array(cp); SwigType_add_pointer(cp); - String *str = get_ffi_type(cp); + String *str = get_ffi_type(n, cp); Delete(cp); return str; } else { SwigType_pop_arrays(cp); - String *inner_type = get_ffi_type(cp); + String *inner_type = get_ffi_type(n, cp); Delete(cp); int ndim = SwigType_array_ndim(ty); @@ -455,7 +460,7 @@ for (Parm *p = pl; p; p = nextSibling(p), argnum++) { String *argname = Getattr(p, "name"); SwigType *argtype = Getattr(p, "type"); - String *ffitype = get_ffi_type(argtype); + String *ffitype = get_ffi_type(n, argtype); int tempargname = 0; @@ -475,7 +480,7 @@ if (ParmList_len(pl) != 0) { Printf(args, ")\n"); /* finish arg list */ } - String *ffitype = get_ffi_type(cp); + String *ffitype = get_ffi_type(n, cp); String *str = NewStringf("(ffi:c-function %s \t\t\t\t(:return-type %s))", args, ffitype); Delete(fn); Delete(args); Modified: trunk/Source/Modules/csharp.cxx =================================================================== --- trunk/Source/Modules/csharp.cxx 2009-07-08 10:24:31 UTC (rev 11379) +++ trunk/Source/Modules/csharp.cxx 2009-07-08 12:17:45 UTC (rev 11380) @@ -1115,16 +1115,16 @@ // Wrap (non-anonymous) C/C++ enum within a typesafe, typeunsafe or proper C# enum // Pure C# baseclass and interfaces - const String *pure_baseclass = typemapLookup("csbase", typemap_lookup_type, WARN_NONE); - const String *pure_interfaces = typemapLookup("csinterfaces", typemap_lookup_type, WARN_NONE); + const String *pure_baseclass = typemapLookup(n, "csbase", typemap_lookup_type, WARN_NONE); + const String *pure_interfaces = typemapLookup(n, "csinterfaces", typemap_lookup_type, WARN_NONE); // Class attributes - const String *csattributes = typemapLookup("csattributes", typemap_lookup_type, WARN_NONE); + const String *csattributes = typemapLookup(n, "csattributes", typemap_lookup_type, WARN_NONE); if (csattributes && *Char(csattributes)) Printf(enum_code, "%s\n", csattributes); // Emit the enum - Printv(enum_code, typemapLookup("csclassmodifiers", typemap_lookup_type, WARN_CSHARP_TYPEMAP_CLASSMOD_UNDEF), // Class modifiers (enum modifiers really) + Printv(enum_code, typemapLookup(n, "csclassmodifiers", typemap_lookup_type, WARN_CSHARP_TYPEMAP_CLASSMOD_UNDEF), // Class modifiers (enum modifiers really) " ", symname, (*Char(pure_baseclass) || *Char(pure_interfaces)) ? " : " : "", pure_baseclass, ((*Char(pure_baseclass)) && *Char(pure_interfaces)) ? // Interfaces ", " : "", pure_interfaces, " {\n", NIL); } else { @@ -1140,8 +1140,8 @@ // Wrap (non-anonymous) C/C++ enum within a typesafe, typeunsafe or proper C# enum // Finish the enum declaration // Typemaps are used to generate the enum definition in a similar manner to proxy classes. - Printv(enum_code, (enum_feature == ProperEnum) ? "\n" : typemapLookup("csbody", typemap_lookup_type, WARN_CSHARP_TYPEMAP_CSBODY_UNDEF), // main body of class - typemapLookup("cscode", typemap_lookup_type, WARN_NONE), // extra C# code + Printv(enum_code, (enum_feature == ProperEnum) ? "\n" : typemapLookup(n, "csbody", typemap_lookup_type, WARN_CSHARP_TYPEMAP_CSBODY_UNDEF), // main body of class + typemapLookup(n, "cscode", typemap_lookup_type, WARN_NONE), // extra C# code "}", NIL); Replaceall(enum_code, "$csclassname", symname); @@ -1177,7 +1177,7 @@ addOpenNamespace(namespce, f_enum); - Printv(f_enum, typemapLookup("csimports", typemap_lookup_type, WARN_NONE), // Import statements + Printv(f_enum, typemapLookup(n, "csimports", typemap_lookup_type, WARN_NONE), // Import statements "\n", enum_code, "\n", NIL); addCloseNamespace(namespce, f_enum); @@ -1243,7 +1243,7 @@ // Wrap C/C++ enums with constant integers or use the typesafe enum pattern const String *parent_name = Getattr(parentNode(n), "name"); String *typemap_lookup_type = parent_name ? Copy(parent_name) : NewString("int"); - const String *tm = typemapLookup("cstype", typemap_lookup_type, WARN_CSHARP_TYPEMAP_CSTYPE_UNDEF); + const String *tm = typemapLookup(n, "cstype", typemap_lookup_type, WARN_CSHARP_TYPEMAP_CSTYPE_UNDEF); String *return_type = Copy(tm); Delete(typemap_lookup_type); typemap_lookup_type = NULL; @@ -1490,12 +1490,12 @@ String *c_baseclass = NULL; String *baseclass = NULL; String *c_baseclassname = NULL; - String *typemap_lookup_type = Getattr(n, "classtypeobj"); + SwigType *typemap_lookup_type = Getattr(n, "classtypeobj"); bool feature_director = Swig_directorclass(n) ? true : false; // Inheritance from pure C# classes Node *attributes = NewHash(); - const String *pure_baseclass = typemapLookup("csbase", typemap_lookup_type, WARN_NONE, attributes); + const String *pure_baseclass = typemapLookup(n, "csbase", typemap_lookup_type, WARN_NONE, attributes); bool purebase_replace = GetFlag(attributes, "tmap:csbase:replace") ? true : false; bool purebase_notderived = GetFlag(attributes, "tmap:csbase:notderived") ? true : false; Delete(attributes); @@ -1549,21 +1549,21 @@ } // Pure C# interfaces - const String *pure_interfaces = typemapLookup(derived ? "csinterfaces_derived" : "csinterfaces", typemap_lookup_type, WARN_NONE); + const String *pure_interfaces = typemapLookup(n, derived ? "csinterfaces_derived" : "csinterfaces", typemap_lookup_type, WARN_NONE); // Start writing the proxy class - Printv(proxy_class_def, typemapLookup("csimports", typemap_lookup_type, WARN_NONE), // Import statements + Printv(proxy_class_def, typemapLookup(n, "csimports", typemap_lookup_type, WARN_NONE), // Import statements "\n", NIL); // Class attributes - const String *csattributes = typemapLookup("csattributes", typemap_lookup_type, WARN_NONE); + const String *csattributes = typemapLookup(n, "csattributes", typemap_lookup_type, WARN_NONE); if (csattributes && *Char(csattributes)) Printf(proxy_class_def, "%s\n", csattributes); - Printv(proxy_class_def, typemapLookup("csclassmodifiers", typemap_lookup_type, WARN_CSHARP_TYPEMAP_CLASSMOD_UNDEF), // Class modifiers + Printv(proxy_class_def, typemapLookup(n, "csclassmodifiers", typemap_lookup_type, WARN_CSHARP_TYPEMAP_CLASSMOD_UNDEF), // Class modifiers " $csclassname", // Class name and base class (*Char(wanted_base) || *Char(pure_interfaces)) ? " : " : "", wanted_base, (*Char(wanted_base) && *Char(pure_interfaces)) ? // Interfaces - ", " : "", pure_interfaces, " {", derived ? typemapLookup("csbody_derived", typemap_lookup_type, WARN_CSHARP_TYPEMAP_CSBODY_UNDEF) : // main body of class - typemapLookup("csbody", typemap_lookup_type, WARN_CSHARP_TYPEMAP_CSBODY_UNDEF), // main body of class + ", " : "", pure_interfaces, " {", derived ? typemapLookup(n, "csbody_derived", typemap_lookup_type, WARN_CSHARP_TYPEMAP_CSBODY_UNDEF) : // main body of class + typemapLookup(n, "csbody", typemap_lookup_type, WARN_CSHARP_TYPEMAP_CSBODY_UNDEF), // main body of class NIL); // C++ destructor is wrapped by the Dispose method @@ -1574,11 +1574,11 @@ String *destruct_methodname = NULL; String *destruct_methodmodifiers = NULL; if (derived) { - tm = typemapLookup("csdestruct_derived", typemap_lookup_type, WARN_NONE, attributes); + tm = typemapLookup(n, "csdestruct_derived", typemap_lookup_type, WARN_NONE, attributes); destruct_methodname = Getattr(attributes, "tmap:csdestruct_derived:methodname"); destruct_methodmodifiers = Getattr(attributes, "tmap:csdestruct_derived:methodmodifiers"); } else { - tm = typemapLookup("csdestruct", typemap_lookup_type, WARN_NONE, attributes); + tm = typemapLookup(n, "csdestruct", typemap_lookup_type, WARN_NONE, attributes); destruct_methodname = Getattr(attributes, "tmap:csdestruct:methodname"); destruct_methodmodifiers = Getattr(attributes, "tmap:csdestruct:methodmodifiers"); } @@ -1595,7 +1595,7 @@ if (tm) { // Finalize method if (*Char(destructor_call)) { - Printv(proxy_class_def, typemapLookup("csfinalize", typemap_lookup_type, WARN_NONE), NIL); + Printv(proxy_class_def, typemapLookup(n, "csfinalize", typemap_lookup_type, WARN_NONE), NIL); } // Dispose method Printv(destruct, tm, NIL); @@ -1690,7 +1690,7 @@ Delete(destruct); // Emit extra user code - Printv(proxy_class_def, typemapLookup("cscode", typemap_lookup_type, WARN_NONE), // extra C# code + Printv(proxy_class_def, typemapLookup(n, "cscode", typemap_lookup_type, WARN_NONE), // extra C# code "\n", NIL); // Substitute various strings into the above template @@ -2355,7 +2355,7 @@ /* Insert the csconstruct typemap, doing the replacement for $directorconnect, as needed */ Hash *attributes = NewHash(); - String *construct_tm = Copy(typemapLookup("csconstruct", Getattr(n, "name"), + String *construct_tm = Copy(typemapLookup(n, "csconstruct", Getattr(n, "name"), WARN_CSHARP_TYPEMAP_CSCONSTRUCT_UNDEF, attributes)); if (construct_tm) { if (!feature_director) { @@ -2972,6 +2972,10 @@ * ----------------------------------------------------------------------------- */ void emitTypeWrapperClass(String *classname, SwigType *type) { + Node *n = NewHash(); + Setfile(n, input_file); + Setline(n, line_number); + String *swigtype = NewString(""); String *filen = NewStringf("%s%s.cs", SWIG_output_directory(), classname); File *f_swigtype = NewFile(filen, "w", SWIG_output_files()); @@ -2989,23 +2993,23 @@ addOpenNamespace(namespce, f_swigtype); // Pure C# baseclass and interfaces - const String *pure_baseclass = typemapLookup("csbase", type, WARN_NONE); - const String *pure_interfaces = typemapLookup("csinterfaces", type, WARN_NONE); + const String *pure_baseclass = typemapLookup(n, "csbase", type, WARN_NONE); + const String *pure_interfaces = typemapLookup(n, "csinterfaces", type, WARN_NONE); // Emit the class - Printv(swigtype, typemapLookup("csimports", type, WARN_NONE), // Import statements + Printv(swigtype, typemapLookup(n, "csimports", type, WARN_NONE), // Import statements "\n", NIL); // Class attributes - const String *csattributes = typemapLookup("csattributes", type, WARN_NONE); + const String *csattributes = typemapLookup(n, "csattributes", type, WARN_NONE); if (csattributes && *Char(csattributes)) Printf(swigtype, "%s\n", csattributes); - Printv(swigtype, typemapLookup("csclassmodifiers", type, WARN_CSHARP_TYPEMAP_CLASSMOD_UNDEF), // Class modifiers + Printv(swigtype, typemapLookup(n, "csclassmodifiers", type, WARN_CSHARP_TYPEMAP_CLASSMOD_UNDEF), // Class modifiers " $csclassname", // Class name and base class (*Char(pure_baseclass) || *Char(pure_interfaces)) ? " : " : "", pure_baseclass, ((*Char(pure_baseclass)) && *Char(pure_interfaces)) ? // Interfaces - ", " : "", pure_interfaces, " {", typemapLookup("csbody", type, WARN_CSHARP_TYPEMAP_CSBODY_UNDEF), // main body of class - typemapLookup("cscode", type, WARN_NONE), // extra C# code + ", " : "", pure_interfaces, " {", typemapLookup(n, "csbody", type, WARN_CSHARP_TYPEMAP_CSBODY_UNDEF), // main body of class + typemapLookup(n, "cscode", type, WARN_NONE), // extra C# code "}\n", NIL); Replaceall(swigtype, "$csclassname", classname); @@ -3019,29 +3023,34 @@ Close(f_swigtype); Delete(swigtype); + Delete(n); } /* ----------------------------------------------------------------------------- * typemapLookup() + * n - for input only and must contain info for Getfile(n) and Getline(n) to work + * op - typemap method name + * type - typemap type to lookup + * warning - warning number to issue if no typemaps found + * typemap_attributes - the typemap attributes are attached to this node and will + * also be used for temporary storage if non null + * return is never NULL, unlike Swig_typemap_lookup() * ----------------------------------------------------------------------------- */ - const String *typemapLookup(const String *op, String *type, int warning, Node *typemap_attributes = NULL) { - String *tm = NULL; - const String *code = NULL; - - if ((tm = Swig_typemap_search(op, type, NULL, NULL))) { - code = Getattr(tm, "code"); - if (typemap_attributes) - Swig_typemap_attach_kwargs(tm, op, typemap_attributes); - } - - if (!code) { - code = empty_string; + const String *typemapLookup(Node *n, const_String_or_char_ptr op, SwigType *type, int warning, Node *typemap_attributes = 0) { + Node *node = !typemap_attributes ? NewHash() : typemap_attributes; + Setattr(node, "type", type); + Setfile(node, Getfile(n)); + Setline(node, Getline(n)); + const String *tm = Swig_typemap_lookup(op, node, "", 0); + if (!tm) { + tm = empty_string; if (warning != WARN_NONE) - Swig_warning(warning, input_file, line_number, "No %s typemap defined for %s\n", op, type); + Swig_warning(warning, Getfile(n), Getline(n), "No %s typemap defined for %s\n", op, SwigType_str(type, 0)); } - - return code ? code : empty_string; + if (!typemap_attributes) + Delete(node); + return tm; } /* ----------------------------------------------------------------------------- @@ -3820,7 +3829,7 @@ Node *disconn_attr = NewHash(); String *disconn_methodname = NULL; - disconn_tm = typemapLookup("directordisconnect", full_classname, WARN_NONE, disconn_attr); + disconn_tm = typemapLookup(n, "directordisconnect", full_classname, WARN_NONE, disconn_attr); disconn_methodname = Getattr(disconn_attr, "tmap:directordisconnect:methodname"); Printv(w->code, "}\n", NIL); Modified: trunk/Source/Modules/java.cxx =================================================================== --- trunk/Source/Modules/java.cxx 2009-07-08 10:24:31 UTC (rev 11379) +++ trunk/Source/Modules/java.cxx 2009-07-08 12:17:45 UTC (rev 11380) @@ -1171,11 +1171,11 @@ // Wrap (non-anonymous) C/C++ enum within a typesafe, typeunsafe or proper Java enum // Pure Java baseclass and interfaces - const String *pure_baseclass = typemapLookup("javabase", typemap_lookup_type, WARN_NONE); - const String *pure_interfaces = typemapLookup("javainterfaces", typemap_lookup_type, WARN_NONE); + const String *pure_baseclass = typemapLookup(n, "javabase", typemap_lookup_type, WARN_NONE); + const String *pure_interfaces = typemapLookup(n, "javainterfaces", typemap_lookup_type, WARN_NONE); // Emit the enum - Printv(enum_code, typemapLookup("javaclassmodifiers", typemap_lookup_type, WARN_JAVA_TYPEMAP_CLASSMOD_UNDEF), // Class modifiers (enum modifiers really) + Printv(enum_code, typemapLookup(n, "javaclassmodifiers", typemap_lookup_type, WARN_JAVA_TYPEMAP_CLASSMOD_UNDEF), // Class modifiers (enum modifiers really) " ", symname, *Char(pure_baseclass) ? // Bases " extends " : "", pure_baseclass, *Char(pure_interfaces) ? // Interfaces " implements " : "", pure_interfaces, " {\n", NIL); @@ -1196,8 +1196,8 @@ // Wrap (non-anonymous) C/C++ enum within a typesafe, typeunsafe or proper Java enum // Finish the enum declaration // Typemaps are used to generate the enum definition in a similar manner to proxy classes. - Printv(enum_code, (enum_feature == ProperEnum) ? ";\n" : "", typemapLookup("javabody", typemap_lookup_type, WARN_JAVA_TYPEMAP_JAVABODY_UNDEF), // main body of class - typemapLookup("javacode", typemap_lookup_type, WARN_NONE), // extra Java code + Printv(enum_code, (enum_feature == ProperEnum) ? ";\n" : "", typemapLookup(n, "javabody", typemap_lookup_type, WARN_JAVA_TYPEMAP_JAVABODY_UNDEF), // main body of class + typemapLookup(n, "javacode", typemap_lookup_type, WARN_NONE), // extra Java code "}", NIL); Replaceall(enum_code, "$javaclassname", symname); @@ -1234,7 +1234,7 @@ if (Len(package) > 0) Printf(f_enum, "package %s;\n", package); - Printv(f_enum, typemapLookup("javaimports", typemap_lookup_type, WARN_NONE), // Import statements + Printv(f_enum, typemapLookup(n, "javaimports", typemap_lookup_type, WARN_NONE), // Import statements "\n", enum_code, "\n", NIL); Printf(f_enum, "\n"); @@ -1295,7 +1295,7 @@ // Wrap C/C++ enums with constant integers or use the typesafe enum pattern const String *parent_name = Getattr(parentNode(n), "name"); String *typemap_lookup_type = parent_name ? Copy(parent_name) : NewString("int"); - const String *tm = typemapLookup("jstype", typemap_lookup_type, WARN_JAVA_TYPEMAP_JSTYPE_UNDEF); + const String *tm = typemapLookup(n, "jstype", typemap_lookup_type, WARN_JAVA_TYPEMAP_JSTYPE_UNDEF); String *return_type = Copy(tm); Delete(typemap_lookup_type); typemap_lookup_type = NULL; @@ -1560,12 +1560,12 @@ String *c_baseclass = NULL; String *baseclass = NULL; String *c_baseclassname = NULL; - String *typemap_lookup_type = Getattr(n, "classtypeobj"); + SwigType *typemap_lookup_type = Getattr(n, "classtypeobj"); bool feature_director = Swig_directorclass(n) ? true : false; // Inheritance from pure Java classes Node *attributes = NewHash(); - const String *pure_baseclass = typemapLookup("javabase", typemap_lookup_type, WARN_NONE, attributes); + const String *pure_baseclass = typemapLookup(n, "javabase", typemap_lookup_type, WARN_NONE, attributes); bool purebase_replace = GetFlag(attributes, "tmap:javabase:replace") ? true : false; bool purebase_notderived = GetFlag(attributes, "tmap:javabase:notderived") ? true : false; Delete(attributes); @@ -1619,15 +1619,15 @@ } // Pure Java interfaces - const String *pure_interfaces = typemapLookup("javainterfaces", typemap_lookup_type, WARN_NONE); + const String *pure_interfaces = typemapLookup(n, "javainterfaces", typemap_lookup_type, WARN_NONE); // Start writing the proxy class - Printv(proxy_class_def, typemapLookup("javaimports", typemap_lookup_type, WARN_NONE), // Import statements - "\n", typemapLookup("javaclassmodifiers", typemap_lookup_type, WARN_JAVA_TYPEMAP_CLASSMOD_UNDEF), // Class modifiers + Printv(proxy_class_def, typemapLookup(n, "javaimports", typemap_lookup_type, WARN_NONE), // Import statements + "\n", typemapLookup(n, "javaclassmodifiers", typemap_lookup_type, WARN_JAVA_TYPEMAP_CLASSMOD_UNDEF), // Class modifiers " $javaclassname", // Class name and bases (*Char(wanted_base)) ? " extends " : "", wanted_base, *Char(pure_interfaces) ? // Pure Java interfaces - " implements " : "", pure_interfaces, " {", derived ? typemapLookup("javabody_derived", typemap_lookup_type, WARN_JAVA_TYPEMAP_JAVABODY_UNDEF) : // main body of class - typemapLookup("javabody", typemap_lookup_type, WARN_JAVA_TYPEMAP_JAVABODY_UNDEF), // main body of class + " implements " : "", pure_interfaces, " {", derived ? typemapLookup(n, "javabody_derived", typemap_lookup_type, WARN_JAVA_TYPEMAP_JAVABODY_UNDEF) : // main body of class + typemapLookup(n, "javabody", typemap_lookup_type, WARN_JAVA_TYPEMAP_JAVABODY_UNDEF), // main body of class NIL); // C++ destructor is wrapped by the delete method @@ -1638,11 +1638,11 @@ String *destruct_methodname = NULL; String *destruct_methodmodifiers = NULL; if (derived) { - tm = typemapLookup("javadestruct_derived", typemap_lookup_type, WARN_NONE, attributes); + tm = typemapLookup(n, "javadestruct_derived", typemap_lookup_type, WARN_NONE, attributes); destruct_methodname = Getattr(attributes, "tmap:javadestruct_derived:methodname"); destruct_methodmodifiers = Getattr(attributes, "tmap:javadestruct_derived:methodmodifiers"); } else { - tm = typemapLookup("javadestruct", typemap_lookup_type, WARN_NONE, attributes); + tm = typemapLookup(n, "javadestruct", typemap_lookup_type, WARN_NONE, attributes); destruct_methodname = Getattr(attributes, "tmap:javadestruct:methodname"); destruct_methodmodifiers = Getattr(attributes, "tmap:javadestruct:methodmodifiers"); } @@ -1660,7 +1660,7 @@ if (tm) { // Finalize method if (*Char(destructor_call)) { - Printv(proxy_class_def, typemapLookup("javafinalize", typemap_lookup_type, WARN_NONE), NIL); + Printv(proxy_class_def, typemapLookup(n, "javafinalize", typemap_lookup_type, WARN_NONE), NIL); } // delete method Printv(destruct, tm, NIL); @@ -1681,9 +1681,9 @@ release_jnicall = NewStringf("%s.%s_change_ownership(this, swigCPtr, false)", imclass_name, proxy_class_name); take_jnicall = NewStringf("%s.%s_change_ownership(this, swigCPtr, true)", imclass_name, proxy_class_name); - emitCodeTypemap(false, typemap_lookup_type, "directordisconnect", "methodname", destruct_jnicall); - emitCodeTypemap(false, typemap_lookup_type, "directorowner_release", "methodname", release_jnicall); - emitCodeTypemap(false, typemap_lookup_type, "directorowner_take", "methodname", take_jnicall); + emitCodeTypemap(n, false, typemap_lookup_type, "directordisconnect", "methodname", destruct_jnicall); + emitCodeTypemap(n, false, typemap_lookup_type, "directorowner_release", "methodname", release_jnicall); + emitCodeTypemap(n, false, typemap_lookup_type, "directorowner_take", "methodname", take_jnicall); Delete(destruct_jnicall); Delete(release_jnicall); @@ -1694,7 +1694,7 @@ Delete(destruct); // Emit extra user code - Printv(proxy_class_def, typemapLookup("javacode", typemap_lookup_type, WARN_NONE), // extra Java code + Printv(proxy_class_def, typemapLookup(n, "javacode", typemap_lookup_type, WARN_NONE), // extra Java code "\n", NIL); // Substitute various strings into the above template @@ -2285,7 +2285,7 @@ /* Insert the javaconstruct typemap, doing the replacement for $directorconnect, as needed */ Hash *attributes = NewHash(); - String *construct_tm = Copy(typemapLookup("javaconstruct", Getattr(n, "name"), + String *construct_tm = Copy(typemapLookup(n, "javaconstruct", Getattr(n, "name"), WARN_JAVA_TYPEMAP_JAVACONSTRUCT_UNDEF, attributes)); if (construct_tm) { if (!feature_director) { @@ -2815,6 +2815,10 @@ * ----------------------------------------------------------------------------- */ void emitTypeWrapperClass(String *classname, SwigType *type) { + Node *n = NewHash(); + Setfile(n, input_file); + Setline(n, line_number); + String *swigtype = NewString(""); String *filen = NewStringf("%s%s.java", SWIG_output_directory(), classname); File *f_swigtype = NewFile(filen, "w", SWIG_output_files()); @@ -2833,16 +2837,16 @@ Printf(f_swigtype, "package %s;\n", package); // Pure Java baseclass and interfaces - const String *pure_baseclass = typemapLookup("javabase", type, WARN_NONE); - const String *pure_interfaces = typemapLookup("javainterfaces", type, WARN_NONE); + const String *pure_baseclass = typemapLookup(n, "javabase", type, WARN_NONE); + const String *pure_interfaces = typemapLookup(n, "javainterfaces", type, WARN_NONE); // Emit the class - Printv(swigtype, typemapLookup("javaimports", type, WARN_NONE), // Import statements - "\n", typemapLookup("javaclassmodifiers", type, WARN_JAVA_TYPEMAP_CLASSMOD_UNDEF), // Class modifiers + Printv(swigtype, typemapLookup(n, "javaimports", type, WARN_NONE), // Import statements + "\n", typemapLookup(n, "javaclassmodifiers", type, WARN_JAVA_TYPEMAP_CLASSMOD_UNDEF), // Class modifiers " $javaclassname", // Class name and bases *Char(pure_baseclass) ? " extends " : "", pure_baseclass, *Char(pure_interfaces) ? // Interfaces - " implements " : "", pure_interfaces, " {", typemapLookup("javabody", type, WARN_JAVA_TYPEMAP_JAVABODY_UNDEF), // main body of class - typemapLookup("javacode", type, WARN_NONE), // extra Java code + " implements " : "", pure_interfaces, " {", typemapLookup(n, "javabody", type, WARN_JAVA_TYPEMAP_JAVABODY_UNDEF), // main body of class + typemapLookup(n, "javacode", type, WARN_NONE), // extra Java code "}\n", "\n", NIL); Replaceall(swigtype, "$javaclassname", classname); @@ -2852,29 +2856,34 @@ Close(f_swigtype); Delete(swigtype); + Delete(n); } /* ----------------------------------------------------------------------------- * typemapLookup() + * n - for input only and must contain info for Getfile(n) and Getline(n) to work + * op - typemap method name + * type - typemap type to lookup + * warning - warning number to issue if no typemaps found + * typemap_attributes - the typemap attributes are attached to this node and will + * also be used for temporary storage if non null + * return is never NULL, unlike Swig_typemap_lookup() * ----------------------------------------------------------------------------- */ - const String *typemapLookup(const String *op, String *type, int warning, Node *typemap_attributes = NULL) { - String *tm = NULL; - const String *code = NULL; - - if ((tm = Swig_typemap_search(op, type, NULL, NULL))) { - code = Getattr(tm, "code"); - if (typemap_attributes) - Swig_typemap_attach_kwargs(tm, op, typemap_attributes); - } - - if (!code) { - code = empty_string; + const String *typemapLookup(Node *n, const_String_or_char_ptr op, SwigType *type, int warning, Node *typemap_attributes = 0) { + Node *node = !typemap_attributes ? NewHash() : typemap_attributes; + Setattr(node, "type", type); + Setfile(node, Getfile(n)); + Setline(node, Getline(n)); + const String *tm = Swig_typemap_lookup(op, node, "", 0); + if (!tm) { + tm = empty_string; if (warning != WARN_NONE) - Swig_warning(warning, input_file, line_number, "No %s typemap defined for %s\n", op, type); + Swig_warning(warning, Getfile(n), Getline(n), "No %s typemap defined for %s\n", op, SwigType_str(type, 0)); } - - return code ? code : empty_string; + if (!typemap_attributes) + Delete(node); + return tm; } /* ----------------------------------------------------------------------------- @@ -3183,8 +3192,7 @@ * typemaps. *--------------------------------------------------------------------*/ - void - emitCodeTypemap(bool derived, String *lookup_type, const String *typemap, const String *methodname, const String *jnicall) { + void emitCodeTypemap(Node *n, bool derived, SwigType *lookup_type, const String *typemap, const String *methodname, const String *jnicall) { const String *tm = NULL; Node *tmattrs = NewHash(); String *lookup_tmname = NewString(typemap); @@ -3195,7 +3203,7 @@ Append(lookup_tmname, "_derived"); } - tm = typemapLookup(lookup_tmname, lookup_type, WARN_NONE, tmattrs); + tm = typemapLookup(n, lookup_tmname, lookup_type, WARN_NONE, tmattrs); method_attr_name = NewStringf("tmap:%s:%s", lookup_tmname, methodname); method_attr = Getattr(tmattrs, method_attr_name); @@ -3979,7 +3987,7 @@ Node *disconn_attr = NewHash(); String *disconn_methodname = NULL; - disconn_tm = typemapLookup("directordisconnect", full_classname, WARN_NONE, disconn_attr); + disconn_tm = typemapLookup(n, "directordisconnect", full_classname, WARN_NONE, disconn_attr); disconn_methodname = Getattr(disconn_attr, "tmap:directordisconnect:methodname"); Printv(w->code, " swig_disconnect_director_self(\"", disconn_methodname, "\");\n", "}\n", NIL); Modified: trunk/Source/Modules/modula3.cxx =================================================================== --- trunk/Source/Modules/modula3.cxx 2009-07-08 10:24:31 UTC (rev 11379) +++ trunk/Source/Modules/modula3.cxx 2009-07-08 12:17:45 UTC (rev 11380) @@ -2230,23 +2230,23 @@ baseclass = NewString(""); // Inheritance from pure Modula 3 classes - const String *pure_baseclass = typemapLookup("m3base", classDeclarationName, WARN_NONE); + const String *pure_baseclass = typemapLookup(n, "m3base", classDeclarationName, WARN_NONE); if (hasContent(pure_baseclass) && hasContent(baseclass)) { Swig_warning(WARN_MODULA3_MULTIPLE_INHERITANCE, input_file, line_number, "Warning for %s proxy: Base %s ignored. Multiple inheritance is not supported in Modula 3.\n", classDeclarationName, pure_baseclass); } // Pure Modula 3 interfaces - const String *pure_interfaces = typemapLookup(derived ? "m3interfaces_derived" : "m3interfaces", + const String *pure_interfaces = typemapLookup(n, derived ? "m3interfaces_derived" : "m3interfaces", classDeclarationName, WARN_NONE); // Start writing the proxy class - Printv(proxy_class_def, typemapLookup("m3imports", classDeclarationName, WARN_NONE), // Import statements - "\n", typemapLookup("m3classmodifiers", classDeclarationName, WARN_MODULA3_TYPEMAP_CLASSMOD_UNDEF), // Class modifiers + Printv(proxy_class_def, typemapLookup(n, "m3imports", classDeclarationName, WARN_NONE), // Import statements + "\n", typemapLookup(n, "m3classmodifiers", classDeclarationName, WARN_MODULA3_TYPEMAP_CLASSMOD_UNDEF), // Class modifiers " class $m3classname", // Class name and bases (derived || *Char(pure_baseclass) || *Char(pure_interfaces)) ? " : " : "", baseclass, pure_baseclass, ((derived || *Char(pure_baseclass)) && *Char(pure_interfaces)) ? // Interfaces ", " : "", pure_interfaces, " {\n", " private IntPtr swigCPtr;\n", // Member variables for memory handling - derived ? "" : " protected bool swigCMemOwn;\n", "\n", " ", typemapLookup("m3ptrconstructormodifiers", classDeclarationName, WARN_MODULA3_TYPEMAP_PTRCONSTMOD_UNDEF), // pointer constructor modifiers + derived ? "" : " protected bool swigCMemOwn;\n", "\n", " ", typemapLookup(n, "m3ptrconstructormodifiers", classDeclarationName, WARN_MODULA3_TYPEMAP_PTRCONSTMOD_UNDEF), // pointer constructor modifiers " $m3classname(IntPtr cPtr, bool cMemoryOwn) ", // Constructor used for wrapping pointers derived ? ": base($imclassname.$m3classnameTo$baseclass(cPtr), cMemoryOwn) {\n" @@ -2262,10 +2262,10 @@ Node *attributes = NewHash(); String *destruct_methodname = NULL; if (derived) { - tm = typemapLookup("m3destruct_derived", classDeclarationName, WARN_NONE, attributes); + tm = typemapLookup(n, "m3destruct_derived", classDeclarationName, WARN_NONE, attributes); destruct_methodname = Getattr(attributes, "tmap:m3destruct_derived:methodname"); } else { - tm = typemapLookup("m3destruct", classDeclarationName, WARN_NONE, attributes); + tm = typemapLookup(n, "m3destruct", classDeclarationName, WARN_NONE, attributes); destruct_methodname = Getattr(attributes, "tmap:m3destruct:methodname"); } if (!destruct_methodname) { @@ -2275,7 +2275,7 @@ if (tm) { // Finalize method if (*Char(destructor_call)) { - Printv(proxy_class_def, typemapLookup("m3finalize", classDeclarationName, WARN_NONE), NIL); + Printv(proxy_class_def, typemapLookup(n, "m3finalize", classDeclarationName, WARN_NONE), NIL); } // Dispose method Printv(destruct, tm, NIL); @@ -2290,8 +2290,8 @@ Delete(destruct); // Emit various other methods - Printv(proxy_class_def, typemapLookup("m3getcptr", classDeclarationName, WARN_MODULA3_TYPEMAP_GETCPTR_UNDEF), // getCPtr method - typemapLookup("m3code", classDeclarationName, WARN_NONE), // extra Modula 3 code + Printv(proxy_class_def, typemapLookup(n, "m3getcptr", classDeclarationName, WARN_MODULA3_TYPEMAP_GETCPTR_UNDEF), // getCPtr method + typemapLookup(n, "m3code", classDeclarationName, WARN_NONE), // extra Modula 3 code "\n", NIL); // Substitute various strings into the above template @@ -3765,6 +3765,10 @@ * ----------------------------------------------------------------------------- */ void emitTypeWrapperClass(String *classname, SwigType *type) { + Node *n = NewHash(); + Setfile(n, input_file); + Setline(n, line_number); + String *filen = NewStringf("%s%s.m3", Swig_file_dirname(outfile), classname); File *f_swigtype = NewFile(filen, "w", SWIG_output_files()); if (!f_swigtype) { @@ -3777,19 +3781,19 @@ emitBanner(f_swigtype); // Pure Modula 3 baseclass and interfaces - const String *pure_baseclass = typemapLookup("m3base", type, WARN_NONE); - const String *pure_interfaces = typemapLookup("m3interfaces", type, WARN_NONE); + const String *pure_baseclass = typemapLookup(n, "m3base", type, WARN_NONE); + const String *pure_interfaces = typemapLookup(n, "m3interfaces", type, WARN_NONE); // Emit the class - Printv(swigtype, typemapLookup("m3imports", type, WARN_NONE), // Import statements - "\n", typemapLookup("m3classmodifiers", type, WARN_MODULA3_TYPEMAP_CLASSMOD_UNDEF), // Class modifiers + Printv(swigtype, typemapLookup(n, "m3imports", type, WARN_NONE), // Import statements + "\n", typemapLookup(n, "m3classmodifiers", type, WARN_MODULA3_TYPEMAP_CLASSMOD_UNDEF), // Class modifiers " class $m3classname", // Class name and bases *Char(pure_baseclass) ? " : " : "", pure_baseclass, *Char(pure_interfaces) ? // Interfaces - " : " : "", pure_interfaces, " {\n", " private IntPtr swigCPtr;\n", "\n", " ", typemapLookup("m3ptrconstructormodifiers", type, WARN_MODULA3_TYPEMAP_PTRCONSTMOD_UNDEF), // pointer constructor modifiers + " : " : "", pure_interfaces, " {\n", " private IntPtr swigCPtr;\n", "\n", " ", typemapLookup(n, "m3ptrconstructormodifiers", type, WARN_MODULA3_TYPEMAP_PTRCONSTMOD_UNDEF), // pointer constructor modifiers " $m3classname(IntPtr cPtr, bool bFutureUse) {\n", // Constructor used for wrapping pointers " swigCPtr = cPtr;\n", " }\n", "\n", " protected $m3classname() {\n", // Default constructor - " swigCPtr = IntPtr.Zero;\n", " }\n", typemapLookup("m3getcptr", type, WARN_MODULA3_TYPEMAP_GETCPTR_UNDEF), // getCPtr method - typemapLookup("m3code", type, WARN_NONE), // extra Modula 3 code + " swigCPtr = IntPtr.Zero;\n", " }\n", typemapLookup(n, "m3getcptr", type, WARN_MODULA3_TYPEMAP_GETCPTR_UNDEF), // getCPtr method + typemapLookup(n, "m3code", type, WARN_NONE), // extra Modula 3 code "}\n", "\n", NIL); Replaceall(swigtype, "$m3classname", classname); @@ -3802,25 +3806,29 @@ /* ----------------------------------------------------------------------------- * typemapLookup() + * n - for input only and must contain info for Getfile(n) and Getline(n) to work + * op - typemap method name + * type - typemap type to lookup + * warning - warning number to issue if no typemaps found + * typemap_attributes - the typemap attributes are attached to this node and will + * also be used for temporary storage if non null + * return is never NULL, unlike Swig_typemap_lookup() * ----------------------------------------------------------------------------- */ - const String *typemapLookup(const String *op, String *type, int warning, Node *typemap_attributes = NULL) { - String *tm = NULL; - const String *code = NULL; - - if ((tm = Swig_typemap_search(op, type, NULL, NULL))) { - code = Getattr(tm, "code"); - if (typemap_attributes) - Swig_typemap_attach_kwargs(tm, op, typemap_attributes); - } - - if (!code) { - code = empty_string; + const String *typemapLookup(Node *n, const_String_or_char_ptr op, SwigType *type, int warning, Node *typemap_attributes = 0) { + Node *node = !typemap_attributes ? NewHash() : typemap_attributes; + Setattr(node, "type", type); + Setfile(node, Getfile(n)); + Setline(node, Getline(n)); + const String *tm = Swig_typemap_lookup(op, node, "", 0); + if (!tm) { + tm = empty_string; if (warning != WARN_NONE) - Swig_warning(warning, input_file, line_number, "No %s typemap defined for %s\n", op, type); + Swig_warning(warning, Getfile(n), Getline(n), "No %s typemap defined for %s\n", op, SwigType_str(type, 0)); } - - return code ? code : empty_string; + if (!typemap_attributes) + Delete(node); + return tm; } /* ----------------------------------------------------------------------------- Modified: trunk/Source/Modules/uffi.cxx =================================================================== --- trunk/Source/Modules/uffi.cxx 2009-07-08 10:24:31 UTC (rev 11379) +++ trunk/Source/Modules/uffi.cxx 2009-07-08 12:17:45 UTC (rev 11380) @@ -131,11 +131,17 @@ } -static String *get_ffi_type(SwigType *ty, const_String_or_char_ptr name) { - Hash *typemap = Swig_typemap_search("ffitype", ty, name, 0); - if (typemap) { - String *typespec = Getattr(typemap, "code"); - return NewString(typespec); +static String *get_ffi_type(Node *n, SwigType *ty, const_String_or_char_ptr name) { + Node *node = NewHash(); + Setattr(node, "type", ty); + Setattr(node, "name", name); + Setfile(node, Getfile(n)); + Setline(node, Getline(n)); + const String *tm = Swig_typemap_lookup("ffitype", node, "", 0); + Delete(node); + + if (tm) { + return NewString(tm); } else { SwigType *tr = SwigType_typedef_resolve_all(ty); char *type_reduced = Char(tr); @@ -167,14 +173,16 @@ return 0; } -static String *get_lisp_type(SwigType *ty, const_String_or_char_ptr name) { - Hash *typemap = Swig_typemap_search("lisptype", ty, name, 0); - if (typemap) { - String *typespec = Getattr(typemap, "code"); - return NewString(typespec); - } else { - return NewString(""); - } +static String *get_lisp_type(Node *n, SwigType *ty, const_String_or_char_ptr name) { + Node *node = NewHash(); + Setattr(node, "type", ty); + Setattr(node, "name", name); + Setfile(node, Getfile(n)); + Setline(node, Getline(n)); + const String *tm = Swig_typemap_lookup("lisptype", node, "", 0); + Delete(node); + + return tm ? NewString(tm) : NewString(""); } void UFFI::main(int argc, char *argv[]) { @@ -280,8 +288,8 @@ for (p = pl; p; p = nextSibling(p), argnum++) { String *argname = Getattr(p, "name"); SwigType *argtype = Getattr(p, "type"); - String *ffitype = get_ffi_type(argtype, argname); - String *lisptype = get_lisp_type(argtype, argname); + String *ffitype = get_ffi_type(n, argtype, argname); + String *lisptype = get_lisp_type(n, argtype, argname); int tempargname = 0; if (!argname) { @@ -307,7 +315,7 @@ //" :strings-convert t\n" //" :call-direct %s\n" //" :optimize-for-space t" - ")\n", get_ffi_type(Getattr(n, "type"), "result") + ")\n", get_ffi_type(n, Getattr(n, "type"), "result") //,varargs ? "nil" : "t" ); @@ -361,7 +369,7 @@ /* Printf(stdout, "Converting %s in %s\n", type, name); */ - lisp_type = get_ffi_type(type, Getattr(c, "sym:name")); + lisp_type = get_ffi_type(n, type, Getattr(c, "sym:name")); Printf(f_cl, " (#.(%s \"%s\" :type :slot) %s)\n", identifier_converter, Getattr(c, "sym:name"), lisp_type); Modified: trunk/Source/Swig/swig.h =================================================================== --- trunk/Source/Swig/swig.h 2009-07-08 10:24:31 UTC (rev 11379) +++ trunk/Source/Swig/swig.h 2009-07-08 12:17:45 UTC (rev 11380) @@ -370,11 +370,8 @@ extern void Swig_typemap_clear_apply(ParmList *pattern); extern void Swig_typemap_debug(void); - extern Hash *Swig_typemap_search(const_String_or_char_ptr op, SwigType *type, const_String_or_char_ptr pname, SwigType **matchtype); - extern Hash *Swig_typemap_search_multi(const_String_or_char_ptr op, ParmList *parms, int *nmatch); extern String *Swig_typemap_lookup(const_String_or_char_ptr op, Node *n, const_String_or_char_ptr lname, Wrapper *f); extern String *Swig_typemap_lookup_out(const_String_or_char_ptr op, Node *n, const_String_or_char_ptr lname, Wrapper *f, String *actioncode); - extern void Swig_typemap_attach_kwargs(Hash *tm, const_String_or_char_ptr op, Parm *p); extern void Swig_typemap_new_scope(void); extern Hash *Swig_typemap_pop_scope(void); Modified: trunk/Source/Swig/typemap.c =================================================================== --- trunk/Source/Swig/typemap.c 2009-07-08 10:24:31 UTC (rev 11379) +++ trunk/Source/Swig/typemap.c 2009-07-08 12:17:45 UTC (rev 11380) @@ -114,7 +114,7 @@ we have to make sure that we only intern strings without object identity into the hash table. - (Swig_typemap_attach_kwargs calls tmop_name several times with + (typemap_attach_kwargs calls tmop_name several times with the "same" String *op (i.e., same object identity) but differing string values.) @@ -134,6 +134,7 @@ return s; } +#if 0 /* ----------------------------------------------------------------------------- * Swig_typemap_new_scope() * @@ -157,6 +158,7 @@ } return 0; } +#endif /* ----------------------------------------------------------------------------- * Swig_typemap_register() @@ -265,12 +267,12 @@ } /* ----------------------------------------------------------------------------- - * Swig_typemap_get() + * typemap_get() * * Retrieve typemap information from current scope. * ----------------------------------------------------------------------------- */ -static Hash *Swig_typemap_get(SwigType *type, const_String_or_char_ptr name, int scope) { +static Hash *typemap_get(SwigType *type, const_String_or_char_ptr name, int scope) { Hash *tm, *tm1; /* See if this type has been seen before */ if ((scope < 0) || (scope > tm_scope)) @@ -312,7 +314,7 @@ pname = Getattr(p, "name"); /* Lookup the type */ - tm = Swig_typemap_get(ptype, pname, ts); + tm = typemap_get(ptype, pname, ts); if (!tm) break; @@ -360,7 +362,7 @@ while (p) { type = Getattr(p, "type"); name = Getattr(p, "name"); - tm = Swig_typemap_get(type, name, tm_scope); + tm = typemap_get(type, name, tm_scope); if (!tm) return; p = nextSibling(p); @@ -385,8 +387,7 @@ * it works. * ----------------------------------------------------------------------------- */ -static -int count_args(String *s) { +static int count_args(String *s) { /* Count up number of arguments */ int na = 0; char *c = Char(s); @@ -456,7 +457,7 @@ while (ts >= 0) { /* See if there is a matching typemap in this scope */ - sm = Swig_typemap_get(type, name, ts); + sm = typemap_get(type, name, ts); /* if there is not matching, look for a typemap in the original type... [truncated message content] |
From: <wsf...@us...> - 2009-07-26 21:21:35
|
Revision: 11454 http://swig.svn.sourceforge.net/swig/?rev=11454&view=rev Author: wsfulton Date: 2009-07-26 21:21:26 +0000 (Sun, 26 Jul 2009) Log Message: ----------- fix some overloaded warning messages when templates are used Modified Paths: -------------- trunk/Source/Modules/allegrocl.cxx trunk/Source/Modules/overload.cxx trunk/Source/Modules/r.cxx trunk/Source/Swig/naming.c Modified: trunk/Source/Modules/allegrocl.cxx =================================================================== --- trunk/Source/Modules/allegrocl.cxx 2009-07-25 22:53:45 UTC (rev 11453) +++ trunk/Source/Modules/allegrocl.cxx 2009-07-26 21:21:26 UTC (rev 11454) @@ -1803,13 +1803,13 @@ String *t2 = Getattr(p2, "tmap:typecheck:precedence"); if ((!t1) && (!nodes[i].error)) { Swig_warning(WARN_TYPEMAP_TYPECHECK, Getfile(nodes[i].n), Getline(nodes[i].n), - "Overloaded %s(%s) not supported (no type checking rule for '%s').\n", - Getattr(nodes[i].n, "name"), ParmList_str_defaultargs(Getattr(nodes[i].n, "parms")), SwigType_str(Getattr(p1, "type"), 0)); + "Overloaded method %s not supported (no type checking rule for '%s').\n", + Swig_name_decl(nodes[i].n), SwigType_str(Getattr(p1, "type"), 0)); nodes[i].error = 1; } else if ((!t2) && (!nodes[j].error)) { Swig_warning(WARN_TYPEMAP_TYPECHECK, Getfile(nodes[j].n), Getline(nodes[j].n), - "Overloaded %s(%s) not supported (no type checking rule for '%s').\n", - Getattr(nodes[j].n, "name"), ParmList_str_defaultargs(Getattr(nodes[j].n, "parms")), SwigType_str(Getattr(p2, "type"), 0)); + "Overloaded method %s not supported (no type checking rule for '%s').\n", + Swig_name_decl(nodes[j].n), SwigType_str(Getattr(p2, "type"), 0)); nodes[j].error = 1; } if (t1 && t2) { @@ -1937,19 +1937,15 @@ if (!nodes[j].error) { if (script_lang_wrapping) { Swig_warning(WARN_LANG_OVERLOAD_SHADOW, Getfile(nodes[j].n), Getline(nodes[j].n), - "Overloaded %s(%s)%s is shadowed by %s(%s)%s at %s:%d.\n", - Getattr(nodes[j].n, "name"), ParmList_errorstr(nodes[j].parms), - SwigType_isconst(Getattr(nodes[j].n, "decl")) ? " const" : "", - Getattr(nodes[i].n, "name"), ParmList_errorstr(nodes[i].parms), - SwigType_isconst(Getattr(nodes[i].n, "decl")) ? " const" : "", Getfile(nodes[i].n), Getline(nodes[i].n)); + "Overloaded method %s is shadowed by %s at %s:%d.\n", + Swig_name_decl(nodes[j].n), Swig_name_decl(nodes[i].n), + Getfile(nodes[i].n), Getline(nodes[i].n)); } else { if (!Getattr(nodes[j].n, "overload:ignore")) Swig_warning(WARN_LANG_OVERLOAD_IGNORED, Getfile(nodes[j].n), Getline(nodes[j].n), - "Overloaded method %s(%s)%s ignored. Method %s(%s)%s at %s:%d used.\n", - Getattr(nodes[j].n, "name"), ParmList_errorstr(nodes[j].parms), - SwigType_isconst(Getattr(nodes[j].n, "decl")) ? " const" : "", - Getattr(nodes[i].n, "name"), ParmList_errorstr(nodes[i].parms), - SwigType_isconst(Getattr(nodes[i].n, "decl")) ? " const" : "", Getfile(nodes[i].n), Getline(nodes[i].n)); + "Overloaded method %s ignored. Method %s at %s:%d used.\n", + Swig_name_decl(nodes[j].n), Swig_name_decl(nodes[i].n), + Getfile(nodes[i].n), Getline(nodes[i].n)); } nodes[j].error = 1; } Modified: trunk/Source/Modules/overload.cxx =================================================================== --- trunk/Source/Modules/overload.cxx 2009-07-25 22:53:45 UTC (rev 11453) +++ trunk/Source/Modules/overload.cxx 2009-07-26 21:21:26 UTC (rev 11454) @@ -126,12 +126,12 @@ String *t2 = Getattr(p2, "tmap:typecheck:precedence"); if ((!t1) && (!nodes[i].error)) { Swig_warning(WARN_TYPEMAP_TYPECHECK, Getfile(nodes[i].n), Getline(nodes[i].n), - "Overloaded method %s not supported (no type checking rule for '%s').\n", + "xx Overloaded method %s not supported (no type checking rule for '%s').\n", Swig_name_decl(nodes[i].n), SwigType_str(Getattr(p1, "type"), 0)); nodes[i].error = 1; } else if ((!t2) && (!nodes[j].error)) { Swig_warning(WARN_TYPEMAP_TYPECHECK, Getfile(nodes[j].n), Getline(nodes[j].n), - "Overloaded method %s not supported (no type checking rule for '%s').\n", + "yy Overloaded method %s not supported (no type checking rule for '%s').\n", Swig_name_decl(nodes[j].n), SwigType_str(Getattr(p2, "type"), 0)); nodes[j].error = 1; } Modified: trunk/Source/Modules/r.cxx =================================================================== --- trunk/Source/Modules/r.cxx 2009-07-25 22:53:45 UTC (rev 11453) +++ trunk/Source/Modules/r.cxx 2009-07-26 21:21:26 UTC (rev 11454) @@ -1418,15 +1418,13 @@ String *t2 = Getattr(p2,"tmap:typecheck:precedence"); if ((!t1) && (!nodes[i].error)) { Swig_warning(WARN_TYPEMAP_TYPECHECK, Getfile(nodes[i].n), Getline(nodes[i].n), - "Overloaded %s(%s) not supported (no type checking rule for '%s').\n", - Getattr(nodes[i].n,"name"),ParmList_str_defaultargs(Getattr(nodes[i].n,"parms")), - SwigType_str(Getattr(p1,"type"),0)); + "Overloaded method %s not supported (no type checking rule for '%s').\n", + Swig_name_decl(nodes[i].n), SwigType_str(Getattr(p1, "type"), 0)); nodes[i].error = 1; } else if ((!t2) && (!nodes[j].error)) { Swig_warning(WARN_TYPEMAP_TYPECHECK, Getfile(nodes[j].n), Getline(nodes[j].n), - "Overloaded %s(%s) not supported (no type checking rule for '%s').\n", - Getattr(nodes[j].n,"name"),ParmList_str_defaultargs(Getattr(nodes[j].n,"parms")), - SwigType_str(Getattr(p2,"type"),0)); + "xx Overloaded method %s not supported (no type checking rule for '%s').\n", + Swig_name_decl(nodes[j].n), SwigType_str(Getattr(p2, "type"), 0)); nodes[j].error = 1; } if (t1 && t2) { @@ -1556,21 +1554,15 @@ if (!nodes[j].error) { if (script_lang_wrapping) { Swig_warning(WARN_LANG_OVERLOAD_SHADOW, Getfile(nodes[j].n), Getline(nodes[j].n), - "Overloaded %s(%s)%s is shadowed by %s(%s)%s at %s:%d.\n", - Getattr(nodes[j].n,"name"), ParmList_errorstr(nodes[j].parms), - SwigType_isconst(Getattr(nodes[j].n,"decl")) ? " const" : "", - Getattr(nodes[i].n,"name"), ParmList_errorstr(nodes[i].parms), - SwigType_isconst(Getattr(nodes[i].n,"decl")) ? " const" : "", - Getfile(nodes[i].n),Getline(nodes[i].n)); + "Overloaded method %s is shadowed by %s at %s:%d.\n", + Swig_name_decl(nodes[j].n), Swig_name_decl(nodes[i].n), + Getfile(nodes[i].n), Getline(nodes[i].n)); } else { if (!Getattr(nodes[j].n, "overload:ignore")) Swig_warning(WARN_LANG_OVERLOAD_IGNORED, Getfile(nodes[j].n), Getline(nodes[j].n), - "Overloaded method %s(%s)%s ignored. Method %s(%s)%s at %s:%d used.\n", - Getattr(nodes[j].n,"name"), ParmList_errorstr(nodes[j].parms), - SwigType_isconst(Getattr(nodes[j].n,"decl")) ? " const" : "", - Getattr(nodes[i].n,"name"), ParmList_errorstr(nodes[i].parms), - SwigType_isconst(Getattr(nodes[i].n,"decl")) ? " const" : "", - Getfile(nodes[i].n),Getline(nodes[i].n)); + "Overloaded method %s ignored. Method %s at %s:%d used.\n", + Swig_name_decl(nodes[j].n), Swig_name_decl(nodes[i].n), + Getfile(nodes[i].n), Getline(nodes[i].n)); } nodes[j].error = 1; } Modified: trunk/Source/Swig/naming.c =================================================================== --- trunk/Source/Swig/naming.c 2009-07-25 22:53:45 UTC (rev 11453) +++ trunk/Source/Swig/naming.c 2009-07-26 21:21:26 UTC (rev 11454) @@ -1611,7 +1611,7 @@ qname = NewString(""); if (qualifier && Len(qualifier) > 0) Printf(qname, "%s::", qualifier); - Printf(qname, "%s", name); + Printf(qname, "%s", SwigType_str(name, 0)); decl = NewStringf("%s(%s)%s", qname, ParmList_errorstr(Getattr(n, "parms")), SwigType_isconst(Getattr(n, "decl")) ? " const" : ""); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wsf...@us...> - 2009-07-30 06:07:01
|
Revision: 11473 http://swig.svn.sourceforge.net/swig/?rev=11473&view=rev Author: wsfulton Date: 2009-07-30 06:06:49 +0000 (Thu, 30 Jul 2009) Log Message: ----------- typemap method name: use consistent terminology in code Modified Paths: -------------- trunk/Source/CParse/parser.y trunk/Source/Modules/csharp.cxx trunk/Source/Modules/java.cxx trunk/Source/Modules/modula3.cxx trunk/Source/Modules/php.cxx trunk/Source/Swig/swig.h trunk/Source/Swig/typemap.c Modified: trunk/Source/CParse/parser.y =================================================================== --- trunk/Source/CParse/parser.y 2009-07-29 21:01:28 UTC (rev 11472) +++ trunk/Source/CParse/parser.y 2009-07-30 06:06:49 UTC (rev 11473) @@ -1465,7 +1465,7 @@ } decl; Parm *tparms; struct { - String *op; + String *method; Hash *kwargs; } tmap; struct { @@ -2499,10 +2499,10 @@ typemap_directive : TYPEMAP LPAREN typemap_type RPAREN tm_list stringbrace { $$ = 0; - if ($3.op) { + if ($3.method) { String *code = 0; $$ = new_node("typemap"); - Setattr($$,"method",$3.op); + Setattr($$,"method",$3.method); if ($3.kwargs) { ParmList *kw = $3.kwargs; code = remove_block(kw, $6); @@ -2516,17 +2516,17 @@ } | TYPEMAP LPAREN typemap_type RPAREN tm_list SEMI { $$ = 0; - if ($3.op) { + if ($3.method) { $$ = new_node("typemap"); - Setattr($$,"method",$3.op); + Setattr($$,"method",$3.method); appendChild($$,$5); } } | TYPEMAP LPAREN typemap_type RPAREN tm_list EQUAL typemap_parm SEMI { $$ = 0; - if ($3.op) { + if ($3.method) { $$ = new_node("typemapcopy"); - Setattr($$,"method",$3.op); + Setattr($$,"method",$3.method); Setattr($$,"pattern", Getattr($7,"pattern")); appendChild($$,$5); } @@ -2546,15 +2546,15 @@ /* two argument typemap form */ name = Getattr($1,"name"); if (!name || (Strcmp(name,typemap_lang))) { - $$.op = 0; + $$.method = 0; $$.kwargs = 0; } else { - $$.op = Getattr(p,"name"); + $$.method = Getattr(p,"name"); $$.kwargs = nextSibling(p); } } else { /* one-argument typemap-form */ - $$.op = Getattr($1,"name"); + $$.method = Getattr($1,"name"); $$.kwargs = p; } } Modified: trunk/Source/Modules/csharp.cxx =================================================================== --- trunk/Source/Modules/csharp.cxx 2009-07-29 21:01:28 UTC (rev 11472) +++ trunk/Source/Modules/csharp.cxx 2009-07-30 06:06:49 UTC (rev 11473) @@ -3039,7 +3039,7 @@ /* ----------------------------------------------------------------------------- * typemapLookup() * n - for input only and must contain info for Getfile(n) and Getline(n) to work - * op - typemap method name + * tmap_method - typemap method name * type - typemap type to lookup * warning - warning number to issue if no typemaps found * typemap_attributes - the typemap attributes are attached to this node and will @@ -3047,16 +3047,16 @@ * return is never NULL, unlike Swig_typemap_lookup() * ----------------------------------------------------------------------------- */ - const String *typemapLookup(Node *n, const_String_or_char_ptr op, SwigType *type, int warning, Node *typemap_attributes = 0) { + const String *typemapLookup(Node *n, const_String_or_char_ptr tmap_method, SwigType *type, int warning, Node *typemap_attributes = 0) { Node *node = !typemap_attributes ? NewHash() : typemap_attributes; Setattr(node, "type", type); Setfile(node, Getfile(n)); Setline(node, Getline(n)); - const String *tm = Swig_typemap_lookup(op, node, "", 0); + const String *tm = Swig_typemap_lookup(tmap_method, node, "", 0); if (!tm) { tm = empty_string; if (warning != WARN_NONE) - Swig_warning(warning, Getfile(n), Getline(n), "No %s typemap defined for %s\n", op, SwigType_str(type, 0)); + Swig_warning(warning, Getfile(n), Getline(n), "No %s typemap defined for %s\n", tmap_method, SwigType_str(type, 0)); } if (!typemap_attributes) Delete(node); Modified: trunk/Source/Modules/java.cxx =================================================================== --- trunk/Source/Modules/java.cxx 2009-07-29 21:01:28 UTC (rev 11472) +++ trunk/Source/Modules/java.cxx 2009-07-30 06:06:49 UTC (rev 11473) @@ -2872,7 +2872,7 @@ /* ----------------------------------------------------------------------------- * typemapLookup() * n - for input only and must contain info for Getfile(n) and Getline(n) to work - * op - typemap method name + * tmap_method - typemap method name * type - typemap type to lookup * warning - warning number to issue if no typemaps found * typemap_attributes - the typemap attributes are attached to this node and will @@ -2880,16 +2880,16 @@ * return is never NULL, unlike Swig_typemap_lookup() * ----------------------------------------------------------------------------- */ - const String *typemapLookup(Node *n, const_String_or_char_ptr op, SwigType *type, int warning, Node *typemap_attributes = 0) { + const String *typemapLookup(Node *n, const_String_or_char_ptr tmap_method, SwigType *type, int warning, Node *typemap_attributes = 0) { Node *node = !typemap_attributes ? NewHash() : typemap_attributes; Setattr(node, "type", type); Setfile(node, Getfile(n)); Setline(node, Getline(n)); - const String *tm = Swig_typemap_lookup(op, node, "", 0); + const String *tm = Swig_typemap_lookup(tmap_method, node, "", 0); if (!tm) { tm = empty_string; if (warning != WARN_NONE) - Swig_warning(warning, Getfile(n), Getline(n), "No %s typemap defined for %s\n", op, SwigType_str(type, 0)); + Swig_warning(warning, Getfile(n), Getline(n), "No %s typemap defined for %s\n", tmap_method, SwigType_str(type, 0)); } if (!typemap_attributes) Delete(node); Modified: trunk/Source/Modules/modula3.cxx =================================================================== --- trunk/Source/Modules/modula3.cxx 2009-07-29 21:01:28 UTC (rev 11472) +++ trunk/Source/Modules/modula3.cxx 2009-07-30 06:06:49 UTC (rev 11473) @@ -3818,7 +3818,7 @@ /* ----------------------------------------------------------------------------- * typemapLookup() * n - for input only and must contain info for Getfile(n) and Getline(n) to work - * op - typemap method name + * tmap_method - typemap method name * type - typemap type to lookup * warning - warning number to issue if no typemaps found * typemap_attributes - the typemap attributes are attached to this node and will @@ -3826,16 +3826,16 @@ * return is never NULL, unlike Swig_typemap_lookup() * ----------------------------------------------------------------------------- */ - const String *typemapLookup(Node *n, const_String_or_char_ptr op, SwigType *type, int warning, Node *typemap_attributes = 0) { + const String *typemapLookup(Node *n, const_String_or_char_ptr tmap_method, SwigType *type, int warning, Node *typemap_attributes = 0) { Node *node = !typemap_attributes ? NewHash() : typemap_attributes; Setattr(node, "type", type); Setfile(node, Getfile(n)); Setline(node, Getline(n)); - const String *tm = Swig_typemap_lookup(op, node, "", 0); + const String *tm = Swig_typemap_lookup(tmap_method, node, "", 0); if (!tm) { tm = empty_string; if (warning != WARN_NONE) - Swig_warning(warning, Getfile(n), Getline(n), "No %s typemap defined for %s\n", op, SwigType_str(type, 0)); + Swig_warning(warning, Getfile(n), Getline(n), "No %s typemap defined for %s\n", tmap_method, SwigType_str(type, 0)); } if (!typemap_attributes) Delete(node); Modified: trunk/Source/Modules/php.cxx =================================================================== --- trunk/Source/Modules/php.cxx 2009-07-29 21:01:28 UTC (rev 11472) +++ trunk/Source/Modules/php.cxx 2009-07-30 06:06:49 UTC (rev 11473) @@ -2196,8 +2196,8 @@ return NewStringEmpty(); } - String *PhpTypeFromTypemap(char *op, Node *n, const_String_or_char_ptr lname) { - String *tms = Swig_typemap_lookup(op, n, lname, 0); + String *PhpTypeFromTypemap(char *tmap_method, Node *n, const_String_or_char_ptr lname) { + String *tms = Swig_typemap_lookup(tmap_method, n, lname, 0); if (!tms) return 0; else Modified: trunk/Source/Swig/swig.h =================================================================== --- trunk/Source/Swig/swig.h 2009-07-29 21:01:28 UTC (rev 11472) +++ trunk/Source/Swig/swig.h 2009-07-30 06:06:49 UTC (rev 11473) @@ -363,19 +363,19 @@ /* --- Legacy Typemap API (somewhat simplified, ha!) --- */ extern void Swig_typemap_init(void); - extern void Swig_typemap_register(const_String_or_char_ptr op, ParmList *pattern, const_String_or_char_ptr code, ParmList *locals, ParmList *kwargs); - extern int Swig_typemap_copy(const_String_or_char_ptr op, ParmList *srcpattern, ParmList *pattern); - extern void Swig_typemap_clear(const_String_or_char_ptr op, ParmList *pattern); + extern void Swig_typemap_register(const_String_or_char_ptr tmap_method, ParmList *pattern, const_String_or_char_ptr code, ParmList *locals, ParmList *kwargs); + extern int Swig_typemap_copy(const_String_or_char_ptr tmap_method, ParmList *srcpattern, ParmList *pattern); + extern void Swig_typemap_clear(const_String_or_char_ptr tmap_method, ParmList *pattern); extern int Swig_typemap_apply(ParmList *srcpat, ParmList *destpat); extern void Swig_typemap_clear_apply(ParmList *pattern); extern void Swig_typemap_debug(void); - extern String *Swig_typemap_lookup(const_String_or_char_ptr op, Node *n, const_String_or_char_ptr lname, Wrapper *f); - extern String *Swig_typemap_lookup_out(const_String_or_char_ptr op, Node *n, const_String_or_char_ptr lname, Wrapper *f, String *actioncode); + extern String *Swig_typemap_lookup(const_String_or_char_ptr tmap_method, Node *n, const_String_or_char_ptr lname, Wrapper *f); + extern String *Swig_typemap_lookup_out(const_String_or_char_ptr tmap_method, Node *n, const_String_or_char_ptr lname, Wrapper *f, String *actioncode); extern void Swig_typemap_new_scope(void); extern Hash *Swig_typemap_pop_scope(void); - extern void Swig_typemap_attach_parms(const_String_or_char_ptr op, ParmList *parms, Wrapper *f); + extern void Swig_typemap_attach_parms(const_String_or_char_ptr tmap_method, ParmList *parms, Wrapper *f); /* --- Code fragment support --- */ Modified: trunk/Source/Swig/typemap.c =================================================================== --- trunk/Source/Swig/typemap.c 2009-07-29 21:01:28 UTC (rev 11472) +++ trunk/Source/Swig/typemap.c 2009-07-30 06:06:49 UTC (rev 11473) @@ -117,29 +117,29 @@ tm_scope = 0; } -static String *tmop_name(const_String_or_char_ptr op) { +static String *typemap_method_name(const_String_or_char_ptr tmap_method) { static Hash *names = 0; String *s; /* Due to "interesting" object-identity semantics of DOH, we have to make sure that we only intern strings without object identity into the hash table. - (typemap_attach_kwargs calls tmop_name several times with - the "same" String *op (i.e., same object identity) but differing + (typemap_attach_kwargs calls typemap_method_name several times with + the "same" String *tmap_method (i.e., same object identity) but differing string values.) Most other callers work around this by using char* rather than String *. -- mkoeppe, Jun 17, 2003 */ - const char *op_without_object_identity = Char(op); + const char *method_without_object_identity = Char(tmap_method); if (!names) names = NewHash(); - s = Getattr(names, op_without_object_identity); + s = Getattr(names, method_without_object_identity); if (s) return s; - s = NewStringf("tmap:%s", op); - Setattr(names, op_without_object_identity, s); + s = NewStringf("tmap:%s", tmap_method); + Setattr(names, method_without_object_identity, s); Delete(s); return s; } @@ -176,18 +176,18 @@ * Add a new multi-argument typemap * ----------------------------------------------------------------------------- */ -void Swig_typemap_register(const_String_or_char_ptr op, ParmList *parms, const_String_or_char_ptr code, ParmList *locals, ParmList *kwargs) { +void Swig_typemap_register(const_String_or_char_ptr tmap_method, ParmList *parms, const_String_or_char_ptr code, ParmList *locals, ParmList *kwargs) { Hash *tm; Hash *tm1; Hash *tm2; Parm *np; - String *tmop; + String *tm_method; SwigType *type; String *pname; if (!parms) return; - tmop = tmop_name(op); + tm_method = typemap_method_name(tmap_method); /* Register the first type in the parameter list */ @@ -212,11 +212,11 @@ tm = tm1; } - /* Now see if this typemap op has been seen before */ - tm2 = Getattr(tm, tmop); + /* Now see if this typemap method has been seen before */ + tm2 = Getattr(tm, tm_method); if (!tm2) { tm2 = NewHash(); - Setattr(tm, tmop, tm2); + Setattr(tm, tm_method, tm2); Delete(tm2); } @@ -247,7 +247,7 @@ np = nextSibling(parms); if (np) { /* Make an entirely new operator key */ - String *newop = NewStringf("%s-%s+%s:", op, type, pname); + String *newop = NewStringf("%s-%s+%s:", tmap_method, type, pname); /* Now reregister on the remaining arguments */ Swig_typemap_register(newop, np, code, locals, kwargs); @@ -255,7 +255,7 @@ Delete(newop); } else { String *str = SwigType_str(type, pname); - String *typemap = NewStringf("typemap(%s) %s", op, str); + String *typemap = NewStringf("typemap(%s) %s", tmap_method, str); ParmList *clocals = CopyParmList(locals); ParmList *ckwargs = CopyParmList(kwargs); @@ -304,21 +304,21 @@ * Copy a typemap * ----------------------------------------------------------------------------- */ -int Swig_typemap_copy(const_String_or_char_ptr op, ParmList *srcparms, ParmList *parms) { +int Swig_typemap_copy(const_String_or_char_ptr tmap_method, ParmList *srcparms, ParmList *parms) { Hash *tm = 0; - String *tmop; + String *tm_method; Parm *p; String *pname; SwigType *ptype; int ts = tm_scope; - String *tmops, *newop; + String *tm_methods, *newop; if (ParmList_len(parms) != ParmList_len(srcparms)) return -1; - tmop = tmop_name(op); + tm_method = typemap_method_name(tmap_method); while (ts >= 0) { p = srcparms; - tmops = NewString(tmop); + tm_methods = NewString(tm_method); while (p) { ptype = Getattr(p, "type"); pname = Getattr(p, "name"); @@ -328,22 +328,22 @@ if (!tm) break; - tm = Getattr(tm, tmops); + tm = Getattr(tm, tm_methods); if (!tm) break; /* Got a match. Look for next typemap */ - newop = NewStringf("%s-%s+%s:", tmops, ptype, pname); - Delete(tmops); - tmops = newop; + newop = NewStringf("%s-%s+%s:", tm_methods, ptype, pname); + Delete(tm_methods); + tm_methods = newop; p = nextSibling(p); } - Delete(tmops); + Delete(tm_methods); if (!p && tm) { /* Got some kind of match */ - Swig_typemap_register(op, parms, Getattr(tm, "code"), Getattr(tm, "locals"), Getattr(tm, "kwargs")); + Swig_typemap_register(tmap_method, parms, Getattr(tm, "code"), Getattr(tm, "locals"), Getattr(tm, "kwargs")); return 0; } ts--; @@ -359,7 +359,7 @@ * Delete a multi-argument typemap * ----------------------------------------------------------------------------- */ -void Swig_typemap_clear(const_String_or_char_ptr op, ParmList *parms) { +void Swig_typemap_clear(const_String_or_char_ptr tmap_method, ParmList *parms) { SwigType *type; String *name; Parm *p; @@ -367,7 +367,7 @@ Hash *tm = 0; /* This might not work */ - newop = NewString(op); + newop = NewString(tmap_method); p = parms; while (p) { type = Getattr(p, "type"); @@ -380,7 +380,7 @@ Printf(newop, "-%s+%s:", type, name); } if (tm) { - tm = Getattr(tm, tmop_name(newop)); + tm = Getattr(tm, typemap_method_name(newop)); if (tm) { Delattr(tm, "code"); Delattr(tm, "locals"); @@ -601,7 +601,7 @@ * that includes a 'code' attribute. * ----------------------------------------------------------------------------- */ -static Hash *typemap_search(const_String_or_char_ptr op, SwigType *type, const_String_or_char_ptr name, SwigType **matchtype) { +static Hash *typemap_search(const_String_or_char_ptr tmap_method, SwigType *type, const_String_or_char_ptr name, SwigType **matchtype) { Hash *result = 0, *tm, *tm1, *tma; Hash *backup = 0; SwigType *noarrays = 0; @@ -611,7 +611,7 @@ int isarray; const String *cname = 0; SwigType *unstripped = 0; - String *tmop = tmop_name(op); + String *tm_method = typemap_method_name(tmap_method); if ((name) && Len(name)) cname = name; @@ -625,7 +625,7 @@ if (tm && cname) { tm1 = Getattr(tm, cname); if (tm1) { - result = Getattr(tm1, tmop); /* See if there is a type-name match */ + result = Getattr(tm1, tm_method); /* See if there is a type-name match */ if (result && Getattr(result, "code")) goto ret_result; if (result) @@ -633,7 +633,7 @@ } } if (tm) { - result = Getattr(tm, tmop); /* See if there is simply a type match */ + result = Getattr(tm, tm_method); /* See if there is simply a type match */ if (result && Getattr(result, "code")) goto ret_result; if (result) @@ -650,7 +650,7 @@ if (tma && cname) { tm1 = Getattr(tma, cname); if (tm1) { - result = Getattr(tm1, tmop); /* type-name match */ + result = Getattr(tm1, tm_method); /* type-name match */ if (result && Getattr(result, "code")) goto ret_result; if (result) @@ -658,7 +658,7 @@ } } if (tma) { - result = Getattr(tma, tmop); /* type match */ + result = Getattr(tma, tm_method); /* type match */ if (result && Getattr(result, "code")) goto ret_result; if (result) @@ -702,13 +702,13 @@ if (tm && cname) { tm1 = Getattr(tm, cname); if (tm1) { - result = Getattr(tm1, tmop); /* See if there is a type-name match */ + result = Getattr(tm1, tm_method); /* See if there is a type-name match */ if (result) goto ret_result; } } if (tm) { /* See if there is simply a type match */ - result = Getattr(tm, tmop); + result = Getattr(tm, tm_method); if (result) goto ret_result; } @@ -748,7 +748,7 @@ * Search for a multi-argument typemap. * ----------------------------------------------------------------------------- */ -static Hash *typemap_search_multi(const_String_or_char_ptr op, ParmList *parms, int *nmatch) { +static Hash *typemap_search_multi(const_String_or_char_ptr tmap_method, ParmList *parms, int *nmatch) { SwigType *type; SwigType *mtype = 0; String *name; @@ -763,13 +763,13 @@ name = Getattr(parms, "name"); /* Try to find a match on the first type */ - tm = typemap_search(op, type, name, &mtype); + tm = typemap_search(tmap_method, type, name, &mtype); if (tm) { if (mtype && SwigType_isarray(mtype)) { Setattr(parms, "tmap:match", mtype); } Delete(mtype); - newop = NewStringf("%s-%s+%s:", op, type, name); + newop = NewStringf("%s-%s+%s:", tmap_method, type, name); tm1 = typemap_search_multi(newop, nextSibling(parms), nmatch); if (tm1) tm = tm1; @@ -1178,20 +1178,20 @@ * * The node should contain the "type" and "name" attributes for the typemap match on. * input. The typemap code and typemap attribute values are attached onto the node - * prefixed with "tmap:". For example with op="in", the typemap code can be retrieved + * prefixed with "tmap:". For example with tmap_method="in", the typemap code can be retrieved * with a call to Getattr(node, "tmap:in") (this is also the string returned) and the * "noblock" attribute can be retrieved with a call to Getattr(node, "tmap:in:noblock"). * - * op - typemap method, eg "in", "out", "newfree" - * node - the node to attach the typemap and typemap attributes to - * lname - name of variable to substitute $1, $2 etc for - * f - wrapper code to generate into if non null - * actioncode - code to generate into f before the out typemap code, unless + * tmap_method - typemap method, eg "in", "out", "newfree" + * node - the node to attach the typemap and typemap attributes to + * lname - name of variable to substitute $1, $2 etc for + * f - wrapper code to generate into if non null + * actioncode - code to generate into f before the out typemap code, unless * the optimal attribute is set in the out typemap in which case * $1 in the out typemap will be replaced by the code in actioncode. * ----------------------------------------------------------------------------- */ -static String *Swig_typemap_lookup_impl(const_String_or_char_ptr op, Node *node, const_String_or_char_ptr lname, Wrapper *f, String *actioncode) { +static String *Swig_typemap_lookup_impl(const_String_or_char_ptr tmap_method, Node *node, const_String_or_char_ptr lname, Wrapper *f, String *actioncode) { SwigType *type; SwigType *mtype = 0; String *pname; @@ -1204,14 +1204,14 @@ String *symname; String *cname = 0; String *clname = 0; - char *cop = Char(op); + char *cop = Char(tmap_method); int optimal_attribute = 0; int optimal_substitution = 0; int num_substitutions = 0; /* special case, we need to check for 'ref' call and set the default code 'sdef' */ - if (node && Cmp(op, "newfree") == 0) { + if (node && Cmp(tmap_method, "newfree") == 0) { sdef = Swig_ref_call(node, lname); } @@ -1234,7 +1234,7 @@ String *qsn = st ? Swig_symbol_string_qualify(pname, st) : 0; if (qsn) { if (Len(qsn) && !Equal(qsn, pname)) { - tm = typemap_search(op, type, qsn, &mtype); + tm = typemap_search(tmap_method, type, qsn, &mtype); if (tm && (!Getattr(tm, "pname") || strstr(Char(Getattr(tm, "type")), "SWIGTYPE"))) { tm = 0; } @@ -1244,7 +1244,7 @@ } if (!tm) #endif - tm = typemap_search(op, type, pname, &mtype); + tm = typemap_search(tmap_method, type, pname, &mtype); if (!tm) return sdef; @@ -1270,7 +1270,7 @@ Delete(mangle); } sprintf(temp, "%s:%s", cop, ckwname); - Setattr(node, tmop_name(temp), value); + Setattr(node, typemap_method_name(temp), value); if (Cmp(temp, "out:optimal") == 0) optimal_attribute = (Cmp(value, "0") != 0) ? 1 : 0; Delete(value); @@ -1353,23 +1353,23 @@ Replace(s, "$symname", symname, DOH_REPLACE_ANY); } - Setattr(node, tmop_name(op), s); + Setattr(node, typemap_method_name(tmap_method), s); if (locals) { sprintf(temp, "%s:locals", cop); - Setattr(node, tmop_name(temp), locals); + Setattr(node, typemap_method_name(temp), locals); Delete(locals); } if (Checkattr(tm, "type", "SWIGTYPE")) { sprintf(temp, "%s:SWIGTYPE", cop); - Setattr(node, tmop_name(temp), "1"); + Setattr(node, typemap_method_name(temp), "1"); } /* Look for warnings */ { String *w; sprintf(temp, "%s:warning", cop); - w = Getattr(node, tmop_name(temp)); + w = Getattr(node, typemap_method_name(temp)); if (w) { Swig_warning(0, Getfile(node), Getline(node), "%s\n", w); } @@ -1379,7 +1379,7 @@ { String *fragment; sprintf(temp, "%s:fragment", cop); - fragment = Getattr(node, tmop_name(temp)); + fragment = Getattr(node, typemap_method_name(temp)); if (fragment) { String *fname = Copy(fragment); Setfile(fname, Getfile(node)); @@ -1402,14 +1402,14 @@ return s; } -String *Swig_typemap_lookup_out(const_String_or_char_ptr op, Node *node, const_String_or_char_ptr lname, Wrapper *f, String *actioncode) { +String *Swig_typemap_lookup_out(const_String_or_char_ptr tmap_method, Node *node, const_String_or_char_ptr lname, Wrapper *f, String *actioncode) { assert(actioncode); - assert(Cmp(op, "out") == 0); - return Swig_typemap_lookup_impl(op, node, lname, f, actioncode); + assert(Cmp(tmap_method, "out") == 0); + return Swig_typemap_lookup_impl(tmap_method, node, lname, f, actioncode); } -String *Swig_typemap_lookup(const_String_or_char_ptr op, Node *node, const_String_or_char_ptr lname, Wrapper *f) { - return Swig_typemap_lookup_impl(op, node, lname, f, 0); +String *Swig_typemap_lookup(const_String_or_char_ptr tmap_method, Node *node, const_String_or_char_ptr lname, Wrapper *f) { + return Swig_typemap_lookup_impl(tmap_method, node, lname, f, 0); } /* ----------------------------------------------------------------------------- @@ -1423,7 +1423,7 @@ * A new attribute called "tmap:in:foo" with value "xyz" is attached to p. * ----------------------------------------------------------------------------- */ -static void typemap_attach_kwargs(Hash *tm, const_String_or_char_ptr op, Parm *p) { +static void typemap_attach_kwargs(Hash *tm, const_String_or_char_ptr tmap_method, Parm *p) { String *temp = NewStringEmpty(); Parm *kw = Getattr(tm, "kwargs"); while (kw) { @@ -1437,36 +1437,36 @@ value = v; } Clear(temp); - Printf(temp, "%s:%s", op, Getattr(kw, "name")); - Setattr(p, tmop_name(temp), value); + Printf(temp, "%s:%s", tmap_method, Getattr(kw, "name")); + Setattr(p, typemap_method_name(temp), value); Delete(value); kw = nextSibling(kw); } Clear(temp); - Printf(temp, "%s:match_type", op); - Setattr(p, tmop_name(temp), Getattr(tm, "type")); + Printf(temp, "%s:match_type", tmap_method); + Setattr(p, typemap_method_name(temp), Getattr(tm, "type")); Delete(temp); } /* ----------------------------------------------------------------------------- * typemap_warn() * - * If any warning message is attached to this parameter's "tmap:op:warning" + * If any warning message is attached to this parameter's "tmap:<method>:warning" * attribute, print that warning message. * ----------------------------------------------------------------------------- */ -static void typemap_warn(const_String_or_char_ptr op, Parm *p) { - String *temp = NewStringf("%s:warning", op); - String *w = Getattr(p, tmop_name(temp)); +static void typemap_warn(const_String_or_char_ptr tmap_method, Parm *p) { + String *temp = NewStringf("%s:warning", tmap_method); + String *w = Getattr(p, typemap_method_name(temp)); Delete(temp); if (w) { Swig_warning(0, Getfile(p), Getline(p), "%s\n", w); } } -static void typemap_emit_code_fragments(const_String_or_char_ptr op, Parm *p) { - String *temp = NewStringf("%s:fragment", op); - String *f = Getattr(p, tmop_name(temp)); +static void typemap_emit_code_fragments(const_String_or_char_ptr tmap_method, Parm *p) { + String *temp = NewStringf("%s:fragment", tmap_method); + String *f = Getattr(p, typemap_method_name(temp)); if (f) { String *fname = Copy(f); Setfile(fname, Getfile(p)); @@ -1496,16 +1496,16 @@ * attributes to the parameter for each type in the parameter list. * * This function basically provides the typemap code and typemap attribute values as - * attributes on each parameter prefixed with "tmap:". For example with op="in", the typemap + * attributes on each parameter prefixed with "tmap:". For example with tmap_method="in", the typemap * code can be retrieved for the first parameter with a call to Getattr(parm, "tmap:in") * and the "numinputs" attribute can be retrieved with a call to Getattr(parm, "tmap:in:numinputs"). * - * op - typemap method, eg "in", "out", "newfree" - * parms - parameter list to attach each typemap and all typemap attributes - * f - wrapper code to generate into if non null + * tmap_method - typemap method, eg "in", "out", "newfree" + * parms - parameter list to attach each typemap and all typemap attributes + * f - wrapper code to generate into if non null * ----------------------------------------------------------------------------- */ -void Swig_typemap_attach_parms(const_String_or_char_ptr op, ParmList *parms, Wrapper *f) { +void Swig_typemap_attach_parms(const_String_or_char_ptr tmap_method, ParmList *parms, Wrapper *f) { Parm *p, *firstp; Hash *tm; int nmatch = 0; @@ -1514,21 +1514,21 @@ ParmList *locals; int argnum = 0; char temp[256]; - char *cop = Char(op); + char *cop = Char(tmap_method); String *kwmatch = 0; p = parms; #ifdef SWIG_DEBUG - Printf(stdout, "Swig_typemap_attach_parms: %s\n", op); + Printf(stdout, "Swig_typemap_attach_parms: %s\n", tmap_method); #endif while (p) { argnum++; nmatch = 0; #ifdef SWIG_DEBUG - Printf(stdout, "parms: %s %s %s\n", op, Getattr(p, "name"), Getattr(p, "type")); + Printf(stdout, "parms: %s %s %s\n", tmap_method, Getattr(p, "name"), Getattr(p, "type")); #endif - tm = typemap_search_multi(op, p, &nmatch); + tm = typemap_search_multi(tmap_method, p, &nmatch); #ifdef SWIG_DEBUG if (tm) Printf(stdout, "found: %s\n", tm); @@ -1634,7 +1634,7 @@ if (Checkattr(tm, "type", "SWIGTYPE")) { sprintf(temp, "%s:SWIGTYPE", cop); - Setattr(p, tmop_name(temp), "1"); + Setattr(p, typemap_method_name(temp), "1"); } p = nextSibling(p); } @@ -1651,34 +1651,34 @@ /* Attach attributes to object */ #ifdef SWIG_DEBUG - Printf(stdout, "attach: %s %s %s\n", Getattr(firstp, "name"), tmop_name(op), s); + Printf(stdout, "attach: %s %s %s\n", Getattr(firstp, "name"), typemap_method_name(tmap_method), s); #endif - Setattr(firstp, tmop_name(op), s); /* Code object */ + Setattr(firstp, typemap_method_name(tmap_method), s); /* Code object */ if (locals) { sprintf(temp, "%s:locals", cop); - Setattr(firstp, tmop_name(temp), locals); + Setattr(firstp, typemap_method_name(temp), locals); Delete(locals); } /* Attach a link to the next parameter. Needed for multimaps */ sprintf(temp, "%s:next", cop); - Setattr(firstp, tmop_name(temp), p); + Setattr(firstp, typemap_method_name(temp), p); /* Attach kwargs */ - typemap_attach_kwargs(tm, op, firstp); + typemap_attach_kwargs(tm, tmap_method, firstp); /* Print warnings, if any */ - typemap_warn(op, firstp); + typemap_warn(tmap_method, firstp); /* Look for code fragments */ - typemap_emit_code_fragments(op, firstp); + typemap_emit_code_fragments(tmap_method, firstp); /* increase argnum to consider numinputs */ argnum += nmatch - 1; Delete(s); #ifdef SWIG_DEBUG - Printf(stdout, "res: %s %s %s\n", Getattr(firstp, "name"), tmop_name(op), Getattr(firstp, tmop_name(op))); + Printf(stdout, "res: %s %s %s\n", Getattr(firstp, "name"), typemap_method_name(tmap_method), Getattr(firstp, typemap_method_name(tmap_method))); #endif } @@ -1790,7 +1790,7 @@ if (!syntax_error) { List *l; - String *op; + String *tmap_method; Hash *vars; syntax_error = 1; @@ -1799,7 +1799,7 @@ if (Len(l) >= 2) { ParmList *to_match_parms; - op = Getitem(l, 0); + tmap_method = Getitem(l, 0); /* the second parameter might contain multiple sub-parameters for multi-argument * typemap matching, so split these parameters apart */ @@ -1843,11 +1843,11 @@ #endif if (!already_substituting) { already_substituting = 1; - Swig_typemap_attach_parms(op, to_match_parms, f); + Swig_typemap_attach_parms(tmap_method, to_match_parms, f); already_substituting = 0; /* Look for the typemap code */ - attr = NewStringf("tmap:%s", op); + attr = NewStringf("tmap:%s", tmap_method); tm = Getattr(to_match_parms, attr); if (tm) { Printf(attr, "%s", ":next"); @@ -1859,7 +1859,7 @@ Replace(tm, ki.key, ki.item, DOH_REPLACE_ANY); } /* offer the target language module the chance to make special variable substitutions */ - Language_replace_special_variables(op, tm, to_match_parms); + Language_replace_special_variables(tmap_method, tm, to_match_parms); /* finish up - do the substitution */ Replace(s, dollar_typemap, tm, DOH_REPLACE_ANY); Delete(tm); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wsf...@us...> - 2009-09-13 20:20:20
|
Revision: 11690 http://swig.svn.sourceforge.net/swig/?rev=11690&view=rev Author: wsfulton Date: 2009-09-13 20:20:11 +0000 (Sun, 13 Sep 2009) Log Message: ----------- minor rewrite of enum value handling Modified Paths: -------------- trunk/Source/CParse/parser.y trunk/Source/Modules/csharp.cxx trunk/Source/Modules/java.cxx Modified: trunk/Source/CParse/parser.y =================================================================== --- trunk/Source/CParse/parser.y 2009-09-12 08:23:55 UTC (rev 11689) +++ trunk/Source/CParse/parser.y 2009-09-13 20:20:11 UTC (rev 11690) @@ -3127,8 +3127,8 @@ if (unnamedinstance) { SwigType *cty = NewString("enum "); Setattr($$,"type",cty); - Setattr($$,"unnamedinstance","1"); - Setattr(n,"unnamedinstance","1"); + SetFlag($$,"unnamedinstance"); + SetFlag(n,"unnamedinstance"); Delete(cty); } if ($8) { Modified: trunk/Source/Modules/csharp.cxx =================================================================== --- trunk/Source/Modules/csharp.cxx 2009-09-12 08:23:55 UTC (rev 11689) +++ trunk/Source/Modules/csharp.cxx 2009-09-13 20:20:11 UTC (rev 11690) @@ -1211,6 +1211,9 @@ String *symname = Getattr(n, "sym:name"); String *value = Getattr(n, "value"); String *name = Getattr(n, "name"); + Node *parent = parentNode(n); + int unnamedinstance = GetFlag(parent, "unnamedinstance"); + String *parent_name = Getattr(parent, "name"); String *tmpValue; // Strange hack from parent method @@ -1222,9 +1225,9 @@ Setattr(n, "value", tmpValue); { - EnumFeature enum_feature = decodeEnumFeature(parentNode(n)); + EnumFeature enum_feature = decodeEnumFeature(parent); - if ((enum_feature == ProperEnum) && Getattr(parentNode(n), "sym:name") && !Getattr(parentNode(n), "unnamedinstance")) { + if ((enum_feature == ProperEnum) && parent_name && !unnamedinstance) { // Wrap (non-anonymous) C/C++ enum with a proper C# enum // Emit the enum item. if (!GetFlag(n, "firstenumitem")) @@ -1241,21 +1244,16 @@ } } else { // Wrap C/C++ enums with constant integers or use the typesafe enum pattern - const String *parent_name = Getattr(parentNode(n), "name"); - String *typemap_lookup_type = parent_name ? Copy(parent_name) : NewString("int"); + String *type = Getattr(n, "type"); /* should be int unless explicitly specified in a C++0x enum class */ + SwigType *typemap_lookup_type = parent_name ? parent_name : type; const String *tm = typemapLookup(n, "cstype", typemap_lookup_type, WARN_CSHARP_TYPEMAP_CSTYPE_UNDEF); + String *return_type = Copy(tm); - Delete(typemap_lookup_type); - typemap_lookup_type = NULL; - - // The %csconst feature determines how the constant value is obtained - int const_feature_flag = GetFlag(n, "feature:cs:const"); - const String *methodmods = Getattr(n, "feature:cs:methodmodifiers"); methodmods = methodmods ? methodmods : (is_public(n) ? public_string : protected_string); - if ((enum_feature == TypesafeEnum) && Getattr(parentNode(n), "sym:name") && !Getattr(parentNode(n), "unnamedinstance")) { - // Wrap (non-anonymouse) enum using the typesafe enum pattern + if ((enum_feature == TypesafeEnum) && parent_name && !unnamedinstance) { + // Wrap (non-anonymous) enum using the typesafe enum pattern if (Getattr(n, "enumvalue")) { String *value = enumValue(n); Printf(enum_code, " %s static readonly %s %s = new %s(\"%s\", %s);\n", methodmods, return_type, symname, return_type, symname, value); @@ -1267,6 +1265,10 @@ // Simple integer constants // Note these are always generated for anonymous enums, no matter what enum_feature is specified // Code generated is the same for SimpleEnum and TypeunsafeEnum -> the class it is generated into is determined later + + // The %csconst feature determines how the constant value is obtained + int const_feature_flag = GetFlag(n, "feature:cs:const"); + const char *const_readonly = const_feature_flag ? "const" : "static readonly"; String *value = enumValue(n); Printf(enum_code, " %s %s %s %s = %s;\n", methodmods, const_readonly, return_type, symname, value); @@ -1275,9 +1277,9 @@ } // Add the enum value to the comma separated list being constructed in the enum declaration. - String *enumvalues = Getattr(parentNode(n), "enumvalues"); + String *enumvalues = Getattr(parent, "enumvalues"); if (!enumvalues) - Setattr(parentNode(n), "enumvalues", Copy(symname)); + Setattr(parent, "enumvalues", Copy(symname)); else Printv(enumvalues, ", ", symname, NIL); } Modified: trunk/Source/Modules/java.cxx =================================================================== --- trunk/Source/Modules/java.cxx 2009-09-12 08:23:55 UTC (rev 11689) +++ trunk/Source/Modules/java.cxx 2009-09-13 20:20:11 UTC (rev 11690) @@ -1267,6 +1267,9 @@ String *symname = Getattr(n, "sym:name"); String *value = Getattr(n, "value"); String *name = Getattr(n, "name"); + Node *parent = parentNode(n); + int unnamedinstance = GetFlag(parent, "unnamedinstance"); + String *parent_name = Getattr(parent, "name"); String *tmpValue; // Strange hack from parent method @@ -1278,9 +1281,9 @@ Setattr(n, "value", tmpValue); { - EnumFeature enum_feature = decodeEnumFeature(parentNode(n)); + EnumFeature enum_feature = decodeEnumFeature(parent); - if ((enum_feature == ProperEnum) && Getattr(parentNode(n), "sym:name") && !Getattr(parentNode(n), "unnamedinstance")) { + if ((enum_feature == ProperEnum) && parent_name && !unnamedinstance) { // Wrap (non-anonymous) C/C++ enum with a proper Java enum // Emit the enum item. if (!GetFlag(n, "firstenumitem")) @@ -1293,18 +1296,16 @@ } } else { // Wrap C/C++ enums with constant integers or use the typesafe enum pattern - const String *parent_name = Getattr(parentNode(n), "name"); - String *typemap_lookup_type = parent_name ? Copy(parent_name) : NewString("int"); + String *type = Getattr(n, "type"); /* should be int unless explicitly specified in a C++0x enum class */ + SwigType *typemap_lookup_type = parent_name ? parent_name : type; const String *tm = typemapLookup(n, "jstype", typemap_lookup_type, WARN_JAVA_TYPEMAP_JSTYPE_UNDEF); + String *return_type = Copy(tm); - Delete(typemap_lookup_type); - typemap_lookup_type = NULL; - const String *methodmods = Getattr(n, "feature:java:methodmodifiers"); methodmods = methodmods ? methodmods : (is_public(n) ? public_string : protected_string); - if ((enum_feature == TypesafeEnum) && Getattr(parentNode(n), "sym:name") && !Getattr(parentNode(n), "unnamedinstance")) { - // Wrap (non-anonymouse) enum using the typesafe enum pattern + if ((enum_feature == TypesafeEnum) && parent_name && !unnamedinstance) { + // Wrap (non-anonymous) enum using the typesafe enum pattern if (Getattr(n, "enumvalue")) { String *value = enumValue(n); Printf(enum_code, " %s final static %s %s = new %s(\"%s\", %s);\n", methodmods, return_type, symname, return_type, symname, value); @@ -1323,9 +1324,9 @@ } // Add the enum value to the comma separated list being constructed in the enum declaration. - String *enumvalues = Getattr(parentNode(n), "enumvalues"); + String *enumvalues = Getattr(parent, "enumvalues"); if (!enumvalues) - Setattr(parentNode(n), "enumvalues", Copy(symname)); + Setattr(parent, "enumvalues", Copy(symname)); else Printv(enumvalues, ", ", symname, NIL); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wsf...@us...> - 2009-11-03 19:52:24
|
Revision: 11720 http://swig.svn.sourceforge.net/swig/?rev=11720&view=rev Author: wsfulton Date: 2009-11-03 19:52:12 +0000 (Tue, 03 Nov 2009) Log Message: ----------- Fix seg fault for some template parameters which have no type, just a default value Modified Paths: -------------- trunk/Source/CParse/parser.y trunk/Source/Swig/parms.c Modified: trunk/Source/CParse/parser.y =================================================================== --- trunk/Source/CParse/parser.y 2009-11-03 19:14:37 UTC (rev 11719) +++ trunk/Source/CParse/parser.y 2009-11-03 19:52:12 UTC (rev 11720) @@ -2644,6 +2644,7 @@ n = Swig_cparse_template_locate($5,$7,tscope); /* Patch the argument types to respect namespaces */ +Printf(stdout, " p before patching: %s\n", ParmList_str_defaultargs($7)); p = $7; while (p) { SwigType *value = Getattr(p,"value"); @@ -2669,6 +2670,7 @@ p = nextSibling(p); } +Printf(stdout, " p after patching: %s\n", ParmList_str_defaultargs($7)); /* Look for the template */ { @@ -2746,6 +2748,7 @@ def_supplied = 1; } } +Printf(stdout, " p tempar patching: %s\n", ParmList_str_defaultargs(temparms)); templnode = copy_node(nn); /* We need to set the node name based on name used to instantiate */ Modified: trunk/Source/Swig/parms.c =================================================================== --- trunk/Source/Swig/parms.c 2009-11-03 19:14:37 UTC (rev 11719) +++ trunk/Source/Swig/parms.c 2009-11-03 19:52:12 UTC (rev 11720) @@ -115,6 +115,14 @@ } /* --------------------------------------------------------------------- + * get_empty_type() + * ---------------------------------------------------------------------- */ + +static SwigType *get_empty_type() { + return NewStringEmpty(); +} + +/* --------------------------------------------------------------------- * ParmList_str() * * Generates a string of parameters @@ -123,7 +131,8 @@ String *ParmList_str(ParmList *p) { String *out = NewStringEmpty(); while (p) { - String *pstr = SwigType_str(Getattr(p, "type"), Getattr(p, "name")); + String *type = Getattr(p, "type"); + String *pstr = SwigType_str(type ? type : get_empty_type(), Getattr(p, "name")); Append(out, pstr); p = nextSibling(p); if (p) { @@ -144,7 +153,8 @@ String *out = NewStringEmpty(); while (p) { String *value = Getattr(p, "value"); - String *pstr = SwigType_str(Getattr(p, "type"), Getattr(p, "name")); + String *type = Getattr(p, "type"); + String *pstr = SwigType_str(type ? type : get_empty_type(), Getattr(p, "name")); Append(out, pstr); if (value) { Printf(out, "=%s", value); @@ -167,7 +177,8 @@ String *ParmList_protostr(ParmList *p) { String *out = NewStringEmpty(); while (p) { - String *pstr = SwigType_str(Getattr(p, "type"), 0); + String *type = Getattr(p, "type"); + String *pstr = SwigType_str(type ? type : get_empty_type(), 0); Append(out, pstr); p = nextSibling(p); if (p) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wsf...@us...> - 2010-01-29 18:49:47
|
Revision: 11834 http://swig.svn.sourceforge.net/swig/?rev=11834&view=rev Author: wsfulton Date: 2010-01-29 18:49:16 +0000 (Fri, 29 Jan 2010) Log Message: ----------- Slight performance tweak for templates Modified Paths: -------------- trunk/Source/CParse/parser.y trunk/Source/Modules/allegrocl.cxx trunk/Source/Swig/naming.c trunk/Source/Swig/typesys.c Modified: trunk/Source/CParse/parser.y =================================================================== --- trunk/Source/CParse/parser.y 2010-01-29 06:55:38 UTC (rev 11833) +++ trunk/Source/CParse/parser.y 2010-01-29 18:49:16 UTC (rev 11834) @@ -211,9 +211,9 @@ } static String *feature_identifier_fix(String *s) { - if (SwigType_istemplate(s)) { - String *tp, *ts, *ta, *tq; - tp = SwigType_templateprefix(s); + String *tp = SwigType_istemplate_templateprefix(s); + if (tp) { + String *ts, *ta, *tq; ts = SwigType_templatesuffix(s); ta = SwigType_templateargs(s); tq = Swig_symbol_type_qualify(ta,0); @@ -756,14 +756,15 @@ static String *make_class_name(String *name) { String *nname = 0; + String *prefix; if (Namespaceprefix) { nname= NewStringf("%s::%s", Namespaceprefix, name); } else { nname = NewString(name); } - if (SwigType_istemplate(nname)) { - String *prefix, *args, *qargs; - prefix = SwigType_templateprefix(nname); + prefix = SwigType_istemplate_templateprefix(nname); + if (prefix) { + String *args, *qargs; args = SwigType_templateargs(nname); qargs = Swig_symbol_type_qualify(args,0); Append(prefix,qargs); @@ -3380,6 +3381,7 @@ /* A simple class/struct/union definition */ cpp_class_decl : storage_class cpptype idcolon inherit LBRACE { if (nested_template == 0) { + String *prefix; List *bases = 0; Node *scope = 0; $<node>$ = new_node("class"); @@ -3428,9 +3430,9 @@ if ($4) { bases = make_inherit_list($3,Getattr($4,"public")); } - if (SwigType_istemplate($3)) { - String *fbase, *tbase, *prefix; - prefix = SwigType_templateprefix($3); + prefix = SwigType_istemplate_templateprefix($3); + if (prefix) { + String *fbase, *tbase; if (Namespaceprefix) { fbase = NewStringf("%s::%s", Namespaceprefix,$3); tbase = NewStringf("%s::%s", Namespaceprefix, prefix); @@ -3441,7 +3443,6 @@ Swig_name_inherit(tbase,fbase); Delete(fbase); Delete(tbase); - Delete(prefix); } if (strcmp($2,"class") == 0) { cplus_mode = CPLUS_PRIVATE; @@ -3492,6 +3493,7 @@ } } class_decl[class_level++] = $<node>$; + Delete(prefix); inclass = 1; } } cpp_members RBRACE cpp_opt_declarators { Modified: trunk/Source/Modules/allegrocl.cxx =================================================================== --- trunk/Source/Modules/allegrocl.cxx 2010-01-29 06:55:38 UTC (rev 11833) +++ trunk/Source/Modules/allegrocl.cxx 2010-01-29 18:49:16 UTC (rev 11834) @@ -374,9 +374,12 @@ // Swig_print_node(n); } - if (SwigType_istemplate(name)) { - String *temp = strip_namespaces(SwigType_templateprefix(name)); + String *tname = SwigType_istemplate_templateprefix(name); + if (tname) { + String *temp = strip_namespaces(tname); name = NewStringf("%s%s%s", temp, SwigType_templateargs(name), SwigType_templatesuffix(name)); + Delete(temp); + Delete(tname); } val = lookup_defined_foreign_type(k); @@ -1085,11 +1088,12 @@ if (Getattr(n, "allegrocl:synonym:already-been-stubbed")) return; - if (SwigType_istemplate(name)) { - String *temp = strip_namespaces(SwigType_templateprefix(name)); + String *tname = SwigType_istemplate_templateprefix(name); + if (tname) { + String *temp = strip_namespaces(tname); name = NewStringf("%s%s%s", temp, SwigType_templateargs(name), SwigType_templatesuffix(name)); - Delete(temp); + Delete(tname); } else { name = strip_namespaces(name); } @@ -1276,11 +1280,12 @@ String *ns_list = listify_namespace(Getattr(n, "allegrocl:namespace")); String *name = Getattr(n, is_tempInst ? "real-name" : "name"); - if (SwigType_istemplate(name)) { - String *temp = strip_namespaces(SwigType_templateprefix(name)); + String *tname = SwigType_istemplate_templateprefix(name); + if (tname) { + String *temp = strip_namespaces(tname); name = NewStringf("%s%s%s", temp, SwigType_templateargs(name), SwigType_templatesuffix(name)); - Delete(temp); + Delete(tname); } else { name = strip_namespaces(name); } @@ -1335,10 +1340,12 @@ if (in_class) { String *class_name = Getattr(in_class, "name"); - if (SwigType_istemplate(class_name)) { - String *temp = strip_namespaces(SwigType_templateprefix(class_name)); + String *tname = SwigType_istemplate_templateprefix(class_name); + if (tname) { + String *temp = strip_namespaces(tname); class_name = NewStringf("%s%s%s", temp, SwigType_templateargs(class_name), SwigType_templatesuffix(class_name)); Delete(temp); + Delete(tname); } name = NewStringf("%s__%s", class_name, sym_name); Modified: trunk/Source/Swig/naming.c =================================================================== --- trunk/Source/Swig/naming.c 2010-01-29 06:55:38 UTC (rev 11833) +++ trunk/Source/Swig/naming.c 2010-01-29 18:49:16 UTC (rev 11834) @@ -474,25 +474,12 @@ Delete(cls); } /* A template-based class lookup, check name first */ - if (!rn && SwigType_istemplate(name)) { - String *t_name = SwigType_templateprefix(name); - if (!Equal(t_name, name)) { + if (!rn) { + String *t_name = SwigType_istemplate_templateprefix(name); + if (t_name) rn = Swig_name_object_get(namehash, prefix, t_name, decl); - } Delete(t_name); } - /* A template-based class lookup */ - /* - if (!rn && SwigType_istemplate(prefix)) { - String *t_prefix = SwigType_templateprefix(prefix); - if (Strcmp(t_prefix, prefix) != 0) { - String *t_name = SwigType_templateprefix(name); - rn = Swig_name_object_get(namehash, t_prefix, t_name, decl); - Delete(t_name); - } - Delete(t_prefix); - } - */ } /* A wildcard-based class lookup */ if (!rn) { @@ -663,10 +650,9 @@ if (name) { String *tname = NewStringEmpty(); /* add features for 'root' template */ - if (SwigType_istemplate(name)) { - String *dname = SwigType_templateprefix(name); + String *dname = SwigType_istemplate_templateprefix(name); + if (dname) { features_get(features, dname, decl, ncdecl, node); - Delete(dname); } /* Catch-all */ features_get(features, name, decl, ncdecl, node); @@ -684,16 +670,16 @@ /* A specific class lookup */ if (Len(prefix)) { /* A template-based class lookup */ - if (SwigType_istemplate(prefix)) { - String *tprefix = SwigType_templateprefix(prefix); + String *tprefix = SwigType_istemplate_templateprefix(prefix); + if (tprefix) { Clear(tname); Printf(tname, "%s::%s", tprefix, name); features_get(features, tname, decl, ncdecl, node); - Delete(tprefix); } Clear(tname); Printf(tname, "%s::%s", prefix, name); features_get(features, tname, decl, ncdecl, node); + Delete(tprefix); } } else { /* Lookup in the global namespace only */ @@ -702,6 +688,7 @@ features_get(features, tname, decl, ncdecl, node); } Delete(tname); + Delete(dname); } if (name && SwigType_istemplate(name)) { /* add features for complete template type */ Modified: trunk/Source/Swig/typesys.c =================================================================== --- trunk/Source/Swig/typesys.c 2010-01-29 06:55:38 UTC (rev 11833) +++ trunk/Source/Swig/typesys.c 2010-01-29 18:49:16 UTC (rev 11834) @@ -1161,9 +1161,9 @@ isclass = 1; } /* Hmmm. Not a class. If a template, it might be uninstantiated */ - if (!isclass && SwigType_istemplate(qtys)) { - String *tp = SwigType_templateprefix(qtys); - if (Strcmp(tp, t) != 0) { + if (!isclass) { + String *tp = SwigType_istemplate_templateprefix(qtys); + if (tp && Strcmp(tp, t) != 0) { isclass = SwigType_isclass(tp); } Delete(tp); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wsf...@us...> - 2010-02-12 23:21:05
|
Revision: 11855 http://swig.svn.sourceforge.net/swig/?rev=11855&view=rev Author: wsfulton Date: 2010-02-12 23:20:58 +0000 (Fri, 12 Feb 2010) Log Message: ----------- Add in possibility to use scopes in target language module symbol table Modified Paths: -------------- trunk/Source/Modules/lang.cxx trunk/Source/Modules/main.cxx trunk/Source/Modules/swigmod.h trunk/Source/Swig/symbol.c Modified: trunk/Source/Modules/lang.cxx =================================================================== --- trunk/Source/Modules/lang.cxx 2010-02-11 22:56:39 UTC (rev 11854) +++ trunk/Source/Modules/lang.cxx 2010-02-12 23:20:58 UTC (rev 11855) @@ -307,15 +307,15 @@ none_comparison(NewString("$arg != 0")), director_ctor_code(NewString("")), director_prot_ctor_code(0), -symbols(NewHash()), -symbolDump(NewString("")), +symtabs(NewHash()), classtypes(NewHash()), enumtypes(NewHash()), overloading(0), multiinput(0), cplus_runtime(0), -directors(0), -symbol_table_dump(0) { +directors(0) { + Hash *symbols = NewHash(); + Setattr(symtabs, "", symbols); // create top level/global symbol table scope argc_template_string = NewString("argc"); argv_template_string = NewString("argv[%d]"); @@ -334,8 +334,7 @@ } Language::~Language() { - Delete(symbols); - Delete(symbolDump); + Delete(symtabs); Delete(classtypes); Delete(enumtypes); Delete(director_ctor_code); @@ -1140,7 +1139,7 @@ Setattr(n, "type", cbty); Setattr(n, "value", calltype); - Node *ns = Getattr(symbols, cbname); + Node *ns = symbolLookup(cbname); if (!ns) constantWrapper(n); @@ -2462,7 +2461,7 @@ continue; String *methodname = Getattr(method, "sym:name"); String *wrapname = NewStringf("%s_%s", symname, methodname); - if (!Getattr(symbols, wrapname) && (!is_public(method))) { + if (!symbolLookup(wrapname, "") && (!is_public(method))) { Node *m = Copy(method); Setattr(m, "director", "1"); Setattr(m, "parentNode", n); @@ -2915,20 +2914,34 @@ /* ----------------------------------------------------------------------------- * Language::addSymbol() * - * Adds a symbol entry. Returns 1 if the symbol is added successfully. + * Adds a symbol entry into the target language symbol tables. + * Returns 1 if the symbol is added successfully. * Prints an error message and returns 0 if a conflict occurs. + * The scope is optional for target languages and if supplied must be a fully + * resolved scope and the symbol s must not contain any scope qualifiers. * ----------------------------------------------------------------------------- */ -int Language::addSymbol(const String *s, const Node *n) { - Node *c = Getattr(symbols, s); - if (c && (c != n)) { - Swig_error(input_file, line_number, "'%s' is multiply defined in the generated target language module.\n", s); - Swig_error(Getfile(c), Getline(c), "Previous declaration of '%s'\n", s); - return 0; +int Language::addSymbol(const String *s, const Node *n, const_String_or_char_ptr scope) { + Hash *symbols = Getattr(symtabs, scope); + if (!symbols) { + // New scope which has not been added by the target language - lazily created. + symbols = NewHash(); + Setattr(symtabs, scope, symbols); + + // Add the new scope as a symbol in the top level scope. + // Alternatively the target language must add it in before attempting to add symbols into the scope. + const_String_or_char_ptr top_scope = ""; + Hash *topscope_symbols = Getattr(symtabs, top_scope); + Setattr(topscope_symbols, scope, NewHash()); + } else { + Node *c = Getattr(symbols, s); + if (c && (c != n)) { + Swig_error(input_file, line_number, "'%s' is multiply defined in the generated target language module.\n", s); + Swig_error(Getfile(c), Getline(c), "Previous declaration of '%s'\n", s); + return 0; + } } Setattr(symbols, s, n); - if (symbol_table_dump) - Printf(symbolDump, "%s\n", s); return 1; } @@ -2937,22 +2950,35 @@ * ----------------------------------------------------------------------------- */ void Language::dumpSymbols() { - if (symbol_table_dump) { - Printf(stdout, "LANGUAGE SYMBOLS start =======================================\n"); + Printf(stdout, "LANGUAGE SYMBOLS start =======================================\n"); - /* The symbol table is a hash so no ordering is possible if we iterate through it. - * Instead we gather the symbols as they are added and display them here. */ - Printf(stdout, "%s", symbolDump); + Node *table = symtabs; + Iterator ki = First(table); + while (ki.key) { + String *k = ki.key; + Printf(stdout, "===================================================\n"); + Printf(stdout, "%s -\n", k); + { + Symtab *symtab = Getattr(table, k); + Iterator it = First(symtab); + while (it.key) { + String *symname = it.key; + Printf(stdout, " %s\n", symname); + it = Next(it); + } + } + ki = Next(ki); + } - Printf(stdout, "LANGUAGE SYMBOLS finish =======================================\n"); - } + Printf(stdout, "LANGUAGE SYMBOLS finish =======================================\n"); } /* ----------------------------------------------------------------------------- * Language::symbolLookup() * ----------------------------------------------------------------------------- */ -Node *Language::symbolLookup(String *s) { +Node *Language::symbolLookup(String *s, const_String_or_char_ptr scope) { + Hash *symbols = Getattr(symtabs, scope); return Getattr(symbols, s); } @@ -3396,10 +3422,6 @@ argv_template_string = Copy(argv); } -void Language::setSymbolsDumpNeeded() { - symbol_table_dump = 1; -} - int Language::is_assignable(Node *n) { if (GetFlag(n, "feature:immutable")) return 0; Modified: trunk/Source/Modules/main.cxx =================================================================== --- trunk/Source/Modules/main.cxx 2010-02-11 22:56:39 UTC (rev 11854) +++ trunk/Source/Modules/main.cxx 2010-02-12 23:20:58 UTC (rev 11855) @@ -908,9 +908,6 @@ SWIG_getoptions(argc, argv); - if (dump_lang_symbols) - lang->setSymbolsDumpNeeded(); - // Define the __cplusplus symbol if (CPlusPlus) Preprocessor_define((DOH *) "__cplusplus __cplusplus", 0); Modified: trunk/Source/Modules/swigmod.h =================================================================== --- trunk/Source/Modules/swigmod.h 2010-02-11 22:56:39 UTC (rev 11854) +++ trunk/Source/Modules/swigmod.h 2010-02-12 23:20:58 UTC (rev 11855) @@ -208,9 +208,9 @@ /* Miscellaneous */ virtual int validIdentifier(String *s); /* valid identifier? */ - virtual int addSymbol(const String *s, const Node *n); /* Add symbol */ + virtual int addSymbol(const String *s, const Node *n, const_String_or_char_ptr scope = ""); /* Add symbol */ virtual void dumpSymbols(); - virtual Node *symbolLookup(String *s); /* Symbol lookup */ + virtual Node *symbolLookup(String *s, const_String_or_char_ptr scope = ""); /* Symbol lookup */ virtual Node *classLookup(SwigType *s); /* Class lookup */ virtual Node *enumLookup(SwigType *s); /* Enum lookup */ virtual int abstractClassTest(Node *n); /* Is class really abstract? */ @@ -252,9 +252,6 @@ /* Set overload variable templates argc and argv */ void setOverloadResolutionTemplates(String *argc, String *argv); - /* Set language module symbol table dump option */ - void setSymbolsDumpNeeded(); - /* Language instance is a singleton - get instance */ static Language* instance(); @@ -308,15 +305,13 @@ int director_language; private: - Hash *symbols; - String *symbolDump; + Hash *symtabs; /* symbol tables */ Hash *classtypes; Hash *enumtypes; int overloading; int multiinput; int cplus_runtime; int directors; - int symbol_table_dump; static Language *this_; }; Modified: trunk/Source/Swig/symbol.c =================================================================== --- trunk/Source/Swig/symbol.c 2010-02-11 22:56:39 UTC (rev 11854) +++ trunk/Source/Swig/symbol.c 2010-02-12 23:20:58 UTC (rev 11855) @@ -207,14 +207,14 @@ * ----------------------------------------------------------------------------- */ static void symbol_print_symbols(const char *symboltabletype) { - Node *obj = symtabs; - Iterator ki = First(obj); + Node *table = symtabs; + Iterator ki = First(table); while (ki.key) { String *k = ki.key; Printf(stdout, "===================================================\n"); Printf(stdout, "%s -\n", k); { - Symtab *symtab = Getattr(Getattr(obj, k), symboltabletype); + Symtab *symtab = Getattr(Getattr(table, k), symboltabletype); Iterator it = First(symtab); while (it.key) { String *symname = it.key; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wsf...@us...> - 2010-02-27 23:53:40
|
Revision: 11876 http://swig.svn.sourceforge.net/swig/?rev=11876&view=rev Author: wsfulton Date: 2010-02-27 23:53:33 +0000 (Sat, 27 Feb 2010) Log Message: ----------- SWIG license change - Source moves to GPLv3 Modified Paths: -------------- trunk/Source/CParse/cparse.h trunk/Source/CParse/cscanner.c trunk/Source/CParse/parser.y trunk/Source/CParse/templ.c trunk/Source/CParse/util.c trunk/Source/DOH/base.c trunk/Source/DOH/doh.h trunk/Source/DOH/dohint.h trunk/Source/DOH/file.c trunk/Source/DOH/fio.c trunk/Source/DOH/hash.c trunk/Source/DOH/list.c trunk/Source/DOH/memory.c trunk/Source/DOH/string.c trunk/Source/DOH/void.c trunk/Source/Include/swigwarn.h trunk/Source/Modules/allegrocl.cxx trunk/Source/Modules/allocate.cxx trunk/Source/Modules/browser.cxx trunk/Source/Modules/cffi.cxx trunk/Source/Modules/chicken.cxx trunk/Source/Modules/clisp.cxx trunk/Source/Modules/contract.cxx trunk/Source/Modules/csharp.cxx trunk/Source/Modules/directors.cxx trunk/Source/Modules/emit.cxx trunk/Source/Modules/guile.cxx trunk/Source/Modules/java.cxx trunk/Source/Modules/lang.cxx trunk/Source/Modules/lua.cxx trunk/Source/Modules/main.cxx trunk/Source/Modules/modula3.cxx trunk/Source/Modules/module.cxx trunk/Source/Modules/mzscheme.cxx trunk/Source/Modules/ocaml.cxx trunk/Source/Modules/octave.cxx trunk/Source/Modules/overload.cxx trunk/Source/Modules/perl5.cxx trunk/Source/Modules/php.cxx trunk/Source/Modules/pike.cxx trunk/Source/Modules/python.cxx trunk/Source/Modules/r.cxx trunk/Source/Modules/ruby.cxx trunk/Source/Modules/s-exp.cxx trunk/Source/Modules/swigmain.cxx trunk/Source/Modules/swigmod.h trunk/Source/Modules/tcl8.cxx trunk/Source/Modules/typepass.cxx trunk/Source/Modules/uffi.cxx trunk/Source/Modules/utils.cxx trunk/Source/Modules/xml.cxx trunk/Source/Preprocessor/cpp.c trunk/Source/Preprocessor/expr.c trunk/Source/Preprocessor/preprocessor.h trunk/Source/Swig/cwrap.c trunk/Source/Swig/deprecate.c trunk/Source/Swig/error.c trunk/Source/Swig/fragment.c trunk/Source/Swig/getopt.c trunk/Source/Swig/include.c trunk/Source/Swig/misc.c trunk/Source/Swig/naming.c trunk/Source/Swig/parms.c trunk/Source/Swig/scanner.c trunk/Source/Swig/stype.c trunk/Source/Swig/swig.h trunk/Source/Swig/swigfile.h trunk/Source/Swig/swigopt.h trunk/Source/Swig/swigparm.h trunk/Source/Swig/swigscan.h trunk/Source/Swig/swigtree.h trunk/Source/Swig/swigwrap.h trunk/Source/Swig/symbol.c trunk/Source/Swig/tree.c trunk/Source/Swig/typemap.c trunk/Source/Swig/typeobj.c trunk/Source/Swig/typesys.c trunk/Source/Swig/wrapfunc.c Modified: trunk/Source/CParse/cparse.h =================================================================== --- trunk/Source/CParse/cparse.h 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/CParse/cparse.h 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * cparse.h * Modified: trunk/Source/CParse/cscanner.c =================================================================== --- trunk/Source/CParse/cscanner.c 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/CParse/cscanner.c 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * scanner.c * Modified: trunk/Source/CParse/parser.y =================================================================== --- trunk/Source/CParse/parser.y 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/CParse/parser.y 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * parser.y * Modified: trunk/Source/CParse/templ.c =================================================================== --- trunk/Source/CParse/templ.c 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/CParse/templ.c 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * templ.c * Modified: trunk/Source/CParse/util.c =================================================================== --- trunk/Source/CParse/util.c 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/CParse/util.c 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * util.c * Modified: trunk/Source/DOH/base.c =================================================================== --- trunk/Source/DOH/base.c 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/DOH/base.c 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,13 +1,15 @@ /* ----------------------------------------------------------------------------- + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. + * * base.c * * This file contains the function entry points for dispatching methods on * DOH objects. A number of small utility functions are also included. - * - * Author(s) : David Beazley (be...@cs...) - * - * Copyright (C) 1999-2000. The University of Chicago - * See the file LICENSE for information on usage and redistribution. * ----------------------------------------------------------------------------- */ char cvsroot_base_c[] = "$Id$"; Modified: trunk/Source/DOH/doh.h =================================================================== --- trunk/Source/DOH/doh.h 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/DOH/doh.h 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,14 +1,14 @@ /* ----------------------------------------------------------------------------- + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. + * * doh.h * * This file describes of the externally visible functions in DOH. - * - * Author(s) : David Beazley (be...@cs...) - * - * Copyright (C) 1999-2000. The University of Chicago - * See the file LICENSE for information on usage and redistribution. - * - * $Id$ * ----------------------------------------------------------------------------- */ #ifndef _DOH_H Modified: trunk/Source/DOH/dohint.h =================================================================== --- trunk/Source/DOH/dohint.h 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/DOH/dohint.h 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,15 +1,14 @@ - /* ----------------------------------------------------------------------------- + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. + * * dohint.h * * This file describes internally managed objects. - * - * Author(s) : David Beazley (be...@cs...) - * - * Copyright (C) 1999-2000. The University of Chicago - * See the file LICENSE for information on usage and redistribution. - * - * $Id$ * ----------------------------------------------------------------------------- */ #ifndef _DOHINT_H Modified: trunk/Source/DOH/file.c =================================================================== --- trunk/Source/DOH/file.c 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/DOH/file.c 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,13 +1,15 @@ /* ----------------------------------------------------------------------------- + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. + * * file.c * * This file implements a file-like object that can be built around an * ordinary FILE * or integer file descriptor. - * - * Author(s) : David Beazley (be...@cs...) - * - * Copyright (C) 1999-2000. The University of Chicago - * See the file LICENSE for information on usage and redistribution. * ----------------------------------------------------------------------------- */ char cvsroot_file_c[] = "$Id$"; Modified: trunk/Source/DOH/fio.c =================================================================== --- trunk/Source/DOH/fio.c 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/DOH/fio.c 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,13 +1,15 @@ /* ----------------------------------------------------------------------------- + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. + * * fio.c * * This file implements a number of standard I/O operations included * formatted output, readline, and splitting. - * - * Author(s) : David Beazley (be...@cs...) - * - * Copyright (C) 1999-2000. The University of Chicago - * See the file LICENSE for information on usage and redistribution. * ----------------------------------------------------------------------------- */ char cvsroot_fio_c[] = "$Id$"; Modified: trunk/Source/DOH/hash.c =================================================================== --- trunk/Source/DOH/hash.c 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/DOH/hash.c 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,12 +1,14 @@ /* ----------------------------------------------------------------------------- + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. + * * hash.c * * Implements a simple hash table object. - * - * Author(s) : David Beazley (be...@cs...) - * - * Copyright (C) 1999-2000. The University of Chicago - * See the file LICENSE for information on usage and redistribution. * ----------------------------------------------------------------------------- */ char cvsroot_hash_c[] = "$Id$"; Modified: trunk/Source/DOH/list.c =================================================================== --- trunk/Source/DOH/list.c 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/DOH/list.c 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,12 +1,14 @@ /* ----------------------------------------------------------------------------- + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. + * * list.c * * Implements a simple list object. - * - * Author(s) : David Beazley (be...@cs...) - * - * Copyright (C) 1999-2000. The University of Chicago - * See the file LICENSE for information on usage and redistribution. * ----------------------------------------------------------------------------- */ char cvsroot_list_c[] = "$Id$"; Modified: trunk/Source/DOH/memory.c =================================================================== --- trunk/Source/DOH/memory.c 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/DOH/memory.c 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,13 +1,15 @@ /* ----------------------------------------------------------------------------- + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. + * * memory.c * * This file implements all of DOH's memory management including allocation * of objects and checking of objects. - * - * Author(s) : David Beazley (be...@cs...) - * - * Copyright (C) 1999-2000. The University of Chicago - * See the file LICENSE for information on usage and redistribution. * ----------------------------------------------------------------------------- */ char cvsroot_memory_c[] = "$Id$"; Modified: trunk/Source/DOH/string.c =================================================================== --- trunk/Source/DOH/string.c 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/DOH/string.c 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,13 +1,15 @@ /* ----------------------------------------------------------------------------- + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. + * * string.c * * Implements a string object that supports both sequence operations and * file semantics. - * - * Author(s) : David Beazley (be...@cs...) - * - * Copyright (C) 1999-2000. The University of Chicago - * See the file LICENSE for information on usage and redistribution. * ----------------------------------------------------------------------------- */ char cvsroot_string_c[] = "$Id$"; Modified: trunk/Source/DOH/void.c =================================================================== --- trunk/Source/DOH/void.c 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/DOH/void.c 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,13 +1,15 @@ /* ----------------------------------------------------------------------------- + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. + * * void.c * * Implements a "void" object that is really just a DOH container around * an arbitrary C object represented as a void *. - * - * Author(s) : David Beazley (be...@cs...) - * - * Copyright (C) 1999-2000. The University of Chicago - * See the file LICENSE for information on usage and redistribution. * ----------------------------------------------------------------------------- */ char cvsroot_void_c[] = "$Id$"; Modified: trunk/Source/Include/swigwarn.h =================================================================== --- trunk/Source/Include/swigwarn.h 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/Include/swigwarn.h 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * swigwarn.h * Modified: trunk/Source/Modules/allegrocl.cxx =================================================================== --- trunk/Source/Modules/allegrocl.cxx 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/Modules/allegrocl.cxx 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * allegrocl.cxx * Modified: trunk/Source/Modules/allocate.cxx =================================================================== --- trunk/Source/Modules/allocate.cxx 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/Modules/allocate.cxx 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * allocate.cxx * Modified: trunk/Source/Modules/browser.cxx =================================================================== --- trunk/Source/Modules/browser.cxx 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/Modules/browser.cxx 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * browser.cxx * Modified: trunk/Source/Modules/cffi.cxx =================================================================== --- trunk/Source/Modules/cffi.cxx 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/Modules/cffi.cxx 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * cffi.cxx * Modified: trunk/Source/Modules/chicken.cxx =================================================================== --- trunk/Source/Modules/chicken.cxx 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/Modules/chicken.cxx 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * chicken.cxx * Modified: trunk/Source/Modules/clisp.cxx =================================================================== --- trunk/Source/Modules/clisp.cxx 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/Modules/clisp.cxx 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * clisp.cxx * Modified: trunk/Source/Modules/contract.cxx =================================================================== --- trunk/Source/Modules/contract.cxx 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/Modules/contract.cxx 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * contract.cxx * Modified: trunk/Source/Modules/csharp.cxx =================================================================== --- trunk/Source/Modules/csharp.cxx 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/Modules/csharp.cxx 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * csharp.cxx * Modified: trunk/Source/Modules/directors.cxx =================================================================== --- trunk/Source/Modules/directors.cxx 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/Modules/directors.cxx 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * directors.cxx * Modified: trunk/Source/Modules/emit.cxx =================================================================== --- trunk/Source/Modules/emit.cxx 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/Modules/emit.cxx 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * emit.cxx * Modified: trunk/Source/Modules/guile.cxx =================================================================== --- trunk/Source/Modules/guile.cxx 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/Modules/guile.cxx 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * guile.cxx * Modified: trunk/Source/Modules/java.cxx =================================================================== --- trunk/Source/Modules/java.cxx 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/Modules/java.cxx 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * java.cxx * Modified: trunk/Source/Modules/lang.cxx =================================================================== --- trunk/Source/Modules/lang.cxx 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/Modules/lang.cxx 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * lang.cxx * Modified: trunk/Source/Modules/lua.cxx =================================================================== --- trunk/Source/Modules/lua.cxx 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/Modules/lua.cxx 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * lua.cxx * Modified: trunk/Source/Modules/main.cxx =================================================================== --- trunk/Source/Modules/main.cxx 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/Modules/main.cxx 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * main.cxx * Modified: trunk/Source/Modules/modula3.cxx =================================================================== --- trunk/Source/Modules/modula3.cxx 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/Modules/modula3.cxx 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * modula3.cxx * Modified: trunk/Source/Modules/module.cxx =================================================================== --- trunk/Source/Modules/module.cxx 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/Modules/module.cxx 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * module.cxx * Modified: trunk/Source/Modules/mzscheme.cxx =================================================================== --- trunk/Source/Modules/mzscheme.cxx 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/Modules/mzscheme.cxx 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * mzscheme.cxx * Modified: trunk/Source/Modules/ocaml.cxx =================================================================== --- trunk/Source/Modules/ocaml.cxx 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/Modules/ocaml.cxx 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * ocaml.cxx * Modified: trunk/Source/Modules/octave.cxx =================================================================== --- trunk/Source/Modules/octave.cxx 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/Modules/octave.cxx 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * octave.cxx * Modified: trunk/Source/Modules/overload.cxx =================================================================== --- trunk/Source/Modules/overload.cxx 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/Modules/overload.cxx 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * overload.cxx * Modified: trunk/Source/Modules/perl5.cxx =================================================================== --- trunk/Source/Modules/perl5.cxx 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/Modules/perl5.cxx 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,10 +1,10 @@ -/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*- - * vim:expandtab:shiftwidth=2:tabstop=8:smarttab: - */ - /* ---------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * perl5.cxx * Modified: trunk/Source/Modules/php.cxx =================================================================== --- trunk/Source/Modules/php.cxx 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/Modules/php.cxx 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * php.cxx * Modified: trunk/Source/Modules/pike.cxx =================================================================== --- trunk/Source/Modules/pike.cxx 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/Modules/pike.cxx 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * pike.cxx * Modified: trunk/Source/Modules/python.cxx =================================================================== --- trunk/Source/Modules/python.cxx 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/Modules/python.cxx 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * python.cxx * Modified: trunk/Source/Modules/r.cxx =================================================================== --- trunk/Source/Modules/r.cxx 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/Modules/r.cxx 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * r.cxx * Modified: trunk/Source/Modules/ruby.cxx =================================================================== --- trunk/Source/Modules/ruby.cxx 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/Modules/ruby.cxx 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * ruby.cxx * Modified: trunk/Source/Modules/s-exp.cxx =================================================================== --- trunk/Source/Modules/s-exp.cxx 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/Modules/s-exp.cxx 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * s-exp.cxx * Modified: trunk/Source/Modules/swigmain.cxx =================================================================== --- trunk/Source/Modules/swigmain.cxx 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/Modules/swigmain.cxx 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,11 +1,15 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * + * swigmain.cxx + * * Simplified Wrapper and Interface Generator (SWIG) * - * swigmain.cxx - * * This file is the main entry point to SWIG. It collects the command * line options, registers built-in language modules, and instantiates * a module for code generation. If adding new language modules Modified: trunk/Source/Modules/swigmod.h =================================================================== --- trunk/Source/Modules/swigmod.h 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/Modules/swigmod.h 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * swigmod.h * Modified: trunk/Source/Modules/tcl8.cxx =================================================================== --- trunk/Source/Modules/tcl8.cxx 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/Modules/tcl8.cxx 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * tcl8.cxx * Modified: trunk/Source/Modules/typepass.cxx =================================================================== --- trunk/Source/Modules/typepass.cxx 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/Modules/typepass.cxx 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * typepass.cxx * Modified: trunk/Source/Modules/uffi.cxx =================================================================== --- trunk/Source/Modules/uffi.cxx 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/Modules/uffi.cxx 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * uffi.cxx * Modified: trunk/Source/Modules/utils.cxx =================================================================== --- trunk/Source/Modules/utils.cxx 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/Modules/utils.cxx 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * utils.cxx * Modified: trunk/Source/Modules/xml.cxx =================================================================== --- trunk/Source/Modules/xml.cxx 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/Modules/xml.cxx 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * xml.cxx * Modified: trunk/Source/Preprocessor/cpp.c =================================================================== --- trunk/Source/Preprocessor/cpp.c 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/Preprocessor/cpp.c 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * cpp.c * Modified: trunk/Source/Preprocessor/expr.c =================================================================== --- trunk/Source/Preprocessor/expr.c 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/Preprocessor/expr.c 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * expr.c * Modified: trunk/Source/Preprocessor/preprocessor.h =================================================================== --- trunk/Source/Preprocessor/preprocessor.h 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/Preprocessor/preprocessor.h 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * preprocessor.h * Modified: trunk/Source/Swig/cwrap.c =================================================================== --- trunk/Source/Swig/cwrap.c 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/Swig/cwrap.c 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * cwrap.c * Modified: trunk/Source/Swig/deprecate.c =================================================================== --- trunk/Source/Swig/deprecate.c 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/Swig/deprecate.c 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * deprecate.c * Modified: trunk/Source/Swig/error.c =================================================================== --- trunk/Source/Swig/error.c 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/Swig/error.c 2010-02-27 23:53:33 UTC (rev 11876) @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * error.c * Modified: trunk/Source/Swig/fragment.c =================================================================== --- trunk/Source/Swig/fragment.c 2010-02-27 23:29:39 UTC (rev 11875) +++ trunk/Source/Swig/fragment.c 2010-02-2... [truncated message content] |
From: <ol...@us...> - 2010-05-21 07:10:19
|
Revision: 12034 http://swig.svn.sourceforge.net/swig/?rev=12034&view=rev Author: olly Date: 2010-05-21 07:10:12 +0000 (Fri, 21 May 2010) Log Message: ----------- Remove superfluous semicolons. Modified Paths: -------------- trunk/Source/Modules/chicken.cxx trunk/Source/Modules/csharp.cxx trunk/Source/Modules/guile.cxx trunk/Source/Modules/java.cxx trunk/Source/Modules/mzscheme.cxx trunk/Source/Modules/ocaml.cxx trunk/Source/Modules/octave.cxx trunk/Source/Preprocessor/cpp.c trunk/Source/Swig/scanner.c Modified: trunk/Source/Modules/chicken.cxx =================================================================== --- trunk/Source/Modules/chicken.cxx 2010-05-21 07:07:15 UTC (rev 12033) +++ trunk/Source/Modules/chicken.cxx 2010-05-21 07:10:12 UTC (rev 12034) @@ -677,7 +677,7 @@ String *wname = NewString(""); String *mangle = NewString(""); String *tm; - String *tm2 = NewString("");; + String *tm2 = NewString(""); String *argnum = NewString("0"); String *arg = NewString("argv[0]"); Wrapper *f; Modified: trunk/Source/Modules/csharp.cxx =================================================================== --- trunk/Source/Modules/csharp.cxx 2010-05-21 07:07:15 UTC (rev 12033) +++ trunk/Source/Modules/csharp.cxx 2010-05-21 07:10:12 UTC (rev 12034) @@ -3886,7 +3886,7 @@ int classDirectorConstructor(Node *n) { Node *parent = parentNode(n); - String *decl = Getattr(n, "decl");; + String *decl = Getattr(n, "decl"); String *supername = Swig_class_name(parent); String *classname = directorClassName(parent); String *sub = NewString(""); Modified: trunk/Source/Modules/guile.cxx =================================================================== --- trunk/Source/Modules/guile.cxx 2010-05-21 07:07:15 UTC (rev 12033) +++ trunk/Source/Modules/guile.cxx 2010-05-21 07:10:12 UTC (rev 12034) @@ -657,7 +657,7 @@ Parm *p; String *proc_name = 0; char source[256]; - Wrapper *f = NewWrapper();; + Wrapper *f = NewWrapper(); String *cleanup = NewString(""); String *outarg = NewString(""); String *signature = NewString(""); Modified: trunk/Source/Modules/java.cxx =================================================================== --- trunk/Source/Modules/java.cxx 2010-05-21 07:07:15 UTC (rev 12033) +++ trunk/Source/Modules/java.cxx 2010-05-21 07:10:12 UTC (rev 12034) @@ -4066,7 +4066,7 @@ int classDirectorConstructor(Node *n) { Node *parent = parentNode(n); - String *decl = Getattr(n, "decl");; + String *decl = Getattr(n, "decl"); String *supername = Swig_class_name(parent); String *classname = directorClassName(parent); String *sub = NewString(""); Modified: trunk/Source/Modules/mzscheme.cxx =================================================================== --- trunk/Source/Modules/mzscheme.cxx 2010-05-21 07:07:15 UTC (rev 12033) +++ trunk/Source/Modules/mzscheme.cxx 2010-05-21 07:10:12 UTC (rev 12034) @@ -514,7 +514,7 @@ String *proc_name = NewString(""); String *tm; - String *tm2 = NewString("");; + String *tm2 = NewString(""); String *argnum = NewString("0"); String *arg = NewString("argv[0]"); Wrapper *f; Modified: trunk/Source/Modules/ocaml.cxx =================================================================== --- trunk/Source/Modules/ocaml.cxx 2010-05-21 07:07:15 UTC (rev 12033) +++ trunk/Source/Modules/ocaml.cxx 2010-05-21 07:10:12 UTC (rev 12034) @@ -778,7 +778,7 @@ String *proc_name = NewString(""); String *tm; - String *tm2 = NewString("");; + String *tm2 = NewString(""); String *argnum = NewString("0"); String *arg = NewString("SWIG_Field(args,0)"); Wrapper *f; Modified: trunk/Source/Modules/octave.cxx =================================================================== --- trunk/Source/Modules/octave.cxx 2010-05-21 07:07:15 UTC (rev 12033) +++ trunk/Source/Modules/octave.cxx 2010-05-21 07:10:12 UTC (rev 12034) @@ -973,12 +973,12 @@ Delete(self); } - return Language::constructorHandler(n);; + return Language::constructorHandler(n); } virtual int destructorHandler(Node *n) { have_destructor = 1; - return Language::destructorHandler(n);; + return Language::destructorHandler(n); } virtual int staticmemberfunctionHandler(Node *n) { Modified: trunk/Source/Preprocessor/cpp.c =================================================================== --- trunk/Source/Preprocessor/cpp.c 2010-05-21 07:07:15 UTC (rev 12033) +++ trunk/Source/Preprocessor/cpp.c 2010-05-21 07:10:12 UTC (rev 12034) @@ -191,7 +191,7 @@ Preprocessor_expr_init(); /* Initialize the expression evaluator */ included_files = NewHash(); - id_scan = NewScanner();; + id_scan = NewScanner(); } Modified: trunk/Source/Swig/scanner.c =================================================================== --- trunk/Source/Swig/scanner.c 2010-05-21 07:07:15 UTC (rev 12033) +++ trunk/Source/Swig/scanner.c 2010-05-21 07:10:12 UTC (rev 12034) @@ -1184,7 +1184,7 @@ state = 12; else if (c == startchar) { state = 0; - num_levels++;; + num_levels++; } else state = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wsf...@us...> - 2010-06-11 06:36:57
|
Revision: 12117 http://swig.svn.sourceforge.net/swig/?rev=12117&view=rev Author: wsfulton Date: 2010-06-11 06:36:51 +0000 (Fri, 11 Jun 2010) Log Message: ----------- make beautify-file fixes and other cosmetics Modified Paths: -------------- trunk/Source/Makefile.am trunk/Source/Modules/go.cxx Modified: trunk/Source/Makefile.am =================================================================== --- trunk/Source/Makefile.am 2010-06-11 06:29:32 UTC (rev 12116) +++ trunk/Source/Makefile.am 2010-06-11 06:36:51 UTC (rev 12117) @@ -115,7 +115,7 @@ # swig executable as a way of checking before and after the 'beautifying'. # Single files can be beautified with the beautify-file target, eg: 'make beautify-file INDENTFILE=chosenfile.c' -SWIGTYPEDEFS=-T File -T DohObjInfo -T Parm -T Language -T List -T Typetab -T ModuleFactory -T ErrorMessageFormat -T Symtab -T Hash -T String -T DohBase -T Node -T String_or_char -T SwigType -T Dispatcher -T Wrapper -T DohStringMethods -T DohFileMethods -T DohListMethods -T DohHashMethods -T DOH -T DohIterator -T ParmList -T FILE -T HashNode -T DOHString_or_char +SWIGTYPEDEFS=-T bool -T File -T DohObjInfo -T Parm -T Language -T List -T Typetab -T ModuleFactory -T ErrorMessageFormat -T Symtab -T Hash -T String -T DohBase -T Node -T String_or_char -T SwigType -T Dispatcher -T Wrapper -T DohStringMethods -T DohFileMethods -T DohListMethods -T DohHashMethods -T DOH -T DohIterator -T ParmList -T FILE -T HashNode -T DOHString_or_char INDENTBAKSDIR=../IndentBaks beautify: Modified: trunk/Source/Modules/go.cxx =================================================================== --- trunk/Source/Modules/go.cxx 2010-06-11 06:29:32 UTC (rev 12116) +++ trunk/Source/Modules/go.cxx 2010-06-11 06:36:51 UTC (rev 12117) @@ -15,7 +15,7 @@ #include <string> class GO:public Language { - static const char * const usage; + static const char *const usage; // Go package name. String *package; @@ -116,8 +116,7 @@ making_variable_wrappers(false), is_static_member_function(false), undefined_types(NULL), - defined_types(NULL) - { + defined_types(NULL) { director_multiple_inheritance = 1; director_language = 1; director_prot_ctor_code = NewString("_swig_gopanic(\"accessing abstract class or protected constructor\");"); @@ -367,14 +366,12 @@ Printf(f_c_runtime, "#define SWIG_DIRECTORS\n"); Swig_banner(f_c_directors_h); - Printf(f_c_directors_h, - "\n/* This file should be compiled with gcc. */\n"); + Printf(f_c_directors_h, "\n/* This file should be compiled with gcc. */\n"); Printf(f_c_directors_h, "#ifndef SWIG_%s_WRAP_H_\n", module); Printf(f_c_directors_h, "#define SWIG_%s_WRAP_H_\n\n", module); Printf(f_c_directors, "\n// C++ director class methods.\n"); - Printf(f_c_directors, "#include \"%s\"\n\n", - Swig_file_filename(c_filename_h)); + Printf(f_c_directors, "#include \"%s\"\n\n", Swig_file_filename(c_filename_h)); } Swig_banner(f_go_begin); @@ -409,8 +406,7 @@ Printv(f_go_wrappers, "type ", ty, " interface {\n", NULL); Printv(f_go_wrappers, "\tSwigcptr() uintptr;\n", NULL); Printv(f_go_wrappers, "}\n", NULL); - Printv(f_go_wrappers, "func (p ", cp, ") Swigcptr() uintptr {\n", - NULL); + Printv(f_go_wrappers, "func (p ", cp, ") Swigcptr() uintptr {\n", NULL); Printv(f_go_wrappers, "\treturn uintptr(p)\n", NULL); Printv(f_go_wrappers, "}\n\n", NULL); } @@ -574,10 +570,8 @@ Delete(c2); Delete(c1); - if (Swig_methodclass(n) != NULL - && Swig_directorclass(n) - && Strcmp(Char(Getattr(n, "wrap:action")), - director_prot_ctor_code) != 0) { + if (Swig_methodclass(n) != NULL && Swig_directorclass(n) + && Strcmp(Char(Getattr(n, "wrap:action")), director_prot_ctor_code) != 0) { // The core SWIG code skips the first parameter when // generating the $nondirector_new string. Recreate the // action in this case. But don't it if we are using the @@ -643,8 +637,7 @@ ParmList *parms = Getattr(n, "parms"); Setattr(n, "wrap:parms", parms); - int r = makeWrappers(n, name, go_name, overname, wname, NULL, parms, - result, is_static); + int r = makeWrappers(n, name, go_name, overname, wname, NULL, parms, result, is_static); if (r != SWIG_OK) { return r; } @@ -703,22 +696,18 @@ * IS_STATIC: Whether this is a static method or member. * ---------------------------------------------------------------------- */ - int makeWrappers(Node *n, String *name, String *go_name, String *overname, - String *wname, List *base, ParmList *parms, - SwigType *result, bool is_static) { + int makeWrappers(Node *n, String *name, String *go_name, String *overname, String *wname, List *base, ParmList *parms, SwigType *result, bool is_static) { assert(result != NULL); bool needs_wrapper; - int r = goFunctionWrapper(n, name, go_name, overname, wname, base, parms, - result, is_static, &needs_wrapper); + int r = goFunctionWrapper(n, name, go_name, overname, wname, base, parms, result, is_static, &needs_wrapper); if (r != SWIG_OK) { return r; } if (!gccgo_flag) { - r = gcFunctionWrapper(n, name, go_name, overname, wname, parms, result, - is_static, needs_wrapper); + r = gcFunctionWrapper(n, name, go_name, overname, wname, parms, result, is_static, needs_wrapper); if (r != SWIG_OK) { return r; } @@ -751,10 +740,7 @@ * base class. * ---------------------------------------------------------------------- */ - int goFunctionWrapper(Node *n, String *name, String *go_name, - String *overname, String *wname, List *base, - ParmList *parms, SwigType *result, bool is_static, - bool *p_needs_wrapper) { + int goFunctionWrapper(Node *n, String *name, String *go_name, String *overname, String *wname, List *base, ParmList *parms, SwigType *result, bool is_static, bool *p_needs_wrapper) { Wrapper *dummy = NewWrapper(); emit_attach_parmmaps(parms, dummy); Swig_typemap_attach_parms("default", parms, dummy); @@ -776,18 +762,9 @@ receiver = NULL; } - bool add_to_interface = (interfaces != NULL - && !is_constructor - && !is_destructor - && !is_static - && overname == NULL - && is_public(n)); + bool add_to_interface = (interfaces != NULL && !is_constructor && !is_destructor && !is_static && overname == NULL && is_public(n)); - bool needs_wrapper = (gccgo_flag - || receiver != NULL - || is_constructor - || is_destructor - || parm_count > required_count); + bool needs_wrapper = (gccgo_flag || receiver != NULL || is_constructor || is_destructor || parm_count > required_count); // See whether any of the function parameters are represented by // interface values When calling the C++ code, we need to convert @@ -845,9 +822,7 @@ p = getParm(p); // Give the parameter a name we will use below. Swig_cparm_name(p, i); - if (i > 0 - || (base != NULL && receiver != NULL) - || parm_count > required_count) { + if (i > 0 || (base != NULL && receiver != NULL) || parm_count > required_count) { Printv(f_go_wrappers, ", ", NULL); } String *tm = goWrapperType(p, Getattr(p, "type"), false); @@ -867,8 +842,7 @@ } if (gccgo_flag) { - Printv(f_go_wrappers, " __asm__ (\"", go_prefix, "_", wname, "\")", - NULL); + Printv(f_go_wrappers, " __asm__ (\"", go_prefix, "_", wname, "\")", NULL); } Printv(f_go_wrappers, "\n\n", NULL); @@ -968,12 +942,9 @@ for (; i < parm_count; ++i) { p = getParm(p); String *tm = goType(p, Getattr(p, "type")); - Printv(f_go_wrappers, "\tvar ", Getattr(p, "lname"), " ", tm, "\n", - NULL); - Printf(f_go_wrappers, "\tif len(_swig_args) > %d {\n", - i - required_count); - Printf(f_go_wrappers, "\t\t%s = _swig_args[%d].(%s)\n", - Getattr(p, "lname"), i - required_count, tm); + Printv(f_go_wrappers, "\tvar ", Getattr(p, "lname"), " ", tm, "\n", NULL); + Printf(f_go_wrappers, "\tif len(_swig_args) > %d {\n", i - required_count); + Printf(f_go_wrappers, "\t\t%s = _swig_args[%d].(%s)\n", Getattr(p, "lname"), i - required_count, tm); Printv(f_go_wrappers, "\t}\n", NULL); Delete(tm); p = nextParm(p); @@ -1001,8 +972,7 @@ Parm *p = parms; for (int i = 0; i < parm_count; ++i) { p = getParm(p); - if (i > 0 - || (base != NULL && receiver != NULL) + if (i > 0 || (base != NULL && receiver != NULL) || parm_count > required_count) { Printv(f_go_wrappers, ", ", NULL); } @@ -1024,8 +994,7 @@ Printv(f_go_wrappers, "}\n", NULL); } else { if (gccgo_flag) { - Printv(f_go_wrappers, " __asm__ (\"", go_prefix, "_", - wname, "\")\n", NULL); + Printv(f_go_wrappers, " __asm__ (\"", go_prefix, "_", wname, "\")\n", NULL); } } @@ -1044,13 +1013,10 @@ * wrapper which will be compiled with 6c/8c. * ---------------------------------------------------------------------- */ - int gcFunctionWrapper(Node *n, String *name, String *go_name, - String *overname, String *wname, ParmList *parms, - SwigType *result, bool is_static, bool needs_wrapper) { + int gcFunctionWrapper(Node *n, String *name, String *go_name, String *overname, String *wname, ParmList *parms, SwigType *result, bool is_static, bool needs_wrapper) { Wrapper *f = NewWrapper(); - Printv(f->def, "#pragma dynimport ", wname, " ", wname, " \"", - soname, "\"\n", NULL); + Printv(f->def, "#pragma dynimport ", wname, " ", wname, " \"", soname, "\"\n", NULL); Printv(f->def, "void (*", wname, ")(void*);\n", NULL); Printv(f->def, "\n", NULL); Printv(f->def, "void\n", NULL); @@ -1101,8 +1067,7 @@ } // \xc2\xb7 is UTF-8 for U+00B7 which is Unicode 'Middle Dot' - Printv(f->def, "\xc2\xb7", fn_name, - "(struct { uint8 x[", parm_size, "];} p)", NULL); + Printv(f->def, "\xc2\xb7", fn_name, "(struct { uint8 x[", parm_size, "];} p)", NULL); Delete(fn_name); Delete(parm_size); @@ -1161,8 +1126,7 @@ * executing the SWIG wrapper code. * ---------------------------------------------------------------------- */ - int gccFunctionWrapper(Node *n, List *base, String *wname, ParmList *parms, - SwigType *result) { + int gccFunctionWrapper(Node *n, List *base, String *wname, ParmList *parms, SwigType *result) { Wrapper *f = NewWrapper(); Swig_save("gccFunctionWrapper", n, "parms", NULL); @@ -1185,11 +1149,7 @@ // Start the function definition. - Printv(f->def, - "#ifdef __cplusplus\n", - "extern \"C\"\n", - "#endif\n", - NULL); + Printv(f->def, "#ifdef __cplusplus\n", "extern \"C\"\n", "#endif\n", NULL); Printv(f->def, "void\n", wname, "(void *swig_v)\n", "{\n", NULL); @@ -1233,9 +1193,7 @@ String *tm = Getattr(p, "tmap:in"); if (tm == NULL) { - Swig_warning(WARN_TYPEMAP_IN_UNDEF, input_file, line_number, - "Unable to use type %s as a function argument\n", - SwigType_str(Getattr(p, "type"), 0)); + Swig_warning(WARN_TYPEMAP_IN_UNDEF, input_file, line_number, "Unable to use type %s as a function argument\n", SwigType_str(Getattr(p, "type"), 0)); } else { String *ln = Getattr(p, "lname"); String *input = NewString(""); @@ -1245,8 +1203,7 @@ if (i < required_count) { Printv(f->code, "\t", tm, "\n", NULL); } else { - Printf(f->code, "\tif (swig_a->_swig_optargc > %d) {\n", - i - required_count); + Printf(f->code, "\tif (swig_a->_swig_optargc > %d) {\n", i - required_count); Printv(f->code, "\t\t", tm, "\n", NULL); Printv(f->code, "\t}\n", NULL); } @@ -1289,8 +1246,7 @@ * executing the SWIG wrapper code. * ---------------------------------------------------------------------- */ - int gccgoFunctionWrapper(Node *n, List *base, String *wname, ParmList *parms, - SwigType *result) { + int gccgoFunctionWrapper(Node *n, List *base, String *wname, ParmList *parms, SwigType *result) { Wrapper *f = NewWrapper(); Swig_save("gccgoFunctionWrapper", n, "parms", NULL); @@ -1313,11 +1269,7 @@ // Start the function definition. - Printv(f->def, - "#ifdef __cplusplus\n", - "extern \"C\"\n", - "#endif\n", - NULL); + Printv(f->def, "#ifdef __cplusplus\n", "extern \"C\"\n", "#endif\n", NULL); String *fnname = NewString(""); Printv(fnname, go_prefix, "_", wname, "(", NULL); @@ -1374,8 +1326,7 @@ String *tm = Getattr(p, "tmap:in"); if (tm == NULL) { Swig_warning(WARN_TYPEMAP_IN_UNDEF, input_file, line_number, - "Unable to use type %s as a function argument\n", - SwigType_str(Getattr(p, "type"), 0)); + "Unable to use type %s as a function argument\n", SwigType_str(Getattr(p, "type"), 0)); } else { String *ln = Getattr(p, "lname"); String *pn = NewString("g"); @@ -1452,8 +1403,7 @@ * Get the action of the function. This is used for C/C++ function. * ----------------------------------------------------------------------- */ - void emitGoAction(Node *n, List *base, ParmList *parms, SwigType *result, - Wrapper *f) { + void emitGoAction(Node *n, List *base, ParmList *parms, SwigType *result, Wrapper *f) { String *actioncode; if (base == NULL || isStatic(n)) { Swig_director_emit_dynamic_cast(n, f); @@ -1471,8 +1421,7 @@ String *last = NULL; int vc = 0; for (Iterator bi = First(base); bi.item != NULL; bi = Next(bi)) { - Printf(actioncode, " %s *swig_b%d = (%s *)%s;\n", bi.item, vc, - bi.item, current); + Printf(actioncode, " %s *swig_b%d = (%s *)%s;\n", bi.item, vc, bi.item, current); Delete(current); current = NewString(""); Printf(current, "swig_b%d", vc); @@ -1491,9 +1440,7 @@ String *tm = Swig_typemap_lookup_out("out", n, "result", f, actioncode); if (tm == NULL) { - Swig_warning(WARN_TYPEMAP_OUT_UNDEF, input_file, line_number, - "Unable to use return type %s\n", - SwigType_str(result, 0)); + Swig_warning(WARN_TYPEMAP_OUT_UNDEF, input_file, line_number, "Unable to use return type %s\n", SwigType_str(result, 0)); } else { if (!gccgo_flag) { Replaceall(tm, "$result", "swig_a->result"); @@ -1611,10 +1558,9 @@ return goComplexConstant(n, type); } - if (Getattr(n, "storage") != NULL - && Strcmp(Getattr(n, "storage"), "static") == 0) { + if (Getattr(n, "storage") != NULL && Strcmp(Getattr(n, "storage"), "static") == 0) { return goComplexConstant(n, type); - } + } String *go_name = buildGoName(Getattr(n, "sym:name"), false, false); @@ -1631,8 +1577,7 @@ if (Cmp(value, "true") != 0 && Cmp(value, "false") != 0) { return goComplexConstant(n, type); } - } else if (SwigType_type(type) == T_STRING - || SwigType_type(type) == T_CHAR) { + } else if (SwigType_type(type) == T_STRING || SwigType_type(type) == T_CHAR) { // Backslash sequences are somewhat different in Go and C/C++. if (Strchr(value, '\\') != NULL) { return goComplexConstant(n, type); @@ -1661,11 +1606,9 @@ } for (; i < len; ++i) { switch (p[i]) { - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': + case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; - case 'a': case 'b': case 'c': case 'd': case 'f': - case 'A': case 'B': case 'C': case 'D': case 'F': + case 'a': case 'b': case 'c': case 'd': case 'f': case 'A': case 'B': case 'C': case 'D': case 'F': if (!is_hex) { return goComplexConstant(n, type); } @@ -1778,7 +1721,7 @@ Printv(get, ";\n", NULL); Setattr(n, "wrap:action", get); - String* symname = Getattr(n, "sym:name"); + String *symname = Getattr(n, "sym:name"); if (symname == NULL) { symname = Getattr(n, "name"); } @@ -1799,8 +1742,7 @@ String *wname = Swig_name_wrapper(sname); Setattr(n, "wrap:name", wname); - int r = makeWrappers(n, sname, go_name, NULL, wname, NULL, NULL, type, - true); + int r = makeWrappers(n, sname, go_name, NULL, wname, NULL, NULL, type, true); if (r != SWIG_OK) { return r; @@ -1808,8 +1750,7 @@ String *varname = buildGoName(symname, true, false); String *t = goType(n, type); - Printv(f_go_wrappers, "var ", varname, " ", t, " = ", go_name, "()\n", - NULL); + Printv(f_go_wrappers, "var ", varname, " ", t, " = ", go_name, "()\n", NULL); Delete(varname); Delete(t); @@ -1854,21 +1795,18 @@ // A method to return the pointer to the C++ class. This is used // by generated code to convert between the interface and the C++ // value. - Printv(f_go_wrappers, "func (p ", go_type_name, ") Swigcptr() uintptr {\n", - NULL); + Printv(f_go_wrappers, "func (p ", go_type_name, ") Swigcptr() uintptr {\n", NULL); Printv(f_go_wrappers, "\treturn (uintptr)(p)\n", NULL); Printv(f_go_wrappers, "}\n\n", NULL); // A method used as a marker for the class, to avoid invalid // interface conversions when using multiple inheritance. - Printv(f_go_wrappers, "func (p ", go_type_name, ") SwigIs", go_name, - "() {\n", NULL); + Printv(f_go_wrappers, "func (p ", go_type_name, ") SwigIs", go_name, "() {\n", NULL); Printv(f_go_wrappers, "}\n\n", NULL); if (is_director) { // Return the interface passed to the NewDirector function. - Printv(f_go_wrappers, "func (p ", go_type_name, - ") DirectorInterface() interface{} {\n", NULL); + Printv(f_go_wrappers, "func (p ", go_type_name, ") DirectorInterface() interface{} {\n", NULL); Printv(f_go_wrappers, "\treturn nil\n", NULL); Printv(f_go_wrappers, "}\n\n", NULL); } @@ -1891,9 +1829,7 @@ // differently in Go and in C++. Hash *local = NewHash(); - for (Node *ni = Getattr(n, "firstChild"); - ni != NULL; - ni = nextSibling(ni)) { + for (Node *ni = Getattr(n, "firstChild"); ni != NULL; ni = nextSibling(ni)) { if (!is_public(ni)) { continue; @@ -1970,9 +1906,7 @@ return SWIG_OK; } - for (Node *ni = Getattr(base, "firstChild"); - ni != NULL; - ni = nextSibling(ni)) { + for (Node *ni = Getattr(base, "firstChild"); ni != NULL; ni = nextSibling(ni)) { if (GetFlag(ni, "feature:ignore")) { continue; @@ -1983,10 +1917,7 @@ } String *type = Getattr(ni, "nodeType"); - if (Strcmp(type, "constructor") == 0 - || Strcmp(type, "destructor") == 0 - || Strcmp(type, "enum") == 0 - || Strcmp(type, "using") == 0) { + if (Strcmp(type, "constructor") == 0 || Strcmp(type, "destructor") == 0 || Strcmp(type, "enum") == 0 || Strcmp(type, "using") == 0) { continue; } String *storage = Getattr(ni, "storage"); @@ -2022,9 +1953,7 @@ } if (Getattr(ni, "sym:overloaded") != NULL) { - for (Node *on = Getattr(ni, "sym:nextSibling"); - on != NULL; - on = Getattr(on, "sym:nextSibling")) { + for (Node *on = Getattr(ni, "sym:nextSibling"); on != NULL; on = Getattr(on, "sym:nextSibling")) { r = goBaseMethod(n, bases, on); if (r != SWIG_OK) { return r; @@ -2036,10 +1965,8 @@ if (is_static) { receiver = NULL; } - String *go_name = buildGoName(Getattr(ni, "sym:name"), is_static, - false); - r = makeDispatchFunction(ni, go_name, receiver, is_static, NULL, - false); + String *go_name = buildGoName(Getattr(ni, "sym:name"), is_static, false); + r = makeDispatchFunction(ni, go_name, receiver, is_static, NULL, false); Delete(go_name); if (r != SWIG_OK) { return r; @@ -2108,11 +2035,7 @@ Swig_save("goBaseMethod", method, "wrap:action", "parms", NULL); if (Getattr(method, "wrap:action") == NULL) { if (!is_static) { - Swig_MethodToFunction(method, getNSpace(), getClassType(), - (Getattr(method, "template") != NULL - ? SmartPointer - : Extend | SmartPointer), - NULL, false); + Swig_MethodToFunction(method, getNSpace(), getClassType(), (Getattr(method, "template") != NULL ? SmartPointer : Extend | SmartPointer), NULL, false); // Remove any self parameter that was just added. ParmList *parms = Getattr(method, "parms"); if (parms != NULL && Getattr(parms, "self") != NULL) { @@ -2120,15 +2043,12 @@ Setattr(method, "parms", parms); } } else { - String *call = Swig_cfunction_call(Getattr(method, "name"), - Getattr(method, "parms")); - Setattr(method, "wrap:action", Swig_cresult(Getattr(method, "type"), - "result", call)); + String *call = Swig_cfunction_call(Getattr(method, "name"), Getattr(method, "parms")); + Setattr(method, "wrap:action", Swig_cresult(Getattr(method, "type"), "result", call)); } } - int r = makeWrappers(method, name, go_name, overname, wname, bases, - Getattr(method, "parms"), result, is_static); + int r = makeWrappers(method, name, go_name, overname, wname, bases, Getattr(method, "parms"), result, is_static); Swig_restore(method); @@ -2170,9 +2090,7 @@ flags |= CWRAP_ALL_PROTECTED_ACCESS; } - String *mname = Swig_name_member(getNSpace(), - Getattr(var_class, "sym:name"), - var_name); + String *mname = Swig_name_member(getNSpace(), Getattr(var_class, "sym:name"), var_name); if (is_assignable(var)) { for (Iterator ki = First(var); ki.key != NULL; ki = Next(ki)) { @@ -2193,8 +2111,7 @@ String *wname = Swig_name_wrapper(mname_set); ParmList *parms = NewParm(vt, var_name, var); String *result = NewString("void"); - int r = makeWrappers(var, mname_set, go_name, NULL, wname, bases, parms, - result, false); + int r = makeWrappers(var, mname_set, go_name, NULL, wname, bases, parms, result, false); if (r != SWIG_OK) { return r; } @@ -2222,8 +2139,7 @@ String *wname = Swig_name_wrapper(mname_get); - int r = makeWrappers(var, mname_get, go_name, NULL, wname, bases, NULL, - vt, false); + int r = makeWrappers(var, mname_get, go_name, NULL, wname, bases, NULL, vt, false); if (r != SWIG_OK) { return r; } @@ -2266,24 +2182,18 @@ String *go_type_name = goCPointerType(Getattr(n, "classtypeobj"), true); String *go_base_name = exportedName(Getattr(b.item, "sym:name")); String *go_base_type = goType(n, Getattr(b.item, "classtypeobj")); - String *go_base_type_name = goCPointerType(Getattr(b.item, - "classtypeobj"), - true); + String *go_base_type_name = goCPointerType(Getattr(b.item, "classtypeobj"), true); - Printv(f_go_wrappers, "func (p ", go_type_name, ") SwigIs", go_base_name, - "() {\n", NULL); + Printv(f_go_wrappers, "func (p ", go_type_name, ") SwigIs", go_base_name, "() {\n", NULL); Printv(f_go_wrappers, "}\n\n", NULL); Printv(interfaces, "\tSwigIs", go_base_name, "()\n", NULL); - Printv(f_go_wrappers, "func (p ", go_type_name, ") SwigGet", go_base_name, - "() ", go_base_type, " {\n", NULL); - Printv(f_go_wrappers, "\treturn ", go_base_type_name, - "(p.Swigcptr())\n", NULL); + Printv(f_go_wrappers, "func (p ", go_type_name, ") SwigGet", go_base_name, "() ", go_base_type, " {\n", NULL); + Printv(f_go_wrappers, "\treturn ", go_base_type_name, "(p.Swigcptr())\n", NULL); Printv(f_go_wrappers, "}\n\n", NULL); - Printv(interfaces, "\tSwigGet", go_base_name, "() ", go_base_type, "\n", - NULL); + Printv(interfaces, "\tSwigGet", go_base_name, "() ", go_base_type, "\n", NULL); Setattr(parents, go_base_name, NewString("")); @@ -2315,8 +2225,7 @@ String *go_base_name = exportedName(Getattr(b.item, "sym:name")); - Swig_save("addExtraBaseInterface", n, "wrap:action", "wrap:name", - "wrap:parms", NULL); + Swig_save("addExtraBaseInterface", n, "wrap:action", "wrap:name", "wrap:parms", NULL); SwigType *type = Copy(Getattr(n, "classtypeobj")); SwigType_add_pointer(type); @@ -2325,8 +2234,7 @@ String *pn = Swig_cparm_name(parm, 0); String *action = NewString(""); - Printv(action, "result = (", Getattr(b.item, "classtype"), "*)", pn, - ";", NULL); + Printv(action, "result = (", Getattr(b.item, "classtype"), "*)", pn, ";", NULL); Delete(pn); Setattr(n, "wrap:action", action); @@ -2383,8 +2291,7 @@ * classes of parents other than the first base class at each level. * ------------------------------------------------------------ */ - void addParentExtraBaseInterfaces(Node *n, Hash *parents, Node *base, - bool is_base_first, String *sofar) { + void addParentExtraBaseInterfaces(Node *n, Hash *parents, Node *base, bool is_base_first, String *sofar) { List *baselist = Getattr(base, "bases"); if (baselist == NULL || Len(baselist) == 0) { return; @@ -2419,14 +2326,11 @@ String *go_base_name = exportedName(Getattr(b.item, "sym:name")); if (Getattr(parents, go_base_name) == NULL) { - Printv(f_go_wrappers, "func (p ", go_type_name, ") SwigGet", - go_base_name, "() ", go_base_name, " {\n", NULL); - Printv(f_go_wrappers, "\treturn p", sf, ".SwigGet", go_base_name, - "()\n", NULL); + Printv(f_go_wrappers, "func (p ", go_type_name, ") SwigGet", go_base_name, "() ", go_base_name, " {\n", NULL); + Printv(f_go_wrappers, "\treturn p", sf, ".SwigGet", go_base_name, "()\n", NULL); Printv(f_go_wrappers, "}\n\n", NULL); - Printv(interfaces, "\tSwigGet", go_base_name, "() ", go_base_name, "\n", - NULL); + Printv(interfaces, "\tSwigGet", go_base_name, "() ", go_base_name, "\n", NULL); addParentExtraBaseInterfaces(n, parents, b.item, false, sf); @@ -2478,7 +2382,7 @@ String *director_struct_name = NewString("_swig_Director"); Append(director_struct_name, go_name); - String* cxx_director_name = NewString("SwigDirector_"); + String *cxx_director_name = NewString("SwigDirector_"); Append(cxx_director_name, name); // The Go type of the director class. @@ -2487,23 +2391,19 @@ Printv(f_go_wrappers, "\tv interface{}\n", NULL); Printv(f_go_wrappers, "}\n\n", NULL); - Printv(f_go_wrappers, "func (p *", director_struct_name, - ") Swigcptr() uintptr {\n", NULL); + Printv(f_go_wrappers, "func (p *", director_struct_name, ") Swigcptr() uintptr {\n", NULL); Printv(f_go_wrappers, "\treturn p.", go_type_name, ".Swigcptr()\n", NULL); Printv(f_go_wrappers, "}\n\n", NULL); - Printv(f_go_wrappers, "func (p *", director_struct_name, ") SwigIs", - go_name, "() {\n", NULL); + Printv(f_go_wrappers, "func (p *", director_struct_name, ") SwigIs", go_name, "() {\n", NULL); Printv(f_go_wrappers, "}\n\n", NULL); - Printv(f_go_wrappers, "func (p *", director_struct_name, - ") DirectorInterface() interface{} {\n", NULL); + Printv(f_go_wrappers, "func (p *", director_struct_name, ") DirectorInterface() interface{} {\n", NULL); Printv(f_go_wrappers, "\treturn p.v\n", NULL); Printv(f_go_wrappers, "}\n\n", NULL); // Start defining the director class. - Printv(f_c_directors_h, "class ", cxx_director_name, " : public ", - Getattr(n, "classtype"), "\n", NULL); + Printv(f_c_directors_h, "class ", cxx_director_name, " : public ", Getattr(n, "classtype"), "\n", NULL); Printv(f_c_directors_h, "{\n", NULL); Printv(f_c_directors_h, " public:\n", NULL); @@ -2542,9 +2442,7 @@ String *cn = exportedName(Getattr(parentNode(n), "sym:name")); - String *go_type_name = goCPointerType(Getattr(parentNode(n), - "classtypeobj"), - true); + String *go_type_name = goCPointerType(Getattr(parentNode(n), "classtypeobj"), true); String *director_struct_name = NewString("_swig_Director"); Append(director_struct_name, cn); @@ -2616,14 +2514,12 @@ Printv(f_go_wrappers, ") ", go_type_name, NULL); if (gccgo_flag) { - Printv(f_go_wrappers, " __asm__(\"", go_prefix, "_", wname, "\")", - NULL); + Printv(f_go_wrappers, " __asm__(\"", go_prefix, "_", wname, "\")", NULL); } Printv(f_go_wrappers, "\n\n", NULL); - Printv(f_go_wrappers, "func ", func_with_over_name, "(v interface{}", - NULL); + Printv(f_go_wrappers, "func ", func_with_over_name, "(v interface{}", NULL); p = parms; for (int i = 0; i < parm_count; ++i) { @@ -2638,8 +2534,7 @@ Printv(f_go_wrappers, ") ", cn, " {\n", NULL); - Printv(f_go_wrappers, "\tp := &", director_struct_name, "{0, v}\n", - NULL); + Printv(f_go_wrappers, "\tp := &", director_struct_name, "{0, v}\n", NULL); Printv(f_go_wrappers, "\tp.", class_receiver, " = ", fn_name, NULL); if (overname != NULL) { Printv(f_go_wrappers, overname, NULL); @@ -2660,8 +2555,7 @@ SwigType *result = Copy(Getattr(parentNode(n), "classtypeobj")); SwigType_add_pointer(result); - Swig_save("classDirectorConstructor", n, "wrap:name", "wrap:action", - NULL); + Swig_save("classDirectorConstructor", n, "wrap:name", "wrap:action", NULL); Setattr(n, "wrap:name", Swig_name_wrapper(name)); @@ -2715,13 +2609,11 @@ Printv(f_c_directors_h, " ", decl, ";\n", NULL); Delete(decl); - decl = Swig_method_decl(NULL, Getattr(n, "decl"), - cxx_director_name, first_parm, 0, 0); + decl = Swig_method_decl(NULL, Getattr(n, "decl"), cxx_director_name, first_parm, 0, 0); Printv(f_c_directors, cxx_director_name, "::", decl, "\n", NULL); Delete(decl); - Printv(f_c_directors, " : ", Getattr(parentNode(n), "classtype"), "(", - NULL); + Printv(f_c_directors, " : ", Getattr(parentNode(n), "classtype"), "(", NULL); p = parms; for (int i = 0; i < parm_count; ++i) { @@ -2739,9 +2631,7 @@ Printv(f_c_directors, "{ }\n\n", NULL); if (Getattr(n, "sym:overloaded") && Getattr(n, "sym:nextSibling") == NULL) { - int r = makeDispatchFunction(n, func_name, cn, is_static, - Getattr(parentNode(n), "classtypeobj"), - false); + int r = makeDispatchFunction(n, func_name, cn, is_static, Getattr(parentNode(n), "classtypeobj"), false); if (r != SWIG_OK) { return r; } @@ -2785,9 +2675,7 @@ Setattr(n, "wrap:name", fnname); - Swig_DestructorToFunction(n, getNSpace(), - Getattr(parentNode(n), "classtype"), - CPlusPlus, Extend); + Swig_DestructorToFunction(n, getNSpace(), Getattr(parentNode(n), "classtype"), CPlusPlus, Extend); ParmList *parms = Getattr(n, "parms"); Setattr(n, "wrap:parms", parms); @@ -2819,8 +2707,7 @@ String *director_struct_name = NewString("_swig_Director"); Append(director_struct_name, cn); - Printv(f_c_directors_h, " virtual ~SwigDirector_", class_name, "()", - NULL); + Printv(f_c_directors_h, " virtual ~SwigDirector_", class_name, "()", NULL); String *throws = buildThrow(n); if (throws != NULL) { @@ -2831,16 +2718,13 @@ if (!is_ignored) { if (!gccgo_flag) { - Printv(f_c_directors, "extern \"C\" void ", wname, "(void*, int);\n", - NULL); + Printv(f_c_directors, "extern \"C\" void ", wname, "(void*, int);\n", NULL); } else { - Printv(f_c_directors, "extern \"C\" void ", wname, "(void*) __asm__(\"", - go_prefix, ".", package, ".", go_name, "\");\n", NULL); + Printv(f_c_directors, "extern \"C\" void ", wname, "(void*) __asm__(\"", go_prefix, ".", package, ".", go_name, "\");\n", NULL); } } - Printv(f_c_directors, "SwigDirector_", class_name, "::~SwigDirector_", - class_name, "()", NULL); + Printv(f_c_directors, "SwigDirector_", class_name, "::~SwigDirector_", class_name, "()", NULL); if (throws != NULL) { Printv(f_c_directors, " ", throws, NULL); @@ -2854,17 +2738,14 @@ if (!gccgo_flag) { Printv(f_c_directors, " struct { void *p; } a;\n", NULL); Printv(f_c_directors, " a.p = go_val;\n", NULL); - Printv(f_c_directors, " crosscall2(", wname, - ", &a, (int) sizeof a);\n", NULL); + Printv(f_c_directors, " crosscall2(", wname, ", &a, (int) sizeof a);\n", NULL); - Printv(f_gc_wrappers, "#pragma dynexport ", wname, " ", wname, "\n", - NULL); + Printv(f_gc_wrappers, "#pragma dynexport ", wname, " ", wname, "\n", NULL); Printv(f_gc_wrappers, "extern void \xc2\xb7", go_name, "();\n", NULL); Printv(f_gc_wrappers, "void\n", NULL); Printv(f_gc_wrappers, wname, "(void *a, int32 n)\n", NULL); Printv(f_gc_wrappers, "{\n", NULL); - Printv(f_gc_wrappers, "\tcgocallback(\xc2\xb7", go_name, ", a, n);\n", - NULL); + Printv(f_gc_wrappers, "\tcgocallback(\xc2\xb7", go_name, ", a, n);\n", NULL); Printv(f_gc_wrappers, "}\n\n", NULL); } else { Printv(f_c_directors, " ", wname, "(go_val);\n", NULL); @@ -2874,8 +2755,7 @@ Printv(f_c_directors, "}\n\n", NULL); if (!is_ignored) { - Printv(f_go_wrappers, "func ", go_name, "(p *", director_struct_name, - ") {\n", NULL); + Printv(f_go_wrappers, "func ", go_name, "(p *", director_struct_name, ") {\n", NULL); Printv(f_go_wrappers, "\tp.", class_receiver, " = 0\n", NULL); Printv(f_go_wrappers, "}\n\n", NULL); } @@ -2898,8 +2778,7 @@ (void) super; bool is_ignored = GetFlag(n, "feature:ignore"); - bool is_pure_virtual = (Cmp(Getattr(n, "storage"), "virtual") == 0 - && Cmp(Getattr(n, "value"), "0") == 0); + bool is_pure_virtual = (Cmp(Getattr(n, "storage"), "virtual") == 0 && Cmp(Getattr(n, "value"), "0") == 0); // We don't need explicit calls. if (GetFlag(n, "explicitcall")) { @@ -2934,9 +2813,7 @@ // class_methods so that we correctly handle cases where a // function in one class hides a function of the same name in a // parent class. - for (Node *on = Getattr(n, "sym:overloaded"); - on != NULL; - on = Getattr(on, "sym:nextSibling")) { + for (Node *on = Getattr(n, "sym:overloaded"); on != NULL; on = Getattr(on, "sym:nextSibling")) { int r = oneClassDirectorMethod(on, parent); if (r != SWIG_OK) { return r; @@ -2959,8 +2836,7 @@ String *director_struct_name = NewString("_swig_Director"); Append(director_struct_name, cn); - int r = makeDispatchFunction(n, go_name, director_struct_name, is_static, - director_struct_name, false); + int r = makeDispatchFunction(n, go_name, director_struct_name, is_static, director_struct_name, false); if (r != SWIG_OK) { return r; } @@ -2968,8 +2844,7 @@ String *go_upcall = NewString("Director"); Append(go_upcall, cn); Append(go_upcall, go_name); - r = makeDispatchFunction(n, go_upcall, director_struct_name, is_static, - director_struct_name, true); + r = makeDispatchFunction(n, go_upcall, director_struct_name, is_static, director_struct_name, true); if (r != SWIG_OK) { return r; } @@ -2991,8 +2866,7 @@ int oneClassDirectorMethod(Node *n, Node *parent) { bool is_ignored = GetFlag(n, "feature:ignore"); - bool is_pure_virtual = (Cmp(Getattr(n, "storage"), "virtual") == 0 - && Cmp(Getattr(n, "value"), "0") == 0); + bool is_pure_virtual = (Cmp(Getattr(n, "storage"), "virtual") == 0 && Cmp(Getattr(n, "value"), "0") == 0); String *name = Getattr(n, "sym:name"); if (name == NULL) { @@ -3007,8 +2881,7 @@ String *cn = exportedName(Getattr(parent, "sym:name")); - String *go_type_name = goCPointerType(Getattr(parent, "classtypeobj"), - true); + String *go_type_name = goCPointerType(Getattr(parent, "classtypeobj"), true); String *director_struct_name = NewString("_swig_Director"); Append(director_struct_name, cn); @@ -3123,8 +2996,7 @@ String *upcall_gc_name = buildGoWrapperName(upcall_name, overname); - Printv(f_go_wrappers, "func ", upcall_gc_name, "(", - go_type_name, NULL); + Printv(f_go_wrappers, "func ", upcall_gc_name, "(", go_type_name, NULL); p = parms; for (int i = 0; i < parm_count; ++i) { @@ -3144,16 +3016,14 @@ } if (gccgo_flag) { - Printv(f_go_wrappers, " __asm__(\"", go_prefix, "_", upcall_wname, - "\")", NULL); + Printv(f_go_wrappers, " __asm__(\"", go_prefix, "_", upcall_wname, "\")", NULL); } Printv(f_go_wrappers, "\n", NULL); // Define the method on the director class in Go. - Printv(f_go_wrappers, "func (swig_p *", director_struct_name, ") ", - go_with_over_name, "(", NULL); + Printv(f_go_wrappers, "func (swig_p *", director_struct_name, ") ", go_with_over_name, "(", NULL); p = parms; for (int i = 0; i < parm_count; ++i) { @@ -3178,8 +3048,7 @@ Printv(f_go_wrappers, " {\n", NULL); - Printv(f_go_wrappers, "\tif swig_g, swig_ok := swig_p.v.(", - interface_name, "); swig_ok {\n", NULL); + Printv(f_go_wrappers, "\tif swig_g, swig_ok := swig_p.v.(", interface_name, "); swig_ok {\n", NULL); Printv(f_go_wrappers, "\t\t", NULL); if (SwigType_type(result) != T_VOID) { Printv(f_go_wrappers, "return ", NULL); @@ -3230,9 +3099,7 @@ if (overname != NULL) { Append(upcall_method_name, overname); } - String *upcall_decl = Swig_method_decl(Getattr(n, "type"), - Getattr(n, "decl"), - upcall_method_name, parms, 0, 0); + String *upcall_decl = Swig_method_decl(Getattr(n, "type"), Getattr(n, "decl"), upcall_method_name, parms, 0, 0); Printv(f_c_directors_h, " ", upcall_decl, " {\n", NULL); Delete(upcall_decl); @@ -3240,8 +3107,7 @@ if (SwigType_type(result) != T_VOID) { Printv(f_c_directors_h, "return ", NULL); } - Printv(f_c_directors_h, Getattr(parent, "classtype"), "::", - Getattr(n, "name"), "(", NULL); + Printv(f_c_directors_h, Getattr(parent, "classtype"), "::", Getattr(n, "name"), "(", NULL); p = parms; for (int i = 0; i < parm_count; ++i) { @@ -3282,8 +3148,7 @@ Printv(action, "&", NULL); } } - Printv(action, Swig_cparm_name(NULL, 0), "->", upcall_method_name, "(", - NULL); + Printv(action, Swig_cparm_name(NULL, 0), "->", upcall_method_name, "(", NULL); p = parms; for (int i = 0; i < parm_count; ++i) { @@ -3309,9 +3174,7 @@ if (!gccgo_flag) { // Write the upcall wrapper function. This is compiled by gc // and calls the C++ function. - int r = gcFunctionWrapper(n, upcall_name, upcall_name, - overname, upcall_wname, first_parm, result, - is_static, true); + int r = gcFunctionWrapper(n, upcall_name, upcall_name, overname, upcall_wname, first_parm, result, is_static, true); if (r != SWIG_OK) { return r; } @@ -3338,8 +3201,7 @@ // Define a function which uses the Go director type that other // methods in the Go type can call to get parent methods. - Printv(f_go_wrappers, "func Director", cn, go_with_over_name, "(p ", cn, - NULL); + Printv(f_go_wrappers, "func Director", cn, go_with_over_name, "(p ", cn, NULL); p = parms; for (int i = 0; i < parm_count; ++i) { @@ -3365,8 +3227,7 @@ if (SwigType_type(result) != T_VOID) { Printv(f_go_wrappers, "return ", NULL); } - Printv(f_go_wrappers, upcall_gc_name, "(p.(*", - director_struct_name, ").", go_type_name, NULL); + Printv(f_go_wrappers, upcall_gc_name, "(p.(*", director_struct_name, ").", go_type_name, NULL); p = parms; for (int i = 0; i < parm_count; ++i) { @@ -3385,8 +3246,7 @@ // The Go function which invokes the method. This is called // from by the C++ method on the director class. - Printv(f_go_wrappers, "func ", callback_name, "(p *", - director_struct_name, NULL); + Printv(f_go_wrappers, "func ", callback_name, "(p *", director_struct_name, NULL); p = parms; for (int i = 0; i < parm_count; ++i) { @@ -3466,12 +3326,11 @@ } // Build the C++ functions. - + Delete(upcall_wname); if (!gccgo_flag) { - Printv(f_c_directors, "extern \"C\" void ", callback_wname, - "(void*, int);\n", NULL); + Printv(f_c_directors, "extern \"C\" void ", callback_wname, "(void*, int);\n", NULL); } else { Printv(f_c_directors, "extern \"C\" ", NULL); @@ -3502,8 +3361,7 @@ Delete(fnname); - Printv(f_c_directors, " __asm__(\"", go_prefix, ".", package, ".", - callback_name, "\");\n", NULL); + Printv(f_c_directors, " __asm__(\"", go_prefix, ".", package, ".", callback_name, "\");\n", NULL); } Delete(upcall_method_name); @@ -3513,18 +3371,13 @@ if (!is_ignored || is_pure_virtual) { // Declare the method for the director class. - SwigType *rtype = (Getattr(n, "conversion_operator") - ? NULL - : Getattr(n, "type")); - String *decl = Swig_method_decl(rtype, Getattr(n, "decl"), - Getattr(n, "name"), parms, - 0, 0); + SwigType *rtype = (Getattr(n, "conversion_operator") ? NULL : Getattr(n, "type")); + String *decl = Swig_method_decl(rtype, Getattr(n, "decl"), Getattr(n, "name"), parms, 0, 0); Printv(f_c_directors_h, " virtual ", decl, NULL); Delete(decl); String *qname = NewString(""); - Printv(qname, "SwigDirector_", class_name, "::", Getattr(n, "name"), - NULL); + Printv(qname, "SwigDirector_", class_name, "::", Getattr(n, "name"), NULL); decl = Swig_method_decl(rtype, Getattr(n, "decl"), qname, parms, 0, 0); Printv(f->def, decl, NULL); Delete(decl); @@ -3542,8 +3395,7 @@ Printv(f->def, " {\n", NULL); if (SwigType_type(result) != T_VOID) { - Wrapper_add_local(f, "c_result", - SwigType_lstr(Getattr(n, "returntype"), "c_result")); + Wrapper_add_local(f, "c_result", SwigType_lstr(Getattr(n, "returntype"), "c_result")); } if (!is_ignored) { @@ -3582,9 +3434,7 @@ String *tm = Getattr(p, "tmap:directorin"); if (tm == NULL) { Swig_warning(WARN_TYPEMAP_DIRECTORIN_UNDEF, input_file, - line_number, - "Unable to use type %s as director method argument\n", - SwigType_str(Getattr(p, "type"), 0)); + line_number, "Unable to use type %s as director method argument\n", SwigType_str(Getattr(p, "type"), 0)); } else { String *ln = Getattr(p, "lname"); String *input = NewString(""); @@ -3597,8 +3447,7 @@ p = Getattr(p, "tmap:directorin:next"); } - Printv(f->code, " crosscall2(", callback_wname, - ", &swig_a, (int) sizeof swig_a);\n", NULL); + Printv(f->code, " crosscall2(", callback_wname, ", &swig_a, (int) sizeof swig_a);\n", NULL); if (SwigType_type(result) != T_VOID) { String *rname = NewString("c_result"); @@ -3606,14 +3455,12 @@ String *tm = Swig_typemap_lookup("directorout", rp, rname, NULL); if (tm == NULL) { Swig_warning(WARN_TYPEMAP_DIRECTOROUT_UNDEF, input_file, line_number, - "Unable to use type %s as director method result\n", - SwigType_str(result, 0)); + "Unable to use type %s as director method result\n", SwigType_str(result, 0)); } else { Replaceall(tm, "$input", "swig_a.result"); Replaceall(tm, "$result", "c_result"); Printv(f->code, " ", tm, "\n", NULL); - String *retstr = SwigType_rcaststr(Getattr(n, "returntype"), - "c_result"); + String *retstr = SwigType_rcaststr(Getattr(n, "returntype"), "c_result"); Printv(f->code, " return ", retstr, ";\n", NULL); Delete(retstr); Delete(tm); @@ -3623,15 +3470,12 @@ } // The C wrapper code which calls the Go function. - Printv(f_gc_wrappers, "#pragma dynexport ", callback_wname, " ", - callback_wname, "\n", NULL); - Printv(f_gc_wrappers, "extern void \xc2\xb7", callback_name, "();\n", - NULL); + Printv(f_gc_wrappers, "#pragma dynexport ", callback_wname, " ", callback_wname, "\n", NULL); + Printv(f_gc_wrappers, "extern void \xc2\xb7", callback_name, "();\n", NULL); Printv(f_gc_wrappers, "void\n", NULL); Printv(f_gc_wrappers, callback_wname, "(void *a, int32 n)\n", NULL); Printv(f_gc_wrappers, "{\n", NULL); - Printv(f_gc_wrappers, "\tcgocallback(\xc2\xb7", callback_name, - ", a, n);\n", NULL); + Printv(f_gc_wrappers, "\tcgocallback(\xc2\xb7", callback_name, ", a, n);\n", NULL); Printv(f_gc_wrappers, "}\n\n", NULL); } else { if (SwigType_type(result) != T_VOID) { @@ -3661,9 +3505,7 @@ tm = Getattr(p, "tmap:directorin"); if (tm == NULL) { Swig_warning(WARN_TYPEMAP_DIRECTORIN_UNDEF, input_file, - line_number, - "Unable to use type %s as director method argument\n", - SwigType_str(Getattr(p, "type"), 0)); + line_number, "Unable to use type %s as director method argument\n", SwigType_str(Getattr(p, "type"), 0)); } else { Replaceall(tm, "$input", pn); Replaceall(tm, "$owner", 0); @@ -3687,14 +3529,12 @@ String *tm = Swig_typemap_lookup("directorout", rp, rname, NULL); if (tm == NULL) { Swig_warning(WARN_TYPEMAP_DIRECTOROUT_UNDEF, input_file, line_number, - "Unable to use type %s as director method result\n", - SwigType_str(result, 0)); + "Unable to use type %s as director method result\n", SwigType_str(result, 0)); } else { Replaceall(tm, "$input", "result"); Replaceall(tm, "$result", "c_result"); Printv(f->code, " ", tm, "\n", NULL); - String *retstr = SwigType_rcaststr(Getattr(n, "returntype"), - "c_result"); + String *retstr = SwigType_rcaststr(Getattr(n, "returntype"), "c_result"); Printv(f->code, " return ", retstr, ";\n", NULL); Delete(retstr); Delete(tm); @@ -3705,11 +3545,9 @@ } } else { assert(is_pure_virtual); - Printv(f->code, " _swig_gopanic(\"call to pure virtual function ", - Getattr(parent, "sym:name"), name, "\");\n"); + Printv(f->code, " _swig_gopanic(\"call to pure virtual function ", Getattr(parent, "sym:name"), name, "\");\n"); if (SwigType_type(result) != T_VOID) { - String *retstr = SwigType_rcaststr(Getattr(n, "returntype"), - "c_result"); + String *retstr = SwigType_rcaststr(Getattr(n, "returntype"), "c_result"); Printv(f->code, " return ", retstr, ";\n", NULL); Delete(retstr); } @@ -3819,27 +3657,18 @@ * the type of the first argument to the function. *--------------------------------------------------------------------*/ - int makeDispatchFunction(Node *n, String *go_name, String *receiver, - bool is_static, SwigType *director_struct, - bool is_upcall) { + int makeDispatchFunction(Node *n, String *go_name, String *receiver, bool is_static, SwigType *director_struct, bool is_upcall) { bool is_director = director_struct != NULL; String *nodetype = Getattr(n, "nodeType"); bool is_constructor = Cmp(nodetype, "constructor") == 0; bool is_destructor = Cmp(nodetype, "destructor") == 0; - bool can_use_receiver = (!is_constructor - && !is_destructor - && !is_upcall); + bool can_use_receiver = (!is_constructor && !is_destructor && !is_upcall); - bool use_receiver = (!is_static - && can_use_receiver); + bool use_receiver = (!is_static && can_use_receiver); - bool add_to_interface = (interfaces != NULL - && !is_constructor - && !is_destructor - && !is_static - && !is_upcall); + bool add_to_interface = (interfaces != NULL && !is_constructor && !is_destructor && !is_static && !is_upcall); List *dispatch = Swig_overload_rank(n, false); int nfunc = Len(dispatch); @@ -3963,8 +3792,7 @@ if (num_required == num_arguments) { Printf(f_go_wrappers, "\tif argc == %d {\n", num_required); } else { - Printf(f_go_wrappers, "\tif argc >= %d && argc <= %d {\n", - num_required, num_arguments); + Printf(f_go_wrappers, "\tif argc >= %d && argc <= %d {\n", num_required, num_arguments); } } @@ -4070,10 +3898,7 @@ result = NULL; } - if (result != NULL - && SwigType_type(result) != T_VOID - && (all_result == NULL - || SwigType_type(all_result) != T_VOID)) { + if (result != NULL && SwigType_type(result) != T_VOID && (all_result == NULL || SwigType_type(all_result) != T_VOID)) { Printv(start, "return ", NULL); } @@ -4081,16 +3906,12 @@ if (receiver != NULL && use_receiver) { Printv(start, "p.", go_name, NULL); - } else if (can_use_receiver - && !isStatic(ni) - && pi != NULL - && Getattr(pi, "self") != NULL) { + } else if (can_use_receiver && !isStatic(ni) && pi != NULL && Getattr(pi, "self") != NULL) { // This is an overload of a static function and a non-static // function. assert(num_required > 0); SwigType *tm = goWrapperType(pi, Getattr(pi, "type"), true); - String *nm = buildGoName(Getattr(ni, "sym:name"), false, - isFriend(ni)); + String *nm = buildGoName(Getattr(ni, "sym:name"), false, isFriend(ni)); Printv(start, "a[0].(", tm, ").", nm, NULL); Delete(nm); Delete(tm); @@ -4137,9 +3958,7 @@ } String *end = NULL; - if (result == NULL - || SwigType_type(result) == T_VOID - || (all_result != NULL && SwigType_type(all_result) == T_VOID)) { + if (result == NULL || SwigType_type(result) == T_VOID || (all_result != NULL && SwigType_type(all_result) == T_VOID)) { end = NewString(""); Printv(end, "return", NULL); if (all_result == NULL || SwigType_type(all_result) != T_VOID) { @@ -4183,8 +4002,7 @@ } Printv(f_go_wrappers, "fail:\n", NULL); - Printv(f_go_wrappers, - "\tpanic(\"No match for overloaded function call\")\n", NULL); + Printv(f_go_wrappers, "\tpanic(\"No match for overloaded function call\")\n", NULL); Printv(f_go_wrappers, "}\n\n", NULL); if (all_result != NULL) { @@ -4244,8 +4062,7 @@ String *copy = Copy(name); if (class_name != NULL) { char *p = Char(name); - if (Strncmp(name, class_name, Len(class_name)) == 0 - && p[Len(class_name)] == '_') { + if (Strncmp(name, class_name, Len(class_name)) == 0 && p[Len(class_name)] == '_') { Replace(copy, class_name, "", DOH_REPLACE_FIRST); Replace(copy, "_", "", DOH_REPLACE_FIRST); } @@ -4475,9 +4292,7 @@ Delete(t); if (ret == NULL) { - Swig_warning(WARN_LANG_NATIVE_UNIMPL, input_file, line_number, - "No Go typemap defined for %s\n", - SwigType_str(type, 0)); + Swig_warning(WARN_LANG_NATIVE_UNIMPL, input_file, line_number, "No Go typemap defined for %s\n", SwigType_str(type, 0)); ret = NewString("uintptr"); } @@ -4662,13 +4477,13 @@ return gcCTypeForGoValue(n, type, name); } - /* ------------------------------------------------------------ + /* ---------------------------------------------------------------------- * goTypeIsInterface * * Return whether this C++ type is represented as an interface type * in Go. These types require adjustments in the Go code when * passing them back and forth between Go and C++. - * ------------------------------------------------------------ */ + * ---------------------------------------------------------------------- */ bool goTypeIsInterface(Node *n, SwigType *type) { bool is_interface; @@ -4676,11 +4491,11 @@ return is_interface; } - /* ------------------------------------------------------------ + /* ---------------------------------------------------------------------- * hasGoTypemap * * Return whether a type has a "go" typemap entry. - * ------------------------------------------------------------ */ + * ---------------------------------------------------------------------- */ bool hasGoTypemap(SwigType *type) { Parm *p = NewParmWithoutFileLineInfo(type, "test"); @@ -4699,8 +4514,7 @@ /* ---------------------------------------------------------------------- * goEnumName() * - * Given an enum node, return a string to use for the enum type in - * Go. + * Given an enum node, return a string to use for the enum type in Go. * ---------------------------------------------------------------------- */ String *goEnumName(Node *n) { @@ -4739,11 +4553,11 @@ } - /* ------------------------------------------------------------ + /* ---------------------------------------------------------------------- * getParm() * * Get the real parameter to use. - * ------------------------------------------------------------ */ + * ---------------------------------------------------------------------- */ Parm *getParm(Parm *p) { while (p != NULL && checkAttribute(p, "tmap:in:numinputs", "0")) { @@ -4752,11 +4566,11 @@ return p; } - /* ------------------------------------------------------------ + /* ---------------------------------------------------------------------- * nextParm() * * Return the next parameter. - * ------------------------------------------------------------ */ + * ---------------------------------------------------------------------- */ Parm *nextParm(Parm *p) { if (p == NULL) { @@ -4768,27 +4582,24 @@ } } - /* ------------------------------------------------------------ + /* ---------------------------------------------------------------------- * isStatic * * Return whether a node should be considered as static rather than * as a member. - * ------------------------------------------------------------ */ + * ---------------------------------------------------------------------- */ bool isStatic(Node *n) { String *storage = Getattr(n, "storage"); - return (storage != NULL - && (Strcmp(storage, "static") == 0 - || Strcmp(storage, "friend") == 0) - && (!SmartPointer - || Getattr(n, "allocate:smartpointeraccess") == NULL)); + return (storage != NULL && (Strcmp(storage, "static") == 0 || Strcmp(storage, "friend") == 0) + && (!SmartPointer || Getattr(n, "allocate:smartpointeraccess") == NULL)); } - /* ------------------------------------------------------------ + /* ---------------------------------------------------------------------- * isFriend * * Return whether a node is a friend. - * ------------------------------------------------------------ */ + * ---------------------------------------------------------------------- */ bool isFriend(Node *n) { String *storage = Getattr(n, "storage"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wsf...@us...> - 2010-06-17 23:49:19
|
Revision: 12137 http://swig.svn.sourceforge.net/swig/?rev=12137&view=rev Author: wsfulton Date: 2010-06-17 23:49:12 +0000 (Thu, 17 Jun 2010) Log Message: ----------- code style: fix inconsistent NULL pointer comparisons Modified Paths: -------------- trunk/Source/Modules/go.cxx trunk/Source/Modules/guile.cxx trunk/Source/Modules/lang.cxx trunk/Source/Modules/modula3.cxx trunk/Source/Modules/ocaml.cxx trunk/Source/Modules/octave.cxx trunk/Source/Modules/perl5.cxx trunk/Source/Modules/php.cxx trunk/Source/Modules/python.cxx trunk/Source/Modules/r.cxx trunk/Source/Modules/ruby.cxx trunk/Source/Swig/misc.c Modified: trunk/Source/Modules/go.cxx =================================================================== --- trunk/Source/Modules/go.cxx 2010-06-17 23:03:18 UTC (rev 12136) +++ trunk/Source/Modules/go.cxx 2010-06-17 23:49:12 UTC (rev 12137) @@ -131,7 +131,7 @@ for (int i = 1; i < argc; i++) { if (argv[i]) { if (strcmp(argv[i], "-package") == 0) { - if (argv[i + 1] != NULL) { + if (argv[i + 1]) { package = NewString(argv[i + 1]); Swig_mark_arg(i); Swig_mark_arg(i + 1); @@ -143,7 +143,7 @@ Swig_mark_arg(i); gccgo_flag = true; } else if (strcmp(argv[i], "-go-prefix") == 0) { - if (argv[i + 1] != NULL) { + if (argv[i + 1]) { go_prefix = NewString(argv[i + 1]); Swig_mark_arg(i); Swig_mark_arg(i + 1); @@ -152,7 +152,7 @@ Swig_arg_error(); } } else if (strcmp(argv[i], "-soname") == 0) { - if (argv[i + 1] != NULL) { + if (argv[i + 1]) { soname = NewString(argv[i + 1]); Swig_mark_arg(i); Swig_mark_arg(i + 1); @@ -161,7 +161,7 @@ Swig_arg_error(); } } else if (strcmp(argv[i], "-longsize") == 0) { - if (argv[i + 1] != NULL) { + if (argv[i + 1]) { long_type_size = atoi(argv[i + 1]); if (long_type_size != 32 && long_type_size != 64) { Printf(stderr, "-longsize not 32 or 64\n"); @@ -179,7 +179,7 @@ } } - if (gccgo_flag && go_prefix == NULL) { + if (gccgo_flag && !go_prefix) { go_prefix = NewString("go"); } @@ -228,7 +228,7 @@ virtual int top(Node *n) { Node *optionsnode = Getattr(Getattr(n, "module"), "options"); - if (optionsnode != NULL) { + if (optionsnode) { if (Getattr(optionsnode, "directors")) { allow_directors(); } @@ -239,10 +239,10 @@ } String *module = Getattr(n, "name"); - if (package == NULL) { + if (!package) { package = Copy(module); } - if (soname == NULL) { + if (!soname) { soname = Copy(package); Append(soname, ".so"); } @@ -371,11 +371,11 @@ // Write out definitions for the types not defined by SWIG. Printv(f_go_wrappers, "\n", NULL); - for (Iterator p = First(undefined_types); p.key != NULL; p = Next(p)) { + for (Iterator p = First(undefined_types); p.key; p = Next(p)) { String *ty = goType(NULL, p.key); - if (Getattr(defined_types, ty) == NULL) { + if (!Getattr(defined_types, ty)) { String *cp = goCPointerType(p.key, false); - if (Getattr(defined_types, cp) == NULL) { + if (!Getattr(defined_types, cp)) { Printv(f_go_wrappers, "type ", cp, " uintptr\n", NULL); Printv(f_go_wrappers, "type ", ty, " interface {\n", NULL); Printv(f_go_wrappers, "\tSwigcptr() uintptr;\n", NULL); @@ -463,7 +463,7 @@ virtual int importDirective(Node *n) { String *hold_import = imported_package; String *modname = Getattr(n, "module"); - if (modname != NULL) { + if (modname) { Printv(f_go_begin, "import \"", modname, "\"\n", NULL); imported_package = modname; saw_import = true; @@ -517,7 +517,7 @@ // If this is a static variable, put in the class name, // capitalized. - if (is_static && class_name != NULL) { + if (is_static && class_name) { String *ccn = exportedName(class_name); Append(go_name, ccn); Delete(ccn); @@ -552,7 +552,7 @@ Delete(c2); Delete(c1); - if (Swig_methodclass(n) != NULL && Swig_directorclass(n) + if (Swig_methodclass(n) && Swig_directorclass(n) && Strcmp(Char(Getattr(n, "wrap:action")), director_prot_ctor_code) != 0) { // The core SWIG code skips the first parameter when // generating the $nondirector_new string. Recreate the @@ -603,7 +603,7 @@ overname = Getattr(n, "sym:overname"); } else { String *scope; - if (class_name == NULL || is_static || is_ctor_dtor) { + if (!class_name || is_static || is_ctor_dtor) { scope = NULL; } else { scope = NewString("swiggoscope."); @@ -616,7 +616,7 @@ } String *wname = Swig_name_wrapper(name); - if (overname != NULL) { + if (overname) { Append(wname, overname); } Setattr(n, "wrap:name", wname); @@ -629,9 +629,9 @@ return r; } - if (Getattr(n, "sym:overloaded") && Getattr(n, "sym:nextSibling") == NULL) { + if (Getattr(n, "sym:overloaded") && !Getattr(n, "sym:nextSibling")) { String *scope ; - if (class_name == NULL || is_static || is_ctor_dtor) { + if (!class_name || is_static || is_ctor_dtor) { scope = NULL; } else { scope = NewString("swiggoscope."); @@ -695,7 +695,7 @@ int makeWrappers(Node *n, String *name, String *go_name, String *overname, String *wname, List *base, ParmList *parms, SwigType *result, bool is_static) { - assert(result != NULL); + assert(result); bool needs_wrapper; int r = goFunctionWrapper(n, name, go_name, overname, wname, base, parms, result, is_static, &needs_wrapper); @@ -719,7 +719,7 @@ } } - if (class_methods != NULL) { + if (class_methods) { Setattr(class_methods, Getattr(n, "name"), NewString("")); } @@ -746,7 +746,7 @@ int required_count = emit_num_required(parms); String *receiver = class_receiver; - if (receiver != NULL && is_static) { + if (receiver && is_static) { receiver = NULL; } @@ -754,14 +754,14 @@ bool is_constructor = Cmp(nodetype, "constructor") == 0; bool is_destructor = Cmp(nodetype, "destructor") == 0; if (is_constructor || is_destructor) { - assert(class_receiver != NULL); - assert(base == NULL); + assert(class_receiver); + assert(!base); receiver = NULL; } - bool add_to_interface = (interfaces != NULL && !is_constructor && !is_destructor && !is_static && overname == NULL && is_public(n)); + bool add_to_interface = (interfaces && !is_constructor && !is_destructor && !is_static && !overname && is_public(n)); - bool needs_wrapper = (gccgo_flag || receiver != NULL || is_constructor || is_destructor || parm_count > required_count); + bool needs_wrapper = (gccgo_flag || receiver || is_constructor || is_destructor || parm_count > required_count); // See whether any of the function parameters are represented by // interface values When calling the C++ code, we need to convert @@ -805,12 +805,12 @@ Printv(f_go_wrappers, "uintptr", NULL); ++i; p = nextParm(p); - } else if (receiver != NULL && (base != NULL || !is_constructor)) { + } else if (receiver && (base || !is_constructor)) { if (parm_count > required_count) { Printv(f_go_wrappers, ", ", NULL); } Printv(f_go_wrappers, receiver, NULL); - if (base == NULL) { + if (!base) { ++i; p = nextParm(p); } @@ -819,7 +819,7 @@ p = getParm(p); // Give the parameter a name we will use below. Swig_cparm_name(p, i); - if (i > 0 || (base != NULL && receiver != NULL) || parm_count > required_count) { + if (i > 0 || (base && receiver) || parm_count > required_count) { Printv(f_go_wrappers, ", ", NULL); } String *tm = goWrapperType(p, Getattr(p, "type"), false); @@ -853,9 +853,9 @@ int pi = 0; // Add the receiver if this is a method. - if (receiver != NULL) { + if (receiver) { Printv(f_go_wrappers, "(", NULL); - if (base != NULL && receiver != NULL) { + if (base && receiver) { Printv(f_go_wrappers, "_swig_base", NULL); } else { Printv(f_go_wrappers, Getattr(p, "lname"), NULL); @@ -866,7 +866,7 @@ } Printv(f_go_wrappers, go_name, NULL); - if (overname != NULL) { + if (overname) { Printv(f_go_wrappers, overname, NULL); } Printv(f_go_wrappers, "(", NULL); @@ -888,7 +888,7 @@ Printv(parm_print, Getattr(p, "lname"), " ", cl, NULL); Delete(cl); } else { - if (pi > (receiver != NULL && base == NULL ? 1 : 0)) { + if (pi > (receiver && !base ? 1 : 0)) { Printv(parm_print, ", ", NULL); } if (pi >= required_count) { @@ -959,7 +959,7 @@ Printv(f_go_wrappers, "len(_swig_args)", NULL); } - if (base != NULL && receiver != NULL) { + if (base && receiver) { if (parm_count > required_count) { Printv(f_go_wrappers, ", ", NULL); } @@ -969,7 +969,7 @@ Parm *p = parms; for (int i = 0; i < parm_count; ++i) { p = getParm(p); - if (i > 0 || (base != NULL && receiver != NULL) + if (i > 0 || (base && receiver) || parm_count > required_count) { Printv(f_go_wrappers, ", ", NULL); } @@ -979,9 +979,7 @@ // C++ value, and we have the interface. We need to get the // C++ value. The same is true for a type represented as an // interface. - if ((i == 0 && is_destructor) - || ((i > 0 || receiver == NULL || base != NULL || is_constructor) - && goTypeIsInterface(p, Getattr(p, "type")))) { + if ((i == 0 && is_destructor) || ((i > 0 || !receiver || base || is_constructor) && goTypeIsInterface(p, Getattr(p, "type")))) { Printv(f_go_wrappers, ".Swigcptr()", NULL); } @@ -1031,7 +1029,7 @@ Append(parm_size, "SWIG_PARM_SIZE"); } - if (class_receiver != NULL && !is_static) { + if (class_receiver && !is_static) { if (Len(parm_size) > 0) { Append(parm_size, " + "); } @@ -1056,7 +1054,7 @@ String *fn_name; if (!needs_wrapper) { fn_name = Copy(go_name); - if (overname != NULL) { + if (overname) { Append(fn_name, overname); } } else { @@ -1129,7 +1127,7 @@ Swig_save("gccFunctionWrapper", n, "parms", NULL); Parm *base_parm = NULL; - if (base != NULL && !isStatic(n)) { + if (base && !isStatic(n)) { SwigType *base_type = Copy(Getattr(class_node, "classtype")); SwigType_add_pointer(base_type); base_parm = NewParm(base_type, NewString("arg1"), n); @@ -1187,7 +1185,7 @@ p = getParm(p); String *tm = Getattr(p, "tmap:in"); - if (tm == NULL) { + if (!tm) { Swig_warning(WARN_TYPEMAP_IN_UNDEF, input_file, line_number, "Unable to use type %s as a function argument\n", SwigType_str(Getattr(p, "type"), 0)); } else { String *ln = Getattr(p, "lname"); @@ -1245,7 +1243,7 @@ Swig_save("gccgoFunctionWrapper", n, "parms", NULL); Parm *base_parm = NULL; - if (base != NULL && !isStatic(n)) { + if (base && !isStatic(n)) { SwigType *base_type = Copy(Getattr(class_node, "classtype")); SwigType_add_pointer(base_type); base_parm = NewParm(base_type, NewString("arg1"), n); @@ -1315,7 +1313,7 @@ p = getParm(p); String *tm = Getattr(p, "tmap:in"); - if (tm == NULL) { + if (!tm) { Swig_warning(WARN_TYPEMAP_IN_UNDEF, input_file, line_number, "Unable to use type %s as a function argument\n", SwigType_str(Getattr(p, "type"), 0)); } else { @@ -1374,9 +1372,9 @@ void checkConstraints(ParmList *parms, Wrapper *f) { Parm *p = parms; - while (p != NULL) { + while (p) { String *tm = Getattr(p, "tmap:check"); - if (tm == NULL) { + if (!tm) { p = nextSibling(p); } else { Replaceall(tm, "$input", Getattr(p, "emit:input")); @@ -1394,7 +1392,7 @@ void emitGoAction(Node *n, List *base, ParmList *parms, SwigType *result, Wrapper *f) { String *actioncode; - if (base == NULL || isStatic(n)) { + if (!base || isStatic(n)) { Swig_director_emit_dynamic_cast(n, f); actioncode = emit_action(n); } else { @@ -1409,7 +1407,7 @@ String *last = NULL; int vc = 0; - for (Iterator bi = First(base); bi.item != NULL; bi = Next(bi)) { + for (Iterator bi = First(base); bi.item; bi = Next(bi)) { Printf(actioncode, " %s *swig_b%d = (%s *)%s;\n", bi.item, vc, bi.item, current); Delete(current); current = NewString(""); @@ -1428,7 +1426,7 @@ Setattr(n, "type", result); String *tm = Swig_typemap_lookup_out("out", n, "result", f, actioncode); - if (tm == NULL) { + if (!tm) { Swig_warning(WARN_TYPEMAP_OUT_UNDEF, input_file, line_number, "Unable to use return type %s\n", SwigType_str(result, 0)); } else { if (!gccgo_flag) { @@ -1458,9 +1456,9 @@ void argout(ParmList *parms, Wrapper *f) { Parm *p = parms; - while (p != NULL) { + while (p) { String *tm = Getattr(p, "tmap:argout"); - if (tm == NULL) { + if (!tm) { p = nextSibling(p); } else { Replaceall(tm, "$result", "result"); @@ -1482,9 +1480,9 @@ String *freearg(ParmList *parms) { String *ret = NewString(""); Parm *p = parms; - while (p != NULL) { + while (p) { String *tm = Getattr(p, "tmap:freearg"); - if (tm == NULL) { + if (!tm) { p = nextSibling(p); } else { Replaceall(tm, "$input", Getattr(p, "emit:input")); @@ -1507,7 +1505,7 @@ if (GetFlag(n, "feature:new")) { String *tm = Swig_typemap_lookup("newfree", n, "result", 0); - if (tm != NULL) { + if (tm) { Replaceall(tm, "$source", "result"); Printv(f->code, tm, "\n", NULL); Delete(tm); @@ -1547,7 +1545,7 @@ return goComplexConstant(n, type); } - if (Getattr(n, "storage") != NULL && Strcmp(Getattr(n, "storage"), "static") == 0) { + if (Getattr(n, "storage") && Strcmp(Getattr(n, "storage"), "static") == 0) { return goComplexConstant(n, type); } @@ -1563,7 +1561,7 @@ } } else if (SwigType_type(type) == T_STRING || SwigType_type(type) == T_CHAR) { // Backslash sequences are somewhat different in Go and C/C++. - if (Strchr(value, '\\') != NULL) { + if (Strchr(value, '\\') != 0) { return goComplexConstant(n, type); } } else { @@ -1644,7 +1642,7 @@ virtual int enumDeclaration(Node *n) { String *name = goEnumName(n); if (Strcmp(name, "int") != 0) { - if (!ImportMode || imported_package == NULL) { + if (!ImportMode || !imported_package) { if (!checkNameConflict(name, n, NULL)) { Delete(name); return SWIG_NOWRAP; @@ -1672,7 +1670,7 @@ if (!is_public(n)) { return SWIG_OK; } - if (Getattr(parentNode(n), "unnamed") != NULL) { + if (Getattr(parentNode(n), "unnamed")) { Setattr(n, "type", NewString("int")); } else { Setattr(n, "type", Getattr(parentNode(n), "enumtype")); @@ -1688,7 +1686,7 @@ int goComplexConstant(Node *n, SwigType *type) { String *symname = Getattr(n, "sym:name"); - if (symname == NULL) { + if (!symname) { symname = Getattr(n, "name"); } @@ -1703,7 +1701,7 @@ Printv(get, "result = ", NULL); char quote; - if (Getattr(n, "wrappedasconstant") != NULL) { + if (Getattr(n, "wrappedasconstant")) { quote = '\0'; } else if (SwigType_type(type) == T_CHAR) { quote = '\''; @@ -1727,13 +1725,13 @@ Setattr(n, "wrap:action", get); String *sname = Copy(symname); - if (class_name != NULL) { + if (class_name) { Append(sname, "_"); Append(sname, class_name); } String *go_name = NewString("_swig_get"); - if (class_name != NULL) { + if (class_name) { Append(go_name, class_name); Append(go_name, "_"); } @@ -1773,7 +1771,7 @@ class_node = n; List *baselist = Getattr(n, "bases"); - bool has_base_classes = baselist != NULL && Len(baselist) > 0; + bool has_base_classes = baselist && Len(baselist) > 0; String *name = Getattr(n, "sym:name"); @@ -1834,7 +1832,7 @@ // differently in Go and in C++. Hash *local = NewHash(); - for (Node *ni = Getattr(n, "firstChild"); ni != NULL; ni = nextSibling(ni)) { + for (Node *ni = Getattr(n, "firstChild"); ni; ni = nextSibling(ni)) { if (!is_public(ni)) { continue; @@ -1846,15 +1844,15 @@ } String *cname = Getattr(ni, "sym:name"); - if (cname == NULL) { + if (!cname) { cname = Getattr(ni, "name"); } - if (cname != NULL) { + if (cname) { Setattr(local, cname, NewString("")); } } - for (Iterator b = First(baselist); b.item != NULL; b = Next(b)) { + for (Iterator b = First(baselist); b.item; b = Next(b)) { List *bases = NewList(); Append(bases, Getattr(b.item, "classtype")); int r = addBase(n, b.item, bases, local); @@ -1911,7 +1909,7 @@ return SWIG_OK; } - for (Node *ni = Getattr(base, "firstChild"); ni != NULL; ni = nextSibling(ni)) { + for (Node *ni = Getattr(base, "firstChild"); ni; ni = nextSibling(ni)) { if (GetFlag(ni, "feature:ignore")) { continue; @@ -1931,15 +1929,15 @@ } String *mname = Getattr(ni, "sym:name"); - if (mname == NULL) { + if (!mname) { continue; } String *lname = Getattr(ni, "name"); - if (Getattr(class_methods, lname) != NULL) { + if (Getattr(class_methods, lname)) { continue; } - if (Getattr(local, lname) != NULL) { + if (Getattr(local, lname)) { continue; } Setattr(local, lname, NewString("")); @@ -1957,8 +1955,8 @@ return r; } - if (Getattr(ni, "sym:overloaded") != NULL) { - for (Node *on = Getattr(ni, "sym:nextSibling"); on != NULL; on = Getattr(on, "sym:nextSibling")) { + if (Getattr(ni, "sym:overloaded")) { + for (Node *on = Getattr(ni, "sym:nextSibling"); on; on = Getattr(on, "sym:nextSibling")) { r = goBaseMethod(n, bases, on); if (r != SWIG_OK) { return r; @@ -1986,8 +1984,8 @@ } List *baselist = Getattr(base, "bases"); - if (baselist != NULL && Len(baselist) > 0) { - for (Iterator b = First(baselist); b.item != NULL; b = Next(b)) { + if (baselist && Len(baselist) > 0) { + for (Iterator b = First(baselist); b.item; b = Next(b)) { List *nb = Copy(bases); Append(nb, Getattr(b.item, "classtype")); int r = addBase(n, b.item, nb, local); @@ -2025,7 +2023,7 @@ overname = Getattr(method, "sym:overname"); } String *wname = Swig_name_wrapper(name); - if (overname != NULL) { + if (overname) { Append(wname, overname); } @@ -2039,12 +2037,12 @@ // If the base method is imported, wrap:action may not be set. Swig_save("goBaseMethod", method, "wrap:name", "wrap:action", "parms", NULL); Setattr(method, "wrap:name", wname); - if (Getattr(method, "wrap:action") == NULL) { + if (!Getattr(method, "wrap:action")) { if (!is_static) { - Swig_MethodToFunction(method, getNSpace(), getClassType(), (Getattr(method, "template") != NULL ? SmartPointer : Extend | SmartPointer), NULL, false); + Swig_MethodToFunction(method, getNSpace(), getClassType(), (Getattr(method, "template") ? SmartPointer : Extend | SmartPointer), NULL, false); // Remove any self parameter that was just added. ParmList *parms = Getattr(method, "parms"); - if (parms != NULL && Getattr(parms, "self") != NULL) { + if (parms && Getattr(parms, "self")) { parms = CopyParmList(nextSibling(parms)); Setattr(method, "parms", parms); } @@ -2099,7 +2097,7 @@ String *mname = Swig_name_member(getNSpace(), Getattr(var_class, "sym:name"), var_name); if (is_assignable(var)) { - for (Iterator ki = First(var); ki.key != NULL; ki = Next(ki)) { + for (Iterator ki = First(var); ki.key; ki = Next(ki)) { if (Strncmp(ki.key, "tmap:", 5) == 0) { Delattr(var, ki.key); } @@ -2128,7 +2126,7 @@ Delete(mname_set); Swig_restore(var); - for (Iterator ki = First(var); ki.key != NULL; ki = Next(ki)) { + for (Iterator ki = First(var); ki.key; ki = Next(ki)) { if (Strncmp(ki.key, "tmap:", 5) == 0) { Delattr(var, ki.key); } @@ -2179,7 +2177,7 @@ * ------------------------------------------------------------ */ void addFirstBaseInterface(Node *n, Hash *parents, List *bases) { - if (bases == NULL || Len(bases) == 0) { + if (!bases || Len(bases) == 0) { return; } Iterator b = First(bases); @@ -2224,7 +2222,7 @@ Node *fb = b.item; - for (b = Next(b); b.item != NULL; b = Next(b)) { + for (b = Next(b); b.item; b = Next(b)) { if (GetFlag(b.item, "feature:ignore")) { continue; } @@ -2299,7 +2297,7 @@ void addParentExtraBaseInterfaces(Node *n, Hash *parents, Node *base, bool is_base_first, String *sofar) { List *baselist = Getattr(base, "bases"); - if (baselist == NULL || Len(baselist) == 0) { + if (!baselist || Len(baselist) == 0) { return; } @@ -2316,7 +2314,7 @@ } b = Next(b); - if (b.item == NULL) { + if (!b.item) { return; } } @@ -2324,14 +2322,14 @@ String *go_name = buildGoName(Getattr(n, "sym:name"), false, false); String *go_type_name = goCPointerType(Getattr(n, "classtypeobj"), true); - for (; b.item != NULL; b = Next(b)) { + for (; b.item; b = Next(b)) { if (GetFlag(b.item, "feature:ignore")) { continue; } String *go_base_name = exportedName(Getattr(b.item, "sym:name")); - if (Getattr(parents, go_base_name) == NULL) { + if (!Getattr(parents, go_base_name)) { Printv(f_go_wrappers, "func (p ", go_type_name, ") SwigGet", go_base_name, "() ", go_base_name, " {\n", NULL); Printv(f_go_wrappers, "\treturn p", sf, ".SwigGet", go_base_name, "()\n", NULL); Printv(f_go_wrappers, "}\n\n", NULL); @@ -2375,14 +2373,14 @@ String *name = Getattr(n, "sym:name"); - assert(class_name == NULL); + assert(!class_name); class_name = name; String *go_name = exportedName(name); String *go_type_name = goCPointerType(Getattr(n, "classtypeobj"), true); - assert(class_receiver == NULL); + assert(!class_receiver); class_receiver = go_type_name; String *director_struct_name = NewString("_swig_Director"); @@ -2431,7 +2429,7 @@ bool is_ignored = GetFlag(n, "feature:ignore"); String *name = Getattr(n, "sym:name"); - if (name == NULL) { + if (!name) { assert(is_ignored); name = Getattr(n, "name"); } @@ -2457,7 +2455,7 @@ Append(fn_name, cn); Append(fn_name, go_name); - if (overname == NULL && !is_ignored) { + if (!overname && !is_ignored) { if (!checkNameConflict(fn_name, n, NULL)) { return SWIG_NOWRAP; } @@ -2465,7 +2463,7 @@ String *wname = Swig_name_wrapper(fn_name); - if (overname != NULL) { + if (overname) { Append(wname, overname); } Setattr(n, "wrap:name", wname); @@ -2483,7 +2481,7 @@ Append(func_name, go_name); String *func_with_over_name = Copy(func_name); - if (overname != NULL) { + if (overname) { Append(func_with_over_name, overname); } @@ -2503,7 +2501,7 @@ if (!is_ignored) { // Declare the C++ wrapper. Printv(f_go_wrappers, "func ", fn_name, NULL); - if (overname != NULL) { + if (overname) { Printv(f_go_wrappers, overname, NULL); } Printv(f_go_wrappers, "(*", director_struct_name, NULL); @@ -2542,7 +2540,7 @@ Printv(f_go_wrappers, "\tp := &", director_struct_name, "{0, v}\n", NULL); Printv(f_go_wrappers, "\tp.", class_receiver, " = ", fn_name, NULL); - if (overname != NULL) { + if (overname) { Printv(f_go_wrappers, overname, NULL); } Printv(f_go_wrappers, "(p", NULL); @@ -2628,7 +2626,7 @@ Printv(f_c_directors, ", ", NULL); } String *pn = Getattr(p, "name"); - assert(pn != NULL); + assert(pn); Printv(f_c_directors, pn, NULL); p = nextParm(p); } @@ -2636,7 +2634,7 @@ Printv(f_c_directors, " go_val(swig_p)\n", NULL); Printv(f_c_directors, "{ }\n\n", NULL); - if (Getattr(n, "sym:overloaded") && Getattr(n, "sym:nextSibling") == NULL) { + if (Getattr(n, "sym:overloaded") && !Getattr(n, "sym:nextSibling")) { int r = makeDispatchFunction(n, func_name, cn, is_static, Getattr(parentNode(n), "classtypeobj"), false); if (r != SWIG_OK) { return r; @@ -2716,7 +2714,7 @@ Printv(f_c_directors_h, " virtual ~SwigDirector_", class_name, "()", NULL); String *throws = buildThrow(n); - if (throws != NULL) { + if (throws) { Printv(f_c_directors_h, " ", throws, NULL); } @@ -2732,7 +2730,7 @@ Printv(f_c_directors, "SwigDirector_", class_name, "::~SwigDirector_", class_name, "()", NULL); - if (throws != NULL) { + if (throws) { Printv(f_c_directors, " ", throws, NULL); Delete(throws); } @@ -2792,23 +2790,23 @@ } String *name = Getattr(n, "sym:name"); - if (name == NULL) { + if (!name) { assert(is_ignored); name = Getattr(n, "name"); } - if (Getattr(class_methods, name) != NULL) { + if (Getattr(class_methods, name)) { // We need to emit a pure virtual function, even if it is // overloaded. Otherwise we won't be able to create an instance // of the director class. The function doesn't need to actually // do anything. - if (!is_pure_virtual || Getattr(n, "sym:overloaded") != NULL) { + if (!is_pure_virtual || Getattr(n, "sym:overloaded")) { return SWIG_OK; } } Setattr(class_methods, name, NewString("")); - if (Getattr(n, "sym:overloaded") == NULL) { + if (!Getattr(n, "sym:overloaded")) { int r = oneClassDirectorMethod(n, parent); if (r != SWIG_OK) { return r; @@ -2819,7 +2817,7 @@ // class_methods so that we correctly handle cases where a // function in one class hides a function of the same name in a // parent class. - for (Node *on = Getattr(n, "sym:overloaded"); on != NULL; on = Getattr(on, "sym:nextSibling")) { + for (Node *on = Getattr(n, "sym:overloaded"); on; on = Getattr(on, "sym:nextSibling")) { int r = oneClassDirectorMethod(on, parent); if (r != SWIG_OK) { return r; @@ -2875,7 +2873,7 @@ bool is_pure_virtual = (Cmp(Getattr(n, "storage"), "virtual") == 0 && Cmp(Getattr(n, "value"), "0") == 0); String *name = Getattr(n, "sym:name"); - if (name == NULL) { + if (!name) { assert(is_ignored); name = Getattr(n, "name"); } @@ -2907,7 +2905,7 @@ int parm_count = emit_num_arguments(parms); SwigType *result = Getattr(n, "returntype"); - if (result == NULL) { + if (!result) { // This can happen when following overloads. result = NewString(Getattr(n, "type")); SwigType_push(result, Getattr(n, "decl")); @@ -2924,7 +2922,7 @@ String *interface_name = NewString("_swig_DirectorInterface"); Append(interface_name, cn); Append(interface_name, go_name); - if (overname != NULL) { + if (overname) { Append(interface_name, overname); } @@ -2932,7 +2930,7 @@ Append(callback_name, "_callback_"); Append(callback_name, name); Replace(callback_name, "_swig", "Swig", DOH_REPLACE_FIRST); - if (overname != NULL) { + if (overname) { Append(callback_name, overname); } @@ -2945,7 +2943,7 @@ String *upcall_wname = Swig_name_wrapper(upcall_name); String *go_with_over_name = Copy(go_name); - if (overname != NULL) { + if (overname) { Append(go_with_over_name, overname); } @@ -2955,7 +2953,7 @@ for (int i = 0; i < parm_count; ++i) { p = getParm(p); Swig_cparm_name(p, i); - if (Getattr(p, "name") == NULL) { + if (!Getattr(p, "name")) { String *pn = NewString(""); Printf(pn, "arg%d", i); Setattr(p, "name", pn); @@ -2996,7 +2994,7 @@ // Declare the upcall function, which calls the method on the // parent class. - if (overname != NULL) { + if (overname) { Append(upcall_wname, overname); } @@ -3102,7 +3100,7 @@ String *upcall_method_name = NewString("_swig_upcall_"); Append(upcall_method_name, name); - if (overname != NULL) { + if (overname) { Append(upcall_method_name, overname); } String *upcall_decl = Swig_method_decl(Getattr(n, "type"), Getattr(n, "decl"), upcall_method_name, parms, 0, 0); @@ -3122,7 +3120,7 @@ Printv(f_c_directors_h, ", ", NULL); } String *pn = Getattr(p, "name"); - assert(pn != NULL); + assert(pn); Printv(f_c_directors_h, pn, NULL); p = nextParm(p); } @@ -3340,7 +3338,7 @@ Printv(fnname, callback_wname, "(void*", NULL); p = parms; - while (p != NULL) { + while (p) { while (checkAttribute(p, "tmap:directorin:numinputs", "0")) { p = Getattr(p, "tmap:directorin:next"); } @@ -3386,7 +3384,7 @@ Delete(qname); String *throws = buildThrow(n); - if (throws != NULL) { + if (throws) { Printv(f_c_directors_h, " ", throws, NULL); Printv(f->def, " ", throws, NULL); Delete(throws); @@ -3406,7 +3404,7 @@ Printv(f->code, " void *go_val;\n", NULL); p = parms; - while (p != NULL) { + while (p) { while (checkAttribute(p, "tmap:directorin:numinputs", "0")) { p = Getattr(p, "tmap:directorin:next"); } @@ -3429,12 +3427,12 @@ Printv(f->code, " swig_a.go_val = go_val;\n", NULL); p = parms; - while (p != NULL) { + while (p) { while (checkAttribute(p, "tmap:directorin:numinputs", "0")) { p = Getattr(p, "tmap:directorin:next"); } String *tm = Getattr(p, "tmap:directorin"); - if (tm == NULL) { + if (!tm) { Swig_warning(WARN_TYPEMAP_DIRECTORIN_UNDEF, input_file, line_number, "Unable to use type %s as director method argument\n", SwigType_str(Getattr(p, "type"), 0)); } else { @@ -3455,7 +3453,7 @@ String *rname = NewString("c_result"); Parm *rp = NewParm(Getattr(n, "returntype"), rname, n); String *tm = Swig_typemap_lookup("directorout", rp, rname, NULL); - if (tm == NULL) { + if (!tm) { Swig_warning(WARN_TYPEMAP_DIRECTOROUT_UNDEF, input_file, line_number, "Unable to use type %s as director method result\n", SwigType_str(result, 0)); } else { @@ -3491,7 +3489,7 @@ String *args = NewString(""); p = parms; - while (p != NULL) { + while (p) { while (checkAttribute(p, "tmap:directorin:numinputs", "0")) { p = Getattr(p, "tmap:directorin:next"); } @@ -3505,7 +3503,7 @@ Delete(tm); tm = Getattr(p, "tmap:directorin"); - if (tm == NULL) { + if (!tm) { Swig_warning(WARN_TYPEMAP_DIRECTORIN_UNDEF, input_file, line_number, "Unable to use type %s as director method argument\n", SwigType_str(Getattr(p, "type"), 0)); } else { @@ -3529,7 +3527,7 @@ String *rname = NewString("c_result"); Parm *rp = NewParm(Getattr(n, "returntype"), rname, n); String *tm = Swig_typemap_lookup("directorout", rp, rname, NULL); - if (tm == NULL) { + if (!tm) { Swig_warning(WARN_TYPEMAP_DIRECTOROUT_UNDEF, input_file, line_number, "Unable to use type %s as director method result\n", SwigType_str(result, 0)); } else { @@ -3617,15 +3615,15 @@ String *buildThrow(Node *n) { ParmList *throw_parm_list = Getattr(n, "throws"); - if (throw_parm_list == NULL && Getattr(n, "throw") == NULL) + if (!throw_parm_list && !Getattr(n, "throw")) return NULL; String *ret = NewString("throw("); - if (throw_parm_list != NULL) { + if (throw_parm_list) { Swig_typemap_attach_parms("throws", throw_parm_list, NULL); } bool first = true; - for (Parm *p = throw_parm_list; p != NULL; p = nextSibling(p)) { - if (Getattr(p, "tmap:throws") != NULL) { + for (Parm *p = throw_parm_list; p; p = nextSibling(p)) { + if (Getattr(p, "tmap:throws")) { if (first) { first = false; } else { @@ -3660,7 +3658,7 @@ *--------------------------------------------------------------------*/ int makeDispatchFunction(Node *n, String *go_name, String *receiver, bool is_static, SwigType *director_struct, bool is_upcall) { - bool is_director = director_struct != NULL; + bool is_director = director_struct ? true : false; String *nodetype = Getattr(n, "nodeType"); bool is_constructor = Cmp(nodetype, "constructor") == 0; @@ -3670,7 +3668,7 @@ bool use_receiver = (!is_static && can_use_receiver); - bool add_to_interface = (interfaces != NULL && !is_constructor && !is_destructor && !is_static && !is_upcall); + bool add_to_interface = (interfaces && !is_constructor && !is_destructor && !is_static && !is_upcall); List *dispatch = Swig_overload_rank(n, false); int nfunc = Len(dispatch); @@ -3692,17 +3690,17 @@ for (int i = 0; i < nfunc; ++i) { Node *ni = Getitem(dispatch, i); SwigType *result = Getattr(ni, "go:type"); - assert(result != NULL); + assert(result); if (SwigType_type(result) == T_VOID) { - if (all_result != NULL) { + if (all_result) { mismatch = true; } any_void = true; } else { if (any_void) { mismatch = true; - } else if (all_result == NULL) { + } else if (!all_result) { all_result = Copy(result); } else if (Cmp(result, all_result) != 0) { mismatch = true; @@ -3712,7 +3710,7 @@ if (mismatch) { Delete(all_result); all_result = NULL; - } else if (all_result != NULL) { + } else if (all_result) { ; } else { all_result = NewString("void"); @@ -3721,7 +3719,7 @@ Printv(f_go_wrappers, "func ", NULL); - if (receiver != NULL && use_receiver) { + if (receiver && use_receiver) { Printv(f_go_wrappers, "(p ", receiver, ") ", NULL); } @@ -3745,7 +3743,7 @@ if (add_to_interface) { Printv(interfaces, " interface{}", NULL); } - } else if (all_result != NULL && SwigType_type(all_result) != T_VOID) { + } else if (all_result && SwigType_type(all_result) != T_VOID) { if (is_director && is_constructor) { Printv(f_go_wrappers, " ", receiver, NULL); if (add_to_interface) { @@ -3775,9 +3773,9 @@ // If we are using a receiver, we want to ignore a leading self // parameter. Because of the way this is called, there may or // may not be a self parameter at this point. - if (use_receiver && pi != NULL && Getattr(pi, "self") != NULL) { + if (use_receiver && pi && Getattr(pi, "self")) { pi = getParm(pi); - if (pi != NULL) { + if (pi) { pi = nextParm(pi); } } @@ -3801,9 +3799,9 @@ for (int k = i + 1; k < nfunc; ++k) { Node *nk = Getitem(dispatch, k); Parm *pk = Getattr(nk, "wrap:parms"); - if (use_receiver && pk != NULL && Getattr(pk, "self") != NULL) { + if (use_receiver && pk && Getattr(pk, "self")) { pk = getParm(pk); - if (pk != NULL) { + if (pk) { pk = nextParm(pk); } } @@ -3820,9 +3818,9 @@ if (Len(coll) > 0 && num_arguments > 0) { int j = 0; Parm *pj = pi; - while (pj != NULL) { + while (pj) { pj = getParm(pj); - if (pj == NULL) { + if (!pj) { break; } @@ -3833,9 +3831,9 @@ for (int k = 0; k < Len(coll) && !emitcheck; ++k) { Node *nk = Getitem(coll, k); Parm *pk = Getattr(nk, "wrap:parms"); - if (use_receiver && pk != NULL && Getattr(pk, "self") != NULL) { + if (use_receiver && pk && Getattr(pk, "self")) { pk = getParm(pk); - if (pk != NULL) { + if (pk) { pk = nextParm(pk); } } @@ -3844,9 +3842,9 @@ continue; int l = 0; Parm *pl = pk; - while (pl != NULL && l <= j) { + while (pl && l <= j) { pl = getParm(pl); - if (pl == NULL) { + if (!pl) { break; } if (l == j) { @@ -3898,15 +3896,15 @@ result = NULL; } - if (result != NULL && SwigType_type(result) != T_VOID && (all_result == NULL || SwigType_type(all_result) != T_VOID)) { + if (result && SwigType_type(result) != T_VOID && (!all_result || SwigType_type(all_result) != T_VOID)) { Printv(start, "return ", NULL); } bool advance_parm = false; - if (receiver != NULL && use_receiver) { + if (receiver && use_receiver) { Printv(start, "p.", go_name, NULL); - } else if (can_use_receiver && !isStatic(ni) && pi != NULL && Getattr(pi, "self") != NULL) { + } else if (can_use_receiver && !isStatic(ni) && pi && Getattr(pi, "self")) { // This is an overload of a static function and a non-static // function. assert(num_required > 0); @@ -3936,7 +3934,7 @@ int pn = 0; if (advance_parm) { p = getParm(p); - if (p != NULL) { + if (p) { p = nextParm(p); } ++pn; @@ -3958,17 +3956,17 @@ } String *end = NULL; - if (result == NULL || SwigType_type(result) == T_VOID || (all_result != NULL && SwigType_type(all_result) == T_VOID)) { + if (!result || SwigType_type(result) == T_VOID || (all_result && SwigType_type(all_result) == T_VOID)) { end = NewString(""); Printv(end, "return", NULL); - if (all_result == NULL || SwigType_type(all_result) != T_VOID) { + if (!all_result || SwigType_type(all_result) != T_VOID) { Printv(end, " 0", NULL); } } if (num_required == num_arguments) { Printv(f_go_wrappers, "\t\t", start, ")\n", NULL); - if (end != NULL) { + if (end) { Printv(f_go_wrappers, "\t\t", end, "\n", NULL); } } else { @@ -3985,7 +3983,7 @@ nc = true; } Printv(f_go_wrappers, ")\n", NULL); - if (end != NULL) { + if (end) { Printv(f_go_wrappers, "\t\t\t", end, "\n", NULL); } } @@ -4058,7 +4056,7 @@ String *removeClassname(String *name) { String *copy = Copy(name); - if (class_name != NULL) { + if (class_name) { char *p = Char(name); if (Strncmp(name, class_name, Len(class_name)) == 0 && p[Len(class_name)] == '_') { Replace(copy, class_name, "", DOH_REPLACE_FIRST); @@ -4080,7 +4078,7 @@ String *buildGoName(String *name, bool is_static, bool is_friend) { String *nw = NewString(""); - if (is_static && !is_friend && class_name != NULL) { + if (is_static && !is_friend && class_name) { String *c1 = exportedName(class_name); Append(nw, c1); Delete(c1); @@ -4109,7 +4107,7 @@ Append(s1, name); String *s2 = Swig_name_mangle(s1); Delete(s1); - if (overname != NULL) { + if (overname) { Append(s2, overname); } return s2; @@ -4126,13 +4124,13 @@ bool checkNameConflict(String* name, Node* n, const_String_or_char_ptr scope) { Node *lk = symbolLookup(name, scope); - if (lk != NULL) { + if (lk) { String *n1 = Getattr(n, "sym:name"); - if (n1 == NULL) { + if (!n1) { n1 = Getattr(n, "name"); } String *n2 = Getattr(lk, "sym:name"); - if (n2 == NULL) { + if (!n2) { n2 = Getattr(lk, "name"); } Swig_warning(WARN_GO_NAME_CONFLICT, input_file, line_number, @@ -4155,7 +4153,7 @@ bool checkIgnoredParameters(Node *n, String *go_name) { ParmList *parms = Getattr(n, "parms"); - if (parms != NULL) { + if (parms) { Wrapper *dummy = NewWrapper(); emit_attach_parmmaps(parms, dummy); int parm_count = emit_num_arguments(parms); @@ -4197,13 +4195,13 @@ bool ret = true; bool is_conflict = false; Node *e = Language::enumLookup(t); - if (e != NULL) { + if (e) { if (GetFlag(e, "go:conflict")) { is_conflict = true; } } else if (SwigType_issimple(t)) { Node *cn = classLookup(t); - if (cn != NULL) { + if (cn) { if (GetFlag(cn, "go:conflict")) { is_conflict = true; } @@ -4264,17 +4262,17 @@ * ---------------------------------------------------------------------- */ String *goTypeWithInfo(Node *n, SwigType *type, bool *p_is_interface) { - if (p_is_interface != NULL) { + if (p_is_interface) { *p_is_interface = false; } String *ret; - if (n != NULL && Cmp(type, Getattr(n, "type")) == 0) { + if (n && Cmp(type, Getattr(n, "type")) == 0) { ret = NULL; if (Strcmp(Getattr(n, "nodeType"), "parm") == 0) { ret = Getattr(n, "tmap:gotype"); } - if (ret == NULL) { + if (!ret) { ret = Swig_typemap_lookup("gotype", n, "", NULL); } } else { @@ -4283,18 +4281,18 @@ Delete(p); } - if (Strstr(ret, "$gotypename") != NULL) { + if (Strstr(ret, "$gotypename") != 0) { ret = NULL; } - if (ret != NULL) { + if (ret) { return Copy(ret); } SwigType *t = SwigType_typedef_resolve_all(type); Node *e = Language::enumLookup(t); - if (e != NULL) { + if (e) { ret = goEnumName(e); } else if (Strcmp(t, "enum ") == 0) { ret = NewString("int"); @@ -4304,15 +4302,15 @@ ret = NewString("_swig_memberptr"); } else if (SwigType_issimple(t)) { Node *cn = classLookup(t); - if (cn != NULL) { + if (cn) { ret = Getattr(cn, "sym:name"); - if (ret == NULL) { + if (!ret) { ret = Getattr(cn, "name"); } ret = exportedName(ret); Node *cnmod = Getattr(cn, "module"); - if (cnmod == NULL || Strcmp(Getattr(cnmod, "name"), package) == 0) { + if (!cnmod || Strcmp(Getattr(cnmod, "name"), package) == 0) { Setattr(undefined_types, t, t); } else { String *nw = NewString(""); @@ -4325,7 +4323,7 @@ ret = exportedName(t); Setattr(undefined_types, t, t); } - if (p_is_interface != NULL) { + if (p_is_interface) { *p_is_interface = true; } } else if (SwigType_ispointer(t) || SwigType_isarray(t)) { @@ -4369,7 +4367,7 @@ if (is_interface) { if (!is_pointer_to_pointer) { ret = base; - if (p_is_interface != NULL) { + if (p_is_interface) { *p_is_interface = true; } } else { @@ -4415,7 +4413,7 @@ Delete(t); - if (ret == NULL) { + if (!ret) { Swig_warning(WARN_LANG_NATIVE_UNIMPL, input_file, line_number, "No Go typemap defined for %s\n", SwigType_str(type, 0)); ret = NewString("uintptr"); } @@ -4478,7 +4476,7 @@ Node *cn = classLookup(ty); String *ex; String *ret; - if (cn == NULL) { + if (!cn) { if (add_to_hash) { Setattr(undefined_types, ty, ty); } @@ -4487,12 +4485,12 @@ Append(ret, ex); } else { String *cname = Getattr(cn, "sym:name"); - if (cname == NULL) { + if (!cname) { cname = Getattr(cn, "name"); } ex = exportedName(cname); Node *cnmod = Getattr(cn, "module"); - if (cnmod == NULL || Strcmp(Getattr(cnmod, "name"), package) == 0) { + if (!cnmod || Strcmp(Getattr(cnmod, "name"), package) == 0) { if (add_to_hash) { Setattr(undefined_types, ty, ty); } @@ -4625,7 +4623,7 @@ Parm *p = NewParmWithoutFileLineInfo(type, "test"); SwigType *tm = Swig_typemap_lookup("gotype", p, "", NULL); Delete(p); - if (tm != NULL && Strstr(tm, "$gotypename") == NULL) { + if (tm && Strstr(tm, "$gotypename") == 0) { Delete(tm); return true; } @@ -4641,7 +4639,7 @@ String *goEnumName(Node *n) { String *ret = Getattr(n, "go:enumname"); - if (ret != NULL) { + if (ret) { return Copy(ret); } @@ -4650,7 +4648,7 @@ } String *type = Getattr(n, "enumtype"); - assert(type != NULL); + assert(type); char *p = Char(type); int len = Len(type); String *s = NewString(""); @@ -4682,7 +4680,7 @@ * ---------------------------------------------------------------------- */ Parm *getParm(Parm *p) { - while (p != NULL && checkAttribute(p, "tmap:in:numinputs", "0")) { + while (p && checkAttribute(p, "tmap:in:numinputs", "0")) { p = Getattr(p, "tmap:in:next"); } return p; @@ -4695,9 +4693,9 @@ * ---------------------------------------------------------------------- */ Parm *nextParm(Parm *p) { - if (p == NULL) { + if (!p) { return NULL; - } else if (Getattr(p, "tmap:in") != NULL) { + } else if (Getattr(p, "tmap:in")) { return Getattr(p, "tmap:in:next"); } else { return nextSibling(p); @@ -4713,8 +4711,7 @@ bool isStatic(Node *n) { String *storage = Getattr(n, "storage"); - return (storage != NULL && (Strcmp(storage, "static") == 0 || Strcmp(storage, "friend") == 0) - && (!SmartPointer || Getattr(n, "allocate:smartpointeraccess") == NULL)); + return (storage && (Strcmp(storage, "static") == 0 || Strcmp(storage, "friend") == 0) && (!SmartPointer || !Getattr(n, "allocate:smartpointeraccess"))); } /* ---------------------------------------------------------------------- @@ -4725,7 +4722,7 @@ bool isFriend(Node *n) { String *storage = Getattr(n, "storage"); - return storage != NULL && Strcmp(storage, "friend") == 0; + return storage && Strcmp(storage, "friend") == 0; } }; /* class GO */ Modified: trunk/Source/Modules/guile.cxx =================================================================== --- trunk/Source/Modules/guile.cxx 2010-06-17 23:03:18 UTC (rev 12136) +++ trunk/Source/Modules/guile.cxx 2010-06-17 23:49:12 UTC (rev 12137) @@ -114,7 +114,7 @@ extern "C" { static int has_classname(Node *class_node) { - return Getattr(class_node, "guile:goopsclassname") != NULL; + return Getattr(class_node, "guile:goopsclassname") ? 1 : 0; } } @@ -254,7 +254,7 @@ } // set default value for primsuffix - if (primsuffix == NULL) + if (!primsuffix) primsuffix = NewString("primitive"); //goops support can only be enabled if passive or module linkage is used @@ -628,7 +628,7 @@ if (maybe_delimiter && Len(output) > 0 && Len(tm) > 0) { Printv(output, maybe_delimiter, NIL); } - const String *pn = (name == NULL) ? (const String *) Getattr(p, "name") : name; + const String *pn = !name ? (const String *) Getattr(p, "name") : name; String *pt = Getattr(p, "type"); Replaceall(tm, "$name", pn); // legacy for $parmname Replaceall(tm, "$type", SwigType_str(pt, 0)); @@ -781,7 +781,7 @@ if (strcmp("void", Char(pt)) != 0) { Node *class_node = Swig_symbol_clookup_check(pb, Getattr(n, "sym:symtab"), has_classname); - String *goopsclassname = (class_node == NULL) ? NULL : Getattr(class_node, "guile:goopsclassname"); + String *goopsclassname = !class_node ? NULL : Getattr(class_node, "guile:goopsclassname"); /* do input conversion */ if (goopsclassname) { Printv(method_signature, " (", argname, " ", goopsclassname, ")", NIL); Modified: trunk/Source/Modules/lang.cxx =================================================================== --- trunk/Source/Modules/lang.cxx 2010-06-17 23:03:18 UTC (rev 12136) +++ trunk/Source/Modules/lang.cxx 2010-06-17 23:49:12 UTC (rev 12137) @@ -2996,7 +2996,7 @@ Node *Language::symbolLookup(String *s, const_String_or_char_ptr scope) { Hash *symbols = Getattr(symtabs, scope ? scope : ""); - if (symbols == NULL) { + if (!symbols) { return NULL; } return Getattr(symbols, s); Modified: trunk/Source/Modules/modula3.cxx =================================================================== --- trunk/Source/Modules/modula3.cxx 2010-06-17 23:03:18 UTC (rev 12136) +++ trunk/Source/Modules/modula3.cxx 2010-06-17 23:49:12 UTC (rev 12137) @@ -1324,7 +1324,7 @@ Parm *p; attachParameterNames(n, "tmap:name", "c:wrapname", "m3arg%d"); bool gencomma = false; - for (p = skipIgnored(l, "in"); p != NULL; p = skipIgnored(p, "in")) { + for (p = skipIgnored(l, "in"); p; p = skipIgnored(p, "in")) { String *arg = Getattr(p, "c:wrapname"); { @@ -1545,7 +1545,7 @@ Parm *p; writeArgState state; attachParameterNames(n, "tmap:rawinname", "modula3:rawname", "arg%d"); - for (p = skipIgnored(l, "m3rawintype"); p != NULL; p = skipIgnored(p, "m3rawintype")) { + for (p = skipIgnored(l, "m3rawintype"); p; p = skipIgnored(p, "m3rawintype")) { /* Get argument passing mode, should be one of VALUE, VAR, READONLY */ String *mode = Getattr(p, "tmap:m3rawinmode"); @@ -1928,7 +1928,7 @@ } else if (Strcmp(code, "unsafe") == 0) { unsafe_module = true; } else if (Strcmp(code, "library") == 0) { - if (targetlibrary != NULL) { + if (targetlibrary) { Delete(targetlibrary); } targetlibrary = Copy(strvalue); Modified: trunk/Source/Modules/ocaml.cxx =================================================================== --- trunk/Source/Modules/ocaml.cxx 2010-06-17 23:03:18 UTC (rev 12136) +++ trunk/Source/Modules/ocaml.cxx 2010-06-17 23:49:12 UTC (rev 12137) @@ -1599,7 +1599,7 @@ tm = Getattr(n, "feature:director:except"); } if ((tm) && Len(tm) && (Strcmp(tm, "1") != 0)) { - Printf(w->code, "if (result == NULL) {\n"); + Printf(w->code, "if (!result) {\n"); Printf(w->code, " CAML_VALUE error = *caml_named_value(\"director_except\");\n"); Replaceall(tm, "$error", "error"); Printv(w->code, Str(tm), "\n", NIL); Modified: trunk/Source/Modules/octave.cxx =================================================================== --- trunk/Source/Modules/octave.cxx 2010-06-17 23:03:18 UTC (rev 12136) +++ trunk/Source/Modules/octave.cxx 2010-06-17 23:49:12 UTC (rev 12137) @@ -1244,7 +1244,7 @@ idx = 0; p = l; int use_parse = 0; - while (p != NULL) { + while (p) { if (checkAttribute(p, "tmap:in:numinputs", "0")) { p = Getattr(p, "tmap:in:next"); continue; Modified: trunk/Source/Modules/perl5.cxx =================================================================== --- trunk/Source/Modules/perl5.cxx 2010-06-17 23:03:18 UTC (rev 12136) +++ trunk/Source/Modules/perl5.cxx 2010-06-17 23:49:12 UTC (rev 12137) @@ -308,7 +308,7 @@ if (no_pmfile) { f_pm = NewString(0); } else { - if (pmfile == NULL) { + if (!pmfile) { char *m = Char(module) + Len(module); while (m != Char(module)) { if (*m == ':') { Modified: trunk/Source/Modules/php.cxx =================================================================== --- trunk/Source/Modules/php.cxx 2010-06-17 23:03:18 UTC (rev 12136) +++ trunk/Source/Modules/php.cxx 2010-06-17 23:49:12 UTC (rev 12137) @@ -1206,7 +1206,7 @@ } if (!pname_cstr) { // Unnamed parameter, e.g. int foo(int); - } else if (pname == NULL) { + } else if (!pname) { pname = NewString(pname_cstr); } else { size_t len = strlen(pname_cstr); @@ -1290,7 +1290,7 @@ if (errno || *p) { Clear(value); Append(value, "?"); - } else if (strchr(Char(value), '.') == NULL) { + } else if (strchr(Char(value), '.') == 0) { // Ensure value is a double constant, not an integer one. Append(value, ".0"); double val2 = strtod(Char(value), &p); @@ -2496,7 +2496,7 @@ idx = 0; p = l; int use_parse = 0; - while (p != NULL) { + while (p) { if (checkAttribute(p, "tmap:in:numinputs", "0")) { p = Getattr(p, "tmap:in:next"); continue; Modified: trunk/Source/Modules/python.cxx =================================================================== --- trunk/Source/Modules/python.cxx 2010-06-17 23:03:18 UTC (rev 12136) +++ trunk/Source/Modules/python.cxx 2010-06-17 23:49:12 UTC (rev 12137) @@ -1073,7 +1073,7 @@ bool have_docstring(Node *n) { String *str = Getattr(n, "feature:docstring"); - return (str != NULL && Len(str) > 0) || (Getattr(n, "feature:autodoc") && !GetFlag(n, "feature:noautodoc")); + return (str && Len(str) > 0) || (Getattr(n, "feature:autodoc") && !GetFlag(n, "feature:noautodoc")); } /* ------------------------------------------------------------ @@ -1085,7 +1085,7 @@ String *docstring(Node *n, autodoc_t ad_type, const String *indent, bool use_triple = true) { String *str = Getattr(n, "feature:docstring"); - bool have_ds = (str != NULL && Len(str) > 0); + bool have_ds = (str && Len(str) > 0); bool have_auto = (Getattr(n, "feature:autodoc") && !GetFlag(n, "feature:noautodoc")); const char *triple_double = use_triple ? "\"\"\"" : ""; String *autodoc = NULL; @@ -1101,7 +1101,7 @@ if (have_auto) { autodoc = make_autodoc(n, ad_type); - have_auto = (autodoc != NULL && Len(autodoc) > 0); + have_auto = (autodoc && Len(autodoc) > 0); } // If there is more than one line then make docstrings like this: // @@ -1116,14 +1116,14 @@ doc = NewString(""); Printv(doc, triple_double, "\n", pythoncode(autodoc, indent), "\n", pythoncode(str, indent), indent, triple_double, NIL); } else if (!have_auto && have_ds) { // only docstring - if (Strchr(str, '\n') == NULL) { + if (Strchr(str, '\n') == 0) { doc = NewStringf("%s%s%s", triple_double, str, triple_double); } else { doc = NewString(""); Printv(doc, triple_double, "\n", pythoncode(str, indent), indent, triple_double, NIL); } } else if (have_auto && !have_ds) { // only autodoc - if (Strchr(autodoc, '\n') == NULL) { + if (Strchr(autodoc, '\n') == 0) { doc = NewStringf("%s%s%s", triple_double, autodoc, triple_double); } else { doc = NewString(""); @@ -1361,7 +1361,7 @@ { // Only do the autodoc if there isn't a docstring for the class String *str = Getattr(n, "feature:docstring"); - if (str == NULL || Len(str) == 0) { + if (!str || Len(str) == 0) { if (CPlusPlus) { Printf(doc, "Proxy of C++ %s class", real_classname); } else { @@ -1557,7 +1557,7 @@ bool have_pythonprepend(Node *n) { String *str = Getattr(n, "feature:pythonprepend"); - return (str != NULL && Len(str) > 0); + return (str && Len(str) > 0); } /* ------------------------------------------------------------ @@ -1584,7 +1584,7 @@ String *str = Getattr(n, "feature:pythonappend"); if (!str) str = Getattr(n, "feature:addtofunc"); - return (str != NULL && Len(str) > 0); + return (str && Len(str) > 0); } /* ------------------------------------------------------------ @@ -2741,7 +2741,7 @@ Printf(f_directors_h, " if (!method) {\n"); Printf(f_directors_h, " swig::SwigVar_PyObject name = SWIG_Python_str_FromChar(method_name);\n"); Printf(f_directors_h, " method = PyObject_GetAttr(swig_get_self(), name);\n"); - Printf(f_directors_h, " if (method == NULL) {\n"); + Printf(f_directors_h, " if (!method) {\n"); Printf(f_directors_h, " std::string msg = \"Method in class %s doesn't exist, undefined \";\n", classname); Printf(f_directors_h, " msg += method_name;\n"); Printf(f_directors_h, " Swig::DirectorMethodException::raise(msg.c_str());\n"); @@ -2904,7 +2904,7 @@ Printf(f_shadow, ":\n"); if (have_docstring(n)) { String *str = docstring(n, AUTODOC_CLASS, tab4); - if (str != NULL && Len(str)) + if (str && Len(str)) Printv(f_shadow, tab4, str, "\n", NIL); } if (!modern) { @@ -3723,7 +3723,7 @@ idx = 0; p = l; int use_parse = 0; - while (p != NULL) { + while (p) { if (checkAttribute(p, "tmap:in:numinputs", "0")) { p = Getattr(p, "tmap:in:next"); continue; @@ -3910,13 +3910,13 @@ if (tm) tm = Copy(tm); } - Append(w->code, "if (result == NULL) {\n"); + Append(w->code, "if (!result) {\n"); Append(w->code, " PyObject *error = PyErr_Occurred();\n"); if ((tm) && Len(tm) && (Strcmp(tm, "1") != 0)) { Replaceall(tm, "$error", "error"); Printv(w->code, Str(tm), "\n", NIL); } else { - Append(w->code, " if (error != NULL) {\n"); + Append(w->code, " if (error) {\n"); Printf(w->code, " Swig::DirectorMethodException::raise(\"Error detected when calling '%s.%s'\");\n", classname, pyname); Append(w->code, " }\n"); } Modified: trunk/Source/Modules/r.cxx =================================================================== --- trunk/Source/Modules/r.cxx 2010-06-17 23:03:18 UTC (rev 12136) +++ trunk/Source/Modules/r.cxx 2010-06-17 23:49:12 UTC (rev 12137) @@ -2514,7 +2514,7 @@ int status(Language::membervariableHandler(n)); - if(opaqueClassDeclaration == NULL && debugMode) + if(!opaqueClassDeclaration && debugMode) Printf(stderr, "<membervariableHandler> %s %s\n", Getattr(n, "name"), Getattr(n, "type")); processing_member_access_function = 0; Modified: trunk/Source/Modules/ruby.cxx =================================================================== --- trunk/Source/Modules/ruby.cxx 2010-06-17 23:03:18 UTC (rev 12136) +++ trunk/Source/Modules/ruby.cxx 2010-06-17 23:49:12 UTC (rev 12137) @@ -231,7 +231,7 @@ bool have_docstring(Node *n) { String *str = Getattr(n, "feature:docstring"); - return (str != NULL && Len(str) > 0) || (Getattr(n, "feature:autodoc") && !GetFlag(n, "feature:noautodoc")); + return (str && Len(str) > 0) || (Getattr(n, "feature:autodoc") && !GetFlag(n, "feature:noautodoc")); } /* ------------------------------------------------------------ @@ -244,7 +244,7 @@ String *docstring(Node *n, autodoc_t ad_type) { String *str = Getattr(n, "feature:docstring"); - bool have_ds = (str != NULL && Len(str) > 0); + bool have_ds = (str && Len(str) > 0); bool have_auto = (Getattr(n, "feature:autodoc") && !GetFlag(n, "feature:noautodoc")); String *autodoc = NULL; String *doc = NULL; @@ -259,7 +259,7 @@ if (have_auto) { autodoc = make_autodoc(n, ad_type); - have_auto = (autodoc != NULL && Len(autodoc) > 0); + have_auto = (autodoc && Len(autodoc) > 0); } // If there is more than one line then make docstrings like this: // @@ -272,14 +272,14 @@ doc = NewString(""); Printv(doc, "\n", autodoc, "\n", str, NIL); } else if (!have_auto && have_ds) { // only docstring - if (Strchr(str, '\n') == NULL) { + if (Strchr(str, '\n') == 0) { doc = NewString(str); } else { doc = NewString(""); Printv(doc, str, NIL); } } else if (have_auto && !have_ds) { // only autodoc - if (Strchr(autodoc, '\n') == NULL) { + if (Strchr(autodoc, '\n') == 0) { doc = NewStringf("%s", autodoc); } else { doc = NewString(""); @@ -618,7 +618,7 @@ { // Only do the autodoc if there isn't a docstring for the class String *str = Getattr(n, "feature:docstring"); - if (counter == 0 && (str == NULL || Len(str) == 0)) { + if (counter == 0 && (str == 0 || Len(str) == 0)) { if (CPlusPlus) { Printf(doc, " Proxy of C++ %s class", full_name); } else { Modified: trunk/Source/Swig/misc.c =================================================================== --- trunk/Source/Swig/misc.c 2010-06-17 23:03:18 UTC (rev 12136) +++ trunk/Source/Swig/misc.c 2010-06-17 23:49:12 UTC (rev 12137) @@ -1092,7 +1092,7 @@ } else { const char *cs = Char(s); const char *ce = Strchr(cs, ']'); - if (*cs != '[' || ce == NULL) { + if (*cs != '[' || !ce) { ns = NewString(s); } else { String *fmt = NewStringf("%%.%ds", ce-cs-1); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wsf...@us...> - 2011-03-14 07:22:16
|
Revision: 12536 http://swig.svn.sourceforge.net/swig/?rev=12536&view=rev Author: wsfulton Date: 2011-03-14 07:22:08 +0000 (Mon, 14 Mar 2011) Log Message: ----------- Remove redundant code highlighted by warnings in gcc-4.6 Modified Paths: -------------- trunk/Source/CParse/parser.y trunk/Source/DOH/string.c trunk/Source/Modules/allegrocl.cxx trunk/Source/Modules/allocate.cxx trunk/Source/Modules/chicken.cxx trunk/Source/Modules/csharp.cxx trunk/Source/Modules/d.cxx trunk/Source/Modules/emit.cxx trunk/Source/Modules/go.cxx trunk/Source/Modules/java.cxx trunk/Source/Modules/main.cxx trunk/Source/Modules/mzscheme.cxx trunk/Source/Modules/ocaml.cxx trunk/Source/Modules/octave.cxx trunk/Source/Modules/php.cxx trunk/Source/Modules/python.cxx trunk/Source/Modules/r.cxx trunk/Source/Modules/ruby.cxx trunk/Source/Modules/typepass.cxx trunk/Source/Modules/uffi.cxx trunk/Source/Swig/cwrap.c trunk/Source/Swig/scanner.c trunk/Source/Swig/swig.h trunk/Source/Swig/symbol.c trunk/Source/Swig/typesys.c Modified: trunk/Source/CParse/parser.y =================================================================== --- trunk/Source/CParse/parser.y 2011-03-13 22:05:33 UTC (rev 12535) +++ trunk/Source/CParse/parser.y 2011-03-14 07:22:08 UTC (rev 12536) @@ -2768,7 +2768,6 @@ template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN valparms GREATERTHAN SEMI { Parm *p, *tp; Node *n; - Node *tnode = 0; Symtab *tscope = 0; int specialized = 0; @@ -2929,7 +2928,6 @@ } Delattr(templnode,"templatetype"); Setattr(templnode,"template",nn); - tnode = templnode; Setfile(templnode,cparse_file); Setline(templnode,cparse_line); Delete(temparms); Modified: trunk/Source/DOH/string.c =================================================================== --- trunk/Source/DOH/string.c 2011-03-13 22:05:33 UTC (rev 12535) +++ trunk/Source/DOH/string.c 2011-03-14 07:22:08 UTC (rev 12536) @@ -269,7 +269,6 @@ static int String_insert(DOH *so, int pos, DOH *str) { String *s; - char *nstr; int len; char *data; @@ -289,7 +288,6 @@ data = (char *) (str); len = (int) strlen(data); } - nstr = s->str; if (pos < 0) pos = 0; Modified: trunk/Source/Modules/allegrocl.cxx =================================================================== --- trunk/Source/Modules/allegrocl.cxx 2011-03-13 22:05:33 UTC (rev 12535) +++ trunk/Source/Modules/allegrocl.cxx 2011-03-14 07:22:08 UTC (rev 12536) @@ -2500,11 +2500,8 @@ Delete(parsed); - int isPtrReturn = 0; - if (cl_t) { lclass = lookup_defined_foreign_ltype(cl_t); - isPtrReturn = 1; } int ff_foreign_ptr = 0; @@ -2523,17 +2520,8 @@ Replaceall(wrap->code, "$out_fftype", out_ffitype); if (deref_out_ffitype) Replaceall(wrap->code, "$*out_fftype", deref_out_ffitype); - // if(Replaceall(wrap->code,"$lclass", lclass) && !isPtrReturn) { - // Swig_warning(WARN_LANG_RETURN_TYPE,Getfile(n), Getline(n), - // "While Wrapping %s, replaced a $lclass reference when return type is non-pointer %s!\n", - // Getattr(n,"name"), cl_t); - // } Replaceall(wrap->code, "$body", NewStringf("(swig-ff-call%s)", wrap->locals)); -// Replaceall(wrap->code,"$body", -// (!Strcmp(result_type,"void") ? -// NewStringf("(swig-ff-call%s)", wrap->locals) : -// NewStringf("(push (swig-ff-call%s) ACL_result)", wrap->locals))); String *ldestructor = Copy(lclass); if (ff_foreign_ptr) Replaceall(ldestructor, ldestructor, "cl::identity"); @@ -2870,23 +2858,13 @@ // String *name = Getattr(n, "name"); SwigType *type = Getattr(n, "type"); - SwigType *ctype; SwigType *rtype = SwigType_typedef_resolve_all(type); - int pointer_added = 0; - if (SwigType_isclass(rtype)) { SwigType_add_pointer(type); SwigType_add_pointer(rtype); - pointer_added = 1; } - ctype = SwigType_str(type, 0); - // EXPORT <SwigType_str> <mangled_name>; - // <SwigType_str> <mangled_name> = <name>; - // Printf(f_runtime, "EXPORT %s %s;\n%s %s = %s%s;\n", ctype, mangled_name, - // ctype, mangled_name, (pointer_added ? "&" : ""), name); - Printf(f_clwrap, "(swig-defvar \"%s\" \"%s\" :type %s)\n", Getattr(n, "sym:name"), Getattr(n, "sym:name"), ((SwigType_isconst(type)) ? ":constant" : ":variable")); Modified: trunk/Source/Modules/allocate.cxx =================================================================== --- trunk/Source/Modules/allocate.cxx 2011-03-13 22:05:33 UTC (rev 12535) +++ trunk/Source/Modules/allocate.cxx 2011-03-14 07:22:08 UTC (rev 12536) @@ -386,10 +386,6 @@ } Node *c = firstChild(cls); - String *kind = Getattr(cls, "kind"); - int mode = PUBLIC; - if (kind && (Strcmp(kind, "class") == 0)) - mode = PRIVATE; while (c) { if (Getattr(c, "error") || GetFlag(c, "feature:ignore")) { @@ -457,13 +453,6 @@ } } - if (Strcmp(nodeType(c), "access") == 0) { - kind = Getattr(c, "kind"); - if (Strcmp(kind, "public") == 0) - mode = PUBLIC; - else - mode = PRIVATE; - } c = nextSibling(c); } /* Look for methods in base classes */ Modified: trunk/Source/Modules/chicken.cxx =================================================================== --- trunk/Source/Modules/chicken.cxx 2011-03-13 22:05:33 UTC (rev 12535) +++ trunk/Source/Modules/chicken.cxx 2011-03-14 07:22:08 UTC (rev 12536) @@ -684,9 +684,6 @@ String *overname = 0; String *scmname; - int num_required; - int num_arguments; - scmname = NewString(iname); Replaceall(scmname, "_", "-"); @@ -705,10 +702,6 @@ emit_attach_parmmaps(l, f); Setattr(n, "wrap:parms", l); - /* Get number of required and total arguments */ - num_arguments = emit_num_arguments(l); - num_required = emit_num_required(l); - // evaluation function names Append(wname, Swig_name_wrapper(iname)); if (overname) { @@ -845,9 +838,6 @@ String *rvalue; SwigType *nctype; - int num_required; - int num_arguments; - scmname = NewString(iname); Replaceall(scmname, "_", "-"); @@ -903,10 +893,6 @@ emit_attach_parmmaps(l, f); Setattr(n, "wrap:parms", l); - /* Get number of required and total arguments */ - num_arguments = emit_num_arguments(l); - num_required = emit_num_required(l); - // evaluation function names // Check for interrupts @@ -1382,12 +1368,10 @@ SortList(flist, compareTypeLists); String *clos_name; - int construct = 0; if (have_constructor && !has_constructor_args) { has_constructor_args = 1; constructor_dispatch = NewStringf("%s@SWIG@new@dispatch", short_class_name); clos_name = Copy(constructor_dispatch); - construct = 1; Printf(clos_methods, "(declare (hide %s))\n", clos_name); } else if (in_class) clos_name = NewString(member_name); Modified: trunk/Source/Modules/csharp.cxx =================================================================== --- trunk/Source/Modules/csharp.cxx 2011-03-13 22:05:33 UTC (rev 12535) +++ trunk/Source/Modules/csharp.cxx 2011-03-14 07:22:08 UTC (rev 12536) @@ -646,7 +646,6 @@ UpcallData *addUpcallMethod(String *imclass_method, String *class_method, String *decl, String *overloaded_name) { UpcallData *udata; - String *imclass_methodidx; String *class_methodidx; Hash *new_udata; String *key = NewStringf("%s|%s", imclass_method, decl); @@ -659,7 +658,6 @@ return Getattr(udata, "methodoff"); } - imclass_methodidx = NewStringf("%d", n_dmethods); class_methodidx = NewStringf("%d", n_dmethods - first_class_dmethod); n_dmethods++; @@ -668,10 +666,6 @@ Setattr(dmethods_table, key, new_udata); Setattr(new_udata, "method", Copy(class_method)); - // TODO: remove fdesc -// Setattr(new_udata, "fdesc", Copy(class_desc)); -// Setattr(new_udata, "imclass_method", Copy(imclass_method)); -// Setattr(new_udata, "imclass_methodidx", imclass_methodidx); Setattr(new_udata, "class_methodidx", class_methodidx); Setattr(new_udata, "decl", Copy(decl)); Setattr(new_udata, "overname", Copy(overloaded_name)); @@ -736,7 +730,6 @@ String *body = NewString(""); String *im_outattributes = 0; int num_arguments = 0; - int num_required = 0; bool is_void_return; String *overloaded_name = getOverloadedName(n); @@ -815,7 +808,6 @@ /* Get number of required and total arguments */ num_arguments = emit_num_arguments(l); - num_required = emit_num_required(l); int gencomma = 0; // Now walk the function parameter list and generate code to get arguments @@ -2707,7 +2699,6 @@ String *return_type = NewString(""); String *function_code = NewString(""); int num_arguments = 0; - int num_required = 0; String *overloaded_name = getOverloadedName(n); String *func_name = NULL; bool setter_flag = false; @@ -2767,7 +2758,6 @@ /* Get number of required and total arguments */ num_arguments = emit_num_arguments(l); - num_required = emit_num_required(l); bool global_or_member_variable = global_variable_flag || (wrapping_member_flag && !enum_constant_flag); int gencomma = 0; @@ -4020,7 +4010,6 @@ int classDirectorDestructor(Node *n) { Node *current_class = getCurrentClass(); - String *full_classname = Getattr(current_class, "name"); String *classname = Swig_class_name(current_class); Wrapper *w = NewWrapper(); @@ -4032,22 +4021,11 @@ Printf(w->def, "SwigDirector_%s::~SwigDirector_%s() {\n", classname, classname); } - /* Ensure that correct directordisconnect typemap's method name is called - * here: */ - - const String *disconn_tm = NULL; - Node *disconn_attr = NewHash(); - String *disconn_methodname = NULL; - - disconn_tm = typemapLookup(n, "directordisconnect", full_classname, WARN_NONE, disconn_attr); - disconn_methodname = Getattr(disconn_attr, "tmap:directordisconnect:methodname"); - Printv(w->code, "}\n", NIL); Wrapper_print(w, f_directors); DelWrapper(w); - Delete(disconn_attr); Delete(classname); return SWIG_OK; } Modified: trunk/Source/Modules/d.cxx =================================================================== --- trunk/Source/Modules/d.cxx 2011-03-13 22:05:33 UTC (rev 12535) +++ trunk/Source/Modules/d.cxx 2011-03-14 07:22:08 UTC (rev 12536) @@ -1506,7 +1506,6 @@ String *outarg = NewString(""); String *body = NewString(""); int num_arguments = 0; - int num_required = 0; bool is_void_return; String *overloaded_name = getOverloadedName(n); @@ -1581,7 +1580,6 @@ /* Get number of required and total arguments */ num_arguments = emit_num_arguments(l); - num_required = emit_num_required(l); int gencomma = 0; // Now walk the function parameter list and generate code to get arguments @@ -2917,7 +2915,6 @@ String *return_type = NewString(""); String *function_code = NewString(""); int num_arguments = 0; - int num_required = 0; String *overloaded_name = getOverloadedName(n); String *func_name = NULL; String *pre_code = NewString(""); @@ -2973,7 +2970,6 @@ /* Get number of required and total arguments */ num_arguments = emit_num_arguments(l); - num_required = emit_num_required(l); int gencomma = 0; @@ -3716,7 +3712,6 @@ String *decl, String *overloaded_name, String *return_type, String *param_list) { UpcallData *udata; - String *imclass_methodidx; String *class_methodidx; Hash *new_udata; String *key = NewStringf("%s|%s", imclass_method, decl); @@ -3729,7 +3724,6 @@ return Getattr(udata, "methodoff"); } - imclass_methodidx = NewStringf("%d", n_dmethods); class_methodidx = NewStringf("%d", n_dmethods - first_class_dmethod); n_dmethods++; Modified: trunk/Source/Modules/emit.cxx =================================================================== --- trunk/Source/Modules/emit.cxx 2011-03-13 22:05:33 UTC (rev 12535) +++ trunk/Source/Modules/emit.cxx 2011-03-14 07:22:08 UTC (rev 12536) @@ -402,7 +402,6 @@ String *tm; String *action; String *wrap; - SwigType *rt; ParmList *catchlist = Getattr(n, "catchlist"); /* Look for fragments */ @@ -440,9 +439,6 @@ action = Getattr(n, "wrap:action"); assert(action != 0); - /* Get the return type */ - rt = Getattr(n, "type"); - /* Emit contract code (if any) */ if (Swig_contract_mode_get()) { /* Preassertion */ Modified: trunk/Source/Modules/go.cxx =================================================================== --- trunk/Source/Modules/go.cxx 2011-03-13 22:05:33 UTC (rev 12535) +++ trunk/Source/Modules/go.cxx 2011-03-14 07:22:08 UTC (rev 12536) @@ -1397,7 +1397,6 @@ } Printv(current, Getattr(parms, "lname"), NULL); - String *last = NULL; int vc = 0; for (Iterator bi = First(base); bi.item; bi = Next(bi)) { Printf(actioncode, " %s *swig_b%d = (%s *)%s;\n", bi.item, vc, bi.item, current); @@ -1405,7 +1404,6 @@ current = NewString(""); Printf(current, "swig_b%d", vc); ++vc; - last = bi.item; } String *code = Copy(Getattr(n, "wrap:action")); Modified: trunk/Source/Modules/java.cxx =================================================================== --- trunk/Source/Modules/java.cxx 2011-03-13 22:05:33 UTC (rev 12535) +++ trunk/Source/Modules/java.cxx 2011-03-14 07:22:08 UTC (rev 12536) @@ -808,7 +808,6 @@ String *outarg = NewString(""); String *body = NewString(""); int num_arguments = 0; - int num_required = 0; int gencomma = 0; bool is_void_return; String *overloaded_name = getOverloadedName(n); @@ -885,9 +884,7 @@ Printf(imclass_class_code, " public final static native %s %s(", im_return_type, overloaded_name); - /* Get number of required and total arguments */ num_arguments = emit_num_arguments(l); - num_required = emit_num_required(l); // Now walk the function parameter list and generate code to get arguments for (i = 0, p = l; i < num_arguments; i++) { @@ -2619,7 +2616,6 @@ String *return_type = NewString(""); String *function_code = NewString(""); int num_arguments = 0; - int num_required = 0; String *overloaded_name = getOverloadedName(n); String *func_name = NULL; bool setter_flag = false; @@ -2667,7 +2663,6 @@ /* Get number of required and total arguments */ num_arguments = emit_num_arguments(l); - num_required = emit_num_required(l); bool global_or_member_variable = global_variable_flag || (wrapping_member_flag && !enum_constant_flag); int gencomma = 0; @@ -4227,11 +4222,10 @@ /* Ensure that correct directordisconnect typemap's method name is called * here: */ - const String *disconn_tm = NULL; Node *disconn_attr = NewHash(); String *disconn_methodname = NULL; - disconn_tm = typemapLookup(n, "directordisconnect", full_classname, WARN_NONE, disconn_attr); + typemapLookup(n, "directordisconnect", full_classname, WARN_NONE, disconn_attr); disconn_methodname = Getattr(disconn_attr, "tmap:directordisconnect:methodname"); Printv(w->code, " swig_disconnect_director_self(\"", disconn_methodname, "\");\n", "}\n", NIL); Modified: trunk/Source/Modules/main.cxx =================================================================== --- trunk/Source/Modules/main.cxx 2011-03-13 22:05:33 UTC (rev 12535) +++ trunk/Source/Modules/main.cxx 2011-03-14 07:22:08 UTC (rev 12536) @@ -1192,7 +1192,7 @@ } if (dump_typedef) { - SwigType_print_scope(0); + SwigType_print_scope(); } if (dump_symtabs) { Modified: trunk/Source/Modules/mzscheme.cxx =================================================================== --- trunk/Source/Modules/mzscheme.cxx 2011-03-13 22:05:33 UTC (rev 12535) +++ trunk/Source/Modules/mzscheme.cxx 2011-03-14 07:22:08 UTC (rev 12536) @@ -240,7 +240,6 @@ String *outarg = NewString(""); String *build = NewString(""); String *tm; - int argout_set = 0; int i = 0; int numargs; int numreq; @@ -381,7 +380,6 @@ Replaceall(tm, "$input", Getattr(p, "emit:input")); Printv(outarg, tm, "\n", NIL); p = Getattr(p, "tmap:argout:next"); - argout_set = 1; } else { p = nextSibling(p); } Modified: trunk/Source/Modules/ocaml.cxx =================================================================== --- trunk/Source/Modules/ocaml.cxx 2011-03-13 22:05:33 UTC (rev 12535) +++ trunk/Source/Modules/ocaml.cxx 2011-03-14 07:22:08 UTC (rev 12536) @@ -445,7 +445,6 @@ String *outarg = NewString(""); String *build = NewString(""); String *tm; - int argout_set = 0; int i = 0; int numargs; int numreq; @@ -608,7 +607,6 @@ Replaceall(tm, "$ntype", normalizeTemplatedClassName(Getattr(p, "type"))); Printv(outarg, tm, "\n", NIL); p = Getattr(p, "tmap:argout:next"); - argout_set = 1; } else { p = nextSibling(p); } @@ -881,9 +879,8 @@ * ------------------------------------------------------------ */ virtual int staticmemberfunctionHandler(Node *n) { - int rv; static_member_function = 1; - rv = Language::staticmemberfunctionHandler(n); + Language::staticmemberfunctionHandler(n); static_member_function = 0; return SWIG_OK; } Modified: trunk/Source/Modules/octave.cxx =================================================================== --- trunk/Source/Modules/octave.cxx 2011-03-13 22:05:33 UTC (rev 12535) +++ trunk/Source/Modules/octave.cxx 2011-03-14 07:22:08 UTC (rev 12536) @@ -359,13 +359,11 @@ String *name = 0; String *type = 0; String *value = 0; - String *ptype = 0; String *pdoc = Getattr(p, "tmap:doc"); if (pdoc) { name = Getattr(p, "tmap:doc:name"); type = Getattr(p, "tmap:doc:type"); value = Getattr(p, "tmap:doc:value"); - ptype = Getattr(p, "tmap:doc:pytype"); } name = name ? name : Getattr(p, "name"); @@ -1243,7 +1241,6 @@ // build argument list and type conversion string idx = 0; p = l; - int use_parse = 0; while (p) { if (checkAttribute(p, "tmap:in:numinputs", "0")) { p = Getattr(p, "tmap:in:next"); @@ -1266,7 +1263,6 @@ Printf(wrap_args, "args.append(tmpv);\n"); Putc('O', parse_args); } else { - use_parse = 1; Append(parse_args, parse); Replaceall(tm, "$input", pname); Replaceall(tm, "$owner", "0"); Modified: trunk/Source/Modules/php.cxx =================================================================== --- trunk/Source/Modules/php.cxx 2011-03-13 22:05:33 UTC (rev 12535) +++ trunk/Source/Modules/php.cxx 2011-03-14 07:22:08 UTC (rev 12536) @@ -250,7 +250,6 @@ virtual int top(Node *n) { String *filen; - String *s_type; /* Check if directors are enabled for this module. */ Node *mod = Getattr(n, "module"); @@ -283,7 +282,6 @@ r_shutdown = NewString("/* rshutdown section */\n"); s_header = NewString("/* header section */\n"); s_wrappers = NewString("/* wrapper section */\n"); - s_type = NewStringEmpty(); /* subsections of the init section */ s_vinit = NewString("/* vinit subsection */\n"); s_vdecl = NewString("/* vdecl subsection */\n"); @@ -2522,7 +2520,6 @@ /* build argument list and type conversion string */ idx = 0; p = l; - int use_parse = 0; while (p) { if (checkAttribute(p, "tmap:in:numinputs", "0")) { p = Getattr(p, "tmap:in:next"); @@ -2549,7 +2546,6 @@ Printv(wrap_args, tm, "\n", NIL); Putc('O', parse_args); } else { - use_parse = 1; Append(parse_args, parse); Replaceall(tm, "$input", pname); Replaceall(tm, "$owner", "0"); Modified: trunk/Source/Modules/python.cxx =================================================================== --- trunk/Source/Modules/python.cxx 2011-03-13 22:05:33 UTC (rev 12535) +++ trunk/Source/Modules/python.cxx 2011-03-14 07:22:08 UTC (rev 12536) @@ -1215,13 +1215,11 @@ String *name = 0; String *type = 0; String *value = 0; - String *ptype = 0; String *pdoc = Getattr(p, "tmap:doc"); if (pdoc) { name = Getattr(p, "tmap:doc:name"); type = Getattr(p, "tmap:doc:type"); value = Getattr(p, "tmap:doc:value"); - ptype = Getattr(p, "tmap:doc:pytype"); } name = name ? name : Getattr(p, "name"); Modified: trunk/Source/Modules/r.cxx =================================================================== --- trunk/Source/Modules/r.cxx 2011-03-13 22:05:33 UTC (rev 12535) +++ trunk/Source/Modules/r.cxx 2011-03-14 07:22:08 UTC (rev 12536) @@ -15,8 +15,6 @@ #include "swigmod.h" -#define UNUSED(a) (void)a - static const double DEFAULT_NUMBER = .0000123456712312312323; static const int MAX_OVERLOAD_ARGS = 5; @@ -268,12 +266,9 @@ Delete(tmp); Delete(tmp_base); Delete(tmp_ref); } -static double getNumber(String *value, String *type) { - UNUSED(type); - +static double getNumber(String *value) { double d = DEFAULT_NUMBER; if(Char(value)) { - // Printf(stderr, "getNumber %s %s\n", Char(value), type); if(sscanf(Char(value), "%lf", &d) != 1) return(DEFAULT_NUMBER); } @@ -1016,7 +1011,6 @@ int R::OutputMemberReferenceMethod(String *className, int isSet, List *el, File *out) { int numMems = Len(el), j; - int has_getitem = 0, has_setitem = 0, has_str = 0; int varaccessor = 0; if (numMems == 0) return SWIG_OK; @@ -1036,9 +1030,6 @@ if (Getattr(itemList, item)) continue; Setattr(itemList, item, "1"); - if (!Strcmp(item, "__getitem__")) has_getitem = 1; - if (!Strcmp(item, "__setitem__")) has_setitem = 1; - if (!Strcmp(item, "__str__")) has_str = 1; String *dup = Getitem(el, j + 1); char *ptr = Char(dup); @@ -1212,10 +1203,9 @@ // const char *tag = Char(nodeType(c)); // if (Strcmp(tag,"cdecl") == 0) { name = Getattr(c, "name"); - String *type = Getattr(c, "type"); String *val = Getattr(c, "enumvalue"); if(val && Char(val)) { - int inval = (int) getNumber(val, type); + int inval = (int) getNumber(val); if(inval == DEFAULT_NUMBER) value++; else @@ -1738,8 +1728,7 @@ } int i; - int nargs, num_required, varargs; - UNUSED(varargs); + int nargs; String *wname = Swig_name_wrapper(iname); Replace(wname, "_wrap", "R_swig", DOH_REPLACE_FIRST); @@ -1788,8 +1777,6 @@ Setattr(n,"wrap:parms",l); nargs = emit_num_arguments(l); - num_required = emit_num_required(l); - varargs = emit_isvarargs(l); Wrapper_add_local(f, "r_nprotect", "unsigned int r_nprotect = 0"); Wrapper_add_localv(f, "r_ans", "SEXP", "r_ans = R_NilValue", NIL); @@ -2134,11 +2121,6 @@ Would like to be able to do this so that we can potentialy insert */ if(processing_member_access_function || processing_class_member_function) { - String *tmp; - if(member_name) - tmp = member_name; - else - tmp = Getattr(n, "memberfunctionHandler:name"); addAccessor(member_name, sfun, iname); } Modified: trunk/Source/Modules/ruby.cxx =================================================================== --- trunk/Source/Modules/ruby.cxx 2011-03-13 22:05:33 UTC (rev 12535) +++ trunk/Source/Modules/ruby.cxx 2011-03-14 07:22:08 UTC (rev 12536) @@ -322,13 +322,11 @@ String *name = 0; String *type = 0; String *value = 0; - String *ptype = 0; String *pdoc = Getattr(p, "tmap:doc"); if (pdoc) { name = Getattr(p, "tmap:doc:name"); type = Getattr(p, "tmap:doc:type"); value = Getattr(p, "tmap:doc:value"); - ptype = Getattr(p, "tmap:doc:pytype"); } name = name ? name : Getattr(p, "name"); @@ -1608,9 +1606,7 @@ virtual int functionWrapper(Node *n) { String *nodeType; - bool constructor; bool destructor; - String *storage; String *symname = Copy(Getattr(n, "sym:name")); SwigType *t = Getattr(n, "type"); @@ -1625,9 +1621,7 @@ return SWIG_NOWRAP; nodeType = Getattr(n, "nodeType"); - constructor = (!Cmp(nodeType, "constructor")); destructor = (!Cmp(nodeType, "destructor")); - storage = Getattr(n, "storage"); /* If the C++ class constructor is overloaded, we only want to * write out the "new" singleton method once since it is always Modified: trunk/Source/Modules/typepass.cxx =================================================================== --- trunk/Source/Modules/typepass.cxx 2011-03-13 22:05:33 UTC (rev 12535) +++ trunk/Source/Modules/typepass.cxx 2011-03-14 07:22:08 UTC (rev 12536) @@ -1062,11 +1062,11 @@ * which is hacked. */ if (Getattr(n, "sym:overloaded")) { + int cnt = 0; #ifdef DEBUG_OVERLOADED -show_overloaded(n); + Node *debugnode = n; + show_overloaded(n); #endif - int cnt = 0; - Node *debugnode = n; if (!firstChild(n)) { // Remove from overloaded list ('using' node does not actually end up adding in any methods) Node *ps = Getattr(n, "sym:previousSibling"); @@ -1113,14 +1113,16 @@ Setattr(ns, "sym:previousSibling", pp); Setattr(pp, "sym:nextSibling", ns); } +#ifdef DEBUG_OVERLOADED debugnode = firstoverloaded; +#endif } Delattr(n, "sym:previousSibling"); Delattr(n, "sym:nextSibling"); Delattr(n, "sym:overloaded"); Delattr(n, "sym:overname"); #ifdef DEBUG_OVERLOADED -show_overloaded(debugnode); + show_overloaded(debugnode); #endif clean_overloaded(n); // Needed? } Modified: trunk/Source/Modules/uffi.cxx =================================================================== --- trunk/Source/Modules/uffi.cxx 2011-03-13 22:05:33 UTC (rev 12535) +++ trunk/Source/Modules/uffi.cxx 2011-03-14 07:22:08 UTC (rev 12536) @@ -278,7 +278,8 @@ String *funcname = Getattr(n, "sym:name"); ParmList *pl = Getattr(n, "parms"); Parm *p; - int argnum = 0, first = 1, varargs = 0; + int argnum = 0, first = 1; +// int varargs = 0; //Language::functionWrapper(n); @@ -291,7 +292,7 @@ Printf(f_cl, ":void"); } else if (any_varargs(pl)) { Printf(f_cl, "#| varargs |#"); - varargs = 1; +// varargs = 1; } else { for (p = pl; p; p = nextSibling(p), argnum++) { String *argname = Getattr(p, "name"); Modified: trunk/Source/Swig/cwrap.c =================================================================== --- trunk/Source/Swig/cwrap.c 2011-03-13 22:05:33 UTC (rev 12535) +++ trunk/Source/Swig/cwrap.c 2011-03-14 07:22:08 UTC (rev 12536) @@ -1041,10 +1041,8 @@ Parm *p; ParmList *directorparms; SwigType *type; - Node *classNode; int use_director; - classNode = Swig_methodclass(n); use_director = Swig_directorclass(n); parms = CopyParmList(nonvoid_parms(Getattr(n, "parms"))); Modified: trunk/Source/Swig/scanner.c =================================================================== --- trunk/Source/Swig/scanner.c 2011-03-13 22:05:33 UTC (rev 12535) +++ trunk/Source/Swig/scanner.c 2011-03-14 07:22:08 UTC (rev 12536) @@ -1156,11 +1156,9 @@ int Scanner_skip_balanced(Scanner * s, int startchar, int endchar) { char c; int num_levels = 1; - int l; int state = 0; char temp[2] = { 0, 0 }; String *locator = 0; - l = s->line; temp[0] = (char) startchar; Clear(s->text); Setfile(s->text, Getfile(s->str)); Modified: trunk/Source/Swig/swig.h =================================================================== --- trunk/Source/Swig/swig.h 2011-03-13 22:05:33 UTC (rev 12535) +++ trunk/Source/Swig/swig.h 2011-03-14 07:22:08 UTC (rev 12536) @@ -194,7 +194,7 @@ extern void SwigType_inherit_scope(Typetab *scope); extern Typetab *SwigType_pop_scope(void); extern Typetab *SwigType_set_scope(Typetab *h); - extern void SwigType_print_scope(Typetab *t); + extern void SwigType_print_scope(void); extern SwigType *SwigType_typedef_resolve(const SwigType *t); extern SwigType *SwigType_typedef_resolve_all(const SwigType *t); extern SwigType *SwigType_typedef_qualified(const SwigType *t); Modified: trunk/Source/Swig/symbol.c =================================================================== --- trunk/Source/Swig/symbol.c 2011-03-13 22:05:33 UTC (rev 12535) +++ trunk/Source/Swig/symbol.c 2011-03-14 07:22:08 UTC (rev 12536) @@ -1206,19 +1206,17 @@ * ----------------------------------------------------------------------------- */ Node *Swig_symbol_clookup_local(const_String_or_char_ptr name, Symtab *n) { - Hash *h, *hsym; + Hash *hsym; Node *s = 0; if (!n) { hsym = current_symtab; - h = ccurrent; } else { if (!Checkattr(n, "nodeType", "symboltable")) { n = Getattr(n, "sym:symtab"); } assert(n); hsym = n; - h = Getattr(n, "csymtab"); } if (Swig_scopename_check(name)) { @@ -1256,19 +1254,17 @@ * ----------------------------------------------------------------------------- */ Node *Swig_symbol_clookup_local_check(const_String_or_char_ptr name, Symtab *n, int (*checkfunc) (Node *)) { - Hash *h, *hsym; + Hash *hsym; Node *s = 0; if (!n) { hsym = current_symtab; - h = ccurrent; } else { if (!Checkattr(n, "nodeType", "symboltable")) { n = Getattr(n, "sym:symtab"); } assert(n); hsym = n; - h = Getattr(n, "csymtab"); } if (Swig_scopename_check(name)) { Modified: trunk/Source/Swig/typesys.c =================================================================== --- trunk/Source/Swig/typesys.c 2011-03-13 22:05:33 UTC (rev 12535) +++ trunk/Source/Swig/typesys.c 2011-03-14 07:22:08 UTC (rev 12536) @@ -389,12 +389,11 @@ * Debugging function for printing out current scope * ----------------------------------------------------------------------------- */ -void SwigType_print_scope(Typetab *t) { +void SwigType_print_scope(void) { Hash *ttab; Iterator i, j; for (i = First(scopes); i.key; i = Next(i)) { - t = i.item; ttab = Getattr(i.item, "typetab"); Printf(stdout, "Type scope '%s' (%x)\n", i.key, i.item); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wsf...@us...> - 2011-03-26 23:25:20
|
Revision: 12558 http://swig.svn.sourceforge.net/swig/?rev=12558&view=rev Author: wsfulton Date: 2011-03-26 23:25:14 +0000 (Sat, 26 Mar 2011) Log Message: ----------- Fix for a few affected target languages since last commit changed the way enum values that are type char are handled. Modified Paths: -------------- trunk/Source/CParse/parser.y trunk/Source/Modules/chicken.cxx trunk/Source/Modules/guile.cxx trunk/Source/Modules/mzscheme.cxx trunk/Source/Modules/ocaml.cxx trunk/Source/Modules/pike.cxx Modified: trunk/Source/CParse/parser.y =================================================================== --- trunk/Source/CParse/parser.y 2011-03-26 15:28:31 UTC (rev 12557) +++ trunk/Source/CParse/parser.y 2011-03-26 23:25:14 UTC (rev 12558) @@ -5591,21 +5591,14 @@ Delete(type); } | ID EQUAL etype { + SwigType *type = NewSwigType($3.type == T_BOOL ? T_BOOL : ($3.type == T_CHAR ? T_CHAR : T_INT)); $$ = new_node("enumitem"); Setattr($$,"name",$1); - Setattr($$,"enumvalue", $3.val); - if ($3.type == T_CHAR) { - SwigType *type = NewSwigType(T_CHAR); - Setattr($$,"value",NewStringf("\'%(escape)s\'", $3.val)); - Setattr($$,"type",type); - Delete(type); - } else { - SwigType *type = NewSwigType($3.type == T_BOOL ? T_BOOL : T_INT); - Setattr($$,"value",$1); - Setattr($$,"type",type); - Delete(type); - } + Setattr($$,"type",type); SetFlag($$,"feature:immutable"); + Setattr($$,"enumvalue", $3.val); + Setattr($$,"value",$1); + Delete(type); } | empty { $$ = 0; } ; Modified: trunk/Source/Modules/chicken.cxx =================================================================== --- trunk/Source/Modules/chicken.cxx 2011-03-26 15:28:31 UTC (rev 12557) +++ trunk/Source/Modules/chicken.cxx 2011-03-26 23:25:14 UTC (rev 12558) @@ -863,9 +863,10 @@ Delete(SwigType_pop(nctype)); } + bool is_enum_item = (Cmp(nodeType(n), "enumitem") == 0); if (SwigType_type(nctype) == T_STRING) { rvalue = NewStringf("\"%s\"", value); - } else if (SwigType_type(nctype) == T_CHAR) { + } else if (SwigType_type(nctype) == T_CHAR && !is_enum_item) { rvalue = NewStringf("\'%s\'", value); } else { rvalue = NewString(value); Modified: trunk/Source/Modules/guile.cxx =================================================================== --- trunk/Source/Modules/guile.cxx 2011-03-26 15:28:31 UTC (rev 12557) +++ trunk/Source/Modules/guile.cxx 2011-03-26 23:25:14 UTC (rev 12558) @@ -1393,9 +1393,10 @@ } // See if there's a typemap + bool is_enum_item = (Cmp(nodeType(n), "enumitem") == 0); if (SwigType_type(nctype) == T_STRING) { rvalue = NewStringf("\"%s\"", value); - } else if (SwigType_type(nctype) == T_CHAR) { + } else if (SwigType_type(nctype) == T_CHAR && !is_enum_item) { rvalue = NewStringf("\'%s\'", value); } else { rvalue = NewString(value); Modified: trunk/Source/Modules/mzscheme.cxx =================================================================== --- trunk/Source/Modules/mzscheme.cxx 2011-03-26 15:28:31 UTC (rev 12557) +++ trunk/Source/Modules/mzscheme.cxx 2011-03-26 23:25:14 UTC (rev 12558) @@ -637,9 +637,10 @@ // Create variable and assign it a value Printf(f_header, "static %s = ", SwigType_lstr(type, var_name)); + bool is_enum_item = (Cmp(nodeType(n), "enumitem") == 0); if ((SwigType_type(type) == T_STRING)) { Printf(f_header, "\"%s\";\n", value); - } else if (SwigType_type(type) == T_CHAR) { + } else if (SwigType_type(type) == T_CHAR && !is_enum_item) { Printf(f_header, "\'%s\';\n", value); } else { Printf(f_header, "%s;\n", value); Modified: trunk/Source/Modules/ocaml.cxx =================================================================== --- trunk/Source/Modules/ocaml.cxx 2011-03-26 15:28:31 UTC (rev 12557) +++ trunk/Source/Modules/ocaml.cxx 2011-03-26 23:25:14 UTC (rev 12558) @@ -927,9 +927,10 @@ // Create variable and assign it a value Printf(f_header, "static %s = ", SwigType_lstr(type, name)); + bool is_enum_item = (Cmp(nodeType(n), "enumitem") == 0); if ((SwigType_type(type) == T_STRING)) { Printf(f_header, "\"%s\";\n", value); - } else if (SwigType_type(type) == T_CHAR) { + } else if (SwigType_type(type) == T_CHAR && !is_enum_item) { Printf(f_header, "\'%s\';\n", value); } else { Printf(f_header, "%s;\n", value); Modified: trunk/Source/Modules/pike.cxx =================================================================== --- trunk/Source/Modules/pike.cxx 2011-03-26 15:28:31 UTC (rev 12557) +++ trunk/Source/Modules/pike.cxx 2011-03-26 23:25:14 UTC (rev 12558) @@ -578,12 +578,16 @@ String *symname = Getattr(n, "sym:name"); SwigType *type = Getattr(n, "type"); String *value = Getattr(n, "value"); + bool is_enum_item = (Cmp(nodeType(n), "enumitem") == 0); - /* Special hook for member pointer */ if (SwigType_type(type) == T_MPOINTER) { + /* Special hook for member pointer */ String *wname = Swig_name_wrapper(symname); Printf(f_header, "static %s = %s;\n", SwigType_str(type, wname), value); value = wname; + } else if (SwigType_type(type) == T_CHAR && is_enum_item) { + type = NewSwigType(T_INT); + Setattr(n, "type", type); } /* Perform constant typemap substitution */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wsf...@us...> - 2012-04-29 21:51:25
|
Revision: 13024 http://swig.svn.sourceforge.net/swig/?rev=13024&view=rev Author: wsfulton Date: 2012-04-29 21:51:18 +0000 (Sun, 29 Apr 2012) Log Message: ----------- Warning fixes using clang Modified Paths: -------------- trunk/Source/DOH/base.c trunk/Source/Modules/d.cxx trunk/Source/Preprocessor/expr.c Modified: trunk/Source/DOH/base.c =================================================================== --- trunk/Source/DOH/base.c 2012-04-28 15:33:58 UTC (rev 13023) +++ trunk/Source/DOH/base.c 2012-04-29 21:51:18 UTC (rev 13024) @@ -259,7 +259,7 @@ if (!b1info) { return obj1 == obj2; - } else if ((b1info == b2info)) { + } else if (b1info == b2info) { return b1info->doh_equal ? (b1info->doh_equal) (b1, b2) : (b1info->doh_cmp ? (b1info->doh_cmp) (b1, b2) == 0 : (b1 == b2)); } else { return 0; Modified: trunk/Source/Modules/d.cxx =================================================================== --- trunk/Source/Modules/d.cxx 2012-04-28 15:33:58 UTC (rev 13023) +++ trunk/Source/Modules/d.cxx 2012-04-29 21:51:18 UTC (rev 13024) @@ -4602,7 +4602,7 @@ co = c + Len(nspace); while (*c && (c != co)) { - if ((*c == '.')) { + if (*c == '.') { break; } c++; Modified: trunk/Source/Preprocessor/expr.c =================================================================== --- trunk/Source/Preprocessor/expr.c 2012-04-28 15:33:58 UTC (rev 13023) +++ trunk/Source/Preprocessor/expr.c 2012-04-29 21:51:18 UTC (rev 13024) @@ -298,16 +298,16 @@ stack[sp++].op = EXPR_OP; stack[sp].op = EXPR_TOP; stack[sp].svalue = 0; - } else if ((token == SWIG_TOKEN_LPAREN)) { + } else if (token == SWIG_TOKEN_LPAREN) { stack[sp++].op = EXPR_GROUP; stack[sp].op = EXPR_TOP; stack[sp].value = 0; stack[sp].svalue = 0; } else if (token == SWIG_TOKEN_ENDLINE) { - } else if ((token == SWIG_TOKEN_STRING)) { + } else if (token == SWIG_TOKEN_STRING) { stack[sp].svalue = NewString(Scanner_text(scan)); stack[sp].op = EXPR_VALUE; - } else if ((token == SWIG_TOKEN_ID)) { + } else if (token == SWIG_TOKEN_ID) { stack[sp].value = 0; stack[sp].svalue = 0; stack[sp].op = EXPR_VALUE; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wsf...@us...> - 2012-08-04 20:25:48
|
Revision: 13507 http://swig.svn.sourceforge.net/swig/?rev=13507&view=rev Author: wsfulton Date: 2012-08-04 20:25:43 +0000 (Sat, 04 Aug 2012) Log Message: ----------- Resolve template parameters Modified Paths: -------------- trunk/Source/Modules/typepass.cxx trunk/Source/Swig/typesys.c Modified: trunk/Source/Modules/typepass.cxx =================================================================== --- trunk/Source/Modules/typepass.cxx 2012-08-04 20:25:16 UTC (rev 13506) +++ trunk/Source/Modules/typepass.cxx 2012-08-04 20:25:43 UTC (rev 13507) @@ -1159,6 +1159,11 @@ SwigType_typedef_using(uname); } else if (Strcmp(ntype, "enum") == 0) { SwigType_typedef_using(Getattr(n, "uname")); + } else if (Strcmp(ntype, "template") == 0) { + /* + Printf(stdout, "usingDeclaration template %s --- %s\n", Getattr(n, "name"), Getattr(n, "uname")); + SwigType_typedef_using(Getattr(n, "uname")); + */ } } } Modified: trunk/Source/Swig/typesys.c =================================================================== --- trunk/Source/Swig/typesys.c 2012-08-04 20:25:16 UTC (rev 13506) +++ trunk/Source/Swig/typesys.c 2012-08-04 20:25:43 UTC (rev 13507) @@ -954,7 +954,12 @@ Iterator pi; Parm *p; List *parms; + /* ty = Swig_symbol_template_deftype(e, current_symtab); + */ + String *dt = Swig_symbol_template_deftype(e, current_symtab); + ty = Swig_symbol_type_qualify(dt, 0); + Printf(stdout, "extra code: %s => %s\n", dt, ty); e = ty; parms = SwigType_parmlist(e); tprefix = SwigType_templateprefix(e); @@ -1021,6 +1026,9 @@ Delete(tprefix); Delete(qprefix); Delete(parms); + /* + Delete(dt); + */ } Append(result, e); Delete(ty); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wsf...@us...> - 2012-11-14 22:16:14
|
Revision: 13885 http://swig.svn.sourceforge.net/swig/?rev=13885&view=rev Author: wsfulton Date: 2012-11-14 22:16:07 +0000 (Wed, 14 Nov 2012) Log Message: ----------- Remove DohClose (Close) and replace with calls to DohDelete (Delete) to fix some minor memory leaks in most uses of NewFile. Modified Paths: -------------- trunk/Source/DOH/base.c trunk/Source/DOH/doh.h trunk/Source/Modules/allegrocl.cxx trunk/Source/Modules/cffi.cxx trunk/Source/Modules/chicken.cxx trunk/Source/Modules/clisp.cxx trunk/Source/Modules/csharp.cxx trunk/Source/Modules/d.cxx trunk/Source/Modules/go.cxx trunk/Source/Modules/guile.cxx trunk/Source/Modules/java.cxx trunk/Source/Modules/lua.cxx trunk/Source/Modules/main.cxx trunk/Source/Modules/modula3.cxx trunk/Source/Modules/mzscheme.cxx trunk/Source/Modules/ocaml.cxx trunk/Source/Modules/octave.cxx trunk/Source/Modules/perl5.cxx trunk/Source/Modules/php.cxx trunk/Source/Modules/pike.cxx trunk/Source/Modules/python.cxx trunk/Source/Modules/r.cxx trunk/Source/Modules/ruby.cxx trunk/Source/Modules/tcl8.cxx trunk/Source/Modules/uffi.cxx Modified: trunk/Source/DOH/base.c =================================================================== --- trunk/Source/DOH/base.c 2012-11-13 22:21:51 UTC (rev 13884) +++ trunk/Source/DOH/base.c 2012-11-14 22:16:07 UTC (rev 13885) @@ -761,6 +761,7 @@ * DohClose() * ----------------------------------------------------------------------------- */ +/* int DohClose(DOH *obj) { DohBase *b = (DohBase *) obj; DohObjInfo *objinfo; @@ -773,6 +774,7 @@ } return fclose((FILE *) obj); } +*/ /* ----------------------------------------------------------------------------- * DohIsString() Modified: trunk/Source/DOH/doh.h =================================================================== --- trunk/Source/DOH/doh.h 2012-11-13 22:21:51 UTC (rev 13884) +++ trunk/Source/DOH/doh.h 2012-11-14 22:16:07 UTC (rev 13885) @@ -307,7 +307,10 @@ extern DOHFile *DohNewFileFromFile(FILE *f); extern DOHFile *DohNewFileFromFd(int fd); extern void DohFileErrorDisplay(DOHString * filename); +/* + Deprecated, just use DohDelete extern int DohClose(DOH *file); +*/ extern int DohCopyto(DOHFile * input, DOHFile * output); Modified: trunk/Source/Modules/allegrocl.cxx =================================================================== --- trunk/Source/Modules/allegrocl.cxx 2012-11-13 22:21:51 UTC (rev 13884) +++ trunk/Source/Modules/allegrocl.cxx 2012-11-14 22:16:07 UTC (rev 13885) @@ -1654,7 +1654,6 @@ if (Generate_Wrapper) { f_begin = NewFile(cxx_filename, "w", SWIG_output_files()); if (!f_begin) { - Close(f_cl); Delete(f_cl); Printf(stderr, "Unable to open %s for writing\n", cxx_filename); SWIG_exit(EXIT_FAILURE); @@ -1711,15 +1710,13 @@ Printf(f_cl, "%s\n", f_clhead); Printf(f_cl, "%s\n", f_clwrap); - Close(f_cl); - Delete(f_cl); // Delete the handle, not the file + Delete(f_cl); Delete(f_clhead); Delete(f_clwrap); Dump(f_runtime, f_begin); Printf(f_begin, "%s\n", f_cxx_wrapper); - Close(f_begin); Delete(f_runtime); Delete(f_begin); Delete(f_cxx_wrapper); Modified: trunk/Source/Modules/cffi.cxx =================================================================== --- trunk/Source/Modules/cffi.cxx 2012-11-13 22:21:51 UTC (rev 13884) +++ trunk/Source/Modules/cffi.cxx 2012-11-14 22:16:07 UTC (rev 13885) @@ -137,7 +137,6 @@ if (CPlusPlus || CWrap) { f_begin = NewFile(cxx_filename, "w", SWIG_output_files()); if (!f_begin) { - Close(f_lisp); Delete(f_lisp); Printf(stderr, "Unable to open %s for writing\n", cxx_filename); SWIG_exit(EXIT_FAILURE); @@ -147,7 +146,6 @@ Printf(clos_filename, "%s%s-clos.lisp", SWIG_output_directory(), module); f_clos = NewFile(clos_filename, "w", SWIG_output_files()); if (!f_clos) { - Close(f_lisp); Delete(f_lisp); Printf(stderr, "Unable to open %s for writing\n", cxx_filename); SWIG_exit(EXIT_FAILURE); @@ -184,13 +182,11 @@ Printf(f_lisp, "%s\n", f_cl); Printf(f_lisp, "%s\n", f_clwrap); - Close(f_lisp); - Delete(f_lisp); // Deletes the handle, not the file + Delete(f_lisp); Delete(f_cl); Delete(f_clhead); Delete(f_clwrap); Dump(f_runtime, f_begin); - Close(f_begin); Delete(f_runtime); Delete(f_begin); Delete(f_cxx_wrapper); Modified: trunk/Source/Modules/chicken.cxx =================================================================== --- trunk/Source/Modules/chicken.cxx 2012-11-13 22:21:51 UTC (rev 13884) +++ trunk/Source/Modules/chicken.cxx 2012-11-14 22:16:07 UTC (rev 13885) @@ -290,8 +290,6 @@ Printf(f_scm, "%s\n", chickentext); - - Close(f_scm); Delete(f_scm); char buftmp[20]; @@ -324,7 +322,6 @@ Delete(f_wrappers); Delete(f_sym_size); Delete(f_init); - Close(f_begin); Delete(f_runtime); Delete(f_begin); return SWIG_OK; Modified: trunk/Source/Modules/clisp.cxx =================================================================== --- trunk/Source/Modules/clisp.cxx 2012-11-13 22:21:51 UTC (rev 13884) +++ trunk/Source/Modules/clisp.cxx 2012-11-14 22:16:07 UTC (rev 13885) @@ -141,8 +141,7 @@ Seek(f_cl, 0, SEEK_SET); Write(f_cl, Char(header), Len(header)); - Close(f_cl); - Delete(f_cl); // Deletes the handle, not the file + Delete(f_cl); return SWIG_OK; } Modified: trunk/Source/Modules/csharp.cxx =================================================================== --- trunk/Source/Modules/csharp.cxx 2012-11-13 22:21:51 UTC (rev 13884) +++ trunk/Source/Modules/csharp.cxx 2012-11-14 22:16:07 UTC (rev 13885) @@ -467,7 +467,7 @@ Printf(f_im, "}\n"); addCloseNamespace(0, f_im); - Close(f_im); + Delete(f_im); } // Generate the C# module class @@ -519,7 +519,7 @@ Printf(f_module, "}\n"); addCloseNamespace(0, f_module); - Close(f_module); + Delete(f_module); } if (upcasts_code) @@ -610,7 +610,6 @@ Printf(f_runtime_h, "\n"); Printf(f_runtime_h, "#endif\n"); - Close(f_runtime_h); Delete(f_runtime_h); f_runtime_h = NULL; Delete(f_directors); @@ -624,7 +623,6 @@ Delete(f_header); Delete(f_wrappers); Delete(f_init); - Close(f_begin); Delete(f_runtime); Delete(f_begin); return SWIG_OK; @@ -1225,7 +1223,7 @@ "\n", enum_code, "\n", NIL); addCloseNamespace(nspace, f_enum); - Close(f_enum); + Delete(f_enum); Delete(output_directory); } } else { @@ -1955,7 +1953,7 @@ Printf(f_proxy, "}\n"); addCloseNamespace(nspace, f_proxy); - Close(f_proxy); + Delete(f_proxy); f_proxy = NULL; /* Output the downcast method, if necessary. Note: There's no other really @@ -3227,7 +3225,7 @@ addCloseNamespace(0, f_swigtype); - Close(f_swigtype); + Delete(f_swigtype); Delete(swigtype); Delete(n); } Modified: trunk/Source/Modules/d.cxx =================================================================== --- trunk/Source/Modules/d.cxx 2012-11-13 22:21:51 UTC (rev 13884) +++ trunk/Source/Modules/d.cxx 2012-11-14 22:16:07 UTC (rev 13885) @@ -538,7 +538,7 @@ replaceModuleVariables(im_dmodule_code); Printv(im_d_file, im_dmodule_code, NIL); - Close(im_d_file); + Delete(im_d_file); } // Generate the main D proxy module. @@ -571,7 +571,7 @@ replaceModuleVariables(proxy_dmodule_code); Printv(proxy_d_file, proxy_dmodule_code, NIL); - Close(proxy_d_file); + Delete(proxy_d_file); } // Generate the additional proxy modules for nspace support. @@ -598,7 +598,7 @@ replaceModuleVariables(code); Printv(file, code, NIL); - Close(file); + Delete(file); Delete(module_name); } @@ -693,7 +693,6 @@ Printf(f_runtime_h, "\n"); Printf(f_runtime_h, "#endif\n"); - Close(f_runtime_h); Delete(f_runtime_h); f_runtime_h = NULL; Delete(f_directors); @@ -707,7 +706,6 @@ Delete(f_header); Delete(f_wrappers); Delete(f_init); - Close(f_begin); Delete(f_runtime); Delete(f_begin); @@ -868,7 +866,6 @@ Printv(class_file, proxy_enum_code, NIL); - Close(class_file); Delete(class_file); } else { String *nspace = Getattr(n, "sym:nspace"); @@ -1363,7 +1360,6 @@ replaceModuleVariables(proxy_class_code); Printv(class_file, proxy_class_code, NIL); - Close(class_file); Delete(class_file); } else { Printv(proxyImportsBuffer(getNSpace()), proxy_class_imports, NIL); @@ -3469,7 +3465,6 @@ Printv(class_file, code_target, NIL); Delete(code_target); - Close(class_file); Delete(class_file); } Modified: trunk/Source/Modules/go.cxx =================================================================== --- trunk/Source/Modules/go.cxx 2012-11-13 22:21:51 UTC (rev 13884) +++ trunk/Source/Modules/go.cxx 2012-11-14 22:16:07 UTC (rev 13885) @@ -437,12 +437,10 @@ if (directorsEnabled()) { Printf(f_c_directors_h, "#endif\n"); - Close(f_c_directors_h); Delete(f_c_directors_h); f_c_directors_h = NULL; Dump(f_c_directors, f_c_runtime); - Close(f_c_directors); Delete(f_c_directors); f_c_directors = NULL; } @@ -475,12 +473,9 @@ Delete(f_gc_wrappers); } - Close(f_c_begin); Delete(f_c_begin); - Close(f_go_begin); Delete(f_go_begin); if (!gccgo_flag) { - Close(f_gc_begin); Delete(f_gc_begin); } Modified: trunk/Source/Modules/guile.cxx =================================================================== --- trunk/Source/Modules/guile.cxx 2012-11-13 22:21:51 UTC (rev 13884) +++ trunk/Source/Modules/guile.cxx 2012-11-14 22:16:07 UTC (rev 13885) @@ -409,7 +409,6 @@ Delete(f_header); Delete(f_wrappers); Delete(f_init); - Close(f_begin); Delete(f_runtime); Delete(f_begin); return SWIG_OK; Modified: trunk/Source/Modules/java.cxx =================================================================== --- trunk/Source/Modules/java.cxx 2012-11-13 22:21:51 UTC (rev 13884) +++ trunk/Source/Modules/java.cxx 2012-11-14 22:16:07 UTC (rev 13885) @@ -502,7 +502,7 @@ } // Finish off the class Printf(f_im, "}\n"); - Close(f_im); + Delete(f_im); } // Generate the Java module class @@ -554,7 +554,7 @@ // Finish off the class Printf(f_module, "}\n"); - Close(f_module); + Delete(f_module); } // Generate the Java constants interface @@ -585,7 +585,7 @@ // Finish off the Java interface Printf(f_module, "}\n"); - Close(f_module); + Delete(f_module); } if (upcasts_code) @@ -685,7 +685,6 @@ Printf(f_runtime_h, "\n"); Printf(f_runtime_h, "#endif\n"); - Close(f_runtime_h); Delete(f_runtime_h); f_runtime_h = NULL; Delete(f_directors); @@ -701,7 +700,6 @@ Delete(f_init); Dump(f_runtime, f_begin); Delete(f_runtime); - Close(f_begin); Delete(f_begin); return SWIG_OK; } @@ -1300,7 +1298,7 @@ "\n", enum_code, "\n", NIL); Printf(f_enum, "\n"); - Close(f_enum); + Delete(f_enum); Delete(output_directory); } } else { @@ -1977,7 +1975,7 @@ Printv(f_proxy, proxy_class_constants_code, NIL); Printf(f_proxy, "}\n"); - Close(f_proxy); + Delete(f_proxy); f_proxy = NULL; /* Output the downcast method, if necessary. Note: There's no other really @@ -3069,7 +3067,7 @@ Replaceall(swigtype, "$imclassname", imclass_name); Printv(f_swigtype, swigtype, NIL); - Close(f_swigtype); + Delete(f_swigtype); Delete(swigtype); Delete(n); } Modified: trunk/Source/Modules/lua.cxx =================================================================== --- trunk/Source/Modules/lua.cxx 2012-11-13 22:21:51 UTC (rev 13884) +++ trunk/Source/Modules/lua.cxx 2012-11-14 22:16:07 UTC (rev 13885) @@ -396,7 +396,6 @@ Delete(f_wrappers); Delete(f_init); Delete(f_initbeforefunc); - Close(f_begin); Delete(f_runtime); Delete(f_begin); Delete(s_dot_get); Modified: trunk/Source/Modules/main.cxx =================================================================== --- trunk/Source/Modules/main.cxx 2012-11-13 22:21:51 UTC (rev 13884) +++ trunk/Source/Modules/main.cxx 2012-11-14 22:16:07 UTC (rev 13885) @@ -403,7 +403,7 @@ s = Swig_include_sys("swiglabels.swg"); if (!s) { Printf(stderr, "*** Unable to open 'swiglabels.swg'\n"); - Close(runtime); + Delete(runtime); SWIG_exit(EXIT_FAILURE); } Printf(runtime, "%s", s); @@ -412,7 +412,7 @@ s = Swig_include_sys("swigerrors.swg"); if (!s) { Printf(stderr, "*** Unable to open 'swigerrors.swg'\n"); - Close(runtime); + Delete(runtime); SWIG_exit(EXIT_FAILURE); } Printf(runtime, "%s", s); @@ -421,7 +421,7 @@ s = Swig_include_sys("swigrun.swg"); if (!s) { Printf(stderr, "*** Unable to open 'swigrun.swg'\n"); - Close(runtime); + Delete(runtime); SWIG_exit(EXIT_FAILURE); } Printf(runtime, "%s", s); @@ -434,13 +434,12 @@ s = Swig_include_sys("runtime.swg"); if (!s) { Printf(stderr, "*** Unable to open 'runtime.swg'\n"); - Close(runtime); + Delete(runtime); SWIG_exit(EXIT_FAILURE); } Printf(runtime, "%s", s); Delete(s); - Close(runtime); Delete(runtime); SWIG_exit(EXIT_SUCCESS); } @@ -1009,7 +1008,7 @@ if (Verbose) Printf(stdout, "'%s' checked out from the SWIG library.\n", outfile); Printv(f_outfile, s, NIL); - Close(f_outfile); + Delete(f_outfile); } } } @@ -1111,7 +1110,7 @@ } Printf(f_dependencies_file, "\n"); if (f_dependencies_file != stdout) - Close(f_dependencies_file); + Delete(f_dependencies_file); if (depend_only) SWIG_exit(EXIT_SUCCESS); } else { @@ -1285,7 +1284,7 @@ int i; for (i = 0; i < Len(all_output_files); i++) Printf(f_outfiles, "%s\n", Getitem(all_output_files, i)); - Close(f_outfiles); + Delete(f_outfiles); } } Modified: trunk/Source/Modules/modula3.cxx =================================================================== --- trunk/Source/Modules/modula3.cxx 2012-11-13 22:21:51 UTC (rev 13884) +++ trunk/Source/Modules/modula3.cxx 2012-11-14 22:16:07 UTC (rev 13885) @@ -835,7 +835,7 @@ scanConstant(file, n); Printf(file, " return 0;\n"); Printf(file, "}\n"); - Close(file); + Delete(file); return SWIG_OK; } @@ -870,7 +870,7 @@ by SWIG with option -generaterename. */\n\ \n", input_file); scanRename(file, n); - Close(file); + Delete(file); return SWIG_OK; } @@ -900,7 +900,7 @@ by SWIG with option -generatetypemap. */\n\ \n", input_file); scanTypemap(file, n); - Close(file); + Delete(file); return SWIG_OK; } @@ -1009,7 +1009,7 @@ } else { Printf(file, "library(\"m3%s\")\n", name); } - Close(file); + Delete(file); } // Generate the raw interface @@ -1027,7 +1027,7 @@ Printv(file, m3raw_intf.f, NIL); Printf(file, "\nEND %s.\n", m3raw_name); - Close(file); + Delete(file); } // Generate the raw module @@ -1045,7 +1045,7 @@ Printv(file, m3raw_impl.f, NIL); Printf(file, "BEGIN\nEND %s.\n", m3raw_name); - Close(file); + Delete(file); } // Generate the interface for the comfort wrappers @@ -1075,7 +1075,7 @@ // Finish off the class Printf(file, "\nEND %s.\n", m3wrap_name); - Close(file); + Delete(file); } // Generate the wrapper routines implemented in Modula 3 @@ -1096,7 +1096,7 @@ Printv(file, m3wrap_impl.f, NIL); Printf(file, "\nBEGIN\nEND %s.\n", m3wrap_name); - Close(file); + Delete(file); } if (upcasts_code) @@ -1162,7 +1162,6 @@ Delete(f_header); Delete(f_wrappers); Delete(f_init); - Close(f_begin); Delete(f_runtime); Delete(f_begin); return SWIG_OK; @@ -2555,7 +2554,7 @@ Printv(f_proxy, proxy_class_def, proxy_class_code, NIL); Printf(f_proxy, "}\n"); - Close(f_proxy); + Delete(f_proxy); f_proxy = NULL; Delete(proxy_class_name); @@ -3811,7 +3810,7 @@ Replaceall(swigtype, "$m3classname", classname); Printv(f_swigtype, swigtype, NIL); - Close(f_swigtype); + Delete(f_swigtype); Delete(filen); Delete(swigtype); } Modified: trunk/Source/Modules/mzscheme.cxx =================================================================== --- trunk/Source/Modules/mzscheme.cxx 2012-11-13 22:21:51 UTC (rev 13884) +++ trunk/Source/Modules/mzscheme.cxx 2012-11-14 22:16:07 UTC (rev 13885) @@ -203,7 +203,6 @@ Delete(f_header); Delete(f_wrappers); Delete(f_init); - Close(f_begin); Delete(f_runtime); Delete(f_begin); return SWIG_OK; Modified: trunk/Source/Modules/ocaml.cxx =================================================================== --- trunk/Source/Modules/ocaml.cxx 2012-11-13 22:21:51 UTC (rev 13884) +++ trunk/Source/Modules/ocaml.cxx 2012-11-14 22:16:07 UTC (rev 13885) @@ -343,7 +343,6 @@ Delete(f_header); Delete(f_wrappers); Delete(f_init); - Close(f_begin); Delete(f_runtime); Delete(f_begin); @@ -357,14 +356,12 @@ Dump(f_class_ctors, f_mlout); Dump(f_class_ctors_end, f_mlout); Dump(f_mltail, f_mlout); - Close(f_mlout); Delete(f_mlout); Dump(f_enumtypes_type, f_mliout); Dump(f_enumtypes_value, f_mliout); Dump(f_mlibody, f_mliout); Dump(f_mlitail, f_mliout); - Close(f_mliout); Delete(f_mliout); return SWIG_OK; Modified: trunk/Source/Modules/octave.cxx =================================================================== --- trunk/Source/Modules/octave.cxx 2012-11-13 22:21:51 UTC (rev 13884) +++ trunk/Source/Modules/octave.cxx 2012-11-14 22:16:07 UTC (rev 13885) @@ -232,7 +232,6 @@ Delete(f_header); Delete(f_directors); Delete(f_directors_h); - Close(f_begin); Delete(f_runtime); Delete(f_begin); Modified: trunk/Source/Modules/perl5.cxx =================================================================== --- trunk/Source/Modules/perl5.cxx 2012-11-13 22:21:51 UTC (rev 13884) +++ trunk/Source/Modules/perl5.cxx 2012-11-14 22:16:07 UTC (rev 13885) @@ -520,7 +520,6 @@ Printf(f_pm, "%s", additional_perl_code); Printf(f_pm, "1;\n"); - Close(f_pm); Delete(f_pm); Delete(base); Delete(dest_package); @@ -534,7 +533,6 @@ Delete(f_header); Delete(f_wrappers); Delete(f_init); - Close(f_begin); Delete(f_runtime); Delete(f_begin); return SWIG_OK; Modified: trunk/Source/Modules/php.cxx =================================================================== --- trunk/Source/Modules/php.cxx 2012-11-13 22:21:51 UTC (rev 13884) +++ trunk/Source/Modules/php.cxx 2012-11-14 22:16:07 UTC (rev 13885) @@ -615,7 +615,7 @@ Printf(f_h, "#endif /* PHP_%s_H */\n", cap_module); - Close(f_h); + Delete(f_h); String *type_table = NewStringEmpty(); SwigType_emit_type_table(f_runtime, type_table); @@ -630,7 +630,7 @@ Dump(f_directors_h, f_runtime_h); Printf(f_runtime_h, "\n"); Printf(f_runtime_h, "#endif\n"); - Close(f_runtime_h); + Delete(f_runtime_h); } Printf(s_header, "/* end header section */\n"); @@ -654,7 +654,6 @@ Delete(s_vdecl); Delete(all_cs_entry); Delete(s_entry); - Close(f_begin); Delete(f_runtime); Delete(f_begin); @@ -667,7 +666,7 @@ s_fakeoowrappers = NULL; } Printf(f_phpcode, "%s\n?>\n", s_phpclasses); - Close(f_phpcode); + Delete(f_phpcode); return SWIG_OK; } Modified: trunk/Source/Modules/pike.cxx =================================================================== --- trunk/Source/Modules/pike.cxx 2012-11-13 22:21:51 UTC (rev 13884) +++ trunk/Source/Modules/pike.cxx 2012-11-14 22:16:07 UTC (rev 13885) @@ -182,8 +182,6 @@ Delete(f_wrappers); Delete(f_init); Delete(f_classInit); - - Close(f_begin); Delete(f_runtime); Delete(f_begin); Modified: trunk/Source/Modules/python.cxx =================================================================== --- trunk/Source/Modules/python.cxx 2012-11-13 22:21:51 UTC (rev 13884) +++ trunk/Source/Modules/python.cxx 2012-11-14 22:16:07 UTC (rev 13885) @@ -979,7 +979,6 @@ Printv(f_shadow_py, "\n", f_shadow_builtin_imports, "\n", NIL); Printv(f_shadow_py, f_shadow, "\n", NIL); Printv(f_shadow_py, f_shadow_stubs, "\n", NIL); - Close(f_shadow_py); Delete(f_shadow_py); } @@ -992,7 +991,7 @@ Printf(f_runtime_h, "\n"); Printf(f_runtime_h, "#endif\n"); if (f_runtime_h != f_begin) - Close(f_runtime_h); + Delete(f_runtime_h); Dump(f_directors, f_begin); } @@ -1007,8 +1006,6 @@ Delete(f_init); Delete(f_directors); Delete(f_directors_h); - - Close(f_begin); Delete(f_runtime); Delete(f_begin); Modified: trunk/Source/Modules/r.cxx =================================================================== --- trunk/Source/Modules/r.cxx 2012-11-13 22:21:51 UTC (rev 13884) +++ trunk/Source/Modules/r.cxx 2012-11-14 22:16:07 UTC (rev 13885) @@ -837,7 +837,6 @@ Delete(f_init); Delete(s_header); - Close(f_begin); Delete(f_runtime); Delete(f_begin); @@ -871,8 +870,7 @@ Printf(scode, "%s\n\n", s_classes); Printf(scode, "%s\n", sfile); - Close(scode); - // Delete(scode); + Delete(scode); String *outfile = Getattr(n,"outfile"); File *runtime = NewFile(outfile,"w", SWIG_output_files()); if (!runtime) { @@ -886,7 +884,6 @@ Printf(runtime, "%s\n", f_wrapper); Printf(runtime, "%s\n", f_init); - Close(runtime); Delete(runtime); if(outputNamespaceInfo) { @@ -907,7 +904,6 @@ Printf(ns, "\nexportMethods(\n"); writeListByLine(namespaceFunctions, ns, 1); Printf(ns, ")\n"); - Close(ns); Delete(ns); Delete(s_namespace); } Modified: trunk/Source/Modules/ruby.cxx =================================================================== --- trunk/Source/Modules/ruby.cxx 2012-11-13 22:21:51 UTC (rev 13884) +++ trunk/Source/Modules/ruby.cxx 2012-11-14 22:16:07 UTC (rev 13885) @@ -1185,7 +1185,7 @@ Dump(f_directors_h, f_runtime_h); Printf(f_runtime_h, "\n"); Printf(f_runtime_h, "#endif\n"); - Close(f_runtime_h); + Delete(f_runtime_h); } Dump(f_wrappers, f_begin); @@ -1196,7 +1196,6 @@ Delete(f_wrappers); Delete(f_init); Delete(f_initbeforefunc); - Close(f_begin); Delete(f_runtime); Delete(f_begin); Modified: trunk/Source/Modules/tcl8.cxx =================================================================== --- trunk/Source/Modules/tcl8.cxx 2012-11-13 22:21:51 UTC (rev 13884) +++ trunk/Source/Modules/tcl8.cxx 2012-11-14 22:16:07 UTC (rev 13885) @@ -248,7 +248,6 @@ if (itcl) { Printv(f_shadow, f_shadow_stubs, "\n", NIL); - Close(f_shadow); Delete(f_shadow); } @@ -259,7 +258,6 @@ Delete(f_header); Delete(f_wrappers); Delete(f_init); - Close(f_begin); Delete(f_runtime); Delete(f_begin); return SWIG_OK; Modified: trunk/Source/Modules/uffi.cxx =================================================================== --- trunk/Source/Modules/uffi.cxx 2012-11-13 22:21:51 UTC (rev 13884) +++ trunk/Source/Modules/uffi.cxx 2012-11-14 22:16:07 UTC (rev 13885) @@ -266,9 +266,7 @@ Language::top(n); - Close(f_cl); Delete(f_cl); // Delete the handle, not the file - Close(f_null); Delete(f_null); return SWIG_OK; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |