/* classes: h_files */
-#ifndef STRINGSH
-#define STRINGSH
-/* Copyright (C) 1995,1996,1997,1998, 2000 Free Software Foundation, Inc.
+#ifndef SCM_STRINGS_H
+#define SCM_STRINGS_H
+/* Copyright (C) 1995,1996,1997,1998,2000,2001 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
\f
-#define SCM_STRINGP(x) (SCM_NIMP (x) && (SCM_TYP7S (x) == scm_tc7_string))
+#define SCM_STRINGP(x) (!SCM_IMP (x) && (SCM_TYP7S (x) == scm_tc7_string))
+#if (SCM_DEBUG_DEPRECATED == 1)
+#define SCM_STRING_UCHARS(x) ((unsigned char *) (SCM_CELL_WORD_1 (x)))
#define SCM_STRING_CHARS(x) ((char *) (SCM_CELL_WORD_1 (x)))
+#endif
+#define SCM_SET_STRING_CHARS(s, c) (SCM_SET_CELL_WORD_1 ((s), (c)))
+#define SCM_STRING_MAX_LENGTH ((1UL << 24) - 1UL)
+#define SCM_STRING_LENGTH(x) ((size_t) (SCM_CELL_WORD_0 (x) >> 8))
+#define SCM_SET_STRING_LENGTH(s, l) (SCM_SET_CELL_WORD_0 ((s), ((l) << 8) + scm_tc7_string))
-/* Is X a writable string (i.e., not a substring)? */
-#define SCM_RWSTRINGP(x) (SCM_NIMP (x) && (SCM_TYP7 (x) == scm_tc7_string))
+#define SCM_STRING_COERCE_0TERMINATION_X(x) \
+ { if (!SCM_IMP (x) && (SCM_TYP7 (x) == scm_tc7_substring)) \
+ x = scm_mem2string (SCM_STRING_CHARS (x), SCM_STRING_LENGTH (x)); }
\f
extern SCM scm_string_p (SCM x);
extern SCM scm_read_only_string_p (SCM x);
extern SCM scm_string (SCM chrs);
-extern SCM scm_makstr (long len, int);
extern SCM scm_makfromstrs (int argc, char **argv);
-extern SCM scm_take_str (char *s, int len);
+extern SCM scm_take_str (char *s, size_t len);
extern SCM scm_take0str (char *s);
-extern SCM scm_makfromstr (const char *src, scm_sizet len, int);
+extern SCM scm_mem2string (const char *src, size_t len);
extern SCM scm_makfrom0str (const char *src);
extern SCM scm_makfrom0str_opt (const char *src);
+extern SCM scm_allocate_string (size_t len);
extern SCM scm_make_string (SCM k, SCM chr);
extern SCM scm_string_length (SCM str);
extern SCM scm_string_ref (SCM str, SCM k);
extern SCM scm_string_set_x (SCM str, SCM k, SCM chr);
extern SCM scm_substring (SCM str, SCM start, SCM end);
extern SCM scm_string_append (SCM args);
-extern SCM scm_make_shared_substring (SCM str, SCM frm, SCM to);
extern void scm_init_strings (void);
\f
#if (SCM_DEBUG_DEPRECATED == 0)
#define SCM_SLOPPY_STRINGP(x) (SCM_STRINGP(x))
-#define SCM_NSTRINGP(x) (!SCM_STRINGP(x))
-#define SCM_NRWSTRINGP(x) (! SCM_RWSTRINGP (x))
+#define SCM_RWSTRINGP(x) (!SCM_IMP (x) && (SCM_TYP7 (x) == scm_tc7_string))
+#define SCM_STRING_UCHARS(x) \
+ ((SCM_TYP7 (x) == scm_tc7_substring) \
+ ? (unsigned char *) SCM_CELL_WORD_1 (SCM_CDDR (x)) + SCM_INUM (SCM_CADR (x)) \
+ : (unsigned char *) SCM_CELL_WORD_1 (x))
+#define SCM_STRING_CHARS(x) \
+ ((SCM_TYP7 (x) == scm_tc7_substring) \
+ ? (char *) SCM_CELL_WORD_1 (SCM_CDDR (x)) + SCM_INUM (SCM_CADR (x)) \
+ : (char *) SCM_CELL_WORD_1 (x))
+extern SCM scm_make_shared_substring (SCM str, SCM frm, SCM to);
+extern SCM scm_makstr (size_t len, int);
+extern SCM scm_makfromstr (const char *src, size_t len, int);
#endif /* SCM_DEBUG_DEPRECATED == 0 */
-#endif /* STRINGSH */
+#endif /* SCM_STRINGS_H */
/*
Local Variables: