*** empty log message ***
[binutils-gdb.git] / binutils / nlmheader.y
index 0f1e22aa5e37241c5c88ac3caf1d98069fb97b41..8aef16834f8bf35543c1cd2b26d1f5f1aa234077 100644 (file)
@@ -1,5 +1,6 @@
 %{/* nlmheader.y - parse NLM header specification keywords.
-     Copyright (C) 1993, 94, 95, 97, 1998 Free Software Foundation, Inc.
+     Copyright 1993, 1994, 1995, 1997, 1998, 2001, 2002
+     Free Software Foundation, Inc.
 
 This file is part of GNU Binutils.
 
@@ -26,9 +27,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
    This implementation is based on the description in the NetWare Tool
    Maker Specification manual, edition 1.0.  */
 
-#include <ansidecl.h>
+#include "ansidecl.h"
 #include <stdio.h>
-#include <ctype.h>
+#include "safe-ctype.h"
 #include "bfd.h"
 #include "bucomm.h"
 #include "nlm/common.h"
@@ -49,7 +50,7 @@ char *check_procedure;
 /* File named by CUSTOM.  */
 char *custom_file;
 /* Whether to generate debugging information (DEBUG).  */
-boolean debug_info;
+bfd_boolean debug_info;
 /* Procedure named by EXIT.  */
 char *exit_procedure;
 /* Exported symbols (EXPORT).  */
@@ -59,7 +60,7 @@ struct string_list *input_files;
 /* Map file name (MAP, FULLMAP).  */
 char *map_file;
 /* Whether a full map has been requested (FULLMAP).  */
-boolean full_map;
+bfd_boolean full_map;
 /* File named by HELP.  */
 char *help_file;
 /* Imported symbols (IMPORT).  */
@@ -75,7 +76,7 @@ char *sharelib_file;
 /* Start procedure name (START).  */
 char *start_procedure;
 /* VERBOSE.  */
-boolean verbose;
+bfd_boolean verbose;
 /* RPC description file (XDCDATA).  */
 char *rpc_file;
 
@@ -92,7 +93,7 @@ static char *symbol_prefix;
 /* Local functions.  */
 static int yylex PARAMS ((void));
 static void nlmlex_file_push PARAMS ((const char *));
-static boolean nlmlex_file_open PARAMS ((const char *));
+static bfd_boolean nlmlex_file_open PARAMS ((const char *));
 static int nlmlex_buf_init PARAMS ((void));
 static char nlmlex_buf_add PARAMS ((int));
 static long nlmlex_get_number PARAMS ((const char *));
@@ -140,7 +141,7 @@ static char *xstrdup PARAMS ((const char *));
 
 /* The entire file is just a list of commands.  */
 
-file:  
+file:
          commands
        ;
 
@@ -204,7 +205,7 @@ command:
          }
        | DEBUG
          {
-           debug_info = true;
+           debug_info = TRUE;
          }
        | DESCRIPTION QUOTED_STRING
          {
@@ -247,12 +248,12 @@ command:
        | FULLMAP
          {
            map_file = "";
-           full_map = true;
+           full_map = TRUE;
          }
        | FULLMAP STRING
          {
            map_file = $2;
-           full_map = true;
+           full_map = TRUE;
          }
        | HELP STRING
          {
@@ -365,7 +366,7 @@ command:
          }
        | VERBOSE
          {
-           verbose = true;
+           verbose = TRUE;
          }
        | VERSIONK STRING STRING STRING
          {
@@ -494,7 +495,7 @@ string_list:
 /* If strerror is just a macro, we want to use the one from libiberty
    since it will handle undefined values.  */
 #undef strerror
-extern char *strerror ();
+extern char *strerror PARAMS ((int));
 
 /* The lexer is simple, too simple for flex.  Keywords are only
    recognized at the start of lines.  Everything else must be an
@@ -535,7 +536,7 @@ static struct input current;
 \f
 /* Start the lexer going on the main input file.  */
 
-boolean
+bfd_boolean
 nlmlex_file (name)
      const char *name;
 {
@@ -564,7 +565,7 @@ nlmlex_file_push (name)
 
 /* Start lexing from a file.  */
 
-static boolean
+static bfd_boolean
 nlmlex_file_open (name)
      const char *name;
 {
@@ -573,12 +574,12 @@ nlmlex_file_open (name)
     {
       fprintf (stderr, "%s:%s: %s\n", program_name, name, strerror (errno));
       ++parse_errors;
-      return false;
+      return FALSE;
     }
   current.name = xstrdup (name);
   current.lineno = 1;
   current.state = BEGINNING_OF_LINE;
-  return true;
+  return TRUE;
 }
 \f
 /* Table used to turn keywords into tokens.  */
@@ -682,7 +683,7 @@ tail_recurse:
   c = getc (current.file);
 
   /* Commas are treated as whitespace characters.  */
-  while (isspace ((unsigned char) c) || c == ',')
+  while (ISSPACE (c) || c == ',')
     {
       current.state = IN_LINE;
       if (c == '\n')
@@ -735,9 +736,9 @@ tail_recurse:
          if (c == '\n')
            ++current.lineno;
        }
-      while (isspace ((unsigned char) c));
+      while (ISSPACE (c));
       BUF_INIT ();
-      while (! isspace ((unsigned char) c) && c != EOF)
+      while (! ISSPACE (c) && c != EOF)
        {
          BUF_ADD (c);
          c = getc (current.file);
@@ -745,7 +746,7 @@ tail_recurse:
       BUF_FINISH ();
 
       ungetc (c, current.file);
-      
+
       nlmlex_file_push (lex_buf);
       goto tail_recurse;
     }
@@ -755,17 +756,14 @@ tail_recurse:
   if (current.state == BEGINNING_OF_LINE)
     {
       BUF_INIT ();
-      while (isalnum ((unsigned char) c) || c == '_')
+      while (ISALNUM (c) || c == '_')
        {
-         if (islower ((unsigned char) c))
-           BUF_ADD (toupper ((unsigned char) c));
-         else
-           BUF_ADD (c);
+         BUF_ADD (TOUPPER (c));
          c = getc (current.file);
        }
       BUF_FINISH ();
 
-      if (c != EOF && ! isspace ((unsigned char) c) && c != ',')
+      if (c != EOF && ! ISSPACE (c) && c != ',')
        {
          nlmheader_identify ();
          fprintf (stderr, _("%s:%d: illegal character in keyword: %c\n"),
@@ -787,7 +785,7 @@ tail_recurse:
                  return keyword_tokens[i].token;
                }
            }
-         
+
          nlmheader_identify ();
          fprintf (stderr, _("%s:%d: unrecognized keyword: %s\n"),
                   current.name, current.lineno, lex_buf);
@@ -838,7 +836,7 @@ tail_recurse:
 
   /* Gather a generic argument.  */
   BUF_INIT ();
-  while (! isspace (c)
+  while (! ISSPACE (c)
         && c != ','
         && c != COMMENT_CHAR
         && c != '('