summaryrefslogtreecommitdiff
path: root/source/luametatex/source/tex/texcommands.h
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2023-01-04 12:09:26 +0100
committerContext Git Mirror Bot <phg@phi-gamma.net>2023-01-04 12:09:26 +0100
commit705b807c950a697d3c8be592c452a6fb3e561c7e (patch)
tree82904661aca945d008f07deb568ee7f05b55df4f /source/luametatex/source/tex/texcommands.h
parent62d980c99a617ff260f29ac2d3bdb084049f25b0 (diff)
downloadcontext-705b807c950a697d3c8be592c452a6fb3e561c7e.tar.gz
2023-01-04 11:35:00
Diffstat (limited to 'source/luametatex/source/tex/texcommands.h')
-rw-r--r--source/luametatex/source/tex/texcommands.h36
1 files changed, 20 insertions, 16 deletions
diff --git a/source/luametatex/source/tex/texcommands.h b/source/luametatex/source/tex/texcommands.h
index be0639af7..6495c93f0 100644
--- a/source/luametatex/source/tex/texcommands.h
+++ b/source/luametatex/source/tex/texcommands.h
@@ -336,27 +336,31 @@ typedef enum tex_command_code {
# define is_nodebased_cmd(cmd) (cmd >= gluespec_cmd && cmd <= fontspec_cmd)
# define is_constant_cmd(cmd) (cmd >= integer_cmd && cmd <= gluespec_cmd)
-# if (main_control_mode == 1)
-
-/*tex Once these were different numbers, no series: */
+/*tex Once these were different numbers, no series (see archive): */
typedef enum tex_modes {
- nomode,
- vmode,
- hmode,
- mmode,
+ nomode = 0,
+ vmode = 1,
+ hmode = 2,
+ mmode = 3,
+ internal_vmode = -1,
+ restricted_hmode = -2,
+ inline_mmode = -3,
} tex_modes;
-# else
-
-typedef enum tex_modes {
- nomode = 0,
- vmode = 1, /*tex vertical mode */
- hmode = 1 + max_command_cmd + 1, /*tex horizontal mode */
- mmode = 1 + 2*(max_command_cmd + 1), /*tex math mode */
-} tex_modes;
+inline int is_v_mode(halfword mode) { return mode == vmode || mode == internal_vmode; }
+inline int is_h_mode(halfword mode) { return mode == hmode || mode == restricted_hmode; }
+inline int is_m_mode(halfword mode) { return mode == mmode || mode == inline_mmode; }
-# endif
+inline int tex_normalized_mode(halfword mode)
+{
+ switch (mode) {
+ case internal_vmode : return vmode;
+ case restricted_hmode: return hmode;
+ case inline_mmode : return mmode;
+ default : return mode;
+ }
+}
typedef enum arithmic_codes {
advance_code,