TeX in C
Explore TeX with modern c compiler.
PART 5: On-line and off-line printing

枚举

enum  Selector {
  NO_PRINT = 16 , TERM_ONLY , LOG_ONLY , TERM_AND_LOG ,
  PSEUDO = 20 , NEW_STRING = 21 , MAX_SELECTOR = NEW_STRING
}
 [p24#54]: selector possible settings. 更多...
 

函数

void println (void)
 [p25#57]: 输出换行 . 更多...
 
void print_char (ASCIICode c)
 [p25#58]: 输出单个 ASCII 字符 . 更多...
 
void print (StrNumber s)
 [p26#59]: prints string s . 更多...
 
void printnl (StrNumber s)
 [#62]: prints string s at beginning of line. 更多...
 
void print_esc (StrNumber s)
 [#63]: prints escape character, then s . 更多...
 
void print_the_digs (EightBits k, char dig[])
 [#64]: prints dig[k − 1]...dig[0] . 更多...
 
void print_int (Integer n)
 [#65]: prints an integer in decimal form. 更多...
 
void print_two (Integer n)
 [#69]: 打印两位数字 (0 <= n <= 99). 更多...
 
void print_hex (Integer n)
 [#67]: 打印十六进制的非负整数 (n >= 0). 更多...
 
void print_roman_int (Integer n)
 [#69]: 打印罗马数字 . 更多...
 
void term_input (void)
 [#70] print_current_string in str.c . 更多...
 

变量

FILE * log_file = NULL
 transcript of TeX session. 更多...
 
Selector selector
 where to print a message. 更多...
 
Integer tally
 the number of characters recently printed. 更多...
 
static UChar term_offset
 the number of characters on the current terminal line. 更多...
 
static UChar file_offset
 the number of characters on the current file line. 更多...
 
ASCIICode trick_buf [ERROR_LINE+1]
 circular buffer for pseudoprinting. 更多...
 
Integer trick_count
 threshold for pseudoprinting, explained later. 更多...
 
Integer first_count
 another variable for pseudoprinting. 更多...
 

详细描述

枚举类型说明

◆ Selector

enum Selector

[p24#54]: selector possible settings.

enum Selector = [16, 21]

convenient relations

  • NO_PRINT + 1 = TERM_ONLY,
  • NO_PRINT + 2 = LOG_ONLY,
  • TERM_ONLY + 2 = LOG_ONLY + 1 = TERM_AND_LOG
枚举值
NO_PRINT 

doesn't print at all.

TERM_ONLY 

prints only on the terminal.

LOG_ONLY 

prints only on the transcript file.

TERM_AND_LOG 

normal selector setting.

PSEUDO 

puts output into a cyclic buffer that is used by the show_context routine.

NEW_STRING 

appends the output to the current string in the string pool.

MAX_SELECTOR 

highest selector setting.

NOTE: not_use, only used in assert

函数说明

◆ print()

void print ( StrNumber  s)

[p26#59]: prints string s .

全局变量:

◆ print_char()

void print_char ( ASCIICode  c)

[p25#58]: 输出单个 ASCII 字符 .

prints a single character.

The print char procedure sends one character to the desired destination, using the xchr array to map it into an external character compatible with input ln. All printing comes through println or print_char.

根据 selector 选择输出位置.

全局变量:

print.h 导出变量:

◆ print_esc()

void print_esc ( StrNumber  s)

[#63]: prints escape character, then s .

prints a string that is preceded by the user’s escape character (which is usually a backslash).

◆ print_hex()

void print_hex ( Integer  n)

[#67]: 打印十六进制的非负整数 (n >= 0).

◆ print_int()

void print_int ( Integer  n)

[#65]: prints an integer in decimal form.

◆ print_roman_int()

void print_roman_int ( Integer  n)

[#69]: 打印罗马数字 .

Notice: 1990 => "mcmxc", not "mxm"

◆ print_the_digs()

void print_the_digs ( EightBits  k,
char  dig[] 
)

[#64]: prints dig[k − 1]...dig[0] .

dig[k] = [0, 15] (hex value: 0~F)

◆ print_two()

void print_two ( Integer  n)

[#69]: 打印两位数字 (0 <= n <= 99).

◆ println()

void println ( void  )

[p25#57]: 输出换行 .

prints an end-of-line.

tally is not affected.

全局变量:

print.h 导出变量:

used by

[58]print_char, [59]print, [61]S55_Initialize_the_output_routines, [62]printnl, [71]term_input, [82]error, [114]print_word, [182]shownodelist, [198]showbox, [218]showactivities, [245]begin_diagnostic, [296]print_meaning, [306]runaway, [330]clearforerrorprompt, [331]showcontext, [341]_get_next_helper, [363]firm_up_the_line, [389]macrocall, [482]readtoks, [534]open_log_file, [537]start_input, [638]shipout, [649]hpack, [668]vpackage, [692]printsubsidiarydata, [1265]newinteraction, [1279]issuemessage, [1302/1309,1311,1320,1324]store_fmt_file, [1333]close_files_and_terminate, [1370]writeout

◆ printnl()

void printnl ( StrNumber  s)

[#62]: prints string s at beginning of line.

全局变量:

print.h 导出变量:

◆ term_input()

void term_input ( void  )

[#70] print_current_string in str.c .

[#71]: gets a line from the terminal.

全局变量

  • [in] last
  • [in] first
  • [out] term_offset
  • [out] selector

变量说明

◆ file_offset

UChar file_offset
static

the number of characters on the current file line.

file_offset = [0, MAX_PRINT_LINE=79]

◆ first_count

Integer first_count

another variable for pseudoprinting.

only used by: lexer.c

◆ log_file

FILE* log_file = NULL

transcript of TeX session.

◆ selector

Selector selector

where to print a message.

◆ tally

Integer tally

the number of characters recently printed.

only used by: lexer.c

◆ term_offset

UChar term_offset
static

the number of characters on the current terminal line.

term_offset = [0, MAX_PRINT_LINE=79]

◆ trick_buf

ASCIICode trick_buf[ERROR_LINE+1]

circular buffer for pseudoprinting.

only used by: lexer.c

◆ trick_count

Integer trick_count

threshold for pseudoprinting, explained later.

only used by: lexer.c