All languages now define a macro in the generated C/C++ wrapper file indicating which language is being wrapped, eg #define SWIGJAVA

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11018 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2008-12-30 00:38:34 +00:00
commit 5ec2d8c166
20 changed files with 72 additions and 9 deletions

View file

@ -1618,6 +1618,10 @@ int ALLEGROCL::top(Node *n) {
Swig_register_filebyname("lisphead", f_cl);
Swig_banner(f_runtime);
Printf(f_runtime, "#define SWIGALLEGROCL\n");
Printf(f_runtime, "\n");
Swig_banner_target_lang(f_cl, ";;");
Printf(f_cl, "\n"

View file

@ -162,6 +162,10 @@ int CFFI::top(Node *n) {
Swig_register_filebyname("swiglisp", f_null);
Swig_banner(f_runtime);
Printf(f_runtime, "#define SWIGCFFI\n");
Printf(f_runtime, "\n");
Swig_banner_target_lang(f_lisp, ";;;");
Language::top(n);

View file

@ -217,11 +217,13 @@ int CHICKEN::top(Node *n) {
Swig_banner(f_runtime);
Printf(f_runtime, "/* Implementation : CHICKEN */\n\n");
Printf(f_runtime, "#define SWIGCHICKEN\n");
if (no_collection)
Printf(f_runtime, "#define SWIG_CHICKEN_NO_COLLECTION 1\n");
Printf(f_runtime, "\n");
/* Set module name */
module = Swig_copy_string(Char(Getattr(n, "name")));
scmmodule = NewString(module);

View file

@ -360,6 +360,8 @@ public:
Swig_banner(f_runtime); // Print the SWIG banner message
Printf(f_runtime, "#define SWIGCSHARP\n");
if (directorsEnabled()) {
Printf(f_runtime, "#define SWIG_DIRECTORS\n");
@ -376,6 +378,8 @@ public:
Printf(f_directors, "#include \"%s\"\n\n", Swig_file_filename(outfile_h));
}
Printf(f_runtime, "\n");
Swig_name_register((char *) "wrapper", (char *) "CSharp_%f");
if (old_variable_names) {
Swig_name_register((char *) "set", (char *) "set_%v");

View file

@ -324,7 +324,7 @@ public:
Swig_banner(f_runtime);
Printf(f_runtime, "/* Implementation : GUILE */\n\n");
Printf(f_runtime, "#define SWIGGUILE\n");
if (!use_scm_interface) {
if (SwigRuntime == 1)
@ -357,6 +357,8 @@ public:
Printf(f_runtime, "\n}\n");
}
Printf(f_runtime, "\n");
Language::top(n);
/* Close module */

View file

@ -369,6 +369,8 @@ public:
Swig_banner(f_runtime); // Print the SWIG banner message
Printf(f_runtime, "#define SWIGJAVA\n");
if (directorsEnabled()) {
Printf(f_runtime, "#define SWIG_DIRECTORS\n");
@ -385,6 +387,8 @@ public:
Printf(f_directors, "#include \"%s\"\n\n", Swig_file_filename(outfile_h));
}
Printf(f_runtime, "\n");
String *wrapper_name = NewString("");
if (Len(package)) {

View file

@ -250,10 +250,15 @@ public:
/* Standard stuff for the SWIG runtime section */
Swig_banner(f_runtime);
Printf(f_runtime, "#define SWIGLUA\n");
// if (NoInclude) {
// Printf(f_runtime, "#define SWIG_NOINCLUDE\n");
// }
Printf(f_runtime, "\n");
//String *init_name = NewStringf("%(title)s_Init", module);
//Printf(f_header, "#define SWIG_init %s\n", init_name);
//Printf(f_header, "#define SWIG_name \"%s\"\n", module);

View file

@ -958,6 +958,9 @@ MODULA3():
Swig_banner(f_runtime); // Print the SWIG banner message
Printf(f_runtime, "#define SWIGMODULA3\n");
Printf(f_runtime, "\n");
Swig_name_register((char *) "wrapper", (char *) "Modula3_%f");
if (old_variable_names) {
Swig_name_register((char *) "set", (char *) "set_%v");

View file

@ -148,6 +148,9 @@ public:
Swig_banner(f_runtime);
Printf(f_runtime, "#define SWIGMZSCHEME\n");
Printf(f_runtime, "\n");
module = Getattr(n, "name");
Language::top(n);

View file

@ -264,6 +264,7 @@ public:
Swig_banner(f_runtime);
Printf(f_runtime, "#define SWIGOCAML\n");
Printf(f_runtime, "#define SWIG_MODULE \"%s\"\n", module);
/* Module name */
Printf(f_mlbody, "let module_name = \"%s\"\n", module);
@ -281,6 +282,8 @@ public:
Printf(f_runtime, "#define SWIG_DIRECTORS\n");
}
Printf(f_runtime, "\n");
/* Produce the enum_to_int and int_to_enum functions */
Printf(f_enumtypes_type, "open Swig\n" "type c_enum_type = [ \n `unknown\n");

View file

@ -111,10 +111,12 @@ public:
Swig_banner(f_runtime);
Printf(f_runtime, "#define SWIGOCTAVE\n");
Printf(f_runtime, "#define SWIG_name_d \"%s\"\n", module);
Printf(f_runtime, "#define SWIG_name %s\n", module);
if (directorsEnabled()) {
Printf(f_runtime, "#define SWIG_DIRECTORS\n");
Swig_banner(f_directors_h);
if (dirprot_mode()) {
// Printf(f_directors_h, "#include <map>\n");
@ -122,6 +124,7 @@ public:
}
}
Printf(f_runtime, "\n");
Printf(s_global_tab, "\nstatic const struct swig_octave_member swig_globals[] = {\n");
Printf(f_init, "static void SWIG_init_user(octave_swig_type* module_ns)\n{\n");

View file

@ -256,7 +256,7 @@ public:
Printf(f_runtime, "#define SWIGPERL\n");
Printf(f_runtime, "#define SWIG_CASTRANK_MODE\n");
Printf(f_runtime, "\n");
// Is the imported module in another package? (IOW, does it use the
// %module(package="name") option and it's different than the package

View file

@ -264,8 +264,6 @@ public:
SWIG_exit(EXIT_FAILURE);
}
Swig_banner(f_runtime);
/* sections of the output file */
s_init = NewString("/* init section */\n");
r_init = NewString("/* rinit section */\n");
@ -291,6 +289,11 @@ public:
Swig_register_filebyname("header", s_header);
Swig_register_filebyname("wrapper", s_wrappers);
Swig_banner(f_runtime);
Printf(f_runtime, "#define SWIGPHP\n");
Printf(f_runtime, "\n");
/* Set the module name */
module = Copy(Getattr(n, "name"));
cap_module = NewStringf("%(upper)s", module);

View file

@ -143,6 +143,9 @@ public:
/* Standard stuff for the SWIG runtime section */
Swig_banner(f_runtime);
Printf(f_runtime, "#define SWIGPIKE\n");
Printf(f_runtime, "\n");
Printf(f_header, "#define SWIG_init pike_module_init\n");
Printf(f_header, "#define SWIG_name \"%s\"\n\n", module);

View file

@ -601,6 +601,8 @@ public:
Printf(f_runtime, "#define SWIG_PYTHON_CLASSIC\n");
}
Printf(f_runtime, "\n");
Printf(f_header, "#if (PY_VERSION_HEX <= 0x02000000)\n");
Printf(f_header, "# if !defined(SWIG_PYTHON_CLASSIC)\n");
Printf(f_header, "# error \"This python version requires swig to be run with the '-classic' option\"\n");

View file

@ -816,9 +816,14 @@ int R::top(Node *n) {
Swig_register_filebyname("header", s_header);
Swig_register_filebyname("wrapper", f_wrapper);
Swig_register_filebyname("s", sfile);
Swig_register_filebyname("sclasses", s_classes);
Swig_banner(f_runtime);
Printf(f_runtime, "#define SWIGR\n");
Printf(f_runtime, "\n");
Swig_banner_target_lang(s_init, "#");
outputCommandLineArguments(s_init);
@ -898,9 +903,6 @@ int R::DumpCode(Node *n) {
SWIG_exit(EXIT_FAILURE);
}
Swig_banner(runtime);
Printf(runtime, "/* Runtime */\n");
Printf(runtime, "%s\n", f_runtime);

View file

@ -1043,6 +1043,8 @@ public:
Printf(f_runtime, "#define SWIG_DIRECTORS\n");
}
Printf(f_runtime, "\n");
/* typedef void *VALUE */
SwigType *value = NewSwigType(T_VOID);
SwigType_add_pointer(value);

View file

@ -160,6 +160,9 @@ public:
Swig_banner(f_runtime);
Printf(f_runtime, "#define SWIGTCL\n");
Printf(f_runtime, "\n");
/* Set the module name, namespace, and prefix */
module = NewStringf("%(lower)s", Getattr(n, "name"));