Header And Logo

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

stem_ISO_8859_1_swedish.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 swedish_ISO_8859_1_stem(struct SN_env * z);
00010 #ifdef __cplusplus
00011 }
00012 #endif
00013 static int r_other_suffix(struct SN_env * z);
00014 static int r_consonant_pair(struct SN_env * z);
00015 static int r_main_suffix(struct SN_env * z);
00016 static int r_mark_regions(struct SN_env * z);
00017 #ifdef __cplusplus
00018 extern "C" {
00019 #endif
00020 
00021 
00022 extern struct SN_env * swedish_ISO_8859_1_create_env(void);
00023 extern void swedish_ISO_8859_1_close_env(struct SN_env * z);
00024 
00025 
00026 #ifdef __cplusplus
00027 }
00028 #endif
00029 static const symbol s_0_0[1] = { 'a' };
00030 static const symbol s_0_1[4] = { 'a', 'r', 'n', 'a' };
00031 static const symbol s_0_2[4] = { 'e', 'r', 'n', 'a' };
00032 static const symbol s_0_3[7] = { 'h', 'e', 't', 'e', 'r', 'n', 'a' };
00033 static const symbol s_0_4[4] = { 'o', 'r', 'n', 'a' };
00034 static const symbol s_0_5[2] = { 'a', 'd' };
00035 static const symbol s_0_6[1] = { 'e' };
00036 static const symbol s_0_7[3] = { 'a', 'd', 'e' };
00037 static const symbol s_0_8[4] = { 'a', 'n', 'd', 'e' };
00038 static const symbol s_0_9[4] = { 'a', 'r', 'n', 'e' };
00039 static const symbol s_0_10[3] = { 'a', 'r', 'e' };
00040 static const symbol s_0_11[4] = { 'a', 's', 't', 'e' };
00041 static const symbol s_0_12[2] = { 'e', 'n' };
00042 static const symbol s_0_13[5] = { 'a', 'n', 'd', 'e', 'n' };
00043 static const symbol s_0_14[4] = { 'a', 'r', 'e', 'n' };
00044 static const symbol s_0_15[5] = { 'h', 'e', 't', 'e', 'n' };
00045 static const symbol s_0_16[3] = { 'e', 'r', 'n' };
00046 static const symbol s_0_17[2] = { 'a', 'r' };
00047 static const symbol s_0_18[2] = { 'e', 'r' };
00048 static const symbol s_0_19[5] = { 'h', 'e', 't', 'e', 'r' };
00049 static const symbol s_0_20[2] = { 'o', 'r' };
00050 static const symbol s_0_21[1] = { 's' };
00051 static const symbol s_0_22[2] = { 'a', 's' };
00052 static const symbol s_0_23[5] = { 'a', 'r', 'n', 'a', 's' };
00053 static const symbol s_0_24[5] = { 'e', 'r', 'n', 'a', 's' };
00054 static const symbol s_0_25[5] = { 'o', 'r', 'n', 'a', 's' };
00055 static const symbol s_0_26[2] = { 'e', 's' };
00056 static const symbol s_0_27[4] = { 'a', 'd', 'e', 's' };
00057 static const symbol s_0_28[5] = { 'a', 'n', 'd', 'e', 's' };
00058 static const symbol s_0_29[3] = { 'e', 'n', 's' };
00059 static const symbol s_0_30[5] = { 'a', 'r', 'e', 'n', 's' };
00060 static const symbol s_0_31[6] = { 'h', 'e', 't', 'e', 'n', 's' };
00061 static const symbol s_0_32[4] = { 'e', 'r', 'n', 's' };
00062 static const symbol s_0_33[2] = { 'a', 't' };
00063 static const symbol s_0_34[5] = { 'a', 'n', 'd', 'e', 't' };
00064 static const symbol s_0_35[3] = { 'h', 'e', 't' };
00065 static const symbol s_0_36[3] = { 'a', 's', 't' };
00066 
00067 static const struct among a_0[37] =
00068 {
00069 /*  0 */ { 1, s_0_0, -1, 1, 0},
00070 /*  1 */ { 4, s_0_1, 0, 1, 0},
00071 /*  2 */ { 4, s_0_2, 0, 1, 0},
00072 /*  3 */ { 7, s_0_3, 2, 1, 0},
00073 /*  4 */ { 4, s_0_4, 0, 1, 0},
00074 /*  5 */ { 2, s_0_5, -1, 1, 0},
00075 /*  6 */ { 1, s_0_6, -1, 1, 0},
00076 /*  7 */ { 3, s_0_7, 6, 1, 0},
00077 /*  8 */ { 4, s_0_8, 6, 1, 0},
00078 /*  9 */ { 4, s_0_9, 6, 1, 0},
00079 /* 10 */ { 3, s_0_10, 6, 1, 0},
00080 /* 11 */ { 4, s_0_11, 6, 1, 0},
00081 /* 12 */ { 2, s_0_12, -1, 1, 0},
00082 /* 13 */ { 5, s_0_13, 12, 1, 0},
00083 /* 14 */ { 4, s_0_14, 12, 1, 0},
00084 /* 15 */ { 5, s_0_15, 12, 1, 0},
00085 /* 16 */ { 3, s_0_16, -1, 1, 0},
00086 /* 17 */ { 2, s_0_17, -1, 1, 0},
00087 /* 18 */ { 2, s_0_18, -1, 1, 0},
00088 /* 19 */ { 5, s_0_19, 18, 1, 0},
00089 /* 20 */ { 2, s_0_20, -1, 1, 0},
00090 /* 21 */ { 1, s_0_21, -1, 2, 0},
00091 /* 22 */ { 2, s_0_22, 21, 1, 0},
00092 /* 23 */ { 5, s_0_23, 22, 1, 0},
00093 /* 24 */ { 5, s_0_24, 22, 1, 0},
00094 /* 25 */ { 5, s_0_25, 22, 1, 0},
00095 /* 26 */ { 2, s_0_26, 21, 1, 0},
00096 /* 27 */ { 4, s_0_27, 26, 1, 0},
00097 /* 28 */ { 5, s_0_28, 26, 1, 0},
00098 /* 29 */ { 3, s_0_29, 21, 1, 0},
00099 /* 30 */ { 5, s_0_30, 29, 1, 0},
00100 /* 31 */ { 6, s_0_31, 29, 1, 0},
00101 /* 32 */ { 4, s_0_32, 21, 1, 0},
00102 /* 33 */ { 2, s_0_33, -1, 1, 0},
00103 /* 34 */ { 5, s_0_34, -1, 1, 0},
00104 /* 35 */ { 3, s_0_35, -1, 1, 0},
00105 /* 36 */ { 3, s_0_36, -1, 1, 0}
00106 };
00107 
00108 static const symbol s_1_0[2] = { 'd', 'd' };
00109 static const symbol s_1_1[2] = { 'g', 'd' };
00110 static const symbol s_1_2[2] = { 'n', 'n' };
00111 static const symbol s_1_3[2] = { 'd', 't' };
00112 static const symbol s_1_4[2] = { 'g', 't' };
00113 static const symbol s_1_5[2] = { 'k', 't' };
00114 static const symbol s_1_6[2] = { 't', 't' };
00115 
00116 static const struct among a_1[7] =
00117 {
00118 /*  0 */ { 2, s_1_0, -1, -1, 0},
00119 /*  1 */ { 2, s_1_1, -1, -1, 0},
00120 /*  2 */ { 2, s_1_2, -1, -1, 0},
00121 /*  3 */ { 2, s_1_3, -1, -1, 0},
00122 /*  4 */ { 2, s_1_4, -1, -1, 0},
00123 /*  5 */ { 2, s_1_5, -1, -1, 0},
00124 /*  6 */ { 2, s_1_6, -1, -1, 0}
00125 };
00126 
00127 static const symbol s_2_0[2] = { 'i', 'g' };
00128 static const symbol s_2_1[3] = { 'l', 'i', 'g' };
00129 static const symbol s_2_2[3] = { 'e', 'l', 's' };
00130 static const symbol s_2_3[5] = { 'f', 'u', 'l', 'l', 't' };
00131 static const symbol s_2_4[4] = { 'l', 0xF6, 's', 't' };
00132 
00133 static const struct among a_2[5] =
00134 {
00135 /*  0 */ { 2, s_2_0, -1, 1, 0},
00136 /*  1 */ { 3, s_2_1, 0, 1, 0},
00137 /*  2 */ { 3, s_2_2, -1, 1, 0},
00138 /*  3 */ { 5, s_2_3, -1, 3, 0},
00139 /*  4 */ { 4, s_2_4, -1, 2, 0}
00140 };
00141 
00142 static const unsigned char g_v[] = { 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 32 };
00143 
00144 static const unsigned char g_s_ending[] = { 119, 127, 149 };
00145 
00146 static const symbol s_0[] = { 'l', 0xF6, 's' };
00147 static const symbol s_1[] = { 'f', 'u', 'l', 'l' };
00148 
00149 static int r_mark_regions(struct SN_env * z) {
00150     z->I[0] = z->l;
00151     {   int c_test = z->c; /* test, line 29 */
00152         {   int ret = z->c + 3;
00153             if (0 > ret || ret > z->l) return 0;
00154             z->c = ret; /* hop, line 29 */
00155         }
00156         z->I[1] = z->c; /* setmark x, line 29 */
00157         z->c = c_test;
00158     }
00159     if (out_grouping(z, g_v, 97, 246, 1) < 0) return 0; /* goto */ /* grouping v, line 30 */
00160     {    /* gopast */ /* non v, line 30 */
00161         int ret = in_grouping(z, g_v, 97, 246, 1);
00162         if (ret < 0) return 0;
00163         z->c += ret;
00164     }
00165     z->I[0] = z->c; /* setmark p1, line 30 */
00166      /* try, line 31 */
00167     if (!(z->I[0] < z->I[1])) goto lab0;
00168     z->I[0] = z->I[1];
00169 lab0:
00170     return 1;
00171 }
00172 
00173 static int r_main_suffix(struct SN_env * z) {
00174     int among_var;
00175     {   int mlimit; /* setlimit, line 37 */
00176         int m1 = z->l - z->c; (void)m1;
00177         if (z->c < z->I[0]) return 0;
00178         z->c = z->I[0]; /* tomark, line 37 */
00179         mlimit = z->lb; z->lb = z->c;
00180         z->c = z->l - m1;
00181         z->ket = z->c; /* [, line 37 */
00182         if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1851442 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->lb = mlimit; return 0; }
00183         among_var = find_among_b(z, a_0, 37); /* substring, line 37 */
00184         if (!(among_var)) { z->lb = mlimit; return 0; }
00185         z->bra = z->c; /* ], line 37 */
00186         z->lb = mlimit;
00187     }
00188     switch(among_var) {
00189         case 0: return 0;
00190         case 1:
00191             {   int ret = slice_del(z); /* delete, line 44 */
00192                 if (ret < 0) return ret;
00193             }
00194             break;
00195         case 2:
00196             if (in_grouping_b(z, g_s_ending, 98, 121, 0)) return 0;
00197             {   int ret = slice_del(z); /* delete, line 46 */
00198                 if (ret < 0) return ret;
00199             }
00200             break;
00201     }
00202     return 1;
00203 }
00204 
00205 static int r_consonant_pair(struct SN_env * z) {
00206     {   int mlimit; /* setlimit, line 50 */
00207         int m1 = z->l - z->c; (void)m1;
00208         if (z->c < z->I[0]) return 0;
00209         z->c = z->I[0]; /* tomark, line 50 */
00210         mlimit = z->lb; z->lb = z->c;
00211         z->c = z->l - m1;
00212         {   int m2 = z->l - z->c; (void)m2; /* and, line 52 */
00213             if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1064976 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->lb = mlimit; return 0; }
00214             if (!(find_among_b(z, a_1, 7))) { z->lb = mlimit; return 0; } /* among, line 51 */
00215             z->c = z->l - m2;
00216             z->ket = z->c; /* [, line 52 */
00217             if (z->c <= z->lb) { z->lb = mlimit; return 0; }
00218             z->c--; /* next, line 52 */
00219             z->bra = z->c; /* ], line 52 */
00220             {   int ret = slice_del(z); /* delete, line 52 */
00221                 if (ret < 0) return ret;
00222             }
00223         }
00224         z->lb = mlimit;
00225     }
00226     return 1;
00227 }
00228 
00229 static int r_other_suffix(struct SN_env * z) {
00230     int among_var;
00231     {   int mlimit; /* setlimit, line 55 */
00232         int m1 = z->l - z->c; (void)m1;
00233         if (z->c < z->I[0]) return 0;
00234         z->c = z->I[0]; /* tomark, line 55 */
00235         mlimit = z->lb; z->lb = z->c;
00236         z->c = z->l - m1;
00237         z->ket = z->c; /* [, line 56 */
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 56 */
00240         if (!(among_var)) { z->lb = mlimit; return 0; }
00241         z->bra = z->c; /* ], line 56 */
00242         switch(among_var) {
00243             case 0: { z->lb = mlimit; return 0; }
00244             case 1:
00245                 {   int ret = slice_del(z); /* delete, line 57 */
00246                     if (ret < 0) return ret;
00247                 }
00248                 break;
00249             case 2:
00250                 {   int ret = slice_from_s(z, 3, s_0); /* <-, line 58 */
00251                     if (ret < 0) return ret;
00252                 }
00253                 break;
00254             case 3:
00255                 {   int ret = slice_from_s(z, 4, s_1); /* <-, line 59 */
00256                     if (ret < 0) return ret;
00257                 }
00258                 break;
00259         }
00260         z->lb = mlimit;
00261     }
00262     return 1;
00263 }
00264 
00265 extern int swedish_ISO_8859_1_stem(struct SN_env * z) {
00266     {   int c1 = z->c; /* do, line 66 */
00267         {   int ret = r_mark_regions(z);
00268             if (ret == 0) goto lab0; /* call mark_regions, line 66 */
00269             if (ret < 0) return ret;
00270         }
00271     lab0:
00272         z->c = c1;
00273     }
00274     z->lb = z->c; z->c = z->l; /* backwards, line 67 */
00275 
00276     {   int m2 = z->l - z->c; (void)m2; /* do, line 68 */
00277         {   int ret = r_main_suffix(z);
00278             if (ret == 0) goto lab1; /* call main_suffix, line 68 */
00279             if (ret < 0) return ret;
00280         }
00281     lab1:
00282         z->c = z->l - m2;
00283     }
00284     {   int m3 = z->l - z->c; (void)m3; /* do, line 69 */
00285         {   int ret = r_consonant_pair(z);
00286             if (ret == 0) goto lab2; /* call consonant_pair, line 69 */
00287             if (ret < 0) return ret;
00288         }
00289     lab2:
00290         z->c = z->l - m3;
00291     }
00292     {   int m4 = z->l - z->c; (void)m4; /* do, line 70 */
00293         {   int ret = r_other_suffix(z);
00294             if (ret == 0) goto lab3; /* call other_suffix, line 70 */
00295             if (ret < 0) return ret;
00296         }
00297     lab3:
00298         z->c = z->l - m4;
00299     }
00300     z->c = z->lb;
00301     return 1;
00302 }
00303 
00304 extern struct SN_env * swedish_ISO_8859_1_create_env(void) { return SN_create_env(0, 2, 0); }
00305 
00306 extern void swedish_ISO_8859_1_close_env(struct SN_env * z) { SN_close_env(z, 0); }
00307