Merged revisions 11085-11086,11088-11089 via svnmerge from
https://swig.svn.sourceforge.net/svnroot/swig/branches/swig-2.0 ........ r11085 | bhy | 2009-01-25 00:21:55 +0800 (Sun, 25 Jan 2009) | 2 lines Fix const-correctness. ........ r11086 | bhy | 2009-01-25 02:08:50 +0800 (Sun, 25 Jan 2009) | 2 lines Correct some function definition in header files, which implementation changed in previous commit caused mismatch. ........ r11088 | bhy | 2009-01-25 02:38:32 +0800 (Sun, 25 Jan 2009) | 1 line minor fix and now SWIG is alive again ........ r11089 | bhy | 2009-01-25 06:07:07 +0800 (Sun, 25 Jan 2009) | 1 line Correct some bug introduced in previous commits. Now SWIG is pretty good with C++ compiler. ........ git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11097 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
a6adffe4d9
commit
47b4825168
15 changed files with 44 additions and 41 deletions
|
|
@ -34,7 +34,7 @@ extern "C" {
|
||||||
extern void scanner_ignore_typedef(void);
|
extern void scanner_ignore_typedef(void);
|
||||||
extern void scanner_last_id(int);
|
extern void scanner_last_id(int);
|
||||||
extern void scanner_clear_rename(void);
|
extern void scanner_clear_rename(void);
|
||||||
extern void scanner_set_location(const_String_or_char_ptr file, int line);
|
extern void scanner_set_location(String *file, int line);
|
||||||
extern void scanner_set_main_input_file(String *file);
|
extern void scanner_set_main_input_file(String *file);
|
||||||
extern String *scanner_get_main_input_file();
|
extern String *scanner_get_main_input_file();
|
||||||
extern void Swig_cparse_follow_locators(int);
|
extern void Swig_cparse_follow_locators(int);
|
||||||
|
|
|
||||||
|
|
@ -442,7 +442,7 @@ int yylook(void) {
|
||||||
|
|
||||||
static int check_typedef = 0;
|
static int check_typedef = 0;
|
||||||
|
|
||||||
void scanner_set_location(const_String_or_char_ptr file, int line) {
|
void scanner_set_location(String *file, int line) {
|
||||||
Scanner_set_location(scan,file,line-1);
|
Scanner_set_location(scan,file,line-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -701,7 +701,7 @@ int yylex(void) {
|
||||||
break;
|
break;
|
||||||
} else if (nexttok == SWIG_TOKEN_CODEBLOCK) {
|
} else if (nexttok == SWIG_TOKEN_CODEBLOCK) {
|
||||||
termtoken = SWIG_TOKEN_CODEBLOCK;
|
termtoken = SWIG_TOKEN_CODEBLOCK;
|
||||||
termvalue = Scanner_text(scan);
|
termvalue = Char(Scanner_text(scan));
|
||||||
break;
|
break;
|
||||||
} else if (nexttok == SWIG_TOKEN_LBRACE) {
|
} else if (nexttok == SWIG_TOKEN_LBRACE) {
|
||||||
termtoken = SWIG_TOKEN_LBRACE;
|
termtoken = SWIG_TOKEN_LBRACE;
|
||||||
|
|
|
||||||
|
|
@ -3334,7 +3334,7 @@ cpp_class_decl :
|
||||||
} else {
|
} else {
|
||||||
max_class_levels *= 2;
|
max_class_levels *= 2;
|
||||||
}
|
}
|
||||||
class_decl = realloc(class_decl, sizeof(Node*) * max_class_levels);
|
class_decl = (Node**) realloc(class_decl, sizeof(Node*) * max_class_levels);
|
||||||
if (!class_decl) {
|
if (!class_decl) {
|
||||||
Swig_error(cparse_file, cparse_line, "realloc() failed\n");
|
Swig_error(cparse_file, cparse_line, "realloc() failed\n");
|
||||||
}
|
}
|
||||||
|
|
@ -3483,7 +3483,7 @@ cpp_class_decl :
|
||||||
} else {
|
} else {
|
||||||
max_class_levels *= 2;
|
max_class_levels *= 2;
|
||||||
}
|
}
|
||||||
class_decl = realloc(class_decl, sizeof(Node*) * max_class_levels);
|
class_decl = (Node**) realloc(class_decl, sizeof(Node*) * max_class_levels);
|
||||||
if (!class_decl) {
|
if (!class_decl) {
|
||||||
Swig_error(cparse_file, cparse_line, "realloc() failed\n");
|
Swig_error(cparse_file, cparse_line, "realloc() failed\n");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ char cvsroot_templ_c[] = "$Id$";
|
||||||
static int template_debug = 0;
|
static int template_debug = 0;
|
||||||
|
|
||||||
|
|
||||||
String *baselists[3];
|
const char *baselists[3];
|
||||||
|
|
||||||
void SwigType_template_init() {
|
void SwigType_template_init() {
|
||||||
baselists[0] = "baselist";
|
baselists[0] = "baselist";
|
||||||
|
|
|
||||||
|
|
@ -827,7 +827,7 @@ void DohSetfile(DOH *ho, DOH *file) {
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* DohGetFile()
|
* DohGetFile()
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
DOH *DohGetfile(DOH *ho) {
|
DOH *DohGetfile(const DOH *ho) {
|
||||||
DohBase *h = (DohBase *) ho;
|
DohBase *h = (DohBase *) ho;
|
||||||
DohObjInfo *objinfo;
|
DohObjInfo *objinfo;
|
||||||
if (!h)
|
if (!h)
|
||||||
|
|
@ -854,7 +854,7 @@ void DohSetline(DOH *ho, int l) {
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* DohGetLine()
|
* DohGetLine()
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
int DohGetline(DOH *ho) {
|
int DohGetline(const DOH *ho) {
|
||||||
DohBase *h = (DohBase *) ho;
|
DohBase *h = (DohBase *) ho;
|
||||||
DohObjInfo *objinfo;
|
DohObjInfo *objinfo;
|
||||||
if (!h)
|
if (!h)
|
||||||
|
|
|
||||||
|
|
@ -237,9 +237,9 @@ extern DohIterator DohNext(DohIterator x);
|
||||||
|
|
||||||
/* Positional */
|
/* Positional */
|
||||||
|
|
||||||
extern int DohGetline(DOH *obj);
|
extern int DohGetline(const DOH *obj);
|
||||||
extern void DohSetline(DOH *obj, int line);
|
extern void DohSetline(DOH *obj, int line);
|
||||||
extern DOH *DohGetfile(DOH *obj);
|
extern DOH *DohGetfile(const DOH *obj);
|
||||||
extern void DohSetfile(DOH *obj, DOH *file);
|
extern void DohSetfile(DOH *obj, DOH *file);
|
||||||
|
|
||||||
/* String Methods */
|
/* String Methods */
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,8 @@ static String *cpp_include(const_String_or_char_ptr fn, int sysfile) {
|
||||||
Setattr(included_files, file, file);
|
Setattr(included_files, file, file);
|
||||||
}
|
}
|
||||||
if (!s) {
|
if (!s) {
|
||||||
Seek(fn, 0, SEEK_SET);
|
/* XXX(bhy) may not need the seek */
|
||||||
|
// Seek(fn, 0, SEEK_SET);
|
||||||
if (ignore_missing) {
|
if (ignore_missing) {
|
||||||
Swig_warning(WARN_PP_MISSING_FILE, Getfile(fn), Getline(fn), "Unable to find '%s'\n", fn);
|
Swig_warning(WARN_PP_MISSING_FILE, Getfile(fn), Getline(fn), "Unable to find '%s'\n", fn);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -261,7 +262,7 @@ void Preprocessor_error_as_warning(int a) {
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
const_String_or_char_ptr Macro_vararg_name(const_String_or_char_ptr str, const_String_or_char_ptr line) {
|
String *Macro_vararg_name(const_String_or_char_ptr str, const_String_or_char_ptr line) {
|
||||||
String *argname;
|
String *argname;
|
||||||
String *varargname;
|
String *varargname;
|
||||||
char *s, *dots;
|
char *s, *dots;
|
||||||
|
|
@ -295,18 +296,18 @@ Hash *Preprocessor_define(const_String_or_char_ptr _str, int swigmacro) {
|
||||||
List *arglist = 0;
|
List *arglist = 0;
|
||||||
int c, line;
|
int c, line;
|
||||||
int varargs = 0;
|
int varargs = 0;
|
||||||
const_String_or_char_ptr str = (const_String_or_char_ptr ) _str;
|
String *str;
|
||||||
|
|
||||||
assert(cpp);
|
assert(cpp);
|
||||||
assert(str);
|
assert(_str);
|
||||||
|
|
||||||
/* First make sure that string is actually a string */
|
/* First make sure that string is actually a string */
|
||||||
if (DohCheck(str)) {
|
if (DohCheck(_str)) {
|
||||||
s = Copy(str);
|
s = Copy(_str);
|
||||||
copy_location(str, s);
|
copy_location(_str, s);
|
||||||
str = s;
|
str = s;
|
||||||
} else {
|
} else {
|
||||||
str = NewString((char *) str);
|
str = NewString((char *) _str);
|
||||||
}
|
}
|
||||||
Seek(str, 0, SEEK_SET);
|
Seek(str, 0, SEEK_SET);
|
||||||
line = Getline(str);
|
line = Getline(str);
|
||||||
|
|
|
||||||
|
|
@ -683,7 +683,7 @@ String *Swig_cppdestructor_call(Node *n) {
|
||||||
*
|
*
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
String *Swig_cmemberset_call(const_String_or_char_ptr name, SwigType *type, const_String_or_char_ptr self, int varcref) {
|
String *Swig_cmemberset_call(const_String_or_char_ptr name, SwigType *type, String *self, int varcref) {
|
||||||
String *func;
|
String *func;
|
||||||
String *pname0 = Swig_cparm_name(0, 0);
|
String *pname0 = Swig_cparm_name(0, 0);
|
||||||
String *pname1 = Swig_cparm_name(0, 1);
|
String *pname1 = Swig_cparm_name(0, 1);
|
||||||
|
|
@ -718,7 +718,7 @@ String *Swig_cmemberset_call(const_String_or_char_ptr name, SwigType *type, cons
|
||||||
*
|
*
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
String *Swig_cmemberget_call(const_String_or_char_ptr name, SwigType *t, const_String_or_char_ptr self, int varcref) {
|
String *Swig_cmemberget_call(const_String_or_char_ptr name, SwigType *t, String *self, int varcref) {
|
||||||
String *func;
|
String *func;
|
||||||
String *call;
|
String *call;
|
||||||
String *pname0 = Swig_cparm_name(0, 0);
|
String *pname0 = Swig_cparm_name(0, 0);
|
||||||
|
|
|
||||||
|
|
@ -651,7 +651,7 @@ String *Swig_string_emangle(String *s) {
|
||||||
* In this case, "A::B". Returns NULL if there is no base.
|
* In this case, "A::B". Returns NULL if there is no base.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void Swig_scopename_split(String *s, String **rprefix, String **rlast) {
|
void Swig_scopename_split(const String *s, String **rprefix, String **rlast) {
|
||||||
char *tmp = Char(s);
|
char *tmp = Char(s);
|
||||||
char *c = tmp;
|
char *c = tmp;
|
||||||
char *cc = c;
|
char *cc = c;
|
||||||
|
|
@ -705,7 +705,7 @@ void Swig_scopename_split(String *s, String **rprefix, String **rlast) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
String *Swig_scopename_prefix(String *s) {
|
String *Swig_scopename_prefix(const String *s) {
|
||||||
char *tmp = Char(s);
|
char *tmp = Char(s);
|
||||||
char *c = tmp;
|
char *c = tmp;
|
||||||
char *cc = c;
|
char *cc = c;
|
||||||
|
|
@ -757,7 +757,7 @@ String *Swig_scopename_prefix(String *s) {
|
||||||
* case, "C".
|
* case, "C".
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
String *Swig_scopename_last(String *s) {
|
String *Swig_scopename_last(const String *s) {
|
||||||
char *tmp = Char(s);
|
char *tmp = Char(s);
|
||||||
char *c = tmp;
|
char *c = tmp;
|
||||||
char *cc = c;
|
char *cc = c;
|
||||||
|
|
@ -801,7 +801,7 @@ String *Swig_scopename_last(String *s) {
|
||||||
* In this case, "A". Returns NULL if there is no base.
|
* In this case, "A". Returns NULL if there is no base.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
String *Swig_scopename_first(String *s) {
|
String *Swig_scopename_first(const String *s) {
|
||||||
char *tmp = Char(s);
|
char *tmp = Char(s);
|
||||||
char *c = tmp;
|
char *c = tmp;
|
||||||
char *co = 0;
|
char *co = 0;
|
||||||
|
|
@ -851,7 +851,7 @@ String *Swig_scopename_first(String *s) {
|
||||||
* In this case, "B::C". Returns NULL if there is no suffix.
|
* In this case, "B::C". Returns NULL if there is no suffix.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
String *Swig_scopename_suffix(String *s) {
|
String *Swig_scopename_suffix(const String *s) {
|
||||||
char *tmp = Char(s);
|
char *tmp = Char(s);
|
||||||
char *c = tmp;
|
char *c = tmp;
|
||||||
char *co = 0;
|
char *co = 0;
|
||||||
|
|
@ -895,7 +895,7 @@ String *Swig_scopename_suffix(String *s) {
|
||||||
* Checks to see if a name is qualified with a scope name
|
* Checks to see if a name is qualified with a scope name
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int Swig_scopename_check(String *s) {
|
int Swig_scopename_check(const String *s) {
|
||||||
char *c = Char(s);
|
char *c = Char(s);
|
||||||
char *co = strstr(c, "operator ");
|
char *co = strstr(c, "operator ");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -600,7 +600,7 @@ static void merge_features(Hash *features, Node *n) {
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static
|
static
|
||||||
void features_get(Hash *features, String *tname, SwigType *decl, SwigType *ncdecl, Node *node) {
|
void features_get(Hash *features, const String *tname, SwigType *decl, SwigType *ncdecl, Node *node) {
|
||||||
Node *n = Getattr(features, tname);
|
Node *n = Getattr(features, tname);
|
||||||
#ifdef SWIG_DEBUG
|
#ifdef SWIG_DEBUG
|
||||||
Printf(stdout, " features_get: %s\n", tname);
|
Printf(stdout, " features_get: %s\n", tname);
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@ void Scanner_pushtoken(Scanner * s, int nt, const_String_or_char_ptr val) {
|
||||||
assert(s);
|
assert(s);
|
||||||
assert((nt >= 0) && (nt < SWIG_MAXTOKENS));
|
assert((nt >= 0) && (nt < SWIG_MAXTOKENS));
|
||||||
s->nexttoken = nt;
|
s->nexttoken = nt;
|
||||||
if (val != s->text) {
|
if ( Char(val) != Char(s->text) ) {
|
||||||
Clear(s->text);
|
Clear(s->text);
|
||||||
Append(s->text,val);
|
Append(s->text,val);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -185,7 +185,7 @@ extern "C" {
|
||||||
extern Typetab *SwigType_pop_scope(void);
|
extern Typetab *SwigType_pop_scope(void);
|
||||||
extern Typetab *SwigType_set_scope(Typetab *h);
|
extern Typetab *SwigType_set_scope(Typetab *h);
|
||||||
extern void SwigType_print_scope(Typetab *t);
|
extern void SwigType_print_scope(Typetab *t);
|
||||||
extern SwigType *SwigType_typedef_resolve(SwigType *t);
|
extern SwigType *SwigType_typedef_resolve(const SwigType *t);
|
||||||
extern SwigType *SwigType_typedef_resolve_all(SwigType *t);
|
extern SwigType *SwigType_typedef_resolve_all(SwigType *t);
|
||||||
extern SwigType *SwigType_typedef_qualified(SwigType *t);
|
extern SwigType *SwigType_typedef_qualified(SwigType *t);
|
||||||
extern int SwigType_istypedef(SwigType *t);
|
extern int SwigType_istypedef(SwigType *t);
|
||||||
|
|
@ -291,12 +291,12 @@ extern int ParmList_is_compactdefargs(ParmList *p);
|
||||||
extern void Swig_filename_correct(String *filename);
|
extern void Swig_filename_correct(String *filename);
|
||||||
extern String *Swig_string_escape(String *s);
|
extern String *Swig_string_escape(String *s);
|
||||||
extern String *Swig_string_mangle(const String *s);
|
extern String *Swig_string_mangle(const String *s);
|
||||||
extern void Swig_scopename_split(String *s, String **prefix, String **last);
|
extern void Swig_scopename_split(const String *s, String **prefix, String **last);
|
||||||
extern String *Swig_scopename_prefix(String *s);
|
extern String *Swig_scopename_prefix(const String *s);
|
||||||
extern String *Swig_scopename_last(String *s);
|
extern String *Swig_scopename_last(const String *s);
|
||||||
extern String *Swig_scopename_first(String *s);
|
extern String *Swig_scopename_first(const String *s);
|
||||||
extern String *Swig_scopename_suffix(String *s);
|
extern String *Swig_scopename_suffix(const String *s);
|
||||||
extern int Swig_scopename_check(String *s);
|
extern int Swig_scopename_check(const String *s);
|
||||||
extern String *Swig_string_lower(String *s);
|
extern String *Swig_string_lower(String *s);
|
||||||
extern String *Swig_string_upper(String *s);
|
extern String *Swig_string_upper(String *s);
|
||||||
extern String *Swig_string_title(String *s);
|
extern String *Swig_string_title(String *s);
|
||||||
|
|
|
||||||
|
|
@ -827,7 +827,7 @@ Node *Swig_symbol_add(const_String_or_char_ptr symname, Node *n) {
|
||||||
* verifying that a class hierarchy implements all pure virtual methods.
|
* verifying that a class hierarchy implements all pure virtual methods.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static Node *_symbol_lookup(String *name, Symtab *symtab, int (*check) (Node *n)) {
|
static Node *_symbol_lookup(const String *name, Symtab *symtab, int (*check) (Node *n)) {
|
||||||
Node *n;
|
Node *n;
|
||||||
List *inherit;
|
List *inherit;
|
||||||
Hash *sym = Getattr(symtab, "csymtab");
|
Hash *sym = Getattr(symtab, "csymtab");
|
||||||
|
|
@ -908,7 +908,7 @@ static Node *symbol_lookup(const_String_or_char_ptr name, Symtab *symtab, int (*
|
||||||
* symbol_lookup_qualified()
|
* symbol_lookup_qualified()
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static Node *symbol_lookup_qualified(const_String_or_char_ptr name, Symtab *symtab, String *prefix, int local, int (*checkfunc) (Node *n)) {
|
static Node *symbol_lookup_qualified(const_String_or_char_ptr name, Symtab *symtab, const String *prefix, int local, int (*checkfunc) (Node *n)) {
|
||||||
/* This is a little funky, we search by fully qualified names */
|
/* This is a little funky, we search by fully qualified names */
|
||||||
|
|
||||||
if (!symtab)
|
if (!symtab)
|
||||||
|
|
@ -928,6 +928,7 @@ static Node *symbol_lookup_qualified(const_String_or_char_ptr name, Symtab *symt
|
||||||
/* Make qualified name of current scope */
|
/* Make qualified name of current scope */
|
||||||
String *qalloc = 0;
|
String *qalloc = 0;
|
||||||
String *qname = Swig_symbol_qualifiedscopename(symtab);
|
String *qname = Swig_symbol_qualifiedscopename(symtab);
|
||||||
|
const String *cqname;
|
||||||
if (qname) {
|
if (qname) {
|
||||||
if (Len(qname)) {
|
if (Len(qname)) {
|
||||||
if (prefix && Len(prefix)) {
|
if (prefix && Len(prefix)) {
|
||||||
|
|
@ -937,10 +938,11 @@ static Node *symbol_lookup_qualified(const_String_or_char_ptr name, Symtab *symt
|
||||||
Append(qname, prefix);
|
Append(qname, prefix);
|
||||||
}
|
}
|
||||||
qalloc = qname;
|
qalloc = qname;
|
||||||
|
cqname = qname;
|
||||||
} else {
|
} else {
|
||||||
qname = prefix;
|
cqname = prefix;
|
||||||
}
|
}
|
||||||
st = Getattr(symtabs, qname);
|
st = Getattr(symtabs, cqname);
|
||||||
/* Found a scope match */
|
/* Found a scope match */
|
||||||
if (st) {
|
if (st) {
|
||||||
if (!name) {
|
if (!name) {
|
||||||
|
|
|
||||||
|
|
@ -1467,7 +1467,7 @@ static void Swig_typemap_emit_code_fragments(const_String_or_char_ptr op, Parm *
|
||||||
* given typemap type
|
* given typemap type
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
String *Swig_typemap_get_option(Hash *tm, String *name) {
|
String *Swig_typemap_get_option(Hash *tm, const_String_or_char_ptr name) {
|
||||||
Parm *kw = Getattr(tm, "kwargs");
|
Parm *kw = Getattr(tm, "kwargs");
|
||||||
while (kw) {
|
while (kw) {
|
||||||
String *kname = Getattr(kw, "name");
|
String *kname = Getattr(kw, "name");
|
||||||
|
|
|
||||||
|
|
@ -539,7 +539,7 @@ static SwigType *typedef_resolve(Typetab *s, String *base) {
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
/* #define SWIG_DEBUG */
|
/* #define SWIG_DEBUG */
|
||||||
SwigType *SwigType_typedef_resolve(SwigType *t) {
|
SwigType *SwigType_typedef_resolve(const SwigType *t) {
|
||||||
String *base;
|
String *base;
|
||||||
String *type = 0;
|
String *type = 0;
|
||||||
String *r = 0;
|
String *r = 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue