+2001-09-18 Bruno Haible <haible@clisp.cons.org>
+
+ * aoutx.h: Include "safe-ctype.h" instead of <ctype.h>.
+ (aout_link_write_symbols): Use ISDIGIT instead of isdigit.
+ * archive.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (_bfd_generic_read_ar_hdr_mag): Use ISDIGIT instead of isdigit.
+ * archures.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (bfd_default_scan): Use ISDIGIT instead of isdigit.
+ * bfd.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (bfd_scan_vma): Use ISXDIGIT/ISDIGIT/ISLOWER instead of
+ isxdigit/isdigit/islower.
+ * binary.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (mangle_name): Use ISALNUM instead of isalnum.
+ * cpu-v850.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (scan): Use ISDIGIT instead of isdigit.
+ * hosts/alphavms.h: Don't include <ctype.h>.
+ * ieee.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (ieee_object_p): Use TOUPPER instead of toupper.
+ * ihex.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (ihex_bad_byte): Use ISPRINT instead of isprint.
+ * merge.c: Don't include <ctype.h>.
+ * oasys.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (oasys_write_sections): Use ISDIGIT instead of isdigit.
+ * pdp11.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (aout_link_write_symbols): Use ISDIGIT instead of isdigit.
+ * ppcboot.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (mangle_name): Use ISALNUM instead of isalnum.
+ * som.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (som_set_reloc_info): Use ISUPPER/ISLOWER/ISDIGIT instead of
+ isupper/islower/isdigit.
+ (som_decode_symclass): Use TOUPPER instead of toupper.
+ * srec.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (srec_bad_byte): Use ISPRINT instead of isprint.
+ (srec_scan): Use ISSPACE instead of isspace.
+ * stabs.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (_bfd_link_section_stabs): Use ISDIGIT instead of isdigit.
+ * syms.c: Include "safe-ctype.h"
+ (islower, toupper): Remove macro definitions.
+ (bfd_decode_symclass): Use TOUPPER instead of toupper.
+ * vms-gsd.c: Don't include <ctype.h>.
+ * vms-hdr.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (_bfd_vms_write_hdr): Use ISLOWER/TOUPPER instead of
+ islower/toupper.
+ * vms-tir.c: Don't include <ctype.h>.
+
2001-09-18 Alan Modra <amodra@bigpond.net.au>
* libbfd.c (bfd_bread): New function replacing bfd_read without
#define KEEPIT udata.i
-#include <ctype.h>
#include "bfd.h"
#include "sysdep.h"
+#include "safe-ctype.h"
#include "bfdlink.h"
#include "libaout.h"
{
/* Skip the file number. */
++s;
- while (isdigit ((unsigned char) *s))
+ while (ISDIGIT (*s))
++s;
--s;
}
#include "libbfd.h"
#include "aout/ar.h"
#include "aout/ranlib.h"
-#include <ctype.h>
+#include "safe-ctype.h"
#ifndef errno
extern int errno;
else if (hdr.ar_name[0] == '#'
&& hdr.ar_name[1] == '1'
&& hdr.ar_name[2] == '/'
- && isdigit ((unsigned char) hdr.ar_name[3]))
+ && ISDIGIT (hdr.ar_name[3]))
{
/* BSD-4.4 extended name */
namelen = atoi (&hdr.ar_name[3]);
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
-#include <ctype.h>
+#include "safe-ctype.h"
/*
}
number = 0;
- while (isdigit ((unsigned char) *ptr_src))
+ while (ISDIGIT (*ptr_src))
{
number = number * 10 + *ptr_src - '0';
ptr_src++;
#endif
#include "libiberty.h"
+#include "safe-ctype.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "coff/internal.h"
#include "libecoff.h"
#undef obj_symbols
#include "elf-bfd.h"
-
-#include <ctype.h>
\f
/* provide storage for subsystem, stack and heap data which may have been
passed in on the command line. Ld puts this data into a bfd_link_info
/* Speed could be improved with a table like hex_value[] in gas. */
#define HEX_VALUE(c) \
- (isxdigit ((unsigned char) c) \
- ? (isdigit ((unsigned char) c) \
+ (ISXDIGIT (c) \
+ ? (ISDIGIT (c) \
? (c - '0') \
- : (10 + c - (islower ((unsigned char) c) ? 'a' : 'A'))) \
+ : (10 + c - (ISLOWER (c) ? 'a' : 'A'))) \
: 42)
for (value = 0; (digit = HEX_VALUE (* string)) < base; string ++)
the file. objcopy cooperates by specially setting the start
address to zero by default. */
-#include <ctype.h>
-
+#include "safe-ctype.h"
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
/* Change any non-alphanumeric characters to underscores. */
for (p = buf; *p; p++)
- if (! isalnum ((unsigned char) *p))
+ if (! ISALNUM (*p))
*p = '_';
return buf;
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
-
-#include <ctype.h>
+#include "safe-ctype.h"
static boolean scan PARAMS ((const struct bfd_arch_info *, const char *));
return info->the_default;
number = 0;
- while (isdigit ((unsigned char) *ptr_src))
+ while (ISDIGIT (*ptr_src))
{
number = number * 10 + * ptr_src - '0';
ptr_src ++;
/* alphavms.h -- BFD definitions for an openVMS host
- Copyright 1996 Free Software Foundation, Inc.
+ Copyright 1996, 2000 Free Software Foundation, Inc.
Written by Klaus Kämpf (kkaempf@progis.de)
of proGIS Softwareentwicklung, Aachen, Germany
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include <ctype.h>
#include <string.h>
#include <sys/file.h>
#include <stdlib.h>
#include "libbfd.h"
#include "ieee.h"
#include "libieee.h"
-
-#include <ctype.h>
+#include "safe-ctype.h"
struct output_buffer_struct
{
strcpy (family, "68332"); /* Guess it will be CPU32 */
}
}
- else if (toupper (processor[3]) == 'F') /* 68F333 */
- strcpy (family, "68332"); /* CPU32 */
- else if ((toupper (processor[3]) == 'C') /* Embedded controllers */
- && ((toupper (processor[2]) == 'E')
- || (toupper (processor[2]) == 'H')
- || (toupper (processor[2]) == 'L')))
+ else if (TOUPPER (processor[3]) == 'F') /* 68F333 */
+ strcpy (family, "68332"); /* CPU32 */
+ else if ((TOUPPER (processor[3]) == 'C') /* Embedded controllers */
+ && ((TOUPPER (processor[2]) == 'E')
+ || (TOUPPER (processor[2]) == 'H')
+ || (TOUPPER (processor[2]) == 'L')))
{
strcpy (family, "68");
strncat (family, processor + 4, 7);
#include "sysdep.h"
#include "libbfd.h"
#include "libiberty.h"
-
-#include <ctype.h>
+#include "safe-ctype.h"
static void ihex_init PARAMS ((void));
static boolean ihex_mkobject PARAMS ((bfd *));
{
char buf[10];
- if (! isprint (c))
+ if (! ISPRINT (c))
sprintf (buf, "\\%03o", (unsigned int) c);
else
{
#include "libbfd.h"
#include "hashtab.h"
-#include <ctype.h>
-
struct sec_merge_sec_info;
/* An entry in the section merge hash table. */
#define UNDERSCORE_HACK 1
#include "bfd.h"
#include "sysdep.h"
-#include <ctype.h>
+#include "safe-ctype.h"
#include "libbfd.h"
#include "oasys.h"
#include "liboasys.h"
for (s = abfd->sections; s != (asection *) NULL; s = s->next)
{
- if (!isdigit ((unsigned char) s->name[0]))
+ if (!ISDIGIT (s->name[0]))
{
(*_bfd_error_handler)
(_("%s: can not represent section `%s' in oasys"),
#define KEEPIT udata.i
#include <string.h> /* For strchr and friends */
-#include <ctype.h>
#include "bfd.h"
#include "sysdep.h"
+#include "safe-ctype.h"
#include "bfdlink.h"
#include "libaout.h"
{
/* Skip the file number. */
++s;
- while (isdigit ((unsigned char) *s))
+ while (ISDIGIT (*s))
++s;
--s;
}
the file. objcopy cooperates by specially setting the start
address to zero by default. */
-#include <ctype.h>
-
+#include "safe-ctype.h"
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
/* Change any non-alphanumeric characters to underscores. */
for (p = buf; *p; p++)
- if (! isalnum ((unsigned char) *p))
+ if (! ISALNUM (*p))
*p = '_';
return buf;
#include "libbfd.h"
#include "som.h"
+#include "safe-ctype.h"
#include <sys/param.h>
#include <signal.h>
#include <machine/reg.h>
#include <sys/file.h>
-#include <ctype.h>
/* Magic not defined in standard HP-UX header files until 8.0 */
c = *cp++;
/* If this is a variable, push it on the stack. */
- if (isupper (c))
+ if (ISUPPER (c))
push (var (c));
/* If this is a lower case letter, then it represents
additional data from the fixup stream to be pushed onto
the stack. */
- else if (islower (c))
+ else if (ISLOWER (c))
{
int bits = (c - 'a') * 8;
for (v = 0; c > 'a'; --c)
}
/* A decimal constant. Push it on the stack. */
- else if (isdigit (c))
+ else if (ISDIGIT (c))
{
v = c - '0';
- while (isdigit (*cp))
+ while (ISDIGIT (*cp))
v = (v * 10) + (*cp++ - '0');
push (v);
}
else
return '?';
if (symbol->flags & BSF_GLOBAL)
- c = toupper (c);
+ c = TOUPPER (c);
return c;
}
#include "sysdep.h"
#include "libbfd.h"
#include "libiberty.h"
-#include <ctype.h>
+#include "safe-ctype.h"
static void srec_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *));
static void srec_print_symbol
{
char buf[10];
- if (! isprint (c))
+ if (! ISPRINT (c))
sprintf (buf, "\\%03o", (unsigned int) c);
else
{
*p++ = c;
while ((c = srec_get_byte (abfd, &error)) != EOF
- && ! isspace (c))
+ && ! ISSPACE (c))
{
if ((bfd_size_type) (p - symbuf) >= alc)
{
#include "sysdep.h"
#include "libbfd.h"
#include "aout/stab_gnu.h"
-
-#include <ctype.h>
+#include "safe-ctype.h"
/* Stabs entries use a 12 byte format:
4 byte string table index
{
/* Skip the file number. */
++str;
- while (isdigit ((unsigned char) *str))
+ while (ISDIGIT (*str))
++str;
--str;
}
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
+#include "safe-ctype.h"
#include "bfdlink.h"
#include "aout/stab_gnu.h"
return '?';
}
-#ifndef islower
-#define islower(c) ((c) >= 'a' && (c) <= 'z')
-#endif
-#ifndef toupper
-#define toupper(c) (islower(c) ? ((c) & ~0x20) : (c))
-#endif
-
/*
FUNCTION
bfd_decode_symclass
else
return '?';
if (symbol->flags & BSF_GLOBAL)
- c = toupper (c);
+ c = TOUPPER (c);
return c;
/* We don't have to handle these cases just yet, but we will soon:
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-#include <ctype.h>
-
#include "bfd.h"
#include "sysdep.h"
#include "bfdlink.h"
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-#include <ctype.h>
-
#include "bfd.h"
#include "sysdep.h"
#include "bfdlink.h"
+#include "safe-ctype.h"
#include "libbfd.h"
#include "vms.h"
fptr = fout;
while (*fptr != 0)
{
- if (islower (*fptr))
- *fptr = toupper (*fptr);
+ *fptr = TOUPPER (*fptr);
fptr++;
if ((*fptr == ';')
|| ((fptr - fout) > 31))
qw quadword (8 byte, 64 bit)
da data stream */
-#include <ctype.h>
-
#include "bfd.h"
#include "sysdep.h"
#include "bfdlink.h"
+2001-09-18 Bruno Haible <haible@clisp.cons.org>
+
+ * addr2line.c: Don't include <ctype.h>.
+ (main): For gettext, also set the LC_CTYPE locate facet.
+ * ar.c (main): Likewise.
+ * coffdump.c (main): Likewise.
+ * dlltool.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (main): For gettext, also set the LC_CTYPE locate facet.
+ Use ISALNUM instead of isalpha/isdigit.
+ * dllwrap.c: Don't include <ctype.h>.
+ (main): For gettext, also set the LC_CTYPE locate facet.
+ * nlmconv.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (main): For gettext, also set the LC_CTYPE locate facet.
+ Use TOUPPER instead of islower/toupper.
+ * nlmheader.y: Include "safe-ctype.h" instead of <ctype.h>.
+ (yylex): Use ISSPACE/ISALNUM instead of isspace/isalnum.
+ Use TOUPPER instead of islower/toupper.
+ * nm.c (main): For gettext, also set the LC_CTYPE locate facet.
+ * objcopy.c (main): Likewise.
+ * objdump.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (disassemble_bytes): Use ISPRINT instead of isprint.
+ (dump_section_stabs): Use ISDIGIT instead of isdigit.
+ (dump_data): Use ISPRINT instead of isprint.
+ (main): For gettext, also set the LC_CTYPE locate facet.
+ * rclex.l: Include "safe-ctype.h" instead of <ctype.h>.
+ (cpp_line, handle_quotes): Use ISSPACE instead of isspace.
+ * rcparse.y: Include "safe-ctype.h" instead of <ctype.h>.
+ Use TOUPPER instead of islower/toupper.
+ * readelf.c (main): For gettext, also set the LC_CTYPE locate facet.
+ * resrc.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (write_rc_accelerators): Use ISPRINT instead of isprint.
+ (write_rc_rcdata): Likewise.
+ * size.c (main): For gettext, also set the LC_CTYPE locate facet.
+ * srconv.c (main): Likewise.
+ * stabs.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (parse_number): Use ISDIGIT/ISUPPER/ISLOWER instead of
+ isdigit/isupper/islower.
+ (parse_stab_string, parse_stab_type, parse_stab_argtypes,
+ parse_stab_array_type, stab_demangle_count, stab_demangle_get_count,
+ stab_demangle_prefix, stab_demangle_qualified,
+ stab_demangle_template, stab_demangle_type,
+ stab_demangle_fund_type): Use ISDIGIT instead of isdigit.
+ * strings.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (isgraphic): Use ISPRINT instead of isascii/isprint.
+ (main): Remove HAVE_LC_MESSAGES dependency.
+ * sysdump.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (pbarray): Use ISPRINT instead of isprint.
+ (main): For gettext, also set the LC_CTYPE locate facet.
+ * windres.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (format_from_filename): Use ISPRINT instead of isprint.
+ (main): For gettext, also set the LC_CTYPE locate facet.
+ * winduni.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (unicode_print): Use ISPRINT instead of isprint.
+ * wrstabs.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (stab_variable): Use ISDIGIT instead of isdigit.
+
2001-09-18 Alan Modra <amodra@bigpond.net.au>
* ar.c (print_contents): Cast args of bfd_seek to the right types.
/* addr2line.c -- convert addresses to line number and function name
- Copyright 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
Contributed by Ulrich Lauther <Ulrich.Lauther@mchp.siemens.de>
This file is part of GNU Binutils.
both forms write results to stdout, the second form reads addresses
to be converted from stdin. */
-#include <ctype.h>
#include <string.h>
#include "bfd.h"
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
+#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
+#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
+#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
/* dlltool.c -- tool to generate stuff for PE style DLLs
- Copyright 1995, 1996, 1997, 1998, 1999, 2000
+ Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
This file is part of GNU Binutils.
#include "demangle.h"
#include "dyn-string.h"
#include "dlltool.h"
+#include "safe-ctype.h"
-#include <ctype.h>
#include <time.h>
#include <sys/stat.h>
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
+#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
imp_name_lab = xstrdup (imp_name);
for (p = imp_name_lab; *p; p++)
{
- if (!isalpha ((unsigned char) *p) && !isdigit ((unsigned char) *p))
+ if (!ISALNUM (*p))
*p = '_';
}
head_label = make_label("_head_", imp_name_lab);
/* dllwrap.c -- wrapper for DLLTOOL and GCC to generate PE style DLLs
- Copyright 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
Contributed by Mumit Khan (khan@xraylith.wisc.edu).
This file is part of GNU Binutils.
#include "getopt.h"
#include "dyn-string.h"
-#include <ctype.h>
#include <time.h>
#include <sys/stat.h>
program_name = argv[0];
+#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
+ setlocale (LC_MESSAGES, "");
+#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
+#endif
+ bindtextdomain (PACKAGE, LOCALEDIR);
+ textdomain (PACKAGE);
+
saved_argv = (char **) xmalloc (argc * sizeof (char*));
dlltool_arg_indices = (int *) xmalloc (argc * sizeof (int));
driver_arg_indices = (int *) xmalloc (argc * sizeof (int));
/* nlmconv.c -- NLM conversion program
- Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
+ Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
This file is part of GNU Binutils.
#include "bfd.h"
#include "libiberty.h"
#include "bucomm.h"
+#include "safe-ctype.h"
#include <ansidecl.h>
#include <time.h>
-#include <ctype.h>
#include <sys/stat.h>
#include <sys/file.h>
#include <assert.h>
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
+#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
for (modname = nlm_fixed_header (outbfd)->moduleName;
*modname != '\0';
modname++)
- if (islower ((unsigned char) *modname))
- *modname = toupper (*modname);
+ *modname = TOUPPER (*modname);
strncpy (nlm_variable_header (outbfd)->oldThreadName, " LONG",
NLM_OLD_THREAD_NAME_LENGTH);
%{/* nlmheader.y - parse NLM header specification keywords.
- Copyright 1993, 1994, 1995, 1997, 1998 Free Software Foundation, Inc.
+ Copyright 1993, 1994, 1995, 1997, 1998, 2001 Free Software Foundation, Inc.
This file is part of GNU Binutils.
#include <ansidecl.h>
#include <stdio.h>
-#include <ctype.h>
+#include "safe-ctype.h"
#include "bfd.h"
#include "bucomm.h"
#include "nlm/common.h"
c = getc (current.file);
/* Commas are treated as whitespace characters. */
- while (isspace ((unsigned char) c) || c == ',')
+ while (ISSPACE (c) || c == ',')
{
current.state = IN_LINE;
if (c == '\n')
if (c == '\n')
++current.lineno;
}
- while (isspace ((unsigned char) c));
+ while (ISSPACE (c));
BUF_INIT ();
- while (! isspace ((unsigned char) c) && c != EOF)
+ while (! ISSPACE (c) && c != EOF)
{
BUF_ADD (c);
c = getc (current.file);
if (current.state == BEGINNING_OF_LINE)
{
BUF_INIT ();
- while (isalnum ((unsigned char) c) || c == '_')
+ while (ISALNUM (c) || c == '_')
{
- if (islower ((unsigned char) c))
- BUF_ADD (toupper ((unsigned char) c));
- else
- BUF_ADD (c);
+ BUF_ADD (TOUPPER (c));
c = getc (current.file);
}
BUF_FINISH ();
- if (c != EOF && ! isspace ((unsigned char) c) && c != ',')
+ if (c != EOF && ! ISSPACE (c) && c != ',')
{
nlmheader_identify ();
fprintf (stderr, _("%s:%d: illegal character in keyword: %c\n"),
/* Gather a generic argument. */
BUF_INIT ();
- while (! isspace (c)
+ while (! ISSPACE (c)
&& c != ','
&& c != COMMENT_CHAR
&& c != '('
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
+#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
{
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
+#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
#include "getopt.h"
#include "progress.h"
#include "bucomm.h"
-#include <ctype.h>
+#include "safe-ctype.h"
#include "dis-asm.h"
#include "libiberty.h"
#include "demangle.h"
for (j = addr_offset * opb; j < addr_offset * opb + octets; ++j)
{
- if (isprint (data[j]))
+ if (ISPRINT (data[j]))
buf[j - addr_offset * opb] = data[j];
else
buf[j - addr_offset * opb] = '.';
match or a section followed by a number. */
if (strncmp (stabsect_name, s->name, len) == 0
&& (s->name[len] == '\000'
- || isdigit ((unsigned char) s->name[len])))
+ || ISDIGIT (s->name[len])))
{
if (read_section_stabs (abfd, s->name, strsect_name))
{
if (j >= stop_offset * opb)
printf (" ");
else
- printf ("%c", isprint (data[j]) ? data[j] : '.');
+ printf ("%c", ISPRINT (data[j]) ? data[j] : '.');
}
putchar ('\n');
}
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
+#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
%{ /* rclex.l -- lexer for Windows rc files parser */
-/* Copyright 1997, 1998, 1999 Free Software Foundation, Inc.
+/* Copyright 1997, 1998, 1999, 2001 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
This file is part of GNU Binutils.
#include "bfd.h"
#include "bucomm.h"
#include "libiberty.h"
+#include "safe-ctype.h"
#include "windres.h"
#include "rcparse.h"
-#include <ctype.h>
#include <assert.h>
/* Whether we are in rcdata mode, in which we returns the lengths of
char *send, *fn;
++s;
- while (isspace ((unsigned char) *s))
+ while (ISSPACE (*s))
++s;
line = strtol (s, &send, 0);
- if (*send != '\0' && ! isspace ((unsigned char) *send))
+ if (*send != '\0' && ! ISSPACE (*send))
return;
/* Subtract 1 because we are about to count the newline. */
rc_lineno = line - 1;
s = send;
- while (isspace ((unsigned char) *s))
+ while (ISSPACE (*s))
++s;
if (*s != '"')
else
{
++t;
- assert (isspace ((unsigned char) *t));
- while (isspace ((unsigned char) *t))
+ assert (ISSPACE (*t));
+ while (ISSPACE (*t))
++t;
if (*t == '\0')
break;
%{ /* rcparse.y -- parser for Windows rc files
- Copyright 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
This file is part of GNU Binutils.
#include "bucomm.h"
#include "libiberty.h"
#include "windres.h"
-
-#include <ctype.h>
+#include "safe-ctype.h"
/* The current language. */
$$.flags = ACC_CONTROL | ACC_VIRTKEY;
++s;
ch = *s;
- ch = toupper ((unsigned char) ch);
+ ch = TOUPPER (ch);
}
$$.key = ch;
if (s[1] != '\0')
/* It seems that resource ID's are forced to upper case. */
copy = xstrdup ($1);
for (s = copy; *s != '\0'; s++)
- if (islower ((unsigned char) *s))
- *s = toupper ((unsigned char) *s);
+ *s = TOUPPER (*s);
res_string_to_id (&$$, copy);
free (copy);
}
/* It seems that resource ID's are forced to upper case. */
copy = xstrdup ($1);
for (s = copy; *s != '\0'; s++)
- if (islower ((unsigned char) *s))
- *s = toupper ((unsigned char) *s);
+ *s = TOUPPER (*s);
res_string_to_id (&$$, copy);
free (copy);
}
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
+#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
/* resrc.c -- read and write Windows rc files.
- Copyright 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
This file is part of GNU Binutils.
#include "bfd.h"
#include "bucomm.h"
#include "libiberty.h"
+#include "safe-ctype.h"
#include "windres.h"
#include <assert.h>
-#include <ctype.h>
#include <errno.h>
#include <sys/stat.h>
#ifdef HAVE_UNISTD_H
fprintf (e, " ");
if ((acc->key & 0x7f) == acc->key
- && isprint ((unsigned char) acc->key)
+ && ISPRINT (acc->key)
&& (acc->flags & ACC_VIRTKEY) == 0)
{
fprintf (e, "\"%c\"", acc->key);
s = ri->u.string.s;
for (i = 0; i < ri->u.string.length; i++)
{
- if (isprint ((unsigned char) *s))
+ if (ISPRINT (*s))
putc (*s, e);
else
fprintf (e, "\\%03o", *s);
if (i + 4 < ri->u.buffer.length || ri->next != NULL)
fprintf (e, ",");
for (j = 0; j < 4; ++j)
- if (! isprint (ri->u.buffer.data[i + j])
+ if (! ISPRINT (ri->u.buffer.data[i + j])
&& ri->u.buffer.data[i + j] != 0)
break;
if (j >= 4)
fprintf (e, "\t// ");
for (j = 0; j < 4; ++j)
{
- if (! isprint (ri->u.buffer.data[i + j]))
+ if (! ISPRINT (ri->u.buffer.data[i + j]))
fprintf (e, "\\%03o", ri->u.buffer.data[i + j]);
else
{
if (i + 2 < ri->u.buffer.length || ri->next != NULL)
fprintf (e, ",");
for (j = 0; j < 2; ++j)
- if (! isprint (ri->u.buffer.data[i + j])
+ if (! ISPRINT (ri->u.buffer.data[i + j])
&& ri->u.buffer.data[i + j] != 0)
break;
if (j >= 2)
fprintf (e, "\t// ");
for (j = 0; j < 2; ++j)
{
- if (! isprint (ri->u.buffer.data[i + j]))
+ if (! ISPRINT (ri->u.buffer.data[i + j]))
fprintf (e, "\\%03o", ri->u.buffer.data[i + j]);
else
{
if (! first)
indent (e, ind + 2);
if ((ri->u.buffer.data[i] & 0x7f) == ri->u.buffer.data[i]
- && isprint (ri->u.buffer.data[i]))
+ && ISPRINT (ri->u.buffer.data[i]))
fprintf (e, "\"%c\"", ri->u.buffer.data[i]);
else
fprintf (e, "\"\\%03o\"", ri->u.buffer.data[i]);
/* size.c -- report size of various sections of an executable file.
- Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
+ Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
This file is part of GNU Binutils.
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
+#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
+#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
trying to identify the correct address for anything. */
#include <stdio.h>
-#include <ctype.h>
#include "bfd.h"
#include "bucomm.h"
#include "libiberty.h"
+#include "safe-ctype.h"
#include "demangle.h"
#include "debug.h"
#include "budbg.h"
int d;
d = *p++;
- if (isdigit ((unsigned char) d))
+ if (ISDIGIT (d))
d -= '0';
- else if (isupper ((unsigned char) d))
+ else if (ISUPPER (d))
d -= 'A';
- else if (islower ((unsigned char) d))
+ else if (ISLOWER (d))
d -= 'a';
else
break;
}
++p;
- if (isdigit ((unsigned char) *p) || *p == '(' || *p == '-')
+ if (ISDIGIT (*p) || *p == '(' || *p == '-')
type = 'l';
else
type = *p++;
/* Read type number if present. The type number may be omitted.
for instance in a two-dimensional array declared with type
"ar1;1;10;ar1;1;10;4". */
- if (! isdigit ((unsigned char) **pp) && **pp != '(' && **pp != '-')
+ if (! ISDIGIT (**pp) && **pp != '(' && **pp != '-')
{
/* 'typenums=' not present, type is anonymous. Read and return
the definition, but don't put it in the type vector. */
const char *p = *pp + 1;
const char *attr;
- if (isdigit ((unsigned char) *p) || *p == '(' || *p == '-')
+ if (ISDIGIT (*p) || *p == '(' || *p == '-')
{
/* Member type. */
break;
/* Constructors are sometimes handled specially. */
is_full_physname_constructor = ((argtypes[0] == '_'
&& argtypes[1] == '_'
- && (isdigit ((unsigned char) argtypes[2])
+ && (ISDIGIT (argtypes[2])
|| argtypes[2] == 'Q'
|| argtypes[2] == 't'))
|| strncmp (argtypes, "__ct", 4) == 0);
adjustable = false;
- if (! isdigit ((unsigned char) **pp) && **pp != '-')
+ if (! ISDIGIT (**pp) && **pp != '-')
{
++*pp;
adjustable = true;
}
++*pp;
- if (! isdigit ((unsigned char) **pp) && **pp != '-')
+ if (! ISDIGIT (**pp) && **pp != '-')
{
++*pp;
adjustable = true;
unsigned int count;
count = 0;
- while (isdigit ((unsigned char) **pp))
+ while (ISDIGIT (**pp))
{
count *= 10;
count += **pp - '0';
const char **pp;
unsigned int *pi;
{
- if (! isdigit ((unsigned char) **pp))
+ if (! ISDIGIT (**pp))
return false;
*pi = **pp - '0';
++*pp;
- if (isdigit ((unsigned char) **pp))
+ if (ISDIGIT (**pp))
{
unsigned int count;
const char *p;
count += *p - '0';
++p;
}
- while (isdigit ((unsigned char) *p));
+ while (ISDIGIT (*p));
if (*p == '_')
{
*pp = p + 1;
scan += i - 2;
if (scan == *pp
- && (isdigit ((unsigned char) scan[2])
+ && (ISDIGIT (scan[2])
|| scan[2] == 'Q'
|| scan[2] == 't'))
{
return true;
}
else if (scan == *pp
- && ! isdigit ((unsigned char) scan[2])
+ && ! ISDIGIT (scan[2])
&& scan[2] != 't')
{
/* Look for the `__' that separates the prefix from the
preceded by an underscore (to distinguish it from the <= 9
case) and followed by an underscore. */
p = *pp + 2;
- if (! isdigit ((unsigned char) *p) || *p == '0')
+ if (! ISDIGIT (*p) || *p == '0')
{
stab_bad_demangle (orig);
return false;
}
qualifiers = atoi (p);
- while (isdigit ((unsigned char) *p))
+ while (ISDIGIT (*p))
++p;
if (*p != '_')
{
{
if (**pp == 'm')
++*pp;
- while (isdigit ((unsigned char) **pp))
+ while (ISDIGIT (**pp))
++*pp;
}
else if (charp)
{
if (**pp == 'm')
++*pp;
- while (isdigit ((unsigned char) **pp))
+ while (ISDIGIT (**pp))
++*pp;
if (**pp == '.')
{
++*pp;
- while (isdigit ((unsigned char) **pp))
+ while (ISDIGIT (**pp))
++*pp;
}
if (**pp == 'e')
{
++*pp;
- while (isdigit ((unsigned char) **pp))
+ while (ISDIGIT (**pp))
++*pp;
}
}
high = 0;
while (**pp != '\0' && **pp != '_')
{
- if (! isdigit ((unsigned char) **pp))
+ if (! ISDIGIT (**pp))
{
stab_bad_demangle (orig);
return false;
varargs = false;
++*pp;
- if (isdigit ((unsigned char) **pp))
+ if (ISDIGIT (**pp))
{
n = stab_demangle_count (pp);
if (strlen (*pp) < n)
case 'G':
++*pp;
- if (! isdigit ((unsigned char) **pp))
+ if (! ISDIGIT (**pp))
{
stab_bad_demangle (orig);
return false;
#include "bfd.h"
#include <stdio.h>
#include <getopt.h>
-#include <ctype.h>
#include <errno.h>
#include "bucomm.h"
#include "libiberty.h"
+#include "safe-ctype.h"
/* Some platforms need to put stdin into binary mode, to read
binary files. */
#endif
#endif
-/* Not all printable characters have ASCII codes (depending upon the
- LOCALE set) but on some older systems it is not safe to test isprint
- without first testing isascii... */
-#if defined isascii && !defined HAVE_LOCALE_H
-#define isgraphic(c) (isascii (c) && (isprint (c) || (c) == '\t'))
-#else
-#define isgraphic(c) (isprint (c) || (c) == '\t')
-#endif
+#define isgraphic(c) (ISPRINT (c) || (c) == '\t')
#ifndef errno
extern int errno;
int exit_status = 0;
boolean files_given = false;
-#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
+#if defined (HAVE_SETLOCALE)
setlocale (LC_ALL, "");
#endif
bindtextdomain (PACKAGE, LOCALEDIR);
#include "bfd.h"
#include "bucomm.h"
+#include "safe-ctype.h"
#include <stdio.h>
-#include <ctype.h>
#include <libiberty.h>
#include <getopt.h>
#include "sysroff.h"
printf ("%d (", y->len);
for (x = 0; x < y->len; x++)
{
- printf ("(%02x %c)", y->data[x], isprint (y->data[x]) ? y->data[x] : '.');
+ printf ("(%02x %c)", y->data[x],
+ ISPRINT (y->data[x]) ? y->data[x] : '.');
}
printf (")\n");
}
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
+#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
/* windres.c -- a program to manipulate Windows resources
- Copyright 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
This file is part of GNU Binutils.
#include "getopt.h"
#include "bucomm.h"
#include "libiberty.h"
+#include "safe-ctype.h"
#include "obstack.h"
#include "windres.h"
#include <assert.h>
-#include <ctype.h>
#include <time.h>
/* used by resrc.c at least */
return RES_FORMAT_RES;
/* If every character is printable or space, assume it's an RC file. */
- if ((isprint (b1) || isspace (b1))
- && (isprint (b2) || isspace (b2))
- && (isprint (b3) || isspace (b3))
- && (isprint (b4) || isspace (b4))
- && (isprint (b5) || isspace (b5)))
+ if ((ISPRINT (b1) || ISSPACE (b1))
+ && (ISPRINT (b2) || ISSPACE (b2))
+ && (ISPRINT (b3) || ISSPACE (b3))
+ && (ISPRINT (b4) || ISSPACE (b4))
+ && (ISPRINT (b5) || ISSPACE (b5)))
return RES_FORMAT_RC;
/* Otherwise, we give up. */
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
+#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
/* winduni.c -- unicode support for the windres program.
- Copyright 1997, 1998 Free Software Foundation, Inc.
+ Copyright 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
This file is part of GNU Binutils.
#include "bfd.h"
#include "bucomm.h"
#include "winduni.h"
-
-#include <ctype.h>
+#include "safe-ctype.h"
#ifdef _WIN32
#include <windows.h>
{
if (ch == '\\')
fputs ("\\", e);
- else if (isprint (ch))
+ else if (ISPRINT (ch))
putc (ch, e);
else
{
/* wrstabs.c -- Output stabs debugging information
- Copyright 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
+ Copyright 1996, 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
Written by Ian Lance Taylor <ian@cygnus.com>.
This file is part of GNU Binutils.
information. */
#include <stdio.h>
-#include <ctype.h>
#include <assert.h>
#include "bfd.h"
#include "bucomm.h"
#include "libiberty.h"
+#include "safe-ctype.h"
#include "debug.h"
#include "budbg.h"
kindstr = "";
/* Make sure that this is a type reference or definition. */
- if (! isdigit ((unsigned char) *s))
+ if (! ISDIGIT (*s))
{
char *n;
long index;
+2001-09-18 Bruno Haible <haible@clisp.cons.org>
+
+ * as.h: Don't include <ctype.h>.
+ * as.c (main): For gettext, also set the LC_CTYPE locate facet.
+ * atof-generic.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (atof_generic): Use ISDIGIT instead of isdigit.
+ * config/m68k-parse.y: Include "safe-ctype.h".
+ (yylex): Use ISDIGIT/ISALNUM instead of isdigit/isalnum.
+ * config/obj-elf.c: Include "safe-ctype.h".
+ (obj_elf_vtable_inherit): Use ISSPACE instead of isspace.
+ * config/obj-vms.c: Include "safe-ctype.h".
+ (Write_VMS_MHD_Records): Use TOUPPER instead of islower/toupper.
+ (VMS_Case_Hack_Symbol): Use ISUPPER/ISLOWER/TOUPPER/TOLOWER
+ instead of isupper/islower/toupper/tolower.
+ * config/tc-a29k.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (insert_sreg): Use TOUPPER instead of islower/toupper.
+ (machine_ip): Use ISALPHA/ISALNUM/ISUPPER/TOLOWER instead of
+ isalpha/isalnum/isupper/tolower.
+ (a29k_unrecognized_line, md_operand): Use ISDIGIT instead of
+ isdigit.
+ * config/tc-alpha.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (md_undefined_symbol, s_alpha_ent): Use ISDIGIT instead of isdigit.
+ * config/tc-arc.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (md_assemble): Use ISSPACE/ISALNUM instead of isspace/isalnum.
+ (arc_extoper): Use TOLOWER instead of isupper/tolower.
+ * config/tc-arm.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (arm_psr_parse): Use ISALPHA instead of isalpha.
+ (accum0_required_here): Use ISALNUM instead of isalnum.
+ (do_ldrd): Use ISSPACE instead of isspace.
+ (decode_shift): Use ISALPHA instead of isalpha.
+ (insert_reg): Use TOUPPER instead of islower/toupper.
+ (arm_reg_parse): Use ISALPHA instead of isalpha.
+ (arm_parse_reloc): Use ISALNUM/ISPUNCT/TOLOWER instead of
+ isalnum/ispunct/tolower.
+ * config/tc-avr.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (md_parse_option): Use TOLOWER instead of tolower.
+ (avr_operand): Use ISDIGIT/TOLOWER instead of isdigit/tolower.
+ * config/tc-cris.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (cris_process_instruction): Use ISLOWER instead of islower.
+ (get_gen_reg): Use ISALNUM/ISDIGIT instead of isalnum/isdigit.
+ (get_spec_reg): Use TOLOWER/ISALNUM instead of isupper/tolower/isalnum.
+ (get_flags): Use ISSPACE instead of isspace.
+ * config/tc-d10v.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (do_assemble): Use TOLOWER instead of tolower.
+ * config/tc-d30v.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (do_assemble): Use TOLOWER instead of tolower.
+ (d30v_start_line): Use ISSPACE instead of isspace.
+ * config/tc-fr30.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (fr30_is_colon_insn): Use TOLOWER instead of tolower.
+ * config/tc-h8300.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (skip_colonthing, get_operand): Use ISDIGIT instead of isdigit.
+ * config/tc-h8500.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (start_label): Use ISALPHA instead of isalpha.
+ * config/tc-hppa.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (pa_ip): Use ISUPPER/ISLOWER/TOLOWER instead of
+ isupper/islower/tolower.
+ (pa_parse_number): Use ISDIGIT instead of isdigit.
+ (pa_chk_field_selector): Use TOLOWER instead of tolower.
+ (pa_stringer): Use ISDIGIT instead of isdigit.
+ * config/tc-i370.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (register_name): Use ISALPHA instead of isalpha.
+ (i370_elf_suffix): Use ISALNUM/TOLOWER instead of
+ isalnum/islower/tolower.
+ (i370_addr_offset): Use ISDIGIT/ISALPHA instead of
+ isdigit/isalpha.
+ (i370_addr_cons): Use ISALPHA/ISXDIGIT instead of
+ isalpha/isxdigit.
+ (md_assemble): Use ISSPACE instead of isspace.
+ * config/tc-i386.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (md_begin): Use ISDIGIT/ISLOWER/ISUPPER/TOLOWER/ISALPHA
+ instead of isdigit/islower/isupper/tolower/isalpha.
+ (output_invalid): Use ISPRINT instead of isprint.
+ * config/tc-i860.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (i860_ip): Use ISLOWER/ISDIGIT instead of islower/isdigit.
+ * config/tc-i960.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (get_args): Use ISALNUM instead of isalnum.
+ * config/tc-ia64.c: Include "safe-ctype.h".
+ (dot_pred_rel): Use TOUPPER/ISDIGIT instead of toupper/isdigit.
+ (ia64_unrecognized_line): Use ISDIGIT instead of isdigit.
+ (ia64_parse_name): Likewise.
+ * config/tc-m32r.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (assemble_two_insns): Use ISSPACE/ISALNUM/ISUPPER/TOLOWER
+ instead of isspace/isalnum/isupper/tolower.
+ * config/tc-m68hc11.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (md_assemble): Use TOLOWER/ISALNUM instead of tolower/isalnum.
+ * config/tc-m68k.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (mklower_table): Remove variable.
+ (mklower): Remove macro.
+ (insert_reg): Use TOUPPER instead of islower/toupper.
+ (md_begin): Remove initialization of mklower_table.
+ (s_reg): Use ISALNUM instead of isalnum.
+ (mri_assemble): Use ISUPPER/TOLOWER instead of isupper/tolower.
+ (parse_mri_condition): Use TOLOWER instead of isupper/tolower.
+ (build_mri_control_operand): Use TOLOWER instead of tolower.
+ (s_mri_else, s_mri_break, s_mri_next, s_mri_for): Likewise.
+ * config/tc-m88k.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (md_assemble): Use ISSPACE instead of isspace.
+ (get_imm16): Use ISALNUM instead of isalnum.
+ (get_cnd): Use ISDIGIT/ISUPPER/TOLOWER instead of
+ isdigit/isupper/tolower.
+ (get_bf_offset_expression): Use ISALPHA/ISUPPER/TOLOWER
+ instead of isalpha/isupper/tolower.
+ (hexval): Use ISDIGIT/ISLOWER/ISUPPER instead of
+ isdigit/islower/isupper.
+ * config/tc-mcore.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (mcore_s_section): Use ISSPACE instead of isspace.
+ (parse_reg): Use ISSPACE/TOLOWER/ISALNUM instead of
+ isspace/tolower/isalnum.
+ (parse_creg): Use ISSPACE/TOLOWER instead of isspace/tolower.
+ (parse_psrmod): Use TOLOWER instead of isascii/tolower.
+ (parse_exp, parse_mem, md_assemble): Use ISSPACE instead of
+ isspace.
+ * config/tc-mips.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (mips_ip): Use ISSPACE/ISDIGIT instead of isspace/isdigit.
+ (mips16_ip): Use ISLOWER/ISDIGIT instead of islower/isdigit.
+ (my_getSmallExpression): Use ISDIGIT/TOLOWER instead of
+ isdigit/tolower.
+ (tc_get_register): Likewise.
+ (get_number): Use ISDIGIT/ISXDIGIT instead of isdigit/isxdigit.
+ (s_mips_ent): Use ISDIGIT instead of isdigit.
+ * config/tc-mn10200.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (md_assemble): Use ISSPACE instead of isspace.
+ * config/tc-mn10300.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (md_assemble): Use ISSPACE instead of isspace.
+ * config/tc-ns32k.c: Don't include <ctype.h>.
+ * config/tc-pdp11.c: Include "safe-ctype.h".
+ (mklower): Remove function.
+ (parse_reg): Use TOLOWER instead of mklower.
+ * config/tc-pj.c: Include "safe-ctype.h".
+ (md_assemble): Use ISSPACE instead of isspace.
+ * config/tc-ppc.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (register_name): Use ISALPHA instead of isalpha.
+ (ppc_elf_suffix): Use ISALNUM/TOLOWER instead of
+ isalnum/islower/tolower.
+ (md_assemble): Use ISSPACE instead of isspace.
+ (ppc_canonicalize_symbol_name): Use ISLOWER/TOUPPER instead of
+ islower/toupper.
+ * config/tc-s390.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (register_name): Use ISALPHA instead of isalpha.
+ (s390_elf_suffix, s390_lit_suffix): Use ISALNUM instead of isalnum.
+ (md_gather_operands, md_assemble, s390_insn): Use ISSPACE instead of
+ isspace.
+ * config/tc-sh.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (sh_elf_suffix): Use ISALNUM/TOLOWER instead of
+ isalnum/islower/tolower.
+ (IDENT_CHAR): Use ISALNUM instead of isalnum.
+ (parse_reg): Use TOLOWER instead of tolower.
+ (find_cooked_opcode): Use TOLOWER instead of isupper/tolower.
+ * config/tc-sparc.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (sparc_ip): Use ISLOWER/ISDIGIT instead of islower/isdigit.
+ (parse_keyword_arg): Use ISALNUM instead of isalnum.
+ * config/tc-tahoe.c: Include "safe-ctype.h".
+ (tahoe_reg_parse): Use ISDIGIT instead of isdigit.
+ (tip_op): Use TOLOWER instead of isupper/tolower.
+ * config/tc-tic30.c: Include "safe-ctype.h".
+ (md_begin): Use ISLOWER/ISDIGIT/ISUPPER/TOLOWER/ISLOWER/
+ ISALPHA instead of islower/isdigit/isupper/tolower/islower/isalpha.
+ (tic30_operand): Use TOLOWER instead of tolower.
+ (tic30_find_parallel_insn): Likewise.
+ (output_invalid): Use ISPRINT instead of isprint.
+ * config/tc-tic54x.c: Include "safe-ctype.h".
+ (tic54x_asg, tic54x_eval): Use ISALPHA instead of isalpha.
+ (lookup_version): Use TOUPPER instead of toupper.
+ (tic54x_var): Use ISALPHA instead of isalpha.
+ (tic54x_mlib): Use ISSPACE instead of isspace.
+ (subsym_iscons): Use TOUPPER instead of toupper.
+ (get_operands): Use ISSPACE instead of isspace.
+ (is_type): Use TOUPPER/ISDIGIT instead of toupper/isdigit.
+ (encode_indirect, encode_operand): Use TOUPPER instead of toupper.
+ (next_line_shows_parallel): Use ISSPACE instead of isspace.
+ (subsym_get_arg, subsym_substitute): Use ISDIGIT instead of isdigit.
+ (tic54x_start_line_hook, md_assemble, tic54x_start_label): Use
+ ISSPACE instead of isspace.
+ * config/tc-tic80.c: Include "safe-ctype.h".
+ (md_assemble): Use ISSPACE instead of isspace.
+ * config/tc-v850.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (system_register_name): Use ISDIGIT instead of isdigit.
+ (md_assemble): Use ISSPACE instead of isspace.
+ * config/tc-vax.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (vax_reg_parse): Use TOLOWER/ISDIGIT instead of
+ isupper/tolower/isdigit.
+ (vip_op): Use TOLOWER instead of isupper/tolower.
+ * config/tc-w65.c: Don't include <ctype.h>.
+ * config/tc-z8k.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (tohex): Use ISDIGIT/ISLOWER instead of isdigit/islower.
+ (whatreg): Use ISDIGIT instead of isdigit.
+ * ecoff.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (ecoff_directive_ent, ecoff_stab): Use ISDIGIT instead of isdigit.
+ * expr.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (integer_constant): Use ISALNUM/TOUPPER instead of
+ isalnum/islower/toupper.
+ (operand): Use TOLOWER instead of isupper/tolower.
+ * gasp.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (sb_strtol, level_0, change_base, doinstr): Use ISDIGIT instead
+ of isdigit.
+ (process_assigns, whatcond): Use TOUPPER instead of toupper.
+ (chartype_init): Use ISALPHA/ISDIGIT instead of isalpha/isdigit.
+ (main): For gettext, also set the LC_CTYPE locate facet.
+ * hash.c: Include "safe-ctype.h".
+ (main): Use TOLOWER instead of isupper/tolower.
+ * itbl-lex.l: Don't include <ctype.h>.
+ * listing.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (listing_newline): Use ISCNTRL instead of isascii/iscntrl. Don't
+ omit non-ASCII characters.
+ (debugging_pseudo): Use ISSPACE instead of isspace.
+ * macro.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (buffer_and_nest): Use ISALNUM instead of isalnum.
+ (get_token): Use ISALPHA/ISALNUM instead of isalpha/isalnum.
+ (define_macro): Use ISUPPER/TOLOWER instead of isupper/tolower.
+ (macro_expand_body): Use ISALNUM/ISDIGIT/ISUPPER/ISALPHA
+ instead of isalnum/isdigit/isupper/isalpha.
+ (check_macro): Use ISALPHA/ISALNUM/ISUPPER/TOLOWER instead
+ of isalpha/isalnum/isupper/tolower.
+ * read.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (read_a_source_file): Use ISUPPER/TOLOWER/ISDIGIT instead of
+ isupper/tolower/isdigit.
+ (s_mri_common): Use ISDIGIT instead of isdigit.
+ (s_mri_sect): Use ISDIGIT/TOUPPER instead of isdigit/toupper.
+ (s_float_space): Use ISALPHA instead of isalpha.
+ (ignore_rest_of_line): Use ISPRINT instead of isprint.
+ (float_cons): Use ISALPHA instead of isalpha.
+ (next_char_of_string): Use ISDIGIT/ISXDIGIT instead of
+ isdigit/isxdigit.
+ * symbols.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (save_symbol_name): Use ISLOWER/TOUPPER instead of
+ islower/toupper.
+ (symbol_find_base): Use TOUPPER instead of islower/toupper.
+ (decode_local_label_name): Use ISDIGIT instead of isdigit.
+
2001-09-18 Martin Schwidefsky <schwidefsky@de.ibm.com>
* tc-s390.c (s390_insn): Add code to cope with 6 byte O_constants
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
+#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
/* System include files first... */
#include <stdio.h>
-#include <ctype.h>
#ifdef HAVE_STRING_H
#include <string.h>
#else
/* atof_generic.c - turn a string of digits into a Flonum
- Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000
+ Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
-#include <ctype.h>
#include <string.h>
#include "as.h"
+#include "safe-ctype.h"
#ifndef FALSE
#define FALSE (0)
&& (!c || !strchr (string_of_decimal_exponent_marks, c)));
p++)
{
- if (isdigit ((unsigned char) c))
+ if (ISDIGIT (c))
{
if (seen_significant_digit || c > '0')
{
{
unsigned int zeros = 0; /* Length of current string of zeros */
- for (p++; (c = *p) && isdigit ((unsigned char) c); p++)
+ for (p++; (c = *p) && ISDIGIT (c); p++)
{
if (c == '0')
{
&& (!c || !strchr (string_of_decimal_exponent_marks, c)));
p++)
{
- if (isdigit ((unsigned char) c))
+ if (ISDIGIT (c))
{
/* This may be retracted below. */
number_of_digits_after_decimal++;
for (; (c); c = *++p)
{
- if (isdigit ((unsigned char) c))
+ if (ISDIGIT (c))
{
decimal_exponent = decimal_exponent * 10 + c - '0';
/*
for (p = first_digit, count = number_of_digits_to_use; count; p++, --count)
{
c = *p;
- if (isdigit ((unsigned char) c))
+ if (ISDIGIT (c))
{
/*
* Multiply by 10. Assume can never overflow.
/* m68k.y -- bison grammar for m68k operand parsing
- Copyright 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+ Copyright 1995, 1996, 1997, 1998, 2001 Free Software Foundation, Inc.
Written by Ken Raeburn and Ian Lance Taylor, Cygnus Support
This file is part of GAS, the GNU Assembler.
#include "as.h"
#include "tc-m68k.h"
#include "m68k-parse.h"
+#include "safe-ctype.h"
/* Remap normal yacc parser interface names (yyparse, yylex, yyerror,
etc), as well as gratuitiously global symbol names If other parser
/* In MRI mode, this can be the start of an octal number. */
if (flag_mri)
{
- if (isdigit (str[1])
+ if (ISDIGIT (str[1])
|| ((str[1] == '+' || str[1] == '-')
- && isdigit (str[2])))
+ && ISDIGIT (str[2])))
break;
}
/* Fall through. */
{
if (parens == 0
&& s > str
- && (s[-1] == ')' || isalnum ((unsigned char) s[-1])))
+ && (s[-1] == ')' || ISALNUM (s[-1])))
break;
++parens;
}
#define OBJ_HEADER "obj-elf.h"
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "obstack.h"
if (input_line_pointer[0] == '0'
&& (input_line_pointer[1] == '\0'
- || isspace ((unsigned char) input_line_pointer[1])))
+ || ISSPACE (input_line_pointer[1])))
{
psym = section_symbol (absolute_section);
++input_line_pointer;
#include "as.h"
#include "config.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "obstack.h"
cp++;
continue;
}
- *cp1++ = islower (*cp) ? toupper (*cp++) : *cp++;
+ *cp1++ = TOUPPER (*cp++);
}
*cp1 = '\0';
switch (vms_name_mapping)
{
case 0:
- if (isupper (*In)) {
+ if (ISUPPER (*In)) {
*Out++ = *In++;
Case_Hack_Bits |= 1;
} else {
- *Out++ = islower (*In) ? toupper (*In++) : *In++;
+ *Out++ = TOUPPER (*In++);
}
break;
case 3: *Out++ = *In++;
break;
case 2:
- if (islower (*In)) {
+ if (ISLOWER (*In)) {
*Out++ = *In++;
} else {
- *Out++ = isupper (*In) ? tolower (*In++) : *In++;
+ *Out++ = TOLOWER (*In++);
}
break;
}
* and ensure that they are lowercase
*/
for (i = 0; (In[i] != 0) && (i < 8); i++)
- if (isupper (In[i]) && !Saw_Dollar && !flag_no_hash_mixed_case)
+ if (ISUPPER (In[i]) && !Saw_Dollar && !flag_no_hash_mixed_case)
break;
if (In[i] == 0)
i = 8;
while ((--i >= 0) && (*In))
switch (vms_name_mapping){
- case 0: *Out++ = islower (*In) ? toupper (*In++) : *In++;
+ case 0: *Out++ = TOUPPER (*In++);
break;
case 3: *Out++ = *In++;
break;
- case 2: *Out++ = isupper (*In) ? tolower (*In++) : *In++;
+ case 2: *Out++ = TOLOWER (*In++);
break;
}
}
/* tc-a29k.c -- Assemble for the AMD 29000.
- Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1998, 2000
+ Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1998, 2000, 2001
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
to convert it to new machines' assemblers as desired. There was too
much bloody rewriting required before. There still probably is. */
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "opcode/a29k.h"
symbol_table_insert (symbol_new (regname, SEG_REGISTER, (valueT) regnum,
&zero_address_frag));
for (i = 0; regname[i]; i++)
- buf[i] = islower (regname[i]) ? toupper (regname[i]) : regname[i];
+ buf[i] = TOUPPER (regname[i]);
buf[i] = '\0';
symbol_table_insert (symbol_new (buf, SEG_REGISTER, (valueT) regnum,
/* Must handle `div0' opcode. */
s = str;
- if (isalpha (*s))
- for (; isalnum (*s); ++s)
- if (isupper (*s))
- *s = tolower (*s);
+ if (ISALPHA (*s))
+ for (; ISALNUM (*s); ++s)
+ *s = TOLOWER (*s);
switch (*s)
{
char *s;
if (c != '$'
- || ! isdigit ((unsigned char) input_line_pointer[0]))
+ || ! ISDIGIT (input_line_pointer[0]))
return 0;
s = input_line_pointer;
lab = 0;
- while (isdigit ((unsigned char) *s))
+ while (ISDIGIT (*s))
{
lab = lab * 10 + *s - '0';
++s;
expressionP->X_op = O_constant;
}
else if (input_line_pointer[0] == '$'
- && isdigit ((unsigned char) input_line_pointer[1]))
+ && ISDIGIT (input_line_pointer[1]))
{
long lab;
char *name;
return;
}
- if (isdigit (*s))
+ if (ISDIGIT (*s))
{
fieldnum = *s - '0';
++s;
#include "dwarf2dbg.h"
#endif
-#include <ctype.h>
+#include "safe-ctype.h"
\f
/* Local types */
/* FALLTHRU */
case 'r':
- if (!isdigit (*++name))
+ if (!ISDIGIT (*++name))
break;
/* FALLTHRU */
case '5': case '6': case '7': case '8': case '9':
if (name[1] == '\0')
num = name[0] - '0';
- else if (name[0] != '0' && isdigit (name[1]) && name[2] == '\0')
+ else if (name[0] != '0' && ISDIGIT (name[1]) && name[2] == '\0')
{
num = (name[0] - '0') * 10 + name[1] - '0';
if (num >= 32)
input_line_pointer++;
SKIP_WHITESPACE ();
}
- if (isdigit (*input_line_pointer) || *input_line_pointer == '-')
+ if (ISDIGIT (*input_line_pointer) || *input_line_pointer == '-')
(void) get_absolute_expression ();
}
demand_empty_rest_of_line ();
02111-1307, USA. */
#include <stdio.h>
-#include <ctype.h>
#include "libiberty.h"
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "opcode/arc.h"
#include "../opcodes/arc-ext.h"
}
/* Skip leading white space. */
- while (isspace (*str))
+ while (ISSPACE (*str))
str++;
/* The instructions are stored in lists hashed by the first letter (though
}
/* Pick the suffix out and look it up via the hash table. */
- for (t = s; *t && isalnum (*t); ++t)
+ for (t = s; *t && ISALNUM (*t); ++t)
continue;
c = *t;
*t = '\0';
insn and it is assumed that longer versions of insns appear
before shorter ones (eg: lsr r2,r3,1 vs lsr r2,r3). */
- while (isspace (*str))
+ while (ISSPACE (*str))
++str;
if (!is_end_of_line[(unsigned char) *str])
p = name;
while (*p)
{
- if (isupper (*p))
- *p = tolower (*p);
+ *p = TOLOWER (*p);
p++;
}
while (ext_oper)
{
l = strlen (ext_oper->operand.name);
- if (!strncmp (p, ext_oper->operand.name, l) && !isalnum (*(p + l)))
+ if (!strncmp (p, ext_oper->operand.name, l) && !ISALNUM (*(p + l)))
{
input_line_pointer += l + 1;
expressionP->X_op = O_register;
for (i = 0; i < arc_reg_names_count; i++)
{
l = strlen (arc_reg_names[i].name);
- if (!strncmp (p, arc_reg_names[i].name, l) && !isalnum (*(p + l)))
+ if (!strncmp (p, arc_reg_names[i].name, l) && !ISALNUM (*(p + l)))
{
input_line_pointer += l + 1;
expressionP->X_op = O_register;
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
-#include <ctype.h>
#include <string.h>
#define NO_RELOC 0
#include "as.h"
+#include "safe-ctype.h"
/* Need TARGET_CPU. */
#include "config.h"
{
c = *p++;
}
- while (isalpha (c) || c == '_');
+ while (ISALPHA (c) || c == '_');
/* Terminate the word. */
*--p = 0;
*str = p; /* Advance caller's string pointer too. */
c = *p++;
- while (isalnum (c))
+ while (ISALNUM (c))
c = *p++;
*--p = 0; /* Aap nul into input buffer at non-alnum. */
static char buff[128];
--str;
- while (isspace (*str))
+ while (ISSPACE (*str))
--str;
str -= 4;
skip_whitespace (* str);
- for (p = * str; isalpha (* p); p ++)
+ for (p = * str; ISALPHA (* p); p ++)
;
if (p == * str)
strcpy (buf + i, reg_table[entry].name);
for (i = 0; buf[i]; i++)
- buf2[i] = islower (buf[i]) ? toupper (buf[i]) : buf[i];
+ buf2[i] = TOUPPER (buf[i]);
buf2[i] = '\0';
p++, start++;
#endif
#endif
- if (!isalpha (*p) || !is_name_beginner (*p))
+ if (!ISALPHA (*p) || !is_name_beginner (*p))
return FAIL;
c = *p++;
- while (isalpha (c) || isdigit (c) || c == '_')
+ while (ISALPHA (c) || ISDIGIT (c) || c == '_')
c = *p++;
*--p = 0;
};
for (i = 0, ip = input_line_pointer;
- i < sizeof (id) && (isalnum (*ip) || ispunct (*ip));
+ i < sizeof (id) && (ISALNUM (*ip) || ISPUNCT (*ip));
i++, ip++)
- id[i] = tolower (*ip);
+ id[i] = TOLOWER (*ip);
for (i = 0; reloc_map[i].str; i++)
if (strncmp (id, reloc_map[i].str, reloc_map[i].len) == 0)
/* tc-avr.c -- Assembler code for the ATMEL AVR
- Copyright 1999, 2000 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
Contributed by Denis Chertykov <denisc@overta.ru>
This file is part of GAS, the GNU Assembler.
Boston, MA 02111-1307, USA. */
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
struct avr_opcodes_s
char *arg1 = arg;
do
- *t = tolower (*arg1++);
+ *t = TOLOWER (*arg1++);
while (*t++);
}
str = extract_word (str, r_name, sizeof (r_name));
op_mask = 0xff;
- if (isdigit (r_name[1]))
+ if (ISDIGIT (r_name[1]))
{
if (r_name[2] == '\0')
op_mask = r_name[1] - '0';
else if (r_name[1] != '0'
- && isdigit (r_name[2])
+ && ISDIGIT (r_name[2])
&& r_name[3] == '\0')
op_mask = (r_name[1] - '0') * 10 + r_name[2] - '0';
}
str = skip_space (str + 1);
op_mask = 0x1002;
}
- c = tolower (*str);
+ c = TOLOWER (*str);
if (c == 'x')
op_mask |= 0x100c;
else if (c == 'y')
case 'b':
{
- char c = tolower (*str++);
+ char c = TOLOWER (*str++);
if (c == 'y')
op_mask |= 0x8;
MA 02111-1307, USA. */
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "opcode/cris.h"
#include "dwarf2dbg.h"
/* Find the end of the opcode mnemonic. We assume (true in 2.9.1)
that the caller has translated the opcode to lower-case, up to the
first non-letter. */
- for (operands = insn_text; islower (*operands); ++operands)
+ for (operands = insn_text; ISLOWER (*operands); ++operands)
;
/* Terminate the opcode after letters, but save the character there if
(*cPP)++;
if ((**cPP == 'C' || **cPP == 'c')
- && ! isalnum ((*cPP)[1]))
+ && ! ISALNUM ((*cPP)[1]))
{
/* It's "PC": consume the "c" and we're done. */
(*cPP)++;
/* Hopefully r[0-9] or r1[0-5]. Consume 'R' or 'r'. */
(*cPP)++;
- if (isdigit (**cPP))
+ if (ISDIGIT (**cPP))
{
/* It's r[0-9]. Consume and check the next digit. */
*regnop = **cPP - '0';
(*cPP)++;
- if (! isalnum (**cPP))
+ if (! ISALNUM (**cPP))
{
/* No more digits, we're done. */
return 1;
s1 = name_begin;
s2 = sregp->name;
- while (*s2 != '\0'
- && (isupper (*s1) ? tolower (*s1) == *s2 : *s1 == *s2))
+ while (*s2 != '\0' && TOLOWER (*s1) == *s2)
{
s1++;
s2++;
/* For a match, we must have consumed the name in the table, and we
must be outside what could be part of a name. Assume here that a
test for alphanumerics is sufficient for a name test. */
- if (*s2 == 0 && ! isalnum (*s1))
+ if (*s2 == 0 && ! ISALNUM (*s1))
{
/* We have a match. Update the pointer and be done. */
*cPP = s1;
whitespace. Anything else, and we consider it a failure. */
if (**cPP != ','
&& **cPP != 0
- && ! isspace (**cPP))
+ && ! ISSPACE (**cPP))
return 0;
else
return 1;
Boston, MA 02111-1307, USA. */
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "opcode/d10v.h"
#include "elf/ppc.h"
&& !is_end_of_line[*op_end] && *op_end != ' ';
op_end++)
{
- name[nlen] = tolower (op_start[nlen]);
+ name[nlen] = TOLOWER (op_start[nlen]);
nlen++;
}
name[nlen] = 0;
/* tc-d30v.c -- Assembler code for the Mitsubishi D30V
- Copyright 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
Boston, MA 02111-1307, USA. */
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "opcode/d30v.h"
&& !is_end_of_line[*op_end] && *op_end != ' ';
op_end++)
{
- name[nlen] = tolower (op_start[nlen]);
+ name[nlen] = TOLOWER (op_start[nlen]);
nlen++;
}
{
char *c = input_line_pointer;
- while (isspace (*c))
+ while (ISSPACE (*c))
c++;
if (*c == '.')
Boston, MA 02111-1307, USA. */
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "symcat.h"
#include "opcodes/fr30-desc.h"
continue;
while (len --)
- if (tolower (start [len]) != insn [len])
+ if (TOLOWER (start [len]) != insn [len])
break;
if (len == -1)
#define DEFINE_TABLE
#define h8_opcodes ops
#include "opcode/h8300.h"
-#include <ctype.h>
+#include "safe-ctype.h"
#ifdef OBJ_ELF
#include "elf/h8.h"
{
*mode |= L_16;
}
- while (isdigit (*ptr))
+ while (ISDIGIT (*ptr))
ptr++;
}
}
/* Gross. Gross. ldm and stm have a format not easily handled
by get_operand. We deal with it explicitly here. */
- if (src[0] == 'e' && src[1] == 'r' && isdigit (src[2])
- && src[3] == '-' && src[4] == 'e' && src[5] == 'r' && isdigit (src[6]))
+ if (src[0] == 'e' && src[1] == 'r' && ISDIGIT (src[2])
+ && src[3] == '-' && src[4] == 'e' && src[5] == 'r' && ISDIGIT (src[6]))
{
int low, high;
#define DEFINE_TABLE
#define ASSEMBLER_TABLE
#include "opcodes/h8500-opc.h"
-#include <ctype.h>
+#include "safe-ctype.h"
const char comment_chars[] = "!";
const char line_separator_chars[] = ";";
char *ptr;
{
/* Check for :s.w */
- if (isalpha (ptr[1]) && ptr[2] == '.')
+ if (ISALPHA (ptr[1]) && ptr[2] == '.')
return 0;
/* Check for :s */
- if (isalpha (ptr[1]) && !isalpha (ptr[2]))
+ if (ISALPHA (ptr[1]) && !ISALPHA (ptr[2]))
return 0;
return 1;
}
at the University of Utah. */
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "bfd/libhppa.h"
/* Convert everything up to the first whitespace character into lower
case. */
for (s = str; *s != ' ' && *s != '\t' && *s != '\n' && *s != '\0'; s++)
- if (isupper (*s))
- *s = tolower (*s);
+ *s = TOLOWER (*s);
/* Skip to something interesting. */
- for (s = str; isupper (*s) || islower (*s) || (*s >= '0' && *s <= '3'); ++s)
+ for (s = str;
+ ISUPPER (*s) || ISLOWER (*s) || (*s >= '0' && *s <= '3');
+ ++s)
;
switch (*s)
pa_number = -1;
have_prefix = 0;
num = 0;
- if (!strict && isdigit (*p))
+ if (!strict && ISDIGIT (*p))
{
/* Looks like a number. */
{
/* The number is specified in hex. */
p += 2;
- while (isdigit (*p) || ((*p >= 'a') && (*p <= 'f'))
+ while (ISDIGIT (*p) || ((*p >= 'a') && (*p <= 'f'))
|| ((*p >= 'A') && (*p <= 'F')))
{
- if (isdigit (*p))
+ if (ISDIGIT (*p))
num = num * 16 + *p - '0';
else if (*p >= 'a' && *p <= 'f')
num = num * 16 + *p - 'a' + 10;
else
{
/* The number is specified in decimal. */
- while (isdigit (*p))
+ while (ISDIGIT (*p))
{
num = num * 10 + *p - '0';
++p;
num = 2;
p++;
}
- else if (!isdigit (*p))
+ else if (!ISDIGIT (*p))
{
if (print_errors)
as_bad (_("Undefined register: '%s'."), name);
{
do
num = num * 10 + *p++ - '0';
- while (isdigit (*p));
+ while (ISDIGIT (*p));
}
}
else
*str = *str + 1;
if ((*str)[1] == '\'' || (*str)[1] == '%')
- name[0] = tolower ((*str)[0]),
+ name[0] = TOLOWER ((*str)[0]),
name[1] = 0;
else if ((*str)[2] == '\'' || (*str)[2] == '%')
- name[0] = tolower ((*str)[0]),
- name[1] = tolower ((*str)[1]),
+ name[0] = TOLOWER ((*str)[0]),
+ name[1] = TOLOWER ((*str)[1]),
name[2] = 0;
else if ((*str)[3] == '\'' || (*str)[3] == '%')
- name[0] = tolower ((*str)[0]),
- name[1] = tolower ((*str)[1]),
- name[2] = tolower ((*str)[2]),
+ name[0] = TOLOWER ((*str)[0]),
+ name[1] = TOLOWER ((*str)[1]),
+ name[2] = TOLOWER ((*str)[2]),
name[3] = 0;
else
return e_fsel;
s++;
for (num_digit = 0, number = 0, dg = *s;
num_digit < 2
- && (isdigit (dg) || (dg >= 'a' && dg <= 'f')
+ && (ISDIGIT (dg) || (dg >= 'a' && dg <= 'f')
|| (dg >= 'A' && dg <= 'F'));
num_digit++)
{
- if (isdigit (dg))
+ if (ISDIGIT (dg))
number = number * 16 + dg - '0';
else if (dg >= 'a' && dg <= 'f')
number = number * 16 + dg - 'a' + 10;
*/
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
+#include "c=ctype.h"
#include "subsegs.h"
#include "struc-symbol.h"
/* Find the spelling of the operand. */
start = name = input_line_pointer;
- if (name[0] == '%' && isalpha (name[1]))
+ if (name[0] == '%' && ISALPHA (name[1]))
name = ++input_line_pointer;
else if (!reg_names_p)
/* If it's a number, treat it as a number. If it's alpha, look to
see if it's in the register table. */
- if (!isalpha (name[0]))
+ if (!ISALPHA (name[0]))
{
reg_number = get_single_number ();
}
for (ch = *str, str2 = ident;
(str2 < ident + sizeof (ident) - 1
- && (isalnum (ch) || ch == '@'));
+ && (ISALNUM (ch) || ch == '@'));
ch = *++str)
{
- *str2++ = (islower (ch)) ? ch : tolower (ch);
+ *str2++ = TOLOWER (ch);
}
*str2 = '\0';
lab = input_line_pointer;
while (*lab && (',' != *lab) && ('(' != *lab))
{
- if (isdigit (*lab))
+ if (ISDIGIT (*lab))
{
all_digits = 1;
}
- else if (isalpha (*lab))
+ else if (ISALPHA (*lab))
{
if (!all_digits)
{
name = input_line_pointer;
sym_name = input_line_pointer;
/* Find the spelling of the operand */
- if (name[0] == '=' && isalpha (name[1]))
+ if (name[0] == '=' && ISALPHA (name[1]))
{
name = ++input_line_pointer;
}
save = input_line_pointer;
while (*save)
{
- if (isxdigit (*save))
+ if (ISXDIGIT (*save))
hex_len++;
save++;
}
#endif
/* Get the opcode. */
- for (s = str; *s != '\0' && ! isspace (*s); s++)
+ for (s = str; *s != '\0' && ! ISSPACE (*s); s++)
;
if (*s != '\0')
*s++ = '\0';
insn = opcode->opcode;
str = s;
- while (isspace (*str))
+ while (ISSPACE (*str))
++str;
/* I370 operands are either expressions or address constants.
++str;
}
- while (isspace (*str))
+ while (ISSPACE (*str))
++str;
if (*str != '\0')
Bugs & suggestions are completely welcome. This is free software.
Please help us make it better. */
-#include <ctype.h>
-
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "dwarf2dbg.h"
#include "opcode/i386.h"
for (c = 0; c < 256; c++)
{
- if (isdigit (c))
+ if (ISDIGIT (c))
{
digit_chars[c] = c;
mnemonic_chars[c] = c;
register_chars[c] = c;
operand_chars[c] = c;
}
- else if (islower (c))
+ else if (ISLOWER (c))
{
mnemonic_chars[c] = c;
register_chars[c] = c;
operand_chars[c] = c;
}
- else if (isupper (c))
+ else if (ISUPPER (c))
{
- mnemonic_chars[c] = tolower (c);
+ mnemonic_chars[c] = TOLOWER (c);
register_chars[c] = mnemonic_chars[c];
operand_chars[c] = c;
}
- if (isalpha (c) || isdigit (c))
+ if (ISALPHA (c) || ISDIGIT (c))
identifier_chars[c] = c;
else if (c >= 128)
{
output_invalid (c)
int c;
{
- if (isprint (c))
+ if (ISPRINT (c))
sprintf (output_invalid_buf, "'%c'", c);
else
sprintf (output_invalid_buf, "(0x%x)", (unsigned) c);
/* tc-i860.c -- Assembler for the Intel i860 architecture.
- Copyright 1989, 1992, 1993, 1994, 1995, 1998, 1999, 2000
+ Copyright 1989, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
Brought back from the dead and completely reworked
with GAS; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "opcode/i860.h"
#include "elf/i860.h"
opcode = 0;
#endif
- for (s = str; islower (*s) || *s == '.' || *s == '3'
+ for (s = str; ISLOWER (*s) || *s == '.' || *s == '3'
|| *s == '2' || *s == '1'; ++s)
;
/* Must be at least one digit. */
case '#':
- if (isdigit (*s++))
+ if (ISDIGIT (*s++))
{
- while (isdigit (*s))
+ while (ISDIGIT (*s))
++s;
continue;
}
/* Any register r0..r31. */
case 'r':
s++;
- if (!isdigit (c = *s++))
+ if (!ISDIGIT (c = *s++))
{
goto error;
}
- if (isdigit (*s))
+ if (ISDIGIT (*s))
{
if ((c = 10 * (c - '0') + (*s++ - '0')) >= 32)
goto error;
else
s++;
- if (*s++ == 'f' && isdigit (*s))
+ if (*s++ == 'f' && ISDIGIT (*s))
{
mask = *s++;
- if (isdigit (*s))
+ if (ISDIGIT (*s))
{
mask = 10 * (mask - '0') + (*s++ - '0');
if (mask >= 32)
a relocation directive. */
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "obstack.h"
#include "opcode/i960.h"
{
if (*p == ' '
- && (! isalnum ((unsigned char) p[1])
- || ! isalnum ((unsigned char) p[-1])))
+ && (! ISALNUM (p[1])
+ || ! ISALNUM (p[-1])))
{
p++;
*/
#include "as.h"
+#include "safe-ctype.h"
#include "dwarf2dbg.h"
#include "subsegs.h"
valueT bit = 1;
int regno;
- if (toupper (*input_line_pointer) != 'P'
+ if (TOUPPER (*input_line_pointer) != 'P'
|| (regno = atoi (++input_line_pointer)) < 0
|| regno > 63)
{
ignore_rest_of_line ();
return;
}
- while (isdigit (*input_line_pointer))
+ while (ISDIGIT (*input_line_pointer))
++input_line_pointer;
if (p1 == -1)
p1 = regno;
valueT stop = 1;
++input_line_pointer;
- if (toupper (*input_line_pointer) != 'P'
+ if (TOUPPER (*input_line_pointer) != 'P'
|| (regno = atoi (++input_line_pointer)) < 0
|| regno > 63)
{
ignore_rest_of_line ();
return;
}
- while (isdigit (*input_line_pointer))
+ while (ISDIGIT (*input_line_pointer))
++input_line_pointer;
stop <<= regno;
if (bit >= stop)
c = get_symbol_end ();
}
else if (LOCAL_LABELS_FB
- && isdigit ((unsigned char) *input_line_pointer))
+ && ISDIGIT (*input_line_pointer))
{
temp = 0;
- while (isdigit ((unsigned char) *input_line_pointer))
+ while (ISDIGIT (*input_line_pointer))
temp = (temp * 10) + *input_line_pointer++ - '0';
fb_label_instance_inc (temp);
s = fb_label_name (temp, 0);
switch (name[0])
{
case 'i':
- if (name[1] == 'n' && isdigit (name[2]))
+ if (name[1] == 'n' && ISDIGIT (name[2]))
{
dr = &md.in;
name += 2;
break;
case 'l':
- if (name[1] == 'o' && name[2] == 'c' && isdigit (name[3]))
+ if (name[1] == 'o' && name[2] == 'c' && ISDIGIT (name[3]))
{
dr = &md.loc;
name += 3;
break;
case 'o':
- if (name[1] == 'u' && name[2] == 't' && isdigit (name[3]))
+ if (name[1] == 'u' && name[2] == 't' && ISDIGIT (name[3]))
{
dr = &md.out;
name += 3;
Boston, MA 02111-1307, USA. */
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "symcat.h"
#include "opcodes/m32r-desc.h"
{
char *s2 = str;
- while (isspace (*s2++))
+ while (ISSPACE (*s2++))
continue;
--s2;
- while (isalnum (*s2))
+ while (ISALNUM (*s2))
{
- if (isupper ((unsigned char) *s2))
- *s2 = tolower (*s2);
+ *s2 = TOLOWER (*s2);
s2++;
}
}
Boston, MA 02111-1307, USA. */
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "opcode/m68hc11.h"
#include "dwarf2dbg.h"
*op_end && nlen < 20 && !is_end_of_line[*op_end] && *op_end != ' ';
op_end++)
{
- name[nlen] = tolower (op_start[nlen]);
+ name[nlen] = TOLOWER (op_start[nlen]);
nlen++;
}
name[nlen] = 0;
&& (*op_end &&
(is_end_of_line[op_end[1]]
|| op_end[1] == ' ' || op_end[1] == '\t'
- || !isalnum (op_end[1])))
+ || !ISALNUM (op_end[1])))
&& (*op_end == 'a' || *op_end == 'b'
|| *op_end == 'A' || *op_end == 'B'
|| *op_end == 'd' || *op_end == 'D'
|| *op_end == 'x' || *op_end == 'X'
|| *op_end == 'y' || *op_end == 'Y'))
{
- name[nlen++] = tolower (*op_end++);
+ name[nlen++] = TOLOWER (*op_end++);
name[nlen] = 0;
opc = (struct m68hc11_opcode_def *) hash_find (m68hc11_hash,
name);
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "obstack.h"
#include "subsegs.h"
#include "dwarf2dbg.h"
extern char *input_line_pointer;
-static char mklower_table[256];
-#define mklower(c) (mklower_table[(unsigned char) (c)])
static char notend_table[256];
static char alt_notend_table[256];
#define notend(s) \
&zero_address_frag));
for (i = 0; regname[i]; i++)
- buf[i] = islower (regname[i]) ? toupper (regname[i]) : regname[i];
+ buf[i] = TOUPPER (regname[i]);
buf[i] = '\0';
symbol_table_insert (symbol_new (buf, reg_section, regnum,
}
}
- for (i = 0; i < (int) sizeof (mklower_table); i++)
- mklower_table[i] = (isupper (c = (char) i)) ? tolower (c) : c;
-
for (i = 0; i < (int) sizeof (notend_table); i++)
{
notend_table[i] = 0;
SKIP_WHITESPACE ();
s = input_line_pointer;
- while (isalnum ((unsigned char) *input_line_pointer)
+ while (ISALNUM (*input_line_pointer)
#ifdef REGISTER_PREFIX
|| *input_line_pointer == REGISTER_PREFIX
#endif
/* md_assemble expects the opcode to be in lower case. */
for (s = str; *s != ' ' && *s != '\0'; s++)
- {
- if (isupper ((unsigned char) *s))
- *s = tolower ((unsigned char) *s);
- }
+ *s = TOLOWER (*s);
md_assemble (str);
}
++input_line_pointer;
SKIP_WHITESPACE ();
- if (isupper (c1))
- c1 = tolower (c1);
- if (isupper (c2))
- c2 = tolower (c2);
+ c1 = TOLOWER (c1);
+ c2 = TOLOWER (c2);
*pcc = (c1 << 8) | c2;
*s++ = 'm';
*s++ = 'p';
if (qual != '\0')
- *s++ = tolower (qual);
+ *s++ = TOLOWER (qual);
*s++ = ' ';
memcpy (s, leftstart, leftstop - leftstart);
s += leftstop - leftstart;
*s++ = cc >> 8;
*s++ = cc & 0xff;
if (extent != '\0')
- *s++ = tolower (extent);
+ *s++ = TOLOWER (extent);
*s++ = ' ';
strcpy (s, truelab);
mri_assemble (buf);
mri_control_stack->else_seen = 1;
buf = (char *) xmalloc (20 + strlen (mri_control_stack->bottom));
- q[0] = tolower (qual);
+ q[0] = TOLOWER (qual);
q[1] = '\0';
sprintf (buf, "bra%s %s", q, mri_control_stack->bottom);
mri_assemble (buf);
}
buf = (char *) xmalloc (20 + strlen (n->bottom));
- ex[0] = tolower (extent);
+ ex[0] = TOLOWER (extent);
ex[1] = '\0';
sprintf (buf, "bra%s %s", ex, n->bottom);
mri_assemble (buf);
}
buf = (char *) xmalloc (20 + strlen (n->next));
- ex[0] = tolower (extent);
+ ex[0] = TOLOWER (extent);
ex[1] = '\0';
sprintf (buf, "bra%s %s", ex, n->next);
mri_assemble (buf);
*s++ = 'v';
*s++ = 'e';
if (qual != '\0')
- *s++ = tolower (qual);
+ *s++ = TOLOWER (qual);
*s++ = ' ';
memcpy (s, initstart, initstop - initstart);
s += initstop - initstart;
*s++ = 'm';
*s++ = 'p';
if (qual != '\0')
- *s++ = tolower (qual);
+ *s++ = TOLOWER (qual);
*s++ = ' ';
memcpy (s, endstart, endstop - endstart);
s += endstop - endstart;
mri_assemble (buf);
/* bcc bottom */
- ex[0] = tolower (extent);
+ ex[0] = TOLOWER (extent);
ex[1] = '\0';
if (up)
sprintf (buf, "blt%s %s", ex, n->bottom);
strcpy (s, "sub");
s += 3;
if (qual != '\0')
- *s++ = tolower (qual);
+ *s++ = TOLOWER (qual);
*s++ = ' ';
memcpy (s, bystart, bystop - bystart);
s += bystop - bystart;
Contributed by Devon Bowen of Buffalo University
and Torbjorn Granlund of the Swedish Institute of Computer Science.
Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1999,
- 2000
+ 2000, 2001
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "m88k-opcode.h"
assert (op);
/* Skip over instruction to find parameters. */
- for (param = op; *param != 0 && !isspace (*param); param++)
+ for (param = op; *param != 0 && !ISSPACE (*param); param++)
;
c = *param;
*param++ = '\0';
unsigned int val;
char *save_ptr;
- if (!strncmp (param, "hi16", 4) && !isalnum (param[4]))
+ if (!strncmp (param, "hi16", 4) && !ISALNUM (param[4]))
{
reloc = RELOC_HI16;
param += 4;
}
- else if (!strncmp (param, "lo16", 4) && !isalnum (param[4]))
+ else if (!strncmp (param, "lo16", 4) && !ISALNUM (param[4]))
{
reloc = RELOC_LO16;
param += 4;
}
- else if (!strncmp (param, "iw16", 4) && !isalnum (param[4]))
+ else if (!strncmp (param, "iw16", 4) && !ISALNUM (param[4]))
{
reloc = RELOC_IW16;
param += 4;
{
unsigned int val;
- if (isdigit (*param))
+ if (ISDIGIT (*param))
{
param = getval (param, &val);
}
else
{
- if (isupper (*param))
- *param = tolower (*param);
-
- if (isupper (param[1]))
- param[1] = tolower (param[1]);
+ param[0] = TOLOWER (param[0]);
+ param[1] = TOLOWER (param[1]);
param = match_name (param, cndmsk, valp);
{
unsigned offset;
- if (isalpha (param[0]))
+ if (ISALPHA (param[0]))
{
- if (isupper (param[0]))
- param[0] = tolower (param[0]);
- if (isupper (param[1]))
- param[1] = tolower (param[1]);
+ param[0] = TOLOWER (param[0]);
+ param[1] = TOLOWER (param[1]);
param = match_name (param, cmpslot, offsetp);
}
#define hexval(z) \
- (isdigit (z) ? (z) - '0' : \
- islower (z) ? (z) - 'a' + 10 : \
- isupper (z) ? (z) - 'A' + 10 : -1)
+ (ISDIGIT (z) ? (z) - '0' : \
+ ISLOWER (z) ? (z) - 'a' + 10 : \
+ ISUPPER (z) ? (z) - 'A' + 10 : -1)
static char *
getval (param, valp)
#include "subsegs.h"
#define DEFINE_TABLE
#include "../opcodes/mcore-opc.h"
-#include <ctype.h>
+#include "safe-ctype.h"
#include <string.h>
#ifdef OBJ_ELF
pool. */
char * ilp = input_line_pointer;
- while (*ilp != 0 && isspace(*ilp))
+ while (*ilp != 0 && ISSPACE (*ilp))
++ ilp;
if (strncmp (ilp, ".line", 5) == 0
- && (isspace (ilp[5]) || *ilp == '\n' || *ilp == '\r'))
+ && (ISSPACE (ilp[5]) || *ilp == '\n' || *ilp == '\r'))
;
else
dump_literals (0);
unsigned * reg;
{
/* Strip leading whitespace. */
- while (isspace (* s))
+ while (ISSPACE (* s))
++ s;
- if (tolower (s[0]) == 'r')
+ if (TOLOWER (s[0]) == 'r')
{
if (s[1] == '1' && s[2] >= '0' && s[2] <= '5')
{
return s + 2;
}
}
- else if ( tolower (s[0]) == 's'
- && tolower (s[1]) == 'p'
- && ! isalnum (s[2]))
+ else if ( TOLOWER (s[0]) == 's'
+ && TOLOWER (s[1]) == 'p'
+ && ! ISALNUM (s[2]))
{
* reg = 0;
return s + 2;
int i;
/* Strip leading whitespace. */
- while (isspace (* s))
+ while (ISSPACE (* s))
++s;
- if ((tolower (s[0]) == 'c' && tolower (s[1]) == 'r'))
+ if ((TOLOWER (s[0]) == 'c' && TOLOWER (s[1]) == 'r'))
{
if (s[2] == '3' && s[3] >= '0' && s[3] <= '1')
{
length = strlen (cregs[i].name);
for (j = 0; j < length; j++)
- buf[j] = tolower (s[j]);
+ buf[j] = TOLOWER (s[j]);
if (strncmp (cregs[i].name, buf, length) == 0)
{
};
for (i = 0; i < 2; i++)
- buf[i] = isascii (s[i]) ? tolower (s[i]) : 0;
+ buf[i] = TOLOWER (s[i]);
for (i = sizeof (psrmods) / sizeof (psrmods[0]); i--;)
{
char * new;
/* Skip whitespace. */
- while (isspace (* s))
+ while (ISSPACE (* s))
++ s;
save = input_line_pointer;
* off = 0;
- while (isspace (* s))
+ while (ISSPACE (* s))
++ s;
if (* s == '(')
{
s = parse_reg (s + 1, reg);
- while (isspace (* s))
+ while (ISSPACE (* s))
++ s;
if (* s == ',')
}
}
- while (isspace (* s))
+ while (ISSPACE (* s))
++ s;
if (* s == ')')
char name[20];
/* Drop leading whitespace. */
- while (isspace (* str))
+ while (ISSPACE (* str))
str ++;
/* Find the op code end. */
inst |= reg;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (*op_end == ',')
inst |= reg;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
op_end = parse_reg (op_end + 1, & reg);
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',') /* xtrb- r1,rx */
inst |= reg;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
inst |= reg;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
inst |= reg;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
inst |= reg;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
inst |= reg;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
inst |= reg;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
inst |= reg;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
inst |= reg;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
inst |= reg;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
inst |= reg << 8;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
inst |= (reg << 8);
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
inst |= reg;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == '-')
as_bad (_("ending register must be r15"));
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
}
op_end ++;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == '(')
as_fatal (_("first register must be r4"));
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == '-')
as_fatal (_("last register must be r7"));
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
op_end ++;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == '(')
inst |= reg;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ')')
inst |= reg << 4;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
inst |= reg;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
inst |= reg << 4;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
inst |= reg;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
}
/* Drop whitespace after all the operands have been parsed. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
op_end ++;
/* Give warning message if the insn has more operands than required. */
#include "as.h"
#include "config.h"
#include "subsegs.h"
-
-#include <ctype.h>
+#include "safe-ctype.h"
#ifdef USE_STDARG
#include <stdarg.h>
/* If the instruction contains a '.', we first try to match an instruction
including the '.'. Then we try again without the '.'. */
insn = NULL;
- for (s = str; *s != '\0' && !isspace ((unsigned char) *s); ++s)
+ for (s = str; *s != '\0' && !ISSPACE (*s); ++s)
continue;
/* If we stopped on whitespace, then replace the whitespace with null for
the call to hash_find. Save the character we replaced just in case we
have to re-parse the instruction. */
- if (isspace ((unsigned char) *s))
+ if (ISSPACE (*s))
{
save_c = *s;
*s++ = '\0';
*(--s) = save_c;
/* Scan up to the first '.' or whitespace. */
- for (s = str; *s != '\0' && *s != '.' && !isspace ((unsigned char) *s); ++s)
+ for (s = str;
+ *s != '\0' && *s != '.' && !ISSPACE (*s);
+ ++s)
continue;
/* If we did not find a '.', then we can quit now. */
if (s[0] == '$')
{
- if (isdigit ((unsigned char) s[1]))
+ if (ISDIGIT (s[1]))
{
++s;
regno = 0;
regno += *s - '0';
++s;
}
- while (isdigit ((unsigned char) *s));
+ while (ISDIGIT (*s));
if (regno > 31)
as_bad (_("Invalid register number (%d)"), regno);
}
case 'V':
case 'W':
s_reset = s;
- if (s[0] == '$' && s[1] == 'f' && isdigit ((unsigned char) s[2]))
+ if (s[0] == '$' && s[1] == 'f'
+ && ISDIGIT (s[2]))
{
s += 2;
regno = 0;
regno += *s - '0';
++s;
}
- while (isdigit ((unsigned char) *s));
+ while (ISDIGIT (*s));
if (regno > 31)
as_bad (_("Invalid float register number (%d)"), regno);
regno += *s - '0';
++s;
}
- while (isdigit ((unsigned char) *s));
+ while (ISDIGIT (*s));
if (regno > 7)
as_bad (_("invalid condition code register $fcc%d"), regno);
if (*args == 'N')
case 'H':
if (s[0] == '0' && (s[1] == 'x' || s[1] == 'X'))
s += 2;
- if (isdigit ((unsigned char) *s))
+ if (ISDIGIT (*s))
{
c = 0;
do
c += *s - '0';
++s;
}
- while (isdigit ((unsigned char) *s));
+ while (ISDIGIT (*s));
}
else
c = 8; /* Invalid sel value. */
mips16_small = false;
mips16_ext = false;
- for (s = str; islower ((unsigned char) *s); ++s)
+ for (s = str; ISLOWER (*s); ++s)
;
switch (*s)
{
if (s[0] != '$')
break;
s_reset = s;
- if (isdigit ((unsigned char) s[1]))
+ if (ISDIGIT (s[1]))
{
++s;
regno = 0;
regno += *s - '0';
++s;
}
- while (isdigit ((unsigned char) *s));
+ while (ISDIGIT (*s));
if (regno > 31)
{
as_bad (_("invalid register number (%d)"), regno);
++s;
}
reg1 = 0;
- while (isdigit ((unsigned char) *s))
+ while (ISDIGIT (*s))
{
reg1 *= 10;
reg1 += *s - '0';
}
}
reg2 = 0;
- while (isdigit ((unsigned char) *s))
+ while (ISDIGIT (*s))
{
reg2 *= 10;
reg2 += *s - '0';
if (*str == '(')
c = S_EX_NONE;
else if (str[0] == '%'
- && tolower(str[1]) == 'l'
- && tolower(str[2]) == 'o'
+ && TOLOWER (str[1]) == 'l'
+ && TOLOWER (str[2]) == 'o'
&& str[3] == '(')
{
c = S_EX_LO;
str += sizeof ("%lo(") - 2;
}
else if (str[0] == '%'
- && tolower(str[1]) == 'h'
- && tolower(str[2]) == 'i'
+ && TOLOWER (str[1]) == 'h'
+ && TOLOWER (str[2]) == 'i'
&& str[3] == '(')
{
c = S_EX_HI;
str += sizeof ("%hi(") - 2;
}
else if (str[0] == '%'
- && tolower(str[1]) == 'h'
- && tolower(str[2]) == 'i'
- && tolower(str[3]) == 'g'
- && tolower(str[4]) == 'h'
- && tolower(str[5]) == 'e'
- && tolower(str[6]) == 'r'
+ && TOLOWER (str[1]) == 'h'
+ && TOLOWER (str[2]) == 'i'
+ && TOLOWER (str[3]) == 'g'
+ && TOLOWER (str[4]) == 'h'
+ && TOLOWER (str[5]) == 'e'
+ && TOLOWER (str[6]) == 'r'
&& str[7] == '(')
{
c = S_EX_HIGHER;
str += sizeof ("%higher(") - 2;
}
else if (str[0] == '%'
- && tolower(str[1]) == 'h'
- && tolower(str[2]) == 'i'
- && tolower(str[3]) == 'g'
- && tolower(str[4]) == 'h'
- && tolower(str[5]) == 'e'
- && tolower(str[6]) == 's'
- && tolower(str[7]) == 't'
+ && TOLOWER (str[1]) == 'h'
+ && TOLOWER (str[2]) == 'i'
+ && TOLOWER (str[3]) == 'g'
+ && TOLOWER (str[4]) == 'h'
+ && TOLOWER (str[5]) == 'e'
+ && TOLOWER (str[6]) == 's'
+ && TOLOWER (str[7]) == 't'
&& str[8] == '(')
{
c = S_EX_HIGHEST;
/* currently unsupported */
#if 0
else if (str[0] == '%'
- && tolower(str[1]) == 'g'
- && tolower(str[2]) == 'p'
- && tolower(str[3]) == '_'
- && tolower(str[4]) == 'r'
- && tolower(str[5]) == 'e'
- && tolower(str[6]) == 'l'
+ && TOLOWER (str[1]) == 'g'
+ && TOLOWER (str[2]) == 'p'
+ && TOLOWER (str[3]) == '_'
+ && TOLOWER (str[4]) == 'r'
+ && TOLOWER (str[5]) == 'e'
+ && TOLOWER (str[6]) == 'l'
&& str[7] == '(')
{
c = S_EX_GPREL;
str += sizeof ("%gp_rel(") - 2;
}
else if (str[0] == '%'
- && tolower(str[1]) == 'n'
- && tolower(str[2]) == 'e'
- && tolower(str[3]) == 'g'
+ && TOLOWER (str[1]) == 'n'
+ && TOLOWER (str[2]) == 'e'
+ && TOLOWER (str[3]) == 'g'
&& str[4] == '(')
{
c = S_EX_NEG;
;
if (sp - 4 >= str && sp[-1] == ')')
{
- if (isdigit ((unsigned char) sp[-2]))
+ if (ISDIGIT (sp[-2]))
{
- for (sp -= 3; sp >= str && isdigit ((unsigned char) *sp); sp--)
+ for (sp -= 3; sp >= str && ISDIGIT (*sp); sp--)
;
if (*sp == '$' && sp > str && sp[-1] == '(')
{
as_warn (_("expected `$'"));
reg = 0;
}
- else if (isdigit ((unsigned char) *input_line_pointer))
+ else if (ISDIGIT (*input_line_pointer))
{
reg = get_absolute_expression ();
if (reg < 0 || reg >= 32)
++input_line_pointer;
negative = 1;
}
- if (!isdigit ((unsigned char) *input_line_pointer))
+ if (!ISDIGIT (*input_line_pointer))
as_bad (_("Expected simple number."));
if (input_line_pointer[0] == '0')
{
if (input_line_pointer[1] == 'x')
{
input_line_pointer += 2;
- while (isxdigit ((unsigned char) *input_line_pointer))
+ while (ISXDIGIT (*input_line_pointer))
{
val <<= 4;
val |= hex_value (*input_line_pointer++);
else
{
++input_line_pointer;
- while (isdigit ((unsigned char) *input_line_pointer))
+ while (ISDIGIT (*input_line_pointer))
{
val <<= 3;
val |= *input_line_pointer++ - '0';
return negative ? -val : val;
}
}
- if (!isdigit ((unsigned char) *input_line_pointer))
+ if (!ISDIGIT (*input_line_pointer))
{
printf (_(" *input_line_pointer == '%c' 0x%02x\n"),
*input_line_pointer, *input_line_pointer);
as_warn (_("Invalid number"));
return -1;
}
- while (isdigit ((unsigned char) *input_line_pointer))
+ while (ISDIGIT (*input_line_pointer))
{
val *= 10;
val += *input_line_pointer++ - '0';
if (*input_line_pointer == ',')
input_line_pointer++;
SKIP_WHITESPACE ();
- if (isdigit ((unsigned char) *input_line_pointer)
+ if (ISDIGIT (*input_line_pointer)
|| *input_line_pointer == '-')
number = get_number ();
Boston, MA 02111-1307, USA. */
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "opcode/mn10200.h"
\f
int match;
/* Get the opcode. */
- for (s = str; *s != '\0' && !isspace (*s); s++)
+ for (s = str; *s != '\0' && !ISSPACE (*s); s++)
;
if (*s != '\0')
*s++ = '\0';
}
str = s;
- while (isspace (*str))
+ while (ISSPACE (*str))
++str;
input_line_pointer = str;
break;
}
- while (isspace (*str))
+ while (ISSPACE (*str))
++str;
if (*str != '\0')
Boston, MA 02111-1307, USA. */
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "opcode/mn10300.h"
#include "dwarf2dbg.h"
int match;
/* Get the opcode. */
- for (s = str; *s != '\0' && !isspace (*s); s++)
+ for (s = str; *s != '\0' && !ISSPACE (*s); s++)
;
if (*s != '\0')
*s++ = '\0';
}
str = s;
- while (isspace (*str))
+ while (ISSPACE (*str))
++str;
input_line_pointer = str;
break;
}
- while (isspace (*str))
+ while (ISSPACE (*str))
++str;
if (*str != '\0')
/*#define SHOW_NUM 1*//* Uncomment for debugging. */
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
#include "opcode/ns32k.h"
*/
#include "as.h"
+#include "safe-ctype.h"
#include "opcode/pdp11.h"
static int set_option PARAMS ((char *arg));
return str;
}
-static char
-mklower (char c)
-{
- if (isupper (c))
- return tolower (c);
- return c;
-}
-
static char *
parse_reg (char *str, struct pdp11_code *operand)
{
str = skip_whitespace (str);
- if (mklower (*str) == 'r')
+ if (TOLOWER (*str) == 'r')
{
str++;
switch (*str)
/*-
tc-pj.c -- Assemble code for Pico Java
- Copyright 1999, 2000 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
/* Contributed by Steve Chamberlain of Transmeta <sac@pobox.com>. */
#include "as.h"
+#include "safe-ctype.h"
#include "opcode/pj.h"
extern const pj_opc_info_t pj_opc_info[512];
pending_reloc = 0;
}
- while (isspace (*op_end))
+ while (ISSPACE (*op_end))
op_end++;
if (*op_end != 0)
02111-1307, USA. */
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "opcode/ppc.h"
/* Find the spelling of the operand. */
start = name = input_line_pointer;
- if (name[0] == '%' && isalpha (name[1]))
+ if (name[0] == '%' && ISALPHA (name[1]))
name = ++input_line_pointer;
- else if (!reg_names_p || !isalpha (name[0]))
+ else if (!reg_names_p || !ISALPHA (name[0]))
return false;
c = get_symbol_end ();
for (ch = *str, str2 = ident;
(str2 < ident + sizeof (ident) - 1
- && (isalnum (ch) || ch == '@'));
+ && (ISALNUM (ch) || ch == '@'));
ch = *++str)
{
- *str2++ = (islower (ch)) ? ch : tolower (ch);
+ *str2++ = TOLOWER (ch);
}
*str2 = '\0';
#endif
/* Get the opcode. */
- for (s = str; *s != '\0' && ! isspace (*s); s++)
+ for (s = str; *s != '\0' && ! ISSPACE (*s); s++)
;
if (*s != '\0')
*s++ = '\0';
insn = opcode->opcode;
str = s;
- while (isspace (*str))
+ while (ISSPACE (*str))
++str;
/* PowerPC operands are just expressions. The only real issue is
++str;
}
- while (isspace (*str))
+ while (ISSPACE (*str))
++str;
if (*str != '\0')
}
for (s++; *s != '\0' && *s != brac; s++)
- if (islower (*s))
- *s = toupper (*s);
+ *s = TOUPPER (*s);
if (*s == '\0' || s[1] != '\0')
as_bad (_("bad symbol suffix"));
02111-1307, USA. */
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "struc-symbol.h"
/* Find the spelling of the operand. */
start = name = input_line_pointer;
- if (name[0] == '%' && isalpha (name[1]))
+ if (name[0] == '%' && ISALPHA (name[1]))
name = ++input_line_pointer;
else
return false;
return ELF_SUFFIX_NONE;
ident = str;
- while (isalnum (*str))
+ while (ISALNUM (*str))
str++;
len = str - ident;
/* We look for a suffix of the form "@lit1", "@lit2", "@lit4" or "@lit8". */
ident = str;
- while (isalnum (*str))
+ while (ISALNUM (*str))
str++;
len = str - ident;
if (len != 4 || strncasecmp (ident, "lit", 3) != 0 ||
char *f;
int fc, i;
- while (isspace(*str)) str++;
+ while (ISSPACE (*str)) str++;
parentheses = 0;
skip_optional = 0;
}
}
- while (isspace (*str))
+ while (ISSPACE (*str))
++str;
if (*str != '\0')
char *s;
/* Get the opcode. */
- for (s = str; *s != '\0' && ! isspace (*s); s++)
+ for (s = str; *s != '\0' && ! ISSPACE (*s); s++)
;
if (*s != '\0')
*s++ = '\0';
/* Get the opcode format. */
s = input_line_pointer;
- while (*s != '\0' && *s != ',' && ! isspace (*s))
+ while (*s != '\0' && *s != ',' && ! ISSPACE (*s))
s++;
if (*s != ',')
as_bad (_("Invalid .insn format\n"));
#include "subsegs.h"
#define DEFINE_TABLE
#include "opcodes/sh-opc.h"
-#include <ctype.h>
+#include "safe-ctype.h"
#include "struc-symbol.h"
#ifdef OBJ_ELF
for (ch = *str, str2 = ident;
(str2 < ident + sizeof (ident) - 1
- && (isalnum (ch) || ch == '@'));
+ && (ISALNUM (ch) || ch == '@'));
ch = *++str)
- {
- *str2++ = (islower (ch)) ? ch : tolower (ch);
- }
+ *str2++ = TOLOWER (ch);
*str2 = '\0';
len = str2 - ident;
static int reg_efg;
static int reg_b;
-#define IDENT_CHAR(c) (isalnum (c) || (c) == '_')
+#define IDENT_CHAR(c) (ISALNUM (c) || (c) == '_')
/* Try to parse a reg name. Return the number of chars consumed. */
int *mode;
int *reg;
{
- char l0 = tolower (src[0]);
- char l1 = l0 ? tolower (src[1]) : 0;
+ char l0 = TOLOWER (src[0]);
+ char l1 = l0 ? TOLOWER (src[1]) : 0;
/* We use ! IDENT_CHAR for the next character after the register name, to
make sure that we won't accidentally recognize a symbol name such as
*reg = A_A0_NUM;
return 2;
}
- if (tolower (src[2]) == 'g' && ! IDENT_CHAR ((unsigned char) src[3]))
+ if (TOLOWER (src[2]) == 'g' && ! IDENT_CHAR ((unsigned char) src[3]))
{
*mode = DSP_REG_N;
*reg = A_A0G_NUM;
*reg = A_A1_NUM;
return 2;
}
- if (tolower (src[2]) == 'g' && ! IDENT_CHAR ((unsigned char) src[3]))
+ if (TOLOWER (src[2]) == 'g' && ! IDENT_CHAR ((unsigned char) src[3]))
{
*mode = DSP_REG_N;
*reg = A_A1G_NUM;
if (l0 == 's'
&& l1 == 's'
- && tolower (src[2]) == 'r' && ! IDENT_CHAR ((unsigned char) src[3]))
+ && TOLOWER (src[2]) == 'r' && ! IDENT_CHAR ((unsigned char) src[3]))
{
*mode = A_SSR;
return 3;
}
- if (l0 == 's' && l1 == 'p' && tolower (src[2]) == 'c'
+ if (l0 == 's' && l1 == 'p' && TOLOWER (src[2]) == 'c'
&& ! IDENT_CHAR ((unsigned char) src[3]))
{
*mode = A_SPC;
return 3;
}
- if (l0 == 's' && l1 == 'g' && tolower (src[2]) == 'r'
+ if (l0 == 's' && l1 == 'g' && TOLOWER (src[2]) == 'r'
&& ! IDENT_CHAR ((unsigned char) src[3]))
{
*mode = A_SGR;
return 3;
}
- if (l0 == 'd' && l1 == 's' && tolower (src[2]) == 'r'
+ if (l0 == 'd' && l1 == 's' && TOLOWER (src[2]) == 'r'
&& ! IDENT_CHAR ((unsigned char) src[3]))
{
*mode = A_DSR;
return 3;
}
- if (l0 == 'd' && l1 == 'b' && tolower (src[2]) == 'r'
+ if (l0 == 'd' && l1 == 'b' && TOLOWER (src[2]) == 'r'
&& ! IDENT_CHAR ((unsigned char) src[3]))
{
*mode = A_DBR;
*mode = A_PC;
return 2;
}
- if (l0 == 'g' && l1 == 'b' && tolower (src[2]) == 'r'
+ if (l0 == 'g' && l1 == 'b' && TOLOWER (src[2]) == 'r'
&& ! IDENT_CHAR ((unsigned char) src[3]))
{
*mode = A_GBR;
return 3;
}
- if (l0 == 'v' && l1 == 'b' && tolower (src[2]) == 'r'
+ if (l0 == 'v' && l1 == 'b' && TOLOWER (src[2]) == 'r'
&& ! IDENT_CHAR ((unsigned char) src[3]))
{
*mode = A_VBR;
return 3;
}
- if (l0 == 'm' && l1 == 'a' && tolower (src[2]) == 'c'
+ if (l0 == 'm' && l1 == 'a' && TOLOWER (src[2]) == 'c'
&& ! IDENT_CHAR ((unsigned char) src[4]))
{
- if (tolower (src[3]) == 'l')
+ if (TOLOWER (src[3]) == 'l')
{
*mode = A_MACL;
return 4;
}
- if (tolower (src[3]) == 'h')
+ if (TOLOWER (src[3]) == 'h')
{
*mode = A_MACH;
return 4;
}
}
- if (l0 == 'm' && l1 == 'o' && tolower (src[2]) == 'd'
+ if (l0 == 'm' && l1 == 'o' && TOLOWER (src[2]) == 'd'
&& ! IDENT_CHAR ((unsigned char) src[4]))
{
*mode = A_MOD;
return 3;
}
}
- if (l0 == 'f' && l1 == 'p' && tolower (src[2]) == 'u'
- && tolower (src[3]) == 'l'
+ if (l0 == 'f' && l1 == 'p' && TOLOWER (src[2]) == 'u'
+ && TOLOWER (src[3]) == 'l'
&& ! IDENT_CHAR ((unsigned char) src[4]))
{
*mode = FPUL_N;
return 4;
}
- if (l0 == 'f' && l1 == 'p' && tolower (src[2]) == 's'
- && tolower (src[3]) == 'c'
- && tolower (src[4]) == 'r' && ! IDENT_CHAR ((unsigned char) src[5]))
+ if (l0 == 'f' && l1 == 'p' && TOLOWER (src[2]) == 's'
+ && TOLOWER (src[3]) == 'c'
+ && TOLOWER (src[4]) == 'r' && ! IDENT_CHAR ((unsigned char) src[5]))
{
*mode = FPSCR_N;
return 5;
}
- if (l0 == 'x' && l1 == 'm' && tolower (src[2]) == 't'
- && tolower (src[3]) == 'r'
- && tolower (src[4]) == 'x' && ! IDENT_CHAR ((unsigned char) src[5]))
+ if (l0 == 'x' && l1 == 'm' && TOLOWER (src[2]) == 't'
+ && TOLOWER (src[3]) == 'r'
+ && TOLOWER (src[4]) == 'x' && ! IDENT_CHAR ((unsigned char) src[5]))
{
*mode = XMTRX_M4;
return 5;
/* The machine independent code will convert CMP/EQ into cmp/EQ
because it thinks the '/' is the end of the symbol. Moreover,
all but the first sub-insn is a parallel processing insn won't
- be capitailzed. Instead of hacking up the machine independent
+ be capitalized. Instead of hacking up the machine independent
code, we just deal with it here. */
- c = isupper (c) ? tolower (c) : c;
+ c = TOLOWER (c);
name[nlen] = c;
nlen++;
}
Boston, MA 02111-1307, USA. */
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "opcode/sparc.h"
int special_case = SPECIAL_CASE_NONE;
s = str;
- if (islower ((unsigned char) *s))
+ if (ISLOWER (*s))
{
do
++s;
- while (islower ((unsigned char) *s) || isdigit ((unsigned char) *s));
+ while (ISLOWER (*s) || ISDIGIT (*s));
}
switch (*s)
{
s += 4;
- if (isdigit ((unsigned char) *s))
+ if (ISDIGIT (*s))
{
long num = 0;
- while (isdigit ((unsigned char) *s))
+ while (ISDIGIT (*s))
{
num = num * 10 + *s - '0';
++s;
break;
case '#': /* Must be at least one digit. */
- if (isdigit ((unsigned char) *s++))
+ if (ISDIGIT (*s++))
{
- while (isdigit ((unsigned char) *s))
+ while (ISDIGIT (*s))
{
++s;
}
case 'b': /* Next operand is a coprocessor register. */
case 'c':
case 'D':
- if (*s++ == '%' && *s++ == 'c' && isdigit ((unsigned char) *s))
+ if (*s++ == '%' && *s++ == 'c' && ISDIGIT (*s))
{
mask = *s++;
- if (isdigit ((unsigned char) *s))
+ if (ISDIGIT (*s))
{
mask = 10 * (mask - '0') + (*s++ - '0');
if (mask >= 32)
goto error;
case 'r': /* any register */
- if (!isdigit ((unsigned char) (c = *s++)))
+ if (!ISDIGIT ((c = *s++)))
{
goto error;
}
case '7':
case '8':
case '9':
- if (isdigit ((unsigned char) *s))
+ if (ISDIGIT (*s))
{
if ((c = 10 * (c - '0') + (*s++ - '0')) >= 32)
{
if (*s++ == '%'
&& ((format = *s) == 'f')
- && isdigit ((unsigned char) *++s))
+ && ISDIGIT (*++s))
{
- for (mask = 0; isdigit ((unsigned char) *s); ++s)
+ for (mask = 0; ISDIGIT (*s); ++s)
{
mask = 10 * mask + (*s - '0');
} /* read the number */
for (s1 = s; *s1 && *s1 != ',' && *s1 != ']'; s1++)
;
- if (s1 != s && isdigit ((unsigned char) s1[-1]))
+ if (s1 != s && ISDIGIT (s1[-1]))
{
if (s1[-2] == '%' && s1[-3] == '+')
s1 -= 3;
p = *input_pointerP;
for (q = p + (*p == '#' || *p == '%');
- isalnum ((unsigned char) *q) || *q == '_';
+ ISALNUM (*q) || *q == '_';
++q)
continue;
c = *q;
/* This file is tc-tahoe.c
- Copyright 1987, 1988, 1989, 1990, 1991, 1992, 1995, 2000
+ Copyright 1987, 1988, 1989, 1990, 1991, 1992, 1995, 2000, 2001
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
#include "as.h"
+#include "safe-ctype.h"
#include "obstack.h"
/* This bit glommed from tahoe-inst.h. */
R or r, and then a number. */
case 'R':
case 'r':
- if (isdigit (*regpoint))
+ if (ISDIGIT (*regpoint))
{
/* Got the first digit. */
regnum = *regpoint++ - '0';
- if ((regnum == 1) && isdigit (*regpoint))
+ if ((regnum == 1) && ISDIGIT (*regpoint))
{
/* Its a two digit number. */
regnum = 10 + (*regpoint++ - '0');
as_warn (_("Casting a branch displacement is bad form, and is ignored."));
else
{
- c = (isupper (*point) ? tolower (*point) : *point);
+ c = TOLOWER (*point);
call_width = ((c == 'b') ? 1 :
((c == 'w') ? 2 : 4));
}
/* tc-c30.c -- Assembly code for the Texas Instruments TMS320C30
- Copyright 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
Contributed by Steven Haworth (steve@pm.cse.rmit.edu.au)
This file is part of GAS, the GNU Assembler.
Please help us make it better. */
#include "as.h"
+#include "safe-ctype.h"
#include "opcode/tic30.h"
/* Put here all non-digit non-letter charcters that may occur in an
for (c = 0; c < 256; c++)
{
- if (islower (c) || isdigit (c))
+ if (ISLOWER (c) || ISDIGIT (c))
{
opcode_chars[c] = c;
register_chars[c] = c;
}
- else if (isupper (c))
+ else if (ISUPPER (c))
{
- opcode_chars[c] = tolower (c);
+ opcode_chars[c] = TOLOWER (c);
register_chars[c] = opcode_chars[c];
}
else if (c == ')' || c == '(')
{
register_chars[c] = c;
}
- if (isupper (c) || islower (c) || isdigit (c))
+ if (ISUPPER (c) || ISLOWER (c) || ISDIGIT (c))
operand_chars[c] = c;
- if (isdigit (c) || c == '-')
+ if (ISDIGIT (c) || c == '-')
digit_chars[c] = c;
- if (isalpha (c) || c == '_' || c == '.' || isdigit (c))
+ if (ISALPHA (c) || c == '_' || c == '.' || ISDIGIT (c))
identifier_chars[c] = c;
if (c == ' ' || c == '\t')
space_chars[c] = c;
ind_buffer[0] = *token;
for (count = 1; count < strlen (token); count++)
{ /* Strip operand */
- ind_buffer[buffer_posn] = tolower (*(token + count));
+ ind_buffer[buffer_posn] = TOLOWER (*(token + count));
if ((*(token + count - 1) == 'a' || *(token + count - 1) == 'A') &&
(*(token + count) == 'r' || *(token + count) == 'R'))
{
{
if (is_opcode_char (c) && search_status == NONE)
{
- opcode[char_ptr++] = tolower (c);
+ opcode[char_ptr++] = TOLOWER (c);
search_status = START_OPCODE;
}
else if (is_opcode_char (c) && search_status == START_OPCODE)
{
- opcode[char_ptr++] = tolower (c);
+ opcode[char_ptr++] = TOLOWER (c);
}
else if (!is_opcode_char (c) && search_status == START_OPCODE)
{
output_invalid (c)
char c;
{
- if (isprint (c))
+ if (ISPRINT (c))
sprintf (output_invalid_buf, "'%c'", c);
else
sprintf (output_invalid_buf, "(0x%x)", (unsigned) c);
#include <limits.h>
#include <errno.h>
#include "as.h"
+#include "safe-ctype.h"
#include "sb.h"
#include "macro.h"
#include "subsegs.h"
name = ++input_line_pointer;
c = get_symbol_end (); /* Get terminator. */
- if (!isalpha (*name))
+ if (!ISALPHA (*name))
{
as_bad ("symbols assigned with .asg must begin with a letter");
ignore_rest_of_line ();
name = strcpy (tmp, name);
*input_line_pointer = c;
- if (!isalpha (*name))
+ if (!ISALPHA (*name))
{
as_bad (_("symbols assigned with .eval must begin with a letter"));
ignore_rest_of_line ();
|| ver[2] == '5' || ver[2] == '8' || ver[2] == '9'))
version = ver[2] - '0';
else if (strlen (ver) == 5
- && toupper (ver[3]) == 'L'
- && toupper (ver[4]) == 'P'
+ && TOUPPER (ver[3]) == 'L'
+ && TOUPPER (ver[4]) == 'P'
&& (ver[2] == '5' || ver[2] == '6'))
version = ver[2] - '0' + 10;
}
}
do
{
- if (!isalpha (*input_line_pointer))
+ if (!ISALPHA (*input_line_pointer))
{
as_bad (_("Substitution symbols must begin with a letter"));
ignore_rest_of_line ();
SKIP_WHITESPACE ();
len = 0;
while (!is_end_of_line[(int) *input_line_pointer]
- && !isspace (*input_line_pointer))
+ && !ISSPACE (*input_line_pointer))
{
obstack_1grow (¬es, *input_line_pointer);
++input_line_pointer;
{
int len = strlen (a);
- switch (toupper (a[len - 1]))
+ switch (TOUPPER (a[len - 1]))
{
case 'B':
return 1;
/* No suffix; either octal, hex, or decimal. */
if (*a == '0' && len > 1)
{
- if (toupper (a[1]) == 'X')
+ if (TOUPPER (a[1]) == 'X')
return 3;
return 2;
}
{
int paren_not_balanced = 0;
char *op_start, *op_end;
- while (*lptr && isspace (*lptr))
+ while (*lptr && ISSPACE (*lptr))
++lptr;
op_start = lptr;
while (paren_not_balanced || *lptr != ',')
/* Trim trailing spaces; while the preprocessor gets rid of most,
there are weird usage patterns that can introduce them
(i.e. using strings for macro args). */
- while (len > 0 && isspace (operands[numexp].buf[len - 1]))
+ while (len > 0 && ISSPACE (operands[numexp].buf[len - 1]))
operands[numexp].buf[--len] = 0;
lptr = op_end;
++numexp;
}
}
- while (*lptr && isspace (*lptr++))
+ while (*lptr && ISSPACE (*lptr++))
;
if (!is_end_of_line[(int) *lptr])
{
case OP_DST:
return is_accumulator (operand);
case OP_B:
- return is_accumulator (operand) && toupper (operand->buf[0]) == 'B';
+ return is_accumulator (operand) && TOUPPER (operand->buf[0]) == 'B';
case OP_A:
- return is_accumulator (operand) && toupper (operand->buf[0]) == 'A';
+ return is_accumulator (operand) && TOUPPER (operand->buf[0]) == 'A';
case OP_ARX:
return strncasecmp ("ar", operand->buf, 2) == 0
- && isdigit (operand->buf[2]);
+ && ISDIGIT (operand->buf[2]);
case OP_SBIT:
return hash_find (sbit_hash, operand->buf) != 0 || is_absolute (operand);
case OP_CC:
if (insn->is_lkaddr)
{
/* lk addresses always go in the second insn word. */
- mod = ((toupper (operand->buf[1]) == 'A') ? 12 :
+ mod = ((TOUPPER (operand->buf[1]) == 'A') ? 12 :
(operand->buf[1] == '(') ? 15 :
(strchr (operand->buf, '%') != NULL) ? 14 : 13);
arf = ((mod == 12) ? operand->buf[3] - '0' :
}
else
{
- arf = (toupper (operand->buf[1]) == 'A' ?
+ arf = (TOUPPER (operand->buf[1]) == 'A' ?
operand->buf[3] : operand->buf[4]) - '0';
if (operand->buf[1] == '+')
else
mod = (operand->buf[4] == '-' ? 8 : 10);/* *ARx+% / *ARx-% */
}
- else if (toupper (operand->buf[6]) == 'B')
+ else if (TOUPPER (operand->buf[6]) == 'B')
mod = (operand->buf[4] == '-' ? 4 : 7); /* ARx+0B / *ARx-0B */
- else if (toupper (operand->buf[6]) == '%')
+ else if (TOUPPER (operand->buf[6]) == '%')
mod = (operand->buf[4] == '-' ? 9 : 11); /* ARx+0% / *ARx - 0% */
else
{
/* 16-bit immediate value. */
return encode_dmad (insn, operand, 0);
case OP_SRC:
- if (toupper (*operand->buf) == 'B')
+ if (TOUPPER (*operand->buf) == 'B')
{
insn->opcode[ext ? (1 + insn->is_lkaddr) : 0].word |= (1 << 9);
if (insn->using_default_dst)
return 1;
case OP_RND:
/* Make sure this agrees with with the OP_DST operand. */
- if (!((toupper (operand->buf[0]) == 'B') ^
+ if (!((TOUPPER (operand->buf[0]) == 'B') ^
((insn->opcode[0].word & (1 << 8)) != 0)))
{
as_bad (_("Destination accumulator for each part of this parallel "
return 1;
case OP_SRC1:
case OP_DST:
- if (toupper (operand->buf[0]) == 'B')
+ if (TOUPPER (operand->buf[0]) == 'B')
insn->opcode[ext ? (1 + insn->is_lkaddr) : 0].word |= (1 << 8);
return 1;
case OP_Xmem:
char *next_line;
{
/* Look for the second half. */
- while (isspace (*next_line))
+ while (ISSPACE (*next_line))
++next_line;
return (next_line[0] == PARALLEL_SEPARATOR
char *ptr = line;
char *endp;
int is_string = *line == '"';
- int is_char = isdigit (*line);
+ int is_char = ISDIGIT (*line);
if (is_char)
{
- while (isdigit (*ptr))
+ while (ISDIGIT (*ptr))
++ptr;
endp = ptr;
*str = xmalloc (ptr - line + 1);
/* Check for local labels; replace them with the appropriate
substitution. */
- if ((*name == '$' && isdigit (name[1]) && name[2] == '\0')
+ if ((*name == '$' && ISDIGIT (name[1]) && name[2] == '\0')
|| name[strlen (name) - 1] == '?')
{
/* Use an existing identifier for that label if, available, or
}
/* Character constants are converted to numerics
by the preprocessor. */
- arg_type[1] = (isdigit (*ptr)) ? 2 : (*ptr == '"');
+ arg_type[1] = (ISDIGIT (*ptr)) ? 2 : (*ptr == '"');
ptr = subsym_get_arg (ptr, ")", &arg2, ismember);
}
/* Args checking. */
comment = replacement + strlen (replacement) - 1;
/* Trim trailing whitespace. */
- while (isspace (*comment))
+ while (ISSPACE (*comment))
{
comment[0] = endc;
comment[1] = 0;
}
/* Compact leading whitespace. */
- while (isspace (tmp[0]) && isspace (tmp[1]))
+ while (ISSPACE (tmp[0]) && ISSPACE (tmp[1]))
++tmp;
input_line_pointer = endp;
otherwise let the assembler pick up the next line for us. */
if (tmp != NULL)
{
- while (isspace (tmp[2]))
+ while (ISSPACE (tmp[2]))
++tmp;
md_assemble (tmp + 2);
}
if (is_end_of_line[(int) c])
return 1;
- if (isspace (c))
- while (isspace (c = *++rest))
+ if (ISSPACE (c))
+ while (ISSPACE (c = *++rest))
;
if (c == '.')
{
/* Don't let colon () define a label for any of these... */
- return (strncasecmp (rest, ".tag", 4) != 0 || !isspace (rest[4]))
- && (strncasecmp (rest, ".struct", 7) != 0 || !isspace (rest[7]))
- && (strncasecmp (rest, ".union", 6) != 0 || !isspace (rest[6]))
- && (strncasecmp (rest, ".macro", 6) != 0 || !isspace (rest[6]))
- && (strncasecmp (rest, ".set", 4) != 0 || !isspace (rest[4]))
- && (strncasecmp (rest, ".equ", 4) != 0 || !isspace (rest[4]));
+ return (strncasecmp (rest, ".tag", 4) != 0 || !ISSPACE (rest[4]))
+ && (strncasecmp (rest, ".struct", 7) != 0 || !ISSPACE (rest[7]))
+ && (strncasecmp (rest, ".union", 6) != 0 || !ISSPACE (rest[6]))
+ && (strncasecmp (rest, ".macro", 6) != 0 || !ISSPACE (rest[6]))
+ && (strncasecmp (rest, ".set", 4) != 0 || !ISSPACE (rest[4]))
+ && (strncasecmp (rest, ".equ", 4) != 0 || !ISSPACE (rest[4]));
}
return 1;
/* tc-tic80.c -- Assemble for the TI TMS320C80 (MV)
- Copyright 1996, 1997, 2000 Free Software Foundation, Inc.
+ Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
02111-1307, USA. */
#include "as.h"
+#include "safe-ctype.h"
#include "opcode/tic80.h"
#define internal_error(what) \
assert (str);
/* Drop any leading whitespace. */
- while (isspace (*str))
+ while (ISSPACE (*str))
str++;
/* Isolate the mnemonic from the rest of the string by finding the first
whitespace character and zapping it to a null byte. */
- for (scan = str; *scan != '\000' && !isspace (*scan); scan++)
+ for (scan = str; *scan != '\000' && !ISSPACE (*scan); scan++)
;
if (*scan != '\000')
}
str = scan;
- while (isspace (*scan))
+ while (ISSPACE (*scan))
scan++;
input_line_save = input_line_pointer;
Boston, MA 02111-1307, USA. */
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "opcode/v850.h"
#include "dwarf2dbg.h"
/* Reset input_line pointer. */
input_line_pointer = start;
- if (isdigit (*input_line_pointer))
+ if (ISDIGIT (*input_line_pointer))
{
reg_number = strtol (input_line_pointer, &input_line_pointer, 10);
strncpy (copy_of_instruction, str, sizeof (copy_of_instruction) - 1);
/* Get the opcode. */
- for (s = str; *s != '\0' && ! isspace (*s); s++)
+ for (s = str; *s != '\0' && ! ISSPACE (*s); s++)
continue;
if (*s != '\0')
}
str = s;
- while (isspace (*str))
+ while (ISSPACE (*str))
++str;
start_of_operands = str;
break;
}
- while (isspace (*str))
+ while (ISSPACE (*str))
++str;
if (*str != '\0')
*
*/
-#include <ctype.h>
+#include "safe-ctype.h"
#define AP (12)
#define FP (13)
#define SP (14)
retval = -1;
- if (isupper (c1))
- c1 = tolower (c1);
- if (isupper (c2))
- c2 = tolower (c2);
- if (isdigit (c2) && c1 == 'r')
+ c1 = TOLOWER (c1);
+ c2 = TOLOWER (c2);
+ if (ISDIGIT (c2) && c1 == 'r')
{
retval = c2 - '0';
- if (isdigit (c3))
+ if (ISDIGIT (c3))
{
retval = retval * 10 + c3 - '0';
retval = (retval > 15) ? -1 : retval;
char c;
c = *p;
- if (isupper (c))
- c = tolower (c);
+ c = TOLOWER (c);
if (DISPLENP (p[1]) && strchr ("bilws", len = c))
p += 2; /* skip (letter) '^' */
else /* no (letter) '^' seen */
#include "subsegs.h"
#define DEFINE_TABLE
#include "../opcodes/w65-opc.h"
-#include <ctype.h>
const char comment_chars[] = "!";
CONST char line_separator_chars[] = ";";
/* tc-z8k.c -- Assemble code for the Zilog Z800n
- Copyright 1992, 1993, 1994, 1995, 1996, 1998, 2000
+ Copyright 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2001
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
#include "as.h"
#include "bfd.h"
-#include <ctype.h>
+#include "safe-ctype.h"
const char comment_chars[] = "!";
const char line_comment_chars[] = "#";
tohex (c)
int c;
{
- if (isdigit (c))
+ if (ISDIGIT (c))
return c - '0';
- if (islower (c))
+ if (ISLOWER (c))
return c - 'a' + 10;
return c - 'A' + 10;
}
int *reg;
char *src;
{
- if (isdigit (src[1]))
+ if (ISDIGIT (src[1]))
{
*reg = (src[0] - '0') * 10 + src[1] - '0';
return src + 2;
#include "coff/symconst.h"
#include "aout/stab_gnu.h"
-#include <ctype.h>
+#include "safe-ctype.h"
/* Why isn't this in coff/sym.h? */
#define ST_RFDESCAPE 0xfff
++input_line_pointer;
SKIP_WHITESPACE ();
}
- if (isdigit ((unsigned char) *input_line_pointer)
+ if (ISDIGIT (*input_line_pointer)
|| *input_line_pointer == '-')
(void) get_absolute_expression ();
listing_source_file (string);
#endif
- if (isdigit ((unsigned char) *input_line_pointer)
+ if (ISDIGIT (*input_line_pointer)
|| *input_line_pointer == '-'
|| *input_line_pointer == '+')
{
(It also gives smaller files to re-compile.)
Here, "operand"s are of expressions, not instructions. */
-#include <ctype.h>
#include <string.h>
#define min(a, b) ((a) < (b) ? (a) : (b))
#include "as.h"
+#include "safe-ctype.h"
#include "obstack.h"
static void floating_constant PARAMS ((expressionS * expressionP));
/* In MRI mode, the number may have a suffix indicating the
radix. For that matter, it might actually be a floating
point constant. */
- for (suffix = input_line_pointer;
- isalnum ((unsigned char) *suffix);
- suffix++)
+ for (suffix = input_line_pointer; ISALNUM (*suffix); suffix++)
{
if (*suffix == 'e' || *suffix == 'E')
flt = 1;
else
{
c = *--suffix;
- if (islower ((unsigned char) c))
- c = toupper (c);
+ c = TOUPPER (c);
if (c == 'B')
radix = 2;
else if (c == 'D')
{
input_line_pointer++;
floating_constant (expressionP);
- expressionP->X_add_number =
- - (isupper ((unsigned char) c) ? tolower (c) : c);
+ expressionP->X_add_number = - TOLOWER (c);
}
else
{
case 'G':
input_line_pointer++;
floating_constant (expressionP);
- expressionP->X_add_number =
- - (isupper ((unsigned char) c) ? tolower (c) : c);
+ expressionP->X_add_number = - TOLOWER (c);
break;
case '$':
/* gasp.c - Gnu assembler preprocessor main program.
- Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
+ Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
Written by Steve and Judy Chamberlain of Cygnus Support,
#include <stdio.h>
#include <string.h>
#include <getopt.h>
-#include <ctype.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#include "ansidecl.h"
#include "libiberty.h"
+#include "safe-ctype.h"
#include "sb.h"
#include "macro.h"
#include "asintl.h"
{
int ch = string->ptr[idx];
int dig = 0;
- if (isdigit (ch))
+ if (ISDIGIT (ch))
dig = ch - '0';
else if (ch >= 'a' && ch <= 'f')
dig = ch - 'a' + 10;
lhs->value = 0;
- if (isdigit ((unsigned char) string->ptr[idx]))
+ if (ISDIGIT (string->ptr[idx]))
{
idx = sb_strtol (idx, string, 10, &lhs->value);
}
idx++;
}
}
- else if (isdigit ((unsigned char) in->ptr[idx]))
+ else if (ISDIGIT (in->ptr[idx]))
{
int value;
/* All numbers must start with a digit, let's chew it and
idx = sb_skip_comma (idx, in);
idx = get_and_process (idx, in, &search);
idx = sb_skip_comma (idx, in);
- if (isdigit ((unsigned char) in->ptr[idx]))
+ if (ISDIGIT (in->ptr[idx]))
{
idx = exp_get_abs (_(".instr needs absolute expresson.\n"), idx, in, &start);
}
}
else if (idx + 3 < in->len
&& in->ptr[idx] == '.'
- && toupper ((unsigned char) in->ptr[idx + 1]) == 'L'
- && toupper ((unsigned char) in->ptr[idx + 2]) == 'E'
- && toupper ((unsigned char) in->ptr[idx + 3]) == 'N')
+ && TOUPPER (in->ptr[idx + 1]) == 'L'
+ && TOUPPER (in->ptr[idx + 2]) == 'E'
+ && TOUPPER (in->ptr[idx + 3]) == 'N')
idx = dolen (idx + 4, in, buf);
else if (idx + 6 < in->len
&& in->ptr[idx] == '.'
- && toupper ((unsigned char) in->ptr[idx + 1]) == 'I'
- && toupper ((unsigned char) in->ptr[idx + 2]) == 'N'
- && toupper ((unsigned char) in->ptr[idx + 3]) == 'S'
- && toupper ((unsigned char) in->ptr[idx + 4]) == 'T'
- && toupper ((unsigned char) in->ptr[idx + 5]) == 'R')
+ && TOUPPER (in->ptr[idx + 1]) == 'I'
+ && TOUPPER (in->ptr[idx + 2]) == 'N'
+ && TOUPPER (in->ptr[idx + 3]) == 'S'
+ && TOUPPER (in->ptr[idx + 4]) == 'T'
+ && TOUPPER (in->ptr[idx + 5]) == 'R')
idx = doinstr (idx + 6, in, buf);
else if (idx + 7 < in->len
&& in->ptr[idx] == '.'
- && toupper ((unsigned char) in->ptr[idx + 1]) == 'S'
- && toupper ((unsigned char) in->ptr[idx + 2]) == 'U'
- && toupper ((unsigned char) in->ptr[idx + 3]) == 'B'
- && toupper ((unsigned char) in->ptr[idx + 4]) == 'S'
- && toupper ((unsigned char) in->ptr[idx + 5]) == 'T'
- && toupper ((unsigned char) in->ptr[idx + 6]) == 'R')
+ && TOUPPER (in->ptr[idx + 1]) == 'S'
+ && TOUPPER (in->ptr[idx + 2]) == 'U'
+ && TOUPPER (in->ptr[idx + 3]) == 'B'
+ && TOUPPER (in->ptr[idx + 4]) == 'S'
+ && TOUPPER (in->ptr[idx + 5]) == 'T'
+ && TOUPPER (in->ptr[idx + 6]) == 'R')
idx = dosubstr (idx + 7, in, buf);
else if (ISFIRSTCHAR (in->ptr[idx]))
{
char a, b;
p = in->ptr + idx;
- a = toupper ((unsigned char) p[0]);
- b = toupper ((unsigned char) p[1]);
+ a = TOUPPER (p[0]);
+ b = TOUPPER (p[1]);
if (a == 'E' && b == 'Q')
cond = EQ;
else if (a == 'N' && b == 'E')
int x;
for (x = 0; x < 256; x++)
{
- if (isalpha (x) || x == '_' || x == '$')
+ if (ISALPHA (x) || x == '_' || x == '$')
chartype[x] |= FIRSTBIT;
if (mri && x == '.')
chartype[x] |= FIRSTBIT;
- if (isdigit (x) || isalpha (x) || x == '_' || x == '$')
+ if (ISDIGIT (x) || ISALPHA (x) || x == '_' || x == '$')
chartype[x] |= NEXTBIT;
if (x == ' ' || x == '\t' || x == ',' || x == '"' || x == ';'
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
+#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
/* hash.c -- gas hash table code
Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999,
- 2000
+ 2000, 2001
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
structure. */
#include "as.h"
+#include "safe-ctype.h"
#include "obstack.h"
/* The default number of entries to use when creating a hash table. */
printf ("hash_test command: ");
gets (answer);
command = answer[0];
- if (isupper (command))
- command = tolower (command); /* Ecch! */
+ command = TOLOWER (command); /* Ecch! */
switch (command)
{
case '#':
/* itbl-lex.l
- Copyright 1997, 1998 Free Software Foundation, Inc.
+ Copyright 1997, 1998, 2001 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
-#include <ctype.h>
#include "itbl-parse.h"
#ifdef DEBUG
on a line
*/
-#include <ctype.h>
-
#include "as.h"
#include <obstack.h>
+#include "safe-ctype.h"
#include "input-file.h"
#include "subsegs.h"
unsigned char c = *src++;
/* Omit control characters in the listing. */
- if (isascii (c) && ! iscntrl (c))
+ if (!ISCNTRL (c))
*dest++ = c;
}
was_debug = in_debug;
in_debug = 0;
- while (isspace ((unsigned char) *line))
+ while (ISSPACE (*line))
line++;
if (*line != '.')
/* macro.c - macro support for gas and gasp
- Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
+ Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
Written by Steve and Judy Chamberlain of Cygnus Support,
#else
#include <strings.h>
#endif
-#include <ctype.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#include "libiberty.h"
+#include "safe-ctype.h"
#include "sb.h"
#include "hash.h"
#include "macro.h"
/* Skip over a label. */
while (i < ptr->len
- && (isalnum ((unsigned char) ptr->ptr[i])
+ && (ISALNUM (ptr->ptr[i])
|| ptr->ptr[i] == '_'
|| ptr->ptr[i] == '$'))
i++;
i++;
if (strncasecmp (ptr->ptr + i, from, from_len) == 0
&& (ptr->len == (i + from_len)
- || ! isalnum (ptr->ptr[i + from_len])))
+ || ! ISALNUM (ptr->ptr[i + from_len])))
depth++;
if (strncasecmp (ptr->ptr + i, to, to_len) == 0
&& (ptr->len == (i + to_len)
- || ! isalnum (ptr->ptr[i + to_len])))
+ || ! ISALNUM (ptr->ptr[i + to_len])))
{
depth--;
if (depth == 0)
sb *name;
{
if (idx < in->len
- && (isalpha ((unsigned char) in->ptr[idx])
+ && (ISALPHA (in->ptr[idx])
|| in->ptr[idx] == '_'
|| in->ptr[idx] == '$'))
{
sb_add_char (name, in->ptr[idx++]);
while (idx < in->len
- && (isalnum ((unsigned char) in->ptr[idx])
+ && (ISALNUM (in->ptr[idx])
|| in->ptr[idx] == '_'
|| in->ptr[idx] == '$'))
{
/* And stick it in the macro hash table. */
for (idx = 0; idx < name.len; idx++)
- if (isupper ((unsigned char) name.ptr[idx]))
- name.ptr[idx] = tolower (name.ptr[idx]);
+ name.ptr[idx] = TOLOWER (name.ptr[idx]);
namestr = sb_terminate (&name);
hash_jam (macro_hash, namestr, (PTR) macro);
sb_add_char (out, '&');
src++;
}
- else if (macro_mri
- && isalnum ((unsigned char) in->ptr[src]))
+ else if (macro_mri && ISALNUM (in->ptr[src]))
{
int ind;
formal_entry *f;
- if (isdigit ((unsigned char) in->ptr[src]))
+ if (ISDIGIT (in->ptr[src]))
ind = in->ptr[src] - '0';
- else if (isupper ((unsigned char) in->ptr[src]))
+ else if (ISUPPER (in->ptr[src]))
ind = in->ptr[src] - 'A' + 10;
else
ind = in->ptr[src] - 'a' + 10;
}
}
else if ((macro_alternate || macro_mri)
- && (isalpha ((unsigned char) in->ptr[src])
+ && (ISALPHA (in->ptr[src])
|| in->ptr[src] == '_'
|| in->ptr[src] == '$')
&& (! inquote
macro_entry *macro;
sb line_sb;
- if (! isalpha ((unsigned char) *line)
+ if (! ISALPHA (*line)
&& *line != '_'
&& *line != '$'
&& (! macro_mri || *line != '.'))
return 0;
s = line + 1;
- while (isalnum ((unsigned char) *s)
+ while (ISALNUM (*s)
|| *s == '_'
|| *s == '$')
++s;
memcpy (copy, line, s - line);
copy[s - line] = '\0';
for (cs = copy; *cs != '\0'; cs++)
- if (isupper ((unsigned char) *cs))
- *cs = tolower (*cs);
+ *cs = TOLOWER (*cs);
macro = (macro_entry *) hash_find (macro_hash, copy);
/* Routines that read assembler source text to build spagetti in memory.
Another group of these functions is in the expr.c module. */
-/* For isdigit (). */
-#include <ctype.h>
-
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "sb.h"
#include "macro.h"
while (*s2)
{
- if (isupper ((unsigned char) *s2))
- *s2 = tolower (*s2);
+ *s2 = TOLOWER (*s2);
s2++;
}
}
if (is_end_of_line[(unsigned char) c])
continue;
- if ((LOCAL_LABELS_DOLLAR || LOCAL_LABELS_FB)
- && isdigit ((unsigned char) c))
+ if ((LOCAL_LABELS_DOLLAR || LOCAL_LABELS_FB) && ISDIGIT (c))
{
/* local label ("4:") */
char *backup = input_line_pointer;
temp = c - '0';
/* Read the whole number. */
- while (isdigit ((unsigned char) *input_line_pointer))
+ while (ISDIGIT (*input_line_pointer))
{
temp = (temp * 10) + *input_line_pointer - '0';
++input_line_pointer;
SKIP_WHITESPACE ();
name = input_line_pointer;
- if (!isdigit ((unsigned char) *name))
+ if (!ISDIGIT (*name))
c = get_symbol_end ();
else
{
{
++input_line_pointer;
}
- while (isdigit ((unsigned char) *input_line_pointer));
+ while (ISDIGIT (*input_line_pointer));
c = *input_line_pointer;
*input_line_pointer = '\0';
SKIP_WHITESPACE ();
name = input_line_pointer;
- if (!isdigit ((unsigned char) *name))
+ if (!ISDIGIT (*name))
c = get_symbol_end ();
else
{
{
++input_line_pointer;
}
- while (isdigit ((unsigned char) *input_line_pointer));
+ while (ISDIGIT (*input_line_pointer));
c = *input_line_pointer;
*input_line_pointer = '\0';
if (*input_line_pointer == ',')
{
c = *++input_line_pointer;
- c = toupper ((unsigned char) c);
+ c = TOUPPER (c);
if (c == 'C' || c == 'D' || c == 'M' || c == 'R')
*type = c;
else
/* Skip any 0{letter} that may be present. Don't even check if the
* letter is legal. */
if (input_line_pointer[0] == '0'
- && isalpha ((unsigned char) input_line_pointer[1]))
+ && ISALPHA (input_line_pointer[1]))
input_line_pointer += 2;
/* Accept :xxxx, where the x's are hex digits, for a floating point
/* For suspect lines: gives warning. */
if (!is_end_of_line[(unsigned char) *input_line_pointer])
{
- if (isprint ((unsigned char) *input_line_pointer))
+ if (ISPRINT (*input_line_pointer))
as_warn (_("rest of line ignored; first ignored character is `%c'"),
*input_line_pointer);
else
has no use for such information. Lusers beware: you get
diagnostics if your input is ill-conditioned. */
if (input_line_pointer[0] == '0'
- && isalpha ((unsigned char) input_line_pointer[1]))
+ && ISALPHA (input_line_pointer[1]))
input_line_pointer += 2;
/* Accept :xxxx, where the x's are hex digits, for a floating
int i;
for (i = 0, number = 0;
- isdigit (c) && i < 3;
+ ISDIGIT (c) && i < 3;
c = *input_line_pointer++, i++)
{
number = number * 8 + c - '0';
number = 0;
c = *input_line_pointer++;
- while (isxdigit (c))
+ while (ISXDIGIT (c))
{
- if (isdigit (c))
+ if (ISDIGIT (c))
number = number * 16 + c - '0';
- else if (isupper (c))
+ else if (ISUPPER (c))
number = number * 16 + c - 'A' + 10;
else
number = number * 16 + c - 'a' + 10;
/* #define DEBUG_SYMS / * to debug symbol list maintenance. */
-#include <ctype.h>
-
#include "as.h"
+#include "safe-ctype.h"
#include "obstack.h" /* For "symbols.h" */
#include "subsegs.h"
if (! symbols_case_sensitive)
{
- unsigned char *s;
+ char *s;
- for (s = (unsigned char *) ret; *s != '\0'; s++)
- if (islower (*s))
- *s = toupper (*s);
+ for (s = ret; *s != '\0'; s++)
+ *s = TOUPPER (*s);
}
return ret;
while ((c = *orig++) != '\0')
{
- if (islower (c))
- c = toupper (c);
- *copy++ = c;
+ *copy++ = TOUPPER (c);
}
*copy = '\0';
}
if (s[index] != 'L')
return s;
- for (label_number = 0, p = s + index + 1; isdigit ((unsigned char) *p); ++p)
+ for (label_number = 0, p = s + index + 1; ISDIGIT (*p); ++p)
label_number = (10 * label_number) + *p - '0';
if (*p == DOLLAR_LABEL_CHAR)
else
return s;
- for (instance_number = 0, p++; isdigit ((unsigned char) *p); ++p)
+ for (instance_number = 0, p++; ISDIGIT (*p); ++p)
instance_number = (10 * instance_number) + *p - '0';
message_format = _("\"%d\" (instance number %d of a %s label)");
+2001-09-18 Bruno Haible <haible@clisp.cons.org>
+
+ * gprof.c (main): For gettext, also set the LC_CTYPE locate facet.
+ * sym_ids.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (parse_spec): Use ISDIGIT instead of isdigit.
+
2001-09-18 Alan Modra <amodra@bigpond.net.au>
* sparc.c (sparc_find_call): Warning fix.
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
+#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
\f
-#include <ctype.h>
-
#include "libiberty.h"
+#include "safe-ctype.h"
#include "cg_arcs.h"
#include "sym_ids.h"
if (strlen (spec))
{
- if (isdigit ((unsigned char) spec[0]))
+ if (ISDIGIT (spec[0]))
sym->line_num = atoi (spec);
else
sym->name = spec;
if (!sym->file)
sym->file = &non_existent_file;
}
- else if (isdigit ((unsigned char) *spec))
+ else if (ISDIGIT (*spec))
{
sym->line_num = atoi (spec);
}
+2001-09-18 Bruno Haible <haible@clisp.cons.org>
+
+ * deffilep.y: Include "safe-ctype.h" instead of <ctype.h>.
+ (def_file_add_directive): Use ISSPACE instead of isspace.
+ (def_lex): Use ISDIGIT/ISXDIGIT/ISALPHA/ISALNUM instead of
+ isdigit/isxdigit/isalpha/isalnum.
+ * emultempl/aix.em: Include "safe-ctype.h" instead of <ctype.h>.
+ (gld${EMULATION_NAME}_read_file): Use ISSPACE instead of isspace.
+ * emultempl/elf32.em: Include "safe-ctype.h" instead of <ctype.h>.
+ (gld${EMULATION_NAME}_place_orphan): Use ISALNUM instead of
+ isalnum.
+ * emultempl/gld960c.em: Include "safe-ctype.h" instead of <ctype.h>.
+ (gld960_set_output_arch): Use ISUPPER/TOLOWER instead of
+ isupper/tolower.
+ * emultempl/sunos.em: Include "safe-ctype.h" instead of <ctype.h>.
+ (gld${EMULATION_NAME}_search_dir): Use ISDIGIT instead of isdigit.
+ * ldctor.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (ctor_prio): Use ISDIGIT instead of isdigit.
+ * ldfile.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (ldfile_open_file_search): Use ISALPHA instead of isalpha.
+ (ldfile_add_arch): Use ISUPPER/TOLOWER instead of
+ isupper/tolower.
+ * ldlang.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (stricpy): Use TOLOWER instead of isupper/tolower.
+ (lang_leave_overlay_section): Use ISALNUM instead of isalnum.
+ * ldlex.l: Include "safe-ctype.h" instead of <ctype.h>.
+ (lex_warn_invalid): Use ISPRINT instead of isprint.
+ * ldmain.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (main): For gettext, also set the LC_CTYPE locate facet.
+ (add_keepsyms_file): Use ISSPACE instead of isspace.
+ * lexsup.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (is_num, parse_args): Use ISDIGIT instead of isdigit.
+ * mpw-elfmips.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (gldelf32ebmip_place_orphan): Use ISALNUM instead of isalnum.
+ * mpw-eppcmac.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (gldppcmacos_read_file): Use ISSPACE instead of isspace.
+ * pe-dll.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (quoteput): Use ISSPACE instead of isspace.
+ (pe_dll_generate_implib, pe_process_import_defs): Use ISALNUM
+ instead of isalnum.
+
2001-09-18 Alan Modra <amodra@bigpond.net.au>
* deffilep.y (def_stash_module): Constify "name" param.
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <stdio.h>
-#include <ctype.h>
#include "libiberty.h"
+#include "safe-ctype.h"
#include "bfd.h"
#include "sysdep.h"
#include "ld.h"
while (param < pend)
{
- while (param < pend && isspace (*param))
+ while (param < pend && ISSPACE (*param))
param++;
for (tend = param + 1;
- tend < pend && !(isspace (tend[-1]) && *tend == '-');
+ tend < pend && !(ISSPACE (tend[-1]) && *tend == '-');
tend++);
for (i = 0; diropts[i].param; i++)
/* must be something else */
saw_newline = 0;
- if (isdigit (c))
+ if (ISDIGIT (c))
{
bufptr = 0;
- while (c != EOF && (isxdigit (c) || (c == 'x')))
+ while (c != EOF && (ISXDIGIT (c) || (c == 'x')))
{
put_buf (c);
c = def_getc ();
return NUMBER;
}
- if (isalpha (c) || strchr ("$:-_?", c))
+ if (ISALPHA (c) || strchr ("$:-_?", c))
{
bufptr = 0;
- while (c != EOF && (isalnum (c) || strchr ("$:-_?/@", c)))
+ while (c != EOF && (ISALNUM (c) || strchr ("$:-_?/@", c)))
{
put_buf (c);
c = def_getc ();
#include "bfd.h"
#include "sysdep.h"
#include "libiberty.h"
+#include "safe-ctype.h"
#include "getopt.h"
#include "obstack.h"
#include "bfdlink.h"
-#include <ctype.h>
-
#include "ld.h"
#include "ldmain.h"
#include "ldmisc.h"
++lineno;
s = (char *) obstack_base (o);
- while (isspace ((unsigned char) *s))
+ while (ISSPACE (*s))
++s;
if (*s == '\0'
|| *s == '*'
if (*s == '#' && s[1] == '!')
{
s += 2;
- while (isspace ((unsigned char) *s))
+ while (ISSPACE (*s))
++s;
if (*s == '\0')
{
keep = true;
imppath = s;
file = NULL;
- while (! isspace ((unsigned char) *s) && *s != '(' && *s != '\0')
+ while (! ISSPACE (*s)
+ && *s != '(' && *s != '\0')
{
if (*s == '/')
file = s + 1;
}
cs = *s;
*s = '\0';
- while (isspace ((unsigned char) cs))
+ while (ISSPACE (cs))
{
++s;
cs = *s;
syscall_flag = 0;
address = (bfd_vma) -1;
- while (! isspace ((unsigned char) *s) && *s != '\0')
+ while (! ISSPACE (*s) && *s != '\0')
++s;
if (*s != '\0')
{
*s++ = '\0';
- while (isspace ((unsigned char) *s))
+ while (ISSPACE (*s))
++s;
se = s;
- while (! isspace ((unsigned char) *se) && *se != '\0')
+ while (! ISSPACE (*se) && *se != '\0')
++se;
if (*se != '\0')
{
*se++ = '\0';
- while (isspace ((unsigned char) *se))
+ while (ISSPACE (*se))
++se;
if (*se != '\0')
einfo ("%s%d: warning: syntax error in import/export file\n",
#include "bfd.h"
#include "sysdep.h"
#include "libiberty.h"
-
-#include <ctype.h>
+#include "safe-ctype.h"
#include "bfdlink.h"
/* If the name of the section is representable in C, then create
symbols to mark the start and the end of the section. */
for (ps = outsecname; *ps != '\0'; ps++)
- if (! isalnum ((unsigned char) *ps) && *ps != '_')
+ if (! ISALNUM (*ps) && *ps != '_')
break;
if (*ps == '\0')
{
*/
-#include <ctype.h>
#include "bfd.h"
#include "sysdep.h"
#include "libiberty.h"
+#include "safe-ctype.h"
#include "bfdlink.h"
#include "ld.h"
s = concat ("i960:", ldfile_output_machine_name, (char *) NULL);
for (s1 = s; *s1 != '\0'; s1++)
- if (isupper ((unsigned char) *s1))
- *s1 = tolower ((unsigned char) *s1);
+ *s1 = TOLOWER (*s1);
ldfile_set_output_arch (s);
free (s);
}
#define TARGET_IS_${EMULATION_NAME}
-#include <ctype.h>
-
#include "bfd.h"
#include "sysdep.h"
#include "bfdlink.h"
#include "libiberty.h"
+#include "safe-ctype.h"
#include "ld.h"
#include "ldmain.h"
if (entry->d_name[6 + len] == '\0')
;
else if (entry->d_name[6 + len] == '.'
- && isdigit ((unsigned char) entry->d_name[7 + len]))
+ && ISDIGIT (entry->d_name[7 + len]))
;
else
continue;
for (s = entry->d_name + 6 + len; *s != '\0'; s++)
- if (*s != '.' && ! isdigit ((unsigned char) *s))
+ if (*s != '.' && ! ISDIGIT (*s))
break;
if (*s != '\0')
continue;
/* ldctor.c -- constructor support routines
- Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
+ Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
By Steve Chamberlain <sac@cygnus.com>
#include "bfd.h"
#include "sysdep.h"
#include "bfdlink.h"
-
-#include <ctype.h>
+#include "safe-ctype.h"
#include "ld.h"
#include "ldexp.h"
return -1;
if (name[1] != 'I' && name[1] != 'D')
return -1;
- if (! isdigit ((unsigned char) name[3]))
+ if (! ISDIGIT (name[3]))
return -1;
return atoi (name + 3);
#include "bfd.h"
#include "sysdep.h"
#include "bfdlink.h"
+#include "safe-ctype.h"
#include "ld.h"
#include "ldmisc.h"
#include "ldexp.h"
#include "ldemul.h"
#include "libiberty.h"
-#include <ctype.h>
-
const char *ldfile_input_filename;
boolean ldfile_assumed_script = false;
const char *ldfile_output_machine_name = "";
else if (entry->filename[0] == '/' || entry->filename[0] == '.'
#if defined (__MSDOS__) || defined (_WIN32)
|| entry->filename[0] == '\\'
- || (isalpha (entry->filename[0])
+ || (ISALPHA (entry->filename[0])
&& entry->filename[1] == ':')
#endif
)
new->next = (search_arch_type *) NULL;
while (*name)
{
- if (isupper ((unsigned char) *name))
- *name = tolower ((unsigned char) *name);
+ *name = TOLOWER (*name);
name++;
}
*search_arch_tail_ptr = new;
#include "bfd.h"
#include "sysdep.h"
#include "libiberty.h"
+#include "safe-ctype.h"
#include "obstack.h"
#include "bfdlink.h"
#include "fnmatch.h"
#include "demangle.h"
-#include <ctype.h>
-
/* FORWARDS */
static lang_statement_union_type *new_statement
PARAMS ((enum statement_enum, size_t, lang_statement_list_type *));
char c;
while ((c = *src++) != 0)
- {
- if (isupper ((unsigned char) c))
- c = tolower (c);
-
- *dest++ = c;
- }
+ *dest++ = TOLOWER (c);
*dest = 0;
}
clean = xmalloc (strlen (name) + 1);
s2 = clean;
for (s1 = name; *s1 != '\0'; s1++)
- if (isalnum ((unsigned char) *s1) || *s1 == '_')
+ if (ISALNUM (*s1) || *s1 == '_')
*s2++ = *s1;
*s2 = '\0';
%{
-/* Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
+/* Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
This file is part of GLD, the Gnu Linker.
#include <ansidecl.h>
#include <stdio.h>
-#include <ctype.h>
#ifdef MPW
/* Prevent enum redefinition problems. */
#include "bfd.h"
#include "sysdep.h"
+#include "safe-ctype.h"
#include "ld.h"
#include "ldgram.h"
#include "ldmisc.h"
einfo ("%F%s: file not recognized: %E\n", ldfile_input_filename);
}
- if (! isprint ((unsigned char) *what))
+ if (! ISPRINT (*what))
{
sprintf (buf, "\\%03o", (unsigned int) *what);
what = buf;
/* Main program of GNU linker.
- Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
+ Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
Written by Steve Chamberlain steve@cygnus.com
#include "bfd.h"
#include "sysdep.h"
#include <stdio.h>
-#include <ctype.h>
+#include "safe-ctype.h"
#include "libiberty.h"
#include "progress.h"
#include "bfdlink.h"
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
+#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
c = getc (file);
while (c != EOF)
{
- while (isspace (c))
+ while (ISSPACE (c))
c = getc (file);
if (c != EOF)
{
size_t len = 0;
- while (! isspace (c) && c != EOF)
+ while (! ISSPACE (c) && c != EOF)
{
buf[len] = c;
++len;
#include "libiberty.h"
#include <stdio.h>
#include <string.h>
-#include <ctype.h>
+#include "safe-ctype.h"
#include "getopt.h"
#include "bfdlink.h"
#include "ld.h"
for (; *string; ++string)
{
- if (! isdigit (*string))
+ if (! ISDIGIT (*string))
{
result = err;
break;
for (i = 1; i < argc; i++)
if (strcmp (argv[i], "-G") == 0
&& (i + 1 >= argc
- || ! isdigit ((unsigned char) argv[i + 1][0])))
+ || ! ISDIGIT (argv[i + 1][0])))
argv[i] = (char *) "--shared";
/* Because we permit long options to start with a single dash, and
#include "bfd.h"
#include "sysdep.h"
-
-#include <ctype.h>
+#include "safe-ctype.h"
#include "bfdlink.h"
/* If the name of the section is representable in C, then create
symbols to mark the start and the end of the section. */
for (ps = secname; *ps != '\0'; ps++)
- if (! isalnum (*ps) && *ps != '_')
+ if (! ISALNUM (*ps) && *ps != '_')
break;
if (*ps == '\0' && config.build_constructors)
{
/* This file is is generated by a shell script. DO NOT EDIT! */
/* AIX emulation code for ppcmacos
- Copyright 1991, 1993, 1995, 1996, 1997, 2000
+ Copyright 1991, 1993, 1995, 1996, 1997, 2000, 2001
Free Software Foundation, Inc.
Written by Steve Chamberlain <sac@cygnus.com>
AIX support by Ian Lance Taylor <ian@cygnus.com>
#include "bfd.h"
#include "sysdep.h"
#include "libiberty.h"
+#include "safe-ctype.h"
#include "getopt.h"
#include "bfdlink.h"
-#include <ctype.h>
-
#include "ld.h"
#include "ldmain.h"
#include "ldmisc.h"
++lineno;
s = (char *) obstack_base (o);
- while (isspace ((unsigned char) *s))
+ while (ISSPACE (*s))
++s;
if (*s == '\0'
|| *s == '*'
if (*s == '#' && s[1] == '!')
{
s += 2;
- while (isspace ((unsigned char) *s))
+ while (ISSPACE (*s))
++s;
if (*s == '\0')
{
keep = true;
imppath = s;
file = NULL;
- while (! isspace ((unsigned char) *s) && *s != '(' && *s != '\0')
+ while (! ISSPACE (*s) && *s != '(' && *s != '\0')
{
if (*s == '/')
file = s + 1;
}
cs = *s;
*s = '\0';
- while (isspace ((unsigned char) cs))
+ while (ISSPACE (cs))
{
++s;
cs = *s;
syscall = false;
address = (bfd_vma) -1;
- while (! isspace ((unsigned char) *s) && *s != '\0')
+ while (! ISSPACE (*s) && *s != '\0')
++s;
if (*s != '\0')
{
*s++ = '\0';
- while (isspace ((unsigned char) *s))
+ while (ISSPACE (*s))
++s;
se = s;
- while (! isspace ((unsigned char) *se) && *se != '\0')
+ while (! ISSPACE (*se) && *se != '\0')
++se;
if (*se != '\0')
{
*se++ = '\0';
- while (isspace ((unsigned char) *se))
+ while (ISSPACE (*se))
++se;
if (*se != '\0')
einfo (_("%s%d: warning: syntax error in import/export file\n"),
#include "sysdep.h"
#include "bfdlink.h"
#include "libiberty.h"
+#include "safe-ctype.h"
#include <time.h>
-#include <ctype.h>
#include "ld.h"
#include "ldexp.h"
if (*cp == '\''
|| *cp == '"'
|| *cp == '\\'
- || isspace ((unsigned char) *cp)
+ || ISSPACE (*cp)
|| *cp == ','
|| *cp == ';')
needs_quotes = 1;
dll_filename = (def->name) ? def->name : dll_name;
dll_symname = xstrdup (dll_filename);
for (i = 0; dll_symname[i]; i++)
- if (!isalnum ((unsigned char) dll_symname[i]))
+ if (!ISALNUM (dll_symname[i]))
dll_symname[i] = '_';
unlink (impfilename);
dll_filename = module->name;
dll_symname = xstrdup (module->name);
for (i = 0; dll_symname[i]; i++)
- if (!isalnum (dll_symname[i]))
+ if (!ISALNUM (dll_symname[i]))
dll_symname[i] = '_';
do_this_dll = 0;
+2001-09-18 Bruno Haible <haible@clisp.cons.org>
+
+ * cgen-asm.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (cgen_parse_keyword): Use ISALNUM instead of isalnum.
+ * cgen-opc.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (cgen_keyword_lookup_name): Use ISALPHA/TOLOWER instead of
+ isalpha/tolower.
+ (cgen_keyword_add): Use ISALNUM instead of isalnum.
+ (hash_keyword_name): Use TOLOWER instead of tolower.
+ * fr30-asm.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (parse_insn_normal): Use TOLOWER/ISSPACE instead of
+ tolower/isspace.
+ (fr30_cgen_assemble_insn): Use ISSPACE instead of isspace.
+ * fr30-desc.c: Don't include <ctype.h>.
+ * fr30-ibld.c: Likewise.
+ * ia64-gen.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (load_insn_classes, parse_resource_users, load_depfile): Use
+ ISSPACE instead of isspace.
+ * m32r-asm.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (parse_insn_normal): Use TOLOWER/ISSPACE instead of
+ tolower/isspace.
+ (m32r_cgen_assemble_insn): Use ISSPACE instead of isspace.
+ * m32r-desc.c: Don't include <ctype.h>.
+ * m32r-ibld.c: Likewise.
+ * openrisc-asm.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (parse_insn_normal): Use TOLOWER/ISSPACE instead of
+ tolower/isspace.
+ (openrisc_cgen_assemble_insn): Use ISSPACE instead of isspace.
+
2001-09-18 Martin Schwidefsky <schwidefsky@de.ibm.com>
* Makefile.am: Add rules and dependencies to create the s/390 opcode
/* CGEN generic assembler support code.
- Copyright 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU Binutils and GDB, the GNU debugger.
#include "sysdep.h"
#include <stdio.h>
-#include <ctype.h>
#include "ansidecl.h"
#include "libiberty.h"
+#include "safe-ctype.h"
#include "bfd.h"
#include "symcat.h"
#include "opcode/cgen.h"
/* Allow letters, digits, and any special characters. */
while (((p - start) < (int) sizeof (buf))
&& *p
- && (isalnum ((unsigned char) *p)
- || strchr (keyword_table->nonalpha_chars, *p)))
+ && (ISALNUM (*p) || strchr (keyword_table->nonalpha_chars, *p)))
++p;
if (p - start >= (int) sizeof (buf))
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "sysdep.h"
-#include <ctype.h>
#include <stdio.h>
#include "ansidecl.h"
#include "libiberty.h"
+#include "safe-ctype.h"
#include "bfd.h"
#include "symcat.h"
#include "opcode/cgen.h"
while (*p
&& (*p == *n
- || (isalpha ((unsigned char) *p)
- && (tolower ((unsigned char) *p)
- == tolower ((unsigned char) *n)))))
+ || (ISALPHA (*p) && (TOLOWER (*p) == TOLOWER (*n)))))
++n, ++p;
if (!*p && !*n)
kt->null_entry = ke;
for (i = 1; i < strlen (ke->name); i++)
- if (! isalnum ((unsigned char) ke->name[i])
+ if (! ISALNUM (ke->name[i])
&& ! strchr (kt->nonalpha_chars, ke->name[i]))
{
size_t idx = strlen (kt->nonalpha_chars);
hash = (hash * 97) + (unsigned char) *name;
else
for (hash = 0; *name; ++name)
- hash = (hash * 97) + (unsigned char) tolower (*name);
+ hash = (hash * 97) + (unsigned char) TOLOWER (*name);
return hash % kt->hash_table_size;
}
Keep that in mind. */
#include "sysdep.h"
-#include <ctype.h>
#include <stdio.h>
#include "ansidecl.h"
+#include "safe-ctype.h"
#include "bfd.h"
#include "symcat.h"
#include "fr30-desc.h"
GAS's input scrubber will ensure mnemonics are lowercase, but we may
not be called from GAS. */
p = CGEN_INSN_MNEMONIC (insn);
- while (*p && tolower (*p) == tolower (*str))
+ while (*p && TOLOWER (*p) == TOLOWER (*str))
++p, ++str;
if (* p)
return _("unrecognized instruction");
#ifndef CGEN_MNEMONIC_OPERANDS
- if (* str && !isspace (* str))
+ if (* str && !ISSPACE (* str))
return _("unrecognized instruction");
#endif
first char after the mnemonic part is a space. */
/* FIXME: We also take inappropriate advantage of the fact that
GAS's input scrubber will remove extraneous blanks. */
- if (tolower (*str) == tolower (CGEN_SYNTAX_CHAR (* syn)))
+ if (TOLOWER (*str) == TOLOWER (CGEN_SYNTAX_CHAR (* syn)))
{
#ifdef CGEN_MNEMONIC_OPERANDS
if (CGEN_SYNTAX_CHAR(* syn) == ' ')
blanks now. IE: We needn't try again with a longer version of
the insn and it is assumed that longer versions of insns appear
before shorter ones (eg: lsr r2,r3,1 vs lsr r2,r3). */
- while (isspace (* str))
+ while (ISSPACE (* str))
++ str;
if (* str != '\0')
int recognized_mnemonic = 0;
/* Skip leading white space. */
- while (isspace (* str))
+ while (ISSPACE (* str))
++ str;
/* The instructions are stored in hashed lists.
*/
#include "sysdep.h"
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "ansidecl.h"
Keep that in mind. */
#include "sysdep.h"
-#include <ctype.h>
#include <stdio.h>
#include "ansidecl.h"
#include "dis-asm.h"
/* ia64-gen.c -- Generate a shrunk set of opcode tables
- Copyright 1999, 2000 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
Written by Bob Manson, Cygnus Solutions, <manson@cygnus.com>
This file is part of GDB, GAS, and the GNU binutils.
*/
#include <stdio.h>
-#include <ctype.h>
#include "ansidecl.h"
#include "libiberty.h"
+#include "safe-ctype.h"
#include "sysdep.h"
#include "ia64-opc.h"
#include "ia64-opc-a.c"
if (fgets (buf, sizeof(buf), fp) == NULL)
break;
- while (isspace(buf[strlen(buf)-1]))
+ while (ISSPACE (buf[strlen(buf)-1]))
buf[strlen(buf)-1] = '\0';
name = tmp = buf;
char *subname;
int sub;
- while (*tmp && isspace(*tmp))
+ while (*tmp && ISSPACE (*tmp))
{
++tmp;
if (tmp == buf + sizeof(buf))
int create = 0;
char *name;
- while (isspace(*tmp))
+ while (ISSPACE (*tmp))
++tmp;
name = tmp;
while (*tmp && *tmp != ',')
if (fgets (buf, sizeof(buf), fp) == NULL)
break;
- while (isspace(buf[strlen(buf)-1]))
+ while (ISSPACE (buf[strlen(buf)-1]))
buf[strlen(buf)-1] = '\0';
name = tmp = buf;
++tmp;
*tmp++ = '\0';
- while (isspace (*tmp))
+ while (ISSPACE (*tmp))
++tmp;
regp = tmp;
tmp = strchr (tmp, ';');
if (!tmp)
abort ();
*tmp++ = 0;
- while (isspace (*tmp))
+ while (ISSPACE (*tmp))
++tmp;
chkp = tmp;
tmp = strchr (tmp, ';');
if (!tmp)
abort ();
*tmp++ = 0;
- while (isspace (*tmp))
+ while (ISSPACE (*tmp))
++tmp;
semantics = parse_semantics (tmp);
extra = semantics == IA64_DVS_OTHER ? xstrdup (tmp) : NULL;
Keep that in mind. */
#include "sysdep.h"
-#include <ctype.h>
#include <stdio.h>
#include "ansidecl.h"
+#include "safe-ctype.h"
#include "bfd.h"
#include "symcat.h"
#include "m32r-desc.h"
GAS's input scrubber will ensure mnemonics are lowercase, but we may
not be called from GAS. */
p = CGEN_INSN_MNEMONIC (insn);
- while (*p && tolower (*p) == tolower (*str))
+ while (*p && TOLOWER (*p) == TOLOWER (*str))
++p, ++str;
if (* p)
return _("unrecognized instruction");
#ifndef CGEN_MNEMONIC_OPERANDS
- if (* str && !isspace (* str))
+ if (* str && !ISSPACE (* str))
return _("unrecognized instruction");
#endif
first char after the mnemonic part is a space. */
/* FIXME: We also take inappropriate advantage of the fact that
GAS's input scrubber will remove extraneous blanks. */
- if (tolower (*str) == tolower (CGEN_SYNTAX_CHAR (* syn)))
+ if (TOLOWER (*str) == TOLOWER (CGEN_SYNTAX_CHAR (* syn)))
{
#ifdef CGEN_MNEMONIC_OPERANDS
if (CGEN_SYNTAX_CHAR(* syn) == ' ')
blanks now. IE: We needn't try again with a longer version of
the insn and it is assumed that longer versions of insns appear
before shorter ones (eg: lsr r2,r3,1 vs lsr r2,r3). */
- while (isspace (* str))
+ while (ISSPACE (* str))
++ str;
if (* str != '\0')
int recognized_mnemonic = 0;
/* Skip leading white space. */
- while (isspace (* str))
+ while (ISSPACE (* str))
++ str;
/* The instructions are stored in hashed lists.
*/
#include "sysdep.h"
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "ansidecl.h"
Keep that in mind. */
#include "sysdep.h"
-#include <ctype.h>
#include <stdio.h>
#include "ansidecl.h"
#include "dis-asm.h"
Keep that in mind. */
#include "sysdep.h"
-#include <ctype.h>
#include <stdio.h>
#include "ansidecl.h"
+#include "safe-ctype.h"
#include "bfd.h"
#include "symcat.h"
#include "openrisc-desc.h"
GAS's input scrubber will ensure mnemonics are lowercase, but we may
not be called from GAS. */
p = CGEN_INSN_MNEMONIC (insn);
- while (*p && tolower (*p) == tolower (*str))
+ while (*p && TOLOWER (*p) == TOLOWER (*str))
++p, ++str;
if (* p)
return _("unrecognized instruction");
#ifndef CGEN_MNEMONIC_OPERANDS
- if (* str && !isspace (* str))
+ if (* str && !ISSPACE (* str))
return _("unrecognized instruction");
#endif
first char after the mnemonic part is a space. */
/* FIXME: We also take inappropriate advantage of the fact that
GAS's input scrubber will remove extraneous blanks. */
- if (tolower (*str) == tolower (CGEN_SYNTAX_CHAR (* syn)))
+ if (TOLOWER (*str) == TOLOWER (CGEN_SYNTAX_CHAR (* syn)))
{
#ifdef CGEN_MNEMONIC_OPERANDS
if (CGEN_SYNTAX_CHAR(* syn) == ' ')
blanks now. IE: We needn't try again with a longer version of
the insn and it is assumed that longer versions of insns appear
before shorter ones (eg: lsr r2,r3,1 vs lsr r2,r3). */
- while (isspace (* str))
+ while (ISSPACE (* str))
++ str;
if (* str != '\0')
int recognized_mnemonic = 0;
/* Skip leading white space. */
- while (isspace (* str))
+ while (ISSPACE (* str))
++ str;
/* The instructions are stored in hashed lists.