xref: /csrg-svn/sys/ufs/ffs/ffs_tables.c (revision 4473)
1 /* Copyright (c) 1981 Regents of the University of California */
2 
3 /* @(#)ffs_tables.c 1.2 10/07/81 */
4 
5 #include "../h/param.h"
6 
7 /*	partab.c	4.2	81/03/08	*/
8 
9 /*
10  * Table giving parity for characters and indicating
11  * character classes to tty driver.  In particular,
12  * if the low 6 bits are 0, then the character needs
13  * no special processing on output.
14  */
15 
16 unsigned char partab[] = {
17 	0001,0201,0201,0001,0201,0001,0001,0201,
18 	0202,0004,0003,0201,0005,0206,0201,0001,
19 	0201,0001,0001,0201,0001,0201,0201,0001,
20 	0001,0201,0201,0001,0201,0001,0001,0201,
21 	0200,0000,0000,0200,0000,0200,0200,0000,
22 	0000,0200,0200,0000,0200,0000,0000,0200,
23 	0000,0200,0200,0000,0200,0000,0000,0200,
24 	0200,0000,0000,0200,0000,0200,0200,0000,
25 	0200,0000,0000,0200,0000,0200,0200,0000,
26 	0000,0200,0200,0000,0200,0000,0000,0200,
27 	0000,0200,0200,0000,0200,0000,0000,0200,
28 	0200,0000,0000,0200,0000,0200,0200,0000,
29 	0000,0200,0200,0000,0200,0000,0000,0200,
30 	0200,0000,0000,0200,0000,0200,0200,0000,
31 	0200,0000,0000,0200,0000,0200,0200,0000,
32 	0000,0200,0200,0000,0200,0000,0000,0201,
33 
34 	/*
35 	 * 7 bit ascii ends with the last character above,
36 	 * but we contine through all 256 codes for the sake
37 	 * of the tty output routines which use special vax
38 	 * instructions which need a 256 character trt table.
39 	 */
40 
41 	0007,0007,0007,0007,0007,0007,0007,0007,
42 	0007,0007,0007,0007,0007,0007,0007,0007,
43 	0007,0007,0007,0007,0007,0007,0007,0007,
44 	0007,0007,0007,0007,0007,0007,0007,0007,
45 	0007,0007,0007,0007,0007,0007,0007,0007,
46 	0007,0007,0007,0007,0007,0007,0007,0007,
47 	0007,0007,0007,0007,0007,0007,0007,0007,
48 	0007,0007,0007,0007,0007,0007,0007,0007,
49 	0007,0007,0007,0007,0007,0007,0007,0007,
50 	0007,0007,0007,0007,0007,0007,0007,0007,
51 	0007,0007,0007,0007,0007,0007,0007,0007,
52 	0007,0007,0007,0007,0007,0007,0007,0007,
53 	0007,0007,0007,0007,0007,0007,0007,0007,
54 	0007,0007,0007,0007,0007,0007,0007,0007,
55 	0007,0007,0007,0007,0007,0007,0007,0007,
56 	0007,0007,0007,0007,0007,0007,0007,0007
57 };
58 
59 /*
60  * bit patterns for identifying fragments in the block map
61  * used as ((map & around) == inside)
62  */
63 int around[9] = {
64 	0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f, 0xff, 0x1ff, 0x3ff
65 };
66 int inside[9] = {
67 	0x0, 0x2, 0x6, 0xe, 0x1e, 0x3e, 0x7e, 0xfe, 0x1fe
68 };
69 
70 /*
71  * given a block map bit pattern, this table tells whether a
72  * particular size fragment is available.
73  * used as:
74  * if ((1 << (size - 1)) & fragtbl[map]) {
75  *	at least one fragment of the indicated size is available
76  * }
77  * This table is used by the scanc instruction on the VAX to
78  * quickly find an appropriate fragment.
79  */
80 #if FRAG == 4
81 unsigned char fragtbl[256] = {
82 	0x0, 0x1, 0x1, 0x2, 0x1, 0x1, 0x2, 0x4,
83 	0x1, 0x1, 0x1, 0x3, 0x2, 0x3, 0x4, 0x8,
84 	0x1, 0x1, 0x1, 0x3, 0x1, 0x1, 0x3, 0x5,
85 	0x1, 0x1, 0x1, 0x3, 0x3, 0x3, 0x5, 0x9,
86 	0x1, 0x1, 0x1, 0x3, 0x1, 0x1, 0x3, 0x5,
87 	0x1, 0x1, 0x1, 0x3, 0x3, 0x3, 0x5, 0x9,
88 	0x2, 0x3, 0x3, 0x2, 0x3, 0x3, 0x2, 0x6,
89 	0x3, 0x3, 0x3, 0x3, 0x2, 0x3, 0x6, 0xa,
90 	0x1, 0x1, 0x1, 0x3, 0x1, 0x1, 0x3, 0x5,
91 	0x1, 0x1, 0x1, 0x3, 0x3, 0x3, 0x5, 0x9,
92 	0x1, 0x1, 0x1, 0x3, 0x1, 0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, 0x02, 0x03, 0x04, 0x08,
121 	0x01, 0x01, 0x01, 0x03, 0x01, 0x01, 0x03, 0x05,
122 	0x02, 0x03, 0x03, 0x02, 0x04, 0x05, 0x08, 0x10,
123 	0x01, 0x01, 0x01, 0x03, 0x01, 0x01, 0x03, 0x05,
124 	0x01, 0x01, 0x01, 0x03, 0x03, 0x03, 0x05, 0x09,
125 	0x02, 0x03, 0x03, 0x02, 0x03, 0x03, 0x02, 0x06,
126 	0x04, 0x05, 0x05, 0x06, 0x08, 0x09, 0x10, 0x20,
127 	0x01, 0x01, 0x01, 0x03, 0x01, 0x01, 0x03, 0x05,
128 	0x01, 0x01, 0x01, 0x03, 0x03, 0x03, 0x05, 0x09,
129 	0x01, 0x01, 0x01, 0x03, 0x01, 0x01, 0x03, 0x05,
130 	0x03, 0x03, 0x03, 0x03, 0x05, 0x05, 0x09, 0x11,
131 	0x02, 0x03, 0x03, 0x02, 0x03, 0x03, 0x02, 0x06,
132 	0x03, 0x03, 0x03, 0x03, 0x02, 0x03, 0x06, 0x0a,
133 	0x04, 0x05, 0x05, 0x06, 0x05, 0x05, 0x06, 0x04,
134 	0x08, 0x09, 0x09, 0x0a, 0x10, 0x11, 0x20, 0x40,
135 	0x01, 0x01, 0x01, 0x03, 0x01, 0x01, 0x03, 0x05,
136 	0x01, 0x01, 0x01, 0x03, 0x03, 0x03, 0x05, 0x09,
137 	0x01, 0x01, 0x01, 0x03, 0x01, 0x01, 0x03, 0x05,
138 	0x03, 0x03, 0x03, 0x03, 0x05, 0x05, 0x09, 0x11,
139 	0x01, 0x01, 0x01, 0x03, 0x01, 0x01, 0x03, 0x05,
140 	0x01, 0x01, 0x01, 0x03, 0x03, 0x03, 0x05, 0x09,
141 	0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x07,
142 	0x05, 0x05, 0x05, 0x07, 0x09, 0x09, 0x11, 0x21,
143 	0x02, 0x03, 0x03, 0x02, 0x03, 0x03, 0x02, 0x06,
144 	0x03, 0x03, 0x03, 0x03, 0x02, 0x03, 0x06, 0x0a,
145 	0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x07,
146 	0x02, 0x03, 0x03, 0x02, 0x06, 0x07, 0x0a, 0x12,
147 	0x04, 0x05, 0x05, 0x06, 0x05, 0x05, 0x06, 0x04,
148 	0x05, 0x05, 0x05, 0x07, 0x06, 0x07, 0x04, 0x0c,
149 	0x08, 0x09, 0x09, 0x0a, 0x09, 0x09, 0x0a, 0x0c,
150 	0x10, 0x11, 0x11, 0x12, 0x20, 0x21, 0x40, 0x80,
151 };
152 #endif
153