Mercurial > hg > CbC > CbC_gcc
annotate include/dyn-string.h @ 55:77e2b8dfacca gcc-4.4.5
update it from 4.4.3 to 4.5.0
author | ryoma <e075725@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 12 Feb 2010 23:39:51 +0900 |
parents | a06113de4d67 |
children | 04ced10e8804 |
rev | line source |
---|---|
0 | 1 /* An abstract string datatype. |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2 Copyright (C) 1998, 1999, 2000, 2002, 2004, 2005, 2009 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3 Free Software Foundation, Inc. |
0 | 4 Contributed by Mark Mitchell (mark@markmitchell.com). |
5 | |
6 This file is part of GCC. | |
7 | |
8 GCC is free software; you can redistribute it and/or modify | |
9 it under the terms of the GNU General Public License as published by | |
10 the Free Software Foundation; either version 2, or (at your option) | |
11 any later version. | |
12 | |
13 GCC is distributed in the hope that it will be useful, | |
14 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 GNU General Public License for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
19 along with GCC; see the file COPYING. If not, write to | |
20 the Free Software Foundation, 51 Franklin Street - Fifth Floor, | |
21 Boston, MA 02110-1301, USA. */ | |
22 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
23 #ifndef DYN_STRING_H |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
24 #define DYN_STRING_H |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
25 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
26 #ifdef __cplusplus |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
27 extern "C" { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
28 #endif |
0 | 29 |
30 typedef struct dyn_string | |
31 { | |
32 int allocated; /* The amount of space allocated for the string. */ | |
33 int length; /* The actual length of the string. */ | |
34 char *s; /* The string itself, NUL-terminated. */ | |
35 }* dyn_string_t; | |
36 | |
37 /* The length STR, in bytes, not including the terminating NUL. */ | |
38 #define dyn_string_length(STR) \ | |
39 ((STR)->length) | |
40 | |
41 /* The NTBS in which the contents of STR are stored. */ | |
42 #define dyn_string_buf(STR) \ | |
43 ((STR)->s) | |
44 | |
45 /* Compare DS1 to DS2 with strcmp. */ | |
46 #define dyn_string_compare(DS1, DS2) \ | |
47 (strcmp ((DS1)->s, (DS2)->s)) | |
48 | |
49 | |
50 extern int dyn_string_init (struct dyn_string *, int); | |
51 extern dyn_string_t dyn_string_new (int); | |
52 extern void dyn_string_delete (dyn_string_t); | |
53 extern char *dyn_string_release (dyn_string_t); | |
54 extern dyn_string_t dyn_string_resize (dyn_string_t, int); | |
55 extern void dyn_string_clear (dyn_string_t); | |
56 extern int dyn_string_copy (dyn_string_t, dyn_string_t); | |
57 extern int dyn_string_copy_cstr (dyn_string_t, const char *); | |
58 extern int dyn_string_prepend (dyn_string_t, dyn_string_t); | |
59 extern int dyn_string_prepend_cstr (dyn_string_t, const char *); | |
60 extern int dyn_string_insert (dyn_string_t, int, dyn_string_t); | |
61 extern int dyn_string_insert_cstr (dyn_string_t, int, const char *); | |
62 extern int dyn_string_insert_char (dyn_string_t, int, int); | |
63 extern int dyn_string_append (dyn_string_t, dyn_string_t); | |
64 extern int dyn_string_append_cstr (dyn_string_t, const char *); | |
65 extern int dyn_string_append_char (dyn_string_t, int); | |
66 extern int dyn_string_substring (dyn_string_t, dyn_string_t, int, int); | |
67 extern int dyn_string_eq (dyn_string_t, dyn_string_t); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
68 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
69 #ifdef __cplusplus |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
70 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
71 #endif |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
72 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
73 #endif /* !defined (DYN_STRING_H) */ |