Converted parameter lists to linked lists
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@641 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
de907d61fe
commit
5a477eef50
15 changed files with 160 additions and 187 deletions
|
|
@ -436,7 +436,7 @@ GUILE::create_function (char *name, char *iname, DataType *d, ParmList *l)
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int first_arg = 1;
|
int first_arg = 1;
|
||||||
for (p = Firstitem(l); p != 0; ++i, p = Nextitem(l)) {
|
for (p = l; p != 0; ++i, p = Getnext(p)) {
|
||||||
DataType *pt = Gettype(p);
|
DataType *pt = Gettype(p);
|
||||||
|
|
||||||
if (Getignore(p))
|
if (Getignore(p))
|
||||||
|
|
@ -467,7 +467,7 @@ GUILE::create_function (char *name, char *iname, DataType *d, ParmList *l)
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
int j = 0;
|
int j = 0;
|
||||||
p = Firstitem(l);
|
p = l;
|
||||||
for (i = 0; i < pcount; ++i) {
|
for (i = 0; i < pcount; ++i) {
|
||||||
DataType *pt = Gettype(p);
|
DataType *pt = Gettype(p);
|
||||||
char *pn = Getname(p);
|
char *pn = Getname(p);
|
||||||
|
|
@ -520,7 +520,7 @@ GUILE::create_function (char *name, char *iname, DataType *d, ParmList *l)
|
||||||
Printv(cleanup, tm, "\n", 0);
|
Printv(cleanup, tm, "\n", 0);
|
||||||
mreplace (cleanup, argnum, arg, proc_name);
|
mreplace (cleanup, argnum, arg, proc_name);
|
||||||
}
|
}
|
||||||
p = Nextitem(l);
|
p = Getnext(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now write code to make the function call
|
// Now write code to make the function call
|
||||||
|
|
@ -819,7 +819,7 @@ GUILE::usage_func (char *iname, DataType *d, ParmList *l, DOHString *usage)
|
||||||
|
|
||||||
// Now go through and print parameters
|
// Now go through and print parameters
|
||||||
|
|
||||||
for (p = Firstitem(l); p != 0; p = Nextitem(l)) {
|
for (p = l; p != 0; p = Getnext(p)) {
|
||||||
DataType *pt = Gettype(p);
|
DataType *pt = Gettype(p);
|
||||||
char *pn = Getname(p);
|
char *pn = Getname(p);
|
||||||
|
|
||||||
|
|
@ -869,7 +869,7 @@ GUILE::usage_returns (char *iname, DataType *d, ParmList *l, DOHString *usage)
|
||||||
|
|
||||||
// go through and see if any are output.
|
// go through and see if any are output.
|
||||||
|
|
||||||
for (p = Firstitem(l); p != 0; p = Nextitem(l)) {
|
for (p = l; p != 0; p = Getnext(p)) {
|
||||||
DataType *pt = Gettype(p);
|
DataType *pt = Gettype(p);
|
||||||
char *pn = Getname(p);
|
char *pn = Getname(p);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -594,8 +594,8 @@ void JAVA::create_function(char *name, char *iname, DataType *t, ParmList *l)
|
||||||
int gencomma = 0;
|
int gencomma = 0;
|
||||||
|
|
||||||
// Now walk the function parameter list and generate code to get arguments
|
// Now walk the function parameter list and generate code to get arguments
|
||||||
p = Firstitem(l);
|
p = l;
|
||||||
for (int i = 0; i < pcount ; i++, p = Nextitem(l)) {
|
for (int i = 0; i < pcount ; i++, p = Getnext(p)) {
|
||||||
DataType *pt = Gettype(p);
|
DataType *pt = Gettype(p);
|
||||||
char *pn = Getname(p);
|
char *pn = Getname(p);
|
||||||
char *target_copy = NULL;
|
char *target_copy = NULL;
|
||||||
|
|
@ -1076,10 +1076,10 @@ void JAVA::cpp_member_func(char *name, char *iname, DataType *t, ParmList *l) {
|
||||||
}
|
}
|
||||||
Printv(nativecall, module, ".", Swig_name_member(shadow_classname,iname), "(_self", 0);
|
Printv(nativecall, module, ".", Swig_name_member(shadow_classname,iname), "(_self", 0);
|
||||||
|
|
||||||
int pcount = Len(l);
|
int pcount = ParmList_len(l);
|
||||||
|
|
||||||
Parm *p = Firstitem(l);
|
Parm *p = l;
|
||||||
for (int i = 0; i < pcount ; i++, p = Nextitem(l)) {
|
for (int i = 0; i < pcount ; i++, p = Getnext(p)) {
|
||||||
DataType *pt = Gettype(p);
|
DataType *pt = Gettype(p);
|
||||||
char *pn = Getname(p);
|
char *pn = Getname(p);
|
||||||
|
|
||||||
|
|
@ -1148,11 +1148,11 @@ void JAVA::cpp_static_func(char *name, char *iname, DataType *t, ParmList *l) {
|
||||||
}
|
}
|
||||||
Printv(nativecall, module, ".", Swig_name_member(shadow_classname,iname), "(", 0);
|
Printv(nativecall, module, ".", Swig_name_member(shadow_classname,iname), "(", 0);
|
||||||
|
|
||||||
int pcount = Len(l);
|
int pcount = ParmList_len(l);
|
||||||
int gencomma = 0;
|
int gencomma = 0;
|
||||||
|
|
||||||
Parm *p = Firstitem(l);
|
Parm *p = l;
|
||||||
for (int i = 0; i < pcount ; i++, p = Nextitem(l)) {
|
for (int i = 0; i < pcount ; i++, p = Getnext(p)) {
|
||||||
DataType *pt = Gettype(p);
|
DataType *pt = Gettype(p);
|
||||||
char *pn = Getname(p);
|
char *pn = Getname(p);
|
||||||
|
|
||||||
|
|
@ -1215,12 +1215,12 @@ void JAVA::cpp_constructor(char *name, char *iname, ParmList *l) {
|
||||||
else
|
else
|
||||||
Printv(nativecall, tab8, " _self = ", module, ".", Swig_name_construct(shadow_classname), "(", 0);
|
Printv(nativecall, tab8, " _self = ", module, ".", Swig_name_construct(shadow_classname), "(", 0);
|
||||||
|
|
||||||
int pcount = Len(l);
|
int pcount = ParmList_len(l);
|
||||||
if(pcount == 0) // We must have a default constructor
|
if(pcount == 0) // We must have a default constructor
|
||||||
have_default_constructor = 1;
|
have_default_constructor = 1;
|
||||||
|
|
||||||
Parm *p = Firstitem(l);
|
Parm *p = l;
|
||||||
for (int i = 0; i < pcount ; i++, p = Nextitem(l)) {
|
for (int i = 0; i < pcount ; i++, p = Getnext(p)) {
|
||||||
DataType *pt = Gettype(p);
|
DataType *pt = Gettype(p);
|
||||||
char *pn = Getname(p);
|
char *pn = Getname(p);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -321,8 +321,8 @@ MZSCHEME::create_function (char *name, char *iname, DataType *d, ParmList *l)
|
||||||
// Now write code to extract the parameters (this is super ugly)
|
// Now write code to extract the parameters (this is super ugly)
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
p = Firstitem(l);
|
p = l;
|
||||||
for (i = 0; i < pcount; ++i, p = Nextitem(l)) {
|
for (i = 0; i < pcount; ++i, p = Getnext(p)) {
|
||||||
DataType *pt = Gettype(p);
|
DataType *pt = Gettype(p);
|
||||||
char *pn = Getname(p);
|
char *pn = Getname(p);
|
||||||
|
|
||||||
|
|
@ -689,7 +689,7 @@ MZSCHEME::usage_func (char *iname, DataType *d, ParmList *l, DOHString *usage)
|
||||||
|
|
||||||
// Now go through and print parameters
|
// Now go through and print parameters
|
||||||
|
|
||||||
for (p = Firstitem(l); p != 0; p = Nextitem(l)) {
|
for (p = l; p != 0; p = Getnext(p)) {
|
||||||
DataType *pt = Gettype(p);
|
DataType *pt = Gettype(p);
|
||||||
char *pn = Getname(p);
|
char *pn = Getname(p);
|
||||||
|
|
||||||
|
|
@ -740,7 +740,7 @@ MZSCHEME::usage_returns (char *iname, DataType *d, ParmList *l, DOHString *usage
|
||||||
|
|
||||||
// go through and see if any are output.
|
// go through and see if any are output.
|
||||||
|
|
||||||
for (p = Firstitem(l); p != 0; p = Nextitem(l)) {
|
for (p = l; p != 0; p = Getnext(p)) {
|
||||||
DataType *pt = Gettype(p);
|
DataType *pt = Gettype(p);
|
||||||
char *pn = Getname(p);
|
char *pn = Getname(p);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -780,7 +780,7 @@ void PERL5::create_function(char *name, char *iname, DataType *d, ParmList *l)
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
j = 0;
|
j = 0;
|
||||||
p = Firstitem(l);
|
p = l;
|
||||||
while (p != 0) {
|
while (p != 0) {
|
||||||
DataType *pt = Gettype(p);
|
DataType *pt = Gettype(p);
|
||||||
char *pn = Getname(p);
|
char *pn = Getname(p);
|
||||||
|
|
@ -902,7 +902,7 @@ void PERL5::create_function(char *name, char *iname, DataType *d, ParmList *l)
|
||||||
Printv(f->code, tab4, temp, " = ", source, ";\n", 0);
|
Printv(f->code, tab4, temp, " = ", source, ";\n", 0);
|
||||||
num_saved++;
|
num_saved++;
|
||||||
}
|
}
|
||||||
p = Nextitem(l);
|
p = Getnext(p);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1037,7 +1037,7 @@ void PERL5::create_function(char *name, char *iname, DataType *d, ParmList *l)
|
||||||
// arguments to our function correspond to other Perl objects, we
|
// arguments to our function correspond to other Perl objects, we
|
||||||
// need to extract them from a tied-hash table object.
|
// need to extract them from a tied-hash table object.
|
||||||
|
|
||||||
Parm *p = Firstitem(l);
|
Parm *p = l;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while(p) {
|
while(p) {
|
||||||
DataType *pt = Gettype(p);
|
DataType *pt = Gettype(p);
|
||||||
|
|
@ -1060,7 +1060,7 @@ void PERL5::create_function(char *name, char *iname, DataType *d, ParmList *l)
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
p = Nextitem(l);
|
p = Getnext(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
Printv(func, tab4, "my $result = ", package, "::", iname, "(@args);\n", 0);
|
Printv(func, tab4, "my $result = ", package, "::", iname, "(@args);\n", 0);
|
||||||
|
|
@ -1507,7 +1507,7 @@ char *PERL5::usage_func(char *iname, DataType *, ParmList *l) {
|
||||||
|
|
||||||
/* Now go through and print parameters */
|
/* Now go through and print parameters */
|
||||||
|
|
||||||
p = Firstitem(l);
|
p = l;
|
||||||
i = 0;
|
i = 0;
|
||||||
while (p != 0) {
|
while (p != 0) {
|
||||||
DataType *pt = Gettype(p);
|
DataType *pt = Gettype(p);
|
||||||
|
|
@ -1523,12 +1523,12 @@ char *PERL5::usage_func(char *iname, DataType *, ParmList *l) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
p = Nextitem(l);
|
p = Getnext(p);
|
||||||
if (p)
|
if (p)
|
||||||
if (!Getignore(p))
|
if (!Getignore(p))
|
||||||
Putc(',',temp);
|
Putc(',',temp);
|
||||||
} else {
|
} else {
|
||||||
p = Nextitem(l);
|
p = Getnext(p);
|
||||||
if (p)
|
if (p)
|
||||||
if ((i>0) && (!Getignore(p)))
|
if ((i>0) && (!Getignore(p)))
|
||||||
Putc(',',temp);
|
Putc(',',temp);
|
||||||
|
|
@ -1864,8 +1864,8 @@ void PERL5::cpp_member_func(char *name, char *iname, DataType *t, ParmList *l) {
|
||||||
// arguments to our function correspond to other Perl objects, we
|
// arguments to our function correspond to other Perl objects, we
|
||||||
// need to extract them from a tied-hash table object.
|
// need to extract them from a tied-hash table object.
|
||||||
|
|
||||||
p = Firstitem(l);
|
p = l;
|
||||||
pcount = Len(l);
|
pcount = ParmList_len(l);
|
||||||
numopt = check_numopt(l);
|
numopt = check_numopt(l);
|
||||||
i = 1;
|
i = 1;
|
||||||
while(p) {
|
while(p) {
|
||||||
|
|
@ -1890,7 +1890,7 @@ void PERL5::cpp_member_func(char *name, char *iname, DataType *t, ParmList *l) {
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
p = Nextitem(l);
|
p = Getnext(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Okay. We've made argument adjustments, now call into the package
|
// Okay. We've made argument adjustments, now call into the package
|
||||||
|
|
@ -2070,7 +2070,7 @@ void PERL5::cpp_constructor(char *name, char *iname, ParmList *l) {
|
||||||
// arguments to our function correspond to other Perl objects, we
|
// arguments to our function correspond to other Perl objects, we
|
||||||
// need to extract them from a tied-hash table object.
|
// need to extract them from a tied-hash table object.
|
||||||
|
|
||||||
p = Firstitem(l);
|
p = l;
|
||||||
i = 0;
|
i = 0;
|
||||||
while(p) {
|
while(p) {
|
||||||
DataType *pt = Gettype(p);
|
DataType *pt = Gettype(p);
|
||||||
|
|
@ -2081,7 +2081,7 @@ void PERL5::cpp_constructor(char *name, char *iname, ParmList *l) {
|
||||||
// Yep. This smells alot like an object, patch up the arguments
|
// Yep. This smells alot like an object, patch up the arguments
|
||||||
Printf(pcode, " $args[%d] = tied(%%{$args[%d]});\n", i, i);
|
Printf(pcode, " $args[%d] = tied(%%{$args[%d]});\n", i, i);
|
||||||
}
|
}
|
||||||
p = Nextitem(l);
|
p = Getnext(p);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -679,8 +679,8 @@ void PYTHON::create_function(char *name, char *iname, DataType *d, ParmList *l)
|
||||||
j = 0;
|
j = 0;
|
||||||
numopt = check_numopt(l); // Get number of optional arguments
|
numopt = check_numopt(l); // Get number of optional arguments
|
||||||
if (numopt) have_defarg = 1;
|
if (numopt) have_defarg = 1;
|
||||||
p = Firstitem(l);
|
|
||||||
|
|
||||||
|
p = l;
|
||||||
Printf(kwargs,"{ ");
|
Printf(kwargs,"{ ");
|
||||||
while (p != 0) {
|
while (p != 0) {
|
||||||
DataType *pt = Gettype(p);
|
DataType *pt = Gettype(p);
|
||||||
|
|
@ -835,7 +835,7 @@ void PYTHON::create_function(char *name, char *iname, DataType *d, ParmList *l)
|
||||||
Replace(outarg,"$arg",source, DOH_REPLACE_ANY);
|
Replace(outarg,"$arg",source, DOH_REPLACE_ANY);
|
||||||
have_output++;
|
have_output++;
|
||||||
}
|
}
|
||||||
p = Nextitem(l);
|
p = Getnext(p);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1364,7 +1364,7 @@ char *PYTHON::usage_func(char *iname, DataType *, ParmList *l) {
|
||||||
// You probably don't need to change this
|
// You probably don't need to change this
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
p = Firstitem(l);
|
p = l;
|
||||||
while (p != 0) {
|
while (p != 0) {
|
||||||
DataType *pt = Gettype(p);
|
DataType *pt = Gettype(p);
|
||||||
char *pn = Getname(p);
|
char *pn = Getname(p);
|
||||||
|
|
@ -1379,13 +1379,13 @@ char *PYTHON::usage_func(char *iname, DataType *, ParmList *l) {
|
||||||
Printf(temp,"%s", DataType_str(pt,0));
|
Printf(temp,"%s", DataType_str(pt,0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p = Nextitem(l);
|
p = Getnext(p);
|
||||||
if (p != 0) {
|
if (p != 0) {
|
||||||
if (!Getignore(p))
|
if (!Getignore(p))
|
||||||
Putc(',',temp);
|
Putc(',',temp);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
p = Nextitem(l);
|
p = Getnext(p);
|
||||||
if (p) {
|
if (p) {
|
||||||
if ((!Getignore(p)) && (i > 0))
|
if ((!Getignore(p)) && (i > 0))
|
||||||
Putc(',',temp);
|
Putc(',',temp);
|
||||||
|
|
|
||||||
|
|
@ -441,11 +441,11 @@ void RUBY::create_function(char *name, char *iname, DataType *t, ParmList *l) {
|
||||||
|
|
||||||
int numreq = 0;
|
int numreq = 0;
|
||||||
int numoptreal = 0;
|
int numoptreal = 0;
|
||||||
Parm *p = Firstitem(l);
|
Parm *p = l;
|
||||||
for (i = 0; i < start; i++) p = Nextitem(l);
|
for (i = 0; i < start; i++) p = Getnext(p);
|
||||||
for (i = start; p; i++, p = Nextitem(l)) {
|
for (i = start; p; i++, p = Getnext(p)) {
|
||||||
if (!Getignore(p)) {
|
if (!Getignore(p)) {
|
||||||
if (i >= Len(l) - numopt) numoptreal++;
|
if (i >= ParmList_len(l) - numopt) numoptreal++;
|
||||||
else numreq++;
|
else numreq++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -457,9 +457,9 @@ void RUBY::create_function(char *name, char *iname, DataType *t, ParmList *l) {
|
||||||
Printv(f->def, "int argc, VALUE *argv, VALUE self",0);
|
Printv(f->def, "int argc, VALUE *argv, VALUE self",0);
|
||||||
} else {
|
} else {
|
||||||
Printv(f->def, "VALUE self", 0);
|
Printv(f->def, "VALUE self", 0);
|
||||||
p = Firstitem(l);
|
p = l;
|
||||||
for (i = 0; i < start; i++) p = Nextitem(l);
|
for (i = 0; i < start; i++) p = Getnext(p);
|
||||||
for (i = start; p; i++, p = Nextitem(l)) {
|
for (i = start; p; i++, p = Getnext(p)) {
|
||||||
if (!Getignore(p)) {
|
if (!Getignore(p)) {
|
||||||
Printf(f->def,", VALUE varg%d", i);
|
Printf(f->def,", VALUE varg%d", i);
|
||||||
}
|
}
|
||||||
|
|
@ -469,9 +469,9 @@ void RUBY::create_function(char *name, char *iname, DataType *t, ParmList *l) {
|
||||||
|
|
||||||
// Emit all of the local variables for holding arguments.
|
// Emit all of the local variables for holding arguments.
|
||||||
if (vararg) {
|
if (vararg) {
|
||||||
p = Firstitem(l);
|
p = l;
|
||||||
for (i = 0; i < start; i++) p = Nextitem(l);
|
for (i = 0; i < start; i++) p = Getnext(p);
|
||||||
for (i = start; p; i++, p = Nextitem(l)) {
|
for (i = start; p; i++, p = Getnext(p)) {
|
||||||
if (!Getignore(p)) {
|
if (!Getignore(p)) {
|
||||||
char s[256];
|
char s[256];
|
||||||
sprintf(s,"varg%d",i);
|
sprintf(s,"varg%d",i);
|
||||||
|
|
@ -501,9 +501,9 @@ void RUBY::create_function(char *name, char *iname, DataType *t, ParmList *l) {
|
||||||
// Emit count to check the number of arguments
|
// Emit count to check the number of arguments
|
||||||
if (vararg) {
|
if (vararg) {
|
||||||
Printf(f->code," rb_scan_args(argc, argv, \"%d%d\"", (numarg-numoptreal), numoptreal);
|
Printf(f->code," rb_scan_args(argc, argv, \"%d%d\"", (numarg-numoptreal), numoptreal);
|
||||||
p = Firstitem(l);
|
p = l;
|
||||||
for (i = 0; i < start; i++) p = Nextitem(l);
|
for (i = 0; i < start; i++) p = Getnext(p);
|
||||||
for (i = start; p; i++, p = Nextitem(l)) {
|
for (i = start; p; i++, p = Getnext(p)) {
|
||||||
if (!Getignore(p)) {
|
if (!Getignore(p)) {
|
||||||
Printf(f->code,", &varg%d", i);
|
Printf(f->code,", &varg%d", i);
|
||||||
}
|
}
|
||||||
|
|
@ -515,8 +515,8 @@ void RUBY::create_function(char *name, char *iname, DataType *t, ParmList *l) {
|
||||||
// to get arguments
|
// to get arguments
|
||||||
int j = 0; // Total number of non-optional arguments
|
int j = 0; // Total number of non-optional arguments
|
||||||
|
|
||||||
p = Firstitem(l);
|
p = l;
|
||||||
for (i = 0; i < pcount ; i++, p = Nextitem(l)) {
|
for (i = 0; i < pcount ; i++, p = Getnext(p)) {
|
||||||
DataType *pt = Gettype(p);
|
DataType *pt = Gettype(p);
|
||||||
char *pn = Getname(p);
|
char *pn = Getname(p);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -505,7 +505,7 @@ void TCL8::create_function(char *name, char *iname, DataType *d, ParmList *l)
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
j = 0;
|
j = 0;
|
||||||
p = Firstitem(l);
|
p = l;
|
||||||
while (p != 0) {
|
while (p != 0) {
|
||||||
DataType *pt = Gettype(p);
|
DataType *pt = Gettype(p);
|
||||||
char *pn = Getname(p);
|
char *pn = Getname(p);
|
||||||
|
|
@ -641,7 +641,7 @@ void TCL8::create_function(char *name, char *iname, DataType *d, ParmList *l)
|
||||||
Replace(outarg,"$arg",source, DOH_REPLACE_ANY);
|
Replace(outarg,"$arg",source, DOH_REPLACE_ANY);
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
p = Nextitem(l); // Get next parameter and continue
|
p = Getnext(p); // Get next parameter and continue
|
||||||
}
|
}
|
||||||
Printf(argstr,":%s\"",usage);
|
Printf(argstr,":%s\"",usage);
|
||||||
Printv(f->code,
|
Printv(f->code,
|
||||||
|
|
@ -1107,9 +1107,9 @@ char * TCL8::usage_string(char *iname, DataType *, ParmList *l) {
|
||||||
|
|
||||||
/* Now go through and print parameters */
|
/* Now go through and print parameters */
|
||||||
i = 0;
|
i = 0;
|
||||||
pcount = Len(l);
|
pcount = ParmList_len(l);
|
||||||
numopt = check_numopt(l);
|
numopt = check_numopt(l);
|
||||||
p = Firstitem(l);
|
p = l;
|
||||||
while (p != 0) {
|
while (p != 0) {
|
||||||
|
|
||||||
DataType *pt = Gettype(p);
|
DataType *pt = Gettype(p);
|
||||||
|
|
@ -1135,7 +1135,7 @@ char * TCL8::usage_string(char *iname, DataType *, ParmList *l) {
|
||||||
Putc(' ',temp);
|
Putc(' ',temp);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
p = Nextitem(l);
|
p = Getnext(p);
|
||||||
}
|
}
|
||||||
return Char(temp);
|
return Char(temp);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -151,9 +151,7 @@ static void update_local_type(DataType *type) {
|
||||||
// (if neccessary).
|
// (if neccessary).
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
static void update_parms(ParmList *l) {
|
static void update_parms(ParmList *p) {
|
||||||
Parm *p;
|
|
||||||
p = Firstitem(l);
|
|
||||||
while (p) {
|
while (p) {
|
||||||
DataType *pt = Gettype(p);
|
DataType *pt = Gettype(p);
|
||||||
char *pvalue = Getvalue(p);
|
char *pvalue = Getvalue(p);
|
||||||
|
|
@ -169,7 +167,7 @@ static void update_parms(ParmList *l) {
|
||||||
Setvalue(p,s);
|
Setvalue(p,s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p = Nextitem(l);
|
p = Getnext(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -639,9 +637,7 @@ public:
|
||||||
Clear(CCode);
|
Clear(CCode);
|
||||||
AddMethods = 0;
|
AddMethods = 0;
|
||||||
if ((!have_constructor) && (1)) {
|
if ((!have_constructor) && (1)) {
|
||||||
ParmList *l;
|
cplus_constructor(classname,0,0);
|
||||||
l = NewParmList();
|
|
||||||
cplus_constructor(classname,0,l);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!have_destructor) {
|
if (!have_destructor) {
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ int emit_args(DataType *rt, ParmList *l, Wrapper *f) {
|
||||||
Swig_cargs(f, l);
|
Swig_cargs(f, l);
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
p = Firstitem(l);
|
p = l;
|
||||||
while (p != 0) {
|
while (p != 0) {
|
||||||
lname = Getlname(p);
|
lname = Getlname(p);
|
||||||
pt = Gettype(p);
|
pt = Gettype(p);
|
||||||
|
|
@ -65,7 +65,7 @@ int emit_args(DataType *rt, ParmList *l, Wrapper *f) {
|
||||||
Setignore(p,1);
|
Setignore(p,1);
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
p = Nextitem(l);
|
p = Getnext(p);
|
||||||
}
|
}
|
||||||
return(i);
|
return(i);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1435,18 +1435,21 @@ func_end : cpp_const LBRACE { skip_brace(); }
|
||||||
|
|
||||||
parms : parm ptail {
|
parms : parm ptail {
|
||||||
DataType *pt = Gettype($1);
|
DataType *pt = Gettype($1);
|
||||||
if (DataType_type(pt) != T_VOID)
|
if (DataType_type(pt) != T_VOID) {
|
||||||
Insert($2,0,$1);
|
Setnext($1,$2);
|
||||||
$$ = $2;
|
$$ = $1;
|
||||||
|
} else {
|
||||||
|
$$ = $2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
| empty { $$ = NewParmList(); }
|
| empty { $$ = 0; }
|
||||||
;
|
;
|
||||||
|
|
||||||
ptail : COMMA parm ptail {
|
ptail : COMMA parm ptail {
|
||||||
Insert($3,0,$2);
|
Setnext($2,$3);
|
||||||
$$ = $3;
|
$$ = $2;
|
||||||
}
|
}
|
||||||
| empty { $$ = NewParmList(); }
|
| empty { $$ = 0; }
|
||||||
;
|
;
|
||||||
|
|
||||||
parm : parm_type {
|
parm : parm_type {
|
||||||
|
|
@ -3230,10 +3233,20 @@ objc_args : objc_args objc_separator objc_arg_type ID {
|
||||||
Parm *p= NewParm($3,$4);
|
Parm *p= NewParm($3,$4);
|
||||||
/* p->objc_separator = $2; */
|
/* p->objc_separator = $2; */
|
||||||
$$ = $1;
|
$$ = $1;
|
||||||
Append($$,p);
|
if (!$$) {
|
||||||
|
$$ = p;
|
||||||
|
} else {
|
||||||
|
Parm *np, *pp;
|
||||||
|
np = $$;
|
||||||
|
while(np) {
|
||||||
|
pp = np;
|
||||||
|
np = Getnext(np);
|
||||||
|
}
|
||||||
|
Setnext(pp,p);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
| empty {
|
| empty {
|
||||||
$$ = NewParmList();
|
$$ = 0;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -308,8 +308,7 @@ void typemap_register(char *op, char *lang, DataType *type, char *pname,
|
||||||
/* Just a sanity check to make sure args look okay. */
|
/* Just a sanity check to make sure args look okay. */
|
||||||
|
|
||||||
if (args) {
|
if (args) {
|
||||||
Parm *p;
|
Parm *p = tm->args;
|
||||||
p = Firstitem(tm->args);
|
|
||||||
while (p) {
|
while (p) {
|
||||||
char *pn = Getname(p);
|
char *pn = Getname(p);
|
||||||
if (pn) {
|
if (pn) {
|
||||||
|
|
@ -318,7 +317,7 @@ void typemap_register(char *op, char *lang, DataType *type, char *pname,
|
||||||
fprintf(stderr,"%s:%d: Typemap error. Local variables must have a name\n",
|
fprintf(stderr,"%s:%d: Typemap error. Local variables must have a name\n",
|
||||||
input_file, line_number);
|
input_file, line_number);
|
||||||
}
|
}
|
||||||
p = Nextitem(tm->args);
|
p = Getnext(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -481,7 +480,7 @@ static void typemap_locals(DataType *t, char *pname, DOHString *s, ParmList *l,
|
||||||
Parm *p;
|
Parm *p;
|
||||||
char *new_name;
|
char *new_name;
|
||||||
|
|
||||||
p = Firstitem(l);
|
p = l;
|
||||||
while (p) {
|
while (p) {
|
||||||
DataType *pt = Gettype(p);
|
DataType *pt = Gettype(p);
|
||||||
char *pn = Getname(p);
|
char *pn = Getname(p);
|
||||||
|
|
@ -529,7 +528,7 @@ static void typemap_locals(DataType *t, char *pname, DOHString *s, ParmList *l,
|
||||||
Replace(s,pn,new_name,DOH_REPLACE_ID);
|
Replace(s,pn,new_name,DOH_REPLACE_ID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p = Nextitem(l);
|
p = Getnext(l);
|
||||||
}
|
}
|
||||||
/* If the original datatype was an array. We're going to go through and substitute
|
/* If the original datatype was an array. We're going to go through and substitute
|
||||||
it's array dimensions */
|
it's array dimensions */
|
||||||
|
|
@ -1122,12 +1121,12 @@ typemap_initialize() {
|
||||||
* Gets the number of optional arguments for a ParmList.
|
* Gets the number of optional arguments for a ParmList.
|
||||||
* ------------------------------------------------------------------ */
|
* ------------------------------------------------------------------ */
|
||||||
|
|
||||||
int check_numopt(ParmList *l) {
|
int check_numopt(ParmList *p) {
|
||||||
int n = 0;
|
int n = 0;
|
||||||
|
int i = 0;
|
||||||
int state = 0;
|
int state = 0;
|
||||||
|
|
||||||
for (int i = 0; i < Len(l); i++) {
|
for (;p; p = Getnext(p),i++) {
|
||||||
Parm *p = Getitem(l,i);
|
|
||||||
DataType *pt = Gettype(p);
|
DataType *pt = Gettype(p);
|
||||||
char *pn = Getname(p);
|
char *pn = Getname(p);
|
||||||
if (Getvalue(p)) {
|
if (Getvalue(p)) {
|
||||||
|
|
@ -1156,80 +1155,58 @@ int check_numopt(ParmList *l) {
|
||||||
* of hash table objects containing all of the matches.
|
* of hash table objects containing all of the matches.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static void extend(ParmList *l, ParmList *e) {
|
|
||||||
Parm *p;
|
|
||||||
if (!(l && e)) return;
|
|
||||||
p = Firstitem(e);
|
|
||||||
while (p) {
|
|
||||||
Append(l,CopyParm(p));
|
|
||||||
p = Nextitem(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DOHList *
|
DOHList *
|
||||||
typemap_match_parms(ParmList *l) {
|
typemap_match_parms(ParmList *l) {
|
||||||
|
|
||||||
DOHList *tl;
|
DOHList *tl;
|
||||||
DOHHash *tm;
|
DOHHash *tm;
|
||||||
Parm *p;
|
Parm *p;
|
||||||
ParmList *nl;
|
|
||||||
|
|
||||||
char *s;
|
char *s;
|
||||||
|
|
||||||
tl = NewList();
|
tl = NewList();
|
||||||
|
|
||||||
p = Firstitem(l);
|
p = l;
|
||||||
while (p) {
|
while (p) {
|
||||||
DataType *pt = Gettype(p);
|
DataType *pt = Gettype(p);
|
||||||
char *pn = Getname(p);
|
char *pn = Getname(p);
|
||||||
ParmList *vars = 0;
|
ParmList *vars = 0;
|
||||||
|
|
||||||
tm = NewHash();
|
tm = NewHash();
|
||||||
vars = NewList();
|
|
||||||
|
|
||||||
/* Look up all of the argument related typemaps */
|
/* Look up all of the argument related typemaps */
|
||||||
/* "in" */
|
/* "in" */
|
||||||
if ((s = typemap_lookup((char*)"in",typemap_lang,pt,pn,(char *)"$source",(char *)"$target",0))) {
|
if ((s = typemap_lookup((char*)"in",typemap_lang,pt,pn,(char *)"$source",(char *)"$target",0))) {
|
||||||
Setattr(tm,"in",s);
|
Setattr(tm,"in",s);
|
||||||
extend(vars,last_args);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* "ignore" */
|
/* "ignore" */
|
||||||
if ((s = typemap_lookup((char*)"ignore",typemap_lang,pt,pn,(char *)"$source",(char *)"$target",0))) {
|
if ((s = typemap_lookup((char*)"ignore",typemap_lang,pt,pn,(char *)"$source",(char *)"$target",0))) {
|
||||||
Setattr(tm,"ignore",s);
|
Setattr(tm,"ignore",s);
|
||||||
extend(vars,last_args);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* "argout" */
|
/* "argout" */
|
||||||
if ((s = typemap_lookup((char*)"argout",typemap_lang,pt,pn,(char *)"$source",(char *)"$target",0))) {
|
if ((s = typemap_lookup((char*)"argout",typemap_lang,pt,pn,(char *)"$source",(char *)"$target",0))) {
|
||||||
Setattr(tm,"argout",s);
|
Setattr(tm,"argout",s);
|
||||||
extend(vars,last_args);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* "default" */
|
/* "default" */
|
||||||
if ((s = typemap_lookup((char*)"default",typemap_lang,pt,pn,(char *)"$source",(char *)"$target",0))) {
|
if ((s = typemap_lookup((char*)"default",typemap_lang,pt,pn,(char *)"$source",(char *)"$target",0))) {
|
||||||
Setattr(tm,"default",s);
|
Setattr(tm,"default",s);
|
||||||
extend(vars,last_args);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* "check" */
|
/* "check" */
|
||||||
if ((s = typemap_lookup((char*)"check",typemap_lang,pt,pn,(char *)"$source",(char *)"$target",0))) {
|
if ((s = typemap_lookup((char*)"check",typemap_lang,pt,pn,(char *)"$source",(char *)"$target",0))) {
|
||||||
Setattr(tm,"check",s);
|
Setattr(tm,"check",s);
|
||||||
extend(vars,last_args);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* "arginit" */
|
/* "arginit" */
|
||||||
if ((s = typemap_lookup((char*)"arginit",typemap_lang,pt,pn,(char *)"$source",(char *)"$target",0))) {
|
if ((s = typemap_lookup((char*)"arginit",typemap_lang,pt,pn,(char *)"$source",(char *)"$target",0))) {
|
||||||
Setattr(tm,"arginit",s);
|
Setattr(tm,"arginit",s);
|
||||||
extend(vars,last_args);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Setattr(tm,"locals", vars);
|
Setattr(tm,"locals", vars);
|
||||||
|
|
||||||
Append(tl,tm);
|
Append(tl,tm);
|
||||||
Delete(vars);
|
|
||||||
Delete(tm);
|
Delete(tm);
|
||||||
p = Nextitem(l);
|
p = Getnext(p);
|
||||||
}
|
}
|
||||||
return tl;
|
return tl;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -153,8 +153,7 @@ Swig_clocal_assign(DataType *t, DOHString_or_char *name) {
|
||||||
* number of parameters.
|
* number of parameters.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int Swig_cargs(Wrapper *w, ParmList *l) {
|
int Swig_cargs(Wrapper *w, ParmList *p) {
|
||||||
Parm *p;
|
|
||||||
int i;
|
int i;
|
||||||
DataType *pt;
|
DataType *pt;
|
||||||
char *pvalue;
|
char *pvalue;
|
||||||
|
|
@ -163,7 +162,6 @@ int Swig_cargs(Wrapper *w, ParmList *l) {
|
||||||
char *lname;
|
char *lname;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
p = Firstitem(l);
|
|
||||||
while (p != 0) {
|
while (p != 0) {
|
||||||
lname = Swig_cparm_name(p,i);
|
lname = Swig_cparm_name(p,i);
|
||||||
pt = Gettype(p);
|
pt = Gettype(p);
|
||||||
|
|
@ -172,7 +170,7 @@ int Swig_cargs(Wrapper *w, ParmList *l) {
|
||||||
local = Swig_clocal(pt,lname,pvalue);
|
local = Swig_clocal(pt,lname,pvalue);
|
||||||
Wrapper_add_localv(w,lname,local,0);
|
Wrapper_add_localv(w,lname,local,0);
|
||||||
i++;
|
i++;
|
||||||
p = Nextitem(l);
|
p = Getnext(p);
|
||||||
}
|
}
|
||||||
return(i);
|
return(i);
|
||||||
}
|
}
|
||||||
|
|
@ -292,20 +290,18 @@ char *
|
||||||
Swig_cfunction_call(DOHString_or_char *name, ParmList *parms) {
|
Swig_cfunction_call(DOHString_or_char *name, ParmList *parms) {
|
||||||
static DOH *func = 0;
|
static DOH *func = 0;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
Parm *p;
|
Parm *p = parms;
|
||||||
DataType *pt;
|
DataType *pt;
|
||||||
|
|
||||||
if (!func) func = NewString("");
|
if (!func) func = NewString("");
|
||||||
Clear(func);
|
Clear(func);
|
||||||
|
|
||||||
Printf(func,"%s(", name);
|
Printf(func,"%s(", name);
|
||||||
|
|
||||||
p = Firstitem(parms);
|
|
||||||
while (p) {
|
while (p) {
|
||||||
pt = Gettype(p);
|
pt = Gettype(p);
|
||||||
Printf(func,"%s", Swig_clocal_deref(pt, Swig_cparm_name(p,i)));
|
Printf(func,"%s", Swig_clocal_deref(pt, Swig_cparm_name(p,i)));
|
||||||
i++;
|
i++;
|
||||||
p = Nextitem(parms);
|
p = Getnext(p);
|
||||||
if (p)
|
if (p)
|
||||||
Printf(func,",");
|
Printf(func,",");
|
||||||
}
|
}
|
||||||
|
|
@ -326,23 +322,21 @@ char *
|
||||||
Swig_cmethod_call(DOHString_or_char *name, ParmList *parms) {
|
Swig_cmethod_call(DOHString_or_char *name, ParmList *parms) {
|
||||||
static DOH *func = 0;
|
static DOH *func = 0;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
Parm *p;
|
Parm *p = parms;
|
||||||
DataType *pt;
|
DataType *pt;
|
||||||
|
|
||||||
if (!func) func = NewString("");
|
if (!func) func = NewString("");
|
||||||
Clear(func);
|
Clear(func);
|
||||||
|
|
||||||
p = Firstitem(parms);
|
|
||||||
|
|
||||||
if (!p) return "";
|
if (!p) return "";
|
||||||
Printf(func,"%s->%s(", Swig_cparm_name(p,0), name);
|
Printf(func,"%s->%s(", Swig_cparm_name(p,0), name);
|
||||||
i++;
|
i++;
|
||||||
p = Nextitem(parms);
|
p = Getnext(p);
|
||||||
while (p) {
|
while (p) {
|
||||||
pt = Gettype(p);
|
pt = Gettype(p);
|
||||||
Printf(func,"%s", Swig_clocal_deref(pt, Swig_cparm_name(p,i)));
|
Printf(func,"%s", Swig_clocal_deref(pt, Swig_cparm_name(p,i)));
|
||||||
i++;
|
i++;
|
||||||
p = Nextitem(parms);
|
p = Getnext(p);
|
||||||
if (p)
|
if (p)
|
||||||
Printf(func,",");
|
Printf(func,",");
|
||||||
}
|
}
|
||||||
|
|
@ -384,18 +378,17 @@ char *
|
||||||
Swig_cppconstructor_call(DOHString_or_char *name, ParmList *parms) {
|
Swig_cppconstructor_call(DOHString_or_char *name, ParmList *parms) {
|
||||||
static DOH *func = 0;
|
static DOH *func = 0;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
Parm *p;
|
Parm *p = parms;
|
||||||
DataType *pt;
|
DataType *pt;
|
||||||
if (!func) func = NewString("");
|
if (!func) func = NewString("");
|
||||||
Clear(func);
|
Clear(func);
|
||||||
|
|
||||||
Printf(func,"new %s(", name);
|
Printf(func,"new %s(", name);
|
||||||
p = Firstitem(parms);
|
|
||||||
while (p) {
|
while (p) {
|
||||||
pt = Gettype(p);
|
pt = Gettype(p);
|
||||||
Printf(func,"%s", Swig_clocal_deref(pt, Swig_cparm_name(p,i)));
|
Printf(func,"%s", Swig_clocal_deref(pt, Swig_cparm_name(p,i)));
|
||||||
i++;
|
i++;
|
||||||
p = Nextitem(parms);
|
p = Getnext(p);
|
||||||
if (p)
|
if (p)
|
||||||
Printf(func,",");
|
Printf(func,",");
|
||||||
}
|
}
|
||||||
|
|
@ -491,11 +484,8 @@ Swig_cmemberget_call(DOHString_or_char *name, DataType *t) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void fix_parm_names(ParmList *l) {
|
static void fix_parm_names(ParmList *p) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
Parm *p;
|
|
||||||
|
|
||||||
p = Firstitem(l);
|
|
||||||
while (p) {
|
while (p) {
|
||||||
if (!Getname(p)) {
|
if (!Getname(p)) {
|
||||||
char temp[64];
|
char temp[64];
|
||||||
|
|
@ -503,7 +493,7 @@ static void fix_parm_names(ParmList *l) {
|
||||||
Setname(p,temp);
|
Setname(p,temp);
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
p = Nextitem(l);
|
p = Getnext(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -529,18 +519,15 @@ Swig_cfunction_wrapper(DOHString_or_char *funcname,
|
||||||
Wrapper_Setname(w,funcname);
|
Wrapper_Setname(w,funcname);
|
||||||
|
|
||||||
l = CopyParmList(parms);
|
l = CopyParmList(parms);
|
||||||
|
|
||||||
fix_parm_names(l);
|
fix_parm_names(l);
|
||||||
|
|
||||||
Printf(w->def,"%s %s(%s) {", DataType_str(rtype,0), funcname, ParmList_str(l));
|
Printf(w->def,"%s %s(%s) {", DataType_str(rtype,0), funcname, ParmList_str(l));
|
||||||
|
|
||||||
if (code) {
|
if (code) {
|
||||||
Printv(w->code, code, "\n", 0);
|
Printv(w->code, code, "\n", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Printf(w->code,"}\n");
|
Printf(w->code,"}\n");
|
||||||
Wrapper_Settype(w,rtype);
|
Wrapper_Settype(w,rtype);
|
||||||
Wrapper_Setparms(w,l);
|
Wrapper_Setparms(w,l);
|
||||||
|
|
||||||
Delete(l);
|
Delete(l);
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
@ -574,9 +561,10 @@ Swig_cmethod_wrapper(DOHString_or_char *classname,
|
||||||
DataType_Setname(t, Char(classname));
|
DataType_Setname(t, Char(classname));
|
||||||
DataType_add_pointer(t);
|
DataType_add_pointer(t);
|
||||||
p = NewParm(t,"self");
|
p = NewParm(t,"self");
|
||||||
Insert(l,0,p);
|
Setnext(p,l);
|
||||||
DelDataType(t);
|
DelDataType(t);
|
||||||
|
|
||||||
|
l = p;
|
||||||
fix_parm_names(l);
|
fix_parm_names(l);
|
||||||
|
|
||||||
Printf(w->def,"%s %s(%s) {", DataType_str(rtype,0), Swig_name_member(classname, methodname), ParmList_str(l));
|
Printf(w->def,"%s %s(%s) {", DataType_str(rtype,0), Swig_name_member(classname, methodname), ParmList_str(l));
|
||||||
|
|
@ -588,11 +576,10 @@ Swig_cmethod_wrapper(DOHString_or_char *classname,
|
||||||
}
|
}
|
||||||
|
|
||||||
Printf(w->code,"self->%s(", methodname);
|
Printf(w->code,"self->%s(", methodname);
|
||||||
p = Firstitem(l);
|
p = Getnext(l);
|
||||||
p = Nextitem(l);
|
|
||||||
while (p) {
|
while (p) {
|
||||||
Printf(w->code,"%s", Getname(p));
|
Printf(w->code,"%s", Getname(p));
|
||||||
p = Nextitem(l);
|
p = Getnext(p);
|
||||||
if (p)
|
if (p)
|
||||||
Printf(w->code,",");
|
Printf(w->code,",");
|
||||||
}
|
}
|
||||||
|
|
@ -688,12 +675,12 @@ Swig_cppconstructor_wrapper(DOHString_or_char *classname,
|
||||||
if (!code) {
|
if (!code) {
|
||||||
/* No code supplied. Write a function manually */
|
/* No code supplied. Write a function manually */
|
||||||
Printf(w->code,"return new %s", DataType_str(t,0));
|
Printf(w->code,"return new %s", DataType_str(t,0));
|
||||||
p = Firstitem(l);
|
p = l;
|
||||||
if (p) {
|
if (p) {
|
||||||
Printf(w->code,"(");
|
Printf(w->code,"(");
|
||||||
while (p) {
|
while (p) {
|
||||||
Printf(w->code,"%s", Getname(p));
|
Printf(w->code,"%s", Getname(p));
|
||||||
p = Nextitem(l);
|
p = Getnext(p);
|
||||||
if (p)
|
if (p)
|
||||||
Printf(w->code,",");
|
Printf(w->code,",");
|
||||||
}
|
}
|
||||||
|
|
@ -732,12 +719,11 @@ Swig_cdestructor_wrapper(DOHString_or_char *classname,
|
||||||
/* Set the name of the function */
|
/* Set the name of the function */
|
||||||
Wrapper_Setname(w,Swig_name_destroy(classname));
|
Wrapper_Setname(w,Swig_name_destroy(classname));
|
||||||
|
|
||||||
l = NewParmList();
|
|
||||||
t = NewDataType(T_USER);
|
t = NewDataType(T_USER);
|
||||||
DataType_Setname(t,classname);
|
DataType_Setname(t,classname);
|
||||||
DataType_add_pointer(t);
|
DataType_add_pointer(t);
|
||||||
p = NewParm(t,"self");
|
p = NewParm(t,"self");
|
||||||
Append(l,p);
|
l = p;
|
||||||
DelDataType(t);
|
DelDataType(t);
|
||||||
|
|
||||||
t = NewDataType(T_VOID);
|
t = NewDataType(T_VOID);
|
||||||
|
|
@ -779,13 +765,12 @@ Swig_cppdestructor_wrapper(DOHString_or_char *classname,
|
||||||
/* Set the name of the function */
|
/* Set the name of the function */
|
||||||
Wrapper_Setname(w,Swig_name_destroy(classname));
|
Wrapper_Setname(w,Swig_name_destroy(classname));
|
||||||
|
|
||||||
l = NewParmList();
|
|
||||||
t = NewDataType(T_USER);
|
t = NewDataType(T_USER);
|
||||||
DataType_Setname(t,classname);
|
DataType_Setname(t,classname);
|
||||||
DataType_add_pointer(t);
|
DataType_add_pointer(t);
|
||||||
p = NewParm(t,"self");
|
p = NewParm(t,"self");
|
||||||
|
|
||||||
Append(l,p);
|
l = p;
|
||||||
DelDataType(t);
|
DelDataType(t);
|
||||||
|
|
||||||
t = NewDataType(T_VOID);
|
t = NewDataType(T_VOID);
|
||||||
|
|
@ -829,17 +814,16 @@ Swig_cmemberset_wrapper(DOHString_or_char *classname,
|
||||||
/* Set the name of the function */
|
/* Set the name of the function */
|
||||||
Wrapper_Setname(w,Swig_name_member(classname, Swig_name_set(membername)));
|
Wrapper_Setname(w,Swig_name_member(classname, Swig_name_set(membername)));
|
||||||
|
|
||||||
l = NewParmList();
|
|
||||||
t = NewDataType(T_USER);
|
t = NewDataType(T_USER);
|
||||||
DataType_Setname(t, Char(classname));
|
DataType_Setname(t, Char(classname));
|
||||||
DataType_add_pointer(t);
|
DataType_add_pointer(t);
|
||||||
p = NewParm(t,"self");
|
p = NewParm(t,"self");
|
||||||
Append(l,p);
|
l = p;
|
||||||
DelDataType(t);
|
DelDataType(t);
|
||||||
|
|
||||||
lt = Swig_clocal_type(type);
|
lt = Swig_clocal_type(type);
|
||||||
p = NewParm(lt,"value");
|
p = NewParm(lt,"value");
|
||||||
Append(l,p);
|
Setnext(l,p);
|
||||||
|
|
||||||
Printf(w->def,"%s %s(%s) {", DataType_str(lt,0), Wrapper_Getname(w), ParmList_str(l));
|
Printf(w->def,"%s %s(%s) {", DataType_str(lt,0), Wrapper_Getname(w), ParmList_str(l));
|
||||||
|
|
||||||
|
|
@ -882,12 +866,11 @@ Swig_cmemberget_wrapper(DOHString_or_char *classname,
|
||||||
/* Set the name of the function */
|
/* Set the name of the function */
|
||||||
Wrapper_Setname(w,Swig_name_member(classname, Swig_name_get(membername)));
|
Wrapper_Setname(w,Swig_name_member(classname, Swig_name_get(membername)));
|
||||||
|
|
||||||
l = NewParmList();
|
|
||||||
t = NewDataType(T_USER);
|
t = NewDataType(T_USER);
|
||||||
DataType_Setname(t, Char(classname));
|
DataType_Setname(t, Char(classname));
|
||||||
DataType_add_pointer(t);
|
DataType_add_pointer(t);
|
||||||
p = NewParm(t,"self");
|
p = NewParm(t,"self");
|
||||||
Append(l,p);
|
l = p;
|
||||||
DelDataType(t);
|
DelDataType(t);
|
||||||
|
|
||||||
lt = Swig_clocal_type(type);
|
lt = Swig_clocal_type(type);
|
||||||
|
|
@ -928,10 +911,9 @@ Swig_cvarset_wrapper(DOHString_or_char *varname,
|
||||||
/* Set the name of the function */
|
/* Set the name of the function */
|
||||||
Wrapper_Setname(w,Swig_name_set(varname));
|
Wrapper_Setname(w,Swig_name_set(varname));
|
||||||
|
|
||||||
l = NewParmList();
|
|
||||||
lt = Swig_clocal_type(type);
|
lt = Swig_clocal_type(type);
|
||||||
p = NewParm(lt,"value");
|
p = NewParm(lt,"value");
|
||||||
Append(l,p);
|
l = p;
|
||||||
|
|
||||||
Printf(w->def,"%s %s(%s) {", DataType_str(lt,0), Wrapper_Getname(w), ParmList_str(l));
|
Printf(w->def,"%s %s(%s) {", DataType_str(lt,0), Wrapper_Getname(w), ParmList_str(l));
|
||||||
|
|
||||||
|
|
@ -966,7 +948,7 @@ Swig_cvarget_wrapper(DOHString_or_char *varname,
|
||||||
DOHString_or_char *code)
|
DOHString_or_char *code)
|
||||||
{
|
{
|
||||||
Wrapper *w;
|
Wrapper *w;
|
||||||
ParmList *l;
|
ParmList *l = 0;
|
||||||
DataType *lt;
|
DataType *lt;
|
||||||
|
|
||||||
w = NewWrapper();
|
w = NewWrapper();
|
||||||
|
|
@ -974,8 +956,6 @@ Swig_cvarget_wrapper(DOHString_or_char *varname,
|
||||||
/* Set the name of the function */
|
/* Set the name of the function */
|
||||||
Wrapper_Setname(w, Swig_name_get(varname));
|
Wrapper_Setname(w, Swig_name_get(varname));
|
||||||
|
|
||||||
l = NewParmList();
|
|
||||||
|
|
||||||
lt = Swig_clocal_type(type);
|
lt = Swig_clocal_type(type);
|
||||||
|
|
||||||
Printf(w->def,"%s %s(%s) {", DataType_str(lt,0), Wrapper_Getname(w), ParmList_str(l));
|
Printf(w->def,"%s %s(%s) {", DataType_str(lt,0), Wrapper_Getname(w), ParmList_str(l));
|
||||||
|
|
|
||||||
|
|
@ -66,66 +66,73 @@ Parm *CopyParm(Parm *p) {
|
||||||
return np;
|
return np;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------------
|
|
||||||
* NewParmList()
|
|
||||||
* ------------------------------------------------------------------ */
|
|
||||||
|
|
||||||
ParmList *NewParmList() {
|
|
||||||
return NewList();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------------
|
/* ------------------------------------------------------------------
|
||||||
* CopyParmList()
|
* CopyParmList()
|
||||||
* ------------------------------------------------------------------ */
|
* ------------------------------------------------------------------ */
|
||||||
|
|
||||||
ParmList *
|
ParmList *
|
||||||
CopyParmList(ParmList *l) {
|
CopyParmList(ParmList *p) {
|
||||||
ParmList *nl;
|
Parm *np;
|
||||||
int i, len;
|
Parm *pp = 0;
|
||||||
|
Parm *fp = 0;
|
||||||
|
|
||||||
nl = NewList();
|
if (!p) return 0;
|
||||||
len = Len(l);
|
|
||||||
for (i = 0; i < len; i++) {
|
while (p) {
|
||||||
Parm *p = Getitem(l,i);
|
np = CopyParm(p);
|
||||||
Append(nl, CopyParm(p));
|
if (pp) {
|
||||||
|
Setnext(pp,np);
|
||||||
|
} else {
|
||||||
|
fp = np;
|
||||||
|
}
|
||||||
|
pp = np;
|
||||||
|
p = Getnext(p);
|
||||||
}
|
}
|
||||||
return nl;
|
return fp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------------
|
/* ------------------------------------------------------------------
|
||||||
* int ParmList_numarg()
|
* int ParmList_numarg()
|
||||||
* ------------------------------------------------------------------ */
|
* ------------------------------------------------------------------ */
|
||||||
|
|
||||||
int ParmList_numarg(ParmList *l) {
|
int ParmList_numarg(ParmList *p) {
|
||||||
int n = 0;
|
int n = 0;
|
||||||
Parm *p;
|
|
||||||
|
|
||||||
p = Firstitem(l);
|
|
||||||
while (p) {
|
while (p) {
|
||||||
if (!Getignore(p)) n++;
|
if (!Getignore(p)) n++;
|
||||||
p = Nextitem(l);
|
p = Getnext(p);
|
||||||
}
|
}
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -----------------------------------------------------------------------------
|
||||||
|
* int ParmList_len()
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
int ParmList_len(ParmList *p) {
|
||||||
|
int i = 0;
|
||||||
|
while (p) {
|
||||||
|
i++;
|
||||||
|
p = Getnext(p);
|
||||||
|
}
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------
|
/* ---------------------------------------------------------------------
|
||||||
* ParmList_str()
|
* ParmList_str()
|
||||||
*
|
*
|
||||||
* Generates a string of parameters
|
* Generates a string of parameters
|
||||||
* ---------------------------------------------------------------------- */
|
* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
char *ParmList_str(ParmList *l) {
|
char *ParmList_str(ParmList *p) {
|
||||||
static DOHString *out = 0;
|
static DOHString *out = 0;
|
||||||
Parm *p;
|
|
||||||
DataType *t;
|
DataType *t;
|
||||||
|
|
||||||
if (!out) out = NewString("");
|
if (!out) out = NewString("");
|
||||||
Clear(out);
|
Clear(out);
|
||||||
p = Firstitem(l);
|
|
||||||
while(p) {
|
while(p) {
|
||||||
t = Gettype(p);
|
t = Gettype(p);
|
||||||
Printf(out,"%s", DataType_str(t,Getname(p)));
|
Printf(out,"%s", DataType_str(t,Getname(p)));
|
||||||
p = Nextitem(l);
|
p = Getnext(p);
|
||||||
if (p)
|
if (p)
|
||||||
Printf(out,",");
|
Printf(out,",");
|
||||||
}
|
}
|
||||||
|
|
@ -138,18 +145,16 @@ char *ParmList_str(ParmList *l) {
|
||||||
* Generate a prototype string.
|
* Generate a prototype string.
|
||||||
* ---------------------------------------------------------------------- */
|
* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
char *ParmList_protostr(ParmList *l) {
|
char *ParmList_protostr(ParmList *p) {
|
||||||
static DOHString *out = 0;
|
static DOHString *out = 0;
|
||||||
Parm *p;
|
|
||||||
DataType *t;
|
DataType *t;
|
||||||
|
|
||||||
if (!out) out = NewString("");
|
if (!out) out = NewString("");
|
||||||
Clear(out);
|
Clear(out);
|
||||||
p = Firstitem(l);
|
|
||||||
while(p) {
|
while(p) {
|
||||||
t = Gettype(p);
|
t = Gettype(p);
|
||||||
Printf(out,"%s", DataType_str(t,0));
|
Printf(out,"%s", DataType_str(t,0));
|
||||||
p = Nextitem(l);
|
p = Getnext(p);
|
||||||
if (p)
|
if (p)
|
||||||
Printf(out,",");
|
Printf(out,",");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -133,6 +133,7 @@ typedef DOH ParmList;
|
||||||
extern ParmList *NewParmList();
|
extern ParmList *NewParmList();
|
||||||
extern ParmList *CopyParmList(ParmList *);
|
extern ParmList *CopyParmList(ParmList *);
|
||||||
|
|
||||||
|
extern int ParmList_len(ParmList *);
|
||||||
extern int ParmList_numarg(ParmList *);
|
extern int ParmList_numarg(ParmList *);
|
||||||
extern char *ParmList_str(ParmList *);
|
extern char *ParmList_str(ParmList *);
|
||||||
extern char *ParmList_protostr(ParmList *);
|
extern char *ParmList_protostr(ParmList *);
|
||||||
|
|
|
||||||
|
|
@ -52,8 +52,8 @@ DelWrapper(Wrapper *w) {
|
||||||
Delete(w->code);
|
Delete(w->code);
|
||||||
Delete(w->def);
|
Delete(w->def);
|
||||||
if (w->_type) DelDataType(w->_type);
|
if (w->_type) DelDataType(w->_type);
|
||||||
if (w->_parms) Delete(w->_parms);
|
Delete(w->_parms);
|
||||||
if (w->_name) Delete(w->_name);
|
Delete(w->_name);
|
||||||
free(w);
|
free(w);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -291,8 +291,9 @@ Wrapper_Getparms(Wrapper *w) {
|
||||||
|
|
||||||
void
|
void
|
||||||
Wrapper_Setparms(Wrapper *w, ParmList *l) {
|
Wrapper_Setparms(Wrapper *w, ParmList *l) {
|
||||||
if (w->_parms) Delete(w->_parms);
|
Delete(w->_parms);
|
||||||
w->_parms = CopyParmList(l);
|
w->_parms = l;
|
||||||
|
DohIncref(l);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
|
|
@ -310,7 +311,7 @@ Wrapper_Getname(Wrapper *w) {
|
||||||
|
|
||||||
void
|
void
|
||||||
Wrapper_Setname(Wrapper *w, DOHString_or_char *n) {
|
Wrapper_Setname(Wrapper *w, DOHString_or_char *n) {
|
||||||
if (w->_name) Delete(w->_name);
|
Delete(w->_name);
|
||||||
w->_name = NewString(n);
|
w->_name = NewString(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue