* gdb/s390-nat.c (s390_register_u_addr): Pass proper arguments to
[deliverable/binutils-gdb.git] / gas / gasp.c
index b8355ece71e1cb133f25461732f22b463c652e4d..4022408e51cc16d889b8d57addf40f7ff19b27e0 100644 (file)
@@ -1,5 +1,5 @@
 /* gasp.c - Gnu assembler preprocessor main program.
-   Copyright (C) 1994, 95, 96, 97, 98, 99, 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"
@@ -124,32 +124,27 @@ static char chartype[256];
    a bug in the user's macro structure.  */
 
 #define IFNESTING 100
-struct
-{
+struct {
   int on;                      /* Is the level being output.  */
   int hadelse;                 /* Has an aelse been seen.  */
-}
-ifstack[IFNESTING];
+} ifstack[IFNESTING];
+
 int ifi;
 
 /* The final and intermediate results of expression evaluation are kept in
    exp_t's.  Note that a symbol is not an sb, but a pointer into the input
    line.  It must be coped somewhere safe before the next line is read in.  */
 
-typedef struct
-{
+typedef struct {
   char *name;
   int len;
-}
-symbol;
+} symbol;
 
-typedef struct
-{
+typedef struct {
   int value;                   /* Constant part.  */
   symbol add_symbol;           /* Name part.  */
   symbol sub_symbol;           /* Name part.  */
-}
-exp_t;
+} exp_t;
 
 /* Hashing is done in a pretty standard way.  A hash_table has a
    pointer to a vector of pointers to hash_entrys, and the size of the
@@ -158,20 +153,17 @@ exp_t;
    with the same hash are kept in a chain.  */
 
 /* What the data in a hash_entry means.  */
-typedef enum
-{
+typedef enum {
   hash_integer,                        /* Name->integer mapping.  */
   hash_string,                 /* Name->string mapping.  */
   hash_macro,                  /* Name is a macro.  */
   hash_formal                  /* Name is a formal argument.  */
 } hash_type;
 
-typedef struct hs
-{
+typedef struct hs {
   sb key;                      /* Symbol name.  */
   hash_type type;              /* Symbol meaning.  */
-  union
-  {
+  union {
     sb s;
     int i;
     struct macro_struct *m;
@@ -180,8 +172,7 @@ typedef struct hs
   struct hs *next;             /* Next hash_entry with same hash key.  */
 } hash_entry;
 
-typedef struct
-{
+typedef struct {
   hash_entry **table;
   int size;
 } hash_table;
@@ -201,13 +192,11 @@ typedef struct
    the same stack index.  If we're being reasonable, we can detect
    recusive expansion by checking the index is reasonably small.  */
 
-typedef enum
-{
+typedef enum {
   include_file, include_repeat, include_while, include_macro
 } include_type;
 
-struct include_stack
-{
+struct include_stack {
   sb pushback;                 /* Current pushback stream.  */
   int pushback_index;          /* Next char to read from stream.  */
   FILE *handle;                        /* Open file.  */
@@ -215,19 +204,17 @@ struct include_stack
   int linecount;               /* Number of lines read so far.  */
   include_type type;
   int index;                   /* Index of this layer.  */
-}
-include_stack[MAX_INCLUDES];
+} include_stack[MAX_INCLUDES];
 
 struct include_stack *sp;
 #define isp (sp - include_stack)
 
 /* Include file list.  */
 
-typedef struct include_path
-{
+typedef struct include_path {
   struct include_path *next;
   sb path;
-}  include_path;
+} include_path;
 
 include_path *paths_head;
 include_path *paths_tail;
@@ -552,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;
@@ -587,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);
     }
@@ -1145,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
@@ -1689,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);
     }
@@ -1789,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]))
        {
@@ -2143,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')
@@ -2993,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 == ';'
@@ -3079,15 +3066,13 @@ chartype_init ()
 #define K_IRP          (PROCESS|54)
 #define K_IRPC         (PROCESS|55)
 
-struct keyword
-{
+struct keyword {
   char *name;
   int code;
   int extra;
 };
 
-static struct keyword kinfo[] =
-{
+static struct keyword kinfo[] = {
   { "EQU", K_EQU, 0 },
   { "ALTERNATE", K_ALTERNATE, 0 },
   { "ASSIGN", K_ASSIGN, 0 },
@@ -3138,8 +3123,7 @@ static struct keyword kinfo[] =
    handle them here as well, in case they are used in a recursive
    macro to end the recursion.  */
 
-static struct keyword mrikinfo[] =
-{
+static struct keyword mrikinfo[] = {
   { "IFEQ", K_IFEQ, 0 },
   { "IFNE", K_IFNE, 0 },
   { "IFLT", K_IFLT, 0 },
@@ -3567,6 +3551,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);
This page took 0.027658 seconds and 4 git commands to generate.