Another merge with master.
Updated Doxygen error numbers yet again, as Python errors got added in the meanwhile, pushing the Doxygen ones further off. And re-merged PEP8/whitespace-related conflicts in autodoc_runme.py once again (if anybody is looking for a motivating example about why significant whitespace is bad, here is a great use case).
This commit is contained in:
commit
302955a152
448 changed files with 8836 additions and 5079 deletions
|
|
@ -1794,12 +1794,12 @@ static List *Swig_overload_rank(Node *n, bool script_lang_wrapping) {
|
|||
String *t2 = Getattr(p2, "tmap:typecheck:precedence");
|
||||
if ((!t1) && (!nodes[i].error)) {
|
||||
Swig_warning(WARN_TYPEMAP_TYPECHECK, Getfile(nodes[i].n), Getline(nodes[i].n),
|
||||
"Overloaded method %s not supported (no type checking rule for '%s').\n",
|
||||
"Overloaded method %s not supported (incomplete type checking rule - no precedence level in typecheck typemap for '%s').\n",
|
||||
Swig_name_decl(nodes[i].n), SwigType_str(Getattr(p1, "type"), 0));
|
||||
nodes[i].error = 1;
|
||||
} else if ((!t2) && (!nodes[j].error)) {
|
||||
Swig_warning(WARN_TYPEMAP_TYPECHECK, Getfile(nodes[j].n), Getline(nodes[j].n),
|
||||
"Overloaded method %s not supported (no type checking rule for '%s').\n",
|
||||
"Overloaded method %s not supported (incomplete type checking rule - no precedence level in typecheck typemap for '%s').\n",
|
||||
Swig_name_decl(nodes[j].n), SwigType_str(Getattr(p2, "type"), 0));
|
||||
nodes[j].error = 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -941,6 +941,8 @@ Allocate():
|
|||
Setattr(inclass, "allocate:default_destructor", "1");
|
||||
} else if (cplus_mode == PROTECTED) {
|
||||
Setattr(inclass, "allocate:default_base_destructor", "1");
|
||||
} else if (cplus_mode == PRIVATE) {
|
||||
Setattr(inclass, "allocate:private_destructor", "1");
|
||||
}
|
||||
} else {
|
||||
Setattr(inclass, "allocate:has_destructor", "1");
|
||||
|
|
|
|||
|
|
@ -831,7 +831,12 @@ void CFFI::emit_struct_union(Node *n, bool un = false) {
|
|||
if (slot_name && (Strcmp(slot_name, "t") == 0 || Strcmp(slot_name, "T") == 0))
|
||||
slot_name = NewStringf("t_var");
|
||||
|
||||
Printf(f_cl, "\n\t(%s %s)", slot_name, typespec);
|
||||
if (SwigType_isarray(childType) && SwigType_array_ndim(childType) == 1) {
|
||||
String *dim = SwigType_array_getdim(childType, 0);
|
||||
Printf(f_cl, "\n\t(%s %s :count %s)", slot_name, typespec, dim);
|
||||
Delete(dim);
|
||||
} else
|
||||
Printf(f_cl, "\n\t(%s %s)", slot_name, typespec);
|
||||
|
||||
Delete(node);
|
||||
Delete(childType);
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ class CSHARP:public Language {
|
|||
File *f_init;
|
||||
File *f_directors;
|
||||
File *f_directors_h;
|
||||
File *f_single_out;
|
||||
List *filenames_list;
|
||||
|
||||
bool proxy_flag; // Flag for generating proxy classes
|
||||
|
|
@ -78,6 +79,7 @@ class CSHARP:public Language {
|
|||
String *director_method_types; // Director method types
|
||||
String *director_connect_parms; // Director delegates parameter list for director connect call
|
||||
String *destructor_call; //C++ destructor call if any
|
||||
String *output_file; // File name for single file mode. If set all generated code will be written to this file
|
||||
|
||||
// Director method stuff:
|
||||
List *dmethods_seq;
|
||||
|
|
@ -108,6 +110,7 @@ public:
|
|||
f_init(NULL),
|
||||
f_directors(NULL),
|
||||
f_directors_h(NULL),
|
||||
f_single_out(NULL),
|
||||
filenames_list(NULL),
|
||||
proxy_flag(true),
|
||||
native_function_flag(false),
|
||||
|
|
@ -150,6 +153,7 @@ public:
|
|||
director_method_types(NULL),
|
||||
director_connect_parms(NULL),
|
||||
destructor_call(NULL),
|
||||
output_file(NULL),
|
||||
dmethods_seq(NULL),
|
||||
dmethods_table(NULL),
|
||||
n_dmethods(0),
|
||||
|
|
@ -244,6 +248,16 @@ public:
|
|||
} else if (strcmp(argv[i], "-oldvarnames") == 0) {
|
||||
Swig_mark_arg(i);
|
||||
old_variable_names = true;
|
||||
} else if (strcmp(argv[i], "-outfile") == 0) {
|
||||
if (argv[i + 1]) {
|
||||
output_file = NewString("");
|
||||
Printf(output_file, argv[i + 1]);
|
||||
Swig_mark_arg(i);
|
||||
Swig_mark_arg(i + 1);
|
||||
i++;
|
||||
} else {
|
||||
Swig_arg_error();
|
||||
}
|
||||
} else if (strcmp(argv[i], "-help") == 0) {
|
||||
Printf(stdout, "%s\n", usage);
|
||||
}
|
||||
|
|
@ -418,22 +432,12 @@ public:
|
|||
|
||||
if (directorsEnabled()) {
|
||||
// Insert director runtime into the f_runtime file (make it occur before %header section)
|
||||
Swig_insert_file("director_common.swg", f_runtime);
|
||||
Swig_insert_file("director.swg", f_runtime);
|
||||
}
|
||||
// Generate the intermediary class
|
||||
{
|
||||
String *filen = NewStringf("%s%s.cs", SWIG_output_directory(), imclass_name);
|
||||
File *f_im = NewFile(filen, "w", SWIG_output_files());
|
||||
if (!f_im) {
|
||||
FileErrorDisplay(filen);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
Append(filenames_list, Copy(filen));
|
||||
Delete(filen);
|
||||
filen = NULL;
|
||||
|
||||
// Start writing out the intermediary class file
|
||||
emitBanner(f_im);
|
||||
File *f_im = getOutputFile(SWIG_output_directory(), imclass_name);
|
||||
|
||||
addOpenNamespace(0, f_im);
|
||||
|
||||
|
|
@ -461,23 +465,14 @@ public:
|
|||
Printf(f_im, "}\n");
|
||||
addCloseNamespace(0, f_im);
|
||||
|
||||
Delete(f_im);
|
||||
if (f_im != f_single_out)
|
||||
Delete(f_im);
|
||||
f_im = NULL;
|
||||
}
|
||||
|
||||
// Generate the C# module class
|
||||
{
|
||||
String *filen = NewStringf("%s%s.cs", SWIG_output_directory(), module_class_name);
|
||||
File *f_module = NewFile(filen, "w", SWIG_output_files());
|
||||
if (!f_module) {
|
||||
FileErrorDisplay(filen);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
Append(filenames_list, Copy(filen));
|
||||
Delete(filen);
|
||||
filen = NULL;
|
||||
|
||||
// Start writing out the module class file
|
||||
emitBanner(f_module);
|
||||
File *f_module = getOutputFile(SWIG_output_directory(), module_class_name);
|
||||
|
||||
addOpenNamespace(0, f_module);
|
||||
|
||||
|
|
@ -513,7 +508,9 @@ public:
|
|||
Printf(f_module, "}\n");
|
||||
addCloseNamespace(0, f_module);
|
||||
|
||||
Delete(f_module);
|
||||
if (f_module != f_single_out)
|
||||
Delete(f_module);
|
||||
f_module = NULL;
|
||||
}
|
||||
|
||||
if (upcasts_code)
|
||||
|
|
@ -612,6 +609,12 @@ public:
|
|||
f_directors_h = NULL;
|
||||
}
|
||||
|
||||
if (f_single_out) {
|
||||
Dump(f_single_out, f_begin);
|
||||
Delete(f_single_out);
|
||||
f_single_out = NULL;
|
||||
}
|
||||
|
||||
Dump(f_wrappers, f_begin);
|
||||
Wrapper_pretty_print(f_init, f_begin);
|
||||
Delete(f_header);
|
||||
|
|
@ -634,6 +637,50 @@ public:
|
|||
Printf(f, "//------------------------------------------------------------------------------\n\n");
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* getOutputFile()
|
||||
*
|
||||
* Prepares a File object by creating the file in the file system and
|
||||
* writing the banner for auto-generated files to it (emitBanner).
|
||||
* If '-outfile' is provided (single file mode) the supplied parameters will
|
||||
* be ignored and the returned file will always be:
|
||||
* <outdir>/<outfile>
|
||||
* Otherwise the file will be:
|
||||
* <dir>/<name>.cs
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
File *getOutputFile(const String *dir, const String *name) {
|
||||
if (output_file) {
|
||||
if (!f_single_out) {
|
||||
String *filen = NewStringf("%s%s", SWIG_output_directory(), output_file);
|
||||
f_single_out = NewFile(filen, "w", SWIG_output_files());
|
||||
if (!f_single_out) {
|
||||
FileErrorDisplay(filen);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
Append(filenames_list, Copy(filen));
|
||||
Delete(filen);
|
||||
filen = NULL;
|
||||
|
||||
emitBanner(f_single_out);
|
||||
}
|
||||
return f_single_out;
|
||||
} else {
|
||||
String *filen = NewStringf("%s%s.cs", dir, name);
|
||||
File *f = NewFile(filen, "w", SWIG_output_files());
|
||||
if (!f) {
|
||||
FileErrorDisplay(f);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
Append(filenames_list, Copy(filen));
|
||||
Delete(filen);
|
||||
filen = NULL;
|
||||
|
||||
emitBanner(f);
|
||||
return f;
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Add new director upcall signature
|
||||
*----------------------------------------------------------------------*/
|
||||
|
|
@ -1085,7 +1132,7 @@ public:
|
|||
scope = NewString("");
|
||||
if (nspace)
|
||||
Printf(scope, "%s", nspace);
|
||||
if (Node* cls = getCurrentClass()) {
|
||||
if (Node *cls = getCurrentClass()) {
|
||||
if (Node *outer = Getattr(cls, "nested:outer")) {
|
||||
String *outerClassesPrefix = Copy(Getattr(outer, "sym:name"));
|
||||
for (outer = Getattr(outer, "nested:outer"); outer != 0; outer = Getattr(outer, "nested:outer")) {
|
||||
|
|
@ -1197,18 +1244,7 @@ public:
|
|||
} else {
|
||||
// Global enums are defined in their own file
|
||||
String *output_directory = outputDirectory(nspace);
|
||||
String *filen = NewStringf("%s%s.cs", output_directory, symname);
|
||||
File *f_enum = NewFile(filen, "w", SWIG_output_files());
|
||||
if (!f_enum) {
|
||||
FileErrorDisplay(filen);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
Append(filenames_list, Copy(filen));
|
||||
Delete(filen);
|
||||
filen = NULL;
|
||||
|
||||
// Start writing out the enum file
|
||||
emitBanner(f_enum);
|
||||
File *f_enum = getOutputFile(output_directory, symname);
|
||||
|
||||
addOpenNamespace(nspace, f_enum);
|
||||
|
||||
|
|
@ -1216,7 +1252,9 @@ public:
|
|||
"\n", enum_code, "\n", NIL);
|
||||
|
||||
addCloseNamespace(nspace, f_enum);
|
||||
Delete(f_enum);
|
||||
if (f_enum != f_single_out)
|
||||
Delete(f_enum);
|
||||
f_enum = NULL;
|
||||
Delete(output_directory);
|
||||
}
|
||||
} else {
|
||||
|
|
@ -1641,7 +1679,7 @@ public:
|
|||
String *proxyclassname = Getattr(n, "classtypeobj");
|
||||
String *baseclassname = Getattr(base.item, "name");
|
||||
Swig_warning(WARN_CSHARP_MULTIPLE_INHERITANCE, Getfile(n), Getline(n),
|
||||
"Warning for %s proxy: Base %s ignored. Multiple inheritance is not supported in Java.\n", SwigType_namestr(proxyclassname), SwigType_namestr(baseclassname));
|
||||
"Warning for %s proxy: Base %s ignored. Multiple inheritance is not supported in C#.\n", SwigType_namestr(proxyclassname), SwigType_namestr(baseclassname));
|
||||
base = Next(base);
|
||||
}
|
||||
}
|
||||
|
|
@ -1916,21 +1954,9 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
// Each outer proxy class goes into a separate file
|
||||
if (!has_outerclass) {
|
||||
String *output_directory = outputDirectory(nspace);
|
||||
String *filen = NewStringf("%s%s.cs", output_directory, proxy_class_name);
|
||||
f_proxy = NewFile(filen, "w", SWIG_output_files());
|
||||
if (!f_proxy) {
|
||||
FileErrorDisplay(filen);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
Append(filenames_list, Copy(filen));
|
||||
Delete(filen);
|
||||
filen = NULL;
|
||||
|
||||
// Start writing out the proxy class file
|
||||
emitBanner(f_proxy);
|
||||
f_proxy = getOutputFile(output_directory, proxy_class_name);
|
||||
|
||||
addOpenNamespace(nspace, f_proxy);
|
||||
}
|
||||
|
|
@ -1990,7 +2016,8 @@ public:
|
|||
if (!has_outerclass) {
|
||||
Printf(f_proxy, "}\n");
|
||||
addCloseNamespace(nspace, f_proxy);
|
||||
Delete(f_proxy);
|
||||
if (f_proxy != f_single_out)
|
||||
Delete(f_proxy);
|
||||
f_proxy = NULL;
|
||||
} else {
|
||||
for (int i = 0; i < nesting_depth; ++i)
|
||||
|
|
@ -2003,7 +2030,7 @@ public:
|
|||
good place to put this code, since Abstract Base Classes (ABCs) can and should have
|
||||
downcasts, making the constructorHandler() a bad place (because ABCs don't get to
|
||||
have constructors emitted.) */
|
||||
if (GetFlag(n, "feature:javadowncast")) {
|
||||
if (GetFlag(n, "feature:csdowncast")) {
|
||||
String *downcast_method = Swig_name_member(getNSpace(), proxy_class_name, "SWIGDowncast");
|
||||
String *wname = Swig_name_wrapper(downcast_method);
|
||||
|
||||
|
|
@ -3215,18 +3242,7 @@ public:
|
|||
Setline(n, line_number);
|
||||
|
||||
String *swigtype = NewString("");
|
||||
String *filen = NewStringf("%s%s.cs", SWIG_output_directory(), classname);
|
||||
File *f_swigtype = NewFile(filen, "w", SWIG_output_files());
|
||||
if (!f_swigtype) {
|
||||
FileErrorDisplay(filen);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
Append(filenames_list, Copy(filen));
|
||||
Delete(filen);
|
||||
filen = NULL;
|
||||
|
||||
// Start writing out the type wrapper class file
|
||||
emitBanner(f_swigtype);
|
||||
File *f_swigtype = getOutputFile(SWIG_output_directory(), classname);
|
||||
|
||||
addOpenNamespace(0, f_swigtype);
|
||||
|
||||
|
|
@ -3261,8 +3277,9 @@ public:
|
|||
Printv(f_swigtype, swigtype, NIL);
|
||||
|
||||
addCloseNamespace(0, f_swigtype);
|
||||
|
||||
Delete(f_swigtype);
|
||||
if (f_swigtype != f_single_out)
|
||||
Delete(f_swigtype);
|
||||
f_swigtype = NULL;
|
||||
Delete(swigtype);
|
||||
Delete(n);
|
||||
}
|
||||
|
|
@ -3358,7 +3375,7 @@ public:
|
|||
/* -----------------------------------------------------------------------------
|
||||
* outputDirectory()
|
||||
*
|
||||
* Return the directory to use for generating Java classes/enums and create the
|
||||
* Return the directory to use for generating C# classes/enums and create the
|
||||
* subdirectory (does not create if language specific outdir does not exist).
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
|
|
@ -3498,7 +3515,7 @@ public:
|
|||
* classDirectorMethod()
|
||||
*
|
||||
* Emit a virtual director method to pass a method call on to the
|
||||
* underlying Java object.
|
||||
* underlying C# object.
|
||||
*
|
||||
* --------------------------------------------------------------- */
|
||||
|
||||
|
|
@ -3659,7 +3676,7 @@ public:
|
|||
if (!ignored_method)
|
||||
Printf(w->code, "} else {\n");
|
||||
|
||||
/* Go through argument list, convert from native to Java */
|
||||
/* Go through argument list, convert from native to C# */
|
||||
for (i = 0, p = l; p; ++i) {
|
||||
/* Is this superfluous? */
|
||||
while (checkAttribute(p, "tmap:directorin:numinputs", "0")) {
|
||||
|
|
@ -4284,4 +4301,5 @@ C# Options (available with -csharp)\n\
|
|||
-noproxy - Generate the low-level functional interface instead\n\
|
||||
of proxy classes\n\
|
||||
-oldvarnames - Old intermediary method names for variable wrappers\n\
|
||||
-outfile <file> - Write all C# into a single <file> located in the output directory\n\
|
||||
\n";
|
||||
|
|
|
|||
|
|
@ -508,6 +508,7 @@ public:
|
|||
|
||||
if (directorsEnabled()) {
|
||||
// Insert director runtime into the f_runtime file (before %header section).
|
||||
Swig_insert_file("director_common.swg", f_runtime);
|
||||
Swig_insert_file("director.swg", f_runtime);
|
||||
}
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -508,6 +508,7 @@ public:
|
|||
|
||||
if (directorsEnabled()) {
|
||||
// Insert director runtime into the f_runtime file (make it occur before %header section)
|
||||
Swig_insert_file("director_common.swg", f_runtime);
|
||||
Swig_insert_file("director.swg", f_runtime);
|
||||
}
|
||||
// Generate the intermediary class
|
||||
|
|
@ -1892,7 +1893,7 @@ public:
|
|||
} else if (Len(pure_baseclass) > 0 && Len(baseclass) > 0) {
|
||||
Swig_warning(WARN_JAVA_MULTIPLE_INHERITANCE, Getfile(n), Getline(n),
|
||||
"Warning for %s proxy: Base %s ignored. Multiple inheritance is not supported in Java. "
|
||||
"Perhaps you need one of the 'replace' or 'notderived' attributes in the csbase typemap?\n", typemap_lookup_type, pure_baseclass);
|
||||
"Perhaps you need one of the 'replace' or 'notderived' attributes in the javabase typemap?\n", typemap_lookup_type, pure_baseclass);
|
||||
}
|
||||
|
||||
// Pure Java interfaces
|
||||
|
|
@ -3569,7 +3570,7 @@ public:
|
|||
Printf(f_runtime, "namespace Swig {\n");
|
||||
Printf(f_runtime, " namespace {\n");
|
||||
Printf(f_runtime, " jclass jclass_%s = NULL;\n", imclass_name);
|
||||
Printf(f_runtime, " jmethodID director_methids[%d];\n", n_methods);
|
||||
Printf(f_runtime, " jmethodID director_method_ids[%d];\n", n_methods);
|
||||
Printf(f_runtime, " }\n");
|
||||
Printf(f_runtime, "}\n");
|
||||
|
||||
|
|
@ -3586,8 +3587,8 @@ public:
|
|||
Printf(w->code, "Swig::jclass_%s = (jclass) jenv->NewGlobalRef(jcls);\n", imclass_name);
|
||||
Printf(w->code, "if (!Swig::jclass_%s) return;\n", imclass_name);
|
||||
Printf(w->code, "for (i = 0; i < (int) (sizeof(methods)/sizeof(methods[0])); ++i) {\n");
|
||||
Printf(w->code, " Swig::director_methids[i] = jenv->GetStaticMethodID(jcls, methods[i].method, methods[i].signature);\n");
|
||||
Printf(w->code, " if (!Swig::director_methids[i]) return;\n");
|
||||
Printf(w->code, " Swig::director_method_ids[i] = jenv->GetStaticMethodID(jcls, methods[i].method, methods[i].signature);\n");
|
||||
Printf(w->code, " if (!Swig::director_method_ids[i]) return;\n");
|
||||
Printf(w->code, "}\n");
|
||||
|
||||
Printf(w->code, "}\n");
|
||||
|
|
@ -4241,7 +4242,7 @@ public:
|
|||
if (!is_void)
|
||||
Printf(w->code, "jresult = (%s) ", c_ret_type);
|
||||
|
||||
Printf(w->code, "jenv->%s(Swig::jclass_%s, Swig::director_methids[%s], %s);\n", methop, imclass_name, methid, jupcall_args);
|
||||
Printf(w->code, "jenv->%s(Swig::jclass_%s, Swig::director_method_ids[%s], %s);\n", methop, imclass_name, methid, jupcall_args);
|
||||
|
||||
// Generate code to handle any Java exception thrown by director delegation
|
||||
directorExceptHandler(n, catches_list ? catches_list : throw_parm_list, w);
|
||||
|
|
@ -4630,7 +4631,7 @@ public:
|
|||
Printf(f_directors_h, " return (n < %d ? swig_override[n] : false);\n", n_methods);
|
||||
Printf(f_directors_h, " }\n");
|
||||
Printf(f_directors_h, "protected:\n");
|
||||
Printf(f_directors_h, " bool swig_override[%d];\n", n_methods);
|
||||
Printf(f_directors_h, " Swig::BoolArray<%d> swig_override;\n", n_methods);
|
||||
|
||||
/* Emit the code to look up the class's methods, initialize the override array */
|
||||
|
||||
|
|
|
|||
|
|
@ -943,7 +943,7 @@ int Language::cDeclaration(Node *n) {
|
|||
}
|
||||
|
||||
if (!validIdentifier(symname)) {
|
||||
Swig_warning(WARN_LANG_IDENTIFIER, input_file, line_number, "Can't wrap '%s' unless renamed to a valid identifier.\n", symname);
|
||||
Swig_warning(WARN_LANG_IDENTIFIER, input_file, line_number, "Can't wrap '%s' unless renamed to a valid identifier.\n", SwigType_namestr(symname));
|
||||
return SWIG_NOWRAP;
|
||||
}
|
||||
|
||||
|
|
@ -3699,14 +3699,26 @@ int Language::abstractClassTest(Node *n) {
|
|||
return 0;
|
||||
if (Getattr(n, "allocate:nonew"))
|
||||
return 1;
|
||||
|
||||
// A class cannot be instantiated if one of its bases has a private destructor
|
||||
// Note that if the above does not hold the class can be instantiated if its own destructor is private
|
||||
List *bases = Getattr(n, "bases");
|
||||
if (bases) {
|
||||
for (int i = 0; i < Len(bases); i++) {
|
||||
Node *b = Getitem(bases, i);
|
||||
if (GetFlag(b, "allocate:private_destructor"))
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* now check for the rest */
|
||||
List *abstracts = Getattr(n, "abstracts");
|
||||
if (!abstracts)
|
||||
return 0;
|
||||
int labs = Len(abstracts);
|
||||
#ifdef SWIG_DEBUG
|
||||
List *bases = Getattr(n, "allbases");
|
||||
Printf(stderr, "testing %s %d %d\n", Getattr(n, "name"), labs, Len(bases));
|
||||
List *allbases = Getattr(n, "allbases");
|
||||
Printf(stderr, "testing %s %d %d\n", Getattr(n, "name"), labs, Len(allbases));
|
||||
#endif
|
||||
if (!labs)
|
||||
return 0; /*strange, but need to be fixed */
|
||||
|
|
|
|||
|
|
@ -131,8 +131,8 @@ static const char *usage3 = (const char *) "\
|
|||
static const char *usage4 = (const char *) "\
|
||||
-O - Enable the optimization options: \n\
|
||||
-fastdispatch -fvirtual \n\
|
||||
-o <outfile> - Set name of the output file to <outfile>\n\
|
||||
-oh <headfile> - Set name of the output header file to <headfile>\n\
|
||||
-o <outfile> - Set name of C/C++ output file to <outfile>\n\
|
||||
-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\
|
||||
|
|
@ -595,7 +595,7 @@ void SWIG_getoptions(int argc, char *argv[]) {
|
|||
Swig_filename_correct(outfile_name);
|
||||
if (!outfile_name_h || !dependencies_file) {
|
||||
char *ext = strrchr(Char(outfile_name), '.');
|
||||
String *basename = ext ? NewStringWithSize(Char(outfile_name), Char(ext) - Char(outfile_name)) : NewString(outfile_name);
|
||||
String *basename = ext ? NewStringWithSize(Char(outfile_name), (int)(Char(ext) - Char(outfile_name))) : NewString(outfile_name);
|
||||
if (!dependencies_file) {
|
||||
dependencies_file = NewStringf("%s.%s", basename, depends_extension);
|
||||
}
|
||||
|
|
@ -899,7 +899,7 @@ int SWIG_main(int argc, char *argv[], Language *l) {
|
|||
String *vers = NewString("SWIG_VERSION 0x");
|
||||
int count = 0;
|
||||
while (token) {
|
||||
int len = strlen(token);
|
||||
int len = (int)strlen(token);
|
||||
assert(len == 1 || len == 2);
|
||||
Printf(vers, "%s%s", (len == 1) ? "0" : "", token);
|
||||
token = strtok(NULL, ".");
|
||||
|
|
@ -1221,7 +1221,7 @@ int SWIG_main(int argc, char *argv[], Language *l) {
|
|||
Printf(stdout, "debug-top stage 3\n");
|
||||
Swig_print_tree(top);
|
||||
}
|
||||
if (dump_module & STAGE3) {
|
||||
if (top && (dump_module & STAGE3)) {
|
||||
Printf(stdout, "debug-module stage 3\n");
|
||||
Swig_print_tree(Getattr(top, "module"));
|
||||
}
|
||||
|
|
@ -1230,7 +1230,7 @@ int SWIG_main(int argc, char *argv[], Language *l) {
|
|||
Printf(stdout, "Generating wrappers...\n");
|
||||
}
|
||||
|
||||
if (dump_classes) {
|
||||
if (top && dump_classes) {
|
||||
Hash *classes = Getattr(top, "classes");
|
||||
if (classes) {
|
||||
Printf(stdout, "Classes\n");
|
||||
|
|
|
|||
|
|
@ -340,6 +340,8 @@ static void insertNodeAfter(Node *n, Node *c) {
|
|||
}
|
||||
|
||||
void Swig_nested_name_unnamed_c_structs(Node *n) {
|
||||
if (!n)
|
||||
return;
|
||||
if (!classhash)
|
||||
classhash = Getattr(n, "classes");
|
||||
Node *c = firstChild(n);
|
||||
|
|
@ -427,6 +429,8 @@ static void remove_outer_class_reference(Node *n) {
|
|||
}
|
||||
|
||||
void Swig_nested_process_classes(Node *n) {
|
||||
if (!n)
|
||||
return;
|
||||
Node *c = firstChild(n);
|
||||
while (c) {
|
||||
Node *next = nextSibling(c);
|
||||
|
|
|
|||
|
|
@ -325,6 +325,7 @@ public:
|
|||
|
||||
if (directorsEnabled()) {
|
||||
// Insert director runtime into the f_runtime file (make it occur before %header section)
|
||||
Swig_insert_file("director_common.swg", f_runtime);
|
||||
Swig_insert_file("director.swg", f_runtime);
|
||||
}
|
||||
|
||||
|
|
@ -619,9 +620,9 @@ public:
|
|||
}
|
||||
|
||||
/* if the object is a director, and the method call originated from its
|
||||
* underlying python object, resolve the call by going up the c++
|
||||
* inheritance chain. otherwise try to resolve the method in python.
|
||||
* without this check an infinite loop is set up between the director and
|
||||
* underlying ocaml object, resolve the call by going up the c++
|
||||
* inheritance chain. otherwise try to resolve the method in ocaml.
|
||||
* without this check an infinite loop is set up between the director and
|
||||
* shadow class method calls.
|
||||
*/
|
||||
|
||||
|
|
@ -989,7 +990,7 @@ public:
|
|||
find_marker += strlen("(*Stream:");
|
||||
|
||||
if (next) {
|
||||
int num_chars = next - find_marker;
|
||||
int num_chars = (int)(next - find_marker);
|
||||
String *stream_name = NewString(find_marker);
|
||||
Delslice(stream_name, num_chars, Len(stream_name));
|
||||
File *fout = Swig_filebyname(stream_name);
|
||||
|
|
@ -1000,7 +1001,7 @@ public:
|
|||
if (!following)
|
||||
following = next + strlen(next);
|
||||
String *chunk = NewString(next);
|
||||
Delslice(chunk, following - next, Len(chunk));
|
||||
Delslice(chunk, (int)(following - next), Len(chunk));
|
||||
Printv(fout, chunk, NIL);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -228,8 +228,10 @@ public:
|
|||
if (Len(docs))
|
||||
emit_doc_texinfo();
|
||||
|
||||
if (directorsEnabled())
|
||||
if (directorsEnabled()) {
|
||||
Swig_insert_file("director_common.swg", f_runtime);
|
||||
Swig_insert_file("director.swg", f_runtime);
|
||||
}
|
||||
|
||||
Printf(f_init, "return true;\n}\n");
|
||||
Printf(s_global_tab, "{0,0,0,0,0}\n};\n");
|
||||
|
|
@ -1385,7 +1387,7 @@ public:
|
|||
SwigType_namestr(name));
|
||||
}
|
||||
} else {
|
||||
// attach typemaps to arguments (C/C++ -> Python)
|
||||
// attach typemaps to arguments (C/C++ -> Octave)
|
||||
String *parse_args = NewString("");
|
||||
|
||||
Swig_director_parms_fixup(l);
|
||||
|
|
|
|||
|
|
@ -158,12 +158,12 @@ List *Swig_overload_rank(Node *n, bool script_lang_wrapping) {
|
|||
String *t2 = Getattr(p2, "tmap:typecheck:precedence");
|
||||
if ((!t1) && (!nodes[i].error)) {
|
||||
Swig_warning(WARN_TYPEMAP_TYPECHECK, Getfile(nodes[i].n), Getline(nodes[i].n),
|
||||
"Overloaded method %s not supported (no type checking rule for '%s').\n",
|
||||
"Overloaded method %s not supported (incomplete type checking rule - no precedence level in typecheck typemap for '%s').\n",
|
||||
Swig_name_decl(nodes[i].n), SwigType_str(Getattr(p1, "type"), 0));
|
||||
nodes[i].error = 1;
|
||||
} else if ((!t2) && (!nodes[j].error)) {
|
||||
Swig_warning(WARN_TYPEMAP_TYPECHECK, Getfile(nodes[j].n), Getline(nodes[j].n),
|
||||
"Overloaded method %s not supported (no type checking rule for '%s').\n",
|
||||
"Overloaded method %s not supported (incomplete type checking rule - no precedence level in typecheck typemap for '%s').\n",
|
||||
Swig_name_decl(nodes[j].n), SwigType_str(Getattr(p2, "type"), 0));
|
||||
nodes[j].error = 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,8 +13,6 @@
|
|||
|
||||
#include "swigmod.h"
|
||||
#include "cparse.h"
|
||||
static int treduce = SWIG_cparse_template_reduce(0);
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
static const char *usage = "\
|
||||
|
|
@ -470,6 +468,7 @@ public:
|
|||
|
||||
if (directorsEnabled()) {
|
||||
// Insert director runtime into the f_runtime file (make it occur before %header section)
|
||||
Swig_insert_file("director_common.swg", f_runtime);
|
||||
Swig_insert_file("director.swg", f_runtime);
|
||||
}
|
||||
|
||||
|
|
@ -2254,7 +2253,7 @@ public:
|
|||
if (SwigType_isreference(ptype)) {
|
||||
Insert(ppname, 0, "&");
|
||||
}
|
||||
/* if necessary, cast away const since Python doesn't support it! */
|
||||
/* if necessary, cast away const since Perl doesn't support it! */
|
||||
if (SwigType_isconst(nptype)) {
|
||||
nonconst = NewStringf("nc_tmp_%s", pname);
|
||||
String *nonconst_i = NewStringf("= const_cast< %s >(%s)", SwigType_lstr(ptype, 0), ppname);
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ class PHP : public Language {
|
|||
p = strchr(p, '"');
|
||||
if (p) {
|
||||
++p;
|
||||
Insert(action, p - Char(action), " TSRMLS_CC");
|
||||
Insert(action, (int)(p - Char(action)), " TSRMLS_CC");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -473,6 +473,7 @@ public:
|
|||
|
||||
if (directorsEnabled()) {
|
||||
// Insert director runtime
|
||||
Swig_insert_file("director_common.swg", s_header);
|
||||
Swig_insert_file("director.swg", s_header);
|
||||
}
|
||||
|
||||
|
|
@ -1721,7 +1722,7 @@ public:
|
|||
Printf(output, "\t\t\treturn new %s%s($r);\n", prefix, Getattr(classLookup(d), "sym:name"));
|
||||
} else {
|
||||
Printf(output, "\t\t\t$c = new stdClass();\n");
|
||||
Printf(output, "\t\t\t$c->"SWIG_PTR" = $r;\n");
|
||||
Printf(output, "\t\t\t$c->" SWIG_PTR " = $r;\n");
|
||||
Printf(output, "\t\t\treturn $c;\n");
|
||||
}
|
||||
Printf(output, "\t\t}\n\t\treturn $r;\n");
|
||||
|
|
@ -2423,7 +2424,7 @@ done:
|
|||
String *target = Swig_method_decl(0, decl, classname, parms, 0, 0);
|
||||
const char * p = Char(target);
|
||||
const char * comma = strchr(p, ',');
|
||||
size_t ins = comma ? comma - p : Len(target) - 1;
|
||||
int ins = comma ? (int)(comma - p) : Len(target) - 1;
|
||||
Insert(target, ins, " TSRMLS_DC");
|
||||
|
||||
call = Swig_csuperclass_call(0, basetype, superparms);
|
||||
|
|
@ -2442,7 +2443,7 @@ done:
|
|||
String *target = Swig_method_decl(0, decl, classname, parms, 0, 1);
|
||||
const char * p = Char(target);
|
||||
const char * comma = strchr(p, ',');
|
||||
size_t ins = comma ? comma - p : Len(target) - 1;
|
||||
int ins = comma ? (int)(comma - p) : Len(target) - 1;
|
||||
Insert(target, ins, " TSRMLS_DC");
|
||||
|
||||
Printf(f_directors_h, " %s;\n", target);
|
||||
|
|
|
|||
|
|
@ -13,9 +13,6 @@
|
|||
|
||||
#include "swigmod.h"
|
||||
#include "cparse.h"
|
||||
|
||||
static int treduce = SWIG_cparse_template_reduce(0);
|
||||
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
|
|
@ -993,6 +990,7 @@ public:
|
|||
|
||||
if (directorsEnabled()) {
|
||||
// Insert director runtime into the f_runtime file (make it occur before %header section)
|
||||
Swig_insert_file("director_common.swg", f_runtime);
|
||||
Swig_insert_file("director.swg", f_runtime);
|
||||
}
|
||||
|
||||
|
|
@ -1212,7 +1210,7 @@ public:
|
|||
const char *py3_end1 = Strchr(rpkg, '.');
|
||||
if (!py3_end1)
|
||||
py3_end1 = (Char(rpkg)) + Len(rpkg);
|
||||
py3_rlen1 = py3_end1 - (Char(rpkg));
|
||||
py3_rlen1 = (int)(py3_end1 - Char(rpkg));
|
||||
} else {
|
||||
rpkg = NewString("");
|
||||
}
|
||||
|
|
@ -1389,7 +1387,7 @@ public:
|
|||
* pythoncode() - Output python code into the shadow file
|
||||
* ------------------------------------------------------------ */
|
||||
|
||||
String *pythoncode(String *code, const_String_or_char_ptr indent) {
|
||||
String *pythoncode(String *code, const_String_or_char_ptr indent, String * file, int line) {
|
||||
String *out = NewString("");
|
||||
String *temp;
|
||||
char *t;
|
||||
|
|
@ -1407,38 +1405,91 @@ public:
|
|||
/* Split the input text into lines */
|
||||
List *clist = SplitLines(temp);
|
||||
Delete(temp);
|
||||
int initial = 0;
|
||||
String *s = 0;
|
||||
Iterator si;
|
||||
/* Get the initial indentation */
|
||||
|
||||
for (si = First(clist); si.item; si = Next(si)) {
|
||||
s = si.item;
|
||||
if (Len(s)) {
|
||||
char *c = Char(s);
|
||||
while (*c) {
|
||||
if (!isspace(*c))
|
||||
break;
|
||||
initial++;
|
||||
c++;
|
||||
}
|
||||
if (*c && !isspace(*c)) {
|
||||
break;
|
||||
} else {
|
||||
initial = 0;
|
||||
}
|
||||
// Line number within the pythoncode.
|
||||
int py_line = 0;
|
||||
|
||||
String * initial = 0;
|
||||
Iterator si;
|
||||
|
||||
/* Get the initial indentation. Skip lines which only contain whitespace
|
||||
* and/or a comment, as the indentation of those doesn't matter:
|
||||
*
|
||||
* A logical line that contains only spaces, tabs, formfeeds and
|
||||
* possibly a comment, is ignored (i.e., no NEWLINE token is
|
||||
* generated).
|
||||
*
|
||||
* see:
|
||||
* https://docs.python.org/2/reference/lexical_analysis.html#blank-lines
|
||||
* https://docs.python.org/3/reference/lexical_analysis.html#blank-lines
|
||||
*/
|
||||
for (si = First(clist); si.item; si = Next(si), ++py_line) {
|
||||
const char *c = Char(si.item);
|
||||
int i;
|
||||
for (i = 0; isspace((unsigned char)c[i]); i++) {
|
||||
// Scan forward until we find a non-space (which may be a nul byte).
|
||||
}
|
||||
char ch = c[i];
|
||||
if (ch && ch != '#') {
|
||||
// Found a line with actual content.
|
||||
initial = NewStringWithSize(c, i);
|
||||
break;
|
||||
}
|
||||
if (ch) {
|
||||
Printv(out, indent, c, NIL);
|
||||
}
|
||||
Putc('\n', out);
|
||||
}
|
||||
while (si.item) {
|
||||
s = si.item;
|
||||
if (Len(s) > initial) {
|
||||
char *c = Char(s);
|
||||
c += initial;
|
||||
|
||||
// Process remaining lines.
|
||||
for ( ; si.item; si = Next(si), ++py_line) {
|
||||
const char *c = Char(si.item);
|
||||
// If no prefixed line was found, the above loop should have completed.
|
||||
assert(initial);
|
||||
|
||||
int i;
|
||||
for (i = 0; isspace((unsigned char)c[i]); i++) {
|
||||
// Scan forward until we find a non-space (which may be a nul byte).
|
||||
}
|
||||
char ch = c[i];
|
||||
if (!ch) {
|
||||
// Line is just whitespace - emit an empty line.
|
||||
Putc('\n', out);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ch == '#') {
|
||||
// Comment - the indentation doesn't matter to python, but try to
|
||||
// adjust the whitespace for the benefit of human readers (though SWIG
|
||||
// currently seems to always remove any whitespace before a '#' before
|
||||
// we get here, in which case we'll just leave the comment at the start
|
||||
// of the line).
|
||||
if (i >= Len(initial)) {
|
||||
Printv(out, indent, NIL);
|
||||
}
|
||||
|
||||
Printv(out, c + i, "\n", NIL);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (i < Len(initial)) {
|
||||
// There's non-whitespace in the initial prefix of this line.
|
||||
Swig_error(file, line, "Line indented less than expected (line %d of pythoncode)\n", py_line);
|
||||
Printv(out, indent, c, "\n", NIL);
|
||||
} else {
|
||||
Printv(out, "\n", NIL);
|
||||
if (memcmp(c, Char(initial), Len(initial)) == 0) {
|
||||
// Prefix matches initial, so just remove it.
|
||||
Printv(out, indent, c + Len(initial), "\n", NIL);
|
||||
continue;
|
||||
}
|
||||
Swig_warning(WARN_PYTHON_INDENT_MISMATCH,
|
||||
file, line, "Whitespace prefix doesn't match (line %d of pythoncode)\n", py_line);
|
||||
// To avoid gratuitously breaking interface files which worked with
|
||||
// SWIG <= 3.0.5, we remove a prefix of the same number of bytes for
|
||||
// lines which start with different whitespace to the line we got
|
||||
// 'initial' from.
|
||||
Printv(out, indent, c + Len(initial), "\n", NIL);
|
||||
}
|
||||
si = Next(si);
|
||||
}
|
||||
Delete(clist);
|
||||
return out;
|
||||
|
|
@ -1811,10 +1862,17 @@ public:
|
|||
// Only do the autodoc if there isn't a docstring for the class
|
||||
String *str = Getattr(n, "feature:docstring");
|
||||
if (!str || Len(str) == 0) {
|
||||
if (CPlusPlus) {
|
||||
Printf(doc, "Proxy of C++ %s class", real_classname);
|
||||
if (builtin) {
|
||||
String *name = Getattr(n, "name");
|
||||
String *rname = add_explicit_scope(SwigType_namestr(name));
|
||||
Printf(doc, "%s", rname);
|
||||
Delete(rname);
|
||||
} else {
|
||||
Printf(doc, "Proxy of C %s struct", real_classname);
|
||||
if (CPlusPlus) {
|
||||
Printf(doc, "Proxy of C++ %s class", real_classname);
|
||||
} else {
|
||||
Printf(doc, "Proxy of C %s struct", real_classname);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1926,7 +1984,7 @@ public:
|
|||
|
||||
// Avoid unnecessary string allocation in the common case when we don't
|
||||
// need to remove any suffix.
|
||||
return *end == '\0' ? v : NewStringWithSize(s, end - s);
|
||||
return *end == '\0' ? v : NewStringWithSize(s, (int)(end - s));
|
||||
}
|
||||
|
||||
return NIL;
|
||||
|
|
@ -1937,9 +1995,12 @@ public:
|
|||
* Check if string v can be a Python value literal or a
|
||||
* constant. Return NIL if it isn't.
|
||||
* ------------------------------------------------------------ */
|
||||
String *convertValue(String *v, SwigType *t) {
|
||||
String *convertValue(String *v, SwigType *type) {
|
||||
const char *const s = Char(v);
|
||||
char *end;
|
||||
String *result = NIL;
|
||||
bool fail = false;
|
||||
SwigType *resolved_type = 0;
|
||||
|
||||
// Check if this is a number in any base.
|
||||
long value = strtol(s, &end, 0);
|
||||
|
|
@ -1948,93 +2009,108 @@ public:
|
|||
if (errno == ERANGE) {
|
||||
// There was an overflow, we could try representing the value as Python
|
||||
// long integer literal, but for now don't bother with it.
|
||||
return NIL;
|
||||
}
|
||||
fail = true;
|
||||
} else {
|
||||
if (*end != '\0') {
|
||||
// If there is a suffix after the number, we can safely ignore any
|
||||
// combination of "l" and "u", but not anything else (again, stuff like
|
||||
// "LL" could be handled, but we don't bother to do it currently).
|
||||
bool seen_long = false;
|
||||
for (char* p = end; *p != '\0'; ++p) {
|
||||
switch (*p) {
|
||||
case 'l':
|
||||
case 'L':
|
||||
// Bail out on "LL".
|
||||
if (seen_long) {
|
||||
fail = true;
|
||||
break;
|
||||
}
|
||||
seen_long = true;
|
||||
break;
|
||||
|
||||
if (*end != '\0') {
|
||||
// If there is a suffix after the number, we can safely ignore any
|
||||
// combination of "l" and "u", but not anything else (again, stuff like
|
||||
// "LL" could be handled, but we don't bother to do it currently).
|
||||
bool seen_long = false;
|
||||
for (char* p = end; *p != '\0'; ++p) {
|
||||
switch (*p) {
|
||||
case 'l':
|
||||
case 'L':
|
||||
// Bail out on "LL".
|
||||
if (seen_long)
|
||||
return NIL;
|
||||
seen_long = true;
|
||||
break;
|
||||
case 'u':
|
||||
case 'U':
|
||||
break;
|
||||
|
||||
case 'u':
|
||||
case 'U':
|
||||
break;
|
||||
|
||||
default:
|
||||
// Except that our suffix could actually be the fractional part of
|
||||
// a floating point number, so we still have to check for this.
|
||||
return convertDoubleValue(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Deal with the values starting with 0 first as they can be octal or
|
||||
// hexadecimal numbers or even pointers.
|
||||
if (s[0] == '0') {
|
||||
if (Len(v) == 1) {
|
||||
// This is just a lone 0, but it needs to be represented differently
|
||||
// in Python depending on whether it's a zero or a null pointer.
|
||||
if (SwigType_ispointer(t))
|
||||
return NewString("None");
|
||||
else
|
||||
return v;
|
||||
} else if (s[1] == 'x' || s[1] == 'X') {
|
||||
// This must have been a hex number, we can use it directly in Python,
|
||||
// so nothing to do here.
|
||||
} else {
|
||||
// This must have been an octal number, we have to change its prefix
|
||||
// to be "0o" in Python 3 only (and as long as we still support Python
|
||||
// 2.5, this can't be done unconditionally).
|
||||
if (py3) {
|
||||
if (end - s > 1) {
|
||||
String *res = NewString("0o");
|
||||
Append(res, NewStringWithSize(s + 1, end - s - 1));
|
||||
return res;
|
||||
default:
|
||||
// Except that our suffix could actually be the fractional part of
|
||||
// a floating point number, so we still have to check for this.
|
||||
result = convertDoubleValue(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Avoid unnecessary string allocation in the common case when we don't
|
||||
// need to remove any suffix.
|
||||
return *end == '\0' ? v : NewStringWithSize(s, end - s);
|
||||
if (!fail) {
|
||||
// Allow integers as the default value for a bool parameter.
|
||||
resolved_type = SwigType_typedef_resolve_all(type);
|
||||
if (Cmp(resolved_type, "bool") == 0) {
|
||||
result = NewString(value ? "True" : "False");
|
||||
} else {
|
||||
// Deal with the values starting with 0 first as they can be octal or
|
||||
// hexadecimal numbers or even pointers.
|
||||
if (s[0] == '0') {
|
||||
if (Len(v) == 1) {
|
||||
// This is just a lone 0, but it needs to be represented differently
|
||||
// in Python depending on whether it's a zero or a null pointer.
|
||||
if (SwigType_ispointer(resolved_type))
|
||||
result = NewString("None");
|
||||
else
|
||||
result = v;
|
||||
} else if (s[1] == 'x' || s[1] == 'X') {
|
||||
// This must have been a hex number, we can use it directly in Python,
|
||||
// so nothing to do here.
|
||||
} else {
|
||||
// This must have been an octal number, we have to change its prefix
|
||||
// to be "0o" in Python 3 only (and as long as we still support Python
|
||||
// 2.5, this can't be done unconditionally).
|
||||
if (py3) {
|
||||
if (end - s > 1) {
|
||||
result = NewString("0o");
|
||||
Append(result, NewStringWithSize(s + 1, (int)(end - s - 1)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Avoid unnecessary string allocation in the common case when we don't
|
||||
// need to remove any suffix.
|
||||
if (!result)
|
||||
result = *end == '\0' ? v : NewStringWithSize(s, (int)(end - s));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check if this is a floating point number (notice that it wasn't
|
||||
// necessarily parsed as a long above, consider e.g. ".123").
|
||||
if (String *res = convertDoubleValue(v)) {
|
||||
return res;
|
||||
}
|
||||
if (!fail && !result) {
|
||||
result = convertDoubleValue(v);
|
||||
if (!result) {
|
||||
if (Strcmp(v, "true") == 0 || Strcmp(v, "TRUE") == 0)
|
||||
result = NewString("True");
|
||||
else if (Strcmp(v, "false") == 0 || Strcmp(v, "FALSE") == 0)
|
||||
result = NewString("False");
|
||||
else if (Strcmp(v, "NULL") == 0 || Strcmp(v, "nullptr") == 0) {
|
||||
if (!resolved_type)
|
||||
resolved_type = SwigType_typedef_resolve_all(type);
|
||||
result = SwigType_ispointer(resolved_type) ? NewString("None") : NewString("0");
|
||||
}
|
||||
|
||||
if (Strcmp(v, "true") == 0 || Strcmp(v, "TRUE") == 0)
|
||||
return NewString("True");
|
||||
if (Strcmp(v, "false") == 0 || Strcmp(v, "FALSE") == 0)
|
||||
return NewString("False");
|
||||
if (Strcmp(v, "NULL") == 0 || Strcmp(v, "nullptr") == 0)
|
||||
return SwigType_ispointer(t) ? NewString("None") : NewString("0");
|
||||
|
||||
// This could also be an enum type, default value of which could be
|
||||
// representable in Python if it doesn't include any scope (which could,
|
||||
// but currently is not, translated).
|
||||
if (!Strchr(s, ':')) {
|
||||
Node *lookup = Swig_symbol_clookup(v, 0);
|
||||
if (lookup) {
|
||||
if (Cmp(Getattr(lookup, "nodeType"), "enumitem") == 0)
|
||||
return Getattr(lookup, "sym:name");
|
||||
// This could also be an enum type, default value of which could be
|
||||
// representable in Python if it doesn't include any scope (which could,
|
||||
// but currently is not, translated).
|
||||
else if (!Strchr(s, ':')) {
|
||||
Node *lookup = Swig_symbol_clookup(v, 0);
|
||||
if (lookup) {
|
||||
if (Cmp(Getattr(lookup, "nodeType"), "enumitem") == 0)
|
||||
result = Getattr(lookup, "sym:name");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NIL;
|
||||
Delete(resolved_type);
|
||||
return result;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------
|
||||
|
|
@ -2047,34 +2123,40 @@ public:
|
|||
* at C++ code level where they can always be handled.
|
||||
* ------------------------------------------------------------ */
|
||||
bool is_representable_as_pyargs(Node *n) {
|
||||
bool is_representable = true;
|
||||
|
||||
ParmList *plist = CopyParmList(Getattr(n, "parms"));
|
||||
Swig_typemap_attach_parms("default", plist, NULL);
|
||||
|
||||
Parm *p;
|
||||
Parm *pnext;
|
||||
|
||||
for (p = plist; p; p = pnext) {
|
||||
pnext = NIL;
|
||||
pnext = nextSibling(p);
|
||||
String *tm = Getattr(p, "tmap:in");
|
||||
if (tm) {
|
||||
pnext = Getattr(p, "tmap:in:next");
|
||||
Parm *in_next = Getattr(p, "tmap:in:next");
|
||||
if (in_next)
|
||||
pnext = in_next;
|
||||
if (checkAttribute(p, "tmap:in:numinputs", "0")) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (!pnext) {
|
||||
pnext = nextSibling(p);
|
||||
}
|
||||
|
||||
// "default" typemap can contain arbitrary C++ code, so while it could, in
|
||||
// principle, be possible to examine it and check if it's just something
|
||||
// simple of the form "$1 = expression" and then use convertValue() to
|
||||
// check if expression can be used in Python, but for now we just
|
||||
// pessimistically give up and prefer to handle this at C++ level only.
|
||||
if (Getattr(p, "tmap:default"))
|
||||
return false;
|
||||
|
||||
if (String *value = Getattr(p, "value")) {
|
||||
String *type = Getattr(p, "type");
|
||||
if (!convertValue(value, type)) {
|
||||
is_representable = false;
|
||||
break;
|
||||
}
|
||||
if (!convertValue(value, type))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return is_representable;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -2116,8 +2198,17 @@ public:
|
|||
if (nn)
|
||||
n = nn;
|
||||
|
||||
/* For overloaded function, just use *args */
|
||||
if (is_real_overloaded(n) || GetFlag(n, "feature:compactdefaultargs") || !is_representable_as_pyargs(n)) {
|
||||
/* We prefer to explicitly list all parameters of the C function in the
|
||||
generated Python code as this makes the function more convenient to use,
|
||||
however in some cases we must replace the real parameters list with just
|
||||
the catch all "*args". This happens when:
|
||||
|
||||
1. The function is overloaded as Python doesn't support this.
|
||||
2. We were explicitly asked to use the "compact" arguments form.
|
||||
3. We were explicitly asked to use default args from C via the "python:cdefaultargs" feature.
|
||||
4. One of the default argument values can't be represented in Python.
|
||||
*/
|
||||
if (is_real_overloaded(n) || GetFlag(n, "feature:compactdefaultargs") || GetFlag(n, "feature:python:cdefaultargs") || !is_representable_as_pyargs(n)) {
|
||||
String *parms = NewString("");
|
||||
if (in_class)
|
||||
Printf(parms, "self, ");
|
||||
|
|
@ -2256,10 +2347,10 @@ public:
|
|||
if (have_docstring(n))
|
||||
Printv(f_dest, tab4, docstring(n, AUTODOC_FUNC), "\n", NIL);
|
||||
if (have_pythonprepend(n))
|
||||
Printv(f_dest, pythoncode(pythonprepend(n), tab4), "\n", NIL);
|
||||
Printv(f_dest, pythoncode(pythonprepend(n), tab4, Getfile(n), Getline(n)), "\n", NIL);
|
||||
if (have_pythonappend(n)) {
|
||||
Printv(f_dest, tab4 "val = ", funcCall(name, callParms), "\n", NIL);
|
||||
Printv(f_dest, pythoncode(pythonappend(n), tab4), "\n", NIL);
|
||||
Printv(f_dest, pythoncode(pythonappend(n), tab4, Getfile(n), Getline(n)), "\n", NIL);
|
||||
Printv(f_dest, tab4 "return val\n", NIL);
|
||||
} else {
|
||||
Printv(f_dest, tab4 "return ", funcCall(name, callParms), "\n", NIL);
|
||||
|
|
@ -2746,14 +2837,12 @@ public:
|
|||
Printv(f->locals, " char * kwnames[] = ", kwargs, ";\n", NIL);
|
||||
}
|
||||
|
||||
if (use_parse || allow_kwargs || !modernargs) {
|
||||
if (builtin && in_class && tuple_arguments == 0) {
|
||||
Printf(parse_args, " if (args && PyTuple_Check(args) && PyTuple_GET_SIZE(args) > 0) SWIG_fail;\n");
|
||||
} else {
|
||||
Printf(parse_args, ":%s\"", iname);
|
||||
Printv(parse_args, arglist, ")) SWIG_fail;\n", NIL);
|
||||
funpack = 0;
|
||||
}
|
||||
if (builtin && !funpack && in_class && tuple_arguments == 0) {
|
||||
Printf(parse_args, " if (args && PyTuple_Check(args) && PyTuple_GET_SIZE(args) > 0) SWIG_exception_fail(SWIG_TypeError, \"%s takes no arguments\");\n", iname);
|
||||
} else if (use_parse || allow_kwargs || !modernargs) {
|
||||
Printf(parse_args, ":%s\"", iname);
|
||||
Printv(parse_args, arglist, ")) SWIG_fail;\n", NIL);
|
||||
funpack = 0;
|
||||
} else {
|
||||
Clear(parse_args);
|
||||
if (funpack) {
|
||||
|
|
@ -3120,6 +3209,17 @@ public:
|
|||
}
|
||||
|
||||
/* If this is a builtin type, create a PyGetSetDef entry for this member variable. */
|
||||
if (builtin) {
|
||||
const char *memname = "__dict__";
|
||||
Hash *h = Getattr(builtin_getset, memname);
|
||||
if (!h) {
|
||||
h = NewHash();
|
||||
Setattr(builtin_getset, memname, h);
|
||||
Delete(h);
|
||||
}
|
||||
Setattr(h, "getter", "SwigPyObject_get___dict__");
|
||||
}
|
||||
|
||||
if (builtin_getter) {
|
||||
String *memname = Getattr(n, "membervariableHandler:sym:name");
|
||||
if (!memname)
|
||||
|
|
@ -3853,7 +3953,7 @@ public:
|
|||
else
|
||||
quoted_symname = NewStringf("\"%s\"", symname);
|
||||
}
|
||||
String *quoted_rname = NewStringf("\"%s\"", rname);
|
||||
String *quoted_tp_doc_str = NewStringf("\"%s\"", getSlot(n, "feature:python:tp_doc"));
|
||||
char const *tp_init = builtin_tp_init ? Char(builtin_tp_init) : Swig_directorclass(n) ? "0" : "SwigPyBuiltin_BadInit";
|
||||
String *tp_flags = NewString("Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_CHECKTYPES");
|
||||
String *py3_tp_flags = NewString("Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE");
|
||||
|
|
@ -3904,7 +4004,7 @@ public:
|
|||
printSlot(f, tp_doc, "tp_doc");
|
||||
Delete(tp_doc);
|
||||
} else {
|
||||
printSlot(f, quoted_rname, "tp_doc");
|
||||
printSlot(f, quoted_tp_doc_str, "tp_doc");
|
||||
}
|
||||
printSlot(f, getSlot(n, "feature:python:tp_traverse"), "tp_traverse", "traverseproc");
|
||||
printSlot(f, getSlot(n, "feature:python:tp_clear"), "tp_clear", "inquiry");
|
||||
|
|
@ -4088,7 +4188,7 @@ public:
|
|||
Delete(tp_flags);
|
||||
Delete(py3_tp_flags);
|
||||
Delete(quoted_symname);
|
||||
Delete(quoted_rname);
|
||||
Delete(quoted_tp_doc_str);
|
||||
Delete(clientdata_klass);
|
||||
Delete(richcompare_func);
|
||||
Delete(getset_name);
|
||||
|
|
@ -4183,7 +4283,18 @@ public:
|
|||
Printv(base_class, abcs, NIL);
|
||||
}
|
||||
|
||||
if (!builtin) {
|
||||
if (builtin) {
|
||||
if (have_docstring(n)) {
|
||||
String *str = cdocstring(n, AUTODOC_CLASS);
|
||||
Setattr(n, "feature:python:tp_doc", str);
|
||||
Delete(str);
|
||||
} else {
|
||||
String *name = Getattr(n, "name");
|
||||
String *rname = add_explicit_scope(SwigType_namestr(name));
|
||||
Setattr(n, "feature:python:tp_doc", rname);
|
||||
Delete(rname);
|
||||
}
|
||||
} else {
|
||||
Printv(f_shadow, "class ", class_name, NIL);
|
||||
|
||||
if (Len(base_class)) {
|
||||
|
|
@ -4462,7 +4573,7 @@ public:
|
|||
have_repr = 1;
|
||||
}
|
||||
if (Getattr(n, "feature:shadow")) {
|
||||
String *pycode = pythoncode(Getattr(n, "feature:shadow"), tab4);
|
||||
String *pycode = pythoncode(Getattr(n, "feature:shadow"), tab4, Getfile(n), Getline(n));
|
||||
String *pyaction = NewStringf("%s.%s", module, fullname);
|
||||
Replaceall(pycode, "$action", pyaction);
|
||||
Delete(pyaction);
|
||||
|
|
@ -4484,12 +4595,12 @@ public:
|
|||
Printv(f_shadow, tab8, docstring(n, AUTODOC_METHOD), "\n", NIL);
|
||||
if (have_pythonprepend(n)) {
|
||||
fproxy = 0;
|
||||
Printv(f_shadow, pythoncode(pythonprepend(n), tab8), "\n", NIL);
|
||||
Printv(f_shadow, pythoncode(pythonprepend(n), tab8, Getfile(n), Getline(n)), "\n", NIL);
|
||||
}
|
||||
if (have_pythonappend(n)) {
|
||||
fproxy = 0;
|
||||
Printv(f_shadow, tab8, "val = ", funcCall(fullname, callParms), "\n", NIL);
|
||||
Printv(f_shadow, pythoncode(pythonappend(n), tab8), "\n", NIL);
|
||||
Printv(f_shadow, pythoncode(pythonappend(n), tab8, Getfile(n), Getline(n)), "\n", NIL);
|
||||
Printv(f_shadow, tab8, "return val\n\n", NIL);
|
||||
} else {
|
||||
Printv(f_shadow, tab8, "return ", funcCall(fullname, callParms), "\n\n", NIL);
|
||||
|
|
@ -4569,10 +4680,10 @@ public:
|
|||
if (have_docstring(n))
|
||||
Printv(f_shadow, tab8, docstring(n, AUTODOC_STATICFUNC), "\n", NIL);
|
||||
if (have_pythonprepend(n))
|
||||
Printv(f_shadow, pythoncode(pythonprepend(n), tab8), "\n", NIL);
|
||||
Printv(f_shadow, pythoncode(pythonprepend(n), tab8, Getfile(n), Getline(n)), "\n", NIL);
|
||||
if (have_pythonappend(n)) {
|
||||
Printv(f_shadow, tab8, "val = ", funcCall(Swig_name_member(NSPACE_TODO, class_name, symname), callParms), "\n", NIL);
|
||||
Printv(f_shadow, pythoncode(pythonappend(n), tab8), "\n", NIL);
|
||||
Printv(f_shadow, pythoncode(pythonappend(n), tab8, Getfile(n), Getline(n)), "\n", NIL);
|
||||
Printv(f_shadow, tab8, "return val\n\n", NIL);
|
||||
} else {
|
||||
Printv(f_shadow, tab8, "return ", funcCall(Swig_name_member(NSPACE_TODO, class_name, symname), callParms), "\n\n", NIL);
|
||||
|
|
@ -4657,7 +4768,7 @@ public:
|
|||
if (!have_constructor && handled_as_init) {
|
||||
if (!builtin) {
|
||||
if (Getattr(n, "feature:shadow")) {
|
||||
String *pycode = pythoncode(Getattr(n, "feature:shadow"), tab4);
|
||||
String *pycode = pythoncode(Getattr(n, "feature:shadow"), tab4, Getfile(n), Getline(n));
|
||||
String *pyaction = NewStringf("%s.%s", module, Swig_name_construct(NSPACE_TODO, symname));
|
||||
Replaceall(pycode, "$action", pyaction);
|
||||
Delete(pyaction);
|
||||
|
|
@ -4686,17 +4797,17 @@ public:
|
|||
if (have_docstring(n))
|
||||
Printv(f_shadow, tab8, docstring(n, AUTODOC_CTOR), "\n", NIL);
|
||||
if (have_pythonprepend(n))
|
||||
Printv(f_shadow, pythoncode(pythonprepend(n), tab8), "\n", NIL);
|
||||
Printv(f_shadow, pythoncode(pythonprepend(n), tab8, Getfile(n), Getline(n)), "\n", NIL);
|
||||
Printv(f_shadow, pass_self, NIL);
|
||||
if (fastinit) {
|
||||
Printv(f_shadow, tab8, module, ".", class_name, "_swiginit(self,", funcCall(Swig_name_construct(NSPACE_TODO, symname), callParms), ")\n", NIL);
|
||||
Printv(f_shadow, tab8, module, ".", class_name, "_swiginit(self, ", funcCall(Swig_name_construct(NSPACE_TODO, symname), callParms), ")\n", NIL);
|
||||
} else {
|
||||
Printv(f_shadow,
|
||||
tab8, "this = ", funcCall(Swig_name_construct(NSPACE_TODO, symname), callParms), "\n",
|
||||
tab8, "try:\n", tab8, tab4, "self.this.append(this)\n", tab8, "except:\n", tab8, tab4, "self.this = this\n", NIL);
|
||||
}
|
||||
if (have_pythonappend(n))
|
||||
Printv(f_shadow, pythoncode(pythonappend(n), tab8), "\n\n", NIL);
|
||||
Printv(f_shadow, pythoncode(pythonappend(n), tab8, Getfile(n), Getline(n)), "\n\n", NIL);
|
||||
Delete(pass_self);
|
||||
}
|
||||
have_constructor = 1;
|
||||
|
|
@ -4705,7 +4816,7 @@ public:
|
|||
/* Hmmm. We seem to be creating a different constructor. We're just going to create a
|
||||
function for it. */
|
||||
if (Getattr(n, "feature:shadow")) {
|
||||
String *pycode = pythoncode(Getattr(n, "feature:shadow"), "");
|
||||
String *pycode = pythoncode(Getattr(n, "feature:shadow"), "", Getfile(n), Getline(n));
|
||||
String *pyaction = NewStringf("%s.%s", module, Swig_name_construct(NSPACE_TODO, symname));
|
||||
Replaceall(pycode, "$action", pyaction);
|
||||
Delete(pyaction);
|
||||
|
|
@ -4719,7 +4830,7 @@ public:
|
|||
if (have_docstring(n))
|
||||
Printv(f_shadow_stubs, tab4, docstring(n, AUTODOC_CTOR), "\n", NIL);
|
||||
if (have_pythonprepend(n))
|
||||
Printv(f_shadow_stubs, pythoncode(pythonprepend(n), tab4), "\n", NIL);
|
||||
Printv(f_shadow_stubs, pythoncode(pythonprepend(n), tab4, Getfile(n), Getline(n)), "\n", NIL);
|
||||
String *subfunc = NULL;
|
||||
/*
|
||||
if (builtin)
|
||||
|
|
@ -4732,7 +4843,7 @@ public:
|
|||
Printv(f_shadow_stubs, tab4, "val.thisown = 1\n", NIL);
|
||||
#endif
|
||||
if (have_pythonappend(n))
|
||||
Printv(f_shadow_stubs, pythoncode(pythonappend(n), tab4), "\n", NIL);
|
||||
Printv(f_shadow_stubs, pythoncode(pythonappend(n), tab4, Getfile(n), Getline(n)), "\n", NIL);
|
||||
Printv(f_shadow_stubs, tab4, "return val\n", NIL);
|
||||
Delete(subfunc);
|
||||
}
|
||||
|
|
@ -4769,7 +4880,7 @@ public:
|
|||
|
||||
if (shadow) {
|
||||
if (Getattr(n, "feature:shadow")) {
|
||||
String *pycode = pythoncode(Getattr(n, "feature:shadow"), tab4);
|
||||
String *pycode = pythoncode(Getattr(n, "feature:shadow"), tab4, Getfile(n), Getline(n));
|
||||
String *pyaction = NewStringf("%s.%s", module, Swig_name_destroy(NSPACE_TODO, symname));
|
||||
Replaceall(pycode, "$action", pyaction);
|
||||
Delete(pyaction);
|
||||
|
|
@ -4787,7 +4898,7 @@ public:
|
|||
if (have_docstring(n))
|
||||
Printv(f_shadow, tab8, docstring(n, AUTODOC_DTOR), "\n", NIL);
|
||||
if (have_pythonprepend(n))
|
||||
Printv(f_shadow, pythoncode(pythonprepend(n), tab8), "\n", NIL);
|
||||
Printv(f_shadow, pythoncode(pythonprepend(n), tab8, Getfile(n), Getline(n)), "\n", NIL);
|
||||
#ifdef USE_THISOWN
|
||||
Printv(f_shadow, tab8, "try:\n", NIL);
|
||||
Printv(f_shadow, tab8, tab4, "if self.thisown:", module, ".", Swig_name_destroy(NSPACE_TODO, symname), "(self)\n", NIL);
|
||||
|
|
@ -4795,7 +4906,7 @@ public:
|
|||
#else
|
||||
#endif
|
||||
if (have_pythonappend(n))
|
||||
Printv(f_shadow, pythoncode(pythonappend(n), tab8), "\n", NIL);
|
||||
Printv(f_shadow, pythoncode(pythonappend(n), tab8, Getfile(n), Getline(n)), "\n", NIL);
|
||||
Printv(f_shadow, tab8, "pass\n", NIL);
|
||||
Printv(f_shadow, "\n", NIL);
|
||||
}
|
||||
|
|
@ -4977,12 +5088,12 @@ public:
|
|||
|
||||
if (!ImportMode && (Cmp(section, "python") == 0 || Cmp(section, "shadow") == 0)) {
|
||||
if (shadow) {
|
||||
String *pycode = pythoncode(code, shadow_indent);
|
||||
String *pycode = pythoncode(code, shadow_indent, Getfile(n), Getline(n));
|
||||
Printv(f_shadow, pycode, NIL);
|
||||
Delete(pycode);
|
||||
}
|
||||
} else if (!ImportMode && (Cmp(section, "pythonbegin") == 0)) {
|
||||
String *pycode = pythoncode(code, "");
|
||||
String *pycode = pythoncode(code, "", Getfile(n), Getline(n));
|
||||
Printv(f_shadow_begin, pycode, NIL);
|
||||
Delete(pycode);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -281,6 +281,7 @@ public:
|
|||
|
||||
void dispatchFunction(Node *n);
|
||||
int functionWrapper(Node *n);
|
||||
int constantWrapper(Node *n);
|
||||
int variableWrapper(Node *n);
|
||||
|
||||
int classDeclaration(Node *n);
|
||||
|
|
@ -1381,12 +1382,12 @@ List * R::Swig_overload_rank(Node *n,
|
|||
}
|
||||
if ((!t1) && (!nodes[i].error)) {
|
||||
Swig_warning(WARN_TYPEMAP_TYPECHECK, Getfile(nodes[i].n), Getline(nodes[i].n),
|
||||
"Overloaded method %s not supported (no type checking rule for '%s').\n",
|
||||
"Overloaded method %s not supported (incomplete type checking rule - no precedence level in typecheck typemap for '%s').\n",
|
||||
Swig_name_decl(nodes[i].n), SwigType_str(Getattr(p1, "type"), 0));
|
||||
nodes[i].error = 1;
|
||||
} else if ((!t2) && (!nodes[j].error)) {
|
||||
Swig_warning(WARN_TYPEMAP_TYPECHECK, Getfile(nodes[j].n), Getline(nodes[j].n),
|
||||
"xx Overloaded method %s not supported (no type checking rule for '%s').\n",
|
||||
"Overloaded method %s not supported (incomplete type checking rule - no precedence level in typecheck typemap for '%s').\n",
|
||||
Swig_name_decl(nodes[j].n), SwigType_str(Getattr(p2, "type"), 0));
|
||||
nodes[j].error = 1;
|
||||
}
|
||||
|
|
@ -2181,6 +2182,16 @@ int R::functionWrapper(Node *n) {
|
|||
return SWIG_OK;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* R::constantWrapper()
|
||||
* ---------------------------------------------------------------------- */
|
||||
|
||||
int R::constantWrapper(Node *n) {
|
||||
(void) n;
|
||||
// TODO
|
||||
return SWIG_OK;
|
||||
}
|
||||
|
||||
/*****************************************************
|
||||
Add the specified routine name to the collection of
|
||||
generated routines that are called from R functions.
|
||||
|
|
|
|||
|
|
@ -13,14 +13,12 @@
|
|||
|
||||
#include "swigmod.h"
|
||||
#include "cparse.h"
|
||||
static int treduce = SWIG_cparse_template_reduce(0);
|
||||
|
||||
#define SWIG_PROTECTED_TARGET_METHODS 1
|
||||
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <limits.h> /* for INT_MAX */
|
||||
|
||||
#define SWIG_PROTECTED_TARGET_METHODS 1
|
||||
|
||||
class RClass {
|
||||
private:
|
||||
String *temp;
|
||||
|
|
@ -1171,6 +1169,7 @@ public:
|
|||
|
||||
if (directorsEnabled()) {
|
||||
// Insert director runtime into the f_runtime file (make it occur before %header section)
|
||||
Swig_insert_file("director_common.swg", f_runtime);
|
||||
Swig_insert_file("director.swg", f_runtime);
|
||||
}
|
||||
|
||||
|
|
@ -1794,8 +1793,8 @@ public:
|
|||
|
||||
/* if the object is a director, and the method call originated from its
|
||||
* underlying Ruby object, resolve the call by going up the c++
|
||||
* inheritance chain. otherwise try to resolve the method in python.
|
||||
* without this check an infinite loop is set up between the director and
|
||||
* inheritance chain. otherwise try to resolve the method in Ruby.
|
||||
* without this check an infinite loop is set up between the director and
|
||||
* shadow class method calls.
|
||||
*/
|
||||
|
||||
|
|
|
|||
|
|
@ -346,14 +346,18 @@ public:
|
|||
emit_attach_parmmaps(functionParamsList, wrapper);
|
||||
Setattr(node, "wrap:parms", functionParamsList);
|
||||
|
||||
/* Check arguments */
|
||||
/* Check input/output arguments count */
|
||||
int maxInputArguments = emit_num_arguments(functionParamsList);
|
||||
int minInputArguments = emit_num_required(functionParamsList);
|
||||
int minOutputArguments = 0;
|
||||
int maxOutputArguments = 0;
|
||||
|
||||
/* Insert calls to CheckInputArgument and CheckOutputArgument */
|
||||
Printf(wrapper->code, "SWIG_CheckInputArgument(pvApiCtx, $mininputarguments, $maxinputarguments);\n");
|
||||
if (!emit_isvarargs(functionParamsList)) {
|
||||
Printf(wrapper->code, "SWIG_CheckInputArgument(pvApiCtx, $mininputarguments, $maxinputarguments);\n");
|
||||
}
|
||||
else {
|
||||
Printf(wrapper->code, "SWIG_CheckInputArgumentAtLeast(pvApiCtx, $mininputarguments-1);\n");
|
||||
}
|
||||
Printf(wrapper->code, "SWIG_CheckOutputArgument(pvApiCtx, $minoutputarguments, $maxoutputarguments);\n");
|
||||
|
||||
/* Set context */
|
||||
|
|
@ -675,7 +679,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
/* Create variables for member pointer constants, not suppported by typemaps (like Python wrapper does) */
|
||||
/* Create variables for member pointer constants, not supported by typemaps (like Python wrapper does) */
|
||||
if (SwigType_type(type) == T_MPOINTER) {
|
||||
String *wname = Swig_name_wrapper(constantName);
|
||||
String *str = SwigType_str(type, wname);
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@
|
|||
|
||||
#include "swigmod.h"
|
||||
#include "cparse.h"
|
||||
static int treduce = SWIG_cparse_template_reduce(0);
|
||||
|
||||
static const char *usage = "\
|
||||
Tcl 8 Options (available with -tcl)\n\
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue