www.delorie.com/gnu/docs/guile/guile_158.html   search  
 
Buy GNU books!


Guile Reference Manual

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

19.14 Transitioning to the scm Interface

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.

Header file
Use #include <libguile.h> instead of #include <guile/gh.h>.

Compiling and Linking
Use 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.

The SCM type
No change: the scm interface also uses this type to represent an arbitrary Scheme value.

SCM_BOOL_F and SCM_BOOL_T
No change.

SCM_UNSPECIFIED and SCM_UNDEFINED
No change.

gh_enter
Use 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. 5.3.1 Guile Initialization Functions for more details.

gh_repl
Use scm_shell instead.

gh_init
Use scm_init_guile instead.

gh_eval_str
Use scm_c_eval_string instead.

gh_eval_file or gh_load
Use scm_c_primitive_load instead.

gh_new_procedure
Use 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. 5.4.1 A Sample Guile Extension for an example.

gh_defer_ints and gh_allow_ints
Use SCM_DEFER_INTS and SCM_ALLOW_INTS instead. Note that these macros are used without parentheses, as in SCM_DEFER_INTS;.

gh_bool2scm
Use SCM_BOOL instead.

gh_ulong2scm
Use scm_ulong2num instead.

gh_long2scm
Use scm_long2num instead.

gh_double2scm
Use scm_make_real instead.

gh_char2scm
Use SCM_MAKE_CHAR instead.

gh_str2scm
Use scm_mem2string instead.

gh_str02scm
Use scm_makfrom0str instead.

gh_set_substr
No direct scm equivalent. [FIXME]

gh_symbol2scm
Use scm_str2symbol instead. [FIXME: inconsistent naming, should be scm_str02symbol.]

gh_ints2scm and gh_doubles2scm
No direct scm equivalent. [FIXME]

gh_chars2byvect and gh_shorts2svect
No direct scm equivalent. [FIXME]

gh_longs2ivect and gh_ulongs2uvect
No direct scm equivalent. [FIXME]

gh_floats2fvect and gh_doubles2dvect
No direct scm equivalent. [FIXME]

gh_scm2bool
Use SCM_NFALSEP instead.

gh_scm2int
Replace 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
Replace 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
Replace 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
Replace gh_scm2double (obj) by
 
scm_num2dbl (obj, str)
where str is a C string that describes the context of the call.

gh_scm2char
Use the 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
No direct scm equivalent. [FIXME]

gh_get_substr
No direct scm equivalent. [FIXME]

gh_symbol2newstr
No direct scm equivalent. [FIXME]

gh_scm2chars
No direct scm equivalent. [FIXME]

gh_scm2shorts and gh_scm2longs
No direct scm equivalent. [FIXME]

gh_scm2floats and gh_scm2doubles
No direct scm equivalent. [FIXME]

gh_boolean_p
Use the SCM_BOOLP macro instead, or replace gh_boolean_p (obj) by
 
SCM_NFALSEP (scm_boolean_p (obj))

gh_symbol_p
Use the SCM_SYMBOLP macro instead, or replace gh_symbol_p (obj) by
 
SCM_NFALSEP (scm_symbol_p (obj))

gh_char_p
Use the SCM_CHARP macro instead, or replace gh_char_p (obj) by
 
SCM_NFALSEP (scm_char_p (obj))

gh_vector_p
Use the SCM_VECTORP macro instead, or replace gh_vector_p (obj) by
 
SCM_NFALSEP (scm_vector_p (obj))

gh_pair_p
Use the SCM_CONSP macro instead, or replace gh_pair_p (obj) by
 
SCM_NFALSEP (scm_pair_p (obj))

gh_number_p
Use the SCM_NUMBERP macro instead, or replace gh_number_p (obj) by
 
SCM_NFALSEP (scm_number_p (obj))

gh_string_p
Use the SCM_STRINGP macro instead, or replace gh_string_p (obj) by
 
SCM_NFALSEP (scm_string_p (obj))

gh_procedure_p
Replace gh_procedure_p (obj) by
 
SCM_NFALSEP (scm_procedure_p (obj))

gh_list_p
Replace gh_list_p (obj) by
 
SCM_NFALSEP (scm_list_p (obj))

gh_inexact_p
Use the SCM_INEXACTP macro instead, or replace gh_inexact_p (obj) by
 
SCM_NFALSEP (scm_inexact_p (obj))

gh_exact_p
Replace gh_exact_p (obj) by
 
SCM_NFALSEP (scm_exact_p (obj))

gh_eq_p
Use the SCM_EQ_P macro instead, or replace gh_eq_p (x, y) by
 
SCM_NFALSEP (scm_eq_p (x, y))

gh_eqv_p
Replace gh_eqv_p (x, y) by
 
SCM_NFALSEP (scm_eqv_p (x, y))

gh_equal_p
Replace gh_equal_p (x, y) by
 
SCM_NFALSEP (scm_equal_p (x, y))

gh_string_equal_p
Replace gh_string_equal_p (x, y) by
 
SCM_NFALSEP (scm_string_equal_p (x, y))

gh_null_p
Use the SCM_NULLP macro instead, or replace gh_null_p (obj) by
 
SCM_NFALSEP (scm_null_p (obj))

gh_cons
Use scm_cons instead.

gh_car and gh_cdr
Use the SCM_CAR and SCM_CDR macros instead.

gh_cxxr and gh_cxxxr
(Where each x is either `a' or `d'.) Use the corresponding SCM_CXXR or SCM_CXXXR macro instead.

gh_set_car_x and gh_set_cdr_x
Use scm_set_car_x and scm_set_cdr_x instead.

gh_list
Use scm_listify instead.

gh_length
Replace 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
Use scm_append instead.

gh_append2, gh_append3, gh_append4
Replace gh_appendN (l1, ..., lN) by
 
scm_append (scm_listify (l1, ..., lN, SCM_UNDEFINED))

gh_reverse
Use scm_reverse instead.

gh_list_tail and gh_list_ref
Use scm_list_tail and scm_list_ref instead.

gh_memq, gh_memv and gh_member
Use scm_memq, scm_memv and scm_member instead.

gh_assq, gh_assv and gh_assoc
Use scm_assq, scm_assv and scm_assoc instead.

gh_make_vector
Use scm_make_vector instead.

gh_vector or gh_list_to_vector
Use scm_vector instead.

gh_vector_ref and gh_vector_set_x
Use scm_vector_ref and scm_vector_set_x instead.

gh_vector_length
Use the SCM_VECTOR_LENGTH macro instead.

gh_apply
Use scm_apply instead, but note that scm_apply takes an additional third argument that you should set to SCM_EOL.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003