YAZ  5.34.0
stem_ISO_8859_1_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
7 extern "C" {
8 #endif
9 extern int danish_ISO_8859_1_stem(struct SN_env * z);
10 #ifdef __cplusplus
11 }
12 #endif
13 static int r_undouble(struct SN_env * z);
14 static int r_other_suffix(struct SN_env * z);
15 static int r_consonant_pair(struct SN_env * z);
16 static int r_main_suffix(struct SN_env * z);
17 static int r_mark_regions(struct SN_env * z);
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 
23 extern struct SN_env * danish_ISO_8859_1_create_env(void);
24 extern void danish_ISO_8859_1_close_env(struct SN_env * z);
25 
26 
27 #ifdef __cplusplus
28 }
29 #endif
30 static const symbol s_0_0[3] = { 'h', 'e', 'd' };
31 static const symbol s_0_1[5] = { 'e', 't', 'h', 'e', 'd' };
32 static const symbol s_0_2[4] = { 'e', 'r', 'e', 'd' };
33 static const symbol s_0_3[1] = { 'e' };
34 static const symbol s_0_4[5] = { 'e', 'r', 'e', 'd', 'e' };
35 static const symbol s_0_5[4] = { 'e', 'n', 'd', 'e' };
36 static const symbol s_0_6[6] = { 'e', 'r', 'e', 'n', 'd', 'e' };
37 static const symbol s_0_7[3] = { 'e', 'n', 'e' };
38 static const symbol s_0_8[4] = { 'e', 'r', 'n', 'e' };
39 static const symbol s_0_9[3] = { 'e', 'r', 'e' };
40 static const symbol s_0_10[2] = { 'e', 'n' };
41 static const symbol s_0_11[5] = { 'h', 'e', 'd', 'e', 'n' };
42 static const symbol s_0_12[4] = { 'e', 'r', 'e', 'n' };
43 static const symbol s_0_13[2] = { 'e', 'r' };
44 static const symbol s_0_14[5] = { 'h', 'e', 'd', 'e', 'r' };
45 static const symbol s_0_15[4] = { 'e', 'r', 'e', 'r' };
46 static const symbol s_0_16[1] = { 's' };
47 static const symbol s_0_17[4] = { 'h', 'e', 'd', 's' };
48 static const symbol s_0_18[2] = { 'e', 's' };
49 static const symbol s_0_19[5] = { 'e', 'n', 'd', 'e', 's' };
50 static const symbol s_0_20[7] = { 'e', 'r', 'e', 'n', 'd', 'e', 's' };
51 static const symbol s_0_21[4] = { 'e', 'n', 'e', 's' };
52 static const symbol s_0_22[5] = { 'e', 'r', 'n', 'e', 's' };
53 static const symbol s_0_23[4] = { 'e', 'r', 'e', 's' };
54 static const symbol s_0_24[3] = { 'e', 'n', 's' };
55 static const symbol s_0_25[6] = { 'h', 'e', 'd', 'e', 'n', 's' };
56 static const symbol s_0_26[5] = { 'e', 'r', 'e', 'n', 's' };
57 static const symbol s_0_27[3] = { 'e', 'r', 's' };
58 static const symbol s_0_28[3] = { 'e', 't', 's' };
59 static const symbol s_0_29[5] = { 'e', 'r', 'e', 't', 's' };
60 static const symbol s_0_30[2] = { 'e', 't' };
61 static const symbol s_0_31[4] = { 'e', 'r', 'e', 't' };
62 
63 static const struct among a_0[32] =
64 {
65 /* 0 */ { 3, s_0_0, -1, 1, 0},
66 /* 1 */ { 5, s_0_1, 0, 1, 0},
67 /* 2 */ { 4, s_0_2, -1, 1, 0},
68 /* 3 */ { 1, s_0_3, -1, 1, 0},
69 /* 4 */ { 5, s_0_4, 3, 1, 0},
70 /* 5 */ { 4, s_0_5, 3, 1, 0},
71 /* 6 */ { 6, s_0_6, 5, 1, 0},
72 /* 7 */ { 3, s_0_7, 3, 1, 0},
73 /* 8 */ { 4, s_0_8, 3, 1, 0},
74 /* 9 */ { 3, s_0_9, 3, 1, 0},
75 /* 10 */ { 2, s_0_10, -1, 1, 0},
76 /* 11 */ { 5, s_0_11, 10, 1, 0},
77 /* 12 */ { 4, s_0_12, 10, 1, 0},
78 /* 13 */ { 2, s_0_13, -1, 1, 0},
79 /* 14 */ { 5, s_0_14, 13, 1, 0},
80 /* 15 */ { 4, s_0_15, 13, 1, 0},
81 /* 16 */ { 1, s_0_16, -1, 2, 0},
82 /* 17 */ { 4, s_0_17, 16, 1, 0},
83 /* 18 */ { 2, s_0_18, 16, 1, 0},
84 /* 19 */ { 5, s_0_19, 18, 1, 0},
85 /* 20 */ { 7, s_0_20, 19, 1, 0},
86 /* 21 */ { 4, s_0_21, 18, 1, 0},
87 /* 22 */ { 5, s_0_22, 18, 1, 0},
88 /* 23 */ { 4, s_0_23, 18, 1, 0},
89 /* 24 */ { 3, s_0_24, 16, 1, 0},
90 /* 25 */ { 6, s_0_25, 24, 1, 0},
91 /* 26 */ { 5, s_0_26, 24, 1, 0},
92 /* 27 */ { 3, s_0_27, 16, 1, 0},
93 /* 28 */ { 3, s_0_28, 16, 1, 0},
94 /* 29 */ { 5, s_0_29, 28, 1, 0},
95 /* 30 */ { 2, s_0_30, -1, 1, 0},
96 /* 31 */ { 4, s_0_31, 30, 1, 0}
97 };
98 
99 static const symbol s_1_0[2] = { 'g', 'd' };
100 static const symbol s_1_1[2] = { 'd', 't' };
101 static const symbol s_1_2[2] = { 'g', 't' };
102 static const symbol s_1_3[2] = { 'k', 't' };
103 
104 static const struct among a_1[4] =
105 {
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 
112 static const symbol s_2_0[2] = { 'i', 'g' };
113 static const symbol s_2_1[3] = { 'l', 'i', 'g' };
114 static const symbol s_2_2[4] = { 'e', 'l', 'i', 'g' };
115 static const symbol s_2_3[3] = { 'e', 'l', 's' };
116 static const symbol s_2_4[4] = { 'l', 0xF8, 's', 't' };
117 
118 static const struct among a_2[5] =
119 {
120 /* 0 */ { 2, s_2_0, -1, 1, 0},
121 /* 1 */ { 3, s_2_1, 0, 1, 0},
122 /* 2 */ { 4, s_2_2, 1, 1, 0},
123 /* 3 */ { 3, s_2_3, -1, 1, 0},
124 /* 4 */ { 4, s_2_4, -1, 2, 0}
125 };
126 
127 static const unsigned char g_v[] = { 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 0, 128 };
128 
129 static const unsigned char g_s_ending[] = { 239, 254, 42, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16 };
130 
131 static const symbol s_0[] = { 's', 't' };
132 static const symbol s_1[] = { 'i', 'g' };
133 static const symbol s_2[] = { 'l', 0xF8, 's' };
134 
135 static int r_mark_regions(struct SN_env * z) {
136  z->I[0] = z->l;
137  { int c_test = z->c; /* test, line 33 */
138  { int ret = z->c + 3;
139  if (0 > ret || ret > z->l) return 0;
140  z->c = ret; /* hop, line 33 */
141  }
142  z->I[1] = z->c; /* setmark x, line 33 */
143  z->c = c_test;
144  }
145  if (out_grouping(z, g_v, 97, 248, 1) < 0) return 0; /* goto */ /* grouping v, line 34 */
146  { /* gopast */ /* non v, line 34 */
147  int ret = in_grouping(z, g_v, 97, 248, 1);
148  if (ret < 0) return 0;
149  z->c += ret;
150  }
151  z->I[0] = z->c; /* setmark p1, line 34 */
152  /* try, line 35 */
153  if (!(z->I[0] < z->I[1])) goto lab0;
154  z->I[0] = z->I[1];
155 lab0:
156  return 1;
157 }
158 
159 static int r_main_suffix(struct SN_env * z) {
160  int among_var;
161  { int mlimit; /* setlimit, line 41 */
162  int m1 = z->l - z->c; (void)m1;
163  if (z->c < z->I[0]) return 0;
164  z->c = z->I[0]; /* tomark, line 41 */
165  mlimit = z->lb; z->lb = z->c;
166  z->c = z->l - m1;
167  z->ket = z->c; /* [, line 41 */
168  if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1851440 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->lb = mlimit; return 0; }
169  among_var = find_among_b(z, a_0, 32); /* substring, line 41 */
170  if (!(among_var)) { z->lb = mlimit; return 0; }
171  z->bra = z->c; /* ], line 41 */
172  z->lb = mlimit;
173  }
174  switch(among_var) {
175  case 0: return 0;
176  case 1:
177  { int ret = slice_del(z); /* delete, line 48 */
178  if (ret < 0) return ret;
179  }
180  break;
181  case 2:
182  if (in_grouping_b(z, g_s_ending, 97, 229, 0)) return 0;
183  { int ret = slice_del(z); /* delete, line 50 */
184  if (ret < 0) return ret;
185  }
186  break;
187  }
188  return 1;
189 }
190 
191 static int r_consonant_pair(struct SN_env * z) {
192  { int m_test = z->l - z->c; /* test, line 55 */
193  { int mlimit; /* setlimit, line 56 */
194  int m1 = z->l - z->c; (void)m1;
195  if (z->c < z->I[0]) return 0;
196  z->c = z->I[0]; /* tomark, line 56 */
197  mlimit = z->lb; z->lb = z->c;
198  z->c = z->l - m1;
199  z->ket = z->c; /* [, line 56 */
200  if (z->c - 1 <= z->lb || (z->p[z->c - 1] != 100 && z->p[z->c - 1] != 116)) { z->lb = mlimit; return 0; }
201  if (!(find_among_b(z, a_1, 4))) { z->lb = mlimit; return 0; } /* substring, line 56 */
202  z->bra = z->c; /* ], line 56 */
203  z->lb = mlimit;
204  }
205  z->c = z->l - m_test;
206  }
207  if (z->c <= z->lb) return 0;
208  z->c--; /* next, line 62 */
209  z->bra = z->c; /* ], line 62 */
210  { int ret = slice_del(z); /* delete, line 62 */
211  if (ret < 0) return ret;
212  }
213  return 1;
214 }
215 
216 static int r_other_suffix(struct SN_env * z) {
217  int among_var;
218  { int m1 = z->l - z->c; (void)m1; /* do, line 66 */
219  z->ket = z->c; /* [, line 66 */
220  if (!(eq_s_b(z, 2, s_0))) goto lab0;
221  z->bra = z->c; /* ], line 66 */
222  if (!(eq_s_b(z, 2, s_1))) goto lab0;
223  { int ret = slice_del(z); /* delete, line 66 */
224  if (ret < 0) return ret;
225  }
226  lab0:
227  z->c = z->l - m1;
228  }
229  { int mlimit; /* setlimit, line 67 */
230  int m2 = z->l - z->c; (void)m2;
231  if (z->c < z->I[0]) return 0;
232  z->c = z->I[0]; /* tomark, line 67 */
233  mlimit = z->lb; z->lb = z->c;
234  z->c = z->l - m2;
235  z->ket = z->c; /* [, line 67 */
236  if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1572992 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->lb = mlimit; return 0; }
237  among_var = find_among_b(z, a_2, 5); /* substring, line 67 */
238  if (!(among_var)) { z->lb = mlimit; return 0; }
239  z->bra = z->c; /* ], line 67 */
240  z->lb = mlimit;
241  }
242  switch(among_var) {
243  case 0: return 0;
244  case 1:
245  { int ret = slice_del(z); /* delete, line 70 */
246  if (ret < 0) return ret;
247  }
248  { int m3 = z->l - z->c; (void)m3; /* do, line 70 */
249  { int ret = r_consonant_pair(z);
250  if (ret == 0) goto lab1; /* call consonant_pair, line 70 */
251  if (ret < 0) return ret;
252  }
253  lab1:
254  z->c = z->l - m3;
255  }
256  break;
257  case 2:
258  { int ret = slice_from_s(z, 3, s_2); /* <-, line 72 */
259  if (ret < 0) return ret;
260  }
261  break;
262  }
263  return 1;
264 }
265 
266 static int r_undouble(struct SN_env * z) {
267  { int mlimit; /* setlimit, line 76 */
268  int m1 = z->l - z->c; (void)m1;
269  if (z->c < z->I[0]) return 0;
270  z->c = z->I[0]; /* tomark, line 76 */
271  mlimit = z->lb; z->lb = z->c;
272  z->c = z->l - m1;
273  z->ket = z->c; /* [, line 76 */
274  if (out_grouping_b(z, g_v, 97, 248, 0)) { z->lb = mlimit; return 0; }
275  z->bra = z->c; /* ], line 76 */
276  z->S[0] = slice_to(z, z->S[0]); /* -> ch, line 76 */
277  if (z->S[0] == 0) return -1; /* -> ch, line 76 */
278  z->lb = mlimit;
279  }
280  if (!(eq_v_b(z, z->S[0]))) return 0; /* name ch, line 77 */
281  { int ret = slice_del(z); /* delete, line 78 */
282  if (ret < 0) return ret;
283  }
284  return 1;
285 }
286 
287 extern int danish_ISO_8859_1_stem(struct SN_env * z) {
288  { int c1 = z->c; /* do, line 84 */
289  { int ret = r_mark_regions(z);
290  if (ret == 0) goto lab0; /* call mark_regions, line 84 */
291  if (ret < 0) return ret;
292  }
293  lab0:
294  z->c = c1;
295  }
296  z->lb = z->c; z->c = z->l; /* backwards, line 85 */
297 
298  { int m2 = z->l - z->c; (void)m2; /* do, line 86 */
299  { int ret = r_main_suffix(z);
300  if (ret == 0) goto lab1; /* call main_suffix, line 86 */
301  if (ret < 0) return ret;
302  }
303  lab1:
304  z->c = z->l - m2;
305  }
306  { int m3 = z->l - z->c; (void)m3; /* do, line 87 */
307  { int ret = r_consonant_pair(z);
308  if (ret == 0) goto lab2; /* call consonant_pair, line 87 */
309  if (ret < 0) return ret;
310  }
311  lab2:
312  z->c = z->l - m3;
313  }
314  { int m4 = z->l - z->c; (void)m4; /* do, line 88 */
315  { int ret = r_other_suffix(z);
316  if (ret == 0) goto lab3; /* call other_suffix, line 88 */
317  if (ret < 0) return ret;
318  }
319  lab3:
320  z->c = z->l - m4;
321  }
322  { int m5 = z->l - z->c; (void)m5; /* do, line 89 */
323  { int ret = r_undouble(z);
324  if (ret == 0) goto lab4; /* call undouble, line 89 */
325  if (ret < 0) return ret;
326  }
327  lab4:
328  z->c = z->l - m5;
329  }
330  z->c = z->lb;
331  return 1;
332 }
333 
334 extern struct SN_env * danish_ISO_8859_1_create_env(void) { return SN_create_env(1, 2, 0); }
335 
336 extern void danish_ISO_8859_1_close_env(struct SN_env * z) { SN_close_env(z, 1); }
337 
struct SN_env * SN_create_env(int S_size, int I_size, int B_size)
Definition: api.c:5
void SN_close_env(struct SN_env *z, int S_size)
Definition: api.c:42
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:272
int slice_del(struct SN_env *z)
Definition: utilities.c:406
int eq_v_b(struct SN_env *z, const symbol *p)
Definition: utilities.c:208
int in_grouping(struct SN_env *z, const unsigned char *s, int min, int max, int repeat)
Definition: utilities.c:146
symbol * slice_to(struct SN_env *z, symbol *p)
Definition: utilities.c:428
int out_grouping_b(struct SN_env *z, const unsigned char *s, int min, int max, int repeat)
Definition: utilities.c:182
int eq_s_b(struct SN_env *z, int s_size, const symbol *s)
Definition: utilities.c:199
int out_grouping(struct SN_env *z, const unsigned char *s, int min, int max, int repeat)
Definition: utilities.c:170
int slice_from_s(struct SN_env *z, int s_size, const symbol *s)
Definition: utilities.c:397
int in_grouping_b(struct SN_env *z, const unsigned char *s, int min, int max, int repeat)
Definition: utilities.c:158
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_ISO_8859_1_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_2_4[4]
static const symbol s_0_1[5]
static const symbol s_0_30[2]
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)
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]
int danish_ISO_8859_1_stem(struct SN_env *z)
static const symbol s_0_9[3]
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]
struct SN_env * danish_ISO_8859_1_create_env(void)
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