OSDN Git Service

* sparc/sparc.c (dwarf2out_cfi_label): Extern no longer needed.
[pf3gnuchains/gcc-fork.git] / include / libiberty.h
1 /* Function declarations for libiberty.
2    Written by Cygnus Support, 1994.
3
4    The libiberty library provides a number of functions which are
5    missing on some operating systems.  We do not declare those here,
6    to avoid conflicts with the system header files on operating
7    systems that do support those functions.  In this file we only
8    declare those functions which are specific to libiberty.  */
9
10 #ifndef LIBIBERTY_H
11 #define LIBIBERTY_H
12
13 #include "ansidecl.h"
14
15 /* Build an argument vector from a string.  Allocates memory using
16    malloc.  Use freeargv to free the vector.  */
17
18 extern char **buildargv PARAMS ((char *));
19
20 /* Free a vector returned by buildargv.  */
21
22 extern void freeargv PARAMS ((char **));
23
24 /* Return the last component of a path name.  Note that we can't use a
25    prototype here because the parameter is declared inconsistently
26    across different systems, sometimes as "char *" and sometimes as
27    "const char *" */
28
29 #if defined(__GNU_LIBRARY__ ) || defined (__linux__)
30 extern char *basename PARAMS ((const char *));
31 #else
32 extern char *basename ();
33 #endif
34
35 /* Concatenate an arbitrary number of strings, up to (char *) NULL.
36    Allocates memory using xmalloc.  */
37
38 extern char *concat PARAMS ((const char *, ...));
39
40 /* Check whether two file descriptors refer to the same file.  */
41
42 extern int fdmatch PARAMS ((int fd1, int fd2));
43
44 /* Get the amount of time the process has run, in microseconds.  */
45
46 extern long get_run_time PARAMS ((void));
47
48 /* Choose a temporary directory to use for scratch files.  */
49
50 extern char *choose_temp_base PARAMS ((void));
51
52 /* Allocate memory filled with spaces.  Allocates using malloc.  */
53
54 extern const char *spaces PARAMS ((int count));
55
56 /* Return the maximum error number for which strerror will return a
57    string.  */
58
59 extern int errno_max PARAMS ((void));
60
61 /* Return the name of an errno value (e.g., strerrno (EINVAL) returns
62    "EINVAL").  */
63
64 extern const char *strerrno PARAMS ((int));
65
66 /* Given the name of an errno value, return the value.  */
67
68 extern int strtoerrno PARAMS ((const char *));
69
70 /* ANSI's strerror(), but more robust.  */
71
72 extern char *xstrerror PARAMS ((int));
73
74 /* Return the maximum signal number for which strsignal will return a
75    string.  */
76
77 extern int signo_max PARAMS ((void));
78
79 /* Return a signal message string for a signal number
80    (e.g., strsignal (SIGHUP) returns something like "Hangup").  */
81 /* This is commented out as it can conflict with one in system headers.
82    We still document its existence though.  */
83
84 /*extern const char *strsignal PARAMS ((int));*/
85
86 /* Return the name of a signal number (e.g., strsigno (SIGHUP) returns
87    "SIGHUP").  */
88
89 extern const char *strsigno PARAMS ((int));
90
91 /* Given the name of a signal, return its number.  */
92
93 extern int strtosigno PARAMS ((const char *));
94
95 /* Register a function to be run by xexit.  Returns 0 on success.  */
96
97 extern int xatexit PARAMS ((void (*fn) (void)));
98
99 /* Exit, calling all the functions registered with xatexit.  */
100
101 #ifndef __GNUC__
102 extern void xexit PARAMS ((int status));
103 #else
104 typedef void libiberty_voidfn PARAMS ((int status));
105 __volatile__ libiberty_voidfn xexit;
106 #endif
107
108 /* Set the program name used by xmalloc.  */
109
110 extern void xmalloc_set_program_name PARAMS ((const char *));
111
112 /* Allocate memory without fail.  If malloc fails, this will print a
113    message to stderr (using the name set by xmalloc_set_program_name,
114    if any) and then call xexit.  */
115
116 #ifdef ANSI_PROTOTYPES
117 /* Get a definition for size_t.  */
118 #include <stddef.h>
119 #endif
120 extern PTR xmalloc PARAMS ((size_t));
121
122 /* Reallocate memory without fail.  This works like xmalloc.
123
124    FIXME: We do not declare the parameter types for the same reason as
125    xmalloc.  */
126
127 extern PTR xrealloc PARAMS ((PTR, size_t));
128
129 /* Copy a string into a memory buffer without fail.  */
130
131 extern char *xstrdup PARAMS ((const char *));
132
133 /* hex character manipulation routines */
134
135 #define _hex_array_size 256
136 #define _hex_bad        99
137 extern char _hex_value[_hex_array_size];
138 extern void hex_init PARAMS ((void));
139 #define hex_p(c)        (hex_value (c) != _hex_bad)
140 /* If you change this, note well: Some code relies on side effects in
141    the argument being performed exactly once.  */
142 #define hex_value(c)    (_hex_value[(unsigned char) (c)])
143
144 /* Definitions used by the pexecute routine.  */
145
146 #define PEXECUTE_FIRST   1
147 #define PEXECUTE_LAST    2
148 #define PEXECUTE_ONE     (PEXECUTE_FIRST + PEXECUTE_LAST)
149 #define PEXECUTE_SEARCH  4
150 #define PEXECUTE_VERBOSE 8
151
152 /* Execute a program.  */
153
154 extern int pexecute PARAMS ((const char *, char * const *, const char *,
155                             const char *, char **, char **, int));
156
157 /* Wait for pexecute to finish.  */
158
159 extern int pwait PARAMS ((int, int *, int));
160
161 #endif /* ! defined (LIBIBERTY_H) */