Convert character and string literals to CL syntax.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@6015 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
d1ba207f00
commit
d4f8df729f
1 changed files with 11 additions and 2 deletions
|
|
@ -57,7 +57,7 @@ String *strip_parens(String *string) {
|
|||
}
|
||||
|
||||
|
||||
String *convert_number(String *num_param, String *type) {
|
||||
String *convert_literal(String *num_param, String *type) {
|
||||
String *num=strip_parens(num_param), *res;
|
||||
char *s=Char(num);
|
||||
|
||||
|
|
@ -71,6 +71,15 @@ String *convert_number(String *num_param, String *type) {
|
|||
Delete(num);
|
||||
return updated;
|
||||
}
|
||||
|
||||
if (SwigType_type(type) == T_CHAR) {
|
||||
/* Use CL syntax for character literals */
|
||||
return NewStringf("#\\%s", num_param);
|
||||
}
|
||||
else if (SwigType_type(type) == T_STRING) {
|
||||
/* Use CL syntax for string literals */
|
||||
return NewStringf("\"%s\"", num_param);
|
||||
}
|
||||
|
||||
if (Len(num) < 2 || s[0] != '0') {
|
||||
return num;
|
||||
|
|
@ -323,7 +332,7 @@ int ALLEGROCL :: functionWrapper(Node *n) {
|
|||
|
||||
int ALLEGROCL :: constantWrapper(Node *n) {
|
||||
String *type=Getattr(n, "type");
|
||||
String *converted_value=convert_number(Getattr(n, "value"), type);
|
||||
String *converted_value=convert_literal(Getattr(n, "value"), type);
|
||||
String *name=Getattr(n, "sym:name");
|
||||
|
||||
#if 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue