ack/mach/proto/as/comm3.c
George Koehler 054b9c87e1 Add .data8 for 8-byte literal integers to the assembler.
This takes literal integers, not expressions, because each machine
defines its own valu_t for expressions, but valu_t can be too narrow
for an 8-byte integer, and I don't want to change all the machines to
use a wider valu_t.  Instead, change how the assembler parses literal
integers.  Remove the NUMBER token and add a NUMBER8 token for an
int64_t.  The new .data8 pseudo emits all 8 bytes of the int64_t;
expressions narrow the int64_t to a valu_t.  Don't add any checks for
integer overflow; expressions and .data* pseudos continue to ignore
overflow when a number is too wide.

This commit requires int64_t and uint64_t in the C compiler to build
the assembler.  The ACK's own C compiler doesn't have these.

For the assembler's temporary file, add NUMBER4 to store 4-byte
integers.  NUMBER4 acts like NUMBER[0-3] and only stores a
non-negative integer.  Each negative integer now takes 8 bytes (up
from 4) in the temporary file.

Move the `\fI` and `\fP` in the uni_ass(6) manual, so the square
brackets in `thing [, thing]*` are not italic.  This looks nicer in my
terminal, where italic text is underlined.
2019-08-13 11:47:44 -04:00

54 lines
1.1 KiB
C

/* $Id$ */
/*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
/* @(#)comm3.c 1.1 */
/*
* storage allocation for variables
*/
#include "comm0.h"
#define extern /* empty, to force storage allocation */
#include "comm1.h"
#undef extern
struct outhead outhead = {
O_MAGIC, O_STAMP, 0
};
#include "y.tab.h"
item_t keytab[] = {
{0, EXTERN, 0, ".define"},
{0, EXTERN, 0, ".extern"},
{0, DOT, 0, "."},
{0, DATA, RELO1, ".data1"},
{0, DATA, RELO2, ".data2"},
{0, DATA, RELO4, ".data4"},
{0, DATA8, 0, ".data8"},
{0, DATAF, 4, ".dataf4"},
{0, DATAF, 8, ".dataf8"},
{0, ASCII, 0, ".ascii"},
{0, ASCII, 1, ".asciz"},
{0, ALIGN, 0, ".align"},
{0, ASSERT, 0, ".assert"},
{0, SPACE, 0, ".space"},
{0, COMMON, 0, ".comm"},
{0, SECTION, 0, ".sect"},
{0, BASE, 0, ".base"},
{0, SYMB, 0, ".symb"},
{0, SYMD, 0, ".symd"},
{0, LINE, 0, ".line"},
{0, FILe, 0, ".file"},
#ifdef LISTING
{0, LIST, 0, ".nolist"},
{0, LIST, 1, ".list"},
#endif
#include "mach3.c"
{0, 0, 0, 0}
};