Debian Codegraph @

lib/proc/proc_table.c

raw symbols SCIP
1 /*
2 Copyright (C) 2009-2018 Brazil
3 Copyright (C) 2018-2026 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_proc.h"cxx . . $ `<file>/lib/grn_proc.h`/
21
22 #include "../grn_ctx.h"cxx . . $ `<file>/lib/grn_ctx.h`/
23 #include "../grn_str.h"cxx . . $ `<file>/lib/grn_str.h`/
24 #include "../grn_db.h"cxx . . $ `<file>/lib/grn_db.h`/
25
26 #include <groonga/plugin.h>cxx . . $ `<file>/include/groonga/plugin.h`/
27
28 static grn_table_flagscxx . . $ grn_table_flags#
29 command_table_create_parse_flagscxx . . $ command_table_create_parse_flags(9dba037bef145705).(grn_ctxcxx . . $ grn_ctx# *ctx,
30 const char *nptr,
31 const char *end)
32 {
33 grn_table_flagscxx . . $ grn_table_flags# flags = 0;
34 while (nptr < end) {
35 size_t name_size;
36
37 if (*nptr == '|' || *nptr == ' ') {
38 nptr += 1;
39 continue;
40 }
41
42 #define CHECK_FLAGcxx . . $ `lib/proc/proc_table.c:42:9`!(name) \
43 name_size = strlen(#name); \
44 if ((size_t)(end - nptr) >= name_size && \
45 memcmp(nptr, #name, name_size) == 0) { \
46 flags |= GRN_OBJ_ ## name; \
47 nptr += name_size; \
48 continue; \
49 }
50
51 CHECK_FLAGcxx . . $ `lib/proc/proc_table.c:42:9`!(TABLE_HASH_KEY);
52 CHECK_FLAGcxx . . $ `lib/proc/proc_table.c:42:9`!(TABLE_PAT_KEY);
53 CHECK_FLAGcxx . . $ `lib/proc/proc_table.c:42:9`!(TABLE_DAT_KEY);
54 CHECK_FLAGcxx . . $ `lib/proc/proc_table.c:42:9`!(TABLE_NO_KEY);
55 CHECK_FLAGcxx . . $ `lib/proc/proc_table.c:42:9`!(KEY_NORMALIZE);
56 CHECK_FLAGcxx . . $ `lib/proc/proc_table.c:42:9`!(KEY_WITH_SIS);
57 CHECK_FLAGcxx . . $ `lib/proc/proc_table.c:42:9`!(KEY_LARGE);
58
59 #undef CHECK_FLAGcxx . . $ `lib/proc/proc_table.c:42:9`!
60
61 GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx,
62 GRN_INVALID_ARGUMENT,
63 "[table][create][flags] unknown flag: <%.*s>",
64 (int)(end - nptr), nptr);
65 return 0;
66 }
67 return flags;
68 }
69
70 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`!
71 grn_proc_table_set_token_filterscxx . . $ grn_proc_table_set_token_filters(9ece0a636012bd6a).(grn_ctxcxx . . $ grn_ctx# *ctx,
72 grn_objcxx . . $ grn_obj# *table,
73 grn_raw_stringcxx . . $ grn_raw_string# *token_filters_raw)
74 {
75 grn_objcxx . . $ grn_obj# token_filters;
76
77 if (token_filters_raw->lengthcxx . . $ $anonymous_type_7f733dd816802915_0#length. == 0) {
78 return truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
79 }
80
81 GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&token_filters, GRN_OBJ_DO_SHALLOW_COPYcxx . . $ `include/groonga/groonga.h:2732:9`!);
82 GRN_TEXT_SETcxx . . $ `include/groonga/groonga.h:2761:9`!(ctx,
83 &token_filters,
84 token_filters_raw->value,
85 token_filters_raw->length);
86 grn_obj_set_infocxx . . $ grn_obj_set_info(1c4fe9650683f16e).(ctx, table, GRN_INFO_TOKEN_FILTERScxx . . $ GRN_INFO_TOKEN_FILTERS., &token_filters);
87 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &token_filters);
88
89 return ctx->rccxx . . $ _grn_ctx#rc. == GRN_SUCCESScxx . . $ GRN_SUCCESS.;
90 }
91
92 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`!
93 grn_proc_table_set_extractorscxx . . $ grn_proc_table_set_extractors(9ece0a636012bd6a).(grn_ctxcxx . . $ grn_ctx# *ctx,
94 grn_objcxx . . $ grn_obj# *table,
95 grn_raw_stringcxx . . $ grn_raw_string# *extractors_raw)
96 {
97 if (extractors_raw->lengthcxx . . $ $anonymous_type_7f733dd816802915_0#length. == 0) {
98 return truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
99 }
100
101 grn_objcxx . . $ grn_obj# extractors;
102 GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&extractors, GRN_OBJ_DO_SHALLOW_COPYcxx . . $ `include/groonga/groonga.h:2732:9`!);
103 GRN_TEXT_SETcxx . . $ `include/groonga/groonga.h:2761:9`!(ctx,
104 &extractors,
105 extractors_raw->value,
106 extractors_raw->length);
107 grn_obj_set_infocxx . . $ grn_obj_set_info(1c4fe9650683f16e).(ctx, table, GRN_INFO_EXTRACTORScxx . . $ GRN_INFO_EXTRACTORS., &extractors);
108 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &extractors);
109
110 return ctx->rccxx . . $ _grn_ctx#rc. == GRN_SUCCESScxx . . $ GRN_SUCCESS.;
111 }
112
113 static grn_objcxx . . $ grn_obj# *
114 command_table_createcxx . . $ command_table_create(fd082858389c8bb0).(grn_ctxcxx . . $ grn_ctx# *ctx,
115 int nargs,
116 grn_objcxx . . $ grn_obj# **args,
117 grn_user_datacxx . . $ grn_user_data# *user_data)
118 {
119 grn_raw_stringcxx . . $ grn_raw_string# name_raw;
120 grn_raw_stringcxx . . $ grn_raw_string# flags_raw;
121 grn_raw_stringcxx . . $ grn_raw_string# key_type_raw;
122 grn_raw_stringcxx . . $ grn_raw_string# value_type_raw;
123 grn_objcxx . . $ grn_obj# *default_tokenizer_raw;
124 grn_objcxx . . $ grn_obj# *normalizer_raw;
125 grn_raw_stringcxx . . $ grn_raw_string# token_filters_raw;
126 grn_raw_stringcxx . . $ grn_raw_string# extractors_raw;
127 grn_objcxx . . $ grn_obj# *path_raw;
128 grn_objcxx . . $ grn_obj# *normalizers_raw;
129 grn_objcxx . . $ grn_obj# *key_type = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
130 grn_objcxx . . $ grn_obj# *value_type = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
131 grn_objcxx . . $ grn_obj# *table = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
132 const char *rest;
133 grn_table_flagscxx . . $ grn_table_flags# flags;
134
135 #define GET_VALUEcxx . . $ `lib/proc/proc_table.c:135:9`!(name) \
136 name ## _raw.value = \
137 grn_plugin_proc_get_var_string(ctx, \
138 user_data, \
139 #name, \
140 strlen(#name), \
141 &(name ## _raw.length))
142
143 GET_VALUEcxx . . $ `lib/proc/proc_table.c:135:9`!(name);
144 GET_VALUEcxx . . $ `lib/proc/proc_table.c:135:9`!(flags);
145 GET_VALUEcxx . . $ `lib/proc/proc_table.c:135:9`!(key_type);
146 GET_VALUEcxx . . $ `lib/proc/proc_table.c:135:9`!(value_type);
147 default_tokenizer_raw = grn_plugin_proc_get_varcxx . . $ grn_plugin_proc_get_var(3074f8d72b0d40ab).(ctx, user_data,
148 "default_tokenizer", -1);
149 normalizer_raw = grn_plugin_proc_get_varcxx . . $ grn_plugin_proc_get_var(3074f8d72b0d40ab).(ctx, user_data, "normalizer", -1);
150 GET_VALUEcxx . . $ `lib/proc/proc_table.c:135:9`!(token_filters);
151 GET_VALUEcxx . . $ `lib/proc/proc_table.c:135:9`!(extractors);
152 path_raw = grn_plugin_proc_get_varcxx . . $ grn_plugin_proc_get_var(3074f8d72b0d40ab).(ctx, user_data, "path", -1);
153 normalizers_raw = grn_plugin_proc_get_varcxx . . $ grn_plugin_proc_get_var(3074f8d72b0d40ab).(ctx, user_data, "normalizers", -1);
154
155 #undef GET_VALUEcxx . . $ `lib/proc/proc_table.c:135:9`!
156
157 flags = (grn_table_flagscxx . . $ grn_table_flags#)grn_atoicxx . . $ grn_atoi(adf3ff2c2b114929).(flags_raw.valuecxx . . $ $anonymous_type_7f733dd816802915_0#value.,
158 flags_raw.valuecxx . . $ $anonymous_type_7f733dd816802915_0#value. + flags_raw.lengthcxx . . $ $anonymous_type_7f733dd816802915_0#length.,
159 &rest);
160 if (flags_raw.valuecxx . . $ $anonymous_type_7f733dd816802915_0#value. == rest) {
161 flags = command_table_create_parse_flagscxx . . $ command_table_create_parse_flags(9dba037bef145705).(ctx,
162 flags_raw.valuecxx . . $ $anonymous_type_7f733dd816802915_0#value.,
163 flags_raw.valuecxx . . $ $anonymous_type_7f733dd816802915_0#value. + flags_raw.lengthcxx . . $ $anonymous_type_7f733dd816802915_0#length.);
164 if (ctx->rccxx . . $ _grn_ctx#rc.) { goto exit; }
165 }
166
167 if (name_raw.lengthcxx . . $ $anonymous_type_7f733dd816802915_0#length. == 0) {
168 GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx,
169 GRN_INVALID_ARGUMENT,
170 "[table][create] should not create anonymous table");
171 goto exit;
172 }
173
174 {
175 if (key_type_raw.lengthcxx . . $ $anonymous_type_7f733dd816802915_0#length. > 0) {
176 key_type = grn_ctx_getcxx . . $ grn_ctx_get(70fde0087014f9ea).(ctx,
177 key_type_raw.valuecxx . . $ $anonymous_type_7f733dd816802915_0#value.,
178 (int)(key_type_raw.lengthcxx . . $ $anonymous_type_7f733dd816802915_0#length.));
179 if (!key_type) {
180 GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx,
181 GRN_INVALID_ARGUMENT,
182 "[table][create] "
183 "key type doesn't exist: <%.*s> (%.*s)",
184 (int)name_raw.length,
185 name_raw.value,
186 (int)key_type_raw.length,
187 key_type_raw.value);
188 goto exit;
189 }
190 }
191
192 if (value_type_raw.lengthcxx . . $ $anonymous_type_7f733dd816802915_0#length. > 0) {
193 value_type = grn_ctx_getcxx . . $ grn_ctx_get(70fde0087014f9ea).(ctx,
194 value_type_raw.valuecxx . . $ $anonymous_type_7f733dd816802915_0#value.,
195 (int)(value_type_raw.lengthcxx . . $ $anonymous_type_7f733dd816802915_0#length.));
196 if (!value_type) {
197 GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx,
198 GRN_INVALID_ARGUMENT,
199 "[table][create] "
200 "value type doesn't exist: <%.*s> (%.*s)",
201 (int)name_raw.length,
202 name_raw.value,
203 (int)value_type_raw.length,
204 value_type_raw.value);
205 goto exit;
206 }
207 }
208
209 const char *path = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
210 if (GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(path_raw) > 0) {
211 GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, path_raw, '\0');
212 path = GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(path_raw);
213 }
214 flags |= GRN_OBJ_PERSISTENTcxx . . $ `include/groonga/groonga.h:827:9`!;
215 table = grn_table_createcxx . . $ grn_table_create(51df5019e8d3bdc1).(ctx,
216 name_raw.valuecxx . . $ $anonymous_type_7f733dd816802915_0#value.,
217 (unsigned int)(name_raw.lengthcxx . . $ $anonymous_type_7f733dd816802915_0#length.),
218 path,
219 flags,
220 key_type,
221 value_type);
222 if (!table) {
223 goto exit;
224 }
225
226 if (GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(default_tokenizer_raw) > 0) {
227 grn_obj_set_infocxx . . $ grn_obj_set_info(1c4fe9650683f16e).(ctx, table,
228 GRN_INFO_DEFAULT_TOKENIZERcxx . . $ GRN_INFO_DEFAULT_TOKENIZER.,
229 default_tokenizer_raw);
230 if (ctx->rccxx . . $ _grn_ctx#rc. != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
231 GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx,
232 GRN_INVALID_ARGUMENT,
233 "[table][create][%.*s] "
234 "failed to set default tokenizer: <%.*s>: %s",
235 (int)name_raw.length,
236 name_raw.value,
237 (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(default_tokenizer_raw),
238 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(default_tokenizer_raw),
239 ctx->errbuf);
240 goto exit;
241 }
242 }
243
244 if (GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(normalizers_raw) == 0 &&
245 GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(normalizer_raw) > 0) {
246 normalizers_raw = normalizer_raw;
247 }
248 if (GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(normalizers_raw) > 0) {
249 grn_obj_set_infocxx . . $ grn_obj_set_info(1c4fe9650683f16e).(ctx, table, GRN_INFO_NORMALIZERScxx . . $ GRN_INFO_NORMALIZERS., normalizers_raw);
250 if (ctx->rccxx . . $ _grn_ctx#rc. != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
251 GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx,
252 GRN_INVALID_ARGUMENT,
253 "[table][create][%.*s] "
254 "failed to set normalizers: <%.*s>: %s",
255 (int)name_raw.length,
256 name_raw.value,
257 (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(normalizers_raw),
258 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(normalizers_raw),
259 ctx->errbuf);
260 goto exit;
261 }
262 }
263
264 if (!grn_proc_table_set_token_filterscxx . . $ grn_proc_table_set_token_filters(9ece0a636012bd6a).(ctx, table, &token_filters_raw)) {
265 goto exit;
266 }
267
268 if (!grn_proc_table_set_extractorscxx . . $ grn_proc_table_set_extractors(9ece0a636012bd6a).(ctx, table, &extractors_raw)) {
269 goto exit;
270 }
271 }
272
273 exit :
274 {
275 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! success = (ctx->rccxx . . $ _grn_ctx#rc. == GRN_SUCCESScxx . . $ GRN_SUCCESS.);
276 if (key_type) {
277 grn_obj_unrefcxx . . $ grn_obj_unref(cda3a5f3c2e53c6b).(ctx, key_type);
278 }
279 if (value_type) {
280 grn_obj_unrefcxx . . $ grn_obj_unref(cda3a5f3c2e53c6b).(ctx, value_type);
281 }
282 if (success) {
283 if (table) {
284 grn_obj_unlinkcxx . . $ grn_obj_unlink(4865d068a46d0f83).(ctx, table);
285 }
286 } else {
287 if (table) {
288 grn_obj_removecxx . . $ grn_obj_remove(4865d068a46d0f83).(ctx, table);
289 }
290 }
291 grn_ctx_output_boolcxx . . $ grn_ctx_output_bool(1112b62984b2cd7f).(ctx, success);
292 }
293 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
294 }
295
296 void
297 grn_proc_init_table_createcxx . . $ grn_proc_init_table_create(b578cd6e53d5fe91).(grn_ctxcxx . . $ grn_ctx# *ctx)
298 {
299 grn_expr_varcxx . . $ grn_expr_var# vars[10];
300
301 grn_plugin_expr_var_initcxx . . $ grn_plugin_expr_var_init(680ef4125f11597f).(ctx, &(vars[0]), "name", -1);
302 grn_plugin_expr_var_initcxx . . $ grn_plugin_expr_var_init(680ef4125f11597f).(ctx, &(vars[1]), "flags", -1);
303 grn_plugin_expr_var_initcxx . . $ grn_plugin_expr_var_init(680ef4125f11597f).(ctx, &(vars[2]), "key_type", -1);
304 grn_plugin_expr_var_initcxx . . $ grn_plugin_expr_var_init(680ef4125f11597f).(ctx, &(vars[3]), "value_type", -1);
305 grn_plugin_expr_var_initcxx . . $ grn_plugin_expr_var_init(680ef4125f11597f).(ctx, &(vars[4]), "default_tokenizer", -1);
306 grn_plugin_expr_var_initcxx . . $ grn_plugin_expr_var_init(680ef4125f11597f).(ctx, &(vars[5]), "normalizer", -1);
307 grn_plugin_expr_var_initcxx . . $ grn_plugin_expr_var_init(680ef4125f11597f).(ctx, &(vars[6]), "token_filters", -1);
308 grn_plugin_expr_var_initcxx . . $ grn_plugin_expr_var_init(680ef4125f11597f).(ctx, &(vars[7]), "path", -1);
309 grn_plugin_expr_var_initcxx . . $ grn_plugin_expr_var_init(680ef4125f11597f).(ctx, &(vars[8]), "normalizers", -1);
310 grn_plugin_expr_var_initcxx . . $ grn_plugin_expr_var_init(680ef4125f11597f).(ctx, &(vars[9]), "extractors", -1);
311 grn_plugin_command_createcxx . . $ grn_plugin_command_create(2dfd920bb40f3149).(ctx,
312 "table_create", -1,
313 command_table_createcxx . . $ command_table_create(fd082858389c8bb0).,
314 10,
315 vars);
316 }
317
318 static void
319 output_table_infocxx . . $ output_table_info(cda3a5f3c2e53c6b).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *table)
320 {
321 grn_objcxx . . $ grn_obj# buffer;
322 grn_idcxx . . $ grn_id# id;
323 const char *path;
324 grn_table_flagscxx . . $ grn_table_flags# flags;
325 grn_objcxx . . $ grn_obj# *default_tokenizer;
326 grn_objcxx . . $ grn_obj# *normalizer;
327 grn_objcxx . . $ grn_obj# *token_filters;
328
329 GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&buffer, 0);
330
331 grn_ctx_output_array_opencxx . . $ grn_ctx_output_array_open(f0f392d632556531).(ctx, "TABLE", 8);
332
333 id = grn_obj_idcxx . . $ grn_obj_id(8dd58acc9865e889).(ctx, table);
334 grn_ctx_output_int64cxx . . $ grn_ctx_output_int64(e824ee96bb92de8).(ctx, id);
335 grn_proc_output_object_id_namecxx . . $ grn_proc_output_object_id_name(969b9cdb234920c4).(ctx, id);
336 path = grn_obj_pathcxx . . $ grn_obj_path(ab3dda79dad54815).(ctx, table);
337 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, path);
338
339 grn_table_get_infocxx . . $ grn_table_get_info(a1e4a6d36d3aee7c).(ctx, table,
340 &flags,
341 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!,
342 &default_tokenizer,
343 &normalizer,
344 &token_filters);
345
346 grn_dump_table_create_flagscxx . . $ grn_dump_table_create_flags(e6d1f76f34fc094d).(ctx, flags, &buffer);
347 grn_ctx_output_objcxx . . $ grn_ctx_output_obj(eded88d24d5f23db).(ctx, &buffer, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
348
349 grn_proc_output_object_id_namecxx . . $ grn_proc_output_object_id_name(969b9cdb234920c4).(ctx, table->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain.);
350 grn_proc_output_object_id_namecxx . . $ grn_proc_output_object_id_name(969b9cdb234920c4).(ctx, grn_obj_get_rangecxx . . $ grn_obj_get_range(8dd58acc9865e889).(ctx, table));
351
352 if (default_tokenizer) {
353 GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(&buffer);
354 grn_table_get_default_tokenizer_stringcxx . . $ grn_table_get_default_tokenizer_string(d825b4ed5bf12304).(ctx, table, &buffer);
355 grn_ctx_output_objcxx . . $ grn_ctx_output_obj(eded88d24d5f23db).(ctx, &buffer, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
356 } else {
357 grn_ctx_output_nullcxx . . $ grn_ctx_output_null(b578cd6e53d5fe91).(ctx);
358 }
359
360 if (normalizer) {
361 GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(&buffer);
362 grn_table_get_normalizers_stringcxx . . $ grn_table_get_normalizers_string(d825b4ed5bf12304).(ctx, table, &buffer);
363 grn_ctx_output_objcxx . . $ grn_ctx_output_obj(eded88d24d5f23db).(ctx, &buffer, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
364 } else {
365 grn_ctx_output_nullcxx . . $ grn_ctx_output_null(b578cd6e53d5fe91).(ctx);
366 }
367
368 grn_ctx_output_array_closecxx . . $ grn_ctx_output_array_close(b578cd6e53d5fe91).(ctx);
369
370 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &buffer);
371 }
372
373 static grn_objcxx . . $ grn_obj# *
374 command_table_listcxx . . $ command_table_list(fd082858389c8bb0).(grn_ctxcxx . . $ grn_ctx# *ctx, int nargs, grn_objcxx . . $ grn_obj# **args,
375 grn_user_datacxx . . $ grn_user_data# *user_data)
376 {
377 grn_objcxx . . $ grn_obj# *db;
378 grn_objcxx . . $ grn_obj# tables;
379 int n_elements_for_header = 1;
380
381 db = grn_ctx_dbcxx . . $ grn_ctx_db(ddec8e3b1327ceae).(ctx);
382
383 {
384 grn_table_cursorcxx . . $ grn_table_cursor# *cursor;
385 grn_idcxx . . $ grn_id# id;
386 grn_objcxx . . $ grn_obj# *prefix;
387 const void *min = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
388 unsigned int min_size = 0;
389 int flags = 0;
390
391 prefix = grn_plugin_proc_get_varcxx . . $ grn_plugin_proc_get_var(3074f8d72b0d40ab).(ctx, user_data, "prefix", -1);
392 if (GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(prefix) > 0) {
393 min = GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(prefix);
394 min_size = (unsigned int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(prefix);
395 flags |= GRN_CURSOR_PREFIXcxx . . $ `include/groonga/table.h:281:9`!;
396 }
397 cursor = grn_table_cursor_opencxx . . $ grn_table_cursor_open(a4cddc3087c69e91).(ctx, db,
398 min, min_size,
399 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 0,
400 0, -1, flags);
401 if (!cursor) {
402 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
403 }
404
405 GRN_PTR_INITcxx . . $ `include/groonga/groonga.h:2869:9`!(&tables, GRN_OBJ_VECTORcxx . . $ `include/groonga/groonga.h:2734:9`!, GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!);
406 while ((id = grn_table_cursor_nextcxx . . $ grn_table_cursor_next(8dd58acc9865e889).(ctx, cursor)) != GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!) {
407 grn_objcxx . . $ grn_obj# *object;
408 const char *name;
409 void *key;
410 int i, key_size;
411 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! have_period = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!;
412
413 key_size = grn_table_cursor_get_keycxx . . $ grn_table_cursor_get_key(7d620ebe94cee13a).(ctx, cursor, &key);
414 name = key;
415 for (i = 0; i < key_size; i++) {
416 if (name[i] == '.') {
417 have_period = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
418 break;
419 }
420 }
421 if (have_period) {
422 continue;
423 }
424
425 object = grn_ctx_atcxx . . $ grn_ctx_at(ac4544c8400954c9).(ctx, id);
426 if (object) {
427 if (grn_obj_is_tablecxx . . $ grn_obj_is_table(a5760e5c319a06ee).(ctx, object)) {
428 GRN_PTR_PUTcxx . . $ `include/groonga/groonga.h:3218:9`!(ctx, &tables, object);
429 } else {
430 grn_obj_unlinkcxx . . $ grn_obj_unlink(4865d068a46d0f83).(ctx, object);
431 }
432 } else {
433 if (ctx->rccxx . . $ _grn_ctx#rc. != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
434 ERRCLRcxx . . $ `lib/grn_error.h:37:9`!(ctx);
435 }
436 }
437 }
438 grn_table_cursor_closecxx . . $ grn_table_cursor_close(4865d068a46d0f83).(ctx, cursor);
439 }
440 size_t n_tables = GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(&tables) / sizeof(grn_objcxx . . $ grn_obj# *);
441 int n_top_level_elements = n_elements_for_header + (int)n_tables;
442 grn_ctx_output_array_opencxx . . $ grn_ctx_output_array_open(f0f392d632556531).(ctx, "TABLE_LIST", n_top_level_elements);
443
444 grn_ctx_output_array_opencxx . . $ grn_ctx_output_array_open(f0f392d632556531).(ctx, "HEADER", 8);
445 grn_ctx_output_array_opencxx . . $ grn_ctx_output_array_open(f0f392d632556531).(ctx, "PROPERTY", 2);
446 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "id");
447 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "UInt32");
448 grn_ctx_output_array_closecxx . . $ grn_ctx_output_array_close(b578cd6e53d5fe91).(ctx);
449 grn_ctx_output_array_opencxx . . $ grn_ctx_output_array_open(f0f392d632556531).(ctx, "PROPERTY", 2);
450 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "name");
451 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "ShortText");
452 grn_ctx_output_array_closecxx . . $ grn_ctx_output_array_close(b578cd6e53d5fe91).(ctx);
453 grn_ctx_output_array_opencxx . . $ grn_ctx_output_array_open(f0f392d632556531).(ctx, "PROPERTY", 2);
454 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "path");
455 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "ShortText");
456 grn_ctx_output_array_closecxx . . $ grn_ctx_output_array_close(b578cd6e53d5fe91).(ctx);
457 grn_ctx_output_array_opencxx . . $ grn_ctx_output_array_open(f0f392d632556531).(ctx, "PROPERTY", 2);
458 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "flags");
459 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "ShortText");
460 grn_ctx_output_array_closecxx . . $ grn_ctx_output_array_close(b578cd6e53d5fe91).(ctx);
461 grn_ctx_output_array_opencxx . . $ grn_ctx_output_array_open(f0f392d632556531).(ctx, "PROPERTY", 2);
462 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "domain");
463 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "ShortText");
464 grn_ctx_output_array_closecxx . . $ grn_ctx_output_array_close(b578cd6e53d5fe91).(ctx);
465 grn_ctx_output_array_opencxx . . $ grn_ctx_output_array_open(f0f392d632556531).(ctx, "PROPERTY", 2);
466 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "range");
467 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "ShortText");
468 grn_ctx_output_array_closecxx . . $ grn_ctx_output_array_close(b578cd6e53d5fe91).(ctx);
469 grn_ctx_output_array_opencxx . . $ grn_ctx_output_array_open(f0f392d632556531).(ctx, "PROPERTY", 2);
470 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "default_tokenizer");
471 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "ShortText");
472 grn_ctx_output_array_closecxx . . $ grn_ctx_output_array_close(b578cd6e53d5fe91).(ctx);
473 grn_ctx_output_array_opencxx . . $ grn_ctx_output_array_open(f0f392d632556531).(ctx, "PROPERTY", 2);
474 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "normalizer");
475 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "ShortText");
476 grn_ctx_output_array_closecxx . . $ grn_ctx_output_array_close(b578cd6e53d5fe91).(ctx);
477 grn_ctx_output_array_closecxx . . $ grn_ctx_output_array_close(b578cd6e53d5fe91).(ctx);
478
479 size_t i;
480 for (i = 0; i < n_tables; i++) {
481 grn_objcxx . . $ grn_obj# *table = GRN_PTR_VALUE_ATcxx . . $ `include/groonga/groonga.h:3150:9`!(&tables, i);
482 output_table_infocxx . . $ output_table_info(cda3a5f3c2e53c6b).(ctx, table);
483 grn_obj_unlinkcxx . . $ grn_obj_unlink(4865d068a46d0f83).(ctx, table);
484 }
485 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &tables);
486
487 grn_ctx_output_array_closecxx . . $ grn_ctx_output_array_close(b578cd6e53d5fe91).(ctx);
488
489 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
490 }
491
492 void
493 grn_proc_init_table_listcxx . . $ grn_proc_init_table_list(b578cd6e53d5fe91).(grn_ctxcxx . . $ grn_ctx# *ctx)
494 {
495 grn_expr_varcxx . . $ grn_expr_var# vars[1];
496
497 grn_plugin_expr_var_initcxx . . $ grn_plugin_expr_var_init(680ef4125f11597f).(ctx, &(vars[0]), "prefix", -1);
498 grn_plugin_command_createcxx . . $ grn_plugin_command_create(2dfd920bb40f3149).(ctx,
499 "table_list", -1,
500 command_table_listcxx . . $ command_table_list(fd082858389c8bb0).,
501 1,
502 vars);
503 }
504
505 static grn_objcxx . . $ grn_obj# *
506 command_table_removecxx . . $ command_table_remove(fd082858389c8bb0).(grn_ctxcxx . . $ grn_ctx# *ctx,
507 int nargs,
508 grn_objcxx . . $ grn_obj# **args,
509 grn_user_datacxx . . $ grn_user_data# *user_data)
510 {
511 grn_objcxx . . $ grn_obj# *name;
512 grn_objcxx . . $ grn_obj# *table;
513 uint32_tcxx . . $ uint32_t# flags = 0;
514
515 name = grn_plugin_proc_get_varcxx . . $ grn_plugin_proc_get_var(3074f8d72b0d40ab).(ctx, user_data, "name", -1);
516 if (grn_plugin_proc_get_var_boolcxx . . $ grn_plugin_proc_get_var_bool(544c966dc918f81a).(ctx, user_data, "dependent", -1, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!)) {
517 flags |= GRN_OBJ_REMOVE_DEPENDENTcxx . . $ `include/groonga/groonga.h:1516:9`!;
518 }
519 if (grn_plugin_proc_get_var_boolcxx . . $ grn_plugin_proc_get_var_bool(544c966dc918f81a).(ctx, user_data, "ensure", -1, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!)) {
520 flags |= GRN_OBJ_REMOVE_ENSUREcxx . . $ `include/groonga/groonga.h:1517:9`!;
521 }
522 table = grn_ctx_getcxx . . $ grn_ctx_get(70fde0087014f9ea).(ctx,
523 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(name),
524 (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(name));
525 if (!table) {
526 GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx,
527 GRN_INVALID_ARGUMENT,
528 "[table][remove] table isn't found: <%.*s>",
529 (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(name),
530 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(name));
531 grn_ctx_output_boolcxx . . $ grn_ctx_output_bool(1112b62984b2cd7f).(ctx, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!);
532 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
533 }
534
535 if (!grn_obj_is_tablecxx . . $ grn_obj_is_table(a5760e5c319a06ee).(ctx, table)) {
536 const char *type_name;
537 type_name = grn_obj_type_to_stringcxx . . $ grn_obj_type_to_string(42624c5f3be67010).(table->headercxx . . $ _grn_obj#header..typecxx . . $ _grn_obj_header#type.);
538 grn_obj_unlinkcxx . . $ grn_obj_unlink(4865d068a46d0f83).(ctx, table);
539 GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx,
540 GRN_INVALID_ARGUMENT,
541 "[table][remove] not table: <%.*s>: <%s>",
542 (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(name),
543 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(name),
544 type_name);
545 grn_ctx_output_boolcxx . . $ grn_ctx_output_bool(1112b62984b2cd7f).(ctx, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!);
546 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
547 }
548
549 grn_obj_remove_flagscxx . . $ grn_obj_remove_flags(aedbc3eaefbe393f).(ctx, table, flags);
550 grn_ctx_output_boolcxx . . $ grn_ctx_output_bool(1112b62984b2cd7f).(ctx, ctx->rccxx . . $ _grn_ctx#rc. == GRN_SUCCESScxx . . $ GRN_SUCCESS.);
551 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
552 }
553
554 void
555 grn_proc_init_table_removecxx . . $ grn_proc_init_table_remove(b578cd6e53d5fe91).(grn_ctxcxx . . $ grn_ctx# *ctx)
556 {
557 #define N_VARScxx . . $ `lib/proc/proc_table.c:557:9`! 3
558 grn_expr_varcxx . . $ grn_expr_var# vars[N_VARScxx . . $ `lib/proc/proc_table.c:557:9`!];
559
560 grn_plugin_expr_var_initcxx . . $ grn_plugin_expr_var_init(680ef4125f11597f).(ctx, &(vars[0]), "name", -1);
561 grn_plugin_expr_var_initcxx . . $ grn_plugin_expr_var_init(680ef4125f11597f).(ctx, &(vars[1]), "dependent", -1);
562 grn_plugin_expr_var_initcxx . . $ grn_plugin_expr_var_init(680ef4125f11597f).(ctx, &(vars[2]), "ensure", -1);
563 grn_plugin_command_createcxx . . $ grn_plugin_command_create(2dfd920bb40f3149).(ctx,
564 "table_remove",
565 -1,
566 command_table_removecxx . . $ command_table_remove(fd082858389c8bb0).,
567 N_VARScxx . . $ `lib/proc/proc_table.c:557:9`!,
568 vars);
569 #undef N_VARScxx . . $ `lib/proc/proc_table.c:557:9`!
570 }
571
572 static grn_objcxx . . $ grn_obj# *
573 command_table_renamecxx . . $ command_table_rename(fd082858389c8bb0).(grn_ctxcxx . . $ grn_ctx# *ctx,
574 int nargs,
575 grn_objcxx . . $ grn_obj# **args,
576 grn_user_datacxx . . $ grn_user_data# *user_data)
577 {
578 grn_rccxx . . $ grn_rc# rc = GRN_SUCCESScxx . . $ GRN_SUCCESS.;
579 grn_objcxx . . $ grn_obj# *name;
580 grn_objcxx . . $ grn_obj# *new_name;
581 grn_objcxx . . $ grn_obj# *table = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
582
583 name = grn_plugin_proc_get_varcxx . . $ grn_plugin_proc_get_var(3074f8d72b0d40ab).(ctx, user_data, "name", -1);
584 new_name = grn_plugin_proc_get_varcxx . . $ grn_plugin_proc_get_var(3074f8d72b0d40ab).(ctx, user_data, "new_name", -1);
585 if (GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(name) == 0) {
586 rc = GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.;
587 GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx, rc, "[table][rename] table name isn't specified");
588 goto exit;
589 }
590 table = grn_ctx_getcxx . . $ grn_ctx_get(70fde0087014f9ea).(ctx, GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(name), (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(name));
591 if (!table) {
592 rc = GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.;
593 GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx,
594 rc,
595 "[table][rename] table isn't found: <%.*s>",
596 (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(name),
597 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(name));
598 goto exit;
599 }
600 if (GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(new_name) == 0) {
601 rc = GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.;
602 GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx,
603 rc,
604 "[table][rename] new table name isn't specified: <%.*s>",
605 (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(name),
606 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(name));
607 goto exit;
608 }
609 rc = grn_table_renamecxx . . $ grn_table_rename(6df5a48525cbe78d).(ctx, table,
610 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(new_name),
611 (unsigned int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(new_name));
612 if (rc != GRN_SUCCESScxx . . $ GRN_SUCCESS. && ctx->rccxx . . $ _grn_ctx#rc. == GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
613 GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx,
614 rc,
615 "[table][rename] failed to rename: <%.*s> -> <%.*s>",
616 (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(name),
617 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(name),
618 (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(new_name),
619 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(new_name));
620 }
621 exit :
622 grn_ctx_output_boolcxx . . $ grn_ctx_output_bool(1112b62984b2cd7f).(ctx, !rc);
623 if (table) { grn_obj_unlinkcxx . . $ grn_obj_unlink(4865d068a46d0f83).(ctx, table); }
624 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
625 }
626
627 void
628 grn_proc_init_table_renamecxx . . $ grn_proc_init_table_rename(b578cd6e53d5fe91).(grn_ctxcxx . . $ grn_ctx# *ctx)
629 {
630 grn_expr_varcxx . . $ grn_expr_var# vars[2];
631
632 grn_plugin_expr_var_initcxx . . $ grn_plugin_expr_var_init(680ef4125f11597f).(ctx, &(vars[0]), "name", -1);
633 grn_plugin_expr_var_initcxx . . $ grn_plugin_expr_var_init(680ef4125f11597f).(ctx, &(vars[1]), "new_name", -1);
634 grn_plugin_command_createcxx . . $ grn_plugin_command_create(2dfd920bb40f3149).(ctx,
635 "table_rename", -1,
636 command_table_renamecxx . . $ command_table_rename(fd082858389c8bb0).,
637 2,
638 vars);
639 }
640
641 static grn_objcxx . . $ grn_obj# *
642 command_table_copycxx . . $ command_table_copy(fd082858389c8bb0).(grn_ctxcxx . . $ grn_ctx# *ctx,
643 int nargs,
644 grn_objcxx . . $ grn_obj# **args,
645 grn_user_datacxx . . $ grn_user_data# *user_data)
646 {
647 grn_objcxx . . $ grn_obj# *from_table = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
648 grn_objcxx . . $ grn_obj# *to_table = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
649 grn_objcxx . . $ grn_obj# *from_name;
650 grn_objcxx . . $ grn_obj# *to_name;
651
652 from_name = grn_plugin_proc_get_varcxx . . $ grn_plugin_proc_get_var(3074f8d72b0d40ab).(ctx, user_data, "from_name", -1);
653 to_name = grn_plugin_proc_get_varcxx . . $ grn_plugin_proc_get_var(3074f8d72b0d40ab).(ctx, user_data, "to_name", -1);
654
655 from_table = grn_proc_get_value_objectcxx . . $ grn_proc_get_value_object(2d873f18cf9e4824).(ctx, from_name, "[table][copy][from]");
656 if (!from_table) {
657 goto exit;
658 }
659 to_table = grn_proc_get_value_objectcxx . . $ grn_proc_get_value_object(2d873f18cf9e4824).(ctx, to_name, "[table][copy][to]");
660 if (!to_table) {
661 goto exit;
662 }
663
664 grn_table_copycxx . . $ grn_table_copy(d825b4ed5bf12304).(ctx, from_table, to_table);
665
666 exit :
667 grn_ctx_output_boolcxx . . $ grn_ctx_output_bool(1112b62984b2cd7f).(ctx, ctx->rccxx . . $ _grn_ctx#rc. == GRN_SUCCESScxx . . $ GRN_SUCCESS.);
668
669 if (to_table) {
670 grn_obj_unlinkcxx . . $ grn_obj_unlink(4865d068a46d0f83).(ctx, to_table);
671 }
672 if (from_table) {
673 grn_obj_unlinkcxx . . $ grn_obj_unlink(4865d068a46d0f83).(ctx, from_table);
674 }
675
676 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
677 }
678
679 void
680 grn_proc_init_table_copycxx . . $ grn_proc_init_table_copy(b578cd6e53d5fe91).(grn_ctxcxx . . $ grn_ctx# *ctx)
681 {
682 grn_expr_varcxx . . $ grn_expr_var# vars[2];
683
684 grn_plugin_expr_var_initcxx . . $ grn_plugin_expr_var_init(680ef4125f11597f).(ctx, &(vars[0]), "from_name", -1);
685 grn_plugin_expr_var_initcxx . . $ grn_plugin_expr_var_init(680ef4125f11597f).(ctx, &(vars[1]), "to_name", -1);
686 grn_plugin_command_createcxx . . $ grn_plugin_command_create(2dfd920bb40f3149).(ctx,
687 "table_copy", -1,
688 command_table_copycxx . . $ command_table_copy(fd082858389c8bb0).,
689 2,
690 vars);
691 }
692
693 static grn_objcxx . . $ grn_obj# *
694 command_table_create_similarcxx . . $ command_table_create_similar(fd082858389c8bb0).(grn_ctxcxx . . $ grn_ctx# *ctx,
695 int nargs,
696 grn_objcxx . . $ grn_obj# **args,
697 grn_user_datacxx . . $ grn_user_data# *user_data)
698 {
699 grn_objcxx . . $ grn_obj# *name;
700 grn_objcxx . . $ grn_obj# *base_table_name;
701 grn_objcxx . . $ grn_obj# *base_table = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
702 grn_objcxx . . $ grn_obj# *table = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
703
704 name = grn_plugin_proc_get_varcxx . . $ grn_plugin_proc_get_var(3074f8d72b0d40ab).(ctx, user_data, "name", -1);
705 base_table_name = grn_plugin_proc_get_varcxx . . $ grn_plugin_proc_get_var(3074f8d72b0d40ab).(ctx, user_data, "base_table", -1);
706
707 base_table = grn_proc_get_value_objectcxx . . $ grn_proc_get_value_object(2d873f18cf9e4824).(ctx,
708 base_table_name,
709 "[table][create][similar][base_table]");
710 if (!base_table) {
711 goto exit;
712 }
713
714 table = grn_table_create_similarcxx . . $ grn_table_create_similar(758cf6744a7c1101).(ctx,
715 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(name),
716 (uint32_tcxx . . $ uint32_t#)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(name),
717 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!,
718 base_table);
719
720 exit :
721 grn_ctx_output_boolcxx . . $ grn_ctx_output_bool(1112b62984b2cd7f).(ctx, ctx->rccxx . . $ _grn_ctx#rc. == GRN_SUCCESScxx . . $ GRN_SUCCESS.);
722
723 if (base_table) {
724 grn_obj_unrefcxx . . $ grn_obj_unref(cda3a5f3c2e53c6b).(ctx, base_table);
725 }
726 if (table) {
727 grn_obj_unrefcxx . . $ grn_obj_unref(cda3a5f3c2e53c6b).(ctx, table);
728 }
729
730 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
731 }
732
733 void
734 grn_proc_init_table_create_similarcxx . . $ grn_proc_init_table_create_similar(b578cd6e53d5fe91).(grn_ctxcxx . . $ grn_ctx# *ctx)
735 {
736 grn_expr_varcxx . . $ grn_expr_var# vars[2];
737
738 grn_plugin_expr_var_initcxx . . $ grn_plugin_expr_var_init(680ef4125f11597f).(ctx, &(vars[0]), "name", -1);
739 grn_plugin_expr_var_initcxx . . $ grn_plugin_expr_var_init(680ef4125f11597f).(ctx, &(vars[1]), "base_table", -1);
740 grn_plugin_command_createcxx . . $ grn_plugin_command_create(2dfd920bb40f3149).(ctx,
741 "table_create_similar", -1,
742 command_table_create_similarcxx . . $ command_table_create_similar(fd082858389c8bb0).,
743 2,
744 vars);
745 }