aboutsummaryrefslogtreecommitdiff
path: root/gas/read.c
diff options
context:
space:
mode:
authorTimothy Wall <twall@alum.mit.edu>2000-02-08 19:06:00 +0000
committerTimothy Wall <twall@alum.mit.edu>2000-02-08 19:06:00 +0000
commit6dc19fc4d614ca0d241cace28ea999dcf9f2888f (patch)
treea8ce8600918b175eceb1584592c4bc1fd33132e1 /gas/read.c
parentf15632584b5f2c0355fcc0f354da079b240aedf2 (diff)
downloadgdb-6dc19fc4d614ca0d241cace28ea999dcf9f2888f.zip
gdb-6dc19fc4d614ca0d241cace28ea999dcf9f2888f.tar.gz
gdb-6dc19fc4d614ca0d241cace28ea999dcf9f2888f.tar.bz2
Remove redundant code for checking numbers with suffixes. Add
functionality to break out of assembler loops.
Diffstat (limited to 'gas/read.c')
-rw-r--r--gas/read.c38
1 files changed, 34 insertions, 4 deletions
diff --git a/gas/read.c b/gas/read.c
index e871166..c510893 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -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. */