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