sdsykes-ferret 0.11.6.19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (195) hide show
  1. data/CHANGELOG +24 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README +102 -0
  4. data/Rakefile +338 -0
  5. data/TODO +17 -0
  6. data/TUTORIAL +231 -0
  7. data/bin/ferret-browser +79 -0
  8. data/ext/analysis.c +1555 -0
  9. data/ext/analysis.h +219 -0
  10. data/ext/api.c +69 -0
  11. data/ext/api.h +27 -0
  12. data/ext/array.c +123 -0
  13. data/ext/array.h +53 -0
  14. data/ext/bitvector.c +540 -0
  15. data/ext/bitvector.h +272 -0
  16. data/ext/compound_io.c +383 -0
  17. data/ext/config.h +42 -0
  18. data/ext/document.c +156 -0
  19. data/ext/document.h +53 -0
  20. data/ext/except.c +120 -0
  21. data/ext/except.h +168 -0
  22. data/ext/extconf.rb +14 -0
  23. data/ext/ferret.c +402 -0
  24. data/ext/ferret.h +91 -0
  25. data/ext/filter.c +156 -0
  26. data/ext/fs_store.c +483 -0
  27. data/ext/global.c +418 -0
  28. data/ext/global.h +117 -0
  29. data/ext/hash.c +567 -0
  30. data/ext/hash.h +473 -0
  31. data/ext/hashset.c +170 -0
  32. data/ext/hashset.h +187 -0
  33. data/ext/header.h +58 -0
  34. data/ext/helper.c +62 -0
  35. data/ext/helper.h +13 -0
  36. data/ext/inc/lang.h +48 -0
  37. data/ext/inc/threading.h +31 -0
  38. data/ext/index.c +6425 -0
  39. data/ext/index.h +961 -0
  40. data/ext/lang.h +66 -0
  41. data/ext/libstemmer.c +92 -0
  42. data/ext/libstemmer.h +79 -0
  43. data/ext/mempool.c +87 -0
  44. data/ext/mempool.h +35 -0
  45. data/ext/modules.h +162 -0
  46. data/ext/multimapper.c +310 -0
  47. data/ext/multimapper.h +51 -0
  48. data/ext/posh.c +1006 -0
  49. data/ext/posh.h +1007 -0
  50. data/ext/priorityqueue.c +151 -0
  51. data/ext/priorityqueue.h +143 -0
  52. data/ext/q_boolean.c +1608 -0
  53. data/ext/q_const_score.c +161 -0
  54. data/ext/q_filtered_query.c +209 -0
  55. data/ext/q_fuzzy.c +268 -0
  56. data/ext/q_match_all.c +148 -0
  57. data/ext/q_multi_term.c +677 -0
  58. data/ext/q_parser.c +2825 -0
  59. data/ext/q_phrase.c +1126 -0
  60. data/ext/q_prefix.c +100 -0
  61. data/ext/q_range.c +350 -0
  62. data/ext/q_span.c +2402 -0
  63. data/ext/q_term.c +337 -0
  64. data/ext/q_wildcard.c +171 -0
  65. data/ext/r_analysis.c +2575 -0
  66. data/ext/r_index.c +3472 -0
  67. data/ext/r_qparser.c +585 -0
  68. data/ext/r_search.c +4105 -0
  69. data/ext/r_store.c +513 -0
  70. data/ext/r_utils.c +963 -0
  71. data/ext/ram_store.c +471 -0
  72. data/ext/search.c +1741 -0
  73. data/ext/search.h +885 -0
  74. data/ext/similarity.c +150 -0
  75. data/ext/similarity.h +82 -0
  76. data/ext/sort.c +983 -0
  77. data/ext/stem_ISO_8859_1_danish.c +338 -0
  78. data/ext/stem_ISO_8859_1_danish.h +16 -0
  79. data/ext/stem_ISO_8859_1_dutch.c +635 -0
  80. data/ext/stem_ISO_8859_1_dutch.h +16 -0
  81. data/ext/stem_ISO_8859_1_english.c +1156 -0
  82. data/ext/stem_ISO_8859_1_english.h +16 -0
  83. data/ext/stem_ISO_8859_1_finnish.c +792 -0
  84. data/ext/stem_ISO_8859_1_finnish.h +16 -0
  85. data/ext/stem_ISO_8859_1_french.c +1276 -0
  86. data/ext/stem_ISO_8859_1_french.h +16 -0
  87. data/ext/stem_ISO_8859_1_german.c +512 -0
  88. data/ext/stem_ISO_8859_1_german.h +16 -0
  89. data/ext/stem_ISO_8859_1_italian.c +1091 -0
  90. data/ext/stem_ISO_8859_1_italian.h +16 -0
  91. data/ext/stem_ISO_8859_1_norwegian.c +296 -0
  92. data/ext/stem_ISO_8859_1_norwegian.h +16 -0
  93. data/ext/stem_ISO_8859_1_porter.c +776 -0
  94. data/ext/stem_ISO_8859_1_porter.h +16 -0
  95. data/ext/stem_ISO_8859_1_portuguese.c +1035 -0
  96. data/ext/stem_ISO_8859_1_portuguese.h +16 -0
  97. data/ext/stem_ISO_8859_1_spanish.c +1119 -0
  98. data/ext/stem_ISO_8859_1_spanish.h +16 -0
  99. data/ext/stem_ISO_8859_1_swedish.c +307 -0
  100. data/ext/stem_ISO_8859_1_swedish.h +16 -0
  101. data/ext/stem_KOI8_R_russian.c +701 -0
  102. data/ext/stem_KOI8_R_russian.h +16 -0
  103. data/ext/stem_UTF_8_danish.c +344 -0
  104. data/ext/stem_UTF_8_danish.h +16 -0
  105. data/ext/stem_UTF_8_dutch.c +653 -0
  106. data/ext/stem_UTF_8_dutch.h +16 -0
  107. data/ext/stem_UTF_8_english.c +1176 -0
  108. data/ext/stem_UTF_8_english.h +16 -0
  109. data/ext/stem_UTF_8_finnish.c +808 -0
  110. data/ext/stem_UTF_8_finnish.h +16 -0
  111. data/ext/stem_UTF_8_french.c +1296 -0
  112. data/ext/stem_UTF_8_french.h +16 -0
  113. data/ext/stem_UTF_8_german.c +526 -0
  114. data/ext/stem_UTF_8_german.h +16 -0
  115. data/ext/stem_UTF_8_italian.c +1113 -0
  116. data/ext/stem_UTF_8_italian.h +16 -0
  117. data/ext/stem_UTF_8_norwegian.c +302 -0
  118. data/ext/stem_UTF_8_norwegian.h +16 -0
  119. data/ext/stem_UTF_8_porter.c +794 -0
  120. data/ext/stem_UTF_8_porter.h +16 -0
  121. data/ext/stem_UTF_8_portuguese.c +1055 -0
  122. data/ext/stem_UTF_8_portuguese.h +16 -0
  123. data/ext/stem_UTF_8_russian.c +709 -0
  124. data/ext/stem_UTF_8_russian.h +16 -0
  125. data/ext/stem_UTF_8_spanish.c +1137 -0
  126. data/ext/stem_UTF_8_spanish.h +16 -0
  127. data/ext/stem_UTF_8_swedish.c +313 -0
  128. data/ext/stem_UTF_8_swedish.h +16 -0
  129. data/ext/stopwords.c +401 -0
  130. data/ext/store.c +692 -0
  131. data/ext/store.h +777 -0
  132. data/ext/term_vectors.c +352 -0
  133. data/ext/threading.h +31 -0
  134. data/ext/utilities.c +446 -0
  135. data/ext/win32.h +54 -0
  136. data/lib/ferret.rb +29 -0
  137. data/lib/ferret/browser.rb +246 -0
  138. data/lib/ferret/browser/s/global.js +192 -0
  139. data/lib/ferret/browser/s/style.css +148 -0
  140. data/lib/ferret/browser/views/document/list.rhtml +49 -0
  141. data/lib/ferret/browser/views/document/show.rhtml +27 -0
  142. data/lib/ferret/browser/views/error/index.rhtml +7 -0
  143. data/lib/ferret/browser/views/help/index.rhtml +8 -0
  144. data/lib/ferret/browser/views/home/index.rhtml +29 -0
  145. data/lib/ferret/browser/views/layout.rhtml +22 -0
  146. data/lib/ferret/browser/views/term-vector/index.rhtml +4 -0
  147. data/lib/ferret/browser/views/term/index.rhtml +199 -0
  148. data/lib/ferret/browser/views/term/termdocs.rhtml +1 -0
  149. data/lib/ferret/browser/webrick.rb +14 -0
  150. data/lib/ferret/document.rb +130 -0
  151. data/lib/ferret/field_infos.rb +44 -0
  152. data/lib/ferret/index.rb +786 -0
  153. data/lib/ferret/number_tools.rb +157 -0
  154. data/lib/ferret_version.rb +3 -0
  155. data/setup.rb +1555 -0
  156. data/test/test_all.rb +5 -0
  157. data/test/test_helper.rb +24 -0
  158. data/test/threading/number_to_spoken.rb +132 -0
  159. data/test/threading/thread_safety_index_test.rb +79 -0
  160. data/test/threading/thread_safety_read_write_test.rb +76 -0
  161. data/test/threading/thread_safety_test.rb +133 -0
  162. data/test/unit/analysis/tc_analyzer.rb +548 -0
  163. data/test/unit/analysis/tc_token_stream.rb +646 -0
  164. data/test/unit/index/tc_index.rb +762 -0
  165. data/test/unit/index/tc_index_reader.rb +699 -0
  166. data/test/unit/index/tc_index_writer.rb +437 -0
  167. data/test/unit/index/th_doc.rb +315 -0
  168. data/test/unit/largefile/tc_largefile.rb +46 -0
  169. data/test/unit/query_parser/tc_query_parser.rb +238 -0
  170. data/test/unit/search/tc_filter.rb +135 -0
  171. data/test/unit/search/tc_fuzzy_query.rb +147 -0
  172. data/test/unit/search/tc_index_searcher.rb +61 -0
  173. data/test/unit/search/tc_multi_searcher.rb +128 -0
  174. data/test/unit/search/tc_multiple_search_requests.rb +58 -0
  175. data/test/unit/search/tc_search_and_sort.rb +179 -0
  176. data/test/unit/search/tc_sort.rb +49 -0
  177. data/test/unit/search/tc_sort_field.rb +27 -0
  178. data/test/unit/search/tc_spans.rb +190 -0
  179. data/test/unit/search/tm_searcher.rb +384 -0
  180. data/test/unit/store/tc_fs_store.rb +77 -0
  181. data/test/unit/store/tc_ram_store.rb +35 -0
  182. data/test/unit/store/tm_store.rb +34 -0
  183. data/test/unit/store/tm_store_lock.rb +68 -0
  184. data/test/unit/tc_document.rb +81 -0
  185. data/test/unit/ts_analysis.rb +2 -0
  186. data/test/unit/ts_index.rb +2 -0
  187. data/test/unit/ts_largefile.rb +4 -0
  188. data/test/unit/ts_query_parser.rb +2 -0
  189. data/test/unit/ts_search.rb +2 -0
  190. data/test/unit/ts_store.rb +2 -0
  191. data/test/unit/ts_utils.rb +2 -0
  192. data/test/unit/utils/tc_bit_vector.rb +295 -0
  193. data/test/unit/utils/tc_number_tools.rb +117 -0
  194. data/test/unit/utils/tc_priority_queue.rb +106 -0
  195. metadata +285 -0
@@ -0,0 +1,16 @@
1
+
2
+ /* This file was generated automatically by the Snowball to ANSI C compiler */
3
+
4
+ #ifdef __cplusplus
5
+ extern "C" {
6
+ #endif
7
+
8
+ extern struct SN_env * italian_UTF_8_create_env(void);
9
+ extern void italian_UTF_8_close_env(struct SN_env * z);
10
+
11
+ extern int italian_UTF_8_stem(struct SN_env * z);
12
+
13
+ #ifdef __cplusplus
14
+ }
15
+ #endif
16
+
@@ -0,0 +1,302 @@
1
+
2
+ /* This file was generated automatically by the Snowball to ANSI C compiler */
3
+
4
+ #include "header.h"
5
+
6
+ extern int norwegian_UTF_8_stem(struct SN_env * z);
7
+ static int r_other_suffix(struct SN_env * z);
8
+ static int r_consonant_pair(struct SN_env * z);
9
+ static int r_main_suffix(struct SN_env * z);
10
+ static int r_mark_regions(struct SN_env * z);
11
+
12
+ extern struct SN_env * norwegian_UTF_8_create_env(void);
13
+ extern void norwegian_UTF_8_close_env(struct SN_env * z);
14
+
15
+ static symbol s_0_0[1] = { 'a' };
16
+ static symbol s_0_1[1] = { 'e' };
17
+ static symbol s_0_2[3] = { 'e', 'd', 'e' };
18
+ static symbol s_0_3[4] = { 'a', 'n', 'd', 'e' };
19
+ static symbol s_0_4[4] = { 'e', 'n', 'd', 'e' };
20
+ static symbol s_0_5[3] = { 'a', 'n', 'e' };
21
+ static symbol s_0_6[3] = { 'e', 'n', 'e' };
22
+ static symbol s_0_7[6] = { 'h', 'e', 't', 'e', 'n', 'e' };
23
+ static symbol s_0_8[4] = { 'e', 'r', 't', 'e' };
24
+ static symbol s_0_9[2] = { 'e', 'n' };
25
+ static symbol s_0_10[5] = { 'h', 'e', 't', 'e', 'n' };
26
+ static symbol s_0_11[2] = { 'a', 'r' };
27
+ static symbol s_0_12[2] = { 'e', 'r' };
28
+ static symbol s_0_13[5] = { 'h', 'e', 't', 'e', 'r' };
29
+ static symbol s_0_14[1] = { 's' };
30
+ static symbol s_0_15[2] = { 'a', 's' };
31
+ static symbol s_0_16[2] = { 'e', 's' };
32
+ static symbol s_0_17[4] = { 'e', 'd', 'e', 's' };
33
+ static symbol s_0_18[5] = { 'e', 'n', 'd', 'e', 's' };
34
+ static symbol s_0_19[4] = { 'e', 'n', 'e', 's' };
35
+ static symbol s_0_20[7] = { 'h', 'e', 't', 'e', 'n', 'e', 's' };
36
+ static symbol s_0_21[3] = { 'e', 'n', 's' };
37
+ static symbol s_0_22[6] = { 'h', 'e', 't', 'e', 'n', 's' };
38
+ static symbol s_0_23[3] = { 'e', 'r', 's' };
39
+ static symbol s_0_24[3] = { 'e', 't', 's' };
40
+ static symbol s_0_25[2] = { 'e', 't' };
41
+ static symbol s_0_26[3] = { 'h', 'e', 't' };
42
+ static symbol s_0_27[3] = { 'e', 'r', 't' };
43
+ static symbol s_0_28[3] = { 'a', 's', 't' };
44
+
45
+ static struct among a_0[29] =
46
+ {
47
+ /* 0 */ { 1, s_0_0, -1, 1, 0},
48
+ /* 1 */ { 1, s_0_1, -1, 1, 0},
49
+ /* 2 */ { 3, s_0_2, 1, 1, 0},
50
+ /* 3 */ { 4, s_0_3, 1, 1, 0},
51
+ /* 4 */ { 4, s_0_4, 1, 1, 0},
52
+ /* 5 */ { 3, s_0_5, 1, 1, 0},
53
+ /* 6 */ { 3, s_0_6, 1, 1, 0},
54
+ /* 7 */ { 6, s_0_7, 6, 1, 0},
55
+ /* 8 */ { 4, s_0_8, 1, 3, 0},
56
+ /* 9 */ { 2, s_0_9, -1, 1, 0},
57
+ /* 10 */ { 5, s_0_10, 9, 1, 0},
58
+ /* 11 */ { 2, s_0_11, -1, 1, 0},
59
+ /* 12 */ { 2, s_0_12, -1, 1, 0},
60
+ /* 13 */ { 5, s_0_13, 12, 1, 0},
61
+ /* 14 */ { 1, s_0_14, -1, 2, 0},
62
+ /* 15 */ { 2, s_0_15, 14, 1, 0},
63
+ /* 16 */ { 2, s_0_16, 14, 1, 0},
64
+ /* 17 */ { 4, s_0_17, 16, 1, 0},
65
+ /* 18 */ { 5, s_0_18, 16, 1, 0},
66
+ /* 19 */ { 4, s_0_19, 16, 1, 0},
67
+ /* 20 */ { 7, s_0_20, 19, 1, 0},
68
+ /* 21 */ { 3, s_0_21, 14, 1, 0},
69
+ /* 22 */ { 6, s_0_22, 21, 1, 0},
70
+ /* 23 */ { 3, s_0_23, 14, 1, 0},
71
+ /* 24 */ { 3, s_0_24, 14, 1, 0},
72
+ /* 25 */ { 2, s_0_25, -1, 1, 0},
73
+ /* 26 */ { 3, s_0_26, 25, 1, 0},
74
+ /* 27 */ { 3, s_0_27, -1, 3, 0},
75
+ /* 28 */ { 3, s_0_28, -1, 1, 0}
76
+ };
77
+
78
+ static symbol s_1_0[2] = { 'd', 't' };
79
+ static symbol s_1_1[2] = { 'v', 't' };
80
+
81
+ static struct among a_1[2] =
82
+ {
83
+ /* 0 */ { 2, s_1_0, -1, -1, 0},
84
+ /* 1 */ { 2, s_1_1, -1, -1, 0}
85
+ };
86
+
87
+ static symbol s_2_0[3] = { 'l', 'e', 'g' };
88
+ static symbol s_2_1[4] = { 'e', 'l', 'e', 'g' };
89
+ static symbol s_2_2[2] = { 'i', 'g' };
90
+ static symbol s_2_3[3] = { 'e', 'i', 'g' };
91
+ static symbol s_2_4[3] = { 'l', 'i', 'g' };
92
+ static symbol s_2_5[4] = { 'e', 'l', 'i', 'g' };
93
+ static symbol s_2_6[3] = { 'e', 'l', 's' };
94
+ static symbol s_2_7[3] = { 'l', 'o', 'v' };
95
+ static symbol s_2_8[4] = { 'e', 'l', 'o', 'v' };
96
+ static symbol s_2_9[4] = { 's', 'l', 'o', 'v' };
97
+ static symbol s_2_10[7] = { 'h', 'e', 't', 's', 'l', 'o', 'v' };
98
+
99
+ static struct among a_2[11] =
100
+ {
101
+ /* 0 */ { 3, s_2_0, -1, 1, 0},
102
+ /* 1 */ { 4, s_2_1, 0, 1, 0},
103
+ /* 2 */ { 2, s_2_2, -1, 1, 0},
104
+ /* 3 */ { 3, s_2_3, 2, 1, 0},
105
+ /* 4 */ { 3, s_2_4, 2, 1, 0},
106
+ /* 5 */ { 4, s_2_5, 4, 1, 0},
107
+ /* 6 */ { 3, s_2_6, -1, 1, 0},
108
+ /* 7 */ { 3, s_2_7, -1, 1, 0},
109
+ /* 8 */ { 4, s_2_8, 7, 1, 0},
110
+ /* 9 */ { 4, s_2_9, 7, 1, 0},
111
+ /* 10 */ { 7, s_2_10, 9, 1, 0}
112
+ };
113
+
114
+ static unsigned char g_v[] = { 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 0, 128 };
115
+
116
+ static unsigned char g_s_ending[] = { 119, 125, 149, 1 };
117
+
118
+ static symbol s_0[] = { 'k' };
119
+ static symbol s_1[] = { 'e', 'r' };
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 30 */
124
+ { int c = skip_utf8(z->p, z->c, 0, z->l, + 3);
125
+ if (c < 0) return 0;
126
+ z->c = c; /* hop, line 30 */
127
+ }
128
+ z->I[1] = z->c; /* setmark x, line 30 */
129
+ z->c = c_test;
130
+ }
131
+ while(1) { /* goto, line 31 */
132
+ int c = z->c;
133
+ if (!(in_grouping_U(z, g_v, 97, 248))) goto lab0;
134
+ z->c = c;
135
+ break;
136
+ lab0:
137
+ z->c = c;
138
+ { int c = skip_utf8(z->p, z->c, 0, z->l, 1);
139
+ if (c < 0) return 0;
140
+ z->c = c; /* goto, line 31 */
141
+ }
142
+ }
143
+ while(1) { /* gopast, line 31 */
144
+ if (!(out_grouping_U(z, g_v, 97, 248))) goto lab1;
145
+ break;
146
+ lab1:
147
+ { int c = skip_utf8(z->p, z->c, 0, z->l, 1);
148
+ if (c < 0) return 0;
149
+ z->c = c; /* gopast, line 31 */
150
+ }
151
+ }
152
+ z->I[0] = z->c; /* setmark p1, line 31 */
153
+ /* try, line 32 */
154
+ if (!(z->I[0] < z->I[1])) goto lab2;
155
+ z->I[0] = z->I[1];
156
+ lab2:
157
+ return 1;
158
+ }
159
+
160
+ static int r_main_suffix(struct SN_env * z) {
161
+ int among_var;
162
+ { int m3; /* setlimit, line 38 */
163
+ int m = z->l - z->c; (void) m;
164
+ if (z->c < z->I[0]) return 0;
165
+ z->c = z->I[0]; /* tomark, line 38 */
166
+ m3 = z->lb; z->lb = z->c;
167
+ z->c = z->l - m;
168
+ z->ket = z->c; /* [, line 38 */
169
+ among_var = find_among_b(z, a_0, 29); /* substring, line 38 */
170
+ if (!(among_var)) { z->lb = m3; return 0; }
171
+ z->bra = z->c; /* ], line 38 */
172
+ z->lb = m3;
173
+ }
174
+ switch(among_var) {
175
+ case 0: return 0;
176
+ case 1:
177
+ { int ret;
178
+ ret = slice_del(z); /* delete, line 44 */
179
+ if (ret < 0) return ret;
180
+ }
181
+ break;
182
+ case 2:
183
+ { int m = z->l - z->c; (void) m; /* or, line 46 */
184
+ if (!(in_grouping_b_U(z, g_s_ending, 98, 122))) goto lab1;
185
+ goto lab0;
186
+ lab1:
187
+ z->c = z->l - m;
188
+ if (!(eq_s_b(z, 1, s_0))) return 0;
189
+ if (!(out_grouping_b_U(z, g_v, 97, 248))) return 0;
190
+ }
191
+ lab0:
192
+ { int ret;
193
+ ret = slice_del(z); /* delete, line 46 */
194
+ if (ret < 0) return ret;
195
+ }
196
+ break;
197
+ case 3:
198
+ { int ret;
199
+ ret = slice_from_s(z, 2, s_1); /* <-, line 48 */
200
+ if (ret < 0) return ret;
201
+ }
202
+ break;
203
+ }
204
+ return 1;
205
+ }
206
+
207
+ static int r_consonant_pair(struct SN_env * z) {
208
+ { int m_test = z->l - z->c; /* test, line 53 */
209
+ { int m3; /* setlimit, line 54 */
210
+ int m = z->l - z->c; (void) m;
211
+ if (z->c < z->I[0]) return 0;
212
+ z->c = z->I[0]; /* tomark, line 54 */
213
+ m3 = z->lb; z->lb = z->c;
214
+ z->c = z->l - m;
215
+ z->ket = z->c; /* [, line 54 */
216
+ if (!(find_among_b(z, a_1, 2))) { z->lb = m3; return 0; } /* substring, line 54 */
217
+ z->bra = z->c; /* ], line 54 */
218
+ z->lb = m3;
219
+ }
220
+ z->c = z->l - m_test;
221
+ }
222
+ { int c = skip_utf8(z->p, z->c, z->lb, 0, -1);
223
+ if (c < 0) return 0;
224
+ z->c = c; /* next, line 59 */
225
+ }
226
+ z->bra = z->c; /* ], line 59 */
227
+ { int ret;
228
+ ret = slice_del(z); /* delete, line 59 */
229
+ if (ret < 0) return ret;
230
+ }
231
+ return 1;
232
+ }
233
+
234
+ static int r_other_suffix(struct SN_env * z) {
235
+ int among_var;
236
+ { int m3; /* setlimit, line 63 */
237
+ int m = z->l - z->c; (void) m;
238
+ if (z->c < z->I[0]) return 0;
239
+ z->c = z->I[0]; /* tomark, line 63 */
240
+ m3 = z->lb; z->lb = z->c;
241
+ z->c = z->l - m;
242
+ z->ket = z->c; /* [, line 63 */
243
+ among_var = find_among_b(z, a_2, 11); /* substring, line 63 */
244
+ if (!(among_var)) { z->lb = m3; return 0; }
245
+ z->bra = z->c; /* ], line 63 */
246
+ z->lb = m3;
247
+ }
248
+ switch(among_var) {
249
+ case 0: return 0;
250
+ case 1:
251
+ { int ret;
252
+ ret = slice_del(z); /* delete, line 67 */
253
+ if (ret < 0) return ret;
254
+ }
255
+ break;
256
+ }
257
+ return 1;
258
+ }
259
+
260
+ extern int norwegian_UTF_8_stem(struct SN_env * z) {
261
+ { int c = z->c; /* do, line 74 */
262
+ { int ret = r_mark_regions(z);
263
+ if (ret == 0) goto lab0; /* call mark_regions, line 74 */
264
+ if (ret < 0) return ret;
265
+ }
266
+ lab0:
267
+ z->c = c;
268
+ }
269
+ z->lb = z->c; z->c = z->l; /* backwards, line 75 */
270
+
271
+ { int m = z->l - z->c; (void) m; /* do, line 76 */
272
+ { int ret = r_main_suffix(z);
273
+ if (ret == 0) goto lab1; /* call main_suffix, line 76 */
274
+ if (ret < 0) return ret;
275
+ }
276
+ lab1:
277
+ z->c = z->l - m;
278
+ }
279
+ { int m = z->l - z->c; (void) m; /* do, line 77 */
280
+ { int ret = r_consonant_pair(z);
281
+ if (ret == 0) goto lab2; /* call consonant_pair, line 77 */
282
+ if (ret < 0) return ret;
283
+ }
284
+ lab2:
285
+ z->c = z->l - m;
286
+ }
287
+ { int m = z->l - z->c; (void) m; /* do, line 78 */
288
+ { int ret = r_other_suffix(z);
289
+ if (ret == 0) goto lab3; /* call other_suffix, line 78 */
290
+ if (ret < 0) return ret;
291
+ }
292
+ lab3:
293
+ z->c = z->l - m;
294
+ }
295
+ z->c = z->lb;
296
+ return 1;
297
+ }
298
+
299
+ extern struct SN_env * norwegian_UTF_8_create_env(void) { return SN_create_env(0, 2, 0); }
300
+
301
+ extern void norwegian_UTF_8_close_env(struct SN_env * z) { SN_close_env(z); }
302
+
@@ -0,0 +1,16 @@
1
+
2
+ /* This file was generated automatically by the Snowball to ANSI C compiler */
3
+
4
+ #ifdef __cplusplus
5
+ extern "C" {
6
+ #endif
7
+
8
+ extern struct SN_env * norwegian_UTF_8_create_env(void);
9
+ extern void norwegian_UTF_8_close_env(struct SN_env * z);
10
+
11
+ extern int norwegian_UTF_8_stem(struct SN_env * z);
12
+
13
+ #ifdef __cplusplus
14
+ }
15
+ #endif
16
+
@@ -0,0 +1,794 @@
1
+
2
+ /* This file was generated automatically by the Snowball to ANSI C compiler */
3
+
4
+ #include "header.h"
5
+
6
+ extern int porter_UTF_8_stem(struct SN_env * z);
7
+ static int r_Step_5b(struct SN_env * z);
8
+ static int r_Step_5a(struct SN_env * z);
9
+ static int r_Step_4(struct SN_env * z);
10
+ static int r_Step_3(struct SN_env * z);
11
+ static int r_Step_2(struct SN_env * z);
12
+ static int r_Step_1c(struct SN_env * z);
13
+ static int r_Step_1b(struct SN_env * z);
14
+ static int r_Step_1a(struct SN_env * z);
15
+ static int r_R2(struct SN_env * z);
16
+ static int r_R1(struct SN_env * z);
17
+ static int r_shortv(struct SN_env * z);
18
+
19
+ extern struct SN_env * porter_UTF_8_create_env(void);
20
+ extern void porter_UTF_8_close_env(struct SN_env * z);
21
+
22
+ static symbol s_0_0[1] = { 's' };
23
+ static symbol s_0_1[3] = { 'i', 'e', 's' };
24
+ static symbol s_0_2[4] = { 's', 's', 'e', 's' };
25
+ static symbol s_0_3[2] = { 's', 's' };
26
+
27
+ static struct among a_0[4] =
28
+ {
29
+ /* 0 */ { 1, s_0_0, -1, 3, 0},
30
+ /* 1 */ { 3, s_0_1, 0, 2, 0},
31
+ /* 2 */ { 4, s_0_2, 0, 1, 0},
32
+ /* 3 */ { 2, s_0_3, 0, -1, 0}
33
+ };
34
+
35
+ static symbol s_1_1[2] = { 'b', 'b' };
36
+ static symbol s_1_2[2] = { 'd', 'd' };
37
+ static symbol s_1_3[2] = { 'f', 'f' };
38
+ static symbol s_1_4[2] = { 'g', 'g' };
39
+ static symbol s_1_5[2] = { 'b', 'l' };
40
+ static symbol s_1_6[2] = { 'm', 'm' };
41
+ static symbol s_1_7[2] = { 'n', 'n' };
42
+ static symbol s_1_8[2] = { 'p', 'p' };
43
+ static symbol s_1_9[2] = { 'r', 'r' };
44
+ static symbol s_1_10[2] = { 'a', 't' };
45
+ static symbol s_1_11[2] = { 't', 't' };
46
+ static symbol s_1_12[2] = { 'i', 'z' };
47
+
48
+ static struct among a_1[13] =
49
+ {
50
+ /* 0 */ { 0, 0, -1, 3, 0},
51
+ /* 1 */ { 2, s_1_1, 0, 2, 0},
52
+ /* 2 */ { 2, s_1_2, 0, 2, 0},
53
+ /* 3 */ { 2, s_1_3, 0, 2, 0},
54
+ /* 4 */ { 2, s_1_4, 0, 2, 0},
55
+ /* 5 */ { 2, s_1_5, 0, 1, 0},
56
+ /* 6 */ { 2, s_1_6, 0, 2, 0},
57
+ /* 7 */ { 2, s_1_7, 0, 2, 0},
58
+ /* 8 */ { 2, s_1_8, 0, 2, 0},
59
+ /* 9 */ { 2, s_1_9, 0, 2, 0},
60
+ /* 10 */ { 2, s_1_10, 0, 1, 0},
61
+ /* 11 */ { 2, s_1_11, 0, 2, 0},
62
+ /* 12 */ { 2, s_1_12, 0, 1, 0}
63
+ };
64
+
65
+ static symbol s_2_0[2] = { 'e', 'd' };
66
+ static symbol s_2_1[3] = { 'e', 'e', 'd' };
67
+ static symbol s_2_2[3] = { 'i', 'n', 'g' };
68
+
69
+ static struct among a_2[3] =
70
+ {
71
+ /* 0 */ { 2, s_2_0, -1, 2, 0},
72
+ /* 1 */ { 3, s_2_1, 0, 1, 0},
73
+ /* 2 */ { 3, s_2_2, -1, 2, 0}
74
+ };
75
+
76
+ static symbol s_3_0[4] = { 'a', 'n', 'c', 'i' };
77
+ static symbol s_3_1[4] = { 'e', 'n', 'c', 'i' };
78
+ static symbol s_3_2[4] = { 'a', 'b', 'l', 'i' };
79
+ static symbol s_3_3[3] = { 'e', 'l', 'i' };
80
+ static symbol s_3_4[4] = { 'a', 'l', 'l', 'i' };
81
+ static symbol s_3_5[5] = { 'o', 'u', 's', 'l', 'i' };
82
+ static symbol s_3_6[5] = { 'e', 'n', 't', 'l', 'i' };
83
+ static symbol s_3_7[5] = { 'a', 'l', 'i', 't', 'i' };
84
+ static symbol s_3_8[6] = { 'b', 'i', 'l', 'i', 't', 'i' };
85
+ static symbol s_3_9[5] = { 'i', 'v', 'i', 't', 'i' };
86
+ static symbol s_3_10[6] = { 't', 'i', 'o', 'n', 'a', 'l' };
87
+ static symbol s_3_11[7] = { 'a', 't', 'i', 'o', 'n', 'a', 'l' };
88
+ static symbol s_3_12[5] = { 'a', 'l', 'i', 's', 'm' };
89
+ static symbol s_3_13[5] = { 'a', 't', 'i', 'o', 'n' };
90
+ static symbol s_3_14[7] = { 'i', 'z', 'a', 't', 'i', 'o', 'n' };
91
+ static symbol s_3_15[4] = { 'i', 'z', 'e', 'r' };
92
+ static symbol s_3_16[4] = { 'a', 't', 'o', 'r' };
93
+ static symbol s_3_17[7] = { 'i', 'v', 'e', 'n', 'e', 's', 's' };
94
+ static symbol s_3_18[7] = { 'f', 'u', 'l', 'n', 'e', 's', 's' };
95
+ static symbol s_3_19[7] = { 'o', 'u', 's', 'n', 'e', 's', 's' };
96
+
97
+ static struct among a_3[20] =
98
+ {
99
+ /* 0 */ { 4, s_3_0, -1, 3, 0},
100
+ /* 1 */ { 4, s_3_1, -1, 2, 0},
101
+ /* 2 */ { 4, s_3_2, -1, 4, 0},
102
+ /* 3 */ { 3, s_3_3, -1, 6, 0},
103
+ /* 4 */ { 4, s_3_4, -1, 9, 0},
104
+ /* 5 */ { 5, s_3_5, -1, 12, 0},
105
+ /* 6 */ { 5, s_3_6, -1, 5, 0},
106
+ /* 7 */ { 5, s_3_7, -1, 10, 0},
107
+ /* 8 */ { 6, s_3_8, -1, 14, 0},
108
+ /* 9 */ { 5, s_3_9, -1, 13, 0},
109
+ /* 10 */ { 6, s_3_10, -1, 1, 0},
110
+ /* 11 */ { 7, s_3_11, 10, 8, 0},
111
+ /* 12 */ { 5, s_3_12, -1, 10, 0},
112
+ /* 13 */ { 5, s_3_13, -1, 8, 0},
113
+ /* 14 */ { 7, s_3_14, 13, 7, 0},
114
+ /* 15 */ { 4, s_3_15, -1, 7, 0},
115
+ /* 16 */ { 4, s_3_16, -1, 8, 0},
116
+ /* 17 */ { 7, s_3_17, -1, 13, 0},
117
+ /* 18 */ { 7, s_3_18, -1, 11, 0},
118
+ /* 19 */ { 7, s_3_19, -1, 12, 0}
119
+ };
120
+
121
+ static symbol s_4_0[5] = { 'i', 'c', 'a', 't', 'e' };
122
+ static symbol s_4_1[5] = { 'a', 't', 'i', 'v', 'e' };
123
+ static symbol s_4_2[5] = { 'a', 'l', 'i', 'z', 'e' };
124
+ static symbol s_4_3[5] = { 'i', 'c', 'i', 't', 'i' };
125
+ static symbol s_4_4[4] = { 'i', 'c', 'a', 'l' };
126
+ static symbol s_4_5[3] = { 'f', 'u', 'l' };
127
+ static symbol s_4_6[4] = { 'n', 'e', 's', 's' };
128
+
129
+ static struct among a_4[7] =
130
+ {
131
+ /* 0 */ { 5, s_4_0, -1, 2, 0},
132
+ /* 1 */ { 5, s_4_1, -1, 3, 0},
133
+ /* 2 */ { 5, s_4_2, -1, 1, 0},
134
+ /* 3 */ { 5, s_4_3, -1, 2, 0},
135
+ /* 4 */ { 4, s_4_4, -1, 2, 0},
136
+ /* 5 */ { 3, s_4_5, -1, 3, 0},
137
+ /* 6 */ { 4, s_4_6, -1, 3, 0}
138
+ };
139
+
140
+ static symbol s_5_0[2] = { 'i', 'c' };
141
+ static symbol s_5_1[4] = { 'a', 'n', 'c', 'e' };
142
+ static symbol s_5_2[4] = { 'e', 'n', 'c', 'e' };
143
+ static symbol s_5_3[4] = { 'a', 'b', 'l', 'e' };
144
+ static symbol s_5_4[4] = { 'i', 'b', 'l', 'e' };
145
+ static symbol s_5_5[3] = { 'a', 't', 'e' };
146
+ static symbol s_5_6[3] = { 'i', 'v', 'e' };
147
+ static symbol s_5_7[3] = { 'i', 'z', 'e' };
148
+ static symbol s_5_8[3] = { 'i', 't', 'i' };
149
+ static symbol s_5_9[2] = { 'a', 'l' };
150
+ static symbol s_5_10[3] = { 'i', 's', 'm' };
151
+ static symbol s_5_11[3] = { 'i', 'o', 'n' };
152
+ static symbol s_5_12[2] = { 'e', 'r' };
153
+ static symbol s_5_13[3] = { 'o', 'u', 's' };
154
+ static symbol s_5_14[3] = { 'a', 'n', 't' };
155
+ static symbol s_5_15[3] = { 'e', 'n', 't' };
156
+ static symbol s_5_16[4] = { 'm', 'e', 'n', 't' };
157
+ static symbol s_5_17[5] = { 'e', 'm', 'e', 'n', 't' };
158
+ static symbol s_5_18[2] = { 'o', 'u' };
159
+
160
+ static struct among a_5[19] =
161
+ {
162
+ /* 0 */ { 2, s_5_0, -1, 1, 0},
163
+ /* 1 */ { 4, s_5_1, -1, 1, 0},
164
+ /* 2 */ { 4, s_5_2, -1, 1, 0},
165
+ /* 3 */ { 4, s_5_3, -1, 1, 0},
166
+ /* 4 */ { 4, s_5_4, -1, 1, 0},
167
+ /* 5 */ { 3, s_5_5, -1, 1, 0},
168
+ /* 6 */ { 3, s_5_6, -1, 1, 0},
169
+ /* 7 */ { 3, s_5_7, -1, 1, 0},
170
+ /* 8 */ { 3, s_5_8, -1, 1, 0},
171
+ /* 9 */ { 2, s_5_9, -1, 1, 0},
172
+ /* 10 */ { 3, s_5_10, -1, 1, 0},
173
+ /* 11 */ { 3, s_5_11, -1, 2, 0},
174
+ /* 12 */ { 2, s_5_12, -1, 1, 0},
175
+ /* 13 */ { 3, s_5_13, -1, 1, 0},
176
+ /* 14 */ { 3, s_5_14, -1, 1, 0},
177
+ /* 15 */ { 3, s_5_15, -1, 1, 0},
178
+ /* 16 */ { 4, s_5_16, 15, 1, 0},
179
+ /* 17 */ { 5, s_5_17, 16, 1, 0},
180
+ /* 18 */ { 2, s_5_18, -1, 1, 0}
181
+ };
182
+
183
+ static unsigned char g_v[] = { 17, 65, 16, 1 };
184
+
185
+ static unsigned char g_v_WXY[] = { 1, 17, 65, 208, 1 };
186
+
187
+ static symbol s_0[] = { 's', 's' };
188
+ static symbol s_1[] = { 'i' };
189
+ static symbol s_2[] = { 'e', 'e' };
190
+ static symbol s_3[] = { 'e' };
191
+ static symbol s_4[] = { 'e' };
192
+ static symbol s_5[] = { 'y' };
193
+ static symbol s_6[] = { 'Y' };
194
+ static symbol s_7[] = { 'i' };
195
+ static symbol s_8[] = { 't', 'i', 'o', 'n' };
196
+ static symbol s_9[] = { 'e', 'n', 'c', 'e' };
197
+ static symbol s_10[] = { 'a', 'n', 'c', 'e' };
198
+ static symbol s_11[] = { 'a', 'b', 'l', 'e' };
199
+ static symbol s_12[] = { 'e', 'n', 't' };
200
+ static symbol s_13[] = { 'e' };
201
+ static symbol s_14[] = { 'i', 'z', 'e' };
202
+ static symbol s_15[] = { 'a', 't', 'e' };
203
+ static symbol s_16[] = { 'a', 'l' };
204
+ static symbol s_17[] = { 'a', 'l' };
205
+ static symbol s_18[] = { 'f', 'u', 'l' };
206
+ static symbol s_19[] = { 'o', 'u', 's' };
207
+ static symbol s_20[] = { 'i', 'v', 'e' };
208
+ static symbol s_21[] = { 'b', 'l', 'e' };
209
+ static symbol s_22[] = { 'a', 'l' };
210
+ static symbol s_23[] = { 'i', 'c' };
211
+ static symbol s_24[] = { 's' };
212
+ static symbol s_25[] = { 't' };
213
+ static symbol s_26[] = { 'e' };
214
+ static symbol s_27[] = { 'l' };
215
+ static symbol s_28[] = { 'l' };
216
+ static symbol s_29[] = { 'y' };
217
+ static symbol s_30[] = { 'Y' };
218
+ static symbol s_31[] = { 'y' };
219
+ static symbol s_32[] = { 'Y' };
220
+ static symbol s_33[] = { 'Y' };
221
+ static symbol s_34[] = { 'y' };
222
+
223
+ static int r_shortv(struct SN_env * z) {
224
+ if (!(out_grouping_b_U(z, g_v_WXY, 89, 121))) return 0;
225
+ if (!(in_grouping_b_U(z, g_v, 97, 121))) return 0;
226
+ if (!(out_grouping_b_U(z, g_v, 97, 121))) return 0;
227
+ return 1;
228
+ }
229
+
230
+ static int r_R1(struct SN_env * z) {
231
+ if (!(z->I[0] <= z->c)) return 0;
232
+ return 1;
233
+ }
234
+
235
+ static int r_R2(struct SN_env * z) {
236
+ if (!(z->I[1] <= z->c)) return 0;
237
+ return 1;
238
+ }
239
+
240
+ static int r_Step_1a(struct SN_env * z) {
241
+ int among_var;
242
+ z->ket = z->c; /* [, line 25 */
243
+ among_var = find_among_b(z, a_0, 4); /* substring, line 25 */
244
+ if (!(among_var)) return 0;
245
+ z->bra = z->c; /* ], line 25 */
246
+ switch(among_var) {
247
+ case 0: return 0;
248
+ case 1:
249
+ { int ret;
250
+ ret = slice_from_s(z, 2, s_0); /* <-, line 26 */
251
+ if (ret < 0) return ret;
252
+ }
253
+ break;
254
+ case 2:
255
+ { int ret;
256
+ ret = slice_from_s(z, 1, s_1); /* <-, line 27 */
257
+ if (ret < 0) return ret;
258
+ }
259
+ break;
260
+ case 3:
261
+ { int ret;
262
+ ret = slice_del(z); /* delete, line 29 */
263
+ if (ret < 0) return ret;
264
+ }
265
+ break;
266
+ }
267
+ return 1;
268
+ }
269
+
270
+ static int r_Step_1b(struct SN_env * z) {
271
+ int among_var;
272
+ z->ket = z->c; /* [, line 34 */
273
+ among_var = find_among_b(z, a_2, 3); /* substring, line 34 */
274
+ if (!(among_var)) return 0;
275
+ z->bra = z->c; /* ], line 34 */
276
+ switch(among_var) {
277
+ case 0: return 0;
278
+ case 1:
279
+ { int ret = r_R1(z);
280
+ if (ret == 0) return 0; /* call R1, line 35 */
281
+ if (ret < 0) return ret;
282
+ }
283
+ { int ret;
284
+ ret = slice_from_s(z, 2, s_2); /* <-, line 35 */
285
+ if (ret < 0) return ret;
286
+ }
287
+ break;
288
+ case 2:
289
+ { int m_test = z->l - z->c; /* test, line 38 */
290
+ while(1) { /* gopast, line 38 */
291
+ if (!(in_grouping_b_U(z, g_v, 97, 121))) goto lab0;
292
+ break;
293
+ lab0:
294
+ { int c = skip_utf8(z->p, z->c, z->lb, 0, -1);
295
+ if (c < 0) return 0;
296
+ z->c = c; /* gopast, line 38 */
297
+ }
298
+ }
299
+ z->c = z->l - m_test;
300
+ }
301
+ { int ret;
302
+ ret = slice_del(z); /* delete, line 38 */
303
+ if (ret < 0) return ret;
304
+ }
305
+ { int m_test = z->l - z->c; /* test, line 39 */
306
+ among_var = find_among_b(z, a_1, 13); /* substring, line 39 */
307
+ if (!(among_var)) return 0;
308
+ z->c = z->l - m_test;
309
+ }
310
+ switch(among_var) {
311
+ case 0: return 0;
312
+ case 1:
313
+ { int ret;
314
+ { int c = z->c;
315
+ ret = insert_s(z, z->c, z->c, 1, s_3); /* <+, line 41 */
316
+ z->c = c;
317
+ }
318
+ if (ret < 0) return ret;
319
+ }
320
+ break;
321
+ case 2:
322
+ z->ket = z->c; /* [, line 44 */
323
+ { int c = skip_utf8(z->p, z->c, z->lb, 0, -1);
324
+ if (c < 0) return 0;
325
+ z->c = c; /* next, line 44 */
326
+ }
327
+ z->bra = z->c; /* ], line 44 */
328
+ { int ret;
329
+ ret = slice_del(z); /* delete, line 44 */
330
+ if (ret < 0) return ret;
331
+ }
332
+ break;
333
+ case 3:
334
+ if (z->c != z->I[0]) return 0; /* atmark, line 45 */
335
+ { int m_test = z->l - z->c; /* test, line 45 */
336
+ { int ret = r_shortv(z);
337
+ if (ret == 0) return 0; /* call shortv, line 45 */
338
+ if (ret < 0) return ret;
339
+ }
340
+ z->c = z->l - m_test;
341
+ }
342
+ { int ret;
343
+ { int c = z->c;
344
+ ret = insert_s(z, z->c, z->c, 1, s_4); /* <+, line 45 */
345
+ z->c = c;
346
+ }
347
+ if (ret < 0) return ret;
348
+ }
349
+ break;
350
+ }
351
+ break;
352
+ }
353
+ return 1;
354
+ }
355
+
356
+ static int r_Step_1c(struct SN_env * z) {
357
+ z->ket = z->c; /* [, line 52 */
358
+ { int m = z->l - z->c; (void) m; /* or, line 52 */
359
+ if (!(eq_s_b(z, 1, s_5))) goto lab1;
360
+ goto lab0;
361
+ lab1:
362
+ z->c = z->l - m;
363
+ if (!(eq_s_b(z, 1, s_6))) return 0;
364
+ }
365
+ lab0:
366
+ z->bra = z->c; /* ], line 52 */
367
+ while(1) { /* gopast, line 53 */
368
+ if (!(in_grouping_b_U(z, g_v, 97, 121))) goto lab2;
369
+ break;
370
+ lab2:
371
+ { int c = skip_utf8(z->p, z->c, z->lb, 0, -1);
372
+ if (c < 0) return 0;
373
+ z->c = c; /* gopast, line 53 */
374
+ }
375
+ }
376
+ { int ret;
377
+ ret = slice_from_s(z, 1, s_7); /* <-, line 54 */
378
+ if (ret < 0) return ret;
379
+ }
380
+ return 1;
381
+ }
382
+
383
+ static int r_Step_2(struct SN_env * z) {
384
+ int among_var;
385
+ z->ket = z->c; /* [, line 58 */
386
+ among_var = find_among_b(z, a_3, 20); /* substring, line 58 */
387
+ if (!(among_var)) return 0;
388
+ z->bra = z->c; /* ], line 58 */
389
+ { int ret = r_R1(z);
390
+ if (ret == 0) return 0; /* call R1, line 58 */
391
+ if (ret < 0) return ret;
392
+ }
393
+ switch(among_var) {
394
+ case 0: return 0;
395
+ case 1:
396
+ { int ret;
397
+ ret = slice_from_s(z, 4, s_8); /* <-, line 59 */
398
+ if (ret < 0) return ret;
399
+ }
400
+ break;
401
+ case 2:
402
+ { int ret;
403
+ ret = slice_from_s(z, 4, s_9); /* <-, line 60 */
404
+ if (ret < 0) return ret;
405
+ }
406
+ break;
407
+ case 3:
408
+ { int ret;
409
+ ret = slice_from_s(z, 4, s_10); /* <-, line 61 */
410
+ if (ret < 0) return ret;
411
+ }
412
+ break;
413
+ case 4:
414
+ { int ret;
415
+ ret = slice_from_s(z, 4, s_11); /* <-, line 62 */
416
+ if (ret < 0) return ret;
417
+ }
418
+ break;
419
+ case 5:
420
+ { int ret;
421
+ ret = slice_from_s(z, 3, s_12); /* <-, line 63 */
422
+ if (ret < 0) return ret;
423
+ }
424
+ break;
425
+ case 6:
426
+ { int ret;
427
+ ret = slice_from_s(z, 1, s_13); /* <-, line 64 */
428
+ if (ret < 0) return ret;
429
+ }
430
+ break;
431
+ case 7:
432
+ { int ret;
433
+ ret = slice_from_s(z, 3, s_14); /* <-, line 66 */
434
+ if (ret < 0) return ret;
435
+ }
436
+ break;
437
+ case 8:
438
+ { int ret;
439
+ ret = slice_from_s(z, 3, s_15); /* <-, line 68 */
440
+ if (ret < 0) return ret;
441
+ }
442
+ break;
443
+ case 9:
444
+ { int ret;
445
+ ret = slice_from_s(z, 2, s_16); /* <-, line 69 */
446
+ if (ret < 0) return ret;
447
+ }
448
+ break;
449
+ case 10:
450
+ { int ret;
451
+ ret = slice_from_s(z, 2, s_17); /* <-, line 71 */
452
+ if (ret < 0) return ret;
453
+ }
454
+ break;
455
+ case 11:
456
+ { int ret;
457
+ ret = slice_from_s(z, 3, s_18); /* <-, line 72 */
458
+ if (ret < 0) return ret;
459
+ }
460
+ break;
461
+ case 12:
462
+ { int ret;
463
+ ret = slice_from_s(z, 3, s_19); /* <-, line 74 */
464
+ if (ret < 0) return ret;
465
+ }
466
+ break;
467
+ case 13:
468
+ { int ret;
469
+ ret = slice_from_s(z, 3, s_20); /* <-, line 76 */
470
+ if (ret < 0) return ret;
471
+ }
472
+ break;
473
+ case 14:
474
+ { int ret;
475
+ ret = slice_from_s(z, 3, s_21); /* <-, line 77 */
476
+ if (ret < 0) return ret;
477
+ }
478
+ break;
479
+ }
480
+ return 1;
481
+ }
482
+
483
+ static int r_Step_3(struct SN_env * z) {
484
+ int among_var;
485
+ z->ket = z->c; /* [, line 82 */
486
+ among_var = find_among_b(z, a_4, 7); /* substring, line 82 */
487
+ if (!(among_var)) return 0;
488
+ z->bra = z->c; /* ], line 82 */
489
+ { int ret = r_R1(z);
490
+ if (ret == 0) return 0; /* call R1, line 82 */
491
+ if (ret < 0) return ret;
492
+ }
493
+ switch(among_var) {
494
+ case 0: return 0;
495
+ case 1:
496
+ { int ret;
497
+ ret = slice_from_s(z, 2, s_22); /* <-, line 83 */
498
+ if (ret < 0) return ret;
499
+ }
500
+ break;
501
+ case 2:
502
+ { int ret;
503
+ ret = slice_from_s(z, 2, s_23); /* <-, line 85 */
504
+ if (ret < 0) return ret;
505
+ }
506
+ break;
507
+ case 3:
508
+ { int ret;
509
+ ret = slice_del(z); /* delete, line 87 */
510
+ if (ret < 0) return ret;
511
+ }
512
+ break;
513
+ }
514
+ return 1;
515
+ }
516
+
517
+ static int r_Step_4(struct SN_env * z) {
518
+ int among_var;
519
+ z->ket = z->c; /* [, line 92 */
520
+ among_var = find_among_b(z, a_5, 19); /* substring, line 92 */
521
+ if (!(among_var)) return 0;
522
+ z->bra = z->c; /* ], line 92 */
523
+ { int ret = r_R2(z);
524
+ if (ret == 0) return 0; /* call R2, line 92 */
525
+ if (ret < 0) return ret;
526
+ }
527
+ switch(among_var) {
528
+ case 0: return 0;
529
+ case 1:
530
+ { int ret;
531
+ ret = slice_del(z); /* delete, line 95 */
532
+ if (ret < 0) return ret;
533
+ }
534
+ break;
535
+ case 2:
536
+ { int m = z->l - z->c; (void) m; /* or, line 96 */
537
+ if (!(eq_s_b(z, 1, s_24))) goto lab1;
538
+ goto lab0;
539
+ lab1:
540
+ z->c = z->l - m;
541
+ if (!(eq_s_b(z, 1, s_25))) return 0;
542
+ }
543
+ lab0:
544
+ { int ret;
545
+ ret = slice_del(z); /* delete, line 96 */
546
+ if (ret < 0) return ret;
547
+ }
548
+ break;
549
+ }
550
+ return 1;
551
+ }
552
+
553
+ static int r_Step_5a(struct SN_env * z) {
554
+ z->ket = z->c; /* [, line 101 */
555
+ if (!(eq_s_b(z, 1, s_26))) return 0;
556
+ z->bra = z->c; /* ], line 101 */
557
+ { int m = z->l - z->c; (void) m; /* or, line 102 */
558
+ { int ret = r_R2(z);
559
+ if (ret == 0) goto lab1; /* call R2, line 102 */
560
+ if (ret < 0) return ret;
561
+ }
562
+ goto lab0;
563
+ lab1:
564
+ z->c = z->l - m;
565
+ { int ret = r_R1(z);
566
+ if (ret == 0) return 0; /* call R1, line 102 */
567
+ if (ret < 0) return ret;
568
+ }
569
+ { int m = z->l - z->c; (void) m; /* not, line 102 */
570
+ { int ret = r_shortv(z);
571
+ if (ret == 0) goto lab2; /* call shortv, line 102 */
572
+ if (ret < 0) return ret;
573
+ }
574
+ return 0;
575
+ lab2:
576
+ z->c = z->l - m;
577
+ }
578
+ }
579
+ lab0:
580
+ { int ret;
581
+ ret = slice_del(z); /* delete, line 103 */
582
+ if (ret < 0) return ret;
583
+ }
584
+ return 1;
585
+ }
586
+
587
+ static int r_Step_5b(struct SN_env * z) {
588
+ z->ket = z->c; /* [, line 107 */
589
+ if (!(eq_s_b(z, 1, s_27))) return 0;
590
+ z->bra = z->c; /* ], line 107 */
591
+ { int ret = r_R2(z);
592
+ if (ret == 0) return 0; /* call R2, line 108 */
593
+ if (ret < 0) return ret;
594
+ }
595
+ if (!(eq_s_b(z, 1, s_28))) return 0;
596
+ { int ret;
597
+ ret = slice_del(z); /* delete, line 109 */
598
+ if (ret < 0) return ret;
599
+ }
600
+ return 1;
601
+ }
602
+
603
+ extern int porter_UTF_8_stem(struct SN_env * z) {
604
+ z->B[0] = 0; /* unset Y_found, line 115 */
605
+ { int c = z->c; /* do, line 116 */
606
+ z->bra = z->c; /* [, line 116 */
607
+ if (!(eq_s(z, 1, s_29))) goto lab0;
608
+ z->ket = z->c; /* ], line 116 */
609
+ { int ret;
610
+ ret = slice_from_s(z, 1, s_30); /* <-, line 116 */
611
+ if (ret < 0) return ret;
612
+ }
613
+ z->B[0] = 1; /* set Y_found, line 116 */
614
+ lab0:
615
+ z->c = c;
616
+ }
617
+ { int c = z->c; /* do, line 117 */
618
+ while(1) { /* repeat, line 117 */
619
+ int c = z->c;
620
+ while(1) { /* goto, line 117 */
621
+ int c = z->c;
622
+ if (!(in_grouping_U(z, g_v, 97, 121))) goto lab3;
623
+ z->bra = z->c; /* [, line 117 */
624
+ if (!(eq_s(z, 1, s_31))) goto lab3;
625
+ z->ket = z->c; /* ], line 117 */
626
+ z->c = c;
627
+ break;
628
+ lab3:
629
+ z->c = c;
630
+ { int c = skip_utf8(z->p, z->c, 0, z->l, 1);
631
+ if (c < 0) goto lab2;
632
+ z->c = c; /* goto, line 117 */
633
+ }
634
+ }
635
+ { int ret;
636
+ ret = slice_from_s(z, 1, s_32); /* <-, line 117 */
637
+ if (ret < 0) return ret;
638
+ }
639
+ z->B[0] = 1; /* set Y_found, line 117 */
640
+ continue;
641
+ lab2:
642
+ z->c = c;
643
+ break;
644
+ }
645
+ z->c = c;
646
+ }
647
+ z->I[0] = z->l;
648
+ z->I[1] = z->l;
649
+ { int c = z->c; /* do, line 121 */
650
+ while(1) { /* gopast, line 122 */
651
+ if (!(in_grouping_U(z, g_v, 97, 121))) goto lab5;
652
+ break;
653
+ lab5:
654
+ { int c = skip_utf8(z->p, z->c, 0, z->l, 1);
655
+ if (c < 0) goto lab4;
656
+ z->c = c; /* gopast, line 122 */
657
+ }
658
+ }
659
+ while(1) { /* gopast, line 122 */
660
+ if (!(out_grouping_U(z, g_v, 97, 121))) goto lab6;
661
+ break;
662
+ lab6:
663
+ { int c = skip_utf8(z->p, z->c, 0, z->l, 1);
664
+ if (c < 0) goto lab4;
665
+ z->c = c; /* gopast, line 122 */
666
+ }
667
+ }
668
+ z->I[0] = z->c; /* setmark p1, line 122 */
669
+ while(1) { /* gopast, line 123 */
670
+ if (!(in_grouping_U(z, g_v, 97, 121))) goto lab7;
671
+ break;
672
+ lab7:
673
+ { int c = skip_utf8(z->p, z->c, 0, z->l, 1);
674
+ if (c < 0) goto lab4;
675
+ z->c = c; /* gopast, line 123 */
676
+ }
677
+ }
678
+ while(1) { /* gopast, line 123 */
679
+ if (!(out_grouping_U(z, g_v, 97, 121))) goto lab8;
680
+ break;
681
+ lab8:
682
+ { int c = skip_utf8(z->p, z->c, 0, z->l, 1);
683
+ if (c < 0) goto lab4;
684
+ z->c = c; /* gopast, line 123 */
685
+ }
686
+ }
687
+ z->I[1] = z->c; /* setmark p2, line 123 */
688
+ lab4:
689
+ z->c = c;
690
+ }
691
+ z->lb = z->c; z->c = z->l; /* backwards, line 126 */
692
+
693
+ { int m = z->l - z->c; (void) m; /* do, line 127 */
694
+ { int ret = r_Step_1a(z);
695
+ if (ret == 0) goto lab9; /* call Step_1a, line 127 */
696
+ if (ret < 0) return ret;
697
+ }
698
+ lab9:
699
+ z->c = z->l - m;
700
+ }
701
+ { int m = z->l - z->c; (void) m; /* do, line 128 */
702
+ { int ret = r_Step_1b(z);
703
+ if (ret == 0) goto lab10; /* call Step_1b, line 128 */
704
+ if (ret < 0) return ret;
705
+ }
706
+ lab10:
707
+ z->c = z->l - m;
708
+ }
709
+ { int m = z->l - z->c; (void) m; /* do, line 129 */
710
+ { int ret = r_Step_1c(z);
711
+ if (ret == 0) goto lab11; /* call Step_1c, line 129 */
712
+ if (ret < 0) return ret;
713
+ }
714
+ lab11:
715
+ z->c = z->l - m;
716
+ }
717
+ { int m = z->l - z->c; (void) m; /* do, line 130 */
718
+ { int ret = r_Step_2(z);
719
+ if (ret == 0) goto lab12; /* call Step_2, line 130 */
720
+ if (ret < 0) return ret;
721
+ }
722
+ lab12:
723
+ z->c = z->l - m;
724
+ }
725
+ { int m = z->l - z->c; (void) m; /* do, line 131 */
726
+ { int ret = r_Step_3(z);
727
+ if (ret == 0) goto lab13; /* call Step_3, line 131 */
728
+ if (ret < 0) return ret;
729
+ }
730
+ lab13:
731
+ z->c = z->l - m;
732
+ }
733
+ { int m = z->l - z->c; (void) m; /* do, line 132 */
734
+ { int ret = r_Step_4(z);
735
+ if (ret == 0) goto lab14; /* call Step_4, line 132 */
736
+ if (ret < 0) return ret;
737
+ }
738
+ lab14:
739
+ z->c = z->l - m;
740
+ }
741
+ { int m = z->l - z->c; (void) m; /* do, line 133 */
742
+ { int ret = r_Step_5a(z);
743
+ if (ret == 0) goto lab15; /* call Step_5a, line 133 */
744
+ if (ret < 0) return ret;
745
+ }
746
+ lab15:
747
+ z->c = z->l - m;
748
+ }
749
+ { int m = z->l - z->c; (void) m; /* do, line 134 */
750
+ { int ret = r_Step_5b(z);
751
+ if (ret == 0) goto lab16; /* call Step_5b, line 134 */
752
+ if (ret < 0) return ret;
753
+ }
754
+ lab16:
755
+ z->c = z->l - m;
756
+ }
757
+ z->c = z->lb;
758
+ { int c = z->c; /* do, line 137 */
759
+ if (!(z->B[0])) goto lab17; /* Boolean test Y_found, line 137 */
760
+ while(1) { /* repeat, line 137 */
761
+ int c = z->c;
762
+ while(1) { /* goto, line 137 */
763
+ int c = z->c;
764
+ z->bra = z->c; /* [, line 137 */
765
+ if (!(eq_s(z, 1, s_33))) goto lab19;
766
+ z->ket = z->c; /* ], line 137 */
767
+ z->c = c;
768
+ break;
769
+ lab19:
770
+ z->c = c;
771
+ { int c = skip_utf8(z->p, z->c, 0, z->l, 1);
772
+ if (c < 0) goto lab18;
773
+ z->c = c; /* goto, line 137 */
774
+ }
775
+ }
776
+ { int ret;
777
+ ret = slice_from_s(z, 1, s_34); /* <-, line 137 */
778
+ if (ret < 0) return ret;
779
+ }
780
+ continue;
781
+ lab18:
782
+ z->c = c;
783
+ break;
784
+ }
785
+ lab17:
786
+ z->c = c;
787
+ }
788
+ return 1;
789
+ }
790
+
791
+ extern struct SN_env * porter_UTF_8_create_env(void) { return SN_create_env(0, 2, 1); }
792
+
793
+ extern void porter_UTF_8_close_env(struct SN_env * z) { SN_close_env(z); }
794
+