Locale changes from Bruno Haible <haible@clisp.cons.org>.

This commit is contained in:
H.J. Lu 2001-09-19 05:33:36 +00:00
parent 6b819c92c4
commit 3882b01078
129 changed files with 1200 additions and 836 deletions

View file

@ -1,3 +1,48 @@
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> 2001-09-18 Alan Modra <amodra@bigpond.net.au>
* libbfd.c (bfd_bread): New function replacing bfd_read without * libbfd.c (bfd_bread): New function replacing bfd_read without

View file

@ -120,9 +120,9 @@ DESCRIPTION
#define KEEPIT udata.i #define KEEPIT udata.i
#include <ctype.h>
#include "bfd.h" #include "bfd.h"
#include "sysdep.h" #include "sysdep.h"
#include "safe-ctype.h"
#include "bfdlink.h" #include "bfdlink.h"
#include "libaout.h" #include "libaout.h"
@ -4407,7 +4407,7 @@ aout_link_write_symbols (finfo, input_bfd)
{ {
/* Skip the file number. */ /* Skip the file number. */
++s; ++s;
while (isdigit ((unsigned char) *s)) while (ISDIGIT (*s))
++s; ++s;
--s; --s;
} }

View file

@ -132,7 +132,7 @@ DESCRIPTION
#include "libbfd.h" #include "libbfd.h"
#include "aout/ar.h" #include "aout/ar.h"
#include "aout/ranlib.h" #include "aout/ranlib.h"
#include <ctype.h> #include "safe-ctype.h"
#ifndef errno #ifndef errno
extern int errno; extern int errno;
@ -407,7 +407,7 @@ _bfd_generic_read_ar_hdr_mag (abfd, mag)
else if (hdr.ar_name[0] == '#' else if (hdr.ar_name[0] == '#'
&& hdr.ar_name[1] == '1' && hdr.ar_name[1] == '1'
&& hdr.ar_name[2] == '/' && hdr.ar_name[2] == '/'
&& isdigit ((unsigned char) hdr.ar_name[3])) && ISDIGIT (hdr.ar_name[3]))
{ {
/* BSD-4.4 extended name */ /* BSD-4.4 extended name */
namelen = atoi (&hdr.ar_name[3]); namelen = atoi (&hdr.ar_name[3]);

View file

@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h" #include "bfd.h"
#include "sysdep.h" #include "sysdep.h"
#include "libbfd.h" #include "libbfd.h"
#include <ctype.h> #include "safe-ctype.h"
/* /*
@ -813,7 +813,7 @@ bfd_default_scan (info, string)
} }
number = 0; number = 0;
while (isdigit ((unsigned char) *ptr_src)) while (ISDIGIT (*ptr_src))
{ {
number = number * 10 + *ptr_src - '0'; number = number * 10 + *ptr_src - '0';
ptr_src++; ptr_src++;

View file

@ -203,6 +203,7 @@ CODE_FRAGMENT
#endif #endif
#include "libiberty.h" #include "libiberty.h"
#include "safe-ctype.h"
#include "bfdlink.h" #include "bfdlink.h"
#include "libbfd.h" #include "libbfd.h"
#include "coff/internal.h" #include "coff/internal.h"
@ -211,8 +212,6 @@ CODE_FRAGMENT
#include "libecoff.h" #include "libecoff.h"
#undef obj_symbols #undef obj_symbols
#include "elf-bfd.h" #include "elf-bfd.h"
#include <ctype.h>
/* provide storage for subsystem, stack and heap data which may have been /* 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 passed in on the command line. Ld puts this data into a bfd_link_info
@ -1034,10 +1033,10 @@ bfd_scan_vma (string, end, base)
/* Speed could be improved with a table like hex_value[] in gas. */ /* Speed could be improved with a table like hex_value[] in gas. */
#define HEX_VALUE(c) \ #define HEX_VALUE(c) \
(isxdigit ((unsigned char) c) \ (ISXDIGIT (c) \
? (isdigit ((unsigned char) c) \ ? (ISDIGIT (c) \
? (c - '0') \ ? (c - '0') \
: (10 + c - (islower ((unsigned char) c) ? 'a' : 'A'))) \ : (10 + c - (ISLOWER (c) ? 'a' : 'A'))) \
: 42) : 42)
for (value = 0; (digit = HEX_VALUE (* string)) < base; string ++) for (value = 0; (digit = HEX_VALUE (* string)) < base; string ++)

View file

@ -32,8 +32,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
the file. objcopy cooperates by specially setting the start the file. objcopy cooperates by specially setting the start
address to zero by default. */ address to zero by default. */
#include <ctype.h> #include "safe-ctype.h"
#include "bfd.h" #include "bfd.h"
#include "sysdep.h" #include "sysdep.h"
#include "libbfd.h" #include "libbfd.h"
@ -167,7 +166,7 @@ mangle_name (abfd, suffix)
/* Change any non-alphanumeric characters to underscores. */ /* Change any non-alphanumeric characters to underscores. */
for (p = buf; *p; p++) for (p = buf; *p; p++)
if (! isalnum ((unsigned char) *p)) if (! ISALNUM (*p))
*p = '_'; *p = '_';
return buf; return buf;

View file

@ -20,8 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h" #include "bfd.h"
#include "sysdep.h" #include "sysdep.h"
#include "libbfd.h" #include "libbfd.h"
#include "safe-ctype.h"
#include <ctype.h>
static boolean scan PARAMS ((const struct bfd_arch_info *, const char *)); static boolean scan PARAMS ((const struct bfd_arch_info *, const char *));
@ -59,7 +58,7 @@ scan (info, string)
return info->the_default; return info->the_default;
number = 0; number = 0;
while (isdigit ((unsigned char) *ptr_src)) while (ISDIGIT (*ptr_src))
{ {
number = number * 10 + * ptr_src - '0'; number = number * 10 + * ptr_src - '0';
ptr_src ++; ptr_src ++;

View file

@ -1,5 +1,5 @@
/* alphavms.h -- BFD definitions for an openVMS host /* 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) Written by Klaus Kämpf (kkaempf@progis.de)
of proGIS Softwareentwicklung, Aachen, Germany of proGIS Softwareentwicklung, Aachen, Germany
@ -25,7 +25,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <stdio.h> #include <stdio.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <ctype.h>
#include <string.h> #include <string.h>
#include <sys/file.h> #include <sys/file.h>
#include <stdlib.h> #include <stdlib.h>

View file

@ -32,8 +32,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "libbfd.h" #include "libbfd.h"
#include "ieee.h" #include "ieee.h"
#include "libieee.h" #include "libieee.h"
#include "safe-ctype.h"
#include <ctype.h>
struct output_buffer_struct struct output_buffer_struct
{ {
@ -1626,12 +1625,12 @@ ieee_object_p (abfd)
strcpy (family, "68332"); /* Guess it will be CPU32 */ strcpy (family, "68332"); /* Guess it will be CPU32 */
} }
} }
else if (toupper (processor[3]) == 'F') /* 68F333 */ else if (TOUPPER (processor[3]) == 'F') /* 68F333 */
strcpy (family, "68332"); /* CPU32 */ strcpy (family, "68332"); /* CPU32 */
else if ((toupper (processor[3]) == 'C') /* Embedded controllers */ else if ((TOUPPER (processor[3]) == 'C') /* Embedded controllers */
&& ((toupper (processor[2]) == 'E') && ((TOUPPER (processor[2]) == 'E')
|| (toupper (processor[2]) == 'H') || (TOUPPER (processor[2]) == 'H')
|| (toupper (processor[2]) == 'L'))) || (TOUPPER (processor[2]) == 'L')))
{ {
strcpy (family, "68"); strcpy (family, "68");
strncat (family, processor + 4, 7); strncat (family, processor + 4, 7);

View file

@ -123,8 +123,7 @@ The MRI compiler uses this, which is a repeat of type 5:
#include "sysdep.h" #include "sysdep.h"
#include "libbfd.h" #include "libbfd.h"
#include "libiberty.h" #include "libiberty.h"
#include "safe-ctype.h"
#include <ctype.h>
static void ihex_init PARAMS ((void)); static void ihex_init PARAMS ((void));
static boolean ihex_mkobject PARAMS ((bfd *)); static boolean ihex_mkobject PARAMS ((bfd *));
@ -249,7 +248,7 @@ ihex_bad_byte (abfd, lineno, c, error)
{ {
char buf[10]; char buf[10];
if (! isprint (c)) if (! ISPRINT (c))
sprintf (buf, "\\%03o", (unsigned int) c); sprintf (buf, "\\%03o", (unsigned int) c);
else else
{ {

View file

@ -26,8 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "libbfd.h" #include "libbfd.h"
#include "hashtab.h" #include "hashtab.h"
#include <ctype.h>
struct sec_merge_sec_info; struct sec_merge_sec_info;
/* An entry in the section merge hash table. */ /* An entry in the section merge hash table. */

View file

@ -22,7 +22,7 @@
#define UNDERSCORE_HACK 1 #define UNDERSCORE_HACK 1
#include "bfd.h" #include "bfd.h"
#include "sysdep.h" #include "sysdep.h"
#include <ctype.h> #include "safe-ctype.h"
#include "libbfd.h" #include "libbfd.h"
#include "oasys.h" #include "oasys.h"
#include "liboasys.h" #include "liboasys.h"
@ -1030,7 +1030,7 @@ oasys_write_sections (abfd)
for (s = abfd->sections; s != (asection *) NULL; s = s->next) 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) (*_bfd_error_handler)
(_("%s: can not represent section `%s' in oasys"), (_("%s: can not represent section `%s' in oasys"),

View file

@ -304,9 +304,9 @@ DESCRIPTION
#define KEEPIT udata.i #define KEEPIT udata.i
#include <string.h> /* For strchr and friends */ #include <string.h> /* For strchr and friends */
#include <ctype.h>
#include "bfd.h" #include "bfd.h"
#include "sysdep.h" #include "sysdep.h"
#include "safe-ctype.h"
#include "bfdlink.h" #include "bfdlink.h"
#include "libaout.h" #include "libaout.h"
@ -4176,7 +4176,7 @@ aout_link_write_symbols (finfo, input_bfd)
{ {
/* Skip the file number. */ /* Skip the file number. */
++s; ++s;
while (isdigit ((unsigned char) *s)) while (ISDIGIT (*s))
++s; ++s;
--s; --s;
} }

View file

@ -32,8 +32,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
the file. objcopy cooperates by specially setting the start the file. objcopy cooperates by specially setting the start
address to zero by default. */ address to zero by default. */
#include <ctype.h> #include "safe-ctype.h"
#include "bfd.h" #include "bfd.h"
#include "sysdep.h" #include "sysdep.h"
#include "libbfd.h" #include "libbfd.h"
@ -279,7 +278,7 @@ mangle_name (abfd, suffix)
/* Change any non-alphanumeric characters to underscores. */ /* Change any non-alphanumeric characters to underscores. */
for (p = buf; *p; p++) for (p = buf; *p; p++)
if (! isalnum ((unsigned char) *p)) if (! ISALNUM (*p))
*p = '_'; *p = '_';
return buf; return buf;

View file

@ -31,12 +31,12 @@
#include "libbfd.h" #include "libbfd.h"
#include "som.h" #include "som.h"
#include "safe-ctype.h"
#include <sys/param.h> #include <sys/param.h>
#include <signal.h> #include <signal.h>
#include <machine/reg.h> #include <machine/reg.h>
#include <sys/file.h> #include <sys/file.h>
#include <ctype.h>
/* Magic not defined in standard HP-UX header files until 8.0 */ /* Magic not defined in standard HP-UX header files until 8.0 */
@ -4672,13 +4672,13 @@ som_set_reloc_info (fixup, end, internal_relocs, section, symbols, just_count)
c = *cp++; c = *cp++;
/* If this is a variable, push it on the stack. */ /* If this is a variable, push it on the stack. */
if (isupper (c)) if (ISUPPER (c))
push (var (c)); push (var (c));
/* If this is a lower case letter, then it represents /* If this is a lower case letter, then it represents
additional data from the fixup stream to be pushed onto additional data from the fixup stream to be pushed onto
the stack. */ the stack. */
else if (islower (c)) else if (ISLOWER (c))
{ {
int bits = (c - 'a') * 8; int bits = (c - 'a') * 8;
for (v = 0; c > 'a'; --c) for (v = 0; c > 'a'; --c)
@ -4689,10 +4689,10 @@ som_set_reloc_info (fixup, end, internal_relocs, section, symbols, just_count)
} }
/* A decimal constant. Push it on the stack. */ /* A decimal constant. Push it on the stack. */
else if (isdigit (c)) else if (ISDIGIT (c))
{ {
v = c - '0'; v = c - '0';
while (isdigit (*cp)) while (ISDIGIT (*cp))
v = (v * 10) + (*cp++ - '0'); v = (v * 10) + (*cp++ - '0');
push (v); push (v);
} }
@ -5438,7 +5438,7 @@ som_decode_symclass (symbol)
else else
return '?'; return '?';
if (symbol->flags & BSF_GLOBAL) if (symbol->flags & BSF_GLOBAL)
c = toupper (c); c = TOUPPER (c);
return c; return c;
} }

View file

@ -108,7 +108,7 @@ DESCRIPTION
#include "sysdep.h" #include "sysdep.h"
#include "libbfd.h" #include "libbfd.h"
#include "libiberty.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_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *));
static void srec_print_symbol static void srec_print_symbol
@ -291,7 +291,7 @@ srec_bad_byte (abfd, lineno, c, error)
{ {
char buf[10]; char buf[10];
if (! isprint (c)) if (! ISPRINT (c))
sprintf (buf, "\\%03o", (unsigned int) c); sprintf (buf, "\\%03o", (unsigned int) c);
else else
{ {
@ -418,7 +418,7 @@ srec_scan (abfd)
*p++ = c; *p++ = c;
while ((c = srec_get_byte (abfd, &error)) != EOF while ((c = srec_get_byte (abfd, &error)) != EOF
&& ! isspace (c)) && ! ISSPACE (c))
{ {
if ((bfd_size_type) (p - symbuf) >= alc) if ((bfd_size_type) (p - symbuf) >= alc)
{ {

View file

@ -26,8 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "sysdep.h" #include "sysdep.h"
#include "libbfd.h" #include "libbfd.h"
#include "aout/stab_gnu.h" #include "aout/stab_gnu.h"
#include "safe-ctype.h"
#include <ctype.h>
/* Stabs entries use a 12 byte format: /* Stabs entries use a 12 byte format:
4 byte string table index 4 byte string table index
@ -364,7 +363,7 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo)
{ {
/* Skip the file number. */ /* Skip the file number. */
++str; ++str;
while (isdigit ((unsigned char) *str)) while (ISDIGIT (*str))
++str; ++str;
--str; --str;
} }

View file

@ -308,6 +308,7 @@ CODE_FRAGMENT
#include "bfd.h" #include "bfd.h"
#include "sysdep.h" #include "sysdep.h"
#include "libbfd.h" #include "libbfd.h"
#include "safe-ctype.h"
#include "bfdlink.h" #include "bfdlink.h"
#include "aout/stab_gnu.h" #include "aout/stab_gnu.h"
@ -556,13 +557,6 @@ coff_section_type (s)
return '?'; return '?';
} }
#ifndef islower
#define islower(c) ((c) >= 'a' && (c) <= 'z')
#endif
#ifndef toupper
#define toupper(c) (islower(c) ? ((c) & ~0x20) : (c))
#endif
/* /*
FUNCTION FUNCTION
bfd_decode_symclass bfd_decode_symclass
@ -617,7 +611,7 @@ bfd_decode_symclass (symbol)
else else
return '?'; return '?';
if (symbol->flags & BSF_GLOBAL) if (symbol->flags & BSF_GLOBAL)
c = toupper (c); c = TOUPPER (c);
return c; return c;
/* We don't have to handle these cases just yet, but we will soon: /* We don't have to handle these cases just yet, but we will soon:

View file

@ -21,8 +21,6 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <ctype.h>
#include "bfd.h" #include "bfd.h"
#include "sysdep.h" #include "sysdep.h"
#include "bfdlink.h" #include "bfdlink.h"

View file

@ -24,11 +24,10 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <ctype.h>
#include "bfd.h" #include "bfd.h"
#include "sysdep.h" #include "sysdep.h"
#include "bfdlink.h" #include "bfdlink.h"
#include "safe-ctype.h"
#include "libbfd.h" #include "libbfd.h"
#include "vms.h" #include "vms.h"
@ -303,8 +302,7 @@ _bfd_vms_write_hdr (abfd, objtype)
fptr = fout; fptr = fout;
while (*fptr != 0) while (*fptr != 0)
{ {
if (islower (*fptr)) *fptr = TOUPPER (*fptr);
*fptr = toupper (*fptr);
fptr++; fptr++;
if ((*fptr == ';') if ((*fptr == ';')
|| ((fptr - fout) > 31)) || ((fptr - fout) > 31))

View file

@ -33,8 +33,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
qw quadword (8 byte, 64 bit) qw quadword (8 byte, 64 bit)
da data stream */ da data stream */
#include <ctype.h>
#include "bfd.h" #include "bfd.h"
#include "sysdep.h" #include "sysdep.h"
#include "bfdlink.h" #include "bfdlink.h"

View file

@ -1,3 +1,59 @@
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> 2001-09-18 Alan Modra <amodra@bigpond.net.au>
* ar.c (print_contents): Cast args of bfd_seek to the right types. * ar.c (print_contents): Cast args of bfd_seek to the right types.

View file

@ -1,5 +1,5 @@
/* addr2line.c -- convert addresses to line number and function name /* 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> Contributed by Ulrich Lauther <Ulrich.Lauther@mchp.siemens.de>
This file is part of GNU Binutils. This file is part of GNU Binutils.
@ -28,7 +28,6 @@
both forms write results to stdout, the second form reads addresses both forms write results to stdout, the second form reads addresses
to be converted from stdin. */ to be converted from stdin. */
#include <ctype.h>
#include <string.h> #include <string.h>
#include "bfd.h" #include "bfd.h"
@ -277,6 +276,9 @@ main (argc, argv)
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, ""); setlocale (LC_MESSAGES, "");
#endif
#if defined (HAVE_SETLOCALE)
setlocale (LC_CTYPE, "");
#endif #endif
bindtextdomain (PACKAGE, LOCALEDIR); bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE); textdomain (PACKAGE);

View file

@ -378,6 +378,9 @@ main (argc, argv)
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, ""); setlocale (LC_MESSAGES, "");
#endif
#if defined (HAVE_SETLOCALE)
setlocale (LC_CTYPE, "");
#endif #endif
bindtextdomain (PACKAGE, LOCALEDIR); bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE); textdomain (PACKAGE);

View file

@ -492,6 +492,9 @@ main (ac, av)
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, ""); setlocale (LC_MESSAGES, "");
#endif
#if defined (HAVE_SETLOCALE)
setlocale (LC_CTYPE, "");
#endif #endif
bindtextdomain (PACKAGE, LOCALEDIR); bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE); textdomain (PACKAGE);

View file

@ -1,5 +1,5 @@
/* dlltool.c -- tool to generate stuff for PE style DLLs /* 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. Free Software Foundation, Inc.
This file is part of GNU Binutils. This file is part of GNU Binutils.
@ -253,8 +253,8 @@
#include "demangle.h" #include "demangle.h"
#include "dyn-string.h" #include "dyn-string.h"
#include "dlltool.h" #include "dlltool.h"
#include "safe-ctype.h"
#include <ctype.h>
#include <time.h> #include <time.h>
#include <sys/stat.h> #include <sys/stat.h>
@ -3219,6 +3219,9 @@ main (ac, av)
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, ""); setlocale (LC_MESSAGES, "");
#endif
#if defined (HAVE_SETLOCALE)
setlocale (LC_CTYPE, "");
#endif #endif
bindtextdomain (PACKAGE, LOCALEDIR); bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE); textdomain (PACKAGE);
@ -3386,7 +3389,7 @@ main (ac, av)
imp_name_lab = xstrdup (imp_name); imp_name_lab = xstrdup (imp_name);
for (p = imp_name_lab; *p; p++) for (p = imp_name_lab; *p; p++)
{ {
if (!isalpha ((unsigned char) *p) && !isdigit ((unsigned char) *p)) if (!ISALNUM (*p))
*p = '_'; *p = '_';
} }
head_label = make_label("_head_", imp_name_lab); head_label = make_label("_head_", imp_name_lab);

View file

@ -1,5 +1,5 @@
/* dllwrap.c -- wrapper for DLLTOOL and GCC to generate PE style DLLs /* 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). Contributed by Mumit Khan (khan@xraylith.wisc.edu).
This file is part of GNU Binutils. This file is part of GNU Binutils.
@ -36,7 +36,6 @@
#include "getopt.h" #include "getopt.h"
#include "dyn-string.h" #include "dyn-string.h"
#include <ctype.h>
#include <time.h> #include <time.h>
#include <sys/stat.h> #include <sys/stat.h>
@ -664,6 +663,15 @@ main (argc, argv)
program_name = argv[0]; 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*)); saved_argv = (char **) xmalloc (argc * sizeof (char*));
dlltool_arg_indices = (int *) xmalloc (argc * sizeof (int)); dlltool_arg_indices = (int *) xmalloc (argc * sizeof (int));
driver_arg_indices = (int *) xmalloc (argc * sizeof (int)); driver_arg_indices = (int *) xmalloc (argc * sizeof (int));

View file

@ -1,5 +1,5 @@
/* nlmconv.c -- NLM conversion program /* 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. Free Software Foundation, Inc.
This file is part of GNU Binutils. This file is part of GNU Binutils.
@ -35,10 +35,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h" #include "bfd.h"
#include "libiberty.h" #include "libiberty.h"
#include "bucomm.h" #include "bucomm.h"
#include "safe-ctype.h"
#include <ansidecl.h> #include <ansidecl.h>
#include <time.h> #include <time.h>
#include <ctype.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/file.h> #include <sys/file.h>
#include <assert.h> #include <assert.h>
@ -213,6 +213,9 @@ main (argc, argv)
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, ""); setlocale (LC_MESSAGES, "");
#endif
#if defined (HAVE_SETLOCALE)
setlocale (LC_CTYPE, "");
#endif #endif
bindtextdomain (PACKAGE, LOCALEDIR); bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE); textdomain (PACKAGE);
@ -1071,8 +1074,7 @@ main (argc, argv)
for (modname = nlm_fixed_header (outbfd)->moduleName; for (modname = nlm_fixed_header (outbfd)->moduleName;
*modname != '\0'; *modname != '\0';
modname++) modname++)
if (islower ((unsigned char) *modname)) *modname = TOUPPER (*modname);
*modname = toupper (*modname);
strncpy (nlm_variable_header (outbfd)->oldThreadName, " LONG", strncpy (nlm_variable_header (outbfd)->oldThreadName, " LONG",
NLM_OLD_THREAD_NAME_LENGTH); NLM_OLD_THREAD_NAME_LENGTH);

View file

@ -1,5 +1,5 @@
%{/* nlmheader.y - parse NLM header specification keywords. %{/* 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. This file is part of GNU Binutils.
@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <ansidecl.h> #include <ansidecl.h>
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include "safe-ctype.h"
#include "bfd.h" #include "bfd.h"
#include "bucomm.h" #include "bucomm.h"
#include "nlm/common.h" #include "nlm/common.h"
@ -682,7 +682,7 @@ tail_recurse:
c = getc (current.file); c = getc (current.file);
/* Commas are treated as whitespace characters. */ /* Commas are treated as whitespace characters. */
while (isspace ((unsigned char) c) || c == ',') while (ISSPACE (c) || c == ',')
{ {
current.state = IN_LINE; current.state = IN_LINE;
if (c == '\n') if (c == '\n')
@ -735,9 +735,9 @@ tail_recurse:
if (c == '\n') if (c == '\n')
++current.lineno; ++current.lineno;
} }
while (isspace ((unsigned char) c)); while (ISSPACE (c));
BUF_INIT (); BUF_INIT ();
while (! isspace ((unsigned char) c) && c != EOF) while (! ISSPACE (c) && c != EOF)
{ {
BUF_ADD (c); BUF_ADD (c);
c = getc (current.file); c = getc (current.file);
@ -755,17 +755,14 @@ tail_recurse:
if (current.state == BEGINNING_OF_LINE) if (current.state == BEGINNING_OF_LINE)
{ {
BUF_INIT (); BUF_INIT ();
while (isalnum ((unsigned char) c) || c == '_') while (ISALNUM (c) || c == '_')
{ {
if (islower ((unsigned char) c)) BUF_ADD (TOUPPER (c));
BUF_ADD (toupper ((unsigned char) c));
else
BUF_ADD (c);
c = getc (current.file); c = getc (current.file);
} }
BUF_FINISH (); BUF_FINISH ();
if (c != EOF && ! isspace ((unsigned char) c) && c != ',') if (c != EOF && ! ISSPACE (c) && c != ',')
{ {
nlmheader_identify (); nlmheader_identify ();
fprintf (stderr, _("%s:%d: illegal character in keyword: %c\n"), fprintf (stderr, _("%s:%d: illegal character in keyword: %c\n"),
@ -838,7 +835,7 @@ tail_recurse:
/* Gather a generic argument. */ /* Gather a generic argument. */
BUF_INIT (); BUF_INIT ();
while (! isspace (c) while (! ISSPACE (c)
&& c != ',' && c != ','
&& c != COMMENT_CHAR && c != COMMENT_CHAR
&& c != '(' && c != '('

View file

@ -404,6 +404,9 @@ main (argc, argv)
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, ""); setlocale (LC_MESSAGES, "");
#endif
#if defined (HAVE_SETLOCALE)
setlocale (LC_CTYPE, "");
#endif #endif
bindtextdomain (PACKAGE, LOCALEDIR); bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE); textdomain (PACKAGE);

View file

@ -2610,6 +2610,9 @@ main (argc, argv)
{ {
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, ""); setlocale (LC_MESSAGES, "");
#endif
#if defined (HAVE_SETLOCALE)
setlocale (LC_CTYPE, "");
#endif #endif
bindtextdomain (PACKAGE, LOCALEDIR); bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE); textdomain (PACKAGE);

View file

@ -23,7 +23,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "getopt.h" #include "getopt.h"
#include "progress.h" #include "progress.h"
#include "bucomm.h" #include "bucomm.h"
#include <ctype.h> #include "safe-ctype.h"
#include "dis-asm.h" #include "dis-asm.h"
#include "libiberty.h" #include "libiberty.h"
#include "demangle.h" #include "demangle.h"
@ -1345,7 +1345,7 @@ disassemble_bytes (info, disassemble_fn, insns, data,
for (j = addr_offset * opb; j < addr_offset * opb + octets; ++j) 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]; buf[j - addr_offset * opb] = data[j];
else else
buf[j - addr_offset * opb] = '.'; buf[j - addr_offset * opb] = '.';
@ -1999,7 +1999,7 @@ dump_section_stabs (abfd, stabsect_name, strsect_name)
match or a section followed by a number. */ match or a section followed by a number. */
if (strncmp (stabsect_name, s->name, len) == 0 if (strncmp (stabsect_name, s->name, len) == 0
&& (s->name[len] == '\000' && (s->name[len] == '\000'
|| isdigit ((unsigned char) s->name[len]))) || ISDIGIT (s->name[len])))
{ {
if (read_section_stabs (abfd, s->name, strsect_name)) if (read_section_stabs (abfd, s->name, strsect_name))
{ {
@ -2286,7 +2286,7 @@ dump_data (abfd)
if (j >= stop_offset * opb) if (j >= stop_offset * opb)
printf (" "); printf (" ");
else else
printf ("%c", isprint (data[j]) ? data[j] : '.'); printf ("%c", ISPRINT (data[j]) ? data[j] : '.');
} }
putchar ('\n'); putchar ('\n');
} }
@ -2765,6 +2765,9 @@ main (argc, argv)
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, ""); setlocale (LC_MESSAGES, "");
#endif
#if defined (HAVE_SETLOCALE)
setlocale (LC_CTYPE, "");
#endif #endif
bindtextdomain (PACKAGE, LOCALEDIR); bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE); textdomain (PACKAGE);

View file

@ -1,5 +1,5 @@
%{ /* rclex.l -- lexer for Windows rc files parser */ %{ /* 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. Written by Ian Lance Taylor, Cygnus Support.
This file is part of GNU Binutils. This file is part of GNU Binutils.
@ -26,10 +26,10 @@
#include "bfd.h" #include "bfd.h"
#include "bucomm.h" #include "bucomm.h"
#include "libiberty.h" #include "libiberty.h"
#include "safe-ctype.h"
#include "windres.h" #include "windres.h"
#include "rcparse.h" #include "rcparse.h"
#include <ctype.h>
#include <assert.h> #include <assert.h>
/* Whether we are in rcdata mode, in which we returns the lengths of /* Whether we are in rcdata mode, in which we returns the lengths of
@ -252,18 +252,18 @@ cpp_line (s)
char *send, *fn; char *send, *fn;
++s; ++s;
while (isspace ((unsigned char) *s)) while (ISSPACE (*s))
++s; ++s;
line = strtol (s, &send, 0); line = strtol (s, &send, 0);
if (*send != '\0' && ! isspace ((unsigned char) *send)) if (*send != '\0' && ! ISSPACE (*send))
return; return;
/* Subtract 1 because we are about to count the newline. */ /* Subtract 1 because we are about to count the newline. */
rc_lineno = line - 1; rc_lineno = line - 1;
s = send; s = send;
while (isspace ((unsigned char) *s)) while (ISSPACE (*s))
++s; ++s;
if (*s != '"') if (*s != '"')
@ -423,8 +423,8 @@ handle_quotes (input, len)
else else
{ {
++t; ++t;
assert (isspace ((unsigned char) *t)); assert (ISSPACE (*t));
while (isspace ((unsigned char) *t)) while (ISSPACE (*t))
++t; ++t;
if (*t == '\0') if (*t == '\0')
break; break;

View file

@ -1,5 +1,5 @@
%{ /* rcparse.y -- parser for Windows rc files %{ /* 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. Written by Ian Lance Taylor, Cygnus Support.
This file is part of GNU Binutils. This file is part of GNU Binutils.
@ -26,8 +26,7 @@
#include "bucomm.h" #include "bucomm.h"
#include "libiberty.h" #include "libiberty.h"
#include "windres.h" #include "windres.h"
#include "safe-ctype.h"
#include <ctype.h>
/* The current language. */ /* The current language. */
@ -245,7 +244,7 @@ acc_event:
$$.flags = ACC_CONTROL | ACC_VIRTKEY; $$.flags = ACC_CONTROL | ACC_VIRTKEY;
++s; ++s;
ch = *s; ch = *s;
ch = toupper ((unsigned char) ch); ch = TOUPPER (ch);
} }
$$.key = ch; $$.key = ch;
if (s[1] != '\0') if (s[1] != '\0')
@ -1259,8 +1258,7 @@ id:
/* It seems that resource ID's are forced to upper case. */ /* It seems that resource ID's are forced to upper case. */
copy = xstrdup ($1); copy = xstrdup ($1);
for (s = copy; *s != '\0'; s++) for (s = copy; *s != '\0'; s++)
if (islower ((unsigned char) *s)) *s = TOUPPER (*s);
*s = toupper ((unsigned char) *s);
res_string_to_id (&$$, copy); res_string_to_id (&$$, copy);
free (copy); free (copy);
} }
@ -1297,8 +1295,7 @@ resref:
/* It seems that resource ID's are forced to upper case. */ /* It seems that resource ID's are forced to upper case. */
copy = xstrdup ($1); copy = xstrdup ($1);
for (s = copy; *s != '\0'; s++) for (s = copy; *s != '\0'; s++)
if (islower ((unsigned char) *s)) *s = TOUPPER (*s);
*s = toupper ((unsigned char) *s);
res_string_to_id (&$$, copy); res_string_to_id (&$$, copy);
free (copy); free (copy);
} }

View file

@ -9011,6 +9011,9 @@ main (argc, argv)
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, ""); setlocale (LC_MESSAGES, "");
#endif
#if defined (HAVE_SETLOCALE)
setlocale (LC_CTYPE, "");
#endif #endif
bindtextdomain (PACKAGE, LOCALEDIR); bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE); textdomain (PACKAGE);

View file

@ -1,5 +1,5 @@
/* resrc.c -- read and write Windows rc files. /* 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. Written by Ian Lance Taylor, Cygnus Support.
This file is part of GNU Binutils. This file is part of GNU Binutils.
@ -25,10 +25,10 @@
#include "bfd.h" #include "bfd.h"
#include "bucomm.h" #include "bucomm.h"
#include "libiberty.h" #include "libiberty.h"
#include "safe-ctype.h"
#include "windres.h" #include "windres.h"
#include <assert.h> #include <assert.h>
#include <ctype.h>
#include <errno.h> #include <errno.h>
#include <sys/stat.h> #include <sys/stat.h>
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
@ -1976,7 +1976,7 @@ write_rc_accelerators (e, accelerators)
fprintf (e, " "); fprintf (e, " ");
if ((acc->key & 0x7f) == acc->key if ((acc->key & 0x7f) == acc->key
&& isprint ((unsigned char) acc->key) && ISPRINT (acc->key)
&& (acc->flags & ACC_VIRTKEY) == 0) && (acc->flags & ACC_VIRTKEY) == 0)
{ {
fprintf (e, "\"%c\"", acc->key); fprintf (e, "\"%c\"", acc->key);
@ -2383,7 +2383,7 @@ write_rc_rcdata (e, rcdata, ind)
s = ri->u.string.s; s = ri->u.string.s;
for (i = 0; i < ri->u.string.length; i++) for (i = 0; i < ri->u.string.length; i++)
{ {
if (isprint ((unsigned char) *s)) if (ISPRINT (*s))
putc (*s, e); putc (*s, e);
else else
fprintf (e, "\\%03o", *s); fprintf (e, "\\%03o", *s);
@ -2421,7 +2421,7 @@ write_rc_rcdata (e, rcdata, ind)
if (i + 4 < ri->u.buffer.length || ri->next != NULL) if (i + 4 < ri->u.buffer.length || ri->next != NULL)
fprintf (e, ","); fprintf (e, ",");
for (j = 0; j < 4; ++j) 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) && ri->u.buffer.data[i + j] != 0)
break; break;
if (j >= 4) if (j >= 4)
@ -2429,7 +2429,7 @@ write_rc_rcdata (e, rcdata, ind)
fprintf (e, "\t// "); fprintf (e, "\t// ");
for (j = 0; j < 4; ++j) 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]); fprintf (e, "\\%03o", ri->u.buffer.data[i + j]);
else else
{ {
@ -2455,7 +2455,7 @@ write_rc_rcdata (e, rcdata, ind)
if (i + 2 < ri->u.buffer.length || ri->next != NULL) if (i + 2 < ri->u.buffer.length || ri->next != NULL)
fprintf (e, ","); fprintf (e, ",");
for (j = 0; j < 2; ++j) 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) && ri->u.buffer.data[i + j] != 0)
break; break;
if (j >= 2) if (j >= 2)
@ -2463,7 +2463,7 @@ write_rc_rcdata (e, rcdata, ind)
fprintf (e, "\t// "); fprintf (e, "\t// ");
for (j = 0; j < 2; ++j) 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]); fprintf (e, "\\%03o", ri->u.buffer.data[i + j]);
else else
{ {
@ -2483,7 +2483,7 @@ write_rc_rcdata (e, rcdata, ind)
if (! first) if (! first)
indent (e, ind + 2); indent (e, ind + 2);
if ((ri->u.buffer.data[i] & 0x7f) == ri->u.buffer.data[i] 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]); fprintf (e, "\"%c\"", ri->u.buffer.data[i]);
else else
fprintf (e, "\"\\%03o\"", ri->u.buffer.data[i]); fprintf (e, "\"\\%03o\"", ri->u.buffer.data[i]);

View file

@ -1,5 +1,5 @@
/* size.c -- report size of various sections of an executable file. /* 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. Free Software Foundation, Inc.
This file is part of GNU Binutils. This file is part of GNU Binutils.
@ -112,6 +112,9 @@ main (argc, argv)
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, ""); setlocale (LC_MESSAGES, "");
#endif
#if defined (HAVE_SETLOCALE)
setlocale (LC_CTYPE, "");
#endif #endif
bindtextdomain (PACKAGE, LOCALEDIR); bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE); textdomain (PACKAGE);

View file

@ -1964,6 +1964,9 @@ main (ac, av)
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, ""); setlocale (LC_MESSAGES, "");
#endif
#if defined (HAVE_SETLOCALE)
setlocale (LC_CTYPE, "");
#endif #endif
bindtextdomain (PACKAGE, LOCALEDIR); bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE); textdomain (PACKAGE);

View file

@ -26,11 +26,11 @@
trying to identify the correct address for anything. */ trying to identify the correct address for anything. */
#include <stdio.h> #include <stdio.h>
#include <ctype.h>
#include "bfd.h" #include "bfd.h"
#include "bucomm.h" #include "bucomm.h"
#include "libiberty.h" #include "libiberty.h"
#include "safe-ctype.h"
#include "demangle.h" #include "demangle.h"
#include "debug.h" #include "debug.h"
#include "budbg.h" #include "budbg.h"
@ -307,11 +307,11 @@ parse_number (pp, poverflow)
int d; int d;
d = *p++; d = *p++;
if (isdigit ((unsigned char) d)) if (ISDIGIT (d))
d -= '0'; d -= '0';
else if (isupper ((unsigned char) d)) else if (ISUPPER (d))
d -= 'A'; d -= 'A';
else if (islower ((unsigned char) d)) else if (ISLOWER (d))
d -= 'a'; d -= 'a';
else else
break; break;
@ -781,7 +781,7 @@ parse_stab_string (dhandle, info, stabtype, desc, value, string)
} }
++p; ++p;
if (isdigit ((unsigned char) *p) || *p == '(' || *p == '-') if (ISDIGIT (*p) || *p == '(' || *p == '-')
type = 'l'; type = 'l';
else else
type = *p++; type = *p++;
@ -1185,7 +1185,7 @@ parse_stab_type (dhandle, info, typename, pp, slotp)
/* Read type number if present. The type number may be omitted. /* Read type number if present. The type number may be omitted.
for instance in a two-dimensional array declared with type for instance in a two-dimensional array declared with type
"ar1;1;10;ar1;1;10;4". */ "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 /* 'typenums=' not present, type is anonymous. Read and return
the definition, but don't put it in the type vector. */ the definition, but don't put it in the type vector. */
@ -1228,7 +1228,7 @@ parse_stab_type (dhandle, info, typename, pp, slotp)
const char *p = *pp + 1; const char *p = *pp + 1;
const char *attr; const char *attr;
if (isdigit ((unsigned char) *p) || *p == '(' || *p == '-') if (ISDIGIT (*p) || *p == '(' || *p == '-')
{ {
/* Member type. */ /* Member type. */
break; break;
@ -2913,7 +2913,7 @@ parse_stab_argtypes (dhandle, info, class_type, fieldname, tagname,
/* Constructors are sometimes handled specially. */ /* Constructors are sometimes handled specially. */
is_full_physname_constructor = ((argtypes[0] == '_' is_full_physname_constructor = ((argtypes[0] == '_'
&& argtypes[1] == '_' && argtypes[1] == '_'
&& (isdigit ((unsigned char) argtypes[2]) && (ISDIGIT (argtypes[2])
|| argtypes[2] == 'Q' || argtypes[2] == 'Q'
|| argtypes[2] == 't')) || argtypes[2] == 't'))
|| strncmp (argtypes, "__ct", 4) == 0); || strncmp (argtypes, "__ct", 4) == 0);
@ -3149,7 +3149,7 @@ parse_stab_array_type (dhandle, info, pp, stringp)
adjustable = false; adjustable = false;
if (! isdigit ((unsigned char) **pp) && **pp != '-') if (! ISDIGIT (**pp) && **pp != '-')
{ {
++*pp; ++*pp;
adjustable = true; adjustable = true;
@ -3163,7 +3163,7 @@ parse_stab_array_type (dhandle, info, pp, stringp)
} }
++*pp; ++*pp;
if (! isdigit ((unsigned char) **pp) && **pp != '-') if (! ISDIGIT (**pp) && **pp != '-')
{ {
++*pp; ++*pp;
adjustable = true; adjustable = true;
@ -3772,7 +3772,7 @@ stab_demangle_count (pp)
unsigned int count; unsigned int count;
count = 0; count = 0;
while (isdigit ((unsigned char) **pp)) while (ISDIGIT (**pp))
{ {
count *= 10; count *= 10;
count += **pp - '0'; count += **pp - '0';
@ -3789,12 +3789,12 @@ stab_demangle_get_count (pp, pi)
const char **pp; const char **pp;
unsigned int *pi; unsigned int *pi;
{ {
if (! isdigit ((unsigned char) **pp)) if (! ISDIGIT (**pp))
return false; return false;
*pi = **pp - '0'; *pi = **pp - '0';
++*pp; ++*pp;
if (isdigit ((unsigned char) **pp)) if (ISDIGIT (**pp))
{ {
unsigned int count; unsigned int count;
const char *p; const char *p;
@ -3807,7 +3807,7 @@ stab_demangle_get_count (pp, pi)
count += *p - '0'; count += *p - '0';
++p; ++p;
} }
while (isdigit ((unsigned char) *p)); while (ISDIGIT (*p));
if (*p == '_') if (*p == '_')
{ {
*pp = p + 1; *pp = p + 1;
@ -3902,7 +3902,7 @@ stab_demangle_prefix (minfo, pp)
scan += i - 2; scan += i - 2;
if (scan == *pp if (scan == *pp
&& (isdigit ((unsigned char) scan[2]) && (ISDIGIT (scan[2])
|| scan[2] == 'Q' || scan[2] == 'Q'
|| scan[2] == 't')) || scan[2] == 't'))
{ {
@ -3911,7 +3911,7 @@ stab_demangle_prefix (minfo, pp)
return true; return true;
} }
else if (scan == *pp else if (scan == *pp
&& ! isdigit ((unsigned char) scan[2]) && ! ISDIGIT (scan[2])
&& scan[2] != 't') && scan[2] != 't')
{ {
/* Look for the `__' that separates the prefix from the /* Look for the `__' that separates the prefix from the
@ -4126,13 +4126,13 @@ stab_demangle_qualified (minfo, pp, ptype)
preceded by an underscore (to distinguish it from the <= 9 preceded by an underscore (to distinguish it from the <= 9
case) and followed by an underscore. */ case) and followed by an underscore. */
p = *pp + 2; p = *pp + 2;
if (! isdigit ((unsigned char) *p) || *p == '0') if (! ISDIGIT (*p) || *p == '0')
{ {
stab_bad_demangle (orig); stab_bad_demangle (orig);
return false; return false;
} }
qualifiers = atoi (p); qualifiers = atoi (p);
while (isdigit ((unsigned char) *p)) while (ISDIGIT (*p))
++p; ++p;
if (*p != '_') if (*p != '_')
{ {
@ -4397,7 +4397,7 @@ stab_demangle_template (minfo, pp, pname)
{ {
if (**pp == 'm') if (**pp == 'm')
++*pp; ++*pp;
while (isdigit ((unsigned char) **pp)) while (ISDIGIT (**pp))
++*pp; ++*pp;
} }
else if (charp) else if (charp)
@ -4428,18 +4428,18 @@ stab_demangle_template (minfo, pp, pname)
{ {
if (**pp == 'm') if (**pp == 'm')
++*pp; ++*pp;
while (isdigit ((unsigned char) **pp)) while (ISDIGIT (**pp))
++*pp; ++*pp;
if (**pp == '.') if (**pp == '.')
{ {
++*pp; ++*pp;
while (isdigit ((unsigned char) **pp)) while (ISDIGIT (**pp))
++*pp; ++*pp;
} }
if (**pp == 'e') if (**pp == 'e')
{ {
++*pp; ++*pp;
while (isdigit ((unsigned char) **pp)) while (ISDIGIT (**pp))
++*pp; ++*pp;
} }
} }
@ -4692,7 +4692,7 @@ stab_demangle_type (minfo, pp, ptype)
high = 0; high = 0;
while (**pp != '\0' && **pp != '_') while (**pp != '\0' && **pp != '_')
{ {
if (! isdigit ((unsigned char) **pp)) if (! ISDIGIT (**pp))
{ {
stab_bad_demangle (orig); stab_bad_demangle (orig);
return false; return false;
@ -4796,7 +4796,7 @@ stab_demangle_type (minfo, pp, ptype)
varargs = false; varargs = false;
++*pp; ++*pp;
if (isdigit ((unsigned char) **pp)) if (ISDIGIT (**pp))
{ {
n = stab_demangle_count (pp); n = stab_demangle_count (pp);
if (strlen (*pp) < n) if (strlen (*pp) < n)
@ -5106,7 +5106,7 @@ stab_demangle_fund_type (minfo, pp, ptype)
case 'G': case 'G':
++*pp; ++*pp;
if (! isdigit ((unsigned char) **pp)) if (! ISDIGIT (**pp))
{ {
stab_bad_demangle (orig); stab_bad_demangle (orig);
return false; return false;

View file

@ -59,10 +59,10 @@
#include "bfd.h" #include "bfd.h"
#include <stdio.h> #include <stdio.h>
#include <getopt.h> #include <getopt.h>
#include <ctype.h>
#include <errno.h> #include <errno.h>
#include "bucomm.h" #include "bucomm.h"
#include "libiberty.h" #include "libiberty.h"
#include "safe-ctype.h"
/* Some platforms need to put stdin into binary mode, to read /* Some platforms need to put stdin into binary mode, to read
binary files. */ binary files. */
@ -81,14 +81,7 @@
#endif #endif
#endif #endif
/* Not all printable characters have ASCII codes (depending upon the #define isgraphic(c) (ISPRINT (c) || (c) == '\t')
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
#ifndef errno #ifndef errno
extern int errno; extern int errno;
@ -153,7 +146,7 @@ main (argc, argv)
int exit_status = 0; int exit_status = 0;
boolean files_given = false; boolean files_given = false;
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) #if defined (HAVE_SETLOCALE)
setlocale (LC_ALL, ""); setlocale (LC_ALL, "");
#endif #endif
bindtextdomain (PACKAGE, LOCALEDIR); bindtextdomain (PACKAGE, LOCALEDIR);

View file

@ -26,9 +26,9 @@
#include "bfd.h" #include "bfd.h"
#include "bucomm.h" #include "bucomm.h"
#include "safe-ctype.h"
#include <stdio.h> #include <stdio.h>
#include <ctype.h>
#include <libiberty.h> #include <libiberty.h>
#include <getopt.h> #include <getopt.h>
#include "sysroff.h" #include "sysroff.h"
@ -260,7 +260,8 @@ pbarray (y)
printf ("%d (", y->len); printf ("%d (", y->len);
for (x = 0; x < y->len; x++) 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"); printf (")\n");
} }
@ -759,6 +760,9 @@ main (ac, av)
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, ""); setlocale (LC_MESSAGES, "");
#endif
#if defined (HAVE_SETLOCALE)
setlocale (LC_CTYPE, "");
#endif #endif
bindtextdomain (PACKAGE, LOCALEDIR); bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE); textdomain (PACKAGE);

View file

@ -1,5 +1,5 @@
/* windres.c -- a program to manipulate Windows resources /* 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. Written by Ian Lance Taylor, Cygnus Support.
This file is part of GNU Binutils. This file is part of GNU Binutils.
@ -39,11 +39,11 @@
#include "getopt.h" #include "getopt.h"
#include "bucomm.h" #include "bucomm.h"
#include "libiberty.h" #include "libiberty.h"
#include "safe-ctype.h"
#include "obstack.h" #include "obstack.h"
#include "windres.h" #include "windres.h"
#include <assert.h> #include <assert.h>
#include <ctype.h>
#include <time.h> #include <time.h>
/* used by resrc.c at least */ /* used by resrc.c at least */
@ -679,11 +679,11 @@ format_from_filename (filename, input)
return RES_FORMAT_RES; return RES_FORMAT_RES;
/* If every character is printable or space, assume it's an RC file. */ /* If every character is printable or space, assume it's an RC file. */
if ((isprint (b1) || isspace (b1)) if ((ISPRINT (b1) || ISSPACE (b1))
&& (isprint (b2) || isspace (b2)) && (ISPRINT (b2) || ISSPACE (b2))
&& (isprint (b3) || isspace (b3)) && (ISPRINT (b3) || ISSPACE (b3))
&& (isprint (b4) || isspace (b4)) && (ISPRINT (b4) || ISSPACE (b4))
&& (isprint (b5) || isspace (b5))) && (ISPRINT (b5) || ISSPACE (b5)))
return RES_FORMAT_RC; return RES_FORMAT_RC;
/* Otherwise, we give up. */ /* Otherwise, we give up. */
@ -788,6 +788,9 @@ main (argc, argv)
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, ""); setlocale (LC_MESSAGES, "");
#endif
#if defined (HAVE_SETLOCALE)
setlocale (LC_CTYPE, "");
#endif #endif
bindtextdomain (PACKAGE, LOCALEDIR); bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE); textdomain (PACKAGE);

View file

@ -1,5 +1,5 @@
/* winduni.c -- unicode support for the windres program. /* 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. Written by Ian Lance Taylor, Cygnus Support.
This file is part of GNU Binutils. This file is part of GNU Binutils.
@ -30,8 +30,7 @@
#include "bfd.h" #include "bfd.h"
#include "bucomm.h" #include "bucomm.h"
#include "winduni.h" #include "winduni.h"
#include "safe-ctype.h"
#include <ctype.h>
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
@ -99,7 +98,7 @@ unicode_print (e, unicode, length)
{ {
if (ch == '\\') if (ch == '\\')
fputs ("\\", e); fputs ("\\", e);
else if (isprint (ch)) else if (ISPRINT (ch))
putc (ch, e); putc (ch, e);
else else
{ {

View file

@ -1,5 +1,5 @@
/* wrstabs.c -- Output stabs debugging information /* 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>. Written by Ian Lance Taylor <ian@cygnus.com>.
This file is part of GNU Binutils. This file is part of GNU Binutils.
@ -23,12 +23,12 @@
information. */ information. */
#include <stdio.h> #include <stdio.h>
#include <ctype.h>
#include <assert.h> #include <assert.h>
#include "bfd.h" #include "bfd.h"
#include "bucomm.h" #include "bucomm.h"
#include "libiberty.h" #include "libiberty.h"
#include "safe-ctype.h"
#include "debug.h" #include "debug.h"
#include "budbg.h" #include "budbg.h"
@ -2172,7 +2172,7 @@ stab_variable (p, name, kind, val)
kindstr = ""; kindstr = "";
/* Make sure that this is a type reference or definition. */ /* Make sure that this is a type reference or definition. */
if (! isdigit ((unsigned char) *s)) if (! ISDIGIT (*s))
{ {
char *n; char *n;
long index; long index;

View file

@ -1,3 +1,232 @@
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> 2001-09-18 Martin Schwidefsky <schwidefsky@de.ibm.com>
* tc-s390.c (s390_insn): Add code to cope with 6 byte O_constants * tc-s390.c (s390_insn): Add code to cope with 6 byte O_constants

View file

@ -779,6 +779,9 @@ main (argc, argv)
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, ""); setlocale (LC_MESSAGES, "");
#endif
#if defined (HAVE_SETLOCALE)
setlocale (LC_CTYPE, "");
#endif #endif
bindtextdomain (PACKAGE, LOCALEDIR); bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE); textdomain (PACKAGE);

View file

@ -73,7 +73,6 @@ extern void *alloca ();
/* System include files first... */ /* System include files first... */
#include <stdio.h> #include <stdio.h>
#include <ctype.h>
#ifdef HAVE_STRING_H #ifdef HAVE_STRING_H
#include <string.h> #include <string.h>
#else #else

View file

@ -1,5 +1,5 @@
/* atof_generic.c - turn a string of digits into a Flonum /* 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. Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler. This file is part of GAS, the GNU Assembler.
@ -19,10 +19,10 @@
Software Foundation, 59 Temple Place - Suite 330, Boston, MA Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */ 02111-1307, USA. */
#include <ctype.h>
#include <string.h> #include <string.h>
#include "as.h" #include "as.h"
#include "safe-ctype.h"
#ifndef FALSE #ifndef FALSE
#define FALSE (0) #define FALSE (0)
@ -171,7 +171,7 @@ atof_generic (address_of_string_pointer,
&& (!c || !strchr (string_of_decimal_exponent_marks, c))); && (!c || !strchr (string_of_decimal_exponent_marks, c)));
p++) p++)
{ {
if (isdigit ((unsigned char) c)) if (ISDIGIT (c))
{ {
if (seen_significant_digit || c > '0') if (seen_significant_digit || c > '0')
{ {
@ -200,7 +200,7 @@ atof_generic (address_of_string_pointer,
{ {
unsigned int zeros = 0; /* Length of current string of zeros */ 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') if (c == '0')
{ {
@ -221,7 +221,7 @@ atof_generic (address_of_string_pointer,
&& (!c || !strchr (string_of_decimal_exponent_marks, c))); && (!c || !strchr (string_of_decimal_exponent_marks, c)));
p++) p++)
{ {
if (isdigit ((unsigned char) c)) if (ISDIGIT (c))
{ {
/* This may be retracted below. */ /* This may be retracted below. */
number_of_digits_after_decimal++; number_of_digits_after_decimal++;
@ -275,7 +275,7 @@ atof_generic (address_of_string_pointer,
for (; (c); c = *++p) for (; (c); c = *++p)
{ {
if (isdigit ((unsigned char) c)) if (ISDIGIT (c))
{ {
decimal_exponent = decimal_exponent * 10 + c - '0'; decimal_exponent = decimal_exponent * 10 + c - '0';
/* /*
@ -400,7 +400,7 @@ atof_generic (address_of_string_pointer,
for (p = first_digit, count = number_of_digits_to_use; count; p++, --count) for (p = first_digit, count = number_of_digits_to_use; count; p++, --count)
{ {
c = *p; c = *p;
if (isdigit ((unsigned char) c)) if (ISDIGIT (c))
{ {
/* /*
* Multiply by 10. Assume can never overflow. * Multiply by 10. Assume can never overflow.

View file

@ -1,5 +1,5 @@
/* m68k.y -- bison grammar for m68k operand parsing /* 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 Written by Ken Raeburn and Ian Lance Taylor, Cygnus Support
This file is part of GAS, the GNU Assembler. This file is part of GAS, the GNU Assembler.
@ -29,6 +29,7 @@
#include "as.h" #include "as.h"
#include "tc-m68k.h" #include "tc-m68k.h"
#include "m68k-parse.h" #include "m68k-parse.h"
#include "safe-ctype.h"
/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, /* Remap normal yacc parser interface names (yyparse, yylex, yyerror,
etc), as well as gratuitiously global symbol names If other parser etc), as well as gratuitiously global symbol names If other parser
@ -743,9 +744,9 @@ yylex ()
/* In MRI mode, this can be the start of an octal number. */ /* In MRI mode, this can be the start of an octal number. */
if (flag_mri) if (flag_mri)
{ {
if (isdigit (str[1]) if (ISDIGIT (str[1])
|| ((str[1] == '+' || str[1] == '-') || ((str[1] == '+' || str[1] == '-')
&& isdigit (str[2]))) && ISDIGIT (str[2])))
break; break;
} }
/* Fall through. */ /* Fall through. */
@ -929,7 +930,7 @@ yylex ()
{ {
if (parens == 0 if (parens == 0
&& s > str && s > str
&& (s[-1] == ')' || isalnum ((unsigned char) s[-1]))) && (s[-1] == ')' || ISALNUM (s[-1])))
break; break;
++parens; ++parens;
} }

View file

@ -21,6 +21,7 @@
#define OBJ_HEADER "obj-elf.h" #define OBJ_HEADER "obj-elf.h"
#include "as.h" #include "as.h"
#include "safe-ctype.h"
#include "subsegs.h" #include "subsegs.h"
#include "obstack.h" #include "obstack.h"
@ -1236,7 +1237,7 @@ obj_elf_vtable_inherit (ignore)
if (input_line_pointer[0] == '0' if (input_line_pointer[0] == '0'
&& (input_line_pointer[1] == '\0' && (input_line_pointer[1] == '\0'
|| isspace ((unsigned char) input_line_pointer[1]))) || ISSPACE (input_line_pointer[1])))
{ {
psym = section_symbol (absolute_section); psym = section_symbol (absolute_section);
++input_line_pointer; ++input_line_pointer;

View file

@ -28,6 +28,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "as.h" #include "as.h"
#include "config.h" #include "config.h"
#include "safe-ctype.h"
#include "subsegs.h" #include "subsegs.h"
#include "obstack.h" #include "obstack.h"
@ -3071,7 +3072,7 @@ Write_VMS_MHD_Records ()
cp++; cp++;
continue; continue;
} }
*cp1++ = islower (*cp) ? toupper (*cp++) : *cp++; *cp1++ = TOUPPER (*cp++);
} }
*cp1 = '\0'; *cp1 = '\0';
@ -3254,20 +3255,20 @@ VMS_Case_Hack_Symbol (In, Out)
switch (vms_name_mapping) switch (vms_name_mapping)
{ {
case 0: case 0:
if (isupper (*In)) { if (ISUPPER (*In)) {
*Out++ = *In++; *Out++ = *In++;
Case_Hack_Bits |= 1; Case_Hack_Bits |= 1;
} else { } else {
*Out++ = islower (*In) ? toupper (*In++) : *In++; *Out++ = TOUPPER (*In++);
} }
break; break;
case 3: *Out++ = *In++; case 3: *Out++ = *In++;
break; break;
case 2: case 2:
if (islower (*In)) { if (ISLOWER (*In)) {
*Out++ = *In++; *Out++ = *In++;
} else { } else {
*Out++ = isupper (*In) ? tolower (*In++) : *In++; *Out++ = TOLOWER (*In++);
} }
break; break;
} }
@ -3298,7 +3299,7 @@ VMS_Case_Hack_Symbol (In, Out)
* and ensure that they are lowercase * and ensure that they are lowercase
*/ */
for (i = 0; (In[i] != 0) && (i < 8); i++) 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; break;
if (In[i] == 0) if (In[i] == 0)
@ -3313,11 +3314,11 @@ VMS_Case_Hack_Symbol (In, Out)
i = 8; i = 8;
while ((--i >= 0) && (*In)) while ((--i >= 0) && (*In))
switch (vms_name_mapping){ switch (vms_name_mapping){
case 0: *Out++ = islower (*In) ? toupper (*In++) : *In++; case 0: *Out++ = TOUPPER (*In++);
break; break;
case 3: *Out++ = *In++; case 3: *Out++ = *In++;
break; break;
case 2: *Out++ = isupper (*In) ? tolower (*In++) : *In++; case 2: *Out++ = TOLOWER (*In++);
break; break;
} }
} }

View file

@ -1,5 +1,5 @@
/* tc-a29k.c -- Assemble for the AMD 29000. /* 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. Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler. This file is part of GAS, the GNU Assembler.
@ -23,8 +23,8 @@
to convert it to new machines' assemblers as desired. There was too to convert it to new machines' assemblers as desired. There was too
much bloody rewriting required before. There still probably is. */ much bloody rewriting required before. There still probably is. */
#include <ctype.h>
#include "as.h" #include "as.h"
#include "safe-ctype.h"
#include "opcode/a29k.h" #include "opcode/a29k.h"
@ -188,7 +188,7 @@ insert_sreg (regname, regnum)
symbol_table_insert (symbol_new (regname, SEG_REGISTER, (valueT) regnum, symbol_table_insert (symbol_new (regname, SEG_REGISTER, (valueT) regnum,
&zero_address_frag)); &zero_address_frag));
for (i = 0; regname[i]; i++) for (i = 0; regname[i]; i++)
buf[i] = islower (regname[i]) ? toupper (regname[i]) : regname[i]; buf[i] = TOUPPER (regname[i]);
buf[i] = '\0'; buf[i] = '\0';
symbol_table_insert (symbol_new (buf, SEG_REGISTER, (valueT) regnum, symbol_table_insert (symbol_new (buf, SEG_REGISTER, (valueT) regnum,
@ -397,10 +397,9 @@ machine_ip (str)
/* Must handle `div0' opcode. */ /* Must handle `div0' opcode. */
s = str; s = str;
if (isalpha (*s)) if (ISALPHA (*s))
for (; isalnum (*s); ++s) for (; ISALNUM (*s); ++s)
if (isupper (*s)) *s = TOLOWER (*s);
*s = tolower (*s);
switch (*s) switch (*s)
{ {
@ -1067,13 +1066,13 @@ a29k_unrecognized_line (c)
char *s; char *s;
if (c != '$' if (c != '$'
|| ! isdigit ((unsigned char) input_line_pointer[0])) || ! ISDIGIT (input_line_pointer[0]))
return 0; return 0;
s = input_line_pointer; s = input_line_pointer;
lab = 0; lab = 0;
while (isdigit ((unsigned char) *s)) while (ISDIGIT (*s))
{ {
lab = lab * 10 + *s - '0'; lab = lab * 10 + *s - '0';
++s; ++s;
@ -1176,7 +1175,7 @@ md_operand (expressionP)
expressionP->X_op = O_constant; expressionP->X_op = O_constant;
} }
else if (input_line_pointer[0] == '$' else if (input_line_pointer[0] == '$'
&& isdigit ((unsigned char) input_line_pointer[1])) && ISDIGIT (input_line_pointer[1]))
{ {
long lab; long lab;
char *name; char *name;
@ -1238,7 +1237,7 @@ md_operand (expressionP)
return; return;
} }
if (isdigit (*s)) if (ISDIGIT (*s))
{ {
fieldnum = *s - '0'; fieldnum = *s - '0';
++s; ++s;

View file

@ -62,7 +62,7 @@
#include "dwarf2dbg.h" #include "dwarf2dbg.h"
#endif #endif
#include <ctype.h> #include "safe-ctype.h"
/* Local types */ /* Local types */
@ -1299,7 +1299,7 @@ md_undefined_symbol (name)
/* FALLTHRU */ /* FALLTHRU */
case 'r': case 'r':
if (!isdigit (*++name)) if (!ISDIGIT (*++name))
break; break;
/* FALLTHRU */ /* FALLTHRU */
@ -1307,7 +1307,7 @@ md_undefined_symbol (name)
case '5': case '6': case '7': case '8': case '9': case '5': case '6': case '7': case '8': case '9':
if (name[1] == '\0') if (name[1] == '\0')
num = name[0] - '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'; num = (name[0] - '0') * 10 + name[1] - '0';
if (num >= 32) if (num >= 32)
@ -4214,7 +4214,7 @@ s_alpha_ent (dummy)
input_line_pointer++; input_line_pointer++;
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
} }
if (isdigit (*input_line_pointer) || *input_line_pointer == '-') if (ISDIGIT (*input_line_pointer) || *input_line_pointer == '-')
(void) get_absolute_expression (); (void) get_absolute_expression ();
} }
demand_empty_rest_of_line (); demand_empty_rest_of_line ();

View file

@ -21,9 +21,9 @@
02111-1307, USA. */ 02111-1307, USA. */
#include <stdio.h> #include <stdio.h>
#include <ctype.h>
#include "libiberty.h" #include "libiberty.h"
#include "as.h" #include "as.h"
#include "safe-ctype.h"
#include "subsegs.h" #include "subsegs.h"
#include "opcode/arc.h" #include "opcode/arc.h"
#include "../opcodes/arc-ext.h" #include "../opcodes/arc-ext.h"
@ -393,7 +393,7 @@ md_assemble (str)
} }
/* Skip leading white space. */ /* Skip leading white space. */
while (isspace (*str)) while (ISSPACE (*str))
str++; str++;
/* The instructions are stored in lists hashed by the first letter (though /* The instructions are stored in lists hashed by the first letter (though
@ -544,7 +544,7 @@ md_assemble (str)
} }
/* Pick the suffix out and look it up via the hash table. */ /* 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; continue;
c = *t; c = *t;
*t = '\0'; *t = '\0';
@ -736,7 +736,7 @@ md_assemble (str)
insn and it is assumed that longer versions of insns appear insn and it is assumed that longer versions of insns appear
before shorter ones (eg: lsr r2,r3,1 vs lsr r2,r3). */ before shorter ones (eg: lsr r2,r3,1 vs lsr r2,r3). */
while (isspace (*str)) while (ISSPACE (*str))
++str; ++str;
if (!is_end_of_line[(unsigned char) *str]) if (!is_end_of_line[(unsigned char) *str])
@ -913,8 +913,7 @@ arc_extoper (opertype)
p = name; p = name;
while (*p) while (*p)
{ {
if (isupper (*p)) *p = TOLOWER (*p);
*p = tolower (*p);
p++; p++;
} }
@ -1703,7 +1702,7 @@ md_operand (expressionP)
while (ext_oper) while (ext_oper)
{ {
l = strlen (ext_oper->operand.name); 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; input_line_pointer += l + 1;
expressionP->X_op = O_register; expressionP->X_op = O_register;
@ -1715,7 +1714,7 @@ md_operand (expressionP)
for (i = 0; i < arc_reg_names_count; i++) for (i = 0; i < arc_reg_names_count; i++)
{ {
l = strlen (arc_reg_names[i].name); 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; input_line_pointer += l + 1;
expressionP->X_op = O_register; expressionP->X_op = O_register;

View file

@ -21,10 +21,10 @@
Software Foundation, 59 Temple Place - Suite 330, Boston, MA Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */ 02111-1307, USA. */
#include <ctype.h>
#include <string.h> #include <string.h>
#define NO_RELOC 0 #define NO_RELOC 0
#include "as.h" #include "as.h"
#include "safe-ctype.h"
/* Need TARGET_CPU. */ /* Need TARGET_CPU. */
#include "config.h" #include "config.h"
@ -1864,7 +1864,7 @@ arm_psr_parse (ccp)
{ {
c = *p++; c = *p++;
} }
while (isalpha (c) || c == '_'); while (ISALPHA (c) || c == '_');
/* Terminate the word. */ /* Terminate the word. */
*--p = 0; *--p = 0;
@ -2517,7 +2517,7 @@ accum0_required_here (str)
*str = p; /* Advance caller's string pointer too. */ *str = p; /* Advance caller's string pointer too. */
c = *p++; c = *p++;
while (isalnum (c)) while (ISALNUM (c))
c = *p++; c = *p++;
*--p = 0; /* Aap nul into input buffer at non-alnum. */ *--p = 0; /* Aap nul into input buffer at non-alnum. */
@ -3513,7 +3513,7 @@ do_ldrd (str, flags)
static char buff[128]; static char buff[128];
--str; --str;
while (isspace (*str)) while (ISSPACE (*str))
--str; --str;
str -= 4; str -= 4;
@ -3710,7 +3710,7 @@ decode_shift (str, unrestrict)
skip_whitespace (* str); skip_whitespace (* str);
for (p = * str; isalpha (* p); p ++) for (p = * str; ISALPHA (* p); p ++)
; ;
if (p == * str) if (p == * str)
@ -6407,7 +6407,7 @@ insert_reg (entry)
strcpy (buf + i, reg_table[entry].name); strcpy (buf + i, reg_table[entry].name);
for (i = 0; buf[i]; i++) for (i = 0; buf[i]; i++)
buf2[i] = islower (buf[i]) ? toupper (buf[i]) : buf[i]; buf2[i] = TOUPPER (buf[i]);
buf2[i] = '\0'; buf2[i] = '\0';
@ -6775,11 +6775,11 @@ arm_reg_parse (ccp)
p++, start++; p++, start++;
#endif #endif
#endif #endif
if (!isalpha (*p) || !is_name_beginner (*p)) if (!ISALPHA (*p) || !is_name_beginner (*p))
return FAIL; return FAIL;
c = *p++; c = *p++;
while (isalpha (c) || isdigit (c) || c == '_') while (ISALPHA (c) || ISDIGIT (c) || c == '_')
c = *p++; c = *p++;
*--p = 0; *--p = 0;
@ -8724,9 +8724,9 @@ arm_parse_reloc ()
}; };
for (i = 0, ip = input_line_pointer; for (i = 0, ip = input_line_pointer;
i < sizeof (id) && (isalnum (*ip) || ispunct (*ip)); i < sizeof (id) && (ISALNUM (*ip) || ISPUNCT (*ip));
i++, ip++) i++, ip++)
id[i] = tolower (*ip); id[i] = TOLOWER (*ip);
for (i = 0; reloc_map[i].str; i++) for (i = 0; reloc_map[i].str; i++)
if (strncmp (id, reloc_map[i].str, reloc_map[i].len) == 0) if (strncmp (id, reloc_map[i].str, reloc_map[i].len) == 0)

View file

@ -1,6 +1,6 @@
/* tc-avr.c -- Assembler code for the ATMEL AVR /* 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> Contributed by Denis Chertykov <denisc@overta.ru>
This file is part of GAS, the GNU Assembler. This file is part of GAS, the GNU Assembler.
@ -21,8 +21,8 @@
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#include <stdio.h> #include <stdio.h>
#include <ctype.h>
#include "as.h" #include "as.h"
#include "safe-ctype.h"
#include "subsegs.h" #include "subsegs.h"
struct avr_opcodes_s struct avr_opcodes_s
@ -298,7 +298,7 @@ md_parse_option (c, arg)
char *arg1 = arg; char *arg1 = arg;
do do
*t = tolower (*arg1++); *t = TOLOWER (*arg1++);
while (*t++); while (*t++);
} }
@ -555,12 +555,12 @@ avr_operand (opcode, where, op, line)
str = extract_word (str, r_name, sizeof (r_name)); str = extract_word (str, r_name, sizeof (r_name));
op_mask = 0xff; op_mask = 0xff;
if (isdigit (r_name[1])) if (ISDIGIT (r_name[1]))
{ {
if (r_name[2] == '\0') if (r_name[2] == '\0')
op_mask = r_name[1] - '0'; op_mask = r_name[1] - '0';
else if (r_name[1] != '0' else if (r_name[1] != '0'
&& isdigit (r_name[2]) && ISDIGIT (r_name[2])
&& r_name[3] == '\0') && r_name[3] == '\0')
op_mask = (r_name[1] - '0') * 10 + r_name[2] - '0'; op_mask = (r_name[1] - '0') * 10 + r_name[2] - '0';
} }
@ -613,7 +613,7 @@ avr_operand (opcode, where, op, line)
str = skip_space (str + 1); str = skip_space (str + 1);
op_mask = 0x1002; op_mask = 0x1002;
} }
c = tolower (*str); c = TOLOWER (*str);
if (c == 'x') if (c == 'x')
op_mask |= 0x100c; op_mask |= 0x100c;
else if (c == 'y') else if (c == 'y')
@ -656,7 +656,7 @@ avr_operand (opcode, where, op, line)
case 'b': case 'b':
{ {
char c = tolower (*str++); char c = TOLOWER (*str++);
if (c == 'y') if (c == 'y')
op_mask |= 0x8; op_mask |= 0x8;

View file

@ -23,8 +23,8 @@
MA 02111-1307, USA. */ MA 02111-1307, USA. */
#include <stdio.h> #include <stdio.h>
#include <ctype.h>
#include "as.h" #include "as.h"
#include "safe-ctype.h"
#include "subsegs.h" #include "subsegs.h"
#include "opcode/cris.h" #include "opcode/cris.h"
#include "dwarf2dbg.h" #include "dwarf2dbg.h"
@ -925,7 +925,7 @@ cris_process_instruction (insn_text, out_insnp, prefixp)
/* Find the end of the opcode mnemonic. We assume (true in 2.9.1) /* 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 that the caller has translated the opcode to lower-case, up to the
first non-letter. */ 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 /* Terminate the opcode after letters, but save the character there if
@ -1586,7 +1586,7 @@ get_gen_reg (cPP, regnop)
(*cPP)++; (*cPP)++;
if ((**cPP == 'C' || **cPP == 'c') if ((**cPP == 'C' || **cPP == 'c')
&& ! isalnum ((*cPP)[1])) && ! ISALNUM ((*cPP)[1]))
{ {
/* It's "PC": consume the "c" and we're done. */ /* It's "PC": consume the "c" and we're done. */
(*cPP)++; (*cPP)++;
@ -1600,13 +1600,13 @@ get_gen_reg (cPP, regnop)
/* Hopefully r[0-9] or r1[0-5]. Consume 'R' or 'r'. */ /* Hopefully r[0-9] or r1[0-5]. Consume 'R' or 'r'. */
(*cPP)++; (*cPP)++;
if (isdigit (**cPP)) if (ISDIGIT (**cPP))
{ {
/* It's r[0-9]. Consume and check the next digit. */ /* It's r[0-9]. Consume and check the next digit. */
*regnop = **cPP - '0'; *regnop = **cPP - '0';
(*cPP)++; (*cPP)++;
if (! isalnum (**cPP)) if (! ISALNUM (**cPP))
{ {
/* No more digits, we're done. */ /* No more digits, we're done. */
return 1; return 1;
@ -1688,8 +1688,7 @@ get_spec_reg (cPP, sregpp)
s1 = name_begin; s1 = name_begin;
s2 = sregp->name; s2 = sregp->name;
while (*s2 != '\0' while (*s2 != '\0' && TOLOWER (*s1) == *s2)
&& (isupper (*s1) ? tolower (*s1) == *s2 : *s1 == *s2))
{ {
s1++; s1++;
s2++; s2++;
@ -1698,7 +1697,7 @@ get_spec_reg (cPP, sregpp)
/* For a match, we must have consumed the name in the table, and we /* 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 must be outside what could be part of a name. Assume here that a
test for alphanumerics is sufficient for a name test. */ 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. */ /* We have a match. Update the pointer and be done. */
*cPP = s1; *cPP = s1;
@ -2321,7 +2320,7 @@ get_flags (cPP, flagsp)
whitespace. Anything else, and we consider it a failure. */ whitespace. Anything else, and we consider it a failure. */
if (**cPP != ',' if (**cPP != ','
&& **cPP != 0 && **cPP != 0
&& ! isspace (**cPP)) && ! ISSPACE (**cPP))
return 0; return 0;
else else
return 1; return 1;

View file

@ -20,8 +20,8 @@
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#include <stdio.h> #include <stdio.h>
#include <ctype.h>
#include "as.h" #include "as.h"
#include "safe-ctype.h"
#include "subsegs.h" #include "subsegs.h"
#include "opcode/d10v.h" #include "opcode/d10v.h"
#include "elf/ppc.h" #include "elf/ppc.h"
@ -1185,7 +1185,7 @@ do_assemble (str, opcode)
&& !is_end_of_line[*op_end] && *op_end != ' '; && !is_end_of_line[*op_end] && *op_end != ' ';
op_end++) op_end++)
{ {
name[nlen] = tolower (op_start[nlen]); name[nlen] = TOLOWER (op_start[nlen]);
nlen++; nlen++;
} }
name[nlen] = 0; name[nlen] = 0;

View file

@ -1,5 +1,5 @@
/* tc-d30v.c -- Assembler code for the Mitsubishi D30V /* 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. This file is part of GAS, the GNU Assembler.
@ -19,8 +19,8 @@
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#include <stdio.h> #include <stdio.h>
#include <ctype.h>
#include "as.h" #include "as.h"
#include "safe-ctype.h"
#include "subsegs.h" #include "subsegs.h"
#include "opcode/d30v.h" #include "opcode/d30v.h"
@ -1454,7 +1454,7 @@ do_assemble (str, opcode, shortp, is_parallel)
&& !is_end_of_line[*op_end] && *op_end != ' '; && !is_end_of_line[*op_end] && *op_end != ' ';
op_end++) op_end++)
{ {
name[nlen] = tolower (op_start[nlen]); name[nlen] = TOLOWER (op_start[nlen]);
nlen++; nlen++;
} }
@ -2045,7 +2045,7 @@ d30v_start_line ()
{ {
char *c = input_line_pointer; char *c = input_line_pointer;
while (isspace (*c)) while (ISSPACE (*c))
c++; c++;
if (*c == '.') if (*c == '.')

View file

@ -19,8 +19,8 @@
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#include <stdio.h> #include <stdio.h>
#include <ctype.h>
#include "as.h" #include "as.h"
#include "safe-ctype.h"
#include "subsegs.h" #include "subsegs.h"
#include "symcat.h" #include "symcat.h"
#include "opcodes/fr30-desc.h" #include "opcodes/fr30-desc.h"
@ -614,7 +614,7 @@ fr30_is_colon_insn (start)
continue; continue;
while (len --) while (len --)
if (tolower (start [len]) != insn [len]) if (TOLOWER (start [len]) != insn [len])
break; break;
if (len == -1) if (len == -1)

View file

@ -28,7 +28,7 @@
#define DEFINE_TABLE #define DEFINE_TABLE
#define h8_opcodes ops #define h8_opcodes ops
#include "opcode/h8300.h" #include "opcode/h8300.h"
#include <ctype.h> #include "safe-ctype.h"
#ifdef OBJ_ELF #ifdef OBJ_ELF
#include "elf/h8.h" #include "elf/h8.h"
@ -347,7 +347,7 @@ skip_colonthing (ptr, exp, mode)
{ {
*mode |= L_16; *mode |= L_16;
} }
while (isdigit (*ptr)) while (ISDIGIT (*ptr))
ptr++; ptr++;
} }
} }
@ -418,8 +418,8 @@ get_operand (ptr, op, dst, direction)
/* Gross. Gross. ldm and stm have a format not easily handled /* Gross. Gross. ldm and stm have a format not easily handled
by get_operand. We deal with it explicitly here. */ by get_operand. We deal with it explicitly here. */
if (src[0] == 'e' && src[1] == 'r' && isdigit (src[2]) if (src[0] == 'e' && src[1] == 'r' && ISDIGIT (src[2])
&& src[3] == '-' && src[4] == 'e' && src[5] == 'r' && isdigit (src[6])) && src[3] == '-' && src[4] == 'e' && src[5] == 'r' && ISDIGIT (src[6]))
{ {
int low, high; int low, high;

View file

@ -28,7 +28,7 @@
#define DEFINE_TABLE #define DEFINE_TABLE
#define ASSEMBLER_TABLE #define ASSEMBLER_TABLE
#include "opcodes/h8500-opc.h" #include "opcodes/h8500-opc.h"
#include <ctype.h> #include "safe-ctype.h"
const char comment_chars[] = "!"; const char comment_chars[] = "!";
const char line_separator_chars[] = ";"; const char line_separator_chars[] = ";";
@ -1589,10 +1589,10 @@ start_label (ptr)
char *ptr; char *ptr;
{ {
/* Check for :s.w */ /* Check for :s.w */
if (isalpha (ptr[1]) && ptr[2] == '.') if (ISALPHA (ptr[1]) && ptr[2] == '.')
return 0; return 0;
/* Check for :s */ /* Check for :s */
if (isalpha (ptr[1]) && !isalpha (ptr[2])) if (ISALPHA (ptr[1]) && !ISALPHA (ptr[2]))
return 0; return 0;
return 1; return 1;
} }

View file

@ -23,9 +23,9 @@
at the University of Utah. */ at the University of Utah. */
#include <stdio.h> #include <stdio.h>
#include <ctype.h>
#include "as.h" #include "as.h"
#include "safe-ctype.h"
#include "subsegs.h" #include "subsegs.h"
#include "bfd/libhppa.h" #include "bfd/libhppa.h"
@ -1571,11 +1571,12 @@ pa_ip (str)
/* Convert everything up to the first whitespace character into lower /* Convert everything up to the first whitespace character into lower
case. */ case. */
for (s = str; *s != ' ' && *s != '\t' && *s != '\n' && *s != '\0'; s++) for (s = str; *s != ' ' && *s != '\t' && *s != '\n' && *s != '\0'; s++)
if (isupper (*s)) *s = TOLOWER (*s);
*s = tolower (*s);
/* Skip to something interesting. */ /* 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) switch (*s)
@ -4687,7 +4688,7 @@ pa_parse_number (s, is_float)
pa_number = -1; pa_number = -1;
have_prefix = 0; have_prefix = 0;
num = 0; num = 0;
if (!strict && isdigit (*p)) if (!strict && ISDIGIT (*p))
{ {
/* Looks like a number. */ /* Looks like a number. */
@ -4695,10 +4696,10 @@ pa_parse_number (s, is_float)
{ {
/* The number is specified in hex. */ /* The number is specified in hex. */
p += 2; p += 2;
while (isdigit (*p) || ((*p >= 'a') && (*p <= 'f')) while (ISDIGIT (*p) || ((*p >= 'a') && (*p <= 'f'))
|| ((*p >= 'A') && (*p <= 'F'))) || ((*p >= 'A') && (*p <= 'F')))
{ {
if (isdigit (*p)) if (ISDIGIT (*p))
num = num * 16 + *p - '0'; num = num * 16 + *p - '0';
else if (*p >= 'a' && *p <= 'f') else if (*p >= 'a' && *p <= 'f')
num = num * 16 + *p - 'a' + 10; num = num * 16 + *p - 'a' + 10;
@ -4710,7 +4711,7 @@ pa_parse_number (s, is_float)
else else
{ {
/* The number is specified in decimal. */ /* The number is specified in decimal. */
while (isdigit (*p)) while (ISDIGIT (*p))
{ {
num = num * 10 + *p - '0'; num = num * 10 + *p - '0';
++p; ++p;
@ -4762,7 +4763,7 @@ pa_parse_number (s, is_float)
num = 2; num = 2;
p++; p++;
} }
else if (!isdigit (*p)) else if (!ISDIGIT (*p))
{ {
if (print_errors) if (print_errors)
as_bad (_("Undefined register: '%s'."), name); as_bad (_("Undefined register: '%s'."), name);
@ -4772,7 +4773,7 @@ pa_parse_number (s, is_float)
{ {
do do
num = num * 10 + *p++ - '0'; num = num * 10 + *p++ - '0';
while (isdigit (*p)); while (ISDIGIT (*p));
} }
} }
else else
@ -5124,16 +5125,16 @@ pa_chk_field_selector (str)
*str = *str + 1; *str = *str + 1;
if ((*str)[1] == '\'' || (*str)[1] == '%') if ((*str)[1] == '\'' || (*str)[1] == '%')
name[0] = tolower ((*str)[0]), name[0] = TOLOWER ((*str)[0]),
name[1] = 0; name[1] = 0;
else if ((*str)[2] == '\'' || (*str)[2] == '%') else if ((*str)[2] == '\'' || (*str)[2] == '%')
name[0] = tolower ((*str)[0]), name[0] = TOLOWER ((*str)[0]),
name[1] = tolower ((*str)[1]), name[1] = TOLOWER ((*str)[1]),
name[2] = 0; name[2] = 0;
else if ((*str)[3] == '\'' || (*str)[3] == '%') else if ((*str)[3] == '\'' || (*str)[3] == '%')
name[0] = tolower ((*str)[0]), name[0] = TOLOWER ((*str)[0]),
name[1] = tolower ((*str)[1]), name[1] = TOLOWER ((*str)[1]),
name[2] = tolower ((*str)[2]), name[2] = TOLOWER ((*str)[2]),
name[3] = 0; name[3] = 0;
else else
return e_fsel; return e_fsel;
@ -8196,11 +8197,11 @@ pa_stringer (append_zero)
s++; s++;
for (num_digit = 0, number = 0, dg = *s; for (num_digit = 0, number = 0, dg = *s;
num_digit < 2 num_digit < 2
&& (isdigit (dg) || (dg >= 'a' && dg <= 'f') && (ISDIGIT (dg) || (dg >= 'a' && dg <= 'f')
|| (dg >= 'A' && dg <= 'F')); || (dg >= 'A' && dg <= 'F'));
num_digit++) num_digit++)
{ {
if (isdigit (dg)) if (ISDIGIT (dg))
number = number * 16 + dg - '0'; number = number * 16 + dg - '0';
else if (dg >= 'a' && dg <= 'f') else if (dg >= 'a' && dg <= 'f')
number = number * 16 + dg - 'a' + 10; number = number * 16 + dg - 'a' + 10;

View file

@ -29,8 +29,8 @@
*/ */
#include <stdio.h> #include <stdio.h>
#include <ctype.h>
#include "as.h" #include "as.h"
#include "c=ctype.h"
#include "subsegs.h" #include "subsegs.h"
#include "struc-symbol.h" #include "struc-symbol.h"
@ -334,7 +334,7 @@ register_name (expressionP)
/* Find the spelling of the operand. */ /* Find the spelling of the operand. */
start = name = input_line_pointer; start = name = input_line_pointer;
if (name[0] == '%' && isalpha (name[1])) if (name[0] == '%' && ISALPHA (name[1]))
name = ++input_line_pointer; name = ++input_line_pointer;
else if (!reg_names_p) else if (!reg_names_p)
@ -345,7 +345,7 @@ register_name (expressionP)
/* If it's a number, treat it as a number. If it's alpha, look to /* If it's a number, treat it as a number. If it's alpha, look to
see if it's in the register table. */ see if it's in the register table. */
if (!isalpha (name[0])) if (!ISALPHA (name[0]))
{ {
reg_number = get_single_number (); reg_number = get_single_number ();
} }
@ -702,10 +702,10 @@ i370_elf_suffix (str_p, exp_p)
for (ch = *str, str2 = ident; for (ch = *str, str2 = ident;
(str2 < ident + sizeof (ident) - 1 (str2 < ident + sizeof (ident) - 1
&& (isalnum (ch) || ch == '@')); && (ISALNUM (ch) || ch == '@'));
ch = *++str) ch = *++str)
{ {
*str2++ = (islower (ch)) ? ch : tolower (ch); *str2++ = TOLOWER (ch);
} }
*str2 = '\0'; *str2 = '\0';
@ -1489,11 +1489,11 @@ i370_addr_offset (expressionS *exx)
lab = input_line_pointer; lab = input_line_pointer;
while (*lab && (',' != *lab) && ('(' != *lab)) while (*lab && (',' != *lab) && ('(' != *lab))
{ {
if (isdigit (*lab)) if (ISDIGIT (*lab))
{ {
all_digits = 1; all_digits = 1;
} }
else if (isalpha (*lab)) else if (ISALPHA (*lab))
{ {
if (!all_digits) if (!all_digits)
{ {
@ -1562,7 +1562,7 @@ i370_addr_cons (expressionS *exp)
name = input_line_pointer; name = input_line_pointer;
sym_name = input_line_pointer; sym_name = input_line_pointer;
/* Find the spelling of the operand */ /* Find the spelling of the operand */
if (name[0] == '=' && isalpha (name[1])) if (name[0] == '=' && ISALPHA (name[1]))
{ {
name = ++input_line_pointer; name = ++input_line_pointer;
} }
@ -1652,7 +1652,7 @@ i370_addr_cons (expressionS *exp)
save = input_line_pointer; save = input_line_pointer;
while (*save) while (*save)
{ {
if (isxdigit (*save)) if (ISXDIGIT (*save))
hex_len++; hex_len++;
save++; save++;
} }
@ -1979,7 +1979,7 @@ md_assemble (str)
#endif #endif
/* Get the opcode. */ /* Get the opcode. */
for (s = str; *s != '\0' && ! isspace (*s); s++) for (s = str; *s != '\0' && ! ISSPACE (*s); s++)
; ;
if (*s != '\0') if (*s != '\0')
*s++ = '\0'; *s++ = '\0';
@ -2004,7 +2004,7 @@ md_assemble (str)
insn = opcode->opcode; insn = opcode->opcode;
str = s; str = s;
while (isspace (*str)) while (ISSPACE (*str))
++str; ++str;
/* I370 operands are either expressions or address constants. /* I370 operands are either expressions or address constants.
@ -2289,7 +2289,7 @@ md_assemble (str)
++str; ++str;
} }
while (isspace (*str)) while (ISSPACE (*str))
++str; ++str;
if (*str != '\0') if (*str != '\0')

View file

@ -26,9 +26,8 @@
Bugs & suggestions are completely welcome. This is free software. Bugs & suggestions are completely welcome. This is free software.
Please help us make it better. */ Please help us make it better. */
#include <ctype.h>
#include "as.h" #include "as.h"
#include "safe-ctype.h"
#include "subsegs.h" #include "subsegs.h"
#include "dwarf2dbg.h" #include "dwarf2dbg.h"
#include "opcode/i386.h" #include "opcode/i386.h"
@ -891,27 +890,27 @@ md_begin ()
for (c = 0; c < 256; c++) for (c = 0; c < 256; c++)
{ {
if (isdigit (c)) if (ISDIGIT (c))
{ {
digit_chars[c] = c; digit_chars[c] = c;
mnemonic_chars[c] = c; mnemonic_chars[c] = c;
register_chars[c] = c; register_chars[c] = c;
operand_chars[c] = c; operand_chars[c] = c;
} }
else if (islower (c)) else if (ISLOWER (c))
{ {
mnemonic_chars[c] = c; mnemonic_chars[c] = c;
register_chars[c] = c; register_chars[c] = c;
operand_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]; register_chars[c] = mnemonic_chars[c];
operand_chars[c] = c; operand_chars[c] = c;
} }
if (isalpha (c) || isdigit (c)) if (ISALPHA (c) || ISDIGIT (c))
identifier_chars[c] = c; identifier_chars[c] = c;
else if (c >= 128) else if (c >= 128)
{ {
@ -4461,7 +4460,7 @@ static char *
output_invalid (c) output_invalid (c)
int c; int c;
{ {
if (isprint (c)) if (ISPRINT (c))
sprintf (output_invalid_buf, "'%c'", c); sprintf (output_invalid_buf, "'%c'", c);
else else
sprintf (output_invalid_buf, "(0x%x)", (unsigned) c); sprintf (output_invalid_buf, "(0x%x)", (unsigned) c);

View file

@ -1,5 +1,5 @@
/* tc-i860.c -- Assembler for the Intel i860 architecture. /* 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. Free Software Foundation, Inc.
Brought back from the dead and completely reworked Brought back from the dead and completely reworked
@ -21,10 +21,10 @@
with GAS; see the file COPYING. If not, write to the Free Software with GAS; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <ctype.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "as.h" #include "as.h"
#include "safe-ctype.h"
#include "subsegs.h" #include "subsegs.h"
#include "opcode/i860.h" #include "opcode/i860.h"
#include "elf/i860.h" #include "elf/i860.h"
@ -409,7 +409,7 @@ i860_process_insn (str)
opcode = 0; opcode = 0;
#endif #endif
for (s = str; islower (*s) || *s == '.' || *s == '3' for (s = str; ISLOWER (*s) || *s == '.' || *s == '3'
|| *s == '2' || *s == '1'; ++s) || *s == '2' || *s == '1'; ++s)
; ;
@ -485,9 +485,9 @@ i860_process_insn (str)
/* Must be at least one digit. */ /* Must be at least one digit. */
case '#': case '#':
if (isdigit (*s++)) if (ISDIGIT (*s++))
{ {
while (isdigit (*s)) while (ISDIGIT (*s))
++s; ++s;
continue; continue;
} }
@ -528,11 +528,11 @@ i860_process_insn (str)
/* Any register r0..r31. */ /* Any register r0..r31. */
case 'r': case 'r':
s++; s++;
if (!isdigit (c = *s++)) if (!ISDIGIT (c = *s++))
{ {
goto error; goto error;
} }
if (isdigit (*s)) if (ISDIGIT (*s))
{ {
if ((c = 10 * (c - '0') + (*s++ - '0')) >= 32) if ((c = 10 * (c - '0') + (*s++ - '0')) >= 32)
goto error; goto error;
@ -575,10 +575,10 @@ i860_process_insn (str)
else else
s++; s++;
if (*s++ == 'f' && isdigit (*s)) if (*s++ == 'f' && ISDIGIT (*s))
{ {
mask = *s++; mask = *s++;
if (isdigit (*s)) if (ISDIGIT (*s))
{ {
mask = 10 * (mask - '0') + (*s++ - '0'); mask = 10 * (mask - '0') + (*s++ - '0');
if (mask >= 32) if (mask >= 32)

View file

@ -64,10 +64,10 @@
a relocation directive. */ a relocation directive. */
#include <stdio.h> #include <stdio.h>
#include <ctype.h>
#include "as.h" #include "as.h"
#include "safe-ctype.h"
#include "obstack.h" #include "obstack.h"
#include "opcode/i960.h" #include "opcode/i960.h"
@ -1389,8 +1389,8 @@ get_args (p, args)
{ {
if (*p == ' ' if (*p == ' '
&& (! isalnum ((unsigned char) p[1]) && (! ISALNUM (p[1])
|| ! isalnum ((unsigned char) p[-1]))) || ! ISALNUM (p[-1])))
{ {
p++; p++;

View file

@ -43,6 +43,7 @@
*/ */
#include "as.h" #include "as.h"
#include "safe-ctype.h"
#include "dwarf2dbg.h" #include "dwarf2dbg.h"
#include "subsegs.h" #include "subsegs.h"
@ -4514,7 +4515,7 @@ dot_pred_rel (type)
valueT bit = 1; valueT bit = 1;
int regno; int regno;
if (toupper (*input_line_pointer) != 'P' if (TOUPPER (*input_line_pointer) != 'P'
|| (regno = atoi (++input_line_pointer)) < 0 || (regno = atoi (++input_line_pointer)) < 0
|| regno > 63) || regno > 63)
{ {
@ -4522,7 +4523,7 @@ dot_pred_rel (type)
ignore_rest_of_line (); ignore_rest_of_line ();
return; return;
} }
while (isdigit (*input_line_pointer)) while (ISDIGIT (*input_line_pointer))
++input_line_pointer; ++input_line_pointer;
if (p1 == -1) if (p1 == -1)
p1 = regno; p1 = regno;
@ -4539,7 +4540,7 @@ dot_pred_rel (type)
valueT stop = 1; valueT stop = 1;
++input_line_pointer; ++input_line_pointer;
if (toupper (*input_line_pointer) != 'P' if (TOUPPER (*input_line_pointer) != 'P'
|| (regno = atoi (++input_line_pointer)) < 0 || (regno = atoi (++input_line_pointer)) < 0
|| regno > 63) || regno > 63)
{ {
@ -4547,7 +4548,7 @@ dot_pred_rel (type)
ignore_rest_of_line (); ignore_rest_of_line ();
return; return;
} }
while (isdigit (*input_line_pointer)) while (ISDIGIT (*input_line_pointer))
++input_line_pointer; ++input_line_pointer;
stop <<= regno; stop <<= regno;
if (bit >= stop) if (bit >= stop)
@ -6779,10 +6780,10 @@ ia64_unrecognized_line (ch)
c = get_symbol_end (); c = get_symbol_end ();
} }
else if (LOCAL_LABELS_FB else if (LOCAL_LABELS_FB
&& isdigit ((unsigned char) *input_line_pointer)) && ISDIGIT (*input_line_pointer))
{ {
temp = 0; temp = 0;
while (isdigit ((unsigned char) *input_line_pointer)) while (ISDIGIT (*input_line_pointer))
temp = (temp * 10) + *input_line_pointer++ - '0'; temp = (temp * 10) + *input_line_pointer++ - '0';
fb_label_instance_inc (temp); fb_label_instance_inc (temp);
s = fb_label_name (temp, 0); s = fb_label_name (temp, 0);
@ -6955,7 +6956,7 @@ ia64_parse_name (name, e)
switch (name[0]) switch (name[0])
{ {
case 'i': case 'i':
if (name[1] == 'n' && isdigit (name[2])) if (name[1] == 'n' && ISDIGIT (name[2]))
{ {
dr = &md.in; dr = &md.in;
name += 2; name += 2;
@ -6963,7 +6964,7 @@ ia64_parse_name (name, e)
break; break;
case 'l': 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; dr = &md.loc;
name += 3; name += 3;
@ -6971,7 +6972,7 @@ ia64_parse_name (name, e)
break; break;
case 'o': 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; dr = &md.out;
name += 3; name += 3;

View file

@ -20,8 +20,8 @@
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#include <stdio.h> #include <stdio.h>
#include <ctype.h>
#include "as.h" #include "as.h"
#include "safe-ctype.h"
#include "subsegs.h" #include "subsegs.h"
#include "symcat.h" #include "symcat.h"
#include "opcodes/m32r-desc.h" #include "opcodes/m32r-desc.h"
@ -819,15 +819,14 @@ assemble_two_insns (str, str2, parallel_p)
{ {
char *s2 = str; char *s2 = str;
while (isspace (*s2++)) while (ISSPACE (*s2++))
continue; continue;
--s2; --s2;
while (isalnum (*s2)) while (ISALNUM (*s2))
{ {
if (isupper ((unsigned char) *s2)) *s2 = TOLOWER (*s2);
*s2 = tolower (*s2);
s2++; s2++;
} }
} }

View file

@ -20,8 +20,8 @@
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#include <stdio.h> #include <stdio.h>
#include <ctype.h>
#include "as.h" #include "as.h"
#include "safe-ctype.h"
#include "subsegs.h" #include "subsegs.h"
#include "opcode/m68hc11.h" #include "opcode/m68hc11.h"
#include "dwarf2dbg.h" #include "dwarf2dbg.h"
@ -2234,7 +2234,7 @@ md_assemble (str)
*op_end && nlen < 20 && !is_end_of_line[*op_end] && *op_end != ' '; *op_end && nlen < 20 && !is_end_of_line[*op_end] && *op_end != ' ';
op_end++) op_end++)
{ {
name[nlen] = tolower (op_start[nlen]); name[nlen] = TOLOWER (op_start[nlen]);
nlen++; nlen++;
} }
name[nlen] = 0; name[nlen] = 0;
@ -2276,14 +2276,14 @@ md_assemble (str)
&& (*op_end && && (*op_end &&
(is_end_of_line[op_end[1]] (is_end_of_line[op_end[1]]
|| op_end[1] == ' ' || op_end[1] == '\t' || 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 == 'A' || *op_end == 'B' || *op_end == 'A' || *op_end == 'B'
|| *op_end == 'd' || *op_end == 'D' || *op_end == 'd' || *op_end == 'D'
|| *op_end == 'x' || *op_end == 'X' || *op_end == 'x' || *op_end == 'X'
|| *op_end == 'y' || *op_end == 'Y')) || *op_end == 'y' || *op_end == 'Y'))
{ {
name[nlen++] = tolower (*op_end++); name[nlen++] = TOLOWER (*op_end++);
name[nlen] = 0; name[nlen] = 0;
opc = (struct m68hc11_opcode_def *) hash_find (m68hc11_hash, opc = (struct m68hc11_opcode_def *) hash_find (m68hc11_hash,
name); name);

View file

@ -20,8 +20,8 @@
Software Foundation, 59 Temple Place - Suite 330, Boston, MA Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */ 02111-1307, USA. */
#include <ctype.h>
#include "as.h" #include "as.h"
#include "safe-ctype.h"
#include "obstack.h" #include "obstack.h"
#include "subsegs.h" #include "subsegs.h"
#include "dwarf2dbg.h" #include "dwarf2dbg.h"
@ -648,8 +648,6 @@ CONST pseudo_typeS mote_pseudo_table[] =
extern char *input_line_pointer; 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 notend_table[256];
static char alt_notend_table[256]; static char alt_notend_table[256];
#define notend(s) \ #define notend(s) \
@ -3311,7 +3309,7 @@ insert_reg (regname, regnum)
&zero_address_frag)); &zero_address_frag));
for (i = 0; regname[i]; i++) for (i = 0; regname[i]; i++)
buf[i] = islower (regname[i]) ? toupper (regname[i]) : regname[i]; buf[i] = TOUPPER (regname[i]);
buf[i] = '\0'; buf[i] = '\0';
symbol_table_insert (symbol_new (buf, reg_section, regnum, symbol_table_insert (symbol_new (buf, reg_section, regnum,
@ -3880,9 +3878,6 @@ md_begin ()
} }
} }
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++) for (i = 0; i < (int) sizeof (notend_table); i++)
{ {
notend_table[i] = 0; notend_table[i] = 0;
@ -5370,7 +5365,7 @@ s_reg (ignore)
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
s = input_line_pointer; s = input_line_pointer;
while (isalnum ((unsigned char) *input_line_pointer) while (ISALNUM (*input_line_pointer)
#ifdef REGISTER_PREFIX #ifdef REGISTER_PREFIX
|| *input_line_pointer == REGISTER_PREFIX || *input_line_pointer == REGISTER_PREFIX
#endif #endif
@ -5582,10 +5577,7 @@ mri_assemble (str)
/* md_assemble expects the opcode to be in lower case. */ /* md_assemble expects the opcode to be in lower case. */
for (s = str; *s != ' ' && *s != '\0'; s++) for (s = str; *s != ' ' && *s != '\0'; s++)
{ *s = TOLOWER (*s);
if (isupper ((unsigned char) *s))
*s = tolower ((unsigned char) *s);
}
md_assemble (str); md_assemble (str);
} }
@ -5667,10 +5659,8 @@ parse_mri_condition (pcc)
++input_line_pointer; ++input_line_pointer;
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
if (isupper (c1)) c1 = TOLOWER (c1);
c1 = tolower (c1); c2 = TOLOWER (c2);
if (isupper (c2))
c2 = tolower (c2);
*pcc = (c1 << 8) | c2; *pcc = (c1 << 8) | c2;
@ -5912,7 +5902,7 @@ build_mri_control_operand (qual, cc, leftstart, leftstop, rightstart,
*s++ = 'm'; *s++ = 'm';
*s++ = 'p'; *s++ = 'p';
if (qual != '\0') if (qual != '\0')
*s++ = tolower (qual); *s++ = TOLOWER (qual);
*s++ = ' '; *s++ = ' ';
memcpy (s, leftstart, leftstop - leftstart); memcpy (s, leftstart, leftstop - leftstart);
s += leftstop - leftstart; s += leftstop - leftstart;
@ -5930,7 +5920,7 @@ build_mri_control_operand (qual, cc, leftstart, leftstop, rightstart,
*s++ = cc >> 8; *s++ = cc >> 8;
*s++ = cc & 0xff; *s++ = cc & 0xff;
if (extent != '\0') if (extent != '\0')
*s++ = tolower (extent); *s++ = TOLOWER (extent);
*s++ = ' '; *s++ = ' ';
strcpy (s, truelab); strcpy (s, truelab);
mri_assemble (buf); mri_assemble (buf);
@ -6180,7 +6170,7 @@ s_mri_else (qual)
mri_control_stack->else_seen = 1; mri_control_stack->else_seen = 1;
buf = (char *) xmalloc (20 + strlen (mri_control_stack->bottom)); buf = (char *) xmalloc (20 + strlen (mri_control_stack->bottom));
q[0] = tolower (qual); q[0] = TOLOWER (qual);
q[1] = '\0'; q[1] = '\0';
sprintf (buf, "bra%s %s", q, mri_control_stack->bottom); sprintf (buf, "bra%s %s", q, mri_control_stack->bottom);
mri_assemble (buf); mri_assemble (buf);
@ -6253,7 +6243,7 @@ s_mri_break (extent)
} }
buf = (char *) xmalloc (20 + strlen (n->bottom)); buf = (char *) xmalloc (20 + strlen (n->bottom));
ex[0] = tolower (extent); ex[0] = TOLOWER (extent);
ex[1] = '\0'; ex[1] = '\0';
sprintf (buf, "bra%s %s", ex, n->bottom); sprintf (buf, "bra%s %s", ex, n->bottom);
mri_assemble (buf); mri_assemble (buf);
@ -6292,7 +6282,7 @@ s_mri_next (extent)
} }
buf = (char *) xmalloc (20 + strlen (n->next)); buf = (char *) xmalloc (20 + strlen (n->next));
ex[0] = tolower (extent); ex[0] = TOLOWER (extent);
ex[1] = '\0'; ex[1] = '\0';
sprintf (buf, "bra%s %s", ex, n->next); sprintf (buf, "bra%s %s", ex, n->next);
mri_assemble (buf); mri_assemble (buf);
@ -6476,7 +6466,7 @@ s_mri_for (qual)
*s++ = 'v'; *s++ = 'v';
*s++ = 'e'; *s++ = 'e';
if (qual != '\0') if (qual != '\0')
*s++ = tolower (qual); *s++ = TOLOWER (qual);
*s++ = ' '; *s++ = ' ';
memcpy (s, initstart, initstop - initstart); memcpy (s, initstart, initstop - initstart);
s += initstop - initstart; s += initstop - initstart;
@ -6494,7 +6484,7 @@ s_mri_for (qual)
*s++ = 'm'; *s++ = 'm';
*s++ = 'p'; *s++ = 'p';
if (qual != '\0') if (qual != '\0')
*s++ = tolower (qual); *s++ = TOLOWER (qual);
*s++ = ' '; *s++ = ' ';
memcpy (s, endstart, endstop - endstart); memcpy (s, endstart, endstop - endstart);
s += endstop - endstart; s += endstop - endstart;
@ -6505,7 +6495,7 @@ s_mri_for (qual)
mri_assemble (buf); mri_assemble (buf);
/* bcc bottom */ /* bcc bottom */
ex[0] = tolower (extent); ex[0] = TOLOWER (extent);
ex[1] = '\0'; ex[1] = '\0';
if (up) if (up)
sprintf (buf, "blt%s %s", ex, n->bottom); sprintf (buf, "blt%s %s", ex, n->bottom);
@ -6521,7 +6511,7 @@ s_mri_for (qual)
strcpy (s, "sub"); strcpy (s, "sub");
s += 3; s += 3;
if (qual != '\0') if (qual != '\0')
*s++ = tolower (qual); *s++ = TOLOWER (qual);
*s++ = ' '; *s++ = ' ';
memcpy (s, bystart, bystop - bystart); memcpy (s, bystart, bystop - bystart);
s += bystop - bystart; s += bystop - bystart;

View file

@ -2,7 +2,7 @@
Contributed by Devon Bowen of Buffalo University Contributed by Devon Bowen of Buffalo University
and Torbjorn Granlund of the Swedish Institute of Computer Science. and Torbjorn Granlund of the Swedish Institute of Computer Science.
Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1999, Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1999,
2000 2000, 2001
Free Software Foundation, Inc. Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler. This file is part of GAS, the GNU Assembler.
@ -22,8 +22,8 @@ along with GAS; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */ 02111-1307, USA. */
#include <ctype.h>
#include "as.h" #include "as.h"
#include "safe-ctype.h"
#include "subsegs.h" #include "subsegs.h"
#include "m88k-opcode.h" #include "m88k-opcode.h"
@ -239,7 +239,7 @@ md_assemble (op)
assert (op); assert (op);
/* Skip over instruction to find parameters. */ /* Skip over instruction to find parameters. */
for (param = op; *param != 0 && !isspace (*param); param++) for (param = op; *param != 0 && !ISSPACE (*param); param++)
; ;
c = *param; c = *param;
*param++ = '\0'; *param++ = '\0';
@ -517,17 +517,17 @@ get_imm16 (param, insn)
unsigned int val; unsigned int val;
char *save_ptr; char *save_ptr;
if (!strncmp (param, "hi16", 4) && !isalnum (param[4])) if (!strncmp (param, "hi16", 4) && !ISALNUM (param[4]))
{ {
reloc = RELOC_HI16; reloc = RELOC_HI16;
param += 4; param += 4;
} }
else if (!strncmp (param, "lo16", 4) && !isalnum (param[4])) else if (!strncmp (param, "lo16", 4) && !ISALNUM (param[4]))
{ {
reloc = RELOC_LO16; reloc = RELOC_LO16;
param += 4; param += 4;
} }
else if (!strncmp (param, "iw16", 4) && !isalnum (param[4])) else if (!strncmp (param, "iw16", 4) && !ISALNUM (param[4]))
{ {
reloc = RELOC_IW16; reloc = RELOC_IW16;
param += 4; param += 4;
@ -630,7 +630,7 @@ get_cnd (param, valp)
{ {
unsigned int val; unsigned int val;
if (isdigit (*param)) if (ISDIGIT (*param))
{ {
param = getval (param, &val); param = getval (param, &val);
@ -642,11 +642,8 @@ get_cnd (param, valp)
} }
else else
{ {
if (isupper (*param)) param[0] = TOLOWER (param[0]);
*param = tolower (*param); param[1] = TOLOWER (param[1]);
if (isupper (param[1]))
param[1] = tolower (param[1]);
param = match_name (param, cndmsk, valp); param = match_name (param, cndmsk, valp);
@ -690,12 +687,10 @@ get_bf_offset_expression (param, offsetp)
{ {
unsigned offset; unsigned offset;
if (isalpha (param[0])) if (ISALPHA (param[0]))
{ {
if (isupper (param[0])) param[0] = TOLOWER (param[0]);
param[0] = tolower (param[0]); param[1] = TOLOWER (param[1]);
if (isupper (param[1]))
param[1] = tolower (param[1]);
param = match_name (param, cmpslot, offsetp); param = match_name (param, cmpslot, offsetp);
@ -888,9 +883,9 @@ get_o6 (param, valp)
} }
#define hexval(z) \ #define hexval(z) \
(isdigit (z) ? (z) - '0' : \ (ISDIGIT (z) ? (z) - '0' : \
islower (z) ? (z) - 'a' + 10 : \ ISLOWER (z) ? (z) - 'a' + 10 : \
isupper (z) ? (z) - 'A' + 10 : -1) ISUPPER (z) ? (z) - 'A' + 10 : -1)
static char * static char *
getval (param, valp) getval (param, valp)

View file

@ -24,7 +24,7 @@
#include "subsegs.h" #include "subsegs.h"
#define DEFINE_TABLE #define DEFINE_TABLE
#include "../opcodes/mcore-opc.h" #include "../opcodes/mcore-opc.h"
#include <ctype.h> #include "safe-ctype.h"
#include <string.h> #include <string.h>
#ifdef OBJ_ELF #ifdef OBJ_ELF
@ -390,11 +390,11 @@ mcore_s_section (ignore)
pool. */ pool. */
char * ilp = input_line_pointer; char * ilp = input_line_pointer;
while (*ilp != 0 && isspace(*ilp)) while (*ilp != 0 && ISSPACE (*ilp))
++ ilp; ++ ilp;
if (strncmp (ilp, ".line", 5) == 0 if (strncmp (ilp, ".line", 5) == 0
&& (isspace (ilp[5]) || *ilp == '\n' || *ilp == '\r')) && (ISSPACE (ilp[5]) || *ilp == '\n' || *ilp == '\r'))
; ;
else else
dump_literals (0); dump_literals (0);
@ -480,10 +480,10 @@ parse_reg (s, reg)
unsigned * reg; unsigned * reg;
{ {
/* Strip leading whitespace. */ /* Strip leading whitespace. */
while (isspace (* s)) while (ISSPACE (* s))
++ s; ++ s;
if (tolower (s[0]) == 'r') if (TOLOWER (s[0]) == 'r')
{ {
if (s[1] == '1' && s[2] >= '0' && s[2] <= '5') if (s[1] == '1' && s[2] >= '0' && s[2] <= '5')
{ {
@ -497,9 +497,9 @@ parse_reg (s, reg)
return s + 2; return s + 2;
} }
} }
else if ( tolower (s[0]) == 's' else if ( TOLOWER (s[0]) == 's'
&& tolower (s[1]) == 'p' && TOLOWER (s[1]) == 'p'
&& ! isalnum (s[2])) && ! ISALNUM (s[2]))
{ {
* reg = 0; * reg = 0;
return s + 2; return s + 2;
@ -540,10 +540,10 @@ parse_creg (s, reg)
int i; int i;
/* Strip leading whitespace. */ /* Strip leading whitespace. */
while (isspace (* s)) while (ISSPACE (* s))
++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') if (s[2] == '3' && s[3] >= '0' && s[3] <= '1')
{ {
@ -580,7 +580,7 @@ parse_creg (s, reg)
length = strlen (cregs[i].name); length = strlen (cregs[i].name);
for (j = 0; j < length; j++) for (j = 0; j < length; j++)
buf[j] = tolower (s[j]); buf[j] = TOLOWER (s[j]);
if (strncmp (cregs[i].name, buf, length) == 0) if (strncmp (cregs[i].name, buf, length) == 0)
{ {
@ -615,7 +615,7 @@ parse_psrmod (s, reg)
}; };
for (i = 0; i < 2; i++) 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--;) for (i = sizeof (psrmods) / sizeof (psrmods[0]); i--;)
{ {
@ -643,7 +643,7 @@ parse_exp (s, e)
char * new; char * new;
/* Skip whitespace. */ /* Skip whitespace. */
while (isspace (* s)) while (ISSPACE (* s))
++ s; ++ s;
save = input_line_pointer; save = input_line_pointer;
@ -903,14 +903,14 @@ parse_mem (s, reg, off, siz)
* off = 0; * off = 0;
while (isspace (* s)) while (ISSPACE (* s))
++ s; ++ s;
if (* s == '(') if (* s == '(')
{ {
s = parse_reg (s + 1, reg); s = parse_reg (s + 1, reg);
while (isspace (* s)) while (ISSPACE (* s))
++ s; ++ s;
if (* s == ',') if (* s == ',')
@ -936,7 +936,7 @@ parse_mem (s, reg, off, siz)
} }
} }
while (isspace (* s)) while (ISSPACE (* s))
++ s; ++ s;
if (* s == ')') if (* s == ')')
@ -969,7 +969,7 @@ md_assemble (str)
char name[20]; char name[20];
/* Drop leading whitespace. */ /* Drop leading whitespace. */
while (isspace (* str)) while (ISSPACE (* str))
str ++; str ++;
/* Find the op code end. */ /* Find the op code end. */
@ -1068,7 +1068,7 @@ md_assemble (str)
inst |= reg; inst |= reg;
/* Skip whitespace. */ /* Skip whitespace. */
while (isspace (* op_end)) while (ISSPACE (* op_end))
++ op_end; ++ op_end;
if (*op_end == ',') if (*op_end == ',')
@ -1092,7 +1092,7 @@ md_assemble (str)
inst |= reg; inst |= reg;
/* Skip whitespace. */ /* Skip whitespace. */
while (isspace (* op_end)) while (ISSPACE (* op_end))
++ op_end; ++ op_end;
if (* op_end == ',') if (* op_end == ',')
@ -1110,7 +1110,7 @@ md_assemble (str)
op_end = parse_reg (op_end + 1, & reg); op_end = parse_reg (op_end + 1, & reg);
/* Skip whitespace. */ /* Skip whitespace. */
while (isspace (* op_end)) while (ISSPACE (* op_end))
++ op_end; ++ op_end;
if (* op_end == ',') /* xtrb- r1,rx */ if (* op_end == ',') /* xtrb- r1,rx */
@ -1130,7 +1130,7 @@ md_assemble (str)
inst |= reg; inst |= reg;
/* Skip whitespace. */ /* Skip whitespace. */
while (isspace (* op_end)) while (ISSPACE (* op_end))
++ op_end; ++ op_end;
if (* op_end == ',') if (* op_end == ',')
@ -1150,7 +1150,7 @@ md_assemble (str)
inst |= reg; inst |= reg;
/* Skip whitespace. */ /* Skip whitespace. */
while (isspace (* op_end)) while (ISSPACE (* op_end))
++ op_end; ++ op_end;
if (* op_end == ',') if (* op_end == ',')
@ -1169,7 +1169,7 @@ md_assemble (str)
inst |= reg; inst |= reg;
/* Skip whitespace. */ /* Skip whitespace. */
while (isspace (* op_end)) while (ISSPACE (* op_end))
++ op_end; ++ op_end;
if (* op_end == ',') if (* op_end == ',')
@ -1188,7 +1188,7 @@ md_assemble (str)
inst |= reg; inst |= reg;
/* Skip whitespace. */ /* Skip whitespace. */
while (isspace (* op_end)) while (ISSPACE (* op_end))
++ op_end; ++ op_end;
if (* op_end == ',') if (* op_end == ',')
@ -1217,7 +1217,7 @@ md_assemble (str)
inst |= reg; inst |= reg;
/* Skip whitespace. */ /* Skip whitespace. */
while (isspace (* op_end)) while (ISSPACE (* op_end))
++ op_end; ++ op_end;
if (* op_end == ',') if (* op_end == ',')
@ -1244,7 +1244,7 @@ md_assemble (str)
inst |= reg; inst |= reg;
/* Skip whitespace. */ /* Skip whitespace. */
while (isspace (* op_end)) while (ISSPACE (* op_end))
++ op_end; ++ op_end;
if (* op_end == ',') if (* op_end == ',')
@ -1283,7 +1283,7 @@ md_assemble (str)
inst |= reg; inst |= reg;
/* Skip whitespace. */ /* Skip whitespace. */
while (isspace (* op_end)) while (ISSPACE (* op_end))
++ op_end; ++ op_end;
if (* op_end == ',') if (* op_end == ',')
@ -1316,7 +1316,7 @@ md_assemble (str)
inst |= reg; inst |= reg;
/* Skip whitespace. */ /* Skip whitespace. */
while (isspace (* op_end)) while (ISSPACE (* op_end))
++ op_end; ++ op_end;
if (* op_end == ',') if (* op_end == ',')
@ -1335,7 +1335,7 @@ md_assemble (str)
inst |= reg; inst |= reg;
/* Skip whitespace. */ /* Skip whitespace. */
while (isspace (* op_end)) while (ISSPACE (* op_end))
++ op_end; ++ op_end;
if (* op_end == ',') if (* op_end == ',')
@ -1354,7 +1354,7 @@ md_assemble (str)
inst |= reg << 8; inst |= reg << 8;
/* Skip whitespace. */ /* Skip whitespace. */
while (isspace (* op_end)) while (ISSPACE (* op_end))
++ op_end; ++ op_end;
if (* op_end == ',') if (* op_end == ',')
@ -1390,7 +1390,7 @@ md_assemble (str)
inst |= (reg << 8); inst |= (reg << 8);
/* Skip whitespace. */ /* Skip whitespace. */
while (isspace (* op_end)) while (ISSPACE (* op_end))
++ op_end; ++ op_end;
if (* op_end == ',') if (* op_end == ',')
@ -1421,7 +1421,7 @@ md_assemble (str)
inst |= reg; inst |= reg;
/* Skip whitespace. */ /* Skip whitespace. */
while (isspace (* op_end)) while (ISSPACE (* op_end))
++ op_end; ++ op_end;
if (* op_end == '-') if (* op_end == '-')
@ -1432,7 +1432,7 @@ md_assemble (str)
as_bad (_("ending register must be r15")); as_bad (_("ending register must be r15"));
/* Skip whitespace. */ /* Skip whitespace. */
while (isspace (* op_end)) while (ISSPACE (* op_end))
++ op_end; ++ op_end;
} }
@ -1441,7 +1441,7 @@ md_assemble (str)
op_end ++; op_end ++;
/* Skip whitespace. */ /* Skip whitespace. */
while (isspace (* op_end)) while (ISSPACE (* op_end))
++ op_end; ++ op_end;
if (* op_end == '(') if (* op_end == '(')
@ -1470,7 +1470,7 @@ md_assemble (str)
as_fatal (_("first register must be r4")); as_fatal (_("first register must be r4"));
/* Skip whitespace. */ /* Skip whitespace. */
while (isspace (* op_end)) while (ISSPACE (* op_end))
++ op_end; ++ op_end;
if (* op_end == '-') if (* op_end == '-')
@ -1481,7 +1481,7 @@ md_assemble (str)
as_fatal (_("last register must be r7")); as_fatal (_("last register must be r7"));
/* Skip whitespace. */ /* Skip whitespace. */
while (isspace (* op_end)) while (ISSPACE (* op_end))
++ op_end; ++ op_end;
if (* op_end == ',') if (* op_end == ',')
@ -1489,7 +1489,7 @@ md_assemble (str)
op_end ++; op_end ++;
/* Skip whitespace. */ /* Skip whitespace. */
while (isspace (* op_end)) while (ISSPACE (* op_end))
++ op_end; ++ op_end;
if (* op_end == '(') if (* op_end == '(')
@ -1502,7 +1502,7 @@ md_assemble (str)
inst |= reg; inst |= reg;
/* Skip whitespace. */ /* Skip whitespace. */
while (isspace (* op_end)) while (ISSPACE (* op_end))
++ op_end; ++ op_end;
if (* op_end == ')') if (* op_end == ')')
@ -1535,7 +1535,7 @@ md_assemble (str)
inst |= reg << 4; inst |= reg << 4;
/* Skip whitespace. */ /* Skip whitespace. */
while (isspace (* op_end)) while (ISSPACE (* op_end))
++ op_end; ++ op_end;
if (* op_end == ',') if (* op_end == ',')
@ -1595,7 +1595,7 @@ md_assemble (str)
inst |= reg; inst |= reg;
/* Skip whitespace. */ /* Skip whitespace. */
while (isspace (* op_end)) while (ISSPACE (* op_end))
++ op_end; ++ op_end;
if (* op_end == ',') if (* op_end == ',')
@ -1617,7 +1617,7 @@ md_assemble (str)
inst |= reg << 4; inst |= reg << 4;
/* Skip whitespace. */ /* Skip whitespace. */
while (isspace (* op_end)) while (ISSPACE (* op_end))
++ op_end; ++ op_end;
if (* op_end == ',') if (* op_end == ',')
@ -1638,7 +1638,7 @@ md_assemble (str)
inst |= reg; inst |= reg;
/* Skip whitespace. */ /* Skip whitespace. */
while (isspace (* op_end)) while (ISSPACE (* op_end))
++ op_end; ++ op_end;
if (* op_end == ',') if (* op_end == ',')
@ -1690,7 +1690,7 @@ md_assemble (str)
} }
/* Drop whitespace after all the operands have been parsed. */ /* Drop whitespace after all the operands have been parsed. */
while (isspace (* op_end)) while (ISSPACE (* op_end))
op_end ++; op_end ++;
/* Give warning message if the insn has more operands than required. */ /* Give warning message if the insn has more operands than required. */

View file

@ -26,8 +26,7 @@
#include "as.h" #include "as.h"
#include "config.h" #include "config.h"
#include "subsegs.h" #include "subsegs.h"
#include "safe-ctype.h"
#include <ctype.h>
#ifdef USE_STDARG #ifdef USE_STDARG
#include <stdarg.h> #include <stdarg.h>
@ -6946,13 +6945,13 @@ mips_ip (str, ip)
/* If the instruction contains a '.', we first try to match an instruction /* If the instruction contains a '.', we first try to match an instruction
including the '.'. Then we try again without the '.'. */ including the '.'. Then we try again without the '.'. */
insn = NULL; insn = NULL;
for (s = str; *s != '\0' && !isspace ((unsigned char) *s); ++s) for (s = str; *s != '\0' && !ISSPACE (*s); ++s)
continue; continue;
/* If we stopped on whitespace, then replace the whitespace with null for /* 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 the call to hash_find. Save the character we replaced just in case we
have to re-parse the instruction. */ have to re-parse the instruction. */
if (isspace ((unsigned char) *s)) if (ISSPACE (*s))
{ {
save_c = *s; save_c = *s;
*s++ = '\0'; *s++ = '\0';
@ -6970,7 +6969,9 @@ mips_ip (str, ip)
*(--s) = save_c; *(--s) = save_c;
/* Scan up to the first '.' or whitespace. */ /* 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; continue;
/* If we did not find a '.', then we can quit now. */ /* If we did not find a '.', then we can quit now. */
@ -7234,7 +7235,7 @@ mips_ip (str, ip)
if (s[0] == '$') if (s[0] == '$')
{ {
if (isdigit ((unsigned char) s[1])) if (ISDIGIT (s[1]))
{ {
++s; ++s;
regno = 0; regno = 0;
@ -7244,7 +7245,7 @@ mips_ip (str, ip)
regno += *s - '0'; regno += *s - '0';
++s; ++s;
} }
while (isdigit ((unsigned char) *s)); while (ISDIGIT (*s));
if (regno > 31) if (regno > 31)
as_bad (_("Invalid register number (%d)"), regno); as_bad (_("Invalid register number (%d)"), regno);
} }
@ -7397,7 +7398,8 @@ mips_ip (str, ip)
case 'V': case 'V':
case 'W': case 'W':
s_reset = s; 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; s += 2;
regno = 0; regno = 0;
@ -7407,7 +7409,7 @@ mips_ip (str, ip)
regno += *s - '0'; regno += *s - '0';
++s; ++s;
} }
while (isdigit ((unsigned char) *s)); while (ISDIGIT (*s));
if (regno > 31) if (regno > 31)
as_bad (_("Invalid float register number (%d)"), regno); as_bad (_("Invalid float register number (%d)"), regno);
@ -7860,7 +7862,7 @@ mips_ip (str, ip)
regno += *s - '0'; regno += *s - '0';
++s; ++s;
} }
while (isdigit ((unsigned char) *s)); while (ISDIGIT (*s));
if (regno > 7) if (regno > 7)
as_bad (_("invalid condition code register $fcc%d"), regno); as_bad (_("invalid condition code register $fcc%d"), regno);
if (*args == 'N') if (*args == 'N')
@ -7872,7 +7874,7 @@ mips_ip (str, ip)
case 'H': case 'H':
if (s[0] == '0' && (s[1] == 'x' || s[1] == 'X')) if (s[0] == '0' && (s[1] == 'x' || s[1] == 'X'))
s += 2; s += 2;
if (isdigit ((unsigned char) *s)) if (ISDIGIT (*s))
{ {
c = 0; c = 0;
do do
@ -7881,7 +7883,7 @@ mips_ip (str, ip)
c += *s - '0'; c += *s - '0';
++s; ++s;
} }
while (isdigit ((unsigned char) *s)); while (ISDIGIT (*s));
} }
else else
c = 8; /* Invalid sel value. */ c = 8; /* Invalid sel value. */
@ -7938,7 +7940,7 @@ mips16_ip (str, ip)
mips16_small = false; mips16_small = false;
mips16_ext = false; mips16_ext = false;
for (s = str; islower ((unsigned char) *s); ++s) for (s = str; ISLOWER (*s); ++s)
; ;
switch (*s) switch (*s)
{ {
@ -8071,7 +8073,7 @@ mips16_ip (str, ip)
if (s[0] != '$') if (s[0] != '$')
break; break;
s_reset = s; s_reset = s;
if (isdigit ((unsigned char) s[1])) if (ISDIGIT (s[1]))
{ {
++s; ++s;
regno = 0; regno = 0;
@ -8081,7 +8083,7 @@ mips16_ip (str, ip)
regno += *s - '0'; regno += *s - '0';
++s; ++s;
} }
while (isdigit ((unsigned char) *s)); while (ISDIGIT (*s));
if (regno > 31) if (regno > 31)
{ {
as_bad (_("invalid register number (%d)"), regno); as_bad (_("invalid register number (%d)"), regno);
@ -8352,7 +8354,7 @@ mips16_ip (str, ip)
++s; ++s;
} }
reg1 = 0; reg1 = 0;
while (isdigit ((unsigned char) *s)) while (ISDIGIT (*s))
{ {
reg1 *= 10; reg1 *= 10;
reg1 += *s - '0'; reg1 += *s - '0';
@ -8379,7 +8381,7 @@ mips16_ip (str, ip)
} }
} }
reg2 = 0; reg2 = 0;
while (isdigit ((unsigned char) *s)) while (ISDIGIT (*s))
{ {
reg2 *= 10; reg2 *= 10;
reg2 += *s - '0'; reg2 += *s - '0';
@ -8641,41 +8643,41 @@ my_getSmallExpression (ep, str)
if (*str == '(') if (*str == '(')
c = S_EX_NONE; c = S_EX_NONE;
else if (str[0] == '%' else if (str[0] == '%'
&& tolower(str[1]) == 'l' && TOLOWER (str[1]) == 'l'
&& tolower(str[2]) == 'o' && TOLOWER (str[2]) == 'o'
&& str[3] == '(') && str[3] == '(')
{ {
c = S_EX_LO; c = S_EX_LO;
str += sizeof ("%lo(") - 2; str += sizeof ("%lo(") - 2;
} }
else if (str[0] == '%' else if (str[0] == '%'
&& tolower(str[1]) == 'h' && TOLOWER (str[1]) == 'h'
&& tolower(str[2]) == 'i' && TOLOWER (str[2]) == 'i'
&& str[3] == '(') && str[3] == '(')
{ {
c = S_EX_HI; c = S_EX_HI;
str += sizeof ("%hi(") - 2; str += sizeof ("%hi(") - 2;
} }
else if (str[0] == '%' else if (str[0] == '%'
&& tolower(str[1]) == 'h' && TOLOWER (str[1]) == 'h'
&& tolower(str[2]) == 'i' && TOLOWER (str[2]) == 'i'
&& tolower(str[3]) == 'g' && TOLOWER (str[3]) == 'g'
&& tolower(str[4]) == 'h' && TOLOWER (str[4]) == 'h'
&& tolower(str[5]) == 'e' && TOLOWER (str[5]) == 'e'
&& tolower(str[6]) == 'r' && TOLOWER (str[6]) == 'r'
&& str[7] == '(') && str[7] == '(')
{ {
c = S_EX_HIGHER; c = S_EX_HIGHER;
str += sizeof ("%higher(") - 2; str += sizeof ("%higher(") - 2;
} }
else if (str[0] == '%' else if (str[0] == '%'
&& tolower(str[1]) == 'h' && TOLOWER (str[1]) == 'h'
&& tolower(str[2]) == 'i' && TOLOWER (str[2]) == 'i'
&& tolower(str[3]) == 'g' && TOLOWER (str[3]) == 'g'
&& tolower(str[4]) == 'h' && TOLOWER (str[4]) == 'h'
&& tolower(str[5]) == 'e' && TOLOWER (str[5]) == 'e'
&& tolower(str[6]) == 's' && TOLOWER (str[6]) == 's'
&& tolower(str[7]) == 't' && TOLOWER (str[7]) == 't'
&& str[8] == '(') && str[8] == '(')
{ {
c = S_EX_HIGHEST; c = S_EX_HIGHEST;
@ -8684,21 +8686,21 @@ my_getSmallExpression (ep, str)
/* currently unsupported */ /* currently unsupported */
#if 0 #if 0
else if (str[0] == '%' else if (str[0] == '%'
&& tolower(str[1]) == 'g' && TOLOWER (str[1]) == 'g'
&& tolower(str[2]) == 'p' && TOLOWER (str[2]) == 'p'
&& tolower(str[3]) == '_' && TOLOWER (str[3]) == '_'
&& tolower(str[4]) == 'r' && TOLOWER (str[4]) == 'r'
&& tolower(str[5]) == 'e' && TOLOWER (str[5]) == 'e'
&& tolower(str[6]) == 'l' && TOLOWER (str[6]) == 'l'
&& str[7] == '(') && str[7] == '(')
{ {
c = S_EX_GPREL; c = S_EX_GPREL;
str += sizeof ("%gp_rel(") - 2; str += sizeof ("%gp_rel(") - 2;
} }
else if (str[0] == '%' else if (str[0] == '%'
&& tolower(str[1]) == 'n' && TOLOWER (str[1]) == 'n'
&& tolower(str[2]) == 'e' && TOLOWER (str[2]) == 'e'
&& tolower(str[3]) == 'g' && TOLOWER (str[3]) == 'g'
&& str[4] == '(') && str[4] == '(')
{ {
c = S_EX_NEG; c = S_EX_NEG;
@ -8721,9 +8723,9 @@ my_getSmallExpression (ep, str)
; ;
if (sp - 4 >= str && sp[-1] == ')') 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] == '(') if (*sp == '$' && sp > str && sp[-1] == '(')
{ {
@ -10777,7 +10779,7 @@ tc_get_register (frame)
as_warn (_("expected `$'")); as_warn (_("expected `$'"));
reg = 0; reg = 0;
} }
else if (isdigit ((unsigned char) *input_line_pointer)) else if (ISDIGIT (*input_line_pointer))
{ {
reg = get_absolute_expression (); reg = get_absolute_expression ();
if (reg < 0 || reg >= 32) if (reg < 0 || reg >= 32)
@ -11796,14 +11798,14 @@ get_number ()
++input_line_pointer; ++input_line_pointer;
negative = 1; negative = 1;
} }
if (!isdigit ((unsigned char) *input_line_pointer)) if (!ISDIGIT (*input_line_pointer))
as_bad (_("Expected simple number.")); as_bad (_("Expected simple number."));
if (input_line_pointer[0] == '0') if (input_line_pointer[0] == '0')
{ {
if (input_line_pointer[1] == 'x') if (input_line_pointer[1] == 'x')
{ {
input_line_pointer += 2; input_line_pointer += 2;
while (isxdigit ((unsigned char) *input_line_pointer)) while (ISXDIGIT (*input_line_pointer))
{ {
val <<= 4; val <<= 4;
val |= hex_value (*input_line_pointer++); val |= hex_value (*input_line_pointer++);
@ -11813,7 +11815,7 @@ get_number ()
else else
{ {
++input_line_pointer; ++input_line_pointer;
while (isdigit ((unsigned char) *input_line_pointer)) while (ISDIGIT (*input_line_pointer))
{ {
val <<= 3; val <<= 3;
val |= *input_line_pointer++ - '0'; val |= *input_line_pointer++ - '0';
@ -11821,14 +11823,14 @@ get_number ()
return negative ? -val : val; return negative ? -val : val;
} }
} }
if (!isdigit ((unsigned char) *input_line_pointer)) if (!ISDIGIT (*input_line_pointer))
{ {
printf (_(" *input_line_pointer == '%c' 0x%02x\n"), printf (_(" *input_line_pointer == '%c' 0x%02x\n"),
*input_line_pointer, *input_line_pointer); *input_line_pointer, *input_line_pointer);
as_warn (_("Invalid number")); as_warn (_("Invalid number"));
return -1; return -1;
} }
while (isdigit ((unsigned char) *input_line_pointer)) while (ISDIGIT (*input_line_pointer))
{ {
val *= 10; val *= 10;
val += *input_line_pointer++ - '0'; val += *input_line_pointer++ - '0';
@ -11951,7 +11953,7 @@ s_mips_ent (aent)
if (*input_line_pointer == ',') if (*input_line_pointer == ',')
input_line_pointer++; input_line_pointer++;
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
if (isdigit ((unsigned char) *input_line_pointer) if (ISDIGIT (*input_line_pointer)
|| *input_line_pointer == '-') || *input_line_pointer == '-')
number = get_number (); number = get_number ();

View file

@ -20,8 +20,8 @@
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#include <stdio.h> #include <stdio.h>
#include <ctype.h>
#include "as.h" #include "as.h"
#include "safe-ctype.h"
#include "subsegs.h" #include "subsegs.h"
#include "opcode/mn10200.h" #include "opcode/mn10200.h"
@ -781,7 +781,7 @@ md_assemble (str)
int match; int match;
/* Get the opcode. */ /* Get the opcode. */
for (s = str; *s != '\0' && !isspace (*s); s++) for (s = str; *s != '\0' && !ISSPACE (*s); s++)
; ;
if (*s != '\0') if (*s != '\0')
*s++ = '\0'; *s++ = '\0';
@ -795,7 +795,7 @@ md_assemble (str)
} }
str = s; str = s;
while (isspace (*str)) while (ISSPACE (*str))
++str; ++str;
input_line_pointer = str; input_line_pointer = str;
@ -1029,7 +1029,7 @@ keep_going:
break; break;
} }
while (isspace (*str)) while (ISSPACE (*str))
++str; ++str;
if (*str != '\0') if (*str != '\0')

View file

@ -20,8 +20,8 @@
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#include <stdio.h> #include <stdio.h>
#include <ctype.h>
#include "as.h" #include "as.h"
#include "safe-ctype.h"
#include "subsegs.h" #include "subsegs.h"
#include "opcode/mn10300.h" #include "opcode/mn10300.h"
#include "dwarf2dbg.h" #include "dwarf2dbg.h"
@ -917,7 +917,7 @@ md_assemble (str)
int match; int match;
/* Get the opcode. */ /* Get the opcode. */
for (s = str; *s != '\0' && !isspace (*s); s++) for (s = str; *s != '\0' && !ISSPACE (*s); s++)
; ;
if (*s != '\0') if (*s != '\0')
*s++ = '\0'; *s++ = '\0';
@ -931,7 +931,7 @@ md_assemble (str)
} }
str = s; str = s;
while (isspace (*str)) while (ISSPACE (*str))
++str; ++str;
input_line_pointer = str; input_line_pointer = str;
@ -1445,7 +1445,7 @@ keep_going:
break; break;
} }
while (isspace (*str)) while (ISSPACE (*str))
++str; ++str;
if (*str != '\0') if (*str != '\0')

View file

@ -23,7 +23,6 @@
/*#define SHOW_NUM 1*//* Uncomment for debugging. */ /*#define SHOW_NUM 1*//* Uncomment for debugging. */
#include <stdio.h> #include <stdio.h>
#include <ctype.h>
#include "as.h" #include "as.h"
#include "opcode/ns32k.h" #include "opcode/ns32k.h"

View file

@ -26,6 +26,7 @@
*/ */
#include "as.h" #include "as.h"
#include "safe-ctype.h"
#include "opcode/pdp11.h" #include "opcode/pdp11.h"
static int set_option PARAMS ((char *arg)); static int set_option PARAMS ((char *arg));
@ -252,19 +253,11 @@ find_whitespace (char *str)
return str; return str;
} }
static char
mklower (char c)
{
if (isupper (c))
return tolower (c);
return c;
}
static char * static char *
parse_reg (char *str, struct pdp11_code *operand) parse_reg (char *str, struct pdp11_code *operand)
{ {
str = skip_whitespace (str); str = skip_whitespace (str);
if (mklower (*str) == 'r') if (TOLOWER (*str) == 'r')
{ {
str++; str++;
switch (*str) switch (*str)

View file

@ -1,6 +1,6 @@
/*- /*-
tc-pj.c -- Assemble code for Pico Java 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. This file is part of GAS, the GNU Assembler.
@ -22,6 +22,7 @@
/* Contributed by Steve Chamberlain of Transmeta <sac@pobox.com>. */ /* Contributed by Steve Chamberlain of Transmeta <sac@pobox.com>. */
#include "as.h" #include "as.h"
#include "safe-ctype.h"
#include "opcode/pj.h" #include "opcode/pj.h"
extern const pj_opc_info_t pj_opc_info[512]; extern const pj_opc_info_t pj_opc_info[512];
@ -312,7 +313,7 @@ md_assemble (str)
pending_reloc = 0; pending_reloc = 0;
} }
while (isspace (*op_end)) while (ISSPACE (*op_end))
op_end++; op_end++;
if (*op_end != 0) if (*op_end != 0)

View file

@ -21,8 +21,8 @@
02111-1307, USA. */ 02111-1307, USA. */
#include <stdio.h> #include <stdio.h>
#include <ctype.h>
#include "as.h" #include "as.h"
#include "safe-ctype.h"
#include "subsegs.h" #include "subsegs.h"
#include "opcode/ppc.h" #include "opcode/ppc.h"
@ -618,10 +618,10 @@ register_name (expressionP)
/* Find the spelling of the operand. */ /* Find the spelling of the operand. */
start = name = input_line_pointer; start = name = input_line_pointer;
if (name[0] == '%' && isalpha (name[1])) if (name[0] == '%' && ISALPHA (name[1]))
name = ++input_line_pointer; name = ++input_line_pointer;
else if (!reg_names_p || !isalpha (name[0])) else if (!reg_names_p || !ISALPHA (name[0]))
return false; return false;
c = get_symbol_end (); c = get_symbol_end ();
@ -1383,10 +1383,10 @@ ppc_elf_suffix (str_p, exp_p)
for (ch = *str, str2 = ident; for (ch = *str, str2 = ident;
(str2 < ident + sizeof (ident) - 1 (str2 < ident + sizeof (ident) - 1
&& (isalnum (ch) || ch == '@')); && (ISALNUM (ch) || ch == '@'));
ch = *++str) ch = *++str)
{ {
*str2++ = (islower (ch)) ? ch : tolower (ch); *str2++ = TOLOWER (ch);
} }
*str2 = '\0'; *str2 = '\0';
@ -1820,7 +1820,7 @@ md_assemble (str)
#endif #endif
/* Get the opcode. */ /* Get the opcode. */
for (s = str; *s != '\0' && ! isspace (*s); s++) for (s = str; *s != '\0' && ! ISSPACE (*s); s++)
; ;
if (*s != '\0') if (*s != '\0')
*s++ = '\0'; *s++ = '\0';
@ -1843,7 +1843,7 @@ md_assemble (str)
insn = opcode->opcode; insn = opcode->opcode;
str = s; str = s;
while (isspace (*str)) while (ISSPACE (*str))
++str; ++str;
/* PowerPC operands are just expressions. The only real issue is /* PowerPC operands are just expressions. The only real issue is
@ -2266,7 +2266,7 @@ md_assemble (str)
++str; ++str;
} }
while (isspace (*str)) while (ISSPACE (*str))
++str; ++str;
if (*str != '\0') if (*str != '\0')
@ -4267,8 +4267,7 @@ ppc_canonicalize_symbol_name (name)
} }
for (s++; *s != '\0' && *s != brac; s++) for (s++; *s != '\0' && *s != brac; s++)
if (islower (*s)) *s = TOUPPER (*s);
*s = toupper (*s);
if (*s == '\0' || s[1] != '\0') if (*s == '\0' || s[1] != '\0')
as_bad (_("bad symbol suffix")); as_bad (_("bad symbol suffix"));

View file

@ -20,8 +20,8 @@
02111-1307, USA. */ 02111-1307, USA. */
#include <stdio.h> #include <stdio.h>
#include <ctype.h>
#include "as.h" #include "as.h"
#include "safe-ctype.h"
#include "subsegs.h" #include "subsegs.h"
#include "struc-symbol.h" #include "struc-symbol.h"
@ -263,7 +263,7 @@ register_name (expressionP)
/* Find the spelling of the operand. */ /* Find the spelling of the operand. */
start = name = input_line_pointer; start = name = input_line_pointer;
if (name[0] == '%' && isalpha (name[1])) if (name[0] == '%' && ISALPHA (name[1]))
name = ++input_line_pointer; name = ++input_line_pointer;
else else
return false; return false;
@ -633,7 +633,7 @@ s390_elf_suffix (str_p, exp_p)
return ELF_SUFFIX_NONE; return ELF_SUFFIX_NONE;
ident = str; ident = str;
while (isalnum (*str)) while (ISALNUM (*str))
str++; str++;
len = str - ident; len = str - ident;
@ -782,7 +782,7 @@ s390_lit_suffix (str_p, exp_p, suffix)
/* We look for a suffix of the form "@lit1", "@lit2", "@lit4" or "@lit8". */ /* We look for a suffix of the form "@lit1", "@lit2", "@lit4" or "@lit8". */
ident = str; ident = str;
while (isalnum (*str)) while (ISALNUM (*str))
str++; str++;
len = str - ident; len = str - ident;
if (len != 4 || strncasecmp (ident, "lit", 3) != 0 || if (len != 4 || strncasecmp (ident, "lit", 3) != 0 ||
@ -1006,7 +1006,7 @@ md_gather_operands (str, insn, opcode)
char *f; char *f;
int fc, i; int fc, i;
while (isspace(*str)) str++; while (ISSPACE (*str)) str++;
parentheses = 0; parentheses = 0;
skip_optional = 0; skip_optional = 0;
@ -1193,7 +1193,7 @@ md_gather_operands (str, insn, opcode)
} }
} }
while (isspace (*str)) while (ISSPACE (*str))
++str; ++str;
if (*str != '\0') if (*str != '\0')
@ -1267,7 +1267,7 @@ md_assemble (str)
char *s; char *s;
/* Get the opcode. */ /* Get the opcode. */
for (s = str; *s != '\0' && ! isspace (*s); s++) for (s = str; *s != '\0' && ! ISSPACE (*s); s++)
; ;
if (*s != '\0') if (*s != '\0')
*s++ = '\0'; *s++ = '\0';
@ -1336,7 +1336,7 @@ s390_insn (ignore)
/* Get the opcode format. */ /* Get the opcode format. */
s = input_line_pointer; s = input_line_pointer;
while (*s != '\0' && *s != ',' && ! isspace (*s)) while (*s != '\0' && *s != ',' && ! ISSPACE (*s))
s++; s++;
if (*s != ',') if (*s != ',')
as_bad (_("Invalid .insn format\n")); as_bad (_("Invalid .insn format\n"));

View file

@ -27,7 +27,7 @@
#include "subsegs.h" #include "subsegs.h"
#define DEFINE_TABLE #define DEFINE_TABLE
#include "opcodes/sh-opc.h" #include "opcodes/sh-opc.h"
#include <ctype.h> #include "safe-ctype.h"
#include "struc-symbol.h" #include "struc-symbol.h"
#ifdef OBJ_ELF #ifdef OBJ_ELF
@ -282,11 +282,9 @@ sh_elf_suffix (str_p, exp_p, new_exp_p)
for (ch = *str, str2 = ident; for (ch = *str, str2 = ident;
(str2 < ident + sizeof (ident) - 1 (str2 < ident + sizeof (ident) - 1
&& (isalnum (ch) || ch == '@')); && (ISALNUM (ch) || ch == '@'));
ch = *++str) ch = *++str)
{ *str2++ = TOLOWER (ch);
*str2++ = (islower (ch)) ? ch : tolower (ch);
}
*str2 = '\0'; *str2 = '\0';
len = str2 - ident; len = str2 - ident;
@ -479,7 +477,7 @@ static int reg_x, reg_y;
static int reg_efg; static int reg_efg;
static int reg_b; 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. */ /* Try to parse a reg name. Return the number of chars consumed. */
@ -489,8 +487,8 @@ parse_reg (src, mode, reg)
int *mode; int *mode;
int *reg; int *reg;
{ {
char l0 = tolower (src[0]); char l0 = TOLOWER (src[0]);
char l1 = l0 ? tolower (src[1]) : 0; char l1 = l0 ? TOLOWER (src[1]) : 0;
/* We use ! IDENT_CHAR for the next character after the register name, to /* 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 make sure that we won't accidentally recognize a symbol name such as
@ -545,7 +543,7 @@ parse_reg (src, mode, reg)
*reg = A_A0_NUM; *reg = A_A0_NUM;
return 2; 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; *mode = DSP_REG_N;
*reg = A_A0G_NUM; *reg = A_A0G_NUM;
@ -560,7 +558,7 @@ parse_reg (src, mode, reg)
*reg = A_A1_NUM; *reg = A_A1_NUM;
return 2; 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; *mode = DSP_REG_N;
*reg = A_A1G_NUM; *reg = A_A1G_NUM;
@ -641,34 +639,34 @@ parse_reg (src, mode, reg)
if (l0 == 's' if (l0 == 's'
&& l1 == '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; *mode = A_SSR;
return 3; 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])) && ! IDENT_CHAR ((unsigned char) src[3]))
{ {
*mode = A_SPC; *mode = A_SPC;
return 3; 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])) && ! IDENT_CHAR ((unsigned char) src[3]))
{ {
*mode = A_SGR; *mode = A_SGR;
return 3; 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])) && ! IDENT_CHAR ((unsigned char) src[3]))
{ {
*mode = A_DSR; *mode = A_DSR;
return 3; 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])) && ! IDENT_CHAR ((unsigned char) src[3]))
{ {
*mode = A_DBR; *mode = A_DBR;
@ -700,34 +698,34 @@ parse_reg (src, mode, reg)
*mode = A_PC; *mode = A_PC;
return 2; 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])) && ! IDENT_CHAR ((unsigned char) src[3]))
{ {
*mode = A_GBR; *mode = A_GBR;
return 3; 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])) && ! IDENT_CHAR ((unsigned char) src[3]))
{ {
*mode = A_VBR; *mode = A_VBR;
return 3; 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])) && ! IDENT_CHAR ((unsigned char) src[4]))
{ {
if (tolower (src[3]) == 'l') if (TOLOWER (src[3]) == 'l')
{ {
*mode = A_MACL; *mode = A_MACL;
return 4; return 4;
} }
if (tolower (src[3]) == 'h') if (TOLOWER (src[3]) == 'h')
{ {
*mode = A_MACH; *mode = A_MACH;
return 4; 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])) && ! IDENT_CHAR ((unsigned char) src[4]))
{ {
*mode = A_MOD; *mode = A_MOD;
@ -809,25 +807,25 @@ parse_reg (src, mode, reg)
return 3; return 3;
} }
} }
if (l0 == 'f' && l1 == 'p' && tolower (src[2]) == 'u' if (l0 == 'f' && l1 == 'p' && TOLOWER (src[2]) == 'u'
&& tolower (src[3]) == 'l' && TOLOWER (src[3]) == 'l'
&& ! IDENT_CHAR ((unsigned char) src[4])) && ! IDENT_CHAR ((unsigned char) src[4]))
{ {
*mode = FPUL_N; *mode = FPUL_N;
return 4; return 4;
} }
if (l0 == 'f' && l1 == 'p' && tolower (src[2]) == 's' if (l0 == 'f' && l1 == 'p' && TOLOWER (src[2]) == 's'
&& tolower (src[3]) == 'c' && TOLOWER (src[3]) == 'c'
&& tolower (src[4]) == 'r' && ! IDENT_CHAR ((unsigned char) src[5])) && TOLOWER (src[4]) == 'r' && ! IDENT_CHAR ((unsigned char) src[5]))
{ {
*mode = FPSCR_N; *mode = FPSCR_N;
return 5; return 5;
} }
if (l0 == 'x' && l1 == 'm' && tolower (src[2]) == 't' if (l0 == 'x' && l1 == 'm' && TOLOWER (src[2]) == 't'
&& tolower (src[3]) == 'r' && TOLOWER (src[3]) == 'r'
&& tolower (src[4]) == 'x' && ! IDENT_CHAR ((unsigned char) src[5])) && TOLOWER (src[4]) == 'x' && ! IDENT_CHAR ((unsigned char) src[5]))
{ {
*mode = XMTRX_M4; *mode = XMTRX_M4;
return 5; return 5;
@ -1637,9 +1635,9 @@ find_cooked_opcode (str_p)
/* The machine independent code will convert CMP/EQ into cmp/EQ /* The machine independent code will convert CMP/EQ into cmp/EQ
because it thinks the '/' is the end of the symbol. Moreover, because it thinks the '/' is the end of the symbol. Moreover,
all but the first sub-insn is a parallel processing insn won't 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. */ code, we just deal with it here. */
c = isupper (c) ? tolower (c) : c; c = TOLOWER (c);
name[nlen] = c; name[nlen] = c;
nlen++; nlen++;
} }

View file

@ -20,9 +20,9 @@
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#include <stdio.h> #include <stdio.h>
#include <ctype.h>
#include "as.h" #include "as.h"
#include "safe-ctype.h"
#include "subsegs.h" #include "subsegs.h"
#include "opcode/sparc.h" #include "opcode/sparc.h"
@ -1385,11 +1385,11 @@ sparc_ip (str, pinsn)
int special_case = SPECIAL_CASE_NONE; int special_case = SPECIAL_CASE_NONE;
s = str; s = str;
if (islower ((unsigned char) *s)) if (ISLOWER (*s))
{ {
do do
++s; ++s;
while (islower ((unsigned char) *s) || isdigit ((unsigned char) *s)); while (ISLOWER (*s) || ISDIGIT (*s));
} }
switch (*s) switch (*s)
@ -1617,11 +1617,11 @@ sparc_ip (str, pinsn)
{ {
s += 4; s += 4;
if (isdigit ((unsigned char) *s)) if (ISDIGIT (*s))
{ {
long num = 0; long num = 0;
while (isdigit ((unsigned char) *s)) while (ISDIGIT (*s))
{ {
num = num * 10 + *s - '0'; num = num * 10 + *s - '0';
++s; ++s;
@ -1825,9 +1825,9 @@ sparc_ip (str, pinsn)
break; break;
case '#': /* Must be at least one digit. */ case '#': /* Must be at least one digit. */
if (isdigit ((unsigned char) *s++)) if (ISDIGIT (*s++))
{ {
while (isdigit ((unsigned char) *s)) while (ISDIGIT (*s))
{ {
++s; ++s;
} }
@ -1846,10 +1846,10 @@ sparc_ip (str, pinsn)
case 'b': /* Next operand is a coprocessor register. */ case 'b': /* Next operand is a coprocessor register. */
case 'c': case 'c':
case 'D': case 'D':
if (*s++ == '%' && *s++ == 'c' && isdigit ((unsigned char) *s)) if (*s++ == '%' && *s++ == 'c' && ISDIGIT (*s))
{ {
mask = *s++; mask = *s++;
if (isdigit ((unsigned char) *s)) if (ISDIGIT (*s))
{ {
mask = 10 * (mask - '0') + (*s++ - '0'); mask = 10 * (mask - '0') + (*s++ - '0');
if (mask >= 32) if (mask >= 32)
@ -1942,7 +1942,7 @@ sparc_ip (str, pinsn)
goto error; goto error;
case 'r': /* any register */ case 'r': /* any register */
if (!isdigit ((unsigned char) (c = *s++))) if (!ISDIGIT ((c = *s++)))
{ {
goto error; goto error;
} }
@ -1957,7 +1957,7 @@ sparc_ip (str, pinsn)
case '7': case '7':
case '8': case '8':
case '9': case '9':
if (isdigit ((unsigned char) *s)) if (ISDIGIT (*s))
{ {
if ((c = 10 * (c - '0') + (*s++ - '0')) >= 32) if ((c = 10 * (c - '0') + (*s++ - '0')) >= 32)
{ {
@ -2022,9 +2022,9 @@ sparc_ip (str, pinsn)
if (*s++ == '%' if (*s++ == '%'
&& ((format = *s) == 'f') && ((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'); mask = 10 * mask + (*s - '0');
} /* read the number */ } /* read the number */
@ -2240,7 +2240,7 @@ sparc_ip (str, pinsn)
for (s1 = s; *s1 && *s1 != ',' && *s1 != ']'; s1++) 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] == '+') if (s1[-2] == '%' && s1[-3] == '+')
s1 -= 3; s1 -= 3;
@ -2663,7 +2663,7 @@ parse_keyword_arg (lookup_fn, input_pointerP, valueP)
p = *input_pointerP; p = *input_pointerP;
for (q = p + (*p == '#' || *p == '%'); for (q = p + (*p == '#' || *p == '%');
isalnum ((unsigned char) *q) || *q == '_'; ISALNUM (*q) || *q == '_';
++q) ++q)
continue; continue;
c = *q; c = *q;

View file

@ -1,6 +1,6 @@
/* This file is tc-tahoe.c /* 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. Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler. This file is part of GAS, the GNU Assembler.
@ -20,6 +20,7 @@
Software Foundation, 59 Temple Place - Suite 330, Boston, MA Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */ 02111-1307, USA. */
#include "as.h" #include "as.h"
#include "safe-ctype.h"
#include "obstack.h" #include "obstack.h"
/* This bit glommed from tahoe-inst.h. */ /* This bit glommed from tahoe-inst.h. */
@ -885,11 +886,11 @@ tahoe_reg_parse (start)
R or r, and then a number. */ R or r, and then a number. */
case 'R': case 'R':
case 'r': case 'r':
if (isdigit (*regpoint)) if (ISDIGIT (*regpoint))
{ {
/* Got the first digit. */ /* Got the first digit. */
regnum = *regpoint++ - '0'; regnum = *regpoint++ - '0';
if ((regnum == 1) && isdigit (*regpoint)) if ((regnum == 1) && ISDIGIT (*regpoint))
{ {
/* Its a two digit number. */ /* Its a two digit number. */
regnum = 10 + (*regpoint++ - '0'); regnum = 10 + (*regpoint++ - '0');
@ -1064,7 +1065,7 @@ tip_op (optex, topP)
as_warn (_("Casting a branch displacement is bad form, and is ignored.")); as_warn (_("Casting a branch displacement is bad form, and is ignored."));
else else
{ {
c = (isupper (*point) ? tolower (*point) : *point); c = TOLOWER (*point);
call_width = ((c == 'b') ? 1 : call_width = ((c == 'b') ? 1 :
((c == 'w') ? 2 : 4)); ((c == 'w') ? 2 : 4));
} }

View file

@ -1,5 +1,5 @@
/* tc-c30.c -- Assembly code for the Texas Instruments TMS320C30 /* 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) Contributed by Steven Haworth (steve@pm.cse.rmit.edu.au)
This file is part of GAS, the GNU Assembler. This file is part of GAS, the GNU Assembler.
@ -25,6 +25,7 @@
Please help us make it better. */ Please help us make it better. */
#include "as.h" #include "as.h"
#include "safe-ctype.h"
#include "opcode/tic30.h" #include "opcode/tic30.h"
/* Put here all non-digit non-letter charcters that may occur in an /* Put here all non-digit non-letter charcters that may occur in an
@ -188,25 +189,25 @@ md_begin ()
for (c = 0; c < 256; c++) for (c = 0; c < 256; c++)
{ {
if (islower (c) || isdigit (c)) if (ISLOWER (c) || ISDIGIT (c))
{ {
opcode_chars[c] = c; opcode_chars[c] = c;
register_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]; register_chars[c] = opcode_chars[c];
} }
else if (c == ')' || c == '(') else if (c == ')' || c == '(')
{ {
register_chars[c] = c; register_chars[c] = c;
} }
if (isupper (c) || islower (c) || isdigit (c)) if (ISUPPER (c) || ISLOWER (c) || ISDIGIT (c))
operand_chars[c] = c; operand_chars[c] = c;
if (isdigit (c) || c == '-') if (ISDIGIT (c) || c == '-')
digit_chars[c] = c; digit_chars[c] = c;
if (isalpha (c) || c == '_' || c == '.' || isdigit (c)) if (ISALPHA (c) || c == '_' || c == '.' || ISDIGIT (c))
identifier_chars[c] = c; identifier_chars[c] = c;
if (c == ' ' || c == '\t') if (c == ' ' || c == '\t')
space_chars[c] = c; space_chars[c] = c;
@ -1267,7 +1268,7 @@ tic30_operand (token)
ind_buffer[0] = *token; ind_buffer[0] = *token;
for (count = 1; count < strlen (token); count++) for (count = 1; count < strlen (token); count++)
{ /* Strip operand */ { /* 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') && if ((*(token + count - 1) == 'a' || *(token + count - 1) == 'A') &&
(*(token + count) == 'r' || *(token + count) == 'R')) (*(token + count) == 'r' || *(token + count) == 'R'))
{ {
@ -1486,12 +1487,12 @@ tic30_find_parallel_insn (current_line, next_line)
{ {
if (is_opcode_char (c) && search_status == NONE) if (is_opcode_char (c) && search_status == NONE)
{ {
opcode[char_ptr++] = tolower (c); opcode[char_ptr++] = TOLOWER (c);
search_status = START_OPCODE; search_status = START_OPCODE;
} }
else if (is_opcode_char (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) else if (!is_opcode_char (c) && search_status == START_OPCODE)
{ {
@ -1868,7 +1869,7 @@ char *
output_invalid (c) output_invalid (c)
char c; char c;
{ {
if (isprint (c)) if (ISPRINT (c))
sprintf (output_invalid_buf, "'%c'", c); sprintf (output_invalid_buf, "'%c'", c);
else else
sprintf (output_invalid_buf, "(0x%x)", (unsigned) c); sprintf (output_invalid_buf, "(0x%x)", (unsigned) c);

View file

@ -45,6 +45,7 @@
#include <limits.h> #include <limits.h>
#include <errno.h> #include <errno.h>
#include "as.h" #include "as.h"
#include "safe-ctype.h"
#include "sb.h" #include "sb.h"
#include "macro.h" #include "macro.h"
#include "subsegs.h" #include "subsegs.h"
@ -355,7 +356,7 @@ tic54x_asg (x)
name = ++input_line_pointer; name = ++input_line_pointer;
c = get_symbol_end (); /* Get terminator. */ c = get_symbol_end (); /* Get terminator. */
if (!isalpha (*name)) if (!ISALPHA (*name))
{ {
as_bad ("symbols assigned with .asg must begin with a letter"); as_bad ("symbols assigned with .asg must begin with a letter");
ignore_rest_of_line (); ignore_rest_of_line ();
@ -420,7 +421,7 @@ tic54x_eval (x)
name = strcpy (tmp, name); name = strcpy (tmp, name);
*input_line_pointer = c; *input_line_pointer = c;
if (!isalpha (*name)) if (!ISALPHA (*name))
{ {
as_bad (_("symbols assigned with .eval must begin with a letter")); as_bad (_("symbols assigned with .eval must begin with a letter"));
ignore_rest_of_line (); ignore_rest_of_line ();
@ -1464,8 +1465,8 @@ lookup_version (ver)
|| ver[2] == '5' || ver[2] == '8' || ver[2] == '9')) || ver[2] == '5' || ver[2] == '8' || ver[2] == '9'))
version = ver[2] - '0'; version = ver[2] - '0';
else if (strlen (ver) == 5 else if (strlen (ver) == 5
&& toupper (ver[3]) == 'L' && TOUPPER (ver[3]) == 'L'
&& toupper (ver[4]) == 'P' && TOUPPER (ver[4]) == 'P'
&& (ver[2] == '5' || ver[2] == '6')) && (ver[2] == '5' || ver[2] == '6'))
version = ver[2] - '0' + 10; version = ver[2] - '0' + 10;
} }
@ -2272,7 +2273,7 @@ tic54x_var (ignore)
} }
do do
{ {
if (!isalpha (*input_line_pointer)) if (!ISALPHA (*input_line_pointer))
{ {
as_bad (_("Substitution symbols must begin with a letter")); as_bad (_("Substitution symbols must begin with a letter"));
ignore_rest_of_line (); ignore_rest_of_line ();
@ -2325,7 +2326,7 @@ tic54x_mlib (ignore)
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
len = 0; len = 0;
while (!is_end_of_line[(int) *input_line_pointer] while (!is_end_of_line[(int) *input_line_pointer]
&& !isspace (*input_line_pointer)) && !ISSPACE (*input_line_pointer))
{ {
obstack_1grow (&notes, *input_line_pointer); obstack_1grow (&notes, *input_line_pointer);
++input_line_pointer; ++input_line_pointer;
@ -2739,7 +2740,7 @@ subsym_iscons (a, ignore)
{ {
int len = strlen (a); int len = strlen (a);
switch (toupper (a[len - 1])) switch (TOUPPER (a[len - 1]))
{ {
case 'B': case 'B':
return 1; return 1;
@ -2755,7 +2756,7 @@ subsym_iscons (a, ignore)
/* No suffix; either octal, hex, or decimal. */ /* No suffix; either octal, hex, or decimal. */
if (*a == '0' && len > 1) if (*a == '0' && len > 1)
{ {
if (toupper (a[1]) == 'X') if (TOUPPER (a[1]) == 'X')
return 3; return 3;
return 2; return 2;
} }
@ -3294,7 +3295,7 @@ get_operands (operands, line)
{ {
int paren_not_balanced = 0; int paren_not_balanced = 0;
char *op_start, *op_end; char *op_start, *op_end;
while (*lptr && isspace (*lptr)) while (*lptr && ISSPACE (*lptr))
++lptr; ++lptr;
op_start = lptr; op_start = lptr;
while (paren_not_balanced || *lptr != ',') while (paren_not_balanced || *lptr != ',')
@ -3324,7 +3325,7 @@ get_operands (operands, line)
/* Trim trailing spaces; while the preprocessor gets rid of most, /* Trim trailing spaces; while the preprocessor gets rid of most,
there are weird usage patterns that can introduce them there are weird usage patterns that can introduce them
(i.e. using strings for macro args). */ (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; operands[numexp].buf[--len] = 0;
lptr = op_end; lptr = op_end;
++numexp; ++numexp;
@ -3348,7 +3349,7 @@ get_operands (operands, line)
} }
} }
while (*lptr && isspace (*lptr++)) while (*lptr && ISSPACE (*lptr++))
; ;
if (!is_end_of_line[(int) *lptr]) if (!is_end_of_line[(int) *lptr])
{ {
@ -3501,12 +3502,12 @@ is_type (operand, type)
case OP_DST: case OP_DST:
return is_accumulator (operand); return is_accumulator (operand);
case OP_B: case OP_B:
return is_accumulator (operand) && toupper (operand->buf[0]) == 'B'; return is_accumulator (operand) && TOUPPER (operand->buf[0]) == 'B';
case OP_A: case OP_A:
return is_accumulator (operand) && toupper (operand->buf[0]) == 'A'; return is_accumulator (operand) && TOUPPER (operand->buf[0]) == 'A';
case OP_ARX: case OP_ARX:
return strncasecmp ("ar", operand->buf, 2) == 0 return strncasecmp ("ar", operand->buf, 2) == 0
&& isdigit (operand->buf[2]); && ISDIGIT (operand->buf[2]);
case OP_SBIT: case OP_SBIT:
return hash_find (sbit_hash, operand->buf) != 0 || is_absolute (operand); return hash_find (sbit_hash, operand->buf) != 0 || is_absolute (operand);
case OP_CC: case OP_CC:
@ -3736,7 +3737,7 @@ encode_indirect (insn, operand)
if (insn->is_lkaddr) if (insn->is_lkaddr)
{ {
/* lk addresses always go in the second insn word. */ /* 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 : (operand->buf[1] == '(') ? 15 :
(strchr (operand->buf, '%') != NULL) ? 14 : 13); (strchr (operand->buf, '%') != NULL) ? 14 : 13);
arf = ((mod == 12) ? operand->buf[3] - '0' : arf = ((mod == 12) ? operand->buf[3] - '0' :
@ -3761,7 +3762,7 @@ encode_indirect (insn, operand)
} }
else else
{ {
arf = (toupper (operand->buf[1]) == 'A' ? arf = (TOUPPER (operand->buf[1]) == 'A' ?
operand->buf[3] : operand->buf[4]) - '0'; operand->buf[3] : operand->buf[4]) - '0';
if (operand->buf[1] == '+') if (operand->buf[1] == '+')
@ -3782,9 +3783,9 @@ encode_indirect (insn, operand)
else else
mod = (operand->buf[4] == '-' ? 8 : 10);/* *ARx+% / *ARx-% */ 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 */ 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% */ mod = (operand->buf[4] == '-' ? 9 : 11); /* ARx+0% / *ARx - 0% */
else else
{ {
@ -4002,7 +4003,7 @@ encode_operand (insn, type, operand)
/* 16-bit immediate value. */ /* 16-bit immediate value. */
return encode_dmad (insn, operand, 0); return encode_dmad (insn, operand, 0);
case OP_SRC: case OP_SRC:
if (toupper (*operand->buf) == 'B') if (TOUPPER (*operand->buf) == 'B')
{ {
insn->opcode[ext ? (1 + insn->is_lkaddr) : 0].word |= (1 << 9); insn->opcode[ext ? (1 + insn->is_lkaddr) : 0].word |= (1 << 9);
if (insn->using_default_dst) if (insn->using_default_dst)
@ -4011,7 +4012,7 @@ encode_operand (insn, type, operand)
return 1; return 1;
case OP_RND: case OP_RND:
/* Make sure this agrees with with the OP_DST operand. */ /* 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))) ((insn->opcode[0].word & (1 << 8)) != 0)))
{ {
as_bad (_("Destination accumulator for each part of this parallel " as_bad (_("Destination accumulator for each part of this parallel "
@ -4021,7 +4022,7 @@ encode_operand (insn, type, operand)
return 1; return 1;
case OP_SRC1: case OP_SRC1:
case OP_DST: 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); insn->opcode[ext ? (1 + insn->is_lkaddr) : 0].word |= (1 << 8);
return 1; return 1;
case OP_Xmem: case OP_Xmem:
@ -4418,7 +4419,7 @@ next_line_shows_parallel (next_line)
char *next_line; char *next_line;
{ {
/* Look for the second half. */ /* Look for the second half. */
while (isspace (*next_line)) while (ISSPACE (*next_line))
++next_line; ++next_line;
return (next_line[0] == PARALLEL_SEPARATOR return (next_line[0] == PARALLEL_SEPARATOR
@ -4505,11 +4506,11 @@ subsym_get_arg (char *line, char *terminators, char **str, int nosub)
char *ptr = line; char *ptr = line;
char *endp; char *endp;
int is_string = *line == '"'; int is_string = *line == '"';
int is_char = isdigit (*line); int is_char = ISDIGIT (*line);
if (is_char) if (is_char)
{ {
while (isdigit (*ptr)) while (ISDIGIT (*ptr))
++ptr; ++ptr;
endp = ptr; endp = ptr;
*str = xmalloc (ptr - line + 1); *str = xmalloc (ptr - line + 1);
@ -4728,7 +4729,7 @@ subsym_substitute (char *line, int forced)
/* Check for local labels; replace them with the appropriate /* Check for local labels; replace them with the appropriate
substitution. */ substitution. */
if ((*name == '$' && isdigit (name[1]) && name[2] == '\0') if ((*name == '$' && ISDIGIT (name[1]) && name[2] == '\0')
|| name[strlen (name) - 1] == '?') || name[strlen (name) - 1] == '?')
{ {
/* Use an existing identifier for that label if, available, or /* Use an existing identifier for that label if, available, or
@ -4821,7 +4822,7 @@ subsym_substitute (char *line, int forced)
} }
/* Character constants are converted to numerics /* Character constants are converted to numerics
by the preprocessor. */ by the preprocessor. */
arg_type[1] = (isdigit (*ptr)) ? 2 : (*ptr == '"'); arg_type[1] = (ISDIGIT (*ptr)) ? 2 : (*ptr == '"');
ptr = subsym_get_arg (ptr, ")", &arg2, ismember); ptr = subsym_get_arg (ptr, ")", &arg2, ismember);
} }
/* Args checking. */ /* Args checking. */
@ -5026,7 +5027,7 @@ tic54x_start_line_hook ()
comment = replacement + strlen (replacement) - 1; comment = replacement + strlen (replacement) - 1;
/* Trim trailing whitespace. */ /* Trim trailing whitespace. */
while (isspace (*comment)) while (ISSPACE (*comment))
{ {
comment[0] = endc; comment[0] = endc;
comment[1] = 0; comment[1] = 0;
@ -5034,7 +5035,7 @@ tic54x_start_line_hook ()
} }
/* Compact leading whitespace. */ /* Compact leading whitespace. */
while (isspace (tmp[0]) && isspace (tmp[1])) while (ISSPACE (tmp[0]) && ISSPACE (tmp[1]))
++tmp; ++tmp;
input_line_pointer = endp; input_line_pointer = endp;
@ -5135,7 +5136,7 @@ md_assemble (line)
otherwise let the assembler pick up the next line for us. */ otherwise let the assembler pick up the next line for us. */
if (tmp != NULL) if (tmp != NULL)
{ {
while (isspace (tmp[2])) while (ISSPACE (tmp[2]))
++tmp; ++tmp;
md_assemble (tmp + 2); md_assemble (tmp + 2);
} }
@ -5673,18 +5674,18 @@ tic54x_start_label (c, rest)
if (is_end_of_line[(int) c]) if (is_end_of_line[(int) c])
return 1; return 1;
if (isspace (c)) if (ISSPACE (c))
while (isspace (c = *++rest)) while (ISSPACE (c = *++rest))
; ;
if (c == '.') if (c == '.')
{ {
/* Don't let colon () define a label for any of these... */ /* Don't let colon () define a label for any of these... */
return (strncasecmp (rest, ".tag", 4) != 0 || !isspace (rest[4])) return (strncasecmp (rest, ".tag", 4) != 0 || !ISSPACE (rest[4]))
&& (strncasecmp (rest, ".struct", 7) != 0 || !isspace (rest[7])) && (strncasecmp (rest, ".struct", 7) != 0 || !ISSPACE (rest[7]))
&& (strncasecmp (rest, ".union", 6) != 0 || !isspace (rest[6])) && (strncasecmp (rest, ".union", 6) != 0 || !ISSPACE (rest[6]))
&& (strncasecmp (rest, ".macro", 6) != 0 || !isspace (rest[6])) && (strncasecmp (rest, ".macro", 6) != 0 || !ISSPACE (rest[6]))
&& (strncasecmp (rest, ".set", 4) != 0 || !isspace (rest[4])) && (strncasecmp (rest, ".set", 4) != 0 || !ISSPACE (rest[4]))
&& (strncasecmp (rest, ".equ", 4) != 0 || !isspace (rest[4])); && (strncasecmp (rest, ".equ", 4) != 0 || !ISSPACE (rest[4]));
} }
return 1; return 1;

View file

@ -1,5 +1,5 @@
/* tc-tic80.c -- Assemble for the TI TMS320C80 (MV) /* 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. This file is part of GAS, the GNU Assembler.
@ -19,6 +19,7 @@
02111-1307, USA. */ 02111-1307, USA. */
#include "as.h" #include "as.h"
#include "safe-ctype.h"
#include "opcode/tic80.h" #include "opcode/tic80.h"
#define internal_error(what) \ #define internal_error(what) \
@ -784,12 +785,12 @@ md_assemble (str)
assert (str); assert (str);
/* Drop any leading whitespace. */ /* Drop any leading whitespace. */
while (isspace (*str)) while (ISSPACE (*str))
str++; str++;
/* Isolate the mnemonic from the rest of the string by finding the first /* Isolate the mnemonic from the rest of the string by finding the first
whitespace character and zapping it to a null byte. */ 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') if (*scan != '\000')
@ -803,7 +804,7 @@ md_assemble (str)
} }
str = scan; str = scan;
while (isspace (*scan)) while (ISSPACE (*scan))
scan++; scan++;
input_line_save = input_line_pointer; input_line_save = input_line_pointer;

View file

@ -20,8 +20,8 @@
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#include <stdio.h> #include <stdio.h>
#include <ctype.h>
#include "as.h" #include "as.h"
#include "safe-ctype.h"
#include "subsegs.h" #include "subsegs.h"
#include "opcode/v850.h" #include "opcode/v850.h"
#include "dwarf2dbg.h" #include "dwarf2dbg.h"
@ -858,7 +858,7 @@ system_register_name (expressionP, accept_numbers, accept_list_names)
/* Reset input_line pointer. */ /* Reset input_line pointer. */
input_line_pointer = start; input_line_pointer = start;
if (isdigit (*input_line_pointer)) if (ISDIGIT (*input_line_pointer))
{ {
reg_number = strtol (input_line_pointer, &input_line_pointer, 10); reg_number = strtol (input_line_pointer, &input_line_pointer, 10);
@ -1711,7 +1711,7 @@ md_assemble (str)
strncpy (copy_of_instruction, str, sizeof (copy_of_instruction) - 1); strncpy (copy_of_instruction, str, sizeof (copy_of_instruction) - 1);
/* Get the opcode. */ /* Get the opcode. */
for (s = str; *s != '\0' && ! isspace (*s); s++) for (s = str; *s != '\0' && ! ISSPACE (*s); s++)
continue; continue;
if (*s != '\0') if (*s != '\0')
@ -1728,7 +1728,7 @@ md_assemble (str)
} }
str = s; str = s;
while (isspace (*str)) while (ISSPACE (*str))
++str; ++str;
start_of_operands = str; start_of_operands = str;
@ -2141,7 +2141,7 @@ md_assemble (str)
break; break;
} }
while (isspace (*str)) while (ISSPACE (*str))
++str; ++str;
if (*str != '\0') if (*str != '\0')

View file

@ -1965,7 +1965,7 @@ main ()
* *
*/ */
#include <ctype.h> #include "safe-ctype.h"
#define AP (12) #define AP (12)
#define FP (13) #define FP (13)
#define SP (14) #define SP (14)
@ -1979,14 +1979,12 @@ vax_reg_parse (c1, c2, c3) /* 3 chars of register name */
retval = -1; retval = -1;
if (isupper (c1)) c1 = TOLOWER (c1);
c1 = tolower (c1); c2 = TOLOWER (c2);
if (isupper (c2)) if (ISDIGIT (c2) && c1 == 'r')
c2 = tolower (c2);
if (isdigit (c2) && c1 == 'r')
{ {
retval = c2 - '0'; retval = c2 - '0';
if (isdigit (c3)) if (ISDIGIT (c3))
{ {
retval = retval * 10 + c3 - '0'; retval = retval * 10 + c3 - '0';
retval = (retval > 15) ? -1 : retval; retval = (retval > 15) ? -1 : retval;
@ -2332,8 +2330,7 @@ vip_op (optext, vopP)
char c; char c;
c = *p; c = *p;
if (isupper (c)) c = TOLOWER (c);
c = tolower (c);
if (DISPLENP (p[1]) && strchr ("bilws", len = c)) if (DISPLENP (p[1]) && strchr ("bilws", len = c))
p += 2; /* skip (letter) '^' */ p += 2; /* skip (letter) '^' */
else /* no (letter) '^' seen */ else /* no (letter) '^' seen */

View file

@ -26,7 +26,6 @@
#include "subsegs.h" #include "subsegs.h"
#define DEFINE_TABLE #define DEFINE_TABLE
#include "../opcodes/w65-opc.h" #include "../opcodes/w65-opc.h"
#include <ctype.h>
const char comment_chars[] = "!"; const char comment_chars[] = "!";
CONST char line_separator_chars[] = ";"; CONST char line_separator_chars[] = ";";

View file

@ -1,5 +1,5 @@
/* tc-z8k.c -- Assemble code for the Zilog Z800n /* 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. Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler. This file is part of GAS, the GNU Assembler.
@ -28,7 +28,7 @@
#include "as.h" #include "as.h"
#include "bfd.h" #include "bfd.h"
#include <ctype.h> #include "safe-ctype.h"
const char comment_chars[] = "!"; const char comment_chars[] = "!";
const char line_comment_chars[] = "#"; const char line_comment_chars[] = "#";
@ -70,9 +70,9 @@ int
tohex (c) tohex (c)
int c; int c;
{ {
if (isdigit (c)) if (ISDIGIT (c))
return c - '0'; return c - '0';
if (islower (c)) if (ISLOWER (c))
return c - 'a' + 10; return c - 'a' + 10;
return c - 'A' + 10; return c - 'A' + 10;
} }
@ -221,7 +221,7 @@ whatreg (reg, src)
int *reg; int *reg;
char *src; char *src;
{ {
if (isdigit (src[1])) if (ISDIGIT (src[1]))
{ {
*reg = (src[0] - '0') * 10 + src[1] - '0'; *reg = (src[0] - '0') * 10 + src[1] - '0';
return src + 2; return src + 2;

View file

@ -37,7 +37,7 @@
#include "coff/symconst.h" #include "coff/symconst.h"
#include "aout/stab_gnu.h" #include "aout/stab_gnu.h"
#include <ctype.h> #include "safe-ctype.h"
/* Why isn't this in coff/sym.h? */ /* Why isn't this in coff/sym.h? */
#define ST_RFDESCAPE 0xfff #define ST_RFDESCAPE 0xfff
@ -3101,7 +3101,7 @@ ecoff_directive_ent (ignore)
++input_line_pointer; ++input_line_pointer;
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
} }
if (isdigit ((unsigned char) *input_line_pointer) if (ISDIGIT (*input_line_pointer)
|| *input_line_pointer == '-') || *input_line_pointer == '-')
(void) get_absolute_expression (); (void) get_absolute_expression ();
@ -3546,7 +3546,7 @@ ecoff_stab (sec, what, string, type, other, desc)
listing_source_file (string); listing_source_file (string);
#endif #endif
if (isdigit ((unsigned char) *input_line_pointer) if (ISDIGIT (*input_line_pointer)
|| *input_line_pointer == '-' || *input_line_pointer == '-'
|| *input_line_pointer == '+') || *input_line_pointer == '+')
{ {

View file

@ -25,11 +25,11 @@
(It also gives smaller files to re-compile.) (It also gives smaller files to re-compile.)
Here, "operand"s are of expressions, not instructions. */ Here, "operand"s are of expressions, not instructions. */
#include <ctype.h>
#include <string.h> #include <string.h>
#define min(a, b) ((a) < (b) ? (a) : (b)) #define min(a, b) ((a) < (b) ? (a) : (b))
#include "as.h" #include "as.h"
#include "safe-ctype.h"
#include "obstack.h" #include "obstack.h"
static void floating_constant PARAMS ((expressionS * expressionP)); static void floating_constant PARAMS ((expressionS * expressionP));
@ -331,9 +331,7 @@ integer_constant (radix, expressionP)
/* In MRI mode, the number may have a suffix indicating the /* In MRI mode, the number may have a suffix indicating the
radix. For that matter, it might actually be a floating radix. For that matter, it might actually be a floating
point constant. */ point constant. */
for (suffix = input_line_pointer; for (suffix = input_line_pointer; ISALNUM (*suffix); suffix++)
isalnum ((unsigned char) *suffix);
suffix++)
{ {
if (*suffix == 'e' || *suffix == 'E') if (*suffix == 'e' || *suffix == 'E')
flt = 1; flt = 1;
@ -347,8 +345,7 @@ integer_constant (radix, expressionP)
else else
{ {
c = *--suffix; c = *--suffix;
if (islower ((unsigned char) c)) c = TOUPPER (c);
c = toupper (c);
if (c == 'B') if (c == 'B')
radix = 2; radix = 2;
else if (c == 'D') else if (c == 'D')
@ -862,8 +859,7 @@ operand (expressionP)
{ {
input_line_pointer++; input_line_pointer++;
floating_constant (expressionP); floating_constant (expressionP);
expressionP->X_add_number = expressionP->X_add_number = - TOLOWER (c);
- (isupper ((unsigned char) c) ? tolower (c) : c);
} }
else else
{ {
@ -985,8 +981,7 @@ operand (expressionP)
case 'G': case 'G':
input_line_pointer++; input_line_pointer++;
floating_constant (expressionP); floating_constant (expressionP);
expressionP->X_add_number = expressionP->X_add_number = - TOLOWER (c);
- (isupper ((unsigned char) c) ? tolower (c) : c);
break; break;
case '$': case '$':

View file

@ -1,5 +1,5 @@
/* gasp.c - Gnu assembler preprocessor main program. /* 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. Free Software Foundation, Inc.
Written by Steve and Judy Chamberlain of Cygnus Support, Written by Steve and Judy Chamberlain of Cygnus Support,
@ -51,7 +51,6 @@ suitable for gas to consume.
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <getopt.h> #include <getopt.h>
#include <ctype.h>
#ifdef HAVE_STDLIB_H #ifdef HAVE_STDLIB_H
#include <stdlib.h> #include <stdlib.h>
@ -63,6 +62,7 @@ extern char *malloc ();
#include "ansidecl.h" #include "ansidecl.h"
#include "libiberty.h" #include "libiberty.h"
#include "safe-ctype.h"
#include "sb.h" #include "sb.h"
#include "macro.h" #include "macro.h"
#include "asintl.h" #include "asintl.h"
@ -539,7 +539,7 @@ sb_strtol (idx, string, base, ptr)
{ {
int ch = string->ptr[idx]; int ch = string->ptr[idx];
int dig = 0; int dig = 0;
if (isdigit (ch)) if (ISDIGIT (ch))
dig = ch - '0'; dig = ch - '0';
else if (ch >= 'a' && ch <= 'f') else if (ch >= 'a' && ch <= 'f')
dig = ch - 'a' + 10; dig = ch - 'a' + 10;
@ -574,7 +574,7 @@ level_0 (idx, string, lhs)
lhs->value = 0; lhs->value = 0;
if (isdigit ((unsigned char) string->ptr[idx])) if (ISDIGIT (string->ptr[idx]))
{ {
idx = sb_strtol (idx, string, 10, &lhs->value); idx = sb_strtol (idx, string, 10, &lhs->value);
} }
@ -1132,7 +1132,7 @@ change_base (idx, in, out)
idx++; idx++;
} }
} }
else if (isdigit ((unsigned char) in->ptr[idx])) else if (ISDIGIT (in->ptr[idx]))
{ {
int value; int value;
/* All numbers must start with a digit, let's chew it and /* All numbers must start with a digit, let's chew it and
@ -1676,7 +1676,7 @@ doinstr (idx, in, out)
idx = sb_skip_comma (idx, in); idx = sb_skip_comma (idx, in);
idx = get_and_process (idx, in, &search); idx = get_and_process (idx, in, &search);
idx = sb_skip_comma (idx, in); 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); idx = exp_get_abs (_(".instr needs absolute expresson.\n"), idx, in, &start);
} }
@ -1776,26 +1776,26 @@ process_assigns (idx, in, buf)
} }
else if (idx + 3 < in->len else if (idx + 3 < in->len
&& in->ptr[idx] == '.' && in->ptr[idx] == '.'
&& toupper ((unsigned char) in->ptr[idx + 1]) == 'L' && TOUPPER (in->ptr[idx + 1]) == 'L'
&& toupper ((unsigned char) in->ptr[idx + 2]) == 'E' && TOUPPER (in->ptr[idx + 2]) == 'E'
&& toupper ((unsigned char) in->ptr[idx + 3]) == 'N') && TOUPPER (in->ptr[idx + 3]) == 'N')
idx = dolen (idx + 4, in, buf); idx = dolen (idx + 4, in, buf);
else if (idx + 6 < in->len else if (idx + 6 < in->len
&& in->ptr[idx] == '.' && in->ptr[idx] == '.'
&& toupper ((unsigned char) in->ptr[idx + 1]) == 'I' && TOUPPER (in->ptr[idx + 1]) == 'I'
&& toupper ((unsigned char) in->ptr[idx + 2]) == 'N' && TOUPPER (in->ptr[idx + 2]) == 'N'
&& toupper ((unsigned char) in->ptr[idx + 3]) == 'S' && TOUPPER (in->ptr[idx + 3]) == 'S'
&& toupper ((unsigned char) in->ptr[idx + 4]) == 'T' && TOUPPER (in->ptr[idx + 4]) == 'T'
&& toupper ((unsigned char) in->ptr[idx + 5]) == 'R') && TOUPPER (in->ptr[idx + 5]) == 'R')
idx = doinstr (idx + 6, in, buf); idx = doinstr (idx + 6, in, buf);
else if (idx + 7 < in->len else if (idx + 7 < in->len
&& in->ptr[idx] == '.' && in->ptr[idx] == '.'
&& toupper ((unsigned char) in->ptr[idx + 1]) == 'S' && TOUPPER (in->ptr[idx + 1]) == 'S'
&& toupper ((unsigned char) in->ptr[idx + 2]) == 'U' && TOUPPER (in->ptr[idx + 2]) == 'U'
&& toupper ((unsigned char) in->ptr[idx + 3]) == 'B' && TOUPPER (in->ptr[idx + 3]) == 'B'
&& toupper ((unsigned char) in->ptr[idx + 4]) == 'S' && TOUPPER (in->ptr[idx + 4]) == 'S'
&& toupper ((unsigned char) in->ptr[idx + 5]) == 'T' && TOUPPER (in->ptr[idx + 5]) == 'T'
&& toupper ((unsigned char) in->ptr[idx + 6]) == 'R') && TOUPPER (in->ptr[idx + 6]) == 'R')
idx = dosubstr (idx + 7, in, buf); idx = dosubstr (idx + 7, in, buf);
else if (ISFIRSTCHAR (in->ptr[idx])) else if (ISFIRSTCHAR (in->ptr[idx]))
{ {
@ -2130,8 +2130,8 @@ whatcond (idx, in, val)
char a, b; char a, b;
p = in->ptr + idx; p = in->ptr + idx;
a = toupper ((unsigned char) p[0]); a = TOUPPER (p[0]);
b = toupper ((unsigned char) p[1]); b = TOUPPER (p[1]);
if (a == 'E' && b == 'Q') if (a == 'E' && b == 'Q')
cond = EQ; cond = EQ;
else if (a == 'N' && b == 'E') else if (a == 'N' && b == 'E')
@ -2980,13 +2980,13 @@ chartype_init ()
int x; int x;
for (x = 0; x < 256; x++) for (x = 0; x < 256; x++)
{ {
if (isalpha (x) || x == '_' || x == '$') if (ISALPHA (x) || x == '_' || x == '$')
chartype[x] |= FIRSTBIT; chartype[x] |= FIRSTBIT;
if (mri && x == '.') if (mri && x == '.')
chartype[x] |= FIRSTBIT; chartype[x] |= FIRSTBIT;
if (isdigit (x) || isalpha (x) || x == '_' || x == '$') if (ISDIGIT (x) || ISALPHA (x) || x == '_' || x == '$')
chartype[x] |= NEXTBIT; chartype[x] |= NEXTBIT;
if (x == ' ' || x == '\t' || x == ',' || x == '"' || x == ';' if (x == ' ' || x == '\t' || x == ',' || x == '"' || x == ';'
@ -3551,6 +3551,9 @@ main (argc, argv)
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, ""); setlocale (LC_MESSAGES, "");
#endif
#if defined (HAVE_SETLOCALE)
setlocale (LC_CTYPE, "");
#endif #endif
bindtextdomain (PACKAGE, LOCALEDIR); bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE); textdomain (PACKAGE);

View file

@ -1,6 +1,6 @@
/* hash.c -- gas hash table code /* hash.c -- gas hash table code
Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999,
2000 2000, 2001
Free Software Foundation, Inc. Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler. This file is part of GAS, the GNU Assembler.
@ -30,6 +30,7 @@
structure. */ structure. */
#include "as.h" #include "as.h"
#include "safe-ctype.h"
#include "obstack.h" #include "obstack.h"
/* The default number of entries to use when creating a hash table. */ /* The default number of entries to use when creating a hash table. */
@ -458,8 +459,7 @@ main ()
printf ("hash_test command: "); printf ("hash_test command: ");
gets (answer); gets (answer);
command = answer[0]; command = answer[0];
if (isupper (command)) command = TOLOWER (command); /* Ecch! */
command = tolower (command); /* Ecch! */
switch (command) switch (command)
{ {
case '#': case '#':

View file

@ -1,5 +1,5 @@
/* itbl-lex.l /* 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. This file is part of GAS, the GNU Assembler.
@ -22,7 +22,6 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <ctype.h>
#include "itbl-parse.h" #include "itbl-parse.h"
#ifdef DEBUG #ifdef DEBUG

View file

@ -91,10 +91,9 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
on a line on a line
*/ */
#include <ctype.h>
#include "as.h" #include "as.h"
#include <obstack.h> #include <obstack.h>
#include "safe-ctype.h"
#include "input-file.h" #include "input-file.h"
#include "subsegs.h" #include "subsegs.h"
@ -370,7 +369,7 @@ listing_newline (ps)
unsigned char c = *src++; unsigned char c = *src++;
/* Omit control characters in the listing. */ /* Omit control characters in the listing. */
if (isascii (c) && ! iscntrl (c)) if (!ISCNTRL (c))
*dest++ = c; *dest++ = c;
} }
@ -908,7 +907,7 @@ debugging_pseudo (list, line)
was_debug = in_debug; was_debug = in_debug;
in_debug = 0; in_debug = 0;
while (isspace ((unsigned char) *line)) while (ISSPACE (*line))
line++; line++;
if (*line != '.') if (*line != '.')

View file

@ -1,5 +1,5 @@
/* macro.c - macro support for gas and gasp /* 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. Free Software Foundation, Inc.
Written by Steve and Judy Chamberlain of Cygnus Support, Written by Steve and Judy Chamberlain of Cygnus Support,
@ -51,11 +51,11 @@ extern void *alloca ();
#else #else
#include <strings.h> #include <strings.h>
#endif #endif
#include <ctype.h>
#ifdef HAVE_STDLIB_H #ifdef HAVE_STDLIB_H
#include <stdlib.h> #include <stdlib.h>
#endif #endif
#include "libiberty.h" #include "libiberty.h"
#include "safe-ctype.h"
#include "sb.h" #include "sb.h"
#include "hash.h" #include "hash.h"
#include "macro.h" #include "macro.h"
@ -183,7 +183,7 @@ buffer_and_nest (from, to, ptr, get_line)
/* Skip over a label. */ /* Skip over a label. */
while (i < ptr->len while (i < ptr->len
&& (isalnum ((unsigned char) ptr->ptr[i]) && (ISALNUM (ptr->ptr[i])
|| ptr->ptr[i] == '_' || ptr->ptr[i] == '_'
|| ptr->ptr[i] == '$')) || ptr->ptr[i] == '$'))
i++; i++;
@ -206,11 +206,11 @@ buffer_and_nest (from, to, ptr, get_line)
i++; i++;
if (strncasecmp (ptr->ptr + i, from, from_len) == 0 if (strncasecmp (ptr->ptr + i, from, from_len) == 0
&& (ptr->len == (i + from_len) && (ptr->len == (i + from_len)
|| ! isalnum (ptr->ptr[i + from_len]))) || ! ISALNUM (ptr->ptr[i + from_len])))
depth++; depth++;
if (strncasecmp (ptr->ptr + i, to, to_len) == 0 if (strncasecmp (ptr->ptr + i, to, to_len) == 0
&& (ptr->len == (i + to_len) && (ptr->len == (i + to_len)
|| ! isalnum (ptr->ptr[i + to_len]))) || ! ISALNUM (ptr->ptr[i + to_len])))
{ {
depth--; depth--;
if (depth == 0) if (depth == 0)
@ -241,13 +241,13 @@ get_token (idx, in, name)
sb *name; sb *name;
{ {
if (idx < in->len if (idx < in->len
&& (isalpha ((unsigned char) in->ptr[idx]) && (ISALPHA (in->ptr[idx])
|| in->ptr[idx] == '_' || in->ptr[idx] == '_'
|| in->ptr[idx] == '$')) || in->ptr[idx] == '$'))
{ {
sb_add_char (name, in->ptr[idx++]); sb_add_char (name, in->ptr[idx++]);
while (idx < in->len while (idx < in->len
&& (isalnum ((unsigned char) in->ptr[idx]) && (ISALNUM (in->ptr[idx])
|| in->ptr[idx] == '_' || in->ptr[idx] == '_'
|| in->ptr[idx] == '$')) || in->ptr[idx] == '$'))
{ {
@ -567,8 +567,7 @@ define_macro (idx, in, label, get_line, namep)
/* And stick it in the macro hash table. */ /* And stick it in the macro hash table. */
for (idx = 0; idx < name.len; idx++) 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); namestr = sb_terminate (&name);
hash_jam (macro_hash, namestr, (PTR) macro); hash_jam (macro_hash, namestr, (PTR) macro);
@ -726,15 +725,14 @@ macro_expand_body (in, out, formals, formal_hash, comment_char, locals)
sb_add_char (out, '&'); sb_add_char (out, '&');
src++; src++;
} }
else if (macro_mri else if (macro_mri && ISALNUM (in->ptr[src]))
&& isalnum ((unsigned char) in->ptr[src]))
{ {
int ind; int ind;
formal_entry *f; formal_entry *f;
if (isdigit ((unsigned char) in->ptr[src])) if (ISDIGIT (in->ptr[src]))
ind = in->ptr[src] - '0'; 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; ind = in->ptr[src] - 'A' + 10;
else else
ind = in->ptr[src] - 'a' + 10; ind = in->ptr[src] - 'a' + 10;
@ -758,7 +756,7 @@ macro_expand_body (in, out, formals, formal_hash, comment_char, locals)
} }
} }
else if ((macro_alternate || macro_mri) else if ((macro_alternate || macro_mri)
&& (isalpha ((unsigned char) in->ptr[src]) && (ISALPHA (in->ptr[src])
|| in->ptr[src] == '_' || in->ptr[src] == '_'
|| in->ptr[src] == '$') || in->ptr[src] == '$')
&& (! inquote && (! inquote
@ -1107,14 +1105,14 @@ check_macro (line, expand, comment_char, error, info)
macro_entry *macro; macro_entry *macro;
sb line_sb; sb line_sb;
if (! isalpha ((unsigned char) *line) if (! ISALPHA (*line)
&& *line != '_' && *line != '_'
&& *line != '$' && *line != '$'
&& (! macro_mri || *line != '.')) && (! macro_mri || *line != '.'))
return 0; return 0;
s = line + 1; s = line + 1;
while (isalnum ((unsigned char) *s) while (ISALNUM (*s)
|| *s == '_' || *s == '_'
|| *s == '$') || *s == '$')
++s; ++s;
@ -1123,8 +1121,7 @@ check_macro (line, expand, comment_char, error, info)
memcpy (copy, line, s - line); memcpy (copy, line, s - line);
copy[s - line] = '\0'; copy[s - line] = '\0';
for (cs = copy; *cs != '\0'; cs++) 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); macro = (macro_entry *) hash_find (macro_hash, copy);

View file

@ -35,10 +35,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
/* Routines that read assembler source text to build spagetti in memory. /* Routines that read assembler source text to build spagetti in memory.
Another group of these functions is in the expr.c module. */ Another group of these functions is in the expr.c module. */
/* For isdigit (). */
#include <ctype.h>
#include "as.h" #include "as.h"
#include "safe-ctype.h"
#include "subsegs.h" #include "subsegs.h"
#include "sb.h" #include "sb.h"
#include "macro.h" #include "macro.h"
@ -739,8 +737,7 @@ read_a_source_file (name)
while (*s2) while (*s2)
{ {
if (isupper ((unsigned char) *s2)) *s2 = TOLOWER (*s2);
*s2 = tolower (*s2);
s2++; s2++;
} }
} }
@ -907,8 +904,7 @@ read_a_source_file (name)
if (is_end_of_line[(unsigned char) c]) if (is_end_of_line[(unsigned char) c])
continue; continue;
if ((LOCAL_LABELS_DOLLAR || LOCAL_LABELS_FB) if ((LOCAL_LABELS_DOLLAR || LOCAL_LABELS_FB) && ISDIGIT (c))
&& isdigit ((unsigned char) c))
{ {
/* local label ("4:") */ /* local label ("4:") */
char *backup = input_line_pointer; char *backup = input_line_pointer;
@ -918,7 +914,7 @@ read_a_source_file (name)
temp = c - '0'; temp = c - '0';
/* Read the whole number. */ /* Read the whole number. */
while (isdigit ((unsigned char) *input_line_pointer)) while (ISDIGIT (*input_line_pointer))
{ {
temp = (temp * 10) + *input_line_pointer - '0'; temp = (temp * 10) + *input_line_pointer - '0';
++input_line_pointer; ++input_line_pointer;
@ -1453,7 +1449,7 @@ s_mri_common (small)
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
name = input_line_pointer; name = input_line_pointer;
if (!isdigit ((unsigned char) *name)) if (!ISDIGIT (*name))
c = get_symbol_end (); c = get_symbol_end ();
else else
{ {
@ -1461,7 +1457,7 @@ s_mri_common (small)
{ {
++input_line_pointer; ++input_line_pointer;
} }
while (isdigit ((unsigned char) *input_line_pointer)); while (ISDIGIT (*input_line_pointer));
c = *input_line_pointer; c = *input_line_pointer;
*input_line_pointer = '\0'; *input_line_pointer = '\0';
@ -2488,7 +2484,7 @@ s_mri_sect (type)
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
name = input_line_pointer; name = input_line_pointer;
if (!isdigit ((unsigned char) *name)) if (!ISDIGIT (*name))
c = get_symbol_end (); c = get_symbol_end ();
else else
{ {
@ -2496,7 +2492,7 @@ s_mri_sect (type)
{ {
++input_line_pointer; ++input_line_pointer;
} }
while (isdigit ((unsigned char) *input_line_pointer)); while (ISDIGIT (*input_line_pointer));
c = *input_line_pointer; c = *input_line_pointer;
*input_line_pointer = '\0'; *input_line_pointer = '\0';
@ -2521,7 +2517,7 @@ s_mri_sect (type)
if (*input_line_pointer == ',') if (*input_line_pointer == ',')
{ {
c = *++input_line_pointer; c = *++input_line_pointer;
c = toupper ((unsigned char) c); c = TOUPPER (c);
if (c == 'C' || c == 'D' || c == 'M' || c == 'R') if (c == 'C' || c == 'D' || c == 'M' || c == 'R')
*type = c; *type = c;
else else
@ -3044,7 +3040,7 @@ s_float_space (float_type)
/* Skip any 0{letter} that may be present. Don't even check if the /* Skip any 0{letter} that may be present. Don't even check if the
* letter is legal. */ * letter is legal. */
if (input_line_pointer[0] == '0' if (input_line_pointer[0] == '0'
&& isalpha ((unsigned char) input_line_pointer[1])) && ISALPHA (input_line_pointer[1]))
input_line_pointer += 2; input_line_pointer += 2;
/* Accept :xxxx, where the x's are hex digits, for a floating point /* Accept :xxxx, where the x's are hex digits, for a floating point
@ -3141,7 +3137,7 @@ ignore_rest_of_line ()
/* For suspect lines: gives warning. */ /* For suspect lines: gives warning. */
if (!is_end_of_line[(unsigned char) *input_line_pointer]) 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'"), as_warn (_("rest of line ignored; first ignored character is `%c'"),
*input_line_pointer); *input_line_pointer);
else else
@ -4130,7 +4126,7 @@ float_cons (float_type)
has no use for such information. Lusers beware: you get has no use for such information. Lusers beware: you get
diagnostics if your input is ill-conditioned. */ diagnostics if your input is ill-conditioned. */
if (input_line_pointer[0] == '0' if (input_line_pointer[0] == '0'
&& isalpha ((unsigned char) input_line_pointer[1])) && ISALPHA (input_line_pointer[1]))
input_line_pointer += 2; input_line_pointer += 2;
/* Accept :xxxx, where the x's are hex digits, for a floating /* Accept :xxxx, where the x's are hex digits, for a floating
@ -4668,7 +4664,7 @@ next_char_of_string ()
int i; int i;
for (i = 0, number = 0; for (i = 0, number = 0;
isdigit (c) && i < 3; ISDIGIT (c) && i < 3;
c = *input_line_pointer++, i++) c = *input_line_pointer++, i++)
{ {
number = number * 8 + c - '0'; number = number * 8 + c - '0';
@ -4686,11 +4682,11 @@ next_char_of_string ()
number = 0; number = 0;
c = *input_line_pointer++; c = *input_line_pointer++;
while (isxdigit (c)) while (ISXDIGIT (c))
{ {
if (isdigit (c)) if (ISDIGIT (c))
number = number * 16 + c - '0'; number = number * 16 + c - '0';
else if (isupper (c)) else if (ISUPPER (c))
number = number * 16 + c - 'A' + 10; number = number * 16 + c - 'A' + 10;
else else
number = number * 16 + c - 'a' + 10; number = number * 16 + c - 'a' + 10;

View file

@ -22,10 +22,9 @@
/* #define DEBUG_SYMS / * to debug symbol list maintenance. */ /* #define DEBUG_SYMS / * to debug symbol list maintenance. */
#include <ctype.h>
#include "as.h" #include "as.h"
#include "safe-ctype.h"
#include "obstack.h" /* For "symbols.h" */ #include "obstack.h" /* For "symbols.h" */
#include "subsegs.h" #include "subsegs.h"
@ -124,11 +123,10 @@ save_symbol_name (name)
if (! symbols_case_sensitive) if (! symbols_case_sensitive)
{ {
unsigned char *s; char *s;
for (s = (unsigned char *) ret; *s != '\0'; s++) for (s = ret; *s != '\0'; s++)
if (islower (*s)) *s = TOUPPER (*s);
*s = toupper (*s);
} }
return ret; return ret;
@ -630,9 +628,7 @@ symbol_find_base (name, strip_underscore)
while ((c = *orig++) != '\0') while ((c = *orig++) != '\0')
{ {
if (islower (c)) *copy++ = TOUPPER (c);
c = toupper (c);
*copy++ = c;
} }
*copy = '\0'; *copy = '\0';
} }
@ -1584,7 +1580,7 @@ decode_local_label_name (s)
if (s[index] != 'L') if (s[index] != 'L')
return s; 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'; label_number = (10 * label_number) + *p - '0';
if (*p == DOLLAR_LABEL_CHAR) if (*p == DOLLAR_LABEL_CHAR)
@ -1594,7 +1590,7 @@ decode_local_label_name (s)
else else
return s; 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'; instance_number = (10 * instance_number) + *p - '0';
message_format = _("\"%d\" (instance number %d of a %s label)"); message_format = _("\"%d\" (instance number %d of a %s label)");

Some files were not shown because too many files have changed in this diff Show more