Guile - fix generated code for static const char member variables when defined and declared inline.
This commit is contained in:
parent
2947b711d9
commit
37bd50ddf9
2 changed files with 9 additions and 15 deletions
|
|
@ -5,6 +5,10 @@ See the RELEASENOTES file for a summary of changes in each release.
|
|||
Version 3.0.6 (in progress)
|
||||
===========================
|
||||
|
||||
2015-02-09: wsfulton
|
||||
[Guile] Fix generated code for static const char member variables when
|
||||
defined and declared inline.
|
||||
|
||||
2015-02-05: ianlancetaylor
|
||||
[Go] Ignore Go specific type maps (goin, goout, etc.) if they are empty.
|
||||
|
||||
|
|
|
|||
|
|
@ -1300,13 +1300,13 @@ public:
|
|||
char *name = GetChar(n, "name");
|
||||
char *iname = GetChar(n, "sym:name");
|
||||
SwigType *type = Getattr(n, "type");
|
||||
String *value = Getattr(n, "value");
|
||||
String *rawval = Getattr(n, "rawval");
|
||||
String *value = rawval ? rawval : Getattr(n, "value");
|
||||
int constasvar = GetFlag(n, "feature:constasvar");
|
||||
|
||||
|
||||
String *proc_name;
|
||||
String *var_name;
|
||||
String *rvalue;
|
||||
Wrapper *f;
|
||||
SwigType *nctype;
|
||||
String *tm;
|
||||
|
|
@ -1334,23 +1334,14 @@ 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 && !is_enum_item) {
|
||||
rvalue = NewStringf("\'%s\'", value);
|
||||
} else {
|
||||
rvalue = NewString(value);
|
||||
}
|
||||
|
||||
if ((tm = Swig_typemap_lookup("constant", n, name, 0))) {
|
||||
Replaceall(tm, "$source", rvalue);
|
||||
Replaceall(tm, "$value", rvalue);
|
||||
Replaceall(tm, "$source", value);
|
||||
Replaceall(tm, "$value", value);
|
||||
Replaceall(tm, "$target", name);
|
||||
Printv(f_header, tm, "\n", NIL);
|
||||
} else {
|
||||
// Create variable and assign it a value
|
||||
Printf(f_header, "static %s = (%s)(%s);\n", SwigType_str(type, var_name), SwigType_str(type, 0), rvalue);
|
||||
Printf(f_header, "static %s = (%s)(%s);\n", SwigType_str(type, var_name), SwigType_str(type, 0), value);
|
||||
}
|
||||
{
|
||||
/* Hack alert: will cleanup later -- Dave */
|
||||
|
|
@ -1370,7 +1361,6 @@ public:
|
|||
Delete(var_name);
|
||||
Delete(nctype);
|
||||
Delete(proc_name);
|
||||
Delete(rvalue);
|
||||
DelWrapper(f);
|
||||
return SWIG_OK;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue