Changed the handling of types in parameter lists and removed the %val

and %out directives.    This result of this change is that SWIG does
a lot less manipulation of types before they are given to language
modules.  It also means that a lot of stuff is going to be broken
for a short period of time.   I am working on cleaning all of this up
so give me a few days to sort it out.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@588 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Dave Beazley 2000-07-20 20:26:17 +00:00
commit 22662ce490
11 changed files with 40 additions and 121 deletions

View file

@ -34,7 +34,6 @@ Parm *NewParm(DataType *type, char *n) {
p->_type = 0;
}
p->_name = Swig_copy_string(n);
p->call_type = 0;
p->_defvalue = 0;
p->ignore = 0;
return p;
@ -48,7 +47,6 @@ Parm *CopyParm(Parm *p) {
Parm *np = (Parm *) malloc(sizeof(Parm));
if (p->_type) np->_type = CopyDataType(p->_type);
np->_name = Swig_copy_string(p->_name);
np->call_type = p->call_type;
np->_defvalue = Swig_copy_string(p->_defvalue);
np->ignore = p->ignore;
return np;
@ -278,9 +276,7 @@ Parm * ParmList_next(ParmList *l) {
* void ParmList_print_types(DOHFile *f)
*
* Prints a comma separated list of all of the parameter types.
* This is for generating valid C prototypes. Has to do some
* manipulation of pointer types depending on how the call_type
* variable has been set.
* This is for generating valid C prototypes.
* ---------------------------------------------------------------------- */
void ParmList_print_types(ParmList *l, DOHFile *f) {
@ -291,21 +287,7 @@ void ParmList_print_types(ParmList *l, DOHFile *f) {
pn = 0;
while(pn < l->nparms) {
t = Parm_Gettype(l->parms[pn]);
is_pointer = t->is_pointer;
/* if (t->is_reference) {
if (t->is_pointer) {
t->is_pointer--;
Printf(f,"%s&", DataType_str(t,0));
t->is_pointer++;
} else {
Printf(f,"%s&", DataType_str(t,0));
}
} else { */
if (l->parms[pn]->call_type & CALL_VALUE) t->is_pointer++;
if (l->parms[pn]->call_type & CALL_REFERENCE) t->is_pointer--;
Printf(f,"%s", DataType_str(t,0));
t->is_pointer = is_pointer;
/* }*/
Printf(f,"%s", DataType_str(t,0));
pn++;
if (pn < l->nparms)
Printf(f,",");
@ -326,30 +308,11 @@ void ParmList_print_args(ParmList *l, DOHFile *f) {
pn = 0;
while(pn < l->nparms) {
t = Parm_Gettype(l->parms[pn]);
is_pointer = t->is_pointer;
/* if (t->is_reference) {
if (t->is_pointer) {
t->is_pointer--;
Printf(f,"%s&", DataType_print_full(t));
t->is_pointer++;
} else {
Printf(f,"%s&", DataType_print_full(t));
}
} else {
*/
if (l->parms[pn]->call_type & CALL_VALUE) t->is_pointer++;
if (l->parms[pn]->call_type & CALL_REFERENCE) t->is_pointer--;
Printf(f,"%s", DataType_str(t,0));
t->is_pointer = is_pointer;
/*
}
*/
Printf(f,"%s",Parm_Getname(l->parms[pn]));
Printf(f,"%s", DataType_str(t,Parm_Getname(l->parms[pn])));
pn++;
if (pn < l->nparms)
Printf(f,",");
}
}

View file

@ -322,7 +322,7 @@ char *DataType_print_mangle_default(DataType *t) {
result[ri][0] = '_';
d = result[ri];
d = result[ri] + 1;
if ((strncmp(c,"struct ",7) == 0) || (strncmp(c,"class ",6) == 0) || (strncmp(c,"union ",6) == 0)) {
c = strchr(c,' ') + 1;

View file

@ -293,13 +293,8 @@ extern void typeeq_addtypedef(char *name, char *eqname, DataType *t);
/* --- Deprecated parameter list structure */
#define CALL_VALUE 0x01
#define CALL_REFERENCE 0x02
#define CALL_OUTPUT 0x04
typedef struct Parm {
DataType *_type; /* Datatype of this parameter */
int call_type; /* Call type (value or reference or value) */
char *_name; /* Name of parameter (optional) */
char *_defvalue; /* Default value (as a string) */
int ignore; /* Ignore flag */

View file

@ -249,7 +249,6 @@ Wrapper_new_localv(Wrapper *w, const DOHString_or_char *name, ...) {
return ret;
}
#ifdef TEST
int main() {
Wrapper *w;