diff options
Diffstat (limited to 'Source/Modules/mzscheme.cxx')
-rw-r--r-- | Source/Modules/mzscheme.cxx | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/Source/Modules/mzscheme.cxx b/Source/Modules/mzscheme.cxx index dd3aecc40..788681330 100644 --- a/Source/Modules/mzscheme.cxx +++ b/Source/Modules/mzscheme.cxx @@ -17,12 +17,10 @@ static const char *usage = "\ Mzscheme Options (available with -mzscheme)\n\ - -declaremodule - Create extension that declares a module\n\ - -dynamic-load <library>,[library,...] - Do not link with these libraries, dynamic load\n\ - them\n\ - -noinit - Do not emit scheme_initialize, scheme_reload,\n\ - scheme_module_name functions\n\ - -prefix <name> - Set a prefix <name> to be prepended to all names\n\ + -declaremodule - Create extension that declares a module\n\ + -dynamic-load <lib>,[lib,...] - Do not link with these libraries, dynamic load them\n\ + -noinit - Do not emit module initialization code\n\ + -prefix <name> - Set a prefix <name> to be prepended to all names\n\ "; static String *fieldnames_tab = 0; @@ -223,7 +221,6 @@ public: Wrapper *f = NewWrapper(); String *proc_name = NewString(""); - String *source = NewString(""); String *target = NewString(""); String *arg = NewString(""); String *cleanup = NewString(""); @@ -314,10 +311,9 @@ public: String *ln = Getattr(p, "lname"); // Produce names of source and target - Clear(source); Clear(target); Clear(arg); - Printf(source, "argv[%d]", i); + String *source = NewStringf("argv[%d]", i); Printf(target, "%s", ln); Printv(arg, Getattr(p, "name"), NIL); @@ -341,6 +337,7 @@ public: if (i >= numreq) { Printf(f->code, "}\n"); } + Delete(source); } /* Insert constraint checking code */ @@ -439,9 +436,8 @@ public: sprintf(temp, "%d", numargs); if (exporting_destructor) { Printf(init_func_def, "SWIG_TypeClientData(SWIGTYPE%s, (void *) %s);\n", swigtype_ptr, wname); - } else { - Printf(init_func_def, "scheme_add_global(\"%s\", scheme_make_prim_w_arity(%s,\"%s\",%d,%d),menv);\n", proc_name, wname, proc_name, numreq, numargs); } + Printf(init_func_def, "scheme_add_global(\"%s\", scheme_make_prim_w_arity(%s,\"%s\",%d,%d),menv);\n", proc_name, wname, proc_name, numreq, numargs); } else { if (!Getattr(n, "sym:nextSibling")) { /* Emit overloading dispatch function */ @@ -457,6 +453,7 @@ public: Printv(df->def, "static Scheme_Object *\n", dname, "(int argc, Scheme_Object **argv) {", NIL); Printv(df->code, dispatch, "\n", NIL); Printf(df->code, "scheme_signal_error(\"No matching function for overloaded '%s'\");\n", iname); + Printf(df->code, "return NULL;\n", iname); Printv(df->code, "}\n", NIL); Wrapper_print(df, f_wrappers); Printf(init_func_def, "scheme_add_global(\"%s\", scheme_make_prim_w_arity(%s,\"%s\",%d,%d),menv);\n", proc_name, dname, proc_name, 0, maxargs); @@ -467,7 +464,6 @@ public: } Delete(proc_name); - Delete(source); Delete(target); Delete(arg); Delete(outarg); @@ -528,7 +524,7 @@ public: Replaceall(tm, "$source", "argv[0]"); Replaceall(tm, "$target", name); Replaceall(tm, "$input", "argv[0]"); - /* Printv(f->code, tm, "\n",NIL); */ + Replaceall(tm, "$argnum", "1"); emit_action_code(n, f->code, tm); } else { throw_unhandled_mzscheme_type_error(t); @@ -765,7 +761,7 @@ public: /* ------------------------------------------------------------ - * validIdentifer() + * validIdentifier() * ------------------------------------------------------------ */ virtual int validIdentifier(String *s) { |