1 /* Copyright 1992 Karl Berry
2 Copyright 2007 TeX Users Group
3 Copyright 2014 Clerk Ma
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 /* texmfmem.h: the memory_word type, which is too hard to translate
21 automatically from Pascal. We have to make sure the byte-swapping
22 that the (un)dumping routines do suffices to put things in the right
25 A memory_word can be broken up into a `two_halves' or a
26 `four_quarters', and a `two_halves' can be further broken up. Here is
27 a picture. ..._M = most significant byte, ..._L = least significant
31 two_halves.v: RH_M RH_L LH_M LH_L
32 two_halves.u: JNK1 JNK2 B0 B1
33 four_quarters: B0 B1 B2 B3
36 two_halves.v: LH_L LH_M RH_L RH_M
37 two_halves.u: B1 B0 JNK1 JNK2
38 four_quarters: B3 B2 B1 B0
40 The halfword fields are four bytes if we are building a TeX or MF;
41 this leads to further complications:
44 two_halves.v: RH_MM RH_ML RH_LM RH_LL LH_MM LH_ML LH_LM LH_LL
45 two_halves.u: ---------JUNK---------- B0 B1
46 four_quarters: B0 B1 B2 B3
49 two_halves.v: LH_LL LH_LM LH_ML LH_MM RH_LL RH_LM RH_ML RH_MM
50 two_halves.u: junkx junky B1 B0
51 four_quarters: ---------JUNK---------- B3 B2 B1 B0
53 I guess TeX and Metafont never refer to the B1 and B0 in the
54 four_quarters structure as the B1 and B0 in the two_halves.u structure.
56 This file can't be part of texmf.h, because texmf.h gets included by
57 {tex,mf}d.h before the `halfword' etc. types are defined. So we
58 include it from the change file instead.
62 meaning structure @TeX @draft
63 ----------------------------------------------------------------------
64 integer | int || 4: long | 8: long long | min_quarterword 0
65 ---------------------------------------------------------------------- max_quarterword FFFF
66 scaled | sc || 4: long | 8: long long | min_halfword
67 ----------------------------------------------------------------------
68 glue_ratio | gr || 4: float | 8: double |
69 ----------------------------------------------------------------------
70 halfword | lh | rh || 2: unsigned short | 4: unsigned long |
71 ----------------------------------------------------------------------
72 half+quarter | b0 | b1 | rh || |
73 ----------------------------------------------------------------------
74 quarter | b0 | b1 | b2 | b3 || 1: unsigned char | 2: unsigned short |
75 ----------------------------------------------------------------------
82 #ifdef WORDS_BIGENDIAN
90 { /* Make B0,B1 overlap the most significant bytes of LH. */
91 #ifdef WORDS_BIGENDIAN
94 #else /* not WORDS_BIGENDIAN */
95 /* If 32-bit TeX/MF, have to have an extra two bytes of junk.
96 I would like to break this line, but I'm afraid that some
97 preprocessors don't properly handle backslash-newline in # commands. */
98 #if (defined (TeX) && !defined (SMALLTeX)) || !defined (TeX) && !defined (SMALLMF)
99 quarterword junkx, junky;
100 #endif /* big TeX or big MF */
102 #endif /* not WORDS_BIGENDIAN */
106 /* new in Y&Y TeX 1.3 1996/Jan/18 used for hash [...] if SHORTHASH defined */
110 #ifdef WORDS_BIGENDIAN
122 #ifdef WORDS_BIGENDIAN
123 quarterword B0, B1, B2, B3;
125 quarterword B3, B2, B1, B0;
139 #ifdef WORDS_BIGENDIAN
142 #else /* not WORDS_BIGENDIAN */
145 #if defined (TeX) && !defined (SMALLTeX) || !defined (TeX) && !defined (SMALLMF)
147 #endif /* big TeX or big MF */
153 #if defined (TeX) && !defined (SMALLTeX) || !defined (TeX) && !defined (SMALLMF)
155 #endif /* big TeX or big MF */
158 #endif /* not WORDS_BIGENDIAN */
161 /* Attempt to reduce size of font_info array ... (and hence format files) */
167 #ifdef WORDS_BIGENDIAN
168 unsigned char B0, B1, B2, B3;
170 unsigned char B3, B2, B1, B0;
173 } ffour_quarters; /* was fourunsignedchars; */
175 #define fquarterword unsigned char
183 /* To keep the original structure accesses working, we must go through
184 the extra names C forced us to introduce. */
190 #ifndef WORDS_BIGENDIAN