Line data Source code
1 : /* Generated from polish.sbl by Snowball 3.0.0 - https://snowballstem.org/ */
2 :
3 : #include "stem_UTF_8_polish.h"
4 :
5 : #include <stddef.h>
6 :
7 : #include "snowball_runtime.h"
8 :
9 : struct SN_local {
10 : struct SN_env z;
11 : int i_p1;
12 : };
13 :
14 : typedef struct SN_local SN_local;
15 :
16 : #ifdef __cplusplus
17 : extern "C" {
18 : #endif
19 : extern int polish_UTF_8_stem(struct SN_env * z);
20 : #ifdef __cplusplus
21 : }
22 : #endif
23 :
24 : static int r_R1(struct SN_env * z);
25 : static int r_normalize_consonant(struct SN_env * z);
26 : static int r_remove_endings(struct SN_env * z);
27 : static int r_mark_regions(struct SN_env * z);
28 :
29 : static const symbol s_0[] = { 's' };
30 : static const symbol s_1[] = { 's' };
31 : static const symbol s_2[] = { 0xC5, 0x82 };
32 : static const symbol s_3[] = { 's' };
33 : static const symbol s_4[] = { 'c' };
34 : static const symbol s_5[] = { 'n' };
35 : static const symbol s_6[] = { 's' };
36 : static const symbol s_7[] = { 'z' };
37 :
38 : static const symbol s_0_0[7] = { 'b', 'y', 0xC5, 0x9B, 'c', 'i', 'e' };
39 : static const symbol s_0_1[3] = { 'b', 'y', 'm' };
40 : static const symbol s_0_2[2] = { 'b', 'y' };
41 : static const symbol s_0_3[6] = { 'b', 'y', 0xC5, 0x9B, 'm', 'y' };
42 : static const symbol s_0_4[4] = { 'b', 'y', 0xC5, 0x9B };
43 : static const struct among a_0[5] = {
44 : { 7, s_0_0, 0, 1, 0},
45 : { 3, s_0_1, 0, 1, 0},
46 : { 2, s_0_2, 0, 1, 0},
47 : { 6, s_0_3, 0, 1, 0},
48 : { 4, s_0_4, 0, 1, 0}
49 : };
50 :
51 : static const symbol s_1_0[3] = { 0xC4, 0x85, 'c' };
52 : static const symbol s_1_1[5] = { 'a', 'j', 0xC4, 0x85, 'c' };
53 : static const symbol s_1_2[5] = { 's', 'z', 0xC4, 0x85, 'c' };
54 : static const symbol s_1_3[2] = { 's', 'z' };
55 : static const symbol s_1_4[5] = { 'i', 'e', 'j', 's', 'z' };
56 : static const struct among a_1[5] = {
57 : { 3, s_1_0, 0, 1, 0},
58 : { 5, s_1_1, -1, 1, 0},
59 : { 5, s_1_2, -2, 2, 0},
60 : { 2, s_1_3, 0, 1, 0},
61 : { 5, s_1_4, -1, 1, 0}
62 : };
63 :
64 : static const symbol s_2_0[1] = { 'a' };
65 : static const symbol s_2_1[4] = { 0xC4, 0x85, 'c', 'a' };
66 : static const symbol s_2_2[6] = { 'a', 'j', 0xC4, 0x85, 'c', 'a' };
67 : static const symbol s_2_3[6] = { 's', 'z', 0xC4, 0x85, 'c', 'a' };
68 : static const symbol s_2_4[2] = { 'i', 'a' };
69 : static const symbol s_2_5[3] = { 's', 'z', 'a' };
70 : static const symbol s_2_6[6] = { 'i', 'e', 'j', 's', 'z', 'a' };
71 : static const symbol s_2_7[4] = { 'a', 0xC5, 0x82, 'a' };
72 : static const symbol s_2_8[5] = { 'i', 'a', 0xC5, 0x82, 'a' };
73 : static const symbol s_2_9[4] = { 'i', 0xC5, 0x82, 'a' };
74 : static const symbol s_2_10[3] = { 0xC4, 0x85, 'c' };
75 : static const symbol s_2_11[5] = { 'a', 'j', 0xC4, 0x85, 'c' };
76 : static const symbol s_2_12[1] = { 'e' };
77 : static const symbol s_2_13[4] = { 0xC4, 0x85, 'c', 'e' };
78 : static const symbol s_2_14[6] = { 'a', 'j', 0xC4, 0x85, 'c', 'e' };
79 : static const symbol s_2_15[6] = { 's', 'z', 0xC4, 0x85, 'c', 'e' };
80 : static const symbol s_2_16[2] = { 'i', 'e' };
81 : static const symbol s_2_17[3] = { 'c', 'i', 'e' };
82 : static const symbol s_2_18[4] = { 'a', 'c', 'i', 'e' };
83 : static const symbol s_2_19[4] = { 'e', 'c', 'i', 'e' };
84 : static const symbol s_2_20[4] = { 'i', 'c', 'i', 'e' };
85 : static const symbol s_2_21[5] = { 'a', 'j', 'c', 'i', 'e' };
86 : static const symbol s_2_22[7] = { 'l', 'i', 0xC5, 0x9B, 'c', 'i', 'e' };
87 : static const symbol s_2_23[8] = { 'a', 'l', 'i', 0xC5, 0x9B, 'c', 'i', 'e' };
88 : static const symbol s_2_24[9] = { 'i', 'e', 'l', 'i', 0xC5, 0x9B, 'c', 'i', 'e' };
89 : static const symbol s_2_25[8] = { 'i', 'l', 'i', 0xC5, 0x9B, 'c', 'i', 'e' };
90 : static const symbol s_2_26[8] = { 0xC5, 0x82, 'y', 0xC5, 0x9B, 'c', 'i', 'e' };
91 : static const symbol s_2_27[9] = { 'a', 0xC5, 0x82, 'y', 0xC5, 0x9B, 'c', 'i', 'e' };
92 : static const symbol s_2_28[10] = { 'i', 'a', 0xC5, 0x82, 'y', 0xC5, 0x9B, 'c', 'i', 'e' };
93 : static const symbol s_2_29[9] = { 'i', 0xC5, 0x82, 'y', 0xC5, 0x9B, 'c', 'i', 'e' };
94 : static const symbol s_2_30[3] = { 's', 'z', 'e' };
95 : static const symbol s_2_31[6] = { 'i', 'e', 'j', 's', 'z', 'e' };
96 : static const symbol s_2_32[3] = { 'a', 'c', 'h' };
97 : static const symbol s_2_33[4] = { 'i', 'a', 'c', 'h' };
98 : static const symbol s_2_34[3] = { 'i', 'c', 'h' };
99 : static const symbol s_2_35[3] = { 'y', 'c', 'h' };
100 : static const symbol s_2_36[1] = { 'i' };
101 : static const symbol s_2_37[3] = { 'a', 'l', 'i' };
102 : static const symbol s_2_38[4] = { 'i', 'e', 'l', 'i' };
103 : static const symbol s_2_39[3] = { 'i', 'l', 'i' };
104 : static const symbol s_2_40[3] = { 'a', 'm', 'i' };
105 : static const symbol s_2_41[4] = { 'i', 'a', 'm', 'i' };
106 : static const symbol s_2_42[3] = { 'i', 'm', 'i' };
107 : static const symbol s_2_43[3] = { 'y', 'm', 'i' };
108 : static const symbol s_2_44[3] = { 'o', 'w', 'i' };
109 : static const symbol s_2_45[4] = { 'i', 'o', 'w', 'i' };
110 : static const symbol s_2_46[2] = { 'a', 'j' };
111 : static const symbol s_2_47[2] = { 'e', 'j' };
112 : static const symbol s_2_48[3] = { 'i', 'e', 'j' };
113 : static const symbol s_2_49[2] = { 'a', 'm' };
114 : static const symbol s_2_50[5] = { 'a', 0xC5, 0x82, 'a', 'm' };
115 : static const symbol s_2_51[6] = { 'i', 'a', 0xC5, 0x82, 'a', 'm' };
116 : static const symbol s_2_52[5] = { 'i', 0xC5, 0x82, 'a', 'm' };
117 : static const symbol s_2_53[2] = { 'e', 'm' };
118 : static const symbol s_2_54[3] = { 'i', 'e', 'm' };
119 : static const symbol s_2_55[5] = { 'a', 0xC5, 0x82, 'e', 'm' };
120 : static const symbol s_2_56[6] = { 'i', 'a', 0xC5, 0x82, 'e', 'm' };
121 : static const symbol s_2_57[5] = { 'i', 0xC5, 0x82, 'e', 'm' };
122 : static const symbol s_2_58[2] = { 'i', 'm' };
123 : static const symbol s_2_59[2] = { 'o', 'm' };
124 : static const symbol s_2_60[3] = { 'i', 'o', 'm' };
125 : static const symbol s_2_61[2] = { 'y', 'm' };
126 : static const symbol s_2_62[1] = { 'o' };
127 : static const symbol s_2_63[3] = { 'e', 'g', 'o' };
128 : static const symbol s_2_64[4] = { 'i', 'e', 'g', 'o' };
129 : static const symbol s_2_65[4] = { 'a', 0xC5, 0x82, 'o' };
130 : static const symbol s_2_66[5] = { 'i', 'a', 0xC5, 0x82, 'o' };
131 : static const symbol s_2_67[4] = { 'i', 0xC5, 0x82, 'o' };
132 : static const symbol s_2_68[1] = { 'u' };
133 : static const symbol s_2_69[2] = { 'i', 'u' };
134 : static const symbol s_2_70[3] = { 'e', 'm', 'u' };
135 : static const symbol s_2_71[4] = { 'i', 'e', 'm', 'u' };
136 : static const symbol s_2_72[3] = { 0xC3, 0xB3, 'w' };
137 : static const symbol s_2_73[1] = { 'y' };
138 : static const symbol s_2_74[3] = { 'a', 'm', 'y' };
139 : static const symbol s_2_75[3] = { 'e', 'm', 'y' };
140 : static const symbol s_2_76[3] = { 'i', 'm', 'y' };
141 : static const symbol s_2_77[6] = { 'l', 'i', 0xC5, 0x9B, 'm', 'y' };
142 : static const symbol s_2_78[7] = { 'a', 'l', 'i', 0xC5, 0x9B, 'm', 'y' };
143 : static const symbol s_2_79[8] = { 'i', 'e', 'l', 'i', 0xC5, 0x9B, 'm', 'y' };
144 : static const symbol s_2_80[7] = { 'i', 'l', 'i', 0xC5, 0x9B, 'm', 'y' };
145 : static const symbol s_2_81[7] = { 0xC5, 0x82, 'y', 0xC5, 0x9B, 'm', 'y' };
146 : static const symbol s_2_82[8] = { 'a', 0xC5, 0x82, 'y', 0xC5, 0x9B, 'm', 'y' };
147 : static const symbol s_2_83[9] = { 'i', 'a', 0xC5, 0x82, 'y', 0xC5, 0x9B, 'm', 'y' };
148 : static const symbol s_2_84[8] = { 'i', 0xC5, 0x82, 'y', 0xC5, 0x9B, 'm', 'y' };
149 : static const symbol s_2_85[4] = { 'a', 0xC5, 0x82, 'y' };
150 : static const symbol s_2_86[5] = { 'i', 'a', 0xC5, 0x82, 'y' };
151 : static const symbol s_2_87[4] = { 'i', 0xC5, 0x82, 'y' };
152 : static const symbol s_2_88[3] = { 'a', 's', 'z' };
153 : static const symbol s_2_89[3] = { 'e', 's', 'z' };
154 : static const symbol s_2_90[3] = { 'i', 's', 'z' };
155 : static const symbol s_2_91[3] = { 'a', 0xC5, 0x82 };
156 : static const symbol s_2_92[4] = { 'i', 'a', 0xC5, 0x82 };
157 : static const symbol s_2_93[3] = { 'i', 0xC5, 0x82 };
158 : static const symbol s_2_94[2] = { 0xC4, 0x85 };
159 : static const symbol s_2_95[5] = { 0xC4, 0x85, 'c', 0xC4, 0x85 };
160 : static const symbol s_2_96[7] = { 'a', 'j', 0xC4, 0x85, 'c', 0xC4, 0x85 };
161 : static const symbol s_2_97[7] = { 's', 'z', 0xC4, 0x85, 'c', 0xC4, 0x85 };
162 : static const symbol s_2_98[3] = { 'i', 0xC4, 0x85 };
163 : static const symbol s_2_99[4] = { 'a', 'j', 0xC4, 0x85 };
164 : static const symbol s_2_100[4] = { 's', 'z', 0xC4, 0x85 };
165 : static const symbol s_2_101[7] = { 'i', 'e', 'j', 's', 'z', 0xC4, 0x85 };
166 : static const symbol s_2_102[3] = { 'a', 0xC4, 0x87 };
167 : static const symbol s_2_103[4] = { 'i', 'e', 0xC4, 0x87 };
168 : static const symbol s_2_104[3] = { 'i', 0xC4, 0x87 };
169 : static const symbol s_2_105[4] = { 0xC4, 0x85, 0xC4, 0x87 };
170 : static const symbol s_2_106[5] = { 'a', 0xC5, 0x9B, 0xC4, 0x87 };
171 : static const symbol s_2_107[5] = { 'e', 0xC5, 0x9B, 0xC4, 0x87 };
172 : static const symbol s_2_108[2] = { 0xC4, 0x99 };
173 : static const symbol s_2_109[4] = { 's', 'z', 0xC4, 0x99 };
174 : static const symbol s_2_110[5] = { 0xC5, 0x82, 'a', 0xC5, 0x9B };
175 : static const symbol s_2_111[6] = { 'a', 0xC5, 0x82, 'a', 0xC5, 0x9B };
176 : static const symbol s_2_112[7] = { 'i', 'a', 0xC5, 0x82, 'a', 0xC5, 0x9B };
177 : static const symbol s_2_113[6] = { 'i', 0xC5, 0x82, 'a', 0xC5, 0x9B };
178 : static const symbol s_2_114[5] = { 0xC5, 0x82, 'e', 0xC5, 0x9B };
179 : static const symbol s_2_115[6] = { 'a', 0xC5, 0x82, 'e', 0xC5, 0x9B };
180 : static const symbol s_2_116[7] = { 'i', 'a', 0xC5, 0x82, 'e', 0xC5, 0x9B };
181 : static const symbol s_2_117[6] = { 'i', 0xC5, 0x82, 'e', 0xC5, 0x9B };
182 : static const struct among a_2[118] = {
183 : { 1, s_2_0, 0, 1, 1},
184 : { 4, s_2_1, -1, 1, 0},
185 : { 6, s_2_2, -1, 1, 0},
186 : { 6, s_2_3, -2, 2, 0},
187 : { 2, s_2_4, -4, 1, 1},
188 : { 3, s_2_5, -5, 1, 0},
189 : { 6, s_2_6, -1, 1, 0},
190 : { 4, s_2_7, -7, 1, 0},
191 : { 5, s_2_8, -1, 1, 0},
192 : { 4, s_2_9, -9, 1, 0},
193 : { 3, s_2_10, 0, 1, 0},
194 : { 5, s_2_11, -1, 1, 0},
195 : { 1, s_2_12, 0, 1, 1},
196 : { 4, s_2_13, -1, 1, 0},
197 : { 6, s_2_14, -1, 1, 0},
198 : { 6, s_2_15, -2, 2, 0},
199 : { 2, s_2_16, -4, 1, 1},
200 : { 3, s_2_17, -1, 1, 0},
201 : { 4, s_2_18, -1, 1, 0},
202 : { 4, s_2_19, -2, 1, 0},
203 : { 4, s_2_20, -3, 1, 0},
204 : { 5, s_2_21, -4, 1, 0},
205 : { 7, s_2_22, -5, 4, 0},
206 : { 8, s_2_23, -1, 1, 0},
207 : { 9, s_2_24, -2, 1, 0},
208 : { 8, s_2_25, -3, 1, 0},
209 : { 8, s_2_26, -9, 4, 0},
210 : { 9, s_2_27, -1, 1, 0},
211 : { 10, s_2_28, -1, 1, 0},
212 : { 9, s_2_29, -3, 1, 0},
213 : { 3, s_2_30, -18, 1, 0},
214 : { 6, s_2_31, -1, 1, 0},
215 : { 3, s_2_32, 0, 1, 1},
216 : { 4, s_2_33, -1, 1, 1},
217 : { 3, s_2_34, 0, 5, 0},
218 : { 3, s_2_35, 0, 5, 0},
219 : { 1, s_2_36, 0, 1, 1},
220 : { 3, s_2_37, -1, 1, 0},
221 : { 4, s_2_38, -2, 1, 0},
222 : { 3, s_2_39, -3, 1, 0},
223 : { 3, s_2_40, -4, 1, 1},
224 : { 4, s_2_41, -1, 1, 1},
225 : { 3, s_2_42, -6, 5, 0},
226 : { 3, s_2_43, -7, 5, 0},
227 : { 3, s_2_44, -8, 1, 1},
228 : { 4, s_2_45, -1, 1, 1},
229 : { 2, s_2_46, 0, 1, 0},
230 : { 2, s_2_47, 0, 5, 0},
231 : { 3, s_2_48, -1, 5, 0},
232 : { 2, s_2_49, 0, 1, 0},
233 : { 5, s_2_50, -1, 1, 0},
234 : { 6, s_2_51, -1, 1, 0},
235 : { 5, s_2_52, -3, 1, 0},
236 : { 2, s_2_53, 0, 1, 1},
237 : { 3, s_2_54, -1, 1, 1},
238 : { 5, s_2_55, -2, 1, 0},
239 : { 6, s_2_56, -1, 1, 0},
240 : { 5, s_2_57, -4, 1, 0},
241 : { 2, s_2_58, 0, 5, 0},
242 : { 2, s_2_59, 0, 1, 1},
243 : { 3, s_2_60, -1, 1, 1},
244 : { 2, s_2_61, 0, 5, 0},
245 : { 1, s_2_62, 0, 1, 1},
246 : { 3, s_2_63, -1, 5, 0},
247 : { 4, s_2_64, -1, 5, 0},
248 : { 4, s_2_65, -3, 1, 0},
249 : { 5, s_2_66, -1, 1, 0},
250 : { 4, s_2_67, -5, 1, 0},
251 : { 1, s_2_68, 0, 1, 1},
252 : { 2, s_2_69, -1, 1, 1},
253 : { 3, s_2_70, -2, 5, 0},
254 : { 4, s_2_71, -1, 5, 0},
255 : { 3, s_2_72, 0, 1, 1},
256 : { 1, s_2_73, 0, 5, 0},
257 : { 3, s_2_74, -1, 1, 0},
258 : { 3, s_2_75, -2, 1, 0},
259 : { 3, s_2_76, -3, 1, 0},
260 : { 6, s_2_77, -4, 4, 0},
261 : { 7, s_2_78, -1, 1, 0},
262 : { 8, s_2_79, -2, 1, 0},
263 : { 7, s_2_80, -3, 1, 0},
264 : { 7, s_2_81, -8, 4, 0},
265 : { 8, s_2_82, -1, 1, 0},
266 : { 9, s_2_83, -1, 1, 0},
267 : { 8, s_2_84, -3, 1, 0},
268 : { 4, s_2_85, -12, 1, 0},
269 : { 5, s_2_86, -1, 1, 0},
270 : { 4, s_2_87, -14, 1, 0},
271 : { 3, s_2_88, 0, 1, 0},
272 : { 3, s_2_89, 0, 1, 0},
273 : { 3, s_2_90, 0, 1, 0},
274 : { 3, s_2_91, 0, 1, 0},
275 : { 4, s_2_92, -1, 1, 0},
276 : { 3, s_2_93, 0, 1, 0},
277 : { 2, s_2_94, 0, 1, 1},
278 : { 5, s_2_95, -1, 1, 0},
279 : { 7, s_2_96, -1, 1, 0},
280 : { 7, s_2_97, -2, 2, 0},
281 : { 3, s_2_98, -4, 1, 1},
282 : { 4, s_2_99, -5, 1, 0},
283 : { 4, s_2_100, -6, 3, 0},
284 : { 7, s_2_101, -1, 1, 0},
285 : { 3, s_2_102, 0, 1, 0},
286 : { 4, s_2_103, 0, 1, 0},
287 : { 3, s_2_104, 0, 1, 0},
288 : { 4, s_2_105, 0, 1, 0},
289 : { 5, s_2_106, 0, 1, 0},
290 : { 5, s_2_107, 0, 1, 0},
291 : { 2, s_2_108, 0, 1, 0},
292 : { 4, s_2_109, -1, 2, 0},
293 : { 5, s_2_110, 0, 4, 0},
294 : { 6, s_2_111, -1, 1, 0},
295 : { 7, s_2_112, -1, 1, 0},
296 : { 6, s_2_113, -3, 1, 0},
297 : { 5, s_2_114, 0, 4, 0},
298 : { 6, s_2_115, -1, 1, 0},
299 : { 7, s_2_116, -1, 1, 0},
300 : { 6, s_2_117, -3, 1, 0}
301 : };
302 :
303 : static const symbol s_3_0[2] = { 0xC5, 0x84 };
304 : static const symbol s_3_1[2] = { 0xC4, 0x87 };
305 : static const symbol s_3_2[2] = { 0xC5, 0x9B };
306 : static const symbol s_3_3[2] = { 0xC5, 0xBA };
307 : static const struct among a_3[4] = {
308 : { 2, s_3_0, 0, 2, 0},
309 : { 2, s_3_1, 0, 1, 0},
310 : { 2, s_3_2, 0, 3, 0},
311 : { 2, s_3_3, 0, 4, 0}
312 : };
313 :
314 : static const unsigned char g_v[] = { 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 16, 0, 0, 1 };
315 :
316 0 : static int r_mark_regions(struct SN_env * z) {
317 0 : ((SN_local *)z)->i_p1 = z->l;
318 : {
319 0 : int ret = out_grouping_U(z, g_v, 97, 281, 1);
320 0 : if (ret < 0) return 0;
321 0 : z->c += ret;
322 : }
323 : {
324 0 : int ret = in_grouping_U(z, g_v, 97, 281, 1);
325 0 : if (ret < 0) return 0;
326 0 : z->c += ret;
327 : }
328 0 : ((SN_local *)z)->i_p1 = z->c;
329 0 : return 1;
330 : }
331 :
332 0 : static int r_R1(struct SN_env * z) {
333 0 : return ((SN_local *)z)->i_p1 <= z->c;
334 : }
335 :
336 0 : static int r_remove_endings(struct SN_env * z) {
337 : int among_var;
338 : {
339 0 : int v_1 = z->l - z->c;
340 : {
341 : int v_2;
342 0 : if (z->c < ((SN_local *)z)->i_p1) goto lab0;
343 0 : v_2 = z->lb; z->lb = ((SN_local *)z)->i_p1;
344 0 : z->ket = z->c;
345 0 : if (!find_among_b(z, a_0, 5, 0)) { z->lb = v_2; goto lab0; }
346 0 : z->bra = z->c;
347 0 : z->lb = v_2;
348 : }
349 : {
350 0 : int ret = slice_del(z);
351 0 : if (ret < 0) return ret;
352 : }
353 0 : lab0:
354 0 : z->c = z->l - v_1;
355 : }
356 0 : z->ket = z->c;
357 0 : among_var = find_among_b(z, a_2, 118, r_R1);
358 0 : if (!among_var) return 0;
359 0 : z->bra = z->c;
360 0 : switch (among_var) {
361 0 : case 1:
362 : {
363 0 : int ret = slice_del(z);
364 0 : if (ret < 0) return ret;
365 : }
366 0 : break;
367 0 : case 2:
368 : {
369 0 : int ret = slice_from_s(z, 1, s_0);
370 0 : if (ret < 0) return ret;
371 : }
372 0 : break;
373 0 : case 3:
374 : do {
375 0 : int v_3 = z->l - z->c;
376 : {
377 0 : int v_4 = z->l - z->c;
378 : {
379 0 : int ret = r_R1(z);
380 0 : if (ret == 0) goto lab1;
381 0 : if (ret < 0) return ret;
382 : }
383 0 : z->c = z->l - v_4;
384 : {
385 0 : int ret = slice_del(z);
386 0 : if (ret < 0) return ret;
387 : }
388 : }
389 0 : break;
390 0 : lab1:
391 0 : z->c = z->l - v_3;
392 : {
393 0 : int ret = slice_from_s(z, 1, s_1);
394 0 : if (ret < 0) return ret;
395 : }
396 : } while (0);
397 0 : break;
398 0 : case 4:
399 : {
400 0 : int ret = slice_from_s(z, 2, s_2);
401 0 : if (ret < 0) return ret;
402 : }
403 0 : break;
404 0 : case 5:
405 : {
406 0 : int ret = slice_del(z);
407 0 : if (ret < 0) return ret;
408 : }
409 : {
410 0 : int v_5 = z->l - z->c;
411 0 : z->ket = z->c;
412 0 : if (z->c - 1 <= z->lb || (z->p[z->c - 1] != 99 && z->p[z->c - 1] != 122)) { z->c = z->l - v_5; goto lab2; }
413 0 : among_var = find_among_b(z, a_1, 5, 0);
414 0 : if (!among_var) { z->c = z->l - v_5; goto lab2; }
415 0 : z->bra = z->c;
416 : switch (among_var) {
417 0 : case 1:
418 : {
419 0 : int ret = slice_del(z);
420 0 : if (ret < 0) return ret;
421 : }
422 0 : break;
423 0 : case 2:
424 : {
425 0 : int ret = slice_from_s(z, 1, s_3);
426 0 : if (ret < 0) return ret;
427 : }
428 0 : break;
429 : }
430 0 : lab2:
431 : ;
432 : }
433 0 : break;
434 : }
435 0 : return 1;
436 : }
437 :
438 0 : static int r_normalize_consonant(struct SN_env * z) {
439 : int among_var;
440 0 : z->ket = z->c;
441 0 : among_var = find_among_b(z, a_3, 4, 0);
442 0 : if (!among_var) return 0;
443 0 : z->bra = z->c;
444 0 : if (z->c > z->lb) goto lab0;
445 0 : return 0;
446 0 : lab0:
447 0 : switch (among_var) {
448 0 : case 1:
449 : {
450 0 : int ret = slice_from_s(z, 1, s_4);
451 0 : if (ret < 0) return ret;
452 : }
453 0 : break;
454 0 : case 2:
455 : {
456 0 : int ret = slice_from_s(z, 1, s_5);
457 0 : if (ret < 0) return ret;
458 : }
459 0 : break;
460 0 : case 3:
461 : {
462 0 : int ret = slice_from_s(z, 1, s_6);
463 0 : if (ret < 0) return ret;
464 : }
465 0 : break;
466 0 : case 4:
467 : {
468 0 : int ret = slice_from_s(z, 1, s_7);
469 0 : if (ret < 0) return ret;
470 : }
471 0 : break;
472 : }
473 0 : return 1;
474 : }
475 :
476 0 : extern int polish_UTF_8_stem(struct SN_env * z) {
477 : {
478 0 : int v_1 = z->c;
479 : {
480 0 : int ret = r_mark_regions(z);
481 0 : if (ret < 0) return ret;
482 : }
483 0 : z->c = v_1;
484 : }
485 : do {
486 0 : int v_2 = z->c;
487 : {
488 0 : int ret = skip_utf8(z->p, z->c, z->l, 2);
489 0 : if (ret < 0) goto lab0;
490 0 : z->c = ret;
491 : }
492 0 : z->lb = z->c; z->c = z->l;
493 : {
494 0 : int ret = r_remove_endings(z);
495 0 : if (ret == 0) goto lab0;
496 0 : if (ret < 0) return ret;
497 : }
498 0 : z->c = z->lb;
499 0 : break;
500 0 : lab0:
501 0 : z->c = v_2;
502 0 : z->lb = z->c; z->c = z->l;
503 : {
504 0 : int ret = r_normalize_consonant(z);
505 0 : if (ret <= 0) return ret;
506 : }
507 0 : z->c = z->lb;
508 : } while (0);
509 0 : return 1;
510 : }
511 :
512 0 : extern struct SN_env * polish_UTF_8_create_env(void) {
513 0 : struct SN_env * z = SN_new_env(sizeof(SN_local));
514 0 : if (z) {
515 0 : ((SN_local *)z)->i_p1 = 0;
516 : }
517 0 : return z;
518 : }
519 :
520 0 : extern void polish_UTF_8_close_env(struct SN_env * z) {
521 0 : SN_delete_env(z);
522 0 : }
523 :
|