]>
Commit | Line | Data |
---|---|---|
39423523 DD |
1 | \input texinfo @c -*-texinfo-*- |
2 | @c %**start of header | |
3 | @setfilename libiberty.info | |
4 | @settitle @sc{gnu} libiberty | |
5 | @c %**end of header | |
6 | ||
7 | @syncodeindex fn cp | |
8 | @syncodeindex vr cp | |
fa9f0e33 DD |
9 | @syncodeindex pg cp |
10 | ||
11 | @finalout | |
12 | @c %**end of header | |
13 | ||
14 | @dircategory GNU libraries | |
15 | @direntry | |
16 | * Libiberty: (libiberty). Library of utility functions which | |
17 | are missing or broken on some systems. | |
18 | @end direntry | |
39423523 DD |
19 | |
20 | @macro libib | |
21 | @code{libiberty} | |
22 | @end macro | |
23 | ||
24 | @c The edition date is written in three locations. Search for 'thedate'. | |
25 | @ifinfo | |
26 | This manual describes the GNU @libib library of utility subroutines. | |
27 | This edition accompanies GCC 3, September 2001. | |
28 | ||
29 | Copyright @copyright{} 2001 Free Software Foundation, Inc. | |
30 | ||
31 | Permission is granted to copy, distribute and/or modify this document | |
32 | under the terms of the GNU Free Documentation License, Version 1.1 | |
33 | or any later version published by the Free Software Foundation; | |
34 | with no Invariant Sections, with no Front-Cover Texts, and with no | |
35 | Back-Cover Texts. A copy of the license is included in the | |
36 | section entitled ``GNU Free Documentation License''. | |
37 | ||
38 | @ignore | |
39 | Permission is granted to process this file through TeX and print the | |
40 | results, provided the printed document carries a copying permission | |
41 | notice identical to this one except for the removal of this paragraph | |
42 | (this paragraph not being relevant to the printed manual). | |
43 | ||
44 | @end ignore | |
45 | @end ifinfo | |
46 | ||
47 | ||
48 | @c The edition date is written in three locations. Search for 'thedate'. | |
49 | @titlepage | |
50 | @title @sc{gnu} libiberty | |
51 | @subtitle September 2001 | |
52 | @subtitle for GCC 3 | |
53 | @author Phil Edwards et al. | |
54 | @page | |
55 | ||
56 | ||
57 | @vskip 0pt plus 1filll | |
58 | Copyright @copyright{} 2001 Free Software Foundation, Inc. | |
59 | ||
60 | Permission is granted to copy, distribute and/or modify this document | |
61 | under the terms of the GNU Free Documentation License, Version 1.1 | |
62 | or any later version published by the Free Software Foundation; | |
63 | with no Invariant Sections, with no Front-Cover Texts, and with no | |
64 | Back-Cover Texts. A copy of the license is included in the | |
65 | section entitled ``GNU Free Documentation License''. | |
66 | ||
67 | @end titlepage | |
68 | ||
69 | ||
70 | @ifnottex | |
71 | @node Top,Using,, | |
72 | @top Introduction | |
73 | ||
74 | The @libib{} library is a collection of subroutines used by various | |
75 | GNU programs. It is available under the Library General Public | |
76 | License; for more information, see @ref{Library Copying}. | |
77 | ||
78 | @c The edition date is written in three locations. Search for 'thedate'. | |
79 | This edition accompanies GCC 3, September 2001. | |
80 | ||
81 | @end ifnottex | |
82 | ||
83 | @menu | |
84 | * Using:: How to use libiberty in your code. | |
85 | ||
86 | * Overview:: Overview of available function groups. | |
87 | ||
88 | * Functions:: Available functions, macros, and global variables. | |
89 | ||
90 | * Obstacks:: Object Stacks. | |
91 | ||
92 | * Licenses:: The various licenses under which libiberty sources are | |
93 | distributed. | |
94 | ||
95 | * Index:: Index of functions and categories. | |
96 | @end menu | |
97 | ||
fa9f0e33 | 98 | @node Using |
39423523 DD |
99 | @chapter Using |
100 | @cindex using libiberty | |
101 | @cindex libiberty usage | |
102 | @cindex how to use | |
103 | ||
104 | @c THIS SECTION IS CRAP AND NEEDS REWRITING BADLY. | |
105 | ||
106 | To date, @libib{} is generally not installed on its own. It has evolved | |
107 | over years but does not have its own version number nor release schedule. | |
108 | ||
109 | Possibly the easiest way to use @libib{} in your projects is to drop the | |
110 | @libib{} code into your project's sources, and to build the library along | |
111 | with your own sources; the library would then be linked in at the end. This | |
112 | prevents any possible version mismatches with other copies of libiberty | |
113 | elsewhere on the system. | |
114 | ||
115 | Passing @option{--enable-install-libiberty} to the @command{configure} | |
116 | script when building @libib{} causes the header files and archive library | |
fa9f0e33 | 117 | to be installed when @kbd{make install} is run. This option also takes |
39423523 DD |
118 | an (optional) argument to specify the installation location, in the same |
119 | manner as @option{--prefix}. | |
120 | ||
121 | For your own projects, an approach which offers stability and flexibility | |
122 | is to include @libib{} with your code, but allow the end user to optionally | |
123 | choose to use a previously-installed version instead. In this way the | |
124 | user may choose (for example) to install @libib{} as part of GCC, and use | |
125 | that version for all software built with that compiler. (This approach | |
126 | has proven useful with software using the GNU @code{readline} library.) | |
127 | ||
128 | Making use of @libib{} code usually requires that you include one or more | |
129 | header files from the @libib{} distribution. (They will be named as | |
130 | necessary in the function descriptions.) At link time, you will need to | |
131 | add @option{-liberty} to your link command invocation. | |
132 | ||
133 | ||
fa9f0e33 | 134 | @node Overview |
39423523 DD |
135 | @chapter Overview |
136 | ||
137 | Functions contained in @libib{} can be divided into three general categories. | |
138 | ||
139 | ||
140 | @menu | |
141 | * Supplemental Functions:: Providing functions which don't exist | |
142 | on older operating systems. | |
143 | ||
144 | * Replacement Functions:: These functions are sometimes buggy or | |
145 | unpredictable on some operating systems. | |
146 | ||
147 | * Extensions:: Functions which provide useful extensions | |
148 | or safety wrappers around existing code. | |
149 | @end menu | |
150 | ||
fa9f0e33 | 151 | @node Supplemental Functions |
39423523 DD |
152 | @section Supplemental Functions |
153 | @cindex supplemental functions | |
154 | @cindex functions, supplemental | |
155 | @cindex functions, missing | |
156 | ||
157 | Certain operating systems do not provide functions which have since | |
158 | become standardized, or at least common. For example, the Single | |
159 | Unix Specification Version 2 requires that the @code{basename} | |
160 | function be provided, but an OS which predates that specification | |
161 | might not have this function. This should not prevent well-written | |
162 | code from running on such a system. | |
163 | ||
164 | Similarly, some functions exist only among a particular ``flavor'' | |
165 | or ``family'' of operating systems. As an example, the @code{bzero} | |
166 | function is often not present on systems outside the BSD-derived | |
167 | family of systems. | |
168 | ||
169 | Many such functions are provided in @libib{}. They are quickly | |
170 | listed here with little description, as systems which lack them | |
171 | become less and less common. Each function @var{foo} is implemented | |
fa9f0e33 | 172 | in @file{@var{foo}.c} but not declared in any @libib{} header file; more |
39423523 DD |
173 | comments and caveats for each function's implementation are often |
174 | available in the source file. Generally, the function can simply | |
175 | be declared as @code{extern}. | |
176 | ||
177 | ||
178 | ||
fa9f0e33 | 179 | @node Replacement Functions |
39423523 DD |
180 | @section Replacement Functions |
181 | @cindex replacement functions | |
182 | @cindex functions, replacement | |
183 | ||
184 | Some functions have extremely limited implementations on different | |
185 | platforms. Other functions are tedious to use correctly; for example, | |
186 | proper use of @code{malloc} calls for the return value to be checked and | |
187 | appropriate action taken if memory has been exhausted. A group of | |
188 | ``replacement functions'' is available in @libib{} to address these issues | |
189 | for some of the most commonly used subroutines. | |
190 | ||
191 | All of these functions are declared in the @file{libiberty.h} header | |
192 | file. Many of the implementations will use preprocessor macros set by | |
193 | GNU Autoconf, if you decide to make use of that program. Some of these | |
194 | functions may call one another. | |
195 | ||
196 | ||
197 | @menu | |
198 | * Memory Allocation:: Testing and handling failed memory | |
199 | requests automatically. | |
200 | * Exit Handlers:: Calling routines on program exit. | |
201 | * Error Reporting:: Mapping errno and signal numbers to | |
202 | more useful string formats. | |
203 | @end menu | |
204 | ||
205 | @node Memory Allocation | |
206 | @subsection Memory Allocation | |
207 | @cindex memory allocation | |
208 | ||
fa9f0e33 | 209 | The functions beginning with the letter @samp{x} are wrappers around |
39423523 DD |
210 | standard functions; the functions provided by the system environment |
211 | are called and their results checked before the results are passed back | |
212 | to client code. If the standard functions fail, these wrappers will | |
213 | terminate the program. Thus, these versions can be used with impunity. | |
214 | ||
215 | ||
216 | @node Exit Handlers | |
217 | @subsection Exit Handlers | |
218 | @cindex exit handlers | |
219 | ||
220 | The existence and implementation of the @code{atexit} routine varies | |
221 | amongst the flavors of Unix. @libib{} provides an unvarying dependable | |
222 | implementation via @code{xatexit} and @code{xexit}. | |
223 | ||
224 | ||
225 | @node Error Reporting | |
226 | @subsection Error Reporting | |
227 | @cindex error reporting | |
228 | ||
229 | These are a set of routines to facilitate programming with the system | |
230 | @code{errno} interface. The @libib{} source file @file{strerror.c} | |
231 | contains a good deal of documentation for these functions. | |
232 | ||
233 | @c signal stuff | |
234 | ||
235 | ||
fa9f0e33 | 236 | @node Extensions |
39423523 DD |
237 | @section Extensions |
238 | @cindex extensions | |
239 | @cindex functions, extension | |
240 | ||
241 | @libib{} includes additional functionality above and beyond standard | |
242 | functions, which has proven generically useful in GNU programs, such as | |
243 | obstacks and regex. These functions are often copied from other | |
244 | projects as they gain popularity, and are included here to provide a | |
245 | central location from which to use, maintain, and distribute them. | |
246 | ||
247 | @menu | |
248 | * Obstacks:: Stacks of arbitrary objects. | |
249 | @end menu | |
250 | ||
39423523 DD |
251 | @c This is generated from the glibc manual using a make-obstacks-texi.sh |
252 | @c script of Phil's. Hope it's accurate. | |
253 | @include obstacks.texi | |
254 | ||
fa9f0e33 DD |
255 | @node Functions |
256 | @chapter Function, Variable, and Macro Listing. | |
257 | @include functions.texi | |
39423523 | 258 | |
fa9f0e33 | 259 | @node Licenses |
39423523 DD |
260 | @appendix Licenses |
261 | ||
262 | @menu | |
263 | ||
fa9f0e33 | 264 | * Library Copying:: The GNU Library General Public License |
39423523 DD |
265 | * BSD:: Regents of the University of California |
266 | ||
267 | @end menu | |
268 | ||
269 | @c This takes care of Library Copying. It is the copying-lib.texi from the | |
fa9f0e33 | 270 | @c GNU web site, with its @node line altered to make makeinfo shut up. |
39423523 DD |
271 | @include copying-lib.texi |
272 | ||
273 | @page | |
fa9f0e33 | 274 | @node BSD |
39423523 DD |
275 | @appendixsec BSD |
276 | ||
277 | Copyright @copyright{} 1990 Regents of the University of California. | |
278 | All rights reserved. | |
279 | ||
280 | Redistribution and use in source and binary forms, with or without | |
281 | modification, are permitted provided that the following conditions | |
282 | are met: | |
283 | ||
284 | @enumerate | |
285 | ||
286 | @item | |
287 | Redistributions of source code must retain the above copyright | |
288 | notice, this list of conditions and the following disclaimer. | |
289 | ||
290 | @item | |
291 | Redistributions in binary form must reproduce the above copyright | |
292 | notice, this list of conditions and the following disclaimer in the | |
293 | documentation and/or other materials provided with the distribution. | |
294 | ||
295 | @item | |
296 | [rescinded 22 July 1999] | |
297 | ||
298 | @item | |
299 | Neither the name of the University nor the names of its contributors | |
300 | may be used to endorse or promote products derived from this software | |
301 | without specific prior written permission. | |
302 | ||
303 | @end enumerate | |
304 | ||
305 | THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
306 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
307 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
308 | ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
309 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
310 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
311 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
312 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
313 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
314 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
315 | SUCH DAMAGE. | |
316 | ||
fa9f0e33 | 317 | @node Index |
39423523 DD |
318 | @unnumbered Index |
319 | ||
320 | @printindex cp | |
321 | ||
322 | @contents | |
323 | @bye | |
324 |