Drop support for guile 1.6 and older

This commit is contained in:
Geert Janssens 2013-04-19 12:49:40 +02:00
commit 3c47730803
4 changed files with 30 additions and 155 deletions

View file

@ -16,22 +16,6 @@ extern "C" {
/* In the code below, use guile 2.0 compatible functions where possible.
Functions that don't exist in older versions will be mapped to
a deprecated equivalent for those versions only */
/* ... setup guile 2-like interface for guile 1.6 */
#if (SCM_MAJOR_VERSION == 1) && (SCM_MINOR_VERSION <= 6)
# define scm_from_locale_keyword scm_c_make_keyword
# define scm_from_locale_symbol scm_str2symbol
# define scm_is_null SCM_NULLP
# define scm_is_true SCM_NFALSEP
# define scm_is_string SCM_STRINGP
/* Used later on to setup different code paths where it's
not possible to use a guile 2-like interface */
# define GUILE_VERSION_1_6
#endif
/* ... setup guile 2-like interface for guile 1.6 and 1.8 */
#if defined (SCM_MAJOR_VERSION) && (SCM_MAJOR_VERSION < 2)
static SCM
@ -59,17 +43,10 @@ typedef struct swig_guile_clientdata {
#define SWIG_scm2str(s) \
SWIG_Guile_scm2newstr(s, NULL)
#ifdef GUILE_VERSION_1_6
# define SWIG_malloc(size) \
SCM_MUST_MALLOC(size)
# define SWIG_free(mem) \
scm_must_free(mem)
#else
# define SWIG_malloc(size) \
scm_malloc(size)
# define SWIG_free(mem) \
free(mem)
#endif
#define SWIG_ConvertPtr(s, result, type, flags) \
SWIG_Guile_ConvertPtr(s, result, type, flags)
#define SWIG_MustGetPtr(s, type, argnum, flags) \
@ -105,9 +82,7 @@ SWIGINTERN char *
SWIG_Guile_scm2newstr(SCM str, size_t *len) {
#define FUNC_NAME "SWIG_Guile_scm2newstr"
char *ret;
# ifndef GUILE_VERSION_1_6
char *tmp;
# endif
size_t l;
SCM_ASSERT (scm_is_string(str), str, 1, FUNC_NAME);
@ -116,13 +91,9 @@ SWIG_Guile_scm2newstr(SCM str, size_t *len) {
ret = (char *) SWIG_malloc( (l + 1) * sizeof(char));
if (!ret) return NULL;
# ifdef GUILE_VERSION_1_6
memcpy(ret, SCM_STRING_CHARS(str), l);
# else
tmp = scm_to_locale_string(str);
memcpy(ret, tmp, l);
free(tmp);
# endif
ret[l] = '\0';
if (len) *len = l;
@ -415,22 +386,6 @@ ensure_smob_tag(SCM swig_module,
const char *smob_name,
const char *scheme_variable_name)
{
#ifdef GUILE_VERSION_1_6
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))) {
*tag_variable = scm_make_smob_type((char*)scheme_variable_name, 0);
SCM_VARIABLE_SET(variable,
scm_ulong2num(*tag_variable));
return 1;
}
else {
*tag_variable = scm_num2ulong(SCM_VARIABLE_REF(variable), 0,
"SWIG_Guile_Init");
return 0;
}
#else
SCM variable = scm_module_variable(swig_module,
scm_from_locale_symbol(scheme_variable_name));
if (scm_is_false(variable)) {
@ -443,7 +398,6 @@ ensure_smob_tag(SCM swig_module,
*tag_variable = scm_to_ulong(SCM_VARIABLE_REF(variable));
return 0;
}
#endif
}
SWIGINTERN SCM
@ -495,16 +449,6 @@ SWIG_Guile_GetModule(void *SWIGUNUSEDPARM(clientdata))
module = SWIG_Guile_Init();
#ifdef GUILE_VERSION_1_6
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))) {
return NULL;
} else {
return (swig_module_info *) scm_num2ulong(SCM_VARIABLE_REF(variable), 0, "SWIG_Guile_Init");
}
#else
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)) {
@ -512,7 +456,6 @@ SWIG_Guile_GetModule(void *SWIGUNUSEDPARM(clientdata))
} else {
return (swig_module_info *) scm_to_ulong(SCM_VARIABLE_REF(variable));
}
#endif
}
SWIGINTERN void
@ -523,17 +466,9 @@ SWIG_Guile_SetModule(swig_module_info *swig_module)
module = SWIG_Guile_Init();
#ifdef GUILE_VERSION_1_6
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));
#else
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));
#endif
}
SWIGINTERN int
@ -545,11 +480,7 @@ SWIG_Guile_GetArgs (SCM *dest, SCM rest,
int num_args_passed = 0;
for (i = 0; i<reqargs; i++) {
if (!SCM_CONSP(rest))
#ifdef GUILE_VERSION_1_6
scm_wrong_num_args(scm_makfrom0str((char *) procname));
#else
scm_wrong_num_args(scm_from_locale_string(procname ? (char *) procname : "unknown procedure"));
#endif
*dest++ = SCM_CAR(rest);
rest = SCM_CDR(rest);
num_args_passed++;
@ -562,11 +493,7 @@ SWIG_Guile_GetArgs (SCM *dest, SCM rest,
for (; i<optargs; i++)
*dest++ = SCM_UNDEFINED;
if (!SCM_NULLP(rest))
#ifdef GUILE_VERSION_1_6
scm_wrong_num_args(scm_makfrom0str((char *) procname));
#else
scm_wrong_num_args(scm_from_locale_string(procname ? (char *) procname : "unknown procedure"));
#endif
return num_args_passed;
}