API cleanup. Documentation

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9631 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Dave Beazley 2007-01-03 05:23:20 +00:00
commit c12550e4ad
27 changed files with 642 additions and 677 deletions

View file

@ -323,7 +323,7 @@ static void add_symbols(Node *n) {
*/
String *prefix = name ? Swig_scopename_prefix(name) : 0;
if (prefix) {
if (Classprefix && (StringEqual(prefix,Classprefix))) {
if (Classprefix && (Equal(prefix,Classprefix))) {
String *base = Swig_scopename_last(name);
Setattr(n,k_name,base);
Delete(base);
@ -1235,7 +1235,7 @@ static void default_arguments(Node *n) {
|| GetFlag(function,"feature:kwargs")) {
ParmList *p = Getattr(function,k_parms);
if (p)
Setattr(p,k_compactdefargs, "1"); /* mark parameters for special handling */
Setattr(p,"compactdefargs", "1"); /* mark parameters for special handling */
function = 0; /* don't add in extra methods */
}
}
@ -1680,7 +1680,7 @@ extend_directive : EXTEND options idcolon LBRACE {
apply_directive : APPLY typemap_parm LBRACE tm_list RBRACE {
$$ = new_node("apply");
Setattr($$,k_pattern,Getattr($2,k_pattern));
Setattr($$,"pattern",Getattr($2,"pattern"));
appendChild($$,$4);
};
@ -1830,7 +1830,7 @@ fragment_directive: FRAGMENT LPAREN fname COMMA kwargs RPAREN HBLOCK {
$$ = new_node("fragment");
Setattr($$,k_value,Getattr($3,k_value));
Setattr($$,k_type,Getattr($3,k_type));
Setattr($$,k_section,Getattr(p,k_name));
Setattr($$,"section",Getattr(p,k_name));
Setattr($$,k_kwargs,nextSibling(p));
Setattr($$,k_code,$7);
}
@ -1841,7 +1841,7 @@ fragment_directive: FRAGMENT LPAREN fname COMMA kwargs RPAREN HBLOCK {
$$ = new_node("fragment");
Setattr($$,k_value,Getattr($3,k_value));
Setattr($$,k_type,Getattr($3,k_type));
Setattr($$,k_section,Getattr(p,k_name));
Setattr($$,"section",Getattr(p,k_name));
Setattr($$,k_kwargs,nextSibling(p));
Delitem(scanner_ccode,0);
Delitem(scanner_ccode,DOH_END);
@ -1980,7 +1980,7 @@ insert_directive : HBLOCK {
| INSERT LPAREN idstring RPAREN string {
String *code = NewStringEmpty();
$$ = new_node("insert");
Setattr($$,k_section,$3);
Setattr($$,"section",$3);
Setattr($$,k_code,code);
if (Swig_insert_file($5,code) < 0) {
Swig_error(cparse_file, cparse_line, "Couldn't find '%s'.\n", $5);
@ -1989,14 +1989,14 @@ insert_directive : HBLOCK {
}
| INSERT LPAREN idstring RPAREN HBLOCK {
$$ = new_node("insert");
Setattr($$,k_section,$3);
Setattr($$,"section",$3);
Setattr($$,k_code,$5);
}
| INSERT LPAREN idstring RPAREN LBRACE {
String *code;
skip_balanced('{','}');
$$ = new_node("insert");
Setattr($$,k_section,$3);
Setattr($$,"section",$3);
Delitem(scanner_ccode,0);
Delitem(scanner_ccode,DOH_END);
code = Copy(scanner_ccode);
@ -2432,7 +2432,7 @@ typemap_directive : TYPEMAP LPAREN typemap_type RPAREN tm_list stringbrace {
if ($3.op) {
$$ = new_node("typemapcopy");
Setattr($$,"method",$3.op);
Setattr($$,k_pattern, Getattr($7,k_pattern));
Setattr($$,"pattern", Getattr($7,"pattern"));
appendChild($$,$5);
}
}
@ -2483,7 +2483,7 @@ typemap_parm : type typemap_parameter_declarator {
SwigType_push($1,$2.type);
$$ = new_node("typemapitem");
parm = NewParm($1,$2.id);
Setattr($$,k_pattern,parm);
Setattr($$,"pattern",parm);
Setattr($$,k_parms, $2.parms);
Delete(parm);
/* $$ = NewParm($1,$2.id);
@ -2491,12 +2491,12 @@ typemap_parm : type typemap_parameter_declarator {
}
| LPAREN parms RPAREN {
$$ = new_node("typemapitem");
Setattr($$,k_pattern,$2);
Setattr($$,"pattern",$2);
/* Setattr($$,"multitype",$2); */
}
| LPAREN parms RPAREN LPAREN parms RPAREN {
$$ = new_node("typemapitem");
Setattr($$,k_pattern, $2);
Setattr($$,"pattern", $2);
/* Setattr($$,"multitype",$2); */
Setattr($$,k_parms,$5);
}

View file

@ -57,7 +57,7 @@ static int cparse_template_expand(Node *n, String *tname, String *rname, String
if (Getattr(n, k_error))
return 0;
if (StringEqual(nodeType, k_template)) {
if (Equal(nodeType, k_template)) {
/* Change the node type back to normal */
if (!expanded) {
expanded = 1;
@ -74,7 +74,7 @@ static int cparse_template_expand(Node *n, String *tname, String *rname, String
set_nodeType(n, k_template);
return ret;
}
} else if (StringEqual(nodeType, k_cdecl)) {
} else if (Equal(nodeType, k_cdecl)) {
/* A simple C declaration */
SwigType *t, *v, *d;
String *code;
@ -99,7 +99,7 @@ static int cparse_template_expand(Node *n, String *tname, String *rname, String
add_parms(Getattr(n, k_parms), cpatchlist, typelist);
add_parms(Getattr(n, k_throws), cpatchlist, typelist);
} else if (StringEqual(nodeType, k_class)) {
} else if (Equal(nodeType, k_class)) {
/* Patch base classes */
{
int b = 0;
@ -124,7 +124,7 @@ static int cparse_template_expand(Node *n, String *tname, String *rname, String
cn = nextSibling(cn);
}
}
} else if (StringEqual(nodeType, k_constructor)) {
} else if (Equal(nodeType, "constructor")) {
String *name = Getattr(n, k_name);
if (!(Getattr(n, k_templatetype))) {
String *symname;
@ -165,7 +165,7 @@ static int cparse_template_expand(Node *n, String *tname, String *rname, String
Append(typelist, Getattr(n, k_decl));
add_parms(Getattr(n, k_parms), cpatchlist, typelist);
add_parms(Getattr(n, k_throws), cpatchlist, typelist);
} else if (StringEqual(nodeType, k_destructor)) {
} else if (Equal(nodeType, "destructor")) {
String *name = Getattr(n, k_name);
if (name && strchr(Char(name), '<')) {
Append(patchlist, Getattr(n, k_name));
@ -182,7 +182,7 @@ static int cparse_template_expand(Node *n, String *tname, String *rname, String
}
/* Setattr(n,k_symname,name); */
Append(cpatchlist, Getattr(n, k_code));
} else if (StringEqual(nodeType, k_using)) {
} else if (Equal(nodeType, k_using)) {
String *uname = Getattr(n, k_uname);
if (uname && strchr(Char(uname), '<')) {
Append(patchlist, uname);
@ -199,7 +199,7 @@ static int cparse_template_expand(Node *n, String *tname, String *rname, String
Append(typelist, Getattr(n, k_decl));
add_parms(Getattr(n, k_parms), cpatchlist, typelist);
add_parms(Getattr(n, k_kwargs), cpatchlist, typelist);
add_parms(Getattr(n, k_pattern), cpatchlist, typelist);
add_parms(Getattr(n, "pattern"), cpatchlist, typelist);
add_parms(Getattr(n, k_throws), cpatchlist, typelist);
cn = firstChild(n);
while (cn) {
@ -472,7 +472,7 @@ static Node *template_locate(String *name, Parm *tparms, Symtab *tscope) {
n = Swig_symbol_clookup_local(tname, 0);
if (!n) {
SwigType *rname = Swig_symbol_typedef_reduce(tname, tscope);
if (!StringEqual(rname, tname)) {
if (!Equal(rname, tname)) {
if (template_debug) {
Printf(stdout, " searching: '%s' (exact specialization)\n", rname);
}
@ -483,7 +483,7 @@ static Node *template_locate(String *name, Parm *tparms, Symtab *tscope) {
if (n) {
Node *tn;
String *nodeType = nodeType(n);
if (StringEqual(nodeType, k_template))
if (Equal(nodeType, k_template))
goto success;
tn = Getattr(n, k_template);
if (tn) {
@ -562,7 +562,7 @@ static Node *template_locate(String *name, Parm *tparms, Symtab *tscope) {
if (template_debug) {
Printf(stdout, " searching: '%s' (partial specialization - %s)\n", ss, pi.item);
}
if ((StringEqual(ss, tname)) || (StringEqual(ss, rname))) {
if ((Equal(ss, tname)) || (Equal(ss, rname))) {
Append(mpartials, pi.item);
}
Delete(ss);
@ -592,7 +592,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 (!StringEqual(nodeType, k_template)) {
if (!Equal(nodeType, k_template)) {
Swig_error(cparse_file, cparse_line, "'%s' is not defined as a template. (%s)\n", name, nodeType);
n = 0;
}
@ -625,8 +625,8 @@ Node *Swig_cparse_template_locate(String *name, Parm *tparms, Symtab *tscope) {
if (n) {
String *nodeType = nodeType(n);
int isclass = 0;
assert(StringEqual(nodeType, k_template));
isclass = (StringEqual(Getattr(n, k_templatetype), k_class));
assert(Equal(nodeType, k_template));
isclass = (Equal(Getattr(n, k_templatetype), k_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