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

@ -1,47 +1,3 @@
#ifdef GUILE_VERSION_1_6
#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
#else
#define gh_append2(a, b) scm_append(scm_listify(a, b, SCM_UNDEFINED))
#define gh_apply(a, b) scm_apply(a, b, SCM_EOL)
#define gh_bool2scm scm_from_bool
@ -81,5 +37,3 @@
#define gh_vector_ref scm_vector_ref
#define gh_vector_set_x scm_vector_set_x
#define gh_char2scm SCM_MAKE_CHAR
#endif

View file

@ -19,22 +19,7 @@ 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 */
/* ... setup guile 2-like interface for guile 1.8 */
#if defined (SCM_MAJOR_VERSION) && (SCM_MAJOR_VERSION < 2)
static SCM

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;
}