API cleanup. Documentation.

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

View file

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

View file

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