Various cleanup.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@629 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Dave Beazley 2000-08-07 21:18:24 +00:00
commit 574ef19b96
6 changed files with 104 additions and 80 deletions

View file

@ -441,8 +441,10 @@ void RUBY::create_function(char *name, char *iname, DataType *t, ParmList *l) {
int numreq = 0;
int numoptreal = 0;
for (i = start; i < Len(l); i++) {
if (!Getignore(Getitem(l,i))) {
Parm *p = Firstitem(l);
for (i = 0; i < start; i++) p = Nextitem(l);
for (i = start; p; i++, p = Nextitem(l)) {
if (!Getignore(p)) {
if (i >= Len(l) - numopt) numoptreal++;
else numreq++;
}
@ -455,8 +457,10 @@ 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);
for (i = start; i < Len(l); i++) {
if (!Getignore(Getitem(l,i))) {
p = Firstitem(l);
for (i = 0; i < start; i++) p = Nextitem(l);
for (i = start; p; i++, p = Nextitem(l)) {
if (!Getignore(p)) {
Printf(f->def,", VALUE varg%d", i);
}
}
@ -465,8 +469,10 @@ void RUBY::create_function(char *name, char *iname, DataType *t, ParmList *l) {
// Emit all of the local variables for holding arguments.
if (vararg) {
for (i = start; i < Len(l); i++) {
if (!Getignore(Getitem(l,i))) {
p = Firstitem(l);
for (i = 0; i < start; i++) p = Nextitem(l);
for (i = start; p; i++, p = Nextitem(l)) {
if (!Getignore(p)) {
char s[256];
sprintf(s,"varg%d",i);
Wrapper_add_localv(f,s,"VALUE",s,0);
@ -495,8 +501,10 @@ 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);
for (i = start; i < Len(l); i++) {
if (!Getignore(Getitem(l,i))) {
p = Firstitem(l);
for (i = 0; i < start; i++) p = Nextitem(l);
for (i = start; p; i++, p = Nextitem(l)) {
if (!Getignore(p)) {
Printf(f->code,", &varg%d", i);
}
}
@ -507,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
for (i = 0; i < pcount ; i++) {
Parm *p = Getitem(l,i);
p = Firstitem(l);
for (i = 0; i < pcount ; i++, p = Nextitem(l)) {
DataType *pt = Gettype(p);
char *pn = Getname(p);