No issues found
1 /*
2 * Copyright (c) 2001, Dr Martin Porter
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7 * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8 * Neither the name of the <ORGANIZATION> nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
9 *
10 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
11 */
12
13
14
15 /* This file was generated automatically by the Snowball to ANSI C compiler */
16
17 #include "header.h"
18
19 extern int german_UTF_8_stem(struct SN_env * z);
20 static int r_standard_suffix(struct SN_env * z);
21 static int r_R2(struct SN_env * z);
22 static int r_R1(struct SN_env * z);
23 static int r_mark_regions(struct SN_env * z);
24 static int r_postlude(struct SN_env * z);
25 static int r_prelude(struct SN_env * z);
26
27 extern struct SN_env * german_UTF_8_create_env(void);
28 extern void german_UTF_8_close_env(struct SN_env * z);
29
30 static symbol s_0_1[1] = { 'U' };
31 static symbol s_0_2[1] = { 'Y' };
32 static symbol s_0_3[2] = { 0xC3, 0xA4 };
33 static symbol s_0_4[2] = { 0xC3, 0xB6 };
34 static symbol s_0_5[2] = { 0xC3, 0xBC };
35
36 static struct among a_0[6] =
37 {
38 /* 0 */ { 0, 0, -1, 6, 0},
39 /* 1 */ { 1, s_0_1, 0, 2, 0},
40 /* 2 */ { 1, s_0_2, 0, 1, 0},
41 /* 3 */ { 2, s_0_3, 0, 3, 0},
42 /* 4 */ { 2, s_0_4, 0, 4, 0},
43 /* 5 */ { 2, s_0_5, 0, 5, 0}
44 };
45
46 static symbol s_1_0[1] = { 'e' };
47 static symbol s_1_1[2] = { 'e', 'm' };
48 static symbol s_1_2[2] = { 'e', 'n' };
49 static symbol s_1_3[3] = { 'e', 'r', 'n' };
50 static symbol s_1_4[2] = { 'e', 'r' };
51 static symbol s_1_5[1] = { 's' };
52 static symbol s_1_6[2] = { 'e', 's' };
53
54 static struct among a_1[7] =
55 {
56 /* 0 */ { 1, s_1_0, -1, 1, 0},
57 /* 1 */ { 2, s_1_1, -1, 1, 0},
58 /* 2 */ { 2, s_1_2, -1, 1, 0},
59 /* 3 */ { 3, s_1_3, -1, 1, 0},
60 /* 4 */ { 2, s_1_4, -1, 1, 0},
61 /* 5 */ { 1, s_1_5, -1, 2, 0},
62 /* 6 */ { 2, s_1_6, 5, 1, 0}
63 };
64
65 static symbol s_2_0[2] = { 'e', 'n' };
66 static symbol s_2_1[2] = { 'e', 'r' };
67 static symbol s_2_2[2] = { 's', 't' };
68 static symbol s_2_3[3] = { 'e', 's', 't' };
69
70 static struct among a_2[4] =
71 {
72 /* 0 */ { 2, s_2_0, -1, 1, 0},
73 /* 1 */ { 2, s_2_1, -1, 1, 0},
74 /* 2 */ { 2, s_2_2, -1, 2, 0},
75 /* 3 */ { 3, s_2_3, 2, 1, 0}
76 };
77
78 static symbol s_3_0[2] = { 'i', 'g' };
79 static symbol s_3_1[4] = { 'l', 'i', 'c', 'h' };
80
81 static struct among a_3[2] =
82 {
83 /* 0 */ { 2, s_3_0, -1, 1, 0},
84 /* 1 */ { 4, s_3_1, -1, 1, 0}
85 };
86
87 static symbol s_4_0[3] = { 'e', 'n', 'd' };
88 static symbol s_4_1[2] = { 'i', 'g' };
89 static symbol s_4_2[3] = { 'u', 'n', 'g' };
90 static symbol s_4_3[4] = { 'l', 'i', 'c', 'h' };
91 static symbol s_4_4[4] = { 'i', 's', 'c', 'h' };
92 static symbol s_4_5[2] = { 'i', 'k' };
93 static symbol s_4_6[4] = { 'h', 'e', 'i', 't' };
94 static symbol s_4_7[4] = { 'k', 'e', 'i', 't' };
95
96 static struct among a_4[8] =
97 {
98 /* 0 */ { 3, s_4_0, -1, 1, 0},
99 /* 1 */ { 2, s_4_1, -1, 2, 0},
100 /* 2 */ { 3, s_4_2, -1, 1, 0},
101 /* 3 */ { 4, s_4_3, -1, 3, 0},
102 /* 4 */ { 4, s_4_4, -1, 2, 0},
103 /* 5 */ { 2, s_4_5, -1, 2, 0},
104 /* 6 */ { 4, s_4_6, -1, 3, 0},
105 /* 7 */ { 4, s_4_7, -1, 4, 0}
106 };
107
108 static unsigned char g_v[] = { 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 32, 8 };
109
110 static unsigned char g_s_ending[] = { 117, 30, 5 };
111
112 static unsigned char g_st_ending[] = { 117, 30, 4 };
113
114 static symbol s_0[] = { 0xC3, 0x9F };
115 static symbol s_1[] = { 's', 's' };
116 static symbol s_2[] = { 'u' };
117 static symbol s_3[] = { 'U' };
118 static symbol s_4[] = { 'y' };
119 static symbol s_5[] = { 'Y' };
120 static symbol s_6[] = { 'y' };
121 static symbol s_7[] = { 'u' };
122 static symbol s_8[] = { 'a' };
123 static symbol s_9[] = { 'o' };
124 static symbol s_10[] = { 'u' };
125 static symbol s_11[] = { 'i', 'g' };
126 static symbol s_12[] = { 'e' };
127 static symbol s_13[] = { 'e' };
128 static symbol s_14[] = { 'e', 'r' };
129 static symbol s_15[] = { 'e', 'n' };
130
131 static int r_prelude(struct SN_env * z) {
132 { int c_test = z->c; /* test, line 30 */
133 while(1) { /* repeat, line 30 */
134 int c = z->c;
135 { int c = z->c; /* or, line 33 */
136 z->bra = z->c; /* [, line 32 */
137 if (!(eq_s(z, 2, s_0))) goto lab2;
138 z->ket = z->c; /* ], line 32 */
139 { int ret;
140 ret = slice_from_s(z, 2, s_1); /* <-, line 32 */
141 if (ret < 0) return ret;
142 }
143 goto lab1;
144 lab2:
145 z->c = c;
146 { int c = skip_utf8(z->p, z->c, 0, z->l, 1);
147 if (c < 0) goto lab0;
148 z->c = c; /* next, line 33 */
149 }
150 }
151 lab1:
152 continue;
153 lab0:
154 z->c = c;
155 break;
156 }
157 z->c = c_test;
158 }
159 while(1) { /* repeat, line 36 */
160 int c = z->c;
161 while(1) { /* goto, line 36 */
162 int c = z->c;
163 if (!(in_grouping_U(z, g_v, 97, 252))) goto lab4;
164 z->bra = z->c; /* [, line 37 */
165 { int c = z->c; /* or, line 37 */
166 if (!(eq_s(z, 1, s_2))) goto lab6;
167 z->ket = z->c; /* ], line 37 */
168 if (!(in_grouping_U(z, g_v, 97, 252))) goto lab6;
169 { int ret;
170 ret = slice_from_s(z, 1, s_3); /* <-, line 37 */
171 if (ret < 0) return ret;
172 }
173 goto lab5;
174 lab6:
175 z->c = c;
176 if (!(eq_s(z, 1, s_4))) goto lab4;
177 z->ket = z->c; /* ], line 38 */
178 if (!(in_grouping_U(z, g_v, 97, 252))) goto lab4;
179 { int ret;
180 ret = slice_from_s(z, 1, s_5); /* <-, line 38 */
181 if (ret < 0) return ret;
182 }
183 }
184 lab5:
185 z->c = c;
186 break;
187 lab4:
188 z->c = c;
189 { int c = skip_utf8(z->p, z->c, 0, z->l, 1);
190 if (c < 0) goto lab3;
191 z->c = c; /* goto, line 36 */
192 }
193 }
194 continue;
195 lab3:
196 z->c = c;
197 break;
198 }
199 return 1;
200 }
201
202 static int r_mark_regions(struct SN_env * z) {
203 z->I[0] = z->l;
204 z->I[1] = z->l;
205 { int c_test = z->c; /* test, line 47 */
206 { int c = skip_utf8(z->p, z->c, 0, z->l, + 3);
207 if (c < 0) return 0;
208 z->c = c; /* hop, line 47 */
209 }
210 z->I[2] = z->c; /* setmark x, line 47 */
211 z->c = c_test;
212 }
213 while(1) { /* gopast, line 49 */
214 if (!(in_grouping_U(z, g_v, 97, 252))) goto lab0;
215 break;
216 lab0:
217 { int c = skip_utf8(z->p, z->c, 0, z->l, 1);
218 if (c < 0) return 0;
219 z->c = c; /* gopast, line 49 */
220 }
221 }
222 while(1) { /* gopast, line 49 */
223 if (!(out_grouping_U(z, g_v, 97, 252))) goto lab1;
224 break;
225 lab1:
226 { int c = skip_utf8(z->p, z->c, 0, z->l, 1);
227 if (c < 0) return 0;
228 z->c = c; /* gopast, line 49 */
229 }
230 }
231 z->I[0] = z->c; /* setmark p1, line 49 */
232 /* try, line 50 */
233 if (!(z->I[0] < z->I[2])) goto lab2;
234 z->I[0] = z->I[2];
235 lab2:
236 while(1) { /* gopast, line 51 */
237 if (!(in_grouping_U(z, g_v, 97, 252))) goto lab3;
238 break;
239 lab3:
240 { int c = skip_utf8(z->p, z->c, 0, z->l, 1);
241 if (c < 0) return 0;
242 z->c = c; /* gopast, line 51 */
243 }
244 }
245 while(1) { /* gopast, line 51 */
246 if (!(out_grouping_U(z, g_v, 97, 252))) goto lab4;
247 break;
248 lab4:
249 { int c = skip_utf8(z->p, z->c, 0, z->l, 1);
250 if (c < 0) return 0;
251 z->c = c; /* gopast, line 51 */
252 }
253 }
254 z->I[1] = z->c; /* setmark p2, line 51 */
255 return 1;
256 }
257
258 static int r_postlude(struct SN_env * z) {
259 int among_var;
260 while(1) { /* repeat, line 55 */
261 int c = z->c;
262 z->bra = z->c; /* [, line 57 */
263 among_var = find_among(z, a_0, 6); /* substring, line 57 */
264 if (!(among_var)) goto lab0;
265 z->ket = z->c; /* ], line 57 */
266 switch(among_var) {
267 case 0: goto lab0;
268 case 1:
269 { int ret;
270 ret = slice_from_s(z, 1, s_6); /* <-, line 58 */
271 if (ret < 0) return ret;
272 }
273 break;
274 case 2:
275 { int ret;
276 ret = slice_from_s(z, 1, s_7); /* <-, line 59 */
277 if (ret < 0) return ret;
278 }
279 break;
280 case 3:
281 { int ret;
282 ret = slice_from_s(z, 1, s_8); /* <-, line 60 */
283 if (ret < 0) return ret;
284 }
285 break;
286 case 4:
287 { int ret;
288 ret = slice_from_s(z, 1, s_9); /* <-, line 61 */
289 if (ret < 0) return ret;
290 }
291 break;
292 case 5:
293 { int ret;
294 ret = slice_from_s(z, 1, s_10); /* <-, line 62 */
295 if (ret < 0) return ret;
296 }
297 break;
298 case 6:
299 { int c = skip_utf8(z->p, z->c, 0, z->l, 1);
300 if (c < 0) goto lab0;
301 z->c = c; /* next, line 63 */
302 }
303 break;
304 }
305 continue;
306 lab0:
307 z->c = c;
308 break;
309 }
310 return 1;
311 }
312
313 static int r_R1(struct SN_env * z) {
314 if (!(z->I[0] <= z->c)) return 0;
315 return 1;
316 }
317
318 static int r_R2(struct SN_env * z) {
319 if (!(z->I[1] <= z->c)) return 0;
320 return 1;
321 }
322
323 static int r_standard_suffix(struct SN_env * z) {
324 int among_var;
325 { int m = z->l - z->c; (void) m; /* do, line 74 */
326 z->ket = z->c; /* [, line 75 */
327 among_var = find_among_b(z, a_1, 7); /* substring, line 75 */
328 if (!(among_var)) goto lab0;
329 z->bra = z->c; /* ], line 75 */
330 { int ret = r_R1(z);
331 if (ret == 0) goto lab0; /* call R1, line 75 */
332 if (ret < 0) return ret;
333 }
334 switch(among_var) {
335 case 0: goto lab0;
336 case 1:
337 { int ret;
338 ret = slice_del(z); /* delete, line 77 */
339 if (ret < 0) return ret;
340 }
341 break;
342 case 2:
343 if (!(in_grouping_b_U(z, g_s_ending, 98, 116))) goto lab0;
344 { int ret;
345 ret = slice_del(z); /* delete, line 80 */
346 if (ret < 0) return ret;
347 }
348 break;
349 }
350 lab0:
351 z->c = z->l - m;
352 }
353 { int m = z->l - z->c; (void) m; /* do, line 84 */
354 z->ket = z->c; /* [, line 85 */
355 among_var = find_among_b(z, a_2, 4); /* substring, line 85 */
356 if (!(among_var)) goto lab1;
357 z->bra = z->c; /* ], line 85 */
358 { int ret = r_R1(z);
359 if (ret == 0) goto lab1; /* call R1, line 85 */
360 if (ret < 0) return ret;
361 }
362 switch(among_var) {
363 case 0: goto lab1;
364 case 1:
365 { int ret;
366 ret = slice_del(z); /* delete, line 87 */
367 if (ret < 0) return ret;
368 }
369 break;
370 case 2:
371 if (!(in_grouping_b_U(z, g_st_ending, 98, 116))) goto lab1;
372 { int c = skip_utf8(z->p, z->c, z->lb, z->l, - 3);
373 if (c < 0) goto lab1;
374 z->c = c; /* hop, line 90 */
375 }
376 { int ret;
377 ret = slice_del(z); /* delete, line 90 */
378 if (ret < 0) return ret;
379 }
380 break;
381 }
382 lab1:
383 z->c = z->l - m;
384 }
385 { int m = z->l - z->c; (void) m; /* do, line 94 */
386 z->ket = z->c; /* [, line 95 */
387 among_var = find_among_b(z, a_4, 8); /* substring, line 95 */
388 if (!(among_var)) goto lab2;
389 z->bra = z->c; /* ], line 95 */
390 { int ret = r_R2(z);
391 if (ret == 0) goto lab2; /* call R2, line 95 */
392 if (ret < 0) return ret;
393 }
394 switch(among_var) {
395 case 0: goto lab2;
396 case 1:
397 { int ret;
398 ret = slice_del(z); /* delete, line 97 */
399 if (ret < 0) return ret;
400 }
401 { int m = z->l - z->c; (void) m; /* try, line 98 */
402 z->ket = z->c; /* [, line 98 */
403 if (!(eq_s_b(z, 2, s_11))) { z->c = z->l - m; goto lab3; }
404 z->bra = z->c; /* ], line 98 */
405 { int m = z->l - z->c; (void) m; /* not, line 98 */
406 if (!(eq_s_b(z, 1, s_12))) goto lab4;
407 { z->c = z->l - m; goto lab3; }
408 lab4:
409 z->c = z->l - m;
410 }
411 { int ret = r_R2(z);
412 if (ret == 0) { z->c = z->l - m; goto lab3; } /* call R2, line 98 */
413 if (ret < 0) return ret;
414 }
415 { int ret;
416 ret = slice_del(z); /* delete, line 98 */
417 if (ret < 0) return ret;
418 }
419 lab3:
420 ;
421 }
422 break;
423 case 2:
424 { int m = z->l - z->c; (void) m; /* not, line 101 */
425 if (!(eq_s_b(z, 1, s_13))) goto lab5;
426 goto lab2;
427 lab5:
428 z->c = z->l - m;
429 }
430 { int ret;
431 ret = slice_del(z); /* delete, line 101 */
432 if (ret < 0) return ret;
433 }
434 break;
435 case 3:
436 { int ret;
437 ret = slice_del(z); /* delete, line 104 */
438 if (ret < 0) return ret;
439 }
440 { int m = z->l - z->c; (void) m; /* try, line 105 */
441 z->ket = z->c; /* [, line 106 */
442 { int m = z->l - z->c; (void) m; /* or, line 106 */
443 if (!(eq_s_b(z, 2, s_14))) goto lab8;
444 goto lab7;
445 lab8:
446 z->c = z->l - m;
447 if (!(eq_s_b(z, 2, s_15))) { z->c = z->l - m; goto lab6; }
448 }
449 lab7:
450 z->bra = z->c; /* ], line 106 */
451 { int ret = r_R1(z);
452 if (ret == 0) { z->c = z->l - m; goto lab6; } /* call R1, line 106 */
453 if (ret < 0) return ret;
454 }
455 { int ret;
456 ret = slice_del(z); /* delete, line 106 */
457 if (ret < 0) return ret;
458 }
459 lab6:
460 ;
461 }
462 break;
463 case 4:
464 { int ret;
465 ret = slice_del(z); /* delete, line 110 */
466 if (ret < 0) return ret;
467 }
468 { int m = z->l - z->c; (void) m; /* try, line 111 */
469 z->ket = z->c; /* [, line 112 */
470 among_var = find_among_b(z, a_3, 2); /* substring, line 112 */
471 if (!(among_var)) { z->c = z->l - m; goto lab9; }
472 z->bra = z->c; /* ], line 112 */
473 { int ret = r_R2(z);
474 if (ret == 0) { z->c = z->l - m; goto lab9; } /* call R2, line 112 */
475 if (ret < 0) return ret;
476 }
477 switch(among_var) {
478 case 0: { z->c = z->l - m; goto lab9; }
479 case 1:
480 { int ret;
481 ret = slice_del(z); /* delete, line 114 */
482 if (ret < 0) return ret;
483 }
484 break;
485 }
486 lab9:
487 ;
488 }
489 break;
490 }
491 lab2:
492 z->c = z->l - m;
493 }
494 return 1;
495 }
496
497 extern int german_UTF_8_stem(struct SN_env * z) {
498 { int c = z->c; /* do, line 125 */
499 { int ret = r_prelude(z);
500 if (ret == 0) goto lab0; /* call prelude, line 125 */
501 if (ret < 0) return ret;
502 }
503 lab0:
504 z->c = c;
505 }
506 { int c = z->c; /* do, line 126 */
507 { int ret = r_mark_regions(z);
508 if (ret == 0) goto lab1; /* call mark_regions, line 126 */
509 if (ret < 0) return ret;
510 }
511 lab1:
512 z->c = c;
513 }
514 z->lb = z->c; z->c = z->l; /* backwards, line 127 */
515
516 { int m = z->l - z->c; (void) m; /* do, line 128 */
517 { int ret = r_standard_suffix(z);
518 if (ret == 0) goto lab2; /* call standard_suffix, line 128 */
519 if (ret < 0) return ret;
520 }
521 lab2:
522 z->c = z->l - m;
523 }
524 z->c = z->lb;
525 { int c = z->c; /* do, line 129 */
526 { int ret = r_postlude(z);
527 if (ret == 0) goto lab3; /* call postlude, line 129 */
528 if (ret < 0) return ret;
529 }
530 lab3:
531 z->c = c;
532 }
533 return 1;
534 }
535
536 extern struct SN_env * german_UTF_8_create_env(void) { return SN_create_env(0, 3, 0); }
537
538 extern void german_UTF_8_close_env(struct SN_env * z) { SN_close_env(z); }