TeX in C
Explore TeX with modern c compiler.
io.h
浏览该文件的文档.
1 #pragma once
2 #ifndef INC_IO_H
6 #define INC_IO_H
7 #include <stdio.h> // FILE
8 #include "global.h"
9 #include "tex_constant.h" // [const] BUF_SIZE, ERROR_LINE, FILE_NAME_SIZE
10 #include "charset.h" // [var] xord; [type] ASCIICode
11 #include "str.h"
12 
17 #define wopenout a_open_out
18 // [p17#33] 无需打开输出流,直接使用 stdout
19 // #define topenin() (termin = stdin) // 33, 37
20 // #define topenout() (termout = stdout) // 33, 1332
21 
23 #define TERM_IN stdin
25 #define TERM_OUT stdout
27 #define TERM_ERR stderr
28 
30 #define update_terminal() fflush(TERM_OUT)
33 #define clear_terminal() // end group S25x37_P13x18
35 
41 #define FORMAT_DEFAULT_LENGTH 20
42 #define formatarealength 11
43 #define formatextlength 4
45 #define formatextension S(256) // end group S511x538_P188x195
47 
48 
49 extern Char name_of_file[FILE_NAME_SIZE + 1];
50 extern UInt16 namelength;
51 
52 extern ASCIICode buffer[BUF_SIZE + 1];
53 extern UInt16 first;
54 extern UInt16 last;
55 extern UInt16 max_buf_stack;
56 
57 // [inputln], tex
58 extern Boolean inputln(FILE* f, Boolean bypass_eoln);
59 extern Boolean initterminal(void);
60 
61 
62 // io_unix
63 // [funcs], tex
64 extern int PASCAL_MAIN(int argc, char** argv);
65 extern Boolean initinc(int _not_use_);
66 extern Boolean open_fmt(FILE** fmt);
67 extern void fix_date_and_time(Integer* p_time, Integer* p_day, Integer* p_month,
68  Integer* p_year);
70 
71 // [funcs], fonts, tex
72 extern Boolean a_open_in(FILE** f);
73 
74 // [funcs], dviout, tex
75 extern Boolean a_open_out(FILE** f);
76 
77 extern void aclose(FILE** f);
78 extern void w_close(FILE** f);
79 
80 
81 // io_fname
84 extern StrNumber job_name;
85 extern Boolean log_opened;
87 
88 extern void fname_init();
91 extern void scan_file_name(void);
92 extern void print_file_name(StrNumber n, StrNumber a, StrNumber e);
93 extern void pack_file_name(StrNumber fname, StrNumber prefix, StrNumber ext);
94 extern void pack_job_name(StrNumber s);
95 extern void prompt_file_name(StrNumber s, StrNumber e);
96 extern void open_log_file(void);
97 extern void start_input(void);
98 
99 #endif /* INC_IO_H */
UChar ASCIICode
[#18]: ASCIICode::UChar(8) = [0, 255]
Definition: charset.h:11
#define BUF_SIZE
[#11] maximum number of characters simultaneously present.
Definition: tex_constant.h:51
#define FILE_NAME_SIZE
[#11] file names shouldn’t be longer than this.
Definition: tex_constant.h:113
void fix_date_and_time(Integer *p_time, Integer *p_day, Integer *p_month, Integer *p_year)
[p97#241] establishes the initial values of the date and time.
Definition: eqtb.c:215
Boolean initterminal(void)
[#37] gets the terminal input started.
Definition: io.c:89
UInt16 first
[#30]: the first unused position in buffer. [0, BUF_SIZE=5000]
Definition: io.c:25
UInt16 last
[#30]: end of the line just input to buffer. [0, BUF_SIZE=5000]
Definition: io.c:27
ASCIICode buffer[BUF_SIZE+1]
[#30]: lines of characters being read
Definition: io.c:23
Boolean inputln(FILE *f, Boolean bypass_eoln)
[#31] inputs the next line or returns false.
Definition: io.c:46
void aclose(FILE **f)
Definition: io.c:33
UInt16 namelength
[#26]: this many characters are actually relevant in name_of_file (the rest are blank).
Definition: io.c:20
void w_close(FILE **f)
Definition: io.c:38
UInt16 max_buf_stack
[#30]: largest index used in buffer. [0, BUF_SIZE=5000]
Definition: io.c:29
Char name_of_file[FILE_NAME_SIZE+1]
[#26]: on some systems this may be a record variable.
Definition: io.c:14
uint_fast32_t StrNumber
Definition: str.h:73
StrNumber w_make_name_string()
Definition: io_fname.c:151
Boolean name_in_progress
[#527] is a file name being scanned? xref: scan_file_name, newfont, expand
Definition: io_fname.c:35
StrNumber cur_name
[#512] name of file just scanned.
Definition: io_fname.c:19
StrNumber job_name
[#527] principal file name.
Definition: io_fname.c:40
void print_file_name(StrNumber n, StrNumber a, StrNumber e)
[#518]
Definition: io_fname.c:98
void scan_file_name(void)
[#526]
Definition: io_fname.c:154
void prompt_file_name(StrNumber s, StrNumber e)
[#530]
Definition: io_fname.c:180
void pack_job_name(StrNumber s)
[#529] s = ".log" , ".dvi" , or format extension.
Definition: io_fname.c:172
Boolean log_opened
[#527] has the transcript file been opened?
Definition: io_fname.c:42
StrNumber output_file_name
[#532] full name of the output file.
Definition: io_fname.c:45
void start_input(void)
[#p195#537] TeX will \input something.
Definition: io_fname.c:272
void fname_init()
[ #511. File names. ]
Definition: io_fname.c:53
void pack_file_name(StrNumber fname, StrNumber prefix, StrNumber ext)
[#519] 打包文件名.
Definition: io_fname.c:118
StrNumber b_make_name_string()
Definition: io_fname.c:150
void open_log_file(void)
[#534]
Definition: io_fname.c:221
int PASCAL_MAIN(int argc, char **argv)
Definition: io_unix.c:80
Boolean open_fmt(FILE **fmt)
[#524]
Definition: io_unix.c:134
Boolean a_open_in(FILE **f)
Definition: io_unix.c:184
Boolean initinc(int _not_use_)
Definition: io_unix.c:44
StrNumber cur_area
Definition: io.h:82
StrNumber log_name
Definition: io.h:86
Boolean a_open_out(FILE **f)
Definition: io_unix.c:206
StrNumber cur_ext
Definition: io.h:82
Boolean need_to_load_format
Definition: io_unix.c:11
int64_t Integer
Integer(64) =
Definition: tex_types.h:42
bool Boolean
布尔类型定义
Definition: tex_types.h:11
uint16_t UInt16
UInt16(16) = = [0, 65536)
Definition: tex_types.h:48
UChar Char
Char(8) = [0, 255]
Definition: tex_types.h:39