Commit Graph

33 Commits

Author SHA1 Message Date
Ian Lance Taylor
987013cd03 Add some support for i960 MRI compatibility mode.
* config/tc-i960.c (md_pseudo_table): Add endian.
	(get_args): Don't discard a space between alphanumeric characters.
	(get_cdisp): Change text_section to now_seg.
	(s_endian): New static function.
	* config/tc-i960.h (MRI_MODE_NEEDS_PSEUDO_DOT): Define.
	* expr.h (operatorT): Add O_logical_not, O_logical_and, and
	O_logical_or.
	* expr.c (operand): Treat '!' as logical not operator.  If
	TC_I960, in MRI mode permit `sizeof secname' and `startof
	secname'.
	(op_rank): Bump values by 2 to make room for && and ||.  Add
	entries for !, &&, and ||.
	(expr_begin): Only do MRI changes if TC_M68K.
	(operator): Recognize || and &&.
	(expr): Handle new operatorT values.
	* symbols.c (resolve_symbol_value): Handle new operatorT values.
	(print_expr_1): Likewise.
	* read.c (potable): Add debug, err, irep, irepc, print, purgem,
	and rep.
	(read_a_source_file): Handle MRI_MODE_NEEDS_PSEUDO_DOT.
	(mri_comment_field): Only handle weird comments if TC_M68K.
	(s_err): New function.
	(s_org): Only punt in MRI mode if TC_M68K.
	(s_mri_sect): Write TC_I960 version.
	(s_print, s_purgem): New functions.
	* read.h (s_err, s_print, s_purgem): Declare.
	* cond.c (s_ifeqs): Implement.
	(ignore_input): Handle MRI_MODE_NEEDS_PSEUDO_DOT.
	* macro.c (macro_strip_at): New static variable.
	(macro_init): Add strip_at parameter.
	(do_formals): If macro_strip_at, change NARG to $NARG.
	(define_macro): Skip a comma after the macro name.
	(get_apost_token): Skip character if macro_strip_at, even if
	macro_mri.
	(macro_expand_body): If macro_strip_at, don't recognize parameters
	in strings unless they are preceded by an '@'.  If macro_strip_at,
	pass '@' as strip character to sub_actual.  If macro_strip_at,
	strip '@' characters.
	(macro_expand): If macro_strip_at, change NARG to $NARG.
	(delete_macro): New function.
	(expand_irp): Skip leading and trailing '"' characters if irpc.
	* macro.h (macro_init): Mention new strip_at parameter.
	(delete_macro): Declare.
	* as.c (main): If TC_I960, pass flag_mri to macro_init as
	strip_at; otherwise, pass 0.
	* gasp.c (process_pseudo_op): Pass 0 to macro_init as strip_at.
	(main): Likewise.
	* doc/as.texinfo: Document i960 MRI mode.

	* as.c (show_usage): Mention --defsym.
1995-09-29 19:36:07 +00:00
Ian Lance Taylor
1359db1b8c * gasp.c (show_usage): Put program_name argument in first fprintf,
not second.
1995-09-08 04:30:24 +00:00
Stan Shebs
dcf62f7359 * config/tc-mips.c: Remove CYGNUS LOCAL comments.
(md_begin): Use 0/1 instead of TRUE/FALSE.
	(md_show_usage): Break up long format string for the benefit
	of lame compilers.
	* config/tc-m68k.c (md_show_usage): Ditto.
	* gasp.c (show_usage): Ditto.
	* macro.c (check_macro): Cast result of hash_find.
1995-09-06 00:33:55 +00:00
Ian Lance Taylor
69cc18d2f0 * gasp.c (as_abort): New function.
* sb.c (sb_build): Revert yesterday's patch.
1995-08-25 02:00:39 +00:00
Ian Lance Taylor
7e047ac2c1 Add support for macros.
* as.c: Include sb.h and macro.h.
	(max_macro_next): New global variable.
	(main): Call macro_init.
	(macro_expr): New static function.
	* as.h (max_macro_nest): Declare.
	* read.c (line_label): Rename from mri_line_label.  Change all
	uses.
	(potable): Add exitm, irp, irpc, macro, mexit, rept.
	(read_a_source_file): Always clear line_label at the start of a
	line, not just when flag_mri or LABELS_WITHOUT_COLONS.  Fixup
	MRI/LABELS_WITHOUT_COLONS handling.  In MRI mode, permit label:
	equ val.  Set line_label when calling colon.  In MRI mode, a
	leading '.' does not imply a pseudo-op.  Check for macro expansion
	before calling md_assemble.
	(s_irp): New function.
	(get_line_sb): New static function.
	(s_macro): New function.
	(s_mexit): New function.
	(s_rept): New function.
	* read.h (line_label): Rename from mri_line_label.
	(s_irp, s_rept): Declare.
	(s_macro, s_mexit): Declare.
	* input-scrub.c: Include sb.h.
	(sb_index, from_sb): New static variables.
	(macro_nest): New static variable.
	(struct input_save): Add sb_index and from_sb fields.  Change
	next_saved_file field to be struct input_save *.
	(next_saved_file): Changed to be struct input_save *.
	(input_scrub_push): Change to return type struct input_save *.
	Save sb_index and from_sb.
	(input_scrub_pop): Change parameter type to struct input_save *.
	Restore sb_index and from_sb.
	(input_scrub_include_sb): New function.
	(input_scrub_next_buffer): Handle reading from from_sb.
	(bump_line_counters): Only increment lines if not using from_sb.
	* config/tc-m68k.c (opt_table): Add nest.
	(opt_nest): New static function.
	* gasp.c: Include sb.h and macro.h.  Move all sb related functions
	and definitions to sb.h and sb.c.  Move all macro related
	functions and definitions to macro.h and macro.c.
	* sb.h, sb.c: New files, extracted from gasp.c.
	* macro.h, macro.c: Likewise.
	* Makefile.in (OBJS): Add sb.o and macro.o
	(GASPOBJS): Define.
	(gasp.new): Depend upon $(GASPOBJS).  Use $(GASPOBJS) to link.
	(TARG_CPU_DEP_m68k): Depend upon subsegs.h.
	(gasp.o): Depend upon sb.h and macro.h.
	(sb.o): New target.
	(macro.o): New target.
	(as.o): Depend upon sb.h and macro.h.
	(input-scrub.o): Depend upon sb.h.
	(read.o): Depend upon sb.h and macro.h.
1995-08-21 18:35:11 +00:00
Ian Lance Taylor
f8d6e6cd08 * gasp.c (include_print_where_line): Always subtract 1 from
linecount before printing it.
	(process_file): In MRI mode, lines beginning with '*' or '!' are
	comments.
	(do_reg): In MRI mode, don't require parentheses.
	(do_include): In MRI mode, don't requires quotes.  If the file can
	not be found in the include path, try opening it in the current
	directory.  Print the file name correctly in the error message.
	(chartype_init): In MRI mode, set FIRSTBIT for '.'.
	(main): Set comment_char to ';' when entering MRI mode.
1995-08-18 15:09:57 +00:00
Ian Lance Taylor
c842dd375d * config/tc-m68k.c (md_pseudo_table): Add MRI structured control
directives: if, if.b, if.w, if.l, else, else.s, else.l, endi,
	break, break.s, break.l, next, next.s, next.l, for, for.b, for.w,
	for.l, endf, repeat, until, until.b, until.w, until.l, while,
	while.b, while.w, while.l, endw.
	(enum mri_control_type): Define.
	(struct mri_control_info): Define.
	(mri_control_stack): New static variable.
	(mri_control_index): New static variable.
	(mri_control_label): New static function.
	(push_mri_control, pop_mri_control): New static functions.
	(parse_mri_condition): New static function.
	(parse_mri_control_operand): New static function.
	(swap_mri_condition, reverse_mri_condition): New static functions.
	(build_mri_control_operand): New static function.
	(parse_mri_control_expression): New static function.
	(s_mri_if, s_mri_else, s_mri_endi): New static functions.
	(s_mri_break, s_mri_next): New static functions.
	(s_mri_for, s_mri_endf): New static functions.
	(s_mri_repeat, s_mri_until): New static functions.
	(s_mri_while, s_mri_endw): New static functions.
	* gasp.c (mrikinfo): Remove IF.
	* expr.c (get_symbol_end): Accept \001 as part of a name.
1995-08-15 19:42:47 +00:00
Ian Lance Taylor
e15126c456 * gasp.c (do_align, get_any_string): Mark as static.
(do_assigna, do_assignc, new_file): Likewise.
1995-08-14 22:00:21 +00:00
Ian Lance Taylor
7f5adcba04 * gasp.c (strip_comments): Comment out; it's not used.
(do_end): Add parameter.  In MRI mode, print it out.
	(do_irp): New static function.
	(sub_actual): Change parameter m to formal_hash, changing type
	from macro_entryh * to hash_table *.
	(macro_expand_body): New static function, broken out of
	macro_expand.
	(macro_expand): Call macro_expand_body.
	(K_*): Fully parenthesize.
	(K_IRP, K_IRPC): Define.
	(mrikinfo): Add IRP and IRPC.
	(process_pseudo_op): In MRI mode, print out END pseudo-op.  Pass
	line to do_end.  Handle K_IRP and K_IRPC.
1995-08-14 20:03:38 +00:00
Ian Lance Taylor
19be7c0800 * gasp.c (change_base): Don't treat ' specially in MRI mode.
(process_file): Don't warn about missing END in MRI mode.
	(do_if): New static function.
	(get_mri_string, do_ifc): New static functions.
	(buffer_and_nest): Treat MRI mode like alternate syntax mode.
	(do_aendr): Change error message in MRI mode.
	(do_arepeat): Use REPT/ENDR in MRI mode.
	(do_formals): In MRI mode, add special NARG formal.
	(macro_expand): Various changes for MRI mode: permit a qualifier
	on the macro name; set special NARG formal; permit unnamed
	positional arguments; use && to concatenate named parameters;
	permit \d to specify an unnamed parameter; permit named parameters
	to not start with \; use == to see if a parameter exists.
	(getstring): In MRI mode, allow <> to quote a string.
	(K_IFEQ, K_IFNE, K_IFLT, K_IFLE, K_IFGE, K_IFGT): Define.
	(K_IFC, K_IFNC): Define.
	(struct keyword): Name structure used in kinfo array.
	(mrikinfo): New static array.
	(process_pseudo_op): Don't require leading '.' in MRI mode.
	Handle new MRI pseudo-op definitions.
	(add_keyword): New static function, broken out of process_init.
	(process_init): Use add_keyword.  In MRI mode, add mrikinfo table.
	(long_options): Add "mri".
	(show_usage): Mention -M/--mri.
	(main): Call process_init after processing arguments.  Handle -M.
	* doc/gasp.texi: Document -M/--mri.
1995-08-11 23:49:17 +00:00
Steve Chamberlain
4f2f30116b * gasp.c (main): Parse -I option.
(do_include): Look through include list.
	* gasp.c (change_base): Don't modify numbers in strings.
	(pr7583)

 	* testsuite/gasp/*: New.
	* testsuite/Makefile.in: Use gasp tests.
	* testsuite/config/default.exp: Add gasp stuff.
1995-08-01 03:35:23 +00:00
Steve Chamberlain
5f57cea3f6 * gasp.c (change_base): Don't modify numbers in strings. (pr7583)
* testsuite/gas/gasp/*: New.
1995-08-01 01:31:42 +00:00
Ian Lance Taylor
fe98e22d83 * gasp.c (process_assigns): Use toupper before comparing against
upper case letter.
	(whatcond): Likewise.
PR 7281.
1995-07-19 16:22:14 +00:00
Ken Raeburn
a2a5a4fa41 fsf address update 1995-07-06 21:18:08 +00:00
Steve Chamberlain
85b369b3a4 * gasp.c (do_print, do_form, buffer_and_nest): Use case insensitive
string compares. gas/7274.
1995-06-21 21:37:13 +00:00
Ken Raeburn
078d1a5afa From Richard Earnshaw (rearnsha@armltd.co.uk):
* gasp.c (istrue): Correctly test for string inequality.
1995-05-19 18:43:49 +00:00
Ken Raeburn
11618ce8f2 gcc lint 1995-01-19 21:04:08 +00:00
Ken Raeburn
2a6978af8d * gasp.c: Include string.h. Put config.h before other includes. 1995-01-06 22:00:50 +00:00
Ken Raeburn
b11fb93989 Conversion to autoconf:
* acconfig.h, aclocal.m4: New files.
* configure.in: Rewritten (except for some target-specific code) for autoconf.
* conf.in, configure: New files, generated from the above.
* Makefile.in: Changed magic sequence indicating insertion of makefile
fragments.
(VPATH, srcdir, CC, LIBS, OBJS dependencies): Use @-substitutions from
configure.
(LINKED_HEADERS): Deleted a.out.gnu.h, a.out.h, and host.h.
(config.status, configure): Rewrite rules.
(config-stamp): Depend on conf.  Skip variables that configure is now
substituting itself.
(*.o dependencies): Deleted host.h.
(distclean, realclean): Don't delete host.h.
* as.c: Don't include stdio.h, string.h, sys/types.h.  Include signal.h after
as.h.
* as.h: Include alloca-conf.h first.  Include ctype.h, string.h, strings.h,
stdlib.h, unistd.h, sys/types.h, fopen-bin.h, fopen-same.h, as suggested by
autoconf test results.
[BROKEN_ASSERT]: Don't include assert.h.
(strdup): Declare.
(volatile, const): Define if not __STDC__ and not already defined.
(malloc, realloc) [NEED_MALLOC_DECLARATION]: Declare.
(free) [NEED_FREE_DECLARATION]: Declare.
* gasp.c: Include config.h, stdlib.h (if HAVE_STDLIB_H).  Don't include host.h.
(malloc) [NEED_MALLOC_DECLARATION]: Declare.
* messages.c: Include as.h first.  Include errno.h only if HAVE_ERRNO_H.  If
HAVE_VARARGS_H and not __STDC__, undefine HAVE_STDARG_H.  Set NO_STDARG and
NO_VARARGS as appropriate.
* doc/Makefile.in (srcdir, INSTALL, INSTALL_PROGRAM, INSTALL_DATA): Use
autoconf @-substitutions.
1994-08-28 07:59:06 +00:00
Ian Lance Taylor
a2a1a548c7 gcc lint.
* as.c (main): Move a inside the #if 0 block which uses it.
	* ecoff.c (current_stabs_filename): Make const.
	* frags.h (frag_align_pattern): Declare.
	* gasp.c (new_file): Cast isp to long, and use %ld to print it.
	* config/tc-alpha.h (md_operand): Add cast to void.
	(alpha_do_align): Declare argument types.
	(tc_get_register): Declare.
	(alpha_frob_ecoff_data): Declare.
	* config/tc-alpha.c: Include <ctype.h>.
	(s_mask): Don't declare; does not exist.
	(line_comment_chars): Remove /* from descriptive comment.
	(tc_get_register): Remove unused local reg.
	(tc_gen_reloc): Don't bother to compare unsigned to zero.
	(s_base): Correct warning to actually print register number.
	(md_begin): Remove unused locals retval, lose, and i.
	(alpha_fix_adjustable): Move default case inside switch to avoid
	warning.
	(load_symbol_address): Remove unused locals reloc_addr, p, sym,
	and addend.
	(emit_byte_manip_r): Declare types for all arguments.
	(emit_extract_r, emit_insert_r, emit_mask_r): Likewise.
	(emit_sign_extend, emit_bis_r, s_proc): Likewise.
	(alpha_ip): Use sprint_value to print offsetT value.  Remove
	unused local size.  Remove unused label get_macro.
	(alpha_do_align): Make fill const.
	(md_apply_fix): Remove unused label check_zov.
1994-08-24 21:48:18 +00:00
Steve Chamberlain
6f15d409d0 * (process_pseudo_op): Pass right are do do_aif.
(get_any_string): New arg 'pretend_quote'.
	(get_and_process, do_formals, macro_expand, do_sdata,
	process_pseudo_op): Use new arg.
1994-07-08 22:34:11 +00:00
Steve Chamberlain
13d9fd33a4 * 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.
1994-07-08 00:13:14 +00:00
Steve Chamberlain
40b559d27f * configure.in (i386-go32): When it's a host set
host_makefile_frag.
	* gasp.c  (get_any_string): Fix handling of % when in PharLap
	mode.
1994-06-28 01:20:04 +00:00
Ken Raeburn
a8773b7d26 oops, left out var decl 1994-06-02 23:37:45 +00:00
Ken Raeburn
7577d7b645 (hash_new_table): Clear newly allocated table. 1994-06-02 16:37:55 +00:00
Ian Lance Taylor
2db90a6320 * gasp.c: Include libiberty.h.
(main): Remove unused variable i.
1994-05-06 18:39:04 +00:00
Steve Chamberlain
fa1a86f302 * configure.in (i386-*-go32): Uses coff now.
* gasp.c (main): Now takes -D on command line.
	(show_usage): Describe new options.
1994-04-27 18:15:14 +00:00
Ken Raeburn
d924d209d3 * gasp.c: Include ctype.h. 1994-04-20 22:48:12 +00:00
Ian Lance Taylor
950df4212c * gasp.c (kinfo): Fully bracket initializer. 1994-02-02 16:43:00 +00:00
Ken Raeburn
6761eb8b9e * gasp.c (malloc): Don't declare, since host.h or system header files may
declare it differently.

(Actually, the only use is in xmalloc; if xmalloc didn't also zero out the
region of memory, I'd delete the function altogether and use the libiberty
version...)
1994-02-02 00:35:37 +00:00
Steve Chamberlain
e2847e64ff * gasp.c: Include host.h. 1994-02-01 18:58:32 +00:00
Steve Chamberlain
b0f2092b3d New file. 1994-01-31 16:40:55 +00:00
Steve Chamberlain
7cb520f090 New file. 1994-01-31 16:37:19 +00:00