Incorporated patch #101430, fixing bugs in the Guile module.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@852 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Matthias Köppe 2000-09-18 09:35:36 +00:00
parent 92ae5e5161
commit e867ed25a8
4 changed files with 26 additions and 6 deletions

View File

@ -3,6 +3,14 @@ SWIG (Simplified Wrapper and Interface Generator)
Version 1.3 Alpha 5
===================
9/18/00 : mkoeppe
Incorporated patch #101430, fixing bugs in the Guile module:
1. Some arguments were erroneously taken as *optional* arguments when
ignored arguments were present.
2. Guile 1.3.4 was not supported since functions introduced in Guile
1.4 were used.
3. Added handling of `const char *'.
9/17/00 : beazley
Fixed problem with failed assertion and large files.

View File

@ -44,6 +44,15 @@ GSWIG_scm2str (SCM s)
return gh_scm2newstr (s, NULL);
}
/* SCM_CHAR and SCM_CHARP were introduced in Guile 1.4; the following is for
1.3.4 compatibility. */
#ifndef SCM_CHAR
# define SCM_CHAR SCM_ICHR
#endif
#ifndef SCM_CHARP
# define SCM_CHARP SCM_ICHRP
#endif
/* This function replaces gh_scm2char, which is broken in Guile 1.4 */
static char
GSWIG_scm2char (SCM s)

View File

@ -42,11 +42,12 @@
SIMPLE_MAP(float, gh_scm2double, gh_double2scm, real);
SIMPLE_MAP(double, gh_scm2double, gh_double2scm, real);
SIMPLE_MAP(char *, GSWIG_scm2str, gh_str02scm, string);
SIMPLE_MAP(const char *, GSWIG_scm2str, gh_str02scm, string);
/* GSWIG_scm2str makes a malloc'ed copy of the string, so get rid of it after
the function call. */
%typemap (guile, freearg) char * "if ($target) scm_must_free($target);";
%typemap (guile, freearg) char *, const char * "if ($target) scm_must_free($target);";
/* Void */

View File

@ -483,7 +483,6 @@ GUILE::create_function (char *name, char *iname, SwigType *d, ParmList *l)
int i;
int numargs = 0;
int numopt = 0;
int pcount = 0;
// Make a wrapper name for this
char * wname = new char [strlen (prefix) + strlen (iname) + 2];
@ -494,8 +493,7 @@ GUILE::create_function (char *name, char *iname, SwigType *d, ParmList *l)
Replace(proc_name,"_", "-", DOH_REPLACE_ANY);
/* Emit locals etc. into f->code; figure out which args to ignore */
pcount = emit_args (d, l, f);
numopt = check_numopt(l);
emit_args (d, l, f);
/* Declare return variable */
@ -515,6 +513,8 @@ GUILE::create_function (char *name, char *iname, SwigType *d, ParmList *l)
for (p = l, i = 0; p; p=Getnext(p), i++) {
SwigType *pt = Gettype(p);
String *pn = Getname(p);
int opt_p = (Getvalue(p)
|| Swig_typemap_search((char*)"default",pt,pn));
// Produce names of source and target
sprintf(source,"s_%d",i);
@ -527,8 +527,10 @@ GUILE::create_function (char *name, char *iname, SwigType *d, ParmList *l)
else {
if (numargs!=0) Printf(f->def,", ");
Printf(f->def,"SCM s_%d", i);
if (i>=(pcount-numopt))
if (opt_p) {
numopt++;
Printf(f->code," if (s_%d != GH_NOT_PASSED) {\n", i);
}
++numargs;
if (guile_do_typemap(f->code, "in", pt, pn,
source, target, numargs, proc_name, f, 0)) {
@ -546,7 +548,7 @@ GUILE::create_function (char *name, char *iname, SwigType *d, ParmList *l)
guile_do_doc_typemap(signature, "indoc", pt, pn,
numargs, proc_name, f);
}
if (i>=(pcount-numopt))
if (opt_p)
Printf(f->code," }\n");
}