* arm.md (*adddf_esfdf_df): Renamed from *adddf_df_esfdf.
[official-gcc.git] / texinfo / info / general.h
blob4b97dc8d8daaed0533aa119e8f250bf5cd39529a
1 /* general.h -- Some generally useful defines. */
3 /* This file is part of GNU Info, a program for reading online documentation
4 stored in Info format.
6 Copyright (C) 1993 Free Software Foundation, Inc.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 Written by Brian Fox (bfox@ai.mit.edu). */
24 #if !defined (_GENERAL_H_)
25 #define _GENERAL_H_
27 extern void *xmalloc (), *xrealloc ();
29 #if defined (HAVE_UNISTD_H)
30 # include <unistd.h>
31 #endif /* HAVE_UNISTD_H */
33 #if defined (HAVE_STRING_H)
34 # include <string.h>
35 #else
36 # include <strings.h>
37 #endif /* !HAVE_STRING_H */
39 #include "clib.h"
41 #define info_toupper(x) (islower (x) ? toupper (x) : x)
42 #define info_tolower(x) (isupper (x) ? tolower (x) : x)
44 #if !defined (whitespace)
45 # define whitespace(c) ((c == ' ') || (c == '\t'))
46 #endif /* !whitespace */
48 #if !defined (whitespace_or_newline)
49 # define whitespace_or_newline(c) (whitespace (c) || (c == '\n'))
50 #endif /* !whitespace_or_newline */
52 #if !defined (__FUNCTION_DEF)
53 # define __FUNCTION_DEF
54 typedef int Function ();
55 typedef void VFunction ();
56 typedef char *CFunction ();
57 #endif /* _FUNCTION_DEF */
59 /* Add POINTER to the list of pointers found in ARRAY. SLOTS is the number
60 of slots that have already been allocated. INDEX is the index into the
61 array where POINTER should be added. GROW is the number of slots to grow
62 ARRAY by, in the case that it needs growing. TYPE is a cast of the type
63 of object stored in ARRAY (e.g., NODE_ENTRY *. */
64 #define add_pointer_to_array(pointer, idx, array, slots, grow, type) \
65 do { \
66 if (idx + 2 >= slots) \
67 array = (type *)(xrealloc (array, (slots += grow) * sizeof (type))); \
68 array[idx++] = (type)pointer; \
69 array[idx] = (type)NULL; \
70 } while (0)
72 #define maybe_free(x) do { if (x) free (x); } while (0)
74 #if !defined (zero_mem) && defined (HAVE_MEMSET)
75 # define zero_mem(mem, length) memset (mem, 0, length)
76 #endif /* !zero_mem && HAVE_MEMSET */
78 #if !defined (zero_mem) && defined (HAVE_BZERO)
79 # define zero_mem(mem, length) bzero (mem, length)
80 #endif /* !zero_mem && HAVE_BZERO */
82 #if !defined (zero_mem)
83 # define zero_mem(mem, length) \
84 do { \
85 register int zi; \
86 register unsigned char *place; \
88 place = (unsigned char *)mem; \
89 for (zi = 0; zi < length; zi++) \
90 place[zi] = 0; \
91 } while (0)
92 #endif /* !zero_mem */
94 #endif /* !_GENERAL_H_ */