From d4f8df729f449bb9aff27626977aa73a014a7175 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20K=C3=B6ppe?= Date: Wed, 7 Jul 2004 16:54:11 +0000 Subject: [PATCH] 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 --- SWIG/Source/Modules/allegrocl.cxx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/SWIG/Source/Modules/allegrocl.cxx b/SWIG/Source/Modules/allegrocl.cxx index 76fab1249..f399b8b0b 100644 --- a/SWIG/Source/Modules/allegrocl.cxx +++ b/SWIG/Source/Modules/allegrocl.cxx @@ -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