From 118ae4d9ba749c8b9df97e490e9f60c38459e7f9 Mon Sep 17 00:00:00 2001 From: Dave Beazley Date: Tue, 11 Feb 2003 21:31:54 +0000 Subject: [PATCH] More fixes. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4299 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/Preprocessor/cpp.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/Source/Preprocessor/cpp.c b/Source/Preprocessor/cpp.c index b2c4f9a34..cd1f6105f 100644 --- a/Source/Preprocessor/cpp.c +++ b/Source/Preprocessor/cpp.c @@ -590,8 +590,22 @@ expand_macro(String_or_char *name, List *args) Clear(tempa); Printf(temp,"\001%s", aname); Printf(tempa,"\"%s\"",arg); - Replace(ns, temp, tempa, DOH_REPLACE_ANY); + Replace(ns, temp, tempa, DOH_REPLACE_ID_END); } + if (strstr(Char(ns),"\002")) { + /* Look for concatenation tokens */ + Clear(temp); + Clear(tempa); + Printf(temp,"\002%s",aname); + Append(tempa,"\002\003"); + Replace(ns, temp, tempa, DOH_REPLACE_ID_END); + Clear(temp); + Clear(tempa); + Printf(temp,"%s\002",aname); + Append(tempa,"\003\002"); + Replace(ns,temp,tempa, DOH_REPLACE_ID_BEGIN); + } + /* Non-standard macro expansion. The value `x` is replaced by a quoted version of the argument except that if the argument is already quoted nothing happens */ @@ -633,8 +647,8 @@ expand_macro(String_or_char *name, List *args) } } /* Replace(ns, aname, arg, DOH_REPLACE_ID); */ - Replace(ns, aname, reparg, DOH_REPLACE_ID); - /* Replace(ns, "\003", arg, DOH_REPLACE_ANY);*/ + Replace(ns, aname, reparg, DOH_REPLACE_ID); /* Replace expanded args */ + Replace(ns, "\003", arg, DOH_REPLACE_ANY); /* Replace unexpanded arg */ Delete(reparg); } }