mirror of
https://github.com/nillerusr/source-engine.git
synced 2026-09-01 15:09:19 +00:00
1
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
|
||||
co::
|
||||
co RCS/*.i* RCS/*.swg*
|
||||
|
||||
@@ -0,0 +1,511 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
* See the LICENSE file for information on copyright, usage and redistribution
|
||||
* of SWIG, and the README file for authors - http://www.swig.org/release.html.
|
||||
*
|
||||
* mzrun.swg
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
#include <escheme.h>
|
||||
#include <assert.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Common SWIG API */
|
||||
|
||||
#define SWIG_ConvertPtr(s, result, type, flags) \
|
||||
SWIG_MzScheme_ConvertPtr(s, result, type, flags)
|
||||
#define SWIG_NewPointerObj(ptr, type, owner) \
|
||||
SWIG_MzScheme_NewPointerObj((void *)ptr, type, owner)
|
||||
#define SWIG_MustGetPtr(s, type, argnum, flags) \
|
||||
SWIG_MzScheme_MustGetPtr(s, type, argnum, flags, FUNC_NAME, argc, argv)
|
||||
|
||||
#define SWIG_contract_assert(expr,msg) \
|
||||
if (!(expr)) { \
|
||||
char *m=(char *) scheme_malloc(strlen(msg)+1000); \
|
||||
sprintf(m,"SWIG contract, assertion failed: function=%s, message=%s", \
|
||||
(char *) FUNC_NAME,(char *) msg); \
|
||||
scheme_signal_error(m); \
|
||||
}
|
||||
|
||||
/* Runtime API */
|
||||
#define SWIG_GetModule(clientdata) SWIG_MzScheme_GetModule((Scheme_Env *)(clientdata))
|
||||
#define SWIG_SetModule(clientdata, pointer) SWIG_MzScheme_SetModule((Scheme_Env *) (clientdata), pointer)
|
||||
#define SWIG_MODULE_CLIENTDATA_TYPE Scheme_Env *
|
||||
|
||||
/* MzScheme-specific SWIG API */
|
||||
|
||||
#define SWIG_malloc(size) SWIG_MzScheme_Malloc(size, FUNC_NAME)
|
||||
#define SWIG_free(mem) free(mem)
|
||||
#define SWIG_NewStructFromPtr(ptr,type) \
|
||||
_swig_convert_struct_##type##(ptr)
|
||||
|
||||
#define MAXVALUES 6
|
||||
#define swig_make_boolean(b) (b ? scheme_true : scheme_false)
|
||||
|
||||
static long
|
||||
SWIG_convert_integer(Scheme_Object *o,
|
||||
long lower_bound, long upper_bound,
|
||||
const char *func_name, int argnum, int argc,
|
||||
Scheme_Object **argv)
|
||||
{
|
||||
long value;
|
||||
int status = scheme_get_int_val(o, &value);
|
||||
if (!status)
|
||||
scheme_wrong_type(func_name, "integer", argnum, argc, argv);
|
||||
if (value < lower_bound || value > upper_bound)
|
||||
scheme_wrong_type(func_name, "integer", argnum, argc, argv);
|
||||
return value;
|
||||
}
|
||||
|
||||
static int
|
||||
SWIG_is_integer(Scheme_Object *o)
|
||||
{
|
||||
long value;
|
||||
return scheme_get_int_val(o, &value);
|
||||
}
|
||||
|
||||
static unsigned long
|
||||
SWIG_convert_unsigned_integer(Scheme_Object *o,
|
||||
unsigned long lower_bound, unsigned long upper_bound,
|
||||
const char *func_name, int argnum, int argc,
|
||||
Scheme_Object **argv)
|
||||
{
|
||||
unsigned long value;
|
||||
int status = scheme_get_unsigned_int_val(o, &value);
|
||||
if (!status)
|
||||
scheme_wrong_type(func_name, "integer", argnum, argc, argv);
|
||||
if (value < lower_bound || value > upper_bound)
|
||||
scheme_wrong_type(func_name, "integer", argnum, argc, argv);
|
||||
return value;
|
||||
}
|
||||
|
||||
static int
|
||||
SWIG_is_unsigned_integer(Scheme_Object *o)
|
||||
{
|
||||
unsigned long value;
|
||||
return scheme_get_unsigned_int_val(o, &value);
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------
|
||||
* mzscheme 30X support code
|
||||
* Contributed by Hans Oesterholt
|
||||
* ----------------------------------------------------------------------- */
|
||||
|
||||
#ifndef SCHEME_STR_VAL
|
||||
#define MZSCHEME30X 1
|
||||
#endif
|
||||
|
||||
#ifdef MZSCHEME30X
|
||||
/*
|
||||
* This is MZSCHEME 299.100 or higher (30x). From version 299.100 of
|
||||
* mzscheme upwards, strings are in unicode. These functions convert
|
||||
* to and from utf8 encodings of these strings. NB! strlen(s) will be
|
||||
* the size in bytes of the string, not the actual length.
|
||||
*/
|
||||
#define SCHEME_STR_VAL(obj) SCHEME_BYTE_STR_VAL(scheme_char_string_to_byte_string(obj))
|
||||
#define SCHEME_STRLEN_VAL(obj) SCHEME_BYTE_STRLEN_VAL(scheme_char_string_to_byte_string(obj))
|
||||
#define SCHEME_STRINGP(obj) SCHEME_CHAR_STRINGP(obj)
|
||||
#define scheme_make_string(s) scheme_make_utf8_string(s)
|
||||
#define scheme_make_sized_string(s,l) scheme_make_sized_utf8_string(s,l)
|
||||
#define scheme_make_sized_offset_string(s,d,l) \
|
||||
scheme_make_sized_offset_utf8_string(s,d,l)
|
||||
#define SCHEME_MAKE_STRING(s) scheme_make_utf8_string(s)
|
||||
#else
|
||||
#define SCHEME_MAKE_STRING(s) scheme_make_string_without_copying(s)
|
||||
#endif
|
||||
/* -----------------------------------------------------------------------
|
||||
* End of mzscheme 30X support code
|
||||
* ----------------------------------------------------------------------- */
|
||||
|
||||
struct swig_mz_proxy {
|
||||
Scheme_Type mztype;
|
||||
swig_type_info *type;
|
||||
void *object;
|
||||
};
|
||||
|
||||
static Scheme_Type swig_type;
|
||||
|
||||
static void
|
||||
mz_free_swig(void *p, void *data) {
|
||||
struct swig_mz_proxy *proxy = (struct swig_mz_proxy *) p;
|
||||
if (SCHEME_NULLP((Scheme_Object*)p) || SCHEME_TYPE((Scheme_Object*)p) != swig_type)
|
||||
return;
|
||||
if (proxy->type) {
|
||||
if (proxy->type->clientdata) {
|
||||
((Scheme_Prim *)proxy->type->clientdata)(1, (Scheme_Object **)&proxy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static Scheme_Object *
|
||||
SWIG_MzScheme_NewPointerObj(void *ptr, swig_type_info *type, int owner) {
|
||||
struct swig_mz_proxy *new_proxy;
|
||||
new_proxy = (struct swig_mz_proxy *) scheme_malloc(sizeof(struct swig_mz_proxy));
|
||||
new_proxy->mztype = swig_type;
|
||||
new_proxy->type = type;
|
||||
new_proxy->object = ptr;
|
||||
if (owner) {
|
||||
scheme_add_finalizer(new_proxy, mz_free_swig, NULL);
|
||||
}
|
||||
return (Scheme_Object *) new_proxy;
|
||||
}
|
||||
|
||||
static int
|
||||
SWIG_MzScheme_ConvertPtr(Scheme_Object *s, void **result, swig_type_info *type, int flags) {
|
||||
swig_cast_info *cast;
|
||||
|
||||
if (SCHEME_NULLP(s)) {
|
||||
*result = NULL;
|
||||
return 0;
|
||||
} else if (SCHEME_TYPE(s) == swig_type) {
|
||||
struct swig_mz_proxy *proxy = (struct swig_mz_proxy *) s;
|
||||
if (type) {
|
||||
cast = SWIG_TypeCheckStruct(proxy->type, type);
|
||||
if (cast) {
|
||||
int newmemory = 0;
|
||||
*result = SWIG_TypeCast(cast, proxy->object, &newmemory);
|
||||
assert(!newmemory); /* newmemory handling not yet implemented */
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
*result = proxy->object;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static SWIGINLINE void *
|
||||
SWIG_MzScheme_MustGetPtr(Scheme_Object *s, swig_type_info *type,
|
||||
int argnum, int flags, const char *func_name,
|
||||
int argc, Scheme_Object **argv) {
|
||||
void *result;
|
||||
if (SWIG_MzScheme_ConvertPtr(s, &result, type, flags)) {
|
||||
scheme_wrong_type(func_name, type->str ? type->str : "void *", argnum - 1, argc, argv);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static SWIGINLINE void *
|
||||
SWIG_MzScheme_Malloc(size_t size, const char *func_name) {
|
||||
void *p = malloc(size);
|
||||
if (p == NULL) {
|
||||
scheme_signal_error("swig-memory-error");
|
||||
} else return p;
|
||||
}
|
||||
|
||||
static Scheme_Object *
|
||||
SWIG_MzScheme_PackageValues(int num, Scheme_Object **values) {
|
||||
/* ignore first value if void */
|
||||
if (num > 0 && SCHEME_VOIDP(values[0]))
|
||||
num--, values++;
|
||||
if (num == 0) return scheme_void;
|
||||
else if (num == 1) return values[0];
|
||||
else return scheme_values(num, values);
|
||||
}
|
||||
|
||||
#ifndef scheme_make_inspector
|
||||
#define scheme_make_inspector(x,y) \
|
||||
_scheme_apply(scheme_builtin_value("make-inspector"), x, y)
|
||||
#endif
|
||||
|
||||
/* Function to create a new struct. */
|
||||
static Scheme_Object *
|
||||
SWIG_MzScheme_new_scheme_struct (Scheme_Env* env, const char* basename,
|
||||
int num_fields, char** field_names)
|
||||
{
|
||||
Scheme_Object *new_type;
|
||||
int count_out, i;
|
||||
Scheme_Object **struct_names;
|
||||
Scheme_Object **vals;
|
||||
Scheme_Object **a = (Scheme_Object**) \
|
||||
scheme_malloc(num_fields*sizeof(Scheme_Object*));
|
||||
|
||||
for (i=0; i<num_fields; ++i) {
|
||||
a[i] = (Scheme_Object*) scheme_intern_symbol(field_names[i]);
|
||||
}
|
||||
|
||||
new_type = scheme_make_struct_type(scheme_intern_symbol(basename),
|
||||
NULL /*super_type*/,
|
||||
scheme_make_inspector(0, NULL),
|
||||
num_fields,
|
||||
0 /* auto_fields */,
|
||||
NULL /* auto_val */,
|
||||
NULL /* properties */
|
||||
#ifdef MZSCHEME30X
|
||||
,NULL /* Guard */
|
||||
#endif
|
||||
);
|
||||
struct_names = scheme_make_struct_names(scheme_intern_symbol(basename),
|
||||
scheme_build_list(num_fields,a),
|
||||
0 /*flags*/, &count_out);
|
||||
vals = scheme_make_struct_values(new_type, struct_names, count_out, 0);
|
||||
|
||||
for (i = 0; i < count_out; i++)
|
||||
scheme_add_global_symbol(struct_names[i], vals[i],env);
|
||||
|
||||
return new_type;
|
||||
}
|
||||
|
||||
/*** DLOPEN PATCH ******************************************************
|
||||
* Contributed by Hans Oesterholt-Dijkema (jan. 2006)
|
||||
***********************************************************************/
|
||||
|
||||
#if defined(_WIN32) || defined(__WIN32__)
|
||||
#define __OS_WIN32
|
||||
#endif
|
||||
|
||||
#ifdef __OS_WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
static char **mz_dlopen_libraries=NULL;
|
||||
static void **mz_libraries=NULL;
|
||||
static char **mz_dynload_libpaths=NULL;
|
||||
|
||||
static void mz_set_dlopen_libraries(const char *_libs)
|
||||
{
|
||||
int i,k,n;
|
||||
int mz_dynload_debug=(1==0);
|
||||
char *extra_paths[1000];
|
||||
char *EP;
|
||||
|
||||
{
|
||||
char *dbg=getenv("MZ_DYNLOAD_DEBUG");
|
||||
if (dbg!=NULL) {
|
||||
mz_dynload_debug=atoi(dbg);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
char *ep=getenv("MZ_DYNLOAD_LIBPATH");
|
||||
int i,k,j;
|
||||
k=0;
|
||||
if (ep!=NULL) {
|
||||
EP=strdup(ep);
|
||||
for(i=0,j=0;EP[i]!='\0';i++) {
|
||||
if (EP[i]==':') {
|
||||
EP[i]='\0';
|
||||
extra_paths[k++]=&EP[j];
|
||||
j=i+1;
|
||||
}
|
||||
}
|
||||
if (j!=i) {
|
||||
extra_paths[k++]=&EP[j];
|
||||
}
|
||||
}
|
||||
else {
|
||||
EP=strdup("");
|
||||
}
|
||||
extra_paths[k]=NULL;
|
||||
k+=1;
|
||||
|
||||
if (mz_dynload_debug) {
|
||||
fprintf(stderr,"SWIG:mzscheme:MZ_DYNLOAD_LIBPATH=%s\n",(ep==NULL) ? "(null)" : ep);
|
||||
fprintf(stderr,"SWIG:mzscheme:extra_paths[%d]\n",k-1);
|
||||
for(i=0;i<k-1;i++) {
|
||||
fprintf(stderr,"SWIG:mzscheme:extra_paths[%d]=%s\n",i,extra_paths[i]);
|
||||
}
|
||||
}
|
||||
|
||||
mz_dynload_libpaths=(char **) malloc(sizeof(char *)*k);
|
||||
for(i=0;i<k;i++) {
|
||||
if (extra_paths[i]!=NULL) {
|
||||
mz_dynload_libpaths[i]=strdup(extra_paths[i]);
|
||||
}
|
||||
else {
|
||||
mz_dynload_libpaths[i]=NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (mz_dynload_debug) {
|
||||
int i;
|
||||
for(i=0;extra_paths[i]!=NULL;i++) {
|
||||
fprintf(stderr,"SWIG:mzscheme:%s\n",extra_paths[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
#ifdef MZ_DYNLOAD_LIBS
|
||||
char *libs=(char *) malloc((strlen(MZ_DYNLOAD_LIBS)+1)*sizeof(char));
|
||||
strcpy(libs,MZ_DYNLOAD_LIBS);
|
||||
#else
|
||||
char *libs=(char *) malloc((strlen(_libs)+1)*sizeof(char));
|
||||
strcpy(libs,_libs);
|
||||
#endif
|
||||
|
||||
for(i=0,n=strlen(libs),k=0;i<n;i++) {
|
||||
if (libs[i]==',') { k+=1; }
|
||||
}
|
||||
k+=1;
|
||||
mz_dlopen_libraries=(char **) malloc(sizeof(char *)*(k+1));
|
||||
mz_dlopen_libraries[0]=libs;
|
||||
for(i=0,k=1,n=strlen(libs);i<n;i++) {
|
||||
if (libs[i]==',') {
|
||||
libs[i]='\0';
|
||||
mz_dlopen_libraries[k++]=&libs[i+1];
|
||||
i+=1;
|
||||
}
|
||||
}
|
||||
|
||||
if (mz_dynload_debug) {
|
||||
fprintf(stderr,"k=%d\n",k);
|
||||
}
|
||||
mz_dlopen_libraries[k]=NULL;
|
||||
|
||||
free(EP);
|
||||
}
|
||||
}
|
||||
|
||||
static void *mz_load_function(char *function)
|
||||
{
|
||||
int mz_dynload_debug=(1==0);
|
||||
|
||||
{
|
||||
char *dbg=getenv("MZ_DYNLOAD_DEBUG");
|
||||
if (dbg!=NULL) {
|
||||
mz_dynload_debug=atoi(dbg);
|
||||
}
|
||||
}
|
||||
|
||||
if (mz_dlopen_libraries==NULL) {
|
||||
return NULL;
|
||||
}
|
||||
else {
|
||||
if (mz_libraries==NULL) {
|
||||
int i,n;
|
||||
for(n=0;mz_dlopen_libraries[n]!=NULL;n++);
|
||||
if (mz_dynload_debug) {
|
||||
fprintf(stderr,"SWIG:mzscheme:n=%d\n",n);
|
||||
}
|
||||
mz_libraries=(void **) malloc(sizeof(void*)*n);
|
||||
for(i=0;i<n;i++) {
|
||||
if (mz_dynload_debug) {
|
||||
fprintf(stderr,"SWIG:mzscheme:loading %s\n",mz_dlopen_libraries[i]);
|
||||
}
|
||||
#ifdef __OS_WIN32
|
||||
mz_libraries[i]=(void *) LoadLibrary(mz_dlopen_libraries[i]);
|
||||
#else
|
||||
mz_libraries[i]=(void *) dlopen(mz_dlopen_libraries[i],RTLD_LAZY);
|
||||
#endif
|
||||
if (mz_libraries[i]==NULL) {
|
||||
int k;
|
||||
char *libp;
|
||||
for(k=0;mz_dynload_libpaths[k]!=NULL && mz_libraries[i]==NULL;k++) {
|
||||
int L=strlen(mz_dynload_libpaths[k])+strlen("\\")+strlen(mz_dlopen_libraries[i])+1;
|
||||
libp=(char *) malloc(L*sizeof(char));
|
||||
#ifdef __OS_WIN32
|
||||
sprintf(libp,"%s\\%s",mz_dynload_libpaths[k],mz_dlopen_libraries[i]);
|
||||
mz_libraries[i]=(void *) LoadLibrary(libp);
|
||||
#else
|
||||
sprintf(libp,"%s/%s",mz_dynload_libpaths[k],mz_dlopen_libraries[i]);
|
||||
mz_libraries[i]=(void *) dlopen(libp,RTLD_LAZY);
|
||||
#endif
|
||||
if (mz_dynload_debug) {
|
||||
fprintf(stderr,"SWIG:mzscheme:trying %s --> %p\n",libp,mz_libraries[i]);
|
||||
}
|
||||
free(libp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
int i;
|
||||
void *func=NULL;
|
||||
|
||||
for(i=0;mz_dlopen_libraries[i]!=NULL && func==NULL;i++) {
|
||||
if (mz_libraries[i]!=NULL) {
|
||||
#ifdef __OS_WIN32
|
||||
func=GetProcAddress(mz_libraries[i],function);
|
||||
#else
|
||||
func=dlsym(mz_libraries[i],function);
|
||||
#endif
|
||||
}
|
||||
if (mz_dynload_debug) {
|
||||
fprintf(stderr,
|
||||
"SWIG:mzscheme:library:%s;dlopen=%p,function=%s,func=%p\n",
|
||||
mz_dlopen_libraries[i],mz_libraries[i],function,func
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return func;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*** DLOPEN PATCH ******************************************************
|
||||
* Contributed by Hans Oesterholt-Dijkema (jan. 2006)
|
||||
***********************************************************************/
|
||||
|
||||
/* The interpreter will store a pointer to this structure in a global
|
||||
variable called swig-runtime-data-type-pointer. The instance of this
|
||||
struct is only used if no other module has yet been loaded */
|
||||
struct swig_mzscheme_runtime_data {
|
||||
swig_module_info *module_head;
|
||||
Scheme_Type type;
|
||||
};
|
||||
static struct swig_mzscheme_runtime_data swig_mzscheme_runtime_data;
|
||||
|
||||
|
||||
static swig_module_info *
|
||||
SWIG_MzScheme_GetModule(Scheme_Env *env) {
|
||||
Scheme_Object *pointer, *symbol;
|
||||
struct swig_mzscheme_runtime_data *data;
|
||||
|
||||
/* first check if pointer already created */
|
||||
symbol = scheme_intern_symbol("swig-runtime-data-type-pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
|
||||
pointer = scheme_lookup_global(symbol, env);
|
||||
if (pointer && SCHEME_CPTRP(pointer)) {
|
||||
data = (struct swig_mzscheme_runtime_data *) SCHEME_CPTR_VAL(pointer);
|
||||
swig_type = data->type;
|
||||
return data->module_head;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
SWIG_MzScheme_SetModule(Scheme_Env *env, swig_module_info *module) {
|
||||
Scheme_Object *pointer, *symbol;
|
||||
struct swig_mzscheme_runtime_data *data;
|
||||
|
||||
/* first check if pointer already created */
|
||||
symbol = scheme_intern_symbol("swig-runtime-data-type-pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
|
||||
pointer = scheme_lookup_global(symbol, env);
|
||||
if (pointer && SCHEME_CPTRP(pointer)) {
|
||||
data = (struct swig_mzscheme_runtime_data *) SCHEME_CPTR_VAL(pointer);
|
||||
swig_type = data->type;
|
||||
data->module_head = module;
|
||||
} else {
|
||||
/* create a new type for wrapped pointer values */
|
||||
swig_type = scheme_make_type((char *)"swig");
|
||||
swig_mzscheme_runtime_data.module_head = module;
|
||||
swig_mzscheme_runtime_data.type = swig_type;
|
||||
|
||||
/* create a new pointer */
|
||||
#ifndef MZSCHEME30X
|
||||
pointer = scheme_make_cptr((void *) &swig_mzscheme_runtime_data, "swig_mzscheme_runtime_data");
|
||||
#else
|
||||
pointer = scheme_make_cptr((void *) &swig_mzscheme_runtime_data,
|
||||
scheme_make_byte_string("swig_mzscheme_runtime_data"));
|
||||
#endif
|
||||
scheme_add_global_symbol(symbol, pointer, env);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
* See the LICENSE file for information on copyright, usage and redistribution
|
||||
* of SWIG, and the README file for authors - http://www.swig.org/release.html.
|
||||
*
|
||||
* mzscheme.swg
|
||||
*
|
||||
* SWIG Configuration File for MzScheme.
|
||||
* This file is parsed by SWIG before reading any other interface file.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
/* Include headers */
|
||||
%runtime "swigrun.swg" // Common C API type-checking code
|
||||
%runtime "mzrun.swg"
|
||||
|
||||
%define SWIG_APPEND_VALUE(value)
|
||||
values[lenv++] = value
|
||||
%enddef
|
||||
|
||||
/* Definitions */
|
||||
#define SWIG_malloc(size) swig_malloc(size, FUNC_NAME)
|
||||
#define SWIG_free(mem) free(mem)
|
||||
|
||||
#define SWIG_convert_short(o) \
|
||||
SWIG_convert_integer(o, - (1 << (8 * sizeof(short) - 1)), \
|
||||
(1 << (8 * sizeof(short) - 1)) - 1, \
|
||||
FUNC_NAME, $argnum-1, argc, argv)
|
||||
#define SWIG_convert_int(o) \
|
||||
SWIG_convert_integer(o, INT_MIN, INT_MAX, \
|
||||
FUNC_NAME, $argnum-1, argc, argv)
|
||||
#define SWIG_convert_long(o) \
|
||||
SWIG_convert_integer(o, LONG_MIN, LONG_MAX, \
|
||||
FUNC_NAME, $argnum-1, argc, argv)
|
||||
#define SWIG_convert_unsigned_short(o) \
|
||||
SWIG_convert_unsigned_integer(o, 0, \
|
||||
(1 << (8 * sizeof(short))) - 1, \
|
||||
FUNC_NAME, $argnum-1, argc, argv)
|
||||
#define SWIG_convert_unsigned_int(o) \
|
||||
SWIG_convert_unsigned_integer(o, 0, UINT_MAX, \
|
||||
FUNC_NAME, $argnum-1, argc, argv)
|
||||
#define SWIG_convert_unsigned_long(o) \
|
||||
SWIG_convert_unsigned_integer(o, 0, ULONG_MAX, \
|
||||
FUNC_NAME, $argnum-1, argc, argv)
|
||||
|
||||
/* Guile compatibility kludges */
|
||||
#define SCM_VALIDATE_VECTOR(argnum, value) (void)0
|
||||
#define SCM_VALIDATE_LIST(argnum, value) (void)0
|
||||
|
||||
/* Read in standard typemaps. */
|
||||
%include <typemaps.i>
|
||||
|
||||
%insert(init) "swiginit.swg"
|
||||
|
||||
%init %{
|
||||
Scheme_Object *scheme_reload(Scheme_Env *env) {
|
||||
Scheme_Env *menv = SWIG_MZSCHEME_CREATE_MENV(env);
|
||||
|
||||
SWIG_InitializeModule((void *) env);
|
||||
%}
|
||||
@@ -0,0 +1,23 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
* See the LICENSE file for information on copyright, usage and redistribution
|
||||
* of SWIG, and the README file for authors - http://www.swig.org/release.html.
|
||||
*
|
||||
* std_common.i
|
||||
*
|
||||
* SWIG typemaps for STL - common utilities
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%include <std/std_except.i>
|
||||
|
||||
%apply size_t { std::size_t };
|
||||
|
||||
%{
|
||||
#include <string>
|
||||
|
||||
std::string swig_scm_to_string(Scheme_Object* x) {
|
||||
return std::string(SCHEME_STR_VAL(x));
|
||||
}
|
||||
Scheme_Object* swig_make_string(const std::string& s) {
|
||||
return scheme_make_string(s.c_str());
|
||||
}
|
||||
%}
|
||||
@@ -0,0 +1 @@
|
||||
%include <std/_std_deque.i>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,873 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
* See the LICENSE file for information on copyright, usage and redistribution
|
||||
* of SWIG, and the README file for authors - http://www.swig.org/release.html.
|
||||
*
|
||||
* std_pair.i
|
||||
*
|
||||
* SWIG typemaps for std::pair
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%include <std_common.i>
|
||||
%include <exception.i>
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// std::pair
|
||||
//
|
||||
// See std_vector.i for the rationale of typemap application
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
%{
|
||||
#include <utility>
|
||||
%}
|
||||
|
||||
// exported class
|
||||
|
||||
namespace std {
|
||||
|
||||
template<class T, class U> struct pair {
|
||||
%typemap(in) pair<T,U> (std::pair<T,U>* m) {
|
||||
if (SCHEME_PAIRP($input)) {
|
||||
T* x;
|
||||
U* y;
|
||||
Scheme_Object *first, *second;
|
||||
first = scheme_car($input);
|
||||
second = scheme_cdr($input);
|
||||
x = (T*) SWIG_MustGetPtr(first,$descriptor(T *),$argnum, 0);
|
||||
y = (U*) SWIG_MustGetPtr(second,$descriptor(U *),$argnum, 0);
|
||||
$1 = std::make_pair(*x,*y);
|
||||
} else {
|
||||
$1 = *(($&1_type)
|
||||
SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0));
|
||||
}
|
||||
}
|
||||
%typemap(in) const pair<T,U>& (std::pair<T,U> temp,
|
||||
std::pair<T,U>* m),
|
||||
const pair<T,U>* (std::pair<T,U> temp,
|
||||
std::pair<T,U>* m) {
|
||||
if (SCHEME_PAIRP($input)) {
|
||||
T* x;
|
||||
U* y;
|
||||
Scheme_Object *first, *second;
|
||||
first = scheme_car($input);
|
||||
second = scheme_cdr($input);
|
||||
x = (T*) SWIG_MustGetPtr(first,$descriptor(T *),$argnum, 0);
|
||||
y = (U*) SWIG_MustGetPtr(second,$descriptor(U *),$argnum, 0);
|
||||
temp = std::make_pair(*x,*y);
|
||||
$1 = &temp;
|
||||
} else {
|
||||
$1 = ($1_ltype)
|
||||
SWIG_MustGetPtr($input,$1_descriptor,$argnum, 0);
|
||||
}
|
||||
}
|
||||
%typemap(out) pair<T,U> {
|
||||
T* x = new T($1.first);
|
||||
U* y = new U($1.second);
|
||||
Scheme_Object* first = SWIG_NewPointerObj(x,$descriptor(T *), 1);
|
||||
Scheme_Object* second = SWIG_NewPointerObj(y,$descriptor(U *), 1);
|
||||
$result = scheme_make_pair(first,second);
|
||||
}
|
||||
%typecheck(SWIG_TYPECHECK_PAIR) pair<T,U> {
|
||||
/* native pair? */
|
||||
if (SCHEME_PAIRP($input)) {
|
||||
T* x;
|
||||
U* y;
|
||||
Scheme_Object* first = scheme_car($input);
|
||||
Scheme_Object* second = scheme_cdr($input);
|
||||
if (SWIG_ConvertPtr(first,(void**) &x,
|
||||
$descriptor(T *), 0) != -1 &&
|
||||
SWIG_ConvertPtr(second,(void**) &y,
|
||||
$descriptor(U *), 0) != -1) {
|
||||
$1 = 1;
|
||||
} else {
|
||||
$1 = 0;
|
||||
}
|
||||
} else {
|
||||
/* wrapped pair? */
|
||||
std::pair<T,U >* p;
|
||||
if (SWIG_ConvertPtr($input,(void **) &p,
|
||||
$&1_descriptor, 0) != -1)
|
||||
$1 = 1;
|
||||
else
|
||||
$1 = 0;
|
||||
}
|
||||
}
|
||||
%typecheck(SWIG_TYPECHECK_PAIR) const pair<T,U>&,
|
||||
const pair<T,U>* {
|
||||
/* native pair? */
|
||||
if (SCHEME_PAIRP($input)) {
|
||||
T* x;
|
||||
U* y;
|
||||
Scheme_Object* first = scheme_car($input);
|
||||
Scheme_Object* second = scheme_cdr($input);
|
||||
if (SWIG_ConvertPtr(first,(void**) &x,
|
||||
$descriptor(T *), 0) != -1 &&
|
||||
SWIG_ConvertPtr(second,(void**) &y,
|
||||
$descriptor(U *), 0) != -1) {
|
||||
$1 = 1;
|
||||
} else {
|
||||
$1 = 0;
|
||||
}
|
||||
} else {
|
||||
/* wrapped pair? */
|
||||
std::pair<T,U >* p;
|
||||
if (SWIG_ConvertPtr($input,(void **) &p,
|
||||
$1_descriptor, 0) != -1)
|
||||
$1 = 1;
|
||||
else
|
||||
$1 = 0;
|
||||
}
|
||||
}
|
||||
pair();
|
||||
pair(T first, U second);
|
||||
pair(const pair& p);
|
||||
|
||||
template <class U1, class U2> pair(const pair<U1, U2> &p);
|
||||
|
||||
T first;
|
||||
U second;
|
||||
};
|
||||
|
||||
// specializations for built-ins
|
||||
|
||||
%define specialize_std_pair_on_first(T,CHECK,CONVERT_FROM,CONVERT_TO)
|
||||
template<class U> struct pair<T,U> {
|
||||
%typemap(in) pair<T,U> (std::pair<T,U>* m) {
|
||||
if (SCHEME_PAIRP($input)) {
|
||||
U* y;
|
||||
Scheme_Object *first, *second;
|
||||
first = scheme_car($input);
|
||||
second = scheme_cdr($input);
|
||||
if (!CHECK(first))
|
||||
SWIG_exception(SWIG_TypeError,
|
||||
"pair<" #T "," #U "> expected");
|
||||
y = (U*) SWIG_MustGetPtr(second,$descriptor(U *),$argnum, 0);
|
||||
$1 = std::make_pair(CONVERT_FROM(first),*y);
|
||||
} else {
|
||||
$1 = *(($&1_type)
|
||||
SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0));
|
||||
}
|
||||
}
|
||||
%typemap(in) const pair<T,U>& (std::pair<T,U> temp,
|
||||
std::pair<T,U>* m),
|
||||
const pair<T,U>* (std::pair<T,U> temp,
|
||||
std::pair<T,U>* m) {
|
||||
if (SCHEME_PAIRP($input)) {
|
||||
U* y;
|
||||
Scheme_Object *first, *second;
|
||||
first = scheme_car($input);
|
||||
second = scheme_cdr($input);
|
||||
if (!CHECK(first))
|
||||
SWIG_exception(SWIG_TypeError,
|
||||
"pair<" #T "," #U "> expected");
|
||||
y = (U*) SWIG_MustGetPtr(second,$descriptor(U *),$argnum, 0);
|
||||
temp = std::make_pair(CONVERT_FROM(first),*y);
|
||||
$1 = &temp;
|
||||
} else {
|
||||
$1 = ($1_ltype)
|
||||
SWIG_MustGetPtr($input,$1_descriptor,$argnum, 0);
|
||||
}
|
||||
}
|
||||
%typemap(out) pair<T,U> {
|
||||
U* y = new U($1.second);
|
||||
Scheme_Object* second = SWIG_NewPointerObj(y,$descriptor(U *), 1);
|
||||
$result = scheme_make_pair(CONVERT_TO($1.first),second);
|
||||
}
|
||||
%typecheck(SWIG_TYPECHECK_PAIR) pair<T,U> {
|
||||
/* native pair? */
|
||||
if (SCHEME_PAIRP($input)) {
|
||||
U* y;
|
||||
Scheme_Object* first = scheme_car($input);
|
||||
Scheme_Object* second = scheme_cdr($input);
|
||||
if (CHECK(first) &&
|
||||
SWIG_ConvertPtr(second,(void**) &y,
|
||||
$descriptor(U *), 0) != -1) {
|
||||
$1 = 1;
|
||||
} else {
|
||||
$1 = 0;
|
||||
}
|
||||
} else {
|
||||
/* wrapped pair? */
|
||||
std::pair<T,U >* p;
|
||||
if (SWIG_ConvertPtr($input,(void **) &p,
|
||||
$&1_descriptor, 0) != -1)
|
||||
$1 = 1;
|
||||
else
|
||||
$1 = 0;
|
||||
}
|
||||
}
|
||||
%typecheck(SWIG_TYPECHECK_PAIR) const pair<T,U>&,
|
||||
const pair<T,U>* {
|
||||
/* native pair? */
|
||||
if (SCHEME_PAIRP($input)) {
|
||||
U* y;
|
||||
Scheme_Object* first = scheme_car($input);
|
||||
Scheme_Object* second = scheme_cdr($input);
|
||||
if (CHECK(first) &&
|
||||
SWIG_ConvertPtr(second,(void**) &y,
|
||||
$descriptor(U *), 0) != -1) {
|
||||
$1 = 1;
|
||||
} else {
|
||||
$1 = 0;
|
||||
}
|
||||
} else {
|
||||
/* wrapped pair? */
|
||||
std::pair<T,U >* p;
|
||||
if (SWIG_ConvertPtr($input,(void **) &p,
|
||||
$1_descriptor, 0) != -1)
|
||||
$1 = 1;
|
||||
else
|
||||
$1 = 0;
|
||||
}
|
||||
}
|
||||
pair();
|
||||
pair(T first, U second);
|
||||
pair(const pair& p);
|
||||
|
||||
template <class U1, class U2> pair(const pair<U1, U2> &p);
|
||||
|
||||
T first;
|
||||
U second;
|
||||
};
|
||||
%enddef
|
||||
|
||||
%define specialize_std_pair_on_second(U,CHECK,CONVERT_FROM,CONVERT_TO)
|
||||
template<class T> struct pair<T,U> {
|
||||
%typemap(in) pair<T,U> (std::pair<T,U>* m) {
|
||||
if (SCHEME_PAIRP($input)) {
|
||||
T* x;
|
||||
Scheme_Object *first, *second;
|
||||
first = scheme_car($input);
|
||||
second = scheme_cdr($input);
|
||||
x = (T*) SWIG_MustGetPtr(first,$descriptor(T *),$argnum, 0);
|
||||
if (!CHECK(second))
|
||||
SWIG_exception(SWIG_TypeError,
|
||||
"pair<" #T "," #U "> expected");
|
||||
$1 = std::make_pair(*x,CONVERT_FROM(second));
|
||||
} else {
|
||||
$1 = *(($&1_type)
|
||||
SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0));
|
||||
}
|
||||
}
|
||||
%typemap(in) const pair<T,U>& (std::pair<T,U> temp,
|
||||
std::pair<T,U>* m),
|
||||
const pair<T,U>* (std::pair<T,U> temp,
|
||||
std::pair<T,U>* m) {
|
||||
if (SCHEME_PAIRP($input)) {
|
||||
T* x;
|
||||
Scheme_Object *first, *second;
|
||||
first = scheme_car($input);
|
||||
second = scheme_cdr($input);
|
||||
x = (T*) SWIG_MustGetPtr(first,$descriptor(T *),$argnum, 0);
|
||||
if (!CHECK(second))
|
||||
SWIG_exception(SWIG_TypeError,
|
||||
"pair<" #T "," #U "> expected");
|
||||
temp = std::make_pair(*x,CONVERT_FROM(second));
|
||||
$1 = &temp;
|
||||
} else {
|
||||
$1 = ($1_ltype)
|
||||
SWIG_MustGetPtr($input,$1_descriptor,$argnum, 0);
|
||||
}
|
||||
}
|
||||
%typemap(out) pair<T,U> {
|
||||
T* x = new T($1.first);
|
||||
Scheme_Object* first = SWIG_NewPointerObj(x,$descriptor(T *), 1);
|
||||
$result = scheme_make_pair(first,CONVERT_TO($1.second));
|
||||
}
|
||||
%typecheck(SWIG_TYPECHECK_PAIR) pair<T,U> {
|
||||
/* native pair? */
|
||||
if (SCHEME_PAIRP($input)) {
|
||||
T* x;
|
||||
Scheme_Object* first = scheme_car($input);
|
||||
Scheme_Object* second = scheme_cdr($input);
|
||||
if (SWIG_ConvertPtr(first,(void**) &x,
|
||||
$descriptor(T *), 0) != -1 &&
|
||||
CHECK(second)) {
|
||||
$1 = 1;
|
||||
} else {
|
||||
$1 = 0;
|
||||
}
|
||||
} else {
|
||||
/* wrapped pair? */
|
||||
std::pair<T,U >* p;
|
||||
if (SWIG_ConvertPtr($input,(void **) &p,
|
||||
$&1_descriptor, 0) != -1)
|
||||
$1 = 1;
|
||||
else
|
||||
$1 = 0;
|
||||
}
|
||||
}
|
||||
%typecheck(SWIG_TYPECHECK_PAIR) const pair<T,U>&,
|
||||
const pair<T,U>* {
|
||||
/* native pair? */
|
||||
if (SCHEME_PAIRP($input)) {
|
||||
T* x;
|
||||
Scheme_Object* first = scheme_car($input);
|
||||
Scheme_Object* second = scheme_cdr($input);
|
||||
if (SWIG_ConvertPtr(first,(void**) &x,
|
||||
$descriptor(T *), 0) != -1 &&
|
||||
CHECK(second)) {
|
||||
$1 = 1;
|
||||
} else {
|
||||
$1 = 0;
|
||||
}
|
||||
} else {
|
||||
/* wrapped pair? */
|
||||
std::pair<T,U >* p;
|
||||
if (SWIG_ConvertPtr($input,(void **) &p,
|
||||
$1_descriptor, 0) != -1)
|
||||
$1 = 1;
|
||||
else
|
||||
$1 = 0;
|
||||
}
|
||||
}
|
||||
pair();
|
||||
pair(T first, U second);
|
||||
pair(const pair& p);
|
||||
|
||||
template <class U1, class U2> pair(const pair<U1, U2> &p);
|
||||
|
||||
T first;
|
||||
U second;
|
||||
};
|
||||
%enddef
|
||||
|
||||
%define specialize_std_pair_on_both(T,CHECK_T,CONVERT_T_FROM,CONVERT_T_TO,
|
||||
U,CHECK_U,CONVERT_U_FROM,CONVERT_U_TO)
|
||||
template<> struct pair<T,U> {
|
||||
%typemap(in) pair<T,U> (std::pair<T,U>* m) {
|
||||
if (SCHEME_PAIRP($input)) {
|
||||
Scheme_Object *first, *second;
|
||||
first = scheme_car($input);
|
||||
second = scheme_cdr($input);
|
||||
if (!CHECK_T(first) || !CHECK_U(second))
|
||||
SWIG_exception(SWIG_TypeError,
|
||||
"pair<" #T "," #U "> expected");
|
||||
$1 = make_pair(CONVERT_T_FROM(first),
|
||||
CONVERT_U_FROM(second));
|
||||
} else {
|
||||
$1 = *(($&1_type)
|
||||
SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0));
|
||||
}
|
||||
}
|
||||
%typemap(in) const pair<T,U>& (std::pair<T,U> temp,
|
||||
std::pair<T,U>* m),
|
||||
const pair<T,U>* (std::pair<T,U> temp,
|
||||
std::pair<T,U>* m) {
|
||||
if (SCHEME_PAIRP($input)) {
|
||||
Scheme_Object *first, *second;
|
||||
T *x;
|
||||
first = scheme_car($input);
|
||||
second = scheme_cdr($input);
|
||||
x = (T*) SWIG_MustGetPtr(first,$descriptor(T *),$argnum, 0);
|
||||
if (!CHECK_T(first) || !CHECK_U(second))
|
||||
SWIG_exception(SWIG_TypeError,
|
||||
"pair<" #T "," #U "> expected");
|
||||
temp = make_pair(CONVERT_T_FROM(first),
|
||||
CONVERT_U_FROM(second));
|
||||
$1 = &temp;
|
||||
} else {
|
||||
$1 = ($1_ltype)
|
||||
SWIG_MustGetPtr($input,$1_descriptor,$argnum, 0);
|
||||
}
|
||||
}
|
||||
%typemap(out) pair<T,U> {
|
||||
$result = scheme_make_pair(CONVERT_T_TO($1.first),
|
||||
CONVERT_U_TO($1.second));
|
||||
}
|
||||
%typecheck(SWIG_TYPECHECK_PAIR) pair<T,U> {
|
||||
/* native pair? */
|
||||
if (SCHEME_PAIRP($input)) {
|
||||
Scheme_Object* first = scheme_car($input);
|
||||
Scheme_Object* second = scheme_cdr($input);
|
||||
if (CHECK_T(first) && CHECK_U(second)) {
|
||||
$1 = 1;
|
||||
} else {
|
||||
$1 = 0;
|
||||
}
|
||||
} else {
|
||||
/* wrapped pair? */
|
||||
std::pair<T,U >* p;
|
||||
if (SWIG_ConvertPtr($input,(void **) &p,
|
||||
$&1_descriptor, 0) != -1)
|
||||
$1 = 1;
|
||||
else
|
||||
$1 = 0;
|
||||
}
|
||||
}
|
||||
%typecheck(SWIG_TYPECHECK_PAIR) const pair<T,U>&,
|
||||
const pair<T,U>* {
|
||||
/* native pair? */
|
||||
if (SCHEME_PAIRP($input)) {
|
||||
Scheme_Object* first = scheme_car($input);
|
||||
Scheme_Object* second = scheme_cdr($input);
|
||||
if (CHECK_T(first) && CHECK_U(second)) {
|
||||
$1 = 1;
|
||||
} else {
|
||||
$1 = 0;
|
||||
}
|
||||
} else {
|
||||
/* wrapped pair? */
|
||||
std::pair<T,U >* p;
|
||||
if (SWIG_ConvertPtr($input,(void **) &p,
|
||||
$1_descriptor, 0) != -1)
|
||||
$1 = 1;
|
||||
else
|
||||
$1 = 0;
|
||||
}
|
||||
}
|
||||
pair();
|
||||
pair(T first, U second);
|
||||
pair(const pair& p);
|
||||
|
||||
template <class U1, class U2> pair(const pair<U1, U2> &p);
|
||||
|
||||
T first;
|
||||
U second;
|
||||
};
|
||||
%enddef
|
||||
|
||||
|
||||
specialize_std_pair_on_first(bool,SCHEME_BOOLP,
|
||||
SCHEME_TRUEP,swig_make_boolean);
|
||||
specialize_std_pair_on_first(int,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_first(short,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_first(long,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_first(unsigned int,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_first(unsigned short,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_first(unsigned long,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_first(double,SCHEME_REALP,
|
||||
scheme_real_to_double,scheme_make_double);
|
||||
specialize_std_pair_on_first(float,SCHEME_REALP,
|
||||
scheme_real_to_double,scheme_make_double);
|
||||
specialize_std_pair_on_first(std::string,SCHEME_STRINGP,
|
||||
swig_scm_to_string,swig_make_string);
|
||||
|
||||
specialize_std_pair_on_second(bool,SCHEME_BOOLP,
|
||||
SCHEME_TRUEP,swig_make_boolean);
|
||||
specialize_std_pair_on_second(int,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_second(short,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_second(long,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_second(unsigned int,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_second(unsigned short,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_second(unsigned long,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_second(double,SCHEME_REALP,
|
||||
scheme_real_to_double,scheme_make_double);
|
||||
specialize_std_pair_on_second(float,SCHEME_REALP,
|
||||
scheme_real_to_double,scheme_make_double);
|
||||
specialize_std_pair_on_second(std::string,SCHEME_STRINGP,
|
||||
swig_scm_to_string,swig_make_string);
|
||||
|
||||
specialize_std_pair_on_both(bool,SCHEME_BOOLP,
|
||||
SCHEME_TRUEP,swig_make_boolean,
|
||||
bool,SCHEME_BOOLP,
|
||||
SCHEME_TRUEP,swig_make_boolean);
|
||||
specialize_std_pair_on_both(bool,SCHEME_BOOLP,
|
||||
SCHEME_TRUEP,swig_make_boolean,
|
||||
int,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(bool,SCHEME_BOOLP,
|
||||
SCHEME_TRUEP,swig_make_boolean,
|
||||
short,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(bool,SCHEME_BOOLP,
|
||||
SCHEME_TRUEP,swig_make_boolean,
|
||||
long,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(bool,SCHEME_BOOLP,
|
||||
SCHEME_TRUEP,swig_make_boolean,
|
||||
unsigned int,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(bool,SCHEME_BOOLP,
|
||||
SCHEME_TRUEP,swig_make_boolean,
|
||||
unsigned short,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(bool,SCHEME_BOOLP,
|
||||
SCHEME_TRUEP,swig_make_boolean,
|
||||
unsigned long,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(bool,SCHEME_BOOLP,
|
||||
SCHEME_TRUEP,swig_make_boolean,
|
||||
double,SCHEME_REALP,
|
||||
scheme_real_to_double,scheme_make_double);
|
||||
specialize_std_pair_on_both(bool,SCHEME_BOOLP,
|
||||
SCHEME_TRUEP,swig_make_boolean,
|
||||
float,SCHEME_REALP,
|
||||
scheme_real_to_double,scheme_make_double);
|
||||
specialize_std_pair_on_both(bool,SCHEME_BOOLP,
|
||||
SCHEME_TRUEP,swig_make_boolean,
|
||||
std::string,SCHEME_STRINGP,
|
||||
swig_scm_to_string,swig_make_string);
|
||||
specialize_std_pair_on_both(int,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
bool,SCHEME_BOOLP,
|
||||
SCHEME_TRUEP,swig_make_boolean);
|
||||
specialize_std_pair_on_both(int,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
int,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(int,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
short,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(int,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
long,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(int,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
unsigned int,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(int,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
unsigned short,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(int,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
unsigned long,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(int,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
double,SCHEME_REALP,
|
||||
scheme_real_to_double,scheme_make_double);
|
||||
specialize_std_pair_on_both(int,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
float,SCHEME_REALP,
|
||||
scheme_real_to_double,scheme_make_double);
|
||||
specialize_std_pair_on_both(int,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
std::string,SCHEME_STRINGP,
|
||||
swig_scm_to_string,swig_make_string);
|
||||
specialize_std_pair_on_both(short,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
bool,SCHEME_BOOLP,
|
||||
SCHEME_TRUEP,swig_make_boolean);
|
||||
specialize_std_pair_on_both(short,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
int,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(short,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
short,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(short,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
long,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(short,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
unsigned int,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(short,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
unsigned short,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(short,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
unsigned long,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(short,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
double,SCHEME_REALP,
|
||||
scheme_real_to_double,scheme_make_double);
|
||||
specialize_std_pair_on_both(short,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
float,SCHEME_REALP,
|
||||
scheme_real_to_double,scheme_make_double);
|
||||
specialize_std_pair_on_both(short,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
std::string,SCHEME_STRINGP,
|
||||
swig_scm_to_string,swig_make_string);
|
||||
specialize_std_pair_on_both(long,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
bool,SCHEME_BOOLP,
|
||||
SCHEME_TRUEP,swig_make_boolean);
|
||||
specialize_std_pair_on_both(long,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
int,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(long,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
short,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(long,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
long,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(long,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
unsigned int,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(long,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
unsigned short,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(long,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
unsigned long,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(long,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
double,SCHEME_REALP,
|
||||
scheme_real_to_double,scheme_make_double);
|
||||
specialize_std_pair_on_both(long,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
float,SCHEME_REALP,
|
||||
scheme_real_to_double,scheme_make_double);
|
||||
specialize_std_pair_on_both(long,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
std::string,SCHEME_STRINGP,
|
||||
swig_scm_to_string,swig_make_string);
|
||||
specialize_std_pair_on_both(unsigned int,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
bool,SCHEME_BOOLP,
|
||||
SCHEME_TRUEP,swig_make_boolean);
|
||||
specialize_std_pair_on_both(unsigned int,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
int,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(unsigned int,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
short,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(unsigned int,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
long,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(unsigned int,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
unsigned int,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(unsigned int,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
unsigned short,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(unsigned int,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
unsigned long,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(unsigned int,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
double,SCHEME_REALP,
|
||||
scheme_real_to_double,scheme_make_double);
|
||||
specialize_std_pair_on_both(unsigned int,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
float,SCHEME_REALP,
|
||||
scheme_real_to_double,scheme_make_double);
|
||||
specialize_std_pair_on_both(unsigned int,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
std::string,SCHEME_STRINGP,
|
||||
swig_scm_to_string,swig_make_string);
|
||||
specialize_std_pair_on_both(unsigned short,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
bool,SCHEME_BOOLP,
|
||||
SCHEME_TRUEP,swig_make_boolean);
|
||||
specialize_std_pair_on_both(unsigned short,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
int,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(unsigned short,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
short,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(unsigned short,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
long,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(unsigned short,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
unsigned int,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(unsigned short,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
unsigned short,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(unsigned short,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
unsigned long,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(unsigned short,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
double,SCHEME_REALP,
|
||||
scheme_real_to_double,scheme_make_double);
|
||||
specialize_std_pair_on_both(unsigned short,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
float,SCHEME_REALP,
|
||||
scheme_real_to_double,scheme_make_double);
|
||||
specialize_std_pair_on_both(unsigned short,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
std::string,SCHEME_STRINGP,
|
||||
swig_scm_to_string,swig_make_string);
|
||||
specialize_std_pair_on_both(unsigned long,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
bool,SCHEME_BOOLP,
|
||||
SCHEME_TRUEP,swig_make_boolean);
|
||||
specialize_std_pair_on_both(unsigned long,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
int,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(unsigned long,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
short,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(unsigned long,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
long,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(unsigned long,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
unsigned int,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(unsigned long,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
unsigned short,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(unsigned long,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
unsigned long,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(unsigned long,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
double,SCHEME_REALP,
|
||||
scheme_real_to_double,scheme_make_double);
|
||||
specialize_std_pair_on_both(unsigned long,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
float,SCHEME_REALP,
|
||||
scheme_real_to_double,scheme_make_double);
|
||||
specialize_std_pair_on_both(unsigned long,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value,
|
||||
std::string,SCHEME_STRINGP,
|
||||
swig_scm_to_string,swig_make_string);
|
||||
specialize_std_pair_on_both(double,SCHEME_REALP,
|
||||
scheme_real_to_double,scheme_make_double,
|
||||
bool,SCHEME_BOOLP,
|
||||
SCHEME_TRUEP,swig_make_boolean);
|
||||
specialize_std_pair_on_both(double,SCHEME_REALP,
|
||||
scheme_real_to_double,scheme_make_double,
|
||||
int,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(double,SCHEME_REALP,
|
||||
scheme_real_to_double,scheme_make_double,
|
||||
short,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(double,SCHEME_REALP,
|
||||
scheme_real_to_double,scheme_make_double,
|
||||
long,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(double,SCHEME_REALP,
|
||||
scheme_real_to_double,scheme_make_double,
|
||||
unsigned int,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(double,SCHEME_REALP,
|
||||
scheme_real_to_double,scheme_make_double,
|
||||
unsigned short,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(double,SCHEME_REALP,
|
||||
scheme_real_to_double,scheme_make_double,
|
||||
unsigned long,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(double,SCHEME_REALP,
|
||||
scheme_real_to_double,scheme_make_double,
|
||||
double,SCHEME_REALP,
|
||||
scheme_real_to_double,scheme_make_double);
|
||||
specialize_std_pair_on_both(double,SCHEME_REALP,
|
||||
scheme_real_to_double,scheme_make_double,
|
||||
float,SCHEME_REALP,
|
||||
scheme_real_to_double,scheme_make_double);
|
||||
specialize_std_pair_on_both(double,SCHEME_REALP,
|
||||
scheme_real_to_double,scheme_make_double,
|
||||
std::string,SCHEME_STRINGP,
|
||||
swig_scm_to_string,swig_make_string);
|
||||
specialize_std_pair_on_both(float,SCHEME_REALP,
|
||||
scheme_real_to_double,scheme_make_double,
|
||||
bool,SCHEME_BOOLP,
|
||||
SCHEME_TRUEP,swig_make_boolean);
|
||||
specialize_std_pair_on_both(float,SCHEME_REALP,
|
||||
scheme_real_to_double,scheme_make_double,
|
||||
int,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(float,SCHEME_REALP,
|
||||
scheme_real_to_double,scheme_make_double,
|
||||
short,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(float,SCHEME_REALP,
|
||||
scheme_real_to_double,scheme_make_double,
|
||||
long,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(float,SCHEME_REALP,
|
||||
scheme_real_to_double,scheme_make_double,
|
||||
unsigned int,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(float,SCHEME_REALP,
|
||||
scheme_real_to_double,scheme_make_double,
|
||||
unsigned short,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(float,SCHEME_REALP,
|
||||
scheme_real_to_double,scheme_make_double,
|
||||
unsigned long,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(float,SCHEME_REALP,
|
||||
scheme_real_to_double,scheme_make_double,
|
||||
double,SCHEME_REALP,
|
||||
scheme_real_to_double,scheme_make_double);
|
||||
specialize_std_pair_on_both(float,SCHEME_REALP,
|
||||
scheme_real_to_double,scheme_make_double,
|
||||
float,SCHEME_REALP,
|
||||
scheme_real_to_double,scheme_make_double);
|
||||
specialize_std_pair_on_both(float,SCHEME_REALP,
|
||||
scheme_real_to_double,scheme_make_double,
|
||||
std::string,SCHEME_STRINGP,
|
||||
swig_scm_to_string,swig_make_string);
|
||||
specialize_std_pair_on_both(std::string,SCHEME_STRINGP,
|
||||
swig_scm_to_string,swig_make_string,
|
||||
bool,SCHEME_BOOLP,
|
||||
SCHEME_TRUEP,swig_make_boolean);
|
||||
specialize_std_pair_on_both(std::string,SCHEME_STRINGP,
|
||||
swig_scm_to_string,swig_make_string,
|
||||
int,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(std::string,SCHEME_STRINGP,
|
||||
swig_scm_to_string,swig_make_string,
|
||||
short,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(std::string,SCHEME_STRINGP,
|
||||
swig_scm_to_string,swig_make_string,
|
||||
long,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(std::string,SCHEME_STRINGP,
|
||||
swig_scm_to_string,swig_make_string,
|
||||
unsigned int,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(std::string,SCHEME_STRINGP,
|
||||
swig_scm_to_string,swig_make_string,
|
||||
unsigned short,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(std::string,SCHEME_STRINGP,
|
||||
swig_scm_to_string,swig_make_string,
|
||||
unsigned long,SCHEME_INTP,
|
||||
SCHEME_INT_VAL,scheme_make_integer_value);
|
||||
specialize_std_pair_on_both(std::string,SCHEME_STRINGP,
|
||||
swig_scm_to_string,swig_make_string,
|
||||
double,SCHEME_REALP,
|
||||
scheme_real_to_double,scheme_make_double);
|
||||
specialize_std_pair_on_both(std::string,SCHEME_STRINGP,
|
||||
swig_scm_to_string,swig_make_string,
|
||||
float,SCHEME_REALP,
|
||||
scheme_real_to_double,scheme_make_double);
|
||||
specialize_std_pair_on_both(std::string,SCHEME_STRINGP,
|
||||
swig_scm_to_string,swig_make_string,
|
||||
std::string,SCHEME_STRINGP,
|
||||
swig_scm_to_string,swig_make_string);
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
* See the LICENSE file for information on copyright, usage and redistribution
|
||||
* of SWIG, and the README file for authors - http://www.swig.org/release.html.
|
||||
*
|
||||
* std_string.i
|
||||
*
|
||||
* SWIG typemaps for std::string types
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// std::string is typemapped by value
|
||||
// This can prevent exporting methods which return a string
|
||||
// in order for the user to modify it.
|
||||
// However, I think I'll wait until someone asks for it...
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
%include <exception.i>
|
||||
|
||||
%{
|
||||
#include <string>
|
||||
%}
|
||||
|
||||
namespace std {
|
||||
|
||||
%naturalvar string;
|
||||
|
||||
class string;
|
||||
|
||||
/* Overloading check */
|
||||
|
||||
%typemap(typecheck) string = char *;
|
||||
%typemap(typecheck) const string & = char *;
|
||||
|
||||
%typemap(in) string {
|
||||
if (SCHEME_STRINGP($input))
|
||||
$1.assign(SCHEME_STR_VAL($input));
|
||||
else
|
||||
SWIG_exception(SWIG_TypeError, "string expected");
|
||||
}
|
||||
|
||||
%typemap(in) const string & (std::string temp) {
|
||||
if (SCHEME_STRINGP($input)) {
|
||||
temp.assign(SCHEME_STR_VAL($input));
|
||||
$1 = &temp;
|
||||
} else {
|
||||
SWIG_exception(SWIG_TypeError, "string expected");
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(out) string {
|
||||
$result = scheme_make_string($1.c_str());
|
||||
}
|
||||
|
||||
%typemap(out) const string & {
|
||||
$result = scheme_make_string($1->c_str());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,436 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
* See the LICENSE file for information on copyright, usage and redistribution
|
||||
* of SWIG, and the README file for authors - http://www.swig.org/release.html.
|
||||
*
|
||||
* std_vector.i
|
||||
*
|
||||
* SWIG typemaps for std::vector
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%include <std_common.i>
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// std::vector
|
||||
//
|
||||
// The aim of all that follows would be to integrate std::vector with
|
||||
// MzScheme as much as possible, namely, to allow the user to pass and
|
||||
// be returned MzScheme vectors or lists.
|
||||
// const declarations are used to guess the intent of the function being
|
||||
// exported; therefore, the following rationale is applied:
|
||||
//
|
||||
// -- f(std::vector<T>), f(const std::vector<T>&), f(const std::vector<T>*):
|
||||
// the parameter being read-only, either a MzScheme sequence or a
|
||||
// previously wrapped std::vector<T> can be passed.
|
||||
// -- f(std::vector<T>&), f(std::vector<T>*):
|
||||
// the parameter must be modified; therefore, only a wrapped std::vector
|
||||
// can be passed.
|
||||
// -- std::vector<T> f():
|
||||
// the vector is returned by copy; therefore, a MzScheme vector of T:s
|
||||
// is returned which is most easily used in other MzScheme functions
|
||||
// -- std::vector<T>& f(), std::vector<T>* f(), const std::vector<T>& f(),
|
||||
// const std::vector<T>* f():
|
||||
// the vector is returned by reference; therefore, a wrapped std::vector
|
||||
// is returned
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
%{
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <stdexcept>
|
||||
%}
|
||||
|
||||
// exported class
|
||||
|
||||
namespace std {
|
||||
|
||||
template<class T> class vector {
|
||||
%typemap(in) vector<T> {
|
||||
if (SCHEME_VECTORP($input)) {
|
||||
unsigned int size = SCHEME_VEC_SIZE($input);
|
||||
$1 = std::vector<T >(size);
|
||||
Scheme_Object** items = SCHEME_VEC_ELS($input);
|
||||
for (unsigned int i=0; i<size; i++) {
|
||||
(($1_type &)$1)[i] =
|
||||
*((T*) SWIG_MustGetPtr(items[i],
|
||||
$descriptor(T *),
|
||||
$argnum, 0));
|
||||
}
|
||||
} else if (SCHEME_NULLP($input)) {
|
||||
$1 = std::vector<T >();
|
||||
} else if (SCHEME_PAIRP($input)) {
|
||||
Scheme_Object *head, *tail;
|
||||
$1 = std::vector<T >();
|
||||
tail = $input;
|
||||
while (!SCHEME_NULLP(tail)) {
|
||||
head = scheme_car(tail);
|
||||
tail = scheme_cdr(tail);
|
||||
$1.push_back(*((T*)SWIG_MustGetPtr(head,
|
||||
$descriptor(T *),
|
||||
$argnum, 0)));
|
||||
}
|
||||
} else {
|
||||
$1 = *(($&1_type)
|
||||
SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0));
|
||||
}
|
||||
}
|
||||
%typemap(in) const vector<T>& (std::vector<T> temp),
|
||||
const vector<T>* (std::vector<T> temp) {
|
||||
if (SCHEME_VECTORP($input)) {
|
||||
unsigned int size = SCHEME_VEC_SIZE($input);
|
||||
temp = std::vector<T >(size);
|
||||
$1 = &temp;
|
||||
Scheme_Object** items = SCHEME_VEC_ELS($input);
|
||||
for (unsigned int i=0; i<size; i++) {
|
||||
temp[i] = *((T*) SWIG_MustGetPtr(items[i],
|
||||
$descriptor(T *),
|
||||
$argnum, 0));
|
||||
}
|
||||
} else if (SCHEME_NULLP($input)) {
|
||||
temp = std::vector<T >();
|
||||
$1 = &temp;
|
||||
} else if (SCHEME_PAIRP($input)) {
|
||||
temp = std::vector<T >();
|
||||
$1 = &temp;
|
||||
Scheme_Object *head, *tail;
|
||||
tail = $input;
|
||||
while (!SCHEME_NULLP(tail)) {
|
||||
head = scheme_car(tail);
|
||||
tail = scheme_cdr(tail);
|
||||
temp.push_back(*((T*) SWIG_MustGetPtr(head,
|
||||
$descriptor(T *),
|
||||
$argnum, 0)));
|
||||
}
|
||||
} else {
|
||||
$1 = ($1_ltype) SWIG_MustGetPtr($input,$1_descriptor,$argnum, 0);
|
||||
}
|
||||
}
|
||||
%typemap(out) vector<T> {
|
||||
$result = scheme_make_vector($1.size(),scheme_undefined);
|
||||
Scheme_Object** els = SCHEME_VEC_ELS($result);
|
||||
for (unsigned int i=0; i<$1.size(); i++) {
|
||||
T* x = new T((($1_type &)$1)[i]);
|
||||
els[i] = SWIG_NewPointerObj(x,$descriptor(T *), 1);
|
||||
}
|
||||
}
|
||||
%typecheck(SWIG_TYPECHECK_VECTOR) vector<T> {
|
||||
/* native sequence? */
|
||||
if (SCHEME_VECTORP($input)) {
|
||||
unsigned int size = SCHEME_VEC_SIZE($input);
|
||||
if (size == 0) {
|
||||
/* an empty sequence can be of any type */
|
||||
$1 = 1;
|
||||
} else {
|
||||
/* check the first element only */
|
||||
T* x;
|
||||
Scheme_Object** items = SCHEME_VEC_ELS($input);
|
||||
if (SWIG_ConvertPtr(items[0],(void**) &x,
|
||||
$descriptor(T *), 0) != -1)
|
||||
$1 = 1;
|
||||
else
|
||||
$1 = 0;
|
||||
}
|
||||
} else if (SCHEME_NULLP($input)) {
|
||||
/* again, an empty sequence can be of any type */
|
||||
$1 = 1;
|
||||
} else if (SCHEME_PAIRP($input)) {
|
||||
/* check the first element only */
|
||||
T* x;
|
||||
Scheme_Object *head = scheme_car($input);
|
||||
if (SWIG_ConvertPtr(head,(void**) &x,
|
||||
$descriptor(T *), 0) != -1)
|
||||
$1 = 1;
|
||||
else
|
||||
$1 = 0;
|
||||
} else {
|
||||
/* wrapped vector? */
|
||||
std::vector<T >* v;
|
||||
if (SWIG_ConvertPtr($input,(void **) &v,
|
||||
$&1_descriptor, 0) != -1)
|
||||
$1 = 1;
|
||||
else
|
||||
$1 = 0;
|
||||
}
|
||||
}
|
||||
%typecheck(SWIG_TYPECHECK_VECTOR) const vector<T>&,
|
||||
const vector<T>* {
|
||||
/* native sequence? */
|
||||
if (SCHEME_VECTORP($input)) {
|
||||
unsigned int size = SCHEME_VEC_SIZE($input);
|
||||
if (size == 0) {
|
||||
/* an empty sequence can be of any type */
|
||||
$1 = 1;
|
||||
} else {
|
||||
/* check the first element only */
|
||||
T* x;
|
||||
Scheme_Object** items = SCHEME_VEC_ELS($input);
|
||||
if (SWIG_ConvertPtr(items[0],(void**) &x,
|
||||
$descriptor(T *), 0) != -1)
|
||||
$1 = 1;
|
||||
else
|
||||
$1 = 0;
|
||||
}
|
||||
} else if (SCHEME_NULLP($input)) {
|
||||
/* again, an empty sequence can be of any type */
|
||||
$1 = 1;
|
||||
} else if (SCHEME_PAIRP($input)) {
|
||||
/* check the first element only */
|
||||
T* x;
|
||||
Scheme_Object *head = scheme_car($input);
|
||||
if (SWIG_ConvertPtr(head,(void**) &x,
|
||||
$descriptor(T *), 0) != -1)
|
||||
$1 = 1;
|
||||
else
|
||||
$1 = 0;
|
||||
} else {
|
||||
/* wrapped vector? */
|
||||
std::vector<T >* v;
|
||||
if (SWIG_ConvertPtr($input,(void **) &v,
|
||||
$1_descriptor, 0) != -1)
|
||||
$1 = 1;
|
||||
else
|
||||
$1 = 0;
|
||||
}
|
||||
}
|
||||
public:
|
||||
vector(unsigned int size = 0);
|
||||
vector(unsigned int size, const T& value);
|
||||
vector(const vector<T>&);
|
||||
%rename(length) size;
|
||||
unsigned int size() const;
|
||||
%rename("empty?") empty;
|
||||
bool empty() const;
|
||||
%rename("clear!") clear;
|
||||
void clear();
|
||||
%rename("set!") set;
|
||||
%rename("pop!") pop;
|
||||
%rename("push!") push_back;
|
||||
void push_back(const T& x);
|
||||
%extend {
|
||||
T pop() throw (std::out_of_range) {
|
||||
if (self->size() == 0)
|
||||
throw std::out_of_range("pop from empty vector");
|
||||
T x = self->back();
|
||||
self->pop_back();
|
||||
return x;
|
||||
}
|
||||
T& ref(int i) throw (std::out_of_range) {
|
||||
int size = int(self->size());
|
||||
if (i>=0 && i<size)
|
||||
return (*self)[i];
|
||||
else
|
||||
throw std::out_of_range("vector index out of range");
|
||||
}
|
||||
void set(int i, const T& x) throw (std::out_of_range) {
|
||||
int size = int(self->size());
|
||||
if (i>=0 && i<size)
|
||||
(*self)[i] = x;
|
||||
else
|
||||
throw std::out_of_range("vector index out of range");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// specializations for built-ins
|
||||
|
||||
%define specialize_std_vector(T,CHECK,CONVERT_FROM,CONVERT_TO)
|
||||
template<> class vector<T> {
|
||||
%typemap(in) vector<T> {
|
||||
if (SCHEME_VECTORP($input)) {
|
||||
unsigned int size = SCHEME_VEC_SIZE($input);
|
||||
$1 = std::vector<T >(size);
|
||||
Scheme_Object** items = SCHEME_VEC_ELS($input);
|
||||
for (unsigned int i=0; i<size; i++) {
|
||||
Scheme_Object* o = items[i];
|
||||
if (CHECK(o))
|
||||
(($1_type &)$1)[i] = (T)(CONVERT_FROM(o));
|
||||
else
|
||||
scheme_wrong_type(FUNC_NAME, "vector<" #T ">",
|
||||
$argnum - 1, argc, argv);
|
||||
}
|
||||
} else if (SCHEME_NULLP($input)) {
|
||||
$1 = std::vector<T >();
|
||||
} else if (SCHEME_PAIRP($input)) {
|
||||
Scheme_Object *head, *tail;
|
||||
$1 = std::vector<T >();
|
||||
tail = $input;
|
||||
while (!SCHEME_NULLP(tail)) {
|
||||
head = scheme_car(tail);
|
||||
tail = scheme_cdr(tail);
|
||||
if (CHECK(head))
|
||||
$1.push_back((T)(CONVERT_FROM(head)));
|
||||
else
|
||||
scheme_wrong_type(FUNC_NAME, "vector<" #T ">",
|
||||
$argnum - 1, argc, argv);
|
||||
}
|
||||
} else {
|
||||
$1 = *(($&1_type)
|
||||
SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0));
|
||||
}
|
||||
}
|
||||
%typemap(in) const vector<T>& (std::vector<T> temp),
|
||||
const vector<T>* (std::vector<T> temp) {
|
||||
if (SCHEME_VECTORP($input)) {
|
||||
unsigned int size = SCHEME_VEC_SIZE($input);
|
||||
temp = std::vector<T >(size);
|
||||
$1 = &temp;
|
||||
Scheme_Object** items = SCHEME_VEC_ELS($input);
|
||||
for (unsigned int i=0; i<size; i++) {
|
||||
Scheme_Object* o = items[i];
|
||||
if (CHECK(o))
|
||||
temp[i] = (T)(CONVERT_FROM(o));
|
||||
else
|
||||
scheme_wrong_type(FUNC_NAME, "vector<" #T ">",
|
||||
$argnum - 1, argc, argv);
|
||||
}
|
||||
} else if (SCHEME_NULLP($input)) {
|
||||
temp = std::vector<T >();
|
||||
$1 = &temp;
|
||||
} else if (SCHEME_PAIRP($input)) {
|
||||
temp = std::vector<T >();
|
||||
$1 = &temp;
|
||||
Scheme_Object *head, *tail;
|
||||
tail = $input;
|
||||
while (!SCHEME_NULLP(tail)) {
|
||||
head = scheme_car(tail);
|
||||
tail = scheme_cdr(tail);
|
||||
if (CHECK(head))
|
||||
temp.push_back((T)(CONVERT_FROM(head)));
|
||||
else
|
||||
scheme_wrong_type(FUNC_NAME, "vector<" #T ">",
|
||||
$argnum - 1, argc, argv);
|
||||
}
|
||||
} else {
|
||||
$1 = ($1_ltype) SWIG_MustGetPtr($input,$1_descriptor,$argnum - 1, 0);
|
||||
}
|
||||
}
|
||||
%typemap(out) vector<T> {
|
||||
$result = scheme_make_vector($1.size(),scheme_undefined);
|
||||
Scheme_Object** els = SCHEME_VEC_ELS($result);
|
||||
for (unsigned int i=0; i<$1.size(); i++)
|
||||
els[i] = CONVERT_TO((($1_type &)$1)[i]);
|
||||
}
|
||||
%typecheck(SWIG_TYPECHECK_VECTOR) vector<T> {
|
||||
/* native sequence? */
|
||||
if (SCHEME_VECTORP($input)) {
|
||||
unsigned int size = SCHEME_VEC_SIZE($input);
|
||||
if (size == 0) {
|
||||
/* an empty sequence can be of any type */
|
||||
$1 = 1;
|
||||
} else {
|
||||
/* check the first element only */
|
||||
T* x;
|
||||
Scheme_Object** items = SCHEME_VEC_ELS($input);
|
||||
$1 = CHECK(items[0]) ? 1 : 0;
|
||||
}
|
||||
} else if (SCHEME_NULLP($input)) {
|
||||
/* again, an empty sequence can be of any type */
|
||||
$1 = 1;
|
||||
} else if (SCHEME_PAIRP($input)) {
|
||||
/* check the first element only */
|
||||
T* x;
|
||||
Scheme_Object *head = scheme_car($input);
|
||||
$1 = CHECK(head) ? 1 : 0;
|
||||
} else {
|
||||
/* wrapped vector? */
|
||||
std::vector<T >* v;
|
||||
$1 = (SWIG_ConvertPtr($input,(void **) &v,
|
||||
$&1_descriptor, 0) != -1) ? 1 : 0;
|
||||
}
|
||||
}
|
||||
%typecheck(SWIG_TYPECHECK_VECTOR) const vector<T>&,
|
||||
const vector<T>* {
|
||||
/* native sequence? */
|
||||
if (SCHEME_VECTORP($input)) {
|
||||
unsigned int size = SCHEME_VEC_SIZE($input);
|
||||
if (size == 0) {
|
||||
/* an empty sequence can be of any type */
|
||||
$1 = 1;
|
||||
} else {
|
||||
/* check the first element only */
|
||||
T* x;
|
||||
Scheme_Object** items = SCHEME_VEC_ELS($input);
|
||||
$1 = CHECK(items[0]) ? 1 : 0;
|
||||
}
|
||||
} else if (SCHEME_NULLP($input)) {
|
||||
/* again, an empty sequence can be of any type */
|
||||
$1 = 1;
|
||||
} else if (SCHEME_PAIRP($input)) {
|
||||
/* check the first element only */
|
||||
T* x;
|
||||
Scheme_Object *head = scheme_car($input);
|
||||
$1 = CHECK(head) ? 1 : 0;
|
||||
} else {
|
||||
/* wrapped vector? */
|
||||
std::vector<T >* v;
|
||||
$1 = (SWIG_ConvertPtr($input,(void **) &v,
|
||||
$1_descriptor, 0) != -1) ? 1 : 0;
|
||||
}
|
||||
}
|
||||
public:
|
||||
vector(unsigned int size = 0);
|
||||
vector(unsigned int size, const T& value);
|
||||
vector(const vector<T>&);
|
||||
%rename(length) size;
|
||||
unsigned int size() const;
|
||||
%rename("empty?") empty;
|
||||
bool empty() const;
|
||||
%rename("clear!") clear;
|
||||
void clear();
|
||||
%rename("set!") set;
|
||||
%rename("pop!") pop;
|
||||
%rename("push!") push_back;
|
||||
void push_back(T x);
|
||||
%extend {
|
||||
T pop() throw (std::out_of_range) {
|
||||
if (self->size() == 0)
|
||||
throw std::out_of_range("pop from empty vector");
|
||||
T x = self->back();
|
||||
self->pop_back();
|
||||
return x;
|
||||
}
|
||||
T ref(int i) throw (std::out_of_range) {
|
||||
int size = int(self->size());
|
||||
if (i>=0 && i<size)
|
||||
return (*self)[i];
|
||||
else
|
||||
throw std::out_of_range("vector index out of range");
|
||||
}
|
||||
void set(int i, T x) throw (std::out_of_range) {
|
||||
int size = int(self->size());
|
||||
if (i>=0 && i<size)
|
||||
(*self)[i] = x;
|
||||
else
|
||||
throw std::out_of_range("vector index out of range");
|
||||
}
|
||||
}
|
||||
};
|
||||
%enddef
|
||||
|
||||
specialize_std_vector(bool,SCHEME_BOOLP,SCHEME_TRUEP,\
|
||||
swig_make_boolean);
|
||||
specialize_std_vector(char,SCHEME_INTP,SCHEME_INT_VAL,\
|
||||
scheme_make_integer_value);
|
||||
specialize_std_vector(int,SCHEME_INTP,SCHEME_INT_VAL,\
|
||||
scheme_make_integer_value);
|
||||
specialize_std_vector(short,SCHEME_INTP,SCHEME_INT_VAL,\
|
||||
scheme_make_integer_value);
|
||||
specialize_std_vector(long,SCHEME_INTP,SCHEME_INT_VAL,\
|
||||
scheme_make_integer_value);
|
||||
specialize_std_vector(unsigned char,SCHEME_INTP,SCHEME_INT_VAL,\
|
||||
scheme_make_integer_value);
|
||||
specialize_std_vector(unsigned int,SCHEME_INTP,SCHEME_INT_VAL,\
|
||||
scheme_make_integer_value);
|
||||
specialize_std_vector(unsigned short,SCHEME_INTP,SCHEME_INT_VAL,\
|
||||
scheme_make_integer_value);
|
||||
specialize_std_vector(unsigned long,SCHEME_INTP,SCHEME_INT_VAL,\
|
||||
scheme_make_integer_value);
|
||||
specialize_std_vector(float,SCHEME_REALP,scheme_real_to_double,\
|
||||
scheme_make_double);
|
||||
specialize_std_vector(double,SCHEME_REALP,scheme_real_to_double,\
|
||||
scheme_make_double);
|
||||
specialize_std_vector(std::string,SCHEME_STRINGP,swig_scm_to_string,\
|
||||
swig_make_string);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
* See the LICENSE file for information on copyright, usage and redistribution
|
||||
* of SWIG, and the README file for authors - http://www.swig.org/release.html.
|
||||
*
|
||||
* stl.i
|
||||
*
|
||||
* Initial STL definition. extended as needed in each language
|
||||
* ----------------------------------------------------------------------------- */
|
||||
%include <std_common.i>
|
||||
%include <std_string.i>
|
||||
%include <std_vector.i>
|
||||
%include <std_map.i>
|
||||
%include <std_pair.i>
|
||||
|
||||
@@ -0,0 +1,354 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
* See the LICENSE file for information on copyright, usage and redistribution
|
||||
* of SWIG, and the README file for authors - http://www.swig.org/release.html.
|
||||
*
|
||||
* typemaps.i
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
/* The MzScheme module handles all types uniformly via typemaps. Here
|
||||
are the definitions. */
|
||||
|
||||
/* Pointers */
|
||||
|
||||
%typemap(in) SWIGTYPE * {
|
||||
$1 = ($ltype) SWIG_MustGetPtr($input, $descriptor, $argnum, 0);
|
||||
}
|
||||
|
||||
%typemap(in) void * {
|
||||
$1 = SWIG_MustGetPtr($input, NULL, $argnum, 0);
|
||||
}
|
||||
|
||||
%typemap(varin) SWIGTYPE * {
|
||||
$1 = ($ltype) SWIG_MustGetPtr($input, $descriptor, 1, 0);
|
||||
}
|
||||
|
||||
%typemap(varin) SWIGTYPE & {
|
||||
$1 = *(($1_ltype)SWIG_MustGetPtr($input, $descriptor, 1, 0));
|
||||
}
|
||||
|
||||
%typemap(varin) SWIGTYPE [ANY] {
|
||||
void *temp;
|
||||
int ii;
|
||||
$1_basetype *b = 0;
|
||||
temp = SWIG_MustGetPtr($input, $1_descriptor, 1, 0);
|
||||
b = ($1_basetype *) $1;
|
||||
for (ii = 0; ii < $1_size; ii++) b[ii] = *(($1_basetype *) temp + ii);
|
||||
}
|
||||
|
||||
|
||||
%typemap(varin) void * {
|
||||
$1 = SWIG_MustGetPtr($input, NULL, 1, 0);
|
||||
}
|
||||
|
||||
%typemap(out) SWIGTYPE * {
|
||||
$result = SWIG_NewPointerObj ($1, $descriptor, $owner);
|
||||
}
|
||||
|
||||
%typemap(out) SWIGTYPE *DYNAMIC {
|
||||
swig_type_info *ty = SWIG_TypeDynamicCast($1_descriptor,(void **) &$1);
|
||||
$result = SWIG_NewPointerObj ($1, ty, $owner);
|
||||
}
|
||||
|
||||
%typemap(varout) SWIGTYPE *, SWIGTYPE [] {
|
||||
$result = SWIG_NewPointerObj ($1, $descriptor, 0);
|
||||
}
|
||||
|
||||
%typemap(varout) SWIGTYPE & {
|
||||
$result = SWIG_NewPointerObj((void *) &$1, $1_descriptor, 0);
|
||||
}
|
||||
|
||||
/* C++ References */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
%typemap(in) SWIGTYPE &, const SWIGTYPE & {
|
||||
$1 = ($ltype) SWIG_MustGetPtr($input, $descriptor, $argnum, 0);
|
||||
if ($1 == NULL) scheme_signal_error("swig-type-error (null reference)");
|
||||
}
|
||||
|
||||
%typemap(out) SWIGTYPE &, const SWIGTYPE & {
|
||||
$result = SWIG_NewPointerObj ($1, $descriptor, $owner);
|
||||
}
|
||||
|
||||
%typemap(out) SWIGTYPE &DYNAMIC {
|
||||
swig_type_info *ty = SWIG_TypeDynamicCast($1_descriptor,(void **) &$1);
|
||||
$result = SWIG_NewPointerObj ($1, ty, $owner);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* Arrays */
|
||||
|
||||
%typemap(in) SWIGTYPE[] {
|
||||
$1 = ($ltype) SWIG_MustGetPtr($input, $descriptor, $argnum, 0);
|
||||
}
|
||||
|
||||
%typemap(out) SWIGTYPE[] {
|
||||
$result = SWIG_NewPointerObj ($1, $descriptor, $owner);
|
||||
}
|
||||
|
||||
/* Enums */
|
||||
%typemap(in) enum SWIGTYPE {
|
||||
if (!SWIG_is_integer($input))
|
||||
scheme_wrong_type(FUNC_NAME, "integer", $argnum - 1, argc, argv);
|
||||
$1 = ($1_type) SWIG_convert_int($input);
|
||||
}
|
||||
|
||||
%typemap(varin) enum SWIGTYPE {
|
||||
if (!SWIG_is_integer($input))
|
||||
scheme_wrong_type(FUNC_NAME, "integer", 0, argc, argv);
|
||||
$1 = ($1_type) SWIG_convert_int($input);
|
||||
}
|
||||
|
||||
%typemap(out) enum SWIGTYPE "$result = scheme_make_integer_value($1);";
|
||||
%typemap(varout) enum SWIGTYPE "$result = scheme_make_integer_value($1);";
|
||||
|
||||
|
||||
/* Pass-by-value */
|
||||
|
||||
%typemap(in) SWIGTYPE($&1_ltype argp) {
|
||||
argp = ($&1_ltype) SWIG_MustGetPtr($input, $&1_descriptor, $argnum, 0);
|
||||
$1 = *argp;
|
||||
}
|
||||
|
||||
%typemap(varin) SWIGTYPE {
|
||||
$&1_ltype argp;
|
||||
argp = ($&1_ltype) SWIG_MustGetPtr($input, $&1_descriptor, 1, 0);
|
||||
$1 = *argp;
|
||||
}
|
||||
|
||||
|
||||
%typemap(out) SWIGTYPE
|
||||
#ifdef __cplusplus
|
||||
{
|
||||
$&1_ltype resultptr;
|
||||
resultptr = new $1_ltype(($1_ltype &) $1);
|
||||
$result = SWIG_NewPointerObj (resultptr, $&1_descriptor, 1);
|
||||
}
|
||||
#else
|
||||
{
|
||||
$&1_ltype resultptr;
|
||||
resultptr = ($&1_ltype) malloc(sizeof($1_type));
|
||||
memmove(resultptr, &$1, sizeof($1_type));
|
||||
$result = SWIG_NewPointerObj(resultptr, $&1_descriptor, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
%typemap(varout) SWIGTYPE
|
||||
#ifdef __cplusplus
|
||||
{
|
||||
$&1_ltype resultptr;
|
||||
resultptr = new $1_ltype(($1_ltype &) $1);
|
||||
$result = SWIG_NewPointerObj (resultptr, $&1_descriptor, 0);
|
||||
}
|
||||
#else
|
||||
{
|
||||
$&1_ltype resultptr;
|
||||
resultptr = ($&1_ltype) malloc(sizeof($1_type));
|
||||
memmove(resultptr, &$1, sizeof($1_type));
|
||||
$result = SWIG_NewPointerObj(resultptr, $&1_descriptor, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* The SIMPLE_MAP macro below defines the whole set of typemaps needed
|
||||
for simple types. */
|
||||
|
||||
%define SIMPLE_MAP(C_NAME, MZ_PREDICATE, MZ_TO_C, C_TO_MZ, MZ_NAME)
|
||||
%typemap(in) C_NAME {
|
||||
if (!MZ_PREDICATE($input))
|
||||
scheme_wrong_type(FUNC_NAME, #MZ_NAME, $argnum - 1, argc, argv);
|
||||
$1 = MZ_TO_C($input);
|
||||
}
|
||||
%typemap(varin) C_NAME {
|
||||
if (!MZ_PREDICATE($input))
|
||||
scheme_wrong_type(FUNC_NAME, #MZ_NAME, 0, argc, argv);
|
||||
$1 = MZ_TO_C($input);
|
||||
}
|
||||
%typemap(out) C_NAME {
|
||||
$result = C_TO_MZ($1);
|
||||
}
|
||||
%typemap(varout) C_NAME {
|
||||
$result = C_TO_MZ($1);
|
||||
}
|
||||
%typemap(in) C_NAME *INPUT (C_NAME temp) {
|
||||
temp = (C_NAME) MZ_TO_C($input);
|
||||
$1 = &temp;
|
||||
}
|
||||
%typemap(in,numinputs=0) C_NAME *OUTPUT (C_NAME temp) {
|
||||
$1 = &temp;
|
||||
}
|
||||
%typemap(argout) C_NAME *OUTPUT {
|
||||
Scheme_Object *s;
|
||||
s = C_TO_MZ(*$1);
|
||||
SWIG_APPEND_VALUE(s);
|
||||
}
|
||||
%typemap(in) C_NAME *BOTH = C_NAME *INPUT;
|
||||
%typemap(argout) C_NAME *BOTH = C_NAME *OUTPUT;
|
||||
%typemap(in) C_NAME *INOUT = C_NAME *INPUT;
|
||||
%typemap(argout) C_NAME *INOUT = C_NAME *OUTPUT;
|
||||
%enddef
|
||||
|
||||
SIMPLE_MAP(bool, SCHEME_BOOLP, SCHEME_TRUEP,
|
||||
swig_make_boolean, boolean);
|
||||
SIMPLE_MAP(char, SCHEME_CHARP, SCHEME_CHAR_VAL,
|
||||
scheme_make_character, character);
|
||||
SIMPLE_MAP(unsigned char, SCHEME_CHARP, SCHEME_CHAR_VAL,
|
||||
scheme_make_character, character);
|
||||
SIMPLE_MAP(int, SWIG_is_integer, SWIG_convert_int,
|
||||
scheme_make_integer_value, integer);
|
||||
SIMPLE_MAP(short, SWIG_is_integer, SWIG_convert_short,
|
||||
scheme_make_integer_value, integer);
|
||||
SIMPLE_MAP(long, SWIG_is_integer, SWIG_convert_long,
|
||||
scheme_make_integer_value, integer);
|
||||
SIMPLE_MAP(ptrdiff_t, SWIG_is_integer, SWIG_convert_long,
|
||||
scheme_make_integer_value, integer);
|
||||
SIMPLE_MAP(unsigned int, SWIG_is_unsigned_integer, SWIG_convert_unsigned_int,
|
||||
scheme_make_integer_value_from_unsigned, integer);
|
||||
SIMPLE_MAP(unsigned short, SWIG_is_unsigned_integer, SWIG_convert_unsigned_short,
|
||||
scheme_make_integer_value_from_unsigned, integer);
|
||||
SIMPLE_MAP(unsigned long, SWIG_is_unsigned_integer, SWIG_convert_unsigned_long,
|
||||
scheme_make_integer_value_from_unsigned, integer);
|
||||
SIMPLE_MAP(size_t, SWIG_is_unsigned_integer, SWIG_convert_unsigned_long,
|
||||
scheme_make_integer_value_from_unsigned, integer);
|
||||
SIMPLE_MAP(float, SCHEME_REALP, scheme_real_to_double,
|
||||
scheme_make_double, real);
|
||||
SIMPLE_MAP(double, SCHEME_REALP, scheme_real_to_double,
|
||||
scheme_make_double, real);
|
||||
|
||||
SIMPLE_MAP(char *, SCHEME_STRINGP, SCHEME_STR_VAL,
|
||||
SCHEME_MAKE_STRING, string);
|
||||
SIMPLE_MAP(const char *, SCHEME_STRINGP, SCHEME_STR_VAL,
|
||||
SCHEME_MAKE_STRING, string);
|
||||
|
||||
/* For MzScheme 30x: Use these typemaps if you are not going to use
|
||||
UTF8 encodings in your C code.
|
||||
SIMPLE_MAP(char *,SCHEME_BYTE_STRINGP, SCHEME_BYTE_STR_VAL,
|
||||
scheme_make_byte_string_without_copying,bytestring);
|
||||
SIMPLE_MAP(const char *,SCHEME_BYTE_STRINGP, SCHEME_BYTE_STR_VAL,
|
||||
scheme_make_byte_string_without_copying,bytestring);
|
||||
*/
|
||||
|
||||
/* Const primitive references. Passed by value */
|
||||
|
||||
%define REF_MAP(C_NAME, MZ_PREDICATE, MZ_TO_C, C_TO_MZ, MZ_NAME)
|
||||
%typemap(in) const C_NAME & (C_NAME temp) {
|
||||
if (!MZ_PREDICATE($input))
|
||||
scheme_wrong_type(FUNC_NAME, #MZ_NAME, $argnum - 1, argc, argv);
|
||||
temp = MZ_TO_C($input);
|
||||
$1 = &temp;
|
||||
}
|
||||
%typemap(out) const C_NAME & {
|
||||
$result = C_TO_MZ(*$1);
|
||||
}
|
||||
%enddef
|
||||
|
||||
REF_MAP(bool, SCHEME_BOOLP, SCHEME_TRUEP,
|
||||
swig_make_boolean, boolean);
|
||||
REF_MAP(char, SCHEME_CHARP, SCHEME_CHAR_VAL,
|
||||
scheme_make_character, character);
|
||||
REF_MAP(unsigned char, SCHEME_CHARP, SCHEME_CHAR_VAL,
|
||||
scheme_make_character, character);
|
||||
REF_MAP(int, SWIG_is_integer, SWIG_convert_int,
|
||||
scheme_make_integer_value, integer);
|
||||
REF_MAP(short, SWIG_is_integer, SWIG_convert_short,
|
||||
scheme_make_integer_value, integer);
|
||||
REF_MAP(long, SWIG_is_integer, SWIG_convert_long,
|
||||
scheme_make_integer_value, integer);
|
||||
REF_MAP(unsigned int, SWIG_is_unsigned_integer, SWIG_convert_unsigned_int,
|
||||
scheme_make_integer_value_from_unsigned, integer);
|
||||
REF_MAP(unsigned short, SWIG_is_unsigned_integer, SWIG_convert_unsigned_short,
|
||||
scheme_make_integer_value_from_unsigned, integer);
|
||||
REF_MAP(unsigned long, SWIG_is_unsigned_integer, SWIG_convert_unsigned_long,
|
||||
scheme_make_integer_value_from_unsigned, integer);
|
||||
REF_MAP(float, SCHEME_REALP, scheme_real_to_double,
|
||||
scheme_make_double, real);
|
||||
REF_MAP(double, SCHEME_REALP, scheme_real_to_double,
|
||||
scheme_make_double, real);
|
||||
|
||||
/* Void */
|
||||
|
||||
%typemap(out) void "$result = scheme_void;";
|
||||
|
||||
/* Pass through Scheme_Object * */
|
||||
|
||||
%typemap (in) Scheme_Object * "$1=$input;";
|
||||
%typemap (out) Scheme_Object * "$result=$1;";
|
||||
%typecheck(SWIG_TYPECHECK_POINTER) Scheme_Object * "$1=1;";
|
||||
|
||||
|
||||
/* ------------------------------------------------------------
|
||||
* String & length
|
||||
* ------------------------------------------------------------ */
|
||||
|
||||
//%typemap(in) (char *STRING, int LENGTH) {
|
||||
// int temp;
|
||||
// $1 = ($1_ltype) gh_scm2newstr($input, &temp);
|
||||
// $2 = ($2_ltype) temp;
|
||||
//}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------
|
||||
* Typechecking rules
|
||||
* ------------------------------------------------------------ */
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_INTEGER)
|
||||
int, short, long,
|
||||
unsigned int, unsigned short, unsigned long,
|
||||
signed char, unsigned char,
|
||||
long long, unsigned long long,
|
||||
const int &, const short &, const long &,
|
||||
const unsigned int &, const unsigned short &, const unsigned long &,
|
||||
const long long &, const unsigned long long &,
|
||||
enum SWIGTYPE
|
||||
{
|
||||
$1 = (SWIG_is_integer($input)) ? 1 : 0;
|
||||
}
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_BOOL) bool, bool &, const bool &
|
||||
{
|
||||
$1 = (SCHEME_BOOLP($input)) ? 1 : 0;
|
||||
}
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_DOUBLE)
|
||||
float, double,
|
||||
const float &, const double &
|
||||
{
|
||||
$1 = (SCHEME_REALP($input)) ? 1 : 0;
|
||||
}
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_STRING) char {
|
||||
$1 = (SCHEME_STRINGP($input)) ? 1 : 0;
|
||||
}
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_STRING) char * {
|
||||
$1 = (SCHEME_STRINGP($input)) ? 1 : 0;
|
||||
}
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] {
|
||||
void *ptr;
|
||||
if (SWIG_ConvertPtr($input, (void **) &ptr, $1_descriptor, 0)) {
|
||||
$1 = 0;
|
||||
} else {
|
||||
$1 = 1;
|
||||
}
|
||||
}
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE {
|
||||
void *ptr;
|
||||
if (SWIG_ConvertPtr($input, (void **) &ptr, $&1_descriptor, 0)) {
|
||||
$1 = 0;
|
||||
} else {
|
||||
$1 = 1;
|
||||
}
|
||||
}
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_VOIDPTR) void * {
|
||||
void *ptr;
|
||||
if (SWIG_ConvertPtr($input, (void **) &ptr, 0, 0)) {
|
||||
$1 = 0;
|
||||
} else {
|
||||
$1 = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user