-outdir commandline option support => directory for proxy class and other language specific files

-help tidy up


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@4981 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2003-08-07 17:22:12 +00:00
commit 06ed231b7d
17 changed files with 150 additions and 115 deletions

View file

@ -32,15 +32,14 @@ char cvsroot_chicken_cxx[] = "$Header$";
static const char *chicken_usage = (char*)"\ static const char *chicken_usage = (char*)"\
\ \
CHICKEN Options (available with -chicken)\n\ CHICKEN Options (available with -chicken)\n\
-help - Print this help.\n\ -prefix <name> - Set a prefix <name> to be prepended to all names\n\
-prefix name - Set a prefix to be prepended to all names.\n\ Defaults to the name of the module\n\
Defaults to the name of the module.\n\ -noprefix - Don't use a prefix\n\
-noprefix - Don't use a prefix.\n\
-mixed - Convert mixed case (ex. aMethodName) into\n\ -mixed - Convert mixed case (ex. aMethodName) into\n\
dash seperated, lower case (ex. a-method-name).\n\ dash seperated, lower case (ex. a-method-name)\n\
-noclos - Don't generate clos TinyCLOS code.\n\ -noclos - Don't generate clos TinyCLOS code\n\
-nogeneric - Don't generate (make-generic) definitions.\n\ -nogeneric - Don't generate (make-generic) definitions\n\
-ldflags - Print runtime libraries to link with.\n\ -ldflags - Print runtime libraries to link with\n\
\n" \n"
; ;
@ -265,7 +264,7 @@ CHICKEN::top(Node *n)
} }
} }
Printf(chicken_filename,"%s%s.scm", Swig_file_dirname(outfile), module); 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")) == 0) {
Printf(stderr,"Unable to open %s\n", chicken_filename); Printf(stderr,"Unable to open %s\n", chicken_filename);
SWIG_exit(EXIT_FAILURE); SWIG_exit(EXIT_FAILURE);
@ -309,7 +308,7 @@ CHICKEN::top(Node *n)
if (generic) { if (generic) {
Printf(generic_filename,"%s%s-generic.scm", Printf(generic_filename,"%s%s-generic.scm",
Swig_file_dirname(outfile), module); SWIG_output_directory(), module);
if ((f_generic = NewFile(generic_filename,"w")) == 0) { if ((f_generic = NewFile(generic_filename,"w")) == 0) {
Printf(stderr,"Unable to open %s\n", generic_filename); Printf(stderr,"Unable to open %s\n", generic_filename);
SWIG_exit (EXIT_FAILURE); SWIG_exit (EXIT_FAILURE);
@ -325,7 +324,7 @@ CHICKEN::top(Node *n)
} }
if (clos) { if (clos) {
Printf(clos_filename,"%s%s-clos.scm", Swig_file_dirname(outfile), module); Printf(clos_filename,"%s%s-clos.scm", SWIG_output_directory(), module);
if ((f_clos = NewFile(clos_filename,"w")) == 0) { if ((f_clos = NewFile(clos_filename,"w")) == 0) {
Printf(stderr,"Unable to open %s\n", clos_filename); Printf(stderr,"Unable to open %s\n", clos_filename);
SWIG_exit (EXIT_FAILURE); SWIG_exit (EXIT_FAILURE);

View file

@ -60,7 +60,6 @@ class CSHARP : public Language {
String *upcasts_code; //C++ casts for inheritance hierarchies C++ code String *upcasts_code; //C++ casts for inheritance hierarchies C++ code
String *imclass_cppcasts_code; //C++ casts up inheritance hierarchies intermediary class code String *imclass_cppcasts_code; //C++ casts up inheritance hierarchies intermediary class code
String *destructor_call; //C++ destructor call if any String *destructor_call; //C++ destructor call if any
String *outfile;
enum type_additions {none, pointer, reference}; enum type_additions {none, pointer, reference};
@ -109,8 +108,7 @@ class CSHARP : public Language {
module_class_modifiers(NULL), module_class_modifiers(NULL),
upcasts_code(NULL), upcasts_code(NULL),
imclass_cppcasts_code(NULL), imclass_cppcasts_code(NULL),
destructor_call(NULL), destructor_call(NULL)
outfile(NULL)
{ {
} }
@ -179,7 +177,7 @@ class CSHARP : public Language {
virtual int top(Node *n) { virtual int top(Node *n) {
/* Initialize all of the output files */ /* Initialize all of the output files */
outfile = Getattr(n,"outfile"); String *outfile = Getattr(n,"outfile");
f_runtime = NewFile(outfile,"w"); f_runtime = NewFile(outfile,"w");
if (!f_runtime) { if (!f_runtime) {
@ -256,7 +254,7 @@ class CSHARP : public Language {
// Generate the intermediary class // Generate the intermediary class
{ {
String *filen = NewStringf("%s%s.cs", Swig_file_dirname(outfile), imclass_name); String *filen = NewStringf("%s%s.cs", SWIG_output_directory(), imclass_name);
File *f_im = NewFile(filen,"w"); File *f_im = NewFile(filen,"w");
if(!f_im) { if(!f_im) {
Printf(stderr,"Unable to open %s\n", filen); Printf(stderr,"Unable to open %s\n", filen);
@ -293,7 +291,7 @@ class CSHARP : public Language {
// Generate the C# module class // Generate the C# module class
{ {
String *filen = NewStringf("%s%s.cs", Swig_file_dirname(outfile), module_class_name); String *filen = NewStringf("%s%s.cs", SWIG_output_directory(), module_class_name);
File *f_module = NewFile(filen,"w"); File *f_module = NewFile(filen,"w");
if(!f_module) { if(!f_module) {
Printf(stderr,"Unable to open %s\n", filen); Printf(stderr,"Unable to open %s\n", filen);
@ -1120,7 +1118,7 @@ class CSHARP : public Language {
SWIG_exit(EXIT_FAILURE); SWIG_exit(EXIT_FAILURE);
} }
String *filen = NewStringf("%s%s.cs", Swig_file_dirname(outfile), proxy_class_name); String *filen = NewStringf("%s%s.cs", SWIG_output_directory(), proxy_class_name);
f_proxy = NewFile(filen,"w"); f_proxy = NewFile(filen,"w");
if(!f_proxy) { if(!f_proxy) {
Printf(stderr, "Unable to create proxy class file: %s\n", filen); Printf(stderr, "Unable to create proxy class file: %s\n", filen);
@ -1855,7 +1853,7 @@ class CSHARP : public Language {
* ----------------------------------------------------------------------------- */ * ----------------------------------------------------------------------------- */
void emitTypeWrapperClass(String *classname, SwigType *type) { void emitTypeWrapperClass(String *classname, SwigType *type) {
String *filen = NewStringf("%s%s.cs", Swig_file_dirname(outfile), classname); String *filen = NewStringf("%s%s.cs", SWIG_output_directory(), classname);
File *f_swigtype = NewFile(filen,"w"); File *f_swigtype = NewFile(filen,"w");
String *swigtype = NewString(""); String *swigtype = NewString("");
@ -2010,7 +2008,8 @@ swig_csharp(void) {
const char *CSHARP::usage = (char*)"\ const char *CSHARP::usage = (char*)"\
C# Options (available with -csharp)\n\ C# Options (available with -csharp)\n\
-package <name> - set name of the assembly\n\ -package <name> - set name of the assembly to <name>\n\
-noproxy - Generate the low-level functional interface instead of proxy classes\n\ -noproxy - Generate the low-level functional interface instead\n\
of proxy classes\n\
\n"; \n";

View file

@ -346,6 +346,7 @@ void emit_mark_varargs(ParmList *l) {
} }
} }
#if 0
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
* replace_args() * replace_args()
* ----------------------------------------------------------------------------- */ * ----------------------------------------------------------------------------- */
@ -360,6 +361,7 @@ void replace_args(Parm *p, String *s) {
p = nextSibling(p); p = nextSibling(p);
} }
} }
#endif
/* replace_contract_args. This function replaces argument names in contract /* replace_contract_args. This function replaces argument names in contract
specifications. Used in conjunction with the %contract directive. */ specifications. Used in conjunction with the %contract directive. */

View file

@ -33,22 +33,22 @@ char cvsroot_guile_cxx[] = "$Header$";
static const char *guile_usage = (char*)"\ static const char *guile_usage = (char*)"\
Guile Options (available with -guile)\n\ Guile Options (available with -guile)\n\
-ldflags - Print runtime libraries to link with\n\ -ldflags - Print runtime libraries to link with\n\
-prefix name - Use NAME as prefix [default \"gswig_\"]\n\ -prefix <name> - Use <name> as prefix [default \"gswig_\"]\n\
-package name - Set the path of the module [default NULL]\n\ -package <name> - Set the path of the module to <name> [default NULL]\n\
-emit-setters - Emit procedures-with-setters for variables\n\ -emit-setters - Emit procedures-with-setters for variables\n\
and structure slots.\n\ and structure slots.\n\
-linkage lstyle - Use linkage protocol LSTYLE [default `module']\n\ -procdoc <file> - Output procedure documentation to <file>\n\
-procdoc file - Output procedure documentation to FILE\n\ -procdocformat <format> - Output procedure documentation in <format>;\n\
-procdocformat format - Output procedure documentation in FORMAT;\n\
one of `guile-1.4', `plain', `texinfo'\n\ one of `guile-1.4', `plain', `texinfo'\n\
-scmstub file - Output Scheme FILE with module declaration and\n\ -linkage <lstyle> - Use linkage protocol <lstyle> [default `module']\n\
-scmstub <file> - Output Scheme <file> with module declaration and\n\
exports; only with `passive' and `simple' linkage\n\ exports; only with `passive' and `simple' linkage\n\
-gh - Use the gh_ guile interface. (default) \n\ -gh - Use the gh_ guile interface. (default) \n\
-scm - Use the scm guile interface. (guile >=1.6) \n\ -scm - Use the scm guile interface. (guile >=1.6) \n\
\n\ \n\
When unspecified, the default LSTYLE is `simple'. For native Guile\n\ When unspecified, the default <lstyle> is `simple'. For native Guile\n\
module linking (for Guile versions >=1.5.0), use `module'. Other\n\ module linking (for Guile versions >=1.5.0), use `module'. Other\n\
LSTYLE values are: `passive' for passive linking (no C-level\n\ <lstyle> values are: `passive' for passive linking (no C-level\n\
module-handling code), `ltdlmod' for Guile's old dynamic module\n\ module-handling code), `ltdlmod' for Guile's old dynamic module\n\
convention (versions <= 1.4), or `hobbit' for hobbit modules.\n\ convention (versions <= 1.4), or `hobbit' for hobbit modules.\n\
\n"; \n";

View file

@ -61,7 +61,6 @@ class JAVA : public Language {
String *upcasts_code; //C++ casts for inheritance hierarchies C++ code String *upcasts_code; //C++ casts for inheritance hierarchies C++ code
String *imclass_cppcasts_code; //C++ casts up inheritance hierarchies intermediary class code String *imclass_cppcasts_code; //C++ casts up inheritance hierarchies intermediary class code
String *destructor_call; //C++ destructor call if any String *destructor_call; //C++ destructor call if any
String *outfile;
enum type_additions {none, pointer, reference}; enum type_additions {none, pointer, reference};
@ -111,8 +110,7 @@ class JAVA : public Language {
module_class_modifiers(NULL), module_class_modifiers(NULL),
upcasts_code(NULL), upcasts_code(NULL),
imclass_cppcasts_code(NULL), imclass_cppcasts_code(NULL),
destructor_call(NULL), destructor_call(NULL)
outfile(NULL)
{ {
} }
@ -204,7 +202,7 @@ class JAVA : public Language {
virtual int top(Node *n) { virtual int top(Node *n) {
/* Initialize all of the output files */ /* Initialize all of the output files */
outfile = Getattr(n,"outfile"); String *outfile = Getattr(n,"outfile");
f_runtime = NewFile(outfile,"w"); f_runtime = NewFile(outfile,"w");
if (!f_runtime) { if (!f_runtime) {
@ -292,7 +290,7 @@ class JAVA : public Language {
// Generate the intermediary class // Generate the intermediary class
{ {
String *filen = NewStringf("%s%s.java", Swig_file_dirname(outfile), imclass_name); String *filen = NewStringf("%s%s.java", SWIG_output_directory(), imclass_name);
File *f_im = NewFile(filen,"w"); File *f_im = NewFile(filen,"w");
if(!f_im) { if(!f_im) {
Printf(stderr,"Unable to open %s\n", filen); Printf(stderr,"Unable to open %s\n", filen);
@ -329,7 +327,7 @@ class JAVA : public Language {
// Generate the Java module class // Generate the Java module class
{ {
String *filen = NewStringf("%s%s.java", Swig_file_dirname(outfile), module_class_name); String *filen = NewStringf("%s%s.java", SWIG_output_directory(), module_class_name);
File *f_module = NewFile(filen,"w"); File *f_module = NewFile(filen,"w");
if(!f_module) { if(!f_module) {
Printf(stderr,"Unable to open %s\n", filen); Printf(stderr,"Unable to open %s\n", filen);
@ -372,7 +370,7 @@ class JAVA : public Language {
// Generate the Java constants interface // Generate the Java constants interface
if (Len(module_class_constants_code) != 0 ) { if (Len(module_class_constants_code) != 0 ) {
String *filen = NewStringf("%s%sConstants.java", Swig_file_dirname(outfile), module_class_name); String *filen = NewStringf("%s%sConstants.java", SWIG_output_directory(), module_class_name);
File *f_module = NewFile(filen,"w"); File *f_module = NewFile(filen,"w");
if(!f_module) { if(!f_module) {
Printf(stderr,"Unable to open %s\n", filen); Printf(stderr,"Unable to open %s\n", filen);
@ -1231,7 +1229,7 @@ class JAVA : public Language {
SWIG_exit(EXIT_FAILURE); SWIG_exit(EXIT_FAILURE);
} }
String *filen = NewStringf("%s%s.java", Swig_file_dirname(outfile), proxy_class_name); String *filen = NewStringf("%s%s.java", SWIG_output_directory(), proxy_class_name);
f_proxy = NewFile(filen,"w"); f_proxy = NewFile(filen,"w");
if(!f_proxy) { if(!f_proxy) {
Printf(stderr, "Unable to create proxy class file: %s\n", filen); Printf(stderr, "Unable to create proxy class file: %s\n", filen);
@ -1845,7 +1843,7 @@ class JAVA : public Language {
* ----------------------------------------------------------------------------- */ * ----------------------------------------------------------------------------- */
void emitTypeWrapperClass(String *classname, SwigType *type) { void emitTypeWrapperClass(String *classname, SwigType *type) {
String *filen = NewStringf("%s%s.java", Swig_file_dirname(outfile), classname); String *filen = NewStringf("%s%s.java", SWIG_output_directory(), classname);
File *f_swigtype = NewFile(filen,"w"); File *f_swigtype = NewFile(filen,"w");
String *swigtype = NewString(""); String *swigtype = NewString("");
@ -2000,7 +1998,8 @@ swig_java(void) {
const char *JAVA::usage = (char*)"\ const char *JAVA::usage = (char*)"\
Java Options (available with -java)\n\ Java Options (available with -java)\n\
-package <name> - set name of the Java package\n\ -package <name> - set name of the Java package to <name>\n\
-noproxy - Generate the low-level functional interface instead of proxy classes\n\ -noproxy - Generate the low-level functional interface instead\n\
of proxy classes\n\
\n"; \n";

View file

@ -45,6 +45,8 @@ extern "C" {
int Verbose = 0; int Verbose = 0;
int NoExtern = 0; int NoExtern = 0;
int NoExcept = 0; int NoExcept = 0;
char *SwigLib;
extern "C" { extern "C" {
extern String *ModuleName; extern String *ModuleName;
@ -55,29 +57,37 @@ static char *usage = (char*)"\
-c - Produce raw wrapper code (omit support code)\n\ -c - Produce raw wrapper code (omit support code)\n\
-c++ - Enable C++ processing\n\ -c++ - Enable C++ processing\n\
-co - Check a file out of the SWIG library\n\ -co - Check a file out of the SWIG library\n\
-Dsymbol - Define a symbol (for conditional compilation)\n\ -D<symbol> - Define a symbol <symbol> (for conditional compilation)\n\
-I<dir> - Look for SWIG files in <dir>\n\
-includeall - Follow all #include statements\n\
-importall - Follow all #include statements as imports\n\
-ignoremissing - Ignore missing include files.\n\
-l<ifile> - Include SWIG library file.\n\
-M - List all dependencies. \n\
-MM - List dependencies, but omit files in SWIG library.\n\
-makedefault - Create default constructors/destructors (the default)\n\
-module - Set module name\n\
-nodefault - Do not generate constructors/destructors\n\
-noexcept - Do not wrap exception specifiers.\n\
-noextern - Do not generate extern declarations.\n\
-o outfile - Set name of the output file.\n\
-swiglib - Report location of SWIG library and exit\n\
-v - Run in verbose mode\n\
-fcompact - Compile in compact mode\n\ -fcompact - Compile in compact mode\n\
-fvirtual - Compile in virtual elimination mode\n\ -fvirtual - Compile in virtual elimination mode\n\
-help - This output\n\
-I<dir> - Look for SWIG files in <dir>\n\
-ignoremissing - Ignore missing include files\n\
-importall - Follow all #include statements as imports\n\
-includeall - Follow all #include statements\n\
-l<ifile> - Include SWIG library file <ifile>\n\
-M - List all dependencies \n\
-MM - List dependencies, but omit files in SWIG library\n\
-makedefault - Create default constructors/destructors (the default)\n\
-module <name> - Set module name to <name>\n\
-nodefault - Do not generate constructors/destructors\n\
-noexcept - Do not wrap exception specifiers\n\
-noextern - Do not generate extern declarations\n\
-o <outfile> - Set name of the output file to <outfile>\n\
-outdir <dir> - Set language specific files output directory\n\
-small - Compile in virtual elimination & compact mode\n\ -small - Compile in virtual elimination & compact mode\n\
-swiglib - Report location of SWIG library and exit\n\
-v - Run in verbose mode\n\
-version - Print SWIG version number\n\ -version - Print SWIG version number\n\
-Wall - Enable all warning messages\n\ -Wall - Enable all warning messages\n\
-wn - Suppress warning number n\n\ -w<n> - Suppress warning number <n>\n\
-help - This output.\n\n"; \n";
// Local variables
static int freeze = 0;
static String *lang_config = 0;
static char *cpp_extension = (char *) "cxx";
static String *outdir = 0;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// check_suffix(char *name) // check_suffix(char *name)
@ -139,17 +149,31 @@ install_opts(int argc, char *argv[]) {
} }
} }
} }
// -----------------------------------------------------------------------------
// Sets the output directory for language specific (proxy) files if not set and
// adds trailing file separator if necessary.
// -----------------------------------------------------------------------------
static void set_outdir(const String *c_wrapper_file_dir) {
// Add file delimiter if not present in output directory name
if (outdir && Len(outdir) != 0) {
const char* outd = Char(outdir);
if (strcmp(outd + strlen(outd) - strlen(SWIG_FILE_DELIMETER), SWIG_FILE_DELIMETER) != 0)
Printv(outdir, SWIG_FILE_DELIMETER, NIL);
}
// Use the C wrapper file's directory if the output directory has not been set by user
if (!outdir)
outdir = NewString(c_wrapper_file_dir);
}
//----------------------------------------------------------------- //-----------------------------------------------------------------
// main() // main()
// //
// Main program. Initializes the files and starts the parser. // Main program. Initializes the files and starts the parser.
//----------------------------------------------------------------- //-----------------------------------------------------------------
char *SwigLib;
static int freeze = 0;
static String *lang_config = 0;
static char *cpp_extension = (char *) "cxx";
/* This function sets the name of the configuration file */ /* 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 *filename) {
@ -160,6 +184,12 @@ void SWIG_library_directory(const char *filename) {
strcpy(LibDir,filename); strcpy(LibDir,filename);
} }
// Returns the directory for generating language specific files (non C/C++ files)
const String *SWIG_output_directory() {
assert(outdir);
return outdir;
}
void SWIG_config_cppext(const char *ext) { void SWIG_config_cppext(const char *ext) {
cpp_extension = (char *) ext; cpp_extension = (char *) ext;
} }
@ -399,6 +429,14 @@ int SWIG_main(int argc, char *argv[], Language *l) {
} else if (strcmp(argv[i],"-MM") == 0) { } else if (strcmp(argv[i],"-MM") == 0) {
depend = 2; depend = 2;
Swig_mark_arg(i); Swig_mark_arg(i);
} else if (strcmp(argv[i],"-outdir") == 0) {
Swig_mark_arg(i);
if (argv[i+1]) {
outdir = NewString(argv[i+1]);
Swig_mark_arg(i+1);
} else {
Swig_arg_error();
}
} else if (strcmp(argv[i],"-Wall") == 0) { } else if (strcmp(argv[i],"-Wall") == 0) {
Swig_mark_arg(i); Swig_mark_arg(i);
Swig_warnall(); Swig_warnall();
@ -430,7 +468,6 @@ int SWIG_main(int argc, char *argv[], Language *l) {
memory_debug =1; memory_debug =1;
Swig_mark_arg(i); Swig_mark_arg(i);
} else if (strcmp(argv[i],"-help") == 0) { } else if (strcmp(argv[i],"-help") == 0) {
//fputs("Help.\n",stderr);
fputs(usage,stderr); fputs(usage,stderr);
Swig_mark_arg(i); Swig_mark_arg(i);
help = 1; help = 1;
@ -642,6 +679,7 @@ int SWIG_main(int argc, char *argv[], Language *l) {
Setattr(top,"outfile_h", NewStringf("%s.h", header)); Setattr(top,"outfile_h", NewStringf("%s.h", header));
free(header); free(header);
} }
set_outdir(Swig_file_dirname(Getattr(top,"outfile")));
if (Swig_contract_mode_get()) { if (Swig_contract_mode_get()) {
Swig_contracts(top); Swig_contracts(top);
} }

View file

@ -32,13 +32,11 @@ char cvsroot_mzscheme_cxx[] = "$Header$";
#include <ctype.h> #include <ctype.h>
static const char *usage = (char*)"\ static const char *usage = (char*)"\
\n\
Mzscheme Options (available with -mzscheme)\n\ Mzscheme Options (available with -mzscheme)\n\
-ldflags - Print runtime libraries to link with\n\ -ldflags - Print runtime libraries to link with\n\
-prefix name - Set a prefix to be appended to all names\n\ -prefix <name> - Set a prefix <name> to be prepended to all names\n\
-declaremodule - Create extension that declares a module\n\ -declaremodule - Create extension that declares a module\n\
\n" \n";
;
static char *prefix=0; static char *prefix=0;
static bool declaremodule = false; static bool declaremodule = false;

View file

@ -26,11 +26,10 @@ char cvsroot_ocaml_cxx[] = "$Header$";
#include <ctype.h> #include <ctype.h>
static const char *usage = (char*) static const char *usage = (char*)"\
("\n" Ocaml Options (available with -ocaml)\n\
"Ocaml Options (available with -ocaml)\n" -prefix <name> - Set a prefix <name> to be prepended to all names\n\
"-prefix name - Set a prefix to be appended to all names\n" \n";
"\n");
static int classmode = 0; static int classmode = 0;
static int in_constructor = 0, in_destructor = 0, in_copyconst = 0; static int in_constructor = 0, in_destructor = 0, in_copyconst = 0;
@ -475,12 +474,12 @@ public:
Printv(mlfile,module,".ml",NIL); Printv(mlfile,module,".ml",NIL);
Printv(mlifile,module,".mli",NIL); Printv(mlifile,module,".mli",NIL);
String *mlfilen = NewStringf("%s%s", Swig_file_dirname(outfile),mlfile); String *mlfilen = NewStringf("%s%s", SWIG_output_directory(),mlfile);
if ((f_mlout = NewFile(mlfilen,"w")) == 0) { if ((f_mlout = NewFile(mlfilen,"w")) == 0) {
Printf(stderr,"Unable to open %s\n", mlfilen); Printf(stderr,"Unable to open %s\n", mlfilen);
SWIG_exit (EXIT_FAILURE); SWIG_exit (EXIT_FAILURE);
} }
String *mlifilen = NewStringf("%s%s", Swig_file_dirname(outfile),mlifile); String *mlifilen = NewStringf("%s%s", SWIG_output_directory(),mlifile);
if ((f_mliout = NewFile(mlifilen,"w")) == 0) { if ((f_mliout = NewFile(mlifilen,"w")) == 0) {
Printf(stderr,"Unable to open %s\n", mlifilen); Printf(stderr,"Unable to open %s\n", mlifilen);
SWIG_exit (EXIT_FAILURE); SWIG_exit (EXIT_FAILURE);

View file

@ -24,11 +24,11 @@ char cvsroot_perl5_cxx[] = "$Header$";
static const char *usage = (char*)"\ static const char *usage = (char*)"\
Perl5 Options (available with -perl5)\n\ Perl5 Options (available with -perl5)\n\
-ldflags - Print runtime libraries to link with\n\ -ldflags - Print runtime libraries to link with\n\
-static - Omit code related to dynamic loading.\n\ -static - Omit code related to dynamic loading\n\
-nopm - Do not generate the .pm file.\n\ -nopm - Do not generate the .pm file\n\
-proxy - Create proxy classes.\n\ -proxy - Create proxy classes\n\
-const - Wrap constants as constants and not variables (implies -shadow).\n\ -const - Wrap constants as constants and not variables (implies -proxy)\n\
-compat - Compatibility mode.\n\n"; -compat - Compatibility mode\n\n";
static int compat = 0; static int compat = 0;
@ -247,11 +247,12 @@ public:
} }
pmfile = NewStringf("%s.pm", m); pmfile = NewStringf("%s.pm", m);
} }
String *filen = NewStringf("%s%s", Swig_file_dirname(outfile),pmfile); String *filen = NewStringf("%s%s", SWIG_output_directory(),pmfile);
if ((f_pm = NewFile(filen,"w")) == 0) { if ((f_pm = NewFile(filen,"w")) == 0) {
Printf(stderr,"Unable to open %s\n", filen); Printf(stderr,"Unable to open %s\n", filen);
SWIG_exit (EXIT_FAILURE); SWIG_exit (EXIT_FAILURE);
} }
Delete(filen); filen = NULL;
Swig_register_filebyname("pm",f_pm); Swig_register_filebyname("pm",f_pm);
} }
{ {

View file

@ -29,13 +29,13 @@ PHP4 Options (available with -php4)\n\
-ldflags - Print runtime libraries to link with\n\ -ldflags - Print runtime libraries to link with\n\
-cppext - cpp file extension (default to .cpp)\n\ -cppext - cpp file extension (default to .cpp)\n\
-noproxy - Don't generate proxy classes.\n\ -noproxy - Don't generate proxy classes.\n\
-dlname name - Set module prefix.\n\ -dlname <name> - Set module prefix to <name>\n\
-make - Create simple makefile.\n\ -make - Create simple makefile\n\
-phpfull - Create full make files.\n\ -phpfull - Create full make files\n\
-withincs libs - With -phpfull writes needed incs in config.m4\n\ -withincs <libs>- With -phpfull writes needed incs in config.m4\n\
-withlibs libs - With -phpfull writes needed libs in config.m4\n\n\ -withlibs <libs>- With -phpfull writes needed libs in config.m4\n\
-withc libs - With -phpfull makes extra c files in Makefile.in\n\ -withc <libs> - With -phpfull makes extra c files in Makefile.in\n\
-withcxx libs - With -phpfull makes extra c++ files in Makefile.in\n\ -withcxx <libs> - With -phpfull makes extra c++ files in Makefile.in\n\
\n"; \n";
static int constructors=0; static int constructors=0;
@ -48,7 +48,6 @@ static String *withlibs = 0;
static String *withincs = 0; static String *withincs = 0;
static String *withc = 0; static String *withc = 0;
static String *withcxx = 0; static String *withcxx = 0;
static String *outfile = 0;
//static char *package = 0; // Name of the package //static char *package = 0; // Name of the package
static char *shadow_classname; static char *shadow_classname;
@ -358,7 +357,7 @@ public:
Close(f_make); Close(f_make);
} }
void create_extra_files(void) { void create_extra_files(String *outfile) {
File *f_extra; File *f_extra;
static String *configm4=0; static String *configm4=0;
@ -366,13 +365,13 @@ public:
static String *credits=0; static String *credits=0;
configm4=NewString(""); configm4=NewString("");
Printv(configm4, Swig_file_dirname(outfile), "config.m4", NIL); Printv(configm4, SWIG_output_directory(), "config.m4", NIL);
makefilein=NewString(""); makefilein=NewString("");
Printv(makefilein, Swig_file_dirname(outfile), "Makefile.in", NIL); Printv(makefilein, SWIG_output_directory(), "Makefile.in", NIL);
credits=NewString(""); credits=NewString("");
Printv(credits, Swig_file_dirname(outfile), "CREDITS", NIL); Printv(credits, SWIG_output_directory(), "CREDITS", NIL);
// are we a --with- or --enable- // are we a --with- or --enable-
int with=(withincs || withlibs)?1:0; int with=(withincs || withlibs)?1:0;
@ -566,7 +565,7 @@ public:
String *s_type; String *s_type;
/* Initialize all of the output files */ /* Initialize all of the output files */
outfile = Getattr(n,"outfile"); String *outfile = Getattr(n,"outfile");
/* main output file */ /* main output file */
f_runtime = NewFile(outfile,"w"); f_runtime = NewFile(outfile,"w");
@ -623,7 +622,7 @@ public:
/* PHP module file */ /* PHP module file */
filen = NewString(""); filen = NewString("");
Printv(filen, Swig_file_dirname(outfile), module, ".php", NIL); Printv(filen, SWIG_output_directory(), module, ".php", NIL);
phpfilename = NewString(filen); phpfilename = NewString(filen);
f_phpcode = NewFile(filen, "w"); f_phpcode = NewFile(filen, "w");
@ -676,7 +675,7 @@ public:
/* Create the .h file too */ /* Create the .h file too */
filen = NewString(""); filen = NewString("");
Printv(filen, Swig_file_dirname(outfile), "php_", module, ".h", NIL); Printv(filen, SWIG_output_directory(), "php_", module, ".h", NIL);
f_h = NewFile(filen, "w"); f_h = NewFile(filen, "w");
if (!f_h) { if (!f_h) {
Printf(stderr,"Unable to open %s\n", filen); Printf(stderr,"Unable to open %s\n", filen);
@ -879,7 +878,7 @@ public:
Printf(f_phpcode, "%s\n%s\n?>\n", pragma_incl, pragma_code); Printf(f_phpcode, "%s\n%s\n?>\n", pragma_incl, pragma_code);
Close(f_phpcode); Close(f_phpcode);
create_extra_files(); create_extra_files(outfile);
if(!gen_extra && gen_make) if(!gen_extra && gen_make)
create_simple_make(); create_simple_make();

View file

@ -302,12 +302,12 @@ static String *real_classname;
static const char *usage = (char *)"\ static const char *usage = (char *)"\
Python Options (available with -python)\n\ Python Options (available with -python)\n\
-ldflags - Print runtime libraries to link with\n\ -ldflags - Print runtime libraries to link with\n\
-globals name - Set name used to access C global variable ('cvar' by default).\n\ -globals <name> - Set <name> used to access C global variable [default: 'cvar']\n\
-interface name - Set the lib name\n\ -interface <lib>- Set the lib name to <lib>\n\
-keyword - Use keyword arguments\n\ -keyword - Use keyword arguments\n\
-classic - Use classic classes only\n\ -classic - Use classic classes only\n\
-noexcept - No automatic exception handling.\n\ -noexcept - No automatic exception handling\n\
-noproxy - Don't generate proxy classes. \n\n"; -noproxy - Don't generate proxy classes \n\n";
class PYTHON : public Language { class PYTHON : public Language {
public: public:
@ -461,11 +461,9 @@ public:
Printf(f_directors, "#include \"%s\"\n\n", outfile_h); Printf(f_directors, "#include \"%s\"\n\n", outfile_h);
} }
char filen[256];
/* If shadow classing is enabled, we're going to change the module name to "_module" */ /* If shadow classing is enabled, we're going to change the module name to "_module" */
if (shadow) { if (shadow) {
sprintf(filen,"%s%s.py", Swig_file_dirname(outfile), Char(module)); String *filen = NewStringf("%s%s.py", SWIG_output_directory(), Char(module));
// If we don't have an interface then change the module name X to _X // If we don't have an interface then change the module name X to _X
if (interface) module = interface; if (interface) module = interface;
else Insert(module,0,"_"); else Insert(module,0,"_");
@ -473,6 +471,8 @@ public:
Printf(stderr,"Unable to open %s\n", filen); Printf(stderr,"Unable to open %s\n", filen);
SWIG_exit (EXIT_FAILURE); SWIG_exit (EXIT_FAILURE);
} }
Delete(filen); filen = NULL;
f_shadow_stubs = NewString(""); f_shadow_stubs = NewString("");
Swig_register_filebyname("shadow",f_shadow); Swig_register_filebyname("shadow",f_shadow);

View file

@ -387,7 +387,7 @@ Ruby Options (available with -ruby)\n\
-ldflags - Print runtime libraries to link with\n\ -ldflags - Print runtime libraries to link with\n\
-globalmodule - Wrap everything into the global module\n\ -globalmodule - Wrap everything into the global module\n\
-minherit - Attempt to support multiple inheritance\n\ -minherit - Attempt to support multiple inheritance\n\
-feature name - Set feature name (used by `require')\n"; -feature <name> - Set feature name to <name> (used by `require')\n";
#define RCLASS(hash, name) (RClass*)(Getattr(hash, name) ? Data(Getattr(hash, name)) : 0) #define RCLASS(hash, name) (RClass*)(Getattr(hash, name) ? Data(Getattr(hash, name)) : 0)

View file

@ -14,7 +14,7 @@
char cvsroot_s_exp_cxx[] = "$Header$"; char cvsroot_s_exp_cxx[] = "$Header$";
static const char *usage = "\ static const char *usage = "\
S-Exp Options (available with -sexp)\n\ S-Exp Options (available with -sexp)\n\
-typemaplang lang - Typemap language.\n\n"; -typemaplang <lang> - Typemap language\n\n";
#include "swigmod.h" #include "swigmod.h"

View file

@ -139,7 +139,7 @@ int main(int argc, char **argv) {
Printf(stderr,"Target Language Options:\n"); Printf(stderr,"Target Language Options:\n");
for (int j = 0; modules[j].name; j++) { for (int j = 0; modules[j].name; j++) {
if (modules[j].help) { if (modules[j].help) {
Printf(stderr," %-15s - Generate %s wrappers.\n", modules[j].name, modules[j].help); Printf(stderr," %-15s - Generate %s wrappers\n", modules[j].name, modules[j].help);
} }
} }
Swig_mark_arg(i); Swig_mark_arg(i);

View file

@ -252,6 +252,7 @@ extern int SWIG_main(int, char **, Language *);
extern void emit_args(SwigType *, ParmList *, Wrapper *f); extern void emit_args(SwigType *, ParmList *, Wrapper *f);
extern void SWIG_exit(int); /* use EXIT_{SUCCESS,FAILURE} */ extern void SWIG_exit(int); /* use EXIT_{SUCCESS,FAILURE} */
extern void SWIG_config_file(const String_or_char *); extern void SWIG_config_file(const String_or_char *);
extern const String *SWIG_output_directory();
extern void SWIG_config_cppext(const char *ext); extern void SWIG_config_cppext(const char *ext);
extern "C" void SWIG_typemap_lang(const char *); extern "C" void SWIG_typemap_lang(const char *);

View file

@ -20,9 +20,9 @@ char cvsroot_tcl8_cxx[] = "$Header$";
static const char *usage = (char*)"\ static const char *usage = (char*)"\
Tcl 8 Options (available with -tcl)\n\ Tcl 8 Options (available with -tcl)\n\
-ldflags - Print runtime libraries to link with\n\ -ldflags - Print runtime libraries to link with\n\
-prefix name - Set a prefix to be appended to all names\n\ -prefix <name> - Set a prefix <name> to be prepended to all names\n\
-namespace - Build module into a Tcl 8 namespace. \n\ -namespace - Build module into a Tcl 8 namespace\n\
-pkgversion - Set package version.\n\n"; -pkgversion - Set package version\n\n";
static String *cmd_tab = 0; /* Table of command names */ static String *cmd_tab = 0; /* Table of command names */
static String *var_tab = 0; /* Table of global variables */ static String *var_tab = 0; /* Table of global variables */

View file

@ -13,9 +13,9 @@
char cvsroot_xml_cxx[] = "$Header$"; char cvsroot_xml_cxx[] = "$Header$";
static const char *usage = "\ static const char *usage = "\
XML Options (available with -xml)\n\ XML Options (available with -xml)\n\
-xmllang lang - Typedef language\n\ -xmllang <lang> - Typedef language\n\
------\n\ ------\n\
deprecated (use -o): -xml output.xml - Use output.xml as output file (extension .xml mandatory)\n"; deprecated (use -o): -xml <output.xml> - Use <output.xml> as output file (extension .xml mandatory)\n";
#include "swigmod.h" #include "swigmod.h"