functionality to break out of assembler loops.
+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.
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)
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
/* 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;
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':
case 'd':
case 'D':
- if (flag_m68k_mri)
+ if (flag_m68k_mri || NUMBERS_WITH_SUFFIX)
{
integer_constant (0, expressionP);
break;
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;
}
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. */
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));