mirror of https://github.com/swig/swig
Drop guilegh interface
All of guile's interface files now use the scm interface. This should not affect any users. Swig generated code using the scm interface can be mixed with gh interface using user code. It does simplify maintenance of the guile swig code though.
This commit is contained in:
parent
3c47730803
commit
b819d2a91e
|
@ -14,7 +14,7 @@
|
|||
<ul>
|
||||
<li><a href="#Guile_nn1">Supported Guile Versions</a>
|
||||
<li><a href="#Guile_nn2">Meaning of "Module"</a>
|
||||
<li><a href="#Guile_nn3">Using the SCM or GH Guile API</a>
|
||||
<li><a href="#Guile_nn3">Old GH Guile API</a>
|
||||
<li><a href="#Guile_nn4">Linkage</a>
|
||||
<ul>
|
||||
<li><a href="#Guile_nn5">Simple Linkage</a>
|
||||
|
@ -64,53 +64,19 @@ There are three different concepts of "module" involved, defined
|
|||
separately for SWIG, Guile, and Libtool. To avoid horrible confusion,
|
||||
we explicitly prefix the context, e.g., "guile-module".
|
||||
|
||||
<H2><a name="Guile_nn3"></a>23.3 Using the SCM or GH Guile API</H2>
|
||||
<H2><a name="Guile_nn3"></a>23.3 Old GH Guile API</H2>
|
||||
|
||||
|
||||
<p>The guile module can currently export wrapper files that use the guile GH interface or the
|
||||
SCM interface. This is controlled by an argument passed to swig. The "-gh" argument causes swig
|
||||
to output GH code, and the "-scm" argument causes swig to output SCM code. Right now the "-scm" argument
|
||||
is the default. The "-scm" wrapper generation assumes a guile version >= 1.6 and has several advantages over
|
||||
the "-gh" wrapper generation including garbage collection and GOOPS support.
|
||||
The "-gh" wrapper generation can be used for older versions of guile.
|
||||
The guile GH wrapper code generation is depreciated and the
|
||||
SCM interface is the default. The SCM and GH interface differ greatly in how they store
|
||||
pointers and have completely different run-time code. See below for more info.
|
||||
<p>Support for the guile GH wrapper code generation has been dropped. The last
|
||||
version of SWIG that can still generate guile GH wrapper code is 2.0.9. Please
|
||||
use that version if you really need the GH wrapper code.
|
||||
|
||||
<p>The GH interface to guile is deprecated. Read more about why in the
|
||||
<p>Guile 1.8 and older could be interfaced using a two different api's, the SCM
|
||||
or the GH API. The GH interface to guile is deprecated. Read more about why in the
|
||||
<a href="http://www.gnu.org/software/guile/docs/docs-1.6/guile-ref/GH.html#GH">Guile manual</a>.
|
||||
The idea of the GH interface was to provide a high level API that other languages and projects
|
||||
could adopt. This was a good idea, but didn't pan out well for general development. But for the
|
||||
specific, minimal uses that the SWIG typemaps put the GH interface to use is ideal for
|
||||
using a high level API. So even though the GH interface is depreciated, SWIG will continue to use
|
||||
the GH interface and provide mappings from the GH interface to whatever API we need.
|
||||
We can maintain this mapping where guile failed because SWIG uses a small subset of all the GH functions
|
||||
which map easily. All the guile typemaps like typemaps.i and std_vector.i
|
||||
will continue to use the GH functions to do things like create lists of values, convert strings to
|
||||
integers, etc. Then every language module will define a mapping between the GH interface and
|
||||
whatever custom API the language uses. This is currently implemented by the guile module to use
|
||||
the SCM guile API rather than the GH guile API.
|
||||
For example, here are some of the current mapping file for the SCM API</p>
|
||||
|
||||
<div class="code"><pre>
|
||||
|
||||
#define gh_append2(a, b) scm_append(scm_listify(a, b, SCM_UNDEFINED))
|
||||
#define gh_apply(a, b) scm_apply(a, b, SCM_EOL)
|
||||
#define gh_bool2scm SCM_BOOL
|
||||
#define gh_boolean_p SCM_BOOLP
|
||||
#define gh_car SCM_CAR
|
||||
#define gh_cdr SCM_CDR
|
||||
#define gh_cons scm_cons
|
||||
#define gh_double2scm scm_make_real
|
||||
...
|
||||
</pre></div>
|
||||
|
||||
<p>This file is parsed by SWIG at wrapper generation time, so every reference to a gh_ function is replaced
|
||||
by a scm_ function in the wrapper file. Thus the gh_ function calls will never be seen in the wrapper;
|
||||
the wrapper will look exactly like it was generated
|
||||
for the specific API. Currently only the guile language module has created a mapping policy from gh_ to scm_,
|
||||
but there is no reason other languages (like mzscheme or chicken) couldn't also use this.
|
||||
If that happens, there is A LOT less code duplication in the standard typemaps.</p>
|
||||
<p>The SCM wrapper generation assumes a guile version >= 1.8 and has several advantages over
|
||||
the "-gh" wrapper generation including garbage collection and GOOPS support.
|
||||
|
||||
<H2><a name="Guile_nn4"></a>23.4 Linkage</H2>
|
||||
|
||||
|
|
|
@ -773,7 +773,7 @@ Here are some examples of valid typemap specifications:
|
|||
}
|
||||
|
||||
/* Typemap with modifiers */
|
||||
%typemap(in,doc="integer") int "$1 = gh_scm2int($input);";
|
||||
%typemap(in,doc="integer") int "$1 = scm_to_int($input);";
|
||||
|
||||
/* Typemap applied to patterns of multiple arguments */
|
||||
%typemap(in) (char *str, int len),
|
||||
|
|
|
@ -479,19 +479,6 @@ $(GUILE_LIBPREFIX)$(TARGET)$(GUILE_SO): $(SRCS)
|
|||
guile_externalhdr:
|
||||
$(SWIG) -guile -external-runtime $(TARGET)
|
||||
|
||||
#------------------------------------------------------------------
|
||||
# Build a dynamically loaded module with passive linkage and the gh interface
|
||||
#------------------------------------------------------------------
|
||||
guile_gh: $(SRCS)
|
||||
$(SWIG) -guile -gh -Linkage passive $(SWIGOPT) $(INTERFACEPATH)
|
||||
$(CC) -c $(CCSHARED) $(CFLAGS) $(INCLUDES) $(GUILE_CFLAGS) $(ISRCS) $(SRCS)
|
||||
$(LDSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(LIBS) -o $(GUILE_LIBPREFIX)$(TARGET)$(GUILE_SO)
|
||||
|
||||
guile_gh_cpp: $(SRCS)
|
||||
$(SWIG) -c++ -guile -gh -Linkage passive $(SWIGOPT) $(INTERFACEPATH)
|
||||
$(CXX) -c $(CCSHARED) $(CFLAGS) $(INCLUDES) $(GUILE_CFLAGS) $(ICXXSRCS) $(SRCS) $(CXXSRCS)
|
||||
$(CXXSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(LIBS) $(CPP_DLLIBS) -o $(GUILE_LIBPREFIX)$(TARGET)$(GUILE_SO)
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# Build a dynamically loadable module with passive linkage
|
||||
# -----------------------------------------------------------------
|
||||
|
|
|
@ -59,14 +59,14 @@ extern int count(char *bytes, int len, char c);
|
|||
|
||||
%typemap(in) (char *str, int len) {
|
||||
size_t temp;
|
||||
$1 = gh_scm2newstr($input,&temp);
|
||||
$1 = SWIG_Guile_scm2newstr($input,&temp);
|
||||
$2 = temp;
|
||||
}
|
||||
|
||||
/* Return the mutated string as a new object. */
|
||||
|
||||
%typemap(argout) (char *str, int len) {
|
||||
SWIG_APPEND_VALUE(gh_str2scm($1,$2));
|
||||
SWIG_APPEND_VALUE(scm_mem2string($1,$2));
|
||||
if ($1) scm_must_free($1);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
#######################################################################
|
||||
# Makefile for guile test-suite (with SCM API)
|
||||
#######################################################################
|
||||
|
||||
include ../guile/Makefile
|
||||
|
||||
# Overridden variables here
|
||||
VARIANT = _gh
|
||||
# Refer to the guile directory for the run scripts
|
||||
SCRIPTPREFIX = ../guile/
|
||||
GUILE_RUNTIME=-runtime
|
||||
|
||||
# Custom tests - tests with additional commandline options
|
||||
# none!
|
||||
|
||||
# Runs the testcase. A testcase is only run if
|
||||
# a file is found which has _runme.scm appended after the testcase name.
|
||||
run_testcase = \
|
||||
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
|
||||
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(GUILE) -l $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
|
||||
fi
|
||||
|
||||
setup = \
|
||||
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
|
||||
echo "$(ACTION)ing testcase $* (with run test) under $(LANGUAGE) (with GH API)" ; \
|
||||
else \
|
||||
echo "$(ACTION)ing testcase $* under $(LANGUAGE) (with GH API)" ; \
|
||||
fi
|
|
@ -11,7 +11,7 @@
|
|||
#ifdef SWIGGUILE
|
||||
/* A silly testing typemap for feeding a doubly indirect integer */
|
||||
%typemap(in) int *&XYZZY (int temp1, int *temp2) {
|
||||
temp1 = gh_scm2int($input); temp2 = &temp1; $1 = &temp2;
|
||||
temp1 = scm_to_int($input); temp2 = &temp1; $1 = &temp2;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ typedef struct SWIGCDATA {
|
|||
|
||||
#if SWIGGUILE
|
||||
%typemap(out) SWIGCDATA {
|
||||
$result = gh_str2scm($1.data,$1.len);
|
||||
$result = scm_mem2string($1.data,$1.len);
|
||||
}
|
||||
%typemap(in) (const void *indata, int inlen) = (char *STRING, int LENGTH);
|
||||
#elif SWIGCHICKEN
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
SWIGINTERN void SWIG_exception_ (int code, const char *msg,
|
||||
const char *subr) {
|
||||
#define ERROR(scmerr) \
|
||||
scm_error(gh_symbol2scm((char *) (scmerr)), \
|
||||
scm_error(scm_str2symbol((char *) (scmerr)), \
|
||||
(char *) subr, (char *) msg, \
|
||||
SCM_EOL, SCM_BOOL_F)
|
||||
#define MAP(swigerr, scmerr) \
|
||||
|
|
|
@ -5,18 +5,18 @@
|
|||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%typemap(guile,out) string, std::string {
|
||||
$result = gh_str02scm(const_cast<char*>($1.c_str()));
|
||||
$result = SWIG_str02scm(const_cast<char*>($1.c_str()));
|
||||
}
|
||||
%typemap(guile,in) string, std::string {
|
||||
$1 = SWIG_scm2str($input);
|
||||
}
|
||||
|
||||
%typemap(guile,out) complex, complex<double>, std::complex<double> {
|
||||
$result = scm_make_rectangular( gh_double2scm ($1.real ()),
|
||||
gh_double2scm ($1.imag ()) );
|
||||
$result = scm_make_rectangular( scm_from_double ($1.real ()),
|
||||
scm_from_double ($1.imag ()) );
|
||||
}
|
||||
%typemap(guile,in) complex, complex<double>, std::complex<double> {
|
||||
$1 = std::complex<double>( gh_scm2double (scm_real_part ($input)),
|
||||
gh_scm2double (scm_imag_part ($input)) );
|
||||
$1 = std::complex<double>( scm_to_double (scm_real_part ($input)),
|
||||
scm_to_double (scm_imag_part ($input)) );
|
||||
}
|
||||
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
#define gh_append2(a, b) scm_append(scm_listify(a, b, SCM_UNDEFINED))
|
||||
#define gh_apply(a, b) scm_apply(a, b, SCM_EOL)
|
||||
#define gh_bool2scm scm_from_bool
|
||||
#define gh_boolean_p scm_is_bool
|
||||
#define gh_car SCM_CAR
|
||||
#define gh_cdr SCM_CDR
|
||||
#define gh_cons scm_cons
|
||||
#define gh_double2scm scm_from_double
|
||||
#define gh_int2scm scm_from_long
|
||||
#define gh_length(lst) scm_to_ulong(scm_length(lst))
|
||||
#define gh_list scm_listify
|
||||
#define gh_list_to_vector scm_vector
|
||||
#define gh_make_vector scm_make_vector
|
||||
#define gh_null_p scm_is_null
|
||||
#define gh_number_p scm_is_number
|
||||
#define gh_pair_p scm_is_pair
|
||||
#define gh_scm2bool scm_is_true
|
||||
#define gh_scm2char SCM_CHAR
|
||||
#define gh_scm2double scm_to_double
|
||||
#define gh_scm2int scm_to_int
|
||||
#define gh_scm2long scm_to_long
|
||||
#define gh_scm2short scm_to_short
|
||||
#define gh_scm2newstr SWIG_Guile_scm2newstr
|
||||
#define gh_scm2ulong scm_to_ulong
|
||||
#define gh_scm2ushort scm_to_ushort
|
||||
#define gh_scm2uint scm_to_uint
|
||||
#define gh_ulong2scm scm_from_ulong
|
||||
#define gh_long2scm scm_from_long
|
||||
#define gh_str02scm(str) str ? scm_from_locale_string(str) : SCM_BOOL_F
|
||||
#define gh_long_long2scm scm_from_long_long
|
||||
#define gh_scm2long_long scm_to_long_long
|
||||
#define gh_ulong_long2scm scm_from_ulong_long
|
||||
#define gh_scm2ulong_long scm_to_ulong_long
|
||||
#define gh_string_p scm_is_string
|
||||
#define gh_vector_length scm_c_vector_length
|
||||
#define gh_vector_p scm_is_vector
|
||||
#define gh_vector_ref scm_vector_ref
|
||||
#define gh_vector_set_x scm_vector_set_x
|
||||
#define gh_char2scm SCM_MAKE_CHAR
|
|
@ -1,71 +0,0 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* guile_gh.swg
|
||||
*
|
||||
* This SWIG interface file is processed if the Guile module is run
|
||||
* with gh_ flavor.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
#define SWIGGUILE_GH
|
||||
|
||||
%runtime "swigrun.swg"
|
||||
%runtime "guile_gh_run.swg"
|
||||
|
||||
#define SWIG_convert_short(o) \
|
||||
SWIG_convert_integer(o, - (1 << (8 * sizeof(short) - 1)), \
|
||||
(1 << (8 * sizeof(short) - 1)) - 1, \
|
||||
FUNC_NAME, $argnum)
|
||||
#define SWIG_convert_unsigned_short(o) \
|
||||
SWIG_convert_unsigned_integer(o, 0, \
|
||||
(1 << (8 * sizeof(short))) - 1, \
|
||||
FUNC_NAME, $argnum)
|
||||
#define SWIG_convert_unsigned_int(o) \
|
||||
SWIG_convert_unsigned_integer(o, 0, UINT_MAX, \
|
||||
FUNC_NAME, $argnum)
|
||||
|
||||
#define gh_scm2short(a) SWIG_convert_short(a)
|
||||
#define gh_scm2ushort(a) SWIG_convert_unsigned_short(a)
|
||||
#define gh_scm2uint(a) SWIG_convert_unsigned_int(a)
|
||||
|
||||
%include <guile.i>
|
||||
|
||||
%runtime %{
|
||||
|
||||
/* scm_values was implemented on C level in 1.4.1, and the prototype
|
||||
is not included in libguile.h, so play safe and lookup `values'... */
|
||||
#define GUILE_MAYBE_VALUES \
|
||||
if (gswig_list_p) \
|
||||
gswig_result = gh_apply(gh_lookup("values"), gswig_result);
|
||||
|
||||
#define GUILE_MAYBE_VECTOR \
|
||||
if (gswig_list_p) \
|
||||
gswig_result = gh_list_to_vector(gswig_result);
|
||||
|
||||
#define SWIG_APPEND_VALUE(object) \
|
||||
if (gswig_result == SCM_UNSPECIFIED) { \
|
||||
gswig_result = object; \
|
||||
} else { \
|
||||
if (!gswig_list_p) { \
|
||||
gswig_list_p = 1; \
|
||||
gswig_result = gh_list(gswig_result, object, SCM_UNDEFINED); \
|
||||
} \
|
||||
else \
|
||||
gswig_result = gh_append2(gswig_result, \
|
||||
gh_list(object, SCM_UNDEFINED)); \
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
%init "swiginit.swg"
|
||||
|
||||
%init %{
|
||||
static int _swig_module_smob_tag;
|
||||
|
||||
SWIG_GUILE_INIT_STATIC void
|
||||
SWIG_init(void)
|
||||
{
|
||||
|
||||
SWIG_InitializeModule(0);
|
||||
swig_module.clientdata = (void *) &_swig_module_smob_tag;
|
||||
|
||||
SWIG_Guile_Init(&swig_module);
|
||||
%}
|
|
@ -1,273 +0,0 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* guile_gh_run.swg
|
||||
*
|
||||
* Guile GH runtime file
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
#define SWIGGUILE
|
||||
#include "guile/gh.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* In the code below, use guile 2.0 compatible functions where possible.
|
||||
Functions that don't exist in older versions will be mapped to
|
||||
a deprecated equivalent for those versions only */
|
||||
/* ... setup guile 2-like interface for guile 1.8 */
|
||||
#if defined (SCM_MAJOR_VERSION) && (SCM_MAJOR_VERSION < 2)
|
||||
|
||||
static SCM
|
||||
scm_module_variable (SCM module, SCM sym)
|
||||
{
|
||||
return scm_sym2var (sym, scm_module_lookup_closure (module), SCM_BOOL_F);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
typedef SCM (*swig_guile_proc)();
|
||||
|
||||
#define SWIG_malloc(size) \
|
||||
SCM_MUST_MALLOC(size)
|
||||
#define SWIG_free(mem) \
|
||||
scm_must_free(mem)
|
||||
#define SWIG_ConvertPtr(s, result, type, flags) \
|
||||
SWIG_Guile_ConvertPtr(&swig_module, s, result, type, flags)
|
||||
#define SWIG_MustGetPtr(s, type, argnum, flags) \
|
||||
SWIG_Guile_MustGetPtr(&swig_module, s, type, argnum, flags, FUNC_NAME)
|
||||
#define SWIG_NewPointerObj(ptr, type, owner) \
|
||||
SWIG_Guile_NewPointerObj(&swig_module, (void*)ptr, type, owner)
|
||||
#define SWIG_GetModule(clientdata) SWIG_Guile_GetModule(clientdata)
|
||||
#define SWIG_SetModule(clientdata, pointer) SWIG_Guile_SetModule(pointer)
|
||||
|
||||
/* Ignore object-ownership changes in gh mode */
|
||||
#define SWIG_Guile_MarkPointerNoncollectable(s) (s)
|
||||
#define SWIG_Guile_MarkPointerDestroyed(s) (s)
|
||||
|
||||
#define SWIG_contract_assert(expr, msg) \
|
||||
if (!(expr)) \
|
||||
scm_error(gh_symbol2scm("swig-contract-assertion-failed"), \
|
||||
(char *) FUNC_NAME, (char *) msg, \
|
||||
SCM_EOL, SCM_BOOL_F); else
|
||||
|
||||
/* 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 */
|
||||
SWIGINTERN char
|
||||
GSWIG_scm2char (SCM s)
|
||||
{
|
||||
if (SCM_CHARP(s)) return SCM_CHAR(s);
|
||||
scm_wrong_type_arg(NULL, 0, s);
|
||||
}
|
||||
#define gh_scm2char GSWIG_scm2char
|
||||
|
||||
/* Interface function */
|
||||
#define SWIG_scm2str(x) gh_scm2newstr(x, NULL)
|
||||
|
||||
/* More 1.3.4 compatibility */
|
||||
#ifndef SCM_INPUT_PORT_P
|
||||
# define SCM_INPUT_PORT_P SCM_INPORTP
|
||||
# define SCM_OUTPUT_PORT_P SCM_OUTPORTP
|
||||
#endif
|
||||
|
||||
SWIGINTERN long
|
||||
SWIG_convert_integer(SCM o,
|
||||
long lower_bound, long upper_bound,
|
||||
const char *func_name, int argnum)
|
||||
{
|
||||
long value = gh_scm2long(o);
|
||||
if (value < lower_bound || value > upper_bound)
|
||||
scm_wrong_type_arg((char *) func_name, argnum, o);
|
||||
return value;
|
||||
}
|
||||
|
||||
SWIGINTERN unsigned long
|
||||
SWIG_convert_unsigned_integer(SCM o,
|
||||
unsigned long lower_bound,
|
||||
unsigned long upper_bound,
|
||||
const char *func_name, int argnum)
|
||||
{
|
||||
unsigned long value = gh_scm2ulong(o);
|
||||
if (value < lower_bound || value > upper_bound)
|
||||
scm_wrong_type_arg((char *) func_name, argnum, o);
|
||||
return value;
|
||||
}
|
||||
|
||||
SWIGINTERN swig_type_info *
|
||||
SWIG_Guile_LookupType(swig_module_info *module, SCM s, int normal)
|
||||
{
|
||||
swig_module_info *iter;
|
||||
if (!module) return 0;
|
||||
iter = module;
|
||||
do {
|
||||
if ((normal && (unsigned long) SCM_TYP16(s) == *((int *)iter->clientdata))) {
|
||||
|
||||
return iter->types[(long) SCM_CAR(s) >> 16];
|
||||
}
|
||||
iter = iter->next;
|
||||
} while (iter != module);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef SWIG_GLOBAL
|
||||
#define SWIG_GUILE_MODULE_STATIC
|
||||
#elif !defined(SWIG_NOINCLUDE)
|
||||
#define SWIG_GUILE_MODULE_STATIC static
|
||||
#endif
|
||||
|
||||
#ifdef SWIG_GUILE_MODULE_STATIC
|
||||
static swig_module_info *swig_guile_module = 0;
|
||||
SWIG_GUILE_MODULE_STATIC swig_module_info *SWIG_Guile_GetModule(void *SWIGUNUSEDPARM(clientdata)) {
|
||||
return swig_guile_module;
|
||||
}
|
||||
SWIG_GUILE_MODULE_STATIC void SWIG_Guile_SetModule(swig_module_info *pointer) {
|
||||
swig_guile_module = pointer;
|
||||
}
|
||||
#else
|
||||
SWIGEXPORT swig_module_info * SWIG_Guile_GetModule(void *SWIGUNUSEDPARM(clientdata));
|
||||
SWIGEXPORT void SWIG_Guile_SetModule(swig_module_info *pointer);
|
||||
#endif
|
||||
|
||||
SWIGINTERN SCM
|
||||
SWIG_Guile_NewPointerObj(swig_module_info *module, void *ptr,
|
||||
swig_type_info *type, int owner)
|
||||
{
|
||||
unsigned long tag;
|
||||
if (ptr==NULL) return SCM_EOL;
|
||||
if (!module) return SCM_EOL;
|
||||
for (tag = 0; tag < module->size; ++tag) {
|
||||
if (module->types[tag] == type)
|
||||
break;
|
||||
}
|
||||
if (tag >= module->size)
|
||||
return SCM_EOL;
|
||||
|
||||
|
||||
SCM_RETURN_NEWSMOB( ((tag << 16) | *((int *)module->clientdata)), ptr);
|
||||
}
|
||||
|
||||
/* Return 0 if successful. */
|
||||
SWIGINTERN int
|
||||
SWIG_Guile_ConvertPtr(swig_module_info *module, SCM s, void **result,
|
||||
swig_type_info *type, int flags)
|
||||
{
|
||||
swig_cast_info *cast;
|
||||
swig_type_info *from;
|
||||
if (scm_is_null(s)) {
|
||||
*result = NULL;
|
||||
return SWIG_OK;
|
||||
} else if (SCM_NIMP(s)) {
|
||||
from = SWIG_Guile_LookupType(module, s, 1);
|
||||
if (!from) return SWIG_ERROR;
|
||||
if (type) {
|
||||
cast = SWIG_TypeCheckStruct(from, type);
|
||||
if (cast) {
|
||||
int newmemory = 0;
|
||||
*result = SWIG_TypeCast(cast, (void *) SCM_CDR(s), &newmemory);
|
||||
assert(!newmemory); /* newmemory handling not yet implemented */
|
||||
return SWIG_OK;
|
||||
} else {
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
} else {
|
||||
*result = (void *) SCM_CDR(s);
|
||||
return SWIG_OK;
|
||||
}
|
||||
}
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
SWIGINTERN void *
|
||||
SWIG_Guile_MustGetPtr (swig_module_info *module, SCM s, swig_type_info *type,
|
||||
int argnum, int flags, const char *func_name)
|
||||
{
|
||||
void *result;
|
||||
int res = SWIG_Guile_ConvertPtr(module, s, &result, type, flags);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
/* type mismatch */
|
||||
scm_wrong_type_arg((char *) func_name, argnum, s);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Init */
|
||||
|
||||
SWIGINTERN int
|
||||
print_swig (SCM swig_smob, SCM port, scm_print_state *pstate)
|
||||
{
|
||||
swig_type_info *type = SWIG_Guile_LookupType(0, swig_smob, 1);
|
||||
if (type) {
|
||||
scm_puts((char *) "#<swig ", port);
|
||||
if (type->str != NULL)
|
||||
scm_puts((char *) type->str, port);
|
||||
else
|
||||
scm_puts((char *) type->name, port);
|
||||
scm_puts((char *) " ", port);
|
||||
scm_intprint((long) SCM_CDR(swig_smob), 16, port);
|
||||
scm_puts((char *) ">", port);
|
||||
/* non-zero means success */
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
SWIGINTERN SCM
|
||||
equalp_swig (SCM A, SCM B)
|
||||
{
|
||||
if (SCM_CAR(A) == SCM_CAR(B)
|
||||
&& SCM_CDR(A) == SCM_CDR(B))
|
||||
return SCM_BOOL_T;
|
||||
else return SCM_BOOL_F;
|
||||
}
|
||||
|
||||
SWIGINTERN void
|
||||
SWIG_Guile_Init (swig_module_info *module)
|
||||
{
|
||||
*((int *)module->clientdata) =
|
||||
scm_make_smob_type_mfpe((char *) "swig", 0, NULL, NULL, print_swig, equalp_swig);
|
||||
}
|
||||
|
||||
SWIGINTERN int
|
||||
SWIG_Guile_GetArgs (SCM *dest, SCM rest,
|
||||
int reqargs, int optargs,
|
||||
const char *procname)
|
||||
{
|
||||
int i;
|
||||
int num_args_passed = 0;
|
||||
for (i = 0; i<reqargs; i++) {
|
||||
if (!SCM_CONSP(rest))
|
||||
scm_wrong_num_args(gh_str02scm((char *) procname));
|
||||
*dest++ = SCM_CAR(rest);
|
||||
rest = SCM_CDR(rest);
|
||||
num_args_passed++;
|
||||
}
|
||||
for (i = 0; i<optargs && SCM_CONSP(rest); i++) {
|
||||
*dest++ = SCM_CAR(rest);
|
||||
rest = SCM_CDR(rest);
|
||||
num_args_passed++;
|
||||
}
|
||||
for (; i<optargs; i++)
|
||||
*dest++ = SCM_UNDEFINED;
|
||||
if (!scm_is_null(rest))
|
||||
scm_wrong_num_args(gh_str02scm((char *) procname));
|
||||
return num_args_passed;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* guile.swg ends here */
|
|
@ -10,7 +10,6 @@
|
|||
%runtime "swigrun.swg" // Common C API type-checking code
|
||||
|
||||
%runtime "guile_scm_run.swg"
|
||||
%include <ghinterface.i>
|
||||
%include <guile.i>
|
||||
|
||||
%runtime %{
|
||||
|
@ -32,10 +31,6 @@
|
|||
else \
|
||||
gswig_result = scm_append(scm_listify(gswig_result, scm_listify(object, SCM_UNDEFINED), SCM_UNDEFINED)); \
|
||||
}
|
||||
/* used by Lib/exception.i */
|
||||
#define gh_symbol2scm scm_str2symbol
|
||||
/* useb by Lib/cdata.i */
|
||||
#define gh_str2scm scm_mem2string
|
||||
|
||||
%}
|
||||
|
||||
|
|
|
@ -43,10 +43,12 @@ typedef struct swig_guile_clientdata {
|
|||
|
||||
#define SWIG_scm2str(s) \
|
||||
SWIG_Guile_scm2newstr(s, NULL)
|
||||
#define SWIG_str02scm(str) \
|
||||
str ? scm_from_locale_string(str) : SCM_BOOL_F
|
||||
# define SWIG_malloc(size) \
|
||||
scm_malloc(size)
|
||||
scm_malloc(size)
|
||||
# define SWIG_free(mem) \
|
||||
free(mem)
|
||||
free(mem)
|
||||
#define SWIG_ConvertPtr(s, result, type, flags) \
|
||||
SWIG_Guile_ConvertPtr(s, result, type, flags)
|
||||
#define SWIG_MustGetPtr(s, type, argnum, flags) \
|
||||
|
|
|
@ -61,12 +61,12 @@
|
|||
(size_t VECTORLENINPUT, C_TYPE *VECTORINPUT)
|
||||
{
|
||||
SCM_VALIDATE_VECTOR($argnum, $input);
|
||||
$1 = gh_vector_length($input);
|
||||
$1 = scm_c_vector_length($input);
|
||||
if ($1 > 0) {
|
||||
$1_ltype i;
|
||||
$2 = (C_TYPE *) SWIG_malloc(sizeof(C_TYPE) * $1);
|
||||
for (i = 0; i<$1; i++) {
|
||||
SCM swig_scm_value = gh_vector_ref($input, gh_int2scm(i));
|
||||
SCM swig_scm_value = scm_vector_ref($input, scm_from_long(i));
|
||||
$2[i] = SCM_TO_C_EXPR;
|
||||
}
|
||||
}
|
||||
|
@ -78,15 +78,15 @@
|
|||
(size_t LISTLENINPUT, C_TYPE *LISTINPUT)
|
||||
{
|
||||
SCM_VALIDATE_LIST($argnum, $input);
|
||||
$1 = gh_length($input);
|
||||
$1 = scm_to_ulong(scm_length($input));
|
||||
if ($1 > 0) {
|
||||
$1_ltype i;
|
||||
SCM rest;
|
||||
$2 = (C_TYPE *) SWIG_malloc(sizeof(C_TYPE) * $1);
|
||||
for (i = 0, rest = $input;
|
||||
i<$1;
|
||||
i++, rest = gh_cdr(rest)) {
|
||||
SCM swig_scm_value = gh_car(rest);
|
||||
i++, rest = SCM_CDR(rest)) {
|
||||
SCM swig_scm_value = SCM_CAR(rest);
|
||||
$2[i] = SCM_TO_C_EXPR;
|
||||
}
|
||||
}
|
||||
|
@ -140,12 +140,12 @@
|
|||
(size_t *VECTORLENOUTPUT, C_TYPE **VECTOROUTPUT)
|
||||
{
|
||||
$*1_ltype i;
|
||||
SCM res = gh_make_vector(gh_int2scm(*$1),
|
||||
SCM res = scm_make_vector(scm_from_long(*$1),
|
||||
SCM_BOOL_F);
|
||||
for (i = 0; i<*$1; i++) {
|
||||
C_TYPE swig_c_value = (*$2)[i];
|
||||
SCM elt = C_TO_SCM_EXPR;
|
||||
gh_vector_set_x(res, gh_int2scm(i), elt);
|
||||
scm_vector_set_x(res, scm_from_long(i), elt);
|
||||
}
|
||||
SWIG_APPEND_VALUE(res);
|
||||
}
|
||||
|
@ -159,7 +159,7 @@
|
|||
for (i = ((int)(*$1)) - 1; i>=0; i--) {
|
||||
C_TYPE swig_c_value = (*$2)[i];
|
||||
SCM elt = C_TO_SCM_EXPR;
|
||||
res = gh_cons(elt, res);
|
||||
res = scm_cons(elt, res);
|
||||
}
|
||||
SWIG_APPEND_VALUE(res);
|
||||
}
|
||||
|
@ -200,21 +200,21 @@
|
|||
|
||||
/* We use the macro to define typemaps for some standard types. */
|
||||
|
||||
TYPEMAP_LIST_VECTOR_INPUT_OUTPUT(bool, gh_scm2bool, gh_bool2scm, boolean);
|
||||
TYPEMAP_LIST_VECTOR_INPUT_OUTPUT(char, gh_scm2char, gh_char2scm, char);
|
||||
TYPEMAP_LIST_VECTOR_INPUT_OUTPUT(unsigned char, gh_scm2char, gh_char2scm, char);
|
||||
TYPEMAP_LIST_VECTOR_INPUT_OUTPUT(int, gh_scm2int, gh_int2scm, integer);
|
||||
TYPEMAP_LIST_VECTOR_INPUT_OUTPUT(short, gh_scm2int, gh_int2scm, integer);
|
||||
TYPEMAP_LIST_VECTOR_INPUT_OUTPUT(long, gh_scm2long, gh_long2scm, integer);
|
||||
TYPEMAP_LIST_VECTOR_INPUT_OUTPUT(ptrdiff_t, gh_scm2long, gh_long2scm, integer);
|
||||
TYPEMAP_LIST_VECTOR_INPUT_OUTPUT(unsigned int, gh_scm2ulong, gh_ulong2scm, integer);
|
||||
TYPEMAP_LIST_VECTOR_INPUT_OUTPUT(unsigned short, gh_scm2ulong, gh_ulong2scm, integer);
|
||||
TYPEMAP_LIST_VECTOR_INPUT_OUTPUT(unsigned long, gh_scm2ulong, gh_ulong2scm, integer);
|
||||
TYPEMAP_LIST_VECTOR_INPUT_OUTPUT(size_t, gh_scm2ulong, gh_ulong2scm, integer);
|
||||
TYPEMAP_LIST_VECTOR_INPUT_OUTPUT(float, gh_scm2double, gh_double2scm, real);
|
||||
TYPEMAP_LIST_VECTOR_INPUT_OUTPUT(double, gh_scm2double, gh_double2scm, real);
|
||||
TYPEMAP_LIST_VECTOR_INPUT_OUTPUT(char *, SWIG_scm2str, gh_str02scm, string);
|
||||
TYPEMAP_LIST_VECTOR_INPUT_OUTPUT(const char *, SWIG_scm2str, gh_str02scm, string);
|
||||
TYPEMAP_LIST_VECTOR_INPUT_OUTPUT(bool, scm_is_true, scm_from_bool, boolean);
|
||||
TYPEMAP_LIST_VECTOR_INPUT_OUTPUT(char, SCM_CHAR, SCM_MAKE_CHAR, char);
|
||||
TYPEMAP_LIST_VECTOR_INPUT_OUTPUT(unsigned char, SCM_CHAR, SCM_MAKE_CHAR, char);
|
||||
TYPEMAP_LIST_VECTOR_INPUT_OUTPUT(int, scm_to_int, scm_from_long, integer);
|
||||
TYPEMAP_LIST_VECTOR_INPUT_OUTPUT(short, scm_to_int, scm_from_long, integer);
|
||||
TYPEMAP_LIST_VECTOR_INPUT_OUTPUT(long, scm_to_long, scm_from_long, integer);
|
||||
TYPEMAP_LIST_VECTOR_INPUT_OUTPUT(ptrdiff_t, scm_to_long, scm_from_long, integer);
|
||||
TYPEMAP_LIST_VECTOR_INPUT_OUTPUT(unsigned int, scm_to_ulong, scm_from_ulong, integer);
|
||||
TYPEMAP_LIST_VECTOR_INPUT_OUTPUT(unsigned short, scm_to_ulong, scm_from_ulong, integer);
|
||||
TYPEMAP_LIST_VECTOR_INPUT_OUTPUT(unsigned long, scm_to_ulong, scm_from_ulong, integer);
|
||||
TYPEMAP_LIST_VECTOR_INPUT_OUTPUT(size_t, scm_to_ulong, scm_from_ulong, integer);
|
||||
TYPEMAP_LIST_VECTOR_INPUT_OUTPUT(float, scm_to_double, scm_from_double, real);
|
||||
TYPEMAP_LIST_VECTOR_INPUT_OUTPUT(double, scm_to_double, scm_from_double, real);
|
||||
TYPEMAP_LIST_VECTOR_INPUT_OUTPUT(char *, SWIG_scm2str, SWIG_str02scm, string);
|
||||
TYPEMAP_LIST_VECTOR_INPUT_OUTPUT(const char *, SWIG_scm2str, SWIG_str02scm, string);
|
||||
|
||||
/* For the char *, free all strings after converting */
|
||||
|
||||
|
@ -312,13 +312,13 @@ TYPEMAP_LIST_VECTOR_INPUT_OUTPUT(const char *, SWIG_scm2str, gh_str02scm, string
|
|||
const C_TYPE *PARALLEL_VECTORINPUT
|
||||
{
|
||||
SCM_VALIDATE_VECTOR($argnum, $input);
|
||||
*_global_vector_length = gh_vector_length($input);
|
||||
*_global_vector_length = scm_c_vector_length($input);
|
||||
if (*_global_vector_length > 0) {
|
||||
int i;
|
||||
$1 = (C_TYPE *) SWIG_malloc(sizeof(C_TYPE)
|
||||
* (*_global_vector_length));
|
||||
for (i = 0; i<*_global_vector_length; i++) {
|
||||
SCM swig_scm_value = gh_vector_ref($input, gh_int2scm(i));
|
||||
SCM swig_scm_value = scm_vector_ref($input, scm_from_long(i));
|
||||
$1[i] = SCM_TO_C_EXPR;
|
||||
}
|
||||
}
|
||||
|
@ -330,7 +330,7 @@ TYPEMAP_LIST_VECTOR_INPUT_OUTPUT(const char *, SWIG_scm2str, gh_str02scm, string
|
|||
const C_TYPE *PARALLEL_LISTINPUT
|
||||
{
|
||||
SCM_VALIDATE_LIST($argnum, $input);
|
||||
*_global_list_length = gh_length($input);
|
||||
*_global_list_length = scm_to_ulong(scm_length($input));
|
||||
if (*_global_list_length > 0) {
|
||||
int i;
|
||||
SCM rest;
|
||||
|
@ -338,8 +338,8 @@ TYPEMAP_LIST_VECTOR_INPUT_OUTPUT(const char *, SWIG_scm2str, gh_str02scm, string
|
|||
* (*_global_list_length));
|
||||
for (i = 0, rest = $input;
|
||||
i<*_global_list_length;
|
||||
i++, rest = gh_cdr(rest)) {
|
||||
SCM swig_scm_value = gh_car(rest);
|
||||
i++, rest = SCM_CDR(rest)) {
|
||||
SCM swig_scm_value = SCM_CAR(rest);
|
||||
$1[i] = SCM_TO_C_EXPR;
|
||||
}
|
||||
}
|
||||
|
@ -391,12 +391,12 @@ TYPEMAP_LIST_VECTOR_INPUT_OUTPUT(const char *, SWIG_scm2str, gh_str02scm, string
|
|||
C_TYPE **PARALLEL_VECTOROUTPUT
|
||||
{
|
||||
int i;
|
||||
SCM res = gh_make_vector(gh_int2scm(_global_arraylentemp),
|
||||
SCM res = scm_make_vector(scm_from_long(_global_arraylentemp),
|
||||
SCM_BOOL_F);
|
||||
for (i = 0; i<_global_arraylentemp; i++) {
|
||||
C_TYPE swig_c_value = (*$1)[i];
|
||||
SCM elt = C_TO_SCM_EXPR;
|
||||
gh_vector_set_x(res, gh_int2scm(i), elt);
|
||||
scm_vector_set_x(res, scm_from_long(i), elt);
|
||||
}
|
||||
SWIG_APPEND_VALUE(res);
|
||||
}
|
||||
|
@ -410,7 +410,7 @@ TYPEMAP_LIST_VECTOR_INPUT_OUTPUT(const char *, SWIG_scm2str, gh_str02scm, string
|
|||
for (i = _global_arraylentemp - 1; i>=0; i--) {
|
||||
C_TYPE swig_c_value = (*$1)[i];
|
||||
SCM elt = C_TO_SCM_EXPR;
|
||||
res = gh_cons(elt, res);
|
||||
res = scm_cons(elt, res);
|
||||
}
|
||||
}
|
||||
SWIG_APPEND_VALUE(res);
|
||||
|
@ -449,21 +449,21 @@ TYPEMAP_LIST_VECTOR_INPUT_OUTPUT(const char *, SWIG_scm2str, gh_str02scm, string
|
|||
|
||||
/* We use the macro to define typemaps for some standard types. */
|
||||
|
||||
TYPEMAP_PARALLEL_LIST_VECTOR_INPUT_OUTPUT(bool, gh_scm2bool, gh_bool2scm, boolean);
|
||||
TYPEMAP_PARALLEL_LIST_VECTOR_INPUT_OUTPUT(char, gh_scm2char, gh_char2scm, char);
|
||||
TYPEMAP_PARALLEL_LIST_VECTOR_INPUT_OUTPUT(unsigned char, gh_scm2char, gh_char2scm, char);
|
||||
TYPEMAP_PARALLEL_LIST_VECTOR_INPUT_OUTPUT(int, gh_scm2int, gh_int2scm, integer);
|
||||
TYPEMAP_PARALLEL_LIST_VECTOR_INPUT_OUTPUT(short, gh_scm2int, gh_int2scm, integer);
|
||||
TYPEMAP_PARALLEL_LIST_VECTOR_INPUT_OUTPUT(long, gh_scm2long, gh_long2scm, integer);
|
||||
TYPEMAP_PARALLEL_LIST_VECTOR_INPUT_OUTPUT(ptrdiff_t, gh_scm2long, gh_long2scm, integer);
|
||||
TYPEMAP_PARALLEL_LIST_VECTOR_INPUT_OUTPUT(unsigned int, gh_scm2ulong, gh_ulong2scm, integer);
|
||||
TYPEMAP_PARALLEL_LIST_VECTOR_INPUT_OUTPUT(unsigned short, gh_scm2ulong, gh_ulong2scm, integer);
|
||||
TYPEMAP_PARALLEL_LIST_VECTOR_INPUT_OUTPUT(unsigned long, gh_scm2ulong, gh_ulong2scm, integer);
|
||||
TYPEMAP_PARALLEL_LIST_VECTOR_INPUT_OUTPUT(size_t, gh_scm2ulong, gh_ulong2scm, integer);
|
||||
TYPEMAP_PARALLEL_LIST_VECTOR_INPUT_OUTPUT(float, gh_scm2double, gh_double2scm, real);
|
||||
TYPEMAP_PARALLEL_LIST_VECTOR_INPUT_OUTPUT(double, gh_scm2double, gh_double2scm, real);
|
||||
TYPEMAP_PARALLEL_LIST_VECTOR_INPUT_OUTPUT(char *, SWIG_scm2str, gh_str02scm, string);
|
||||
TYPEMAP_PARALLEL_LIST_VECTOR_INPUT_OUTPUT(const char *, SWIG_scm2str, gh_str02scm, string);
|
||||
TYPEMAP_PARALLEL_LIST_VECTOR_INPUT_OUTPUT(bool, scm_is_true, scm_from_bool, boolean);
|
||||
TYPEMAP_PARALLEL_LIST_VECTOR_INPUT_OUTPUT(char, SCM_CHAR, SCM_MAKE_CHAR, char);
|
||||
TYPEMAP_PARALLEL_LIST_VECTOR_INPUT_OUTPUT(unsigned char, SCM_CHAR, SCM_MAKE_CHAR, char);
|
||||
TYPEMAP_PARALLEL_LIST_VECTOR_INPUT_OUTPUT(int, scm_to_int, scm_from_long, integer);
|
||||
TYPEMAP_PARALLEL_LIST_VECTOR_INPUT_OUTPUT(short, scm_to_int, scm_from_long, integer);
|
||||
TYPEMAP_PARALLEL_LIST_VECTOR_INPUT_OUTPUT(long, scm_to_long, scm_from_long, integer);
|
||||
TYPEMAP_PARALLEL_LIST_VECTOR_INPUT_OUTPUT(ptrdiff_t, scm_to_long, scm_from_long, integer);
|
||||
TYPEMAP_PARALLEL_LIST_VECTOR_INPUT_OUTPUT(unsigned int, scm_to_ulong, scm_from_ulong, integer);
|
||||
TYPEMAP_PARALLEL_LIST_VECTOR_INPUT_OUTPUT(unsigned short, scm_to_ulong, scm_from_ulong, integer);
|
||||
TYPEMAP_PARALLEL_LIST_VECTOR_INPUT_OUTPUT(unsigned long, scm_to_ulong, scm_from_ulong, integer);
|
||||
TYPEMAP_PARALLEL_LIST_VECTOR_INPUT_OUTPUT(size_t, scm_to_ulong, scm_from_ulong, integer);
|
||||
TYPEMAP_PARALLEL_LIST_VECTOR_INPUT_OUTPUT(float, scm_to_double, scm_from_double, real);
|
||||
TYPEMAP_PARALLEL_LIST_VECTOR_INPUT_OUTPUT(double, scm_to_double, scm_from_double, real);
|
||||
TYPEMAP_PARALLEL_LIST_VECTOR_INPUT_OUTPUT(char *, SWIG_scm2str, SWIG_str02scm, string);
|
||||
TYPEMAP_PARALLEL_LIST_VECTOR_INPUT_OUTPUT(const char *, SWIG_scm2str, SWIG_str02scm, string);
|
||||
|
||||
%typemap(freearg) char **PARALLEL_LISTINPUT, char **PARALLEL_VECTORINPUT,
|
||||
const char **PARALLEL_LISTINPUT, const char **PARALLEL_VECTORINPUT
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
%apply size_t { std::size_t };
|
||||
|
||||
#define SWIG_bool2scm(b) gh_bool2scm(b ? 1 : 0)
|
||||
#define SWIG_string2scm(s) gh_str02scm(s.c_str())
|
||||
#define SWIG_bool2scm(b) scm_from_bool(b ? 1 : 0)
|
||||
#define SWIG_string2scm(s) SWIG_str02scm(s.c_str())
|
||||
|
||||
%{
|
||||
#include <string>
|
||||
|
|
1148
Lib/guile/std_map.i
1148
Lib/guile/std_map.i
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -27,7 +27,7 @@ namespace std {
|
|||
%typemap(typecheck) const string & = char *;
|
||||
|
||||
%typemap(in) string (char * tempptr) {
|
||||
if (gh_string_p($input)) {
|
||||
if (scm_is_string($input)) {
|
||||
tempptr = SWIG_scm2str($input);
|
||||
$1.assign(tempptr);
|
||||
if (tempptr) SWIG_free(tempptr);
|
||||
|
@ -37,7 +37,7 @@ namespace std {
|
|||
}
|
||||
|
||||
%typemap(in) const string & ($*1_ltype temp, char *tempptr) {
|
||||
if (gh_string_p($input)) {
|
||||
if (scm_is_string($input)) {
|
||||
tempptr = SWIG_scm2str($input);
|
||||
temp.assign(tempptr);
|
||||
if (tempptr) SWIG_free(tempptr);
|
||||
|
@ -48,7 +48,7 @@ namespace std {
|
|||
}
|
||||
|
||||
%typemap(in) string * (char *tempptr) {
|
||||
if (gh_string_p($input)) {
|
||||
if (scm_is_string($input)) {
|
||||
tempptr = SWIG_scm2str($input);
|
||||
$1 = new $*1_ltype(tempptr);
|
||||
if (tempptr) SWIG_free(tempptr);
|
||||
|
@ -58,19 +58,19 @@ namespace std {
|
|||
}
|
||||
|
||||
%typemap(out) string {
|
||||
$result = gh_str02scm($1.c_str());
|
||||
$result = SWIG_str02scm($1.c_str());
|
||||
}
|
||||
|
||||
%typemap(out) const string & {
|
||||
$result = gh_str02scm($1->c_str());
|
||||
$result = SWIG_str02scm($1->c_str());
|
||||
}
|
||||
|
||||
%typemap(out) string * {
|
||||
$result = gh_str02scm($1->c_str());
|
||||
$result = SWIG_str02scm($1->c_str());
|
||||
}
|
||||
|
||||
%typemap(varin) string {
|
||||
if (gh_string_p($input)) {
|
||||
if (scm_is_string($input)) {
|
||||
char *tempptr = SWIG_scm2str($input);
|
||||
$1.assign(tempptr);
|
||||
if (tempptr) SWIG_free(tempptr);
|
||||
|
@ -80,7 +80,7 @@ namespace std {
|
|||
}
|
||||
|
||||
%typemap(varout) string {
|
||||
$result = gh_str02scm($1.c_str());
|
||||
$result = SWIG_str02scm($1.c_str());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -42,23 +42,23 @@ namespace std {
|
|||
|
||||
template<class T> class vector {
|
||||
%typemap(in) vector<T> {
|
||||
if (gh_vector_p($input)) {
|
||||
unsigned long size = gh_vector_length($input);
|
||||
if (scm_is_vector($input)) {
|
||||
unsigned long size = scm_c_vector_length($input);
|
||||
$1 = std::vector<T >(size);
|
||||
for (unsigned long i=0; i<size; i++) {
|
||||
SCM o = gh_vector_ref($input,gh_ulong2scm(i));
|
||||
SCM o = scm_vector_ref($input,scm_from_ulong(i));
|
||||
(($1_type &)$1)[i] =
|
||||
*((T*) SWIG_MustGetPtr(o,$descriptor(T *),$argnum, 0));
|
||||
}
|
||||
} else if (gh_null_p($input)) {
|
||||
} else if (scm_is_null($input)) {
|
||||
$1 = std::vector<T >();
|
||||
} else if (gh_pair_p($input)) {
|
||||
} else if (scm_is_pair($input)) {
|
||||
SCM head, tail;
|
||||
$1 = std::vector<T >();
|
||||
tail = $input;
|
||||
while (!gh_null_p(tail)) {
|
||||
head = gh_car(tail);
|
||||
tail = gh_cdr(tail);
|
||||
while (!scm_is_null(tail)) {
|
||||
head = SCM_CAR(tail);
|
||||
tail = SCM_CDR(tail);
|
||||
$1.push_back(*((T*)SWIG_MustGetPtr(head,
|
||||
$descriptor(T *),
|
||||
$argnum, 0)));
|
||||
|
@ -70,27 +70,27 @@ namespace std {
|
|||
}
|
||||
%typemap(in) const vector<T>& (std::vector<T> temp),
|
||||
const vector<T>* (std::vector<T> temp) {
|
||||
if (gh_vector_p($input)) {
|
||||
unsigned long size = gh_vector_length($input);
|
||||
if (scm_is_vector($input)) {
|
||||
unsigned long size = scm_c_vector_length($input);
|
||||
temp = std::vector<T >(size);
|
||||
$1 = &temp;
|
||||
for (unsigned long i=0; i<size; i++) {
|
||||
SCM o = gh_vector_ref($input,gh_ulong2scm(i));
|
||||
SCM o = scm_vector_ref($input,scm_from_ulong(i));
|
||||
temp[i] = *((T*) SWIG_MustGetPtr(o,
|
||||
$descriptor(T *),
|
||||
$argnum, 0));
|
||||
}
|
||||
} else if (gh_null_p($input)) {
|
||||
} else if (scm_is_null($input)) {
|
||||
temp = std::vector<T >();
|
||||
$1 = &temp;
|
||||
} else if (gh_pair_p($input)) {
|
||||
} else if (scm_is_pair($input)) {
|
||||
temp = std::vector<T >();
|
||||
$1 = &temp;
|
||||
SCM head, tail;
|
||||
tail = $input;
|
||||
while (!gh_null_p(tail)) {
|
||||
head = gh_car(tail);
|
||||
tail = gh_cdr(tail);
|
||||
while (!scm_is_null(tail)) {
|
||||
head = SCM_CAR(tail);
|
||||
tail = SCM_CDR(tail);
|
||||
temp.push_back(*((T*) SWIG_MustGetPtr(head,
|
||||
$descriptor(T *),
|
||||
$argnum, 0)));
|
||||
|
@ -100,23 +100,23 @@ namespace std {
|
|||
}
|
||||
}
|
||||
%typemap(out) vector<T> {
|
||||
$result = gh_make_vector(gh_long2scm($1.size()),SCM_UNSPECIFIED);
|
||||
$result = scm_make_vector(scm_from_long($1.size()),SCM_UNSPECIFIED);
|
||||
for (unsigned int i=0; i<$1.size(); i++) {
|
||||
T* x = new T((($1_type &)$1)[i]);
|
||||
gh_vector_set_x($result,gh_long2scm(i),
|
||||
scm_vector_set_x($result,scm_from_long(i),
|
||||
SWIG_NewPointerObj(x, $descriptor(T *), 1));
|
||||
}
|
||||
}
|
||||
%typecheck(SWIG_TYPECHECK_VECTOR) vector<T> {
|
||||
/* native sequence? */
|
||||
if (gh_vector_p($input)) {
|
||||
unsigned int size = gh_vector_length($input);
|
||||
if (scm_is_vector($input)) {
|
||||
unsigned int size = scm_c_vector_length($input);
|
||||
if (size == 0) {
|
||||
/* an empty sequence can be of any type */
|
||||
$1 = 1;
|
||||
} else {
|
||||
/* check the first element only */
|
||||
SCM o = gh_vector_ref($input,gh_ulong2scm(0));
|
||||
SCM o = scm_vector_ref($input,scm_from_ulong(0));
|
||||
T* x;
|
||||
if (SWIG_ConvertPtr(o,(void**) &x,
|
||||
$descriptor(T *), 0) != -1)
|
||||
|
@ -124,13 +124,13 @@ namespace std {
|
|||
else
|
||||
$1 = 0;
|
||||
}
|
||||
} else if (gh_null_p($input)) {
|
||||
} else if (scm_is_null($input)) {
|
||||
/* again, an empty sequence can be of any type */
|
||||
$1 = 1;
|
||||
} else if (gh_pair_p($input)) {
|
||||
} else if (scm_is_pair($input)) {
|
||||
/* check the first element only */
|
||||
T* x;
|
||||
SCM head = gh_car($input);
|
||||
SCM head = SCM_CAR($input);
|
||||
if (SWIG_ConvertPtr(head,(void**) &x,
|
||||
$descriptor(T *), 0) != -1)
|
||||
$1 = 1;
|
||||
|
@ -149,28 +149,28 @@ namespace std {
|
|||
%typecheck(SWIG_TYPECHECK_VECTOR) const vector<T>&,
|
||||
const vector<T>* {
|
||||
/* native sequence? */
|
||||
if (gh_vector_p($input)) {
|
||||
unsigned int size = gh_vector_length($input);
|
||||
if (scm_is_vector($input)) {
|
||||
unsigned int size = scm_c_vector_length($input);
|
||||
if (size == 0) {
|
||||
/* an empty sequence can be of any type */
|
||||
$1 = 1;
|
||||
} else {
|
||||
/* check the first element only */
|
||||
T* x;
|
||||
SCM o = gh_vector_ref($input,gh_ulong2scm(0));
|
||||
SCM o = scm_vector_ref($input,scm_from_ulong(0));
|
||||
if (SWIG_ConvertPtr(o,(void**) &x,
|
||||
$descriptor(T *), 0) != -1)
|
||||
$1 = 1;
|
||||
else
|
||||
$1 = 0;
|
||||
}
|
||||
} else if (gh_null_p($input)) {
|
||||
} else if (scm_is_null($input)) {
|
||||
/* again, an empty sequence can be of any type */
|
||||
$1 = 1;
|
||||
} else if (gh_pair_p($input)) {
|
||||
} else if (scm_is_pair($input)) {
|
||||
/* check the first element only */
|
||||
T* x;
|
||||
SCM head = gh_car($input);
|
||||
SCM head = SCM_CAR($input);
|
||||
if (SWIG_ConvertPtr(head,(void**) &x,
|
||||
$descriptor(T *), 0) != -1)
|
||||
$1 = 1;
|
||||
|
@ -230,24 +230,24 @@ namespace std {
|
|||
%define specialize_stl_vector(T,CHECK,CONVERT_FROM,CONVERT_TO)
|
||||
template<> class vector<T> {
|
||||
%typemap(in) vector<T> {
|
||||
if (gh_vector_p($input)) {
|
||||
unsigned long size = gh_vector_length($input);
|
||||
if (scm_is_vector($input)) {
|
||||
unsigned long size = scm_c_vector_length($input);
|
||||
$1 = std::vector<T >(size);
|
||||
for (unsigned long i=0; i<size; i++) {
|
||||
SCM o = gh_vector_ref($input,gh_ulong2scm(i));
|
||||
SCM o = scm_vector_ref($input,scm_from_ulong(i));
|
||||
if (CHECK(o))
|
||||
(($1_type &)$1)[i] = (T)(CONVERT_FROM(o));
|
||||
else
|
||||
scm_wrong_type_arg(FUNC_NAME, $argnum, $input);
|
||||
}
|
||||
} else if (gh_null_p($input)) {
|
||||
} else if (scm_is_null($input)) {
|
||||
$1 = std::vector<T >();
|
||||
} else if (gh_pair_p($input)) {
|
||||
SCM v = gh_list_to_vector($input);
|
||||
unsigned long size = gh_vector_length(v);
|
||||
} else if (scm_is_pair($input)) {
|
||||
SCM v = scm_vector($input);
|
||||
unsigned long size = scm_c_vector_length(v);
|
||||
$1 = std::vector<T >(size);
|
||||
for (unsigned long i=0; i<size; i++) {
|
||||
SCM o = gh_vector_ref(v,gh_ulong2scm(i));
|
||||
SCM o = scm_vector_ref(v,scm_from_ulong(i));
|
||||
if (CHECK(o))
|
||||
(($1_type &)$1)[i] = (T)(CONVERT_FROM(o));
|
||||
else
|
||||
|
@ -260,27 +260,27 @@ namespace std {
|
|||
}
|
||||
%typemap(in) const vector<T>& (std::vector<T> temp),
|
||||
const vector<T>* (std::vector<T> temp) {
|
||||
if (gh_vector_p($input)) {
|
||||
unsigned long size = gh_vector_length($input);
|
||||
if (scm_is_vector($input)) {
|
||||
unsigned long size = scm_c_vector_length($input);
|
||||
temp = std::vector<T >(size);
|
||||
$1 = &temp;
|
||||
for (unsigned long i=0; i<size; i++) {
|
||||
SCM o = gh_vector_ref($input,gh_ulong2scm(i));
|
||||
SCM o = scm_vector_ref($input,scm_from_ulong(i));
|
||||
if (CHECK(o))
|
||||
temp[i] = (T)(CONVERT_FROM(o));
|
||||
else
|
||||
scm_wrong_type_arg(FUNC_NAME, $argnum, $input);
|
||||
}
|
||||
} else if (gh_null_p($input)) {
|
||||
} else if (scm_is_null($input)) {
|
||||
temp = std::vector<T >();
|
||||
$1 = &temp;
|
||||
} else if (gh_pair_p($input)) {
|
||||
SCM v = gh_list_to_vector($input);
|
||||
unsigned long size = gh_vector_length(v);
|
||||
} else if (scm_is_pair($input)) {
|
||||
SCM v = scm_vector($input);
|
||||
unsigned long size = scm_c_vector_length(v);
|
||||
temp = std::vector<T >(size);
|
||||
$1 = &temp;
|
||||
for (unsigned long i=0; i<size; i++) {
|
||||
SCM o = gh_vector_ref(v,gh_ulong2scm(i));
|
||||
SCM o = scm_vector_ref(v,scm_from_ulong(i));
|
||||
if (CHECK(o))
|
||||
temp[i] = (T)(CONVERT_FROM(o));
|
||||
else
|
||||
|
@ -291,32 +291,32 @@ namespace std {
|
|||
}
|
||||
}
|
||||
%typemap(out) vector<T> {
|
||||
$result = gh_make_vector(gh_long2scm($1.size()),SCM_UNSPECIFIED);
|
||||
$result = scm_make_vector(scm_from_long($1.size()),SCM_UNSPECIFIED);
|
||||
for (unsigned int i=0; i<$1.size(); i++) {
|
||||
SCM x = CONVERT_TO((($1_type &)$1)[i]);
|
||||
gh_vector_set_x($result,gh_long2scm(i),x);
|
||||
scm_vector_set_x($result,scm_from_long(i),x);
|
||||
}
|
||||
}
|
||||
%typecheck(SWIG_TYPECHECK_VECTOR) vector<T> {
|
||||
/* native sequence? */
|
||||
if (gh_vector_p($input)) {
|
||||
unsigned int size = gh_vector_length($input);
|
||||
if (scm_is_vector($input)) {
|
||||
unsigned int size = scm_c_vector_length($input);
|
||||
if (size == 0) {
|
||||
/* an empty sequence can be of any type */
|
||||
$1 = 1;
|
||||
} else {
|
||||
/* check the first element only */
|
||||
T* x;
|
||||
SCM o = gh_vector_ref($input,gh_ulong2scm(0));
|
||||
SCM o = scm_vector_ref($input,scm_from_ulong(0));
|
||||
$1 = CHECK(o) ? 1 : 0;
|
||||
}
|
||||
} else if (gh_null_p($input)) {
|
||||
} else if (scm_is_null($input)) {
|
||||
/* again, an empty sequence can be of any type */
|
||||
$1 = 1;
|
||||
} else if (gh_pair_p($input)) {
|
||||
} else if (scm_is_pair($input)) {
|
||||
/* check the first element only */
|
||||
T* x;
|
||||
SCM head = gh_car($input);
|
||||
SCM head = SCM_CAR($input);
|
||||
$1 = CHECK(head) ? 1 : 0;
|
||||
} else {
|
||||
/* wrapped vector? */
|
||||
|
@ -328,24 +328,24 @@ namespace std {
|
|||
%typecheck(SWIG_TYPECHECK_VECTOR) const vector<T>&,
|
||||
const vector<T>* {
|
||||
/* native sequence? */
|
||||
if (gh_vector_p($input)) {
|
||||
unsigned int size = gh_vector_length($input);
|
||||
if (scm_is_vector($input)) {
|
||||
unsigned int size = scm_c_vector_length($input);
|
||||
if (size == 0) {
|
||||
/* an empty sequence can be of any type */
|
||||
$1 = 1;
|
||||
} else {
|
||||
/* check the first element only */
|
||||
T* x;
|
||||
SCM o = gh_vector_ref($input,gh_ulong2scm(0));
|
||||
SCM o = scm_vector_ref($input,scm_from_ulong(0));
|
||||
$1 = CHECK(o) ? 1 : 0;
|
||||
}
|
||||
} else if (gh_null_p($input)) {
|
||||
} else if (scm_is_null($input)) {
|
||||
/* again, an empty sequence can be of any type */
|
||||
$1 = 1;
|
||||
} else if (gh_pair_p($input)) {
|
||||
} else if (scm_is_pair($input)) {
|
||||
/* check the first element only */
|
||||
T* x;
|
||||
SCM head = gh_car($input);
|
||||
SCM head = SCM_CAR($input);
|
||||
$1 = CHECK(head) ? 1 : 0;
|
||||
} else {
|
||||
/* wrapped vector? */
|
||||
|
@ -394,17 +394,17 @@ namespace std {
|
|||
};
|
||||
%enddef
|
||||
|
||||
specialize_stl_vector(bool,gh_boolean_p,gh_scm2bool,SWIG_bool2scm);
|
||||
specialize_stl_vector(char,gh_number_p,gh_scm2long,gh_long2scm);
|
||||
specialize_stl_vector(int,gh_number_p,gh_scm2long,gh_long2scm);
|
||||
specialize_stl_vector(long,gh_number_p,gh_scm2long,gh_long2scm);
|
||||
specialize_stl_vector(short,gh_number_p,gh_scm2long,gh_long2scm);
|
||||
specialize_stl_vector(unsigned char,gh_number_p,gh_scm2ulong,gh_ulong2scm);
|
||||
specialize_stl_vector(unsigned int,gh_number_p,gh_scm2ulong,gh_ulong2scm);
|
||||
specialize_stl_vector(unsigned long,gh_number_p,gh_scm2ulong,gh_ulong2scm);
|
||||
specialize_stl_vector(unsigned short,gh_number_p,gh_scm2ulong,gh_ulong2scm);
|
||||
specialize_stl_vector(float,gh_number_p,gh_scm2double,gh_double2scm);
|
||||
specialize_stl_vector(double,gh_number_p,gh_scm2double,gh_double2scm);
|
||||
specialize_stl_vector(std::string,gh_string_p,SWIG_scm2string,SWIG_string2scm);
|
||||
specialize_stl_vector(bool,scm_is_bool,scm_is_true,SWIG_bool2scm);
|
||||
specialize_stl_vector(char,scm_is_number,scm_to_long,scm_from_long);
|
||||
specialize_stl_vector(int,scm_is_number,scm_to_long,scm_from_long);
|
||||
specialize_stl_vector(long,scm_is_number,scm_to_long,scm_from_long);
|
||||
specialize_stl_vector(short,scm_is_number,scm_to_long,scm_from_long);
|
||||
specialize_stl_vector(unsigned char,scm_is_number,scm_to_ulong,scm_from_ulong);
|
||||
specialize_stl_vector(unsigned int,scm_is_number,scm_to_ulong,scm_from_ulong);
|
||||
specialize_stl_vector(unsigned long,scm_is_number,scm_to_ulong,scm_from_ulong);
|
||||
specialize_stl_vector(unsigned short,scm_is_number,scm_to_ulong,scm_from_ulong);
|
||||
specialize_stl_vector(float,scm_is_number,scm_to_double,scm_from_double);
|
||||
specialize_stl_vector(double,scm_is_number,scm_to_double,scm_from_double);
|
||||
specialize_stl_vector(std::string,scm_is_string,SWIG_scm2string,SWIG_string2scm);
|
||||
}
|
||||
|
||||
|
|
|
@ -60,26 +60,26 @@
|
|||
|
||||
%typemap(throws) SWIGTYPE {
|
||||
$<ype temp = new $ltype($1);
|
||||
scm_throw(gh_symbol2scm((char *) "swig-exception"),
|
||||
gh_list(SWIG_NewPointerObj(temp, $&descriptor, 1),
|
||||
scm_throw(scm_str2symbol((char *) "swig-exception"),
|
||||
scm_listify(SWIG_NewPointerObj(temp, $&descriptor, 1),
|
||||
SCM_UNDEFINED));
|
||||
}
|
||||
|
||||
%typemap(throws) SWIGTYPE & {
|
||||
scm_throw(gh_symbol2scm((char *) "swig-exception"),
|
||||
gh_list(SWIG_NewPointerObj(&$1, $descriptor, 1),
|
||||
scm_throw(scm_str2symbol((char *) "swig-exception"),
|
||||
scm_listify(SWIG_NewPointerObj(&$1, $descriptor, 1),
|
||||
SCM_UNDEFINED));
|
||||
}
|
||||
|
||||
%typemap(throws) SWIGTYPE * {
|
||||
scm_throw(gh_symbol2scm((char *) "swig-exception"),
|
||||
gh_list(SWIG_NewPointerObj($1, $descriptor, 1),
|
||||
scm_throw(scm_str2symbol((char *) "swig-exception"),
|
||||
scm_listify(SWIG_NewPointerObj($1, $descriptor, 1),
|
||||
SCM_UNDEFINED));
|
||||
}
|
||||
|
||||
%typemap(throws) SWIGTYPE [] {
|
||||
scm_throw(gh_symbol2scm((char *) "swig-exception"),
|
||||
gh_list(SWIG_NewPointerObj($1, $descriptor, 1),
|
||||
scm_throw(scm_str2symbol((char *) "swig-exception"),
|
||||
scm_listify(SWIG_NewPointerObj($1, $descriptor, 1),
|
||||
SCM_UNDEFINED));
|
||||
}
|
||||
|
||||
|
@ -146,7 +146,7 @@
|
|||
|
||||
/* Enums */
|
||||
|
||||
%typemap(in) enum SWIGTYPE { $1 = ($1_type) gh_scm2int($input); }
|
||||
%typemap(in) enum SWIGTYPE { $1 = ($1_type) scm_to_int($input); }
|
||||
/* The complicated construction below needed to deal with anonymous
|
||||
enums, which cannot be cast to. */
|
||||
%typemap(varin) enum SWIGTYPE {
|
||||
|
@ -156,13 +156,13 @@
|
|||
(char *) "enum variable '$name' cannot be set",
|
||||
SCM_EOL, SCM_BOOL_F);
|
||||
}
|
||||
* (int *) &($1) = gh_scm2int($input);
|
||||
* (int *) &($1) = scm_to_int($input);
|
||||
}
|
||||
%typemap(out) enum SWIGTYPE { $result = gh_int2scm($1); }
|
||||
%typemap(varout) enum SWIGTYPE { $result = gh_int2scm($1); }
|
||||
%typemap(out) enum SWIGTYPE { $result = scm_from_long($1); }
|
||||
%typemap(varout) enum SWIGTYPE { $result = scm_from_long($1); }
|
||||
%typemap(throws) enum SWIGTYPE {
|
||||
scm_throw(gh_symbol2scm((char *) "swig-exception"),
|
||||
gh_list(gh_int2scm($1), SCM_UNDEFINED));
|
||||
scm_throw(scm_str2symbol((char *) "swig-exception"),
|
||||
scm_listify(scm_from_long($1), SCM_UNDEFINED));
|
||||
}
|
||||
|
||||
/* The SIMPLE_MAP_WITH_EXPR macro below defines the whole set of
|
||||
|
@ -210,8 +210,8 @@
|
|||
/* Throw typemap */
|
||||
%typemap(throws) C_NAME {
|
||||
C_NAME swig_c_value = $1;
|
||||
scm_throw(gh_symbol2scm((char *) "swig-exception"),
|
||||
gh_list(C_TO_SCM_EXPR, SCM_UNDEFINED));
|
||||
scm_throw(scm_str2symbol((char *) "swig-exception"),
|
||||
scm_listify(C_TO_SCM_EXPR, SCM_UNDEFINED));
|
||||
}
|
||||
%enddef
|
||||
|
||||
|
@ -254,34 +254,34 @@
|
|||
}
|
||||
/* Throw typemap */
|
||||
%typemap(throws) C_NAME {
|
||||
scm_throw(gh_symbol2scm((char *) "swig-exception"),
|
||||
gh_list(C_TO_SCM($1), SCM_UNDEFINED));
|
||||
scm_throw(scm_str2symbol((char *) "swig-exception"),
|
||||
scm_listify(C_TO_SCM($1), SCM_UNDEFINED));
|
||||
}
|
||||
%enddef
|
||||
|
||||
SIMPLE_MAP(bool, gh_scm2bool, gh_bool2scm, boolean);
|
||||
SIMPLE_MAP(char, gh_scm2char, gh_char2scm, char);
|
||||
SIMPLE_MAP(unsigned char, gh_scm2char, gh_char2scm, char);
|
||||
SIMPLE_MAP(signed char, gh_scm2char, gh_char2scm, char);
|
||||
SIMPLE_MAP(int, gh_scm2int, gh_int2scm, integer);
|
||||
SIMPLE_MAP(short, gh_scm2short, gh_int2scm, integer);
|
||||
SIMPLE_MAP(long, gh_scm2long, gh_long2scm, integer);
|
||||
SIMPLE_MAP(ptrdiff_t, gh_scm2long, gh_long2scm, integer);
|
||||
SIMPLE_MAP(unsigned int, gh_scm2uint, gh_ulong2scm, integer);
|
||||
SIMPLE_MAP(unsigned short, gh_scm2ushort, gh_ulong2scm, integer);
|
||||
SIMPLE_MAP(unsigned long, gh_scm2ulong, gh_ulong2scm, integer);
|
||||
SIMPLE_MAP(size_t, gh_scm2ulong, gh_ulong2scm, integer);
|
||||
SIMPLE_MAP(float, gh_scm2double, gh_double2scm, real);
|
||||
SIMPLE_MAP(double, gh_scm2double, gh_double2scm, real);
|
||||
// SIMPLE_MAP(char *, SWIG_scm2str, gh_str02scm, string);
|
||||
// SIMPLE_MAP(const char *, SWIG_scm2str, gh_str02scm, string);
|
||||
SIMPLE_MAP(bool, scm_is_true, scm_from_bool, boolean);
|
||||
SIMPLE_MAP(char, SCM_CHAR, SCM_MAKE_CHAR, char);
|
||||
SIMPLE_MAP(unsigned char, SCM_CHAR, SCM_MAKE_CHAR, char);
|
||||
SIMPLE_MAP(signed char, SCM_CHAR, SCM_MAKE_CHAR, char);
|
||||
SIMPLE_MAP(int, scm_to_int, scm_from_long, integer);
|
||||
SIMPLE_MAP(short, scm_to_short, scm_from_long, integer);
|
||||
SIMPLE_MAP(long, scm_to_long, scm_from_long, integer);
|
||||
SIMPLE_MAP(ptrdiff_t, scm_to_long, scm_from_long, integer);
|
||||
SIMPLE_MAP(unsigned int, scm_to_uint, scm_from_ulong, integer);
|
||||
SIMPLE_MAP(unsigned short, scm_to_ushort, scm_from_ulong, integer);
|
||||
SIMPLE_MAP(unsigned long, scm_to_ulong, scm_from_ulong, integer);
|
||||
SIMPLE_MAP(size_t, scm_to_ulong, scm_from_ulong, integer);
|
||||
SIMPLE_MAP(float, scm_to_double, scm_from_double, real);
|
||||
SIMPLE_MAP(double, scm_to_double, scm_from_double, real);
|
||||
// SIMPLE_MAP(char *, SWIG_scm2str, SWIG_str02scm, string);
|
||||
// SIMPLE_MAP(const char *, SWIG_scm2str, SWIG_str02scm, string);
|
||||
|
||||
/* Define long long typemaps -- uses functions that are only defined
|
||||
in recent versions of Guile, availability also depends on Guile's
|
||||
configuration. */
|
||||
|
||||
SIMPLE_MAP(long long, gh_scm2long_long, gh_long_long2scm, integer);
|
||||
SIMPLE_MAP(unsigned long long, gh_scm2ulong_long, gh_ulong_long2scm, integer);
|
||||
SIMPLE_MAP(long long, scm_to_long_long, scm_from_long_long, integer);
|
||||
SIMPLE_MAP(unsigned long long, scm_to_ulong_long, scm_from_ulong_long, integer);
|
||||
|
||||
/* Strings */
|
||||
|
||||
|
@ -290,8 +290,8 @@ SIMPLE_MAP(unsigned long long, gh_scm2ulong_long, gh_ulong_long2scm, integer);
|
|||
must_free = 1;
|
||||
}
|
||||
%typemap (varin, doc="NEW-VALUE is a string") char * {$1 = ($1_ltype)SWIG_scm2str($input);}
|
||||
%typemap (out, doc="<string>") char * {$result = gh_str02scm((const char *)$1);}
|
||||
%typemap (varout, doc="<string>") char * {$result = gh_str02scm($1);}
|
||||
%typemap (out, doc="<string>") char * {$result = SWIG_str02scm((const char *)$1);}
|
||||
%typemap (varout, doc="<string>") char * {$result = SWIG_str02scm($1);}
|
||||
%typemap (in, doc="$NAME is a string") char **INPUT(char * temp, int must_free = 0) {
|
||||
temp = (char *) SWIG_scm2str($input); $1 = &temp;
|
||||
must_free = 1;
|
||||
|
@ -299,7 +299,7 @@ SIMPLE_MAP(unsigned long long, gh_scm2ulong_long, gh_ulong_long2scm, integer);
|
|||
%typemap (in,numinputs=0) char **OUTPUT (char * temp)
|
||||
{$1 = &temp;}
|
||||
%typemap (argout,doc="$NAME (a string)") char **OUTPUT
|
||||
{SWIG_APPEND_VALUE(gh_str02scm(*$1));}
|
||||
{SWIG_APPEND_VALUE(SWIG_str02scm(*$1));}
|
||||
%typemap (in) char **BOTH = char **INPUT;
|
||||
%typemap (argout) char **BOTH = char **OUTPUT;
|
||||
%typemap (in) char **INOUT = char **INPUT;
|
||||
|
@ -329,8 +329,8 @@ SIMPLE_MAP(unsigned long long, gh_scm2ulong_long, gh_ulong_long2scm, integer);
|
|||
}
|
||||
|
||||
%typemap(throws) char * {
|
||||
scm_throw(gh_symbol2scm((char *) "swig-exception"),
|
||||
gh_list(gh_str02scm($1), SCM_UNDEFINED));
|
||||
scm_throw(scm_str2symbol((char *) "swig-exception"),
|
||||
scm_listify(SWIG_str02scm($1), SCM_UNDEFINED));
|
||||
}
|
||||
|
||||
/* Void */
|
||||
|
@ -350,7 +350,7 @@ typedef unsigned long SCM;
|
|||
|
||||
%typemap(in) (char *STRING, int LENGTH), (char *STRING, size_t LENGTH) {
|
||||
size_t temp;
|
||||
$1 = ($1_ltype) gh_scm2newstr($input, &temp);
|
||||
$1 = ($1_ltype) SWIG_Guile_scm2newstr($input, &temp);
|
||||
$2 = ($2_ltype) temp;
|
||||
}
|
||||
|
||||
|
|
|
@ -279,7 +279,7 @@ REF_MAP(double, SCHEME_REALP, scheme_real_to_double,
|
|||
|
||||
//%typemap(in) (char *STRING, int LENGTH) {
|
||||
// int temp;
|
||||
// $1 = ($1_ltype) gh_scm2newstr($input, &temp);
|
||||
// $1 = ($1_ltype) SWIG_Guile_scm2newstr($input, &temp);
|
||||
// $2 = ($2_ltype) temp;
|
||||
//}
|
||||
|
||||
|
|
|
@ -59,7 +59,6 @@ skip-tcl = test -n "@SKIP_TCL@"
|
|||
skip-perl5 = test -n "@SKIP_PERL5@"
|
||||
skip-python = test -n "@SKIP_PYTHON@"
|
||||
skip-java = test -n "@SKIP_JAVA@"
|
||||
skip-guilegh = test -n "@SKIP_GUILEGH@"
|
||||
skip-guile = test -n "@SKIP_GUILE@"
|
||||
skip-mzscheme = test -n "@SKIP_MZSCHEME@"
|
||||
skip-ruby = test -n "@SKIP_RUBY@"
|
||||
|
@ -247,7 +246,6 @@ check-test-suite: \
|
|||
check-perl5-test-suite \
|
||||
check-python-test-suite \
|
||||
check-java-test-suite \
|
||||
check-guilegh-test-suite \
|
||||
check-guile-test-suite \
|
||||
check-mzscheme-test-suite \
|
||||
check-ruby-test-suite \
|
||||
|
@ -300,7 +298,6 @@ all-test-suite: \
|
|||
all-perl5-test-suite \
|
||||
all-python-test-suite \
|
||||
all-java-test-suite \
|
||||
all-guilegh-test-suite \
|
||||
all-guile-test-suite \
|
||||
all-mzscheme-test-suite \
|
||||
all-ruby-test-suite \
|
||||
|
@ -329,7 +326,6 @@ broken-test-suite: \
|
|||
broken-perl5-test-suite \
|
||||
broken-python-test-suite \
|
||||
broken-java-test-suite \
|
||||
broken-guilegh-test-suite \
|
||||
broken-guile-test-suite \
|
||||
broken-mzscheme-test-suite \
|
||||
broken-ruby-test-suite \
|
||||
|
|
|
@ -23,7 +23,6 @@ Guile Options (available with -guile)\n\
|
|||
-emitslotaccessors - Emit accessor methods for all GOOPS slots\n" "\
|
||||
-exportprimitive - Add the (export ...) code from scmstub into the\n\
|
||||
GOOPS file.\n\
|
||||
-gh - Use the gh_ Guile API. (Guile <= 1.8) \n\
|
||||
-goopsprefix <prefix> - Prepend <prefix> to all goops identifiers\n\
|
||||
-linkage <lstyle> - Use linkage protocol <lstyle> (default `simple')\n\
|
||||
Use `module' for native Guile module linking\n\
|
||||
|
@ -44,10 +43,14 @@ Guile Options (available with -guile)\n\
|
|||
-proxy - Export GOOPS class definitions\n\
|
||||
-primsuffix <suffix> - Name appended to primitive module when exporting\n\
|
||||
GOOPS classes. (default = \"primitive\")\n\
|
||||
-scm - Use the scm Guile API. (Guile >= 1.6, default) \n\
|
||||
-scmstub - Output Scheme file with module declaration and\n\
|
||||
exports; only with `passive' and `simple' linkage\n\
|
||||
-useclassprefix - Prepend the class name to all goops identifiers\n\
|
||||
\n\
|
||||
Obsolete parameters:\n\
|
||||
These parameters do nothing, but are kept for compatibility with old scripts only.\n\
|
||||
-gh - Was used to select the gh_ Guile API. \n\
|
||||
-scm - scm Guile API is always used now. \n\
|
||||
\n";
|
||||
|
||||
static File *f_begin = 0;
|
||||
|
@ -94,7 +97,6 @@ static String *return_multi_doc = 0;
|
|||
|
||||
static String *exported_symbols = 0;
|
||||
|
||||
static int use_scm_interface = 1;
|
||||
static int exporting_destructor = 0;
|
||||
static String *swigtype_ptr = 0;
|
||||
|
||||
|
@ -216,10 +218,8 @@ public:
|
|||
goops = true;
|
||||
Swig_mark_arg(i);
|
||||
} else if (strcmp(argv[i], "-gh") == 0) {
|
||||
use_scm_interface = 0;
|
||||
Swig_mark_arg(i);
|
||||
} else if (strcmp(argv[i], "-scm") == 0) {
|
||||
use_scm_interface = 1;
|
||||
Swig_mark_arg(i);
|
||||
} else if (strcmp(argv[i], "-primsuffix") == 0) {
|
||||
if (argv[i + 1]) {
|
||||
|
@ -285,10 +285,7 @@ public:
|
|||
/* Add a symbol for this module */
|
||||
Preprocessor_define("SWIGGUILE 1", 0);
|
||||
/* Read in default typemaps */
|
||||
if (use_scm_interface)
|
||||
SWIG_config_file("guile_scm.swg");
|
||||
else
|
||||
SWIG_config_file("guile_gh.swg");
|
||||
SWIG_config_file("guile_scm.swg");
|
||||
allow_overloading();
|
||||
|
||||
}
|
||||
|
@ -331,13 +328,6 @@ public:
|
|||
Printf(f_runtime, "\n");
|
||||
Printf(f_runtime, "#define SWIGGUILE\n");
|
||||
|
||||
if (!use_scm_interface) {
|
||||
if (SwigRuntime == 1)
|
||||
Printf(f_runtime, "#define SWIG_GLOBAL\n");
|
||||
if (SwigRuntime == 2)
|
||||
Printf(f_runtime, "#define SWIG_NOINCLUDE\n");
|
||||
}
|
||||
|
||||
/* Write out directives and declarations */
|
||||
|
||||
module = Swig_copy_string(Char(Getattr(n, "name")));
|
||||
|
@ -851,7 +841,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
if (use_scm_interface && exporting_destructor) {
|
||||
if (exporting_destructor) {
|
||||
/* Mark the destructor's argument as destroyed. */
|
||||
String *tm = NewString("SWIG_Guile_MarkPointerDestroyed($input);");
|
||||
Replaceall(tm, "$input", Getattr(l, "emit:input"));
|
||||
|
@ -868,14 +858,8 @@ public:
|
|||
Printv(f->def, "#define FUNC_NAME \"", proc_name, "\"", NIL);
|
||||
|
||||
// Now write code to make the function call
|
||||
if (!use_scm_interface)
|
||||
Printv(f->code, tab4, "gh_defer_ints();\n", NIL);
|
||||
|
||||
String *actioncode = emit_action(n);
|
||||
|
||||
if (!use_scm_interface)
|
||||
Printv(actioncode, tab4, "gh_allow_ints();\n", NIL);
|
||||
|
||||
// Now have return value, figure out what to do with it.
|
||||
if ((tm = Swig_typemap_lookup_out("out", n, Swig_cresult_name(), f, actioncode))) {
|
||||
Replaceall(tm, "$result", "gswig_result");
|
||||
|
@ -958,11 +942,7 @@ public:
|
|||
Printv(f_wrappers, ");\n", NIL);
|
||||
Printv(f_wrappers, "}\n", NIL);
|
||||
/* Register it */
|
||||
if (use_scm_interface) {
|
||||
Printf(f_init, "scm_c_define_gsubr(\"%s\", 0, 0, 1, (swig_guile_proc) %s_rest);\n", proc_name, wname);
|
||||
} else {
|
||||
Printf(f_init, "gh_new_procedure(\"%s\", (swig_guile_proc) %s_rest, 0, 0, 1);\n", proc_name, wname);
|
||||
}
|
||||
Printf(f_init, "scm_c_define_gsubr(\"%s\", 0, 0, 1, (swig_guile_proc) %s_rest);\n", proc_name, wname);
|
||||
} else if (emit_setters && struct_member && strlen(Char(proc_name)) > 3) {
|
||||
int len = Len(proc_name);
|
||||
const char *pc = Char(proc_name);
|
||||
|
@ -973,19 +953,13 @@ public:
|
|||
struct_member = 2; /* have a setter */
|
||||
} else
|
||||
Printf(f_init, "SCM getter = ");
|
||||
if (use_scm_interface) {
|
||||
/* GOOPS support uses the MEMBER-set and MEMBER-get functions,
|
||||
so ignore only_setters in this case. */
|
||||
if (only_setters && !goops)
|
||||
Printf(f_init, "scm_c_make_gsubr(\"%s\", %d, %d, 0, (swig_guile_proc) %s);\n", proc_name, numreq, numargs - numreq, wname);
|
||||
else
|
||||
Printf(f_init, "scm_c_define_gsubr(\"%s\", %d, %d, 0, (swig_guile_proc) %s);\n", proc_name, numreq, numargs - numreq, wname);
|
||||
} else {
|
||||
if (only_setters && !goops)
|
||||
Printf(f_init, "scm_make_gsubr(\"%s\", %d, %d, 0, (swig_guile_proc) %s);\n", proc_name, numreq, numargs - numreq, wname);
|
||||
else
|
||||
Printf(f_init, "gh_new_procedure(\"%s\", (swig_guile_proc) %s, %d, %d, 0);\n", proc_name, wname, numreq, numargs - numreq);
|
||||
}
|
||||
/* GOOPS support uses the MEMBER-set and MEMBER-get functions,
|
||||
so ignore only_setters in this case. */
|
||||
if (only_setters && !goops)
|
||||
Printf(f_init, "scm_c_make_gsubr(\"%s\", %d, %d, 0, (swig_guile_proc) %s);\n", proc_name, numreq, numargs - numreq, wname);
|
||||
else
|
||||
Printf(f_init, "scm_c_define_gsubr(\"%s\", %d, %d, 0, (swig_guile_proc) %s);\n", proc_name, numreq, numargs - numreq, wname);
|
||||
|
||||
if (!is_setter) {
|
||||
/* Strip off "-get" */
|
||||
char *pws_name = (char *) malloc(sizeof(char) * (len - 3));
|
||||
|
@ -993,19 +967,11 @@ public:
|
|||
pws_name[len - 4] = 0;
|
||||
if (struct_member == 2) {
|
||||
/* There was a setter, so create a procedure with setter */
|
||||
if (use_scm_interface) {
|
||||
Printf(f_init, "scm_c_define");
|
||||
} else {
|
||||
Printf(f_init, "gh_define");
|
||||
}
|
||||
Printf(f_init, "scm_c_define");
|
||||
Printf(f_init, "(\"%s\", " "scm_make_procedure_with_setter(getter, setter));\n", pws_name);
|
||||
} else {
|
||||
/* There was no setter, so make an alias to the getter */
|
||||
if (use_scm_interface) {
|
||||
Printf(f_init, "scm_c_define");
|
||||
} else {
|
||||
Printf(f_init, "gh_define");
|
||||
}
|
||||
Printf(f_init, "scm_c_define");
|
||||
Printf(f_init, "(\"%s\", getter);\n", pws_name);
|
||||
}
|
||||
Printf(exported_symbols, "\"%s\", ", pws_name);
|
||||
|
@ -1013,15 +979,11 @@ public:
|
|||
}
|
||||
} else {
|
||||
/* Register the function */
|
||||
if (use_scm_interface) {
|
||||
if (exporting_destructor) {
|
||||
Printf(f_init, "((swig_guile_clientdata *)(SWIGTYPE%s->clientdata))->destroy = (guile_destructor) %s;\n", swigtype_ptr, wname);
|
||||
//Printf(f_init, "SWIG_TypeClientData(SWIGTYPE%s, (void *) %s);\n", swigtype_ptr, wname);
|
||||
}
|
||||
Printf(f_init, "scm_c_define_gsubr(\"%s\", %d, %d, 0, (swig_guile_proc) %s);\n", proc_name, numreq, numargs - numreq, wname);
|
||||
} else {
|
||||
Printf(f_init, "gh_new_procedure(\"%s\", (swig_guile_proc) %s, %d, %d, 0);\n", proc_name, wname, numreq, numargs - numreq);
|
||||
if (exporting_destructor) {
|
||||
Printf(f_init, "((swig_guile_clientdata *)(SWIGTYPE%s->clientdata))->destroy = (guile_destructor) %s;\n", swigtype_ptr, wname);
|
||||
//Printf(f_init, "SWIG_TypeClientData(SWIGTYPE%s, (void *) %s);\n", swigtype_ptr, wname);
|
||||
}
|
||||
Printf(f_init, "scm_c_define_gsubr(\"%s\", %d, %d, 0, (swig_guile_proc) %s);\n", proc_name, numreq, numargs - numreq, wname);
|
||||
}
|
||||
} else { /* overloaded function; don't export the single methods */
|
||||
if (!Getattr(n, "sym:nextSibling")) {
|
||||
|
@ -1044,11 +1006,7 @@ public:
|
|||
Printf(df->code, "#undef FUNC_NAME\n");
|
||||
Printv(df->code, "}\n", NIL);
|
||||
Wrapper_print(df, f_wrappers);
|
||||
if (use_scm_interface) {
|
||||
Printf(f_init, "scm_c_define_gsubr(\"%s\", 0, 0, 1, (swig_guile_proc) %s);\n", proc_name, dname);
|
||||
} else {
|
||||
Printf(f_init, "gh_new_procedure(\"%s\", (swig_guile_proc) %s, 0, 0, 1);\n", proc_name, dname);
|
||||
}
|
||||
Printf(f_init, "scm_c_define_gsubr(\"%s\", 0, 0, 1, (swig_guile_proc) %s);\n", proc_name, dname);
|
||||
DelWrapper(df);
|
||||
Delete(dispatch);
|
||||
Delete(dname);
|
||||
|
@ -1221,36 +1179,27 @@ public:
|
|||
/* Read-only variables become a simple procedure returning the
|
||||
value; read-write variables become a simple procedure with
|
||||
an optional argument. */
|
||||
if (use_scm_interface) {
|
||||
|
||||
if (!goops && GetFlag(n, "feature:constasvar")) {
|
||||
/* need to export this function as a variable instead of a procedure */
|
||||
if (scmstub) {
|
||||
/* export the function in the wrapper, and (set!) it in scmstub */
|
||||
Printf(f_init, "scm_c_define_gsubr(\"%s\", 0, %d, 0, (swig_guile_proc) %s);\n", proc_name, !GetFlag(n, "feature:immutable"), var_name);
|
||||
Printf(scmtext, "(set! %s (%s))\n", proc_name, proc_name);
|
||||
} else {
|
||||
/* export the variable directly */
|
||||
Printf(f_init, "scm_c_define(\"%s\", %s(SCM_UNDEFINED));\n", proc_name, var_name);
|
||||
}
|
||||
|
||||
} else {
|
||||
/* Export the function as normal */
|
||||
if (!goops && GetFlag(n, "feature:constasvar")) {
|
||||
/* need to export this function as a variable instead of a procedure */
|
||||
if (scmstub) {
|
||||
/* export the function in the wrapper, and (set!) it in scmstub */
|
||||
Printf(f_init, "scm_c_define_gsubr(\"%s\", 0, %d, 0, (swig_guile_proc) %s);\n", proc_name, !GetFlag(n, "feature:immutable"), var_name);
|
||||
Printf(scmtext, "(set! %s (%s))\n", proc_name, proc_name);
|
||||
} else {
|
||||
/* export the variable directly */
|
||||
Printf(f_init, "scm_c_define(\"%s\", %s(SCM_UNDEFINED));\n", proc_name, var_name);
|
||||
}
|
||||
|
||||
} else {
|
||||
Printf(f_init, "\t gh_new_procedure(\"%s\", (swig_guile_proc) %s, 0, %d, 0);\n", proc_name, var_name, !GetFlag(n, "feature:immutable"));
|
||||
/* Export the function as normal */
|
||||
Printf(f_init, "scm_c_define_gsubr(\"%s\", 0, %d, 0, (swig_guile_proc) %s);\n", proc_name, !GetFlag(n, "feature:immutable"), var_name);
|
||||
}
|
||||
|
||||
} else {
|
||||
/* Read/write variables become a procedure with setter. */
|
||||
if (use_scm_interface) {
|
||||
Printf(f_init, "{ SCM p = scm_c_define_gsubr(\"%s\", 0, 1, 0, (swig_guile_proc) %s);\n", proc_name, var_name);
|
||||
Printf(f_init, "scm_c_define");
|
||||
} else {
|
||||
Printf(f_init, "\t{ SCM p = gh_new_procedure(\"%s\", (swig_guile_proc) %s, 0, 1, 0);\n", proc_name, var_name);
|
||||
Printf(f_init, "gh_define");
|
||||
}
|
||||
Printf(f_init, "{ SCM p = scm_c_define_gsubr(\"%s\", 0, 1, 0, (swig_guile_proc) %s);\n", proc_name, var_name);
|
||||
Printf(f_init, "scm_c_define");
|
||||
Printf(f_init, "(\"%s\", " "scm_make_procedure_with_setter(p, p)); }\n", proc_name);
|
||||
}
|
||||
Printf(exported_symbols, "\"%s\", ", proc_name);
|
||||
|
@ -1484,12 +1433,10 @@ public:
|
|||
|
||||
String *mangled_classname = Swig_name_mangle(Getattr(n, "sym:name"));
|
||||
/* Export clientdata structure */
|
||||
if (use_scm_interface) {
|
||||
Printf(f_runtime, "static swig_guile_clientdata _swig_guile_clientdata%s = { NULL, SCM_EOL };\n", mangled_classname);
|
||||
Printf(f_runtime, "static swig_guile_clientdata _swig_guile_clientdata%s = { NULL, SCM_EOL };\n", mangled_classname);
|
||||
|
||||
Printv(f_init, "SWIG_TypeClientData(SWIGTYPE", swigtype_ptr, ", (void *) &_swig_guile_clientdata", mangled_classname, ");\n", NIL);
|
||||
SwigType_remember(ct);
|
||||
}
|
||||
Printv(f_init, "SWIG_TypeClientData(SWIGTYPE", swigtype_ptr, ", (void *) &_swig_guile_clientdata", mangled_classname, ");\n", NIL);
|
||||
SwigType_remember(ct);
|
||||
Delete(ct);
|
||||
|
||||
/* Emit all of the members */
|
||||
|
@ -1725,28 +1672,16 @@ public:
|
|||
|
||||
String *runtimeCode() {
|
||||
String *s;
|
||||
if (use_scm_interface) {
|
||||
s = Swig_include_sys("guile_scm_run.swg");
|
||||
if (!s) {
|
||||
Printf(stderr, "*** Unable to open 'guile_scm_run.swg");
|
||||
s = NewString("");
|
||||
}
|
||||
} else {
|
||||
s = Swig_include_sys("guile_gh_run.swg");
|
||||
if (!s) {
|
||||
Printf(stderr, "*** Unable to open 'guile_gh_run.swg");
|
||||
s = NewString("");
|
||||
}
|
||||
s = Swig_include_sys("guile_scm_run.swg");
|
||||
if (!s) {
|
||||
Printf(stderr, "*** Unable to open 'guile_scm_run.swg");
|
||||
s = NewString("");
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
String *defaultExternalRuntimeFilename() {
|
||||
if (use_scm_interface) {
|
||||
return NewString("swigguilerun.h");
|
||||
} else {
|
||||
return NewString("swigguileghrun.h");
|
||||
}
|
||||
return NewString("swigguilerun.h");
|
||||
}
|
||||
};
|
||||
|
||||
|
|
18
configure.ac
18
configure.ac
|
@ -1239,15 +1239,7 @@ else
|
|||
CFLAGS="`echo $CFLAGS | sed 's/-ansi//g;s/-pedantic//g;'` $GUILE_CFLAGS"
|
||||
LIBS="$LIBS $GUILE_LIBS"
|
||||
|
||||
AC_MSG_CHECKING(whether Guile's gh_ API works)
|
||||
AC_LINK_IFELSE([AC_LANG_SOURCE([#include <guile/gh.h>
|
||||
int main() { SCM s; return gh_scm2int(s); }])], GUILE_GH_INTERFACE=1, )
|
||||
if test -n "$GUILE_GH_INTERFACE" ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
AC_MSG_CHECKING(whether Guile's SCM_ API works)
|
||||
AC_MSG_CHECKING(whether Guile/SCM_ API works)
|
||||
AC_LINK_IFELSE([AC_LANG_SOURCE([#include <libguile.h>
|
||||
int main() { SCM s; scm_slot_exists_p(SCM_BOOL_F, SCM_BOOL_F); return SCM_STRING_LENGTH(s); }])], GUILE_SCM_INTERFACE=1, )
|
||||
if test -n "$GUILE_SCM_INTERFACE" ; then
|
||||
|
@ -1265,7 +1257,6 @@ fi
|
|||
AC_SUBST(GUILE)
|
||||
AC_SUBST(GUILE_CFLAGS)
|
||||
AC_SUBST(GUILE_LIBS)
|
||||
AC_SUBST(GUILE_GH_INTERFACE)
|
||||
AC_SUBST(GUILE_SCM_INTERFACE)
|
||||
|
||||
#----------------------------------------------------------------
|
||||
|
@ -2271,12 +2262,6 @@ if test -z "$GUILE_CFLAGS" || test -z "$GUILE_LIBS" || test -z "$GUILE_SCM_INTER
|
|||
fi
|
||||
AC_SUBST(SKIP_GUILE)
|
||||
|
||||
SKIP_GUILEGH=
|
||||
if test -z "$GUILE_CFLAGS" || test -z "$GUILE_LIBS" || test -z "$GUILE_GH_INTERFACE"; then
|
||||
SKIP_GUILEGH="1"
|
||||
fi
|
||||
AC_SUBST(SKIP_GUILEGH)
|
||||
|
||||
|
||||
SKIP_MZSCHEME=
|
||||
if test -z "$MZC" || test -z "$MZDYNOBJ" ; then
|
||||
|
@ -2452,7 +2437,6 @@ AC_CONFIG_FILES([ \
|
|||
Examples/test-suite/csharp/Makefile \
|
||||
Examples/test-suite/d/Makefile \
|
||||
Examples/test-suite/guile/Makefile \
|
||||
Examples/test-suite/guilegh/Makefile \
|
||||
Examples/test-suite/java/Makefile \
|
||||
Examples/test-suite/mzscheme/Makefile \
|
||||
Examples/test-suite/ocaml/Makefile \
|
||||
|
|
Loading…
Reference in New Issue