last performance improvements, and typemaps fixes
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@7865 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
0e34b75e44
commit
726de6fc52
5 changed files with 164 additions and 46 deletions
|
|
@ -303,13 +303,17 @@
|
||||||
#define SWIG_AsVal_frag(Type...) %fragment_name(AsVal, Type)
|
#define SWIG_AsVal_frag(Type...) %fragment_name(AsVal, Type)
|
||||||
#define SWIG_From_frag(Type...) %fragment_name(From, Type)
|
#define SWIG_From_frag(Type...) %fragment_name(From, Type)
|
||||||
|
|
||||||
#define SWIG_AsVal_dec(Type...) %symbol_name(AsVal, Type) SWIG_AS_DECL_ARGS
|
#define SWIG_AsVal_name(Type...) %symbol_name(AsVal, Type)
|
||||||
#define SWIG_AsPtr_dec(Type...) %symbol_name(AsPtr, Type) SWIG_AS_DECL_ARGS
|
#define SWIG_AsPtr_name(Type...) %symbol_name(AsPtr, Type)
|
||||||
#define SWIG_From_dec(Type...) %symbol_name(From, Type) SWIG_FROM_DECL_ARGS
|
#define SWIG_From_name(Type...) %symbol_name(From, Type)
|
||||||
|
|
||||||
#define SWIG_AsVal(Type...) %symbol_name(AsVal, Type) SWIG_AS_CALL_ARGS
|
#define SWIG_AsVal_dec(Type...) SWIG_AsVal_name(Type) SWIG_AS_DECL_ARGS
|
||||||
#define SWIG_AsPtr(Type...) %symbol_name(AsPtr, Type) SWIG_AS_CALL_ARGS
|
#define SWIG_AsPtr_dec(Type...) SWIG_AsPtr_name(Type) SWIG_AS_DECL_ARGS
|
||||||
#define SWIG_From(Type...) %symbol_name(From, Type) SWIG_FROM_CALL_ARGS
|
#define SWIG_From_dec(Type...) SWIG_From_name(Type) SWIG_FROM_DECL_ARGS
|
||||||
|
|
||||||
|
#define SWIG_AsVal(Type...) SWIG_AsVal_name(Type) SWIG_AS_CALL_ARGS
|
||||||
|
#define SWIG_AsPtr(Type...) SWIG_AsPtr_name(Type) SWIG_AS_CALL_ARGS
|
||||||
|
#define SWIG_From(Type...) SWIG_From_name(Type) SWIG_FROM_CALL_ARGS
|
||||||
|
|
||||||
/* ------------------------------------------------------------
|
/* ------------------------------------------------------------
|
||||||
* common fragments
|
* common fragments
|
||||||
|
|
|
||||||
|
|
@ -6,14 +6,16 @@
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
||||||
namespace std
|
%apply size_t { std::size_t };
|
||||||
{
|
%apply const size_t& { const std::size_t& };
|
||||||
typedef ::ptrdiff_t ptrdiff_t;
|
|
||||||
typedef ::size_t size_t;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
%apply ptrdiff_t { std::ptrdiff_t };
|
||||||
|
%apply const ptrdiff_t& { const std::ptrdiff_t& };
|
||||||
|
|
||||||
|
#ifndef SWIG_INOUT_NODEF
|
||||||
|
%apply size_t& { std::size_t& };
|
||||||
|
%apply ptrdiff_t& { std::ptrdiff_t& };
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -164,4 +164,7 @@ phased out in future releases.
|
||||||
|
|
||||||
%apply_checkctypes(%typemaps_inoutn)
|
%apply_checkctypes(%typemaps_inoutn)
|
||||||
|
|
||||||
|
%apply size_t& { std::size_t& };
|
||||||
|
%apply ptrdiff_t& { std::ptrdiff_t& };
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -434,9 +434,9 @@ DohString_putc(DOH *so, int ch)
|
||||||
register char *tc;
|
register char *tc;
|
||||||
maxsize = s->maxsize;
|
maxsize = s->maxsize;
|
||||||
if (len > (maxsize-2)) {
|
if (len > (maxsize-2)) {
|
||||||
s->str = (char *) DohRealloc(s->str,3*maxsize);
|
s->str = (char *) DohRealloc(s->str,2*maxsize);
|
||||||
assert(s->str);
|
assert(s->str);
|
||||||
s->maxsize = 3*maxsize;
|
s->maxsize = 2*maxsize;
|
||||||
}
|
}
|
||||||
tc = s->str + len;
|
tc = s->str + len;
|
||||||
*(tc++) = ch;
|
*(tc++) = ch;
|
||||||
|
|
|
||||||
|
|
@ -114,23 +114,65 @@ List *Preprocessor_depend(void) {
|
||||||
* void Preprocessor_cpp_init() - Initialize the preprocessor
|
* void Preprocessor_cpp_init() - Initialize the preprocessor
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
static String *k_args = 0;
|
static String *k_args = 0;
|
||||||
|
static String *k_define = 0;
|
||||||
|
static String *k_defined = 0;
|
||||||
|
static String *k_elif = 0;
|
||||||
|
static String *k_else = 0;
|
||||||
|
static String *k_endif = 0;
|
||||||
static String *k_expanded = 0;
|
static String *k_expanded = 0;
|
||||||
|
static String *k_if = 0;
|
||||||
|
static String *k_ifdef = 0;
|
||||||
|
static String *k_ifndef = 0;
|
||||||
static String *k_name = 0;
|
static String *k_name = 0;
|
||||||
|
static String *k_swigmacro = 0;
|
||||||
static String *k_symbols = 0;
|
static String *k_symbols = 0;
|
||||||
|
static String *k_undef = 0;
|
||||||
static String *k_value = 0;
|
static String *k_value = 0;
|
||||||
static String *k_varargs = 0;
|
static String *k_varargs = 0;
|
||||||
static String *k_swigmacro = 0;
|
static String *k_error = 0;
|
||||||
|
static String *k_warning = 0;
|
||||||
|
static String *k_line = 0;
|
||||||
|
static String *k_include = 0;
|
||||||
|
static String *k_pragma = 0;
|
||||||
|
static String *k_level = 0;
|
||||||
|
|
||||||
|
static String *k_dline = 0;
|
||||||
|
static String *k_ddefine = 0;
|
||||||
|
static String *k_dinclude = 0;
|
||||||
|
static String *k_dimport = 0;
|
||||||
|
static String *k_dextern = 0;
|
||||||
|
|
||||||
void Preprocessor_init(void) {
|
void Preprocessor_init(void) {
|
||||||
Hash *s;
|
Hash *s;
|
||||||
|
|
||||||
k_args = NewString("args");
|
k_args = NewString("args");
|
||||||
k_name = NewString("name");
|
k_define = NewString("define");
|
||||||
k_value = NewString("value");
|
k_defined = NewString("defined");
|
||||||
k_symbols = NewString("symbols");
|
k_else = NewString("else");
|
||||||
k_varargs = NewString("varargs");
|
k_elif = NewString("elif");
|
||||||
|
k_endif = NewString("endif");
|
||||||
k_expanded = NewString("*expanded*");
|
k_expanded = NewString("*expanded*");
|
||||||
|
k_if = NewString("if");
|
||||||
|
k_ifdef = NewString("ifdef");
|
||||||
|
k_ifndef = NewString("ifndef");
|
||||||
|
k_name = NewString("name");
|
||||||
k_swigmacro = NewString("swigmacro");
|
k_swigmacro = NewString("swigmacro");
|
||||||
|
k_symbols = NewString("symbols");
|
||||||
|
k_undef = NewString("undef");
|
||||||
|
k_value = NewString("value");
|
||||||
|
k_error = NewString("error");
|
||||||
|
k_warning = NewString("warning");
|
||||||
|
k_pragma = NewString("pragma");
|
||||||
|
k_level = NewString("level");
|
||||||
|
k_line = NewString("line");
|
||||||
|
k_include = NewString("include");
|
||||||
|
k_varargs = NewString("varargs");
|
||||||
|
|
||||||
|
k_dinclude = NewString("%include");
|
||||||
|
k_dimport = NewString("%import");
|
||||||
|
k_dextern = NewString("%extern");
|
||||||
|
k_ddefine = NewString("%define");
|
||||||
|
k_dline = NewString("%line");
|
||||||
|
|
||||||
cpp = NewHash();
|
cpp = NewHash();
|
||||||
s = NewHash();
|
s = NewHash();
|
||||||
|
|
@ -809,11 +851,18 @@ List *evaluate_args(List *x) {
|
||||||
* which are then expanded.
|
* which are then expanded.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
/*#define PBUFF*/
|
||||||
DOH *
|
DOH *
|
||||||
Preprocessor_replace(DOH *s)
|
Preprocessor_replace(DOH *s)
|
||||||
{
|
{
|
||||||
DOH *ns, *id, *symbols, *m;
|
DOH *ns, *symbols, *m;
|
||||||
int c, i, state = 0;
|
int c, i, state = 0;
|
||||||
|
String *id = NewString("");
|
||||||
|
#ifdef PBUFF
|
||||||
|
char bid[4096];
|
||||||
|
char *cid;
|
||||||
|
cid = bid; *cid = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
assert(cpp);
|
assert(cpp);
|
||||||
symbols = Getattr(cpp,k_symbols);
|
symbols = Getattr(cpp,k_symbols);
|
||||||
|
|
@ -821,7 +870,6 @@ Preprocessor_replace(DOH *s)
|
||||||
ns = NewString("");
|
ns = NewString("");
|
||||||
copy_location(s,ns);
|
copy_location(s,ns);
|
||||||
Seek(s,0,SEEK_SET);
|
Seek(s,0,SEEK_SET);
|
||||||
id = NewString("");
|
|
||||||
|
|
||||||
/* Try to locate identifiers in s and replace them with macro replacements */
|
/* Try to locate identifiers in s and replace them with macro replacements */
|
||||||
while ((c = StringGetc(s)) != EOF) {
|
while ((c = StringGetc(s)) != EOF) {
|
||||||
|
|
@ -829,8 +877,15 @@ Preprocessor_replace(DOH *s)
|
||||||
case 0:
|
case 0:
|
||||||
if (isidentifier(c) || (c == '%')) {
|
if (isidentifier(c) || (c == '%')) {
|
||||||
Clear(id);
|
Clear(id);
|
||||||
|
#ifdef PBUFF
|
||||||
|
cid = bid; *cid = 0;
|
||||||
|
#endif
|
||||||
copy_location(s,id);
|
copy_location(s,id);
|
||||||
|
#ifndef PBUFF
|
||||||
StringPutc(c,id);
|
StringPutc(c,id);
|
||||||
|
#else
|
||||||
|
*cid = c; ++cid; *cid = 0;
|
||||||
|
#endif
|
||||||
state = 1;
|
state = 1;
|
||||||
} else if (c == '\"') {
|
} else if (c == '\"') {
|
||||||
StringPutc(c,ns);
|
StringPutc(c,ns);
|
||||||
|
|
@ -847,13 +902,24 @@ Preprocessor_replace(DOH *s)
|
||||||
break;
|
break;
|
||||||
case 1: /* An identifier */
|
case 1: /* An identifier */
|
||||||
if (isidchar(c)) {
|
if (isidchar(c)) {
|
||||||
|
#ifndef PBUFF
|
||||||
StringPutc(c,id);
|
StringPutc(c,id);
|
||||||
|
#else
|
||||||
|
*cid = c; ++cid; *cid = 0;
|
||||||
|
#endif
|
||||||
state = 1;
|
state = 1;
|
||||||
} else {
|
} else {
|
||||||
|
#ifdef PBUFF
|
||||||
|
/* StringAppend(id,bid); */
|
||||||
|
#endif
|
||||||
/* We found the end of a valid identifier */
|
/* We found the end of a valid identifier */
|
||||||
StringUngetc(c,s);
|
StringUngetc(c,s);
|
||||||
/* See if this is the special "defined" macro */
|
/* See if this is the special "defined" macro */
|
||||||
if (Cmp(id,"defined") == 0) {
|
#ifndef PBUFF
|
||||||
|
if (Cmp(id,k_defined) == 0) {
|
||||||
|
#else
|
||||||
|
if (strcmp(bid,"defined") == 0) {
|
||||||
|
#endif
|
||||||
DOH *args = 0;
|
DOH *args = 0;
|
||||||
/* See whether or not a paranthesis has been used */
|
/* See whether or not a paranthesis has been used */
|
||||||
skip_whitespace(s,0);
|
skip_whitespace(s,0);
|
||||||
|
|
@ -879,7 +945,11 @@ Preprocessor_replace(DOH *s)
|
||||||
}
|
}
|
||||||
if ((!args) || (!Len(args))) {
|
if ((!args) || (!Len(args))) {
|
||||||
/* This is not a defined() macro. */
|
/* This is not a defined() macro. */
|
||||||
|
#ifndef PBUFF
|
||||||
StringAppend(ns,id);
|
StringAppend(ns,id);
|
||||||
|
#else
|
||||||
|
StringAppend(ns,bid);
|
||||||
|
#endif
|
||||||
state = 0;
|
state = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -895,12 +965,20 @@ Preprocessor_replace(DOH *s)
|
||||||
state = 0;
|
state = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#ifndef PBUFF
|
||||||
if (Cmp(id,"__LINE__") == 0) {
|
if (Cmp(id,"__LINE__") == 0) {
|
||||||
|
#else
|
||||||
|
if (strcmp(bid,"__LINE__") == 0) {
|
||||||
|
#endif
|
||||||
Printf(ns,"%d",Getline(s));
|
Printf(ns,"%d",Getline(s));
|
||||||
state = 0;
|
state = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#ifndef PBUFF
|
||||||
if (Cmp(id,"__FILE__") == 0) {
|
if (Cmp(id,"__FILE__") == 0) {
|
||||||
|
#else
|
||||||
|
if (strcmp(bid,"__FILE__") == 0) {
|
||||||
|
#endif
|
||||||
String *fn = Copy(Getfile(s));
|
String *fn = Copy(Getfile(s));
|
||||||
Replaceall(fn,"\\","\\\\");
|
Replaceall(fn,"\\","\\\\");
|
||||||
Printf(ns,"\"%s\"",fn);
|
Printf(ns,"\"%s\"",fn);
|
||||||
|
|
@ -909,7 +987,11 @@ Preprocessor_replace(DOH *s)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* See if the macro is defined in the preprocessor symbol table */
|
/* See if the macro is defined in the preprocessor symbol table */
|
||||||
|
#ifndef PBUFF
|
||||||
if ((m = Getattr(symbols,id))) {
|
if ((m = Getattr(symbols,id))) {
|
||||||
|
#else
|
||||||
|
if ((m = Getattr(symbols,bid))) {
|
||||||
|
#endif
|
||||||
DOH *args = 0;
|
DOH *args = 0;
|
||||||
DOH *e;
|
DOH *e;
|
||||||
/* See if the macro expects arguments */
|
/* See if the macro expects arguments */
|
||||||
|
|
@ -923,14 +1005,22 @@ Preprocessor_replace(DOH *s)
|
||||||
} else {
|
} else {
|
||||||
args = 0;
|
args = 0;
|
||||||
}
|
}
|
||||||
|
#ifndef PBUFF
|
||||||
e = expand_macro(id,args);
|
e = expand_macro(id,args);
|
||||||
|
#else
|
||||||
|
e = expand_macro(bid,args);
|
||||||
|
#endif
|
||||||
if (e) {
|
if (e) {
|
||||||
StringAppend(ns,e);
|
StringAppend(ns,e);
|
||||||
}
|
}
|
||||||
Delete(e);
|
Delete(e);
|
||||||
Delete(args);
|
Delete(args);
|
||||||
} else {
|
} else {
|
||||||
|
#ifndef PBUFF
|
||||||
StringAppend(ns,id);
|
StringAppend(ns,id);
|
||||||
|
#else
|
||||||
|
StringAppend(ns,bid);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
state = 0;
|
state = 0;
|
||||||
}
|
}
|
||||||
|
|
@ -966,21 +1056,40 @@ Preprocessor_replace(DOH *s)
|
||||||
|
|
||||||
/* Identifier at the end */
|
/* Identifier at the end */
|
||||||
if (state == 1) {
|
if (state == 1) {
|
||||||
|
#ifdef PBUFF
|
||||||
|
/* StringAppend(id,bid); */
|
||||||
|
#endif
|
||||||
/* See if this is the special "defined" macro */
|
/* See if this is the special "defined" macro */
|
||||||
if (Cmp(id,"defined") == 0) {
|
#ifndef PBUFF
|
||||||
|
if (Cmp(id,k_defined) == 0) {
|
||||||
|
#else
|
||||||
|
if (strcmp(bid,"defined") == 0) {
|
||||||
|
#endif
|
||||||
Swig_error(Getfile(id),Getline(id),"No arguments given to defined()\n");
|
Swig_error(Getfile(id),Getline(id),"No arguments given to defined()\n");
|
||||||
|
#ifndef PBUFF
|
||||||
} else if ((m = Getattr(symbols,id))) {
|
} else if ((m = Getattr(symbols,id))) {
|
||||||
|
#else
|
||||||
|
} else if ((m = Getattr(symbols,bid))) {
|
||||||
|
#endif
|
||||||
DOH *e;
|
DOH *e;
|
||||||
/* Yes. There is a macro here */
|
/* Yes. There is a macro here */
|
||||||
/* See if the macro expects arguments */
|
/* See if the macro expects arguments */
|
||||||
/* if (Getattr(m,"args")) {
|
/* if (Getattr(m,"args")) {
|
||||||
Swig_error(Getfile(id),Getline(id),"Macro arguments expected.\n");
|
Swig_error(Getfile(id),Getline(id),"Macro arguments expected.\n");
|
||||||
} */
|
} */
|
||||||
|
#ifndef PBUFF
|
||||||
e = expand_macro(id,0);
|
e = expand_macro(id,0);
|
||||||
|
#else
|
||||||
|
e = expand_macro(bid,0);
|
||||||
|
#endif
|
||||||
StringAppend(ns,e);
|
StringAppend(ns,e);
|
||||||
Delete(e);
|
Delete(e);
|
||||||
} else {
|
} else {
|
||||||
|
#ifndef PBUFF
|
||||||
StringAppend(ns,id);
|
StringAppend(ns,id);
|
||||||
|
#else
|
||||||
|
StringAppend(ns,bid);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Delete(id);
|
Delete(id);
|
||||||
|
|
@ -1289,7 +1398,7 @@ Preprocessor_parse(String *s)
|
||||||
case 50:
|
case 50:
|
||||||
/* Check for various preprocessor directives */
|
/* Check for various preprocessor directives */
|
||||||
Chop(value);
|
Chop(value);
|
||||||
if (Cmp(id,"define") == 0) {
|
if (Cmp(id,k_define) == 0) {
|
||||||
if (allow) {
|
if (allow) {
|
||||||
DOH *m, *v, *v1;
|
DOH *m, *v, *v1;
|
||||||
Seek(value,0,SEEK_SET);
|
Seek(value,0,SEEK_SET);
|
||||||
|
|
@ -1314,9 +1423,9 @@ Preprocessor_parse(String *s)
|
||||||
}
|
}
|
||||||
Delete(m);
|
Delete(m);
|
||||||
}
|
}
|
||||||
} else if (Cmp(id,"undef") == 0) {
|
} else if (Cmp(id,k_undef) == 0) {
|
||||||
if (allow) Preprocessor_undef(value);
|
if (allow) Preprocessor_undef(value);
|
||||||
} else if (Cmp(id,"ifdef") == 0) {
|
} else if (Cmp(id,k_ifdef) == 0) {
|
||||||
cond_lines[level] = Getline(id);
|
cond_lines[level] = Getline(id);
|
||||||
level++;
|
level++;
|
||||||
if (allow) {
|
if (allow) {
|
||||||
|
|
@ -1325,7 +1434,7 @@ Preprocessor_parse(String *s)
|
||||||
if (!Getattr(symbols,value)) allow = 0;
|
if (!Getattr(symbols,value)) allow = 0;
|
||||||
mask = 1;
|
mask = 1;
|
||||||
}
|
}
|
||||||
} else if (Cmp(id,"ifndef") == 0) {
|
} else if (Cmp(id,k_ifndef) == 0) {
|
||||||
cond_lines[level] = Getline(id);
|
cond_lines[level] = Getline(id);
|
||||||
level++;
|
level++;
|
||||||
if (allow) {
|
if (allow) {
|
||||||
|
|
@ -1334,7 +1443,7 @@ Preprocessor_parse(String *s)
|
||||||
if (Getattr(symbols,value)) allow = 0;
|
if (Getattr(symbols,value)) allow = 0;
|
||||||
mask = 1;
|
mask = 1;
|
||||||
}
|
}
|
||||||
} else if (Cmp(id,"else") == 0) {
|
} else if (Cmp(id,k_else) == 0) {
|
||||||
if (level <= 0) {
|
if (level <= 0) {
|
||||||
Swig_error(Getfile(s),Getline(id),"Misplaced #else.\n");
|
Swig_error(Getfile(s),Getline(id),"Misplaced #else.\n");
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1346,7 +1455,7 @@ Preprocessor_parse(String *s)
|
||||||
allow = 1*mask;
|
allow = 1*mask;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (Cmp(id,"endif") == 0) {
|
} else if (Cmp(id,k_endif) == 0) {
|
||||||
level--;
|
level--;
|
||||||
if (level < 0) {
|
if (level < 0) {
|
||||||
Swig_error(Getfile(id),Getline(id),"Extraneous #endif.\n");
|
Swig_error(Getfile(id),Getline(id),"Extraneous #endif.\n");
|
||||||
|
|
@ -1357,7 +1466,7 @@ Preprocessor_parse(String *s)
|
||||||
start_level--;
|
start_level--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (Cmp(id,"if") == 0) {
|
} else if (Cmp(id,k_if) == 0) {
|
||||||
cond_lines[level] = Getline(id);
|
cond_lines[level] = Getline(id);
|
||||||
level++;
|
level++;
|
||||||
if (allow) {
|
if (allow) {
|
||||||
|
|
@ -1379,7 +1488,7 @@ Preprocessor_parse(String *s)
|
||||||
}
|
}
|
||||||
mask = 1;
|
mask = 1;
|
||||||
}
|
}
|
||||||
} else if (Cmp(id,"elif") == 0) {
|
} else if (Cmp(id,k_elif) == 0) {
|
||||||
if (level == 0) {
|
if (level == 0) {
|
||||||
Swig_error(Getfile(s),Getline(id),"Misplaced #elif.\n");
|
Swig_error(Getfile(s),Getline(id),"Misplaced #elif.\n");
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1406,16 +1515,16 @@ Preprocessor_parse(String *s)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (Cmp(id,"warning") == 0) {
|
} else if (Cmp(id,k_warning) == 0) {
|
||||||
if (allow) {
|
if (allow) {
|
||||||
Swig_warning(WARN_PP_CPP_WARNING,Getfile(s),Getline(id),"%s\n", value);
|
Swig_warning(WARN_PP_CPP_WARNING,Getfile(s),Getline(id),"%s\n", value);
|
||||||
}
|
}
|
||||||
} else if (Cmp(id,"error") == 0) {
|
} else if (Cmp(id,k_error) == 0) {
|
||||||
if (allow) {
|
if (allow) {
|
||||||
Swig_error(Getfile(s),Getline(id),"%s\n",value);
|
Swig_error(Getfile(s),Getline(id),"%s\n",value);
|
||||||
}
|
}
|
||||||
} else if (Cmp(id,"line") == 0) {
|
} else if (Cmp(id,k_line) == 0) {
|
||||||
} else if (Cmp(id,"include") == 0) {
|
} else if (Cmp(id,k_include) == 0) {
|
||||||
if (((include_all) || (import_all)) && (allow)) {
|
if (((include_all) || (import_all)) && (allow)) {
|
||||||
String *s1, *s2, *fn;
|
String *s1, *s2, *fn;
|
||||||
char *dirname; int sysfile = 0;
|
char *dirname; int sysfile = 0;
|
||||||
|
|
@ -1455,7 +1564,7 @@ Preprocessor_parse(String *s)
|
||||||
Delete(s1);
|
Delete(s1);
|
||||||
Delete(fn);
|
Delete(fn);
|
||||||
}
|
}
|
||||||
} else if (Cmp(id,"pragma") == 0) {
|
} else if (Cmp(id,k_pragma) == 0) {
|
||||||
if (Strncmp(value,"SWIG ",5) == 0) {
|
if (Strncmp(value,"SWIG ",5) == 0) {
|
||||||
char *c = Char(value)+5;
|
char *c = Char(value)+5;
|
||||||
while (*c && (isspace((int)*c))) c++;
|
while (*c && (isspace((int)*c))) c++;
|
||||||
|
|
@ -1465,7 +1574,7 @@ Preprocessor_parse(String *s)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (Cmp(id,"level") == 0) {
|
} else if (Cmp(id,k_level) == 0) {
|
||||||
Swig_error(Getfile(s),Getline(id),"cpp debug: level = %d, startlevel = %d\n", level, start_level);
|
Swig_error(Getfile(s),Getline(id),"cpp debug: level = %d, startlevel = %d\n", level, start_level);
|
||||||
}
|
}
|
||||||
for (i = 0; i < cpp_lines; i++)
|
for (i = 0; i < cpp_lines; i++)
|
||||||
|
|
@ -1539,12 +1648,12 @@ Preprocessor_parse(String *s)
|
||||||
if (!isidchar(c)) {
|
if (!isidchar(c)) {
|
||||||
StringUngetc(c,s);
|
StringUngetc(c,s);
|
||||||
/* Look for common Swig directives */
|
/* Look for common Swig directives */
|
||||||
if ((Cmp(decl,"%include") == 0) || (Cmp(decl,"%import") == 0) || (Cmp(decl,"%extern") == 0)) {
|
if ((Cmp(decl,k_dinclude) == 0) || (Cmp(decl,k_dimport) == 0) || (Cmp(decl,k_dextern) == 0)) {
|
||||||
/* Got some kind of file inclusion directive */
|
/* Got some kind of file inclusion directive */
|
||||||
if (allow) {
|
if (allow) {
|
||||||
DOH *s1, *s2, *fn, *opt; int sysfile = 0;
|
DOH *s1, *s2, *fn, *opt; int sysfile = 0;
|
||||||
|
|
||||||
if (Cmp(decl,"%extern") == 0) {
|
if (Cmp(decl,k_dextern) == 0) {
|
||||||
Swig_warning(WARN_DEPRECATED_EXTERN, Getfile(s),Getline(s),"%%extern is deprecated. Use %%import instead.\n");
|
Swig_warning(WARN_DEPRECATED_EXTERN, Getfile(s),Getline(s),"%%extern is deprecated. Use %%import instead.\n");
|
||||||
Clear(decl);
|
Clear(decl);
|
||||||
StringAppend(decl,"%%import");
|
StringAppend(decl,"%%import");
|
||||||
|
|
@ -1557,7 +1666,7 @@ Preprocessor_parse(String *s)
|
||||||
add_chunk(ns,chunk,allow);
|
add_chunk(ns,chunk,allow);
|
||||||
copy_location(s,chunk);
|
copy_location(s,chunk);
|
||||||
Printf(ns,"%sfile%s \"%s\" [\n", decl, opt, Swig_last_file());
|
Printf(ns,"%sfile%s \"%s\" [\n", decl, opt, Swig_last_file());
|
||||||
if (Cmp(decl,"%import") == 0) {
|
if (Cmp(decl,k_dimport) == 0) {
|
||||||
push_imported();
|
push_imported();
|
||||||
}
|
}
|
||||||
dirname = Swig_file_dirname(Swig_last_file());
|
dirname = Swig_file_dirname(Swig_last_file());
|
||||||
|
|
@ -1570,7 +1679,7 @@ Preprocessor_parse(String *s)
|
||||||
if (dirname) {
|
if (dirname) {
|
||||||
Swig_pop_directory();
|
Swig_pop_directory();
|
||||||
}
|
}
|
||||||
if (Cmp(decl,"%import") == 0) {
|
if (Cmp(decl,k_dimport) == 0) {
|
||||||
pop_imported();
|
pop_imported();
|
||||||
}
|
}
|
||||||
addline(ns,s2,allow);
|
addline(ns,s2,allow);
|
||||||
|
|
@ -1581,10 +1690,10 @@ Preprocessor_parse(String *s)
|
||||||
Delete(fn);
|
Delete(fn);
|
||||||
}
|
}
|
||||||
state = 1;
|
state = 1;
|
||||||
} else if (Cmp(decl,"%line") == 0) {
|
} else if (Cmp(decl,k_dline) == 0) {
|
||||||
/* Got a line directive */
|
/* Got a line directive */
|
||||||
state = 1;
|
state = 1;
|
||||||
} else if (Cmp(decl,"%define") == 0) {
|
} else if (Cmp(decl,k_ddefine) == 0) {
|
||||||
/* Got a define directive */
|
/* Got a define directive */
|
||||||
dlevel++;
|
dlevel++;
|
||||||
add_chunk(ns,chunk,allow);
|
add_chunk(ns,chunk,allow);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue