TeX in C
Explore TeX with modern c compiler.
print.h
浏览该文件的文档.
1 #pragma once
2 #ifndef INC_PRINT
6 #define INC_PRINT
7 #include <stdio.h> // FILE
8 #include "global.h"
9  // [type] Integer, UChar
10  // [const] UMAXOF, static_assert
11 #include "charset.h" // [type] ASCIICode
12 #include "tex_constant.h" // [const] TEX_BANNER, ERROR_LINE, HALF_ERROR_LINE, MAX_PRINT_LINE,
13 #include "eqtb.h" // [macro] newlinechar
14 #include "str.h" // StrNumber, str_adjust_to_room
15 
16 
29 typedef enum _Selector {
30  /* [0~15] write_file[16] */
31 
32  NO_PRINT = 16,
36 
39  PSEUDO = 20,
41  NEW_STRING = 21,
45 } Selector; // [p24#54] enum Selector // end group S54x71_P24x29
47 
48 
49 
50 
51 extern FILE* log_file;
52 extern Selector selector;
53 extern Integer tally;
54 extern ASCIICode trick_buf[ERROR_LINE + 1];
55 extern Integer trick_count;
56 extern Integer first_count;
57 
58 extern void println(void);
59 extern void print_char(ASCIICode s);
60 extern void print(StrNumber s);
61 extern void printnl(StrNumber s);
62 extern void print_esc(StrNumber s);
63 extern void print_the_digs(EightBits k, char dig[]);
64 extern void print_int(Integer n);
65 extern void print_two(Integer n);
66 extern void print_hex(Integer n);
67 extern void print_roman_int(Integer n);
68 extern void term_input(void);
69 
70 extern void print_mod_init();
71 extern void newline_or_space(size_t len);
72 // 直接输出 string 的函数
73 extern void print_str(Str s);
74 extern void printnl_str(Str s);
75 extern void print_esc_str(Str s);
76 
77 extern void begin_pseudo_print(char* l);
78 extern void set_trick_count();
79 
80 #endif // INC_PRINT
UChar ASCIICode
[#18]: ASCIICode::UChar(8) = [0, 255]
Definition: charset.h:11
#define ERROR_LINE
Definition: tex_constant.h:68
UChar EightBits
[#25]: EightBits::UChar(8) = [0, 255]
Definition: tex_types.h:98
void begin_pseudo_print(char *l)
[#316]
Definition: print.c:478
void set_trick_count()
[#316]
Definition: print.c:486
uint_fast32_t StrNumber
Definition: str.h:73
char * Str
real string.
Definition: str.h:75
void print_esc(StrNumber s)
[#63]: prints escape character, then s .
Definition: print.c:249
void print_int(Integer n)
[#65]: prints an integer in decimal form.
Definition: print.c:276
Selector selector
where to print a message.
Definition: print.c:21
void print_hex(Integer n)
[#67]: 打印十六进制的非负整数 (n >= 0).
Definition: print.c:322
void print_char(ASCIICode s)
[p25#58]: 输出单个 ASCII 字符 .
Definition: print.c:140
void term_input(void)
[#70] print_current_string in str.c .
Definition: print.c:382
Selector
[p24#54]: selector possible settings.
Definition: print.h:29
void printnl(StrNumber s)
[#62]: prints string s at beginning of line.
Definition: print.c:236
ASCIICode trick_buf[ERROR_LINE+1]
circular buffer for pseudoprinting.
Definition: print.c:37
void print_roman_int(Integer n)
[#69]: 打印罗马数字 .
Definition: print.c:339
Integer first_count
another variable for pseudoprinting.
Definition: print.c:47
Integer tally
the number of characters recently printed.
Definition: print.c:25
void print_the_digs(EightBits k, char dig[])
[#64]: prints dig[k − 1]...dig[0] .
Definition: print.c:262
void print(StrNumber s)
[p26#59]: prints string s .
Definition: print.c:199
void print_two(Integer n)
[#69]: 打印两位数字 (0 <= n <= 99).
Definition: print.c:313
FILE * log_file
transcript of TeX session.
Definition: print.c:20
void println(void)
[p25#57]: 输出换行 .
Definition: print.c:87
Integer trick_count
threshold for pseudoprinting, explained later.
Definition: print.c:44
@ LOG_ONLY
prints only on the transcript file.
Definition: print.h:34
@ PSEUDO
puts output into a cyclic buffer that is used by the show_context routine.
Definition: print.h:39
@ NEW_STRING
appends the output to the current string in the string pool.
Definition: print.h:41
@ MAX_SELECTOR
highest selector setting.
Definition: print.h:44
@ TERM_AND_LOG
normal selector setting.
Definition: print.h:35
@ NO_PRINT
doesn't print at all.
Definition: print.h:32
@ TERM_ONLY
prints only on the terminal.
Definition: print.h:33
void print_str(Str s)
Definition: print.c:437
void print_esc_str(Str s)
Definition: print.c:459
void printnl_str(Str s)
Definition: print.c:451
void newline_or_space(size_t len)
Choose add newline or space based on the length to be printed.
Definition: print.c:429
void print_mod_init()
help fucntions
Definition: print.c:404
int64_t Integer
Integer(64) =
Definition: tex_types.h:42