texlanguage.h /size: 3487 b    last modification: 2024-01-16 10:22
1/*
2    See license.txt in the root of this project.
3*/
4
5# ifndef LMT_TEXLANG_H
6# define LMT_TEXLANG_H
7
8/*tex We resolve the properties beforehand and store them in a struct. */
9
10typedef struct language_state_info {
11    struct tex_language **languages;
12    memory_data           language_data;
13    lua_Integer           handler_table_id;
14    int                   handler_count;
15} language_state_info;
16
17extern language_state_info lmt_language_state;
18
19typedef struct lang_variables {
20    halfword pre_hyphen_char;
21    halfword post_hyphen_char;
22    halfword pre_exhyphen_char;
23    halfword post_exhyphen_char;
24} lang_variables;
25
26/*tex This is used in: */
27
28typedef struct tex_language {
29    halfword        pre_hyphen_char;
30    halfword        post_hyphen_char;
31    halfword        pre_exhyphen_char;
32    halfword        post_exhyphen_char;
33    halfword        hyphenation_min;
34    halfword        id;
35    hjn_dictionary *patterns;
36    int             exceptions;
37    int             wordhandler;
38    sa_tree         hjcode_head;
39} tex_language;
40
41extern tex_language *tex_new_language           (halfword n);
42extern tex_language *tex_get_language           (halfword n);
43/*     void          tex_free_languages         (void); */
44
45extern void          tex_load_patterns          (struct tex_language *lang, const unsigned char *buf);
46extern void          tex_load_hyphenation       (struct tex_language *lang, const unsigned char *buf);
47
48extern void          tex_handle_hyphenation     (halfword h, halfword t);
49extern void          tex_clear_patterns         (struct tex_language *lang);
50extern void          tex_clear_hyphenation      (struct tex_language *lang);
51extern const char   *tex_clean_hyphenation      (halfword id, const char *buffer, char **cleaned);
52
53extern void          tex_hyphenate_list         (halfword head, halfword tail);
54extern int           tex_collapse_list          (halfword head, halfword c1, halfword c2, halfword c3);
55
56extern void          tex_set_pre_hyphen_char    (halfword lan, halfword val);
57extern void          tex_set_post_hyphen_char   (halfword lan, halfword val);
58extern halfword      tex_get_pre_hyphen_char    (halfword lan);
59extern halfword      tex_get_post_hyphen_char   (halfword lan);
60
61extern void          tex_set_pre_exhyphen_char  (halfword lan, halfword val);
62extern void          tex_set_post_exhyphen_char (halfword lan, halfword val);
63extern halfword      tex_get_pre_exhyphen_char  (halfword lan);
64extern halfword      tex_get_post_exhyphen_char (halfword lan);
65
66extern void          tex_set_hyphenation_min    (halfword lan, halfword val);
67extern halfword      tex_get_hyphenation_min    (halfword lan);
68
69extern void          tex_dump_language_data     (dumpstream f);
70extern void          tex_undump_language_data   (dumpstream f);
71
72/*     char         *tex_get_exception_strings  (struct tex_language *lang); */
73
74extern void          tex_load_tex_patterns      (halfword curlang, halfword head);
75extern void          tex_load_tex_hyphenation   (halfword curlang, halfword head);
76
77extern void          tex_initialize_languages   (void);
78extern int           tex_is_valid_language      (halfword n);
79
80extern halfword      tex_glyph_to_discretionary (halfword glyph, quarterword code, int keepkern);
81
82/*
83void tex_hnj_hyphen_hyphenate(
84    HyphenDict     *dict,
85    halfword        first,
86    halfword        last,
87    int             size,
88    halfword        left,
89    halfword        right,
90    lang_variables *lan
91);
92*/
93
94# endif
95