Cleanup and a variety of changes related to new core.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@602 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
91ff20631b
commit
fbb026037d
7 changed files with 85 additions and 116 deletions
|
|
@ -438,8 +438,8 @@ GUILE::create_function (char *name, char *iname, DataType *d, ParmList *l)
|
|||
int first_arg = 1;
|
||||
for (p = ParmList_first(l); p != 0; ++i, p = ParmList_next(l)) {
|
||||
DataType *pt = Parm_Gettype(p);
|
||||
char *pn = Parm_Getname(p);
|
||||
if (p->ignore)
|
||||
|
||||
if (Parm_Getignore(p))
|
||||
continue;
|
||||
if ((pt->type != T_VOID) || (pt->is_pointer)) {
|
||||
if (!first_arg)
|
||||
|
|
@ -480,7 +480,7 @@ GUILE::create_function (char *name, char *iname, DataType *d, ParmList *l)
|
|||
|
||||
// Handle parameter types.
|
||||
|
||||
if (p->ignore)
|
||||
if (Parm_Getignore(p))
|
||||
Printv(f->code, "/* ", pn, " ignored... */\n", 0);
|
||||
else {
|
||||
++numargs;
|
||||
|
|
@ -621,7 +621,7 @@ GUILE::link_variable (char *name, char *iname, DataType *t)
|
|||
DOHString *proc_name;
|
||||
char var_name[256];
|
||||
char *tm;
|
||||
char *tm2 = typemap_lookup ((char*)"varout", (char*)"guile", t, name, name, (char*)"scmresult");
|
||||
|
||||
|
||||
// evaluation function names
|
||||
|
||||
|
|
@ -810,7 +810,7 @@ GUILE::usage_var (char *iname, DataType *t, DOHString *usage)
|
|||
void
|
||||
GUILE::usage_func (char *iname, DataType *d, ParmList *l, DOHString *usage)
|
||||
{
|
||||
int i;
|
||||
|
||||
Parm *p;
|
||||
|
||||
// Print the function name.
|
||||
|
|
@ -823,7 +823,7 @@ GUILE::usage_func (char *iname, DataType *d, ParmList *l, DOHString *usage)
|
|||
DataType *pt = Parm_Gettype(p);
|
||||
char *pn = Parm_Getname(p);
|
||||
|
||||
if (p->ignore)
|
||||
if (Parm_Getignore(p))
|
||||
continue;
|
||||
|
||||
// Print the type. If the parameter has been named, use that as well.
|
||||
|
|
|
|||
|
|
@ -529,7 +529,7 @@ void JAVA::create_function(char *name, char *iname, DataType *t, ParmList *l)
|
|||
char source[256], target[256];
|
||||
char *tm;
|
||||
DOHString *cleanup, *outarg, *body;
|
||||
char *javaReturnSignature;
|
||||
char *javaReturnSignature = 0;
|
||||
DOHString *javaParameterSignature;
|
||||
|
||||
cleanup = NewString("");
|
||||
|
|
@ -606,7 +606,7 @@ void JAVA::create_function(char *name, char *iname, DataType *t, ParmList *l)
|
|||
Printv(javaParameterSignature, JavaMethodSignature(pt, 0, 0), 0);
|
||||
}
|
||||
|
||||
if(p->ignore) continue;
|
||||
if(Parm_Getignore(p)) continue;
|
||||
|
||||
// Add to java function header
|
||||
if(shadow && member_func) {
|
||||
|
|
@ -643,7 +643,7 @@ void JAVA::create_function(char *name, char *iname, DataType *t, ParmList *l)
|
|||
Printv(f->code, tab4, target, " = (", source, ") ? (char *)", JNICALL((char*)"GetStringUTFChars"), source, ", 0) : NULL;\n", 0);
|
||||
} else {
|
||||
char *scalarType = SwigTcToJniScalarType(pt);
|
||||
char *cptrtype = DataType_lstr(pt,0);
|
||||
|
||||
pt->is_pointer--;
|
||||
const char *basic_jnitype = (pt->is_pointer > 0) ? "jlong" : SwigTcToJniType(pt, 0);
|
||||
char *ctype = DataType_lstr(pt,0);
|
||||
|
|
@ -707,7 +707,7 @@ void JAVA::create_function(char *name, char *iname, DataType *t, ParmList *l)
|
|||
// nothing to do
|
||||
} else {
|
||||
char *scalarType = SwigTcToJniScalarType(pt);
|
||||
char *cptrtype = DataType_lstr(pt,0);
|
||||
|
||||
pt->is_pointer--;
|
||||
const char *basic_jnitype = (pt->is_pointer > 0) ? "jlong" : SwigTcToJniType(pt, 0);
|
||||
char *ctype = DataType_lstr(pt,0);
|
||||
|
|
|
|||
|
|
@ -38,8 +38,6 @@ Mzscheme Options (available with -mzscheme)\n\
|
|||
static char *mzscheme_path = (char*)"mzscheme";
|
||||
static char *prefix = 0;
|
||||
static char *module = 0;
|
||||
static char *package = (char*)"";
|
||||
static int linkage = 0;
|
||||
|
||||
static DOHString *init_func_def = 0;
|
||||
|
||||
|
|
@ -202,18 +200,6 @@ MZSCHEME::headers (void)
|
|||
void
|
||||
MZSCHEME::initialize (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
#ifdef OLD_STYLE_WILL_GO_AWAY
|
||||
if (InitNames) {
|
||||
i = 0;
|
||||
while (InitNames[i]) {
|
||||
Printf(f_init,"\t %s();\n",InitNames[i]);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
#endif /* OLD_STYLE_WILL_GO_AWAY */
|
||||
|
||||
Printf (f_init, "static void\nSWIG_init (void)\n{\n");
|
||||
}
|
||||
|
||||
|
|
@ -289,14 +275,14 @@ throw_unhandled_mzscheme_type_error (DataType *d)
|
|||
void
|
||||
MZSCHEME::create_function (char *name, char *iname, DataType *d, ParmList *l)
|
||||
{
|
||||
Parm *p;
|
||||
|
||||
char source[256], target[256], argnum[256], arg[256];
|
||||
char *tm;
|
||||
Wrapper *f;
|
||||
DOHString *cleanup = 0;
|
||||
DOHString *proc_name = 0;
|
||||
int need_len = 0;
|
||||
int need_tempc = 0;
|
||||
|
||||
|
||||
DOHString *outarg = 0;
|
||||
int argout_set = 0;
|
||||
|
||||
|
|
@ -325,7 +311,7 @@ MZSCHEME::create_function (char *name, char *iname, DataType *d, ParmList *l)
|
|||
|
||||
int pcount = emit_args (d, l, f);
|
||||
int numargs = 0;
|
||||
int numopt = 0;
|
||||
|
||||
|
||||
// adds local variables : type name
|
||||
Wrapper_add_local (f,"_tempc","char *_tempc");
|
||||
|
|
@ -349,7 +335,7 @@ MZSCHEME::create_function (char *name, char *iname, DataType *d, ParmList *l)
|
|||
|
||||
// Handle parameter types.
|
||||
|
||||
if (p->ignore)
|
||||
if (Parm_Getignore(p))
|
||||
Printv(f->code, "/* ", pn, " ignored... */\n", 0);
|
||||
else {
|
||||
++numargs;
|
||||
|
|
@ -694,7 +680,7 @@ MZSCHEME::usage_var (char *iname, DataType *t, DOHString *usage)
|
|||
void
|
||||
MZSCHEME::usage_func (char *iname, DataType *d, ParmList *l, DOHString *usage)
|
||||
{
|
||||
int i;
|
||||
|
||||
Parm *p;
|
||||
|
||||
// Print the function name.
|
||||
|
|
@ -707,7 +693,7 @@ MZSCHEME::usage_func (char *iname, DataType *d, ParmList *l, DOHString *usage)
|
|||
DataType *pt = Parm_Gettype(p);
|
||||
char *pn = Parm_Getname(p);
|
||||
|
||||
if (p->ignore)
|
||||
if (Parm_Getignore(p))
|
||||
continue;
|
||||
|
||||
// Print the type. If the parameter has been named, use that as well.
|
||||
|
|
|
|||
|
|
@ -782,7 +782,6 @@ void PERL5::create_function(char *name, char *iname, DataType *d, ParmList *l)
|
|||
while (p != 0) {
|
||||
DataType *pt = Parm_Gettype(p);
|
||||
char *pn = Parm_Getname(p);
|
||||
char *pv = Parm_Getvalue(p);
|
||||
|
||||
// Produce string representation of source and target arguments
|
||||
sprintf(source,"ST(%d)",j);
|
||||
|
|
@ -791,7 +790,7 @@ void PERL5::create_function(char *name, char *iname, DataType *d, ParmList *l)
|
|||
|
||||
// Check to see if this argument is being ignored
|
||||
|
||||
if (!p->ignore) {
|
||||
if (!Parm_Getignore(p)) {
|
||||
|
||||
// If there are optional arguments, check for this
|
||||
|
||||
|
|
@ -817,9 +816,6 @@ void PERL5::create_function(char *name, char *iname, DataType *d, ParmList *l)
|
|||
case T_INT :
|
||||
case T_SHORT :
|
||||
case T_LONG :
|
||||
case T_SINT :
|
||||
case T_SSHORT:
|
||||
case T_SLONG:
|
||||
case T_SCHAR:
|
||||
case T_UINT:
|
||||
case T_USHORT:
|
||||
|
|
@ -850,6 +846,12 @@ void PERL5::create_function(char *name, char *iname, DataType *d, ParmList *l)
|
|||
|
||||
case T_USER:
|
||||
|
||||
pt->is_pointer++;
|
||||
sprintf(temp,"argument %d", i+1);
|
||||
get_pointer(iname, temp, source, target, pt, f->code, (char *)"XSRETURN(1)");
|
||||
pt->is_pointer--;
|
||||
break;
|
||||
|
||||
// Unsupported data type
|
||||
|
||||
default :
|
||||
|
|
@ -907,7 +909,7 @@ void PERL5::create_function(char *name, char *iname, DataType *d, ParmList *l)
|
|||
}
|
||||
// If we needed a saved variable, we need to emit to emit some code for that
|
||||
// This only applies if the argument actually existed (not ignore)
|
||||
if ((need_save) && (!p->ignore)) {
|
||||
if ((need_save) && (!Parm_Getignore(p))) {
|
||||
Printv(f->code, tab4, temp, " = ", source, ";\n", 0);
|
||||
num_saved++;
|
||||
}
|
||||
|
|
@ -936,9 +938,9 @@ void PERL5::create_function(char *name, char *iname, DataType *d, ParmList *l)
|
|||
// Function returns a "value"
|
||||
Printf(f->code," ST(argvi) = sv_newmortal();\n");
|
||||
switch(d->type) {
|
||||
case T_INT: case T_BOOL: case T_SINT: case T_UINT:
|
||||
case T_SHORT: case T_SSHORT: case T_USHORT:
|
||||
case T_LONG : case T_SLONG : case T_ULONG:
|
||||
case T_INT: case T_BOOL: case T_UINT:
|
||||
case T_SHORT: case T_USHORT:
|
||||
case T_LONG : case T_ULONG:
|
||||
case T_SCHAR: case T_UCHAR :
|
||||
Printf(f->code," sv_setiv(ST(argvi++),(IV) result);\n");
|
||||
break;
|
||||
|
|
@ -1057,8 +1059,8 @@ void PERL5::create_function(char *name, char *iname, DataType *d, ParmList *l)
|
|||
int i = 0;
|
||||
while(p) {
|
||||
DataType *pt = Parm_Gettype(p);
|
||||
char *pn = Parm_Getname(p);
|
||||
if (!p->ignore) {
|
||||
|
||||
if (!Parm_Getignore(p)) {
|
||||
// Look up the datatype name here
|
||||
char sourceNtarget[256];
|
||||
sprintf(sourceNtarget,"$args[%d]",i);
|
||||
|
|
@ -1184,9 +1186,9 @@ void PERL5::link_variable(char *name, char *iname, DataType *t)
|
|||
// Set the value to something
|
||||
|
||||
switch(t->type) {
|
||||
case T_INT : case T_BOOL: case T_SINT : case T_UINT:
|
||||
case T_SHORT : case T_SSHORT : case T_USHORT:
|
||||
case T_LONG : case T_SLONG : case T_ULONG:
|
||||
case T_INT : case T_BOOL: case T_UINT:
|
||||
case T_SHORT : case T_USHORT:
|
||||
case T_LONG : case T_ULONG:
|
||||
case T_UCHAR: case T_SCHAR:
|
||||
Printv(setf->code,tab4, name, " = (", DataType_str(t,0), ") SvIV(sv);\n", 0);
|
||||
break;
|
||||
|
|
@ -1263,9 +1265,9 @@ void PERL5::link_variable(char *name, char *iname, DataType *t)
|
|||
} else {
|
||||
if (!t->is_pointer) {
|
||||
switch(t->type) {
|
||||
case T_INT : case T_BOOL: case T_SINT: case T_UINT:
|
||||
case T_SHORT : case T_SSHORT: case T_USHORT:
|
||||
case T_LONG : case T_SLONG : case T_ULONG:
|
||||
case T_INT : case T_BOOL: case T_UINT:
|
||||
case T_SHORT : case T_USHORT:
|
||||
case T_LONG : case T_ULONG:
|
||||
case T_UCHAR: case T_SCHAR:
|
||||
Printv(getf->code,tab4, "sv_setiv(sv, (IV) ", name, ");\n", 0);
|
||||
Printv(vinit, tab4, "sv_setiv(sv,(IV)", name, ");\n",0);
|
||||
|
|
@ -1432,9 +1434,9 @@ PERL5::declare_const(char *name, char *, DataType *type, char *value)
|
|||
// Generate a constant
|
||||
if (type->is_pointer == 0) {
|
||||
switch(type->type) {
|
||||
case T_INT:case T_SINT: case T_UINT: case T_BOOL:
|
||||
case T_SHORT: case T_SSHORT: case T_USHORT:
|
||||
case T_LONG: case T_SLONG: case T_ULONG:
|
||||
case T_INT: case T_UINT: case T_BOOL:
|
||||
case T_SHORT: case T_USHORT:
|
||||
case T_LONG: case T_ULONG:
|
||||
case T_SCHAR: case T_UCHAR:
|
||||
if (!have_int_func) {
|
||||
Printf(f_header,"%s\n",setiv);
|
||||
|
|
@ -1537,7 +1539,7 @@ char *PERL5::usage_func(char *iname, DataType *, ParmList *l) {
|
|||
while (p != 0) {
|
||||
DataType *pt = Parm_Gettype(p);
|
||||
char *pn = Parm_Getname(p);
|
||||
if (!p->ignore) {
|
||||
if (!Parm_Getignore(p)) {
|
||||
/* If parameter has been named, use that. Otherwise, just print a type */
|
||||
|
||||
if ((pt->type != T_VOID) || (pt->is_pointer)) {
|
||||
|
|
@ -1550,12 +1552,12 @@ char *PERL5::usage_func(char *iname, DataType *, ParmList *l) {
|
|||
i++;
|
||||
p = ParmList_next(l);
|
||||
if (p)
|
||||
if (!p->ignore)
|
||||
if (!Parm_Getignore(p))
|
||||
Putc(',',temp);
|
||||
} else {
|
||||
p = ParmList_next(l);
|
||||
if (p)
|
||||
if ((i>0) && (!p->ignore))
|
||||
if ((i>0) && (!Parm_Getignore(p)))
|
||||
Putc(',',temp);
|
||||
}
|
||||
}
|
||||
|
|
@ -1895,7 +1897,7 @@ void PERL5::cpp_member_func(char *name, char *iname, DataType *t, ParmList *l) {
|
|||
i = 1;
|
||||
while(p) {
|
||||
DataType *pt = Parm_Gettype(p);
|
||||
if (!p->ignore) {
|
||||
if (!Parm_Getignore(p)) {
|
||||
char sourceNtarget[512];
|
||||
sprintf(sourceNtarget, "$args[%d]", i);
|
||||
|
||||
|
|
|
|||
|
|
@ -41,11 +41,9 @@ static DOHString *shadow_methods = 0;
|
|||
|
||||
static char *module = 0; // Module name
|
||||
static char *path = (char*)"python"; // Pathname of where to look for library files
|
||||
static char *methods; // Method table name
|
||||
static char *global_name = (char*)"cvar"; // Name of global variables.
|
||||
static int shadow = 0;
|
||||
static int have_defarg = 0;
|
||||
static int docstring;
|
||||
static int have_output;
|
||||
static int use_kw = 0;
|
||||
static int noopt = 1;
|
||||
|
|
@ -377,7 +375,7 @@ void PYTHON::initialize(void)
|
|||
// ---------------------------------------------------------------------
|
||||
void PYTHON::initialize_cmodule(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
Printf(f_header,"#define SWIG_init init%s\n\n", module);
|
||||
Printf(f_header,"#define SWIG_name \"%s\"\n", module);
|
||||
|
||||
|
|
@ -696,7 +694,7 @@ void PYTHON::create_function(char *name, char *iname, DataType *d, ParmList *l)
|
|||
|
||||
// Only consider this argument if it's not ignored
|
||||
|
||||
if (!p->ignore) {
|
||||
if (!Parm_Getignore(p)) {
|
||||
Putc(',',arglist);
|
||||
// Add an optional argument separator if needed
|
||||
|
||||
|
|
@ -735,13 +733,13 @@ void PYTHON::create_function(char *name, char *iname, DataType *d, ParmList *l)
|
|||
// case if you appropriate cast things. However, if you have
|
||||
// special cases, you'll need to add more code.
|
||||
|
||||
case T_INT : case T_UINT: case T_SINT:
|
||||
case T_INT : case T_UINT:
|
||||
Putc('i',parse_args);
|
||||
break;
|
||||
case T_SHORT: case T_USHORT: case T_SSHORT:
|
||||
case T_SHORT: case T_USHORT:
|
||||
Putc('h',parse_args);
|
||||
break;
|
||||
case T_LONG : case T_ULONG: case T_SLONG :
|
||||
case T_LONG : case T_ULONG:
|
||||
Putc('l',parse_args);
|
||||
break;
|
||||
case T_SCHAR : case T_UCHAR :
|
||||
|
|
@ -892,13 +890,13 @@ void PYTHON::create_function(char *name, char *iname, DataType *d, ParmList *l)
|
|||
|
||||
// Return an integer type
|
||||
|
||||
case T_INT: case T_SINT: case T_UINT: case T_BOOL:
|
||||
case T_INT: case T_UINT: case T_BOOL:
|
||||
Printf(f->code," resultobj = Py_BuildValue(\"i\",result);\n");
|
||||
break;
|
||||
case T_SHORT: case T_SSHORT: case T_USHORT:
|
||||
case T_SHORT: case T_USHORT:
|
||||
Printf(f->code," resultobj = Py_BuildValue(\"h\",result);\n");
|
||||
break;
|
||||
case T_LONG : case T_SLONG : case T_ULONG:
|
||||
case T_LONG : case T_ULONG:
|
||||
Printf(f->code," resultobj = Py_BuildValue(\"l\",result);\n");
|
||||
break;
|
||||
case T_SCHAR: case T_UCHAR :
|
||||
|
|
@ -1009,7 +1007,7 @@ void PYTHON::create_function(char *name, char *iname, DataType *d, ParmList *l)
|
|||
|
||||
int need_wrapper = 0;
|
||||
int munge_return = 0;
|
||||
int have_optional = 0;
|
||||
|
||||
|
||||
// Check return code for modification
|
||||
if ((Getattr(hash,d->name)) && (d->is_pointer <=1)) {
|
||||
|
|
@ -1118,7 +1116,6 @@ void PYTHON::link_variable(char *name, char *iname, DataType *t) {
|
|||
switch(t->type) {
|
||||
case T_INT: case T_SHORT: case T_LONG :
|
||||
case T_UINT: case T_USHORT: case T_ULONG:
|
||||
case T_SINT: case T_SSHORT: case T_SLONG:
|
||||
case T_SCHAR: case T_UCHAR: case T_BOOL:
|
||||
// Get an integer value
|
||||
Wrapper_add_localv(setf,"tval",DataType_lstr(t,0),"tval",0);
|
||||
|
|
@ -1244,9 +1241,9 @@ void PYTHON::link_variable(char *name, char *iname, DataType *t) {
|
|||
|
||||
/* Is a normal datatype */
|
||||
switch(t->type) {
|
||||
case T_INT: case T_SINT: case T_UINT:
|
||||
case T_SHORT: case T_SSHORT: case T_USHORT:
|
||||
case T_LONG: case T_SLONG: case T_ULONG:
|
||||
case T_INT: case T_UINT:
|
||||
case T_SHORT: case T_USHORT:
|
||||
case T_LONG: case T_ULONG:
|
||||
case T_SCHAR: case T_UCHAR: case T_BOOL:
|
||||
Printv(getf->code, tab4, "pyobj = PyInt_FromLong((long) ", name, ");\n", 0);
|
||||
break;
|
||||
|
|
@ -1344,9 +1341,9 @@ void PYTHON::declare_const(char *name, char *, DataType *type, char *value) {
|
|||
|
||||
if (type->is_pointer == 0) {
|
||||
switch(type->type) {
|
||||
case T_INT:case T_SINT: case T_UINT: case T_BOOL:
|
||||
case T_SHORT: case T_SSHORT: case T_USHORT:
|
||||
case T_LONG: case T_SLONG: case T_ULONG:
|
||||
case T_INT: case T_UINT: case T_BOOL:
|
||||
case T_SHORT: case T_USHORT:
|
||||
case T_LONG: case T_ULONG:
|
||||
case T_SCHAR: case T_UCHAR:
|
||||
Printv(const_code, tab4, "{ SWIG_PY_INT, \"", name, "\", (long) ", value, ", 0, 0, 0},\n", 0);
|
||||
break;
|
||||
|
|
@ -1424,7 +1421,7 @@ char *PYTHON::usage_func(char *iname, DataType *, ParmList *l) {
|
|||
while (p != 0) {
|
||||
DataType *pt = Parm_Gettype(p);
|
||||
char *pn = Parm_Getname(p);
|
||||
if (!p->ignore) {
|
||||
if (!Parm_Getignore(p)) {
|
||||
i++;
|
||||
/* If parameter has been named, use that. Otherwise, just print a type */
|
||||
|
||||
|
|
@ -1437,13 +1434,13 @@ char *PYTHON::usage_func(char *iname, DataType *, ParmList *l) {
|
|||
}
|
||||
p = ParmList_next(l);
|
||||
if (p != 0) {
|
||||
if (!p->ignore)
|
||||
if (!Parm_Getignore(p))
|
||||
Putc(',',temp);
|
||||
}
|
||||
} else {
|
||||
p = ParmList_next(l);
|
||||
if (p) {
|
||||
if ((!p->ignore) && (i > 0))
|
||||
if ((!Parm_Getignore(p)) && (i > 0))
|
||||
Putc(',',temp);
|
||||
}
|
||||
}
|
||||
|
|
@ -1721,13 +1718,9 @@ void PYTHON::cpp_open_class(char *classname, char *rname, char *ctype, int strip
|
|||
|
||||
void PYTHON::cpp_member_func(char *name, char *iname, DataType *t, ParmList *l) {
|
||||
|
||||
Parm *p;
|
||||
int i;
|
||||
char *realname;
|
||||
int oldshadow;
|
||||
int pcount;
|
||||
int numopt;
|
||||
int have_optional;
|
||||
|
||||
|
||||
char cname[1024];
|
||||
|
||||
|
|
@ -1802,12 +1795,8 @@ void PYTHON::cpp_member_func(char *name, char *iname, DataType *t, ParmList *l)
|
|||
|
||||
void PYTHON::cpp_constructor(char *name, char *iname, ParmList *l) {
|
||||
char *realname;
|
||||
Parm *p;
|
||||
int i;
|
||||
int oldshadow = shadow;
|
||||
char cname[1024];
|
||||
int pcount, numopt;
|
||||
int have_optional;
|
||||
|
||||
if (shadow) shadow = shadow | PYSHADOW_MEMBER;
|
||||
this->Language::cpp_constructor(name,iname,l);
|
||||
|
|
|
|||
|
|
@ -429,7 +429,7 @@ void RUBY::create_function(char *name, char *iname, DataType *t, ParmList *l) {
|
|||
// Get number of arguments
|
||||
int numarg = ParmList_numarg(l);
|
||||
int numopt = check_numopt(l);
|
||||
int numignore = l->nparms - numarg;
|
||||
|
||||
int start = 0;
|
||||
int use_self = 0;
|
||||
switch (current) {
|
||||
|
|
@ -444,7 +444,7 @@ void RUBY::create_function(char *name, char *iname, DataType *t, ParmList *l) {
|
|||
int numreq = 0;
|
||||
int numoptreal = 0;
|
||||
for (i = start; i < l->nparms; i++) {
|
||||
if (!ParmList_get(l,i)->ignore) {
|
||||
if (!Parm_Getignore(ParmList_get(l,i))) {
|
||||
if (i >= l->nparms - numopt) numoptreal++;
|
||||
else numreq++;
|
||||
}
|
||||
|
|
@ -458,7 +458,7 @@ void RUBY::create_function(char *name, char *iname, DataType *t, ParmList *l) {
|
|||
} else {
|
||||
Printv(f->def, "VALUE self", 0);
|
||||
for (i = start; i < l->nparms; i++) {
|
||||
if (!ParmList_get(l,i)->ignore) {
|
||||
if (!Parm_Getignore(ParmList_get(l,i))) {
|
||||
Printf(f->def,", VALUE varg%d", i);
|
||||
}
|
||||
}
|
||||
|
|
@ -468,7 +468,7 @@ 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 < l->nparms; i++) {
|
||||
if (!ParmList_get(l,i)->ignore) {
|
||||
if (!Parm_Getignore(ParmList_get(l,i))) {
|
||||
char s[256];
|
||||
sprintf(s,"varg%d",i);
|
||||
Wrapper_add_localv(f,s,"VALUE",s,0);
|
||||
|
|
@ -498,7 +498,7 @@ void RUBY::create_function(char *name, char *iname, DataType *t, ParmList *l) {
|
|||
if (vararg) {
|
||||
Printf(f->code," rb_scan_args(argc, argv, \"%d%d\"", (numarg-numoptreal), numoptreal);
|
||||
for (i = start; i < l->nparms; i++) {
|
||||
if (!ParmList_get(l,i)->ignore) {
|
||||
if (!Parm_Getignore(ParmList_get(l,i))) {
|
||||
Printf(f->code,", &varg%d", i);
|
||||
}
|
||||
}
|
||||
|
|
@ -523,7 +523,7 @@ void RUBY::create_function(char *name, char *iname, DataType *t, ParmList *l) {
|
|||
|
||||
sprintf(target,"%s", Parm_Getlname(p));
|
||||
|
||||
if (!p->ignore) {
|
||||
if (!Parm_Getignore(p)) {
|
||||
char *tab = (char*)tab4;
|
||||
if (j >= (pcount-numopt)) { // Check if parsing an optional argument
|
||||
Printf(f->code," if (argc > %d) {\n", j - start);
|
||||
|
|
@ -934,9 +934,9 @@ int RUBY::to_VALUE(DataType *type, char *value, DOHString *str, int raw) {
|
|||
Clear(str);
|
||||
if (type->is_pointer == 0) {
|
||||
switch(type->type) {
|
||||
case T_INT:case T_SINT:
|
||||
case T_SHORT: case T_SSHORT:
|
||||
case T_LONG: case T_SLONG:
|
||||
case T_INT:
|
||||
case T_SHORT:
|
||||
case T_LONG:
|
||||
case T_SCHAR:
|
||||
Printv(str, "INT2NUM(", value, ")", 0);
|
||||
break;
|
||||
|
|
@ -985,13 +985,13 @@ int RUBY::from_VALUE(DataType *type, char *value, DOHString *str) {
|
|||
Clear(str);
|
||||
if (type->is_pointer == 0) {
|
||||
switch(type->type) {
|
||||
case T_INT:case T_SINT:
|
||||
case T_INT:
|
||||
Printv(str, "NUM2INT(", value, ")", 0);
|
||||
break;
|
||||
case T_LONG: case T_SLONG:
|
||||
case T_LONG:
|
||||
Printv(str, "NUM2LONG(", value, ")", 0);
|
||||
break;
|
||||
case T_SHORT: case T_SSHORT:
|
||||
case T_SHORT:
|
||||
Printv(str, "NUM2SHRT(", value, ")", 0);
|
||||
break;
|
||||
case T_UINT:
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ static char cvsroot[] = "$Header$";
|
|||
#include "tcl8.h"
|
||||
#include <ctype.h>
|
||||
|
||||
static char *Tcl_config=(char*)"swigtcl.swg";
|
||||
|
||||
static char *usage = (char*)"\
|
||||
Tcl 8.0 Options (available with -tcl)\n\
|
||||
-module name - Set name of module\n\
|
||||
|
|
@ -54,7 +54,6 @@ static int shadow = 1;
|
|||
static char *tcl_path = (char*)"tcl";
|
||||
static char interp_name[256] = "interp";
|
||||
static char *init_name = 0;
|
||||
static char *char_result = (char *)"TCL_VOLATILE";
|
||||
|
||||
static int have_constructor;
|
||||
static int have_destructor;
|
||||
|
|
@ -510,7 +509,7 @@ void TCL8::create_function(char *name, char *iname, DataType *d, ParmList *l)
|
|||
while (p != 0) {
|
||||
DataType *pt = Parm_Gettype(p);
|
||||
char *pn = Parm_Getname(p);
|
||||
char *pv = Parm_Getvalue(p);
|
||||
|
||||
// Produce string representations of the source and target arguments
|
||||
sprintf(source,"objv[%d]",j+1);
|
||||
sprintf(target,"%s", Parm_Getlname(p));
|
||||
|
|
@ -518,7 +517,7 @@ void TCL8::create_function(char *name, char *iname, DataType *d, ParmList *l)
|
|||
|
||||
// See if this argument is being ignored
|
||||
|
||||
if (!p->ignore) {
|
||||
if (!Parm_Getignore(p)) {
|
||||
if (j == (pcount-numopt))
|
||||
Putc('|',argstr);
|
||||
|
||||
|
|
@ -540,7 +539,6 @@ void TCL8::create_function(char *name, char *iname, DataType *d, ParmList *l)
|
|||
// Signed Integers
|
||||
|
||||
case T_INT:
|
||||
case T_SINT:
|
||||
case T_UINT:
|
||||
Putc('i', argstr);
|
||||
Printf(args,",&%s",target);
|
||||
|
|
@ -556,13 +554,11 @@ void TCL8::create_function(char *name, char *iname, DataType *d, ParmList *l)
|
|||
}
|
||||
break;
|
||||
case T_SHORT:
|
||||
case T_SSHORT:
|
||||
case T_USHORT:
|
||||
Putc('h',argstr);
|
||||
Printf(args,",&%s",target);
|
||||
break;
|
||||
case T_LONG:
|
||||
case T_SLONG:
|
||||
case T_ULONG:
|
||||
Putc('l',argstr);
|
||||
Printf(args,",&%s",target);
|
||||
|
|
@ -598,6 +594,13 @@ void TCL8::create_function(char *name, char *iname, DataType *d, ParmList *l)
|
|||
// User defined. This is an error.
|
||||
|
||||
case T_USER:
|
||||
pt->is_pointer++;
|
||||
DataType_remember(pt);
|
||||
Putc('p',argstr);
|
||||
Printv(args, ",&", target, ", SWIGTYPE", DataType_manglestr(pt), 0);
|
||||
pt->is_pointer--;
|
||||
break;
|
||||
|
||||
// Unsupported data type
|
||||
|
||||
default :
|
||||
|
|
@ -672,11 +675,8 @@ void TCL8::create_function(char *name, char *iname, DataType *d, ParmList *l)
|
|||
// Is an integer
|
||||
case T_BOOL:
|
||||
case T_INT:
|
||||
case T_SINT:
|
||||
case T_SHORT:
|
||||
case T_SSHORT:
|
||||
case T_LONG :
|
||||
case T_SLONG:
|
||||
case T_SCHAR:
|
||||
case T_UINT:
|
||||
case T_USHORT:
|
||||
|
|
@ -815,12 +815,9 @@ void TCL8::link_variable(char *name, char *iname, DataType *t)
|
|||
if (!t->is_pointer) {
|
||||
switch(t->type) {
|
||||
case T_INT:
|
||||
case T_SINT:
|
||||
case T_SHORT:
|
||||
case T_USHORT:
|
||||
case T_SSHORT:
|
||||
case T_LONG:
|
||||
case T_SLONG:
|
||||
case T_UCHAR:
|
||||
case T_SCHAR:
|
||||
case T_BOOL:
|
||||
|
|
@ -882,14 +879,11 @@ void TCL8::link_variable(char *name, char *iname, DataType *t)
|
|||
if (!t->is_pointer) {
|
||||
switch(t->type) {
|
||||
case T_INT:
|
||||
case T_SINT:
|
||||
case T_UINT:
|
||||
case T_SHORT:
|
||||
case T_USHORT:
|
||||
case T_SSHORT:
|
||||
case T_LONG:
|
||||
case T_ULONG:
|
||||
case T_SLONG:
|
||||
case T_UCHAR:
|
||||
case T_SCHAR:
|
||||
case T_BOOL:
|
||||
|
|
@ -1006,15 +1000,13 @@ void TCL8::declare_const(char *name, char *, DataType *type, char *value) {
|
|||
|
||||
if (type->is_pointer == 0) {
|
||||
switch(type->type) {
|
||||
case T_BOOL: case T_INT: case T_SINT: case T_DOUBLE:
|
||||
case T_BOOL: case T_INT: case T_DOUBLE:
|
||||
Printf(f_header,"static %s %s = %s;\n", DataType_str(type,0), var_name, value);
|
||||
link_variable(var_name,name,type);
|
||||
break;
|
||||
case T_SHORT:
|
||||
case T_LONG:
|
||||
case T_SSHORT:
|
||||
case T_SCHAR:
|
||||
case T_SLONG:
|
||||
Printf(f_header,"static %s %s = %s;\n", DataType_str(type,0), var_name, value);
|
||||
Printf(f_header,"static char *%s_char;\n", var_name);
|
||||
if (CPlusPlus)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue