| 1 |
/* conditional.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 CONDITIONAL_H |
| 22 |
# define CONDITIONAL_H |
| 23 |
|
| 24 |
# define unless_code 32 /* amount added for `\.{\\unless}' prefix */ |
| 25 |
|
| 26 |
typedef enum { |
| 27 |
if_char_code = 0, /* \.{\\if} */ |
| 28 |
if_cat_code = 1, /* \.{\\ifcat} */ |
| 29 |
if_int_code = 2, /* \.{\\ifnum} */ |
| 30 |
if_dim_code = 3, /* \.{\\ifdim} */ |
| 31 |
if_odd_code = 4, /* \.{\\ifodd} */ |
| 32 |
if_vmode_code = 5, /* \.{\\ifvmode} */ |
| 33 |
if_hmode_code = 6, /* \.{\\ifhmode} */ |
| 34 |
if_mmode_code = 7, /* \.{\\ifmmode} */ |
| 35 |
if_inner_code = 8, /* \.{\\ifinner} */ |
| 36 |
if_void_code = 9, /* \.{\\ifvoid} */ |
| 37 |
if_hbox_code = 10, /* \.{\\ifhbox} */ |
| 38 |
if_vbox_code = 11, /* \.{\\ifvbox} */ |
| 39 |
if_x_code = 12, /* \.{\\ifx} */ |
| 40 |
if_eof_code = 13, /* \.{\\ifeof} */ |
| 41 |
if_true_code = 14, /* \.{\\iftrue} */ |
| 42 |
if_false_code = 15, /* \.{\\iffalse} */ |
| 43 |
if_case_code = 16, /* \.{\\ifcase} */ |
| 44 |
if_def_code = 17, /* \.{\\ifdefined} */ |
| 45 |
if_cs_code = 18, /* \.{\\ifcsname} */ |
| 46 |
if_font_char_code = 19, /* \.{\\iffontchar} */ |
| 47 |
if_in_csname_code = 20, /* \.{\\ifincsname} */ |
| 48 |
if_primitive_code = 21, /* \.{\\ifprimitive} */ |
| 49 |
if_abs_num_code = 22, /* \.{\\ifabsnum} */ |
| 50 |
if_abs_dim_code = 23, /* \.{\\ifabsdim} */ |
| 51 |
if_condition_code = 24, /* \.{\\ifcondition} */ |
| 52 |
} if_type_codes; |
| 53 |
|
| 54 |
# define if_limit_subtype(A) subtype((A)+1) |
| 55 |
# define if_limit_type(A) type((A)+1) |
| 56 |
# define if_line_field(A) vlink((A)+1) |
| 57 |
|
| 58 |
typedef enum { |
| 59 |
if_code = 1, /* \.{\\if...} */ |
| 60 |
fi_code = 2, /* \.{\\fi} */ |
| 61 |
else_code = 3, /* \.{\\else} */ |
| 62 |
or_code = 4, /* \.{\\or} */ |
| 63 |
} else_type_codes; |
| 64 |
|
| 65 |
extern halfword cond_ptr; /* top of the condition stack */ |
| 66 |
extern int if_limit; /* upper bound on |fi_or_else| codes */ |
| 67 |
extern int cur_if; /* type of conditional being worked on */ |
| 68 |
extern int if_line; /* line where that conditional began */ |
| 69 |
extern int skip_line; /* skipping began here */ |
| 70 |
|
| 71 |
extern void pass_text(void); |
| 72 |
extern void push_condition_stack(void); |
| 73 |
extern void pop_condition_stack(void); |
| 74 |
extern void change_if_limit(int l, halfword p); |
| 75 |
|
| 76 |
extern void conditional(void); |
| 77 |
|
| 78 |
#endif |