x
[deliverable/binutils-gdb.git] / gas / gasp.c
index ff779b055d6f245de157667888dc1e21ac373e03..3fb51b84b61f1504696c235579d33d530bb2486f 100644 (file)
@@ -1,5 +1,5 @@
 /* gasp.c - Gnu assembler preprocessor main program.
-   Copyright (C) 1994, 1995 Free Software Foundation, Inc.
+   Copyright (C) 1994, 95, 96, 1997 Free Software Foundation, Inc.
 
    Written by Steve and Judy Chamberlain of Cygnus Support,
       sac@cygnus.com
@@ -70,6 +70,11 @@ extern char *malloc ();
 
 char *program_version = "1.2";
 
+/* This is normally declared in as.h, but we don't include that.  We
+   need the function because other files linked with gasp.c might call
+   it.  */
+extern void as_abort PARAMS ((const char *, int, const char *));
+
 #define MAX_INCLUDES 30                /* Maximum include depth */
 #define MAX_REASONABLE 1000    /* Maximum number of expansions */
 
@@ -470,7 +475,7 @@ hash_add_to_string_table (tab, key, name, again)
   if (ptr->value.s.len)
     {
       if (!again)
-       ERROR ((stderr, "redefintion not allowed"));
+       ERROR ((stderr, "redefinition not allowed\n"));
     }
 
   ptr->type = hash_string;
@@ -1917,19 +1922,43 @@ process_file ()
        {
          l = grab_label (&line, &label_in);
          sb_reset (&label);              
-         if (label_in.len)
-           {
-             /* Munge any label */
-
-             
-             process_assigns (0, &label_in, &label);
-           }
 
          if (line.ptr[l] == ':')
            l++;
          while (ISWHITE (line.ptr[l]) && l < line.len)
            l++;
 
+         if (label_in.len)
+           {
+             int do_assigns;
+
+             /* Munge the label, unless this is EQU or ASSIGN.  */
+             do_assigns = 1;
+             if (l < line.len
+                 && (line.ptr[l] == '.' || alternate || mri))
+               {
+                 int lx = l;
+
+                 if (line.ptr[lx] == '.')
+                   ++lx;
+                 if (lx + 3 <= line.len
+                     && strncasecmp ("EQU", line.ptr + lx, 3) == 0
+                     && (lx + 3 == line.len
+                         || ! ISFIRSTCHAR (line.ptr[lx + 3])))
+                   do_assigns = 0;
+                 else if (lx + 6 <= line.len
+                          && strncasecmp ("ASSIGN", line.ptr + lx, 6) == 0
+                          && (lx + 6 == line.len
+                              || ! ISFIRSTCHAR (line.ptr[lx + 6])))
+                   do_assigns = 0;
+               }
+
+             if (do_assigns)
+               process_assigns (0, &label_in, &label);
+             else
+               sb_add_sb (&label, &label_in);
+           }
+
          if (l < line.len)
            {
              if (process_pseudo_op (l, &line, &acc))
@@ -2638,7 +2667,7 @@ do_macro (idx, in)
   const char *err;
   int line = linecount ();
 
-  err = define_macro (idx, in, &label, get_line);
+  err = define_macro (idx, in, &label, get_line, (const char **) NULL);
   if (err != NULL)
     ERROR ((stderr, "macro at line %d: %s\n", line - 1, err));
 }
@@ -3308,7 +3337,7 @@ process_pseudo_op (idx, line, acc)
              do_sdata (idx, line, 'z');
              return 1;
            case K_ASSIGN:
-             do_assign (1, 0, line);
+             do_assign (0, 0, line);
              return 1;
            case K_AIF:
              do_aif (idx, line);
@@ -3326,7 +3355,7 @@ process_pseudo_op (idx, line, acc)
              do_aendr ();
              return 1;
            case K_EQU:
-             do_assign (0, idx, line);
+             do_assign (1, idx, line);
              return 1;
            case K_ALIGN:
              do_align (idx, line);
@@ -3549,6 +3578,8 @@ Usage: %s \n\
   [-Dname=value]                  create preprocessor variable called name, with value\n\
   [-Ipath]                        add to include path list\n\
   [in-file]\n");
+  if (status == 0)
+    printf ("\nReport bugs to bug-gnu-utils@prep.ai.mit.edu\n");
   exit (status);
 }
 
@@ -3634,7 +3665,12 @@ main (argc, argv)
          show_help ();
          /*NOTREACHED*/
        case 'v':
-         printf ("GNU %s version %s\n", program_name, program_version);
+         /* This output is intended to follow the GNU standards document.  */
+         printf ("GNU assembler pre-processor %s\n", program_version);
+         printf ("Copyright 1996 Free Software Foundation, Inc.\n");
+         printf ("\
+This program is free software; you may redistribute it under the terms of\n\
+the GNU General Public License.  This program has absolutely no warranty.\n");
          exit (0);
          /*NOTREACHED*/
        case 0:
This page took 0.025358 seconds and 4 git commands to generate.