TeX in C
Explore TeX with modern c compiler.
PART 1: Introduction

第一章:TeX 相关的常量. 更多...

宏定义

#define MAX_STRINGS   300000
 [#11] maximum number of strings; must not exceed MAX_HALF_WORD. 更多...
 
#define STRING_VACANCIES   8000
 [#11] the minimum number of characters that should be available for the user’s control sequences and font names, after TEX’s own error messages are stored. 更多...
 
#define POOL_SIZE   (1024 * 1024 * 4 - 1)
 [#11] maximum number of characters in strings. 更多...
 
#define TEX_BANNER   "This is TeX, Version 3.14159"
 [#2] printed when TEX starts. 更多...
 
#define MEM_MAX   3000000
 [#11] greatest index in TeX's internal mem array. 更多...
 
#define MEM_MIN   0
 [#11] smallest index in TeX's internal mem array. 更多...
 
#define BUF_SIZE   5000
 [#11] maximum number of characters simultaneously present. 更多...
 
#define ERROR_LINE   64
 
#define HALF_ERROR_LINE   32
 
#define MAX_PRINT_LINE   72
 
#define STACK_SIZE   200
 [#11] maximum number of simultaneous input sources. 更多...
 
#define MAX_IN_OPEN   6
 [#11] maximum number of input files and error insertions that can be going on simultaneously. 更多...
 
#define FONT_MAX   75
 [#11] maximum internal font number. 更多...
 
#define FONT_MEM_SIZE   200000
 [#11] number of words of fontinfo for all fonts. 更多...
 
#define PARAM_SIZE   60
 [#11] maximum number of simultaneous macro parameters. 更多...
 
#define NEST_SIZE   40
 [#11] maximum number of semantic levels simultaneously active. 更多...
 
#define SAVE_SIZE   600
 [#11] space for saving values outside of current group. 更多...
 
#define TRIE_SIZE   131000
 [#11] space for hyphenation patterns. 更多...
 
#define TRIE_OP_SIZE   5000
 [#11] space for "opcodes" in the hyphenation patterns. 更多...
 
#define FILE_NAME_SIZE   240
 [#11] file names shouldn’t be longer than this. 更多...
 
#define POOL_NAME   "TeXformats:TEX.POOL "
 [#11] string of length FILE_NAME_SIZE; tells where the string pool appears not_use 更多...
 
#define MEM_BOT   0
 [#12] smallest index in the mem array dumped by INITEX. 更多...
 
#define MEM_TOP   3000000
 [#12] largest index in the mem array dumped by INITEX. 更多...
 
#define FONT_BASE   0
 [#12] smallest internal font number. 更多...
 
#define HASH_SIZE   210000
 [#12] maximum number of control sequences. 更多...
 
#define HASH_PRIME   171553
 [#12] a prime number equal to about 85% of HASH_SIZE. 更多...
 
#define HYPH_SIZE   307
 [#12] another prime; the number of \hyphenation exceptions. 更多...
 
#define EMPTY   0
 [#16] symbolic name for a null constant. 更多...
 

详细描述

第一章:TeX 相关的常量.

宏定义说明

◆ BUF_SIZE

#define BUF_SIZE   5000

[#11] maximum number of characters simultaneously present.

in current lines of open files and in control sequences between \csname and \endcsname; must not exceed MAX_HALF_WORD.

[500=>5000]

◆ EMPTY

#define EMPTY   0

[#16] symbolic name for a null constant.

◆ ERROR_LINE

#define ERROR_LINE   64

◆ FILE_NAME_SIZE

#define FILE_NAME_SIZE   240

[#11] file names shouldn’t be longer than this.

[40=>240]

◆ FONT_BASE

#define FONT_BASE   0

[#12] smallest internal font number.

◆ FONT_MAX

#define FONT_MAX   75

[#11] maximum internal font number.

◆ FONT_MEM_SIZE

#define FONT_MEM_SIZE   200000

[#11] number of words of fontinfo for all fonts.

[20_000 => 200_000]

◆ HALF_ERROR_LINE

#define HALF_ERROR_LINE   32

◆ HASH_PRIME

#define HASH_PRIME   171553

[#12] a prime number equal to about 85% of HASH_SIZE.

it should be at most about (MEM_MAXMEM_MIN)/10 .

[1777 => 171_553]

◆ HASH_SIZE

#define HASH_SIZE   210000

[#12] maximum number of control sequences.

must not be less than MIN_QUARTER_WORD.

[2100 => 210_000]

◆ HYPH_SIZE

#define HYPH_SIZE   307

[#12] another prime; the number of \hyphenation exceptions.

◆ MAX_IN_OPEN

#define MAX_IN_OPEN   6

[#11] maximum number of input files and error insertions that can be going on simultaneously.

◆ MAX_PRINT_LINE

#define MAX_PRINT_LINE   72

◆ MAX_STRINGS

#define MAX_STRINGS   300000

[#11] maximum number of strings; must not exceed MAX_HALF_WORD.

xref: str[6], tex[1]. [3000 => 300_000]

◆ MEM_BOT

#define MEM_BOT   0

[#12] smallest index in the mem array dumped by INITEX.

must not be less than MEM_MIN.

◆ MEM_MAX

#define MEM_MAX   3000000

[#11] greatest index in TeX's internal mem array.

must be strictly less than MAX_HALF_WORD; must be equal to MEM_TOP in INITEX, otherwise ≥ MEM_TOP.

[30_000 => 3_000_000]

◆ MEM_MIN

#define MEM_MIN   0

[#11] smallest index in TeX's internal mem array.

must be MAX_HALF_WORD or more; must be equal to MEM_BOT in INITEX, otherwise ≤ MEM_BOT.

◆ MEM_TOP

#define MEM_TOP   3000000

[#12] largest index in the mem array dumped by INITEX.

must be substantially larger than MEM_BOT and not greater than MEM_MAX

[30_000 => 3_000_000]

◆ NEST_SIZE

#define NEST_SIZE   40

[#11] maximum number of semantic levels simultaneously active.

◆ PARAM_SIZE

#define PARAM_SIZE   60

[#11] maximum number of simultaneous macro parameters.

◆ POOL_NAME

#define POOL_NAME   "TeXformats:TEX.POOL "

[#11] string of length FILE_NAME_SIZE; tells where the string pool appears not_use

◆ POOL_SIZE

#define POOL_SIZE   (1024 * 1024 * 4 - 1)

[#11] maximum number of characters in strings.

including all error messages and help texts, and the names of all fonts and control sequences; must exceed STRING_VACANCIES by the total length of TEX’s own strings, which is currently about 23000.

xref: str[4], tex[4]. [32000 => 1024*1024*4 (4 MB)]

◆ SAVE_SIZE

#define SAVE_SIZE   600

[#11] space for saving values outside of current group.

must be at most MAX_HALF_WORD.

◆ STACK_SIZE

#define STACK_SIZE   200

[#11] maximum number of simultaneous input sources.

◆ STRING_VACANCIES

#define STRING_VACANCIES   8000

[#11] the minimum number of characters that should be available for the user’s control sequences and font names, after TEX’s own error messages are stored.

xref: inipool[2] only

◆ TEX_BANNER

#define TEX_BANNER   "This is TeX, Version 3.14159"

[#2] printed when TEX starts.

TODO: update to 3.14159265

◆ TRIE_OP_SIZE

#define TRIE_OP_SIZE   5000

[#11] space for "opcodes" in the hyphenation patterns.

[500=>5000]

◆ TRIE_SIZE

#define TRIE_SIZE   131000

[#11] space for hyphenation patterns.

should be larger for INITEX than it is in production versions of TeX.

[8_000 => 131_000]