Debian Codegraph @

texk/web2c/luatexdir/tex/maincontrol.h

raw
1 /* maincontrol.h
2
3 Copyright 2009 Taco Hoekwater <[email protected]>
4
5 This file is part of LuaTeX.
6
7 LuaTeX is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2 of the License, or (at your
10 option) any later version.
11
12 LuaTeX is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15 License for more details.
16
17 You should have received a copy of the GNU General Public License along
18 with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */
19
20
21 #ifndef MAINCONTROL_H
22 # define MAINCONTROL_H
23
24 # define fil_code 0 /* identifies \.{\\hfil} and \.{\\vfil} */
25 # define fill_code 1 /* identifies \.{\\hfill} and \.{\\vfill} */
26 # define ss_code 2 /* identifies \.{\\hss} and \.{\\vss} */
27 # define fil_neg_code 3 /* identifies \.{\\hfilneg} and \.{\\vfilneg} */
28 # define skip_code 4 /* identifies \.{\\hskip} and \.{\\vskip} */
29 # define mskip_code 5 /* identifies \.{\\mskip} */
30
31 /* The |prefixed_command| does not have to adjust |a| so that |a mod 4=0|,
32 since the following routines test for the \.{\\global} prefix as follows.
33 */
34
35 # define is_global(a) (a>=4)
36
37 # define define(A,B,C) do { \
38 if (is_global(a)) \
39 geq_define((A),(quarterword)(B),(C)); \
40 else \
41 eq_define((A),(quarterword)(B),(C)); \
42 } while (0)
43
44 # define word_define(A,B) do { \
45 if (is_global(a)) \
46 geq_word_define((A),(B)); \
47 else \
48 eq_word_define((A),(B)); \
49 } while (0)
50
51 # define define_lc_code(A,B) do { \
52 if (is_global(a)) \
53 set_lc_code((A),(B),level_one); \
54 else \
55 set_lc_code((A),(B),cur_level); \
56 } while (0)
57
58 # define define_uc_code(A,B) do { \
59 if (is_global(a)) \
60 set_uc_code((A),(B),level_one); \
61 else \
62 set_uc_code((A),(B),cur_level); \
63 } while (0)
64
65 # define define_sf_code(A,B) do { \
66 if (is_global(a)) \
67 set_sf_code((A),(B),level_one); \
68 else \
69 set_sf_code((A),(B),cur_level); \
70 } while (0)
71
72 # define define_cat_code(A,B) do { \
73 if (is_global(a)) \
74 set_cat_code(cat_code_table_par,(A),(B),level_one); \
75 else \
76 set_cat_code(cat_code_table_par,(A),(B),cur_level); \
77 } while (0)
78
79 # define define_fam_fnt(A,B,C) do { \
80 if (is_global(a)) \
81 def_fam_fnt((A),(B),(C),level_one); \
82 else \
83 def_fam_fnt((A),(B),(C),cur_level); \
84 } while (0)
85
86 # define define_math_param(A,B,C) do { \
87 if (is_global(a)) \
88 def_math_param((A),(B),(C),level_one); \
89 else \
90 def_math_param((A),(B),(C),cur_level); \
91 } while (0)
92
93 extern halfword cur_box; /* box to be placed into its context */
94
95 /*
96 A \.{\\chardef} creates a control sequence whose |cmd| is |char_given|;
97 a \.{\\mathchardef} creates a control sequence whose |cmd| is |math_given|;
98 and the corresponding |chr| is the character code or math code. A \.{\\countdef}
99 or \.{\\dimendef} or \.{\\skipdef} or \.{\\muskipdef} creates a control
100 sequence whose |cmd| is |assign_int| or \dots\ or |assign_mu_glue|, and the
101 corresponding |chr| is the |eqtb| location of the internal register in question.
102 */
103
104 # define char_def_code 0 /* |shorthand_def| for \.{\\chardef} */
105 # define math_char_def_code 1 /* |shorthand_def| for \.{\\mathchardef} */
106 # define xmath_char_def_code 2 /* |shorthand_def| for \.{\\Umathchardef} */
107 # define count_def_code 3 /* |shorthand_def| for \.{\\countdef} */
108 # define attribute_def_code 4 /* |shorthand_def| for \.{\\attributedef} */
109 # define dimen_def_code 5 /* |shorthand_def| for \.{\\dimendef} */
110 # define skip_def_code 6 /* |shorthand_def| for \.{\\skipdef} */
111 # define mu_skip_def_code 7 /* |shorthand_def| for \.{\\muskipdef} */
112 # define toks_def_code 8 /* |shorthand_def| for \.{\\toksdef} */
113 # define umath_char_def_code 9 /* |shorthand_def| for \.{\\Umathcharnumdef} */
114
115 extern void adjust_space_factor(void);
116 extern void main_control(void);
117 extern void app_space(void);
118 extern void insert_dollar_sign(void);
119 extern void insert_dollar_sign_par_end(void);
120 extern void you_cant(void);
121 extern void report_illegal_case(void);
122 extern boolean privileged(void);
123 extern boolean its_all_over(void);
124 extern void append_glue(void);
125 extern void append_kern(void);
126 extern void off_save(void);
127 extern void handle_right_brace(void);
128 extern void extra_right_brace(void);
129 extern void normal_paragraph(void);
130 extern void box_end(int box_context);
131 extern void scan_box(int box_context);
132 extern void new_graf(boolean indented);
133 extern void indent_in_hmode(void);
134 extern void head_for_vmode(void);
135 extern void end_graf(int);
136 extern void begin_insert_or_adjust(void);
137 extern void handle_mark(void);
138 extern void append_penalty(void);
139 extern void delete_last(void);
140 extern void unpackage(void);
141 extern void append_italic_correction(void);
142 extern void append_local_box(int kind);
143 extern void append_discretionary(void);
144 extern void build_local_box(void);
145 extern void build_discretionary(void);
146 extern void make_accent(void);
147 extern void align_error(void);
148 extern void no_align_error(void);
149 extern void omit_error(void);
150 extern void do_endv(void);
151 extern void cs_error(void);
152 extern void prefixed_command(void);
153 extern void fixup_directions(void);
154 extern void fixup_directions_only(void);
155
156
157 /* Assignments from Lua need helpers. */
158
159 # define is_int_assign(cmd) (cmd==assign_int_cmd)
160 # define is_attr_assign(cmd) (cmd==assign_attr_cmd)
161 # define is_dim_assign(cmd) (cmd==assign_dimen_cmd)
162 # define is_glue_assign(cmd) (cmd==assign_glue_cmd)
163 # define is_mu_glue_assign(cmd) (cmd==assign_mu_glue_cmd)
164 # define is_toks_assign(cmd) (cmd==assign_toks_cmd)
165
166 # define show_code 0 /* \.{\\show} */
167 # define show_box_code 1 /* \.{\\showbox} */
168 # define show_the_code 2 /* \.{\\showthe} */
169 # define show_lists 3 /* \.{\\showlists} */
170 # define show_groups 4 /* \.{\\showgroups} */
171 # define show_tokens 5 /* \.{\\showtokens} , must be odd! */
172 # define show_ifs 6 /* \.{\\showifs} */
173
174 # define print_if_line(A) if ((A)!=0) { \
175 tprint(" entered on line "); print_int((A)); \
176 }
177
178 /*
179 extern halfword swap_hang_indent(halfword indentation, halfword shape_mode);
180 extern halfword swap_parshape_indent(halfword indentation, halfword width, halfword shape_mode);
181 */
182
183 #define swap_hang_indent(indentation) \
184 ( ((shape_mode_par == 1 || shape_mode_par == 3 || shape_mode_par == -1 || shape_mode_par == -3)) ? negate(indentation) : indentation )
185
186 #define swap_parshape_indent(indentation,width) \
187 ( ((shape_mode_par == 2 || shape_mode_par == 3 || shape_mode_par == -2 || shape_mode_par == -3)) ? (hsize_par - width - indentation) : indentation )
188
189 extern void get_r_token(void);
190 extern void assign_internal_value(int a, halfword p, int cur_val);
191 extern void do_register_command(int a);
192 extern void alter_aux(void);
193 extern void alter_prev_graf(void);
194 extern void alter_page_so_far(void);
195 extern void alter_integer(void);
196 extern void alter_box_dimen(void);
197 extern void new_interaction(void);
198 extern halfword after_token;
199 extern void do_assignments(void);
200 extern void open_or_close_in(void);
201 extern boolean long_help_seen;
202 extern void issue_message(void);
203 extern void give_err_help(void);
204 extern void shift_case(void);
205 extern void show_whatever(void);
206
207 extern void initialize(void); /* this procedure gets things started properly */
208
209 /*extern int local_level;*/
210
211 extern void local_control(void);
212 extern halfword local_scan_box(void);
213 extern int current_local_level(void);
214 extern void end_local_control(void);
215 extern void local_control_message(const char *s);
216
217 #endif