- Improve the runtime type sytesm

- Update all languages to new type system
- Add DohSortList function
- Fix mzscheme Examples/Makefile


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6930 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
John Lenz 2005-02-01 00:08:24 +00:00
commit c3338b1a16
48 changed files with 1383 additions and 1021 deletions

View file

@ -377,12 +377,12 @@ public:
/* Simple linkage; we have to export the SWIG_init function. The user can
rename the function by a #define. */
Printf (f_runtime, "extern void\nSWIG_init (void)\n;\n");
Printf (f_init, "extern void\nSWIG_init (void)\n{\n");
Printf (f_init, "#define SWIG_GUILE_INIT_STATIC static\n");
break;
default:
/* Other linkage; we make the SWIG_init function static */
Printf (f_runtime, "static void\nSWIG_init (void)\n;\n");
Printf (f_init, "static void\nSWIG_init (void)\n{\n");
Printf (f_init, "#define SWIG_GUILE_INIT_STATIC extern\n");
break;
}
if (CPlusPlus) {

View file

@ -155,30 +155,28 @@ public:
SwigType_emit_type_table (f_runtime, f_wrappers);
if (!noinit) {
Printf(f_init, "Scheme_Object *scheme_reload(Scheme_Env *env) {\n");
if (declaremodule) {
Printf(f_init, "\tScheme_Env *menv = scheme_primitive_module(scheme_intern_symbol(\"%s\"), env);\n", module);
}
else {
Printf(f_init, "\tScheme_Env *menv = env;\n");
}
Printf(f_init, "%s\n", Char(init_func_def));
if (declaremodule) {
Printf(f_init, "\tscheme_finish_primitive_module(menv);\n");
}
Printf (f_init, "\treturn scheme_void;\n}\n");
Printf(f_init, "Scheme_Object *scheme_initialize(Scheme_Env *env) {\n");
Printf(f_init, "\treturn scheme_reload(env);\n");
Printf (f_init, "}\n");
if (declaremodule) {
Printf(f_init, "#define SWIG_MZSCHEME_CREATE_MENV(env) scheme_primitive_module(scheme_intern_symbol(\"%s\"), env)\n", module);
}
else {
Printf(f_init,"#define SWIG_MZSCHEME_CREATE_MENV(env) (env)\n");
}
Printf(f_init, "%s\n", Char(init_func_def));
if (declaremodule) {
Printf(f_init, "\tscheme_finish_primitive_module(menv);\n");
}
Printf (f_init, "\treturn scheme_void;\n}\n");
Printf(f_init, "Scheme_Object *scheme_initialize(Scheme_Env *env) {\n");
Printf(f_init, "\treturn scheme_reload(env);\n");
Printf (f_init, "}\n");
Printf(f_init,"Scheme_Object *scheme_module_name(void) {\n");
if (declaremodule) {
Printf(f_init, " return scheme_intern_symbol((char*)\"%s\");\n", module);
}
else {
Printf(f_init," return scheme_make_symbol((char*)\"%s\");\n", module);
}
Printf(f_init,"}\n");
Printf(f_init,"Scheme_Object *scheme_module_name(void) {\n");
if (declaremodule) {
Printf(f_init, " return scheme_intern_symbol((char*)\"%s\");\n", module);
} else {
Printf(f_init," return scheme_make_symbol((char*)\"%s\");\n", module);
}
Printf(f_init,"}\n");
}
/* Close all of the files */

View file

@ -337,7 +337,7 @@ public:
Printf( f_mlibody,
"val int_to_enum : c_enum_type -> int -> c_obj\n" );
Printf( f_init,
"SWIGEXT void f_%s_init() {\n"
"#define SWIG_init f_%s_init\n"
"%s"
"}\n",
module, init_func_def );

View file

@ -733,12 +733,8 @@ public:
* things are being called in the wrong order
*/
Printf(s_init,"PHP_MINIT_FUNCTION(%s)\n{\n", module);
Printf(s_init,
" int i;\n"
" for (i = 0; swig_types_initial[i]; i++) {\n"
" swig_types[i] = SWIG_TypeRegister(swig_types_initial[i]);\n"
" }\n");
Printf(s_init,"#define SWIG_php_minit PHP_MINIT_FUNCTION(%s)\n", module);
/* Emit all of the code */
Language::top(n);

View file

@ -147,6 +147,7 @@ private:
File *f_header;
File *f_wrappers;
File *f_init;
File *f_initbeforefunc;
bool useGlobalModule;
bool multipleInheritance;
@ -185,6 +186,7 @@ public:
f_header = 0;
f_wrappers = 0;
f_init = 0;
f_initbeforefunc = 0;
useGlobalModule = false;
multipleInheritance = false;
director_prot_ctor_code = NewString("");
@ -391,6 +393,7 @@ public:
f_wrappers = NewString("");
f_directors_h = NewString("");
f_directors = NewString("");
f_initbeforefunc = NewString("");
/* Register file targets with the SWIG file handler */
Swig_register_filebyname("header",f_header);
@ -399,6 +402,7 @@ public:
Swig_register_filebyname("init",f_init);
Swig_register_filebyname("director",f_directors);
Swig_register_filebyname("director_h",f_directors_h);
Swig_register_filebyname("initbeforefunc", f_initbeforefunc);
modvar = 0;
current = NO_CPP;
@ -457,9 +461,9 @@ public:
Printv(f_init,
"\n",
"for (i = 0; swig_types_initial[i]; i++) {\n",
"swig_types[i] = SWIG_TypeRegister(swig_types_initial[i]);\n",
"SWIG_define_class(swig_types[i]);\n",
"SWIG_InitializeModule(0);\n",
"for (i = 0; i < swig_module.size; i++) {\n",
"SWIG_define_class(swig_module.types[i]);\n",
"}\n",
NIL);
Printf(f_init,"\n");
@ -482,11 +486,13 @@ public:
}
Dump(f_wrappers,f_runtime);
Dump(f_initbeforefunc, f_runtime);
Wrapper_pretty_print(f_init,f_runtime);
Delete(f_header);
Delete(f_wrappers);
Delete(f_init);
Delete(f_initbeforefunc);
Close(f_runtime);
Delete(f_runtime);

View file

@ -896,7 +896,7 @@ public:
Delete(base_class);
Delete(base_class_names);
Printv(f_wrappers, "swig_class _wrap_class_", mangled_classname, " = { \"", class_name,
Printv(f_wrappers, "static swig_class _wrap_class_", mangled_classname, " = { \"", class_name,
"\", &SWIGTYPE", SwigType_manglestr(t), ",",NIL);
if (have_constructor) {
@ -912,7 +912,7 @@ public:
Printf(f_wrappers,",0");
}
Printv(f_wrappers, ", swig_", mangled_classname, "_methods, swig_", mangled_classname, "_attributes, swig_", mangled_classname,"_bases,",
"swig_", mangled_classname, "_base_names };\n", NIL);
"swig_", mangled_classname, "_base_names, &swig_module };\n", NIL);
if( !itcl ) {
Printv(cmd_tab, tab4, "{ SWIG_prefix \"", class_name, "\", (swig_wrapper_func) SWIG_ObjectConstructor, &_wrap_class_", mangled_classname, "},\n", NIL);