Eliminated use of swigkeys.h/.c files.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9632 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Dave Beazley 2007-01-03 20:58:19 +00:00
commit ff41049b1c
20 changed files with 993 additions and 1279 deletions

File diff suppressed because it is too large Load diff

View file

@ -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) {

View file

@ -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");
}
}
}

View file

@ -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@

View file

@ -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);

View file

@ -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;

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", 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, ",");

View file

@ -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);

View file

@ -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));

View file

@ -10,7 +10,6 @@
char cvsroot_misc_c[] = "$Id$";
#include "swig.h"
#include "swigkeys.h"
#include <errno.h>
#include <ctype.h>
#include <limits.h>
@ -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();

View file

@ -11,7 +11,6 @@ char cvsroot_naming_c[] = "$Id$";
#include "swig.h"
#include "cparse.h"
#include "swigkeys.h"
#include <ctype.h>
/* 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);

View file

@ -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 */

View file

@ -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");
}

View file

@ -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_ */

View file

@ -11,7 +11,6 @@ char cvsroot_symbol_c[] = "$Id$";
#include "swig.h"
#include "swigwarn.h"
#include "swigkeys.h"
#include <ctype.h>
/* #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<typename> 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);

View file

@ -11,7 +11,6 @@
char cvsroot_tree_c[] = "$Id$";
#include "swig.h"
#include "swigkeys.h"
#include <stdarg.h>
#include <assert.h>

View file

@ -10,7 +10,6 @@
char cvsroot_typemap_c[] = "$Id$";
#include "swig.h"
#include "swigkeys.h"
#include "cparse.h"
#include <ctype.h>
@ -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;

View file

@ -13,7 +13,6 @@
char cvsroot_typeobj_c[] = "$Id$";
#include "swig.h"
#include "swigkeys.h"
#include <ctype.h>
/* -----------------------------------------------------------------------------
@ -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, ")>");

View file

@ -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 = "<unnamed>";
}
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"))) {