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} hash_state_info ;
31
32extern hash_state_info lmt_hash_state;
33
34
44
45# define cs_next(a) lmt_hash_state.hash[(a)].half0
46# define cs_text(a) lmt_hash_state.hash[(a)].half1
47
48# define undefined_primitive 0
49# define prim_size 2100
50# define prim_prime 1777
51
52typedef struct primitive_info {
53 halfword subids;
54 halfword offset;
55 strnumber *names;
56} prim_info;
57
58typedef struct primitive_state_info {
59 memoryword prim[prim_size + 1];
60 memoryword prim_eqtb[prim_size + 1];
61 prim_info prim_data[last_cmd + 1];
62 halfword prim_used;
63
64 int padding;
65} primitive_state_info;
66
67extern primitive_state_info lmt_primitive_state;
68
69# define prim_next(a) lmt_primitive_state.prim[(a)].half0
70# define prim_text(a) lmt_primitive_state.prim[(a)].half1
71# define prim_origin(a) lmt_primitive_state.prim_eqtb[(a)].quart01
72# define prim_eq_type(a) lmt_primitive_state.prim_eqtb[(a)].quart00
73# define prim_equiv(a) lmt_primitive_state.prim_eqtb[(a)].half1
74
75# define get_prim_eq_type(p) prim_eq_type(p)
76# define get_prim_equiv(p) prim_equiv(p)
77# define get_prim_text(p) prim_text(p)
78# define get_prim_origin(p) prim_origin(p)
79
80extern void tex_initialize_primitives (void);
81extern void tex_initialize_hash_mem (void);
82
83extern halfword tex_prim_lookup (strnumber s);
84
85extern void tex_primitive (int cmd_origin, const char *ss, singleword cmd, halfword chr, halfword offset);
86extern void tex_primitive_def (const char *str, size_t length, singleword cmd, halfword chr);
87extern void tex_print_cmd_chr (singleword cmd, halfword chr);
88extern void tex_dump_primitives (dumpstream f);
89extern void tex_undump_primitives (dumpstream f);
90extern void tex_dump_hashtable (dumpstream f);
91extern void tex_undump_hashtable (dumpstream f);
92
93extern halfword tex_string_locate (const char *s, size_t l, int create);
94extern halfword tex_string_locate_only (const char *s, size_t l);
95extern halfword tex_located_string (const char *s);
96
97extern halfword tex_id_locate (int j, int l, int create);
98extern halfword tex_id_locate_only (int j, int l);
99extern void tex_print_cmd_flags (halfword cs, halfword cmd, int flags, int escape);
100
101# endif
102 |