diff --git a/CHANGES.current b/CHANGES.current index 9449c2f4c..633745a6f 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -5,6 +5,28 @@ See the RELEASENOTES file for a summary of changes in each release. Version 2.0.2 (in progress) =========================== +2010-12-08: wsfulton + The name mangling for some complex types was incorrect. This is now fixed and results + in types being more interchangeable when there are typedefs involved. + namespace foo { + template class bar {}; + typedef int Integer; + void test2(bar *x) { return x; } + } + The typewrapper class for x changes from + SWIGTYPE_p_foo__barT_int_p_t to + SWIGTYPE_p_foo__barT_p_int_t. + + The name mangling involving qualifiers was not consistent, for example with the const qualifier in + MyTemplate< const ::DD * > the type wrapper class changes from + SWIGTYPE_p_MyTemplateT_DD_const_p_t to + SWIGTYPE_p_MyTemplateT_p_q_const__DD_t + + There a number of other subtle name mangling changes not listed. The runtime version + has hence been changed from 4 to 5. + +TODO: write a testcase in Java showing reference_type working or whatever I fixed in STL. + 2010-12-14: wsfulton Fix $basemangle expansion in array typemaps. For example if type is int *[3], $basemangle expands to _p_int. diff --git a/Source/Modules/lang.cxx b/Source/Modules/lang.cxx index 0110b6ea1..7f96007e3 100644 --- a/Source/Modules/lang.cxx +++ b/Source/Modules/lang.cxx @@ -3011,7 +3011,7 @@ Node *Language::symbolLookup(String *s, const_String_or_char_ptr scope) { * Tries to locate a class from a type definition * ----------------------------------------------------------------------------- */ -Node *Language::classLookup(SwigType *s) { +Node *Language::classLookup(const SwigType *s) { Node *n = 0; /* Look in hash of cached values */ diff --git a/Source/Modules/php.cxx b/Source/Modules/php.cxx index b95eaa7cd..43eee9ae6 100644 --- a/Source/Modules/php.cxx +++ b/Source/Modules/php.cxx @@ -126,7 +126,7 @@ static enum { } wrapperType = standard; extern "C" { - static void (*r_prevtracefunc) (SwigType *t, String *mangled, String *clientdata) = 0; + static void (*r_prevtracefunc) (const SwigType *t, String *mangled, String *clientdata) = 0; } static void SwigPHP_emit_resource_registrations() { @@ -2710,7 +2710,7 @@ static PHP *maininstance = 0; // We use this function to be able to write out zend_register_list_destructor_ex // lines for most things in the type table // NOTE: it's a function NOT A PHP::METHOD -extern "C" void typetrace(SwigType *ty, String *mangled, String *clientdata) { +extern "C" void typetrace(const SwigType *ty, String *mangled, String *clientdata) { Node *class_node; if (!zend_types) { zend_types = NewHash(); diff --git a/Source/Modules/swigmod.h b/Source/Modules/swigmod.h index d3074105f..208a7b026 100644 --- a/Source/Modules/swigmod.h +++ b/Source/Modules/swigmod.h @@ -213,7 +213,7 @@ public: virtual int addSymbol(const String *s, const Node *n, const_String_or_char_ptr scope = ""); /* Add symbol */ virtual void dumpSymbols(); virtual Node *symbolLookup(String *s, const_String_or_char_ptr scope = ""); /* Symbol lookup */ - virtual Node *classLookup(SwigType *s); /* Class lookup */ + virtual Node *classLookup(const SwigType *s); /* Class lookup */ virtual Node *enumLookup(SwigType *s); /* Enum lookup */ virtual int abstractClassTest(Node *n); /* Is class really abstract? */ virtual int is_assignable(Node *n); /* Is variable assignable? */ diff --git a/Source/Swig/stype.c b/Source/Swig/stype.c index 742b6232a..f3a1dc8ca 100644 --- a/Source/Swig/stype.c +++ b/Source/Swig/stype.c @@ -177,7 +177,7 @@ void SwigType_push(SwigType *t, String *cons) { * Testing functions for querying a raw datatype * ----------------------------------------------------------------------------- */ -int SwigType_ispointer_return(SwigType *t) { +int SwigType_ispointer_return(const SwigType *t) { char *c; int idx; if (!t) @@ -190,7 +190,7 @@ int SwigType_ispointer_return(SwigType *t) { return 0; } -int SwigType_isreference_return(SwigType *t) { +int SwigType_isreference_return(const SwigType *t) { char *c; int idx; if (!t) @@ -203,7 +203,7 @@ int SwigType_isreference_return(SwigType *t) { return 0; } -int SwigType_isconst(SwigType *t) { +int SwigType_isconst(const SwigType *t) { char *c; if (!t) return 0; @@ -229,7 +229,7 @@ int SwigType_isconst(SwigType *t) { return 0; } -int SwigType_ismutable(SwigType *t) { +int SwigType_ismutable(const SwigType *t) { int r; SwigType *qt = SwigType_typedef_resolve_all(t); if (SwigType_isreference(qt) || SwigType_isarray(qt)) { @@ -240,7 +240,7 @@ int SwigType_ismutable(SwigType *t) { return r ? 0 : 1; } -int SwigType_isenum(SwigType *t) { +int SwigType_isenum(const SwigType *t) { char *c = Char(t); if (!t) return 0; @@ -250,7 +250,7 @@ int SwigType_isenum(SwigType *t) { return 0; } -int SwigType_issimple(SwigType *t) { +int SwigType_issimple(const SwigType *t) { char *c = Char(t); if (!t) return 0; @@ -308,7 +308,7 @@ int SwigType_issimple(SwigType *t) { * r.q(const).enum SWIGTYPE * ----------------------------------------------------------------------------- */ -SwigType *SwigType_default_create(SwigType *ty) { +SwigType *SwigType_default_create(const SwigType *ty) { SwigType *r = 0; List *l; Iterator it; @@ -387,7 +387,7 @@ SwigType *SwigType_default_create(SwigType *ty) { * SWIGTYPE * ----------------------------------------------------------------------------- */ -SwigType *SwigType_default_deduce(SwigType *t) { +SwigType *SwigType_default_deduce(const SwigType *t) { SwigType *r = NewStringEmpty(); List *l; Iterator it; @@ -511,7 +511,7 @@ String *SwigType_namestr(const SwigType *t) { * Create a C string representation of a datatype. * ----------------------------------------------------------------------------- */ -String *SwigType_str(SwigType *s, const_String_or_char_ptr id) { +String *SwigType_str(const SwigType *s, const_String_or_char_ptr id) { String *result; String *element = 0, *nextelement; List *elements; @@ -606,12 +606,12 @@ String *SwigType_str(SwigType *s, const_String_or_char_ptr id) { } /* ----------------------------------------------------------------------------- - * SwigType_ltype(SwigType *ty) + * SwigType_ltype(const SwigType *ty) * * Create a locally assignable type * ----------------------------------------------------------------------------- */ -SwigType *SwigType_ltype(SwigType *s) { +SwigType *SwigType_ltype(const SwigType *s) { String *result; String *element; SwigType *td, *tc = 0; @@ -709,7 +709,7 @@ SwigType *SwigType_ltype(SwigType *s) { * with an equivalent assignable version. * -------------------------------------------------------------------- */ -String *SwigType_lstr(SwigType *s, const_String_or_char_ptr id) { +String *SwigType_lstr(const SwigType *s, const_String_or_char_ptr id) { String *result; SwigType *tc; @@ -726,10 +726,11 @@ String *SwigType_lstr(SwigType *s, const_String_or_char_ptr id) { * datatype printed by str(). * ----------------------------------------------------------------------------- */ -String *SwigType_rcaststr(SwigType *s, const_String_or_char_ptr name) { +String *SwigType_rcaststr(const SwigType *s, const_String_or_char_ptr name) { String *result, *cast; String *element = 0, *nextelement; - SwigType *td, *rs, *tc = 0; + SwigType *td, *tc = 0; + const SwigType *rs; List *elements; int nelements, i; int clear = 1; @@ -873,7 +874,7 @@ String *SwigType_rcaststr(SwigType *s, const_String_or_char_ptr name) { * Casts a variable from the real type to the local datatype. * ----------------------------------------------------------------------------- */ -String *SwigType_lcaststr(SwigType *s, const_String_or_char_ptr name) { +String *SwigType_lcaststr(const SwigType *s, const_String_or_char_ptr name) { String *result; result = NewStringEmpty(); @@ -899,9 +900,7 @@ String *SwigType_lcaststr(SwigType *s, const_String_or_char_ptr name) { return result; } - -/* keep old mangling since Java codes need it */ -String *SwigType_manglestr_default(SwigType *s) { +static String *manglestr_default(const SwigType *s) { char *c; String *result = 0; String *base = 0; @@ -909,17 +908,16 @@ String *SwigType_manglestr_default(SwigType *s) { SwigType *sr = SwigType_typedef_resolve_all(s); SwigType *sq = SwigType_typedef_qualified(sr); SwigType *ss = SwigType_remove_global_scope_prefix(sq); - - s = ss; + SwigType *type = ss; if (SwigType_istemplate(ss)) { SwigType *ty = Swig_symbol_template_deftype(ss, 0); Delete(ss); ss = ty; - s = ss; + type = ss; } - lt = SwigType_ltype(s); + lt = SwigType_ltype(type); result = SwigType_prefix(lt); base = SwigType_base(lt); @@ -972,8 +970,8 @@ String *SwigType_manglestr_default(SwigType *s) { return result; } -String *SwigType_manglestr(SwigType *s) { - return SwigType_manglestr_default(s); +String *SwigType_manglestr(const SwigType *s) { + return manglestr_default(s); } /* ----------------------------------------------------------------------------- @@ -1092,7 +1090,7 @@ SwigType *SwigType_remove_global_scope_prefix(const SwigType *t) { * Checks type declarators for a match * ----------------------------------------------------------------------------- */ -int SwigType_check_decl(SwigType *ty, const SwigType *decl) { +int SwigType_check_decl(const SwigType *ty, const SwigType *decl) { SwigType *t, *t1, *t2; int r; t = SwigType_typedef_resolve_all(ty); diff --git a/Source/Swig/swig.h b/Source/Swig/swig.h index 8058216c3..6607c333d 100644 --- a/Source/Swig/swig.h +++ b/Source/Swig/swig.h @@ -129,37 +129,37 @@ extern "C" { extern SwigType *SwigType_add_function(SwigType *t, ParmList *parms); extern SwigType *SwigType_add_template(SwigType *t, ParmList *parms); extern SwigType *SwigType_pop_function(SwigType *t); - extern ParmList *SwigType_function_parms(SwigType *t, Node *file_line_node); + extern ParmList *SwigType_function_parms(const SwigType *t, Node *file_line_node); extern List *SwigType_split(const SwigType *t); extern String *SwigType_pop(SwigType *t); - extern void SwigType_push(SwigType *t, SwigType *s); + extern void SwigType_push(SwigType *t, String *s); extern List *SwigType_parmlist(const SwigType *p); - extern String *SwigType_parm(String *p); - extern String *SwigType_str(SwigType *s, const_String_or_char_ptr id); - extern String *SwigType_lstr(SwigType *s, const_String_or_char_ptr id); - extern String *SwigType_rcaststr(SwigType *s, const_String_or_char_ptr id); - extern String *SwigType_lcaststr(SwigType *s, const_String_or_char_ptr id); - extern String *SwigType_manglestr(SwigType *t); - extern SwigType *SwigType_ltype(SwigType *t); - extern int SwigType_ispointer(SwigType *t); - extern int SwigType_ispointer_return(SwigType *t); - extern int SwigType_isfunctionpointer(SwigType *t); - extern int SwigType_ismemberpointer(SwigType *t); - extern int SwigType_isreference(SwigType *t); - extern int SwigType_isreference_return(SwigType *t); - extern int SwigType_isarray(SwigType *t); - extern int SwigType_prefix_is_simple_1D_array(SwigType *t); - extern int SwigType_isfunction(SwigType *t); - extern int SwigType_isqualifier(SwigType *t); - extern int SwigType_isconst(SwigType *t); - extern int SwigType_issimple(SwigType *t); - extern int SwigType_ismutable(SwigType *t); + extern String *SwigType_parm(const SwigType *p); + extern String *SwigType_str(const SwigType *s, const_String_or_char_ptr id); + extern String *SwigType_lstr(const SwigType *s, const_String_or_char_ptr id); + extern String *SwigType_rcaststr(const SwigType *s, const_String_or_char_ptr id); + extern String *SwigType_lcaststr(const SwigType *s, const_String_or_char_ptr id); + extern String *SwigType_manglestr(const SwigType *t); + extern SwigType *SwigType_ltype(const SwigType *t); + extern int SwigType_ispointer(const SwigType *t); + extern int SwigType_ispointer_return(const SwigType *t); + extern int SwigType_isfunctionpointer(const SwigType *t); + extern int SwigType_ismemberpointer(const SwigType *t); + extern int SwigType_isreference(const SwigType *t); + extern int SwigType_isreference_return(const SwigType *t); + extern int SwigType_isarray(const SwigType *t); + extern int SwigType_prefix_is_simple_1D_array(const SwigType *t); + extern int SwigType_isfunction(const SwigType *t); + extern int SwigType_isqualifier(const SwigType *t); + extern int SwigType_isconst(const SwigType *t); + extern int SwigType_issimple(const SwigType *t); + extern int SwigType_ismutable(const SwigType *t); extern int SwigType_isvarargs(const SwigType *t); extern int SwigType_istemplate(const SwigType *t); - extern int SwigType_isenum(SwigType *t); - extern int SwigType_check_decl(SwigType *t, const_String_or_char_ptr decl); - extern SwigType *SwigType_strip_qualifiers(SwigType *t); - extern SwigType *SwigType_strip_single_qualifier(SwigType *t); + extern int SwigType_isenum(const SwigType *t); + extern int SwigType_check_decl(const SwigType *t, const_String_or_char_ptr decl); + extern SwigType *SwigType_strip_qualifiers(const SwigType *t); + extern SwigType *SwigType_strip_single_qualifier(const SwigType *t); extern SwigType *SwigType_functionpointer_decompose(SwigType *t); extern String *SwigType_base(const SwigType *t); extern String *SwigType_namestr(const SwigType *t); @@ -168,27 +168,26 @@ extern "C" { extern String *SwigType_istemplate_templateprefix(const SwigType *t); extern String *SwigType_templateargs(const SwigType *t); extern String *SwigType_prefix(const SwigType *t); - extern int SwigType_array_ndim(SwigType *t); - extern String *SwigType_array_getdim(SwigType *t, int n); + extern int SwigType_array_ndim(const SwigType *t); + extern String *SwigType_array_getdim(const SwigType *t, int n); extern void SwigType_array_setdim(SwigType *t, int n, const_String_or_char_ptr rep); - extern SwigType *SwigType_array_type(SwigType *t); - extern String *SwigType_default(SwigType *t); - extern SwigType *SwigType_default_create(SwigType *ty); - extern SwigType *SwigType_default_deduce(SwigType *t); + extern SwigType *SwigType_array_type(const SwigType *t); + extern SwigType *SwigType_default_create(const SwigType *ty); + extern SwigType *SwigType_default_deduce(const SwigType *t); extern void SwigType_typename_replace(SwigType *t, String *pat, String *rep); extern SwigType *SwigType_remove_global_scope_prefix(const SwigType *t); - extern SwigType *SwigType_alttype(SwigType *t, int ltmap); + extern SwigType *SwigType_alttype(const SwigType *t, int ltmap); extern void SwigType_template_defargs(Parm *parms, Parm *targs, Symtab *tscope, Symtab *tsdecl); extern SwigType *SwigType_template_deftype(const SwigType *type, Symtab *tscope); /* --- Type-system managment --- */ extern void SwigType_typesystem_init(void); - extern int SwigType_typedef(SwigType *type, const_String_or_char_ptr name); + extern int SwigType_typedef(const SwigType *type, const_String_or_char_ptr name); extern int SwigType_typedef_class(const_String_or_char_ptr name); extern int SwigType_typedef_using(const_String_or_char_ptr qname); extern void SwigType_inherit(String *subclass, String *baseclass, String *cast, String *conversioncode); - extern int SwigType_issubtype(SwigType *subtype, SwigType *basetype); + extern int SwigType_issubtype(const SwigType *subtype, const SwigType *basetype); extern void SwigType_scope_alias(String *aliasname, Typetab *t); extern void SwigType_using_scope(Typetab *t); extern void SwigType_new_scope(const_String_or_char_ptr name); @@ -197,17 +196,17 @@ extern "C" { extern Typetab *SwigType_set_scope(Typetab *h); extern void SwigType_print_scope(Typetab *t); extern SwigType *SwigType_typedef_resolve(const SwigType *t); - extern SwigType *SwigType_typedef_resolve_all(SwigType *t); - extern SwigType *SwigType_typedef_qualified(SwigType *t); - extern int SwigType_istypedef(SwigType *t); - extern int SwigType_isclass(SwigType *t); + extern SwigType *SwigType_typedef_resolve_all(const SwigType *t); + extern SwigType *SwigType_typedef_qualified(const SwigType *t); + extern int SwigType_istypedef(const SwigType *t); + extern int SwigType_isclass(const SwigType *t); extern void SwigType_attach_symtab(Symtab *syms); - extern void SwigType_remember(SwigType *t); - extern void SwigType_remember_clientdata(SwigType *t, const_String_or_char_ptr clientdata); + extern void SwigType_remember(const SwigType *t); + extern void SwigType_remember_clientdata(const SwigType *t, const_String_or_char_ptr clientdata); extern void SwigType_remember_mangleddata(String *mangled, const_String_or_char_ptr clientdata); - extern void (*SwigType_remember_trace(void (*tf) (SwigType *, String *, String *))) (SwigType *, String *, String *); + extern void (*SwigType_remember_trace(void (*tf) (const SwigType *, String *, String *))) (const SwigType *, String *, String *); extern void SwigType_emit_type_table(File *f_headers, File *f_table); - extern int SwigType_type(SwigType *t); + extern int SwigType_type(const SwigType *t); /* --- Symbol table module --- */ @@ -240,7 +239,7 @@ extern "C" { extern void Swig_symbol_inherit(Symtab *tab); extern SwigType *Swig_symbol_type_qualify(const SwigType *ty, Symtab *tab); extern String *Swig_symbol_string_qualify(String *s, Symtab *tab); - extern SwigType *Swig_symbol_typedef_reduce(SwigType *ty, Symtab *tab); + extern SwigType *Swig_symbol_typedef_reduce(const SwigType *ty, Symtab *tab); extern ParmList *Swig_symbol_template_defargs(Parm *parms, Parm *targs, Symtab *tscope, Symtab *tsdecl); extern SwigType *Swig_symbol_template_deftype(const SwigType *type, Symtab *tscope); diff --git a/Source/Swig/symbol.c b/Source/Swig/symbol.c index b5e114683..4ec18e8c7 100644 --- a/Source/Swig/symbol.c +++ b/Source/Swig/symbol.c @@ -1642,7 +1642,7 @@ SwigType *Swig_symbol_template_reduce(SwigType *qt, Symtab *ntab) { * Chase a typedef through symbol tables looking for a match. * ----------------------------------------------------------------------------- */ -SwigType *Swig_symbol_typedef_reduce(SwigType *ty, Symtab *tab) { +SwigType *Swig_symbol_typedef_reduce(const SwigType *ty, Symtab *tab) { SwigType *prefix, *base; Node *n; String *nt; diff --git a/Source/Swig/typeobj.c b/Source/Swig/typeobj.c index 074bbf904..dd8d901e0 100644 --- a/Source/Swig/typeobj.c +++ b/Source/Swig/typeobj.c @@ -210,7 +210,7 @@ SwigType *SwigType_pop(SwigType *t) { * Returns the parameter of an operator as a string * ----------------------------------------------------------------------------- */ -String *SwigType_parm(SwigType *t) { +String *SwigType_parm(const SwigType *t) { char *start, *c; int nparens = 0; @@ -362,7 +362,7 @@ SwigType *SwigType_del_pointer(SwigType *t) { return t; } -int SwigType_ispointer(SwigType *t) { +int SwigType_ispointer(const SwigType *t) { char *c; if (!t) return 0; @@ -404,7 +404,7 @@ SwigType *SwigType_del_reference(SwigType *t) { return t; } -int SwigType_isreference(SwigType *t) { +int SwigType_isreference(const SwigType *t) { char *c; if (!t) return 0; @@ -494,7 +494,7 @@ SwigType *SwigType_del_qualifier(SwigType *t) { return t; } -int SwigType_isqualifier(SwigType *t) { +int SwigType_isqualifier(const SwigType *t) { char *c; if (!t) return 0; @@ -509,7 +509,7 @@ int SwigType_isqualifier(SwigType *t) { * Function Pointers * ----------------------------------------------------------------------------- */ -int SwigType_isfunctionpointer(SwigType *t) { +int SwigType_isfunctionpointer(const SwigType *t) { char *c; if (!t) return 0; @@ -562,7 +562,7 @@ SwigType *SwigType_del_memberpointer(SwigType *t) { return t; } -int SwigType_ismemberpointer(SwigType *t) { +int SwigType_ismemberpointer(const SwigType *t) { char *c; if (!t) return 0; @@ -606,7 +606,7 @@ SwigType *SwigType_del_array(SwigType *t) { return t; } -int SwigType_isarray(SwigType *t) { +int SwigType_isarray(const SwigType *t) { char *c; if (!t) return 0; @@ -622,7 +622,7 @@ int SwigType_isarray(SwigType *t) { * Determine if the type is a 1D array type that is treated as a pointer within SWIG * eg Foo[], Foo[3] return true, but Foo[3][3], Foo*[], Foo*[3], Foo**[] return false */ -int SwigType_prefix_is_simple_1D_array(SwigType *t) { +int SwigType_prefix_is_simple_1D_array(const SwigType *t) { char *c = Char(t); if (c && (strncmp(c, "a(", 2) == 0)) { @@ -648,7 +648,7 @@ SwigType *SwigType_pop_arrays(SwigType *t) { } /* Return number of array dimensions */ -int SwigType_array_ndim(SwigType *t) { +int SwigType_array_ndim(const SwigType *t) { int ndim = 0; char *c = Char(t); @@ -661,7 +661,7 @@ int SwigType_array_ndim(SwigType *t) { } /* Get nth array dimension */ -String *SwigType_array_getdim(SwigType *t, int n) { +String *SwigType_array_getdim(const SwigType *t, int n) { char *c = Char(t); while (c && (strncmp(c, "a(", 2) == 0) && (n > 0)) { c = strchr(c, '.'); @@ -713,7 +713,7 @@ void SwigType_array_setdim(SwigType *t, int n, const_String_or_char_ptr rep) { } /* Return base type of an array */ -SwigType *SwigType_array_type(SwigType *ty) { +SwigType *SwigType_array_type(const SwigType *ty) { SwigType *t; t = Copy(ty); while (SwigType_isarray(t)) { @@ -771,7 +771,7 @@ SwigType *SwigType_pop_function(SwigType *t) { return g; } -int SwigType_isfunction(SwigType *t) { +int SwigType_isfunction(const SwigType *t) { char *c; if (!t) { return 0; @@ -793,7 +793,7 @@ int SwigType_isfunction(SwigType *t) { /* Create a list of parameters from the type t, using the file_line_node Node for * file and line numbering for the parameters */ -ParmList *SwigType_function_parms(SwigType *t, Node *file_line_node) { +ParmList *SwigType_function_parms(const SwigType *t, Node *file_line_node) { List *l = SwigType_parmlist(t); Hash *p, *pp = 0, *firstp = 0; Iterator o; @@ -1094,7 +1094,7 @@ String *SwigType_prefix(const SwigType *t) { * Strip all qualifiers from a type and return a new type * ----------------------------------------------------------------------------- */ -SwigType *SwigType_strip_qualifiers(SwigType *t) { +SwigType *SwigType_strip_qualifiers(const SwigType *t) { static Hash *memoize_stripped = 0; SwigType *r; List *l; @@ -1138,7 +1138,7 @@ SwigType *SwigType_strip_qualifiers(SwigType *t) { * r.p.int => r.p.int * ----------------------------------------------------------------------------- */ -SwigType *SwigType_strip_single_qualifier(SwigType *t) { +SwigType *SwigType_strip_single_qualifier(const SwigType *t) { static Hash *memoize_stripped = 0; SwigType *r = 0; List *l; diff --git a/Source/Swig/typesys.c b/Source/Swig/typesys.c index 2436e005c..ec4376af4 100644 --- a/Source/Swig/typesys.c +++ b/Source/Swig/typesys.c @@ -112,7 +112,7 @@ static Hash *typedef_resolve_cache = 0; static Hash *typedef_all_cache = 0; static Hash *typedef_qualified_cache = 0; -static Typetab *SwigType_find_scope(Typetab *s, String *nameprefix); +static Typetab *SwigType_find_scope(Typetab *s, const SwigType *nameprefix); /* common attribute keys, to avoid calling find_key all the times */ @@ -167,7 +167,7 @@ void SwigType_typesystem_init() { * already defined. * ----------------------------------------------------------------------------- */ -int SwigType_typedef(SwigType *type, const_String_or_char_ptr name) { +int SwigType_typedef(const SwigType *type, const_String_or_char_ptr name) { if (Getattr(current_typetab, name)) return -1; /* Already defined */ if (Strcmp(type, name) == 0) { /* Can't typedef a name to itself */ @@ -414,7 +414,7 @@ void SwigType_print_scope(Typetab *t) { } } -static Typetab *SwigType_find_scope(Typetab *s, String *nameprefix) { +static Typetab *SwigType_find_scope(Typetab *s, const SwigType *nameprefix) { Typetab *ss; String *nnameprefix = 0; static int check_parent = 1; @@ -806,7 +806,7 @@ return_result: * Fully resolve a type down to its most basic datatype * ----------------------------------------------------------------------------- */ -SwigType *SwigType_typedef_resolve_all(SwigType *t) { +SwigType *SwigType_typedef_resolve_all(const SwigType *t) { SwigType *n; SwigType *r; @@ -848,7 +848,7 @@ SwigType *SwigType_typedef_resolve_all(SwigType *t) { * scope, it is left in place. * ----------------------------------------------------------------------------- */ -SwigType *SwigType_typedef_qualified(SwigType *t) { +SwigType *SwigType_typedef_qualified(const SwigType *t) { List *elements; String *result; int i, len; @@ -1049,7 +1049,7 @@ SwigType *SwigType_typedef_qualified(SwigType *t) { * Checks a typename to see if it is a typedef. * ----------------------------------------------------------------------------- */ -int SwigType_istypedef(SwigType *t) { +int SwigType_istypedef(const SwigType *t) { String *type; type = SwigType_typedef_resolve(t); @@ -1150,7 +1150,7 @@ int SwigType_typedef_using(const_String_or_char_ptr name) { * a class. * ----------------------------------------------------------------------------- */ -int SwigType_isclass(SwigType *t) { +int SwigType_isclass(const SwigType *t) { SwigType *qty, *qtys; int isclass = 0; @@ -1186,7 +1186,7 @@ int SwigType_isclass(SwigType *t) { * everything is based on typemaps. * ----------------------------------------------------------------------------- */ -int SwigType_type(SwigType *t) { +int SwigType_type(const SwigType *t) { char *c; /* Check for the obvious stuff */ c = Char(t); @@ -1295,7 +1295,7 @@ int SwigType_type(SwigType *t) { * %feature("valuewrapper"). * ----------------------------------------------------------------------------- */ -SwigType *SwigType_alttype(SwigType *t, int local_tmap) { +SwigType *SwigType_alttype(const SwigType *t, int local_tmap) { Node *n; SwigType *w = 0; int use_wrapper = 0; @@ -1413,7 +1413,7 @@ static Hash *r_clientdata = 0; /* Hash mapping resolved types to client data static Hash *r_mangleddata = 0; /* Hash mapping mangled types to client data */ static Hash *r_remembered = 0; /* Hash of types we remembered already */ -static void (*r_tracefunc) (SwigType *t, String *mangled, String *clientdata) = 0; +static void (*r_tracefunc) (const SwigType *t, String *mangled, String *clientdata) = 0; void SwigType_remember_mangleddata(String *mangled, const_String_or_char_ptr clientdata) { if (!r_mangleddata) { @@ -1423,7 +1423,7 @@ void SwigType_remember_mangleddata(String *mangled, const_String_or_char_ptr cli } -void SwigType_remember_clientdata(SwigType *t, const_String_or_char_ptr clientdata) { +void SwigType_remember_clientdata(const SwigType *t, const_String_or_char_ptr clientdata) { String *mt; SwigType *lt; Hash *h; @@ -1536,12 +1536,12 @@ void SwigType_remember_clientdata(SwigType *t, const_String_or_char_ptr clientda } } -void SwigType_remember(SwigType *ty) { +void SwigType_remember(const SwigType *ty) { SwigType_remember_clientdata(ty, 0); } -void (*SwigType_remember_trace(void (*tf) (SwigType *, String *, String *))) (SwigType *, String *, String *) { - void (*o) (SwigType *, String *, String *) = r_tracefunc; +void (*SwigType_remember_trace(void (*tf) (const SwigType *, String *, String *))) (const SwigType *, String *, String *) { + void (*o) (const SwigType *, String *, String *) = r_tracefunc; r_tracefunc = tf; return o; } @@ -1713,7 +1713,7 @@ void SwigType_inherit(String *derived, String *base, String *cast, String *conve * Determines if a t1 is a subtype of t2, ie, is t1 derived from t2 * ----------------------------------------------------------------------------- */ -int SwigType_issubtype(SwigType *t1, SwigType *t2) { +int SwigType_issubtype(const SwigType *t1, const SwigType *t2) { SwigType *ft1, *ft2; String *b1, *b2; Hash *h;