initialize_objfile_symbol: Renamed from initialize_symbol.
[deliverable/binutils-gdb.git] / gas / sb.h
CommitLineData
252b5132 1/* sb.h - header file for string buffer manipulation routines
4b95cf5c 2 Copyright (C) 1994-2014 Free Software Foundation, Inc.
252b5132
RH
3
4 Written by Steve and Judy Chamberlain of Cygnus Support,
5 sac@cygnus.com
6
7 This file is part of GAS, the GNU Assembler.
8
9 GAS is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
ec2655a6 11 the Free Software Foundation; either version 3, or (at your option)
252b5132
RH
12 any later version.
13
14 GAS is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with GAS; see the file COPYING. If not, write to the Free
4b4da160
NC
21 Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
22 02110-1301, USA. */
252b5132
RH
23
24#ifndef SB_H
25
26#define SB_H
27
93a9f991 28/* String blocks
252b5132
RH
29
30 I had a couple of choices when deciding upon this data structure.
31 gas uses null terminated strings for all its internal work. This
32 often means that parts of the program that want to examine
33 substrings have to manipulate the data in the string to do the
34 right thing (a common operation is to single out a bit of text by
35 saving away the character after it, nulling it out, operating on
36 the substring and then replacing the character which was under the
37 null). This is a pain and I remember a load of problems that I had with
38 code in gas which almost got this right. Also, it's harder to grow and
39 allocate null terminated strings efficiently.
40
41 Obstacks provide all the functionality needed, but are too
42 complicated, hence the sb.
43
39a45edc 44 An sb is allocated by the caller. */
252b5132 45
252b5132 46typedef struct sb
93a9f991
NC
47{
48 char *ptr; /* Points to the current block. */
39a45edc
AM
49 size_t len; /* How much is used. */
50 size_t max; /* The maximum length. */
93a9f991 51}
252b5132
RH
52sb;
53
24361518 54extern void sb_new (sb *);
d2ae702c 55extern void sb_build (sb *, size_t);
24361518
KH
56extern void sb_kill (sb *);
57extern void sb_add_sb (sb *, sb *);
c19d1205 58extern void sb_scrub_and_add_sb (sb *, sb *);
24361518 59extern void sb_reset (sb *);
39a45edc 60extern void sb_add_char (sb *, size_t);
24361518 61extern void sb_add_string (sb *, const char *);
39a45edc 62extern void sb_add_buffer (sb *, const char *, size_t);
24361518 63extern char *sb_terminate (sb *);
39a45edc
AM
64extern size_t sb_skip_white (size_t, sb *);
65extern size_t sb_skip_comma (size_t, sb *);
252b5132
RH
66
67/* Actually in input-scrub.c. */
24361518 68extern void input_scrub_include_sb (sb *, char *, int);
252b5132
RH
69
70#endif /* SB_H */
This page took 0.625326 seconds and 4 git commands to generate.