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

@ -18,11 +18,11 @@ The following documentation describe the internal APIs used by SWIG. These may
<li><a href="file.html">File handling functions</a> <li><a href="file.html">File handling functions</a>
<li><a href="cmdopt.html">Command line arguments</a> <li><a href="cmdopt.html">Command line arguments</a>
<li><a href="tree.html">Parse tree navigation and manipulation</a> <li><a href="tree.html">Parse tree navigation and manipulation</a>
<li><a href="parm.html">Parameter and Parameter list handling functions</a>
</ul> </ul>
<hr> <hr>
Copyright (C) 1999-2004 SWIG Development Team. Copyright (C) 1999-2007 SWIG Development Team.
</body> </body>
</html> </html>

108
Doc/Devel/parm.html Normal file
View file

@ -0,0 +1,108 @@
<html>
<head>
<title>SWIG Parameter Handling</title>
</head>
<body>
<center>
<h1>SWIG Parameter Handling</h1>
<p>
David M. Beazley <br>
dave-swig@dabeaz.com<br>
January 2, 2007<br>
</b>
</center>
<h2>Introduction</h2>
This document describes the functions related to management of function parameters and parameter lists in the SWIG core. These functions are declared in <tt>Source/Swig/swigparm.h</tt>. This API is considered to be stable.
<h2>Parameters</h2>
The following utility functions are used to create and copy individual parameters. In their most basic form, a parameter merely contains a type, a name, and an optional default value.
<p>
<b><tt>Parm *NewParm(SwigType *type, const String_or_char *name)</tt></b>
<blockquote>
Creates a new parameter object with type <tt>type</tt> and name <tt>name</tt>. The type is stored in the attribute "type" and the name is stored in the attribute "name".
</blockquote>
<p>
<b><tt>Parm *CopyParm(Parm *p)</tt></b>
<blockquote>
Copies a parameter object. All string attributes are copied in the
process of making the copy. However, no complex attributes (lists,
hashes, etc.) are copied.
</blockquote>
<h2>Parameter Lists</h2>
<p>
<b><tt>ParmList *CopyParmList(ParmList *p)</tt></b>
<blockquote>
Creates a copy of a parameter list. A parameter list is merely a linked list of parameters created by NewParm().
</blockquote>
<p>
<b><tt>ParmList *CopyParmListMax(ParmList *p, int count)</tt></b>
<blockquote>
Copies at most <tt>count</tt> parameters from the parameter list <tt>p</tt>.
</blockquote>
<p>
<b><tt>int ParmList_len(ParmList *p)</tt></b>
<blockquote>
Returns the total number of parameters in a parameter list.
</blockquote>
<p>
<b><tt>int ParmList_numarg(ParmList *p)</tt></b>
<blockquote>
Returns the number of non-ignored parameters in a parameter list. Any parameter with an "ignore" attribute is ignored in the count.
</blockquote>
<p>
<b><tt>int ParmList_numrequired(ParmList *p)</tt></b>
<blockquote>
Returns the number of required parameters in a parameter list. This pertains to invoking a function/method in C/C++.
</blockquote>
<p>
<b><tt>int ParmList_has_defaultargs(ParmList *p)</tt></b>
<blockquote>
Returns 1 if the parameter list has any default arguments. Otherwise returns 0.
</blockquote>
<h2>Code Generation Functions</h2>
<p>
<b><tt>String *ParmList_str(ParmList *p)</tt></b>
<blockquote>
Creates a C prototype string of the parameters, but without any default values.
</blockquote>
<p>
<b><tt>String *ParmList_str_defaultargs(ParmList *p)</tt></b>
<blockquote>
Creates a C prototype string of the parameters and includes the default values (if any).
</blockquote>
<p>
<b><tt>String *ParmList_protostr(ParmList *p)</tt></b>
<blockquote>
Creates a C prototype string of the parameters. Does not include any hidden parameters.
</blockquote>
</body>
</html>

View file

@ -323,7 +323,7 @@ static void add_symbols(Node *n) {
*/ */
String *prefix = name ? Swig_scopename_prefix(name) : 0; String *prefix = name ? Swig_scopename_prefix(name) : 0;
if (prefix) { if (prefix) {
if (Classprefix && (StringEqual(prefix,Classprefix))) { if (Classprefix && (Equal(prefix,Classprefix))) {
String *base = Swig_scopename_last(name); String *base = Swig_scopename_last(name);
Setattr(n,k_name,base); Setattr(n,k_name,base);
Delete(base); Delete(base);
@ -1235,7 +1235,7 @@ static void default_arguments(Node *n) {
|| GetFlag(function,"feature:kwargs")) { || GetFlag(function,"feature:kwargs")) {
ParmList *p = Getattr(function,k_parms); ParmList *p = Getattr(function,k_parms);
if (p) 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 */ 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 { apply_directive : APPLY typemap_parm LBRACE tm_list RBRACE {
$$ = new_node("apply"); $$ = new_node("apply");
Setattr($$,k_pattern,Getattr($2,k_pattern)); Setattr($$,"pattern",Getattr($2,"pattern"));
appendChild($$,$4); appendChild($$,$4);
}; };
@ -1830,7 +1830,7 @@ fragment_directive: FRAGMENT LPAREN fname COMMA kwargs RPAREN HBLOCK {
$$ = new_node("fragment"); $$ = new_node("fragment");
Setattr($$,k_value,Getattr($3,k_value)); Setattr($$,k_value,Getattr($3,k_value));
Setattr($$,k_type,Getattr($3,k_type)); 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_kwargs,nextSibling(p));
Setattr($$,k_code,$7); Setattr($$,k_code,$7);
} }
@ -1841,7 +1841,7 @@ fragment_directive: FRAGMENT LPAREN fname COMMA kwargs RPAREN HBLOCK {
$$ = new_node("fragment"); $$ = new_node("fragment");
Setattr($$,k_value,Getattr($3,k_value)); Setattr($$,k_value,Getattr($3,k_value));
Setattr($$,k_type,Getattr($3,k_type)); 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_kwargs,nextSibling(p));
Delitem(scanner_ccode,0); Delitem(scanner_ccode,0);
Delitem(scanner_ccode,DOH_END); Delitem(scanner_ccode,DOH_END);
@ -1980,7 +1980,7 @@ insert_directive : HBLOCK {
| INSERT LPAREN idstring RPAREN string { | INSERT LPAREN idstring RPAREN string {
String *code = NewStringEmpty(); String *code = NewStringEmpty();
$$ = new_node("insert"); $$ = new_node("insert");
Setattr($$,k_section,$3); Setattr($$,"section",$3);
Setattr($$,k_code,code); Setattr($$,k_code,code);
if (Swig_insert_file($5,code) < 0) { if (Swig_insert_file($5,code) < 0) {
Swig_error(cparse_file, cparse_line, "Couldn't find '%s'.\n", $5); Swig_error(cparse_file, cparse_line, "Couldn't find '%s'.\n", $5);
@ -1989,14 +1989,14 @@ insert_directive : HBLOCK {
} }
| INSERT LPAREN idstring RPAREN HBLOCK { | INSERT LPAREN idstring RPAREN HBLOCK {
$$ = new_node("insert"); $$ = new_node("insert");
Setattr($$,k_section,$3); Setattr($$,"section",$3);
Setattr($$,k_code,$5); Setattr($$,k_code,$5);
} }
| INSERT LPAREN idstring RPAREN LBRACE { | INSERT LPAREN idstring RPAREN LBRACE {
String *code; String *code;
skip_balanced('{','}'); skip_balanced('{','}');
$$ = new_node("insert"); $$ = new_node("insert");
Setattr($$,k_section,$3); Setattr($$,"section",$3);
Delitem(scanner_ccode,0); Delitem(scanner_ccode,0);
Delitem(scanner_ccode,DOH_END); Delitem(scanner_ccode,DOH_END);
code = Copy(scanner_ccode); code = Copy(scanner_ccode);
@ -2432,7 +2432,7 @@ typemap_directive : TYPEMAP LPAREN typemap_type RPAREN tm_list stringbrace {
if ($3.op) { if ($3.op) {
$$ = new_node("typemapcopy"); $$ = new_node("typemapcopy");
Setattr($$,"method",$3.op); Setattr($$,"method",$3.op);
Setattr($$,k_pattern, Getattr($7,k_pattern)); Setattr($$,"pattern", Getattr($7,"pattern"));
appendChild($$,$5); appendChild($$,$5);
} }
} }
@ -2483,7 +2483,7 @@ typemap_parm : type typemap_parameter_declarator {
SwigType_push($1,$2.type); SwigType_push($1,$2.type);
$$ = new_node("typemapitem"); $$ = new_node("typemapitem");
parm = NewParm($1,$2.id); parm = NewParm($1,$2.id);
Setattr($$,k_pattern,parm); Setattr($$,"pattern",parm);
Setattr($$,k_parms, $2.parms); Setattr($$,k_parms, $2.parms);
Delete(parm); Delete(parm);
/* $$ = NewParm($1,$2.id); /* $$ = NewParm($1,$2.id);
@ -2491,12 +2491,12 @@ typemap_parm : type typemap_parameter_declarator {
} }
| LPAREN parms RPAREN { | LPAREN parms RPAREN {
$$ = new_node("typemapitem"); $$ = new_node("typemapitem");
Setattr($$,k_pattern,$2); Setattr($$,"pattern",$2);
/* Setattr($$,"multitype",$2); */ /* Setattr($$,"multitype",$2); */
} }
| LPAREN parms RPAREN LPAREN parms RPAREN { | LPAREN parms RPAREN LPAREN parms RPAREN {
$$ = new_node("typemapitem"); $$ = new_node("typemapitem");
Setattr($$,k_pattern, $2); Setattr($$,"pattern", $2);
/* Setattr($$,"multitype",$2); */ /* Setattr($$,"multitype",$2); */
Setattr($$,k_parms,$5); 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)) if (Getattr(n, k_error))
return 0; return 0;
if (StringEqual(nodeType, k_template)) { if (Equal(nodeType, k_template)) {
/* Change the node type back to normal */ /* Change the node type back to normal */
if (!expanded) { if (!expanded) {
expanded = 1; expanded = 1;
@ -74,7 +74,7 @@ static int cparse_template_expand(Node *n, String *tname, String *rname, String
set_nodeType(n, k_template); set_nodeType(n, k_template);
return ret; return ret;
} }
} else if (StringEqual(nodeType, k_cdecl)) { } else if (Equal(nodeType, k_cdecl)) {
/* A simple C declaration */ /* A simple C declaration */
SwigType *t, *v, *d; SwigType *t, *v, *d;
String *code; 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_parms), cpatchlist, typelist);
add_parms(Getattr(n, k_throws), 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 */ /* Patch base classes */
{ {
int b = 0; int b = 0;
@ -124,7 +124,7 @@ static int cparse_template_expand(Node *n, String *tname, String *rname, String
cn = nextSibling(cn); cn = nextSibling(cn);
} }
} }
} else if (StringEqual(nodeType, k_constructor)) { } else if (Equal(nodeType, "constructor")) {
String *name = Getattr(n, k_name); String *name = Getattr(n, k_name);
if (!(Getattr(n, k_templatetype))) { if (!(Getattr(n, k_templatetype))) {
String *symname; String *symname;
@ -165,7 +165,7 @@ static int cparse_template_expand(Node *n, String *tname, String *rname, String
Append(typelist, Getattr(n, k_decl)); Append(typelist, Getattr(n, k_decl));
add_parms(Getattr(n, k_parms), cpatchlist, typelist); add_parms(Getattr(n, k_parms), cpatchlist, typelist);
add_parms(Getattr(n, k_throws), 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); String *name = Getattr(n, k_name);
if (name && strchr(Char(name), '<')) { if (name && strchr(Char(name), '<')) {
Append(patchlist, Getattr(n, k_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); */ /* Setattr(n,k_symname,name); */
Append(cpatchlist, Getattr(n, k_code)); Append(cpatchlist, Getattr(n, k_code));
} else if (StringEqual(nodeType, k_using)) { } else if (Equal(nodeType, k_using)) {
String *uname = Getattr(n, k_uname); String *uname = Getattr(n, k_uname);
if (uname && strchr(Char(uname), '<')) { if (uname && strchr(Char(uname), '<')) {
Append(patchlist, 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)); Append(typelist, Getattr(n, k_decl));
add_parms(Getattr(n, k_parms), cpatchlist, typelist); add_parms(Getattr(n, k_parms), cpatchlist, typelist);
add_parms(Getattr(n, k_kwargs), 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); add_parms(Getattr(n, k_throws), cpatchlist, typelist);
cn = firstChild(n); cn = firstChild(n);
while (cn) { while (cn) {
@ -472,7 +472,7 @@ static Node *template_locate(String *name, Parm *tparms, Symtab *tscope) {
n = Swig_symbol_clookup_local(tname, 0); n = Swig_symbol_clookup_local(tname, 0);
if (!n) { if (!n) {
SwigType *rname = Swig_symbol_typedef_reduce(tname, tscope); SwigType *rname = Swig_symbol_typedef_reduce(tname, tscope);
if (!StringEqual(rname, tname)) { if (!Equal(rname, tname)) {
if (template_debug) { if (template_debug) {
Printf(stdout, " searching: '%s' (exact specialization)\n", rname); Printf(stdout, " searching: '%s' (exact specialization)\n", rname);
} }
@ -483,7 +483,7 @@ static Node *template_locate(String *name, Parm *tparms, Symtab *tscope) {
if (n) { if (n) {
Node *tn; Node *tn;
String *nodeType = nodeType(n); String *nodeType = nodeType(n);
if (StringEqual(nodeType, k_template)) if (Equal(nodeType, k_template))
goto success; goto success;
tn = Getattr(n, k_template); tn = Getattr(n, k_template);
if (tn) { if (tn) {
@ -562,7 +562,7 @@ static Node *template_locate(String *name, Parm *tparms, Symtab *tscope) {
if (template_debug) { if (template_debug) {
Printf(stdout, " searching: '%s' (partial specialization - %s)\n", ss, pi.item); 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); Append(mpartials, pi.item);
} }
Delete(ss); 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); Swig_error(cparse_file, cparse_line, "Template '%s' undefined.\n", name);
} else if (n) { } else if (n) {
String *nodeType = nodeType(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); Swig_error(cparse_file, cparse_line, "'%s' is not defined as a template. (%s)\n", name, nodeType);
n = 0; n = 0;
} }
@ -625,8 +625,8 @@ Node *Swig_cparse_template_locate(String *name, Parm *tparms, Symtab *tscope) {
if (n) { if (n) {
String *nodeType = nodeType(n); String *nodeType = nodeType(n);
int isclass = 0; int isclass = 0;
assert(StringEqual(nodeType, k_template)); assert(Equal(nodeType, k_template));
isclass = (StringEqual(Getattr(n, k_templatetype), k_class)); isclass = (Equal(Getattr(n, k_templatetype), k_class));
if (!isclass) { if (!isclass) {
/* If not a templated class we must have a templated function. /* 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 The template found is not necessarily the one we want when dealing with templated

View file

@ -73,17 +73,6 @@
#define DohGetc DOH_NAMESPACE(Getc) #define DohGetc DOH_NAMESPACE(Getc)
#define DohPutc DOH_NAMESPACE(Putc) #define DohPutc DOH_NAMESPACE(Putc)
#define DohUngetc DOH_NAMESPACE(Ungetc) #define DohUngetc DOH_NAMESPACE(Ungetc)
#define DohStringPutc DOH_NAMESPACE(StringPutc)
#define DohStringGetc DOH_NAMESPACE(StringGetc)
#define DohStringUngetc DOH_NAMESPACE(StringUngetc)
#define DohStringAppend DOH_NAMESPACE(StringAppend)
#define DohStringLen DOH_NAMESPACE(StringLen)
#define DohStringChar DOH_NAMESPACE(StringChar)
#define DohStringEqual DOH_NAMESPACE(StringEqual)
#define DohGetline DOH_NAMESPACE(Getline) #define DohGetline DOH_NAMESPACE(Getline)
#define DohSetline DOH_NAMESPACE(Setline) #define DohSetline DOH_NAMESPACE(Setline)
#define DohGetfile DOH_NAMESPACE(Getfile) #define DohGetfile DOH_NAMESPACE(Getfile)
@ -255,23 +244,6 @@ extern void DohSetfile(DOH *obj, DOH *file);
extern int DohReplace(DOHString * src, const DOHString_or_char *token, const DOHString_or_char *rep, int flags); extern int DohReplace(DOHString * src, const DOHString_or_char *token, const DOHString_or_char *rep, int flags);
extern void DohChop(DOHString * src); extern void DohChop(DOHString * src);
extern int DohString_putc(DOH *so, int ch);
extern int DohString_getc(DOH *so);
extern int DohString_ungetc(DOH *so, int ch);
extern void DohString_append(DOH *so, DOH *str);
extern int DohString_len(DOH *s1);
extern char *DohString_char(DOH *s1);
extern int DohString_equal(DOH *s1, DOH *s2);
extern int DohString_delslice(DOH *so, int sindex, int eindex);
#define DohStringPutc(ch,so) DohString_putc(so, ch)
#define DohStringGetc(so) DohString_getc(so)
#define DohStringUngetc(ch,so) DohString_ungetc(so, ch)
#define DohStringAppend(so,str) DohString_append(so, (DOH*)str)
#define DohStringLen(so) DohString_len((DOH*)so)
#define DohStringChar(so) DohString_char(so)
#define DohStringEqual(s1,s2) DohString_equal((DOH *)s1, (DOH *)s2)
/* Meta-variables */ /* Meta-variables */
extern DOH *DohGetmeta(DOH *, const DOH *); extern DOH *DohGetmeta(DOH *, const DOH *);
extern int DohSetmeta(DOH *, const DOH *, const DOH *value); extern int DohSetmeta(DOH *, const DOH *, const DOH *value);
@ -397,13 +369,13 @@ extern void DohMemoryDebug(void);
#define Putc DohPutc #define Putc DohPutc
#define Ungetc DohUngetc #define Ungetc DohUngetc
#define StringPutc DohStringPutc /* #define StringPutc DohStringPutc */
#define StringGetc DohStringGetc /* #define StringGetc DohStringGetc */
#define StringUngetc DohStringUngetc /* #define StringUngetc DohStringUngetc */
#define StringAppend DohStringAppend /* #define StringAppend Append */
#define StringLen DohStringLen /* #define StringLen DohStringLen */
#define StringChar DohStringChar /* #define StringChar DohStringChar */
#define StringEqual DohStringEqual /* #define StringEqual DohStringEqual */
#define Close DohClose #define Close DohClose
#define vPrintf DohvPrintf #define vPrintf DohvPrintf

View file

@ -36,9 +36,10 @@ static void *String_data(DOH *so) {
return (void *) s->str; return (void *) s->str;
} }
char *DohString_char(DOH *so) { /* static char *String_char(DOH *so) {
return (char *) String_data(so); return (char *) String_data(so);
} }
*/
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
* int String_dump() - Serialize a string onto out * int String_dump() - Serialize a string onto out
@ -97,7 +98,7 @@ static void DelString(DOH *so) {
* DohString_len() - Length of a string * DohString_len() - Length of a string
* ----------------------------------------------------------------------------- */ * ----------------------------------------------------------------------------- */
int DohString_len(DOH *so) { static int String_len(DOH *so) {
String *s = (String *) ObjData(so); String *s = (String *) ObjData(so);
return s->len; return s->len;
} }
@ -139,7 +140,7 @@ static int String_cmp(DOH *so1, DOH *so2) {
* int String_equal() - Say if two string are equal * int String_equal() - Say if two string are equal
* ----------------------------------------------------------------------------- */ * ----------------------------------------------------------------------------- */
int DohString_equal(DOH *so1, DOH *so2) { static int String_equal(DOH *so1, DOH *so2) {
String *s1 = (String *) ObjData(so1); String *s1 = (String *) ObjData(so1);
String *s2 = (String *) ObjData(so2); String *s2 = (String *) ObjData(so2);
register int len = s1->len; register int len = s1->len;
@ -509,7 +510,7 @@ static long String_tell(DOH *so) {
* int String_putc() * int String_putc()
* ----------------------------------------------------------------------------- */ * ----------------------------------------------------------------------------- */
int DohString_putc(DOH *so, int ch) { static int String_putc(DOH *so, int ch) {
String *s = (String *) ObjData(so); String *s = (String *) ObjData(so);
register int len = s->len; register int len = s->len;
register int sp = s->sp; register int sp = s->sp;
@ -540,7 +541,7 @@ int DohString_putc(DOH *so, int ch) {
* int String_getc() * int String_getc()
* ----------------------------------------------------------------------------- */ * ----------------------------------------------------------------------------- */
int DohString_getc(DOH *so) { static int String_getc(DOH *so) {
int c; int c;
String *s = (String *) ObjData(so); String *s = (String *) ObjData(so);
if (s->sp >= s->len) if (s->sp >= s->len)
@ -556,7 +557,7 @@ int DohString_getc(DOH *so) {
* int String_ungetc() * int String_ungetc()
* ----------------------------------------------------------------------------- */ * ----------------------------------------------------------------------------- */
int DohString_ungetc(DOH *so, int ch) { static int String_ungetc(DOH *so, int ch) {
String *s = (String *) ObjData(so); String *s = (String *) ObjData(so);
if (ch == EOF) if (ch == EOF)
return ch; return ch;
@ -968,9 +969,9 @@ static DohListMethods StringListMethods = {
static DohFileMethods StringFileMethods = { static DohFileMethods StringFileMethods = {
String_read, String_read,
String_write, String_write,
DohString_putc, String_putc,
DohString_getc, String_getc,
DohString_ungetc, String_ungetc,
String_seek, String_seek,
String_tell, String_tell,
0, /* close */ 0, /* close */
@ -989,10 +990,10 @@ DohObjInfo DohStringType = {
String_str, /* doh_str */ String_str, /* doh_str */
String_data, /* doh_data */ String_data, /* doh_data */
String_dump, /* doh_dump */ String_dump, /* doh_dump */
DohString_len, /* doh_len */ String_len, /* doh_len */
String_hash, /* doh_hash */ String_hash, /* doh_hash */
String_cmp, /* doh_cmp */ String_cmp, /* doh_cmp */
DohString_equal, /* doh_equal */ String_equal, /* doh_equal */
0, /* doh_first */ 0, /* doh_first */
0, /* doh_next */ 0, /* doh_next */
String_setfile, /* doh_setfile */ String_setfile, /* doh_setfile */

View file

@ -71,6 +71,7 @@ eswig_SOURCES = CParse/cscanner.c \
Preprocessor/cpp.c \ Preprocessor/cpp.c \
Preprocessor/expr.c \ Preprocessor/expr.c \
Swig/cwrap.c \ Swig/cwrap.c \
Swig/deprecate.c \
Swig/error.c \ Swig/error.c \
Swig/fragment.c \ Swig/fragment.c \
Swig/getopt.c \ Swig/getopt.c \

View file

@ -333,7 +333,7 @@ int CFFI::functionWrapper(Node *n) {
String *wname = Swig_name_wrapper(iname); String *wname = Swig_name_wrapper(iname);
if (overname) { if (overname) {
StringAppend(wname, overname); Append(wname, overname);
} }
// Emit all of the local variables for holding arguments. // Emit all of the local variables for holding arguments.
emit_args(Getattr(n, "type"), parms, wrap); emit_args(Getattr(n, "type"), parms, wrap);

View file

@ -85,6 +85,13 @@ class CSHARP:public Language {
enum EnumFeature { SimpleEnum, TypeunsafeEnum, TypesafeEnum, ProperEnum }; enum EnumFeature { SimpleEnum, TypeunsafeEnum, TypesafeEnum, ProperEnum };
static Parm *NewParmFromNode(SwigType *type, const String_or_char *name, Node *n) {
Parm *p = NewParm(type, name);
Setfile(p, Getfile(n));
Setline(p, Getline(n));
return p;
}
public: public:
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------

View file

@ -81,6 +81,13 @@ class JAVA:public Language {
enum EnumFeature { SimpleEnum, TypeunsafeEnum, TypesafeEnum, ProperEnum }; enum EnumFeature { SimpleEnum, TypeunsafeEnum, TypesafeEnum, ProperEnum };
static Parm *NewParmFromNode(SwigType *type, const String_or_char *name, Node *n) {
Parm *p = NewParm(type, name);
Setfile(p, Getfile(n));
Setline(p, Getline(n));
return p;
}
public: public:
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------

View file

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

View file

@ -866,12 +866,12 @@ class TypePass:private Dispatcher {
String *ucode = is_void ? NewStringf("{ self->%s(", Getattr(n, "uname")) : NewStringf("{ return self->%s(", Getattr(n, "uname")); String *ucode = is_void ? NewStringf("{ self->%s(", Getattr(n, "uname")) : NewStringf("{ return self->%s(", Getattr(n, "uname"));
for (ParmList *p = parms; p;) { for (ParmList *p = parms; p;) {
StringAppend(ucode, Getattr(p, k_name)); Append(ucode, Getattr(p, k_name));
p = nextSibling(p); p = nextSibling(p);
if (p) if (p)
StringAppend(ucode, ","); Append(ucode, ",");
} }
StringAppend(ucode, "); }"); Append(ucode, "); }");
Setattr(nn, "code", ucode); Setattr(nn, "code", ucode);
Delete(ucode); Delete(ucode);
} }

View file

@ -40,27 +40,27 @@ static int error_as_warning = 0; /* Understand the cpp #error directive as a spe
/* Skip whitespace */ /* Skip whitespace */
static void skip_whitespace(String *s, String *out) { static void skip_whitespace(String *s, String *out) {
int c; int c;
while ((c = StringGetc(s)) != EOF) { while ((c = Getc(s)) != EOF) {
if (!isspace(c)) { if (!isspace(c)) {
StringUngetc(c, s); Ungetc(c, s);
break; break;
} else if (out) } else if (out)
StringPutc(c, out); Putc(c, out);
} }
} }
/* Skip to a specified character taking line breaks into account */ /* Skip to a specified character taking line breaks into account */
static int skip_tochar(String *s, int ch, String *out) { static int skip_tochar(String *s, int ch, String *out) {
int c; int c;
while ((c = StringGetc(s)) != EOF) { while ((c = Getc(s)) != EOF) {
if (out) if (out)
StringPutc(c, out); Putc(c, out);
if (c == ch) if (c == ch)
break; break;
if (c == '\\') { if (c == '\\') {
c = StringGetc(s); c = Getc(s);
if ((c != EOF) && (out)) if ((c != EOF) && (out))
StringPutc(c, out); Putc(c, out);
} }
} }
if (c == EOF) if (c == EOF)
@ -315,16 +315,16 @@ Hash *Preprocessor_define(const String_or_char *_str, int swigmacro) {
/* Now look for a macro name */ /* Now look for a macro name */
macroname = NewStringEmpty(); macroname = NewStringEmpty();
while ((c = StringGetc(str)) != EOF) { while ((c = Getc(str)) != EOF) {
if (c == '(') { if (c == '(') {
argstr = NewStringEmpty(); argstr = NewStringEmpty();
copy_location(str, argstr); copy_location(str, argstr);
/* It is a macro. Go extract its argument string */ /* It is a macro. Go extract its argument string */
while ((c = StringGetc(str)) != EOF) { while ((c = Getc(str)) != EOF) {
if (c == ')') if (c == ')')
break; break;
else else
StringPutc(c, argstr); Putc(c, argstr);
} }
if (c != ')') { if (c != ')') {
Swig_error(Getfile(str), Getline(str), "Missing \')\' in macro parameters\n"); Swig_error(Getfile(str), Getline(str), "Missing \')\' in macro parameters\n");
@ -332,28 +332,28 @@ Hash *Preprocessor_define(const String_or_char *_str, int swigmacro) {
} }
break; break;
} else if (isidchar(c) || (c == '%')) { } else if (isidchar(c) || (c == '%')) {
StringPutc(c, macroname); Putc(c, macroname);
} else if (isspace(c)) { } else if (isspace(c)) {
break; break;
} else if (c == '\\') { } else if (c == '\\') {
c = StringGetc(str); c = Getc(str);
if (c != '\n') { if (c != '\n') {
StringUngetc(c, str); Ungetc(c, str);
StringUngetc('\\', str); Ungetc('\\', str);
break; break;
} }
} else { } else {
/*Swig_error(Getfile(str),Getline(str),"Illegal character in macro name\n"); /*Swig_error(Getfile(str),Getline(str),"Illegal character in macro name\n");
goto macro_error; */ goto macro_error; */
StringUngetc(c, str); Ungetc(c, str);
break; break;
} }
} }
if (!swigmacro) if (!swigmacro)
skip_whitespace(str, 0); skip_whitespace(str, 0);
macrovalue = NewStringEmpty(); macrovalue = NewStringEmpty();
while ((c = StringGetc(str)) != EOF) { while ((c = Getc(str)) != EOF) {
StringPutc(c, macrovalue); Putc(c, macrovalue);
} }
/* If there are any macro arguments, convert into a list */ /* If there are any macro arguments, convert into a list */
@ -362,7 +362,7 @@ Hash *Preprocessor_define(const String_or_char *_str, int swigmacro) {
arglist = NewList(); arglist = NewList();
Seek(argstr, 0, SEEK_SET); Seek(argstr, 0, SEEK_SET);
argname = NewStringEmpty(); argname = NewStringEmpty();
while ((c = StringGetc(argstr)) != EOF) { while ((c = Getc(argstr)) != EOF) {
if (c == ',') { if (c == ',') {
varargname = Macro_vararg_name(argname, str); varargname = Macro_vararg_name(argname, str);
if (varargname) { if (varargname) {
@ -374,7 +374,7 @@ Hash *Preprocessor_define(const String_or_char *_str, int swigmacro) {
Delete(argname); Delete(argname);
argname = NewStringEmpty(); argname = NewStringEmpty();
} else if (isidchar(c) || (c == '.')) { } else if (isidchar(c) || (c == '.')) {
StringPutc(c, argname); Putc(c, argname);
} else if (!(isspace(c) || (c == '\\'))) { } else if (!(isspace(c) || (c == '\\'))) {
Delete(argname); Delete(argname);
Swig_error(Getfile(str), Getline(str), "Illegal character in macro argument name\n"); Swig_error(Getfile(str), Getline(str), "Illegal character in macro argument name\n");
@ -559,45 +559,45 @@ static List *find_args(String *s) {
skip_whitespace(s, 0); skip_whitespace(s, 0);
/* Now see if the next character is a '(' */ /* Now see if the next character is a '(' */
c = StringGetc(s); c = Getc(s);
if (c != '(') { if (c != '(') {
/* Not a macro, bail out now! */ /* Not a macro, bail out now! */
Seek(s, pos, SEEK_SET); Seek(s, pos, SEEK_SET);
Delete(args); Delete(args);
return 0; return 0;
} }
c = StringGetc(s); c = Getc(s);
/* Okay. This appears to be a macro so we will start isolating arguments */ /* Okay. This appears to be a macro so we will start isolating arguments */
while (c != EOF) { while (c != EOF) {
if (isspace(c)) { if (isspace(c)) {
skip_whitespace(s, 0); /* Skip leading whitespace */ skip_whitespace(s, 0); /* Skip leading whitespace */
c = StringGetc(s); c = Getc(s);
} }
str = NewStringEmpty(); str = NewStringEmpty();
copy_location(s, str); copy_location(s, str);
level = 0; level = 0;
while (c != EOF) { while (c != EOF) {
if (c == '\"') { if (c == '\"') {
StringPutc(c, str); Putc(c, str);
skip_tochar(s, '\"', str); skip_tochar(s, '\"', str);
c = StringGetc(s); c = Getc(s);
continue; continue;
} else if (c == '\'') { } else if (c == '\'') {
StringPutc(c, str); Putc(c, str);
skip_tochar(s, '\'', str); skip_tochar(s, '\'', str);
c = StringGetc(s); c = Getc(s);
continue; continue;
} }
if ((c == ',') && (level == 0)) if ((c == ',') && (level == 0))
break; break;
if ((c == ')') && (level == 0)) if ((c == ')') && (level == 0))
break; break;
StringPutc(c, str); Putc(c, str);
if (c == '(') if (c == '(')
level++; level++;
if (c == ')') if (c == ')')
level--; level--;
c = StringGetc(s); c = Getc(s);
} }
if (level > 0) { if (level > 0) {
goto unterm; goto unterm;
@ -612,7 +612,7 @@ static List *find_args(String *s) {
if (c == ')') if (c == ')')
return args; return args;
c = StringGetc(s); c = Getc(s);
} }
unterm: unterm:
Swig_error(Getfile(args), Getline(args), "Unterminated macro call.\n"); Swig_error(Getfile(args), Getline(args), "Unterminated macro call.\n");
@ -633,21 +633,21 @@ static String *get_filename(String *str, int *sysfile) {
skip_whitespace(str, 0); skip_whitespace(str, 0);
fn = NewStringEmpty(); fn = NewStringEmpty();
copy_location(str, fn); copy_location(str, fn);
c = StringGetc(str); c = Getc(str);
*sysfile = 0; *sysfile = 0;
if (c == '\"') { if (c == '\"') {
while (((c = StringGetc(str)) != EOF) && (c != '\"')) while (((c = Getc(str)) != EOF) && (c != '\"'))
StringPutc(c, fn); Putc(c, fn);
} else if (c == '<') { } else if (c == '<') {
*sysfile = 1; *sysfile = 1;
while (((c = StringGetc(str)) != EOF) && (c != '>')) while (((c = Getc(str)) != EOF) && (c != '>'))
StringPutc(c, fn); Putc(c, fn);
} else { } else {
StringPutc(c, fn); Putc(c, fn);
while (((c = StringGetc(str)) != EOF) && (!isspace(c))) while (((c = Getc(str)) != EOF) && (!isspace(c)))
StringPutc(c, fn); Putc(c, fn);
if (isspace(c)) if (isspace(c))
StringUngetc(c, str); Ungetc(c, str);
} }
#if defined(_WIN32) || defined(MACSWIG) #if defined(_WIN32) || defined(MACSWIG)
/* accept Unix path separator on non-Unix systems */ /* accept Unix path separator on non-Unix systems */
@ -665,13 +665,13 @@ static String *get_options(String *str) {
int c; int c;
skip_whitespace(str, 0); skip_whitespace(str, 0);
c = StringGetc(str); c = Getc(str);
if (c == '(') { if (c == '(') {
String *opt; String *opt;
int level = 1; int level = 1;
opt = NewString("("); opt = NewString("(");
while (((c = StringGetc(str)) != EOF)) { while (((c = Getc(str)) != EOF)) {
StringPutc(c, opt); Putc(c, opt);
if (c == ')') { if (c == ')') {
level--; level--;
if (!level) if (!level)
@ -683,7 +683,7 @@ static String *get_options(String *str) {
Delete(opt); Delete(opt);
return 0; return 0;
} else { } else {
StringUngetc(c, str); Ungetc(c, str);
return 0; return 0;
} }
} }
@ -712,18 +712,18 @@ static String *expand_macro(String *name, List *args) {
return 0; return 0;
if (Getattr(macro, kpp_expanded)) { if (Getattr(macro, kpp_expanded)) {
ns = NewStringEmpty(); ns = NewStringEmpty();
StringAppend(ns, name); Append(ns, name);
if (args) { if (args) {
int lenargs = Len(args); int lenargs = Len(args);
if (lenargs) if (lenargs)
StringPutc('(', ns); Putc('(', ns);
for (i = 0; i < lenargs; i++) { for (i = 0; i < lenargs; i++) {
StringAppend(ns, Getitem(args, i)); Append(ns, Getitem(args, i));
if (i < (lenargs - 1)) if (i < (lenargs - 1))
StringPutc(',', ns); Putc(',', ns);
} }
if (i) if (i)
StringPutc(')', ns); Putc(')', ns);
} }
return ns; return ns;
} }
@ -743,9 +743,9 @@ static String *expand_macro(String *name, List *args) {
vi = Len(margs) - 1; vi = Len(margs) - 1;
na = Len(args); na = Len(args);
for (i = vi; i < na; i++) { for (i = vi; i < na; i++) {
StringAppend(vararg, Getitem(args, i)); Append(vararg, Getitem(args, i));
if ((i + 1) < na) { if ((i + 1) < na) {
StringAppend(vararg, ","); Append(vararg, ",");
} }
} }
/* Remove arguments */ /* Remove arguments */
@ -789,7 +789,7 @@ static String *expand_macro(String *name, List *args) {
arg = Getitem(args, i); /* Get an argument value */ arg = Getitem(args, i); /* Get an argument value */
reparg = Preprocessor_replace(arg); reparg = Preprocessor_replace(arg);
aname = Getitem(margs, i); /* Get macro argument name */ aname = Getitem(margs, i); /* Get macro argument name */
if (strstr(StringChar(ns), "\001")) { if (strstr(Char(ns), "\001")) {
/* Try to replace a quoted version of the argument */ /* Try to replace a quoted version of the argument */
Clear(temp); Clear(temp);
Clear(tempa); Clear(tempa);
@ -797,17 +797,17 @@ static String *expand_macro(String *name, List *args) {
Printf(tempa, "\"%s\"", arg); Printf(tempa, "\"%s\"", arg);
Replace(ns, temp, tempa, DOH_REPLACE_ID_END); Replace(ns, temp, tempa, DOH_REPLACE_ID_END);
} }
if (strstr(StringChar(ns), "\002")) { if (strstr(Char(ns), "\002")) {
/* Look for concatenation tokens */ /* Look for concatenation tokens */
Clear(temp); Clear(temp);
Clear(tempa); Clear(tempa);
Printf(temp, "\002%s", aname); Printf(temp, "\002%s", aname);
StringAppend(tempa, "\002\003"); Append(tempa, "\002\003");
Replace(ns, temp, tempa, DOH_REPLACE_ID_END); Replace(ns, temp, tempa, DOH_REPLACE_ID_END);
Clear(temp); Clear(temp);
Clear(tempa); Clear(tempa);
Printf(temp, "%s\002", aname); Printf(temp, "%s\002", aname);
StringAppend(tempa, "\003\002"); Append(tempa, "\003\002");
Replace(ns, temp, tempa, DOH_REPLACE_ID_BEGIN); Replace(ns, temp, tempa, DOH_REPLACE_ID_BEGIN);
} }
@ -815,7 +815,7 @@ static String *expand_macro(String *name, List *args) {
version of the argument except that if the argument is already quoted version of the argument except that if the argument is already quoted
nothing happens */ nothing happens */
if (strchr(StringChar(ns), '`')) { if (strchr(Char(ns), '`')) {
String *rep; String *rep;
char *c; char *c;
Clear(temp); Clear(temp);
@ -833,14 +833,14 @@ static String *expand_macro(String *name, List *args) {
/* Non-standard mangle expansions. /* Non-standard mangle expansions.
The #@Name is replaced by mangle_arg(Name). */ The #@Name is replaced by mangle_arg(Name). */
if (strstr(StringChar(ns), "\004")) { if (strstr(Char(ns), "\004")) {
String *marg = Swig_string_mangle(arg); String *marg = Swig_string_mangle(arg);
Clear(temp); Clear(temp);
Printf(temp, "\004%s", aname); Printf(temp, "\004%s", aname);
Replace(ns, temp, marg, DOH_REPLACE_ID_END); Replace(ns, temp, marg, DOH_REPLACE_ID_END);
Delete(marg); Delete(marg);
} }
if (strstr(StringChar(ns), "\005")) { if (strstr(Char(ns), "\005")) {
String *marg = Swig_string_mangle(arg); String *marg = Swig_string_mangle(arg);
Clear(temp); Clear(temp);
Clear(tempa); Clear(tempa);
@ -854,7 +854,7 @@ static String *expand_macro(String *name, List *args) {
/* Zero length varargs macro argument. We search for commas that might appear before and nuke them */ /* Zero length varargs macro argument. We search for commas that might appear before and nuke them */
char *a, *s, *t, *name; char *a, *s, *t, *name;
int namelen; int namelen;
s = StringChar(ns); s = Char(ns);
name = Char(aname); name = Char(aname);
namelen = Len(aname); namelen = Len(aname);
a = strstr(s, name); a = strstr(s, name);
@ -911,7 +911,7 @@ static String *expand_macro(String *name, List *args) {
if (strchr(Char(g), '\n')) { if (strchr(Char(g), '\n')) {
Printf(f, "/*@SWIG:%s@*/%s/*@SWIG@*/", name, g); Printf(f, "/*@SWIG:%s@*/%s/*@SWIG@*/", name, g);
} else { } else {
StringAppend(f, g); Append(f, g);
} }
#endif #endif
@ -966,53 +966,53 @@ DOH *Preprocessor_replace(DOH *s) {
Seek(s, 0, SEEK_SET); Seek(s, 0, SEEK_SET);
/* Try to locate identifiers in s and replace them with macro replacements */ /* Try to locate identifiers in s and replace them with macro replacements */
while ((c = StringGetc(s)) != EOF) { while ((c = Getc(s)) != EOF) {
switch (state) { switch (state) {
case 0: case 0:
if (isidentifier(c) || (c == '%')) { if (isidentifier(c) || (c == '%')) {
Clear(id); Clear(id);
StringPutc(c, id); Putc(c, id);
state = 1; state = 1;
} else if (c == '\"') { } else if (c == '\"') {
StringPutc(c, ns); Putc(c, ns);
skip_tochar(s, '\"', ns); skip_tochar(s, '\"', ns);
} else if (c == '\'') { } else if (c == '\'') {
StringPutc(c, ns); Putc(c, ns);
skip_tochar(s, '\'', ns); skip_tochar(s, '\'', ns);
} else if (c == '/') { } else if (c == '/') {
StringPutc(c, ns); Putc(c, ns);
state = 10; state = 10;
} else { } else {
StringPutc(c, ns); Putc(c, ns);
} }
break; break;
case 1: /* An identifier */ case 1: /* An identifier */
if (isidchar(c)) { if (isidchar(c)) {
StringPutc(c, id); Putc(c, id);
state = 1; state = 1;
} else { } else {
/* We found the end of a valid identifier */ /* We found the end of a valid identifier */
StringUngetc(c, s); Ungetc(c, s);
/* See if this is the special "defined" macro */ /* See if this is the special "defined" macro */
if (StringEqual(kpp_defined, id)) { if (Equal(kpp_defined, id)) {
int lenargs = 0; int lenargs = 0;
DOH *args = 0; DOH *args = 0;
/* See whether or not a paranthesis has been used */ /* See whether or not a paranthesis has been used */
skip_whitespace(s, 0); skip_whitespace(s, 0);
c = StringGetc(s); c = Getc(s);
if (c == '(') { if (c == '(') {
StringUngetc(c, s); Ungetc(c, s);
args = find_args(s); args = find_args(s);
} else if (isidchar(c)) { } else if (isidchar(c)) {
DOH *arg = NewStringEmpty(); DOH *arg = NewStringEmpty();
args = NewList(); args = NewList();
StringPutc(c, arg); Putc(c, arg);
while (((c = StringGetc(s)) != EOF)) { while (((c = Getc(s)) != EOF)) {
if (!isidchar(c)) { if (!isidchar(c)) {
StringUngetc(c, s); Ungetc(c, s);
break; break;
} }
StringPutc(c, arg); Putc(c, arg);
} }
if (Len(arg)) if (Len(arg))
Append(args, arg); Append(args, arg);
@ -1023,7 +1023,7 @@ DOH *Preprocessor_replace(DOH *s) {
lenargs = Len(args); lenargs = Len(args);
if ((!args) || (!lenargs)) { if ((!args) || (!lenargs)) {
/* This is not a defined() macro. */ /* This is not a defined() macro. */
StringAppend(ns, id); Append(ns, id);
state = 0; state = 0;
break; break;
} }
@ -1034,19 +1034,19 @@ DOH *Preprocessor_replace(DOH *s) {
} }
} }
if (i < lenargs) if (i < lenargs)
StringPutc('0', ns); Putc('0', ns);
else else
StringPutc('1', ns); Putc('1', ns);
Delete(args); Delete(args);
state = 0; state = 0;
break; break;
} }
if (StringEqual(kpp_LINE, id)) { if (Equal(kpp_LINE, id)) {
Printf(ns, "%d", Getline(s)); Printf(ns, "%d", Getline(s));
state = 0; state = 0;
break; break;
} }
if (StringEqual(kpp_FILE, id)) { if (Equal(kpp_FILE, id)) {
String *fn = Copy(Getfile(s)); String *fn = Copy(Getfile(s));
Replaceall(fn, "\\", "\\\\"); Replaceall(fn, "\\", "\\\\");
Printf(ns, "\"%s\"", fn); Printf(ns, "\"%s\"", fn);
@ -1071,12 +1071,12 @@ DOH *Preprocessor_replace(DOH *s) {
} }
e = expand_macro(id, args); e = expand_macro(id, args);
if (e) { if (e) {
StringAppend(ns, e); Append(ns, e);
} }
Delete(e); Delete(e);
Delete(args); Delete(args);
} else { } else {
StringAppend(ns, id); Append(ns, id);
} }
state = 0; state = 0;
} }
@ -1087,24 +1087,24 @@ DOH *Preprocessor_replace(DOH *s) {
else if (c == '*') else if (c == '*')
state = 12; state = 12;
else { else {
StringUngetc(c, s); Ungetc(c, s);
state = 0; state = 0;
break; break;
} }
StringPutc(c, ns); Putc(c, ns);
break; break;
case 11: case 11:
StringPutc(c, ns); Putc(c, ns);
if (c == '\n') if (c == '\n')
state = 0; state = 0;
break; break;
case 12: case 12:
StringPutc(c, ns); Putc(c, ns);
if (c == '*') if (c == '*')
state = 13; state = 13;
break; break;
case 13: case 13:
StringPutc(c, ns); Putc(c, ns);
if (c == '/') if (c == '/')
state = 0; state = 0;
else if (c != '*') else if (c != '*')
@ -1119,7 +1119,7 @@ DOH *Preprocessor_replace(DOH *s) {
/* Identifier at the end */ /* Identifier at the end */
if (state == 1) { if (state == 1) {
/* See if this is the special "defined" macro */ /* See if this is the special "defined" macro */
if (StringEqual(kpp_defined, id)) { if (Equal(kpp_defined, id)) {
Swig_error(Getfile(s), Getline(s), "No arguments given to defined()\n"); Swig_error(Getfile(s), Getline(s), "No arguments given to defined()\n");
} else if ((m = Getattr(symbols, id))) { } else if ((m = Getattr(symbols, id))) {
DOH *e; DOH *e;
@ -1129,10 +1129,10 @@ DOH *Preprocessor_replace(DOH *s) {
Swig_error(Getfile(id),Getline(id),"Macro arguments expected.\n"); Swig_error(Getfile(id),Getline(id),"Macro arguments expected.\n");
} */ } */
e = expand_macro(id, 0); e = expand_macro(id, 0);
StringAppend(ns, e); Append(ns, e);
Delete(e); Delete(e);
} else { } else {
StringAppend(ns, id); Append(ns, id);
} }
} }
Delete(id); Delete(id);
@ -1171,12 +1171,12 @@ static int checkpp_id(DOH *s) {
/* addline(). Utility function for adding lines to a chunk */ /* addline(). Utility function for adding lines to a chunk */
static void addline(DOH *s1, DOH *s2, int allow) { static void addline(DOH *s1, DOH *s2, int allow) {
if (allow) { if (allow) {
StringAppend(s1, s2); Append(s1, s2);
} else { } else {
char *c = Char(s2); char *c = Char(s2);
while (*c) { while (*c) {
if (*c == '\n') if (*c == '\n')
StringPutc('\n', s1); Putc('\n', s1);
c++; c++;
} }
} }
@ -1257,7 +1257,7 @@ String *Preprocessor_parse(String *s) {
symbols = Getattr(cpp, kpp_symbols); symbols = Getattr(cpp, kpp_symbols);
state = 0; state = 0;
while ((c = StringGetc(s)) != EOF) { while ((c = Getc(s)) != EOF) {
switch (state) { switch (state) {
case 0: /* Initial state - in first column */ case 0: /* Initial state - in first column */
/* Look for C preprocessor directives. Otherwise, go directly to state 1 */ /* Look for C preprocessor directives. Otherwise, go directly to state 1 */
@ -1267,11 +1267,11 @@ String *Preprocessor_parse(String *s) {
cpp_lines = 1; cpp_lines = 1;
state = 40; state = 40;
} else if (isspace(c)) { } else if (isspace(c)) {
StringPutc(c, chunk); Putc(c, chunk);
skip_whitespace(s, chunk); skip_whitespace(s, chunk);
} else { } else {
state = 1; state = 1;
StringUngetc(c, s); Ungetc(c, s);
} }
break; break;
case 1: /* Non-preprocessor directive */ case 1: /* Non-preprocessor directive */
@ -1280,7 +1280,7 @@ String *Preprocessor_parse(String *s) {
state = 100; state = 100;
break; break;
} }
StringPutc(c, chunk); Putc(c, chunk);
if (c == '\n') if (c == '\n')
state = 0; state = 0;
else if (c == '\"') { else if (c == '\"') {
@ -1299,7 +1299,7 @@ String *Preprocessor_parse(String *s) {
case 30: /* Possibly a comment string of some sort */ case 30: /* Possibly a comment string of some sort */
start_line = Getline(s); start_line = Getline(s);
StringPutc(c, chunk); Putc(c, chunk);
if (c == '/') if (c == '/')
state = 31; state = 31;
else if (c == '*') else if (c == '*')
@ -1308,17 +1308,17 @@ String *Preprocessor_parse(String *s) {
state = 1; state = 1;
break; break;
case 31: case 31:
StringPutc(c, chunk); Putc(c, chunk);
if (c == '\n') if (c == '\n')
state = 0; state = 0;
break; break;
case 32: case 32:
StringPutc(c, chunk); Putc(c, chunk);
if (c == '*') if (c == '*')
state = 33; state = 33;
break; break;
case 33: case 33:
StringPutc(c, chunk); Putc(c, chunk);
if (c == '/') if (c == '/')
state = 1; state = 1;
else if (c != '*') else if (c != '*')
@ -1327,13 +1327,13 @@ String *Preprocessor_parse(String *s) {
case 40: /* Start of a C preprocessor directive */ case 40: /* Start of a C preprocessor directive */
if (c == '\n') { if (c == '\n') {
StringPutc('\n', chunk); Putc('\n', chunk);
state = 0; state = 0;
} else if (isspace(c)) { } else if (isspace(c)) {
state = 40; state = 40;
} else { } else {
/* Got the start of a preprocessor directive */ /* Got the start of a preprocessor directive */
StringUngetc(c, s); Ungetc(c, s);
Clear(id); Clear(id);
copy_location(s, id); copy_location(s, id);
state = 41; state = 41;
@ -1345,25 +1345,25 @@ String *Preprocessor_parse(String *s) {
Clear(value); Clear(value);
Clear(comment); Clear(comment);
if (c == '\n') { if (c == '\n') {
StringUngetc(c, s); Ungetc(c, s);
state = 50; state = 50;
} else { } else {
state = 42; state = 42;
if (!isspace(c)) { if (!isspace(c)) {
StringUngetc(c, s); Ungetc(c, s);
} }
} }
copy_location(s, value); copy_location(s, value);
break; break;
} }
StringPutc(c, id); Putc(c, id);
break; break;
case 42: /* Strip any leading space before preprocessor value */ case 42: /* Strip any leading space before preprocessor value */
if (isspace(c)) { if (isspace(c)) {
if (c == '\n') { if (c == '\n') {
StringUngetc(c, s); Ungetc(c, s);
state = 50; state = 50;
} }
break; break;
@ -1374,18 +1374,18 @@ String *Preprocessor_parse(String *s) {
case 43: case 43:
/* Get preprocessor value */ /* Get preprocessor value */
if (c == '\n') { if (c == '\n') {
StringUngetc(c, s); Ungetc(c, s);
state = 50; state = 50;
} else if (c == '/') { } else if (c == '/') {
state = 45; state = 45;
} else if (c == '\"') { } else if (c == '\"') {
StringPutc(c, value); Putc(c, value);
skip_tochar(s, '\"', value); skip_tochar(s, '\"', value);
} else if (c == '\'') { } else if (c == '\'') {
StringPutc(c, value); Putc(c, value);
skip_tochar(s, '\'', value); skip_tochar(s, '\'', value);
} else { } else {
StringPutc(c, value); Putc(c, value);
if (c == '\\') if (c == '\\')
state = 44; state = 44;
} }
@ -1393,10 +1393,10 @@ String *Preprocessor_parse(String *s) {
case 44: case 44:
if (c == '\n') { if (c == '\n') {
StringPutc(c, value); Putc(c, value);
cpp_lines++; cpp_lines++;
} else { } else {
StringUngetc(c, s); Ungetc(c, s);
} }
state = 43; state = 43;
break; break;
@ -1410,45 +1410,45 @@ String *Preprocessor_parse(String *s) {
else if (c == '*') else if (c == '*')
state = 47; state = 47;
else if (c == '\n') { else if (c == '\n') {
StringPutc('/', value); Putc('/', value);
StringUngetc(c, s); Ungetc(c, s);
cpp_lines++; cpp_lines++;
state = 50; state = 50;
} else { } else {
StringPutc('/', value); Putc('/', value);
StringPutc(c, value); Putc(c, value);
state = 43; state = 43;
} }
break; break;
case 46: case 46:
if (c == '\n') { if (c == '\n') {
StringUngetc(c, s); Ungetc(c, s);
cpp_lines++; cpp_lines++;
state = 50; state = 50;
} else } else
StringPutc(c, comment); Putc(c, comment);
break; break;
case 47: case 47:
if (c == '*') if (c == '*')
state = 48; state = 48;
else else
StringPutc(c, comment); Putc(c, comment);
break; break;
case 48: case 48:
if (c == '/') if (c == '/')
state = 43; state = 43;
else if (c == '*') else if (c == '*')
StringPutc(c, comment); Putc(c, comment);
else { else {
StringPutc('*', comment); Putc('*', comment);
StringPutc(c, comment); Putc(c, comment);
state = 47; state = 47;
} }
break; break;
case 50: case 50:
/* Check for various preprocessor directives */ /* Check for various preprocessor directives */
Chop(value); Chop(value);
if (StringEqual(id, kpp_define)) { if (Equal(id, kpp_define)) {
if (allow) { if (allow) {
DOH *m, *v, *v1; DOH *m, *v, *v1;
Seek(value, 0, SEEK_SET); Seek(value, 0, SEEK_SET);
@ -1472,10 +1472,10 @@ String *Preprocessor_parse(String *s) {
Delete(v); Delete(v);
} }
} }
} else if (StringEqual(id, kpp_undef)) { } else if (Equal(id, kpp_undef)) {
if (allow) if (allow)
Preprocessor_undef(value); Preprocessor_undef(value);
} else if (StringEqual(id, kpp_ifdef)) { } else if (Equal(id, kpp_ifdef)) {
cond_lines[level] = Getline(id); cond_lines[level] = Getline(id);
level++; level++;
if (allow) { if (allow) {
@ -1485,7 +1485,7 @@ String *Preprocessor_parse(String *s) {
allow = 0; allow = 0;
mask = 1; mask = 1;
} }
} else if (StringEqual(id, kpp_ifndef)) { } else if (Equal(id, kpp_ifndef)) {
cond_lines[level] = Getline(id); cond_lines[level] = Getline(id);
level++; level++;
if (allow) { if (allow) {
@ -1495,7 +1495,7 @@ String *Preprocessor_parse(String *s) {
allow = 0; allow = 0;
mask = 1; mask = 1;
} }
} else if (StringEqual(id, kpp_else)) { } else if (Equal(id, kpp_else)) {
if (level <= 0) { if (level <= 0) {
Swig_error(Getfile(s), Getline(id), "Misplaced #else.\n"); Swig_error(Getfile(s), Getline(id), "Misplaced #else.\n");
} else { } else {
@ -1507,7 +1507,7 @@ String *Preprocessor_parse(String *s) {
allow = 1 * mask; allow = 1 * mask;
} }
} }
} else if (StringEqual(id, kpp_endif)) { } else if (Equal(id, kpp_endif)) {
level--; level--;
if (level < 0) { if (level < 0) {
Swig_error(Getfile(id), Getline(id), "Extraneous #endif.\n"); Swig_error(Getfile(id), Getline(id), "Extraneous #endif.\n");
@ -1518,7 +1518,7 @@ String *Preprocessor_parse(String *s) {
start_level--; start_level--;
} }
} }
} else if (StringEqual(id, kpp_if)) { } else if (Equal(id, kpp_if)) {
cond_lines[level] = Getline(id); cond_lines[level] = Getline(id);
level++; level++;
if (allow) { if (allow) {
@ -1541,7 +1541,7 @@ String *Preprocessor_parse(String *s) {
} }
mask = 1; mask = 1;
} }
} else if (StringEqual(id, kpp_elif)) { } else if (Equal(id, kpp_elif)) {
if (level == 0) { if (level == 0) {
Swig_error(Getfile(s), Getline(id), "Misplaced #elif.\n"); Swig_error(Getfile(s), Getline(id), "Misplaced #elif.\n");
} else { } else {
@ -1569,11 +1569,11 @@ String *Preprocessor_parse(String *s) {
} }
} }
} }
} else if (StringEqual(id, kpp_warning)) { } else if (Equal(id, kpp_warning)) {
if (allow) { if (allow) {
Swig_warning(WARN_PP_CPP_WARNING, Getfile(s), Getline(id), "CPP #warning, %s\n", value); Swig_warning(WARN_PP_CPP_WARNING, Getfile(s), Getline(id), "CPP #warning, %s\n", value);
} }
} else if (StringEqual(id, kpp_error)) { } else if (Equal(id, kpp_error)) {
if (allow) { if (allow) {
if (error_as_warning) { if (error_as_warning) {
Swig_warning(WARN_PP_CPP_ERROR, Getfile(s), Getline(id), "CPP #error \"%s\".\n", value); Swig_warning(WARN_PP_CPP_ERROR, Getfile(s), Getline(id), "CPP #error \"%s\".\n", value);
@ -1581,8 +1581,8 @@ String *Preprocessor_parse(String *s) {
Swig_error(Getfile(s), Getline(id), "CPP #error \"%s\". Use the -cpperraswarn option to continue swig processing.\n", value); Swig_error(Getfile(s), Getline(id), "CPP #error \"%s\". Use the -cpperraswarn option to continue swig processing.\n", value);
} }
} }
} else if (StringEqual(id, kpp_line)) { } else if (Equal(id, kpp_line)) {
} else if (StringEqual(id, kpp_include)) { } else if (Equal(id, kpp_include)) {
if (((include_all) || (import_all)) && (allow)) { if (((include_all) || (import_all)) && (allow)) {
String *s1, *s2, *fn; String *s1, *s2, *fn;
char *dirname; char *dirname;
@ -1612,7 +1612,7 @@ String *Preprocessor_parse(String *s) {
} }
s2 = Preprocessor_parse(s1); s2 = Preprocessor_parse(s1);
addline(ns, s2, allow); addline(ns, s2, allow);
StringAppend(ns, "\n]"); Append(ns, "\n]");
if (dirname) { if (dirname) {
Swig_pop_directory(); Swig_pop_directory();
} }
@ -1624,7 +1624,7 @@ String *Preprocessor_parse(String *s) {
Delete(s1); Delete(s1);
Delete(fn); Delete(fn);
} }
} else if (StringEqual(id, kpp_pragma)) { } else if (Equal(id, kpp_pragma)) {
if (Strncmp(value, "SWIG ", 5) == 0) { if (Strncmp(value, "SWIG ", 5) == 0) {
char *c = Char(value) + 5; char *c = Char(value) + 5;
while (*c && (isspace((int) *c))) while (*c && (isspace((int) *c)))
@ -1641,11 +1641,11 @@ String *Preprocessor_parse(String *s) {
} }
} }
} }
} else if (StringEqual(id, kpp_level)) { } else if (Equal(id, kpp_level)) {
Swig_error(Getfile(s), Getline(id), "cpp debug: level = %d, startlevel = %d\n", level, start_level); Swig_error(Getfile(s), Getline(id), "cpp debug: level = %d, startlevel = %d\n", level, start_level);
} }
for (i = 0; i < cpp_lines; i++) for (i = 0; i < cpp_lines; i++)
StringPutc('\n', ns); Putc('\n', ns);
state = 0; state = 0;
break; break;
@ -1656,35 +1656,35 @@ String *Preprocessor_parse(String *s) {
start_line = Getline(s); start_line = Getline(s);
add_chunk(ns, chunk, allow); add_chunk(ns, chunk, allow);
copy_location(s, chunk); copy_location(s, chunk);
StringPutc('%', chunk); Putc('%', chunk);
StringPutc(c, chunk); Putc(c, chunk);
state = 105; state = 105;
} }
/* %#cpp - an embedded C preprocessor directive (we strip off the %) */ /* %#cpp - an embedded C preprocessor directive (we strip off the %) */
else if (c == '#') { else if (c == '#') {
add_chunk(ns, chunk, allow); add_chunk(ns, chunk, allow);
StringPutc(c, chunk); Putc(c, chunk);
state = 107; state = 107;
} else if (isidentifier(c)) { } else if (isidentifier(c)) {
Clear(decl); Clear(decl);
StringPutc('%', decl); Putc('%', decl);
StringPutc(c, decl); Putc(c, decl);
state = 110; state = 110;
} else { } else {
StringPutc('%', chunk); Putc('%', chunk);
StringPutc(c, chunk); Putc(c, chunk);
state = 1; state = 1;
} }
break; break;
case 105: case 105:
StringPutc(c, chunk); Putc(c, chunk);
if (c == '%') if (c == '%')
state = 106; state = 106;
break; break;
case 106: case 106:
StringPutc(c, chunk); Putc(c, chunk);
if (c == '}') { if (c == '}') {
state = 1; state = 1;
addline(ns, chunk, allow); addline(ns, chunk, allow);
@ -1696,7 +1696,7 @@ String *Preprocessor_parse(String *s) {
break; break;
case 107: case 107:
StringPutc(c, chunk); Putc(c, chunk);
if (c == '\n') { if (c == '\n') {
addline(ns, chunk, allow); addline(ns, chunk, allow);
Clear(chunk); Clear(chunk);
@ -1707,24 +1707,24 @@ String *Preprocessor_parse(String *s) {
break; break;
case 108: case 108:
StringPutc(c, chunk); Putc(c, chunk);
state = 107; state = 107;
break; break;
case 110: case 110:
if (!isidchar(c)) { if (!isidchar(c)) {
StringUngetc(c, s); Ungetc(c, s);
/* Look for common Swig directives */ /* Look for common Swig directives */
if (StringEqual(decl, kpp_dinclude) || StringEqual(decl, kpp_dimport) || StringEqual(decl, kpp_dextern)) { if (Equal(decl, kpp_dinclude) || Equal(decl, kpp_dimport) || Equal(decl, kpp_dextern)) {
/* Got some kind of file inclusion directive */ /* Got some kind of file inclusion directive */
if (allow) { if (allow) {
DOH *s1, *s2, *fn, *opt; DOH *s1, *s2, *fn, *opt;
int sysfile = 0; int sysfile = 0;
if (StringEqual(decl, kpp_dextern)) { if (Equal(decl, kpp_dextern)) {
Swig_warning(WARN_DEPRECATED_EXTERN, Getfile(s), Getline(s), "%%extern is deprecated. Use %%import instead.\n"); Swig_warning(WARN_DEPRECATED_EXTERN, Getfile(s), Getline(s), "%%extern is deprecated. Use %%import instead.\n");
Clear(decl); Clear(decl);
StringAppend(decl, "%%import"); Append(decl, "%%import");
} }
opt = get_options(s); opt = get_options(s);
fn = get_filename(s, &sysfile); fn = get_filename(s, &sysfile);
@ -1734,7 +1734,7 @@ String *Preprocessor_parse(String *s) {
add_chunk(ns, chunk, allow); add_chunk(ns, chunk, allow);
copy_location(s, chunk); copy_location(s, chunk);
Printf(ns, "%sfile%s \"%s\" [\n", decl, opt, Swig_last_file()); Printf(ns, "%sfile%s \"%s\" [\n", decl, opt, Swig_last_file());
if (StringEqual(decl, kpp_dimport)) { if (Equal(decl, kpp_dimport)) {
push_imported(); push_imported();
} }
dirname = Swig_file_dirname(Swig_last_file()); dirname = Swig_file_dirname(Swig_last_file());
@ -1748,21 +1748,21 @@ String *Preprocessor_parse(String *s) {
if (dirname) { if (dirname) {
Swig_pop_directory(); Swig_pop_directory();
} }
if (StringEqual(decl, kpp_dimport)) { if (Equal(decl, kpp_dimport)) {
pop_imported(); pop_imported();
} }
addline(ns, s2, allow); addline(ns, s2, allow);
StringAppend(ns, "\n]"); Append(ns, "\n]");
Delete(s2); Delete(s2);
Delete(s1); Delete(s1);
} }
Delete(fn); Delete(fn);
} }
state = 1; state = 1;
} else if (StringEqual(decl, kpp_dline)) { } else if (Equal(decl, kpp_dline)) {
/* Got a line directive */ /* Got a line directive */
state = 1; state = 1;
} else if (StringEqual(decl, kpp_ddefine)) { } else if (Equal(decl, kpp_ddefine)) {
/* Got a define directive */ /* Got a define directive */
dlevel++; dlevel++;
add_chunk(ns, chunk, allow); add_chunk(ns, chunk, allow);
@ -1771,31 +1771,31 @@ String *Preprocessor_parse(String *s) {
copy_location(s, value); copy_location(s, value);
state = 150; state = 150;
} else { } else {
StringAppend(chunk, decl); Append(chunk, decl);
state = 1; state = 1;
} }
} else { } else {
StringPutc(c, decl); Putc(c, decl);
} }
break; break;
/* Searching for the end of a %define statement */ /* Searching for the end of a %define statement */
case 150: case 150:
StringPutc(c, value); Putc(c, value);
if (c == '%') { if (c == '%') {
const char *ed = "enddef"; const char *ed = "enddef";
const char *df = "define"; const char *df = "define";
char statement[7]; char statement[7];
int i = 0; int i = 0;
for (i = 0; i < 6;) { for (i = 0; i < 6;) {
c = StringGetc(s); c = Getc(s);
StringPutc(c, value); Putc(c, value);
statement[i++] = c; statement[i++] = c;
if (strncmp(statement, ed, i) && strncmp(statement, df, i)) if (strncmp(statement, ed, i) && strncmp(statement, df, i))
break; break;
} }
c = StringGetc(s); c = Getc(s);
StringUngetc(c, s); Ungetc(c, s);
if ((i == 6) && (isspace(c))) { if ((i == 6) && (isspace(c))) {
if (strncmp(statement, df, i) == 0) { if (strncmp(statement, df, i) == 0) {
++dlevel; ++dlevel;
@ -1811,7 +1811,7 @@ String *Preprocessor_parse(String *s) {
Seek(value, 0, SEEK_SET); Seek(value, 0, SEEK_SET);
Preprocessor_define(value, 1); Preprocessor_define(value, 1);
} }
/* StringPutc('\n',ns); */ /* Putc('\n',ns); */
addline(ns, value, 0); addline(ns, value, 0);
state = 0; state = 0;
} }

View file

@ -510,7 +510,7 @@ String *Swig_cppconstructor_base_call(String_or_char *name, ParmList *parms, int
String *pname = 0; String *pname = 0;
if (comma) if (comma)
Append(func, ","); Append(func, ",");
if (!Getattr(p, k_argbyname)) { if (!Getattr(p, "arg:byname")) {
pname = Swig_cparm_name(p, i); pname = Swig_cparm_name(p, i);
i++; i++;
} else { } else {
@ -806,8 +806,8 @@ int Swig_MethodToFunction(Node *n, String *classname, int flags, SwigType *direc
SwigType_push(type, qualifier); SwigType_push(type, qualifier);
} }
SwigType_add_pointer(type); SwigType_add_pointer(type);
p = NewParm(type, k_self); p = NewParm(type, "self");
Setattr(p, k_self, "1"); Setattr(p, "self", "1");
Setattr(p, k_hidden, "1"); Setattr(p, k_hidden, "1");
/* /*
Disable the 'this' ownership in 'self' to manage inplace Disable the 'this' ownership in 'self' to manage inplace
@ -910,7 +910,7 @@ int Swig_MethodToFunction(Node *n, String *classname, int flags, SwigType *direc
/* See if there is any code that we need to emit */ /* See if there is any code that we need to emit */
if (!defaultargs && code && !is_smart_pointer) { if (!defaultargs && code && !is_smart_pointer) {
Swig_add_extension_code(n, mangled, p, type, code, cparse_cplusplus, k_self); Swig_add_extension_code(n, mangled, p, type, code, cparse_cplusplus, "self");
} }
if (is_smart_pointer) { if (is_smart_pointer) {
int i = 0; int i = 0;
@ -984,7 +984,7 @@ Node *Swig_methodclass(Node *n) {
int Swig_directorclass(Node *n) { int Swig_directorclass(Node *n) {
Node *classNode = Swig_methodclass(n); Node *classNode = Swig_methodclass(n);
assert(classNode != 0); assert(classNode != 0);
return (Getattr(classNode, k_vtable) != 0); return (Getattr(classNode, "vtable") != 0);
} }
Node *Swig_directormap(Node *module, String *type) { Node *Swig_directormap(Node *module, String *type) {
@ -1060,7 +1060,7 @@ int Swig_ConstructorToFunction(Node *n, String *classname, String *none_comparis
/* See if there is any code that we need to emit */ /* See if there is any code that we need to emit */
if (!defaultargs && code) { if (!defaultargs && code) {
Swig_add_extension_code(n, mangled, parms, type, code, cparse_cplusplus, k_self); Swig_add_extension_code(n, mangled, parms, type, code, cparse_cplusplus, "self");
} }
call = Swig_cfunction_call(mangled, parms); call = Swig_cfunction_call(mangled, parms);
@ -1158,8 +1158,8 @@ int Swig_DestructorToFunction(Node *n, String *classname, int cplus, int flags)
type = NewString(classname); type = NewString(classname);
SwigType_add_pointer(type); SwigType_add_pointer(type);
p = NewParm(type, k_self); p = NewParm(type, "self");
Setattr(p, k_self, "1"); Setattr(p, "self", "1");
Setattr(p, k_hidden, "1"); Setattr(p, k_hidden, "1");
Setattr(p, k_wrapdisown, "1"); Setattr(p, k_wrapdisown, "1");
Delete(type); Delete(type);
@ -1173,7 +1173,7 @@ int Swig_DestructorToFunction(Node *n, String *classname, int cplus, int flags)
mangled = Swig_name_mangle(membername); mangled = Swig_name_mangle(membername);
code = Getattr(n, k_code); code = Getattr(n, k_code);
if (code) { if (code) {
Swig_add_extension_code(n, mangled, p, type, code, cparse_cplusplus, k_self); Swig_add_extension_code(n, mangled, p, type, code, cparse_cplusplus, "self");
} }
call = Swig_cfunction_call(mangled, p); call = Swig_cfunction_call(mangled, p);
cres = NewStringf("%s;\n", call); cres = NewStringf("%s;\n", call);
@ -1238,8 +1238,8 @@ int Swig_MembersetToFunction(Node *n, String *classname, int flags) {
t = NewString(classname); t = NewString(classname);
SwigType_add_pointer(t); SwigType_add_pointer(t);
parms = NewParm(t, k_self); parms = NewParm(t, "self");
Setattr(parms, k_self, "1"); Setattr(parms, "self", "1");
Setattr(parms, k_hidden, "1"); Setattr(parms, k_hidden, "1");
Delete(t); Delete(t);
@ -1260,7 +1260,7 @@ int Swig_MembersetToFunction(Node *n, String *classname, int flags) {
String *code = Getattr(n, k_code); String *code = Getattr(n, k_code);
if (code) { if (code) {
/* I don't think this ever gets run - WSF */ /* I don't think this ever gets run - WSF */
Swig_add_extension_code(n, mangled, parms, void_type, code, cparse_cplusplus, k_self); Swig_add_extension_code(n, mangled, parms, void_type, code, cparse_cplusplus, "self");
} }
call = Swig_cfunction_call(mangled, parms); call = Swig_cfunction_call(mangled, parms);
cres = NewStringf("%s;\n", call); cres = NewStringf("%s;\n", call);
@ -1324,8 +1324,8 @@ int Swig_MembergetToFunction(Node *n, String *classname, int flags) {
t = NewString(classname); t = NewString(classname);
SwigType_add_pointer(t); SwigType_add_pointer(t);
parms = NewParm(t, k_self); parms = NewParm(t, "self");
Setattr(parms, k_self, "1"); Setattr(parms, "self", "1");
Setattr(parms, k_hidden, "1"); Setattr(parms, k_hidden, "1");
Delete(t); Delete(t);
@ -1337,7 +1337,7 @@ int Swig_MembergetToFunction(Node *n, String *classname, int flags) {
String *code = Getattr(n, k_code); String *code = Getattr(n, k_code);
if (code) { if (code) {
/* I don't think this ever gets run - WSF */ /* I don't think this ever gets run - WSF */
Swig_add_extension_code(n, mangled, parms, ty, code, cparse_cplusplus, k_self); Swig_add_extension_code(n, mangled, parms, ty, code, cparse_cplusplus, "self");
} }
call = Swig_cfunction_call(mangled, parms); call = Swig_cfunction_call(mangled, parms);
cres = Swig_cresult(ty, k_result, call); cres = Swig_cresult(ty, k_result, call);

70
Source/Swig/deprecate.c Normal file
View file

@ -0,0 +1,70 @@
/* -----------------------------------------------------------------------------
* 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.
*
* deprecate.c
*
* The functions in this file are SWIG core functions that are deprecated
* or which do not fit in nicely with everything else. Generally this means
* that the function and/or API needs to be changed in some future release.
* ----------------------------------------------------------------------------- */
char cvsroot_deprecate_c[] = "$Id: parms.c 9630 2007-01-02 21:17:19Z beazley $";
#include "swig.h"
/* ---------------------------------------------------------------------
* ParmList_is_compactdefargs()
*
* Returns 1 if the parameter list passed in is marked for compact argument
* handling (by the "compactdefargs" attribute). Otherwise returns 0.
* ---------------------------------------------------------------------- */
/* Discussion:
"compactdefargs" is a property set by the Parser to indicate special
handling of default arguments. This property seems to be something that
is associated with functions and methods rather than low-level ParmList
objects. Therefore, I don't like the fact that this special purpose
feature is bolted onto the side of ParmList objects.
Proposed solution:
1. "compactdefargs" should be a feature set on function/method nodes
instead of ParmList objects. For example, if you have a function,
you would check the function node to see if the parameters are
to be handled in this way.
Difficulties:
1. This is used by functions in cwrap.c and emit.cxx, none of which
are passed information about the function/method node. We might
have to change the API of those functions to make this work correctly.
For example:
int emit_num_required(ParmList *parms)
might become
int emit_num_required(ParmList *parms, int compactargs)
*/
int ParmList_is_compactdefargs(ParmList *p) {
int compactdefargs = 0;
if (p) {
compactdefargs = Getattr(p, "compactdefargs") ? 1 : 0;
/* The "compactdefargs" attribute should only be set on the first parameter in the list.
* However, sometimes an extra parameter is inserted at the beginning of the parameter list,
* so we check the 2nd parameter too. */
if (!compactdefargs) {
Parm *nextparm = nextSibling(p);
compactdefargs = (nextparm && Getattr(nextparm, "compactdefargs")) ? 1 : 0;
}
}
return compactdefargs;
}

View file

@ -31,7 +31,7 @@ static int debug = 0;
* ----------------------------------------------------------------------------- */ * ----------------------------------------------------------------------------- */
void Swig_fragment_register(Node *fragment) { void Swig_fragment_register(Node *fragment) {
if (Getattr(fragment, k_emitonly)) { if (Getattr(fragment, "emitonly")) {
Swig_fragment_emit(fragment); Swig_fragment_emit(fragment);
return; return;
} else { } else {
@ -50,10 +50,10 @@ void Swig_fragment_register(Node *fragment) {
fragments = NewHash(); fragments = NewHash();
} }
if (!Getattr(fragments, name)) { if (!Getattr(fragments, name)) {
String *section = Copy(Getattr(fragment, k_section)); String *section = Copy(Getattr(fragment, "section"));
String *ccode = Copy(Getattr(fragment, k_code)); String *ccode = Copy(Getattr(fragment, k_code));
Hash *kwargs = Getattr(fragment, k_kwargs); Hash *kwargs = Getattr(fragment, k_kwargs);
Setmeta(ccode, k_section, section); Setmeta(ccode, "section", section);
if (kwargs) { if (kwargs) {
Setmeta(ccode, k_kwargs, kwargs); Setmeta(ccode, k_kwargs, kwargs);
} }
@ -121,13 +121,13 @@ void Swig_fragment_emit(Node *n) {
if (debug) if (debug)
Printf(stdout, "looking subfragment %s\n", name); Printf(stdout, "looking subfragment %s\n", name);
if (code && (Strcmp(code, k_ignore) != 0)) { if (code && (Strcmp(code, k_ignore) != 0)) {
String *section = Getmeta(code, k_section); String *section = Getmeta(code, "section");
Hash *nn = Getmeta(code, k_kwargs); Hash *nn = Getmeta(code, k_kwargs);
if (!looking_fragments) if (!looking_fragments)
looking_fragments = NewHash(); looking_fragments = NewHash();
Setattr(looking_fragments, name, "1"); Setattr(looking_fragments, name, "1");
while (nn) { while (nn) {
if (Equal(Getattr(nn, k_name), k_fragment)) { if (Equal(Getattr(nn, k_name), "fragment")) {
if (debug) if (debug)
Printf(stdout, "emitting fragment %s %s\n", nn, type); Printf(stdout, "emitting fragment %s %s\n", nn, type);
Setfile(nn, Getfile(n)); Setfile(nn, Getfile(n));

View file

@ -122,7 +122,7 @@ static List *Swig_search_path_any(int syspath) {
ilen = Len(pdirectories); ilen = Len(pdirectories);
for (i = 0; i < ilen; i++) { for (i = 0; i < ilen; i++) {
filename = NewString(Getitem(pdirectories,i)); filename = NewString(Getitem(pdirectories,i));
StringAppend(filename,SWIG_FILE_DELIMETER); Append(filename,SWIG_FILE_DELIMETER);
Append(slist,filename); Append(slist,filename);
Delete(filename); Delete(filename);
} }
@ -131,7 +131,7 @@ static List *Swig_search_path_any(int syspath) {
ilen = Len(directories); ilen = Len(directories);
for (i = 0; i < ilen; i++) { for (i = 0; i < ilen; i++) {
filename = NewString(Getitem(directories,i)); filename = NewString(Getitem(directories,i));
StringAppend(filename,SWIG_FILE_DELIMETER); Append(filename,SWIG_FILE_DELIMETER);
if (syspath) { if (syspath) {
/* If doing a system include, put the system directories first */ /* If doing a system include, put the system directories first */
Insert(slist,i,filename); Insert(slist,i,filename);
@ -214,13 +214,13 @@ String *Swig_read_file(FILE *f) {
assert(str); assert(str);
while (fgets(buffer, 4095, f)) { while (fgets(buffer, 4095, f)) {
StringAppend(str, buffer); Append(str, buffer);
} }
len = StringLen(str); len = Len(str);
if (len) { if (len) {
char *cstr = Char(str); char *cstr = Char(str);
if (cstr[len - 1] != '\n') { if (cstr[len - 1] != '\n') {
StringAppend(str, "\n"); Append(str, "\n");
} }
} }
return str; return str;

View file

@ -429,13 +429,13 @@ String *Swig_string_mangle(const String *s) {
Delete(b); Delete(b);
b = t; b = t;
} }
pc = cb = StringChar(b); pc = cb = Char(b);
while (*pc) { while (*pc) {
char c = *pc; char c = *pc;
if (isalnum((int) c) || (c == '_')) { if (isalnum((int) c) || (c == '_')) {
state = 1; state = 1;
if (space && (space == state)) { if (space && (space == state)) {
StringAppend(result, "_SS_"); Append(result, "_SS_");
} }
space = 0; space = 0;
Printf(result, "%c", (int) c); Printf(result, "%c", (int) c);
@ -452,7 +452,7 @@ String *Swig_string_mangle(const String *s) {
switch (c) { switch (c) {
case '.': case '.':
if ((cb != pc) && (*(pc - 1) == 'p')) { if ((cb != pc) && (*(pc - 1) == 'p')) {
StringAppend(result, "_"); Append(result, "_");
++pc; ++pc;
continue; continue;
} else { } else {
@ -461,7 +461,7 @@ String *Swig_string_mangle(const String *s) {
break; break;
case ':': case ':':
if (*(pc + 1) == ':') { if (*(pc + 1) == ':') {
StringAppend(result, "_"); Append(result, "_");
++pc; ++pc;
++pc; ++pc;
continue; continue;

View file

@ -179,7 +179,7 @@ String *Swig_name_member(const String_or_char *classname, const String_or_char *
r = NewStringEmpty(); r = NewStringEmpty();
if (!naming_hash) if (!naming_hash)
naming_hash = NewHash(); naming_hash = NewHash();
f = Getattr(naming_hash, k_member); f = Getattr(naming_hash, "member");
if (!f) { if (!f) {
Append(r, "%c_%m"); Append(r, "%c_%m");
} else { } else {
@ -213,7 +213,7 @@ String *Swig_name_get(const String_or_char *vname) {
r = NewStringEmpty(); r = NewStringEmpty();
if (!naming_hash) if (!naming_hash)
naming_hash = NewHash(); naming_hash = NewHash();
f = Getattr(naming_hash, k_get); f = Getattr(naming_hash, "get");
if (!f) { if (!f) {
Append(r, "%v_get"); Append(r, "%v_get");
} else { } else {
@ -237,7 +237,7 @@ String *Swig_name_set(const String_or_char *vname) {
r = NewStringEmpty(); r = NewStringEmpty();
if (!naming_hash) if (!naming_hash)
naming_hash = NewHash(); naming_hash = NewHash();
f = Getattr(naming_hash, k_set); f = Getattr(naming_hash, "set");
if (!f) { if (!f) {
Append(r, "%v_set"); Append(r, "%v_set");
} else { } else {
@ -264,7 +264,7 @@ String *Swig_name_construct(const String_or_char *classname) {
r = NewStringEmpty(); r = NewStringEmpty();
if (!naming_hash) if (!naming_hash)
naming_hash = NewHash(); naming_hash = NewHash();
f = Getattr(naming_hash, k_construct); f = Getattr(naming_hash, "construct");
if (!f) { if (!f) {
Append(r, "new_%c"); Append(r, "new_%c");
} else { } else {
@ -297,7 +297,7 @@ String *Swig_name_copyconstructor(const String_or_char *classname) {
r = NewStringEmpty(); r = NewStringEmpty();
if (!naming_hash) if (!naming_hash)
naming_hash = NewHash(); naming_hash = NewHash();
f = Getattr(naming_hash, k_copy); f = Getattr(naming_hash, "copy");
if (!f) { if (!f) {
Append(r, "copy_%c"); Append(r, "copy_%c");
} else { } else {
@ -329,7 +329,7 @@ String *Swig_name_destroy(const String_or_char *classname) {
r = NewStringEmpty(); r = NewStringEmpty();
if (!naming_hash) if (!naming_hash)
naming_hash = NewHash(); naming_hash = NewHash();
f = Getattr(naming_hash, k_destroy); f = Getattr(naming_hash, "destroy");
if (!f) { if (!f) {
Append(r, "delete_%c"); Append(r, "delete_%c");
} else { } else {
@ -361,7 +361,7 @@ String *Swig_name_disown(const String_or_char *classname) {
r = NewStringEmpty(); r = NewStringEmpty();
if (!naming_hash) if (!naming_hash)
naming_hash = NewHash(); naming_hash = NewHash();
f = Getattr(naming_hash, k_disown); f = Getattr(naming_hash, "disown");
if (!f) { if (!f) {
Append(r, "disown_%c"); Append(r, "disown_%c");
} else { } else {
@ -398,7 +398,7 @@ void Swig_name_object_set(Hash *namehash, String *name, SwigType *decl, DOH *obj
} }
/* Add an object based on the declarator value */ /* Add an object based on the declarator value */
if (!decl) { if (!decl) {
Setattr(n, k_start, object); Setattr(n, "start", object);
} else { } else {
SwigType *cd = Copy(decl); SwigType *cd = Copy(decl);
Setattr(n, cd, object); Setattr(n, cd, object);
@ -422,7 +422,7 @@ static DOH *get_object(Hash *n, String *decl) {
if (decl) { if (decl) {
rn = Getattr(n, decl); rn = Getattr(n, decl);
} else { } else {
rn = Getattr(n, k_start); rn = Getattr(n, "start");
} }
return rn; return rn;
} }
@ -630,7 +630,7 @@ void Swig_features_get(Hash *features, String *prefix, String *name, SwigType *d
/* very specific hack for template constructors/destructors */ /* very specific hack for template constructors/destructors */
if (name && SwigType_istemplate(name)) { if (name && SwigType_istemplate(name)) {
String *nodetype = nodeType(node); String *nodetype = nodeType(node);
if (nodetype && (Equal(nodetype, k_constructor) || Equal(nodetype, k_destructor))) { if (nodetype && (Equal(nodetype, "constructor") || Equal(nodetype, "destructor"))) {
String *nprefix = NewStringEmpty(); String *nprefix = NewStringEmpty();
String *nlast = NewStringEmpty(); String *nlast = NewStringEmpty();
String *tprefix; String *tprefix;
@ -658,7 +658,7 @@ void Swig_features_get(Hash *features, String *prefix, String *name, SwigType *d
#endif #endif
/* Global features */ /* Global features */
features_get(features, empty_string, 0, 0, node); features_get(features, "", 0, 0, node);
if (name) { if (name) {
String *tname = NewStringEmpty(); String *tname = NewStringEmpty();
/* add features for 'root' template */ /* add features for 'root' template */
@ -741,10 +741,10 @@ void Swig_feature_set(Hash *features, const String_or_char *name, SwigType *decl
Delete(n); Delete(n);
} }
if (!decl) { if (!decl) {
fhash = Getattr(n, k_start); fhash = Getattr(n, "start");
if (!fhash) { if (!fhash) {
fhash = NewHash(); fhash = NewHash();
Setattr(n, k_start, fhash); Setattr(n, "start", fhash);
Delete(fhash); Delete(fhash);
} }
} else { } else {
@ -979,7 +979,7 @@ int Swig_need_protected(Node *n) {
/* and the function is declared like virtual, or it has no /* and the function is declared like virtual, or it has no
storage. This eliminates typedef, static and so on. */ storage. This eliminates typedef, static and so on. */
return !storage || Equal(storage, k_virtual); return !storage || Equal(storage, k_virtual);
} else if (Equal(nodetype, k_constructor) || Equal(nodetype, k_destructor)) { } else if (Equal(nodetype, "constructor") || Equal(nodetype, "destructor")) {
return 1; return 1;
} }
@ -1035,15 +1035,15 @@ static void Swig_name_object_attach_keys(const char *keys[], Hash *nameobj) {
if (!matchlist) if (!matchlist)
matchlist = NewList(); matchlist = NewList();
Setattr(mi, k_value, Getattr(kw, k_value)); Setattr(mi, k_value, Getattr(kw, k_value));
Setattr(mi, k_attrlist, attrlist); Setattr(mi, "attrlist", attrlist);
#ifdef SWIG_DEBUG #ifdef SWIG_DEBUG
if (isrxsmatch) 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, k_value), attrlist);
#endif #endif
if (isnotmatch) if (isnotmatch)
SetFlag(mi, k_notmatch); SetFlag(mi, "notmatch");
if (isrxsmatch) if (isrxsmatch)
SetFlag(mi, k_rxsmatch); SetFlag(mi, "rxsmatch");
Delete(attrlist); Delete(attrlist);
Append(matchlist, mi); Append(matchlist, mi);
Delete(mi); Delete(mi);
@ -1060,7 +1060,7 @@ static void Swig_name_object_attach_keys(const char *keys[], Hash *nameobj) {
kw = next; kw = next;
} }
if (matchlist) { if (matchlist) {
Setattr(nameobj, k_matchlist, matchlist); Setattr(nameobj, "matchlist", matchlist);
Delete(matchlist); Delete(matchlist);
} }
} }
@ -1068,7 +1068,7 @@ static void Swig_name_object_attach_keys(const char *keys[], Hash *nameobj) {
void Swig_name_nameobj_add(Hash *name_hash, List *name_list, String *prefix, String *name, SwigType *decl, Hash *nameobj) { void Swig_name_nameobj_add(Hash *name_hash, List *name_list, String *prefix, String *name, SwigType *decl, Hash *nameobj) {
String *nname = 0; String *nname = 0;
if (name && Len(name)) { if (name && Len(name)) {
String *target_fmt = Getattr(nameobj, k_targetfmt); String *target_fmt = Getattr(nameobj, "targetfmt");
nname = prefix ? NewStringf("%s::%s", prefix, name) : NewString(name); nname = prefix ? NewStringf("%s::%s", prefix, name) : NewString(name);
if (target_fmt) { if (target_fmt) {
String *tmp = NewStringf(target_fmt, nname); String *tmp = NewStringf(target_fmt, nname);
@ -1078,11 +1078,11 @@ 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, k_fullname) || /* any of these options trigger a 'list' nameobj */
Getattr(nameobj, k_sourcefmt) || Getattr(nameobj, k_matchlist)) { Getattr(nameobj, "sourcefmt") || Getattr(nameobj, "matchlist")) {
if (decl) if (decl)
Setattr(nameobj, k_decl, decl); Setattr(nameobj, k_decl, decl);
if (nname && Len(nname)) if (nname && Len(nname))
Setattr(nameobj, k_targetname, nname); Setattr(nameobj, "targetname", nname);
/* put the new nameobj at the beginnig of the list, such that the /* put the new nameobj at the beginnig of the list, such that the
last inserted rule take precedence */ last inserted rule take precedence */
Insert(name_list, 0, nameobj); Insert(name_list, 0, nameobj);
@ -1172,14 +1172,14 @@ int Swig_name_match_value(String *mvalue, String *value) {
} }
return match; return match;
#else #else
return StringEqual(mvalue, value); return Equal(mvalue, value);
#endif #endif
} }
int Swig_name_match_nameobj(Hash *rn, Node *n) { int Swig_name_match_nameobj(Hash *rn, Node *n) {
int match = 1; int match = 1;
List *matchlist = Getattr(rn, k_matchlist); List *matchlist = Getattr(rn, "matchlist");
#ifdef SWIG_DEBUG #ifdef SWIG_DEBUG
Printf(stderr, "Swig_name_match_nameobj: %s\n", Getattr(n, "name")); Printf(stderr, "Swig_name_match_nameobj: %s\n", Getattr(n, "name"));
#endif #endif
@ -1188,10 +1188,10 @@ int Swig_name_match_nameobj(Hash *rn, Node *n) {
int i; int i;
for (i = 0; match && (i < ilen); ++i) { for (i = 0; match && (i < ilen); ++i) {
Node *mi = Getitem(matchlist, i); Node *mi = Getitem(matchlist, i);
List *lattr = Getattr(mi, k_attrlist); List *lattr = Getattr(mi, "attrlist");
String *nval = Swig_get_lattr(n, lattr); String *nval = Swig_get_lattr(n, lattr);
int notmatch = GetFlag(mi, k_notmatch); int notmatch = GetFlag(mi, "notmatch");
int rxsmatch = GetFlag(mi, k_rxsmatch); int rxsmatch = GetFlag(mi, "rxsmatch");
#ifdef SWIG_DEBUG #ifdef SWIG_DEBUG
Printf(stderr, "mi %d %s re %d not %d \n", i, nval, notmatch, rxsmatch); Printf(stderr, "mi %d %s re %d not %d \n", i, nval, notmatch, rxsmatch);
if (rxsmatch) { if (rxsmatch) {
@ -1236,12 +1236,12 @@ Hash *Swig_name_nameobj_lget(List *namelist, Node *n, String *prefix, String *na
if (rdecl && (!decl || !Equal(rdecl, decl))) { if (rdecl && (!decl || !Equal(rdecl, decl))) {
continue; continue;
} else if (Swig_name_match_nameobj(rn, n)) { } else if (Swig_name_match_nameobj(rn, n)) {
String *tname = Getattr(rn, k_targetname); String *tname = Getattr(rn, "targetname");
if (tname) { if (tname) {
String *sfmt = Getattr(rn, k_sourcefmt); String *sfmt = Getattr(rn, "sourcefmt");
String *sname = 0; String *sname = 0;
int fullname = GetFlag(rn, k_fullname); int fullname = GetFlag(rn, k_fullname);
int rxstarget = GetFlag(rn, k_rxstarget); int rxstarget = GetFlag(rn, "rxstarget");
if (sfmt) { if (sfmt) {
if (fullname && prefix) { if (fullname && prefix) {
String *pname = NewStringf("%s::%s", prefix, name); String *pname = NewStringf("%s::%s", prefix, name);
@ -1443,7 +1443,7 @@ String *Swig_name_make(Node *n, String *prefix, String_or_char *cname, SwigType
if (name && n && SwigType_istemplate(name)) { if (name && n && SwigType_istemplate(name)) {
String *nodetype = nodeType(n); String *nodetype = nodeType(n);
if (nodetype && (Equal(nodetype, k_constructor) || Equal(nodetype, k_destructor))) { if (nodetype && (Equal(nodetype, "constructor") || Equal(nodetype, "destructor"))) {
String *nprefix = NewStringEmpty(); String *nprefix = NewStringEmpty();
String *nlast = NewStringEmpty(); String *nlast = NewStringEmpty();
String *tprefix; String *tprefix;
@ -1476,7 +1476,7 @@ String *Swig_name_make(Node *n, String *prefix, String_or_char *cname, SwigType
if (!rn || !Swig_name_match_nameobj(rn, n)) { if (!rn || !Swig_name_match_nameobj(rn, n)) {
rn = Swig_name_nameobj_lget(Swig_name_rename_list(), n, prefix, name, decl); rn = Swig_name_nameobj_lget(Swig_name_rename_list(), n, prefix, name, decl);
if (rn) { if (rn) {
String *sfmt = Getattr(rn, k_sourcefmt); String *sfmt = Getattr(rn, "sourcefmt");
int fullname = GetFlag(rn, k_fullname); int fullname = GetFlag(rn, k_fullname);
if (fullname && prefix) { if (fullname && prefix) {
String *sname = NewStringf("%s::%s", prefix, name); String *sname = NewStringf("%s::%s", prefix, name);

View file

@ -10,7 +10,6 @@
char cvsroot_parms_c[] = "$Id$"; char cvsroot_parms_c[] = "$Id$";
#include "swig.h" #include "swig.h"
#include "swigkeys.h"
/* ------------------------------------------------------------------------ /* ------------------------------------------------------------------------
* NewParm() * NewParm()
@ -30,87 +29,22 @@ Parm *NewParm(SwigType *type, const String_or_char *name) {
return p; return p;
} }
/* ------------------------------------------------------------------------
* NewParmFromNode()
*
* Create a new parameter from datatype 'type' and name 'name'.
* Sets the file and line number for the parameter for error handling by
* making a (shallow) copy of file and line number from Node 'n'.
* ------------------------------------------------------------------------ */
Parm *NewParmFromNode(SwigType *type, const String_or_char *name, Node *n) {
Parm *p = NewParm(type, name);
Setfile(p, Getfile(n));
Setline(p, Getline(n));
return p;
}
/* ------------------------------------------------------------------------ /* ------------------------------------------------------------------------
* CopyParm() * CopyParm()
* ------------------------------------------------------------------------ */ * ------------------------------------------------------------------------ */
Parm *CopyParm(Parm *p) { Parm *CopyParm(Parm *p) {
Parm *np = NewHash(); Parm *np = NewHash();
SwigType *t = Getattr(p, "type"); Iterator ki;
String *name = Getattr(p, "name"); for (ki = First(p); ki.key; ki = Next(ki)) {
String *lname = Getattr(p, "lname"); if (DohIsString(ki.item)) {
String *value = Getattr(p, "value"); DOH *c = Copy(ki.item);
String *ignore = Getattr(p, "ignore"); Setattr(np,ki.key,c);
String *alttype = Getattr(p, "alttype"); Delete(c);
String *byname = Getattr(p, "arg:byname"); }
String *compactdefargs = Getattr(p, "compactdefargs");
String *self = Getattr(p, "self");
if (t) {
SwigType *nt = Copy(t);
Setattr(np, "type", nt);
Delete(nt);
} }
if (name) {
String *str = Copy(name);
Setattr(np, "name", str);
Delete(str);
}
if (lname) {
String *str = Copy(lname);
Setattr(np, "lname", str);
Delete(str);
}
if (value) {
String *str = Copy(value);
Setattr(np, "value", str);
Delete(str);
}
if (ignore) {
String *str = Copy(ignore);
Setattr(np, "ignore", str);
Delete(str);
}
if (alttype) {
String *str = Copy(alttype);
Setattr(np, "alttype", str);
Delete(str);
}
if (byname) {
String *str = Copy(byname);
Setattr(np, "arg:byname", str);
Delete(str);
}
if (compactdefargs) {
String *str = Copy(compactdefargs);
Setattr(np, "compactdefargs", str);
Delete(str);
}
if (self) {
String *str = Copy(self);
Setattr(np, "self", str);
Delete(str);
}
Setfile(np, Getfile(p)); Setfile(np, Getfile(p));
Setline(np, Getline(p)); Setline(np, Getline(p));
return np; return np;
} }
@ -204,10 +138,10 @@ String *ParmList_str(ParmList *p) {
String *out = NewStringEmpty(); String *out = NewStringEmpty();
while (p) { while (p) {
String *pstr = SwigType_str(Getattr(p, "type"), Getattr(p, "name")); String *pstr = SwigType_str(Getattr(p, "type"), Getattr(p, "name"));
StringAppend(out, pstr); Append(out, pstr);
p = nextSibling(p); p = nextSibling(p);
if (p) { if (p) {
StringAppend(out, ","); Append(out, ",");
} }
Delete(pstr); Delete(pstr);
} }
@ -225,13 +159,13 @@ String *ParmList_str_defaultargs(ParmList *p) {
while (p) { while (p) {
String *value = Getattr(p, "value"); String *value = Getattr(p, "value");
String *pstr = SwigType_str(Getattr(p, "type"), Getattr(p, "name")); String *pstr = SwigType_str(Getattr(p, "type"), Getattr(p, "name"));
StringAppend(out, pstr); Append(out, pstr);
if (value) { if (value) {
Printf(out, "=%s", value); Printf(out, "=%s", value);
} }
p = nextSibling(p); p = nextSibling(p);
if (p) { if (p) {
StringAppend(out, ","); Append(out, ",");
} }
Delete(pstr); Delete(pstr);
} }
@ -251,10 +185,10 @@ String *ParmList_protostr(ParmList *p) {
p = nextSibling(p); p = nextSibling(p);
} else { } else {
String *pstr = SwigType_str(Getattr(p, "type"), 0); String *pstr = SwigType_str(Getattr(p, "type"), 0);
StringAppend(out, pstr); Append(out, pstr);
p = nextSibling(p); p = nextSibling(p);
if (p) { if (p) {
StringAppend(out, ","); Append(out, ",");
} }
Delete(pstr); Delete(pstr);
} }
@ -262,32 +196,6 @@ String *ParmList_protostr(ParmList *p) {
return out; return out;
} }
/* ---------------------------------------------------------------------
* ParmList_is_compactdefargs()
*
* Returns 1 if the parameter list passed in is marked for compact argument
* handling (by the "compactdefargs" attribute). Otherwise returns 0.
* ---------------------------------------------------------------------- */
int ParmList_is_compactdefargs(ParmList *p) {
int compactdefargs = 0;
if (p) {
compactdefargs = Getattr(p, "compactdefargs") ? 1 : 0;
/* The "compactdefargs" attribute should only be set on the first parameter in the list.
* However, sometimes an extra parameter is inserted at the beginning of the parameter list,
* so we check the 2nd parameter too. */
if (!compactdefargs) {
Parm *nextparm = nextSibling(p);
compactdefargs = (nextparm && Getattr(nextparm, "compactdefargs")) ? 1 : 0;
}
}
return compactdefargs;
}
/* --------------------------------------------------------------------- /* ---------------------------------------------------------------------
* ParmList_has_defaultargs() * ParmList_has_defaultargs()
* *
@ -296,13 +204,11 @@ int ParmList_is_compactdefargs(ParmList *p) {
* ---------------------------------------------------------------------- */ * ---------------------------------------------------------------------- */
int ParmList_has_defaultargs(ParmList *p) { int ParmList_has_defaultargs(ParmList *p) {
int default_args = 0;
while (p) { while (p) {
if (Getattr(p, "value")) { if (Getattr(p, "value")) {
default_args = 1; return 1;
break;
} }
p = nextSibling(p); p = nextSibling(p);
} }
return default_args; return 0;
} }

View file

@ -331,11 +331,11 @@ static Hash *default_cache = 0;
static static
void SwigType_add_default(String *def, SwigType *nr) { void SwigType_add_default(String *def, SwigType *nr) {
if (Strcmp(nr, "SWIGTYPE") == 0) { if (Strcmp(nr, "SWIGTYPE") == 0) {
StringAppend(def, "SWIGTYPE"); Append(def, "SWIGTYPE");
} else { } else {
String *q = SwigType_isqualifier(nr) ? SwigType_pop(nr) : 0; String *q = SwigType_isqualifier(nr) ? SwigType_pop(nr) : 0;
if (q && strstr(Char(nr), "SWIGTYPE")) { if (q && strstr(Char(nr), "SWIGTYPE")) {
StringAppend(def, nr); Append(def, nr);
} else { } else {
String *nd = SwigType_default(nr); String *nd = SwigType_default(nr);
if (nd) { if (nd) {
@ -349,10 +349,10 @@ void SwigType_add_default(String *def, SwigType *nr) {
Delete(nd); Delete(nd);
} }
} }
StringAppend(def, bdef); Append(def, bdef);
Delete(bdef); Delete(bdef);
} else { } else {
StringAppend(def, nr); Append(def, nr);
} }
} }
Delete(q); Delete(q);
@ -448,7 +448,7 @@ SwigType *SwigType_default(SwigType *t) {
SwigType_del_array(nr); SwigType_del_array(nr);
SwigType_add_default(def, nr); SwigType_add_default(def, nr);
#else #else
StringAppend(def, "SWIGTYPE"); Append(def, "SWIGTYPE");
#endif #endif
Delete(nr); Delete(nr);
} }
@ -475,7 +475,7 @@ SwigType *SwigType_default(SwigType *t) {
} }
if (r != t) if (r != t)
Delete(r); Delete(r);
if (StringEqual(def, t)) { if (Equal(def, t)) {
Delete(def); Delete(def);
def = 0; def = 0;
} }
@ -522,7 +522,7 @@ String *SwigType_namestr(const SwigType *t) {
/* Avoid creating a <: token, which is the same as [ in C++. */ /* Avoid creating a <: token, which is the same as [ in C++. */
if (i == 0 && Len(str) && *Char(str) == ':') if (i == 0 && Len(str) && *Char(str) == ':')
Putc(' ', r); Putc(' ', r);
StringAppend(r, str); Append(r, str);
if ((i + 1) < sz) if ((i + 1) < sz)
Putc(',', r); Putc(',', r);
Delete(str); Delete(str);
@ -530,7 +530,7 @@ String *SwigType_namestr(const SwigType *t) {
Putc(' ', r); Putc(' ', r);
Putc('>', r); Putc('>', r);
suffix = SwigType_templatesuffix(t); suffix = SwigType_templatesuffix(t);
StringAppend(r, suffix); Append(r, suffix);
Delete(suffix); Delete(suffix);
Delete(p); Delete(p);
return r; return r;
@ -577,7 +577,7 @@ String *SwigType_str(SwigType *s, const String_or_char *id) {
Insert(result, 0, "*"); Insert(result, 0, "*");
if ((nextelement) && ((SwigType_isfunction(nextelement) || (SwigType_isarray(nextelement))))) { if ((nextelement) && ((SwigType_isfunction(nextelement) || (SwigType_isarray(nextelement))))) {
Insert(result, 0, "("); Insert(result, 0, "(");
StringAppend(result, ")"); Append(result, ")");
} }
} else if (SwigType_ismemberpointer(element)) { } else if (SwigType_ismemberpointer(element)) {
String *q; String *q;
@ -586,35 +586,35 @@ String *SwigType_str(SwigType *s, const String_or_char *id) {
Insert(result, 0, q); Insert(result, 0, q);
if ((nextelement) && ((SwigType_isfunction(nextelement) || (SwigType_isarray(nextelement))))) { if ((nextelement) && ((SwigType_isfunction(nextelement) || (SwigType_isarray(nextelement))))) {
Insert(result, 0, "("); Insert(result, 0, "(");
StringAppend(result, ")"); Append(result, ")");
} }
Delete(q); Delete(q);
} else if (SwigType_isreference(element)) { } else if (SwigType_isreference(element)) {
Insert(result, 0, "&"); Insert(result, 0, "&");
if ((nextelement) && ((SwigType_isfunction(nextelement) || (SwigType_isarray(nextelement))))) { if ((nextelement) && ((SwigType_isfunction(nextelement) || (SwigType_isarray(nextelement))))) {
Insert(result, 0, "("); Insert(result, 0, "(");
StringAppend(result, ")"); Append(result, ")");
} }
} else if (SwigType_isarray(element)) { } else if (SwigType_isarray(element)) {
DOH *size; DOH *size;
StringAppend(result, "["); Append(result, "[");
size = SwigType_parm(element); size = SwigType_parm(element);
StringAppend(result, size); Append(result, size);
StringAppend(result, "]"); Append(result, "]");
Delete(size); Delete(size);
} else if (SwigType_isfunction(element)) { } else if (SwigType_isfunction(element)) {
DOH *parms, *p; DOH *parms, *p;
int j, plen; int j, plen;
StringAppend(result, "("); Append(result, "(");
parms = SwigType_parmlist(element); parms = SwigType_parmlist(element);
plen = Len(parms); plen = Len(parms);
for (j = 0; j < plen; j++) { for (j = 0; j < plen; j++) {
p = SwigType_str(Getitem(parms, j), 0); p = SwigType_str(Getitem(parms, j), 0);
StringAppend(result, p); Append(result, p);
if (j < (plen - 1)) if (j < (plen - 1))
StringAppend(result, ","); Append(result, ",");
} }
StringAppend(result, ")"); Append(result, ")");
Delete(parms); Delete(parms);
} else { } else {
if (strcmp(Char(element), "v(...)") == 0) { if (strcmp(Char(element), "v(...)") == 0) {
@ -687,34 +687,34 @@ SwigType *SwigType_ltype(SwigType *s) {
if (SwigType_isqualifier(element)) { if (SwigType_isqualifier(element)) {
/* Do nothing. Ignore */ /* Do nothing. Ignore */
} else if (SwigType_ispointer(element)) { } else if (SwigType_ispointer(element)) {
StringAppend(result, element); Append(result, element);
firstarray = 0; firstarray = 0;
} else if (SwigType_ismemberpointer(element)) { } else if (SwigType_ismemberpointer(element)) {
StringAppend(result, element); Append(result, element);
firstarray = 0; firstarray = 0;
} else if (SwigType_isreference(element)) { } else if (SwigType_isreference(element)) {
if (notypeconv) { if (notypeconv) {
StringAppend(result, element); Append(result, element);
} else { } else {
StringAppend(result, "p."); Append(result, "p.");
} }
firstarray = 0; firstarray = 0;
} else if (SwigType_isarray(element) && firstarray) { } else if (SwigType_isarray(element) && firstarray) {
if (notypeconv) { if (notypeconv) {
StringAppend(result, element); Append(result, element);
} else { } else {
StringAppend(result, "p."); Append(result, "p.");
} }
firstarray = 0; firstarray = 0;
} else if (SwigType_isenum(element)) { } else if (SwigType_isenum(element)) {
int anonymous_enum = (Cmp(element, "enum ") == 0); int anonymous_enum = (Cmp(element, "enum ") == 0);
if (notypeconv || !anonymous_enum) { if (notypeconv || !anonymous_enum) {
StringAppend(result, element); Append(result, element);
} else { } else {
StringAppend(result, "int"); Append(result, "int");
} }
} else { } else {
StringAppend(result, element); Append(result, element);
} }
} }
Delete(elements); Delete(elements);
@ -813,7 +813,7 @@ String *SwigType_rcaststr(SwigType *s, const String_or_char *name) {
Insert(result, 0, "*"); Insert(result, 0, "*");
if ((nextelement) && ((SwigType_isfunction(nextelement) || (SwigType_isarray(nextelement))))) { if ((nextelement) && ((SwigType_isfunction(nextelement) || (SwigType_isarray(nextelement))))) {
Insert(result, 0, "("); Insert(result, 0, "(");
StringAppend(result, ")"); Append(result, ")");
} }
firstarray = 0; firstarray = 0;
} else if (SwigType_ismemberpointer(element)) { } else if (SwigType_ismemberpointer(element)) {
@ -824,26 +824,26 @@ String *SwigType_rcaststr(SwigType *s, const String_or_char *name) {
Delete(q); Delete(q);
if ((nextelement) && ((SwigType_isfunction(nextelement) || (SwigType_isarray(nextelement))))) { if ((nextelement) && ((SwigType_isfunction(nextelement) || (SwigType_isarray(nextelement))))) {
Insert(result, 0, "("); Insert(result, 0, "(");
StringAppend(result, ")"); Append(result, ")");
} }
firstarray = 0; firstarray = 0;
} else if (SwigType_isreference(element)) { } else if (SwigType_isreference(element)) {
Insert(result, 0, "&"); Insert(result, 0, "&");
if ((nextelement) && ((SwigType_isfunction(nextelement) || (SwigType_isarray(nextelement))))) { if ((nextelement) && ((SwigType_isfunction(nextelement) || (SwigType_isarray(nextelement))))) {
Insert(result, 0, "("); Insert(result, 0, "(");
StringAppend(result, ")"); Append(result, ")");
} }
isreference = 1; isreference = 1;
} else if (SwigType_isarray(element)) { } else if (SwigType_isarray(element)) {
DOH *size; DOH *size;
if (firstarray && !isreference) { if (firstarray && !isreference) {
StringAppend(result, "(*)"); Append(result, "(*)");
firstarray = 0; firstarray = 0;
} else { } else {
StringAppend(result, "["); Append(result, "[");
size = SwigType_parm(element); size = SwigType_parm(element);
StringAppend(result, size); Append(result, size);
StringAppend(result, "]"); Append(result, "]");
Delete(size); Delete(size);
clear = 0; clear = 0;
} }
@ -851,17 +851,17 @@ String *SwigType_rcaststr(SwigType *s, const String_or_char *name) {
} else if (SwigType_isfunction(element)) { } else if (SwigType_isfunction(element)) {
DOH *parms, *p; DOH *parms, *p;
int j, plen; int j, plen;
StringAppend(result, "("); Append(result, "(");
parms = SwigType_parmlist(element); parms = SwigType_parmlist(element);
plen = Len(parms); plen = Len(parms);
for (j = 0; j < plen; j++) { for (j = 0; j < plen; j++) {
p = SwigType_str(Getitem(parms, j), 0); p = SwigType_str(Getitem(parms, j), 0);
StringAppend(result, p); Append(result, p);
Delete(p); Delete(p);
if (j < (plen - 1)) if (j < (plen - 1))
StringAppend(result, ","); Append(result, ",");
} }
StringAppend(result, ")"); Append(result, ")");
Delete(parms); Delete(parms);
} else { } else {
String *bs = SwigType_namestr(element); String *bs = SwigType_namestr(element);
@ -881,9 +881,9 @@ String *SwigType_rcaststr(SwigType *s, const String_or_char *name) {
if (isreference) { if (isreference) {
if (isarray) if (isarray)
Clear(cast); Clear(cast);
StringAppend(cast, "*"); Append(cast, "*");
} }
StringAppend(cast, name); Append(cast, name);
} }
Delete(result); Delete(result);
Delete(tc); Delete(tc);
@ -911,14 +911,14 @@ String *SwigType_lcaststr(SwigType *s, const String_or_char *name) {
Printf(result, "(%s)", str); Printf(result, "(%s)", str);
Delete(str); Delete(str);
if (name) if (name)
StringAppend(result, name); Append(result, name);
} else if (SwigType_isqualifier(s)) { } else if (SwigType_isqualifier(s)) {
String *lstr = SwigType_lstr(s, 0); String *lstr = SwigType_lstr(s, 0);
Printf(result, "(%s)%s", lstr, name); Printf(result, "(%s)%s", lstr, name);
Delete(lstr); Delete(lstr);
} else { } else {
if (name) if (name)
StringAppend(result, name); Append(result, name);
} }
return result; return result;
} }
@ -986,7 +986,7 @@ String *SwigType_manglestr_default(SwigType *s) {
*c = '_'; *c = '_';
c++; c++;
} }
StringAppend(result, base); Append(result, base);
Insert(result, 0, "_"); Insert(result, 0, "_");
Delete(lt); Delete(lt);
Delete(base); Delete(base);
@ -1013,7 +1013,7 @@ void SwigType_typename_replace(SwigType *t, String *pat, String *rep) {
if (!Strstr(t, pat)) if (!Strstr(t, pat))
return; return;
if (StringEqual(t, pat)) { if (Equal(t, pat)) {
Replace(t, pat, rep, DOH_REPLACE_ANY); Replace(t, pat, rep, DOH_REPLACE_ANY);
return; return;
} }
@ -1023,12 +1023,12 @@ void SwigType_typename_replace(SwigType *t, String *pat, String *rep) {
for (i = 0; i < ilen; i++) { for (i = 0; i < ilen; i++) {
String *e = Getitem(elem, i); String *e = Getitem(elem, i);
if (SwigType_issimple(e)) { if (SwigType_issimple(e)) {
if (StringEqual(e, pat)) { if (Equal(e, pat)) {
/* Replaces a type of the form 'pat' with 'rep<args>' */ /* Replaces a type of the form 'pat' with 'rep<args>' */
Replace(e, pat, rep, DOH_REPLACE_ANY); Replace(e, pat, rep, DOH_REPLACE_ANY);
} else if (SwigType_istemplate(e)) { } else if (SwigType_istemplate(e)) {
/* Replaces a type of the form 'pat<args>' with 'rep' */ /* Replaces a type of the form 'pat<args>' with 'rep' */
if (StringEqual(e, pat)) { if (Equal(e, pat)) {
String *repbase = SwigType_templateprefix(rep); String *repbase = SwigType_templateprefix(rep);
Replace(e, pat, repbase, DOH_REPLACE_ID | DOH_REPLACE_FIRST); Replace(e, pat, repbase, DOH_REPLACE_ID | DOH_REPLACE_FIRST);
Delete(repbase); Delete(repbase);
@ -1038,11 +1038,11 @@ void SwigType_typename_replace(SwigType *t, String *pat, String *rep) {
List *tparms = SwigType_parmlist(e); List *tparms = SwigType_parmlist(e);
int j, jlen; int j, jlen;
String *nt = SwigType_templateprefix(e); String *nt = SwigType_templateprefix(e);
StringAppend(nt, "<("); Append(nt, "<(");
jlen = Len(tparms); jlen = Len(tparms);
for (j = 0; j < jlen; j++) { for (j = 0; j < jlen; j++) {
SwigType_typename_replace(Getitem(tparms, j), pat, rep); SwigType_typename_replace(Getitem(tparms, j), pat, rep);
StringAppend(nt, Getitem(tparms, j)); Append(nt, Getitem(tparms, j));
if (j < (jlen - 1)) if (j < (jlen - 1))
Putc(',', nt); Putc(',', nt);
} }
@ -1050,7 +1050,7 @@ void SwigType_typename_replace(SwigType *t, String *pat, String *rep) {
Printf(nt, ")>%s", tsuffix); Printf(nt, ")>%s", tsuffix);
Delete(tsuffix); Delete(tsuffix);
Clear(e); Clear(e);
StringAppend(e, nt); Append(e, nt);
Delete(nt); Delete(nt);
Delete(tparms); Delete(tparms);
} }
@ -1069,23 +1069,23 @@ void SwigType_typename_replace(SwigType *t, String *pat, String *rep) {
int j, jlen; int j, jlen;
List *fparms = SwigType_parmlist(e); List *fparms = SwigType_parmlist(e);
Clear(e); Clear(e);
StringAppend(e, "f("); Append(e, "f(");
jlen = Len(fparms); jlen = Len(fparms);
for (j = 0; j < jlen; j++) { for (j = 0; j < jlen; j++) {
SwigType_typename_replace(Getitem(fparms, j), pat, rep); SwigType_typename_replace(Getitem(fparms, j), pat, rep);
StringAppend(e, Getitem(fparms, j)); Append(e, Getitem(fparms, j));
if (j < (jlen - 1)) if (j < (jlen - 1))
Putc(',', e); Putc(',', e);
} }
StringAppend(e, ")."); Append(e, ").");
Delete(fparms); Delete(fparms);
} else if (SwigType_isarray(e)) { } else if (SwigType_isarray(e)) {
Replace(e, pat, rep, DOH_REPLACE_ID); Replace(e, pat, rep, DOH_REPLACE_ID);
} }
StringAppend(nt, e); Append(nt, e);
} }
Clear(t); Clear(t);
StringAppend(t, nt); Append(t, nt);
Delete(nt); Delete(nt);
Delete(elem); Delete(elem);
} }

View file

@ -9,15 +9,11 @@ char cvsroot_keys_c[] = "$Id$";
#include "swigkeys.h" #include "swigkeys.h"
String *empty_string = 0;
String *k_SWIGTYPE = 0;
String *k_abstract = 0; String *k_abstract = 0;
String *k_access = 0; String *k_access = 0;
String *k_alias = 0; String *k_alias = 0;
String *k_allowstypedef = 0; String *k_allowstypedef = 0;
String *k_alttype = 0; String *k_alttype = 0;
String *k_argbyname = 0;
String *k_attrlist = 0;
String *k_baselist = 0; String *k_baselist = 0;
String *k_bases = 0; String *k_bases = 0;
String *k_cdecl = 0; String *k_cdecl = 0;
@ -26,33 +22,21 @@ String *k_classforward = 0;
String *k_classname = 0; String *k_classname = 0;
String *k_cplusstaticbase = 0; String *k_cplusstaticbase = 0;
String *k_code = 0; String *k_code = 0;
String *k_coloncolon = 0;
String *k_compactdefargs = 0;
String *k_construct = 0;
String *k_constructor = 0;
String *k_continue = 0;
String *k_conversionoperator = 0; String *k_conversionoperator = 0;
String *k_copy = 0;
String *k_csymnextSibling = 0; String *k_csymnextSibling = 0;
String *k_csympreviousSibling = 0; String *k_csympreviousSibling = 0;
String *k_csymtab = 0; String *k_csymtab = 0;
String *k_decl = 0; String *k_decl = 0;
String *k_default = 0; String *k_default = 0;
String *k_defaultargs = 0; String *k_defaultargs = 0;
String *k_destroy = 0;
String *k_destructor = 0;
String *k_director = 0; String *k_director = 0;
String *k_directorbase = 0; String *k_directorbase = 0;
String *k_directorprefixargs = 0; String *k_directorprefixargs = 0;
String *k_disown = 0;
String *k_emitonly = 0;
String *k_enumitem = 0; String *k_enumitem = 0;
String *k_error = 0; String *k_error = 0;
String *k_extern = 0; String *k_extern = 0;
String *k_fragment = 0;
String *k_friend = 0; String *k_friend = 0;
String *k_fullname = 0; String *k_fullname = 0;
String *k_get = 0;
String *k_hidden = 0; String *k_hidden = 0;
String *k_ignore = 0; String *k_ignore = 0;
String *k_inherit = 0; String *k_inherit = 0;
@ -60,38 +44,23 @@ String *k_kwargs = 0;
String *k_lname = 0; String *k_lname = 0;
String *k_locals = 0; String *k_locals = 0;
String *k_kind = 0; String *k_kind = 0;
String *k_match = 0;
String *k_matchlist = 0;
String *k_member = 0;
String *k_name = 0; String *k_name = 0;
String *k_namespace = 0; String *k_namespace = 0;
String *k_notmatch = 0;
String *k_parent = 0;
String *k_parm = 0; String *k_parm = 0;
String *k_parms = 0; String *k_parms = 0;
String *k_partialarg = 0; String *k_partialarg = 0;
String *k_partialargs = 0; String *k_partialargs = 0;
String *k_partials = 0; String *k_partials = 0;
String *k_pattern = 0;
String *k_pname = 0; String *k_pname = 0;
String *k_privatebaselist = 0; String *k_privatebaselist = 0;
String *k_protectedbaselist = 0; String *k_protectedbaselist = 0;
String *k_public = 0; String *k_public = 0;
String *k_qname = 0; String *k_qname = 0;
String *k_qualifier = 0; String *k_qualifier = 0;
String *k_rxsmatch = 0;
String *k_rxstarget = 0;
String *k_rename = 0; String *k_rename = 0;
String *k_result = 0; String *k_result = 0;
String *k_scope = 0;
String *k_section = 0;
String *k_self = 0;
String *k_set = 0;
String *k_sourcefmt = 0;
String *k_start = 0;
String *k_static = 0; String *k_static = 0;
String *k_storage = 0; String *k_storage = 0;
String *k_symboltable = 0;
String *k_symname = 0; String *k_symname = 0;
String *k_symnextSibling = 0; String *k_symnextSibling = 0;
String *k_symoverloaded = 0; String *k_symoverloaded = 0;
@ -101,15 +70,12 @@ String *k_symsymtab = 0;
String *k_symtab = 0; String *k_symtab = 0;
String *k_symtypename = 0; String *k_symtypename = 0;
String *k_symweak = 0; String *k_symweak = 0;
String *k_targetfmt = 0;
String *k_targetname = 0;
String *k_template = 0; String *k_template = 0;
String *k_templateparm = 0; String *k_templateparm = 0;
String *k_templateparms = 0; String *k_templateparms = 0;
String *k_templatetype = 0; String *k_templatetype = 0;
String *k_throw = 0; String *k_throw = 0;
String *k_throws = 0; String *k_throws = 0;
String *k_tmapmatch = 0;
String *k_type = 0; String *k_type = 0;
String *k_typemap = 0; String *k_typemap = 0;
String *k_typedef = 0; String *k_typedef = 0;
@ -119,7 +85,6 @@ String *k_unnamed = 0;
String *k_using = 0; String *k_using = 0;
String *k_value = 0; String *k_value = 0;
String *k_virtual = 0; String *k_virtual = 0;
String *k_vtable = 0;
String *k_wrapaction = 0; String *k_wrapaction = 0;
String *k_wrapcode = 0; String *k_wrapcode = 0;
String *k_wrapdirectormap = 0; String *k_wrapdirectormap = 0;
@ -127,15 +92,11 @@ String *k_wrapdisown = 0;
String *k_wrapper = 0; String *k_wrapper = 0;
void Swig_keys_init() { void Swig_keys_init() {
empty_string = NewString("");
k_SWIGTYPE = NewString("SWIGTYPE");
k_abstract = NewString("abstract"); k_abstract = NewString("abstract");
k_access = NewString("access"); k_access = NewString("access");
k_alias = NewString("alias"); k_alias = NewString("alias");
k_allowstypedef = NewString("allows_typedef"); k_allowstypedef = NewString("allows_typedef");
k_alttype = NewString("alttype"); k_alttype = NewString("alttype");
k_argbyname = NewString("arg:byname");
k_attrlist = NewString("attrlist");
k_baselist = NewString("baselist"); k_baselist = NewString("baselist");
k_bases = NewString("bases"); k_bases = NewString("bases");
k_cdecl = NewString("cdecl"); k_cdecl = NewString("cdecl");
@ -144,32 +105,20 @@ void Swig_keys_init() {
k_classname = NewString("classname"); k_classname = NewString("classname");
k_cplusstaticbase = NewString("cplus:staticbase");; k_cplusstaticbase = NewString("cplus:staticbase");;
k_code = NewString("code"); k_code = NewString("code");
k_coloncolon = NewString("::");
k_compactdefargs = NewString("compactdefargs");
k_construct = NewString("construct");
k_constructor = NewString("constructor");
k_continue = NewString("continue");
k_conversionoperator = NewString("conversion_operator"); k_conversionoperator = NewString("conversion_operator");
k_copy = NewString("copy");
k_csymnextSibling = NewString("csym:nextSibling"); k_csymnextSibling = NewString("csym:nextSibling");
k_csympreviousSibling = NewString("csym:previousSibling"); k_csympreviousSibling = NewString("csym:previousSibling");
k_csymtab = NewString("csymtab"); k_csymtab = NewString("csymtab");
k_decl = NewString("decl"); k_decl = NewString("decl");
k_default = NewString("default"); k_default = NewString("default");
k_defaultargs = NewString("defaultargs"); k_defaultargs = NewString("defaultargs");
k_destroy = NewString("destroy");
k_destructor = NewString("destructor");
k_director = NewString("director"); k_director = NewString("director");
k_directorbase = NewString("directorBase"); k_directorbase = NewString("directorBase");
k_directorprefixargs = NewString("director:prefix_args"); k_directorprefixargs = NewString("director:prefix_args");
k_disown = NewString("disown");
k_emitonly = NewString("emitonly");
k_enumitem = NewString("enumitem"); k_enumitem = NewString("enumitem");
k_error = NewString("error"); k_error = NewString("error");
k_fragment = NewString("fragment");
k_friend = NewString("friend"); k_friend = NewString("friend");
k_fullname = NewString("fullname"); k_fullname = NewString("fullname");
k_get = NewString("get");
k_hidden = NewString("hidden"); k_hidden = NewString("hidden");
k_ignore = NewString("ignore"); k_ignore = NewString("ignore");
k_inherit = NewString("inherit"); k_inherit = NewString("inherit");
@ -177,38 +126,23 @@ void Swig_keys_init() {
k_lname = NewString("lname"); k_lname = NewString("lname");
k_locals = NewString("locals"); k_locals = NewString("locals");
k_kind = NewString("kind"); k_kind = NewString("kind");
k_match = NewString("match");
k_matchlist = NewString("matchlist");
k_member = NewString("member");
k_name = NewString("name"); k_name = NewString("name");
k_namespace = NewString("namespace"); k_namespace = NewString("namespace");
k_notmatch = NewString("notmatch");
k_parent = NewString("parent");
k_parm = NewString("parm"); k_parm = NewString("parm");
k_parms = NewString("parms"); k_parms = NewString("parms");
k_partialarg = NewString("partialarg"); k_partialarg = NewString("partialarg");
k_partialargs = NewString("partialargs"); k_partialargs = NewString("partialargs");
k_partials = NewString("partials"); k_partials = NewString("partials");
k_pattern = NewString("pattern");
k_pname = NewString("pname"); k_pname = NewString("pname");
k_privatebaselist = NewString("privatebaselist"); k_privatebaselist = NewString("privatebaselist");
k_protectedbaselist = NewString("protectedbaselist"); k_protectedbaselist = NewString("protectedbaselist");
k_public = NewString("public"); k_public = NewString("public");
k_qname = NewString("qname"); k_qname = NewString("qname");
k_qualifier = NewString("qualifier"); k_qualifier = NewString("qualifier");
k_rxsmatch = NewString("rxsmatch");
k_rxstarget = NewString("rxstarget");
k_rename = NewString("rename"); k_rename = NewString("rename");
k_result = NewString("result"); k_result = NewString("result");
k_scope = NewString("scope");
k_section = NewString("section");
k_self = NewString("self");
k_set = NewString("set");
k_sourcefmt = NewString("sourcefmt");
k_start = NewString("*");
k_static = NewString("static"); k_static = NewString("static");
k_storage = NewString("storage"); k_storage = NewString("storage");
k_symboltable = NewString("symboltable");
k_symname = NewString("sym:name"); k_symname = NewString("sym:name");
k_symnextSibling = NewString("sym:nextSibling"); k_symnextSibling = NewString("sym:nextSibling");
k_symoverloaded = NewString("sym:overloaded"); k_symoverloaded = NewString("sym:overloaded");
@ -218,15 +152,12 @@ void Swig_keys_init() {
k_symtab = NewString("symtab"); k_symtab = NewString("symtab");
k_symtypename = NewString("sym:typename"); k_symtypename = NewString("sym:typename");
k_symweak = NewString("sym:weak"); k_symweak = NewString("sym:weak");
k_targetfmt = NewString("targetfmt");
k_targetname = NewString("targetname");
k_template = NewString("template"); k_template = NewString("template");
k_templateparm = NewString("templateparm"); k_templateparm = NewString("templateparm");
k_templateparms = NewString("templateparms"); k_templateparms = NewString("templateparms");
k_templatetype = NewString("templatetype"); k_templatetype = NewString("templatetype");
k_throw = NewString("throw"); k_throw = NewString("throw");
k_throws = NewString("throws"); k_throws = NewString("throws");
k_tmapmatch = NewString("tmap:match");
k_type = NewString("type"); k_type = NewString("type");
k_typemap = NewString("typemap"); k_typemap = NewString("typemap");
k_typedef = NewString("typedef"); k_typedef = NewString("typedef");
@ -236,7 +167,6 @@ void Swig_keys_init() {
k_using = NewString("using"); k_using = NewString("using");
k_value = NewString("value"); k_value = NewString("value");
k_virtual = NewString("virtual"); k_virtual = NewString("virtual");
k_vtable = NewString("vtable");
k_wrapaction = NewString("wrap:action"); k_wrapaction = NewString("wrap:action");
k_wrapcode = NewString("wrap:code"); k_wrapcode = NewString("wrap:code");
k_wrapdirectormap = NewString("wrap:directormap"); k_wrapdirectormap = NewString("wrap:directormap");

View file

@ -14,29 +14,19 @@
extern void Swig_keys_init(); extern void Swig_keys_init();
extern String *empty_string;
extern String *k_SWIGTYPE;
extern String *k_abstract; extern String *k_abstract;
extern String *k_access; extern String *k_access;
extern String *k_alias; extern String *k_alias;
extern String *k_allowstypedef; extern String *k_allowstypedef;
extern String *k_alttype; extern String *k_alttype;
extern String *k_argbyname;
extern String *k_attrlist;
extern String *k_baselist; extern String *k_baselist;
extern String *k_bases; extern String *k_bases;
extern String *k_cdecl; extern String *k_cdecl;
extern String *k_class; extern String *k_class;
extern String *k_classforward; extern String *k_classforward;
extern String *k_classname; extern String *k_classname;
extern String *k_copy;
extern String *k_cplusstaticbase; extern String *k_cplusstaticbase;
extern String *k_code; extern String *k_code;
extern String *k_coloncolon;
extern String *k_compactdefargs;
extern String *k_construct;
extern String *k_constructor;
extern String *k_continue;
extern String *k_conversionoperator; extern String *k_conversionoperator;
extern String *k_csymnextSibling; extern String *k_csymnextSibling;
extern String *k_csympreviousSibling; extern String *k_csympreviousSibling;
@ -44,20 +34,14 @@ extern String *k_csymtab;
extern String *k_decl; extern String *k_decl;
extern String *k_default; extern String *k_default;
extern String *k_defaultargs; extern String *k_defaultargs;
extern String *k_destroy;
extern String *k_destructor;
extern String *k_director; extern String *k_director;
extern String *k_directorbase; extern String *k_directorbase;
extern String *k_directorprefixargs; extern String *k_directorprefixargs;
extern String *k_disown;
extern String *k_emitonly;
extern String *k_enumitem; extern String *k_enumitem;
extern String *k_error; extern String *k_error;
extern String *k_extern; extern String *k_extern;
extern String *k_fragment;
extern String *k_friend; extern String *k_friend;
extern String *k_fullname; extern String *k_fullname;
extern String *k_get;
extern String *k_hidden; extern String *k_hidden;
extern String *k_ignore; extern String *k_ignore;
extern String *k_inherit; extern String *k_inherit;
@ -65,38 +49,23 @@ extern String *k_kwargs;
extern String *k_lname; extern String *k_lname;
extern String *k_locals; extern String *k_locals;
extern String *k_kind; extern String *k_kind;
extern String *k_match;
extern String *k_matchlist;
extern String *k_member;
extern String *k_name; extern String *k_name;
extern String *k_namespace; extern String *k_namespace;
extern String *k_notmatch;
extern String *k_parent;
extern String *k_parm; extern String *k_parm;
extern String *k_parms; extern String *k_parms;
extern String *k_partialarg; extern String *k_partialarg;
extern String *k_partialargs; extern String *k_partialargs;
extern String *k_partials; extern String *k_partials;
extern String *k_pattern;
extern String *k_pname; extern String *k_pname;
extern String *k_privatebaselist; extern String *k_privatebaselist;
extern String *k_protectedbaselist; extern String *k_protectedbaselist;
extern String *k_public; extern String *k_public;
extern String *k_qname; extern String *k_qname;
extern String *k_qualifier; extern String *k_qualifier;
extern String *k_rxsmatch;
extern String *k_rxstarget;
extern String *k_rename; extern String *k_rename;
extern String *k_result; extern String *k_result;
extern String *k_scope;
extern String *k_section;
extern String *k_self;
extern String *k_set;
extern String *k_sourcefmt;
extern String *k_start;
extern String *k_static; extern String *k_static;
extern String *k_storage; extern String *k_storage;
extern String *k_symboltable;
extern String *k_symname; extern String *k_symname;
extern String *k_symnextSibling; extern String *k_symnextSibling;
extern String *k_symoverloaded; extern String *k_symoverloaded;
@ -106,15 +75,12 @@ extern String *k_symsymtab;
extern String *k_symtab; extern String *k_symtab;
extern String *k_symtypename; extern String *k_symtypename;
extern String *k_symweak; extern String *k_symweak;
extern String *k_targetfmt;
extern String *k_targetname;
extern String *k_template; extern String *k_template;
extern String *k_templateparm; extern String *k_templateparm;
extern String *k_templateparms; extern String *k_templateparms;
extern String *k_templatetype; extern String *k_templatetype;
extern String *k_throw; extern String *k_throw;
extern String *k_throws; extern String *k_throws;
extern String *k_tmapmatch;
extern String *k_type; extern String *k_type;
extern String *k_typemap; extern String *k_typemap;
extern String *k_typedef; extern String *k_typedef;
@ -124,7 +90,6 @@ extern String *k_unnamed;
extern String *k_using; extern String *k_using;
extern String *k_value; extern String *k_value;
extern String *k_virtual; extern String *k_virtual;
extern String *k_vtable;
extern String *k_wrapaction; extern String *k_wrapaction;
extern String *k_wrapcode; extern String *k_wrapcode;
extern String *k_wrapdirectormap; extern String *k_wrapdirectormap;

View file

@ -12,7 +12,6 @@
/* Individual parameters */ /* Individual parameters */
extern Parm *NewParm(SwigType *type, const String_or_char *name); extern Parm *NewParm(SwigType *type, const String_or_char *name);
extern Parm *NewParmFromNode(SwigType *type, const String_or_char *name, Node *n);
extern Parm *CopyParm(Parm *p); extern Parm *CopyParm(Parm *p);
/* Parameter lists */ /* Parameter lists */
@ -26,4 +25,3 @@ extern String *ParmList_str_defaultargs(ParmList *);
extern String *ParmList_protostr(ParmList *); extern String *ParmList_protostr(ParmList *);
extern int ParmList_is_compactdefargs(ParmList *p); extern int ParmList_is_compactdefargs(ParmList *p);
extern int ParmList_has_defaultargs(ParmList *p); extern int ParmList_has_defaultargs(ParmList *p);
extern ParmList *ParmList_copy_all_except_last_parm(ParmList *p);

View file

@ -202,7 +202,7 @@ void Swig_symbol_init() {
current = NewHash(); current = NewHash();
current_symtab = NewHash(); current_symtab = NewHash();
ccurrent = NewHash(); ccurrent = NewHash();
set_nodeType(current_symtab, k_symboltable); set_nodeType(current_symtab, "symboltable");
Setattr(current_symtab, k_symtab, current); Setattr(current_symtab, k_symtab, current);
Delete(current); Delete(current);
Setattr(current_symtab, k_csymtab, ccurrent); Setattr(current_symtab, k_csymtab, ccurrent);
@ -210,7 +210,7 @@ void Swig_symbol_init() {
/* Set the global scope */ /* Set the global scope */
symtabs = NewHash(); symtabs = NewHash();
Setattr(symtabs, empty_string, current_symtab); Setattr(symtabs, "", current_symtab);
Delete(current_symtab); Delete(current_symtab);
global_scope = current_symtab; global_scope = current_symtab;
} }
@ -254,8 +254,8 @@ String *Swig_symbol_getscopename() {
Symtab *Swig_symbol_getscope(const String_or_char *name) { Symtab *Swig_symbol_getscope(const String_or_char *name) {
if (!symtabs) if (!symtabs)
return 0; return 0;
if (StringEqual(k_coloncolon, (String_or_char *) name)) if (Equal("::", (String_or_char *) name))
name = empty_string; name = "";
return Getattr(symtabs, name); return Getattr(symtabs, name);
} }
@ -281,10 +281,10 @@ String *Swig_symbol_qualifiedscopename(Symtab *symtab) {
if (!result) { if (!result) {
result = NewStringEmpty(); result = NewStringEmpty();
} }
if (StringLen(result)) { if (Len(result)) {
Printv(result, "::", name, NIL); Printv(result, "::", name, NIL);
} else { } else {
StringAppend(result, name); Append(result, name);
} }
} }
return result; return result;
@ -303,7 +303,7 @@ Symtab *Swig_symbol_newscope() {
hsyms = NewHash(); hsyms = NewHash();
h = NewHash(); h = NewHash();
set_nodeType(h, k_symboltable); set_nodeType(h, "symboltable");
Setattr(h, k_symtab, hsyms); Setattr(h, k_symtab, hsyms);
Delete(hsyms); Delete(hsyms);
set_parentNode(h, current_symtab); set_parentNode(h, current_symtab);
@ -447,7 +447,7 @@ void Swig_symbol_cadd(String_or_char *name, Node *n) {
if (SwigType_istemplate(name)) { if (SwigType_istemplate(name)) {
String *cname = NewString(name); String *cname = NewString(name);
String *dname = Swig_symbol_template_deftype(cname, 0); String *dname = Swig_symbol_template_deftype(cname, 0);
if (!StringEqual(dname, name)) { if (!Equal(dname, name)) {
Swig_symbol_cadd(dname, n); Swig_symbol_cadd(dname, n);
} }
Delete(dname); Delete(dname);
@ -563,7 +563,7 @@ void Swig_symbol_cadd(String_or_char *name, Node *n) {
if (td1 && Checkattr(td1, k_storage, k_typedef)) { if (td1 && Checkattr(td1, k_storage, k_typedef)) {
String *st = Getattr(td1, k_type); String *st = Getattr(td1, k_type);
String *sn = Getattr(td, k_name); String *sn = Getattr(td, k_name);
if (st && sn && StringEqual(st, sn)) { if (st && sn && Equal(st, sn)) {
Symtab *sc = Getattr(current_symtab, "parentNode"); Symtab *sc = Getattr(current_symtab, "parentNode");
if (sc) if (sc)
td1 = Swig_symbol_clookup(type, sc); td1 = Swig_symbol_clookup(type, sc);
@ -670,7 +670,7 @@ Node *Swig_symbol_add(String_or_char *symname, Node *n) {
/* Check for namespaces */ /* Check for namespaces */
String *ntype = Getattr(n, "nodeType"); String *ntype = Getattr(n, "nodeType");
if ((StringEqual(ntype, Getattr(c, "nodeType"))) && ((StringEqual(ntype, k_namespace)))) { if ((Equal(ntype, Getattr(c, "nodeType"))) && ((Equal(ntype, k_namespace)))) {
Node *cl, *pcl = 0; Node *cl, *pcl = 0;
cl = c; cl = c;
while (cl) { while (cl) {
@ -706,7 +706,7 @@ Node *Swig_symbol_add(String_or_char *symname, Node *n) {
} }
/* Make sure the other node is a typedef */ /* Make sure the other node is a typedef */
s = Getattr(other, k_storage); s = Getattr(other, k_storage);
if (!s || (!StringEqual(s, k_typedef))) if (!s || (!Equal(s, k_typedef)))
return c; /* No. This is a conflict */ return c; /* No. This is a conflict */
/* Hmmm. This appears to be okay. Make sure the symbol table refers to the allow_type node */ /* Hmmm. This appears to be okay. Make sure the symbol table refers to the allow_type node */
@ -725,17 +725,17 @@ Node *Swig_symbol_add(String_or_char *symname, Node *n) {
{ {
String *nt1, *nt2; String *nt1, *nt2;
nt1 = Getattr(n, "nodeType"); nt1 = Getattr(n, "nodeType");
if (StringEqual(nt1, k_template)) if (Equal(nt1, k_template))
nt1 = Getattr(n, k_templatetype); nt1 = Getattr(n, k_templatetype);
nt2 = Getattr(c, "nodeType"); nt2 = Getattr(c, "nodeType");
if (StringEqual(nt2, k_template)) if (Equal(nt2, k_template))
nt2 = Getattr(c, k_templatetype); nt2 = Getattr(c, k_templatetype);
if (StringEqual(nt1, k_using)) if (Equal(nt1, k_using))
u1 = 1; u1 = 1;
if (StringEqual(nt2, k_using)) if (Equal(nt2, k_using))
u2 = 1; u2 = 1;
if ((!StringEqual(nt1, nt2)) && !(u1 || u2)) if ((!Equal(nt1, nt2)) && !(u1 || u2))
return c; return c;
} }
if (!(u1 || u2)) { if (!(u1 || u2)) {
@ -761,8 +761,8 @@ Node *Swig_symbol_add(String_or_char *symname, Node *n) {
/* Okay. Walk down the list of symbols and see if we get a declarator match */ /* Okay. Walk down the list of symbols and see if we get a declarator match */
{ {
String *nt = Getattr(n, "nodeType"); String *nt = Getattr(n, "nodeType");
int n_template = StringEqual(nt, k_template) && Checkattr(n, k_templatetype, k_cdecl); int n_template = Equal(nt, k_template) && Checkattr(n, k_templatetype, k_cdecl);
int n_plain_cdecl = StringEqual(nt, k_cdecl); int n_plain_cdecl = Equal(nt, k_cdecl);
cn = c; cn = c;
pn = 0; pn = 0;
while (cn) { while (cn) {
@ -773,8 +773,8 @@ Node *Swig_symbol_add(String_or_char *symname, Node *n) {
/* Now check we don't have a non-templated function overloaded by a templated function with same params, /* 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(); */ * eg void foo(); template<typename> void foo(); */
String *cnt = Getattr(cn, "nodeType"); String *cnt = Getattr(cn, "nodeType");
int cn_template = StringEqual(cnt, k_template) && Checkattr(cn, k_templatetype, k_cdecl); int cn_template = Equal(cnt, k_template) && Checkattr(cn, k_templatetype, k_cdecl);
int cn_plain_cdecl = StringEqual(cnt, k_cdecl); int cn_plain_cdecl = Equal(cnt, k_cdecl);
if (!((n_template && cn_plain_cdecl) || (cn_template && n_plain_cdecl))) { if (!((n_template && cn_plain_cdecl) || (cn_template && n_plain_cdecl))) {
/* found a conflict */ /* found a conflict */
return cn; return cn;
@ -866,7 +866,7 @@ static Node *_symbol_lookup(String *name, Symtab *symtab, int (*check) (Node *n)
String *dname = 0; String *dname = 0;
Setmark(symtab, 0); Setmark(symtab, 0);
dname = Swig_symbol_template_deftype(name, symtab); dname = Swig_symbol_template_deftype(name, symtab);
if (!StringEqual(dname, name)) { if (!Equal(dname, name)) {
n = _symbol_lookup(dname, symtab, check); n = _symbol_lookup(dname, symtab, check);
} }
Delete(dname); Delete(dname);
@ -930,12 +930,12 @@ static Node *symbol_lookup_qualified(String_or_char *name, Symtab *symtab, Strin
String *qalloc = 0; String *qalloc = 0;
String *qname = Swig_symbol_qualifiedscopename(symtab); String *qname = Swig_symbol_qualifiedscopename(symtab);
if (qname) { if (qname) {
if (StringLen(qname)) { if (Len(qname)) {
if (prefix && StringLen(prefix)) { if (prefix && Len(prefix)) {
Printv(qname, k_coloncolon, prefix, NIL); Printv(qname, "::", prefix, NIL);
} }
} else { } else {
StringAppend(qname, prefix); Append(qname, prefix);
} }
qalloc = qname; qalloc = qname;
} else { } else {
@ -986,7 +986,7 @@ Node *Swig_symbol_clookup(String_or_char *name, Symtab *n) {
if (!n) { if (!n) {
hsym = current_symtab; hsym = current_symtab;
} else { } else {
if (!Checkattr(n, "nodeType", k_symboltable)) { if (!Checkattr(n, "nodeType", "symboltable")) {
n = Getattr(n, k_symsymtab); n = Getattr(n, k_symsymtab);
} }
assert(n); assert(n);
@ -1032,7 +1032,7 @@ Node *Swig_symbol_clookup(String_or_char *name, Symtab *n) {
while (s && Checkattr(s, "nodeType", k_using)) { while (s && Checkattr(s, "nodeType", k_using)) {
String *uname = Getattr(s, k_uname); String *uname = Getattr(s, k_uname);
Symtab *un = Getattr(s, k_symsymtab); Symtab *un = Getattr(s, k_symsymtab);
Node *ss = (!StringEqual(name, uname) || (un != n)) ? Swig_symbol_clookup(uname, un) : 0; /* avoid infinity loop */ Node *ss = (!Equal(name, uname) || (un != n)) ? Swig_symbol_clookup(uname, un) : 0; /* avoid infinity loop */
if (!ss) { 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, k_uname));
} }
@ -1058,7 +1058,7 @@ Node *Swig_symbol_clookup_check(String_or_char *name, Symtab *n, int (*checkfunc
if (!n) { if (!n) {
hsym = current_symtab; hsym = current_symtab;
} else { } else {
if (!Checkattr(n, "nodeType", k_symboltable)) { if (!Checkattr(n, "nodeType", "symboltable")) {
n = Getattr(n, k_symsymtab); n = Getattr(n, k_symsymtab);
} }
assert(n); assert(n);
@ -1123,7 +1123,7 @@ Node *Swig_symbol_clookup_local(String_or_char *name, Symtab *n) {
hsym = current_symtab; hsym = current_symtab;
h = ccurrent; h = ccurrent;
} else { } else {
if (!Checkattr(n, "nodeType", k_symboltable)) { if (!Checkattr(n, "nodeType", "symboltable")) {
n = Getattr(n, k_symsymtab); n = Getattr(n, k_symsymtab);
} }
assert(n); assert(n);
@ -1171,7 +1171,7 @@ Node *Swig_symbol_clookup_local_check(String_or_char *name, Symtab *n, int (*che
hsym = current_symtab; hsym = current_symtab;
h = ccurrent; h = ccurrent;
} else { } else {
if (!Checkattr(n, "nodeType", k_symboltable)) { if (!Checkattr(n, "nodeType", "symboltable")) {
n = Getattr(n, k_symsymtab); n = Getattr(n, k_symsymtab);
} }
assert(n); assert(n);
@ -1308,7 +1308,7 @@ void Swig_symbol_remove(Node *n) {
String *Swig_symbol_qualified(Node *n) { String *Swig_symbol_qualified(Node *n) {
Hash *symtab; Hash *symtab;
if (Checkattr(n, "nodeType", k_symboltable)) { if (Checkattr(n, "nodeType", "symboltable")) {
symtab = n; symtab = n;
} else { } else {
symtab = Getattr(n, k_symsymtab); symtab = Getattr(n, k_symsymtab);
@ -1338,7 +1338,7 @@ Node *Swig_symbol_isoverloaded(Node *n) {
* ----------------------------------------------------------------------------- */ * ----------------------------------------------------------------------------- */
static int no_constructor(Node *n) { static int no_constructor(Node *n) {
return !Checkattr(n, "nodeType", k_constructor); return !Checkattr(n, "nodeType", "constructor");
} }
/* This cache produce problems with OSS, don't active it */ /* This cache produce problems with OSS, don't active it */
@ -1372,7 +1372,7 @@ static SwigType *Swig_symbol_template_qualify(const SwigType *e, Symtab *st) {
targs = SwigType_parmlist(e); targs = SwigType_parmlist(e);
tempn = Swig_symbol_clookup_local(tprefix, st); tempn = Swig_symbol_clookup_local(tprefix, st);
tscope = tempn ? Getattr(tempn, k_symsymtab) : 0; tscope = tempn ? Getattr(tempn, k_symsymtab) : 0;
StringAppend(qprefix, "<("); Append(qprefix, "<(");
for (ti = First(targs); ti.item;) { for (ti = First(targs); ti.item;) {
String *vparm; String *vparm;
String *qparm = Swig_symbol_type_qualify(ti.item, st); String *qparm = Swig_symbol_type_qualify(ti.item, st);
@ -1383,16 +1383,16 @@ static SwigType *Swig_symbol_template_qualify(const SwigType *e, Symtab *st) {
} }
vparm = Swig_symbol_template_param_eval(qparm, st); vparm = Swig_symbol_template_param_eval(qparm, st);
StringAppend(qprefix, vparm); Append(qprefix, vparm);
ti = Next(ti); ti = Next(ti);
if (ti.item) { if (ti.item) {
StringPutc(',', qprefix); Putc(',', qprefix);
} }
Delete(qparm); Delete(qparm);
Delete(vparm); Delete(vparm);
} }
StringAppend(qprefix, ")>"); Append(qprefix, ")>");
StringAppend(qprefix, tsuffix); Append(qprefix, tsuffix);
Delete(tprefix); Delete(tprefix);
Delete(tsuffix); Delete(tsuffix);
Delete(targs); Delete(targs);
@ -1414,7 +1414,7 @@ SwigType *Swig_symbol_type_qualify(const SwigType *t, Symtab *st) {
int i, len; int i, len;
char *c = Char(t); char *c = Char(t);
if (strncmp(c, "::", 2) == 0) { if (strncmp(c, "::", 2) == 0) {
StringAppend(result, t); Append(result, t);
return result; return result;
} }
@ -1428,14 +1428,14 @@ SwigType *Swig_symbol_type_qualify(const SwigType *t, Symtab *st) {
if (n) { if (n) {
String *name = Getattr(n, k_name); String *name = Getattr(n, k_name);
Clear(e); Clear(e);
StringAppend(e, name); Append(e, name);
#ifdef SWIG_DEBUG #ifdef SWIG_DEBUG
Printf(stderr, "symbol_qual_ei %d %s %s %x\n", i, name, e, st); Printf(stderr, "symbol_qual_ei %d %s %s %x\n", i, name, e, st);
#endif #endif
if (!Swig_scopename_check(name)) { if (!Swig_scopename_check(name)) {
String *qname = Swig_symbol_qualified(n); String *qname = Swig_symbol_qualified(n);
if (qname && StringLen(qname)) { if (qname && Len(qname)) {
Insert(e, 0, k_coloncolon); Insert(e, 0, "::");
Insert(e, 0, qname); Insert(e, 0, qname);
} }
#ifdef SWIG_DEBUG #ifdef SWIG_DEBUG
@ -1446,33 +1446,33 @@ SwigType *Swig_symbol_type_qualify(const SwigType *t, Symtab *st) {
} else if (SwigType_istemplate(e)) { } else if (SwigType_istemplate(e)) {
SwigType *ty = Swig_symbol_template_qualify(e, st); SwigType *ty = Swig_symbol_template_qualify(e, st);
Clear(e); Clear(e);
StringAppend(e, ty); Append(e, ty);
Delete(ty); Delete(ty);
} }
if (strncmp(StringChar(e), "::", 2) == 0) { if (strncmp(Char(e), "::", 2) == 0) {
Delitem(e, 0); Delitem(e, 0);
Delitem(e, 0); Delitem(e, 0);
} }
StringAppend(result, e); Append(result, e);
} else if (SwigType_isfunction(e)) { } else if (SwigType_isfunction(e)) {
List *parms = SwigType_parmlist(e); List *parms = SwigType_parmlist(e);
String *s = NewString("f("); String *s = NewString("f(");
Iterator pi = First(parms); Iterator pi = First(parms);
while (pi.item) { while (pi.item) {
String *pf = Swig_symbol_type_qualify(pi.item, st); String *pf = Swig_symbol_type_qualify(pi.item, st);
StringAppend(s, pf); Append(s, pf);
pi = Next(pi); pi = Next(pi);
if (pi.item) { if (pi.item) {
StringAppend(s, ","); Append(s, ",");
} }
Delete(pf); Delete(pf);
} }
StringAppend(s, ")."); Append(s, ").");
StringAppend(result, s); Append(result, s);
Delete(parms); Delete(parms);
Delete(s); Delete(s);
} else { } else {
StringAppend(result, e); Append(result, e);
} }
} }
Delete(elements); Delete(elements);
@ -1497,7 +1497,7 @@ SwigType *Swig_symbol_template_reduce(SwigType *qt, Symtab *ntab) {
String *tprefix = SwigType_templateprefix(qt); String *tprefix = SwigType_templateprefix(qt);
String *tsuffix = SwigType_templatesuffix(qt); String *tsuffix = SwigType_templatesuffix(qt);
String *qprefix = SwigType_typedef_qualified(tprefix); String *qprefix = SwigType_typedef_qualified(tprefix);
StringAppend(qprefix, "<("); Append(qprefix, "<(");
while ((p = pi.item)) { while ((p = pi.item)) {
String *np; String *np;
String *tp = Swig_symbol_typedef_reduce(p, ntab); String *tp = Swig_symbol_typedef_reduce(p, ntab);
@ -1508,24 +1508,24 @@ SwigType *Swig_symbol_template_reduce(SwigType *qt, Symtab *ntab) {
np = Copy(Getattr(n, k_name)); np = Copy(Getattr(n, k_name));
Delete(tp); Delete(tp);
tp = np; tp = np;
if (qual && StringLen(qual)) { if (qual && Len(qual)) {
Insert(np, 0, k_coloncolon); Insert(np, 0, "::");
Insert(np, 0, qual); Insert(np, 0, qual);
} }
Delete(qual); Delete(qual);
} else { } else {
np = qp; np = qp;
} }
StringAppend(qprefix, np); Append(qprefix, np);
pi = Next(pi); pi = Next(pi);
if (pi.item) { if (pi.item) {
StringAppend(qprefix, ","); Append(qprefix, ",");
} }
Delete(qp); Delete(qp);
Delete(tp); Delete(tp);
} }
StringAppend(qprefix, ")>"); Append(qprefix, ")>");
StringAppend(qprefix, tsuffix); Append(qprefix, tsuffix);
Delete(parms); Delete(parms);
Delete(tprefix); Delete(tprefix);
Delete(tsuffix); Delete(tsuffix);
@ -1545,7 +1545,7 @@ SwigType *Swig_symbol_typedef_reduce(SwigType *ty, Symtab *tab) {
if (!n) { if (!n) {
if (SwigType_istemplate(ty)) { if (SwigType_istemplate(ty)) {
SwigType *qt = Swig_symbol_template_reduce(base, tab); SwigType *qt = Swig_symbol_template_reduce(base, tab);
StringAppend(prefix, qt); Append(prefix, qt);
Delete(qt); Delete(qt);
#ifdef SWIG_DEBUG #ifdef SWIG_DEBUG
Printf(stderr, "symbol_reduce %s %s\n", ty, prefix); Printf(stderr, "symbol_reduce %s %s\n", ty, prefix);
@ -1561,7 +1561,7 @@ SwigType *Swig_symbol_typedef_reduce(SwigType *ty, Symtab *tab) {
} }
} }
nt = Getattr(n, "nodeType"); nt = Getattr(n, "nodeType");
if (StringEqual(nt, k_using)) { if (Equal(nt, k_using)) {
String *uname = Getattr(n, k_uname); String *uname = Getattr(n, k_uname);
if (uname) { if (uname) {
n = Swig_symbol_clookup(base, Getattr(n, k_symsymtab)); n = Swig_symbol_clookup(base, Getattr(n, k_symsymtab));
@ -1575,9 +1575,9 @@ SwigType *Swig_symbol_typedef_reduce(SwigType *ty, Symtab *tab) {
} }
} }
} }
if (StringEqual(nt, k_cdecl)) { if (Equal(nt, k_cdecl)) {
String *storage = Getattr(n, k_storage); String *storage = Getattr(n, k_storage);
if (storage && (StringEqual(storage, k_typedef))) { if (storage && (Equal(storage, k_typedef))) {
SwigType *decl; SwigType *decl;
SwigType *rt; SwigType *rt;
SwigType *qt; SwigType *qt;
@ -1588,7 +1588,7 @@ SwigType *Swig_symbol_typedef_reduce(SwigType *ty, Symtab *tab) {
{ {
const char *dclass[3] = { "struct ", "union ", "class " }; const char *dclass[3] = { "struct ", "union ", "class " };
int i; int i;
char *c = StringChar(nt); char *c = Char(nt);
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
if (strstr(c, dclass[i]) == c) { if (strstr(c, dclass[i]) == c) {
Replace(nt, dclass[i], "", DOH_REPLACE_FIRST); Replace(nt, dclass[i], "", DOH_REPLACE_FIRST);
@ -1639,26 +1639,26 @@ String *Swig_symbol_string_qualify(String *s, Symtab *st) {
int have_id = 0; int have_id = 0;
String *id = NewStringEmpty(); String *id = NewStringEmpty();
String *r = NewStringEmpty(); String *r = NewStringEmpty();
char *c = StringChar(s); char *c = Char(s);
while (*c) { while (*c) {
if (isalpha((int) *c) || (*c == '_') || (*c == ':')) { if (isalpha((int) *c) || (*c == '_') || (*c == ':')) {
StringPutc(*c, id); Putc(*c, id);
have_id = 1; have_id = 1;
} else { } else {
if (have_id) { if (have_id) {
String *qid = Swig_symbol_type_qualify(id, st); String *qid = Swig_symbol_type_qualify(id, st);
StringAppend(r, qid); Append(r, qid);
Clear(id); Clear(id);
Delete(qid); Delete(qid);
have_id = 0; have_id = 0;
} }
StringPutc(*c, r); Putc(*c, r);
} }
c++; c++;
} }
if (have_id) { if (have_id) {
String *qid = Swig_symbol_type_qualify(id, st); String *qid = Swig_symbol_type_qualify(id, st);
StringAppend(r, qid); Append(r, qid);
Delete(qid); Delete(qid);
} }
Delete(id); Delete(id);
@ -1769,15 +1769,15 @@ SwigType *Swig_symbol_template_deftype(const SwigType *type, Symtab *tscope) {
while (pi.item) { while (pi.item) {
String *pf = SwigType_istemplate(e) ? Swig_symbol_template_deftype(pi.item, tscope) String *pf = SwigType_istemplate(e) ? Swig_symbol_template_deftype(pi.item, tscope)
: Swig_symbol_type_qualify(pi.item, tscope); : Swig_symbol_type_qualify(pi.item, tscope);
StringAppend(s, pf); Append(s, pf);
pi = Next(pi); pi = Next(pi);
if (pi.item) { if (pi.item) {
StringAppend(s, ","); Append(s, ",");
} }
Delete(pf); Delete(pf);
} }
StringAppend(s, ")."); Append(s, ").");
StringAppend(result, s); Append(result, s);
Delete(s); Delete(s);
Delete(parms); Delete(parms);
} else if (SwigType_istemplate(e)) { } else if (SwigType_istemplate(e)) {
@ -1802,7 +1802,7 @@ SwigType *Swig_symbol_template_deftype(const SwigType *type, Symtab *tscope) {
#ifdef SWIG_DEBUG #ifdef SWIG_DEBUG
Printf(stderr, "deftype type %s %s %s\n", tprefix, targs, tsuffix); Printf(stderr, "deftype type %s %s %s\n", tprefix, targs, tsuffix);
#endif #endif
StringAppend(tprefix, "<("); Append(tprefix, "<(");
Swig_symbol_template_defargs(tparms, tnargs, tscope, tsdecl); Swig_symbol_template_defargs(tparms, tnargs, tscope, tsdecl);
p = tparms; p = tparms;
tscope = tsdecl; tscope = tsdecl;
@ -1822,22 +1822,22 @@ SwigType *Swig_symbol_template_deftype(const SwigType *type, Symtab *tscope) {
Printf(stderr, "arg deftype %s\n", ttq); Printf(stderr, "arg deftype %s\n", ttq);
#endif #endif
} }
StringAppend(tprefix, ttq); Append(tprefix, ttq);
p = nextSibling(p); p = nextSibling(p);
if (p) if (p)
StringPutc(',', tprefix); Putc(',', tprefix);
Delete(ttf); Delete(ttf);
Delete(ttq); Delete(ttq);
} }
StringAppend(tprefix, ")>"); Append(tprefix, ")>");
StringAppend(tprefix, tsuffix); Append(tprefix, tsuffix);
StringAppend(prefix, tprefix); Append(prefix, tprefix);
#ifdef SWIG_DEBUG #ifdef SWIG_DEBUG
Printf(stderr, "deftype %s %s \n", type, tprefix); Printf(stderr, "deftype %s %s \n", type, tprefix);
#endif #endif
StringAppend(result, prefix); Append(result, prefix);
} else { } else {
StringAppend(result, e); Append(result, e);
} }
Delete(prefix); Delete(prefix);
Delete(base); Delete(base);
@ -1846,7 +1846,7 @@ SwigType *Swig_symbol_template_deftype(const SwigType *type, Symtab *tscope) {
Delete(targs); Delete(targs);
Delete(tparms); Delete(tparms);
} else { } else {
StringAppend(result, e); Append(result, e);
} }
} }
Delete(elements); Delete(elements);
@ -1868,12 +1868,12 @@ SwigType *Swig_symbol_template_param_eval(const SwigType *p, Symtab *symtab) {
lastnode = n; lastnode = n;
if (n) { if (n) {
String *nt = Getattr(n, "nodeType"); String *nt = Getattr(n, "nodeType");
if (StringEqual(nt, k_enumitem)) { if (Equal(nt, k_enumitem)) {
/* An enum item. Generate a fully qualified name */ /* An enum item. Generate a fully qualified name */
String *qn = Swig_symbol_qualified(n); String *qn = Swig_symbol_qualified(n);
if (qn && StringLen(qn)) { if (qn && Len(qn)) {
StringAppend(qn, k_coloncolon); Append(qn, "::");
StringAppend(qn, Getattr(n, k_name)); Append(qn, Getattr(n, k_name));
Delete(value); Delete(value);
value = qn; value = qn;
continue; continue;
@ -1881,7 +1881,7 @@ SwigType *Swig_symbol_template_param_eval(const SwigType *p, Symtab *symtab) {
Delete(qn); Delete(qn);
break; break;
} }
} else if ((StringEqual(nt, k_cdecl))) { } else if ((Equal(nt, k_cdecl))) {
String *nv = Getattr(n, k_value); String *nv = Getattr(n, k_value);
if (nv) { if (nv) {
Delete(value); Delete(value);

View file

@ -664,7 +664,7 @@ Hash *Swig_typemap_search(const String_or_char *op, SwigType *type, const String
if (!unstripped) { if (!unstripped) {
unstripped = ctype; unstripped = ctype;
ctype = SwigType_strip_qualifiers(ctype); ctype = SwigType_strip_qualifiers(ctype);
if (!StringEqual(ctype, unstripped)) if (!Equal(ctype, unstripped))
continue; /* Types are different */ continue; /* Types are different */
Delete(ctype); Delete(ctype);
ctype = unstripped; ctype = unstripped;
@ -756,7 +756,7 @@ Hash *Swig_typemap_search_multi(const String_or_char *op, ParmList *parms, int *
tm = Swig_typemap_search(op, type, name, &mtype); tm = Swig_typemap_search(op, type, name, &mtype);
if (tm) { if (tm) {
if (mtype && SwigType_isarray(mtype)) { if (mtype && SwigType_isarray(mtype)) {
Setattr(parms, k_tmapmatch, mtype); Setattr(parms, "tmap:match", mtype);
} }
Delete(mtype); Delete(mtype);
newop = NewStringf("%s-%s+%s:", op, type, name); newop = NewStringf("%s-%s+%s:", op, type, name);
@ -1127,7 +1127,7 @@ static void typemap_locals(DOHString * s, ParmList *l, Wrapper *f, int argnum) {
if ((argnum >= 0) && (!isglobal)) { if ((argnum >= 0) && (!isglobal)) {
Printf(str, "%s%d", pn, argnum); Printf(str, "%s%d", pn, argnum);
} else { } else {
StringAppend(str, pn); Append(str, pn);
} }
if (isglobal && Wrapper_check_local(f, str)) { if (isglobal && Wrapper_check_local(f, str)) {
p = nextSibling(p); p = nextSibling(p);
@ -1273,7 +1273,7 @@ String *Swig_typemap_lookup_new(const String_or_char *op, Node *node, const Stri
Symtab *st = Getattr(node, k_symsymtab); Symtab *st = Getattr(node, k_symsymtab);
String *qsn = st ? Swig_symbol_string_qualify(pname, st) : 0; String *qsn = st ? Swig_symbol_string_qualify(pname, st) : 0;
if (qsn) { if (qsn) {
if (StringLen(qsn) && !Equal(qsn, pname)) { if (Len(qsn) && !Equal(qsn, pname)) {
tm = Swig_typemap_search(op, type, qsn, &mtype); 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, k_pname) || strstr(Char(Getattr(tm, k_type)), "SWIGTYPE"))) {
tm = 0; tm = 0;
@ -1342,7 +1342,7 @@ String *Swig_typemap_lookup_new(const String_or_char *op, Node *node, const Stri
Delete(locals); Delete(locals);
} }
if (Checkattr(tm, k_type, k_SWIGTYPE)) { if (Checkattr(tm, k_type, "SWIGTYPE")) {
sprintf(temp, "%s:SWIGTYPE", cop); sprintf(temp, "%s:SWIGTYPE", cop);
Setattr(node, tmop_name(temp), "1"); Setattr(node, tmop_name(temp), "1");
} }
@ -1355,7 +1355,7 @@ String *Swig_typemap_lookup_new(const String_or_char *op, Node *node, const Stri
char *ckwname = Char(Getattr(kw, k_name)); char *ckwname = Char(Getattr(kw, k_name));
if (type) { if (type) {
String *mangle = Swig_string_mangle(type); String *mangle = Swig_string_mangle(type);
StringAppend(value, mangle); Append(value, mangle);
Delete(mangle); Delete(mangle);
} }
sprintf(temp, "%s:%s", cop, ckwname); sprintf(temp, "%s:%s", cop, ckwname);
@ -1529,7 +1529,7 @@ void Swig_typemap_attach_parms(const String_or_char *op, ParmList *parms, Wrappe
here, the freearg typemap requires the "in" typemap to match, here, the freearg typemap requires the "in" typemap to match,
or the 'var$argnum' variable will not exist. or the 'var$argnum' variable will not exist.
*/ */
kwmatch = Swig_typemap_get_option(tm, k_match); kwmatch = Swig_typemap_get_option(tm, "match");
if (kwmatch) { if (kwmatch) {
String *tmname = NewStringf("tmap:%s", kwmatch); String *tmname = NewStringf("tmap:%s", kwmatch);
String *tmin = Getattr(p, tmname); String *tmin = Getattr(p, tmname);
@ -1605,16 +1605,16 @@ void Swig_typemap_attach_parms(const String_or_char *op, ParmList *parms, Wrappe
type = Getattr(p, k_type); type = Getattr(p, k_type);
pname = Getattr(p, k_name); pname = Getattr(p, k_name);
lname = Getattr(p, k_lname); lname = Getattr(p, k_lname);
mtype = Getattr(p, k_tmapmatch); mtype = Getattr(p, "tmap:match");
if (mtype) { if (mtype) {
typemap_replace_vars(s, locals, mtype, type, pname, lname, i + 1); typemap_replace_vars(s, locals, mtype, type, pname, lname, i + 1);
Delattr(p, k_tmapmatch); Delattr(p, "tmap:match");
} else { } else {
typemap_replace_vars(s, locals, type, type, pname, lname, i + 1); typemap_replace_vars(s, locals, type, type, pname, lname, i + 1);
} }
if (Checkattr(tm, k_type, k_SWIGTYPE)) { if (Checkattr(tm, k_type, "SWIGTYPE")) {
sprintf(temp, "%s:SWIGTYPE", cop); sprintf(temp, "%s:SWIGTYPE", cop);
Setattr(p, tmop_name(temp), "1"); Setattr(p, tmop_name(temp), "1");
} }

View file

@ -214,14 +214,14 @@ int SwigType_typedef_class(String_or_char *name) {
String *SwigType_scope_name(Typetab *ttab) { String *SwigType_scope_name(Typetab *ttab) {
String *qname = NewString(Getattr(ttab, k_name)); String *qname = NewString(Getattr(ttab, k_name));
ttab = Getattr(ttab, k_parent); ttab = Getattr(ttab, "parent");
while (ttab) { while (ttab) {
String *pname = Getattr(ttab, k_name); String *pname = Getattr(ttab, k_name);
if (Len(pname)) { if (Len(pname)) {
Insert(qname, 0, "::"); Insert(qname, 0, "::");
Insert(qname, 0, pname); Insert(qname, 0, pname);
} }
ttab = Getattr(ttab, k_parent); ttab = Getattr(ttab, "parent");
} }
return qname; return qname;
} }
@ -242,7 +242,7 @@ void SwigType_new_scope(const String_or_char *name) {
} }
s = NewHash(); s = NewHash();
Setattr(s, k_name, name); Setattr(s, k_name, name);
Setattr(s, k_parent, current_scope); Setattr(s, "parent", current_scope);
ttab = NewHash(); ttab = NewHash();
Setattr(s, k_typetab, ttab); Setattr(s, k_typetab, ttab);
@ -341,7 +341,7 @@ void SwigType_using_scope(Typetab *scope) {
Typetab *SwigType_pop_scope() { Typetab *SwigType_pop_scope() {
Typetab *t, *old = current_scope; Typetab *t, *old = current_scope;
t = Getattr(current_scope, k_parent); t = Getattr(current_scope, "parent");
if (!t) if (!t)
t = global_scope; t = global_scope;
current_scope = t; current_scope = t;
@ -466,7 +466,7 @@ Typetab *SwigType_find_scope(Typetab *s, String *nameprefix) {
} }
if (!check_parent) if (!check_parent)
break; break;
ss = Getattr(ss, k_parent); ss = Getattr(ss, "parent");
} }
if (nnameprefix) if (nnameprefix)
Delete(nnameprefix); Delete(nnameprefix);
@ -519,7 +519,7 @@ static SwigType *_typedef_resolve(Typetab *s, String *base, int look_parent) {
if (!type) { if (!type) {
/* Hmmm. Not found in my scope. check parent */ /* Hmmm. Not found in my scope. check parent */
if (look_parent) { if (look_parent) {
parent = Getattr(s, k_parent); parent = Getattr(s, "parent");
type = parent ? _typedef_resolve(parent, base, 1) : 0; type = parent ? _typedef_resolve(parent, base, 1) : 0;
} }
} }
@ -563,7 +563,7 @@ SwigType *SwigType_typedef_resolve(SwigType *t) {
} }
r = Getattr(typedef_resolve_cache, t); r = Getattr(typedef_resolve_cache, t);
if (r) { if (r) {
resolved_scope = Getmeta(r, k_scope); resolved_scope = Getmeta(r, "scope");
return Copy(r); return Copy(r);
} }
#endif #endif
@ -650,7 +650,7 @@ SwigType *SwigType_typedef_resolve(SwigType *t) {
} }
} }
if (type && (StringEqual(base, type))) { if (type && (Equal(base, type))) {
if (newtype) if (newtype)
Delete(type); Delete(type);
Delete(base); Delete(base);
@ -785,7 +785,7 @@ return_result:
if (r) { if (r) {
SwigType *r1; SwigType *r1;
Setattr(typedef_resolve_cache, key, r); Setattr(typedef_resolve_cache, key, r);
Setmeta(r, k_scope, resolved_scope); Setmeta(r, "scope", resolved_scope);
r1 = Copy(r); r1 = Copy(r);
Delete(r); Delete(r);
r = r1; r = r1;
@ -915,7 +915,7 @@ SwigType *SwigType_typedef_qualified(SwigType *t) {
break; break;
} }
Delete(qs); Delete(qs);
cs = Getattr(cs, k_parent); cs = Getattr(cs, "parent");
} }
} }
} }
@ -940,7 +940,7 @@ SwigType *SwigType_typedef_qualified(SwigType *t) {
pi = First(parms); pi = First(parms);
while ((p = pi.item)) { while ((p = pi.item)) {
String *qt = SwigType_typedef_qualified(p); String *qt = SwigType_typedef_qualified(p);
if (StringEqual(qt, p)) { /* && (!Swig_scopename_check(qt))) */ if (Equal(qt, p)) { /* && (!Swig_scopename_check(qt))) */
/* No change in value. It is entirely possible that the parameter is an integer value. /* No change in value. It is entirely possible that the parameter is an integer value.
If there is a symbol table associated with this scope, we're going to check for this */ If there is a symbol table associated with this scope, we're going to check for this */