summaryrefslogtreecommitdiff
path: root/libguile/deprecated.h
diff options
context:
space:
mode:
authorMarius Vollmer <mvo@zagadka.de>2004-08-12 17:43:41 +0000
committerMarius Vollmer <mvo@zagadka.de>2004-08-12 17:43:41 +0000
commit6f14f578d2e24f58594e682061755dab41ed1f9e (patch)
tree06d7cbd7b83020f4f2ee5fec58b19f76eb27e9cb /libguile/deprecated.h
parent396e5506d6c7ba9e669856cae97445e5c307ba34 (diff)
downloadguile-6f14f578d2e24f58594e682061755dab41ed1f9e.tar.gz
* strings.h, strings.c (scm_i_get_substring_spec): New.
* socket.c, rw.c, deprecated.h, validate.h (SCM_VALIDATE_STRING_COPY): Deprecated. Replaced all uses with SCM_VALIDATE_STRING plus SCM_I_STRING_CHARS or scm_to_locale_string, etc. (SCM_VALIDATE_SUBSTRING_SPEC_COPY): Deprecated. Replaced as above, plus scm_i_get_substring_spec.
Diffstat (limited to 'libguile/deprecated.h')
-rw-r--r--libguile/deprecated.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/libguile/deprecated.h b/libguile/deprecated.h
index 4336dd472..bc7f527f7 100644
--- a/libguile/deprecated.h
+++ b/libguile/deprecated.h
@@ -410,6 +410,35 @@ SCM_API char *scm_c_substring2str (SCM obj, char *str, size_t start, size_t len)
SCM_API double scm_truncate (double x);
SCM_API double scm_round (double x);
+/* Deprecated because we don't want people to access the internal
+ representation of strings directly.
+*/
+
+#define SCM_VALIDATE_STRING_COPY(pos, str, cvar) \
+ do { \
+ SCM_ASSERT (SCM_STRINGP (str), str, pos, FUNC_NAME); \
+ cvar = SCM_STRING_CHARS(str); \
+ } while (0)
+
+/* validate a string and optional start/end arguments which default to
+ 0/string-len. this is unrelated to the old shared substring
+ support, so please do not deprecate it :) */
+#define SCM_VALIDATE_SUBSTRING_SPEC_COPY(pos_str, str, c_str, \
+ pos_start, start, c_start,\
+ pos_end, end, c_end) \
+ do {\
+ SCM_VALIDATE_STRING_COPY (pos_str, str, c_str);\
+ c_start = SCM_UNBNDP(start)? 0 : scm_to_size_t (start);\
+ c_end = SCM_UNBNDP(end)? SCM_STRING_LENGTH(str) : scm_to_size_t (end);\
+ SCM_ASSERT_RANGE (pos_start, start,\
+ 0 <= c_start \
+ && (size_t) c_start <= SCM_STRING_LENGTH (str));\
+ SCM_ASSERT_RANGE (pos_end, end,\
+ c_start <= c_end \
+ && (size_t) c_end <= SCM_STRING_LENGTH (str));\
+ } while (0)
+
+
void scm_i_init_deprecated (void);
#endif