Merge branch 'swig:master' into imfunc
This commit is contained in:
commit
e25911b846
308 changed files with 5008 additions and 4773 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -196,7 +196,7 @@ public:
|
|||
String *name = Getattr(n, "name") ? Getattr(n, "name") : NewString("<unnamed>");
|
||||
Swig_warning(WARN_JAVA_NSPACE_WITHOUT_PACKAGE, Getfile(n), Getline(n),
|
||||
"The nspace feature is used on '%s' without -package. "
|
||||
"The generated code may not compile as Java does not support types declared in a named package accessing types declared in an unnamed package.\n", name);
|
||||
"The generated code may not compile as Java does not support types declared in a named package accessing types declared in an unnamed package.\n", SwigType_namestr(name));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -994,7 +994,7 @@ int JSEmitter::emitDtor(Node *n) {
|
|||
{
|
||||
SWIG_PRV_DATA* t = (SWIG_PRV_DATA*)JSObjectGetPrivate(thisObject);
|
||||
if(t && t->swigCMemOwn) free ((${type}*)t->swigCObject);
|
||||
if(t) free(t);
|
||||
free(t);
|
||||
}
|
||||
%}
|
||||
|
||||
|
|
@ -1007,7 +1007,7 @@ int JSEmitter::emitDtor(Node *n) {
|
|||
${type}* arg1 = (${type}*)t->swigCObject;
|
||||
${destructor_action}
|
||||
}
|
||||
if(t) free(t);
|
||||
free(t);
|
||||
|
||||
Based on what I saw in the Lua and Ruby modules, I use Getattr(n, "wrap:action")
|
||||
to decide if the user has a preferred destructor action.
|
||||
|
|
@ -1255,7 +1255,7 @@ int JSEmitter::emitFunctionDispatcher(Node *n, bool /*is_member */ ) {
|
|||
// Note: this dispatcher function gets called after the last overloaded function has been created.
|
||||
// At this time, n.wrap:name contains the name of the last wrapper function.
|
||||
// To get a valid function name for the dispatcher function we take the last wrapper name and
|
||||
// substract the extension "sym:overname",
|
||||
// subtract the extension "sym:overname",
|
||||
String *wrap_name = NewString(Getattr(n, "wrap:name"));
|
||||
String *overname = Getattr(n, "sym:overname");
|
||||
|
||||
|
|
|
|||
|
|
@ -1320,16 +1320,21 @@ int Language::staticmemberfunctionHandler(Node *n) {
|
|||
Delete(mrename);
|
||||
mrename = mangled;
|
||||
|
||||
if (Getattr(n, "sym:overloaded") && code) {
|
||||
Append(cname, Getattr(defaultargs ? defaultargs : n, "sym:overname"));
|
||||
}
|
||||
if (code) {
|
||||
// See Swig_MethodToFunction() for the explanation of this code.
|
||||
if (Getattr(n, "sym:overloaded")) {
|
||||
Append(cname, Getattr(defaultargs ? defaultargs : n, "sym:overname"));
|
||||
} else {
|
||||
Append(cname, "__SWIG");
|
||||
}
|
||||
|
||||
if (!defaultargs && code) {
|
||||
/* Hmmm. An added static member. We have to create a little wrapper for this */
|
||||
String *mangled_cname = Swig_name_mangle(cname);
|
||||
Swig_add_extension_code(n, mangled_cname, parms, type, code, CPlusPlus, 0);
|
||||
Setattr(n, "extendname", mangled_cname);
|
||||
Delete(mangled_cname);
|
||||
if (!defaultargs) {
|
||||
/* Hmmm. An added static member. We have to create a little wrapper for this */
|
||||
String *mangled_cname = Swig_name_mangle(cname);
|
||||
Swig_add_extension_code(n, mangled_cname, parms, type, code, CPlusPlus, 0);
|
||||
Setattr(n, "extendname", mangled_cname);
|
||||
Delete(mangled_cname);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ static const char *usage4 = (const char *) "\
|
|||
-oh <headfile> - Set name of C++ output header file for directors to <headfile>\n\
|
||||
-outcurrentdir - Set default output dir to current dir instead of input file's path\n\
|
||||
-outdir <dir> - Set language specific files output directory to <dir>\n\
|
||||
-pcreversion - Display PCRE version information\n\
|
||||
-pcreversion - Display PCRE2 version information\n\
|
||||
-small - Compile in virtual elimination and compact mode\n\
|
||||
-swiglib - Report location of SWIG library and exit\n\
|
||||
-templatereduce - Reduce all the typedefs in templates\n\
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
String *argv_template_string;
|
||||
String *argc_template_string;
|
||||
|
||||
namespace {
|
||||
struct Overloaded {
|
||||
Node *n; /* Node */
|
||||
int argc; /* Argument count */
|
||||
|
|
@ -28,6 +29,7 @@ struct Overloaded {
|
|||
int error; /* Ambiguity error */
|
||||
bool implicitconv_function; /* For ordering implicitconv functions*/
|
||||
};
|
||||
}
|
||||
|
||||
static int fast_dispatch_mode = 0;
|
||||
static int cast_dispatch_mode = 0;
|
||||
|
|
|
|||
|
|
@ -445,13 +445,7 @@ public:
|
|||
|
||||
Printv(magic,
|
||||
"#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n",
|
||||
"#ifdef PERL_OBJECT\n",
|
||||
"#define MAGIC_CLASS _wrap_", underscore_module, "_var::\n",
|
||||
"class _wrap_", underscore_module, "_var : public CPerlObj {\n",
|
||||
"public:\n",
|
||||
"#else\n",
|
||||
"#define MAGIC_CLASS\n",
|
||||
"#endif\n",
|
||||
"SWIGCLASS_STATIC int swig_magic_readonly(pTHX_ SV *SWIGUNUSEDPARM(sv), MAGIC *SWIGUNUSEDPARM(mg)) {\n",
|
||||
tab4, "MAGIC_PPERL\n", tab4, "croak(\"Value is read-only.\");\n", tab4, "return 0;\n", "}\n", NIL);
|
||||
|
||||
|
|
@ -470,7 +464,6 @@ public:
|
|||
|
||||
/* Dump out variable wrappers */
|
||||
|
||||
Printv(magic, "\n\n#ifdef PERL_OBJECT\n", "};\n", "#endif\n", NIL);
|
||||
Printv(magic, "\n#ifdef __cplusplus\n}\n#endif\n", NIL);
|
||||
|
||||
Printf(f_header, "%s\n", magic);
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -73,8 +73,10 @@ static int py3 = 0;
|
|||
|
||||
/* C++ Support + Shadow Classes */
|
||||
|
||||
static int have_constructor;
|
||||
static int have_repr;
|
||||
static int have_constructor = 0;
|
||||
static int have_repr = 0;
|
||||
static bool have_builtin_static_member_method_callback = false;
|
||||
static bool have_fast_proxy_static_member_method_callback = false;
|
||||
static String *real_classname;
|
||||
|
||||
/* Thread Support */
|
||||
|
|
@ -93,6 +95,7 @@ static int nortti = 0;
|
|||
static int relativeimport = 0;
|
||||
|
||||
/* flags for the make_autodoc function */
|
||||
namespace {
|
||||
enum autodoc_t {
|
||||
AUTODOC_CLASS,
|
||||
AUTODOC_CTOR,
|
||||
|
|
@ -103,7 +106,7 @@ enum autodoc_t {
|
|||
AUTODOC_CONST,
|
||||
AUTODOC_VAR
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
static const char *usage1 = "\
|
||||
Python Options (available with -python)\n\
|
||||
|
|
@ -444,6 +447,11 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
if (builtin && !shadow) {
|
||||
Printf(stderr, "Incompatible options -builtin and -noproxy specified.\n");
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (doxygen)
|
||||
doxygenTranslator = new PyDocConverter(doxygen_translator_flags);
|
||||
|
||||
|
|
@ -814,6 +822,10 @@ public:
|
|||
|
||||
Append(const_code, "{0, 0, 0, 0.0, 0, 0}};\n");
|
||||
Printf(f_wrappers, "%s\n", const_code);
|
||||
|
||||
if (have_fast_proxy_static_member_method_callback)
|
||||
Printf(f_init, " SWIG_Python_FixMethods(SwigMethods_proxydocs, swig_const_table, swig_types, swig_type_initial);\n\n");
|
||||
|
||||
initialize_threads(f_init);
|
||||
|
||||
Printf(f_init, "#if PY_VERSION_HEX >= 0x03000000\n");
|
||||
|
|
@ -2477,6 +2489,7 @@ public:
|
|||
Printf(methods, "\"swig_ptr: %s\"", Getattr(n, "feature:callback:name"));
|
||||
if (fastproxy) {
|
||||
Printf(methods_proxydocs, "\"swig_ptr: %s\"", Getattr(n, "feature:callback:name"));
|
||||
have_fast_proxy_static_member_method_callback = true;
|
||||
}
|
||||
} else {
|
||||
Append(methods, "NULL");
|
||||
|
|
@ -2797,7 +2810,7 @@ public:
|
|||
|
||||
/* Generate code for argument marshalling */
|
||||
if (funpack) {
|
||||
if (num_arguments > 0 && !overname) {
|
||||
if (num_arguments > (builtin_self && !constructor ? 1 : 0) && !overname) {
|
||||
sprintf(source, "PyObject *swig_obj[%d]", num_arguments);
|
||||
Wrapper_add_localv(f, "swig_obj", source, NIL);
|
||||
}
|
||||
|
|
@ -3423,7 +3436,6 @@ public:
|
|||
Printf(f_init, "#endif\n");
|
||||
Printf(f_init, "\t }\n");
|
||||
Printf(f_init, "\t PyDict_SetItemString(md, \"%s\", globals);\n", global_name);
|
||||
Printf(f_init, "\t Py_DECREF(globals);\n");
|
||||
if (builtin)
|
||||
Printf(f_init, "\t SwigPyBuiltin_AddPublicSymbol(public_interface, \"%s\");\n", global_name);
|
||||
have_globals = 1;
|
||||
|
|
@ -3935,6 +3947,10 @@ public:
|
|||
int funpack = fastunpack;
|
||||
static String *tp_new = NewString("PyType_GenericNew");
|
||||
|
||||
if (have_builtin_static_member_method_callback) {
|
||||
Printf(f_init, " SWIG_Python_FixMethods(SwigPyBuiltin_%s_methods, swig_const_table, swig_types, swig_type_initial);\n", mname);
|
||||
}
|
||||
|
||||
Printv(f_init, " SwigPyBuiltin_SetMetaType(builtin_pytype, metatype);\n", NIL);
|
||||
|
||||
// We can’t statically initialize a structure member with a function defined in another C module
|
||||
|
|
@ -4365,6 +4381,7 @@ public:
|
|||
/* Create new strings for building up a wrapper function */
|
||||
have_constructor = 0;
|
||||
have_repr = 0;
|
||||
have_builtin_static_member_method_callback = false;
|
||||
|
||||
class_name = Getattr(n, "sym:name");
|
||||
real_classname = Getattr(n, "name");
|
||||
|
|
@ -4727,6 +4744,7 @@ public:
|
|||
Swig_restore(n);
|
||||
}
|
||||
|
||||
int kw = (check_kwargs(n) && !Getattr(n, "sym:overloaded")) ? 1 : 0;
|
||||
if (builtin && in_class) {
|
||||
if ((GetFlagAttr(n, "feature:extend") || checkAttribute(n, "access", "public"))
|
||||
&& !Getattr(class_members, symname)) {
|
||||
|
|
@ -4741,7 +4759,7 @@ public:
|
|||
else if (funpack && argcount == 1)
|
||||
Append(pyflags, "METH_O");
|
||||
else
|
||||
Append(pyflags, "METH_VARARGS");
|
||||
Append(pyflags, kw ? "METH_VARARGS|METH_KEYWORDS" : "METH_VARARGS");
|
||||
// Cast via void(*)(void) to suppress GCC -Wcast-function-type warning.
|
||||
// Python should always call the function correctly, but the Python C
|
||||
// API requires us to store it in function pointer of a different type.
|
||||
|
|
@ -4749,6 +4767,11 @@ public:
|
|||
String *ds = cdocstring(n, AUTODOC_STATICFUNC);
|
||||
Printf(builtin_methods, " { \"%s\", (PyCFunction)(void(*)(void))%s, %s, \"%s\" },\n", symname, wname, pyflags, ds);
|
||||
Delete(ds);
|
||||
} else if (Getattr(n, "feature:callback")) {
|
||||
String *ds = NewStringf("swig_ptr: %s", Getattr(n, "feature:callback:name"));
|
||||
Printf(builtin_methods, " { \"%s\", (PyCFunction)(void(*)(void))%s, %s, \"%s\" },\n", symname, wname, pyflags, ds);
|
||||
Delete(ds);
|
||||
have_builtin_static_member_method_callback = true;
|
||||
} else {
|
||||
Printf(builtin_methods, " { \"%s\", (PyCFunction)(void(*)(void))%s, %s, \"\" },\n", symname, wname, pyflags);
|
||||
}
|
||||
|
|
@ -4767,7 +4790,6 @@ public:
|
|||
String *staticfunc_name = NewString(fastproxy ? "_swig_new_static_method" : "staticmethod");
|
||||
bool fast = (fastproxy && !have_addtofunc(n)) || Getattr(n, "feature:callback");
|
||||
if (!fast || olddefs) {
|
||||
int kw = (check_kwargs(n) && !Getattr(n, "sym:overloaded")) ? 1 : 0;
|
||||
String *parms = make_pyParmList(n, false, false, kw);
|
||||
String *callParms = make_pyParmList(n, false, true, kw);
|
||||
Printv(f_shadow, "\n", tab4, "@staticmethod", NIL);
|
||||
|
|
|
|||
|
|
@ -1301,13 +1301,14 @@ void R::addAccessor(String *memberName, Wrapper *wrapper, String *name,
|
|||
|
||||
#define MAX_OVERLOAD 256
|
||||
|
||||
namespace {
|
||||
struct Overloaded {
|
||||
Node *n; /* Node */
|
||||
int argc; /* Argument count */
|
||||
ParmList *parms; /* Parameters used for overload check */
|
||||
int error; /* Ambiguity error */
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
List * R::Swig_overload_rank(Node *n,
|
||||
bool script_lang_wrapping) {
|
||||
|
|
@ -2568,7 +2569,7 @@ int R::generateCopyRoutines(Node *n) {
|
|||
|
||||
|
||||
Printf(sfile, "# Start definition of copy methods for %s\n", rclassName);
|
||||
Printf(sfile, "setMethod('copyToR', '_p_%s', CopyToR%s);\n", rclassName,
|
||||
Printf(sfile, "setMethod('copyToR', '_p%s', CopyToR%s);\n", mangledName,
|
||||
mangledName);
|
||||
Printf(sfile, "setMethod('copyToC', '%s', CopyToC%s);\n\n", rclassName,
|
||||
mangledName);
|
||||
|
|
|
|||
|
|
@ -106,9 +106,10 @@ public:
|
|||
|
||||
char *strip(const_String_or_char_ptr s) {
|
||||
Clear(temp);
|
||||
Append(temp, s);
|
||||
if (Strncmp(s, prefix, Len(prefix)) == 0) {
|
||||
Replaceall(temp, prefix, "");
|
||||
Append(temp, Char(s) + Len(prefix));
|
||||
} else {
|
||||
Append(temp, s);
|
||||
}
|
||||
return Char(temp);
|
||||
}
|
||||
|
|
@ -116,6 +117,7 @@ public:
|
|||
|
||||
|
||||
/* flags for the make_autodoc function */
|
||||
namespace {
|
||||
enum autodoc_t {
|
||||
AUTODOC_CLASS,
|
||||
AUTODOC_CTOR,
|
||||
|
|
@ -127,6 +129,7 @@ enum autodoc_t {
|
|||
AUTODOC_SETTER,
|
||||
AUTODOC_NONE
|
||||
};
|
||||
}
|
||||
|
||||
static const char *usage = "\
|
||||
Ruby Options (available with -ruby)\n\
|
||||
|
|
|
|||
|
|
@ -228,9 +228,10 @@ public:
|
|||
|
||||
// Module initialization function
|
||||
String *gatewayInitFunctionName = NewStringf("%s_Init", gatewayName);
|
||||
String *wrapperInitFunctionName = NewStringf("SWIG_%s_Init", gatewayName);
|
||||
|
||||
/* Add initialization function to builder table */
|
||||
addFunctionToScilab(gatewayInitFunctionName, gatewayInitFunctionName);
|
||||
addFunctionToScilab(gatewayInitFunctionName, wrapperInitFunctionName);
|
||||
|
||||
// Add helper functions to builder table
|
||||
addHelperFunctions();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue