* sim-load.c (sim_load_file): Print LMA/VMA according to value
[deliverable/binutils-gdb.git] / include / libiberty.h
CommitLineData
e51437f1
ILT
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
18extern char **buildargv PARAMS ((char *));
19
20/* Free a vector returned by buildargv. */
21
22extern void freeargv PARAMS ((char **));
23
77f7bfd8
FF
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 *" */
e51437f1 28
77f7bfd8 29extern char *basename ();
e51437f1
ILT
30
31/* Concatenate an arbitrary number of strings, up to (char *) NULL.
32 Allocates memory using xmalloc. */
33
34extern char *concat PARAMS ((const char *, ...));
35
36/* Check whether two file descriptors refer to the same file. */
37
38extern int fdmatch PARAMS ((int fd1, int fd2));
39
40/* Get the amount of time the process has run, in microseconds. */
41
42extern long get_run_time PARAMS ((void));
43
77f7bfd8
FF
44/* Choose a temporary directory to use for scratch files. */
45
46extern char *choose_temp_base PARAMS ((void));
47
e51437f1
ILT
48/* Allocate memory filled with spaces. Allocates using malloc. */
49
50extern const char *spaces PARAMS ((int count));
51
52/* Return the maximum error number for which strerror will return a
53 string. */
54
55extern int errno_max PARAMS ((void));
56
57/* Return the name of an errno value (e.g., strerrno (EINVAL) returns
58 "EINVAL"). */
59
60extern const char *strerrno PARAMS ((int));
61
62/* Given the name of an errno value, return the value. */
63
64extern int strtoerrno PARAMS ((const char *));
65
77f7bfd8
FF
66/* ANSI's strerror(), but more robust. */
67
68extern char *xstrerror PARAMS ((int));
69
e51437f1
ILT
70/* Return the maximum signal number for which strsignal will return a
71 string. */
72
73extern int signo_max PARAMS ((void));
74
ba1c97e7
KR
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. */
e51437f1 79
ba1c97e7 80/*extern const char *strsignal PARAMS ((int));*/
e51437f1
ILT
81
82/* Return the name of a signal number (e.g., strsigno (SIGHUP) returns
83 "SIGHUP"). */
84
85extern const char *strsigno PARAMS ((int));
86
87/* Given the name of a signal, return its number. */
88
89extern int strtosigno PARAMS ((const char *));
90
91/* Register a function to be run by xexit. Returns 0 on success. */
92
93extern int xatexit PARAMS ((void (*fn) (void)));
94
95/* Exit, calling all the functions registered with xatexit. */
96
97#ifndef __GNUC__
98extern void xexit PARAMS ((int status));
99#else
100typedef void libiberty_voidfn PARAMS ((int status));
ba1c97e7 101__volatile__ libiberty_voidfn xexit;
e51437f1
ILT
102#endif
103
104/* Set the program name used by xmalloc. */
105
106extern 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
116extern 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
123extern PTR xrealloc ();
124
77f7bfd8
FF
125/* Copy a string into a memory buffer without fail. */
126
127extern char *xstrdup PARAMS ((const char *));
128
ba1c97e7
KR
129/* hex character manipulation routines */
130
131#define _hex_array_size 256
132#define _hex_bad 99
133extern char _hex_value[_hex_array_size];
134extern void hex_init PARAMS ((void));
df8d5082 135#define hex_p(c) (hex_value (c) != _hex_bad)
ba1c97e7
KR
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
e51437f1 140#endif /* ! defined (LIBIBERTY_H) */
This page took 0.131441 seconds and 4 git commands to generate.