Merged from trunk
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-sploving@12656 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
commit
954256979c
557 changed files with 27074 additions and 5555 deletions
|
|
@ -22,6 +22,21 @@ char cvsroot_allegrocl_cxx[] = "$Id$";
|
|||
// #define ALLEGROCL_TYPE_DEBUG
|
||||
// #define ALLEGROCL_CLASS_DEBUG
|
||||
|
||||
static const char *usage = (char *) "\
|
||||
Allegro CL Options (available with -allegrocl)\n\
|
||||
-identifier-converter <type or funcname> - \n\
|
||||
Specifies the type of conversion to do on C identifiers to convert\n\
|
||||
them to symbols. There are two built-in converters: 'null' and\n\
|
||||
'lispify'. The default is 'null'. If you supply a name other\n\
|
||||
than one of the built-ins, then a function by that name will be\n\
|
||||
called to convert identifiers to symbols.\n\
|
||||
-[no]cwrap - Turn on or turn off generation of an intermediate C file when\n\
|
||||
creating a C interface. By default this is only done for C++ code.\n\
|
||||
-isolate - Define all SWIG helper functions in a package unique to this\n\
|
||||
module. Avoids redefinition warnings when loading multiple\n\
|
||||
SWIGged modules into the same running Allegro CL image.\n\
|
||||
";
|
||||
|
||||
static File *f_cl = 0;
|
||||
String *f_clhead = NewString("");
|
||||
String *f_clwrap = NewString("(swig-in-package ())\n\n");
|
||||
|
|
@ -1587,21 +1602,7 @@ void ALLEGROCL::main(int argc, char *argv[]) {
|
|||
}
|
||||
|
||||
if (!strcmp(argv[i], "-help")) {
|
||||
fprintf(stdout, "Allegro CL Options (available with -allegrocl)\n");
|
||||
fprintf(stdout,
|
||||
" -identifier-converter <type or funcname>\n"
|
||||
"\tSpecifies the type of conversion to do on C identifiers to convert\n"
|
||||
"\tthem to symbols. There are two built-in converters: 'null' and\n"
|
||||
"\t 'lispify'. The default is 'null'. If you supply a name other\n"
|
||||
"\tthan one of the built-ins, then a function by that name will be\n"
|
||||
"\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");
|
||||
|
||||
Printf(stdout, "%s\n", usage);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -2499,11 +2500,8 @@ int ALLEGROCL::emit_defun(Node *n, File *fcl) {
|
|||
|
||||
Delete(parsed);
|
||||
|
||||
int isPtrReturn = 0;
|
||||
|
||||
if (cl_t) {
|
||||
lclass = lookup_defined_foreign_ltype(cl_t);
|
||||
isPtrReturn = 1;
|
||||
}
|
||||
|
||||
int ff_foreign_ptr = 0;
|
||||
|
|
@ -2522,17 +2520,8 @@ int ALLEGROCL::emit_defun(Node *n, File *fcl) {
|
|||
Replaceall(wrap->code, "$out_fftype", out_ffitype);
|
||||
if (deref_out_ffitype)
|
||||
Replaceall(wrap->code, "$*out_fftype", deref_out_ffitype);
|
||||
// if(Replaceall(wrap->code,"$lclass", lclass) && !isPtrReturn) {
|
||||
// Swig_warning(WARN_LANG_RETURN_TYPE,Getfile(n), Getline(n),
|
||||
// "While Wrapping %s, replaced a $lclass reference when return type is non-pointer %s!\n",
|
||||
// Getattr(n,"name"), cl_t);
|
||||
// }
|
||||
|
||||
Replaceall(wrap->code, "$body", NewStringf("(swig-ff-call%s)", wrap->locals));
|
||||
// Replaceall(wrap->code,"$body",
|
||||
// (!Strcmp(result_type,"void") ?
|
||||
// NewStringf("(swig-ff-call%s)", wrap->locals) :
|
||||
// NewStringf("(push (swig-ff-call%s) ACL_result)", wrap->locals)));
|
||||
String *ldestructor = Copy(lclass);
|
||||
if (ff_foreign_ptr)
|
||||
Replaceall(ldestructor, ldestructor, "cl::identity");
|
||||
|
|
@ -2869,23 +2858,13 @@ int ALLEGROCL::globalvariableHandler(Node *n) {
|
|||
|
||||
// String *name = Getattr(n, "name");
|
||||
SwigType *type = Getattr(n, "type");
|
||||
SwigType *ctype;
|
||||
SwigType *rtype = SwigType_typedef_resolve_all(type);
|
||||
|
||||
int pointer_added = 0;
|
||||
|
||||
if (SwigType_isclass(rtype)) {
|
||||
SwigType_add_pointer(type);
|
||||
SwigType_add_pointer(rtype);
|
||||
pointer_added = 1;
|
||||
}
|
||||
|
||||
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_clwrap, "(swig-defvar \"%s\" \"%s\" :type %s)\n",
|
||||
Getattr(n, "sym:name"), Getattr(n, "sym:name"), ((SwigType_isconst(type)) ? ":constant" : ":variable"));
|
||||
|
||||
|
|
@ -3230,3 +3209,4 @@ int ALLEGROCL::templateDeclaration(Node *n) {
|
|||
|
||||
return SWIG_OK;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -216,7 +216,7 @@ class Allocate:public Dispatcher {
|
|||
|
||||
if (!most_base_covariant_type) {
|
||||
// Eliminate the derived virtual method.
|
||||
if (virtual_elimination_mode)
|
||||
if (virtual_elimination_mode && !is_member_director(n))
|
||||
if (both_have_public_access)
|
||||
if (!is_non_public_base(inclass, b))
|
||||
if (!Swig_symbol_isoverloaded(n)) {
|
||||
|
|
@ -386,10 +386,6 @@ class Allocate:public Dispatcher {
|
|||
}
|
||||
|
||||
Node *c = firstChild(cls);
|
||||
String *kind = Getattr(cls, "kind");
|
||||
int mode = PUBLIC;
|
||||
if (kind && (Strcmp(kind, "class") == 0))
|
||||
mode = PRIVATE;
|
||||
|
||||
while (c) {
|
||||
if (Getattr(c, "error") || GetFlag(c, "feature:ignore")) {
|
||||
|
|
@ -457,13 +453,6 @@ class Allocate:public Dispatcher {
|
|||
}
|
||||
}
|
||||
|
||||
if (Strcmp(nodeType(c), "access") == 0) {
|
||||
kind = Getattr(c, "kind");
|
||||
if (Strcmp(kind, "public") == 0)
|
||||
mode = PUBLIC;
|
||||
else
|
||||
mode = PRIVATE;
|
||||
}
|
||||
c = nextSibling(c);
|
||||
}
|
||||
/* Look for methods in base classes */
|
||||
|
|
|
|||
|
|
@ -20,6 +20,19 @@ char cvsroot_cffi_cxx[] = "$Id$";
|
|||
//#define CFFI_DEBUG
|
||||
//#define CFFI_WRAP_DEBUG
|
||||
|
||||
static const char *usage = (char *) "\
|
||||
CFFI Options (available with -cffi)\n\
|
||||
-generate-typedef - Use defctype to generate shortcuts according to the\n\
|
||||
typedefs in the input.\n\
|
||||
-[no]cwrap - Turn on or turn off generation of an intermediate C\n\
|
||||
file when creating a C interface. By default this is\n\
|
||||
only done for C++ code.\n\
|
||||
-[no]swig-lisp - Turn on or off generation of code for helper lisp\n\
|
||||
macro, functions, etc. which SWIG uses while\n\
|
||||
generating wrappers. These macros, functions may still\n\
|
||||
be used by generated wrapper code.\n\
|
||||
";
|
||||
|
||||
class CFFI:public Language {
|
||||
public:
|
||||
String *f_cl;
|
||||
|
|
@ -80,17 +93,7 @@ void CFFI::main(int argc, char *argv[]) {
|
|||
CWrap = false;
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (!Strcmp(argv[i], "-help")) {
|
||||
Printf(stdout, "cffi Options (available with -cffi)\n");
|
||||
Printf(stdout,
|
||||
" -generate-typedef\n"
|
||||
"\tIf this option is given then defctype will be used to generate\n"
|
||||
"\tshortcuts according to the typedefs in the input.\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"
|
||||
" -[no]swig-lisp\n"
|
||||
"\tTurns on or off generation of code for helper lisp macro, functions,\n"
|
||||
"\tetc. which SWIG uses while generating wrappers. These macros, functions\n" "\tmay still be used by generated wrapper code.\n");
|
||||
Printf(stdout, "%s\n", usage);
|
||||
} else if (!strcmp(argv[i], "-cwrap")) {
|
||||
CWrap = true;
|
||||
Swig_mark_arg(i);
|
||||
|
|
|
|||
|
|
@ -17,17 +17,17 @@ char cvsroot_chicken_cxx[] = "$Id$";
|
|||
|
||||
#include <ctype.h>
|
||||
|
||||
static const char *chicken_usage = (char *) "\
|
||||
static const char *usage = (char *) "\
|
||||
\
|
||||
CHICKEN Options (available with -chicken)\n\
|
||||
-proxy - Export TinyCLOS class definitions\n\
|
||||
-closprefix <prefix> - Prepend <prefix> to all clos identifiers\n\
|
||||
-useclassprefix - Prepend the class name to all clos identifiers\n\
|
||||
-unhideprimitive - Unhide the primitive: symbols\n\
|
||||
-nounit - Do not (declare (unit ...)) in scheme file\n\
|
||||
-noclosuses - Do not (declare (uses ...)) in scheme file\n\
|
||||
-nocollection - Do not register pointers with chicken garbage\n\
|
||||
collector and export destructors\n\
|
||||
-nounit - Do not (declare (unit ...)) in scheme file\n\
|
||||
-proxy - Export TinyCLOS class definitions\n\
|
||||
-unhideprimitive - Unhide the primitive: symbols\n\
|
||||
-useclassprefix - Prepend the class name to all clos identifiers\n\
|
||||
\n";
|
||||
|
||||
static char *module = 0;
|
||||
|
|
@ -137,7 +137,7 @@ void CHICKEN::main(int argc, char *argv[]) {
|
|||
for (i = 1; i < argc; i++) {
|
||||
if (argv[i]) {
|
||||
if (strcmp(argv[i], "-help") == 0) {
|
||||
fputs(chicken_usage, stdout);
|
||||
fputs(usage, stdout);
|
||||
SWIG_exit(0);
|
||||
} else if (strcmp(argv[i], "-proxy") == 0) {
|
||||
clos = 1;
|
||||
|
|
@ -684,9 +684,6 @@ int CHICKEN::variableWrapper(Node *n) {
|
|||
String *overname = 0;
|
||||
String *scmname;
|
||||
|
||||
int num_required;
|
||||
int num_arguments;
|
||||
|
||||
scmname = NewString(iname);
|
||||
Replaceall(scmname, "_", "-");
|
||||
|
||||
|
|
@ -705,10 +702,6 @@ int CHICKEN::variableWrapper(Node *n) {
|
|||
emit_attach_parmmaps(l, f);
|
||||
Setattr(n, "wrap:parms", l);
|
||||
|
||||
/* Get number of required and total arguments */
|
||||
num_arguments = emit_num_arguments(l);
|
||||
num_required = emit_num_required(l);
|
||||
|
||||
// evaluation function names
|
||||
Append(wname, Swig_name_wrapper(iname));
|
||||
if (overname) {
|
||||
|
|
@ -845,9 +838,6 @@ int CHICKEN::constantWrapper(Node *n) {
|
|||
String *rvalue;
|
||||
SwigType *nctype;
|
||||
|
||||
int num_required;
|
||||
int num_arguments;
|
||||
|
||||
scmname = NewString(iname);
|
||||
Replaceall(scmname, "_", "-");
|
||||
|
||||
|
|
@ -873,9 +863,10 @@ int CHICKEN::constantWrapper(Node *n) {
|
|||
Delete(SwigType_pop(nctype));
|
||||
}
|
||||
|
||||
bool is_enum_item = (Cmp(nodeType(n), "enumitem") == 0);
|
||||
if (SwigType_type(nctype) == T_STRING) {
|
||||
rvalue = NewStringf("\"%s\"", value);
|
||||
} else if (SwigType_type(nctype) == T_CHAR) {
|
||||
} else if (SwigType_type(nctype) == T_CHAR && !is_enum_item) {
|
||||
rvalue = NewStringf("\'%s\'", value);
|
||||
} else {
|
||||
rvalue = NewString(value);
|
||||
|
|
@ -903,10 +894,6 @@ int CHICKEN::constantWrapper(Node *n) {
|
|||
emit_attach_parmmaps(l, f);
|
||||
Setattr(n, "wrap:parms", l);
|
||||
|
||||
/* Get number of required and total arguments */
|
||||
num_arguments = emit_num_arguments(l);
|
||||
num_required = emit_num_required(l);
|
||||
|
||||
// evaluation function names
|
||||
|
||||
// Check for interrupts
|
||||
|
|
@ -1382,12 +1369,10 @@ void CHICKEN::dispatchFunction(Node *n) {
|
|||
SortList(flist, compareTypeLists);
|
||||
|
||||
String *clos_name;
|
||||
int construct = 0;
|
||||
if (have_constructor && !has_constructor_args) {
|
||||
has_constructor_args = 1;
|
||||
constructor_dispatch = NewStringf("%s@SWIG@new@dispatch", short_class_name);
|
||||
clos_name = Copy(constructor_dispatch);
|
||||
construct = 1;
|
||||
Printf(clos_methods, "(declare (hide %s))\n", clos_name);
|
||||
} else if (in_class)
|
||||
clos_name = NewString(member_name);
|
||||
|
|
|
|||
|
|
@ -15,6 +15,15 @@ char cvsroot_clisp_cxx[] = "$Id$";
|
|||
|
||||
#include "swigmod.h"
|
||||
|
||||
static const char *usage = (char *) "\
|
||||
CLISP Options (available with -clisp)\n\
|
||||
-extern-all - Create clisp definitions for all the functions and\n\
|
||||
global variables otherwise only definitions for\n\
|
||||
externed functions and variables are created.\n\
|
||||
-generate-typedef - Use def-c-type to generate shortcuts according to the\n\
|
||||
typedefs in the input.\n\
|
||||
";
|
||||
|
||||
class CLISP:public Language {
|
||||
public:
|
||||
File *f_cl;
|
||||
|
|
@ -48,15 +57,7 @@ void CLISP::main(int argc, char *argv[]) {
|
|||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (!strcmp(argv[i], "-help")) {
|
||||
Printf(stdout, "clisp Options (available with -clisp)\n");
|
||||
Printf(stdout,
|
||||
" -extern-all\n"
|
||||
"\t If this option is given then clisp definitions for all the functions\n"
|
||||
"and global variables will be created otherwise only definitions for \n"
|
||||
"externed functions and variables are created.\n"
|
||||
" -generate-typedef\n"
|
||||
"\t If this option is given then def-c-type will be used to generate shortcuts\n"
|
||||
"according to the typedefs in the input.\n");
|
||||
Printf(stdout, "%s\n", usage);
|
||||
} else if ((Strcmp(argv[i], "-extern-all") == 0)) {
|
||||
extern_all_flag = 1;
|
||||
Swig_mark_arg(i);
|
||||
|
|
@ -293,16 +294,18 @@ int CLISP::classDeclaration(Node *n) {
|
|||
}
|
||||
|
||||
String *temp = Copy(Getattr(c, "decl"));
|
||||
Append(temp, Getattr(c, "type")); //appending type to the end, otherwise wrong type
|
||||
String *lisp_type = get_ffi_type(n, temp);
|
||||
Delete(temp);
|
||||
if (temp) {
|
||||
Append(temp, Getattr(c, "type")); //appending type to the end, otherwise wrong type
|
||||
String *lisp_type = get_ffi_type(n, temp);
|
||||
Delete(temp);
|
||||
|
||||
String *slot_name = Getattr(c, "sym:name");
|
||||
Printf(f_cl, "\n\t(%s %s)", slot_name, lisp_type);
|
||||
String *slot_name = Getattr(c, "sym:name");
|
||||
Printf(f_cl, "\n\t(%s %s)", slot_name, lisp_type);
|
||||
|
||||
Append(entries, NewStringf("%s-%s", name, slot_name));
|
||||
Append(entries, NewStringf("%s-%s", name, slot_name));
|
||||
|
||||
Delete(lisp_type);
|
||||
Delete(lisp_type);
|
||||
}
|
||||
}
|
||||
|
||||
Printf(f_cl, ")\n");
|
||||
|
|
|
|||
|
|
@ -646,7 +646,6 @@ public:
|
|||
|
||||
UpcallData *addUpcallMethod(String *imclass_method, String *class_method, String *decl, String *overloaded_name) {
|
||||
UpcallData *udata;
|
||||
String *imclass_methodidx;
|
||||
String *class_methodidx;
|
||||
Hash *new_udata;
|
||||
String *key = NewStringf("%s|%s", imclass_method, decl);
|
||||
|
|
@ -659,7 +658,6 @@ public:
|
|||
return Getattr(udata, "methodoff");
|
||||
}
|
||||
|
||||
imclass_methodidx = NewStringf("%d", n_dmethods);
|
||||
class_methodidx = NewStringf("%d", n_dmethods - first_class_dmethod);
|
||||
n_dmethods++;
|
||||
|
||||
|
|
@ -668,10 +666,6 @@ public:
|
|||
Setattr(dmethods_table, key, new_udata);
|
||||
|
||||
Setattr(new_udata, "method", Copy(class_method));
|
||||
// TODO: remove fdesc
|
||||
// Setattr(new_udata, "fdesc", Copy(class_desc));
|
||||
// Setattr(new_udata, "imclass_method", Copy(imclass_method));
|
||||
// Setattr(new_udata, "imclass_methodidx", imclass_methodidx);
|
||||
Setattr(new_udata, "class_methodidx", class_methodidx);
|
||||
Setattr(new_udata, "decl", Copy(decl));
|
||||
Setattr(new_udata, "overname", Copy(overloaded_name));
|
||||
|
|
@ -736,7 +730,6 @@ public:
|
|||
String *body = NewString("");
|
||||
String *im_outattributes = 0;
|
||||
int num_arguments = 0;
|
||||
int num_required = 0;
|
||||
bool is_void_return;
|
||||
String *overloaded_name = getOverloadedName(n);
|
||||
|
||||
|
|
@ -815,7 +808,6 @@ public:
|
|||
|
||||
/* Get number of required and total arguments */
|
||||
num_arguments = emit_num_arguments(l);
|
||||
num_required = emit_num_required(l);
|
||||
int gencomma = 0;
|
||||
|
||||
// Now walk the function parameter list and generate code to get arguments
|
||||
|
|
@ -1282,11 +1274,15 @@ public:
|
|||
// Note that this is used in enumValue() amongst other places
|
||||
Setattr(n, "value", tmpValue);
|
||||
|
||||
// Deal with enum values that are bools
|
||||
if (SwigType_type(Getattr(n, "type")) == T_BOOL) {
|
||||
String *boolValue = NewStringf("%s ? 1 : 0", Getattr(n, "enumvalue"));
|
||||
Setattr(n, "enumvalue", boolValue);
|
||||
Delete(boolValue);
|
||||
// Deal with enum values that are not int
|
||||
int swigtype = SwigType_type(Getattr(n, "type"));
|
||||
if (swigtype == T_BOOL) {
|
||||
const char *val = Equal(Getattr(n, "enumvalue"), "true") ? "1" : "0";
|
||||
Setattr(n, "enumvalue", val);
|
||||
} else if (swigtype == T_CHAR) {
|
||||
String *val = NewStringf("'%s'", Getattr(n, "enumvalue"));
|
||||
Setattr(n, "enumvalue", val);
|
||||
Delete(val);
|
||||
}
|
||||
|
||||
{
|
||||
|
|
@ -1337,11 +1333,12 @@ public:
|
|||
}
|
||||
} else {
|
||||
// Wrap C/C++ enums with constant integers or use the typesafe enum pattern
|
||||
String *type = Getattr(n, "type"); /* should be int unless explicitly specified in a C++0x enum class */
|
||||
SwigType *typemap_lookup_type = parent_name ? parent_name : type;
|
||||
SwigType *typemap_lookup_type = parent_name ? parent_name : NewString("enum ");
|
||||
Setattr(n, "type", typemap_lookup_type);
|
||||
const String *tm = typemapLookup(n, "cstype", typemap_lookup_type, WARN_CSHARP_TYPEMAP_CSTYPE_UNDEF);
|
||||
|
||||
String *return_type = Copy(tm);
|
||||
substituteClassname(typemap_lookup_type, return_type);
|
||||
const String *methodmods = Getattr(n, "feature:cs:methodmodifiers");
|
||||
methodmods = methodmods ? methodmods : (is_public(n) ? public_string : protected_string);
|
||||
|
||||
|
|
@ -1370,6 +1367,7 @@ public:
|
|||
Printf(enum_code, " %s %s %s %s = %s;\n", methodmods, const_readonly, return_type, symname, value);
|
||||
Delete(value);
|
||||
}
|
||||
Delete(return_type);
|
||||
}
|
||||
|
||||
// Add the enum value to the comma separated list being constructed in the enum declaration.
|
||||
|
|
@ -1404,6 +1402,7 @@ public:
|
|||
String *tm;
|
||||
String *return_type = NewString("");
|
||||
String *constants_code = NewString("");
|
||||
Swig_save("constantWrapper", n, "value", NIL);
|
||||
|
||||
bool is_enum_item = (Cmp(nodeType(n), "enumitem") == 0);
|
||||
|
||||
|
|
@ -1452,7 +1451,6 @@ public:
|
|||
|
||||
// Add the stripped quotes back in
|
||||
String *new_value = NewString("");
|
||||
Swig_save("constantWrapper", n, "value", NIL);
|
||||
if (SwigType_type(t) == T_STRING) {
|
||||
Printf(new_value, "\"%s\"", Copy(Getattr(n, "value")));
|
||||
Setattr(n, "value", new_value);
|
||||
|
|
@ -2292,17 +2290,24 @@ public:
|
|||
String *ex_imcall = Copy(imcall);
|
||||
Replaceall(ex_imcall, "$imfuncname", ex_intermediary_function_name);
|
||||
Replaceall(imcall, "$imfuncname", intermediary_function_name);
|
||||
|
||||
String *excode = NewString("");
|
||||
if (!Cmp(return_type, "void"))
|
||||
Printf(excode, "if (this.GetType() == typeof(%s)) %s; else %s", proxy_class_name, imcall, ex_imcall);
|
||||
else
|
||||
Printf(excode, "((this.GetType() == typeof(%s)) ? %s : %s)", proxy_class_name, imcall, ex_imcall);
|
||||
Node *directorNode = Getattr(n, "directorNode");
|
||||
if (directorNode) {
|
||||
UpcallData *udata = Getattr(directorNode, "upcalldata");
|
||||
String *methid = Getattr(udata, "class_methodidx");
|
||||
|
||||
Clear(imcall);
|
||||
Printv(imcall, excode, NIL);
|
||||
Delete(ex_overloaded_name);
|
||||
if (!Cmp(return_type, "void"))
|
||||
Printf(excode, "if (SwigDerivedClassHasMethod(\"%s\", swigMethodTypes%s)) %s; else %s", proxy_function_name, methid, ex_imcall, imcall);
|
||||
else
|
||||
Printf(excode, "(SwigDerivedClassHasMethod(\"%s\", swigMethodTypes%s) ? %s : %s)", proxy_function_name, methid, ex_imcall, imcall);
|
||||
|
||||
Clear(imcall);
|
||||
Printv(imcall, excode, NIL);
|
||||
} else {
|
||||
// probably an ignored method or nodirector
|
||||
}
|
||||
Delete(excode);
|
||||
Delete(ex_overloaded_name);
|
||||
} else {
|
||||
Replaceall(imcall, "$imfuncname", intermediary_function_name);
|
||||
}
|
||||
|
|
@ -2343,6 +2348,7 @@ public:
|
|||
SwigType *pt = Getattr(p, "type");
|
||||
if ((tm = Getattr(p, "tmap:csvarin"))) {
|
||||
substituteClassname(pt, tm);
|
||||
Replaceall(tm, "$csinput", "value");
|
||||
Replaceall(tm, "$imcall", imcall);
|
||||
excodeSubstitute(n, tm, "csvarin", p);
|
||||
Printf(proxy_class_code, "%s", tm);
|
||||
|
|
@ -2699,7 +2705,6 @@ public:
|
|||
String *return_type = NewString("");
|
||||
String *function_code = NewString("");
|
||||
int num_arguments = 0;
|
||||
int num_required = 0;
|
||||
String *overloaded_name = getOverloadedName(n);
|
||||
String *func_name = NULL;
|
||||
bool setter_flag = false;
|
||||
|
|
@ -2759,7 +2764,6 @@ public:
|
|||
|
||||
/* Get number of required and total arguments */
|
||||
num_arguments = emit_num_arguments(l);
|
||||
num_required = emit_num_required(l);
|
||||
|
||||
bool global_or_member_variable = global_variable_flag || (wrapping_member_flag && !enum_constant_flag);
|
||||
int gencomma = 0;
|
||||
|
|
@ -3472,7 +3476,6 @@ public:
|
|||
String *callback_def = NewString("");
|
||||
String *callback_code = NewString("");
|
||||
String *imcall_args = NewString("");
|
||||
int gencomma = 0;
|
||||
bool ignored_method = GetFlag(n, "feature:ignore") ? true : false;
|
||||
|
||||
// Kludge Alert: functionWrapper sets sym:overload properly, but it
|
||||
|
|
@ -3616,14 +3619,14 @@ public:
|
|||
Printf(w->code, "} else {\n");
|
||||
|
||||
/* Go through argument list, convert from native to Java */
|
||||
for (p = l; p; /* empty */ ) {
|
||||
for (i = 0, p = l; p; ++i) {
|
||||
/* Is this superfluous? */
|
||||
while (checkAttribute(p, "tmap:directorin:numinputs", "0")) {
|
||||
p = Getattr(p, "tmap:directorin:next");
|
||||
}
|
||||
|
||||
SwigType *pt = Getattr(p, "type");
|
||||
String *ln = Copy(Getattr(p, "name"));
|
||||
String *ln = makeParameterName(n, p, i, false);
|
||||
String *c_param_type = NULL;
|
||||
String *c_decl = NewString("");
|
||||
String *arg = NewString("");
|
||||
|
|
@ -3631,7 +3634,7 @@ public:
|
|||
Printf(arg, "j%s", ln);
|
||||
|
||||
/* And add to the upcall args */
|
||||
if (gencomma > 0)
|
||||
if (i > 0)
|
||||
Printf(jupcall_args, ", ");
|
||||
Printf(jupcall_args, "%s", arg);
|
||||
|
||||
|
|
@ -3641,17 +3644,13 @@ public:
|
|||
if (ctypeout)
|
||||
c_param_type = ctypeout;
|
||||
|
||||
Parm *tp = NewParm(c_param_type, empty_str, n);
|
||||
String *desc_tm = NULL;
|
||||
|
||||
/* Add to local variables */
|
||||
Printf(c_decl, "%s %s", c_param_type, arg);
|
||||
if (!ignored_method)
|
||||
Wrapper_add_localv(w, arg, c_decl, (!(SwigType_ispointer(pt) || SwigType_isreference(pt)) ? "" : "= 0"), NIL);
|
||||
|
||||
/* Add input marshalling code */
|
||||
if ((desc_tm = Swig_typemap_lookup("directorin", tp, "", 0))
|
||||
&& (tm = Getattr(p, "tmap:directorin"))) {
|
||||
if ((tm = Getattr(p, "tmap:directorin"))) {
|
||||
|
||||
Replaceall(tm, "$input", arg);
|
||||
Replaceall(tm, "$owner", "0");
|
||||
|
|
@ -3663,7 +3662,7 @@ public:
|
|||
Delete(tm);
|
||||
|
||||
/* Add C type to callback typedef */
|
||||
if (gencomma > 0)
|
||||
if (i > 0)
|
||||
Printf(callback_typedef_parms, ", ");
|
||||
Printf(callback_typedef_parms, "%s", c_param_type);
|
||||
|
||||
|
|
@ -3684,7 +3683,7 @@ public:
|
|||
substituteClassname(pt, din);
|
||||
Replaceall(din, "$iminput", ln);
|
||||
|
||||
if (gencomma > 0) {
|
||||
if (i > 0) {
|
||||
Printf(delegate_parms, ", ");
|
||||
Printf(proxy_method_types, ", ");
|
||||
Printf(imcall_args, ", ");
|
||||
|
|
@ -3716,24 +3715,13 @@ public:
|
|||
|
||||
p = Getattr(p, "tmap:directorin:next");
|
||||
|
||||
Delete(desc_tm);
|
||||
} else {
|
||||
if (!desc_tm) {
|
||||
Swig_warning(WARN_CSHARP_TYPEMAP_CSDIRECTORIN_UNDEF, input_file, line_number,
|
||||
"No or improper directorin typemap defined for %s for use in %s::%s (skipping director method)\n",
|
||||
SwigType_str(c_param_type, 0), SwigType_namestr(c_classname), SwigType_namestr(name));
|
||||
p = nextSibling(p);
|
||||
} else if (!tm) {
|
||||
Swig_warning(WARN_CSHARP_TYPEMAP_CSDIRECTORIN_UNDEF, input_file, line_number,
|
||||
"No or improper directorin typemap defined for argument %s for use in %s::%s (skipping director method)\n",
|
||||
SwigType_str(pt, 0), SwigType_namestr(c_classname), SwigType_namestr(name));
|
||||
p = nextSibling(p);
|
||||
}
|
||||
|
||||
Swig_warning(WARN_CSHARP_TYPEMAP_CSDIRECTORIN_UNDEF, input_file, line_number,
|
||||
"No or improper directorin typemap defined for argument %s for use in %s::%s (skipping director method)\n",
|
||||
SwigType_str(pt, 0), SwigType_namestr(c_classname), SwigType_namestr(name));
|
||||
p = nextSibling(p);
|
||||
output_director = false;
|
||||
}
|
||||
|
||||
Delete(tp);
|
||||
} else {
|
||||
Swig_warning(WARN_CSHARP_TYPEMAP_CTYPE_UNDEF, input_file, line_number, "No ctype typemap defined for %s for use in %s::%s (skipping director method)\n",
|
||||
SwigType_str(pt, 0), SwigType_namestr(c_classname), SwigType_namestr(name));
|
||||
|
|
@ -3741,7 +3729,7 @@ public:
|
|||
p = nextSibling(p);
|
||||
}
|
||||
|
||||
gencomma++;
|
||||
Delete(ln);
|
||||
Delete(arg);
|
||||
Delete(c_decl);
|
||||
Delete(c_param_type);
|
||||
|
|
@ -3884,6 +3872,10 @@ public:
|
|||
/* Emit the actual upcall through */
|
||||
UpcallData *udata = addUpcallMethod(imclass_dmethod, symname, decl, overloaded_name);
|
||||
String *methid = Getattr(udata, "class_methodidx");
|
||||
Setattr(n, "upcalldata", udata);
|
||||
/*
|
||||
Printf(stdout, "setting upcalldata, nodeType: %s %s::%s %p\n", nodeType(n), classname, Getattr(n, "name"), n);
|
||||
*/
|
||||
|
||||
Printf(director_callback_typedefs, " typedef %s (SWIGSTDCALL* SWIG_Callback%s_t)(", c_ret_type, methid);
|
||||
Printf(director_callback_typedefs, "%s);\n", callback_typedef_parms);
|
||||
|
|
@ -4024,7 +4016,6 @@ public:
|
|||
|
||||
int classDirectorDestructor(Node *n) {
|
||||
Node *current_class = getCurrentClass();
|
||||
String *full_classname = Getattr(current_class, "name");
|
||||
String *classname = Swig_class_name(current_class);
|
||||
Wrapper *w = NewWrapper();
|
||||
|
||||
|
|
@ -4036,22 +4027,11 @@ public:
|
|||
Printf(w->def, "SwigDirector_%s::~SwigDirector_%s() {\n", classname, classname);
|
||||
}
|
||||
|
||||
/* Ensure that correct directordisconnect typemap's method name is called
|
||||
* here: */
|
||||
|
||||
const String *disconn_tm = NULL;
|
||||
Node *disconn_attr = NewHash();
|
||||
String *disconn_methodname = NULL;
|
||||
|
||||
disconn_tm = typemapLookup(n, "directordisconnect", full_classname, WARN_NONE, disconn_attr);
|
||||
disconn_methodname = Getattr(disconn_attr, "tmap:directordisconnect:methodname");
|
||||
|
||||
Printv(w->code, "}\n", NIL);
|
||||
|
||||
Wrapper_print(w, f_directors);
|
||||
|
||||
DelWrapper(w);
|
||||
Delete(disconn_attr);
|
||||
Delete(classname);
|
||||
return SWIG_OK;
|
||||
}
|
||||
|
|
@ -4176,5 +4156,5 @@ C# Options (available with -csharp)\n\
|
|||
-namespace <nm> - Generate wrappers into C# namespace <nm>\n\
|
||||
-noproxy - Generate the low-level functional interface instead\n\
|
||||
of proxy classes\n\
|
||||
-oldvarnames - old intermediary method names for variable wrappers\n\
|
||||
-oldvarnames - Old intermediary method names for variable wrappers\n\
|
||||
\n";
|
||||
|
|
|
|||
4679
Source/Modules/d.cxx
Normal file
4679
Source/Modules/d.cxx
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -402,7 +402,6 @@ String *emit_action(Node *n) {
|
|||
String *tm;
|
||||
String *action;
|
||||
String *wrap;
|
||||
SwigType *rt;
|
||||
ParmList *catchlist = Getattr(n, "catchlist");
|
||||
|
||||
/* Look for fragments */
|
||||
|
|
@ -440,9 +439,6 @@ String *emit_action(Node *n) {
|
|||
action = Getattr(n, "wrap:action");
|
||||
assert(action != 0);
|
||||
|
||||
/* Get the return type */
|
||||
rt = Getattr(n, "type");
|
||||
|
||||
/* Emit contract code (if any) */
|
||||
if (Swig_contract_mode_get()) {
|
||||
/* Preassertion */
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ char cvsroot_go_cxx[] = "$Id";
|
|||
#include "swigmod.h"
|
||||
#include "cparse.h"
|
||||
#include <ctype.h>
|
||||
#include <string>
|
||||
|
||||
class GO:public Language {
|
||||
static const char *const usage;
|
||||
|
|
@ -43,11 +42,9 @@ class GO:public Language {
|
|||
File *f_go_runtime;
|
||||
File *f_go_header;
|
||||
File *f_go_wrappers;
|
||||
File *f_go_once;
|
||||
File *f_gc_runtime;
|
||||
File *f_gc_header;
|
||||
File *f_gc_wrappers;
|
||||
File *f_gc_once;
|
||||
|
||||
// True if we imported a module.
|
||||
bool saw_import;
|
||||
|
|
@ -100,14 +97,14 @@ public:
|
|||
f_go_runtime(NULL),
|
||||
f_go_header(NULL),
|
||||
f_go_wrappers(NULL),
|
||||
f_go_once(NULL),
|
||||
f_gc_runtime(NULL),
|
||||
f_gc_header(NULL),
|
||||
f_gc_wrappers(NULL),
|
||||
f_gc_once(NULL),
|
||||
saw_import(false),
|
||||
imported_package(NULL),
|
||||
interfaces(NULL),
|
||||
class_node(NULL),
|
||||
class_name(NULL),
|
||||
class_receiver(NULL),
|
||||
class_methods(NULL),
|
||||
making_variable_wrappers(false),
|
||||
|
|
@ -303,12 +300,10 @@ private:
|
|||
f_go_runtime = NewString("");
|
||||
f_go_header = NewString("");
|
||||
f_go_wrappers = NewString("");
|
||||
f_go_once = NewString("");
|
||||
if (!gccgo_flag) {
|
||||
f_gc_runtime = NewString("");
|
||||
f_gc_header = NewString("");
|
||||
f_gc_wrappers = NewString("");
|
||||
f_gc_once = NewString("");
|
||||
}
|
||||
|
||||
Swig_register_filebyname("begin", f_c_begin);
|
||||
|
|
@ -322,13 +317,11 @@ private:
|
|||
Swig_register_filebyname("go_runtime", f_go_runtime);
|
||||
Swig_register_filebyname("go_header", f_go_header);
|
||||
Swig_register_filebyname("go_wrapper", f_go_wrappers);
|
||||
Swig_register_filebyname("go_once", f_go_once);
|
||||
if (!gccgo_flag) {
|
||||
Swig_register_filebyname("gc_begin", f_gc_begin);
|
||||
Swig_register_filebyname("gc_runtime", f_gc_runtime);
|
||||
Swig_register_filebyname("gc_header", f_gc_header);
|
||||
Swig_register_filebyname("gc_wrapper", f_gc_wrappers);
|
||||
Swig_register_filebyname("gc_once", f_gc_once);
|
||||
}
|
||||
|
||||
Swig_banner(f_c_begin);
|
||||
|
|
@ -349,6 +342,7 @@ private:
|
|||
if (!gccgo_flag) {
|
||||
Swig_banner(f_gc_begin);
|
||||
Printf(f_gc_begin, "\n/* This file should be compiled with 6c/8c. */\n");
|
||||
Printf(f_gc_begin, "#pragma dynimport _ _ \"%s\"\n", soname);
|
||||
}
|
||||
|
||||
// Output module initialization code.
|
||||
|
|
@ -414,16 +408,10 @@ private:
|
|||
Dump(f_c_wrappers, f_c_begin);
|
||||
Dump(f_c_init, f_c_begin);
|
||||
Dump(f_go_header, f_go_begin);
|
||||
if (!saw_import) {
|
||||
Dump(f_go_once, f_go_begin);
|
||||
}
|
||||
Dump(f_go_runtime, f_go_begin);
|
||||
Dump(f_go_wrappers, f_go_begin);
|
||||
if (!gccgo_flag) {
|
||||
Dump(f_gc_header, f_gc_begin);
|
||||
if (!saw_import) {
|
||||
Dump(f_gc_once, f_gc_begin);
|
||||
}
|
||||
Dump(f_gc_runtime, f_gc_begin);
|
||||
Dump(f_gc_wrappers, f_gc_begin);
|
||||
}
|
||||
|
|
@ -586,7 +574,7 @@ private:
|
|||
result = NewString("void");
|
||||
r1 = result;
|
||||
} else {
|
||||
if (!is_public(n)) {
|
||||
if (!checkFunctionVisibility(n, NULL)) {
|
||||
return SWIG_OK;
|
||||
}
|
||||
|
||||
|
|
@ -660,7 +648,7 @@ private:
|
|||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* staticmemberfunctionHandler
|
||||
* staticmemberfunctionHandler()
|
||||
*
|
||||
* For some reason the language code removes the "storage" attribute
|
||||
* for a static function before calling functionWrapper, which means
|
||||
|
|
@ -759,7 +747,7 @@ private:
|
|||
receiver = NULL;
|
||||
}
|
||||
|
||||
bool add_to_interface = (interfaces && !is_constructor && !is_destructor && !is_static && !overname && is_public(n));
|
||||
bool add_to_interface = (interfaces && !is_constructor && !is_destructor && !is_static && !overname && checkFunctionVisibility(n, NULL));
|
||||
|
||||
bool needs_wrapper = (gccgo_flag || receiver || is_constructor || is_destructor || parm_count > required_count);
|
||||
|
||||
|
|
@ -1011,8 +999,9 @@ private:
|
|||
int gcFunctionWrapper(Node *n, String *name, String *go_name, String *overname, String *wname, ParmList *parms, SwigType *result, bool is_static, bool needs_wrapper) {
|
||||
Wrapper *f = NewWrapper();
|
||||
|
||||
Printv(f->def, "#pragma dynimport ", wname, " ", wname, " \"", soname, "\"\n", NULL);
|
||||
Printv(f->def, "void (*", wname, ")(void*);\n", NULL);
|
||||
Printv(f->def, "#pragma dynimport ", wname, " ", wname, " \"\"\n", NULL);
|
||||
Printv(f->def, "extern void (*", wname, ")(void*);\n", NULL);
|
||||
Printv(f->def, "static void (*x", wname, ")(void*) = ", wname, ";\n", NULL);
|
||||
Printv(f->def, "\n", NULL);
|
||||
Printv(f->def, "void\n", NULL);
|
||||
|
||||
|
|
@ -1068,7 +1057,7 @@ private:
|
|||
Delete(parm_size);
|
||||
|
||||
Printv(f->code, "{\n", NULL);
|
||||
Printv(f->code, "\tcgocall(", wname, ", &p);\n", NULL);
|
||||
Printv(f->code, "\truntime\xc2\xb7" "cgocall(x", wname, ", &p);\n", NULL);
|
||||
Printv(f->code, "}\n", NULL);
|
||||
Printv(f->code, "\n", NULL);
|
||||
|
||||
|
|
@ -1099,9 +1088,9 @@ private:
|
|||
// A slice has a pointer, a length, and a capacity. The
|
||||
// length and capacity are always 4 bytes.
|
||||
Append(orig, "(SWIG_PARM_SIZE + 8)");
|
||||
} else if (Strcmp(go, "float") == 0 || Strcmp(go, "float64") == 0) {
|
||||
} else if (Strcmp(go, "float64") == 0) {
|
||||
Append(orig, "8");
|
||||
} else if (Strcmp(go, "complex") == 0 || Strcmp(go, "complex64") == 0) {
|
||||
} else if (Strcmp(go, "complex64") == 0) {
|
||||
Append(orig, "8");
|
||||
} else if (Strcmp(go, "complex128") == 0) {
|
||||
Append(orig, "16");
|
||||
|
|
@ -1128,7 +1117,7 @@ private:
|
|||
|
||||
Parm *base_parm = NULL;
|
||||
if (base && !isStatic(n)) {
|
||||
SwigType *base_type = Copy(Getattr(class_node, "classtype"));
|
||||
SwigType *base_type = Copy(getClassType());
|
||||
SwigType_add_pointer(base_type);
|
||||
base_parm = NewParm(base_type, NewString("arg1"), n);
|
||||
set_nextSibling(base_parm, parms);
|
||||
|
|
@ -1166,7 +1155,7 @@ private:
|
|||
p = nextParm(p);
|
||||
}
|
||||
if (SwigType_type(result) != T_VOID) {
|
||||
Printv(f->code, "\t\tint : 0;\n", NULL);
|
||||
Printv(f->code, "\t\tlong : 0;\n", NULL);
|
||||
String *ln = NewString("result");
|
||||
String *ct = gcCTypeForGoValue(n, result, ln);
|
||||
Delete(ln);
|
||||
|
|
@ -1244,7 +1233,7 @@ private:
|
|||
|
||||
Parm *base_parm = NULL;
|
||||
if (base && !isStatic(n)) {
|
||||
SwigType *base_type = Copy(Getattr(class_node, "classtype"));
|
||||
SwigType *base_type = Copy(getClassType());
|
||||
SwigType_add_pointer(base_type);
|
||||
base_parm = NewParm(base_type, NewString("arg1"), n);
|
||||
set_nextSibling(base_parm, parms);
|
||||
|
|
@ -1270,7 +1259,11 @@ private:
|
|||
Parm *p = parms;
|
||||
for (int i = 0; i < parm_count; ++i) {
|
||||
p = getParm(p);
|
||||
SwigType *pt = Getattr(p, "type");
|
||||
SwigType *pt = Copy(Getattr(p, "type"));
|
||||
if (SwigType_isarray(pt)) {
|
||||
SwigType_del_array(pt);
|
||||
SwigType_add_pointer(pt);
|
||||
}
|
||||
String *pn = NewString("g");
|
||||
Append(pn, Getattr(p, "lname"));
|
||||
String *ct = gccgoCTypeForGoValue(p, pt, pn);
|
||||
|
|
@ -1280,6 +1273,7 @@ private:
|
|||
Printv(fnname, ct, NULL);
|
||||
Delete(ct);
|
||||
Delete(pn);
|
||||
Delete(pt);
|
||||
p = nextParm(p);
|
||||
}
|
||||
|
||||
|
|
@ -1405,7 +1399,6 @@ private:
|
|||
}
|
||||
Printv(current, Getattr(parms, "lname"), NULL);
|
||||
|
||||
String *last = NULL;
|
||||
int vc = 0;
|
||||
for (Iterator bi = First(base); bi.item; bi = Next(bi)) {
|
||||
Printf(actioncode, " %s *swig_b%d = (%s *)%s;\n", bi.item, vc, bi.item, current);
|
||||
|
|
@ -1413,7 +1406,6 @@ private:
|
|||
current = NewString("");
|
||||
Printf(current, "swig_b%d", vc);
|
||||
++vc;
|
||||
last = bi.item;
|
||||
}
|
||||
|
||||
String *code = Copy(Getattr(n, "wrap:action"));
|
||||
|
|
@ -2679,7 +2671,7 @@ private:
|
|||
|
||||
Setattr(n, "wrap:name", fnname);
|
||||
|
||||
Swig_DestructorToFunction(n, getNSpace(), Getattr(parentNode(n), "classtype"), CPlusPlus, Extend);
|
||||
Swig_DestructorToFunction(n, getNSpace(), getClassType(), CPlusPlus, Extend);
|
||||
|
||||
ParmList *parms = Getattr(n, "parms");
|
||||
Setattr(n, "wrap:parms", parms);
|
||||
|
|
@ -2749,7 +2741,7 @@ private:
|
|||
Printv(f_gc_wrappers, "void\n", NULL);
|
||||
Printv(f_gc_wrappers, wname, "(void *a, int32 n)\n", NULL);
|
||||
Printv(f_gc_wrappers, "{\n", NULL);
|
||||
Printv(f_gc_wrappers, "\tcgocallback(\xc2\xb7", go_name, ", a, n);\n", NULL);
|
||||
Printv(f_gc_wrappers, "\truntime\xc2\xb7" "cgocallback(\xc2\xb7", go_name, ", a, n);\n", NULL);
|
||||
Printv(f_gc_wrappers, "}\n\n", NULL);
|
||||
} else {
|
||||
Printv(f_c_directors, " ", wname, "(go_val);\n", NULL);
|
||||
|
|
@ -2779,8 +2771,6 @@ private:
|
|||
* ------------------------------------------------------------ */
|
||||
|
||||
int classDirectorMethod(Node *n, Node *parent, String *super) {
|
||||
(void) super;
|
||||
|
||||
bool is_ignored = GetFlag(n, "feature:ignore") ? true : false;
|
||||
bool is_pure_virtual = (Cmp(Getattr(n, "storage"), "virtual") == 0 && Cmp(Getattr(n, "value"), "0") == 0);
|
||||
|
||||
|
|
@ -2807,7 +2797,7 @@ private:
|
|||
Setattr(class_methods, name, NewString(""));
|
||||
|
||||
if (!Getattr(n, "sym:overloaded")) {
|
||||
int r = oneClassDirectorMethod(n, parent);
|
||||
int r = oneClassDirectorMethod(n, parent, super);
|
||||
if (r != SWIG_OK) {
|
||||
return r;
|
||||
}
|
||||
|
|
@ -2818,7 +2808,7 @@ private:
|
|||
// function in one class hides a function of the same name in a
|
||||
// parent class.
|
||||
for (Node *on = Getattr(n, "sym:overloaded"); on; on = Getattr(on, "sym:nextSibling")) {
|
||||
int r = oneClassDirectorMethod(on, parent);
|
||||
int r = oneClassDirectorMethod(on, parent, super);
|
||||
if (r != SWIG_OK) {
|
||||
return r;
|
||||
}
|
||||
|
|
@ -2868,7 +2858,11 @@ private:
|
|||
* Emit a method for a director class.
|
||||
* ------------------------------------------------------------ */
|
||||
|
||||
int oneClassDirectorMethod(Node *n, Node *parent) {
|
||||
int oneClassDirectorMethod(Node *n, Node *parent, String *super) {
|
||||
if (!checkFunctionVisibility(n, parent)) {
|
||||
return SWIG_OK;
|
||||
}
|
||||
|
||||
bool is_ignored = GetFlag(n, "feature:ignore") ? true : false;
|
||||
bool is_pure_virtual = (Cmp(Getattr(n, "storage"), "virtual") == 0 && Cmp(Getattr(n, "value"), "0") == 0);
|
||||
|
||||
|
|
@ -3111,24 +3105,13 @@ private:
|
|||
if (SwigType_type(result) != T_VOID) {
|
||||
Printv(f_c_directors_h, "return ", NULL);
|
||||
}
|
||||
Printv(f_c_directors_h, Getattr(parent, "classtype"), "::", Getattr(n, "name"), "(", NULL);
|
||||
|
||||
p = parms;
|
||||
for (int i = 0; i < parm_count; ++i) {
|
||||
p = getParm(p);
|
||||
if (i > 0) {
|
||||
Printv(f_c_directors_h, ", ", NULL);
|
||||
}
|
||||
String *pn = Getattr(p, "name");
|
||||
assert(pn);
|
||||
Printv(f_c_directors_h, pn, NULL);
|
||||
p = nextParm(p);
|
||||
}
|
||||
String *super_call = Swig_method_call(super, parms);
|
||||
Printv(f_c_directors_h, super_call, ";\n", NULL);
|
||||
Delete(super_call);
|
||||
|
||||
Printv(f_c_directors_h, ");\n", NULL);
|
||||
Printv(f_c_directors_h, " }\n", NULL);
|
||||
|
||||
|
||||
// Define the C++ function that the Go function calls.
|
||||
|
||||
SwigType *first_type = NULL;
|
||||
|
|
@ -3415,7 +3398,7 @@ private:
|
|||
p = Getattr(p, "tmap:directorin:next");
|
||||
}
|
||||
if (SwigType_type(result) != T_VOID) {
|
||||
Printv(f->code, " int : 0;\n", NULL);
|
||||
Printv(f->code, " long : 0;\n", NULL);
|
||||
String *rname = NewString("result");
|
||||
String *cg = gcCTypeForGoValue(n, result, rname);
|
||||
Printv(f->code, " ", cg, ";\n", NULL);
|
||||
|
|
@ -3475,7 +3458,7 @@ private:
|
|||
Printv(f_gc_wrappers, "void\n", NULL);
|
||||
Printv(f_gc_wrappers, callback_wname, "(void *a, int32 n)\n", NULL);
|
||||
Printv(f_gc_wrappers, "{\n", NULL);
|
||||
Printv(f_gc_wrappers, "\tcgocallback(\xc2\xb7", callback_name, ", a, n);\n", NULL);
|
||||
Printv(f_gc_wrappers, "\truntime\xc2\xb7" "cgocallback(\xc2\xb7", callback_name, ", a, n);\n", NULL);
|
||||
Printv(f_gc_wrappers, "}\n\n", NULL);
|
||||
} else {
|
||||
if (SwigType_type(result) != T_VOID) {
|
||||
|
|
@ -3545,7 +3528,7 @@ private:
|
|||
}
|
||||
} else {
|
||||
assert(is_pure_virtual);
|
||||
Printv(f->code, " _swig_gopanic(\"call to pure virtual function ", Getattr(parent, "sym:name"), name, "\");\n");
|
||||
Printv(f->code, " _swig_gopanic(\"call to pure virtual function ", Getattr(parent, "sym:name"), name, "\");\n", NULL);
|
||||
if (SwigType_type(result) != T_VOID) {
|
||||
String *retstr = SwigType_rcaststr(Getattr(n, "returntype"), "c_result");
|
||||
Printv(f->code, " return ", retstr, ";\n", NULL);
|
||||
|
|
@ -3809,7 +3792,8 @@ private:
|
|||
int nak = emit_num_arguments(pk);
|
||||
if ((nrk >= num_required && nrk <= num_arguments)
|
||||
|| (nak >= num_required && nak <= num_arguments)
|
||||
|| (nrk <= num_required && nak >= num_arguments)) {
|
||||
|| (nrk <= num_required && nak >= num_arguments)
|
||||
|| (varargs && nrk >= num_required)) {
|
||||
Append(coll, nk);
|
||||
}
|
||||
}
|
||||
|
|
@ -3999,7 +3983,6 @@ private:
|
|||
Delete(coll);
|
||||
}
|
||||
|
||||
Printv(f_go_wrappers, "fail:\n", NULL);
|
||||
Printv(f_go_wrappers, "\tpanic(\"No match for overloaded function call\")\n", NULL);
|
||||
Printv(f_go_wrappers, "}\n\n", NULL);
|
||||
|
||||
|
|
@ -4009,6 +3992,32 @@ private:
|
|||
return SWIG_OK;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* checkFunctionVisibility()
|
||||
*
|
||||
* Return true if we should write out a function based on its
|
||||
* visibility, false otherwise.
|
||||
* ---------------------------------------------------------------------- */
|
||||
|
||||
bool checkFunctionVisibility(Node *n, Node *parent) {
|
||||
// Write out a public function.
|
||||
if (is_public(n))
|
||||
return true;
|
||||
// Don't write out a private function.
|
||||
if (is_private(n))
|
||||
return false;
|
||||
// Write a protected function for a director class in
|
||||
// dirprot_mode.
|
||||
if (parent == NULL) {
|
||||
return false;
|
||||
}
|
||||
if (dirprot_mode() && Swig_directorclass(parent))
|
||||
return true;
|
||||
// Otherwise don't write out a protected function.
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* exportedName()
|
||||
*
|
||||
|
|
@ -4409,6 +4418,8 @@ private:
|
|||
SwigType_del_qualifier(r);
|
||||
ret = goTypeWithInfo(n, r, p_is_interface);
|
||||
Delete(r);
|
||||
} else if (SwigType_isvarargs(t)) {
|
||||
ret = NewString("[]interface{}");
|
||||
}
|
||||
|
||||
Delete(t);
|
||||
|
|
@ -4520,9 +4531,22 @@ private:
|
|||
bool is_slice = Strncmp(gt, "[]", 2) == 0;
|
||||
bool is_function = Strcmp(gt, "_swig_fnptr") == 0;
|
||||
bool is_member = Strcmp(gt, "_swig_memberptr") == 0;
|
||||
bool is_complex = Strcmp(gt, "complex") == 0;
|
||||
bool is_complex64 = Strcmp(gt, "complex64") == 0;
|
||||
bool is_complex128 = Strcmp(gt, "complex128") == 0;
|
||||
bool is_char = false;
|
||||
bool is_short = false;
|
||||
bool is_int = false;
|
||||
bool is_long = false;
|
||||
bool is_float = false;
|
||||
bool is_double = false;
|
||||
if ((n != NULL && Getattr(n, "tmap:gotype") != NULL) || hasGoTypemap(type)) {
|
||||
is_char = Strcmp(gt, "int8") == 0 || Strcmp(gt, "uint8") == 0 || Strcmp(gt, "byte") == 0;
|
||||
is_short = Strcmp(gt, "int16") == 0 || Strcmp(gt, "uint16") == 0;
|
||||
is_int = Strcmp(gt, "int") == 0 || Strcmp(gt, "int32") == 0 || Strcmp(gt, "uint32") == 0;
|
||||
is_long = Strcmp(gt, "int64") == 0 || Strcmp(gt, "uint64") == 0;
|
||||
is_float = Strcmp(gt, "float32") == 0;
|
||||
is_double = Strcmp(gt, "float64") == 0;
|
||||
}
|
||||
Delete(gt);
|
||||
|
||||
String *ret;
|
||||
|
|
@ -4538,7 +4562,7 @@ private:
|
|||
ret = NewString("void *");
|
||||
Append(ret, name);
|
||||
return ret;
|
||||
} else if (is_complex || is_complex64) {
|
||||
} else if (is_complex64) {
|
||||
ret = NewString("_Complex float ");
|
||||
} else if (is_complex128) {
|
||||
ret = NewString("_Complex double ");
|
||||
|
|
@ -4578,7 +4602,21 @@ private:
|
|||
}
|
||||
}
|
||||
Delete(t);
|
||||
return SwigType_lstr(type, name);
|
||||
if (is_char) {
|
||||
ret = NewString("char ");
|
||||
} else if (is_short) {
|
||||
ret = NewString("short ");
|
||||
} else if (is_int) {
|
||||
ret = NewString("int ");
|
||||
} else if (is_long) {
|
||||
ret = NewString("long long ");
|
||||
} else if (is_float) {
|
||||
ret = NewString("float ");
|
||||
} else if (is_double) {
|
||||
ret = NewString("double ");
|
||||
} else {
|
||||
return SwigType_lstr(type, name);
|
||||
}
|
||||
}
|
||||
|
||||
if (SwigType_isreference(type)) {
|
||||
|
|
@ -4745,9 +4783,9 @@ extern "C" Language *swig_go(void) {
|
|||
// Usage message.
|
||||
const char * const GO::usage = (char *) "\
|
||||
Go Options (available with -go)\n\
|
||||
-package <name> - Set name of the Go package to <name>\n\
|
||||
-gccgo - Generate code for gccgo rather than 6g/8g\n\
|
||||
-go-prefix <p> - Like gccgo -fgo-prefix option\n\
|
||||
-soname <name> - Set shared library holding C/C++ code to <name>\n\
|
||||
-longsize <s> - Set size of C/C++ long type--32 or 64 bits\n\
|
||||
-package <name> - Set name of the Go package to <name>\n\
|
||||
-soname <name> - Set shared library holding C/C++ code to <name>\n\
|
||||
\n";
|
||||
|
|
|
|||
|
|
@ -18,19 +18,15 @@ char cvsroot_guile_cxx[] = "$Id$";
|
|||
#include <ctype.h>
|
||||
|
||||
// Note string broken in half for compilers that can't handle long strings
|
||||
static const char *guile_usage = (char *) "\
|
||||
static const char *usage = (char *) "\
|
||||
Guile Options (available with -guile)\n\
|
||||
-prefix <name> - Use <name> as prefix [default \"gswig_\"]\n\
|
||||
-package <name> - Set the path of the module to <name>\n\
|
||||
(default NULL)\n\
|
||||
-emitsetters - Emit procedures-with-setters for variables\n\
|
||||
and structure slots.\n\
|
||||
-onlysetters - Don't emit traditional getter and setter\n\
|
||||
procedures for structure slots,\n\
|
||||
only emit procedures-with-setters.\n\
|
||||
-procdoc <file> - Output procedure documentation to <file>\n\
|
||||
-procdocformat <format> - Output procedure documentation in <format>;\n\
|
||||
one of `guile-1.4', `plain', `texinfo'\n\
|
||||
-emitslotaccessors - Emit accessor methods for all GOOPS slots\n" "\
|
||||
-exportprimitive - Add the (export ...) code from scmstub into the\n\
|
||||
GOOPS file.\n\
|
||||
-gh - Use the gh_ Guile API. (Guile <= 1.8) \n\
|
||||
-goopsprefix <prefix> - Prepend <prefix> to all goops identifiers\n\
|
||||
-linkage <lstyle> - Use linkage protocol <lstyle> (default `simple')\n\
|
||||
Use `module' for native Guile module linking\n\
|
||||
(requires Guile >= 1.5.0). Use `passive' for\n\
|
||||
|
|
@ -38,18 +34,23 @@ Guile Options (available with -guile)\n\
|
|||
`ltdlmod' for Guile's old dynamic module\n\
|
||||
convention (Guile <= 1.4), or `hobbit' for hobbit\n\
|
||||
modules.\n\
|
||||
-scmstub - Output Scheme file with module declaration and\n\
|
||||
exports; only with `passive' and `simple' linkage\n\
|
||||
-gh - Use the gh_ Guile API. (Guile <= 1.8) \n\
|
||||
-scm - Use the scm Guile API. (Guile >= 1.6, default) \n\
|
||||
-onlysetters - Don't emit traditional getter and setter\n\
|
||||
procedures for structure slots,\n\
|
||||
only emit procedures-with-setters.\n\
|
||||
-package <name> - Set the path of the module to <name>\n\
|
||||
(default NULL)\n\
|
||||
-prefix <name> - Use <name> as prefix [default \"gswig_\"]\n\
|
||||
-procdoc <file> - Output procedure documentation to <file>\n\
|
||||
-procdocformat <format> - Output procedure documentation in <format>;\n\
|
||||
one of `guile-1.4', `plain', `texinfo'\n\
|
||||
-proxy - Export GOOPS class definitions\n\
|
||||
-emitslotaccessors - Emit accessor methods for all GOOPS slots\n" "\
|
||||
-primsuffix <suffix> - Name appended to primitive module when exporting\n\
|
||||
GOOPS classes. (default = \"primitive\")\n\
|
||||
-goopsprefix <prefix> - Prepend <prefix> to all goops identifiers\n\
|
||||
-scm - Use the scm Guile API. (Guile >= 1.6, default) \n\
|
||||
-scmstub - Output Scheme file with module declaration and\n\
|
||||
exports; only with `passive' and `simple' linkage\n\
|
||||
-useclassprefix - Prepend the class name to all goops identifiers\n\
|
||||
-exportprimitive - Add the (export ...) code from scmstub into the\n\
|
||||
GOOPS file.\n";
|
||||
\n";
|
||||
|
||||
static File *f_begin = 0;
|
||||
static File *f_runtime = 0;
|
||||
|
|
@ -135,7 +136,7 @@ public:
|
|||
for (i = 1; i < argc; i++) {
|
||||
if (argv[i]) {
|
||||
if (strcmp(argv[i], "-help") == 0) {
|
||||
fputs(guile_usage, stdout);
|
||||
fputs(usage, stdout);
|
||||
SWIG_exit(EXIT_SUCCESS);
|
||||
} else if (strcmp(argv[i], "-prefix") == 0) {
|
||||
if (argv[i + 1]) {
|
||||
|
|
@ -1392,9 +1393,10 @@ public:
|
|||
}
|
||||
// See if there's a typemap
|
||||
|
||||
bool is_enum_item = (Cmp(nodeType(n), "enumitem") == 0);
|
||||
if (SwigType_type(nctype) == T_STRING) {
|
||||
rvalue = NewStringf("\"%s\"", value);
|
||||
} else if (SwigType_type(nctype) == T_CHAR) {
|
||||
} else if (SwigType_type(nctype) == T_CHAR && !is_enum_item) {
|
||||
rvalue = NewStringf("\'%s\'", value);
|
||||
} else {
|
||||
rvalue = NewString(value);
|
||||
|
|
|
|||
|
|
@ -808,7 +808,6 @@ public:
|
|||
String *outarg = NewString("");
|
||||
String *body = NewString("");
|
||||
int num_arguments = 0;
|
||||
int num_required = 0;
|
||||
int gencomma = 0;
|
||||
bool is_void_return;
|
||||
String *overloaded_name = getOverloadedName(n);
|
||||
|
|
@ -885,9 +884,7 @@ public:
|
|||
|
||||
Printf(imclass_class_code, " public final static native %s %s(", im_return_type, overloaded_name);
|
||||
|
||||
/* Get number of required and total arguments */
|
||||
num_arguments = emit_num_arguments(l);
|
||||
num_required = emit_num_required(l);
|
||||
|
||||
// Now walk the function parameter list and generate code to get arguments
|
||||
for (i = 0, p = l; i < num_arguments; i++) {
|
||||
|
|
@ -1352,11 +1349,15 @@ public:
|
|||
// Note that this is used in enumValue() amongst other places
|
||||
Setattr(n, "value", tmpValue);
|
||||
|
||||
// Deal with enum values that are bools
|
||||
if (SwigType_type(Getattr(n, "type")) == T_BOOL) {
|
||||
String *boolValue = NewStringf("%s ? 1 : 0", Getattr(n, "enumvalue"));
|
||||
Setattr(n, "enumvalue", boolValue);
|
||||
Delete(boolValue);
|
||||
// Deal with enum values that are not int
|
||||
int swigtype = SwigType_type(Getattr(n, "type"));
|
||||
if (swigtype == T_BOOL) {
|
||||
const char *val = Equal(Getattr(n, "enumvalue"), "true") ? "1" : "0";
|
||||
Setattr(n, "enumvalue", val);
|
||||
} else if (swigtype == T_CHAR) {
|
||||
String *val = NewStringf("'%s'", Getattr(n, "enumvalue"));
|
||||
Setattr(n, "enumvalue", val);
|
||||
Delete(val);
|
||||
}
|
||||
|
||||
{
|
||||
|
|
@ -1397,11 +1398,12 @@ public:
|
|||
}
|
||||
} else {
|
||||
// Wrap C/C++ enums with constant integers or use the typesafe enum pattern
|
||||
String *type = Getattr(n, "type"); /* should be int unless explicitly specified in a C++0x enum class */
|
||||
SwigType *typemap_lookup_type = parent_name ? parent_name : type;
|
||||
SwigType *typemap_lookup_type = parent_name ? parent_name : NewString("enum ");
|
||||
Setattr(n, "type", typemap_lookup_type);
|
||||
const String *tm = typemapLookup(n, "jstype", typemap_lookup_type, WARN_JAVA_TYPEMAP_JSTYPE_UNDEF);
|
||||
|
||||
String *return_type = Copy(tm);
|
||||
substituteClassname(typemap_lookup_type, return_type);
|
||||
const String *methodmods = Getattr(n, "feature:java:methodmodifiers");
|
||||
methodmods = methodmods ? methodmods : (is_public(n) ? public_string : protected_string);
|
||||
|
||||
|
|
@ -1422,6 +1424,7 @@ public:
|
|||
Printf(enum_code, " %s final static %s %s = %s;\n", methodmods, return_type, symname, value);
|
||||
Delete(value);
|
||||
}
|
||||
Delete(return_type);
|
||||
}
|
||||
|
||||
// Add the enum value to the comma separated list being constructed in the enum declaration.
|
||||
|
|
@ -1456,6 +1459,7 @@ public:
|
|||
String *tm;
|
||||
String *return_type = NewString("");
|
||||
String *constants_code = NewString("");
|
||||
Swig_save("constantWrapper", n, "value", NIL);
|
||||
|
||||
bool is_enum_item = (Cmp(nodeType(n), "enumitem") == 0);
|
||||
|
||||
|
|
@ -1501,7 +1505,6 @@ public:
|
|||
|
||||
// Add the stripped quotes back in
|
||||
String *new_value = NewString("");
|
||||
Swig_save("constantWrapper", n, "value", NIL);
|
||||
if (SwigType_type(t) == T_STRING) {
|
||||
Printf(new_value, "\"%s\"", Copy(Getattr(n, "value")));
|
||||
Setattr(n, "value", new_value);
|
||||
|
|
@ -2619,7 +2622,6 @@ public:
|
|||
String *return_type = NewString("");
|
||||
String *function_code = NewString("");
|
||||
int num_arguments = 0;
|
||||
int num_required = 0;
|
||||
String *overloaded_name = getOverloadedName(n);
|
||||
String *func_name = NULL;
|
||||
bool setter_flag = false;
|
||||
|
|
@ -2667,7 +2669,6 @@ public:
|
|||
|
||||
/* Get number of required and total arguments */
|
||||
num_arguments = emit_num_arguments(l);
|
||||
num_required = emit_num_required(l);
|
||||
|
||||
bool global_or_member_variable = global_variable_flag || (wrapping_member_flag && !enum_constant_flag);
|
||||
int gencomma = 0;
|
||||
|
|
@ -3548,7 +3549,6 @@ public:
|
|||
String *callback_def = NewString("");
|
||||
String *callback_code = NewString("");
|
||||
String *imcall_args = NewString("");
|
||||
int gencomma = 0;
|
||||
int classmeth_off = curr_class_dmethod - first_class_dmethod;
|
||||
bool ignored_method = GetFlag(n, "feature:ignore") ? true : false;
|
||||
|
||||
|
|
@ -3767,14 +3767,14 @@ public:
|
|||
Delete(tp);
|
||||
|
||||
/* Go through argument list, convert from native to Java */
|
||||
for (p = l; p; /* empty */ ) {
|
||||
for (i = 0, p = l; p; ++i) {
|
||||
/* Is this superfluous? */
|
||||
while (checkAttribute(p, "tmap:directorin:numinputs", "0")) {
|
||||
p = Getattr(p, "tmap:directorin:next");
|
||||
}
|
||||
|
||||
SwigType *pt = Getattr(p, "type");
|
||||
String *ln = Copy(Getattr(p, "name"));
|
||||
String *ln = makeParameterName(n, p, i, false);
|
||||
String *c_param_type = NULL;
|
||||
String *c_decl = NewString("");
|
||||
String *arg = NewString("");
|
||||
|
|
@ -3833,7 +3833,7 @@ public:
|
|||
substituteClassname(pt, din);
|
||||
Replaceall(din, "$jniinput", ln);
|
||||
|
||||
if (++gencomma > 1)
|
||||
if (i > 0)
|
||||
Printf(imcall_args, ", ");
|
||||
Printf(callback_def, ", %s %s", tm, ln);
|
||||
|
||||
|
|
@ -3896,6 +3896,7 @@ public:
|
|||
Delete(arg);
|
||||
Delete(c_decl);
|
||||
Delete(c_param_type);
|
||||
Delete(ln);
|
||||
}
|
||||
|
||||
/* header declaration, start wrapper definition */
|
||||
|
|
@ -4227,11 +4228,10 @@ public:
|
|||
/* Ensure that correct directordisconnect typemap's method name is called
|
||||
* here: */
|
||||
|
||||
const String *disconn_tm = NULL;
|
||||
Node *disconn_attr = NewHash();
|
||||
String *disconn_methodname = NULL;
|
||||
|
||||
disconn_tm = typemapLookup(n, "directordisconnect", full_classname, WARN_NONE, disconn_attr);
|
||||
typemapLookup(n, "directordisconnect", full_classname, WARN_NONE, disconn_attr);
|
||||
disconn_methodname = Getattr(disconn_attr, "tmap:directordisconnect:methodname");
|
||||
|
||||
Printv(w->code, " swig_disconnect_director_self(\"", disconn_methodname, "\");\n", "}\n", NIL);
|
||||
|
|
@ -4394,6 +4394,6 @@ Java Options (available with -java)\n\
|
|||
-nopgcpp - Suppress premature garbage collection prevention parameter\n\
|
||||
-noproxy - Generate the low-level functional interface instead\n\
|
||||
of proxy classes\n\
|
||||
-oldvarnames - old intermediary method names for variable wrappers\n\
|
||||
-package <name> - set name of the Java package to <name>\n\
|
||||
-oldvarnames - Old intermediary method names for variable wrappers\n\
|
||||
-package <name> - Set name of the Java package to <name>\n\
|
||||
\n";
|
||||
|
|
|
|||
|
|
@ -1044,7 +1044,10 @@ int Language::functionHandler(Node *n) {
|
|||
if (isstatic) {
|
||||
staticmemberfunctionHandler(n);
|
||||
} else if (isfriend) {
|
||||
int oldInClass = InClass;
|
||||
InClass = 0;
|
||||
globalfunctionHandler(n);
|
||||
InClass = oldInClass;
|
||||
} else {
|
||||
Node *explicit_n = 0;
|
||||
if (directorsEnabled() && is_member_director(CurrentClass, n) && !extraDirectorProtectedCPPMethodsRequired()) {
|
||||
|
|
@ -1806,17 +1809,25 @@ int Language::unrollVirtualMethods(Node *n, Node *parent, List *vm, int default_
|
|||
classname = Getattr(n, "name");
|
||||
for (ni = Getattr(n, "firstChild"); ni; ni = nextSibling(ni)) {
|
||||
/* we only need to check the virtual members */
|
||||
if (!checkAttribute(ni, "storage", "virtual"))
|
||||
continue;
|
||||
nodeType = Getattr(ni, "nodeType");
|
||||
int is_using = (Cmp(nodeType, "using") == 0);
|
||||
Node *nn = is_using ? firstChild(ni) : ni; /* assume there is only one child node for "using" nodes */
|
||||
if (is_using) {
|
||||
if (nn)
|
||||
nodeType = Getattr(nn, "nodeType");
|
||||
else
|
||||
continue; // A private "using" node
|
||||
}
|
||||
if (!checkAttribute(nn, "storage", "virtual"))
|
||||
continue;
|
||||
/* we need to add methods(cdecl) and destructor (to check for throw decl) */
|
||||
int is_destructor = (Cmp(nodeType, "destructor") == 0);
|
||||
if ((Cmp(nodeType, "cdecl") == 0) || is_destructor) {
|
||||
decl = Getattr(ni, "decl");
|
||||
decl = Getattr(nn, "decl");
|
||||
/* extra check for function type and proper access */
|
||||
if (SwigType_isfunction(decl) && (((!protectedbase || dirprot_mode()) && is_public(ni)) || need_nonpublic_member(ni))) {
|
||||
String *name = Getattr(ni, "name");
|
||||
Node *method_id = is_destructor ? NewStringf("~destructor") : vtable_method_id(ni);
|
||||
if (SwigType_isfunction(decl) && (((!protectedbase || dirprot_mode()) && is_public(nn)) || need_nonpublic_member(nn))) {
|
||||
String *name = Getattr(nn, "name");
|
||||
Node *method_id = is_destructor ? NewStringf("~destructor") : vtable_method_id(nn);
|
||||
/* Make sure that the new method overwrites the existing: */
|
||||
int len = Len(vm);
|
||||
const int DO_NOT_REPLACE = -1;
|
||||
|
|
@ -1834,7 +1845,7 @@ int Language::unrollVirtualMethods(Node *n, Node *parent, List *vm, int default_
|
|||
String *fqdname = NewStringf("%s::%s", classname, name);
|
||||
Hash *item = NewHash();
|
||||
Setattr(item, "fqdname", fqdname);
|
||||
Node *m = Copy(ni);
|
||||
Node *m = Copy(nn);
|
||||
|
||||
/* Store the complete return type - needed for non-simple return types (pointers, references etc.) */
|
||||
SwigType *ty = NewString(Getattr(m, "type"));
|
||||
|
|
@ -1854,6 +1865,7 @@ int Language::unrollVirtualMethods(Node *n, Node *parent, List *vm, int default_
|
|||
Append(vm, item);
|
||||
else
|
||||
Setitem(vm, replace, item);
|
||||
Setattr(nn, "directorNode", m);
|
||||
|
||||
Delete(mname);
|
||||
}
|
||||
|
|
@ -2806,7 +2818,7 @@ int Language::validIdentifier(String *s) {
|
|||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
int Language::usingDeclaration(Node *n) {
|
||||
if ((cplus_mode == PUBLIC)) {
|
||||
if ((cplus_mode == PUBLIC) || (!is_public(n) && dirprot_mode())) {
|
||||
Node *np = Copy(n);
|
||||
Node *c;
|
||||
for (c = firstChild(np); c; c = nextSibling(c)) {
|
||||
|
|
@ -3011,7 +3023,7 @@ Node *Language::symbolLookup(String *s, const_String_or_char_ptr scope) {
|
|||
* Tries to locate a class from a type definition
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
Node *Language::classLookup(SwigType *s) {
|
||||
Node *Language::classLookup(const SwigType *s) {
|
||||
Node *n = 0;
|
||||
|
||||
/* Look in hash of cached values */
|
||||
|
|
|
|||
|
|
@ -82,8 +82,9 @@ void display_mapping(DOH *d) {
|
|||
(though for now I have not bothered)
|
||||
NEW LANGUAGE NOTE:END ************************************************/
|
||||
static const char *usage = (char *) "\
|
||||
Lua Options (available with -lua)\n\
|
||||
(coming soon.)\n\n";
|
||||
Lua Options (available with -lua)\n\
|
||||
[no additional options]\n\
|
||||
\n";
|
||||
|
||||
|
||||
|
||||
|
|
@ -170,7 +171,7 @@ public:
|
|||
for (int i = 1; i < argc; i++) {
|
||||
if (argv[i]) {
|
||||
if (strcmp(argv[i], "-help") == 0) { // usage flags
|
||||
fputs(usage, stderr);
|
||||
fputs(usage, stdout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -445,10 +446,8 @@ public:
|
|||
String *argument_check = NewString("");
|
||||
String *argument_parse = NewString("");
|
||||
String *checkfn = NULL;
|
||||
// String *numoutputs=NULL;
|
||||
char source[64];
|
||||
//Printf(argument_check, "SWIG_check_num_args(\"%s\",%d,%d)\n",name,num_required,num_arguments);
|
||||
Printf(argument_check, "SWIG_check_num_args(\"%s\",%d,%d)\n",name,num_required+args_to_ignore,num_arguments+args_to_ignore);
|
||||
Printf(argument_check, "SWIG_check_num_args(\"%s\",%d,%d)\n",Swig_name_str(n),num_required+args_to_ignore,num_arguments+args_to_ignore);
|
||||
|
||||
for (i = 0, p = l; i < num_arguments; i++) {
|
||||
|
||||
|
|
@ -484,7 +483,7 @@ public:
|
|||
} else {
|
||||
Printf(argument_check, "if(lua_gettop(L)>=%s && !%s(L,%s))", source, checkfn, source);
|
||||
}
|
||||
Printf(argument_check, " SWIG_fail_arg(\"%s\",%s,\"%s\");\n", name, source, SwigType_str(pt, 0));
|
||||
Printf(argument_check, " SWIG_fail_arg(\"%s\",%s,\"%s\");\n", Swig_name_str(n), source, SwigType_str(pt, 0));
|
||||
}
|
||||
/* NEW LANGUAGE NOTE:***********************************************
|
||||
lua states the number of arguments passed to a function using the fn
|
||||
|
|
@ -718,7 +717,9 @@ public:
|
|||
sibl = Getattr(sibl, "sym:previousSibling"); // go all the way up
|
||||
String *protoTypes = NewString("");
|
||||
do {
|
||||
Printf(protoTypes, "\n\" %s(%s)\\n\"", SwigType_str(Getattr(sibl, "name"), 0), ParmList_protostr(Getattr(sibl, "wrap:parms")));
|
||||
String *fulldecl = Swig_name_decl(sibl);
|
||||
Printf(protoTypes, "\n\" %s\\n\"", fulldecl);
|
||||
Delete(fulldecl);
|
||||
} while ((sibl = Getattr(sibl, "sym:nextSibling")));
|
||||
Printf(f->code, "lua_pushstring(L,\"Wrong arguments for overloaded function '%s'\\n\"\n"
|
||||
"\" Possible C/C++ prototypes are:\\n\"%s);\n",symname,protoTypes);
|
||||
|
|
@ -919,7 +920,7 @@ public:
|
|||
String *wrap_class = NewStringf("&_wrap_class_%s", mangled_classname);
|
||||
SwigType_remember_clientdata(t, wrap_class);
|
||||
|
||||
String *rt = Copy(Getattr(n, "classtype"));
|
||||
String *rt = Copy(getClassType());
|
||||
SwigType_add_pointer(rt);
|
||||
|
||||
// Register the class structure with the type checker
|
||||
|
|
|
|||
|
|
@ -1192,7 +1192,7 @@ int SWIG_main(int argc, char *argv[], Language *l) {
|
|||
}
|
||||
|
||||
if (dump_typedef) {
|
||||
SwigType_print_scope(0);
|
||||
SwigType_print_scope();
|
||||
}
|
||||
|
||||
if (dump_symtabs) {
|
||||
|
|
|
|||
|
|
@ -3975,10 +3975,10 @@ extern "C" Language *swig_modula3(void) {
|
|||
|
||||
const char *MODULA3::usage = (char *) "\
|
||||
Modula 3 Options (available with -modula3)\n\
|
||||
-generateconst <file> - generate code for computing numeric values of constants\n\
|
||||
-generaterename <file> - generate suggestions for %rename\n\
|
||||
-generatetypemap <file> - generate templates for some basic typemaps\n\
|
||||
-oldvarnames - old intermediary method names for variable wrappers\n\
|
||||
-generateconst <file> - Generate code for computing numeric values of constants\n\
|
||||
-generaterename <file> - Generate suggestions for %rename\n\
|
||||
-generatetypemap <file> - Generate templates for some basic typemaps\n\
|
||||
-oldvarnames - Old intermediary method names for variable wrappers\n\
|
||||
\n";
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -19,12 +19,12 @@ char cvsroot_mzscheme_cxx[] = "$Id$";
|
|||
|
||||
static const char *usage = (char *) "\
|
||||
Mzscheme Options (available with -mzscheme)\n\
|
||||
-prefix <name> - Set a prefix <name> to be prepended to all names\n\
|
||||
-declaremodule - Create extension that declares a module\n\
|
||||
-noinit - Do not emit scheme_initialize, scheme_reload,\n\
|
||||
scheme_module_name functions\n\
|
||||
-dynamic-load <library>,[library,...] - Do not link with these libraries, dynamic load\n\
|
||||
them\n\
|
||||
-noinit - Do not emit scheme_initialize, scheme_reload,\n\
|
||||
scheme_module_name functions\n\
|
||||
-prefix <name> - Set a prefix <name> to be prepended to all names\n\
|
||||
";
|
||||
|
||||
static String *fieldnames_tab = 0;
|
||||
|
|
@ -240,7 +240,6 @@ public:
|
|||
String *outarg = NewString("");
|
||||
String *build = NewString("");
|
||||
String *tm;
|
||||
int argout_set = 0;
|
||||
int i = 0;
|
||||
int numargs;
|
||||
int numreq;
|
||||
|
|
@ -381,7 +380,6 @@ public:
|
|||
Replaceall(tm, "$input", Getattr(p, "emit:input"));
|
||||
Printv(outarg, tm, "\n", NIL);
|
||||
p = Getattr(p, "tmap:argout:next");
|
||||
argout_set = 1;
|
||||
} else {
|
||||
p = nextSibling(p);
|
||||
}
|
||||
|
|
@ -639,9 +637,10 @@ public:
|
|||
// Create variable and assign it a value
|
||||
|
||||
Printf(f_header, "static %s = ", SwigType_lstr(type, var_name));
|
||||
bool is_enum_item = (Cmp(nodeType(n), "enumitem") == 0);
|
||||
if ((SwigType_type(type) == T_STRING)) {
|
||||
Printf(f_header, "\"%s\";\n", value);
|
||||
} else if (SwigType_type(type) == T_CHAR) {
|
||||
} else if (SwigType_type(type) == T_CHAR && !is_enum_item) {
|
||||
Printf(f_header, "\'%s\';\n", value);
|
||||
} else {
|
||||
Printf(f_header, "%s;\n", value);
|
||||
|
|
@ -682,7 +681,7 @@ public:
|
|||
String *mangled_classname = 0;
|
||||
String *real_classname = 0;
|
||||
String *scm_structname = NewString("");
|
||||
SwigType *ctype_ptr = NewStringf("p.%s", Getattr(n, "classtype"));
|
||||
SwigType *ctype_ptr = NewStringf("p.%s", getClassType());
|
||||
|
||||
SwigType *t = NewStringf("p.%s", Getattr(n, "name"));
|
||||
swigtype_ptr = SwigType_manglestr(t);
|
||||
|
|
|
|||
|
|
@ -17,11 +17,13 @@ char cvsroot_ocaml_cxx[] = "$Id$";
|
|||
|
||||
#include <ctype.h>
|
||||
|
||||
static const char *usage = (char *)
|
||||
("Ocaml Options (available with -ocaml)\n"
|
||||
"-prefix <name> - Set a prefix <name> to be prepended to all names\n"
|
||||
"-where - Emit library location\n"
|
||||
"-suffix <name> - Change .cxx to something else\n" "-oldvarnames - old intermediary method names for variable wrappers\n" "\n");
|
||||
static const char *usage = (char *) "\
|
||||
Ocaml Options (available with -ocaml)\n\
|
||||
-oldvarnames - Old intermediary method names for variable wrappers\n\
|
||||
-prefix <name> - Set a prefix <name> to be prepended to all names\n\
|
||||
-suffix <name> - Change .cxx to something else\n\
|
||||
-where - Emit library location\n\
|
||||
\n";
|
||||
|
||||
static int classmode = 0;
|
||||
static int in_constructor = 0, in_destructor = 0, in_copyconst = 0;
|
||||
|
|
@ -35,7 +37,7 @@ static String *classname = 0;
|
|||
static String *module = 0;
|
||||
static String *init_func_def = 0;
|
||||
static String *f_classtemplate = 0;
|
||||
static String *name_qualifier = 0;
|
||||
static SwigType *name_qualifier_type = 0;
|
||||
|
||||
static Hash *seen_enums = 0;
|
||||
static Hash *seen_enumvalues = 0;
|
||||
|
|
@ -443,7 +445,6 @@ public:
|
|||
String *outarg = NewString("");
|
||||
String *build = NewString("");
|
||||
String *tm;
|
||||
int argout_set = 0;
|
||||
int i = 0;
|
||||
int numargs;
|
||||
int numreq;
|
||||
|
|
@ -606,7 +607,6 @@ public:
|
|||
Replaceall(tm, "$ntype", normalizeTemplatedClassName(Getattr(p, "type")));
|
||||
Printv(outarg, tm, "\n", NIL);
|
||||
p = Getattr(p, "tmap:argout:next");
|
||||
argout_set = 1;
|
||||
} else {
|
||||
p = nextSibling(p);
|
||||
}
|
||||
|
|
@ -879,9 +879,8 @@ public:
|
|||
* ------------------------------------------------------------ */
|
||||
|
||||
virtual int staticmemberfunctionHandler(Node *n) {
|
||||
int rv;
|
||||
static_member_function = 1;
|
||||
rv = Language::staticmemberfunctionHandler(n);
|
||||
Language::staticmemberfunctionHandler(n);
|
||||
static_member_function = 0;
|
||||
return SWIG_OK;
|
||||
}
|
||||
|
|
@ -898,12 +897,12 @@ public:
|
|||
String *name = Getattr(n, "feature:symname");
|
||||
SwigType *type = Getattr(n, "type");
|
||||
String *value = Getattr(n, "value");
|
||||
String *qvalue = Getattr(n, "qualified:value");
|
||||
SwigType *qname = Getattr(n, "qualified:name");
|
||||
String *rvalue = NewString("");
|
||||
String *temp = 0;
|
||||
|
||||
if (qvalue)
|
||||
value = qvalue;
|
||||
if (qname)
|
||||
value = qname;
|
||||
|
||||
if (!name) {
|
||||
name = mangleNameForCaml(Getattr(n, "name"));
|
||||
|
|
@ -928,9 +927,10 @@ public:
|
|||
// Create variable and assign it a value
|
||||
|
||||
Printf(f_header, "static %s = ", SwigType_lstr(type, name));
|
||||
bool is_enum_item = (Cmp(nodeType(n), "enumitem") == 0);
|
||||
if ((SwigType_type(type) == T_STRING)) {
|
||||
Printf(f_header, "\"%s\";\n", value);
|
||||
} else if (SwigType_type(type) == T_CHAR) {
|
||||
} else if (SwigType_type(type) == T_CHAR && !is_enum_item) {
|
||||
Printf(f_header, "\'%s\';\n", value);
|
||||
} else {
|
||||
Printf(f_header, "%s;\n", value);
|
||||
|
|
@ -1228,20 +1228,18 @@ public:
|
|||
return out;
|
||||
}
|
||||
|
||||
String *fully_qualify_enum_name(Node *n, String *name) {
|
||||
SwigType *fully_qualified_enum_type(Node *n) {
|
||||
Node *parent = 0;
|
||||
String *qualification = NewString("");
|
||||
String *fully_qualified_name = NewString("");
|
||||
String *parent_type = 0;
|
||||
String *normalized_name;
|
||||
|
||||
parent = parentNode(n);
|
||||
while (parent) {
|
||||
parent_type = nodeType(parent);
|
||||
if (Getattr(parent, "name")) {
|
||||
String *parent_copy = NewStringf("%s::", Getattr(parent, "name"));
|
||||
if (!Cmp(parent_type, "class") || !Cmp(parent_type, "namespace"))
|
||||
Insert(qualification, 0, parent_copy);
|
||||
if (Cmp(parent_type, "class") == 0 || Cmp(parent_type, "namespace") == 0)
|
||||
Insert(fully_qualified_name, 0, parent_copy);
|
||||
Delete(parent_copy);
|
||||
}
|
||||
if (!Cmp(parent_type, "class"))
|
||||
|
|
@ -1249,25 +1247,18 @@ public:
|
|||
parent = parentNode(parent);
|
||||
}
|
||||
|
||||
Printf(fully_qualified_name, "%s%s", qualification, name);
|
||||
|
||||
normalized_name = normalizeTemplatedClassName(fully_qualified_name);
|
||||
if (!strncmp(Char(normalized_name), "enum ", 5)) {
|
||||
Insert(normalized_name, 5, qualification);
|
||||
}
|
||||
|
||||
return normalized_name;
|
||||
return fully_qualified_name;
|
||||
}
|
||||
|
||||
/* Benedikt Grundmann inspired --> Enum wrap styles */
|
||||
|
||||
int enumvalueDeclaration(Node *n) {
|
||||
String *name = Getattr(n, "name");
|
||||
String *qvalue = 0;
|
||||
SwigType *qtype = 0;
|
||||
|
||||
if (name_qualifier) {
|
||||
qvalue = Copy(name_qualifier);
|
||||
Printv(qvalue, name, NIL);
|
||||
if (name_qualifier_type) {
|
||||
qtype = Copy(name_qualifier_type);
|
||||
Printv(qtype, name, NIL);
|
||||
}
|
||||
|
||||
if (const_enum && name && !Getattr(seen_enumvalues, name)) {
|
||||
|
|
@ -1275,10 +1266,10 @@ public:
|
|||
SetFlag(n, "feature:immutable");
|
||||
Setattr(n, "feature:enumvalue", "1"); // this does not appear to be used
|
||||
|
||||
if (qvalue)
|
||||
Setattr(n, "qualified:value", qvalue);
|
||||
if (qtype)
|
||||
Setattr(n, "qualified:name", SwigType_namestr(qtype));
|
||||
|
||||
String *evname = SwigType_manglestr(qvalue);
|
||||
String *evname = SwigType_manglestr(qtype);
|
||||
Insert(evname, 0, "SWIG_ENUM_");
|
||||
|
||||
Setattr(n, "feature:enumvname", name);
|
||||
|
|
@ -1309,10 +1300,10 @@ public:
|
|||
/* name is now fully qualified */
|
||||
String *fully_qualified_name = NewString(name);
|
||||
bool seen_enum = false;
|
||||
if (name_qualifier)
|
||||
Delete(name_qualifier);
|
||||
if (name_qualifier_type)
|
||||
Delete(name_qualifier_type);
|
||||
char *strip_position;
|
||||
name_qualifier = fully_qualify_enum_name(n, NewString(""));
|
||||
name_qualifier_type = fully_qualified_enum_type(n);
|
||||
|
||||
strip_position = strstr(Char(oname), "::");
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ char cvsroot_octave_cxx[] = "$Id$";
|
|||
static const char *usage = (char *) "\
|
||||
Octave Options (available with -octave)\n\
|
||||
[no additional options]\n\
|
||||
\n";
|
||||
\n";
|
||||
|
||||
|
||||
class OCTAVE:public Language {
|
||||
|
|
@ -64,7 +64,7 @@ public:
|
|||
for (int i = 1; i < argc; i++) {
|
||||
if (argv[i]) {
|
||||
if (strcmp(argv[i], "-help") == 0) {
|
||||
fputs(usage, stderr);
|
||||
fputs(usage, stdout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -359,13 +359,11 @@ public:
|
|||
String *name = 0;
|
||||
String *type = 0;
|
||||
String *value = 0;
|
||||
String *ptype = 0;
|
||||
String *pdoc = Getattr(p, "tmap:doc");
|
||||
if (pdoc) {
|
||||
name = Getattr(p, "tmap:doc:name");
|
||||
type = Getattr(p, "tmap:doc:type");
|
||||
value = Getattr(p, "tmap:doc:value");
|
||||
ptype = Getattr(p, "tmap:doc:pytype");
|
||||
}
|
||||
|
||||
name = name ? name : Getattr(p, "name");
|
||||
|
|
@ -1243,7 +1241,6 @@ public:
|
|||
// build argument list and type conversion string
|
||||
idx = 0;
|
||||
p = l;
|
||||
int use_parse = 0;
|
||||
while (p) {
|
||||
if (checkAttribute(p, "tmap:in:numinputs", "0")) {
|
||||
p = Getattr(p, "tmap:in:next");
|
||||
|
|
@ -1266,7 +1263,6 @@ public:
|
|||
Printf(wrap_args, "args.append(tmpv);\n");
|
||||
Putc('O', parse_args);
|
||||
} else {
|
||||
use_parse = 1;
|
||||
Append(parse_args, parse);
|
||||
Replaceall(tm, "$input", pname);
|
||||
Replaceall(tm, "$owner", "0");
|
||||
|
|
|
|||
|
|
@ -231,11 +231,12 @@ List *Swig_overload_rank(Node *n, bool script_lang_wrapping) {
|
|||
Swig_warning(WARN_LANG_OVERLOAD_CONST, Getfile(nodes[i].n), Getline(nodes[i].n),
|
||||
"using non-const method %s instead.\n", Swig_name_decl(nodes[i].n));
|
||||
} else {
|
||||
if (!Getattr(nodes[j].n, "overload:ignore"))
|
||||
if (!Getattr(nodes[j].n, "overload:ignore")) {
|
||||
Swig_warning(WARN_LANG_OVERLOAD_IGNORED, Getfile(nodes[j].n), Getline(nodes[j].n),
|
||||
"Overloaded method %s ignored,\n", Swig_name_decl(nodes[j].n));
|
||||
Swig_warning(WARN_LANG_OVERLOAD_IGNORED, Getfile(nodes[i].n), Getline(nodes[i].n),
|
||||
"using %s instead.\n", Swig_name_decl(nodes[i].n));
|
||||
}
|
||||
}
|
||||
}
|
||||
nodes[j].error = 1;
|
||||
|
|
@ -248,11 +249,12 @@ List *Swig_overload_rank(Node *n, bool script_lang_wrapping) {
|
|||
Swig_warning(WARN_LANG_OVERLOAD_CONST, Getfile(nodes[i].n), Getline(nodes[i].n),
|
||||
"using non-const method %s instead.\n", Swig_name_decl(nodes[i].n));
|
||||
} else {
|
||||
if (!Getattr(nodes[j].n, "overload:ignore"))
|
||||
if (!Getattr(nodes[j].n, "overload:ignore")) {
|
||||
Swig_warning(WARN_LANG_OVERLOAD_IGNORED, Getfile(nodes[j].n), Getline(nodes[j].n),
|
||||
"Overloaded method %s ignored,\n", Swig_name_decl(nodes[j].n));
|
||||
Swig_warning(WARN_LANG_OVERLOAD_IGNORED, Getfile(nodes[i].n), Getline(nodes[i].n),
|
||||
"using %s instead.\n", Swig_name_decl(nodes[i].n));
|
||||
}
|
||||
}
|
||||
}
|
||||
nodes[j].error = 1;
|
||||
|
|
@ -270,11 +272,12 @@ List *Swig_overload_rank(Node *n, bool script_lang_wrapping) {
|
|||
Swig_warning(WARN_LANG_OVERLOAD_SHADOW, Getfile(nodes[i].n), Getline(nodes[i].n),
|
||||
"as it is shadowed by %s.\n", Swig_name_decl(nodes[i].n));
|
||||
} else {
|
||||
if (!Getattr(nodes[j].n, "overload:ignore"))
|
||||
if (!Getattr(nodes[j].n, "overload:ignore")) {
|
||||
Swig_warning(WARN_LANG_OVERLOAD_IGNORED, Getfile(nodes[j].n), Getline(nodes[j].n),
|
||||
"Overloaded method %s ignored,\n", Swig_name_decl(nodes[j].n));
|
||||
Swig_warning(WARN_LANG_OVERLOAD_IGNORED, Getfile(nodes[i].n), Getline(nodes[i].n),
|
||||
"using %s instead.\n", Swig_name_decl(nodes[i].n));
|
||||
}
|
||||
}
|
||||
nodes[j].error = 1;
|
||||
}
|
||||
|
|
@ -386,16 +389,11 @@ String *Swig_overload_dispatch_cast(Node *n, const_String_or_char_ptr fmt, int *
|
|||
int num_arguments = emit_num_arguments(pi);
|
||||
if (num_arguments > *maxargs)
|
||||
*maxargs = num_arguments;
|
||||
int varargs = emit_isvarargs(pi);
|
||||
|
||||
if (!varargs) {
|
||||
if (num_required == num_arguments) {
|
||||
Printf(f, "if (%s == %d) {\n", argc_template_string, num_required);
|
||||
} else {
|
||||
Printf(f, "if ((%s >= %d) && (%s <= %d)) {\n", argc_template_string, num_required, argc_template_string, num_arguments);
|
||||
}
|
||||
if (num_required == num_arguments) {
|
||||
Printf(f, "if (%s == %d) {\n", argc_template_string, num_required);
|
||||
} else {
|
||||
Printf(f, "if (%s >= %d) {\n", argc_template_string, num_required);
|
||||
Printf(f, "if ((%s >= %d) && (%s <= %d)) {\n", argc_template_string, num_required, argc_template_string, num_arguments);
|
||||
}
|
||||
Printf(f, "SWIG_TypeRank _ranki = 0;\n");
|
||||
Printf(f, "SWIG_TypeRank _rankm = 0;\n");
|
||||
|
|
@ -565,16 +563,11 @@ String *Swig_overload_dispatch_fast(Node *n, const_String_or_char_ptr fmt, int *
|
|||
int num_arguments = emit_num_arguments(pi);
|
||||
if (num_arguments > *maxargs)
|
||||
*maxargs = num_arguments;
|
||||
int varargs = emit_isvarargs(pi);
|
||||
|
||||
if (!varargs) {
|
||||
if (num_required == num_arguments) {
|
||||
Printf(f, "if (%s == %d) {\n", argc_template_string, num_required);
|
||||
} else {
|
||||
Printf(f, "if ((%s >= %d) && (%s <= %d)) {\n", argc_template_string, num_required, argc_template_string, num_arguments);
|
||||
}
|
||||
if (num_required == num_arguments) {
|
||||
Printf(f, "if (%s == %d) {\n", argc_template_string, num_required);
|
||||
} else {
|
||||
Printf(f, "if (%s >= %d) {\n", argc_template_string, num_required);
|
||||
Printf(f, "if ((%s >= %d) && (%s <= %d)) {\n", argc_template_string, num_required, argc_template_string, num_arguments);
|
||||
}
|
||||
|
||||
/* create a list with the wrappers that collide with the
|
||||
|
|
@ -732,16 +725,11 @@ String *Swig_overload_dispatch(Node *n, const_String_or_char_ptr fmt, int *maxar
|
|||
}
|
||||
if (num_arguments > *maxargs)
|
||||
*maxargs = num_arguments;
|
||||
int varargs = emit_isvarargs(pi);
|
||||
|
||||
if (!varargs) {
|
||||
if (num_required == num_arguments) {
|
||||
Printf(f, "if (%s == %d) {\n", argc_template_string, num_required);
|
||||
} else {
|
||||
Printf(f, "if ((%s >= %d) && (%s <= %d)) {\n", argc_template_string, num_required, argc_template_string, num_arguments);
|
||||
}
|
||||
if (num_required == num_arguments) {
|
||||
Printf(f, "if (%s == %d) {\n", argc_template_string, num_required);
|
||||
} else {
|
||||
Printf(f, "if (%s >= %d) {\n", argc_template_string, num_required);
|
||||
Printf(f, "if ((%s >= %d) && (%s <= %d)) {\n", argc_template_string, num_required, argc_template_string, num_arguments);
|
||||
}
|
||||
|
||||
if (num_arguments) {
|
||||
|
|
|
|||
|
|
@ -21,14 +21,15 @@ static int treduce = SWIG_cparse_template_reduce(0);
|
|||
|
||||
static const char *usage = (char *) "\
|
||||
Perl5 Options (available with -perl5)\n\
|
||||
-static - Omit code related to dynamic loading\n\
|
||||
-nopm - Do not generate the .pm file\n\
|
||||
-proxy - Create proxy classes\n\
|
||||
-noproxy - Don't create proxy classes\n\
|
||||
-compat - Compatibility mode\n\
|
||||
-const - Wrap constants as constants and not variables (implies -proxy)\n\
|
||||
-nocppcast - Disable C++ casting operators, useful for generating bugs\n\
|
||||
-cppcast - Enable C++ casting operators\n\
|
||||
-compat - Compatibility mode\n\n";
|
||||
-nocppcast - Disable C++ casting operators, useful for generating bugs\n\
|
||||
-nopm - Do not generate the .pm file\n\
|
||||
-noproxy - Don't create proxy classes\n\
|
||||
-proxy - Create proxy classes\n\
|
||||
-static - Omit code related to dynamic loading\n\
|
||||
\n";
|
||||
|
||||
static int compat = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ char cvsroot_php_cxx[] = "$Id$";
|
|||
|
||||
static const char *usage = (char *) "\
|
||||
PHP Options (available with -php)\n\
|
||||
-cppext - cpp file extension (default to .cpp)\n\
|
||||
-cppext <ext> - Change C++ file extension to <ext> (default is cpp)\n\
|
||||
-noproxy - Don't generate proxy classes.\n\
|
||||
-prefix <prefix> - Prepend <prefix> to all class names in PHP wrappers\n\
|
||||
\n";
|
||||
|
|
@ -126,7 +126,7 @@ static enum {
|
|||
} wrapperType = standard;
|
||||
|
||||
extern "C" {
|
||||
static void (*r_prevtracefunc) (SwigType *t, String *mangled, String *clientdata) = 0;
|
||||
static void (*r_prevtracefunc) (const SwigType *t, String *mangled, String *clientdata) = 0;
|
||||
}
|
||||
|
||||
static void SwigPHP_emit_resource_registrations() {
|
||||
|
|
@ -250,7 +250,6 @@ public:
|
|||
virtual int top(Node *n) {
|
||||
|
||||
String *filen;
|
||||
String *s_type;
|
||||
|
||||
/* Check if directors are enabled for this module. */
|
||||
Node *mod = Getattr(n, "module");
|
||||
|
|
@ -283,7 +282,6 @@ public:
|
|||
r_shutdown = NewString("/* rshutdown section */\n");
|
||||
s_header = NewString("/* header section */\n");
|
||||
s_wrappers = NewString("/* wrapper section */\n");
|
||||
s_type = NewStringEmpty();
|
||||
/* subsections of the init section */
|
||||
s_vinit = NewString("/* vinit subsection */\n");
|
||||
s_vdecl = NewString("/* vdecl subsection */\n");
|
||||
|
|
@ -391,6 +389,12 @@ public:
|
|||
Printf(s_header, "#define SWIG_ErrorCode() (%s_globals.error_code)\n", module);
|
||||
Printf(s_header, "#endif\n\n");
|
||||
|
||||
Printf(s_header, "// Allow the user to workaround a PHP bug on some platforms/architectures by\n");
|
||||
Printf(s_header, "// compiling with -DSWIG_ZEND_ERROR_NORETURN=zend_error\n");
|
||||
Printf(s_header, "#ifndef SWIG_ZEND_ERROR_NORETURN\n");
|
||||
Printf(s_header, "# define SWIG_ZEND_ERROR_NORETURN zend_error_noreturn\n");
|
||||
Printf(s_header, "#endif\n\n");
|
||||
|
||||
Printf(s_header, "static void %s_init_globals(zend_%s_globals *globals ) {\n", module, module);
|
||||
Printf(s_header, " globals->error_msg = default_error_msg;\n");
|
||||
Printf(s_header, " globals->error_code = default_error_code;\n");
|
||||
|
|
@ -976,7 +980,11 @@ public:
|
|||
/* Error handling code */
|
||||
Printf(f->code, "fail:\n");
|
||||
Printv(f->code, cleanup, NIL);
|
||||
Printv(f->code, "zend_error_noreturn(SWIG_ErrorCode(),\"%s\",SWIG_ErrorMsg());", NIL);
|
||||
/* This could be zend_error_noreturn(), but that's buggy in PHP ~5.3 and
|
||||
* using zend_error() here shouldn't generate a warning, so just use that.
|
||||
* At worst this may result in slightly less good code.
|
||||
*/
|
||||
Printv(f->code, "zend_error(SWIG_ErrorCode(),\"%s\",SWIG_ErrorMsg());", NIL);
|
||||
|
||||
Printf(f->code, "}\n");
|
||||
|
||||
|
|
@ -1069,6 +1077,8 @@ public:
|
|||
Hash *ret_types = NewHash();
|
||||
Setattr(ret_types, d, d);
|
||||
|
||||
bool non_void_return = (Cmp(d, "void") != 0);
|
||||
|
||||
if (overloaded) {
|
||||
// Look at all the overloaded versions of this method in turn to
|
||||
// decide if it's really an overloaded method, or just one where some
|
||||
|
|
@ -1085,6 +1095,7 @@ public:
|
|||
assert(constructor);
|
||||
} else if (!Getattr(ret_types, d2)) {
|
||||
Setattr(ret_types, d2, d2);
|
||||
non_void_return = non_void_return || (Cmp(d2, "void") != 0);
|
||||
}
|
||||
|
||||
ParmList *l2 = Getattr(o, "wrap:parms");
|
||||
|
|
@ -1496,7 +1507,7 @@ public:
|
|||
while (last_handled_i < i) {
|
||||
Printf(prepare, "case %d: ", ++last_handled_i);
|
||||
}
|
||||
if (Cmp(d, "void") != 0) {
|
||||
if (non_void_return) {
|
||||
if ((!directorsEnabled() || !Swig_directorclass(n)) && !newobject) {
|
||||
Append(prepare, "$r=");
|
||||
} else {
|
||||
|
|
@ -1518,7 +1529,7 @@ public:
|
|||
Printf(prepare, "\t\t");
|
||||
if (had_a_case)
|
||||
Printf(prepare, "default: ");
|
||||
if (Cmp(d, "void") != 0) {
|
||||
if (non_void_return) {
|
||||
if ((!directorsEnabled() || !Swig_directorclass(n)) && !newobject) {
|
||||
Append(prepare, "$r=");
|
||||
} else {
|
||||
|
|
@ -1601,10 +1612,9 @@ public:
|
|||
Delete(args);
|
||||
args = NewString("$res=null");
|
||||
}
|
||||
SwigType *t = Getattr(current_class, "classtype");
|
||||
String *mangled_type = SwigType_manglestr(SwigType_ltype(t));
|
||||
String *mangled_type = SwigType_manglestr(Getattr(n, "type"));
|
||||
Printf(output, "\t%sfunction %s(%s) {\n", acc, methodname, args);
|
||||
Printf(output, "\t\tif (is_resource($%s) && get_resource_type($%s) === '_p%s') {\n", arg0, arg0, mangled_type);
|
||||
Printf(output, "\t\tif (is_resource($%s) && get_resource_type($%s) === '%s') {\n", arg0, arg0, mangled_type);
|
||||
Printf(output, "\t\t\t$this->%s=$%s;\n", SWIG_PTR, arg0);
|
||||
Printf(output, "\t\t\treturn;\n");
|
||||
Printf(output, "\t\t}\n");
|
||||
|
|
@ -1665,7 +1675,7 @@ public:
|
|||
}
|
||||
}
|
||||
Printf(output, "%s", prepare);
|
||||
} else if (Cmp(d, "void") == 0 && !hasargout) {
|
||||
} else if (!non_void_return && !hasargout) {
|
||||
if (Cmp(invoke, "$r") != 0)
|
||||
Printf(output, "\t\t%s;\n", invoke);
|
||||
} else if (is_class(d)) {
|
||||
|
|
@ -1719,7 +1729,6 @@ public:
|
|||
while (i.item) {
|
||||
SwigType *ret_type = i.item;
|
||||
i = Next(i);
|
||||
Printf(output, "\t\t");
|
||||
String *mangled = NewString("_p");
|
||||
Printf(mangled, "%s", SwigType_manglestr(ret_type));
|
||||
Node *class_node = Getattr(zend_types, mangled);
|
||||
|
|
@ -1730,7 +1739,13 @@ public:
|
|||
Delete(mangled);
|
||||
mangled = NewString(SwigType_manglestr(ret_type));
|
||||
class_node = Getattr(zend_types, mangled);
|
||||
if (!class_node) {
|
||||
// Return type isn't an object, so will be handled by the
|
||||
// !is_resource() check before the switch.
|
||||
continue;
|
||||
}
|
||||
}
|
||||
Printf(output, "\t\t");
|
||||
if (i.item) {
|
||||
Printf(output, "case '%s': ", mangled);
|
||||
} else {
|
||||
|
|
@ -2291,7 +2306,11 @@ done:
|
|||
|
||||
Append(f->code, "return;\n");
|
||||
Append(f->code, "fail:\n");
|
||||
Append(f->code, "zend_error_noreturn(SWIG_ErrorCode(),\"%s\",SWIG_ErrorMsg());\n");
|
||||
/* This could be zend_error_noreturn(), but that's buggy in PHP ~5.3 and
|
||||
* using zend_error() here shouldn't generate a warning, so just use that.
|
||||
* At worst this may result in slightly less good code.
|
||||
*/
|
||||
Append(f->code, "zend_error(SWIG_ErrorCode(),\"%s\",SWIG_ErrorMsg());\n");
|
||||
Printf(f->code, "}\n");
|
||||
|
||||
Wrapper_print(f, s_wrappers);
|
||||
|
|
@ -2504,7 +2523,6 @@ done:
|
|||
/* build argument list and type conversion string */
|
||||
idx = 0;
|
||||
p = l;
|
||||
int use_parse = 0;
|
||||
while (p) {
|
||||
if (checkAttribute(p, "tmap:in:numinputs", "0")) {
|
||||
p = Getattr(p, "tmap:in:next");
|
||||
|
|
@ -2531,7 +2549,6 @@ done:
|
|||
Printv(wrap_args, tm, "\n", NIL);
|
||||
Putc('O', parse_args);
|
||||
} else {
|
||||
use_parse = 1;
|
||||
Append(parse_args, parse);
|
||||
Replaceall(tm, "$input", pname);
|
||||
Replaceall(tm, "$owner", "0");
|
||||
|
|
@ -2666,7 +2683,15 @@ done:
|
|||
}
|
||||
|
||||
Append(w->code, "fail:\n");
|
||||
Append(w->code, "zend_error_noreturn(SWIG_ErrorCode(),\"%s\",SWIG_ErrorMsg());\n");
|
||||
if (!is_void) {
|
||||
Append(w->code, "SWIG_ZEND_ERROR_NORETURN(SWIG_ErrorCode(),\"%s\",SWIG_ErrorMsg());\n");
|
||||
} else {
|
||||
/* This could be zend_error_noreturn(), but that's buggy in PHP ~5.3 and
|
||||
* using zend_error() here shouldn't generate a warning, so just use that.
|
||||
* At worst this may result in slightly less good code.
|
||||
*/
|
||||
Append(w->code, "zend_error(SWIG_ErrorCode(),\"%s\",SWIG_ErrorMsg());\n");
|
||||
}
|
||||
Append(w->code, "}\n");
|
||||
|
||||
// We expose protected methods via an extra public inline method which makes a straight call to the wrapped class' method
|
||||
|
|
@ -2711,7 +2736,7 @@ static PHP *maininstance = 0;
|
|||
// We use this function to be able to write out zend_register_list_destructor_ex
|
||||
// lines for most things in the type table
|
||||
// NOTE: it's a function NOT A PHP::METHOD
|
||||
extern "C" void typetrace(SwigType *ty, String *mangled, String *clientdata) {
|
||||
extern "C" void typetrace(const SwigType *ty, String *mangled, String *clientdata) {
|
||||
Node *class_node;
|
||||
if (!zend_types) {
|
||||
zend_types = NewHash();
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ char cvsroot_pike_cxx[] = "$Id$";
|
|||
|
||||
static const char *usage = (char *) "\
|
||||
Pike Options (available with -pike)\n\
|
||||
[None]\n\
|
||||
[no additional options]\n\
|
||||
\n";
|
||||
|
||||
class PIKE:public Language {
|
||||
|
|
@ -578,12 +578,16 @@ public:
|
|||
String *symname = Getattr(n, "sym:name");
|
||||
SwigType *type = Getattr(n, "type");
|
||||
String *value = Getattr(n, "value");
|
||||
bool is_enum_item = (Cmp(nodeType(n), "enumitem") == 0);
|
||||
|
||||
/* Special hook for member pointer */
|
||||
if (SwigType_type(type) == T_MPOINTER) {
|
||||
/* Special hook for member pointer */
|
||||
String *wname = Swig_name_wrapper(symname);
|
||||
Printf(f_header, "static %s = %s;\n", SwigType_str(type, wname), value);
|
||||
value = wname;
|
||||
} else if (SwigType_type(type) == T_CHAR && is_enum_item) {
|
||||
type = NewSwigType(T_INT);
|
||||
Setattr(n, "type", type);
|
||||
}
|
||||
|
||||
/* Perform constant typemap substitution */
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -15,8 +15,6 @@ char cvsroot_r_cxx[] = "$Id$";
|
|||
|
||||
#include "swigmod.h"
|
||||
|
||||
#define UNUSED(a) (void)a
|
||||
|
||||
static const double DEFAULT_NUMBER = .0000123456712312312323;
|
||||
static const int MAX_OVERLOAD_ARGS = 5;
|
||||
|
||||
|
|
@ -215,12 +213,15 @@ R Options (available with -r)\n\
|
|||
-copystruct - Emit R code to copy C structs (on by default)\n\
|
||||
-cppcast - Enable C++ casting operators (default) \n\
|
||||
-debug - Output debug\n\
|
||||
-dll <name> - Name of the DLL (without the .dll or .so suffix). Default is the module name.\n\
|
||||
-dll <name> - Name of the DLL (without the .dll or .so suffix).\n\
|
||||
Default is the module name.\n\
|
||||
-gc - Aggressive garbage collection\n\
|
||||
-memoryprof - Add memory profile\n\
|
||||
-namespace - Output NAMESPACE file\n\
|
||||
-no-init-code - Turn off the generation of the R_init_<pkgname> code (registration information still generated)\n\
|
||||
-package <name> - Package name for the PACKAGE argument of the R .Call() invocations. Default is the module name.\n\
|
||||
-no-init-code - Turn off the generation of the R_init_<pkgname> code\n\
|
||||
(registration information still generated)\n\
|
||||
-package <name> - Package name for the PACKAGE argument of the R .Call()\n\
|
||||
invocations. Default is the module name.\n\
|
||||
";
|
||||
|
||||
|
||||
|
|
@ -265,12 +266,9 @@ static void replaceRClass(String *tm, SwigType *type) {
|
|||
Delete(tmp); Delete(tmp_base); Delete(tmp_ref);
|
||||
}
|
||||
|
||||
static double getNumber(String *value, String *type) {
|
||||
UNUSED(type);
|
||||
|
||||
static double getNumber(String *value) {
|
||||
double d = DEFAULT_NUMBER;
|
||||
if(Char(value)) {
|
||||
// Printf(stderr, "getNumber %s %s\n", Char(value), type);
|
||||
if(sscanf(Char(value), "%lf", &d) != 1)
|
||||
return(DEFAULT_NUMBER);
|
||||
}
|
||||
|
|
@ -300,7 +298,7 @@ public:
|
|||
Printf(stderr, "<memberfunctionHandler> %s %s\n",
|
||||
Getattr(n, "name"),
|
||||
Getattr(n, "type"));
|
||||
member_name = Getattr(n, "name");
|
||||
member_name = Getattr(n, "sym:name");
|
||||
processing_class_member_function = 1;
|
||||
int status = Language::memberfunctionHandler(n);
|
||||
processing_class_member_function = 0;
|
||||
|
|
@ -1013,7 +1011,6 @@ int R::OutputClassMemberTable(Hash *tb, File *out) {
|
|||
int R::OutputMemberReferenceMethod(String *className, int isSet,
|
||||
List *el, File *out) {
|
||||
int numMems = Len(el), j;
|
||||
int has_getitem = 0, has_setitem = 0, has_str = 0;
|
||||
int varaccessor = 0;
|
||||
if (numMems == 0)
|
||||
return SWIG_OK;
|
||||
|
|
@ -1033,9 +1030,6 @@ int R::OutputMemberReferenceMethod(String *className, int isSet,
|
|||
if (Getattr(itemList, item))
|
||||
continue;
|
||||
Setattr(itemList, item, "1");
|
||||
if (!Strcmp(item, "__getitem__")) has_getitem = 1;
|
||||
if (!Strcmp(item, "__setitem__")) has_setitem = 1;
|
||||
if (!Strcmp(item, "__str__")) has_str = 1;
|
||||
|
||||
String *dup = Getitem(el, j + 1);
|
||||
char *ptr = Char(dup);
|
||||
|
|
@ -1209,10 +1203,9 @@ int R::enumDeclaration(Node *n) {
|
|||
// const char *tag = Char(nodeType(c));
|
||||
// if (Strcmp(tag,"cdecl") == 0) {
|
||||
name = Getattr(c, "name");
|
||||
String *type = Getattr(c, "type");
|
||||
String *val = Getattr(c, "enumvalue");
|
||||
if(val && Char(val)) {
|
||||
int inval = (int) getNumber(val, type);
|
||||
int inval = (int) getNumber(val);
|
||||
if(inval == DEFAULT_NUMBER)
|
||||
value++;
|
||||
else
|
||||
|
|
@ -1603,6 +1596,16 @@ void R::dispatchFunction(Node *n) {
|
|||
j == 0 ? "" : " && ",
|
||||
j+1);
|
||||
}
|
||||
else if (DohStrcmp(tm,"integer")==0) {
|
||||
Printf(f->code, "%s(is.integer(argv[[%d]]) || is.numeric(argv[[%d]]))",
|
||||
j == 0 ? "" : " && ",
|
||||
j+1, j+1);
|
||||
}
|
||||
else if (DohStrcmp(tm,"character")==0) {
|
||||
Printf(f->code, "%sis.character(argv[[%d]])",
|
||||
j == 0 ? "" : " && ",
|
||||
j+1);
|
||||
}
|
||||
else {
|
||||
Printf(f->code, "%sextends(argtypes[%d], '%s')",
|
||||
j == 0 ? "" : " && ",
|
||||
|
|
@ -1617,7 +1620,10 @@ void R::dispatchFunction(Node *n) {
|
|||
}
|
||||
}
|
||||
if (cur_args != -1) {
|
||||
Printv(f->code, "}", NIL);
|
||||
Printf(f->code, "} else {\n"
|
||||
"stop(\"cannot find overloaded function for %s with argtypes (\","
|
||||
"toString(argtypes),\")\");\n"
|
||||
"}", sfname);
|
||||
}
|
||||
Printv(f->code, ";\nf(...)", NIL);
|
||||
Printv(f->code, ";\n}", NIL);
|
||||
|
|
@ -1722,8 +1728,7 @@ int R::functionWrapper(Node *n) {
|
|||
}
|
||||
|
||||
int i;
|
||||
int nargs, num_required, varargs;
|
||||
UNUSED(varargs);
|
||||
int nargs;
|
||||
|
||||
String *wname = Swig_name_wrapper(iname);
|
||||
Replace(wname, "_wrap", "R_swig", DOH_REPLACE_FIRST);
|
||||
|
|
@ -1772,8 +1777,6 @@ int R::functionWrapper(Node *n) {
|
|||
Setattr(n,"wrap:parms",l);
|
||||
|
||||
nargs = emit_num_arguments(l);
|
||||
num_required = emit_num_required(l);
|
||||
varargs = emit_isvarargs(l);
|
||||
|
||||
Wrapper_add_local(f, "r_nprotect", "unsigned int r_nprotect = 0");
|
||||
Wrapper_add_localv(f, "r_ans", "SEXP", "r_ans = R_NilValue", NIL);
|
||||
|
|
@ -2118,11 +2121,6 @@ int R::functionWrapper(Node *n) {
|
|||
Would like to be able to do this so that we can potentialy insert
|
||||
*/
|
||||
if(processing_member_access_function || processing_class_member_function) {
|
||||
String *tmp;
|
||||
if(member_name)
|
||||
tmp = member_name;
|
||||
else
|
||||
tmp = Getattr(n, "memberfunctionHandler:name");
|
||||
addAccessor(member_name, sfun, iname);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -131,16 +131,17 @@ enum autodoc_t {
|
|||
AUTODOC_SETTER
|
||||
};
|
||||
|
||||
static const char *usage = "\
|
||||
static const char *usage = (char *) "\
|
||||
Ruby Options (available with -ruby)\n\
|
||||
-globalmodule - Wrap everything into the global module\n\
|
||||
-minherit - Attempt to support multiple inheritance\n\
|
||||
-nocppcast - Disable C++ casting operators, useful for generating bugs\n\
|
||||
-cppcast - Enable C++ casting operators (default)\n\
|
||||
-autorename - Enable renaming of classes and methods to follow Ruby coding standards\n\
|
||||
-cppcast - Enable C++ casting operators (default)\n\
|
||||
-globalmodule - Wrap everything into the global module\n\
|
||||
-initname <name>- Set entry function to Init_<name> (used by `require')\n\
|
||||
-minherit - Attempt to support multiple inheritance\n\
|
||||
-noautorename - Disable renaming of classes and methods (default)\n\
|
||||
-nocppcast - Disable C++ casting operators, useful for generating bugs\n\
|
||||
-prefix <name> - Set a prefix <name> to be prepended to all names\n\
|
||||
-initname <name> - Set entry function to Init_<name> (used by `require')\n";
|
||||
";
|
||||
|
||||
|
||||
#define RCLASS(hash, name) (RClass*)(Getattr(hash, name) ? Data(Getattr(hash, name)) : 0)
|
||||
|
|
@ -321,13 +322,11 @@ private:
|
|||
String *name = 0;
|
||||
String *type = 0;
|
||||
String *value = 0;
|
||||
String *ptype = 0;
|
||||
String *pdoc = Getattr(p, "tmap:doc");
|
||||
if (pdoc) {
|
||||
name = Getattr(p, "tmap:doc:name");
|
||||
type = Getattr(p, "tmap:doc:type");
|
||||
value = Getattr(p, "tmap:doc:value");
|
||||
ptype = Getattr(p, "tmap:doc:pytype");
|
||||
}
|
||||
|
||||
name = name ? name : Getattr(p, "name");
|
||||
|
|
@ -1607,9 +1606,7 @@ public:
|
|||
virtual int functionWrapper(Node *n) {
|
||||
|
||||
String *nodeType;
|
||||
bool constructor;
|
||||
bool destructor;
|
||||
String *storage;
|
||||
|
||||
String *symname = Copy(Getattr(n, "sym:name"));
|
||||
SwigType *t = Getattr(n, "type");
|
||||
|
|
@ -1624,9 +1621,7 @@ public:
|
|||
return SWIG_NOWRAP;
|
||||
|
||||
nodeType = Getattr(n, "nodeType");
|
||||
constructor = (!Cmp(nodeType, "constructor"));
|
||||
destructor = (!Cmp(nodeType, "destructor"));
|
||||
storage = Getattr(n, "storage");
|
||||
|
||||
/* If the C++ class constructor is overloaded, we only want to
|
||||
* write out the "new" singleton method once since it is always
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ extern "C" {
|
|||
Language *swig_r(void);
|
||||
Language *swig_scilab(void);
|
||||
Language *swig_go(void);
|
||||
Language *swig_d(void);
|
||||
}
|
||||
|
||||
struct swig_module {
|
||||
|
|
@ -71,6 +72,7 @@ static swig_module modules[] = {
|
|||
{"-clisp", swig_clisp, "CLISP"},
|
||||
{"-cffi", swig_cffi, "CFFI"},
|
||||
{"-csharp", swig_csharp, "C#"},
|
||||
{"-d", swig_d, "D"},
|
||||
{"-go", swig_go, "Go"},
|
||||
{"-guile", swig_guile, "Guile"},
|
||||
{"-java", swig_java, "Java"},
|
||||
|
|
|
|||
|
|
@ -213,7 +213,7 @@ public:
|
|||
virtual int addSymbol(const String *s, const Node *n, const_String_or_char_ptr scope = ""); /* Add symbol */
|
||||
virtual void dumpSymbols();
|
||||
virtual Node *symbolLookup(String *s, const_String_or_char_ptr scope = ""); /* Symbol lookup */
|
||||
virtual Node *classLookup(SwigType *s); /* Class lookup */
|
||||
virtual Node *classLookup(const SwigType *s); /* Class lookup */
|
||||
virtual Node *enumLookup(SwigType *s); /* Enum lookup */
|
||||
virtual int abstractClassTest(Node *n); /* Is class really abstract? */
|
||||
virtual int is_assignable(Node *n); /* Is variable assignable? */
|
||||
|
|
|
|||
|
|
@ -531,7 +531,19 @@ public:
|
|||
Printf(df->code, "Tcl_Obj *CONST *argv = objv+1;\n");
|
||||
Printf(df->code, "int argc = objc-1;\n");
|
||||
Printv(df->code, dispatch, "\n", NIL);
|
||||
Printf(df->code, "Tcl_SetResult(interp,(char *) \"No matching function for overloaded '%s'\", TCL_STATIC);\n", iname);
|
||||
Node *sibl = n;
|
||||
while (Getattr(sibl, "sym:previousSibling"))
|
||||
sibl = Getattr(sibl, "sym:previousSibling"); // go all the way up
|
||||
String *protoTypes = NewString("");
|
||||
do {
|
||||
String *fulldecl = Swig_name_decl(sibl);
|
||||
Printf(protoTypes, "\n\" %s\\n\"", fulldecl);
|
||||
Delete(fulldecl);
|
||||
} while ((sibl = Getattr(sibl, "sym:nextSibling")));
|
||||
Printf(df->code, "Tcl_SetResult(interp,(char *) "
|
||||
"\"Wrong number or type of arguments for overloaded function '%s'.\\n\""
|
||||
"\n\" Possible C/C++ prototypes are:\\n\"%s, TCL_STATIC);\n", iname, protoTypes);
|
||||
Delete(protoTypes);
|
||||
Printf(df->code, "return TCL_ERROR;\n");
|
||||
Printv(df->code, "}\n", NIL);
|
||||
Wrapper_print(df, f_wrappers);
|
||||
|
|
@ -783,10 +795,7 @@ public:
|
|||
String *wrap_class = NewStringf("&_wrap_class_%s", mangled_classname);
|
||||
SwigType_remember_clientdata(t, wrap_class);
|
||||
|
||||
// t = Copy(Getattr(n,"classtype"));
|
||||
// SwigType_add_pointer(t);
|
||||
|
||||
String *rt = Copy(Getattr(n, "classtype"));
|
||||
String *rt = Copy(getClassType());
|
||||
SwigType_add_pointer(rt);
|
||||
|
||||
// Register the class structure with the type checker
|
||||
|
|
|
|||
|
|
@ -254,12 +254,17 @@ class TypePass:private Dispatcher {
|
|||
Delete(smartnamestr);
|
||||
/* setup inheritance relationship between smart pointer templates */
|
||||
SwigType_inherit(smart, bsmart, 0, convcode);
|
||||
if (!GetFlag(bclass, "feature:smartptr"))
|
||||
Swig_warning(WARN_LANG_SMARTPTR_MISSING, Getfile(first), Getline(first), "Base class '%s' of '%s' is not similarly marked as a smart pointer.\n", SwigType_namestr(Getattr(bclass, "name")), SwigType_namestr(Getattr(first, "name")));
|
||||
Delete(convcode);
|
||||
Delete(bsmart);
|
||||
Delete(smart);
|
||||
} else {
|
||||
Swig_error(Getfile(first), Getline(first), "Invalid type (%s) in 'smartptr' feature for class %s.\n", SwigType_namestr(smartptr), SwigType_namestr(clsname));
|
||||
}
|
||||
} else {
|
||||
if (GetFlag(bclass, "feature:smartptr"))
|
||||
Swig_warning(WARN_LANG_SMARTPTR_MISSING, Getfile(first), Getline(first), "Derived class '%s' of '%s' is not similarly marked as a smart pointer.\n", SwigType_namestr(Getattr(first, "name")), SwigType_namestr(Getattr(bclass, "name")));
|
||||
}
|
||||
if (!importmode) {
|
||||
String *btype = Copy(bname);
|
||||
|
|
@ -994,6 +999,7 @@ class TypePass:private Dispatcher {
|
|||
}
|
||||
Node *nn = copyNode(c);
|
||||
Delattr(nn, "access"); // access might be different from the method in the base class
|
||||
Setattr(nn, "access", Getattr(n, "access"));
|
||||
if (!Getattr(nn, "sym:name"))
|
||||
Setattr(nn, "sym:name", symname);
|
||||
|
||||
|
|
@ -1056,11 +1062,11 @@ class TypePass:private Dispatcher {
|
|||
* which is hacked. */
|
||||
if (Getattr(n, "sym:overloaded"))
|
||||
{
|
||||
#ifdef DEBUG_OVERLOADED
|
||||
show_overloaded(n);
|
||||
#endif
|
||||
int cnt = 0;
|
||||
#ifdef DEBUG_OVERLOADED
|
||||
Node *debugnode = n;
|
||||
show_overloaded(n);
|
||||
#endif
|
||||
if (!firstChild(n)) {
|
||||
// Remove from overloaded list ('using' node does not actually end up adding in any methods)
|
||||
Node *ps = Getattr(n, "sym:previousSibling");
|
||||
|
|
@ -1107,14 +1113,16 @@ show_overloaded(n);
|
|||
Setattr(ns, "sym:previousSibling", pp);
|
||||
Setattr(pp, "sym:nextSibling", ns);
|
||||
}
|
||||
#ifdef DEBUG_OVERLOADED
|
||||
debugnode = firstoverloaded;
|
||||
#endif
|
||||
}
|
||||
Delattr(n, "sym:previousSibling");
|
||||
Delattr(n, "sym:nextSibling");
|
||||
Delattr(n, "sym:overloaded");
|
||||
Delattr(n, "sym:overname");
|
||||
#ifdef DEBUG_OVERLOADED
|
||||
show_overloaded(debugnode);
|
||||
show_overloaded(debugnode);
|
||||
#endif
|
||||
clean_overloaded(n); // Needed?
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,17 @@ char cvsroot_uffi_cxx[] = "$Id$";
|
|||
|
||||
#include "swigmod.h"
|
||||
|
||||
static const char *usage = (char *) "\
|
||||
UFFI Options (available with -uffi)\n\
|
||||
-identifier-converter <type or funcname> - \n\
|
||||
Specifies the type of conversion to do on C identifiers\n\
|
||||
to convert them to symbols. There are two built-in\n\
|
||||
converters: 'null' and 'lispify'. The default is\n\
|
||||
'null'. If you supply a name other than one of the\n\
|
||||
built-ins, then a function by that name will be\n\
|
||||
called to convert identifiers to symbols.\n\
|
||||
";
|
||||
|
||||
class UFFI:public Language {
|
||||
public:
|
||||
|
||||
|
|
@ -222,14 +233,7 @@ void UFFI::main(int argc, char *argv[]) {
|
|||
}
|
||||
|
||||
if (!strcmp(argv[i], "-help")) {
|
||||
fprintf(stdout, "UFFI Options (available with -uffi)\n");
|
||||
fprintf(stdout,
|
||||
" -identifier-converter <type or funcname>\n"
|
||||
"\tSpecifies the type of conversion to do on C identifiers to convert\n"
|
||||
"\tthem to symbols. There are two built-in converters: 'null' and\n"
|
||||
"\t 'lispify'. The default is 'null'. If you supply a name other\n"
|
||||
"\tthan one of the built-ins, then a function by that name will be\n"
|
||||
"\tcalled to convert identifiers to symbols.\n");
|
||||
Printf(stdout, "%s\n", usage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -274,7 +278,8 @@ int UFFI::functionWrapper(Node *n) {
|
|||
String *funcname = Getattr(n, "sym:name");
|
||||
ParmList *pl = Getattr(n, "parms");
|
||||
Parm *p;
|
||||
int argnum = 0, first = 1, varargs = 0;
|
||||
int argnum = 0, first = 1;
|
||||
// int varargs = 0;
|
||||
|
||||
//Language::functionWrapper(n);
|
||||
|
||||
|
|
@ -287,7 +292,7 @@ int UFFI::functionWrapper(Node *n) {
|
|||
Printf(f_cl, ":void");
|
||||
} else if (any_varargs(pl)) {
|
||||
Printf(f_cl, "#| varargs |#");
|
||||
varargs = 1;
|
||||
// varargs = 1;
|
||||
} else {
|
||||
for (p = pl; p; p = nextSibling(p), argnum++) {
|
||||
String *argname = Getattr(p, "name");
|
||||
|
|
|
|||
|
|
@ -57,7 +57,12 @@ int is_member_director(Node *member) {
|
|||
int is_non_virtual_protected_access(Node *n) {
|
||||
int result = 0;
|
||||
if (Swig_director_mode() && Swig_director_protected_mode() && Swig_all_protected_mode() && is_protected(n) && !checkAttribute(n, "storage", "virtual")) {
|
||||
if (is_member_director_helper(Getattr(n, "parentNode"), n))
|
||||
Node *parentNode = Getattr(n, "parentNode");
|
||||
// When vtable is empty, the director class does not get emitted, so a check for an empty vtable should be done.
|
||||
// However, vtable is set in Language and so is not yet set when methods in Typepass call clean_overloaded()
|
||||
// which calls is_non_virtual_protected_access. So commented out below.
|
||||
// Moving the director vtable creation into into Typepass should solve this problem.
|
||||
if (is_member_director_helper(parentNode, n) /* && Getattr(parentNode, "vtable")*/)
|
||||
result = 1;
|
||||
}
|
||||
return result;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue