texinserts.h /size: 3892 b    last modification: 2024-01-16 10:22
1/*
2    See license.txt in the root of this project.
3*/
4
5# ifndef LMT_INSERTS_H
6# define LMT_INSERTS_H
7
8typedef struct insert_record {
9    halfword limit;
10    halfword multiplier;
11    halfword distance;
12    halfword content;
13    halfword initialized;
14    halfword options;
15    halfword penalty;
16    halfword maxdepth;
17} insert_record;
18
19typedef enum insert_modes {
20    unset_insert_mode,
21    index_insert_mode,
22    class_insert_mode,
23} insert_modes;
24
25typedef enum insert_class_options {
26    insert_option_storing  = 0x1,
27    insert_option_penalty  = 0x2,
28    insert_option_maxdepth = 0x4,
29} insert_class_options;
30
31typedef enum insert_storage_actions {
32    insert_storage_ignore,
33    insert_storage_delay,
34    insert_storage_inject,
35} insert_storage_actions;
36
37typedef struct insert_state_info {
38    insert_record *inserts;
39    memory_data    insert_data;
40    int            mode;
41    halfword       storing;
42    halfword       head;
43    halfword       tail;
44} insert_state_info;
45
46extern insert_state_info lmt_insert_state;
47
48# define has_insert_option(a,b)   (lmt_insert_state.mode == class_insert_mode && (lmt_insert_state.inserts[a].options & b) == b)
49# define set_insert_option(a,b)   (lmt_insert_state.inserts[a].options |= b)
50# define unset_insert_option(a,b) (lmt_insert_state.inserts[a].options & ~(b))
51
52extern scaled   tex_get_insert_limit       (halfword i);
53extern halfword tex_get_insert_multiplier  (halfword i);
54extern halfword tex_get_insert_penalty     (halfword i);
55extern halfword tex_get_insert_distance    (halfword i);
56extern halfword tex_get_insert_maxdepth    (halfword i);
57extern scaled   tex_get_insert_height      (halfword i);
58extern scaled   tex_get_insert_depth       (halfword i);
59extern scaled   tex_get_insert_width       (halfword i);
60extern halfword tex_get_insert_content     (halfword i);
61extern halfword tex_get_insert_storage     (halfword i);
62                                           
63extern void     tex_set_insert_limit       (halfword i, scaled v);
64extern void     tex_set_insert_multiplier  (halfword i, halfword v);
65extern void     tex_set_insert_penalty     (halfword i, halfword v);
66extern void     tex_set_insert_distance    (halfword i, halfword v);
67extern void     tex_set_insert_maxdepth    (halfword i, halfword v);
68extern void     tex_set_insert_height      (halfword i, scaled v);
69extern void     tex_set_insert_depth       (halfword i, scaled v);
70extern void     tex_set_insert_width       (halfword i, scaled v);
71extern void     tex_set_insert_content     (halfword i, halfword v);
72extern void     tex_set_insert_storage     (halfword i, halfword v);
73                                           
74extern void     tex_wipe_insert            (halfword i);
75                                           
76extern void     tex_initialize_inserts     (void);
77extern int      tex_valid_insert_id        (halfword n);
78extern void     tex_dump_insert_data       (dumpstream f);
79extern void     tex_undump_insert_data     (dumpstream f);
80                                           
81extern halfword lmt_get_insert_distance    (halfword i, int slot); /* callback */
82                                           
83extern halfword tex_get_insert_progress    (halfword i);
84                                           
85extern void     tex_insert_store           (halfword i, halfword n);
86extern void     tex_insert_restore         (halfword n);
87extern int      tex_insert_stored          (void);
88                                           
89extern halfword tex_scan_insert_index      (void);
90extern void     tex_set_insert_mode        (halfword mode);
91extern int      tex_insert_is_void         (halfword i);
92                                           
93extern void     tex_run_insert             (void);
94extern void     tex_finish_insert_group    (void);
95
96extern void     tex_show_insert_group      (void);
97extern int      tex_show_insert_record     (void);
98
99# endif
100