1
4
5# ifndef LMT_PRIMITIVE_H
6# define LMT_PRIMITIVE_H
7
8
15
16typedef enum command_origin {
17 tex_command = 1,
18 etex_command = 2,
19 luatex_command = 4,
20 no_command = 8,
21} command_origin;
22
23typedef struct hash_state_info {
24 memoryword *hash;
25 memory_data hash_data;
26 memoryword *eqtb;
27 memory_data eqtb_data;
28 int no_new_cs;
29 int padding;
30 unsigned char destructors[number_tex_commands];
31} hash_state_info ;
32
33extern hash_state_info lmt_hash_state;
34
35
45
46# define cs_next(a) lmt_hash_state.hash[(a)].half0
47# define cs_text(a) lmt_hash_state.hash[(a)].half1
48
49# define undefined_primitive 0
50# define prim_size 2100
51# define prim_prime 1777
52
53typedef struct primitive_info {
54 halfword subids;
55 halfword offset;
56 strnumber *names;
57} prim_info;
58
59typedef struct primitive_state_info {
60 memoryword prim[prim_size + 1];
61 memoryword prim_eqtb[prim_size + 1];
62 prim_info prim_data[last_cmd + 1];
63 halfword prim_used;
64
65 int padding;
66} primitive_state_info;
67
68extern primitive_state_info lmt_primitive_state;
69
70# define prim_next(a) lmt_primitive_state.prim[(a)].half0
71# define prim_text(a) lmt_primitive_state.prim[(a)].half1
72# define prim_origin(a) lmt_primitive_state.prim_eqtb[(a)].quart01
73# define prim_eq_type(a) lmt_primitive_state.prim_eqtb[(a)].quart00
74# define prim_equiv(a) lmt_primitive_state.prim_eqtb[(a)].half1
75
76# define get_prim_eq_type(p) prim_eq_type(p)
77# define get_prim_equiv(p) prim_equiv(p)
78# define get_prim_text(p) prim_text(p)
79# define get_prim_origin(p) prim_origin(p)
80
81extern void tex_initialize_primitives (void);
82extern void tex_initialize_hash_mem (void);
83
84extern halfword tex_prim_lookup (strnumber s);
85
86extern void tex_primitive (int cmd_origin, const char *ss, singleword cmd, halfword chr, halfword offset);
87extern void tex_primitive_def (const char *str, size_t length, singleword cmd, halfword chr);
88extern void tex_print_cmd_chr (singleword cmd, halfword chr);
89extern void tex_dump_primitives (dumpstream f);
90extern void tex_undump_primitives (dumpstream f);
91extern void tex_dump_hashtable (dumpstream f);
92extern void tex_undump_hashtable (dumpstream f);
93
94extern halfword tex_string_locate (const char *s, size_t l, int create);
95extern halfword tex_string_locate_only (const char *s, size_t l);
96extern halfword tex_located_string (const char *s);
97
98extern halfword tex_id_locate (int j, int l, int create);
99extern halfword tex_id_locate_only (int j, int l);
100extern int tex_id_locate_steps (const char *s);
101extern void tex_print_cmd_flags (halfword cs, halfword cmd, int flags, int escape);
102
103# endif
104 |