| 1 | /* |
| 2 | Copyright (C) 2009-2016 Brazil |
| 3 | Copyright (C) 2020-2024 Sutou Kouhei <[email protected]> |
| 4 | |
| 5 | This library is free software; you can redistribute it and/or |
| 6 | modify it under the terms of the GNU Lesser General Public |
| 7 | License as published by the Free Software Foundation; either |
| 8 | version 2.1 of the License, or (at your option) any later version. |
| 9 | |
| 10 | This library is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | Lesser General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU Lesser General Public |
| 16 | License along with this library; if not, write to the Free Software |
| 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | */ |
| 19 | |
| 20 | #pragma once |
| 21 | |
| 22 | #include "grn.h"cxx . . $ `<file>/lib/grn.h`/ |
| 23 | #include "grn_error.h"cxx . . $ `<file>/lib/grn_error.h`/ |
| 24 | |
| 25 | #include <errno.h> |
| 26 | |
| 27 | #ifdef HAVE_SIGNAL_Hcxx . . $ `build/config.h:134:9`! |
| 28 | # include <signal.h> |
| 29 | # define GRN_BREAK_POINTcxx . . $ `lib/grn_ctx.h:29:11`! raise(SIGTRAP) |
| 30 | #endif /* HAVE_SIGNAL_H */ |
| 31 | |
| 32 | #include "grn_alloc.h"cxx . . $ `<file>/lib/grn_alloc.h`/ |
| 33 | #include "grn_time.h"cxx . . $ `<file>/lib/grn_time.h`/ |
| 34 | |
| 35 | #ifdef __cpluspluscxx . . $ `<built-in>:470:9`! |
| 36 | extern "C" { |
| 37 | #endif |
| 38 | |
| 39 | /**** api in/out ****/ |
| 40 | |
| 41 | #define GRN_API_ENTERcxx . . $ `lib/grn_ctx.h:41:9`! \ |
| 42 | do { \ |
| 43 | if ((ctx)->seqno & 1) { \ |
| 44 | (ctx)->subno++; \ |
| 45 | } else { \ |
| 46 | (ctx)->errlvl = GRN_OKcxx . . $ `lib/grn_error.h:35:9`!; \ |
| 47 | if ((ctx)->rc != GRN_CANCEL) { \ |
| 48 | (ctx)->rc = GRN_SUCCESS; \ |
| 49 | } \ |
| 50 | (ctx)->seqno++; \ |
| 51 | } \ |
| 52 | GRN_TEST_YIELDcxx . . $ `lib/grn.h:279:13`!(); \ |
| 53 | } while (0) |
| 54 | |
| 55 | /* CAUTION!! : pass only variables or constants as r */ |
| 56 | #define GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(...) \ |
| 57 | do { \ |
| 58 | if (ctx->subno) { \ |
| 59 | ctx->subno--; \ |
| 60 | } else { \ |
| 61 | ctx->seqno++; \ |
| 62 | } \ |
| 63 | GRN_TEST_YIELDcxx . . $ `lib/grn.h:279:13`!(); \ |
| 64 | return __VA_ARGS__; \ |
| 65 | } while (0) |
| 66 | |
| 67 | #ifdef DEBUG |
| 68 | # define GRN_ASSERT(s) grn_assert(ctx, (s), __FILE__, __LINE__, __FUNCTION__) |
| 69 | #else |
| 70 | # define GRN_ASSERTcxx . . $ `lib/grn_ctx.h:70:11`!(s) |
| 71 | #endif |
| 72 | |
| 73 | void |
| 74 | grn_assertcxx . . $ grn_assert(4e81275eb0614788).( |
| 75 | grn_ctxcxx . . $ grn_ctx# *ctx, int cond, const char *file, int line, const char *func); |
| 76 | |
| 77 | /**** grn_ctx ****/ |
| 78 | |
| 79 | GRN_VARcxx . . $ `lib/grn.h:85:13`! grn_ctxcxx . . $ grn_ctx# grn_gctxcxx . . $ grn_gctx.; |
| 80 | extern int grn_pagesizecxx . . $ grn_pagesize.; |
| 81 | extern grn_critical_sectioncxx . . $ grn_critical_section# grn_glockcxx . . $ grn_glock.; |
| 82 | extern uint32_tcxx . . $ uint32_t# grn_gtickcxx . . $ grn_gtick.; |
| 83 | extern int grn_lock_timeoutcxx . . $ grn_lock_timeout.; |
| 84 | |
| 85 | #define GRN_CTX_ALLOCATEDcxx . . $ `lib/grn_ctx.h:85:9`! (0x80) |
| 86 | #define GRN_CTX_TEMPORARY_DISABLE_II_RESOLVE_SEL_ANDcxx . . $ `lib/grn_ctx.h:86:9`! (0x40) |
| 87 | |
| 88 | extern grn_timevalcxx . . $ grn_timeval# grn_starttimecxx . . $ grn_starttime.; |
| 89 | |
| 90 | void |
| 91 | grn_ctx_loader_clearcxx . . $ grn_ctx_loader_clear(b578cd6e53d5fe91).(grn_ctxcxx . . $ grn_ctx# *ctx); |
| 92 | void |
| 93 | grn_log_reopencxx . . $ grn_log_reopen(b578cd6e53d5fe91).(grn_ctxcxx . . $ grn_ctx# *ctx); |
| 94 | |
| 95 | GRN_APIcxx . . $ `lib/grn.h:84:13`! grn_rccxx . . $ grn_rc# |
| 96 | grn_ctx_sendvcxx . . $ grn_ctx_sendv(ed016bc7ceda3be3).(grn_ctxcxx . . $ grn_ctx# *ctx, int argc, char **argv, int flags); |
| 97 | void |
| 98 | grn_ctx_set_keep_commandcxx . . $ grn_ctx_set_keep_command(cda3a5f3c2e53c6b).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *command); |
| 99 | |
| 100 | grn_ctxcxx . . $ grn_ctx# * |
| 101 | grn_ctx_pull_childcxx . . $ grn_ctx_pull_child(9fc1677c2f9058a8).(grn_ctxcxx . . $ grn_ctx# *ctx); |
| 102 | grn_rccxx . . $ grn_rc# |
| 103 | grn_ctx_release_childcxx . . $ grn_ctx_release_child(1231df5ba8090606).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_ctxcxx . . $ grn_ctx# *child_ctx); |
| 104 | |
| 105 | void * |
| 106 | grn_ctx_expr_parser_pullcxx . . $ grn_ctx_expr_parser_pull(7dab3f0baaad5d65).(grn_ctxcxx . . $ grn_ctx# *ctx); |
| 107 | grn_rccxx . . $ grn_rc# |
| 108 | grn_ctx_expr_parser_releasecxx . . $ grn_ctx_expr_parser_release(ac5818a16ab3dde0).(grn_ctxcxx . . $ grn_ctx# *ctx, void *parser); |
| 109 | grn_rccxx . . $ grn_rc# |
| 110 | grn_ctx_expr_parsers_clearcxx . . $ grn_ctx_expr_parsers_clear(2b4fa601bf4f1e5b).(grn_ctxcxx . . $ grn_ctx# *ctx); |
| 111 | |
| 112 | void |
| 113 | grn_ctx_call_progress_callbackcxx . . $ grn_ctx_call_progress_callback(3bad27b95919f16c).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_progresscxx . . $ grn_progress# *progress); |
| 114 | |
| 115 | void |
| 116 | grn_ctx_trace_log_enablecxx . . $ grn_ctx_trace_log_enable(b578cd6e53d5fe91).(grn_ctxcxx . . $ grn_ctx# *ctx); |
| 117 | void |
| 118 | grn_ctx_trace_log_disablecxx . . $ grn_ctx_trace_log_disable(b578cd6e53d5fe91).(grn_ctxcxx . . $ grn_ctx# *ctx); |
| 119 | void |
| 120 | grn_ctx_trace_log_dumpcxx . . $ grn_ctx_trace_log_dump(e1cc6b3f92033d3f).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_ctxcxx . . $ grn_ctx# *dump_ctx, grn_objcxx . . $ grn_obj# *output); |
| 121 | size_tcxx . . $ size_t# |
| 122 | grn_ctx_trace_log_restorecxx . . $ grn_ctx_trace_log_restore(e2e34019f4a887ab).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 123 | const uint8_tcxx . . $ uint8_t# *value, |
| 124 | size_tcxx . . $ size_t# value_size); |
| 125 | uint16_tcxx . . $ uint16_t# |
| 126 | grn_ctx_trace_log_get_current_depthcxx . . $ grn_ctx_trace_log_get_current_depth(f3e056e093dc648d).(grn_ctxcxx . . $ grn_ctx# *ctx); |
| 127 | void |
| 128 | grn_ctx_trace_log_set_current_depthcxx . . $ grn_ctx_trace_log_set_current_depth(a9231b06ff01019b).(grn_ctxcxx . . $ grn_ctx# *ctx, uint16_tcxx . . $ uint16_t# depth); |
| 129 | void |
| 130 | grn_ctx_trace_log_pushcxx . . $ grn_ctx_trace_log_push(b578cd6e53d5fe91).(grn_ctxcxx . . $ grn_ctx# *ctx); |
| 131 | void |
| 132 | grn_ctx_trace_log_popcxx . . $ grn_ctx_trace_log_pop(b578cd6e53d5fe91).(grn_ctxcxx . . $ grn_ctx# *ctx); |
| 133 | void |
| 134 | grn_ctx_trace_log_emit_stringcxx . . $ grn_ctx_trace_log_emit_string(a1ac2b9f7e2991e).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 135 | const char *name, |
| 136 | const char *value, |
| 137 | size_tcxx . . $ size_t# value_length); |
| 138 | void |
| 139 | grn_ctx_trace_log_emit_cstringcxx . . $ grn_ctx_trace_log_emit_cstring(af7f37f5046ba4a0).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 140 | const char *name, |
| 141 | const char *value); |
| 142 | void |
| 143 | grn_ctx_trace_log_emit_uint32cxx . . $ grn_ctx_trace_log_emit_uint32(ae297cf89bde2f1f).(grn_ctxcxx . . $ grn_ctx# *ctx, const char *name, uint32_tcxx . . $ uint32_t# n); |
| 144 | void |
| 145 | grn_ctx_trace_log_emit_record_keycxx . . $ grn_ctx_trace_log_emit_record_key(75d16404fbbe9290).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 146 | const char *name, |
| 147 | grn_objcxx . . $ grn_obj# *table, |
| 148 | grn_idcxx . . $ grn_id# id); |
| 149 | void |
| 150 | grn_ctx_trace_log_emit_objectcxx . . $ grn_ctx_trace_log_emit_object(bff8cce4b2bec01a).(grn_ctxcxx . . $ grn_ctx# *ctx, const char *name, grn_objcxx . . $ grn_obj# *object); |
| 151 | |
| 152 | grn_content_typecxx . . $ grn_content_type# |
| 153 | grn_get_ctypecxx . . $ grn_get_ctype(9fae9b3fdf32cc2f).(grn_objcxx . . $ grn_obj# *var); |
| 154 | grn_content_typecxx . . $ grn_content_type# |
| 155 | grn_content_type_parsecxx . . $ grn_content_type_parse(d9b82c2cea93b286).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 156 | grn_objcxx . . $ grn_obj# *var, |
| 157 | grn_content_typecxx . . $ grn_content_type# default_value); |
| 158 | |
| 159 | /**** db_obj ****/ |
| 160 | |
| 161 | /* flag values used for grn_obj.header.impl_flags */ |
| 162 | |
| 163 | #define GRN_OBJ_ALLOCATEDcxx . . $ `lib/grn_ctx.h:163:9`! (0x01 << 2) /* allocated by ctx */ |
| 164 | #define GRN_OBJ_EXPRVALUEcxx . . $ `lib/grn_ctx.h:164:9`! (0x01 << 3) /* value allocated by grn_expr */ |
| 165 | #define GRN_OBJ_EXPRCONSTcxx . . $ `lib/grn_ctx.h:165:9`! (0x01 << 4) /* constant allocated by grn_expr */ |
| 166 | |
| 167 | typedef struct _grn_hookcxx . . $ _grn_hook# grn_hookcxx . . $ grn_hook#; |
| 168 | |
| 169 | typedef structcxx . . $ $anonymous_type_4a7c1014017e4c5d_0# { |
| 170 | grn_obj_headercxx . . $ grn_obj_header# headercxx . . $ $anonymous_type_4a7c1014017e4c5d_0#header.; |
| 171 | grn_idcxx . . $ grn_id# rangecxx . . $ $anonymous_type_4a7c1014017e4c5d_0#range.; /* table: type of subrecords, column: type of values */ |
| 172 | /* -- compatible with grn_accessor -- */ |
| 173 | grn_idcxx . . $ grn_id# idcxx . . $ $anonymous_type_4a7c1014017e4c5d_0#id.; |
| 174 | grn_objcxx . . $ grn_obj# *dbcxx . . $ $anonymous_type_4a7c1014017e4c5d_0#db.; |
| 175 | grn_user_datacxx . . $ grn_user_data# user_datacxx . . $ $anonymous_type_4a7c1014017e4c5d_0#user_data.; |
| 176 | grn_proc_funccxx . . $ grn_proc_func# *finalizercxx . . $ $anonymous_type_4a7c1014017e4c5d_0#finalizer.; |
| 177 | grn_hookcxx . . $ grn_hook# *hookscxx . . $ $anonymous_type_4a7c1014017e4c5d_0#hooks.[5]; |
| 178 | void *sourcecxx . . $ $anonymous_type_4a7c1014017e4c5d_0#source.; |
| 179 | uint32_tcxx . . $ uint32_t# source_sizecxx . . $ $anonymous_type_4a7c1014017e4c5d_0#source_size.; |
| 180 | uint32_tcxx . . $ uint32_t# max_n_subrecscxx . . $ $anonymous_type_4a7c1014017e4c5d_0#max_n_subrecs.; |
| 181 | uint8_tcxx . . $ uint8_t# subrec_sizecxx . . $ $anonymous_type_4a7c1014017e4c5d_0#subrec_size.; |
| 182 | uint8_tcxx . . $ uint8_t# subrec_offsetcxx . . $ $anonymous_type_4a7c1014017e4c5d_0#subrec_offset.; |
| 183 | uint8_tcxx . . $ uint8_t# record_unitcxx . . $ $anonymous_type_4a7c1014017e4c5d_0#record_unit.; |
| 184 | uint8_tcxx . . $ uint8_t# subrec_unitcxx . . $ $anonymous_type_4a7c1014017e4c5d_0#subrec_unit.; |
| 185 | structcxx . . $ $anonymous_type_4a7c1014017e4c5d_0#$anonymous_type_1# { |
| 186 | grn_table_group_flagscxx . . $ grn_table_group_flags# flagscxx . . $ $anonymous_type_4a7c1014017e4c5d_0#$anonymous_type_1#flags.; |
| 187 | grn_objcxx . . $ grn_obj# *calc_targetcxx . . $ $anonymous_type_4a7c1014017e4c5d_0#$anonymous_type_1#calc_target.; |
| 188 | grn_idcxx . . $ grn_id# aggregated_value_type_idcxx . . $ $anonymous_type_4a7c1014017e4c5d_0#$anonymous_type_1#aggregated_value_type_id.; |
| 189 | grn_table_group_aggregatorcxx . . $ grn_table_group_aggregator# **aggregatorscxx . . $ $anonymous_type_4a7c1014017e4c5d_0#$anonymous_type_1#aggregators.; |
| 190 | uint32_tcxx . . $ uint32_t# n_aggregatorscxx . . $ $anonymous_type_4a7c1014017e4c5d_0#$anonymous_type_1#n_aggregators.; |
| 191 | } groupcxx . . $ $anonymous_type_4a7c1014017e4c5d_0#group.; |
| 192 | uint32_tcxx . . $ uint32_t# reference_countcxx . . $ $anonymous_type_4a7c1014017e4c5d_0#reference_count.; |
| 193 | } grn_db_objcxx . . $ grn_db_obj#; |
| 194 | |
| 195 | #define GRN_DB_OBJ_SET_TYPEcxx . . $ `lib/grn_ctx.h:195:9`!(db_obj, obj_type) \ |
| 196 | do { \ |
| 197 | (db_obj)->obj.header.type = (obj_type); \ |
| 198 | (db_obj)->obj.header.impl_flags = 0; \ |
| 199 | (db_obj)->obj.header.flags = 0; \ |
| 200 | (db_obj)->obj.header.domain = GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!; \ |
| 201 | (db_obj)->obj.id = GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!; \ |
| 202 | (db_obj)->obj.user_data.ptr = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!; \ |
| 203 | (db_obj)->obj.finalizer = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!; \ |
| 204 | (db_obj)->obj.hooks[0] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!; \ |
| 205 | (db_obj)->obj.hooks[1] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!; \ |
| 206 | (db_obj)->obj.hooks[2] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!; \ |
| 207 | (db_obj)->obj.hooks[3] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!; \ |
| 208 | (db_obj)->obj.hooks[4] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!; \ |
| 209 | (db_obj)->obj.source = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!; \ |
| 210 | (db_obj)->obj.source_size = 0; \ |
| 211 | (db_obj)->obj.reference_count = 1; \ |
| 212 | } while (0) |
| 213 | |
| 214 | /**** receive handler ****/ |
| 215 | |
| 216 | GRN_APIcxx . . $ `lib/grn.h:84:13`! void |
| 217 | grn_ctx_stream_out_funccxx . . $ grn_ctx_stream_out_func(e5088b957ff2e019).(grn_ctxcxx . . $ grn_ctx# *c, int flags, void *stream); |
| 218 | |
| 219 | grn_rccxx . . $ grn_rc# |
| 220 | grn_db_init_builtin_procscxx . . $ grn_db_init_builtin_procs(2b4fa601bf4f1e5b).(grn_ctxcxx . . $ grn_ctx# *ctx); |
| 221 | |
| 222 | #ifdef __cpluspluscxx . . $ `<built-in>:470:9`! |
| 223 | } |
| 224 | #endif |