summaryrefslogtreecommitdiff
path: root/source/luametatex/source/tex/texlanguage.h
blob: f00bf16c6c2e62dcf775fd0f3d89550ec6e1e0ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/*
    See license.txt in the root of this project.
*/

# ifndef LMT_TEXLANG_H
# define LMT_TEXLANG_H

/*tex We resolve the properties beforehand and store them in a struct. */

typedef struct language_state_info {
    struct tex_language **languages;
    memory_data           language_data;
    lua_Integer           handler_table_id;
    int                   handler_count;
} language_state_info;

extern language_state_info lmt_language_state;

typedef struct lang_variables {
    halfword pre_hyphen_char;
    halfword post_hyphen_char;
    halfword pre_exhyphen_char;
    halfword post_exhyphen_char;
} lang_variables;

/*tex This is used in: */

typedef struct tex_language {
    halfword        pre_hyphen_char;
    halfword        post_hyphen_char;
    halfword        pre_exhyphen_char;
    halfword        post_exhyphen_char;
    halfword        hyphenation_min;
    halfword        id;
    hjn_dictionary *patterns;
    int             exceptions;
    int             wordhandler;
    sa_tree         hjcode_head;
} tex_language;

extern tex_language *tex_new_language           (halfword n);
extern tex_language *tex_get_language           (halfword n);
/*     void          tex_free_languages         (void); */

extern void          tex_load_patterns          (struct tex_language *lang, const unsigned char *buf);
extern void          tex_load_hyphenation       (struct tex_language *lang, const unsigned char *buf);

extern void          tex_handle_hyphenation     (halfword h, halfword t);
extern void          tex_clear_patterns         (struct tex_language *lang);
extern void          tex_clear_hyphenation      (struct tex_language *lang);
extern const char   *tex_clean_hyphenation      (halfword id, const char *buffer, char **cleaned);

extern void          tex_hyphenate_list         (halfword head, halfword tail);
extern int           tex_collapse_list          (halfword head, halfword c1, halfword c2, halfword c3);

extern void          tex_set_pre_hyphen_char    (halfword lan, halfword val);
extern void          tex_set_post_hyphen_char   (halfword lan, halfword val);
extern halfword      tex_get_pre_hyphen_char    (halfword lan);
extern halfword      tex_get_post_hyphen_char   (halfword lan);

extern void          tex_set_pre_exhyphen_char  (halfword lan, halfword val);
extern void          tex_set_post_exhyphen_char (halfword lan, halfword val);
extern halfword      tex_get_pre_exhyphen_char  (halfword lan);
extern halfword      tex_get_post_exhyphen_char (halfword lan);

extern void          tex_set_hyphenation_min    (halfword lan, halfword val);
extern halfword      tex_get_hyphenation_min    (halfword lan);

extern void          tex_dump_language_data     (dumpstream f);
extern void          tex_undump_language_data   (dumpstream f);

/*     char         *tex_get_exception_strings  (struct tex_language *lang); */

extern void          tex_load_tex_patterns      (halfword curlang, halfword head);
extern void          tex_load_tex_hyphenation   (halfword curlang, halfword head);

extern void          tex_initialize_languages   (void);
extern int           tex_is_valid_language      (halfword n);

extern halfword      tex_glyph_to_discretionary (halfword glyph, quarterword code, int keepkern);

/*
void tex_hnj_hyphen_hyphenate(
    HyphenDict     *dict,
    halfword        first,
    halfword        last,
    int             size,
    halfword        left,
    halfword        right,
    lang_variables *lan
);
*/

# endif