Next: GH preliminaries, Previous: GH deprecation, Up: GH
The following table summarizes how to transition from the GH to the scm interface. The replacements that are recommended are not always completely equivalent to the GH functionality that they should replace. Therefore, you should read the reference documentation of the replacements carefully if you are not yet familiar with them.
#include <libguile.h>
instead of #include
<guile/gh.h>
.
guile-config
to pick up the flags required to compile C or
C++ code that uses libguile
, like so
$(CC) -o prog.o -c prog.c `guile-config compile`
If you are using libtool to link your executables, just use
-lguile
in your link command. Libtool will expand this into
the needed linker options automatically. If you are not using
libtool, use the guile-config
program to query the needed
options explicitly. A linker command like
$(CC) -o prog prog.o `guile-config link`
should be all that is needed. To link shared libraries that will be
used as Guile Extensions, use libtool to control both the compilation
and the link stage.
SCM
typeSCM_BOOL_F
and SCM_BOOL_T
SCM_UNSPECIFIED
and SCM_UNDEFINED
gh_enter
scm_boot_guile
instead, but note that scm_boot_guile
has a slightly different calling convention from gh_enter
:
scm_boot_guile
, and the main program function that you specify
for scm_boot_guile
to call, both take an additional closure
parameter. Guile Initialization Functions for more details.
gh_repl
scm_shell
instead.
gh_init
scm_init_guile
instead.
gh_catch
scm_internal_catch
instead.
gh_eval_str
scm_c_eval_string
instead.
gh_eval_str_with_catch
scm_c_eval_string
together with scm_internal_catch
instead.
gh_eval_str_with_standard_handler
scm_c_eval_string
together with scm_internal_catch
and scm_handle_by_message_no_exit
instead.
gh_eval_str_with_stack_saving_handler
scm_c_eval_string
together with
scm_internal_stack_catch
and
scm_handle_by_message_no_exit
instead.
gh_eval_file
or gh_load
scm_c_primitive_load
instead.
gh_eval_file_with_catch
scm_c_primitive_load
together with
scm_internal_catch
instead.
gh_eval_file_with_standard_handler
scm_c_primitive_load
together with
scm_internal_catch
and scm_handle_by_message_no_exit
instead.
gh_new_procedure
gh_new_procedure0_0
gh_new_procedure0_1
gh_new_procedure0_2
gh_new_procedure1_0
gh_new_procedure1_1
gh_new_procedure1_2
gh_new_procedure2_0
gh_new_procedure2_1
gh_new_procedure2_2
gh_new_procedure3_0
gh_new_procedure4_0
gh_new_procedure5_0
scm_c_define_gsubr
instead, but note that the arguments are
in a different order: for scm_c_define_gsubr
the C function
pointer is the last argument. A Sample Guile Extension for an
example.
gh_defer_ints
and gh_allow_ints
SCM_CRITICAL_SECTION_START
and
SCM_CRITICAL_SECTION_END
instead. Note that these macros are
used without parentheses, as in SCM_DEFER_INTS;
.
gh_bool2scm
scm_from_bool
instead.
gh_int2scm
scm_from_int
instead.
gh_ulong2scm
scm_from_ulong
instead.
gh_long2scm
scm_from_long
instead.
gh_double2scm
scm_make_real
instead.
gh_char2scm
SCM_MAKE_CHAR
instead.
gh_str2scm
scm_from_locale_stringn
instead.
gh_str02scm
scm_from_locale_string
instead.
gh_set_substr
scm_string_copy_x
.
gh_symbol2scm
scm_from_locale_symbol
instead.
gh_ints2scm
gh_doubles2scm
gh_chars2byvect
gh_shorts2svect
gh_longs2ivect
gh_ulongs2uvect
gh_floats2fvect
gh_doubles2dvect
gh_scm2bool
scm_is_true
or scm_to_bool
instead.
gh_scm2int
scm_to_int
instead.
gh_scm2ulong
scm_to_ulong
instead.
gh_scm2long
scm_to_long
instead.
gh_scm2double
scm_to_double
instead.
gh_scm2char
scm_to_char
instead.
gh_scm2newstr
scm_to_locale_string
or similar instead.
gh_get_substr
scm_c_substring
together with scm_to_locale_string
or similar instead.
gh_symbol2newstr
scm_symbol_to_string
together with scm_to_locale_string
or similar instead.
gh_scm2chars
scm_from_locale_string
(or similar) or the uniform numeric
vector functions (see Uniform Numeric Vectors) instead.
gh_scm2shorts
gh_scm2longs
gh_scm2floats
gh_scm2doubles
gh_boolean_p
scm_is_bool
instead.
gh_symbol_p
scm_is_symbol
instead.
gh_char_p
gh_char_p (
obj)
with
scm_is_true (scm_char_p (obj))
gh_vector_p
gh_vector_p (
obj)
with
scm_is_true (scm_vector_p (obj))
gh_pair_p
gh_pair_p (
obj)
with
scm_is_true (scm_pair_p (obj))
gh_number_p
scm_is_number
instead.
gh_string_p
scm_is_string
instead.
gh_procedure_p
gh_procedure_p (
obj)
by
scm_is_true (scm_procedure_p (obj))
gh_list_p
gh_list_p (
obj)
with
scm_is_true (scm_list_p (obj))
gh_inexact_p
gh_inexact_p (
obj)
with
scm_is_true (scm_inexact_p (obj))
gh_exact_p
gh_exact_p (
obj)
with
scm_is_true (scm_exact_p (obj))
gh_eq_p
scm_is_eq
instead.
gh_eqv_p
gh_eqv_p (
x,
y)
with
scm_is_true (scm_eqv_p (x, y))
gh_equal_p
gh_equal_p (
x,
y)
with
scm_is_true (scm_equal_p (x, y))
gh_string_equal_p
gh_string_equal_p (
x,
y)
with
scm_is_true (scm_string_equal_p (x, y))
gh_null_p
scm_is_null
instead.
gh_not
scm_not
instead.
gh_make_string
scm_make_string
instead.
gh_string_length
scm_string_length
instead.
gh_string_ref
scm_string_ref
instead.
gh_string_set_x
scm_string_set_x
instead.
gh_substring
scm_substring
instead.
gh_string_append
scm_string_append
instead.
gh_cons
scm_cons
instead.
gh_car
and gh_cdr
scm_car
and scm_cdr
instead.
gh_cxxr
and gh_cxxxr
scm_cxxr
or scm_cxxxr
function instead.
gh_set_car_x
and gh_set_cdr_x
scm_set_car_x
and scm_set_cdr_x
instead.
gh_list
scm_list_n
instead.
gh_length
gh_length (
lst)
with
scm_to_size_t (scm_length (lst))
gh_append
scm_append
instead.
gh_append2
, gh_append3
, gh_append4
gh_append
N (
l1, ...,
lN)
by
scm_append (scm_list_n (l1, ..., lN, SCM_UNDEFINED))
gh_reverse
scm_reverse
instead.
gh_list_tail
and gh_list_ref
scm_list_tail
and scm_list_ref
instead.
gh_memq
, gh_memv
and gh_member
scm_memq
, scm_memv
and scm_member
instead.
gh_assq
, gh_assv
and gh_assoc
scm_assq
, scm_assv
and scm_assoc
instead.
gh_make_vector
scm_make_vector
instead.
gh_vector
or gh_list_to_vector
scm_vector
instead.
gh_vector_ref
and gh_vector_set_x
scm_vector_ref
and scm_vector_set_x
instead.
gh_vector_length
scm_c_vector_length
instead.
gh_uniform_vector_length
scm_c_uniform_vector_length
instead.
gh_uniform_vector_ref
scm_c_uniform_vector_ref
instead.
gh_vector_to_list
scm_vector_to_list
instead.
gh_apply
scm_apply_0
instead.
gh_call0
gh_call1
gh_call2
gh_call3
scm_call_0
, scm_call_1
, etc instead.
gh_display
gh_write
gh_newline
scm_display (obj, scm_current_output_port ())
instead, etc.
gh_lookup
scm_variable_ref (scm_c_lookup (name))
instead.
gh_module_lookup
scm_variable_ref (scm_c_module_lookup (module, name))
instead.