diff options
-rw-r--r-- | gas/ChangeLog | 10 | ||||
-rw-r--r-- | gas/expr.c | 31 | ||||
-rw-r--r-- | gas/read.c | 38 | ||||
-rw-r--r-- | gas/read.h | 2 |
4 files changed, 53 insertions, 28 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index 807ea28..171a277 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,5 +1,15 @@ 2000-02-08 Timothy Wall <twall@redhat.com> + * read.c (s_rept): Call do_repeat, which abstracts the repeat + logic. + (do_repeat): New. Abstract repeat logic so that a "break" can be + implemented. + (end_repeat): New. Provide support for a "break" out of the + repeat loop. + * read.h: Add prototypes for new functions. + +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 @@ -833,25 +833,6 @@ 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) @@ -888,14 +869,14 @@ operand (expressionP) case 'x': case 'X': - if (flag_m68k_mri) + if (flag_m68k_mri || NUMBERS_WITH_SUFFIX) goto default_case; input_line_pointer++; integer_constant (16, expressionP); break; case 'b': - if (LOCAL_LABELS_FB && ! flag_m68k_mri && ! NUMBERS_WITH_SUFFIX) + 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 @@ -917,7 +898,7 @@ operand (expressionP) /* Fall through. */ case 'B': input_line_pointer++; - if (flag_m68k_mri) + if (flag_m68k_mri || NUMBERS_WITH_SUFFIX) goto default_case; integer_constant (2, expressionP); break; @@ -930,7 +911,9 @@ operand (expressionP) case '5': case '6': case '7': - integer_constant (flag_m68k_mri ? 0 : 8, expressionP); + integer_constant ((flag_m68k_mri || NUMBERS_WITH_SUFFIX) + ? 0 : 8, + expressionP); break; case 'f': @@ -980,7 +963,7 @@ operand (expressionP) case 'd': case 'D': - if (flag_m68k_mri) + if (flag_m68k_mri || NUMBERS_WITH_SUFFIX) { integer_constant (0, expressionP); break; @@ -2644,15 +2644,28 @@ s_rept (ignore) int ignore ATTRIBUTE_UNUSED; { int count; - sb one; - sb many; count = get_absolute_expression (); + do_repeat(count, "REPT", "ENDR"); +} + +/* This function provides a generic repeat block implementation. It allows + different directives to be used as the start/end keys. */ + +void +do_repeat (count, start, end) + int count; + const char *start; + const char *end; +{ + sb one; + sb many; + sb_new (&one); - if (! buffer_and_nest ("REPT", "ENDR", &one, get_line_sb)) + if (! buffer_and_nest (start, end, &one, get_line_sb)) { - as_bad (_("rept without endr")); + as_bad (_("%s without %s"), start, end); return; } @@ -2667,6 +2680,23 @@ s_rept (ignore) buffer_limit = input_scrub_next_buffer (&input_line_pointer); } +/* Skip to end of current repeat loop; EXTRA indicates how many additional + input buffers to skip. Assumes that conditionals preceding the loop end + are properly nested. + + This function makes it easier to implement a premature "break" out of the + loop. The EXTRA arg accounts for other buffers we might have inserted, + such as line substitutions. */ + +void +end_repeat (extra) + int extra; +{ + cond_exit_macro (macro_nest); + while (extra-- >= 0) + buffer_limit = input_scrub_next_buffer (&input_line_pointer); +} + /* Handle the .equ, .equiv and .set directives. If EQUIV is 1, then this is .equiv, and it is an error if the symbol is already defined. */ @@ -116,6 +116,8 @@ extern void stabs_generate_asm_file PARAMS ((void)); extern void stabs_generate_asm_lineno PARAMS ((void)); extern void stabs_generate_asm_func PARAMS ((const char *, const char *)); extern void stabs_generate_asm_endfunc PARAMS ((const char *, const char *)); +extern void do_repeat PARAMS((int,const char *,const char *)); +extern void end_repeat PARAMS((int)); extern void generate_lineno_debug PARAMS ((void)); |