This commit was generated by cvs2svn to track changes on a CVS vendor
[deliverable/binutils-gdb.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 extern char *basename ();
30
31 /* Concatenate an arbitrary number of strings, up to (char *) NULL.
32 Allocates memory using xmalloc. */
33
34 extern char *concat PARAMS ((const char *, ...));
35
36 /* Check whether two file descriptors refer to the same file. */
37
38 extern int fdmatch PARAMS ((int fd1, int fd2));
39
40 /* Get the amount of time the process has run, in microseconds. */
41
42 extern long get_run_time PARAMS ((void));
43
44 /* Choose a temporary directory to use for scratch files. */
45
46 extern char *choose_temp_base PARAMS ((void));
47
48 /* Allocate memory filled with spaces. Allocates using malloc. */
49
50 extern const char *spaces PARAMS ((int count));
51
52 /* Return the maximum error number for which strerror will return a
53 string. */
54
55 extern int errno_max PARAMS ((void));
56
57 /* Return the name of an errno value (e.g., strerrno (EINVAL) returns
58 "EINVAL"). */
59
60 extern const char *strerrno PARAMS ((int));
61
62 /* Given the name of an errno value, return the value. */
63
64 extern int strtoerrno PARAMS ((const char *));
65
66 /* ANSI's strerror(), but more robust. */
67
68 extern char *xstrerror PARAMS ((int));
69
70 /* Return the maximum signal number for which strsignal will return a
71 string. */
72
73 extern int signo_max PARAMS ((void));
74
75 /* Return a signal message string for a signal number
76 (e.g., strsignal (SIGHUP) returns something like "Hangup"). */
77 /* This is commented out as it can conflict with one in system headers.
78 We still document its existence though. */
79
80 /*extern const char *strsignal PARAMS ((int));*/
81
82 /* Return the name of a signal number (e.g., strsigno (SIGHUP) returns
83 "SIGHUP"). */
84
85 extern const char *strsigno PARAMS ((int));
86
87 /* Given the name of a signal, return its number. */
88
89 extern int strtosigno PARAMS ((const char *));
90
91 /* Register a function to be run by xexit. Returns 0 on success. */
92
93 extern int xatexit PARAMS ((void (*fn) (void)));
94
95 /* Exit, calling all the functions registered with xatexit. */
96
97 #ifndef __GNUC__
98 extern void xexit PARAMS ((int status));
99 #else
100 typedef void libiberty_voidfn PARAMS ((int status));
101 __volatile__ libiberty_voidfn xexit;
102 #endif
103
104 /* Set the program name used by xmalloc. */
105
106 extern void xmalloc_set_program_name PARAMS ((const char *));
107
108 /* Allocate memory without fail. If malloc fails, this will print a
109 message to stderr (using the name set by xmalloc_set_program_name,
110 if any) and then call xexit.
111
112 FIXME: We do not declare the parameter type (size_t) in order to
113 avoid conflicts with other declarations of xmalloc that exist in
114 programs which use libiberty. */
115
116 extern PTR xmalloc ();
117
118 /* Reallocate memory without fail. This works like xmalloc.
119
120 FIXME: We do not declare the parameter types for the same reason as
121 xmalloc. */
122
123 extern PTR xrealloc ();
124
125 /* Copy a string into a memory buffer without fail. */
126
127 extern char *xstrdup PARAMS ((const char *));
128
129 /* hex character manipulation routines */
130
131 #define _hex_array_size 256
132 #define _hex_bad 99
133 extern char _hex_value[_hex_array_size];
134 extern void hex_init PARAMS ((void));
135 #define hex_p(c) (hex_value (c) != _hex_bad)
136 /* If you change this, note well: Some code relies on side effects in
137 the argument being performed exactly once. */
138 #define hex_value(c) (_hex_value[(unsigned char) (c)])
139
140 #endif /* ! defined (LIBIBERTY_H) */
This page took 0.032586 seconds and 5 git commands to generate.