xapian-core  2.0.0
danish.cc
Go to the documentation of this file.
1 /* Generated from danish.sbl by Snowball 3.0.0 - https://snowballstem.org/ */
2 
3 #include <config.h>
4 
5 #define SNOWBALL_RUNTIME_THROW_EXCEPTIONS
6 #include "danish.h"
7 
8 #include <stddef.h>
9 
11 
12 static int r_undouble(struct SN_env * z);
13 static int r_other_suffix(struct SN_env * z);
14 static int r_consonant_pair(struct SN_env * z);
15 static int r_main_suffix(struct SN_env * z);
16 static int r_mark_regions(struct SN_env * z);
17 
18 static const symbol s_0[] = { 's', 't' };
19 static const symbol s_1[] = { 'i', 'g' };
20 static const symbol s_2[] = { 'l', 0xC3, 0xB8, 's' };
21 
22 static const symbol s_0_0[3] = { 'h', 'e', 'd' };
23 static const symbol s_0_1[5] = { 'e', 't', 'h', 'e', 'd' };
24 static const symbol s_0_2[4] = { 'e', 'r', 'e', 'd' };
25 static const symbol s_0_3[1] = { 'e' };
26 static const symbol s_0_4[5] = { 'e', 'r', 'e', 'd', 'e' };
27 static const symbol s_0_5[4] = { 'e', 'n', 'd', 'e' };
28 static const symbol s_0_6[6] = { 'e', 'r', 'e', 'n', 'd', 'e' };
29 static const symbol s_0_7[3] = { 'e', 'n', 'e' };
30 static const symbol s_0_8[4] = { 'e', 'r', 'n', 'e' };
31 static const symbol s_0_9[3] = { 'e', 'r', 'e' };
32 static const symbol s_0_10[2] = { 'e', 'n' };
33 static const symbol s_0_11[5] = { 'h', 'e', 'd', 'e', 'n' };
34 static const symbol s_0_12[4] = { 'e', 'r', 'e', 'n' };
35 static const symbol s_0_13[2] = { 'e', 'r' };
36 static const symbol s_0_14[5] = { 'h', 'e', 'd', 'e', 'r' };
37 static const symbol s_0_15[4] = { 'e', 'r', 'e', 'r' };
38 static const symbol s_0_16[1] = { 's' };
39 static const symbol s_0_17[4] = { 'h', 'e', 'd', 's' };
40 static const symbol s_0_18[2] = { 'e', 's' };
41 static const symbol s_0_19[5] = { 'e', 'n', 'd', 'e', 's' };
42 static const symbol s_0_20[7] = { 'e', 'r', 'e', 'n', 'd', 'e', 's' };
43 static const symbol s_0_21[4] = { 'e', 'n', 'e', 's' };
44 static const symbol s_0_22[5] = { 'e', 'r', 'n', 'e', 's' };
45 static const symbol s_0_23[4] = { 'e', 'r', 'e', 's' };
46 static const symbol s_0_24[3] = { 'e', 'n', 's' };
47 static const symbol s_0_25[6] = { 'h', 'e', 'd', 'e', 'n', 's' };
48 static const symbol s_0_26[5] = { 'e', 'r', 'e', 'n', 's' };
49 static const symbol s_0_27[3] = { 'e', 'r', 's' };
50 static const symbol s_0_28[3] = { 'e', 't', 's' };
51 static const symbol s_0_29[5] = { 'e', 'r', 'e', 't', 's' };
52 static const symbol s_0_30[2] = { 'e', 't' };
53 static const symbol s_0_31[4] = { 'e', 'r', 'e', 't' };
54 static const struct among a_0[32] = {
55 { 3, s_0_0, 0, 1, 0},
56 { 5, s_0_1, -1, 1, 0},
57 { 4, s_0_2, 0, 1, 0},
58 { 1, s_0_3, 0, 1, 0},
59 { 5, s_0_4, -1, 1, 0},
60 { 4, s_0_5, -2, 1, 0},
61 { 6, s_0_6, -1, 1, 0},
62 { 3, s_0_7, -4, 1, 0},
63 { 4, s_0_8, -5, 1, 0},
64 { 3, s_0_9, -6, 1, 0},
65 { 2, s_0_10, 0, 1, 0},
66 { 5, s_0_11, -1, 1, 0},
67 { 4, s_0_12, -2, 1, 0},
68 { 2, s_0_13, 0, 1, 0},
69 { 5, s_0_14, -1, 1, 0},
70 { 4, s_0_15, -2, 1, 0},
71 { 1, s_0_16, 0, 2, 0},
72 { 4, s_0_17, -1, 1, 0},
73 { 2, s_0_18, -2, 1, 0},
74 { 5, s_0_19, -1, 1, 0},
75 { 7, s_0_20, -1, 1, 0},
76 { 4, s_0_21, -3, 1, 0},
77 { 5, s_0_22, -4, 1, 0},
78 { 4, s_0_23, -5, 1, 0},
79 { 3, s_0_24, -8, 1, 0},
80 { 6, s_0_25, -1, 1, 0},
81 { 5, s_0_26, -2, 1, 0},
82 { 3, s_0_27, -11, 1, 0},
83 { 3, s_0_28, -12, 1, 0},
84 { 5, s_0_29, -1, 1, 0},
85 { 2, s_0_30, 0, 1, 0},
86 { 4, s_0_31, -1, 1, 0}
87 };
88 
89 static const symbol s_1_0[2] = { 'g', 'd' };
90 static const symbol s_1_1[2] = { 'd', 't' };
91 static const symbol s_1_2[2] = { 'g', 't' };
92 static const symbol s_1_3[2] = { 'k', 't' };
93 static const struct among a_1[4] = {
94 { 2, s_1_0, 0, -1, 0},
95 { 2, s_1_1, 0, -1, 0},
96 { 2, s_1_2, 0, -1, 0},
97 { 2, s_1_3, 0, -1, 0}
98 };
99 
100 static const symbol s_2_0[2] = { 'i', 'g' };
101 static const symbol s_2_1[3] = { 'l', 'i', 'g' };
102 static const symbol s_2_2[4] = { 'e', 'l', 'i', 'g' };
103 static const symbol s_2_3[3] = { 'e', 'l', 's' };
104 static const symbol s_2_4[5] = { 'l', 0xC3, 0xB8, 's', 't' };
105 static const struct among a_2[5] = {
106 { 2, s_2_0, 0, 1, 0},
107 { 3, s_2_1, -1, 1, 0},
108 { 4, s_2_2, -1, 1, 0},
109 { 3, s_2_3, 0, 1, 0},
110 { 5, s_2_4, 0, 2, 0}
111 };
112 
113 static const unsigned char g_c[] = { 119, 223, 119, 1 };
114 
115 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 };
116 
117 static const unsigned char g_s_ending[] = { 239, 254, 42, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16 };
118 
119 static int r_mark_regions(struct SN_env * z) {
120  int i_x;
121  ((SN_local *)z)->i_p1 = z->l;
122  {
123  int v_1 = z->c;
124  {
125  int ret = skip_utf8(z->p, z->c, z->l, 3);
126  if (ret < 0) return 0;
127  z->c = ret;
128  }
129  i_x = z->c;
130  z->c = v_1;
131  }
132  {
133  int ret = out_grouping_U(z, g_v, 97, 248, 1);
134  if (ret < 0) return 0;
135  z->c += ret;
136  }
137  {
138  int ret = in_grouping_U(z, g_v, 97, 248, 1);
139  if (ret < 0) return 0;
140  z->c += ret;
141  }
142  ((SN_local *)z)->i_p1 = z->c;
143  if (((SN_local *)z)->i_p1 >= i_x) goto lab0;
144  ((SN_local *)z)->i_p1 = i_x;
145 lab0:
146  return 1;
147 }
148 
149 static int r_main_suffix(struct SN_env * z) {
150  int among_var;
151  {
152  int v_1;
153  if (z->c < ((SN_local *)z)->i_p1) return 0;
154  v_1 = z->lb; z->lb = ((SN_local *)z)->i_p1;
155  z->ket = z->c;
156  if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1851440 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->lb = v_1; return 0; }
157  among_var = find_among_b(z, a_0, 32, 0);
158  if (!among_var) { z->lb = v_1; return 0; }
159  z->bra = z->c;
160  z->lb = v_1;
161  }
162  switch (among_var) {
163  case 1:
164  slice_del(z);
165  break;
166  case 2:
167  if (in_grouping_b_U(z, g_s_ending, 97, 229, 0)) return 0;
168  slice_del(z);
169  break;
170  }
171  return 1;
172 }
173 
174 static int r_consonant_pair(struct SN_env * z) {
175  {
176  int v_1 = z->l - z->c;
177  {
178  int v_2;
179  if (z->c < ((SN_local *)z)->i_p1) return 0;
180  v_2 = z->lb; z->lb = ((SN_local *)z)->i_p1;
181  z->ket = z->c;
182  if (z->c - 1 <= z->lb || (z->p[z->c - 1] != 100 && z->p[z->c - 1] != 116)) { z->lb = v_2; return 0; }
183  if (!find_among_b(z, a_1, 4, 0)) { z->lb = v_2; return 0; }
184  z->bra = z->c;
185  z->lb = v_2;
186  }
187  z->c = z->l - v_1;
188  }
189  {
190  int ret = skip_b_utf8(z->p, z->c, z->lb, 1);
191  if (ret < 0) return 0;
192  z->c = ret;
193  }
194  z->bra = z->c;
195  slice_del(z);
196  return 1;
197 }
198 
199 static int r_other_suffix(struct SN_env * z) {
200  int among_var;
201  {
202  int v_1 = z->l - z->c;
203  z->ket = z->c;
204  if (!(eq_s_b(z, 2, s_0))) goto lab0;
205  z->bra = z->c;
206  if (!(eq_s_b(z, 2, s_1))) goto lab0;
207  slice_del(z);
208  lab0:
209  z->c = z->l - v_1;
210  }
211  {
212  int v_2;
213  if (z->c < ((SN_local *)z)->i_p1) return 0;
214  v_2 = z->lb; z->lb = ((SN_local *)z)->i_p1;
215  z->ket = z->c;
216  if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1572992 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->lb = v_2; return 0; }
217  among_var = find_among_b(z, a_2, 5, 0);
218  if (!among_var) { z->lb = v_2; return 0; }
219  z->bra = z->c;
220  z->lb = v_2;
221  }
222  switch (among_var) {
223  case 1:
224  slice_del(z);
225  {
226  int v_3 = z->l - z->c;
227  r_consonant_pair(z);
228  z->c = z->l - v_3;
229  }
230  break;
231  case 2:
232  slice_from_s(z, 4, s_2);
233  break;
234  }
235  return 1;
236 }
237 
238 static int r_undouble(struct SN_env * z) {
239  {
240  int v_1;
241  if (z->c < ((SN_local *)z)->i_p1) return 0;
242  v_1 = z->lb; z->lb = ((SN_local *)z)->i_p1;
243  z->ket = z->c;
244  if (in_grouping_b_U(z, g_c, 98, 122, 0)) { z->lb = v_1; return 0; }
245  z->bra = z->c;
246  slice_to(z, &((SN_local *)z)->s_ch);
247  z->lb = v_1;
248  }
249  if (!(eq_v_b(z, ((SN_local *)z)->s_ch))) return 0;
250  slice_del(z);
251  return 1;
252 }
253 
255  {
256  int v_1 = z->c;
257  r_mark_regions(z);
258  z->c = v_1;
259  }
260  z->lb = z->c; z->c = z->l;
261  {
262  int v_2 = z->l - z->c;
263  r_main_suffix(z);
264  z->c = z->l - v_2;
265  }
266  {
267  int v_3 = z->l - z->c;
268  r_consonant_pair(z);
269  z->c = z->l - v_3;
270  }
271  {
272  int v_4 = z->l - z->c;
273  r_other_suffix(z);
274  z->c = z->l - v_4;
275  }
276  {
277  int v_5 = z->l - z->c;
278  r_undouble(z);
279  z->c = z->l - v_5;
280  }
281  z->c = z->lb;
282  return 1;
283 }
unsigned char symbol
Definition: api.h:4
static int stem(struct SN_env *z)
Definition: danish.cc:254
static const symbol s_0_24[3]
Definition: danish.cc:46
static const struct among a_2[5]
Definition: danish.cc:105
static const symbol s_0_2[4]
Definition: danish.cc:24
static const symbol s_2[]
Definition: danish.cc:20
static const symbol s_0_15[4]
Definition: danish.cc:37
Xapian::Internal::Snowball::Danish::SN_local SN_local
Definition: danish.cc:10
static const unsigned char g_c[]
Definition: danish.cc:113
static const struct among a_0[32]
Definition: danish.cc:54
static const symbol s_0_13[2]
Definition: danish.cc:35
static const symbol s_0_20[7]
Definition: danish.cc:42
static const symbol s_1_2[2]
Definition: danish.cc:91
static const symbol s_0_14[5]
Definition: danish.cc:36
static int r_other_suffix(struct SN_env *z)
Definition: danish.cc:199
static int r_consonant_pair(struct SN_env *z)
Definition: danish.cc:174
static const symbol s_0_12[4]
Definition: danish.cc:34
static const symbol s_2_3[3]
Definition: danish.cc:103
static const symbol s_0_31[4]
Definition: danish.cc:53
static const symbol s_2_0[2]
Definition: danish.cc:100
static int r_main_suffix(struct SN_env *z)
Definition: danish.cc:149
static const struct among a_1[4]
Definition: danish.cc:93
static const symbol s_1_3[2]
Definition: danish.cc:92
static const symbol s_2_1[3]
Definition: danish.cc:101
static const symbol s_1_0[2]
Definition: danish.cc:89
static const symbol s_0_5[4]
Definition: danish.cc:27
static const symbol s_2_2[4]
Definition: danish.cc:102
static const symbol s_0_11[5]
Definition: danish.cc:33
static const symbol s_0_1[5]
Definition: danish.cc:23
static const symbol s_0_30[2]
Definition: danish.cc:52
static const symbol s_2_4[5]
Definition: danish.cc:104
static const symbol s_0_17[4]
Definition: danish.cc:39
static const symbol s_1_1[2]
Definition: danish.cc:90
static const symbol s_0_0[3]
Definition: danish.cc:22
static int r_undouble(struct SN_env *z)
Definition: danish.cc:238
static const symbol s_0_19[5]
Definition: danish.cc:41
static const symbol s_0_18[2]
Definition: danish.cc:40
static const symbol s_0_23[4]
Definition: danish.cc:45
static const symbol s_0_27[3]
Definition: danish.cc:49
static const symbol s_0_16[1]
Definition: danish.cc:38
static const symbol s_0_28[3]
Definition: danish.cc:50
static const symbol s_0_29[5]
Definition: danish.cc:51
static const symbol s_0_9[3]
Definition: danish.cc:31
static const symbol s_0_22[5]
Definition: danish.cc:44
static const symbol s_1[]
Definition: danish.cc:19
static int r_mark_regions(struct SN_env *z)
Definition: danish.cc:119
static const symbol s_0_3[1]
Definition: danish.cc:25
static const symbol s_0_6[6]
Definition: danish.cc:28
static const symbol s_0_8[4]
Definition: danish.cc:30
static const symbol s_0_25[6]
Definition: danish.cc:47
static const symbol s_0_7[3]
Definition: danish.cc:29
static const symbol s_0_26[5]
Definition: danish.cc:48
static const symbol s_0_10[2]
Definition: danish.cc:32
static const unsigned char g_v[]
Definition: danish.cc:115
static const unsigned char g_s_ending[]
Definition: danish.cc:117
static const symbol s_0_21[4]
Definition: danish.cc:43
static const symbol s_0[]
Definition: danish.cc:18
static const symbol s_0_4[5]
Definition: danish.cc:26
int out_grouping_U(struct SN_env *z, const unsigned char *s, int min, int max, int repeat)
Definition: utilities.cc:164
int in_grouping_U(struct SN_env *z, const unsigned char *s, int min, int max, int repeat)
Definition: utilities.cc:140
int eq_v_b(struct SN_env *z, const symbol *p)
Definition: utilities.cc:252
SNOWBALL_ERR slice_from_s(struct SN_env *z, int s_size, const symbol *s)
Definition: utilities.cc:439
SNOWBALL_ERR slice_to(struct SN_env *z, symbol **p)
Definition: utilities.cc:485
int in_grouping_b_U(struct SN_env *z, const unsigned char *s, int min, int max, int repeat)
Definition: utilities.cc:152
int skip_b_utf8(const symbol *p, int c, int limit, int n)
Definition: utilities.cc:75
int eq_s_b(struct SN_env *z, int s_size, const symbol *s)
Definition: utilities.cc:243
SNOWBALL_ERR slice_del(struct SN_env *z)
Definition: utilities.cc:450
int skip_utf8(const symbol *p, int c, int limit, int n)
Definition: utilities.cc:50
int find_among_b(struct SN_env *z, const struct among *v, int v_size, int(*)(struct SN_env *))
Definition: utilities.cc:322
Definition: api.h:15
int lb
Definition: api.h:17
symbol * p
Definition: api.h:16
int ket
Definition: api.h:17
int c
Definition: api.h:17
int bra
Definition: api.h:17
int l
Definition: api.h:17
Definition: header.h:256