Merge branch 'master' into directorargout_and_java_typemaps

This commit is contained in:
Andrey Starodubtsev 2016-08-05 11:20:01 +03:00
commit c7adb7901d
68 changed files with 568 additions and 462 deletions

View file

@ -188,8 +188,12 @@ public:
String *symname = Copy(Getattr(n, "sym:name"));
if (symname && !GetFlag(n, "feature:flatnested")) {
for (Node *outer_class = Getattr(n, "nested:outer"); outer_class; outer_class = Getattr(outer_class, "nested:outer")) {
Push(symname, ".");
Push(symname, Getattr(outer_class, "sym:name"));
if (String* name = Getattr(outer_class, "sym:name")) {
Push(symname, ".");
Push(symname, name);
}
else
return NULL;
}
}
if (nspace) {

View file

@ -4176,7 +4176,6 @@ private:
Wrapper *dummy = NewWrapper();
emit_attach_parmmaps(parms, dummy);
DelWrapper(dummy);
Swig_typemap_attach_parms("gotype", parms, NULL);
Swig_typemap_attach_parms("imtype", parms, NULL);
@ -4233,6 +4232,8 @@ private:
Swig_typemap_attach_parms("goin", parms, dummy);
Swig_typemap_attach_parms("goargout", parms, dummy);
DelWrapper(dummy);
if (!is_ignored) {
// We use an interface to see if this method is defined in Go.
Printv(f_go_wrappers, "type ", interface_name, " interface {\n", NULL);

View file

@ -210,10 +210,14 @@ public:
String *nspace = Getattr(n, "sym:nspace");
String *symname = Copy(Getattr(n, "sym:name"));
if (symname && !GetFlag(n, "feature:flatnested")) {
for (Node *outer_class = Getattr(n, "nested:outer"); outer_class; outer_class = Getattr(outer_class, "nested:outer")) {
Push(symname, jnidescriptor ? "$" : ".");
Push(symname, Getattr(outer_class, "sym:name"));
}
for (Node *outer_class = Getattr(n, "nested:outer"); outer_class; outer_class = Getattr(outer_class, "nested:outer")) {
if (String* name = Getattr(outer_class, "sym:name")) {
Push(symname, jnidescriptor ? "$" : ".");
Push(symname, name);
}
else
return NULL;
}
}
if (nspace) {
if (package && !jnidescriptor)

View file

@ -856,6 +856,9 @@ public:
//Printf(stdout,"Swig_overload_dispatch %s %s '%s' %d\n",symname,wname,dispatch,maxargs);
if (!luaAddSymbol(lua_name, n)) {
DelWrapper(f);
Delete(dispatch);
Delete(tmp);
return SWIG_ERROR;
}

View file

@ -433,6 +433,7 @@ String *Swig_overload_dispatch_cast(Node *n, const_String_or_char_ptr fmt, int *
int fn = 0;
Node *ni = Getitem(dispatch, i);
Parm *pi = Getattr(ni, "wrap:parms");
bool implicitconvtypecheckoff = GetFlag(ni, "implicitconvtypecheckoff") != 0;
int num_required = emit_num_required(pi);
int num_arguments = emit_num_arguments(pi);
if (num_arguments > *maxargs)
@ -476,6 +477,7 @@ String *Swig_overload_dispatch_cast(Node *n, const_String_or_char_ptr fmt, int *
String *tm = Getattr(pj, "tmap:typecheck");
if (tm) {
tm = Copy(tm);
/* normalise for comparison later */
Replaceid(tm, Getattr(pj, "lname"), "_v");
@ -528,13 +530,14 @@ String *Swig_overload_dispatch_cast(Node *n, const_String_or_char_ptr fmt, int *
String *tmp = NewStringf(argv_template_string, j);
String *conv = Getattr(pj, "implicitconv");
if (conv) {
if (conv && !implicitconvtypecheckoff) {
Replaceall(tm, "$implicitconv", conv);
} else {
Replaceall(tm, "$implicitconv", "0");
}
Replaceall(tm, "$input", tmp);
Printv(f, "{\n", tm, "}\n", NIL);
Delete(tm);
fn = i + 1;
Printf(f, "if (!_v) goto check_%d;\n", fn);
Printf(f, "_ranki += _v*_pi;\n");
@ -574,6 +577,9 @@ String *Swig_overload_dispatch_cast(Node *n, const_String_or_char_ptr fmt, int *
if (fn)
Printf(f, "check_%d:\n\n", fn);
if (implicitconvtypecheckoff)
Delattr(ni, "implicitconvtypecheckoff");
Delete(lfmt);
Delete(coll);
}
@ -607,6 +613,7 @@ String *Swig_overload_dispatch_fast(Node *n, const_String_or_char_ptr fmt, int *
int fn = 0;
Node *ni = Getitem(dispatch, i);
Parm *pi = Getattr(ni, "wrap:parms");
bool implicitconvtypecheckoff = GetFlag(ni, "implicitconvtypecheckoff") != 0;
int num_required = emit_num_required(pi);
int num_arguments = emit_num_arguments(pi);
if (num_arguments > *maxargs)
@ -646,6 +653,7 @@ String *Swig_overload_dispatch_fast(Node *n, const_String_or_char_ptr fmt, int *
String *tm = Getattr(pj, "tmap:typecheck");
if (tm) {
tm = Copy(tm);
/* normalise for comparison later */
Replaceid(tm, Getattr(pj, "lname"), "_v");
@ -699,13 +707,14 @@ String *Swig_overload_dispatch_fast(Node *n, const_String_or_char_ptr fmt, int *
String *tmp = NewStringf(argv_template_string, j);
String *conv = Getattr(pj, "implicitconv");
if (conv) {
if (conv && !implicitconvtypecheckoff) {
Replaceall(tm, "$implicitconv", conv);
} else {
Replaceall(tm, "$implicitconv", "0");
}
Replaceall(tm, "$input", tmp);
Printv(f, "{\n", tm, "}\n", NIL);
Delete(tm);
fn = i + 1;
Printf(f, "if (!_v) goto check_%d;\n", fn);
}
@ -737,6 +746,9 @@ String *Swig_overload_dispatch_fast(Node *n, const_String_or_char_ptr fmt, int *
if (fn)
Printf(f, "check_%d:\n\n", fn);
if (implicitconvtypecheckoff)
Delattr(ni, "implicitconvtypecheckoff");
Delete(lfmt);
Delete(coll);
}

View file

@ -326,6 +326,7 @@ public:
bool isLastOverloaded = isOverloaded && !Getattr(node, "sym:nextSibling");
if (!isOverloaded && !addSymbol(functionName, node)) {
DelWrapper(wrapper);
return SWIG_ERROR;
}
@ -633,7 +634,10 @@ public:
/* Add function to builder table */
addFunctionToScilab(scilabSetFunctionName, setFunctionName);
DelWrapper(setFunctionWrapper);
}
DelWrapper(getFunctionWrapper);
return SWIG_OK;
}
@ -660,7 +664,7 @@ public:
if (isConstant || isEnum) {
if (isEnum) {
Setattr(node, "type", "double");
constantValue = Getattr(node, "enumvalue");
constantValue = Getattr(node, "value");
}
constantTypemap = Swig_typemap_lookup("scilabconstcode", node, nodeName, 0);
@ -1026,7 +1030,7 @@ public:
Printf(gatewayHeaderV5, ",\n");
Printf(gatewayHeaderV5, " {(Myinterfun)sci_gateway, (GT)%s, (char *)\"%s\"}", wrapperFunctionName, scilabFunctionName);
Printf(gatewayHeaderV6, "if (wcscmp(pwstFuncName, L\"%s\") == 0) { addCFunction((wchar_t *)L\"%s\", &%s, (wchar_t *)MODULE_NAME); }\n", scilabFunctionName, scilabFunctionName, wrapperFunctionName);
Printf(gatewayHeaderV6, "if (wcscmp(pwstFuncName, L\"%s\") == 0) { addCStackFunction((wchar_t *)L\"%s\", &%s, (wchar_t *)MODULE_NAME); }\n", scilabFunctionName, scilabFunctionName, wrapperFunctionName);
}
/* -----------------------------------------------------------------------

View file

@ -265,7 +265,13 @@ class TypePass:private Dispatcher {
SwigType *bsmart = Copy(smart);
SwigType *rclsname = SwigType_typedef_resolve_all(clsname);
SwigType *rbname = SwigType_typedef_resolve_all(bname);
Replaceall(bsmart, rclsname, rbname);
int replace_count = Replaceall(bsmart, rclsname, rbname);
if (replace_count == 0) {
// If no replacement made, it will be because rclsname is fully resolved, but the
// type in the smartptr feature used a typedef or not fully resolved name.
String *firstname = Getattr(first, "name");
Replaceall(bsmart, firstname, rbname);
}
Delete(rclsname);
Delete(rbname);
String *smartnamestr = SwigType_namestr(smart);

View file

@ -81,9 +81,11 @@ public:
virtual int top(Node *n) {
if (out == 0) {
String *outfile = Getattr(n, "outfile");
Replaceall(outfile, ".cxx", ".xml");
Replaceall(outfile, ".cpp", ".xml");
Replaceall(outfile, ".c", ".xml");
String *ext = Swig_file_extension(outfile);
// If there's an extension, ext will include the ".".
Delslice(outfile, Len(outfile) - Len(ext), DOH_END);
Delete(ext);
Append(outfile, ".xml");
out = NewFile(outfile, "w", SWIG_output_files());
if (!out) {
FileErrorDisplay(outfile);