* gasp.c (get_any_string): Cope with getting a string with an

alternate base specifier.
	(do_aif, do_aelse): Only enable output if expression is true and previous
	level was on.
	(chartype_init):  Add BASEBIT chartype.
	(process_pseudo_op):  Notice nesteed AIFs.
This commit is contained in:
Steve Chamberlain 1994-07-08 00:13:14 +00:00
parent 109babdf49
commit 13d9fd33a4
2 changed files with 50 additions and 18 deletions

View File

@ -1,5 +1,22 @@
Thu Jul 7 17:04:03 1994 Steve Chamberlain (sac@jonny.cygnus.com)
* gasp.c (get_any_string): Cope with getting a string with an
alternate base specifier.
(do_aif, do_aelse): Only enable output if expression is true and previous
level was on.
(chartype_init): Add BASEBIT chartype.
(process_pseudo_op): Notice nesteed AIFs.
Thu Jul 7 12:30:22 1994 Steve Chamberlain (sac@jonny.cygnus.com)
* h8300.c (do_a_fix_imm): Code for 2 bit reloc type using in trapa
insn. (fix pr 5165, 5174)
Thu Jul 7 11:31:32 1994 Jeff Law (law@snake.cs.utah.edu) Thu Jul 7 11:31:32 1994 Jeff Law (law@snake.cs.utah.edu)
* config/tc-hppa.c (R_DLT_REL): If it isn't defined, then define
to an appropriate value to avoid losing on old hpux systems.
* config/tc-hppa.c (hppa_fix_adjustable): Reject reductions for * config/tc-hppa.c (hppa_fix_adjustable): Reject reductions for
symbols in DLT relative relocs. symbols in DLT relative relocs.
(tc_gen_reloc): Zero out the addend field for DLT relative relocs. (tc_gen_reloc): Zero out the addend field for DLT relative relocs.

View File

@ -150,13 +150,13 @@ int string_count[max_power_two];
#define SEPBIT 4 #define SEPBIT 4
#define WHITEBIT 8 #define WHITEBIT 8
#define COMMENTBIT 16 #define COMMENTBIT 16
#define BASEBIT 32
#define ISCOMMENTCHAR(x) (chartype[(unsigned)(x)] & COMMENTBIT) #define ISCOMMENTCHAR(x) (chartype[(unsigned)(x)] & COMMENTBIT)
#define ISFIRSTCHAR(x) (chartype[(unsigned)(x)] & FIRSTBIT) #define ISFIRSTCHAR(x) (chartype[(unsigned)(x)] & FIRSTBIT)
#define ISNEXTCHAR(x) (chartype[(unsigned)(x)] & NEXTBIT) #define ISNEXTCHAR(x) (chartype[(unsigned)(x)] & NEXTBIT)
#define ISSEP(x) (chartype[(unsigned)(x)] & SEPBIT) #define ISSEP(x) (chartype[(unsigned)(x)] & SEPBIT)
#define ISWHITE(x) (chartype[(unsigned)(x)] & WHITEBIT) #define ISWHITE(x) (chartype[(unsigned)(x)] & WHITEBIT)
#define ISBASE(x) (chartype[(unsigned)(x)] & BASEBIT)
static char chartype[256]; static char chartype[256];
@ -714,10 +714,10 @@ hash_lookup (tab, key)
expression precedence: expression precedence:
( ) ( )
unary + - ~ unary + - ~
* / * /
+ - + -
& &
| ~ | ~
*/ */
@ -1708,12 +1708,16 @@ get_any_string (idx, in, out, expand)
sb_reset (out); sb_reset (out);
idx = sb_skip_white (idx, in); idx = sb_skip_white (idx, in);
if (idx < in->len) if (idx < in->len)
{ {
if (in->ptr[idx] == '%' if (in->len > 2 && in->ptr[idx+1] == '\'' && ISBASE (in->ptr[idx]))
&& alternate {
&& expand) while (!ISSEP (in->ptr[idx]))
sb_add_char (out, in->ptr[idx++]);
}
else if (in->ptr[idx] == '%'
&& alternate
&& expand)
{ {
int val; int val;
char buf[20]; char buf[20];
@ -1725,16 +1729,16 @@ get_any_string (idx, in, out, expand)
sprintf(buf, "%d", val); sprintf(buf, "%d", val);
sb_add_string (out, buf); sb_add_string (out, buf);
} }
else if (in->ptr[idx] == '"' else if (in->ptr[idx] == '"'
|| in->ptr[idx] == '<' || in->ptr[idx] == '<'
|| (alternate && in->ptr[idx] == '\'')) || (alternate && in->ptr[idx] == '\''))
{ {
if (alternate && !expand) if (alternate && !expand)
{ {
/* Keep the quotes */ /* Keep the quotes */
/* sb_add_char (out, '\"');*/ /* sb_add_char (out, '\"');*/
idx = getstring (idx, in, out); idx = getstring (idx, in, out);
/* sb_add_char (out, '\"');*/ /* sb_add_char (out, '\"');*/
} }
else { else {
@ -1756,12 +1760,14 @@ get_any_string (idx, in, out, expand)
while (idx < in->len while (idx < in->len
&& in->ptr[idx] != tchar) && in->ptr[idx] != tchar)
sb_add_char (out, in->ptr[idx++]); sb_add_char (out, in->ptr[idx++]);
if (idx == in->len)
return idx;
} }
sb_add_char (out, in->ptr[idx++]); sb_add_char (out, in->ptr[idx++]);
} }
} }
} }
return idx; return idx;
} }
@ -2367,7 +2373,7 @@ do_aif (idx, in)
FATAL ((stderr, "AIF nesting unreasonable.\n")); FATAL ((stderr, "AIF nesting unreasonable.\n"));
} }
ifi++; ifi++;
ifstack[ifi].on = istrue (idx, in); ifstack[ifi].on = ifstack[ifi-1].on ? istrue (idx, in) : 0;
ifstack[ifi].hadelse = 0; ifstack[ifi].hadelse = 0;
} }
@ -2376,7 +2382,7 @@ do_aif (idx, in)
static void static void
do_aelse () do_aelse ()
{ {
ifstack[ifi].on = !ifstack[ifi].on; ifstack[ifi].on = ifstack[ifi-1].on ? !ifstack[ifi].on : 0;
if (ifstack[ifi].hadelse) if (ifstack[ifi].hadelse)
{ {
ERROR ((stderr, "Multiple AELSEs in AIF.\n")); ERROR ((stderr, "Multiple AELSEs in AIF.\n"));
@ -3368,6 +3374,12 @@ chartype_init ()
|| x == '"' || x == '<' || x == '>' || x == ')' || x == '(') || x == '"' || x == '<' || x == '>' || x == ')' || x == '(')
chartype[x] |= SEPBIT; chartype[x] |= SEPBIT;
if (x == 'b' || x == 'B'
|| x == 'q' || x == 'Q'
|| x == 'h' || x == 'H'
|| x == 'd' || x == 'D')
chartype [x] |= BASEBIT;
if (x == ' ' || x == '\t') if (x == ' ' || x == '\t')
chartype[x] |= WHITEBIT; chartype[x] |= WHITEBIT;
@ -3552,6 +3564,9 @@ process_pseudo_op (idx, line, acc)
{ {
switch (ptr->value.i) switch (ptr->value.i)
{ {
case K_AIF:
do_aif ();
break;
case K_AELSE: case K_AELSE:
do_aelse (); do_aelse ();
break; break;