Fixed handling of char types.
Added support for optional arguments. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@739 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
c883555fb3
commit
d5431492ae
3 changed files with 16 additions and 3 deletions
|
|
@ -45,6 +45,13 @@ GSWIG_scm2str (SCM s)
|
||||||
return gh_scm2newstr (s, &len);
|
return gh_scm2newstr (s, &len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char
|
||||||
|
GSWIG_scm2char (SCM s)
|
||||||
|
{
|
||||||
|
if (SCM_CHARP(s)) return SCM_CHAR(s);
|
||||||
|
scm_wrong_type_arg(NULL, 0, s);
|
||||||
|
}
|
||||||
|
|
||||||
typedef struct SwigPtrType SwigPtrType;
|
typedef struct SwigPtrType SwigPtrType;
|
||||||
|
|
||||||
typedef struct _swig_type_info {
|
typedef struct _swig_type_info {
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,8 @@
|
||||||
%enddef
|
%enddef
|
||||||
|
|
||||||
SIMPLE_MAP(bool, gh_scm2bool, gh_bool2scm, boolean);
|
SIMPLE_MAP(bool, gh_scm2bool, gh_bool2scm, boolean);
|
||||||
SIMPLE_MAP(char, gh_scm2char, gh_char2scm, char);
|
SIMPLE_MAP(char, GSWIG_scm2char, gh_char2scm, char);
|
||||||
SIMPLE_MAP(unsigned char, gh_scm2char, gh_char2scm, char);
|
SIMPLE_MAP(unsigned char, GSWIG_scm2char, gh_char2scm, char);
|
||||||
SIMPLE_MAP(int, gh_scm2int, gh_int2scm, integer);
|
SIMPLE_MAP(int, gh_scm2int, gh_int2scm, integer);
|
||||||
SIMPLE_MAP(short, gh_scm2int, gh_int2scm, integer);
|
SIMPLE_MAP(short, gh_scm2int, gh_int2scm, integer);
|
||||||
SIMPLE_MAP(long, gh_scm2long, gh_long2scm, integer);
|
SIMPLE_MAP(long, gh_scm2long, gh_long2scm, integer);
|
||||||
|
|
|
||||||
|
|
@ -474,6 +474,7 @@ GUILE::create_function (char *name, char *iname, SwigType *d, ParmList *l)
|
||||||
int i;
|
int i;
|
||||||
int numargs = 0;
|
int numargs = 0;
|
||||||
int numopt = 0;
|
int numopt = 0;
|
||||||
|
int pcount = 0;
|
||||||
|
|
||||||
// Make a wrapper name for this
|
// Make a wrapper name for this
|
||||||
char * wname = new char [strlen (prefix) + strlen (iname) + 2];
|
char * wname = new char [strlen (prefix) + strlen (iname) + 2];
|
||||||
|
|
@ -484,7 +485,8 @@ GUILE::create_function (char *name, char *iname, SwigType *d, ParmList *l)
|
||||||
Replace(proc_name,"_", "-", DOH_REPLACE_ANY);
|
Replace(proc_name,"_", "-", DOH_REPLACE_ANY);
|
||||||
|
|
||||||
/* Emit locals etc. into f->code; figure out which args to ignore */
|
/* Emit locals etc. into f->code; figure out which args to ignore */
|
||||||
emit_args (d, l, f);
|
pcount = emit_args (d, l, f);
|
||||||
|
numopt = check_numopt(l);
|
||||||
|
|
||||||
/* Declare return variable */
|
/* Declare return variable */
|
||||||
|
|
||||||
|
|
@ -516,6 +518,8 @@ GUILE::create_function (char *name, char *iname, SwigType *d, ParmList *l)
|
||||||
else {
|
else {
|
||||||
if (numargs!=0) Printf(f->def,", ");
|
if (numargs!=0) Printf(f->def,", ");
|
||||||
Printf(f->def,"SCM s_%d", i);
|
Printf(f->def,"SCM s_%d", i);
|
||||||
|
if (i>=(pcount-numopt))
|
||||||
|
Printf(f->code," if (s_%d != GH_NOT_PASSED) {\n", i);
|
||||||
++numargs;
|
++numargs;
|
||||||
if (guile_do_typemap(f->code, "in", pt, pn,
|
if (guile_do_typemap(f->code, "in", pt, pn,
|
||||||
source, target, numargs, proc_name, f, 0)) {
|
source, target, numargs, proc_name, f, 0)) {
|
||||||
|
|
@ -533,6 +537,8 @@ GUILE::create_function (char *name, char *iname, SwigType *d, ParmList *l)
|
||||||
guile_do_doc_typemap(signature, "indoc", pt, pn,
|
guile_do_doc_typemap(signature, "indoc", pt, pn,
|
||||||
numargs, proc_name, f);
|
numargs, proc_name, f);
|
||||||
}
|
}
|
||||||
|
if (i>=(pcount-numopt))
|
||||||
|
Printf(f->code," }\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if there are any constraints. */
|
/* Check if there are any constraints. */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue