diff options
author | Olly Betts <olly@survex.com> | 2015-01-08 10:54:37 +1300 |
---|---|---|
committer | Olly Betts <olly@survex.com> | 2015-01-08 10:54:37 +1300 |
commit | cd16059c667aa952d79a5b70a0a6ac9a7d5fdc0d (patch) | |
tree | 29ca6a8662a4d034d4adaa4667ff73a159cce19e | |
parent | 0acebe2289a33c2e039912a7985f54ae3f5436f1 (diff) | |
download | swig-cd16059c667aa952d79a5b70a0a6ac9a7d5fdc0d.tar.gz |
Provide -cppext as a general command line option
Provide -cppext as a general command line option for setting the
extension used for generated C++ files (previously it was specific
to the PHP backend). Deprecate the equivalent -suffix option
provided by the Ocaml backend, but continue to support that for
now.
-rw-r--r-- | CHANGES.current | 6 | ||||
-rw-r--r-- | Doc/Manual/SWIG.html | 1 | ||||
-rw-r--r-- | Source/Modules/main.cxx | 11 | ||||
-rw-r--r-- | Source/Modules/ocaml.cxx | 3 | ||||
-rw-r--r-- | Source/Modules/php.cxx | 10 |
5 files changed, 20 insertions, 11 deletions
diff --git a/CHANGES.current b/CHANGES.current index dd10b0f2b..a5b700cf4 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -5,3 +5,9 @@ See the RELEASENOTES file for a summary of changes in each release. Version 3.0.4 (in progress) =========================== +2015-01-08: olly + Provide -cppext as a general command line option for setting the + extension used for generated C++ files (previously it was specific + to the PHP backend). Deprecate the equivalent -suffix option + provided by the Ocaml backend, but continue to support that for + now. diff --git a/Doc/Manual/SWIG.html b/Doc/Manual/SWIG.html index e70280a08..1652df3c0 100644 --- a/Doc/Manual/SWIG.html +++ b/Doc/Manual/SWIG.html @@ -138,6 +138,7 @@ can be obtained by typing <tt>swig -help</tt> or <tt>swig -xml Generate XML wrappers -c++ Enable C++ parsing +-cppext <em>ext</em> Change file extension of C++ generated files to <em>ext</em> (default is cxx, except for PHP which uses cpp) -D<em>symbol</em> Define a preprocessor symbol -Fstandard Display error/warning messages in commonly used format -Fmicrosoft Display error/warning messages in Microsoft format diff --git a/Source/Modules/main.cxx b/Source/Modules/main.cxx index d1465947f..aa0d7d589 100644 --- a/Source/Modules/main.cxx +++ b/Source/Modules/main.cxx @@ -63,6 +63,8 @@ static const char *usage1 = (const char *) "\ -co <file> - Check <file> out of the SWIG library\n\ -copyctor - Automatically generate copy constructors wherever possible\n\ -cpperraswarn - Treat the preprocessor #error statement as #warning (default)\n\ + -cppext <ext> - Change file extension of generated C++ files to <ext>\n\ + (default is cxx, except for PHP which uses cpp)\n\ -copyright - Display copyright notices\n\ -debug-classes - Display information about the classes found in the interface\n\ -debug-module <n>- Display module parse tree at stages 1-4, <n> is a csv list of stages\n\ @@ -681,6 +683,15 @@ void SWIG_getoptions(int argc, char *argv[]) { } else if (strcmp(argv[i], "-nocpperraswarn") == 0) { Preprocessor_error_as_warning(0); Swig_mark_arg(i); + } else if (strcmp(argv[i], "-cppext") == 0) { + Swig_mark_arg(i); + if (argv[i + 1]) { + SWIG_config_cppext(argv[i + 1]); + Swig_mark_arg(i + 1); + i++; + } else { + Swig_arg_error(); + } } else if ((strcmp(argv[i], "-debug-typemap") == 0) || (strcmp(argv[i], "-debug_typemap") == 0) || (strcmp(argv[i], "-tm_debug") == 0)) { tm_debug = 1; Swig_mark_arg(i); diff --git a/Source/Modules/ocaml.cxx b/Source/Modules/ocaml.cxx index f3d63a6dc..ac73c1f0c 100644 --- a/Source/Modules/ocaml.cxx +++ b/Source/Modules/ocaml.cxx @@ -19,7 +19,7 @@ static const char *usage = "\ Ocaml Options (available with -ocaml)\n\ -oldvarnames - Old intermediary method names for variable wrappers\n\ -prefix <name> - Set a prefix <name> to be prepended to all names\n\ - -suffix <name> - Change .cxx to something else\n\ + -suffix <name> - Deprecated alias for general option -cppext\n\ -where - Emit library location\n\ \n"; @@ -114,6 +114,7 @@ public: } } else if (strcmp(argv[i], "-suffix") == 0) { if (argv[i + 1]) { + Printf(stderr, "swig: warning: -suffix option deprecated. SWIG 3.0.4 and later provide a -cppext option which should be used instead.\n"); SWIG_config_cppext(argv[i + 1]); Swig_mark_arg(i); Swig_mark_arg(i + 1); diff --git a/Source/Modules/php.cxx b/Source/Modules/php.cxx index b09dd09aa..efeb4dcc4 100644 --- a/Source/Modules/php.cxx +++ b/Source/Modules/php.cxx @@ -44,7 +44,6 @@ static const char *usage = "\ PHP Options (available with -php)\n\ - -cppext <ext> - Change C++ file extension to <ext> (default is cpp)\n\ -noproxy - Don't generate proxy classes.\n\ -prefix <prefix> - Prepend <prefix> to all class names in PHP wrappers\n\ \n"; @@ -221,15 +220,6 @@ public: } else { Swig_arg_error(); } - } else if (strcmp(argv[i], "-cppext") == 0) { - if (argv[i + 1]) { - SWIG_config_cppext(argv[i + 1]); - Swig_mark_arg(i); - Swig_mark_arg(i + 1); - i++; - } else { - Swig_arg_error(); - } } else if ((strcmp(argv[i], "-noshadow") == 0) || (strcmp(argv[i], "-noproxy") == 0)) { shadow = 0; Swig_mark_arg(i); |