Header And Logo

PostgreSQL
| The world's most advanced open source database.

stem_UTF_8_danish.c

Go to the documentation of this file.
00001 
00002 /* This file was generated automatically by the Snowball to ANSI C compiler */
00003 
00004 #include "header.h"
00005 
00006 #ifdef __cplusplus
00007 extern "C" {
00008 #endif
00009 extern int danish_UTF_8_stem(struct SN_env * z);
00010 #ifdef __cplusplus
00011 }
00012 #endif
00013 static int r_undouble(struct SN_env * z);
00014 static int r_other_suffix(struct SN_env * z);
00015 static int r_consonant_pair(struct SN_env * z);
00016 static int r_main_suffix(struct SN_env * z);
00017 static int r_mark_regions(struct SN_env * z);
00018 #ifdef __cplusplus
00019 extern "C" {
00020 #endif
00021 
00022 
00023 extern struct SN_env * danish_UTF_8_create_env(void);
00024 extern void danish_UTF_8_close_env(struct SN_env * z);
00025 
00026 
00027 #ifdef __cplusplus
00028 }
00029 #endif
00030 static const symbol s_0_0[3] = { 'h', 'e', 'd' };
00031 static const symbol s_0_1[5] = { 'e', 't', 'h', 'e', 'd' };
00032 static const symbol s_0_2[4] = { 'e', 'r', 'e', 'd' };
00033 static const symbol s_0_3[1] = { 'e' };
00034 static const symbol s_0_4[5] = { 'e', 'r', 'e', 'd', 'e' };
00035 static const symbol s_0_5[4] = { 'e', 'n', 'd', 'e' };
00036 static const symbol s_0_6[6] = { 'e', 'r', 'e', 'n', 'd', 'e' };
00037 static const symbol s_0_7[3] = { 'e', 'n', 'e' };
00038 static const symbol s_0_8[4] = { 'e', 'r', 'n', 'e' };
00039 static const symbol s_0_9[3] = { 'e', 'r', 'e' };
00040 static const symbol s_0_10[2] = { 'e', 'n' };
00041 static const symbol s_0_11[5] = { 'h', 'e', 'd', 'e', 'n' };
00042 static const symbol s_0_12[4] = { 'e', 'r', 'e', 'n' };
00043 static const symbol s_0_13[2] = { 'e', 'r' };
00044 static const symbol s_0_14[5] = { 'h', 'e', 'd', 'e', 'r' };
00045 static const symbol s_0_15[4] = { 'e', 'r', 'e', 'r' };
00046 static const symbol s_0_16[1] = { 's' };
00047 static const symbol s_0_17[4] = { 'h', 'e', 'd', 's' };
00048 static const symbol s_0_18[2] = { 'e', 's' };
00049 static const symbol s_0_19[5] = { 'e', 'n', 'd', 'e', 's' };
00050 static const symbol s_0_20[7] = { 'e', 'r', 'e', 'n', 'd', 'e', 's' };
00051 static const symbol s_0_21[4] = { 'e', 'n', 'e', 's' };
00052 static const symbol s_0_22[5] = { 'e', 'r', 'n', 'e', 's' };
00053 static const symbol s_0_23[4] = { 'e', 'r', 'e', 's' };
00054 static const symbol s_0_24[3] = { 'e', 'n', 's' };
00055 static const symbol s_0_25[6] = { 'h', 'e', 'd', 'e', 'n', 's' };
00056 static const symbol s_0_26[5] = { 'e', 'r', 'e', 'n', 's' };
00057 static const symbol s_0_27[3] = { 'e', 'r', 's' };
00058 static const symbol s_0_28[3] = { 'e', 't', 's' };
00059 static const symbol s_0_29[5] = { 'e', 'r', 'e', 't', 's' };
00060 static const symbol s_0_30[2] = { 'e', 't' };
00061 static const symbol s_0_31[4] = { 'e', 'r', 'e', 't' };
00062 
00063 static const struct among a_0[32] =
00064 {
00065 /*  0 */ { 3, s_0_0, -1, 1, 0},
00066 /*  1 */ { 5, s_0_1, 0, 1, 0},
00067 /*  2 */ { 4, s_0_2, -1, 1, 0},
00068 /*  3 */ { 1, s_0_3, -1, 1, 0},
00069 /*  4 */ { 5, s_0_4, 3, 1, 0},
00070 /*  5 */ { 4, s_0_5, 3, 1, 0},
00071 /*  6 */ { 6, s_0_6, 5, 1, 0},
00072 /*  7 */ { 3, s_0_7, 3, 1, 0},
00073 /*  8 */ { 4, s_0_8, 3, 1, 0},
00074 /*  9 */ { 3, s_0_9, 3, 1, 0},
00075 /* 10 */ { 2, s_0_10, -1, 1, 0},
00076 /* 11 */ { 5, s_0_11, 10, 1, 0},
00077 /* 12 */ { 4, s_0_12, 10, 1, 0},
00078 /* 13 */ { 2, s_0_13, -1, 1, 0},
00079 /* 14 */ { 5, s_0_14, 13, 1, 0},
00080 /* 15 */ { 4, s_0_15, 13, 1, 0},
00081 /* 16 */ { 1, s_0_16, -1, 2, 0},
00082 /* 17 */ { 4, s_0_17, 16, 1, 0},
00083 /* 18 */ { 2, s_0_18, 16, 1, 0},
00084 /* 19 */ { 5, s_0_19, 18, 1, 0},
00085 /* 20 */ { 7, s_0_20, 19, 1, 0},
00086 /* 21 */ { 4, s_0_21, 18, 1, 0},
00087 /* 22 */ { 5, s_0_22, 18, 1, 0},
00088 /* 23 */ { 4, s_0_23, 18, 1, 0},
00089 /* 24 */ { 3, s_0_24, 16, 1, 0},
00090 /* 25 */ { 6, s_0_25, 24, 1, 0},
00091 /* 26 */ { 5, s_0_26, 24, 1, 0},
00092 /* 27 */ { 3, s_0_27, 16, 1, 0},
00093 /* 28 */ { 3, s_0_28, 16, 1, 0},
00094 /* 29 */ { 5, s_0_29, 28, 1, 0},
00095 /* 30 */ { 2, s_0_30, -1, 1, 0},
00096 /* 31 */ { 4, s_0_31, 30, 1, 0}
00097 };
00098 
00099 static const symbol s_1_0[2] = { 'g', 'd' };
00100 static const symbol s_1_1[2] = { 'd', 't' };
00101 static const symbol s_1_2[2] = { 'g', 't' };
00102 static const symbol s_1_3[2] = { 'k', 't' };
00103 
00104 static const struct among a_1[4] =
00105 {
00106 /*  0 */ { 2, s_1_0, -1, -1, 0},
00107 /*  1 */ { 2, s_1_1, -1, -1, 0},
00108 /*  2 */ { 2, s_1_2, -1, -1, 0},
00109 /*  3 */ { 2, s_1_3, -1, -1, 0}
00110 };
00111 
00112 static const symbol s_2_0[2] = { 'i', 'g' };
00113 static const symbol s_2_1[3] = { 'l', 'i', 'g' };
00114 static const symbol s_2_2[4] = { 'e', 'l', 'i', 'g' };
00115 static const symbol s_2_3[3] = { 'e', 'l', 's' };
00116 static const symbol s_2_4[5] = { 'l', 0xC3, 0xB8, 's', 't' };
00117 
00118 static const struct among a_2[5] =
00119 {
00120 /*  0 */ { 2, s_2_0, -1, 1, 0},
00121 /*  1 */ { 3, s_2_1, 0, 1, 0},
00122 /*  2 */ { 4, s_2_2, 1, 1, 0},
00123 /*  3 */ { 3, s_2_3, -1, 1, 0},
00124 /*  4 */ { 5, s_2_4, -1, 2, 0}
00125 };
00126 
00127 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 };
00128 
00129 static const unsigned char g_s_ending[] = { 239, 254, 42, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16 };
00130 
00131 static const symbol s_0[] = { 's', 't' };
00132 static const symbol s_1[] = { 'i', 'g' };
00133 static const symbol s_2[] = { 'l', 0xC3, 0xB8, 's' };
00134 
00135 static int r_mark_regions(struct SN_env * z) {
00136     z->I[0] = z->l;
00137     {   int c_test = z->c; /* test, line 33 */
00138         {   int ret = skip_utf8(z->p, z->c, 0, z->l, + 3);
00139             if (ret < 0) return 0;
00140             z->c = ret; /* hop, line 33 */
00141         }
00142         z->I[1] = z->c; /* setmark x, line 33 */
00143         z->c = c_test;
00144     }
00145     if (out_grouping_U(z, g_v, 97, 248, 1) < 0) return 0; /* goto */ /* grouping v, line 34 */
00146     {    /* gopast */ /* non v, line 34 */
00147         int ret = in_grouping_U(z, g_v, 97, 248, 1);
00148         if (ret < 0) return 0;
00149         z->c += ret;
00150     }
00151     z->I[0] = z->c; /* setmark p1, line 34 */
00152      /* try, line 35 */
00153     if (!(z->I[0] < z->I[1])) goto lab0;
00154     z->I[0] = z->I[1];
00155 lab0:
00156     return 1;
00157 }
00158 
00159 static int r_main_suffix(struct SN_env * z) {
00160     int among_var;
00161     {   int mlimit; /* setlimit, line 41 */
00162         int m1 = z->l - z->c; (void)m1;
00163         if (z->c < z->I[0]) return 0;
00164         z->c = z->I[0]; /* tomark, line 41 */
00165         mlimit = z->lb; z->lb = z->c;
00166         z->c = z->l - m1;
00167         z->ket = z->c; /* [, line 41 */
00168         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; }
00169         among_var = find_among_b(z, a_0, 32); /* substring, line 41 */
00170         if (!(among_var)) { z->lb = mlimit; return 0; }
00171         z->bra = z->c; /* ], line 41 */
00172         z->lb = mlimit;
00173     }
00174     switch(among_var) {
00175         case 0: return 0;
00176         case 1:
00177             {   int ret = slice_del(z); /* delete, line 48 */
00178                 if (ret < 0) return ret;
00179             }
00180             break;
00181         case 2:
00182             if (in_grouping_b_U(z, g_s_ending, 97, 229, 0)) return 0;
00183             {   int ret = slice_del(z); /* delete, line 50 */
00184                 if (ret < 0) return ret;
00185             }
00186             break;
00187     }
00188     return 1;
00189 }
00190 
00191 static int r_consonant_pair(struct SN_env * z) {
00192     {   int m_test = z->l - z->c; /* test, line 55 */
00193         {   int mlimit; /* setlimit, line 56 */
00194             int m1 = z->l - z->c; (void)m1;
00195             if (z->c < z->I[0]) return 0;
00196             z->c = z->I[0]; /* tomark, line 56 */
00197             mlimit = z->lb; z->lb = z->c;
00198             z->c = z->l - m1;
00199             z->ket = z->c; /* [, line 56 */
00200             if (z->c - 1 <= z->lb || (z->p[z->c - 1] != 100 && z->p[z->c - 1] != 116)) { z->lb = mlimit; return 0; }
00201             if (!(find_among_b(z, a_1, 4))) { z->lb = mlimit; return 0; } /* substring, line 56 */
00202             z->bra = z->c; /* ], line 56 */
00203             z->lb = mlimit;
00204         }
00205         z->c = z->l - m_test;
00206     }
00207     {   int ret = skip_utf8(z->p, z->c, z->lb, 0, -1);
00208         if (ret < 0) return 0;
00209         z->c = ret; /* next, line 62 */
00210     }
00211     z->bra = z->c; /* ], line 62 */
00212     {   int ret = slice_del(z); /* delete, line 62 */
00213         if (ret < 0) return ret;
00214     }
00215     return 1;
00216 }
00217 
00218 static int r_other_suffix(struct SN_env * z) {
00219     int among_var;
00220     {   int m1 = z->l - z->c; (void)m1; /* do, line 66 */
00221         z->ket = z->c; /* [, line 66 */
00222         if (!(eq_s_b(z, 2, s_0))) goto lab0;
00223         z->bra = z->c; /* ], line 66 */
00224         if (!(eq_s_b(z, 2, s_1))) goto lab0;
00225         {   int ret = slice_del(z); /* delete, line 66 */
00226             if (ret < 0) return ret;
00227         }
00228     lab0:
00229         z->c = z->l - m1;
00230     }
00231     {   int mlimit; /* setlimit, line 67 */
00232         int m2 = z->l - z->c; (void)m2;
00233         if (z->c < z->I[0]) return 0;
00234         z->c = z->I[0]; /* tomark, line 67 */
00235         mlimit = z->lb; z->lb = z->c;
00236         z->c = z->l - m2;
00237         z->ket = z->c; /* [, line 67 */
00238         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; }
00239         among_var = find_among_b(z, a_2, 5); /* substring, line 67 */
00240         if (!(among_var)) { z->lb = mlimit; return 0; }
00241         z->bra = z->c; /* ], line 67 */
00242         z->lb = mlimit;
00243     }
00244     switch(among_var) {
00245         case 0: return 0;
00246         case 1:
00247             {   int ret = slice_del(z); /* delete, line 70 */
00248                 if (ret < 0) return ret;
00249             }
00250             {   int m3 = z->l - z->c; (void)m3; /* do, line 70 */
00251                 {   int ret = r_consonant_pair(z);
00252                     if (ret == 0) goto lab1; /* call consonant_pair, line 70 */
00253                     if (ret < 0) return ret;
00254                 }
00255             lab1:
00256                 z->c = z->l - m3;
00257             }
00258             break;
00259         case 2:
00260             {   int ret = slice_from_s(z, 4, s_2); /* <-, line 72 */
00261                 if (ret < 0) return ret;
00262             }
00263             break;
00264     }
00265     return 1;
00266 }
00267 
00268 static int r_undouble(struct SN_env * z) {
00269     {   int mlimit; /* setlimit, line 76 */
00270         int m1 = z->l - z->c; (void)m1;
00271         if (z->c < z->I[0]) return 0;
00272         z->c = z->I[0]; /* tomark, line 76 */
00273         mlimit = z->lb; z->lb = z->c;
00274         z->c = z->l - m1;
00275         z->ket = z->c; /* [, line 76 */
00276         if (out_grouping_b_U(z, g_v, 97, 248, 0)) { z->lb = mlimit; return 0; }
00277         z->bra = z->c; /* ], line 76 */
00278         z->S[0] = slice_to(z, z->S[0]); /* -> ch, line 76 */
00279         if (z->S[0] == 0) return -1; /* -> ch, line 76 */
00280         z->lb = mlimit;
00281     }
00282     if (!(eq_v_b(z, z->S[0]))) return 0; /* name ch, line 77 */
00283     {   int ret = slice_del(z); /* delete, line 78 */
00284         if (ret < 0) return ret;
00285     }
00286     return 1;
00287 }
00288 
00289 extern int danish_UTF_8_stem(struct SN_env * z) {
00290     {   int c1 = z->c; /* do, line 84 */
00291         {   int ret = r_mark_regions(z);
00292             if (ret == 0) goto lab0; /* call mark_regions, line 84 */
00293             if (ret < 0) return ret;
00294         }
00295     lab0:
00296         z->c = c1;
00297     }
00298     z->lb = z->c; z->c = z->l; /* backwards, line 85 */
00299 
00300     {   int m2 = z->l - z->c; (void)m2; /* do, line 86 */
00301         {   int ret = r_main_suffix(z);
00302             if (ret == 0) goto lab1; /* call main_suffix, line 86 */
00303             if (ret < 0) return ret;
00304         }
00305     lab1:
00306         z->c = z->l - m2;
00307     }
00308     {   int m3 = z->l - z->c; (void)m3; /* do, line 87 */
00309         {   int ret = r_consonant_pair(z);
00310             if (ret == 0) goto lab2; /* call consonant_pair, line 87 */
00311             if (ret < 0) return ret;
00312         }
00313     lab2:
00314         z->c = z->l - m3;
00315     }
00316     {   int m4 = z->l - z->c; (void)m4; /* do, line 88 */
00317         {   int ret = r_other_suffix(z);
00318             if (ret == 0) goto lab3; /* call other_suffix, line 88 */
00319             if (ret < 0) return ret;
00320         }
00321     lab3:
00322         z->c = z->l - m4;
00323     }
00324     {   int m5 = z->l - z->c; (void)m5; /* do, line 89 */
00325         {   int ret = r_undouble(z);
00326             if (ret == 0) goto lab4; /* call undouble, line 89 */
00327             if (ret < 0) return ret;
00328         }
00329     lab4:
00330         z->c = z->l - m5;
00331     }
00332     z->c = z->lb;
00333     return 1;
00334 }
00335 
00336 extern struct SN_env * danish_UTF_8_create_env(void) { return SN_create_env(1, 2, 0); }
00337 
00338 extern void danish_UTF_8_close_env(struct SN_env * z) { SN_close_env(z, 1); }
00339