Converted parameter lists to linked lists
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@641 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
b18002ef38
commit
dae32de1c5
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 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);
|
||||
|
||||
if (Getignore(p))
|
||||
|
|
@ -467,7 +467,7 @@ GUILE::create_function (char *name, char *iname, DataType *d, ParmList *l)
|
|||
|
||||
i = 0;
|
||||
int j = 0;
|
||||
p = Firstitem(l);
|
||||
p = l;
|
||||
for (i = 0; i < pcount; ++i) {
|
||||
DataType *pt = Gettype(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);
|
||||
mreplace (cleanup, argnum, arg, proc_name);
|
||||
}
|
||||
p = Nextitem(l);
|
||||
p = Getnext(p);
|
||||
}
|
||||
|
||||
// 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
|
||||
|
||||
for (p = Firstitem(l); p != 0; p = Nextitem(l)) {
|
||||
for (p = l; p != 0; p = Getnext(p)) {
|
||||
DataType *pt = Gettype(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.
|
||||
|
||||
for (p = Firstitem(l); p != 0; p = Nextitem(l)) {
|
||||
for (p = l; p != 0; p = Getnext(p)) {
|
||||
DataType *pt = Gettype(p);
|
||||
char *pn = Getname(p);
|
||||
|
||||
|
|
|
|||
|
|
@ -594,8 +594,8 @@ void JAVA::create_function(char *name, char *iname, DataType *t, ParmList *l)
|
|||
int gencomma = 0;
|
||||
|
||||
// Now walk the function parameter list and generate code to get arguments
|
||||
p = Firstitem(l);
|
||||
for (int i = 0; i < pcount ; i++, p = Nextitem(l)) {
|
||||
p = l;
|
||||
for (int i = 0; i < pcount ; i++, p = Getnext(p)) {
|
||||
DataType *pt = Gettype(p);
|
||||
char *pn = Getname(p);
|
||||
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);
|
||||
|
||||
int pcount = Len(l);
|
||||
int pcount = ParmList_len(l);
|
||||
|
||||
Parm *p = Firstitem(l);
|
||||
for (int i = 0; i < pcount ; i++, p = Nextitem(l)) {
|
||||
Parm *p = l;
|
||||
for (int i = 0; i < pcount ; i++, p = Getnext(p)) {
|
||||
DataType *pt = Gettype(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);
|
||||
|
||||
int pcount = Len(l);
|
||||
int pcount = ParmList_len(l);
|
||||
int gencomma = 0;
|
||||
|
||||
Parm *p = Firstitem(l);
|
||||
for (int i = 0; i < pcount ; i++, p = Nextitem(l)) {
|
||||
Parm *p = l;
|
||||
for (int i = 0; i < pcount ; i++, p = Getnext(p)) {
|
||||
DataType *pt = Gettype(p);
|
||||
char *pn = Getname(p);
|
||||
|
||||
|
|
@ -1215,12 +1215,12 @@ void JAVA::cpp_constructor(char *name, char *iname, ParmList *l) {
|
|||
else
|
||||
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
|
||||
have_default_constructor = 1;
|
||||
|
||||
Parm *p = Firstitem(l);
|
||||
for (int i = 0; i < pcount ; i++, p = Nextitem(l)) {
|
||||
Parm *p = l;
|
||||
for (int i = 0; i < pcount ; i++, p = Getnext(p)) {
|
||||
DataType *pt = Gettype(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)
|
||||
|
||||
int i = 0;
|
||||
p = Firstitem(l);
|
||||
for (i = 0; i < pcount; ++i, p = Nextitem(l)) {
|
||||
p = l;
|
||||
for (i = 0; i < pcount; ++i, p = Getnext(p)) {
|
||||
DataType *pt = Gettype(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
|
||||
|
||||
for (p = Firstitem(l); p != 0; p = Nextitem(l)) {
|
||||
for (p = l; p != 0; p = Getnext(p)) {
|
||||
DataType *pt = Gettype(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.
|
||||
|
||||
for (p = Firstitem(l); p != 0; p = Nextitem(l)) {
|
||||
for (p = l; p != 0; p = Getnext(p)) {
|
||||
DataType *pt = Gettype(p);
|
||||
char *pn = Getname(p);
|
||||
|
||||
|
|
|
|||
|
|
@ -780,7 +780,7 @@ void PERL5::create_function(char *name, char *iname, DataType *d, ParmList *l)
|
|||
|
||||
i = 0;
|
||||
j = 0;
|
||||
p = Firstitem(l);
|
||||
p = l;
|
||||
while (p != 0) {
|
||||
DataType *pt = Gettype(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);
|
||||
num_saved++;
|
||||
}
|
||||
p = Nextitem(l);
|
||||
p = Getnext(p);
|
||||
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
|
||||
// need to extract them from a tied-hash table object.
|
||||
|
||||
Parm *p = Firstitem(l);
|
||||
Parm *p = l;
|
||||
int i = 0;
|
||||
while(p) {
|
||||
DataType *pt = Gettype(p);
|
||||
|
|
@ -1060,7 +1060,7 @@ void PERL5::create_function(char *name, char *iname, DataType *d, ParmList *l)
|
|||
}
|
||||
i++;
|
||||
}
|
||||
p = Nextitem(l);
|
||||
p = Getnext(p);
|
||||
}
|
||||
|
||||
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 */
|
||||
|
||||
p = Firstitem(l);
|
||||
p = l;
|
||||
i = 0;
|
||||
while (p != 0) {
|
||||
DataType *pt = Gettype(p);
|
||||
|
|
@ -1523,12 +1523,12 @@ char *PERL5::usage_func(char *iname, DataType *, ParmList *l) {
|
|||
}
|
||||
}
|
||||
i++;
|
||||
p = Nextitem(l);
|
||||
p = Getnext(p);
|
||||
if (p)
|
||||
if (!Getignore(p))
|
||||
Putc(',',temp);
|
||||
} else {
|
||||
p = Nextitem(l);
|
||||
p = Getnext(p);
|
||||
if (p)
|
||||
if ((i>0) && (!Getignore(p)))
|
||||
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
|
||||
// need to extract them from a tied-hash table object.
|
||||
|
||||
p = Firstitem(l);
|
||||
pcount = Len(l);
|
||||
p = l;
|
||||
pcount = ParmList_len(l);
|
||||
numopt = check_numopt(l);
|
||||
i = 1;
|
||||
while(p) {
|
||||
|
|
@ -1890,7 +1890,7 @@ void PERL5::cpp_member_func(char *name, char *iname, DataType *t, ParmList *l) {
|
|||
}
|
||||
i++;
|
||||
}
|
||||
p = Nextitem(l);
|
||||
p = Getnext(p);
|
||||
}
|
||||
|
||||
// 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
|
||||
// need to extract them from a tied-hash table object.
|
||||
|
||||
p = Firstitem(l);
|
||||
p = l;
|
||||
i = 0;
|
||||
while(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
|
||||
Printf(pcode, " $args[%d] = tied(%%{$args[%d]});\n", i, i);
|
||||
}
|
||||
p = Nextitem(l);
|
||||
p = Getnext(p);
|
||||
i++;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -679,8 +679,8 @@ void PYTHON::create_function(char *name, char *iname, DataType *d, ParmList *l)
|
|||
j = 0;
|
||||
numopt = check_numopt(l); // Get number of optional arguments
|
||||
if (numopt) have_defarg = 1;
|
||||
p = Firstitem(l);
|
||||
|
||||
p = l;
|
||||
Printf(kwargs,"{ ");
|
||||
while (p != 0) {
|
||||
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);
|
||||
have_output++;
|
||||
}
|
||||
p = Nextitem(l);
|
||||
p = Getnext(p);
|
||||
i++;
|
||||
}
|
||||
|
||||
|
|
@ -1364,7 +1364,7 @@ char *PYTHON::usage_func(char *iname, DataType *, ParmList *l) {
|
|||
// You probably don't need to change this
|
||||
|
||||
i = 0;
|
||||
p = Firstitem(l);
|
||||
p = l;
|
||||
while (p != 0) {
|
||||
DataType *pt = Gettype(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));
|
||||
}
|
||||
}
|
||||
p = Nextitem(l);
|
||||
p = Getnext(p);
|
||||
if (p != 0) {
|
||||
if (!Getignore(p))
|
||||
Putc(',',temp);
|
||||
}
|
||||
} else {
|
||||
p = Nextitem(l);
|
||||
p = Getnext(p);
|
||||
if (p) {
|
||||
if ((!Getignore(p)) && (i > 0))
|
||||
Putc(',',temp);
|
||||
|
|
|
|||
|
|
@ -441,11 +441,11 @@ void RUBY::create_function(char *name, char *iname, DataType *t, ParmList *l) {
|
|||
|
||||
int numreq = 0;
|
||||
int numoptreal = 0;
|
||||
Parm *p = Firstitem(l);
|
||||
for (i = 0; i < start; i++) p = Nextitem(l);
|
||||
for (i = start; p; i++, p = Nextitem(l)) {
|
||||
Parm *p = l;
|
||||
for (i = 0; i < start; i++) p = Getnext(p);
|
||||
for (i = start; p; i++, p = Getnext(p)) {
|
||||
if (!Getignore(p)) {
|
||||
if (i >= Len(l) - numopt) numoptreal++;
|
||||
if (i >= ParmList_len(l) - numopt) numoptreal++;
|
||||
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);
|
||||
} else {
|
||||
Printv(f->def, "VALUE self", 0);
|
||||
p = Firstitem(l);
|
||||
for (i = 0; i < start; i++) p = Nextitem(l);
|
||||
for (i = start; p; i++, p = Nextitem(l)) {
|
||||
p = l;
|
||||
for (i = 0; i < start; i++) p = Getnext(p);
|
||||
for (i = start; p; i++, p = Getnext(p)) {
|
||||
if (!Getignore(p)) {
|
||||
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.
|
||||
if (vararg) {
|
||||
p = Firstitem(l);
|
||||
for (i = 0; i < start; i++) p = Nextitem(l);
|
||||
for (i = start; p; i++, p = Nextitem(l)) {
|
||||
p = l;
|
||||
for (i = 0; i < start; i++) p = Getnext(p);
|
||||
for (i = start; p; i++, p = Getnext(p)) {
|
||||
if (!Getignore(p)) {
|
||||
char s[256];
|
||||
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
|
||||
if (vararg) {
|
||||
Printf(f->code," rb_scan_args(argc, argv, \"%d%d\"", (numarg-numoptreal), numoptreal);
|
||||
p = Firstitem(l);
|
||||
for (i = 0; i < start; i++) p = Nextitem(l);
|
||||
for (i = start; p; i++, p = Nextitem(l)) {
|
||||
p = l;
|
||||
for (i = 0; i < start; i++) p = Getnext(p);
|
||||
for (i = start; p; i++, p = Getnext(p)) {
|
||||
if (!Getignore(p)) {
|
||||
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
|
||||
int j = 0; // Total number of non-optional arguments
|
||||
|
||||
p = Firstitem(l);
|
||||
for (i = 0; i < pcount ; i++, p = Nextitem(l)) {
|
||||
p = l;
|
||||
for (i = 0; i < pcount ; i++, p = Getnext(p)) {
|
||||
DataType *pt = Gettype(p);
|
||||
char *pn = Getname(p);
|
||||
|
||||
|
|
|
|||
|
|
@ -505,7 +505,7 @@ void TCL8::create_function(char *name, char *iname, DataType *d, ParmList *l)
|
|||
|
||||
i = 0;
|
||||
j = 0;
|
||||
p = Firstitem(l);
|
||||
p = l;
|
||||
while (p != 0) {
|
||||
DataType *pt = Gettype(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);
|
||||
}
|
||||
i++;
|
||||
p = Nextitem(l); // Get next parameter and continue
|
||||
p = Getnext(p); // Get next parameter and continue
|
||||
}
|
||||
Printf(argstr,":%s\"",usage);
|
||||
Printv(f->code,
|
||||
|
|
@ -1107,9 +1107,9 @@ char * TCL8::usage_string(char *iname, DataType *, ParmList *l) {
|
|||
|
||||
/* Now go through and print parameters */
|
||||
i = 0;
|
||||
pcount = Len(l);
|
||||
pcount = ParmList_len(l);
|
||||
numopt = check_numopt(l);
|
||||
p = Firstitem(l);
|
||||
p = l;
|
||||
while (p != 0) {
|
||||
|
||||
DataType *pt = Gettype(p);
|
||||
|
|
@ -1135,7 +1135,7 @@ char * TCL8::usage_string(char *iname, DataType *, ParmList *l) {
|
|||
Putc(' ',temp);
|
||||
i++;
|
||||
}
|
||||
p = Nextitem(l);
|
||||
p = Getnext(p);
|
||||
}
|
||||
return Char(temp);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue