texmathcodes.h /size: 2970 b    last modification: 2025-02-21 11:03
1/*
2    See license.txt in the root of this project.
3*/
4
5# ifndef LMT_MATHCODES_H
6# define LMT_MATHCODES_H
7
8/*tex
9    We keep this special value which is used in |0x8000| so we have no real problem with 8 being
10    some other class as well. The 8 here is not really a class.
11*/
12
13# define active_math_class_value 8
14
15typedef enum mathcode_codes {
16    no_mathcode,
17    tex_mathcode,
18    umath_mathcode,
19 /* umathnum_mathcode, */
20    mathspec_mathcode
21} mathcode_codes;
22
23typedef struct mathcodeval {
24    short class_value;
25    short family_value;
26    int   character_value;
27} mathcodeval;
28
29typedef struct mathdictval {
30    unsigned short properties; // 1=char 2=open 4=close 8=middle 16=middle==class 
31    unsigned short group;
32    unsigned int   index;
33} mathdictval;
34
35/*tex 
36    We could have the next variant, on which case we could even have dict properties
37    that control when left and right classes kick in. We only just started scratching
38    the surface of possibilities. 
39*/
40
41// typedef struct mathcodeval {
42//     unsigned char class_value;
43//     unsigned char left_class_value;
44//     unsigned char right_class_value;
45//     unsigned char family_value;
46//     int           character_value;
47// } mathcodeval;
48
49# undef small /* defined in some microsoft library */
50
51/*tex
52    Until we drop 8 bit font support we keep the small and large distinction but it might
53    go away some day as it wastes memory.
54*/
55
56typedef struct delcodeval {
57    mathcodeval small;
58    mathcodeval large;
59} delcodeval;
60
61typedef struct mathspecval {
62    mathcodeval code;
63    mathdictval dict;
64} mathspecval;
65
66extern void        tex_set_math_code              (int n, mathcodeval v, int gl);
67extern mathcodeval tex_get_math_code              (int n);
68extern int         tex_get_math_code_number       (int n);
69extern mathcodeval tex_no_math_code               (void);
70
71extern void        tex_set_del_code               (int n, delcodeval v, int gl);
72extern delcodeval  tex_get_del_code               (int n);
73extern int         tex_get_del_code_number        (int n);
74extern int         tex_has_del_code               (delcodeval v);
75extern delcodeval  tex_no_del_code                (void);
76
77extern mathcodeval tex_scan_mathchar              (int extcode);
78extern mathdictval tex_scan_mathdict              (void);
79extern mathcodeval tex_scan_delimiter_as_mathchar (int extcode);
80extern mathcodeval tex_mathchar_from_integer      (int value, int extcode);
81extern mathcodeval tex_mathchar_from_spec         (int value);
82
83extern void        tex_show_mathcode_value        (mathcodeval d, int extcode);
84extern void        tex_unsave_math_codes          (int grouplevel);
85extern void        tex_initialize_math_codes      (void);
86extern void        tex_dump_math_codes            (dumpstream f);
87extern void        tex_undump_math_codes          (dumpstream f);
88
89extern void        tex_free_math_codes            (void);
90
91extern mathdictval tex_no_dict_code               (void);
92
93# endif
94