Changed license terms to the plain LGPL thru-out.
[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
8c494e99 29#define SCM_STRINGP(x) (!SCM_IMP (x) && (SCM_TYP7 (x) == scm_tc7_string))
a002f1a2 30#define SCM_STRING_UCHARS(x) ((unsigned char *) (SCM_CELL_WORD_1 (x)))
c1aef037 31#define SCM_STRING_CHARS(x) ((char *) (SCM_CELL_WORD_1 (x)))
6a0476fd 32#define SCM_SET_STRING_CHARS(s, c) (SCM_SET_CELL_WORD_1 ((s), (c)))
2635d5ef
MV
33#define SCM_STRING_MAX_LENGTH ((1UL << 24) - 1UL)
34#define SCM_STRING_LENGTH(x) ((size_t) (SCM_CELL_WORD_0 (x) >> 8))
c65e9822
MV
35#define SCM_MAKE_STRING_TAG(l) ((((scm_t_bits) (l)) << 8) + scm_tc7_string)
36#define SCM_SET_STRING_LENGTH(s, l) (SCM_SET_CELL_WORD_0 ((s), SCM_MAKE_STRING_TAG (l)))
0f2d19dd
JB
37
38\f
39
33b001fd
MV
40SCM_API SCM scm_string_p (SCM x);
41SCM_API SCM scm_string (SCM chrs);
42SCM_API SCM scm_makfromstrs (int argc, char **argv);
43SCM_API SCM scm_take_str (char *s, size_t len);
44SCM_API SCM scm_take0str (char *s);
45SCM_API SCM scm_mem2string (const char *src, size_t len);
46SCM_API SCM scm_str2string (const char *src);
47SCM_API SCM scm_makfrom0str (const char *src);
48SCM_API SCM scm_makfrom0str_opt (const char *src);
49SCM_API SCM scm_allocate_string (size_t len);
50SCM_API SCM scm_make_string (SCM k, SCM chr);
51SCM_API SCM scm_string_length (SCM str);
52SCM_API SCM scm_string_ref (SCM str, SCM k);
53SCM_API SCM scm_string_set_x (SCM str, SCM k, SCM chr);
54SCM_API SCM scm_substring (SCM str, SCM start, SCM end);
55SCM_API SCM scm_string_append (SCM args);
56SCM_API void scm_init_strings (void);
4d4528e7 57SCM_API char *scm_c_string2str (SCM obj, char *str, size_t *lenp);
af68e5e5 58SCM_API char *scm_c_substring2str (SCM obj, char *str, size_t start, size_t len);
0f2d19dd 59
6ba93e5e
DH
60\f
61
8c494e99 62#if (SCM_ENABLE_DEPRECATED == 1)
6ba93e5e 63
8c494e99 64#define SCM_STRING_COERCE_0TERMINATION_X(x) (x)
6ba93e5e 65
8c494e99 66#endif
6ba93e5e 67
36284627 68#endif /* SCM_STRINGS_H */
89e00824
ML
69
70/*
71 Local Variables:
72 c-file-style: "gnu"
73 End:
74*/