Renamining
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@102 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
230231d91f
commit
cc85906a83
3 changed files with 124 additions and 126 deletions
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
static char cvsroot[] = "$Header$";
|
||||
|
||||
#include "swigcpp.h"
|
||||
#include "preprocessor.h"
|
||||
#include <ctype.h>
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
|
|
@ -42,7 +42,7 @@ static DOH *included_files = 0;
|
|||
|
||||
/* Handle an error */
|
||||
|
||||
void cpp_error(DOH *file, int line, char *fmt, ...) {
|
||||
static void cpp_error(DOH *file, int line, char *fmt, ...) {
|
||||
va_list ap;
|
||||
if (silent_errors) return;
|
||||
va_start(ap,fmt);
|
||||
|
|
@ -109,7 +109,7 @@ static DOH *cpp_include(DOH *fn) {
|
|||
if (Getattr(included_files,fn)) return 0;
|
||||
Setattr(included_files,fn,fn);
|
||||
}
|
||||
s = SWIG_include(fn);
|
||||
s = Swig_include(fn);
|
||||
if (!s) {
|
||||
Seek(fn,0,SEEK_SET);
|
||||
cpp_error(Getfile(fn),Getline(fn),"Unable to find '%s'\n", fn);
|
||||
|
|
@ -120,31 +120,31 @@ static DOH *cpp_include(DOH *fn) {
|
|||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* void SWIG_cpp_init() - Initialize the preprocessor
|
||||
* void Preprocessor_cpp_init() - Initialize the preprocessor
|
||||
* ----------------------------------------------------------------------------- */
|
||||
void SWIG_cpp_init() {
|
||||
void Preprocessor_init() {
|
||||
DOH *s;
|
||||
cpp = NewHash();
|
||||
s = NewHash();
|
||||
Setattr(cpp,"symbols",s);
|
||||
SWIG_expr_init(); /* Initialize the expression evaluator */
|
||||
Preprocessor_expr_init(); /* Initialize the expression evaluator */
|
||||
included_files = NewHash();
|
||||
}
|
||||
/* -----------------------------------------------------------------------------
|
||||
* void SWIG_cpp_include_all() - Instruct preprocessor to include all files
|
||||
* void Preprocessor_include_all() - Instruct preprocessor to include all files
|
||||
* ----------------------------------------------------------------------------- */
|
||||
void SWIG_cpp_include_all(int a) {
|
||||
void Preprocessor_include_all(int a) {
|
||||
include_all = a;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* DOH *SWIG_cpp_define(DOH *str, int swigmacro)
|
||||
* DOH *Preprocessor_define(DOH *str, int swigmacro)
|
||||
*
|
||||
* Defines a new C preprocessor symbol. swigmacro specifies whether or not the macro has
|
||||
* SWIG macro semantics.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
DOH *SWIG_cpp_define(DOH *str, int swigmacro)
|
||||
DOH *Preprocessor_define(DOH *str, int swigmacro)
|
||||
{
|
||||
DOH *macroname = 0, *argstr = 0, *macrovalue = 0, *arglist = 0, *macro = 0, *symbols = 0, *file = 0, *s, *m1;
|
||||
int c, line;
|
||||
|
|
@ -261,11 +261,11 @@ macro_error:
|
|||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* void SWIG_cpp_undef(DOH *str)
|
||||
* void Preprocessor_undef(DOH *str)
|
||||
*
|
||||
* Undefines a macro.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
void SWIG_cpp_undef(DOH *str)
|
||||
void Preprocessor_undef(DOH *str)
|
||||
{
|
||||
DOH *symbols;
|
||||
assert(cpp);
|
||||
|
|
@ -384,12 +384,12 @@ get_filename(DOH *str) {
|
|||
|
||||
DOH *expanded_value = 0;
|
||||
|
||||
DOH *
|
||||
static DOH *
|
||||
expand_macro(DOH *name, DOH *args)
|
||||
{
|
||||
DOH *symbols, *ns, *macro, *margs, *mvalue, *temp, *tempa, *e;
|
||||
DOH *swig_cpp_replace(DOH *);
|
||||
DOH *SWIG_cpp_parse(DOH *);
|
||||
DOH *Preprocessor_replace(DOH *);
|
||||
DOH *Preprocessor_parse(DOH *);
|
||||
int i, l;
|
||||
|
||||
symbols = Getattr(cpp,"symbols");
|
||||
|
|
@ -464,7 +464,7 @@ expand_macro(DOH *name, DOH *args)
|
|||
Replace(ns,"\001","#",DOH_REPLACE_ANY); /* Put # back (non-standard C) */
|
||||
|
||||
/* Expand this macro even further */
|
||||
e = swig_cpp_replace(ns);
|
||||
e = Preprocessor_replace(ns);
|
||||
Delattr(macro,"*expanded*");
|
||||
if (Getattr(macro,"swigmacro")) {
|
||||
DOH *g;
|
||||
|
|
@ -472,7 +472,7 @@ expand_macro(DOH *name, DOH *args)
|
|||
Printf(f,"%%macro %s, \"%s\", %d {\n", name, Getfile(macro), Getline(macro));
|
||||
Seek(e,0,SEEK_SET);
|
||||
copy_location(macro,e);
|
||||
g = SWIG_cpp_parse(e);
|
||||
g = Preprocessor_parse(e);
|
||||
Printf(f,"%s\n", g);
|
||||
Printf(f,"}\n");
|
||||
e = f;
|
||||
|
|
@ -481,7 +481,7 @@ expand_macro(DOH *name, DOH *args)
|
|||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* DOH *swig_cpp_replace(DOH *s)
|
||||
* DOH *Preprocessor_replace(DOH *s)
|
||||
*
|
||||
* Performs a macro substitution on a string s. Returns a new string with
|
||||
* substitutions applied. This function works by walking down s and looking
|
||||
|
|
@ -490,7 +490,7 @@ expand_macro(DOH *name, DOH *args)
|
|||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
DOH *
|
||||
swig_cpp_replace(DOH *s)
|
||||
Preprocessor_replace(DOH *s)
|
||||
{
|
||||
DOH *ns, *id, *symbols, *m;
|
||||
int c, i, state = 0;
|
||||
|
|
@ -727,7 +727,7 @@ static void add_chunk(DOH *ns, DOH *chunk, int allow) {
|
|||
DOH *echunk;
|
||||
Seek(chunk,0,SEEK_SET);
|
||||
if (allow) {
|
||||
echunk = swig_cpp_replace(chunk);
|
||||
echunk = Preprocessor_replace(chunk);
|
||||
addline(ns,echunk,allow);
|
||||
Delete(echunk);
|
||||
} else {
|
||||
|
|
@ -737,7 +737,7 @@ static void add_chunk(DOH *ns, DOH *chunk, int allow) {
|
|||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* DOH *SWIG_cpp_parse(DOH *s)
|
||||
* DOH *Preprocessor_parse(DOH *s)
|
||||
*
|
||||
* Parses the string s. Returns a new string containing the preprocessed version.
|
||||
*
|
||||
|
|
@ -750,7 +750,7 @@ static void add_chunk(DOH *ns, DOH *chunk, int allow) {
|
|||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
DOH *
|
||||
SWIG_cpp_parse(DOH *s)
|
||||
Preprocessor_parse(DOH *s)
|
||||
{
|
||||
DOH *ns; /* New string containing the preprocessed text */
|
||||
DOH *chunk, *symbols, *sval, *decl;
|
||||
|
|
@ -936,12 +936,12 @@ SWIG_cpp_parse(DOH *s)
|
|||
if (allow) {
|
||||
DOH *m, *v, *v1;
|
||||
Seek(value,0,SEEK_SET);
|
||||
m = SWIG_cpp_define(value,0);
|
||||
m = Preprocessor_define(value,0);
|
||||
if ((m) && !(Getattr(m,"args"))) {
|
||||
v = Copy(Getattr(m,"value"));
|
||||
if (Len(v)) {
|
||||
silent_errors = 1;
|
||||
v1 = swig_cpp_replace(v);
|
||||
v1 = Preprocessor_replace(v);
|
||||
silent_errors = 0;
|
||||
if (!check_id(v1)) {
|
||||
if (Len(comment) == 0)
|
||||
|
|
@ -954,7 +954,7 @@ SWIG_cpp_parse(DOH *s)
|
|||
}
|
||||
}
|
||||
} else if (Cmp(id,"undef") == 0) {
|
||||
if (allow) SWIG_cpp_undef(value);
|
||||
if (allow) Preprocessor_undef(value);
|
||||
} else if (Cmp(id,"ifdef") == 0) {
|
||||
cond_lines[level] = Getline(id);
|
||||
level++;
|
||||
|
|
@ -996,9 +996,9 @@ SWIG_cpp_parse(DOH *s)
|
|||
level++;
|
||||
if (allow) {
|
||||
start_level = level;
|
||||
sval = swig_cpp_replace(value);
|
||||
sval = Preprocessor_replace(value);
|
||||
Seek(sval,0,SEEK_SET);
|
||||
val = SWIG_expr(sval,&e);
|
||||
val = Preprocessor_expr(sval,&e);
|
||||
if (e) {
|
||||
Seek(value,0,SEEK_SET);
|
||||
/* cpp_error(Getfile(value),Getline(value),"Could not evaluate '%s'\n", value); */
|
||||
|
|
@ -1018,9 +1018,9 @@ SWIG_cpp_parse(DOH *s)
|
|||
allow = 0;
|
||||
mask = 0;
|
||||
} else if (level == start_level) {
|
||||
sval = swig_cpp_replace(value);
|
||||
sval = Preprocessor_replace(value);
|
||||
Seek(sval,0,SEEK_SET);
|
||||
val = SWIG_expr(sval,&e);
|
||||
val = Preprocessor_expr(sval,&e);
|
||||
if (e) {
|
||||
Seek(value,0,SEEK_SET);
|
||||
/* cpp_error(Getfile(value),Getline(value),"Could not evaluate '%s'\n", value); */
|
||||
|
|
@ -1041,8 +1041,8 @@ SWIG_cpp_parse(DOH *s)
|
|||
fn = get_filename(value);
|
||||
s1 = cpp_include(fn);
|
||||
if (s1) {
|
||||
Printf(ns,"%%includefile \"%s\" {\n", SWIG_last_file());
|
||||
s2 = SWIG_cpp_parse(s1);
|
||||
Printf(ns,"%%includefile \"%s\" {\n", Swig_last_file());
|
||||
s2 = Preprocessor_parse(s1);
|
||||
addline(ns,s2,allow);
|
||||
Printf(ns,"\n}\n");
|
||||
Delete(s2);
|
||||
|
|
@ -1114,13 +1114,13 @@ SWIG_cpp_parse(DOH *s)
|
|||
if (s1) {
|
||||
add_chunk(ns,chunk,allow);
|
||||
copy_location(s,chunk);
|
||||
Printf(ns,"%sfile \"%s\" {\n", decl, SWIG_last_file());
|
||||
Printf(ns,"%sfile \"%s\" {\n", decl, Swig_last_file());
|
||||
if ((Cmp(decl,"%import") == 0) || (Cmp(decl,"%extern") == 0)) {
|
||||
SWIG_cpp_define("WRAPEXTERN 1", 0);
|
||||
Preprocessor_define("WRAPEXTERN 1", 0);
|
||||
}
|
||||
s2 = SWIG_cpp_parse(s1);
|
||||
s2 = Preprocessor_parse(s1);
|
||||
if ((Cmp(decl,"%import") == 0) || (Cmp(decl,"%extern") == 0)) {
|
||||
SWIG_cpp_undef("WRAPEXTERN");
|
||||
Preprocessor_undef("WRAPEXTERN");
|
||||
}
|
||||
addline(ns,s2,allow);
|
||||
Printf(ns,"\n}\n");
|
||||
|
|
@ -1167,7 +1167,7 @@ SWIG_cpp_parse(DOH *s)
|
|||
}
|
||||
if (allow) {
|
||||
Seek(value,0,SEEK_SET);
|
||||
SWIG_cpp_define(value,1);
|
||||
Preprocessor_define(value,1);
|
||||
}
|
||||
Putc('\n',ns);
|
||||
addline(ns,value,0);
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
* can be used and distributed.
|
||||
****************************************************************************/
|
||||
|
||||
#include "swigcore.h"
|
||||
#include "preprocessor.h"
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* expr.c
|
||||
|
|
@ -26,7 +26,7 @@
|
|||
* the compiler that need to perform compile-time expression evaluation.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
static Scanner *scan = 0;
|
||||
static SwigScanner *scan = 0;
|
||||
|
||||
typedef struct {
|
||||
int op;
|
||||
|
|
@ -47,27 +47,27 @@ static char *errmsg = 0; /* Parsing error */
|
|||
|
||||
/* Initialize the precedence table for various operators. Low values have higher precedence */
|
||||
static void init_precedence() {
|
||||
prec[TOKEN_NOT] = 10;
|
||||
prec[SWIG_TOKEN_NOT] = 10;
|
||||
prec[EXPR_UMINUS] = 10;
|
||||
prec[TOKEN_STAR] = 20;
|
||||
prec[TOKEN_SLASH] = 20;
|
||||
prec[TOKEN_PERCENT] = 20;
|
||||
prec[TOKEN_PLUS] = 30;
|
||||
prec[TOKEN_MINUS] = 30;
|
||||
prec[TOKEN_LSHIFT] = 40;
|
||||
prec[TOKEN_RSHIFT] = 40;
|
||||
prec[TOKEN_AND] = 50;
|
||||
prec[TOKEN_XOR] = 60;
|
||||
prec[TOKEN_OR] = 70;
|
||||
prec[TOKEN_EQUALTO] = 80;
|
||||
prec[TOKEN_NOTEQUAL] = 80;
|
||||
prec[TOKEN_LESSTHAN] = 80;
|
||||
prec[TOKEN_GREATERTHAN] = 80;
|
||||
prec[TOKEN_LTEQUAL] = 80;
|
||||
prec[TOKEN_GTEQUAL] = 80;
|
||||
prec[TOKEN_LNOT] = 90;
|
||||
prec[TOKEN_LAND] = 100;
|
||||
prec[TOKEN_LOR] = 110;
|
||||
prec[SWIG_TOKEN_STAR] = 20;
|
||||
prec[SWIG_TOKEN_SLASH] = 20;
|
||||
prec[SWIG_TOKEN_PERCENT] = 20;
|
||||
prec[SWIG_TOKEN_PLUS] = 30;
|
||||
prec[SWIG_TOKEN_MINUS] = 30;
|
||||
prec[SWIG_TOKEN_LSHIFT] = 40;
|
||||
prec[SWIG_TOKEN_RSHIFT] = 40;
|
||||
prec[SWIG_TOKEN_AND] = 50;
|
||||
prec[SWIG_TOKEN_XOR] = 60;
|
||||
prec[SWIG_TOKEN_OR] = 70;
|
||||
prec[SWIG_TOKEN_EQUALTO] = 80;
|
||||
prec[SWIG_TOKEN_NOTEQUAL] = 80;
|
||||
prec[SWIG_TOKEN_LESSTHAN] = 80;
|
||||
prec[SWIG_TOKEN_GREATERTHAN] = 80;
|
||||
prec[SWIG_TOKEN_LTEQUAL] = 80;
|
||||
prec[SWIG_TOKEN_GTEQUAL] = 80;
|
||||
prec[SWIG_TOKEN_LNOT] = 90;
|
||||
prec[SWIG_TOKEN_LAND] = 100;
|
||||
prec[SWIG_TOKEN_LOR] = 110;
|
||||
expr_init = 1;
|
||||
}
|
||||
|
||||
|
|
@ -79,67 +79,67 @@ static void reduce_op() {
|
|||
return;
|
||||
}
|
||||
switch(stack[sp-1].value) {
|
||||
case TOKEN_STAR:
|
||||
case SWIG_TOKEN_STAR:
|
||||
stack[sp-2].value = stack[sp-2].value * stack[sp].value;
|
||||
sp -= 2;
|
||||
break;
|
||||
case TOKEN_EQUALTO:
|
||||
case SWIG_TOKEN_EQUALTO:
|
||||
stack[sp-2].value = stack[sp-2].value == stack[sp].value;
|
||||
sp -= 2;
|
||||
break;
|
||||
case TOKEN_NOTEQUAL:
|
||||
case SWIG_TOKEN_NOTEQUAL:
|
||||
stack[sp-2].value = stack[sp-2].value != stack[sp].value;
|
||||
sp -= 2;
|
||||
break;
|
||||
case TOKEN_PLUS:
|
||||
case SWIG_TOKEN_PLUS:
|
||||
stack[sp-2].value = stack[sp-2].value + stack[sp].value;
|
||||
sp -= 2;
|
||||
break;
|
||||
case TOKEN_MINUS:
|
||||
case SWIG_TOKEN_MINUS:
|
||||
stack[sp-2].value = stack[sp-2].value - stack[sp].value;
|
||||
sp -= 2;
|
||||
break;
|
||||
case TOKEN_AND:
|
||||
case SWIG_TOKEN_AND:
|
||||
stack[sp-2].value = stack[sp-2].value & stack[sp].value;
|
||||
sp -= 2;
|
||||
break;
|
||||
case TOKEN_LAND:
|
||||
case SWIG_TOKEN_LAND:
|
||||
stack[sp-2].value = stack[sp-2].value && stack[sp].value;
|
||||
sp -= 2;
|
||||
break;
|
||||
case TOKEN_OR:
|
||||
case SWIG_TOKEN_OR:
|
||||
stack[sp-2].value = stack[sp-2].value | stack[sp].value;
|
||||
sp -= 2;
|
||||
break;
|
||||
case TOKEN_LOR:
|
||||
case SWIG_TOKEN_LOR:
|
||||
stack[sp-2].value = stack[sp-2].value || stack[sp].value;
|
||||
sp -= 2;
|
||||
break;
|
||||
case TOKEN_XOR:
|
||||
case SWIG_TOKEN_XOR:
|
||||
stack[sp-2].value = stack[sp-2].value ^ stack[sp].value;
|
||||
sp -= 2;
|
||||
break;
|
||||
case TOKEN_LESSTHAN:
|
||||
case SWIG_TOKEN_LESSTHAN:
|
||||
stack[sp-2].value = stack[sp-2].value < stack[sp].value;
|
||||
sp -= 2;
|
||||
break;
|
||||
case TOKEN_GREATERTHAN:
|
||||
case SWIG_TOKEN_GREATERTHAN:
|
||||
stack[sp-2].value = stack[sp-2].value > stack[sp].value;
|
||||
sp -= 2;
|
||||
break;
|
||||
case TOKEN_LTEQUAL:
|
||||
case SWIG_TOKEN_LTEQUAL:
|
||||
stack[sp-2].value = stack[sp-2].value <= stack[sp].value;
|
||||
sp -= 2;
|
||||
break;
|
||||
case TOKEN_GTEQUAL:
|
||||
case SWIG_TOKEN_GTEQUAL:
|
||||
stack[sp-2].value = stack[sp-2].value >= stack[sp].value;
|
||||
sp -= 2;
|
||||
break;
|
||||
case TOKEN_NOT:
|
||||
case SWIG_TOKEN_NOT:
|
||||
stack[sp-1].value = ~stack[sp].value;
|
||||
sp--;
|
||||
break;
|
||||
case TOKEN_LNOT:
|
||||
case SWIG_TOKEN_LNOT:
|
||||
stack[sp-1].value = !stack[sp].value;
|
||||
sp--;
|
||||
break;
|
||||
|
|
@ -147,19 +147,19 @@ static void reduce_op() {
|
|||
stack[sp-1].value = -stack[sp].value;
|
||||
sp--;
|
||||
break;
|
||||
case TOKEN_SLASH:
|
||||
case SWIG_TOKEN_SLASH:
|
||||
stack[sp-2].value = stack[sp-2].value / stack[sp].value;
|
||||
sp -= 2;
|
||||
break;
|
||||
case TOKEN_PERCENT:
|
||||
case SWIG_TOKEN_PERCENT:
|
||||
stack[sp-2].value = stack[sp-2].value % stack[sp].value;
|
||||
sp -= 2;
|
||||
break;
|
||||
case TOKEN_LSHIFT:
|
||||
case SWIG_TOKEN_LSHIFT:
|
||||
stack[sp-2].value = stack[sp-2].value << stack[sp].value;
|
||||
sp -= 2;
|
||||
break;
|
||||
case TOKEN_RSHIFT:
|
||||
case SWIG_TOKEN_RSHIFT:
|
||||
stack[sp-2].value = stack[sp-2].value >> stack[sp].value;
|
||||
sp -= 2;
|
||||
break;
|
||||
|
|
@ -172,23 +172,23 @@ static void reduce_op() {
|
|||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* void SWIG_expr_init()
|
||||
* void Preprocessor_expr_init()
|
||||
*
|
||||
* Initialize the expression evaluator
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
void SWIG_expr_init() {
|
||||
void Preprocessor_expr_init() {
|
||||
if (!expr_init) init_precedence();
|
||||
if (!scan) scan = NewScanner();
|
||||
if (!scan) scan = NewSwigScanner();
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* int SWIG_expr(DOH *s, int *error)
|
||||
* int Preprocessor_expr(DOH *s, int *error)
|
||||
*
|
||||
* Evaluates an arithmetic expression in s.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
int SWIG_expr(DOH *s, int *error) {
|
||||
int Preprocessor_expr(DOH *s, int *error) {
|
||||
int token = 0;
|
||||
int op = 0;
|
||||
|
||||
|
|
@ -198,8 +198,8 @@ int SWIG_expr(DOH *s, int *error) {
|
|||
|
||||
Seek(s,0,SEEK_SET);
|
||||
*error = 0;
|
||||
Scanner_clear(scan);
|
||||
Scanner_push(scan,s);
|
||||
SwigScanner_clear(scan);
|
||||
SwigScanner_push(scan,s);
|
||||
|
||||
/* Put initial state onto the stack */
|
||||
stack[sp].op = EXPR_TOP;
|
||||
|
|
@ -210,32 +210,32 @@ int SWIG_expr(DOH *s, int *error) {
|
|||
switch(stack[sp].op) {
|
||||
case EXPR_TOP:
|
||||
/* An expression. Can be a number or another expression enclosed in parens */
|
||||
token = Scanner_token(scan);
|
||||
token = SwigScanner_token(scan);
|
||||
if (!token) {
|
||||
errmsg = "Expected an expression";
|
||||
*error = 1;
|
||||
return 0;
|
||||
}
|
||||
if ((token == TOKEN_INT) || (token == TOKEN_UINT) || (token == TOKEN_LONG) || (token == TOKEN_ULONG)) {
|
||||
if ((token == SWIG_TOKEN_INT) || (token == SWIG_TOKEN_UINT) || (token == SWIG_TOKEN_LONG) || (token == SWIG_TOKEN_ULONG)) {
|
||||
/* A number. Reduce EXPR_TOP to an EXPR_VALUE */
|
||||
stack[sp].value = (long) atol(Char(Scanner_text(scan)));
|
||||
stack[sp].value = (long) atol(Char(SwigScanner_text(scan)));
|
||||
stack[sp].op = EXPR_VALUE;
|
||||
} else if (token == TOKEN_PLUS) { }
|
||||
else if ((token == TOKEN_MINUS) || (token == TOKEN_LNOT) || (token==TOKEN_NOT)) {
|
||||
if (token == TOKEN_MINUS) token = EXPR_UMINUS;
|
||||
} else if (token == SWIG_TOKEN_PLUS) { }
|
||||
else if ((token == SWIG_TOKEN_MINUS) || (token == SWIG_TOKEN_LNOT) || (token==SWIG_TOKEN_NOT)) {
|
||||
if (token == SWIG_TOKEN_MINUS) token = EXPR_UMINUS;
|
||||
stack[sp].value = token;
|
||||
stack[sp++].op = EXPR_OP;
|
||||
stack[sp].op = EXPR_TOP;
|
||||
} else if ((token == TOKEN_LPAREN)) {
|
||||
} else if ((token == SWIG_TOKEN_LPAREN)) {
|
||||
stack[sp++].op = EXPR_GROUP;
|
||||
stack[sp].op = EXPR_TOP;
|
||||
stack[sp].value = 0;
|
||||
} else if (token == TOKEN_ENDLINE) { }
|
||||
} else if (token == SWIG_TOKEN_ENDLINE) { }
|
||||
else goto syntax_error;
|
||||
break;
|
||||
case EXPR_VALUE:
|
||||
/* A value is on the stack. We may reduce or evaluate depending on what the next token is */
|
||||
token = Scanner_token(scan);
|
||||
token = SwigScanner_token(scan);
|
||||
if (!token) {
|
||||
/* End of input. Might have to reduce if an operator is on stack */
|
||||
while (sp > 0) {
|
||||
|
|
@ -251,24 +251,24 @@ int SWIG_expr(DOH *s, int *error) {
|
|||
}
|
||||
/* Token must be an operator */
|
||||
switch(token) {
|
||||
case TOKEN_STAR:
|
||||
case TOKEN_EQUALTO:
|
||||
case TOKEN_NOTEQUAL:
|
||||
case TOKEN_PLUS:
|
||||
case TOKEN_MINUS:
|
||||
case TOKEN_AND:
|
||||
case TOKEN_LAND:
|
||||
case TOKEN_OR:
|
||||
case TOKEN_LOR:
|
||||
case TOKEN_XOR:
|
||||
case TOKEN_LESSTHAN:
|
||||
case TOKEN_GREATERTHAN:
|
||||
case TOKEN_LTEQUAL:
|
||||
case TOKEN_GTEQUAL:
|
||||
case TOKEN_SLASH:
|
||||
case TOKEN_PERCENT:
|
||||
case TOKEN_LSHIFT:
|
||||
case TOKEN_RSHIFT:
|
||||
case SWIG_TOKEN_STAR:
|
||||
case SWIG_TOKEN_EQUALTO:
|
||||
case SWIG_TOKEN_NOTEQUAL:
|
||||
case SWIG_TOKEN_PLUS:
|
||||
case SWIG_TOKEN_MINUS:
|
||||
case SWIG_TOKEN_AND:
|
||||
case SWIG_TOKEN_LAND:
|
||||
case SWIG_TOKEN_OR:
|
||||
case SWIG_TOKEN_LOR:
|
||||
case SWIG_TOKEN_XOR:
|
||||
case SWIG_TOKEN_LESSTHAN:
|
||||
case SWIG_TOKEN_GREATERTHAN:
|
||||
case SWIG_TOKEN_LTEQUAL:
|
||||
case SWIG_TOKEN_GTEQUAL:
|
||||
case SWIG_TOKEN_SLASH:
|
||||
case SWIG_TOKEN_PERCENT:
|
||||
case SWIG_TOKEN_LSHIFT:
|
||||
case SWIG_TOKEN_RSHIFT:
|
||||
if ((sp == 0) || (stack[sp-1].op == EXPR_GROUP)) {
|
||||
/* No possibility of reduce. Push operator and expression */
|
||||
sp++;
|
||||
|
|
@ -297,7 +297,7 @@ int SWIG_expr(DOH *s, int *error) {
|
|||
stack[sp].value = 0;
|
||||
}
|
||||
break;
|
||||
case TOKEN_RPAREN:
|
||||
case SWIG_TOKEN_RPAREN:
|
||||
if (sp == 0) goto extra_rparen;
|
||||
|
||||
/* Might have to reduce operators first */
|
||||
|
|
@ -329,7 +329,7 @@ int SWIG_expr(DOH *s, int *error) {
|
|||
}
|
||||
|
||||
/* Return the expression error message */
|
||||
char *SWIG_expr_error() {
|
||||
char *Preprocessor_expr_error() {
|
||||
return errmsg;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,24 +13,22 @@
|
|||
* can be used and distributed.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef _SWIGCPP_H
|
||||
#define _SWIGCPP_H
|
||||
#ifndef _PREPROCESSOR_H
|
||||
#define _PREPROCESSOR_H
|
||||
|
||||
#include "swigcore.h"
|
||||
#include "swig.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern int SWIG_expr(DOH *s, int *error);
|
||||
extern char *SWIG_expr_error(void);
|
||||
extern void SWIG_expr_init();
|
||||
|
||||
extern DOH *SWIG_cpp_define(DOH *str, int swigmacro);
|
||||
extern void SWIG_cpp_undef(DOH *name);
|
||||
extern void SWIG_cpp_init();
|
||||
extern DOH *SWIG_cpp_parse(DOH *s);
|
||||
extern void SWIG_cpp_include_all(int);
|
||||
extern int Preprocessor_expr(DOH *s, int *error);
|
||||
extern char *Preprocessor_expr_error(void);
|
||||
extern DOH *Preprocessor_define(DOH *str, int swigmacro);
|
||||
extern void Preprocessor_undef(DOH *name);
|
||||
extern void Preprocessor_init();
|
||||
extern DOH *Preprocessor_parse(DOH *s);
|
||||
extern void Preprocessor_include_all(int);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue