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_TSCM_UNSPECIFIED and SCM_UNDEFINEDgh_enterscm_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_replscm_shell instead.
gh_initscm_init_guile instead.
gh_catchscm_internal_catch instead.
gh_eval_strscm_c_eval_string instead.
gh_eval_str_with_catchscm_c_eval_string together with scm_internal_catch
instead.
gh_eval_str_with_standard_handlerscm_c_eval_string together with scm_internal_catch
and scm_handle_by_message_no_exit instead.
gh_eval_str_with_stack_saving_handlerscm_c_eval_string together with
scm_internal_stack_catch and
scm_handle_by_message_no_exit instead.
gh_eval_file or gh_loadscm_c_primitive_load instead.
gh_eval_file_with_catchscm_c_primitive_load together with
scm_internal_catch instead.
gh_eval_file_with_standard_handlerscm_c_primitive_load together with
scm_internal_catch and scm_handle_by_message_no_exit
instead.
gh_new_proceduregh_new_procedure0_0gh_new_procedure0_1gh_new_procedure0_2gh_new_procedure1_0gh_new_procedure1_1gh_new_procedure1_2gh_new_procedure2_0gh_new_procedure2_1gh_new_procedure2_2gh_new_procedure3_0gh_new_procedure4_0gh_new_procedure5_0scm_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_intsSCM_CRITICAL_SECTION_START and
SCM_CRITICAL_SECTION_END instead. Note that these macros are
used without parentheses, as in SCM_DEFER_INTS;.
gh_bool2scmscm_from_bool instead.
gh_int2scmscm_from_int instead.
gh_ulong2scmscm_from_ulong instead.
gh_long2scmscm_from_long instead.
gh_double2scmscm_make_real instead.
gh_char2scmSCM_MAKE_CHAR instead.
gh_str2scmscm_from_locale_stringn instead.
gh_str02scmscm_from_locale_string instead.
gh_set_substrscm_string_copy_x.
gh_symbol2scmscm_from_locale_symbol instead.
gh_ints2scmgh_doubles2scmgh_chars2byvectgh_shorts2svectgh_longs2ivectgh_ulongs2uvectgh_floats2fvectgh_doubles2dvectgh_scm2boolscm_is_true or scm_to_bool instead.
gh_scm2intscm_to_int instead.
gh_scm2ulongscm_to_ulong instead.
gh_scm2longscm_to_long instead.
gh_scm2doublescm_to_double instead.
gh_scm2charscm_to_char instead.
gh_scm2newstrscm_to_locale_string or similar instead.
gh_get_substrscm_c_substring together with scm_to_locale_string
or similar instead.
gh_symbol2newstrscm_symbol_to_string together with scm_to_locale_string or similar instead.
gh_scm2charsscm_from_locale_string (or similar) or the uniform numeric
vector functions (see Uniform Numeric Vectors) instead.
gh_scm2shortsgh_scm2longsgh_scm2floatsgh_scm2doublesgh_boolean_pscm_is_bool instead.
gh_symbol_pscm_is_symbol instead.
gh_char_pgh_char_p (obj) with
scm_is_true (scm_char_p (obj))
gh_vector_pgh_vector_p (obj) with
scm_is_true (scm_vector_p (obj))
gh_pair_pgh_pair_p (obj) with
scm_is_true (scm_pair_p (obj))
gh_number_pscm_is_number instead.
gh_string_pscm_is_string instead.
gh_procedure_pgh_procedure_p (obj) by
scm_is_true (scm_procedure_p (obj))
gh_list_pgh_list_p (obj) with
scm_is_true (scm_list_p (obj))
gh_inexact_pgh_inexact_p (obj) with
scm_is_true (scm_inexact_p (obj))
gh_exact_pgh_exact_p (obj) with
scm_is_true (scm_exact_p (obj))
gh_eq_pscm_is_eq instead.
gh_eqv_pgh_eqv_p (x, y) with
scm_is_true (scm_eqv_p (x, y))
gh_equal_pgh_equal_p (x, y) with
scm_is_true (scm_equal_p (x, y))
gh_string_equal_pgh_string_equal_p (x, y) with
scm_is_true (scm_string_equal_p (x, y))
gh_null_pscm_is_null instead.
gh_notscm_not instead.
gh_make_stringscm_make_string instead.
gh_string_lengthscm_string_length instead.
gh_string_refscm_string_ref instead.
gh_string_set_xscm_string_set_x instead.
gh_substringscm_substring instead.
gh_string_appendscm_string_append instead.
gh_consscm_cons instead.
gh_car and gh_cdrscm_car and scm_cdr instead.
gh_cxxr and gh_cxxxrscm_cxxr or scm_cxxxr function instead.
gh_set_car_x and gh_set_cdr_xscm_set_car_x and scm_set_cdr_x instead.
gh_listscm_list_n instead.
gh_lengthgh_length (lst) with
scm_to_size_t (scm_length (lst))
gh_appendscm_append instead.
gh_append2, gh_append3, gh_append4gh_appendN (l1, ..., lN) by
scm_append (scm_list_n (l1, ..., lN, SCM_UNDEFINED))
gh_reversescm_reverse instead.
gh_list_tail and gh_list_refscm_list_tail and scm_list_ref instead.
gh_memq, gh_memv and gh_memberscm_memq, scm_memv and scm_member instead.
gh_assq, gh_assv and gh_assocscm_assq, scm_assv and scm_assoc instead.
gh_make_vectorscm_make_vector instead.
gh_vector or gh_list_to_vectorscm_vector instead.
gh_vector_ref and gh_vector_set_xscm_vector_ref and scm_vector_set_x instead.
gh_vector_lengthscm_c_vector_length instead.
gh_uniform_vector_lengthscm_c_uniform_vector_length instead.
gh_uniform_vector_refscm_c_uniform_vector_ref instead.
gh_vector_to_listscm_vector_to_list instead.
gh_applyscm_apply_0 instead.
gh_call0gh_call1gh_call2gh_call3scm_call_0, scm_call_1, etc instead.
gh_displaygh_writegh_newlinescm_display (obj, scm_current_output_port ()) instead, etc.
gh_lookupscm_variable_ref (scm_c_lookup (name)) instead.
gh_module_lookupscm_variable_ref (scm_c_module_lookup (module, name)) instead.