1 commit ce9d1e1c64e3575c0987999263b82741235499e2
2 Author: Andy Wingo <wingo@pobox.com>
3 Date: Tue Dec 15 11:40:58 2009 +0100
5 guile 1.9 compatibility in guile-runtime.c
7 * guile/g-wrap/guile-runtime.c (gw_guile_add_subr_method): In Guile 1.9
8 it's OK to have a subr as a method procedure, which is good, as there
9 is no more scm_closure.
10 (gw_guile_ensure_latent_variables_hash_and_binder):
11 (gw_guile_procedure_to_method_public): Avoid deprecated SCM_INUM
14 diff --git a/guile/g-wrap/guile-runtime.c b/guile/g-wrap/guile-runtime.c
15 index ad49108..f71e8fd 100644
16 --- a/guile/g-wrap/guile-runtime.c
17 +++ b/guile/g-wrap/guile-runtime.c
19 /**********************************************************************
20 -Copyright (C) 2003-2005 Andreas Rottmann
21 +Copyright (C) 2003-2005, 2009 Andreas Rottmann
23 This program is free software; you can redistribute it and/or modify
24 it under the terms of the GNU Lesser General Public License as
25 @@ -197,6 +197,9 @@ gw_guile_add_subr_method (SCM generic, SCM subr, SCM all_specializers,
26 formals = scm_cons (scm_from_locale_symbol (buffer), formals);
29 +#if SCM_MAJOR_VERSION <= 1 && SCM_MINOR_VERSION < 9
30 + /* in Guile 1.8 and before, the procedure for a method had to be an
31 + interpreted closure. */
32 if (use_optional_args)
34 SCM f_apply = scm_c_eval_string ("apply");
35 @@ -213,6 +216,9 @@ gw_guile_add_subr_method (SCM generic, SCM subr, SCM all_specializers,
36 procm = scm_closure (scm_list_2 (formals, scm_cons (subr, formals)),
37 scm_top_level_env (SCM_TOP_LEVEL_LOOKUP_CLOSURE));
43 meth = scm_apply_0 (scm_sym_make,
44 scm_list_5 (scm_class_method,
45 @@ -456,7 +462,7 @@ gw_guile_ensure_latent_variables_hash_and_binder (SCM module)
46 return SCM_BOOL_F; /* won't get here */
49 - scm_struct_set_x (module, SCM_MAKINUM (scm_module_index_binder),
50 + scm_struct_set_x (module, scm_from_int (scm_module_index_binder),
51 scm_c_make_gsubr ("%gw-module-binder", 3, 0,
52 0, gw_module_binder_proc));
54 @@ -531,11 +537,12 @@ gw_guile_procedure_to_method_public (SCM proc, SCM specializers,
60 SCM_VALIDATE_PROC (1, proc);
61 SCM_VALIDATE_LIST (2, specializers);
62 SCM_VALIDATE_SYMBOL (3, generic_name);
63 - SCM_VALIDATE_INUM (4, n_req_args);
64 + SCM_VALIDATE_INT_COPY (4, n_req_args, c_n_req_args);
65 /* the fifth is a bool */
67 generics = gw_guile_ensure_generics_module ();
68 @@ -553,7 +560,7 @@ gw_guile_procedure_to_method_public (SCM proc, SCM specializers,
71 scm_current_module (),
72 - scm_to_int (n_req_args),
74 scm_is_true (use_optional_args));
77 commit 6821dfbd43514e55ce78850d3aabf86f3326c8f4
78 Author: Andy Wingo <wingo@pobox.com>
79 Date: Tue Dec 15 12:13:54 2009 +0100
81 use Scheme's add-method!
83 * guile/g-wrap/guile-runtime.c: Keep a pointer to the `make' variable,
85 (gw_guile_add_subr_method): Call the Scheme add-method! instead of
86 scm_add_method. The C function is removed in Guile 1.9.
88 diff --git a/guile/g-wrap/guile-runtime.c b/guile/g-wrap/guile-runtime.c
89 index f71e8fd..715e542 100644
90 --- a/guile/g-wrap/guile-runtime.c
91 +++ b/guile/g-wrap/guile-runtime.c
92 @@ -36,7 +36,8 @@ USA.
94 static SCM is_a_p_proc = SCM_UNSPECIFIED;
95 static SCM module_add_x = SCM_UNSPECIFIED;
96 -static SCM scm_sym_make = SCM_UNSPECIFIED;
97 +static SCM var_make = SCM_UNSPECIFIED;
98 +static SCM var_add_method_x = SCM_UNSPECIFIED;
100 /* TODO: Use snarfer for kewords & symbols */
101 static SCM k_specializers = SCM_UNSPECIFIED;
102 @@ -220,11 +221,11 @@ gw_guile_add_subr_method (SCM generic, SCM subr, SCM all_specializers,
106 - meth = scm_apply_0 (scm_sym_make,
107 + meth = scm_apply_0 (SCM_VARIABLE_REF (var_make),
108 scm_list_5 (scm_class_method,
109 k_specializers, specializers,
110 k_procedure, procm));
111 - scm_add_method (generic, meth);
112 + scm_call_2 (SCM_VARIABLE_REF (var_add_method_x), generic, meth);
115 /* What's going on here?
116 @@ -349,7 +350,7 @@ allocate_generic_variable (SCM module, SCM sym)
118 if (scm_is_false (var)) {
119 /* Symbol unbound, make a new generic */
120 - generic = scm_apply_0 (scm_sym_make,
121 + generic = scm_apply_0 (SCM_VARIABLE_REF (var_make),
122 scm_list_3 (scm_class_generic, k_name, sym));
123 return scm_make_variable (generic);
124 } else if (scm_is_true (scm_call_2 (is_a_p_proc, scm_variable_ref (var),
125 @@ -361,7 +362,7 @@ allocate_generic_variable (SCM module, SCM sym)
126 } else if (scm_is_true (scm_procedure_p (scm_variable_ref (var)))) {
127 /* Make a generic that falls back on the original binding. NB: generics also
128 satisfy procedure?. */
129 - generic = scm_apply_0 (scm_sym_make,
130 + generic = scm_apply_0 (SCM_VARIABLE_REF (var_make),
131 scm_list_5 (scm_class_generic,
133 k_default, scm_variable_ref (var)));
134 @@ -879,9 +880,10 @@ gw_guile_runtime_init (void)
138 - scm_sym_make = scm_permanent_object (
139 - SCM_VARIABLE_REF (scm_c_module_lookup (scm_module_goops,
142 + scm_permanent_object (scm_c_module_lookup (scm_module_goops, "make"));
144 + scm_permanent_object (scm_c_module_lookup (scm_module_goops, "add-method!"));
145 is_a_p_proc = scm_permanent_object (
146 SCM_VARIABLE_REF (scm_c_module_lookup (scm_module_goops,
148 From eeb1aaeaf26ef510cbb535a7e9e04776cd74926f Mon Sep 17 00:00:00 2001
149 From: Andreas Rottmann <a.rottmann@gmx.at>
150 Date: Sun, 27 Feb 2011 15:37:39 +0000
151 Subject: Fix SCM_VERSION_17X compatibility macro definition for Guile 2.x
153 * guile/g-wrap/guile-compatibility.h: Also define SCM_VERSION_17X on
156 diff --git a/guile/g-wrap/guile-compatibility.h b/guile/g-wrap/guile-compatibility.h
157 index 1169725..c875e98 100644
158 --- a/guile/g-wrap/guile-compatibility.h
159 +++ b/guile/g-wrap/guile-compatibility.h
160 @@ -38,8 +38,10 @@ extern "C" {
163 /* Define this macro if Guile 1.7.x or better is in use. */
164 -#if defined (SCM_MINOR_VERSION) && (SCM_MINOR_VERSION >= 7) && \
165 - defined (SCM_MAJOR_VERSION) && (SCM_MAJOR_VERSION >= 1)
166 +#if defined (SCM_MAJOR_VERSION) && \
167 + ((SCM_MAJOR_VERSION >= 2) || \
168 + ((SCM_MAJOR_VERSION == 1) && \
169 + defined (SCM_MINOR_VERSION) && (SCM_MINOR_VERSION >= 7)))
170 #define SCM_VERSION_17X 1