| 1 | /* |
| 2 | Copyright (C) 2015-2018 Brazil |
| 3 | Copyright (C) 2022-2023 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 | #ifdef GRN_EMBEDDED |
| 21 | # define GRN_PLUGIN_FUNCTION_TAG functions_vector |
| 22 | #endif |
| 23 | |
| 24 | #include <groonga/plugin.h>cxx . . $ `<file>/include/groonga/plugin.h`/ |
| 25 | |
| 26 | static grn_objcxx . . $ grn_obj# * |
| 27 | func_vector_sizecxx . . $ func_vector_size(fd082858389c8bb0).(grn_ctxcxx . . $ grn_ctx# *ctx, int n_args, grn_objcxx . . $ grn_obj# **args, |
| 28 | grn_user_datacxx . . $ grn_user_data# *user_data) |
| 29 | { |
| 30 | grn_objcxx . . $ grn_obj# *target; |
| 31 | unsigned int size; |
| 32 | grn_objcxx . . $ grn_obj# *grn_size; |
| 33 | |
| 34 | if (n_args != 1) { |
| 35 | GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx, GRN_INVALID_ARGUMENT, |
| 36 | "vector_size(): wrong number of arguments (%d for 1)", |
| 37 | n_args); |
| 38 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 39 | } |
| 40 | |
| 41 | target = args[0]; |
| 42 | switch (target->headercxx . . $ _grn_obj#header..typecxx . . $ _grn_obj_header#type.) { |
| 43 | case GRN_VECTORcxx . . $ `include/groonga/groonga.h:877:9`! : |
| 44 | case GRN_PVECTORcxx . . $ `include/groonga/groonga.h:876:9`! : |
| 45 | case GRN_UVECTORcxx . . $ `include/groonga/groonga.h:875:9`! : |
| 46 | size = grn_vector_sizecxx . . $ grn_vector_size(8dd58acc9865e889).(ctx, target); |
| 47 | break; |
| 48 | default : |
| 49 | { |
| 50 | grn_objcxx . . $ grn_obj# inspected; |
| 51 | |
| 52 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&inspected, 0); |
| 53 | grn_inspectcxx . . $ grn_inspect(88456f97fe0d41a).(ctx, target, &inspected); |
| 54 | GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx, GRN_INVALID_ARGUMENT, |
| 55 | "vector_size(): target object must be vector: <%.*s>", |
| 56 | (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&inspected), |
| 57 | GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&inspected)); |
| 58 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &inspected); |
| 59 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 60 | } |
| 61 | break; |
| 62 | } |
| 63 | |
| 64 | grn_size = grn_plugin_proc_alloccxx . . $ grn_plugin_proc_alloc(acb267eca6702fc).(ctx, user_data, GRN_DB_UINT32cxx . . $ GRN_DB_UINT32., 0); |
| 65 | if (!grn_size) { |
| 66 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 67 | } |
| 68 | |
| 69 | GRN_UINT32_SETcxx . . $ `include/groonga/groonga.h:2909:9`!(ctx, grn_size, size); |
| 70 | |
| 71 | return grn_size; |
| 72 | } |
| 73 | |
| 74 | static grn_objcxx . . $ grn_obj# * |
| 75 | func_vector_slicecxx . . $ func_vector_slice(fd082858389c8bb0).(grn_ctxcxx . . $ grn_ctx# *ctx, int n_args, grn_objcxx . . $ grn_obj# **args, |
| 76 | grn_user_datacxx . . $ grn_user_data# *user_data) |
| 77 | { |
| 78 | grn_objcxx . . $ grn_obj# *target; |
| 79 | grn_objcxx . . $ grn_obj# *from_raw = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 80 | grn_objcxx . . $ grn_obj# *length_raw = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 81 | int32_tcxx . . $ int32_t# from = 0; |
| 82 | int32_tcxx . . $ int32_t# length = -1; |
| 83 | int32_tcxx . . $ int32_t# to = 0; |
| 84 | int32_tcxx . . $ int32_t# size = 0; |
| 85 | grn_objcxx . . $ grn_obj# *slice; |
| 86 | |
| 87 | if (n_args < 2 || n_args > 3) { |
| 88 | GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx, GRN_INVALID_ARGUMENT, |
| 89 | "vector_slice(): wrong number of arguments (%d for 2..3)", |
| 90 | n_args); |
| 91 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 92 | } |
| 93 | |
| 94 | target = args[0]; |
| 95 | from_raw = args[1]; |
| 96 | if (n_args == 3) { |
| 97 | length_raw = args[2]; |
| 98 | } |
| 99 | switch (target->headercxx . . $ _grn_obj#header..typecxx . . $ _grn_obj_header#type.) { |
| 100 | case GRN_VECTORcxx . . $ `include/groonga/groonga.h:877:9`! : |
| 101 | case GRN_PVECTORcxx . . $ `include/groonga/groonga.h:876:9`! : |
| 102 | case GRN_UVECTORcxx . . $ `include/groonga/groonga.h:875:9`! : |
| 103 | size = (int32_tcxx . . $ int32_t#)grn_vector_sizecxx . . $ grn_vector_size(8dd58acc9865e889).(ctx, target); |
| 104 | break; |
| 105 | default : |
| 106 | { |
| 107 | grn_objcxx . . $ grn_obj# inspected; |
| 108 | |
| 109 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&inspected, 0); |
| 110 | grn_inspectcxx . . $ grn_inspect(88456f97fe0d41a).(ctx, target, &inspected); |
| 111 | GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx, GRN_INVALID_ARGUMENT, |
| 112 | "vector_slice(): target object must be vector: <%.*s>", |
| 113 | (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&inspected), |
| 114 | GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&inspected)); |
| 115 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &inspected); |
| 116 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 117 | } |
| 118 | break; |
| 119 | } |
| 120 | |
| 121 | if (!grn_type_id_is_number_familycxx . . $ grn_type_id_is_number_family(a2a496425acc5b40).(ctx, from_raw->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain.)) { |
| 122 | grn_objcxx . . $ grn_obj# inspected; |
| 123 | |
| 124 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&inspected, 0); |
| 125 | grn_inspectcxx . . $ grn_inspect(88456f97fe0d41a).(ctx, &inspected, from_raw); |
| 126 | GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx, GRN_INVALID_ARGUMENT, |
| 127 | "vector_slice(): from must be a number: <%.*s>", |
| 128 | (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&inspected), |
| 129 | GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&inspected)); |
| 130 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &inspected); |
| 131 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 132 | } |
| 133 | if (from_raw->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain. == GRN_DB_INT32cxx . . $ GRN_DB_INT32.) { |
| 134 | from = GRN_INT32_VALUEcxx . . $ `include/groonga/groonga.h:3102:9`!(from_raw); |
| 135 | } else if (from_raw->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain. == GRN_DB_INT64cxx . . $ GRN_DB_INT64.) { |
| 136 | from = (int32_tcxx . . $ int32_t#)GRN_INT64_VALUEcxx . . $ `include/groonga/groonga.h:3104:9`!(from_raw); |
| 137 | } else { |
| 138 | grn_objcxx . . $ grn_obj# buffer; |
| 139 | grn_rccxx . . $ grn_rc# rc; |
| 140 | |
| 141 | GRN_INT32_INITcxx . . $ `include/groonga/groonga.h:2852:9`!(&buffer, 0); |
| 142 | rc = grn_obj_castcxx . . $ grn_obj_cast(a6fd93da1614eccd).(ctx, from_raw, &buffer, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!); |
| 143 | if (rc == GRN_SUCCESScxx . . $ GRN_SUCCESS.) { |
| 144 | from = GRN_INT32_VALUEcxx . . $ `include/groonga/groonga.h:3102:9`!(&buffer); |
| 145 | } |
| 146 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &buffer); |
| 147 | |
| 148 | if (rc != GRN_SUCCESScxx . . $ GRN_SUCCESS.) { |
| 149 | grn_objcxx . . $ grn_obj# inspected; |
| 150 | |
| 151 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&inspected, 0); |
| 152 | grn_inspectcxx . . $ grn_inspect(88456f97fe0d41a).(ctx, &inspected, from_raw); |
| 153 | GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx, rc, |
| 154 | "vector_slice(): " |
| 155 | "failed to cast from value to number: <%.*s>", |
| 156 | (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&inspected), |
| 157 | GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&inspected)); |
| 158 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &inspected); |
| 159 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 160 | } |
| 161 | } |
| 162 | |
| 163 | if (length_raw) { |
| 164 | if (!grn_type_id_is_number_familycxx . . $ grn_type_id_is_number_family(a2a496425acc5b40).(ctx, length_raw->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain.)) { |
| 165 | grn_objcxx . . $ grn_obj# inspected; |
| 166 | |
| 167 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&inspected, 0); |
| 168 | grn_inspectcxx . . $ grn_inspect(88456f97fe0d41a).(ctx, &inspected, length_raw); |
| 169 | GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx, GRN_INVALID_ARGUMENT, |
| 170 | "vector_slice(): length must be a number: <%.*s>", |
| 171 | (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&inspected), |
| 172 | GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&inspected)); |
| 173 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &inspected); |
| 174 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 175 | } |
| 176 | if (length_raw->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain. == GRN_DB_INT32cxx . . $ GRN_DB_INT32.) { |
| 177 | length = GRN_INT32_VALUEcxx . . $ `include/groonga/groonga.h:3102:9`!(length_raw); |
| 178 | } else if (length_raw->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain. == GRN_DB_INT64cxx . . $ GRN_DB_INT64.) { |
| 179 | length = (int32_tcxx . . $ int32_t#)GRN_INT64_VALUEcxx . . $ `include/groonga/groonga.h:3104:9`!(length_raw); |
| 180 | } else { |
| 181 | grn_objcxx . . $ grn_obj# buffer; |
| 182 | grn_rccxx . . $ grn_rc# rc; |
| 183 | |
| 184 | GRN_INT32_INITcxx . . $ `include/groonga/groonga.h:2852:9`!(&buffer, 0); |
| 185 | rc = grn_obj_castcxx . . $ grn_obj_cast(a6fd93da1614eccd).(ctx, length_raw, &buffer, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!); |
| 186 | if (rc == GRN_SUCCESScxx . . $ GRN_SUCCESS.) { |
| 187 | length = GRN_INT32_VALUEcxx . . $ `include/groonga/groonga.h:3102:9`!(&buffer); |
| 188 | } |
| 189 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &buffer); |
| 190 | |
| 191 | if (rc != GRN_SUCCESScxx . . $ GRN_SUCCESS.) { |
| 192 | grn_objcxx . . $ grn_obj# inspected; |
| 193 | |
| 194 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&inspected, 0); |
| 195 | grn_inspectcxx . . $ grn_inspect(88456f97fe0d41a).(ctx, &inspected, length_raw); |
| 196 | GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx, rc, |
| 197 | "vector_slice(): " |
| 198 | "failed to cast length value to number: <%.*s>", |
| 199 | (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&inspected), |
| 200 | GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&inspected)); |
| 201 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &inspected); |
| 202 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 203 | } |
| 204 | } |
| 205 | } |
| 206 | |
| 207 | slice = grn_plugin_proc_alloccxx . . $ grn_plugin_proc_alloc(acb267eca6702fc).(ctx, user_data, target->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain., GRN_OBJ_VECTORcxx . . $ `include/groonga/groonga.h:2734:9`!); |
| 208 | if (!slice) { |
| 209 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 210 | } |
| 211 | |
| 212 | if (target->headercxx . . $ _grn_obj#header..flagscxx . . $ _grn_obj_header#flags. & GRN_OBJ_WITH_WEIGHTcxx . . $ `include/groonga/groonga.h:785:9`!) { |
| 213 | slice->headercxx . . $ _grn_obj#header..flagscxx . . $ _grn_obj_header#flags. |= GRN_OBJ_WITH_WEIGHTcxx . . $ `include/groonga/groonga.h:785:9`!; |
| 214 | if (target->headercxx . . $ _grn_obj#header..flagscxx . . $ _grn_obj_header#flags. & GRN_OBJ_WEIGHT_BFLOAT16cxx . . $ `include/groonga/groonga.h:796:9`!) { |
| 215 | slice->headercxx . . $ _grn_obj#header..flagscxx . . $ _grn_obj_header#flags. |= GRN_OBJ_WEIGHT_BFLOAT16cxx . . $ `include/groonga/groonga.h:796:9`!; |
| 216 | } |
| 217 | } |
| 218 | |
| 219 | if (length < 0) { |
| 220 | length = size + length + 1; |
| 221 | } |
| 222 | |
| 223 | if (length > size) { |
| 224 | length = size; |
| 225 | } |
| 226 | |
| 227 | if (length <= 0) { |
| 228 | return slice; |
| 229 | } |
| 230 | |
| 231 | while (from < 0) { |
| 232 | from += size; |
| 233 | } |
| 234 | |
| 235 | to = from + length; |
| 236 | if (to > size) { |
| 237 | to = size; |
| 238 | } |
| 239 | |
| 240 | switch (target->headercxx . . $ _grn_obj#header..typecxx . . $ _grn_obj_header#type.) { |
| 241 | case GRN_VECTORcxx . . $ `include/groonga/groonga.h:877:9`! : |
| 242 | { |
| 243 | int32_tcxx . . $ int32_t# i; |
| 244 | for (i = from; i < to; i++) { |
| 245 | const char *content; |
| 246 | unsigned int content_length; |
| 247 | float weight; |
| 248 | grn_idcxx . . $ grn_id# domain; |
| 249 | content_length = grn_vector_get_element_floatcxx . . $ grn_vector_get_element_float(1a20d0a474ae13cb).(ctx, target, (uint32_tcxx . . $ uint32_t#)i, |
| 250 | &content, &weight, &domain); |
| 251 | grn_vector_add_element_floatcxx . . $ grn_vector_add_element_float(d14ed80b83bcdc3d).(ctx, slice, |
| 252 | content, content_length, weight, domain); |
| 253 | } |
| 254 | } |
| 255 | break; |
| 256 | case GRN_PVECTORcxx . . $ `include/groonga/groonga.h:876:9`! : |
| 257 | { |
| 258 | int32_tcxx . . $ int32_t# i; |
| 259 | for (i = from; i < to; i++) { |
| 260 | grn_objcxx . . $ grn_obj# *element = GRN_PTR_VALUE_ATcxx . . $ `include/groonga/groonga.h:3150:9`!(target, i); |
| 261 | GRN_PTR_PUTcxx . . $ `include/groonga/groonga.h:3218:9`!(ctx, slice, element); |
| 262 | } |
| 263 | } |
| 264 | break; |
| 265 | case GRN_UVECTORcxx . . $ `include/groonga/groonga.h:875:9`! : |
| 266 | { |
| 267 | grn_objcxx . . $ grn_obj# *domain; |
| 268 | |
| 269 | domain = grn_ctx_atcxx . . $ grn_ctx_at(ac4544c8400954c9).(ctx, target->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain.); |
| 270 | if (grn_obj_is_tablecxx . . $ grn_obj_is_table(a5760e5c319a06ee).(ctx, domain)) { |
| 271 | int32_tcxx . . $ int32_t# i; |
| 272 | for (i = from; i < to; i++) { |
| 273 | grn_idcxx . . $ grn_id# id; |
| 274 | float weight; |
| 275 | id = grn_uvector_get_element_recordcxx . . $ grn_uvector_get_element_record(c5aebe30586be12f).(ctx, target, (uint32_tcxx . . $ uint32_t#)i, &weight); |
| 276 | grn_uvector_add_element_recordcxx . . $ grn_uvector_add_element_record(bb4e215c5fe2bb23).(ctx, slice, id, weight); |
| 277 | } |
| 278 | } else { |
| 279 | #define PUT_SLICE_VALUEScxx . . $ `plugins/functions/vector.c:279:9`!(type) do { \ |
| 280 | int32_t i; \ |
| 281 | for (i = from; i < to; i++) { \ |
| 282 | GRN_ ## type ## _PUT(ctx, \ |
| 283 | slice, \ |
| 284 | GRN_ ## type ## _VALUE_AT(target, i)); \ |
| 285 | } \ |
| 286 | } while (falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!) |
| 287 | switch (target->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain.) { |
| 288 | case GRN_DB_BOOLcxx . . $ GRN_DB_BOOL. : |
| 289 | PUT_SLICE_VALUEScxx . . $ `plugins/functions/vector.c:279:9`!(BOOL); |
| 290 | break; |
| 291 | case GRN_DB_INT8cxx . . $ GRN_DB_INT8. : |
| 292 | PUT_SLICE_VALUEScxx . . $ `plugins/functions/vector.c:279:9`!(INT8); |
| 293 | break; |
| 294 | case GRN_DB_UINT8cxx . . $ GRN_DB_UINT8. : |
| 295 | PUT_SLICE_VALUEScxx . . $ `plugins/functions/vector.c:279:9`!(UINT8); |
| 296 | break; |
| 297 | case GRN_DB_INT16cxx . . $ GRN_DB_INT16. : |
| 298 | PUT_SLICE_VALUEScxx . . $ `plugins/functions/vector.c:279:9`!(INT16); |
| 299 | break; |
| 300 | case GRN_DB_UINT16cxx . . $ GRN_DB_UINT16. : |
| 301 | PUT_SLICE_VALUEScxx . . $ `plugins/functions/vector.c:279:9`!(UINT16); |
| 302 | break; |
| 303 | case GRN_DB_INT32cxx . . $ GRN_DB_INT32. : |
| 304 | PUT_SLICE_VALUEScxx . . $ `plugins/functions/vector.c:279:9`!(INT32); |
| 305 | break; |
| 306 | case GRN_DB_UINT32cxx . . $ GRN_DB_UINT32. : |
| 307 | PUT_SLICE_VALUEScxx . . $ `plugins/functions/vector.c:279:9`!(UINT32); |
| 308 | break; |
| 309 | case GRN_DB_INT64cxx . . $ GRN_DB_INT64. : |
| 310 | PUT_SLICE_VALUEScxx . . $ `plugins/functions/vector.c:279:9`!(INT64); |
| 311 | break; |
| 312 | case GRN_DB_UINT64cxx . . $ GRN_DB_UINT64. : |
| 313 | PUT_SLICE_VALUEScxx . . $ `plugins/functions/vector.c:279:9`!(UINT64); |
| 314 | break; |
| 315 | case GRN_DB_FLOATcxx . . $ GRN_DB_FLOAT. : |
| 316 | PUT_SLICE_VALUEScxx . . $ `plugins/functions/vector.c:279:9`!(FLOAT); |
| 317 | break; |
| 318 | case GRN_DB_FLOAT32cxx . . $ GRN_DB_FLOAT32. : |
| 319 | PUT_SLICE_VALUEScxx . . $ `plugins/functions/vector.c:279:9`!(FLOAT32); |
| 320 | break; |
| 321 | case GRN_DB_TIMEcxx . . $ GRN_DB_TIME. : |
| 322 | PUT_SLICE_VALUEScxx . . $ `plugins/functions/vector.c:279:9`!(TIME); |
| 323 | break; |
| 324 | } |
| 325 | } |
| 326 | } |
| 327 | break; |
| 328 | #undef PUT_SLICE_VALUEScxx . . $ `plugins/functions/vector.c:279:9`! |
| 329 | } |
| 330 | |
| 331 | return slice; |
| 332 | } |
| 333 | |
| 334 | static grn_objcxx . . $ grn_obj# * |
| 335 | func_vector_newcxx . . $ func_vector_new(fd082858389c8bb0).(grn_ctxcxx . . $ grn_ctx# *ctx, int n_args, grn_objcxx . . $ grn_obj# **args, |
| 336 | grn_user_datacxx . . $ grn_user_data# *user_data) |
| 337 | { |
| 338 | grn_objcxx . . $ grn_obj# *vector = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 339 | int i; |
| 340 | |
| 341 | if (n_args == 0) { |
| 342 | return grn_plugin_proc_alloccxx . . $ grn_plugin_proc_alloc(acb267eca6702fc).(ctx, user_data, GRN_DB_UINT32cxx . . $ GRN_DB_UINT32., GRN_OBJ_VECTORcxx . . $ `include/groonga/groonga.h:2734:9`!); |
| 343 | } |
| 344 | |
| 345 | vector = grn_plugin_proc_alloccxx . . $ grn_plugin_proc_alloc(acb267eca6702fc).(ctx, |
| 346 | user_data, |
| 347 | args[0]->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain., |
| 348 | GRN_OBJ_VECTORcxx . . $ `include/groonga/groonga.h:2734:9`!); |
| 349 | if (!vector) { |
| 350 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 351 | } |
| 352 | |
| 353 | for (i = 0; i < n_args; i++) { |
| 354 | grn_objcxx . . $ grn_obj# *element = args[i]; |
| 355 | switch (vector->headercxx . . $ _grn_obj#header..typecxx . . $ _grn_obj_header#type.) { |
| 356 | case GRN_VECTORcxx . . $ `include/groonga/groonga.h:877:9`! : |
| 357 | grn_vector_add_elementcxx . . $ grn_vector_add_element(d170aee3d3986928).(ctx, |
| 358 | vector, |
| 359 | GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(element), |
| 360 | (uint32_tcxx . . $ uint32_t#)GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(element), |
| 361 | 0, |
| 362 | element->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain.); |
| 363 | break; |
| 364 | case GRN_UVECTORcxx . . $ `include/groonga/groonga.h:875:9`! : |
| 365 | grn_bulk_writecxx . . $ grn_bulk_write(4609c18fd87cf054).(ctx, |
| 366 | vector, |
| 367 | GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(element), |
| 368 | GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(element)); |
| 369 | break; |
| 370 | case GRN_PVECTORcxx . . $ `include/groonga/groonga.h:876:9`! : |
| 371 | GRN_PTR_PUTcxx . . $ `include/groonga/groonga.h:3218:9`!(ctx, vector, element); |
| 372 | break; |
| 373 | default : |
| 374 | break; |
| 375 | } |
| 376 | } |
| 377 | |
| 378 | return vector; |
| 379 | } |
| 380 | |
| 381 | static grn_objcxx . . $ grn_obj# * |
| 382 | func_vector_find_vectorcxx . . $ func_vector_find_vector(251fca57498125c3).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 383 | grn_objcxx . . $ grn_obj# *target, |
| 384 | grn_objcxx . . $ grn_obj# *query, |
| 385 | grn_operatorcxx . . $ grn_operator# mode, |
| 386 | grn_user_datacxx . . $ grn_user_data# *user_data) |
| 387 | { |
| 388 | grn_objcxx . . $ grn_obj# *found_element = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 389 | grn_operator_exec_funccxx . . $ grn_operator_exec_func# *exec; |
| 390 | grn_objcxx . . $ grn_obj# element; |
| 391 | unsigned int i; |
| 392 | unsigned int n_elements = 0; |
| 393 | |
| 394 | exec = grn_operator_to_exec_funccxx . . $ grn_operator_to_exec_func(f63e3fac1c366159).(mode); |
| 395 | if (!exec) { |
| 396 | GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx, GRN_INVALID_ARGUMENT, |
| 397 | "vector_find(): unsupported mode: <%s>", |
| 398 | grn_operator_to_string(mode)); |
| 399 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 400 | } |
| 401 | GRN_VOID_INITcxx . . $ `include/groonga/groonga.h:2749:9`!(&element); |
| 402 | n_elements = grn_vector_sizecxx . . $ grn_vector_size(8dd58acc9865e889).(ctx, target); |
| 403 | for (i = 0; i < n_elements; i++) { |
| 404 | const char *content; |
| 405 | unsigned int content_size; |
| 406 | grn_idcxx . . $ grn_id# domain; |
| 407 | |
| 408 | content_size = grn_vector_get_elementcxx . . $ grn_vector_get_element(744613554bd9830c).(ctx, |
| 409 | target, |
| 410 | i, |
| 411 | &content, |
| 412 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, |
| 413 | &domain); |
| 414 | grn_obj_reinitcxx . . $ grn_obj_reinit(fc9ea836325dd1d2).(ctx, &element, domain, 0); |
| 415 | grn_bulk_writecxx . . $ grn_bulk_write(4609c18fd87cf054).(ctx, &element, content, content_size); |
| 416 | if (exec(ctx, &element, query)) { |
| 417 | found_element = grn_plugin_proc_alloccxx . . $ grn_plugin_proc_alloc(acb267eca6702fc).(ctx, user_data, domain, 0); |
| 418 | grn_bulk_writecxx . . $ grn_bulk_write(4609c18fd87cf054).(ctx, found_element, content, content_size); |
| 419 | break; |
| 420 | } |
| 421 | } |
| 422 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &element); |
| 423 | |
| 424 | return found_element; |
| 425 | } |
| 426 | |
| 427 | static grn_objcxx . . $ grn_obj# * |
| 428 | func_vector_find_uvector_numbercxx . . $ func_vector_find_uvector_number(251fca57498125c3).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 429 | grn_objcxx . . $ grn_obj# *target, |
| 430 | grn_objcxx . . $ grn_obj# *query, |
| 431 | grn_operatorcxx . . $ grn_operator# mode, |
| 432 | grn_user_datacxx . . $ grn_user_data# *user_data) |
| 433 | { |
| 434 | grn_objcxx . . $ grn_obj# *found_element = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 435 | grn_objcxx . . $ grn_obj# query_number_raw; |
| 436 | grn_objcxx . . $ grn_obj# *query_number = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 437 | size_tcxx . . $ size_t# i, n_elements; |
| 438 | unsigned int element_size; |
| 439 | |
| 440 | if (query->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain. == target->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain.) { |
| 441 | query_number = query; |
| 442 | } else { |
| 443 | GRN_VALUE_FIX_SIZE_INITcxx . . $ `include/groonga/groonga.h:2738:9`!(&query_number_raw, 0, target->header.domain); |
| 444 | if (grn_obj_castcxx . . $ grn_obj_cast(a6fd93da1614eccd).(ctx, query, &query_number_raw, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!) != GRN_SUCCESScxx . . $ GRN_SUCCESS.) { |
| 445 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &query_number_raw); |
| 446 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 447 | } |
| 448 | query_number = &query_number_raw; |
| 449 | } |
| 450 | element_size = grn_uvector_element_sizecxx . . $ grn_uvector_element_size(8dd58acc9865e889).(ctx, target); |
| 451 | n_elements = GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(target) / element_size; |
| 452 | if (mode == GRN_OP_EQUALcxx . . $ GRN_OP_EQUAL.) { |
| 453 | for (i = 0; i < n_elements; i++) { |
| 454 | if (memcmpcxx . . $ memcmp(36f949851efa3055).(GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(target) + (i * element_size), |
| 455 | GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(query_number), |
| 456 | element_size) == 0) { |
| 457 | found_element = grn_plugin_proc_alloccxx . . $ grn_plugin_proc_alloc(acb267eca6702fc).(ctx, |
| 458 | user_data, |
| 459 | target->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain., |
| 460 | 0); |
| 461 | grn_bulk_writecxx . . $ grn_bulk_write(4609c18fd87cf054).(ctx, |
| 462 | found_element, |
| 463 | GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(target) + (i * element_size), |
| 464 | element_size); |
| 465 | break; |
| 466 | } |
| 467 | } |
| 468 | } else { |
| 469 | grn_operator_exec_funccxx . . $ grn_operator_exec_func# *exec; |
| 470 | grn_objcxx . . $ grn_obj# element; |
| 471 | |
| 472 | exec = grn_operator_to_exec_funccxx . . $ grn_operator_to_exec_func(f63e3fac1c366159).(mode); |
| 473 | if (!exec) { |
| 474 | GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx, GRN_INVALID_ARGUMENT, |
| 475 | "vector_find(): unsupported mode: <%s>", |
| 476 | grn_operator_to_string(mode)); |
| 477 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 478 | } |
| 479 | GRN_VALUE_FIX_SIZE_INITcxx . . $ `include/groonga/groonga.h:2738:9`!(&element, 0, target->header.domain); |
| 480 | for (i = 0; i < n_elements; i++) { |
| 481 | GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(&element); |
| 482 | grn_bulk_writecxx . . $ grn_bulk_write(4609c18fd87cf054).(ctx, |
| 483 | &element, |
| 484 | GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(target) + (i * element_size), |
| 485 | element_size); |
| 486 | if (exec(ctx, &element, query_number)) { |
| 487 | found_element = grn_plugin_proc_alloccxx . . $ grn_plugin_proc_alloc(acb267eca6702fc).(ctx, |
| 488 | user_data, |
| 489 | target->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain., |
| 490 | 0); |
| 491 | grn_bulk_writecxx . . $ grn_bulk_write(4609c18fd87cf054).(ctx, |
| 492 | found_element, |
| 493 | GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(target) + (i * element_size), |
| 494 | element_size); |
| 495 | break; |
| 496 | } |
| 497 | } |
| 498 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &element); |
| 499 | } |
| 500 | if (query_number == &query_number_raw) { |
| 501 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &query_number_raw); |
| 502 | } |
| 503 | |
| 504 | return found_element; |
| 505 | } |
| 506 | |
| 507 | static grn_objcxx . . $ grn_obj# * |
| 508 | func_vector_find_uvector_recordcxx . . $ func_vector_find_uvector_record(251fca57498125c3).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 509 | grn_objcxx . . $ grn_obj# *target, |
| 510 | grn_objcxx . . $ grn_obj# *query, |
| 511 | grn_operatorcxx . . $ grn_operator# mode, |
| 512 | grn_user_datacxx . . $ grn_user_data# *user_data) |
| 513 | { |
| 514 | grn_objcxx . . $ grn_obj# *found_element = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 515 | grn_idcxx . . $ grn_id# query_id = GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!; |
| 516 | grn_idcxx . . $ grn_id# *ids; |
| 517 | size_tcxx . . $ size_t# i, n_elements; |
| 518 | |
| 519 | if (mode != GRN_OP_EQUALcxx . . $ GRN_OP_EQUAL.) { |
| 520 | GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx, GRN_INVALID_ARGUMENT, |
| 521 | "vector_find(): unsupported mode: <%s>", |
| 522 | grn_operator_to_string(mode)); |
| 523 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 524 | } |
| 525 | |
| 526 | if (query->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain. == target->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain.) { |
| 527 | query_id = GRN_RECORD_VALUEcxx . . $ `include/groonga/groonga.h:3110:9`!(query); |
| 528 | } else { |
| 529 | grn_objcxx . . $ grn_obj# query_id_raw; |
| 530 | GRN_RECORD_INITcxx . . $ `include/groonga/groonga.h:2868:9`!(&query_id_raw, 0, target->header.domain); |
| 531 | if (grn_obj_castcxx . . $ grn_obj_cast(a6fd93da1614eccd).(ctx, query, &query_id_raw, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!) != GRN_SUCCESScxx . . $ GRN_SUCCESS.) { |
| 532 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &query_id_raw); |
| 533 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 534 | } |
| 535 | query_id = GRN_RECORD_VALUEcxx . . $ `include/groonga/groonga.h:3110:9`!(&query_id_raw); |
| 536 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &query_id_raw); |
| 537 | } |
| 538 | ids = (grn_idcxx . . $ grn_id# *)GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(target); |
| 539 | n_elements = GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(target) / sizeof(grn_idcxx . . $ grn_id#); |
| 540 | for (i = 0; i < n_elements; i++) { |
| 541 | if (ids[i] == query_id) { |
| 542 | found_element = grn_plugin_proc_alloccxx . . $ grn_plugin_proc_alloc(acb267eca6702fc).(ctx, |
| 543 | user_data, |
| 544 | target->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain., |
| 545 | 0); |
| 546 | GRN_RECORD_SETcxx . . $ `include/groonga/groonga.h:2940:9`!(ctx, found_element, ids[i]); |
| 547 | break; |
| 548 | } |
| 549 | } |
| 550 | |
| 551 | return found_element; |
| 552 | } |
| 553 | |
| 554 | static grn_objcxx . . $ grn_obj# * |
| 555 | func_vector_find_uvectorcxx . . $ func_vector_find_uvector(251fca57498125c3).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 556 | grn_objcxx . . $ grn_obj# *target, |
| 557 | grn_objcxx . . $ grn_obj# *query, |
| 558 | grn_operatorcxx . . $ grn_operator# mode, |
| 559 | grn_user_datacxx . . $ grn_user_data# *user_data) |
| 560 | { |
| 561 | if (grn_type_id_is_number_familycxx . . $ grn_type_id_is_number_family(a2a496425acc5b40).(ctx, target->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain.)) { |
| 562 | return func_vector_find_uvector_numbercxx . . $ func_vector_find_uvector_number(251fca57498125c3).(ctx, |
| 563 | target, |
| 564 | query, |
| 565 | mode, |
| 566 | user_data); |
| 567 | } else if (grn_type_id_is_builtincxx . . $ grn_type_id_is_builtin(a2a496425acc5b40).(ctx, target->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain.)) { |
| 568 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 569 | } else { |
| 570 | return func_vector_find_uvector_recordcxx . . $ func_vector_find_uvector_record(251fca57498125c3).(ctx, |
| 571 | target, |
| 572 | query, |
| 573 | mode, |
| 574 | user_data); |
| 575 | } |
| 576 | } |
| 577 | |
| 578 | static grn_objcxx . . $ grn_obj# * |
| 579 | func_vector_find_pvectorcxx . . $ func_vector_find_pvector(251fca57498125c3).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 580 | grn_objcxx . . $ grn_obj# *target, |
| 581 | grn_objcxx . . $ grn_obj# *query, |
| 582 | grn_operatorcxx . . $ grn_operator# mode, |
| 583 | grn_user_datacxx . . $ grn_user_data# *user_data) |
| 584 | { |
| 585 | grn_objcxx . . $ grn_obj# *found_element = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 586 | grn_operator_exec_funccxx . . $ grn_operator_exec_func# *exec; |
| 587 | size_tcxx . . $ size_t# i; |
| 588 | size_tcxx . . $ size_t# n_elements = 0; |
| 589 | |
| 590 | exec = grn_operator_to_exec_funccxx . . $ grn_operator_to_exec_func(f63e3fac1c366159).(mode); |
| 591 | if (!exec) { |
| 592 | GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx, GRN_INVALID_ARGUMENT, |
| 593 | "vector_find(): unsupported mode: <%s>", |
| 594 | grn_operator_to_string(mode)); |
| 595 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 596 | } |
| 597 | n_elements = GRN_PTR_VECTOR_SIZEcxx . . $ `include/groonga/groonga.h:3265:9`!(target); |
| 598 | for (i = 0; i < n_elements; i++) { |
| 599 | grn_objcxx . . $ grn_obj# *element = GRN_PTR_VALUE_ATcxx . . $ `include/groonga/groonga.h:3150:9`!(target, i); |
| 600 | if (exec(ctx, element, query)) { |
| 601 | found_element = |
| 602 | grn_plugin_proc_alloccxx . . $ grn_plugin_proc_alloc(acb267eca6702fc).(ctx, user_data, element->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain., 0); |
| 603 | grn_bulk_writecxx . . $ grn_bulk_write(4609c18fd87cf054).(ctx, |
| 604 | found_element, |
| 605 | GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(element), |
| 606 | GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(element)); |
| 607 | break; |
| 608 | } |
| 609 | } |
| 610 | |
| 611 | return found_element; |
| 612 | } |
| 613 | |
| 614 | static grn_objcxx . . $ grn_obj# * |
| 615 | func_vector_findcxx . . $ func_vector_find(fd082858389c8bb0).(grn_ctxcxx . . $ grn_ctx# *ctx, int n_args, grn_objcxx . . $ grn_obj# **args, |
| 616 | grn_user_datacxx . . $ grn_user_data# *user_data) |
| 617 | { |
| 618 | const char *context = "vector_find()"; |
| 619 | grn_objcxx . . $ grn_obj# *target; |
| 620 | grn_objcxx . . $ grn_obj# *query = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 621 | grn_operatorcxx . . $ grn_operator# mode = GRN_OP_EQUALcxx . . $ GRN_OP_EQUAL.; |
| 622 | grn_objcxx . . $ grn_obj# *found_element = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 623 | |
| 624 | if (n_args < 2 || n_args > 3) { |
| 625 | GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx, GRN_INVALID_ARGUMENT, |
| 626 | "%s: wrong number of arguments (%d for 2..3)", |
| 627 | context, |
| 628 | n_args); |
| 629 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 630 | } |
| 631 | |
| 632 | target = args[0]; |
| 633 | query = args[1]; |
| 634 | if (n_args == 3) { |
| 635 | mode = grn_plugin_proc_get_value_modecxx . . $ grn_plugin_proc_get_value_mode(db52f52f4dd070c1).(ctx, args[2], mode, context); |
| 636 | if (ctx->rccxx . . $ _grn_ctx#rc. != GRN_SUCCESScxx . . $ GRN_SUCCESS.) { |
| 637 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 638 | } |
| 639 | } |
| 640 | |
| 641 | switch (target->headercxx . . $ _grn_obj#header..typecxx . . $ _grn_obj_header#type.) { |
| 642 | case GRN_VECTORcxx . . $ `include/groonga/groonga.h:877:9`! : |
| 643 | case GRN_PVECTORcxx . . $ `include/groonga/groonga.h:876:9`! : |
| 644 | case GRN_UVECTORcxx . . $ `include/groonga/groonga.h:875:9`! : |
| 645 | break; |
| 646 | default : |
| 647 | { |
| 648 | grn_objcxx . . $ grn_obj# inspected; |
| 649 | |
| 650 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&inspected, 0); |
| 651 | grn_inspectcxx . . $ grn_inspect(88456f97fe0d41a).(ctx, target, &inspected); |
| 652 | GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx, GRN_INVALID_ARGUMENT, |
| 653 | "%s: target object must be vector: <%.*s>", |
| 654 | context, |
| 655 | (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&inspected), |
| 656 | GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&inspected)); |
| 657 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &inspected); |
| 658 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 659 | } |
| 660 | break; |
| 661 | } |
| 662 | |
| 663 | if (target->headercxx . . $ _grn_obj#header..typecxx . . $ _grn_obj_header#type. == GRN_VECTORcxx . . $ `include/groonga/groonga.h:877:9`!) { |
| 664 | found_element = |
| 665 | func_vector_find_vectorcxx . . $ func_vector_find_vector(251fca57498125c3).(ctx, target, query, mode, user_data); |
| 666 | } else if (target->headercxx . . $ _grn_obj#header..typecxx . . $ _grn_obj_header#type. == GRN_UVECTORcxx . . $ `include/groonga/groonga.h:875:9`!) { |
| 667 | found_element = |
| 668 | func_vector_find_uvectorcxx . . $ func_vector_find_uvector(251fca57498125c3).(ctx, target, query, mode, user_data); |
| 669 | } else if (target->headercxx . . $ _grn_obj#header..typecxx . . $ _grn_obj_header#type. == GRN_PVECTORcxx . . $ `include/groonga/groonga.h:876:9`!) { |
| 670 | found_element = |
| 671 | func_vector_find_pvectorcxx . . $ func_vector_find_pvector(251fca57498125c3).(ctx, target, query, mode, user_data); |
| 672 | } |
| 673 | |
| 674 | if (!found_element) { |
| 675 | found_element = grn_plugin_proc_alloccxx . . $ grn_plugin_proc_alloc(acb267eca6702fc).(ctx, user_data, GRN_DB_VOIDcxx . . $ GRN_DB_VOID., 0); |
| 676 | } |
| 677 | |
| 678 | return found_element; |
| 679 | } |
| 680 | |
| 681 | static grn_objcxx . . $ grn_obj# * |
| 682 | func_vector_joincxx . . $ func_vector_join(fd082858389c8bb0).(grn_ctxcxx . . $ grn_ctx# *ctx, int n_args, grn_objcxx . . $ grn_obj# **args, |
| 683 | grn_user_datacxx . . $ grn_user_data# *user_data) |
| 684 | { |
| 685 | const char *context = "vector_join()"; |
| 686 | grn_objcxx . . $ grn_obj# *target; |
| 687 | grn_objcxx . . $ grn_obj# *separator = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 688 | |
| 689 | if (n_args < 1 || n_args > 2) { |
| 690 | GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx, GRN_INVALID_ARGUMENT, |
| 691 | "%s: wrong number of arguments (%d for 1..2)", |
| 692 | context, |
| 693 | n_args); |
| 694 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 695 | } |
| 696 | |
| 697 | target = args[0]; |
| 698 | if (n_args == 2) { |
| 699 | separator = args[1]; |
| 700 | } |
| 701 | |
| 702 | switch (target->headercxx . . $ _grn_obj#header..typecxx . . $ _grn_obj_header#type.) { |
| 703 | case GRN_VECTORcxx . . $ `include/groonga/groonga.h:877:9`! : |
| 704 | case GRN_UVECTORcxx . . $ `include/groonga/groonga.h:875:9`! : |
| 705 | case GRN_PVECTORcxx . . $ `include/groonga/groonga.h:876:9`! : |
| 706 | break; |
| 707 | default : |
| 708 | { |
| 709 | grn_objcxx . . $ grn_obj# inspected; |
| 710 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&inspected, 0); |
| 711 | grn_inspectcxx . . $ grn_inspect(88456f97fe0d41a).(ctx, target, &inspected); |
| 712 | GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx, GRN_INVALID_ARGUMENT, |
| 713 | "%s: target object must be vector: <%.*s>", |
| 714 | context, |
| 715 | (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&inspected), |
| 716 | GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&inspected)); |
| 717 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &inspected); |
| 718 | } |
| 719 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 720 | } |
| 721 | |
| 722 | if (separator && !grn_obj_is_text_family_bulkcxx . . $ grn_obj_is_text_family_bulk(a5760e5c319a06ee).(ctx, separator)) { |
| 723 | grn_objcxx . . $ grn_obj# inspected; |
| 724 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&inspected, 0); |
| 725 | grn_inspectcxx . . $ grn_inspect(88456f97fe0d41a).(ctx, separator, &inspected); |
| 726 | GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx, GRN_INVALID_ARGUMENT, |
| 727 | "%s: separator must be text family bulk: <%.*s>", |
| 728 | context, |
| 729 | (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&inspected), |
| 730 | GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&inspected)); |
| 731 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &inspected); |
| 732 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 733 | } |
| 734 | |
| 735 | grn_objcxx . . $ grn_obj# *joined_target = grn_plugin_proc_alloccxx . . $ grn_plugin_proc_alloc(acb267eca6702fc).(ctx, user_data, GRN_DB_TEXTcxx . . $ GRN_DB_TEXT., 0); |
| 736 | if (!joined_target) { |
| 737 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 738 | } |
| 739 | const char *separator_data = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 740 | size_tcxx . . $ size_t# separator_length = 0; |
| 741 | if (separator) { |
| 742 | separator_data = GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(separator); |
| 743 | separator_length = GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(separator); |
| 744 | } |
| 745 | switch (target->headercxx . . $ _grn_obj#header..typecxx . . $ _grn_obj_header#type.) { |
| 746 | case GRN_VECTORcxx . . $ `include/groonga/groonga.h:877:9`! : |
| 747 | grn_vector_joincxx . . $ grn_vector_join(d4c856f466652194).(ctx, |
| 748 | target, |
| 749 | separator_data, |
| 750 | (int)separator_length, |
| 751 | joined_target); |
| 752 | break; |
| 753 | case GRN_UVECTORcxx . . $ `include/groonga/groonga.h:875:9`! : |
| 754 | grn_uvector_joincxx . . $ grn_uvector_join(d4c856f466652194).(ctx, |
| 755 | target, |
| 756 | separator_data, |
| 757 | (int)separator_length, |
| 758 | joined_target); |
| 759 | break; |
| 760 | case GRN_PVECTORcxx . . $ `include/groonga/groonga.h:876:9`! : |
| 761 | grn_pvector_joincxx . . $ grn_pvector_join(d4c856f466652194).(ctx, |
| 762 | target, |
| 763 | separator_data, |
| 764 | (int)separator_length, |
| 765 | joined_target); |
| 766 | break; |
| 767 | default : |
| 768 | break; |
| 769 | } |
| 770 | return joined_target; |
| 771 | } |
| 772 | |
| 773 | grn_rccxx . . $ grn_rc# |
| 774 | GRN_PLUGIN_INITcxx . . $ `include/groonga/plugin.h:43:9`!(grn_ctxcxx . . $ grn_ctx# *ctx) |
| 775 | { |
| 776 | return ctx->rccxx . . $ _grn_ctx#rc.; |
| 777 | } |
| 778 | |
| 779 | grn_rccxx . . $ grn_rc# |
| 780 | GRN_PLUGIN_REGISTERcxx . . $ `include/groonga/plugin.h:44:9`!(grn_ctxcxx . . $ grn_ctx# *ctx) |
| 781 | { |
| 782 | grn_rccxx . . $ grn_rc# rc = GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 783 | |
| 784 | grn_proc_createcxx . . $ grn_proc_create(195df001e5324f57).(ctx, "vector_size", -1, GRN_PROC_FUNCTIONcxx . . $ GRN_PROC_FUNCTION., func_vector_sizecxx . . $ func_vector_size(fd082858389c8bb0)., |
| 785 | 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`!, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 786 | |
| 787 | grn_proc_createcxx . . $ grn_proc_create(195df001e5324f57).(ctx, "vector_slice", -1, GRN_PROC_FUNCTIONcxx . . $ GRN_PROC_FUNCTION., func_vector_slicecxx . . $ func_vector_slice(fd082858389c8bb0)., |
| 788 | 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`!, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 789 | |
| 790 | grn_proc_createcxx . . $ grn_proc_create(195df001e5324f57).(ctx, "vector_new", -1, GRN_PROC_FUNCTIONcxx . . $ GRN_PROC_FUNCTION., func_vector_newcxx . . $ func_vector_new(fd082858389c8bb0)., |
| 791 | 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`!, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 792 | |
| 793 | grn_proc_createcxx . . $ grn_proc_create(195df001e5324f57).(ctx, "vector_find", -1, GRN_PROC_FUNCTIONcxx . . $ GRN_PROC_FUNCTION., func_vector_findcxx . . $ func_vector_find(fd082858389c8bb0)., |
| 794 | 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`!, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 795 | |
| 796 | grn_proc_createcxx . . $ grn_proc_create(195df001e5324f57).(ctx, "vector_join", -1, GRN_PROC_FUNCTIONcxx . . $ GRN_PROC_FUNCTION., func_vector_joincxx . . $ func_vector_join(fd082858389c8bb0)., |
| 797 | 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`!, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 798 | |
| 799 | return rc; |
| 800 | } |
| 801 | |
| 802 | grn_rccxx . . $ grn_rc# |
| 803 | GRN_PLUGIN_FINcxx . . $ `include/groonga/plugin.h:45:9`!(grn_ctxcxx . . $ grn_ctx# *ctx) |
| 804 | { |
| 805 | return GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 806 | } |