1
4
5# ifndef LMT_PRINTING_H
6# define LMT_PRINTING_H
7
8typedef enum selector_settings {
9 no_print_selector_code,
10 terminal_selector_code,
11 logfile_selector_code,
12 terminal_and_logfile_selector_code,
13 pseudo_selector_code,
14 new_string_selector_code,
15 luabuffer_selector_code,
16} selector_settings;
17
18typedef struct print_state_info {
19 FILE *logfile;
20 char *loggable_info;
21 int selector;
22 int terminal_offset;
23 int logfile_offset;
24 int new_string_line;
25 int tally;
26 unsigned char trick_buffer[max_error_line + 1];
27 int trick_count;
28 int first_count;
29 int saved_selector;
30 int font_in_short_display;
31 FILE *saved_logfile;
32 int saved_logfile_offset;
33} print_state_info;
34
35extern print_state_info lmt_print_state;
36
37typedef enum spec_units {
38 no_unit,
39 pt_unit,
40 mu_unit,
41
42
43
44
45
46} spec_units;
47
48
57
58extern void tex_print_ln (void);
59extern void tex_print_char (int s);
60extern void tex_print_tex_str (int s);
61extern void tex_print_tex_str_esc (strnumber s);
62extern void tex_print_nlp (void);
63extern void tex_print_banner (void);
64extern void tex_print_log_banner (void);
65extern void tex_print_version_banner (void);
66extern void tex_print_int (int n);
67extern void tex_print_hex (long long n);
68extern void tex_print_uhex (long long n);
69extern void tex_print_qhex (long long n);
70extern void tex_print_roman_int (int n);
71extern void tex_print_current_string (void);
72extern void tex_print_cs_checked (halfword p);
73extern void tex_print_cs (halfword p);
74extern void tex_print_cs_name (halfword p);
75extern void tex_print_str (const char *s);
76extern void tex_print_str_esc (const char *s);
77extern void tex_print_posit (halfword d);
78extern void tex_print_dimension (scaled d, int unit);
79extern void tex_print_sparse_dimension (scaled d, int unit);
80extern void tex_print_unit (int unit);
81extern void tex_print_glue (scaled d, int order, int unit);
82extern void tex_print_spec (int p, int unit);
83extern void tex_print_fontspec (int p);
84extern void tex_print_mathspec (int p);
85extern void tex_print_font_identifier (halfword f);
86extern void tex_print_font_specifier (halfword e);
87extern void tex_print_font (halfword f);
88extern void tex_print_char_identifier (halfword c);
89extern void tex_print_token_list (const char *s, halfword p);
90extern void tex_print_rule_dimension (scaled d);
91extern void tex_print_group (int e);
92extern void tex_print_format (const char *format, ...);
93extern const char *tex_print_format_args (const char *format, va_list args);
94extern void tex_begin_diagnostic (void);
95extern void tex_print_levels (void);
96extern void tex_end_diagnostic (void);
97extern void tex_show_box (halfword p);
98extern void tex_short_display (halfword p);
99extern void tex_print_message (const char *s);
100
101static inline int tex_single_letter(strnumber s)
102{
103 return (
104 (str_length(s) == 1)
105 || ( (str_length(s) == 4) && *(str_string(s) ) >= 0xF0)
106 || ( (str_length(s) == 3) && *(str_string(s) ) >= 0xE0)
107 || ( (str_length(s) == 2) && *(str_string(s) ) >= 0xC0)
108 );
109}
110
111static inline int tex_is_active_cs(strnumber s)
112{
113 if (s && str_length(s) > 3) {
114 const unsigned char *ss = str_string(s);
115 return (ss[0] == active_first) && (ss[1] == active_second) && (ss[2] == active_third);
116 } else {
117 return 0;
118 }
119}
120
121static inline void tex_aux_show_group_count(int n)
122{
123 for (int i = 1; i <= n; i++) {
124 tex_print_str("{}");
125 }
126}
127
128# endif
129 |