From 07d012f66c135c8d021001454bc14b6d0d9ace8e Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 3 Nov 1995 18:31:25 +0000 Subject: [PATCH] * as.c (main): On TC_A29K, call macro_init with macro_alternate set to 1. * macro.c (get_any_string): Don't keep quotes if macro_strip_at is set, even if macro_alternate is set. (get_apost_token): If macro_strip_at, only skip kind if it is '@'. (sub_actual): If macro_strip_at, and kind is '@', don't look up the token unless it ended in '@'. * config/tc-a29k.c (line_separator_chars): Remove '@'. * doc/c-a29k.texi: Document macro usage on A29K. --- gas/ChangeLog | 12 ++++++++++++ gas/config/tc-a29k.c | 2 +- gas/doc/c-a29k.texi | 16 ++++++++++------ gas/macro.c | 31 +++++++++++++++++++++++-------- 4 files changed, 46 insertions(+), 15 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 74cd48d11c..f01840fc46 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,15 @@ +Fri Nov 3 13:02:59 1995 Ian Lance Taylor + + * as.c (main): On TC_A29K, call macro_init with macro_alternate + set to 1. + * macro.c (get_any_string): Don't keep quotes if macro_strip_at is + set, even if macro_alternate is set. + (get_apost_token): If macro_strip_at, only skip kind if it is '@'. + (sub_actual): If macro_strip_at, and kind is '@', don't look up + the token unless it ended in '@'. + * config/tc-a29k.c (line_separator_chars): Remove '@'. + * doc/c-a29k.texi: Document macro usage on A29K. + Thu Nov 2 23:07:57 1995 Ian Lance Taylor * config/tc-m68k.c (m68k_ip): Handle new 'W' place, meaning a diff --git a/gas/config/tc-a29k.c b/gas/config/tc-a29k.c index 9832a3808e..96b13d9dfc 100644 --- a/gas/config/tc-a29k.c +++ b/gas/config/tc-a29k.c @@ -104,7 +104,7 @@ const char line_comment_chars[] = "#"; /* We needed an unused char for line separation to work around the lack of macros, using sed and such. */ -const char line_separator_chars[] = "@"; +const char line_separator_chars[] = ""; /* Chars that can be used to separate mant from exp in floating point nums */ const char EXP_CHARS[] = "eE"; diff --git a/gas/doc/c-a29k.texi b/gas/doc/c-a29k.texi index 1e5383b79d..771831a2ef 100644 --- a/gas/doc/c-a29k.texi +++ b/gas/doc/c-a29k.texi @@ -31,10 +31,20 @@ @node AMD29K Syntax @section Syntax @menu +* AMD29K-Macros:: Macros * AMD29K-Chars:: Special Characters * AMD29K-Regs:: Register Names @end menu +@node AMD29K-Macros +@subsection Macros + +@cindex Macros, AMD 29K +@cindex AMD 29K macros +The macro syntax used on the AMD 29K is like that described in the AMD +29K Family Macro Assembler Specification. Normal @code{@value{AS}} +macros should still work. + @node AMD29K-Chars @subsection Special Characters @@ -42,12 +52,6 @@ @cindex AMD 29K line comment character @samp{;} is the line comment character. -@cindex line separator, AMD 29K -@cindex AMD 29K line separator -@cindex statement separator, AMD 29K -@cindex AMD 29K statement separator -@samp{@@} can be used instead of a newline to separate statements. - @cindex identifiers, AMD 29K @cindex AMD 29K identifiers The character @samp{?} is permitted in identifiers (but may not begin diff --git a/gas/macro.c b/gas/macro.c index e256feebb6..5743f79536 100644 --- a/gas/macro.c +++ b/gas/macro.c @@ -23,7 +23,11 @@ #include "config.h" #include +#ifdef HAVE_STRING_H #include +#else +#include +#endif #include #ifdef HAVE_STDLIB_H #include @@ -382,7 +386,9 @@ get_any_string (idx, in, out, expand, pretend_quoted) || in->ptr[idx] == '<' || (macro_alternate && in->ptr[idx] == '\'')) { - if (macro_alternate && expand) + if (macro_alternate + && ! macro_strip_at + && expand) { /* Keep the quotes */ sb_add_char (out, '\"'); @@ -573,8 +579,10 @@ get_apost_token (idx, in, name, kind) int kind; { idx = get_token (idx, in, name); - if (idx < in->len && in->ptr[idx] == kind - && (! macro_mri || macro_strip_at)) + if (idx < in->len + && in->ptr[idx] == kind + && (! macro_mri || macro_strip_at) + && (! macro_strip_at || kind == '@')) idx++; return idx; } @@ -582,8 +590,8 @@ get_apost_token (idx, in, name, kind) /* Substitute the actual value for a formal parameter. */ static int -sub_actual (src, in, t, formal_hash, kind, out, copyifnotthere) - int src; +sub_actual (start, in, t, formal_hash, kind, out, copyifnotthere) + int start; sb *in; sb *t; struct hash_control *formal_hash; @@ -591,11 +599,18 @@ sub_actual (src, in, t, formal_hash, kind, out, copyifnotthere) sb *out; int copyifnotthere; { + int src; formal_entry *ptr; - src = get_apost_token (src, in, t, kind); - /* See if it's in the macro's hash table */ - ptr = (formal_entry *) hash_find (formal_hash, sb_terminate (t)); + src = get_apost_token (start, in, t, kind); + /* See if it's in the macro's hash table, unless this is + macro_strip_at and kind is '@' and the token did not end in '@'. */ + if (macro_strip_at + && kind == '@' + && (src == start || in->ptr[src - 1] != '@')) + ptr = NULL; + else + ptr = (formal_entry *) hash_find (formal_hash, sb_terminate (t)); if (ptr) { if (ptr->actual.len)