~ubuntu-branches/ubuntu/wily/ruby-ferret/wily

« back to all changes in this revision

Viewing changes to ext/stem_ISO_8859_1_danish.c

  • Committer: Bazaar Package Importer
  • Author(s): Antonio Terceiro
  • Date: 2011-07-28 00:02:49 UTC
  • Revision ID: james.westby@ubuntu.com-20110728000249-v0443y69ftcpxwi6
Tags: upstream-0.11.6
ImportĀ upstreamĀ versionĀ 0.11.6

Show diffs side-by-side

added added

removed removed

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