summaryrefslogtreecommitdiff
path: root/libiberty
diff options
context:
space:
mode:
authornobody <>2003-06-22 18:32:50 +0000
committernobody <>2003-06-22 18:32:50 +0000
commit80ac87715c56a77eb51c3454434daf1f16a7bd49 (patch)
tree5ba5aedb242fd6b1e9d09fa7e7a20adba3a00c08 /libiberty
parent11308f70b39a78aae01eb7b0fbe5e23e9a8313ee (diff)
downloadbinutils-gdb-80ac87715c56a77eb51c3454434daf1f16a7bd49.tar.gz
This commit was manufactured by cvs2svn to create branch 'gdb_6_0-branch'.gdb_6_0-2003-06-23-branchpoint
Sprout from jimb-ppc64-linux-20030613-branch 2003-06-13 21:56:28 UTC nobody 'This commit was manufactured by cvs2svn to create branch 'jimb-' Cherrypick from master 2003-06-22 18:32:49 UTC Daniel Jacobowitz <drow@false.org> ' * symfile.c (add_symbol_file_command): Use parse_and_eval_address.': ChangeLog Makefile.in Makefile.tpl bfd/ChangeLog bfd/bfd-in2.h bfd/config.bfd bfd/elf32-cris.c bfd/elf64-ppc.c bfd/elf64-ppc.h bfd/elf64-sparc.c bfd/elflink.h bfd/elfxx-ia64.c bfd/section.c bfd/version.h config.guess config.sub configure configure.in gdb/ChangeLog gdb/Makefile.in gdb/NEWS gdb/README gdb/ada-lang.c gdb/ada-lex.l gdb/ada-tasks.c gdb/alpha-tdep.c gdb/arch-utils.c gdb/arch-utils.h gdb/avr-tdep.c gdb/breakpoint.c gdb/c-valprint.c gdb/cli/cli-cmds.c gdb/config/alpha/alpha-linux.mh gdb/config/arm/linux.mh gdb/config/arm/linux.mt gdb/config/arm/nm-linux.h gdb/config/arm/tm-linux.h gdb/config/djgpp/fnchange.lst gdb/config/i386/linux.mh gdb/config/i386/linux.mt gdb/config/i386/nm-x86-64linux.h gdb/config/i386/tm-i386.h gdb/config/i386/x86-64linux.mh gdb/config/ia64/linux.mh gdb/config/ia64/linux.mt gdb/config/ia64/nm-linux.h gdb/config/ia64/tm-ia64.h gdb/config/m68k/linux.mh gdb/config/mips/embed.mt gdb/config/mips/embed64.mt gdb/config/mips/embedl.mt gdb/config/mips/embedl64.mt gdb/config/mips/linux.mh gdb/config/mips/linux.mt gdb/config/mips/tm-irix5.h gdb/config/mips/tm-irix6.h gdb/config/mips/tm-mips.h gdb/config/mips/tm-mips64.h gdb/config/nm-linux.h gdb/config/pa/nm-hppah.h gdb/config/powerpc/linux.mh gdb/config/s390/s390.mh gdb/config/s390/tm-linux.h gdb/config/s390/tm-s390.h gdb/config/sh/linux.mt gdb/config/sparc/linux.mh gdb/cp-valprint.c gdb/cris-tdep.c gdb/doc/ChangeLog gdb/doc/Makefile.in gdb/doc/agentexpr.texi gdb/doc/gdb.texinfo gdb/doc/gdbint.texinfo gdb/dummy-frame.c gdb/findvar.c gdb/frame.c gdb/frame.h gdb/gdbarch.c gdb/gdbarch.h gdb/gdbarch.sh gdb/gdbserver/ChangeLog gdb/gdbserver/Makefile.in gdb/gdbserver/linux-low.c gdb/gdbserver/server.c gdb/gdbserver/target.h gdb/gnu-nat.c gdb/h8300-tdep.c gdb/hppa-tdep.c gdb/hppah-nat.c gdb/i386-nto-tdep.c gdb/i386-tdep.c gdb/i387-tdep.c gdb/i387-tdep.h gdb/ia64-tdep.c gdb/infcall.c gdb/infcmd.c gdb/infrun.c gdb/infttrace.c gdb/lin-lwp.c gdb/linux-nat.c gdb/linux-nat.h gdb/linux-proc.c gdb/mcore-tdep.c gdb/mi/ChangeLog gdb/mi/mi-cmds.c gdb/mips-tdep.c gdb/mn10300-tdep.c gdb/nto-tdep.c gdb/osabi.c gdb/ppc-linux-tdep.c gdb/rdi-share/host.h gdb/regcache.c gdb/remote-fileio.h gdb/remote-rdi.c gdb/remote.c gdb/rs6000-tdep.c gdb/s390-nat.c gdb/s390-tdep.c gdb/solib.c gdb/sparc-nat.c gdb/symfile.c gdb/target.c gdb/target.h gdb/testsuite/ChangeLog gdb/testsuite/gdb.base/attach.exp gdb/testsuite/gdb.base/fileio.c gdb/testsuite/gdb.base/fileio.exp gdb/testsuite/gdb.base/relocate.exp gdb/testsuite/gdb.base/store.c gdb/testsuite/gdb.base/store.exp gdb/testsuite/gdb.c++/pr-1210.cc gdb/testsuite/gdb.c++/pr-1210.exp gdb/testsuite/lib/mi-support.exp gdb/trad-frame.h gdb/tui/ChangeLog gdb/tui/tui-hooks.c gdb/tui/tui.c gdb/tui/tuiCommand.c gdb/tui/tuiData.c gdb/tui/tuiDataWin.c gdb/tui/tuiDisassem.c gdb/tui/tuiGeneralWin.c gdb/tui/tuiIO.c gdb/tui/tuiLayout.c gdb/tui/tuiRegs.c gdb/tui/tuiSource.c gdb/tui/tuiSourceWin.c gdb/tui/tuiStack.c gdb/tui/tuiWin.c gdb/valops.c gdb/varobj.c gdb/version.in gdb/x86-64-tdep.c gdb/xstormy16-tdep.c include/ChangeLog include/ansidecl.h include/opcode/ChangeLog include/safe-ctype.h libiberty/ChangeLog libiberty/Makefile.in libiberty/config.in libiberty/configure libiberty/configure.in libiberty/functions.texi libiberty/hashtab.c libiberty/hex.c libiberty/safe-ctype.c opcodes/ChangeLog opcodes/z8k-dis.c opcodes/z8k-opc.h opcodes/z8kgen.c readline/ChangeLog.gdb readline/support/config.guess readline/support/config.sub sim/common/ChangeLog sim/common/cgen-trace.c sim/common/cgen-trace.h sim/common/sim-fpu.c sim/common/sim-fpu.h sim/d10v/ChangeLog sim/d10v/interp.c sim/h8300/ChangeLog sim/h8300/compile.c sim/h8300/sim-main.h sim/mips/ChangeLog sim/mips/mips.igen sim/ppc/ChangeLog sim/ppc/Makefile.in sim/ppc/altivec.igen sim/ppc/altivec_expression.h sim/ppc/altivec_registers.h sim/ppc/configure sim/ppc/configure.in sim/ppc/e500.igen sim/ppc/e500_expression.h sim/ppc/e500_registers.h sim/ppc/emul_chirp.c sim/ppc/gen-idecode.c sim/ppc/gen-itable.c sim/ppc/gen-model.c sim/ppc/gen-support.c sim/ppc/hw_com.c sim/ppc/hw_htab.c sim/ppc/hw_init.c sim/ppc/hw_nvram.c sim/ppc/hw_register.c sim/ppc/idecode_expression.h sim/ppc/igen.c sim/ppc/interrupts.c sim/ppc/ld-cache.c sim/ppc/ld-cache.h sim/ppc/ld-insn.c sim/ppc/ld-insn.h sim/ppc/ppc-instructions sim/ppc/ppc-spr-table sim/ppc/psim.c sim/ppc/psim.h sim/ppc/registers.c sim/ppc/registers.h sim/ppc/sim_calls.c sim/testsuite/sim/h8300/ChangeLog sim/testsuite/sim/h8300/addx.s sim/testsuite/sim/h8300/allinsn.exp sim/testsuite/sim/h8300/andb.s sim/testsuite/sim/h8300/band.s sim/testsuite/sim/h8300/biand.s sim/testsuite/sim/h8300/brabc.s sim/testsuite/sim/h8300/bset.s sim/testsuite/sim/h8300/div.s sim/testsuite/sim/h8300/jmp.s sim/testsuite/sim/h8300/ldm.s sim/testsuite/sim/h8300/mac.s sim/testsuite/sim/h8300/mul.s sim/testsuite/sim/h8300/orb.s sim/testsuite/sim/h8300/stack.s sim/testsuite/sim/h8300/subs.s sim/testsuite/sim/h8300/subx.s sim/testsuite/sim/h8300/tas.s sim/testsuite/sim/h8300/testutils.inc sim/testsuite/sim/h8300/xorb.s Delete: gdb/config/mips/bigmips.mt gdb/config/mips/bigmips64.mt gdb/config/mips/decstation.mt gdb/config/mips/littlemips.mt gdb/config/mips/tm-bigmips.h gdb/config/mips/tm-bigmips64.h gdb/config/mips/tm-embed64.h gdb/config/mips/tm-embedl.h gdb/config/mips/tm-embedl64.h gdb/config/mips/tm-tx39l.h gdb/config/mips/tm-vr4100.h gdb/config/mips/tm-vr4300.h gdb/config/mips/tm-vr4300el.h gdb/config/mips/tm-vr4xxx.h gdb/config/mips/tm-vr4xxxel.h gdb/config/mips/tm-vr5000.h gdb/config/mips/tm-vr5000el.h gdb/config/mips/vr4100.mt gdb/config/mips/vr4300.mt gdb/config/mips/vr4300el.mt gdb/config/mips/vr4xxx.mt gdb/config/mips/vr4xxxel.mt gdb/config/mips/vr5000.mt gdb/config/mips/vr5000el.mt gdb/dwarf2cfi.c gdb/dwarf2cfi.h gdb/gdbserver/linux-ppc64-low.c gdb/gdbserver/low-hppabsd.c gdb/gdbserver/low-lynx.c gdb/gdbserver/low-nbsd.c gdb/gdbserver/low-sim.c gdb/gdbserver/low-sparc.c gdb/gdbserver/low-sun3.c gdb/regformats/reg-ppc64.dat gdb/remote-array.c sim/ppc/ppc-cache-rules
Diffstat (limited to 'libiberty')
-rw-r--r--libiberty/ChangeLog32
-rw-r--r--libiberty/Makefile.in3
-rw-r--r--libiberty/config.in3
-rwxr-xr-xlibiberty/configure31
-rw-r--r--libiberty/configure.in2
-rw-r--r--libiberty/functions.texi100
-rw-r--r--libiberty/hashtab.c4
-rw-r--r--libiberty/hex.c9
-rw-r--r--libiberty/safe-ctype.c119
9 files changed, 267 insertions, 36 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 75b66361296..913bf54a3e3 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,12 +1,34 @@
+2003-06-22 Zack Weinberg <zack@codesourcery.com>
+
+ * safe-ctype.c: Use HOST_CHARSET_ASCII and HOST_CHARSET_EBCDIC,
+ not HC_ASCII and HC_EBCDIC.
+ Add documentation in form expected by gather-docs.
+ * hex.c: Use HOST_CHARSET, not hand-coded check of character set.
+ * Makefile.in, functions.texi: Regenerate.
+
+2003-06-21 Zack Weinberg <zack@codesourcery.com>
+
+ * safe-ctype.c: Separate out EOF==-1 check. Use HOST_CHARSET
+ for charset determination.
+
+2003-06-19 Dara Hazeghi <dhazeghi@yahoo.com>
+
+ * configure.in: Add check for malloc.h needed by
+ m68k for function free().
+ * configure: Regenerated.
+ * config.in: Add HAVE_MALLOC_H.
+ * hashtab.c: include malloc.h were available for
+ free().
+
2003-06-09 Albert Chin-A-Young <china@thewrittenword.com>
-
+
PR bootstrap/10974
* physmem.c: Update comment.
* configure.in: Modify test for _system_configuration for older
AIX systems.
* config.in, configure: Regenerated.
-
+
2003-06-05 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
PR other/10810
@@ -100,7 +122,7 @@
ANSI_PROTOTYPES.
* vsprintf.c: Include "ansidecl.h" earlier, rely on
ANSI_PROTOTYPES and possibly include <stdarg.h>.
-
+
* Makefile.in: Regenerate dependencies.
2003-04-15 DJ Delorie <dj@redhat.com>
@@ -198,7 +220,7 @@
2003-02-22 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
Richard Earnshaw <rearnsha@arm.com>
Geoffrey Keating <geoffk@apple.com>
-
+
* configure.in: Check for sys/sysctl.h and sysctl.
* physmem.c: Add support for *bsd and darwin.
* Makefile.in: Generate depedency for physmem.o.
@@ -227,7 +249,7 @@
* physmem.c (physmem_total, physmem_available): De-ANSI-fy.
* configure.in (AC_CHECK_FUNCS): Add pstat_getstatic and
pstat_getdynamic.
-
+
2003-02-20 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* Makefile.in (CFILES): Add physmem.c.
diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in
index d73ab2fef77..5d2dc3cbf8d 100644
--- a/libiberty/Makefile.in
+++ b/libiberty/Makefile.in
@@ -447,7 +447,8 @@ getpwd.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
getruntime.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
hashtab.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/hashtab.h \
$(INCDIR)/libiberty.h
-hex.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
+hex.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/safe-ctype.h
lbasename.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
$(INCDIR)/safe-ctype.h
lrealpath.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
diff --git a/libiberty/config.in b/libiberty/config.in
index 51d161a4606..50ed3266852 100644
--- a/libiberty/config.in
+++ b/libiberty/config.in
@@ -291,6 +291,9 @@
/* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
+/* Define if you have the <malloc.h> header file. */
+#undef HAVE_MALLOC_H
+
/* whether byteorder is bigendian */
#undef WORDS_BIGENDIAN
diff --git a/libiberty/configure b/libiberty/configure
index 9182fc3f98e..77d5170a877 100755
--- a/libiberty/configure
+++ b/libiberty/configure
@@ -1492,7 +1492,7 @@ else
fi
echo "$ac_t""$CPP" 1>&6
-for ac_hdr in sys/file.h sys/param.h limits.h stdlib.h string.h unistd.h strings.h sys/time.h time.h sys/resource.h sys/stat.h sys/mman.h fcntl.h alloca.h sys/pstat.h sys/sysmp.h sys/sysinfo.h machine/hal_sysinfo.h sys/table.h sys/sysctl.h sys/systemcfg.h
+for ac_hdr in sys/file.h sys/param.h limits.h stdlib.h malloc.h string.h unistd.h strings.h sys/time.h time.h sys/resource.h sys/stat.h sys/mman.h fcntl.h alloca.h sys/pstat.h sys/sysmp.h sys/sysinfo.h machine/hal_sysinfo.h sys/table.h sys/sysctl.h sys/systemcfg.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
@@ -2900,7 +2900,7 @@ case "${host}" in
esac
-for ac_hdr in unistd.h
+for ac_hdr in stdlib.h unistd.h sys/stat.h sys/types.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
@@ -3032,11 +3032,24 @@ else
#include <fcntl.h>
#include <sys/mman.h>
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_STDLIB_H
+# include <stdlib.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
/* This mess was copied from the GNU getpagesize.h. */
#ifndef HAVE_GETPAGESIZE
-# ifdef HAVE_UNISTD_H
-# include <unistd.h>
-# endif
/* Assume that all systems that can run configure have sys/param.h. */
# ifndef HAVE_SYS_PARAM_H
@@ -3144,7 +3157,7 @@ main()
}
EOF
-if { (eval echo configure:3148: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3161: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_func_mmap_fixed_mapped=yes
else
@@ -3168,7 +3181,7 @@ fi
echo $ac_n "checking for working strncmp""... $ac_c" 1>&6
-echo "configure:3172: checking for working strncmp" >&5
+echo "configure:3185: checking for working strncmp" >&5
if eval "test \"`echo '$''{'ac_cv_func_strncmp_works'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -3176,7 +3189,7 @@ else
ac_cv_func_strncmp_works=no
else
cat > conftest.$ac_ext <<EOF
-#line 3180 "configure"
+#line 3193 "configure"
#include "confdefs.h"
/* Test by Jim Wilson and Kaveh Ghazi.
@@ -3240,7 +3253,7 @@ main ()
}
EOF
-if { (eval echo configure:3244: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3257: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_func_strncmp_works=yes
else
diff --git a/libiberty/configure.in b/libiberty/configure.in
index 0eab85513da..5dca13ed6f6 100644
--- a/libiberty/configure.in
+++ b/libiberty/configure.in
@@ -143,7 +143,7 @@ AC_SUBST_FILE(host_makefile_frag)
# It's OK to check for header files. Although the compiler may not be
# able to link anything, it had better be able to at least compile
# something.
-AC_CHECK_HEADERS(sys/file.h sys/param.h limits.h stdlib.h string.h unistd.h strings.h sys/time.h time.h sys/resource.h sys/stat.h sys/mman.h fcntl.h alloca.h sys/pstat.h sys/sysmp.h sys/sysinfo.h machine/hal_sysinfo.h sys/table.h sys/sysctl.h sys/systemcfg.h)
+AC_CHECK_HEADERS(sys/file.h sys/param.h limits.h stdlib.h malloc.h string.h unistd.h strings.h sys/time.h time.h sys/resource.h sys/stat.h sys/mman.h fcntl.h alloca.h sys/pstat.h sys/sysmp.h sys/sysinfo.h machine/hal_sysinfo.h sys/table.h sys/sysctl.h sys/systemcfg.h)
AC_HEADER_SYS_WAIT
AC_HEADER_TIME
diff --git a/libiberty/functions.texi b/libiberty/functions.texi
index 2d30c5da1f3..aac4424fd8f 100644
--- a/libiberty/functions.texi
+++ b/libiberty/functions.texi
@@ -3,6 +3,28 @@
@c Edit the *.c files, configure with --enable-maintainer-mode,
@c and let gather-docs build you a new copy.
+@c safe-ctype.c:24
+@defvr Extension HOST_CHARSET
+This macro indicates the basic character set and encoding used by the
+host: more precisely, the encoding used for character constants in
+preprocessor @samp{#if} statements (the C "execution character set").
+It is defined by @file{safe-ctype.h}, and will be an integer constant
+with one of the following values:
+
+@ftable @code
+@item HOST_CHARSET_UNKNOWN
+The host character set is unknown - that is, not one of the next two
+possibilities.
+
+@item HOST_CHARSET_ASCII
+The host character set is ASCII.
+
+@item HOST_CHARSET_EBCDIC
+The host character set is some variant of EBCDIC. (Only one of the
+nineteen EBCDIC varying characters is tested; exercise caution.)
+@end ftable
+@end defvr
+
@c alloca.c:26
@deftypefn Replacement void* alloca (size_t @var{size})
@@ -317,7 +339,7 @@ between calls to @code{getpwd}.
@end deftypefn
-@c hex.c:25
+@c hex.c:30
@deftypefn Extension void hex_init (void)
Initializes the array mapping the current character set to
@@ -327,7 +349,7 @@ default ASCII-based table will normally be used on ASCII systems.
@end deftypefn
-@c hex.c:34
+@c hex.c:39
@deftypefn Extension int hex_p (int @var{c})
Evaluates to non-zero if the given character is a valid hex character,
@@ -336,7 +358,7 @@ or zero if it is not. Note that the value you pass will be cast to
@end deftypefn
-@c hex.c:42
+@c hex.c:47
@deftypefn Extension unsigned int hex_value (int @var{c})
Returns the numeric equivalent of the given character when interpreted
@@ -382,6 +404,78 @@ struct qelem @{
@end deftypefn
+@c safe-ctype.c:45
+@deffn Extension ISALPHA (@var{c})
+@deffnx Extension ISALNUM (@var{c})
+@deffnx Extension ISBLANK (@var{c})
+@deffnx Extension ISCNTRL (@var{c})
+@deffnx Extension ISDIGIT (@var{c})
+@deffnx Extension ISGRAPH (@var{c})
+@deffnx Extension ISLOWER (@var{c})
+@deffnx Extension ISPRINT (@var{c})
+@deffnx Extension ISPUNCT (@var{c})
+@deffnx Extension ISSPACE (@var{c})
+@deffnx Extension ISUPPER (@var{c})
+@deffnx Extension ISXDIGIT (@var{c})
+
+These twelve macros are defined by @file{safe-ctype.h}. Each has the
+same meaning as the corresponding macro (with name in lowercase)
+defined by the standard header @file{ctype.h}. For example,
+@code{ISALPHA} returns true for alphabetic characters and false for
+others. However, there are two differences between these macros and
+those provided by @file{ctype.h}:
+
+@itemize @bullet
+@item These macros are guaranteed to have well-defined behavior for all
+values representable by @code{signed char} and @code{unsigned char}, and
+for @code{EOF}.
+
+@item These macros ignore the current locale; they are true for these
+fixed sets of characters:
+@multitable {@code{XDIGIT}} {yada yada yada yada yada yada yada yada}
+@item @code{ALPHA} @tab @kbd{A-Za-z}
+@item @code{ALNUM} @tab @kbd{A-Za-z0-9}
+@item @code{BLANK} @tab @kbd{space tab}
+@item @code{CNTRL} @tab @code{!PRINT}
+@item @code{DIGIT} @tab @kbd{0-9}
+@item @code{GRAPH} @tab @code{ALNUM || PUNCT}
+@item @code{LOWER} @tab @kbd{a-z}
+@item @code{PRINT} @tab @code{GRAPH ||} @kbd{space}
+@item @code{PUNCT} @tab @kbd{`~!@@#$%^&*()_-=+[@{]@}\|;:'",<.>/?}
+@item @code{SPACE} @tab @kbd{space tab \n \r \f \v}
+@item @code{UPPER} @tab @kbd{A-Z}
+@item @code{XDIGIT} @tab @kbd{0-9A-Fa-f}
+@end multitable
+
+Note that, if the host character set is ASCII or a superset thereof,
+all these macros will return false for all values of @code{char} outside
+the range of 7-bit ASCII. In particular, both ISPRINT and ISCNTRL return
+false for characters with numeric values from 128 to 255.
+@end itemize
+@end deffn
+
+@c safe-ctype.c:94
+@deffn Extension ISIDNUM (@var{c})
+@deffnx Extension ISIDST (@var{c})
+@deffnx Extension IS_VSPACE (@var{c})
+@deffnx Extension IS_NVSPACE (@var{c})
+@deffnx Extension IS_SPACE_OR_NUL (@var{c})
+@deffnx Extension IS_ISOBASIC (@var{c})
+These six macros are defined by @file{safe-ctype.h} and provide
+additional character classes which are useful when doing lexical
+analysis of C or similar languages. They are true for the following
+sets of characters:
+
+@multitable {@code{SPACE_OR_NUL}} {yada yada yada yada yada yada yada yada}
+@item @code{IDNUM} @tab @kbd{A-Za-z0-9_}
+@item @code{IDST} @tab @kbd{A-Za-z_}
+@item @code{VSPACE} @tab @kbd{\r \n}
+@item @code{NVSPACE} @tab @kbd{space tab \f \v \0}
+@item @code{SPACE_OR_NUL} @tab @code{VSPACE || NVSPACE}
+@item @code{ISOBASIC} @tab @code{VSPACE || NVSPACE || PRINT}
+@end multitable
+@end deffn
+
@c lbasename.c:23
@deftypefn Replacement {const char*} lbasename (const char *@var{name})
diff --git a/libiberty/hashtab.c b/libiberty/hashtab.c
index 3896328717a..cbf82592be1 100644
--- a/libiberty/hashtab.c
+++ b/libiberty/hashtab.c
@@ -45,6 +45,10 @@ Boston, MA 02111-1307, USA. */
#include <string.h>
#endif
+#ifdef HAVE_MALLOC_H
+#include <malloc.h>
+#endif
+
#include <stdio.h>
#include "libiberty.h"
diff --git a/libiberty/hex.c b/libiberty/hex.c
index f425509be75..e4c5dfa2f1d 100644
--- a/libiberty/hex.c
+++ b/libiberty/hex.c
@@ -19,6 +19,11 @@ Boston, MA 02111-1307, USA. */
#include <stdio.h> /* for EOF */
#include "libiberty.h"
+#include "safe-ctype.h" /* for HOST_CHARSET_ASCII */
+
+#if EOF != -1
+ #error "hex.c requires EOF == -1"
+#endif
/*
@@ -62,9 +67,7 @@ systems.
/* Are we ASCII? */
-#if '\n' == 0x0A && ' ' == 0x20 && '0' == 0x30 \
- && 'A' == 0x41 && 'a' == 0x61 && '!' == 0x21 \
- && EOF == -1
+#if HOST_CHARSET == HOST_CHARSET_ASCII
const unsigned char _hex_value[_hex_array_size] =
{
diff --git a/libiberty/safe-ctype.c b/libiberty/safe-ctype.c
index 3bac84bf68a..91a0e9a2589 100644
--- a/libiberty/safe-ctype.c
+++ b/libiberty/safe-ctype.c
@@ -19,20 +19,109 @@ License along with libiberty; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-/* This is a compatible replacement of the standard C library's <ctype.h>
- with the following properties:
-
- - Implements all isxxx() macros required by C99.
- - Also implements some character classes useful when
- parsing C-like languages.
- - Does not change behavior depending on the current locale.
- - Behaves properly for all values in the range of a signed or
- unsigned char. */
+/*
+
+@defvr Extension HOST_CHARSET
+This macro indicates the basic character set and encoding used by the
+host: more precisely, the encoding used for character constants in
+preprocessor @samp{#if} statements (the C "execution character set").
+It is defined by @file{safe-ctype.h}, and will be an integer constant
+with one of the following values:
+
+@ftable @code
+@item HOST_CHARSET_UNKNOWN
+The host character set is unknown - that is, not one of the next two
+possibilities.
+
+@item HOST_CHARSET_ASCII
+The host character set is ASCII.
+
+@item HOST_CHARSET_EBCDIC
+The host character set is some variant of EBCDIC. (Only one of the
+nineteen EBCDIC varying characters is tested; exercise caution.)
+@end ftable
+@end defvr
+
+@deffn Extension ISALPHA (@var{c})
+@deffnx Extension ISALNUM (@var{c})
+@deffnx Extension ISBLANK (@var{c})
+@deffnx Extension ISCNTRL (@var{c})
+@deffnx Extension ISDIGIT (@var{c})
+@deffnx Extension ISGRAPH (@var{c})
+@deffnx Extension ISLOWER (@var{c})
+@deffnx Extension ISPRINT (@var{c})
+@deffnx Extension ISPUNCT (@var{c})
+@deffnx Extension ISSPACE (@var{c})
+@deffnx Extension ISUPPER (@var{c})
+@deffnx Extension ISXDIGIT (@var{c})
+
+These twelve macros are defined by @file{safe-ctype.h}. Each has the
+same meaning as the corresponding macro (with name in lowercase)
+defined by the standard header @file{ctype.h}. For example,
+@code{ISALPHA} returns true for alphabetic characters and false for
+others. However, there are two differences between these macros and
+those provided by @file{ctype.h}:
+
+@itemize @bullet
+@item These macros are guaranteed to have well-defined behavior for all
+values representable by @code{signed char} and @code{unsigned char}, and
+for @code{EOF}.
+
+@item These macros ignore the current locale; they are true for these
+fixed sets of characters:
+@multitable {@code{XDIGIT}} {yada yada yada yada yada yada yada yada}
+@item @code{ALPHA} @tab @kbd{A-Za-z}
+@item @code{ALNUM} @tab @kbd{A-Za-z0-9}
+@item @code{BLANK} @tab @kbd{space tab}
+@item @code{CNTRL} @tab @code{!PRINT}
+@item @code{DIGIT} @tab @kbd{0-9}
+@item @code{GRAPH} @tab @code{ALNUM || PUNCT}
+@item @code{LOWER} @tab @kbd{a-z}
+@item @code{PRINT} @tab @code{GRAPH ||} @kbd{space}
+@item @code{PUNCT} @tab @kbd{`~!@@#$%^&*()_-=+[@{]@}\|;:'",<.>/?}
+@item @code{SPACE} @tab @kbd{space tab \n \r \f \v}
+@item @code{UPPER} @tab @kbd{A-Z}
+@item @code{XDIGIT} @tab @kbd{0-9A-Fa-f}
+@end multitable
+
+Note that, if the host character set is ASCII or a superset thereof,
+all these macros will return false for all values of @code{char} outside
+the range of 7-bit ASCII. In particular, both ISPRINT and ISCNTRL return
+false for characters with numeric values from 128 to 255.
+@end itemize
+@end deffn
+
+@deffn Extension ISIDNUM (@var{c})
+@deffnx Extension ISIDST (@var{c})
+@deffnx Extension IS_VSPACE (@var{c})
+@deffnx Extension IS_NVSPACE (@var{c})
+@deffnx Extension IS_SPACE_OR_NUL (@var{c})
+@deffnx Extension IS_ISOBASIC (@var{c})
+These six macros are defined by @file{safe-ctype.h} and provide
+additional character classes which are useful when doing lexical
+analysis of C or similar languages. They are true for the following
+sets of characters:
+
+@multitable {@code{SPACE_OR_NUL}} {yada yada yada yada yada yada yada yada}
+@item @code{IDNUM} @tab @kbd{A-Za-z0-9_}
+@item @code{IDST} @tab @kbd{A-Za-z_}
+@item @code{VSPACE} @tab @kbd{\r \n}
+@item @code{NVSPACE} @tab @kbd{space tab \f \v \0}
+@item @code{SPACE_OR_NUL} @tab @code{VSPACE || NVSPACE}
+@item @code{ISOBASIC} @tab @code{VSPACE || NVSPACE || PRINT}
+@end multitable
+@end deffn
+
+*/
#include "ansidecl.h"
#include <safe-ctype.h>
#include <stdio.h> /* for EOF */
+#if EOF != -1
+ #error "<safe-ctype.h> requires EOF == -1"
+#endif
+
/* Shorthand */
#define bl _sch_isblank
#define cn _sch_iscntrl
@@ -64,9 +153,7 @@ Boston, MA 02111-1307, USA. */
#define S (const unsigned short) (nv|sp|bl|pr) /* space */
/* Are we ASCII? */
-#if '\n' == 0x0A && ' ' == 0x20 && '0' == 0x30 \
- && 'A' == 0x41 && 'a' == 0x61 && '!' == 0x21 \
- && EOF == -1
+#if HOST_CHARSET == HOST_CHARSET_ASCII
const unsigned short _sch_istable[256] =
{
@@ -159,5 +246,9 @@ const unsigned char _sch_toupper[256] =
};
#else
- #error "Unsupported host character set"
-#endif /* not ASCII */
+# if HOST_CHARSET == HOST_CHARSET_EBCDIC
+ #error "FIXME: write tables for EBCDIC"
+# else
+ #error "Unrecognized host character set"
+# endif
+#endif