Merge branch 'master' into gsoc2009-matevz
Conflicts: Examples/Makefile.in Examples/guile/Makefile.in Lib/php/php.swg Makefile.in Source/CParse/parser.y configure.ac
This commit is contained in:
commit
bcb7aee022
585 changed files with 9528 additions and 12959 deletions
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
co::
|
||||
co:
|
||||
co RCS/*.i* RCS/*.swg*
|
||||
|
||||
|
|
|
|||
|
|
@ -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_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
|
||||
#define gh_int2scm scm_long2num
|
||||
#define gh_length(lst) scm_num2ulong(scm_length(lst), SCM_ARG1, FUNC_NAME)
|
||||
#define gh_list scm_listify
|
||||
#define gh_list_to_vector scm_vector
|
||||
#define gh_make_vector scm_make_vector
|
||||
#define gh_null_p SCM_NULLP
|
||||
#define gh_number_p SCM_NUMBERP
|
||||
#define gh_pair_p SCM_CONSP
|
||||
#define gh_scm2bool SCM_NFALSEP
|
||||
#define gh_scm2char SCM_CHAR
|
||||
#define gh_scm2double(a) scm_num2dbl(a, FUNC_NAME)
|
||||
#define gh_scm2int(a) scm_num2int(a, SCM_ARG1, FUNC_NAME)
|
||||
#define gh_scm2long(a) scm_num2long(a, SCM_ARG1, FUNC_NAME)
|
||||
#define gh_scm2short(a) scm_num2short(a, SCM_ARG1, FUNC_NAME)
|
||||
#define gh_scm2newstr SWIG_Guile_scm2newstr
|
||||
#define gh_scm2ulong(a) scm_num2ulong(a, SCM_ARG1, FUNC_NAME)
|
||||
#define gh_scm2ushort(a) scm_num2ushort(a, SCM_ARG1, FUNC_NAME)
|
||||
#define gh_scm2uint(a) scm_num2uint(a, SCM_ARG1, FUNC_NAME)
|
||||
#define gh_ulong2scm scm_ulong2num
|
||||
#define gh_long2scm scm_long2num
|
||||
#define gh_str02scm scm_makfrom0str
|
||||
#define gh_long_long2scm scm_long_long2num
|
||||
#define gh_scm2long_long(a) scm_num2long_long(a, SCM_ARG1, FUNC_NAME)
|
||||
#define gh_ulong_long2scm scm_ulong_long2num
|
||||
#define gh_scm2ulong_long(a) scm_num2ulong_long(a, SCM_ARG1, FUNC_NAME)
|
||||
#define gh_string_p SCM_STRINGP
|
||||
#define gh_vector_length SCM_VECTOR_LENGTH
|
||||
#define gh_vector_p SCM_VECTORP
|
||||
#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,258 +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
|
||||
|
||||
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_NULLP(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_NULLP(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
|
||||
|
||||
%}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,28 @@
|
|||
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 */
|
||||
#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
|
||||
|
||||
#if SCM_MAJOR_VERSION >= 2
|
||||
// scm_c_define_gsubr takes a different parameter type
|
||||
// depending on the guile version
|
||||
|
||||
typedef scm_t_subr swig_guile_proc;
|
||||
#else
|
||||
typedef SCM (*swig_guile_proc)();
|
||||
#endif
|
||||
typedef SCM (*guile_destructor)(SCM);
|
||||
|
||||
typedef struct swig_guile_clientdata {
|
||||
|
|
@ -22,10 +43,12 @@ typedef struct swig_guile_clientdata {
|
|||
|
||||
#define SWIG_scm2str(s) \
|
||||
SWIG_Guile_scm2newstr(s, NULL)
|
||||
#define SWIG_malloc(size) \
|
||||
SCM_MUST_MALLOC(size)
|
||||
#define SWIG_free(mem) \
|
||||
scm_must_free(mem)
|
||||
#define SWIG_str02scm(str) \
|
||||
str ? scm_from_locale_string(str) : SCM_BOOL_F
|
||||
# define SWIG_malloc(size) \
|
||||
scm_malloc(size)
|
||||
# define SWIG_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) \
|
||||
|
|
@ -42,7 +65,7 @@ typedef struct swig_guile_clientdata {
|
|||
SWIG_Guile_IsPointer(object)
|
||||
#define SWIG_contract_assert(expr, msg) \
|
||||
if (!(expr)) \
|
||||
scm_error(scm_str2symbol("swig-contract-assertion-failed"), \
|
||||
scm_error(scm_from_locale_symbol("swig-contract-assertion-failed"), \
|
||||
(char *) FUNC_NAME, (char *) msg, \
|
||||
SCM_EOL, SCM_BOOL_F); else
|
||||
|
||||
|
|
@ -61,15 +84,19 @@ SWIGINTERN char *
|
|||
SWIG_Guile_scm2newstr(SCM str, size_t *len) {
|
||||
#define FUNC_NAME "SWIG_Guile_scm2newstr"
|
||||
char *ret;
|
||||
char *tmp;
|
||||
size_t l;
|
||||
|
||||
SCM_ASSERT (SCM_STRINGP(str), str, 1, FUNC_NAME);
|
||||
|
||||
l = SCM_STRING_LENGTH(str);
|
||||
SCM_ASSERT (scm_is_string(str), str, 1, FUNC_NAME);
|
||||
l = scm_c_string_length(str);
|
||||
|
||||
ret = (char *) SWIG_malloc( (l + 1) * sizeof(char));
|
||||
if (!ret) return NULL;
|
||||
|
||||
memcpy(ret, SCM_STRING_CHARS(str), l);
|
||||
tmp = scm_to_locale_string(str);
|
||||
memcpy(ret, tmp, l);
|
||||
free(tmp);
|
||||
|
||||
ret[l] = '\0';
|
||||
if (len) *len = l;
|
||||
return ret;
|
||||
|
|
@ -86,7 +113,7 @@ static SCM swig_keyword = SCM_EOL;
|
|||
static SCM swig_symbol = SCM_EOL;
|
||||
|
||||
#define SWIG_Guile_GetSmob(x) \
|
||||
( SCM_NNULLP(x) && SCM_INSTANCEP(x) && SCM_NFALSEP(scm_slot_exists_p(x, swig_symbol)) \
|
||||
( !scm_is_null(x) && SCM_INSTANCEP(x) && scm_is_true(scm_slot_exists_p(x, swig_symbol)) \
|
||||
? scm_slot_ref(x, swig_symbol) : (x) )
|
||||
|
||||
SWIGINTERN SCM
|
||||
|
|
@ -361,18 +388,16 @@ ensure_smob_tag(SCM swig_module,
|
|||
const char *smob_name,
|
||||
const char *scheme_variable_name)
|
||||
{
|
||||
SCM variable = scm_sym2var(scm_str2symbol(scheme_variable_name),
|
||||
scm_module_lookup_closure(swig_module),
|
||||
SCM_BOOL_T);
|
||||
if (SCM_UNBNDP(SCM_VARIABLE_REF(variable))) {
|
||||
SCM variable = scm_module_variable(swig_module,
|
||||
scm_from_locale_symbol(scheme_variable_name));
|
||||
if (scm_is_false(variable)) {
|
||||
*tag_variable = scm_make_smob_type((char*)scheme_variable_name, 0);
|
||||
SCM_VARIABLE_SET(variable,
|
||||
scm_ulong2num(*tag_variable));
|
||||
scm_c_module_define(swig_module, scheme_variable_name,
|
||||
scm_from_ulong(*tag_variable));
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
*tag_variable = scm_num2ulong(SCM_VARIABLE_REF(variable), 0,
|
||||
"SWIG_Guile_Init");
|
||||
*tag_variable = scm_to_ulong(SCM_VARIABLE_REF(variable));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -409,8 +434,8 @@ SWIG_Guile_Init ()
|
|||
}
|
||||
swig_make_func = scm_permanent_object(
|
||||
scm_variable_ref(scm_c_module_lookup(scm_c_resolve_module("oop goops"), "make")));
|
||||
swig_keyword = scm_permanent_object(scm_c_make_keyword((char*) "init-smob"));
|
||||
swig_symbol = scm_permanent_object(scm_str2symbol("swig-smob"));
|
||||
swig_keyword = scm_permanent_object(scm_from_locale_keyword((char*) "init-smob"));
|
||||
swig_symbol = scm_permanent_object(scm_from_locale_symbol("swig-smob"));
|
||||
#ifdef SWIG_INIT_RUNTIME_MODULE
|
||||
SWIG_INIT_RUNTIME_MODULE
|
||||
#endif
|
||||
|
|
@ -426,13 +451,12 @@ SWIG_Guile_GetModule(void *SWIGUNUSEDPARM(clientdata))
|
|||
|
||||
module = SWIG_Guile_Init();
|
||||
|
||||
variable = scm_sym2var(scm_str2symbol("swig-type-list-address" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME),
|
||||
scm_module_lookup_closure(module),
|
||||
SCM_BOOL_T);
|
||||
if (SCM_UNBNDP(SCM_VARIABLE_REF(variable))) {
|
||||
variable = scm_module_variable(module,
|
||||
scm_from_locale_symbol("swig-type-list-address" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME));
|
||||
if (scm_is_false(variable)) {
|
||||
return NULL;
|
||||
} else {
|
||||
return (swig_module_info *) scm_num2ulong(SCM_VARIABLE_REF(variable), 0, "SWIG_Guile_Init");
|
||||
return (swig_module_info *) scm_to_ulong(SCM_VARIABLE_REF(variable));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -444,11 +468,9 @@ SWIG_Guile_SetModule(swig_module_info *swig_module)
|
|||
|
||||
module = SWIG_Guile_Init();
|
||||
|
||||
variable = scm_sym2var(scm_str2symbol("swig-type-list-address" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME),
|
||||
scm_module_lookup_closure(module),
|
||||
SCM_BOOL_T);
|
||||
|
||||
SCM_VARIABLE_SET(variable, scm_ulong2num((unsigned long) swig_module));
|
||||
scm_module_define(module,
|
||||
scm_from_locale_symbol("swig-type-list-address" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME),
|
||||
scm_from_ulong((unsigned long) swig_module));
|
||||
}
|
||||
|
||||
SWIGINTERN int
|
||||
|
|
@ -460,7 +482,7 @@ SWIG_Guile_GetArgs (SCM *dest, SCM rest,
|
|||
int num_args_passed = 0;
|
||||
for (i = 0; i<reqargs; i++) {
|
||||
if (!SCM_CONSP(rest))
|
||||
scm_wrong_num_args(scm_makfrom0str((char *) procname));
|
||||
scm_wrong_num_args(scm_from_locale_string(procname ? (char *) procname : "unknown procedure"));
|
||||
*dest++ = SCM_CAR(rest);
|
||||
rest = SCM_CDR(rest);
|
||||
num_args_passed++;
|
||||
|
|
@ -473,7 +495,7 @@ SWIG_Guile_GetArgs (SCM *dest, SCM rest,
|
|||
for (; i<optargs; i++)
|
||||
*dest++ = SCM_UNDEFINED;
|
||||
if (!SCM_NULLP(rest))
|
||||
scm_wrong_num_args(scm_makfrom0str((char *) procname));
|
||||
scm_wrong_num_args(scm_from_locale_string(procname ? (char *) procname : "unknown procedure"));
|
||||
return num_args_passed;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -21,33 +21,30 @@
|
|||
*/
|
||||
|
||||
%typemap(in, doc="$NAME is a file port or a FILE * pointer") FILE *
|
||||
( int closep )
|
||||
{
|
||||
if (SWIG_ConvertPtr($input, (void**) &($1), $1_descriptor, 0) == 0) {
|
||||
closep = 0;
|
||||
}
|
||||
else if(!(SCM_FPORTP($input)))
|
||||
scm_wrong_type_arg("$name", $argnum, $input);
|
||||
else {
|
||||
int fd;
|
||||
if (SCM_OUTPUT_PORT_P($input))
|
||||
scm_force_output($input);
|
||||
fd=dup(SCM_FPORT_FDES($input));
|
||||
if(fd==-1)
|
||||
scm_misc_error("$name", strerror(errno), SCM_EOL);
|
||||
$1=fdopen(fd,
|
||||
SCM_OUTPUT_PORT_P($input)
|
||||
? (SCM_INPUT_PORT_P($input)
|
||||
? "r+" : "w")
|
||||
: "r");
|
||||
if($1==NULL)
|
||||
scm_misc_error("$name", strerror(errno), SCM_EOL);
|
||||
closep = 1;
|
||||
if (SWIG_ConvertPtr($input, (void**) &($1), $1_descriptor, 0) != 0) {
|
||||
if (!(SCM_FPORTP($input))) {
|
||||
scm_wrong_type_arg("$symname", $argnum, $input);
|
||||
} else {
|
||||
int fd;
|
||||
if (SCM_OUTPUT_PORT_P($input)) {
|
||||
scm_force_output($input);
|
||||
}
|
||||
fd=dup(SCM_FPORT_FDES($input));
|
||||
if (fd==-1) {
|
||||
scm_misc_error("$symname", strerror(errno), SCM_EOL);
|
||||
}
|
||||
$1=fdopen(fd, SCM_OUTPUT_PORT_P($input) ? (SCM_INPUT_PORT_P($input) ? "r+" : "w") : "r");
|
||||
if ($1==NULL) {
|
||||
scm_misc_error("$symname", strerror(errno), SCM_EOL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(freearg) FILE* {
|
||||
if (closep$argnum)
|
||||
if ($1) {
|
||||
fclose($1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
1168
Lib/guile/std_map.i
1168
Lib/guile/std_map.i
File diff suppressed because it is too large
Load diff
1021
Lib/guile/std_pair.i
1021
Lib/guile/std_pair.i
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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -68,14 +68,14 @@
|
|||
|
||||
%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_from_locale_symbol((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_from_locale_symbol((char *) "swig-exception"),
|
||||
scm_listify(SWIG_NewPointerObj(&$1, $descriptor, 1),
|
||||
SCM_UNDEFINED));
|
||||
}
|
||||
|
||||
|
|
@ -86,14 +86,14 @@
|
|||
}
|
||||
|
||||
%typemap(throws) SWIGTYPE * {
|
||||
scm_throw(gh_symbol2scm((char *) "swig-exception"),
|
||||
gh_list(SWIG_NewPointerObj($1, $descriptor, 1),
|
||||
scm_throw(scm_from_locale_symbol((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_from_locale_symbol((char *) "swig-exception"),
|
||||
scm_listify(SWIG_NewPointerObj($1, $descriptor, 1),
|
||||
SCM_UNDEFINED));
|
||||
}
|
||||
|
||||
|
|
@ -160,23 +160,23 @@
|
|||
|
||||
/* 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 {
|
||||
if (sizeof(int) != sizeof($1)) {
|
||||
scm_error(scm_str2symbol("swig-error"),
|
||||
scm_error(scm_from_locale_symbol("swig-error"),
|
||||
(char *) FUNC_NAME,
|
||||
(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_from_locale_symbol((char *) "swig-exception"),
|
||||
scm_listify(scm_from_long($1), SCM_UNDEFINED));
|
||||
}
|
||||
|
||||
/* The SIMPLE_MAP_WITH_EXPR macro below defines the whole set of
|
||||
|
|
@ -224,8 +224,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_from_locale_symbol((char *) "swig-exception"),
|
||||
scm_listify(C_TO_SCM_EXPR, SCM_UNDEFINED));
|
||||
}
|
||||
%enddef
|
||||
|
||||
|
|
@ -268,34 +268,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_from_locale_symbol((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 */
|
||||
|
||||
|
|
@ -304,8 +304,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;
|
||||
|
|
@ -313,7 +313,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;
|
||||
|
|
@ -343,8 +343,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_from_locale_symbol((char *) "swig-exception"),
|
||||
scm_listify(SWIG_str02scm($1), SCM_UNDEFINED));
|
||||
}
|
||||
|
||||
/* Void */
|
||||
|
|
@ -364,7 +364,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;
|
||||
}
|
||||
|
||||
|
|
@ -420,7 +420,7 @@ typedef unsigned long SCM;
|
|||
const std::size_t &, const std::ptrdiff_t &,
|
||||
enum SWIGTYPE
|
||||
{
|
||||
$1 = SCM_NFALSEP(scm_integer_p($input)) && SCM_NFALSEP(scm_exact_p($input))? 1 : 0;
|
||||
$1 = scm_is_true(scm_integer_p($input)) && scm_is_true(scm_exact_p($input))? 1 : 0;
|
||||
}
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_BOOL)
|
||||
|
|
@ -433,7 +433,7 @@ typedef unsigned long SCM;
|
|||
float, double,
|
||||
const float &, const double &
|
||||
{
|
||||
$1 = SCM_NFALSEP(scm_real_p($input)) ? 1 : 0;
|
||||
$1 = scm_is_true(scm_real_p($input)) ? 1 : 0;
|
||||
}
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_CHAR) char {
|
||||
|
|
@ -441,7 +441,7 @@ typedef unsigned long SCM;
|
|||
}
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_STRING) char * {
|
||||
$1 = SCM_STRINGP($input) ? 1 : 0;
|
||||
$1 = scm_is_string($input) ? 1 : 0;
|
||||
}
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue