Hi Ludovic, et al.,
On 01/20/11 14:34, Ludovic Courtès wrote:
> What message are you replying to?
A private thread that led to the issue where the altered
config test program was trying to use scm_c_make_string()
on a system still running 1.6.8. At least the BSD world
looks like it has moved beyond 1.4.x. Maybe I can remove
the prior-to-1.6 wrappers now. Obviously, I still have
to have the 1.6 and after wrappers.
Basically, I need a very short C program than links against
libguile to ensure that the functions I need are there.
> Bruce Korb <[email protected]> writes:
> Which interfaces specifically?
_Very_ specifically, see the attached header. :)
There are other interfaces that I use, but they
haven't wiggled, so I haven't added 'em to the
interface glue file.
#if GUILE_VERSION < 106000
# define AG_SCM_APPLY2(_op, _f, _tst) gh_call2(_op, _f, _tst)
# define AG_SCM_BOOL_P(_b) gh_boolean_p(_b)
# define AG_SCM_BOOT_GUILE(_ac, _av, _im) \
gh_enter((_ac), (_av), (_im))
# define AG_SCM_CHAR(_c) gh_scm2char(_c)
# define AG_SCM_CHARS(_s) SCM_CHARS(_s)
# define AG_SCM_CHAR_P(_c) gh_char_p(_c)
# define AG_SCM_DISPLAY(_s) gh_display(_s)
# define AG_SCM_FALSEP(_r) SCM_FALSEP(_r)
# define AG_SCM_FROM_LONG(_l) gh_long2scm(_l)
# define AG_SCM_INT2SCM(_i) gh_int2scm(_i)
# define AG_SCM_IS_PROC(_p) gh_procedure_p(_p)
# define AG_SCM_LIST_P(_l) gh_list_p(_l)
# define AG_SCM_LONG2SCM(_i) gh_long2scm(_i)
# define AG_SCM_NFALSEP(_r) SCM_NFALSEP(_r)
# define AG_SCM_NULLP(_m) SCM_NULLP(_m)
# define AG_SCM_NUM_P(_n) gh_number_p(_n)
# define AG_SCM_PAIR_P(_p) gh_pair_p(_p)
# define AG_SCM_STR02SCM(_s) gh_str02scm(_s)
# define AG_SCM_STR2SCM(_st,_sz) gh_str2scm(_st,_sz)
# define AG_SCM_STRING_P(_s) gh_string_p(_s)
# define AG_SCM_STRLEN(_s) SCM_LENGTH(_s)
# define AG_SCM_SYM_P(_s) gh_symbol_p(_s)
# define AG_SCM_TO_INT(_i) gh_scm2int(_i)
# define AG_SCM_TO_LONG(_v) gh_scm2long(_v)
# define AG_SCM_TO_NEWSTR(_s) gh_scm2newstr(_s, NULL)
# define AG_SCM_TO_ULONG(_v) gh_scm2ulong(_v)
# define AG_SCM_VEC_P(_v) gh_vector_p(_v)
#elif GUILE_VERSION < 107000
# define AG_SCM_APPLY2(_op, _f, _tst) gh_call2(_op, _f, _tst)
# define AG_SCM_BOOL_P(_b) gh_boolean_p(_b)
# define AG_SCM_BOOT_GUILE(_ac, _av, _im) \
gh_enter((_ac), (_av), (_im))
# define AG_SCM_CHAR(_c) gh_scm2char(_c)
# define AG_SCM_CHARS(_s) SCM_CHARS(_s)
# define AG_SCM_CHAR_P(_c) gh_char_p(_c)
# define AG_SCM_DISPLAY(_s) gh_display(_s)
# define AG_SCM_FALSEP(_r) SCM_FALSEP(_r)
# define AG_SCM_FROM_LONG(_l) gh_long2scm(_l)
# define AG_SCM_INT2SCM(_i) gh_int2scm(_i)
# define AG_SCM_IS_PROC(_p) SCM_NFALSEP( scm_procedure_p(_p))
# define AG_SCM_LIST_P(_l) SCM_NFALSEP( scm_list_p(_l))
# define AG_SCM_LONG2SCM(_i) gh_long2scm(_i)
# define AG_SCM_NFALSEP(_r) SCM_NFALSEP(_r)
# define AG_SCM_NULLP(_m) SCM_NULLP(_m)
# define AG_SCM_NUM_P(_n) SCM_NUMBERP(_n)
# define AG_SCM_PAIR_P(_p) SCM_NFALSEP( scm_pair_p(_p))
# define AG_SCM_STR02SCM(_s) scm_makfrom0str(_s)
# define AG_SCM_STR2SCM(_st,_sz) scm_mem2string(_st,_sz)
# define AG_SCM_STRING_P(_s) SCM_STRINGP(_s)
# define AG_SCM_STRLEN(_s) SCM_LENGTH(_s)
# define AG_SCM_SYM_P(_s) gh_symbol_p(_s)
# define AG_SCM_TO_INT(_i) gh_scm2int(_i)
# define AG_SCM_TO_LONG(_v) gh_scm2long(_v)
# define AG_SCM_TO_NEWSTR(_s) gh_scm2newstr(_s, NULL)
# define AG_SCM_TO_ULONG(_v) gh_scm2ulong(_v)
# define AG_SCM_VEC_P(_v) gh_vector_p(_v)
#elif GUILE_VERSION < 108000
# define AG_SCM_APPLY2(_op, _f, _tst) gh_call2(_op, _f, _tst)
# define AG_SCM_BOOL_P(_b) SCM_BOOLP(_b)
# define AG_SCM_BOOT_GUILE(_ac, _av, _im) \
gh_enter((_ac), (_av), (_im))
# define AG_SCM_CHAR(_c) gh_scm2char(_c)
# define AG_SCM_CHARS(_s) SCM_STRING_CHARS(_s)
# define AG_SCM_CHAR_P(_c) gh_char_p(_c)
# define AG_SCM_DISPLAY(_s) gh_display(_s)
# define AG_SCM_FALSEP(_r) SCM_FALSEP(_r)
# define AG_SCM_FROM_LONG(_l) gh_long2scm(_l)
# define AG_SCM_INT2SCM(_i) gh_int2scm(_i)
# define AG_SCM_IS_PROC(_p) SCM_NFALSEP( scm_procedure_p(_p))
# define AG_SCM_LIST_P(_l) SCM_NFALSEP( scm_list_p(_l))
# define AG_SCM_LONG2SCM(_i) gh_long2scm(_i)
# define AG_SCM_NFALSEP(_r) SCM_NFALSEP(_r)
# define AG_SCM_NULLP(_m) SCM_NULLP(_m)
# define AG_SCM_NUM_P(_n) SCM_NUMBERP(_n)
# define AG_SCM_PAIR_P(_p) SCM_NFALSEP( scm_pair_p(_p))
# define AG_SCM_STR02SCM(_s) scm_makfrom0str(_s)
# define AG_SCM_STR2SCM(_st,_sz) scm_mem2string(_st,_sz)
# define AG_SCM_STRING_P(_s) SCM_STRINGP(_s)
# define AG_SCM_STRLEN(_s) SCM_STRING_LENGTH(_s)
# define AG_SCM_SYM_P(_s) SCM_SYMBOLP(_s)
# define AG_SCM_TO_INT(_i) gh_scm2int(_i)
# define AG_SCM_TO_LONG(_v) gh_scm2long(_v)
# define AG_SCM_TO_NEWSTR(_s) gh_scm2newstr(_s, NULL)
# define AG_SCM_TO_ULONG(_v) gh_scm2ulong(_v)
# define AG_SCM_VEC_P(_v) SCM_VECTORP(_v)
#elif GUILE_VERSION < 201000
# define AG_SCM_APPLY2(_op, _f, _tst) \
scm_apply(_op, _f, scm_cons(_tst, scm_listofnull))
# define AG_SCM_BOOL_P(_b) scm_is_bool(_b)
# define AG_SCM_BOOT_GUILE(_ac, _av, _im) \
scm_boot_guile((_ac), (_av), (_im), NULL)
# define AG_SCM_CHAR(_c) SCM_CHAR(_c)
# define AG_SCM_CHARS(_s) scm_i_string_chars(_s)
# define AG_SCM_CHAR_P(_c) SCM_CHARP(_c)
# define AG_SCM_DISPLAY(_s) \
scm_display(_s, scm_current_output_port())
# define AG_SCM_FALSEP(_r) scm_is_false(_r)
# define AG_SCM_FROM_LONG(_l) scm_from_long(_l)
# define AG_SCM_INT2SCM(_i) scm_from_int(_i)
# define AG_SCM_IS_PROC(_p) scm_is_true( scm_procedure_p(_p))
# define AG_SCM_LIST_P(_l) scm_is_true( scm_list_p(_l))
# define AG_SCM_LONG2SCM(_i) scm_from_long(_i)
# define AG_SCM_NFALSEP(_r) scm_is_true(_r)
# define AG_SCM_NULLP(_m) scm_is_null(_m)
# define AG_SCM_NUM_P(_n) scm_is_number(_n)
# define AG_SCM_PAIR_P(_p) scm_is_true( scm_pair_p(_p))
# define AG_SCM_STR02SCM(_s) scm_from_locale_string(_s)
# define AG_SCM_STR2SCM(_st,_sz) scm_from_locale_stringn(_st,_sz)
# define AG_SCM_STRING_P(_s) scm_is_string(_s)
# define AG_SCM_STRLEN(_s) scm_c_string_length(_s)
# define AG_SCM_SYM_P(_s) scm_is_symbol(_s)
# define AG_SCM_TO_INT(_i) scm_to_int(_i)
# define AG_SCM_TO_LONG(_v) scm_to_long(_v)
# define AG_SCM_TO_NEWSTR(_s) scm_to_locale_string(_s)
# define AG_SCM_TO_ULONG(_v) scm_to_ulong(_v)
# define AG_SCM_VEC_P(_v) scm_is_vector(_v)
# define scm_sizet size_t
#else
#error unknown GUILE_VERSION
#endif
#if GUILE_VERSION < 107000 /* pre-Guile 1.7.x */
static inline char* ag_scm2zchars(SCM s, tCC* type)
{
if (! AG_SCM_STRING_P(s))
AG_ABEND(aprf(zNotStr, type));
if (SCM_SUBSTRP(s))
s = scm_makfromstr(SCM_CHARS(s), SCM_LENGTH(s), 0);
return SCM_CHARS(s);
}
#else /* Guile 1.7 and following */
extern char* ag_scm2zchars(SCM s, tCC* type);
#endif
static inline SCM ag_eval(tCC* pzStr)
{
SCM res;
char const * pzSaveScheme = pzLastScheme; /* Watch for nested calls */
pzLastScheme = pzStr;
res = ag_scm_c_eval_string_from_file_line(
pzStr, pCurTemplate->pzTplFile, pCurMacro->lineNo);
pzLastScheme = pzSaveScheme;
return res;
}