Revert rev 11187 "Merged with recent changes from trunk."
This reverts commit c595e4d90ebfd63eb55430c735bb121cf690bd59. Conflicts: Source/Modules/c.cxx From: William S Fulton <wsf@fultondesigns.co.uk> git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-maciekd@13033 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
34a628c7c7
commit
d6b81eb831
703 changed files with 9266 additions and 21128 deletions
|
|
@ -21,8 +21,7 @@ char cvsroot_allegrocl_cxx[] = "$Id$";
|
|||
static File *f_cl = 0;
|
||||
String *f_clhead = NewString("");
|
||||
String *f_clwrap = NewString("(swig-in-package ())\n\n");
|
||||
static File *f_begin;
|
||||
static File *f_runtime;
|
||||
static File *f_cxx;
|
||||
static File *f_cxx_header = 0;
|
||||
static File *f_cxx_wrapper = 0;
|
||||
|
||||
|
|
@ -35,8 +34,6 @@ static bool CWrap = true; // generate wrapper file for C code by default. most c
|
|||
static bool Generate_Wrapper = false;
|
||||
static bool unique_swig_package = false;
|
||||
|
||||
static SwigType *fwdref_ffi_type = NewString("__SWIGACL_FwdReference");
|
||||
|
||||
static String *current_namespace = NewString("");
|
||||
static String *current_package = NewString("");
|
||||
static Hash *defined_namespace_packages = NewHash();
|
||||
|
|
@ -171,7 +168,6 @@ static String *namespace_of(String *str) {
|
|||
void add_linked_type(Node *n) {
|
||||
#ifdef ALLEGROCL_CLASS_DEBUG
|
||||
Printf(stderr, "Adding linked node of type: %s(%s) %s(%x)\n\n", nodeType(n), Getattr(n, "storage"), Getattr(n, "name"), n);
|
||||
// Swig_print_node(n);
|
||||
#endif
|
||||
if (!first_linked_type) {
|
||||
first_linked_type = n;
|
||||
|
|
@ -301,8 +297,7 @@ void add_forward_referenced_type(Node *n, int overwrite = 0) {
|
|||
}
|
||||
}
|
||||
|
||||
void add_defined_foreign_type(Node *n, int overwrite = 0, String *k = 0,
|
||||
String *name = 0, String *ns = current_namespace) {
|
||||
void add_defined_foreign_type(Node *n, int overwrite = 0, String *k = 0, String *name = 0, String *ns = current_namespace) {
|
||||
|
||||
String *val;
|
||||
String *ns_list = listify_namespace(ns);
|
||||
|
|
@ -326,34 +321,22 @@ void add_defined_foreign_type(Node *n, int overwrite = 0, String *k = 0,
|
|||
/*
|
||||
For typedefs of the form:
|
||||
|
||||
typedef struct __xxx { ... } xxx;
|
||||
typedef __xxx { ... } xxx;
|
||||
|
||||
behavior differs between C mode and C++ mode.
|
||||
|
||||
C Mode:
|
||||
add_defined_foreign_type will be called once via classHandler
|
||||
to define the type for 'struct __xxx' and add the mapping from
|
||||
'struct __xxx' -> 'xxx'
|
||||
to define the type for 'struct __xxx', and once via typedefHandler
|
||||
to associate xxx with 'struct __xxx'.
|
||||
|
||||
It will also be called once via typedefHandler to add the
|
||||
mapping 'xxx' -> 'xxx'
|
||||
We create the following type to identifier mappings:
|
||||
|
||||
C++ Mode:
|
||||
add_defined_foreign_type will be called once via classHandler
|
||||
to define the type for 'xxx'. it also adds the mapping from
|
||||
'xxx' -> 'xxx' and also for 'struct xxx' -> 'xxx'
|
||||
struct __xxx -> (swig-insert-id "xxx") via classHand
|
||||
xxx -> (swig-insert-id "xxx") via typedefHand
|
||||
|
||||
In typedefHandler, we again try to add the mapping from
|
||||
'xxx' -> 'xxx', which already exists. This second mapping
|
||||
is ignored.
|
||||
and all references to this typedef'd struct will appear in
|
||||
generated code as 'xxx'. For non-typedef'd structs, the
|
||||
classHand mapping will be
|
||||
|
||||
Both modes:
|
||||
|
||||
All references to this typedef'd struct will appear in
|
||||
generated lisp code as an objectd of type 'xxx'. For
|
||||
non-typedef'd structs, the classHand mapping will be
|
||||
|
||||
struct __xxx -> (swig-insert-id "__xxx")
|
||||
struct __xxx -> (swig-insert-id "__xxx")
|
||||
*/
|
||||
// Swig_print_node(n);
|
||||
String *unnamed = Getattr(n, "unnamed");
|
||||
|
|
@ -602,11 +585,7 @@ void add_defined_foreign_type(Node *n, int overwrite = 0, String *k = 0,
|
|||
Delete(mangled_name_gen);
|
||||
Delete(mangled_lname_gen);
|
||||
} else {
|
||||
if (!CPlusPlus || Strcmp(Getattr(n,"kind"),"typedef")) {
|
||||
Swig_warning(WARN_TYPE_REDEFINED, Getfile(n), Getline(n),
|
||||
"Attempting to store a foreign type that exists: %s (%s)\n",
|
||||
k, val);
|
||||
}
|
||||
Swig_warning(WARN_TYPE_REDEFINED, Getfile(n), Getline(n), "Attempting to store a foreign type that exists: %s (%s)\n", k, val);
|
||||
}
|
||||
|
||||
Delete(ns_list);
|
||||
|
|
@ -626,7 +605,7 @@ void note_implicit_template_instantiation(SwigType *t) {
|
|||
add_defined_foreign_type(0, 0, t, t, implicit_ns ? implicit_ns : current_namespace);
|
||||
}
|
||||
|
||||
String *get_ffi_type(SwigType *ty, const_String_or_char_ptr name) {
|
||||
String *get_ffi_type(SwigType *ty, const String_or_char *name) {
|
||||
/* lookup defined foreign type.
|
||||
if it exists, it will return a form suitable for placing
|
||||
into lisp code to generate the def-foreign-type name */
|
||||
|
|
@ -641,8 +620,7 @@ String *get_ffi_type(SwigType *ty, const_String_or_char_ptr name) {
|
|||
#ifdef ALLEGROCL_TYPE_DEBUG
|
||||
Printf(stderr, "found_type '%s'\n", found_type);
|
||||
#endif
|
||||
return (Strcmp(found_type, "forward-reference") ? Copy(found_type) :
|
||||
get_ffi_type(fwdref_ffi_type, ""));
|
||||
return (Strcmp(found_type, "forward-reference") ? Copy(found_type) : NewString(":void"));
|
||||
} else {
|
||||
Hash *typemap = Swig_typemap_search("ffitype", ty, name, 0);
|
||||
|
||||
|
|
@ -729,39 +707,25 @@ String *internal_compose_foreign_type(SwigType *ty) {
|
|||
if (res)
|
||||
Printf(ffiType, "%s", res);
|
||||
}
|
||||
|
||||
// while(resolved_type) {
|
||||
// // the resolved_type may expand into something like p.NS1::NS2::SomeType
|
||||
// // for which get_ffi_type will not find any match (due to the p.).
|
||||
// // Printf(stderr, "\n in resolved type loop on '%s'\n", resolved_type);
|
||||
// res = get_ffi_type(resolved_type, "");
|
||||
// if (res) {
|
||||
// Printf(ffiType, "%s", res);
|
||||
// break;
|
||||
// } else {
|
||||
// resolved_type = SwigType_typedef_resolve(resolved_type);
|
||||
// }
|
||||
// }
|
||||
if (!res) {
|
||||
String *is_struct = 0;
|
||||
String *tok_remove_text = 0;
|
||||
String *tok_name = Copy(tok);
|
||||
String *tok_key = SwigType_str(tok,0);
|
||||
if ((is_struct = Strstr(tok_key, "struct ")) || Strstr(tok_key, "union ")) {
|
||||
tok_remove_text = NewString(is_struct ? "struct " : "union ");
|
||||
if (Strstr(tok, "struct ")) {
|
||||
Swig_warning(WARN_TYPE_UNDEFINED_CLASS, Getfile(tok), Getline(tok), "Unable to find definition of '%s', assuming forward reference.\n", tok);
|
||||
} else {
|
||||
Printf(stderr, "Unable to compose foreign type of: '%s'\n", tok);
|
||||
}
|
||||
|
||||
/* be more permissive of opaque types. This is the swig way.
|
||||
compiles will notice if these types are ultimately not
|
||||
present. */
|
||||
|
||||
if(tok_remove_text) {
|
||||
Replaceall(tok_name,tok_remove_text,"");
|
||||
}
|
||||
tok_name = strip_namespaces(tok_name);
|
||||
Delete(tok_remove_text);
|
||||
// Swig_warning(WARN_TYPE_UNDEFINED_CLASS, Getfile(tok), Getline(tok), "Unable to find definition of '%s', assuming forward reference.\n", tok);
|
||||
|
||||
#ifdef ALLEGROCL_TYPE_DEBUG
|
||||
Printf(stderr, "i-c-f-t: adding forward reference for unknown type '%s'. mapping: %s -> %s\n", tok, tok_key, tok_name);
|
||||
#endif
|
||||
Node *nn = NewHash();
|
||||
Setattr(nn,"nodeType","classforward");
|
||||
Setattr(nn,"kind","class");
|
||||
Setattr(nn,"sym:name",tok_name);
|
||||
Setattr(nn,"name",tok_key);
|
||||
Setattr(nn,"allegrocl:package",current_namespace);
|
||||
|
||||
add_forward_referenced_type(nn, 0);
|
||||
Printf(ffiType, "%s", get_ffi_type(tok, ""), tok_name);
|
||||
Printf(ffiType, "(* :void)");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -769,36 +733,24 @@ String *internal_compose_foreign_type(SwigType *ty) {
|
|||
return ffiType;
|
||||
}
|
||||
|
||||
String *compose_foreign_type(SwigType *ty, String * /*id*/ = 0) {
|
||||
|
||||
/* Hash *lookup_res = Swig_typemap_search("ffitype", ty, id, 0); */
|
||||
String *compose_foreign_type(SwigType *ty, String *id = 0) {
|
||||
|
||||
Hash *lookup_res = Swig_typemap_search("ffitype", ty, id, 0);
|
||||
#ifdef ALLEGROCL_TYPE_DEBUG
|
||||
Printf(stderr, "compose_foreign_type: ENTER (%s)...\n ", ty);
|
||||
// Printf(stderr, "compose_foreign_type: ENTER (%s)(%s)...\n ", ty, (id ? id : 0));
|
||||
/* String *id_ref = SwigType_str(ty, id);
|
||||
String *id_ref = SwigType_str(ty, id);
|
||||
Printf(stderr, "looking up typemap for %s, found '%s'(%x)\n",
|
||||
id_ref, lookup_res ? Getattr(lookup_res, "code") : 0, lookup_res);
|
||||
if (lookup_res) Swig_print_node(lookup_res);
|
||||
*/
|
||||
#endif
|
||||
|
||||
/* should we allow named lookups in the typemap here? YES! */
|
||||
/* unnamed lookups should be found in get_ffi_type, called
|
||||
by internal_compose_foreign_type(), below. */
|
||||
|
||||
/* I'm reverting to 'no' for the question above. I can no longer
|
||||
remember why I needed it. If a user needed it, I'll find out
|
||||
as soon as they upgrade. Sigh. -mutandiz 9/16/2008. */
|
||||
|
||||
/*
|
||||
if(id && lookup_res) {
|
||||
#ifdef ALLEGROCL_TYPE_DEBUG
|
||||
Printf(stderr, "compose_foreign_type: EXIT-1 (%s)\n ", Getattr(lookup_res, "code"));
|
||||
#endif
|
||||
return NewString(Getattr(lookup_res, "code"));
|
||||
}
|
||||
*/
|
||||
|
||||
SwigType *temp = SwigType_strip_qualifiers(ty);
|
||||
String *res = internal_compose_foreign_type(temp);
|
||||
|
|
@ -876,10 +828,6 @@ String *strip_parens(String *string) {
|
|||
}
|
||||
|
||||
int ALLEGROCL::validIdentifier(String *s) {
|
||||
#ifdef ALLEGROCL_DEBUG
|
||||
Printf(stderr, "validIdentifier %s\n", s);
|
||||
#endif
|
||||
|
||||
char *c = Char(s);
|
||||
|
||||
bool got_dot = false;
|
||||
|
|
@ -1006,7 +954,6 @@ String *convert_literal(String *literal, String *type, bool try_to_split) {
|
|||
Delete(num);
|
||||
num = 0;
|
||||
}
|
||||
Delete(lisp_exp);
|
||||
} else {
|
||||
String *id = NewStringf("#.(swig-insert-id \"%s\" %s :type :constant)",
|
||||
num, ns);
|
||||
|
|
@ -1137,8 +1084,7 @@ void emit_synonym(Node *synonym) {
|
|||
of_ltype = lookup_defined_foreign_ltype(of_name);
|
||||
|
||||
// Printf(f_clhead,";; from emit-synonym\n");
|
||||
if( of_ltype )
|
||||
Printf(f_clhead, "(swig-def-synonym-type %s\n %s\n %s)\n", syn_ltype, of_ltype, syn_type);
|
||||
Printf(f_clhead, "(swig-def-synonym-type %s\n %s\n %s)\n", syn_ltype, of_ltype, syn_type);
|
||||
|
||||
Delete(synonym_ns);
|
||||
Delete(of_ns_list);
|
||||
|
|
@ -1338,6 +1284,7 @@ void emit_typedef(Node *n) {
|
|||
|
||||
// leave these in for now. might want to change these to def-foreign-class at some point.
|
||||
// Printf(f_clhead, ";; %s\n", SwigType_typedef_resolve_all(lisp_type));
|
||||
// Swig_print_node(n);
|
||||
Printf(f_clhead, "(swig-def-foreign-type \"%s\"\n %s)\n", name, lisp_type);
|
||||
|
||||
Delete(name);
|
||||
|
|
@ -1521,7 +1468,6 @@ extern "C" Language *swig_allegrocl(void) {
|
|||
void ALLEGROCL::main(int argc, char *argv[]) {
|
||||
int i;
|
||||
|
||||
Preprocessor_define("SWIGALLEGROCL 1", 0);
|
||||
SWIG_library_directory("allegrocl");
|
||||
SWIG_config_file("allegrocl.swg");
|
||||
|
||||
|
|
@ -1569,10 +1515,7 @@ void ALLEGROCL::main(int argc, char *argv[]) {
|
|||
"\tcalled to convert identifiers to symbols.\n"
|
||||
"\n"
|
||||
" -[no]cwrap\n"
|
||||
"\tTurn on or turn off generation of an intermediate C file when\n" "\tcreating a C interface. By default this is only done for C++ code.\n"
|
||||
" -isolate\n"
|
||||
"Define all SWIG helper functions in a package unique to this module. Avoids redefinition warnings when loading multiple SWIGged modules\n"
|
||||
"into the same running Allegro CL image.\n");
|
||||
"\tTurn on or turn off generation of an intermediate C file when\n" "\tcreating a C interface. By default this is only done for C++ code.\n");
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -1588,9 +1531,9 @@ int ALLEGROCL::top(Node *n) {
|
|||
|
||||
swig_package = unique_swig_package ? NewStringf("swig.%s", module_name) : NewString("swig");
|
||||
|
||||
Printf(cl_filename, "%s%s.cl", SWIG_output_directory(), module_name);
|
||||
Printf(cl_filename, "%s%s.cl", SWIG_output_directory(), Swig_file_basename(Getattr(n,"infile")));
|
||||
|
||||
f_cl = NewFile(cl_filename, "w", SWIG_output_files());
|
||||
f_cl = NewFile(cl_filename, "w");
|
||||
if (!f_cl) {
|
||||
Printf(stderr, "Unable to open %s for writing\n", cl_filename);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
|
|
@ -1599,42 +1542,33 @@ int ALLEGROCL::top(Node *n) {
|
|||
Generate_Wrapper = CPlusPlus || CWrap;
|
||||
|
||||
if (Generate_Wrapper) {
|
||||
f_begin = NewFile(cxx_filename, "w", SWIG_output_files());
|
||||
if (!f_begin) {
|
||||
f_cxx = NewFile(cxx_filename, "w");
|
||||
if (!f_cxx) {
|
||||
Close(f_cl);
|
||||
Delete(f_cl);
|
||||
Printf(stderr, "Unable to open %s for writing\n", cxx_filename);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
} else
|
||||
f_begin = NewString("");
|
||||
f_cxx = NewString("");
|
||||
|
||||
f_runtime = NewString("");
|
||||
f_cxx_header = f_runtime;
|
||||
f_cxx_header = f_cxx;
|
||||
f_cxx_wrapper = NewString("");
|
||||
|
||||
Swig_register_filebyname("header", f_cxx_header);
|
||||
Swig_register_filebyname("wrapper", f_cxx_wrapper);
|
||||
Swig_register_filebyname("begin", f_begin);
|
||||
Swig_register_filebyname("runtime", f_runtime);
|
||||
Swig_register_filebyname("runtime", f_cxx);
|
||||
Swig_register_filebyname("lisp", f_clwrap);
|
||||
Swig_register_filebyname("lisphead", f_cl);
|
||||
|
||||
Swig_banner(f_begin);
|
||||
|
||||
Printf(f_runtime, "\n");
|
||||
Printf(f_runtime, "#define SWIGALLEGROCL\n");
|
||||
Printf(f_runtime, "\n");
|
||||
|
||||
Swig_banner_target_lang(f_cl, ";;");
|
||||
|
||||
Printf(f_cl, "\n"
|
||||
Printf(f_cl, ";; This is an automatically generated file. Make changes in\n"
|
||||
";; the definition file, not here.\n\n"
|
||||
"(defpackage :%s\n"
|
||||
" (:use :common-lisp :ff :excl)\n"
|
||||
" (:export #:*swig-identifier-converter* #:*swig-module-name*\n"
|
||||
" #:*void* #:*swig-export-list*))\n"
|
||||
"(in-package :%s)\n\n"
|
||||
"(eval-when (:compile-toplevel :load-toplevel :execute)\n"
|
||||
"(eval-when (compile load eval)\n"
|
||||
" (defparameter *swig-identifier-converter* '%s)\n"
|
||||
" (defparameter *swig-module-name* :%s))\n\n", swig_package, swig_package, identifier_converter, module_name);
|
||||
Printf(f_cl, "(defpackage :%s\n" " (:use :common-lisp :%s :ff :excl))\n\n", module_name, swig_package);
|
||||
|
|
@ -1645,7 +1579,7 @@ int ALLEGROCL::top(Node *n) {
|
|||
|
||||
Language::top(n);
|
||||
|
||||
// SwigType_emit_type_table(f_runtime,f_cxx_wrapper);
|
||||
// SwigType_emit_type_table(f_cxx,f_cxx_wrapper);
|
||||
|
||||
// Swig_print_tree(n);
|
||||
#ifdef ALLEGROCL_TYPE_DEBUG
|
||||
|
|
@ -1668,12 +1602,8 @@ int ALLEGROCL::top(Node *n) {
|
|||
Delete(f_clhead);
|
||||
Delete(f_clwrap);
|
||||
|
||||
Dump(f_runtime, f_begin);
|
||||
Printf(f_begin, "%s\n", f_cxx_wrapper);
|
||||
|
||||
Close(f_begin);
|
||||
Delete(f_runtime);
|
||||
Delete(f_begin);
|
||||
Close(f_cxx);
|
||||
Delete(f_cxx);
|
||||
Delete(f_cxx_wrapper);
|
||||
|
||||
// Swig_print_tree(n);
|
||||
|
|
@ -1968,7 +1898,7 @@ int any_varargs(ParmList *pl) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
String *get_lisp_type(SwigType *ty, const_String_or_char_ptr name) {
|
||||
String *get_lisp_type(SwigType *ty, const String_or_char *name) {
|
||||
Hash *typemap = Swig_typemap_search("lisptype", ty, name, 0);
|
||||
if (typemap) {
|
||||
String *typespec = Getattr(typemap, "code");
|
||||
|
|
@ -2154,9 +2084,7 @@ struct IDargs {
|
|||
String *arity;
|
||||
|
||||
IDargs():name(0), type(0), klass(0), arity(0) {
|
||||
}
|
||||
|
||||
String *full_quoted_str() {
|
||||
} String *full_quoted_str() {
|
||||
String *result = no_others_quoted_str();
|
||||
if (arity)
|
||||
Printf(result, " :arity %s", arity);
|
||||
|
|
@ -2407,24 +2335,41 @@ int ALLEGROCL::emit_defun(Node *n, File *fcl) {
|
|||
for (p = pl; p; p = nextSibling(p), argnum++, largnum++) {
|
||||
// SwigType *argtype=Getattr(p, "type");
|
||||
SwigType *argtype = Swig_cparse_type(Getattr(p, "tmap:ctype"));
|
||||
SwigType *parmtype = Getattr(p,"type");
|
||||
|
||||
if (!first) {
|
||||
Printf(fcl, "\n ");
|
||||
}
|
||||
|
||||
/* by default, skip varargs */
|
||||
if (!SwigType_isvarargs(parmtype)) {
|
||||
if (SwigType_isvarargs(argtype)) {
|
||||
Printf(stderr, "Function %s (line %d) contains varargs, which is not directly supported. Use %%varargs instead.\n", Getattr(n, "name"), Getline(n));
|
||||
} else {
|
||||
String *argname = NewStringf("PARM%d_%s", largnum, Getattr(p, "name"));
|
||||
|
||||
// Swig_print_node(p);
|
||||
// Printf(stderr,"%s\n", Getattr(p,"tmap:lin"));
|
||||
String *ffitype = compose_foreign_type(argtype, Getattr(p,"name"));
|
||||
String *deref_ffitype = dereference_ffitype(ffitype);
|
||||
String *lisptype = get_lisp_type(parmtype, Getattr(p, "name"));
|
||||
String *deref_ffitype;
|
||||
|
||||
deref_ffitype = dereference_ffitype(ffitype);
|
||||
|
||||
/*
|
||||
String *temp = Copy(argtype);
|
||||
|
||||
if (SwigType_ispointer(temp)) {
|
||||
SwigType_pop(temp);
|
||||
deref_ffitype = compose_foreign_type(temp);
|
||||
} else {
|
||||
deref_ffitype = Copy(ffitype);
|
||||
}
|
||||
|
||||
Delete(temp);
|
||||
*/
|
||||
// String *lisptype=get_lisp_type(argtype, argname);
|
||||
String *lisptype = get_lisp_type(Getattr(p, "type"), Getattr(p, "name"));
|
||||
|
||||
#ifdef ALLEGROCL_DEBUG
|
||||
Printf(stderr, "lisptype of '%s' '%s' = '%s'\n", parmtype,
|
||||
Getattr(p, "name"), lisptype);
|
||||
Printf(stderr, "lisptype of '%s' '%s' = '%s'\n",
|
||||
Getattr(p, "type"), Getattr(p, "name"), lisptype);
|
||||
#endif
|
||||
|
||||
// while we're walking the parameters, generating LIN
|
||||
|
|
@ -2455,9 +2400,7 @@ int ALLEGROCL::emit_defun(Node *n, File *fcl) {
|
|||
first = 0;
|
||||
}
|
||||
|
||||
Delete(argname);
|
||||
Delete(ffitype);
|
||||
Delete(deref_ffitype);
|
||||
Delete(lisptype);
|
||||
}
|
||||
}
|
||||
|
|
@ -2495,6 +2438,11 @@ int ALLEGROCL::emit_defun(Node *n, File *fcl) {
|
|||
lclass = lookup_defined_foreign_ltype(cl_t);
|
||||
isPtrReturn = 1;
|
||||
}
|
||||
// if (SwigType_ispointer(cl_t)) {
|
||||
// isPtrReturn = 1;
|
||||
// SwigType_pop(cl_t);
|
||||
// lclass = lookup_defined_foreign_ltype(cl_t);
|
||||
// }
|
||||
|
||||
int ff_foreign_ptr = 0;
|
||||
if (!lclass) {
|
||||
|
|
@ -2567,16 +2515,9 @@ int ALLEGROCL::emit_defun(Node *n, File *fcl) {
|
|||
}
|
||||
|
||||
int ALLEGROCL::functionWrapper(Node *n) {
|
||||
#ifdef ALLEGROCL_DEBUG
|
||||
Printf(stderr, "functionWrapper %s\n", Getattr(n,"name"));
|
||||
Swig_print_node(n);
|
||||
#endif
|
||||
|
||||
|
||||
ParmList *parms = CopyParmList(Getattr(n, "parms"));
|
||||
Wrapper *f = NewWrapper();
|
||||
SwigType *t = Getattr(n, "type");
|
||||
String *name = Getattr(n, "name");
|
||||
|
||||
String *raw_return_type = Swig_typemap_lookup("ctype", n, "", 0);
|
||||
SwigType *return_type = Swig_cparse_type(raw_return_type);
|
||||
|
|
@ -2586,13 +2527,11 @@ int ALLEGROCL::functionWrapper(Node *n) {
|
|||
Delete(resolved);
|
||||
|
||||
if (!is_void_return) {
|
||||
String *lresult_init =
|
||||
NewStringf("= (%s)0",
|
||||
SwigType_str(SwigType_strip_qualifiers(return_type),0));
|
||||
Wrapper_add_localv(f, "lresult",
|
||||
SwigType_lstr(SwigType_ltype(return_type), "lresult"),
|
||||
lresult_init, NIL);
|
||||
Delete(lresult_init);
|
||||
String *lresult_init = NewStringf("= (%s)0", raw_return_type);
|
||||
Wrapper_add_localv(f, "lresult",
|
||||
SwigType_lstr(SwigType_ltype(return_type), "lresult"),
|
||||
lresult_init, NIL);
|
||||
Delete(lresult_init);
|
||||
}
|
||||
// Emit all of the local variables for holding arguments.
|
||||
emit_parameter_variables(parms, f);
|
||||
|
|
@ -2617,7 +2556,7 @@ int ALLEGROCL::functionWrapper(Node *n) {
|
|||
if (Getattr(n, "overload:ignore")) {
|
||||
// if we're the last overload, make sure to force the emit
|
||||
// of the rest of the overloads before we leave.
|
||||
Printf(stderr, "ignored overload %s(%x)\n", name, Getattr(n, "sym:nextSibling"));
|
||||
Printf(stderr, "ignored overload %s(%x)\n", Getattr(n, "name"), Getattr(n, "sym:nextSibling"));
|
||||
if (!Getattr(n, "sym:nextSibling")) {
|
||||
update_package_if_needed(n);
|
||||
emit_buffered_defuns(n);
|
||||
|
|
@ -2632,7 +2571,7 @@ int ALLEGROCL::functionWrapper(Node *n) {
|
|||
int gencomma = 0;
|
||||
|
||||
#ifdef ALLEGROCL_DEBUG
|
||||
Printf(stderr, "Walking parameters for %s '%s'\n", Getattr(n, "allegrocl:kind"), name);
|
||||
Printf(stderr, "Walking parameters for %s '%s'\n", Getattr(n, "allegrocl:kind"), Getattr(n, "name"));
|
||||
#endif
|
||||
// Now walk the function parameter list and generate code to get arguments
|
||||
String *name_and_parms = NewStringf("%s (", mangled);
|
||||
|
|
@ -2686,34 +2625,24 @@ int ALLEGROCL::functionWrapper(Node *n) {
|
|||
|
||||
String *actioncode = emit_action(n);
|
||||
|
||||
String *tm = Swig_typemap_lookup_out("out", n, "result", f, actioncode);
|
||||
if (!is_void_return && tm) {
|
||||
if (tm) {
|
||||
Replaceall(tm, "$result", "lresult");
|
||||
Printf(f->code, "%s\n", tm);
|
||||
Printf(f->code, " return lresult;\n");
|
||||
Delete(tm);
|
||||
} else {
|
||||
Swig_warning(WARN_TYPEMAP_OUT_UNDEF, input_file, line_number,
|
||||
"Unable to use return type %s in function %s.\n",
|
||||
SwigType_str(t, 0), name);
|
||||
}
|
||||
}
|
||||
|
||||
emit_return_variable(n, t, f);
|
||||
String *result_convert = Swig_typemap_lookup_out("out", n, "result", f, actioncode);
|
||||
Replaceall(result_convert, "$result", "lresult");
|
||||
Printf(f->code, "%s\n", result_convert);
|
||||
Printf(f->code, " return lresult;\n");
|
||||
Delete(result_convert);
|
||||
emit_return_variable(n, Getattr(n, "type"), f);
|
||||
|
||||
if (CPlusPlus) {
|
||||
Printf(f->code, " } catch (...) {\n");
|
||||
if (!is_void_return)
|
||||
Printf(f->code, " return (%s)0;\n",
|
||||
SwigType_str(SwigType_strip_qualifiers(return_type),0));
|
||||
Printf(f->code, " return (%s)0;\n", raw_return_type);
|
||||
Printf(f->code, " }\n");
|
||||
}
|
||||
Printf(f->code, "}\n");
|
||||
|
||||
/* print this when in C mode? make this a command-line arg? */
|
||||
if (Generate_Wrapper)
|
||||
Wrapper_print(f, f_cxx_wrapper);
|
||||
Wrapper_print(f, f_cxx);
|
||||
|
||||
String *f_buffer = NewString("");
|
||||
|
||||
|
|
@ -2735,15 +2664,13 @@ int ALLEGROCL::functionWrapper(Node *n) {
|
|||
}
|
||||
|
||||
int ALLEGROCL::namespaceDeclaration(Node *n) {
|
||||
// Empty namespaces are not worth DEFPACKAGEing.
|
||||
// Swig_print_node(n);
|
||||
#ifdef ALLEGROCL_DEBUG
|
||||
Printf(stderr, "namespaceDecl: '%s'(0x%x) (fc=0x%x)\n", Getattr(n, "sym:name"), n, firstChild(n));
|
||||
#endif
|
||||
|
||||
/* don't wrap a namespace with no contents. package bloat.
|
||||
also, test-suite/namespace_class.i claims an unnamed namespace
|
||||
is 'private' and should not be wrapped. Complying...
|
||||
*/
|
||||
if (Getattr(n,"unnamed") || !firstChild(n))
|
||||
if (!firstChild(n))
|
||||
return SWIG_OK;
|
||||
|
||||
String *name = Getattr(n, "sym:name");
|
||||
|
|
@ -2770,7 +2697,7 @@ int ALLEGROCL::namespaceDeclaration(Node *n) {
|
|||
|
||||
int ALLEGROCL::constructorHandler(Node *n) {
|
||||
#ifdef ALLEGROCL_DEBUG
|
||||
Printf(stderr, "constructorHandler %s\n", Getattr(n, "name"));
|
||||
Printf(stderr, "constructor %s\n", Getattr(n, "name"));
|
||||
#endif
|
||||
// Swig_print_node(n);
|
||||
Setattr(n, "allegrocl:kind", "constructor");
|
||||
|
|
@ -2782,7 +2709,7 @@ int ALLEGROCL::constructorHandler(Node *n) {
|
|||
|
||||
int ALLEGROCL::destructorHandler(Node *n) {
|
||||
#ifdef ALLEGROCL_DEBUG
|
||||
Printf(stderr, "destructorHandler %s\n", Getattr(n, "name"));
|
||||
Printf(stderr, "destructor %s\n", Getattr(n, "name"));
|
||||
#endif
|
||||
|
||||
Setattr(n, "allegrocl:kind", "destructor");
|
||||
|
|
@ -2793,8 +2720,9 @@ int ALLEGROCL::destructorHandler(Node *n) {
|
|||
}
|
||||
|
||||
int ALLEGROCL::constantWrapper(Node *n) {
|
||||
|
||||
#ifdef ALLEGROCL_DEBUG
|
||||
Printf(stderr, "constantWrapper %s\n", Getattr(n, "name"));
|
||||
Printf(stderr, "constant %s\n", Getattr(n, "name"));
|
||||
#endif
|
||||
|
||||
if (Generate_Wrapper) {
|
||||
|
|
@ -2813,10 +2741,10 @@ int ALLEGROCL::constantWrapper(Node *n) {
|
|||
}
|
||||
|
||||
SwigType_add_qualifier(const_type, "const");
|
||||
SwigType_add_qualifier(const_type, "static");
|
||||
|
||||
String *ppcname = NewStringf("ACLppc_%s", Getattr(n, "sym:name"));
|
||||
// Printf(f_runtime, "static const %s = %s;\n", SwigType_lstr(const_type, ppcname), const_val);
|
||||
Printf(f_runtime, "static %s = %s;\n", SwigType_lstr(const_type, ppcname), const_val);
|
||||
String *ppcname = NewStringf("ACLppc_%s", Getattr(n, "name"));
|
||||
Printf(f_cxx, "static const %s = %s;\n", SwigType_lstr(const_type, ppcname), const_val);
|
||||
|
||||
Setattr(n, "name", ppcname);
|
||||
SetFlag(n, "feature:immutable");
|
||||
|
|
@ -2850,10 +2778,6 @@ int ALLEGROCL::constantWrapper(Node *n) {
|
|||
}
|
||||
|
||||
int ALLEGROCL::globalvariableHandler(Node *n) {
|
||||
#ifdef ALLEGROCL_DEBUG
|
||||
Printf(stderr, "globalvariableHandler %s\n", Getattr(n, "name"));
|
||||
#endif
|
||||
|
||||
if (Generate_Wrapper)
|
||||
return Language::globalvariableHandler(n);
|
||||
|
||||
|
|
@ -2873,7 +2797,7 @@ int ALLEGROCL::globalvariableHandler(Node *n) {
|
|||
ctype = SwigType_str(type, 0);
|
||||
// EXPORT <SwigType_str> <mangled_name>;
|
||||
// <SwigType_str> <mangled_name> = <name>;
|
||||
// Printf(f_runtime, "EXPORT %s %s;\n%s %s = %s%s;\n", ctype, mangled_name,
|
||||
// Printf(f_cxx, "EXPORT %s %s;\n%s %s = %s%s;\n", ctype, mangled_name,
|
||||
// ctype, mangled_name, (pointer_added ? "&" : ""), name);
|
||||
|
||||
Printf(f_clwrap, "(swig-defvar \"%s\" \"%s\" :type %s)\n",
|
||||
|
|
@ -2884,7 +2808,7 @@ int ALLEGROCL::globalvariableHandler(Node *n) {
|
|||
|
||||
int ALLEGROCL::variableWrapper(Node *n) {
|
||||
#ifdef ALLEGROCL_DEBUG
|
||||
Printf(stderr, "variableWrapper %s\n", Getattr(n, "name"));
|
||||
Printf(stderr, "variable %s\n", Getattr(n, "name"));
|
||||
#endif
|
||||
Setattr(n, "allegrocl:kind", "variable");
|
||||
Setattr(n, "allegrocl:old-sym:name", Getattr(n, "sym:name"));
|
||||
|
|
@ -2909,30 +2833,24 @@ int ALLEGROCL::variableWrapper(Node *n) {
|
|||
}
|
||||
|
||||
ctype = SwigType_str(type, 0);
|
||||
|
||||
// EXPORT <SwigType_str> <mangled_name>;
|
||||
// <SwigType_str> <mangled_name> = <name>;
|
||||
Printf(f_runtime, "EXPORT %s %s;\n%s %s = %s%s;\n", ctype, mangled_name, ctype, mangled_name, (pointer_added ? "&" : ""), name);
|
||||
Printf(f_cxx, "EXPORT %s %s;\n%s %s = %s%s;\n", ctype, mangled_name, ctype, mangled_name, (pointer_added ? "&" : ""), name);
|
||||
|
||||
Printf(f_cl, "(swig-defvar \"%s\" :type %s)\n", mangled_name, ((SwigType_isconst(type)) ? ":constant" : ":variable"));
|
||||
/*
|
||||
Printf(f_runtime, "// swigtype: %s\n", SwigType_typedef_resolve_all(Getattr(n,"type")));
|
||||
Printf(f_runtime, "// vwrap: %s\n", compose_foreign_type(SwigType_strip_qualifiers(Copy(rtype))));
|
||||
Printf(f_cxx, "// swigtype: %s\n", SwigType_typedef_resolve_all(Getattr(n,"type")));
|
||||
Printf(f_cxx, "// vwrap: %s\n", compose_foreign_type(SwigType_strip_qualifiers(Copy(rtype))));
|
||||
*/
|
||||
|
||||
Printf(stderr,"***\n");
|
||||
Delete(mangled_name);
|
||||
|
||||
#ifdef ALLEGROCL_DEBUG
|
||||
Printf(stderr, "DONE variable %s\n", Getattr(n, "name"));
|
||||
#endif
|
||||
|
||||
return SWIG_OK;
|
||||
}
|
||||
|
||||
int ALLEGROCL::memberfunctionHandler(Node *n) {
|
||||
#ifdef ALLEGROCL_DEBUG
|
||||
Printf(stderr, "memberfunctionHandler %s::%s\n", Getattr(parent_node_skipping_extends(n), "name"), Getattr(n, "name"));
|
||||
Printf(stderr, "member function %s::%s\n", Getattr(parent_node_skipping_extends(n), "name"), Getattr(n, "name"));
|
||||
#endif
|
||||
Setattr(n, "allegrocl:kind", "member function");
|
||||
Setattr(n, "allegrocl:old-sym:name", Getattr(n, "sym:name"));
|
||||
|
|
@ -2943,7 +2861,7 @@ int ALLEGROCL::memberfunctionHandler(Node *n) {
|
|||
|
||||
int ALLEGROCL::membervariableHandler(Node *n) {
|
||||
#ifdef ALLEGROCL_DEBUG
|
||||
Printf(stderr, "membervariableHandler %s::%s\n", Getattr(parent_node_skipping_extends(n), "name"), Getattr(n, "name"));
|
||||
Printf(stderr, "member variable %s::%s\n", Getattr(parent_node_skipping_extends(n), "name"), Getattr(n, "name"));
|
||||
#endif
|
||||
Setattr(n, "allegrocl:kind", "member variable");
|
||||
Setattr(n, "allegrocl:old-sym:name", Getattr(n, "sym:name"));
|
||||
|
|
@ -2953,8 +2871,10 @@ int ALLEGROCL::membervariableHandler(Node *n) {
|
|||
}
|
||||
|
||||
int ALLEGROCL::typedefHandler(Node *n) {
|
||||
|
||||
#ifdef ALLEGROCL_TYPE_DEBUG
|
||||
Printf(stderr, "In typedefHandler\n");
|
||||
Printf(stderr, "In typedefHAND\n");
|
||||
// Swig_print_node(n);
|
||||
#endif
|
||||
|
||||
SwigType *typedef_type = Getattr(n,"type");
|
||||
|
|
@ -2972,7 +2892,9 @@ int ALLEGROCL::typedefHandler(Node *n) {
|
|||
Printf(stderr, " typedef in class '%s'(%x)\n", Getattr(in_class, "sym:name"), in_class);
|
||||
#endif
|
||||
Setattr(n, "allegrocl:typedef:in-class", in_class);
|
||||
}
|
||||
|
||||
if (in_class) {
|
||||
String *class_name = Getattr(in_class, "name");
|
||||
name = NewStringf("%s__%s", class_name, sym_name);
|
||||
type_ref = NewStringf("%s::%s", class_name, sym_name);
|
||||
|
|
@ -2986,19 +2908,14 @@ int ALLEGROCL::typedefHandler(Node *n) {
|
|||
|
||||
String *lookup = lookup_defined_foreign_type(typedef_type);
|
||||
|
||||
#ifdef ALLEGROCL_TYPE_DEBUG
|
||||
Printf(stderr, "** lookup='%s'(%x), typedef_type='%s', strcmp = '%d' strstr = '%d'\n", lookup, lookup, typedef_type, Strcmp(typedef_type,"void"), Strstr(ff_type,"__SWIGACL_FwdReference"));
|
||||
#endif
|
||||
// Printf(stderr, "** lookup='%s'(%x), ff_type='%s', strstr = '%d'\n", lookup, lookup, ff_type, !Strstr(ff_type,"void"));
|
||||
|
||||
if(lookup || (!lookup && Strcmp(typedef_type,"void")) ||
|
||||
(!lookup && Strstr(ff_type,"__SWIGACL_FwdReference"))) {
|
||||
if(lookup || (!lookup && !Strstr(ff_type,"void")))
|
||||
add_defined_foreign_type(n, 0, type_ref, name);
|
||||
} else {
|
||||
add_forward_referenced_type(n);
|
||||
}
|
||||
else add_forward_referenced_type(n);
|
||||
|
||||
#ifdef ALLEGROCL_TYPE_DEBUG
|
||||
Printf(stderr, "Out typedefHandler\n");
|
||||
Printf(stderr, "Out typedefHAND\n");
|
||||
#endif
|
||||
|
||||
Delete(ff_type);
|
||||
|
|
@ -3008,33 +2925,22 @@ int ALLEGROCL::typedefHandler(Node *n) {
|
|||
|
||||
// forward referenced classes are added specially to defined_foreign_types
|
||||
int ALLEGROCL::classforwardDeclaration(Node *n) {
|
||||
#ifdef ALLEGROCL_DEBUG
|
||||
Printf(stderr, "classforwardDeclaration %s\n", Getattr(n, "name"));
|
||||
#endif
|
||||
|
||||
add_forward_referenced_type(n);
|
||||
return SWIG_OK;
|
||||
}
|
||||
|
||||
int ALLEGROCL::classHandler(Node *n) {
|
||||
#ifdef ALLEGROCL_DEBUG
|
||||
Printf(stderr, "classHandler %s::%s\n", current_namespace, Getattr(n, "sym:name"));
|
||||
Printf(stderr, "class %s::%s\n", current_namespace, Getattr(n, "sym:name"));
|
||||
#endif
|
||||
|
||||
int result;
|
||||
|
||||
if (Generate_Wrapper)
|
||||
result = cppClassHandler(n);
|
||||
return cppClassHandler(n);
|
||||
else
|
||||
result = cClassHandler(n);
|
||||
|
||||
return result;
|
||||
return cClassHandler(n);
|
||||
}
|
||||
|
||||
int ALLEGROCL::cClassHandler(Node *n) {
|
||||
#ifdef ALLEGROCL_TYPE_DEBUG
|
||||
Printf(stderr, "In cClassHandler\n");
|
||||
#endif
|
||||
// String *cDeclName = Getattr(n,"classDeclaration:name");
|
||||
// String *name= Getattr(n, "sym:name");
|
||||
// String *kind = Getattr(n,"kind");
|
||||
|
|
@ -3044,21 +2950,22 @@ int ALLEGROCL::cClassHandler(Node *n) {
|
|||
// Printf(stderr, "Adding %s foreign type\n", name);
|
||||
String *ns = listify_namespace(current_namespace);
|
||||
|
||||
#ifdef ALLEGROCL_TYPE_DEBUG
|
||||
Printf(stderr, "In cClassHAND\n");
|
||||
#endif
|
||||
|
||||
add_defined_foreign_type(n);
|
||||
|
||||
Delete(ns);
|
||||
|
||||
#ifdef ALLEGROCL_TYPE_DEBUG
|
||||
Printf(stderr, "Out cClassHandler\n");
|
||||
Printf(stderr, "Out cClassHAND\n");
|
||||
#endif
|
||||
|
||||
return SWIG_OK;
|
||||
}
|
||||
|
||||
int ALLEGROCL::cppClassHandler(Node *n) {
|
||||
#ifdef ALLEGROCL_DEBUG
|
||||
Printf(stderr, "cppClassHandler %s\n", Getattr(n, "name"));
|
||||
#endif
|
||||
|
||||
// String *name=Getattr(n, "sym:name");
|
||||
// String *kind = Getattr(n,"kind");
|
||||
|
|
@ -3117,9 +3024,6 @@ int ALLEGROCL::cppClassHandler(Node *n) {
|
|||
// so their types can be added to the linked_type_list.
|
||||
SwigType *childType = NewStringf("%s%s", Getattr(c, "decl"),
|
||||
Getattr(c, "type"));
|
||||
#ifdef ALLEGROCL_CLASS_DEBUG
|
||||
Printf(stderr, "looking at child '%x' of type '%s'\n", c, childType);
|
||||
#endif
|
||||
if (!SwigType_isfunction(childType))
|
||||
Delete(compose_foreign_type(childType));
|
||||
|
||||
|
|
@ -3160,9 +3064,6 @@ int ALLEGROCL::emit_one(Node *n) {
|
|||
}
|
||||
|
||||
int ALLEGROCL::enumDeclaration(Node *n) {
|
||||
#ifdef ALLEGROCL_DEBUG
|
||||
Printf(stderr, "enumDeclaration %s\n", Getattr(n, "name"));
|
||||
#endif
|
||||
|
||||
if (Getattr(n, "sym:name")) {
|
||||
add_defined_foreign_type(n);
|
||||
|
|
@ -3179,34 +3080,21 @@ int ALLEGROCL::enumDeclaration(Node *n) {
|
|||
|
||||
|
||||
int ALLEGROCL::enumvalueDeclaration(Node *n) {
|
||||
#ifdef ALLEGROCL_DEBUG
|
||||
Printf(stderr, "enumvalueDeclaration %s\n", Getattr(n, "name"));
|
||||
#endif
|
||||
/* print this when in C mode? make this a command-line arg? */
|
||||
if (Generate_Wrapper) {
|
||||
SwigType *enum_type = Copy(Getattr(n,"type"));
|
||||
String *mangled_name =
|
||||
mangle_name(n, "ACL_ENUM",
|
||||
in_class ? Getattr(in_class,"name") :
|
||||
current_namespace);
|
||||
|
||||
SwigType_add_qualifier(enum_type,"const");
|
||||
|
||||
String *enum_decl = SwigType_str(enum_type, mangled_name);
|
||||
Printf(f_cxx_wrapper, "EXPORT %s;\n", enum_decl);
|
||||
Printf(f_cxx_wrapper, "%s = %s;\n", enum_decl, Getattr(n, "value"));
|
||||
/* print this when in C mode? make this a command-line arg? */
|
||||
|
||||
if (Generate_Wrapper) {
|
||||
String *mangled_name = mangle_name(n, "ACL_ENUM");
|
||||
|
||||
Printf(f_cxx, "EXPORT const %s %s = %s;\n", Getattr(n, "type"), mangled_name, Getattr(n, "value"));
|
||||
|
||||
Delete(mangled_name);
|
||||
Delete(enum_type);
|
||||
Delete(enum_decl);
|
||||
}
|
||||
|
||||
return SWIG_OK;
|
||||
}
|
||||
|
||||
int ALLEGROCL::templateDeclaration(Node *n) {
|
||||
#ifdef ALLEGROCL_DEBUG
|
||||
Printf(stderr, "templateDeclaration %s\n", Getattr(n, "name"));
|
||||
#endif
|
||||
|
||||
String *type = Getattr(n, "templatetype");
|
||||
|
||||
|
|
|
|||
|
|
@ -12,22 +12,6 @@ char cvsroot_c_cxx[] = "$Id: c.cxx 11186 2009-04-11 10:46:13Z maciekd $";
|
|||
#include <ctype.h>
|
||||
#include "swigmod.h"
|
||||
|
||||
int SwigType_isbuiltin(SwigType *t) {
|
||||
const char* builtins[] = { "void", "short", "int", "long", "char", "float", "double", "bool",
|
||||
"unsigned short", "unsigned int", "unsigned long", "unsigned char", "signed char",
|
||||
"long long", "unsigned long long", 0 };
|
||||
int i = 0;
|
||||
char *c = Char(t);
|
||||
if (!t)
|
||||
return 0;
|
||||
while (builtins[i]) {
|
||||
if (strcmp(c, builtins[i]) == 0)
|
||||
return 1;
|
||||
i++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
class C:public Language {
|
||||
static const char *usage;
|
||||
|
||||
|
|
@ -166,8 +150,8 @@ public:
|
|||
String *outfile = Getattr(n, "outfile");
|
||||
|
||||
// initialize I/O
|
||||
f_begin = NewFile(outfile, "w", SWIG_output_files());
|
||||
if (!f_begin) {
|
||||
f_runtime = NewFile(outfile, "w");
|
||||
if (!f_runtime) {
|
||||
FileErrorDisplay(outfile);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
|
|
@ -186,13 +170,13 @@ public:
|
|||
|
||||
// create proxy files with appropriate name
|
||||
String *proxy_code_filename = NewStringf("%s%s_proxy.c", SWIG_output_directory(), Char(module));
|
||||
if ((f_proxy_c = NewFile(proxy_code_filename, "w", SWIG_output_files())) == 0) {
|
||||
if ((f_proxy_c = NewFile(proxy_code_filename, "w")) == 0) {
|
||||
FileErrorDisplay(proxy_code_filename);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
String *proxy_header_filename = NewStringf("%s%s_proxy.h", SWIG_output_directory(), Char(module));
|
||||
if ((f_proxy_h = NewFile(proxy_header_filename, "w", SWIG_output_files())) == 0) {
|
||||
if ((f_proxy_h = NewFile(proxy_header_filename, "w")) == 0) {
|
||||
FileErrorDisplay(proxy_header_filename);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,8 +22,7 @@ public:
|
|||
String *f_clhead;
|
||||
String *f_clwrap;
|
||||
bool CWrap; // generate wrapper file for C code?
|
||||
File *f_begin;
|
||||
File *f_runtime;
|
||||
File *f_cxx;
|
||||
File *f_cxx_header;
|
||||
File *f_cxx_wrapper;
|
||||
File *f_clos;
|
||||
|
|
@ -68,7 +67,6 @@ private:
|
|||
void CFFI::main(int argc, char *argv[]) {
|
||||
int i;
|
||||
|
||||
Preprocessor_define("SWIGCFFI 1", 0);
|
||||
SWIG_library_directory("cffi");
|
||||
SWIG_config_file("cffi.swg");
|
||||
generate_typedef_flag = 0;
|
||||
|
|
@ -121,15 +119,16 @@ int CFFI::top(Node *n) {
|
|||
|
||||
Printf(lisp_filename, "%s%s.lisp", SWIG_output_directory(), module);
|
||||
|
||||
File *f_lisp = NewFile(lisp_filename, "w", SWIG_output_files());
|
||||
File *f_lisp = NewFile(lisp_filename, "w");
|
||||
NewFile(lisp_filename, "w");
|
||||
if (!f_lisp) {
|
||||
FileErrorDisplay(lisp_filename);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (CPlusPlus || CWrap) {
|
||||
f_begin = NewFile(cxx_filename, "w", SWIG_output_files());
|
||||
if (!f_begin) {
|
||||
f_cxx = NewFile(cxx_filename, "w");
|
||||
if (!f_cxx) {
|
||||
Close(f_lisp);
|
||||
Delete(f_lisp);
|
||||
Printf(stderr, "Unable to open %s for writing\n", cxx_filename);
|
||||
|
|
@ -138,7 +137,7 @@ int CFFI::top(Node *n) {
|
|||
|
||||
String *clos_filename = NewString("");
|
||||
Printf(clos_filename, "%s%s-clos.lisp", SWIG_output_directory(), module);
|
||||
f_clos = NewFile(clos_filename, "w", SWIG_output_files());
|
||||
f_clos = NewFile(clos_filename, "w");
|
||||
if (!f_clos) {
|
||||
Close(f_lisp);
|
||||
Delete(f_lisp);
|
||||
|
|
@ -146,32 +145,22 @@ int CFFI::top(Node *n) {
|
|||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
} else {
|
||||
f_begin = NewString("");
|
||||
f_cxx = NewString("");
|
||||
f_clos = NewString("");
|
||||
}
|
||||
|
||||
f_runtime = NewString("");
|
||||
f_cxx_header = f_runtime;
|
||||
f_cxx_header = f_cxx;
|
||||
f_cxx_wrapper = NewString("");
|
||||
|
||||
Swig_register_filebyname("header", f_cxx_header);
|
||||
Swig_register_filebyname("wrapper", f_cxx_wrapper);
|
||||
Swig_register_filebyname("begin", f_begin);
|
||||
Swig_register_filebyname("runtime", f_runtime);
|
||||
Swig_register_filebyname("runtime", f_cxx);
|
||||
Swig_register_filebyname("lisphead", f_clhead);
|
||||
if (!no_swig_lisp)
|
||||
Swig_register_filebyname("swiglisp", f_cl);
|
||||
else
|
||||
Swig_register_filebyname("swiglisp", f_null);
|
||||
|
||||
Swig_banner(f_begin);
|
||||
|
||||
Printf(f_runtime, "\n");
|
||||
Printf(f_runtime, "#define SWIGCFFI\n");
|
||||
Printf(f_runtime, "\n");
|
||||
|
||||
Swig_banner_target_lang(f_lisp, ";;;");
|
||||
|
||||
Language::top(n);
|
||||
Printf(f_lisp, "%s\n", f_clhead);
|
||||
Printf(f_lisp, "%s\n", f_cl);
|
||||
|
|
@ -182,10 +171,8 @@ int CFFI::top(Node *n) {
|
|||
Delete(f_cl);
|
||||
Delete(f_clhead);
|
||||
Delete(f_clwrap);
|
||||
Dump(f_runtime, f_begin);
|
||||
Close(f_begin);
|
||||
Delete(f_runtime);
|
||||
Delete(f_begin);
|
||||
Close(f_cxx);
|
||||
Delete(f_cxx);
|
||||
Delete(f_cxx_wrapper);
|
||||
Delete(f_null);
|
||||
|
||||
|
|
@ -245,7 +232,7 @@ void CFFI::emit_defmethod(Node *n) {
|
|||
|
||||
ParmList *pl = Getattr(n, "parms");
|
||||
int argnum = 0;
|
||||
Node *parent = getCurrentClass();
|
||||
Node *parent = parentNode(n);
|
||||
bool first = 0;
|
||||
|
||||
for (Parm *p = pl; p; p = nextSibling(p), argnum++) {
|
||||
|
|
@ -300,7 +287,7 @@ void CFFI::emit_initialize_instance(Node *n) {
|
|||
|
||||
ParmList *pl = Getattr(n, "parms");
|
||||
int argnum = 0;
|
||||
Node *parent = getCurrentClass();
|
||||
Node *parent = parentNode(n);
|
||||
|
||||
for (Parm *p = pl; p; p = nextSibling(p), argnum++) {
|
||||
String *argname = Getattr(p, "name");
|
||||
|
|
@ -337,18 +324,18 @@ void CFFI::emit_initialize_instance(Node *n) {
|
|||
}
|
||||
|
||||
void CFFI::emit_setter(Node *n) {
|
||||
Node *parent = getCurrentClass();
|
||||
Node *p = parentNode(n);
|
||||
Printf(f_clos, "(cl:defmethod (cl:setf %s) (arg0 (obj %s))\n (%s (ff-pointer obj) arg0))\n\n",
|
||||
lispify_name(n, Getattr(n, "name"), "'method"),
|
||||
lispify_name(parent, lispy_name(Char(Getattr(parent, "sym:name"))), "'class"), lispify_name(n, Getattr(n, "sym:name"), "'function"));
|
||||
lispify_name(p, lispy_name(Char(Getattr(p, "sym:name"))), "'class"), lispify_name(n, Getattr(n, "sym:name"), "'function"));
|
||||
}
|
||||
|
||||
|
||||
void CFFI::emit_getter(Node *n) {
|
||||
Node *parent = getCurrentClass();
|
||||
Node *p = parentNode(n);
|
||||
Printf(f_clos, "(cl:defmethod %s ((obj %s))\n (%s (ff-pointer obj)))\n\n",
|
||||
lispify_name(n, Getattr(n, "name"), "'method"),
|
||||
lispify_name(parent, lispy_name(Char(Getattr(parent, "sym:name"))), "'class"), lispify_name(n, Getattr(n, "sym:name"), "'function"));
|
||||
lispify_name(p, lispy_name(Char(Getattr(p, "sym:name"))), "'class"), lispify_name(n, Getattr(n, "sym:name"), "'function"));
|
||||
}
|
||||
|
||||
int CFFI::memberfunctionHandler(Node *n) {
|
||||
|
|
@ -468,7 +455,7 @@ int CFFI::functionWrapper(Node *n) {
|
|||
Printf(f->code, "}\n");
|
||||
|
||||
if (CPlusPlus)
|
||||
Wrapper_print(f, f_runtime);
|
||||
Wrapper_print(f, f_cxx);
|
||||
|
||||
if (CPlusPlus) {
|
||||
emit_defun(n, wname);
|
||||
|
|
@ -643,7 +630,7 @@ int CFFI::enumDeclaration(Node *n) {
|
|||
else {
|
||||
String *type = Getattr(c, "type");
|
||||
String *converted_value = convert_literal(value, type);
|
||||
Printf(f_cl, "\n\t(%s #.%s)", slot_name, converted_value);
|
||||
Printf(f_cl, "\n\t(%s %s)", slot_name, converted_value);
|
||||
Delete(converted_value);
|
||||
}
|
||||
Delete(value);
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ static char *module = 0;
|
|||
static char *chicken_path = (char *) "chicken";
|
||||
static int num_methods = 0;
|
||||
|
||||
static File *f_begin = 0;
|
||||
static File *f_runtime = 0;
|
||||
static File *f_header = 0;
|
||||
static File *f_wrappers = 0;
|
||||
|
|
@ -102,12 +101,12 @@ protected:
|
|||
int isPointer(SwigType *t);
|
||||
void dispatchFunction(Node *n);
|
||||
|
||||
String *chickenNameMapping(String *, const_String_or_char_ptr );
|
||||
String *chickenNameMapping(String *, String_or_char *);
|
||||
String *chickenPrimitiveName(String *);
|
||||
|
||||
String *runtimeCode();
|
||||
String *defaultExternalRuntimeFilename();
|
||||
String *buildClosFunctionCall(List *types, const_String_or_char_ptr closname, const_String_or_char_ptr funcname);
|
||||
String *buildClosFunctionCall(List *types, String_or_char *closname, String_or_char *funcname);
|
||||
};
|
||||
|
||||
/* -----------------------------------------------------------------------
|
||||
|
|
@ -189,12 +188,11 @@ int CHICKEN::top(Node *n) {
|
|||
/* Initialize all of the output files */
|
||||
String *outfile = Getattr(n, "outfile");
|
||||
|
||||
f_begin = NewFile(outfile, "w", SWIG_output_files());
|
||||
if (!f_begin) {
|
||||
f_runtime = NewFile(outfile, "w");
|
||||
if (!f_runtime) {
|
||||
FileErrorDisplay(outfile);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
f_runtime = NewString("");
|
||||
f_init = NewString("");
|
||||
f_header = NewString("");
|
||||
f_wrappers = NewString("");
|
||||
|
|
@ -207,7 +205,6 @@ int CHICKEN::top(Node *n) {
|
|||
/* Register file targets with the SWIG file handler */
|
||||
Swig_register_filebyname("header", f_header);
|
||||
Swig_register_filebyname("wrapper", f_wrappers);
|
||||
Swig_register_filebyname("begin", f_begin);
|
||||
Swig_register_filebyname("runtime", f_runtime);
|
||||
Swig_register_filebyname("init", f_init);
|
||||
|
||||
|
|
@ -218,16 +215,14 @@ int CHICKEN::top(Node *n) {
|
|||
clos_methods = NewString("");
|
||||
scm_const_defs = NewString("");
|
||||
|
||||
Swig_banner(f_begin);
|
||||
Printf(f_runtime, "/* -*- buffer-read-only: t -*- vi: set ro: */\n");
|
||||
Swig_banner(f_runtime);
|
||||
|
||||
Printf(f_runtime, "\n");
|
||||
Printf(f_runtime, "#define SWIGCHICKEN\n");
|
||||
Printf(f_runtime, "/* Implementation : CHICKEN */\n\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);
|
||||
|
|
@ -256,14 +251,14 @@ int CHICKEN::top(Node *n) {
|
|||
Printf(f_init, "#endif\n");
|
||||
|
||||
Printf(chicken_filename, "%s%s.scm", SWIG_output_directory(), module);
|
||||
if ((f_scm = NewFile(chicken_filename, "w", SWIG_output_files())) == 0) {
|
||||
if ((f_scm = NewFile(chicken_filename, "w")) == 0) {
|
||||
FileErrorDisplay(chicken_filename);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
Swig_banner_target_lang(f_scm, ";;");
|
||||
Printf(f_scm, "\n");
|
||||
|
||||
Printv(f_scm,
|
||||
";; -*- buffer-read-only: t -*- vi: set ro:\n",
|
||||
";; This file was created automatically by SWIG.\n", ";; Don't modify this file, modify the SWIG interface instead.\n", NIL);
|
||||
if (declare_unit)
|
||||
Printv(f_scm, "(declare (unit ", scmmodule, "))\n\n", NIL);
|
||||
Printv(f_scm, "(declare \n",
|
||||
|
|
@ -312,17 +307,15 @@ int CHICKEN::top(Node *n) {
|
|||
/* Close all of the files */
|
||||
Delete(primitive_names);
|
||||
Delete(scmmodule);
|
||||
Dump(f_runtime, f_begin);
|
||||
Dump(f_header, f_begin);
|
||||
Dump(f_wrappers, f_begin);
|
||||
Wrapper_pretty_print(f_init, f_begin);
|
||||
Dump(f_header, f_runtime);
|
||||
Dump(f_wrappers, f_runtime);
|
||||
Wrapper_pretty_print(f_init, f_runtime);
|
||||
Delete(f_header);
|
||||
Delete(f_wrappers);
|
||||
Delete(f_sym_size);
|
||||
Delete(f_init);
|
||||
Close(f_begin);
|
||||
Close(f_runtime);
|
||||
Delete(f_runtime);
|
||||
Delete(f_begin);
|
||||
return SWIG_OK;
|
||||
}
|
||||
|
||||
|
|
@ -1240,7 +1233,7 @@ int CHICKEN::importDirective(Node *n) {
|
|||
return Language::importDirective(n);
|
||||
}
|
||||
|
||||
String *CHICKEN::buildClosFunctionCall(List *types, const_String_or_char_ptr closname, const_String_or_char_ptr funcname) {
|
||||
String *CHICKEN::buildClosFunctionCall(List *types, String_or_char *closname, String_or_char *funcname) {
|
||||
String *method_signature = NewString("");
|
||||
String *func_args = NewString("");
|
||||
String *func_call = NewString("");
|
||||
|
|
@ -1514,7 +1507,7 @@ int CHICKEN::validIdentifier(String *s) {
|
|||
* If class_name = "" that means the mapping is for a function or
|
||||
* variable not attached to any class.
|
||||
* ------------------------------------------------------------ */
|
||||
String *CHICKEN::chickenNameMapping(String *name, const_String_or_char_ptr class_name) {
|
||||
String *CHICKEN::chickenNameMapping(String *name, String_or_char *class_name) {
|
||||
String *n = NewString("");
|
||||
|
||||
if (Strcmp(class_name, "") == 0) {
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ private:
|
|||
void CLISP::main(int argc, char *argv[]) {
|
||||
int i;
|
||||
|
||||
Preprocessor_define("SWIGCLISP 1", 0);
|
||||
SWIG_library_directory("clisp");
|
||||
SWIG_config_file("clisp.swg");
|
||||
generate_typedef_flag = 0;
|
||||
|
|
@ -80,22 +79,20 @@ int CLISP::top(Node *n) {
|
|||
Printf(output_filename, "%s%s.lisp", SWIG_output_directory(), module);
|
||||
}
|
||||
|
||||
f_cl = NewFile(output_filename, "w+", SWIG_output_files());
|
||||
f_cl = NewFile(output_filename, "w+");
|
||||
if (!f_cl) {
|
||||
FileErrorDisplay(output_filename);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
Swig_register_filebyname("header", f_null);
|
||||
Swig_register_filebyname("begin", f_null);
|
||||
Swig_register_filebyname("runtime", f_null);
|
||||
Swig_register_filebyname("wrapper", f_null);
|
||||
|
||||
String *header = NewString("");
|
||||
|
||||
Swig_banner_target_lang(header, ";;");
|
||||
|
||||
Printf(header, "\n(defpackage :%s\n (:use :common-lisp :ffi)", module);
|
||||
String *header =
|
||||
NewStringf
|
||||
(";; This is an automatically generated file. \n;;Make changes as you feel are necessary (but remember if you try to regenerate this file, your changes will be lost). \n\n(defpackage :%s\n (:use :common-lisp :ffi)",
|
||||
module);
|
||||
|
||||
Language::top(n);
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,6 @@ public:
|
|||
int extendDirective(Node *n);
|
||||
int importDirective(Node *n);
|
||||
int includeDirective(Node *n);
|
||||
int namespaceDeclaration(Node *n);
|
||||
int classDeclaration(Node *n);
|
||||
virtual int top(Node *n);
|
||||
};
|
||||
|
|
@ -321,23 +320,16 @@ int Contracts::constructorDeclaration(Node *n) {
|
|||
int Contracts::externDeclaration(Node *n) {
|
||||
return emit_children(n);
|
||||
}
|
||||
|
||||
int Contracts::extendDirective(Node *n) {
|
||||
return emit_children(n);
|
||||
}
|
||||
|
||||
int Contracts::importDirective(Node *n) {
|
||||
return emit_children(n);
|
||||
}
|
||||
|
||||
int Contracts::includeDirective(Node *n) {
|
||||
return emit_children(n);
|
||||
}
|
||||
|
||||
int Contracts::namespaceDeclaration(Node *n) {
|
||||
return emit_children(n);
|
||||
}
|
||||
|
||||
int Contracts::classDeclaration(Node *n) {
|
||||
int ret = SWIG_OK;
|
||||
InClass = 1;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ class CSHARP:public Language {
|
|||
const String *protected_string;
|
||||
|
||||
Hash *swig_types_hash;
|
||||
File *f_begin;
|
||||
File *f_runtime;
|
||||
File *f_runtime_h;
|
||||
File *f_header;
|
||||
|
|
@ -86,7 +85,7 @@ class CSHARP:public Language {
|
|||
|
||||
enum EnumFeature { SimpleEnum, TypeunsafeEnum, TypesafeEnum, ProperEnum };
|
||||
|
||||
static Parm *NewParmFromNode(SwigType *type, const_String_or_char_ptr name, Node *n) {
|
||||
static Parm *NewParmFromNode(SwigType *type, const String_or_char *name, Node *n) {
|
||||
Parm *p = NewParm(type, name);
|
||||
Setfile(p, Getfile(n));
|
||||
Setline(p, Getline(n));
|
||||
|
|
@ -103,7 +102,6 @@ public:
|
|||
public_string(NewString("public")),
|
||||
protected_string(NewString("protected")),
|
||||
swig_types_hash(NULL),
|
||||
f_begin(NULL),
|
||||
f_runtime(NULL),
|
||||
f_runtime_h(NULL),
|
||||
f_header(NULL),
|
||||
|
|
@ -288,8 +286,8 @@ public:
|
|||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
f_begin = NewFile(outfile, "w", SWIG_output_files());
|
||||
if (!f_begin) {
|
||||
f_runtime = NewFile(outfile, "w");
|
||||
if (!f_runtime) {
|
||||
FileErrorDisplay(outfile);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
|
|
@ -299,14 +297,13 @@ public:
|
|||
Printf(stderr, "Unable to determine outfile_h\n");
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
f_runtime_h = NewFile(outfile_h, "w", SWIG_output_files());
|
||||
f_runtime_h = NewFile(outfile_h, "w");
|
||||
if (!f_runtime_h) {
|
||||
FileErrorDisplay(outfile_h);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
f_runtime = NewString("");
|
||||
f_init = NewString("");
|
||||
f_header = NewString("");
|
||||
f_wrappers = NewString("");
|
||||
|
|
@ -316,7 +313,6 @@ public:
|
|||
/* Register file targets with the SWIG file handler */
|
||||
Swig_register_filebyname("header", f_header);
|
||||
Swig_register_filebyname("wrapper", f_wrappers);
|
||||
Swig_register_filebyname("begin", f_begin);
|
||||
Swig_register_filebyname("runtime", f_runtime);
|
||||
Swig_register_filebyname("init", f_init);
|
||||
Swig_register_filebyname("director", f_directors);
|
||||
|
|
@ -362,17 +358,13 @@ public:
|
|||
if (!dllimport)
|
||||
dllimport = Copy(module_class_name);
|
||||
|
||||
Swig_banner(f_begin);
|
||||
|
||||
Printf(f_runtime, "\n");
|
||||
Printf(f_runtime, "#define SWIGCSHARP\n");
|
||||
Swig_banner(f_runtime); // Print the SWIG banner message
|
||||
|
||||
if (directorsEnabled()) {
|
||||
Printf(f_runtime, "#define SWIG_DIRECTORS\n");
|
||||
|
||||
/* Emit initial director header and director code: */
|
||||
Swig_banner(f_directors_h);
|
||||
Printf(f_directors_h, "\n");
|
||||
Printf(f_directors_h, "#ifndef SWIG_%s_WRAP_H_\n", module_class_name);
|
||||
Printf(f_directors_h, "#define SWIG_%s_WRAP_H_\n\n", module_class_name);
|
||||
|
||||
|
|
@ -384,8 +376,6 @@ 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");
|
||||
|
|
@ -406,7 +396,7 @@ public:
|
|||
// Generate the intermediary class
|
||||
{
|
||||
String *filen = NewStringf("%s%s.cs", SWIG_output_directory(), imclass_name);
|
||||
File *f_im = NewFile(filen, "w", SWIG_output_files());
|
||||
File *f_im = NewFile(filen, "w");
|
||||
if (!f_im) {
|
||||
FileErrorDisplay(filen);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
|
|
@ -450,7 +440,7 @@ public:
|
|||
// Generate the C# module class
|
||||
{
|
||||
String *filen = NewStringf("%s%s.cs", SWIG_output_directory(), module_class_name);
|
||||
File *f_module = NewFile(filen, "w", SWIG_output_files());
|
||||
File *f_module = NewFile(filen, "w");
|
||||
if (!f_module) {
|
||||
FileErrorDisplay(filen);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
|
|
@ -577,11 +567,10 @@ public:
|
|||
n_dmethods = 0;
|
||||
|
||||
/* Close all of the files */
|
||||
Dump(f_runtime, f_begin);
|
||||
Dump(f_header, f_begin);
|
||||
Dump(f_header, f_runtime);
|
||||
|
||||
if (directorsEnabled()) {
|
||||
Dump(f_directors, f_begin);
|
||||
Dump(f_directors, f_runtime);
|
||||
Dump(f_directors_h, f_runtime_h);
|
||||
|
||||
Printf(f_runtime_h, "\n");
|
||||
|
|
@ -596,14 +585,13 @@ public:
|
|||
f_directors_h = NULL;
|
||||
}
|
||||
|
||||
Dump(f_wrappers, f_begin);
|
||||
Wrapper_pretty_print(f_init, f_begin);
|
||||
Dump(f_wrappers, f_runtime);
|
||||
Wrapper_pretty_print(f_init, f_runtime);
|
||||
Delete(f_header);
|
||||
Delete(f_wrappers);
|
||||
Delete(f_init);
|
||||
Close(f_begin);
|
||||
Close(f_runtime);
|
||||
Delete(f_runtime);
|
||||
Delete(f_begin);
|
||||
return SWIG_OK;
|
||||
}
|
||||
|
||||
|
|
@ -613,7 +601,11 @@ public:
|
|||
|
||||
void emitBanner(File *f) {
|
||||
Printf(f, "/* ----------------------------------------------------------------------------\n");
|
||||
Swig_banner_target_lang(f, " *");
|
||||
Printf(f, " * This file was automatically generated by SWIG (http://www.swig.org).\n");
|
||||
Printf(f, " * Version %s\n", Swig_package_version());
|
||||
Printf(f, " *\n");
|
||||
Printf(f, " * Do not make changes to this file unless you know what you are doing--modify\n");
|
||||
Printf(f, " * the SWIG interface file instead.\n");
|
||||
Printf(f, " * ----------------------------------------------------------------------------- */\n\n");
|
||||
}
|
||||
|
||||
|
|
@ -1163,7 +1155,7 @@ public:
|
|||
} else {
|
||||
// Global enums are defined in their own file
|
||||
String *filen = NewStringf("%s%s.cs", SWIG_output_directory(), symname);
|
||||
File *f_enum = NewFile(filen, "w", SWIG_output_files());
|
||||
File *f_enum = NewFile(filen, "w");
|
||||
if (!f_enum) {
|
||||
FileErrorDisplay(filen);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
|
|
@ -1742,7 +1734,7 @@ public:
|
|||
}
|
||||
|
||||
String *filen = NewStringf("%s%s.cs", SWIG_output_directory(), proxy_class_name);
|
||||
f_proxy = NewFile(filen, "w", SWIG_output_files());
|
||||
f_proxy = NewFile(filen, "w");
|
||||
if (!f_proxy) {
|
||||
FileErrorDisplay(filen);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
|
|
@ -1895,7 +1887,6 @@ public:
|
|||
bool setter_flag = false;
|
||||
String *pre_code = NewString("");
|
||||
String *post_code = NewString("");
|
||||
String *terminator_code = NewString("");
|
||||
|
||||
if (!proxy_flag)
|
||||
return;
|
||||
|
|
@ -2007,8 +1998,7 @@ public:
|
|||
if (!(variable_wrapper_flag && i == 0)) {
|
||||
SwigType *pt = Getattr(p, "type");
|
||||
String *param_type = NewString("");
|
||||
if (setter_flag)
|
||||
last_parm = p;
|
||||
last_parm = p;
|
||||
|
||||
/* Get the C# parameter type */
|
||||
if ((tm = Getattr(p, "tmap:cstype"))) {
|
||||
|
|
@ -2044,14 +2034,6 @@ public:
|
|||
Printf(post_code, "\n");
|
||||
Printv(post_code, post, NIL);
|
||||
}
|
||||
String *terminator = Getattr(p, "tmap:csin:terminator");
|
||||
if (terminator) {
|
||||
substituteClassname(pt, terminator);
|
||||
Replaceall(terminator, "$csinput", arg);
|
||||
if (Len(terminator_code) > 0)
|
||||
Insert(terminator_code, 0, "\n");
|
||||
Insert(terminator_code, 0, terminator);
|
||||
}
|
||||
Printv(imcall, tm, NIL);
|
||||
} else {
|
||||
Swig_warning(WARN_CSHARP_TYPEMAP_CSIN_UNDEF, input_file, line_number, "No csin typemap defined for %s\n", SwigType_str(pt, 0));
|
||||
|
|
@ -2077,8 +2059,7 @@ public:
|
|||
excodeSubstitute(n, tm, "csout", n);
|
||||
bool is_pre_code = Len(pre_code) > 0;
|
||||
bool is_post_code = Len(post_code) > 0;
|
||||
bool is_terminator_code = Len(terminator_code) > 0;
|
||||
if (is_pre_code || is_post_code || is_terminator_code) {
|
||||
if (is_pre_code || is_post_code) {
|
||||
Replaceall(tm, "\n ", "\n "); // add extra indentation to code in typemap
|
||||
if (is_post_code) {
|
||||
Insert(tm, 0, "\n try ");
|
||||
|
|
@ -2090,9 +2071,6 @@ public:
|
|||
Insert(tm, 0, pre_code);
|
||||
Insert(tm, 0, "\n");
|
||||
}
|
||||
if (is_terminator_code) {
|
||||
Printv(tm, "\n", terminator_code, NIL);
|
||||
}
|
||||
Insert(tm, 0, "{");
|
||||
Printf(tm, "\n }");
|
||||
}
|
||||
|
|
@ -2192,7 +2170,6 @@ public:
|
|||
|
||||
Delete(pre_code);
|
||||
Delete(post_code);
|
||||
Delete(terminator_code);
|
||||
Delete(function_code);
|
||||
Delete(return_type);
|
||||
Delete(imcall);
|
||||
|
|
@ -2213,7 +2190,6 @@ public:
|
|||
String *helper_args = NewString("");
|
||||
String *pre_code = NewString("");
|
||||
String *post_code = NewString("");
|
||||
String *terminator_code = NewString("");
|
||||
String *im_return_type = NewString("");
|
||||
bool feature_director = (parentNode(n) && Swig_directorclass(n));
|
||||
|
||||
|
|
@ -2309,14 +2285,6 @@ public:
|
|||
Printf(post_code, "\n");
|
||||
Printv(post_code, post, NIL);
|
||||
}
|
||||
String *terminator = Getattr(p, "tmap:csin:terminator");
|
||||
if (terminator) {
|
||||
substituteClassname(pt, terminator);
|
||||
Replaceall(terminator, "$csinput", arg);
|
||||
if (Len(terminator_code) > 0)
|
||||
Insert(terminator_code, 0, "\n");
|
||||
Insert(terminator_code, 0, terminator);
|
||||
}
|
||||
cshin = Getattr(p, "tmap:csin:cshin");
|
||||
if (cshin)
|
||||
Replaceall(cshin, "$csinput", arg);
|
||||
|
|
@ -2373,8 +2341,7 @@ public:
|
|||
|
||||
bool is_pre_code = Len(pre_code) > 0;
|
||||
bool is_post_code = Len(post_code) > 0;
|
||||
bool is_terminator_code = Len(terminator_code) > 0;
|
||||
if (is_pre_code || is_post_code || is_terminator_code) {
|
||||
if (is_pre_code || is_post_code) {
|
||||
Printf(helper_code, " {\n");
|
||||
if (is_pre_code) {
|
||||
Printv(helper_code, pre_code, "\n", NIL);
|
||||
|
|
@ -2386,9 +2353,6 @@ public:
|
|||
} else {
|
||||
Printv(helper_code, " return ", imcall, ";", NIL);
|
||||
}
|
||||
if (is_terminator_code) {
|
||||
Printv(helper_code, "\n", terminator_code, NIL);
|
||||
}
|
||||
Printf(helper_code, "\n }\n");
|
||||
String *helper_name = NewStringf("%s.SwigConstruct%s(%s)", proxy_class_name, proxy_class_name, helper_args);
|
||||
String *im_outattributes = Getattr(n, "tmap:imtype:outattributes");
|
||||
|
|
@ -2407,7 +2371,6 @@ public:
|
|||
Delete(im_return_type);
|
||||
Delete(pre_code);
|
||||
Delete(post_code);
|
||||
Delete(terminator_code);
|
||||
Delete(construct_tm);
|
||||
Delete(attributes);
|
||||
Delete(overloaded_name);
|
||||
|
|
@ -2525,7 +2488,6 @@ public:
|
|||
bool setter_flag = false;
|
||||
String *pre_code = NewString("");
|
||||
String *post_code = NewString("");
|
||||
String *terminator_code = NewString("");
|
||||
|
||||
if (l) {
|
||||
if (SwigType_type(Getattr(l, "type")) == T_VOID) {
|
||||
|
|
@ -2630,14 +2592,6 @@ public:
|
|||
Printf(post_code, "\n");
|
||||
Printv(post_code, post, NIL);
|
||||
}
|
||||
String *terminator = Getattr(p, "tmap:csin:terminator");
|
||||
if (terminator) {
|
||||
substituteClassname(pt, terminator);
|
||||
Replaceall(terminator, "$csinput", arg);
|
||||
if (Len(terminator_code) > 0)
|
||||
Insert(terminator_code, 0, "\n");
|
||||
Insert(terminator_code, 0, terminator);
|
||||
}
|
||||
Printv(imcall, tm, NIL);
|
||||
} else {
|
||||
Swig_warning(WARN_CSHARP_TYPEMAP_CSIN_UNDEF, input_file, line_number, "No csin typemap defined for %s\n", SwigType_str(pt, 0));
|
||||
|
|
@ -2662,8 +2616,7 @@ public:
|
|||
excodeSubstitute(n, tm, "csout", n);
|
||||
bool is_pre_code = Len(pre_code) > 0;
|
||||
bool is_post_code = Len(post_code) > 0;
|
||||
bool is_terminator_code = Len(terminator_code) > 0;
|
||||
if (is_pre_code || is_post_code || is_terminator_code) {
|
||||
if (is_pre_code || is_post_code) {
|
||||
Replaceall(tm, "\n ", "\n "); // add extra indentation to code in typemap
|
||||
if (is_post_code) {
|
||||
Insert(tm, 0, "\n try ");
|
||||
|
|
@ -2675,9 +2628,6 @@ public:
|
|||
Insert(tm, 0, pre_code);
|
||||
Insert(tm, 0, "\n");
|
||||
}
|
||||
if (is_terminator_code) {
|
||||
Printv(tm, "\n", terminator_code, NIL);
|
||||
}
|
||||
Insert(tm, 0, "{");
|
||||
Printf(tm, "\n }");
|
||||
}
|
||||
|
|
@ -2753,7 +2703,6 @@ public:
|
|||
|
||||
Delete(pre_code);
|
||||
Delete(post_code);
|
||||
Delete(terminator_code);
|
||||
Delete(function_code);
|
||||
Delete(return_type);
|
||||
Delete(imcall);
|
||||
|
|
@ -2968,7 +2917,7 @@ public:
|
|||
void emitTypeWrapperClass(String *classname, SwigType *type) {
|
||||
String *swigtype = NewString("");
|
||||
String *filen = NewStringf("%s%s.cs", SWIG_output_directory(), classname);
|
||||
File *f_swigtype = NewFile(filen, "w", SWIG_output_files());
|
||||
File *f_swigtype = NewFile(filen, "w");
|
||||
if (!f_swigtype) {
|
||||
FileErrorDisplay(filen);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ String *Swig_director_declaration(Node *n) {
|
|||
}
|
||||
|
||||
|
||||
String *Swig_method_call(const_String_or_char_ptr name, ParmList *parms) {
|
||||
String *Swig_method_call(String_or_char *name, ParmList *parms) {
|
||||
String *func;
|
||||
int i = 0;
|
||||
int comma = 0;
|
||||
|
|
@ -128,7 +128,7 @@ String *Swig_method_call(const_String_or_char_ptr name, ParmList *parms) {
|
|||
*
|
||||
*/
|
||||
|
||||
String *Swig_method_decl(SwigType *returntype, SwigType *decl, const_String_or_char_ptr id, List *args, int strip, int values) {
|
||||
String *Swig_method_decl(SwigType *returntype, SwigType *decl, const String_or_char *id, List *args, int strip, int values) {
|
||||
String *result;
|
||||
List *elements;
|
||||
String *element = 0, *nextelement;
|
||||
|
|
|
|||
|
|
@ -47,7 +47,6 @@ Guile Options (available with -guile)\n\
|
|||
-exportprimitive - Add the (export ...) code from scmstub into the\n\
|
||||
GOOPS file.\n";
|
||||
|
||||
static File *f_begin = 0;
|
||||
static File *f_runtime = 0;
|
||||
static File *f_header = 0;
|
||||
static File *f_wrappers = 0;
|
||||
|
|
@ -175,7 +174,7 @@ public:
|
|||
}
|
||||
} else if (strcmp(argv[i], "-procdoc") == 0) {
|
||||
if (argv[i + 1]) {
|
||||
procdoc = NewFile(argv[i + 1], "w", SWIG_output_files());
|
||||
procdoc = NewFile(argv[i + 1], (char *) "w");
|
||||
if (!procdoc) {
|
||||
FileErrorDisplay(argv[i + 1]);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
|
|
@ -300,12 +299,11 @@ public:
|
|||
/* Initialize all of the output files */
|
||||
String *outfile = Getattr(n, "outfile");
|
||||
|
||||
f_begin = NewFile(outfile, "w", SWIG_output_files());
|
||||
if (!f_begin) {
|
||||
f_runtime = NewFile(outfile, "w");
|
||||
if (!f_runtime) {
|
||||
FileErrorDisplay(outfile);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
f_runtime = NewString("");
|
||||
f_init = NewString("");
|
||||
f_header = NewString("");
|
||||
f_wrappers = NewString("");
|
||||
|
|
@ -313,7 +311,6 @@ public:
|
|||
/* Register file targets with the SWIG file handler */
|
||||
Swig_register_filebyname("header", f_header);
|
||||
Swig_register_filebyname("wrapper", f_wrappers);
|
||||
Swig_register_filebyname("begin", f_begin);
|
||||
Swig_register_filebyname("runtime", f_runtime);
|
||||
Swig_register_filebyname("init", f_init);
|
||||
|
||||
|
|
@ -325,10 +322,10 @@ public:
|
|||
goopscode = NewString("");
|
||||
goopsexport = NewString("");
|
||||
|
||||
Swig_banner(f_begin);
|
||||
Printf(f_runtime, "/* -*- buffer-read-only: t -*- vi: set ro: */\n");
|
||||
Swig_banner(f_runtime);
|
||||
|
||||
Printf(f_runtime, "\n");
|
||||
Printf(f_runtime, "#define SWIGGUILE\n");
|
||||
Printf(f_runtime, "/* Implementation : GUILE */\n\n");
|
||||
|
||||
if (!use_scm_interface) {
|
||||
if (SwigRuntime == 1)
|
||||
|
|
@ -361,8 +358,6 @@ public:
|
|||
Printf(f_runtime, "\n}\n");
|
||||
}
|
||||
|
||||
Printf(f_runtime, "\n");
|
||||
|
||||
Language::top(n);
|
||||
|
||||
/* Close module */
|
||||
|
|
@ -397,16 +392,14 @@ public:
|
|||
Delete(goopstext);
|
||||
|
||||
/* Close all of the files */
|
||||
Dump(f_runtime, f_begin);
|
||||
Dump(f_header, f_begin);
|
||||
Dump(f_wrappers, f_begin);
|
||||
Wrapper_pretty_print(f_init, f_begin);
|
||||
Dump(f_header, f_runtime);
|
||||
Dump(f_wrappers, f_runtime);
|
||||
Wrapper_pretty_print(f_init, f_runtime);
|
||||
Delete(f_header);
|
||||
Delete(f_wrappers);
|
||||
Delete(f_init);
|
||||
Close(f_begin);
|
||||
Close(f_runtime);
|
||||
Delete(f_runtime);
|
||||
Delete(f_begin);
|
||||
return SWIG_OK;
|
||||
}
|
||||
|
||||
|
|
@ -506,15 +499,15 @@ public:
|
|||
SWIG_output_directory(),
|
||||
primitive_name);
|
||||
Delete(primitive_name);
|
||||
File *scmstubfile = NewFile(fname, "w", SWIG_output_files());
|
||||
File *scmstubfile = NewFile(fname, (char *) "w");
|
||||
if (!scmstubfile) {
|
||||
FileErrorDisplay(fname);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
Delete(fname);
|
||||
|
||||
Swig_banner_target_lang(scmstubfile, ";;;");
|
||||
Printf(scmstubfile, "\n");
|
||||
Printf(scmstubfile, ";;; -*- buffer-read-only: t -*- vi: set ro: */\n");
|
||||
Printf(scmstubfile, ";;; Automatically generated by SWIG; do not edit.\n\n");
|
||||
if (linkage == GUILE_LSTYLE_SIMPLE || linkage == GUILE_LSTYLE_PASSIVE)
|
||||
Printf(scmstubfile, "(define-module (%s))\n\n", mod);
|
||||
Delete(mod);
|
||||
|
|
@ -537,14 +530,14 @@ public:
|
|||
|
||||
String *fname = NewStringf("%s%s.scm", SWIG_output_directory(),
|
||||
module_name);
|
||||
File *goopsfile = NewFile(fname, "w", SWIG_output_files());
|
||||
File *goopsfile = NewFile(fname, (char *) "w");
|
||||
if (!goopsfile) {
|
||||
FileErrorDisplay(fname);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
Delete(fname);
|
||||
Swig_banner_target_lang(goopsfile, ";;;");
|
||||
Printf(goopsfile, "\n");
|
||||
Printf(goopsfile, ";;; -*- buffer-read-only: t -*- vi: set ro: */\n");
|
||||
Printf(goopsfile, ";;; Automatically generated by SWIG; do not edit.\n\n");
|
||||
Printf(goopsfile, "(define-module (%s))\n", mod);
|
||||
Printf(goopsfile, "%s\n", goopstext);
|
||||
Printf(goopsfile, "(use-modules (oop goops) (Swig common))\n");
|
||||
|
|
@ -1660,7 +1653,7 @@ public:
|
|||
* If class_name = "" that means the mapping is for a function or
|
||||
* variable not attached to any class.
|
||||
* ------------------------------------------------------------ */
|
||||
String *goopsNameMapping(String *name, const_String_or_char_ptr class_name) {
|
||||
String *goopsNameMapping(String *name, String_or_char *class_name) {
|
||||
String *n = NewString("");
|
||||
|
||||
if (Strcmp(class_name, "") == 0) {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ class JAVA:public Language {
|
|||
const String *protected_string;
|
||||
|
||||
Hash *swig_types_hash;
|
||||
File *f_begin;
|
||||
File *f_runtime;
|
||||
File *f_runtime_h;
|
||||
File *f_header;
|
||||
|
|
@ -71,7 +70,6 @@ class JAVA:public Language {
|
|||
String *imclass_cppcasts_code; //C++ casts up inheritance hierarchies intermediary class code
|
||||
String *imclass_directors; // Intermediate class director code
|
||||
String *destructor_call; //C++ destructor call if any
|
||||
String *destructor_throws_clause; //C++ destructor throws clause if any
|
||||
|
||||
// Director method stuff:
|
||||
List *dmethods_seq;
|
||||
|
|
@ -83,7 +81,7 @@ class JAVA:public Language {
|
|||
|
||||
enum EnumFeature { SimpleEnum, TypeunsafeEnum, TypesafeEnum, ProperEnum };
|
||||
|
||||
static Parm *NewParmFromNode(SwigType *type, const_String_or_char_ptr name, Node *n) {
|
||||
static Parm *NewParmFromNode(SwigType *type, const String_or_char *name, Node *n) {
|
||||
Parm *p = NewParm(type, name);
|
||||
Setfile(p, Getfile(n));
|
||||
Setline(p, Getline(n));
|
||||
|
|
@ -100,7 +98,6 @@ public:
|
|||
public_string(NewString("public")),
|
||||
protected_string(NewString("protected")),
|
||||
swig_types_hash(NULL),
|
||||
f_begin(NULL),
|
||||
f_runtime(NULL),
|
||||
f_runtime_h(NULL),
|
||||
f_header(NULL),
|
||||
|
|
@ -144,7 +141,6 @@ public:
|
|||
imclass_cppcasts_code(NULL),
|
||||
imclass_directors(NULL),
|
||||
destructor_call(NULL),
|
||||
destructor_throws_clause(NULL),
|
||||
dmethods_seq(NULL),
|
||||
dmethods_table(NULL),
|
||||
n_dmethods(0),
|
||||
|
|
@ -297,8 +293,8 @@ public:
|
|||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
f_begin = NewFile(outfile, "w", SWIG_output_files());
|
||||
if (!f_begin) {
|
||||
f_runtime = NewFile(outfile, "w");
|
||||
if (!f_runtime) {
|
||||
FileErrorDisplay(outfile);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
|
|
@ -308,14 +304,13 @@ public:
|
|||
Printf(stderr, "Unable to determine outfile_h\n");
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
f_runtime_h = NewFile(outfile_h, "w", SWIG_output_files());
|
||||
f_runtime_h = NewFile(outfile_h, "w");
|
||||
if (!f_runtime_h) {
|
||||
FileErrorDisplay(outfile_h);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
f_runtime = NewString("");
|
||||
f_init = NewString("");
|
||||
f_header = NewString("");
|
||||
f_wrappers = NewString("");
|
||||
|
|
@ -323,7 +318,6 @@ public:
|
|||
f_directors = NewString("");
|
||||
|
||||
/* Register file targets with the SWIG file handler */
|
||||
Swig_register_filebyname("begin", f_begin);
|
||||
Swig_register_filebyname("header", f_header);
|
||||
Swig_register_filebyname("wrapper", f_wrappers);
|
||||
Swig_register_filebyname("runtime", f_runtime);
|
||||
|
|
@ -371,16 +365,13 @@ public:
|
|||
jnipackage = NewString("");
|
||||
package_path = NewString("");
|
||||
|
||||
Swig_banner(f_begin);
|
||||
|
||||
Printf(f_runtime, "\n#define SWIGJAVA\n");
|
||||
Swig_banner(f_runtime); // Print the SWIG banner message
|
||||
|
||||
if (directorsEnabled()) {
|
||||
Printf(f_runtime, "#define SWIG_DIRECTORS\n");
|
||||
|
||||
/* Emit initial director header and director code: */
|
||||
Swig_banner(f_directors_h);
|
||||
Printf(f_directors_h, "\n");
|
||||
Printf(f_directors_h, "#ifndef SWIG_%s_WRAP_H_\n", module_class_name);
|
||||
Printf(f_directors_h, "#define SWIG_%s_WRAP_H_\n\n", module_class_name);
|
||||
|
||||
|
|
@ -392,8 +383,6 @@ public:
|
|||
Printf(f_directors, "#include \"%s\"\n\n", Swig_file_filename(outfile_h));
|
||||
}
|
||||
|
||||
Printf(f_runtime, "\n");
|
||||
|
||||
String *wrapper_name = NewString("");
|
||||
|
||||
if (Len(package)) {
|
||||
|
|
@ -431,7 +420,7 @@ public:
|
|||
// Generate the intermediary class
|
||||
{
|
||||
String *filen = NewStringf("%s%s.java", SWIG_output_directory(), imclass_name);
|
||||
File *f_im = NewFile(filen, "w", SWIG_output_files());
|
||||
File *f_im = NewFile(filen, "w");
|
||||
if (!f_im) {
|
||||
FileErrorDisplay(filen);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
|
|
@ -482,7 +471,7 @@ public:
|
|||
// Generate the Java module class
|
||||
{
|
||||
String *filen = NewStringf("%s%s.java", SWIG_output_directory(), module_class_name);
|
||||
File *f_module = NewFile(filen, "w", SWIG_output_files());
|
||||
File *f_module = NewFile(filen, "w");
|
||||
if (!f_module) {
|
||||
FileErrorDisplay(filen);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
|
|
@ -534,7 +523,7 @@ public:
|
|||
// Generate the Java constants interface
|
||||
if (Len(module_class_constants_code) != 0) {
|
||||
String *filen = NewStringf("%s%sConstants.java", SWIG_output_directory(), module_class_name);
|
||||
File *f_module = NewFile(filen, "w", SWIG_output_files());
|
||||
File *f_module = NewFile(filen, "w");
|
||||
if (!f_module) {
|
||||
FileErrorDisplay(filen);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
|
|
@ -671,10 +660,8 @@ public:
|
|||
Delete(f_header);
|
||||
Delete(f_wrappers);
|
||||
Delete(f_init);
|
||||
Dump(f_runtime, f_begin);
|
||||
Close(f_runtime);
|
||||
Delete(f_runtime);
|
||||
Close(f_begin);
|
||||
Delete(f_begin);
|
||||
return SWIG_OK;
|
||||
}
|
||||
|
||||
|
|
@ -684,7 +671,11 @@ public:
|
|||
|
||||
void emitBanner(File *f) {
|
||||
Printf(f, "/* ----------------------------------------------------------------------------\n");
|
||||
Swig_banner_target_lang(f, " *");
|
||||
Printf(f, " * This file was automatically generated by SWIG (http://www.swig.org).\n");
|
||||
Printf(f, " * Version %s\n", Swig_package_version());
|
||||
Printf(f, " *\n");
|
||||
Printf(f, " * Do not make changes to this file unless you know what you are doing--modify\n");
|
||||
Printf(f, " * the SWIG interface file instead.\n");
|
||||
Printf(f, " * ----------------------------------------------------------------------------- */\n\n");
|
||||
}
|
||||
|
||||
|
|
@ -1219,7 +1210,7 @@ public:
|
|||
} else {
|
||||
// Global enums are defined in their own file
|
||||
String *filen = NewStringf("%s%s.java", SWIG_output_directory(), symname);
|
||||
File *f_enum = NewFile(filen, "w", SWIG_output_files());
|
||||
File *f_enum = NewFile(filen, "w");
|
||||
if (!f_enum) {
|
||||
FileErrorDisplay(filen);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
|
|
@ -1663,7 +1654,7 @@ public:
|
|||
else
|
||||
Replaceall(destruct, "$jnicall", "throw new UnsupportedOperationException(\"C++ destructor does not have public access\")");
|
||||
if (*Char(destruct))
|
||||
Printv(proxy_class_def, "\n ", destruct_methodmodifiers, " void ", destruct_methodname, "()", destructor_throws_clause, " ", destruct, "\n", NIL);
|
||||
Printv(proxy_class_def, "\n ", destruct_methodmodifiers, " void ", destruct_methodname, "() ", destruct, "\n", NIL);
|
||||
}
|
||||
|
||||
/* Insert directordisconnect typemap, if this class has directors enabled */
|
||||
|
|
@ -1751,7 +1742,7 @@ public:
|
|||
}
|
||||
|
||||
String *filen = NewStringf("%s%s.java", SWIG_output_directory(), proxy_class_name);
|
||||
f_proxy = NewFile(filen, "w", SWIG_output_files());
|
||||
f_proxy = NewFile(filen, "w");
|
||||
if (!f_proxy) {
|
||||
FileErrorDisplay(filen);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
|
|
@ -1770,7 +1761,6 @@ public:
|
|||
Clear(proxy_class_code);
|
||||
|
||||
destructor_call = NewString("");
|
||||
destructor_throws_clause = NewString("");
|
||||
proxy_class_constants_code = NewString("");
|
||||
}
|
||||
|
||||
|
|
@ -1829,8 +1819,6 @@ public:
|
|||
proxy_class_name = NULL;
|
||||
Delete(destructor_call);
|
||||
destructor_call = NULL;
|
||||
Delete(destructor_throws_clause);
|
||||
destructor_throws_clause = NULL;
|
||||
Delete(proxy_class_constants_code);
|
||||
proxy_class_constants_code = NULL;
|
||||
}
|
||||
|
|
@ -2348,7 +2336,6 @@ public:
|
|||
|
||||
if (proxy_flag) {
|
||||
Printv(destructor_call, imclass_name, ".", Swig_name_destroy(symname), "(swigCPtr)", NIL);
|
||||
generateThrowsClause(n, destructor_throws_clause);
|
||||
}
|
||||
return SWIG_OK;
|
||||
}
|
||||
|
|
@ -2811,7 +2798,7 @@ public:
|
|||
void emitTypeWrapperClass(String *classname, SwigType *type) {
|
||||
String *swigtype = NewString("");
|
||||
String *filen = NewStringf("%s%s.java", SWIG_output_directory(), classname);
|
||||
File *f_swigtype = NewFile(filen, "w", SWIG_output_files());
|
||||
File *f_swigtype = NewFile(filen, "w");
|
||||
if (!f_swigtype) {
|
||||
FileErrorDisplay(filen);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
|
|
@ -2883,7 +2870,7 @@ public:
|
|||
String *throws_attribute = NewStringf("%s:throws", attribute);
|
||||
String *throws = Getattr(parameter, throws_attribute);
|
||||
|
||||
if (throws && Len(throws) > 0) {
|
||||
if (throws) {
|
||||
String *throws_list = Getattr(n, "java:throwslist");
|
||||
if (!throws_list) {
|
||||
throws_list = NewList();
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ static String *AttributeFunctionGet = 0;
|
|||
static String *AttributeFunctionSet = 0;
|
||||
static Node *CurrentClass = 0;
|
||||
int line_number = 0;
|
||||
String *input_file = 0;
|
||||
char *input_file = 0;
|
||||
int SmartPointer = 0;
|
||||
static Hash *classhash;
|
||||
|
||||
|
|
@ -352,7 +352,7 @@ int Language::emit_one(Node *n) {
|
|||
Extend = 1;
|
||||
|
||||
line_number = Getline(n);
|
||||
input_file = Getfile(n);
|
||||
input_file = Char(Getfile(n));
|
||||
|
||||
/*
|
||||
symtab = Getattr(n,"symtab");
|
||||
|
|
@ -830,8 +830,9 @@ int Language::cDeclaration(Node *n) {
|
|||
if (!(directorsEnabled() && ((is_member_director(CurrentClass, n) && need_nonpublic_member(n)) || is_non_virtual_protected_access(n)))) {
|
||||
return SWIG_NOWRAP;
|
||||
}
|
||||
// Prevent wrapping protected overloaded director methods more than once -
|
||||
// This bit of code is only needed due to the cDeclaration call in classHandler()
|
||||
#if 0
|
||||
// I don't see why this is needed - WSF
|
||||
/* prevent wrapping the method twice due to overload */
|
||||
String *wrapname = NewStringf("nonpublic_%s%s", symname, Getattr(n, "sym:overname"));
|
||||
if (Getattr(CurrentClass, wrapname)) {
|
||||
Delete(wrapname);
|
||||
|
|
@ -839,6 +840,7 @@ int Language::cDeclaration(Node *n) {
|
|||
}
|
||||
SetFlag(CurrentClass, wrapname);
|
||||
Delete(wrapname);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1422,39 +1424,36 @@ int Language::membervariableHandler(Node *n) {
|
|||
target = NewStringf("%s->%s", pname, name);
|
||||
Delete(pname);
|
||||
}
|
||||
} else {
|
||||
target = NewStringf("$extendgetcall"); // member variable access expanded later
|
||||
tm = Swig_typemap_lookup("memberin", n, target, 0);
|
||||
}
|
||||
tm = Swig_typemap_lookup("memberin", n, target, 0);
|
||||
int flags = Extend | SmartPointer | use_naturalvar_mode(n);
|
||||
if (is_non_virtual_protected_access(n))
|
||||
flags = flags | CWRAP_ALL_PROTECTED_ACCESS;
|
||||
|
||||
String *call = 0;
|
||||
Swig_MembersetToFunction(n, ClassType, flags, &call);
|
||||
Swig_MembersetToFunction(n, ClassType, flags);
|
||||
Setattr(n, "memberset", "1");
|
||||
if (!Extend) {
|
||||
/* Check for a member in typemap here */
|
||||
|
||||
if (!tm) {
|
||||
if (SwigType_isarray(type)) {
|
||||
Swig_warning(WARN_TYPEMAP_VARIN_UNDEF, input_file, line_number, "Unable to set variable of type %s.\n", SwigType_str(type, 0));
|
||||
make_set_wrapper = 0;
|
||||
if (!tm) {
|
||||
if (SwigType_isarray(type)) {
|
||||
Swig_warning(WARN_TYPEMAP_VARIN_UNDEF, input_file, line_number, "Unable to set variable of type %s.\n", SwigType_str(type, 0));
|
||||
make_set_wrapper = 0;
|
||||
}
|
||||
} else {
|
||||
String *pname0 = Swig_cparm_name(0, 0);
|
||||
String *pname1 = Swig_cparm_name(0, 1);
|
||||
Replace(tm, "$source", pname1, DOH_REPLACE_ANY);
|
||||
Replace(tm, "$target", target, DOH_REPLACE_ANY);
|
||||
Replace(tm, "$input", pname1, DOH_REPLACE_ANY);
|
||||
Replace(tm, "$self", pname0, DOH_REPLACE_ANY);
|
||||
Setattr(n, "wrap:action", tm);
|
||||
Delete(tm);
|
||||
Delete(pname0);
|
||||
Delete(pname1);
|
||||
}
|
||||
} else {
|
||||
String *pname0 = Swig_cparm_name(0, 0);
|
||||
String *pname1 = Swig_cparm_name(0, 1);
|
||||
Replace(tm, "$source", pname1, DOH_REPLACE_ANY);
|
||||
Replace(tm, "$target", target, DOH_REPLACE_ANY);
|
||||
Replace(tm, "$input", pname1, DOH_REPLACE_ANY);
|
||||
Replace(tm, "$self", pname0, DOH_REPLACE_ANY);
|
||||
Replace(tm, "$extendgetcall", call, DOH_REPLACE_ANY);
|
||||
Setattr(n, "wrap:action", tm);
|
||||
Delete(tm);
|
||||
Delete(pname0);
|
||||
Delete(pname1);
|
||||
Delete(target);
|
||||
}
|
||||
Delete(call);
|
||||
Delete(target);
|
||||
|
||||
if (make_set_wrapper) {
|
||||
Setattr(n, "sym:name", mrename_set);
|
||||
functionWrapper(n);
|
||||
|
|
@ -2477,13 +2476,6 @@ int Language::classHandler(Node *n) {
|
|||
Node *m = Copy(method);
|
||||
Setattr(m, "director", "1");
|
||||
Setattr(m, "parentNode", n);
|
||||
/*
|
||||
* There is a bug that needs fixing still...
|
||||
* This area of code is creating methods which have not been overidden in a derived class (director methods that are protected in the base)
|
||||
* If the method is overloaded, then Swig_overload_dispatch() incorrectly generates a call to the base wrapper, _wrap_xxx method
|
||||
* See director_protected_overloaded.i - Possibly sym:overname needs correcting here.
|
||||
Printf(stdout, "new method: %s::%s(%s)\n", Getattr(parentNode(m), "name"), Getattr(m, "name"), ParmList_str_defaultargs(Getattr(m, "parms")));
|
||||
*/
|
||||
cDeclaration(m);
|
||||
Delete(m);
|
||||
}
|
||||
|
|
@ -2963,9 +2955,14 @@ Node *Language::classLookup(SwigType *s) {
|
|||
n = Getattr(classtypes, s);
|
||||
if (!n) {
|
||||
Symtab *stab = 0;
|
||||
// SwigType *lt = SwigType_ltype(s);
|
||||
// SwigType *ty1 = SwigType_typedef_resolve_all(lt);
|
||||
SwigType *ty1 = SwigType_typedef_resolve_all(s);
|
||||
SwigType *ty2 = SwigType_strip_qualifiers(ty1);
|
||||
// Printf(stdout, " stages... ty1: %s ty2: %s\n", ty1, ty2);
|
||||
// Delete(lt);
|
||||
Delete(ty1);
|
||||
// lt = 0;
|
||||
ty1 = 0;
|
||||
|
||||
String *base = SwigType_base(ty2);
|
||||
|
|
@ -2974,12 +2971,6 @@ Node *Language::classLookup(SwigType *s) {
|
|||
Replaceall(base, "struct ", "");
|
||||
Replaceall(base, "union ", "");
|
||||
|
||||
if (strncmp(Char(base), "::", 2) == 0) {
|
||||
String *oldbase = base;
|
||||
base = NewString(Char(base) + 2);
|
||||
Delete(oldbase);
|
||||
}
|
||||
|
||||
String *prefix = SwigType_prefix(ty2);
|
||||
|
||||
/* Do a symbol table search on the base type */
|
||||
|
|
@ -3053,12 +3044,6 @@ Node *Language::enumLookup(SwigType *s) {
|
|||
Replaceall(base, "enum ", "");
|
||||
String *prefix = SwigType_prefix(ty2);
|
||||
|
||||
if (strncmp(Char(base), "::", 2) == 0) {
|
||||
String *oldbase = base;
|
||||
base = NewString(Char(base) + 2);
|
||||
Delete(oldbase);
|
||||
}
|
||||
|
||||
/* Look for type in symbol table */
|
||||
while (!n) {
|
||||
Hash *nstab;
|
||||
|
|
|
|||
|
|
@ -92,7 +92,6 @@ NEW LANGUAGE NOTE:END ************************************************/
|
|||
class LUA:public Language {
|
||||
private:
|
||||
|
||||
File *f_begin;
|
||||
File *f_runtime;
|
||||
File *f_header;
|
||||
File *f_wrappers;
|
||||
|
|
@ -133,7 +132,6 @@ public:
|
|||
* --------------------------------------------------------------------- */
|
||||
|
||||
LUA() {
|
||||
f_begin = 0;
|
||||
f_runtime = 0;
|
||||
f_header = 0;
|
||||
f_wrappers = 0;
|
||||
|
|
@ -215,12 +213,11 @@ public:
|
|||
String *outfile = Getattr(n, "outfile");
|
||||
|
||||
/* Open the output file */
|
||||
f_begin = NewFile(outfile, "w", SWIG_output_files());
|
||||
if (!f_begin) {
|
||||
f_runtime = NewFile(outfile, "w");
|
||||
if (!f_runtime) {
|
||||
FileErrorDisplay(outfile);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
f_runtime = NewString("");
|
||||
f_init = NewString("");
|
||||
f_header = NewString("");
|
||||
f_wrappers = NewString("");
|
||||
|
|
@ -229,7 +226,6 @@ public:
|
|||
/* Register file targets with the SWIG file handler */
|
||||
Swig_register_filebyname("header", f_header);
|
||||
Swig_register_filebyname("wrapper", f_wrappers);
|
||||
Swig_register_filebyname("begin", f_begin);
|
||||
Swig_register_filebyname("runtime", f_runtime);
|
||||
Swig_register_filebyname("init", f_init);
|
||||
Swig_register_filebyname("initbeforefunc", f_initbeforefunc);
|
||||
|
|
@ -253,17 +249,11 @@ public:
|
|||
current=NO_CPP;
|
||||
|
||||
/* Standard stuff for the SWIG runtime section */
|
||||
Swig_banner(f_begin);
|
||||
|
||||
Printf(f_runtime, "\n");
|
||||
Printf(f_runtime, "#define SWIGLUA\n");
|
||||
|
||||
Swig_banner(f_runtime);
|
||||
// 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);
|
||||
|
|
@ -298,14 +288,13 @@ public:
|
|||
this basically combines several of the strings together
|
||||
and then writes it all to a file
|
||||
NEW LANGUAGE NOTE:END ************************************************/
|
||||
Dump(f_runtime, f_begin);
|
||||
Dump(f_header, f_begin);
|
||||
Dump(f_wrappers, f_begin);
|
||||
Dump(f_initbeforefunc, f_begin);
|
||||
Dump(f_header, f_runtime);
|
||||
Dump(f_wrappers, f_runtime);
|
||||
Dump(f_initbeforefunc, f_runtime);
|
||||
/* for the Lua code it needs to be properly excaped to be added into the C/C++ code */
|
||||
EscapeCode(s_luacode);
|
||||
Printf(f_begin, "const char* SWIG_LUACODE=\n \"%s\";\n\n",s_luacode);
|
||||
Wrapper_pretty_print(f_init, f_begin);
|
||||
Printf(f_runtime, "const char* SWIG_LUACODE=\n \"%s\";\n\n",s_luacode);
|
||||
Wrapper_pretty_print(f_init, f_runtime);
|
||||
/* Close all of the files */
|
||||
Delete(s_luacode);
|
||||
Delete(s_cmd_tab);
|
||||
|
|
@ -315,9 +304,8 @@ public:
|
|||
Delete(f_wrappers);
|
||||
Delete(f_init);
|
||||
Delete(f_initbeforefunc);
|
||||
Close(f_begin);
|
||||
Close(f_runtime);
|
||||
Delete(f_runtime);
|
||||
Delete(f_begin);
|
||||
|
||||
/* Done */
|
||||
return SWIG_OK;
|
||||
|
|
|
|||
|
|
@ -117,8 +117,7 @@ static const char *usage3 = (const char *) "\
|
|||
-fastdispatch -fvirtual \n\
|
||||
-o <outfile> - Set name of the output file to <outfile>\n\
|
||||
-oh <headfile> - Set name of the output header file to <headfile>\n\
|
||||
-outcurrentdir - Set default output dir to current dir instead of input file's path\n\
|
||||
-outdir <dir> - Set language specific files output directory to <dir>\n\
|
||||
-outdir <dir> - Set language specific files output directory <dir>\n\
|
||||
-small - Compile in virtual elimination & compact mode\n\
|
||||
-swiglib - Report location of SWIG library and exit\n\
|
||||
-templatereduce - Reduce all the typedefs in templates\n\
|
||||
|
|
@ -154,7 +153,6 @@ static char *cpp_extension = (char *) "cxx";
|
|||
static char *depends_extension = (char *) "d";
|
||||
static String *outdir = 0;
|
||||
static String *xmlout = 0;
|
||||
static int outcurrentdir = 0;
|
||||
static int help = 0;
|
||||
static int checkout = 0;
|
||||
static int cpp_only = 0;
|
||||
|
|
@ -182,16 +180,14 @@ static String *dependencies_target = 0;
|
|||
static int external_runtime = 0;
|
||||
static String *external_runtime_name = 0;
|
||||
enum { STAGE1=1, STAGE2=2, STAGE3=4, STAGE4=8, STAGEOVERFLOW=16 };
|
||||
static List *all_output_files = 0;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// check_suffix()
|
||||
// check_suffix(char *name)
|
||||
//
|
||||
// Checks the suffix of a file to see if we should emit extern declarations.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
static int check_suffix(String *filename) {
|
||||
const char *name = Char(filename);
|
||||
static int check_suffix(const char *name) {
|
||||
const char *c;
|
||||
if (!name)
|
||||
return 0;
|
||||
|
|
@ -285,7 +281,7 @@ static void set_outdir(const String *c_wrapper_file_dir) {
|
|||
}
|
||||
|
||||
/* This function sets the name of the configuration file */
|
||||
void SWIG_config_file(const_String_or_char_ptr filename) {
|
||||
void SWIG_config_file(const String_or_char *filename) {
|
||||
lang_config = NewString(filename);
|
||||
}
|
||||
|
||||
|
|
@ -304,11 +300,6 @@ void SWIG_config_cppext(const char *ext) {
|
|||
cpp_extension = (char *) ext;
|
||||
}
|
||||
|
||||
List *SWIG_output_files() {
|
||||
assert(all_output_files);
|
||||
return all_output_files;
|
||||
}
|
||||
|
||||
void SWIG_setfeature(const char *cfeature, const char *cvalue) {
|
||||
Hash *features_hash = Swig_cparse_features();
|
||||
String *name = NewString("");
|
||||
|
|
@ -372,14 +363,13 @@ static void SWIG_dump_runtime() {
|
|||
}
|
||||
}
|
||||
|
||||
runtime = NewFile(outfile, "w", SWIG_output_files());
|
||||
runtime = NewFile(outfile, "w");
|
||||
if (!runtime) {
|
||||
FileErrorDisplay(outfile);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
Swig_banner(runtime);
|
||||
Printf(runtime, "\n");
|
||||
|
||||
s = Swig_include_sys("swiglabels.swg");
|
||||
if (!s) {
|
||||
|
|
@ -698,9 +688,6 @@ void SWIG_getoptions(int argc, char *argv[]) {
|
|||
} else {
|
||||
Swig_arg_error();
|
||||
}
|
||||
} else if (strcmp(argv[i], "-outcurrentdir") == 0) {
|
||||
Swig_mark_arg(i);
|
||||
outcurrentdir = 1;
|
||||
} else if (strcmp(argv[i], "-Wall") == 0) {
|
||||
Swig_mark_arg(i);
|
||||
Swig_warnall();
|
||||
|
|
@ -880,7 +867,6 @@ int SWIG_main(int argc, char *argv[], Language *l) {
|
|||
}
|
||||
|
||||
libfiles = NewList();
|
||||
all_output_files = NewList();
|
||||
|
||||
/* Check for SWIG_FEATURES environment variable */
|
||||
|
||||
|
|
@ -938,13 +924,12 @@ int SWIG_main(int argc, char *argv[], Language *l) {
|
|||
|
||||
// If we made it this far, looks good. go for it....
|
||||
|
||||
input_file = NewString(argv[argc - 1]);
|
||||
Swig_filename_correct(input_file);
|
||||
input_file = argv[argc - 1];
|
||||
|
||||
// If the user has requested to check out a file, handle that
|
||||
if (checkout) {
|
||||
DOH *s;
|
||||
char *outfile = Char(input_file);
|
||||
char *outfile = input_file;
|
||||
if (outfile_name)
|
||||
outfile = outfile_name;
|
||||
|
||||
|
|
@ -953,26 +938,30 @@ int SWIG_main(int argc, char *argv[], Language *l) {
|
|||
|
||||
s = Swig_include(input_file);
|
||||
if (!s) {
|
||||
Printf(stderr, "Unable to locate '%s' in the SWIG library.\n", input_file);
|
||||
fprintf(stderr, "Unable to locate '%s' in the SWIG library.\n", input_file);
|
||||
} else {
|
||||
FILE *f = Swig_open(outfile);
|
||||
FILE *f = fopen(outfile, "r");
|
||||
if (f) {
|
||||
fclose(f);
|
||||
Printf(stderr, "File '%s' already exists. Checkout aborted.\n", outfile);
|
||||
fprintf(stderr, "File '%s' already exists. Checkout aborted.\n", outfile);
|
||||
} else {
|
||||
File *f_outfile = NewFile(outfile, "w", SWIG_output_files());
|
||||
if (!f_outfile) {
|
||||
FileErrorDisplay(outfile);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
} else {
|
||||
if (Verbose)
|
||||
Printf(stdout, "'%s' checked out from the SWIG library.\n", outfile);
|
||||
Printv(f_outfile, s, NIL);
|
||||
Close(f_outfile);
|
||||
}
|
||||
f = fopen(outfile, "w");
|
||||
if (!f) {
|
||||
fprintf(stderr, "Unable to create file '%s'\n", outfile);
|
||||
} else {
|
||||
if (Verbose)
|
||||
fprintf(stdout, "'%s' checked out from the SWIG library.\n", input_file);
|
||||
fputs(Char(s), f);
|
||||
fclose(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Check the suffix for a .c file. If so, we're going to
|
||||
// declare everything we see as "extern"
|
||||
|
||||
ForceExtern = check_suffix(input_file);
|
||||
|
||||
// Run the preprocessor
|
||||
if (Verbose)
|
||||
printf("Preprocessing...\n");
|
||||
|
|
@ -982,22 +971,17 @@ int SWIG_main(int argc, char *argv[], Language *l) {
|
|||
String *fs = NewString("");
|
||||
FILE *df = Swig_open(input_file);
|
||||
if (!df) {
|
||||
df = Swig_include_open(input_file);
|
||||
if (!df) {
|
||||
char *cfile = Char(input_file);
|
||||
if (cfile && cfile[0] == '-') {
|
||||
Printf(stderr, "Unable to find option or file '%s', ", input_file);
|
||||
Printf(stderr, "use 'swig -help' for more information.\n");
|
||||
} else {
|
||||
Printf(stderr, "Unable to find file '%s'.\n", input_file);
|
||||
}
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
char *cfile = Char(input_file);
|
||||
if (cfile && cfile[0] == '-') {
|
||||
Printf(stderr, "Unable to find option or file '%s', ", input_file);
|
||||
Printf(stderr, "use 'swig -help' for more information.\n");
|
||||
} else {
|
||||
Swig_warning(WARN_DEPRECATED_INPUT_FILE, "SWIG", 1, "Use of the include path to find the input file is deprecated and will not work with ccache. Please include the path when specifying the input file.\n"); // so that behaviour is like c/c++ compilers
|
||||
Printf(stderr, "Unable to find file '%s'.\n", input_file);
|
||||
}
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
fclose(df);
|
||||
if (!no_cpp) {
|
||||
fclose(df);
|
||||
Printf(fs, "%%include <swig.swg>\n");
|
||||
if (allkw) {
|
||||
Printf(fs, "%%include <allkw.swg>\n");
|
||||
|
|
@ -1005,7 +989,7 @@ int SWIG_main(int argc, char *argv[], Language *l) {
|
|||
if (lang_config) {
|
||||
Printf(fs, "\n%%include <%s>\n", lang_config);
|
||||
}
|
||||
Printf(fs, "%%include(maininput=\"%s\") \"%s\"\n", Swig_filename_escape(input_file), Swig_last_file());
|
||||
Printf(fs, "%%include \"%s\"\n", Swig_last_file());
|
||||
for (i = 0; i < Len(libfiles); i++) {
|
||||
Printf(fs, "\n%%include \"%s\"\n", Getitem(libfiles, i));
|
||||
}
|
||||
|
|
@ -1013,8 +997,8 @@ int SWIG_main(int argc, char *argv[], Language *l) {
|
|||
cpps = Preprocessor_parse(fs);
|
||||
Delete(fs);
|
||||
} else {
|
||||
cpps = Swig_read_file(df);
|
||||
fclose(df);
|
||||
df = Swig_open(input_file);
|
||||
cpps = NewFileFromFile(df);
|
||||
}
|
||||
if (Swig_error_count()) {
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
|
|
@ -1024,55 +1008,47 @@ int SWIG_main(int argc, char *argv[], Language *l) {
|
|||
SWIG_exit(EXIT_SUCCESS);
|
||||
}
|
||||
if (depend) {
|
||||
if (!no_cpp) {
|
||||
String *outfile;
|
||||
|
||||
char *basename = Swig_file_basename(outcurrentdir ? Swig_file_filename(input_file): Char(input_file));
|
||||
if (!outfile_name) {
|
||||
if (CPlusPlus || lang->cplus_runtime_mode()) {
|
||||
outfile = NewStringf("%s_wrap.%s", basename, cpp_extension);
|
||||
} else {
|
||||
outfile = NewStringf("%s_wrap.c", basename);
|
||||
}
|
||||
String *outfile;
|
||||
if (!outfile_name) {
|
||||
if (CPlusPlus || lang->cplus_runtime_mode()) {
|
||||
outfile = NewStringf("%s_wrap.%s", Swig_file_basename(input_file), cpp_extension);
|
||||
} else {
|
||||
outfile = NewString(outfile_name);
|
||||
outfile = NewStringf("%s_wrap.c", Swig_file_basename(input_file));
|
||||
}
|
||||
if (dependencies_file && Len(dependencies_file) != 0) {
|
||||
f_dependencies_file = NewFile(dependencies_file, "w", SWIG_output_files());
|
||||
if (!f_dependencies_file) {
|
||||
FileErrorDisplay(dependencies_file);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
} else if (!depend_only) {
|
||||
String *filename = NewStringf("%s_wrap.%s", basename, depends_extension);
|
||||
f_dependencies_file = NewFile(filename, "w", SWIG_output_files());
|
||||
if (!f_dependencies_file) {
|
||||
FileErrorDisplay(filename);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
} else
|
||||
f_dependencies_file = stdout;
|
||||
if (dependencies_target) {
|
||||
Printf(f_dependencies_file, "%s: ", dependencies_target);
|
||||
} else {
|
||||
Printf(f_dependencies_file, "%s: ", outfile);
|
||||
}
|
||||
List *files = Preprocessor_depend();
|
||||
for (int i = 0; i < Len(files); i++) {
|
||||
if ((depend != 2) || ((depend == 2) && (Strncmp(Getitem(files, i), SwigLib, Len(SwigLib)) != 0))) {
|
||||
Printf(f_dependencies_file, "\\\n %s ", Getitem(files, i));
|
||||
}
|
||||
}
|
||||
Printf(f_dependencies_file, "\n");
|
||||
if (f_dependencies_file != stdout)
|
||||
Close(f_dependencies_file);
|
||||
if (depend_only)
|
||||
SWIG_exit(EXIT_SUCCESS);
|
||||
} else {
|
||||
Printf(stderr, "Cannot generate dependencies with -nopreprocess\n");
|
||||
// Actually we could but it would be inefficient when just generating dependencies, as it would be done after Swig_cparse
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
outfile = NewString(outfile_name);
|
||||
}
|
||||
if (dependencies_file && Len(dependencies_file) != 0) {
|
||||
f_dependencies_file = NewFile(dependencies_file, "w");
|
||||
if (!f_dependencies_file) {
|
||||
FileErrorDisplay(dependencies_file);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
} else if (!depend_only) {
|
||||
String *filename = NewStringf("%s_wrap.%s", Swig_file_basename(input_file), depends_extension);
|
||||
f_dependencies_file = NewFile(filename, "w");
|
||||
if (!f_dependencies_file) {
|
||||
FileErrorDisplay(filename);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
} else
|
||||
f_dependencies_file = stdout;
|
||||
if (dependencies_target) {
|
||||
Printf(f_dependencies_file, "%s: ", dependencies_target);
|
||||
} else {
|
||||
Printf(f_dependencies_file, "%s: ", outfile);
|
||||
}
|
||||
List *files = Preprocessor_depend();
|
||||
for (int i = 0; i < Len(files); i++) {
|
||||
if ((depend != 2) || ((depend == 2) && (Strncmp(Getitem(files, i), SwigLib, Len(SwigLib)) != 0))) {
|
||||
Printf(f_dependencies_file, "\\\n %s ", Getitem(files, i));
|
||||
}
|
||||
}
|
||||
Printf(f_dependencies_file, "\n");
|
||||
if (f_dependencies_file != stdout)
|
||||
Close(f_dependencies_file);
|
||||
if (depend_only)
|
||||
SWIG_exit(EXIT_SUCCESS);
|
||||
}
|
||||
Seek(cpps, 0, SEEK_SET);
|
||||
}
|
||||
|
|
@ -1150,30 +1126,22 @@ int SWIG_main(int argc, char *argv[], Language *l) {
|
|||
}
|
||||
if (top) {
|
||||
if (!Getattr(top, "name")) {
|
||||
Printf(stderr, "No module name specified using %%module or -module.\n");
|
||||
Printf(stderr, "*** No module name specified using %%module or -module.\n");
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
} else {
|
||||
/* Set some filename information on the object */
|
||||
String *infile = scanner_get_main_input_file();
|
||||
if (!infile) {
|
||||
Printf(stderr, "Missing input file in preprocessed output.\n");
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
Setattr(top, "infile", infile); // Note: if nopreprocess then infile is the original input file, otherwise input_file
|
||||
Setattr(top, "inputfile", input_file);
|
||||
|
||||
char *basename = Swig_file_basename(outcurrentdir ? Swig_file_filename(infile): Char(infile));
|
||||
Setattr(top, "infile", input_file);
|
||||
if (!outfile_name) {
|
||||
if (CPlusPlus || lang->cplus_runtime_mode()) {
|
||||
Setattr(top, "outfile", NewStringf("%s_wrap.%s", basename, cpp_extension));
|
||||
Setattr(top, "outfile", NewStringf("%s_wrap.%s", Swig_file_basename(input_file), cpp_extension));
|
||||
} else {
|
||||
Setattr(top, "outfile", NewStringf("%s_wrap.c", basename));
|
||||
Setattr(top, "outfile", NewStringf("%s_wrap.c", Swig_file_basename(input_file)));
|
||||
}
|
||||
} else {
|
||||
Setattr(top, "outfile", outfile_name);
|
||||
}
|
||||
if (!outfile_name_h) {
|
||||
Setattr(top, "outfile_h", NewStringf("%s_wrap.%s", basename, hpp_extension));
|
||||
Setattr(top, "outfile_h", NewStringf("%s_wrap.%s", Swig_file_basename(input_file), hpp_extension));
|
||||
} else {
|
||||
Setattr(top, "outfile_h", outfile_name_h);
|
||||
}
|
||||
|
|
@ -1181,12 +1149,7 @@ int SWIG_main(int argc, char *argv[], Language *l) {
|
|||
if (Swig_contract_mode_get()) {
|
||||
Swig_contracts(top);
|
||||
}
|
||||
|
||||
// Check the suffix for a c/c++ file. If so, we're going to declare everything we see as "extern"
|
||||
ForceExtern = check_suffix(input_file);
|
||||
|
||||
lang->top(top);
|
||||
|
||||
if (browse) {
|
||||
Swig_browser(top, 0);
|
||||
}
|
||||
|
|
@ -1210,21 +1173,6 @@ int SWIG_main(int argc, char *argv[], Language *l) {
|
|||
if (memory_debug)
|
||||
DohMemoryDebug();
|
||||
|
||||
char *outfiles = getenv("CCACHE_OUTFILES");
|
||||
if (outfiles) {
|
||||
File *f_outfiles = NewFile(outfiles, "w", 0);
|
||||
if (!f_outfiles) {
|
||||
Printf(stderr, "Failed to write list of output files to the filename '%s' specified in CCACHE_OUTFILES environment variable - ", outfiles);
|
||||
FileErrorDisplay(outfiles);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
} else {
|
||||
int i;
|
||||
for (i = 0; i < Len(all_output_files); i++)
|
||||
Printf(f_outfiles, "%s\n", Getitem(all_output_files, i));
|
||||
Close(f_outfiles);
|
||||
}
|
||||
}
|
||||
|
||||
// Deletes
|
||||
Delete(libfiles);
|
||||
Preprocessor_delete();
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ char cvsroot_modula3_cxx[] = "$Id$";
|
|||
#include <limits.h> // for INT_MAX
|
||||
#include <ctype.h>
|
||||
|
||||
#define USAGE_ARG_DIR "m3wrapargdir typemap expect values: in, out, inout\n"
|
||||
const char usageArgDir[] = "m3wrapargdir typemap expect values: in, out, inout\n";
|
||||
|
||||
class MODULA3:public Language {
|
||||
public:
|
||||
|
|
@ -172,7 +172,6 @@ private:
|
|||
const String *empty_string;
|
||||
|
||||
Hash *swig_types_hash;
|
||||
File *f_begin;
|
||||
File *f_runtime;
|
||||
File *f_header;
|
||||
File *f_wrappers;
|
||||
|
|
@ -238,7 +237,6 @@ public:
|
|||
MODULA3():
|
||||
empty_string(NewString("")),
|
||||
swig_types_hash(NULL),
|
||||
f_begin(NULL),
|
||||
f_runtime(NULL),
|
||||
f_header(NULL),
|
||||
f_wrappers(NULL),
|
||||
|
|
@ -376,7 +374,7 @@ MODULA3():
|
|||
} else if (Strcmp(dir, "out") == 0) {
|
||||
return false;
|
||||
} else {
|
||||
printf("%s", USAGE_ARG_DIR);
|
||||
printf(usageArgDir);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -388,7 +386,7 @@ MODULA3():
|
|||
} else if ((Strcmp(dir, "out") == 0) || (Strcmp(dir, "inout") == 0)) {
|
||||
return true;
|
||||
} else {
|
||||
printf("%s", USAGE_ARG_DIR);
|
||||
printf(usageArgDir);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -544,7 +542,7 @@ MODULA3():
|
|||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
File *openWriteFile(String *name) {
|
||||
File *file = NewFile(name, "w", SWIG_output_files());
|
||||
File *file = NewFile(name, "w");
|
||||
if (!file) {
|
||||
FileErrorDisplay(name);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
|
|
@ -904,12 +902,11 @@ MODULA3():
|
|||
/* Initialize all of the output files */
|
||||
outfile = Getattr(n, "outfile");
|
||||
|
||||
f_begin = NewFile(outfile, "w", SWIG_output_files());
|
||||
if (!f_begin) {
|
||||
f_runtime = NewFile(outfile, "w");
|
||||
if (!f_runtime) {
|
||||
FileErrorDisplay(outfile);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
f_runtime = NewString("");
|
||||
f_init = NewString("");
|
||||
f_header = NewString("");
|
||||
f_wrappers = NewString("");
|
||||
|
|
@ -919,7 +916,6 @@ MODULA3():
|
|||
/* Register file targets with the SWIG file handler */
|
||||
Swig_register_filebyname("header", f_header);
|
||||
Swig_register_filebyname("wrapper", f_wrappers);
|
||||
Swig_register_filebyname("begin", f_begin);
|
||||
Swig_register_filebyname("runtime", f_runtime);
|
||||
Swig_register_filebyname("init", f_init);
|
||||
|
||||
|
|
@ -960,11 +956,7 @@ MODULA3():
|
|||
module_imports = NewString("");
|
||||
upcasts_code = NewString("");
|
||||
|
||||
Swig_banner(f_begin);
|
||||
|
||||
Printf(f_runtime, "\n");
|
||||
Printf(f_runtime, "#define SWIGMODULA3\n");
|
||||
Printf(f_runtime, "\n");
|
||||
Swig_banner(f_runtime); // Print the SWIG banner message
|
||||
|
||||
Swig_name_register((char *) "wrapper", (char *) "Modula3_%f");
|
||||
if (old_variable_names) {
|
||||
|
|
@ -1151,16 +1143,14 @@ MODULA3():
|
|||
typemapfilename = NULL;
|
||||
|
||||
/* Close all of the files */
|
||||
Dump(f_runtime, f_begin);
|
||||
Dump(f_header, f_begin);
|
||||
Dump(f_wrappers, f_begin);
|
||||
Wrapper_pretty_print(f_init, f_begin);
|
||||
Dump(f_header, f_runtime);
|
||||
Dump(f_wrappers, f_runtime);
|
||||
Wrapper_pretty_print(f_init, f_runtime);
|
||||
Delete(f_header);
|
||||
Delete(f_wrappers);
|
||||
Delete(f_init);
|
||||
Close(f_begin);
|
||||
Close(f_runtime);
|
||||
Delete(f_runtime);
|
||||
Delete(f_begin);
|
||||
return SWIG_OK;
|
||||
}
|
||||
|
||||
|
|
@ -1169,9 +1159,14 @@ MODULA3():
|
|||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
void emitBanner(File *f) {
|
||||
Printf(f, "(*******************************************************************************\n");
|
||||
Swig_banner_target_lang(f, " *");
|
||||
Printf(f, "*******************************************************************************)\n\n");
|
||||
Printf(f, "\
|
||||
(*******************************************************************************\n\
|
||||
* This file was automatically generated by SWIG (http://www.swig.org/).\n\
|
||||
* Version %s\n\
|
||||
*\n\
|
||||
* Do not make changes to this file unless you know what you are doing --\n\
|
||||
* modify the SWIG interface file instead.\n\
|
||||
*******************************************************************************)\n\n", Swig_package_version());
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
|
@ -2387,7 +2382,7 @@ MODULA3():
|
|||
}
|
||||
|
||||
String *filen = NewStringf("%s%s.m3", Swig_file_dirname(outfile), proxy_class_name);
|
||||
f_proxy = NewFile(filen, "w", SWIG_output_files());
|
||||
f_proxy = NewFile(filen, "w");
|
||||
if (!f_proxy) {
|
||||
FileErrorDisplay(filen);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
|
|
@ -3179,7 +3174,8 @@ MODULA3():
|
|||
Clear(result_m3wraptype);
|
||||
Printv(result_m3wraptype, tm, NIL);
|
||||
} else {
|
||||
Swig_warning(WARN_MODULA3_TYPEMAP_MULTIPLE_RETURN, input_file, line_number,
|
||||
Swig_warning(WARN_MODULA3_TYPEMAP_MULTIPLE_RETURN,
|
||||
input_file, line_number,
|
||||
"Typemap m3wrapargdir set to 'out' for %s implies a RETURN value, but the routine %s has already one.\nUse %%multiretval feature.\n",
|
||||
SwigType_str(Getattr(p, "type"), 0), raw_name);
|
||||
}
|
||||
|
|
@ -3766,7 +3762,7 @@ MODULA3():
|
|||
|
||||
void emitTypeWrapperClass(String *classname, SwigType *type) {
|
||||
String *filen = NewStringf("%s%s.m3", Swig_file_dirname(outfile), classname);
|
||||
File *f_swigtype = NewFile(filen, "w", SWIG_output_files());
|
||||
File *f_swigtype = NewFile(filen, "w");
|
||||
if (!f_swigtype) {
|
||||
FileErrorDisplay(filen);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ static String *module = 0;
|
|||
static char *mzscheme_path = (char *) "mzscheme";
|
||||
static String *init_func_def = 0;
|
||||
|
||||
static File *f_begin = 0;
|
||||
static File *f_runtime = 0;
|
||||
static File *f_header = 0;
|
||||
static File *f_wrappers = 0;
|
||||
|
|
@ -130,12 +129,11 @@ public:
|
|||
/* Initialize all of the output files */
|
||||
String *outfile = Getattr(n, "outfile");
|
||||
|
||||
f_begin = NewFile(outfile, "w", SWIG_output_files());
|
||||
if (!f_begin) {
|
||||
f_runtime = NewFile(outfile, "w");
|
||||
if (!f_runtime) {
|
||||
FileErrorDisplay(outfile);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
f_runtime = NewString("");
|
||||
f_init = NewString("");
|
||||
f_header = NewString("");
|
||||
f_wrappers = NewString("");
|
||||
|
|
@ -143,17 +141,13 @@ public:
|
|||
/* Register file targets with the SWIG file handler */
|
||||
Swig_register_filebyname("header", f_header);
|
||||
Swig_register_filebyname("wrapper", f_wrappers);
|
||||
Swig_register_filebyname("begin", f_begin);
|
||||
Swig_register_filebyname("runtime", f_runtime);
|
||||
|
||||
init_func_def = NewString("");
|
||||
Swig_register_filebyname("init", init_func_def);
|
||||
|
||||
Swig_banner(f_begin);
|
||||
|
||||
Printf(f_runtime, "\n");
|
||||
Printf(f_runtime, "#define SWIGMZSCHEME\n");
|
||||
Printf(f_runtime, "\n");
|
||||
Printf(f_runtime, "/* -*- buffer-read-only: t -*- vi: set ro: */\n");
|
||||
Swig_banner(f_runtime);
|
||||
|
||||
module = Getattr(n, "name");
|
||||
|
||||
|
|
@ -192,16 +186,14 @@ public:
|
|||
}
|
||||
|
||||
/* Close all of the files */
|
||||
Dump(f_runtime, f_begin);
|
||||
Dump(f_header, f_begin);
|
||||
Dump(f_wrappers, f_begin);
|
||||
Wrapper_pretty_print(f_init, f_begin);
|
||||
Dump(f_header, f_runtime);
|
||||
Dump(f_wrappers, f_runtime);
|
||||
Wrapper_pretty_print(f_init, f_runtime);
|
||||
Delete(f_header);
|
||||
Delete(f_wrappers);
|
||||
Delete(f_init);
|
||||
Close(f_begin);
|
||||
Close(f_runtime);
|
||||
Delete(f_runtime);
|
||||
Delete(f_begin);
|
||||
return SWIG_OK;
|
||||
}
|
||||
|
||||
|
|
|
|||
112
Source/Modules/ocaml.cxx
Normal file → Executable file
112
Source/Modules/ocaml.cxx
Normal file → Executable file
|
|
@ -38,7 +38,6 @@ static Hash *seen_enumvalues = 0;
|
|||
static Hash *seen_constructors = 0;
|
||||
|
||||
static File *f_header = 0;
|
||||
static File *f_begin = 0;
|
||||
static File *f_runtime = 0;
|
||||
static File *f_wrappers = 0;
|
||||
static File *f_directors = 0;
|
||||
|
|
@ -215,12 +214,11 @@ public:
|
|||
/* Initialize all of the output files */
|
||||
String *outfile = Getattr(n, "outfile");
|
||||
|
||||
f_begin = NewFile(outfile, "w", SWIG_output_files());
|
||||
if (!f_begin) {
|
||||
f_runtime = NewFile(outfile, "w");
|
||||
if (!f_runtime) {
|
||||
FileErrorDisplay(outfile);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
f_runtime = NewString("");
|
||||
f_init = NewString("");
|
||||
f_header = NewString("");
|
||||
f_wrappers = NewString("");
|
||||
|
|
@ -249,7 +247,6 @@ public:
|
|||
Swig_register_filebyname("init", init_func_def);
|
||||
Swig_register_filebyname("header", f_header);
|
||||
Swig_register_filebyname("wrapper", f_wrappers);
|
||||
Swig_register_filebyname("begin", f_begin);
|
||||
Swig_register_filebyname("runtime", f_runtime);
|
||||
Swig_register_filebyname("mli", f_mlibody);
|
||||
Swig_register_filebyname("ml", f_mlbody);
|
||||
|
|
@ -265,10 +262,7 @@ public:
|
|||
Swig_name_register("get", "%v__get__");
|
||||
}
|
||||
|
||||
Swig_banner(f_begin);
|
||||
|
||||
Printf(f_runtime, "\n");
|
||||
Printf(f_runtime, "#define SWIGOCAML\n");
|
||||
Printf(f_runtime, "/* -*- buffer-read-only: t -*- vi: set ro: */\n");
|
||||
Printf(f_runtime, "#define SWIG_MODULE \"%s\"\n", module);
|
||||
/* Module name */
|
||||
Printf(f_mlbody, "let module_name = \"%s\"\n", module);
|
||||
|
|
@ -282,12 +276,12 @@ public:
|
|||
|
||||
Printf(f_int_to_enum, "let int_to_enum x y =\n" " match (x : c_enum_type) with\n" " `unknown -> C_enum (`Int y)\n");
|
||||
|
||||
Swig_banner(f_runtime);
|
||||
|
||||
if (directorsEnabled()) {
|
||||
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");
|
||||
|
|
@ -299,12 +293,12 @@ public:
|
|||
Printv(mlifile, module, ".mli", NIL);
|
||||
|
||||
String *mlfilen = NewStringf("%s%s", SWIG_output_directory(), mlfile);
|
||||
if ((f_mlout = NewFile(mlfilen, "w", SWIG_output_files())) == 0) {
|
||||
if ((f_mlout = NewFile(mlfilen, "w")) == 0) {
|
||||
FileErrorDisplay(mlfilen);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
String *mlifilen = NewStringf("%s%s", SWIG_output_directory(), mlifile);
|
||||
if ((f_mliout = NewFile(mlifilen, "w", SWIG_output_files())) == 0) {
|
||||
if ((f_mliout = NewFile(mlifilen, "w")) == 0) {
|
||||
FileErrorDisplay(mlifilen);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
|
|
@ -328,18 +322,16 @@ public:
|
|||
|
||||
SwigType_emit_type_table(f_runtime, f_wrappers);
|
||||
/* Close all of the files */
|
||||
Dump(f_runtime, f_begin);
|
||||
Dump(f_directors_h, f_header);
|
||||
Dump(f_header, f_begin);
|
||||
Dump(f_header, f_runtime);
|
||||
Dump(f_directors, f_wrappers);
|
||||
Dump(f_wrappers, f_begin);
|
||||
Wrapper_pretty_print(f_init, f_begin);
|
||||
Dump(f_wrappers, f_runtime);
|
||||
Wrapper_pretty_print(f_init, f_runtime);
|
||||
Delete(f_header);
|
||||
Delete(f_wrappers);
|
||||
Delete(f_init);
|
||||
Close(f_begin);
|
||||
Close(f_runtime);
|
||||
Delete(f_runtime);
|
||||
Delete(f_begin);
|
||||
|
||||
Dump(f_enumtypes_type, f_mlout);
|
||||
Dump(f_enumtypes_value, f_mlout);
|
||||
|
|
@ -1300,50 +1292,56 @@ public:
|
|||
* which means looking up and registering by typedef and enum name. */
|
||||
int enumDeclaration(Node *n) {
|
||||
String *name = Getattr(n, "name");
|
||||
if (name) {
|
||||
String *oname = NewString(name);
|
||||
/* name is now fully qualified */
|
||||
String *fully_qualified_name = NewString(name);
|
||||
bool seen_enum = false;
|
||||
if (name_qualifier)
|
||||
Delete(name_qualifier);
|
||||
char *strip_position;
|
||||
name_qualifier = fully_qualify_enum_name(n, NewString(""));
|
||||
String *oname = name ? NewString(name) : NULL;
|
||||
/* name is now fully qualified */
|
||||
String *fully_qualified_name = NewString(name);
|
||||
bool seen_enum = false;
|
||||
if (name_qualifier)
|
||||
Delete(name_qualifier);
|
||||
char *strip_position;
|
||||
name_qualifier = fully_qualify_enum_name(n, NewString(""));
|
||||
|
||||
/* Recent changes have distrubed enum and template naming again.
|
||||
* Will try to keep it consistent by can't guarantee much given
|
||||
* that these things move around a lot.
|
||||
*
|
||||
* I need to figure out a way to isolate this module better.
|
||||
*/
|
||||
if (oname) {
|
||||
strip_position = strstr(Char(oname), "::");
|
||||
|
||||
while (strip_position) {
|
||||
strip_position += 2;
|
||||
oname = NewString(strip_position);
|
||||
strip_position = strstr(Char(oname), "::");
|
||||
strip_position += 2;
|
||||
oname = NewString(strip_position);
|
||||
strip_position = strstr(Char(oname), "::");
|
||||
}
|
||||
}
|
||||
|
||||
seen_enum = oname ? (Getattr(seen_enums, fully_qualified_name) ? true : false) : false;
|
||||
|
||||
if (oname && !seen_enum) {
|
||||
const_enum = true;
|
||||
Printf(f_enum_to_int, "| `%s -> (match y with\n", oname);
|
||||
Printf(f_int_to_enum, "| `%s -> C_enum (\n", oname);
|
||||
/* * * * A note about enum name resolution * * * *
|
||||
* This code should now work, but I think we can do a bit better.
|
||||
* The problem I'm having is that swig isn't very precise about
|
||||
* typedef name resolution. My opinion is that SwigType_typedef
|
||||
* resolve_all should *always* return the enum tag if one exists,
|
||||
* rather than the admittedly friendlier enclosing typedef.
|
||||
*
|
||||
* This would make one of the cases below unnecessary.
|
||||
* * * */
|
||||
Printf(f_mlbody, "let _ = Callback.register \"%s_marker\" (`%s)\n", fully_qualified_name, oname);
|
||||
if (!strncmp(Char(fully_qualified_name), "enum ", 5)) {
|
||||
String *fq_noenum = NewString(Char(fully_qualified_name) + 5);
|
||||
Printf(f_mlbody,
|
||||
"let _ = Callback.register \"%s_marker\" (`%s)\n" "let _ = Callback.register \"%s_marker\" (`%s)\n", fq_noenum, oname, fq_noenum, name);
|
||||
}
|
||||
|
||||
seen_enum = (Getattr(seen_enums, fully_qualified_name) ? true : false);
|
||||
|
||||
if (!seen_enum) {
|
||||
const_enum = true;
|
||||
Printf(f_enum_to_int, "| `%s -> (match y with\n", oname);
|
||||
Printf(f_int_to_enum, "| `%s -> C_enum (\n", oname);
|
||||
/* * * * A note about enum name resolution * * * *
|
||||
* This code should now work, but I think we can do a bit better.
|
||||
* The problem I'm having is that swig isn't very precise about
|
||||
* typedef name resolution. My opinion is that SwigType_typedef
|
||||
* resolve_all should *always* return the enum tag if one exists,
|
||||
* rather than the admittedly friendlier enclosing typedef.
|
||||
*
|
||||
* This would make one of the cases below unnecessary.
|
||||
* * * */
|
||||
Printf(f_mlbody, "let _ = Callback.register \"%s_marker\" (`%s)\n", fully_qualified_name, oname);
|
||||
if (!strncmp(Char(fully_qualified_name), "enum ", 5)) {
|
||||
String *fq_noenum = NewString(Char(fully_qualified_name) + 5);
|
||||
Printf(f_mlbody,
|
||||
"let _ = Callback.register \"%s_marker\" (`%s)\n" "let _ = Callback.register \"%s_marker\" (`%s)\n", fq_noenum, oname, fq_noenum, name);
|
||||
}
|
||||
|
||||
Printf(f_enumtypes_type, "| `%s\n", oname);
|
||||
Insert(fully_qualified_name, 0, "enum ");
|
||||
Setattr(seen_enums, fully_qualified_name, n);
|
||||
}
|
||||
Printf(f_enumtypes_type, "| `%s\n", oname);
|
||||
Insert(fully_qualified_name, 0, "enum ");
|
||||
Setattr(seen_enums, fully_qualified_name, n);
|
||||
}
|
||||
|
||||
int ret = Language::enumDeclaration(n);
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
* Octave language module for SWIG.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
char cvsroot_octave_cxx[] = "$Id: octave.cxx 10538 2008-06-21 14:51:02Z maciekd $";
|
||||
char cvsroot_octave_cxx[] = "$Id$";
|
||||
|
||||
#include "swigmod.h"
|
||||
|
||||
|
|
@ -18,7 +18,6 @@ Octave Options (available with -octave)\n\
|
|||
|
||||
class OCTAVE:public Language {
|
||||
private:
|
||||
File *f_begin;
|
||||
File *f_runtime;
|
||||
File *f_header;
|
||||
File *f_doc;
|
||||
|
|
@ -38,16 +37,9 @@ private:
|
|||
Hash *docs;
|
||||
|
||||
public:
|
||||
OCTAVE():f_begin(0), f_runtime(0), f_header(0), f_doc(0), f_wrappers(0),
|
||||
OCTAVE():f_runtime(0), f_header(0), f_doc(0), f_wrappers(0),
|
||||
f_init(0), f_initbeforefunc(0), f_directors(0), f_directors_h(0),
|
||||
s_global_tab(0), s_members_tab(0), class_name(0) {
|
||||
/* Add code to manage protected constructors and directors */
|
||||
director_prot_ctor_code = NewString("");
|
||||
Printv(director_prot_ctor_code,
|
||||
"if ( $comparison ) { /* subclassed */\n",
|
||||
" $director_new \n",
|
||||
"} else {\n", " error(\"accessing abstract class or protected constructor\"); \n", " SWIG_fail;\n", "}\n", NIL);
|
||||
|
||||
enable_cplus_runtime_mode();
|
||||
allow_overloading();
|
||||
director_multiple_inheritance = 1;
|
||||
|
|
@ -95,12 +87,11 @@ public:
|
|||
|
||||
String *module = Getattr(n, "name");
|
||||
String *outfile = Getattr(n, "outfile");
|
||||
f_begin = NewFile(outfile, "w", SWIG_output_files());
|
||||
if (!f_begin) {
|
||||
f_runtime = NewFile(outfile, "w");
|
||||
if (!f_runtime) {
|
||||
FileErrorDisplay(outfile);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
f_runtime = NewString("");
|
||||
f_header = NewString("");
|
||||
f_doc = NewString("");
|
||||
f_wrappers = NewString("");
|
||||
|
|
@ -109,7 +100,6 @@ public:
|
|||
f_directors_h = NewString("");
|
||||
f_directors = NewString("");
|
||||
s_global_tab = NewString("");
|
||||
Swig_register_filebyname("begin", f_begin);
|
||||
Swig_register_filebyname("runtime", f_runtime);
|
||||
Swig_register_filebyname("header", f_header);
|
||||
Swig_register_filebyname("doc", f_doc);
|
||||
|
|
@ -118,16 +108,11 @@ public:
|
|||
Swig_register_filebyname("initbeforefunc", f_initbeforefunc);
|
||||
Swig_register_filebyname("director", f_directors);
|
||||
Swig_register_filebyname("director_h", f_directors_h);
|
||||
|
||||
Swig_banner(f_begin);
|
||||
|
||||
Printf(f_runtime, "\n");
|
||||
Printf(f_runtime, "#define SWIGOCTAVE\n");
|
||||
Swig_banner(f_runtime);
|
||||
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");
|
||||
|
|
@ -135,7 +120,6 @@ 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");
|
||||
|
|
@ -159,16 +143,15 @@ public:
|
|||
|
||||
Printv(f_wrappers, s_global_tab, NIL);
|
||||
SwigType_emit_type_table(f_runtime, f_wrappers);
|
||||
Dump(f_runtime, f_begin);
|
||||
Dump(f_header, f_begin);
|
||||
Dump(f_doc, f_begin);
|
||||
Dump(f_header, f_runtime);
|
||||
Dump(f_doc, f_runtime);
|
||||
if (directorsEnabled()) {
|
||||
Dump(f_directors_h, f_begin);
|
||||
Dump(f_directors, f_begin);
|
||||
Dump(f_directors_h, f_runtime);
|
||||
Dump(f_directors, f_runtime);
|
||||
}
|
||||
Dump(f_wrappers, f_begin);
|
||||
Dump(f_initbeforefunc, f_begin);
|
||||
Wrapper_pretty_print(f_init, f_begin);
|
||||
Dump(f_wrappers, f_runtime);
|
||||
Dump(f_initbeforefunc, f_runtime);
|
||||
Wrapper_pretty_print(f_init, f_runtime);
|
||||
|
||||
Delete(s_global_tab);
|
||||
Delete(f_initbeforefunc);
|
||||
|
|
@ -178,9 +161,8 @@ public:
|
|||
Delete(f_header);
|
||||
Delete(f_directors);
|
||||
Delete(f_directors_h);
|
||||
Close(f_begin);
|
||||
Close(f_runtime);
|
||||
Delete(f_runtime);
|
||||
Delete(f_begin);
|
||||
|
||||
return SWIG_OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -316,7 +316,7 @@ static bool print_typecheck(String *f, int j, Parm *pj) {
|
|||
* ReplaceFormat()
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
static String *ReplaceFormat(const_String_or_char_ptr fmt, int j) {
|
||||
static String *ReplaceFormat(const String_or_char *fmt, int j) {
|
||||
String *lfmt = NewString(fmt);
|
||||
char buf[50];
|
||||
sprintf(buf, "%d", j);
|
||||
|
|
@ -352,7 +352,7 @@ static String *ReplaceFormat(const_String_or_char_ptr fmt, int j) {
|
|||
/*
|
||||
Cast dispatch mechanism.
|
||||
*/
|
||||
String *Swig_overload_dispatch_cast(Node *n, const_String_or_char_ptr fmt, int *maxargs) {
|
||||
String *Swig_overload_dispatch_cast(Node *n, const String_or_char *fmt, int *maxargs) {
|
||||
int i, j;
|
||||
|
||||
*maxargs = 1;
|
||||
|
|
@ -536,7 +536,7 @@ String *Swig_overload_dispatch_cast(Node *n, const_String_or_char_ptr fmt, int *
|
|||
/*
|
||||
Fast dispatch mechanism, provided by Salvador Fandi~no Garc'ia (#930586).
|
||||
*/
|
||||
String *Swig_overload_dispatch_fast(Node *n, const_String_or_char_ptr fmt, int *maxargs) {
|
||||
String *Swig_overload_dispatch_fast(Node *n, const String_or_char *fmt, int *maxargs) {
|
||||
int i, j;
|
||||
|
||||
*maxargs = 1;
|
||||
|
|
@ -695,7 +695,7 @@ String *Swig_overload_dispatch_fast(Node *n, const_String_or_char_ptr fmt, int *
|
|||
return f;
|
||||
}
|
||||
|
||||
String *Swig_overload_dispatch(Node *n, const_String_or_char_ptr fmt, int *maxargs) {
|
||||
String *Swig_overload_dispatch(Node *n, const String_or_char *fmt, int *maxargs) {
|
||||
|
||||
if (fast_dispatch_mode || GetFlag(n, "feature:fastdispatch")) {
|
||||
return Swig_overload_dispatch_fast(n, fmt, maxargs);
|
||||
|
|
|
|||
|
|
@ -78,7 +78,6 @@ static String *command_tab = 0;
|
|||
static String *constant_tab = 0;
|
||||
static String *variable_tab = 0;
|
||||
|
||||
static File *f_begin = 0;
|
||||
static File *f_runtime = 0;
|
||||
static File *f_header = 0;
|
||||
static File *f_wrappers = 0;
|
||||
|
|
@ -208,7 +207,6 @@ public:
|
|||
}
|
||||
|
||||
Preprocessor_define("SWIGPERL 1", 0);
|
||||
// SWIGPERL5 is deprecated, and no longer documented.
|
||||
Preprocessor_define("SWIGPERL5 1", 0);
|
||||
SWIG_typemap_lang("perl5");
|
||||
SWIG_config_file("perl5.swg");
|
||||
|
|
@ -224,12 +222,11 @@ public:
|
|||
/* Initialize all of the output files */
|
||||
String *outfile = Getattr(n, "outfile");
|
||||
|
||||
f_begin = NewFile(outfile, "w", SWIG_output_files());
|
||||
if (!f_begin) {
|
||||
f_runtime = NewFile(outfile, "w");
|
||||
if (!f_runtime) {
|
||||
FileErrorDisplay(outfile);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
f_runtime = NewString("");
|
||||
f_init = NewString("");
|
||||
f_header = NewString("");
|
||||
f_wrappers = NewString("");
|
||||
|
|
@ -237,7 +234,6 @@ public:
|
|||
/* Register file targets with the SWIG file handler */
|
||||
Swig_register_filebyname("header", f_header);
|
||||
Swig_register_filebyname("wrapper", f_wrappers);
|
||||
Swig_register_filebyname("begin", f_begin);
|
||||
Swig_register_filebyname("runtime", f_runtime);
|
||||
Swig_register_filebyname("init", f_init);
|
||||
|
||||
|
|
@ -256,12 +252,11 @@ public:
|
|||
constant_tab = NewString("static swig_constant_info swig_constants[] = {\n");
|
||||
variable_tab = NewString("static swig_variable_info swig_variables[] = {\n");
|
||||
|
||||
Swig_banner(f_begin);
|
||||
Swig_banner(f_runtime);
|
||||
|
||||
Printf(f_runtime, "\n");
|
||||
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
|
||||
|
|
@ -320,7 +315,7 @@ public:
|
|||
pmfile = NewStringf("%s.pm", m);
|
||||
}
|
||||
String *filen = NewStringf("%s%s", SWIG_output_directory(), pmfile);
|
||||
if ((f_pm = NewFile(filen, "w", SWIG_output_files())) == 0) {
|
||||
if ((f_pm = NewFile(filen, "w")) == 0) {
|
||||
FileErrorDisplay(filen);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
|
|
@ -337,7 +332,10 @@ public:
|
|||
Delete(boot_name);
|
||||
}
|
||||
|
||||
Swig_banner_target_lang(f_pm, "#");
|
||||
Printf(f_pm, "# This file was automatically generated by SWIG (http://www.swig.org).\n");
|
||||
Printf(f_pm, "# Version %s\n", Swig_package_version());
|
||||
Printf(f_pm, "#\n");
|
||||
Printf(f_pm, "# Don't modify this file, modify the SWIG interface instead.\n");
|
||||
Printf(f_pm, "\n");
|
||||
|
||||
Printf(f_pm, "package %s;\n", module);
|
||||
|
|
@ -526,16 +524,14 @@ public:
|
|||
Delete(underscore_module);
|
||||
|
||||
/* Close all of the files */
|
||||
Dump(f_runtime, f_begin);
|
||||
Dump(f_header, f_begin);
|
||||
Dump(f_wrappers, f_begin);
|
||||
Wrapper_pretty_print(f_init, f_begin);
|
||||
Dump(f_header, f_runtime);
|
||||
Dump(f_wrappers, f_runtime);
|
||||
Wrapper_pretty_print(f_init, f_runtime);
|
||||
Delete(f_header);
|
||||
Delete(f_wrappers);
|
||||
Delete(f_init);
|
||||
Close(f_begin);
|
||||
Close(f_runtime);
|
||||
Delete(f_runtime);
|
||||
Delete(f_begin);
|
||||
return SWIG_OK;
|
||||
}
|
||||
|
||||
|
|
@ -1145,9 +1141,8 @@ public:
|
|||
|
||||
/* Do some work on the class name */
|
||||
if (verbose > 0) {
|
||||
String *modulename = Getattr(clsmodule, "name");
|
||||
fprintf(stdout, "setclassname: Found sym:name: %s\n", Char(symname));
|
||||
fprintf(stdout, "setclassname: Found module: %s\n", Char(modulename));
|
||||
fprintf(stdout, "setclassname: Found module: %s\n", Char(clsmodule));
|
||||
fprintf(stdout, "setclassname: No package found\n");
|
||||
}
|
||||
|
||||
|
|
@ -1629,7 +1624,7 @@ public:
|
|||
} else if (Strcmp(code, "include") == 0) {
|
||||
/* Include a file into the .pm file */
|
||||
if (value) {
|
||||
FILE *f = Swig_include_open(value);
|
||||
FILE *f = Swig_open(value);
|
||||
if (!f) {
|
||||
Printf(stderr, "%s : Line %d. Unable to locate file %s\n", input_file, line_number, value);
|
||||
} else {
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -39,7 +39,6 @@ Pike Options (available with -pike)\n\
|
|||
class PIKE:public Language {
|
||||
private:
|
||||
|
||||
File *f_begin;
|
||||
File *f_runtime;
|
||||
File *f_header;
|
||||
File *f_wrappers;
|
||||
|
|
@ -70,7 +69,6 @@ public:
|
|||
* --------------------------------------------------------------------- */
|
||||
|
||||
PIKE() {
|
||||
f_begin = 0;
|
||||
f_runtime = 0;
|
||||
f_header = 0;
|
||||
f_wrappers = 0;
|
||||
|
|
@ -125,12 +123,11 @@ public:
|
|||
String *outfile = Getattr(n, "outfile");
|
||||
|
||||
/* Open the output file */
|
||||
f_begin = NewFile(outfile, "w", SWIG_output_files());
|
||||
if (!f_begin) {
|
||||
f_runtime = NewFile(outfile, "w");
|
||||
if (!f_runtime) {
|
||||
FileErrorDisplay(outfile);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
f_runtime = NewString("");
|
||||
f_init = NewString("");
|
||||
f_classInit = NewString("");
|
||||
f_header = NewString("");
|
||||
|
|
@ -139,17 +136,12 @@ public:
|
|||
/* Register file targets with the SWIG file handler */
|
||||
Swig_register_filebyname("header", f_header);
|
||||
Swig_register_filebyname("wrapper", f_wrappers);
|
||||
Swig_register_filebyname("begin", f_begin);
|
||||
Swig_register_filebyname("runtime", f_runtime);
|
||||
Swig_register_filebyname("init", f_init);
|
||||
Swig_register_filebyname("classInit", f_classInit);
|
||||
|
||||
/* Standard stuff for the SWIG runtime section */
|
||||
Swig_banner(f_begin);
|
||||
|
||||
Printf(f_runtime, "\n");
|
||||
Printf(f_runtime, "#define SWIGPIKE\n");
|
||||
Printf(f_runtime, "\n");
|
||||
Swig_banner(f_runtime);
|
||||
|
||||
Printf(f_header, "#define SWIG_init pike_module_init\n");
|
||||
Printf(f_header, "#define SWIG_name \"%s\"\n\n", module);
|
||||
|
|
@ -169,19 +161,17 @@ public:
|
|||
SwigType_emit_type_table(f_runtime, f_wrappers);
|
||||
|
||||
/* Close all of the files */
|
||||
Dump(f_runtime, f_begin);
|
||||
Dump(f_header, f_begin);
|
||||
Dump(f_wrappers, f_begin);
|
||||
Wrapper_pretty_print(f_init, f_begin);
|
||||
Dump(f_header, f_runtime);
|
||||
Dump(f_wrappers, f_runtime);
|
||||
Wrapper_pretty_print(f_init, f_runtime);
|
||||
|
||||
Delete(f_header);
|
||||
Delete(f_wrappers);
|
||||
Delete(f_init);
|
||||
Delete(f_classInit);
|
||||
|
||||
Close(f_begin);
|
||||
Close(f_runtime);
|
||||
Delete(f_runtime);
|
||||
Delete(f_begin);
|
||||
|
||||
/* Done */
|
||||
return SWIG_OK;
|
||||
|
|
@ -231,7 +221,7 @@ public:
|
|||
* name (i.e. "enum_test").
|
||||
* ------------------------------------------------------------ */
|
||||
|
||||
String *strip(const DOHconst_String_or_char_ptr name) {
|
||||
String *strip(const DOHString_or_char *name) {
|
||||
String *s = Copy(name);
|
||||
if (Strncmp(name, PrefixPlusUnderscore, Len(PrefixPlusUnderscore)) != 0) {
|
||||
return s;
|
||||
|
|
@ -244,7 +234,7 @@ public:
|
|||
* add_method()
|
||||
* ------------------------------------------------------------ */
|
||||
|
||||
void add_method(const DOHconst_String_or_char_ptr name, const DOHconst_String_or_char_ptr function, const DOHconst_String_or_char_ptr description) {
|
||||
void add_method(const DOHString_or_char *name, const DOHString_or_char *function, const DOHString_or_char *description) {
|
||||
String *rename = NULL;
|
||||
switch (current) {
|
||||
case NO_CPP:
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -424,7 +424,6 @@ protected:
|
|||
String *sfile;
|
||||
String *f_init;
|
||||
String *s_classes;
|
||||
String *f_begin;
|
||||
String *f_runtime;
|
||||
String *f_wrapper;
|
||||
String *s_header;
|
||||
|
|
@ -488,7 +487,6 @@ R::R() :
|
|||
sfile(0),
|
||||
f_init(0),
|
||||
s_classes(0),
|
||||
f_begin(0),
|
||||
f_runtime(0),
|
||||
f_wrapper(0),
|
||||
s_header(0),
|
||||
|
|
@ -769,7 +767,6 @@ void R::init() {
|
|||
sfile = NewString("");
|
||||
f_init = NewString("");
|
||||
s_header = NewString("");
|
||||
f_begin = NewString("");
|
||||
f_runtime = NewString("");
|
||||
f_wrapper = NewString("");
|
||||
s_classes = NewString("");
|
||||
|
|
@ -814,22 +811,16 @@ int R::top(Node *n) {
|
|||
Swig_register_filebyname("sinit", s_init);
|
||||
Swig_register_filebyname("sinitroutine", s_init_routine);
|
||||
|
||||
Swig_register_filebyname("begin", f_begin);
|
||||
Swig_register_filebyname("runtime", f_runtime);
|
||||
Swig_register_filebyname("init", f_init);
|
||||
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_begin);
|
||||
|
||||
Printf(f_runtime, "\n");
|
||||
Printf(f_runtime, "#define SWIGR\n");
|
||||
Printf(f_runtime, "\n");
|
||||
|
||||
|
||||
Swig_banner_target_lang(s_init, "#");
|
||||
Printf(s_init, "# This is an automatically generated file by the R module for SWIG.\n\n");
|
||||
outputCommandLineArguments(s_init);
|
||||
|
||||
Printf(f_wrapper, "#ifdef __cplusplus\n");
|
||||
|
|
@ -867,9 +858,7 @@ int R::top(Node *n) {
|
|||
Delete(f_init);
|
||||
|
||||
Delete(s_header);
|
||||
Close(f_begin);
|
||||
Delete(f_runtime);
|
||||
Delete(f_begin);
|
||||
|
||||
return SWIG_OK;
|
||||
}
|
||||
|
|
@ -889,7 +878,7 @@ int R::DumpCode(Node *n) {
|
|||
Printf(stderr, "Writing S code to %s\n", output_filename);
|
||||
#endif
|
||||
|
||||
File *scode = NewFile(output_filename, "w", SWIG_output_files());
|
||||
File *scode = NewFile(output_filename, "w");
|
||||
if (!scode) {
|
||||
FileErrorDisplay(output_filename);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
|
|
@ -904,16 +893,25 @@ int R::DumpCode(Node *n) {
|
|||
Close(scode);
|
||||
// Delete(scode);
|
||||
String *outfile = Getattr(n,"outfile");
|
||||
File *runtime = NewFile(outfile,"w", SWIG_output_files());
|
||||
File *runtime = NewFile(outfile,"w");
|
||||
if (!runtime) {
|
||||
FileErrorDisplay(outfile);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
Printf(runtime, "%s", f_begin);
|
||||
Swig_banner(runtime);
|
||||
|
||||
|
||||
Printf(runtime, "/* Runtime */\n");
|
||||
Printf(runtime, "%s\n", f_runtime);
|
||||
|
||||
Printf(runtime, "/* Header */\n");
|
||||
Printf(runtime, "%s\n", s_header);
|
||||
|
||||
Printf(runtime, "/* Wrapper */\n");
|
||||
Printf(runtime, "%s\n", f_wrapper);
|
||||
|
||||
Printf(runtime, "/* Init code */\n");
|
||||
Printf(runtime, "%s\n", f_init);
|
||||
|
||||
Close(runtime);
|
||||
|
|
@ -922,7 +920,7 @@ int R::DumpCode(Node *n) {
|
|||
if(outputNamespaceInfo) {
|
||||
output_filename = NewString("");
|
||||
Printf(output_filename, "%sNAMESPACE", SWIG_output_directory());
|
||||
File *ns = NewFile(output_filename, "w", SWIG_output_files());
|
||||
File *ns = NewFile(output_filename, "w");
|
||||
if (!ns) {
|
||||
FileErrorDisplay(output_filename);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
|
|
@ -2576,9 +2574,9 @@ String * R::runtimeCode() {
|
|||
void R::main(int argc, char *argv[]) {
|
||||
bool cppcast = true;
|
||||
init();
|
||||
Preprocessor_define("SWIGR 1", 0);
|
||||
SWIG_library_directory("r");
|
||||
SWIG_config_file("r.swg");
|
||||
Preprocessor_define("SWIGR 1", 0);
|
||||
debugMode = false;
|
||||
copyStruct = true;
|
||||
memoryProfile = false;
|
||||
|
|
@ -2661,7 +2659,7 @@ int R::outputCommandLineArguments(File *out)
|
|||
if(Argc < 1 || !Argv || !Argv[0])
|
||||
return(-1);
|
||||
|
||||
Printf(out, "\n## Generated via the command line invocation:\n##\t");
|
||||
Printf(out, "## Generated via the command line invocation:\n##\t");
|
||||
for(int i = 0; i < Argc ; i++) {
|
||||
Printf(out, " %s", Argv[i]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public:
|
|||
|
||||
/**
|
||||
* The C variable name used in the SWIG-generated wrapper code to refer to
|
||||
* this class; usually it is of the form "SwigClassXXX.klass", where SwigClassXXX
|
||||
* this class; usually it is of the form "cClassName.klass", where cClassName
|
||||
* is a swig_class struct instance and klass is a member of that struct.
|
||||
*/
|
||||
String *vname;
|
||||
|
|
@ -39,7 +39,7 @@ public:
|
|||
* The C variable name used in the SWIG-generated wrapper code to refer to
|
||||
* the module that implements this class's methods (when we're trying to
|
||||
* support C++ multiple inheritance). Usually it is of the form
|
||||
* "SwigClassClassName.mImpl", where SwigClassXXX is a swig_class struct instance
|
||||
* "cClassName.mImpl", where cClassName is a swig_class struct instance
|
||||
* and mImpl is a member of that struct.
|
||||
*/
|
||||
String *mImpl;
|
||||
|
|
@ -78,7 +78,7 @@ public:
|
|||
Delete(temp);
|
||||
}
|
||||
|
||||
void set_name(const_String_or_char_ptr cn, const_String_or_char_ptr rn, const_String_or_char_ptr valn) {
|
||||
void set_name(const String_or_char *cn, const String_or_char *rn, const String_or_char *valn) {
|
||||
/* Original C/C++ class (or struct) name */
|
||||
Clear(cname);
|
||||
Append(cname, cn);
|
||||
|
|
@ -93,18 +93,18 @@ public:
|
|||
|
||||
/* Variable name for the VALUE that refers to the Ruby Class object */
|
||||
Clear(vname);
|
||||
Printf(vname, "SwigClass%s.klass", name);
|
||||
Printf(vname, "c%s.klass", name);
|
||||
|
||||
/* Variable name for the VALUE that refers to the Ruby Class object */
|
||||
Clear(mImpl);
|
||||
Printf(mImpl, "SwigClass%s.mImpl", name);
|
||||
Printf(mImpl, "c%s.mImpl", name);
|
||||
|
||||
/* Prefix */
|
||||
Clear(prefix);
|
||||
Printv(prefix, (rn ? rn : cn), "_", NIL);
|
||||
}
|
||||
|
||||
char *strip(const_String_or_char_ptr s) {
|
||||
char *strip(const String_or_char *s) {
|
||||
Clear(temp);
|
||||
Append(temp, s);
|
||||
if (Strncmp(s, prefix, Len(prefix)) == 0) {
|
||||
|
|
@ -158,7 +158,6 @@ private:
|
|||
File *f_directors;
|
||||
File *f_directors_h;
|
||||
File *f_directors_helpers;
|
||||
File *f_begin;
|
||||
File *f_runtime;
|
||||
File *f_runtime_h;
|
||||
File *f_header;
|
||||
|
|
@ -763,7 +762,6 @@ public:
|
|||
classes = 0;
|
||||
klass = 0;
|
||||
special_methods = 0;
|
||||
f_begin = 0;
|
||||
f_runtime = 0;
|
||||
f_header = 0;
|
||||
f_wrappers = 0;
|
||||
|
|
@ -994,13 +992,24 @@ public:
|
|||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
f_begin = NewFile(outfile, "w", SWIG_output_files());
|
||||
if (!f_begin) {
|
||||
f_runtime = NewFile(outfile, "w");
|
||||
if (!f_runtime) {
|
||||
FileErrorDisplay(outfile);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
f_runtime = NewString("");
|
||||
if (directorsEnabled()) {
|
||||
if (!outfile_h) {
|
||||
Printf(stderr, "Unable to determine outfile_h\n");
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
f_runtime_h = NewFile(outfile_h, "w");
|
||||
if (!f_runtime_h) {
|
||||
FileErrorDisplay(outfile_h);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
f_init = NewString("");
|
||||
f_header = NewString("");
|
||||
f_wrappers = NewString("");
|
||||
|
|
@ -1009,22 +1018,9 @@ public:
|
|||
f_directors_helpers = NewString("");
|
||||
f_initbeforefunc = NewString("");
|
||||
|
||||
if (directorsEnabled()) {
|
||||
if (!outfile_h) {
|
||||
Printf(stderr, "Unable to determine outfile_h\n");
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
f_runtime_h = NewFile(outfile_h, "w", SWIG_output_files());
|
||||
if (!f_runtime_h) {
|
||||
FileErrorDisplay(outfile_h);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
/* Register file targets with the SWIG file handler */
|
||||
Swig_register_filebyname("header", f_header);
|
||||
Swig_register_filebyname("wrapper", f_wrappers);
|
||||
Swig_register_filebyname("begin", f_begin);
|
||||
Swig_register_filebyname("runtime", f_runtime);
|
||||
Swig_register_filebyname("init", f_init);
|
||||
Swig_register_filebyname("director", f_directors);
|
||||
|
|
@ -1039,17 +1035,14 @@ public:
|
|||
|
||||
registerMagicMethods();
|
||||
|
||||
Swig_banner(f_begin);
|
||||
Swig_banner(f_runtime);
|
||||
|
||||
Printf(f_runtime, "\n");
|
||||
Printf(f_runtime, "#define SWIGRUBY\n");
|
||||
|
||||
if (directorsEnabled()) {
|
||||
Printf(f_runtime, "#define SWIG_DIRECTORS\n");
|
||||
}
|
||||
|
||||
Printf(f_runtime, "\n");
|
||||
|
||||
/* typedef void *VALUE */
|
||||
SwigType *value = NewSwigType(T_VOID);
|
||||
SwigType_add_pointer(value);
|
||||
|
|
@ -1065,7 +1058,6 @@ public:
|
|||
Replaceall(module_macro, "::", "__");
|
||||
|
||||
Swig_banner(f_directors_h);
|
||||
Printf(f_directors_h, "\n");
|
||||
Printf(f_directors_h, "#ifndef SWIG_%s_WRAP_H_\n", module_macro);
|
||||
Printf(f_directors_h, "#define SWIG_%s_WRAP_H_\n\n", module_macro);
|
||||
Printf(f_directors_h, "namespace Swig {\n");
|
||||
|
|
@ -1118,29 +1110,27 @@ public:
|
|||
SwigType_emit_type_table(f_runtime, f_wrappers);
|
||||
|
||||
/* Close all of the files */
|
||||
Dump(f_runtime, f_begin);
|
||||
Dump(f_header, f_begin);
|
||||
Dump(f_header, f_runtime);
|
||||
|
||||
if (directorsEnabled()) {
|
||||
Dump(f_directors_helpers, f_begin);
|
||||
Dump(f_directors, f_begin);
|
||||
Dump(f_directors_helpers, f_runtime);
|
||||
Dump(f_directors, f_runtime);
|
||||
Dump(f_directors_h, f_runtime_h);
|
||||
Printf(f_runtime_h, "\n");
|
||||
Printf(f_runtime_h, "#endif\n");
|
||||
Close(f_runtime_h);
|
||||
}
|
||||
|
||||
Dump(f_wrappers, f_begin);
|
||||
Dump(f_initbeforefunc, f_begin);
|
||||
Wrapper_pretty_print(f_init, f_begin);
|
||||
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_begin);
|
||||
Close(f_runtime);
|
||||
Delete(f_runtime);
|
||||
Delete(f_begin);
|
||||
|
||||
return SWIG_OK;
|
||||
}
|
||||
|
|
@ -1236,7 +1226,7 @@ public:
|
|||
/**
|
||||
* Process the comma-separated list of aliases (if any).
|
||||
*/
|
||||
void defineAliases(Node *n, const_String_or_char_ptr iname) {
|
||||
void defineAliases(Node *n, const String_or_char *iname) {
|
||||
String *aliasv = Getattr(n, "feature:alias");
|
||||
if (aliasv) {
|
||||
List *aliases = Split(aliasv, ',', INT_MAX);
|
||||
|
|
@ -1270,7 +1260,7 @@ public:
|
|||
* as another instance of the same class.
|
||||
* --------------------------------------------------------------------- */
|
||||
|
||||
void create_command(Node *n, const_String_or_char_ptr iname) {
|
||||
void create_command(Node *n, const String_or_char *iname) {
|
||||
|
||||
String *alloc_func = Swig_name_wrapper(iname);
|
||||
String *wname = Swig_name_wrapper(iname);
|
||||
|
|
@ -2402,9 +2392,9 @@ public:
|
|||
void handleMarkFuncDirective(Node *n) {
|
||||
String *markfunc = Getattr(n, "feature:markfunc");
|
||||
if (markfunc) {
|
||||
Printf(klass->init, "SwigClass%s.mark = (void (*)(void *)) %s;\n", klass->name, markfunc);
|
||||
Printf(klass->init, "c%s.mark = (void (*)(void *)) %s;\n", klass->name, markfunc);
|
||||
} else {
|
||||
Printf(klass->init, "SwigClass%s.mark = 0;\n", klass->name);
|
||||
Printf(klass->init, "c%s.mark = 0;\n", klass->name);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2414,10 +2404,10 @@ public:
|
|||
void handleFreeFuncDirective(Node *n) {
|
||||
String *freefunc = Getattr(n, "feature:freefunc");
|
||||
if (freefunc) {
|
||||
Printf(klass->init, "SwigClass%s.destroy = (void (*)(void *)) %s;\n", klass->name, freefunc);
|
||||
Printf(klass->init, "c%s.destroy = (void (*)(void *)) %s;\n", klass->name, freefunc);
|
||||
} else {
|
||||
if (klass->destructor_defined) {
|
||||
Printf(klass->init, "SwigClass%s.destroy = (void (*)(void *)) free_%s;\n", klass->name, klass->mname);
|
||||
Printf(klass->init, "c%s.destroy = (void (*)(void *)) free_%s;\n", klass->name, klass->mname);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2428,9 +2418,9 @@ public:
|
|||
void handleTrackDirective(Node *n) {
|
||||
int trackObjects = GetFlag(n, "feature:trackobjects");
|
||||
if (trackObjects) {
|
||||
Printf(klass->init, "SwigClass%s.trackObjects = 1;\n", klass->name);
|
||||
Printf(klass->init, "c%s.trackObjects = 1;\n", klass->name);
|
||||
} else {
|
||||
Printf(klass->init, "SwigClass%s.trackObjects = 0;\n", klass->name);
|
||||
Printf(klass->init, "c%s.trackObjects = 0;\n", klass->name);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2455,7 +2445,7 @@ public:
|
|||
|
||||
Clear(klass->type);
|
||||
Printv(klass->type, Getattr(n, "classtype"), NIL);
|
||||
Printv(f_wrappers, "swig_class SwigClass", valid_name, ";\n\n", NIL);
|
||||
Printv(f_wrappers, "swig_class c", valid_name, ";\n\n", NIL);
|
||||
Printv(klass->init, "\n", tab4, NIL);
|
||||
|
||||
if (!useGlobalModule) {
|
||||
|
|
@ -2473,7 +2463,7 @@ public:
|
|||
SwigType_add_pointer(tt);
|
||||
SwigType_remember(tt);
|
||||
String *tm = SwigType_manglestr(tt);
|
||||
Printf(klass->init, "SWIG_TypeClientData(SWIGTYPE%s, (void *) &SwigClass%s);\n", tm, valid_name);
|
||||
Printf(klass->init, "SWIG_TypeClientData(SWIGTYPE%s, (void *) &c%s);\n", tm, valid_name);
|
||||
Delete(tm);
|
||||
Delete(tt);
|
||||
Delete(valid_name);
|
||||
|
|
@ -2574,7 +2564,7 @@ public:
|
|||
|
||||
/* First wrap the allocate method */
|
||||
current = CONSTRUCTOR_ALLOCATE;
|
||||
Swig_name_register((const_String_or_char_ptr ) "construct", (const_String_or_char_ptr ) "%c_allocate");
|
||||
Swig_name_register((String_or_char *) "construct", (String_or_char *) "%c_allocate");
|
||||
|
||||
|
||||
Language::constructorHandler(n);
|
||||
|
|
@ -2609,7 +2599,7 @@ public:
|
|||
Delete(docs);
|
||||
|
||||
current = CONSTRUCTOR_INITIALIZE;
|
||||
Swig_name_register((const_String_or_char_ptr ) "construct", (const_String_or_char_ptr ) "new_%c");
|
||||
Swig_name_register((String_or_char *) "construct", (String_or_char *) "new_%c");
|
||||
Language::constructorHandler(n);
|
||||
|
||||
/* Restore original parameter list */
|
||||
|
|
@ -2617,7 +2607,7 @@ public:
|
|||
Swig_restore(n);
|
||||
|
||||
/* Done */
|
||||
Swig_name_unregister((const_String_or_char_ptr ) "construct");
|
||||
Swig_name_unregister((String_or_char *) "construct");
|
||||
current = NO_CPP;
|
||||
klass->constructor_defined = 1;
|
||||
return SWIG_OK;
|
||||
|
|
@ -2631,7 +2621,7 @@ public:
|
|||
|
||||
/* First wrap the allocate method */
|
||||
current = CONSTRUCTOR_ALLOCATE;
|
||||
Swig_name_register((const_String_or_char_ptr ) "construct", (const_String_or_char_ptr ) "%c_allocate");
|
||||
Swig_name_register((String_or_char *) "construct", (String_or_char *) "%c_allocate");
|
||||
|
||||
return Language::copyconstructorHandler(n);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,9 +29,6 @@ public:
|
|||
}
|
||||
|
||||
virtual void main(int argc, char *argv[]) {
|
||||
// Add a symbol to the parser for conditional compilation
|
||||
Preprocessor_define("SWIGSEXP 1", 0);
|
||||
|
||||
SWIG_typemap_lang("sexp");
|
||||
for (int iX = 0; iX < argc; iX++) {
|
||||
if (strcmp(argv[iX], "-typemaplang") == 0) {
|
||||
|
|
@ -45,6 +42,9 @@ public:
|
|||
fputs(usage, stdout);
|
||||
}
|
||||
}
|
||||
|
||||
// Add a symbol to the parser for conditional compilation
|
||||
Preprocessor_define("SWIGSEXP 1", 0);
|
||||
}
|
||||
|
||||
DOHHash *print_circle_hash;
|
||||
|
|
@ -59,7 +59,7 @@ public:
|
|||
String *outfile = Getattr(n, "outfile");
|
||||
Replaceall(outfile, "_wrap.cxx", ".lisp");
|
||||
Replaceall(outfile, "_wrap.c", ".lisp");
|
||||
out = NewFile(outfile, "w", SWIG_output_files());
|
||||
out = NewFile(outfile, "w");
|
||||
if (!out) {
|
||||
FileErrorDisplay(outfile);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
|
|
@ -68,14 +68,10 @@ public:
|
|||
String *f_sink = NewString("");
|
||||
Swig_register_filebyname("header", f_sink);
|
||||
Swig_register_filebyname("wrapper", f_sink);
|
||||
Swig_register_filebyname("begin", f_sink);
|
||||
Swig_register_filebyname("runtime", f_sink);
|
||||
Swig_register_filebyname("init", f_sink);
|
||||
|
||||
Swig_banner_target_lang(out, ";;;");
|
||||
|
||||
Language::top(n);
|
||||
Printf(out, "\n");
|
||||
Printf(out, ";;; Lisp parse tree produced by SWIG\n");
|
||||
print_circle_hash = DohNewHash();
|
||||
print_circle_count = 0;
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@ extern "C" {
|
|||
Language *swig_modula3(void);
|
||||
Language *swig_mzscheme(void);
|
||||
Language *swig_java(void);
|
||||
Language *swig_php(void);
|
||||
Language *swig_php4(void);
|
||||
Language *swig_php5(void);
|
||||
Language *swig_ocaml(void);
|
||||
Language *swig_octave(void);
|
||||
Language *swig_pike(void);
|
||||
|
|
@ -76,9 +76,9 @@ static swig_module modules[] = {
|
|||
{"-octave", swig_octave, "Octave"},
|
||||
{"-perl", swig_perl5, "Perl"},
|
||||
{"-perl5", swig_perl5, 0},
|
||||
{"-php", swig_php, "PHP"},
|
||||
{"-php4", swig_php4, 0},
|
||||
{"-php5", swig_php, 0},
|
||||
{"-php", swig_php4, 0},
|
||||
{"-php4", swig_php4, "PHP4"},
|
||||
{"-php5", swig_php5, "PHP5"},
|
||||
{"-pike", swig_pike, "Pike"},
|
||||
{"-python", swig_python, "Python"},
|
||||
{"-r", swig_r, "R (aka GNU S)"},
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ typedef int bool;
|
|||
#define PLAIN_VIRTUAL 1
|
||||
#define PURE_VIRTUAL 2
|
||||
|
||||
extern String *input_file;
|
||||
extern char *input_file;
|
||||
extern int line_number;
|
||||
extern int start_line;
|
||||
extern int CPlusPlus; // C++ mode
|
||||
|
|
@ -114,8 +114,8 @@ protected:
|
|||
|
||||
class Language:public Dispatcher {
|
||||
public:
|
||||
Language();
|
||||
virtual ~Language();
|
||||
Language ();
|
||||
virtual ~ Language ();
|
||||
virtual int emit_one(Node *n);
|
||||
|
||||
/* Parse command line options */
|
||||
|
|
@ -313,13 +313,10 @@ int SWIG_main(int, char **, Language *);
|
|||
void emit_parameter_variables(ParmList *l, Wrapper *f);
|
||||
void emit_return_variable(Node *n, SwigType *rt, Wrapper *f);
|
||||
void SWIG_exit(int); /* use EXIT_{SUCCESS,FAILURE} */
|
||||
void SWIG_config_file(const_String_or_char_ptr );
|
||||
void SWIG_config_file(const String_or_char *);
|
||||
const String *SWIG_output_directory();
|
||||
void SWIG_config_cppext(const char *ext);
|
||||
|
||||
/* get the list of generated files */
|
||||
List *SWIG_output_files();
|
||||
|
||||
void SWIG_library_directory(const char *);
|
||||
int emit_num_arguments(ParmList *);
|
||||
int emit_num_required(ParmList *);
|
||||
|
|
@ -329,17 +326,17 @@ void emit_mark_varargs(ParmList *l);
|
|||
String *emit_action(Node *n);
|
||||
int emit_action_code(Node *n, String *wrappercode, String *action);
|
||||
void Swig_overload_check(Node *n);
|
||||
String *Swig_overload_dispatch(Node *n, const_String_or_char_ptr fmt, int *);
|
||||
String *Swig_overload_dispatch_cast(Node *n, const_String_or_char_ptr fmt, int *);
|
||||
String *Swig_overload_dispatch_fast(Node *n, const_String_or_char_ptr fmt, int *);
|
||||
String *Swig_overload_dispatch(Node *n, const String_or_char *fmt, int *);
|
||||
String *Swig_overload_dispatch_cast(Node *n, const String_or_char *fmt, int *);
|
||||
String *Swig_overload_dispatch_fast(Node *n, const String_or_char *fmt, int *);
|
||||
SwigType *cplus_value_type(SwigType *t);
|
||||
|
||||
/* directors.cxx start */
|
||||
String *Swig_csuperclass_call(String *base, String *method, ParmList *l);
|
||||
String *Swig_class_declaration(Node *n, String *name);
|
||||
String *Swig_class_name(Node *n);
|
||||
String *Swig_method_call(const_String_or_char_ptr name, ParmList *parms);
|
||||
String *Swig_method_decl(SwigType *rtype, SwigType *decl, const_String_or_char_ptr id, List *args, int strip, int values);
|
||||
String *Swig_method_call(String_or_char *name, ParmList *parms);
|
||||
String *Swig_method_decl(SwigType *rtype, SwigType *decl, const String_or_char *id, List *args, int strip, int values);
|
||||
String *Swig_director_declaration(Node *n);
|
||||
void Swig_director_emit_dynamic_cast(Node *n, Wrapper *f);
|
||||
/* directors.cxx end */
|
||||
|
|
|
|||
|
|
@ -46,7 +46,6 @@ static int nosafe = 0;
|
|||
static File *f_header = 0;
|
||||
static File *f_wrappers = 0;
|
||||
static File *f_init = 0;
|
||||
static File *f_begin = 0;
|
||||
static File *f_runtime = 0;
|
||||
|
||||
|
||||
|
|
@ -122,7 +121,6 @@ public:
|
|||
}
|
||||
|
||||
Preprocessor_define("SWIGTCL 1", 0);
|
||||
// SWIGTCL8 is deprecated, and no longer documented.
|
||||
Preprocessor_define("SWIGTCL8 1", 0);
|
||||
SWIG_typemap_lang("tcl8");
|
||||
SWIG_config_file("tcl8.swg");
|
||||
|
|
@ -138,12 +136,11 @@ public:
|
|||
/* Initialize all of the output files */
|
||||
String *outfile = Getattr(n, "outfile");
|
||||
|
||||
f_begin = NewFile(outfile, "w", SWIG_output_files());
|
||||
if (!f_begin) {
|
||||
f_runtime = NewFile(outfile, "w");
|
||||
if (!f_runtime) {
|
||||
FileErrorDisplay(outfile);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
f_runtime = NewString("");
|
||||
f_init = NewString("");
|
||||
f_header = NewString("");
|
||||
f_wrappers = NewString("");
|
||||
|
|
@ -151,7 +148,6 @@ public:
|
|||
/* Register file targets with the SWIG file handler */
|
||||
Swig_register_filebyname("header", f_header);
|
||||
Swig_register_filebyname("wrapper", f_wrappers);
|
||||
Swig_register_filebyname("begin", f_begin);
|
||||
Swig_register_filebyname("runtime", f_runtime);
|
||||
Swig_register_filebyname("init", f_init);
|
||||
|
||||
|
|
@ -162,11 +158,7 @@ public:
|
|||
methods_tab = NewString("");
|
||||
const_tab = NewString("");
|
||||
|
||||
Swig_banner(f_begin);
|
||||
|
||||
Printf(f_runtime, "\n");
|
||||
Printf(f_runtime, "#define SWIGTCL\n");
|
||||
Printf(f_runtime, "\n");
|
||||
Swig_banner(f_runtime);
|
||||
|
||||
/* Set the module name, namespace, and prefix */
|
||||
|
||||
|
|
@ -185,7 +177,7 @@ public:
|
|||
|
||||
Insert(module, 0, "_");
|
||||
|
||||
if ((f_shadow = NewFile(filen, "w", SWIG_output_files())) == 0) {
|
||||
if ((f_shadow = NewFile(filen, "w")) == 0) {
|
||||
FileErrorDisplay(filen);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
|
|
@ -194,7 +186,10 @@ public:
|
|||
Swig_register_filebyname("shadow", f_shadow);
|
||||
Swig_register_filebyname("itcl", f_shadow);
|
||||
|
||||
Swig_banner_target_lang(f_shadow, "#");
|
||||
Printf(f_shadow, "# This file was automatically generated by SWIG (http://www.swig.org).\n");
|
||||
Printf(f_shadow, "# Version %s\n", Swig_package_version());
|
||||
Printf(f_shadow, "#\n");
|
||||
Printf(f_shadow, "# Don't modify this file, modify the SWIG interface instead.\n");
|
||||
|
||||
Printv(f_shadow, "\npackage require Itcl\n\n", NIL);
|
||||
Delete(filen);
|
||||
|
|
@ -249,15 +244,12 @@ public:
|
|||
}
|
||||
|
||||
/* Close all of the files */
|
||||
Dump(f_runtime, f_begin);
|
||||
Printv(f_begin, f_header, f_wrappers, NIL);
|
||||
Wrapper_pretty_print(f_init, f_begin);
|
||||
Printv(f_runtime, f_header, f_wrappers, NIL);
|
||||
Wrapper_pretty_print(f_init, f_runtime);
|
||||
Delete(f_header);
|
||||
Delete(f_wrappers);
|
||||
Delete(f_init);
|
||||
Close(f_begin);
|
||||
Delete(f_runtime);
|
||||
Delete(f_begin);
|
||||
Close(f_runtime);
|
||||
return SWIG_OK;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ public:
|
|||
};
|
||||
|
||||
static File *f_cl = 0;
|
||||
static File *f_null = 0;
|
||||
|
||||
static struct {
|
||||
int count;
|
||||
|
|
@ -131,7 +132,7 @@ static void add_defined_foreign_type(String *type) {
|
|||
}
|
||||
|
||||
|
||||
static String *get_ffi_type(SwigType *ty, const_String_or_char_ptr name) {
|
||||
static String *get_ffi_type(SwigType *ty, const String_or_char *name) {
|
||||
Hash *typemap = Swig_typemap_search("ffitype", ty, name, 0);
|
||||
if (typemap) {
|
||||
String *typespec = Getattr(typemap, "code");
|
||||
|
|
@ -167,7 +168,7 @@ static String *get_ffi_type(SwigType *ty, const_String_or_char_ptr name) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static String *get_lisp_type(SwigType *ty, const_String_or_char_ptr name) {
|
||||
static String *get_lisp_type(SwigType *ty, const String_or_char *name) {
|
||||
Hash *typemap = Swig_typemap_search("lisptype", ty, name, 0);
|
||||
if (typemap) {
|
||||
String *typespec = Getattr(typemap, "code");
|
||||
|
|
@ -180,7 +181,6 @@ static String *get_lisp_type(SwigType *ty, const_String_or_char_ptr name) {
|
|||
void UFFI::main(int argc, char *argv[]) {
|
||||
int i;
|
||||
|
||||
Preprocessor_define("SWIGUFFI 1", 0);
|
||||
SWIG_library_directory("uffi");
|
||||
SWIG_config_file("uffi.swg");
|
||||
|
||||
|
|
@ -225,26 +225,31 @@ void UFFI::main(int argc, char *argv[]) {
|
|||
int UFFI::top(Node *n) {
|
||||
String *module = Getattr(n, "name");
|
||||
String *output_filename = NewString("");
|
||||
File *f_null = NewString("");
|
||||
String *devnull = NewString("/dev/null");
|
||||
|
||||
f_null = NewFile(devnull, "w+");
|
||||
if (!f_null) {
|
||||
FileErrorDisplay(devnull);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
Delete(devnull);
|
||||
|
||||
|
||||
Printf(output_filename, "%s%s.cl", SWIG_output_directory(), module);
|
||||
|
||||
|
||||
f_cl = NewFile(output_filename, "w", SWIG_output_files());
|
||||
f_cl = NewFile(output_filename, "w");
|
||||
if (!f_cl) {
|
||||
FileErrorDisplay(output_filename);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
Swig_register_filebyname("header", f_null);
|
||||
Swig_register_filebyname("begin", f_null);
|
||||
Swig_register_filebyname("runtime", f_null);
|
||||
Swig_register_filebyname("wrapper", f_cl);
|
||||
|
||||
Swig_banner_target_lang(f_cl, ";;");
|
||||
|
||||
Printf(f_cl, "\n"
|
||||
";; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10; package: %s -*-\n\n(defpackage :%s\n (:use :common-lisp :uffi))\n\n(in-package :%s)\n",
|
||||
Printf(f_cl,
|
||||
";; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10; package: %s -*-\n;; This is an automatically generated file. Make changes in\n;; the definition file, not here.\n\n(defpackage :%s\n (:use :common-lisp :uffi))\n\n(in-package :%s)\n",
|
||||
module, module, module);
|
||||
Printf(f_cl, "(eval-when (compile load eval)\n (defparameter *swig-identifier-converter* '%s))\n", identifier_converter);
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public:
|
|||
iX++;
|
||||
Swig_mark_arg(iX);
|
||||
String *outfile = NewString(argv[iX]);
|
||||
out = NewFile(outfile, "w", SWIG_output_files());
|
||||
out = NewFile(outfile, "w");
|
||||
if (!out) {
|
||||
FileErrorDisplay(outfile);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
|
|
@ -82,7 +82,7 @@ public:
|
|||
Replaceall(outfile, ".cxx", ".xml");
|
||||
Replaceall(outfile, ".cpp", ".xml");
|
||||
Replaceall(outfile, ".c", ".xml");
|
||||
out = NewFile(outfile, "w", SWIG_output_files());
|
||||
out = NewFile(outfile, "w");
|
||||
if (!out) {
|
||||
FileErrorDisplay(outfile);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
|
|
@ -301,7 +301,7 @@ void Swig_print_xml(DOH *obj, String *filename) {
|
|||
if (!filename) {
|
||||
out = stdout;
|
||||
} else {
|
||||
out = NewFile(filename, "w", SWIG_output_files());
|
||||
out = NewFile(filename, "w");
|
||||
if (!out) {
|
||||
FileErrorDisplay(filename);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue