summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Doc/Devel/index.html4
-rw-r--r--Doc/Devel/parm.html108
-rw-r--r--Source/CParse/parser.y24
-rw-r--r--Source/CParse/templ.c26
-rw-r--r--Source/DOH/doh.h42
-rw-r--r--Source/DOH/string.c23
-rw-r--r--Source/Makefile.am1
-rw-r--r--Source/Modules/cffi.cxx2
-rw-r--r--Source/Modules/csharp.cxx7
-rw-r--r--Source/Modules/java.cxx7
-rw-r--r--Source/Modules/php4.cxx2
-rw-r--r--Source/Modules/typepass.cxx6
-rw-r--r--Source/Preprocessor/cpp.c328
-rw-r--r--Source/Swig/cwrap.c30
-rw-r--r--Source/Swig/deprecate.c70
-rw-r--r--Source/Swig/fragment.c10
-rw-r--r--Source/Swig/include.c10
-rw-r--r--Source/Swig/misc.c8
-rw-r--r--Source/Swig/naming.c62
-rw-r--r--Source/Swig/parms.c124
-rw-r--r--Source/Swig/stype.c108
-rw-r--r--Source/Swig/swigkeys.c70
-rw-r--r--Source/Swig/swigkeys.h35
-rw-r--r--Source/Swig/swigparm.h2
-rw-r--r--Source/Swig/symbol.c168
-rw-r--r--Source/Swig/typemap.c20
-rw-r--r--Source/Swig/typesys.c22
27 files changed, 642 insertions, 677 deletions
diff --git a/Doc/Devel/index.html b/Doc/Devel/index.html
index c4f6669c4..35aff4ab1 100644
--- a/Doc/Devel/index.html
+++ b/Doc/Devel/index.html
@@ -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="cmdopt.html">Command line arguments</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>
<hr>
-Copyright (C) 1999-2004 SWIG Development Team.
+Copyright (C) 1999-2007 SWIG Development Team.
</body>
</html>
diff --git a/Doc/Devel/parm.html b/Doc/Devel/parm.html
new file mode 100644
index 000000000..14b604811
--- /dev/null
+++ b/Doc/Devel/parm.html
@@ -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>
+
+
+
+
+
diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y
index 295a78c80..dc191836f 100644
--- a/Source/CParse/parser.y
+++ b/Source/CParse/parser.y
@@ -323,7 +323,7 @@ static void add_symbols(Node *n) {
*/
String *prefix = name ? Swig_scopename_prefix(name) : 0;
if (prefix) {
- if (Classprefix && (StringEqual(prefix,Classprefix))) {
+ if (Classprefix && (Equal(prefix,Classprefix))) {
String *base = Swig_scopename_last(name);
Setattr(n,k_name,base);
Delete(base);
@@ -1235,7 +1235,7 @@ static void default_arguments(Node *n) {
|| GetFlag(function,"feature:kwargs")) {
ParmList *p = Getattr(function,k_parms);
if (p)
- Setattr(p,k_compactdefargs, "1"); /* mark parameters for special handling */
+ Setattr(p,"compactdefargs", "1"); /* mark parameters for special handling */
function = 0; /* don't add in extra methods */
}
}
@@ -1680,7 +1680,7 @@ extend_directive : EXTEND options idcolon LBRACE {
apply_directive : APPLY typemap_parm LBRACE tm_list RBRACE {
$$ = new_node("apply");
- Setattr($$,k_pattern,Getattr($2,k_pattern));
+ Setattr($$,"pattern",Getattr($2,"pattern"));
appendChild($$,$4);
};
@@ -1830,7 +1830,7 @@ fragment_directive: FRAGMENT LPAREN fname COMMA kwargs RPAREN HBLOCK {
$$ = new_node("fragment");
Setattr($$,k_value,Getattr($3,k_value));
Setattr($$,k_type,Getattr($3,k_type));
- Setattr($$,k_section,Getattr(p,k_name));
+ Setattr($$,"section",Getattr(p,k_name));
Setattr($$,k_kwargs,nextSibling(p));
Setattr($$,k_code,$7);
}
@@ -1841,7 +1841,7 @@ fragment_directive: FRAGMENT LPAREN fname COMMA kwargs RPAREN HBLOCK {
$$ = new_node("fragment");
Setattr($$,k_value,Getattr($3,k_value));
Setattr($$,k_type,Getattr($3,k_type));
- Setattr($$,k_section,Getattr(p,k_name));
+ Setattr($$,"section",Getattr(p,k_name));
Setattr($$,k_kwargs,nextSibling(p));
Delitem(scanner_ccode,0);
Delitem(scanner_ccode,DOH_END);
@@ -1980,7 +1980,7 @@ insert_directive : HBLOCK {
| INSERT LPAREN idstring RPAREN string {
String *code = NewStringEmpty();
$$ = new_node("insert");
- Setattr($$,k_section,$3);
+ Setattr($$,"section",$3);
Setattr($$,k_code,code);
if (Swig_insert_file($5,code) < 0) {
Swig_error(cparse_file, cparse_line, "Couldn't find '%s'.\n", $5);
@@ -1989,14 +1989,14 @@ insert_directive : HBLOCK {
}
| INSERT LPAREN idstring RPAREN HBLOCK {
$$ = new_node("insert");
- Setattr($$,k_section,$3);
+ Setattr($$,"section",$3);
Setattr($$,k_code,$5);
}
| INSERT LPAREN idstring RPAREN LBRACE {
String *code;
skip_balanced('{','}');
$$ = new_node("insert");
- Setattr($$,k_section,$3);
+ Setattr($$,"section",$3);
Delitem(scanner_ccode,0);
Delitem(scanner_ccode,DOH_END);
code = Copy(scanner_ccode);
@@ -2432,7 +2432,7 @@ typemap_directive : TYPEMAP LPAREN typemap_type RPAREN tm_list stringbrace {
if ($3.op) {
$$ = new_node("typemapcopy");
Setattr($$,"method",$3.op);
- Setattr($$,k_pattern, Getattr($7,k_pattern));
+ Setattr($$,"pattern", Getattr($7,"pattern"));
appendChild($$,$5);
}
}
@@ -2483,7 +2483,7 @@ typemap_parm : type typemap_parameter_declarator {
SwigType_push($1,$2.type);
$$ = new_node("typemapitem");
parm = NewParm($1,$2.id);
- Setattr($$,k_pattern,parm);
+ Setattr($$,"pattern",parm);
Setattr($$,k_parms, $2.parms);
Delete(parm);
/* $$ = NewParm($1,$2.id);
@@ -2491,12 +2491,12 @@ typemap_parm : type typemap_parameter_declarator {
}
| LPAREN parms RPAREN {
$$ = new_node("typemapitem");
- Setattr($$,k_pattern,$2);
+ Setattr($$,"pattern",$2);
/* Setattr($$,"multitype",$2); */
}
| LPAREN parms RPAREN LPAREN parms RPAREN {
$$ = new_node("typemapitem");
- Setattr($$,k_pattern, $2);
+ Setattr($$,"pattern", $2);
/* Setattr($$,"multitype",$2); */
Setattr($$,k_parms,$5);
}
diff --git a/Source/CParse/templ.c b/Source/CParse/templ.c
index e3de3a772..12d9afdca 100644
--- a/Source/CParse/templ.c
+++ b/Source/CParse/templ.c
@@ -57,7 +57,7 @@ static int cparse_template_expand(Node *n, String *tname, String *rname, String
if (Getattr(n, k_error))
return 0;
- if (StringEqual(nodeType, k_template)) {
+ if (Equal(nodeType, k_template)) {
/* Change the node type back to normal */
if (!expanded) {
expanded = 1;
@@ -74,7 +74,7 @@ static int cparse_template_expand(Node *n, String *tname, String *rname, String
set_nodeType(n, k_template);
return ret;
}
- } else if (StringEqual(nodeType, k_cdecl)) {
+ } else if (Equal(nodeType, k_cdecl)) {
/* A simple C declaration */
SwigType *t, *v, *d;
String *code;
@@ -99,7 +99,7 @@ static int cparse_template_expand(Node *n, String *tname, String *rname, String
add_parms(Getattr(n, k_parms), cpatchlist, typelist);
add_parms(Getattr(n, k_throws), cpatchlist, typelist);
- } else if (StringEqual(nodeType, k_class)) {
+ } else if (Equal(nodeType, k_class)) {
/* Patch base classes */
{
int b = 0;
@@ -124,7 +124,7 @@ static int cparse_template_expand(Node *n, String *tname, String *rname, String
cn = nextSibling(cn);
}
}
- } else if (StringEqual(nodeType, k_constructor)) {
+ } else if (Equal(nodeType, "constructor")) {
String *name = Getattr(n, k_name);
if (!(Getattr(n, k_templatetype))) {
String *symname;
@@ -165,7 +165,7 @@ static int cparse_template_expand(Node *n, String *tname, String *rname, String
Append(typelist, Getattr(n, k_decl));
add_parms(Getattr(n, k_parms), cpatchlist, typelist);
add_parms(Getattr(n, k_throws), cpatchlist, typelist);
- } else if (StringEqual(nodeType, k_destructor)) {
+ } else if (Equal(nodeType, "destructor")) {
String *name = Getattr(n, k_name);
if (name && strchr(Char(name), '<')) {
Append(patchlist, Getattr(n, k_name));
@@ -182,7 +182,7 @@ static int cparse_template_expand(Node *n, String *tname, String *rname, String
}
/* Setattr(n,k_symname,name); */
Append(cpatchlist, Getattr(n, k_code));
- } else if (StringEqual(nodeType, k_using)) {
+ } else if (Equal(nodeType, k_using)) {
String *uname = Getattr(n, k_uname);
if (uname && strchr(Char(uname), '<')) {
Append(patchlist, uname);
@@ -199,7 +199,7 @@ static int cparse_template_expand(Node *n, String *tname, String *rname, String
Append(typelist, Getattr(n, k_decl));
add_parms(Getattr(n, k_parms), cpatchlist, typelist);
add_parms(Getattr(n, k_kwargs), cpatchlist, typelist);
- add_parms(Getattr(n, k_pattern), cpatchlist, typelist);
+ add_parms(Getattr(n, "pattern"), cpatchlist, typelist);
add_parms(Getattr(n, k_throws), cpatchlist, typelist);
cn = firstChild(n);
while (cn) {
@@ -472,7 +472,7 @@ static Node *template_locate(String *name, Parm *tparms, Symtab *tscope) {
n = Swig_symbol_clookup_local(tname, 0);
if (!n) {
SwigType *rname = Swig_symbol_typedef_reduce(tname, tscope);
- if (!StringEqual(rname, tname)) {
+ if (!Equal(rname, tname)) {
if (template_debug) {
Printf(stdout, " searching: '%s' (exact specialization)\n", rname);
}
@@ -483,7 +483,7 @@ static Node *template_locate(String *name, Parm *tparms, Symtab *tscope) {
if (n) {
Node *tn;
String *nodeType = nodeType(n);
- if (StringEqual(nodeType, k_template))
+ if (Equal(nodeType, k_template))
goto success;
tn = Getattr(n, k_template);
if (tn) {
@@ -562,7 +562,7 @@ static Node *template_locate(String *name, Parm *tparms, Symtab *tscope) {
if (template_debug) {
Printf(stdout, " searching: '%s' (partial specialization - %s)\n", ss, pi.item);
}
- if ((StringEqual(ss, tname)) || (StringEqual(ss, rname))) {
+ if ((Equal(ss, tname)) || (Equal(ss, rname))) {
Append(mpartials, pi.item);
}
Delete(ss);
@@ -592,7 +592,7 @@ static Node *template_locate(String *name, Parm *tparms, Symtab *tscope) {
Swig_error(cparse_file, cparse_line, "Template '%s' undefined.\n", name);
} else if (n) {
String *nodeType = nodeType(n);
- if (!StringEqual(nodeType, k_template)) {
+ if (!Equal(nodeType, k_template)) {
Swig_error(cparse_file, cparse_line, "'%s' is not defined as a template. (%s)\n", name, nodeType);
n = 0;
}
@@ -625,8 +625,8 @@ Node *Swig_cparse_template_locate(String *name, Parm *tparms, Symtab *tscope) {
if (n) {
String *nodeType = nodeType(n);
int isclass = 0;
- assert(StringEqual(nodeType, k_template));
- isclass = (StringEqual(Getattr(n, k_templatetype), k_class));
+ assert(Equal(nodeType, k_template));
+ isclass = (Equal(Getattr(n, k_templatetype), k_class));
if (!isclass) {
/* If not a templated class we must have a templated function.
The template found is not necessarily the one we want when dealing with templated
diff --git a/Source/DOH/doh.h b/Source/DOH/doh.h
index a1a11e9c7..7ab244fab 100644
--- a/Source/DOH/doh.h
+++ b/Source/DOH/doh.h
@@ -73,17 +73,6 @@
#define DohGetc DOH_NAMESPACE(Getc)
#define DohPutc DOH_NAMESPACE(Putc)
#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 DohSetline DOH_NAMESPACE(Setline)
#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 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 */
extern DOH *DohGetmeta(DOH *, const DOH *);
extern int DohSetmeta(DOH *, const DOH *, const DOH *value);
@@ -397,13 +369,13 @@ extern void DohMemoryDebug(void);
#define Putc DohPutc
#define Ungetc DohUngetc
-#define StringPutc DohStringPutc
-#define StringGetc DohStringGetc
-#define StringUngetc DohStringUngetc
-#define StringAppend DohStringAppend
-#define StringLen DohStringLen
-#define StringChar DohStringChar
-#define StringEqual DohStringEqual
+/* #define StringPutc DohStringPutc */
+/* #define StringGetc DohStringGetc */
+/* #define StringUngetc DohStringUngetc */
+/* #define StringAppend Append */
+/* #define StringLen DohStringLen */
+/* #define StringChar DohStringChar */
+/* #define StringEqual DohStringEqual */
#define Close DohClose
#define vPrintf DohvPrintf
diff --git a/Source/DOH/string.c b/Source/DOH/string.c
index 82cc97b7e..1588da181 100644
--- a/Source/DOH/string.c
+++ b/Source/DOH/string.c
@@ -36,9 +36,10 @@ static void *String_data(DOH *so) {
return (void *) s->str;
}
-char *DohString_char(DOH *so) {
+/* static char *String_char(DOH *so) {
return (char *) String_data(so);
}
+*/
/* -----------------------------------------------------------------------------
* int String_dump() - Serialize a string onto out
@@ -97,7 +98,7 @@ static void DelString(DOH *so) {
* DohString_len() - Length of a string
* ----------------------------------------------------------------------------- */
-int DohString_len(DOH *so) {
+static int String_len(DOH *so) {
String *s = (String *) ObjData(so);
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 DohString_equal(DOH *so1, DOH *so2) {
+static int String_equal(DOH *so1, DOH *so2) {
String *s1 = (String *) ObjData(so1);
String *s2 = (String *) ObjData(so2);
register int len = s1->len;
@@ -509,7 +510,7 @@ static long String_tell(DOH *so) {
* int String_putc()
* ----------------------------------------------------------------------------- */
-int DohString_putc(DOH *so, int ch) {
+static int String_putc(DOH *so, int ch) {
String *s = (String *) ObjData(so);
register int len = s->len;
register int sp = s->sp;
@@ -540,7 +541,7 @@ int DohString_putc(DOH *so, int ch) {
* int String_getc()
* ----------------------------------------------------------------------------- */
-int DohString_getc(DOH *so) {
+static int String_getc(DOH *so) {
int c;
String *s = (String *) ObjData(so);
if (s->sp >= s->len)
@@ -556,7 +557,7 @@ int DohString_getc(DOH *so) {
* int String_ungetc()
* ----------------------------------------------------------------------------- */
-int DohString_ungetc(DOH *so, int ch) {
+static int String_ungetc(DOH *so, int ch) {
String *s = (String *) ObjData(so);
if (ch == EOF)
return ch;
@@ -968,9 +969,9 @@ static DohListMethods StringListMethods = {
static DohFileMethods StringFileMethods = {
String_read,
String_write,
- DohString_putc,
- DohString_getc,
- DohString_ungetc,
+ String_putc,
+ String_getc,
+ String_ungetc,
String_seek,
String_tell,
0, /* close */
@@ -989,10 +990,10 @@ DohObjInfo DohStringType = {
String_str, /* doh_str */
String_data, /* doh_data */
String_dump, /* doh_dump */
- DohString_len, /* doh_len */
+ String_len, /* doh_len */
String_hash, /* doh_hash */
String_cmp, /* doh_cmp */
- DohString_equal, /* doh_equal */
+ String_equal, /* doh_equal */
0, /* doh_first */
0, /* doh_next */
String_setfile, /* doh_setfile */
diff --git a/Source/Makefile.am b/Source/Makefile.am
index 010d4ef53..4a9583624 100644
--- a/Source/Makefile.am
+++ b/Source/Makefile.am
@@ -71,6 +71,7 @@ eswig_SOURCES = CParse/cscanner.c \
Preprocessor/cpp.c \
Preprocessor/expr.c \
Swig/cwrap.c \
+ Swig/deprecate.c \
Swig/error.c \
Swig/fragment.c \
Swig/getopt.c \
diff --git a/Source/Modules/cffi.cxx b/Source/Modules/cffi.cxx
index 06cee7a8b..d8dcc330b 100644
--- a/Source/Modules/cffi.cxx
+++ b/Source/Modules/cffi.cxx
@@ -333,7 +333,7 @@ int CFFI::functionWrapper(Node *n) {
String *wname = Swig_name_wrapper(iname);
if (overname) {
- StringAppend(wname, overname);
+ Append(wname, overname);
}
// Emit all of the local variables for holding arguments.
emit_args(Getattr(n, "type"), parms, wrap);
diff --git a/Source/Modules/csharp.cxx b/Source/Modules/csharp.cxx
index 293e097e5..26318c5d5 100644
--- a/Source/Modules/csharp.cxx
+++ b/Source/Modules/csharp.cxx
@@ -85,6 +85,13 @@ class CSHARP:public Language {
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:
/* -----------------------------------------------------------------------------
diff --git a/Source/Modules/java.cxx b/Source/Modules/java.cxx
index 356750eb0..f175b3daf 100644
--- a/Source/Modules/java.cxx
+++ b/Source/Modules/java.cxx
@@ -81,6 +81,13 @@ class JAVA:public Language {
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:
/* -----------------------------------------------------------------------------
diff --git a/Source/Modules/php4.cxx b/Source/Modules/php4.cxx
index dda2eaf1b..73fdb9eb3 100644
--- a/Source/Modules/php4.cxx
+++ b/Source/Modules/php4.cxx
@@ -1142,7 +1142,7 @@ public:
Replaceall(tm, "$input", source);
Setattr(p, "emit:input", source);
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");
}
p = Getattr(p, "tmap:in:next");
diff --git a/Source/Modules/typepass.cxx b/Source/Modules/typepass.cxx
index 7df7c4862..abcb0492c 100644
--- a/Source/Modules/typepass.cxx
+++ b/Source/Modules/typepass.cxx
@@ -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"));
for (ParmList *p = parms; p;) {
- StringAppend(ucode, Getattr(p, k_name));
+ Append(ucode, Getattr(p, k_name));
p = nextSibling(p);
if (p)
- StringAppend(ucode, ",");
+ Append(ucode, ",");
}
- StringAppend(ucode, "); }");
+ Append(ucode, "); }");
Setattr(nn, "code", ucode);
Delete(ucode);
}
diff --git a/Source/Preprocessor/cpp.c b/Source/Preprocessor/cpp.c
index 54eaf9ed5..255b5fb8e 100644
--- a/Source/Preprocessor/cpp.c
+++ b/Source/Preprocessor/cpp.c
@@ -40,27 +40,27 @@ static int error_as_warning = 0; /* Understand the cpp #error directive as a spe
/* Skip whitespace */
static void skip_whitespace(String *s, String *out) {
int c;
- while ((c = StringGetc(s)) != EOF) {
+ while ((c = Getc(s)) != EOF) {
if (!isspace(c)) {
- StringUngetc(c, s);
+ Ungetc(c, s);
break;
} else if (out)
- StringPutc(c, out);
+ Putc(c, out);
}
}
/* Skip to a specified character taking line breaks into account */
static int skip_tochar(String *s, int ch, String *out) {
int c;
- while ((c = StringGetc(s)) != EOF) {
+ while ((c = Getc(s)) != EOF) {
if (out)
- StringPutc(c, out);
+ Putc(c, out);
if (c == ch)
break;
if (c == '\\') {
- c = StringGetc(s);
+ c = Getc(s);
if ((c != EOF) && (out))
- StringPutc(c, out);
+ Putc(c, out);
}
}
if (c == EOF)
@@ -315,16 +315,16 @@ Hash *Preprocessor_define(const String_or_char *_str, int swigmacro) {
/* Now look for a macro name */
macroname = NewStringEmpty();
- while ((c = StringGetc(str)) != EOF) {
+ while ((c = Getc(str)) != EOF) {
if (c == '(') {
argstr = NewStringEmpty();
copy_location(str, argstr);
/* It is a macro. Go extract its argument string */
- while ((c = StringGetc(str)) != EOF) {
+ while ((c = Getc(str)) != EOF) {
if (c == ')')
break;
else
- StringPutc(c, argstr);
+ Putc(c, argstr);
}
if (c != ')') {
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;
} else if (isidchar(c) || (c == '%')) {
- StringPutc(c, macroname);
+ Putc(c, macroname);
} else if (isspace(c)) {
break;
} else if (c == '\\') {
- c = StringGetc(str);
+ c = Getc(str);
if (c != '\n') {
- StringUngetc(c, str);
- StringUngetc('\\', str);
+ Ungetc(c, str);
+ Ungetc('\\', str);
break;
}
} else {
/*Swig_error(Getfile(str),Getline(str),"Illegal character in macro name\n");
goto macro_error; */
- StringUngetc(c, str);
+ Ungetc(c, str);
break;
}
}
if (!swigmacro)
skip_whitespace(str, 0);
macrovalue = NewStringEmpty();
- while ((c = StringGetc(str)) != EOF) {
- StringPutc(c, macrovalue);
+ while ((c = Getc(str)) != EOF) {
+ Putc(c, macrovalue);
}
/* 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();
Seek(argstr, 0, SEEK_SET);
argname = NewStringEmpty();
- while ((c = StringGetc(argstr)) != EOF) {
+ while ((c = Getc(argstr)) != EOF) {
if (c == ',') {
varargname = Macro_vararg_name(argname, str);
if (varargname) {
@@ -374,7 +374,7 @@ Hash *Preprocessor_define(const String_or_char *_str, int swigmacro) {
Delete(argname);
argname = NewStringEmpty();
} else if (isidchar(c) || (c == '.')) {
- StringPutc(c, argname);
+ Putc(c, argname);
} else if (!(isspace(c) || (c == '\\'))) {
Delete(argname);
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);
/* Now see if the next character is a '(' */
- c = StringGetc(s);
+ c = Getc(s);
if (c != '(') {
/* Not a macro, bail out now! */
Seek(s, pos, SEEK_SET);
Delete(args);
return 0;
}
- c = StringGetc(s);
+ c = Getc(s);
/* Okay. This appears to be a macro so we will start isolating arguments */
while (c != EOF) {
if (isspace(c)) {
skip_whitespace(s, 0); /* Skip leading whitespace */
- c = StringGetc(s);
+ c = Getc(s);
}
str = NewStringEmpty();
copy_location(s, str);
level = 0;
while (c != EOF) {
if (c == '\"') {
- StringPutc(c, str);
+ Putc(c, str);
skip_tochar(s, '\"', str);
- c = StringGetc(s);
+ c = Getc(s);
continue;
} else if (c == '\'') {
- StringPutc(c, str);
+ Putc(c, str);
skip_tochar(s, '\'', str);
- c = StringGetc(s);
+ c = Getc(s);
continue;
}
if ((c == ',') && (level == 0))
break;
if ((c == ')') && (level == 0))
break;
- StringPutc(c, str);
+ Putc(c, str);
if (c == '(')
level++;
if (c == ')')
level--;
- c = StringGetc(s);
+ c = Getc(s);
}
if (level > 0) {
goto unterm;
@@ -612,7 +612,7 @@ static List *find_args(String *s) {
if (c == ')')
return args;
- c = StringGetc(s);
+ c = Getc(s);
}
unterm:
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);
fn = NewStringEmpty();
copy_location(str, fn);
- c = StringGetc(str);
+ c = Getc(str);
*sysfile = 0;
if (c == '\"') {
- while (((c = StringGetc(str)) != EOF) && (c != '\"'))
- StringPutc(c, fn);
+ while (((c = Getc(str)) != EOF) && (c != '\"'))
+ Putc(c, fn);
} else if (c == '<') {
*sysfile = 1;
- while (((c = StringGetc(str)) != EOF) && (c != '>'))
- StringPutc(c, fn);
+ while (((c = Getc(str)) != EOF) && (c != '>'))
+ Putc(c, fn);
} else {
- StringPutc(c, fn);
- while (((c = StringGetc(str)) != EOF) && (!isspace(c)))
- StringPutc(c, fn);
+ Putc(c, fn);
+ while (((c = Getc(str)) != EOF) && (!isspace(c)))
+ Putc(c, fn);
if (isspace(c))
- StringUngetc(c, str);
+ Ungetc(c, str);
}
#if defined(_WIN32) || defined(MACSWIG)
/* accept Unix path separator on non-Unix systems */
@@ -665,13 +665,13 @@ static String *get_options(String *str) {
int c;
skip_whitespace(str, 0);
- c = StringGetc(str);
+ c = Getc(str);
if (c == '(') {
String *opt;
int level = 1;
opt = NewString("(");
- while (((c = StringGetc(str)) != EOF)) {
- StringPutc(c, opt);
+ while (((c = Getc(str)) != EOF)) {
+ Putc(c, opt);
if (c == ')') {
level--;
if (!level)
@@ -683,7 +683,7 @@ static String *get_options(String *str) {
Delete(opt);
return 0;
} else {
- StringUngetc(c, str);
+ Ungetc(c, str);
return 0;
}
}
@@ -712,18 +712,18 @@ static String *expand_macro(String *name, List *args) {
return 0;
if (Getattr(macro, kpp_expanded)) {
ns = NewStringEmpty();
- StringAppend(ns, name);
+ Append(ns, name);
if (args) {
int lenargs = Len(args);
if (lenargs)
- StringPutc('(', ns);
+ Putc('(', ns);
for (i = 0; i < lenargs; i++) {
- StringAppend(ns, Getitem(args, i));
+ Append(ns, Getitem(args, i));
if (i < (lenargs - 1))
- StringPutc(',', ns);
+ Putc(',', ns);
}
if (i)
- StringPutc(')', ns);
+ Putc(')', ns);
}
return ns;
}
@@ -743,9 +743,9 @@ static String *expand_macro(String *name, List *args) {
vi = Len(margs) - 1;
na = Len(args);
for (i = vi; i < na; i++) {
- StringAppend(vararg, Getitem(args, i));
+ Append(vararg, Getitem(args, i));
if ((i + 1) < na) {
- StringAppend(vararg, ",");
+ Append(vararg, ",");
}
}
/* Remove arguments */
@@ -789,7 +789,7 @@ static String *expand_macro(String *name, List *args) {
arg = Getitem(args, i); /* Get an argument value */
reparg = Preprocessor_replace(arg);
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 */
Clear(temp);
Clear(tempa);
@@ -797,17 +797,17 @@ static String *expand_macro(String *name, List *args) {
Printf(tempa, "\"%s\"", arg);
Replace(ns, temp, tempa, DOH_REPLACE_ID_END);
}
- if (strstr(StringChar(ns), "\002")) {
+ if (strstr(Char(ns), "\002")) {
/* Look for concatenation tokens */
Clear(temp);
Clear(tempa);
Printf(temp, "\002%s", aname);
- StringAppend(tempa, "\002\003");
+ Append(tempa, "\002\003");
Replace(ns, temp, tempa, DOH_REPLACE_ID_END);
Clear(temp);
Clear(tempa);
Printf(temp, "%s\002", aname);
- StringAppend(tempa, "\003\002");
+ Append(tempa, "\003\002");
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
nothing happens */
- if (strchr(StringChar(ns), '`')) {
+ if (strchr(Char(ns), '`')) {
String *rep;
char *c;
Clear(temp);
@@ -833,14 +833,14 @@ static String *expand_macro(String *name, List *args) {
/* Non-standard mangle expansions.
The #@Name is replaced by mangle_arg(Name). */
- if (strstr(StringChar(ns), "\004")) {
+ if (strstr(Char(ns), "\004")) {
String *marg = Swig_string_mangle(arg);
Clear(temp);
Printf(temp, "\004%s", aname);
Replace(ns, temp, marg, DOH_REPLACE_ID_END);
Delete(marg);
}
- if (strstr(StringChar(ns), "\005")) {
+ if (strstr(Char(ns), "\005")) {
String *marg = Swig_string_mangle(arg);
Clear(temp);
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 */
char *a, *s, *t, *name;
int namelen;
- s = StringChar(ns);
+ s = Char(ns);
name = Char(aname);
namelen = Len(aname);
a = strstr(s, name);
@@ -911,7 +911,7 @@ static String *expand_macro(String *name, List *args) {
if (strchr(Char(g), '\n')) {
Printf(f, "/*@SWIG:%s@*/%s/*@SWIG@*/", name, g);
} else {
- StringAppend(f, g);
+ Append(f, g);
}
#endif
@@ -966,53 +966,53 @@ DOH *Preprocessor_replace(DOH *s) {
Seek(s, 0, SEEK_SET);
/* Try to locate identifiers in s and replace them with macro replacements */
- while ((c = StringGetc(s)) != EOF) {
+ while ((c = Getc(s)) != EOF) {
switch (state) {
case 0:
if (isidentifier(c) || (c == '%')) {
Clear(id);
- StringPutc(c, id);
+ Putc(c, id);
state = 1;
} else if (c == '\"') {
- StringPutc(c, ns);
+ Putc(c, ns);
skip_tochar(s, '\"', ns);
} else if (c == '\'') {
- StringPutc(c, ns);
+ Putc(c, ns);
skip_tochar(s, '\'', ns);
} else if (c == '/') {
- StringPutc(c, ns);
+ Putc(c, ns);
state = 10;
} else {
- StringPutc(c, ns);
+ Putc(c, ns);
}
break;
case 1: /* An identifier */
if (isidchar(c)) {
- StringPutc(c, id);
+ Putc(c, id);
state = 1;
} else {
/* We found the end of a valid identifier */
- StringUngetc(c, s);
+ Ungetc(c, s);
/* See if this is the special "defined" macro */
- if (StringEqual(kpp_defined, id)) {
+ if (Equal(kpp_defined, id)) {
int lenargs = 0;
DOH *args = 0;
/* See whether or not a paranthesis has been used */
skip_whitespace(s, 0);
- c = StringGetc(s);
+ c = Getc(s);
if (c == '(') {
- StringUngetc(c, s);
+ Ungetc(c, s);
args = find_args(s);
} else if (isidchar(c)) {
DOH *arg = NewStringEmpty();
args = NewList();
- StringPutc(c, arg);
- while (((c = StringGetc(s)) != EOF)) {
+ Putc(c, arg);
+ while (((c = Getc(s)) != EOF)) {
if (!isidchar(c)) {
- StringUngetc(c, s);
+ Ungetc(c, s);
break;
}
- StringPutc(c, arg);
+ Putc(c, arg);
}
if (Len(arg))
Append(args, arg);
@@ -1023,7 +1023,7 @@ DOH *Preprocessor_replace(DOH *s) {
lenargs = Len(args);
if ((!args) || (!lenargs)) {
/* This is not a defined() macro. */
- StringAppend(ns, id);
+ Append(ns, id);
state = 0;
break;
}
@@ -1034,19 +1034,19 @@ DOH *Preprocessor_replace(DOH *s) {
}
}
if (i < lenargs)
- StringPutc('0', ns);
+ Putc('0', ns);
else
- StringPutc('1', ns);
+ Putc('1', ns);
Delete(args);
state = 0;
break;
}
- if (StringEqual(kpp_LINE, id)) {
+ if (Equal(kpp_LINE, id)) {
Printf(ns, "%d", Getline(s));
state = 0;
break;
}
- if (StringEqual(kpp_FILE, id)) {
+ if (Equal(kpp_FILE, id)) {
String *fn = Copy(Getfile(s));
Replaceall(fn, "\\", "\\\\");
Printf(ns, "\"%s\"", fn);
@@ -1071,12 +1071,12 @@ DOH *Preprocessor_replace(DOH *s) {
}
e = expand_macro(id, args);
if (e) {
- StringAppend(ns, e);
+ Append(ns, e);
}
Delete(e);
Delete(args);
} else {
- StringAppend(ns, id);
+ Append(ns, id);
}
state = 0;
}
@@ -1087,24 +1087,24 @@ DOH *Preprocessor_replace(DOH *s) {
else if (c == '*')
state = 12;
else {
- StringUngetc(c, s);
+ Ungetc(c, s);
state = 0;
break;
}
- StringPutc(c, ns);
+ Putc(c, ns);
break;
case 11:
- StringPutc(c, ns);
+ Putc(c, ns);
if (c == '\n')
state = 0;
break;
case 12:
- StringPutc(c, ns);
+ Putc(c, ns);
if (c == '*')
state = 13;
break;
case 13:
- StringPutc(c, ns);
+ Putc(c, ns);
if (c == '/')
state = 0;
else if (c != '*')
@@ -1119,7 +1119,7 @@ DOH *Preprocessor_replace(DOH *s) {
/* Identifier at the end */
if (state == 1) {
/* 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");
} else if ((m = Getattr(symbols, id))) {
DOH *e;
@@ -1129,10 +1129,10 @@ DOH *Preprocessor_replace(DOH *s) {
Swig_error(Getfile(id),Getline(id),"Macro arguments expected.\n");
} */
e = expand_macro(id, 0);
- StringAppend(ns, e);
+ Append(ns, e);
Delete(e);
} else {
- StringAppend(ns, id);
+ Append(ns, id);
}
}
Delete(id);
@@ -1171,12 +1171,12 @@ static int checkpp_id(DOH *s) {
/* addline(). Utility function for adding lines to a chunk */
static void addline(DOH *s1, DOH *s2, int allow) {
if (allow) {
- StringAppend(s1, s2);
+ Append(s1, s2);
} else {
char *c = Char(s2);
while (*c) {
if (*c == '\n')
- StringPutc('\n', s1);
+ Putc('\n', s1);
c++;
}
}
@@ -1257,7 +1257,7 @@ String *Preprocessor_parse(String *s) {
symbols = Getattr(cpp, kpp_symbols);
state = 0;
- while ((c = StringGetc(s)) != EOF) {
+ while ((c = Getc(s)) != EOF) {
switch (state) {
case 0: /* Initial state - in first column */
/* Look for C preprocessor directives. Otherwise, go directly to state 1 */
@@ -1267,11 +1267,11 @@ String *Preprocessor_parse(String *s) {
cpp_lines = 1;
state = 40;
} else if (isspace(c)) {
- StringPutc(c, chunk);
+ Putc(c, chunk);
skip_whitespace(s, chunk);
} else {
state = 1;
- StringUngetc(c, s);
+ Ungetc(c, s);
}
break;
case 1: /* Non-preprocessor directive */
@@ -1280,7 +1280,7 @@ String *Preprocessor_parse(String *s) {
state = 100;
break;
}
- StringPutc(c, chunk);
+ Putc(c, chunk);
if (c == '\n')
state = 0;
else if (c == '\"') {
@@ -1299,7 +1299,7 @@ String *Preprocessor_parse(String *s) {
case 30: /* Possibly a comment string of some sort */
start_line = Getline(s);
- StringPutc(c, chunk);
+ Putc(c, chunk);
if (c == '/')
state = 31;
else if (c == '*')
@@ -1308,17 +1308,17 @@ String *Preprocessor_parse(String *s) {
state = 1;
break;
case 31:
- StringPutc(c, chunk);
+ Putc(c, chunk);
if (c == '\n')
state = 0;
break;
case 32:
- StringPutc(c, chunk);
+ Putc(c, chunk);
if (c == '*')
state = 33;
break;
case 33:
- StringPutc(c, chunk);
+ Putc(c, chunk);
if (c == '/')
state = 1;
else if (c != '*')
@@ -1327,13 +1327,13 @@ String *Preprocessor_parse(String *s) {
case 40: /* Start of a C preprocessor directive */
if (c == '\n') {
- StringPutc('\n', chunk);
+ Putc('\n', chunk);
state = 0;
} else if (isspace(c)) {
state = 40;
} else {
/* Got the start of a preprocessor directive */
- StringUngetc(c, s);
+ Ungetc(c, s);
Clear(id);
copy_location(s, id);
state = 41;
@@ -1345,25 +1345,25 @@ String *Preprocessor_parse(String *s) {
Clear(value);
Clear(comment);
if (c == '\n') {
- StringUngetc(c, s);
+ Ungetc(c, s);
state = 50;
} else {
state = 42;
if (!isspace(c)) {
- StringUngetc(c, s);
+ Ungetc(c, s);
}
}
copy_location(s, value);
break;
}
- StringPutc(c, id);
+ Putc(c, id);
break;
case 42: /* Strip any leading space before preprocessor value */
if (isspace(c)) {
if (c == '\n') {
- StringUngetc(c, s);
+ Ungetc(c, s);
state = 50;
}
break;
@@ -1374,18 +1374,18 @@ String *Preprocessor_parse(String *s) {
case 43:
/* Get preprocessor value */
if (c == '\n') {
- StringUngetc(c, s);
+ Ungetc(c, s);
state = 50;
} else if (c == '/') {
state = 45;
} else if (c == '\"') {
- StringPutc(c, value);
+ Putc(c, value);
skip_tochar(s, '\"', value);
} else if (c == '\'') {
- StringPutc(c, value);
+ Putc(c, value);
skip_tochar(s, '\'', value);
} else {
- StringPutc(c, value);
+ Putc(c, value);
if (c == '\\')
state = 44;
}
@@ -1393,10 +1393,10 @@ String *Preprocessor_parse(String *s) {
case 44:
if (c == '\n') {
- StringPutc(c, value);
+ Putc(c, value);
cpp_lines++;
} else {
- StringUngetc(c, s);
+ Ungetc(c, s);
}
state = 43;
break;
@@ -1410,45 +1410,45 @@ String *Preprocessor_parse(String *s) {
else if (c == '*')
state = 47;
else if (c == '\n') {
- StringPutc('/', value);
- StringUngetc(c, s);
+ Putc('/', value);
+ Ungetc(c, s);
cpp_lines++;
state = 50;
} else {
- StringPutc('/', value);
- StringPutc(c, value);
+ Putc('/', value);
+ Putc(c, value);
state = 43;
}
break;
case 46:
if (c == '\n') {
- StringUngetc(c, s);
+ Ungetc(c, s);
cpp_lines++;
state = 50;
} else
- StringPutc(c, comment);
+ Putc(c, comment);
break;
case 47:
if (c == '*')
state = 48;
else
- StringPutc(c, comment);
+ Putc(c, comment);
break;
case 48:
if (c == '/')
state = 43;
else if (c == '*')
- StringPutc(c, comment);
+ Putc(c, comment);
else {
- StringPutc('*', comment);
- StringPutc(c, comment);
+ Putc('*', comment);
+ Putc(c, comment);
state = 47;
}
break;
case 50:
/* Check for various preprocessor directives */
Chop(value);
- if (StringEqual(id, kpp_define)) {
+ if (Equal(id, kpp_define)) {
if (allow) {
DOH *m, *v, *v1;
Seek(value, 0, SEEK_SET);
@@ -1472,10 +1472,10 @@ String *Preprocessor_parse(String *s) {
Delete(v);
}
}
- } else if (StringEqual(id, kpp_undef)) {
+ } else if (Equal(id, kpp_undef)) {
if (allow)
Preprocessor_undef(value);
- } else if (StringEqual(id, kpp_ifdef)) {
+ } else if (Equal(id, kpp_ifdef)) {
cond_lines[level] = Getline(id);
level++;
if (allow) {
@@ -1485,7 +1485,7 @@ String *Preprocessor_parse(String *s) {
allow = 0;
mask = 1;
}
- } else if (StringEqual(id, kpp_ifndef)) {
+ } else if (Equal(id, kpp_ifndef)) {
cond_lines[level] = Getline(id);
level++;
if (allow) {
@@ -1495,7 +1495,7 @@ String *Preprocessor_parse(String *s) {
allow = 0;
mask = 1;
}
- } else if (StringEqual(id, kpp_else)) {
+ } else if (Equal(id, kpp_else)) {
if (level <= 0) {
Swig_error(Getfile(s), Getline(id), "Misplaced #else.\n");
} else {
@@ -1507,7 +1507,7 @@ String *Preprocessor_parse(String *s) {
allow = 1 * mask;
}
}
- } else if (StringEqual(id, kpp_endif)) {
+ } else if (Equal(id, kpp_endif)) {
level--;
if (level < 0) {
Swig_error(Getfile(id), Getline(id), "Extraneous #endif.\n");
@@ -1518,7 +1518,7 @@ String *Preprocessor_parse(String *s) {
start_level--;
}
}
- } else if (StringEqual(id, kpp_if)) {
+ } else if (Equal(id, kpp_if)) {
cond_lines[level] = Getline(id);
level++;
if (allow) {
@@ -1541,7 +1541,7 @@ String *Preprocessor_parse(String *s) {
}
mask = 1;
}
- } else if (StringEqual(id, kpp_elif)) {
+ } else if (Equal(id, kpp_elif)) {
if (level == 0) {
Swig_error(Getfile(s), Getline(id), "Misplaced #elif.\n");
} else {
@@ -1569,11 +1569,11 @@ String *Preprocessor_parse(String *s) {
}
}
}
- } else if (StringEqual(id, kpp_warning)) {
+ } else if (Equal(id, kpp_warning)) {
if (allow) {
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 (error_as_warning) {
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);
}
}
- } else if (StringEqual(id, kpp_line)) {
- } else if (StringEqual(id, kpp_include)) {
+ } else if (Equal(id, kpp_line)) {
+ } else if (Equal(id, kpp_include)) {
if (((include_all) || (import_all)) && (allow)) {
String *s1, *s2, *fn;
char *dirname;
@@ -1612,7 +1612,7 @@ String *Preprocessor_parse(String *s) {
}
s2 = Preprocessor_parse(s1);
addline(ns, s2, allow);
- StringAppend(ns, "\n]");
+ Append(ns, "\n]");
if (dirname) {
Swig_pop_directory();
}
@@ -1624,7 +1624,7 @@ String *Preprocessor_parse(String *s) {
Delete(s1);
Delete(fn);
}
- } else if (StringEqual(id, kpp_pragma)) {
+ } else if (Equal(id, kpp_pragma)) {
if (Strncmp(value, "SWIG ", 5) == 0) {
char *c = Char(value) + 5;
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);
}
for (i = 0; i < cpp_lines; i++)
- StringPutc('\n', ns);
+ Putc('\n', ns);
state = 0;
break;
@@ -1656,35 +1656,35 @@ String *Preprocessor_parse(String *s) {
start_line = Getline(s);
add_chunk(ns, chunk, allow);
copy_location(s, chunk);
- StringPutc('%', chunk);
- StringPutc(c, chunk);
+ Putc('%', chunk);
+ Putc(c, chunk);
state = 105;
}
/* %#cpp - an embedded C preprocessor directive (we strip off the %) */
else if (c == '#') {
add_chunk(ns, chunk, allow);
- StringPutc(c, chunk);
+ Putc(c, chunk);
state = 107;
} else if (isidentifier(c)) {
Clear(decl);
- StringPutc('%', decl);
- StringPutc(c, decl);
+ Putc('%', decl);
+ Putc(c, decl);
state = 110;
} else {
- StringPutc('%', chunk);
- StringPutc(c, chunk);
+ Putc('%', chunk);
+ Putc(c, chunk);
state = 1;
}
break;
case 105:
- StringPutc(c, chunk);
+ Putc(c, chunk);
if (c == '%')
state = 106;
break;
case 106:
- StringPutc(c, chunk);
+ Putc(c, chunk);
if (c == '}') {
state = 1;
addline(ns, chunk, allow);
@@ -1696,7 +1696,7 @@ String *Preprocessor_parse(String *s) {
break;
case 107:
- StringPutc(c, chunk);
+ Putc(c, chunk);
if (c == '\n') {
addline(ns, chunk, allow);
Clear(chunk);
@@ -1707,24 +1707,24 @@ String *Preprocessor_parse(String *s) {
break;
case 108:
- StringPutc(c, chunk);
+ Putc(c, chunk);
state = 107;
break;
case 110:
if (!isidchar(c)) {
- StringUngetc(c, s);
+ Ungetc(c, s);
/* 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 */
if (allow) {
DOH *s1, *s2, *fn, *opt;
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");
Clear(decl);
- StringAppend(decl, "%%import");
+ Append(decl, "%%import");
}
opt = get_options(s);
fn = get_filename(s, &sysfile);
@@ -1734,7 +1734,7 @@ String *Preprocessor_parse(String *s) {
add_chunk(ns, chunk, allow);
copy_location(s, chunk);
Printf(ns, "%sfile%s \"%s\" [\n", decl, opt, Swig_last_file());
- if (StringEqual(decl, kpp_dimport)) {
+ if (Equal(decl, kpp_dimport)) {
push_imported();
}
dirname = Swig_file_dirname(Swig_last_file());
@@ -1748,21 +1748,21 @@ String *Preprocessor_parse(String *s) {
if (dirname) {
Swig_pop_directory();
}
- if (StringEqual(decl, kpp_dimport)) {
+ if (Equal(decl, kpp_dimport)) {
pop_imported();
}
addline(ns, s2, allow);
- StringAppend(ns, "\n]");
+ Append(ns, "\n]");
Delete(s2);
Delete(s1);
}
Delete(fn);
}
state = 1;
- } else if (StringEqual(decl, kpp_dline)) {
+ } else if (Equal(decl, kpp_dline)) {
/* Got a line directive */
state = 1;
- } else if (StringEqual(decl, kpp_ddefine)) {
+ } else if (Equal(decl, kpp_ddefine)) {
/* Got a define directive */
dlevel++;
add_chunk(ns, chunk, allow);
@@ -1771,31 +1771,31 @@ String *Preprocessor_parse(String *s) {
copy_location(s, value);
state = 150;
} else {
- StringAppend(chunk, decl);
+ Append(chunk, decl);
state = 1;
}
} else {
- StringPutc(c, decl);
+ Putc(c, decl);
}
break;
/* Searching for the end of a %define statement */
case 150:
- StringPutc(c, value);
+ Putc(c, value);
if (c == '%') {
const char *ed = "enddef";
const char *df = "define";
char statement[7];
int i = 0;
for (i = 0; i < 6;) {
- c = StringGetc(s);
- StringPutc(c, value);
+ c = Getc(s);
+ Putc(c, value);
statement[i++] = c;
if (strncmp(statement, ed, i) && strncmp(statement, df, i))
break;
}
- c = StringGetc(s);
- StringUngetc(c, s);
+ c = Getc(s);
+ Ungetc(c, s);
if ((i == 6) && (isspace(c))) {
if (strncmp(statement, df, i) == 0) {
++dlevel;
@@ -1811,7 +1811,7 @@ String *Preprocessor_parse(String *s) {
Seek(value, 0, SEEK_SET);
Preprocessor_define(value, 1);
}
- /* StringPutc('\n',ns); */
+ /* Putc('\n',ns); */
addline(ns, value, 0);
state = 0;
}
diff --git a/Source/Swig/cwrap.c b/Source/Swig/cwrap.c
index e64d6fddf..5890029f3 100644
--- a/Source/Swig/cwrap.c
+++ b/Source/Swig/cwrap.c
@@ -510,7 +510,7 @@ String *Swig_cppconstructor_base_call(String_or_char *name, ParmList *parms, int
String *pname = 0;
if (comma)
Append(func, ",");
- if (!Getattr(p, k_argbyname)) {
+ if (!Getattr(p, "arg:byname")) {
pname = Swig_cparm_name(p, i);
i++;
} else {
@@ -806,8 +806,8 @@ int Swig_MethodToFunction(Node *n, String *classname, int flags, SwigType *direc
SwigType_push(type, qualifier);
}
SwigType_add_pointer(type);
- p = NewParm(type, k_self);
- Setattr(p, k_self, "1");
+ p = NewParm(type, "self");
+ Setattr(p, "self", "1");
Setattr(p, k_hidden, "1");
/*
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 */
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) {
int i = 0;
@@ -984,7 +984,7 @@ Node *Swig_methodclass(Node *n) {
int Swig_directorclass(Node *n) {
Node *classNode = Swig_methodclass(n);
assert(classNode != 0);
- return (Getattr(classNode, k_vtable) != 0);
+ return (Getattr(classNode, "vtable") != 0);
}
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 */
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);
@@ -1158,8 +1158,8 @@ int Swig_DestructorToFunction(Node *n, String *classname, int cplus, int flags)
type = NewString(classname);
SwigType_add_pointer(type);
- p = NewParm(type, k_self);
- Setattr(p, k_self, "1");
+ p = NewParm(type, "self");
+ Setattr(p, "self", "1");
Setattr(p, k_hidden, "1");
Setattr(p, k_wrapdisown, "1");
Delete(type);
@@ -1173,7 +1173,7 @@ int Swig_DestructorToFunction(Node *n, String *classname, int cplus, int flags)
mangled = Swig_name_mangle(membername);
code = Getattr(n, k_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);
cres = NewStringf("%s;\n", call);
@@ -1238,8 +1238,8 @@ int Swig_MembersetToFunction(Node *n, String *classname, int flags) {
t = NewString(classname);
SwigType_add_pointer(t);
- parms = NewParm(t, k_self);
- Setattr(parms, k_self, "1");
+ parms = NewParm(t, "self");
+ Setattr(parms, "self", "1");
Setattr(parms, k_hidden, "1");
Delete(t);
@@ -1260,7 +1260,7 @@ int Swig_MembersetToFunction(Node *n, String *classname, int flags) {
String *code = Getattr(n, k_code);
if (code) {
/* 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);
cres = NewStringf("%s;\n", call);
@@ -1324,8 +1324,8 @@ int Swig_MembergetToFunction(Node *n, String *classname, int flags) {
t = NewString(classname);
SwigType_add_pointer(t);
- parms = NewParm(t, k_self);
- Setattr(parms, k_self, "1");
+ parms = NewParm(t, "self");
+ Setattr(parms, "self", "1");
Setattr(parms, k_hidden, "1");
Delete(t);
@@ -1337,7 +1337,7 @@ int Swig_MembergetToFunction(Node *n, String *classname, int flags) {
String *code = Getattr(n, k_code);
if (code) {
/* 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);
cres = Swig_cresult(ty, k_result, call);
diff --git a/Source/Swig/deprecate.c b/Source/Swig/deprecate.c
new file mode 100644
index 000000000..269cf9eee
--- /dev/null
+++ b/Source/Swig/deprecate.c
@@ -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;
+}
diff --git a/Source/Swig/fragment.c b/Source/Swig/fragment.c
index c96009fd3..26ec3476f 100644
--- a/Source/Swig/fragment.c
+++ b/Source/Swig/fragment.c
@@ -31,7 +31,7 @@ static int debug = 0;
* ----------------------------------------------------------------------------- */
void Swig_fragment_register(Node *fragment) {
- if (Getattr(fragment, k_emitonly)) {
+ if (Getattr(fragment, "emitonly")) {
Swig_fragment_emit(fragment);
return;
} else {
@@ -50,10 +50,10 @@ void Swig_fragment_register(Node *fragment) {
fragments = NewHash();
}
if (!Getattr(fragments, name)) {
- String *section = Copy(Getattr(fragment, k_section));
+ String *section = Copy(Getattr(fragment, "section"));
String *ccode = Copy(Getattr(fragment, k_code));
Hash *kwargs = Getattr(fragment, k_kwargs);
- Setmeta(ccode, k_section, section);
+ Setmeta(ccode, "section", section);
if (kwargs) {
Setmeta(ccode, k_kwargs, kwargs);
}
@@ -121,13 +121,13 @@ void Swig_fragment_emit(Node *n) {
if (debug)
Printf(stdout, "looking subfragment %s\n", name);
if (code && (Strcmp(code, k_ignore) != 0)) {
- String *section = Getmeta(code, k_section);
+ String *section = Getmeta(code, "section");
Hash *nn = Getmeta(code, k_kwargs);
if (!looking_fragments)
looking_fragments = NewHash();
Setattr(looking_fragments, name, "1");
while (nn) {
- if (Equal(Getattr(nn, k_name), k_fragment)) {
+ if (Equal(Getattr(nn, k_name), "fragment")) {
if (debug)
Printf(stdout, "emitting fragment %s %s\n", nn, type);
Setfile(nn, Getfile(n));
diff --git a/Source/Swig/include.c b/Source/Swig/include.c
index 9d522ab8b..c3403da96 100644
--- a/Source/Swig/include.c
+++ b/Source/Swig/include.c
@@ -122,7 +122,7 @@ static List *Swig_search_path_any(int syspath) {
ilen = Len(pdirectories);
for (i = 0; i < ilen; i++) {
filename = NewString(Getitem(pdirectories,i));
- StringAppend(filename,SWIG_FILE_DELIMETER);
+ Append(filename,SWIG_FILE_DELIMETER);
Append(slist,filename);
Delete(filename);
}
@@ -131,7 +131,7 @@ static List *Swig_search_path_any(int syspath) {
ilen = Len(directories);
for (i = 0; i < ilen; i++) {
filename = NewString(Getitem(directories,i));
- StringAppend(filename,SWIG_FILE_DELIMETER);
+ Append(filename,SWIG_FILE_DELIMETER);
if (syspath) {
/* If doing a system include, put the system directories first */
Insert(slist,i,filename);
@@ -214,13 +214,13 @@ String *Swig_read_file(FILE *f) {
assert(str);
while (fgets(buffer, 4095, f)) {
- StringAppend(str, buffer);
+ Append(str, buffer);
}
- len = StringLen(str);
+ len = Len(str);
if (len) {
char *cstr = Char(str);
if (cstr[len - 1] != '\n') {
- StringAppend(str, "\n");
+ Append(str, "\n");
}
}
return str;
diff --git a/Source/Swig/misc.c b/Source/Swig/misc.c
index a26fa4c6f..ae73fdf0a 100644
--- a/Source/Swig/misc.c
+++ b/Source/Swig/misc.c
@@ -429,13 +429,13 @@ String *Swig_string_mangle(const String *s) {
Delete(b);
b = t;
}
- pc = cb = StringChar(b);
+ pc = cb = Char(b);
while (*pc) {
char c = *pc;
if (isalnum((int) c) || (c == '_')) {
state = 1;
if (space && (space == state)) {
- StringAppend(result, "_SS_");
+ Append(result, "_SS_");
}
space = 0;
Printf(result, "%c", (int) c);
@@ -452,7 +452,7 @@ String *Swig_string_mangle(const String *s) {
switch (c) {
case '.':
if ((cb != pc) && (*(pc - 1) == 'p')) {
- StringAppend(result, "_");
+ Append(result, "_");
++pc;
continue;
} else {
@@ -461,7 +461,7 @@ String *Swig_string_mangle(const String *s) {
break;
case ':':
if (*(pc + 1) == ':') {
- StringAppend(result, "_");
+ Append(result, "_");
++pc;
++pc;
continue;
diff --git a/Source/Swig/naming.c b/Source/Swig/naming.c
index 7dc9ee5af..20a161ecb 100644
--- a/Source/Swig/naming.c
+++ b/Source/Swig/naming.c
@@ -179,7 +179,7 @@ String *Swig_name_member(const String_or_char *classname, const String_or_char *
r = NewStringEmpty();
if (!naming_hash)
naming_hash = NewHash();
- f = Getattr(naming_hash, k_member);
+ f = Getattr(naming_hash, "member");
if (!f) {
Append(r, "%c_%m");
} else {
@@ -213,7 +213,7 @@ String *Swig_name_get(const String_or_char *vname) {
r = NewStringEmpty();
if (!naming_hash)
naming_hash = NewHash();
- f = Getattr(naming_hash, k_get);
+ f = Getattr(naming_hash, "get");
if (!f) {
Append(r, "%v_get");
} else {
@@ -237,7 +237,7 @@ String *Swig_name_set(const String_or_char *vname) {
r = NewStringEmpty();
if (!naming_hash)
naming_hash = NewHash();
- f = Getattr(naming_hash, k_set);
+ f = Getattr(naming_hash, "set");
if (!f) {
Append(r, "%v_set");
} else {
@@ -264,7 +264,7 @@ String *Swig_name_construct(const String_or_char *classname) {
r = NewStringEmpty();
if (!naming_hash)
naming_hash = NewHash();
- f = Getattr(naming_hash, k_construct);
+ f = Getattr(naming_hash, "construct");
if (!f) {
Append(r, "new_%c");
} else {
@@ -297,7 +297,7 @@ String *Swig_name_copyconstructor(const String_or_char *classname) {
r = NewStringEmpty();
if (!naming_hash)
naming_hash = NewHash();
- f = Getattr(naming_hash, k_copy);
+ f = Getattr(naming_hash, "copy");
if (!f) {
Append(r, "copy_%c");
} else {
@@ -329,7 +329,7 @@ String *Swig_name_destroy(const String_or_char *classname) {
r = NewStringEmpty();
if (!naming_hash)
naming_hash = NewHash();
- f = Getattr(naming_hash, k_destroy);
+ f = Getattr(naming_hash, "destroy");
if (!f) {
Append(r, "delete_%c");
} else {
@@ -361,7 +361,7 @@ String *Swig_name_disown(const String_or_char *classname) {
r = NewStringEmpty();
if (!naming_hash)
naming_hash = NewHash();
- f = Getattr(naming_hash, k_disown);
+ f = Getattr(naming_hash, "disown");
if (!f) {
Append(r, "disown_%c");
} 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 */
if (!decl) {
- Setattr(n, k_start, object);
+ Setattr(n, "start", object);
} else {
SwigType *cd = Copy(decl);
Setattr(n, cd, object);
@@ -422,7 +422,7 @@ static DOH *get_object(Hash *n, String *decl) {
if (decl) {
rn = Getattr(n, decl);
} else {
- rn = Getattr(n, k_start);
+ rn = Getattr(n, "start");
}
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 */
if (name && SwigType_istemplate(name)) {
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 *nlast = NewStringEmpty();
String *tprefix;
@@ -658,7 +658,7 @@ void Swig_features_get(Hash *features, String *prefix, String *name, SwigType *d
#endif
/* Global features */
- features_get(features, empty_string, 0, 0, node);
+ features_get(features, "", 0, 0, node);
if (name) {
String *tname = NewStringEmpty();
/* add features for 'root' template */
@@ -741,10 +741,10 @@ void Swig_feature_set(Hash *features, const String_or_char *name, SwigType *decl
Delete(n);
}
if (!decl) {
- fhash = Getattr(n, k_start);
+ fhash = Getattr(n, "start");
if (!fhash) {
fhash = NewHash();
- Setattr(n, k_start, fhash);
+ Setattr(n, "start", fhash);
Delete(fhash);
}
} else {
@@ -979,7 +979,7 @@ int Swig_need_protected(Node *n) {
/* and the function is declared like virtual, or it has no
storage. This eliminates typedef, static and so on. */
return !storage || Equal(storage, k_virtual);
- } else if (Equal(nodetype, k_constructor) || Equal(nodetype, k_destructor)) {
+ } else if (Equal(nodetype, "constructor") || Equal(nodetype, "destructor")) {
return 1;
}
@@ -1035,15 +1035,15 @@ static void Swig_name_object_attach_keys(const char *keys[], Hash *nameobj) {
if (!matchlist)
matchlist = NewList();
Setattr(mi, k_value, Getattr(kw, k_value));
- Setattr(mi, k_attrlist, attrlist);
+ Setattr(mi, "attrlist", attrlist);
#ifdef SWIG_DEBUG
if (isrxsmatch)
Printf(stderr, "rxsmatch to use: %s %s %s\n", ckey, Getattr(kw, k_value), attrlist);
#endif
if (isnotmatch)
- SetFlag(mi, k_notmatch);
+ SetFlag(mi, "notmatch");
if (isrxsmatch)
- SetFlag(mi, k_rxsmatch);
+ SetFlag(mi, "rxsmatch");
Delete(attrlist);
Append(matchlist, mi);
Delete(mi);
@@ -1060,7 +1060,7 @@ static void Swig_name_object_attach_keys(const char *keys[], Hash *nameobj) {
kw = next;
}
if (matchlist) {
- Setattr(nameobj, k_matchlist, matchlist);
+ Setattr(nameobj, "matchlist", 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) {
String *nname = 0;
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);
if (target_fmt) {
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 */
- Getattr(nameobj, k_sourcefmt) || Getattr(nameobj, k_matchlist)) {
+ Getattr(nameobj, "sourcefmt") || Getattr(nameobj, "matchlist")) {
if (decl)
Setattr(nameobj, k_decl, decl);
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
last inserted rule take precedence */
Insert(name_list, 0, nameobj);
@@ -1172,14 +1172,14 @@ int Swig_name_match_value(String *mvalue, String *value) {
}
return match;
#else
- return StringEqual(mvalue, value);
+ return Equal(mvalue, value);
#endif
}
int Swig_name_match_nameobj(Hash *rn, Node *n) {
int match = 1;
- List *matchlist = Getattr(rn, k_matchlist);
+ List *matchlist = Getattr(rn, "matchlist");
#ifdef SWIG_DEBUG
Printf(stderr, "Swig_name_match_nameobj: %s\n", Getattr(n, "name"));
#endif
@@ -1188,10 +1188,10 @@ int Swig_name_match_nameobj(Hash *rn, Node *n) {
int i;
for (i = 0; match && (i < ilen); ++i) {
Node *mi = Getitem(matchlist, i);
- List *lattr = Getattr(mi, k_attrlist);
+ List *lattr = Getattr(mi, "attrlist");
String *nval = Swig_get_lattr(n, lattr);
- int notmatch = GetFlag(mi, k_notmatch);
- int rxsmatch = GetFlag(mi, k_rxsmatch);
+ int notmatch = GetFlag(mi, "notmatch");
+ int rxsmatch = GetFlag(mi, "rxsmatch");
#ifdef SWIG_DEBUG
Printf(stderr, "mi %d %s re %d not %d \n", i, nval, notmatch, 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))) {
continue;
} else if (Swig_name_match_nameobj(rn, n)) {
- String *tname = Getattr(rn, k_targetname);
+ String *tname = Getattr(rn, "targetname");
if (tname) {
- String *sfmt = Getattr(rn, k_sourcefmt);
+ String *sfmt = Getattr(rn, "sourcefmt");
String *sname = 0;
int fullname = GetFlag(rn, k_fullname);
- int rxstarget = GetFlag(rn, k_rxstarget);
+ int rxstarget = GetFlag(rn, "rxstarget");
if (sfmt) {
if (fullname && prefix) {
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)) {
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 *nlast = NewStringEmpty();
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)) {
rn = Swig_name_nameobj_lget(Swig_name_rename_list(), n, prefix, name, decl);
if (rn) {
- String *sfmt = Getattr(rn, k_sourcefmt);
+ String *sfmt = Getattr(rn, "sourcefmt");
int fullname = GetFlag(rn, k_fullname);
if (fullname && prefix) {
String *sname = NewStringf("%s::%s", prefix, name);
diff --git a/Source/Swig/parms.c b/Source/Swig/parms.c
index ff28211f1..934e6f327 100644
--- a/Source/Swig/parms.c
+++ b/Source/Swig/parms.c
@@ -10,7 +10,6 @@
char cvsroot_parms_c[] = "$Id$";
#include "swig.h"
-#include "swigkeys.h"
/* ------------------------------------------------------------------------
* NewParm()
@@ -31,86 +30,21 @@ Parm *NewParm(SwigType *type, const String_or_char *name) {
}
/* ------------------------------------------------------------------------
- * 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()
* ------------------------------------------------------------------------ */
Parm *CopyParm(Parm *p) {
Parm *np = NewHash();
- SwigType *t = Getattr(p, "type");
- String *name = Getattr(p, "name");
- String *lname = Getattr(p, "lname");
- String *value = Getattr(p, "value");
- String *ignore = Getattr(p, "ignore");
- String *alttype = Getattr(p, "alttype");
- 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);
+ Iterator ki;
+ for (ki = First(p); ki.key; ki = Next(ki)) {
+ if (DohIsString(ki.item)) {
+ DOH *c = Copy(ki.item);
+ Setattr(np,ki.key,c);
+ Delete(c);
+ }
}
-
Setfile(np, Getfile(p));
Setline(np, Getline(p));
-
return np;
}
@@ -204,10 +138,10 @@ String *ParmList_str(ParmList *p) {
String *out = NewStringEmpty();
while (p) {
String *pstr = SwigType_str(Getattr(p, "type"), Getattr(p, "name"));
- StringAppend(out, pstr);
+ Append(out, pstr);
p = nextSibling(p);
if (p) {
- StringAppend(out, ",");
+ Append(out, ",");
}
Delete(pstr);
}
@@ -225,13 +159,13 @@ String *ParmList_str_defaultargs(ParmList *p) {
while (p) {
String *value = Getattr(p, "value");
String *pstr = SwigType_str(Getattr(p, "type"), Getattr(p, "name"));
- StringAppend(out, pstr);
+ Append(out, pstr);
if (value) {
Printf(out, "=%s", value);
}
p = nextSibling(p);
if (p) {
- StringAppend(out, ",");
+ Append(out, ",");
}
Delete(pstr);
}
@@ -251,10 +185,10 @@ String *ParmList_protostr(ParmList *p) {
p = nextSibling(p);
} else {
String *pstr = SwigType_str(Getattr(p, "type"), 0);
- StringAppend(out, pstr);
+ Append(out, pstr);
p = nextSibling(p);
if (p) {
- StringAppend(out, ",");
+ Append(out, ",");
}
Delete(pstr);
}
@@ -263,32 +197,6 @@ String *ParmList_protostr(ParmList *p) {
}
/* ---------------------------------------------------------------------
- * 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()
*
* Returns 1 if the parameter list passed in is has one or more default
@@ -296,13 +204,11 @@ int ParmList_is_compactdefargs(ParmList *p) {
* ---------------------------------------------------------------------- */
int ParmList_has_defaultargs(ParmList *p) {
- int default_args = 0;
while (p) {
if (Getattr(p, "value")) {
- default_args = 1;
- break;
+ return 1;
}
p = nextSibling(p);
}
- return default_args;
+ return 0;
}
diff --git a/Source/Swig/stype.c b/Source/Swig/stype.c
index a4f9d7abb..1fda4cd2b 100644
--- a/Source/Swig/stype.c
+++ b/Source/Swig/stype.c
@@ -331,11 +331,11 @@ static Hash *default_cache = 0;
static
void SwigType_add_default(String *def, SwigType *nr) {
if (Strcmp(nr, "SWIGTYPE") == 0) {
- StringAppend(def, "SWIGTYPE");
+ Append(def, "SWIGTYPE");
} else {
String *q = SwigType_isqualifier(nr) ? SwigType_pop(nr) : 0;
if (q && strstr(Char(nr), "SWIGTYPE")) {
- StringAppend(def, nr);
+ Append(def, nr);
} else {
String *nd = SwigType_default(nr);
if (nd) {
@@ -349,10 +349,10 @@ void SwigType_add_default(String *def, SwigType *nr) {
Delete(nd);
}
}
- StringAppend(def, bdef);
+ Append(def, bdef);
Delete(bdef);
} else {
- StringAppend(def, nr);
+ Append(def, nr);
}
}
Delete(q);
@@ -448,7 +448,7 @@ SwigType *SwigType_default(SwigType *t) {
SwigType_del_array(nr);
SwigType_add_default(def, nr);
#else
- StringAppend(def, "SWIGTYPE");
+ Append(def, "SWIGTYPE");
#endif
Delete(nr);
}
@@ -475,7 +475,7 @@ SwigType *SwigType_default(SwigType *t) {
}
if (r != t)
Delete(r);
- if (StringEqual(def, t)) {
+ if (Equal(def, t)) {
Delete(def);
def = 0;
}
@@ -522,7 +522,7 @@ String *SwigType_namestr(const SwigType *t) {
/* Avoid creating a <: token, which is the same as [ in C++. */
if (i == 0 && Len(str) && *Char(str) == ':')
Putc(' ', r);
- StringAppend(r, str);
+ Append(r, str);
if ((i + 1) < sz)
Putc(',', r);
Delete(str);
@@ -530,7 +530,7 @@ String *SwigType_namestr(const SwigType *t) {
Putc(' ', r);
Putc('>', r);
suffix = SwigType_templatesuffix(t);
- StringAppend(r, suffix);
+ Append(r, suffix);
Delete(suffix);
Delete(p);
return r;
@@ -577,7 +577,7 @@ String *SwigType_str(SwigType *s, const String_or_char *id) {
Insert(result, 0, "*");
if ((nextelement) && ((SwigType_isfunction(nextelement) || (SwigType_isarray(nextelement))))) {
Insert(result, 0, "(");
- StringAppend(result, ")");
+ Append(result, ")");
}
} else if (SwigType_ismemberpointer(element)) {
String *q;
@@ -586,35 +586,35 @@ String *SwigType_str(SwigType *s, const String_or_char *id) {
Insert(result, 0, q);
if ((nextelement) && ((SwigType_isfunction(nextelement) || (SwigType_isarray(nextelement))))) {
Insert(result, 0, "(");
- StringAppend(result, ")");
+ Append(result, ")");
}
Delete(q);
} else if (SwigType_isreference(element)) {
Insert(result, 0, "&");
if ((nextelement) && ((SwigType_isfunction(nextelement) || (SwigType_isarray(nextelement))))) {
Insert(result, 0, "(");
- StringAppend(result, ")");
+ Append(result, ")");
}
} else if (SwigType_isarray(element)) {
DOH *size;
- StringAppend(result, "[");
+ Append(result, "[");
size = SwigType_parm(element);
- StringAppend(result, size);
- StringAppend(result, "]");
+ Append(result, size);
+ Append(result, "]");
Delete(size);
} else if (SwigType_isfunction(element)) {
DOH *parms, *p;
int j, plen;
- StringAppend(result, "(");
+ Append(result, "(");
parms = SwigType_parmlist(element);
plen = Len(parms);
for (j = 0; j < plen; j++) {
p = SwigType_str(Getitem(parms, j), 0);
- StringAppend(result, p);
+ Append(result, p);
if (j < (plen - 1))
- StringAppend(result, ",");
+ Append(result, ",");
}
- StringAppend(result, ")");
+ Append(result, ")");
Delete(parms);
} else {
if (strcmp(Char(element), "v(...)") == 0) {
@@ -687,34 +687,34 @@ SwigType *SwigType_ltype(SwigType *s) {
if (SwigType_isqualifier(element)) {
/* Do nothing. Ignore */
} else if (SwigType_ispointer(element)) {
- StringAppend(result, element);
+ Append(result, element);
firstarray = 0;
} else if (SwigType_ismemberpointer(element)) {
- StringAppend(result, element);
+ Append(result, element);
firstarray = 0;
} else if (SwigType_isreference(element)) {
if (notypeconv) {
- StringAppend(result, element);
+ Append(result, element);
} else {
- StringAppend(result, "p.");
+ Append(result, "p.");
}
firstarray = 0;
} else if (SwigType_isarray(element) && firstarray) {
if (notypeconv) {
- StringAppend(result, element);
+ Append(result, element);
} else {
- StringAppend(result, "p.");
+ Append(result, "p.");
}
firstarray = 0;
} else if (SwigType_isenum(element)) {
int anonymous_enum = (Cmp(element, "enum ") == 0);
if (notypeconv || !anonymous_enum) {
- StringAppend(result, element);
+ Append(result, element);
} else {
- StringAppend(result, "int");
+ Append(result, "int");
}
} else {
- StringAppend(result, element);
+ Append(result, element);
}
}
Delete(elements);
@@ -813,7 +813,7 @@ String *SwigType_rcaststr(SwigType *s, const String_or_char *name) {
Insert(result, 0, "*");
if ((nextelement) && ((SwigType_isfunction(nextelement) || (SwigType_isarray(nextelement))))) {
Insert(result, 0, "(");
- StringAppend(result, ")");
+ Append(result, ")");
}
firstarray = 0;
} else if (SwigType_ismemberpointer(element)) {
@@ -824,26 +824,26 @@ String *SwigType_rcaststr(SwigType *s, const String_or_char *name) {
Delete(q);
if ((nextelement) && ((SwigType_isfunction(nextelement) || (SwigType_isarray(nextelement))))) {
Insert(result, 0, "(");
- StringAppend(result, ")");
+ Append(result, ")");
}
firstarray = 0;
} else if (SwigType_isreference(element)) {
Insert(result, 0, "&");
if ((nextelement) && ((SwigType_isfunction(nextelement) || (SwigType_isarray(nextelement))))) {
Insert(result, 0, "(");
- StringAppend(result, ")");
+ Append(result, ")");
}
isreference = 1;
} else if (SwigType_isarray(element)) {
DOH *size;
if (firstarray && !isreference) {
- StringAppend(result, "(*)");
+ Append(result, "(*)");
firstarray = 0;
} else {
- StringAppend(result, "[");
+ Append(result, "[");
size = SwigType_parm(element);
- StringAppend(result, size);
- StringAppend(result, "]");
+ Append(result, size);
+ Append(result, "]");
Delete(size);
clear = 0;
}
@@ -851,17 +851,17 @@ String *SwigType_rcaststr(SwigType *s, const String_or_char *name) {
} else if (SwigType_isfunction(element)) {
DOH *parms, *p;
int j, plen;
- StringAppend(result, "(");
+ Append(result, "(");
parms = SwigType_parmlist(element);
plen = Len(parms);
for (j = 0; j < plen; j++) {
p = SwigType_str(Getitem(parms, j), 0);
- StringAppend(result, p);
+ Append(result, p);
Delete(p);
if (j < (plen - 1))
- StringAppend(result, ",");
+ Append(result, ",");
}
- StringAppend(result, ")");
+ Append(result, ")");
Delete(parms);
} else {
String *bs = SwigType_namestr(element);
@@ -881,9 +881,9 @@ String *SwigType_rcaststr(SwigType *s, const String_or_char *name) {
if (isreference) {
if (isarray)
Clear(cast);
- StringAppend(cast, "*");
+ Append(cast, "*");
}
- StringAppend(cast, name);
+ Append(cast, name);
}
Delete(result);
Delete(tc);
@@ -911,14 +911,14 @@ String *SwigType_lcaststr(SwigType *s, const String_or_char *name) {
Printf(result, "(%s)", str);
Delete(str);
if (name)
- StringAppend(result, name);
+ Append(result, name);
} else if (SwigType_isqualifier(s)) {
String *lstr = SwigType_lstr(s, 0);
Printf(result, "(%s)%s", lstr, name);
Delete(lstr);
} else {
if (name)
- StringAppend(result, name);
+ Append(result, name);
}
return result;
}
@@ -986,7 +986,7 @@ String *SwigType_manglestr_default(SwigType *s) {
*c = '_';
c++;
}
- StringAppend(result, base);
+ Append(result, base);
Insert(result, 0, "_");
Delete(lt);
Delete(base);
@@ -1013,7 +1013,7 @@ void SwigType_typename_replace(SwigType *t, String *pat, String *rep) {
if (!Strstr(t, pat))
return;
- if (StringEqual(t, pat)) {
+ if (Equal(t, pat)) {
Replace(t, pat, rep, DOH_REPLACE_ANY);
return;
}
@@ -1023,12 +1023,12 @@ void SwigType_typename_replace(SwigType *t, String *pat, String *rep) {
for (i = 0; i < ilen; i++) {
String *e = Getitem(elem, i);
if (SwigType_issimple(e)) {
- if (StringEqual(e, pat)) {
+ if (Equal(e, pat)) {
/* Replaces a type of the form 'pat' with 'rep<args>' */
Replace(e, pat, rep, DOH_REPLACE_ANY);
} else if (SwigType_istemplate(e)) {
/* Replaces a type of the form 'pat<args>' with 'rep' */
- if (StringEqual(e, pat)) {
+ if (Equal(e, pat)) {
String *repbase = SwigType_templateprefix(rep);
Replace(e, pat, repbase, DOH_REPLACE_ID | DOH_REPLACE_FIRST);
Delete(repbase);
@@ -1038,11 +1038,11 @@ void SwigType_typename_replace(SwigType *t, String *pat, String *rep) {
List *tparms = SwigType_parmlist(e);
int j, jlen;
String *nt = SwigType_templateprefix(e);
- StringAppend(nt, "<(");
+ Append(nt, "<(");
jlen = Len(tparms);
for (j = 0; j < jlen; j++) {
SwigType_typename_replace(Getitem(tparms, j), pat, rep);
- StringAppend(nt, Getitem(tparms, j));
+ Append(nt, Getitem(tparms, j));
if (j < (jlen - 1))
Putc(',', nt);
}
@@ -1050,7 +1050,7 @@ void SwigType_typename_replace(SwigType *t, String *pat, String *rep) {
Printf(nt, ")>%s", tsuffix);
Delete(tsuffix);
Clear(e);
- StringAppend(e, nt);
+ Append(e, nt);
Delete(nt);
Delete(tparms);
}
@@ -1069,23 +1069,23 @@ void SwigType_typename_replace(SwigType *t, String *pat, String *rep) {
int j, jlen;
List *fparms = SwigType_parmlist(e);
Clear(e);
- StringAppend(e, "f(");
+ Append(e, "f(");
jlen = Len(fparms);
for (j = 0; j < jlen; j++) {
SwigType_typename_replace(Getitem(fparms, j), pat, rep);
- StringAppend(e, Getitem(fparms, j));
+ Append(e, Getitem(fparms, j));
if (j < (jlen - 1))
Putc(',', e);
}
- StringAppend(e, ").");
+ Append(e, ").");
Delete(fparms);
} else if (SwigType_isarray(e)) {
Replace(e, pat, rep, DOH_REPLACE_ID);
}
- StringAppend(nt, e);
+ Append(nt, e);
}
Clear(t);
- StringAppend(t, nt);
+ Append(t, nt);
Delete(nt);
Delete(elem);
}
diff --git a/Source/Swig/swigkeys.c b/Source/Swig/swigkeys.c
index bcdf53a02..8abb3cdc0 100644
--- a/Source/Swig/swigkeys.c
+++ b/Source/Swig/swigkeys.c
@@ -9,15 +9,11 @@ char cvsroot_keys_c[] = "$Id$";
#include "swigkeys.h"
-String *empty_string = 0;
-String *k_SWIGTYPE = 0;
String *k_abstract = 0;
String *k_access = 0;
String *k_alias = 0;
String *k_allowstypedef = 0;
String *k_alttype = 0;
-String *k_argbyname = 0;
-String *k_attrlist = 0;
String *k_baselist = 0;
String *k_bases = 0;
String *k_cdecl = 0;
@@ -26,33 +22,21 @@ String *k_classforward = 0;
String *k_classname = 0;
String *k_cplusstaticbase = 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_copy = 0;
String *k_csymnextSibling = 0;
String *k_csympreviousSibling = 0;
String *k_csymtab = 0;
String *k_decl = 0;
String *k_default = 0;
String *k_defaultargs = 0;
-String *k_destroy = 0;
-String *k_destructor = 0;
String *k_director = 0;
String *k_directorbase = 0;
String *k_directorprefixargs = 0;
-String *k_disown = 0;
-String *k_emitonly = 0;
String *k_enumitem = 0;
String *k_error = 0;
String *k_extern = 0;
-String *k_fragment = 0;
String *k_friend = 0;
String *k_fullname = 0;
-String *k_get = 0;
String *k_hidden = 0;
String *k_ignore = 0;
String *k_inherit = 0;
@@ -60,38 +44,23 @@ String *k_kwargs = 0;
String *k_lname = 0;
String *k_locals = 0;
String *k_kind = 0;
-String *k_match = 0;
-String *k_matchlist = 0;
-String *k_member = 0;
String *k_name = 0;
String *k_namespace = 0;
-String *k_notmatch = 0;
-String *k_parent = 0;
String *k_parm = 0;
String *k_parms = 0;
String *k_partialarg = 0;
String *k_partialargs = 0;
String *k_partials = 0;
-String *k_pattern = 0;
String *k_pname = 0;
String *k_privatebaselist = 0;
String *k_protectedbaselist = 0;
String *k_public = 0;
String *k_qname = 0;
String *k_qualifier = 0;
-String *k_rxsmatch = 0;
-String *k_rxstarget = 0;
String *k_rename = 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_storage = 0;
-String *k_symboltable = 0;
String *k_symname = 0;
String *k_symnextSibling = 0;
String *k_symoverloaded = 0;
@@ -101,15 +70,12 @@ String *k_symsymtab = 0;
String *k_symtab = 0;
String *k_symtypename = 0;
String *k_symweak = 0;
-String *k_targetfmt = 0;
-String *k_targetname = 0;
String *k_template = 0;
String *k_templateparm = 0;
String *k_templateparms = 0;
String *k_templatetype = 0;
String *k_throw = 0;
String *k_throws = 0;
-String *k_tmapmatch = 0;
String *k_type = 0;
String *k_typemap = 0;
String *k_typedef = 0;
@@ -119,7 +85,6 @@ String *k_unnamed = 0;
String *k_using = 0;
String *k_value = 0;
String *k_virtual = 0;
-String *k_vtable = 0;
String *k_wrapaction = 0;
String *k_wrapcode = 0;
String *k_wrapdirectormap = 0;
@@ -127,15 +92,11 @@ String *k_wrapdisown = 0;
String *k_wrapper = 0;
void Swig_keys_init() {
- empty_string = NewString("");
- k_SWIGTYPE = NewString("SWIGTYPE");
k_abstract = NewString("abstract");
k_access = NewString("access");
k_alias = NewString("alias");
k_allowstypedef = NewString("allows_typedef");
k_alttype = NewString("alttype");
- k_argbyname = NewString("arg:byname");
- k_attrlist = NewString("attrlist");
k_baselist = NewString("baselist");
k_bases = NewString("bases");
k_cdecl = NewString("cdecl");
@@ -144,32 +105,20 @@ void Swig_keys_init() {
k_classname = NewString("classname");
k_cplusstaticbase = NewString("cplus:staticbase");;
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_copy = NewString("copy");
k_csymnextSibling = NewString("csym:nextSibling");
k_csympreviousSibling = NewString("csym:previousSibling");
k_csymtab = NewString("csymtab");
k_decl = NewString("decl");
k_default = NewString("default");
k_defaultargs = NewString("defaultargs");
- k_destroy = NewString("destroy");
- k_destructor = NewString("destructor");
k_director = NewString("director");
k_directorbase = NewString("directorBase");
k_directorprefixargs = NewString("director:prefix_args");
- k_disown = NewString("disown");
- k_emitonly = NewString("emitonly");
k_enumitem = NewString("enumitem");
k_error = NewString("error");
- k_fragment = NewString("fragment");
k_friend = NewString("friend");
k_fullname = NewString("fullname");
- k_get = NewString("get");
k_hidden = NewString("hidden");
k_ignore = NewString("ignore");
k_inherit = NewString("inherit");
@@ -177,38 +126,23 @@ void Swig_keys_init() {
k_lname = NewString("lname");
k_locals = NewString("locals");
k_kind = NewString("kind");
- k_match = NewString("match");
- k_matchlist = NewString("matchlist");
- k_member = NewString("member");
k_name = NewString("name");
k_namespace = NewString("namespace");
- k_notmatch = NewString("notmatch");
- k_parent = NewString("parent");
k_parm = NewString("parm");
k_parms = NewString("parms");
k_partialarg = NewString("partialarg");
k_partialargs = NewString("partialargs");
k_partials = NewString("partials");
- k_pattern = NewString("pattern");
k_pname = NewString("pname");
k_privatebaselist = NewString("privatebaselist");
k_protectedbaselist = NewString("protectedbaselist");
k_public = NewString("public");
k_qname = NewString("qname");
k_qualifier = NewString("qualifier");
- k_rxsmatch = NewString("rxsmatch");
- k_rxstarget = NewString("rxstarget");
k_rename = NewString("rename");
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_storage = NewString("storage");
- k_symboltable = NewString("symboltable");
k_symname = NewString("sym:name");
k_symnextSibling = NewString("sym:nextSibling");
k_symoverloaded = NewString("sym:overloaded");
@@ -218,15 +152,12 @@ void Swig_keys_init() {
k_symtab = NewString("symtab");
k_symtypename = NewString("sym:typename");
k_symweak = NewString("sym:weak");
- k_targetfmt = NewString("targetfmt");
- k_targetname = NewString("targetname");
k_template = NewString("template");
k_templateparm = NewString("templateparm");
k_templateparms = NewString("templateparms");
k_templatetype = NewString("templatetype");
k_throw = NewString("throw");
k_throws = NewString("throws");
- k_tmapmatch = NewString("tmap:match");
k_type = NewString("type");
k_typemap = NewString("typemap");
k_typedef = NewString("typedef");
@@ -236,7 +167,6 @@ void Swig_keys_init() {
k_using = NewString("using");
k_value = NewString("value");
k_virtual = NewString("virtual");
- k_vtable = NewString("vtable");
k_wrapaction = NewString("wrap:action");
k_wrapcode = NewString("wrap:code");
k_wrapdirectormap = NewString("wrap:directormap");
diff --git a/Source/Swig/swigkeys.h b/Source/Swig/swigkeys.h
index ae3009698..6e04419fa 100644
--- a/Source/Swig/swigkeys.h
+++ b/Source/Swig/swigkeys.h
@@ -14,29 +14,19 @@
extern void Swig_keys_init();
-extern String *empty_string;
-extern String *k_SWIGTYPE;
extern String *k_abstract;
extern String *k_access;
extern String *k_alias;
extern String *k_allowstypedef;
extern String *k_alttype;
-extern String *k_argbyname;
-extern String *k_attrlist;
extern String *k_baselist;
extern String *k_bases;
extern String *k_cdecl;
extern String *k_class;
extern String *k_classforward;
extern String *k_classname;
-extern String *k_copy;
extern String *k_cplusstaticbase;
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_csymnextSibling;
extern String *k_csympreviousSibling;
@@ -44,20 +34,14 @@ extern String *k_csymtab;
extern String *k_decl;
extern String *k_default;
extern String *k_defaultargs;
-extern String *k_destroy;
-extern String *k_destructor;
extern String *k_director;
extern String *k_directorbase;
extern String *k_directorprefixargs;
-extern String *k_disown;
-extern String *k_emitonly;
extern String *k_enumitem;
extern String *k_error;
extern String *k_extern;
-extern String *k_fragment;
extern String *k_friend;
extern String *k_fullname;
-extern String *k_get;
extern String *k_hidden;
extern String *k_ignore;
extern String *k_inherit;
@@ -65,38 +49,23 @@ extern String *k_kwargs;
extern String *k_lname;
extern String *k_locals;
extern String *k_kind;
-extern String *k_match;
-extern String *k_matchlist;
-extern String *k_member;
extern String *k_name;
extern String *k_namespace;
-extern String *k_notmatch;
-extern String *k_parent;
extern String *k_parm;
extern String *k_parms;
extern String *k_partialarg;
extern String *k_partialargs;
extern String *k_partials;
-extern String *k_pattern;
extern String *k_pname;
extern String *k_privatebaselist;
extern String *k_protectedbaselist;
extern String *k_public;
extern String *k_qname;
extern String *k_qualifier;
-extern String *k_rxsmatch;
-extern String *k_rxstarget;
extern String *k_rename;
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_storage;
-extern String *k_symboltable;
extern String *k_symname;
extern String *k_symnextSibling;
extern String *k_symoverloaded;
@@ -106,15 +75,12 @@ extern String *k_symsymtab;
extern String *k_symtab;
extern String *k_symtypename;
extern String *k_symweak;
-extern String *k_targetfmt;
-extern String *k_targetname;
extern String *k_template;
extern String *k_templateparm;
extern String *k_templateparms;
extern String *k_templatetype;
extern String *k_throw;
extern String *k_throws;
-extern String *k_tmapmatch;
extern String *k_type;
extern String *k_typemap;
extern String *k_typedef;
@@ -124,7 +90,6 @@ extern String *k_unnamed;
extern String *k_using;
extern String *k_value;
extern String *k_virtual;
-extern String *k_vtable;
extern String *k_wrapaction;
extern String *k_wrapcode;
extern String *k_wrapdirectormap;
diff --git a/Source/Swig/swigparm.h b/Source/Swig/swigparm.h
index 80b9e50ae..24c63cc1f 100644
--- a/Source/Swig/swigparm.h
+++ b/Source/Swig/swigparm.h
@@ -12,7 +12,6 @@
/* Individual parameters */
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);
/* Parameter lists */
@@ -26,4 +25,3 @@ extern String *ParmList_str_defaultargs(ParmList *);
extern String *ParmList_protostr(ParmList *);
extern int ParmList_is_compactdefargs(ParmList *p);
extern int ParmList_has_defaultargs(ParmList *p);
-extern ParmList *ParmList_copy_all_except_last_parm(ParmList *p);
diff --git a/Source/Swig/symbol.c b/Source/Swig/symbol.c
index 835270347..8616e536a 100644
--- a/Source/Swig/symbol.c
+++ b/Source/Swig/symbol.c
@@ -202,7 +202,7 @@ void Swig_symbol_init() {
current = NewHash();
current_symtab = NewHash();
ccurrent = NewHash();
- set_nodeType(current_symtab, k_symboltable);
+ set_nodeType(current_symtab, "symboltable");
Setattr(current_symtab, k_symtab, current);
Delete(current);
Setattr(current_symtab, k_csymtab, ccurrent);
@@ -210,7 +210,7 @@ void Swig_symbol_init() {
/* Set the global scope */
symtabs = NewHash();
- Setattr(symtabs, empty_string, current_symtab);
+ Setattr(symtabs, "", current_symtab);
Delete(current_symtab);
global_scope = current_symtab;
}
@@ -254,8 +254,8 @@ String *Swig_symbol_getscopename() {
Symtab *Swig_symbol_getscope(const String_or_char *name) {
if (!symtabs)
return 0;
- if (StringEqual(k_coloncolon, (String_or_char *) name))
- name = empty_string;
+ if (Equal("::", (String_or_char *) name))
+ name = "";
return Getattr(symtabs, name);
}
@@ -281,10 +281,10 @@ String *Swig_symbol_qualifiedscopename(Symtab *symtab) {
if (!result) {
result = NewStringEmpty();
}
- if (StringLen(result)) {
+ if (Len(result)) {
Printv(result, "::", name, NIL);
} else {
- StringAppend(result, name);
+ Append(result, name);
}
}
return result;
@@ -303,7 +303,7 @@ Symtab *Swig_symbol_newscope() {
hsyms = NewHash();
h = NewHash();
- set_nodeType(h, k_symboltable);
+ set_nodeType(h, "symboltable");
Setattr(h, k_symtab, hsyms);
Delete(hsyms);
set_parentNode(h, current_symtab);
@@ -447,7 +447,7 @@ void Swig_symbol_cadd(String_or_char *name, Node *n) {
if (SwigType_istemplate(name)) {
String *cname = NewString(name);
String *dname = Swig_symbol_template_deftype(cname, 0);
- if (!StringEqual(dname, name)) {
+ if (!Equal(dname, name)) {
Swig_symbol_cadd(dname, n);
}
Delete(dname);
@@ -563,7 +563,7 @@ void Swig_symbol_cadd(String_or_char *name, Node *n) {
if (td1 && Checkattr(td1, k_storage, k_typedef)) {
String *st = Getattr(td1, k_type);
String *sn = Getattr(td, k_name);
- if (st && sn && StringEqual(st, sn)) {
+ if (st && sn && Equal(st, sn)) {
Symtab *sc = Getattr(current_symtab, "parentNode");
if (sc)
td1 = Swig_symbol_clookup(type, sc);
@@ -670,7 +670,7 @@ Node *Swig_symbol_add(String_or_char *symname, Node *n) {
/* Check for namespaces */
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;
cl = c;
while (cl) {
@@ -706,7 +706,7 @@ Node *Swig_symbol_add(String_or_char *symname, Node *n) {
}
/* Make sure the other node is a typedef */
s = Getattr(other, k_storage);
- if (!s || (!StringEqual(s, k_typedef)))
+ if (!s || (!Equal(s, k_typedef)))
return c; /* No. This is a conflict */
/* Hmmm. This appears to be okay. Make sure the symbol table refers to the allow_type node */
@@ -725,17 +725,17 @@ Node *Swig_symbol_add(String_or_char *symname, Node *n) {
{
String *nt1, *nt2;
nt1 = Getattr(n, "nodeType");
- if (StringEqual(nt1, k_template))
+ if (Equal(nt1, k_template))
nt1 = Getattr(n, k_templatetype);
nt2 = Getattr(c, "nodeType");
- if (StringEqual(nt2, k_template))
+ if (Equal(nt2, k_template))
nt2 = Getattr(c, k_templatetype);
- if (StringEqual(nt1, k_using))
+ if (Equal(nt1, k_using))
u1 = 1;
- if (StringEqual(nt2, k_using))
+ if (Equal(nt2, k_using))
u2 = 1;
- if ((!StringEqual(nt1, nt2)) && !(u1 || u2))
+ if ((!Equal(nt1, nt2)) && !(u1 || u2))
return c;
}
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 */
{
String *nt = Getattr(n, "nodeType");
- int n_template = StringEqual(nt, k_template) && Checkattr(n, k_templatetype, k_cdecl);
- int n_plain_cdecl = StringEqual(nt, k_cdecl);
+ int n_template = Equal(nt, k_template) && Checkattr(n, k_templatetype, k_cdecl);
+ int n_plain_cdecl = Equal(nt, k_cdecl);
cn = c;
pn = 0;
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,
* eg void foo(); template<typename> void foo(); */
String *cnt = Getattr(cn, "nodeType");
- int cn_template = StringEqual(cnt, k_template) && Checkattr(cn, k_templatetype, k_cdecl);
- int cn_plain_cdecl = StringEqual(cnt, k_cdecl);
+ int cn_template = Equal(cnt, k_template) && Checkattr(cn, k_templatetype, k_cdecl);
+ int cn_plain_cdecl = Equal(cnt, k_cdecl);
if (!((n_template && cn_plain_cdecl) || (cn_template && n_plain_cdecl))) {
/* found a conflict */
return cn;
@@ -866,7 +866,7 @@ static Node *_symbol_lookup(String *name, Symtab *symtab, int (*check) (Node *n)
String *dname = 0;
Setmark(symtab, 0);
dname = Swig_symbol_template_deftype(name, symtab);
- if (!StringEqual(dname, name)) {
+ if (!Equal(dname, name)) {
n = _symbol_lookup(dname, symtab, check);
}
Delete(dname);
@@ -930,12 +930,12 @@ static Node *symbol_lookup_qualified(String_or_char *name, Symtab *symtab, Strin
String *qalloc = 0;
String *qname = Swig_symbol_qualifiedscopename(symtab);
if (qname) {
- if (StringLen(qname)) {
- if (prefix && StringLen(prefix)) {
- Printv(qname, k_coloncolon, prefix, NIL);
+ if (Len(qname)) {
+ if (prefix && Len(prefix)) {
+ Printv(qname, "::", prefix, NIL);
}
} else {
- StringAppend(qname, prefix);
+ Append(qname, prefix);
}
qalloc = qname;
} else {
@@ -986,7 +986,7 @@ Node *Swig_symbol_clookup(String_or_char *name, Symtab *n) {
if (!n) {
hsym = current_symtab;
} else {
- if (!Checkattr(n, "nodeType", k_symboltable)) {
+ if (!Checkattr(n, "nodeType", "symboltable")) {
n = Getattr(n, k_symsymtab);
}
assert(n);
@@ -1032,7 +1032,7 @@ Node *Swig_symbol_clookup(String_or_char *name, Symtab *n) {
while (s && Checkattr(s, "nodeType", k_using)) {
String *uname = Getattr(s, k_uname);
Symtab *un = Getattr(s, k_symsymtab);
- Node *ss = (!StringEqual(name, uname) || (un != n)) ? Swig_symbol_clookup(uname, un) : 0; /* avoid infinity loop */
+ Node *ss = (!Equal(name, uname) || (un != n)) ? Swig_symbol_clookup(uname, un) : 0; /* avoid infinity loop */
if (!ss) {
Swig_warning(WARN_PARSE_USING_UNDEF, Getfile(s), Getline(s), "Nothing known about '%s'.\n", Getattr(s, k_uname));
}
@@ -1058,7 +1058,7 @@ Node *Swig_symbol_clookup_check(String_or_char *name, Symtab *n, int (*checkfunc
if (!n) {
hsym = current_symtab;
} else {
- if (!Checkattr(n, "nodeType", k_symboltable)) {
+ if (!Checkattr(n, "nodeType", "symboltable")) {
n = Getattr(n, k_symsymtab);
}
assert(n);
@@ -1123,7 +1123,7 @@ Node *Swig_symbol_clookup_local(String_or_char *name, Symtab *n) {
hsym = current_symtab;
h = ccurrent;
} else {
- if (!Checkattr(n, "nodeType", k_symboltable)) {
+ if (!Checkattr(n, "nodeType", "symboltable")) {
n = Getattr(n, k_symsymtab);
}
assert(n);
@@ -1171,7 +1171,7 @@ Node *Swig_symbol_clookup_local_check(String_or_char *name, Symtab *n, int (*che
hsym = current_symtab;
h = ccurrent;
} else {
- if (!Checkattr(n, "nodeType", k_symboltable)) {
+ if (!Checkattr(n, "nodeType", "symboltable")) {
n = Getattr(n, k_symsymtab);
}
assert(n);
@@ -1308,7 +1308,7 @@ void Swig_symbol_remove(Node *n) {
String *Swig_symbol_qualified(Node *n) {
Hash *symtab;
- if (Checkattr(n, "nodeType", k_symboltable)) {
+ if (Checkattr(n, "nodeType", "symboltable")) {
symtab = n;
} else {
symtab = Getattr(n, k_symsymtab);
@@ -1338,7 +1338,7 @@ Node *Swig_symbol_isoverloaded(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 */
@@ -1372,7 +1372,7 @@ static SwigType *Swig_symbol_template_qualify(const SwigType *e, Symtab *st) {
targs = SwigType_parmlist(e);
tempn = Swig_symbol_clookup_local(tprefix, st);
tscope = tempn ? Getattr(tempn, k_symsymtab) : 0;
- StringAppend(qprefix, "<(");
+ Append(qprefix, "<(");
for (ti = First(targs); ti.item;) {
String *vparm;
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);
- StringAppend(qprefix, vparm);
+ Append(qprefix, vparm);
ti = Next(ti);
if (ti.item) {
- StringPutc(',', qprefix);
+ Putc(',', qprefix);
}
Delete(qparm);
Delete(vparm);
}
- StringAppend(qprefix, ")>");
- StringAppend(qprefix, tsuffix);
+ Append(qprefix, ")>");
+ Append(qprefix, tsuffix);
Delete(tprefix);
Delete(tsuffix);
Delete(targs);
@@ -1414,7 +1414,7 @@ SwigType *Swig_symbol_type_qualify(const SwigType *t, Symtab *st) {
int i, len;
char *c = Char(t);
if (strncmp(c, "::", 2) == 0) {
- StringAppend(result, t);
+ Append(result, t);
return result;
}
@@ -1428,14 +1428,14 @@ SwigType *Swig_symbol_type_qualify(const SwigType *t, Symtab *st) {
if (n) {
String *name = Getattr(n, k_name);
Clear(e);
- StringAppend(e, name);
+ Append(e, name);
#ifdef SWIG_DEBUG
Printf(stderr, "symbol_qual_ei %d %s %s %x\n", i, name, e, st);
#endif
if (!Swig_scopename_check(name)) {
String *qname = Swig_symbol_qualified(n);
- if (qname && StringLen(qname)) {
- Insert(e, 0, k_coloncolon);
+ if (qname && Len(qname)) {
+ Insert(e, 0, "::");
Insert(e, 0, qname);
}
#ifdef SWIG_DEBUG
@@ -1446,33 +1446,33 @@ SwigType *Swig_symbol_type_qualify(const SwigType *t, Symtab *st) {
} else if (SwigType_istemplate(e)) {
SwigType *ty = Swig_symbol_template_qualify(e, st);
Clear(e);
- StringAppend(e, ty);
+ Append(e, ty);
Delete(ty);
}
- if (strncmp(StringChar(e), "::", 2) == 0) {
+ if (strncmp(Char(e), "::", 2) == 0) {
Delitem(e, 0);
Delitem(e, 0);
}
- StringAppend(result, e);
+ Append(result, e);
} else if (SwigType_isfunction(e)) {
List *parms = SwigType_parmlist(e);
String *s = NewString("f(");
Iterator pi = First(parms);
while (pi.item) {
String *pf = Swig_symbol_type_qualify(pi.item, st);
- StringAppend(s, pf);
+ Append(s, pf);
pi = Next(pi);
if (pi.item) {
- StringAppend(s, ",");
+ Append(s, ",");
}
Delete(pf);
}
- StringAppend(s, ").");
- StringAppend(result, s);
+ Append(s, ").");
+ Append(result, s);
Delete(parms);
Delete(s);
} else {
- StringAppend(result, e);
+ Append(result, e);
}
}
Delete(elements);
@@ -1497,7 +1497,7 @@ SwigType *Swig_symbol_template_reduce(SwigType *qt, Symtab *ntab) {
String *tprefix = SwigType_templateprefix(qt);
String *tsuffix = SwigType_templatesuffix(qt);
String *qprefix = SwigType_typedef_qualified(tprefix);
- StringAppend(qprefix, "<(");
+ Append(qprefix, "<(");
while ((p = pi.item)) {
String *np;
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));
Delete(tp);
tp = np;
- if (qual && StringLen(qual)) {
- Insert(np, 0, k_coloncolon);
+ if (qual && Len(qual)) {
+ Insert(np, 0, "::");
Insert(np, 0, qual);
}
Delete(qual);
} else {
np = qp;
}
- StringAppend(qprefix, np);
+ Append(qprefix, np);
pi = Next(pi);
if (pi.item) {
- StringAppend(qprefix, ",");
+ Append(qprefix, ",");
}
Delete(qp);
Delete(tp);
}
- StringAppend(qprefix, ")>");
- StringAppend(qprefix, tsuffix);
+ Append(qprefix, ")>");
+ Append(qprefix, tsuffix);
Delete(parms);
Delete(tprefix);
Delete(tsuffix);
@@ -1545,7 +1545,7 @@ SwigType *Swig_symbol_typedef_reduce(SwigType *ty, Symtab *tab) {
if (!n) {
if (SwigType_istemplate(ty)) {
SwigType *qt = Swig_symbol_template_reduce(base, tab);
- StringAppend(prefix, qt);
+ Append(prefix, qt);
Delete(qt);
#ifdef SWIG_DEBUG
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");
- if (StringEqual(nt, k_using)) {
+ if (Equal(nt, k_using)) {
String *uname = Getattr(n, k_uname);
if (uname) {
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);
- if (storage && (StringEqual(storage, k_typedef))) {
+ if (storage && (Equal(storage, k_typedef))) {
SwigType *decl;
SwigType *rt;
SwigType *qt;
@@ -1588,7 +1588,7 @@ SwigType *Swig_symbol_typedef_reduce(SwigType *ty, Symtab *tab) {
{
const char *dclass[3] = { "struct ", "union ", "class " };
int i;
- char *c = StringChar(nt);
+ char *c = Char(nt);
for (i = 0; i < 3; i++) {
if (strstr(c, dclass[i]) == c) {
Replace(nt, dclass[i], "", DOH_REPLACE_FIRST);
@@ -1639,26 +1639,26 @@ String *Swig_symbol_string_qualify(String *s, Symtab *st) {
int have_id = 0;
String *id = NewStringEmpty();
String *r = NewStringEmpty();
- char *c = StringChar(s);
+ char *c = Char(s);
while (*c) {
if (isalpha((int) *c) || (*c == '_') || (*c == ':')) {
- StringPutc(*c, id);
+ Putc(*c, id);
have_id = 1;
} else {
if (have_id) {
String *qid = Swig_symbol_type_qualify(id, st);
- StringAppend(r, qid);
+ Append(r, qid);
Clear(id);
Delete(qid);
have_id = 0;
}
- StringPutc(*c, r);
+ Putc(*c, r);
}
c++;
}
if (have_id) {
String *qid = Swig_symbol_type_qualify(id, st);
- StringAppend(r, qid);
+ Append(r, qid);
Delete(qid);
}
Delete(id);
@@ -1769,15 +1769,15 @@ SwigType *Swig_symbol_template_deftype(const SwigType *type, Symtab *tscope) {
while (pi.item) {
String *pf = SwigType_istemplate(e) ? Swig_symbol_template_deftype(pi.item, tscope)
: Swig_symbol_type_qualify(pi.item, tscope);
- StringAppend(s, pf);
+ Append(s, pf);
pi = Next(pi);
if (pi.item) {
- StringAppend(s, ",");
+ Append(s, ",");
}
Delete(pf);
}
- StringAppend(s, ").");
- StringAppend(result, s);
+ Append(s, ").");
+ Append(result, s);
Delete(s);
Delete(parms);
} else if (SwigType_istemplate(e)) {
@@ -1802,7 +1802,7 @@ SwigType *Swig_symbol_template_deftype(const SwigType *type, Symtab *tscope) {
#ifdef SWIG_DEBUG
Printf(stderr, "deftype type %s %s %s\n", tprefix, targs, tsuffix);
#endif
- StringAppend(tprefix, "<(");
+ Append(tprefix, "<(");
Swig_symbol_template_defargs(tparms, tnargs, tscope, tsdecl);
p = tparms;
tscope = tsdecl;
@@ -1822,22 +1822,22 @@ SwigType *Swig_symbol_template_deftype(const SwigType *type, Symtab *tscope) {
Printf(stderr, "arg deftype %s\n", ttq);
#endif
}
- StringAppend(tprefix, ttq);
+ Append(tprefix, ttq);
p = nextSibling(p);
if (p)
- StringPutc(',', tprefix);
+ Putc(',', tprefix);
Delete(ttf);
Delete(ttq);
}
- StringAppend(tprefix, ")>");
- StringAppend(tprefix, tsuffix);
- StringAppend(prefix, tprefix);
+ Append(tprefix, ")>");
+ Append(tprefix, tsuffix);
+ Append(prefix, tprefix);
#ifdef SWIG_DEBUG
Printf(stderr, "deftype %s %s \n", type, tprefix);
#endif
- StringAppend(result, prefix);
+ Append(result, prefix);
} else {
- StringAppend(result, e);
+ Append(result, e);
}
Delete(prefix);
Delete(base);
@@ -1846,7 +1846,7 @@ SwigType *Swig_symbol_template_deftype(const SwigType *type, Symtab *tscope) {
Delete(targs);
Delete(tparms);
} else {
- StringAppend(result, e);
+ Append(result, e);
}
}
Delete(elements);
@@ -1868,12 +1868,12 @@ SwigType *Swig_symbol_template_param_eval(const SwigType *p, Symtab *symtab) {
lastnode = n;
if (n) {
String *nt = Getattr(n, "nodeType");
- if (StringEqual(nt, k_enumitem)) {
+ if (Equal(nt, k_enumitem)) {
/* An enum item. Generate a fully qualified name */
String *qn = Swig_symbol_qualified(n);
- if (qn && StringLen(qn)) {
- StringAppend(qn, k_coloncolon);
- StringAppend(qn, Getattr(n, k_name));
+ if (qn && Len(qn)) {
+ Append(qn, "::");
+ Append(qn, Getattr(n, k_name));
Delete(value);
value = qn;
continue;
@@ -1881,7 +1881,7 @@ SwigType *Swig_symbol_template_param_eval(const SwigType *p, Symtab *symtab) {
Delete(qn);
break;
}
- } else if ((StringEqual(nt, k_cdecl))) {
+ } else if ((Equal(nt, k_cdecl))) {
String *nv = Getattr(n, k_value);
if (nv) {
Delete(value);
diff --git a/Source/Swig/typemap.c b/Source/Swig/typemap.c
index 926cf63b3..de5eb1217 100644
--- a/Source/Swig/typemap.c
+++ b/Source/Swig/typemap.c
@@ -664,7 +664,7 @@ Hash *Swig_typemap_search(const String_or_char *op, SwigType *type, const String
if (!unstripped) {
unstripped = ctype;
ctype = SwigType_strip_qualifiers(ctype);
- if (!StringEqual(ctype, unstripped))
+ if (!Equal(ctype, unstripped))
continue; /* Types are different */
Delete(ctype);
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);
if (tm) {
if (mtype && SwigType_isarray(mtype)) {
- Setattr(parms, k_tmapmatch, mtype);
+ Setattr(parms, "tmap:match", mtype);
}
Delete(mtype);
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)) {
Printf(str, "%s%d", pn, argnum);
} else {
- StringAppend(str, pn);
+ Append(str, pn);
}
if (isglobal && Wrapper_check_local(f, str)) {
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);
String *qsn = st ? Swig_symbol_string_qualify(pname, st) : 0;
if (qsn) {
- if (StringLen(qsn) && !Equal(qsn, pname)) {
+ if (Len(qsn) && !Equal(qsn, pname)) {
tm = Swig_typemap_search(op, type, qsn, &mtype);
if (tm && (!Getattr(tm, k_pname) || strstr(Char(Getattr(tm, k_type)), "SWIGTYPE"))) {
tm = 0;
@@ -1342,7 +1342,7 @@ String *Swig_typemap_lookup_new(const String_or_char *op, Node *node, const Stri
Delete(locals);
}
- if (Checkattr(tm, k_type, k_SWIGTYPE)) {
+ if (Checkattr(tm, k_type, "SWIGTYPE")) {
sprintf(temp, "%s:SWIGTYPE", cop);
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));
if (type) {
String *mangle = Swig_string_mangle(type);
- StringAppend(value, mangle);
+ Append(value, mangle);
Delete(mangle);
}
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,
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) {
String *tmname = NewStringf("tmap:%s", kwmatch);
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);
pname = Getattr(p, k_name);
lname = Getattr(p, k_lname);
- mtype = Getattr(p, k_tmapmatch);
+ mtype = Getattr(p, "tmap:match");
if (mtype) {
typemap_replace_vars(s, locals, mtype, type, pname, lname, i + 1);
- Delattr(p, k_tmapmatch);
+ Delattr(p, "tmap:match");
} else {
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);
Setattr(p, tmop_name(temp), "1");
}
diff --git a/Source/Swig/typesys.c b/Source/Swig/typesys.c
index 9ea4cece8..212519961 100644
--- a/Source/Swig/typesys.c
+++ b/Source/Swig/typesys.c
@@ -214,14 +214,14 @@ int SwigType_typedef_class(String_or_char *name) {
String *SwigType_scope_name(Typetab *ttab) {
String *qname = NewString(Getattr(ttab, k_name));
- ttab = Getattr(ttab, k_parent);
+ ttab = Getattr(ttab, "parent");
while (ttab) {
String *pname = Getattr(ttab, k_name);
if (Len(pname)) {
Insert(qname, 0, "::");
Insert(qname, 0, pname);
}
- ttab = Getattr(ttab, k_parent);
+ ttab = Getattr(ttab, "parent");
}
return qname;
}
@@ -242,7 +242,7 @@ void SwigType_new_scope(const String_or_char *name) {
}
s = NewHash();
Setattr(s, k_name, name);
- Setattr(s, k_parent, current_scope);
+ Setattr(s, "parent", current_scope);
ttab = NewHash();
Setattr(s, k_typetab, ttab);
@@ -341,7 +341,7 @@ void SwigType_using_scope(Typetab *scope) {
Typetab *SwigType_pop_scope() {
Typetab *t, *old = current_scope;
- t = Getattr(current_scope, k_parent);
+ t = Getattr(current_scope, "parent");
if (!t)
t = global_scope;
current_scope = t;
@@ -466,7 +466,7 @@ Typetab *SwigType_find_scope(Typetab *s, String *nameprefix) {
}
if (!check_parent)
break;
- ss = Getattr(ss, k_parent);
+ ss = Getattr(ss, "parent");
}
if (nnameprefix)
Delete(nnameprefix);
@@ -519,7 +519,7 @@ static SwigType *_typedef_resolve(Typetab *s, String *base, int look_parent) {
if (!type) {
/* Hmmm. Not found in my scope. check parent */
if (look_parent) {
- parent = Getattr(s, k_parent);
+ parent = Getattr(s, "parent");
type = parent ? _typedef_resolve(parent, base, 1) : 0;
}
}
@@ -563,7 +563,7 @@ SwigType *SwigType_typedef_resolve(SwigType *t) {
}
r = Getattr(typedef_resolve_cache, t);
if (r) {
- resolved_scope = Getmeta(r, k_scope);
+ resolved_scope = Getmeta(r, "scope");
return Copy(r);
}
#endif
@@ -650,7 +650,7 @@ SwigType *SwigType_typedef_resolve(SwigType *t) {
}
}
- if (type && (StringEqual(base, type))) {
+ if (type && (Equal(base, type))) {
if (newtype)
Delete(type);
Delete(base);
@@ -785,7 +785,7 @@ return_result:
if (r) {
SwigType *r1;
Setattr(typedef_resolve_cache, key, r);
- Setmeta(r, k_scope, resolved_scope);
+ Setmeta(r, "scope", resolved_scope);
r1 = Copy(r);
Delete(r);
r = r1;
@@ -915,7 +915,7 @@ SwigType *SwigType_typedef_qualified(SwigType *t) {
break;
}
Delete(qs);
- cs = Getattr(cs, k_parent);
+ cs = Getattr(cs, "parent");
}
}
}
@@ -940,7 +940,7 @@ SwigType *SwigType_typedef_qualified(SwigType *t) {
pi = First(parms);
while ((p = pi.item)) {
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.
If there is a symbol table associated with this scope, we're going to check for this */