YAZ 5.35.1
stem_UTF_8_danish.c
Go to the documentation of this file.
1
2/* This file was generated automatically by the Snowball to ANSI C compiler */
3
4#include "../runtime/header.h"
5
6#ifdef __cplusplus
7extern "C"
8{
9#endif
10 extern int danish_UTF_8_stem (struct SN_env *z);
11#ifdef __cplusplus
12}
13#endif
14static int r_undouble (struct SN_env *z);
15static int r_other_suffix (struct SN_env *z);
16static int r_consonant_pair (struct SN_env *z);
17static int r_main_suffix (struct SN_env *z);
18static int r_mark_regions (struct SN_env *z);
19#ifdef __cplusplus
20extern "C"
21{
22#endif
23
24
25 extern struct SN_env *danish_UTF_8_create_env (void);
26 extern void danish_UTF_8_close_env (struct SN_env *z);
27
28
29#ifdef __cplusplus
30}
31#endif
32static const symbol s_0_0[3] = { 'h', 'e', 'd' };
33static const symbol s_0_1[5] = { 'e', 't', 'h', 'e', 'd' };
34static const symbol s_0_2[4] = { 'e', 'r', 'e', 'd' };
35static const symbol s_0_3[1] = { 'e' };
36static const symbol s_0_4[5] = { 'e', 'r', 'e', 'd', 'e' };
37static const symbol s_0_5[4] = { 'e', 'n', 'd', 'e' };
38static const symbol s_0_6[6] = { 'e', 'r', 'e', 'n', 'd', 'e' };
39static const symbol s_0_7[3] = { 'e', 'n', 'e' };
40static const symbol s_0_8[4] = { 'e', 'r', 'n', 'e' };
41static const symbol s_0_9[3] = { 'e', 'r', 'e' };
42static const symbol s_0_10[2] = { 'e', 'n' };
43static const symbol s_0_11[5] = { 'h', 'e', 'd', 'e', 'n' };
44static const symbol s_0_12[4] = { 'e', 'r', 'e', 'n' };
45static const symbol s_0_13[2] = { 'e', 'r' };
46static const symbol s_0_14[5] = { 'h', 'e', 'd', 'e', 'r' };
47static const symbol s_0_15[4] = { 'e', 'r', 'e', 'r' };
48static const symbol s_0_16[1] = { 's' };
49static const symbol s_0_17[4] = { 'h', 'e', 'd', 's' };
50static const symbol s_0_18[2] = { 'e', 's' };
51static const symbol s_0_19[5] = { 'e', 'n', 'd', 'e', 's' };
52static const symbol s_0_20[7] = { 'e', 'r', 'e', 'n', 'd', 'e', 's' };
53static const symbol s_0_21[4] = { 'e', 'n', 'e', 's' };
54static const symbol s_0_22[5] = { 'e', 'r', 'n', 'e', 's' };
55static const symbol s_0_23[4] = { 'e', 'r', 'e', 's' };
56static const symbol s_0_24[3] = { 'e', 'n', 's' };
57static const symbol s_0_25[6] = { 'h', 'e', 'd', 'e', 'n', 's' };
58static const symbol s_0_26[5] = { 'e', 'r', 'e', 'n', 's' };
59static const symbol s_0_27[3] = { 'e', 'r', 's' };
60static const symbol s_0_28[3] = { 'e', 't', 's' };
61static const symbol s_0_29[5] = { 'e', 'r', 'e', 't', 's' };
62static const symbol s_0_30[2] = { 'e', 't' };
63static const symbol s_0_31[4] = { 'e', 'r', 'e', 't' };
64
65static const struct among a_0[32] = {
66/* 0 */ {3, s_0_0, -1, 1, 0},
67/* 1 */ {5, s_0_1, 0, 1, 0},
68/* 2 */ {4, s_0_2, -1, 1, 0},
69/* 3 */ {1, s_0_3, -1, 1, 0},
70/* 4 */ {5, s_0_4, 3, 1, 0},
71/* 5 */ {4, s_0_5, 3, 1, 0},
72/* 6 */ {6, s_0_6, 5, 1, 0},
73/* 7 */ {3, s_0_7, 3, 1, 0},
74/* 8 */ {4, s_0_8, 3, 1, 0},
75/* 9 */ {3, s_0_9, 3, 1, 0},
76/* 10 */ {2, s_0_10, -1, 1, 0},
77/* 11 */ {5, s_0_11, 10, 1, 0},
78/* 12 */ {4, s_0_12, 10, 1, 0},
79/* 13 */ {2, s_0_13, -1, 1, 0},
80/* 14 */ {5, s_0_14, 13, 1, 0},
81/* 15 */ {4, s_0_15, 13, 1, 0},
82/* 16 */ {1, s_0_16, -1, 2, 0},
83/* 17 */ {4, s_0_17, 16, 1, 0},
84/* 18 */ {2, s_0_18, 16, 1, 0},
85/* 19 */ {5, s_0_19, 18, 1, 0},
86/* 20 */ {7, s_0_20, 19, 1, 0},
87/* 21 */ {4, s_0_21, 18, 1, 0},
88/* 22 */ {5, s_0_22, 18, 1, 0},
89/* 23 */ {4, s_0_23, 18, 1, 0},
90/* 24 */ {3, s_0_24, 16, 1, 0},
91/* 25 */ {6, s_0_25, 24, 1, 0},
92/* 26 */ {5, s_0_26, 24, 1, 0},
93/* 27 */ {3, s_0_27, 16, 1, 0},
94/* 28 */ {3, s_0_28, 16, 1, 0},
95/* 29 */ {5, s_0_29, 28, 1, 0},
96/* 30 */ {2, s_0_30, -1, 1, 0},
97/* 31 */ {4, s_0_31, 30, 1, 0}
98};
99
100static const symbol s_1_0[2] = { 'g', 'd' };
101static const symbol s_1_1[2] = { 'd', 't' };
102static const symbol s_1_2[2] = { 'g', 't' };
103static const symbol s_1_3[2] = { 'k', 't' };
104
105static const struct among a_1[4] = {
106/* 0 */ {2, s_1_0, -1, -1, 0},
107/* 1 */ {2, s_1_1, -1, -1, 0},
108/* 2 */ {2, s_1_2, -1, -1, 0},
109/* 3 */ {2, s_1_3, -1, -1, 0}
110};
111
112static const symbol s_2_0[2] = { 'i', 'g' };
113static const symbol s_2_1[3] = { 'l', 'i', 'g' };
114static const symbol s_2_2[4] = { 'e', 'l', 'i', 'g' };
115static const symbol s_2_3[3] = { 'e', 'l', 's' };
116static const symbol s_2_4[5] = { 'l', 0xC3, 0xB8, 's', 't' };
117
118static const struct among a_2[5] = {
119/* 0 */ {2, s_2_0, -1, 1, 0},
120/* 1 */ {3, s_2_1, 0, 1, 0},
121/* 2 */ {4, s_2_2, 1, 1, 0},
122/* 3 */ {3, s_2_3, -1, 1, 0},
123/* 4 */ {5, s_2_4, -1, 2, 0}
124};
125
126static const unsigned char g_v[] =
127 { 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 0, 128 };
128
129static const unsigned char g_s_ending[] =
130 { 239, 254, 42, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16 };
131
132static const symbol s_0[] = { 's', 't' };
133static const symbol s_1[] = { 'i', 'g' };
134static const symbol s_2[] = { 'l', 0xC3, 0xB8, 's' };
135
136static int
138{
139 z->I[0] = z->l;
140 {
141 int c_test = z->c; /* test, line 33 */
142 {
143 int ret = skip_utf8 (z->p, z->c, 0, z->l, +3);
144 if (ret < 0)
145 return 0;
146 z->c = ret; /* hop, line 33 */
147 }
148 z->I[1] = z->c; /* setmark x, line 33 */
149 z->c = c_test;
150 }
151 if (out_grouping_U (z, g_v, 97, 248, 1) < 0)
152 return 0; /* goto *//* grouping v, line 34 */
153 { /* gopast *//* non v, line 34 */
154 int ret = in_grouping_U (z, g_v, 97, 248, 1);
155 if (ret < 0)
156 return 0;
157 z->c += ret;
158 }
159 z->I[0] = z->c; /* setmark p1, line 34 */
160 /* try, line 35 */
161 if (!(z->I[0] < z->I[1]))
162 goto lab0;
163 z->I[0] = z->I[1];
164lab0:
165 return 1;
166}
167
168static int
170{
171 int among_var;
172 {
173 int mlimit; /* setlimit, line 41 */
174 int m1 = z->l - z->c;
175 (void) m1;
176 if (z->c < z->I[0])
177 return 0;
178 z->c = z->I[0]; /* tomark, line 41 */
179 mlimit = z->lb;
180 z->lb = z->c;
181 z->c = z->l - m1;
182 z->ket = z->c; /* [, line 41 */
183 if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3
184 || !((1851440 >> (z->p[z->c - 1] & 0x1f)) & 1))
185 {
186 z->lb = mlimit;
187 return 0;
188 }
189 among_var = find_among_b (z, a_0, 32); /* substring, line 41 */
190 if (!(among_var))
191 {
192 z->lb = mlimit;
193 return 0;
194 }
195 z->bra = z->c; /* ], line 41 */
196 z->lb = mlimit;
197 }
198 switch (among_var)
199 {
200 case 0:
201 return 0;
202 case 1:
203 {
204 int ret = slice_del (z); /* delete, line 48 */
205 if (ret < 0)
206 return ret;
207 }
208 break;
209 case 2:
210 if (in_grouping_b_U (z, g_s_ending, 97, 229, 0))
211 return 0;
212 {
213 int ret = slice_del (z); /* delete, line 50 */
214 if (ret < 0)
215 return ret;
216 }
217 break;
218 }
219 return 1;
220}
221
222static int
224{
225 {
226 int m_test = z->l - z->c; /* test, line 55 */
227 {
228 int mlimit; /* setlimit, line 56 */
229 int m1 = z->l - z->c;
230 (void) m1;
231 if (z->c < z->I[0])
232 return 0;
233 z->c = z->I[0]; /* tomark, line 56 */
234 mlimit = z->lb;
235 z->lb = z->c;
236 z->c = z->l - m1;
237 z->ket = z->c; /* [, line 56 */
238 if (z->c - 1 <= z->lb
239 || (z->p[z->c - 1] != 100 && z->p[z->c - 1] != 116))
240 {
241 z->lb = mlimit;
242 return 0;
243 }
244 if (!(find_among_b (z, a_1, 4)))
245 {
246 z->lb = mlimit;
247 return 0;
248 } /* substring, line 56 */
249 z->bra = z->c; /* ], line 56 */
250 z->lb = mlimit;
251 }
252 z->c = z->l - m_test;
253 }
254 {
255 int ret = skip_utf8 (z->p, z->c, z->lb, 0, -1);
256 if (ret < 0)
257 return 0;
258 z->c = ret; /* next, line 62 */
259 }
260 z->bra = z->c; /* ], line 62 */
261 {
262 int ret = slice_del (z); /* delete, line 62 */
263 if (ret < 0)
264 return ret;
265 }
266 return 1;
267}
268
269static int
271{
272 int among_var;
273 {
274 int m1 = z->l - z->c;
275 (void) m1; /* do, line 66 */
276 z->ket = z->c; /* [, line 66 */
277 if (!(eq_s_b (z, 2, s_0)))
278 goto lab0;
279 z->bra = z->c; /* ], line 66 */
280 if (!(eq_s_b (z, 2, s_1)))
281 goto lab0;
282 {
283 int ret = slice_del (z); /* delete, line 66 */
284 if (ret < 0)
285 return ret;
286 }
287 lab0:
288 z->c = z->l - m1;
289 }
290 {
291 int mlimit; /* setlimit, line 67 */
292 int m2 = z->l - z->c;
293 (void) m2;
294 if (z->c < z->I[0])
295 return 0;
296 z->c = z->I[0]; /* tomark, line 67 */
297 mlimit = z->lb;
298 z->lb = z->c;
299 z->c = z->l - m2;
300 z->ket = z->c; /* [, line 67 */
301 if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3
302 || !((1572992 >> (z->p[z->c - 1] & 0x1f)) & 1))
303 {
304 z->lb = mlimit;
305 return 0;
306 }
307 among_var = find_among_b (z, a_2, 5); /* substring, line 67 */
308 if (!(among_var))
309 {
310 z->lb = mlimit;
311 return 0;
312 }
313 z->bra = z->c; /* ], line 67 */
314 z->lb = mlimit;
315 }
316 switch (among_var)
317 {
318 case 0:
319 return 0;
320 case 1:
321 {
322 int ret = slice_del (z); /* delete, line 70 */
323 if (ret < 0)
324 return ret;
325 }
326 {
327 int m3 = z->l - z->c;
328 (void) m3; /* do, line 70 */
329 {
330 int ret = r_consonant_pair (z);
331 if (ret == 0)
332 goto lab1; /* call consonant_pair, line 70 */
333 if (ret < 0)
334 return ret;
335 }
336 lab1:
337 z->c = z->l - m3;
338 }
339 break;
340 case 2:
341 {
342 int ret = slice_from_s (z, 4, s_2); /* <-, line 72 */
343 if (ret < 0)
344 return ret;
345 }
346 break;
347 }
348 return 1;
349}
350
351static int
353{
354 {
355 int mlimit; /* setlimit, line 76 */
356 int m1 = z->l - z->c;
357 (void) m1;
358 if (z->c < z->I[0])
359 return 0;
360 z->c = z->I[0]; /* tomark, line 76 */
361 mlimit = z->lb;
362 z->lb = z->c;
363 z->c = z->l - m1;
364 z->ket = z->c; /* [, line 76 */
365 if (out_grouping_b_U (z, g_v, 97, 248, 0))
366 {
367 z->lb = mlimit;
368 return 0;
369 }
370 z->bra = z->c; /* ], line 76 */
371 z->S[0] = slice_to (z, z->S[0]); /* -> ch, line 76 */
372 if (z->S[0] == 0)
373 return -1; /* -> ch, line 76 */
374 z->lb = mlimit;
375 }
376 if (!(eq_v_b (z, z->S[0])))
377 return 0; /* name ch, line 77 */
378 {
379 int ret = slice_del (z); /* delete, line 78 */
380 if (ret < 0)
381 return ret;
382 }
383 return 1;
384}
385
386extern int
388{
389 {
390 int c1 = z->c; /* do, line 84 */
391 {
392 int ret = r_mark_regions (z);
393 if (ret == 0)
394 goto lab0; /* call mark_regions, line 84 */
395 if (ret < 0)
396 return ret;
397 }
398 lab0:
399 z->c = c1;
400 }
401 z->lb = z->c;
402 z->c = z->l; /* backwards, line 85 */
403
404 {
405 int m2 = z->l - z->c;
406 (void) m2; /* do, line 86 */
407 {
408 int ret = r_main_suffix (z);
409 if (ret == 0)
410 goto lab1; /* call main_suffix, line 86 */
411 if (ret < 0)
412 return ret;
413 }
414 lab1:
415 z->c = z->l - m2;
416 }
417 {
418 int m3 = z->l - z->c;
419 (void) m3; /* do, line 87 */
420 {
421 int ret = r_consonant_pair (z);
422 if (ret == 0)
423 goto lab2; /* call consonant_pair, line 87 */
424 if (ret < 0)
425 return ret;
426 }
427 lab2:
428 z->c = z->l - m3;
429 }
430 {
431 int m4 = z->l - z->c;
432 (void) m4; /* do, line 88 */
433 {
434 int ret = r_other_suffix (z);
435 if (ret == 0)
436 goto lab3; /* call other_suffix, line 88 */
437 if (ret < 0)
438 return ret;
439 }
440 lab3:
441 z->c = z->l - m4;
442 }
443 {
444 int m5 = z->l - z->c;
445 (void) m5; /* do, line 89 */
446 {
447 int ret = r_undouble (z);
448 if (ret == 0)
449 goto lab4; /* call undouble, line 89 */
450 if (ret < 0)
451 return ret;
452 }
453 lab4:
454 z->c = z->l - m5;
455 }
456 z->c = z->lb;
457 return 1;
458}
459
460extern struct SN_env *
462{
463 return SN_create_env (1, 2, 0);
464}
465
466extern void
468{
469 SN_close_env (z, 1);
470}
struct SN_env * SN_create_env(int S_size, int I_size, int B_size)
Definition api.c:6
void SN_close_env(struct SN_env *z, int S_size)
Definition api.c:50
unsigned char symbol
Definition api.h:2
int find_among_b(struct SN_env *z, const struct among *v, int v_size)
Definition utilities.c:400
int out_grouping_U(struct SN_env *z, const unsigned char *s, int min, int max, int repeat)
Definition utilities.c:170
int slice_del(struct SN_env *z)
Definition utilities.c:573
int in_grouping_U(struct SN_env *z, const unsigned char *s, int min, int max, int repeat)
Definition utilities.c:134
int eq_v_b(struct SN_env *z, const symbol *p)
Definition utilities.c:306
int skip_utf8(const symbol *p, int c, int lb, int l, int n)
Definition utilities.c:42
int in_grouping_b_U(struct SN_env *z, const unsigned char *s, int min, int max, int repeat)
Definition utilities.c:152
int eq_s_b(struct SN_env *z, int s_size, const symbol *s)
Definition utilities.c:290
int out_grouping_b_U(struct SN_env *z, const unsigned char *s, int min, int max, int repeat)
Definition utilities.c:187
symbol * slice_to(struct SN_env *z, symbol *p)
Definition utilities.c:605
int slice_from_s(struct SN_env *z, int s_size, const symbol *s)
Definition utilities.c:559
static const symbol s_0_24[3]
static const struct among a_2[5]
static const symbol s_0_2[4]
static const symbol s_2[]
static const symbol s_0_15[4]
static const struct among a_0[32]
static const symbol s_0_13[2]
static const symbol s_0_20[7]
static const symbol s_1_2[2]
static const symbol s_0_14[5]
static int r_other_suffix(struct SN_env *z)
static int r_consonant_pair(struct SN_env *z)
static const symbol s_0_12[4]
static const symbol s_2_3[3]
static const symbol s_0_31[4]
static const symbol s_2_0[2]
static int r_main_suffix(struct SN_env *z)
static const struct among a_1[4]
static const symbol s_1_3[2]
static const symbol s_2_1[3]
static const symbol s_1_0[2]
void danish_UTF_8_close_env(struct SN_env *z)
static const symbol s_0_5[4]
static const symbol s_2_2[4]
static const symbol s_0_11[5]
static const symbol s_0_1[5]
static const symbol s_0_30[2]
static const symbol s_2_4[5]
static const symbol s_0_17[4]
static const symbol s_1_1[2]
static const symbol s_0_0[3]
static int r_undouble(struct SN_env *z)
int danish_UTF_8_stem(struct SN_env *z)
static const symbol s_0_19[5]
static const symbol s_0_18[2]
static const symbol s_0_23[4]
static const symbol s_0_27[3]
static const symbol s_0_16[1]
static const symbol s_0_28[3]
static const symbol s_0_29[5]
static const symbol s_0_9[3]
struct SN_env * danish_UTF_8_create_env(void)
static const symbol s_0_22[5]
static const symbol s_1[]
static int r_mark_regions(struct SN_env *z)
static const symbol s_0_3[1]
static const symbol s_0_6[6]
static const symbol s_0_8[4]
static const symbol s_0_25[6]
static const symbol s_0_7[3]
static const symbol s_0_26[5]
static const symbol s_0_10[2]
static const unsigned char g_v[]
static const unsigned char g_s_ending[]
static const symbol s_0_21[4]
static const symbol s_0[]
static const symbol s_0_4[5]
Definition api.h:14
int lb
Definition api.h:16
symbol * p
Definition api.h:15
int * I
Definition api.h:18
int ket
Definition api.h:16
int c
Definition api.h:16
int bra
Definition api.h:16
int l
Definition api.h:16
symbol ** S
Definition api.h:17
Definition header.h:16