diff --git a/libguile/deprecated.c b/libguile/deprecated.c index e74778566..91cb86ccf 100644 --- a/libguile/deprecated.c +++ b/libguile/deprecated.c @@ -651,6 +651,33 @@ scm_strprint_obj (SCM obj) return scm_object_to_string (obj, SCM_UNDEFINED); } +char * +scm_i_object_chars (SCM obj) +{ + scm_c_issue_deprecation_warning + ("SCM_CHARS is deprecated. See the manual for alternatives."); + if (SCM_STRINGP (obj)) + return SCM_STRING_CHARS (obj); + if (SCM_SYMBOLP (obj)) + return SCM_SYMBOL_CHARS (obj); + abort (); +} + +long +scm_i_object_length (SCM obj) +{ + scm_c_issue_deprecation_warning + ("SCM_LENGTH is deprecated. " + "Use scm_c_string_length instead, for example, or see the manual."); + if (SCM_STRINGP (obj)) + return SCM_STRING_LENGTH (obj); + if (SCM_SYMBOLP (obj)) + return SCM_SYMBOL_LENGTH (obj); + if (SCM_VECTORP (obj)) + return SCM_VECTOR_LENGTH (obj); + abort (); +} + SCM scm_sym2ovcell_soft (SCM sym, SCM obarray) { diff --git a/libguile/deprecated.h b/libguile/deprecated.h index a8c7de36a..4032baff5 100644 --- a/libguile/deprecated.h +++ b/libguile/deprecated.h @@ -226,6 +226,15 @@ SCM_API SCM scm_strprint_obj (SCM obj); SCM_API SCM scm_read_0str (char *expr); SCM_API SCM scm_eval_0str (const char *expr); +SCM_API char *scm_i_object_chars (SCM); + +#define SCM_CHARS(x) scm_i_object_chars(x) +#define SCM_UCHARS(x) ((unsigned char *)SCM_CHARS(x)) + +SCM_API long scm_i_object_length (SCM); + +#define SCM_LENGTH(x) scm_i_object_length(x) + #define scm_strhash(str, len, n) (scm_string_hash ((str), (len)) % (n)) SCM_API SCM scm_sym2ovcell_soft (SCM sym, SCM obarray);