diff options
Diffstat (limited to 'Source/CParse')
-rw-r--r-- | Source/CParse/cparse.h | 2 | ||||
-rw-r--r-- | Source/CParse/cscanner.c | 11 | ||||
-rw-r--r-- | Source/CParse/parser.y | 5 |
3 files changed, 15 insertions, 3 deletions
diff --git a/Source/CParse/cparse.h b/Source/CParse/cparse.h index 19bf3f3f0..6d7342a45 100644 --- a/Source/CParse/cparse.h +++ b/Source/CParse/cparse.h @@ -25,9 +25,11 @@ extern "C" { extern String *cparse_file; extern int cparse_line; extern int cparse_cplusplus; + extern int cparse_cplusplusout; extern int cparse_start_line; extern void Swig_cparse_cplusplus(int); + extern void Swig_cparse_cplusplusout(int); extern void scanner_file(File *); extern void scanner_next_token(int); extern void skip_balanced(int startchar, int endchar); diff --git a/Source/CParse/cscanner.c b/Source/CParse/cscanner.c index ee2c49cd4..2dfc2c479 100644 --- a/Source/CParse/cscanner.c +++ b/Source/CParse/cscanner.c @@ -37,6 +37,9 @@ int cparse_start_line = 0; /* C++ mode */ int cparse_cplusplus = 0; +/* Generate C++ compatible code when wrapping C code */ +int cparse_cplusplusout = 0; + /* Private vars */ static int scan_init = 0; static int num_brace = 0; @@ -52,6 +55,14 @@ void Swig_cparse_cplusplus(int v) { cparse_cplusplus = v; } +/* ----------------------------------------------------------------------------- + * Swig_cparse_cplusplusout() + * ----------------------------------------------------------------------------- */ + +void Swig_cparse_cplusplusout(int v) { + cparse_cplusplusout = v; +} + /* ---------------------------------------------------------------------------- * scanner_init() * diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y index 8e34833e2..9b1cec387 100644 --- a/Source/CParse/parser.y +++ b/Source/CParse/parser.y @@ -59,7 +59,6 @@ static int extendmode = 0; static int compact_default_args = 0; static int template_reduce = 0; static int cparse_externc = 0; -extern int CPlusPlusOut; /* ----------------------------------------------------------------------------- * Assist Functions @@ -3446,7 +3445,7 @@ cpp_class_decl : storage_class cpptype idcolon inherit LBRACE { Delete(prefix); inclass = 1; currentOuterClass = $<node>$; - if (CPlusPlusOut) { + if (cparse_cplusplusout) { /* save the structure declaration to declare it in global scope for C++ to see */ code = get_raw_text_balanced('{', '}'); Setattr($<node>$, "code", code); @@ -3577,7 +3576,7 @@ cpp_class_decl : storage_class cpptype idcolon inherit LBRACE { Namespaceprefix = Swig_symbol_qualifiedscopename(0); yyrename = Copy(Getattr($<node>$, "class_rename")); add_symbols($$); - if (!CPlusPlusOut) + if (!cparse_cplusplusout) Delattr($$, "nested:outer"); Delattr($$, "class_rename"); $$ = 0; |