Debian Codegraph @

lib/token_cursor.c

raw symbols SCIP
1 /*
2 Copyright (C) 2009-2018 Brazil
3 Copyright (C) 2018-2024 Sutou Kouhei <[email protected]>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20 #include "grn_token.h"cxx . . $ `<file>/lib/grn_token.h`/
21 #include "grn_token_cursor.h"cxx . . $ `<file>/lib/grn_token_cursor.h`/
22
23 #include "grn_dat.h"cxx . . $ `<file>/lib/grn_dat.h`/
24 #include "grn_obj.h"cxx . . $ `<file>/lib/grn_obj.h`/
25 #include "grn_pat.h"cxx . . $ `<file>/lib/grn_pat.h`/
26 #include "grn_string.h"cxx . . $ `<file>/lib/grn_string.h`/
27 #include "grn_table.h"cxx . . $ `<file>/lib/grn_table.h`/
28
29 static void
30 grn_token_cursor_open_initialize_token_filterscxx . . $ grn_token_cursor_open_initialize_token_filters(f3f958a45ad21d6).(grn_ctxcxx . . $ grn_ctx# *ctx,
31 grn_token_cursorcxx . . $ grn_token_cursor# *token_cursor)
32 {
33 grn_objcxx . . $ grn_obj# *token_filters = token_cursor->token_filtercxx . . $ _grn_token_cursor#token_filter..objectscxx . . $ _grn_token_cursor#$anonymous_type_1#objects.;
34 grn_tokenizer_querycxx . . $ grn_tokenizer_query# *query = &(token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..querycxx . . $ _grn_token_cursor#$anonymous_type_0#query.);
35
36 token_cursor->token_filtercxx . . $ _grn_token_cursor#token_filter..datacxx . . $ _grn_token_cursor#$anonymous_type_1#data. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
37
38 size_t n_token_filters;
39 if (token_filters) {
40 n_token_filters = GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(token_filters) / sizeof(grn_objcxx . . $ grn_obj# *);
41 } else {
42 n_token_filters = 0;
43 }
44
45 if (n_token_filters == 0) {
46 return;
47 }
48
49 token_cursor->token_filtercxx . . $ _grn_token_cursor#token_filter..datacxx . . $ _grn_token_cursor#$anonymous_type_1#data. =
50 GRN_CALLOCcxx . . $ `lib/grn_alloc.h:42:9`!(sizeof(void *) * n_token_filters);
51 if (!token_cursor->token_filtercxx . . $ _grn_token_cursor#token_filter..datacxx . . $ _grn_token_cursor#$anonymous_type_1#data.) {
52 return;
53 }
54
55 size_t i;
56 for (i = 0; i < n_token_filters; i++) {
57 grn_objcxx . . $ grn_obj# *token_filter_object = GRN_PTR_VALUE_ATcxx . . $ `include/groonga/groonga.h:3150:9`!(token_filters, i);
58 grn_proccxx . . $ grn_proc# *token_filter = (grn_proccxx . . $ grn_proc# *)token_filter_object;
59
60 if (token_filter->callbackscxx . . $ _grn_proc#callbacks..token_filtercxx . . $ _grn_proc#$anonymous_type_5#token_filter..init_querycxx . . $ _grn_proc#$anonymous_type_5#$anonymous_type_9#init_query.) {
61 grn_tokenizer_query_set_token_filter_indexcxx . . $ grn_tokenizer_query_set_token_filter_index(a914390917774d18).(ctx, query, (unsigned int)i);
62 token_cursor->token_filtercxx . . $ _grn_token_cursor#token_filter..datacxx . . $ _grn_token_cursor#$anonymous_type_1#data.[i] =
63 token_filter->callbackscxx . . $ _grn_proc#callbacks..token_filtercxx . . $ _grn_proc#$anonymous_type_5#token_filter..init_querycxx . . $ _grn_proc#$anonymous_type_5#$anonymous_type_9#init_query.(ctx, query);
64 } else {
65 token_cursor->token_filtercxx . . $ _grn_token_cursor#token_filter..datacxx . . $ _grn_token_cursor#$anonymous_type_1#data.[i] =
66 token_filter->callbackscxx . . $ _grn_proc#callbacks..token_filtercxx . . $ _grn_proc#$anonymous_type_5#token_filter..initcxx . . $ _grn_proc#$anonymous_type_5#$anonymous_type_9#init.(ctx,
67 token_cursor->tablecxx . . $ _grn_token_cursor#table.,
68 token_cursor->modecxx . . $ _grn_token_cursor#mode.);
69 }
70 if (ctx->rccxx . . $ _grn_ctx#rc. != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
71 return;
72 }
73 }
74 }
75
76 grn_token_cursorcxx . . $ grn_token_cursor# *
77 grn_token_cursor_opencxx . . $ grn_token_cursor_open(b521006a1987c493).(grn_ctxcxx . . $ grn_ctx# *ctx,
78 grn_objcxx . . $ grn_obj# *table,
79 const char *str,
80 size_t str_len,
81 grn_tokenize_modecxx . . $ grn_tokenize_mode# mode,
82 uint32_tcxx . . $ uint32_t# flags)
83 {
84 GRN_API_ENTERcxx . . $ `lib/grn_ctx.h:41:9`!;
85
86 grn_token_cursorcxx . . $ grn_token_cursor# *token_cursor;
87 grn_encodingcxx . . $ grn_encoding# encoding;
88 grn_objcxx . . $ grn_obj# *tokenizer;
89 grn_objcxx . . $ grn_obj# *token_filters;
90 grn_table_flagscxx . . $ grn_table_flags# table_flags;
91 if (grn_table_get_infocxx . . $ grn_table_get_info(a1e4a6d36d3aee7c).(ctx,
92 table,
93 &table_flags,
94 &encoding,
95 &tokenizer,
96 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!,
97 &token_filters)) {
98 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
99 "[token-cursor][open] failed to get table information");
100 GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
101 }
102 if (!(token_cursor = GRN_CALLOCcxx . . $ `lib/grn_alloc.h:42:9`!(sizeof(grn_token_cursor)))) {
103 GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
104 }
105 token_cursor->initializedcxx . . $ _grn_token_cursor#initialized. = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!;
106 token_cursor->tablecxx . . $ _grn_token_cursor#table. = table;
107 token_cursor->modecxx . . $ _grn_token_cursor#mode. = mode;
108 token_cursor->encodingcxx . . $ _grn_token_cursor#encoding. = encoding;
109 token_cursor->flagscxx . . $ _grn_token_cursor#flags. = flags;
110 token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..objectcxx . . $ _grn_token_cursor#$anonymous_type_0#object. = tokenizer;
111 grn_tokenizer_query_initcxx . . $ grn_tokenizer_query_init(e3cdec9fc3a01300).(ctx, &(token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..querycxx . . $ _grn_token_cursor#$anonymous_type_0#query.));
112 grn_tokenizer_query_set_lexiconcxx . . $ grn_tokenizer_query_set_lexicon(55018db8af6c72ee).(ctx, &(token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..querycxx . . $ _grn_token_cursor#$anonymous_type_0#query.), table);
113 grn_tokenizer_query_set_flagscxx . . $ grn_tokenizer_query_set_flags(a914390917774d18).(ctx, &(token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..querycxx . . $ _grn_token_cursor#$anonymous_type_0#query.), flags);
114 grn_tokenizer_query_set_modecxx . . $ grn_tokenizer_query_set_mode(78377f1da5bcc9c).(ctx, &(token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..querycxx . . $ _grn_token_cursor#$anonymous_type_0#query.), mode);
115 token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..query_domaincxx . . $ _grn_token_cursor#$anonymous_type_0#query_domain. = GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
116 GRN_OBJ_INITcxx . . $ `include/groonga/groonga.h:947:9`!(&(token_cursor->tokenizer.casted_query),
117 GRN_BULKcxx . . $ `include/groonga/groonga.h:868:9`!,
118 0,
119 table->header.domain);
120 grn_token_initcxx . . $ grn_token_init(c8f3c42adffbb855).(ctx, &(token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..current_tokencxx . . $ _grn_token_cursor#$anonymous_type_0#current_token.));
121 grn_token_initcxx . . $ grn_token_init(c8f3c42adffbb855).(ctx, &(token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..next_tokencxx . . $ _grn_token_cursor#$anonymous_type_0#next_token.));
122 grn_token_initcxx . . $ grn_token_init(c8f3c42adffbb855).(ctx, &(token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..original_tokencxx . . $ _grn_token_cursor#$anonymous_type_0#original_token.));
123 token_cursor->token_filtercxx . . $ _grn_token_cursor#token_filter..objectscxx . . $ _grn_token_cursor#$anonymous_type_1#objects. = token_filters;
124 token_cursor->token_filtercxx . . $ _grn_token_cursor#token_filter..datacxx . . $ _grn_token_cursor#$anonymous_type_1#data. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
125 GRN_VOID_INITcxx . . $ `include/groonga/groonga.h:2749:9`!(&(token_cursor->original_buffer));
126 token_cursor->origcxx . . $ _grn_token_cursor#orig. = (const unsigned char *)str;
127 token_cursor->orig_blencxx . . $ _grn_token_cursor#orig_blen. = (uint32_tcxx . . $ uint32_t#)str_len;
128 token_cursor->currcxx . . $ _grn_token_cursor#curr. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
129 token_cursor->curr_sizecxx . . $ _grn_token_cursor#curr_size. = 0;
130 token_cursor->poscxx . . $ _grn_token_cursor#pos. = -1;
131 token_cursor->statuscxx . . $ _grn_token_cursor#status. = GRN_TOKEN_CURSOR_DOINGcxx . . $ GRN_TOKEN_CURSOR_DOING.;
132 token_cursor->pendingcxx . . $ _grn_token_cursor#pending..statuscxx . . $ _grn_token_cursor#$anonymous_type_2#status. = GRN_TOKEN_CURSOR_DOINGcxx . . $ GRN_TOKEN_CURSOR_DOING.;
133 token_cursor->pendingcxx . . $ _grn_token_cursor#pending..tokencxx . . $ _grn_token_cursor#$anonymous_type_2#token. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
134 GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(token_cursor);
135 }
136
137 grn_rccxx . . $ grn_rc#
138 grn_token_cursor_set_query_domaincxx . . $ grn_token_cursor_set_query_domain(fe988a01052ed552).(grn_ctxcxx . . $ grn_ctx# *ctx,
139 grn_token_cursorcxx . . $ grn_token_cursor# *token_cursor,
140 grn_idcxx . . $ grn_id# domain)
141 {
142 GRN_API_ENTERcxx . . $ `lib/grn_ctx.h:41:9`!;
143 token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..query_domaincxx . . $ _grn_token_cursor#$anonymous_type_0#query_domain. = domain;
144 GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(ctx->rc);
145 }
146
147 static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`!
148 grn_token_cursor_ensure_initializecxx . . $ grn_token_cursor_ensure_initialize(b1a3feed70774cbb).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_token_cursorcxx . . $ grn_token_cursor# *token_cursor)
149 {
150 if (token_cursor->initializedcxx . . $ _grn_token_cursor#initialized.) {
151 goto exit;
152 }
153
154 token_cursor->initializedcxx . . $ _grn_token_cursor#initialized. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
155
156 grn_tokenizer_querycxx . . $ grn_tokenizer_query# *query = &(token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..querycxx . . $ _grn_token_cursor#$anonymous_type_0#query.);
157 if (token_cursor->orig_blencxx . . $ _grn_token_cursor#orig_blen. == 0) {
158 grn_objcxx . . $ grn_obj# *source_column = grn_tokenizer_query_get_source_columncxx . . $ grn_tokenizer_query_get_source_column(38bcf00b9363bed9).(ctx, query);
159 grn_idcxx . . $ grn_id# source_id = grn_tokenizer_query_get_source_idcxx . . $ grn_tokenizer_query_get_source_id(1d72e78078742bd3).(ctx, query);
160 if (source_column && source_id != GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!) {
161 GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(&(token_cursor->original_buffer));
162 grn_obj_get_valuecxx . . $ grn_obj_get_value(6e06fec66698a6a).(ctx,
163 source_column,
164 source_id,
165 &(token_cursor->original_buffercxx . . $ _grn_token_cursor#original_buffer.));
166 token_cursor->origcxx . . $ _grn_token_cursor#orig. = GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(&(token_cursor->original_buffer));
167 token_cursor->orig_blencxx . . $ _grn_token_cursor#orig_blen. =
168 (uint32_tcxx . . $ uint32_t#)GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(&(token_cursor->original_buffer));
169 }
170 }
171
172 if (token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..objectcxx . . $ _grn_token_cursor#$anonymous_type_0#object.) {
173 grn_proccxx . . $ grn_proc# *tokenizer_proc = (grn_proccxx . . $ grn_proc# *)(token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..objectcxx . . $ _grn_token_cursor#$anonymous_type_0#object.);
174 if (tokenizer_proc->callbackscxx . . $ _grn_proc#callbacks..tokenizercxx . . $ _grn_proc#$anonymous_type_5#tokenizer..initcxx . . $ _grn_proc#$anonymous_type_5#$anonymous_type_8#init.) {
175 grn_idcxx . . $ grn_id# query_domain = token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..query_domaincxx . . $ _grn_token_cursor#$anonymous_type_0#query_domain.;
176 if (query_domain == GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!) {
177 query_domain = GRN_DB_TEXTcxx . . $ GRN_DB_TEXT.;
178 }
179 token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..user_datacxx . . $ _grn_token_cursor#$anonymous_type_0#user_data. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
180 grn_tokenizer_query_set_datacxx . . $ grn_tokenizer_query_set_data(ab27102fd8bdbf9c).(ctx,
181 query,
182 token_cursor->origcxx . . $ _grn_token_cursor#orig.,
183 token_cursor->orig_blencxx . . $ _grn_token_cursor#orig_blen.,
184 query_domain);
185 if (ctx->rccxx . . $ _grn_ctx#rc. != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
186 goto exit;
187 }
188 token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..user_datacxx . . $ _grn_token_cursor#$anonymous_type_0#user_data. =
189 tokenizer_proc->callbackscxx . . $ _grn_proc#callbacks..tokenizercxx . . $ _grn_proc#$anonymous_type_5#tokenizer..initcxx . . $ _grn_proc#$anonymous_type_5#$anonymous_type_8#init.(ctx, query);
190 } else if (tokenizer_proc->funcscxx . . $ _grn_proc#funcs.[PROC_INITcxx . . $ PROC_INIT.]) {
191 grn_objcxx . . $ grn_obj# str_, flags_, mode_;
192 GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&str_, GRN_OBJ_DO_SHALLOW_COPYcxx . . $ `include/groonga/groonga.h:2732:9`!);
193 GRN_TEXT_SET_REFcxx . . $ `include/groonga/groonga.h:2756:9`!(&str_, token_cursor->orig, token_cursor->orig_blen);
194 GRN_UINT32_INITcxx . . $ `include/groonga/groonga.h:2854:9`!(&flags_, 0);
195 GRN_UINT32_SETcxx . . $ `include/groonga/groonga.h:2909:9`!(ctx, &flags_, token_cursor->flags);
196 GRN_UINT32_INITcxx . . $ `include/groonga/groonga.h:2854:9`!(&mode_, 0);
197 GRN_UINT32_SETcxx . . $ `include/groonga/groonga.h:2909:9`!(ctx, &mode_, token_cursor->mode);
198 token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..pctxcxx . . $ _grn_token_cursor#$anonymous_type_0#pctx..callercxx . . $ _grn_proc_ctx#caller. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
199 token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..pctxcxx . . $ _grn_token_cursor#$anonymous_type_0#pctx..user_datacxx . . $ _grn_proc_ctx#user_data..ptrcxx . . $ $anonymous_type_1555d7cc1d218aa4_5#ptr. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
200 token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..pctxcxx . . $ _grn_token_cursor#$anonymous_type_0#pctx..proccxx . . $ _grn_proc_ctx#proc. = tokenizer_proc;
201 token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..pctxcxx . . $ _grn_token_cursor#$anonymous_type_0#pctx..hookscxx . . $ _grn_proc_ctx#hooks. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
202 token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..pctxcxx . . $ _grn_token_cursor#$anonymous_type_0#pctx..currhcxx . . $ _grn_proc_ctx#currh. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
203 token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..pctxcxx . . $ _grn_token_cursor#$anonymous_type_0#pctx..phasecxx . . $ _grn_proc_ctx#phase. = PROC_INITcxx . . $ PROC_INIT.;
204 grn_ctx_pushcxx . . $ grn_ctx_push(4865d068a46d0f83).(ctx, &mode_);
205 grn_ctx_pushcxx . . $ grn_ctx_push(4865d068a46d0f83).(ctx, &str_);
206 grn_ctx_pushcxx . . $ grn_ctx_push(4865d068a46d0f83).(ctx, &flags_);
207 tokenizer_proc->funcscxx . . $ _grn_proc#funcs.[PROC_INITcxx . . $ PROC_INIT.](
208 ctx,
209 1,
210 &(token_cursor->tablecxx . . $ _grn_token_cursor#table.),
211 &(token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..pctxcxx . . $ _grn_token_cursor#$anonymous_type_0#pctx..user_datacxx . . $ _grn_proc_ctx#user_data.));
212 grn_obj_closecxx . . $ grn_obj_close(4865d068a46d0f83).(ctx, &flags_);
213 grn_obj_closecxx . . $ grn_obj_close(4865d068a46d0f83).(ctx, &str_);
214 grn_obj_closecxx . . $ grn_obj_close(4865d068a46d0f83).(ctx, &mode_);
215 }
216 } else {
217 grn_idcxx . . $ grn_id# query_domain = token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..query_domaincxx . . $ _grn_token_cursor#$anonymous_type_0#query_domain.;
218
219 grn_tokenizer_query_set_datacxx . . $ grn_tokenizer_query_set_data(ab27102fd8bdbf9c).(ctx,
220 query,
221 token_cursor->origcxx . . $ _grn_token_cursor#orig.,
222 token_cursor->orig_blencxx . . $ _grn_token_cursor#orig_blen.,
223 query_domain == GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`! ? GRN_DB_TEXTcxx . . $ GRN_DB_TEXT.
224 : query_domain);
225 if (ctx->rccxx . . $ _grn_ctx#rc. != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
226 goto exit;
227 }
228 grn_objcxx . . $ grn_obj# *casted_query = &(token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..casted_querycxx . . $ _grn_token_cursor#$anonymous_type_0#casted_query.);
229 grn_objcxx . . $ grn_obj# *table = token_cursor->tablecxx . . $ _grn_token_cursor#table.;
230 grn_idcxx . . $ grn_id# table_id = casted_query->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain.;
231 if (query_domain == GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`! ||
232 (grn_type_id_is_text_familycxx . . $ grn_type_id_is_text_family(a2a496425acc5b40).(ctx, query_domain) &&
233 grn_type_id_is_text_familycxx . . $ grn_type_id_is_text_family(a2a496425acc5b40).(ctx, casted_query->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain.))) {
234 grn_objcxx . . $ grn_obj# *string;
235 const char *normalized;
236 string = grn_tokenizer_query_get_normalized_stringcxx . . $ grn_tokenizer_query_get_normalized_string(38bcf00b9363bed9).(ctx, query);
237 grn_string_get_normalizedcxx . . $ grn_string_get_normalized(fcb0da4d05783f05).(ctx,
238 string,
239 &normalized,
240 &(token_cursor->curr_sizecxx . . $ _grn_token_cursor#curr_size.),
241 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
242 token_cursor->currcxx . . $ _grn_token_cursor#curr. = (const unsigned char *)normalized;
243 grn_token_set_datacxx . . $ grn_token_set_data(6ab8cb5e36c467ee).(ctx,
244 &(token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..current_tokencxx . . $ _grn_token_cursor#$anonymous_type_0#current_token.),
245 token_cursor->currcxx . . $ _grn_token_cursor#curr.,
246 (int)(token_cursor->curr_sizecxx . . $ _grn_token_cursor#curr_size.));
247 } else {
248 if (query_domain == table_id || query_domain == table->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain.) {
249 token_cursor->currcxx . . $ _grn_token_cursor#curr. = token_cursor->origcxx . . $ _grn_token_cursor#orig.;
250 token_cursor->curr_sizecxx . . $ _grn_token_cursor#curr_size. = token_cursor->orig_blencxx . . $ _grn_token_cursor#orig_blen.;
251 grn_token_set_datacxx . . $ grn_token_set_data(6ab8cb5e36c467ee).(ctx,
252 &(token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..current_tokencxx . . $ _grn_token_cursor#$anonymous_type_0#current_token.),
253 token_cursor->currcxx . . $ _grn_token_cursor#curr.,
254 (int)(token_cursor->curr_sizecxx . . $ _grn_token_cursor#curr_size.));
255 grn_token_set_domaincxx . . $ grn_token_set_domain(ab0ad35a1c0de1a).(ctx,
256 &(token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..current_tokencxx . . $ _grn_token_cursor#$anonymous_type_0#current_token.),
257 query_domain);
258 } else {
259 grn_objcxx . . $ grn_obj# query;
260 GRN_OBJ_INITcxx . . $ `include/groonga/groonga.h:947:9`!(&query, GRN_BULKcxx . . $ `include/groonga/groonga.h:868:9`!, GRN_OBJ_DO_SHALLOW_COPYcxx . . $ `include/groonga/groonga.h:2732:9`!, query_domain);
261 GRN_TEXT_SETcxx . . $ `include/groonga/groonga.h:2761:9`!(ctx, &query, token_cursor->orig, token_cursor->orig_blen);
262 GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(casted_query);
263 grn_rccxx . . $ grn_rc# rc = grn_obj_castcxx . . $ grn_obj_cast(a6fd93da1614eccd).(ctx, &query, casted_query, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!);
264 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &query);
265 if (rc == GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
266 token_cursor->currcxx . . $ _grn_token_cursor#curr. = GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(casted_query);
267 token_cursor->curr_sizecxx . . $ _grn_token_cursor#curr_size. = GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(casted_query);
268 grn_token_set_datacxx . . $ grn_token_set_data(6ab8cb5e36c467ee).(ctx,
269 &(token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..current_tokencxx . . $ _grn_token_cursor#$anonymous_type_0#current_token.),
270 token_cursor->currcxx . . $ _grn_token_cursor#curr.,
271 (int)(token_cursor->curr_sizecxx . . $ _grn_token_cursor#curr_size.));
272 grn_token_set_domaincxx . . $ grn_token_set_domain(ab0ad35a1c0de1a).(
273 ctx,
274 &(token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..current_tokencxx . . $ _grn_token_cursor#$anonymous_type_0#current_token.),
275 token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..casted_querycxx . . $ _grn_token_cursor#$anonymous_type_0#casted_query..headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain.);
276 }
277 }
278 }
279 grn_token_set_statuscxx . . $ grn_token_set_status(ab0ad35a1c0de1a).(ctx,
280 &(token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..current_tokencxx . . $ _grn_token_cursor#$anonymous_type_0#current_token.),
281 GRN_TOKEN_LASTcxx . . $ `include/groonga/token.h:82:9`!);
282 }
283
284 if (ctx->rccxx . . $ _grn_ctx#rc. == GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
285 grn_token_cursor_open_initialize_token_filterscxx . . $ grn_token_cursor_open_initialize_token_filters(f3f958a45ad21d6).(ctx, token_cursor);
286 }
287
288 exit:
289 return ctx->rccxx . . $ _grn_ctx#rc. == GRN_SUCCESScxx . . $ GRN_SUCCESS.;
290 }
291
292 grn_rccxx . . $ grn_rc#
293 grn_token_cursor_set_source_columncxx . . $ grn_token_cursor_set_source_column(307d29261fed8edb).(grn_ctxcxx . . $ grn_ctx# *ctx,
294 grn_token_cursorcxx . . $ grn_token_cursor# *token_cursor,
295 grn_objcxx . . $ grn_obj# *column)
296 {
297 GRN_API_ENTERcxx . . $ `lib/grn_ctx.h:41:9`!;
298 grn_tokenizer_querycxx . . $ grn_tokenizer_query# *query = &(token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..querycxx . . $ _grn_token_cursor#$anonymous_type_0#query.);
299 grn_rccxx . . $ grn_rc# rc = grn_tokenizer_query_set_source_columncxx . . $ grn_tokenizer_query_set_source_column(55018db8af6c72ee).(ctx, query, column);
300 GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(rc);
301 }
302
303 grn_rccxx . . $ grn_rc#
304 grn_token_cursor_set_source_idcxx . . $ grn_token_cursor_set_source_id(fe988a01052ed552).(grn_ctxcxx . . $ grn_ctx# *ctx,
305 grn_token_cursorcxx . . $ grn_token_cursor# *token_cursor,
306 grn_idcxx . . $ grn_id# id)
307 {
308 GRN_API_ENTERcxx . . $ `lib/grn_ctx.h:41:9`!;
309 grn_tokenizer_querycxx . . $ grn_tokenizer_query# *query = &(token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..querycxx . . $ _grn_token_cursor#$anonymous_type_0#query.);
310 grn_rccxx . . $ grn_rc# rc = grn_tokenizer_query_set_source_idcxx . . $ grn_tokenizer_query_set_source_id(a914390917774d18).(ctx, query, id);
311 GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(rc);
312 }
313
314 grn_rccxx . . $ grn_rc#
315 grn_token_cursor_set_index_columncxx . . $ grn_token_cursor_set_index_column(307d29261fed8edb).(grn_ctxcxx . . $ grn_ctx# *ctx,
316 grn_token_cursorcxx . . $ grn_token_cursor# *token_cursor,
317 grn_objcxx . . $ grn_obj# *column)
318 {
319 GRN_API_ENTERcxx . . $ `lib/grn_ctx.h:41:9`!;
320 grn_tokenizer_querycxx . . $ grn_tokenizer_query# *query = &(token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..querycxx . . $ _grn_token_cursor#$anonymous_type_0#query.);
321 grn_rccxx . . $ grn_rc# rc = grn_tokenizer_query_set_index_columncxx . . $ grn_tokenizer_query_set_index_column(55018db8af6c72ee).(ctx, query, column);
322 GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(rc);
323 }
324
325 grn_rccxx . . $ grn_rc#
326 grn_token_cursor_set_query_optionscxx . . $ grn_token_cursor_set_query_options(307d29261fed8edb).(grn_ctxcxx . . $ grn_ctx# *ctx,
327 grn_token_cursorcxx . . $ grn_token_cursor# *token_cursor,
328 grn_objcxx . . $ grn_obj# *query_options)
329 {
330 GRN_API_ENTERcxx . . $ `lib/grn_ctx.h:41:9`!;
331 grn_tokenizer_querycxx . . $ grn_tokenizer_query# *query = &(token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..querycxx . . $ _grn_token_cursor#$anonymous_type_0#query.);
332 grn_rccxx . . $ grn_rc# rc = grn_tokenizer_query_set_optionscxx . . $ grn_tokenizer_query_set_options(55018db8af6c72ee).(ctx, query, query_options);
333 GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(rc);
334 }
335
336 static void
337 grn_token_cursor_next_apply_token_filterscxx . . $ grn_token_cursor_next_apply_token_filters(f3f958a45ad21d6).(grn_ctxcxx . . $ grn_ctx# *ctx,
338 grn_token_cursorcxx . . $ grn_token_cursor# *token_cursor)
339 {
340 grn_objcxx . . $ grn_obj# *token_filters = token_cursor->token_filtercxx . . $ _grn_token_cursor#token_filter..objectscxx . . $ _grn_token_cursor#$anonymous_type_1#objects.;
341 grn_tokencxx . . $ grn_token# *current_token = &(token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..current_tokencxx . . $ _grn_token_cursor#$anonymous_type_0#current_token.);
342 grn_tokencxx . . $ grn_token# *next_token = &(token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..next_tokencxx . . $ _grn_token_cursor#$anonymous_type_0#next_token.);
343 grn_tokencxx . . $ grn_token# *original_token = &(token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..original_tokencxx . . $ _grn_token_cursor#$anonymous_type_0#original_token.);
344 grn_tokenizer_querycxx . . $ grn_tokenizer_query# *query = &(token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..querycxx . . $ _grn_token_cursor#$anonymous_type_0#query.);
345
346 size_t n_token_filters;
347 if (token_filters) {
348 n_token_filters = GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(token_filters) / sizeof(grn_objcxx . . $ grn_obj# *);
349 } else {
350 n_token_filters = 0;
351 }
352
353 if (n_token_filters > 0) {
354 grn_token_copycxx . . $ grn_token_copy(d8752d628fc40805).(ctx, original_token, current_token);
355 grn_token_copycxx . . $ grn_token_copy(d8752d628fc40805).(ctx, next_token, current_token);
356 size_t i;
357 for (i = 0; i < n_token_filters; i++) {
358 grn_objcxx . . $ grn_obj# *token_filter_object = GRN_PTR_VALUE_ATcxx . . $ `include/groonga/groonga.h:3150:9`!(token_filters, i);
359 grn_proccxx . . $ grn_proc# *token_filter = (grn_proccxx . . $ grn_proc# *)token_filter_object;
360 void *data = token_cursor->token_filtercxx . . $ _grn_token_cursor#token_filter..datacxx . . $ _grn_token_cursor#$anonymous_type_1#data.[i];
361
362 grn_tokenizer_query_set_token_filter_indexcxx . . $ grn_tokenizer_query_set_token_filter_index(a914390917774d18).(ctx, query, (unsigned int)i);
363
364 #define SKIP_FLAGScxx . . $ `lib/token_cursor.c:364:9`! (GRN_TOKEN_SKIPcxx . . $ `include/groonga/token.h:106:9`! | GRN_TOKEN_SKIP_WITH_POSITIONcxx . . $ `include/groonga/token.h:112:9`!)
365 if (grn_token_get_statuscxx . . $ grn_token_get_status(e181e4c8cedfccbf).(ctx, current_token) & SKIP_FLAGScxx . . $ `lib/token_cursor.c:364:9`!) {
366 break;
367 }
368 #undef SKIP_FLAGScxx . . $ `lib/token_cursor.c:364:9`!
369
370 token_filter->callbackscxx . . $ _grn_proc#callbacks..token_filtercxx . . $ _grn_proc#$anonymous_type_5#token_filter..filtercxx . . $ _grn_proc#$anonymous_type_5#$anonymous_type_9#filter.(ctx,
371 current_token,
372 next_token,
373 data);
374 grn_token_copycxx . . $ grn_token_copy(d8752d628fc40805).(ctx, current_token, next_token);
375 }
376 }
377
378 {
379 size_t size;
380 token_cursor->currcxx . . $ _grn_token_cursor#curr. = grn_token_get_data_rawcxx . . $ grn_token_get_data_raw(a860c6b46bade933).(ctx, current_token, &size);
381 token_cursor->curr_sizecxx . . $ _grn_token_cursor#curr_size. = (uint32_tcxx . . $ uint32_t#)size;
382 }
383 }
384
385 static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`!
386 grn_token_cursor_next_need_keep_originalcxx . . $ grn_token_cursor_next_need_keep_original(b1a3feed70774cbb).(grn_ctxcxx . . $ grn_ctx# *ctx,
387 grn_token_cursorcxx . . $ grn_token_cursor# *token_cursor)
388 {
389 grn_tokencxx . . $ grn_token# *current_token = &(token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..current_tokencxx . . $ _grn_token_cursor#$anonymous_type_0#current_token.);
390 grn_tokencxx . . $ grn_token# *original_token = &(token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..original_tokencxx . . $ _grn_token_cursor#$anonymous_type_0#original_token.);
391
392 if (!(grn_token_get_statuscxx . . $ grn_token_get_status(e181e4c8cedfccbf).(ctx, current_token) & GRN_TOKEN_KEEP_ORIGINALcxx . . $ `include/groonga/token.h:125:9`!)) {
393 return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!;
394 }
395
396 grn_raw_stringcxx . . $ grn_raw_string# current_data;
397 current_data.valuecxx . . $ $anonymous_type_7f733dd816802915_0#value. =
398 grn_token_get_data_rawcxx . . $ grn_token_get_data_raw(a860c6b46bade933).(ctx, current_token, &(current_data.lengthcxx . . $ $anonymous_type_7f733dd816802915_0#length.));
399 grn_raw_stringcxx . . $ grn_raw_string# original_data;
400 original_data.valuecxx . . $ $anonymous_type_7f733dd816802915_0#value. =
401 grn_token_get_data_rawcxx . . $ grn_token_get_data_raw(a860c6b46bade933).(ctx, original_token, &(original_data.lengthcxx . . $ $anonymous_type_7f733dd816802915_0#length.));
402 return !GRN_RAW_STRING_EQUALcxx . . $ `include/groonga/raw_string.h:53:9`!(current_data, original_data);
403 }
404
405 grn_idcxx . . $ grn_id#
406 grn_token_cursor_nextcxx . . $ grn_token_cursor_next(60c29d5cf5463368).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_token_cursorcxx . . $ grn_token_cursor# *token_cursor)
407 {
408 GRN_API_ENTERcxx . . $ `lib/grn_ctx.h:41:9`!;
409
410 if (!grn_token_cursor_ensure_initializecxx . . $ grn_token_cursor_ensure_initialize(b1a3feed70774cbb).(ctx, token_cursor)) {
411 token_cursor->statuscxx . . $ _grn_token_cursor#status. = GRN_TOKEN_CURSOR_DONEcxx . . $ GRN_TOKEN_CURSOR_DONE.;
412 GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!);
413 }
414
415 grn_idcxx . . $ grn_id# tid = GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
416 grn_objcxx . . $ grn_obj# *table = token_cursor->tablecxx . . $ _grn_token_cursor#table.;
417 grn_objcxx . . $ grn_obj# *tokenizer = token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..objectcxx . . $ _grn_token_cursor#$anonymous_type_0#object.;
418 grn_tokenizer_querycxx . . $ grn_tokenizer_query# *query = &(token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..querycxx . . $ _grn_token_cursor#$anonymous_type_0#query.);
419 grn_tokencxx . . $ grn_token# *current_token = &(token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..current_tokencxx . . $ _grn_token_cursor#$anonymous_type_0#current_token.);
420 void *user_data = token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..user_datacxx . . $ _grn_token_cursor#$anonymous_type_0#user_data.;
421 while (token_cursor->statuscxx . . $ _grn_token_cursor#status. != GRN_TOKEN_CURSOR_DONEcxx . . $ GRN_TOKEN_CURSOR_DONE.) {
422 if (token_cursor->pendingcxx . . $ _grn_token_cursor#pending..tokencxx . . $ _grn_token_cursor#$anonymous_type_2#token.) {
423 token_cursor->statuscxx . . $ _grn_token_cursor#status. = token_cursor->pendingcxx . . $ _grn_token_cursor#pending..statuscxx . . $ _grn_token_cursor#$anonymous_type_2#status.;
424 grn_token_copycxx . . $ grn_token_copy(d8752d628fc40805).(ctx, current_token, token_cursor->pendingcxx . . $ _grn_token_cursor#pending..tokencxx . . $ _grn_token_cursor#$anonymous_type_2#token.);
425 grn_token_remove_statuscxx . . $ grn_token_remove_status(ab0ad35a1c0de1a).(ctx, current_token, GRN_TOKEN_KEEP_ORIGINALcxx . . $ `include/groonga/token.h:125:9`!);
426 size_t size;
427 token_cursor->currcxx . . $ _grn_token_cursor#curr. = grn_token_get_data_rawcxx . . $ grn_token_get_data_raw(a860c6b46bade933).(ctx, current_token, &size);
428 token_cursor->curr_sizecxx . . $ _grn_token_cursor#curr_size. = (uint32_tcxx . . $ uint32_t#)size;
429 token_cursor->pendingcxx . . $ _grn_token_cursor#pending..tokencxx . . $ _grn_token_cursor#$anonymous_type_2#token. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
430 token_cursor->poscxx . . $ _grn_token_cursor#pos.--;
431 } else if (tokenizer) {
432 grn_proccxx . . $ grn_proc# *tokenizer_proc = (grn_proccxx . . $ grn_proc# *)tokenizer;
433 grn_token_resetcxx . . $ grn_token_reset(c8f3c42adffbb855).(ctx, current_token);
434 if (tokenizer_proc->callbackscxx . . $ _grn_proc#callbacks..tokenizercxx . . $ _grn_proc#$anonymous_type_5#tokenizer..nextcxx . . $ _grn_proc#$anonymous_type_5#$anonymous_type_8#next.) {
435 tokenizer_proc->callbackscxx . . $ _grn_proc#callbacks..tokenizercxx . . $ _grn_proc#$anonymous_type_5#tokenizer..nextcxx . . $ _grn_proc#$anonymous_type_5#$anonymous_type_8#next.(ctx,
436 query,
437 current_token,
438 user_data);
439 } else if (tokenizer_proc->funcscxx . . $ _grn_proc#funcs.[PROC_NEXTcxx . . $ PROC_NEXT.]) {
440 grn_objcxx . . $ grn_obj# *data, *status_obj;
441 tokenizer_proc->funcscxx . . $ _grn_proc#funcs.[PROC_NEXTcxx . . $ PROC_NEXT.](
442 ctx,
443 1,
444 &table,
445 &token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..pctxcxx . . $ _grn_token_cursor#$anonymous_type_0#pctx..user_datacxx . . $ _grn_proc_ctx#user_data.);
446 status_obj = grn_ctx_popcxx . . $ grn_ctx_pop(ddec8e3b1327ceae).(ctx);
447 data = grn_ctx_popcxx . . $ grn_ctx_pop(ddec8e3b1327ceae).(ctx);
448 grn_token_set_datacxx . . $ grn_token_set_data(6ab8cb5e36c467ee).(ctx,
449 current_token,
450 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(data),
451 (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(data));
452 grn_token_set_statuscxx . . $ grn_token_set_status(ab0ad35a1c0de1a).(ctx, current_token, GRN_UINT32_VALUEcxx . . $ `include/groonga/groonga.h:3103:9`!(status_obj));
453 }
454 grn_token_cursor_next_apply_token_filterscxx . . $ grn_token_cursor_next_apply_token_filters(f3f958a45ad21d6).(ctx, token_cursor);
455 } else {
456 grn_token_set_statuscxx . . $ grn_token_set_status(ab0ad35a1c0de1a).(ctx, current_token, GRN_TOKEN_LASTcxx . . $ `include/groonga/token.h:82:9`!);
457 grn_token_cursor_next_apply_token_filterscxx . . $ grn_token_cursor_next_apply_token_filters(f3f958a45ad21d6).(ctx, token_cursor);
458 }
459 {
460 grn_token_statuscxx . . $ grn_token_status# status = grn_token_get_statuscxx . . $ grn_token_get_status(e181e4c8cedfccbf).(ctx, current_token);
461 token_cursor->statuscxx . . $ _grn_token_cursor#status. =
462 ((status & GRN_TOKEN_LASTcxx . . $ `include/groonga/token.h:82:9`!) || (token_cursor->modecxx . . $ _grn_token_cursor#mode. == GRN_TOKENIZE_GETcxx . . $ GRN_TOKENIZE_GET. &&
463 (status & GRN_TOKEN_REACH_ENDcxx . . $ `include/groonga/token.h:100:9`!)))
464 ? GRN_TOKEN_CURSOR_DONEcxx . . $ GRN_TOKEN_CURSOR_DONE.
465 : GRN_TOKEN_CURSOR_DOINGcxx . . $ GRN_TOKEN_CURSOR_DOING.;
466 #define SKIP_FLAGScxx . . $ `lib/token_cursor.c:466:9`! (GRN_TOKEN_SKIPcxx . . $ `include/groonga/token.h:106:9`! | GRN_TOKEN_SKIP_WITH_POSITIONcxx . . $ `include/groonga/token.h:112:9`!)
467 if (status & SKIP_FLAGScxx . . $ `lib/token_cursor.c:466:9`!) {
468 if (status & GRN_TOKEN_SKIPcxx . . $ `include/groonga/token.h:106:9`!) {
469 token_cursor->poscxx . . $ _grn_token_cursor#pos.++;
470 }
471 if (token_cursor->statuscxx . . $ _grn_token_cursor#status. == GRN_TOKEN_CURSOR_DONEcxx . . $ GRN_TOKEN_CURSOR_DONE. &&
472 tid == GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!) {
473 token_cursor->statuscxx . . $ _grn_token_cursor#status. = GRN_TOKEN_CURSOR_DONE_SKIPcxx . . $ GRN_TOKEN_CURSOR_DONE_SKIP.;
474 break;
475 } else {
476 continue;
477 }
478 }
479 #undef SKIP_FLAGScxx . . $ `lib/token_cursor.c:466:9`!
480 if (status & GRN_TOKEN_FORCE_PREFIXcxx . . $ `include/groonga/token.h:118:9`!) {
481 grn_token_set_force_prefix_searchcxx . . $ grn_token_set_force_prefix_search(e1c7767f8d607145).(ctx, current_token, truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!);
482 }
483 if (token_cursor->curr_sizecxx . . $ _grn_token_cursor#curr_size. == 0) {
484 continue;
485 }
486 if (token_cursor->curr_sizecxx . . $ _grn_token_cursor#curr_size. > GRN_TABLE_MAX_KEY_SIZEcxx . . $ `include/groonga/table.h:26:9`!) {
487 GRN_LOGcxx . . $ `include/groonga/groonga.h:2493:9`!(ctx,
488 GRN_WARNcxx . . $ `lib/grn_error.h:34:9`!,
489 "[token_next] ignore too long token. "
490 "Token must be less than or equal to %d: <%d>(<%.*s>)",
491 GRN_TABLE_MAX_KEY_SIZEcxx . . $ `include/groonga/table.h:26:9`!,
492 token_cursor->curr_size,
493 token_cursor->curr_size,
494 token_cursor->curr);
495 continue;
496 }
497 if (status & GRN_TOKEN_UNMATUREDcxx . . $ `include/groonga/token.h:94:9`!) {
498 if (status & GRN_TOKEN_OVERLAPcxx . . $ `include/groonga/token.h:88:9`!) {
499 if (token_cursor->modecxx . . $ _grn_token_cursor#mode. == GRN_TOKENIZE_GETcxx . . $ GRN_TOKENIZE_GET.) {
500 token_cursor->poscxx . . $ _grn_token_cursor#pos.++;
501 continue;
502 }
503 } else {
504 if (status & GRN_TOKEN_REACH_ENDcxx . . $ `include/groonga/token.h:100:9`!) {
505 grn_token_set_force_prefix_searchcxx . . $ grn_token_set_force_prefix_search(e1c7767f8d607145).(ctx, current_token, truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!);
506 }
507 }
508 }
509 }
510 if (grn_id_maybe_tablecxx . . $ grn_id_maybe_table(a2a496425acc5b40).(ctx, grn_token_get_domaincxx . . $ grn_token_get_domain(e181e4c8cedfccbf).(ctx, current_token)) &&
511 GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(&(current_token->data)) == sizeof(grn_idcxx . . $ grn_id#)) {
512 tid = GRN_RECORD_VALUEcxx . . $ `include/groonga/groonga.h:3110:9`!(&(current_token->data));
513 } else if (token_cursor->modecxx . . $ _grn_token_cursor#mode. == GRN_TOKENIZE_ADDcxx . . $ GRN_TOKENIZE_ADD.) {
514 switch (table->headercxx . . $ _grn_obj#header..typecxx . . $ _grn_obj_header#type.) {
515 case GRN_TABLE_PAT_KEYcxx . . $ `include/groonga/groonga.h:896:9`!:
516 if (token_cursor->flagscxx . . $ _grn_token_cursor#flags. & GRN_TOKEN_CURSOR_PARALLELcxx . . $ `include/groonga/token_cursor.h:34:9`!) {
517 tid = grn_pat_getcxx . . $ grn_pat_get(fa992a8ddbc8af6f).(ctx,
518 (grn_patcxx . . $ grn_pat# *)table,
519 token_cursor->currcxx . . $ _grn_token_cursor#curr.,
520 token_cursor->curr_sizecxx . . $ _grn_token_cursor#curr_size.,
521 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
522 }
523 if (tid == GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!) {
524 GRN_TABLE_LOCK_BEGINcxx . . $ `lib/grn_table.h:56:9`!(ctx, table)
525 {
526 tid = grn_pat_addcxx . . $ grn_pat_add(73f23071831c7e2a).(ctx,
527 (grn_patcxx . . $ grn_pat# *)table,
528 token_cursor->currcxx . . $ _grn_token_cursor#curr.,
529 token_cursor->curr_sizecxx . . $ _grn_token_cursor#curr_size.,
530 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!,
531 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
532 }
533 GRN_TABLE_LOCK_ENDcxx . . $ `lib/grn_table.h:69:9`!(ctx);
534 }
535 break;
536 case GRN_TABLE_DAT_KEYcxx . . $ `include/groonga/groonga.h:897:9`!:
537 if (token_cursor->flagscxx . . $ _grn_token_cursor#flags. & GRN_TOKEN_CURSOR_PARALLELcxx . . $ `include/groonga/token_cursor.h:34:9`!) {
538 tid = grn_dat_getcxx . . $ grn_dat_get(57fd449a22d316b4).(ctx,
539 (grn_datcxx . . $ grn_dat# *)table,
540 token_cursor->currcxx . . $ _grn_token_cursor#curr.,
541 token_cursor->curr_sizecxx . . $ _grn_token_cursor#curr_size.,
542 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
543 }
544 if (tid == GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!) {
545 GRN_TABLE_LOCK_BEGINcxx . . $ `lib/grn_table.h:56:9`!(ctx, table)
546 {
547 tid = grn_dat_addcxx . . $ grn_dat_add(724fd4b47fe4332e).(ctx,
548 (grn_datcxx . . $ grn_dat# *)table,
549 token_cursor->currcxx . . $ _grn_token_cursor#curr.,
550 token_cursor->curr_sizecxx . . $ _grn_token_cursor#curr_size.,
551 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!,
552 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
553 }
554 GRN_TABLE_LOCK_ENDcxx . . $ `lib/grn_table.h:69:9`!(ctx);
555 }
556 break;
557 case GRN_TABLE_HASH_KEYcxx . . $ `include/groonga/groonga.h:895:9`!:
558 if (token_cursor->flagscxx . . $ _grn_token_cursor#flags. & GRN_TOKEN_CURSOR_PARALLELcxx . . $ `include/groonga/token_cursor.h:34:9`!) {
559 tid = grn_hash_getcxx . . $ grn_hash_get(4e868e5367e71b67).(ctx,
560 (grn_hashcxx . . $ grn_hash# *)table,
561 token_cursor->currcxx . . $ _grn_token_cursor#curr.,
562 token_cursor->curr_sizecxx . . $ _grn_token_cursor#curr_size.,
563 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
564 }
565 GRN_TABLE_LOCK_BEGINcxx . . $ `lib/grn_table.h:56:9`!(ctx, table)
566 {
567 tid = grn_hash_addcxx . . $ grn_hash_add(251a256fc515235e).(ctx,
568 (grn_hashcxx . . $ grn_hash# *)table,
569 token_cursor->currcxx . . $ _grn_token_cursor#curr.,
570 token_cursor->curr_sizecxx . . $ _grn_token_cursor#curr_size.,
571 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!,
572 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
573 }
574 GRN_TABLE_LOCK_ENDcxx . . $ `lib/grn_table.h:69:9`!(ctx);
575 break;
576 case GRN_TABLE_NO_KEYcxx . . $ `include/groonga/groonga.h:898:9`!:
577 if (token_cursor->curr_sizecxx . . $ _grn_token_cursor#curr_size. == sizeof(grn_idcxx . . $ grn_id#)) {
578 tid = *((grn_idcxx . . $ grn_id# *)token_cursor->currcxx . . $ _grn_token_cursor#curr.);
579 } else {
580 tid = GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
581 }
582 break;
583 }
584 } else if (token_cursor->modecxx . . $ _grn_token_cursor#mode. != GRN_TOKENIZE_ONLYcxx . . $ GRN_TOKENIZE_ONLY.) {
585 switch (table->headercxx . . $ _grn_obj#header..typecxx . . $ _grn_obj_header#type.) {
586 case GRN_TABLE_PAT_KEYcxx . . $ `include/groonga/groonga.h:896:9`!:
587 tid = grn_pat_getcxx . . $ grn_pat_get(fa992a8ddbc8af6f).(ctx,
588 (grn_patcxx . . $ grn_pat# *)table,
589 token_cursor->currcxx . . $ _grn_token_cursor#curr.,
590 token_cursor->curr_sizecxx . . $ _grn_token_cursor#curr_size.,
591 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
592 break;
593 case GRN_TABLE_DAT_KEYcxx . . $ `include/groonga/groonga.h:897:9`!:
594 tid = grn_dat_getcxx . . $ grn_dat_get(57fd449a22d316b4).(ctx,
595 (grn_datcxx . . $ grn_dat# *)table,
596 token_cursor->currcxx . . $ _grn_token_cursor#curr.,
597 token_cursor->curr_sizecxx . . $ _grn_token_cursor#curr_size.,
598 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
599 break;
600 case GRN_TABLE_HASH_KEYcxx . . $ `include/groonga/groonga.h:895:9`!:
601 tid = grn_hash_getcxx . . $ grn_hash_get(4e868e5367e71b67).(ctx,
602 (grn_hashcxx . . $ grn_hash# *)table,
603 token_cursor->currcxx . . $ _grn_token_cursor#curr.,
604 token_cursor->curr_sizecxx . . $ _grn_token_cursor#curr_size.,
605 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
606 break;
607 case GRN_TABLE_NO_KEYcxx . . $ `include/groonga/groonga.h:898:9`!:
608 if (token_cursor->curr_sizecxx . . $ _grn_token_cursor#curr_size. == sizeof(grn_idcxx . . $ grn_id#)) {
609 tid = *((grn_idcxx . . $ grn_id# *)token_cursor->currcxx . . $ _grn_token_cursor#curr.);
610 } else {
611 tid = GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
612 }
613 break;
614 }
615 }
616 if (token_cursor->modecxx . . $ _grn_token_cursor#mode. != GRN_TOKENIZE_ONLYcxx . . $ GRN_TOKENIZE_ONLY. && tid == GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`! &&
617 token_cursor->statuscxx . . $ _grn_token_cursor#status. != GRN_TOKEN_CURSOR_DONEcxx . . $ GRN_TOKEN_CURSOR_DONE.) {
618 token_cursor->statuscxx . . $ _grn_token_cursor#status. = GRN_TOKEN_CURSOR_NOT_FOUNDcxx . . $ GRN_TOKEN_CURSOR_NOT_FOUND.;
619 }
620 if (grn_token_cursor_next_need_keep_originalcxx . . $ grn_token_cursor_next_need_keep_original(b1a3feed70774cbb).(ctx, token_cursor)) {
621 token_cursor->pendingcxx . . $ _grn_token_cursor#pending..statuscxx . . $ _grn_token_cursor#$anonymous_type_2#status. = token_cursor->statuscxx . . $ _grn_token_cursor#status.;
622 token_cursor->statuscxx . . $ _grn_token_cursor#status. = GRN_TOKEN_CURSOR_DOINGcxx . . $ GRN_TOKEN_CURSOR_DOING.;
623 token_cursor->pendingcxx . . $ _grn_token_cursor#pending..tokencxx . . $ _grn_token_cursor#$anonymous_type_2#token. = &(token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..original_tokencxx . . $ _grn_token_cursor#$anonymous_type_0#original_token.);
624 }
625 token_cursor->poscxx . . $ _grn_token_cursor#pos.++;
626 grn_token_set_positioncxx . . $ grn_token_set_position(ab0ad35a1c0de1a).(ctx, current_token, (uint32_tcxx . . $ uint32_t#)(token_cursor->poscxx . . $ _grn_token_cursor#pos.));
627 break;
628 }
629 GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(tid);
630 }
631
632 grn_token_cursor_statuscxx . . $ grn_token_cursor_status#
633 grn_token_cursor_get_statuscxx . . $ grn_token_cursor_get_status(4be9deca176a28c7).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_token_cursorcxx . . $ grn_token_cursor# *token_cursor)
634 {
635 GRN_API_ENTERcxx . . $ `lib/grn_ctx.h:41:9`!;
636 if (!token_cursor) {
637 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
638 "[token-cursor][status] token cursor must not NULL");
639 GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(GRN_TOKEN_CURSOR_DONE);
640 }
641 GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(token_cursor->status);
642 }
643
644 static void
645 grn_token_cursor_close_token_filterscxx . . $ grn_token_cursor_close_token_filters(f3f958a45ad21d6).(grn_ctxcxx . . $ grn_ctx# *ctx,
646 grn_token_cursorcxx . . $ grn_token_cursor# *token_cursor)
647 {
648 grn_objcxx . . $ grn_obj# *token_filters = token_cursor->token_filtercxx . . $ _grn_token_cursor#token_filter..objectscxx . . $ _grn_token_cursor#$anonymous_type_1#objects.;
649 grn_tokenizer_querycxx . . $ grn_tokenizer_query# *query = &(token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..querycxx . . $ _grn_token_cursor#$anonymous_type_0#query.);
650
651 if (!token_cursor->token_filtercxx . . $ _grn_token_cursor#token_filter..datacxx . . $ _grn_token_cursor#$anonymous_type_1#data.) {
652 return;
653 }
654
655 size_t n_token_filters;
656 if (token_filters) {
657 n_token_filters = GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(token_filters) / sizeof(grn_objcxx . . $ grn_obj# *);
658 } else {
659 n_token_filters = 0;
660 }
661
662 if (n_token_filters == 0) {
663 return;
664 }
665
666 size_t i;
667 for (i = 0; i < n_token_filters; i++) {
668 grn_objcxx . . $ grn_obj# *token_filter_object = GRN_PTR_VALUE_ATcxx . . $ `include/groonga/groonga.h:3150:9`!(token_filters, i);
669 grn_proccxx . . $ grn_proc# *token_filter = (grn_proccxx . . $ grn_proc# *)token_filter_object;
670 void *data = token_cursor->token_filtercxx . . $ _grn_token_cursor#token_filter..datacxx . . $ _grn_token_cursor#$anonymous_type_1#data.[i];
671
672 grn_tokenizer_query_set_token_filter_indexcxx . . $ grn_tokenizer_query_set_token_filter_index(a914390917774d18).(ctx, query, (unsigned int)i);
673 token_filter->callbackscxx . . $ _grn_proc#callbacks..token_filtercxx . . $ _grn_proc#$anonymous_type_5#token_filter..fincxx . . $ _grn_proc#$anonymous_type_5#$anonymous_type_9#fin.(ctx, data);
674 }
675 GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(token_cursor->token_filter.data);
676 }
677
678 grn_rccxx . . $ grn_rc#
679 grn_token_cursor_closecxx . . $ grn_token_cursor_close(fbd52f00bdc6c9ff).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_token_cursorcxx . . $ grn_token_cursor# *token_cursor)
680 {
681 GRN_API_ENTERcxx . . $ `lib/grn_ctx.h:41:9`!;
682 if (!token_cursor) {
683 GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(GRN_INVALID_ARGUMENT);
684 }
685
686 if (token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..objectcxx . . $ _grn_token_cursor#$anonymous_type_0#object. && token_cursor->initializedcxx . . $ _grn_token_cursor#initialized.) {
687 grn_proccxx . . $ grn_proc# *tokenizer_proc = (grn_proccxx . . $ grn_proc# *)(token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..objectcxx . . $ _grn_token_cursor#$anonymous_type_0#object.);
688 if (tokenizer_proc->callbackscxx . . $ _grn_proc#callbacks..tokenizercxx . . $ _grn_proc#$anonymous_type_5#tokenizer..fincxx . . $ _grn_proc#$anonymous_type_5#$anonymous_type_8#fin.) {
689 void *user_data = token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..user_datacxx . . $ _grn_token_cursor#$anonymous_type_0#user_data.;
690 if (user_data) {
691 tokenizer_proc->callbackscxx . . $ _grn_proc#callbacks..tokenizercxx . . $ _grn_proc#$anonymous_type_5#tokenizer..fincxx . . $ _grn_proc#$anonymous_type_5#$anonymous_type_8#fin.(ctx, user_data);
692 }
693 } else if (tokenizer_proc->funcscxx . . $ _grn_proc#funcs.[PROC_FINcxx . . $ PROC_FIN.]) {
694 tokenizer_proc->funcscxx . . $ _grn_proc#funcs.[PROC_FINcxx . . $ PROC_FIN.](ctx,
695 1,
696 &token_cursor->tablecxx . . $ _grn_token_cursor#table.,
697 &token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..pctxcxx . . $ _grn_token_cursor#$anonymous_type_0#pctx..user_datacxx . . $ _grn_proc_ctx#user_data.);
698 }
699 }
700 grn_token_fincxx . . $ grn_token_fin(c8f3c42adffbb855).(ctx, &(token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..current_tokencxx . . $ _grn_token_cursor#$anonymous_type_0#current_token.));
701 grn_token_fincxx . . $ grn_token_fin(c8f3c42adffbb855).(ctx, &(token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..next_tokencxx . . $ _grn_token_cursor#$anonymous_type_0#next_token.));
702 grn_token_fincxx . . $ grn_token_fin(c8f3c42adffbb855).(ctx, &(token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..original_tokencxx . . $ _grn_token_cursor#$anonymous_type_0#original_token.));
703 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &(token_cursor->tokenizer.casted_query));
704 grn_tokenizer_query_fincxx . . $ grn_tokenizer_query_fin(dbe4aab7d778e9d8).(ctx, &(token_cursor->tokenizercxx . . $ _grn_token_cursor#tokenizer..querycxx . . $ _grn_token_cursor#$anonymous_type_0#query.));
705 grn_token_cursor_close_token_filterscxx . . $ grn_token_cursor_close_token_filters(f3f958a45ad21d6).(ctx, token_cursor);
706 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &(token_cursor->original_buffer));
707 GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(token_cursor);
708 GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(GRN_SUCCESS);
709 }
710
711 grn_tokencxx . . $ grn_token# *
712 grn_token_cursor_get_tokencxx . . $ grn_token_cursor_get_token(42eb6886c4ba0dd1).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_token_cursorcxx . . $ grn_token_cursor# *token_cursor)
713 {
714 GRN_API_ENTERcxx . . $ `lib/grn_ctx.h:41:9`!;
715 GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(&(token_cursor->tokenizer.current_token));
716 }