w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

texmfmem.h
Go to the documentation of this file.
1 /* texmfmem.h: the memory_word type, which is too hard to translate
2  automatically from Pascal. We have to make sure the byte-swapping
3  that the (un)dumping routines do suffices to put things in the right
4  place in memory.
5 
6  A memory_word can be broken up into a `twohalves' or a
7  `fourquarters', and a `twohalves' can be further broken up. Here is
8  a picture. ..._M = most significant byte, ..._L = least significant
9  byte.
10 
11  The halfword fields are four bytes if we are building a big TeX or MF;
12  this leads to further complications:
13 
14  BigEndian:
15  twohalves.v: RH_MM RH_ML RH_LM RH_LL LH_MM LH_ML LH_LM LH_LL
16  twohalves.u: ---------JUNK---------- B0 B1
17  fourquarters: B0 B1 B2 B3
18 
19  LittleEndian:
20  twohalves.v: LH_LL LH_LM LH_ML LH_MM RH_LL RH_LM RH_ML RH_MM
21  twohalves.u: B1 B0
22  fourquarters: ---------JUNK---------- B3 B2 B1 B0
23 
24  I guess TeX and Metafont never refer to the B1 and B0 in the
25  fourquarters structure as the B1 and B0 in the twohalves.u structure.
26 
27  The B0 and B1 fields are declared short instead of quarterword,
28  because they are used in character nodes to store a font number and a
29  character. If left as a quarterword (which is a single byte), we
30  couldn't support more than 256 fonts. (If shorts aren't two bytes,
31  this will lose.)
32 
33  In the old four-byte memory structure (something more needs to be
34  done to handle >256 fonts):
35 
36  If BigEndian:
37  twohalves.v: RH_M RH_L LH_M LH_L
38  twohalves.u: JNK1 JNK2 B0 B1
39  fourquarters: B0 B1 B2 B3
40 
41  If LittleEndian:
42  twohalves.v: LH_L LH_M RH_L RH_M
43  twohalves.u: B1 B0 JNK1 JNK2
44  fourquarters: B3 B2 B1 B0
45 
46  In Aleph, quarterwords are two octets, so the picture becomes simpler:
47 
48  BigEndian:
49  twohalves.v: RH_MM RH_ML RH_LM RH_LL LH_MM LH_ML LH_LM LH_LL
50  twohalves.u: ---------JUNK---------- ----B0----- ----B1-----
51  fourquarters: ----B0----- ----B1----- ----B2----- ----B3-----
52  twoints: ---------CINT0--------- ---------CINT1---------
53 
54  LittleEndian:
55  twohalves.v: LH_LL LH_LM LH_ML LH_MM RH_LL RH_LM RH_ML RH_MM
56  twohalves.u: ----B1----- ----B0-----
57  fourquarters: ----B3----- ----B2----- ----B1----- ----B0-----
58  twoints: ---------CINT1--------- ---------CINT0---------
59 
60  This file can't be part of texmf.h, because texmf.h gets included by
61  {tex,mf,mp}d.h before the `halfword' etc. types are defined. So we
62  include it from the change file instead.
63 */
64 
65 /* Aleph is sufficiently different to separate the definition. */
66 #if !defined(Omega) && !defined(upTeX) && !defined(Aleph) && !defined(FAM256)
67 
68 typedef union
69 {
70  struct
71  {
72 #ifdef WORDS_BIGENDIAN
73  halfword RH, LH;
74 #else
75  halfword LH, RH;
76 #endif
77  } v;
78 
79  struct
80  { /* Make B0,B1 overlap the most significant bytes of LH. */
81 #ifdef WORDS_BIGENDIAN
82  halfword junk;
83  short B0, B1;
84 #else /* not WORDS_BIGENDIAN */
85  /* If 32-bit memory words, have to do something. */
86 #if defined (SMALLTeX) || defined (SMALLMF) || defined (SMALLMP)
87  fixme
88 #else
89  short B1, B0;
90 #endif /* big memory words */
91 #endif /* LittleEndian */
92  } u;
93 } twohalves;
94 
95 typedef struct
96 {
97  struct
98  {
99 #ifdef WORDS_BIGENDIAN
100  quarterword B0, B1, B2, B3;
101 #else
103 #endif
104  } u;
105 } fourquarters;
106 
107 typedef union
108 {
109 #ifdef TeX
110  glueratio gr;
111  twohalves hh;
112 #else
114 #endif
115 #ifdef XeTeX
116  voidpointer ptr;
117 #endif
118 #ifdef WORDS_BIGENDIAN
119  integer cint;
121 #else /* not WORDS_BIGENDIAN */
122  struct
123  {
124 #if defined (TeX) && !defined (SMALLTeX) || defined (MF) && !defined (SMALLMF) || defined (MP) && !defined (SMALLMP)
125  halfword junk;
126 #endif /* big {TeX,MF,MP} */
128  } u;
129 
130  struct
131  {
132 #ifndef XeTeX
133 #if defined (TeX) && !defined (SMALLTeX) || defined (MF) && !defined (SMALLMF) || defined (MP) && !defined (SMALLMP)
134  halfword junk;
135 #endif /* big {TeX,MF,MP} */
136 #endif
138  } v;
139 #endif /* not WORDS_BIGENDIAN */
140 } memoryword;
141 
142 
143 /* fmemory_word for font_list; needs to be only four bytes. This saves
144  significant space in the .fmt files. (Not true in XeTeX, actually!) */
145 typedef union
146 {
147 #ifdef WORDS_BIGENDIAN
148  integer cint;
150 #else /* not WORDS_BIGENDIAN */
151  struct
152  {
153 #ifdef XeTeX
154  halfword junk; /* quarterword is really 16 bits in XeTeX, so integer does not fill the union */
155 #endif
157  } u;
158 
159  struct
160  {
162  } v;
163 #endif /* not WORDS_BIGENDIAN */
164 } fmemoryword;
165 
166 /* To keep the original structure accesses working, we must go through
167  the extra names C forced us to introduce. */
168 #define b0 u.B0
169 #define b1 u.B1
170 #define b2 u.B2
171 #define b3 u.B3
172 
173 #define rh v.RH
174 #define lhfield v.LH
175 
176 #ifndef WORDS_BIGENDIAN
177 #define cint u.CINT
178 #endif
179 
180 #ifndef WORDS_BIGENDIAN
181 #define qqqq v.QQQQ
182 #endif
183 
184 #else /* Omega || upTeX || Aleph || FAM256 */
185 
186 typedef union
187 {
188  struct
189  {
190 #ifdef WORDS_BIGENDIAN
191  halfword RH, LH;
192 #else
193  halfword LH, RH;
194 #endif
195  } v;
196 
197  struct
198  { /* Make B0,B1 overlap the most significant bytes of LH. */
199 #ifdef WORDS_BIGENDIAN
200  halfword junk;
201  quarterword B0, B1;
202 #else /* not WORDS_BIGENDIAN */
203  /* If 32-bit memory words, have to do something. */
204 #if defined (SMALLTeX) || defined (SMALLMF) || defined (SMALLMP)
205  fixme
206 #else
207  quarterword B1, B0;
208 #endif /* big memory words */
209 #endif /* LittleEndian */
210  } u;
211 } twohalves;
212 
213 typedef struct
214 {
215  struct
216  {
217 #ifdef WORDS_BIGENDIAN
218  quarterword B0, B1, B2, B3;
219 #else
220  quarterword B3, B2, B1, B0;
221 #endif
222  } u;
223 } fourquarters;
224 
225 typedef struct
226 {
227 #ifdef WORDS_BIGENDIAN
228  integer CINT0, CINT1;
229 #else
230  integer CINT1, CINT0;
231 #endif
232 } twoints;
233 
234 typedef struct
235 {
236  glueratio GLUE;
237 } glues;
238 
239 typedef union
240 {
241  twohalves hh;
243  twoints ii;
244  glues gg;
245 } memoryword;
246 
247 #define b0 u.B0
248 #define b1 u.B1
249 #define b2 u.B2
250 #define b3 u.B3
251 
252 #define rh v.RH
253 #define lhfield v.LH
254 
255 #define cint ii.CINT0
256 #define cint1 ii.CINT1
257 
258 #define gr gg.GLUE
259 
260 #endif /* Omega || upTeX || Aleph || FAM256 */
int v
Definition: dviconv.c:10
unsigned short halfword
Definition: dvips.h:68
long hh
Definition: dvi2xx.h:579
#define B2
Definition: mod_34lsub1.c:69
#define B1
Definition: mod_34lsub1.c:68
#define B3
Definition: mod_34lsub1.c:70
small capitals from c petite p scientific f u
Definition: afcover.h:88
#define cint
Definition: texmfmem.h:177
#define qqqq
Definition: texmfmem.h:181
int ii
Definition: main.c:50
double glueratio
Definition: luatex.h:92
#define gr
Definition: memoryword.h:113
#define memoryword
Definition: memoryword.h:117
int integer
Definition: pbmtopk.c:38
char quarterword
Definition: pbmtopk.c:39
set set set set set set set set set set set set set set set set set set set set *set set set macro pixldst op &r &cond WK op &r &cond WK op &r &cond WK else op &m &cond &ia op &r &cond WK else op &m &cond &ia elseif elseif else error unsupported base if elseif elseif else error unsupported unaligned pixldst unaligned endm macro pixst base base else pixldst base endif endm macro PF ptr
@ GLUE
Definition: pl-parser.h:120
quarterword B0
Definition: texmfmem.h:102
fourquarters QQQQ
Definition: texmfmem.h:161
integer CINT
Definition: texmfmem.h:156
integer CINT
Definition: texmfmem.h:127
fourquarters QQQQ
Definition: texmfmem.h:137
twohalves hhfield
Definition: texmfmem.h:113
halfword LH
Definition: texmfmem.h:75
short B0
Definition: texmfmem.h:89