* strings.h, deprecated.h (SCM_STRING_COERCE_0TERMINATION_X):
[bpt/guile.git] / libguile / strings.h
CommitLineData
0f2d19dd
JB
1/* classes: h_files */
2
36284627
DH
3#ifndef SCM_STRINGS_H
4#define SCM_STRINGS_H
8c494e99 5
36284627 6/* Copyright (C) 1995,1996,1997,1998,2000,2001 Free Software Foundation, Inc.
8c494e99 7 *
73be1d9e
MV
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
8c494e99 12 *
73be1d9e 13 * This library is distributed in the hope that it will be useful,
0f2d19dd 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
73be1d9e
MV
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
8c494e99 17 *
73be1d9e
MV
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
d3a6bc94 22
0f2d19dd
JB
23\f
24
b4309c3c 25#include "libguile/__scm.h"
0f2d19dd
JB
26
27\f
28
c829a427
MV
29#define SCM_STRING_MAX_LENGTH ((SCM_T_BITS_MAX-255)/256)
30
31#define SCM_I_MAKE_STRING_TAG(l) ((((scm_t_bits) (l)) << 8) + scm_tc7_string)
32#define SCM_I_STRINGP(x) (!SCM_IMP (x) && (SCM_TYP7 (x) == scm_tc7_string))
33#define SCM_I_STRING_UCHARS(x) ((unsigned char *) (SCM_CELL_WORD_1 (x)))
34#define SCM_I_STRING_CHARS(x) ((char *) (SCM_CELL_WORD_1 (x)))
35#define SCM_I_STRING_LENGTH(x) ((size_t) (SCM_CELL_WORD_0 (x) >> 8))
36
37#define SCM_STRINGP SCM_I_STRINGP
38#define SCM_STRING_CHARS SCM_I_STRING_CHARS
39#define SCM_STRING_UCHARS SCM_I_STRING_UCHARS
40#define SCM_STRING_LENGTH SCM_I_STRING_LENGTH
0f2d19dd
JB
41
42\f
43
33b001fd
MV
44SCM_API SCM scm_string_p (SCM x);
45SCM_API SCM scm_string (SCM chrs);
c829a427
MV
46SCM_API SCM scm_make_string (SCM k, SCM chr);
47SCM_API SCM scm_string_length (SCM str);
48SCM_API SCM scm_string_ref (SCM str, SCM k);
49SCM_API SCM scm_string_set_x (SCM str, SCM k, SCM chr);
50SCM_API SCM scm_substring (SCM str, SCM start, SCM end);
51SCM_API SCM scm_string_append (SCM args);
52
33b001fd
MV
53SCM_API SCM scm_makfromstrs (int argc, char **argv);
54SCM_API SCM scm_take_str (char *s, size_t len);
55SCM_API SCM scm_take0str (char *s);
56SCM_API SCM scm_mem2string (const char *src, size_t len);
57SCM_API SCM scm_str2string (const char *src);
58SCM_API SCM scm_makfrom0str (const char *src);
59SCM_API SCM scm_makfrom0str_opt (const char *src);
60SCM_API SCM scm_allocate_string (size_t len);
0f2d19dd 61
c829a427
MV
62SCM_API int scm_is_string (SCM x);
63SCM_API SCM scm_from_locale_string (const char *str);
64SCM_API SCM scm_from_locale_stringn (const char *str, size_t len);
65SCM_API SCM scm_take_locale_string (char *str);
66SCM_API SCM scm_take_locale_stringn (char *str, size_t len);
67SCM_API char *scm_to_locale_string (SCM str);
68SCM_API char *scm_to_locale_stringn (SCM str, size_t *lenp);
69SCM_API size_t scm_to_locale_stringbuf (SCM str, char *buf, size_t max_len);
6ba93e5e 70
c829a427 71/* internal utility functions. */
6ba93e5e 72
c829a427
MV
73SCM_API char **scm_i_allocate_string_pointers (SCM list);
74SCM_API void scm_i_free_string_pointers (char **pointers);
6ba93e5e 75
c829a427 76SCM_API void scm_init_strings (void);
6ba93e5e 77
36284627 78#endif /* SCM_STRINGS_H */
89e00824
ML
79
80/*
81 Local Variables:
82 c-file-style: "gnu"
83 End:
84*/