1 /* An abstract string datatype.
2 Copyright (C) 1998-2017 Free Software Foundation, Inc.
3 Contributed by Mark Mitchell (mark@markmitchell.com).
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
12 GCC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING. If not, write to
19 the Free Software Foundation, 51 Franklin Street - Fifth Floor,
20 Boston, MA 02110-1301, USA. */
29 typedef struct dyn_string
31 int allocated
; /* The amount of space allocated for the string. */
32 int length
; /* The actual length of the string. */
33 char *s
; /* The string itself, NUL-terminated. */
36 /* The length STR, in bytes, not including the terminating NUL. */
37 #define dyn_string_length(STR) \
40 /* The NTBS in which the contents of STR are stored. */
41 #define dyn_string_buf(STR) \
44 /* Compare DS1 to DS2 with strcmp. */
45 #define dyn_string_compare(DS1, DS2) \
46 (strcmp ((DS1)->s, (DS2)->s))
49 extern int dyn_string_init (struct dyn_string
*, int);
50 extern dyn_string_t
dyn_string_new (int);
51 extern void dyn_string_delete (dyn_string_t
);
52 extern char *dyn_string_release (dyn_string_t
);
53 extern dyn_string_t
dyn_string_resize (dyn_string_t
, int);
54 extern void dyn_string_clear (dyn_string_t
);
55 extern int dyn_string_copy (dyn_string_t
, dyn_string_t
);
56 extern int dyn_string_copy_cstr (dyn_string_t
, const char *);
57 extern int dyn_string_prepend (dyn_string_t
, dyn_string_t
);
58 extern int dyn_string_prepend_cstr (dyn_string_t
, const char *);
59 extern int dyn_string_insert (dyn_string_t
, int, dyn_string_t
);
60 extern int dyn_string_insert_cstr (dyn_string_t
, int, const char *);
61 extern int dyn_string_insert_char (dyn_string_t
, int, int);
62 extern int dyn_string_append (dyn_string_t
, dyn_string_t
);
63 extern int dyn_string_append_cstr (dyn_string_t
, const char *);
64 extern int dyn_string_append_char (dyn_string_t
, int);
65 extern int dyn_string_substring (dyn_string_t
, dyn_string_t
, int, int);
66 extern int dyn_string_eq (dyn_string_t
, dyn_string_t
);
72 #endif /* !defined (DYN_STRING_H) */
This page took 0.03121 seconds and 4 git commands to generate.