OSDN Git Service

removed unused flag.
[putex/putex.git] / src / texsourc / texmfmem.h
1 /* Copyright 1992 Karl Berry
2    Copyright 2007 TeX Users Group
3    Copyright 2014 Clerk Ma
4
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.
9
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.
14
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
18    02110-1301 USA.  */
19
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
23    place in memory.
24
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
28    byte.
29    
30    If BigEndian:
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
34    
35    If LittleEndian:
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
39    
40    The halfword fields are four bytes if we are building a TeX or MF;
41    this leads to further complications:
42    
43    BigEndian:
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
47
48    LittleEndian:
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
52
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.
55    
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.
59 */
60
61 /*
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                ----------------------------------------------------------------------
76 */
77
78 typedef union
79 {
80   struct
81   {
82 #ifdef WORDS_BIGENDIAN
83     halfword RH, LH;
84 #else
85     halfword LH, RH;
86 #endif
87   } v;
88
89   struct
90   { /* Make B0,B1 overlap the most significant bytes of LH.  */
91 #ifdef WORDS_BIGENDIAN
92     halfword junk;
93     quarterword B0, B1;
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 */
101     quarterword B1, B0;
102 #endif /* not WORDS_BIGENDIAN */
103   } u;
104 } two_halves;
105
106 /* new in Y&Y TeX 1.3 1996/Jan/18 used for hash [...] if SHORTHASH defined */
107 typedef struct {
108   struct
109   {
110 #ifdef WORDS_BIGENDIAN
111     quarterword RH, LH;
112 #else
113     quarterword LH, RH;
114 #endif
115   } v;
116 } htwo_halves;
117
118 typedef struct
119 {
120   struct
121   {
122 #ifdef WORDS_BIGENDIAN
123     quarterword B0, B1, B2, B3;
124 #else
125     quarterword B3, B2, B1, B0;
126 #endif
127   } u;
128 } four_quarters;
129
130
131 typedef union
132 {
133 #ifdef TeX
134   glue_ratio gr;
135   two_halves hh;
136 #else
137   two_halves hhfield;
138 #endif
139 #ifdef WORDS_BIGENDIAN
140   integer cint;
141   four_quarters qqqq;
142 #else /* not WORDS_BIGENDIAN */
143   struct
144   {
145 #if defined (TeX) && !defined (SMALLTeX) || !defined (TeX) && !defined (SMALLMF)
146     halfword junk;
147 #endif /* big TeX or big MF */
148     integer CINT;
149   } u;
150
151   struct
152   {
153 #if defined (TeX) && !defined (SMALLTeX) || !defined (TeX) && !defined (SMALLMF)
154     halfword junk;
155 #endif /* big TeX or big MF */
156     four_quarters QQQQ;
157   } v;
158 #endif /* not WORDS_BIGENDIAN */
159 } memory_word;
160
161 /* Attempt to reduce size of font_info array ... (and hence format files) */
162
163 typedef struct
164 {
165   struct
166   {
167 #ifdef WORDS_BIGENDIAN
168     unsigned char B0, B1, B2, B3;
169 #else
170     unsigned char B3, B2, B1, B0;
171 #endif
172   } u;
173 } ffour_quarters; /* was fourunsignedchars; */
174
175 #define fquarterword unsigned char
176
177 typedef union
178 {
179   integer cint;
180   ffour_quarters qqqq;
181 } fmemoryword;
182
183 /* To keep the original structure accesses working, we must go through
184    the extra names C forced us to introduce.  */
185 #define b0 u.B0
186 #define b1 u.B1
187 #define b2 u.B2
188 #define b3 u.B3
189
190 #ifndef WORDS_BIGENDIAN
191 #define cint u.CINT
192 #define qqqq v.QQQQ
193 #endif