aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2001-09-19 05:33:36 +0000
committerH.J. Lu <hjl.tools@gmail.com>2001-09-19 05:33:36 +0000
commit3882b010780ca1aa1ed5d7b38e936cd2d6d5486b (patch)
treec806a73a13afd3265ba6b538ba73cae065c591f5 /gas
parent6b819c92c4512ccfba90f0caa204ab687fae8254 (diff)
downloadgdb-3882b010780ca1aa1ed5d7b38e936cd2d6d5486b.zip
gdb-3882b010780ca1aa1ed5d7b38e936cd2d6d5486b.tar.gz
gdb-3882b010780ca1aa1ed5d7b38e936cd2d6d5486b.tar.bz2
Locale changes from Bruno Haible <haible@clisp.cons.org>.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog229
-rw-r--r--gas/as.c3
-rw-r--r--gas/as.h1
-rw-r--r--gas/atof-generic.c14
-rw-r--r--gas/config/m68k-parse.y9
-rw-r--r--gas/config/obj-elf.c3
-rw-r--r--gas/config/obj-vms.c17
-rw-r--r--gas/config/tc-a29k.c21
-rw-r--r--gas/config/tc-alpha.c8
-rw-r--r--gas/config/tc-arc.c15
-rw-r--r--gas/config/tc-arm.c20
-rw-r--r--gas/config/tc-avr.c14
-rw-r--r--gas/config/tc-cris.c17
-rw-r--r--gas/config/tc-d10v.c4
-rw-r--r--gas/config/tc-d30v.c8
-rw-r--r--gas/config/tc-fr30.c4
-rw-r--r--gas/config/tc-h8300.c8
-rw-r--r--gas/config/tc-h8500.c6
-rw-r--r--gas/config/tc-hppa.c37
-rw-r--r--gas/config/tc-i370.c24
-rw-r--r--gas/config/tc-i386.c15
-rw-r--r--gas/config/tc-i860.c18
-rw-r--r--gas/config/tc-i960.c6
-rw-r--r--gas/config/tc-ia64.c19
-rw-r--r--gas/config/tc-m32r.c9
-rw-r--r--gas/config/tc-m68hc11.c8
-rw-r--r--gas/config/tc-m68k.c40
-rw-r--r--gas/config/tc-m88k.c35
-rw-r--r--gas/config/tc-mcore.c86
-rw-r--r--gas/config/tc-mips.c106
-rw-r--r--gas/config/tc-mn10200.c8
-rw-r--r--gas/config/tc-mn10300.c8
-rw-r--r--gas/config/tc-ns32k.c1
-rw-r--r--gas/config/tc-pdp11.c11
-rw-r--r--gas/config/tc-pj.c5
-rw-r--r--gas/config/tc-ppc.c19
-rw-r--r--gas/config/tc-s390.c16
-rw-r--r--gas/config/tc-sh.c60
-rw-r--r--gas/config/tc-sparc.c30
-rw-r--r--gas/config/tc-tahoe.c9
-rw-r--r--gas/config/tc-tic30.c23
-rw-r--r--gas/config/tc-tic54x.c75
-rw-r--r--gas/config/tc-tic80.c9
-rw-r--r--gas/config/tc-v850.c10
-rw-r--r--gas/config/tc-vax.c15
-rw-r--r--gas/config/tc-w65.c1
-rw-r--r--gas/config/tc-z8k.c10
-rw-r--r--gas/ecoff.c6
-rw-r--r--gas/expr.c15
-rw-r--r--gas/gasp.c51
-rw-r--r--gas/hash.c6
-rw-r--r--gas/itbl-lex.l3
-rw-r--r--gas/listing.c7
-rw-r--r--gas/macro.c33
-rw-r--r--gas/read.c36
-rw-r--r--gas/symbols.c18
56 files changed, 741 insertions, 548 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index ce8567d..ba90aaf 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -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>
* tc-s390.c (s390_insn): Add code to cope with 6 byte O_constants
diff --git a/gas/as.c b/gas/as.c
index 0f6d4af..2ce2fb9 100644
--- a/gas/as.c
+++ b/gas/as.c
@@ -780,6 +780,9 @@ main (argc, argv)
#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);
diff --git a/gas/as.h b/gas/as.h
index 7da5ed2..ed82574 100644
--- a/gas/as.h
+++ b/gas/as.h
@@ -73,7 +73,6 @@ extern void *alloca ();
/* System include files first... */
#include <stdio.h>
-#include <ctype.h>
#ifdef HAVE_STRING_H
#include <string.h>
#else
diff --git a/gas/atof-generic.c b/gas/atof-generic.c
index 2d7a32b..c5d10d4 100644
--- a/gas/atof-generic.c
+++ b/gas/atof-generic.c
@@ -1,5 +1,5 @@
/* atof_generic.c - turn a string of digits into a Flonum
- Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000
+ Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -19,10 +19,10 @@
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
-#include <ctype.h>
#include <string.h>
#include "as.h"
+#include "safe-ctype.h"
#ifndef FALSE
#define FALSE (0)
@@ -171,7 +171,7 @@ atof_generic (address_of_string_pointer,
&& (!c || !strchr (string_of_decimal_exponent_marks, c)));
p++)
{
- if (isdigit ((unsigned char) c))
+ if (ISDIGIT (c))
{
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 */
- for (p++; (c = *p) && isdigit ((unsigned char) c); p++)
+ for (p++; (c = *p) && ISDIGIT (c); p++)
{
if (c == '0')
{
@@ -221,7 +221,7 @@ atof_generic (address_of_string_pointer,
&& (!c || !strchr (string_of_decimal_exponent_marks, c)));
p++)
{
- if (isdigit ((unsigned char) c))
+ if (ISDIGIT (c))
{
/* This may be retracted below. */
number_of_digits_after_decimal++;
@@ -275,7 +275,7 @@ atof_generic (address_of_string_pointer,
for (; (c); c = *++p)
{
- if (isdigit ((unsigned char) c))
+ if (ISDIGIT (c))
{
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)
{
c = *p;
- if (isdigit ((unsigned char) c))
+ if (ISDIGIT (c))
{
/*
* Multiply by 10. Assume can never overflow.
diff --git a/gas/config/m68k-parse.y b/gas/config/m68k-parse.y
index e24110f..15c6236 100644
--- a/gas/config/m68k-parse.y
+++ b/gas/config/m68k-parse.y
@@ -1,5 +1,5 @@
/* m68k.y -- bison grammar for m68k operand parsing
- Copyright 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+ Copyright 1995, 1996, 1997, 1998, 2001 Free Software Foundation, Inc.
Written by Ken Raeburn and Ian Lance Taylor, Cygnus Support
This file is part of GAS, the GNU Assembler.
@@ -29,6 +29,7 @@
#include "as.h"
#include "tc-m68k.h"
#include "m68k-parse.h"
+#include "safe-ctype.h"
/* Remap normal yacc parser interface names (yyparse, yylex, yyerror,
etc), as well as gratuitiously global symbol names If other parser
@@ -743,9 +744,9 @@ yylex ()
/* In MRI mode, this can be the start of an octal number. */
if (flag_mri)
{
- if (isdigit (str[1])
+ if (ISDIGIT (str[1])
|| ((str[1] == '+' || str[1] == '-')
- && isdigit (str[2])))
+ && ISDIGIT (str[2])))
break;
}
/* Fall through. */
@@ -929,7 +930,7 @@ yylex ()
{
if (parens == 0
&& s > str
- && (s[-1] == ')' || isalnum ((unsigned char) s[-1])))
+ && (s[-1] == ')' || ISALNUM (s[-1])))
break;
++parens;
}
diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c
index 7ab0d57..b84a4b0 100644
--- a/gas/config/obj-elf.c
+++ b/gas/config/obj-elf.c
@@ -21,6 +21,7 @@
#define OBJ_HEADER "obj-elf.h"
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "obstack.h"
@@ -1236,7 +1237,7 @@ obj_elf_vtable_inherit (ignore)
if (input_line_pointer[0] == '0'
&& (input_line_pointer[1] == '\0'
- || isspace ((unsigned char) input_line_pointer[1])))
+ || ISSPACE (input_line_pointer[1])))
{
psym = section_symbol (absolute_section);
++input_line_pointer;
diff --git a/gas/config/obj-vms.c b/gas/config/obj-vms.c
index 969b96e..cd36a38 100644
--- a/gas/config/obj-vms.c
+++ b/gas/config/obj-vms.c
@@ -28,6 +28,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "as.h"
#include "config.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "obstack.h"
@@ -3071,7 +3072,7 @@ Write_VMS_MHD_Records ()
cp++;
continue;
}
- *cp1++ = islower (*cp) ? toupper (*cp++) : *cp++;
+ *cp1++ = TOUPPER (*cp++);
}
*cp1 = '\0';
@@ -3254,20 +3255,20 @@ VMS_Case_Hack_Symbol (In, Out)
switch (vms_name_mapping)
{
case 0:
- if (isupper (*In)) {
+ if (ISUPPER (*In)) {
*Out++ = *In++;
Case_Hack_Bits |= 1;
} else {
- *Out++ = islower (*In) ? toupper (*In++) : *In++;
+ *Out++ = TOUPPER (*In++);
}
break;
case 3: *Out++ = *In++;
break;
case 2:
- if (islower (*In)) {
+ if (ISLOWER (*In)) {
*Out++ = *In++;
} else {
- *Out++ = isupper (*In) ? tolower (*In++) : *In++;
+ *Out++ = TOLOWER (*In++);
}
break;
}
@@ -3298,7 +3299,7 @@ VMS_Case_Hack_Symbol (In, Out)
* and ensure that they are lowercase
*/
for (i = 0; (In[i] != 0) && (i < 8); i++)
- if (isupper (In[i]) && !Saw_Dollar && !flag_no_hash_mixed_case)
+ if (ISUPPER (In[i]) && !Saw_Dollar && !flag_no_hash_mixed_case)
break;
if (In[i] == 0)
@@ -3313,11 +3314,11 @@ VMS_Case_Hack_Symbol (In, Out)
i = 8;
while ((--i >= 0) && (*In))
switch (vms_name_mapping){
- case 0: *Out++ = islower (*In) ? toupper (*In++) : *In++;
+ case 0: *Out++ = TOUPPER (*In++);
break;
case 3: *Out++ = *In++;
break;
- case 2: *Out++ = isupper (*In) ? tolower (*In++) : *In++;
+ case 2: *Out++ = TOLOWER (*In++);
break;
}
}
diff --git a/gas/config/tc-a29k.c b/gas/config/tc-a29k.c
index d4d4c43..14c0d82 100644
--- a/gas/config/tc-a29k.c
+++ b/gas/config/tc-a29k.c
@@ -1,5 +1,5 @@
/* tc-a29k.c -- Assemble for the AMD 29000.
- Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1998, 2000
+ Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1998, 2000, 2001
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -23,8 +23,8 @@
to convert it to new machines' assemblers as desired. There was too
much bloody rewriting required before. There still probably is. */
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "opcode/a29k.h"
@@ -188,7 +188,7 @@ insert_sreg (regname, regnum)
symbol_table_insert (symbol_new (regname, SEG_REGISTER, (valueT) regnum,
&zero_address_frag));
for (i = 0; regname[i]; i++)
- buf[i] = islower (regname[i]) ? toupper (regname[i]) : regname[i];
+ buf[i] = TOUPPER (regname[i]);
buf[i] = '\0';
symbol_table_insert (symbol_new (buf, SEG_REGISTER, (valueT) regnum,
@@ -397,10 +397,9 @@ machine_ip (str)
/* Must handle `div0' opcode. */
s = str;
- if (isalpha (*s))
- for (; isalnum (*s); ++s)
- if (isupper (*s))
- *s = tolower (*s);
+ if (ISALPHA (*s))
+ for (; ISALNUM (*s); ++s)
+ *s = TOLOWER (*s);
switch (*s)
{
@@ -1067,13 +1066,13 @@ a29k_unrecognized_line (c)
char *s;
if (c != '$'
- || ! isdigit ((unsigned char) input_line_pointer[0]))
+ || ! ISDIGIT (input_line_pointer[0]))
return 0;
s = input_line_pointer;
lab = 0;
- while (isdigit ((unsigned char) *s))
+ while (ISDIGIT (*s))
{
lab = lab * 10 + *s - '0';
++s;
@@ -1176,7 +1175,7 @@ md_operand (expressionP)
expressionP->X_op = O_constant;
}
else if (input_line_pointer[0] == '$'
- && isdigit ((unsigned char) input_line_pointer[1]))
+ && ISDIGIT (input_line_pointer[1]))
{
long lab;
char *name;
@@ -1238,7 +1237,7 @@ md_operand (expressionP)
return;
}
- if (isdigit (*s))
+ if (ISDIGIT (*s))
{
fieldnum = *s - '0';
++s;
diff --git a/gas/config/tc-alpha.c b/gas/config/tc-alpha.c
index 7a8c04c..0c87d40 100644
--- a/gas/config/tc-alpha.c
+++ b/gas/config/tc-alpha.c
@@ -62,7 +62,7 @@
#include "dwarf2dbg.h"
#endif
-#include <ctype.h>
+#include "safe-ctype.h"
/* Local types */
@@ -1299,7 +1299,7 @@ md_undefined_symbol (name)
/* FALLTHRU */
case 'r':
- if (!isdigit (*++name))
+ if (!ISDIGIT (*++name))
break;
/* FALLTHRU */
@@ -1307,7 +1307,7 @@ md_undefined_symbol (name)
case '5': case '6': case '7': case '8': case '9':
if (name[1] == '\0')
num = name[0] - '0';
- else if (name[0] != '0' && isdigit (name[1]) && name[2] == '\0')
+ else if (name[0] != '0' && ISDIGIT (name[1]) && name[2] == '\0')
{
num = (name[0] - '0') * 10 + name[1] - '0';
if (num >= 32)
@@ -4214,7 +4214,7 @@ s_alpha_ent (dummy)
input_line_pointer++;
SKIP_WHITESPACE ();
}
- if (isdigit (*input_line_pointer) || *input_line_pointer == '-')
+ if (ISDIGIT (*input_line_pointer) || *input_line_pointer == '-')
(void) get_absolute_expression ();
}
demand_empty_rest_of_line ();
diff --git a/gas/config/tc-arc.c b/gas/config/tc-arc.c
index 285cdf6..cedd2b4 100644
--- a/gas/config/tc-arc.c
+++ b/gas/config/tc-arc.c
@@ -21,9 +21,9 @@
02111-1307, USA. */
#include <stdio.h>
-#include <ctype.h>
#include "libiberty.h"
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "opcode/arc.h"
#include "../opcodes/arc-ext.h"
@@ -393,7 +393,7 @@ md_assemble (str)
}
/* Skip leading white space. */
- while (isspace (*str))
+ while (ISSPACE (*str))
str++;
/* 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. */
- for (t = s; *t && isalnum (*t); ++t)
+ for (t = s; *t && ISALNUM (*t); ++t)
continue;
c = *t;
*t = '\0';
@@ -736,7 +736,7 @@ md_assemble (str)
insn and it is assumed that longer versions of insns appear
before shorter ones (eg: lsr r2,r3,1 vs lsr r2,r3). */
- while (isspace (*str))
+ while (ISSPACE (*str))
++str;
if (!is_end_of_line[(unsigned char) *str])
@@ -913,8 +913,7 @@ arc_extoper (opertype)
p = name;
while (*p)
{
- if (isupper (*p))
- *p = tolower (*p);
+ *p = TOLOWER (*p);
p++;
}
@@ -1703,7 +1702,7 @@ md_operand (expressionP)
while (ext_oper)
{
l = strlen (ext_oper->operand.name);
- if (!strncmp (p, ext_oper->operand.name, l) && !isalnum (*(p + l)))
+ if (!strncmp (p, ext_oper->operand.name, l) && !ISALNUM (*(p + l)))
{
input_line_pointer += l + 1;
expressionP->X_op = O_register;
@@ -1715,7 +1714,7 @@ md_operand (expressionP)
for (i = 0; i < arc_reg_names_count; i++)
{
l = strlen (arc_reg_names[i].name);
- if (!strncmp (p, arc_reg_names[i].name, l) && !isalnum (*(p + l)))
+ if (!strncmp (p, arc_reg_names[i].name, l) && !ISALNUM (*(p + l)))
{
input_line_pointer += l + 1;
expressionP->X_op = O_register;
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index da8ffc0..ab4f291 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -21,10 +21,10 @@
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
-#include <ctype.h>
#include <string.h>
#define NO_RELOC 0
#include "as.h"
+#include "safe-ctype.h"
/* Need TARGET_CPU. */
#include "config.h"
@@ -1864,7 +1864,7 @@ arm_psr_parse (ccp)
{
c = *p++;
}
- while (isalpha (c) || c == '_');
+ while (ISALPHA (c) || c == '_');
/* Terminate the word. */
*--p = 0;
@@ -2517,7 +2517,7 @@ accum0_required_here (str)
*str = p; /* Advance caller's string pointer too. */
c = *p++;
- while (isalnum (c))
+ while (ISALNUM (c))
c = *p++;
*--p = 0; /* Aap nul into input buffer at non-alnum. */
@@ -3513,7 +3513,7 @@ do_ldrd (str, flags)
static char buff[128];
--str;
- while (isspace (*str))
+ while (ISSPACE (*str))
--str;
str -= 4;
@@ -3710,7 +3710,7 @@ decode_shift (str, unrestrict)
skip_whitespace (* str);
- for (p = * str; isalpha (* p); p ++)
+ for (p = * str; ISALPHA (* p); p ++)
;
if (p == * str)
@@ -6407,7 +6407,7 @@ insert_reg (entry)
strcpy (buf + i, reg_table[entry].name);
for (i = 0; buf[i]; i++)
- buf2[i] = islower (buf[i]) ? toupper (buf[i]) : buf[i];
+ buf2[i] = TOUPPER (buf[i]);
buf2[i] = '\0';
@@ -6775,11 +6775,11 @@ arm_reg_parse (ccp)
p++, start++;
#endif
#endif
- if (!isalpha (*p) || !is_name_beginner (*p))
+ if (!ISALPHA (*p) || !is_name_beginner (*p))
return FAIL;
c = *p++;
- while (isalpha (c) || isdigit (c) || c == '_')
+ while (ISALPHA (c) || ISDIGIT (c) || c == '_')
c = *p++;
*--p = 0;
@@ -8724,9 +8724,9 @@ arm_parse_reloc ()
};
for (i = 0, ip = input_line_pointer;
- i < sizeof (id) && (isalnum (*ip) || ispunct (*ip));
+ i < sizeof (id) && (ISALNUM (*ip) || ISPUNCT (*ip));
i++, ip++)
- id[i] = tolower (*ip);
+ id[i] = TOLOWER (*ip);
for (i = 0; reloc_map[i].str; i++)
if (strncmp (id, reloc_map[i].str, reloc_map[i].len) == 0)
diff --git a/gas/config/tc-avr.c b/gas/config/tc-avr.c
index 78954e1..aebab8d 100644
--- a/gas/config/tc-avr.c
+++ b/gas/config/tc-avr.c
@@ -1,6 +1,6 @@
/* tc-avr.c -- Assembler code for the ATMEL AVR
- Copyright 1999, 2000 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
Contributed by Denis Chertykov <denisc@overta.ru>
This file is part of GAS, the GNU Assembler.
@@ -21,8 +21,8 @@
Boston, MA 02111-1307, USA. */
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
struct avr_opcodes_s
@@ -298,7 +298,7 @@ md_parse_option (c, arg)
char *arg1 = arg;
do
- *t = tolower (*arg1++);
+ *t = TOLOWER (*arg1++);
while (*t++);
}
@@ -555,12 +555,12 @@ avr_operand (opcode, where, op, line)
str = extract_word (str, r_name, sizeof (r_name));
op_mask = 0xff;
- if (isdigit (r_name[1]))
+ if (ISDIGIT (r_name[1]))
{
if (r_name[2] == '\0')
op_mask = r_name[1] - '0';
else if (r_name[1] != '0'
- && isdigit (r_name[2])
+ && ISDIGIT (r_name[2])
&& r_name[3] == '\0')
op_mask = (r_name[1] - '0') * 10 + r_name[2] - '0';
}
@@ -613,7 +613,7 @@ avr_operand (opcode, where, op, line)
str = skip_space (str + 1);
op_mask = 0x1002;
}
- c = tolower (*str);
+ c = TOLOWER (*str);
if (c == 'x')
op_mask |= 0x100c;
else if (c == 'y')
@@ -656,7 +656,7 @@ avr_operand (opcode, where, op, line)
case 'b':
{
- char c = tolower (*str++);
+ char c = TOLOWER (*str++);
if (c == 'y')
op_mask |= 0x8;
diff --git a/gas/config/tc-cris.c b/gas/config/tc-cris.c
index a83cf8a..0ca98f5 100644
--- a/gas/config/tc-cris.c
+++ b/gas/config/tc-cris.c
@@ -23,8 +23,8 @@
MA 02111-1307, USA. */
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "opcode/cris.h"
#include "dwarf2dbg.h"
@@ -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)
that the caller has translated the opcode to lower-case, up to the
first non-letter. */
- for (operands = insn_text; islower (*operands); ++operands)
+ for (operands = insn_text; ISLOWER (*operands); ++operands)
;
/* Terminate the opcode after letters, but save the character there if
@@ -1586,7 +1586,7 @@ get_gen_reg (cPP, regnop)
(*cPP)++;
if ((**cPP == 'C' || **cPP == 'c')
- && ! isalnum ((*cPP)[1]))
+ && ! ISALNUM ((*cPP)[1]))
{
/* It's "PC": consume the "c" and we're done. */
(*cPP)++;
@@ -1600,13 +1600,13 @@ get_gen_reg (cPP, regnop)
/* Hopefully r[0-9] or r1[0-5]. Consume 'R' or 'r'. */
(*cPP)++;
- if (isdigit (**cPP))
+ if (ISDIGIT (**cPP))
{
/* It's r[0-9]. Consume and check the next digit. */
*regnop = **cPP - '0';
(*cPP)++;
- if (! isalnum (**cPP))
+ if (! ISALNUM (**cPP))
{
/* No more digits, we're done. */
return 1;
@@ -1688,8 +1688,7 @@ get_spec_reg (cPP, sregpp)
s1 = name_begin;
s2 = sregp->name;
- while (*s2 != '\0'
- && (isupper (*s1) ? tolower (*s1) == *s2 : *s1 == *s2))
+ while (*s2 != '\0' && TOLOWER (*s1) == *s2)
{
s1++;
s2++;
@@ -1698,7 +1697,7 @@ get_spec_reg (cPP, sregpp)
/* For a match, we must have consumed the name in the table, and we
must be outside what could be part of a name. Assume here that a
test for alphanumerics is sufficient for a name test. */
- if (*s2 == 0 && ! isalnum (*s1))
+ if (*s2 == 0 && ! ISALNUM (*s1))
{
/* We have a match. Update the pointer and be done. */
*cPP = s1;
@@ -2321,7 +2320,7 @@ get_flags (cPP, flagsp)
whitespace. Anything else, and we consider it a failure. */
if (**cPP != ','
&& **cPP != 0
- && ! isspace (**cPP))
+ && ! ISSPACE (**cPP))
return 0;
else
return 1;
diff --git a/gas/config/tc-d10v.c b/gas/config/tc-d10v.c
index 28ac040..248e62a 100644
--- a/gas/config/tc-d10v.c
+++ b/gas/config/tc-d10v.c
@@ -20,8 +20,8 @@
Boston, MA 02111-1307, USA. */
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "opcode/d10v.h"
#include "elf/ppc.h"
@@ -1185,7 +1185,7 @@ do_assemble (str, opcode)
&& !is_end_of_line[*op_end] && *op_end != ' ';
op_end++)
{
- name[nlen] = tolower (op_start[nlen]);
+ name[nlen] = TOLOWER (op_start[nlen]);
nlen++;
}
name[nlen] = 0;
diff --git a/gas/config/tc-d30v.c b/gas/config/tc-d30v.c
index b61ce5f..5316b09 100644
--- a/gas/config/tc-d30v.c
+++ b/gas/config/tc-d30v.c
@@ -1,5 +1,5 @@
/* 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.
@@ -19,8 +19,8 @@
Boston, MA 02111-1307, USA. */
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "opcode/d30v.h"
@@ -1454,7 +1454,7 @@ do_assemble (str, opcode, shortp, is_parallel)
&& !is_end_of_line[*op_end] && *op_end != ' ';
op_end++)
{
- name[nlen] = tolower (op_start[nlen]);
+ name[nlen] = TOLOWER (op_start[nlen]);
nlen++;
}
@@ -2045,7 +2045,7 @@ d30v_start_line ()
{
char *c = input_line_pointer;
- while (isspace (*c))
+ while (ISSPACE (*c))
c++;
if (*c == '.')
diff --git a/gas/config/tc-fr30.c b/gas/config/tc-fr30.c
index 98f5729..26768fe 100644
--- a/gas/config/tc-fr30.c
+++ b/gas/config/tc-fr30.c
@@ -19,8 +19,8 @@
Boston, MA 02111-1307, USA. */
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "symcat.h"
#include "opcodes/fr30-desc.h"
@@ -614,7 +614,7 @@ fr30_is_colon_insn (start)
continue;
while (len --)
- if (tolower (start [len]) != insn [len])
+ if (TOLOWER (start [len]) != insn [len])
break;
if (len == -1)
diff --git a/gas/config/tc-h8300.c b/gas/config/tc-h8300.c
index 05c49dc..13be3462 100644
--- a/gas/config/tc-h8300.c
+++ b/gas/config/tc-h8300.c
@@ -28,7 +28,7 @@
#define DEFINE_TABLE
#define h8_opcodes ops
#include "opcode/h8300.h"
-#include <ctype.h>
+#include "safe-ctype.h"
#ifdef OBJ_ELF
#include "elf/h8.h"
@@ -347,7 +347,7 @@ skip_colonthing (ptr, exp, mode)
{
*mode |= L_16;
}
- while (isdigit (*ptr))
+ while (ISDIGIT (*ptr))
ptr++;
}
}
@@ -418,8 +418,8 @@ get_operand (ptr, op, dst, direction)
/* Gross. Gross. ldm and stm have a format not easily handled
by get_operand. We deal with it explicitly here. */
- if (src[0] == 'e' && src[1] == 'r' && isdigit (src[2])
- && src[3] == '-' && src[4] == 'e' && src[5] == 'r' && isdigit (src[6]))
+ if (src[0] == 'e' && src[1] == 'r' && ISDIGIT (src[2])
+ && src[3] == '-' && src[4] == 'e' && src[5] == 'r' && ISDIGIT (src[6]))
{
int low, high;
diff --git a/gas/config/tc-h8500.c b/gas/config/tc-h8500.c
index a13c942..7cffd83 100644
--- a/gas/config/tc-h8500.c
+++ b/gas/config/tc-h8500.c
@@ -28,7 +28,7 @@
#define DEFINE_TABLE
#define ASSEMBLER_TABLE
#include "opcodes/h8500-opc.h"
-#include <ctype.h>
+#include "safe-ctype.h"
const char comment_chars[] = "!";
const char line_separator_chars[] = ";";
@@ -1589,10 +1589,10 @@ start_label (ptr)
char *ptr;
{
/* Check for :s.w */
- if (isalpha (ptr[1]) && ptr[2] == '.')
+ if (ISALPHA (ptr[1]) && ptr[2] == '.')
return 0;
/* Check for :s */
- if (isalpha (ptr[1]) && !isalpha (ptr[2]))
+ if (ISALPHA (ptr[1]) && !ISALPHA (ptr[2]))
return 0;
return 1;
}
diff --git a/gas/config/tc-hppa.c b/gas/config/tc-hppa.c
index cb9b9fb..2339890 100644
--- a/gas/config/tc-hppa.c
+++ b/gas/config/tc-hppa.c
@@ -23,9 +23,9 @@
at the University of Utah. */
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "bfd/libhppa.h"
@@ -1571,11 +1571,12 @@ pa_ip (str)
/* Convert everything up to the first whitespace character into lower
case. */
for (s = str; *s != ' ' && *s != '\t' && *s != '\n' && *s != '\0'; s++)
- if (isupper (*s))
- *s = tolower (*s);
+ *s = TOLOWER (*s);
/* Skip to something interesting. */
- for (s = str; isupper (*s) || islower (*s) || (*s >= '0' && *s <= '3'); ++s)
+ for (s = str;
+ ISUPPER (*s) || ISLOWER (*s) || (*s >= '0' && *s <= '3');
+ ++s)
;
switch (*s)
@@ -4687,7 +4688,7 @@ pa_parse_number (s, is_float)
pa_number = -1;
have_prefix = 0;
num = 0;
- if (!strict && isdigit (*p))
+ if (!strict && ISDIGIT (*p))
{
/* Looks like a number. */
@@ -4695,10 +4696,10 @@ pa_parse_number (s, is_float)
{
/* The number is specified in hex. */
p += 2;
- while (isdigit (*p) || ((*p >= 'a') && (*p <= 'f'))
+ while (ISDIGIT (*p) || ((*p >= 'a') && (*p <= 'f'))
|| ((*p >= 'A') && (*p <= 'F')))
{
- if (isdigit (*p))
+ if (ISDIGIT (*p))
num = num * 16 + *p - '0';
else if (*p >= 'a' && *p <= 'f')
num = num * 16 + *p - 'a' + 10;
@@ -4710,7 +4711,7 @@ pa_parse_number (s, is_float)
else
{
/* The number is specified in decimal. */
- while (isdigit (*p))
+ while (ISDIGIT (*p))
{
num = num * 10 + *p - '0';
++p;
@@ -4762,7 +4763,7 @@ pa_parse_number (s, is_float)
num = 2;
p++;
}
- else if (!isdigit (*p))
+ else if (!ISDIGIT (*p))
{
if (print_errors)
as_bad (_("Undefined register: '%s'."), name);
@@ -4772,7 +4773,7 @@ pa_parse_number (s, is_float)
{
do
num = num * 10 + *p++ - '0';
- while (isdigit (*p));
+ while (ISDIGIT (*p));
}
}
else
@@ -5124,16 +5125,16 @@ pa_chk_field_selector (str)
*str = *str + 1;
if ((*str)[1] == '\'' || (*str)[1] == '%')
- name[0] = tolower ((*str)[0]),
+ name[0] = TOLOWER ((*str)[0]),
name[1] = 0;
else if ((*str)[2] == '\'' || (*str)[2] == '%')
- name[0] = tolower ((*str)[0]),
- name[1] = tolower ((*str)[1]),
+ name[0] = TOLOWER ((*str)[0]),
+ name[1] = TOLOWER ((*str)[1]),
name[2] = 0;
else if ((*str)[3] == '\'' || (*str)[3] == '%')
- name[0] = tolower ((*str)[0]),
- name[1] = tolower ((*str)[1]),
- name[2] = tolower ((*str)[2]),
+ name[0] = TOLOWER ((*str)[0]),
+ name[1] = TOLOWER ((*str)[1]),
+ name[2] = TOLOWER ((*str)[2]),
name[3] = 0;
else
return e_fsel;
@@ -8196,11 +8197,11 @@ pa_stringer (append_zero)
s++;
for (num_digit = 0, number = 0, dg = *s;
num_digit < 2
- && (isdigit (dg) || (dg >= 'a' && dg <= 'f')
+ && (ISDIGIT (dg) || (dg >= 'a' && dg <= 'f')
|| (dg >= 'A' && dg <= 'F'));
num_digit++)
{
- if (isdigit (dg))
+ if (ISDIGIT (dg))
number = number * 16 + dg - '0';
else if (dg >= 'a' && dg <= 'f')
number = number * 16 + dg - 'a' + 10;
diff --git a/gas/config/tc-i370.c b/gas/config/tc-i370.c
index 75a5792..9ea4c3a 100644
--- a/gas/config/tc-i370.c
+++ b/gas/config/tc-i370.c
@@ -29,8 +29,8 @@
*/
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
+#include "c=ctype.h"
#include "subsegs.h"
#include "struc-symbol.h"
@@ -334,7 +334,7 @@ register_name (expressionP)
/* Find the spelling of the operand. */
start = name = input_line_pointer;
- if (name[0] == '%' && isalpha (name[1]))
+ if (name[0] == '%' && ISALPHA (name[1]))
name = ++input_line_pointer;
else if (!reg_names_p)
@@ -345,7 +345,7 @@ register_name (expressionP)
/* If it's a number, treat it as a number. If it's alpha, look to
see if it's in the register table. */
- if (!isalpha (name[0]))
+ if (!ISALPHA (name[0]))
{
reg_number = get_single_number ();
}
@@ -702,10 +702,10 @@ i370_elf_suffix (str_p, exp_p)
for (ch = *str, str2 = ident;
(str2 < ident + sizeof (ident) - 1
- && (isalnum (ch) || ch == '@'));
+ && (ISALNUM (ch) || ch == '@'));
ch = *++str)
{
- *str2++ = (islower (ch)) ? ch : tolower (ch);
+ *str2++ = TOLOWER (ch);
}
*str2 = '\0';
@@ -1489,11 +1489,11 @@ i370_addr_offset (expressionS *exx)
lab = input_line_pointer;
while (*lab && (',' != *lab) && ('(' != *lab))
{
- if (isdigit (*lab))
+ if (ISDIGIT (*lab))
{
all_digits = 1;
}
- else if (isalpha (*lab))
+ else if (ISALPHA (*lab))
{
if (!all_digits)
{
@@ -1562,7 +1562,7 @@ i370_addr_cons (expressionS *exp)
name = input_line_pointer;
sym_name = input_line_pointer;
/* Find the spelling of the operand */
- if (name[0] == '=' && isalpha (name[1]))
+ if (name[0] == '=' && ISALPHA (name[1]))
{
name = ++input_line_pointer;
}
@@ -1652,7 +1652,7 @@ i370_addr_cons (expressionS *exp)
save = input_line_pointer;
while (*save)
{
- if (isxdigit (*save))
+ if (ISXDIGIT (*save))
hex_len++;
save++;
}
@@ -1979,7 +1979,7 @@ md_assemble (str)
#endif
/* Get the opcode. */
- for (s = str; *s != '\0' && ! isspace (*s); s++)
+ for (s = str; *s != '\0' && ! ISSPACE (*s); s++)
;
if (*s != '\0')
*s++ = '\0';
@@ -2004,7 +2004,7 @@ md_assemble (str)
insn = opcode->opcode;
str = s;
- while (isspace (*str))
+ while (ISSPACE (*str))
++str;
/* I370 operands are either expressions or address constants.
@@ -2289,7 +2289,7 @@ md_assemble (str)
++str;
}
- while (isspace (*str))
+ while (ISSPACE (*str))
++str;
if (*str != '\0')
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 739ed58..749d7c4 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -26,9 +26,8 @@
Bugs & suggestions are completely welcome. This is free software.
Please help us make it better. */
-#include <ctype.h>
-
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "dwarf2dbg.h"
#include "opcode/i386.h"
@@ -891,27 +890,27 @@ md_begin ()
for (c = 0; c < 256; c++)
{
- if (isdigit (c))
+ if (ISDIGIT (c))
{
digit_chars[c] = c;
mnemonic_chars[c] = c;
register_chars[c] = c;
operand_chars[c] = c;
}
- else if (islower (c))
+ else if (ISLOWER (c))
{
mnemonic_chars[c] = c;
register_chars[c] = c;
operand_chars[c] = c;
}
- else if (isupper (c))
+ else if (ISUPPER (c))
{
- mnemonic_chars[c] = tolower (c);
+ mnemonic_chars[c] = TOLOWER (c);
register_chars[c] = mnemonic_chars[c];
operand_chars[c] = c;
}
- if (isalpha (c) || isdigit (c))
+ if (ISALPHA (c) || ISDIGIT (c))
identifier_chars[c] = c;
else if (c >= 128)
{
@@ -4461,7 +4460,7 @@ static char *
output_invalid (c)
int c;
{
- if (isprint (c))
+ if (ISPRINT (c))
sprintf (output_invalid_buf, "'%c'", c);
else
sprintf (output_invalid_buf, "(0x%x)", (unsigned) c);
diff --git a/gas/config/tc-i860.c b/gas/config/tc-i860.c
index 5a48115..5f29b20 100644
--- a/gas/config/tc-i860.c
+++ b/gas/config/tc-i860.c
@@ -1,5 +1,5 @@
/* tc-i860.c -- Assembler for the Intel i860 architecture.
- Copyright 1989, 1992, 1993, 1994, 1995, 1998, 1999, 2000
+ Copyright 1989, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
Brought back from the dead and completely reworked
@@ -21,10 +21,10 @@
with GAS; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "opcode/i860.h"
#include "elf/i860.h"
@@ -409,7 +409,7 @@ i860_process_insn (str)
opcode = 0;
#endif
- for (s = str; islower (*s) || *s == '.' || *s == '3'
+ for (s = str; ISLOWER (*s) || *s == '.' || *s == '3'
|| *s == '2' || *s == '1'; ++s)
;
@@ -485,9 +485,9 @@ i860_process_insn (str)
/* Must be at least one digit. */
case '#':
- if (isdigit (*s++))
+ if (ISDIGIT (*s++))
{
- while (isdigit (*s))
+ while (ISDIGIT (*s))
++s;
continue;
}
@@ -528,11 +528,11 @@ i860_process_insn (str)
/* Any register r0..r31. */
case 'r':
s++;
- if (!isdigit (c = *s++))
+ if (!ISDIGIT (c = *s++))
{
goto error;
}
- if (isdigit (*s))
+ if (ISDIGIT (*s))
{
if ((c = 10 * (c - '0') + (*s++ - '0')) >= 32)
goto error;
@@ -575,10 +575,10 @@ i860_process_insn (str)
else
s++;
- if (*s++ == 'f' && isdigit (*s))
+ if (*s++ == 'f' && ISDIGIT (*s))
{
mask = *s++;
- if (isdigit (*s))
+ if (ISDIGIT (*s))
{
mask = 10 * (mask - '0') + (*s++ - '0');
if (mask >= 32)
diff --git a/gas/config/tc-i960.c b/gas/config/tc-i960.c
index 66ec025..279c214 100644
--- a/gas/config/tc-i960.c
+++ b/gas/config/tc-i960.c
@@ -64,10 +64,10 @@
a relocation directive. */
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "obstack.h"
#include "opcode/i960.h"
@@ -1389,8 +1389,8 @@ get_args (p, args)
{
if (*p == ' '
- && (! isalnum ((unsigned char) p[1])
- || ! isalnum ((unsigned char) p[-1])))
+ && (! ISALNUM (p[1])
+ || ! ISALNUM (p[-1])))
{
p++;
diff --git a/gas/config/tc-ia64.c b/gas/config/tc-ia64.c
index c7b0ec9..6930d6f 100644
--- a/gas/config/tc-ia64.c
+++ b/gas/config/tc-ia64.c
@@ -43,6 +43,7 @@
*/
#include "as.h"
+#include "safe-ctype.h"
#include "dwarf2dbg.h"
#include "subsegs.h"
@@ -4514,7 +4515,7 @@ dot_pred_rel (type)
valueT bit = 1;
int regno;
- if (toupper (*input_line_pointer) != 'P'
+ if (TOUPPER (*input_line_pointer) != 'P'
|| (regno = atoi (++input_line_pointer)) < 0
|| regno > 63)
{
@@ -4522,7 +4523,7 @@ dot_pred_rel (type)
ignore_rest_of_line ();
return;
}
- while (isdigit (*input_line_pointer))
+ while (ISDIGIT (*input_line_pointer))
++input_line_pointer;
if (p1 == -1)
p1 = regno;
@@ -4539,7 +4540,7 @@ dot_pred_rel (type)
valueT stop = 1;
++input_line_pointer;
- if (toupper (*input_line_pointer) != 'P'
+ if (TOUPPER (*input_line_pointer) != 'P'
|| (regno = atoi (++input_line_pointer)) < 0
|| regno > 63)
{
@@ -4547,7 +4548,7 @@ dot_pred_rel (type)
ignore_rest_of_line ();
return;
}
- while (isdigit (*input_line_pointer))
+ while (ISDIGIT (*input_line_pointer))
++input_line_pointer;
stop <<= regno;
if (bit >= stop)
@@ -6779,10 +6780,10 @@ ia64_unrecognized_line (ch)
c = get_symbol_end ();
}
else if (LOCAL_LABELS_FB
- && isdigit ((unsigned char) *input_line_pointer))
+ && ISDIGIT (*input_line_pointer))
{
temp = 0;
- while (isdigit ((unsigned char) *input_line_pointer))
+ while (ISDIGIT (*input_line_pointer))
temp = (temp * 10) + *input_line_pointer++ - '0';
fb_label_instance_inc (temp);
s = fb_label_name (temp, 0);
@@ -6955,7 +6956,7 @@ ia64_parse_name (name, e)
switch (name[0])
{
case 'i':
- if (name[1] == 'n' && isdigit (name[2]))
+ if (name[1] == 'n' && ISDIGIT (name[2]))
{
dr = &md.in;
name += 2;
@@ -6963,7 +6964,7 @@ ia64_parse_name (name, e)
break;
case 'l':
- if (name[1] == 'o' && name[2] == 'c' && isdigit (name[3]))
+ if (name[1] == 'o' && name[2] == 'c' && ISDIGIT (name[3]))
{
dr = &md.loc;
name += 3;
@@ -6971,7 +6972,7 @@ ia64_parse_name (name, e)
break;
case 'o':
- if (name[1] == 'u' && name[2] == 't' && isdigit (name[3]))
+ if (name[1] == 'u' && name[2] == 't' && ISDIGIT (name[3]))
{
dr = &md.out;
name += 3;
diff --git a/gas/config/tc-m32r.c b/gas/config/tc-m32r.c
index af53e6e..6ee3a2e 100644
--- a/gas/config/tc-m32r.c
+++ b/gas/config/tc-m32r.c
@@ -20,8 +20,8 @@
Boston, MA 02111-1307, USA. */
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "symcat.h"
#include "opcodes/m32r-desc.h"
@@ -819,15 +819,14 @@ assemble_two_insns (str, str2, parallel_p)
{
char *s2 = str;
- while (isspace (*s2++))
+ while (ISSPACE (*s2++))
continue;
--s2;
- while (isalnum (*s2))
+ while (ISALNUM (*s2))
{
- if (isupper ((unsigned char) *s2))
- *s2 = tolower (*s2);
+ *s2 = TOLOWER (*s2);
s2++;
}
}
diff --git a/gas/config/tc-m68hc11.c b/gas/config/tc-m68hc11.c
index 2c2b80c..7ac37c2 100644
--- a/gas/config/tc-m68hc11.c
+++ b/gas/config/tc-m68hc11.c
@@ -20,8 +20,8 @@
Boston, MA 02111-1307, USA. */
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "opcode/m68hc11.h"
#include "dwarf2dbg.h"
@@ -2234,7 +2234,7 @@ md_assemble (str)
*op_end && nlen < 20 && !is_end_of_line[*op_end] && *op_end != ' ';
op_end++)
{
- name[nlen] = tolower (op_start[nlen]);
+ name[nlen] = TOLOWER (op_start[nlen]);
nlen++;
}
name[nlen] = 0;
@@ -2276,14 +2276,14 @@ md_assemble (str)
&& (*op_end &&
(is_end_of_line[op_end[1]]
|| op_end[1] == ' ' || op_end[1] == '\t'
- || !isalnum (op_end[1])))
+ || !ISALNUM (op_end[1])))
&& (*op_end == 'a' || *op_end == 'b'
|| *op_end == 'A' || *op_end == 'B'
|| *op_end == 'd' || *op_end == 'D'
|| *op_end == 'x' || *op_end == 'X'
|| *op_end == 'y' || *op_end == 'Y'))
{
- name[nlen++] = tolower (*op_end++);
+ name[nlen++] = TOLOWER (*op_end++);
name[nlen] = 0;
opc = (struct m68hc11_opcode_def *) hash_find (m68hc11_hash,
name);
diff --git a/gas/config/tc-m68k.c b/gas/config/tc-m68k.c
index 9f6b500..c04eb6e 100644
--- a/gas/config/tc-m68k.c
+++ b/gas/config/tc-m68k.c
@@ -20,8 +20,8 @@
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "obstack.h"
#include "subsegs.h"
#include "dwarf2dbg.h"
@@ -648,8 +648,6 @@ CONST pseudo_typeS mote_pseudo_table[] =
extern char *input_line_pointer;
-static char mklower_table[256];
-#define mklower(c) (mklower_table[(unsigned char) (c)])
static char notend_table[256];
static char alt_notend_table[256];
#define notend(s) \
@@ -3311,7 +3309,7 @@ insert_reg (regname, regnum)
&zero_address_frag));
for (i = 0; regname[i]; i++)
- buf[i] = islower (regname[i]) ? toupper (regname[i]) : regname[i];
+ buf[i] = TOUPPER (regname[i]);
buf[i] = '\0';
symbol_table_insert (symbol_new (buf, 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++)
{
notend_table[i] = 0;
@@ -5370,7 +5365,7 @@ s_reg (ignore)
SKIP_WHITESPACE ();
s = input_line_pointer;
- while (isalnum ((unsigned char) *input_line_pointer)
+ while (ISALNUM (*input_line_pointer)
#ifdef REGISTER_PREFIX
|| *input_line_pointer == REGISTER_PREFIX
#endif
@@ -5582,10 +5577,7 @@ mri_assemble (str)
/* md_assemble expects the opcode to be in lower case. */
for (s = str; *s != ' ' && *s != '\0'; s++)
- {
- if (isupper ((unsigned char) *s))
- *s = tolower ((unsigned char) *s);
- }
+ *s = TOLOWER (*s);
md_assemble (str);
}
@@ -5667,10 +5659,8 @@ parse_mri_condition (pcc)
++input_line_pointer;
SKIP_WHITESPACE ();
- if (isupper (c1))
- c1 = tolower (c1);
- if (isupper (c2))
- c2 = tolower (c2);
+ c1 = TOLOWER (c1);
+ c2 = TOLOWER (c2);
*pcc = (c1 << 8) | c2;
@@ -5912,7 +5902,7 @@ build_mri_control_operand (qual, cc, leftstart, leftstop, rightstart,
*s++ = 'm';
*s++ = 'p';
if (qual != '\0')
- *s++ = tolower (qual);
+ *s++ = TOLOWER (qual);
*s++ = ' ';
memcpy (s, leftstart, leftstop - leftstart);
s += leftstop - leftstart;
@@ -5930,7 +5920,7 @@ build_mri_control_operand (qual, cc, leftstart, leftstop, rightstart,
*s++ = cc >> 8;
*s++ = cc & 0xff;
if (extent != '\0')
- *s++ = tolower (extent);
+ *s++ = TOLOWER (extent);
*s++ = ' ';
strcpy (s, truelab);
mri_assemble (buf);
@@ -6180,7 +6170,7 @@ s_mri_else (qual)
mri_control_stack->else_seen = 1;
buf = (char *) xmalloc (20 + strlen (mri_control_stack->bottom));
- q[0] = tolower (qual);
+ q[0] = TOLOWER (qual);
q[1] = '\0';
sprintf (buf, "bra%s %s", q, mri_control_stack->bottom);
mri_assemble (buf);
@@ -6253,7 +6243,7 @@ s_mri_break (extent)
}
buf = (char *) xmalloc (20 + strlen (n->bottom));
- ex[0] = tolower (extent);
+ ex[0] = TOLOWER (extent);
ex[1] = '\0';
sprintf (buf, "bra%s %s", ex, n->bottom);
mri_assemble (buf);
@@ -6292,7 +6282,7 @@ s_mri_next (extent)
}
buf = (char *) xmalloc (20 + strlen (n->next));
- ex[0] = tolower (extent);
+ ex[0] = TOLOWER (extent);
ex[1] = '\0';
sprintf (buf, "bra%s %s", ex, n->next);
mri_assemble (buf);
@@ -6476,7 +6466,7 @@ s_mri_for (qual)
*s++ = 'v';
*s++ = 'e';
if (qual != '\0')
- *s++ = tolower (qual);
+ *s++ = TOLOWER (qual);
*s++ = ' ';
memcpy (s, initstart, initstop - initstart);
s += initstop - initstart;
@@ -6494,7 +6484,7 @@ s_mri_for (qual)
*s++ = 'm';
*s++ = 'p';
if (qual != '\0')
- *s++ = tolower (qual);
+ *s++ = TOLOWER (qual);
*s++ = ' ';
memcpy (s, endstart, endstop - endstart);
s += endstop - endstart;
@@ -6505,7 +6495,7 @@ s_mri_for (qual)
mri_assemble (buf);
/* bcc bottom */
- ex[0] = tolower (extent);
+ ex[0] = TOLOWER (extent);
ex[1] = '\0';
if (up)
sprintf (buf, "blt%s %s", ex, n->bottom);
@@ -6521,7 +6511,7 @@ s_mri_for (qual)
strcpy (s, "sub");
s += 3;
if (qual != '\0')
- *s++ = tolower (qual);
+ *s++ = TOLOWER (qual);
*s++ = ' ';
memcpy (s, bystart, bystop - bystart);
s += bystop - bystart;
diff --git a/gas/config/tc-m88k.c b/gas/config/tc-m88k.c
index c12142e..bd3ddba 100644
--- a/gas/config/tc-m88k.c
+++ b/gas/config/tc-m88k.c
@@ -2,7 +2,7 @@
Contributed by Devon Bowen of Buffalo University
and Torbjorn Granlund of the Swedish Institute of Computer Science.
Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1999,
- 2000
+ 2000, 2001
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -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
02111-1307, USA. */
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "m88k-opcode.h"
@@ -239,7 +239,7 @@ md_assemble (op)
assert (op);
/* Skip over instruction to find parameters. */
- for (param = op; *param != 0 && !isspace (*param); param++)
+ for (param = op; *param != 0 && !ISSPACE (*param); param++)
;
c = *param;
*param++ = '\0';
@@ -517,17 +517,17 @@ get_imm16 (param, insn)
unsigned int val;
char *save_ptr;
- if (!strncmp (param, "hi16", 4) && !isalnum (param[4]))
+ if (!strncmp (param, "hi16", 4) && !ISALNUM (param[4]))
{
reloc = RELOC_HI16;
param += 4;
}
- else if (!strncmp (param, "lo16", 4) && !isalnum (param[4]))
+ else if (!strncmp (param, "lo16", 4) && !ISALNUM (param[4]))
{
reloc = RELOC_LO16;
param += 4;
}
- else if (!strncmp (param, "iw16", 4) && !isalnum (param[4]))
+ else if (!strncmp (param, "iw16", 4) && !ISALNUM (param[4]))
{
reloc = RELOC_IW16;
param += 4;
@@ -630,7 +630,7 @@ get_cnd (param, valp)
{
unsigned int val;
- if (isdigit (*param))
+ if (ISDIGIT (*param))
{
param = getval (param, &val);
@@ -642,11 +642,8 @@ get_cnd (param, valp)
}
else
{
- if (isupper (*param))
- *param = tolower (*param);
-
- if (isupper (param[1]))
- param[1] = tolower (param[1]);
+ param[0] = TOLOWER (param[0]);
+ param[1] = TOLOWER (param[1]);
param = match_name (param, cndmsk, valp);
@@ -690,12 +687,10 @@ get_bf_offset_expression (param, offsetp)
{
unsigned offset;
- if (isalpha (param[0]))
+ if (ISALPHA (param[0]))
{
- if (isupper (param[0]))
- param[0] = tolower (param[0]);
- if (isupper (param[1]))
- param[1] = tolower (param[1]);
+ param[0] = TOLOWER (param[0]);
+ param[1] = TOLOWER (param[1]);
param = match_name (param, cmpslot, offsetp);
@@ -888,9 +883,9 @@ get_o6 (param, valp)
}
#define hexval(z) \
- (isdigit (z) ? (z) - '0' : \
- islower (z) ? (z) - 'a' + 10 : \
- isupper (z) ? (z) - 'A' + 10 : -1)
+ (ISDIGIT (z) ? (z) - '0' : \
+ ISLOWER (z) ? (z) - 'a' + 10 : \
+ ISUPPER (z) ? (z) - 'A' + 10 : -1)
static char *
getval (param, valp)
diff --git a/gas/config/tc-mcore.c b/gas/config/tc-mcore.c
index 0af3dc1..7a8a5f4 100644
--- a/gas/config/tc-mcore.c
+++ b/gas/config/tc-mcore.c
@@ -24,7 +24,7 @@
#include "subsegs.h"
#define DEFINE_TABLE
#include "../opcodes/mcore-opc.h"
-#include <ctype.h>
+#include "safe-ctype.h"
#include <string.h>
#ifdef OBJ_ELF
@@ -390,11 +390,11 @@ mcore_s_section (ignore)
pool. */
char * ilp = input_line_pointer;
- while (*ilp != 0 && isspace(*ilp))
+ while (*ilp != 0 && ISSPACE (*ilp))
++ ilp;
if (strncmp (ilp, ".line", 5) == 0
- && (isspace (ilp[5]) || *ilp == '\n' || *ilp == '\r'))
+ && (ISSPACE (ilp[5]) || *ilp == '\n' || *ilp == '\r'))
;
else
dump_literals (0);
@@ -480,10 +480,10 @@ parse_reg (s, reg)
unsigned * reg;
{
/* Strip leading whitespace. */
- while (isspace (* s))
+ while (ISSPACE (* s))
++ s;
- if (tolower (s[0]) == 'r')
+ if (TOLOWER (s[0]) == 'r')
{
if (s[1] == '1' && s[2] >= '0' && s[2] <= '5')
{
@@ -497,9 +497,9 @@ parse_reg (s, reg)
return s + 2;
}
}
- else if ( tolower (s[0]) == 's'
- && tolower (s[1]) == 'p'
- && ! isalnum (s[2]))
+ else if ( TOLOWER (s[0]) == 's'
+ && TOLOWER (s[1]) == 'p'
+ && ! ISALNUM (s[2]))
{
* reg = 0;
return s + 2;
@@ -540,10 +540,10 @@ parse_creg (s, reg)
int i;
/* Strip leading whitespace. */
- while (isspace (* s))
+ while (ISSPACE (* s))
++s;
- if ((tolower (s[0]) == 'c' && tolower (s[1]) == 'r'))
+ if ((TOLOWER (s[0]) == 'c' && TOLOWER (s[1]) == 'r'))
{
if (s[2] == '3' && s[3] >= '0' && s[3] <= '1')
{
@@ -580,7 +580,7 @@ parse_creg (s, reg)
length = strlen (cregs[i].name);
for (j = 0; j < length; j++)
- buf[j] = tolower (s[j]);
+ buf[j] = TOLOWER (s[j]);
if (strncmp (cregs[i].name, buf, length) == 0)
{
@@ -615,7 +615,7 @@ parse_psrmod (s, reg)
};
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--;)
{
@@ -643,7 +643,7 @@ parse_exp (s, e)
char * new;
/* Skip whitespace. */
- while (isspace (* s))
+ while (ISSPACE (* s))
++ s;
save = input_line_pointer;
@@ -903,14 +903,14 @@ parse_mem (s, reg, off, siz)
* off = 0;
- while (isspace (* s))
+ while (ISSPACE (* s))
++ s;
if (* s == '(')
{
s = parse_reg (s + 1, reg);
- while (isspace (* s))
+ while (ISSPACE (* s))
++ s;
if (* s == ',')
@@ -936,7 +936,7 @@ parse_mem (s, reg, off, siz)
}
}
- while (isspace (* s))
+ while (ISSPACE (* s))
++ s;
if (* s == ')')
@@ -969,7 +969,7 @@ md_assemble (str)
char name[20];
/* Drop leading whitespace. */
- while (isspace (* str))
+ while (ISSPACE (* str))
str ++;
/* Find the op code end. */
@@ -1068,7 +1068,7 @@ md_assemble (str)
inst |= reg;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (*op_end == ',')
@@ -1092,7 +1092,7 @@ md_assemble (str)
inst |= reg;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
@@ -1110,7 +1110,7 @@ md_assemble (str)
op_end = parse_reg (op_end + 1, & reg);
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',') /* xtrb- r1,rx */
@@ -1130,7 +1130,7 @@ md_assemble (str)
inst |= reg;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
@@ -1150,7 +1150,7 @@ md_assemble (str)
inst |= reg;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
@@ -1169,7 +1169,7 @@ md_assemble (str)
inst |= reg;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
@@ -1188,7 +1188,7 @@ md_assemble (str)
inst |= reg;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
@@ -1217,7 +1217,7 @@ md_assemble (str)
inst |= reg;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
@@ -1244,7 +1244,7 @@ md_assemble (str)
inst |= reg;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
@@ -1283,7 +1283,7 @@ md_assemble (str)
inst |= reg;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
@@ -1316,7 +1316,7 @@ md_assemble (str)
inst |= reg;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
@@ -1335,7 +1335,7 @@ md_assemble (str)
inst |= reg;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
@@ -1354,7 +1354,7 @@ md_assemble (str)
inst |= reg << 8;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
@@ -1390,7 +1390,7 @@ md_assemble (str)
inst |= (reg << 8);
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
@@ -1421,7 +1421,7 @@ md_assemble (str)
inst |= reg;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == '-')
@@ -1432,7 +1432,7 @@ md_assemble (str)
as_bad (_("ending register must be r15"));
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
}
@@ -1441,7 +1441,7 @@ md_assemble (str)
op_end ++;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == '(')
@@ -1470,7 +1470,7 @@ md_assemble (str)
as_fatal (_("first register must be r4"));
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == '-')
@@ -1481,7 +1481,7 @@ md_assemble (str)
as_fatal (_("last register must be r7"));
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
@@ -1489,7 +1489,7 @@ md_assemble (str)
op_end ++;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == '(')
@@ -1502,7 +1502,7 @@ md_assemble (str)
inst |= reg;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ')')
@@ -1535,7 +1535,7 @@ md_assemble (str)
inst |= reg << 4;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
@@ -1595,7 +1595,7 @@ md_assemble (str)
inst |= reg;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
@@ -1617,7 +1617,7 @@ md_assemble (str)
inst |= reg << 4;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
@@ -1638,7 +1638,7 @@ md_assemble (str)
inst |= reg;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
@@ -1690,7 +1690,7 @@ md_assemble (str)
}
/* Drop whitespace after all the operands have been parsed. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
op_end ++;
/* Give warning message if the insn has more operands than required. */
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index 92cac7e..8babf77 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -26,8 +26,7 @@
#include "as.h"
#include "config.h"
#include "subsegs.h"
-
-#include <ctype.h>
+#include "safe-ctype.h"
#ifdef USE_STDARG
#include <stdarg.h>
@@ -6946,13 +6945,13 @@ mips_ip (str, ip)
/* If the instruction contains a '.', we first try to match an instruction
including the '.'. Then we try again without the '.'. */
insn = NULL;
- for (s = str; *s != '\0' && !isspace ((unsigned char) *s); ++s)
+ for (s = str; *s != '\0' && !ISSPACE (*s); ++s)
continue;
/* If we stopped on whitespace, then replace the whitespace with null for
the call to hash_find. Save the character we replaced just in case we
have to re-parse the instruction. */
- if (isspace ((unsigned char) *s))
+ if (ISSPACE (*s))
{
save_c = *s;
*s++ = '\0';
@@ -6970,7 +6969,9 @@ mips_ip (str, ip)
*(--s) = save_c;
/* Scan up to the first '.' or whitespace. */
- for (s = str; *s != '\0' && *s != '.' && !isspace ((unsigned char) *s); ++s)
+ for (s = str;
+ *s != '\0' && *s != '.' && !ISSPACE (*s);
+ ++s)
continue;
/* If we did not find a '.', then we can quit now. */
@@ -7234,7 +7235,7 @@ mips_ip (str, ip)
if (s[0] == '$')
{
- if (isdigit ((unsigned char) s[1]))
+ if (ISDIGIT (s[1]))
{
++s;
regno = 0;
@@ -7244,7 +7245,7 @@ mips_ip (str, ip)
regno += *s - '0';
++s;
}
- while (isdigit ((unsigned char) *s));
+ while (ISDIGIT (*s));
if (regno > 31)
as_bad (_("Invalid register number (%d)"), regno);
}
@@ -7397,7 +7398,8 @@ mips_ip (str, ip)
case 'V':
case 'W':
s_reset = s;
- if (s[0] == '$' && s[1] == 'f' && isdigit ((unsigned char) s[2]))
+ if (s[0] == '$' && s[1] == 'f'
+ && ISDIGIT (s[2]))
{
s += 2;
regno = 0;
@@ -7407,7 +7409,7 @@ mips_ip (str, ip)
regno += *s - '0';
++s;
}
- while (isdigit ((unsigned char) *s));
+ while (ISDIGIT (*s));
if (regno > 31)
as_bad (_("Invalid float register number (%d)"), regno);
@@ -7860,7 +7862,7 @@ mips_ip (str, ip)
regno += *s - '0';
++s;
}
- while (isdigit ((unsigned char) *s));
+ while (ISDIGIT (*s));
if (regno > 7)
as_bad (_("invalid condition code register $fcc%d"), regno);
if (*args == 'N')
@@ -7872,7 +7874,7 @@ mips_ip (str, ip)
case 'H':
if (s[0] == '0' && (s[1] == 'x' || s[1] == 'X'))
s += 2;
- if (isdigit ((unsigned char) *s))
+ if (ISDIGIT (*s))
{
c = 0;
do
@@ -7881,7 +7883,7 @@ mips_ip (str, ip)
c += *s - '0';
++s;
}
- while (isdigit ((unsigned char) *s));
+ while (ISDIGIT (*s));
}
else
c = 8; /* Invalid sel value. */
@@ -7938,7 +7940,7 @@ mips16_ip (str, ip)
mips16_small = false;
mips16_ext = false;
- for (s = str; islower ((unsigned char) *s); ++s)
+ for (s = str; ISLOWER (*s); ++s)
;
switch (*s)
{
@@ -8071,7 +8073,7 @@ mips16_ip (str, ip)
if (s[0] != '$')
break;
s_reset = s;
- if (isdigit ((unsigned char) s[1]))
+ if (ISDIGIT (s[1]))
{
++s;
regno = 0;
@@ -8081,7 +8083,7 @@ mips16_ip (str, ip)
regno += *s - '0';
++s;
}
- while (isdigit ((unsigned char) *s));
+ while (ISDIGIT (*s));
if (regno > 31)
{
as_bad (_("invalid register number (%d)"), regno);
@@ -8352,7 +8354,7 @@ mips16_ip (str, ip)
++s;
}
reg1 = 0;
- while (isdigit ((unsigned char) *s))
+ while (ISDIGIT (*s))
{
reg1 *= 10;
reg1 += *s - '0';
@@ -8379,7 +8381,7 @@ mips16_ip (str, ip)
}
}
reg2 = 0;
- while (isdigit ((unsigned char) *s))
+ while (ISDIGIT (*s))
{
reg2 *= 10;
reg2 += *s - '0';
@@ -8641,41 +8643,41 @@ my_getSmallExpression (ep, str)
if (*str == '(')
c = S_EX_NONE;
else if (str[0] == '%'
- && tolower(str[1]) == 'l'
- && tolower(str[2]) == 'o'
+ && TOLOWER (str[1]) == 'l'
+ && TOLOWER (str[2]) == 'o'
&& str[3] == '(')
{
c = S_EX_LO;
str += sizeof ("%lo(") - 2;
}
else if (str[0] == '%'
- && tolower(str[1]) == 'h'
- && tolower(str[2]) == 'i'
+ && TOLOWER (str[1]) == 'h'
+ && TOLOWER (str[2]) == 'i'
&& str[3] == '(')
{
c = S_EX_HI;
str += sizeof ("%hi(") - 2;
}
else if (str[0] == '%'
- && tolower(str[1]) == 'h'
- && tolower(str[2]) == 'i'
- && tolower(str[3]) == 'g'
- && tolower(str[4]) == 'h'
- && tolower(str[5]) == 'e'
- && tolower(str[6]) == 'r'
+ && TOLOWER (str[1]) == 'h'
+ && TOLOWER (str[2]) == 'i'
+ && TOLOWER (str[3]) == 'g'
+ && TOLOWER (str[4]) == 'h'
+ && TOLOWER (str[5]) == 'e'
+ && TOLOWER (str[6]) == 'r'
&& str[7] == '(')
{
c = S_EX_HIGHER;
str += sizeof ("%higher(") - 2;
}
else if (str[0] == '%'
- && tolower(str[1]) == 'h'
- && tolower(str[2]) == 'i'
- && tolower(str[3]) == 'g'
- && tolower(str[4]) == 'h'
- && tolower(str[5]) == 'e'
- && tolower(str[6]) == 's'
- && tolower(str[7]) == 't'
+ && TOLOWER (str[1]) == 'h'
+ && TOLOWER (str[2]) == 'i'
+ && TOLOWER (str[3]) == 'g'
+ && TOLOWER (str[4]) == 'h'
+ && TOLOWER (str[5]) == 'e'
+ && TOLOWER (str[6]) == 's'
+ && TOLOWER (str[7]) == 't'
&& str[8] == '(')
{
c = S_EX_HIGHEST;
@@ -8684,21 +8686,21 @@ my_getSmallExpression (ep, str)
/* currently unsupported */
#if 0
else if (str[0] == '%'
- && tolower(str[1]) == 'g'
- && tolower(str[2]) == 'p'
- && tolower(str[3]) == '_'
- && tolower(str[4]) == 'r'
- && tolower(str[5]) == 'e'
- && tolower(str[6]) == 'l'
+ && TOLOWER (str[1]) == 'g'
+ && TOLOWER (str[2]) == 'p'
+ && TOLOWER (str[3]) == '_'
+ && TOLOWER (str[4]) == 'r'
+ && TOLOWER (str[5]) == 'e'
+ && TOLOWER (str[6]) == 'l'
&& str[7] == '(')
{
c = S_EX_GPREL;
str += sizeof ("%gp_rel(") - 2;
}
else if (str[0] == '%'
- && tolower(str[1]) == 'n'
- && tolower(str[2]) == 'e'
- && tolower(str[3]) == 'g'
+ && TOLOWER (str[1]) == 'n'
+ && TOLOWER (str[2]) == 'e'
+ && TOLOWER (str[3]) == 'g'
&& str[4] == '(')
{
c = S_EX_NEG;
@@ -8721,9 +8723,9 @@ my_getSmallExpression (ep, str)
;
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] == '(')
{
@@ -10777,7 +10779,7 @@ tc_get_register (frame)
as_warn (_("expected `$'"));
reg = 0;
}
- else if (isdigit ((unsigned char) *input_line_pointer))
+ else if (ISDIGIT (*input_line_pointer))
{
reg = get_absolute_expression ();
if (reg < 0 || reg >= 32)
@@ -11796,14 +11798,14 @@ get_number ()
++input_line_pointer;
negative = 1;
}
- if (!isdigit ((unsigned char) *input_line_pointer))
+ if (!ISDIGIT (*input_line_pointer))
as_bad (_("Expected simple number."));
if (input_line_pointer[0] == '0')
{
if (input_line_pointer[1] == 'x')
{
input_line_pointer += 2;
- while (isxdigit ((unsigned char) *input_line_pointer))
+ while (ISXDIGIT (*input_line_pointer))
{
val <<= 4;
val |= hex_value (*input_line_pointer++);
@@ -11813,7 +11815,7 @@ get_number ()
else
{
++input_line_pointer;
- while (isdigit ((unsigned char) *input_line_pointer))
+ while (ISDIGIT (*input_line_pointer))
{
val <<= 3;
val |= *input_line_pointer++ - '0';
@@ -11821,14 +11823,14 @@ get_number ()
return negative ? -val : val;
}
}
- if (!isdigit ((unsigned char) *input_line_pointer))
+ if (!ISDIGIT (*input_line_pointer))
{
printf (_(" *input_line_pointer == '%c' 0x%02x\n"),
*input_line_pointer, *input_line_pointer);
as_warn (_("Invalid number"));
return -1;
}
- while (isdigit ((unsigned char) *input_line_pointer))
+ while (ISDIGIT (*input_line_pointer))
{
val *= 10;
val += *input_line_pointer++ - '0';
@@ -11951,7 +11953,7 @@ s_mips_ent (aent)
if (*input_line_pointer == ',')
input_line_pointer++;
SKIP_WHITESPACE ();
- if (isdigit ((unsigned char) *input_line_pointer)
+ if (ISDIGIT (*input_line_pointer)
|| *input_line_pointer == '-')
number = get_number ();
diff --git a/gas/config/tc-mn10200.c b/gas/config/tc-mn10200.c
index a6a46af..1ccc8e0 100644
--- a/gas/config/tc-mn10200.c
+++ b/gas/config/tc-mn10200.c
@@ -20,8 +20,8 @@
Boston, MA 02111-1307, USA. */
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "opcode/mn10200.h"
@@ -781,7 +781,7 @@ md_assemble (str)
int match;
/* Get the opcode. */
- for (s = str; *s != '\0' && !isspace (*s); s++)
+ for (s = str; *s != '\0' && !ISSPACE (*s); s++)
;
if (*s != '\0')
*s++ = '\0';
@@ -795,7 +795,7 @@ md_assemble (str)
}
str = s;
- while (isspace (*str))
+ while (ISSPACE (*str))
++str;
input_line_pointer = str;
@@ -1029,7 +1029,7 @@ keep_going:
break;
}
- while (isspace (*str))
+ while (ISSPACE (*str))
++str;
if (*str != '\0')
diff --git a/gas/config/tc-mn10300.c b/gas/config/tc-mn10300.c
index 725f4f2..6782240 100644
--- a/gas/config/tc-mn10300.c
+++ b/gas/config/tc-mn10300.c
@@ -20,8 +20,8 @@
Boston, MA 02111-1307, USA. */
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "opcode/mn10300.h"
#include "dwarf2dbg.h"
@@ -917,7 +917,7 @@ md_assemble (str)
int match;
/* Get the opcode. */
- for (s = str; *s != '\0' && !isspace (*s); s++)
+ for (s = str; *s != '\0' && !ISSPACE (*s); s++)
;
if (*s != '\0')
*s++ = '\0';
@@ -931,7 +931,7 @@ md_assemble (str)
}
str = s;
- while (isspace (*str))
+ while (ISSPACE (*str))
++str;
input_line_pointer = str;
@@ -1445,7 +1445,7 @@ keep_going:
break;
}
- while (isspace (*str))
+ while (ISSPACE (*str))
++str;
if (*str != '\0')
diff --git a/gas/config/tc-ns32k.c b/gas/config/tc-ns32k.c
index ca6cb8f..3aa890d 100644
--- a/gas/config/tc-ns32k.c
+++ b/gas/config/tc-ns32k.c
@@ -23,7 +23,6 @@
/*#define SHOW_NUM 1*//* Uncomment for debugging. */
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
#include "opcode/ns32k.h"
diff --git a/gas/config/tc-pdp11.c b/gas/config/tc-pdp11.c
index 3af7dc8..a38a0ea 100644
--- a/gas/config/tc-pdp11.c
+++ b/gas/config/tc-pdp11.c
@@ -26,6 +26,7 @@
*/
#include "as.h"
+#include "safe-ctype.h"
#include "opcode/pdp11.h"
static int set_option PARAMS ((char *arg));
@@ -252,19 +253,11 @@ find_whitespace (char *str)
return str;
}
-static char
-mklower (char c)
-{
- if (isupper (c))
- return tolower (c);
- return c;
-}
-
static char *
parse_reg (char *str, struct pdp11_code *operand)
{
str = skip_whitespace (str);
- if (mklower (*str) == 'r')
+ if (TOLOWER (*str) == 'r')
{
str++;
switch (*str)
diff --git a/gas/config/tc-pj.c b/gas/config/tc-pj.c
index fbd0eb6..7d5b835 100644
--- a/gas/config/tc-pj.c
+++ b/gas/config/tc-pj.c
@@ -1,6 +1,6 @@
/*-
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.
@@ -22,6 +22,7 @@
/* Contributed by Steve Chamberlain of Transmeta <sac@pobox.com>. */
#include "as.h"
+#include "safe-ctype.h"
#include "opcode/pj.h"
extern const pj_opc_info_t pj_opc_info[512];
@@ -312,7 +313,7 @@ md_assemble (str)
pending_reloc = 0;
}
- while (isspace (*op_end))
+ while (ISSPACE (*op_end))
op_end++;
if (*op_end != 0)
diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c
index f06bb58..945e6dc 100644
--- a/gas/config/tc-ppc.c
+++ b/gas/config/tc-ppc.c
@@ -21,8 +21,8 @@
02111-1307, USA. */
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "opcode/ppc.h"
@@ -618,10 +618,10 @@ register_name (expressionP)
/* Find the spelling of the operand. */
start = name = input_line_pointer;
- if (name[0] == '%' && isalpha (name[1]))
+ if (name[0] == '%' && ISALPHA (name[1]))
name = ++input_line_pointer;
- else if (!reg_names_p || !isalpha (name[0]))
+ else if (!reg_names_p || !ISALPHA (name[0]))
return false;
c = get_symbol_end ();
@@ -1383,10 +1383,10 @@ ppc_elf_suffix (str_p, exp_p)
for (ch = *str, str2 = ident;
(str2 < ident + sizeof (ident) - 1
- && (isalnum (ch) || ch == '@'));
+ && (ISALNUM (ch) || ch == '@'));
ch = *++str)
{
- *str2++ = (islower (ch)) ? ch : tolower (ch);
+ *str2++ = TOLOWER (ch);
}
*str2 = '\0';
@@ -1820,7 +1820,7 @@ md_assemble (str)
#endif
/* Get the opcode. */
- for (s = str; *s != '\0' && ! isspace (*s); s++)
+ for (s = str; *s != '\0' && ! ISSPACE (*s); s++)
;
if (*s != '\0')
*s++ = '\0';
@@ -1843,7 +1843,7 @@ md_assemble (str)
insn = opcode->opcode;
str = s;
- while (isspace (*str))
+ while (ISSPACE (*str))
++str;
/* PowerPC operands are just expressions. The only real issue is
@@ -2266,7 +2266,7 @@ md_assemble (str)
++str;
}
- while (isspace (*str))
+ while (ISSPACE (*str))
++str;
if (*str != '\0')
@@ -4267,8 +4267,7 @@ ppc_canonicalize_symbol_name (name)
}
for (s++; *s != '\0' && *s != brac; s++)
- if (islower (*s))
- *s = toupper (*s);
+ *s = TOUPPER (*s);
if (*s == '\0' || s[1] != '\0')
as_bad (_("bad symbol suffix"));
diff --git a/gas/config/tc-s390.c b/gas/config/tc-s390.c
index 6b93796..a84750b 100644
--- a/gas/config/tc-s390.c
+++ b/gas/config/tc-s390.c
@@ -20,8 +20,8 @@
02111-1307, USA. */
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "struc-symbol.h"
@@ -263,7 +263,7 @@ register_name (expressionP)
/* Find the spelling of the operand. */
start = name = input_line_pointer;
- if (name[0] == '%' && isalpha (name[1]))
+ if (name[0] == '%' && ISALPHA (name[1]))
name = ++input_line_pointer;
else
return false;
@@ -633,7 +633,7 @@ s390_elf_suffix (str_p, exp_p)
return ELF_SUFFIX_NONE;
ident = str;
- while (isalnum (*str))
+ while (ISALNUM (*str))
str++;
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". */
ident = str;
- while (isalnum (*str))
+ while (ISALNUM (*str))
str++;
len = str - ident;
if (len != 4 || strncasecmp (ident, "lit", 3) != 0 ||
@@ -1006,7 +1006,7 @@ md_gather_operands (str, insn, opcode)
char *f;
int fc, i;
- while (isspace(*str)) str++;
+ while (ISSPACE (*str)) str++;
parentheses = 0;
skip_optional = 0;
@@ -1193,7 +1193,7 @@ md_gather_operands (str, insn, opcode)
}
}
- while (isspace (*str))
+ while (ISSPACE (*str))
++str;
if (*str != '\0')
@@ -1267,7 +1267,7 @@ md_assemble (str)
char *s;
/* Get the opcode. */
- for (s = str; *s != '\0' && ! isspace (*s); s++)
+ for (s = str; *s != '\0' && ! ISSPACE (*s); s++)
;
if (*s != '\0')
*s++ = '\0';
@@ -1336,7 +1336,7 @@ s390_insn (ignore)
/* Get the opcode format. */
s = input_line_pointer;
- while (*s != '\0' && *s != ',' && ! isspace (*s))
+ while (*s != '\0' && *s != ',' && ! ISSPACE (*s))
s++;
if (*s != ',')
as_bad (_("Invalid .insn format\n"));
diff --git a/gas/config/tc-sh.c b/gas/config/tc-sh.c
index 9308959..b574e68 100644
--- a/gas/config/tc-sh.c
+++ b/gas/config/tc-sh.c
@@ -27,7 +27,7 @@
#include "subsegs.h"
#define DEFINE_TABLE
#include "opcodes/sh-opc.h"
-#include <ctype.h>
+#include "safe-ctype.h"
#include "struc-symbol.h"
#ifdef OBJ_ELF
@@ -282,11 +282,9 @@ sh_elf_suffix (str_p, exp_p, new_exp_p)
for (ch = *str, str2 = ident;
(str2 < ident + sizeof (ident) - 1
- && (isalnum (ch) || ch == '@'));
+ && (ISALNUM (ch) || ch == '@'));
ch = *++str)
- {
- *str2++ = (islower (ch)) ? ch : tolower (ch);
- }
+ *str2++ = TOLOWER (ch);
*str2 = '\0';
len = str2 - ident;
@@ -479,7 +477,7 @@ static int reg_x, reg_y;
static int reg_efg;
static int reg_b;
-#define IDENT_CHAR(c) (isalnum (c) || (c) == '_')
+#define IDENT_CHAR(c) (ISALNUM (c) || (c) == '_')
/* Try to parse a reg name. Return the number of chars consumed. */
@@ -489,8 +487,8 @@ parse_reg (src, mode, reg)
int *mode;
int *reg;
{
- char l0 = tolower (src[0]);
- char l1 = l0 ? tolower (src[1]) : 0;
+ char l0 = TOLOWER (src[0]);
+ char l1 = l0 ? TOLOWER (src[1]) : 0;
/* We use ! IDENT_CHAR for the next character after the register name, to
make sure that we won't accidentally recognize a symbol name such as
@@ -545,7 +543,7 @@ parse_reg (src, mode, reg)
*reg = A_A0_NUM;
return 2;
}
- if (tolower (src[2]) == 'g' && ! IDENT_CHAR ((unsigned char) src[3]))
+ if (TOLOWER (src[2]) == 'g' && ! IDENT_CHAR ((unsigned char) src[3]))
{
*mode = DSP_REG_N;
*reg = A_A0G_NUM;
@@ -560,7 +558,7 @@ parse_reg (src, mode, reg)
*reg = A_A1_NUM;
return 2;
}
- if (tolower (src[2]) == 'g' && ! IDENT_CHAR ((unsigned char) src[3]))
+ if (TOLOWER (src[2]) == 'g' && ! IDENT_CHAR ((unsigned char) src[3]))
{
*mode = DSP_REG_N;
*reg = A_A1G_NUM;
@@ -641,34 +639,34 @@ parse_reg (src, mode, reg)
if (l0 == 's'
&& l1 == 's'
- && tolower (src[2]) == 'r' && ! IDENT_CHAR ((unsigned char) src[3]))
+ && TOLOWER (src[2]) == 'r' && ! IDENT_CHAR ((unsigned char) src[3]))
{
*mode = A_SSR;
return 3;
}
- if (l0 == 's' && l1 == 'p' && tolower (src[2]) == 'c'
+ if (l0 == 's' && l1 == 'p' && TOLOWER (src[2]) == 'c'
&& ! IDENT_CHAR ((unsigned char) src[3]))
{
*mode = A_SPC;
return 3;
}
- if (l0 == 's' && l1 == 'g' && tolower (src[2]) == 'r'
+ if (l0 == 's' && l1 == 'g' && TOLOWER (src[2]) == 'r'
&& ! IDENT_CHAR ((unsigned char) src[3]))
{
*mode = A_SGR;
return 3;
}
- if (l0 == 'd' && l1 == 's' && tolower (src[2]) == 'r'
+ if (l0 == 'd' && l1 == 's' && TOLOWER (src[2]) == 'r'
&& ! IDENT_CHAR ((unsigned char) src[3]))
{
*mode = A_DSR;
return 3;
}
- if (l0 == 'd' && l1 == 'b' && tolower (src[2]) == 'r'
+ if (l0 == 'd' && l1 == 'b' && TOLOWER (src[2]) == 'r'
&& ! IDENT_CHAR ((unsigned char) src[3]))
{
*mode = A_DBR;
@@ -700,34 +698,34 @@ parse_reg (src, mode, reg)
*mode = A_PC;
return 2;
}
- if (l0 == 'g' && l1 == 'b' && tolower (src[2]) == 'r'
+ if (l0 == 'g' && l1 == 'b' && TOLOWER (src[2]) == 'r'
&& ! IDENT_CHAR ((unsigned char) src[3]))
{
*mode = A_GBR;
return 3;
}
- if (l0 == 'v' && l1 == 'b' && tolower (src[2]) == 'r'
+ if (l0 == 'v' && l1 == 'b' && TOLOWER (src[2]) == 'r'
&& ! IDENT_CHAR ((unsigned char) src[3]))
{
*mode = A_VBR;
return 3;
}
- if (l0 == 'm' && l1 == 'a' && tolower (src[2]) == 'c'
+ if (l0 == 'm' && l1 == 'a' && TOLOWER (src[2]) == 'c'
&& ! IDENT_CHAR ((unsigned char) src[4]))
{
- if (tolower (src[3]) == 'l')
+ if (TOLOWER (src[3]) == 'l')
{
*mode = A_MACL;
return 4;
}
- if (tolower (src[3]) == 'h')
+ if (TOLOWER (src[3]) == 'h')
{
*mode = A_MACH;
return 4;
}
}
- if (l0 == 'm' && l1 == 'o' && tolower (src[2]) == 'd'
+ if (l0 == 'm' && l1 == 'o' && TOLOWER (src[2]) == 'd'
&& ! IDENT_CHAR ((unsigned char) src[4]))
{
*mode = A_MOD;
@@ -809,25 +807,25 @@ parse_reg (src, mode, reg)
return 3;
}
}
- if (l0 == 'f' && l1 == 'p' && tolower (src[2]) == 'u'
- && tolower (src[3]) == 'l'
+ if (l0 == 'f' && l1 == 'p' && TOLOWER (src[2]) == 'u'
+ && TOLOWER (src[3]) == 'l'
&& ! IDENT_CHAR ((unsigned char) src[4]))
{
*mode = FPUL_N;
return 4;
}
- if (l0 == 'f' && l1 == 'p' && tolower (src[2]) == 's'
- && tolower (src[3]) == 'c'
- && tolower (src[4]) == 'r' && ! IDENT_CHAR ((unsigned char) src[5]))
+ if (l0 == 'f' && l1 == 'p' && TOLOWER (src[2]) == 's'
+ && TOLOWER (src[3]) == 'c'
+ && TOLOWER (src[4]) == 'r' && ! IDENT_CHAR ((unsigned char) src[5]))
{
*mode = FPSCR_N;
return 5;
}
- if (l0 == 'x' && l1 == 'm' && tolower (src[2]) == 't'
- && tolower (src[3]) == 'r'
- && tolower (src[4]) == 'x' && ! IDENT_CHAR ((unsigned char) src[5]))
+ if (l0 == 'x' && l1 == 'm' && TOLOWER (src[2]) == 't'
+ && TOLOWER (src[3]) == 'r'
+ && TOLOWER (src[4]) == 'x' && ! IDENT_CHAR ((unsigned char) src[5]))
{
*mode = XMTRX_M4;
return 5;
@@ -1637,9 +1635,9 @@ find_cooked_opcode (str_p)
/* The machine independent code will convert CMP/EQ into cmp/EQ
because it thinks the '/' is the end of the symbol. Moreover,
all but the first sub-insn is a parallel processing insn won't
- be capitailzed. Instead of hacking up the machine independent
+ be capitalized. Instead of hacking up the machine independent
code, we just deal with it here. */
- c = isupper (c) ? tolower (c) : c;
+ c = TOLOWER (c);
name[nlen] = c;
nlen++;
}
diff --git a/gas/config/tc-sparc.c b/gas/config/tc-sparc.c
index 33ea071..692a7fa 100644
--- a/gas/config/tc-sparc.c
+++ b/gas/config/tc-sparc.c
@@ -20,9 +20,9 @@
Boston, MA 02111-1307, USA. */
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "opcode/sparc.h"
@@ -1385,11 +1385,11 @@ sparc_ip (str, pinsn)
int special_case = SPECIAL_CASE_NONE;
s = str;
- if (islower ((unsigned char) *s))
+ if (ISLOWER (*s))
{
do
++s;
- while (islower ((unsigned char) *s) || isdigit ((unsigned char) *s));
+ while (ISLOWER (*s) || ISDIGIT (*s));
}
switch (*s)
@@ -1617,11 +1617,11 @@ sparc_ip (str, pinsn)
{
s += 4;
- if (isdigit ((unsigned char) *s))
+ if (ISDIGIT (*s))
{
long num = 0;
- while (isdigit ((unsigned char) *s))
+ while (ISDIGIT (*s))
{
num = num * 10 + *s - '0';
++s;
@@ -1825,9 +1825,9 @@ sparc_ip (str, pinsn)
break;
case '#': /* Must be at least one digit. */
- if (isdigit ((unsigned char) *s++))
+ if (ISDIGIT (*s++))
{
- while (isdigit ((unsigned char) *s))
+ while (ISDIGIT (*s))
{
++s;
}
@@ -1846,10 +1846,10 @@ sparc_ip (str, pinsn)
case 'b': /* Next operand is a coprocessor register. */
case 'c':
case 'D':
- if (*s++ == '%' && *s++ == 'c' && isdigit ((unsigned char) *s))
+ if (*s++ == '%' && *s++ == 'c' && ISDIGIT (*s))
{
mask = *s++;
- if (isdigit ((unsigned char) *s))
+ if (ISDIGIT (*s))
{
mask = 10 * (mask - '0') + (*s++ - '0');
if (mask >= 32)
@@ -1942,7 +1942,7 @@ sparc_ip (str, pinsn)
goto error;
case 'r': /* any register */
- if (!isdigit ((unsigned char) (c = *s++)))
+ if (!ISDIGIT ((c = *s++)))
{
goto error;
}
@@ -1957,7 +1957,7 @@ sparc_ip (str, pinsn)
case '7':
case '8':
case '9':
- if (isdigit ((unsigned char) *s))
+ if (ISDIGIT (*s))
{
if ((c = 10 * (c - '0') + (*s++ - '0')) >= 32)
{
@@ -2022,9 +2022,9 @@ sparc_ip (str, pinsn)
if (*s++ == '%'
&& ((format = *s) == 'f')
- && isdigit ((unsigned char) *++s))
+ && ISDIGIT (*++s))
{
- for (mask = 0; isdigit ((unsigned char) *s); ++s)
+ for (mask = 0; ISDIGIT (*s); ++s)
{
mask = 10 * mask + (*s - '0');
} /* read the number */
@@ -2240,7 +2240,7 @@ sparc_ip (str, pinsn)
for (s1 = s; *s1 && *s1 != ',' && *s1 != ']'; s1++)
;
- if (s1 != s && isdigit ((unsigned char) s1[-1]))
+ if (s1 != s && ISDIGIT (s1[-1]))
{
if (s1[-2] == '%' && s1[-3] == '+')
s1 -= 3;
@@ -2663,7 +2663,7 @@ parse_keyword_arg (lookup_fn, input_pointerP, valueP)
p = *input_pointerP;
for (q = p + (*p == '#' || *p == '%');
- isalnum ((unsigned char) *q) || *q == '_';
+ ISALNUM (*q) || *q == '_';
++q)
continue;
c = *q;
diff --git a/gas/config/tc-tahoe.c b/gas/config/tc-tahoe.c
index f4f781a..895c426 100644
--- a/gas/config/tc-tahoe.c
+++ b/gas/config/tc-tahoe.c
@@ -1,6 +1,6 @@
/* This file is tc-tahoe.c
- Copyright 1987, 1988, 1989, 1990, 1991, 1992, 1995, 2000
+ Copyright 1987, 1988, 1989, 1990, 1991, 1992, 1995, 2000, 2001
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -20,6 +20,7 @@
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
#include "as.h"
+#include "safe-ctype.h"
#include "obstack.h"
/* This bit glommed from tahoe-inst.h. */
@@ -885,11 +886,11 @@ tahoe_reg_parse (start)
R or r, and then a number. */
case 'R':
case 'r':
- if (isdigit (*regpoint))
+ if (ISDIGIT (*regpoint))
{
/* Got the first digit. */
regnum = *regpoint++ - '0';
- if ((regnum == 1) && isdigit (*regpoint))
+ if ((regnum == 1) && ISDIGIT (*regpoint))
{
/* Its a two digit number. */
regnum = 10 + (*regpoint++ - '0');
@@ -1064,7 +1065,7 @@ tip_op (optex, topP)
as_warn (_("Casting a branch displacement is bad form, and is ignored."));
else
{
- c = (isupper (*point) ? tolower (*point) : *point);
+ c = TOLOWER (*point);
call_width = ((c == 'b') ? 1 :
((c == 'w') ? 2 : 4));
}
diff --git a/gas/config/tc-tic30.c b/gas/config/tc-tic30.c
index 2190a85..21f2ad9 100644
--- a/gas/config/tc-tic30.c
+++ b/gas/config/tc-tic30.c
@@ -1,5 +1,5 @@
/* tc-c30.c -- Assembly code for the Texas Instruments TMS320C30
- Copyright 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
Contributed by Steven Haworth (steve@pm.cse.rmit.edu.au)
This file is part of GAS, the GNU Assembler.
@@ -25,6 +25,7 @@
Please help us make it better. */
#include "as.h"
+#include "safe-ctype.h"
#include "opcode/tic30.h"
/* Put here all non-digit non-letter charcters that may occur in an
@@ -188,25 +189,25 @@ md_begin ()
for (c = 0; c < 256; c++)
{
- if (islower (c) || isdigit (c))
+ if (ISLOWER (c) || ISDIGIT (c))
{
opcode_chars[c] = c;
register_chars[c] = c;
}
- else if (isupper (c))
+ else if (ISUPPER (c))
{
- opcode_chars[c] = tolower (c);
+ opcode_chars[c] = TOLOWER (c);
register_chars[c] = opcode_chars[c];
}
else if (c == ')' || c == '(')
{
register_chars[c] = c;
}
- if (isupper (c) || islower (c) || isdigit (c))
+ if (ISUPPER (c) || ISLOWER (c) || ISDIGIT (c))
operand_chars[c] = c;
- if (isdigit (c) || c == '-')
+ if (ISDIGIT (c) || c == '-')
digit_chars[c] = c;
- if (isalpha (c) || c == '_' || c == '.' || isdigit (c))
+ if (ISALPHA (c) || c == '_' || c == '.' || ISDIGIT (c))
identifier_chars[c] = c;
if (c == ' ' || c == '\t')
space_chars[c] = c;
@@ -1267,7 +1268,7 @@ tic30_operand (token)
ind_buffer[0] = *token;
for (count = 1; count < strlen (token); count++)
{ /* Strip operand */
- ind_buffer[buffer_posn] = tolower (*(token + count));
+ ind_buffer[buffer_posn] = TOLOWER (*(token + count));
if ((*(token + count - 1) == 'a' || *(token + count - 1) == 'A') &&
(*(token + count) == 'r' || *(token + count) == 'R'))
{
@@ -1486,12 +1487,12 @@ tic30_find_parallel_insn (current_line, next_line)
{
if (is_opcode_char (c) && search_status == NONE)
{
- opcode[char_ptr++] = tolower (c);
+ opcode[char_ptr++] = TOLOWER (c);
search_status = START_OPCODE;
}
else if (is_opcode_char (c) && search_status == START_OPCODE)
{
- opcode[char_ptr++] = tolower (c);
+ opcode[char_ptr++] = TOLOWER (c);
}
else if (!is_opcode_char (c) && search_status == START_OPCODE)
{
@@ -1868,7 +1869,7 @@ char *
output_invalid (c)
char c;
{
- if (isprint (c))
+ if (ISPRINT (c))
sprintf (output_invalid_buf, "'%c'", c);
else
sprintf (output_invalid_buf, "(0x%x)", (unsigned) c);
diff --git a/gas/config/tc-tic54x.c b/gas/config/tc-tic54x.c
index f0b1007..3c59a8a 100644
--- a/gas/config/tc-tic54x.c
+++ b/gas/config/tc-tic54x.c
@@ -45,6 +45,7 @@
#include <limits.h>
#include <errno.h>
#include "as.h"
+#include "safe-ctype.h"
#include "sb.h"
#include "macro.h"
#include "subsegs.h"
@@ -355,7 +356,7 @@ tic54x_asg (x)
name = ++input_line_pointer;
c = get_symbol_end (); /* Get terminator. */
- if (!isalpha (*name))
+ if (!ISALPHA (*name))
{
as_bad ("symbols assigned with .asg must begin with a letter");
ignore_rest_of_line ();
@@ -420,7 +421,7 @@ tic54x_eval (x)
name = strcpy (tmp, name);
*input_line_pointer = c;
- if (!isalpha (*name))
+ if (!ISALPHA (*name))
{
as_bad (_("symbols assigned with .eval must begin with a letter"));
ignore_rest_of_line ();
@@ -1464,8 +1465,8 @@ lookup_version (ver)
|| ver[2] == '5' || ver[2] == '8' || ver[2] == '9'))
version = ver[2] - '0';
else if (strlen (ver) == 5
- && toupper (ver[3]) == 'L'
- && toupper (ver[4]) == 'P'
+ && TOUPPER (ver[3]) == 'L'
+ && TOUPPER (ver[4]) == 'P'
&& (ver[2] == '5' || ver[2] == '6'))
version = ver[2] - '0' + 10;
}
@@ -2272,7 +2273,7 @@ tic54x_var (ignore)
}
do
{
- if (!isalpha (*input_line_pointer))
+ if (!ISALPHA (*input_line_pointer))
{
as_bad (_("Substitution symbols must begin with a letter"));
ignore_rest_of_line ();
@@ -2325,7 +2326,7 @@ tic54x_mlib (ignore)
SKIP_WHITESPACE ();
len = 0;
while (!is_end_of_line[(int) *input_line_pointer]
- && !isspace (*input_line_pointer))
+ && !ISSPACE (*input_line_pointer))
{
obstack_1grow (&notes, *input_line_pointer);
++input_line_pointer;
@@ -2739,7 +2740,7 @@ subsym_iscons (a, ignore)
{
int len = strlen (a);
- switch (toupper (a[len - 1]))
+ switch (TOUPPER (a[len - 1]))
{
case 'B':
return 1;
@@ -2755,7 +2756,7 @@ subsym_iscons (a, ignore)
/* No suffix; either octal, hex, or decimal. */
if (*a == '0' && len > 1)
{
- if (toupper (a[1]) == 'X')
+ if (TOUPPER (a[1]) == 'X')
return 3;
return 2;
}
@@ -3294,7 +3295,7 @@ get_operands (operands, line)
{
int paren_not_balanced = 0;
char *op_start, *op_end;
- while (*lptr && isspace (*lptr))
+ while (*lptr && ISSPACE (*lptr))
++lptr;
op_start = lptr;
while (paren_not_balanced || *lptr != ',')
@@ -3324,7 +3325,7 @@ get_operands (operands, line)
/* Trim trailing spaces; while the preprocessor gets rid of most,
there are weird usage patterns that can introduce them
(i.e. using strings for macro args). */
- while (len > 0 && isspace (operands[numexp].buf[len - 1]))
+ while (len > 0 && ISSPACE (operands[numexp].buf[len - 1]))
operands[numexp].buf[--len] = 0;
lptr = op_end;
++numexp;
@@ -3348,7 +3349,7 @@ get_operands (operands, line)
}
}
- while (*lptr && isspace (*lptr++))
+ while (*lptr && ISSPACE (*lptr++))
;
if (!is_end_of_line[(int) *lptr])
{
@@ -3501,12 +3502,12 @@ is_type (operand, type)
case OP_DST:
return is_accumulator (operand);
case OP_B:
- return is_accumulator (operand) && toupper (operand->buf[0]) == 'B';
+ return is_accumulator (operand) && TOUPPER (operand->buf[0]) == 'B';
case OP_A:
- return is_accumulator (operand) && toupper (operand->buf[0]) == 'A';
+ return is_accumulator (operand) && TOUPPER (operand->buf[0]) == 'A';
case OP_ARX:
return strncasecmp ("ar", operand->buf, 2) == 0
- && isdigit (operand->buf[2]);
+ && ISDIGIT (operand->buf[2]);
case OP_SBIT:
return hash_find (sbit_hash, operand->buf) != 0 || is_absolute (operand);
case OP_CC:
@@ -3736,7 +3737,7 @@ encode_indirect (insn, operand)
if (insn->is_lkaddr)
{
/* lk addresses always go in the second insn word. */
- mod = ((toupper (operand->buf[1]) == 'A') ? 12 :
+ mod = ((TOUPPER (operand->buf[1]) == 'A') ? 12 :
(operand->buf[1] == '(') ? 15 :
(strchr (operand->buf, '%') != NULL) ? 14 : 13);
arf = ((mod == 12) ? operand->buf[3] - '0' :
@@ -3761,7 +3762,7 @@ encode_indirect (insn, operand)
}
else
{
- arf = (toupper (operand->buf[1]) == 'A' ?
+ arf = (TOUPPER (operand->buf[1]) == 'A' ?
operand->buf[3] : operand->buf[4]) - '0';
if (operand->buf[1] == '+')
@@ -3782,9 +3783,9 @@ encode_indirect (insn, operand)
else
mod = (operand->buf[4] == '-' ? 8 : 10);/* *ARx+% / *ARx-% */
}
- else if (toupper (operand->buf[6]) == 'B')
+ else if (TOUPPER (operand->buf[6]) == 'B')
mod = (operand->buf[4] == '-' ? 4 : 7); /* ARx+0B / *ARx-0B */
- else if (toupper (operand->buf[6]) == '%')
+ else if (TOUPPER (operand->buf[6]) == '%')
mod = (operand->buf[4] == '-' ? 9 : 11); /* ARx+0% / *ARx - 0% */
else
{
@@ -4002,7 +4003,7 @@ encode_operand (insn, type, operand)
/* 16-bit immediate value. */
return encode_dmad (insn, operand, 0);
case OP_SRC:
- if (toupper (*operand->buf) == 'B')
+ if (TOUPPER (*operand->buf) == 'B')
{
insn->opcode[ext ? (1 + insn->is_lkaddr) : 0].word |= (1 << 9);
if (insn->using_default_dst)
@@ -4011,7 +4012,7 @@ encode_operand (insn, type, operand)
return 1;
case OP_RND:
/* Make sure this agrees with with the OP_DST operand. */
- if (!((toupper (operand->buf[0]) == 'B') ^
+ if (!((TOUPPER (operand->buf[0]) == 'B') ^
((insn->opcode[0].word & (1 << 8)) != 0)))
{
as_bad (_("Destination accumulator for each part of this parallel "
@@ -4021,7 +4022,7 @@ encode_operand (insn, type, operand)
return 1;
case OP_SRC1:
case OP_DST:
- if (toupper (operand->buf[0]) == 'B')
+ if (TOUPPER (operand->buf[0]) == 'B')
insn->opcode[ext ? (1 + insn->is_lkaddr) : 0].word |= (1 << 8);
return 1;
case OP_Xmem:
@@ -4418,7 +4419,7 @@ next_line_shows_parallel (next_line)
char *next_line;
{
/* Look for the second half. */
- while (isspace (*next_line))
+ while (ISSPACE (*next_line))
++next_line;
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 *endp;
int is_string = *line == '"';
- int is_char = isdigit (*line);
+ int is_char = ISDIGIT (*line);
if (is_char)
{
- while (isdigit (*ptr))
+ while (ISDIGIT (*ptr))
++ptr;
endp = ptr;
*str = xmalloc (ptr - line + 1);
@@ -4728,7 +4729,7 @@ subsym_substitute (char *line, int forced)
/* Check for local labels; replace them with the appropriate
substitution. */
- if ((*name == '$' && isdigit (name[1]) && name[2] == '\0')
+ if ((*name == '$' && ISDIGIT (name[1]) && name[2] == '\0')
|| name[strlen (name) - 1] == '?')
{
/* Use an existing identifier for that label if, available, or
@@ -4821,7 +4822,7 @@ subsym_substitute (char *line, int forced)
}
/* Character constants are converted to numerics
by the preprocessor. */
- arg_type[1] = (isdigit (*ptr)) ? 2 : (*ptr == '"');
+ arg_type[1] = (ISDIGIT (*ptr)) ? 2 : (*ptr == '"');
ptr = subsym_get_arg (ptr, ")", &arg2, ismember);
}
/* Args checking. */
@@ -5026,7 +5027,7 @@ tic54x_start_line_hook ()
comment = replacement + strlen (replacement) - 1;
/* Trim trailing whitespace. */
- while (isspace (*comment))
+ while (ISSPACE (*comment))
{
comment[0] = endc;
comment[1] = 0;
@@ -5034,7 +5035,7 @@ tic54x_start_line_hook ()
}
/* Compact leading whitespace. */
- while (isspace (tmp[0]) && isspace (tmp[1]))
+ while (ISSPACE (tmp[0]) && ISSPACE (tmp[1]))
++tmp;
input_line_pointer = endp;
@@ -5135,7 +5136,7 @@ md_assemble (line)
otherwise let the assembler pick up the next line for us. */
if (tmp != NULL)
{
- while (isspace (tmp[2]))
+ while (ISSPACE (tmp[2]))
++tmp;
md_assemble (tmp + 2);
}
@@ -5673,18 +5674,18 @@ tic54x_start_label (c, rest)
if (is_end_of_line[(int) c])
return 1;
- if (isspace (c))
- while (isspace (c = *++rest))
+ if (ISSPACE (c))
+ while (ISSPACE (c = *++rest))
;
if (c == '.')
{
/* Don't let colon () define a label for any of these... */
- return (strncasecmp (rest, ".tag", 4) != 0 || !isspace (rest[4]))
- && (strncasecmp (rest, ".struct", 7) != 0 || !isspace (rest[7]))
- && (strncasecmp (rest, ".union", 6) != 0 || !isspace (rest[6]))
- && (strncasecmp (rest, ".macro", 6) != 0 || !isspace (rest[6]))
- && (strncasecmp (rest, ".set", 4) != 0 || !isspace (rest[4]))
- && (strncasecmp (rest, ".equ", 4) != 0 || !isspace (rest[4]));
+ return (strncasecmp (rest, ".tag", 4) != 0 || !ISSPACE (rest[4]))
+ && (strncasecmp (rest, ".struct", 7) != 0 || !ISSPACE (rest[7]))
+ && (strncasecmp (rest, ".union", 6) != 0 || !ISSPACE (rest[6]))
+ && (strncasecmp (rest, ".macro", 6) != 0 || !ISSPACE (rest[6]))
+ && (strncasecmp (rest, ".set", 4) != 0 || !ISSPACE (rest[4]))
+ && (strncasecmp (rest, ".equ", 4) != 0 || !ISSPACE (rest[4]));
}
return 1;
diff --git a/gas/config/tc-tic80.c b/gas/config/tc-tic80.c
index 244e16b..585865f 100644
--- a/gas/config/tc-tic80.c
+++ b/gas/config/tc-tic80.c
@@ -1,5 +1,5 @@
/* 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.
@@ -19,6 +19,7 @@
02111-1307, USA. */
#include "as.h"
+#include "safe-ctype.h"
#include "opcode/tic80.h"
#define internal_error(what) \
@@ -784,12 +785,12 @@ md_assemble (str)
assert (str);
/* Drop any leading whitespace. */
- while (isspace (*str))
+ while (ISSPACE (*str))
str++;
/* Isolate the mnemonic from the rest of the string by finding the first
whitespace character and zapping it to a null byte. */
- for (scan = str; *scan != '\000' && !isspace (*scan); scan++)
+ for (scan = str; *scan != '\000' && !ISSPACE (*scan); scan++)
;
if (*scan != '\000')
@@ -803,7 +804,7 @@ md_assemble (str)
}
str = scan;
- while (isspace (*scan))
+ while (ISSPACE (*scan))
scan++;
input_line_save = input_line_pointer;
diff --git a/gas/config/tc-v850.c b/gas/config/tc-v850.c
index ce676cd..46104a4 100644
--- a/gas/config/tc-v850.c
+++ b/gas/config/tc-v850.c
@@ -20,8 +20,8 @@
Boston, MA 02111-1307, USA. */
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "opcode/v850.h"
#include "dwarf2dbg.h"
@@ -858,7 +858,7 @@ system_register_name (expressionP, accept_numbers, accept_list_names)
/* Reset input_line pointer. */
input_line_pointer = start;
- if (isdigit (*input_line_pointer))
+ if (ISDIGIT (*input_line_pointer))
{
reg_number = strtol (input_line_pointer, &input_line_pointer, 10);
@@ -1711,7 +1711,7 @@ md_assemble (str)
strncpy (copy_of_instruction, str, sizeof (copy_of_instruction) - 1);
/* Get the opcode. */
- for (s = str; *s != '\0' && ! isspace (*s); s++)
+ for (s = str; *s != '\0' && ! ISSPACE (*s); s++)
continue;
if (*s != '\0')
@@ -1728,7 +1728,7 @@ md_assemble (str)
}
str = s;
- while (isspace (*str))
+ while (ISSPACE (*str))
++str;
start_of_operands = str;
@@ -2141,7 +2141,7 @@ md_assemble (str)
break;
}
- while (isspace (*str))
+ while (ISSPACE (*str))
++str;
if (*str != '\0')
diff --git a/gas/config/tc-vax.c b/gas/config/tc-vax.c
index bf6558c..8400b5d 100644
--- a/gas/config/tc-vax.c
+++ b/gas/config/tc-vax.c
@@ -1965,7 +1965,7 @@ main ()
*
*/
-#include <ctype.h>
+#include "safe-ctype.h"
#define AP (12)
#define FP (13)
#define SP (14)
@@ -1979,14 +1979,12 @@ vax_reg_parse (c1, c2, c3) /* 3 chars of register name */
retval = -1;
- if (isupper (c1))
- c1 = tolower (c1);
- if (isupper (c2))
- c2 = tolower (c2);
- if (isdigit (c2) && c1 == 'r')
+ c1 = TOLOWER (c1);
+ c2 = TOLOWER (c2);
+ if (ISDIGIT (c2) && c1 == 'r')
{
retval = c2 - '0';
- if (isdigit (c3))
+ if (ISDIGIT (c3))
{
retval = retval * 10 + c3 - '0';
retval = (retval > 15) ? -1 : retval;
@@ -2332,8 +2330,7 @@ vip_op (optext, vopP)
char c;
c = *p;
- if (isupper (c))
- c = tolower (c);
+ c = TOLOWER (c);
if (DISPLENP (p[1]) && strchr ("bilws", len = c))
p += 2; /* skip (letter) '^' */
else /* no (letter) '^' seen */
diff --git a/gas/config/tc-w65.c b/gas/config/tc-w65.c
index 24247ae..dda8859 100644
--- a/gas/config/tc-w65.c
+++ b/gas/config/tc-w65.c
@@ -26,7 +26,6 @@
#include "subsegs.h"
#define DEFINE_TABLE
#include "../opcodes/w65-opc.h"
-#include <ctype.h>
const char comment_chars[] = "!";
CONST char line_separator_chars[] = ";";
diff --git a/gas/config/tc-z8k.c b/gas/config/tc-z8k.c
index d8bbb8b..924ce9c 100644
--- a/gas/config/tc-z8k.c
+++ b/gas/config/tc-z8k.c
@@ -1,5 +1,5 @@
/* tc-z8k.c -- Assemble code for the Zilog Z800n
- Copyright 1992, 1993, 1994, 1995, 1996, 1998, 2000
+ Copyright 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2001
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -28,7 +28,7 @@
#include "as.h"
#include "bfd.h"
-#include <ctype.h>
+#include "safe-ctype.h"
const char comment_chars[] = "!";
const char line_comment_chars[] = "#";
@@ -70,9 +70,9 @@ int
tohex (c)
int c;
{
- if (isdigit (c))
+ if (ISDIGIT (c))
return c - '0';
- if (islower (c))
+ if (ISLOWER (c))
return c - 'a' + 10;
return c - 'A' + 10;
}
@@ -221,7 +221,7 @@ whatreg (reg, src)
int *reg;
char *src;
{
- if (isdigit (src[1]))
+ if (ISDIGIT (src[1]))
{
*reg = (src[0] - '0') * 10 + src[1] - '0';
return src + 2;
diff --git a/gas/ecoff.c b/gas/ecoff.c
index cbcdd9f..ed11921 100644
--- a/gas/ecoff.c
+++ b/gas/ecoff.c
@@ -37,7 +37,7 @@
#include "coff/symconst.h"
#include "aout/stab_gnu.h"
-#include <ctype.h>
+#include "safe-ctype.h"
/* Why isn't this in coff/sym.h? */
#define ST_RFDESCAPE 0xfff
@@ -3101,7 +3101,7 @@ ecoff_directive_ent (ignore)
++input_line_pointer;
SKIP_WHITESPACE ();
}
- if (isdigit ((unsigned char) *input_line_pointer)
+ if (ISDIGIT (*input_line_pointer)
|| *input_line_pointer == '-')
(void) get_absolute_expression ();
@@ -3546,7 +3546,7 @@ ecoff_stab (sec, what, string, type, other, desc)
listing_source_file (string);
#endif
- if (isdigit ((unsigned char) *input_line_pointer)
+ if (ISDIGIT (*input_line_pointer)
|| *input_line_pointer == '-'
|| *input_line_pointer == '+')
{
diff --git a/gas/expr.c b/gas/expr.c
index 4f7f225..499f9a3 100644
--- a/gas/expr.c
+++ b/gas/expr.c
@@ -25,11 +25,11 @@
(It also gives smaller files to re-compile.)
Here, "operand"s are of expressions, not instructions. */
-#include <ctype.h>
#include <string.h>
#define min(a, b) ((a) < (b) ? (a) : (b))
#include "as.h"
+#include "safe-ctype.h"
#include "obstack.h"
static void floating_constant PARAMS ((expressionS * expressionP));
@@ -331,9 +331,7 @@ integer_constant (radix, expressionP)
/* In MRI mode, the number may have a suffix indicating the
radix. For that matter, it might actually be a floating
point constant. */
- for (suffix = input_line_pointer;
- isalnum ((unsigned char) *suffix);
- suffix++)
+ for (suffix = input_line_pointer; ISALNUM (*suffix); suffix++)
{
if (*suffix == 'e' || *suffix == 'E')
flt = 1;
@@ -347,8 +345,7 @@ integer_constant (radix, expressionP)
else
{
c = *--suffix;
- if (islower ((unsigned char) c))
- c = toupper (c);
+ c = TOUPPER (c);
if (c == 'B')
radix = 2;
else if (c == 'D')
@@ -862,8 +859,7 @@ operand (expressionP)
{
input_line_pointer++;
floating_constant (expressionP);
- expressionP->X_add_number =
- - (isupper ((unsigned char) c) ? tolower (c) : c);
+ expressionP->X_add_number = - TOLOWER (c);
}
else
{
@@ -985,8 +981,7 @@ operand (expressionP)
case 'G':
input_line_pointer++;
floating_constant (expressionP);
- expressionP->X_add_number =
- - (isupper ((unsigned char) c) ? tolower (c) : c);
+ expressionP->X_add_number = - TOLOWER (c);
break;
case '$':
diff --git a/gas/gasp.c b/gas/gasp.c
index ad33a46..4022408 100644
--- a/gas/gasp.c
+++ b/gas/gasp.c
@@ -1,5 +1,5 @@
/* gasp.c - Gnu assembler preprocessor main program.
- Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
+ Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
Written by Steve and Judy Chamberlain of Cygnus Support,
@@ -51,7 +51,6 @@ suitable for gas to consume.
#include <stdio.h>
#include <string.h>
#include <getopt.h>
-#include <ctype.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
@@ -63,6 +62,7 @@ extern char *malloc ();
#include "ansidecl.h"
#include "libiberty.h"
+#include "safe-ctype.h"
#include "sb.h"
#include "macro.h"
#include "asintl.h"
@@ -539,7 +539,7 @@ sb_strtol (idx, string, base, ptr)
{
int ch = string->ptr[idx];
int dig = 0;
- if (isdigit (ch))
+ if (ISDIGIT (ch))
dig = ch - '0';
else if (ch >= 'a' && ch <= 'f')
dig = ch - 'a' + 10;
@@ -574,7 +574,7 @@ level_0 (idx, string, lhs)
lhs->value = 0;
- if (isdigit ((unsigned char) string->ptr[idx]))
+ if (ISDIGIT (string->ptr[idx]))
{
idx = sb_strtol (idx, string, 10, &lhs->value);
}
@@ -1132,7 +1132,7 @@ change_base (idx, in, out)
idx++;
}
}
- else if (isdigit ((unsigned char) in->ptr[idx]))
+ else if (ISDIGIT (in->ptr[idx]))
{
int value;
/* All numbers must start with a digit, let's chew it and
@@ -1676,7 +1676,7 @@ doinstr (idx, in, out)
idx = sb_skip_comma (idx, in);
idx = get_and_process (idx, in, &search);
idx = sb_skip_comma (idx, in);
- if (isdigit ((unsigned char) in->ptr[idx]))
+ if (ISDIGIT (in->ptr[idx]))
{
idx = exp_get_abs (_(".instr needs absolute expresson.\n"), idx, in, &start);
}
@@ -1776,26 +1776,26 @@ process_assigns (idx, in, buf)
}
else if (idx + 3 < in->len
&& in->ptr[idx] == '.'
- && toupper ((unsigned char) in->ptr[idx + 1]) == 'L'
- && toupper ((unsigned char) in->ptr[idx + 2]) == 'E'
- && toupper ((unsigned char) in->ptr[idx + 3]) == 'N')
+ && TOUPPER (in->ptr[idx + 1]) == 'L'
+ && TOUPPER (in->ptr[idx + 2]) == 'E'
+ && TOUPPER (in->ptr[idx + 3]) == 'N')
idx = dolen (idx + 4, in, buf);
else if (idx + 6 < in->len
&& in->ptr[idx] == '.'
- && toupper ((unsigned char) in->ptr[idx + 1]) == 'I'
- && toupper ((unsigned char) in->ptr[idx + 2]) == 'N'
- && toupper ((unsigned char) in->ptr[idx + 3]) == 'S'
- && toupper ((unsigned char) in->ptr[idx + 4]) == 'T'
- && toupper ((unsigned char) in->ptr[idx + 5]) == 'R')
+ && TOUPPER (in->ptr[idx + 1]) == 'I'
+ && TOUPPER (in->ptr[idx + 2]) == 'N'
+ && TOUPPER (in->ptr[idx + 3]) == 'S'
+ && TOUPPER (in->ptr[idx + 4]) == 'T'
+ && TOUPPER (in->ptr[idx + 5]) == 'R')
idx = doinstr (idx + 6, in, buf);
else if (idx + 7 < in->len
&& in->ptr[idx] == '.'
- && toupper ((unsigned char) in->ptr[idx + 1]) == 'S'
- && toupper ((unsigned char) in->ptr[idx + 2]) == 'U'
- && toupper ((unsigned char) in->ptr[idx + 3]) == 'B'
- && toupper ((unsigned char) in->ptr[idx + 4]) == 'S'
- && toupper ((unsigned char) in->ptr[idx + 5]) == 'T'
- && toupper ((unsigned char) in->ptr[idx + 6]) == 'R')
+ && TOUPPER (in->ptr[idx + 1]) == 'S'
+ && TOUPPER (in->ptr[idx + 2]) == 'U'
+ && TOUPPER (in->ptr[idx + 3]) == 'B'
+ && TOUPPER (in->ptr[idx + 4]) == 'S'
+ && TOUPPER (in->ptr[idx + 5]) == 'T'
+ && TOUPPER (in->ptr[idx + 6]) == 'R')
idx = dosubstr (idx + 7, in, buf);
else if (ISFIRSTCHAR (in->ptr[idx]))
{
@@ -2130,8 +2130,8 @@ whatcond (idx, in, val)
char a, b;
p = in->ptr + idx;
- a = toupper ((unsigned char) p[0]);
- b = toupper ((unsigned char) p[1]);
+ a = TOUPPER (p[0]);
+ b = TOUPPER (p[1]);
if (a == 'E' && b == 'Q')
cond = EQ;
else if (a == 'N' && b == 'E')
@@ -2980,13 +2980,13 @@ chartype_init ()
int x;
for (x = 0; x < 256; x++)
{
- if (isalpha (x) || x == '_' || x == '$')
+ if (ISALPHA (x) || x == '_' || x == '$')
chartype[x] |= FIRSTBIT;
if (mri && x == '.')
chartype[x] |= FIRSTBIT;
- if (isdigit (x) || isalpha (x) || x == '_' || x == '$')
+ if (ISDIGIT (x) || ISALPHA (x) || x == '_' || x == '$')
chartype[x] |= NEXTBIT;
if (x == ' ' || x == '\t' || x == ',' || x == '"' || x == ';'
@@ -3552,6 +3552,9 @@ main (argc, argv)
#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);
diff --git a/gas/hash.c b/gas/hash.c
index ab28396..e993136 100644
--- a/gas/hash.c
+++ b/gas/hash.c
@@ -1,6 +1,6 @@
/* hash.c -- gas hash table code
Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999,
- 2000
+ 2000, 2001
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -30,6 +30,7 @@
structure. */
#include "as.h"
+#include "safe-ctype.h"
#include "obstack.h"
/* The default number of entries to use when creating a hash table. */
@@ -458,8 +459,7 @@ main ()
printf ("hash_test command: ");
gets (answer);
command = answer[0];
- if (isupper (command))
- command = tolower (command); /* Ecch! */
+ command = TOLOWER (command); /* Ecch! */
switch (command)
{
case '#':
diff --git a/gas/itbl-lex.l b/gas/itbl-lex.l
index 4ac0946..ed0be64 100644
--- a/gas/itbl-lex.l
+++ b/gas/itbl-lex.l
@@ -1,5 +1,5 @@
/* 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.
@@ -22,7 +22,6 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
-#include <ctype.h>
#include "itbl-parse.h"
#ifdef DEBUG
diff --git a/gas/listing.c b/gas/listing.c
index 7aeb3fc..f8847d9 100644
--- a/gas/listing.c
+++ b/gas/listing.c
@@ -91,10 +91,9 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
on a line
*/
-#include <ctype.h>
-
#include "as.h"
#include <obstack.h>
+#include "safe-ctype.h"
#include "input-file.h"
#include "subsegs.h"
@@ -370,7 +369,7 @@ listing_newline (ps)
unsigned char c = *src++;
/* Omit control characters in the listing. */
- if (isascii (c) && ! iscntrl (c))
+ if (!ISCNTRL (c))
*dest++ = c;
}
@@ -908,7 +907,7 @@ debugging_pseudo (list, line)
was_debug = in_debug;
in_debug = 0;
- while (isspace ((unsigned char) *line))
+ while (ISSPACE (*line))
line++;
if (*line != '.')
diff --git a/gas/macro.c b/gas/macro.c
index e78855b..3e03c5d 100644
--- a/gas/macro.c
+++ b/gas/macro.c
@@ -1,5 +1,5 @@
/* macro.c - macro support for gas and gasp
- Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
+ Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
Written by Steve and Judy Chamberlain of Cygnus Support,
@@ -51,11 +51,11 @@ extern void *alloca ();
#else
#include <strings.h>
#endif
-#include <ctype.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#include "libiberty.h"
+#include "safe-ctype.h"
#include "sb.h"
#include "hash.h"
#include "macro.h"
@@ -183,7 +183,7 @@ buffer_and_nest (from, to, ptr, get_line)
/* Skip over a label. */
while (i < ptr->len
- && (isalnum ((unsigned char) ptr->ptr[i])
+ && (ISALNUM (ptr->ptr[i])
|| ptr->ptr[i] == '_'
|| ptr->ptr[i] == '$'))
i++;
@@ -206,11 +206,11 @@ buffer_and_nest (from, to, ptr, get_line)
i++;
if (strncasecmp (ptr->ptr + i, from, from_len) == 0
&& (ptr->len == (i + from_len)
- || ! isalnum (ptr->ptr[i + from_len])))
+ || ! ISALNUM (ptr->ptr[i + from_len])))
depth++;
if (strncasecmp (ptr->ptr + i, to, to_len) == 0
&& (ptr->len == (i + to_len)
- || ! isalnum (ptr->ptr[i + to_len])))
+ || ! ISALNUM (ptr->ptr[i + to_len])))
{
depth--;
if (depth == 0)
@@ -241,13 +241,13 @@ get_token (idx, in, name)
sb *name;
{
if (idx < in->len
- && (isalpha ((unsigned char) in->ptr[idx])
+ && (ISALPHA (in->ptr[idx])
|| in->ptr[idx] == '_'
|| in->ptr[idx] == '$'))
{
sb_add_char (name, in->ptr[idx++]);
while (idx < in->len
- && (isalnum ((unsigned char) in->ptr[idx])
+ && (ISALNUM (in->ptr[idx])
|| in->ptr[idx] == '_'
|| in->ptr[idx] == '$'))
{
@@ -567,8 +567,7 @@ define_macro (idx, in, label, get_line, namep)
/* And stick it in the macro hash table. */
for (idx = 0; idx < name.len; idx++)
- if (isupper ((unsigned char) name.ptr[idx]))
- name.ptr[idx] = tolower (name.ptr[idx]);
+ name.ptr[idx] = TOLOWER (name.ptr[idx]);
namestr = sb_terminate (&name);
hash_jam (macro_hash, namestr, (PTR) macro);
@@ -726,15 +725,14 @@ macro_expand_body (in, out, formals, formal_hash, comment_char, locals)
sb_add_char (out, '&');
src++;
}
- else if (macro_mri
- && isalnum ((unsigned char) in->ptr[src]))
+ else if (macro_mri && ISALNUM (in->ptr[src]))
{
int ind;
formal_entry *f;
- if (isdigit ((unsigned char) in->ptr[src]))
+ if (ISDIGIT (in->ptr[src]))
ind = in->ptr[src] - '0';
- else if (isupper ((unsigned char) in->ptr[src]))
+ else if (ISUPPER (in->ptr[src]))
ind = in->ptr[src] - 'A' + 10;
else
ind = in->ptr[src] - 'a' + 10;
@@ -758,7 +756,7 @@ macro_expand_body (in, out, formals, formal_hash, comment_char, locals)
}
}
else if ((macro_alternate || macro_mri)
- && (isalpha ((unsigned char) in->ptr[src])
+ && (ISALPHA (in->ptr[src])
|| in->ptr[src] == '_'
|| in->ptr[src] == '$')
&& (! inquote
@@ -1107,14 +1105,14 @@ check_macro (line, expand, comment_char, error, info)
macro_entry *macro;
sb line_sb;
- if (! isalpha ((unsigned char) *line)
+ if (! ISALPHA (*line)
&& *line != '_'
&& *line != '$'
&& (! macro_mri || *line != '.'))
return 0;
s = line + 1;
- while (isalnum ((unsigned char) *s)
+ while (ISALNUM (*s)
|| *s == '_'
|| *s == '$')
++s;
@@ -1123,8 +1121,7 @@ check_macro (line, expand, comment_char, error, info)
memcpy (copy, line, s - line);
copy[s - line] = '\0';
for (cs = copy; *cs != '\0'; cs++)
- if (isupper ((unsigned char) *cs))
- *cs = tolower (*cs);
+ *cs = TOLOWER (*cs);
macro = (macro_entry *) hash_find (macro_hash, copy);
diff --git a/gas/read.c b/gas/read.c
index 17bd456..80389b7 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -35,10 +35,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
/* Routines that read assembler source text to build spagetti in memory.
Another group of these functions is in the expr.c module. */
-/* For isdigit (). */
-#include <ctype.h>
-
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "sb.h"
#include "macro.h"
@@ -739,8 +737,7 @@ read_a_source_file (name)
while (*s2)
{
- if (isupper ((unsigned char) *s2))
- *s2 = tolower (*s2);
+ *s2 = TOLOWER (*s2);
s2++;
}
}
@@ -907,8 +904,7 @@ read_a_source_file (name)
if (is_end_of_line[(unsigned char) c])
continue;
- if ((LOCAL_LABELS_DOLLAR || LOCAL_LABELS_FB)
- && isdigit ((unsigned char) c))
+ if ((LOCAL_LABELS_DOLLAR || LOCAL_LABELS_FB) && ISDIGIT (c))
{
/* local label ("4:") */
char *backup = input_line_pointer;
@@ -918,7 +914,7 @@ read_a_source_file (name)
temp = c - '0';
/* Read the whole number. */
- while (isdigit ((unsigned char) *input_line_pointer))
+ while (ISDIGIT (*input_line_pointer))
{
temp = (temp * 10) + *input_line_pointer - '0';
++input_line_pointer;
@@ -1453,7 +1449,7 @@ s_mri_common (small)
SKIP_WHITESPACE ();
name = input_line_pointer;
- if (!isdigit ((unsigned char) *name))
+ if (!ISDIGIT (*name))
c = get_symbol_end ();
else
{
@@ -1461,7 +1457,7 @@ s_mri_common (small)
{
++input_line_pointer;
}
- while (isdigit ((unsigned char) *input_line_pointer));
+ while (ISDIGIT (*input_line_pointer));
c = *input_line_pointer;
*input_line_pointer = '\0';
@@ -2488,7 +2484,7 @@ s_mri_sect (type)
SKIP_WHITESPACE ();
name = input_line_pointer;
- if (!isdigit ((unsigned char) *name))
+ if (!ISDIGIT (*name))
c = get_symbol_end ();
else
{
@@ -2496,7 +2492,7 @@ s_mri_sect (type)
{
++input_line_pointer;
}
- while (isdigit ((unsigned char) *input_line_pointer));
+ while (ISDIGIT (*input_line_pointer));
c = *input_line_pointer;
*input_line_pointer = '\0';
@@ -2521,7 +2517,7 @@ s_mri_sect (type)
if (*input_line_pointer == ',')
{
c = *++input_line_pointer;
- c = toupper ((unsigned char) c);
+ c = TOUPPER (c);
if (c == 'C' || c == 'D' || c == 'M' || c == 'R')
*type = c;
else
@@ -3044,7 +3040,7 @@ s_float_space (float_type)
/* Skip any 0{letter} that may be present. Don't even check if the
* letter is legal. */
if (input_line_pointer[0] == '0'
- && isalpha ((unsigned char) input_line_pointer[1]))
+ && ISALPHA (input_line_pointer[1]))
input_line_pointer += 2;
/* Accept :xxxx, where the x's are hex digits, for a floating point
@@ -3141,7 +3137,7 @@ ignore_rest_of_line ()
/* For suspect lines: gives warning. */
if (!is_end_of_line[(unsigned char) *input_line_pointer])
{
- if (isprint ((unsigned char) *input_line_pointer))
+ if (ISPRINT (*input_line_pointer))
as_warn (_("rest of line ignored; first ignored character is `%c'"),
*input_line_pointer);
else
@@ -4130,7 +4126,7 @@ float_cons (float_type)
has no use for such information. Lusers beware: you get
diagnostics if your input is ill-conditioned. */
if (input_line_pointer[0] == '0'
- && isalpha ((unsigned char) input_line_pointer[1]))
+ && ISALPHA (input_line_pointer[1]))
input_line_pointer += 2;
/* Accept :xxxx, where the x's are hex digits, for a floating
@@ -4668,7 +4664,7 @@ next_char_of_string ()
int i;
for (i = 0, number = 0;
- isdigit (c) && i < 3;
+ ISDIGIT (c) && i < 3;
c = *input_line_pointer++, i++)
{
number = number * 8 + c - '0';
@@ -4686,11 +4682,11 @@ next_char_of_string ()
number = 0;
c = *input_line_pointer++;
- while (isxdigit (c))
+ while (ISXDIGIT (c))
{
- if (isdigit (c))
+ if (ISDIGIT (c))
number = number * 16 + c - '0';
- else if (isupper (c))
+ else if (ISUPPER (c))
number = number * 16 + c - 'A' + 10;
else
number = number * 16 + c - 'a' + 10;
diff --git a/gas/symbols.c b/gas/symbols.c
index 201b03e..5dd3040 100644
--- a/gas/symbols.c
+++ b/gas/symbols.c
@@ -22,10 +22,9 @@
/* #define DEBUG_SYMS / * to debug symbol list maintenance. */
-#include <ctype.h>
-
#include "as.h"
+#include "safe-ctype.h"
#include "obstack.h" /* For "symbols.h" */
#include "subsegs.h"
@@ -124,11 +123,10 @@ save_symbol_name (name)
if (! symbols_case_sensitive)
{
- unsigned char *s;
+ char *s;
- for (s = (unsigned char *) ret; *s != '\0'; s++)
- if (islower (*s))
- *s = toupper (*s);
+ for (s = ret; *s != '\0'; s++)
+ *s = TOUPPER (*s);
}
return ret;
@@ -630,9 +628,7 @@ symbol_find_base (name, strip_underscore)
while ((c = *orig++) != '\0')
{
- if (islower (c))
- c = toupper (c);
- *copy++ = c;
+ *copy++ = TOUPPER (c);
}
*copy = '\0';
}
@@ -1584,7 +1580,7 @@ decode_local_label_name (s)
if (s[index] != 'L')
return s;
- for (label_number = 0, p = s + index + 1; isdigit ((unsigned char) *p); ++p)
+ for (label_number = 0, p = s + index + 1; ISDIGIT (*p); ++p)
label_number = (10 * label_number) + *p - '0';
if (*p == DOLLAR_LABEL_CHAR)
@@ -1594,7 +1590,7 @@ decode_local_label_name (s)
else
return s;
- for (instance_number = 0, p++; isdigit ((unsigned char) *p); ++p)
+ for (instance_number = 0, p++; ISDIGIT (*p); ++p)
instance_number = (10 * instance_number) + *p - '0';
message_format = _("\"%d\" (instance number %d of a %s label)");