TeX in C
Explore TeX with modern c compiler.
expand.h
浏览该文件的文档.
1 #pragma once
2 #ifndef INC_EXPAND_H
9 #define INC_EXPAND_H
10 #include <stdio.h> // FILE
11 #include "global.h"
12 
17 #define STORE_NEW_TOKEN(p, x) \
18  do { \
19  int q = get_avail(); \
20  link(p) = q; \
21  info(q) = (x); \
22  p = q; \
23  } while (0)
24 // end #define STORE_NEW_TOKEN(p, x)
25 
27 #define FAST_STORE_NEW_TOKEN(p, x) \
28  do { \
29  int q; \
30  FAST_GET_AVAIL(q); \
31  link(p) = q; \
32  info(q) = (x); \
33  p = q; \
34  } while (0)
35 // end #define FAST_STORE_NEW_TOKEN(p, x)
37 #define topmarkcode 0
38 #define firstmarkcode 1
39 #define botmarkcode 2
40 #define splitfirstmarkcode 3
41 #define splitbotmarkcode 4
42 #define topmark curmark[topmarkcode - topmarkcode]
43 #define firstmark curmark[firstmarkcode - topmarkcode]
44 #define botmark curmark[botmarkcode - topmarkcode]
45 #define splitfirstmark curmark[splitfirstmarkcode - topmarkcode]
46 #define splitbotmark curmark[splitbotmarkcode - topmarkcode]
51 // [p179#480]
52 #define closed 2
53 #define justopen 1
78 }; // [p181#487]: enum ConditionPrimitives
79 
81 #define ifnodesize 2
82 
84 enum IfCode {
85  ifcode = 1,
89 }; // [#489] enum IfCode
90 
92 #define iflinefield(x) mem[x + 1].int_ // end group S487x510_P181x187
94 
95 extern FILE* readfile[16];
96 extern char readopen[17];
97 
98 extern Pointer condptr;
99 // init only
100 extern UChar iflimit;
101 // init + final cleanup
102 extern SmallNumber curif;
103 extern Integer ifline;
104 // lexer
105 extern Integer skipline;
106 extern char longstate;
108 
109 extern HalfWord thetoks(void);
110 extern HalfWord scantoks(Boolean macrodef, Boolean xpand);
111 extern void readtoks(long n, HalfWord r);
112 extern void expand_init();
113 extern void build_token_init();
114 extern void cond_process_init();
115 extern void expand(void);
116 extern void get_x_token(void);
117 extern void xtoken(void);
118 
119 
120 #endif // INC_EXPAND_H
char longstate
[#387] governs the acceptance of \par .
Definition: expand.c:47
uint32_t HalfWord
[p43#113]: HalfWord(16=>32) .
Definition: tex_types.h:127
void xtoken(void)
[#381] get_x_token without the initial get_next
Definition: expand.c:557
#define topmarkcode
[p148#382]
Definition: expand.h:37
void expand_init()
[#383]
Definition: expand.c:71
Pointer curmark[splitbotmarkcode - topmarkcode+1]
Definition: expand.c:68
void expand(void)
[p143#366]
Definition: expand.c:338
void get_x_token(void)
Definition: expand.c:535
#define splitbotmarkcode
Definition: expand.h:41
FILE * readfile[16]
Definition: expand.c:24
void readtoks(long n, HalfWord r)
[#482] constructs a token list like that for any macro definition, and makes cur val point to it.
Definition: expand.c:873
HalfWord thetoks(void)
Definition: expand.c:598
char readopen[17]
Definition: expand.c:25
void build_token_init()
[#481]
Definition: expand.c:863
HalfWord scantoks(Boolean macrodef, Boolean xpand)
Definition: expand.c:722
ConditionPrimitives
[p181#487]: Conditional processing
Definition: expand.h:60
Pointer condptr
[#489] top of the condition stack.
Definition: expand.c:33
Integer ifline
[#489] line where that conditional began
Definition: expand.c:39
SmallNumber curif
[#489] type of conditional being worked on
Definition: expand.c:37
Integer skipline
[#493] skipping began here
Definition: expand.c:42
void cond_process_init()
[#490]
Definition: expand.c:983
UChar iflimit
[#489] upper bound on fi_or_else codes
Definition: expand.c:35
IfCode
[#489]
Definition: expand.h:84
@ IF_HBOX_CODE
\ifhbox
Definition: expand.h:71
@ IF_CASE_CODE
\ifcase
Definition: expand.h:77
@ IF_X_CODE
\ifx
Definition: expand.h:73
@ IF_VMODE_CODE
\ifvmode
Definition: expand.h:66
@ IF_INNER_CODE
\ifinner
Definition: expand.h:69
@ IF_VBOX_CODE
\ifvbox
Definition: expand.h:72
@ IF_MMODE_CODE
\ifmmode
Definition: expand.h:68
@ IF_VOID_CODE
\ifvoid
Definition: expand.h:70
@ IF_DIM_CODE
\ifdim
Definition: expand.h:64
@ IF_ODD_CODE
\ifodd
Definition: expand.h:65
@ IF_FALSE_CODE
\iffalse
Definition: expand.h:76
@ IF_CAT_CODE
\ifcat
Definition: expand.h:62
@ IF_TRUE_CODE
\iftrue
Definition: expand.h:75
@ IF_INT_CODE
\ifnum
Definition: expand.h:63
@ IF_EOF_CODE
\ifeof
Definition: expand.h:74
@ IF_HMODE_CODE
\ifhmode
Definition: expand.h:67
@ IF_CHAR_CODE
\if
Definition: expand.h:61
@ elsecode
code for \else
Definition: expand.h:87
@ ifcode
code for \if... being evaluated
Definition: expand.h:85
@ ficode
code for \fi
Definition: expand.h:86
@ orcode
code for \or
Definition: expand.h:88
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
uint8_t UChar
UChar(8) = [0, 255]
Definition: tex_types.h:38
UChar SmallNumber
[p38#101]: SmallNumber::UChar(8) = [0, 255] only need: (6bit)[0, 63] .
Definition: tex_types.h:112