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

Subversion Repositories open8_urisc

[/] [open8_urisc/] [trunk/] [gnu/] [binutils/] [include/] [dyn-string.h] - Blame information for rev 39

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

Line No. Rev Author Line
1 17 khays
/* An abstract string datatype.
2
   Copyright (C) 1998, 1999, 2000, 2002, 2004, 2005, 2009
3
   Free Software Foundation, Inc.
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
 
23
#ifndef DYN_STRING_H
24
#define DYN_STRING_H
25
 
26
#ifdef __cplusplus
27
extern "C" {
28
#endif
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);
68
 
69
#ifdef __cplusplus
70
}
71
#endif
72
 
73
#endif /* !defined (DYN_STRING_H) */

powered by: WebSVN 2.1.0

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