Ensure -c++out is not used with -c++

Error checking for this combination implemented as well as correcting
Octave

Also refactor, replacing CPlusPlusOut variable with cparse_cplusplusout
for an implementation which more closely resembles cparse_cplusplus which
is also required in both .c and .cxx files.
This commit is contained in:
William S Fulton 2013-12-12 20:44:08 +00:00
commit 2121e1217e
8 changed files with 30 additions and 14 deletions

View file

@ -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);

View file

@ -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()
*

View file

@ -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;