📄 libiberty.texi
字号:
\input texinfo @c -*-texinfo-*-@c %**start of header@setfilename libiberty.info@settitle @sc{gnu} libiberty@c %**end of header@syncodeindex fn cp@syncodeindex vr cp@syncodeindex pg cp@finalout@c %**end of header @dircategory GNU libraries@direntry* Libiberty: (libiberty). Library of utility functions which are missing or broken on some systems.@end direntry@macro libib@code{libiberty}@end macro@c The edition date is written in three locations. Search for 'thedate'.@ifinfoThis manual describes the GNU @libib library of utility subroutines.This edition accompanies GCC 3, September 2001.Copyright @copyright{} 2001 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled ``GNU Free Documentation License''.@ignorePermission is granted to process this file through TeX and print theresults, provided the printed document carries a copying permissionnotice identical to this one except for the removal of this paragraph(this paragraph not being relevant to the printed manual).@end ignore@end ifinfo@c The edition date is written in three locations. Search for 'thedate'.@titlepage@title @sc{gnu} libiberty@subtitle September 2001@subtitle for GCC 3@author Phil Edwards et al.@page@vskip 0pt plus 1filllCopyright @copyright{} 2001 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled ``GNU Free Documentation License''.@end titlepage@contents@page@ifnottex@node Top,Using,,@top IntroductionThe @libib{} library is a collection of subroutines used by variousGNU programs. It is available under the Library General PublicLicense; for more information, see @ref{Library Copying}.@c The edition date is written in three locations. Search for 'thedate'.This edition accompanies GCC 3, September 2001.@end ifnottex@menu* Using:: How to use libiberty in your code.* Overview:: Overview of available function groups.* Functions:: Available functions, macros, and global variables.* Obstacks:: Object Stacks.* Licenses:: The various licenses under which libiberty sources are distributed.* Index:: Index of functions and categories.@end menu@node Using@chapter Using@cindex using libiberty@cindex libiberty usage@cindex how to use@c THIS SECTION IS CRAP AND NEEDS REWRITING BADLY.To date, @libib{} is generally not installed on its own. It has evolvedover years but does not have its own version number nor release schedule.Possibly the easiest way to use @libib{} in your projects is to drop the@libib{} code into your project's sources, and to build the library alongwith your own sources; the library would then be linked in at the end. Thisprevents any possible version mismatches with other copies of libibertyelsewhere on the system.Passing @option{--enable-install-libiberty} to the @command{configure}script when building @libib{} causes the header files and archive libraryto be installed when @kbd{make install} is run. This option also takesan (optional) argument to specify the installation location, in the samemanner as @option{--prefix}.For your own projects, an approach which offers stability and flexibilityis to include @libib{} with your code, but allow the end user to optionallychoose to use a previously-installed version instead. In this way theuser may choose (for example) to install @libib{} as part of GCC, and usethat version for all software built with that compiler. (This approachhas proven useful with software using the GNU @code{readline} library.)Making use of @libib{} code usually requires that you include one or moreheader files from the @libib{} distribution. (They will be named asnecessary in the function descriptions.) At link time, you will need toadd @option{-liberty} to your link command invocation.@node Overview@chapter OverviewFunctions contained in @libib{} can be divided into three general categories.@menu* Supplemental Functions:: Providing functions which don't exist on older operating systems.* Replacement Functions:: These functions are sometimes buggy or unpredictable on some operating systems.* Extensions:: Functions which provide useful extensions or safety wrappers around existing code.@end menu@node Supplemental Functions@section Supplemental Functions@cindex supplemental functions@cindex functions, supplemental@cindex functions, missingCertain operating systems do not provide functions which have sincebecome standardized, or at least common. For example, the SingleUnix Specification Version 2 requires that the @code{basename}function be provided, but an OS which predates that specificationmight not have this function. This should not prevent well-writtencode from running on such a system.Similarly, some functions exist only among a particular ``flavor''or ``family'' of operating systems. As an example, the @code{bzero}function is often not present on systems outside the BSD-derivedfamily of systems.Many such functions are provided in @libib{}. They are quicklylisted here with little description, as systems which lack thembecome less and less common. Each function @var{foo} is implementedin @file{@var{foo}.c} but not declared in any @libib{} header file; morecomments and caveats for each function's implementation are oftenavailable in the source file. Generally, the function can simplybe declared as @code{extern}.@node Replacement Functions@section Replacement Functions@cindex replacement functions@cindex functions, replacementSome functions have extremely limited implementations on differentplatforms. Other functions are tedious to use correctly; for example,proper use of @code{malloc} calls for the return value to be checked andappropriate action taken if memory has been exhausted. A group of``replacement functions'' is available in @libib{} to address these issuesfor some of the most commonly used subroutines.All of these functions are declared in the @file{libiberty.h} headerfile. Many of the implementations will use preprocessor macros set byGNU Autoconf, if you decide to make use of that program. Some of thesefunctions may call one another.@menu* Memory Allocation:: Testing and handling failed memory requests automatically.* Exit Handlers:: Calling routines on program exit.* Error Reporting:: Mapping errno and signal numbers to more useful string formats.@end menu@node Memory Allocation@subsection Memory Allocation@cindex memory allocationThe functions beginning with the letter @samp{x} are wrappers aroundstandard functions; the functions provided by the system environmentare called and their results checked before the results are passed backto client code. If the standard functions fail, these wrappers willterminate the program. Thus, these versions can be used with impunity.@node Exit Handlers@subsection Exit Handlers@cindex exit handlersThe existence and implementation of the @code{atexit} routine variesamongst the flavors of Unix. @libib{} provides an unvarying dependableimplementation via @code{xatexit} and @code{xexit}.@node Error Reporting@subsection Error Reporting@cindex error reportingThese are a set of routines to facilitate programming with the system@code{errno} interface. The @libib{} source file @file{strerror.c}contains a good deal of documentation for these functions.@c signal stuff@node Extensions@section Extensions@cindex extensions@cindex functions, extension@libib{} includes additional functionality above and beyond standardfunctions, which has proven generically useful in GNU programs, such asobstacks and regex. These functions are often copied from otherprojects as they gain popularity, and are included here to provide acentral location from which to use, maintain, and distribute them.@menu* Obstacks:: Stacks of arbitrary objects.@end menu@c This is generated from the glibc manual using a make-obstacks-texi.sh@c script of Phil's. Hope it's accurate.@include obstacks.texi@node Functions@chapter Function, Variable, and Macro Listing.@include functions.texi@node Licenses@appendix Licenses@menu* Library Copying:: The GNU Library General Public License* BSD:: Regents of the University of California@end menu@c This takes care of Library Copying. It is the copying-lib.texi from the@c GNU web site, with its @node line altered to make makeinfo shut up.@include copying-lib.texi@page@node BSD@appendixsec BSDCopyright @copyright{} 1990 Regents of the University of California.All rights reserved.Redistribution and use in source and binary forms, with or withoutmodification, are permitted provided that the following conditionsare met:@enumerate@itemRedistributions of source code must retain the above copyrightnotice, this list of conditions and the following disclaimer.@itemRedistributions in binary form must reproduce the above copyrightnotice, this list of conditions and the following disclaimer in thedocumentation and/or other materials provided with the distribution.@item[rescinded 22 July 1999]@itemNeither the name of the University nor the names of its contributorsmay be used to endorse or promote products derived from this softwarewithout specific prior written permission.@end enumerateTHIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' ANDANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THEIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSEARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLEFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIALDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODSOR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICTLIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAYOUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OFSUCH DAMAGE.@node Index@unnumbered Index@printindex cp@bye
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -