Debian Codegraph @

texk/upmendex/mendex.h

raw
1 #include <c-auto.h>
2
3 #include <kpathsea/config.h>
4
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <string.h>
8
9 #if defined(WIN32) && defined(WITH_SYSTEM_ICU)
10 #include <icu.h>
11 #else
12 #include <unicode/utypes.h>
13 #include <unicode/ustring.h>
14 #include <unicode/uchar.h>
15 #include <unicode/ucol.h>
16 #include <unicode/unorm2.h>
17 #endif
18
19 #define PAGE_COMPOSIT_DEPTH 10
20 #define MAXDEPTH 5
21
22 struct page {
23 char *page;
24 char *enc;
25 int attr[PAGE_COMPOSIT_DEPTH];
26 };
27
28 struct index {
29 int num;
30 unsigned char words;
31 UChar *dic[MAXDEPTH];
32 UChar *org[MAXDEPTH];
33 UChar *idx[MAXDEPTH];
34 struct page *p;
35 int lnum;
36 };
37
38 #define INITIALLENGTH 10
39
40 struct hanzi_index {
41 UChar idx[INITIALLENGTH];
42 UChar threshold[3];
43 };
44
45 /* convert.c */
46 UChar *u_xstrdup (const UChar *string);
47 void initkanatable(void);
48 int convert(UChar *buff1, UChar *buff2);
49 int pnumconv(char *page, int attr);
50 int dicread(const char *filename);
51
52 /* pageread.c */
53 int lastpage(const char *filename);
54
55 /* sort.c */
56 void init_icu_collator();
57 void wsort(struct index *ind, int num);
58 void pagesort(struct index *ind, int num);
59 int is_latin(UChar *c);
60 int is_numeric(UChar *c);
61 int is_jpn_kana(UChar *c);
62 int is_kor_hngl(UChar *c);
63 int is_hanzi(UChar *c);
64 int is_zhuyin(UChar *c);
65 int is_cyrillic(UChar *c);
66 int is_greek(UChar *c);
67 int is_brahmic(UChar *c);
68 int is_thai(UChar *c);
69 int is_lao(UChar *c);
70 int is_arabic(UChar *c);
71 int is_hebrew(UChar *c);
72 int is_type_mark_or_punct(UChar *c);
73 int is_type_symbol(UChar *c);
74 int chkcontinue(struct page *p, int num);
75 int ss_comp(UChar *s1, UChar *s2);
76
77 #define CH_UNKNOWN 0
78 #define CH_LATIN 1
79 #define CH_CYRILLIC 2
80 #define CH_GREEK 3
81 #define CH_KANA 4
82 #define CH_HANGUL 5
83 #define CH_HANZI 6
84 #define CH_ARABIC 7
85 #define CH_HEBREW 8
86 #define CH_DEVANAGARI 9
87 #define CH_BENGALI 10
88 #define CH_GURMUKHI 11
89 #define CH_GUJARATI 12
90 #define CH_ORIYA 13
91 #define CH_TAMIL 14
92 #define CH_TELUGU 15
93 #define CH_KANNADA 16
94 #define CH_MALAYALAM 17
95 #define CH_SINHALA 18
96 #define CH_THAI 19
97 #define CH_LAO 20
98 #define CH_SYMBOL 0x100
99 #define CH_NUMERIC 0x101
100 #define is_any_script(a) ((CH_LATIN<=(a) && (a)<=CH_LAO))
101 #define NUM_BRAHMIC 12
102 #define BR_DEVA CH_DEVANAGARI - CH_DEVANAGARI
103 #define BR_BENG CH_BENGALI - CH_DEVANAGARI
104 #define BR_GURU CH_GURMUKHI - CH_DEVANAGARI
105 #define BR_GUJR CH_GUJARATI - CH_DEVANAGARI
106 #define BR_ORYA CH_ORIYA - CH_DEVANAGARI
107 #define BR_TAML CH_TAMIL - CH_DEVANAGARI
108 #define BR_TELU CH_TELUGU - CH_DEVANAGARI
109 #define BR_KNDA CH_KANNADA - CH_DEVANAGARI
110 #define BR_MLYM CH_MALAYALAM - CH_DEVANAGARI
111 #define BR_SINH CH_SINHALA - CH_DEVANAGARI
112 #define BR_THAI CH_THAI - CH_DEVANAGARI
113 #define BR_LAO CH_LAO - CH_DEVANAGARI
114
115 /* sort.c */
116 int charset(UChar *c);
117
118 /* styfile.c */
119 void styread(const char *filename);
120 void set_icu_attributes(void);
121
122 /* fread.c */
123 int idxread(char *filename, int start);
124 int multibyte_to_widechar(UChar *wcstr, int32_t size, char *mbstr);
125 int widechar_to_multibyte(char *mbstr, int32_t size, UChar *wcstr);
126
127 /* fwrite.c */
128 int fprintf2 (FILE *fp, const char *format, ...);
129 void warn_printf(FILE *fp, const char *format, ...);
130 void verb_printf(FILE *fp, const char *format, ...);
131
132 struct index;
133 void indwrite(char *filename, struct index *ind, int pagenum);
134
135 #define multibytelen(a) ((a)<0x80 ? 1 : ((a)<0xc2 ? -2 : ((a)<0xe0 ? 2 : ((a)<0xf0 ? 3 : ((a)<0xf5 ? 4 : -1)))))
136 #define is_surrogate_pair(a) (U16_IS_LEAD(*(a)) && U16_IS_TRAIL(*(a+1)))
137
138 #ifdef WIN32
139 #undef fprintf
140 #undef fputs
141 #undef fopen
142 #define fprintf fprintf2
143 #define fputs win32_fputs
144 #define fopen fsyscp_fopen
145 #endif