diff --git a/CHANGES.current b/CHANGES.current index 1e55f9207..e22a31256 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -1,6 +1,10 @@ Version 1.3.32 (in progress) ============================ +01/03/2007: beazley + [Internals]. Use of swigkeys.c/.h variables is revoked. Please use + simple strings for attribute names. + 12/30/2006: beazley Internal API functions HashGetAttr() and HashCheckAttr() have been revoked. Please use Getattr() to retrieve attributes. The function Checkattr() can diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y index dc191836f..c216cd97f 100644 --- a/Source/CParse/parser.y +++ b/Source/CParse/parser.y @@ -16,7 +16,6 @@ char cvsroot_parser_y[] = "$Id$"; #include "swig.h" -#include "swigkeys.h" #include "cparse.h" #include "preprocessor.h" #include @@ -259,7 +258,7 @@ static String *make_unnamed() { /* Return if the node is a friend declaration */ static int is_friend(Node *n) { - return Cmp(Getattr(n,k_storage),"friend") == 0; + return Cmp(Getattr(n,"storage"),"friend") == 0; } static int is_operator(String *name) { @@ -288,7 +287,7 @@ static void add_symbols(Node *n) { } if (inclass) { - String *name = Getattr(n, k_name); + String *name = Getattr(n, "name"); if (isfriend) { /* for friends, we need to add the scopename if needed */ String *prefix = name ? Swig_scopename_prefix(name) : 0; @@ -298,15 +297,15 @@ static void add_symbols(Node *n) { if (!prefix) { if (name && !is_operator(name) && Namespaceprefix) { String *nname = NewStringf("%s::%s", Namespaceprefix, name); - Setattr(n,k_name,nname); + Setattr(n,"name",nname); Delete(nname); } } else { Symtab *st = Swig_symbol_getscope(prefix); - String *ns = st ? Getattr(st,k_name) : prefix; + String *ns = st ? Getattr(st,"name") : prefix; String *base = Swig_scopename_last(name); String *nname = NewStringf("%s::%s", ns, base); - Setattr(n,k_name,nname); + Setattr(n,"name",nname); Delete(nname); Delete(base); Delete(prefix); @@ -325,7 +324,7 @@ static void add_symbols(Node *n) { if (prefix) { if (Classprefix && (Equal(prefix,Classprefix))) { String *base = Swig_scopename_last(name); - Setattr(n,k_name,base); + Setattr(n,"name",base); Delete(base); } Delete(prefix); @@ -339,13 +338,13 @@ static void add_symbols(Node *n) { if ((cplus_mode != CPLUS_PUBLIC)) { int only_csymbol = 1; if (cplus_mode == CPLUS_PROTECTED) { - Setattr(n,k_access, "protected"); + Setattr(n,"access", "protected"); only_csymbol = !Swig_need_protected(n); } else { /* private are needed only when they are pure virtuals */ - Setattr(n,k_access, "private"); - if ((Cmp(Getattr(n,k_storage),"virtual") == 0) - && (Cmp(Getattr(n,k_value),"0") == 0)) { + Setattr(n,"access", "private"); + if ((Cmp(Getattr(n,"storage"),"virtual") == 0) + && (Cmp(Getattr(n,"value"),"0") == 0)) { only_csymbol = !Swig_need_protected(n); } } @@ -357,25 +356,25 @@ static void add_symbols(Node *n) { continue; } } else { - Setattr(n,k_access, "public"); + Setattr(n,"access", "public"); } } - if (Getattr(n,k_symname)) { + if (Getattr(n,"sym:name")) { n = nextSibling(n); continue; } - decl = Getattr(n,k_decl); + decl = Getattr(n,"decl"); if (!SwigType_isfunction(decl)) { - String *name = Getattr(n,k_name); + String *name = Getattr(n,"name"); String *makename = Getattr(n,"parser:makename"); if (iscdecl) { - String *storage = Getattr(n, k_storage); + String *storage = Getattr(n, "storage"); if (Cmp(storage,"typedef") == 0) { - Setattr(n,k_kind,"typedef"); + Setattr(n,"kind","typedef"); } else { SwigType *type = Getattr(n,"type"); - String *value = Getattr(n,k_value); - Setattr(n,k_kind,"variable"); + String *value = Getattr(n,"value"); + Setattr(n,"kind","variable"); if (value && Len(value)) { Setattr(n,"hasvalue","1"); } @@ -409,17 +408,17 @@ static void add_symbols(Node *n) { } if (!symname) { - symname = Copy(Getattr(n,k_unnamed)); + symname = Copy(Getattr(n,"unnamed")); } if (symname) { wrn = Swig_name_warning(n, Namespaceprefix, symname,0); } } else { - String *name = Getattr(n,k_name); + String *name = Getattr(n,"name"); SwigType *fdecl = Copy(decl); SwigType *fun = SwigType_pop_function(fdecl); if (iscdecl) { - Setattr(n,k_kind,"function"); + Setattr(n,"kind","function"); } Swig_features_get(Swig_cparse_features(),Namespaceprefix,name,fun,n); @@ -461,8 +460,8 @@ static void add_symbols(Node *n) { if (c != n) { /* symbol conflict attempting to add in the new symbol */ - if (Getattr(n,k_symweak)) { - Setattr(n,k_symname,symname); + if (Getattr(n,"sym:weak")) { + Setattr(n,"sym:name",symname); } else { String *e = NewStringEmpty(); String *en = NewStringEmpty(); @@ -475,12 +474,12 @@ static void add_symbols(Node *n) { Printf(en,"Redundant redeclaration of '%s'",symname); Printf(ec,"previous declaration of '%s'",symname); } - if (Cmp(symname,Getattr(n,k_name))) { - Printf(en," (Renamed from '%s')", SwigType_namestr(Getattr(n,k_name))); + if (Cmp(symname,Getattr(n,"name"))) { + Printf(en," (Renamed from '%s')", SwigType_namestr(Getattr(n,"name"))); } Printf(en,","); - if (Cmp(symname,Getattr(c,k_name))) { - Printf(ec," (Renamed from '%s')", SwigType_namestr(Getattr(c,k_name))); + if (Cmp(symname,Getattr(c,"name"))) { + Printf(ec," (Renamed from '%s')", SwigType_namestr(Getattr(c,"name"))); } Printf(ec,"."); SWIG_WARN_NODE_BEGIN(n); @@ -494,7 +493,7 @@ static void add_symbols(Node *n) { SWIG_WARN_NODE_END(n); Printf(e,"%s:%d:%s\n%s:%d:%s\n",Getfile(n),Getline(n),en, Getfile(c),Getline(c),ec); - Setattr(n,k_error,e); + Setattr(n,"error",e); Delete(e); Delete(en); Delete(ec); @@ -526,7 +525,7 @@ static void add_symbols_copy(Node *n) { char *cnodeType = Char(nodeType(n)); if (strcmp(cnodeType,"access") == 0) { - String *kind = Getattr(n,k_kind); + String *kind = Getattr(n,"kind"); if (Strcmp(kind,"public") == 0) { cplus_mode = CPLUS_PUBLIC; } else if (Strcmp(kind,"private") == 0) { @@ -538,30 +537,30 @@ static void add_symbols_copy(Node *n) { continue; } - add_oldname = Getattr(n,k_symname); + add_oldname = Getattr(n,"sym:name"); if ((add_oldname) || (Getattr(n,"sym:needs_symtab"))) { if (add_oldname) { DohIncref(add_oldname); /* Disable this, it prevents %rename to work with templates */ /* If already renamed, we used that name */ /* - if (Strcmp(add_oldname, Getattr(n,k_name)) != 0) { + if (Strcmp(add_oldname, Getattr(n,"name")) != 0) { Delete(yyrename); yyrename = Copy(add_oldname); } */ } Delattr(n,"sym:needs_symtab"); - Delattr(n,k_symname); + Delattr(n,"sym:name"); add_only_one = 1; add_symbols(n); - if (Getattr(n,k_partialargs)) { - Swig_symbol_cadd(Getattr(n,k_partialargs),n); + if (Getattr(n,"partialargs")) { + Swig_symbol_cadd(Getattr(n,"partialargs"),n); } add_only_one = 0; - name = Getattr(n,k_name); + name = Getattr(n,"name"); if (Getattr(n,"requires_symtab")) { Swig_symbol_newscope(); Swig_symbol_setscopename(name); @@ -571,7 +570,7 @@ static void add_symbols_copy(Node *n) { if (strcmp(cnodeType,"class") == 0) { inclass = 1; current_class = n; - if (Strcmp(Getattr(n,k_kind),"class") == 0) { + if (Strcmp(Getattr(n,"kind"),"class") == 0) { cplus_mode = CPLUS_PRIVATE; } else { cplus_mode = CPLUS_PUBLIC; @@ -586,7 +585,7 @@ static void add_symbols_copy(Node *n) { cplus_mode = emode; } if (Getattr(n,"requires_symtab")) { - Setattr(n,k_symtab, Swig_symbol_popscope()); + Setattr(n,"symtab", Swig_symbol_popscope()); Delattr(n,"requires_symtab"); Delete(Namespaceprefix); Namespaceprefix = Swig_symbol_qualifiedscopename(0); @@ -626,23 +625,23 @@ static void merge_extensions(Node *cls, Node *am) { while (n) { String *symname; if (Strcmp(nodeType(n),"constructor") == 0) { - symname = Getattr(n,k_symname); + symname = Getattr(n,"sym:name"); if (symname) { - if (Strcmp(symname,Getattr(n,k_name)) == 0) { + if (Strcmp(symname,Getattr(n,"name")) == 0) { /* If the name and the sym:name of a constructor are the same, then it hasn't been renamed. However---the name of the class itself might have been renamed so we need to do a consistency check here */ - if (Getattr(cls,k_symname)) { - Setattr(n,k_symname, Getattr(cls,k_symname)); + if (Getattr(cls,"sym:name")) { + Setattr(n,"sym:name", Getattr(cls,"sym:name")); } } } } - symname = Getattr(n,k_symname); + symname = Getattr(n,"sym:name"); DohIncref(symname); - if ((symname) && (!Getattr(n,k_error))) { + if ((symname) && (!Getattr(n,"error"))) { /* Remove node from its symbol table */ Swig_symbol_remove(n); csym = Swig_symbol_add(symname,n); @@ -659,7 +658,7 @@ static void merge_extensions(Node *cls, Node *am) { SWIG_WARN_NODE_END(n); Printf(e,"%s:%d:%s\n%s:%d:%s\n",Getfile(csym),Getline(csym),ec, Getfile(n),Getline(n),en); - Setattr(csym,k_error,e); + Setattr(csym,"error",e); Delete(e); Delete(en); Delete(ec); @@ -719,24 +718,24 @@ static List *pure_abstract(Node *n) { List *abs = 0; while (n) { if (Cmp(nodeType(n),"cdecl") == 0) { - String *decl = Getattr(n,k_decl); + String *decl = Getattr(n,"decl"); if (SwigType_isfunction(decl)) { - String *init = Getattr(n,k_value); + String *init = Getattr(n,"value"); if (Cmp(init,"0") == 0) { if (!abs) { abs = NewList(); } Append(abs,n); - Setattr(n,k_abstract,"1"); + Setattr(n,"abstract","1"); } } } else if (Cmp(nodeType(n),"destructor") == 0) { - if (Cmp(Getattr(n,k_value),"0") == 0) { + if (Cmp(Getattr(n,"value"),"0") == 0) { if (!abs) { abs = NewList(); } Append(abs,n); - Setattr(n,k_abstract,"1"); + Setattr(n,"abstract","1"); } } n = nextSibling(n); @@ -785,10 +784,10 @@ static List *make_inherit_list(String *clsname, List *names) { if (s) { while (s && (Strcmp(nodeType(s),"class") != 0)) { /* Not a class. Could be a typedef though. */ - String *storage = Getattr(s,k_storage); + String *storage = Getattr(s,"storage"); if (storage && (Strcmp(storage,"typedef") == 0)) { - String *nn = Getattr(s,k_type); - s = Swig_symbol_clookup(nn,Getattr(s,k_symsymtab)); + String *nn = Getattr(s,"type"); + s = Swig_symbol_clookup(nn,Getattr(s,"sym:symtab")); } else { break; } @@ -797,10 +796,10 @@ static List *make_inherit_list(String *clsname, List *names) { String *q = Swig_symbol_qualified(s); Append(bases,s); if (q) { - base = NewStringf("%s::%s", q, Getattr(s,k_name)); + base = NewStringf("%s::%s", q, Getattr(s,"name")); Delete(q); } else { - base = NewString(Getattr(s,k_name)); + base = NewString(Getattr(s,"name")); } } else { base = NewString(n); @@ -851,11 +850,11 @@ static String *resolve_node_scope(String *cname) { if (!prefix || (Len(prefix) == 0)) { /* Use the global scope, but we need to add a 'global' namespace. */ if (!gscope) gscope = get_global_scope(); - /* note that this namespace is not the k_unnamed one, - and we don't use Setattr(nscope,k_name, ""), + /* note that this namespace is not the "unnamed" one, + and we don't use Setattr(nscope,"name", ""), because the unnamed namespace is private */ - nscope = new_node(k_namespace); - Setattr(nscope,k_symtab, gscope);; + nscope = new_node("namespace"); + Setattr(nscope,"symtab", gscope);; nscope_inner = nscope; return base; } @@ -864,7 +863,7 @@ static String *resolve_node_scope(String *cname) { if (!ns) { Swig_error(cparse_file,cparse_line,"Undefined scope '%s'\n", prefix); } else { - Symtab *nstab = Getattr(ns,k_symtab); + Symtab *nstab = Getattr(ns,"symtab"); if (!nstab) { Swig_error(cparse_file,cparse_line, "'%s' is not defined as a valid scope.\n", prefix); @@ -902,8 +901,8 @@ static String *resolve_node_scope(String *cname) { ns1 = Swig_symbol_clookup(sname,0); assert(ns1); if (Strcmp(nodeType(ns1),"namespace") == 0) { - if (Getattr(ns1,k_alias)) { - ns1 = Getattr(ns1,k_namespace); + if (Getattr(ns1,"alias")) { + ns1 = Getattr(ns1,"namespace"); } } else { /* now this last part is a class */ @@ -918,7 +917,7 @@ static String *resolve_node_scope(String *cname) { /* we get the 'inner' class */ nscope_inner = Swig_symbol_clookup(sname,0); /* set the scope to the inner class */ - Swig_symbol_setscope(Getattr(nscope_inner,k_symtab)); + Swig_symbol_setscope(Getattr(nscope_inner,"symtab")); /* save the last namespace prefix */ Delete(Namespaceprefix); Namespaceprefix = Swig_symbol_qualifiedscopename(0); @@ -927,14 +926,14 @@ static String *resolve_node_scope(String *cname) { } /* here we just populate the namespace tree as usual */ ns2 = new_node("namespace"); - Setattr(ns2,k_name,sname); - Setattr(ns2,k_symtab, Getattr(ns1,k_symtab)); + Setattr(ns2,"name",sname); + Setattr(ns2,"symtab", Getattr(ns1,"symtab")); add_symbols(ns2); - Swig_symbol_setscope(Getattr(ns1,k_symtab)); + Swig_symbol_setscope(Getattr(ns1,"symtab")); Delete(Namespaceprefix); Namespaceprefix = Swig_symbol_qualifiedscopename(0); if (nscope_inner) { - if (Getattr(nscope_inner,k_symtab) != Getattr(ns2,k_symtab)) { + if (Getattr(nscope_inner,"symtab") != Getattr(ns2,"symtab")) { appendChild(nscope_inner,ns2); Delete(ns2); } @@ -1008,13 +1007,13 @@ static Node *dump_nested(const char *parent) { /* Add the appropriate declaration to the C++ processor */ retx = new_node("cdecl"); - Setattr(retx,k_name,n->name); + Setattr(retx,"name",n->name); nt = Copy(n->type); - Setattr(retx,k_type,nt); + Setattr(retx,"type",nt); Delete(nt); Setattr(retx,"nested",parent); if (n->unnamed) { - Setattr(retx,k_unnamed,"1"); + Setattr(retx,"unnamed","1"); } add_symbols(retx); @@ -1027,8 +1026,8 @@ static Node *dump_nested(const char *parent) { /* Insert a forward class declaration */ /* Disabled: [ 597599 ] union in class: incorrect scope retx = new_node("classforward"); - Setattr(retx,k_kind,n->kind); - Setattr(retx,k_name,Copy(n->type)); + Setattr(retx,"kind",n->kind); + Setattr(retx,"name",Copy(n->type)); Setattr(retx,"sym:name", make_name(n->type,0)); set_nextSibling(retx,ret); ret = retx; @@ -1080,7 +1079,7 @@ static Node *dump_nested(const char *parent) { { Node *head = new_node("insert"); String *code = NewStringf("\n%s\n",n->code); - Setattr(head,k_code, code); + Setattr(head,"code", code); Delete(code); set_nextSibling(head,ret); Delete(ret); @@ -1126,7 +1125,7 @@ static void single_new_feature(const char *featurename, String *val, Hash *featu name = fixname; } - if (declaratorparms) Setmeta(val,k_parms,declaratorparms); + if (declaratorparms) Setmeta(val,"parms",declaratorparms); if (!Len(t)) t = 0; if (t) { if (qualifier) SwigType_push(t,qualifier); @@ -1189,7 +1188,7 @@ static void new_feature(const char *featurename, String *val, Hash *featureattri /* check if a function declaration is a plain C object */ static int is_cfunction(Node *n) { if (!cparse_cplusplus || cparse_externc) return 1; - if (Cmp(Getattr(n,k_storage),"externc") == 0) { + if (Cmp(Getattr(n,"storage"),"externc") == 0) { return 1; } return 0; @@ -1206,10 +1205,10 @@ static void default_arguments(Node *n) { if (varargs) { /* Handles the %varargs directive by looking for "feature:varargs" and * substituting ... with an alternative set of arguments. */ - Parm *p = Getattr(function,k_parms); + Parm *p = Getattr(function,"parms"); Parm *pp = 0; while (p) { - SwigType *t = Getattr(p,k_type); + SwigType *t = Getattr(p,"type"); if (Strcmp(t,"v(...)") == 0) { if (pp) { ParmList *cv = Copy(varargs); @@ -1217,7 +1216,7 @@ static void default_arguments(Node *n) { Delete(cv); } else { ParmList *cv = Copy(varargs); - Setattr(function,k_parms, cv); + Setattr(function,"parms", cv); Delete(cv); } break; @@ -1233,7 +1232,7 @@ static void default_arguments(Node *n) { || is_cfunction(function) || GetFlag(function,"feature:compactdefaultargs") || GetFlag(function,"feature:kwargs")) { - ParmList *p = Getattr(function,k_parms); + ParmList *p = Getattr(function,"parms"); if (p) Setattr(p,"compactdefargs", "1"); /* mark parameters for special handling */ function = 0; /* don't add in extra methods */ @@ -1241,7 +1240,7 @@ static void default_arguments(Node *n) { } while (function) { - ParmList *parms = Getattr(function,k_parms); + ParmList *parms = Getattr(function,"parms"); if (ParmList_has_defaultargs(parms)) { /* Create a parameter list for the new function by copying all @@ -1253,27 +1252,27 @@ static void default_arguments(Node *n) { SwigType *ntype = Copy(nodeType(function)); char *cntype = Char(ntype); Node *new_function = new_node(ntype); - SwigType *decl = Copy(Getattr(function,k_decl)); + SwigType *decl = Copy(Getattr(function,"decl")); int constqualifier = SwigType_isconst(decl); - String *ccode = Copy(Getattr(function,k_code)); - String *cstorage = Copy(Getattr(function,k_storage)); - String *cvalue = Copy(Getattr(function,k_value)); - SwigType *ctype = Copy(Getattr(function,k_type)); - String *cthrow = Copy(Getattr(function,k_throw)); + String *ccode = Copy(Getattr(function,"code")); + String *cstorage = Copy(Getattr(function,"storage")); + String *cvalue = Copy(Getattr(function,"value")); + SwigType *ctype = Copy(Getattr(function,"type")); + String *cthrow = Copy(Getattr(function,"throw")); Delete(SwigType_pop_function(decl)); /* remove the old parameter list from decl */ SwigType_add_function(decl,newparms); if (constqualifier) SwigType_add_qualifier(decl,"const"); - Setattr(new_function,k_name, Getattr(function,k_name)); - Setattr(new_function,k_code, ccode); - Setattr(new_function,k_decl, decl); - Setattr(new_function,k_parms, newparms); - Setattr(new_function,k_storage, cstorage); - Setattr(new_function,k_value, cvalue); - Setattr(new_function,k_type, ctype); - Setattr(new_function,k_throw, cthrow); + Setattr(new_function,"name", Getattr(function,"name")); + Setattr(new_function,"code", ccode); + Setattr(new_function,"decl", decl); + Setattr(new_function,"parms", newparms); + Setattr(new_function,"storage", cstorage); + Setattr(new_function,"value", cvalue); + Setattr(new_function,"type", ctype); + Setattr(new_function,"throw", cthrow); Delete(ccode); Delete(cstorage); @@ -1283,30 +1282,30 @@ static void default_arguments(Node *n) { Delete(decl); { - Node *throws = Getattr(function,k_throws); + Node *throws = Getattr(function,"throws"); ParmList *pl = CopyParmList(throws); - if (throws) Setattr(new_function,k_throws,pl); + if (throws) Setattr(new_function,"throws",pl); Delete(pl); } /* copy specific attributes for global (or in a namespace) template functions - these are not templated class methods */ if (strcmp(cntype,"template") == 0) { - Node *templatetype = Getattr(function,k_templatetype); - Node *symtypename = Getattr(function,k_symtypename); - Parm *templateparms = Getattr(function,k_templateparms); + Node *templatetype = Getattr(function,"templatetype"); + Node *symtypename = Getattr(function,"sym:typename"); + Parm *templateparms = Getattr(function,"templateparms"); if (templatetype) { Node *tmp = Copy(templatetype); - Setattr(new_function,k_templatetype,tmp); + Setattr(new_function,"templatetype",tmp); Delete(tmp); } if (symtypename) { Node *tmp = Copy(symtypename); - Setattr(new_function,k_symtypename,tmp); + Setattr(new_function,"sym:typename",tmp); Delete(tmp); } if (templateparms) { Parm *tmp = CopyParmList(templateparms); - Setattr(new_function,k_templateparms,tmp); + Setattr(new_function,"templateparms",tmp); Delete(tmp); } } else if (strcmp(cntype,"constructor") == 0) { @@ -1501,18 +1500,18 @@ static void tag_nodes(Node *n, const String_or_char *attrname, DOH *value) { program : interface { if (!classes) classes = NewHash(); Setattr($1,"classes",classes); - Setattr($1,k_name,ModuleName); + Setattr($1,"name",ModuleName); if ((!module_node) && ModuleName) { module_node = new_node("module"); - Setattr(module_node,k_name,ModuleName); + Setattr(module_node,"name",ModuleName); } Setattr($1,"module",module_node); check_extensions(); top = $1; } | PARSETYPE parm SEMI { - top = Copy(Getattr($2,k_type)); + top = Copy(Getattr($2,"type")); Delete($2); } | PARSETYPE error { @@ -1622,12 +1621,12 @@ extend_directive : EXTEND options idcolon LBRACE { Swig_symbol_setscopename($3); prev_symtab = 0; } else { - prev_symtab = Swig_symbol_setscope(Getattr(am,k_symtab)); + prev_symtab = Swig_symbol_setscope(Getattr(am,"symtab")); } current_class = 0; } else { /* Previous class definition. Use its symbol table */ - prev_symtab = Swig_symbol_setscope(Getattr(cls,k_symtab)); + prev_symtab = Swig_symbol_setscope(Getattr(cls,"symtab")); current_class = cls; extendmode = 1; } @@ -1638,13 +1637,13 @@ extend_directive : EXTEND options idcolon LBRACE { String *clsname; extendmode = 0; $$ = new_node("extend"); - Setattr($$,k_symtab,Swig_symbol_popscope()); + Setattr($$,"symtab",Swig_symbol_popscope()); if (prev_symtab) { Swig_symbol_setscope(prev_symtab); } Namespaceprefix = Swig_symbol_qualifiedscopename(0); clsname = make_class_name($3); - Setattr($$,k_name,clsname); + Setattr($$,"name",clsname); /* Mark members as extend */ @@ -1703,11 +1702,11 @@ constant_directive : CONSTANT ID EQUAL definetype SEMI { if (($4.type != T_ERROR) && ($4.type != T_SYMBOL)) { SwigType *type = NewSwigType($4.type); $$ = new_node("constant"); - Setattr($$,k_name,$2); - Setattr($$,k_type,type); - Setattr($$,k_value,$4.val); + Setattr($$,"name",$2); + Setattr($$,"type",type); + Setattr($$,"value",$4.val); if ($4.rawval) Setattr($$,"rawval", $4.rawval); - Setattr($$,k_storage,"%constant"); + Setattr($$,"storage","%constant"); SetFlag($$,"feature:immutable"); add_symbols($$); Delete(type); @@ -1728,11 +1727,11 @@ constant_directive : CONSTANT ID EQUAL definetype SEMI { SwigType_add_pointer($2); } $$ = new_node("constant"); - Setattr($$,k_name,$3.id); - Setattr($$,k_type,$2); - Setattr($$,k_value,$4.val); + Setattr($$,"name",$3.id); + Setattr($$,"type",$2); + Setattr($$,"value",$4.val); if ($4.rawval) Setattr($$,"rawval", $4.rawval); - Setattr($$,k_storage,"%constant"); + Setattr($$,"storage","%constant"); SetFlag($$,"feature:immutable"); add_symbols($$); } else { @@ -1811,14 +1810,14 @@ except_directive : EXCEPT LPAREN ID RPAREN LBRACE { /* fragment keyword arguments */ stringtype : string LBRACE parm RBRACE { $$ = NewHash(); - Setattr($$,k_value,$1); - Setattr($$,k_type,Getattr($3,k_type)); + Setattr($$,"value",$1); + Setattr($$,"type",Getattr($3,"type")); } ; fname : string { $$ = NewHash(); - Setattr($$,k_value,$1); + Setattr($$,"value",$1); } | stringtype { $$ = $1; @@ -1828,31 +1827,31 @@ fname : string { fragment_directive: FRAGMENT LPAREN fname COMMA kwargs RPAREN HBLOCK { Hash *p = $5; $$ = new_node("fragment"); - Setattr($$,k_value,Getattr($3,k_value)); - Setattr($$,k_type,Getattr($3,k_type)); - Setattr($$,"section",Getattr(p,k_name)); - Setattr($$,k_kwargs,nextSibling(p)); - Setattr($$,k_code,$7); + Setattr($$,"value",Getattr($3,"value")); + Setattr($$,"type",Getattr($3,"type")); + Setattr($$,"section",Getattr(p,"name")); + Setattr($$,"kwargs",nextSibling(p)); + Setattr($$,"code",$7); } | FRAGMENT LPAREN fname COMMA kwargs RPAREN LBRACE { Hash *p = $5; String *code; skip_balanced('{','}'); $$ = new_node("fragment"); - Setattr($$,k_value,Getattr($3,k_value)); - Setattr($$,k_type,Getattr($3,k_type)); - Setattr($$,"section",Getattr(p,k_name)); - Setattr($$,k_kwargs,nextSibling(p)); + Setattr($$,"value",Getattr($3,"value")); + Setattr($$,"type",Getattr($3,"type")); + Setattr($$,"section",Getattr(p,"name")); + Setattr($$,"kwargs",nextSibling(p)); Delitem(scanner_ccode,0); Delitem(scanner_ccode,DOH_END); code = Copy(scanner_ccode); - Setattr($$,k_code,code); + Setattr($$,"code",code); Delete(code); } | FRAGMENT LPAREN fname RPAREN SEMI { $$ = new_node("fragment"); - Setattr($$,k_value,Getattr($3,k_value)); - Setattr($$,k_type,Getattr($3,k_type)); + Setattr($$,"value",Getattr($3,"value")); + Setattr($$,"type",Getattr($3,"type")); Setattr($$,"emitonly","1"); } ; @@ -1879,17 +1878,17 @@ include_directive: includetype options string LBRACKET { if (import_mode) --import_mode; } - Setattr($$,k_name,$3); + Setattr($$,"name",$3); /* Search for the module (if any) */ { Node *n = firstChild($$); while (n) { if (Strcmp(nodeType(n),"module") == 0) { if (mname) { - Setattr(n,k_name, mname); + Setattr(n,"name", mname); mname = 0; } - Setattr($$,"module",Getattr(n,k_name)); + Setattr($$,"module",Getattr(n,"name")); break; } n = nextSibling(n); @@ -1902,7 +1901,7 @@ include_directive: includetype options string LBRACKET { */ Node *nint = new_node("import"); Node *mnode = new_node("module"); - Setattr(mnode,k_name, mname); + Setattr(mnode,"name", mname); appendChild(nint,mnode); Delete(mnode); appendChild(nint,firstChild($$)); @@ -1930,7 +1929,7 @@ inline_directive : INLINE HBLOCK { $$ = 0; } else { $$ = new_node("insert"); - Setattr($$,k_code,$2); + Setattr($$,"code",$2); /* Need to run through the preprocessor */ Setline($2,cparse_start_line); Setfile($2,cparse_file); @@ -1956,7 +1955,7 @@ inline_directive : INLINE HBLOCK { Delitem(scanner_ccode,0); Delitem(scanner_ccode,DOH_END); code = Copy(scanner_ccode); - Setattr($$,k_code, code); + Setattr($$,"code", code); Delete(code); cpps=Copy(scanner_ccode); start_inline(Char(cpps), start_line); @@ -1975,13 +1974,13 @@ inline_directive : INLINE HBLOCK { insert_directive : HBLOCK { $$ = new_node("insert"); - Setattr($$,k_code,$1); + Setattr($$,"code",$1); } | INSERT LPAREN idstring RPAREN string { String *code = NewStringEmpty(); $$ = new_node("insert"); Setattr($$,"section",$3); - Setattr($$,k_code,code); + Setattr($$,"code",code); if (Swig_insert_file($5,code) < 0) { Swig_error(cparse_file, cparse_line, "Couldn't find '%s'.\n", $5); $$ = 0; @@ -1990,7 +1989,7 @@ insert_directive : HBLOCK { | INSERT LPAREN idstring RPAREN HBLOCK { $$ = new_node("insert"); Setattr($$,"section",$3); - Setattr($$,k_code,$5); + Setattr($$,"code",$5); } | INSERT LPAREN idstring RPAREN LBRACE { String *code; @@ -2000,7 +1999,7 @@ insert_directive : HBLOCK { Delitem(scanner_ccode,0); Delitem(scanner_ccode,DOH_END); code = Copy(scanner_ccode); - Setattr($$,k_code, code); + Setattr($$,"code", code); Delete(code); } ; @@ -2029,11 +2028,11 @@ module_directive: MODULE options idstring { /* first module included, we apply global ModuleName, which can be modify by -module */ String *mname = Copy(ModuleName); - Setattr($$,k_name,mname); + Setattr($$,"name",mname); Delete(mname); } else { /* import mode, we just pass the idstring */ - Setattr($$,k_name,$3); + Setattr($$,"name",$3); } if (!module_node) module_node = $$; } @@ -2065,7 +2064,7 @@ name_directive : NAME LPAREN idstring RPAREN { native_directive : NATIVE LPAREN ID RPAREN storage_class ID SEMI { $$ = new_node("native"); - Setattr($$,k_name,$3); + Setattr($$,"name",$3); Setattr($$,"wrap:name",$6); add_symbols($$); } @@ -2078,11 +2077,11 @@ native_directive : NATIVE LPAREN ID RPAREN storage_class ID SEMI { /* Need check for function here */ SwigType_push($6,$7.type); $$ = new_node("native"); - Setattr($$,k_name,$3); + Setattr($$,"name",$3); Setattr($$,"wrap:name",$7.id); - Setattr($$,k_type,$6); - Setattr($$,k_parms,$7.parms); - Setattr($$,k_decl,$7.type); + Setattr($$,"type",$6); + Setattr($$,"parms",$7.parms); + Setattr($$,"decl",$7.type); } add_symbols($$); } @@ -2098,13 +2097,13 @@ native_directive : NATIVE LPAREN ID RPAREN storage_class ID SEMI { pragma_directive : PRAGMA pragma_lang ID EQUAL pragma_arg { $$ = new_node("pragma"); Setattr($$,"lang",$2); - Setattr($$,k_name,$3); - Setattr($$,k_value,$5); + Setattr($$,"name",$3); + Setattr($$,"value",$5); } | PRAGMA pragma_lang ID { $$ = new_node("pragma"); Setattr($$,"lang",$2); - Setattr($$,k_name,$3); + Setattr($$,"name",$3); } ; @@ -2126,7 +2125,7 @@ rename_directive : rename_namewarn declarator idstring SEMI { Hash *kws = NewHash(); String *fixname; fixname = feature_identifier_fix($2.id); - Setattr(kws,k_name,$3); + Setattr(kws,"name",$3); if (!Len(t)) t = 0; /* Special declarator check */ if (t) { @@ -2305,13 +2304,13 @@ stringbracesemi : stringbrace { $$ = $1; } featattr : COMMA idstring EQUAL stringnum { $$ = NewHash(); - Setattr($$,k_name,$2); - Setattr($$,k_value,$4); + Setattr($$,"name",$2); + Setattr($$,"value",$4); } | COMMA idstring EQUAL stringnum featattr { $$ = NewHash(); - Setattr($$,k_name,$2); - Setattr($$,k_value,$4); + Setattr($$,"name",$2); + Setattr($$,"value",$4); set_nextSibling($$,$5); } ; @@ -2326,7 +2325,7 @@ varargs_directive : VARARGS LPAREN varargs_parms RPAREN declarator cpp_const SEM else name = NewString($5.id); val = $3; if ($5.parms) { - Setmeta(val,k_parms,$5.parms); + Setmeta(val,"parms",$5.parms); } t = $5.type; if (!Len(t)) t = 0; @@ -2365,7 +2364,7 @@ varargs_parms : parms { $$ = $1; } $$ = 0; } else { $$ = Copy($3); - Setattr($$,k_name,"VARARGS_SENTINEL"); + Setattr($$,"name","VARARGS_SENTINEL"); for (i = 0; i < n; i++) { p = Copy($3); set_nextSibling(p,$$); @@ -2395,7 +2394,7 @@ typemap_directive : TYPEMAP LPAREN typemap_type RPAREN tm_list stringbrace { Parm *kw = $3.kwargs; /* check for 'noblock' option, which remove the block braces */ while (kw) { - String *name = Getattr(kw,k_name); + String *name = Getattr(kw,"name"); if (name && (Cmp(name,"noblock") == 0)) { char *cstr = Char($6); size_t len = Len($6); @@ -2411,10 +2410,10 @@ typemap_directive : TYPEMAP LPAREN typemap_type RPAREN tm_list stringbrace { } kw = nextSibling(kw); } - Setattr($$,k_kwargs, $3.kwargs); + Setattr($$,"kwargs", $3.kwargs); } code = code ? code : NewString($6); - Setattr($$,k_code, code); + Setattr($$,"code", code); Delete(code); appendChild($$,$5); } @@ -2444,22 +2443,22 @@ typemap_type : kwargs { Hash *p; String *name; p = nextSibling($1); - if (p && (!Getattr(p,k_value))) { + if (p && (!Getattr(p,"value"))) { /* this is the deprecated two argument typemap form */ Swig_warning(WARN_DEPRECATED_TYPEMAP_LANG,cparse_file, cparse_line, "Specifying the language name in %%typemap is deprecated - use #ifdef SWIG instead.\n"); /* two argument typemap form */ - name = Getattr($1,k_name); + name = Getattr($1,"name"); if (!name || (Strcmp(name,typemap_lang))) { $$.op = 0; $$.kwargs = 0; } else { - $$.op = Getattr(p,k_name); + $$.op = Getattr(p,"name"); $$.kwargs = nextSibling(p); } } else { /* one-argument typemap-form */ - $$.op = Getattr($1,k_name); + $$.op = Getattr($1,"name"); $$.kwargs = p; } } @@ -2484,7 +2483,7 @@ typemap_parm : type typemap_parameter_declarator { $$ = new_node("typemapitem"); parm = NewParm($1,$2.id); Setattr($$,"pattern",parm); - Setattr($$,k_parms, $2.parms); + Setattr($$,"parms", $2.parms); Delete(parm); /* $$ = NewParm($1,$2.id); Setattr($$,"parms",$2.parms); */ @@ -2498,7 +2497,7 @@ typemap_parm : type typemap_parameter_declarator { $$ = new_node("typemapitem"); Setattr($$,"pattern", $2); /* Setattr($$,"multitype",$2); */ - Setattr($$,k_parms,$5); + Setattr($$,"parms",$5); } ; @@ -2508,7 +2507,7 @@ typemap_parm : type typemap_parameter_declarator { types_directive : TYPES LPAREN parms RPAREN SEMI { $$ = new_node("types"); - Setattr($$,k_parms,$3); + Setattr($$,"parms",$3); } ; @@ -2544,9 +2543,9 @@ template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN va /* Patch the argument types to respect namespaces */ p = $7; while (p) { - SwigType *value = Getattr(p,k_value); + SwigType *value = Getattr(p,"value"); if (!value) { - SwigType *ty = Getattr(p,k_type); + SwigType *ty = Getattr(p,"type"); if (ty) { SwigType *rty = 0; int reduce = template_reduce; @@ -2555,13 +2554,13 @@ template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN va if (!reduce) reduce = SwigType_ispointer(rty); } ty = reduce ? Swig_symbol_type_qualify(rty,tscope) : Swig_symbol_type_qualify(ty,tscope); - Setattr(p,k_type,ty); + Setattr(p,"type",ty); Delete(ty); Delete(rty); } } else { value = Swig_symbol_type_qualify(value,tscope); - Setattr(p,k_value,value); + Setattr(p,"value",value); Delete(value); } @@ -2575,8 +2574,8 @@ template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN va while (nn) { Node *templnode = 0; if (Strcmp(nodeType(nn),"template") == 0) { - int nnisclass = (Strcmp(Getattr(nn,k_templatetype),"class") == 0); /* if not a templated class it is a templated function */ - Parm *tparms = Getattr(nn,k_templateparms); + int nnisclass = (Strcmp(Getattr(nn,"templatetype"),"class") == 0); /* if not a templated class it is a templated function */ + Parm *tparms = Getattr(nn,"templateparms"); if (!tparms) { specialized = 1; } @@ -2593,7 +2592,7 @@ template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN va int def_supplied = 0; /* Expand the template */ Node *templ = Swig_symbol_clookup($5,0); - Parm *targs = templ ? Getattr(templ,k_templateparms) : 0; + Parm *targs = templ ? Getattr(templ,"templateparms") : 0; ParmList *temparms; if (specialized) temparms = CopyParmList($7); @@ -2603,29 +2602,29 @@ template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN va p = $7; tp = temparms; while (p) { - String *value = Getattr(p,k_value); + String *value = Getattr(p,"value"); if (def_supplied) { Setattr(p,"default","1"); } if (value) { - Setattr(tp,k_value,value); + Setattr(tp,"value",value); } else { - SwigType *ty = Getattr(p,k_type); + SwigType *ty = Getattr(p,"type"); if (ty) { - Setattr(tp,k_type,ty); + Setattr(tp,"type",ty); } - Delattr(tp,k_value); + Delattr(tp,"value"); } /* fix default arg values */ if (targs) { Parm *pi = temparms; Parm *ti = targs; - String *tv = Getattr(tp,k_value); - if (!tv) tv = Getattr(tp,k_type); + String *tv = Getattr(tp,"value"); + if (!tv) tv = Getattr(tp,"type"); while(pi != tp) { - String *name = Getattr(ti,k_name); - String *value = Getattr(pi,k_value); - if (!value) value = Getattr(pi,k_type); + String *name = Getattr(ti,"name"); + String *value = Getattr(pi,"value"); + if (!value) value = Getattr(pi,"type"); Replaceid(tv, name, value); pi = nextSibling(pi); ti = nextSibling(ti); @@ -2641,12 +2640,12 @@ template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN va templnode = copy_node(nn); /* We need to set the node name based on name used to instantiate */ - Setattr(templnode,k_name,tname); + Setattr(templnode,"name",tname); Delete(tname); if (!specialized) { - Delattr(templnode,k_symtypename); + Delattr(templnode,"sym:typename"); } else { - Setattr(templnode,k_symtypename,"1"); + Setattr(templnode,"sym:typename","1"); } if ($3) { /* @@ -2659,18 +2658,18 @@ template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN va */ String *symname = $3; Swig_cparse_template_expand(templnode,symname,temparms,tscope); - Setattr(templnode,k_symname,symname); + Setattr(templnode,"sym:name",symname); } else { static int cnt = 0; String *nname = NewStringf("__dummy_%d__", cnt++); Swig_cparse_template_expand(templnode,nname,temparms,tscope); - Setattr(templnode,k_symname,nname); + Setattr(templnode,"sym:name",nname); Delete(nname); Setattr(templnode,"feature:onlychildren", "typemap,typemapitem,typemapcopy,typedef,types,fragment"); } - Delattr(templnode,k_templatetype); - Setattr(templnode,k_template,nn); + Delattr(templnode,"templatetype"); + Setattr(templnode,"template",nn); tnode = templnode; Setfile(templnode,cparse_file); Setline(templnode,cparse_line); @@ -2681,20 +2680,20 @@ template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN va if (Strcmp(nodeType(templnode),"class") == 0) { /* Identify pure abstract methods */ - Setattr(templnode,k_abstract, pure_abstract(firstChild(templnode))); + Setattr(templnode,"abstract", pure_abstract(firstChild(templnode))); /* Set up inheritance in symbol table */ { Symtab *csyms; - List *baselist = Getattr(templnode,k_baselist); + List *baselist = Getattr(templnode,"baselist"); csyms = Swig_symbol_current(); - Swig_symbol_setscope(Getattr(templnode,k_symtab)); + Swig_symbol_setscope(Getattr(templnode,"symtab")); if (baselist) { - List *bases = make_inherit_list(Getattr(templnode,k_name),baselist); + List *bases = make_inherit_list(Getattr(templnode,"name"),baselist); if (bases) { Iterator s; for (s = First(bases); s.item; s = Next(s)) { - Symtab *st = Getattr(s.item,k_symtab); + Symtab *st = Getattr(s.item,"symtab"); if (st) { Setfile(st,Getfile(s.item)); Setline(st,Getline(s.item)); @@ -2717,15 +2716,15 @@ template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN va String *clsname; Node *am; if (Namespaceprefix) { - clsname = stmp = NewStringf("%s::%s", Namespaceprefix, Getattr(templnode,k_name)); + clsname = stmp = NewStringf("%s::%s", Namespaceprefix, Getattr(templnode,"name")); } else { - clsname = Getattr(templnode,k_name); + clsname = Getattr(templnode,"name"); } am = Getattr(extendhash,clsname); if (am) { Symtab *st = Swig_symbol_current(); - Swig_symbol_setscope(Getattr(templnode,k_symtab)); - /* Printf(stdout,"%s: %s %x %x\n", Getattr(templnode,k_name), clsname, Swig_symbol_current(), Getattr(templnode,"symtab")); */ + Swig_symbol_setscope(Getattr(templnode,"symtab")); + /* Printf(stdout,"%s: %s %x %x\n", Getattr(templnode,"name"), clsname, Swig_symbol_current(), Getattr(templnode,"symtab")); */ merge_extensions(templnode,am); Swig_symbol_setscope(st); append_previous_extension(templnode,am); @@ -2738,7 +2737,7 @@ template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN va { if (Namespaceprefix) { - String *temp = NewStringf("%s::%s", Namespaceprefix, Getattr(templnode,k_name)); + String *temp = NewStringf("%s::%s", Namespaceprefix, Getattr(templnode,"name")); Setattr(classes,temp,templnode); Delete(temp); } else { @@ -2814,19 +2813,19 @@ c_declaration : c_decl { if (Strcmp($2,"C") == 0) { Node *n = firstChild($5); $$ = new_node("extern"); - Setattr($$,k_name,$2); + Setattr($$,"name",$2); appendChild($$,n); while (n) { - SwigType *decl = Getattr(n,k_decl); + SwigType *decl = Getattr(n,"decl"); if (SwigType_isfunction(decl)) { - Setattr(n,k_storage,"externc"); + Setattr(n,"storage","externc"); } n = nextSibling(n); } } else { Swig_warning(WARN_PARSE_UNDEFINED_EXTERN,cparse_file, cparse_line,"Unrecognized extern type \"%s\".\n", $2); $$ = new_node("extern"); - Setattr($$,k_name,$2); + Setattr($$,"name",$2); appendChild($$,firstChild($5)); } } @@ -2839,18 +2838,18 @@ c_declaration : c_decl { c_decl : storage_class type declarator initializer c_decl_tail { $$ = new_node("cdecl"); if ($4.qualifier) SwigType_push($3.type,$4.qualifier); - Setattr($$,k_type,$2); - Setattr($$,k_storage,$1); - Setattr($$,k_name,$3.id); - Setattr($$,k_decl,$3.type); - Setattr($$,k_parms,$3.parms); - Setattr($$,k_value,$4.val); - Setattr($$,k_throws,$4.throws); - Setattr($$,k_throw,$4.throwf); + Setattr($$,"type",$2); + Setattr($$,"storage",$1); + Setattr($$,"name",$3.id); + Setattr($$,"decl",$3.type); + Setattr($$,"parms",$3.parms); + Setattr($$,"value",$4.val); + Setattr($$,"throws",$4.throws); + Setattr($$,"throw",$4.throwf); if (!$5) { if (Len(scanner_ccode)) { String *code = Copy(scanner_ccode); - Setattr($$,k_code,code); + Setattr($$,"code",code); Delete(code); } } else { @@ -2858,8 +2857,8 @@ c_decl : storage_class type declarator initializer c_decl_tail { /* Inherit attributes */ while (n) { String *type = Copy($2); - Setattr(n,k_type,type); - Setattr(n,k_storage,$1); + Setattr(n,"type",type); + Setattr(n,"storage",$1); n = nextSibling(n); Delete(type); } @@ -2877,7 +2876,7 @@ c_decl : storage_class type declarator initializer c_decl_tail { if ((Namespaceprefix && Strcmp(p,Namespaceprefix) == 0) || (inclass && Strcmp(p,Classprefix) == 0)) { String *lstr = Swig_scopename_last($3.id); - Setattr($$,k_name,lstr); + Setattr($$,"name",lstr); Delete(lstr); set_nextSibling($$,$5); } else { @@ -2904,19 +2903,19 @@ c_decl_tail : SEMI { | COMMA declarator initializer c_decl_tail { $$ = new_node("cdecl"); if ($3.qualifier) SwigType_push($2.type,$3.qualifier); - Setattr($$,k_name,$2.id); - Setattr($$,k_decl,$2.type); - Setattr($$,k_parms,$2.parms); - Setattr($$,k_value,$3.val); - Setattr($$,k_throws,$3.throws); - Setattr($$,k_throw,$3.throwf); + Setattr($$,"name",$2.id); + Setattr($$,"decl",$2.type); + Setattr($$,"parms",$2.parms); + Setattr($$,"value",$3.val); + Setattr($$,"throws",$3.throws); + Setattr($$,"throw",$3.throwf); if ($3.bitfield) { Setattr($$,"bitfield", $3.bitfield); } if (!$4) { if (Len(scanner_ccode)) { String *code = Copy(scanner_ccode); - Setattr($$,k_code,code); + Setattr($$,"code",code); Delete(code); } } else { @@ -2964,9 +2963,9 @@ c_enum_forward_decl : storage_class ENUM ID SEMI { SwigType *ty = 0; $$ = new_node("enumforward"); ty = NewStringf("enum %s", $3); - Setattr($$,k_name,$3); - Setattr($$,k_type,ty); - Setattr($$,k_symweak, "1"); + Setattr($$,"name",$3); + Setattr($$,"type",ty); + Setattr($$,"sym:weak", "1"); add_symbols($$); } ; @@ -2979,8 +2978,8 @@ c_enum_decl : storage_class ENUM ename LBRACE enumlist RBRACE SEMI { SwigType *ty = 0; $$ = new_node("enum"); ty = NewStringf("enum %s", $3); - Setattr($$,k_name,$3); - Setattr($$,k_type,ty); + Setattr($$,"name",$3); + Setattr($$,"type",ty); appendChild($$,$5); add_symbols($$); /* Add to tag space */ add_symbols($5); /* Add enum values to id space */ @@ -2993,19 +2992,19 @@ c_enum_decl : storage_class ENUM ename LBRACE enumlist RBRACE SEMI { $$ = new_node("enum"); if ($3) { - Setattr($$,k_name,$3); + Setattr($$,"name",$3); ty = NewStringf("enum %s", $3); } else if ($7.id) { unnamed = make_unnamed(); ty = NewStringf("enum %s", unnamed); - Setattr($$,k_unnamed,unnamed); + Setattr($$,"unnamed",unnamed); /* name is not set for unnamed enum instances, e.g. enum { foo } Instance; */ if ($1 && Cmp($1,"typedef") == 0) { - Setattr($$,k_name,$7.id); + Setattr($$,"name",$7.id); } else { unnamedinstance = 1; } - Setattr($$,k_storage,$1); + Setattr($$,"storage",$1); } if ($7.id && Cmp($1,"typedef") == 0) { Setattr($$,"tdname",$7.id); @@ -3013,16 +3012,16 @@ c_enum_decl : storage_class ENUM ename LBRACE enumlist RBRACE SEMI { } appendChild($$,$5); n = new_node("cdecl"); - Setattr(n,k_type,ty); - Setattr(n,k_name,$7.id); - Setattr(n,k_storage,$1); - Setattr(n,k_decl,$7.type); - Setattr(n,k_parms,$7.parms); - Setattr(n,k_unnamed,unnamed); + Setattr(n,"type",ty); + Setattr(n,"name",$7.id); + Setattr(n,"storage",$1); + Setattr(n,"decl",$7.type); + Setattr(n,"parms",$7.parms); + Setattr(n,"unnamed",unnamed); if (unnamedinstance) { SwigType *cty = NewString("enum "); - Setattr($$,k_type,cty); + Setattr($$,"type",cty); Setattr($$,"unnamedinstance","1"); Setattr(n,"unnamedinstance","1"); Delete(cty); @@ -3032,16 +3031,16 @@ c_enum_decl : storage_class ENUM ename LBRACE enumlist RBRACE SEMI { set_nextSibling(n,p); while (p) { SwigType *cty = Copy(ty); - Setattr(p,k_type,cty); - Setattr(p,k_unnamed,unnamed); - Setattr(p,k_storage,$1); + Setattr(p,"type",cty); + Setattr(p,"unnamed",unnamed); + Setattr(p,"storage",$1); Delete(cty); p = nextSibling(p); } } else { if (Len(scanner_ccode)) { String *code = Copy(scanner_ccode); - Setattr(n,k_code,code); + Setattr(n,"code",code); Delete(code); } } @@ -3075,31 +3074,31 @@ c_constructor_decl : storage_class type LPAREN parms RPAREN ctor_end { $$ = 0; if ((ParmList_len($4) == 1) && (!Swig_scopename_check($2))) { - SwigType *ty = Getattr($4,k_type); - String *name = Getattr($4,k_name); + SwigType *ty = Getattr($4,"type"); + String *name = Getattr($4,"name"); err = 1; if (!name) { $$ = new_node("cdecl"); - Setattr($$,k_type,$2); - Setattr($$,k_storage,$1); - Setattr($$,k_name,ty); + Setattr($$,"type",$2); + Setattr($$,"storage",$1); + Setattr($$,"name",ty); if ($6.have_parms) { SwigType *decl = NewStringEmpty(); SwigType_add_function(decl,$6.parms); - Setattr($$,k_decl,decl); - Setattr($$,k_parms,$6.parms); + Setattr($$,"decl",decl); + Setattr($$,"parms",$6.parms); if (Len(scanner_ccode)) { String *code = Copy(scanner_ccode); - Setattr($$,k_code,code); + Setattr($$,"code",code); Delete(code); } } if ($6.defarg) { - Setattr($$,k_value,$6.defarg); + Setattr($$,"value",$6.defarg); } - Setattr($$,k_throws,$6.throws); - Setattr($$,k_throw,$6.throwf); + Setattr($$,"throws",$6.throws); + Setattr($$,"throw",$6.throwf); err = 0; } } @@ -3131,9 +3130,9 @@ cpp_class_decl : Node *scope = 0; $$ = new_node("class"); Setline($$,cparse_start_line); - Setattr($$,k_kind,$2); + Setattr($$,"kind",$2); if ($4) { - Setattr($$,k_baselist, Getattr($4,"public")); + Setattr($$,"baselist", Getattr($4,"public")); Setattr($$,"protectedbaselist", Getattr($4,"protected")); Setattr($$,"privatebaselist", Getattr($4,"private")); } @@ -3166,7 +3165,7 @@ cpp_class_decl : nscope_inner = 0; } } - Setattr($$,k_name,$3); + Setattr($$,"name",$3); Delete(class_rename); class_rename = make_name($$,$3,0); @@ -3200,7 +3199,7 @@ cpp_class_decl : if (bases) { Iterator s; for (s = First(bases); s.item; s = Next(s)) { - Symtab *st = Getattr(s.item,k_symtab); + Symtab *st = Getattr(s.item,"symtab"); if (st) { Setfile(st,Getfile(s.item)); Setline(st,Getline(s.item)); @@ -3219,9 +3218,9 @@ cpp_class_decl : if (template_parameters) { Parm *tp = template_parameters; while(tp) { - String *tpname = Copy(Getattr(tp,k_name)); + String *tpname = Copy(Getattr(tp,"name")); Node *tn = new_node("templateparm"); - Setattr(tn,k_name,tpname); + Setattr(tn,"name",tpname); Swig_symbol_cadd(tpname,tn); tp = nextSibling(tp); Delete(tpname); @@ -3250,7 +3249,7 @@ cpp_class_decl : inclass = 0; /* Check for pure-abstract class */ - Setattr($$,k_abstract, pure_abstract($7)); + Setattr($$,"abstract", pure_abstract($7)); /* This bit of code merges in a previously defined %extend directive (if any) */ @@ -3283,19 +3282,19 @@ cpp_class_decl : ty = NewStringf("%s %s", $2,$3); } while (p) { - Setattr(p,k_storage,$1); - Setattr(p,k_type,ty); + Setattr(p,"storage",$1); + Setattr(p,"type",ty); p = nextSibling(p); } /* Dump nested classes */ { String *name = $3; if ($9) { - SwigType *decltype = Getattr($9,k_decl); + SwigType *decltype = Getattr($9,"decl"); if (Cmp($1,"typedef") == 0) { if (!decltype || !Len(decltype)) { String *cname; - name = Getattr($9,k_name); + name = Getattr($9,"name"); cname = Copy(name); Setattr($$,"tdname",cname); Delete(cname); @@ -3308,7 +3307,7 @@ cpp_class_decl : if (!Getattr(classes,name)) { Setattr(classes,name,$$); } - Setattr($$,k_decl,decltype); + Setattr($$,"decl",decltype); } } } @@ -3319,20 +3318,20 @@ cpp_class_decl : /* we 'open' the class at the end, to allow %template to add new members */ Node *pa = new_node("access"); - Setattr(pa,k_kind,"public"); + Setattr(pa,"kind","public"); cplus_mode = CPLUS_PUBLIC; appendChild($$,pa); Delete(pa); } - Setattr($$,k_symtab,Swig_symbol_popscope()); + Setattr($$,"symtab",Swig_symbol_popscope()); Classprefix = 0; if (nscope_inner) { /* this is tricky */ /* we add the declaration in the original namespace */ appendChild(nscope_inner,$$); - Swig_symbol_setscope(Getattr(nscope_inner,k_symtab)); + Swig_symbol_setscope(Getattr(nscope_inner,"symtab")); Delete(Namespaceprefix); Namespaceprefix = Swig_symbol_qualifiedscopename(0); add_symbols($$); @@ -3363,9 +3362,9 @@ cpp_class_decl : unnamed = make_unnamed(); $$ = new_node("class"); Setline($$,cparse_start_line); - Setattr($$,k_kind,$2); - Setattr($$,k_storage,$1); - Setattr($$,k_unnamed,unnamed); + Setattr($$,"kind",$2); + Setattr($$,"storage",$1); + Setattr($$,"unnamed",unnamed); Setattr($$,"allows_typedef","1"); Delete(class_rename); class_rename = make_name($$,0,0); @@ -3398,28 +3397,28 @@ cpp_class_decl : Classprefix = 0; $$ = class_decl[--class_level]; inclass = 0; - unnamed = Getattr($$,k_unnamed); + unnamed = Getattr($$,"unnamed"); /* Check for pure-abstract class */ - Setattr($$,k_abstract, pure_abstract($5)); + Setattr($$,"abstract", pure_abstract($5)); n = new_node("cdecl"); - Setattr(n,k_name,$7.id); - Setattr(n,k_unnamed,unnamed); - Setattr(n,k_type,unnamed); - Setattr(n,k_decl,$7.type); - Setattr(n,k_parms,$7.parms); - Setattr(n,k_storage,$1); + Setattr(n,"name",$7.id); + Setattr(n,"unnamed",unnamed); + Setattr(n,"type",unnamed); + Setattr(n,"decl",$7.type); + Setattr(n,"parms",$7.parms); + Setattr(n,"storage",$1); if ($8) { Node *p = $8; set_nextSibling(n,p); while (p) { String *type = Copy(unnamed); - Setattr(p,k_name,$7.id); - Setattr(p,k_unnamed,unnamed); - Setattr(p,k_type,type); + Setattr(p,"name",$7.id); + Setattr(p,"unnamed",unnamed); + Setattr(p,"type",type); Delete(type); - Setattr(p,k_storage,$1); + Setattr(p,"storage",$1); p = nextSibling(p); } } @@ -3433,7 +3432,7 @@ cpp_class_decl : String *scpname = 0; name = $7.id; Setattr($$,"tdname",name); - Setattr($$,k_name,name); + Setattr($$,"name",name); Swig_symbol_setscopename(name); /* If a proper name was given, we use that as the typedef, not unnamed */ @@ -3467,7 +3466,7 @@ cpp_class_decl : appendChild($$,dump_nested(Char(name))); } /* Pop the scope */ - Setattr($$,k_symtab,Swig_symbol_popscope()); + Setattr($$,"symtab",Swig_symbol_popscope()); if (class_rename) { Delete(yyrename); yyrename = NewString(class_rename); @@ -3483,9 +3482,9 @@ cpp_class_decl : cpp_opt_declarators : SEMI { $$ = 0; } | declarator c_decl_tail { $$ = new_node("cdecl"); - Setattr($$,k_name,$1.id); - Setattr($$,k_decl,$1.type); - Setattr($$,k_parms,$1.parms); + Setattr($$,"name",$1.id); + Setattr($$,"decl",$1.type); + Setattr($$,"parms",$1.parms); set_nextSibling($$,$2); } ; @@ -3501,9 +3500,9 @@ cpp_forward_class_decl : storage_class cpptype idcolon SEMI { $$ = new_node("classforward"); Setfile($$,cparse_file); Setline($$,cparse_line); - Setattr($$,k_kind,$2); - Setattr($$,k_name,$3); - Setattr($$,k_symweak, "1"); + Setattr($$,"kind",$2); + Setattr($$,"name",$3); + Setattr($$,"sym:weak", "1"); add_symbols($$); } } @@ -3524,7 +3523,7 @@ cpp_template_decl : TEMPLATE LESSTHAN template_parms GREATERTHAN { template_para Node *ni = ntop; SwigType *ntype = ni ? nodeType(ni) : 0; while (ni && Strcmp(ntype,"namespace") == 0) { - sti = Getattr(ni,k_symtab); + sti = Getattr(ni,"symtab"); ni = firstChild(ni); ntype = nodeType(ni); } @@ -3537,7 +3536,7 @@ cpp_template_decl : TEMPLATE LESSTHAN template_parms GREATERTHAN { template_para template_parameters = 0; $$ = $6; - if ($$) tname = Getattr($$,k_name); + if ($$) tname = Getattr($$,"name"); /* Check if the class is a template specialization */ if (($$) && (Strchr(tname,'<')) && (!is_operator(tname))) { @@ -3556,7 +3555,7 @@ cpp_template_decl : TEMPLATE LESSTHAN template_parms GREATERTHAN { template_para Delete(tbase); } Setattr($$,"specialization","1"); - Setattr($$,k_templatetype,nodeType($$)); + Setattr($$,"templatetype",nodeType($$)); set_nodeType($$,"template"); /* Template partial specialization */ if (tempn && ($3) && ($6)) { @@ -3564,12 +3563,12 @@ cpp_template_decl : TEMPLATE LESSTHAN template_parms GREATERTHAN { template_para String *targs = SwigType_templateargs(tname); tlist = SwigType_parmlist(targs); /* Printf(stdout,"targs = '%s' %s\n", targs, tlist); */ - if (!Getattr($$,k_symweak)) { - Setattr($$,k_symtypename,"1"); + if (!Getattr($$,"sym:weak")) { + Setattr($$,"sym:typename","1"); } - if (Len(tlist) != ParmList_len(Getattr(tempn,k_templateparms))) { - Swig_error(Getfile($$),Getline($$),"Inconsistent argument count in template partial specialization. %d %d\n", Len(tlist), ParmList_len(Getattr(tempn,k_templateparms))); + if (Len(tlist) != ParmList_len(Getattr(tempn,"templateparms"))) { + Swig_error(Getfile($$),Getline($$),"Inconsistent argument count in template partial specialization. %d %d\n", Len(tlist), ParmList_len(Getattr(tempn,"templateparms"))); } else { @@ -3595,20 +3594,20 @@ cpp_template_decl : TEMPLATE LESSTHAN template_parms GREATERTHAN { template_para String *pn; Parm *p, *p1; int i, nargs; - Parm *tp = CopyParmList(Getattr(tempn,k_templateparms)); + Parm *tp = CopyParmList(Getattr(tempn,"templateparms")); nargs = Len(tlist); p = $3; while (p) { for (i = 0; i < nargs; i++){ - pn = Getattr(p,k_name); + pn = Getattr(p,"name"); if (Strcmp(pn,SwigType_base(Getitem(tlist,i))) == 0) { int j; Parm *p1 = tp; for (j = 0; j < i; j++) { p1 = nextSibling(p1); } - Setattr(p1,k_name,pn); - Setattr(p1,k_partialarg,"1"); + Setattr(p1,"name",pn); + Setattr(p1,"partialarg","1"); } } p = nextSibling(p); @@ -3616,37 +3615,37 @@ cpp_template_decl : TEMPLATE LESSTHAN template_parms GREATERTHAN { template_para p1 = tp; i = 0; while (p1) { - if (!Getattr(p1,k_partialarg)) { - Delattr(p1,k_name); - Setattr(p1,k_type, Getitem(tlist,i)); + if (!Getattr(p1,"partialarg")) { + Delattr(p1,"name"); + Setattr(p1,"type", Getitem(tlist,i)); } i++; p1 = nextSibling(p1); } - Setattr($$,k_templateparms,tp); + Setattr($$,"templateparms",tp); Delete(tp); } #if 0 /* Patch the parameter list */ if (tempn) { Parm *p,*p1; - ParmList *tp = CopyParmList(Getattr(tempn,k_templateparms)); + ParmList *tp = CopyParmList(Getattr(tempn,"templateparms")); p = $3; p1 = tp; while (p && p1) { - String *pn = Getattr(p,k_name); + String *pn = Getattr(p,"name"); Printf(stdout,"pn = '%s'\n", pn); - if (pn) Setattr(p1,k_name,pn); - else Delattr(p1,k_name); - pn = Getattr(p,k_type); - if (pn) Setattr(p1,k_type,pn); + if (pn) Setattr(p1,"name",pn); + else Delattr(p1,"name"); + pn = Getattr(p,"type"); + if (pn) Setattr(p1,"type",pn); p = nextSibling(p); p1 = nextSibling(p1); } - Setattr($$,k_templateparms,tp); + Setattr($$,"templateparms",tp); Delete(tp); } else { - Setattr($$,k_templateparms,$3); + Setattr($$,"templateparms",$3); } #endif Delattr($$,"specialization"); @@ -3654,13 +3653,13 @@ cpp_template_decl : TEMPLATE LESSTHAN template_parms GREATERTHAN { template_para /* Create a specialized name for matching */ { Parm *p = $3; - String *fname = NewString(Getattr($$,k_name)); + String *fname = NewString(Getattr($$,"name")); String *ffname = 0; char tmp[32]; int i, ilen; while (p) { - String *n = Getattr(p,k_name); + String *n = Getattr(p,"name"); if (!n) { p = nextSibling(p); continue; @@ -3693,16 +3692,16 @@ cpp_template_decl : TEMPLATE LESSTHAN template_parms GREATERTHAN { template_para Append(ffname,")>"); } { - String *partials = Getattr(tempn,k_partials); + String *partials = Getattr(tempn,"partials"); if (!partials) { partials = NewList(); - Setattr(tempn,k_partials,partials); + Setattr(tempn,"partials",partials); Delete(partials); } /* Printf(stdout,"partial: fname = '%s', '%s'\n", fname, Swig_symbol_typedef_reduce(fname,0)); */ Append(partials,ffname); } - Setattr($$,k_partialargs,ffname); + Setattr($$,"partialargs",ffname); Swig_symbol_cadd(ffname,$$); } } @@ -3718,22 +3717,22 @@ cpp_template_decl : TEMPLATE LESSTHAN template_parms GREATERTHAN { template_para Delete(fname); } } else if ($$) { - Setattr($$,k_templatetype,nodeType($6)); + Setattr($$,"templatetype",nodeType($6)); set_nodeType($$,"template"); - Setattr($$,k_templateparms, $3); - if (!Getattr($$,k_symweak)) { - Setattr($$,k_symtypename,"1"); + Setattr($$,"templateparms", $3); + if (!Getattr($$,"sym:weak")) { + Setattr($$,"sym:typename","1"); } add_symbols($$); default_arguments($$); /* We also place a fully parameterized version in the symbol table */ { Parm *p; - String *fname = NewStringf("%s<(", Getattr($$,k_name)); + String *fname = NewStringf("%s<(", Getattr($$,"name")); p = $3; while (p) { - String *n = Getattr(p,k_name); - if (!n) n = Getattr(p,k_type); + String *n = Getattr(p,"name"); + if (!n) n = Getattr(p,"type"); Append(fname,n); p = nextSibling(p); if (p) Putc(',',fname); @@ -3780,17 +3779,17 @@ template_parms : rawparms { $$ = $1; while (p) { - String *name = Getattr(p,k_name); + String *name = Getattr(p,"name"); if (!name) { /* Hmmm. Maybe it's a 'class T' parameter */ - char *type = Char(Getattr(p,k_type)); + char *type = Char(Getattr(p,"type")); /* Template template parameter */ if (strncmp(type,"template ",16) == 0) { type += 16; } if ((strncmp(type,"class ",6) == 0) || (strncmp(type,"typename ", 9) == 0)) { char *t = strchr(type,' '); - Setattr(p,k_name, t+1); + Setattr(p,"name", t+1); } else { /* Swig_error(cparse_file, cparse_line, "Missing template parameter name\n"); @@ -3810,8 +3809,8 @@ cpp_using_decl : USING idcolon SEMI { String *uname = Swig_symbol_type_qualify($2,0); String *name = Swig_scopename_last($2); $$ = new_node("using"); - Setattr($$,k_uname,uname); - Setattr($$,k_name, name); + Setattr($$,"uname",uname); + Setattr($$,"name", name); Delete(uname); Delete(name); add_symbols($$); @@ -3829,10 +3828,10 @@ cpp_using_decl : USING idcolon SEMI { if (n) { if (Strcmp(nodeType(n),"namespace") == 0) { Symtab *current = Swig_symbol_current(); - Symtab *symtab = Getattr(n,k_symtab); + Symtab *symtab = Getattr(n,"symtab"); $$ = new_node("using"); Setattr($$,"node",n); - Setattr($$,k_namespace, $3); + Setattr($$,"namespace", $3); if (current != symtab) { Swig_symbol_inherit(symtab); } @@ -3851,14 +3850,14 @@ cpp_namespace_decl : NAMESPACE idcolon LBRACE { Hash *h; $1 = Swig_symbol_current(); h = Swig_symbol_clookup($2,0); - if (h && ($1 == Getattr(h,k_symsymtab)) && (Strcmp(nodeType(h),"namespace") == 0)) { - if (Getattr(h,k_alias)) { - h = Getattr(h,k_namespace); + if (h && ($1 == Getattr(h,"sym:symtab")) && (Strcmp(nodeType(h),"namespace") == 0)) { + if (Getattr(h,"alias")) { + h = Getattr(h,"namespace"); Swig_warning(WARN_PARSE_NAMESPACE_ALIAS, cparse_file, cparse_line, "Namespace alias '%s' not allowed here. Assuming '%s'\n", - $2, Getattr(h,k_name)); - $2 = Getattr(h,k_name); + $2, Getattr(h,"name")); + $2 = Getattr(h,"name"); } - Swig_symbol_setscope(Getattr(h,k_symtab)); + Swig_symbol_setscope(Getattr(h,"symtab")); } else { Swig_symbol_newscope(); Swig_symbol_setscopename($2); @@ -3868,8 +3867,8 @@ cpp_namespace_decl : NAMESPACE idcolon LBRACE { } interface RBRACE { Node *n = $5; set_nodeType(n,"namespace"); - Setattr(n,k_name,$2); - Setattr(n,k_symtab, Swig_symbol_popscope()); + Setattr(n,"name",$2); + Setattr(n,"symtab", Swig_symbol_popscope()); Swig_symbol_setscope($1); $$ = n; Delete(Namespaceprefix); @@ -3881,7 +3880,7 @@ cpp_namespace_decl : NAMESPACE idcolon LBRACE { $1 = Swig_symbol_current(); h = Swig_symbol_clookup((char *)" ",0); if (h && (Strcmp(nodeType(h),"namespace") == 0)) { - Swig_symbol_setscope(Getattr(h,k_symtab)); + Swig_symbol_setscope(Getattr(h,"symtab")); } else { Swig_symbol_newscope(); /* we don't use "__unnamed__", but a long 'empty' name */ @@ -3891,8 +3890,8 @@ cpp_namespace_decl : NAMESPACE idcolon LBRACE { } interface RBRACE { $$ = $4; set_nodeType($$,"namespace"); - Setattr($$,k_unnamed,"1"); - Setattr($$,k_symtab, Swig_symbol_popscope()); + Setattr($$,"unnamed","1"); + Setattr($$,"symtab", Swig_symbol_popscope()); Swig_symbol_setscope($1); Delete(Namespaceprefix); Namespaceprefix = Swig_symbol_qualifiedscopename(0); @@ -3902,8 +3901,8 @@ cpp_namespace_decl : NAMESPACE idcolon LBRACE { /* Namespace alias */ Node *n; $$ = new_node("namespace"); - Setattr($$,k_name,$2); - Setattr($$,k_alias,$4); + Setattr($$,"name",$2); + Setattr($$,"alias",$4); n = Swig_symbol_clookup($4,0); if (!n) { Swig_error(cparse_file, cparse_line, "Unknown namespace '%s'\n", $4); @@ -3913,13 +3912,13 @@ cpp_namespace_decl : NAMESPACE idcolon LBRACE { Swig_error(cparse_file, cparse_line, "'%s' is not a namespace\n",$4); $$ = 0; } else { - while (Getattr(n,k_alias)) { - n = Getattr(n,k_namespace); + while (Getattr(n,"alias")) { + n = Getattr(n,"namespace"); } - Setattr($$,k_namespace,n); + Setattr($$,"namespace",n); add_symbols($$); /* Set up a scope alias */ - Swig_symbol_alias($2,Getattr(n,k_symtab)); + Swig_symbol_alias($2,Getattr(n,"symtab")); } } } @@ -3974,11 +3973,11 @@ cpp_member : c_declaration { $$ = $1; } $$ = $1; if (extendmode) { String *symname; - symname= make_name($$,Getattr($$,k_name), Getattr($$,k_decl)); - if (Strcmp(symname,Getattr($$,k_name)) == 0) { + symname= make_name($$,Getattr($$,"name"), Getattr($$,"decl")); + if (Strcmp(symname,Getattr($$,"name")) == 0) { /* No renaming operation. Set name to class name */ Delete(yyrename); - yyrename = NewString(Getattr(current_class,k_symname)); + yyrename = NewString(Getattr(current_class,"sym:name")); } else { Delete(yyrename); yyrename = symname; @@ -4015,16 +4014,16 @@ cpp_constructor_decl : storage_class type LPAREN parms RPAREN ctor_end { if (Classprefix) { SwigType *decl = NewStringEmpty(); $$ = new_node("constructor"); - Setattr($$,k_storage,$1); - Setattr($$,k_name,$2); - Setattr($$,k_parms,$4); + Setattr($$,"storage",$1); + Setattr($$,"name",$2); + Setattr($$,"parms",$4); SwigType_add_function(decl,$4); - Setattr($$,k_decl,decl); - Setattr($$,k_throws,$6.throws); - Setattr($$,k_throw,$6.throwf); + Setattr($$,"decl",decl); + Setattr($$,"throws",$6.throws); + Setattr($$,"throw",$6.throwf); if (Len(scanner_ccode)) { String *code = Copy(scanner_ccode); - Setattr($$,k_code,code); + Setattr($$,"code",code); Delete(code); } SetFlag($$,"feature:new"); @@ -4040,21 +4039,21 @@ cpp_destructor_decl : NOT idtemplate LPAREN parms RPAREN cpp_end { String *name = NewStringf("%s",$2); if (*(Char(name)) != '~') Insert(name,0,"~"); $$ = new_node("destructor"); - Setattr($$,k_name,name); + Setattr($$,"name",name); Delete(name); if (Len(scanner_ccode)) { String *code = Copy(scanner_ccode); - Setattr($$,k_code,code); + Setattr($$,"code",code); Delete(code); } { String *decl = NewStringEmpty(); SwigType_add_function(decl,$4); - Setattr($$,k_decl,decl); + Setattr($$,"decl",decl); Delete(decl); } - Setattr($$,k_throws,$6.throws); - Setattr($$,k_throw,$6.throwf); + Setattr($$,"throws",$6.throws); + Setattr($$,"throw",$6.throwf); add_symbols($$); } @@ -4072,25 +4071,25 @@ cpp_destructor_decl : NOT idtemplate LPAREN parms RPAREN cpp_end { $3 = NewStringf("%s%s",$3,c); } } - Setattr($$,k_storage,"virtual"); + Setattr($$,"storage","virtual"); name = NewStringf("%s",$3); if (*(Char(name)) != '~') Insert(name,0,"~"); - Setattr($$,k_name,name); + Setattr($$,"name",name); Delete(name); - Setattr($$,k_throws,$7.throws); - Setattr($$,k_throw,$7.throwf); + Setattr($$,"throws",$7.throws); + Setattr($$,"throw",$7.throwf); if ($7.val) { - Setattr($$,k_value,"0"); + Setattr($$,"value","0"); } if (Len(scanner_ccode)) { String *code = Copy(scanner_ccode); - Setattr($$,k_code,code); + Setattr($$,"code",code); Delete(code); } { String *decl = NewStringEmpty(); SwigType_add_function(decl,$5); - Setattr($$,k_decl,decl); + Setattr($$,"decl",decl); Delete(decl); } @@ -4102,50 +4101,50 @@ cpp_destructor_decl : NOT idtemplate LPAREN parms RPAREN cpp_end { /* C++ type conversion operator */ cpp_conversion_operator : storage_class COPERATOR type pointer LPAREN parms RPAREN cpp_vend { $$ = new_node("cdecl"); - Setattr($$,k_type,$3); - Setattr($$,k_name,$2); - Setattr($$,k_storage,$1); + Setattr($$,"type",$3); + Setattr($$,"name",$2); + Setattr($$,"storage",$1); SwigType_add_function($4,$6); if ($8.qualifier) { SwigType_push($4,$8.qualifier); } - Setattr($$,k_decl,$4); - Setattr($$,k_parms,$6); - Setattr($$,k_conversionoperator,"1"); + Setattr($$,"decl",$4); + Setattr($$,"parms",$6); + Setattr($$,"conversion_operator","1"); add_symbols($$); } | storage_class COPERATOR type AND LPAREN parms RPAREN cpp_vend { SwigType *decl; $$ = new_node("cdecl"); - Setattr($$,k_type,$3); - Setattr($$,k_name,$2); - Setattr($$,k_storage,$1); + Setattr($$,"type",$3); + Setattr($$,"name",$2); + Setattr($$,"storage",$1); decl = NewStringEmpty(); SwigType_add_reference(decl); SwigType_add_function(decl,$6); if ($8.qualifier) { SwigType_push(decl,$8.qualifier); } - Setattr($$,k_decl,decl); - Setattr($$,k_parms,$6); - Setattr($$,k_conversionoperator,"1"); + Setattr($$,"decl",decl); + Setattr($$,"parms",$6); + Setattr($$,"conversion_operator","1"); add_symbols($$); } | storage_class COPERATOR type LPAREN parms RPAREN cpp_vend { String *t = NewStringEmpty(); $$ = new_node("cdecl"); - Setattr($$,k_type,$3); - Setattr($$,k_name,$2); - Setattr($$,k_storage,$1); + Setattr($$,"type",$3); + Setattr($$,"name",$2); + Setattr($$,"storage",$1); SwigType_add_function(t,$5); if ($7.qualifier) { SwigType_push(t,$7.qualifier); } - Setattr($$,k_decl,t); - Setattr($$,k_parms,$5); - Setattr($$,k_conversionoperator,"1"); + Setattr($$,"decl",t); + Setattr($$,"parms",$5); + Setattr($$,"conversion_operator","1"); add_symbols($$); } ; @@ -4161,14 +4160,14 @@ cpp_catch_decl : CATCH LPAREN parms RPAREN LBRACE { /* public: */ cpp_protection_decl : PUBLIC COLON { $$ = new_node("access"); - Setattr($$,k_kind,"public"); + Setattr($$,"kind","public"); cplus_mode = CPLUS_PUBLIC; } /* private: */ | PRIVATE COLON { $$ = new_node("access"); - Setattr($$,k_kind,"private"); + Setattr($$,"kind","private"); cplus_mode = CPLUS_PRIVATE; } @@ -4176,7 +4175,7 @@ cpp_protection_decl : PUBLIC COLON { | PROTECTED COLON { $$ = new_node("access"); - Setattr($$,k_kind,"protected"); + Setattr($$,"kind","protected"); cplus_mode = CPLUS_PROTECTED; } ; @@ -4223,9 +4222,9 @@ cpp_nested : storage_class cpptype ID LBRACE { cparse_start_line = cparse_line $$ = new_node("classforward"); Setfile($$,cparse_file); Setline($$,cparse_line); - Setattr($$,k_kind,$2); - Setattr($$,k_name,$3); - Setattr($$,k_symweak, "1"); + Setattr($$,"kind",$2); + Setattr($$,"name",$3); + Setattr($$,"sym:weak", "1"); add_symbols($$); } } @@ -4379,7 +4378,7 @@ parms : rawparms { $$ = $1; p = $1; while (p) { - Replace(Getattr(p,k_type),"typename ", "", DOH_REPLACE_ANY); + Replace(Getattr(p,"type"),"typename ", "", DOH_REPLACE_ANY); p = nextSibling(p); } } @@ -4410,7 +4409,7 @@ parm : rawtype parameter_declarator { Setfile($$,cparse_file); Setline($$,cparse_line); if ($2.defarg) { - Setattr($$,k_value,$2.defarg); + Setattr($$,"value",$2.defarg); } } @@ -4432,8 +4431,8 @@ valparms : rawvalparms { $$ = $1; p = $1; while (p) { - if (Getattr(p,k_type)) { - Replace(Getattr(p,k_type),"typename ", "", DOH_REPLACE_ANY); + if (Getattr(p,"type")) { + Replace(Getattr(p,"type"),"typename ", "", DOH_REPLACE_ANY); } p = nextSibling(p); } @@ -4467,15 +4466,15 @@ valparm : parm { Node *n = 0; while (!n) { - type = Getattr($1,k_type); + type = Getattr($1,"type"); n = Swig_symbol_clookup(type,0); /* See if we can find a node that matches the typename */ if ((n) && (Strcmp(nodeType(n),"cdecl") == 0)) { - SwigType *decl = Getattr(n,k_decl); + SwigType *decl = Getattr(n,"decl"); if (!SwigType_isfunction(decl)) { - String *value = Getattr(n,k_value); + String *value = Getattr(n,"value"); if (value) { String *v = Copy(value); - Setattr($1,k_type,v); + Setattr($1,"type",v); Delete(v); n = 0; } @@ -4491,7 +4490,7 @@ valparm : parm { $$ = NewParm(0,0); Setfile($$,cparse_file); Setline($$,cparse_line); - Setattr($$,k_value,$1.val); + Setattr($$,"value",$1.val); } ; @@ -5279,24 +5278,24 @@ enumlist : enumlist COMMA edecl { edecl : ID { SwigType *type = NewSwigType(T_INT); $$ = new_node("enumitem"); - Setattr($$,k_name,$1); - Setattr($$,k_type,type); + Setattr($$,"name",$1); + Setattr($$,"type",type); SetFlag($$,"feature:immutable"); Delete(type); } | ID EQUAL etype { $$ = new_node("enumitem"); - Setattr($$,k_name,$1); + Setattr($$,"name",$1); Setattr($$,"enumvalue", $3.val); if ($3.type == T_CHAR) { SwigType *type = NewSwigType(T_CHAR); - Setattr($$,k_value,NewStringf("\'%(escape)s\'", $3.val)); - Setattr($$,k_type,type); + Setattr($$,"value",NewStringf("\'%(escape)s\'", $3.val)); + Setattr($$,"type",type); Delete(type); } else { SwigType *type = NewSwigType(T_INT); - Setattr($$,k_value,$1); - Setattr($$,k_type,type); + Setattr($$,"value",$1); + Setattr($$,"type",type); Delete(type); } SetFlag($$,"feature:immutable"); @@ -5331,7 +5330,7 @@ expr : valexpr { $$ = $1; } if (Strcmp(nodeType(n),"enumitem") == 0) { String *q = Swig_symbol_qualified(n); if (q) { - $$.val = NewStringf("%s::%s", q, Getattr(n,k_name)); + $$.val = NewStringf("%s::%s", q, Getattr(n,"name")); Delete(q); } } @@ -5545,7 +5544,7 @@ raw_inherit : COLON { inherit_list = 1; } base_list { $$ = $3; inherit_list base_list : base_specifier { Hash *list = NewHash(); Node *base = $1; - Node *name = Getattr(base,k_name); + Node *name = Getattr(base,"name"); List *lpublic = NewList(); List *lprotected = NewList(); List *lprivate = NewList(); @@ -5555,15 +5554,15 @@ base_list : base_specifier { Delete(lpublic); Delete(lprotected); Delete(lprivate); - Append(Getattr(list,Getattr(base,k_access)),name); + Append(Getattr(list,Getattr(base,"access")),name); $$ = list; } | base_list COMMA base_specifier { Hash *list = $1; Node *base = $3; - Node *name = Getattr(base,k_name); - Append(Getattr(list,Getattr(base,k_access)),name); + Node *name = Getattr(base,"name"); + Append(Getattr(list,Getattr(base,"access")),name); $$ = list; } ; @@ -5572,21 +5571,21 @@ base_specifier : opt_virtual idcolon { $$ = NewHash(); Setfile($$,cparse_file); Setline($$,cparse_line); - Setattr($$,k_name,$2); + Setattr($$,"name",$2); if (last_cpptype && (Strcmp(last_cpptype,"struct") != 0)) { - Setattr($$,k_access,"private"); + Setattr($$,"access","private"); Swig_warning(WARN_PARSE_NO_ACCESS,cparse_file,cparse_line, "No access specifier given for base class %s (ignored).\n",$2); } else { - Setattr($$,k_access,"public"); + Setattr($$,"access","public"); } } | opt_virtual access_specifier opt_virtual idcolon { $$ = NewHash(); Setfile($$,cparse_file); Setline($$,cparse_line); - Setattr($$,k_name,$4); - Setattr($$,k_access,$2); + Setattr($$,"name",$4); + Setattr($$,"access",$2); if (Strcmp($2,"public") != 0) { Swig_warning(WARN_PARSE_PRIVATE_INHERIT, cparse_file, cparse_line,"%s inheritance ignored.\n", $2); @@ -5830,8 +5829,8 @@ options : LPAREN kwargs RPAREN { n = $2; while(n) { String *name, *value; - name = Getattr(n,k_name); - value = Getattr(n,k_value); + name = Getattr(n,"name"); + value = Getattr(n,"value"); if (!value) value = (String *) "1"; Setattr($$,name, value); n = nextSibling(n); @@ -5843,31 +5842,31 @@ options : LPAREN kwargs RPAREN { /* Keyword arguments */ kwargs : idstring EQUAL stringnum { $$ = NewHash(); - Setattr($$,k_name,$1); - Setattr($$,k_value,$3); + Setattr($$,"name",$1); + Setattr($$,"value",$3); } | idstring EQUAL stringnum COMMA kwargs { $$ = NewHash(); - Setattr($$,k_name,$1); - Setattr($$,k_value,$3); + Setattr($$,"name",$1); + Setattr($$,"value",$3); set_nextSibling($$,$5); } | idstring { $$ = NewHash(); - Setattr($$,k_name,$1); + Setattr($$,"name",$1); } | idstring COMMA kwargs { $$ = NewHash(); - Setattr($$,k_name,$1); + Setattr($$,"name",$1); set_nextSibling($$,$3); } | idstring EQUAL stringtype { $$ = $3; - Setattr($$,k_name,$1); + Setattr($$,"name",$1); } | idstring EQUAL stringtype COMMA kwargs { $$ = $3; - Setattr($$,k_name,$1); + Setattr($$,"name",$1); set_nextSibling($$,$5); } ; diff --git a/Source/CParse/templ.c b/Source/CParse/templ.c index 12d9afdca..2d5f31a59 100644 --- a/Source/CParse/templ.c +++ b/Source/CParse/templ.c @@ -10,7 +10,6 @@ char cvsroot_templ_c[] = "$Id$"; #include "swig.h" -#include "swigkeys.h" #include "cparse.h" static int template_debug = 0; @@ -19,16 +18,16 @@ static int template_debug = 0; String *baselists[3]; void SwigType_template_init() { - baselists[0] = k_baselist; - baselists[1] = k_protectedbaselist; - baselists[2] = k_privatebaselist; + baselists[0] = "baselist"; + baselists[1] = "protectedbaselist"; + baselists[2] = "privatebaselist"; } static void add_parms(ParmList *p, List *patchlist, List *typelist) { while (p) { - SwigType *ty = Getattr(p, k_type); - SwigType *val = Getattr(p, k_value); + SwigType *ty = Getattr(p, "type"); + SwigType *val = Getattr(p, "value"); Append(typelist, ty); Append(typelist, val); Append(patchlist, val); @@ -54,14 +53,14 @@ static int cparse_template_expand(Node *n, String *tname, String *rname, String String *nodeType = nodeType(n); if (!n) return 0; - if (Getattr(n, k_error)) + if (Getattr(n, "error")) return 0; - if (Equal(nodeType, k_template)) { + if (Equal(nodeType, "template")) { /* Change the node type back to normal */ if (!expanded) { expanded = 1; - set_nodeType(n, Getattr(n, k_templatetype)); + set_nodeType(n, Getattr(n, "templatetype")); ret = cparse_template_expand(n, tname, rname, templateargs, patchlist, typelist, cpatchlist); expanded = 0; return ret; @@ -69,37 +68,37 @@ static int cparse_template_expand(Node *n, String *tname, String *rname, String /* Called when template appears inside another template */ /* Member templates */ - set_nodeType(n, Getattr(n, k_templatetype)); + set_nodeType(n, Getattr(n, "templatetype")); ret = cparse_template_expand(n, tname, rname, templateargs, patchlist, typelist, cpatchlist); - set_nodeType(n, k_template); + set_nodeType(n, "template"); return ret; } - } else if (Equal(nodeType, k_cdecl)) { + } else if (Equal(nodeType, "cdecl")) { /* A simple C declaration */ SwigType *t, *v, *d; String *code; - t = Getattr(n, k_type); - v = Getattr(n, k_value); - d = Getattr(n, k_decl); + t = Getattr(n, "type"); + v = Getattr(n, "value"); + d = Getattr(n, "decl"); - code = Getattr(n, k_code); + code = Getattr(n, "code"); Append(typelist, t); Append(typelist, d); Append(patchlist, v); Append(cpatchlist, code); - if (Getattr(n, k_conversionoperator)) { - Append(cpatchlist, Getattr(n, k_name)); - if (Getattr(n, k_symname)) { - Append(cpatchlist, Getattr(n, k_symname)); + if (Getattr(n, "conversion_operator")) { + Append(cpatchlist, Getattr(n, "name")); + if (Getattr(n, "sym:name")) { + Append(cpatchlist, Getattr(n, "sym:name")); } } - add_parms(Getattr(n, k_parms), cpatchlist, typelist); - add_parms(Getattr(n, k_throws), cpatchlist, typelist); + add_parms(Getattr(n, "parms"), cpatchlist, typelist); + add_parms(Getattr(n, "throws"), cpatchlist, typelist); - } else if (Equal(nodeType, k_class)) { + } else if (Equal(nodeType, "class")) { /* Patch base classes */ { int b = 0; @@ -125,15 +124,15 @@ static int cparse_template_expand(Node *n, String *tname, String *rname, String } } } else if (Equal(nodeType, "constructor")) { - String *name = Getattr(n, k_name); - if (!(Getattr(n, k_templatetype))) { + String *name = Getattr(n, "name"); + if (!(Getattr(n, "templatetype"))) { String *symname; String *stripped_name = SwigType_templateprefix(name); if (Strstr(tname, stripped_name)) { Replaceid(name, stripped_name, tname); } Delete(stripped_name); - symname = Getattr(n, k_symname); + symname = Getattr(n, "sym:name"); if (symname) { stripped_name = SwigType_templateprefix(symname); if (Strstr(tname, stripped_name)) { @@ -142,11 +141,11 @@ static int cparse_template_expand(Node *n, String *tname, String *rname, String Delete(stripped_name); } if (strchr(Char(name), '<')) { - Append(patchlist, Getattr(n, k_name)); + Append(patchlist, Getattr(n, "name")); } else { Append(name, templateargs); } - name = Getattr(n, k_symname); + name = Getattr(n, "sym:name"); if (name) { if (strchr(Char(name), '<')) { Clear(name); @@ -159,48 +158,48 @@ static int cparse_template_expand(Node *n, String *tname, String *rname, String Delete(tmp); } } - /* Setattr(n,k_symname,name); */ + /* Setattr(n,"sym:name",name); */ } - Append(cpatchlist, Getattr(n, k_code)); - Append(typelist, Getattr(n, k_decl)); - add_parms(Getattr(n, k_parms), cpatchlist, typelist); - add_parms(Getattr(n, k_throws), cpatchlist, typelist); + Append(cpatchlist, Getattr(n, "code")); + Append(typelist, Getattr(n, "decl")); + add_parms(Getattr(n, "parms"), cpatchlist, typelist); + add_parms(Getattr(n, "throws"), cpatchlist, typelist); } else if (Equal(nodeType, "destructor")) { - String *name = Getattr(n, k_name); + String *name = Getattr(n, "name"); if (name && strchr(Char(name), '<')) { - Append(patchlist, Getattr(n, k_name)); + Append(patchlist, Getattr(n, "name")); } else { Append(name, templateargs); } - name = Getattr(n, k_symname); + name = Getattr(n, "sym:name"); if (name && strchr(Char(name), '<')) { String *sn = Copy(tname); - Setattr(n, k_symname, sn); + Setattr(n, "sym:name", sn); Delete(sn); } else { Replace(name, tname, rname, DOH_REPLACE_ANY); } - /* Setattr(n,k_symname,name); */ - Append(cpatchlist, Getattr(n, k_code)); - } else if (Equal(nodeType, k_using)) { - String *uname = Getattr(n, k_uname); + /* Setattr(n,"sym:name",name); */ + Append(cpatchlist, Getattr(n, "code")); + } else if (Equal(nodeType, "using")) { + String *uname = Getattr(n, "uname"); if (uname && strchr(Char(uname), '<')) { Append(patchlist, uname); } - if (Getattr(n, k_namespace)) { + if (Getattr(n, "namespace")) { /* Namespace link. This is nasty. Is other namespace defined? */ } } else { /* Look for obvious parameters */ Node *cn; - Append(cpatchlist, Getattr(n, k_code)); - Append(typelist, Getattr(n, k_type)); - Append(typelist, Getattr(n, k_decl)); - add_parms(Getattr(n, k_parms), cpatchlist, typelist); - add_parms(Getattr(n, k_kwargs), cpatchlist, typelist); + Append(cpatchlist, Getattr(n, "code")); + Append(typelist, Getattr(n, "type")); + Append(typelist, Getattr(n, "decl")); + add_parms(Getattr(n, "parms"), cpatchlist, typelist); + add_parms(Getattr(n, "kwargs"), cpatchlist, typelist); add_parms(Getattr(n, "pattern"), cpatchlist, typelist); - add_parms(Getattr(n, k_throws), cpatchlist, typelist); + add_parms(Getattr(n, "throws"), cpatchlist, typelist); cn = firstChild(n); while (cn) { cparse_template_expand(cn, tname, rname, templateargs, patchlist, typelist, cpatchlist); @@ -249,25 +248,25 @@ int Swig_cparse_template_expand(Node *n, String *rname, ParmList *tparms, Symtab Delete(tmp); } - tname = Copy(Getattr(n, k_name)); + tname = Copy(Getattr(n, "name")); tbase = Swig_scopename_last(tname); /* Look for partial specialization matching */ - if (Getattr(n, k_partialargs)) { + if (Getattr(n, "partialargs")) { Parm *p, *tp; - ParmList *ptargs = SwigType_function_parms(Getattr(n, k_partialargs)); + ParmList *ptargs = SwigType_function_parms(Getattr(n, "partialargs")); p = ptargs; tp = tparms; while (p && tp) { SwigType *ptype; SwigType *tptype; SwigType *partial_type; - ptype = Getattr(p, k_type); - tptype = Getattr(tp, k_type); + ptype = Getattr(p, "type"); + tptype = Getattr(tp, "type"); if (ptype && tptype) { partial_type = partial_arg(tptype, ptype); /* Printf(stdout,"partial '%s' '%s' ---> '%s'\n", tptype, ptype, partial_type); */ - Setattr(tp, k_type, partial_type); + Setattr(tp, "type", partial_type); Delete(partial_type); } p = nextSibling(p); @@ -280,7 +279,7 @@ int Swig_cparse_template_expand(Node *n, String *rname, ParmList *tparms, Symtab if (0) { Parm *p = tparms; while (p) { - Printf(stdout, "tparm: '%s' '%s' '%s'\n", Getattr(p, k_name), Getattr(p, k_type), Getattr(p, k_value)); + Printf(stdout, "tparm: '%s' '%s' '%s'\n", Getattr(p, "name"), Getattr(p, "type"), Getattr(p, "value")); p = nextSibling(p); } } @@ -292,7 +291,7 @@ int Swig_cparse_template_expand(Node *n, String *rname, ParmList *tparms, Symtab /* Set the name */ { - String *name = Getattr(n, k_name); + String *name = Getattr(n, "name"); if (name) { Append(name, templateargs); } @@ -301,25 +300,25 @@ int Swig_cparse_template_expand(Node *n, String *rname, ParmList *tparms, Symtab /* Patch all of the types */ { - Parm *tp = Getattr(n, k_templateparms); + Parm *tp = Getattr(n, "templateparms"); Parm *p = tparms; /* Printf(stdout,"%s\n", ParmList_str_defaultargs(tp)); */ if (tp) { - Symtab *tsdecl = Getattr(n, k_symsymtab); + Symtab *tsdecl = Getattr(n, "sym:symtab"); while (p && tp) { String *name, *value, *valuestr, *tydef, *tmp, *tmpr; int sz, i; String *dvalue = 0; String *qvalue = 0; - name = Getattr(tp, k_name); - value = Getattr(p, k_value); - tydef = Getattr(p, k_typedef); + name = Getattr(tp, "name"); + value = Getattr(p, "value"); + tydef = Getattr(p, "typedef"); if (name) { if (!value) - value = Getattr(p, k_type); + value = Getattr(p, "type"); qvalue = Swig_symbol_typedef_reduce(value, tsdecl); dvalue = Swig_symbol_type_qualify(qvalue, tsdecl); if (SwigType_istemplate(dvalue)) { @@ -334,7 +333,7 @@ int Swig_cparse_template_expand(Node *n, String *rname, ParmList *tparms, Symtab { Parm *rp = nextSibling(p); while (rp) { - String *rvalue = Getattr(rp, k_value); + String *rvalue = Getattr(rp, "value"); if (rvalue) { Replace(rvalue, name, dvalue, DOH_REPLACE_ID); } @@ -393,7 +392,7 @@ int Swig_cparse_template_expand(Node *n, String *rname, ParmList *tparms, Symtab /* Patch bases */ { - List *bases = Getattr(n, k_baselist); + List *bases = Getattr(n, "baselist"); if (bases) { Iterator b; for (b = First(bases); b.item; b = Next(b)) { @@ -411,7 +410,7 @@ int Swig_cparse_template_expand(Node *n, String *rname, ParmList *tparms, Symtab Delete(tname); Delete(templateargs); - /* set_nodeType(n,k_template); */ + /* set_nodeType(n,"template"); */ return 0; } @@ -438,9 +437,9 @@ static Node *template_locate(String *name, Parm *tparms, Symtab *tscope) { /* Add default values from generic template */ if (templ) { - Symtab *tsdecl = Getattr(templ, k_symsymtab); + Symtab *tsdecl = Getattr(templ, "sym:symtab"); - targs = Getattr(templ, k_templateparms); + targs = Getattr(templ, "templateparms"); Swig_symbol_template_defargs(parms, targs, tscope, tsdecl); } @@ -448,10 +447,10 @@ static Node *template_locate(String *name, Parm *tparms, Symtab *tscope) { /* reduce the typedef */ p = parms; while (p) { - SwigType *ty = Getattr(p, k_type); + SwigType *ty = Getattr(p, "type"); if (ty) { SwigType *nt = Swig_symbol_type_qualify(ty, tscope); - Setattr(p, k_type, nt); + Setattr(p, "type", nt); Delete(nt); } p = nextSibling(p); @@ -483,9 +482,9 @@ static Node *template_locate(String *name, Parm *tparms, Symtab *tscope) { if (n) { Node *tn; String *nodeType = nodeType(n); - if (Equal(nodeType, k_template)) + if (Equal(nodeType, "template")) goto success; - tn = Getattr(n, k_template); + tn = Getattr(n, "template"); if (tn) { n = tn; goto success; /* Previously wrapped by a template return that */ @@ -506,9 +505,9 @@ static Node *template_locate(String *name, Parm *tparms, Symtab *tscope) { p = parms; while (p) { String *t; - t = Getattr(p, k_type); + t = Getattr(p, "type"); if (!t) - t = Getattr(p, k_value); + t = Getattr(p, "value"); if (t) { String *ty = Swig_symbol_typedef_reduce(t, tscope); String *tb = SwigType_base(ty); @@ -537,7 +536,7 @@ static Node *template_locate(String *name, Parm *tparms, Symtab *tscope) { String *ss; Iterator pi; - partials = Getattr(templ, k_partials); + partials = Getattr(templ, "partials"); if (partials) { for (pi = First(partials); pi.item; pi = Next(pi)) { ss = Copy(pi.item); @@ -546,9 +545,9 @@ static Node *template_locate(String *name, Parm *tparms, Symtab *tscope) { while (p) { String *t, *tn; sprintf(tmp, "$%d", i); - t = Getattr(p, k_type); + t = Getattr(p, "type"); if (!t) - t = Getattr(p, k_value); + t = Getattr(p, "value"); if (t) { String *ty = Swig_symbol_typedef_reduce(t, tscope); tn = SwigType_base(ty); @@ -580,7 +579,7 @@ static Node *template_locate(String *name, Parm *tparms, Symtab *tscope) { if (Len(mpartials) > 1) { if (n) { Swig_warning(WARN_PARSE_TEMPLATE_AMBIG, cparse_file, cparse_line, "Instantiation of template '%s' is ambiguous,\n", SwigType_namestr(tname)); - Swig_warning(WARN_PARSE_TEMPLATE_AMBIG, Getfile(n), Getline(n), " instantiation '%s' is used.\n", SwigType_namestr(Getattr(n, k_name))); + Swig_warning(WARN_PARSE_TEMPLATE_AMBIG, Getfile(n), Getline(n), " instantiation '%s' is used.\n", SwigType_namestr(Getattr(n, "name"))); } } } @@ -592,7 +591,7 @@ static Node *template_locate(String *name, Parm *tparms, Symtab *tscope) { Swig_error(cparse_file, cparse_line, "Template '%s' undefined.\n", name); } else if (n) { String *nodeType = nodeType(n); - if (!Equal(nodeType, k_template)) { + if (!Equal(nodeType, "template")) { Swig_error(cparse_file, cparse_line, "'%s' is not defined as a template. (%s)\n", name, nodeType); n = 0; } @@ -625,8 +624,8 @@ Node *Swig_cparse_template_locate(String *name, Parm *tparms, Symtab *tscope) { if (n) { String *nodeType = nodeType(n); int isclass = 0; - assert(Equal(nodeType, k_template)); - isclass = (Equal(Getattr(n, k_templatetype), k_class)); + assert(Equal(nodeType, "template")); + isclass = (Equal(Getattr(n, "templatetype"), "class")); if (!isclass) { /* If not a templated class we must have a templated function. The template found is not necessarily the one we want when dealing with templated @@ -641,13 +640,13 @@ Node *Swig_cparse_template_locate(String *name, Parm *tparms, Symtab *tscope) { n = Swig_symbol_clookup_local(name, 0); while (n) { - Parm *tparmsfound = Getattr(n, k_templateparms); + Parm *tparmsfound = Getattr(n, "templateparms"); if (ParmList_len(tparms) == ParmList_len(tparmsfound)) { /* successful match */ break; } /* repeat until we find a match with correct number of templated parameters */ - n = Getattr(n, k_symnextSibling); + n = Getattr(n, "sym:nextSibling"); } if (!n) { diff --git a/Source/CParse/util.c b/Source/CParse/util.c index febd19add..efae41051 100644 --- a/Source/CParse/util.c +++ b/Source/CParse/util.c @@ -10,7 +10,6 @@ char cvsroot_util_c[] = "$Id$"; #include "swig.h" -#include "swigkeys.h" #include "cparse.h" /* ----------------------------------------------------------------------------- @@ -77,13 +76,13 @@ void Swig_cparse_replace_descriptor(String *s) { * ----------------------------------------------------------------------------- */ void cparse_normalize_void(Node *n) { - String *decl = Getattr(n, k_decl); - Parm *parms = Getattr(n, k_parms); + String *decl = Getattr(n, "decl"); + Parm *parms = Getattr(n, "parms"); if (SwigType_isfunction(decl)) { - if ((ParmList_len(parms) == 1) && (SwigType_type(Getattr(parms, k_type)) == T_VOID)) { + if ((ParmList_len(parms) == 1) && (SwigType_type(Getattr(parms, "type")) == T_VOID)) { Replaceall(decl, "f(void).", "f()."); - Delattr(n, k_parms); + Delattr(n, "parms"); } } } diff --git a/Source/Makefile.am b/Source/Makefile.am index 4a9583624..5b39a4fe6 100644 --- a/Source/Makefile.am +++ b/Source/Makefile.am @@ -87,8 +87,7 @@ eswig_SOURCES = CParse/cscanner.c \ Swig/typemap.c \ Swig/typesys.c \ Swig/warn.c \ - Swig/wrapfunc.c \ - Swig/swigkeys.c + Swig/wrapfunc.c bin_PROGRAMS = eswig eswig_LDADD = @SWIGLIBS@ diff --git a/Source/Modules/java.cxx b/Source/Modules/java.cxx index f175b3daf..cdd3de3b0 100644 --- a/Source/Modules/java.cxx +++ b/Source/Modules/java.cxx @@ -1920,7 +1920,7 @@ public: String *this_type = Copy(getClassType()); String *name = NewString("self"); - String *qualifier = Getattr(n, k_qualifier); + String *qualifier = Getattr(n, "qualifier"); if (qualifier) SwigType_push(this_type, qualifier); SwigType_add_pointer(this_type); diff --git a/Source/Modules/lang.cxx b/Source/Modules/lang.cxx index 183062a6c..1f508f514 100644 --- a/Source/Modules/lang.cxx +++ b/Source/Modules/lang.cxx @@ -1210,7 +1210,7 @@ int Language::memberfunctionHandler(Node *n) { String *director_type = 0; if (!is_public(n) && (is_member_director(CurrentClass, n) || GetFlag(n, "explicitcall"))) { director_type = Copy(DirectorClassName); - String *qualifier = Getattr(n, k_qualifier); + String *qualifier = Getattr(n, "qualifier"); if (qualifier) SwigType_push(director_type, qualifier); SwigType_add_pointer(director_type); @@ -2119,8 +2119,8 @@ static void addCopyConstructor(Node *n) { for (c = firstChild(n); c; c = nextSibling(c)) { const char *tag = Char(nodeType(c)); if (strcmp(tag, "constructor") == 0) { - String *cname = Getattr(c, k_name); - String *csname = Getattr(c, k_symname); + String *cname = Getattr(c, "name"); + String *csname = Getattr(c, "sym:name"); String *clast = Swig_scopename_last(cname); if (Equal(csname, clast)) { oldname = csname; diff --git a/Source/Modules/typepass.cxx b/Source/Modules/typepass.cxx index abcb0492c..bcda4a154 100644 --- a/Source/Modules/typepass.cxx +++ b/Source/Modules/typepass.cxx @@ -239,7 +239,7 @@ class TypePass:private Dispatcher { Symtab *st = Getattr(cls, "symtab"); Symtab *bst = Getattr(bclass, "symtab"); if (st == bst) { - Swig_warning(WARN_PARSE_REC_INHERITANCE, Getfile(cls), Getline(cls), "Recursive scope inheritance of '%s'.\n", Getattr(cls, k_name)); + Swig_warning(WARN_PARSE_REC_INHERITANCE, Getfile(cls), Getline(cls), "Recursive scope inheritance of '%s'.\n", Getattr(cls, "name")); continue; } Symtab *s = Swig_symbol_current(); @@ -866,7 +866,7 @@ class TypePass:private Dispatcher { String *ucode = is_void ? NewStringf("{ self->%s(", Getattr(n, "uname")) : NewStringf("{ return self->%s(", Getattr(n, "uname")); for (ParmList *p = parms; p;) { - Append(ucode, Getattr(p, k_name)); + Append(ucode, Getattr(p, "name")); p = nextSibling(p); if (p) Append(ucode, ","); diff --git a/Source/Swig/cwrap.c b/Source/Swig/cwrap.c index 5890029f3..4a9e5a4b1 100644 --- a/Source/Swig/cwrap.c +++ b/Source/Swig/cwrap.c @@ -11,13 +11,12 @@ char cvsroot_cwrap_c[] = "$Id$"; #include "swig.h" -#include "swigkeys.h" extern int cparse_cplusplus; static Parm *nonvoid_parms(Parm *p) { if (p) { - SwigType *t = Getattr(p, k_type); + SwigType *t = Getattr(p, "type"); if (SwigType_type(t) == T_VOID) return 0; } @@ -33,7 +32,7 @@ static Parm *nonvoid_parms(Parm *p) { String *Swig_cparm_name(Parm *p, int i) { String *name = NewStringf("arg%d", i + 1); if (p) { - Setattr(p, k_lname, name); + Setattr(p, "lname", name); } return name; @@ -190,12 +189,12 @@ int Swig_cargs(Wrapper *w, ParmList *p) { while (p != 0) { String *lname = Swig_cparm_name(p, i); - SwigType *pt = Getattr(p, k_type); + SwigType *pt = Getattr(p, "type"); if ((SwigType_type(pt) != T_VOID)) { String *local = 0; - String *type = Getattr(p, k_type); + String *type = Getattr(p, "type"); /* default values only emitted if in compact default args mode */ - String *pvalue = (compactdefargs) ? Getattr(p, k_value) : 0; + String *pvalue = (compactdefargs) ? Getattr(p, "value") : 0; SwigType *altty = SwigType_alttype(type, 0); int tycode = SwigType_type(type); if (tycode == T_REFERENCE) { @@ -342,7 +341,7 @@ String *Swig_cfunction_call(String_or_char *name, ParmList *parms) { Delete(nname); while (p) { - SwigType *pt = Getattr(p, k_type); + SwigType *pt = Getattr(p, "type"); if ((SwigType_type(pt) != T_VOID)) { SwigType *rpt = SwigType_typedef_resolve_all(pt); String *pname = Swig_cparm_name(p, i); @@ -406,7 +405,7 @@ static String *Swig_cmethod_call(String_or_char *name, ParmList *parms, String_o Replaceall(func, "this", rcaststr); Delete(rcaststr); } else { - pt = Getattr(p, k_type); + pt = Getattr(p, "type"); /* If the method is invoked through a dereferenced pointer, we don't add any casts (needed for smart pointers). Otherwise, we cast to the appropriate type */ @@ -442,7 +441,7 @@ static String *Swig_cmethod_call(String_or_char *name, ParmList *parms, String_o i++; p = nextSibling(p); while (p) { - pt = Getattr(p, k_type); + pt = Getattr(p, "type"); if ((SwigType_type(pt) != T_VOID)) { String *pname = Swig_cparm_name(p, i); String *rcaststr = SwigType_rcaststr(pt, pname); @@ -504,7 +503,7 @@ String *Swig_cppconstructor_base_call(String_or_char *name, ParmList *parms, int func = NewStringEmpty(); Printf(func, "new %s(", nname); while (p) { - pt = Getattr(p, k_type); + pt = Getattr(p, "type"); if ((SwigType_type(pt) != T_VOID)) { String *rcaststr = 0; String *pname = 0; @@ -514,10 +513,10 @@ String *Swig_cppconstructor_base_call(String_or_char *name, ParmList *parms, int pname = Swig_cparm_name(p, i); i++; } else { - if ((pname = Getattr(p, k_value))) + if ((pname = Getattr(p, "value"))) pname = Copy(pname); else - pname = Copy(Getattr(p, k_name)); + pname = Copy(Getattr(p, "name")); } rcaststr = SwigType_rcaststr(pt, pname); Append(func, rcaststr); @@ -576,7 +575,7 @@ String *Swig_rflag_search(Node *n, const String *attr, const String *noattr) { if (f) { return f; } else { - List *bl = Getattr(n, k_bases); + List *bl = Getattr(n, "bases"); if (bl) { Iterator bi; for (bi = First(bl); bi.item; bi = Next(bi)) { @@ -769,7 +768,7 @@ static String *extension_code(const String *function_name, ParmList *parms, Swig * ----------------------------------------------------------------------------- */ int Swig_add_extension_code(Node *n, const String *function_name, ParmList *parms, SwigType *return_type, const String *code, int cplusplus, const String *self) { String *body = extension_code(function_name, parms, return_type, code, cplusplus, self); - Setattr(n, k_wrapcode, body); + Setattr(n, "wrap:code", body); Delete(body); return SWIG_OK; } @@ -794,12 +793,12 @@ int Swig_MethodToFunction(Node *n, String *classname, int flags, SwigType *direc } /* If node is a member template expansion, we don't allow added code */ - if (Getattr(n, k_templatetype)) + if (Getattr(n, "templatetype")) flags &= ~(CWRAP_EXTEND); - name = Getattr(n, k_name); - qualifier = Getattr(n, k_qualifier); - parms = CopyParmList(nonvoid_parms(Getattr(n, k_parms))); + name = Getattr(n, "name"); + qualifier = Getattr(n, "qualifier"); + parms = CopyParmList(nonvoid_parms(Getattr(n, "parms"))); type = NewString(classname); if (qualifier) { @@ -808,7 +807,7 @@ int Swig_MethodToFunction(Node *n, String *classname, int flags, SwigType *direc SwigType_add_pointer(type); p = NewParm(type, "self"); Setattr(p, "self", "1"); - Setattr(p, k_hidden, "1"); + Setattr(p, "hidden", "1"); /* Disable the 'this' ownership in 'self' to manage inplace operations like: @@ -833,7 +832,7 @@ int Swig_MethodToFunction(Node *n, String *classname, int flags, SwigType *direc languages. */ if (GetFlag(n, "feature:self:disown")) { - Setattr(p, k_wrapdisown, "1"); + Setattr(p, "wrap:disown", "1"); } set_nextSibling(p, parms); Delete(type); @@ -844,27 +843,27 @@ int Swig_MethodToFunction(Node *n, String *classname, int flags, SwigType *direc String *call = 0; String *cres = 0; String *explicitcall_name = 0; - int pure_virtual = !(Cmp(Getattr(n, k_storage), "virtual")) && !(Cmp(Getattr(n, k_value), "0")); + int pure_virtual = !(Cmp(Getattr(n, "storage"), "virtual")) && !(Cmp(Getattr(n, "value"), "0")); /* Call the explicit method rather than allow for a polymorphic call */ if ((flags & CWRAP_DIRECTOR_TWO_CALLS) || (flags & CWRAP_DIRECTOR_ONE_CALL)) { String *access = Getattr(n, "access"); if (access && (Cmp(access, "protected") == 0)) { /* If protected access (can only be if a director method) then call the extra public accessor method (language module must provide this) */ - String *explicit_qualifier_tmp = SwigType_namestr(Getattr(Getattr(parentNode(n), "typescope"), k_qname)); + String *explicit_qualifier_tmp = SwigType_namestr(Getattr(Getattr(parentNode(n), "typescope"), "qname")); explicitcall_name = NewStringf("%sSwigPublic", name); explicit_qualifier = NewStringf("SwigDirector_%s", explicit_qualifier_tmp); Delete(explicit_qualifier_tmp); } else { - explicit_qualifier = SwigType_namestr(Getattr(Getattr(parentNode(n), "typescope"), k_qname)); + explicit_qualifier = SwigType_namestr(Getattr(Getattr(parentNode(n), "typescope"), "qname")); } } call = Swig_cmethod_call(explicitcall_name ? explicitcall_name : name, p, self, explicit_qualifier, director_type); - cres = Swig_cresult(Getattr(n, k_type), k_result, call); + cres = Swig_cresult(Getattr(n, "type"), "result", call); if (pure_virtual && is_director && (flags & CWRAP_DIRECTOR_TWO_CALLS)) { - String *qualifier = SwigType_namestr(Getattr(Getattr(parentNode(n), "typescope"), k_qname)); + String *qualifier = SwigType_namestr(Getattr(Getattr(parentNode(n), "typescope"), "qname")); Delete(cres); cres = NewStringf("Swig::DirectorPureVirtualException::raise(\"%s::%s\");", qualifier, name); Delete(qualifier); @@ -874,14 +873,14 @@ int Swig_MethodToFunction(Node *n, String *classname, int flags, SwigType *direc /* Create two method calls, one to call the explicit method, the other a normal polymorphic function call */ String *cres_both_calls = NewStringf(""); String *call_extra = Swig_cmethod_call(name, p, self, 0, director_type); - String *cres_extra = Swig_cresult(Getattr(n, k_type), k_result, call_extra); + String *cres_extra = Swig_cresult(Getattr(n, "type"), "result", call_extra); Printv(cres_both_calls, "if (upcall) {\n", cres, "\n", "} else {", cres_extra, "\n}", NIL); - Setattr(n, k_wrapaction, cres_both_calls); + Setattr(n, "wrap:action", cres_both_calls); Delete(cres_extra); Delete(call_extra); Delete(cres_both_calls); } else { - Setattr(n, k_wrapaction, cres); + Setattr(n, "wrap:action", cres); } Delete(explicitcall_name); @@ -892,20 +891,20 @@ int Swig_MethodToFunction(Node *n, String *classname, int flags, SwigType *direc /* Methods with default arguments are wrapped with additional methods for each default argument, * however, only one extra %extend method is generated. */ - String *defaultargs = Getattr(n, k_defaultargs); - String *code = Getattr(n, k_code); - String *cname = Getattr(n, k_classname) ? Getattr(n, k_classname) : classname; + String *defaultargs = Getattr(n, "defaultargs"); + String *code = Getattr(n, "code"); + String *cname = Getattr(n, "classname") ? Getattr(n, "classname") : classname; String *membername = Swig_name_member(cname, name); String *mangled = Swig_name_mangle(membername); int is_smart_pointer = flags & CWRAP_SMART_POINTER; - type = Getattr(n, k_type); + type = Getattr(n, "type"); /* Check if the method is overloaded. If so, and it has code attached, we append an extra suffix to avoid a name-clash in the generated wrappers. This allows overloaded methods to be defined in C. */ - if (Getattr(n, k_symoverloaded) && code) { - Append(mangled, Getattr(defaultargs ? defaultargs : n, k_symovername)); + if (Getattr(n, "sym:overloaded") && code) { + Append(mangled, Getattr(defaultargs ? defaultargs : n, "sym:overname")); } /* See if there is any code that we need to emit */ @@ -918,7 +917,7 @@ int Swig_MethodToFunction(Node *n, String *classname, int flags, SwigType *direc String *func = NewStringf("%s(", mangled); String *cres; - if (Cmp(Getattr(n, k_storage), k_static) != 0) { + if (Cmp(Getattr(n, "storage"), "static") != 0) { String *pname = Swig_cparm_name(pp, i); String *ctname = SwigType_namestr(cname); String *fadd = NewStringf("(%s*)(%s)->operator ->()", ctname, pname); @@ -934,7 +933,7 @@ int Swig_MethodToFunction(Node *n, String *classname, int flags, SwigType *direc } ++i; while (pp) { - SwigType *pt = Getattr(pp, k_type); + SwigType *pt = Getattr(pp, "type"); if ((SwigType_type(pt) != T_VOID)) { String *pname = Swig_cparm_name(pp, i++); String *rcaststr = SwigType_rcaststr(pt, pname); @@ -947,13 +946,13 @@ int Swig_MethodToFunction(Node *n, String *classname, int flags, SwigType *direc } } Append(func, ")"); - cres = Swig_cresult(Getattr(n, k_type), k_result, func); - Setattr(n, k_wrapaction, cres); + cres = Swig_cresult(Getattr(n, "type"), "result", func); + Setattr(n, "wrap:action", cres); Delete(cres); } else { String *call = Swig_cfunction_call(mangled, p); - String *cres = Swig_cresult(Getattr(n, k_type), k_result, call); - Setattr(n, k_wrapaction, cres); + String *cres = Swig_cresult(Getattr(n, "type"), "result", call); + Setattr(n, "wrap:action", cres); Delete(call); Delete(cres); } @@ -961,7 +960,7 @@ int Swig_MethodToFunction(Node *n, String *classname, int flags, SwigType *direc Delete(membername); Delete(mangled); } - Setattr(n, k_parms, p); + Setattr(n, "parms", p); Delete(p); Delete(self); Delete(parms); @@ -994,7 +993,7 @@ Node *Swig_directormap(Node *module, String *type) { String *base = SwigType_base(type); - Node *directormap = Getattr(module, k_wrapdirectormap); + Node *directormap = Getattr(module, "wrap:directormap"); if (directormap) return Getattr(directormap, base); } @@ -1020,10 +1019,10 @@ int Swig_ConstructorToFunction(Node *n, String *classname, String *none_comparis classNode = Swig_methodclass(n); use_director = Swig_directorclass(n); - parms = CopyParmList(nonvoid_parms(Getattr(n, k_parms))); + parms = CopyParmList(nonvoid_parms(Getattr(n, "parms"))); /* Prepend the list of prefix_args (if any) */ - prefix_args = Getattr(n, k_directorprefixargs); + prefix_args = Getattr(n, "director:prefix_args"); if (prefix_args != NIL) { Parm *p2, *p3; @@ -1046,16 +1045,16 @@ int Swig_ConstructorToFunction(Node *n, String *classname, String *none_comparis * however, only one extra %extend method is generated. */ String *call; String *cres; - String *defaultargs = Getattr(n, k_defaultargs); - String *code = Getattr(n, k_code); + String *defaultargs = Getattr(n, "defaultargs"); + String *code = Getattr(n, "code"); String *membername = Swig_name_construct(classname); String *mangled = Swig_name_mangle(membername); /* Check if the constructor is overloaded. If so, and it has code attached, we append an extra suffix to avoid a name-clash in the generated wrappers. This allows overloaded constructors to be defined in C. */ - if (Getattr(n, k_symoverloaded) && code) { - Append(mangled, Getattr(defaultargs ? defaultargs : n, k_symovername)); + if (Getattr(n, "sym:overloaded") && code) { + Append(mangled, Getattr(defaultargs ? defaultargs : n, "sym:overname")); } /* See if there is any code that we need to emit */ @@ -1064,8 +1063,8 @@ int Swig_ConstructorToFunction(Node *n, String *classname, String *none_comparis } call = Swig_cfunction_call(mangled, parms); - cres = Swig_cresult(type, k_result, call); - Setattr(n, k_wrapaction, cres); + cres = Swig_cresult(type, "result", call); + Setattr(n, "wrap:action", cres); Delete(cres); Delete(call); Delete(membername); @@ -1075,8 +1074,8 @@ int Swig_ConstructorToFunction(Node *n, String *classname, String *none_comparis /* if a C++ director class exists, create it rather than the original class */ if (use_director) { Node *parent = Swig_methodclass(n); - int abstract = Getattr(parent, k_abstract) != 0; - String *name = Getattr(parent, k_symname); + int abstract = Getattr(parent, "abstract") != 0; + String *name = Getattr(parent, "sym:name"); String *directorname = NewStringf("SwigDirector_%s", name); String *action = NewStringEmpty(); String *tmp_none_comparison = Copy(none_comparison); @@ -1095,7 +1094,7 @@ int Swig_ConstructorToFunction(Node *n, String *classname, String *none_comparis * implemented in the target language, calls to those methods will * generate Swig::DirectorPureVirtualException exceptions. */ - String *cres = Swig_cresult(type, k_result, director_call); + String *cres = Swig_cresult(type, "result", director_call); Append(action, cres); Delete(cres); } else { @@ -1110,35 +1109,35 @@ int Swig_ConstructorToFunction(Node *n, String *classname, String *none_comparis Append(action, director_ctor); Replaceall(action, "$comparison", tmp_none_comparison); - cres = Swig_cresult(type, k_result, director_call); + cres = Swig_cresult(type, "result", director_call); Replaceall(action, "$director_new", cres); Delete(cres); - cres = Swig_cresult(type, k_result, nodirector_call); + cres = Swig_cresult(type, "result", nodirector_call); Replaceall(action, "$nondirector_new", cres); Delete(cres); } - Setattr(n, k_wrapaction, action); + Setattr(n, "wrap:action", action); Delete(tmp_none_comparison); Delete(action); Delete(directorname); } else { String *call = Swig_cppconstructor_call(classname, parms); - String *cres = Swig_cresult(type, k_result, call); - Setattr(n, k_wrapaction, cres); + String *cres = Swig_cresult(type, "result", call); + Setattr(n, "wrap:action", cres); Delete(cres); Delete(call); } } else { String *call = Swig_cconstructor_call(classname); - String *cres = Swig_cresult(type, k_result, call); - Setattr(n, k_wrapaction, cres); + String *cres = Swig_cresult(type, "result", call); + Setattr(n, "wrap:action", cres); Delete(cres); Delete(call); } } - Setattr(n, k_type, type); - Setattr(n, k_parms, parms); + Setattr(n, "type", type); + Setattr(n, "parms", parms); Delete(type); if (directorparms != parms) Delete(directorparms); @@ -1160,8 +1159,8 @@ int Swig_DestructorToFunction(Node *n, String *classname, int cplus, int flags) SwigType_add_pointer(type); p = NewParm(type, "self"); Setattr(p, "self", "1"); - Setattr(p, k_hidden, "1"); - Setattr(p, k_wrapdisown, "1"); + Setattr(p, "hidden", "1"); + Setattr(p, "wrap:disown", "1"); Delete(type); type = NewString("void"); @@ -1171,13 +1170,13 @@ int Swig_DestructorToFunction(Node *n, String *classname, int cplus, int flags) String *membername, *mangled, *code; membername = Swig_name_destroy(classname); mangled = Swig_name_mangle(membername); - code = Getattr(n, k_code); + code = Getattr(n, "code"); if (code) { Swig_add_extension_code(n, mangled, p, type, code, cparse_cplusplus, "self"); } call = Swig_cfunction_call(mangled, p); cres = NewStringf("%s;\n", call); - Setattr(n, k_wrapaction, cres); + Setattr(n, "wrap:action", cres); Delete(membername); Delete(mangled); Delete(call); @@ -1186,19 +1185,19 @@ int Swig_DestructorToFunction(Node *n, String *classname, int cplus, int flags) if (cplus) { String *call = Swig_cppdestructor_call(n); String *cres = NewStringf("%s\n", call); - Setattr(n, k_wrapaction, cres); + Setattr(n, "wrap:action", cres); Delete(call); Delete(cres); } else { String *call = Swig_cdestructor_call(n); String *cres = NewStringf("%s\n", call); - Setattr(n, k_wrapaction, cres); + Setattr(n, "wrap:action", cres); Delete(call); Delete(cres); } } - Setattr(n, k_type, type); - Setattr(n, k_parms, p); + Setattr(n, "type", type); + Setattr(n, "parms", p); Delete(type); Delete(p); return SWIG_OK; @@ -1229,8 +1228,8 @@ int Swig_MembersetToFunction(Node *n, String *classname, int flags) { self = NewString("(*this)->"); } - name = Getattr(n, k_name); - type = Getattr(n, k_type); + name = Getattr(n, "name"); + type = Getattr(n, "type"); sname = Swig_name_set(name); membername = Swig_name_member(classname, sname); @@ -1240,42 +1239,42 @@ int Swig_MembersetToFunction(Node *n, String *classname, int flags) { SwigType_add_pointer(t); parms = NewParm(t, "self"); Setattr(parms, "self", "1"); - Setattr(parms, k_hidden, "1"); + Setattr(parms, "hidden", "1"); Delete(t); ty = Swig_wrapped_member_var_type(type, varcref); p = NewParm(ty, name); - Setattr(parms, k_hidden, "1"); + Setattr(parms, "hidden", "1"); set_nextSibling(parms, p); /* If the type is a pointer or reference. We mark it with a special wrap:disown attribute */ if (SwigType_check_decl(type, "p.")) { - Setattr(p, k_wrapdisown, "1"); + Setattr(p, "wrap:disown", "1"); } Delete(p); if (flags & CWRAP_EXTEND) { String *call; String *cres; - String *code = Getattr(n, k_code); + String *code = Getattr(n, "code"); if (code) { /* I don't think this ever gets run - WSF */ Swig_add_extension_code(n, mangled, parms, void_type, code, cparse_cplusplus, "self"); } call = Swig_cfunction_call(mangled, parms); cres = NewStringf("%s;\n", call); - Setattr(n, k_wrapaction, cres); + Setattr(n, "wrap:action", cres); Delete(call); Delete(cres); } else { String *call = Swig_cmemberset_call(name, type, self, varcref); String *cres = NewStringf("%s;\n", call); - Setattr(n, k_wrapaction, cres); + Setattr(n, "wrap:action", cres); Delete(call); Delete(cres); } - Setattr(n, k_type, void_type); - Setattr(n, k_parms, parms); + Setattr(n, "type", void_type); + Setattr(n, "parms", parms); Delete(parms); Delete(ty); Delete(void_type); @@ -1306,17 +1305,17 @@ int Swig_MembergetToFunction(Node *n, String *classname, int flags) { int varcref = flags & CWRAP_NATURAL_VAR; if (flags & CWRAP_SMART_POINTER) { - if (checkAttribute(n, k_storage, k_static)) { - Node *sn = Getattr(n, k_cplusstaticbase); - String *base = Getattr(sn, k_name); + if (checkAttribute(n, "storage", "static")) { + Node *sn = Getattr(n, "cplus:staticbase"); + String *base = Getattr(sn, "name"); self = NewStringf("%s::", base); } else { self = NewString("(*this)->"); } } - name = Getattr(n, k_name); - type = Getattr(n, k_type); + name = Getattr(n, "name"); + type = Getattr(n, "type"); gname = Swig_name_get(name); membername = Swig_name_member(classname, gname); @@ -1326,7 +1325,7 @@ int Swig_MembergetToFunction(Node *n, String *classname, int flags) { SwigType_add_pointer(t); parms = NewParm(t, "self"); Setattr(parms, "self", "1"); - Setattr(parms, k_hidden, "1"); + Setattr(parms, "hidden", "1"); Delete(t); ty = Swig_wrapped_member_var_type(type, varcref); @@ -1334,25 +1333,25 @@ int Swig_MembergetToFunction(Node *n, String *classname, int flags) { String *call; String *cres; - String *code = Getattr(n, k_code); + String *code = Getattr(n, "code"); if (code) { /* I don't think this ever gets run - WSF */ Swig_add_extension_code(n, mangled, parms, ty, code, cparse_cplusplus, "self"); } call = Swig_cfunction_call(mangled, parms); - cres = Swig_cresult(ty, k_result, call); - Setattr(n, k_wrapaction, cres); + cres = Swig_cresult(ty, "result", call); + Setattr(n, "wrap:action", cres); Delete(cres); Delete(call); } else { String *call = Swig_cmemberget_call(name, type, self, varcref); - String *cres = Swig_cresult(ty, k_result, call); - Setattr(n, k_wrapaction, cres); + String *cres = Swig_cresult(ty, "result", call); + Setattr(n, "wrap:action", cres); Delete(call); Delete(cres); } - Setattr(n, k_type, ty); - Setattr(n, k_parms, parms); + Setattr(n, "type", ty); + Setattr(n, "parms", parms); Delete(parms); Delete(ty); Delete(membername); @@ -1376,8 +1375,8 @@ int Swig_VarsetToFunction(Node *n, int flags) { int varcref = flags & CWRAP_NATURAL_VAR; - name = Getattr(n, k_name); - type = Getattr(n, k_type); + name = Getattr(n, "name"); + type = Getattr(n, "type"); nname = SwigType_namestr(name); ty = Swig_wrapped_var_type(type, varcref); parms = NewParm(ty, name); @@ -1387,7 +1386,7 @@ int Swig_VarsetToFunction(Node *n, int flags) { String *mangled = Swig_name_mangle(sname); String *call = Swig_cfunction_call(mangled, parms); String *cres = NewStringf("%s;\n", call); - Setattr(n, k_wrapaction, cres); + Setattr(n, "wrap:action", cres); Delete(cres); Delete(call); Delete(mangled); @@ -1397,20 +1396,20 @@ int Swig_VarsetToFunction(Node *n, int flags) { String *pname = Swig_cparm_name(0, 0); String *dref = Swig_wrapped_var_deref(type, pname, varcref); String *call = NewStringf("%s = %s;\n", nname, dref); - Setattr(n, k_wrapaction, call); + Setattr(n, "wrap:action", call); Delete(call); Delete(dref); Delete(pname); } else { String *pname = Swig_cparm_name(0, 0); String *call = NewStringf("if (sizeof(int) == sizeof(%s)) *(int*)(void*)&(%s) = %s;\n", nname, nname, pname); - Setattr(n, k_wrapaction, call); + Setattr(n, "wrap:action", call); Delete(pname); Delete(call); } } - Setattr(n, k_type, "void"); - Setattr(n, k_parms, parms); + Setattr(n, "type", "void"); + Setattr(n, "parms", parms); Delete(parms); Delete(ty); Delete(nname); @@ -1432,28 +1431,28 @@ int Swig_VargetToFunction(Node *n, int flags) { int varcref = flags & CWRAP_NATURAL_VAR; - name = Getattr(n, k_name); - type = Getattr(n, k_type); + name = Getattr(n, "name"); + type = Getattr(n, "type"); ty = Swig_wrapped_var_type(type, varcref); if (flags & CWRAP_EXTEND) { String *sname = Swig_name_get(name); String *mangled = Swig_name_mangle(sname); call = Swig_cfunction_call(mangled, 0); - cres = Swig_cresult(ty, k_result, call); - Setattr(n, k_wrapaction, cres); + cres = Swig_cresult(ty, "result", call); + Setattr(n, "wrap:action", cres); Delete(mangled); Delete(sname); } else { String *nname = SwigType_namestr(name); call = Swig_wrapped_var_assign(type, nname, varcref); - cres = Swig_cresult(ty, k_result, call); - Setattr(n, k_wrapaction, cres); + cres = Swig_cresult(ty, "result", call); + Setattr(n, "wrap:action", cres); Delete(nname); } - Setattr(n, k_type, ty); - Delattr(n, k_parms); + Setattr(n, "type", ty); + Delattr(n, "parms"); Delete(cres); Delete(call); Delete(ty); diff --git a/Source/Swig/fragment.c b/Source/Swig/fragment.c index 26ec3476f..510a01875 100644 --- a/Source/Swig/fragment.c +++ b/Source/Swig/fragment.c @@ -15,7 +15,6 @@ char cvsroot_fragment_c[] = "$Id$"; #include "swig.h" -#include "swigkeys.h" #include "swigwarn.h" static Hash *fragments = 0; @@ -35,8 +34,8 @@ void Swig_fragment_register(Node *fragment) { Swig_fragment_emit(fragment); return; } else { - String *name = Copy(Getattr(fragment, k_value)); - String *type = Getattr(fragment, k_type); + String *name = Copy(Getattr(fragment, "value")); + String *type = Getattr(fragment, "type"); if (type) { SwigType *rtype = SwigType_typedef_resolve_all(type); String *mangle = Swig_string_mangle(type); @@ -51,11 +50,11 @@ void Swig_fragment_register(Node *fragment) { } if (!Getattr(fragments, name)) { String *section = Copy(Getattr(fragment, "section")); - String *ccode = Copy(Getattr(fragment, k_code)); - Hash *kwargs = Getattr(fragment, k_kwargs); + String *ccode = Copy(Getattr(fragment, "code")); + Hash *kwargs = Getattr(fragment, "kwargs"); Setmeta(ccode, "section", section); if (kwargs) { - Setmeta(ccode, k_kwargs, kwargs); + Setmeta(ccode, "kwargs", kwargs); } Setattr(fragments, name, ccode); if (debug) @@ -94,11 +93,11 @@ void Swig_fragment_emit(Node *n) { } - name = Getattr(n, k_value); + name = Getattr(n, "value"); if (!name) { name = n; } - type = Getattr(n, k_type); + type = Getattr(n, "type"); if (type) { mangle = Swig_string_mangle(type); } @@ -120,14 +119,14 @@ void Swig_fragment_emit(Node *n) { code = Getattr(fragments, name); if (debug) Printf(stdout, "looking subfragment %s\n", name); - if (code && (Strcmp(code, k_ignore) != 0)) { + if (code && (Strcmp(code, "ignore") != 0)) { String *section = Getmeta(code, "section"); - Hash *nn = Getmeta(code, k_kwargs); + Hash *nn = Getmeta(code, "kwargs"); if (!looking_fragments) looking_fragments = NewHash(); Setattr(looking_fragments, name, "1"); while (nn) { - if (Equal(Getattr(nn, k_name), "fragment")) { + if (Equal(Getattr(nn, "name"), "fragment")) { if (debug) Printf(stdout, "emitting fragment %s %s\n", nn, type); Setfile(nn, Getfile(n)); @@ -148,14 +147,14 @@ void Swig_fragment_emit(Node *n) { Printf(f, "%s\n", code); if (debug) Printf(f, "/* end fragment %s */\n\n", name); - Setattr(fragments, name, k_ignore); + Setattr(fragments, name, "ignore"); Delattr(looking_fragments, name); } } } else if (!code && type) { SwigType *rtype = SwigType_typedef_resolve_all(type); if (!Equal(type, rtype)) { - String *name = Copy(Getattr(n, k_value)); + String *name = Copy(Getattr(n, "value")); String *mangle = Swig_string_mangle(type); Append(name, mangle); Setfile(name, Getfile(n)); diff --git a/Source/Swig/misc.c b/Source/Swig/misc.c index ae73fdf0a..6e9549c9a 100644 --- a/Source/Swig/misc.c +++ b/Source/Swig/misc.c @@ -10,7 +10,6 @@ char cvsroot_misc_c[] = "$Id$"; #include "swig.h" -#include "swigkeys.h" #include #include #include @@ -1002,9 +1001,6 @@ void Swig_init() { DohEncoding("firstuppercase", Swig_string_first_upper); DohEncoding("firstlowercase", Swig_string_first_lower); - /* Initialize the swig keys */ - Swig_keys_init(); - /* Initialize typemaps */ Swig_typemap_init(); diff --git a/Source/Swig/naming.c b/Source/Swig/naming.c index 20a161ecb..de21dca69 100644 --- a/Source/Swig/naming.c +++ b/Source/Swig/naming.c @@ -11,7 +11,6 @@ char cvsroot_naming_c[] = "$Id$"; #include "swig.h" #include "cparse.h" -#include "swigkeys.h" #include /* Hash table containing naming data */ @@ -151,7 +150,7 @@ String *Swig_name_wrapper(const String_or_char *fname) { r = NewStringEmpty(); if (!naming_hash) naming_hash = NewHash(); - f = Getattr(naming_hash, k_wrapper); + f = Getattr(naming_hash, "wrapper"); if (!f) { Append(r, "_wrap_%f"); } else { @@ -767,10 +766,10 @@ void Swig_feature_set(Hash *features, const String_or_char *name, SwigType *decl /* Add in the optional feature attributes */ Hash *attribs = featureattribs; while (attribs) { - String *attribname = Getattr(attribs, k_name); + String *attribname = Getattr(attribs, "name"); String *featureattribname = NewStringf("%s:%s", featurename, attribname); if (value) { - String *attribvalue = Getattr(attribs, k_value); + String *attribvalue = Getattr(attribs, "value"); Setattr(fhash, featureattribname, attribvalue); } else { Delattr(fhash, featureattribname); @@ -838,15 +837,15 @@ int Swig_need_name_warning(Node *n) { - template declarations, only for real instances using %template(name). - typedefs, they have no effect at the target language. */ - if (checkAttribute(n, "nodeType", k_classforward)) { + if (checkAttribute(n, "nodeType", "classforward")) { need = 0; - } else if (checkAttribute(n, k_storage, k_typedef)) { + } else if (checkAttribute(n, "storage", "typedef")) { need = 0; - } else if (Getattr(n, k_hidden)) { + } else if (Getattr(n, "hidden")) { need = 0; - } else if (Getattr(n, k_ignore)) { + } else if (Getattr(n, "ignore")) { need = 0; - } else if (Getattr(n, k_templatetype)) { + } else if (Getattr(n, "templatetype")) { need = 0; } return need; @@ -867,16 +866,16 @@ static int nodes_are_equivalent(Node *a, Node *b, int a_inclass) { return 0; /* cdecl case */ - if (Cmp(ta, k_cdecl) == 0) { + if (Cmp(ta, "cdecl") == 0) { /* typedef */ - String *a_storage = Getattr(a, k_storage); - String *b_storage = Getattr(b, k_storage); + String *a_storage = Getattr(a, "storage"); + String *b_storage = Getattr(b, "storage"); - if ((Cmp(a_storage, k_typedef) == 0) - || (Cmp(b_storage, k_typedef) == 0)) { + if ((Cmp(a_storage, "typedef") == 0) + || (Cmp(b_storage, "typedef") == 0)) { if (Cmp(a_storage, b_storage) == 0) { - String *a_type = (Getattr(a, k_type)); - String *b_type = (Getattr(b, k_type)); + String *a_type = (Getattr(a, "type")); + String *b_type = (Getattr(b, "type")); if (Cmp(a_type, b_type) == 0) return 1; } @@ -884,30 +883,30 @@ static int nodes_are_equivalent(Node *a, Node *b, int a_inclass) { } /* static functions */ - if ((Cmp(a_storage, k_static) == 0) - || (Cmp(b_storage, k_static) == 0)) { + if ((Cmp(a_storage, "static") == 0) + || (Cmp(b_storage, "static") == 0)) { if (Cmp(a_storage, b_storage) != 0) return 0; } /* friend methods */ - if (!a_inclass || (Cmp(a_storage, k_friend) == 0)) { + if (!a_inclass || (Cmp(a_storage, "friend") == 0)) { /* check declaration */ - String *a_decl = (Getattr(a, k_decl)); - String *b_decl = (Getattr(b, k_decl)); + String *a_decl = (Getattr(a, "decl")); + String *b_decl = (Getattr(b, "decl")); if (Cmp(a_decl, b_decl) == 0) { /* check return type */ - String *a_type = (Getattr(a, k_type)); - String *b_type = (Getattr(b, k_type)); + String *a_type = (Getattr(a, "type")); + String *b_type = (Getattr(b, "type")); if (Cmp(a_type, b_type) == 0) { /* check parameters */ - Parm *ap = (Getattr(a, k_parms)); - Parm *bp = (Getattr(b, k_parms)); + Parm *ap = (Getattr(a, "parms")); + Parm *bp = (Getattr(b, "parms")); while (ap && bp) { - SwigType *at = Getattr(ap, k_type); - SwigType *bt = Getattr(bp, k_type); + SwigType *at = Getattr(ap, "type"); + SwigType *bt = Getattr(bp, "type"); if (Cmp(at, bt) != 0) return 0; ap = nextSibling(ap); @@ -916,8 +915,8 @@ static int nodes_are_equivalent(Node *a, Node *b, int a_inclass) { if (ap || bp) { return 0; } else { - Node *a_template = Getattr(a, k_template); - Node *b_template = Getattr(b, k_template); + Node *a_template = Getattr(a, "template"); + Node *b_template = Getattr(b, "template"); /* Not equivalent if one is a template instantiation (via %template) and the other is a non-templated function */ if ((a_template && !b_template) || (!a_template && b_template)) return 0; @@ -928,15 +927,15 @@ static int nodes_are_equivalent(Node *a, Node *b, int a_inclass) { } } else { /* %constant case */ - String *a_storage = Getattr(a, k_storage); - String *b_storage = Getattr(b, k_storage); + String *a_storage = Getattr(a, "storage"); + String *b_storage = Getattr(b, "storage"); if ((Cmp(a_storage, "%constant") == 0) || (Cmp(b_storage, "%constant") == 0)) { if (Cmp(a_storage, b_storage) == 0) { - String *a_type = (Getattr(a, k_type)); - String *b_type = (Getattr(b, k_type)); + String *a_type = (Getattr(a, "type")); + String *b_type = (Getattr(b, "type")); if ((Cmp(a_type, b_type) == 0) - && (Cmp(Getattr(a, k_value), Getattr(b, k_value)) == 0)) + && (Cmp(Getattr(a, "value"), Getattr(b, "value")) == 0)) return 1; } return 0; @@ -946,10 +945,10 @@ static int nodes_are_equivalent(Node *a, Node *b, int a_inclass) { } int Swig_need_redefined_warn(Node *a, Node *b, int InClass) { - String *a_name = Getattr(a, k_name); - String *b_name = Getattr(b, k_name); - String *a_symname = Getattr(a, k_symname); - String *b_symname = Getattr(b, k_symname); + String *a_name = Getattr(a, "name"); + String *b_name = Getattr(b, "name"); + String *a_symname = Getattr(a, "sym:name"); + String *b_symname = Getattr(b, "sym:name"); /* always send a warning if a 'rename' is involved */ if ((a_symname && !Equal(a_symname, a_name)) || (b_symname && !Equal(b_symname, b_name))) { @@ -974,11 +973,11 @@ int Swig_need_protected(Node *n) { /* First, 'n' looks like a function */ /* if (!Swig_director_mode()) return 0; */ String *nodetype = nodeType(n); - if ((Equal(nodetype, k_cdecl)) && SwigType_isfunction(Getattr(n, k_decl))) { - String *storage = Getattr(n, k_storage); + if ((Equal(nodetype, "cdecl")) && SwigType_isfunction(Getattr(n, "decl"))) { + String *storage = Getattr(n, "storage"); /* and the function is declared like virtual, or it has no storage. This eliminates typedef, static and so on. */ - return !storage || Equal(storage, k_virtual); + return !storage || Equal(storage, "virtual"); } else if (Equal(nodetype, "constructor") || Equal(nodetype, "destructor")) { return 1; } @@ -1020,7 +1019,7 @@ static void Swig_name_object_attach_keys(const char *keys[], Hash *nameobj) { List *matchlist = 0; while (kw) { Node *next = nextSibling(kw); - String *kname = Getattr(kw, k_name); + String *kname = Getattr(kw, "name"); char *ckey = kname ? Char(kname) : 0; if (ckey) { const char **rkey; @@ -1034,11 +1033,11 @@ static void Swig_name_object_attach_keys(const char *keys[], Hash *nameobj) { List *attrlist = Swig_make_attrlist(ckey); if (!matchlist) matchlist = NewList(); - Setattr(mi, k_value, Getattr(kw, k_value)); + Setattr(mi, "value", Getattr(kw, "value")); Setattr(mi, "attrlist", attrlist); #ifdef SWIG_DEBUG if (isrxsmatch) - Printf(stderr, "rxsmatch to use: %s %s %s\n", ckey, Getattr(kw, k_value), attrlist); + Printf(stderr, "rxsmatch to use: %s %s %s\n", ckey, Getattr(kw, "value"), attrlist); #endif if (isnotmatch) SetFlag(mi, "notmatch"); @@ -1051,7 +1050,7 @@ static void Swig_name_object_attach_keys(const char *keys[], Hash *nameobj) { } else { for (rkey = keys; *rkey != 0; ++rkey) { if (strcmp(ckey, *rkey) == 0) { - Setattr(nameobj, *rkey, Getattr(kw, k_value)); + Setattr(nameobj, *rkey, Getattr(kw, "value")); removeNode(kw); } } @@ -1077,10 +1076,10 @@ void Swig_name_nameobj_add(Hash *name_hash, List *name_list, String *prefix, Str } } - if (!nname || !Len(nname) || Getattr(nameobj, k_fullname) || /* any of these options trigger a 'list' nameobj */ + if (!nname || !Len(nname) || Getattr(nameobj, "fullname") || /* any of these options trigger a 'list' nameobj */ Getattr(nameobj, "sourcefmt") || Getattr(nameobj, "matchlist")) { if (decl) - Setattr(nameobj, k_decl, decl); + Setattr(nameobj, "decl", decl); if (nname && Len(nname)) Setattr(nameobj, "targetname", nname); /* put the new nameobj at the beginnig of the list, such that the @@ -1109,9 +1108,9 @@ static DOH *Swig_get_lattr(Node *n, List *lattr) { res = Getattr(n, nattr); #ifdef SWIG_DEBUG if (!res) { - Printf(stderr, "missing %s %s %s\n", nattr, Getattr(n, k_name), Getattr(n, "member")); + Printf(stderr, "missing %s %s %s\n", nattr, Getattr(n, "name"), Getattr(n, "member")); } else { - Printf(stderr, "lattr %d %s %s\n", i, nattr, DohIsString(res) ? res : Getattr(res, k_name)); + Printf(stderr, "lattr %d %s %s\n", i, nattr, DohIsString(res) ? res : Getattr(res, "name")); } #endif n = res; @@ -1200,7 +1199,7 @@ int Swig_name_match_nameobj(Hash *rn, Node *n) { #endif match = 0; if (nval) { - String *kwval = Getattr(mi, k_value); + String *kwval = Getattr(mi, "value"); match = rxsmatch ? Swig_name_rxsmatch_value(kwval, nval) : Swig_name_match_value(kwval, nval); #ifdef SWIG_DEBUG @@ -1232,7 +1231,7 @@ Hash *Swig_name_nameobj_lget(List *namelist, Node *n, String *prefix, String *na int match = 0; for (i = 0; !match && (i < len); i++) { Hash *rn = Getitem(namelist, i); - String *rdecl = Getattr(rn, k_decl); + String *rdecl = Getattr(rn, "decl"); if (rdecl && (!decl || !Equal(rdecl, decl))) { continue; } else if (Swig_name_match_nameobj(rn, n)) { @@ -1240,7 +1239,7 @@ Hash *Swig_name_nameobj_lget(List *namelist, Node *n, String *prefix, String *na if (tname) { String *sfmt = Getattr(rn, "sourcefmt"); String *sname = 0; - int fullname = GetFlag(rn, k_fullname); + int fullname = GetFlag(rn, "fullname"); int rxstarget = GetFlag(rn, "rxstarget"); if (sfmt) { if (fullname && prefix) { @@ -1301,8 +1300,8 @@ Hash *Swig_name_namewarn_get(Node *n, String *prefix, String *name, SwigType *de if (!name || !Swig_need_name_warning(n)) { return 0; } else { - String *access = Getattr(n, k_access); - int is_public = !access || Equal(access, k_public); + String *access = Getattr(n, "access"); + int is_public = !access || Equal(access, "public"); if (!is_public && !Swig_need_protected(n)) { return 0; } @@ -1316,11 +1315,11 @@ Hash *Swig_name_namewarn_get(Node *n, String *prefix, String *name, SwigType *de if (!wrn) { wrn = Swig_name_nameobj_lget(Swig_name_namewarn_list(), n, prefix, name, decl); } - if (wrn && Getattr(wrn, k_error)) { + if (wrn && Getattr(wrn, "error")) { if (n) { - Swig_error(Getfile(n), Getline(n), "%s\n", Getattr(wrn, k_name)); + Swig_error(Getfile(n), Getline(n), "%s\n", Getattr(wrn, "name")); } else { - Swig_error(cparse_file, cparse_line, "%s\n", Getattr(wrn, k_name)); + Swig_error(cparse_file, cparse_line, "%s\n", Getattr(wrn, "name")); } } return wrn; @@ -1338,7 +1337,7 @@ Hash *Swig_name_namewarn_get(Node *n, String *prefix, String *name, SwigType *de String *Swig_name_warning(Node *n, String *prefix, String *name, SwigType *decl) { Hash *wrn = Swig_name_namewarn_get(n, prefix, name, decl); - return (name && wrn) ? Getattr(wrn, k_name) : 0; + return (name && wrn) ? Getattr(wrn, "name") : 0; } /* ----------------------------------------------------------------------------- @@ -1477,7 +1476,7 @@ String *Swig_name_make(Node *n, String *prefix, String_or_char *cname, SwigType rn = Swig_name_nameobj_lget(Swig_name_rename_list(), n, prefix, name, decl); if (rn) { String *sfmt = Getattr(rn, "sourcefmt"); - int fullname = GetFlag(rn, k_fullname); + int fullname = GetFlag(rn, "fullname"); if (fullname && prefix) { String *sname = NewStringf("%s::%s", prefix, name); Delete(name); @@ -1492,8 +1491,8 @@ String *Swig_name_make(Node *n, String *prefix, String_or_char *cname, SwigType } } if (rn) { - String *newname = Getattr(rn, k_name); - int fullname = GetFlag(rn, k_fullname); + String *newname = Getattr(rn, "name"); + int fullname = GetFlag(rn, "fullname"); result = apply_rename(newname, fullname, prefix, name); } if (result && !Equal(result, name)) { @@ -1512,10 +1511,10 @@ String *Swig_name_make(Node *n, String *prefix, String_or_char *cname, SwigType nname = result ? result : name; wrn = Swig_name_namewarn_get(n, prefix, nname, decl); if (wrn) { - String *rename = Getattr(wrn, k_rename); + String *rename = Getattr(wrn, "rename"); if (rename) { - String *msg = Getattr(wrn, k_name); - int fullname = GetFlag(wrn, k_fullname); + String *msg = Getattr(wrn, "name"); + int fullname = GetFlag(wrn, "fullname"); if (result) Delete(result); result = apply_rename(rename, fullname, prefix, name); diff --git a/Source/Swig/swig.h b/Source/Swig/swig.h index d80dcf3f3..8ec155ded 100644 --- a/Source/Swig/swig.h +++ b/Source/Swig/swig.h @@ -299,7 +299,6 @@ extern "C" { /* --- Parse tree support --- */ -#include "swigkeys.h" /* This file is likely going to go away */ #include "swigtree.h" /* -- Wrapper function Object */ diff --git a/Source/Swig/swigkeys.c b/Source/Swig/swigkeys.c deleted file mode 100644 index 8abb3cdc0..000000000 --- a/Source/Swig/swigkeys.c +++ /dev/null @@ -1,175 +0,0 @@ -/* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * - * swigkeys.c - * ----------------------------------------------------------------------------- */ - -char cvsroot_keys_c[] = "$Id$"; - -#include "swigkeys.h" - -String *k_abstract = 0; -String *k_access = 0; -String *k_alias = 0; -String *k_allowstypedef = 0; -String *k_alttype = 0; -String *k_baselist = 0; -String *k_bases = 0; -String *k_cdecl = 0; -String *k_class = 0; -String *k_classforward = 0; -String *k_classname = 0; -String *k_cplusstaticbase = 0; -String *k_code = 0; -String *k_conversionoperator = 0; -String *k_csymnextSibling = 0; -String *k_csympreviousSibling = 0; -String *k_csymtab = 0; -String *k_decl = 0; -String *k_default = 0; -String *k_defaultargs = 0; -String *k_director = 0; -String *k_directorbase = 0; -String *k_directorprefixargs = 0; -String *k_enumitem = 0; -String *k_error = 0; -String *k_extern = 0; -String *k_friend = 0; -String *k_fullname = 0; -String *k_hidden = 0; -String *k_ignore = 0; -String *k_inherit = 0; -String *k_kwargs = 0; -String *k_lname = 0; -String *k_locals = 0; -String *k_kind = 0; -String *k_name = 0; -String *k_namespace = 0; -String *k_parm = 0; -String *k_parms = 0; -String *k_partialarg = 0; -String *k_partialargs = 0; -String *k_partials = 0; -String *k_pname = 0; -String *k_privatebaselist = 0; -String *k_protectedbaselist = 0; -String *k_public = 0; -String *k_qname = 0; -String *k_qualifier = 0; -String *k_rename = 0; -String *k_result = 0; -String *k_static = 0; -String *k_storage = 0; -String *k_symname = 0; -String *k_symnextSibling = 0; -String *k_symoverloaded = 0; -String *k_symovername = 0; -String *k_sympreviousSibling = 0; -String *k_symsymtab = 0; -String *k_symtab = 0; -String *k_symtypename = 0; -String *k_symweak = 0; -String *k_template = 0; -String *k_templateparm = 0; -String *k_templateparms = 0; -String *k_templatetype = 0; -String *k_throw = 0; -String *k_throws = 0; -String *k_type = 0; -String *k_typemap = 0; -String *k_typedef = 0; -String *k_typetab = 0; -String *k_uname = 0; -String *k_unnamed = 0; -String *k_using = 0; -String *k_value = 0; -String *k_virtual = 0; -String *k_wrapaction = 0; -String *k_wrapcode = 0; -String *k_wrapdirectormap = 0; -String *k_wrapdisown = 0; -String *k_wrapper = 0; - -void Swig_keys_init() { - k_abstract = NewString("abstract"); - k_access = NewString("access"); - k_alias = NewString("alias"); - k_allowstypedef = NewString("allows_typedef"); - k_alttype = NewString("alttype"); - k_baselist = NewString("baselist"); - k_bases = NewString("bases"); - k_cdecl = NewString("cdecl"); - k_class = NewString("class"); - k_classforward = NewString("classforward"); - k_classname = NewString("classname"); - k_cplusstaticbase = NewString("cplus:staticbase");; - k_code = NewString("code"); - k_conversionoperator = NewString("conversion_operator"); - k_csymnextSibling = NewString("csym:nextSibling"); - k_csympreviousSibling = NewString("csym:previousSibling"); - k_csymtab = NewString("csymtab"); - k_decl = NewString("decl"); - k_default = NewString("default"); - k_defaultargs = NewString("defaultargs"); - k_director = NewString("director"); - k_directorbase = NewString("directorBase"); - k_directorprefixargs = NewString("director:prefix_args"); - k_enumitem = NewString("enumitem"); - k_error = NewString("error"); - k_friend = NewString("friend"); - k_fullname = NewString("fullname"); - k_hidden = NewString("hidden"); - k_ignore = NewString("ignore"); - k_inherit = NewString("inherit"); - k_kwargs = NewString("kwargs"); - k_lname = NewString("lname"); - k_locals = NewString("locals"); - k_kind = NewString("kind"); - k_name = NewString("name"); - k_namespace = NewString("namespace"); - k_parm = NewString("parm"); - k_parms = NewString("parms"); - k_partialarg = NewString("partialarg"); - k_partialargs = NewString("partialargs"); - k_partials = NewString("partials"); - k_pname = NewString("pname"); - k_privatebaselist = NewString("privatebaselist"); - k_protectedbaselist = NewString("protectedbaselist"); - k_public = NewString("public"); - k_qname = NewString("qname"); - k_qualifier = NewString("qualifier"); - k_rename = NewString("rename"); - k_result = NewString("result"); - k_static = NewString("static"); - k_storage = NewString("storage"); - k_symname = NewString("sym:name"); - k_symnextSibling = NewString("sym:nextSibling"); - k_symoverloaded = NewString("sym:overloaded"); - k_symovername = NewString("sym:overname"); - k_sympreviousSibling = NewString("sym:previousSibling"); - k_symsymtab = NewString("sym:symtab"); - k_symtab = NewString("symtab"); - k_symtypename = NewString("sym:typename"); - k_symweak = NewString("sym:weak"); - k_template = NewString("template"); - k_templateparm = NewString("templateparm"); - k_templateparms = NewString("templateparms"); - k_templatetype = NewString("templatetype"); - k_throw = NewString("throw"); - k_throws = NewString("throws"); - k_type = NewString("type"); - k_typemap = NewString("typemap"); - k_typedef = NewString("typedef"); - k_typetab = NewString("typetab"); - k_uname = NewString("uname"); - k_unnamed = NewString("unnamed"); - k_using = NewString("using"); - k_value = NewString("value"); - k_virtual = NewString("virtual"); - k_wrapaction = NewString("wrap:action"); - k_wrapcode = NewString("wrap:code"); - k_wrapdirectormap = NewString("wrap:directormap"); - k_wrapdisown = NewString("wrap:disown"); - k_wrapper = NewString("wrapper"); -} diff --git a/Source/Swig/swigkeys.h b/Source/Swig/swigkeys.h deleted file mode 100644 index 6e04419fa..000000000 --- a/Source/Swig/swigkeys.h +++ /dev/null @@ -1,98 +0,0 @@ -/* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * - * swigkeys.h - * ----------------------------------------------------------------------------- */ - -/* $Id$ */ - -#ifndef SWIG_SWIGKEYS_H_ -#define SWIG_SWIGKEYS_H_ - -#include "swig.h" - -extern void Swig_keys_init(); - -extern String *k_abstract; -extern String *k_access; -extern String *k_alias; -extern String *k_allowstypedef; -extern String *k_alttype; -extern String *k_baselist; -extern String *k_bases; -extern String *k_cdecl; -extern String *k_class; -extern String *k_classforward; -extern String *k_classname; -extern String *k_cplusstaticbase; -extern String *k_code; -extern String *k_conversionoperator; -extern String *k_csymnextSibling; -extern String *k_csympreviousSibling; -extern String *k_csymtab; -extern String *k_decl; -extern String *k_default; -extern String *k_defaultargs; -extern String *k_director; -extern String *k_directorbase; -extern String *k_directorprefixargs; -extern String *k_enumitem; -extern String *k_error; -extern String *k_extern; -extern String *k_friend; -extern String *k_fullname; -extern String *k_hidden; -extern String *k_ignore; -extern String *k_inherit; -extern String *k_kwargs; -extern String *k_lname; -extern String *k_locals; -extern String *k_kind; -extern String *k_name; -extern String *k_namespace; -extern String *k_parm; -extern String *k_parms; -extern String *k_partialarg; -extern String *k_partialargs; -extern String *k_partials; -extern String *k_pname; -extern String *k_privatebaselist; -extern String *k_protectedbaselist; -extern String *k_public; -extern String *k_qname; -extern String *k_qualifier; -extern String *k_rename; -extern String *k_result; -extern String *k_static; -extern String *k_storage; -extern String *k_symname; -extern String *k_symnextSibling; -extern String *k_symoverloaded; -extern String *k_symovername; -extern String *k_sympreviousSibling; -extern String *k_symsymtab; -extern String *k_symtab; -extern String *k_symtypename; -extern String *k_symweak; -extern String *k_template; -extern String *k_templateparm; -extern String *k_templateparms; -extern String *k_templatetype; -extern String *k_throw; -extern String *k_throws; -extern String *k_type; -extern String *k_typemap; -extern String *k_typedef; -extern String *k_typetab; -extern String *k_uname; -extern String *k_unnamed; -extern String *k_using; -extern String *k_value; -extern String *k_virtual; -extern String *k_wrapaction; -extern String *k_wrapcode; -extern String *k_wrapdirectormap; -extern String *k_wrapdisown; -extern String *k_wrapper; -#endif /* SWIG_SWIGKEYS_H_ */ diff --git a/Source/Swig/symbol.c b/Source/Swig/symbol.c index 8616e536a..7fac16c3b 100644 --- a/Source/Swig/symbol.c +++ b/Source/Swig/symbol.c @@ -11,7 +11,6 @@ char cvsroot_symbol_c[] = "$Id$"; #include "swig.h" #include "swigwarn.h" -#include "swigkeys.h" #include /* #define SWIG_DEBUG*/ @@ -181,7 +180,7 @@ static Hash *global_scope = 0; /* Global scope */ void Swig_symbol_dump_symtable() { Printf(stdout, "DUMPING SYMTABLE start =======================================\n"); { - Hash *cst = Getattr(current_symtab, k_csymtab); + Hash *cst = Getattr(current_symtab, "csymtab"); Swig_print_tree(cst); /* Swig_print_tree(Getattr(cst, "NumSpace")); @@ -203,9 +202,9 @@ void Swig_symbol_init() { current_symtab = NewHash(); ccurrent = NewHash(); set_nodeType(current_symtab, "symboltable"); - Setattr(current_symtab, k_symtab, current); + Setattr(current_symtab, "symtab", current); Delete(current); - Setattr(current_symtab, k_csymtab, ccurrent); + Setattr(current_symtab, "csymtab", ccurrent); Delete(ccurrent); /* Set the global scope */ @@ -223,8 +222,8 @@ void Swig_symbol_init() { void Swig_symbol_setscopename(const String_or_char *name) { String *qname; - /* assert(!Getattr(current_symtab,k_name)); */ - Setattr(current_symtab, k_name, name); + /* assert(!Getattr(current_symtab,"name")); */ + Setattr(current_symtab, "name", name); /* Set nested scope in parent */ @@ -242,7 +241,7 @@ void Swig_symbol_setscopename(const String_or_char *name) { * ----------------------------------------------------------------------------- */ String *Swig_symbol_getscopename() { - return Getattr(current_symtab, k_name); + return Getattr(current_symtab, "name"); } /* ----------------------------------------------------------------------------- @@ -276,7 +275,7 @@ String *Swig_symbol_qualifiedscopename(Symtab *symtab) { if (parent) { result = Swig_symbol_qualifiedscopename(parent); } - name = Getattr(symtab, k_name); + name = Getattr(symtab, "name"); if (name) { if (!result) { result = NewStringEmpty(); @@ -304,7 +303,7 @@ Symtab *Swig_symbol_newscope() { h = NewHash(); set_nodeType(h, "symboltable"); - Setattr(h, k_symtab, hsyms); + Setattr(h, "symtab", hsyms); Delete(hsyms); set_parentNode(h, current_symtab); @@ -318,7 +317,7 @@ Symtab *Swig_symbol_newscope() { set_lastChild(current_symtab, h); current = hsyms; ccurrent = NewHash(); - Setattr(h, k_csymtab, ccurrent); + Setattr(h, "csymtab", ccurrent); Delete(ccurrent); current_symtab = h; return h; @@ -333,9 +332,9 @@ Symtab *Swig_symbol_newscope() { Symtab *Swig_symbol_setscope(Symtab *sym) { Symtab *ret = current_symtab; current_symtab = sym; - current = Getattr(sym, k_symtab); + current = Getattr(sym, "symtab"); assert(current); - ccurrent = Getattr(sym, k_csymtab); + ccurrent = Getattr(sym, "csymtab"); assert(ccurrent); return ret; } @@ -351,9 +350,9 @@ Symtab *Swig_symbol_popscope() { Hash *h = current_symtab; current_symtab = Getattr(current_symtab, "parentNode"); assert(current_symtab); - current = Getattr(current_symtab, k_symtab); + current = Getattr(current_symtab, "symtab"); assert(current); - ccurrent = Getattr(current_symtab, k_csymtab); + ccurrent = Getattr(current_symtab, "csymtab"); assert(ccurrent); return h; } @@ -395,15 +394,15 @@ void Swig_symbol_alias(String_or_char *aliasname, Symtab *s) { void Swig_symbol_inherit(Symtab *s) { int i, ilen; - List *inherit = Getattr(current_symtab, k_inherit); + List *inherit = Getattr(current_symtab, "inherit"); if (!inherit) { inherit = NewList(); - Setattr(current_symtab, k_inherit, inherit); + Setattr(current_symtab, "inherit", inherit); Delete(inherit); } if (s == current_symtab) { - Swig_warning(WARN_PARSE_REC_INHERITANCE, Getfile(s), Getline(s), "Recursive scope inheritance of '%s'.\n", Getattr(s, k_name)); + Swig_warning(WARN_PARSE_REC_INHERITANCE, Getfile(s), Getline(s), "Recursive scope inheritance of '%s'.\n", Getattr(s, "name")); return; } assert(s != current_symtab); @@ -458,43 +457,43 @@ void Swig_symbol_cadd(String_or_char *name, Node *n) { #endif cn = Getattr(ccurrent, name); - if (cn && (Getattr(cn, k_symtypename))) { + if (cn && (Getattr(cn, "sym:typename"))) { /* The node in the C symbol table is a typename. Do nothing */ /* We might append the symbol at the end */ append = n; - } else if (cn && (Getattr(cn, k_symweak))) { + } else if (cn && (Getattr(cn, "sym:weak"))) { /* The node in the symbol table is weak. Replace it */ - if (checkAttribute(cn, "nodeType", k_template) - && checkAttribute(cn, k_templatetype, k_classforward)) { + if (checkAttribute(cn, "nodeType", "template") + && checkAttribute(cn, "templatetype", "classforward")) { /* The node is a template classforward declaration, and the default template parameters here take precedence. */ - ParmList *pc = Getattr(cn, k_templateparms); - ParmList *pn = Getattr(n, k_templateparms); + ParmList *pc = Getattr(cn, "templateparms"); + ParmList *pn = Getattr(n, "templateparms"); #ifdef SWIG_DEBUG - Printf(stderr, "found template classforward %s\n", Getattr(cn, k_name)); + Printf(stderr, "found template classforward %s\n", Getattr(cn, "name")); #endif while (pc && pn) { - String *value = Getattr(pc, k_value); + String *value = Getattr(pc, "value"); if (value) { #ifdef SWIG_DEBUG - Printf(stderr, "add default template value %s %s\n", Getattr(pc, k_name), value); + Printf(stderr, "add default template value %s %s\n", Getattr(pc, "name"), value); #endif - Setattr(pn, k_value, value); + Setattr(pn, "value", value); } pc = nextSibling(pc); pn = nextSibling(pn); } - Setattr(n, k_templateparms, Getattr(cn, k_templateparms)); + Setattr(n, "templateparms", Getattr(cn, "templateparms")); } Setattr(ccurrent, name, n); - } else if (cn && (Getattr(n, k_symweak))) { + } else if (cn && (Getattr(n, "sym:weak"))) { /* The node being added is weak. Don't worry about it */ - } else if (cn && (Getattr(n, k_symtypename))) { + } else if (cn && (Getattr(n, "sym:typename"))) { /* The node being added is a typename. We definitely add it */ Setattr(ccurrent, name, n); append = cn; - } else if (cn && (Checkattr(cn, "nodeType", k_templateparm))) { + } else if (cn && (Checkattr(cn, "nodeType", "templateparm"))) { Swig_error(Getfile(n), Getline(n), "Declaration of '%s' shadows template parameter,\n", name); Swig_error(Getfile(cn), Getline(cn), "previous template parameter declaration '%s'.\n", name); return; @@ -516,10 +515,10 @@ void Swig_symbol_cadd(String_or_char *name, Node *n) { /* already added. Bail */ return; } - fn = Getattr(fn, k_csymnextSibling); + fn = Getattr(fn, "csym:nextSibling"); } if (pn) { - Setattr(pn, k_csymnextSibling, append); + Setattr(pn, "csym:nextSibling", append); } } @@ -536,11 +535,11 @@ void Swig_symbol_cadd(String_or_char *name, Node *n) { { Node *td = n; - while (td && Checkattr(td, "nodeType", k_cdecl) && Checkattr(td, k_storage, k_typedef)) { + while (td && Checkattr(td, "nodeType", "cdecl") && Checkattr(td, "storage", "typedef")) { SwigType *type; Node *td1; - type = Copy(Getattr(td, k_type)); - SwigType_push(type, Getattr(td, k_decl)); + type = Copy(Getattr(td, "type")); + SwigType_push(type, Getattr(td, "decl")); td1 = Swig_symbol_clookup(type, 0); /* Fix pathetic case #1214313: @@ -560,9 +559,9 @@ void Swig_symbol_cadd(String_or_char *name, Node *n) { ie, when Foo -> FooBar -> Foo, jump one scope up when possible. */ - if (td1 && Checkattr(td1, k_storage, k_typedef)) { - String *st = Getattr(td1, k_type); - String *sn = Getattr(td, k_name); + if (td1 && Checkattr(td1, "storage", "typedef")) { + String *st = Getattr(td1, "type"); + String *sn = Getattr(td, "name"); if (st && sn && Equal(st, sn)) { Symtab *sc = Getattr(current_symtab, "parentNode"); if (sc) @@ -575,9 +574,9 @@ void Swig_symbol_cadd(String_or_char *name, Node *n) { break; td = td1; if (td) { - Symtab *st = Getattr(td, k_symtab); + Symtab *st = Getattr(td, "symtab"); if (st) { - Swig_symbol_alias(Getattr(n, k_name), st); + Swig_symbol_alias(Getattr(n, "name"), st); break; } } @@ -627,14 +626,14 @@ Node *Swig_symbol_add(String_or_char *symname, Node *n) { stays in the C symbol table (so that it can be expanded using %template). */ - name = Getattr(n, k_name); + name = Getattr(n, "name"); if (name && Len(name)) { Swig_symbol_cadd(name, n); } /* No symbol name defined. We return. */ if (!symname) { - Setattr(n, k_symsymtab, current_symtab); + Setattr(n, "sym:symtab", current_symtab); return n; } @@ -654,7 +653,7 @@ Node *Swig_symbol_add(String_or_char *symname, Node *n) { In this case, "Foo" sits in the symbol table. However, the definition of Foo would replace the entry if it appeared later. */ - if (c && Getattr(c, k_symweak)) { + if (c && Getattr(c, "sym:weak")) { c = 0; } if (c) { @@ -670,22 +669,22 @@ Node *Swig_symbol_add(String_or_char *symname, Node *n) { /* Check for namespaces */ String *ntype = Getattr(n, "nodeType"); - if ((Equal(ntype, Getattr(c, "nodeType"))) && ((Equal(ntype, k_namespace)))) { + if ((Equal(ntype, Getattr(c, "nodeType"))) && ((Equal(ntype, "namespace")))) { Node *cl, *pcl = 0; cl = c; while (cl) { pcl = cl; - cl = Getattr(cl, k_symnextSibling); + cl = Getattr(cl, "sym:nextSibling"); } - Setattr(pcl, k_symnextSibling, n); - Setattr(n, k_symsymtab, current_symtab); - Setattr(n, k_symname, symname); - Setattr(n, k_sympreviousSibling, pcl); + Setattr(pcl, "sym:nextSibling", n); + Setattr(n, "sym:symtab", current_symtab); + Setattr(n, "sym:name", symname); + Setattr(n, "sym:previousSibling", pcl); return n; } - if (Getattr(n, k_allowstypedef)) + if (Getattr(n, "allows_typedef")) nt = 1; - if (Getattr(c, k_allowstypedef)) + if (Getattr(c, "allows_typedef")) ct = 1; if (nt || ct) { Node *td, *other; @@ -705,34 +704,34 @@ Node *Swig_symbol_add(String_or_char *symname, Node *n) { other = n; } /* Make sure the other node is a typedef */ - s = Getattr(other, k_storage); - if (!s || (!Equal(s, k_typedef))) + s = Getattr(other, "storage"); + if (!s || (!Equal(s, "typedef"))) return c; /* No. This is a conflict */ /* Hmmm. This appears to be okay. Make sure the symbol table refers to the allow_type node */ if (td != c) { Setattr(current, symname, td); - Setattr(td, k_symsymtab, current_symtab); - Setattr(td, k_symname, symname); + Setattr(td, "sym:symtab", current_symtab); + Setattr(td, "sym:name", symname); } return n; } - decl = Getattr(c, k_decl); - ndecl = Getattr(n, k_decl); + decl = Getattr(c, "decl"); + ndecl = Getattr(n, "decl"); { String *nt1, *nt2; nt1 = Getattr(n, "nodeType"); - if (Equal(nt1, k_template)) - nt1 = Getattr(n, k_templatetype); + if (Equal(nt1, "template")) + nt1 = Getattr(n, "templatetype"); nt2 = Getattr(c, "nodeType"); - if (Equal(nt2, k_template)) - nt2 = Getattr(c, k_templatetype); - if (Equal(nt1, k_using)) + if (Equal(nt2, "template")) + nt2 = Getattr(c, "templatetype"); + if (Equal(nt1, "using")) u1 = 1; - if (Equal(nt2, k_using)) + if (Equal(nt2, "using")) u2 = 1; if ((!Equal(nt1, nt2)) && !(u1 || u2)) @@ -747,34 +746,34 @@ Node *Swig_symbol_add(String_or_char *symname, Node *n) { /* Hmmm. Declarator seems to indicate that this is a function */ /* Look at storage class to see if compatible */ - cstorage = Getattr(c, k_storage); - nstorage = Getattr(n, k_storage); + cstorage = Getattr(c, "storage"); + nstorage = Getattr(n, "storage"); /* If either one is declared as typedef, forget it. We're hosed */ - if (Cmp(cstorage, k_typedef) == 0) { + if (Cmp(cstorage, "typedef") == 0) { return c; } - if (Cmp(nstorage, k_typedef) == 0) { + if (Cmp(nstorage, "typedef") == 0) { return c; } /* Okay. Walk down the list of symbols and see if we get a declarator match */ { String *nt = Getattr(n, "nodeType"); - int n_template = Equal(nt, k_template) && Checkattr(n, k_templatetype, k_cdecl); - int n_plain_cdecl = Equal(nt, k_cdecl); + int n_template = Equal(nt, "template") && Checkattr(n, "templatetype", "cdecl"); + int n_plain_cdecl = Equal(nt, "cdecl"); cn = c; pn = 0; while (cn) { - decl = Getattr(cn, k_decl); + decl = Getattr(cn, "decl"); if (!(u1 || u2)) { if (Cmp(ndecl, decl) == 0) { /* Declarator conflict */ /* Now check we don't have a non-templated function overloaded by a templated function with same params, * eg void foo(); template void foo(); */ String *cnt = Getattr(cn, "nodeType"); - int cn_template = Equal(cnt, k_template) && Checkattr(cn, k_templatetype, k_cdecl); - int cn_plain_cdecl = Equal(cnt, k_cdecl); + int cn_template = Equal(cnt, "template") && Checkattr(cn, "templatetype", "cdecl"); + int cn_plain_cdecl = Equal(cnt, "cdecl"); if (!((n_template && cn_plain_cdecl) || (cn_template && n_plain_cdecl))) { /* found a conflict */ return cn; @@ -782,34 +781,34 @@ Node *Swig_symbol_add(String_or_char *symname, Node *n) { } } cl = cn; - cn = Getattr(cn, k_symnextSibling); + cn = Getattr(cn, "sym:nextSibling"); pn++; } } /* Well, we made it this far. Guess we can drop the symbol in place */ - Setattr(n, k_symsymtab, current_symtab); - Setattr(n, k_symname, symname); - /* Printf(stdout,"%s %x\n", Getattr(n,k_symovername), current_symtab); */ - assert(!Getattr(n, k_symovername)); + Setattr(n, "sym:symtab", current_symtab); + Setattr(n, "sym:name", symname); + /* Printf(stdout,"%s %x\n", Getattr(n,"sym:overname"), current_symtab); */ + assert(!Getattr(n, "sym:overname")); overname = NewStringf("__SWIG_%d", pn); - Setattr(n, k_symovername, overname); - /*Printf(stdout,"%s %s %s\n", symname, Getattr(n,k_decl), Getattr(n,k_symovername)); */ - Setattr(cl, k_symnextSibling, n); - Setattr(n, k_sympreviousSibling, cl); - Setattr(cl, k_symoverloaded, c); - Setattr(n, k_symoverloaded, c); + Setattr(n, "sym:overname", overname); + /*Printf(stdout,"%s %s %s\n", symname, Getattr(n,"decl"), Getattr(n,"sym:overname")); */ + Setattr(cl, "sym:nextSibling", n); + Setattr(n, "sym:previousSibling", cl); + Setattr(cl, "sym:overloaded", c); + Setattr(n, "sym:overloaded", c); Delete(overname); return n; } /* No conflict. Just add it */ - Setattr(n, k_symsymtab, current_symtab); - Setattr(n, k_symname, symname); - /* Printf(stdout,"%s\n", Getattr(n,k_symovername)); */ + Setattr(n, "sym:symtab", current_symtab); + Setattr(n, "sym:name", symname); + /* Printf(stdout,"%s\n", Getattr(n,"sym:overname")); */ overname = NewStringf("__SWIG_%d", pn); - Setattr(n, k_symovername, overname); + Setattr(n, "sym:overname", overname); Delete(overname); - /* Printf(stdout,"%s %s %s\n", symname, Getattr(n,k_decl), Getattr(n,k_symovername)); */ + /* Printf(stdout,"%s %s %s\n", symname, Getattr(n,"decl"), Getattr(n,"sym:overname")); */ Setattr(current, symname, n); return n; } @@ -831,7 +830,7 @@ Node *Swig_symbol_add(String_or_char *symname, Node *n) { static Node *_symbol_lookup(String *name, Symtab *symtab, int (*check) (Node *n)) { Node *n; List *inherit; - Hash *sym = Getattr(symtab, k_csymtab); + Hash *sym = Getattr(symtab, "csymtab"); if (Getmark(symtab)) return 0; Setmark(symtab, 1); @@ -840,7 +839,7 @@ static Node *_symbol_lookup(String *name, Symtab *symtab, int (*check) (Node *n) n = Getattr(sym, name); #ifdef SWIG_DEBUG - Printf(stderr, "symbol_look %s %x %x %s\n", name, n, symtab, Getattr(symtab, k_name)); + Printf(stderr, "symbol_look %s %x %x %s\n", name, n, symtab, Getattr(symtab, "name")); #endif if (n) { @@ -874,7 +873,7 @@ static Node *_symbol_lookup(String *name, Symtab *symtab, int (*check) (Node *n) return n; } - inherit = Getattr(symtab, k_inherit); + inherit = Getattr(symtab, "inherit"); if (inherit) { int i, len; len = Len(inherit); @@ -987,7 +986,7 @@ Node *Swig_symbol_clookup(String_or_char *name, Symtab *n) { hsym = current_symtab; } else { if (!Checkattr(n, "nodeType", "symboltable")) { - n = Getattr(n, k_symsymtab); + n = Getattr(n, "sym:symtab"); } assert(n); if (n) { @@ -1029,12 +1028,12 @@ Node *Swig_symbol_clookup(String_or_char *name, Symtab *n) { return 0; } /* Check if s is a 'using' node */ - while (s && Checkattr(s, "nodeType", k_using)) { - String *uname = Getattr(s, k_uname); - Symtab *un = Getattr(s, k_symsymtab); + while (s && Checkattr(s, "nodeType", "using")) { + String *uname = Getattr(s, "uname"); + Symtab *un = Getattr(s, "sym:symtab"); Node *ss = (!Equal(name, uname) || (un != n)) ? Swig_symbol_clookup(uname, un) : 0; /* avoid infinity loop */ if (!ss) { - Swig_warning(WARN_PARSE_USING_UNDEF, Getfile(s), Getline(s), "Nothing known about '%s'.\n", Getattr(s, k_uname)); + Swig_warning(WARN_PARSE_USING_UNDEF, Getfile(s), Getline(s), "Nothing known about '%s'.\n", Getattr(s, "uname")); } s = ss; } @@ -1059,7 +1058,7 @@ Node *Swig_symbol_clookup_check(String_or_char *name, Symtab *n, int (*checkfunc hsym = current_symtab; } else { if (!Checkattr(n, "nodeType", "symboltable")) { - n = Getattr(n, k_symsymtab); + n = Getattr(n, "sym:symtab"); } assert(n); if (n) { @@ -1100,11 +1099,11 @@ Node *Swig_symbol_clookup_check(String_or_char *name, Symtab *n, int (*checkfunc return 0; } /* Check if s is a 'using' node */ - while (s && Checkattr(s, "nodeType", k_using)) { + while (s && Checkattr(s, "nodeType", "using")) { Node *ss; - ss = Swig_symbol_clookup(Getattr(s, k_uname), Getattr(s, k_symsymtab)); + ss = Swig_symbol_clookup(Getattr(s, "uname"), Getattr(s, "sym:symtab")); if (!ss && !checkfunc) { - Swig_warning(WARN_PARSE_USING_UNDEF, Getfile(s), Getline(s), "Nothing known about '%s'.\n", Getattr(s, k_uname)); + Swig_warning(WARN_PARSE_USING_UNDEF, Getfile(s), Getline(s), "Nothing known about '%s'.\n", Getattr(s, "uname")); } s = ss; } @@ -1124,11 +1123,11 @@ Node *Swig_symbol_clookup_local(String_or_char *name, Symtab *n) { h = ccurrent; } else { if (!Checkattr(n, "nodeType", "symboltable")) { - n = Getattr(n, k_symsymtab); + n = Getattr(n, "sym:symtab"); } assert(n); hsym = n; - h = Getattr(n, k_csymtab); + h = Getattr(n, "csymtab"); } if (Swig_scopename_check(name)) { @@ -1149,10 +1148,10 @@ Node *Swig_symbol_clookup_local(String_or_char *name, Symtab *n) { if (!s) return 0; /* Check if s is a 'using' node */ - while (s && Checkattr(s, "nodeType", k_using)) { - Node *ss = Swig_symbol_clookup_local(Getattr(s, k_uname), Getattr(s, k_symsymtab)); + while (s && Checkattr(s, "nodeType", "using")) { + Node *ss = Swig_symbol_clookup_local(Getattr(s, "uname"), Getattr(s, "sym:symtab")); if (!ss) { - Swig_warning(WARN_PARSE_USING_UNDEF, Getfile(s), Getline(s), "Nothing known about '%s'.\n", Getattr(s, k_uname)); + Swig_warning(WARN_PARSE_USING_UNDEF, Getfile(s), Getline(s), "Nothing known about '%s'.\n", Getattr(s, "uname")); } s = ss; } @@ -1172,11 +1171,11 @@ Node *Swig_symbol_clookup_local_check(String_or_char *name, Symtab *n, int (*che h = ccurrent; } else { if (!Checkattr(n, "nodeType", "symboltable")) { - n = Getattr(n, k_symsymtab); + n = Getattr(n, "sym:symtab"); } assert(n); hsym = n; - h = Getattr(n, k_csymtab); + h = Getattr(n, "csymtab"); } if (Swig_scopename_check(name)) { @@ -1197,10 +1196,10 @@ Node *Swig_symbol_clookup_local_check(String_or_char *name, Symtab *n, int (*che if (!s) return 0; /* Check if s is a 'using' node */ - while (s && Checkattr(s, "nodeType", k_using)) { - Node *ss = Swig_symbol_clookup_local_check(Getattr(s, k_uname), Getattr(s, k_symsymtab), checkfunc); + while (s && Checkattr(s, "nodeType", "using")) { + Node *ss = Swig_symbol_clookup_local_check(Getattr(s, "uname"), Getattr(s, "sym:symtab"), checkfunc); if (!ss && !checkfunc) { - Swig_warning(WARN_PARSE_USING_UNDEF, Getfile(s), Getline(s), "Nothing known about '%s'.\n", Getattr(s, k_uname)); + Swig_warning(WARN_PARSE_USING_UNDEF, Getfile(s), Getline(s), "Nothing known about '%s'.\n", Getattr(s, "uname")); } s = ss; } @@ -1236,19 +1235,19 @@ void Swig_symbol_remove(Node *n) { Node *symprev; Node *symnext; Node *fixovername = 0; - symtab = Getattr(n, k_symsymtab); /* Get symbol table object */ - symtab = Getattr(symtab, k_symtab); /* Get actual hash table of symbols */ - symname = Getattr(n, k_symname); - symprev = Getattr(n, k_sympreviousSibling); - symnext = Getattr(n, k_symnextSibling); + symtab = Getattr(n, "sym:symtab"); /* Get symbol table object */ + symtab = Getattr(symtab, "symtab"); /* Get actual hash table of symbols */ + symname = Getattr(n, "sym:name"); + symprev = Getattr(n, "sym:previousSibling"); + symnext = Getattr(n, "sym:nextSibling"); /* If previous symbol, just fix the links */ if (symprev) { if (symnext) { - Setattr(symprev, k_symnextSibling, symnext); + Setattr(symprev, "sym:nextSibling", symnext); fixovername = symprev; /* fix as symbol to remove is somewhere in the middle of the linked list */ } else { - Delattr(symprev, k_symnextSibling); + Delattr(symprev, "sym:nextSibling"); } } else { /* If no previous symbol, see if there is a next symbol */ @@ -1261,18 +1260,18 @@ void Swig_symbol_remove(Node *n) { } if (symnext) { if (symprev) { - Setattr(symnext, k_sympreviousSibling, symprev); + Setattr(symnext, "sym:previousSibling", symprev); } else { - Delattr(symnext, k_sympreviousSibling); + Delattr(symnext, "sym:previousSibling"); } } - Delattr(n, k_symsymtab); - Delattr(n, k_sympreviousSibling); - Delattr(n, k_symnextSibling); - Delattr(n, k_csymnextSibling); - Delattr(n, k_symovername); - Delattr(n, k_csympreviousSibling); - Delattr(n, k_symoverloaded); + Delattr(n, "sym:symtab"); + Delattr(n, "sym:previousSibling"); + Delattr(n, "sym:nextSibling"); + Delattr(n, "csym:nextSibling"); + Delattr(n, "sym:overname"); + Delattr(n, "csym:previousSibling"); + Delattr(n, "sym:overloaded"); n = 0; if (fixovername) { @@ -1283,19 +1282,19 @@ void Swig_symbol_remove(Node *n) { /* find head of linked list */ while (nn) { head = nn; - nn = Getattr(nn, k_sympreviousSibling); + nn = Getattr(nn, "sym:previousSibling"); } /* adjust all the sym:overname strings to start from 0 and increment by one */ nn = head; while (nn) { - assert(Getattr(nn, k_symovername)); - Delattr(nn, k_symovername); + assert(Getattr(nn, "sym:overname")); + Delattr(nn, "sym:overname"); overname = NewStringf("__SWIG_%d", pn); - Setattr(nn, k_symovername, overname); + Setattr(nn, "sym:overname", overname); Delete(overname); pn++; - nn = Getattr(nn, k_symnextSibling); + nn = Getattr(nn, "sym:nextSibling"); } } } @@ -1311,12 +1310,12 @@ String *Swig_symbol_qualified(Node *n) { if (Checkattr(n, "nodeType", "symboltable")) { symtab = n; } else { - symtab = Getattr(n, k_symsymtab); + symtab = Getattr(n, "sym:symtab"); } if (!symtab) return NewStringEmpty(); #ifdef SWIG_DEBUG - Printf(stderr, "symbol_qscope %s %x %s\n", Getattr(n, k_name), symtab, Getattr(symtab, k_name)); + Printf(stderr, "symbol_qscope %s %x %s\n", Getattr(n, "name"), symtab, Getattr(symtab, "name")); #endif return Swig_symbol_qualifiedscopename(symtab); } @@ -1328,7 +1327,7 @@ String *Swig_symbol_qualified(Node *n) { * ----------------------------------------------------------------------------- */ Node *Swig_symbol_isoverloaded(Node *n) { - return Getattr(n, k_symoverloaded); + return Getattr(n, "sym:overloaded"); } /* ----------------------------------------------------------------------------- @@ -1352,7 +1351,7 @@ static SwigType *Swig_symbol_template_qualify(const SwigType *e, Symtab *st) { Iterator ti; #ifdef SWIG_TEMPLATE_QUALIFY_CACHE static Hash *qualify_cache = 0; - String *scopetype = st ? NewStringf("%s::%s", Getattr(st, k_name), e) + String *scopetype = st ? NewStringf("%s::%s", Getattr(st, "name"), e) : NewStringf("%s::%s", Swig_symbol_getscopename(), e); if (!qualify_cache) { qualify_cache = NewHash(); @@ -1371,7 +1370,7 @@ static SwigType *Swig_symbol_template_qualify(const SwigType *e, Symtab *st) { qprefix = Swig_symbol_type_qualify(tprefix, st); targs = SwigType_parmlist(e); tempn = Swig_symbol_clookup_local(tprefix, st); - tscope = tempn ? Getattr(tempn, k_symsymtab) : 0; + tscope = tempn ? Getattr(tempn, "sym:symtab") : 0; Append(qprefix, "<("); for (ti = First(targs); ti.item;) { String *vparm; @@ -1426,7 +1425,7 @@ SwigType *Swig_symbol_type_qualify(const SwigType *t, Symtab *st) { if (SwigType_issimple(e)) { Node *n = Swig_symbol_clookup_check(e, st, no_constructor); if (n) { - String *name = Getattr(n, k_name); + String *name = Getattr(n, "name"); Clear(e); Append(e, name); #ifdef SWIG_DEBUG @@ -1477,7 +1476,7 @@ SwigType *Swig_symbol_type_qualify(const SwigType *t, Symtab *st) { } Delete(elements); #ifdef SWIG_DEBUG - Printf(stderr, "symbol_qualify %s %s %x %s\n", t, result, st, st ? Getattr(st, k_name) : 0); + Printf(stderr, "symbol_qualify %s %s %x %s\n", t, result, st, st ? Getattr(st, "name") : 0); #endif return result; @@ -1505,7 +1504,7 @@ SwigType *Swig_symbol_template_reduce(SwigType *qt, Symtab *ntab) { Node *n = Swig_symbol_clookup(qp, ntab); if (n) { String *qual = Swig_symbol_qualified(n); - np = Copy(Getattr(n, k_name)); + np = Copy(Getattr(n, "name")); Delete(tp); tp = np; if (qual && Len(qual)) { @@ -1561,10 +1560,10 @@ SwigType *Swig_symbol_typedef_reduce(SwigType *ty, Symtab *tab) { } } nt = Getattr(n, "nodeType"); - if (Equal(nt, k_using)) { - String *uname = Getattr(n, k_uname); + if (Equal(nt, "using")) { + String *uname = Getattr(n, "uname"); if (uname) { - n = Swig_symbol_clookup(base, Getattr(n, k_symsymtab)); + n = Swig_symbol_clookup(base, Getattr(n, "sym:symtab")); if (!n) { Delete(base); Delete(prefix); @@ -1575,14 +1574,14 @@ SwigType *Swig_symbol_typedef_reduce(SwigType *ty, Symtab *tab) { } } } - if (Equal(nt, k_cdecl)) { - String *storage = Getattr(n, k_storage); - if (storage && (Equal(storage, k_typedef))) { + if (Equal(nt, "cdecl")) { + String *storage = Getattr(n, "storage"); + if (storage && (Equal(storage, "typedef"))) { SwigType *decl; SwigType *rt; SwigType *qt; Symtab *ntab; - SwigType *nt = Copy(Getattr(n, k_type)); + SwigType *nt = Copy(Getattr(n, "type")); /* Fix for case 'typedef struct Hello hello;' */ { @@ -1595,14 +1594,14 @@ SwigType *Swig_symbol_typedef_reduce(SwigType *ty, Symtab *tab) { } } } - decl = Getattr(n, k_decl); + decl = Getattr(n, "decl"); if (decl) { SwigType_push(nt, decl); } SwigType_push(nt, prefix); Delete(base); Delete(prefix); - ntab = Getattr(n, k_symsymtab); + ntab = Getattr(n, "sym:symtab"); rt = Swig_symbol_typedef_reduce(nt, ntab); qt = Swig_symbol_type_qualify(rt, ntab); if (SwigType_istemplate(qt)) { @@ -1685,7 +1684,7 @@ void Swig_symbol_template_defargs(Parm *parms, Parm *targs, Symtab *tscope, Symt lp = p; } while (tp) { - String *value = Getattr(tp, k_value); + String *value = Getattr(tp, "value"); if (value) { Parm *cp; Parm *ta = targs; @@ -1693,12 +1692,12 @@ void Swig_symbol_template_defargs(Parm *parms, Parm *targs, Symtab *tscope, Symt SwigType *nt = Swig_symbol_string_qualify(value, tsdecl); SwigType *ntq = 0; #ifdef SWIG_DEBUG - Printf(stderr, "value %s %s %s\n", value, nt, tsdecl ? Getattr(tsdecl, k_name) : tsdecl); + Printf(stderr, "value %s %s %s\n", value, nt, tsdecl ? Getattr(tsdecl, "name") : tsdecl); #endif while (p && ta) { - String *name = Getattr(ta, k_name); - String *pvalue = Getattr(p, k_value); - String *value = pvalue ? pvalue : Getattr(p, k_type); + String *name = Getattr(ta, "name"); + String *pvalue = Getattr(p, "value"); + String *value = pvalue ? pvalue : Getattr(p, "type"); String *ttq = Swig_symbol_type_qualify(value, tscope); /* value = SwigType_typedef_resolve_all(value); */ Replaceid(nt, name, ttq); @@ -1741,7 +1740,7 @@ SwigType *Swig_symbol_template_deftype(const SwigType *type, Symtab *tscope) { int i; #ifdef SWIG_TEMPLATE_DEFTYPE_CACHE static Hash *deftype_cache = 0; - String *scopetype = tscope ? NewStringf("%s::%s", Getattr(tscope, k_name), type) + String *scopetype = tscope ? NewStringf("%s::%s", Getattr(tscope, "name"), type) : NewStringf("%s::%s", Swig_symbol_getscopename(), type); if (!deftype_cache) { deftype_cache = NewHash(); @@ -1795,9 +1794,9 @@ SwigType *Swig_symbol_template_deftype(const SwigType *type, Symtab *tscope) { Printf(stderr, "deftype type %s %s %d\n", e, tprefix, (long) tempn); #endif if (tempn) { - ParmList *tnargs = Getattr(tempn, k_templateparms); + ParmList *tnargs = Getattr(tempn, "templateparms"); Parm *p; - Symtab *tsdecl = Getattr(tempn, k_symsymtab); + Symtab *tsdecl = Getattr(tempn, "sym:symtab"); #ifdef SWIG_DEBUG Printf(stderr, "deftype type %s %s %s\n", tprefix, targs, tsuffix); @@ -1807,8 +1806,8 @@ SwigType *Swig_symbol_template_deftype(const SwigType *type, Symtab *tscope) { p = tparms; tscope = tsdecl; while (p) { - SwigType *ptype = Getattr(p, k_type); - SwigType *ttr = ptype ? ptype : Getattr(p, k_value); + SwigType *ptype = Getattr(p, "type"); + SwigType *ttr = ptype ? ptype : Getattr(p, "value"); SwigType *ttf = Swig_symbol_type_qualify(ttr, tscope); SwigType *ttq = Swig_symbol_template_param_eval(ttf, tscope); #ifdef SWIG_DEBUG @@ -1868,12 +1867,12 @@ SwigType *Swig_symbol_template_param_eval(const SwigType *p, Symtab *symtab) { lastnode = n; if (n) { String *nt = Getattr(n, "nodeType"); - if (Equal(nt, k_enumitem)) { + if (Equal(nt, "enumitem")) { /* An enum item. Generate a fully qualified name */ String *qn = Swig_symbol_qualified(n); if (qn && Len(qn)) { Append(qn, "::"); - Append(qn, Getattr(n, k_name)); + Append(qn, Getattr(n, "name")); Delete(value); value = qn; continue; @@ -1881,8 +1880,8 @@ SwigType *Swig_symbol_template_param_eval(const SwigType *p, Symtab *symtab) { Delete(qn); break; } - } else if ((Equal(nt, k_cdecl))) { - String *nv = Getattr(n, k_value); + } else if ((Equal(nt, "cdecl"))) { + String *nv = Getattr(n, "value"); if (nv) { Delete(value); value = Copy(nv); diff --git a/Source/Swig/tree.c b/Source/Swig/tree.c index 08379859e..947a21d57 100644 --- a/Source/Swig/tree.c +++ b/Source/Swig/tree.c @@ -11,7 +11,6 @@ char cvsroot_tree_c[] = "$Id$"; #include "swig.h" -#include "swigkeys.h" #include #include diff --git a/Source/Swig/typemap.c b/Source/Swig/typemap.c index de5eb1217..9b9781a7b 100644 --- a/Source/Swig/typemap.c +++ b/Source/Swig/typemap.c @@ -10,7 +10,6 @@ char cvsroot_typemap_c[] = "$Id$"; #include "swig.h" -#include "swigkeys.h" #include "cparse.h" #include @@ -180,8 +179,8 @@ void Swig_typemap_register(const String_or_char *op, ParmList *parms, String_or_ /* Register the first type in the parameter list */ - type = Getattr(parms, k_type); - pname = Getattr(parms, k_name); + type = Getattr(parms, "type"); + pname = Getattr(parms, "name"); /* See if this type has been seen before */ tm = get_typemap(tm_scope, type); @@ -248,14 +247,14 @@ void Swig_typemap_register(const String_or_char *op, ParmList *parms, String_or_ ParmList *clocals = CopyParmList(locals); ParmList *ckwargs = CopyParmList(kwargs); - Setattr(tm2, k_code, code); - Setattr(tm2, k_type, type); - Setattr(tm2, k_typemap, typemap); + Setattr(tm2, "code", code); + Setattr(tm2, "type", type); + Setattr(tm2, "typemap", typemap); if (pname) { - Setattr(tm2, k_pname, pname); + Setattr(tm2, "pname", pname); } - Setattr(tm2, k_locals, clocals); - Setattr(tm2, k_kwargs, ckwargs); + Setattr(tm2, "locals", clocals); + Setattr(tm2, "kwargs", ckwargs); Delete(clocals); Delete(ckwargs); @@ -309,8 +308,8 @@ int Swig_typemap_copy(const String_or_char *op, ParmList *srcparms, ParmList *pa p = srcparms; tmops = NewString(tmop); while (p) { - ptype = Getattr(p, k_type); - pname = Getattr(p, k_name); + ptype = Getattr(p, "type"); + pname = Getattr(p, "name"); /* Lookup the type */ tm = Swig_typemap_get(ptype, pname, ts); @@ -332,7 +331,7 @@ int Swig_typemap_copy(const String_or_char *op, ParmList *srcparms, ParmList *pa if (!p && tm) { /* Got some kind of match */ - Swig_typemap_register(op, parms, Getattr(tm, k_code), Getattr(tm, k_locals), Getattr(tm, k_kwargs)); + Swig_typemap_register(op, parms, Getattr(tm, "code"), Getattr(tm, "locals"), Getattr(tm, "kwargs")); return 0; } ts--; @@ -359,8 +358,8 @@ void Swig_typemap_clear(const String_or_char *op, ParmList *parms) { newop = NewString(op); p = parms; while (p) { - type = Getattr(p, k_type); - name = Getattr(p, k_name); + type = Getattr(p, "type"); + name = Getattr(p, "name"); tm = Swig_typemap_get(type, name, tm_scope); if (!tm) return; @@ -371,9 +370,9 @@ void Swig_typemap_clear(const String_or_char *op, ParmList *parms) { if (tm) { tm = Getattr(tm, tmop_name(newop)); if (tm) { - Delattr(tm, k_code); - Delattr(tm, k_locals); - Delattr(tm, k_kwargs); + Delattr(tm, "code"); + Delattr(tm, "locals"); + Delattr(tm, "kwargs"); } } Delete(newop); @@ -421,8 +420,8 @@ int Swig_typemap_apply(ParmList *src, ParmList *dest) { lastdp = dp; np = nextSibling(p); if (np) { - Printf(ssig, "-%s+%s:", Getattr(p, k_type), Getattr(p, k_name)); - Printf(dsig, "-%s+%s:", Getattr(dp, k_type), Getattr(dp, k_name)); + Printf(ssig, "-%s+%s:", Getattr(p, "type"), Getattr(p, "name")); + Printf(dsig, "-%s+%s:", Getattr(dp, "type"), Getattr(dp, "name")); narg++; } p = np; @@ -430,14 +429,14 @@ int Swig_typemap_apply(ParmList *src, ParmList *dest) { } /* make sure a typemap node exists for the last destination node */ - type = Getattr(lastdp, k_type); + type = Getattr(lastdp, "type"); tm = get_typemap(tm_scope, type); if (!tm) { tm = NewHash(); set_typemap(tm_scope, type, tm); Delete(tm); } - name = Getattr(lastdp, k_name); + name = Getattr(lastdp, "name"); if (name) { Hash *tm1 = Getattr(tm, name); if (!tm1) { @@ -451,8 +450,8 @@ int Swig_typemap_apply(ParmList *src, ParmList *dest) { /* This is a little nasty. We need to go searching for all possible typemaps in the source and apply them to the target */ - type = Getattr(lastp, k_type); - name = Getattr(lastp, k_name); + type = Getattr(lastp, "type"); + name = Getattr(lastp, "name"); while (ts >= 0) { @@ -489,15 +488,15 @@ int Swig_typemap_apply(ParmList *src, ParmList *dest) { /* Make sure the typemap doesn't already exist in the target map */ oldm = Getattr(tm, nkey); - if (!oldm || (!Getattr(tm, k_code))) { + if (!oldm || (!Getattr(tm, "code"))) { String *code; ParmList *locals; ParmList *kwargs; Hash *sm1 = ki.item; - code = Getattr(sm1, k_code); - locals = Getattr(sm1, k_locals); - kwargs = Getattr(sm1, k_kwargs); + code = Getattr(sm1, "code"); + locals = Getattr(sm1, "locals"); + kwargs = Getattr(sm1, "kwargs"); if (code) { Replace(nkey, dsig, "", DOH_REPLACE_ANY); Replace(nkey, "tmap:", "", DOH_REPLACE_ANY); @@ -537,17 +536,17 @@ void Swig_typemap_clear_apply(Parm *parms) { lastp = p; np = nextSibling(p); if (np) { - Printf(tsig, "-%s+%s:", Getattr(p, k_type), Getattr(p, k_name)); + Printf(tsig, "-%s+%s:", Getattr(p, "type"), Getattr(p, "name")); narg++; } p = np; } - tm = get_typemap(tm_scope, Getattr(lastp, k_type)); + tm = get_typemap(tm_scope, Getattr(lastp, "type")); if (!tm) { Delete(tsig); return; } - name = Getattr(lastp, k_name); + name = Getattr(lastp, "name"); if (name) { tm = Getattr(tm, name); } @@ -616,7 +615,7 @@ Hash *Swig_typemap_search(const String_or_char *op, SwigType *type, const String tm1 = Getattr(tm, cname); if (tm1) { result = Getattr(tm1, tmop); /* See if there is a type-name match */ - if (result && Getattr(result, k_code)) + if (result && Getattr(result, "code")) goto ret_result; if (result) backup = result; @@ -624,7 +623,7 @@ Hash *Swig_typemap_search(const String_or_char *op, SwigType *type, const String } if (tm) { result = Getattr(tm, tmop); /* See if there is simply a type match */ - if (result && Getattr(result, k_code)) + if (result && Getattr(result, "code")) goto ret_result; if (result) backup = result; @@ -641,7 +640,7 @@ Hash *Swig_typemap_search(const String_or_char *op, SwigType *type, const String tm1 = Getattr(tma, cname); if (tm1) { result = Getattr(tm1, tmop); /* type-name match */ - if (result && Getattr(result, k_code)) + if (result && Getattr(result, "code")) goto ret_result; if (result) backup = result; @@ -649,7 +648,7 @@ Hash *Swig_typemap_search(const String_or_char *op, SwigType *type, const String } if (tma) { result = Getattr(tma, tmop); /* type match */ - if (result && Getattr(result, k_code)) + if (result && Getattr(result, "code")) goto ret_result; if (result) backup = result; @@ -749,8 +748,8 @@ Hash *Swig_typemap_search_multi(const String_or_char *op, ParmList *parms, int * *nmatch = 0; return 0; } - type = Getattr(parms, k_type); - name = Getattr(parms, k_name); + type = Getattr(parms, "type"); + name = Getattr(parms, "name"); /* Try to find a match on the first type */ tm = Swig_typemap_search(op, type, name, &mtype); @@ -763,7 +762,7 @@ Hash *Swig_typemap_search_multi(const String_or_char *op, ParmList *parms, int * tm1 = Swig_typemap_search_multi(newop, nextSibling(parms), nmatch); if (tm1) tm = tm1; - if (Getattr(tm, k_code)) { + if (Getattr(tm, "code")) { *(nmatch) = *nmatch + 1; } else { tm = 0; @@ -785,7 +784,7 @@ static void replace_local_types(ParmList *p, const String *name, const String *rep) { SwigType *t; while (p) { - t = Getattr(p, k_type); + t = Getattr(p, "type"); Replace(t, name, rep, DOH_REPLACE_ANY); p = nextSibling(p); } @@ -819,7 +818,7 @@ void typemap_replace_vars(String *s, ParmList *locals, SwigType *type, SwigType int rep = 0; p = locals; while (p) { - if (Strchr(Getattr(p, k_type), '$')) + if (Strchr(Getattr(p, "type"), '$')) rep = 1; p = nextSibling(p); } @@ -1104,10 +1103,10 @@ static void typemap_locals(DOHString * s, ParmList *l, Wrapper *f, int argnum) { p = l; while (p) { - SwigType *pt = Getattr(p, k_type); + SwigType *pt = Getattr(p, "type"); SwigType *at = SwigType_alttype(pt, 1); - String *pn = Getattr(p, k_name); - String *value = Getattr(p, k_value); + String *pn = Getattr(p, "name"); + String *value = Getattr(p, "value"); if (at) pt = at; if (pn) { @@ -1174,7 +1173,7 @@ String *Swig_typemap_lookup(const String_or_char *op, SwigType *type, String_or_ if (!tm) return 0; - s = Getattr(tm, k_code); + s = Getattr(tm, "code"); if (!s) { if (mtype) Delete(mtype); @@ -1190,7 +1189,7 @@ String *Swig_typemap_lookup(const String_or_char *op, SwigType *type, String_or_ s = Copy(s); /* Make a local copy of the typemap code */ - locals = Getattr(tm, k_locals); + locals = Getattr(tm, "locals"); if (locals) locals = CopyParmList(locals); @@ -1255,14 +1254,14 @@ String *Swig_typemap_lookup_new(const String_or_char *op, Node *node, const Stri sdef = Swig_ref_call(node, lname); } - type = Getattr(node, k_type); + type = Getattr(node, "type"); if (!type) return sdef; - pname = Getattr(node, k_name); + pname = Getattr(node, "name"); #if 1 - if (pname && node && checkAttribute(node, k_kind, "function")) { + if (pname && node && checkAttribute(node, "kind", "function")) { /* For functions, look qualified names first, such as @@ -1270,12 +1269,12 @@ String *Swig_typemap_lookup_new(const String_or_char *op, Node *node, const Stri int *foo(int bar) -> Foo::foo }; */ - Symtab *st = Getattr(node, k_symsymtab); + Symtab *st = Getattr(node, "sym:symtab"); String *qsn = st ? Swig_symbol_string_qualify(pname, st) : 0; if (qsn) { if (Len(qsn) && !Equal(qsn, pname)) { tm = Swig_typemap_search(op, type, qsn, &mtype); - if (tm && (!Getattr(tm, k_pname) || strstr(Char(Getattr(tm, k_type)), "SWIGTYPE"))) { + if (tm && (!Getattr(tm, "pname") || strstr(Char(Getattr(tm, "type")), "SWIGTYPE"))) { tm = 0; } } @@ -1288,7 +1287,7 @@ String *Swig_typemap_lookup_new(const String_or_char *op, Node *node, const Stri if (!tm) return sdef; - s = Getattr(tm, k_code); + s = Getattr(tm, "code"); if (!s) return sdef; @@ -1298,7 +1297,7 @@ String *Swig_typemap_lookup_new(const String_or_char *op, Node *node, const Stri s = Copy(s); /* Make a local copy of the typemap code */ - locals = Getattr(tm, k_locals); + locals = Getattr(tm, "locals"); if (locals) locals = CopyParmList(locals); @@ -1330,7 +1329,7 @@ String *Swig_typemap_lookup_new(const String_or_char *op, Node *node, const Stri Replace(s, "$name", pname, DOH_REPLACE_ANY); - symname = Getattr(node, k_symname); + symname = Getattr(node, "sym:name"); if (symname) { Replace(s, "$symname", symname, DOH_REPLACE_ANY); } @@ -1342,17 +1341,17 @@ String *Swig_typemap_lookup_new(const String_or_char *op, Node *node, const Stri Delete(locals); } - if (Checkattr(tm, k_type, "SWIGTYPE")) { + if (Checkattr(tm, "type", "SWIGTYPE")) { sprintf(temp, "%s:SWIGTYPE", cop); Setattr(node, tmop_name(temp), "1"); } /* Attach kwargs */ - kw = Getattr(tm, k_kwargs); + kw = Getattr(tm, "kwargs"); while (kw) { - String *value = Copy(Getattr(kw, k_value)); - String *type = Getattr(kw, k_type); - char *ckwname = Char(Getattr(kw, k_name)); + String *value = Copy(Getattr(kw, "value")); + String *type = Getattr(kw, "type"); + char *ckwname = Char(Getattr(kw, "name")); if (type) { String *mangle = Swig_string_mangle(type); Append(value, mangle); @@ -1416,26 +1415,26 @@ String *Swig_typemap_lookup_new(const String_or_char *op, Node *node, const Stri void Swig_typemap_attach_kwargs(Hash *tm, const String_or_char *op, Parm *p) { String *temp = NewStringEmpty(); - Parm *kw = Getattr(tm, k_kwargs); + Parm *kw = Getattr(tm, "kwargs"); while (kw) { - String *value = Copy(Getattr(kw, k_value)); - String *type = Getattr(kw, k_type); + String *value = Copy(Getattr(kw, "value")); + String *type = Getattr(kw, "type"); if (type) { Hash *v = NewHash(); - Setattr(v, k_type, type); - Setattr(v, k_value, value); + Setattr(v, "type", type); + Setattr(v, "value", value); Delete(value); value = v; } Clear(temp); - Printf(temp, "%s:%s", op, Getattr(kw, k_name)); + Printf(temp, "%s:%s", op, Getattr(kw, "name")); Setattr(p, tmop_name(temp), value); Delete(value); kw = nextSibling(kw); } Clear(temp); Printf(temp, "%s:match_type", op); - Setattr(p, tmop_name(temp), Getattr(tm, k_type)); + Setattr(p, tmop_name(temp), Getattr(tm, "type")); Delete(temp); } @@ -1476,11 +1475,11 @@ static void Swig_typemap_emit_code_fragments(const String_or_char *op, Parm *p) * ----------------------------------------------------------------------------- */ String *Swig_typemap_get_option(Hash *tm, String *name) { - Parm *kw = Getattr(tm, k_kwargs); + Parm *kw = Getattr(tm, "kwargs"); while (kw) { - String *kname = Getattr(kw, k_name); + String *kname = Getattr(kw, "name"); if (Equal(kname, name)) { - return Getattr(kw, k_value); + return Getattr(kw, "value"); } kw = nextSibling(kw); } @@ -1508,7 +1507,7 @@ void Swig_typemap_attach_parms(const String_or_char *op, ParmList *parms, Wrappe argnum++; nmatch = 0; #ifdef SWIG_DEBUG - Printf(stdout, "parms: %s %s %s\n", op, Getattr(p, k_name), Getattr(p, k_type)); + Printf(stdout, "parms: %s %s %s\n", op, Getattr(p, "name"), Getattr(p, "type")); #endif tm = Swig_typemap_search_multi(op, p, &nmatch); #ifdef SWIG_DEBUG @@ -1546,7 +1545,7 @@ void Swig_typemap_attach_parms(const String_or_char *op, ParmList *parms, Wrappe p = nextSibling(p); continue; } else { - SwigType *typetm = Getattr(tm, k_type); + SwigType *typetm = Getattr(tm, "type"); String *temp = NewStringf("tmap:%s:match_type", kwmatch); SwigType *typein = Getattr(p, temp); Delete(temp); @@ -1556,8 +1555,8 @@ void Swig_typemap_attach_parms(const String_or_char *op, ParmList *parms, Wrappe } else { int nnmatch; Hash *tmapin = Swig_typemap_search_multi(kwmatch, p, &nnmatch); - String *tmname = Getattr(tm, k_pname); - String *tnname = Getattr(tmapin, k_pname); + String *tmname = Getattr(tm, "pname"); + String *tnname = Getattr(tmapin, "pname"); if (!(tmname && tnname && Equal(tmname, tnname)) && !(!tmname && !tnname)) { p = nextSibling(p); continue; @@ -1571,7 +1570,7 @@ void Swig_typemap_attach_parms(const String_or_char *op, ParmList *parms, Wrappe } } - s = Getattr(tm, k_code); + s = Getattr(tm, "code"); if (!s) { p = nextSibling(p); continue; @@ -1588,7 +1587,7 @@ void Swig_typemap_attach_parms(const String_or_char *op, ParmList *parms, Wrappe } s = Copy(s); - locals = Getattr(tm, k_locals); + locals = Getattr(tm, "locals"); if (locals) locals = CopyParmList(locals); firstp = p; @@ -1602,9 +1601,9 @@ void Swig_typemap_attach_parms(const String_or_char *op, ParmList *parms, Wrappe SwigType *mtype; - type = Getattr(p, k_type); - pname = Getattr(p, k_name); - lname = Getattr(p, k_lname); + type = Getattr(p, "type"); + pname = Getattr(p, "name"); + lname = Getattr(p, "lname"); mtype = Getattr(p, "tmap:match"); if (mtype) { @@ -1614,7 +1613,7 @@ void Swig_typemap_attach_parms(const String_or_char *op, ParmList *parms, Wrappe typemap_replace_vars(s, locals, type, type, pname, lname, i + 1); } - if (Checkattr(tm, k_type, "SWIGTYPE")) { + if (Checkattr(tm, "type", "SWIGTYPE")) { sprintf(temp, "%s:SWIGTYPE", cop); Setattr(p, tmop_name(temp), "1"); } @@ -1633,7 +1632,7 @@ void Swig_typemap_attach_parms(const String_or_char *op, ParmList *parms, Wrappe /* Attach attributes to object */ #ifdef SWIG_DEBUG - Printf(stdout, "attach: %s %s %s\n", Getattr(firstp, k_name), tmop_name(op), s); + Printf(stdout, "attach: %s %s %s\n", Getattr(firstp, "name"), tmop_name(op), s); #endif Setattr(firstp, tmop_name(op), s); /* Code object */ @@ -1660,7 +1659,7 @@ void Swig_typemap_attach_parms(const String_or_char *op, ParmList *parms, Wrappe argnum += nmatch - 1; Delete(s); #ifdef SWIG_DEBUG - Printf(stdout, "res: %s %s %s\n", Getattr(firstp, k_name), tmop_name(op), Getattr(firstp, tmop_name(op))); + Printf(stdout, "res: %s %s %s\n", Getattr(firstp, "name"), tmop_name(op), Getattr(firstp, tmop_name(op))); #endif } @@ -1827,9 +1826,9 @@ static void replace_embedded_typemap(String *s) { set_previousSibling(v, p); } p = v; - Setattr(p, k_lname, Getattr(p, k_name)); - if (Getattr(p, k_value)) { - Setattr(p, k_name, Getattr(p, k_value)); + Setattr(p, "lname", Getattr(p, "name")); + if (Getattr(p, "value")) { + Setattr(p, "name", Getattr(p, "value")); } if (!first) first = p; diff --git a/Source/Swig/typeobj.c b/Source/Swig/typeobj.c index 85ff6ea9f..e5781cc5b 100644 --- a/Source/Swig/typeobj.c +++ b/Source/Swig/typeobj.c @@ -13,7 +13,6 @@ char cvsroot_typeobj_c[] = "$Id$"; #include "swig.h" -#include "swigkeys.h" #include /* ----------------------------------------------------------------------------- @@ -669,7 +668,7 @@ SwigType *SwigType_add_function(SwigType *t, ParmList *parms) { for (p = parms; p; p = nextSibling(p)) { if (p != parms) Putc(',', pstr); - Append(pstr, Getattr(p, k_type)); + Append(pstr, Getattr(p, "type")); } Insert(t, 0, pstr); Delete(pstr); @@ -764,15 +763,15 @@ SwigType *SwigType_add_template(SwigType *t, ParmList *parms) { p = parms; for (p = parms; p; p = nextSibling(p)) { String *v; - if (Getattr(p, k_default)) + if (Getattr(p, "default")) continue; if (p != parms) Append(t, ","); - v = Getattr(p, k_value); + v = Getattr(p, "value"); if (v) { Append(t, v); } else { - Append(t, Getattr(p, k_type)); + Append(t, Getattr(p, "type")); } } Append(t, ")>"); diff --git a/Source/Swig/typesys.c b/Source/Swig/typesys.c index 212519961..ee8b4887d 100644 --- a/Source/Swig/typesys.c +++ b/Source/Swig/typesys.c @@ -13,7 +13,6 @@ char cvsroot_typesys_c[] = "$Id$"; #include "swig.h" -#include "swigkeys.h" #include "cparse.h" /* ----------------------------------------------------------------------------- @@ -145,9 +144,9 @@ void SwigType_typesystem_init() { current_scope = NewHash(); global_scope = current_scope; - Setattr(current_scope, k_name, ""); /* No name for global scope */ + Setattr(current_scope, "name", ""); /* No name for global scope */ current_typetab = NewHash(); - Setattr(current_scope, k_typetab, current_typetab); + Setattr(current_scope, "typetab", current_typetab); current_symtab = 0; scopes = NewHash(); @@ -213,10 +212,10 @@ int SwigType_typedef_class(String_or_char *name) { * ----------------------------------------------------------------------------- */ String *SwigType_scope_name(Typetab *ttab) { - String *qname = NewString(Getattr(ttab, k_name)); + String *qname = NewString(Getattr(ttab, "name")); ttab = Getattr(ttab, "parent"); while (ttab) { - String *pname = Getattr(ttab, k_name); + String *pname = Getattr(ttab, "name"); if (Len(pname)) { Insert(qname, 0, "::"); Insert(qname, 0, pname); @@ -241,15 +240,15 @@ void SwigType_new_scope(const String_or_char *name) { name = ""; } s = NewHash(); - Setattr(s, k_name, name); + Setattr(s, "name", name); Setattr(s, "parent", current_scope); ttab = NewHash(); - Setattr(s, k_typetab, ttab); + Setattr(s, "typetab", ttab); /* Build fully qualified name and */ qname = SwigType_scope_name(s); Setattr(scopes, qname, s); - Setattr(s, k_qname, qname); + Setattr(s, "qname", qname); Delete(qname); current_scope = s; @@ -268,10 +267,10 @@ void SwigType_new_scope(const String_or_char *name) { void SwigType_inherit_scope(Typetab *scope) { List *inherits; int i, len; - inherits = Getattr(current_scope, k_inherit); + inherits = Getattr(current_scope, "inherit"); if (!inherits) { inherits = NewList(); - Setattr(current_scope, k_inherit, inherits); + Setattr(current_scope, "inherit", inherits); Delete(inherits); } assert(scope != current_scope); @@ -314,10 +313,10 @@ void SwigType_using_scope(Typetab *scope) { { List *ulist; int i, len; - ulist = Getattr(current_scope, k_using); + ulist = Getattr(current_scope, "using"); if (!ulist) { ulist = NewList(); - Setattr(current_scope, k_using, ulist); + Setattr(current_scope, "using", ulist); Delete(ulist); } assert(scope != current_scope); @@ -345,8 +344,8 @@ Typetab *SwigType_pop_scope() { if (!t) t = global_scope; current_scope = t; - current_typetab = Getattr(t, k_typetab); - current_symtab = Getattr(t, k_symtab); + current_typetab = Getattr(t, "typetab"); + current_symtab = Getattr(t, "symtab"); flush_cache(); return old; } @@ -362,8 +361,8 @@ Typetab *SwigType_set_scope(Typetab *t) { if (!t) t = global_scope; current_scope = t; - current_typetab = Getattr(t, k_typetab); - current_symtab = Getattr(t, k_symtab); + current_typetab = Getattr(t, "typetab"); + current_symtab = Getattr(t, "symtab"); flush_cache(); return old; } @@ -375,7 +374,7 @@ Typetab *SwigType_set_scope(Typetab *t) { * ----------------------------------------------------------------------------- */ void SwigType_attach_symtab(Symtab *sym) { - Setattr(current_scope, k_symtab, sym); + Setattr(current_scope, "symtab", sym); current_symtab = sym; } @@ -391,15 +390,15 @@ void SwigType_print_scope(Typetab *t) { for (i = First(scopes); i.key; i = Next(i)) { t = i.item; - ttab = Getattr(i.item, k_typetab); + ttab = Getattr(i.item, "typetab"); Printf(stdout, "Type scope '%s' (%x)\n", i.key, i.item); { - List *inherit = Getattr(i.item, k_inherit); + List *inherit = Getattr(i.item, "inherit"); if (inherit) { Iterator j; for (j = First(inherit); j.item; j = Next(j)) { - Printf(stdout, " Inherits from '%s' (%x)\n", Getattr(j.item, k_qname), j.item); + Printf(stdout, " Inherits from '%s' (%x)\n", Getattr(j.item, "qname"), j.item); } } } @@ -425,7 +424,7 @@ Typetab *SwigType_find_scope(Typetab *s, String *nameprefix) { ss = s; while (ss) { String *full; - String *qname = Getattr(ss, k_qname); + String *qname = Getattr(ss, "qname"); if (qname) { full = NewStringf("%s::%s", qname, nameprefix); } else { @@ -445,7 +444,7 @@ Typetab *SwigType_find_scope(Typetab *s, String *nameprefix) { if (!s) { /* Check inheritance */ List *inherit; - inherit = Getattr(ss, k_using); + inherit = Getattr(ss, "using"); if (inherit) { Typetab *ttab; int i, len; @@ -497,14 +496,14 @@ static SwigType *_typedef_resolve(Typetab *s, String *base, int look_parent) { if (!Getmark(s)) { Setmark(s, 1); - ttab = Getattr(s, k_typetab); + ttab = Getattr(s, "typetab"); type = Getattr(ttab, base); if (type) { resolved_scope = s; Setmark(s, 0); } else { /* Hmmm. Not found in my scope. It could be in an inherited scope */ - inherit = Getattr(s, k_inherit); + inherit = Getattr(s, "inherit"); if (inherit) { int i, len; len = Len(inherit); @@ -579,7 +578,7 @@ SwigType *SwigType_typedef_resolve(SwigType *t) { ttab = current_typetab; if (strncmp(Char(base), "::", 2) == 0) { s = global_scope; - ttab = Getattr(s, k_typetab); + ttab = Getattr(s, "typetab"); Delitem(base, 0); Delitem(base, 0); } @@ -627,7 +626,7 @@ SwigType *SwigType_typedef_resolve(SwigType *t) { #endif if ((type) && (!Swig_scopename_check(type)) && resolved_scope) { Typetab *rtab = resolved_scope; - String *qname = Getattr(resolved_scope, k_qname); + String *qname = Getattr(resolved_scope, "qname"); /* If qualified *and* the typename is defined from the resolved scope, we qualify */ if ((qname) && typedef_resolve(resolved_scope, type)) { type = Copy(type); @@ -876,7 +875,7 @@ SwigType *SwigType_typedef_qualified(SwigType *t) { resolved_scope = 0; if (typedef_resolve(current_scope, e)) { /* resolved_scope contains the scope that actually resolved the symbol */ - String *qname = Getattr(resolved_scope, k_qname); + String *qname = Getattr(resolved_scope, "qname"); if (qname) { Insert(e, 0, "::"); Insert(e, 0, qname); @@ -959,7 +958,7 @@ SwigType *SwigType_typedef_qualified(SwigType *t) { String *qn = Swig_symbol_qualified(n); if (Len(qn)) { Append(qn, "::"); - Append(qn, Getattr(n, k_name)); + Append(qn, Getattr(n, "name")); Delete(value); value = qn; continue; @@ -967,9 +966,9 @@ SwigType *SwigType_typedef_qualified(SwigType *t) { Delete(qn); break; } - } else if ((strcmp(ntype, "cdecl") == 0) && (Getattr(n, k_value))) { + } else if ((strcmp(ntype, "cdecl") == 0) && (Getattr(n, "value"))) { Delete(value); - value = Copy(Getattr(n, k_value)); + value = Copy(Getattr(n, "value")); continue; } } @@ -1103,7 +1102,7 @@ int SwigType_typedef_using(String_or_char *name) { td = SwigType_typedef_resolve(name); /* Printf(stdout,"td = '%s' %x\n", td, resolved_scope); */ if (resolved_scope) { - defined_name = Getattr(resolved_scope, k_qname); + defined_name = Getattr(resolved_scope, "qname"); if (defined_name) { defined_name = Copy(defined_name); Append(defined_name, "::"); @@ -1121,7 +1120,7 @@ int SwigType_typedef_using(String_or_char *name) { prefix = Swig_scopename_prefix(name); s = SwigType_find_scope(current_scope, prefix); if (s) { - Hash *ttab = Getattr(s, k_typetab); + Hash *ttab = Getattr(s, "typetab"); if (!Getattr(ttab, base) && defined_name) { Setattr(ttab, base, defined_name); } @@ -1313,7 +1312,7 @@ SwigType *SwigType_alttype(SwigType *t, int local_tmap) { if (GetFlag(n, "feature:valuewrapper")) { use_wrapper = 1; } else { - if (Checkattr(n, "nodeType", k_class) + if (Checkattr(n, "nodeType", "class") && (!Getattr(n, "allocate:default_constructor") || (Getattr(n, "allocate:noassign")))) { use_wrapper = !GetFlag(n, "feature:novaluewrapper") || GetFlag(n, "feature:nodefault"); @@ -1342,7 +1341,7 @@ SwigType *SwigType_alttype(SwigType *t, int local_tmap) { SwigType *td = SwigType_strip_qualifiers(ftd); if (SwigType_type(td) == T_USER) { if ((n = Swig_symbol_clookup(td, 0))) { - if ((Checkattr(n, "nodeType", k_class) + if ((Checkattr(n, "nodeType", "class") && !Getattr(n, "allocate:noassign") && (Getattr(n, "allocate:default_constructor"))) || (GetFlag(n, "feature:novaluewrapper"))) {