Merge branch 'jiulongw-master'

* jiulongw-master:
  Fix go wrapper compilation error
  Fix missing semicolon in golang wrapper
  Fix extra quote escape in golang
  Fix #define error when value contains char in compound expression
  Add more test case for char const expression in enum
  Revert "Add enum test cases with const char in compound expression"
  Add runtime tests for char in compound expression patch
  Add enum test cases with const char in compound expression
  Fix enum error when value contains char in compound expression
This commit is contained in:
William S Fulton 2016-10-23 10:32:48 +01:00
commit f89b8836dd
6 changed files with 82 additions and 42 deletions

View file

@ -2809,29 +2809,39 @@ private:
String *get = NewString("");
Printv(get, Swig_cresult_name(), " = ", NULL);
char quote;
if (Getattr(n, "wrappedasconstant")) {
quote = '\0';
} else if (SwigType_type(type) == T_CHAR) {
quote = '\'';
} else if (SwigType_type(type) == T_STRING) {
Printv(get, "(char *)", NULL);
quote = '"';
String *rawval = Getattr(n, "rawval");
if (rawval && Len(rawval)) {
if (SwigType_type(type) == T_STRING) {
Printv(get, "(char *)", NULL);
}
Printv(get, rawval, NULL);
} else {
quote = '\0';
}
char quote;
if (Getattr(n, "wrappedasconstant")) {
quote = '\0';
} else if (SwigType_type(type) == T_CHAR) {
quote = '\'';
} else if (SwigType_type(type) == T_STRING) {
Printv(get, "(char *)", NULL);
quote = '"';
} else {
quote = '\0';
}
if (quote != '\0') {
Printf(get, "%c", quote);
}
if (quote != '\0') {
Printf(get, "%c", quote);
}
Printv(get, Getattr(n, "value"), NULL);
Printv(get, Getattr(n, "value"), NULL);
if (quote != '\0') {
Printf(get, "%c", quote);
if (quote != '\0') {
Printf(get, "%c", quote);
}
}
Printv(get, ";\n", NULL);
Setattr(n, "wrap:action", get);
String *sname = Copy(symname);