OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [binutils-2.18.50/] [include/] [dyn-string.h] - Blame information for rev 862

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 38 julius
/* An abstract string datatype.
2
   Copyright (C) 1998, 1999, 2000, 2002, 2004 Free Software Foundation, Inc.
3
   Contributed by Mark Mitchell (mark@markmitchell.com).
4
 
5
This file is part of GCC.
6
 
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)
10
any later version.
11
 
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.
16
 
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.  */
21
 
22
 
23
typedef 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
 
43
extern int dyn_string_init (struct dyn_string *, int);
44
extern dyn_string_t dyn_string_new (int);
45
extern void dyn_string_delete (dyn_string_t);
46
extern char *dyn_string_release (dyn_string_t);
47
extern dyn_string_t dyn_string_resize (dyn_string_t, int);
48
extern void dyn_string_clear (dyn_string_t);
49
extern int dyn_string_copy (dyn_string_t, dyn_string_t);
50
extern int dyn_string_copy_cstr (dyn_string_t, const char *);
51
extern int dyn_string_prepend (dyn_string_t, dyn_string_t);
52
extern int dyn_string_prepend_cstr (dyn_string_t, const char *);
53
extern int dyn_string_insert (dyn_string_t, int, dyn_string_t);
54
extern int dyn_string_insert_cstr (dyn_string_t, int, const char *);
55
extern int dyn_string_insert_char (dyn_string_t, int, int);
56
extern int dyn_string_append (dyn_string_t, dyn_string_t);
57
extern int dyn_string_append_cstr (dyn_string_t, const char *);
58
extern int dyn_string_append_char (dyn_string_t, int);
59
extern int dyn_string_substring (dyn_string_t,  dyn_string_t, int, int);
60
extern int dyn_string_eq (dyn_string_t, dyn_string_t);

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.