Node:scm transition summary, Previous:Mixing gh and scm APIs, Up:GH
The following table summarizes the available information on how to transition from the GH to the scm interface. Where transitioning is not completely straightforward, the table includes a reference to more detailed documentation in the preceding sections.
#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 type
SCM_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_eval_str
scm_c_eval_string instead.
gh_eval_file or gh_load
scm_c_primitive_load instead.
gh_new_procedure
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_DEFER_INTS and SCM_ALLOW_INTS instead. Note that
these macros are used without parentheses, as in SCM_DEFER_INTS;.
gh_bool2scm
SCM_BOOL instead.
gh_ulong2scm
scm_ulong2num instead.
gh_long2scm
scm_long2num instead.
gh_double2scm
scm_make_real instead.
gh_char2scm
SCM_MAKE_CHAR instead.
gh_str2scm
scm_mem2string instead.
gh_str02scm
scm_makfrom0str instead.
gh_set_substr
gh_symbol2scm
scm_str2symbol instead. [FIXME: inconsistent naming,
should be scm_str02symbol.]
gh_ints2scm and gh_doubles2scm
gh_chars2byvect and gh_shorts2svect
gh_longs2ivect and gh_ulongs2uvect
gh_floats2fvect and gh_doubles2dvect
gh_scm2bool
SCM_NFALSEP instead.
gh_scm2int
gh_scm2int (obj) by
scm_num2int (obj, SCM_ARG1, str)where str is a C string that describes the context of the call.
gh_scm2ulong
gh_scm2ulong (obj) by
scm_num2ulong (obj, SCM_ARG1, str)where str is a C string that describes the context of the call.
gh_scm2long
gh_scm2long (obj) by
scm_num2long (obj, SCM_ARG1, str)where str is a C string that describes the context of the call.
gh_scm2double
gh_scm2double (obj) by
scm_num2dbl (obj, str)where str is a C string that describes the context of the call.
gh_scm2char
SCM_CHAR macro instead, but note that SCM_CHAR
does not check that its argument is actually a character. To check that
a SCM value is a character before using SCM_CHAR to
extract the character value, use the SCM_VALIDATE_CHAR macro.
gh_scm2newstr
gh_get_substr
gh_symbol2newstr
gh_scm2chars
gh_scm2shorts and gh_scm2longs
gh_scm2floats and gh_scm2doubles
gh_boolean_p
SCM_BOOLP macro instead, or replace gh_boolean_p
(obj) by
SCM_NFALSEP (scm_boolean_p (obj))
gh_symbol_p
SCM_SYMBOLP macro instead, or replace gh_symbol_p
(obj) by
SCM_NFALSEP (scm_symbol_p (obj))
gh_char_p
SCM_CHARP macro instead, or replace gh_char_p
(obj) by
SCM_NFALSEP (scm_char_p (obj))
gh_vector_p
SCM_VECTORP macro instead, or replace gh_vector_p
(obj) by
SCM_NFALSEP (scm_vector_p (obj))
gh_pair_p
SCM_CONSP macro instead, or replace gh_pair_p
(obj) by
SCM_NFALSEP (scm_pair_p (obj))
gh_number_p
SCM_NUMBERP macro instead, or replace gh_number_p
(obj) by
SCM_NFALSEP (scm_number_p (obj))
gh_string_p
SCM_STRINGP macro instead, or replace gh_string_p
(obj) by
SCM_NFALSEP (scm_string_p (obj))
gh_procedure_p
gh_procedure_p (obj) by
SCM_NFALSEP (scm_procedure_p (obj))
gh_list_p
gh_list_p (obj) by
SCM_NFALSEP (scm_list_p (obj))
gh_inexact_p
SCM_INEXACTP macro instead, or replace gh_inexact_p
(obj) by
SCM_NFALSEP (scm_inexact_p (obj))
gh_exact_p
gh_exact_p (obj) by
SCM_NFALSEP (scm_exact_p (obj))
gh_eq_p
SCM_EQ_P macro instead, or replace gh_eq_p
(x, y) by
SCM_NFALSEP (scm_eq_p (x, y))
gh_eqv_p
gh_eqv_p (x, y) by
SCM_NFALSEP (scm_eqv_p (x, y))
gh_equal_p
gh_equal_p (x, y) by
SCM_NFALSEP (scm_equal_p (x, y))
gh_string_equal_p
gh_string_equal_p (x, y) by
SCM_NFALSEP (scm_string_equal_p (x, y))
gh_null_p
SCM_NULLP macro instead, or replace gh_null_p
(obj) by
SCM_NFALSEP (scm_null_p (obj))
gh_cons
scm_cons instead.
gh_car and gh_cdr
SCM_CAR and SCM_CDR macros instead.
gh_cxxr and gh_cxxxr
a or d.) Use the corresponding
SCM_CXXR or SCM_CXXXR macro instead.
gh_set_car_x and gh_set_cdr_x
scm_set_car_x and scm_set_cdr_x instead.
gh_list
scm_listify instead.
gh_length
gh_length (lst) by
scm_num2ulong (scm_length (lst), SCM_ARG1, str)where str is a C string that describes the context of the call.
gh_append
scm_append instead.
gh_append2, gh_append3, gh_append4
gh_appendN (l1, ..., lN) by
scm_append (scm_listify (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_VECTOR_LENGTH macro instead.
gh_apply
scm_apply instead, but note that scm_apply takes an
additional third argument that you should set to SCM_EOL.