Debian Codegraph @

plugins/functions/h3.c

raw symbols SCIP
1 /*
2 Copyright (C) 2024 Sutou Kouhei <[email protected]>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with this library; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19 #ifdef GRN_EMBEDDED
20 # define GRN_PLUGIN_FUNCTION_TAG functions_h3
21 #endif
22
23 #include <groonga/plugin.h>cxx . . $ `<file>/include/groonga/plugin.h`/
24
25 static grn_objcxx . . $ grn_obj# *
26 grn_h3_ensure_wgs84_geo_pointcxx . . $ grn_h3_ensure_wgs84_geo_point(112fd9a65686e93).(grn_ctxcxx . . $ grn_ctx# *ctx,
27 grn_objcxx . . $ grn_obj# *input,
28 grn_objcxx . . $ grn_obj# *buffer,
29 const char *tag,
30 const char *input_name)
31 {
32 if (grn_obj_is_bulkcxx . . $ grn_obj_is_bulk(a5760e5c319a06ee).(ctx, input) &&
33 input->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain. == GRN_DB_WGS84_GEO_POINTcxx . . $ GRN_DB_WGS84_GEO_POINT.) {
34 return input;
35 }
36 if (grn_obj_is_text_family_bulkcxx . . $ grn_obj_is_text_family_bulk(a5760e5c319a06ee).(ctx, input)) {
37 GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(buffer);
38 grn_rccxx . . $ grn_rc# rc = grn_obj_castcxx . . $ grn_obj_cast(a6fd93da1614eccd).(ctx, input, buffer, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!);
39 if (rc == GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
40 return buffer;
41 }
42 }
43
44 grn_objcxx . . $ grn_obj# inspected;
45 GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&inspected, 0);
46 grn_inspectcxx . . $ grn_inspect(88456f97fe0d41a).(ctx, &inspected, input);
47 GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx,
48 GRN_INVALID_ARGUMENT,
49 "%s %s must be WGS84GeoPoint: %.*s",
50 tag,
51 input_name,
52 (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&inspected),
53 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&inspected));
54 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &inspected);
55 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
56 }
57
58 static grn_objcxx . . $ grn_obj# *
59 func_h3_grid_distancecxx . . $ func_h3_grid_distance(fd082858389c8bb0).(grn_ctxcxx . . $ grn_ctx# *ctx,
60 int n_args,
61 grn_objcxx . . $ grn_obj# **args,
62 grn_user_datacxx . . $ grn_user_data# *user_data)
63 {
64 const char *tag = "h3_grid_distance():";
65
66 if (n_args != 3) {
67 GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx,
68 GRN_INVALID_ARGUMENT,
69 "%s wrong number of arguments (%d for 3)",
70 tag,
71 n_args);
72 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
73 }
74
75 grn_objcxx . . $ grn_obj# *distance_obj = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
76
77 grn_objcxx . . $ grn_obj# *point1_obj = args[0];
78 grn_objcxx . . $ grn_obj# *point2_obj = args[1];
79 grn_objcxx . . $ grn_obj# *resolution_obj = args[2];
80
81 grn_objcxx . . $ grn_obj# point1_buffer;
82 GRN_WGS84_GEO_POINT_INITcxx . . $ `include/groonga/groonga.h:2876:9`!(&point1_buffer, 0);
83 grn_objcxx . . $ grn_obj# point2_buffer;
84 GRN_WGS84_GEO_POINT_INITcxx . . $ `include/groonga/groonga.h:2876:9`!(&point2_buffer, 0);
85
86 int32_tcxx . . $ int32_t# resolution =
87 grn_plugin_proc_get_value_int32cxx . . $ grn_plugin_proc_get_value_int32(398b30e9dc37a61b).(ctx, resolution_obj, -1, tag);
88
89 point1_obj = grn_h3_ensure_wgs84_geo_pointcxx . . $ grn_h3_ensure_wgs84_geo_point(112fd9a65686e93).(ctx,
90 point1_obj,
91 &point1_buffer,
92 tag,
93 "point1");
94 if (!point1_obj) {
95 goto exit;
96 }
97 point2_obj = grn_h3_ensure_wgs84_geo_pointcxx . . $ grn_h3_ensure_wgs84_geo_point(112fd9a65686e93).(ctx,
98 point2_obj,
99 &point2_buffer,
100 tag,
101 "point2");
102 if (!point2_obj) {
103 goto exit;
104 }
105
106 uint64_tcxx . . $ uint64_t# h3_index1 = grn_h3_compute_cellcxx . . $ grn_h3_compute_cell(20c0e0a6e42575f).(ctx,
107 GRN_GEO_POINT_VALUE_RAWcxx . . $ `include/groonga/groonga.h:3112:9`!(point1_obj),
108 resolution,
109 tag);
110 if (ctx->rccxx . . $ _grn_ctx#rc. != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
111 goto exit;
112 }
113 uint64_tcxx . . $ uint64_t# h3_index2 = grn_h3_compute_cellcxx . . $ grn_h3_compute_cell(20c0e0a6e42575f).(ctx,
114 GRN_GEO_POINT_VALUE_RAWcxx . . $ `include/groonga/groonga.h:3112:9`!(point2_obj),
115 resolution,
116 tag);
117 if (ctx->rccxx . . $ _grn_ctx#rc. != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
118 goto exit;
119 }
120 uint64_tcxx . . $ uint64_t# distance =
121 grn_h3_compute_grid_distancecxx . . $ grn_h3_compute_grid_distance(794e02ec1926a47c).(ctx, h3_index1, h3_index2, tag);
122 if (ctx->rccxx . . $ _grn_ctx#rc. != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
123 goto exit;
124 }
125
126 distance_obj = grn_plugin_proc_alloccxx . . $ grn_plugin_proc_alloc(acb267eca6702fc).(ctx, user_data, GRN_DB_UINT64cxx . . $ GRN_DB_UINT64., 0);
127 if (!distance_obj) {
128 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
129 }
130 GRN_UINT64_SETcxx . . $ `include/groonga/groonga.h:2919:9`!(ctx, distance_obj, distance);
131
132 exit:
133 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &point1_buffer);
134 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &point2_buffer);
135
136 return distance_obj;
137 }
138
139 static grn_rccxx . . $ grn_rc#
140 applier_h3_grid_distancecxx . . $ applier_h3_grid_distance(6580e31ad1f8e719).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_applier_datacxx . . $ grn_applier_data# *data)
141 {
142 const char *tag = "h3_grid_distance():";
143
144 grn_objcxx . . $ grn_obj# *table = grn_applier_data_get_tablecxx . . $ grn_applier_data_get_table(a08f760c9bd20156).(ctx, data);
145 grn_objcxx . . $ grn_obj# *output_column = grn_applier_data_get_output_columncxx . . $ grn_applier_data_get_output_column(a08f760c9bd20156).(ctx, data);
146 size_t n_args;
147 grn_objcxx . . $ grn_obj# **args = grn_applier_data_get_argscxx . . $ grn_applier_data_get_args(f080cb29cc6f2c0a).(ctx, data, &n_args);
148
149 if (n_args != 3) {
150 GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx,
151 GRN_INVALID_ARGUMENT,
152 "%s wrong number of arguments (%zu for 3)",
153 tag,
154 n_args);
155 return ctx->rccxx . . $ _grn_ctx#rc.;
156 }
157
158 grn_objcxx . . $ grn_obj# *input_column = args[0];
159 grn_objcxx . . $ grn_obj# *point2_obj = args[1];
160 grn_objcxx . . $ grn_obj# *resolution_obj = args[2];
161
162 int32_tcxx . . $ int32_t# resolution =
163 grn_plugin_proc_get_value_int32cxx . . $ grn_plugin_proc_get_value_int32(398b30e9dc37a61b).(ctx, resolution_obj, -1, tag);
164
165 if (!(grn_obj_is_scalar_columncxx . . $ grn_obj_is_scalar_column(a5760e5c319a06ee).(ctx, input_column) ||
166 grn_obj_is_scalar_accessorcxx . . $ grn_obj_is_scalar_accessor(a5760e5c319a06ee).(ctx, input_column))) {
167 grn_objcxx . . $ grn_obj# inspected;
168 GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&inspected, 0);
169 grn_inspectcxx . . $ grn_inspect(88456f97fe0d41a).(ctx, &inspected, input_column);
170 GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(
171 ctx,
172 GRN_INVALID_ARGUMENT,
173 "%s 1st argument must be a scalar column or accessor: %.*s",
174 tag,
175 (int)(GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&inspected)),
176 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&inspected));
177 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &inspected);
178 return ctx->rccxx . . $ _grn_ctx#rc.;
179 }
180 grn_idcxx . . $ grn_id# input_column_range = grn_obj_get_rangecxx . . $ grn_obj_get_range(8dd58acc9865e889).(ctx, input_column);
181 if (input_column_range != GRN_DB_WGS84_GEO_POINTcxx . . $ GRN_DB_WGS84_GEO_POINT.) {
182 GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx,
183 GRN_INVALID_ARGUMENT,
184 "%s 1st argument's type must be WGS84GeoPoint: %s",
185 tag,
186 grn_type_id_to_string_builtin(ctx, input_column_range));
187 return ctx->rccxx . . $ _grn_ctx#rc.;
188 }
189
190 grn_objcxx . . $ grn_obj# point2_buffer;
191 GRN_WGS84_GEO_POINT_INITcxx . . $ `include/groonga/groonga.h:2876:9`!(&point2_buffer, 0);
192 point2_obj = grn_h3_ensure_wgs84_geo_pointcxx . . $ grn_h3_ensure_wgs84_geo_point(112fd9a65686e93).(ctx,
193 point2_obj,
194 &point2_buffer,
195 tag,
196 "point2");
197 uint64_tcxx . . $ uint64_t# h3_index2 = grn_h3_compute_cellcxx . . $ grn_h3_compute_cell(20c0e0a6e42575f).(ctx,
198 GRN_GEO_POINT_VALUE_RAWcxx . . $ `include/groonga/groonga.h:3112:9`!(point2_obj),
199 resolution,
200 tag);
201 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &point2_buffer);
202 if (ctx->rccxx . . $ _grn_ctx#rc. != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
203 return ctx->rccxx . . $ _grn_ctx#rc.;
204 }
205
206 if (grn_table_sizecxx . . $ grn_table_size(8dd58acc9865e889).(ctx, table) == 0) {
207 return ctx->rccxx . . $ _grn_ctx#rc.;
208 }
209
210 grn_objcxx . . $ grn_obj# point1_buffer;
211 GRN_WGS84_GEO_POINT_INITcxx . . $ `include/groonga/groonga.h:2876:9`!(&point1_buffer, 0);
212 grn_objcxx . . $ grn_obj# distance_buffer;
213 GRN_UINT64_INITcxx . . $ `include/groonga/groonga.h:2858:9`!(&distance_buffer, 0);
214 GRN_TABLE_EACH_BEGINcxx . . $ `include/groonga/table.h:614:9`!(ctx, table, cursor, id)
215 {
216 GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(&point1_buffer);
217 grn_obj_get_valuecxx . . $ grn_obj_get_value(6e06fec66698a6a).(ctx, input_column, id, &point1_buffer);
218 if (GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(&point1_buffer) != sizeof(grn_geo_pointcxx . . $ grn_geo_point#)) {
219 continue;
220 }
221 uint64_tcxx . . $ uint64_t# h3_index1 =
222 grn_h3_compute_cellcxx . . $ grn_h3_compute_cell(20c0e0a6e42575f).(ctx,
223 GRN_GEO_POINT_VALUE_RAWcxx . . $ `include/groonga/groonga.h:3112:9`!(&point1_buffer),
224 resolution,
225 tag);
226 if (ctx->rccxx . . $ _grn_ctx#rc. != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
227 break;
228 }
229 uint64_tcxx . . $ uint64_t# distance_raw =
230 grn_h3_compute_grid_distancecxx . . $ grn_h3_compute_grid_distance(794e02ec1926a47c).(ctx, h3_index1, h3_index2, tag);
231 if (ctx->rccxx . . $ _grn_ctx#rc. != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
232 break;
233 }
234 GRN_UINT64_SETcxx . . $ `include/groonga/groonga.h:2919:9`!(ctx, &distance_buffer, distance_raw);
235 grn_obj_set_valuecxx . . $ grn_obj_set_value(16170250441fe8eb).(ctx, output_column, id, &distance_buffer, GRN_OBJ_SETcxx . . $ `include/groonga/groonga.h:1466:9`!);
236 if (ctx->rccxx . . $ _grn_ctx#rc. != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
237 break;
238 }
239 }
240 GRN_TABLE_EACH_ENDcxx . . $ `include/groonga/table.h:665:9`!(ctx, cursor);
241 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &point1_buffer);
242 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &distance_buffer);
243
244 return ctx->rccxx . . $ _grn_ctx#rc.;
245 }
246
247 static grn_objcxx . . $ grn_obj# *
248 func_h3_in_grid_diskcxx . . $ func_h3_in_grid_disk(fd082858389c8bb0).(grn_ctxcxx . . $ grn_ctx# *ctx,
249 int n_args,
250 grn_objcxx . . $ grn_obj# **args,
251 grn_user_datacxx . . $ grn_user_data# *user_data)
252 {
253 const char *tag = "h3_in_grid_disk():";
254 if (n_args != 4) {
255 GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx,
256 GRN_INVALID_ARGUMENT,
257 "%s wrong number of arguments (%d for 4)",
258 tag,
259 n_args);
260 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
261 }
262
263 grn_objcxx . . $ grn_obj# *in_obj = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
264
265 grn_objcxx . . $ grn_obj# *target_obj = args[0];
266 grn_objcxx . . $ grn_obj# *origin_obj = args[1];
267 grn_objcxx . . $ grn_obj# *resolution_obj = args[2];
268 grn_objcxx . . $ grn_obj# *k_obj = args[3];
269
270 grn_objcxx . . $ grn_obj# target_buffer;
271 GRN_WGS84_GEO_POINT_INITcxx . . $ `include/groonga/groonga.h:2876:9`!(&target_buffer, 0);
272 grn_objcxx . . $ grn_obj# origin_buffer;
273 GRN_WGS84_GEO_POINT_INITcxx . . $ `include/groonga/groonga.h:2876:9`!(&origin_buffer, 0);
274 grn_objcxx . . $ grn_obj# h3_indices;
275 GRN_UINT64_INITcxx . . $ `include/groonga/groonga.h:2858:9`!(&h3_indices, GRN_OBJ_VECTORcxx . . $ `include/groonga/groonga.h:2734:9`!);
276
277 int32_tcxx . . $ int32_t# resolution =
278 grn_plugin_proc_get_value_int32cxx . . $ grn_plugin_proc_get_value_int32(398b30e9dc37a61b).(ctx, resolution_obj, -1, tag);
279 int32_tcxx . . $ int32_t# k = grn_plugin_proc_get_value_int32cxx . . $ grn_plugin_proc_get_value_int32(398b30e9dc37a61b).(ctx, k_obj, -1, tag);
280
281 target_obj = grn_h3_ensure_wgs84_geo_pointcxx . . $ grn_h3_ensure_wgs84_geo_point(112fd9a65686e93).(ctx,
282 target_obj,
283 &target_buffer,
284 tag,
285 "target");
286 if (!target_obj) {
287 goto exit;
288 }
289 uint64_tcxx . . $ uint64_t# target_index =
290 grn_h3_compute_cellcxx . . $ grn_h3_compute_cell(20c0e0a6e42575f).(ctx,
291 GRN_GEO_POINT_VALUE_RAWcxx . . $ `include/groonga/groonga.h:3112:9`!(target_obj),
292 resolution,
293 tag);
294 if (ctx->rccxx . . $ _grn_ctx#rc. != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
295 goto exit;
296 }
297 origin_obj = grn_h3_ensure_wgs84_geo_pointcxx . . $ grn_h3_ensure_wgs84_geo_point(112fd9a65686e93).(ctx,
298 origin_obj,
299 &origin_buffer,
300 tag,
301 "origin");
302 if (!origin_obj) {
303 goto exit;
304 }
305
306 if (grn_h3_compute_grid_diskcxx . . $ grn_h3_compute_grid_disk(19843f0bd71d5a02).(ctx,
307 GRN_GEO_POINT_VALUE_RAWcxx . . $ `include/groonga/groonga.h:3112:9`!(origin_obj),
308 resolution,
309 k,
310 &h3_indices,
311 tag) != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
312 goto exit;
313 }
314 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! in = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!;
315 size_t i;
316 size_t n_h3_indices = GRN_UINT64_VECTOR_SIZEcxx . . $ `include/groonga/groonga.h:3259:9`!(&h3_indices);
317 for (i = 0; i < n_h3_indices; i++) {
318 uint64_tcxx . . $ uint64_t# h3_index = GRN_UINT64_VALUE_ATcxx . . $ `include/groonga/groonga.h:3140:9`!(&h3_indices, i);
319 if (h3_index == target_index) {
320 in = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
321 break;
322 }
323 }
324
325 in_obj = grn_plugin_proc_alloccxx . . $ grn_plugin_proc_alloc(acb267eca6702fc).(ctx, user_data, GRN_DB_BOOLcxx . . $ GRN_DB_BOOL., 0);
326 if (!in_obj) {
327 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
328 }
329 GRN_BOOL_SETcxx . . $ `include/groonga/groonga.h:2879:9`!(ctx, in_obj, in);
330
331 exit:
332 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &target_buffer);
333 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &origin_buffer);
334 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &h3_indices);
335
336 return in_obj;
337 }
338
339 static grn_rccxx . . $ grn_rc#
340 selector_h3_in_grid_diskcxx . . $ selector_h3_in_grid_disk(2267fc2522c8e143).(grn_ctxcxx . . $ grn_ctx# *ctx,
341 grn_objcxx . . $ grn_obj# *table,
342 grn_objcxx . . $ grn_obj# *index,
343 int n_args,
344 grn_objcxx . . $ grn_obj# **args,
345 grn_objcxx . . $ grn_obj# *res,
346 grn_operatorcxx . . $ grn_operator# op)
347 {
348 const char *tag = "h3_in_grid_disk():";
349
350 if ((n_args - 1) != 4) {
351 GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx,
352 GRN_INVALID_ARGUMENT,
353 "%s wrong number of arguments (%d for 4)",
354 tag,
355 (n_args - 1));
356 return ctx->rccxx . . $ _grn_ctx#rc.;
357 }
358
359 grn_objcxx . . $ grn_obj# *origin_obj = args[2];
360 grn_objcxx . . $ grn_obj# *resolution_obj = args[3];
361 grn_objcxx . . $ grn_obj# *k_obj = args[4];
362
363 grn_objcxx . . $ grn_obj# origin_buffer;
364 GRN_WGS84_GEO_POINT_INITcxx . . $ `include/groonga/groonga.h:2876:9`!(&origin_buffer, 0);
365
366 grn_objcxx . . $ grn_obj# h3_indices;
367 GRN_UINT64_INITcxx . . $ `include/groonga/groonga.h:2858:9`!(&h3_indices, GRN_OBJ_VECTORcxx . . $ `include/groonga/groonga.h:2734:9`!);
368
369 int32_tcxx . . $ int32_t# resolution =
370 grn_plugin_proc_get_value_int32cxx . . $ grn_plugin_proc_get_value_int32(398b30e9dc37a61b).(ctx, resolution_obj, -1, tag);
371 int32_tcxx . . $ int32_t# k = grn_plugin_proc_get_value_int32cxx . . $ grn_plugin_proc_get_value_int32(398b30e9dc37a61b).(ctx, k_obj, -1, tag);
372
373 origin_obj = grn_h3_ensure_wgs84_geo_pointcxx . . $ grn_h3_ensure_wgs84_geo_point(112fd9a65686e93).(ctx,
374 origin_obj,
375 &origin_buffer,
376 tag,
377 "origin");
378 if (!origin_obj) {
379 goto exit;
380 }
381 if (grn_h3_compute_grid_diskcxx . . $ grn_h3_compute_grid_disk(19843f0bd71d5a02).(ctx,
382 GRN_GEO_POINT_VALUE_RAWcxx . . $ `include/groonga/groonga.h:3112:9`!(origin_obj),
383 resolution,
384 k,
385 &h3_indices,
386 tag) != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
387 goto exit;
388 }
389 grn_iicxx . . $ grn_ii# *ii = (grn_iicxx . . $ grn_ii# *)index;
390 grn_objcxx . . $ grn_obj# *lexicon = grn_ii_get_lexiconcxx . . $ grn_ii_get_lexicon(ef38d4c159295a7e).(ctx, ii);
391 size_t i;
392 size_t n_h3_indices = GRN_UINT64_VECTOR_SIZEcxx . . $ `include/groonga/groonga.h:3259:9`!(&h3_indices);
393 for (i = 0; i < n_h3_indices; i++) {
394 uint64_tcxx . . $ uint64_t# h3_index = GRN_UINT64_VALUE_ATcxx . . $ `include/groonga/groonga.h:3140:9`!(&h3_indices, i);
395 if (h3_index == 0) {
396 continue;
397 }
398 grn_idcxx . . $ grn_id# id = grn_table_getcxx . . $ grn_table_get(5676c91e20172100).(ctx, lexicon, &h3_index, sizeof(uint64_tcxx . . $ uint64_t#));
399 if (id == GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!) {
400 continue;
401 }
402 grn_ii_select_by_idcxx . . $ grn_ii_select_by_id(c699eb785099329f).(ctx, ii, id, (grn_hashcxx . . $ grn_hash# *)res, op);
403 }
404 grn_ii_resolve_sel_andcxx . . $ grn_ii_resolve_sel_and(8582dd5db79648f2).(ctx, (grn_hashcxx . . $ grn_hash# *)res, op);
405
406 exit:
407 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &origin_buffer);
408 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &h3_indices);
409
410 return ctx->rccxx . . $ _grn_ctx#rc.;
411 }
412
413 grn_rccxx . . $ grn_rc#
414 GRN_PLUGIN_INITcxx . . $ `include/groonga/plugin.h:43:9`!(grn_ctxcxx . . $ grn_ctx# *ctx)
415 {
416 return ctx->rccxx . . $ _grn_ctx#rc.;
417 }
418
419 grn_rccxx . . $ grn_rc#
420 GRN_PLUGIN_REGISTERcxx . . $ `include/groonga/plugin.h:44:9`!(grn_ctxcxx . . $ grn_ctx# *ctx)
421 {
422 grn_rccxx . . $ grn_rc# rc = GRN_SUCCESScxx . . $ GRN_SUCCESS.;
423
424 {
425 grn_objcxx . . $ grn_obj# *proc = grn_proc_createcxx . . $ grn_proc_create(195df001e5324f57).(ctx,
426 "h3_grid_distance",
427 -1,
428 GRN_PROC_FUNCTIONcxx . . $ GRN_PROC_FUNCTION.,
429 func_h3_grid_distancecxx . . $ func_h3_grid_distance(fd082858389c8bb0).,
430 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!,
431 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!,
432 0,
433 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
434 grn_proc_set_appliercxx . . $ grn_proc_set_applier(5e518908f149fea).(ctx, proc, applier_h3_grid_distancecxx . . $ applier_h3_grid_distance(6580e31ad1f8e719).);
435 }
436
437 {
438 grn_objcxx . . $ grn_obj# *proc = grn_proc_createcxx . . $ grn_proc_create(195df001e5324f57).(ctx,
439 "h3_in_grid_disk",
440 -1,
441 GRN_PROC_FUNCTIONcxx . . $ GRN_PROC_FUNCTION.,
442 func_h3_in_grid_diskcxx . . $ func_h3_in_grid_disk(fd082858389c8bb0).,
443 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!,
444 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!,
445 0,
446 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
447 grn_proc_set_selectorcxx . . $ grn_proc_set_selector(7ce76c9564b607b5).(ctx, proc, selector_h3_in_grid_diskcxx . . $ selector_h3_in_grid_disk(2267fc2522c8e143).);
448 grn_proc_set_selector_operatorcxx . . $ grn_proc_set_selector_operator(bbc69e63741a8d0a).(ctx, proc, GRN_OP_MATCHcxx . . $ GRN_OP_MATCH.);
449 }
450
451 return rc;
452 }
453
454 grn_rccxx . . $ grn_rc#
455 GRN_PLUGIN_FINcxx . . $ `include/groonga/plugin.h:45:9`!(grn_ctxcxx . . $ grn_ctx# *ctx)
456 {
457 return GRN_SUCCESScxx . . $ GRN_SUCCESS.;
458 }