Add handling for numbers with suffixed radix.
authorTimothy Wall <twall@alum.mit.edu>
Tue, 8 Feb 2000 14:21:53 +0000 (14:21 +0000)
committerTimothy Wall <twall@alum.mit.edu>
Tue, 8 Feb 2000 14:21:53 +0000 (14:21 +0000)
gas/ChangeLog
gas/as.h
gas/doc/internals.texi
gas/expr.c

index 00c44405437433d7f4e2ba071b1def8e82923818..807ea282d18cb26ad3cd11094d8febc91dea9f44 100644 (file)
@@ -1,3 +1,10 @@
+2000-02-08  Timothy Wall  <twall@redhat.com>
+
+       * doc/internals.texi: Document NUMBERS_WITH_SUFFIX macro.
+       * as.h: Provide a default NUMBERS_WITH_SUFFIX definition (zero).
+       * expr.c: Handle numbers with suffixes if NUMBERS_WITH_SUFFIX is
+       non-zero. 
+       
 2000-02-08  Timothy Wall  <twall@redhat.com>
 
        * read.c: Added elseif to directives table.
index 3f16d5649efc9abfc91c021ed576470aac5fddaa..c82788c3c8a08d5c4b96546cf6f7f978f0048c54 100644 (file)
--- a/gas/as.h
+++ b/gas/as.h
@@ -629,6 +629,10 @@ void eh_frame_convert_frag PARAMS ((fragS *));
 #endif
 #include "listing.h"
 
+#ifndef NUMBERS_WITH_SUFFIX
+#define NUMBERS_WITH_SUFFIX 0
+#endif
+
 #ifndef LOCAL_LABELS_DOLLAR
 #define LOCAL_LABELS_DOLLAR 0
 #endif
index 6dc9ac7c658f99cc954c557b8336317b7de37bb7..dfc2d3af7247e61bd4cd91eb2c6f490899c3b962 100644 (file)
@@ -960,6 +960,12 @@ default value it zero.
 You may define this macro to the lexical type of the @kbd{$} character.  The
 default value is @code{LEX_NAME | LEX_BEGIN_NAME}.
 
+@item NUMBERS_WITH_SUFFIX
+@cindex NUMBERS_WITH_SUFFIX
+When this macro is defined to be non-zero, the parser allows the radix of a
+constant to be indicated with a suffix.  Valid suffixes are binary (B), 
+octal (Q), and hexadecimal (H).  Case is not significant.
+
 @item SINGLE_QUOTE_STRINGS
 @cindex SINGLE_QUOTE_STRINGS
 If you define this macro, GAS will treat single quotes as string delimiters.
index ced12395bb916b0af04a45099bb772cced7d8c61..e2e64991e466fea1e09813927cfb69a5e5d19d51 100644 (file)
@@ -327,7 +327,7 @@ integer_constant (radix, expressionP)
 #define valuesize 32
 #endif
 
-  if (flag_m68k_mri && radix == 0)
+  if ((NUMBERS_WITH_SUFFIX || flag_m68k_mri) && radix == 0)
     {
       int flt = 0;
 
@@ -541,7 +541,9 @@ integer_constant (radix, expressionP)
        }
     }
 
-  if (flag_m68k_mri && suffix != NULL && input_line_pointer - 1 == suffix)
+  if ((NUMBERS_WITH_SUFFIX || flag_m68k_mri) 
+      && suffix != NULL 
+      && input_line_pointer - 1 == suffix)
     c = *input_line_pointer++;
 
   if (small)
@@ -810,13 +812,15 @@ operand (expressionP)
     case '9':
       input_line_pointer--;
 
-      integer_constant (flag_m68k_mri ? 0 : 10, expressionP);
+      integer_constant ((NUMBERS_WITH_SUFFIX || flag_m68k_mri) 
+                        ? 0 : 10,
+                        expressionP);
       break;
 
     case '0':
       /* non-decimal radix */
 
-      if (flag_m68k_mri)
+      if (NUMBERS_WITH_SUFFIX || flag_m68k_mri)
        {
          char *s;
 
@@ -829,8 +833,26 @@ operand (expressionP)
              integer_constant (0, expressionP);
              break;
            }
-       }
-
+          if (NUMBERS_WITH_SUFFIX)
+            {
+              /* Check for a binary constant.  */
+              for (s = input_line_pointer; *s == '0' || *s == '1'; s++)
+                ;
+              if (toupper (*s) == 'B')
+                {
+                  integer_constant (0, expressionP);
+                  break;
+                }
+              /* Check for an octal constant.  */
+              for (s = input_line_pointer; *s >= '0' && *s <= '7'; s++)
+                ;
+              if (toupper (*s) == 'Q')
+                {
+                  integer_constant (0, expressionP);
+                  break;
+                }
+            }
+        }
       c = *input_line_pointer;
       switch (c)
        {
@@ -840,7 +862,7 @@ operand (expressionP)
        case 'Q':
        case '8':
        case '9':
-         if (flag_m68k_mri)
+         if (NUMBERS_WITH_SUFFIX || flag_m68k_mri)
            {
              integer_constant (0, expressionP);
              break;
@@ -873,7 +895,7 @@ operand (expressionP)
          break;
 
        case 'b':
-         if (LOCAL_LABELS_FB && ! flag_m68k_mri)
+         if (LOCAL_LABELS_FB && ! flag_m68k_mri && ! NUMBERS_WITH_SUFFIX)
            {
              /* This code used to check for '+' and '-' here, and, in
                 some conditions, fall through to call
This page took 0.043537 seconds and 4 git commands to generate.