API cleanup. Documentation.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9629 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Dave Beazley 2006-12-30 18:27:47 +00:00
commit 264b7dff90
26 changed files with 712 additions and 373 deletions

View file

@ -331,7 +331,7 @@ static void add_symbols(Node *n) {
Delete(prefix);
}
if (0 && !Getattr(n,k_parentnode) && class_level) set_parentNode(n,class_decl[class_level - 1]);
if (0 && !Getattr(n,"parentNode") && class_level) set_parentNode(n,class_decl[class_level - 1]);
Setattr(n,"ismember","1");
}
}
@ -692,7 +692,7 @@ static void append_previous_extension(Node *cls, Node *am) {
}
n = ne;
}
if (pe) preppendChild(cls,pe);
if (pe) prependChild(cls,pe);
if (ae) appendChild(cls,ae);
}
@ -1331,6 +1331,20 @@ static void default_arguments(Node *n) {
}
}
/* -----------------------------------------------------------------------------
* tag_nodes()
*
* Used by the parser to mark subtypes with extra information.
* ----------------------------------------------------------------------------- */
static void tag_nodes(Node *n, const String_or_char *attrname, DOH *value) {
while (n) {
Setattr(n, attrname, value);
tag_nodes(firstChild(n), attrname, value);
n = nextSibling(n);
}
}
%}
%union {
@ -1634,7 +1648,7 @@ extend_directive : EXTEND options idcolon LBRACE {
/* Mark members as extend */
Swig_tag_nodes($6,"feature:extend",(char*) "1");
tag_nodes($6,"feature:extend",(char*) "1");
if (current_class) {
/* We add the extension to the previously defined class */
appendChild($$,$6);
@ -3932,7 +3946,7 @@ cpp_members : cpp_member cpp_members {
}
} cpp_members RBRACE cpp_members {
$$ = new_node("extend");
Swig_tag_nodes($4,"feature:extend",(char*) "1");
tag_nodes($4,"feature:extend",(char*) "1");
appendChild($$,$4);
set_nextSibling($$,$6);
}

View file

@ -51,7 +51,7 @@ void Swig_cparse_debug_templates(int x) {
static int cparse_template_expand(Node *n, String *tname, String *rname, String *templateargs, List *patchlist, List *typelist, List *cpatchlist) {
static int expanded = 0;
int ret;
String *nodeType = Getattr(n, k_nodetype);
String *nodeType = nodeType(n);
if (!n)
return 0;
if (Getattr(n, k_error))
@ -61,7 +61,7 @@ static int cparse_template_expand(Node *n, String *tname, String *rname, String
/* Change the node type back to normal */
if (!expanded) {
expanded = 1;
Setattr(n, k_nodetype, Getattr(n, k_templatetype));
set_nodeType(n, Getattr(n, k_templatetype));
ret = cparse_template_expand(n, tname, rname, templateargs, patchlist, typelist, cpatchlist);
expanded = 0;
return ret;
@ -69,9 +69,9 @@ static int cparse_template_expand(Node *n, String *tname, String *rname, String
/* Called when template appears inside another template */
/* Member templates */
Setattr(n, k_nodetype, Getattr(n, k_templatetype));
set_nodeType(n, Getattr(n, k_templatetype));
ret = cparse_template_expand(n, tname, rname, templateargs, patchlist, typelist, cpatchlist);
Setattr(n, k_nodetype, k_template);
set_nodeType(n, k_template);
return ret;
}
} else if (StringEqual(nodeType, k_cdecl)) {
@ -482,7 +482,7 @@ static Node *template_locate(String *name, Parm *tparms, Symtab *tscope) {
}
if (n) {
Node *tn;
String *nodeType = Getattr(n, k_nodetype);
String *nodeType = nodeType(n);
if (StringEqual(nodeType, k_template))
goto success;
tn = Getattr(n, k_template);
@ -490,7 +490,7 @@ static Node *template_locate(String *name, Parm *tparms, Symtab *tscope) {
n = tn;
goto success; /* Previously wrapped by a template return that */
}
Swig_error(cparse_file, cparse_line, "'%s' is not defined as a template. (%s)\n", name, Getattr(n, k_nodetype));
Swig_error(cparse_file, cparse_line, "'%s' is not defined as a template. (%s)\n", name, nodeType(n));
Delete(tname);
Delete(parms);
return 0; /* Found a match, but it's not a template of any kind. */
@ -591,7 +591,7 @@ static Node *template_locate(String *name, Parm *tparms, Symtab *tscope) {
if (!n) {
Swig_error(cparse_file, cparse_line, "Template '%s' undefined.\n", name);
} else if (n) {
String *nodeType = Getattr(n, k_nodetype);
String *nodeType = nodeType(n);
if (!StringEqual(nodeType, k_template)) {
Swig_error(cparse_file, cparse_line, "'%s' is not defined as a template. (%s)\n", name, nodeType);
n = 0;
@ -623,7 +623,7 @@ Node *Swig_cparse_template_locate(String *name, Parm *tparms, Symtab *tscope) {
Node *n = template_locate(name, tparms, tscope); /* this function does what we want for templated classes */
if (n) {
String *nodeType = Getattr(n, k_nodetype);
String *nodeType = nodeType(n);
int isclass = 0;
assert(StringEqual(nodeType, k_template));
isclass = (StringEqual(Getattr(n, k_templatetype), k_class));

View file

@ -353,6 +353,16 @@ int DohDelattr(DOH *obj, const DOH *name) {
return 0;
}
/* -----------------------------------------------------------------------------
* DohCheckattr()
* ----------------------------------------------------------------------------- */
int DohCheckattr(DOH *obj, const DOH *name, const DOH *value) {
DOH *attr = Getattr(obj,name);
if (!attr) return 0;
return DohEqual(attr,value);
}
/* -----------------------------------------------------------------------------
* DohKeys()
* ----------------------------------------------------------------------------- */

View file

@ -118,8 +118,6 @@
#define DohCopyto DOH_NAMESPACE(Copyto)
#define DohNewList DOH_NAMESPACE(NewList)
#define DohNewHash DOH_NAMESPACE(NewHash)
#define DohHashGetAttr DOH_NAMESPACE(HashGetAttr)
#define DohHashCheckAttr DOH_NAMESPACE(HashCheckAttr)
#define DohNewVoid DOH_NAMESPACE(NewVoid)
#define DohSplit DOH_NAMESPACE(Split)
#define DohSplitLines DOH_NAMESPACE(SplitLines)
@ -206,6 +204,7 @@ extern void DohIncref(DOH *obj);
extern DOH *DohGetattr(DOH *obj, const DOHString_or_char *name);
extern int DohSetattr(DOH *obj, const DOHString_or_char *name, const DOHObj_or_char * value);
extern int DohDelattr(DOH *obj, const DOHString_or_char *name);
extern int DohCheckattr(DOH *obj, const DOHString_or_char *name, const DOHString_or_char *value);
extern DOH *DohKeys(DOH *obj);
extern int DohGetInt(DOH *obj, const DOHString_or_char *name);
extern void DohSetInt(DOH *obj, const DOHString_or_char *name, int);
@ -346,8 +345,6 @@ extern void DohSortList(DOH *lo, int (*cmp) (const DOH *, const DOH *));
* ----------------------------------------------------------------------------- */
extern DOHHash *DohNewHash();
extern DOH *DohHashGetAttr(DOH *hash, const DOH *key);
extern int DohHashCheckAttr(DOH *hash, DOH *key, DOH *value);
/* -----------------------------------------------------------------------------
* Void
@ -372,6 +369,7 @@ extern void DohMemoryDebug(void);
#define Getattr DohGetattr
#define Setattr DohSetattr
#define Delattr DohDelattr
#define Checkattr DohCheckattr
#define Hashval DohHashval
#define Getitem DohGetitem
#define Setitem DohSetitem
@ -434,8 +432,6 @@ extern void DohMemoryDebug(void);
#define NewStringWithSize DohNewStringWithSize
#define NewStringf DohNewStringf
#define NewHash DohNewHash
#define HashGetAttr DohHashGetAttr
#define HashCheckAttr DohHashCheckAttr
#define NewList DohNewList
#define NewFile DohNewFile
#define NewFileFromFile DohNewFileFromFile

View file

@ -253,61 +253,30 @@ static int Hash_setattr(DOH *ho, DOH *k, DOH *obj) {
* ----------------------------------------------------------------------------- */
typedef int (*binop) (DOH *obj1, DOH *obj2);
#define _Hash_getattr(h, k, o) \
int hv = Hashval(k) % h->hashsize; \
DohObjInfo *k_type = ((DohBase*)k)->type; \
HashNode *n = h->hashtable[hv]; \
if (k_type->doh_equal) { \
binop equal = k_type->doh_equal; \
while (n) { \
DohBase *nk = (DohBase *)n->key; \
if ((k_type == nk->type) && equal(k, nk)) o = n->object; \
n = n->next; \
} \
} else { \
binop cmp = k_type->doh_cmp; \
while (n) { \
DohBase *nk = (DohBase *)n->key; \
if ((k_type == nk->type) && (cmp(k, nk) == 0)) o = n->object; \
n = n->next; \
} \
}
static DOH *Hash_getattr(DOH *h, DOH *k) {
DOH *obj = 0;
Hash *ho = (Hash *) ObjData(h);
DOH *ko = DohCheck(k) ? k : find_key(k);
_Hash_getattr(ho, ko, obj);
return obj;
}
DOH *DohHashGetAttr(DOH *h, const DOH *k) {
DOH *obj = 0;
Hash *ho = (Hash *) ObjData(h);
_Hash_getattr(ho, (DOH *) k, obj);
return obj;
}
/* -----------------------------------------------------------------------------
* HashCheckAttr()
*
* Check an attribute from the hash table.
* ----------------------------------------------------------------------------- */
int DohHashCheckAttr(DOH *h, DOH *k, DOH *v) {
DOH *obj = 0;
Hash *ho = (Hash *) ObjData(h);
_Hash_getattr(ho, k, obj);
if (obj) {
DohObjInfo *o_type = ((DohBase *) obj)->type;
if (o_type == ((DohBase *) v)->type) {
binop equal = o_type->doh_equal;
return equal ? equal(obj, v) : (o_type->doh_cmp(obj, v) == 0);
int hv = Hashval(ko) % ho->hashsize;
DohObjInfo *k_type = ((DohBase*)ko)->type;
HashNode *n = ho->hashtable[hv];
if (k_type->doh_equal) {
binop equal = k_type->doh_equal;
while (n) {
DohBase *nk = (DohBase *)n->key;
if ((k_type == nk->type) && equal(ko, nk)) obj = n->object;
n = n->next;
}
} else {
binop cmp = k_type->doh_cmp;
while (n) {
DohBase *nk = (DohBase *)n->key;
if ((k_type == nk->type) && (cmp(ko, nk) == 0)) obj = n->object;
n = n->next;
}
}
return 0;
return obj;
}
/* -----------------------------------------------------------------------------

View file

@ -715,6 +715,7 @@ void SWIG_getoptions(int argc, char *argv[]) {
int SWIG_main(int argc, char *argv[], Language *l) {
char *c;
extern void Swig_print_xml(Node *obj, String *filename);
/* Initialize the SWIG core */
Swig_init();

View file

@ -1142,7 +1142,7 @@ public:
Replaceall(tm, "$input", source);
Setattr(p, "emit:input", source);
Printf(f->code, "%s\n", tm);
if (i == 0 && HashGetAttr(p, k_self)) {
if (i == 0 && Getattr(p, k_self)) {
Printf(f->code, "\tif(!arg1) SWIG_PHP_Error(E_ERROR, \"this pointer is NULL\");\n");
}
p = Getattr(p, "tmap:in:next");

View file

@ -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", HashGetAttr(cls, k_name));
Swig_warning(WARN_PARSE_REC_INHERITANCE, Getfile(cls), Getline(cls), "Recursive scope inheritance of '%s'.\n", Getattr(cls, k_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;) {
StringAppend(ucode, HashGetAttr(p, k_name));
StringAppend(ucode, Getattr(p, k_name));
p = nextSibling(p);
if (p)
StringAppend(ucode, ",");

View file

@ -498,9 +498,9 @@ Hash *Preprocessor_define(const String_or_char *_str, int swigmacro) {
if (swigmacro) {
Setattr(macro, kpp_swigmacro, "1");
}
symbols = HashGetAttr(cpp, kpp_symbols);
if ((m1 = HashGetAttr(symbols, macroname))) {
if (!HashCheckAttr(m1, kpp_value, macrovalue)) {
symbols = Getattr(cpp, kpp_symbols);
if ((m1 = Getattr(symbols, macroname))) {
if (!Checkattr(m1, kpp_value, macrovalue)) {
Swig_error(Getfile(str), Getline(str), "Macro '%s' redefined,\n", macroname);
Swig_error(Getfile(m1), Getline(m1), "previous definition of '%s'.\n", macroname);
goto macro_error;
@ -534,7 +534,7 @@ macro_error:
void Preprocessor_undef(const String_or_char *str) {
Hash *symbols;
assert(cpp);
symbols = HashGetAttr(cpp, kpp_symbols);
symbols = Getattr(cpp, kpp_symbols);
Delattr(symbols, str);
}
@ -702,15 +702,15 @@ static String *expand_macro(String *name, List *args) {
int i, l;
int isvarargs = 0;
symbols = HashGetAttr(cpp, kpp_symbols);
symbols = Getattr(cpp, kpp_symbols);
if (!symbols)
return 0;
/* See if the name is actually defined */
macro = HashGetAttr(symbols, name);
macro = Getattr(symbols, name);
if (!macro)
return 0;
if (HashGetAttr(macro, kpp_expanded)) {
if (Getattr(macro, kpp_expanded)) {
ns = NewStringEmpty();
StringAppend(ns, name);
if (args) {
@ -729,11 +729,11 @@ static String *expand_macro(String *name, List *args) {
}
/* Get macro arguments and value */
mvalue = HashGetAttr(macro, kpp_value);
mvalue = Getattr(macro, kpp_value);
assert(mvalue);
margs = HashGetAttr(macro, kpp_args);
margs = Getattr(macro, kpp_args);
if (args && HashGetAttr(macro, kpp_varargs)) {
if (args && Getattr(macro, kpp_varargs)) {
isvarargs = 1;
/* Variable length argument macro. We need to collect all of the extra arguments into a single argument */
if (Len(args) >= (Len(margs) - 1)) {
@ -896,7 +896,7 @@ static String *expand_macro(String *name, List *args) {
Delattr(macro, kpp_expanded);
Delete(ns);
if (HashGetAttr(macro, kpp_swigmacro)) {
if (Getattr(macro, kpp_swigmacro)) {
String *g;
String *f = NewStringEmpty();
Seek(e, 0, SEEK_SET);
@ -959,7 +959,7 @@ DOH *Preprocessor_replace(DOH *s) {
String *id = NewStringEmpty();
assert(cpp);
symbols = HashGetAttr(cpp, kpp_symbols);
symbols = Getattr(cpp, kpp_symbols);
ns = NewStringEmpty();
copy_location(s, ns);
@ -1029,7 +1029,7 @@ DOH *Preprocessor_replace(DOH *s) {
}
for (i = 0; i < lenargs; i++) {
DOH *o = Getitem(args, i);
if (!HashGetAttr(symbols, o)) {
if (!Getattr(symbols, o)) {
break;
}
}
@ -1055,11 +1055,11 @@ DOH *Preprocessor_replace(DOH *s) {
break;
}
/* See if the macro is defined in the preprocessor symbol table */
if ((m = HashGetAttr(symbols, id))) {
if ((m = Getattr(symbols, id))) {
DOH *args = 0;
DOH *e;
/* See if the macro expects arguments */
if (HashGetAttr(m, kpp_args)) {
if (Getattr(m, kpp_args)) {
/* Yep. We need to go find the arguments and do a substitution */
args = find_args(s);
if (!Len(args)) {
@ -1121,7 +1121,7 @@ DOH *Preprocessor_replace(DOH *s) {
/* See if this is the special "defined" macro */
if (StringEqual(kpp_defined, id)) {
Swig_error(Getfile(s), Getline(s), "No arguments given to defined()\n");
} else if ((m = HashGetAttr(symbols, id))) {
} else if ((m = Getattr(symbols, id))) {
DOH *e;
/* Yes. There is a macro here */
/* See if the macro expects arguments */
@ -1254,7 +1254,7 @@ String *Preprocessor_parse(String *s) {
chunk = NewStringEmpty();
copy_location(s, chunk);
copy_location(s, ns);
symbols = HashGetAttr(cpp, kpp_symbols);
symbols = Getattr(cpp, kpp_symbols);
state = 0;
while ((c = StringGetc(s)) != EOF) {
@ -1453,8 +1453,8 @@ String *Preprocessor_parse(String *s) {
DOH *m, *v, *v1;
Seek(value, 0, SEEK_SET);
m = Preprocessor_define(value, 0);
if ((m) && !(HashGetAttr(m, kpp_args))) {
v = Copy(HashGetAttr(m, kpp_value));
if ((m) && !(Getattr(m, kpp_args))) {
v = Copy(Getattr(m, kpp_value));
if (Len(v)) {
Swig_error_silent(1);
v1 = Preprocessor_replace(v);
@ -1462,9 +1462,9 @@ String *Preprocessor_parse(String *s) {
/* Printf(stdout,"checking '%s'\n", v1); */
if (!checkpp_id(v1)) {
if (Len(comment) == 0)
Printf(ns, "%%constant %s = %s;\n", HashGetAttr(m, kpp_name), v1);
Printf(ns, "%%constant %s = %s;\n", Getattr(m, kpp_name), v1);
else
Printf(ns, "%%constant %s = %s; /*%s*/\n", HashGetAttr(m, kpp_name), v1, comment);
Printf(ns, "%%constant %s = %s; /*%s*/\n", Getattr(m, kpp_name), v1, comment);
cpp_lines--;
}
Delete(v1);
@ -1481,7 +1481,7 @@ String *Preprocessor_parse(String *s) {
if (allow) {
start_level = level;
/* See if the identifier is in the hash table */
if (!HashGetAttr(symbols, value))
if (!Getattr(symbols, value))
allow = 0;
mask = 1;
}
@ -1491,7 +1491,7 @@ String *Preprocessor_parse(String *s) {
if (allow) {
start_level = level;
/* See if the identifier is in the hash table */
if (HashGetAttr(symbols, value))
if (Getattr(symbols, value))
allow = 0;
mask = 1;
}

View file

@ -975,10 +975,10 @@ int Swig_MethodToFunction(Node *n, String *classname, int flags, SwigType *direc
* ----------------------------------------------------------------------------- */
Node *Swig_methodclass(Node *n) {
Node *nodetype = Getattr(n, k_nodetype);
Node *nodetype = nodeType(n);
if (!Cmp(nodetype, "class"))
return n;
return GetFlag(n, "feature:extend") ? Getattr(Getattr(n, k_parentnode), k_parentnode) : Getattr(n, k_parentnode);
return GetFlag(n, "feature:extend") ? parentNode(parentNode(n)) : parentNode(n);
}
int Swig_directorclass(Node *n) {

View file

@ -151,7 +151,7 @@ String *Swig_name_wrapper(const String_or_char *fname) {
r = NewStringEmpty();
if (!naming_hash)
naming_hash = NewHash();
f = HashGetAttr(naming_hash, k_wrapper);
f = Getattr(naming_hash, k_wrapper);
if (!f) {
Append(r, "_wrap_%f");
} else {
@ -179,7 +179,7 @@ String *Swig_name_member(const String_or_char *classname, const String_or_char *
r = NewStringEmpty();
if (!naming_hash)
naming_hash = NewHash();
f = HashGetAttr(naming_hash, k_member);
f = Getattr(naming_hash, k_member);
if (!f) {
Append(r, "%c_%m");
} else {
@ -237,7 +237,7 @@ String *Swig_name_set(const String_or_char *vname) {
r = NewStringEmpty();
if (!naming_hash)
naming_hash = NewHash();
f = HashGetAttr(naming_hash, k_set);
f = Getattr(naming_hash, k_set);
if (!f) {
Append(r, "%v_set");
} else {
@ -264,7 +264,7 @@ String *Swig_name_construct(const String_or_char *classname) {
r = NewStringEmpty();
if (!naming_hash)
naming_hash = NewHash();
f = HashGetAttr(naming_hash, k_construct);
f = Getattr(naming_hash, k_construct);
if (!f) {
Append(r, "new_%c");
} else {
@ -297,7 +297,7 @@ String *Swig_name_copyconstructor(const String_or_char *classname) {
r = NewStringEmpty();
if (!naming_hash)
naming_hash = NewHash();
f = HashGetAttr(naming_hash, k_copy);
f = Getattr(naming_hash, k_copy);
if (!f) {
Append(r, "copy_%c");
} else {
@ -329,7 +329,7 @@ String *Swig_name_destroy(const String_or_char *classname) {
r = NewStringEmpty();
if (!naming_hash)
naming_hash = NewHash();
f = HashGetAttr(naming_hash, k_destroy);
f = Getattr(naming_hash, k_destroy);
if (!f) {
Append(r, "delete_%c");
} else {
@ -361,7 +361,7 @@ String *Swig_name_disown(const String_or_char *classname) {
r = NewStringEmpty();
if (!naming_hash)
naming_hash = NewHash();
f = HashGetAttr(naming_hash, k_disown);
f = Getattr(naming_hash, k_disown);
if (!f) {
Append(r, "disown_%c");
} else {
@ -390,7 +390,7 @@ void Swig_name_object_set(Hash *namehash, String *name, SwigType *decl, DOH *obj
#ifdef SWIG_DEBUG
Printf(stderr, "Swig_name_object_set: '%s', '%s'\n", name, decl);
#endif
n = HashGetAttr(namehash, name);
n = Getattr(namehash, name);
if (!n) {
n = NewHash();
Setattr(namehash, name, n);
@ -553,7 +553,7 @@ void Swig_name_object_inherit(Hash *namehash, String *base, String *derived) {
Iterator oi;
String *nkey = NewStringf("%s%s", dprefix, k + plen);
Hash *n = ki.item;
Hash *newh = HashGetAttr(namehash, nkey);
Hash *newh = Getattr(namehash, nkey);
if (!newh) {
newh = NewHash();
Setattr(namehash, nkey, newh);
@ -629,7 +629,7 @@ void Swig_features_get(Hash *features, String *prefix, String *name, SwigType *d
/* very specific hack for template constructors/destructors */
if (name && SwigType_istemplate(name)) {
String *nodetype = Getattr(node, k_nodetype);
String *nodetype = nodeType(node);
if (nodetype && (Equal(nodetype, k_constructor) || Equal(nodetype, k_destructor))) {
String *nprefix = NewStringEmpty();
String *nlast = NewStringEmpty();
@ -838,7 +838,7 @@ 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, k_nodetype, k_classforward)) {
if (checkAttribute(n, "nodeType", k_classforward)) {
need = 0;
} else if (checkAttribute(n, k_storage, k_typedef)) {
need = 0;
@ -861,8 +861,8 @@ int Swig_need_name_warning(Node *n) {
static int nodes_are_equivalent(Node *a, Node *b, int a_inclass) {
/* they must have the same type */
String *ta = Getattr(a, k_nodetype);
String *tb = Getattr(b, k_nodetype);
String *ta = nodeType(a);
String *tb = nodeType(b);
if (Cmp(ta, tb) != 0)
return 0;
@ -973,7 +973,7 @@ int Swig_need_redefined_warn(Node *a, Node *b, int InClass) {
int Swig_need_protected(Node *n) {
/* First, 'n' looks like a function */
/* if (!Swig_director_mode()) return 0; */
String *nodetype = Getattr(n, k_nodetype);
String *nodetype = nodeType(n);
if ((Equal(nodetype, k_cdecl)) && SwigType_isfunction(Getattr(n, k_decl))) {
String *storage = Getattr(n, k_storage);
/* and the function is declared like virtual, or it has no
@ -1010,7 +1010,7 @@ static List *Swig_make_attrlist(const char *ckey) {
Append(list, nattr);
Delete(nattr);
} else {
Append(list, k_nodetype);
Append(list, "nodeType");
}
return list;
}
@ -1047,12 +1047,12 @@ static void Swig_name_object_attach_keys(const char *keys[], Hash *nameobj) {
Delete(attrlist);
Append(matchlist, mi);
Delete(mi);
deleteNode(kw);
removeNode(kw);
} else {
for (rkey = keys; *rkey != 0; ++rkey) {
if (strcmp(ckey, *rkey) == 0) {
Setattr(nameobj, *rkey, Getattr(kw, k_value));
deleteNode(kw);
removeNode(kw);
}
}
}
@ -1179,7 +1179,7 @@ int Swig_name_match_value(String *mvalue, String *value) {
int Swig_name_match_nameobj(Hash *rn, Node *n) {
int match = 1;
List *matchlist = HashGetAttr(rn, k_matchlist);
List *matchlist = Getattr(rn, k_matchlist);
#ifdef SWIG_DEBUG
Printf(stderr, "Swig_name_match_nameobj: %s\n", Getattr(n, "name"));
#endif
@ -1232,13 +1232,13 @@ 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 = HashGetAttr(rn, k_decl);
String *rdecl = Getattr(rn, k_decl);
if (rdecl && (!decl || !Equal(rdecl, decl))) {
continue;
} else if (Swig_name_match_nameobj(rn, n)) {
String *tname = HashGetAttr(rn, k_targetname);
String *tname = Getattr(rn, k_targetname);
if (tname) {
String *sfmt = HashGetAttr(rn, k_sourcefmt);
String *sfmt = Getattr(rn, k_sourcefmt);
String *sname = 0;
int fullname = GetFlag(rn, k_fullname);
int rxstarget = GetFlag(rn, k_rxstarget);
@ -1316,11 +1316,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 && HashGetAttr(wrn, k_error)) {
if (wrn && Getattr(wrn, k_error)) {
if (n) {
Swig_error(Getfile(n), Getline(n), "%s\n", HashGetAttr(wrn, k_name));
Swig_error(Getfile(n), Getline(n), "%s\n", Getattr(wrn, k_name));
} else {
Swig_error(cparse_file, cparse_line, "%s\n", HashGetAttr(wrn, k_name));
Swig_error(cparse_file, cparse_line, "%s\n", Getattr(wrn, k_name));
}
}
return wrn;
@ -1338,7 +1338,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) ? HashGetAttr(wrn, k_name) : 0;
return (name && wrn) ? Getattr(wrn, k_name) : 0;
}
/* -----------------------------------------------------------------------------
@ -1442,7 +1442,7 @@ String *Swig_name_make(Node *n, String *prefix, String_or_char *cname, SwigType
#endif
if (name && n && SwigType_istemplate(name)) {
String *nodetype = Getattr(n, k_nodetype);
String *nodetype = nodeType(n);
if (nodetype && (Equal(nodetype, k_constructor) || Equal(nodetype, k_destructor))) {
String *nprefix = NewStringEmpty();
String *nlast = NewStringEmpty();
@ -1476,7 +1476,7 @@ String *Swig_name_make(Node *n, String *prefix, String_or_char *cname, SwigType
if (!rn || !Swig_name_match_nameobj(rn, n)) {
rn = Swig_name_nameobj_lget(Swig_name_rename_list(), n, prefix, name, decl);
if (rn) {
String *sfmt = HashGetAttr(rn, k_sourcefmt);
String *sfmt = Getattr(rn, k_sourcefmt);
int fullname = GetFlag(rn, k_fullname);
if (fullname && prefix) {
String *sname = NewStringf("%s::%s", prefix, name);
@ -1492,7 +1492,7 @@ String *Swig_name_make(Node *n, String *prefix, String_or_char *cname, SwigType
}
}
if (rn) {
String *newname = HashGetAttr(rn, k_name);
String *newname = Getattr(rn, k_name);
int fullname = GetFlag(rn, k_fullname);
result = apply_rename(newname, fullname, prefix, name);
}
@ -1512,9 +1512,9 @@ 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 = HashGetAttr(wrn, k_rename);
String *rename = Getattr(wrn, k_rename);
if (rename) {
String *msg = HashGetAttr(wrn, k_name);
String *msg = Getattr(wrn, k_name);
int fullname = GetFlag(wrn, k_fullname);
if (result)
Delete(result);

View file

@ -20,7 +20,7 @@ char cvsroot_parms_c[] = "$Id$";
Parm *NewParm(SwigType *type, const String_or_char *name) {
Parm *p = NewHash();
Setattr(p, k_nodetype, k_parm);
set_nodeType(p, "parm");
if (type) {
SwigType *ntype = Copy(type);
Setattr(p, k_type, ntype);
@ -52,15 +52,15 @@ Parm *NewParmFromNode(SwigType *type, const String_or_char *name, Node *n) {
Parm *CopyParm(Parm *p) {
Parm *np = NewHash();
SwigType *t = HashGetAttr(p, k_type);
String *name = HashGetAttr(p, k_name);
String *lname = HashGetAttr(p, k_lname);
String *value = HashGetAttr(p, k_value);
String *ignore = HashGetAttr(p, k_ignore);
String *alttype = HashGetAttr(p, k_alttype);
String *byname = HashGetAttr(p, k_argbyname);
String *compactdefargs = HashGetAttr(p, k_compactdefargs);
String *self = HashGetAttr(p, k_self);
SwigType *t = Getattr(p, k_type);
String *name = Getattr(p, k_name);
String *lname = Getattr(p, k_lname);
String *value = Getattr(p, k_value);
String *ignore = Getattr(p, k_ignore);
String *alttype = Getattr(p, k_alttype);
String *byname = Getattr(p, k_argbyname);
String *compactdefargs = Getattr(p, k_compactdefargs);
String *self = Getattr(p, k_self);
if (t) {
SwigType *nt = Copy(t);
@ -147,7 +147,7 @@ ParmList *CopyParmList(ParmList *p) {
int ParmList_numarg(ParmList *p) {
int n = 0;
while (p) {
if (!HashGetAttr(p, k_ignore))
if (!Getattr(p, k_ignore))
n++;
p = nextSibling(p);
}
@ -161,8 +161,8 @@ int ParmList_numarg(ParmList *p) {
int ParmList_numrequired(ParmList *p) {
int i = 0;
while (p) {
SwigType *t = HashGetAttr(p, k_type);
String *value = HashGetAttr(p, k_value);
SwigType *t = Getattr(p, k_type);
String *value = Getattr(p, k_value);
if (value)
return i;
if (!(SwigType_type(t) == T_VOID))
@ -196,7 +196,7 @@ int ParmList_len(ParmList *p) {
String *ParmList_str(ParmList *p) {
String *out = NewStringEmpty();
while (p) {
String *pstr = SwigType_str(HashGetAttr(p, k_type), HashGetAttr(p, k_name));
String *pstr = SwigType_str(Getattr(p, k_type), Getattr(p, k_name));
StringAppend(out, pstr);
p = nextSibling(p);
if (p) {
@ -216,8 +216,8 @@ String *ParmList_str(ParmList *p) {
String *ParmList_str_defaultargs(ParmList *p) {
String *out = NewStringEmpty();
while (p) {
String *value = HashGetAttr(p, k_value);
String *pstr = SwigType_str(HashGetAttr(p, k_type), HashGetAttr(p, k_name));
String *value = Getattr(p, k_value);
String *pstr = SwigType_str(Getattr(p, k_type), Getattr(p, k_name));
StringAppend(out, pstr);
if (value) {
Printf(out, "=%s", value);
@ -240,10 +240,10 @@ String *ParmList_str_defaultargs(ParmList *p) {
String *ParmList_protostr(ParmList *p) {
String *out = NewStringEmpty();
while (p) {
if (HashGetAttr(p, k_hidden)) {
if (Getattr(p, k_hidden)) {
p = nextSibling(p);
} else {
String *pstr = SwigType_str(HashGetAttr(p, k_type), 0);
String *pstr = SwigType_str(Getattr(p, k_type), 0);
StringAppend(out, pstr);
p = nextSibling(p);
if (p) {
@ -266,14 +266,14 @@ int ParmList_is_compactdefargs(ParmList *p) {
int compactdefargs = 0;
if (p) {
compactdefargs = HashGetAttr(p, k_compactdefargs) ? 1 : 0;
compactdefargs = Getattr(p, k_compactdefargs) ? 1 : 0;
/* The "compactdefargs" attribute should only be set on the first parameter in the list.
* However, sometimes an extra parameter is inserted at the beginning of the parameter list,
* so we check the 2nd parameter too. */
if (!compactdefargs) {
Parm *nextparm = nextSibling(p);
compactdefargs = (nextparm && HashGetAttr(nextparm, k_compactdefargs)) ? 1 : 0;
compactdefargs = (nextparm && Getattr(nextparm, k_compactdefargs)) ? 1 : 0;
}
}
@ -291,7 +291,7 @@ int ParmList_is_compactdefargs(ParmList *p) {
int ParmList_has_defaultargs(ParmList *p) {
int default_args = 0;
while (p) {
if (HashGetAttr(p, k_value)) {
if (Getattr(p, k_value)) {
default_args = 1;
break;
}

View file

@ -99,11 +99,7 @@ extern "C" {
/* --- Command line parsing --- */
extern void Swig_init_args(int argc, char **argv);
extern void Swig_mark_arg(int n);
extern int Swig_check_marked(int n);
extern void Swig_check_options(int check_input);
extern void Swig_arg_error();
#include "swigopt.h"
/* --- Scanner Interface --- */
@ -318,42 +314,8 @@ extern "C" {
/* --- Parse tree support --- */
/* DOM-like node access */
#include "swigkeys.h"
#define nodeType(x) Getattr(x,k_nodetype)
#define parentNode(x) Getattr(x,k_parentnode)
#define previousSibling(x) Getattr(x,k_previoussibling)
#define nextSibling(x) Getattr(x,k_nextsibling)
#define firstChild(x) Getattr(x,k_firstchild)
#define lastChild(x) Getattr(x,k_lastchild)
extern int checkAttribute(Node *obj, const String_or_char *name, const String_or_char *value);
/* Macros to set up the DOM tree (mostly used by the parser) */
#define set_nodeType(x,v) Setattr(x,"nodeType",v)
#define set_parentNode(x,v) Setattr(x,"parentNode",v)
#define set_previousSibling(x,v) Setattr(x,"previousSibling",v)
#define set_nextSibling(x,v) Setattr(x,"nextSibling",v)
#define set_firstChild(x,v) Setattr(x,"firstChild",v)
#define set_lastChild(x,v) Setattr(x,"lastChild",v)
extern void appendChild(Node *node, Node *child);
extern void preppendChild(Node *node, Node *child);
extern void deleteNode(Node *node);
extern Node *copyNode(Node *node);
extern void Swig_tag_nodes(Node *node, const String_or_char *attrname, DOH *value);
extern int Swig_require(const char *ns, Node *node, ...);
extern int Swig_save(const char *ns, Node *node, ...);
extern void Swig_restore(Node *node);
/* Debugging of parse trees */
extern void Swig_print_tags(File *obj, Node *root);
extern void Swig_print_tree(Node *obj);
extern void Swig_print_node(Node *obj);
extern void Swig_print_xml(Node *obj, String *filename);
#include "swigkeys.h" /* This file is likely going to go away */
#include "swigtree.h"
/* -- Wrapper function Object */

View file

@ -10,7 +10,6 @@ char cvsroot_keys_c[] = "$Id$";
#include "swigkeys.h"
String *empty_string = 0;
String *k_1 = 0;
String *k_SWIGTYPE = 0;
String *k_abstract = 0;
String *k_access = 0;
@ -66,10 +65,8 @@ String *k_matchlist = 0;
String *k_member = 0;
String *k_name = 0;
String *k_namespace = 0;
String *k_nodetype = 0;
String *k_notmatch = 0;
String *k_parent = 0;
String *k_parentnode = 0;
String *k_parm = 0;
String *k_parms = 0;
String *k_partialarg = 0;
@ -121,7 +118,6 @@ String *k_uname = 0;
String *k_unnamed = 0;
String *k_using = 0;
String *k_value = 0;
String *k_view = 0;
String *k_virtual = 0;
String *k_vtable = 0;
String *k_wrapaction = 0;
@ -130,14 +126,8 @@ String *k_wrapdirectormap = 0;
String *k_wrapdisown = 0;
String *k_wrapper = 0;
String *k_previoussibling = 0;
String *k_nextsibling = 0;
String *k_firstchild = 0;
String *k_lastchild = 0;
void Swig_keys_init() {
empty_string = NewString("");
k_1 = NewString("1");
k_SWIGTYPE = NewString("SWIGTYPE");
k_abstract = NewString("abstract");
k_access = NewString("access");
@ -192,10 +182,8 @@ void Swig_keys_init() {
k_member = NewString("member");
k_name = NewString("name");
k_namespace = NewString("namespace");
k_nodetype = NewString("nodeType");
k_notmatch = NewString("notmatch");
k_parent = NewString("parent");
k_parentnode = NewString("parentNode");
k_parm = NewString("parm");
k_parms = NewString("parms");
k_partialarg = NewString("partialarg");
@ -247,7 +235,6 @@ void Swig_keys_init() {
k_unnamed = NewString("unnamed");
k_using = NewString("using");
k_value = NewString("value");
k_view = NewString("view");
k_virtual = NewString("virtual");
k_vtable = NewString("vtable");
k_wrapaction = NewString("wrap:action");
@ -255,10 +242,4 @@ void Swig_keys_init() {
k_wrapdirectormap = NewString("wrap:directormap");
k_wrapdisown = NewString("wrap:disown");
k_wrapper = NewString("wrapper");
k_previoussibling = NewString("previousSibling");
k_nextsibling = NewString("nextSibling");
k_firstchild = NewString("firstChild");
k_lastchild = NewString("lastChild");
}

View file

@ -15,7 +15,6 @@
extern void Swig_keys_init();
extern String *empty_string;
extern String *k_1;
extern String *k_SWIGTYPE;
extern String *k_abstract;
extern String *k_access;
@ -71,10 +70,8 @@ extern String *k_matchlist;
extern String *k_member;
extern String *k_name;
extern String *k_namespace;
extern String *k_nodetype;
extern String *k_notmatch;
extern String *k_parent;
extern String *k_parentnode;
extern String *k_parm;
extern String *k_parms;
extern String *k_partialarg;
@ -127,16 +124,10 @@ extern String *k_unnamed;
extern String *k_using;
extern String *k_value;
extern String *k_virtual;
extern String *k_view;
extern String *k_vtable;
extern String *k_wrapaction;
extern String *k_wrapcode;
extern String *k_wrapdirectormap;
extern String *k_wrapdisown;
extern String *k_wrapper;
extern String *k_previoussibling;
extern String *k_nextsibling;
extern String *k_firstchild;
extern String *k_lastchild;
#endif /* SWIG_SWIGKEYS_H_ */

16
Source/Swig/swigopt.h Normal file
View file

@ -0,0 +1,16 @@
/* -----------------------------------------------------------------------------
* 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.
*
* swigopt.h
*
* Header file for the SWIG command line processing functions
* ----------------------------------------------------------------------------- */
/* $Id: swig.h 9622 2006-12-19 03:49:17Z beazley $ */
extern void Swig_init_args(int argc, char **argv);
extern void Swig_mark_arg(int n);
extern int Swig_check_marked(int n);
extern void Swig_check_options(int check_input);
extern void Swig_arg_error();

50
Source/Swig/swigtree.h Normal file
View file

@ -0,0 +1,50 @@
/* -----------------------------------------------------------------------------
* 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.
*
* swigtree.h
*
* These functions are used to access and manipulate the SWIG parse tree.
* The structure of this tree is modeled directly after XML-DOM. The attribute
* and function names are meant to be similar.
* ----------------------------------------------------------------------------- */
/* $Id: swig.h 9622 2006-12-19 03:49:17Z beazley $ */
/* Macros to traverse the DOM tree */
#define nodeType(x) Getattr(x,"nodeType")
#define parentNode(x) Getattr(x,"parentNode")
#define previousSibling(x) Getattr(x,"previousSibling")
#define nextSibling(x) Getattr(x,"nextSibling")
#define firstChild(x) Getattr(x,"firstChild")
#define lastChild(x) Getattr(x,"lastChild")
/* Macros to set up the DOM tree (mostly used by the parser) */
#define set_nodeType(x,v) Setattr(x,"nodeType",v)
#define set_parentNode(x,v) Setattr(x,"parentNode",v)
#define set_previousSibling(x,v) Setattr(x,"previousSibling",v)
#define set_nextSibling(x,v) Setattr(x,"nextSibling",v)
#define set_firstChild(x,v) Setattr(x,"firstChild",v)
#define set_lastChild(x,v) Setattr(x,"lastChild",v)
/* Utility functions */
extern int checkAttribute(Node *obj, const String_or_char *name, const String_or_char *value);
extern void appendChild(Node *node, Node *child);
extern void prependChild(Node *node, Node *child);
extern void removeNode(Node *node);
extern Node *copyNode(Node *node);
/* Node restoration/restore functions */
extern void Swig_require(const char *ns, Node *node, ...);
extern void Swig_save(const char *ns, Node *node, ...);
extern void Swig_restore(Node *node);
/* Debugging of parse trees */
extern void Swig_print_tags(File *obj, Node *root);
extern void Swig_print_tree(Node *obj);
extern void Swig_print_node(Node *obj);

View file

@ -242,7 +242,7 @@ void Swig_symbol_setscopename(const String_or_char *name) {
* ----------------------------------------------------------------------------- */
String *Swig_symbol_getscopename() {
return HashGetAttr(current_symtab, k_name);
return Getattr(current_symtab, k_name);
}
/* -----------------------------------------------------------------------------
@ -272,11 +272,11 @@ String *Swig_symbol_qualifiedscopename(Symtab *symtab) {
String *name;
if (!symtab)
symtab = current_symtab;
parent = HashGetAttr(symtab, k_parentnode);
parent = Getattr(symtab, "parentNode");
if (parent) {
result = Swig_symbol_qualifiedscopename(parent);
}
name = HashGetAttr(symtab, k_name);
name = Getattr(symtab, k_name);
if (name) {
if (!result) {
result = NewStringEmpty();
@ -333,9 +333,9 @@ Symtab *Swig_symbol_newscope() {
Symtab *Swig_symbol_setscope(Symtab *sym) {
Symtab *ret = current_symtab;
current_symtab = sym;
current = HashGetAttr(sym, k_symtab);
current = Getattr(sym, k_symtab);
assert(current);
ccurrent = HashGetAttr(sym, k_csymtab);
ccurrent = Getattr(sym, k_csymtab);
assert(ccurrent);
return ret;
}
@ -349,11 +349,11 @@ Symtab *Swig_symbol_setscope(Symtab *sym) {
Symtab *Swig_symbol_popscope() {
Hash *h = current_symtab;
current_symtab = HashGetAttr(current_symtab, k_parentnode);
current_symtab = Getattr(current_symtab, "parentNode");
assert(current_symtab);
current = HashGetAttr(current_symtab, k_symtab);
current = Getattr(current_symtab, k_symtab);
assert(current);
ccurrent = HashGetAttr(current_symtab, k_csymtab);
ccurrent = Getattr(current_symtab, k_csymtab);
assert(ccurrent);
return h;
}
@ -381,7 +381,7 @@ void Swig_symbol_alias(String_or_char *aliasname, Symtab *s) {
} else {
qname = NewString(aliasname);
}
if (!HashGetAttr(symtabs, qname)) {
if (!Getattr(symtabs, qname)) {
Setattr(symtabs, qname, s);
}
Delete(qname);
@ -395,7 +395,7 @@ void Swig_symbol_alias(String_or_char *aliasname, Symtab *s) {
void Swig_symbol_inherit(Symtab *s) {
int i, ilen;
List *inherit = HashGetAttr(current_symtab, k_inherit);
List *inherit = Getattr(current_symtab, k_inherit);
if (!inherit) {
inherit = NewList();
Setattr(current_symtab, k_inherit, inherit);
@ -403,7 +403,7 @@ void Swig_symbol_inherit(Symtab *s) {
}
if (s == current_symtab) {
Swig_warning(WARN_PARSE_REC_INHERITANCE, Getfile(s), Getline(s), "Recursive scope inheritance of '%s'.\n", HashGetAttr(s, k_name));
Swig_warning(WARN_PARSE_REC_INHERITANCE, Getfile(s), Getline(s), "Recursive scope inheritance of '%s'.\n", Getattr(s, k_name));
return;
}
assert(s != current_symtab);
@ -458,13 +458,13 @@ void Swig_symbol_cadd(String_or_char *name, Node *n) {
#endif
cn = Getattr(ccurrent, name);
if (cn && (HashGetAttr(cn, k_symtypename))) {
if (cn && (Getattr(cn, k_symtypename))) {
/* 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 && (HashGetAttr(cn, k_symweak))) {
} else if (cn && (Getattr(cn, k_symweak))) {
/* The node in the symbol table is weak. Replace it */
if (checkAttribute(cn, k_nodetype, k_template)
if (checkAttribute(cn, "nodeType", k_template)
&& checkAttribute(cn, k_templatetype, k_classforward)) {
/* The node is a template classforward declaration, and the
default template parameters here take precedence. */
@ -488,13 +488,13 @@ void Swig_symbol_cadd(String_or_char *name, Node *n) {
}
Setattr(ccurrent, name, n);
} else if (cn && (HashGetAttr(n, k_symweak))) {
} else if (cn && (Getattr(n, k_symweak))) {
/* The node being added is weak. Don't worry about it */
} else if (cn && (HashGetAttr(n, k_symtypename))) {
} else if (cn && (Getattr(n, k_symtypename))) {
/* The node being added is a typename. We definitely add it */
Setattr(ccurrent, name, n);
append = cn;
} else if (cn && (HashCheckAttr(cn, k_nodetype, k_templateparm))) {
} else if (cn && (Checkattr(cn, "nodeType", k_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,7 +516,7 @@ void Swig_symbol_cadd(String_or_char *name, Node *n) {
/* already added. Bail */
return;
}
fn = HashGetAttr(fn, k_csymnextSibling);
fn = Getattr(fn, k_csymnextSibling);
}
if (pn) {
Setattr(pn, k_csymnextSibling, append);
@ -536,11 +536,11 @@ void Swig_symbol_cadd(String_or_char *name, Node *n) {
{
Node *td = n;
while (td && HashCheckAttr(td, k_nodetype, k_cdecl) && HashCheckAttr(td, k_storage, k_typedef)) {
while (td && Checkattr(td, "nodeType", k_cdecl) && Checkattr(td, k_storage, k_typedef)) {
SwigType *type;
Node *td1;
type = Copy(HashGetAttr(td, k_type));
SwigType_push(type, HashGetAttr(td, k_decl));
type = Copy(Getattr(td, k_type));
SwigType_push(type, Getattr(td, k_decl));
td1 = Swig_symbol_clookup(type, 0);
/* Fix pathetic case #1214313:
@ -560,11 +560,11 @@ void Swig_symbol_cadd(String_or_char *name, Node *n) {
ie, when Foo -> FooBar -> Foo, jump one scope up when possible.
*/
if (td1 && HashCheckAttr(td1, k_storage, k_typedef)) {
String *st = HashGetAttr(td1, k_type);
String *sn = HashGetAttr(td, k_name);
if (td1 && Checkattr(td1, k_storage, k_typedef)) {
String *st = Getattr(td1, k_type);
String *sn = Getattr(td, k_name);
if (st && sn && StringEqual(st, sn)) {
Symtab *sc = HashGetAttr(current_symtab, k_parentnode);
Symtab *sc = Getattr(current_symtab, "parentNode");
if (sc)
td1 = Swig_symbol_clookup(type, sc);
}
@ -575,9 +575,9 @@ void Swig_symbol_cadd(String_or_char *name, Node *n) {
break;
td = td1;
if (td) {
Symtab *st = HashGetAttr(td, k_symtab);
Symtab *st = Getattr(td, k_symtab);
if (st) {
Swig_symbol_alias(HashGetAttr(n, k_name), st);
Swig_symbol_alias(Getattr(n, k_name), st);
break;
}
}
@ -627,7 +627,7 @@ 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 = HashGetAttr(n, k_name);
name = Getattr(n, k_name);
if (name && Len(name)) {
Swig_symbol_cadd(name, n);
}
@ -654,7 +654,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 && HashGetAttr(c, k_symweak)) {
if (c && Getattr(c, k_symweak)) {
c = 0;
}
if (c) {
@ -669,13 +669,13 @@ Node *Swig_symbol_add(String_or_char *symname, Node *n) {
*/
/* Check for namespaces */
String *ntype = HashGetAttr(n, k_nodetype);
if ((StringEqual(ntype, HashGetAttr(c, k_nodetype))) && ((StringEqual(ntype, k_namespace)))) {
String *ntype = Getattr(n, "nodeType");
if ((StringEqual(ntype, Getattr(c, "nodeType"))) && ((StringEqual(ntype, k_namespace)))) {
Node *cl, *pcl = 0;
cl = c;
while (cl) {
pcl = cl;
cl = HashGetAttr(cl, k_symnextSibling);
cl = Getattr(cl, k_symnextSibling);
}
Setattr(pcl, k_symnextSibling, n);
Setattr(n, k_symsymtab, current_symtab);
@ -683,9 +683,9 @@ Node *Swig_symbol_add(String_or_char *symname, Node *n) {
Setattr(n, k_sympreviousSibling, pcl);
return n;
}
if (HashGetAttr(n, k_allowstypedef))
if (Getattr(n, k_allowstypedef))
nt = 1;
if (HashGetAttr(c, k_allowstypedef))
if (Getattr(c, k_allowstypedef))
ct = 1;
if (nt || ct) {
Node *td, *other;
@ -705,7 +705,7 @@ Node *Swig_symbol_add(String_or_char *symname, Node *n) {
other = n;
}
/* Make sure the other node is a typedef */
s = HashGetAttr(other, k_storage);
s = Getattr(other, k_storage);
if (!s || (!StringEqual(s, k_typedef)))
return c; /* No. This is a conflict */
@ -719,17 +719,17 @@ Node *Swig_symbol_add(String_or_char *symname, Node *n) {
return n;
}
decl = HashGetAttr(c, k_decl);
ndecl = HashGetAttr(n, k_decl);
decl = Getattr(c, k_decl);
ndecl = Getattr(n, k_decl);
{
String *nt1, *nt2;
nt1 = HashGetAttr(n, k_nodetype);
nt1 = Getattr(n, "nodeType");
if (StringEqual(nt1, k_template))
nt1 = HashGetAttr(n, k_templatetype);
nt2 = HashGetAttr(c, k_nodetype);
nt1 = Getattr(n, k_templatetype);
nt2 = Getattr(c, "nodeType");
if (StringEqual(nt2, k_template))
nt2 = HashGetAttr(c, k_templatetype);
nt2 = Getattr(c, k_templatetype);
if (StringEqual(nt1, k_using))
u1 = 1;
if (StringEqual(nt2, k_using))
@ -747,8 +747,8 @@ 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 = HashGetAttr(c, k_storage);
nstorage = HashGetAttr(n, k_storage);
cstorage = Getattr(c, k_storage);
nstorage = Getattr(n, k_storage);
/* If either one is declared as typedef, forget it. We're hosed */
if (Cmp(cstorage, k_typedef) == 0) {
@ -760,20 +760,20 @@ Node *Swig_symbol_add(String_or_char *symname, Node *n) {
/* Okay. Walk down the list of symbols and see if we get a declarator match */
{
String *nt = HashGetAttr(n, k_nodetype);
int n_template = StringEqual(nt, k_template) && HashCheckAttr(n, k_templatetype, k_cdecl);
String *nt = Getattr(n, "nodeType");
int n_template = StringEqual(nt, k_template) && Checkattr(n, k_templatetype, k_cdecl);
int n_plain_cdecl = StringEqual(nt, k_cdecl);
cn = c;
pn = 0;
while (cn) {
decl = HashGetAttr(cn, k_decl);
decl = Getattr(cn, k_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<typename> void foo(); */
String *cnt = HashGetAttr(cn, k_nodetype);
int cn_template = StringEqual(cnt, k_template) && HashCheckAttr(cn, k_templatetype, k_cdecl);
String *cnt = Getattr(cn, "nodeType");
int cn_template = StringEqual(cnt, k_template) && Checkattr(cn, k_templatetype, k_cdecl);
int cn_plain_cdecl = StringEqual(cnt, k_cdecl);
if (!((n_template && cn_plain_cdecl) || (cn_template && n_plain_cdecl))) {
/* found a conflict */
@ -782,7 +782,7 @@ Node *Swig_symbol_add(String_or_char *symname, Node *n) {
}
}
cl = cn;
cn = HashGetAttr(cn, k_symnextSibling);
cn = Getattr(cn, k_symnextSibling);
pn++;
}
}
@ -790,7 +790,7 @@ Node *Swig_symbol_add(String_or_char *symname, Node *n) {
Setattr(n, k_symsymtab, current_symtab);
Setattr(n, k_symname, symname);
/* Printf(stdout,"%s %x\n", Getattr(n,k_symovername), current_symtab); */
assert(!HashGetAttr(n, k_symovername));
assert(!Getattr(n, k_symovername));
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)); */
@ -831,16 +831,16 @@ 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 = HashGetAttr(symtab, k_csymtab);
Hash *sym = Getattr(symtab, k_csymtab);
if (Getmark(symtab))
return 0;
Setmark(symtab, 1);
n = HashGetAttr(sym, name);
n = Getattr(sym, name);
#ifdef SWIG_DEBUG
Printf(stderr, "symbol_look %s %x %x %s\n", name, n, symtab, HashGetAttr(symtab, k_name));
Printf(stderr, "symbol_look %s %x %x %s\n", name, n, symtab, Getattr(symtab, k_name));
#endif
if (n) {
@ -874,7 +874,7 @@ static Node *_symbol_lookup(String *name, Symtab *symtab, int (*check) (Node *n)
return n;
}
inherit = HashGetAttr(symtab, k_inherit);
inherit = Getattr(symtab, k_inherit);
if (inherit) {
int i, len;
len = Len(inherit);
@ -941,7 +941,7 @@ static Node *symbol_lookup_qualified(String_or_char *name, Symtab *symtab, Strin
} else {
qname = prefix;
}
st = HashGetAttr(symtabs, qname);
st = Getattr(symtabs, qname);
/* Found a scope match */
if (st) {
if (!name) {
@ -956,7 +956,7 @@ static Node *symbol_lookup_qualified(String_or_char *name, Symtab *symtab, Strin
if (!n) {
if (!local) {
Node *pn = HashGetAttr(symtab, k_parentnode);
Node *pn = Getattr(symtab, "parentNode");
if (pn)
n = symbol_lookup_qualified(name, pn, prefix, local, checkfunc);
} else {
@ -986,8 +986,8 @@ Node *Swig_symbol_clookup(String_or_char *name, Symtab *n) {
if (!n) {
hsym = current_symtab;
} else {
if (!HashCheckAttr(n, k_nodetype, k_symboltable)) {
n = HashGetAttr(n, k_symsymtab);
if (!Checkattr(n, "nodeType", k_symboltable)) {
n = Getattr(n, k_symsymtab);
}
assert(n);
if (n) {
@ -1019,7 +1019,7 @@ Node *Swig_symbol_clookup(String_or_char *name, Symtab *n) {
s = symbol_lookup(name, hsym, 0);
if (s)
break;
hsym = HashGetAttr(hsym, k_parentnode);
hsym = Getattr(hsym, "parentNode");
if (!hsym)
break;
}
@ -1029,12 +1029,12 @@ Node *Swig_symbol_clookup(String_or_char *name, Symtab *n) {
return 0;
}
/* Check if s is a 'using' node */
while (s && HashCheckAttr(s, k_nodetype, k_using)) {
String *uname = HashGetAttr(s, k_uname);
Symtab *un = HashGetAttr(s, k_symsymtab);
while (s && Checkattr(s, "nodeType", k_using)) {
String *uname = Getattr(s, k_uname);
Symtab *un = Getattr(s, k_symsymtab);
Node *ss = (!StringEqual(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", HashGetAttr(s, k_uname));
Swig_warning(WARN_PARSE_USING_UNDEF, Getfile(s), Getline(s), "Nothing known about '%s'.\n", Getattr(s, k_uname));
}
s = ss;
}
@ -1058,8 +1058,8 @@ Node *Swig_symbol_clookup_check(String_or_char *name, Symtab *n, int (*checkfunc
if (!n) {
hsym = current_symtab;
} else {
if (!HashCheckAttr(n, k_nodetype, k_symboltable)) {
n = HashGetAttr(n, k_symsymtab);
if (!Checkattr(n, "nodeType", k_symboltable)) {
n = Getattr(n, k_symsymtab);
}
assert(n);
if (n) {
@ -1091,7 +1091,7 @@ Node *Swig_symbol_clookup_check(String_or_char *name, Symtab *n, int (*checkfunc
s = symbol_lookup(name, hsym, checkfunc);
if (s)
break;
hsym = HashGetAttr(hsym, k_parentnode);
hsym = Getattr(hsym, "parentNode");
if (!hsym)
break;
}
@ -1100,11 +1100,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 && HashCheckAttr(s, k_nodetype, k_using)) {
while (s && Checkattr(s, "nodeType", k_using)) {
Node *ss;
ss = Swig_symbol_clookup(HashGetAttr(s, k_uname), HashGetAttr(s, k_symsymtab));
ss = Swig_symbol_clookup(Getattr(s, k_uname), Getattr(s, k_symsymtab));
if (!ss && !checkfunc) {
Swig_warning(WARN_PARSE_USING_UNDEF, Getfile(s), Getline(s), "Nothing known about '%s'.\n", HashGetAttr(s, k_uname));
Swig_warning(WARN_PARSE_USING_UNDEF, Getfile(s), Getline(s), "Nothing known about '%s'.\n", Getattr(s, k_uname));
}
s = ss;
}
@ -1123,12 +1123,12 @@ Node *Swig_symbol_clookup_local(String_or_char *name, Symtab *n) {
hsym = current_symtab;
h = ccurrent;
} else {
if (!HashCheckAttr(n, k_nodetype, k_symboltable)) {
n = HashGetAttr(n, k_symsymtab);
if (!Checkattr(n, "nodeType", k_symboltable)) {
n = Getattr(n, k_symsymtab);
}
assert(n);
hsym = n;
h = HashGetAttr(n, k_csymtab);
h = Getattr(n, k_csymtab);
}
if (Swig_scopename_check(name)) {
@ -1149,10 +1149,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 && HashCheckAttr(s, k_nodetype, k_using)) {
Node *ss = Swig_symbol_clookup_local(HashGetAttr(s, k_uname), HashGetAttr(s, k_symsymtab));
while (s && Checkattr(s, "nodeType", k_using)) {
Node *ss = Swig_symbol_clookup_local(Getattr(s, k_uname), Getattr(s, k_symsymtab));
if (!ss) {
Swig_warning(WARN_PARSE_USING_UNDEF, Getfile(s), Getline(s), "Nothing known about '%s'.\n", HashGetAttr(s, k_uname));
Swig_warning(WARN_PARSE_USING_UNDEF, Getfile(s), Getline(s), "Nothing known about '%s'.\n", Getattr(s, k_uname));
}
s = ss;
}
@ -1171,12 +1171,12 @@ Node *Swig_symbol_clookup_local_check(String_or_char *name, Symtab *n, int (*che
hsym = current_symtab;
h = ccurrent;
} else {
if (!HashCheckAttr(n, k_nodetype, k_symboltable)) {
n = HashGetAttr(n, k_symsymtab);
if (!Checkattr(n, "nodeType", k_symboltable)) {
n = Getattr(n, k_symsymtab);
}
assert(n);
hsym = n;
h = HashGetAttr(n, k_csymtab);
h = Getattr(n, k_csymtab);
}
if (Swig_scopename_check(name)) {
@ -1197,10 +1197,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 && HashCheckAttr(s, k_nodetype, k_using)) {
Node *ss = Swig_symbol_clookup_local_check(HashGetAttr(s, k_uname), HashGetAttr(s, k_symsymtab), checkfunc);
while (s && Checkattr(s, "nodeType", k_using)) {
Node *ss = Swig_symbol_clookup_local_check(Getattr(s, k_uname), Getattr(s, k_symsymtab), checkfunc);
if (!ss && !checkfunc) {
Swig_warning(WARN_PARSE_USING_UNDEF, Getfile(s), Getline(s), "Nothing known about '%s'.\n", HashGetAttr(s, k_uname));
Swig_warning(WARN_PARSE_USING_UNDEF, Getfile(s), Getline(s), "Nothing known about '%s'.\n", Getattr(s, k_uname));
}
s = ss;
}
@ -1236,11 +1236,11 @@ void Swig_symbol_remove(Node *n) {
Node *symprev;
Node *symnext;
Node *fixovername = 0;
symtab = HashGetAttr(n, k_symsymtab); /* Get symbol table object */
symtab = HashGetAttr(symtab, k_symtab); /* Get actual hash table of symbols */
symname = HashGetAttr(n, k_symname);
symprev = HashGetAttr(n, k_sympreviousSibling);
symnext = HashGetAttr(n, k_symnextSibling);
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);
/* If previous symbol, just fix the links */
if (symprev) {
@ -1283,19 +1283,19 @@ void Swig_symbol_remove(Node *n) {
/* find head of linked list */
while (nn) {
head = nn;
nn = HashGetAttr(nn, k_sympreviousSibling);
nn = Getattr(nn, k_sympreviousSibling);
}
/* adjust all the sym:overname strings to start from 0 and increment by one */
nn = head;
while (nn) {
assert(HashGetAttr(nn, k_symovername));
assert(Getattr(nn, k_symovername));
Delattr(nn, k_symovername);
overname = NewStringf("__SWIG_%d", pn);
Setattr(nn, k_symovername, overname);
Delete(overname);
pn++;
nn = HashGetAttr(nn, k_symnextSibling);
nn = Getattr(nn, k_symnextSibling);
}
}
}
@ -1308,15 +1308,15 @@ void Swig_symbol_remove(Node *n) {
String *Swig_symbol_qualified(Node *n) {
Hash *symtab;
if (HashCheckAttr(n, k_nodetype, k_symboltable)) {
if (Checkattr(n, "nodeType", k_symboltable)) {
symtab = n;
} else {
symtab = HashGetAttr(n, k_symsymtab);
symtab = Getattr(n, k_symsymtab);
}
if (!symtab)
return NewStringEmpty();
#ifdef SWIG_DEBUG
Printf(stderr, "symbol_qscope %s %x %s\n", HashGetAttr(n, k_name), symtab, HashGetAttr(symtab, k_name));
Printf(stderr, "symbol_qscope %s %x %s\n", Getattr(n, k_name), symtab, Getattr(symtab, k_name));
#endif
return Swig_symbol_qualifiedscopename(symtab);
}
@ -1328,7 +1328,7 @@ String *Swig_symbol_qualified(Node *n) {
* ----------------------------------------------------------------------------- */
Node *Swig_symbol_isoverloaded(Node *n) {
return HashGetAttr(n, k_symoverloaded);
return Getattr(n, k_symoverloaded);
}
/* -----------------------------------------------------------------------------
@ -1338,7 +1338,7 @@ Node *Swig_symbol_isoverloaded(Node *n) {
* ----------------------------------------------------------------------------- */
static int no_constructor(Node *n) {
return !HashCheckAttr(n, k_nodetype, k_constructor);
return !Checkattr(n, "nodeType", k_constructor);
}
/* This cache produce problems with OSS, don't active it */
@ -1371,7 +1371,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 ? HashGetAttr(tempn, k_symsymtab) : 0;
tscope = tempn ? Getattr(tempn, k_symsymtab) : 0;
StringAppend(qprefix, "<(");
for (ti = First(targs); ti.item;) {
String *vparm;
@ -1426,7 +1426,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 = HashGetAttr(n, k_name);
String *name = Getattr(n, k_name);
Clear(e);
StringAppend(e, name);
#ifdef SWIG_DEBUG
@ -1477,7 +1477,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 ? HashGetAttr(st, k_name) : 0);
Printf(stderr, "symbol_qualify %s %s %x %s\n", t, result, st, st ? Getattr(st, k_name) : 0);
#endif
return result;
@ -1505,7 +1505,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(HashGetAttr(n, k_name));
np = Copy(Getattr(n, k_name));
Delete(tp);
tp = np;
if (qual && StringLen(qual)) {
@ -1560,11 +1560,11 @@ SwigType *Swig_symbol_typedef_reduce(SwigType *ty, Symtab *tab) {
return Copy(ty);
}
}
nt = HashGetAttr(n, k_nodetype);
nt = Getattr(n, "nodeType");
if (StringEqual(nt, k_using)) {
String *uname = HashGetAttr(n, k_uname);
String *uname = Getattr(n, k_uname);
if (uname) {
n = Swig_symbol_clookup(base, HashGetAttr(n, k_symsymtab));
n = Swig_symbol_clookup(base, Getattr(n, k_symsymtab));
if (!n) {
Delete(base);
Delete(prefix);
@ -1576,13 +1576,13 @@ SwigType *Swig_symbol_typedef_reduce(SwigType *ty, Symtab *tab) {
}
}
if (StringEqual(nt, k_cdecl)) {
String *storage = HashGetAttr(n, k_storage);
String *storage = Getattr(n, k_storage);
if (storage && (StringEqual(storage, k_typedef))) {
SwigType *decl;
SwigType *rt;
SwigType *qt;
Symtab *ntab;
SwigType *nt = Copy(HashGetAttr(n, k_type));
SwigType *nt = Copy(Getattr(n, k_type));
/* Fix for case 'typedef struct Hello hello;' */
{
@ -1595,14 +1595,14 @@ SwigType *Swig_symbol_typedef_reduce(SwigType *ty, Symtab *tab) {
}
}
}
decl = HashGetAttr(n, k_decl);
decl = Getattr(n, k_decl);
if (decl) {
SwigType_push(nt, decl);
}
SwigType_push(nt, prefix);
Delete(base);
Delete(prefix);
ntab = HashGetAttr(n, k_symsymtab);
ntab = Getattr(n, k_symsymtab);
rt = Swig_symbol_typedef_reduce(nt, ntab);
qt = Swig_symbol_type_qualify(rt, ntab);
if (SwigType_istemplate(qt)) {
@ -1685,7 +1685,7 @@ void Swig_symbol_template_defargs(Parm *parms, Parm *targs, Symtab *tscope, Symt
lp = p;
}
while (tp) {
String *value = HashGetAttr(tp, k_value);
String *value = Getattr(tp, k_value);
if (value) {
Parm *cp;
Parm *ta = targs;
@ -1693,12 +1693,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 ? HashGetAttr(tsdecl, k_name) : tsdecl);
Printf(stderr, "value %s %s %s\n", value, nt, tsdecl ? Getattr(tsdecl, k_name) : tsdecl);
#endif
while (p && ta) {
String *name = HashGetAttr(ta, k_name);
String *pvalue = HashGetAttr(p, k_value);
String *value = pvalue ? pvalue : HashGetAttr(p, k_type);
String *name = Getattr(ta, k_name);
String *pvalue = Getattr(p, k_value);
String *value = pvalue ? pvalue : Getattr(p, k_type);
String *ttq = Swig_symbol_type_qualify(value, tscope);
/* value = SwigType_typedef_resolve_all(value); */
Replaceid(nt, name, ttq);
@ -1795,9 +1795,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 = HashGetAttr(tempn, k_templateparms);
ParmList *tnargs = Getattr(tempn, k_templateparms);
Parm *p;
Symtab *tsdecl = HashGetAttr(tempn, k_symsymtab);
Symtab *tsdecl = Getattr(tempn, k_symsymtab);
#ifdef SWIG_DEBUG
Printf(stderr, "deftype type %s %s %s\n", tprefix, targs, tsuffix);
@ -1807,8 +1807,8 @@ SwigType *Swig_symbol_template_deftype(const SwigType *type, Symtab *tscope) {
p = tparms;
tscope = tsdecl;
while (p) {
SwigType *ptype = HashGetAttr(p, k_type);
SwigType *ttr = ptype ? ptype : HashGetAttr(p, k_value);
SwigType *ptype = Getattr(p, k_type);
SwigType *ttr = ptype ? ptype : Getattr(p, k_value);
SwigType *ttf = Swig_symbol_type_qualify(ttr, tscope);
SwigType *ttq = Swig_symbol_template_param_eval(ttf, tscope);
#ifdef SWIG_DEBUG
@ -1867,13 +1867,13 @@ SwigType *Swig_symbol_template_param_eval(const SwigType *p, Symtab *symtab) {
break;
lastnode = n;
if (n) {
String *nt = HashGetAttr(n, k_nodetype);
String *nt = Getattr(n, "nodeType");
if (StringEqual(nt, k_enumitem)) {
/* An enum item. Generate a fully qualified name */
String *qn = Swig_symbol_qualified(n);
if (qn && StringLen(qn)) {
StringAppend(qn, k_coloncolon);
StringAppend(qn, HashGetAttr(n, k_name));
StringAppend(qn, Getattr(n, k_name));
Delete(value);
value = qn;
continue;
@ -1882,7 +1882,7 @@ SwigType *Swig_symbol_template_param_eval(const SwigType *p, Symtab *symtab) {
break;
}
} else if ((StringEqual(nt, k_cdecl))) {
String *nv = HashGetAttr(n, k_value);
String *nv = Getattr(n, k_value);
if (nv) {
Delete(value);
value = Copy(nv);

View file

@ -147,12 +147,12 @@ void appendChild(Node *node, Node *chd) {
}
/* -----------------------------------------------------------------------------
* preppendChild()
* prependChild()
*
* Preppends a new child to a node
* Prepends a new child to a node
* ----------------------------------------------------------------------------- */
void preppendChild(Node *node, Node *chd) {
void prependChild(Node *node, Node *chd) {
Node *fc;
if (!chd)
@ -171,17 +171,19 @@ void preppendChild(Node *node, Node *chd) {
}
/* -----------------------------------------------------------------------------
* deleteNode()
* removeNode()
*
* Deletes a node.
* Removes a node from the parse tree. Detaches it from its parent's child list.
* ----------------------------------------------------------------------------- */
void deleteNode(Node *n) {
void removeNode(Node *n) {
Node *parent;
Node *prev;
Node *next;
parent = parentNode(n);
if (!parent) return;
prev = previousSibling(n);
next = nextSibling(n);
if (prev) {
@ -198,6 +200,11 @@ void deleteNode(Node *n) {
set_lastChild(parent, prev);
}
}
/* Delete attributes */
Delattr(n,"parentNode");
Delattr(n,"nextSibling");
Delattr(n,"prevSibling");
}
/* -----------------------------------------------------------------------------
@ -219,21 +226,6 @@ Node *copyNode(Node *n) {
return c;
}
/* -----------------------------------------------------------------------------
* Swig_tag_nodes()
*
* Tags a collection of nodes with an attribute. Used by the parser to mark
* subtypes with extra information.
* ----------------------------------------------------------------------------- */
void Swig_tag_nodes(Node *n, const String_or_char *attrname, DOH *value) {
while (n) {
Setattr(n, attrname, value);
Swig_tag_nodes(firstChild(n), attrname, value);
n = nextSibling(n);
}
}
/* -----------------------------------------------------------------------------
* checkAttribute()
* ----------------------------------------------------------------------------- */
@ -257,7 +249,7 @@ int checkAttribute(Node *n, const String_or_char *name, const String_or_char *va
* This function can be called more than once with different namespaces.
* ----------------------------------------------------------------------------- */
int Swig_require(const char *ns, Node *n, ...) {
void Swig_require(const char *ns, Node *n, ...) {
va_list ap;
char *name;
DOH *obj;
@ -292,18 +284,16 @@ int Swig_require(const char *ns, Node *n, ...) {
/* Save the view */
{
String *view = Getattr(n, k_view);
String *view = Getattr(n, "view");
if (view) {
if (Strcmp(view, ns) != 0) {
Setattr(n, NewStringf("%s:view", ns), view);
Setattr(n, k_view, ns);
Setattr(n, "view", ns);
}
} else {
Setattr(n, k_view, ns);
Setattr(n, "view", ns);
}
}
return 1;
}
@ -313,7 +303,7 @@ int Swig_require(const char *ns, Node *n, ...) {
* are saved, ie behaves as if all the attribute names were prefixed by ?.
* ----------------------------------------------------------------------------- */
int Swig_save(const char *ns, Node *n, ...) {
void Swig_save(const char *ns, Node *n, ...) {
va_list ap;
char *name;
DOH *obj;
@ -340,18 +330,16 @@ int Swig_save(const char *ns, Node *n, ...) {
/* Save the view */
{
String *view = Getattr(n, k_view);
String *view = Getattr(n, "view");
if (view) {
if (Strcmp(view, ns) != 0) {
Setattr(n, NewStringf("%s:view", ns), view);
Setattr(n, k_view, ns);
Setattr(n, "view", ns);
}
} else {
Setattr(n, k_view, ns);
Setattr(n, "view", ns);
}
}
return 1;
}
/* -----------------------------------------------------------------------------
@ -366,7 +354,7 @@ void Swig_restore(Node *n) {
String *ns;
Iterator ki;
ns = Getattr(n, k_view);
ns = Getattr(n, "view");
assert(ns);
l = NewList();

View file

@ -1342,9 +1342,9 @@ String *Swig_typemap_lookup_new(const String_or_char *op, Node *node, const Stri
Delete(locals);
}
if (HashCheckAttr(tm, k_type, k_SWIGTYPE)) {
if (Checkattr(tm, k_type, k_SWIGTYPE)) {
sprintf(temp, "%s:SWIGTYPE", cop);
Setattr(node, tmop_name(temp), k_1);
Setattr(node, tmop_name(temp), "1");
}
/* Attach kwargs */
@ -1614,9 +1614,9 @@ 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 (HashCheckAttr(tm, k_type, k_SWIGTYPE)) {
if (Checkattr(tm, k_type, k_SWIGTYPE)) {
sprintf(temp, "%s:SWIGTYPE", cop);
Setattr(p, tmop_name(temp), k_1);
Setattr(p, tmop_name(temp), "1");
}
p = nextSibling(p);
}

View file

@ -853,7 +853,7 @@ SwigType *SwigType_typedef_qualified(SwigType *t) {
if (!typedef_qualified_cache)
typedef_qualified_cache = NewHash();
result = HashGetAttr(typedef_qualified_cache, t);
result = Getattr(typedef_qualified_cache, t);
if (result) {
String *rc = Copy(result);
return rc;
@ -953,7 +953,7 @@ SwigType *SwigType_typedef_qualified(SwigType *t) {
break;
lastnode = n;
if (n) {
char *ntype = Char(Getattr(n, k_nodetype));
char *ntype = Char(nodeType(n));
if (strcmp(ntype, "enumitem") == 0) {
/* An enum item. Generate a fully qualified name */
String *qn = Swig_symbol_qualified(n);
@ -1313,7 +1313,7 @@ SwigType *SwigType_alttype(SwigType *t, int local_tmap) {
if (GetFlag(n, "feature:valuewrapper")) {
use_wrapper = 1;
} else {
if (HashCheckAttr(n, k_nodetype, k_class)
if (Checkattr(n, "nodeType", k_class)
&& (!Getattr(n, "allocate:default_constructor")
|| (Getattr(n, "allocate:noassign")))) {
use_wrapper = !GetFlag(n, "feature:novaluewrapper") || GetFlag(n, "feature:nodefault");
@ -1342,7 +1342,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 ((HashCheckAttr(n, k_nodetype, k_class)
if ((Checkattr(n, "nodeType", k_class)
&& !Getattr(n, "allocate:noassign")
&& (Getattr(n, "allocate:default_constructor")))
|| (GetFlag(n, "feature:novaluewrapper"))) {