source: Daodan/MSYS2/mingw32/include/libiberty/dyn-string.h@ 1175

Last change on this file since 1175 was 1166, checked in by rossy, 3 years ago

Daodan: Replace MinGW build env with an up-to-date MSYS2 env

File size: 2.6 KB
RevLine 
[1166]1/* An abstract string datatype.
2 Copyright (C) 1998-2021 Free Software Foundation, Inc.
3 Contributed by Mark Mitchell (mark@markmitchell.com).
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify
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
12GCC is distributed in the hope that it will be useful,
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
18along with GCC; see the file COPYING. If not, write to
19the Free Software Foundation, 51 Franklin Street - Fifth Floor,
20Boston, MA 02110-1301, USA. */
21
22#ifndef DYN_STRING_H
23#define DYN_STRING_H
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29typedef struct dyn_string
30{
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. */
34}* dyn_string_t;
35
36/* The length STR, in bytes, not including the terminating NUL. */
37#define dyn_string_length(STR) \
38 ((STR)->length)
39
40/* The NTBS in which the contents of STR are stored. */
41#define dyn_string_buf(STR) \
42 ((STR)->s)
43
44/* Compare DS1 to DS2 with strcmp. */
45#define dyn_string_compare(DS1, DS2) \
46 (strcmp ((DS1)->s, (DS2)->s))
47
48
49extern int dyn_string_init (struct dyn_string *, int);
50extern dyn_string_t dyn_string_new (int);
51extern void dyn_string_delete (dyn_string_t);
52extern char *dyn_string_release (dyn_string_t);
53extern dyn_string_t dyn_string_resize (dyn_string_t, int);
54extern void dyn_string_clear (dyn_string_t);
55extern int dyn_string_copy (dyn_string_t, dyn_string_t);
56extern int dyn_string_copy_cstr (dyn_string_t, const char *);
57extern int dyn_string_prepend (dyn_string_t, dyn_string_t);
58extern int dyn_string_prepend_cstr (dyn_string_t, const char *);
59extern int dyn_string_insert (dyn_string_t, int, dyn_string_t);
60extern int dyn_string_insert_cstr (dyn_string_t, int, const char *);
61extern int dyn_string_insert_char (dyn_string_t, int, int);
62extern int dyn_string_append (dyn_string_t, dyn_string_t);
63extern int dyn_string_append_cstr (dyn_string_t, const char *);
64extern int dyn_string_append_char (dyn_string_t, int);
65extern int dyn_string_substring (dyn_string_t, dyn_string_t, int, int);
66extern int dyn_string_eq (dyn_string_t, dyn_string_t);
67
68#ifdef __cplusplus
69}
70#endif
71
72#endif /* !defined (DYN_STRING_H) */
Note: See TracBrowser for help on using the repository browser.