Debian Codegraph @

lib/plugin.c

raw symbols SCIP
1 /*
2 Copyright (C) 2012-2018 Brazil
3 Copyright (C) 2022-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_ctx_impl_mrb.h"cxx . . $ `<file>/lib/grn_ctx_impl_mrb.h`/
22 #include "grn_encoding.h"cxx . . $ `<file>/lib/grn_encoding.h`/
23 #include "grn_proc.h"cxx . . $ `<file>/lib/grn_proc.h`/
24 #include <groonga/plugin.h>cxx . . $ `<file>/include/groonga/plugin.h`/
25
26 #include <stdarg.h>
27 #include <stdio.h>
28 #include <string.h>
29
30 #include <sys/stat.h>
31 #ifdef HAVE_DIRENT_Hcxx . . $ `build/config.h:125:9`!
32 # include <dirent.h>
33 #endif /* HAVE_DIRENT_H */
34
35 #ifndef S_ISREGcxx . . $ `<external>/531885356569766532/stat.h:128:9`!
36 # ifdef _S_IFREG
37 # define S_ISREG(mode) (mode & _S_IFREG)
38 # endif /* _S_IFREG */
39 #endif /* !S_ISREG */
40
41 #include "grn_db.h"cxx . . $ `<file>/lib/grn_db.h`/
42 #include "grn_plugin.h"cxx . . $ `<file>/lib/grn_plugin.h`/
43 #include "grn_ctx_impl.h"cxx . . $ `<file>/lib/grn_ctx_impl.h`/
44 #include "grn_util.h"cxx . . $ `<file>/lib/grn_util.h`/
45
46 #ifdef GRN_WITH_MRUBY
47 # include <mruby.h>
48 #endif /* GRN_WITH_MRUBY */
49
50 static grn_hashcxx . . $ grn_hash# *grn_pluginscxx . . $ grn_plugins. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
51 static grn_critical_sectioncxx . . $ grn_critical_section# grn_plugins_lockcxx . . $ grn_plugins_lock.;
52 static grn_ctxcxx . . $ grn_ctx# grn_plugins_ctxcxx . . $ grn_plugins_ctx.;
53 static grn_objcxx . . $ grn_obj# grn_plugins_pathcxx . . $ grn_plugins_path.;
54
55 #define GRN_PLUGINS_DIR_EACH_BEGINcxx . . $ `lib/plugin.c:55:9`!(dir, dir_length) \
56 do { \
57 unsigned int i_; \
58 const unsigned int n_dirs_ = \
59 grn_vector_size(&grn_plugins_ctx, &grn_plugins_path); \
60 for (i_ = 0; i_ < n_dirs_; i_++) { \
61 const char *dir = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; \
62 unsigned int dir_length; \
63 dir_length = grn_vector_get_element(&grn_plugins_ctx, \
64 &grn_plugins_path, \
65 i_, \
66 &dir, \
67 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, \
68 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
69 #define GRN_PLUGINS_DIR_EACH_ENDcxx . . $ `lib/plugin.c:69:9`!() \
70 } \
71 } \
72 while (falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!)
73
74 #ifdef HAVE_DLFCN_Hcxx . . $ `build/config.h:126:9`!
75 # include <dlfcn.h>
76 # define grn_dl_opencxx . . $ `lib/plugin.c:76:11`!(filename) dlopen(filename, RTLD_LAZYcxx . . $ `<external>/10632388298615623587/dlfcn.h:24:9`! | RTLD_LOCALcxx . . $ `<external>/10632388298615623587/dlfcn.h:38:9`!)
77 # define grn_dl_open_error_labelcxx . . $ `lib/plugin.c:77:11`!() dlerror()
78 # define grn_dl_closecxx . . $ `lib/plugin.c:78:11`!(dl) (dlclose(dl) == 0)
79 # define grn_dl_close_error_labelcxx . . $ `lib/plugin.c:79:11`!() dlerror()
80 # define grn_dl_symcxx . . $ `lib/plugin.c:80:11`!(dl, symbol) dlsym(dl, symbol)
81 # define grn_dl_sym_error_labelcxx . . $ `lib/plugin.c:81:11`!() dlerror()
82 # define grn_dl_clear_errorcxx . . $ `lib/plugin.c:82:11`!() dlerror()
83 #else
84 # define grn_dl_open(filename) LoadLibrary(filename)
85 # define grn_dl_open_error_label() "LoadLibrary"
86 # define grn_dl_close(dl) (FreeLibrary(dl) != 0)
87 # define grn_dl_close_error_label() "FreeLibrary"
88 # define grn_dl_sym(dl, symbol) ((void *)GetProcAddress(dl, symbol))
89 # define grn_dl_sym_error_label() "GetProcAddress"
90 # define grn_dl_clear_error()
91 #endif
92
93 #define GRN_PLUGIN_KEY_SIZEcxx . . $ `lib/plugin.c:93:9`!(filename) (strlen((filename)) + 1)
94
95 static char grn_plugins_path_envcxx . . $ grn_plugins_path_env.[GRN_ENV_BUFFER_SIZEcxx . . $ `include/groonga/portability.h:42:9`!];
96 static char grn_plugins_dir_envcxx . . $ grn_plugins_dir_env.[GRN_ENV_BUFFER_SIZEcxx . . $ `include/groonga/portability.h:42:9`!];
97
98 void
99 grn_plugin_init_from_envcxx . . $ grn_plugin_init_from_env(49f6e7a06ebc5aa8).(void)
100 {
101 grn_getenvcxx . . $ `include/groonga/portability.h:58:11`!("GRN_PLUGINS_PATH", grn_plugins_path_env, GRN_ENV_BUFFER_SIZEcxx . . $ `include/groonga/portability.h:42:9`!);
102 grn_getenvcxx . . $ `include/groonga/portability.h:58:11`!("GRN_PLUGINS_DIR", grn_plugins_dir_env, GRN_ENV_BUFFER_SIZEcxx . . $ `include/groonga/portability.h:42:9`!);
103 }
104
105 static int
106 compute_name_sizecxx . . $ compute_name_size(cb7559238bb26814).(const char *name, int name_size)
107 {
108 if (name_size < 0) {
109 if (name) {
110 name_size = (int)strlencxx . . $ strlen(751346f8406fd082).(name);
111 } else {
112 name_size = 0;
113 }
114 }
115 return name_size;
116 }
117
118 grn_idcxx . . $ grn_id#
119 grn_plugin_referencecxx . . $ grn_plugin_reference(1be90328514dd2c4).(grn_ctxcxx . . $ grn_ctx# *ctx, const char *filename)
120 {
121 grn_idcxx . . $ grn_id# id;
122 grn_plugincxx . . $ grn_plugin# **plugin = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
123
124 CRITICAL_SECTION_ENTERcxx . . $ `lib/grn.h:227:11`!(grn_plugins_lock);
125 id = grn_hash_getcxx . . $ grn_hash_get(4e868e5367e71b67).(&grn_plugins_ctxcxx . . $ grn_plugins_ctx.,
126 grn_pluginscxx . . $ grn_plugins.,
127 filename,
128 (unsigned int)GRN_PLUGIN_KEY_SIZEcxx . . $ `lib/plugin.c:93:9`!(filename),
129 (void **)&plugin);
130 if (plugin) {
131 (*plugin)->refcountcxx . . $ _grn_plugin#refcount.++;
132 }
133 CRITICAL_SECTION_LEAVEcxx . . $ `lib/grn.h:228:11`!(grn_plugins_lock);
134
135 return id;
136 }
137
138 const char *
139 grn_plugin_pathcxx . . $ grn_plugin_path(7cd85086f4e96fc4).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_idcxx . . $ grn_id# id)
140 {
141 const char *path;
142 grn_plugincxx . . $ grn_plugin# *plugin;
143 int value_size;
144
145 if (id == GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!) {
146 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
147 }
148
149 CRITICAL_SECTION_ENTERcxx . . $ `lib/grn.h:227:11`!(grn_plugins_lock);
150 value_size = grn_hash_get_valuecxx . . $ grn_hash_get_value(3fd53c1c6a190bf5).(&grn_plugins_ctxcxx . . $ grn_plugins_ctx., grn_pluginscxx . . $ grn_plugins., id, &plugin);
151 CRITICAL_SECTION_LEAVEcxx . . $ `lib/grn.h:228:11`!(grn_plugins_lock);
152
153 if (!plugin) {
154 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
155 }
156
157 path = plugin->pathcxx . . $ _grn_plugin#path.;
158 GRN_PLUGINS_DIR_EACH_BEGINcxx . . $ `lib/plugin.c:55:9`!(dir, dir_length)
159 {
160 if (strncmpcxx . . $ strncmp(fd278af2f295fa2e).(dir, path, dir_length) == 0) {
161 const char *plugin_name = path + dir_length;
162 while (plugin_name[0] == '/') {
163 plugin_name++;
164 }
165 /* TODO: remove suffix too? */
166 return plugin_name;
167 }
168 }
169 GRN_PLUGINS_DIR_EACH_ENDcxx . . $ `lib/plugin.c:69:9`!();
170
171 return path;
172 }
173
174 #define GRN_PLUGIN_FUNC_PREFIXcxx . . $ `lib/plugin.c:174:9`! "grn_plugin_impl_"
175
176 static grn_rccxx . . $ grn_rc#
177 grn_plugin_call_initcxx . . $ grn_plugin_call_init(40dd0a06a64dbe5d).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_idcxx . . $ grn_id# id)
178 {
179 grn_plugincxx . . $ grn_plugin# *plugin;
180 int size;
181
182 size = grn_hash_get_valuecxx . . $ grn_hash_get_value(3fd53c1c6a190bf5).(&grn_plugins_ctxcxx . . $ grn_plugins_ctx., grn_pluginscxx . . $ grn_plugins., id, &plugin);
183 if (size == 0) {
184 return GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.;
185 }
186
187 if (plugin->init_funccxx . . $ _grn_plugin#init_func.) {
188 return plugin->init_funccxx . . $ _grn_plugin#init_func.(ctx);
189 }
190
191 return GRN_SUCCESScxx . . $ GRN_SUCCESS.;
192 }
193
194 #ifdef GRN_WITH_MRUBY
195 static grn_rc
196 grn_plugin_call_register_mrb(grn_ctx *ctx, grn_id id, grn_plugin *plugin)
197 {
198 grn_mrb_data *data;
199 mrb_state *mrb;
200 struct RClass *module;
201 struct RClass *plugin_loader_class;
202 int arena_index;
203
204 grn_ctx_impl_mrb_ensure_init(ctx);
205 if (ctx->rc != GRN_SUCCESS) {
206 return ctx->rc;
207 }
208
209 data = &(ctx->impl->mrb);
210 mrb = data->state;
211 module = data->module;
212
213 {
214 int added;
215 grn_hash_add(ctx,
216 ctx->impl->mrb.registered_plugins,
217 &id,
218 sizeof(grn_id),
219 NULL,
220 &added);
221 if (!added) {
222 return ctx->rc;
223 }
224 }
225
226 arena_index = mrb_gc_arena_save(mrb);
227 plugin_loader_class = mrb_class_get_under(mrb, module, "PluginLoader");
228 {
229 const char *utf8_path;
230 mrb_value mrb_path;
231 utf8_path = grn_encoding_convert_to_utf8_from_locale(ctx,
232 ctx->impl->plugin_path,
233 -1,
234 NULL);
235 mrb_path = mrb_str_new_cstr(mrb, utf8_path);
236 grn_encoding_converted_free(ctx, utf8_path);
237 mrb_funcall(mrb,
238 mrb_obj_value(plugin_loader_class),
239 "load_file",
240 1,
241 mrb_path);
242 }
243 mrb_gc_arena_restore(mrb, arena_index);
244 return ctx->rc;
245 }
246 #endif /*GRN_WITH_MRUBY */
247
248 static grn_rccxx . . $ grn_rc#
249 grn_plugin_call_registercxx . . $ grn_plugin_call_register(40dd0a06a64dbe5d).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_idcxx . . $ grn_id# id)
250 {
251 grn_plugincxx . . $ grn_plugin# *plugin;
252 int size;
253
254 CRITICAL_SECTION_ENTERcxx . . $ `lib/grn.h:227:11`!(grn_plugins_lock);
255 size = grn_hash_get_valuecxx . . $ grn_hash_get_value(3fd53c1c6a190bf5).(&grn_plugins_ctxcxx . . $ grn_plugins_ctx., grn_pluginscxx . . $ grn_plugins., id, &plugin);
256 CRITICAL_SECTION_LEAVEcxx . . $ `lib/grn.h:228:11`!(grn_plugins_lock);
257
258 if (size == 0) {
259 return GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.;
260 }
261
262 #ifdef GRN_WITH_MRUBY
263 if (!plugin->dl) {
264 return grn_plugin_call_register_mrb(ctx, id, plugin);
265 }
266 #endif /* GRN_WITH_MRUBY */
267
268 if (plugin->register_funccxx . . $ _grn_plugin#register_func.) {
269 return plugin->register_funccxx . . $ _grn_plugin#register_func.(ctx);
270 }
271
272 return GRN_SUCCESScxx . . $ GRN_SUCCESS.;
273 }
274
275 static grn_rccxx . . $ grn_rc#
276 grn_plugin_call_fincxx . . $ grn_plugin_call_fin(40dd0a06a64dbe5d).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_idcxx . . $ grn_id# id)
277 {
278 grn_plugincxx . . $ grn_plugin# *plugin;
279 int size;
280
281 size = grn_hash_get_valuecxx . . $ grn_hash_get_value(3fd53c1c6a190bf5).(&grn_plugins_ctxcxx . . $ grn_plugins_ctx., grn_pluginscxx . . $ grn_plugins., id, &plugin);
282 if (size == 0) {
283 return GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.;
284 }
285
286 if (plugin->fin_funccxx . . $ _grn_plugin#fin_func.) {
287 return plugin->fin_funccxx . . $ _grn_plugin#fin_func.(ctx);
288 }
289
290 return GRN_SUCCESScxx . . $ GRN_SUCCESS.;
291 }
292
293 static grn_rccxx . . $ grn_rc#
294 grn_plugin_initializecxx . . $ grn_plugin_initialize(f709cd1ce48f4bd).(
295 grn_ctxcxx . . $ grn_ctx# *ctx, grn_plugincxx . . $ grn_plugin# *plugin, grn_dlcxx . . $ grn_dl# dl, grn_idcxx . . $ grn_id# id, const char *path)
296 {
297 plugin->dlcxx . . $ _grn_plugin#dl. = dl;
298
299 #define GET_SYMBOLcxx . . $ `lib/plugin.c:299:9`!(type) \
300 do { \
301 grn_dl_clear_errorcxx . . $ `lib/plugin.c:82:11`!(); \
302 plugin->type##_func = grn_dl_symcxx . . $ `lib/plugin.c:80:11`!(dl, GRN_PLUGIN_FUNC_PREFIXcxx . . $ `lib/plugin.c:174:9`! #type); \
303 if (!plugin->type##_func) { \
304 const char *label; \
305 label = grn_dl_sym_error_labelcxx . . $ `lib/plugin.c:81:11`!(); \
306 SERRcxx . . $ `lib/grn_error.h:411:11`!("%s", label); \
307 } \
308 } while (0)
309
310 GET_SYMBOLcxx . . $ `lib/plugin.c:299:9`!(init);
311 GET_SYMBOLcxx . . $ `lib/plugin.c:299:9`!(register);
312 GET_SYMBOLcxx . . $ `lib/plugin.c:299:9`!(fin);
313
314 #undef GET_SYMBOLcxx . . $ `lib/plugin.c:299:9`!
315
316 if (!plugin->init_funccxx . . $ _grn_plugin#init_func. || !plugin->register_funccxx . . $ _grn_plugin#register_func. || !plugin->fin_funccxx . . $ _grn_plugin#fin_func.) {
317 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_FORMAT,
318 "init func (%s) %sfound, "
319 "register func (%s) %sfound and "
320 "fin func (%s) %sfound",
321 GRN_PLUGIN_FUNC_PREFIXcxx . . $ `lib/plugin.c:174:9`! "init",
322 plugin->init_func ? "" : "not ",
323 GRN_PLUGIN_FUNC_PREFIXcxx . . $ `lib/plugin.c:174:9`! "register",
324 plugin->register_func ? "" : "not ",
325 GRN_PLUGIN_FUNC_PREFIXcxx . . $ `lib/plugin.c:174:9`! "fin",
326 plugin->fin_func ? "" : "not ");
327 }
328
329 if (!ctx->rccxx . . $ _grn_ctx#rc.) {
330 ctx->implcxx . . $ _grn_ctx#impl.->plugin_pathcxx . . $ _grn_ctx_impl#plugin_path. = path;
331 grn_plugin_call_initcxx . . $ grn_plugin_call_init(40dd0a06a64dbe5d).(ctx, id);
332 ctx->implcxx . . $ _grn_ctx#impl.->plugin_pathcxx . . $ _grn_ctx_impl#plugin_path. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
333 }
334
335 return ctx->rccxx . . $ _grn_ctx#rc.;
336 }
337
338 #ifdef GRN_WITH_MRUBY
339 static grn_id
340 grn_plugin_open_mrb(grn_ctx *ctx, const char *filename, size_t filename_size)
341 {
342 grn_ctx *plugins_ctx = &grn_plugins_ctx;
343 grn_id id = GRN_ID_NIL;
344 grn_plugin **plugin = NULL;
345
346 grn_ctx_impl_mrb_ensure_init(ctx);
347 if (ctx->rc != GRN_SUCCESS) {
348 return GRN_ID_NIL;
349 }
350
351 if (!ctx->impl->mrb.state) {
352 ERR(GRN_FUNCTION_NOT_IMPLEMENTED, "mruby support isn't enabled");
353 return GRN_ID_NIL;
354 }
355
356 id = grn_hash_add(plugins_ctx,
357 grn_plugins,
358 filename,
359 filename_size,
360 (void **)&plugin,
361 NULL);
362 if (!id) {
363 return id;
364 }
365
366 {
367 grn_ctx *ctx = plugins_ctx;
368 *plugin = GRN_CALLOC(sizeof(grn_plugin));
369 }
370 if (!*plugin) {
371 grn_hash_delete_by_id(plugins_ctx, grn_plugins, id, NULL);
372 return GRN_ID_NIL;
373 }
374
375 grn_memcpy((*plugin)->path, filename, filename_size);
376 (*plugin)->dl = NULL;
377 (*plugin)->init_func = NULL;
378 (*plugin)->register_func = NULL;
379 (*plugin)->fin_func = NULL;
380 (*plugin)->refcount = 1;
381
382 return id;
383 }
384 #endif /* GRN_WITH_MRUBY */
385
386 grn_idcxx . . $ grn_id#
387 grn_plugin_opencxx . . $ grn_plugin_open(1be90328514dd2c4).(grn_ctxcxx . . $ grn_ctx# *ctx, const char *filename)
388 {
389 grn_ctxcxx . . $ grn_ctx# *plugins_ctx = &grn_plugins_ctxcxx . . $ grn_plugins_ctx.;
390 grn_idcxx . . $ grn_id# id = GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
391 grn_dlcxx . . $ grn_dl# dl;
392 grn_plugincxx . . $ grn_plugin# **plugin = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
393 unsigned int filename_size;
394
395 filename_size = (unsigned int)GRN_PLUGIN_KEY_SIZEcxx . . $ `lib/plugin.c:93:9`!(filename);
396
397 CRITICAL_SECTION_ENTERcxx . . $ `lib/grn.h:227:11`!(grn_plugins_lock);
398 if ((id = grn_hash_getcxx . . $ grn_hash_get(4e868e5367e71b67).(plugins_ctx,
399 grn_pluginscxx . . $ grn_plugins.,
400 filename,
401 filename_size,
402 (void **)&plugin))) {
403 (*plugin)->refcountcxx . . $ _grn_plugin#refcount.++;
404 goto exit;
405 }
406
407 #ifdef GRN_WITH_MRUBY
408 {
409 const char *mrb_suffix;
410 mrb_suffix = grn_plugin_get_ruby_suffix();
411 if (filename_size > strlen(mrb_suffix) &&
412 strcmp(filename + (strlen(filename) - strlen(mrb_suffix)),
413 mrb_suffix) == 0) {
414 id = grn_plugin_open_mrb(ctx, filename, filename_size);
415 goto exit;
416 }
417 }
418 #endif /* GRN_WITH_MRUBY */
419
420 if ((dl = grn_dl_opencxx . . $ `lib/plugin.c:76:11`!(filename))) {
421 if ((id = grn_hash_addcxx . . $ grn_hash_add(251a256fc515235e).(plugins_ctx,
422 grn_pluginscxx . . $ grn_plugins.,
423 filename,
424 filename_size,
425 (void **)&plugin,
426 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!))) {
427 {
428 grn_ctxcxx . . $ grn_ctx# *ctx = plugins_ctx;
429 *plugin = GRN_CALLOCcxx . . $ `lib/grn_alloc.h:42:9`!(sizeof(grn_plugin));
430 }
431 if (*plugin) {
432 grn_memcpycxx . . $ `include/groonga/portability.h:32:13`!((*plugin)->path, filename, filename_size);
433 if (grn_plugin_initializecxx . . $ grn_plugin_initialize(f709cd1ce48f4bd).(ctx, *plugin, dl, id, filename)) {
434 {
435 grn_ctxcxx . . $ grn_ctx# *ctx = plugins_ctx;
436 GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(*plugin);
437 }
438 *plugin = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
439 }
440 }
441 if (!*plugin) {
442 grn_hash_delete_by_idcxx . . $ grn_hash_delete_by_id(1721f36f0335b634).(plugins_ctx, grn_pluginscxx . . $ grn_plugins., id, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
443 if (grn_dl_closecxx . . $ `lib/plugin.c:78:11`!(dl)) {
444 /* Now, __FILE__ set in plugin is invalid. */
445 ctx->errlinecxx . . $ _grn_ctx#errline. = 0;
446 ctx->errfilecxx . . $ _grn_ctx#errfile. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
447 } else {
448 const char *label;
449 label = grn_dl_close_error_labelcxx . . $ `lib/plugin.c:79:11`!();
450 SERRcxx . . $ `lib/grn_error.h:411:11`!("%s", label);
451 }
452 id = GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
453 } else {
454 (*plugin)->refcountcxx . . $ _grn_plugin#refcount. = 1;
455 }
456 } else {
457 if (!grn_dl_closecxx . . $ `lib/plugin.c:78:11`!(dl)) {
458 const char *label;
459 label = grn_dl_close_error_labelcxx . . $ `lib/plugin.c:79:11`!();
460 SERRcxx . . $ `lib/grn_error.h:411:11`!("%s", label);
461 }
462 }
463 } else {
464 const char *label;
465 label = grn_dl_open_error_labelcxx . . $ `lib/plugin.c:77:11`!();
466 SERRcxx . . $ `lib/grn_error.h:411:11`!("%s: <%.*s>", label, (int)filename_size, filename);
467 }
468
469 exit:
470 CRITICAL_SECTION_LEAVEcxx . . $ `lib/grn.h:228:11`!(grn_plugins_lock);
471
472 return id;
473 }
474
475 grn_rccxx . . $ grn_rc#
476 grn_plugin_closecxx . . $ grn_plugin_close(40dd0a06a64dbe5d).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_idcxx . . $ grn_id# id)
477 {
478 grn_ctxcxx . . $ grn_ctx# *plugins_ctx = &grn_plugins_ctxcxx . . $ grn_plugins_ctx.;
479 grn_rccxx . . $ grn_rc# rc;
480 grn_plugincxx . . $ grn_plugin# *plugin;
481
482 if (id == GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!) {
483 return GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.;
484 }
485
486 CRITICAL_SECTION_ENTERcxx . . $ `lib/grn.h:227:11`!(grn_plugins_lock);
487 if (!grn_hash_get_valuecxx . . $ grn_hash_get_value(3fd53c1c6a190bf5).(plugins_ctx, grn_pluginscxx . . $ grn_plugins., id, &plugin)) {
488 rc = GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.;
489 goto exit;
490 }
491 if (--plugin->refcountcxx . . $ _grn_plugin#refcount.) {
492 rc = GRN_SUCCESScxx . . $ GRN_SUCCESS.;
493 goto exit;
494 }
495 if (plugin->dlcxx . . $ _grn_plugin#dl.) {
496 grn_plugin_call_fincxx . . $ grn_plugin_call_fin(40dd0a06a64dbe5d).(ctx, id);
497 if (!grn_dl_closecxx . . $ `lib/plugin.c:78:11`!(plugin->dl)) {
498 const char *label;
499 label = grn_dl_close_error_labelcxx . . $ `lib/plugin.c:79:11`!();
500 SERRcxx . . $ `lib/grn_error.h:411:11`!("%s", label);
501 }
502 }
503 {
504 grn_ctxcxx . . $ grn_ctx# *ctx = plugins_ctx;
505 GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(plugin);
506 }
507 rc = grn_hash_delete_by_idcxx . . $ grn_hash_delete_by_id(1721f36f0335b634).(plugins_ctx, grn_pluginscxx . . $ grn_plugins., id, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
508
509 exit:
510 CRITICAL_SECTION_LEAVEcxx . . $ `lib/grn.h:228:11`!(grn_plugins_lock);
511
512 return rc;
513 }
514
515 void *
516 grn_plugin_symcxx . . $ grn_plugin_sym(6d6b2988876f781b).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_idcxx . . $ grn_id# id, const char *symbol)
517 {
518 grn_plugincxx . . $ grn_plugin# *plugin;
519 grn_dl_symbolcxx . . $ grn_dl_symbol# func;
520
521 if (id == GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!) {
522 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
523 }
524
525 CRITICAL_SECTION_ENTERcxx . . $ `lib/grn.h:227:11`!(grn_plugins_lock);
526 if (!grn_hash_get_valuecxx . . $ grn_hash_get_value(3fd53c1c6a190bf5).(&grn_plugins_ctxcxx . . $ grn_plugins_ctx., grn_pluginscxx . . $ grn_plugins., id, &plugin)) {
527 func = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
528 goto exit;
529 }
530 grn_dl_clear_errorcxx . . $ `lib/plugin.c:82:11`!();
531 if (!(func = grn_dl_symcxx . . $ `lib/plugin.c:80:11`!(plugin->dl, symbol))) {
532 const char *label;
533 label = grn_dl_sym_error_labelcxx . . $ `lib/plugin.c:81:11`!();
534 SERRcxx . . $ `lib/grn_error.h:411:11`!("%s", label);
535 }
536
537 exit:
538 CRITICAL_SECTION_LEAVEcxx . . $ `lib/grn.h:228:11`!(grn_plugins_lock);
539
540 return func;
541 }
542
543 #ifdef WIN32
544 static void
545 grn_plugins_init_path(grn_ctx *ctx, grn_obj *path, const char *path_env)
546 {
547 /* TODO */
548 }
549 #else /* WIN32 */
550 static void
551 grn_plugins_init_pathcxx . . $ grn_plugins_init_path(b84060a767e6a862).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *path, const char *path_env)
552 {
553 const char separator = ':';
554 const char *start = path_env;
555 const char *current;
556
557 for (current = path_env; current[0]; current++) {
558 if (current[0] == separator) {
559 if (current - start > 0) {
560 grn_vector_add_elementcxx . . $ grn_vector_add_element(d170aee3d3986928).(&grn_plugins_ctxcxx . . $ grn_plugins_ctx.,
561 &grn_plugins_pathcxx . . $ grn_plugins_path.,
562 start,
563 (uint32_tcxx . . $ uint32_t#)(current - start),
564 0,
565 GRN_DB_TEXTcxx . . $ GRN_DB_TEXT.);
566 }
567 start = current + 1;
568 }
569 }
570
571 if (start[0] && current - start > 0) {
572 grn_vector_add_elementcxx . . $ grn_vector_add_element(d170aee3d3986928).(&grn_plugins_ctxcxx . . $ grn_plugins_ctx.,
573 &grn_plugins_pathcxx . . $ grn_plugins_path.,
574 start,
575 (uint32_tcxx . . $ uint32_t#)(current - start),
576 0,
577 GRN_DB_TEXTcxx . . $ GRN_DB_TEXT.);
578 }
579 }
580 #endif /* WIN32 */
581
582 #ifdef WIN32
583 static char *windows_plugins_dir = NULL;
584 static char windows_plugins_dir_buffer[PATH_MAX];
585 static const char *
586 grn_plugin_get_default_system_plugins_dir(void)
587 {
588 if (!windows_plugins_dir) {
589 const char *base_dir;
590 const char *relative_path = GRN_RELATIVE_PLUGINS_DIR;
591 size_t base_dir_length;
592
593 base_dir = grn_windows_base_dir();
594 base_dir_length = strlen(base_dir);
595 grn_strcpy(windows_plugins_dir_buffer, PATH_MAX, base_dir);
596 grn_strcat(windows_plugins_dir_buffer, PATH_MAX, "/");
597 grn_strcat(windows_plugins_dir_buffer, PATH_MAX, relative_path);
598 windows_plugins_dir = windows_plugins_dir_buffer;
599 }
600 return windows_plugins_dir;
601 }
602
603 #else /* WIN32 */
604 static const char *
605 grn_plugin_get_default_system_plugins_dircxx . . $ grn_plugin_get_default_system_plugins_dir(33a1f659e94feb42).(void)
606 {
607 return GRN_PLUGINS_DIRcxx . . $ `build/config.h:37:9`!;
608 }
609 #endif /* WIN32 */
610
611 const char *
612 grn_plugin_get_system_plugins_dircxx . . $ grn_plugin_get_system_plugins_dir(33a1f659e94feb42).(void)
613 {
614 if (grn_plugins_dir_envcxx . . $ grn_plugins_dir_env.[0]) {
615 return grn_plugins_dir_envcxx . . $ grn_plugins_dir_env.;
616 } else {
617 return grn_plugin_get_default_system_plugins_dircxx . . $ grn_plugin_get_default_system_plugins_dir(33a1f659e94feb42).();
618 }
619 }
620
621 grn_rccxx . . $ grn_rc#
622 grn_plugins_initcxx . . $ grn_plugins_init(d5bb96df31a8101).(void)
623 {
624 CRITICAL_SECTION_INITcxx . . $ `lib/grn.h:226:11`!(grn_plugins_lock);
625 grn_ctx_initcxx . . $ grn_ctx_init(670fdc69e3f5dbb5).(&grn_plugins_ctxcxx . . $ grn_plugins_ctx., 0);
626 GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&grn_plugins_path, GRN_OBJ_VECTORcxx . . $ `include/groonga/groonga.h:2734:9`!);
627 grn_pluginscxx . . $ grn_plugins. = grn_hash_createcxx . . $ grn_hash_create(db1bba7e0d64660).(&grn_plugins_ctxcxx . . $ grn_plugins_ctx.,
628 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!,
629 PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`!,
630 sizeof(grn_plugincxx . . $ grn_plugin# *),
631 GRN_OBJ_KEY_VAR_SIZEcxx . . $ `include/groonga/groonga.h:820:9`!);
632 if (!grn_pluginscxx . . $ grn_plugins.) {
633 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(&grn_plugins_ctx, &grn_plugins_path);
634 grn_ctx_fincxx . . $ grn_ctx_fin(2b4fa601bf4f1e5b).(&grn_plugins_ctxcxx . . $ grn_plugins_ctx.);
635 return GRN_NO_MEMORY_AVAILABLEcxx . . $ GRN_NO_MEMORY_AVAILABLE.;
636 }
637 if (grn_plugins_path_envcxx . . $ grn_plugins_path_env.[0]) {
638 grn_plugins_init_pathcxx . . $ grn_plugins_init_path(b84060a767e6a862).(&grn_plugins_ctxcxx . . $ grn_plugins_ctx.,
639 &grn_plugins_pathcxx . . $ grn_plugins_path.,
640 grn_plugins_path_envcxx . . $ grn_plugins_path_env.);
641 }
642 {
643 const char *system_plugins_dir = grn_plugin_get_system_plugins_dircxx . . $ grn_plugin_get_system_plugins_dir(33a1f659e94feb42).();
644 grn_vector_add_elementcxx . . $ grn_vector_add_element(d170aee3d3986928).(&grn_plugins_ctxcxx . . $ grn_plugins_ctx.,
645 &grn_plugins_pathcxx . . $ grn_plugins_path.,
646 system_plugins_dir,
647 (uint32_tcxx . . $ uint32_t#)strlencxx . . $ strlen(751346f8406fd082).(system_plugins_dir),
648 0,
649 GRN_DB_TEXTcxx . . $ GRN_DB_TEXT.);
650 }
651 return GRN_SUCCESScxx . . $ GRN_SUCCESS.;
652 }
653
654 grn_rccxx . . $ grn_rc#
655 grn_plugins_fincxx . . $ grn_plugins_fin(d5bb96df31a8101).(void)
656 {
657 grn_rccxx . . $ grn_rc# rc;
658 if (!grn_pluginscxx . . $ grn_plugins.) {
659 return GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.;
660 }
661 GRN_HASH_EACHcxx . . $ `include/groonga/hash.h:121:9`!(&grn_plugins_ctx, grn_plugins, id, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, {
662 grn_plugin_close(&grn_plugins_ctx, id);
663 });
664 rc = grn_hash_closecxx . . $ grn_hash_close(c005d027d163fb0b).(&grn_plugins_ctxcxx . . $ grn_plugins_ctx., grn_pluginscxx . . $ grn_plugins.);
665 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(&grn_plugins_ctx, &grn_plugins_path);
666 grn_ctx_fincxx . . $ grn_ctx_fin(2b4fa601bf4f1e5b).(&grn_plugins_ctxcxx . . $ grn_plugins_ctx.);
667 CRITICAL_SECTION_FINcxx . . $ `lib/grn.h:229:11`!(grn_plugins_lock);
668 return rc;
669 }
670
671 const char *
672 grn_plugin_get_suffixcxx . . $ grn_plugin_get_suffix(33a1f659e94feb42).(void)
673 {
674 return GRN_PLUGIN_SUFFIXcxx . . $ `build/config.h:38:9`!;
675 }
676
677 const char *
678 grn_plugin_get_ruby_suffixcxx . . $ grn_plugin_get_ruby_suffix(33a1f659e94feb42).(void)
679 {
680 return ".rb";
681 }
682
683 grn_rccxx . . $ grn_rc#
684 grn_plugin_register_by_pathcxx . . $ grn_plugin_register_by_path(cae1c943be750b4c).(grn_ctxcxx . . $ grn_ctx# *ctx, const char *path)
685 {
686 grn_objcxx . . $ grn_obj# *db;
687 if (!ctx || !ctx->implcxx . . $ _grn_ctx#impl. || !(db = ctx->implcxx . . $ _grn_ctx#impl.->dbcxx . . $ _grn_ctx_impl#db.)) {
688 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT, "db not initialized");
689 return ctx->rccxx . . $ _grn_ctx#rc.;
690 }
691 GRN_API_ENTERcxx . . $ `lib/grn_ctx.h:41:9`!;
692 if (GRN_DB_Pcxx . . $ `lib/grn_db.h:619:9`!(db)) {
693 grn_idcxx . . $ grn_id# id;
694 id = grn_plugin_opencxx . . $ grn_plugin_open(1be90328514dd2c4).(ctx, path);
695 if (id) {
696 ctx->implcxx . . $ _grn_ctx#impl.->plugin_pathcxx . . $ _grn_ctx_impl#plugin_path. = path;
697 ctx->rccxx . . $ _grn_ctx#rc. = grn_plugin_call_registercxx . . $ grn_plugin_call_register(40dd0a06a64dbe5d).(ctx, id);
698 ctx->implcxx . . $ _grn_ctx#impl.->plugin_pathcxx . . $ _grn_ctx_impl#plugin_path. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
699 grn_plugin_closecxx . . $ grn_plugin_close(40dd0a06a64dbe5d).(ctx, id);
700 }
701 } else {
702 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT, "invalid db assigned");
703 }
704 GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(ctx->rc);
705 }
706
707 static char *
708 grn_plugin_find_path_rawcxx . . $ grn_plugin_find_path_raw(f175fe58fb3ff6f1).(grn_ctxcxx . . $ grn_ctx# *ctx, const char *path)
709 {
710 struct statcxx . . $ stat# path_stat;
711
712 if (statcxx . . $ stat(a9cd1e23e96f423c).(path, &path_stat) != 0) {
713 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
714 }
715
716 if (!S_ISREGcxx . . $ `<external>/531885356569766532/stat.h:128:9`!(path_stat.st_mode)) {
717 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
718 }
719
720 return GRN_STRDUPcxx . . $ `lib/grn_alloc.h:44:9`!(path);
721 }
722
723 #ifdef GRN_WITH_MRUBY
724 static char *
725 grn_plugin_find_path_mrb(grn_ctx *ctx, const char *path, size_t path_len)
726 {
727 char mrb_path[PATH_MAX];
728 const char *mrb_suffix;
729 size_t mrb_path_len;
730
731 grn_ctx_impl_mrb_ensure_init(ctx);
732 if (ctx->rc != GRN_SUCCESS) {
733 return NULL;
734 }
735
736 if (!ctx->impl->mrb.state) {
737 return NULL;
738 }
739
740 mrb_suffix = grn_plugin_get_ruby_suffix();
741 mrb_path_len = path_len + strlen(mrb_suffix);
742 if (mrb_path_len >= PATH_MAX) {
743 ERR(GRN_FILENAME_TOO_LONG,
744 "too long plugin path: <%s%s>",
745 path,
746 mrb_suffix);
747 return NULL;
748 }
749
750 grn_strcpy(mrb_path, PATH_MAX, path);
751 grn_strcat(mrb_path, PATH_MAX, mrb_suffix);
752 return grn_plugin_find_path_raw(ctx, mrb_path);
753 }
754 #else /* GRN_WITH_MRUBY */
755 static char *
756 grn_plugin_find_path_mrbcxx . . $ grn_plugin_find_path_mrb(5bbb7a0ed225bf59).(grn_ctxcxx . . $ grn_ctx# *ctx, const char *path, size_t path_len)
757 {
758 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
759 }
760 #endif /* GRN_WITH_MRUBY */
761
762 static char *
763 grn_plugin_find_path_socxx . . $ grn_plugin_find_path_so(5bbb7a0ed225bf59).(grn_ctxcxx . . $ grn_ctx# *ctx, const char *path, size_t path_len)
764 {
765 char so_path[PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`!];
766 const char *so_suffix;
767 size_t so_path_len;
768
769 so_suffix = grn_plugin_get_suffixcxx . . $ grn_plugin_get_suffix(33a1f659e94feb42).();
770 so_path_len = path_len + strlencxx . . $ strlen(751346f8406fd082).(so_suffix);
771 if (so_path_len >= PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`!) {
772 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_FILENAME_TOO_LONG, "too long plugin path: <%s%s>", path, so_suffix);
773 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
774 }
775
776 grn_strcpycxx . . $ `include/groonga/portability.h:101:11`!(so_path, PATH_MAX, path);
777 grn_strcatcxx . . $ `include/groonga/portability.h:114:11`!(so_path, PATH_MAX, so_suffix);
778 return grn_plugin_find_path_rawcxx . . $ grn_plugin_find_path_raw(f175fe58fb3ff6f1).(ctx, so_path);
779 }
780
781 static char *
782 grn_plugin_find_path_libs_socxx . . $ grn_plugin_find_path_libs_so(5bbb7a0ed225bf59).(grn_ctxcxx . . $ grn_ctx# *ctx, const char *path, size_t path_len)
783 {
784 char libs_so_path[PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`!];
785 const char *base_name;
786 const char *so_suffix;
787 const char *libs_path = "/.libs";
788 size_t libs_so_path_len;
789
790 base_name = strrchrcxx . . $ `<external>/13506128340496143423/string.h:295:11`!(path, '/');
791 if (!base_name) {
792 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
793 }
794
795 so_suffix = grn_plugin_get_suffixcxx . . $ grn_plugin_get_suffix(33a1f659e94feb42).();
796 libs_so_path_len = (size_t)(base_name - path) + strlencxx . . $ strlen(751346f8406fd082).(libs_path) +
797 strlencxx . . $ strlen(751346f8406fd082).(base_name) + strlencxx . . $ strlen(751346f8406fd082).(so_suffix);
798 if (libs_so_path_len >= PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`!) {
799 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_FILENAME_TOO_LONG,
800 "too long plugin path: <%.*s/.libs%s%s>",
801 (int)(base_name - path),
802 path,
803 base_name,
804 so_suffix);
805 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
806 }
807
808 libs_so_path[0] = '\0';
809 grn_strncatcxx . . $ `include/groonga/portability.h:95:11`!(libs_so_path, PATH_MAX, path, (size_t)(base_name - path));
810 grn_strcatcxx . . $ `include/groonga/portability.h:114:11`!(libs_so_path, PATH_MAX, libs_path);
811 grn_strcatcxx . . $ `include/groonga/portability.h:114:11`!(libs_so_path, PATH_MAX, base_name);
812 grn_strcatcxx . . $ `include/groonga/portability.h:114:11`!(libs_so_path, PATH_MAX, so_suffix);
813 return grn_plugin_find_path_rawcxx . . $ grn_plugin_find_path_raw(f175fe58fb3ff6f1).(ctx, libs_so_path);
814 }
815
816 static char *
817 grn_plugin_find_path_onecxx . . $ grn_plugin_find_path_one(f175fe58fb3ff6f1).(grn_ctxcxx . . $ grn_ctx# *ctx, const char *path)
818 {
819 char *found_path = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
820 size_t path_len;
821
822 found_path = grn_plugin_find_path_rawcxx . . $ grn_plugin_find_path_raw(f175fe58fb3ff6f1).(ctx, path);
823 if (found_path) {
824 goto exit;
825 }
826
827 path_len = strlencxx . . $ strlen(751346f8406fd082).(path);
828
829 found_path = grn_plugin_find_path_socxx . . $ grn_plugin_find_path_so(5bbb7a0ed225bf59).(ctx, path, path_len);
830 if (found_path) {
831 goto exit;
832 }
833 if (ctx->rccxx . . $ _grn_ctx#rc.) {
834 goto exit;
835 }
836
837 found_path = grn_plugin_find_path_libs_socxx . . $ grn_plugin_find_path_libs_so(5bbb7a0ed225bf59).(ctx, path, path_len);
838 if (found_path) {
839 goto exit;
840 }
841 if (ctx->rccxx . . $ _grn_ctx#rc.) {
842 goto exit;
843 }
844
845 found_path = grn_plugin_find_path_mrbcxx . . $ grn_plugin_find_path_mrb(5bbb7a0ed225bf59).(ctx, path, path_len);
846 if (found_path) {
847 goto exit;
848 }
849 if (ctx->rccxx . . $ _grn_ctx#rc.) {
850 goto exit;
851 }
852
853 exit:
854 return found_path;
855 }
856
857 static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`!
858 grn_plugin_find_path_is_absolute_pathcxx . . $ grn_plugin_find_path_is_absolute_path(445bcde47c288915).(grn_ctxcxx . . $ grn_ctx# *ctx, const char *name)
859 {
860 /* UNIX */
861 if (name[0] == '/') {
862 return truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
863 }
864
865 /* Windows */
866 if ((('a' <= name[0] && name[0] <= 'z') ||
867 ('A' <= name[0] && name[0] <= 'Z')) &&
868 name[1] == ':' && name[2] == '/') {
869 return truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
870 }
871
872 return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!;
873 }
874
875 char *
876 grn_plugin_find_pathcxx . . $ grn_plugin_find_path(f175fe58fb3ff6f1).(grn_ctxcxx . . $ grn_ctx# *ctx, const char *name)
877 {
878 char *found_path = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
879
880 GRN_API_ENTERcxx . . $ `lib/grn_ctx.h:41:9`!;
881
882 if (grn_plugin_find_path_is_absolute_pathcxx . . $ grn_plugin_find_path_is_absolute_path(445bcde47c288915).(ctx, name)) {
883 found_path = grn_plugin_find_path_onecxx . . $ grn_plugin_find_path_one(f175fe58fb3ff6f1).(ctx, name);
884 } else {
885 GRN_PLUGINS_DIR_EACH_BEGINcxx . . $ `lib/plugin.c:55:9`!(dir, dir_length)
886 {
887 char dir_last_char;
888 char path[PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`!];
889 size_t name_length, max_name_length;
890
891 grn_strncpycxx . . $ `include/groonga/portability.h:108:11`!(path, PATH_MAX, dir, dir_length);
892 path[dir_length] = '\0';
893
894 dir_last_char = dir[dir_length - 1];
895 if (dir_last_char != '/') {
896 grn_strcatcxx . . $ `include/groonga/portability.h:114:11`!(path, PATH_MAX, "/");
897 }
898
899 name_length = strlencxx . . $ strlen(751346f8406fd082).(name);
900 max_name_length = PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`! - strlencxx . . $ strlen(751346f8406fd082).(path) - 1;
901 if (name_length > max_name_length) {
902 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
903 "plugin name is too long: %" GRN_FMT_SIZEcxx . . $ `lib/grn.h:408:11`! " (max: %" GRN_FMT_SIZEcxx . . $ `lib/grn.h:408:11`!
904 ") <%s%s>",
905 name_length,
906 max_name_length,
907 path,
908 name);
909 break;
910 }
911 grn_strcatcxx . . $ `include/groonga/portability.h:114:11`!(path, PATH_MAX, name);
912
913 found_path = grn_plugin_find_path_onecxx . . $ grn_plugin_find_path_one(f175fe58fb3ff6f1).(ctx, path);
914 if (found_path) {
915 break;
916 }
917 if (ctx->rccxx . . $ _grn_ctx#rc. != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
918 break;
919 }
920 }
921 GRN_PLUGINS_DIR_EACH_ENDcxx . . $ `lib/plugin.c:69:9`!();
922 }
923
924 GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(found_path);
925 }
926
927 static void
928 grn_plugin_set_name_resolve_errorcxx . . $ grn_plugin_set_name_resolve_error(af7f37f5046ba4a0).(grn_ctxcxx . . $ grn_ctx# *ctx,
929 const char *name,
930 const char *tag)
931 {
932 if (name[0] == '/') {
933 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_NO_SUCH_FILE_OR_DIRECTORY,
934 "%s cannot find plugin file: <%s>",
935 tag,
936 name);
937 } else {
938 const char *grn_encoding_plugins_dir;
939 size_t grn_encoding_plugins_dir_length;
940 const char *plugins_dir_path_separator;
941
942 grn_encoding_plugins_dir =
943 grn_encoding_convert_from_localecxx . . $ grn_encoding_convert_from_locale(7ca20cb0a0cd3873).(ctx,
944 grn_plugin_get_system_plugins_dircxx . . $ grn_plugin_get_system_plugins_dir(33a1f659e94feb42).(),
945 -1,
946 &grn_encoding_plugins_dir_length);
947 if (grn_encoding_plugins_dir[grn_encoding_plugins_dir_length - 1] != '/') {
948 plugins_dir_path_separator = "/";
949 } else {
950 plugins_dir_path_separator = "";
951 }
952 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_NO_SUCH_FILE_OR_DIRECTORY,
953 "%s cannot find plugin file: <%s%s%s%s>",
954 tag,
955 grn_encoding_plugins_dir,
956 plugins_dir_path_separator,
957 name,
958 grn_plugin_get_suffix());
959 grn_encoding_converted_freecxx . . $ grn_encoding_converted_free(777524e3d10dd7b4).(ctx, grn_encoding_plugins_dir);
960 }
961 }
962
963 grn_rccxx . . $ grn_rc#
964 grn_plugin_registercxx . . $ grn_plugin_register(cae1c943be750b4c).(grn_ctxcxx . . $ grn_ctx# *ctx, const char *name)
965 {
966 grn_rccxx . . $ grn_rc# rc;
967 char *path;
968
969 GRN_API_ENTERcxx . . $ `lib/grn_ctx.h:41:9`!;
970 path = grn_plugin_find_pathcxx . . $ grn_plugin_find_path(f175fe58fb3ff6f1).(ctx, name);
971 if (path) {
972 rc = grn_plugin_register_by_pathcxx . . $ grn_plugin_register_by_path(cae1c943be750b4c).(ctx, path);
973 GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(path);
974 } else {
975 if (ctx->rccxx . . $ _grn_ctx#rc. == GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
976 grn_plugin_set_name_resolve_errorcxx . . $ grn_plugin_set_name_resolve_error(af7f37f5046ba4a0).(ctx, name, "[plugin][register]");
977 }
978 rc = ctx->rccxx . . $ _grn_ctx#rc.;
979 }
980 GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(rc);
981 }
982
983 grn_rccxx . . $ grn_rc#
984 grn_plugin_unregister_by_pathcxx . . $ grn_plugin_unregister_by_path(cae1c943be750b4c).(grn_ctxcxx . . $ grn_ctx# *ctx, const char *path)
985 {
986 grn_objcxx . . $ grn_obj# *db;
987 grn_idcxx . . $ grn_id# plugin_id;
988
989 if (!ctx || !ctx->implcxx . . $ _grn_ctx#impl.) {
990 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT, "[plugin][unregister] ctx isn't initialized");
991 return ctx->rccxx . . $ _grn_ctx#rc.;
992 }
993
994 db = ctx->implcxx . . $ _grn_ctx#impl.->dbcxx . . $ _grn_ctx_impl#db.;
995 if (!db) {
996 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT, "[plugin][unregister] DB isn't initialized");
997 return ctx->rccxx . . $ _grn_ctx#rc.;
998 }
999
1000 GRN_API_ENTERcxx . . $ `lib/grn_ctx.h:41:9`!;
1001
1002 CRITICAL_SECTION_ENTERcxx . . $ `lib/grn.h:227:11`!(grn_plugins_lock);
1003 plugin_id = grn_hash_getcxx . . $ grn_hash_get(4e868e5367e71b67).(&grn_plugins_ctxcxx . . $ grn_plugins_ctx.,
1004 grn_pluginscxx . . $ grn_plugins.,
1005 path,
1006 (uint32_tcxx . . $ uint32_t#)GRN_PLUGIN_KEY_SIZEcxx . . $ `lib/plugin.c:93:9`!(path),
1007 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
1008 CRITICAL_SECTION_LEAVEcxx . . $ `lib/grn.h:228:11`!(grn_plugins_lock);
1009
1010 if (plugin_id == GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!) {
1011 GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(ctx->rc);
1012 }
1013
1014 {
1015 grn_table_cursorcxx . . $ grn_table_cursor# *cursor;
1016 grn_idcxx . . $ grn_id# id;
1017
1018 cursor =
1019 grn_table_cursor_opencxx . . $ grn_table_cursor_open(a4cddc3087c69e91).(ctx, db, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 0, 0, -1, GRN_CURSOR_BY_IDcxx . . $ `include/groonga/table.h:280:9`!);
1020 if (!cursor) {
1021 GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(ctx->rc);
1022 }
1023
1024 while ((id = grn_table_cursor_nextcxx . . $ grn_table_cursor_next(8dd58acc9865e889).(ctx, cursor))) {
1025 grn_objcxx . . $ grn_obj# *obj;
1026 obj = grn_ctx_atcxx . . $ grn_ctx_at(ac4544c8400954c9).(ctx, id);
1027 if (!obj) {
1028 continue;
1029 }
1030 if (obj->headercxx . . $ _grn_obj#header..typecxx . . $ _grn_obj_header#type. == GRN_PROCcxx . . $ `include/groonga/groonga.h:893:9`! && DB_OBJcxx . . $ `lib/grn_db.h:62:9`!(obj)->rangecxx . . $ $anonymous_type_4a7c1014017e4c5d_0#range. == plugin_id) {
1031 grn_obj_removecxx . . $ grn_obj_remove(4865d068a46d0f83).(ctx, obj);
1032 } else {
1033 grn_obj_unlinkcxx . . $ grn_obj_unlink(4865d068a46d0f83).(ctx, obj);
1034 }
1035 }
1036 grn_table_cursor_closecxx . . $ grn_table_cursor_close(4865d068a46d0f83).(ctx, cursor);
1037 }
1038
1039 GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(ctx->rc);
1040 }
1041
1042 grn_rccxx . . $ grn_rc#
1043 grn_plugin_unregistercxx . . $ grn_plugin_unregister(cae1c943be750b4c).(grn_ctxcxx . . $ grn_ctx# *ctx, const char *name)
1044 {
1045 grn_rccxx . . $ grn_rc# rc;
1046 char *path;
1047
1048 GRN_API_ENTERcxx . . $ `lib/grn_ctx.h:41:9`!;
1049 path = grn_plugin_find_pathcxx . . $ grn_plugin_find_path(f175fe58fb3ff6f1).(ctx, name);
1050 if (path) {
1051 rc = grn_plugin_unregister_by_pathcxx . . $ grn_plugin_unregister_by_path(cae1c943be750b4c).(ctx, path);
1052 GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(path);
1053 } else {
1054 if (ctx->rccxx . . $ _grn_ctx#rc. == GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
1055 grn_plugin_set_name_resolve_errorcxx . . $ grn_plugin_set_name_resolve_error(af7f37f5046ba4a0).(ctx, name, "[plugin][unregister]");
1056 }
1057 rc = ctx->rccxx . . $ _grn_ctx#rc.;
1058 }
1059 GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(rc);
1060 }
1061
1062 void
1063 grn_plugin_ensure_registeredcxx . . $ grn_plugin_ensure_registered(cda3a5f3c2e53c6b).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *proc)
1064 {
1065 #ifdef GRN_WITH_MRUBY
1066 grn_id plugin_id;
1067 grn_plugin *plugin = NULL;
1068
1069 if (!(proc->header.flags & GRN_OBJ_CUSTOM_NAME)) {
1070 return;
1071 }
1072
1073 plugin_id = DB_OBJ(proc)->range;
1074 CRITICAL_SECTION_ENTER(grn_plugins_lock);
1075 {
1076 const char *value;
1077 value = grn_hash_get_value_(&grn_plugins_ctx, grn_plugins, plugin_id, NULL);
1078 if (value) {
1079 plugin = *((grn_plugin **)value);
1080 }
1081 }
1082 CRITICAL_SECTION_LEAVE(grn_plugins_lock);
1083
1084 if (!plugin) {
1085 return;
1086 }
1087
1088 if (plugin->dl) {
1089 return;
1090 }
1091
1092 grn_ctx_impl_mrb_ensure_init(ctx);
1093 if (ctx->rc != GRN_SUCCESS) {
1094 return;
1095 }
1096
1097 if (!ctx->impl->mrb.state) {
1098 return;
1099 }
1100
1101 {
1102 grn_id id;
1103 int added;
1104 id = DB_OBJ(proc)->id;
1105 grn_hash_add(ctx,
1106 ctx->impl->mrb.checked_procs,
1107 &id,
1108 sizeof(grn_id),
1109 NULL,
1110 &added);
1111 if (!added) {
1112 return;
1113 }
1114 }
1115
1116 ctx->impl->plugin_path = plugin->path;
1117 grn_plugin_call_register_mrb(ctx, plugin_id, plugin);
1118 ctx->impl->plugin_path = NULL;
1119 #endif /* GRN_WITH_MRUBY */
1120 }
1121
1122 grn_rccxx . . $ grn_rc#
1123 grn_plugin_get_namescxx . . $ grn_plugin_get_names(4865d068a46d0f83).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *names)
1124 {
1125 grn_hashcxx . . $ grn_hash# *processed_paths;
1126 const char *system_plugins_dir;
1127 const char *native_plugin_suffix;
1128 const char *ruby_plugin_suffix;
1129 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! is_close_opened_object_mode = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!;
1130
1131 GRN_API_ENTERcxx . . $ `lib/grn_ctx.h:41:9`!;
1132
1133 if (ctx->rccxx . . $ _grn_ctx#rc.) {
1134 GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(ctx->rc);
1135 }
1136
1137 if (grn_thread_get_limitcxx . . $ grn_thread_get_limit(db52760e79bf9054).() == 1) {
1138 is_close_opened_object_mode = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
1139 }
1140
1141 processed_paths =
1142 grn_hash_createcxx . . $ grn_hash_create(db1bba7e0d64660).(ctx,
1143 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!,
1144 GRN_TABLE_MAX_KEY_SIZEcxx . . $ `include/groonga/table.h:26:9`!,
1145 0,
1146 GRN_OBJ_TABLE_HASH_KEYcxx . . $ `include/groonga/groonga.h:688:9`! | GRN_OBJ_KEY_VAR_SIZEcxx . . $ `include/groonga/groonga.h:820:9`!);
1147 if (!processed_paths) {
1148 GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(ctx->rc);
1149 }
1150
1151 system_plugins_dir = grn_plugin_get_system_plugins_dircxx . . $ grn_plugin_get_system_plugins_dir(33a1f659e94feb42).();
1152 native_plugin_suffix = grn_plugin_get_suffixcxx . . $ grn_plugin_get_suffix(33a1f659e94feb42).();
1153 ruby_plugin_suffix = grn_plugin_get_ruby_suffixcxx . . $ grn_plugin_get_ruby_suffix(33a1f659e94feb42).();
1154
1155 GRN_TABLE_EACH_BEGIN_FLAGScxx . . $ `include/groonga/table.h:631:9`!(ctx,
1156 grn_ctx_db(ctx),
1157 cursor,
1158 id,
1159 GRN_CURSOR_BY_IDcxx . . $ `include/groonga/table.h:280:9`! | GRN_CURSOR_ASCENDINGcxx . . $ `include/groonga/table.h:273:9`!)
1160 {
1161 void *name;
1162 int name_size;
1163 grn_objcxx . . $ grn_obj# *object;
1164 const char *path;
1165 grn_idcxx . . $ grn_id# processed_path_id;
1166
1167 if (grn_id_is_builtincxx . . $ grn_id_is_builtin(a2a496425acc5b40).(ctx, id)) {
1168 continue;
1169 }
1170
1171 name_size = grn_table_cursor_get_keycxx . . $ grn_table_cursor_get_key(7d620ebe94cee13a).(ctx, cursor, &name);
1172 if (grn_obj_name_is_columncxx . . $ grn_obj_name_is_column(da3161f0ad1ba10a).(ctx, name, name_size)) {
1173 continue;
1174 }
1175
1176 if (is_close_opened_object_mode) {
1177 grn_ctx_push_temporary_open_spacecxx . . $ grn_ctx_push_temporary_open_space(2b4fa601bf4f1e5b).(ctx);
1178 }
1179
1180 object = grn_ctx_atcxx . . $ grn_ctx_at(ac4544c8400954c9).(ctx, id);
1181 if (!object) {
1182 ERRCLRcxx . . $ `lib/grn_error.h:37:9`!(ctx);
1183 goto next_loop;
1184 }
1185
1186 if (!grn_obj_is_proccxx . . $ grn_obj_is_proc(a5760e5c319a06ee).(ctx, object)) {
1187 goto next_loop;
1188 }
1189
1190 path = grn_obj_pathcxx . . $ grn_obj_path(ab3dda79dad54815).(ctx, object);
1191 if (!path) {
1192 goto next_loop;
1193 }
1194
1195 processed_path_id =
1196 grn_hash_getcxx . . $ grn_hash_get(4e868e5367e71b67).(ctx, processed_paths, path, (uint32_tcxx . . $ uint32_t#)strlencxx . . $ strlen(751346f8406fd082).(path), NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
1197 if (processed_path_id != GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!) {
1198 goto next_loop;
1199 }
1200
1201 grn_hash_addcxx . . $ grn_hash_add(251a256fc515235e).(ctx,
1202 processed_paths,
1203 path,
1204 (uint32_tcxx . . $ uint32_t#)strlencxx . . $ strlen(751346f8406fd082).(path),
1205 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!,
1206 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
1207
1208 {
1209 const char *relative_path;
1210 const char *libs_path = "/.libs/";
1211 const char *start_libs;
1212 char name[PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`!];
1213
1214 name[0] = '\0';
1215 if (strncmpcxx . . $ strncmp(fd278af2f295fa2e).(path, system_plugins_dir, strlencxx . . $ strlen(751346f8406fd082).(system_plugins_dir)) == 0) {
1216 relative_path = path + strlencxx . . $ strlen(751346f8406fd082).(system_plugins_dir);
1217 } else {
1218 relative_path = path;
1219 }
1220 start_libs = strstrcxx . . $ `<external>/13506128340496143423/string.h:380:11`!(relative_path, libs_path);
1221 if (start_libs) {
1222 grn_strncatcxx . . $ `include/groonga/portability.h:95:11`!(name,
1223 PATH_MAX,
1224 relative_path,
1225 (size_t)(start_libs - relative_path));
1226 grn_strcatcxx . . $ `include/groonga/portability.h:114:11`!(name, PATH_MAX, "/");
1227 grn_strcatcxx . . $ `include/groonga/portability.h:114:11`!(name, PATH_MAX, start_libs + strlen(libs_path));
1228 } else {
1229 grn_strcatcxx . . $ `include/groonga/portability.h:114:11`!(name, PATH_MAX, relative_path);
1230 }
1231 if (strlencxx . . $ strlen(751346f8406fd082).(name) > strlencxx . . $ strlen(751346f8406fd082).(native_plugin_suffix) &&
1232 strcmpcxx . . $ strcmp(5ae29d726ae57f88).(name + strlencxx . . $ strlen(751346f8406fd082).(name) - strlencxx . . $ strlen(751346f8406fd082).(native_plugin_suffix),
1233 native_plugin_suffix) == 0) {
1234 name[strlencxx . . $ strlen(751346f8406fd082).(name) - strlencxx . . $ strlen(751346f8406fd082).(native_plugin_suffix)] = '\0';
1235 } else if (strlencxx . . $ strlen(751346f8406fd082).(name) > strlencxx . . $ strlen(751346f8406fd082).(ruby_plugin_suffix) &&
1236 strcmpcxx . . $ strcmp(5ae29d726ae57f88).(name + strlencxx . . $ strlen(751346f8406fd082).(name) - strlencxx . . $ strlen(751346f8406fd082).(ruby_plugin_suffix),
1237 ruby_plugin_suffix) == 0) {
1238 name[strlencxx . . $ strlen(751346f8406fd082).(name) - strlencxx . . $ strlen(751346f8406fd082).(ruby_plugin_suffix)] = '\0';
1239 }
1240 grn_vector_add_elementcxx . . $ grn_vector_add_element(d170aee3d3986928).(ctx,
1241 names,
1242 name,
1243 (uint32_tcxx . . $ uint32_t#)strlencxx . . $ strlen(751346f8406fd082).(name),
1244 0,
1245 GRN_DB_TEXTcxx . . $ GRN_DB_TEXT.);
1246 }
1247
1248 next_loop:
1249 if (is_close_opened_object_mode) {
1250 grn_ctx_pop_temporary_open_spacecxx . . $ grn_ctx_pop_temporary_open_space(2b4fa601bf4f1e5b).(ctx);
1251 }
1252 }
1253 GRN_TABLE_EACH_ENDcxx . . $ `include/groonga/table.h:665:9`!(ctx, cursor);
1254
1255 grn_hash_closecxx . . $ grn_hash_close(c005d027d163fb0b).(ctx, processed_paths);
1256
1257 GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(ctx->rc);
1258 }
1259
1260 void *
1261 grn_plugin_malloccxx . . $ grn_plugin_malloc(464175534efa3de7).(
1262 grn_ctxcxx . . $ grn_ctx# *ctx, size_t size, const char *file, int line, const char *func)
1263 {
1264 return grn_malloccxx . . $ grn_malloc(464175534efa3de7).(ctx, size, file, line, func);
1265 }
1266
1267 void *
1268 grn_plugin_calloccxx . . $ grn_plugin_calloc(464175534efa3de7).(
1269 grn_ctxcxx . . $ grn_ctx# *ctx, size_t size, const char *file, int line, const char *func)
1270 {
1271 return grn_calloccxx . . $ grn_calloc(464175534efa3de7).(ctx, size, file, line, func);
1272 }
1273
1274 void *
1275 grn_plugin_realloccxx . . $ grn_plugin_realloc(81c005e7023c2b15).(grn_ctxcxx . . $ grn_ctx# *ctx,
1276 void *ptr,
1277 size_t size,
1278 const char *file,
1279 int line,
1280 const char *func)
1281 {
1282 return grn_realloccxx . . $ grn_realloc(81c005e7023c2b15).(ctx, ptr, size, file, line, func);
1283 }
1284
1285 void
1286 grn_plugin_freecxx . . $ grn_plugin_free(7cadacd43fda8113).(
1287 grn_ctxcxx . . $ grn_ctx# *ctx, void *ptr, const char *file, int line, const char *func)
1288 {
1289 grn_freecxx . . $ grn_free(7cadacd43fda8113).(ctx, ptr, file, line, func);
1290 }
1291
1292 void
1293 grn_plugin_set_errorcxx . . $ grn_plugin_set_error(fd99a418ac585d39).(grn_ctxcxx . . $ grn_ctx# *ctx,
1294 grn_log_levelcxx . . $ grn_log_level# level,
1295 grn_rccxx . . $ grn_rc# error_code,
1296 const char *file,
1297 int line,
1298 const char *func,
1299 const char *format,
1300 ...)
1301 {
1302 char old_error_message[GRN_CTX_MSGSIZEcxx . . $ `include/groonga/groonga.h:334:9`!];
1303
1304 ctx->errlvlcxx . . $ _grn_ctx#errlvl. = (unsigned char)level;
1305 ctx->rccxx . . $ _grn_ctx#rc. = error_code;
1306 ctx->errfilecxx . . $ _grn_ctx#errfile. = file;
1307 ctx->errlinecxx . . $ _grn_ctx#errline. = (unsigned int)line;
1308 ctx->errfunccxx . . $ _grn_ctx#errfunc. = func;
1309
1310 grn_strcpycxx . . $ `include/groonga/portability.h:101:11`!(old_error_message, GRN_CTX_MSGSIZE, ctx->errbuf);
1311
1312 {
1313 va_listcxx . . $ va_list# ap;
1314 va_startcxx . . $ `<external>/8293021631987149590/stdarg.h:51:9`!(ap, format);
1315 grn_ctx_logvcxx . . $ grn_ctx_logv(e8a2c43f96f3f14a).(ctx, format, ap);
1316 va_endcxx . . $ `<external>/8293021631987149590/stdarg.h:53:9`!(ap);
1317 }
1318
1319 if (grn_ctx_impl_should_logcxx . . $ grn_ctx_impl_should_log(6769dd2542d68818).(ctx)) {
1320 grn_ctx_impl_set_current_error_messagecxx . . $ grn_ctx_impl_set_current_error_message(b578cd6e53d5fe91).(ctx);
1321 if (grn_logger_passcxx . . $ grn_logger_pass(188766080ec9c0f2).(ctx, level)) {
1322 char new_error_message[GRN_CTX_MSGSIZEcxx . . $ `include/groonga/groonga.h:334:9`!];
1323 grn_strcpycxx . . $ `include/groonga/portability.h:101:11`!(new_error_message, GRN_CTX_MSGSIZE, ctx->errbuf);
1324 grn_strcpycxx . . $ `include/groonga/portability.h:101:11`!(ctx->errbuf, GRN_CTX_MSGSIZE, old_error_message);
1325 {
1326 va_listcxx . . $ va_list# ap;
1327 va_startcxx . . $ `<external>/8293021631987149590/stdarg.h:51:9`!(ap, format);
1328 grn_logger_putvcxx . . $ grn_logger_putv(76508e69ff1adf9d).(ctx, level, file, line, func, format, ap);
1329 va_endcxx . . $ `<external>/8293021631987149590/stdarg.h:53:9`!(ap);
1330 }
1331 grn_strcpycxx . . $ `include/groonga/portability.h:101:11`!(ctx->errbuf, GRN_CTX_MSGSIZE, new_error_message);
1332 }
1333 if (level <= GRN_LOG_ERRORcxx . . $ GRN_LOG_ERROR.) {
1334 grn_plugin_logtracecxx . . $ grn_plugin_logtrace(59adfd980b109eb9).(ctx, level);
1335 }
1336 }
1337 }
1338
1339 void
1340 grn_plugin_clear_errorcxx . . $ grn_plugin_clear_error(b578cd6e53d5fe91).(grn_ctxcxx . . $ grn_ctx# *ctx)
1341 {
1342 ERRCLRcxx . . $ `lib/grn_error.h:37:9`!(ctx);
1343 }
1344
1345 void
1346 grn_plugin_backtracecxx . . $ grn_plugin_backtrace(b578cd6e53d5fe91).(grn_ctxcxx . . $ grn_ctx# *ctx)
1347 {
1348 }
1349
1350 void
1351 grn_plugin_logtracecxx . . $ grn_plugin_logtrace(59adfd980b109eb9).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_log_levelcxx . . $ grn_log_level# level)
1352 {
1353 grn_ctx_log_back_tracecxx . . $ grn_ctx_log_back_trace(59adfd980b109eb9).(ctx, level);
1354 }
1355
1356 struct _grn_plugin_mutexcxx . . $ _grn_plugin_mutex# {
1357 grn_critical_sectioncxx . . $ grn_critical_section# critical_sectioncxx . . $ _grn_plugin_mutex#critical_section.;
1358 };
1359
1360 grn_plugin_mutexcxx . . $ grn_plugin_mutex# *
1361 grn_plugin_mutex_opencxx . . $ grn_plugin_mutex_open(3cf2524950758967).(grn_ctxcxx . . $ grn_ctx# *ctx)
1362 {
1363 grn_plugin_mutexcxx . . $ grn_plugin_mutex# *const mutex =
1364 GRN_PLUGIN_MALLOCcxx . . $ `include/groonga/plugin.h:88:9`!(ctx, sizeof(grn_plugin_mutex));
1365 if (mutex != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) {
1366 CRITICAL_SECTION_INITcxx . . $ `lib/grn.h:226:11`!(mutex->critical_section);
1367 }
1368 return mutex;
1369 }
1370
1371 grn_plugin_mutexcxx . . $ grn_plugin_mutex# *
1372 grn_plugin_mutex_createcxx . . $ grn_plugin_mutex_create(3cf2524950758967).(grn_ctxcxx . . $ grn_ctx# *ctx)
1373 {
1374 return grn_plugin_mutex_opencxx . . $ grn_plugin_mutex_open(3cf2524950758967).(ctx);
1375 }
1376
1377 void
1378 grn_plugin_mutex_closecxx . . $ grn_plugin_mutex_close(11b54cdd75f6769c).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_plugin_mutexcxx . . $ grn_plugin_mutex# *mutex)
1379 {
1380 if (mutex != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) {
1381 CRITICAL_SECTION_FINcxx . . $ `lib/grn.h:229:11`!(mutex->critical_section);
1382 GRN_PLUGIN_FREEcxx . . $ `include/groonga/plugin.h:100:9`!(ctx, mutex);
1383 }
1384 }
1385
1386 void
1387 grn_plugin_mutex_destroycxx . . $ grn_plugin_mutex_destroy(11b54cdd75f6769c).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_plugin_mutexcxx . . $ grn_plugin_mutex# *mutex)
1388 {
1389 grn_plugin_mutex_closecxx . . $ grn_plugin_mutex_close(11b54cdd75f6769c).(ctx, mutex);
1390 }
1391
1392 void
1393 grn_plugin_mutex_lockcxx . . $ grn_plugin_mutex_lock(11b54cdd75f6769c).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_plugin_mutexcxx . . $ grn_plugin_mutex# *mutex)
1394 {
1395 if (mutex != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) {
1396 CRITICAL_SECTION_ENTERcxx . . $ `lib/grn.h:227:11`!(mutex->critical_section);
1397 }
1398 }
1399
1400 void
1401 grn_plugin_mutex_unlockcxx . . $ grn_plugin_mutex_unlock(11b54cdd75f6769c).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_plugin_mutexcxx . . $ grn_plugin_mutex# *mutex)
1402 {
1403 if (mutex != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) {
1404 CRITICAL_SECTION_LEAVEcxx . . $ `lib/grn.h:228:11`!(mutex->critical_section);
1405 }
1406 }
1407
1408 grn_objcxx . . $ grn_obj# *
1409 grn_plugin_proc_alloccxx . . $ grn_plugin_proc_alloc(acb267eca6702fc).(grn_ctxcxx . . $ grn_ctx# *ctx,
1410 grn_user_datacxx . . $ grn_user_data# *user_data,
1411 grn_idcxx . . $ grn_id# domain,
1412 unsigned char flags)
1413 {
1414 return grn_proc_alloccxx . . $ grn_proc_alloc(acb267eca6702fc).(ctx, user_data, domain, flags);
1415 }
1416
1417 grn_objcxx . . $ grn_obj# *
1418 grn_plugin_proc_get_varscxx . . $ grn_plugin_proc_get_vars(409051005bdbf179).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_user_datacxx . . $ grn_user_data# *user_data)
1419 {
1420 return grn_proc_get_varscxx . . $ grn_proc_get_vars(409051005bdbf179).(ctx, user_data);
1421 }
1422
1423 grn_objcxx . . $ grn_obj# *
1424 grn_plugin_proc_get_varcxx . . $ grn_plugin_proc_get_var(3074f8d72b0d40ab).(grn_ctxcxx . . $ grn_ctx# *ctx,
1425 grn_user_datacxx . . $ grn_user_data# *user_data,
1426 const char *name,
1427 int name_size)
1428 {
1429 name_size = compute_name_sizecxx . . $ compute_name_size(cb7559238bb26814).(name, name_size);
1430 return grn_proc_get_varcxx . . $ grn_proc_get_var(cbbef09cf8135f4b).(ctx, user_data, name, (unsigned int)name_size);
1431 }
1432
1433 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`!
1434 grn_plugin_proc_get_var_boolcxx . . $ grn_plugin_proc_get_var_bool(544c966dc918f81a).(grn_ctxcxx . . $ grn_ctx# *ctx,
1435 grn_user_datacxx . . $ grn_user_data# *user_data,
1436 const char *name,
1437 int name_size,
1438 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! default_value)
1439 {
1440 grn_objcxx . . $ grn_obj# *var;
1441
1442 var = grn_plugin_proc_get_varcxx . . $ grn_plugin_proc_get_var(3074f8d72b0d40ab).(ctx, user_data, name, name_size);
1443 return grn_proc_option_value_boolcxx . . $ grn_proc_option_value_bool(ff9372b2545d27df).(ctx, var, default_value);
1444 }
1445
1446 int32_tcxx . . $ int32_t#
1447 grn_plugin_proc_get_var_int32cxx . . $ grn_plugin_proc_get_var_int32(15a79c06634e1698).(grn_ctxcxx . . $ grn_ctx# *ctx,
1448 grn_user_datacxx . . $ grn_user_data# *user_data,
1449 const char *name,
1450 int name_size,
1451 int32_tcxx . . $ int32_t# default_value)
1452 {
1453 grn_objcxx . . $ grn_obj# *var;
1454
1455 var = grn_plugin_proc_get_varcxx . . $ grn_plugin_proc_get_var(3074f8d72b0d40ab).(ctx, user_data, name, name_size);
1456 return grn_proc_option_value_int32cxx . . $ grn_proc_option_value_int32(c76c8d360eca5cfb).(ctx, var, default_value);
1457 }
1458
1459 double
1460 grn_plugin_proc_get_var_doublecxx . . $ grn_plugin_proc_get_var_double(4687558b569ca04c).(grn_ctxcxx . . $ grn_ctx# *ctx,
1461 grn_user_datacxx . . $ grn_user_data# *user_data,
1462 const char *name,
1463 int name_size,
1464 double default_value)
1465 {
1466 grn_objcxx . . $ grn_obj# *var;
1467
1468 var = grn_plugin_proc_get_varcxx . . $ grn_plugin_proc_get_var(3074f8d72b0d40ab).(ctx, user_data, name, name_size);
1469 return grn_proc_option_value_doublecxx . . $ grn_proc_option_value_double(f44f0e520a9ae05f).(ctx, var, default_value);
1470 }
1471
1472 const char *
1473 grn_plugin_proc_get_var_stringcxx . . $ grn_plugin_proc_get_var_string(b6763965d55cfbc).(grn_ctxcxx . . $ grn_ctx# *ctx,
1474 grn_user_datacxx . . $ grn_user_data# *user_data,
1475 const char *name,
1476 int name_size,
1477 size_t *size)
1478 {
1479 grn_objcxx . . $ grn_obj# *var;
1480
1481 var = grn_plugin_proc_get_varcxx . . $ grn_plugin_proc_get_var(3074f8d72b0d40ab).(ctx, user_data, name, name_size);
1482 return grn_proc_option_value_stringcxx . . $ grn_proc_option_value_string(b7bca21e38c64932).(ctx, var, size);
1483 }
1484
1485 grn_content_typecxx . . $ grn_content_type#
1486 grn_plugin_proc_get_var_content_typecxx . . $ grn_plugin_proc_get_var_content_type(ae804eec47fca811).(grn_ctxcxx . . $ grn_ctx# *ctx,
1487 grn_user_datacxx . . $ grn_user_data# *user_data,
1488 const char *name,
1489 int name_size,
1490 grn_content_typecxx . . $ grn_content_type# default_value)
1491 {
1492 grn_objcxx . . $ grn_obj# *var;
1493
1494 var = grn_plugin_proc_get_varcxx . . $ grn_plugin_proc_get_var(3074f8d72b0d40ab).(ctx, user_data, name, name_size);
1495 return grn_proc_option_value_content_typecxx . . $ grn_proc_option_value_content_type(d9b82c2cea93b286).(ctx, var, default_value);
1496 }
1497
1498 grn_log_levelcxx . . $ grn_log_level#
1499 grn_plugin_proc_get_var_log_levelcxx . . $ grn_plugin_proc_get_var_log_level(474ecd79a1bdcbd4).(grn_ctxcxx . . $ grn_ctx# *ctx,
1500 grn_user_datacxx . . $ grn_user_data# *user_data,
1501 const char *name,
1502 int name_size,
1503 grn_log_levelcxx . . $ grn_log_level# default_value)
1504 {
1505 grn_objcxx . . $ grn_obj# *var;
1506
1507 var = grn_plugin_proc_get_varcxx . . $ grn_plugin_proc_get_var(3074f8d72b0d40ab).(ctx, user_data, name, name_size);
1508 return grn_proc_option_value_log_levelcxx . . $ grn_proc_option_value_log_level(d023da8d3583c911).(ctx, var, default_value);
1509 }
1510
1511 grn_objcxx . . $ grn_obj# *
1512 grn_plugin_proc_get_var_by_offsetcxx . . $ grn_plugin_proc_get_var_by_offset(e898511223acbe78).(grn_ctxcxx . . $ grn_ctx# *ctx,
1513 grn_user_datacxx . . $ grn_user_data# *user_data,
1514 unsigned int offset)
1515 {
1516 return grn_proc_get_var_by_offsetcxx . . $ grn_proc_get_var_by_offset(e898511223acbe78).(ctx, user_data, offset);
1517 }
1518
1519 grn_objcxx . . $ grn_obj# *
1520 grn_plugin_proc_get_callercxx . . $ grn_plugin_proc_get_caller(409051005bdbf179).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_user_datacxx . . $ grn_user_data# *user_data)
1521 {
1522 grn_objcxx . . $ grn_obj# *caller = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
1523 GRN_API_ENTERcxx . . $ `lib/grn_ctx.h:41:9`!;
1524 grn_proc_get_infocxx . . $ grn_proc_get_info(760bc9a52c80d02a).(ctx, user_data, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, &caller);
1525 GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(caller);
1526 }
1527
1528 const char *
1529 grn_plugin_win32_base_dircxx . . $ grn_plugin_win32_base_dir(33a1f659e94feb42).(void)
1530 {
1531 return grn_plugin_windows_base_dircxx . . $ grn_plugin_windows_base_dir(33a1f659e94feb42).();
1532 }
1533
1534 const char *
1535 grn_plugin_windows_base_dircxx . . $ grn_plugin_windows_base_dir(33a1f659e94feb42).(void)
1536 {
1537 #ifdef WIN32
1538 return grn_windows_base_dir();
1539 #else /* WIN32 */
1540 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
1541 #endif /* WIN32 */
1542 }
1543
1544 /*
1545 grn_plugin_charlen() takes the length of a string, unlike grn_charlen_().
1546 */
1547 int
1548 grn_plugin_charlencxx . . $ grn_plugin_charlen(d193efbb4ea6251).(grn_ctxcxx . . $ grn_ctx# *ctx,
1549 const char *str_ptr,
1550 unsigned int str_length,
1551 grn_encodingcxx . . $ grn_encoding# encoding)
1552 {
1553 return grn_charlen_cxx . . $ grn_charlen_(b4b53c9e31f93d3e).(ctx, str_ptr, str_ptr + str_length, encoding);
1554 }
1555
1556 /*
1557 grn_plugin_isspace() takes the length of a string, unlike grn_isspace().
1558 */
1559 int
1560 grn_plugin_isspacecxx . . $ grn_plugin_isspace(d193efbb4ea6251).(grn_ctxcxx . . $ grn_ctx# *ctx,
1561 const char *str_ptr,
1562 unsigned int str_length,
1563 grn_encodingcxx . . $ grn_encoding# encoding)
1564 {
1565 if ((str_ptr == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) || (str_length == 0)) {
1566 return 0;
1567 }
1568 switch ((unsigned char)str_ptr[0]) {
1569 case ' ':
1570 case '\f':
1571 case '\n':
1572 case '\r':
1573 case '\t':
1574 case '\v':
1575 return 1;
1576 case 0x81:
1577 if ((encoding == GRN_ENC_SJIScxx . . $ GRN_ENC_SJIS.) && (str_length >= 2) &&
1578 ((unsigned char)str_ptr[1] == 0x40)) {
1579 return 2;
1580 }
1581 break;
1582 case 0xA1:
1583 if ((encoding == GRN_ENC_EUC_JPcxx . . $ GRN_ENC_EUC_JP.) && (str_length >= 2) &&
1584 ((unsigned char)str_ptr[1] == 0xA1)) {
1585 return 2;
1586 }
1587 break;
1588 case 0xE3:
1589 if ((encoding == GRN_ENC_UTF8cxx . . $ GRN_ENC_UTF8.) && (str_length >= 3) &&
1590 ((unsigned char)str_ptr[1] == 0x80) &&
1591 ((unsigned char)str_ptr[2] == 0x80)) {
1592 return 3;
1593 }
1594 break;
1595 default:
1596 break;
1597 }
1598 return 0;
1599 }
1600
1601 grn_rccxx . . $ grn_rc#
1602 grn_plugin_expr_var_initcxx . . $ grn_plugin_expr_var_init(680ef4125f11597f).(grn_ctxcxx . . $ grn_ctx# *ctx,
1603 grn_expr_varcxx . . $ grn_expr_var# *var,
1604 const char *name,
1605 int name_size)
1606 {
1607 var->namecxx . . $ $anonymous_type_1555d7cc1d218aa4_11#name. = name;
1608 var->name_sizecxx . . $ $anonymous_type_1555d7cc1d218aa4_11#name_size. = (unsigned int)compute_name_sizecxx . . $ compute_name_size(cb7559238bb26814).(name, name_size);
1609 GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&var->value, 0);
1610 return GRN_SUCCESScxx . . $ GRN_SUCCESS.;
1611 }
1612
1613 grn_objcxx . . $ grn_obj# *
1614 grn_plugin_command_createcxx . . $ grn_plugin_command_create(2dfd920bb40f3149).(grn_ctxcxx . . $ grn_ctx# *ctx,
1615 const char *name,
1616 int name_size,
1617 grn_proc_funccxx . . $ grn_proc_func# func,
1618 unsigned int n_vars,
1619 grn_expr_varcxx . . $ grn_expr_var# *vars)
1620 {
1621 grn_objcxx . . $ grn_obj# *proc;
1622 name_size = compute_name_sizecxx . . $ compute_name_size(cb7559238bb26814).(name, name_size);
1623 proc = grn_proc_createcxx . . $ grn_proc_create(195df001e5324f57).(ctx,
1624 name,
1625 name_size,
1626 GRN_PROC_COMMANDcxx . . $ GRN_PROC_COMMAND.,
1627 func,
1628 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!,
1629 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!,
1630 n_vars,
1631 vars);
1632 return proc;
1633 }
1634
1635 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`!
1636 grn_plugin_proc_get_value_boolcxx . . $ grn_plugin_proc_get_value_bool(d6418eb1362f7a09).(grn_ctxcxx . . $ grn_ctx# *ctx,
1637 grn_objcxx . . $ grn_obj# *value,
1638 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! default_value,
1639 const char *tag)
1640 {
1641 return grn_proc_get_value_boolcxx . . $ grn_proc_get_value_bool(d6418eb1362f7a09).(ctx, value, default_value, tag);
1642 }
1643
1644 int32_tcxx . . $ int32_t#
1645 grn_plugin_proc_get_value_int32cxx . . $ grn_plugin_proc_get_value_int32(398b30e9dc37a61b).(grn_ctxcxx . . $ grn_ctx# *ctx,
1646 grn_objcxx . . $ grn_obj# *value,
1647 int32_tcxx . . $ int32_t# default_value_raw,
1648 const char *tag)
1649 {
1650 return grn_proc_get_value_int32cxx . . $ grn_proc_get_value_int32(398b30e9dc37a61b).(ctx, value, default_value_raw, tag);
1651 }
1652
1653 int64_tcxx . . $ int64_t#
1654 grn_plugin_proc_get_value_int64cxx . . $ grn_plugin_proc_get_value_int64(7238b57f8c735d17).(grn_ctxcxx . . $ grn_ctx# *ctx,
1655 grn_objcxx . . $ grn_obj# *value,
1656 int64_tcxx . . $ int64_t# default_value_raw,
1657 const char *tag)
1658 {
1659 return grn_proc_get_value_int64cxx . . $ grn_proc_get_value_int64(7238b57f8c735d17).(ctx, value, default_value_raw, tag);
1660 }
1661
1662 double
1663 grn_plugin_proc_get_value_doublecxx . . $ grn_plugin_proc_get_value_double(29f41cb7e20a0e4c).(grn_ctxcxx . . $ grn_ctx# *ctx,
1664 grn_objcxx . . $ grn_obj# *value,
1665 double default_value_raw,
1666 const char *tag)
1667 {
1668 return grn_proc_get_value_doublecxx . . $ grn_proc_get_value_double(29f41cb7e20a0e4c).(ctx, value, default_value_raw, tag);
1669 }
1670
1671 grn_operatorcxx . . $ grn_operator#
1672 grn_plugin_proc_get_value_modecxx . . $ grn_plugin_proc_get_value_mode(db52f52f4dd070c1).(grn_ctxcxx . . $ grn_ctx# *ctx,
1673 grn_objcxx . . $ grn_obj# *value,
1674 grn_operatorcxx . . $ grn_operator# default_mode,
1675 const char *tag)
1676 {
1677 return grn_proc_get_value_modecxx . . $ grn_proc_get_value_mode(db52f52f4dd070c1).(ctx, value, default_mode, tag);
1678 }
1679
1680 grn_operatorcxx . . $ grn_operator#
1681 grn_plugin_proc_get_value_operatorcxx . . $ grn_plugin_proc_get_value_operator(db52f52f4dd070c1).(grn_ctxcxx . . $ grn_ctx# *ctx,
1682 grn_objcxx . . $ grn_obj# *value,
1683 grn_operatorcxx . . $ grn_operator# default_operator,
1684 const char *tag)
1685 {
1686 return grn_proc_get_value_operatorcxx . . $ grn_proc_get_value_operator(db52f52f4dd070c1).(ctx, value, default_operator, tag);
1687 }