handle enums w/o tags as structure/union members
[unix-history] / usr / src / old / as.vax / asscan.h
CommitLineData
f70ab843
RH
1/*
2 * Copyright (c) 1982 Regents of the University of California
ec43bca4 3 * @(#)asscan.h 4.9 %G%
f70ab843 4 */
d731b8e1
BJ
5/*
6 * The character scanner is called to fill up one token buffer
7 *
8 * However, once the tokens are filled up by the
9 * character scanner, they are used in both the first and the second
10 * pass. Holes created by .stab removal are replaced
11 * with 'skip' tokens that direct the second pass to ignore the
12 * following tokens.
13 */
14
6dd84c64 15#define TOKBUFLG 4096
d731b8e1
BJ
16#define MAXVAX 32
17#define SAFETY 16
18
19#define AVAILTOKS TOKBUFLG -\
20 sizeof(int) -\
21 sizeof (struct tokbufdesc *) -\
22 MAXVAX - SAFETY
23
24struct tokbufdesc{
25 int tok_count; /*absolute byte length*/
26 struct tokbufdesc *tok_next;
27 char toks[AVAILTOKS];
28 char bufovf[MAXVAX + SAFETY];
29};
30/*
31 * Definitions for handling tokens in the intermediate file
32 * buffers.
33 *
34 * We want to have the compiler produce the efficient auto increment
35 * instruction for stepping through the buffer of tokens. We must
36 * fool the type checker into thinking that a pointer can point
37 * to various size things.
38 */
39
f70ab843
RH
40typedef int inttoktype;
41typedef char bytetoktype;
d731b8e1
BJ
42
43typedef char *ptrall; /*all uses will be type cast*/
ad67d5e5 44typedef u_short lgtype; /*for storing length of strings or skiping*/
d731b8e1
BJ
45/*
46 * defintions for putting various typed values
47 * into the intermediate buffers
48 * ptr will ALWAYS be of type ptrall
49 */
50
51#define pchar(ptr,val) *ptr++ = val
52#define puchar(ptr,val) *ptr++ = val
53
54#define pshort(ptr,val) *(short *)ptr=val, ptr += sizeof(short)
ad67d5e5 55#define plgtype(ptr,val) *(lgtype *)ptr=val, ptr += sizeof(lgtype)
f70ab843 56#define pushort(ptr,val) *(u_short *)ptr=val, ptr += sizeof(short)
d731b8e1 57#define pint(ptr,val) *(int *)ptr = val, ptr += sizeof(int)
f70ab843 58#define puint(ptr,val) *(u_int int *)ptr=val, ptr += sizeof(int)
d731b8e1 59#define plong(ptr,val) *(long *)ptr = val, ptr += sizeof(long)
f70ab843
RH
60#define pulong(ptr,val) *(u_int long *)ptr=val, ptr += sizeof(long)
61#define pnumber(ptr,val) *(Bignum*)ptr=val, ptr += sizeof(Bignum)
62#define popcode(ptr,val) *(struct Opcode*)ptr=val, ptr += sizeof(struct Opcode)
63
d731b8e1
BJ
64#define pptr(ptr,val) *(int *)ptr = (val), ptr += sizeof(ptrall)
65#define ptoken(ptr,val) *ptr++ = val
d731b8e1
BJ
66#define pskiplg(ptr,val) *(lgtype *)ptr = val, ptr += sizeof(short)
67
68#define gchar(val, ptr) val = *ptr++
69#define guchar(val, ptr) val = *ptr++
70
71#define gshort(val, ptr) val = *(short *)ptr , ptr += sizeof (short)
ad67d5e5 72#define glgtype(val, ptr) val = *(lgtype *)ptr , ptr += sizeof (lgtype)
f70ab843 73#define gushort(val, ptr) val = *(u_short *)ptr , ptr += sizeof (short)
d731b8e1 74#define gint(val, ptr) val = *(int *)ptr, ptr += sizeof (int)
f70ab843 75#define guint(val, ptr) val = *(u_int *)ptr, ptr += sizeof (int)
d731b8e1 76#define glong(val, ptr) val = *(long *)ptr, ptr += sizeof (long)
f70ab843
RH
77#define gulong(val, ptr) val = *(u_int *)ptr, ptr += sizeof (long)
78#define gnumber(val, ptr) val = *(Bignum *)ptr, ptr += sizeof(Bignum)
79#define gopcode(val, ptr) val = *(struct Opcode *)ptr, ptr += sizeof(struct Opcode)
80
d731b8e1
BJ
81#define gptr(val, ptr) val = *(int *)ptr, ptr += sizeof (ptrall)
82#define gtoken(val, ptr) val = *ptr++
d731b8e1
BJ
83#define gskiplg(val, ptr) val = *(lgtype *)ptr, ptr += sizeof (short)
84
d731b8e1
BJ
85extern ptrall tokptr; /*the next token to consume, call by copy*/
86extern ptrall tokub; /*current upper bound in the current buffer*/