Debian Codegraph @

lib/expr_executor.cpp

raw symbols SCIP
1 /*
2 Copyright (C) 2010-2018 Brazil
3 Copyright (C) 2020-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.h"cxx . . $ `<file>/lib/grn.h`/
21 #include "grn_bulk.h"cxx . . $ `<file>/lib/grn_bulk.h`/
22 #include "grn_ctx_impl.h"cxx . . $ `<file>/lib/grn_ctx_impl.h`/
23 #include "grn_expr.h"cxx . . $ `<file>/lib/grn_expr.h`/
24 #include "grn_expr_code.h"cxx . . $ `<file>/lib/grn_expr_code.h`/
25 #include "grn_expr_executor.h"cxx . . $ `<file>/lib/grn_expr_executor.h`/
26 #include "grn_geo.h"cxx . . $ `<file>/lib/grn_geo.h`/
27 #include "grn_normalizer.h"cxx . . $ `<file>/lib/grn_normalizer.h`/
28
29 #ifdef GRN_SUPPORT_REGEXPcxx . . $ `lib/grn.h:734:11`!
30 # include "grn_onigmo.h"cxx . . $ `<file>/lib/grn_onigmo.h`/
31 #endif
32
33 #include <groonga.hpp>cxx . . $ `<file>/include/groonga.hpp`/
34
35 static void
36 grn_expr_executor_init_generalcxx . . $ grn_expr_executor_init_general(a11777c3305b25fa).(grn_ctx *ctx, grn_expr_executor *executor)
37 {
38 }
39
40 #define EXPRVPcxx . . $ `lib/expr_executor.cpp:40:9`!(x) ((x)->header.impl_flags & GRN_OBJ_EXPRVALUEcxx . . $ `lib/grn_ctx.h:164:9`!)
41
42 #define GEO_RESOLUTIONcxx . . $ `lib/expr_executor.cpp:42:9`! 3600000
43 #define GEO_RADIOUScxx . . $ `lib/expr_executor.cpp:43:9`! 6357303
44 #define GEO_BES_C1cxx . . $ `lib/expr_executor.cpp:44:9`! 6334834
45 #define GEO_BES_C2cxx . . $ `lib/expr_executor.cpp:45:9`! 6377397
46 #define GEO_BES_C3cxx . . $ `lib/expr_executor.cpp:46:9`! 0.006674
47 #define GEO_GRS_C1cxx . . $ `lib/expr_executor.cpp:47:9`! 6335439
48 #define GEO_GRS_C2cxx . . $ `lib/expr_executor.cpp:48:9`! 6378137
49 #define GEO_GRS_C3cxx . . $ `lib/expr_executor.cpp:49:9`! 0.006694
50
51 #define CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(expression) \
52 do { \
53 if (!(expression)) { \
54 return false; \
55 } \
56 } while (false)
57
58 namespacecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ {
59 struct ExecuteDatacxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData# {
60 grn_expr *ecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#e.;
61 grn_obj **s_cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#s_.;
62 grn_obj *s0cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#s0.;
63 grn_obj *s1cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#s1.;
64 grn_obj **spcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#sp.;
65 grn_obj *vpcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#vp.;
66 grn_obj *rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res.;
67 grn_obj *v0cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#v0.;
68 grn_expr_code *codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.;
69 grn_expr_code *cecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#ce.;
70 };
71
72 template <typename BLOCK>
73 void
74 with_spsavecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/with_spsave(a494dc215517b3b0).(grn_ctx *ctx, ExecuteDatacxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData# &data, BLOCK block)
75 {
76 ctx->implcxx . . $ _grn_ctx#impl.->stack_currcxx . . $ _grn_ctx_impl#stack_curr. = data.spcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#sp. - ctx->implcxx . . $ _grn_ctx#impl.->stackcxx . . $ _grn_ctx_impl#stack.;
77 data.ecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#e.->values_currcxx . . $ _grn_expr#values_curr. = data.vpcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#vp. - data.ecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#e.->valuescxx . . $ _grn_expr#values.;
78 block();
79 data.vpcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#vp. = data.ecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#e.->valuescxx . . $ _grn_expr#values. + data.ecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#e.->values_currcxx . . $ _grn_expr#values_curr.;
80 data.spcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#sp. = ctx->implcxx . . $ _grn_ctx#impl.->stackcxx . . $ _grn_ctx_impl#stack. + ctx->implcxx . . $ _grn_ctx#impl.->stack_currcxx . . $ _grn_ctx_impl#stack_curr.;
81 data.s_cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#s_. = ctx->implcxx . . $ _grn_ctx#impl.->stackcxx . . $ _grn_ctx_impl#stack.;
82 data.s0cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#s0. = (data.spcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#sp. > data.s_cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#s_.) ? data.spcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#sp.[-1] : nullptr;
83 data.s1cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#s1. = (data.spcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#sp. > data.s_cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#s_. + 1) ? data.spcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#sp.[-2] : nullptr;
84 }
85
86 inline void
87 var_set_valuecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/var_set_value(99eba0d3a8372d65).(grn_ctx *ctx, grn_obj *var, grn_obj *value)
88 {
89 if (GRN_DB_OBJPcxx . . $ `lib/grn_db.h:371:9`!(value)) {
90 var->headercxx . . $ _grn_obj#header..type = GRN_PTRcxx . . $ `include/groonga/groonga.h:873:9`!;
91 var->headercxx . . $ _grn_obj#header..domain = DB_OBJcxx . . $ `lib/grn_db.h:62:9`!(value)->id;
92 GRN_PTR_SETcxx . . $ `include/groonga/groonga.h:2945:9`!(ctx, var, value);
93 } else {
94 var->headercxx . . $ _grn_obj#header..type = value->headercxx . . $ _grn_obj#header..type;
95 var->headercxx . . $ _grn_obj#header..domain = value->headercxx . . $ _grn_obj#header..domain;
96 GRN_TEXT_SETcxx . . $ `include/groonga/groonga.h:2761:9`!(ctx, var, GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(value), GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(value));
97 }
98 }
99
100 inline bool
101 push1cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/push1(89e0055e4a8a160a).(grn_ctx *ctx, ExecuteDatacxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData# &data, grn_obj *v)
102 {
103 if (EXPRVPcxx . . $ `lib/expr_executor.cpp:40:9`!(v)) {
104 data.vpcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#vp.++;
105 if (data.vpcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#vp. - data.ecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#e.->valuescxx . . $ _grn_expr#values. > data.ecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#e.->values_tailcxx . . $ _grn_expr#values_tail.) {
106 data.ecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#e.->values_tailcxx . . $ _grn_expr#values_tail. = data.vpcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#vp. - data.ecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#e.->valuescxx . . $ _grn_expr#values.;
107 }
108 }
109 data.s1cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#s1. = data.s0cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#s0.;
110 if (data.spcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#sp. >= data.s_cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#s_. + ctx->implcxx . . $ _grn_ctx#impl.->stack_sizecxx . . $ _grn_ctx_impl#stack_size.) {
111 if (grn_ctx_expand_stack(ctx) != GRN_SUCCESS) {
112 return false;
113 }
114 data.spcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#sp. += (ctx->implcxx . . $ _grn_ctx#impl.->stackcxx . . $ _grn_ctx_impl#stack. - data.s_cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#s_.);
115 data.s_cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#s_. = ctx->implcxx . . $ _grn_ctx#impl.->stackcxx . . $ _grn_ctx_impl#stack.;
116 }
117 *data.spcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#sp. = data.s0cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#s0. = v;
118 data.spcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#sp.++;
119 return true;
120 }
121
122 inline bool
123 pop1cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/pop1(4c96baa6ca90c8f1).(grn_ctx *ctx, ExecuteDatacxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData# &data, grn_obj *&v)
124 {
125 if (EXPRVPcxx . . $ `lib/expr_executor.cpp:40:9`!(data.s0)) {
126 data.vpcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#vp.--;
127 }
128 v = data.s0cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#s0.;
129 data.s0cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#s0. = data.s1cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#s1.;
130 data.spcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#sp.--;
131 if (data.spcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#sp. < data.s_cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#s_.) {
132 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT, "stack underflow");
133 return false;
134 }
135 data.s1cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#s1. = (data.spcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#sp. > data.s_cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#s_. + 1) ? data.spcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#sp.[-2] : nullptr;
136 return true;
137 }
138
139 inline bool
140 alloc1cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/alloc1(4c96baa6ca90c8f1).(grn_ctx *ctx, ExecuteDatacxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData# &data, grn_obj *&value)
141 {
142 data.s1cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#s1. = data.s0cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#s0.;
143 if (data.spcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#sp. >= data.s_cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#s_. + ctx->implcxx . . $ _grn_ctx#impl.->stack_sizecxx . . $ _grn_ctx_impl#stack_size.) {
144 if (grn_ctx_expand_stack(ctx) != GRN_SUCCESS) {
145 return false;
146 }
147 data.spcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#sp. += (ctx->implcxx . . $ _grn_ctx#impl.->stackcxx . . $ _grn_ctx_impl#stack. - data.s_cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#s_.);
148 data.s_cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#s_. = ctx->implcxx . . $ _grn_ctx#impl.->stackcxx . . $ _grn_ctx_impl#stack.;
149 }
150 *(data.spcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#sp.) = data.s0cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#s0. = value = data.vpcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#vp.++;
151 data.spcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#sp.++;
152 if (data.vpcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#vp. - data.ecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#e.->valuescxx . . $ _grn_expr#values. > data.ecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#e.->values_tailcxx . . $ _grn_expr#values_tail.) {
153 data.ecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#e.->values_tailcxx . . $ _grn_expr#values_tail. = data.vpcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#vp. - data.ecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#e.->valuescxx . . $ _grn_expr#values.;
154 }
155 return true;
156 }
157
158 inline bool
159 pop1alloc1cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/pop1alloc1(38f141cb722e6df8).(grn_ctx *ctx, ExecuteDatacxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData# &data, grn_obj *&arg, grn_obj *&value)
160 {
161 arg = data.s0cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#s0.;
162 if (EXPRVPcxx . . $ `lib/expr_executor.cpp:40:9`!(data.s0)) {
163 value = data.s0cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#s0.;
164 } else {
165 if (data.spcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#sp. < data.s_cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#s_. + 1) {
166 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT, "stack underflow");
167 return false;
168 }
169 data.spcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#sp.[-1] = data.s0cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#s0. = value = data.vpcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#vp.++;
170 if (data.vpcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#vp. - data.ecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#e.->valuescxx . . $ _grn_expr#values. > data.ecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#e.->values_tailcxx . . $ _grn_expr#values_tail.) {
171 data.ecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#e.->values_tailcxx . . $ _grn_expr#values_tail. = data.vpcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#vp. - data.ecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#e.->valuescxx . . $ _grn_expr#values.;
172 }
173 data.s0cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#s0.->headercxx . . $ _grn_obj#header..impl_flags |= GRN_OBJ_EXPRVALUEcxx . . $ `lib/grn_ctx.h:164:9`!;
174 }
175 return true;
176 }
177
178 inline bool
179 pop2alloc1cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/pop2alloc1(48c306d89b2ee7e1).(grn_ctx *ctx,
180 ExecuteDatacxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData# &data,
181 grn_obj *&arg1,
182 grn_obj *&arg2,
183 grn_obj *&value)
184 {
185 if (EXPRVPcxx . . $ `lib/expr_executor.cpp:40:9`!(data.s0)) {
186 data.vpcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#vp.--;
187 }
188 if (EXPRVPcxx . . $ `lib/expr_executor.cpp:40:9`!(data.s1)) {
189 data.vpcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#vp.--;
190 }
191 arg2 = data.s0cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#s0.;
192 arg1 = data.s1cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#s1.;
193 data.spcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#sp.--;
194 if (data.spcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#sp. < data.s_cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#s_. + 1) {
195 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT, "stack underflow");
196 return false;
197 }
198 data.s1cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#s1. = (data.spcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#sp. > data.s_cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#s_. + 1) ? data.spcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#sp.[-2] : NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
199 data.spcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#sp.[-1] = data.s0cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#s0. = value = data.vpcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#vp.++;
200 if (data.vpcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#vp. - data.ecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#e.->valuescxx . . $ _grn_expr#values. > data.ecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#e.->values_tailcxx . . $ _grn_expr#values_tail.) {
201 data.ecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#e.->values_tailcxx . . $ _grn_expr#values_tail. = data.vpcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#vp. - data.ecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#e.->valuescxx . . $ _grn_expr#values.;
202 }
203 data.s0cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#s0.->headercxx . . $ _grn_obj#header..impl_flags |= GRN_OBJ_EXPRVALUEcxx . . $ `lib/grn_ctx.h:164:9`!;
204 return true;
205 }
206
207 inline bool
208 text_arithmetic_binary_operationcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/text_arithmetic_binary_operation(925d1aad99ca3036).(
209 grn_ctx *ctx, grn_operator op, grn_obj *x, grn_obj *y, grn_obj *result)
210 {
211 grn_obj casted_value;
212 GRN_INT64_INITcxx . . $ `include/groonga/groonga.h:2856:9`!(&casted_value, 0);
213 grn_obj_cast(ctx, x, &casted_value, false);
214 auto x_int64 = GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(&casted_value) < sizeof(int64_t)
215 ? 0
216 : GRN_INT64_VALUEcxx . . $ `include/groonga/groonga.h:3104:9`!(&casted_value);
217 GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(&casted_value);
218 grn_obj_cast(ctx, y, &casted_value, false);
219 auto y_int64 = GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(&casted_value) < sizeof(int64_t)
220 ? 0
221 : GRN_INT64_VALUEcxx . . $ `include/groonga/groonga.h:3104:9`!(&casted_value);
222 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &casted_value);
223
224 result->headercxx . . $ _grn_obj#header..domain = GRN_DB_INT64;
225 switch (op) {
226 case GRN_OP_BITWISE_OR:
227 GRN_INT64_SETcxx . . $ `include/groonga/groonga.h:2914:9`!(ctx, result, x_int64 | y_int64);
228 return true;
229 case GRN_OP_BITWISE_XOR:
230 GRN_INT64_SETcxx . . $ `include/groonga/groonga.h:2914:9`!(ctx, result, x_int64 ^ y_int64);
231 return true;
232 case GRN_OP_BITWISE_AND:
233 GRN_INT64_SETcxx . . $ `include/groonga/groonga.h:2914:9`!(ctx, result, x_int64 & y_int64);
234 return true;
235 case GRN_OP_SHIFTL:
236 GRN_INT64_SETcxx . . $ `include/groonga/groonga.h:2914:9`!(ctx, result, x_int64 << y_int64);
237 return true;
238 case GRN_OP_SHIFTR:
239 GRN_INT64_SETcxx . . $ `include/groonga/groonga.h:2914:9`!(ctx, result, x_int64 >> y_int64);
240 return true;
241 case GRN_OP_SHIFTRR:
242 GRN_INT64_SETcxx . . $ `include/groonga/groonga.h:2914:9`!(ctx,
243 result,
244 static_cast<uint64_t>(x_int64) >>
245 static_cast<uint64_t>(y_int64));
246 return true;
247 default:
248 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
249 "[expr-executor] \"string\" %s \"string\" isn't supported",
250 grn_operator_to_string(op));
251 return false;
252 }
253 }
254
255 /*
256 * X / -1 as -X.
257 * Since UInt cannot express negative values, it is expressed by changing its
258 * type.
259 *
260 * - uint8_t -> int16_t
261 * - uint16_t -> int32_t
262 * - uint32_t -> int64_t
263 * - uint64_t -> int64_t (When X does not over INT64_MAX + 1)
264 * - uint64_t -> double (When X over INT64_MAX + 1)
265 */
266 template <typename RESULT_TYPE, typename X, typename Y>
267 stdcxx . . $ std/::enable_if_t<
268 !(stdcxx . . $ std/::is_same_v<X, uint8_tcxx . . $ uint8_t#> || stdcxx . . $ std/::is_same_v<X, uint16_tcxx . . $ uint16_t#> ||
269 stdcxx . . $ std/::is_same_v<X, uint32_tcxx . . $ uint32_t#> || stdcxx . . $ std/::is_same_v<X, uint64_tcxx . . $ uint64_t#>) &&
270 stdcxx . . $ std/::is_signed_v<Y> && stdcxx . . $ std/::is_integral_v<Y>,
271 bool>
272 numeric_arithmetic_binary_operation_execute_slashcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_binary_operation_execute_slash(fb145be1926397bb).(grn_ctx *ctx,
273 X x,
274 Y y,
275 grn_obj *result)
276 {
277 if (y == -1) {
278 grncxx . . $ grn/::bulkcxx . . $ grn/bulk/::setcxx . . $ grn/bulk/set(ca8f724eff6ab81).<RESULT_TYPE>(ctx, result, static_cast<RESULT_TYPE>(-x));
279 } else {
280 grncxx . . $ grn/::bulkcxx . . $ grn/bulk/::setcxx . . $ grn/bulk/set(ca8f724eff6ab81).<RESULT_TYPE>(ctx, result, static_cast<RESULT_TYPE>(x / y));
281 }
282 return true;
283 }
284
285 template <typename RESULT_TYPE, typename X, typename Y>
286 stdcxx . . $ std/::enable_if_t<(stdcxx . . $ std/::is_same_v<X, uint8_tcxx . . $ uint8_t#>) && stdcxx . . $ std/::is_signed_v<Y> &&
287 stdcxx . . $ std/::is_integral_v<Y>,
288 bool>
289 numeric_arithmetic_binary_operation_execute_slashcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_binary_operation_execute_slash(1a974115264780e4).(grn_ctx *ctx,
290 X x,
291 Y y,
292 grn_obj *result)
293 {
294 if (y == -1) {
295 grn_obj_reinit(ctx, result, GRN_DB_INT16, 0);
296 grncxx . . $ grn/::bulkcxx . . $ grn/bulk/::setcxx . . $ grn/bulk/set(ca8f724eff6ab81).<int16_t>(ctx, result, -static_cast<int16_t>(x));
297 } else if (y < -1) {
298 grn_obj_reinit(ctx, result, GRN_DB_INT16, 0);
299 grncxx . . $ grn/::bulkcxx . . $ grn/bulk/::setcxx . . $ grn/bulk/set(ca8f724eff6ab81).<int16_t>(ctx, result, static_cast<int16_t>(x) / y);
300 } else {
301 grncxx . . $ grn/::bulkcxx . . $ grn/bulk/::setcxx . . $ grn/bulk/set(ca8f724eff6ab81).<RESULT_TYPE>(ctx, result, static_cast<RESULT_TYPE>(x / y));
302 }
303 return true;
304 }
305
306 template <typename RESULT_TYPE, typename X, typename Y>
307 stdcxx . . $ std/::enable_if_t<(stdcxx . . $ std/::is_same_v<X, uint16_tcxx . . $ uint16_t#>) && stdcxx . . $ std/::is_signed_v<Y> &&
308 stdcxx . . $ std/::is_integral_v<Y>,
309 bool>
310 numeric_arithmetic_binary_operation_execute_slashcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_binary_operation_execute_slash(8f6d72c37a676c37).(grn_ctx *ctx,
311 X x,
312 Y y,
313 grn_obj *result)
314 {
315 if (y == -1) {
316 grn_obj_reinit(ctx, result, GRN_DB_INT32, 0);
317 grncxx . . $ grn/::bulkcxx . . $ grn/bulk/::setcxx . . $ grn/bulk/set(ca8f724eff6ab81).<int32_t>(ctx, result, -static_cast<int32_t>(x));
318 } else if (y < -1) {
319 grn_obj_reinit(ctx, result, GRN_DB_INT32, 0);
320 grncxx . . $ grn/::bulkcxx . . $ grn/bulk/::setcxx . . $ grn/bulk/set(ca8f724eff6ab81).<int32_t>(ctx, result, static_cast<int32_t>(x) / y);
321 } else {
322 grncxx . . $ grn/::bulkcxx . . $ grn/bulk/::setcxx . . $ grn/bulk/set(ca8f724eff6ab81).<RESULT_TYPE>(ctx, result, static_cast<RESULT_TYPE>(x / y));
323 }
324 return true;
325 }
326
327 template <typename RESULT_TYPE, typename X, typename Y>
328 stdcxx . . $ std/::enable_if_t<(stdcxx . . $ std/::is_same_v<X, uint32_tcxx . . $ uint32_t#>) && stdcxx . . $ std/::is_signed_v<Y> &&
329 stdcxx . . $ std/::is_integral_v<Y>,
330 bool>
331 numeric_arithmetic_binary_operation_execute_slashcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_binary_operation_execute_slash(8d838e9296b21a1).(grn_ctx *ctx,
332 X x,
333 Y y,
334 grn_obj *result)
335 {
336 if (y == -1) {
337 grn_obj_reinit(ctx, result, GRN_DB_INT64, 0);
338 grncxx . . $ grn/::bulkcxx . . $ grn/bulk/::setcxx . . $ grn/bulk/set(ca8f724eff6ab81).<int64_t>(ctx, result, -static_cast<int64_t>(x));
339 } else if (y < -1) {
340 grn_obj_reinit(ctx, result, GRN_DB_INT64, 0);
341 grncxx . . $ grn/::bulkcxx . . $ grn/bulk/::setcxx . . $ grn/bulk/set(ca8f724eff6ab81).<int64_t>(ctx, result, static_cast<int64_t>(x) / y);
342 } else {
343 grncxx . . $ grn/::bulkcxx . . $ grn/bulk/::setcxx . . $ grn/bulk/set(ca8f724eff6ab81).<RESULT_TYPE>(ctx, result, static_cast<RESULT_TYPE>(x / y));
344 }
345 return true;
346 }
347
348 template <typename RESULT_TYPE, typename X, typename Y>
349 stdcxx . . $ std/::enable_if_t<(stdcxx . . $ std/::is_same_v<X, uint64_tcxx . . $ uint64_t#>) && stdcxx . . $ std/::is_signed_v<Y> &&
350 stdcxx . . $ std/::is_integral_v<Y>,
351 bool>
352 numeric_arithmetic_binary_operation_execute_slashcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_binary_operation_execute_slash(feeccc779995a643).(grn_ctx *ctx,
353 X x,
354 Y y,
355 grn_obj *result)
356 {
357 if (y == -1) {
358 /* int64_t max: 9223372036854775807
359 * int64_t min: -9223372036854775808
360 * uint64_t's 9223372036854775808 as int64_t's -9223372036854775808
361 */
362 auto threshold =
363 static_cast<uint64_tcxx . . $ uint64_t#>(stdcxx . . $ std/::numeric_limits<int64_t>::max()) + 1;
364 if (x > threshold) {
365 grn_obj_reinit(ctx, result, GRN_DB_FLOAT, 0);
366 grncxx . . $ grn/::bulkcxx . . $ grn/bulk/::setcxx . . $ grn/bulk/set(ca8f724eff6ab81).<double>(ctx, result, -static_cast<double>(x));
367 } else if (x == threshold) {
368 grn_obj_reinit(ctx, result, GRN_DB_INT64, 0);
369 grncxx . . $ grn/::bulkcxx . . $ grn/bulk/::setcxx . . $ grn/bulk/set(ca8f724eff6ab81).<int64_t>(ctx,
370 result,
371 stdcxx . . $ std/::numeric_limits<int64_t>::min());
372 } else {
373 grn_obj_reinit(ctx, result, GRN_DB_INT64, 0);
374 grncxx . . $ grn/::bulkcxx . . $ grn/bulk/::setcxx . . $ grn/bulk/set(ca8f724eff6ab81).<int64_t>(ctx, result, -static_cast<int64_t>(x));
375 }
376 } else if (y < -1) {
377 /* `y` is less than -2 because `std::is_integral_v`.
378 * Therefore, `x / y` is never smaller than the minimum value of int64_t.
379 */
380 grn_obj_reinit(ctx, result, GRN_DB_INT64, 0);
381 grncxx . . $ grn/::bulkcxx . . $ grn/bulk/::setcxx . . $ grn/bulk/set(ca8f724eff6ab81).<int64_t>(ctx, result, static_cast<double>(x) / y);
382 } else {
383 grncxx . . $ grn/::bulkcxx . . $ grn/bulk/::setcxx . . $ grn/bulk/set(ca8f724eff6ab81).<RESULT_TYPE>(ctx, result, static_cast<RESULT_TYPE>(x / y));
384 }
385 return true;
386 }
387
388 template <typename RESULT_TYPE, typename X, typename Y>
389 stdcxx . . $ std/::enable_if_t<!stdcxx . . $ std/::is_signed_v<Y>, bool>
390 numeric_arithmetic_binary_operation_execute_slashcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_binary_operation_execute_slash(6b01def38692314b).(grn_ctx *ctx,
391 X x,
392 Y y,
393 grn_obj *result)
394 {
395 grncxx . . $ grn/::bulkcxx . . $ grn/bulk/::setcxx . . $ grn/bulk/set(ca8f724eff6ab81).<RESULT_TYPE>(ctx, result, static_cast<RESULT_TYPE>(x / y));
396 return true;
397 }
398
399 template <typename RESULT_TYPE, typename X, typename Y>
400 stdcxx . . $ std/::enable_if_t<stdcxx . . $ std/::is_floating_point_v<Y>, bool>
401 numeric_arithmetic_binary_operation_execute_slashcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_binary_operation_execute_slash(a6123ece9d9b710f).(grn_ctx *ctx,
402 X x,
403 Y y,
404 grn_obj *result)
405 {
406 // y == -1
407 if (grncxx . . $ grn/::numericcxx . . $ grn/numeric/::is_zerocxx . . $ grn/numeric/is_zero(a142b9e4da30b6a4).(y + 1)) {
408 grncxx . . $ grn/::bulkcxx . . $ grn/bulk/::setcxx . . $ grn/bulk/set(ca8f724eff6ab81).<RESULT_TYPE>(ctx, result, -static_cast<RESULT_TYPE>(x));
409 } else {
410 grncxx . . $ grn/::bulkcxx . . $ grn/bulk/::setcxx . . $ grn/bulk/set(ca8f724eff6ab81).<RESULT_TYPE>(ctx, result, static_cast<RESULT_TYPE>(x / y));
411 }
412 return true;
413 }
414
415 template <typename RESULT_TYPE, typename X, typename Y>
416 stdcxx . . $ std/::enable_if_t<stdcxx . . $ std/::is_integral_v<X> && stdcxx . . $ std/::is_integral_v<Y>, bool>
417 numeric_arithmetic_binary_operation_execute_modcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_binary_operation_execute_mod(8309a5f6a4b49618).(grn_ctx *ctx,
418 X x,
419 Y y,
420 grn_obj *result)
421 {
422 grncxx . . $ grn/::bulkcxx . . $ grn/bulk/::setcxx . . $ grn/bulk/set(ca8f724eff6ab81).<RESULT_TYPE>(ctx, result, static_cast<RESULT_TYPE>(x % y));
423 return true;
424 }
425
426 template <typename RESULT_TYPE, typename X, typename Y>
427 stdcxx . . $ std/::enable_if_t<stdcxx . . $ std/::is_floating_point_v<X> || stdcxx . . $ std/::is_floating_point_v<Y>,
428 bool>
429 numeric_arithmetic_binary_operation_execute_modcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_binary_operation_execute_mod(7a62c6d661fe6274).(grn_ctx *ctx,
430 X x,
431 Y y,
432 grn_obj *result)
433 {
434 grncxx . . $ grn/::bulkcxx . . $ grn/bulk/::setcxx . . $ grn/bulk/set(ca8f724eff6ab81).<RESULT_TYPE>(ctx,
435 result,
436 static_cast<RESULT_TYPE>(fmod(x, y)));
437 return true;
438 }
439
440 template <typename RESULT_TYPE, typename X, typename Y>
441 stdcxx . . $ std/::enable_if_t<stdcxx . . $ std/::is_integral_v<X> && stdcxx . . $ std/::is_integral_v<Y>, bool>
442 numeric_arithmetic_binary_operation_execute_shiftlcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_binary_operation_execute_shiftl(8309a5f6a4b49618).(grn_ctx *ctx,
443 X x,
444 Y y,
445 grn_obj *result)
446 {
447 grncxx . . $ grn/::bulkcxx . . $ grn/bulk/::setcxx . . $ grn/bulk/set(ca8f724eff6ab81).<RESULT_TYPE>(ctx, result, static_cast<RESULT_TYPE>(x << y));
448 return true;
449 }
450
451 template <typename RESULT_TYPE, typename X, typename Y>
452 stdcxx . . $ std/::enable_if_t<stdcxx . . $ std/::is_floating_point_v<X> || stdcxx . . $ std/::is_floating_point_v<Y>,
453 bool>
454 numeric_arithmetic_binary_operation_execute_shiftlcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_binary_operation_execute_shiftl(7a62c6d661fe6274).(grn_ctx *ctx,
455 X x,
456 Y y,
457 grn_obj *result)
458 {
459 grncxx . . $ grn/::bulkcxx . . $ grn/bulk/::setcxx . . $ grn/bulk/set(ca8f724eff6ab81).<RESULT_TYPE>(
460 ctx,
461 result,
462 static_cast<RESULT_TYPE>(static_cast<int64_t>(x)
463 << static_cast<int64_t>(y)));
464 return true;
465 }
466
467 template <typename RESULT_TYPE, typename X, typename Y>
468 stdcxx . . $ std/::enable_if_t<stdcxx . . $ std/::is_integral_v<X> && stdcxx . . $ std/::is_integral_v<Y>, bool>
469 numeric_arithmetic_binary_operation_execute_shiftrcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_binary_operation_execute_shiftr(8309a5f6a4b49618).(grn_ctx *ctx,
470 X x,
471 Y y,
472 grn_obj *result)
473 {
474 grncxx . . $ grn/::bulkcxx . . $ grn/bulk/::setcxx . . $ grn/bulk/set(ca8f724eff6ab81).<RESULT_TYPE>(ctx, result, static_cast<RESULT_TYPE>(x >> y));
475 return true;
476 }
477
478 template <typename RESULT_TYPE, typename X, typename Y>
479 stdcxx . . $ std/::enable_if_t<stdcxx . . $ std/::is_floating_point_v<X> || stdcxx . . $ std/::is_floating_point_v<Y>,
480 bool>
481 numeric_arithmetic_binary_operation_execute_shiftrcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_binary_operation_execute_shiftr(7a62c6d661fe6274).(grn_ctx *ctx,
482 X x,
483 Y y,
484 grn_obj *result)
485 {
486 grncxx . . $ grn/::bulkcxx . . $ grn/bulk/::setcxx . . $ grn/bulk/set(ca8f724eff6ab81).<RESULT_TYPE>(
487 ctx,
488 result,
489 static_cast<RESULT_TYPE>(static_cast<int64_t>(x) >>
490 static_cast<int64_t>(y)));
491 return true;
492 }
493
494 template <typename RESULT_TYPE, typename X, typename Y>
495 stdcxx . . $ std/::enable_if_t<(stdcxx . . $ std/::is_same_v<X, int8_t> || stdcxx . . $ std/::is_same_v<X, uint8_tcxx . . $ uint8_t#>) &&
496 !stdcxx . . $ std/::is_floating_point_v<Y>,
497 bool>
498 numeric_arithmetic_binary_operation_execute_shiftrrcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_binary_operation_execute_shiftrr(64d286531871a806).(grn_ctx *ctx,
499 X x,
500 Y y,
501 grn_obj *result)
502 {
503 grncxx . . $ grn/::bulkcxx . . $ grn/bulk/::setcxx . . $ grn/bulk/set(ca8f724eff6ab81).<RESULT_TYPE>(
504 ctx,
505 result,
506 static_cast<RESULT_TYPE>(static_cast<uint8_tcxx . . $ uint8_t#>(x) >> y));
507 return true;
508 }
509
510 template <typename RESULT_TYPE, typename X, typename Y>
511 stdcxx . . $ std/::enable_if_t<(stdcxx . . $ std/::is_same_v<X, int16_t> ||
512 stdcxx . . $ std/::is_same_v<X, uint16_tcxx . . $ uint16_t#>) &&
513 !stdcxx . . $ std/::is_floating_point_v<Y>,
514 bool>
515 numeric_arithmetic_binary_operation_execute_shiftrrcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_binary_operation_execute_shiftrr(cad9951373c3fb0c).(grn_ctx *ctx,
516 X x,
517 Y y,
518 grn_obj *result)
519 {
520 grncxx . . $ grn/::bulkcxx . . $ grn/bulk/::setcxx . . $ grn/bulk/set(ca8f724eff6ab81).<RESULT_TYPE>(
521 ctx,
522 result,
523 static_cast<RESULT_TYPE>(static_cast<uint16_tcxx . . $ uint16_t#>(x) >> y));
524 return true;
525 }
526
527 template <typename RESULT_TYPE, typename X, typename Y>
528 stdcxx . . $ std/::enable_if_t<(stdcxx . . $ std/::is_same_v<X, int32_t> ||
529 stdcxx . . $ std/::is_same_v<X, uint32_tcxx . . $ uint32_t#>) &&
530 !stdcxx . . $ std/::is_floating_point_v<Y>,
531 bool>
532 numeric_arithmetic_binary_operation_execute_shiftrrcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_binary_operation_execute_shiftrr(4d28bea9df854581).(grn_ctx *ctx,
533 X x,
534 Y y,
535 grn_obj *result)
536 {
537 grncxx . . $ grn/::bulkcxx . . $ grn/bulk/::setcxx . . $ grn/bulk/set(ca8f724eff6ab81).<RESULT_TYPE>(
538 ctx,
539 result,
540 static_cast<RESULT_TYPE>(static_cast<uint32_tcxx . . $ uint32_t#>(x) >> y));
541 return true;
542 }
543
544 template <typename RESULT_TYPE, typename X, typename Y>
545 stdcxx . . $ std/::enable_if_t<(stdcxx . . $ std/::is_same_v<X, int64_t> ||
546 stdcxx . . $ std/::is_same_v<X, uint64_tcxx . . $ uint64_t#>) &&
547 !stdcxx . . $ std/::is_floating_point_v<Y>,
548 bool>
549 numeric_arithmetic_binary_operation_execute_shiftrrcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_binary_operation_execute_shiftrr(564df5ac20f50778).(grn_ctx *ctx,
550 X x,
551 Y y,
552 grn_obj *result)
553 {
554 grncxx . . $ grn/::bulkcxx . . $ grn/bulk/::setcxx . . $ grn/bulk/set(ca8f724eff6ab81).<RESULT_TYPE>(
555 ctx,
556 result,
557 static_cast<RESULT_TYPE>(static_cast<uint64_tcxx . . $ uint64_t#>(x) >> y));
558 return true;
559 }
560
561 template <typename RESULT_TYPE, typename X, typename Y>
562 stdcxx . . $ std/::enable_if_t<stdcxx . . $ std/::is_floating_point_v<X> || stdcxx . . $ std/::is_floating_point_v<Y>,
563 bool>
564 numeric_arithmetic_binary_operation_execute_shiftrrcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_binary_operation_execute_shiftrr(7a62c6d661fe6274).(grn_ctx *ctx,
565 X x,
566 Y y,
567 grn_obj *result)
568 {
569 grncxx . . $ grn/::bulkcxx . . $ grn/bulk/::setcxx . . $ grn/bulk/set(ca8f724eff6ab81).<RESULT_TYPE>(
570 ctx,
571 result,
572 static_cast<RESULT_TYPE>(static_cast<int64_t>(x) >>
573 static_cast<int64_t>(y)));
574 return true;
575 }
576
577 template <typename RESULT_TYPE, typename X, typename Y>
578 stdcxx . . $ std/::enable_if_t<stdcxx . . $ std/::is_integral_v<X> && stdcxx . . $ std/::is_integral_v<Y>, bool>
579 numeric_arithmetic_binary_operation_execute_bitwise_orcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_binary_operation_execute_bitwise_or(8309a5f6a4b49618).(grn_ctx *ctx,
580 X x,
581 Y y,
582 grn_obj *result)
583 {
584 grncxx . . $ grn/::bulkcxx . . $ grn/bulk/::setcxx . . $ grn/bulk/set(ca8f724eff6ab81).<RESULT_TYPE>(ctx, result, static_cast<RESULT_TYPE>(x | y));
585 return true;
586 }
587
588 template <typename RESULT_TYPE, typename X, typename Y>
589 stdcxx . . $ std/::enable_if_t<stdcxx . . $ std/::is_floating_point_v<X> || stdcxx . . $ std/::is_floating_point_v<Y>,
590 bool>
591 numeric_arithmetic_binary_operation_execute_bitwise_orcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_binary_operation_execute_bitwise_or(7a62c6d661fe6274).(grn_ctx *ctx,
592 X x,
593 Y y,
594 grn_obj *result)
595 {
596 grncxx . . $ grn/::bulkcxx . . $ grn/bulk/::setcxx . . $ grn/bulk/set(ca8f724eff6ab81).<RESULT_TYPE>(
597 ctx,
598 result,
599 static_cast<RESULT_TYPE>(static_cast<int64_t>(x) |
600 static_cast<int64_t>(y)));
601 return true;
602 }
603
604 template <typename RESULT_TYPE, typename X, typename Y>
605 stdcxx . . $ std/::enable_if_t<stdcxx . . $ std/::is_integral_v<X> && stdcxx . . $ std/::is_integral_v<Y>, bool>
606 numeric_arithmetic_binary_operation_execute_bitwise_xorcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_binary_operation_execute_bitwise_xor(8309a5f6a4b49618).(grn_ctx *ctx,
607 X x,
608 Y y,
609 grn_obj *result)
610 {
611 grncxx . . $ grn/::bulkcxx . . $ grn/bulk/::setcxx . . $ grn/bulk/set(ca8f724eff6ab81).<RESULT_TYPE>(ctx, result, static_cast<RESULT_TYPE>(x ^ y));
612 return true;
613 }
614
615 template <typename RESULT_TYPE, typename X, typename Y>
616 stdcxx . . $ std/::enable_if_t<stdcxx . . $ std/::is_floating_point_v<X> || stdcxx . . $ std/::is_floating_point_v<Y>,
617 bool>
618 numeric_arithmetic_binary_operation_execute_bitwise_xorcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_binary_operation_execute_bitwise_xor(7a62c6d661fe6274).(grn_ctx *ctx,
619 X x,
620 Y y,
621 grn_obj *result)
622 {
623 grncxx . . $ grn/::bulkcxx . . $ grn/bulk/::setcxx . . $ grn/bulk/set(ca8f724eff6ab81).<RESULT_TYPE>(
624 ctx,
625 result,
626 static_cast<RESULT_TYPE>(static_cast<int64_t>(x) ^
627 static_cast<int64_t>(y)));
628 return true;
629 }
630
631 template <typename RESULT_TYPE, typename X, typename Y>
632 stdcxx . . $ std/::enable_if_t<stdcxx . . $ std/::is_integral_v<X> && stdcxx . . $ std/::is_integral_v<Y>, bool>
633 numeric_arithmetic_binary_operation_execute_bitwise_andcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_binary_operation_execute_bitwise_and(8309a5f6a4b49618).(grn_ctx *ctx,
634 X x,
635 Y y,
636 grn_obj *result)
637 {
638 grncxx . . $ grn/::bulkcxx . . $ grn/bulk/::setcxx . . $ grn/bulk/set(ca8f724eff6ab81).<RESULT_TYPE>(ctx, result, static_cast<RESULT_TYPE>(x & y));
639 return true;
640 }
641
642 template <typename RESULT_TYPE, typename X, typename Y>
643 stdcxx . . $ std/::enable_if_t<stdcxx . . $ std/::is_floating_point_v<X> || stdcxx . . $ std/::is_floating_point_v<Y>,
644 bool>
645 numeric_arithmetic_binary_operation_execute_bitwise_andcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_binary_operation_execute_bitwise_and(7a62c6d661fe6274).(grn_ctx *ctx,
646 X x,
647 Y y,
648 grn_obj *result)
649 {
650 grncxx . . $ grn/::bulkcxx . . $ grn/bulk/::setcxx . . $ grn/bulk/set(ca8f724eff6ab81).<RESULT_TYPE>(
651 ctx,
652 result,
653 static_cast<RESULT_TYPE>(static_cast<int64_t>(x) &
654 static_cast<int64_t>(y)));
655 return true;
656 }
657
658 template <typename RESULT_TYPE, typename X, typename Y>
659 bool
660 numeric_arithmetic_binary_operation_executecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_binary_operation_execute(4ff150f85e214d65).(
661 grn_ctx *ctx, grn_operator op, X x, Y y, grn_obj *result)
662 {
663 switch (op) {
664 case GRN_OP_PLUS:
665 case GRN_OP_PLUS_ASSIGN:
666 grncxx . . $ grn/::bulkcxx . . $ grn/bulk/::setcxx . . $ grn/bulk/set(ca8f724eff6ab81).<RESULT_TYPE>(ctx, result, static_cast<RESULT_TYPE>(x + y));
667 return true;
668 case GRN_OP_MINUS:
669 case GRN_OP_MINUS_ASSIGN:
670 grncxx . . $ grn/::bulkcxx . . $ grn/bulk/::setcxx . . $ grn/bulk/set(ca8f724eff6ab81).<RESULT_TYPE>(ctx, result, static_cast<RESULT_TYPE>(x - y));
671 return true;
672 case GRN_OP_STAR:
673 case GRN_OP_STAR_ASSIGN:
674 grncxx . . $ grn/::bulkcxx . . $ grn/bulk/::setcxx . . $ grn/bulk/set(ca8f724eff6ab81).<RESULT_TYPE>(ctx, result, static_cast<RESULT_TYPE>(x * y));
675 return true;
676 case GRN_OP_SLASH:
677 case GRN_OP_SLASH_ASSIGN:
678 if (grncxx . . $ grn/::numericcxx . . $ grn/numeric/::is_zerocxx . . $ grn/numeric/is_zero(a142b9e4da30b6a4).(y)) {
679 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT, "divisor should not be 0");
680 return false;
681 }
682 return numeric_arithmetic_binary_operation_execute_slashcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_binary_operation_execute_slash(a6123ece9d9b710f).<RESULT_TYPE>(
683 ctx,
684 x,
685 y,
686 result);
687 return true;
688 case GRN_OP_MOD:
689 case GRN_OP_MOD_ASSIGN:
690 if (grncxx . . $ grn/::numericcxx . . $ grn/numeric/::is_zerocxx . . $ grn/numeric/is_zero(a142b9e4da30b6a4).(y)) {
691 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT, "divisor should not be 0");
692 return false;
693 }
694 return numeric_arithmetic_binary_operation_execute_modcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_binary_operation_execute_mod(7a62c6d661fe6274).<RESULT_TYPE>(
695 ctx,
696 x,
697 y,
698 result);
699 case GRN_OP_SHIFTL:
700 case GRN_OP_SHIFTL_ASSIGN:
701 return numeric_arithmetic_binary_operation_execute_shiftlcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_binary_operation_execute_shiftl(7a62c6d661fe6274).<RESULT_TYPE>(
702 ctx,
703 x,
704 y,
705 result);
706 case GRN_OP_SHIFTR:
707 case GRN_OP_SHIFTR_ASSIGN:
708 return numeric_arithmetic_binary_operation_execute_shiftrcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_binary_operation_execute_shiftr(7a62c6d661fe6274).<RESULT_TYPE>(
709 ctx,
710 x,
711 y,
712 result);
713 case GRN_OP_SHIFTRR:
714 case GRN_OP_SHIFTRR_ASSIGN:
715 return numeric_arithmetic_binary_operation_execute_shiftrrcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_binary_operation_execute_shiftrr(7a62c6d661fe6274).<RESULT_TYPE>(
716 ctx,
717 x,
718 y,
719 result);
720 case GRN_OP_BITWISE_OR:
721 case GRN_OP_OR_ASSIGN:
722 return numeric_arithmetic_binary_operation_execute_bitwise_orcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_binary_operation_execute_bitwise_or(7a62c6d661fe6274).<
723 RESULT_TYPE>(ctx, x, y, result);
724 case GRN_OP_BITWISE_XOR:
725 case GRN_OP_XOR_ASSIGN:
726 return numeric_arithmetic_binary_operation_execute_bitwise_xorcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_binary_operation_execute_bitwise_xor(7a62c6d661fe6274).<
727 RESULT_TYPE>(ctx, x, y, result);
728 case GRN_OP_BITWISE_AND:
729 case GRN_OP_AND_ASSIGN:
730 return numeric_arithmetic_binary_operation_execute_bitwise_andcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_binary_operation_execute_bitwise_and(7a62c6d661fe6274).<
731 RESULT_TYPE>(ctx, x, y, result);
732 default:
733 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
734 "[expr-executor] unsupported operator: %s",
735 grn_operator_to_script_syntax(op));
736 return false;
737 }
738 }
739
740 template <typename RESULT_TYPE, typename X>
741 bool
742 numeric_arithmetic_binary_operation_dispatchcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_binary_operation_dispatch(12ccac937644ff49).(grn_ctx *ctx,
743 grn_operator op,
744 X x_raw,
745 grn_obj *y,
746 grn_obj *res,
747 grn_id res_domain)
748 {
749 switch (y->headercxx . . $ _grn_obj#header..domain) {
750 case GRN_DB_BOOL:
751 {
752 uint8_tcxx . . $ uint8_t# y_raw = GRN_BOOL_VALUEcxx . . $ `include/groonga/groonga.h:3097:9`!(y) ? 1 : 0;
753 grn_obj_reinit(ctx, res, res_domain, 0);
754 return numeric_arithmetic_binary_operation_executecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_binary_operation_execute(4ff150f85e214d65).<RESULT_TYPE>(ctx,
755 op,
756 x_raw,
757 y_raw,
758 res);
759 }
760 case GRN_DB_INT8:
761 {
762 auto y_raw = GRN_INT8_VALUEcxx . . $ `include/groonga/groonga.h:3098:9`!(y);
763 grn_obj_reinit(ctx, res, res_domain, 0);
764 return numeric_arithmetic_binary_operation_executecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_binary_operation_execute(4ff150f85e214d65).<RESULT_TYPE>(ctx,
765 op,
766 x_raw,
767 y_raw,
768 res);
769 }
770 case GRN_DB_UINT8:
771 {
772 auto y_raw = GRN_UINT8_VALUEcxx . . $ `include/groonga/groonga.h:3099:9`!(y);
773 grn_obj_reinit(ctx, res, res_domain, 0);
774 return numeric_arithmetic_binary_operation_executecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_binary_operation_execute(4ff150f85e214d65).<RESULT_TYPE>(ctx,
775 op,
776 x_raw,
777 y_raw,
778 res);
779 }
780 case GRN_DB_INT16:
781 {
782 auto y_raw = GRN_INT16_VALUEcxx . . $ `include/groonga/groonga.h:3100:9`!(y);
783 grn_obj_reinit(ctx, res, res_domain, 0);
784 return numeric_arithmetic_binary_operation_executecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_binary_operation_execute(4ff150f85e214d65).<RESULT_TYPE>(ctx,
785 op,
786 x_raw,
787 y_raw,
788 res);
789 }
790 case GRN_DB_UINT16:
791 {
792 auto y_raw = GRN_UINT16_VALUEcxx . . $ `include/groonga/groonga.h:3101:9`!(y);
793 grn_obj_reinit(ctx, res, res_domain, 0);
794 return numeric_arithmetic_binary_operation_executecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_binary_operation_execute(4ff150f85e214d65).<RESULT_TYPE>(ctx,
795 op,
796 x_raw,
797 y_raw,
798 res);
799 }
800 case GRN_DB_INT32:
801 {
802 auto y_raw = GRN_INT32_VALUEcxx . . $ `include/groonga/groonga.h:3102:9`!(y);
803 grn_obj_reinit(ctx, res, res_domain, 0);
804 return numeric_arithmetic_binary_operation_executecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_binary_operation_execute(4ff150f85e214d65).<RESULT_TYPE>(ctx,
805 op,
806 x_raw,
807 y_raw,
808 res);
809 }
810 case GRN_DB_UINT32:
811 {
812 auto y_raw = GRN_UINT32_VALUEcxx . . $ `include/groonga/groonga.h:3103:9`!(y);
813 grn_obj_reinit(ctx, res, res_domain, 0);
814 return numeric_arithmetic_binary_operation_executecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_binary_operation_execute(4ff150f85e214d65).<RESULT_TYPE>(ctx,
815 op,
816 x_raw,
817 y_raw,
818 res);
819 }
820 case GRN_DB_TIME:
821 {
822 auto y_raw = GRN_TIME_VALUEcxx . . $ `include/groonga/groonga.h:3109:9`!(y);
823 grn_obj_reinit(ctx, res, res_domain, 0);
824 return numeric_arithmetic_binary_operation_executecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_binary_operation_execute(4ff150f85e214d65).<RESULT_TYPE>(ctx,
825 op,
826 x_raw,
827 y_raw,
828 res);
829 }
830 case GRN_DB_INT64:
831 {
832 auto y_raw = GRN_INT64_VALUEcxx . . $ `include/groonga/groonga.h:3104:9`!(y);
833 grn_obj_reinit(ctx, res, res_domain, 0);
834 return numeric_arithmetic_binary_operation_executecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_binary_operation_execute(4ff150f85e214d65).<RESULT_TYPE>(ctx,
835 op,
836 x_raw,
837 y_raw,
838 res);
839 }
840 case GRN_DB_UINT64:
841 {
842 auto y_raw = GRN_UINT64_VALUEcxx . . $ `include/groonga/groonga.h:3105:9`!(y);
843 grn_obj_reinit(ctx, res, res_domain, 0);
844 return numeric_arithmetic_binary_operation_executecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_binary_operation_execute(4ff150f85e214d65).<RESULT_TYPE>(ctx,
845 op,
846 x_raw,
847 y_raw,
848 res);
849 }
850 case GRN_DB_FLOAT32:
851 {
852 auto y_raw = GRN_FLOAT32_VALUEcxx . . $ `include/groonga/groonga.h:3107:9`!(y);
853 grn_obj_reinit(ctx, res, GRN_DB_FLOAT32, 0);
854 return numeric_arithmetic_binary_operation_executecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_binary_operation_execute(4ff150f85e214d65).<float>(ctx,
855 op,
856 x_raw,
857 y_raw,
858 res);
859 }
860 case GRN_DB_FLOAT:
861 {
862 auto y_raw = GRN_FLOAT_VALUEcxx . . $ `include/groonga/groonga.h:3108:9`!(y);
863 grn_obj_reinit(ctx, res, GRN_DB_FLOAT, 0);
864 return numeric_arithmetic_binary_operation_executecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_binary_operation_execute(4ff150f85e214d65).<double>(ctx,
865 op,
866 x_raw,
867 y_raw,
868 res);
869 }
870 case GRN_DB_SHORT_TEXT:
871 case GRN_DB_TEXT:
872 case GRN_DB_LONG_TEXT:
873 grn_obj_reinit(ctx, res, res_domain, 0);
874 if (grn_obj_cast(ctx, y, res, false)) {
875 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
876 "not a numerical format: <%.*s>",
877 (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(y),
878 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(y));
879 return false;
880 }
881 return numeric_arithmetic_binary_operation_executecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_binary_operation_execute(4ff150f85e214d65).<RESULT_TYPE>(
882 ctx,
883 op,
884 x_raw,
885 grncxx . . $ grn/::bulkcxx . . $ grn/bulk/::getcxx . . $ grn/bulk/get(fc0e5dd5d2409f65).<RESULT_TYPE>(ctx, res, 0),
886 res);
887 default:
888 {
889 grncxx . . $ grn/::TextBulkcxx . . $ grn/TextBulk# y_inspectedcxx . . $ grn/TextBulk#TextBulk(f33f77cd46f8f264).(ctx);
890 grn_inspect(ctx, *cxx . . $ grn/TextBulk#`operator*`(d5f0a9fb11b2b135).y_inspected, y);
891 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
892 "[expr-executor] unsupported right type: %.*s(%s)",
893 static_cast<int>(GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(*y_inspected)),
894 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(*y_inspected),
895 grn_obj_type_to_string(y->header.type));
896 return false;
897 }
898 }
899 }
900
901 inline bool
902 text_binary_operationcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/text_binary_operation(925d1aad99ca3036).(
903 grn_ctx *ctx, grn_operator op, grn_obj *x, grn_obj *y, grn_obj *result)
904 {
905 switch (op) {
906 case GRN_OP_STAR_ASSIGN:
907 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
908 "[expr-executor] variable *= \"string\" isn't supported");
909 return false;
910 case GRN_OP_SLASH_ASSIGN:
911 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
912 "[expr-executor] variable /= \"string\" isn't supported");
913 return false;
914 case GRN_OP_MOD_ASSIGN:
915 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
916 "[expr-executor] variable %%= \"string\" isn't supported");
917 return false;
918 case GRN_OP_PLUS_ASSIGN:
919 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
920 "[expr-executor] variable += \"string\" isn't supported");
921 return false;
922 case GRN_OP_MINUS_ASSIGN:
923 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
924 "[expr-executor] variable -= \"string\" isn't supported");
925 return false;
926 case GRN_OP_SHIFTL_ASSIGN:
927 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
928 "[expr-executor] variable <<= \"string\" isn't supported");
929 return false;
930 case GRN_OP_SHIFTR_ASSIGN:
931 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
932 "[expr-executor] variable >>= \"string\" isn't supported");
933 return false;
934 case GRN_OP_SHIFTRR_ASSIGN:
935 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
936 "[expr-executor] variable >>>= \"string\" isn't supported");
937 return false;
938 case GRN_OP_AND_ASSIGN:
939 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
940 "[expr-executor] variable &= \"string\" isn't supported");
941 return false;
942 case GRN_OP_XOR_ASSIGN:
943 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
944 "[expr-executor] variable ^= \"string\" isn't supported");
945 return false;
946 case GRN_OP_OR_ASSIGN:
947 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
948 "[expr-executor] variable |= \"string\" isn't supported");
949 return false;
950 case GRN_OP_BITWISE_OR:
951 case GRN_OP_BITWISE_XOR:
952 case GRN_OP_BITWISE_AND:
953 case GRN_OP_SHIFTL:
954 case GRN_OP_SHIFTR:
955 case GRN_OP_SHIFTRR:
956 return text_arithmetic_binary_operationcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/text_arithmetic_binary_operation(925d1aad99ca3036).(ctx, op, x, y, result);
957 case GRN_OP_PLUS:
958 if (x == result) {
959 grn_obj_cast(ctx, y, result, false);
960 } else if (y == result) {
961 grncxx . . $ grn/::TextBulkcxx . . $ grn/TextBulk# buffercxx . . $ grn/TextBulk#TextBulk(f33f77cd46f8f264).(ctx);
962 GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(*buffer, 0);
963 grn_obj_cast(ctx, x, *cxx . . $ grn/TextBulk#`operator*`(d5f0a9fb11b2b135).buffer, false);
964 grn_obj_cast(ctx, y, *cxx . . $ grn/TextBulk#`operator*`(d5f0a9fb11b2b135).buffer, false);
965 GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(result);
966 grn_obj_reinit(ctx, result, GRN_DB_TEXT, 0);
967 grn_obj_cast(ctx, *cxx . . $ grn/TextBulk#`operator*`(d5f0a9fb11b2b135).buffer, result, false);
968 } else {
969 grn_obj_reinit(ctx, result, GRN_DB_TEXT, 0);
970 grn_obj_cast(ctx, x, result, false);
971 grn_obj_cast(ctx, y, result, false);
972 }
973 return true;
974 case GRN_OP_MINUS:
975 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
976 "[expr-executor] \"string\" - \"string\" isn't supported");
977 return false;
978 case GRN_OP_STAR:
979 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
980 "[expr-executor] \"string\" * \"string\" isn't supported");
981 return false;
982 case GRN_OP_SLASH:
983 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
984 "[expr-executor] \"string\" / \"string\" isn't supported");
985 return false;
986 case GRN_OP_MOD:
987 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
988 "[expr-executor] \"string\" %% \"string\" isn't supported");
989 return false;
990 default:
991 {
992 grncxx . . $ grn/::TextBulkcxx . . $ grn/TextBulk# x_inspectedcxx . . $ grn/TextBulk#TextBulk(f33f77cd46f8f264).(ctx);
993 grn_inspect(ctx, *cxx . . $ grn/TextBulk#`operator*`(d5f0a9fb11b2b135).x_inspected, x);
994 grncxx . . $ grn/::TextBulkcxx . . $ grn/TextBulk# y_inspectedcxx . . $ grn/TextBulk#TextBulk(f33f77cd46f8f264).(ctx);
995 grn_inspect(ctx, *cxx . . $ grn/TextBulk#`operator*`(d5f0a9fb11b2b135).y_inspected, y);
996 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
997 "[expr-executor] unsupported text operation: %.*s %s %.*s",
998 static_cast<int>(GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(*x_inspected)),
999 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(*x_inspected),
1000 grn_operator_to_string(op),
1001 static_cast<int>(GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(*y_inspected)),
1002 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(*y_inspected));
1003 return false;
1004 }
1005 }
1006 }
1007
1008 inline bool
1009 arithmetic_binary_operation_dispatchcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/arithmetic_binary_operation_dispatch(1cebdc7cecf3d0a9).(grn_ctx *ctx,
1010 ExecuteDatacxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData# &data,
1011 grn_operator op,
1012 grn_obj *x,
1013 grn_obj *y,
1014 grn_obj *res)
1015 {
1016 switch (x->headercxx . . $ _grn_obj#header..domain) {
1017 case GRN_DB_BOOL:
1018 {
1019 uint8_tcxx . . $ uint8_t# x_ = GRN_BOOL_VALUEcxx . . $ `include/groonga/groonga.h:3097:9`!(x) ? 1 : 0;
1020 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(
1021 numeric_arithmetic_binary_operation_dispatch<uint8_t>(ctx,
1022 op,
1023 x_,
1024 y,
1025 res,
1026 GRN_DB_UINT8));
1027 }
1028 break;
1029 case GRN_DB_INT8:
1030 {
1031 auto x_ = GRN_INT8_VALUEcxx . . $ `include/groonga/groonga.h:3098:9`!(x);
1032 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(
1033 numeric_arithmetic_binary_operation_dispatch<int8_t>(ctx,
1034 op,
1035 x_,
1036 y,
1037 res,
1038 GRN_DB_INT8));
1039 }
1040 break;
1041 case GRN_DB_UINT8:
1042 {
1043 auto x_ = GRN_UINT8_VALUEcxx . . $ `include/groonga/groonga.h:3099:9`!(x);
1044 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(
1045 numeric_arithmetic_binary_operation_dispatch<uint8_t>(ctx,
1046 op,
1047 x_,
1048 y,
1049 res,
1050 GRN_DB_UINT8));
1051 }
1052 break;
1053 case GRN_DB_INT16:
1054 {
1055 auto x_ = GRN_INT16_VALUEcxx . . $ `include/groonga/groonga.h:3100:9`!(x);
1056 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(
1057 numeric_arithmetic_binary_operation_dispatch<int16_t>(ctx,
1058 op,
1059 x_,
1060 y,
1061 res,
1062 GRN_DB_INT16));
1063 }
1064 break;
1065 case GRN_DB_UINT16:
1066 {
1067 auto x_ = GRN_UINT16_VALUEcxx . . $ `include/groonga/groonga.h:3101:9`!(x);
1068 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(numeric_arithmetic_binary_operation_dispatch<
1069 uint16_t>(ctx, op, x_, y, res, GRN_DB_UINT16));
1070 }
1071 break;
1072 case GRN_DB_INT32:
1073 {
1074 auto x_ = GRN_INT32_VALUEcxx . . $ `include/groonga/groonga.h:3102:9`!(x);
1075 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(
1076 numeric_arithmetic_binary_operation_dispatch<int32_t>(ctx,
1077 op,
1078 x_,
1079 y,
1080 res,
1081 GRN_DB_INT32));
1082 }
1083 break;
1084 case GRN_DB_UINT32:
1085 {
1086 auto x_ = GRN_UINT32_VALUEcxx . . $ `include/groonga/groonga.h:3103:9`!(x);
1087 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(numeric_arithmetic_binary_operation_dispatch<
1088 uint32_t>(ctx, op, x_, y, res, GRN_DB_UINT32));
1089 }
1090 break;
1091 case GRN_DB_INT64:
1092 {
1093 auto x_ = GRN_INT64_VALUEcxx . . $ `include/groonga/groonga.h:3104:9`!(x);
1094 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(
1095 numeric_arithmetic_binary_operation_dispatch<int64_t>(ctx,
1096 op,
1097 x_,
1098 y,
1099 res,
1100 GRN_DB_INT64));
1101 }
1102 break;
1103 case GRN_DB_TIME:
1104 {
1105 auto x_ = GRN_TIME_VALUEcxx . . $ `include/groonga/groonga.h:3109:9`!(x);
1106 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(
1107 numeric_arithmetic_binary_operation_dispatch<int64_t>(ctx,
1108 op,
1109 x_,
1110 y,
1111 res,
1112 GRN_DB_TIME));
1113 }
1114 break;
1115 case GRN_DB_UINT64:
1116 {
1117 auto x_ = GRN_UINT64_VALUEcxx . . $ `include/groonga/groonga.h:3105:9`!(x);
1118 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(numeric_arithmetic_binary_operation_dispatch<
1119 uint64_t>(ctx, op, x_, y, res, GRN_DB_UINT64));
1120 }
1121 break;
1122 case GRN_DB_FLOAT32:
1123 {
1124 auto x_ = GRN_FLOAT32_VALUEcxx . . $ `include/groonga/groonga.h:3107:9`!(x);
1125 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(
1126 numeric_arithmetic_binary_operation_dispatch<float>(ctx,
1127 op,
1128 x_,
1129 y,
1130 res,
1131 GRN_DB_FLOAT32));
1132 }
1133 break;
1134 case GRN_DB_FLOAT:
1135 {
1136 auto x_ = GRN_FLOAT_VALUEcxx . . $ `include/groonga/groonga.h:3108:9`!(x);
1137 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(
1138 numeric_arithmetic_binary_operation_dispatch<double>(ctx,
1139 op,
1140 x_,
1141 y,
1142 res,
1143 GRN_DB_FLOAT));
1144 }
1145 break;
1146 case GRN_DB_SHORT_TEXT:
1147 case GRN_DB_TEXT:
1148 case GRN_DB_LONG_TEXT:
1149 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(text_binary_operation(ctx, op, x, y, res));
1150 break;
1151 default:
1152 break;
1153 }
1154 data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.++;
1155 return true;
1156 }
1157
1158 inline bool
1159 arithmetic_binary_operation_dispatchcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/arithmetic_binary_operation_dispatch(87315b471eaeeef5).(grn_ctx *ctx,
1160 ExecuteDatacxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData# &data,
1161 grn_operator op)
1162 {
1163 grn_obj *x = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
1164 grn_obj *y = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
1165
1166 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop2alloc1(ctx, data, x, y, data.res));
1167 if (x->headercxx . . $ _grn_obj#header..type == GRN_VECTORcxx . . $ `include/groonga/groonga.h:877:9`! || y->headercxx . . $ _grn_obj#header..type == GRN_VECTORcxx . . $ `include/groonga/groonga.h:877:9`!) {
1168 grn_obj inspected_x;
1169 grn_obj inspected_y;
1170 GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&inspected_x, 0);
1171 GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&inspected_y, 0);
1172 grn_inspect(ctx, &inspected_x, x);
1173 grn_inspect(ctx, &inspected_y, y);
1174 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
1175 "<%s> doesn't support vector: <%.*s> %s <%.*s>",
1176 grn_operator_to_script_syntax(op),
1177 (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&inspected_x),
1178 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&inspected_x),
1179 grn_operator_to_script_syntax(op),
1180 (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&inspected_y),
1181 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&inspected_y));
1182 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &inspected_x);
1183 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &inspected_y);
1184 return false;
1185 }
1186 return arithmetic_binary_operation_dispatchcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/arithmetic_binary_operation_dispatch(1cebdc7cecf3d0a9).(ctx, data, op, x, y, data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res.);
1187 }
1188
1189 template <typename RESULT_TYPE, typename X>
1190 stdcxx . . $ std/::enable_if_t<stdcxx . . $ std/::is_integral_v<X>, bool>
1191 numeric_arithmetic_unary_operation_execute_bitwise_notcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_unary_operation_execute_bitwise_not(5e440e3670c4aec7).(grn_ctx *ctx,
1192 X x,
1193 grn_obj *result)
1194 {
1195 grncxx . . $ grn/::bulkcxx . . $ grn/bulk/::setcxx . . $ grn/bulk/set(ca8f724eff6ab81).<RESULT_TYPE>(ctx, result, static_cast<RESULT_TYPE>(~x));
1196 return true;
1197 }
1198
1199 template <typename RESULT_TYPE, typename X>
1200 stdcxx . . $ std/::enable_if_t<stdcxx . . $ std/::is_floating_point_v<X>, bool>
1201 numeric_arithmetic_unary_operation_execute_bitwise_notcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_unary_operation_execute_bitwise_not(9f569a134c9f7783).(grn_ctx *ctx,
1202 X x,
1203 grn_obj *result)
1204 {
1205 grncxx . . $ grn/::bulkcxx . . $ grn/bulk/::setcxx . . $ grn/bulk/set(ca8f724eff6ab81).<RESULT_TYPE>(
1206 ctx,
1207 result,
1208 static_cast<RESULT_TYPE>(~static_cast<int64_t>(x)));
1209 return true;
1210 }
1211
1212 template <typename RESULT_TYPE, typename X>
1213 bool
1214 numeric_arithmetic_unary_operation_executecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_unary_operation_execute(eb27c4fde4e6a94b).(grn_ctx *ctx,
1215 grn_operator op,
1216 X x_raw,
1217 grn_obj *result,
1218 grn_id result_domain)
1219 {
1220 switch (op) {
1221 case GRN_OP_MINUS:
1222 grn_obj_reinit(ctx, result, result_domain, 0);
1223 grncxx . . $ grn/::bulkcxx . . $ grn/bulk/::setcxx . . $ grn/bulk/set(ca8f724eff6ab81).<RESULT_TYPE>(ctx,
1224 result,
1225 static_cast<RESULT_TYPE>(-x_raw));
1226 return true;
1227 case GRN_OP_BITWISE_NOT:
1228 grn_obj_reinit(ctx, result, result_domain, 0);
1229 return numeric_arithmetic_unary_operation_execute_bitwise_notcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/numeric_arithmetic_unary_operation_execute_bitwise_not(9f569a134c9f7783).<
1230 RESULT_TYPE>(ctx, x_raw, result);
1231 default:
1232 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
1233 "[expr-executor] unsupported unary operator: %s",
1234 grn_operator_to_script_syntax(op));
1235 return false;
1236 }
1237 }
1238
1239 inline bool
1240 arithmetic_unary_operation_dispatchcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/arithmetic_unary_operation_dispatch(87315b471eaeeef5).(grn_ctx *ctx,
1241 ExecuteDatacxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData# &data,
1242 grn_operator op)
1243 {
1244 grn_obj *x = nullptr;
1245 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1alloc1(ctx, data, x, data.res));
1246 switch (x->headercxx . . $ _grn_obj#header..domain) {
1247 case GRN_DB_INT8:
1248 {
1249 auto x_raw = GRN_INT8_VALUEcxx . . $ `include/groonga/groonga.h:3098:9`!(x);
1250 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(numeric_arithmetic_unary_operation_execute<int8_t>(ctx,
1251 op,
1252 x_raw,
1253 data.res,
1254 GRN_DB_INT8));
1255 }
1256 break;
1257 case GRN_DB_UINT8:
1258 {
1259 int16_t x_raw = GRN_UINT8_VALUEcxx . . $ `include/groonga/groonga.h:3099:9`!(x);
1260 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(
1261 numeric_arithmetic_unary_operation_execute<int16_t>(ctx,
1262 op,
1263 x_raw,
1264 data.res,
1265 GRN_DB_INT16));
1266 }
1267 break;
1268 case GRN_DB_INT16:
1269 {
1270 auto x_raw = GRN_INT16_VALUEcxx . . $ `include/groonga/groonga.h:3100:9`!(x);
1271 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(
1272 numeric_arithmetic_unary_operation_execute<int16_t>(ctx,
1273 op,
1274 x_raw,
1275 data.res,
1276 GRN_DB_INT16));
1277 }
1278 break;
1279 case GRN_DB_UINT16:
1280 {
1281 int32_t x_raw = GRN_UINT16_VALUEcxx . . $ `include/groonga/groonga.h:3101:9`!(x);
1282 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(
1283 numeric_arithmetic_unary_operation_execute<int32_t>(ctx,
1284 op,
1285 x_raw,
1286 data.res,
1287 GRN_DB_INT32));
1288 }
1289 break;
1290 case GRN_DB_INT32:
1291 {
1292 auto x_raw = GRN_INT32_VALUEcxx . . $ `include/groonga/groonga.h:3102:9`!(x);
1293 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(
1294 numeric_arithmetic_unary_operation_execute<int32_t>(ctx,
1295 op,
1296 x_raw,
1297 data.res,
1298 GRN_DB_INT32));
1299 }
1300 break;
1301 case GRN_DB_UINT32:
1302 {
1303 int64_t x_raw = GRN_UINT32_VALUEcxx . . $ `include/groonga/groonga.h:3103:9`!(x);
1304 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(
1305 numeric_arithmetic_unary_operation_execute<int64_t>(ctx,
1306 op,
1307 x_raw,
1308 data.res,
1309 GRN_DB_INT64));
1310 }
1311 break;
1312 case GRN_DB_INT64:
1313 {
1314 auto x_raw = GRN_INT64_VALUEcxx . . $ `include/groonga/groonga.h:3104:9`!(x);
1315 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(
1316 numeric_arithmetic_unary_operation_execute<int64_t>(ctx,
1317 op,
1318 x_raw,
1319 data.res,
1320 GRN_DB_INT64));
1321 }
1322 break;
1323 case GRN_DB_TIME:
1324 {
1325 auto x_raw = GRN_TIME_VALUEcxx . . $ `include/groonga/groonga.h:3109:9`!(x);
1326 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(numeric_arithmetic_unary_operation_execute<int64_t>(ctx,
1327 op,
1328 x_raw,
1329 data.res,
1330 GRN_DB_TIME));
1331 }
1332 break;
1333 case GRN_DB_UINT64:
1334 {
1335 auto x_raw = GRN_UINT64_VALUEcxx . . $ `include/groonga/groonga.h:3105:9`!(x);
1336 if (x_raw >
1337 static_cast<uint64_tcxx . . $ uint64_t#>(stdcxx . . $ std/::numeric_limits<int64_t>::max())) {
1338 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
1339 "too large UInt64 value to inverse sign: "
1340 "<%" GRN_FMT_INT64Ucxx . . $ `lib/grn.h:377:11`! ">",
1341 x_raw);
1342 return false;
1343 } else {
1344 int64_t signed_x_raw;
1345 signed_x_raw = x_raw;
1346 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(
1347 numeric_arithmetic_unary_operation_execute<int64_t>(ctx,
1348 op,
1349 signed_x_raw,
1350 data.res,
1351 GRN_DB_INT64));
1352 }
1353 }
1354 break;
1355 case GRN_DB_FLOAT32:
1356 {
1357 auto x_raw = GRN_FLOAT32_VALUEcxx . . $ `include/groonga/groonga.h:3107:9`!(x);
1358 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(
1359 numeric_arithmetic_unary_operation_execute<float>(ctx,
1360 op,
1361 x_raw,
1362 data.res,
1363 GRN_DB_FLOAT32));
1364 }
1365 break;
1366 case GRN_DB_FLOAT:
1367 {
1368 auto x_raw = GRN_FLOAT_VALUEcxx . . $ `include/groonga/groonga.h:3108:9`!(x);
1369 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(numeric_arithmetic_unary_operation_execute<double>(ctx,
1370 op,
1371 x_raw,
1372 data.res,
1373 GRN_DB_FLOAT));
1374 }
1375 break;
1376 case GRN_DB_SHORT_TEXT:
1377 case GRN_DB_TEXT:
1378 case GRN_DB_LONG_TEXT:
1379 {
1380 grn_obj x_casted;
1381 GRN_INT64_INITcxx . . $ `include/groonga/groonga.h:2856:9`!(&x_casted, 0);
1382 grn_obj_cast(ctx, x, &x_casted, false);
1383 auto x_casted_raw = GRN_INT64_VALUEcxx . . $ `include/groonga/groonga.h:3104:9`!(&x_casted);
1384 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &x_casted);
1385 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(
1386 numeric_arithmetic_unary_operation_execute<int64_t>(ctx,
1387 op,
1388 x_casted_raw,
1389 data.res,
1390 GRN_DB_INT64));
1391 break;
1392 }
1393 default:
1394 {
1395 grncxx . . $ grn/::TextBulkcxx . . $ grn/TextBulk# x_inspectedcxx . . $ grn/TextBulk#TextBulk(f33f77cd46f8f264).(ctx);
1396 grn_inspect(ctx, *cxx . . $ grn/TextBulk#`operator*`(d5f0a9fb11b2b135).x_inspected, x);
1397 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
1398 "[expr-executor] unsupported unary operation target type: %.*s(%s)",
1399 static_cast<int>(GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(*x_inspected)),
1400 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(*x_inspected),
1401 grn_obj_type_to_string(x->header.type));
1402 return false;
1403 }
1404 }
1405 data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.++;
1406 return true;
1407 }
1408
1409 inline bool
1410 unary_operation_and_assign_dispatchcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/unary_operation_and_assign_dispatch(87315b471eaeeef5).(grn_ctx *ctx,
1411 ExecuteDatacxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData# &data,
1412 grn_operator op)
1413 {
1414 grn_obj *variable = nullptr;
1415 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1alloc1(ctx, data, variable, data.res));
1416 if (variable->headercxx . . $ _grn_obj#header..type != GRN_PTRcxx . . $ `include/groonga/groonga.h:873:9`!) {
1417 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
1418 "invalid variable type: %s(0x%0x)",
1419 grn_obj_type_to_string(variable->header.type),
1420 variable->header.type);
1421 return false;
1422 }
1423 if (GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(variable) != (sizeof(grn_obj *) + sizeof(grn_id))) {
1424 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
1425 "invalid variable size: "
1426 "expected: %" GRN_FMT_SIZEcxx . . $ `lib/grn.h:408:11`! "actual: %" GRN_FMT_SIZEcxx . . $ `lib/grn.h:408:11`!,
1427 (sizeof(grn_obj *) + sizeof(grn_id)),
1428 GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(variable));
1429 return false;
1430 }
1431 auto column = GRN_PTR_VALUEcxx . . $ `include/groonga/groonga.h:3111:9`!(variable);
1432 auto rid =
1433 *reinterpret_cast<grn_id *>(GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(variable) + sizeof(grn_obj *));
1434 data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res.->headercxx . . $ _grn_obj#header..type = GRN_VOIDcxx . . $ `include/groonga/groonga.h:863:9`!;
1435 data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res.->headercxx . . $ _grn_obj#header..domain = DB_OBJcxx . . $ `lib/grn_db.h:62:9`!(column)->range;
1436 grn_obj value;
1437 int32_t delta = 1;
1438 int set_flags = (op == GRN_OP_INCR || op == GRN_OP_INCR_POST)
1439 ? GRN_OBJ_INCRcxx . . $ `include/groonga/groonga.h:1470:9`!
1440 : GRN_OBJ_DECRcxx . . $ `include/groonga/groonga.h:1474:9`!;
1441 switch (DB_OBJcxx . . $ `lib/grn_db.h:62:9`!(column)->range) {
1442 case GRN_DB_INT8:
1443 GRN_INT8_INITcxx . . $ `include/groonga/groonga.h:2844:9`!(&value, 0);
1444 GRN_INT8_SETcxx . . $ `include/groonga/groonga.h:2884:9`!(ctx, &value, delta);
1445 break;
1446 case GRN_DB_UINT8:
1447 GRN_UINT8_INITcxx . . $ `include/groonga/groonga.h:2846:9`!(&value, 0);
1448 GRN_UINT8_SETcxx . . $ `include/groonga/groonga.h:2889:9`!(ctx, &value, delta);
1449 break;
1450 case GRN_DB_INT16:
1451 GRN_INT16_INITcxx . . $ `include/groonga/groonga.h:2848:9`!(&value, 0);
1452 GRN_INT16_SETcxx . . $ `include/groonga/groonga.h:2894:9`!(ctx, &value, delta);
1453 break;
1454 case GRN_DB_UINT16:
1455 GRN_UINT16_INITcxx . . $ `include/groonga/groonga.h:2850:9`!(&value, 0);
1456 GRN_UINT16_SETcxx . . $ `include/groonga/groonga.h:2899:9`!(ctx, &value, delta);
1457 break;
1458 case GRN_DB_INT32:
1459 GRN_INT32_INITcxx . . $ `include/groonga/groonga.h:2852:9`!(&value, 0);
1460 GRN_INT32_SETcxx . . $ `include/groonga/groonga.h:2904:9`!(ctx, &value, delta);
1461 break;
1462 case GRN_DB_UINT32:
1463 GRN_UINT32_INITcxx . . $ `include/groonga/groonga.h:2854:9`!(&value, 0);
1464 GRN_UINT32_SETcxx . . $ `include/groonga/groonga.h:2909:9`!(ctx, &value, delta);
1465 break;
1466 case GRN_DB_INT64:
1467 GRN_INT64_INITcxx . . $ `include/groonga/groonga.h:2856:9`!(&value, 0);
1468 GRN_INT64_SETcxx . . $ `include/groonga/groonga.h:2914:9`!(ctx, &value, delta);
1469 break;
1470 case GRN_DB_UINT64:
1471 GRN_UINT64_INITcxx . . $ `include/groonga/groonga.h:2858:9`!(&value, 0);
1472 GRN_UINT64_SETcxx . . $ `include/groonga/groonga.h:2919:9`!(ctx, &value, delta);
1473 break;
1474 case GRN_DB_FLOAT32:
1475 GRN_FLOAT32_INITcxx . . $ `include/groonga/groonga.h:2862:9`!(&value, 0);
1476 GRN_FLOAT32_SETcxx . . $ `include/groonga/groonga.h:2929:9`!(ctx, &value, delta);
1477 break;
1478 case GRN_DB_FLOAT:
1479 GRN_FLOAT_INITcxx . . $ `include/groonga/groonga.h:2864:9`!(&value, 0);
1480 GRN_FLOAT_SETcxx . . $ `include/groonga/groonga.h:2934:9`!(ctx, &value, delta);
1481 break;
1482 case GRN_DB_TIME:
1483 GRN_TIME_INITcxx . . $ `include/groonga/groonga.h:2866:9`!(&value, 0);
1484 GRN_TIME_SETcxx . . $ `include/groonga/groonga.h:2939:9`!(ctx, &value, GRN_TIME_PACKcxx . . $ `include/groonga/time.h:51:9`!(delta, 0));
1485 break;
1486 default:
1487 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
1488 "invalid %s target type: %d "
1489 "(FIXME: type name is needed)",
1490 grn_operator_to_script_syntax(op),
1491 DB_OBJcxx . . $ `lib/grn_db.h:62:9`!(column)->range);
1492 return false;
1493 }
1494 if (op == GRN_OP_INCR || op == GRN_OP_DECR) {
1495 grn_obj_set_value(ctx, column, rid, &value, set_flags);
1496 grn_obj_get_value(ctx, column, rid, data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res.);
1497 } else {
1498 grn_obj_get_value(ctx, column, rid, data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res.);
1499 grn_obj_set_value(ctx, column, rid, &value, set_flags);
1500 }
1501 data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.++;
1502 return true;
1503 }
1504
1505 inline bool
1506 operation_and_assign_dispatchcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/operation_and_assign_dispatch(87315b471eaeeef5).(grn_ctx *ctx,
1507 ExecuteDatacxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData# &data,
1508 grn_operator op)
1509 {
1510 grn_obj *value = nullptr;
1511 grn_obj *variable = nullptr;
1512 grn_obj *result = nullptr;
1513 if (data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.->value) {
1514 value = data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.->value;
1515 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1alloc1(ctx, data, variable, result));
1516 } else {
1517 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop2alloc1(ctx, data, variable, value, result));
1518 }
1519 if (!(variable->headercxx . . $ _grn_obj#header..type == GRN_PTRcxx . . $ `include/groonga/groonga.h:873:9`! &&
1520 GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(variable) == (sizeof(grn_obj *) + sizeof(grn_id)))) {
1521 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT, "left hand expression isn't column.");
1522 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, result));
1523 }
1524
1525 auto column = GRN_PTR_VALUEcxx . . $ `include/groonga/groonga.h:3111:9`!(variable);
1526 auto rid =
1527 *reinterpret_cast<grn_id *>(GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(variable) + sizeof(grn_obj *));
1528 value = GRN_OBJ_RESOLVEcxx . . $ `lib/grn_db.h:554:9`!(ctx, value);
1529 auto domain = grn_obj_get_range(ctx, column);
1530
1531 grn_obj variable_value;
1532 GRN_OBJ_INITcxx . . $ `include/groonga/groonga.h:947:9`!(&variable_value, GRN_BULKcxx . . $ `include/groonga/groonga.h:868:9`!, 0, domain);
1533 grn_obj_get_value(ctx, column, rid, &variable_value);
1534
1535 grn_obj casted_value;
1536 GRN_OBJ_INITcxx . . $ `include/groonga/groonga.h:947:9`!(&casted_value, GRN_BULKcxx . . $ `include/groonga/groonga.h:868:9`!, 0, domain);
1537 if (grn_obj_cast(ctx, value, &casted_value, false) != GRN_SUCCESS) {
1538 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT, "invalid value: string");
1539 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &variable_value);
1540 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &casted_value);
1541 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, result));
1542 return false;
1543 }
1544 auto success = arithmetic_binary_operation_dispatchcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/arithmetic_binary_operation_dispatch(1cebdc7cecf3d0a9).(ctx,
1545 data,
1546 op,
1547 &variable_value,
1548 &casted_value,
1549 result);
1550 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &variable_value);
1551 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &casted_value);
1552 if (!success) {
1553 return false;
1554 }
1555 grn_obj_set_value(ctx, column, rid, result, GRN_OBJ_SETcxx . . $ `include/groonga/groonga.h:1466:9`!);
1556 return true;
1557 }
1558 }; // namespace
1559
1560 static inline void
1561 grn_expr_exec_get_member_vectorcxx . . $ grn_expr_exec_get_member_vector(2f138204b87252a).(grn_ctx *ctx,
1562 grn_obj *expr,
1563 grn_obj *column_and_record_id,
1564 grn_obj *index,
1565 grn_obj *result)
1566 {
1567 grn_obj *column;
1568 grn_id record_id;
1569 grn_obj values;
1570 uint32_tcxx . . $ uint32_t# i;
1571
1572 column = GRN_PTR_VALUEcxx . . $ `include/groonga/groonga.h:3111:9`!(column_and_record_id);
1573 record_id = *((grn_id *)(&(GRN_PTR_VALUE_ATcxx . . $ `include/groonga/groonga.h:3150:9`!(column_and_record_id, 1))));
1574 GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&values, 0);
1575 grn_obj_get_value(ctx, column, record_id, &values);
1576
1577 i = GRN_UINT32_VALUEcxx . . $ `include/groonga/groonga.h:3103:9`!(index);
1578 if (values.headercxx . . $ _grn_obj#header..type == GRN_UVECTORcxx . . $ `include/groonga/groonga.h:875:9`!) {
1579 uint32_tcxx . . $ uint32_t# n_elements = 0;
1580 grn_obj *range;
1581 grn_id range_id = DB_OBJcxx . . $ `lib/grn_db.h:62:9`!(column)->range;
1582
1583 grn_obj_reinit(ctx, result, range_id, 0);
1584 range = grn_ctx_at(ctx, range_id);
1585 if (range) {
1586 switch (range->headercxx . . $ _grn_obj#header..type) {
1587 case GRN_TYPEcxx . . $ `include/groonga/groonga.h:892:9`!:
1588 n_elements = GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(&values) / grn_type_size(ctx, range);
1589 break;
1590 case GRN_TABLE_HASH_KEYcxx . . $ `include/groonga/groonga.h:895:9`!:
1591 case GRN_TABLE_PAT_KEYcxx . . $ `include/groonga/groonga.h:896:9`!:
1592 case GRN_TABLE_DAT_KEYcxx . . $ `include/groonga/groonga.h:897:9`!:
1593 case GRN_TABLE_NO_KEYcxx . . $ `include/groonga/groonga.h:898:9`!:
1594 n_elements = GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(&values) / sizeof(grn_id);
1595 break;
1596 }
1597 }
1598 if (n_elements > i) {
1599 #define GET_UVECTOR_ELEMENT_AScxx . . $ `lib/expr_executor.cpp:1599:9`!(type) \
1600 do { \
1601 GRN_##type##_SET(ctx, result, GRN_##type##_VALUE_AT(&values, i)); \
1602 } while (false)
1603 switch (values.headercxx . . $ _grn_obj#header..domain) {
1604 case GRN_DB_BOOL:
1605 GET_UVECTOR_ELEMENT_AScxx . . $ `lib/expr_executor.cpp:1599:9`!(BOOL);
1606 break;
1607 case GRN_DB_INT8:
1608 GET_UVECTOR_ELEMENT_AScxx . . $ `lib/expr_executor.cpp:1599:9`!(INT8);
1609 break;
1610 case GRN_DB_UINT8:
1611 GET_UVECTOR_ELEMENT_AScxx . . $ `lib/expr_executor.cpp:1599:9`!(UINT8);
1612 break;
1613 case GRN_DB_INT16:
1614 GET_UVECTOR_ELEMENT_AScxx . . $ `lib/expr_executor.cpp:1599:9`!(INT16);
1615 break;
1616 case GRN_DB_UINT16:
1617 GET_UVECTOR_ELEMENT_AScxx . . $ `lib/expr_executor.cpp:1599:9`!(UINT16);
1618 break;
1619 case GRN_DB_INT32:
1620 GET_UVECTOR_ELEMENT_AScxx . . $ `lib/expr_executor.cpp:1599:9`!(INT32);
1621 break;
1622 case GRN_DB_UINT32:
1623 GET_UVECTOR_ELEMENT_AScxx . . $ `lib/expr_executor.cpp:1599:9`!(UINT32);
1624 break;
1625 case GRN_DB_INT64:
1626 GET_UVECTOR_ELEMENT_AScxx . . $ `lib/expr_executor.cpp:1599:9`!(INT64);
1627 break;
1628 case GRN_DB_UINT64:
1629 GET_UVECTOR_ELEMENT_AScxx . . $ `lib/expr_executor.cpp:1599:9`!(UINT64);
1630 break;
1631 case GRN_DB_FLOAT32:
1632 GET_UVECTOR_ELEMENT_AScxx . . $ `lib/expr_executor.cpp:1599:9`!(FLOAT32);
1633 break;
1634 case GRN_DB_FLOAT:
1635 GET_UVECTOR_ELEMENT_AScxx . . $ `lib/expr_executor.cpp:1599:9`!(FLOAT);
1636 break;
1637 case GRN_DB_TIME:
1638 GET_UVECTOR_ELEMENT_AScxx . . $ `lib/expr_executor.cpp:1599:9`!(TIME);
1639 break;
1640 default:
1641 GET_UVECTOR_ELEMENT_AScxx . . $ `lib/expr_executor.cpp:1599:9`!(RECORD);
1642 break;
1643 }
1644 #undef GET_UVECTOR_ELEMENT_AScxx . . $ `lib/expr_executor.cpp:1599:9`!
1645 }
1646 } else {
1647 if (values.ucxx . . $ _grn_obj#u..vcxx . . $ _grn_obj#$anonymous_type_0#v..n_sectionscxx . . $ _grn_obj#$anonymous_type_0#$anonymous_type_2#n_sections. > i) {
1648 const char *content;
1649 unsigned int content_length;
1650 grn_id domain;
1651
1652 content_length =
1653 grn_vector_get_element(ctx, &values, i, &content, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!, &domain);
1654 grn_obj_reinit(ctx, result, domain, 0);
1655 grn_bulk_write(ctx, result, content, content_length);
1656 }
1657 }
1658
1659 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &values);
1660 }
1661
1662 static inline void
1663 grn_expr_exec_get_member_tablecxx . . $ grn_expr_exec_get_member_table(2f138204b87252a).(
1664 grn_ctx *ctx, grn_obj *expr, grn_obj *table, grn_obj *key, grn_obj *result)
1665 {
1666 grn_id id;
1667
1668 if (table->headercxx . . $ _grn_obj#header..domain == key->headercxx . . $ _grn_obj#header..domain) {
1669 id = grn_table_get(ctx, table, GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(key), GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(key));
1670 } else {
1671 grn_obj casted_key;
1672 GRN_OBJ_INITcxx . . $ `include/groonga/groonga.h:947:9`!(&casted_key, GRN_BULKcxx . . $ `include/groonga/groonga.h:868:9`!, 0, table->header.domain);
1673 if (grn_obj_cast(ctx, key, &casted_key, false) == GRN_SUCCESS) {
1674 id = grn_table_get(ctx,
1675 table,
1676 GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(&casted_key),
1677 GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(&casted_key));
1678 } else {
1679 id = GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
1680 }
1681 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &casted_key);
1682 }
1683
1684 grn_obj_reinit(ctx, result, DB_OBJcxx . . $ `lib/grn_db.h:62:9`!(table)->id, 0);
1685 GRN_RECORD_SETcxx . . $ `include/groonga/groonga.h:2940:9`!(ctx, result, id);
1686 }
1687
1688 static bool
1689 expr_exec_internalcxx . . $ expr_exec_internal(a5760e5c319a06ee).(grn_ctx *ctx, grn_obj *expr)
1690 {
1691 uint32_tcxx . . $ uint32_t# stack_curr = ctx->implcxx . . $ _grn_ctx#impl.->stack_currcxx . . $ _grn_ctx_impl#stack_curr.;
1692 ExecuteDatacxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData# data;
1693 data.ecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#e. = reinterpret_cast<grn_expr *>(expr);
1694 data.s_cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#s_. = ctx->implcxx . . $ _grn_ctx#impl.->stackcxx . . $ _grn_ctx_impl#stack.;
1695 data.s0cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#s0. = nullptr;
1696 data.s1cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#s1. = nullptr;
1697 data.spcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#sp. = nullptr;
1698 data.vpcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#vp. = data.ecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#e.->valuescxx . . $ _grn_expr#values.;
1699 data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res. = nullptr;
1700 data.v0cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#v0. = grn_expr_get_var_by_offset(ctx, expr, 0);
1701 data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code. = data.ecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#e.->codescxx . . $ _grn_expr#codes.;
1702 data.cecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#ce. = &(data.ecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#e.->codescxx . . $ _grn_expr#codes.[data.ecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#e.->codes_currcxx . . $ _grn_expr#codes_curr.]);
1703 data.spcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#sp. = data.s_cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#s_. + stack_curr;
1704 while (data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code. < data.cecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#ce.) {
1705 switch (data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.->op) {
1706 case GRN_OP_NOP:
1707 data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.++;
1708 break;
1709 case GRN_OP_PUSH:
1710 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(push1(ctx, data, data.code->value));
1711 data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.++;
1712 break;
1713 case GRN_OP_POP:
1714 {
1715 grn_obj *obj = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
1716 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, obj));
1717 data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.++;
1718 }
1719 break;
1720 case GRN_OP_GET_REF:
1721 {
1722 grn_obj *col = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
1723 grn_obj *rec = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
1724 if (data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.->nargs == 1) {
1725 rec = data.v0cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#v0.;
1726 if (data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.->value) {
1727 col = data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.->value;
1728 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(alloc1(ctx, data, data.res));
1729 } else {
1730 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1alloc1(ctx, data, col, data.res));
1731 }
1732 } else {
1733 if (data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.->value) {
1734 col = data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.->value;
1735 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1alloc1(ctx, data, rec, data.res));
1736 } else {
1737 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop2alloc1(ctx, data, rec, col, data.res));
1738 }
1739 }
1740 if (col->headercxx . . $ _grn_obj#header..type == GRN_BULKcxx . . $ `include/groonga/groonga.h:868:9`!) {
1741 grn_obj *table = grn_ctx_at(ctx, GRN_OBJ_GET_DOMAINcxx . . $ `include/groonga/groonga.h:1803:9`!(rec));
1742 col =
1743 grn_obj_column(ctx, table, GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(col), GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(col));
1744 if (col) {
1745 grn_expr_take_obj(ctx, expr, col);
1746 }
1747 }
1748 if (col) {
1749 data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res.->headercxx . . $ _grn_obj#header..type = GRN_PTRcxx . . $ `include/groonga/groonga.h:873:9`!;
1750 data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res.->headercxx . . $ _grn_obj#header..domain = GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
1751 GRN_PTR_SETcxx . . $ `include/groonga/groonga.h:2945:9`!(ctx, data.res, col);
1752 GRN_UINT32_PUTcxx . . $ `include/groonga/groonga.h:3182:9`!(ctx, data.res, GRN_RECORD_VALUEcxx . . $ `include/groonga/groonga.h:3110:9`!(rec));
1753 } else {
1754 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT, "col resolve failed");
1755 return false;
1756 }
1757 data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.++;
1758 }
1759 break;
1760 case GRN_OP_CALL:
1761 {
1762 grn_obj *proc = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
1763 if (data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.->value) {
1764 if (data.spcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#sp. < data.s_cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#s_. + data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.->nargs - 1) {
1765 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT, "stack error");
1766 return false;
1767 }
1768 proc = data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.->value;
1769 with_spsavecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/with_spsave(a494dc215517b3b0).(ctx, data, [&]() {
1770 grn_proc_call(ctx, proc, data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.->nargs - 1, expr);
1771 });
1772 } else {
1773 int offset = data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.->nargs;
1774 if (data.spcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#sp. < data.s_cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#s_. + offset) {
1775 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT, "stack error");
1776 return false;
1777 }
1778 proc = data.spcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#sp.[-offset];
1779 if (grn_obj_is_window_function_proc(ctx, proc)) {
1780 grn_obj inspected;
1781 GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&inspected, 0);
1782 grn_inspect(ctx, &inspected, proc);
1783 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
1784 "window function can't be executed for each record: %.*s",
1785 (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&inspected),
1786 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&inspected));
1787 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &inspected);
1788 return false;
1789 } else {
1790 with_spsavecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/with_spsave(a494dc215517b3b0).(ctx, data, [&]() {
1791 grn_proc_call(ctx, proc, data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.->nargs - 1, expr);
1792 });
1793 }
1794 if (ctx->rccxx . . $ _grn_ctx#rc.) {
1795 return false;
1796 }
1797 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, data.res));
1798 {
1799 grn_obj *proc_;
1800 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, proc_));
1801 if (proc != proc_) {
1802 GRN_LOGcxx . . $ `include/groonga/groonga.h:2493:9`!(ctx, GRN_LOG_WARNING, "stack may be corrupt");
1803 }
1804 }
1805 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(push1(ctx, data, data.res));
1806 }
1807 }
1808 data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.++;
1809 break;
1810 case GRN_OP_INTERN:
1811 {
1812 grn_obj *obj = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
1813 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, obj));
1814 obj = GRN_OBJ_RESOLVEcxx . . $ `lib/grn_db.h:554:9`!(ctx, obj);
1815 data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res. =
1816 grn_expr_get_var(ctx, expr, GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(obj), GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(obj));
1817 if (!data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res.) {
1818 data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res. = grn_ctx_get(ctx, GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(obj), GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(obj));
1819 }
1820 if (!data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res.) {
1821 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT, "intern failed");
1822 return false;
1823 }
1824 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(push1(ctx, data, data.res));
1825 }
1826 data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.++;
1827 break;
1828 case GRN_OP_TABLE_CREATE:
1829 {
1830 grn_obj *value_type, *key_type, *flags, *name;
1831 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, value_type));
1832 value_type = GRN_OBJ_RESOLVEcxx . . $ `lib/grn_db.h:554:9`!(ctx, value_type);
1833 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, key_type));
1834 key_type = GRN_OBJ_RESOLVEcxx . . $ `lib/grn_db.h:554:9`!(ctx, key_type);
1835 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, flags));
1836 flags = GRN_OBJ_RESOLVEcxx . . $ `lib/grn_db.h:554:9`!(ctx, flags);
1837 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, name));
1838 name = GRN_OBJ_RESOLVEcxx . . $ `lib/grn_db.h:554:9`!(ctx, name);
1839 data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res. = grn_table_create(ctx,
1840 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(name),
1841 GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(name),
1842 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!,
1843 GRN_UINT32_VALUEcxx . . $ `include/groonga/groonga.h:3103:9`!(flags),
1844 key_type,
1845 value_type);
1846 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(push1(ctx, data, data.res));
1847 }
1848 data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.++;
1849 break;
1850 case GRN_OP_EXPR_GET_VAR:
1851 {
1852 grn_obj *name = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
1853 grn_obj *expr = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
1854 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, name));
1855 name = GRN_OBJ_RESOLVEcxx . . $ `lib/grn_db.h:554:9`!(ctx, name);
1856 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, expr));
1857 expr = GRN_OBJ_RESOLVEcxx . . $ `lib/grn_db.h:554:9`!(ctx, expr);
1858 switch (name->headercxx . . $ _grn_obj#header..domain) {
1859 case GRN_DB_INT32:
1860 data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res. =
1861 grn_expr_get_var_by_offset(ctx,
1862 expr,
1863 (unsigned int)GRN_INT32_VALUEcxx . . $ `include/groonga/groonga.h:3102:9`!(name));
1864 break;
1865 case GRN_DB_UINT32:
1866 data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res. =
1867 grn_expr_get_var_by_offset(ctx,
1868 expr,
1869 (unsigned int)GRN_UINT32_VALUEcxx . . $ `include/groonga/groonga.h:3103:9`!(name));
1870 break;
1871 case GRN_DB_INT64:
1872 data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res. =
1873 grn_expr_get_var_by_offset(ctx,
1874 expr,
1875 (unsigned int)GRN_INT64_VALUEcxx . . $ `include/groonga/groonga.h:3104:9`!(name));
1876 break;
1877 case GRN_DB_UINT64:
1878 data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res. =
1879 grn_expr_get_var_by_offset(ctx,
1880 expr,
1881 (unsigned int)GRN_UINT64_VALUEcxx . . $ `include/groonga/groonga.h:3105:9`!(name));
1882 break;
1883 case GRN_DB_SHORT_TEXT:
1884 case GRN_DB_TEXT:
1885 case GRN_DB_LONG_TEXT:
1886 data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res. = grn_expr_get_var(ctx,
1887 expr,
1888 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(name),
1889 GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(name));
1890 break;
1891 default:
1892 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT, "invalid type");
1893 return false;
1894 }
1895 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(push1(ctx, data, data.res));
1896 }
1897 data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.++;
1898 break;
1899 case GRN_OP_ASSIGN:
1900 {
1901 grn_obj *value = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
1902 grn_obj *var = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
1903 if (data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.->value) {
1904 value = data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.->value;
1905 } else {
1906 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, value));
1907 }
1908 value = GRN_OBJ_RESOLVEcxx . . $ `lib/grn_db.h:554:9`!(ctx, value);
1909 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, var));
1910 // var = GRN_OBJ_RESOLVE(ctx, var);
1911 if (var->headercxx . . $ _grn_obj#header..type == GRN_PTRcxx . . $ `include/groonga/groonga.h:873:9`! &&
1912 GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(var) == (sizeof(grn_obj *) + sizeof(grn_id))) {
1913 grn_obj *col = GRN_PTR_VALUEcxx . . $ `include/groonga/groonga.h:3111:9`!(var);
1914 grn_id rid = *(grn_id *)(GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(var) + sizeof(grn_obj *));
1915 grn_obj_set_value(ctx, col, rid, value, GRN_OBJ_SETcxx . . $ `include/groonga/groonga.h:1466:9`!);
1916 } else {
1917 var_set_valuecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/var_set_value(99eba0d3a8372d65).(ctx, var, value);
1918 }
1919 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(push1(ctx, data, value));
1920 }
1921 data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.++;
1922 break;
1923 case GRN_OP_STAR_ASSIGN:
1924 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(operation_and_assign_dispatch(ctx, data, GRN_OP_STAR_ASSIGN));
1925 break;
1926 case GRN_OP_SLASH_ASSIGN:
1927 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(operation_and_assign_dispatch(ctx, data, GRN_OP_SLASH_ASSIGN));
1928 break;
1929 case GRN_OP_MOD_ASSIGN:
1930 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(operation_and_assign_dispatch(ctx, data, GRN_OP_MOD_ASSIGN));
1931 break;
1932 case GRN_OP_PLUS_ASSIGN:
1933 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(operation_and_assign_dispatch(ctx, data, GRN_OP_PLUS_ASSIGN));
1934 break;
1935 case GRN_OP_MINUS_ASSIGN:
1936 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(operation_and_assign_dispatch(ctx, data, GRN_OP_MINUS_ASSIGN));
1937 break;
1938 case GRN_OP_SHIFTL_ASSIGN:
1939 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(operation_and_assign_dispatch(ctx, data, GRN_OP_SHIFTL_ASSIGN));
1940 break;
1941 case GRN_OP_SHIFTR_ASSIGN:
1942 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(operation_and_assign_dispatch(ctx, data, GRN_OP_SHIFTR));
1943 break;
1944 case GRN_OP_SHIFTRR_ASSIGN:
1945 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(operation_and_assign_dispatch(ctx, data, GRN_OP_SHIFTRR));
1946 break;
1947 case GRN_OP_AND_ASSIGN:
1948 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(operation_and_assign_dispatch(ctx, data, GRN_OP_AND_ASSIGN));
1949 break;
1950 case GRN_OP_OR_ASSIGN:
1951 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(operation_and_assign_dispatch(ctx, data, GRN_OP_OR_ASSIGN));
1952 break;
1953 case GRN_OP_XOR_ASSIGN:
1954 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(operation_and_assign_dispatch(ctx, data, GRN_OP_BITWISE_XOR));
1955 break;
1956 case GRN_OP_JUMP:
1957 data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code. += data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.->nargs + 1;
1958 break;
1959 case GRN_OP_CJUMP:
1960 {
1961 grn_obj *v = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
1962 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, v));
1963 if (!grn_obj_is_true(ctx, v)) {
1964 data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code. += data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.->nargs;
1965 }
1966 }
1967 data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.++;
1968 break;
1969 case GRN_OP_GET_VALUE:
1970 {
1971 grn_obj *col = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
1972 grn_obj *rec = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
1973 do {
1974 if (data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.->nargs == 1) {
1975 rec = data.v0cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#v0.;
1976 if (data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.->value) {
1977 col = data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.->value;
1978 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(alloc1(ctx, data, data.res));
1979 } else {
1980 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1alloc1(ctx, data, col, data.res));
1981 }
1982 } else {
1983 if (data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.->value) {
1984 col = data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.->value;
1985 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1alloc1(ctx, data, rec, data.res));
1986 } else {
1987 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop2alloc1(ctx, data, rec, col, data.res));
1988 }
1989 }
1990 if (col->headercxx . . $ _grn_obj#header..type == GRN_BULKcxx . . $ `include/groonga/groonga.h:868:9`!) {
1991 grn_obj *table = grn_ctx_at(ctx, GRN_OBJ_GET_DOMAINcxx . . $ `include/groonga/groonga.h:1803:9`!(rec));
1992 col = grn_obj_column(ctx,
1993 table,
1994 GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(col),
1995 GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(col));
1996 if (col) {
1997 grn_expr_take_obj(ctx, expr, col);
1998 }
1999 }
2000 if (!col) {
2001 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT, "col resolve failed");
2002 return false;
2003 }
2004 grn_obj_reinit_for(ctx, data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res., col);
2005 grn_obj_get_value(ctx, col, GRN_RECORD_VALUEcxx . . $ `include/groonga/groonga.h:3110:9`!(rec), data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res.);
2006 data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.++;
2007 } while (data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code. < data.cecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#ce. && data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.->op == GRN_OP_GET_VALUE);
2008 }
2009 break;
2010 case GRN_OP_OBJ_SEARCH:
2011 {
2012 grn_obj *op = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2013 grn_obj *query = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2014 grn_obj *index = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2015 // todo : grn_search_optarg optarg;
2016 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, op));
2017 op = GRN_OBJ_RESOLVEcxx . . $ `lib/grn_db.h:554:9`!(ctx, op);
2018 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, data.res));
2019 data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res. = GRN_OBJ_RESOLVEcxx . . $ `lib/grn_db.h:554:9`!(ctx, data.res);
2020 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, query));
2021 query = GRN_OBJ_RESOLVEcxx . . $ `lib/grn_db.h:554:9`!(ctx, query);
2022 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, index));
2023 index = GRN_OBJ_RESOLVEcxx . . $ `lib/grn_db.h:554:9`!(ctx, index);
2024 grn_obj_search(ctx,
2025 index,
2026 query,
2027 data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res.,
2028 (grn_operator)GRN_UINT32_VALUEcxx . . $ `include/groonga/groonga.h:3103:9`!(op),
2029 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!);
2030 }
2031 data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.++;
2032 break;
2033 case GRN_OP_TABLE_SELECT:
2034 {
2035 grn_obj *op = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2036 grn_obj *res = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2037 grn_obj *expr = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2038 grn_obj *table = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2039 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, op));
2040 op = GRN_OBJ_RESOLVEcxx . . $ `lib/grn_db.h:554:9`!(ctx, op);
2041 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, res));
2042 res = GRN_OBJ_RESOLVEcxx . . $ `lib/grn_db.h:554:9`!(ctx, res);
2043 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, expr));
2044 expr = GRN_OBJ_RESOLVEcxx . . $ `lib/grn_db.h:554:9`!(ctx, expr);
2045 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, table));
2046 table = GRN_OBJ_RESOLVEcxx . . $ `lib/grn_db.h:554:9`!(ctx, table);
2047 with_spsavecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/with_spsave(a494dc215517b3b0).(ctx, data, [&]() {
2048 grn_table_select(ctx,
2049 table,
2050 expr,
2051 res,
2052 static_cast<grn_operator>(GRN_UINT32_VALUEcxx . . $ `include/groonga/groonga.h:3103:9`!(op)));
2053 });
2054 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(push1(ctx, data, res));
2055 }
2056 data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.++;
2057 break;
2058 case GRN_OP_TABLE_SORT:
2059 {
2060 grn_obj *keys_ = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2061 grn_obj *res = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2062 grn_obj *limit = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2063 grn_obj *table = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2064 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, keys_));
2065 keys_ = GRN_OBJ_RESOLVEcxx . . $ `lib/grn_db.h:554:9`!(ctx, keys_);
2066 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, res));
2067 res = GRN_OBJ_RESOLVEcxx . . $ `lib/grn_db.h:554:9`!(ctx, res);
2068 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, limit));
2069 limit = GRN_OBJ_RESOLVEcxx . . $ `lib/grn_db.h:554:9`!(ctx, limit);
2070 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, table));
2071 table = GRN_OBJ_RESOLVEcxx . . $ `lib/grn_db.h:554:9`!(ctx, table);
2072 {
2073 grn_table_sort_key *keys;
2074 const char *p = GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(keys_), *tokbuf[256];
2075 int n = grn_str_tok(p, GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(keys_), ' ', tokbuf, 256, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!);
2076 if ((keys = GRN_MALLOCNcxx . . $ `lib/grn_alloc.h:50:9`!(grn_table_sort_key, n))) {
2077 int i, n_keys = 0;
2078 for (i = 0; i < n; i++) {
2079 uint32_tcxx . . $ uint32_t# len = (uint32_tcxx . . $ uint32_t#)(tokbuf[i] - p);
2080 grn_obj *col = grn_obj_column(ctx, table, p, len);
2081 if (col) {
2082 keys[n_keys].keycxx . . $ _grn_table_sort_key#key. = col;
2083 keys[n_keys].flagscxx . . $ _grn_table_sort_key#flags. = GRN_TABLE_SORT_ASCcxx . . $ `include/groonga/table.h:679:9`!;
2084 keys[n_keys].offsetcxx . . $ _grn_table_sort_key#offset. = 0;
2085 n_keys++;
2086 } else {
2087 if (p[0] == ':' && p[1] == 'd' && len == 2 && n_keys) {
2088 keys[n_keys - 1].flagscxx . . $ _grn_table_sort_key#flags. |= GRN_TABLE_SORT_DESCcxx . . $ `include/groonga/table.h:683:9`!;
2089 }
2090 }
2091 p = tokbuf[i] + 1;
2092 }
2093 with_spsavecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/with_spsave(a494dc215517b3b0).(ctx, data, [&]() {
2094 grn_table_sort(ctx,
2095 table,
2096 0,
2097 GRN_INT32_VALUEcxx . . $ `include/groonga/groonga.h:3102:9`!(limit),
2098 res,
2099 keys,
2100 n_keys);
2101 });
2102 for (i = 0; i < n_keys; i++) {
2103 grn_obj_unlink(ctx, keys[i].keycxx . . $ _grn_table_sort_key#key.);
2104 }
2105 GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(keys);
2106 }
2107 }
2108 }
2109 data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.++;
2110 break;
2111 case GRN_OP_TABLE_GROUP:
2112 {
2113 grn_obj *res = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2114 grn_obj *keys_ = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2115 grn_obj *table = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2116 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, res));
2117 res = GRN_OBJ_RESOLVEcxx . . $ `lib/grn_db.h:554:9`!(ctx, res);
2118 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, keys_));
2119 keys_ = GRN_OBJ_RESOLVEcxx . . $ `lib/grn_db.h:554:9`!(ctx, keys_);
2120 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, table));
2121 table = GRN_OBJ_RESOLVEcxx . . $ `lib/grn_db.h:554:9`!(ctx, table);
2122 {
2123 grn_table_sort_key *keys;
2124 grn_table_group_result results;
2125 const char *p = GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(keys_), *tokbuf[256];
2126 int n = grn_str_tok(p, GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(keys_), ' ', tokbuf, 256, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!);
2127 if ((keys = GRN_MALLOCNcxx . . $ `lib/grn_alloc.h:50:9`!(grn_table_sort_key, n))) {
2128 int i, n_keys = 0;
2129 for (i = 0; i < n; i++) {
2130 uint32_tcxx . . $ uint32_t# len = (uint32_tcxx . . $ uint32_t#)(tokbuf[i] - p);
2131 grn_obj *col = grn_obj_column(ctx, table, p, len);
2132 if (col) {
2133 keys[n_keys].keycxx . . $ _grn_table_sort_key#key. = col;
2134 keys[n_keys].flagscxx . . $ _grn_table_sort_key#flags. = GRN_TABLE_SORT_ASCcxx . . $ `include/groonga/table.h:679:9`!;
2135 keys[n_keys].offsetcxx . . $ _grn_table_sort_key#offset. = 0;
2136 n_keys++;
2137 } else if (n_keys) {
2138 if (p[0] == ':' && p[1] == 'd' && len == 2) {
2139 keys[n_keys - 1].flagscxx . . $ _grn_table_sort_key#flags. |= GRN_TABLE_SORT_DESCcxx . . $ `include/groonga/table.h:683:9`!;
2140 } else {
2141 keys[n_keys - 1].offsetcxx . . $ _grn_table_sort_key#offset. = grn_atoi(p, p + len, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!);
2142 }
2143 }
2144 p = tokbuf[i] + 1;
2145 }
2146 /* todo : support multi-results */
2147 results.tablecxx . . $ _grn_table_group_result#table. = res;
2148 results.key_begincxx . . $ _grn_table_group_result#key_begin. = 0;
2149 results.key_endcxx . . $ _grn_table_group_result#key_end. = 0;
2150 results.limitcxx . . $ _grn_table_group_result#limit. = 0;
2151 results.flagscxx . . $ _grn_table_group_result#flags. = 0;
2152 results.opcxx . . $ _grn_table_group_result#op. = GRN_OP_OR;
2153 with_spsavecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/with_spsave(a494dc215517b3b0).(ctx, data, [&]() {
2154 grn_table_group(ctx, table, keys, n_keys, &results, 1);
2155 });
2156 for (i = 0; i < n_keys; i++) {
2157 grn_obj_unlink(ctx, keys[i].keycxx . . $ _grn_table_sort_key#key.);
2158 }
2159 GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(keys);
2160 }
2161 }
2162 }
2163 data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.++;
2164 break;
2165 case GRN_OP_JSON_PUT:
2166 {
2167 grn_obj_format format;
2168 grn_obj *res = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2169 grn_obj *str = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2170 grn_obj *table = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2171 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, res));
2172 res = GRN_OBJ_RESOLVEcxx . . $ `lib/grn_db.h:554:9`!(ctx, res);
2173 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, str));
2174 str = GRN_OBJ_RESOLVEcxx . . $ `lib/grn_db.h:554:9`!(ctx, str);
2175 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, table));
2176 table = GRN_OBJ_RESOLVEcxx . . $ `lib/grn_db.h:554:9`!(ctx, table);
2177 GRN_OBJ_FORMAT_INITcxx . . $ `include/groonga/output.h:59:9`!(&format, grn_table_size(ctx, table), 0, -1, 0);
2178 format.flagscxx . . $ _grn_obj_format#flags. = 0;
2179 grn_obj_columns(ctx,
2180 table,
2181 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(str),
2182 GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(str),
2183 &format.columnscxx . . $ _grn_obj_format#columns.);
2184 grn_text_otoj(ctx, res, table, &format);
2185 grn_obj_format_fin(ctx, &format);
2186 }
2187 data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.++;
2188 break;
2189 case GRN_OP_AND:
2190 {
2191 grn_obj *x = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2192 grn_obj *y = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2193 grn_obj *result = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2194 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop2alloc1(ctx, data, x, y, data.res));
2195 if (grn_obj_is_true(ctx, x)) {
2196 if (grn_obj_is_true(ctx, y)) {
2197 result = y;
2198 }
2199 }
2200 if (result) {
2201 if (data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res. != result) {
2202 grn_bulk_copy(ctx, result, data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res.);
2203 }
2204 } else {
2205 grn_obj_reinit(ctx, data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res., GRN_DB_BOOL, 0);
2206 GRN_BOOL_SETcxx . . $ `include/groonga/groonga.h:2879:9`!(ctx, data.res, false);
2207 }
2208 }
2209 data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.++;
2210 break;
2211 case GRN_OP_OR:
2212 {
2213 grn_obj *x = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2214 grn_obj *y = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2215 grn_obj *result = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2216 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop2alloc1(ctx, data, x, y, data.res));
2217 if (grn_obj_is_true(ctx, x)) {
2218 result = x;
2219 } else {
2220 if (grn_obj_is_true(ctx, y)) {
2221 result = y;
2222 } else {
2223 result = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2224 }
2225 }
2226 if (result) {
2227 if (data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res. != result) {
2228 grn_bulk_copy(ctx, result, data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res.);
2229 }
2230 } else {
2231 grn_obj_reinit(ctx, data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res., GRN_DB_BOOL, 0);
2232 GRN_BOOL_SETcxx . . $ `include/groonga/groonga.h:2879:9`!(ctx, data.res, false);
2233 }
2234 }
2235 data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.++;
2236 break;
2237 case GRN_OP_AND_NOT:
2238 {
2239 grn_obj *x = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2240 grn_obj *y = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2241 bool is_true = false;
2242 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop2alloc1(ctx, data, x, y, data.res));
2243 if (!grn_obj_is_true(ctx, x) || grn_obj_is_true(ctx, y)) {
2244 is_true = false;
2245 } else {
2246 is_true = true;
2247 }
2248 grn_obj_reinit(ctx, data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res., GRN_DB_BOOL, 0);
2249 GRN_BOOL_SETcxx . . $ `include/groonga/groonga.h:2879:9`!(ctx, data.res, is_true);
2250 }
2251 data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.++;
2252 break;
2253 case GRN_OP_ADJUST:
2254 {
2255 /* todo */
2256 }
2257 data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.++;
2258 break;
2259 case GRN_OP_MATCH:
2260 {
2261 grn_obj *x = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2262 grn_obj *y = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2263 bool matched;
2264 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, y));
2265 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, x));
2266 with_spsavecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/with_spsave(a494dc215517b3b0).(ctx, data, [&]() {
2267 matched = grn_operator_exec_match(ctx, x, y);
2268 });
2269 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(alloc1(ctx, data, data.res));
2270 grn_obj_reinit(ctx, data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res., GRN_DB_BOOL, 0);
2271 GRN_BOOL_SETcxx . . $ `include/groonga/groonga.h:2879:9`!(ctx, data.res, matched);
2272 }
2273 data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.++;
2274 break;
2275 case GRN_OP_EQUAL:
2276 {
2277 grn_obj *x = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2278 grn_obj *y = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2279 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop2alloc1(ctx, data, x, y, data.res));
2280 bool is_equal = grn_operator_exec_equal(ctx, x, y);
2281 grn_obj_reinit(ctx, data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res., GRN_DB_BOOL, 0);
2282 GRN_BOOL_SETcxx . . $ `include/groonga/groonga.h:2879:9`!(ctx, data.res, is_equal);
2283 }
2284 data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.++;
2285 break;
2286 case GRN_OP_NOT_EQUAL:
2287 {
2288 grn_obj *x = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2289 grn_obj *y = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2290 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop2alloc1(ctx, data, x, y, data.res));
2291 bool is_not_equal = grn_operator_exec_not_equal(ctx, x, y);
2292 grn_obj_reinit(ctx, data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res., GRN_DB_BOOL, 0);
2293 GRN_BOOL_SETcxx . . $ `include/groonga/groonga.h:2879:9`!(ctx, data.res, is_not_equal);
2294 }
2295 data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.++;
2296 break;
2297 case GRN_OP_PREFIX:
2298 {
2299 grn_obj *x = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2300 grn_obj *y = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2301 bool matched = false;
2302 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, y));
2303 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, x));
2304 with_spsavecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/with_spsave(a494dc215517b3b0).(ctx, data, [&]() {
2305 matched = grn_operator_exec_prefix(ctx, x, y);
2306 });
2307 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(alloc1(ctx, data, data.res));
2308 grn_obj_reinit(ctx, data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res., GRN_DB_BOOL, 0);
2309 GRN_BOOL_SETcxx . . $ `include/groonga/groonga.h:2879:9`!(ctx, data.res, matched);
2310 }
2311 data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.++;
2312 break;
2313 case GRN_OP_SUFFIX:
2314 {
2315 grn_obj *x = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2316 grn_obj *y = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2317 bool matched = false;
2318 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop2alloc1(ctx, data, x, y, data.res));
2319 if (GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(x) >= GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(y) &&
2320 !memcmp(GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(x) + GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(x) - GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(y),
2321 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(y),
2322 GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(y))) {
2323 matched = true;
2324 }
2325 grn_obj_reinit(ctx, data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res., GRN_DB_BOOL, 0);
2326 GRN_BOOL_SETcxx . . $ `include/groonga/groonga.h:2879:9`!(ctx, data.res, matched);
2327 }
2328 data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.++;
2329 break;
2330 case GRN_OP_LESS:
2331 {
2332 grn_obj *x = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2333 grn_obj *y = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2334 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop2alloc1(ctx, data, x, y, data.res));
2335 bool r = grn_operator_exec_less(ctx, x, y);
2336 grn_obj_reinit(ctx, data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res., GRN_DB_BOOL, 0);
2337 GRN_BOOL_SETcxx . . $ `include/groonga/groonga.h:2879:9`!(ctx, data.res, r);
2338 }
2339 data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.++;
2340 break;
2341 case GRN_OP_GREATER:
2342 {
2343 grn_obj *x = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2344 grn_obj *y = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2345 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop2alloc1(ctx, data, x, y, data.res));
2346 bool r = grn_operator_exec_greater(ctx, x, y);
2347 grn_obj_reinit(ctx, data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res., GRN_DB_BOOL, 0);
2348 GRN_BOOL_SETcxx . . $ `include/groonga/groonga.h:2879:9`!(ctx, data.res, r);
2349 }
2350 data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.++;
2351 break;
2352 case GRN_OP_LESS_EQUAL:
2353 {
2354 grn_obj *x = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2355 grn_obj *y = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2356 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop2alloc1(ctx, data, x, y, data.res));
2357 bool r = grn_operator_exec_less_equal(ctx, x, y);
2358 grn_obj_reinit(ctx, data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res., GRN_DB_BOOL, 0);
2359 GRN_BOOL_SETcxx . . $ `include/groonga/groonga.h:2879:9`!(ctx, data.res, r);
2360 }
2361 data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.++;
2362 break;
2363 case GRN_OP_GREATER_EQUAL:
2364 {
2365 grn_obj *x = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2366 grn_obj *y = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2367 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop2alloc1(ctx, data, x, y, data.res));
2368 bool r = grn_operator_exec_greater_equal(ctx, x, y);
2369 grn_obj_reinit(ctx, data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res., GRN_DB_BOOL, 0);
2370 GRN_BOOL_SETcxx . . $ `include/groonga/groonga.h:2879:9`!(ctx, data.res, r);
2371 }
2372 data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.++;
2373 break;
2374 case GRN_OP_GEO_DISTANCE1:
2375 {
2376 grn_obj *value = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2377 double lng1, lat1, lng2, lat2, x, y, d;
2378 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, value));
2379 lng1 = GRN_GEO_MSEC2RADIANcxx . . $ `include/groonga/groonga.h:2958:9`!(GRN_INT32_VALUEcxx . . $ `include/groonga/groonga.h:3102:9`!(value));
2380 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, value));
2381 lat1 = GRN_GEO_MSEC2RADIANcxx . . $ `include/groonga/groonga.h:2958:9`!(GRN_INT32_VALUEcxx . . $ `include/groonga/groonga.h:3102:9`!(value));
2382 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, value));
2383 lng2 = GRN_GEO_MSEC2RADIANcxx . . $ `include/groonga/groonga.h:2958:9`!(GRN_INT32_VALUEcxx . . $ `include/groonga/groonga.h:3102:9`!(value));
2384 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1alloc1(ctx, data, value, data.res));
2385 lat2 = GRN_GEO_MSEC2RADIANcxx . . $ `include/groonga/groonga.h:2958:9`!(GRN_INT32_VALUEcxx . . $ `include/groonga/groonga.h:3102:9`!(value));
2386 x = (lng2 - lng1) * cos((lat1 + lat2) * 0.5);
2387 y = (lat2 - lat1);
2388 d = sqrt((x * x) + (y * y)) * GEO_RADIOUScxx . . $ `lib/expr_executor.cpp:43:9`!;
2389 data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res.->headercxx . . $ _grn_obj#header..type = GRN_BULKcxx . . $ `include/groonga/groonga.h:868:9`!;
2390 data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res.->headercxx . . $ _grn_obj#header..domain = GRN_DB_FLOAT;
2391 GRN_FLOAT_SETcxx . . $ `include/groonga/groonga.h:2934:9`!(ctx, data.res, d);
2392 }
2393 data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.++;
2394 break;
2395 case GRN_OP_GEO_DISTANCE2:
2396 {
2397 grn_obj *value = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2398 double lng1, lat1, lng2, lat2, x, y, d;
2399 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, value));
2400 lng1 = GRN_GEO_MSEC2RADIANcxx . . $ `include/groonga/groonga.h:2958:9`!(GRN_INT32_VALUEcxx . . $ `include/groonga/groonga.h:3102:9`!(value));
2401 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, value));
2402 lat1 = GRN_GEO_MSEC2RADIANcxx . . $ `include/groonga/groonga.h:2958:9`!(GRN_INT32_VALUEcxx . . $ `include/groonga/groonga.h:3102:9`!(value));
2403 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, value));
2404 lng2 = GRN_GEO_MSEC2RADIANcxx . . $ `include/groonga/groonga.h:2958:9`!(GRN_INT32_VALUEcxx . . $ `include/groonga/groonga.h:3102:9`!(value));
2405 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1alloc1(ctx, data, value, data.res));
2406 lat2 = GRN_GEO_MSEC2RADIANcxx . . $ `include/groonga/groonga.h:2958:9`!(GRN_INT32_VALUEcxx . . $ `include/groonga/groonga.h:3102:9`!(value));
2407 x = sin(fabs(lng2 - lng1) * 0.5);
2408 y = sin(fabs(lat2 - lat1) * 0.5);
2409 d =
2410 asin(sqrt((y * y) + cos(lat1) * cos(lat2) * x * x)) * 2 * GEO_RADIOUScxx . . $ `lib/expr_executor.cpp:43:9`!;
2411 data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res.->headercxx . . $ _grn_obj#header..type = GRN_BULKcxx . . $ `include/groonga/groonga.h:868:9`!;
2412 data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res.->headercxx . . $ _grn_obj#header..domain = GRN_DB_FLOAT;
2413 GRN_FLOAT_SETcxx . . $ `include/groonga/groonga.h:2934:9`!(ctx, data.res, d);
2414 }
2415 data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.++;
2416 break;
2417 case GRN_OP_GEO_DISTANCE3:
2418 {
2419 grn_obj *value = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2420 double lng1, lat1, lng2, lat2, p, q, m, n, x, y, d;
2421 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, value));
2422 lng1 = GRN_GEO_MSEC2RADIANcxx . . $ `include/groonga/groonga.h:2958:9`!(GRN_INT32_VALUEcxx . . $ `include/groonga/groonga.h:3102:9`!(value));
2423 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, value));
2424 lat1 = GRN_GEO_MSEC2RADIANcxx . . $ `include/groonga/groonga.h:2958:9`!(GRN_INT32_VALUEcxx . . $ `include/groonga/groonga.h:3102:9`!(value));
2425 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, value));
2426 lng2 = GRN_GEO_MSEC2RADIANcxx . . $ `include/groonga/groonga.h:2958:9`!(GRN_INT32_VALUEcxx . . $ `include/groonga/groonga.h:3102:9`!(value));
2427 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1alloc1(ctx, data, value, data.res));
2428 lat2 = GRN_GEO_MSEC2RADIANcxx . . $ `include/groonga/groonga.h:2958:9`!(GRN_INT32_VALUEcxx . . $ `include/groonga/groonga.h:3102:9`!(value));
2429 p = (lat1 + lat2) * 0.5;
2430 q = (1 - GEO_BES_C3cxx . . $ `lib/expr_executor.cpp:46:9`! * sin(p) * sin(p));
2431 m = GEO_BES_C1cxx . . $ `lib/expr_executor.cpp:44:9`! / sqrt(q * q * q);
2432 n = GEO_BES_C2cxx . . $ `lib/expr_executor.cpp:45:9`! / sqrt(q);
2433 x = n * cos(p) * fabs(lng1 - lng2);
2434 y = m * fabs(lat1 - lat2);
2435 d = sqrt((x * x) + (y * y));
2436 data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res.->headercxx . . $ _grn_obj#header..type = GRN_BULKcxx . . $ `include/groonga/groonga.h:868:9`!;
2437 data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res.->headercxx . . $ _grn_obj#header..domain = GRN_DB_FLOAT;
2438 GRN_FLOAT_SETcxx . . $ `include/groonga/groonga.h:2934:9`!(ctx, data.res, d);
2439 }
2440 data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.++;
2441 break;
2442 case GRN_OP_GEO_DISTANCE4:
2443 {
2444 grn_obj *value = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2445 double lng1, lat1, lng2, lat2, p, q, m, n, x, y, d;
2446 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, value));
2447 lng1 = GRN_GEO_MSEC2RADIANcxx . . $ `include/groonga/groonga.h:2958:9`!(GRN_INT32_VALUEcxx . . $ `include/groonga/groonga.h:3102:9`!(value));
2448 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, value));
2449 lat1 = GRN_GEO_MSEC2RADIANcxx . . $ `include/groonga/groonga.h:2958:9`!(GRN_INT32_VALUEcxx . . $ `include/groonga/groonga.h:3102:9`!(value));
2450 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, value));
2451 lng2 = GRN_GEO_MSEC2RADIANcxx . . $ `include/groonga/groonga.h:2958:9`!(GRN_INT32_VALUEcxx . . $ `include/groonga/groonga.h:3102:9`!(value));
2452 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1alloc1(ctx, data, value, data.res));
2453 lat2 = GRN_GEO_MSEC2RADIANcxx . . $ `include/groonga/groonga.h:2958:9`!(GRN_INT32_VALUEcxx . . $ `include/groonga/groonga.h:3102:9`!(value));
2454 p = (lat1 + lat2) * 0.5;
2455 q = (1 - GEO_GRS_C3cxx . . $ `lib/expr_executor.cpp:49:9`! * sin(p) * sin(p));
2456 m = GEO_GRS_C1cxx . . $ `lib/expr_executor.cpp:47:9`! / sqrt(q * q * q);
2457 n = GEO_GRS_C2cxx . . $ `lib/expr_executor.cpp:48:9`! / sqrt(q);
2458 x = n * cos(p) * fabs(lng1 - lng2);
2459 y = m * fabs(lat1 - lat2);
2460 d = sqrt((x * x) + (y * y));
2461 data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res.->headercxx . . $ _grn_obj#header..type = GRN_BULKcxx . . $ `include/groonga/groonga.h:868:9`!;
2462 data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res.->headercxx . . $ _grn_obj#header..domain = GRN_DB_FLOAT;
2463 GRN_FLOAT_SETcxx . . $ `include/groonga/groonga.h:2934:9`!(ctx, data.res, d);
2464 }
2465 data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.++;
2466 break;
2467 case GRN_OP_GEO_WITHINP5:
2468 {
2469 int r;
2470 grn_obj *value = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2471 double lng0, lat0, lng1, lat1, x, y, d;
2472 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, value));
2473 lng0 = GRN_GEO_MSEC2RADIANcxx . . $ `include/groonga/groonga.h:2958:9`!(GRN_INT32_VALUEcxx . . $ `include/groonga/groonga.h:3102:9`!(value));
2474 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, value));
2475 lat0 = GRN_GEO_MSEC2RADIANcxx . . $ `include/groonga/groonga.h:2958:9`!(GRN_INT32_VALUEcxx . . $ `include/groonga/groonga.h:3102:9`!(value));
2476 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, value));
2477 lng1 = GRN_GEO_MSEC2RADIANcxx . . $ `include/groonga/groonga.h:2958:9`!(GRN_INT32_VALUEcxx . . $ `include/groonga/groonga.h:3102:9`!(value));
2478 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, value));
2479 lat1 = GRN_GEO_MSEC2RADIANcxx . . $ `include/groonga/groonga.h:2958:9`!(GRN_INT32_VALUEcxx . . $ `include/groonga/groonga.h:3102:9`!(value));
2480 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1alloc1(ctx, data, value, data.res));
2481 x = (lng1 - lng0) * cos((lat0 + lat1) * 0.5);
2482 y = (lat1 - lat0);
2483 d = sqrt((x * x) + (y * y)) * GEO_RADIOUScxx . . $ `lib/expr_executor.cpp:43:9`!;
2484 switch (value->headercxx . . $ _grn_obj#header..domain) {
2485 case GRN_DB_INT32:
2486 r = d <= GRN_INT32_VALUEcxx . . $ `include/groonga/groonga.h:3102:9`!(value);
2487 break;
2488 case GRN_DB_FLOAT:
2489 r = d <= GRN_FLOAT_VALUEcxx . . $ `include/groonga/groonga.h:3108:9`!(value);
2490 break;
2491 default:
2492 r = 0;
2493 break;
2494 }
2495 GRN_INT32_SETcxx . . $ `include/groonga/groonga.h:2904:9`!(ctx, data.res, r);
2496 data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res.->headercxx . . $ _grn_obj#header..type = GRN_BULKcxx . . $ `include/groonga/groonga.h:868:9`!;
2497 data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res.->headercxx . . $ _grn_obj#header..domain = GRN_DB_INT32;
2498 }
2499 data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.++;
2500 break;
2501 case GRN_OP_GEO_WITHINP6:
2502 {
2503 int r;
2504 grn_obj *value = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2505 double lng0, lat0, lng1, lat1, lng2, lat2, x, y, d;
2506 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, value));
2507 lng0 = GRN_GEO_MSEC2RADIANcxx . . $ `include/groonga/groonga.h:2958:9`!(GRN_INT32_VALUEcxx . . $ `include/groonga/groonga.h:3102:9`!(value));
2508 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, value));
2509 lat0 = GRN_GEO_MSEC2RADIANcxx . . $ `include/groonga/groonga.h:2958:9`!(GRN_INT32_VALUEcxx . . $ `include/groonga/groonga.h:3102:9`!(value));
2510 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, value));
2511 lng1 = GRN_GEO_MSEC2RADIANcxx . . $ `include/groonga/groonga.h:2958:9`!(GRN_INT32_VALUEcxx . . $ `include/groonga/groonga.h:3102:9`!(value));
2512 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, value));
2513 lat1 = GRN_GEO_MSEC2RADIANcxx . . $ `include/groonga/groonga.h:2958:9`!(GRN_INT32_VALUEcxx . . $ `include/groonga/groonga.h:3102:9`!(value));
2514 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, value));
2515 lng2 = GRN_GEO_MSEC2RADIANcxx . . $ `include/groonga/groonga.h:2958:9`!(GRN_INT32_VALUEcxx . . $ `include/groonga/groonga.h:3102:9`!(value));
2516 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1alloc1(ctx, data, value, data.res));
2517 lat2 = GRN_GEO_MSEC2RADIANcxx . . $ `include/groonga/groonga.h:2958:9`!(GRN_INT32_VALUEcxx . . $ `include/groonga/groonga.h:3102:9`!(value));
2518 x = (lng1 - lng0) * cos((lat0 + lat1) * 0.5);
2519 y = (lat1 - lat0);
2520 d = (x * x) + (y * y);
2521 x = (lng2 - lng1) * cos((lat1 + lat2) * 0.5);
2522 y = (lat2 - lat1);
2523 r = d <= (x * x) + (y * y);
2524 GRN_INT32_SETcxx . . $ `include/groonga/groonga.h:2904:9`!(ctx, data.res, r);
2525 data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res.->headercxx . . $ _grn_obj#header..type = GRN_BULKcxx . . $ `include/groonga/groonga.h:868:9`!;
2526 data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res.->headercxx . . $ _grn_obj#header..domain = GRN_DB_INT32;
2527 }
2528 data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.++;
2529 break;
2530 case GRN_OP_GEO_WITHINP8:
2531 {
2532 int r;
2533 grn_obj *value = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2534 int64_t ln0, la0, ln1, la1, ln2, la2, ln3, la3;
2535 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, value));
2536 ln0 = GRN_INT32_VALUEcxx . . $ `include/groonga/groonga.h:3102:9`!(value);
2537 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, value));
2538 la0 = GRN_INT32_VALUEcxx . . $ `include/groonga/groonga.h:3102:9`!(value);
2539 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, value));
2540 ln1 = GRN_INT32_VALUEcxx . . $ `include/groonga/groonga.h:3102:9`!(value);
2541 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, value));
2542 la1 = GRN_INT32_VALUEcxx . . $ `include/groonga/groonga.h:3102:9`!(value);
2543 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, value));
2544 ln2 = GRN_INT32_VALUEcxx . . $ `include/groonga/groonga.h:3102:9`!(value);
2545 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, value));
2546 la2 = GRN_INT32_VALUEcxx . . $ `include/groonga/groonga.h:3102:9`!(value);
2547 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, value));
2548 ln3 = GRN_INT32_VALUEcxx . . $ `include/groonga/groonga.h:3102:9`!(value);
2549 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1alloc1(ctx, data, value, data.res));
2550 la3 = GRN_INT32_VALUEcxx . . $ `include/groonga/groonga.h:3102:9`!(value);
2551 r = ((ln2 <= ln0) && (ln0 <= ln3) && (la2 <= la0) && (la0 <= la3));
2552 GRN_INT32_SETcxx . . $ `include/groonga/groonga.h:2904:9`!(ctx, data.res, r);
2553 data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res.->headercxx . . $ _grn_obj#header..type = GRN_BULKcxx . . $ `include/groonga/groonga.h:868:9`!;
2554 data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res.->headercxx . . $ _grn_obj#header..domain = GRN_DB_INT32;
2555 }
2556 data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.++;
2557 break;
2558 case GRN_OP_PLUS:
2559 {
2560 grn_obj *x = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2561 grn_obj *y = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2562 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop2alloc1(ctx, data, x, y, data.res));
2563 if (x->headercxx . . $ _grn_obj#header..type == GRN_VECTORcxx . . $ `include/groonga/groonga.h:877:9`! && y->headercxx . . $ _grn_obj#header..type == GRN_VECTORcxx . . $ `include/groonga/groonga.h:877:9`!) {
2564 grn_id domain_id = x->headercxx . . $ _grn_obj#header..domain;
2565 if (domain_id == GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!) {
2566 domain_id = y->headercxx . . $ _grn_obj#header..domain;
2567 }
2568 if (domain_id == GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`! && grn_vector_size(ctx, x) > 0) {
2569 const char *content;
2570 grn_vector_get_element(ctx, x, 0, &content, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!, &domain_id);
2571 }
2572 if (domain_id == GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`! && grn_vector_size(ctx, y) > 0) {
2573 const char *content;
2574 grn_vector_get_element(ctx, y, 0, &content, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!, &domain_id);
2575 }
2576 if (domain_id == GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!) {
2577 /* TODO: Consider better default for GRN_VECTOR. */
2578 domain_id = GRN_DB_SHORT_TEXT;
2579 }
2580 if (data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res. == y) {
2581 grn_obj y_copied;
2582 GRN_OBJ_INITcxx . . $ `include/groonga/groonga.h:947:9`!(&y_copied, GRN_VECTORcxx . . $ `include/groonga/groonga.h:877:9`!, 0, y->header.domain);
2583 grn_vector_copy(ctx, y, &y_copied);
2584 grn_obj_reinit(ctx, data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res., domain_id, GRN_OBJ_VECTORcxx . . $ `include/groonga/groonga.h:2734:9`!);
2585 grn_vector_copy(ctx, x, data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res.);
2586 grn_vector_copy(ctx, &y_copied, data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res.);
2587 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &y_copied);
2588 } else {
2589 if (data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res. != x) {
2590 grn_obj_reinit(ctx, data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res., domain_id, GRN_OBJ_VECTORcxx . . $ `include/groonga/groonga.h:2734:9`!);
2591 grn_vector_copy(ctx, x, data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res.);
2592 }
2593 grn_vector_copy(ctx, y, data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res.);
2594 }
2595 data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.++;
2596 } else if (x->headercxx . . $ _grn_obj#header..type == GRN_VECTORcxx . . $ `include/groonga/groonga.h:877:9`! ||
2597 y->headercxx . . $ _grn_obj#header..type == GRN_VECTORcxx . . $ `include/groonga/groonga.h:877:9`!) {
2598 grn_obj inspected_x;
2599 grn_obj inspected_y;
2600 GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&inspected_x, 0);
2601 GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&inspected_y, 0);
2602 grn_inspect(ctx, &inspected_x, x);
2603 grn_inspect(ctx, &inspected_y, y);
2604 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
2605 "<+> doesn't support %s + %s: <%.*s> + <%.*s>",
2606 x->header.type == GRN_VECTORcxx . . $ `include/groonga/groonga.h:877:9`! ? "vector" : "non-vector",
2607 y->header.type == GRN_VECTORcxx . . $ `include/groonga/groonga.h:877:9`! ? "vector" : "non-vector",
2608 (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&inspected_x),
2609 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&inspected_x),
2610 (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&inspected_y),
2611 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&inspected_y));
2612 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &inspected_x);
2613 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &inspected_y);
2614 return false;
2615 } else {
2616 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(arithmetic_binary_operation_dispatch(ctx,
2617 data,
2618 GRN_OP_PLUS,
2619 x,
2620 y,
2621 data.res));
2622 }
2623 }
2624 break;
2625 case GRN_OP_MINUS:
2626 if (data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.->nargs == 1) {
2627 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(arithmetic_unary_operation_dispatch(ctx, data, GRN_OP_MINUS));
2628 } else {
2629 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(arithmetic_binary_operation_dispatch(ctx, data, GRN_OP_MINUS));
2630 }
2631 break;
2632 case GRN_OP_STAR:
2633 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(arithmetic_binary_operation_dispatch(ctx, data, GRN_OP_STAR));
2634 break;
2635 case GRN_OP_SLASH:
2636 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(arithmetic_binary_operation_dispatch(ctx, data, GRN_OP_SLASH));
2637 break;
2638 case GRN_OP_MOD:
2639 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(arithmetic_binary_operation_dispatch(ctx, data, GRN_OP_MOD));
2640 break;
2641 case GRN_OP_BITWISE_NOT:
2642 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(arithmetic_unary_operation_dispatch(ctx, data, GRN_OP_BITWISE_NOT));
2643 break;
2644 case GRN_OP_BITWISE_OR:
2645 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(arithmetic_binary_operation_dispatch(ctx, data, GRN_OP_BITWISE_OR));
2646 break;
2647 case GRN_OP_BITWISE_XOR:
2648 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(
2649 arithmetic_binary_operation_dispatch(ctx, data, GRN_OP_BITWISE_XOR));
2650 break;
2651 case GRN_OP_BITWISE_AND:
2652 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(
2653 arithmetic_binary_operation_dispatch(ctx, data, GRN_OP_BITWISE_AND));
2654 break;
2655 case GRN_OP_SHIFTL:
2656 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(arithmetic_binary_operation_dispatch(ctx, data, GRN_OP_SHIFTL));
2657 break;
2658 case GRN_OP_SHIFTR:
2659 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(arithmetic_binary_operation_dispatch(ctx, data, GRN_OP_SHIFTR));
2660 break;
2661 case GRN_OP_SHIFTRR:
2662 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(arithmetic_binary_operation_dispatch(ctx, data, GRN_OP_SHIFTRR));
2663 break;
2664 case GRN_OP_INCR:
2665 case GRN_OP_DECR:
2666 case GRN_OP_INCR_POST:
2667 case GRN_OP_DECR_POST:
2668 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(unary_operation_and_assign_dispatch(ctx, data, data.code->op));
2669 break;
2670 case GRN_OP_NOT:
2671 {
2672 grn_obj *value = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2673 bool value_boolean = false;
2674 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1alloc1(ctx, data, value, data.res));
2675 GRN_OBJ_IS_TRUEcxx . . $ `include/groonga/obj.h:29:9`!(ctx, value, value_boolean);
2676 grn_obj_reinit(ctx, data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res., GRN_DB_BOOL, 0);
2677 GRN_BOOL_SETcxx . . $ `include/groonga/groonga.h:2879:9`!(ctx, data.res, !value_boolean);
2678 }
2679 data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.++;
2680 break;
2681 case GRN_OP_GET_MEMBER:
2682 {
2683 grn_obj *receiver = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2684 grn_obj *index_or_key = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2685 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop2alloc1(ctx, data, receiver, index_or_key, data.res));
2686 if (receiver->headercxx . . $ _grn_obj#header..type == GRN_PTRcxx . . $ `include/groonga/groonga.h:873:9`!) {
2687 grn_obj *index = index_or_key;
2688 grn_expr_exec_get_member_vectorcxx . . $ grn_expr_exec_get_member_vector(2f138204b87252a).(ctx, expr, receiver, index, data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res.);
2689 } else {
2690 grn_obj *key = index_or_key;
2691 grn_expr_exec_get_member_tablecxx . . $ grn_expr_exec_get_member_table(2f138204b87252a).(ctx, expr, receiver, key, data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res.);
2692 }
2693 data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.++;
2694 }
2695 break;
2696 case GRN_OP_REGEXP:
2697 {
2698 grn_obj *target = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2699 grn_obj *pattern = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2700 bool matched;
2701 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, pattern));
2702 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(pop1(ctx, data, target));
2703 with_spsavecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/with_spsave(a494dc215517b3b0).(ctx, data, [&]() {
2704 matched = grn_operator_exec_regexp(ctx, target, pattern);
2705 });
2706 CHECKcxx . . $ `lib/expr_executor.cpp:51:9`!(alloc1(ctx, data, data.res));
2707 grn_obj_reinit(ctx, data.rescxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#res., GRN_DB_BOOL, 0);
2708 GRN_BOOL_SETcxx . . $ `include/groonga/groonga.h:2879:9`!(ctx, data.res, matched);
2709 }
2710 data.codecxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#code.++;
2711 break;
2712 default:
2713 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_FUNCTION_NOT_IMPLEMENTED, "not implemented operator assigned");
2714 return false;
2715 }
2716 }
2717 ctx->implcxx . . $ _grn_ctx#impl.->stack_currcxx . . $ _grn_ctx_impl#stack_curr. = data.spcxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#sp. - data.s_cxx . . $ `$anonymous_namespace_lib/expr_executor.cpp`/ExecuteData#s_.;
2718 return true;
2719 }
2720
2721 static grn_obj *
2722 expr_execcxx . . $ expr_exec(e9f40e4080908c1e).(grn_ctx *ctx, grn_obj *expr)
2723 {
2724 uint32_tcxx . . $ uint32_t# stack_curr = ctx->implcxx . . $ _grn_ctx#impl.->stack_currcxx . . $ _grn_ctx_impl#stack_curr.;
2725 grn_obj *value = nullptr;
2726 auto success = expr_exec_internalcxx . . $ expr_exec_internal(a5760e5c319a06ee).(ctx, expr);
2727 if (success) {
2728 if (ctx->implcxx . . $ _grn_ctx#impl.->stack_currcxx . . $ _grn_ctx_impl#stack_curr. > stack_curr) {
2729 value = grn_ctx_pop(ctx);
2730 }
2731 }
2732 if (ctx->implcxx . . $ _grn_ctx#impl.->stack_currcxx . . $ _grn_ctx_impl#stack_curr. > stack_curr) {
2733 /*
2734 GRN_LOG(ctx, GRN_LOG_WARNING, "stack balance=%d",
2735 stack_curr - ctx->impl->stack_curr);
2736 */
2737 ctx->implcxx . . $ _grn_ctx#impl.->stack_currcxx . . $ _grn_ctx_impl#stack_curr. = stack_curr;
2738 }
2739 return value;
2740 }
2741
2742 static grn_obj *
2743 grn_expr_executor_exec_generalcxx . . $ grn_expr_executor_exec_general(16f9569af33219a9).(grn_ctx *ctx,
2744 grn_expr_executor *executor,
2745 grn_id id)
2746 {
2747 if (!executor->variablecxx . . $ _grn_expr_executor#variable. && id != GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!) {
2748 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
2749 "[expr-executor][exec][general] can't specify ID for no variable expr");
2750 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2751 }
2752 if (executor->variablecxx . . $ _grn_expr_executor#variable.) {
2753 GRN_RECORD_SETcxx . . $ `include/groonga/groonga.h:2940:9`!(ctx, executor->variable, id);
2754 }
2755 return expr_execcxx . . $ expr_exec(e9f40e4080908c1e).(ctx, executor->exprcxx . . $ _grn_expr_executor#expr.);
2756 }
2757
2758 static void
2759 grn_expr_executor_fin_generalcxx . . $ grn_expr_executor_fin_general(a11777c3305b25fa).(grn_ctx *ctx, grn_expr_executor *executor)
2760 {
2761 }
2762
2763 static void
2764 grn_expr_executor_init_constantcxx . . $ grn_expr_executor_init_constant(a11777c3305b25fa).(grn_ctx *ctx, grn_expr_executor *executor)
2765 {
2766 grn_expr *e = (grn_expr *)(executor->exprcxx . . $ _grn_expr_executor#expr.);
2767
2768 executor->datacxx . . $ _grn_expr_executor#data..constant.value = e->codescxx . . $ _grn_expr#codes.[0].value;
2769 }
2770
2771 static bool
2772 grn_expr_executor_is_constantcxx . . $ grn_expr_executor_is_constant(a69fbfa71aaf4e06).(grn_ctx *ctx, grn_expr_executor *executor)
2773 {
2774 grn_expr *e = (grn_expr *)(executor->exprcxx . . $ _grn_expr_executor#expr.);
2775 grn_expr_code *target;
2776
2777 if (e->codes_currcxx . . $ _grn_expr#codes_curr. != 1) {
2778 return false;
2779 }
2780
2781 target = &(e->codescxx . . $ _grn_expr#codes.[0]);
2782
2783 if (target->op != GRN_OP_PUSH) {
2784 return false;
2785 }
2786 if (!target->value) {
2787 return false;
2788 }
2789
2790 grn_expr_executor_init_constantcxx . . $ grn_expr_executor_init_constant(a11777c3305b25fa).(ctx, executor);
2791
2792 return true;
2793 }
2794
2795 static grn_obj *
2796 grn_expr_executor_exec_constantcxx . . $ grn_expr_executor_exec_constant(16f9569af33219a9).(grn_ctx *ctx,
2797 grn_expr_executor *executor,
2798 grn_id id)
2799 {
2800 return executor->datacxx . . $ _grn_expr_executor#data..constant.value;
2801 }
2802
2803 static void
2804 grn_expr_executor_fin_constantcxx . . $ grn_expr_executor_fin_constant(a11777c3305b25fa).(grn_ctx *ctx, grn_expr_executor *executor)
2805 {
2806 }
2807
2808 static void
2809 grn_expr_executor_init_valuecxx . . $ grn_expr_executor_init_value(a11777c3305b25fa).(grn_ctx *ctx, grn_expr_executor *executor)
2810 {
2811 grn_expr *e = (grn_expr *)(executor->exprcxx . . $ _grn_expr_executor#expr.);
2812
2813 executor->datacxx . . $ _grn_expr_executor#data..value.column = e->codescxx . . $ _grn_expr#codes.[0].value;
2814 GRN_VOID_INITcxx . . $ `include/groonga/groonga.h:2749:9`!(&(executor->data.value.value_buffer));
2815 }
2816
2817 static bool
2818 grn_expr_executor_is_valuecxx . . $ grn_expr_executor_is_value(a69fbfa71aaf4e06).(grn_ctx *ctx, grn_expr_executor *executor)
2819 {
2820 grn_expr *e = (grn_expr *)(executor->exprcxx . . $ _grn_expr_executor#expr.);
2821 grn_expr_code *target;
2822
2823 if (e->codes_currcxx . . $ _grn_expr#codes_curr. != 1) {
2824 return false;
2825 }
2826
2827 target = &(e->codescxx . . $ _grn_expr#codes.[0]);
2828
2829 if (target->op != GRN_OP_GET_VALUE) {
2830 return false;
2831 }
2832 if (!target->value) {
2833 return false;
2834 }
2835
2836 grn_expr_executor_init_valuecxx . . $ grn_expr_executor_init_value(a11777c3305b25fa).(ctx, executor);
2837
2838 return true;
2839 }
2840
2841 static grn_obj *
2842 grn_expr_executor_exec_valuecxx . . $ grn_expr_executor_exec_value(16f9569af33219a9).(grn_ctx *ctx,
2843 grn_expr_executor *executor,
2844 grn_id id)
2845 {
2846 grn_obj *value_buffer = &(executor->datacxx . . $ _grn_expr_executor#data..value.value_buffer);
2847
2848 GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(value_buffer);
2849 grn_obj_get_value(ctx, executor->datacxx . . $ _grn_expr_executor#data..value.column, id, value_buffer);
2850
2851 return value_buffer;
2852 }
2853
2854 static void
2855 grn_expr_executor_fin_valuecxx . . $ grn_expr_executor_fin_value(a11777c3305b25fa).(grn_ctx *ctx, grn_expr_executor *executor)
2856 {
2857 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &(executor->data.value.value_buffer));
2858 }
2859
2860 #ifdef GRN_SUPPORT_REGEXPcxx . . $ `lib/grn.h:734:11`!
2861 static void
2862 grn_expr_executor_init_simple_regexpcxx . . $ grn_expr_executor_init_simple_regexp(a11777c3305b25fa).(grn_ctx *ctx, grn_expr_executor *executor)
2863 {
2864 grn_expr *e = (grn_expr *)(executor->exprcxx . . $ _grn_expr_executor#expr.);
2865 grn_obj *result_buffer = &(executor->datacxx . . $ _grn_expr_executor#data..simple_regexp.result_buffer);
2866 grn_obj *pattern;
2867
2868 GRN_BOOL_INITcxx . . $ `include/groonga/groonga.h:2842:9`!(result_buffer, 0);
2869 GRN_BOOL_SETcxx . . $ `include/groonga/groonga.h:2879:9`!(ctx, result_buffer, false);
2870
2871 pattern = e->codescxx . . $ _grn_expr#codes.[1].value;
2872 if (GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(pattern) == 0) {
2873 executor->datacxx . . $ _grn_expr_executor#data..simple_regexp.regex = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
2874 return;
2875 }
2876
2877 executor->datacxx . . $ _grn_expr_executor#data..simple_regexp.regex =
2878 grn_onigmo_new(ctx,
2879 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(pattern),
2880 GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(pattern),
2881 GRN_ONIGMO_OPTION_DEFAULTcxx . . $ `lib/grn_onigmo.h:33:9`!,
2882 GRN_ONIGMO_SYNTAX_DEFAULTcxx . . $ `lib/grn_onigmo.h:37:9`!,
2883 "[expr-executor][regexp]");
2884 if (!executor->datacxx . . $ _grn_expr_executor#data..simple_regexp.regex) {
2885 return;
2886 }
2887
2888 GRN_VOID_INITcxx . . $ `include/groonga/groonga.h:2749:9`!(&(executor->data.simple_regexp.value_buffer));
2889
2890 executor->datacxx . . $ _grn_expr_executor#data..simple_regexp.normalizer =
2891 grn_ctx_get(ctx, GRN_NORMALIZER_AUTO_NAMEcxx . . $ `lib/grn_normalizer.h:32:9`!, -1);
2892 }
2893
2894 static bool
2895 grn_expr_executor_is_simple_regexpcxx . . $ grn_expr_executor_is_simple_regexp(a69fbfa71aaf4e06).(grn_ctx *ctx, grn_expr_executor *executor)
2896 {
2897 grn_expr *e = (grn_expr *)(executor->exprcxx . . $ _grn_expr_executor#expr.);
2898 grn_expr_code *target;
2899 grn_expr_code *pattern;
2900 grn_expr_code *operator_code;
2901
2902 if (e->codes_currcxx . . $ _grn_expr#codes_curr. != 3) {
2903 return false;
2904 }
2905
2906 target = &(e->codescxx . . $ _grn_expr#codes.[0]);
2907 pattern = &(e->codescxx . . $ _grn_expr#codes.[1]);
2908 operator_code = &(e->codescxx . . $ _grn_expr#codes.[2]);
2909
2910 if (operator_code->op != GRN_OP_REGEXP) {
2911 return false;
2912 }
2913 if (operator_code->nargs != 2) {
2914 return false;
2915 }
2916
2917 if (target->op != GRN_OP_GET_VALUE) {
2918 return false;
2919 }
2920 if (target->nargs != 1) {
2921 return false;
2922 }
2923 if (!target->value) {
2924 return false;
2925 }
2926 if (target->value->headercxx . . $ _grn_obj#header..type != GRN_COLUMN_VAR_SIZEcxx . . $ `include/groonga/groonga.h:901:9`!) {
2927 return false;
2928 }
2929 if ((target->value->headercxx . . $ _grn_obj#header..flags & GRN_OBJ_COLUMN_TYPE_MASKcxx . . $ `include/groonga/groonga.h:726:9`!) !=
2930 GRN_OBJ_COLUMN_SCALARcxx . . $ `include/groonga/groonga.h:731:9`!) {
2931 return false;
2932 }
2933 switch (grn_obj_get_range(ctx, target->value)) {
2934 case GRN_DB_SHORT_TEXT:
2935 case GRN_DB_TEXT:
2936 case GRN_DB_LONG_TEXT:
2937 break;
2938 default:
2939 return false;
2940 }
2941
2942 if (pattern->op != GRN_OP_PUSH) {
2943 return false;
2944 }
2945 if (pattern->nargs != 1) {
2946 return false;
2947 }
2948 if (!pattern->value) {
2949 return false;
2950 }
2951 if (pattern->value->headercxx . . $ _grn_obj#header..type != GRN_BULKcxx . . $ `include/groonga/groonga.h:868:9`!) {
2952 return false;
2953 }
2954 switch (pattern->value->headercxx . . $ _grn_obj#header..domain) {
2955 case GRN_DB_SHORT_TEXT:
2956 case GRN_DB_TEXT:
2957 case GRN_DB_LONG_TEXT:
2958 break;
2959 default:
2960 return false;
2961 }
2962
2963 if (!grn_onigmo_is_valid_encoding(ctx)) {
2964 return false;
2965 }
2966
2967 grn_expr_executor_init_simple_regexpcxx . . $ grn_expr_executor_init_simple_regexp(a11777c3305b25fa).(ctx, executor);
2968
2969 return true;
2970 }
2971
2972 static grn_obj *
2973 grn_expr_executor_exec_simple_regexpcxx . . $ grn_expr_executor_exec_simple_regexp(16f9569af33219a9).(grn_ctx *ctx,
2974 grn_expr_executor *executor,
2975 grn_id id)
2976 {
2977 grn_expr *e = (grn_expr *)(executor->exprcxx . . $ _grn_expr_executor#expr.);
2978 OnigRegex regex = static_cast<OnigRegex>(executor->datacxx . . $ _grn_expr_executor#data..simple_regexp.regex);
2979 grn_obj *value_buffer = &(executor->datacxx . . $ _grn_expr_executor#data..simple_regexp.value_buffer);
2980 grn_obj *result_buffer = &(executor->datacxx . . $ _grn_expr_executor#data..simple_regexp.result_buffer);
2981
2982 if (ctx->rccxx . . $ _grn_ctx#rc.) {
2983 GRN_BOOL_SETcxx . . $ `include/groonga/groonga.h:2879:9`!(ctx, result_buffer, false);
2984 return result_buffer;
2985 }
2986
2987 if (!regex) {
2988 return result_buffer;
2989 }
2990
2991 grn_obj_reinit_for(ctx, value_buffer, e->codescxx . . $ _grn_expr#codes.[0].value);
2992 grn_obj_get_value(ctx, e->codescxx . . $ _grn_expr#codes.[0].value, id, value_buffer);
2993 {
2994 grn_obj *norm_target;
2995 const char *norm_target_raw;
2996 unsigned int norm_target_raw_length_in_bytes;
2997
2998 norm_target = grn_string_open(ctx,
2999 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(value_buffer),
3000 GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(value_buffer),
3001 executor->datacxx . . $ _grn_expr_executor#data..simple_regexp.normalizer,
3002 0);
3003 grn_string_get_normalized(ctx,
3004 norm_target,
3005 &norm_target_raw,
3006 &norm_target_raw_length_in_bytes,
3007 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!);
3008
3009 {
3010 auto target_start = reinterpret_cast<const OnigUChar *>(norm_target_raw);
3011 auto target_end = target_start + norm_target_raw_length_in_bytes;
3012 OnigPosition position;
3013 position = onig_search(regex,
3014 target_start,
3015 target_end,
3016 target_start,
3017 target_end,
3018 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!,
3019 ONIG_OPTION_NONEcxx . . $ `vendor/onigmo-source/onigmo.h:450:9`!);
3020 grn_obj_close(ctx, norm_target);
3021 GRN_BOOL_SETcxx . . $ `include/groonga/groonga.h:2879:9`!(ctx, result_buffer, (position != ONIG_MISMATCHcxx . . $ `vendor/onigmo-source/onigmo.h:625:9`!));
3022 return result_buffer;
3023 }
3024 }
3025 }
3026
3027 static void
3028 grn_expr_executor_fin_simple_regexpcxx . . $ grn_expr_executor_fin_simple_regexp(a11777c3305b25fa).(grn_ctx *ctx, grn_expr_executor *executor)
3029 {
3030 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &(executor->data.simple_regexp.result_buffer));
3031
3032 if (!executor->datacxx . . $ _grn_expr_executor#data..simple_regexp.regex) {
3033 return;
3034 }
3035
3036 onig_free(static_cast<OnigRegex>(executor->datacxx . . $ _grn_expr_executor#data..simple_regexp.regex));
3037 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &(executor->data.simple_regexp.value_buffer));
3038 }
3039 #endif /* GRN_SUPPORT_REGEXP */
3040
3041 static void
3042 grn_expr_executor_init_simple_matchcxx . . $ grn_expr_executor_init_simple_match(a11777c3305b25fa).(grn_ctx *ctx, grn_expr_executor *executor)
3043 {
3044 grn_expr *e = (grn_expr *)(executor->exprcxx . . $ _grn_expr_executor#expr.);
3045 grn_obj *result_buffer = &(executor->datacxx . . $ _grn_expr_executor#data..simple_match.result_buffer);
3046 grn_obj *sub_text;
3047
3048 GRN_BOOL_INITcxx . . $ `include/groonga/groonga.h:2842:9`!(result_buffer, 0);
3049 GRN_BOOL_SETcxx . . $ `include/groonga/groonga.h:2879:9`!(ctx, result_buffer, false);
3050
3051 executor->datacxx . . $ _grn_expr_executor#data..simple_match.normalizer =
3052 grn_ctx_get(ctx, GRN_NORMALIZER_AUTO_NAMEcxx . . $ `lib/grn_normalizer.h:32:9`!, -1);
3053
3054 sub_text = e->codescxx . . $ _grn_expr#codes.[1].value;
3055 executor->datacxx . . $ _grn_expr_executor#data..simple_match.normalized_sub_text =
3056 grn_string_open(ctx,
3057 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(sub_text),
3058 GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(sub_text),
3059 executor->datacxx . . $ _grn_expr_executor#data..simple_match.normalizer,
3060 0);
3061 grn_string_get_normalized(
3062 ctx,
3063 executor->datacxx . . $ _grn_expr_executor#data..simple_match.normalized_sub_text,
3064 &(executor->datacxx . . $ _grn_expr_executor#data..simple_match.normalized_sub_text_raw),
3065 &(executor->datacxx . . $ _grn_expr_executor#data..simple_match.normalized_sub_text_raw_length_in_bytes),
3066 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!);
3067 #ifdef GRN_SUPPORT_REGEXPcxx . . $ `lib/grn.h:734:11`!
3068 executor->datacxx . . $ _grn_expr_executor#data..simple_match.regex = grn_onigmo_new(
3069 ctx,
3070 executor->datacxx . . $ _grn_expr_executor#data..simple_match.normalized_sub_text_raw,
3071 executor->datacxx . . $ _grn_expr_executor#data..simple_match.normalized_sub_text_raw_length_in_bytes,
3072 GRN_ONIGMO_OPTION_DEFAULTcxx . . $ `lib/grn_onigmo.h:33:9`!,
3073 ONIG_SYNTAX_ASIScxx . . $ `vendor/onigmo-source/onigmo.h:501:9`!,
3074 "[expr-executor][match]");
3075 #endif
3076
3077 grn_obj *target = e->codescxx . . $ _grn_expr#codes.[0].value;
3078 grn_obj *value_buffer = &(executor->datacxx . . $ _grn_expr_executor#data..simple_match.value_buffer);
3079 GRN_VOID_INITcxx . . $ `include/groonga/groonga.h:2749:9`!(value_buffer);
3080 grn_obj_reinit_for(ctx, value_buffer, target);
3081 }
3082
3083 static bool
3084 grn_expr_executor_is_simple_matchcxx . . $ grn_expr_executor_is_simple_match(a69fbfa71aaf4e06).(grn_ctx *ctx, grn_expr_executor *executor)
3085 {
3086 grn_expr *e = (grn_expr *)(executor->exprcxx . . $ _grn_expr_executor#expr.);
3087 grn_expr_code *target;
3088 grn_expr_code *sub_text;
3089 grn_expr_code *operator_code;
3090
3091 if (e->codes_currcxx . . $ _grn_expr#codes_curr. != 3) {
3092 return false;
3093 }
3094
3095 target = &(e->codescxx . . $ _grn_expr#codes.[0]);
3096 sub_text = &(e->codescxx . . $ _grn_expr#codes.[1]);
3097 operator_code = &(e->codescxx . . $ _grn_expr#codes.[2]);
3098
3099 if (operator_code->op != GRN_OP_MATCH) {
3100 return false;
3101 }
3102 if (operator_code->nargs != 2) {
3103 return false;
3104 }
3105
3106 if (target->op != GRN_OP_GET_VALUE) {
3107 return false;
3108 }
3109 if (target->nargs != 1) {
3110 return false;
3111 }
3112 if (!target->value) {
3113 return false;
3114 }
3115 if (!(grn_obj_is_key_accessor(ctx, target->value) ||
3116 grn_obj_is_text_family_scalar_column(ctx, target->value))) {
3117 return false;
3118 }
3119
3120 if (sub_text->op != GRN_OP_PUSH) {
3121 return false;
3122 }
3123 if (sub_text->nargs != 1) {
3124 return false;
3125 }
3126 if (!grn_obj_is_text_family_bulk(ctx, sub_text->value)) {
3127 return false;
3128 }
3129
3130 #ifdef GRN_SUPPORT_REGEXPcxx . . $ `lib/grn.h:734:11`!
3131 if (!grn_onigmo_is_valid_encoding(ctx)) {
3132 return false;
3133 }
3134 #endif
3135
3136 grn_expr_executor_init_simple_matchcxx . . $ grn_expr_executor_init_simple_match(a11777c3305b25fa).(ctx, executor);
3137
3138 return true;
3139 }
3140
3141 static bool
3142 grn_expr_executor_exec_simple_match_have_sub_textcxx . . $ grn_expr_executor_exec_simple_match_have_sub_text(9b93ff3a4fd5d376).(grn_ctx *ctx,
3143 grn_expr_executor *executor,
3144 const char *text,
3145 unsigned int text_len)
3146 {
3147 unsigned int sub_text_len =
3148 executor->datacxx . . $ _grn_expr_executor#data..simple_match.normalized_sub_text_raw_length_in_bytes;
3149
3150 if (sub_text_len > text_len) {
3151 return false;
3152 }
3153
3154 #ifdef GRN_SUPPORT_REGEXPcxx . . $ `lib/grn.h:734:11`!
3155 {
3156 auto regex = static_cast<OnigRegex>(executor->datacxx . . $ _grn_expr_executor#data..simple_match.regex);
3157 auto target_start = reinterpret_cast<const OnigUChar *>(text);
3158 auto target_end = target_start + text_len;
3159 OnigPosition position;
3160 position = onig_search(regex,
3161 target_start,
3162 target_end,
3163 target_start,
3164 target_end,
3165 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!,
3166 ONIG_OPTION_NONEcxx . . $ `vendor/onigmo-source/onigmo.h:450:9`!);
3167 return (position != ONIG_MISMATCHcxx . . $ `vendor/onigmo-source/onigmo.h:625:9`!);
3168 }
3169 #else /* GRN_SUPPORT_REGEXP */
3170 {
3171 grn_raw_string string;
3172 string.value = text;
3173 string.length = text_len;
3174 grn_raw_string sub_string;
3175 sub_string.value = executor->data.simple_match.normalized_sub_text_raw;
3176 sub_string.length = sub_text_len;
3177 return grn_raw_string_have_sub_string(ctx, &string, &sub_string);
3178 }
3179 #endif /* GRN_SUPPORT_REGEXP */
3180 }
3181
3182 static grn_obj *
3183 grn_expr_executor_exec_simple_matchcxx . . $ grn_expr_executor_exec_simple_match(16f9569af33219a9).(grn_ctx *ctx,
3184 grn_expr_executor *executor,
3185 grn_id id)
3186 {
3187 grn_expr *e = (grn_expr *)(executor->exprcxx . . $ _grn_expr_executor#expr.);
3188 grn_obj *value_buffer = &(executor->datacxx . . $ _grn_expr_executor#data..simple_match.value_buffer);
3189 grn_obj *result_buffer = &(executor->datacxx . . $ _grn_expr_executor#data..simple_match.result_buffer);
3190
3191 if (ctx->rccxx . . $ _grn_ctx#rc. != GRN_SUCCESS) {
3192 GRN_BOOL_SETcxx . . $ `include/groonga/groonga.h:2879:9`!(ctx, result_buffer, false);
3193 return result_buffer;
3194 }
3195
3196 if (executor->datacxx . . $ _grn_expr_executor#data..simple_match.normalized_sub_text_raw_length_in_bytes ==
3197 0) {
3198 return result_buffer;
3199 }
3200
3201 GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(value_buffer);
3202 grn_obj_get_value(ctx, e->codescxx . . $ _grn_expr#codes.[0].value, id, value_buffer);
3203 {
3204 grn_obj *norm_target;
3205 norm_target = grn_string_open(ctx,
3206 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(value_buffer),
3207 GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(value_buffer),
3208 executor->datacxx . . $ _grn_expr_executor#data..simple_match.normalizer,
3209 0);
3210 const char *norm_target_raw;
3211 unsigned int norm_target_raw_length_in_bytes;
3212 grn_string_get_normalized(ctx,
3213 norm_target,
3214 &norm_target_raw,
3215 &norm_target_raw_length_in_bytes,
3216 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!);
3217 bool have_sub_text = grn_expr_executor_exec_simple_match_have_sub_textcxx . . $ grn_expr_executor_exec_simple_match_have_sub_text(9b93ff3a4fd5d376).(
3218 ctx,
3219 executor,
3220 norm_target_raw,
3221 norm_target_raw_length_in_bytes);
3222 GRN_BOOL_SETcxx . . $ `include/groonga/groonga.h:2879:9`!(ctx, result_buffer, have_sub_text);
3223 grn_obj_close(ctx, norm_target);
3224 }
3225
3226 return result_buffer;
3227 }
3228
3229 static void
3230 grn_expr_executor_fin_simple_matchcxx . . $ grn_expr_executor_fin_simple_match(a11777c3305b25fa).(grn_ctx *ctx, grn_expr_executor *executor)
3231 {
3232 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &(executor->data.simple_match.result_buffer));
3233
3234 #ifdef GRN_SUPPORT_REGEXPcxx . . $ `lib/grn.h:734:11`!
3235 if (executor->datacxx . . $ _grn_expr_executor#data..simple_match.regex) {
3236 onig_free(static_cast<OnigRegex>(executor->datacxx . . $ _grn_expr_executor#data..simple_match.regex));
3237 }
3238 #endif /* GRN_SUPPORT_REGEXP */
3239
3240 grn_obj_close(ctx, executor->datacxx . . $ _grn_expr_executor#data..simple_match.normalized_sub_text);
3241 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &(executor->data.simple_match.value_buffer));
3242 }
3243
3244 static bool
3245 grn_expr_executor_data_simple_proc_initcxx . . $ grn_expr_executor_data_simple_proc_init(6b7121c92f768323).(
3246 grn_ctx *ctx,
3247 grn_expr_executor *executor,
3248 grn_expr_executor_data_simple_proc *data)
3249 {
3250 grn_proc_ctx *proc_ctx = &(data->proc_ctx);
3251 grn_expr *expr;
3252 grn_proc *proc;
3253
3254 data->args = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
3255 data->n_args = 0;
3256 data->buffers = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
3257 data->n_buffers = 0;
3258
3259 expr = (grn_expr *)(executor->exprcxx . . $ _grn_expr_executor#expr.);
3260 proc = (grn_proc *)(expr->codescxx . . $ _grn_expr#codes.[data->codes_start_offset].value);
3261 proc_ctx->proccxx . . $ _grn_proc_ctx#proc. = proc;
3262 proc_ctx->callercxx . . $ _grn_proc_ctx#caller. = executor->exprcxx . . $ _grn_expr_executor#expr.;
3263
3264 int n_args = 0;
3265 int n_buffers = 0;
3266 {
3267 uint32_tcxx . . $ uint32_t# i;
3268 for (i = data->codes_start_offset + 1;
3269 i < expr->codes_currcxx . . $ _grn_expr#codes_curr. - data->codes_end_offset - 1;
3270 i++) {
3271 switch (expr->codescxx . . $ _grn_expr#codes.[i].op) {
3272 case GRN_OP_GET_VALUE:
3273 n_args++;
3274 n_buffers++;
3275 break;
3276 case GRN_OP_PUSH:
3277 n_args++;
3278 break;
3279 default:
3280 return false;
3281 }
3282 }
3283 }
3284
3285 grn_obj **args = GRN_MALLOCNcxx . . $ `lib/grn_alloc.h:50:9`!(grn_obj *, n_args);
3286 if (!args) {
3287 return false;
3288 }
3289 data->args = args;
3290 data->n_args = n_args;
3291
3292 if (n_buffers > 0) {
3293 grn_obj *buffers = GRN_MALLOCNcxx . . $ `lib/grn_alloc.h:50:9`!(grn_obj, n_buffers);
3294 if (!buffers) {
3295 GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(args);
3296 return false;
3297 }
3298 int i;
3299 for (i = 0; i < n_buffers; i++) {
3300 GRN_VOID_INITcxx . . $ `include/groonga/groonga.h:2749:9`!(&(buffers[i]));
3301 }
3302 data->buffers = buffers;
3303 } else {
3304 data->buffers = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
3305 }
3306 data->n_buffers = n_buffers;
3307
3308 return true;
3309 }
3310
3311 static void
3312 grn_expr_executor_data_simple_proc_fincxx . . $ grn_expr_executor_data_simple_proc_fin(1473451689df91d8).(grn_ctx *ctx,
3313 grn_expr_executor *executor,
3314 grn_expr_executor_data_simple_proc *data)
3315 {
3316 GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(data->args);
3317 int n_buffers = data->n_buffers;
3318 if (n_buffers > 0) {
3319 grn_obj *buffers = data->buffers;
3320 int i;
3321 for (i = 0; i < n_buffers; i++) {
3322 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &(buffers[i]));
3323 }
3324 GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(buffers);
3325 }
3326 }
3327
3328 static grn_obj *
3329 grn_expr_executor_data_simple_proc_execcxx . . $ grn_expr_executor_data_simple_proc_exec(24ad10174f5c60d0).(
3330 grn_ctx *ctx,
3331 grn_expr_executor *executor,
3332 grn_expr_executor_data_simple_proc *data,
3333 grn_id id)
3334 {
3335 grn_proc_ctx *proc_ctx = &(data->proc_ctx);
3336 grn_obj **args = data->args;
3337 grn_obj *buffers = data->buffers;
3338 int n_args = data->n_args;
3339 grn_proc *proc;
3340 grn_expr *expr;
3341 grn_obj *result = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
3342
3343 proc = proc_ctx->proccxx . . $ _grn_proc_ctx#proc.;
3344 if (executor->variablecxx . . $ _grn_expr_executor#variable.) {
3345 GRN_RECORD_SETcxx . . $ `include/groonga/groonga.h:2940:9`!(ctx, executor->variable, id);
3346 }
3347
3348 expr = (grn_expr *)(executor->exprcxx . . $ _grn_expr_executor#expr.);
3349 {
3350 uint32_tcxx . . $ uint32_t# i_expr;
3351 uint32_tcxx . . $ uint32_t# i_buffer;
3352 uint32_tcxx . . $ uint32_t# i_arg;
3353 for (i_expr = data->codes_start_offset + 1, i_buffer = 0, i_arg = 0;
3354 i_expr < expr->codes_currcxx . . $ _grn_expr#codes_curr. - data->codes_end_offset - 1;
3355 i_expr++, i_arg++) {
3356 switch (expr->codescxx . . $ _grn_expr#codes.[i_expr].op) {
3357 case GRN_OP_GET_VALUE:
3358 {
3359 grn_obj *target = expr->codescxx . . $ _grn_expr#codes.[i_expr].value;
3360 bool found = false;
3361 auto n = GRN_RECORD_VECTOR_SIZEcxx . . $ `include/groonga/groonga.h:3264:9`!(&(executor->replace_ids));
3362 for (size_t i = 0; i < n; ++i) {
3363 auto target_id = GRN_RECORD_VALUE_ATcxx . . $ `include/groonga/groonga.h:3148:9`!(&(executor->replace_ids), i);
3364 if (target_id == DB_OBJcxx . . $ `lib/grn_db.h:62:9`!(target)->id) {
3365 args[i_arg] = GRN_PTR_VALUE_ATcxx . . $ `include/groonga/groonga.h:3150:9`!(&(executor->replace_values), i);
3366 found = true;
3367 break;
3368 }
3369 }
3370 if (!found) {
3371 grn_obj *buffer = &(buffers[i_buffer++]);
3372 GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(buffer);
3373 grn_obj_get_value(ctx, target, id, buffer);
3374 args[i_arg] = buffer;
3375 }
3376 break;
3377 }
3378 case GRN_OP_PUSH:
3379 args[i_arg] = expr->codescxx . . $ _grn_expr#codes.[i_expr].value;
3380 break;
3381 default:
3382 break;
3383 }
3384 }
3385 }
3386
3387 uint32_tcxx . . $ uint32_t# values_curr = expr->values_currcxx . . $ _grn_expr#values_curr.;
3388 if (proc->funcscxx . . $ _grn_proc#funcs.[PROC_INIT]) {
3389 proc_ctx->phasecxx . . $ _grn_proc_ctx#phase. = PROC_INIT;
3390 grn_obj *sub_result =
3391 proc->funcscxx . . $ _grn_proc#funcs.[PROC_INIT](ctx, n_args, args, &(proc_ctx->user_datacxx . . $ _grn_proc_ctx#user_data.));
3392 if (sub_result) {
3393 result = sub_result;
3394 }
3395 }
3396 if (proc->funcscxx . . $ _grn_proc#funcs.[PROC_NEXT]) {
3397 proc_ctx->phasecxx . . $ _grn_proc_ctx#phase. = PROC_NEXT;
3398 grn_obj *sub_result =
3399 proc->funcscxx . . $ _grn_proc#funcs.[PROC_NEXT](ctx, n_args, args, &(proc_ctx->user_datacxx . . $ _grn_proc_ctx#user_data.));
3400 if (sub_result) {
3401 result = sub_result;
3402 }
3403 }
3404 if (proc->funcscxx . . $ _grn_proc#funcs.[PROC_FIN]) {
3405 proc_ctx->phasecxx . . $ _grn_proc_ctx#phase. = PROC_FIN;
3406 grn_obj *sub_result =
3407 proc->funcscxx . . $ _grn_proc#funcs.[PROC_FIN](ctx, n_args, args, &(proc_ctx->user_datacxx . . $ _grn_proc_ctx#user_data.));
3408 if (sub_result) {
3409 result = sub_result;
3410 }
3411 }
3412 expr->values_currcxx . . $ _grn_expr#values_curr. = values_curr;
3413
3414 return result;
3415 }
3416
3417 static bool
3418 grn_expr_executor_init_simple_proccxx . . $ grn_expr_executor_init_simple_proc(a69fbfa71aaf4e06).(grn_ctx *ctx, grn_expr_executor *executor)
3419 {
3420 grn_expr_executor_data_simple_proc *data = &(executor->datacxx . . $ _grn_expr_executor#data..simple_proc.data);
3421 data->codes_start_offset = 0;
3422 data->codes_end_offset = 0;
3423 return grn_expr_executor_data_simple_proc_initcxx . . $ grn_expr_executor_data_simple_proc_init(6b7121c92f768323).(ctx, executor, data);
3424 }
3425
3426 static bool
3427 grn_expr_executor_is_simple_proccxx . . $ grn_expr_executor_is_simple_proc(a69fbfa71aaf4e06).(grn_ctx *ctx, grn_expr_executor *executor)
3428 {
3429 grn_expr *e = (grn_expr *)(executor->exprcxx . . $ _grn_expr_executor#expr.);
3430
3431 /*
3432 * 0: GRN_OP_PUSH(func)
3433 * n-1: GRN_OP_CALL(func)
3434 */
3435 if (e->codes_currcxx . . $ _grn_expr#codes_curr. < 2) {
3436 return false;
3437 }
3438
3439 grn_expr_code *func = &(e->codescxx . . $ _grn_expr#codes.[0]);
3440 if (func->op != GRN_OP_PUSH) {
3441 return false;
3442 }
3443 if (!grn_obj_is_function_proc(ctx, func->value)) {
3444 return false;
3445 }
3446
3447 grn_proc *proc = (grn_proc *)(func->value);
3448 if (!proc->funcscxx . . $ _grn_proc#funcs.[PROC_INIT] && !proc->funcscxx . . $ _grn_proc#funcs.[PROC_NEXT] &&
3449 !proc->funcscxx . . $ _grn_proc#funcs.[PROC_FIN]) {
3450 return false;
3451 }
3452
3453 if (func->modify != (int32_t)(e->codes_currcxx . . $ _grn_expr#codes_curr. - 1)) {
3454 return false;
3455 }
3456 if (e->codescxx . . $ _grn_expr#codes.[func->modify].op != GRN_OP_CALL) {
3457 return false;
3458 }
3459
3460 return grn_expr_executor_init_simple_proccxx . . $ grn_expr_executor_init_simple_proc(a69fbfa71aaf4e06).(ctx, executor);
3461 }
3462
3463 static grn_obj *
3464 grn_expr_executor_exec_simple_proccxx . . $ grn_expr_executor_exec_simple_proc(16f9569af33219a9).(grn_ctx *ctx,
3465 grn_expr_executor *executor,
3466 grn_id id)
3467 {
3468 grn_expr_executor_data_simple_proc *data = &(executor->datacxx . . $ _grn_expr_executor#data..simple_proc.data);
3469 return grn_expr_executor_data_simple_proc_execcxx . . $ grn_expr_executor_data_simple_proc_exec(24ad10174f5c60d0).(ctx, executor, data, id);
3470 }
3471
3472 static void
3473 grn_expr_executor_fin_simple_proccxx . . $ grn_expr_executor_fin_simple_proc(a11777c3305b25fa).(grn_ctx *ctx, grn_expr_executor *executor)
3474 {
3475 grn_expr_executor_data_simple_proc *data = &(executor->datacxx . . $ _grn_expr_executor#data..simple_proc.data);
3476 grn_expr_executor_data_simple_proc_fincxx . . $ grn_expr_executor_data_simple_proc_fin(1473451689df91d8).(ctx, executor, data);
3477 }
3478
3479 static bool
3480 grn_expr_executor_is_simple_condition_constantcxx . . $ grn_expr_executor_is_simple_condition_constant(a69fbfa71aaf4e06).(grn_ctx *ctx,
3481 grn_expr_executor *executor)
3482 {
3483 grn_expr *e = (grn_expr *)(executor->exprcxx . . $ _grn_expr_executor#expr.);
3484 grn_expr_code *target;
3485 grn_expr_code *constant;
3486 grn_expr_code *operator_code;
3487 grn_id target_range;
3488 grn_id constant_range;
3489 bool constant_value_is_int = true;
3490 int64_t constant_value_int = 0;
3491 uint64_tcxx . . $ uint64_t# constant_value_uint = 0;
3492 bool constant_always_over = false;
3493 bool constant_always_under = false;
3494
3495 if (e->codes_currcxx . . $ _grn_expr#codes_curr. != 3) {
3496 return false;
3497 }
3498
3499 target = &(e->codescxx . . $ _grn_expr#codes.[0]);
3500 constant = &(e->codescxx . . $ _grn_expr#codes.[1]);
3501 operator_code = &(e->codescxx . . $ _grn_expr#codes.[2]);
3502
3503 switch (operator_code->op) {
3504 case GRN_OP_EQUAL:
3505 case GRN_OP_NOT_EQUAL:
3506 case GRN_OP_LESS:
3507 case GRN_OP_GREATER:
3508 case GRN_OP_LESS_EQUAL:
3509 case GRN_OP_GREATER_EQUAL:
3510 break;
3511 default:
3512 return false;
3513 }
3514 if (operator_code->nargs != 2) {
3515 return false;
3516 }
3517
3518 if (target->op != GRN_OP_GET_VALUE) {
3519 return false;
3520 }
3521 if (target->nargs != 1) {
3522 return false;
3523 }
3524 if (target->value->headercxx . . $ _grn_obj#header..type != GRN_COLUMN_FIX_SIZEcxx . . $ `include/groonga/groonga.h:900:9`!) {
3525 return false;
3526 }
3527
3528 target_range = grn_obj_get_range(ctx, target->value);
3529 if (!(GRN_DB_INT8 <= target_range && target_range <= GRN_DB_UINT64)) {
3530 return false;
3531 }
3532
3533 if (constant->op != GRN_OP_PUSH) {
3534 return false;
3535 }
3536 if (constant->nargs != 1) {
3537 return false;
3538 }
3539 if (!constant->value) {
3540 return false;
3541 }
3542 if (constant->value->headercxx . . $ _grn_obj#header..type != GRN_BULKcxx . . $ `include/groonga/groonga.h:868:9`!) {
3543 return false;
3544 }
3545 constant_range = constant->value->headercxx . . $ _grn_obj#header..domain;
3546 if (!(GRN_DB_INT8 <= constant_range && constant_range <= GRN_DB_UINT64)) {
3547 return false;
3548 }
3549
3550 #define CASE_INTcxx . . $ `lib/expr_executor.cpp:3550:9`!(N) \
3551 GRN_DB_INT##N : constant_value_is_int = true; \
3552 constant_value_int = GRN_INT##N##_VALUE(constant->value); \
3553 break
3554 #define CASE_UINTcxx . . $ `lib/expr_executor.cpp:3554:9`!(N) \
3555 GRN_DB_UINT##N : constant_value_is_int = false; \
3556 constant_value_uint = GRN_UINT##N##_VALUE(constant->value); \
3557 break
3558
3559 switch (constant_range) {
3560 case CASE_INTcxx . . $ `lib/expr_executor.cpp:3550:9`!(8); case CASE_UINTcxx . . $ `lib/expr_executor.cpp:3554:9`!(8); case CASE_INTcxx . . $ `lib/expr_executor.cpp:3550:9`!(16); case CASE_UINTcxx . . $ `lib/expr_executor.cpp:3554:9`!(16);
3561 case CASE_INTcxx . . $ `lib/expr_executor.cpp:3550:9`!(32); case CASE_UINTcxx . . $ `lib/expr_executor.cpp:3554:9`!(32); case CASE_INTcxx . . $ `lib/expr_executor.cpp:3550:9`!(64);
3562 case CASE_UINTcxx . . $ `lib/expr_executor.cpp:3554:9`!(64); default:
3563 return false;
3564 }
3565
3566 #undef CASE_INTcxx . . $ `lib/expr_executor.cpp:3550:9`!
3567 #undef CASE_UINTcxx . . $ `lib/expr_executor.cpp:3554:9`!
3568
3569 #define CASE_INTcxx . . $ `lib/expr_executor.cpp:3569:9`!(N) \
3570 GRN_DB_INT##N : if (constant_value_is_int) \
3571 { \
3572 if (constant_value_int > INT##N##_MAX) { \
3573 constant_always_over = true; \
3574 } else if (constant_value_int < INT##N##_MIN) { \
3575 constant_always_under = true; \
3576 } \
3577 } \
3578 else \
3579 { \
3580 if (constant_value_uint > INT##N##_MAX) { \
3581 constant_always_over = true; \
3582 } \
3583 } \
3584 break
3585 #define CASE_UINTcxx . . $ `lib/expr_executor.cpp:3585:9`!(N) \
3586 GRN_DB_UINT##N : if (constant_value_is_int) \
3587 { \
3588 if (constant_value_int > UINT##N##_MAX) { \
3589 constant_always_over = true; \
3590 } else if (constant_value_int < 0) { \
3591 constant_always_under = true; \
3592 } \
3593 } \
3594 else \
3595 { \
3596 if (constant_value_uint > UINT##N##_MAX) { \
3597 constant_always_over = true; \
3598 } \
3599 } \
3600 break
3601
3602 switch (target_range) {
3603 case CASE_INTcxx . . $ `lib/expr_executor.cpp:3569:9`!(8); case CASE_UINTcxx . . $ `lib/expr_executor.cpp:3585:9`!(8); case CASE_INTcxx . . $ `lib/expr_executor.cpp:3569:9`!(16); case CASE_UINTcxx . . $ `lib/expr_executor.cpp:3585:9`!(16);
3604 case CASE_INTcxx . . $ `lib/expr_executor.cpp:3569:9`!(32); case CASE_UINTcxx . . $ `lib/expr_executor.cpp:3585:9`!(32); case CASE_INTcxx . . $ `lib/expr_executor.cpp:3569:9`!(64);
3605 case GRN_DB_UINT64:
3606 if (constant_value_is_int && constant_value_int < 0) {
3607 constant_always_under = true;
3608 }
3609 break;
3610 default:
3611 return false;
3612 }
3613
3614 if (!constant_always_over && !constant_always_under) {
3615 return false;
3616 }
3617
3618 {
3619 bool result;
3620 grn_obj *result_buffer =
3621 &(executor->datacxx . . $ _grn_expr_executor#data..simple_condition_constant.result_buffer);
3622
3623 switch (operator_code->op) {
3624 case GRN_OP_EQUAL:
3625 result = false;
3626 break;
3627 case GRN_OP_NOT_EQUAL:
3628 result = true;
3629 break;
3630 case GRN_OP_LESS:
3631 case GRN_OP_LESS_EQUAL:
3632 result = constant_always_over;
3633 break;
3634 case GRN_OP_GREATER:
3635 case GRN_OP_GREATER_EQUAL:
3636 result = constant_always_under;
3637 break;
3638 default:
3639 return false;
3640 }
3641
3642 GRN_BOOL_INITcxx . . $ `include/groonga/groonga.h:2842:9`!(result_buffer, 0);
3643 GRN_BOOL_SETcxx . . $ `include/groonga/groonga.h:2879:9`!(ctx, result_buffer, result);
3644
3645 return true;
3646 }
3647 }
3648
3649 static grn_obj *
3650 grn_expr_executor_exec_simple_condition_constantcxx . . $ grn_expr_executor_exec_simple_condition_constant(16f9569af33219a9).(grn_ctx *ctx,
3651 grn_expr_executor *executor,
3652 grn_id id)
3653 {
3654 grn_obj *result_buffer =
3655 &(executor->datacxx . . $ _grn_expr_executor#data..simple_condition_constant.result_buffer);
3656 return result_buffer;
3657 }
3658
3659 static void
3660 grn_expr_executor_fin_simple_condition_constantcxx . . $ grn_expr_executor_fin_simple_condition_constant(a11777c3305b25fa).(grn_ctx *ctx,
3661 grn_expr_executor *executor)
3662 {
3663 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &(executor->data.simple_condition_constant.result_buffer));
3664 }
3665
3666 static void
3667 grn_expr_executor_init_simple_condition_racxx . . $ grn_expr_executor_init_simple_condition_ra(a11777c3305b25fa).(grn_ctx *ctx,
3668 grn_expr_executor *executor)
3669 {
3670 grn_expr *e = (grn_expr *)(executor->exprcxx . . $ _grn_expr_executor#expr.);
3671 grn_obj *target;
3672 grn_obj *constant;
3673 grn_operator op;
3674 grn_obj *result_buffer;
3675 grn_obj *value_buffer;
3676 grn_obj *constant_buffer;
3677
3678 target = e->codescxx . . $ _grn_expr#codes.[0].value;
3679 constant = e->codescxx . . $ _grn_expr#codes.[1].value;
3680 op = e->codescxx . . $ _grn_expr#codes.[2].op;
3681
3682 result_buffer = &(executor->datacxx . . $ _grn_expr_executor#data..simple_condition_ra.result_buffer);
3683 GRN_BOOL_INITcxx . . $ `include/groonga/groonga.h:2842:9`!(result_buffer, 0);
3684 GRN_BOOL_SETcxx . . $ `include/groonga/groonga.h:2879:9`!(ctx, result_buffer, false);
3685
3686 value_buffer = &(executor->datacxx . . $ _grn_expr_executor#data..simple_condition_ra.value_buffer);
3687 GRN_VOID_INITcxx . . $ `include/groonga/groonga.h:2749:9`!(value_buffer);
3688 grn_obj_reinit_for(ctx, value_buffer, target);
3689
3690 executor->datacxx . . $ _grn_expr_executor#data..simple_condition_ra.ra = (grn_ra *)target;
3691 GRN_RA_CACHE_INITcxx . . $ `lib/grn_store.h:91:9`!(executor->data.simple_condition_ra.ra,
3692 &(executor->data.simple_condition_ra.ra_cache));
3693 grn_ra_info(ctx,
3694 executor->datacxx . . $ _grn_expr_executor#data..simple_condition_ra.ra,
3695 &(executor->datacxx . . $ _grn_expr_executor#data..simple_condition_ra.ra_element_size));
3696
3697 executor->datacxx . . $ _grn_expr_executor#data..simple_condition_ra.exec = grn_operator_to_exec_func(op);
3698
3699 constant_buffer = &(executor->datacxx . . $ _grn_expr_executor#data..simple_condition_ra.constant_buffer);
3700 if (grn_obj_is_reference_column(ctx, target)) {
3701 GRN_OBJ_INITcxx . . $ `include/groonga/groonga.h:947:9`!(constant_buffer, GRN_BULKcxx . . $ `include/groonga/groonga.h:868:9`!, 0, constant->header.domain);
3702 grn_obj_cast(ctx, constant, constant_buffer, false);
3703 } else {
3704 GRN_VOID_INITcxx . . $ `include/groonga/groonga.h:2749:9`!(constant_buffer);
3705 grn_obj_reinit_for(ctx, constant_buffer, target);
3706 grn_obj_cast(ctx, constant, constant_buffer, false);
3707 }
3708 }
3709
3710 static bool
3711 grn_expr_executor_is_simple_condition_racxx . . $ grn_expr_executor_is_simple_condition_ra(a69fbfa71aaf4e06).(grn_ctx *ctx,
3712 grn_expr_executor *executor)
3713 {
3714 grn_expr *e = (grn_expr *)(executor->exprcxx . . $ _grn_expr_executor#expr.);
3715 grn_expr_code *target;
3716 grn_expr_code *constant;
3717 grn_expr_code *operator_code;
3718
3719 if (e->codes_currcxx . . $ _grn_expr#codes_curr. != 3) {
3720 return false;
3721 }
3722
3723 target = &(e->codescxx . . $ _grn_expr#codes.[0]);
3724 constant = &(e->codescxx . . $ _grn_expr#codes.[1]);
3725 operator_code = &(e->codescxx . . $ _grn_expr#codes.[2]);
3726
3727 switch (operator_code->op) {
3728 case GRN_OP_EQUAL:
3729 case GRN_OP_NOT_EQUAL:
3730 case GRN_OP_LESS:
3731 case GRN_OP_GREATER:
3732 case GRN_OP_LESS_EQUAL:
3733 case GRN_OP_GREATER_EQUAL:
3734 break;
3735 default:
3736 return false;
3737 }
3738 if (operator_code->nargs != 2) {
3739 return false;
3740 }
3741
3742 if (target->op != GRN_OP_GET_VALUE) {
3743 return false;
3744 }
3745 if (target->nargs != 1) {
3746 return false;
3747 }
3748 if (target->value->headercxx . . $ _grn_obj#header..type != GRN_COLUMN_FIX_SIZEcxx . . $ `include/groonga/groonga.h:900:9`!) {
3749 return false;
3750 }
3751
3752 if (constant->op != GRN_OP_PUSH) {
3753 return false;
3754 }
3755 if (constant->nargs != 1) {
3756 return false;
3757 }
3758 if (!constant->value) {
3759 return false;
3760 }
3761 if (constant->value->headercxx . . $ _grn_obj#header..type != GRN_BULKcxx . . $ `include/groonga/groonga.h:868:9`!) {
3762 return false;
3763 }
3764
3765 if (!grn_obj_is_reference_column(ctx, target->value)) {
3766 grn_obj constant_buffer;
3767 grn_rc rc;
3768 GRN_VOID_INITcxx . . $ `include/groonga/groonga.h:2749:9`!(&constant_buffer);
3769 grn_obj_reinit_for(ctx, &constant_buffer, target->value);
3770 rc = grn_obj_cast(ctx, constant->value, &constant_buffer, false);
3771 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &constant_buffer);
3772 if (rc != GRN_SUCCESS) {
3773 return false;
3774 }
3775 }
3776
3777 grn_expr_executor_init_simple_condition_racxx . . $ grn_expr_executor_init_simple_condition_ra(a11777c3305b25fa).(ctx, executor);
3778
3779 return true;
3780 }
3781
3782 static grn_obj *
3783 grn_expr_executor_exec_simple_condition_racxx . . $ grn_expr_executor_exec_simple_condition_ra(16f9569af33219a9).(grn_ctx *ctx,
3784 grn_expr_executor *executor,
3785 grn_id id)
3786 {
3787 grn_obj *result_buffer = &(executor->datacxx . . $ _grn_expr_executor#data..simple_condition_ra.result_buffer);
3788 grn_obj *value_buffer = &(executor->datacxx . . $ _grn_expr_executor#data..simple_condition_ra.value_buffer);
3789 grn_obj *constant_buffer =
3790 &(executor->datacxx . . $ _grn_expr_executor#data..simple_condition_ra.constant_buffer);
3791
3792 if (ctx->rccxx . . $ _grn_ctx#rc.) {
3793 GRN_BOOL_SETcxx . . $ `include/groonga/groonga.h:2879:9`!(ctx, result_buffer, false);
3794 return result_buffer;
3795 }
3796
3797 {
3798 grn_ra *ra = executor->datacxx . . $ _grn_expr_executor#data..simple_condition_ra.ra;
3799 grn_ra_cache *ra_cache = &(executor->datacxx . . $ _grn_expr_executor#data..simple_condition_ra.ra_cache);
3800 unsigned int ra_element_size =
3801 executor->datacxx . . $ _grn_expr_executor#data..simple_condition_ra.ra_element_size;
3802 void *raw_value;
3803 raw_value = grn_ra_ref_cache(ctx, ra, id, ra_cache);
3804 GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(value_buffer);
3805 grn_bulk_write(ctx,
3806 value_buffer,
3807 static_cast<char *>(raw_value),
3808 ra_element_size);
3809 }
3810
3811 if (executor->datacxx . . $ _grn_expr_executor#data..simple_condition_ra.exec(ctx,
3812 value_buffer,
3813 constant_buffer)) {
3814 GRN_BOOL_SETcxx . . $ `include/groonga/groonga.h:2879:9`!(ctx, result_buffer, true);
3815 } else {
3816 GRN_BOOL_SETcxx . . $ `include/groonga/groonga.h:2879:9`!(ctx, result_buffer, false);
3817 }
3818 return result_buffer;
3819 }
3820
3821 static void
3822 grn_expr_executor_fin_simple_condition_racxx . . $ grn_expr_executor_fin_simple_condition_ra(a11777c3305b25fa).(grn_ctx *ctx,
3823 grn_expr_executor *executor)
3824 {
3825 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &(executor->data.simple_condition_ra.result_buffer));
3826 GRN_RA_CACHE_FINcxx . . $ `lib/grn_store.h:97:9`!(ctx,
3827 executor->data.simple_condition_ra.ra,
3828 &(executor->data.simple_condition_ra.ra_cache));
3829 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &(executor->data.simple_condition_ra.value_buffer));
3830 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &(executor->data.simple_condition_ra.constant_buffer));
3831 }
3832
3833 static void
3834 grn_expr_executor_init_simple_conditioncxx . . $ grn_expr_executor_init_simple_condition(a11777c3305b25fa).(grn_ctx *ctx,
3835 grn_expr_executor *executor)
3836 {
3837 grn_expr *e = (grn_expr *)(executor->exprcxx . . $ _grn_expr_executor#expr.);
3838 grn_obj *target;
3839 grn_obj *constant;
3840 grn_operator op;
3841 grn_obj *result_buffer;
3842 grn_obj *value_buffer;
3843 grn_obj *constant_buffer;
3844 grn_rc rc;
3845
3846 target = e->codescxx . . $ _grn_expr#codes.[0].value;
3847 constant = e->codescxx . . $ _grn_expr#codes.[1].value;
3848 op = e->codescxx . . $ _grn_expr#codes.[2].op;
3849
3850 executor->datacxx . . $ _grn_expr_executor#data..simple_condition.need_exec = true;
3851
3852 result_buffer = &(executor->datacxx . . $ _grn_expr_executor#data..simple_condition.result_buffer);
3853 GRN_BOOL_INITcxx . . $ `include/groonga/groonga.h:2842:9`!(result_buffer, 0);
3854 GRN_BOOL_SETcxx . . $ `include/groonga/groonga.h:2879:9`!(ctx, result_buffer, false);
3855
3856 value_buffer = &(executor->datacxx . . $ _grn_expr_executor#data..simple_condition.value_buffer);
3857 GRN_VOID_INITcxx . . $ `include/groonga/groonga.h:2749:9`!(value_buffer);
3858 grn_obj_reinit_for(ctx, value_buffer, target);
3859
3860 executor->datacxx . . $ _grn_expr_executor#data..simple_condition.exec = grn_operator_to_exec_func(op);
3861
3862 constant_buffer = &(executor->datacxx . . $ _grn_expr_executor#data..simple_condition.constant_buffer);
3863 GRN_VOID_INITcxx . . $ `include/groonga/groonga.h:2749:9`!(constant_buffer);
3864 grn_obj_reinit_for(ctx, constant_buffer, target);
3865 rc = grn_obj_cast(ctx, constant, constant_buffer, false);
3866 if (rc != GRN_SUCCESS) {
3867 grn_obj *type;
3868
3869 type = grn_ctx_at(ctx, constant_buffer->headercxx . . $ _grn_obj#header..domain);
3870 if (grn_obj_is_table(ctx, type)) {
3871 GRN_BOOL_SETcxx . . $ `include/groonga/groonga.h:2879:9`!(ctx, result_buffer, (op == GRN_OP_NOT_EQUAL));
3872 executor->datacxx . . $ _grn_expr_executor#data..simple_condition.need_exec = false;
3873 } else {
3874 int type_name_size;
3875 char type_name[GRN_TABLE_MAX_KEY_SIZEcxx . . $ `include/groonga/table.h:26:9`!];
3876 grn_obj inspected;
3877
3878 type_name_size =
3879 grn_obj_name(ctx, type, type_name, GRN_TABLE_MAX_KEY_SIZEcxx . . $ `include/groonga/table.h:26:9`!);
3880 GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&inspected, 0);
3881 grn_inspect(ctx, &inspected, constant);
3882 ERRcxx . . $ `lib/grn_error.h:156:9`!(rc,
3883 "[expr-executor][condition] "
3884 "failed to cast to <%.*s>: <%.*s>",
3885 type_name_size,
3886 type_name,
3887 (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&inspected),
3888 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&inspected));
3889 }
3890 }
3891 }
3892
3893 static bool
3894 grn_expr_executor_is_simple_conditioncxx . . $ grn_expr_executor_is_simple_condition(a69fbfa71aaf4e06).(grn_ctx *ctx, grn_expr_executor *executor)
3895 {
3896 grn_expr *e = (grn_expr *)(executor->exprcxx . . $ _grn_expr_executor#expr.);
3897 grn_expr_code *target;
3898 grn_expr_code *constant;
3899 grn_expr_code *operator_code;
3900
3901 if (e->codes_currcxx . . $ _grn_expr#codes_curr. != 3) {
3902 return false;
3903 }
3904
3905 target = &(e->codescxx . . $ _grn_expr#codes.[0]);
3906 constant = &(e->codescxx . . $ _grn_expr#codes.[1]);
3907 operator_code = &(e->codescxx . . $ _grn_expr#codes.[2]);
3908
3909 switch (operator_code->op) {
3910 case GRN_OP_EQUAL:
3911 case GRN_OP_NOT_EQUAL:
3912 case GRN_OP_LESS:
3913 case GRN_OP_GREATER:
3914 case GRN_OP_LESS_EQUAL:
3915 case GRN_OP_GREATER_EQUAL:
3916 break;
3917 default:
3918 return false;
3919 }
3920 if (operator_code->nargs != 2) {
3921 return false;
3922 }
3923
3924 if (target->op != GRN_OP_GET_VALUE) {
3925 return false;
3926 }
3927 if (target->nargs != 1) {
3928 return false;
3929 }
3930 if (!grn_obj_is_scalar_column(ctx, target->value)) {
3931 return false;
3932 }
3933
3934 if (constant->op != GRN_OP_PUSH) {
3935 return false;
3936 }
3937 if (constant->nargs != 1) {
3938 return false;
3939 }
3940 if (!constant->value) {
3941 return false;
3942 }
3943 if (constant->value->headercxx . . $ _grn_obj#header..type != GRN_BULKcxx . . $ `include/groonga/groonga.h:868:9`!) {
3944 return false;
3945 }
3946
3947 grn_expr_executor_init_simple_conditioncxx . . $ grn_expr_executor_init_simple_condition(a11777c3305b25fa).(ctx, executor);
3948
3949 return true;
3950 }
3951
3952 static grn_obj *
3953 grn_expr_executor_exec_simple_conditioncxx . . $ grn_expr_executor_exec_simple_condition(16f9569af33219a9).(grn_ctx *ctx,
3954 grn_expr_executor *executor,
3955 grn_id id)
3956 {
3957 grn_expr *e = (grn_expr *)(executor->exprcxx . . $ _grn_expr_executor#expr.);
3958 grn_obj *target;
3959 grn_obj *result_buffer = &(executor->datacxx . . $ _grn_expr_executor#data..simple_condition.result_buffer);
3960 grn_obj *value_buffer = &(executor->datacxx . . $ _grn_expr_executor#data..simple_condition.value_buffer);
3961 grn_obj *constant_buffer = &(executor->datacxx . . $ _grn_expr_executor#data..simple_condition.constant_buffer);
3962
3963 if (ctx->rccxx . . $ _grn_ctx#rc.) {
3964 GRN_BOOL_SETcxx . . $ `include/groonga/groonga.h:2879:9`!(ctx, result_buffer, false);
3965 return result_buffer;
3966 }
3967
3968 if (!executor->datacxx . . $ _grn_expr_executor#data..simple_condition.need_exec) {
3969 return result_buffer;
3970 }
3971
3972 target = e->codescxx . . $ _grn_expr#codes.[0].value;
3973 GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(value_buffer);
3974 grn_obj_get_value(ctx, target, id, value_buffer);
3975
3976 if (executor->datacxx . . $ _grn_expr_executor#data..simple_condition.exec(ctx,
3977 value_buffer,
3978 constant_buffer)) {
3979 GRN_BOOL_SETcxx . . $ `include/groonga/groonga.h:2879:9`!(ctx, result_buffer, true);
3980 } else {
3981 GRN_BOOL_SETcxx . . $ `include/groonga/groonga.h:2879:9`!(ctx, result_buffer, false);
3982 }
3983 return result_buffer;
3984 }
3985
3986 static void
3987 grn_expr_executor_fin_simple_conditioncxx . . $ grn_expr_executor_fin_simple_condition(a11777c3305b25fa).(grn_ctx *ctx,
3988 grn_expr_executor *executor)
3989 {
3990 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &(executor->data.simple_condition.result_buffer));
3991 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &(executor->data.simple_condition.value_buffer));
3992 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &(executor->data.simple_condition.constant_buffer));
3993 }
3994
3995 static bool
3996 grn_expr_executor_init_simple_proc_scorercxx . . $ grn_expr_executor_init_simple_proc_scorer(a69fbfa71aaf4e06).(grn_ctx *ctx,
3997 grn_expr_executor *executor)
3998 {
3999 grn_expr_executor_data_simple_proc *data =
4000 &(executor->datacxx . . $ _grn_expr_executor#data..simple_proc_scorer.data);
4001 /* The first GRN_OP_GET_REF for _score */
4002 data->codes_start_offset = 1;
4003 /* The last GRN_OP_ASSIGN */
4004 data->codes_end_offset = 1;
4005 return grn_expr_executor_data_simple_proc_initcxx . . $ grn_expr_executor_data_simple_proc_init(6b7121c92f768323).(ctx, executor, data);
4006 }
4007
4008 static void
4009 grn_expr_executor_fin_simple_proc_scorercxx . . $ grn_expr_executor_fin_simple_proc_scorer(a11777c3305b25fa).(grn_ctx *ctx,
4010 grn_expr_executor *executor)
4011 {
4012 grn_expr_executor_data_simple_proc *data =
4013 &(executor->datacxx . . $ _grn_expr_executor#data..simple_proc_scorer.data);
4014 grn_expr_executor_data_simple_proc_fincxx . . $ grn_expr_executor_data_simple_proc_fin(1473451689df91d8).(ctx, executor, data);
4015 }
4016
4017 static bool
4018 grn_expr_executor_is_simple_proc_scorercxx . . $ grn_expr_executor_is_simple_proc_scorer(a69fbfa71aaf4e06).(grn_ctx *ctx,
4019 grn_expr_executor *executor)
4020 {
4021 grn_expr *e = (grn_expr *)(executor->exprcxx . . $ _grn_expr_executor#expr.);
4022
4023 /*
4024 * 0: GRN_OP_GET_REF(_score)
4025 * 1: GRN_OP_PUSH(func)
4026 * n-2: GRN_OP_CALL(func)
4027 * n-1: GRN_OP_ASSIGN(_score)
4028 */
4029 if (e->codes_currcxx . . $ _grn_expr#codes_curr. < 4) {
4030 return false;
4031 }
4032
4033 grn_expr_code *score = &(e->codescxx . . $ _grn_expr#codes.[0]);
4034 if (score->op != GRN_OP_GET_REF) {
4035 return false;
4036 }
4037 if (!grn_obj_is_score_accessor(ctx, score->value)) {
4038 return false;
4039 }
4040 executor->datacxx . . $ _grn_expr_executor#data..simple_proc_scorer.score_column = score->value;
4041
4042 if (score->modify != (int32_t)(e->codes_currcxx . . $ _grn_expr#codes_curr. - 1)) {
4043 return false;
4044 }
4045 grn_expr_code *operation = &(e->codescxx . . $ _grn_expr#codes.[score->modify]);
4046 if (operation->op != GRN_OP_ASSIGN) {
4047 return false;
4048 }
4049
4050 const size_t func_index = 1;
4051 grn_expr_code *func = &(e->codescxx . . $ _grn_expr#codes.[func_index]);
4052 if (func->op != GRN_OP_PUSH) {
4053 return false;
4054 }
4055 if (!grn_obj_is_function_proc(ctx, func->value)) {
4056 return false;
4057 }
4058 grn_proc *proc = (grn_proc *)(func->value);
4059 if (!proc->funcscxx . . $ _grn_proc#funcs.[PROC_INIT] && !proc->funcscxx . . $ _grn_proc#funcs.[PROC_NEXT] &&
4060 !proc->funcscxx . . $ _grn_proc#funcs.[PROC_FIN]) {
4061 return false;
4062 }
4063
4064 if ((func->modify + func_index) != e->codes_currcxx . . $ _grn_expr#codes_curr. - 2) {
4065 return false;
4066 }
4067 if (e->codescxx . . $ _grn_expr#codes.[func->modify + func_index].op != GRN_OP_CALL) {
4068 return false;
4069 }
4070
4071 if (!grn_expr_executor_init_simple_proc_scorercxx . . $ grn_expr_executor_init_simple_proc_scorer(a69fbfa71aaf4e06).(ctx, executor)) {
4072 grn_expr_executor_fin_simple_proc_scorercxx . . $ grn_expr_executor_fin_simple_proc_scorer(a11777c3305b25fa).(ctx, executor);
4073 return false;
4074 }
4075
4076 return true;
4077 }
4078
4079 static grn_obj *
4080 grn_expr_executor_exec_simple_proc_scorercxx . . $ grn_expr_executor_exec_simple_proc_scorer(16f9569af33219a9).(grn_ctx *ctx,
4081 grn_expr_executor *executor,
4082 grn_id id)
4083 {
4084 grn_expr_executor_data_simple_proc *data =
4085 &(executor->datacxx . . $ _grn_expr_executor#data..simple_proc_scorer.data);
4086 grn_obj *score =
4087 grn_expr_executor_data_simple_proc_execcxx . . $ grn_expr_executor_data_simple_proc_exec(24ad10174f5c60d0).(ctx, executor, data, id);
4088 if (score) {
4089 grn_obj *score_column = executor->datacxx . . $ _grn_expr_executor#data..simple_proc_scorer.score_column;
4090 grn_obj_set_value(ctx, score_column, id, score, GRN_OBJ_SETcxx . . $ `include/groonga/groonga.h:1466:9`!);
4091 }
4092 return score;
4093 }
4094
4095 static double
4096 grn_expr_executor_scorer_get_valuecxx . . $ grn_expr_executor_scorer_get_value(d514af004b222e2b).(grn_ctx *ctx,
4097 grn_expr_executor *executor,
4098 grn_id id,
4099 grn_obj *args,
4100 grn_expr_executor_scorer_data *data)
4101 {
4102 grn_obj *source_buffer = &(data->source_buffer);
4103 grn_obj *score_buffer = &(executor->datacxx . . $ _grn_expr_executor#data..scorer.score_buffer);
4104 if (data->cache) {
4105 size_t size;
4106 void *value = grn_column_cache_ref(ctx, data->cache, id, &size);
4107 if (size == 0) {
4108 return 0.0;
4109 }
4110 if (source_buffer->headercxx . . $ _grn_obj#header..domain == GRN_DB_FLOAT) {
4111 return *((double *)value);
4112 }
4113 GRN_TEXT_SETcxx . . $ `include/groonga/groonga.h:2761:9`!(ctx, source_buffer, value, size);
4114 } else {
4115 GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(source_buffer);
4116 grn_obj_get_value(ctx, data->source, id, source_buffer);
4117 if (GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(source_buffer) == 0) {
4118 return 0.0;
4119 }
4120 if (source_buffer->headercxx . . $ _grn_obj#header..domain == GRN_DB_FLOAT) {
4121 return GRN_FLOAT_VALUEcxx . . $ `include/groonga/groonga.h:3108:9`!(source_buffer);
4122 }
4123 }
4124 GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(score_buffer);
4125 grn_rc rc = grn_obj_cast(ctx, source_buffer, score_buffer, true);
4126 if (rc == GRN_SUCCESS) {
4127 return GRN_FLOAT_VALUEcxx . . $ `include/groonga/groonga.h:3108:9`!(score_buffer);
4128 } else {
4129 return 0.0;
4130 }
4131 }
4132
4133 static double
4134 grn_expr_executor_scorer_pushcxx . . $ grn_expr_executor_scorer_push(d514af004b222e2b).(grn_ctx *ctx,
4135 grn_expr_executor *executor,
4136 grn_id id,
4137 grn_obj *args,
4138 grn_expr_executor_scorer_data *data)
4139 {
4140 grn_obj *source = data->source;
4141 grn_obj *score_buffer = &(executor->datacxx . . $ _grn_expr_executor#data..scorer.score_buffer);
4142 if (GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(source) == 0) {
4143 return 0.0;
4144 }
4145 if (source->headercxx . . $ _grn_obj#header..domain == GRN_DB_FLOAT) {
4146 return GRN_FLOAT_VALUEcxx . . $ `include/groonga/groonga.h:3108:9`!(source);
4147 }
4148 GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(score_buffer);
4149 grn_rc rc = grn_obj_cast(ctx, source, score_buffer, true);
4150 if (rc == GRN_SUCCESS) {
4151 return GRN_FLOAT_VALUEcxx . . $ `include/groonga/groonga.h:3108:9`!(score_buffer);
4152 } else {
4153 return 0.0;
4154 }
4155 }
4156
4157 static double
4158 grn_expr_executor_scorer_starcxx . . $ grn_expr_executor_scorer_star(d514af004b222e2b).(grn_ctx *ctx,
4159 grn_expr_executor *executor,
4160 grn_id id,
4161 grn_obj *args,
4162 grn_expr_executor_scorer_data *data)
4163 {
4164 double right;
4165 GRN_FLOAT_POPcxx . . $ `include/groonga/groonga.h:3245:9`!(args, right);
4166 double left;
4167 GRN_FLOAT_POPcxx . . $ `include/groonga/groonga.h:3245:9`!(args, left);
4168 return left * right;
4169 }
4170
4171 static double
4172 grn_expr_executor_scorer_pluscxx . . $ grn_expr_executor_scorer_plus(d514af004b222e2b).(grn_ctx *ctx,
4173 grn_expr_executor *executor,
4174 grn_id id,
4175 grn_obj *args,
4176 grn_expr_executor_scorer_data *data)
4177 {
4178 double right;
4179 GRN_FLOAT_POPcxx . . $ `include/groonga/groonga.h:3245:9`!(args, right);
4180 double left;
4181 GRN_FLOAT_POPcxx . . $ `include/groonga/groonga.h:3245:9`!(args, left);
4182 return left + right;
4183 }
4184
4185 static double
4186 grn_expr_executor_scorer_minuscxx . . $ grn_expr_executor_scorer_minus(d514af004b222e2b).(grn_ctx *ctx,
4187 grn_expr_executor *executor,
4188 grn_id id,
4189 grn_obj *args,
4190 grn_expr_executor_scorer_data *data)
4191 {
4192 double right;
4193 GRN_FLOAT_POPcxx . . $ `include/groonga/groonga.h:3245:9`!(args, right);
4194 double left;
4195 GRN_FLOAT_POPcxx . . $ `include/groonga/groonga.h:3245:9`!(args, left);
4196 return left - right;
4197 }
4198
4199 static bool
4200 grn_expr_executor_init_scorercxx . . $ grn_expr_executor_init_scorer(a69fbfa71aaf4e06).(grn_ctx *ctx, grn_expr_executor *executor)
4201 {
4202 grn_expr *e = (grn_expr *)(executor->exprcxx . . $ _grn_expr_executor#expr.);
4203
4204 GRN_FLOAT_INITcxx . . $ `include/groonga/groonga.h:2864:9`!(&(executor->data.scorer.args), GRN_OBJ_VECTORcxx . . $ `include/groonga/groonga.h:2734:9`!);
4205 GRN_FLOAT_INITcxx . . $ `include/groonga/groonga.h:2864:9`!(&(executor->data.scorer.score_buffer), 0);
4206
4207 executor->datacxx . . $ _grn_expr_executor#data..scorer.n_funcs = 0;
4208 /* The first GRN_OP_GET_REF and the last GRN_OP_ASSIGN are needless. */
4209 size_t n_allocated_funcs = e->codes_currcxx . . $ _grn_expr#codes_curr. - 2;
4210 executor->datacxx . . $ _grn_expr_executor#data..scorer.funcs =
4211 GRN_MALLOCNcxx . . $ `lib/grn_alloc.h:50:9`!(grn_expr_executor_scorer_func, n_allocated_funcs);
4212 if (!executor->datacxx . . $ _grn_expr_executor#data..scorer.funcs) {
4213 return false;
4214 }
4215 executor->datacxx . . $ _grn_expr_executor#data..scorer.datas =
4216 GRN_MALLOCNcxx . . $ `lib/grn_alloc.h:50:9`!(grn_expr_executor_scorer_data, n_allocated_funcs);
4217 if (!executor->datacxx . . $ _grn_expr_executor#data..scorer.datas) {
4218 GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(executor->data.scorer.funcs);
4219 return false;
4220 }
4221 executor->datacxx . . $ _grn_expr_executor#data..scorer.n_allocated_funcs = n_allocated_funcs;
4222 {
4223 size_t i;
4224 for (i = 0; i < executor->datacxx . . $ _grn_expr_executor#data..scorer.n_allocated_funcs; i++) {
4225 executor->datacxx . . $ _grn_expr_executor#data..scorer.funcs[i] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
4226 GRN_VOID_INITcxx . . $ `include/groonga/groonga.h:2749:9`!(&(executor->data.scorer.datas[i].source_buffer));
4227 executor->datacxx . . $ _grn_expr_executor#data..scorer.datas[i].source = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
4228 executor->datacxx . . $ _grn_expr_executor#data..scorer.datas[i].cache = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
4229 executor->datacxx . . $ _grn_expr_executor#data..scorer.datas[i].n_required_args = 0;
4230 }
4231 }
4232
4233 {
4234 uint32_tcxx . . $ uint32_t# i;
4235 for (i = 1; i < (e->codes_currcxx . . $ _grn_expr#codes_curr. - 1); i++) {
4236 grn_expr_code *code = &(e->codescxx . . $ _grn_expr#codes.[i]);
4237 size_t nth_func = executor->datacxx . . $ _grn_expr_executor#data..scorer.n_funcs;
4238 grn_expr_executor_scorer_data *data =
4239 &(executor->datacxx . . $ _grn_expr_executor#data..scorer.datas[nth_func]);
4240 switch (code->op) {
4241 case GRN_OP_GET_VALUE:
4242 {
4243 data->source = code->value;
4244 data->cache = grn_column_cache_open(ctx, data->source);
4245 grn_id range = grn_obj_get_range(ctx, data->source);
4246 grn_obj_reinit(ctx, &(data->source_buffer), range, 0);
4247 if (data->cache) {
4248 data->source_buffer.headercxx . . $ _grn_obj#header..impl_flags = GRN_OBJ_DO_SHALLOW_COPYcxx . . $ `include/groonga/groonga.h:2732:9`!;
4249 }
4250 executor->datacxx . . $ _grn_expr_executor#data..scorer.funcs[nth_func] =
4251 grn_expr_executor_scorer_get_valuecxx . . $ grn_expr_executor_scorer_get_value(d514af004b222e2b).;
4252 break;
4253 }
4254 case GRN_OP_PUSH:
4255 data->source = code->value;
4256 executor->datacxx . . $ _grn_expr_executor#data..scorer.funcs[nth_func] = grn_expr_executor_scorer_pushcxx . . $ grn_expr_executor_scorer_push(d514af004b222e2b).;
4257 break;
4258 case GRN_OP_STAR:
4259 data->n_required_args = 2;
4260 executor->datacxx . . $ _grn_expr_executor#data..scorer.funcs[nth_func] = grn_expr_executor_scorer_starcxx . . $ grn_expr_executor_scorer_star(d514af004b222e2b).;
4261 break;
4262 case GRN_OP_PLUS:
4263 data->n_required_args = 2;
4264 executor->datacxx . . $ _grn_expr_executor#data..scorer.funcs[nth_func] = grn_expr_executor_scorer_pluscxx . . $ grn_expr_executor_scorer_plus(d514af004b222e2b).;
4265 break;
4266 case GRN_OP_MINUS:
4267 data->n_required_args = 2;
4268 executor->datacxx . . $ _grn_expr_executor#data..scorer.funcs[nth_func] = grn_expr_executor_scorer_minuscxx . . $ grn_expr_executor_scorer_minus(d514af004b222e2b).;
4269 break;
4270 default:
4271 return false;
4272 }
4273 executor->datacxx . . $ _grn_expr_executor#data..scorer.n_funcs++;
4274 }
4275 }
4276
4277 return true;
4278 }
4279
4280 static void
4281 grn_expr_executor_fin_scorercxx . . $ grn_expr_executor_fin_scorer(a11777c3305b25fa).(grn_ctx *ctx, grn_expr_executor *executor)
4282 {
4283 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &(executor->data.scorer.args));
4284 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &(executor->data.scorer.score_buffer));
4285
4286 size_t n_allocated_funcs = executor->datacxx . . $ _grn_expr_executor#data..scorer.n_allocated_funcs;
4287 if (n_allocated_funcs == 0) {
4288 return;
4289 }
4290
4291 size_t i;
4292 for (i = 0; i < n_allocated_funcs; i++) {
4293 grn_expr_executor_scorer_data *data = &(executor->datacxx . . $ _grn_expr_executor#data..scorer.datas[i]);
4294 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &(data->source_buffer));
4295 if (data->cache) {
4296 grn_column_cache_close(ctx, data->cache);
4297 }
4298 }
4299 GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(executor->data.scorer.funcs);
4300 GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(executor->data.scorer.datas);
4301 }
4302
4303 static bool
4304 grn_expr_executor_is_scorercxx . . $ grn_expr_executor_is_scorer(a69fbfa71aaf4e06).(grn_ctx *ctx, grn_expr_executor *executor)
4305 {
4306 grn_expr *e = (grn_expr *)(executor->exprcxx . . $ _grn_expr_executor#expr.);
4307
4308 if (e->codes_currcxx . . $ _grn_expr#codes_curr. < 2) {
4309 return false;
4310 }
4311
4312 grn_expr_code *score = &(e->codescxx . . $ _grn_expr#codes.[0]);
4313 if (score->op != GRN_OP_GET_REF) {
4314 return false;
4315 }
4316 if (!grn_obj_is_score_accessor(ctx, score->value)) {
4317 return false;
4318 }
4319 executor->datacxx . . $ _grn_expr_executor#data..scorer.score_column = score->value;
4320
4321 grn_expr_code *operation = &(e->codescxx . . $ _grn_expr#codes.[score->modify]);
4322 if (operation->op != GRN_OP_ASSIGN) {
4323 return false;
4324 }
4325
4326 if (!grn_expr_executor_init_scorercxx . . $ grn_expr_executor_init_scorer(a69fbfa71aaf4e06).(ctx, executor)) {
4327 grn_expr_executor_fin_scorercxx . . $ grn_expr_executor_fin_scorer(a11777c3305b25fa).(ctx, executor);
4328 return false;
4329 }
4330
4331 return true;
4332 }
4333
4334 static grn_obj *
4335 grn_expr_executor_exec_scorercxx . . $ grn_expr_executor_exec_scorer(16f9569af33219a9).(grn_ctx *ctx,
4336 grn_expr_executor *executor,
4337 grn_id id)
4338 {
4339 double score = 0.0;
4340 grn_obj *args = &(executor->datacxx . . $ _grn_expr_executor#data..scorer.args);
4341 GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(args);
4342 size_t n_funcs = executor->datacxx . . $ _grn_expr_executor#data..scorer.n_funcs;
4343 size_t i;
4344 for (i = 0; i < n_funcs; i++) {
4345 grn_expr_executor_scorer_func func = executor->datacxx . . $ _grn_expr_executor#data..scorer.funcs[i];
4346 grn_expr_executor_scorer_data *data = &(executor->datacxx . . $ _grn_expr_executor#data..scorer.datas[i]);
4347 double value = func(ctx, executor, id, args, data);
4348 GRN_FLOAT_PUTcxx . . $ `include/groonga/groonga.h:3207:9`!(ctx, args, value);
4349 score = value;
4350 }
4351 grn_obj *score_column = executor->datacxx . . $ _grn_expr_executor#data..scorer.score_column;
4352 grn_obj *score_buffer = &(executor->datacxx . . $ _grn_expr_executor#data..scorer.score_buffer);
4353 GRN_FLOAT_SETcxx . . $ `include/groonga/groonga.h:2934:9`!(ctx, score_buffer, score);
4354 grn_obj_set_value(ctx, score_column, id, score_buffer, GRN_OBJ_SETcxx . . $ `include/groonga/groonga.h:1466:9`!);
4355
4356 return score_buffer;
4357 }
4358
4359 extern "C" {
4360 grn_rc
4361 grn_expr_executor_init(grn_ctx *ctx, grn_expr_executor *executor, grn_obj *expr)
4362 {
4363 GRN_API_ENTERcxx . . $ `lib/grn_ctx.h:41:9`!;
4364
4365 if (!grn_obj_is_expr(ctx, expr)) {
4366 grn_rc rc = ctx->rccxx . . $ _grn_ctx#rc.;
4367 grn_obj inspected;
4368 GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&inspected, 0);
4369 grn_inspect(ctx, &inspected, expr);
4370 if (rc == GRN_SUCCESS) {
4371 rc = GRN_INVALID_ARGUMENT;
4372 }
4373 ERRcxx . . $ `lib/grn_error.h:156:9`!(rc,
4374 "[expr-executor][init] invalid expression: %.*s",
4375 (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&inspected),
4376 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&inspected));
4377 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &inspected);
4378 GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(ctx->rc);
4379 }
4380
4381 executor->exprcxx . . $ _grn_expr_executor#expr. = expr;
4382 executor->variablecxx . . $ _grn_expr_executor#variable. = grn_expr_get_var_by_offset(ctx, expr, 0);
4383 GRN_RECORD_INITcxx . . $ `include/groonga/groonga.h:2868:9`!(&(executor->replace_ids), GRN_OBJ_VECTORcxx . . $ `include/groonga/groonga.h:2734:9`!, GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!);
4384 GRN_PTR_INITcxx . . $ `include/groonga/groonga.h:2869:9`!(&(executor->replace_values), GRN_OBJ_VECTORcxx . . $ `include/groonga/groonga.h:2734:9`!, GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!);
4385 if (grn_expr_executor_is_constantcxx . . $ grn_expr_executor_is_constant(a69fbfa71aaf4e06).(ctx, executor)) {
4386 executor->execcxx . . $ _grn_expr_executor#exec. = grn_expr_executor_exec_constantcxx . . $ grn_expr_executor_exec_constant(16f9569af33219a9).;
4387 executor->fincxx . . $ _grn_expr_executor#fin. = grn_expr_executor_fin_constantcxx . . $ grn_expr_executor_fin_constant(a11777c3305b25fa).;
4388 } else if (grn_expr_executor_is_valuecxx . . $ grn_expr_executor_is_value(a69fbfa71aaf4e06).(ctx, executor)) {
4389 executor->execcxx . . $ _grn_expr_executor#exec. = grn_expr_executor_exec_valuecxx . . $ grn_expr_executor_exec_value(16f9569af33219a9).;
4390 executor->fincxx . . $ _grn_expr_executor#fin. = grn_expr_executor_fin_valuecxx . . $ grn_expr_executor_fin_value(a11777c3305b25fa).;
4391 #ifdef GRN_SUPPORT_REGEXPcxx . . $ `lib/grn.h:734:11`!
4392 } else if (grn_expr_executor_is_simple_regexpcxx . . $ grn_expr_executor_is_simple_regexp(a69fbfa71aaf4e06).(ctx, executor)) {
4393 executor->execcxx . . $ _grn_expr_executor#exec. = grn_expr_executor_exec_simple_regexpcxx . . $ grn_expr_executor_exec_simple_regexp(16f9569af33219a9).;
4394 executor->fincxx . . $ _grn_expr_executor#fin. = grn_expr_executor_fin_simple_regexpcxx . . $ grn_expr_executor_fin_simple_regexp(a11777c3305b25fa).;
4395 #endif /* GRN_SUPPORT_REGEXP */
4396 } else if (grn_expr_executor_is_simple_matchcxx . . $ grn_expr_executor_is_simple_match(a69fbfa71aaf4e06).(ctx, executor)) {
4397 executor->execcxx . . $ _grn_expr_executor#exec. = grn_expr_executor_exec_simple_matchcxx . . $ grn_expr_executor_exec_simple_match(16f9569af33219a9).;
4398 executor->fincxx . . $ _grn_expr_executor#fin. = grn_expr_executor_fin_simple_matchcxx . . $ grn_expr_executor_fin_simple_match(a11777c3305b25fa).;
4399 } else if (grn_expr_executor_is_simple_proccxx . . $ grn_expr_executor_is_simple_proc(a69fbfa71aaf4e06).(ctx, executor)) {
4400 executor->execcxx . . $ _grn_expr_executor#exec. = grn_expr_executor_exec_simple_proccxx . . $ grn_expr_executor_exec_simple_proc(16f9569af33219a9).;
4401 executor->fincxx . . $ _grn_expr_executor#fin. = grn_expr_executor_fin_simple_proccxx . . $ grn_expr_executor_fin_simple_proc(a11777c3305b25fa).;
4402 } else if (grn_expr_executor_is_simple_condition_constantcxx . . $ grn_expr_executor_is_simple_condition_constant(a69fbfa71aaf4e06).(ctx, executor)) {
4403 executor->execcxx . . $ _grn_expr_executor#exec. = grn_expr_executor_exec_simple_condition_constantcxx . . $ grn_expr_executor_exec_simple_condition_constant(16f9569af33219a9).;
4404 executor->fincxx . . $ _grn_expr_executor#fin. = grn_expr_executor_fin_simple_condition_constantcxx . . $ grn_expr_executor_fin_simple_condition_constant(a11777c3305b25fa).;
4405 } else if (grn_expr_executor_is_simple_condition_racxx . . $ grn_expr_executor_is_simple_condition_ra(a69fbfa71aaf4e06).(ctx, executor)) {
4406 executor->execcxx . . $ _grn_expr_executor#exec. = grn_expr_executor_exec_simple_condition_racxx . . $ grn_expr_executor_exec_simple_condition_ra(16f9569af33219a9).;
4407 executor->fincxx . . $ _grn_expr_executor#fin. = grn_expr_executor_fin_simple_condition_racxx . . $ grn_expr_executor_fin_simple_condition_ra(a11777c3305b25fa).;
4408 } else if (grn_expr_executor_is_simple_conditioncxx . . $ grn_expr_executor_is_simple_condition(a69fbfa71aaf4e06).(ctx, executor)) {
4409 executor->execcxx . . $ _grn_expr_executor#exec. = grn_expr_executor_exec_simple_conditioncxx . . $ grn_expr_executor_exec_simple_condition(16f9569af33219a9).;
4410 executor->fincxx . . $ _grn_expr_executor#fin. = grn_expr_executor_fin_simple_conditioncxx . . $ grn_expr_executor_fin_simple_condition(a11777c3305b25fa).;
4411 } else if (grn_expr_executor_is_simple_proc_scorercxx . . $ grn_expr_executor_is_simple_proc_scorer(a69fbfa71aaf4e06).(ctx, executor)) {
4412 executor->execcxx . . $ _grn_expr_executor#exec. = grn_expr_executor_exec_simple_proc_scorercxx . . $ grn_expr_executor_exec_simple_proc_scorer(16f9569af33219a9).;
4413 executor->fincxx . . $ _grn_expr_executor#fin. = grn_expr_executor_fin_simple_proc_scorercxx . . $ grn_expr_executor_fin_simple_proc_scorer(a11777c3305b25fa).;
4414 } else if (grn_expr_executor_is_scorercxx . . $ grn_expr_executor_is_scorer(a69fbfa71aaf4e06).(ctx, executor)) {
4415 executor->execcxx . . $ _grn_expr_executor#exec. = grn_expr_executor_exec_scorercxx . . $ grn_expr_executor_exec_scorer(16f9569af33219a9).;
4416 executor->fincxx . . $ _grn_expr_executor#fin. = grn_expr_executor_fin_scorercxx . . $ grn_expr_executor_fin_scorer(a11777c3305b25fa).;
4417 } else {
4418 grn_expr_executor_init_generalcxx . . $ grn_expr_executor_init_general(a11777c3305b25fa).(ctx, executor);
4419 executor->execcxx . . $ _grn_expr_executor#exec. = grn_expr_executor_exec_generalcxx . . $ grn_expr_executor_exec_general(16f9569af33219a9).;
4420 executor->fincxx . . $ _grn_expr_executor#fin. = grn_expr_executor_fin_generalcxx . . $ grn_expr_executor_fin_general(a11777c3305b25fa).;
4421 }
4422
4423 GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(ctx->rc);
4424 }
4425
4426 grn_rc
4427 grn_expr_executor_fin(grn_ctx *ctx, grn_expr_executor *executor)
4428 {
4429 GRN_API_ENTERcxx . . $ `lib/grn_ctx.h:41:9`!;
4430
4431 if (!executor) {
4432 GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(GRN_SUCCESS);
4433 }
4434
4435 executor->fincxx . . $ _grn_expr_executor#fin.(ctx, executor);
4436
4437 GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(GRN_SUCCESS);
4438 }
4439
4440 grn_expr_executor *
4441 grn_expr_executor_open(grn_ctx *ctx, grn_obj *expr)
4442 {
4443 grn_expr_executor *executor;
4444
4445 GRN_API_ENTERcxx . . $ `lib/grn_ctx.h:41:9`!;
4446
4447 executor =
4448 static_cast<grn_expr_executor *>(GRN_CALLOCcxx . . $ `lib/grn_alloc.h:42:9`!(sizeof(grn_expr_executor)));
4449 if (!executor) {
4450 char errbuf[GRN_CTX_MSGSIZEcxx . . $ `include/groonga/groonga.h:334:9`!];
4451 grn_strcpycxx . . $ `include/groonga/portability.h:101:11`!(errbuf, GRN_CTX_MSGSIZE, ctx->errbuf);
4452 ERRcxx . . $ `lib/grn_error.h:156:9`!(ctx->rc, "[expr-executor][open] failed to allocate: %s", errbuf);
4453 GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!);
4454 }
4455
4456 grn_expr_executor_init(ctx, executor, expr);
4457
4458 if (ctx->rccxx . . $ _grn_ctx#rc. != GRN_SUCCESS) {
4459 GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(executor);
4460 executor = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
4461 }
4462
4463 GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(executor);
4464 }
4465
4466 grn_rc
4467 grn_expr_executor_close(grn_ctx *ctx, grn_expr_executor *executor)
4468 {
4469 GRN_API_ENTERcxx . . $ `lib/grn_ctx.h:41:9`!;
4470
4471 if (!executor) {
4472 GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(GRN_SUCCESS);
4473 }
4474
4475 grn_expr_executor_fin(ctx, executor);
4476 GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(executor);
4477
4478 GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(GRN_SUCCESS);
4479 }
4480
4481 grn_rc
4482 grn_expr_executor_add_replace_value(grn_ctx *ctx,
4483 grn_expr_executor *executor,
4484 grn_id id,
4485 grn_obj *value)
4486 {
4487 GRN_API_ENTERcxx . . $ `lib/grn_ctx.h:41:9`!;
4488
4489 if (!executor) {
4490 GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(GRN_SUCCESS);
4491 }
4492
4493 GRN_RECORD_PUTcxx . . $ `include/groonga/groonga.h:3213:9`!(ctx, &(executor->replace_ids), id);
4494 GRN_PTR_PUTcxx . . $ `include/groonga/groonga.h:3218:9`!(ctx, &(executor->replace_values), value);
4495
4496 GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(GRN_SUCCESS);
4497 }
4498
4499 grn_obj *
4500 grn_expr_executor_exec(grn_ctx *ctx, grn_expr_executor *executor, grn_id id)
4501 {
4502 grn_obj *value;
4503
4504 GRN_API_ENTERcxx . . $ `lib/grn_ctx.h:41:9`!;
4505
4506 if (!executor) {
4507 GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!);
4508 }
4509
4510 value = executor->execcxx . . $ _grn_expr_executor#exec.(ctx, executor, id);
4511 if (ctx->rccxx . . $ _grn_ctx#rc. != GRN_SUCCESS) {
4512 value = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
4513 }
4514
4515 GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(value);
4516 }
4517 }