TeX in C
Explore TeX with modern c compiler.
mmode.h
浏览该文件的文档.
1 #pragma once
2 #ifndef INC_MMODE_H
4 #define INC_MMODE_H
5 #include "global.h"
6 #include "charset.h" // [type] ASCIICode
7 #include "fonts.h"
8 #include "scan.h" // MAX_DIMEN
9 #include "box.h" // [enum] UNSET_NODE
10 #include "tex_constant.h" // [const] MEM_MIN, EMPTY, MIN_QUARTER_WORD
11 
22 enum NoadType {
26 
27  // [#682]
35 
36  // [#683]
39 
40  // [#687]
47 }; // [#682] enum NoadType
48 
50 #define limits 1
52 #define nolimits 2
53 
55 #define noadsize (4 * CHAR_NODE_SIZE)
57 #define radicalnoadsize (5 * CHAR_NODE_SIZE)
59 #define fractionnoadsize (6 * CHAR_NODE_SIZE)
61 #define accentnoadsize (5 * CHAR_NODE_SIZE)
62 
64 #define stylenode (UNSET_NODE + 1)
66 #define stylenodesize 3
67 
71  textstyle = 2,
74 }; // [#688] StyleNodeSubtype
75 
77 #define cramped 1
79 #define choicenode (UNSET_NODE + 2)
80 
81 
82 
83 #if 1
85 #define nucleus(x) ((x)+CHAR_NODE_SIZE) /* the |nucleus| field of a noad}*/
86 #define supscr(x) (nucleus(x)+CHAR_NODE_SIZE) /* the |supscr| field of a noad}*/
87 #define subscr(x) (supscr(x)+CHAR_NODE_SIZE) /* the |subscr| field of a noad}*/
89 #define leftdelimiter(x) (subscr(x)+CHAR_NODE_SIZE) /* first delimiter field of a noad}*/
90 #define rightdelimiter(x) (leftdelimiter(x)+CHAR_NODE_SIZE) /* second delimiter field of a fraction noad}*/
92 #define accentchr(x) (subscr(x)+CHAR_NODE_SIZE) /* the |accentchr| field of an accent noad}*/
93 #else
94 #define nucleus(x) ((x)+1) /* the |nucleus| field of a noad}*/
95 #define supscr(x) ((x)+2) /* the |supscr| field of a noad}*/
96 #define subscr(x) ((x)+7) /* the |subscr| field of a noad}*/
97 #define leftdelimiter(x) ((x)+4) /* first delimiter field of a noad}*/
98 #define rightdelimiter(x) ((x)+5) /* second delimiter field of a fraction noad}*/
99 #define accentchr(x) ((x)+4) /* the |accentchr| field of an accent noad}*/
100 #endif
101 
103 #define mathtype link
104 #define fam(x) type(x)
106 #define smallfam(x) mem[x].qqqq.b0 /* |fam| for ``small'' delimiter}*/
107 #define smallchar(x) mem[x].qqqq.b1 /* |character| for ``small'' delimiter}*/
108 #define largefam(x) mem[x].qqqq.b2 /* |fam| for ``large'' delimiter}*/
109 #define largechar(x) mem[x].qqqq.b3 /* |character| for ``large'' delimiter}*/
110 #define thickness(x) (mem[nucleus(x)-MEM_MIN].sc) /* |thickness| field in a fraction noad}*/
111 #define defaultcode 1073741824L // denotes default_rule_thickness
112 #define numerator supscr /* |numerator| field in a fraction noad}*/
113 #define denominator subscr /* |denominator| field in a fraction noad}*/
115 #define delimiter nucleus /* |delimiter| field in left and right noads}*/
117 #define scriptsallowed(x) ((type(x)>=ordnoad)&&(type(x)<leftnoad))
119 #define vpack(x, y, z) vpackage((x), (y), (z), MAX_DIMEN)
121 #define displaymlist(x) info(x+1) /* mlist to be used in display style}*/
122 #define textmlist(x) link(x+1) /* mlist to be used in text style}*/
123 #define scriptmlist(x) info(x+2) /* mlist to be used in script style}*/
124 #define scriptscriptmlist(x) link(x+2) /* mlist to be used in scriptscript style}*/ // end group S680x698_P249x257
129 // enum FontSizeCode {};
131 // size code for the largest size in a family
132 #define TEXT_SIZE 0
133 // size code for the medium size in a family
134 #define SCRIPT_SIZE 16
135 // size code for the smallest size in a family
136 #define SCRIPT_SCRIPT_SIZE 32
137 
138 // [p258#700]
139 #define totalmathsyparams 22
140 // [p258#701]
141 #define totalmathexparams 13
142 
144 #define mathsy(x, y) (fontinfo[(x) + parambase[fam_fnt(2 + (y))]].sc)
145 #define mathxheight(x) mathsy(5, x) /* height of `\.x'}*/
146 #define mathquad(x) mathsy(6, x) /* \.{18mu}}*/
147 #define num1(x) mathsy(8,x) /* numerator shift-up in display styles}*/
148 #define num2(x) mathsy(9,x) /* numerator shift-up in non-display, non-\.{\\atop}}*/
149 #define num3(x) mathsy(10,x) /* numerator shift-up in non-display \.{\\atop}}*/
150 #define denom1(x) mathsy(11,x) /* denominator shift-down in display styles}*/
151 #define denom2(x) mathsy(12,x) /* denominator shift-down in non-display styles}*/
152 #define sup1(x) mathsy(13,x) /* superscript shift-up in uncramped display style}*/
153 #define sup2(x) mathsy(14,x) /* superscript shift-up in uncramped non-display}*/
154 #define sup3(x) mathsy(15,x) /* superscript shift-up in cramped styles}*/
155 #define sub1(x) mathsy(16,x) /* subscript shift-down if superscript is absent}*/
156 #define sub2(x) mathsy(17,x) /* subscript shift-down if superscript is present}*/
157 #define supdrop(x) mathsy(18,x) /* superscript baseline below top of large box}*/
158 #define subdrop(x) mathsy(19,x) /* subscript baseline below bottom of large box}*/
159 #define delim1(x) mathsy(20,x) /* size of \.{\\atopwithdelims} delimiters*/
160 /* in display styles}*/
161 #define delim2(x) mathsy(21,x) /* size of \.{\\atopwithdelims} delimiters in non-displays}*/
162 #define axisheight(x) mathsy(22,x) /* height of fraction lines above the baseline}*/
163 
165 #define mathex(x) fontinfo[x + parambase[fam_fnt(3 + cursize)]].sc
166 #define defaultrulethickness mathex(8) /* thickness of \.{\\over} bars}*/
167 #define bigopspacing1 mathex(9) /* minimum clearance above a displayed op}*/
168 #define bigopspacing2 mathex(10) /* minimum clearance below a displayed op}*/
169 #define bigopspacing3 mathex(11) /* minimum baselineskip above displayed op}*/
170 #define bigopspacing4 mathex(12) /* minimum baselineskip below displayed op}*/
171 #define bigopspacing5 mathex(13) /* padding above and below displayed limits}*/
172 
174 #define crampedstyle(x) 2*(x / 2)+cramped /* cramp the style}*/
175 #define substyle(x) 2*(x / 4)+scriptstyle+cramped /* smaller and cramped}*/
176 #define supstyle(x) 2*(x / 4)+scriptstyle+(x % 2) /* smaller}*/
177 #define numstyle(x) x+2-2*(x / 6) /* smaller unless already script-script}*/
178 #define denomstyle(x) 2*(x / 2)+cramped+2-2*(x / 6) /* smaller, cramped}*/ // end group S699x718_P258x264
183 #define newhlist(x) mem[nucleus(x)].int_
186 // #define donewithnoad 80
187 // #define donewithnode 81
188 // #define checkdimensions 82
189 // #define deleteq 83 // end group S719x767_P265x284
191 
192 extern TwoHalves emptyfield;
194 
195 extern Pointer curmlist;
197 extern Boolean mlistpenalties;
198 extern InternalFontNumber curf;
199 extern QuarterWord curc;
200 extern FourQuarters curi;
201 
202 extern void mmode_init();
203 extern void print_size(Integer s);
204 extern HalfWord newnoad(void);
205 extern HalfWord newstyle(SmallNumber s);
206 extern HalfWord newchoice(void);
207 extern void printfamandchar(HalfWord p);
208 extern void printdelimiter(HalfWord p);
209 extern void printsubsidiarydata(HalfWord p, ASCIICode c);
210 extern void showinfo(void);
211 extern void printstyle(Integer c);
212 
213 extern HalfWord fractionrule(long t);
214 extern HalfWord overbar(HalfWord b, long k, long t);
218 extern HalfWord vardelimiter(HalfWord d, SmallNumber s, long v);
219 extern HalfWord rebox(HalfWord b, long w);
220 extern HalfWord mathglue(HalfWord g, long m);
221 extern void mathkern(HalfWord p, long m);
222 extern void flushmath(void);
223 
224 // math formula
225 extern void mlisttohlist(void);
226 
227 #endif /* INC_MMODE_H */
uint16_t QuarterWord
[p43#113]: QuarterWord(8=>16) .
Definition: tex_types.h:126
uint32_t HalfWord
[p43#113]: HalfWord(16=>32) .
Definition: tex_types.h:127
@ UNSET_NODE
#159: type for an unset node
Definition: box.h:64
UChar ASCIICode
[#18]: ASCIICode::UChar(8) = [0, 255]
Definition: charset.h:11
UChar InternalFontNumber
[#548]: [FONT_BASE, FONT_MAX] = [0, 75]
Definition: fonts.h:92
HalfWord newnoad(void)
Definition: mmode.c:31
StyleNodeSubtype
[#688]
Definition: mmode.h:69
void printfamandchar(HalfWord p)
[#691] prints family and character.
Definition: mmode.c:80
TwoHalves emptyfield
[p267#726] label not_use
Definition: mmode.c:15
void showinfo(void)
Definition: mmode.c:131
void printsubsidiarydata(HalfWord p, ASCIICode c)
[#692] display a noad field.
Definition: mmode.c:100
void printstyle(Integer c)
[#694]
Definition: mmode.c:135
NoadType
[p251#682] type of noad classified XXX.
Definition: mmode.h:22
void mmode_init()
[#685]
Definition: mmode.c:21
HalfWord newchoice(void)
Definition: mmode.c:64
FourQuarters nulldelimiter
Definition: mmode.c:16
HalfWord newstyle(SmallNumber s)
Definition: mmode.c:51
void printdelimiter(HalfWord p)
[#691] prints a delimiter as 24-bit hex value.
Definition: mmode.c:88
@ textstyle
subtype for \textstyle
Definition: mmode.h:71
@ scriptstyle
subtype for \scriptstyle
Definition: mmode.h:72
@ scriptscriptstyle
subtype for \scriptscriptstyle
Definition: mmode.h:73
@ displaystyle
subtype for \displaystyle
Definition: mmode.h:70
@ relnoad
noad classified Rel
Definition: mmode.h:30
@ binnoad
noad classified Bin
Definition: mmode.h:29
@ ordnoad
[#682] [UNSET_NODE=13 + 3 = 16] type of a noad classified Ord.
Definition: mmode.h:25
@ radicalnoad
noad for square roots
Definition: mmode.h:37
@ accentnoad
noad for accented subformulas
Definition: mmode.h:43
@ opennoad
noad classified Ope
Definition: mmode.h:31
@ fractionnoad
noad for generalized fractions.
Definition: mmode.h:38
@ overnoad
noad for overlining
Definition: mmode.h:42
@ rightnoad
noad for \right
Definition: mmode.h:46
@ leftnoad
noad for \left
Definition: mmode.h:45
@ opnoad
noad classified Op
Definition: mmode.h:28
@ punctnoad
noad classified Pun
Definition: mmode.h:33
@ closenoad
noad classified Clo
Definition: mmode.h:32
@ vcenternoad
noad for \vcenter
Definition: mmode.h:44
@ undernoad
noad for underlining
Definition: mmode.h:41
@ innernoad
noad classified Inn.
Definition: mmode.h:34
void flushmath(void)
Definition: mmode.c:424
void stackintobox(HalfWord b, InternalFontNumber f, QuarterWord c)
Definition: mmode.c:213
Integer heightplusdepth(InternalFontNumber f, QuarterWord c)
Definition: mmode.c:224
HalfWord rebox(HalfWord b, long w)
Definition: mmode.c:346
HalfWord fractionrule(long t)
Definition: mmode.c:167
void mathkern(HalfWord p, long m)
Definition: mmode.c:407
void print_size(Integer s)
[#699]
Definition: mmode.c:154
HalfWord overbar(HalfWord b, long k, long t)
Definition: mmode.c:178
HalfWord charbox(InternalFontNumber f, QuarterWord c)
Definition: mmode.c:193
HalfWord mathglue(HalfWord g, long m)
Definition: mmode.c:374
HalfWord vardelimiter(HalfWord d, SmallNumber s, long v)
Definition: mmode.c:234
Pointer curmlist
Definition: math_formula.c:19
InternalFontNumber curf
Definition: math_formula.c:24
Boolean mlistpenalties
Definition: math_formula.c:21
QuarterWord curc
Definition: math_formula.c:25
SmallNumber curstyle
Definition: math_formula.c:20
void mlisttohlist(void)
Definition: math_formula.c:659
FourQuarters curi
Definition: math_formula.c:26
SmallNumber cursize
Definition: mmode.h:196
[p43#113]: FourQuarters(64) .
Definition: tex_types.h:159
[p43#113]: TwoHalves(64) .
Definition: tex_types.h:144
int64_t Integer
Integer(64) =
Definition: tex_types.h:42
size_t Pointer
Pointer::size_t(64), a flag or a location in mem or eqtb.
Definition: tex_types.h:45
bool Boolean
布尔类型定义
Definition: tex_types.h:11
UChar SmallNumber
[p38#101]: SmallNumber::UChar(8) = [0, 255] only need: (6bit)[0, 63] .
Definition: tex_types.h:112