merge from gcc
[deliverable/binutils-gdb.git] / include / dyn-string.h
CommitLineData
b8cdcddf 1/* An abstract string datatype.
099f84cf 2 Copyright (C) 1998, 1999, 2000, 2002, 2004 Free Software Foundation, Inc.
b8cdcddf
L
3 Contributed by Mark Mitchell (mark@markmitchell.com).
4
da4d4077 5This file is part of GCC.
b8cdcddf 6
da4d4077 7GCC is free software; you can redistribute it and/or modify
b8cdcddf
L
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option)
10any later version.
11
da4d4077 12GCC is distributed in the hope that it will be useful,
b8cdcddf
L
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
da4d4077 18along with GCC; see the file COPYING. If not, write to
b8cdcddf
L
19the Free Software Foundation, 59 Temple Place - Suite 330,
20Boston, MA 02111-1307, USA. */
21
22
23typedef struct dyn_string
24{
25 int allocated; /* The amount of space allocated for the string. */
26 int length; /* The actual length of the string. */
27 char *s; /* The string itself, NUL-terminated. */
28}* dyn_string_t;
29
30/* The length STR, in bytes, not including the terminating NUL. */
31#define dyn_string_length(STR) \
32 ((STR)->length)
33
34/* The NTBS in which the contents of STR are stored. */
35#define dyn_string_buf(STR) \
36 ((STR)->s)
37
38/* Compare DS1 to DS2 with strcmp. */
39#define dyn_string_compare(DS1, DS2) \
40 (strcmp ((DS1)->s, (DS2)->s))
41
42
03d5f569 43extern int dyn_string_init PARAMS ((struct dyn_string *, int));
b8cdcddf
L
44extern dyn_string_t dyn_string_new PARAMS ((int));
45extern void dyn_string_delete PARAMS ((dyn_string_t));
46extern char *dyn_string_release PARAMS ((dyn_string_t));
47extern dyn_string_t dyn_string_resize PARAMS ((dyn_string_t, int));
48extern void dyn_string_clear PARAMS ((dyn_string_t));
03d5f569
JM
49extern int dyn_string_copy PARAMS ((dyn_string_t, dyn_string_t));
50extern int dyn_string_copy_cstr PARAMS ((dyn_string_t, const char *));
51extern int dyn_string_prepend PARAMS ((dyn_string_t, dyn_string_t));
52extern int dyn_string_prepend_cstr PARAMS ((dyn_string_t, const char *));
53extern int dyn_string_insert PARAMS ((dyn_string_t, int,
b8cdcddf 54 dyn_string_t));
03d5f569 55extern int dyn_string_insert_cstr PARAMS ((dyn_string_t, int,
b8cdcddf 56 const char *));
6221ac1b 57extern int dyn_string_insert_char PARAMS ((dyn_string_t, int, int));
03d5f569 58extern int dyn_string_append PARAMS ((dyn_string_t, dyn_string_t));
6221ac1b
CF
59extern int dyn_string_append_cstr PARAMS ((dyn_string_t, const char *));
60extern int dyn_string_append_char PARAMS ((dyn_string_t, int));
03d5f569 61extern int dyn_string_substring PARAMS ((dyn_string_t,
b8cdcddf
L
62 dyn_string_t, int, int));
63extern int dyn_string_eq PARAMS ((dyn_string_t, dyn_string_t));
This page took 0.194687 seconds and 4 git commands to generate.