| 1 | /* |
| 2 | Copyright (C) 2009-2018 Brazil |
| 3 | Copyright (C) 2018-2022 Sutou Kouhei <[email protected]> |
| 4 | |
| 5 | This library is free software; you can redistribute it and/or |
| 6 | modify it under the terms of the GNU Lesser General Public |
| 7 | License as published by the Free Software Foundation; either |
| 8 | version 2.1 of the License, or (at your option) any later version. |
| 9 | |
| 10 | This library is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | Lesser General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU Lesser General Public |
| 16 | License along with this library; if not, write to the Free Software |
| 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | */ |
| 19 | |
| 20 | #include "grn.h"cxx . . $ `<file>/lib/grn.h`/ |
| 21 | #include <string.h> |
| 22 | #include "grn_string.h"cxx . . $ `<file>/lib/grn_string.h`/ |
| 23 | #include "grn_normalizer.h"cxx . . $ `<file>/lib/grn_normalizer.h`/ |
| 24 | #include "grn_str.h"cxx . . $ `<file>/lib/grn_str.h`/ |
| 25 | #include "grn_util.h"cxx . . $ `<file>/lib/grn_util.h`/ |
| 26 | |
| 27 | #include <groonga/tokenizer.h>cxx . . $ `<file>/include/groonga/tokenizer.h`/ |
| 28 | |
| 29 | const char * |
| 30 | grn_char_type_to_stringcxx . . $ grn_char_type_to_string(4f7a31af04a5b084).(grn_char_typecxx . . $ grn_char_type# type) |
| 31 | { |
| 32 | const char *string = "unknown"; |
| 33 | |
| 34 | #define CHAR_TYPE_STRING_WITH_BLANKcxx . . $ `lib/string.c:34:9`!(type_string) do { \ |
| 35 | if (GRN_CHAR_IS_BLANKcxx . . $ `include/groonga/string.h:60:9`!(type)) { \ |
| 36 | string = type_string "|blank"; \ |
| 37 | } else { \ |
| 38 | string = type_string; \ |
| 39 | } \ |
| 40 | } while (falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!) |
| 41 | |
| 42 | switch (GRN_CHAR_TYPEcxx . . $ `include/groonga/string.h:61:9`!(type)) { |
| 43 | case GRN_CHAR_NULLcxx . . $ GRN_CHAR_NULL. : |
| 44 | CHAR_TYPE_STRING_WITH_BLANKcxx . . $ `lib/string.c:34:9`!("null"); |
| 45 | break; |
| 46 | case GRN_CHAR_ALPHAcxx . . $ GRN_CHAR_ALPHA. : |
| 47 | CHAR_TYPE_STRING_WITH_BLANKcxx . . $ `lib/string.c:34:9`!("alpha"); |
| 48 | break; |
| 49 | case GRN_CHAR_DIGITcxx . . $ GRN_CHAR_DIGIT. : |
| 50 | CHAR_TYPE_STRING_WITH_BLANKcxx . . $ `lib/string.c:34:9`!("digit"); |
| 51 | break; |
| 52 | case GRN_CHAR_SYMBOLcxx . . $ GRN_CHAR_SYMBOL. : |
| 53 | CHAR_TYPE_STRING_WITH_BLANKcxx . . $ `lib/string.c:34:9`!("symbol"); |
| 54 | break; |
| 55 | case GRN_CHAR_HIRAGANAcxx . . $ GRN_CHAR_HIRAGANA. : |
| 56 | CHAR_TYPE_STRING_WITH_BLANKcxx . . $ `lib/string.c:34:9`!("hiragana"); |
| 57 | break; |
| 58 | case GRN_CHAR_KATAKANAcxx . . $ GRN_CHAR_KATAKANA. : |
| 59 | CHAR_TYPE_STRING_WITH_BLANKcxx . . $ `lib/string.c:34:9`!("katakana"); |
| 60 | break; |
| 61 | case GRN_CHAR_KANJIcxx . . $ GRN_CHAR_KANJI. : |
| 62 | CHAR_TYPE_STRING_WITH_BLANKcxx . . $ `lib/string.c:34:9`!("kanji"); |
| 63 | break; |
| 64 | case GRN_CHAR_OTHERScxx . . $ GRN_CHAR_OTHERS. : |
| 65 | CHAR_TYPE_STRING_WITH_BLANKcxx . . $ `lib/string.c:34:9`!("others"); |
| 66 | break; |
| 67 | case GRN_CHAR_EMOJIcxx . . $ GRN_CHAR_EMOJI. : |
| 68 | CHAR_TYPE_STRING_WITH_BLANKcxx . . $ `lib/string.c:34:9`!("emoji"); |
| 69 | break; |
| 70 | default : |
| 71 | CHAR_TYPE_STRING_WITH_BLANKcxx . . $ `lib/string.c:34:9`!("unknown"); |
| 72 | break; |
| 73 | } |
| 74 | |
| 75 | #undef CHAR_TYPE_STRING_WITH_BLANKcxx . . $ `lib/string.c:34:9`! |
| 76 | |
| 77 | return string; |
| 78 | } |
| 79 | |
| 80 | static grn_stringcxx . . $ grn_string# * |
| 81 | grn_fake_string_opencxx . . $ grn_fake_string_open(673c29f59d2e4697).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_stringcxx . . $ grn_string# *string) |
| 82 | { |
| 83 | /* TODO: support GRN_STRING_REMOVE_BLANK flag and ctypes */ |
| 84 | grn_stringcxx . . $ grn_string# *nstr = string; |
| 85 | const char *str; |
| 86 | unsigned int str_len; |
| 87 | |
| 88 | str = nstr->originalcxx . . $ $anonymous_type_a07610201251503c_0#original.; |
| 89 | str_len = nstr->original_length_in_bytescxx . . $ $anonymous_type_a07610201251503c_0#original_length_in_bytes.; |
| 90 | |
| 91 | if (!(nstr->normalizedcxx . . $ $anonymous_type_a07610201251503c_0#normalized. = GRN_MALLOCcxx . . $ `lib/grn_alloc.h:41:9`!(str_len + 1))) { |
| 92 | ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_NO_MEMORY_AVAILABLE, |
| 93 | "[strinig][fake] failed to allocate normalized text space"); |
| 94 | grn_string_closecxx . . $ grn_string_close(4865d068a46d0f83).(ctx, (grn_objcxx . . $ grn_obj# *)nstr); |
| 95 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 96 | } |
| 97 | |
| 98 | if (nstr->flagscxx . . $ $anonymous_type_a07610201251503c_0#flags. & GRN_STRING_REMOVE_TOKENIZED_DELIMITERcxx . . $ `include/groonga/string.h:55:9`! && |
| 99 | ctx->encodingcxx . . $ _grn_ctx#encoding. == GRN_ENC_UTF8cxx . . $ GRN_ENC_UTF8.) { |
| 100 | int char_length; |
| 101 | const char *source_current = str; |
| 102 | const char *source_end = str + str_len; |
| 103 | char *destination = nstr->normalizedcxx . . $ $anonymous_type_a07610201251503c_0#normalized.; |
| 104 | uint32_tcxx . . $ uint32_t# destination_length = 0; |
| 105 | while ((char_length = grn_charlencxx . . $ grn_charlen(d229e8bf7c87f0f0).(ctx, source_current, source_end)) > 0) { |
| 106 | if (!grn_tokenizer_is_tokenized_delimitercxx . . $ grn_tokenizer_is_tokenized_delimiter(ee3f38db1c378f4).(ctx, |
| 107 | source_current, |
| 108 | (unsigned int)char_length, |
| 109 | ctx->encodingcxx . . $ _grn_ctx#encoding.)) { |
| 110 | grn_memcpycxx . . $ `include/groonga/portability.h:32:13`!(destination, source_current, (size_t)char_length); |
| 111 | destination += char_length; |
| 112 | destination_length += (uint32_tcxx . . $ uint32_t#)char_length; |
| 113 | } |
| 114 | source_current += char_length; |
| 115 | } |
| 116 | nstr->normalizedcxx . . $ $anonymous_type_a07610201251503c_0#normalized.[destination_length] = '\0'; |
| 117 | nstr->normalized_length_in_bytescxx . . $ $anonymous_type_a07610201251503c_0#normalized_length_in_bytes. = destination_length; |
| 118 | } else { |
| 119 | grn_memcpycxx . . $ `include/groonga/portability.h:32:13`!(nstr->normalized, str, str_len); |
| 120 | nstr->normalizedcxx . . $ $anonymous_type_a07610201251503c_0#normalized.[str_len] = '\0'; |
| 121 | nstr->normalized_length_in_bytescxx . . $ $anonymous_type_a07610201251503c_0#normalized_length_in_bytes. = str_len; |
| 122 | } |
| 123 | |
| 124 | if (nstr->flagscxx . . $ $anonymous_type_a07610201251503c_0#flags. & GRN_STRING_WITH_CHECKScxx . . $ `include/groonga/string.h:54:9`!) { |
| 125 | int16_tcxx . . $ int16_t# f = 0; |
| 126 | unsigned char c; |
| 127 | size_tcxx . . $ size_t# i; |
| 128 | if (!(nstr->checkscxx . . $ $anonymous_type_a07610201251503c_0#checks. = (int16_tcxx . . $ int16_t# *) GRN_MALLOCcxx . . $ `lib/grn_alloc.h:41:9`!(sizeof(int16_t) * str_len))) { |
| 129 | grn_string_closecxx . . $ grn_string_close(4865d068a46d0f83).(ctx, (grn_objcxx . . $ grn_obj# *)nstr); |
| 130 | ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_NO_MEMORY_AVAILABLE, |
| 131 | "[strinig][fake] failed to allocate checks space"); |
| 132 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 133 | } |
| 134 | switch (nstr->encodingcxx . . $ $anonymous_type_a07610201251503c_0#encoding.) { |
| 135 | case GRN_ENC_EUC_JPcxx . . $ GRN_ENC_EUC_JP.: |
| 136 | for (i = 0; i < str_len; i++) { |
| 137 | if (!f) { |
| 138 | c = (unsigned char) str[i]; |
| 139 | f = ((c >= 0xa1U && c <= 0xfeU) || c == 0x8eU ? 2 : (c == 0x8fU ? 3 : 1) |
| 140 | ); |
| 141 | nstr->checkscxx . . $ $anonymous_type_a07610201251503c_0#checks.[i] = f; |
| 142 | } else { |
| 143 | nstr->checkscxx . . $ $anonymous_type_a07610201251503c_0#checks.[i] = 0; |
| 144 | } |
| 145 | f--; |
| 146 | } |
| 147 | break; |
| 148 | case GRN_ENC_SJIScxx . . $ GRN_ENC_SJIS.: |
| 149 | for (i = 0; i < str_len; i++) { |
| 150 | if (!f) { |
| 151 | c = (unsigned char) str[i]; |
| 152 | f = (c >= 0x81U && ((c <= 0x9fU) || (c >= 0xe0U && c <= 0xfcU)) ? 2 : 1); |
| 153 | nstr->checkscxx . . $ $anonymous_type_a07610201251503c_0#checks.[i] = f; |
| 154 | } else { |
| 155 | nstr->checkscxx . . $ $anonymous_type_a07610201251503c_0#checks.[i] = 0; |
| 156 | } |
| 157 | f--; |
| 158 | } |
| 159 | break; |
| 160 | case GRN_ENC_UTF8cxx . . $ GRN_ENC_UTF8.: |
| 161 | for (i = 0; i < str_len; i++) { |
| 162 | if (!f) { |
| 163 | c = (unsigned char) str[i]; |
| 164 | f = (c & 0x80U ? (c & 0x20U ? (c & 0x10U ? 4 : 3) |
| 165 | : 2) |
| 166 | : 1); |
| 167 | nstr->checkscxx . . $ $anonymous_type_a07610201251503c_0#checks.[i] = f; |
| 168 | } else { |
| 169 | nstr->checkscxx . . $ $anonymous_type_a07610201251503c_0#checks.[i] = 0; |
| 170 | } |
| 171 | f--; |
| 172 | } |
| 173 | break; |
| 174 | default: |
| 175 | for (i = 0; i < str_len; i++) { |
| 176 | nstr->checkscxx . . $ $anonymous_type_a07610201251503c_0#checks.[i] = 1; |
| 177 | } |
| 178 | break; |
| 179 | } |
| 180 | } |
| 181 | return nstr; |
| 182 | } |
| 183 | |
| 184 | grn_rccxx . . $ grn_rc# |
| 185 | grn_string_initcxx . . $ grn_string_init(6b836d3fe11755a8).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 186 | grn_objcxx . . $ grn_obj# *string, |
| 187 | grn_objcxx . . $ grn_obj# *lexicon_or_normalizer, |
| 188 | int flags, |
| 189 | grn_encodingcxx . . $ grn_encoding# encoding) |
| 190 | { |
| 191 | grn_stringcxx . . $ grn_string# *string_ = (grn_stringcxx . . $ grn_string# *)string; |
| 192 | |
| 193 | GRN_OBJ_INITcxx . . $ `include/groonga/groonga.h:947:9`!(string, GRN_STRINGcxx . . $ `include/groonga/groonga.h:883:9`!, 0, GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!); |
| 194 | string_->originalcxx . . $ $anonymous_type_a07610201251503c_0#original. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 195 | string_->original_length_in_bytescxx . . $ $anonymous_type_a07610201251503c_0#original_length_in_bytes. = 0; |
| 196 | string_->normalizedcxx . . $ $anonymous_type_a07610201251503c_0#normalized. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 197 | string_->normalized_length_in_bytescxx . . $ $anonymous_type_a07610201251503c_0#normalized_length_in_bytes. = 0; |
| 198 | string_->n_characterscxx . . $ $anonymous_type_a07610201251503c_0#n_characters. = 0; |
| 199 | string_->checkscxx . . $ $anonymous_type_a07610201251503c_0#checks. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 200 | string_->ctypescxx . . $ $anonymous_type_a07610201251503c_0#ctypes. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 201 | string_->offsetscxx . . $ $anonymous_type_a07610201251503c_0#offsets. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 202 | string_->encodingcxx . . $ $anonymous_type_a07610201251503c_0#encoding. = encoding; |
| 203 | string_->flagscxx . . $ $anonymous_type_a07610201251503c_0#flags. = flags; |
| 204 | string_->lexiconcxx . . $ $anonymous_type_a07610201251503c_0#lexicon. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 205 | string_->normalizer_indexcxx . . $ $anonymous_type_a07610201251503c_0#normalizer_index. = 0; |
| 206 | |
| 207 | if (lexicon_or_normalizer && |
| 208 | lexicon_or_normalizer != GRN_NORMALIZER_AUTOcxx . . $ `include/groonga/string.h:57:9`! && |
| 209 | grn_obj_is_tablecxx . . $ grn_obj_is_table(a5760e5c319a06ee).(ctx, lexicon_or_normalizer)) { |
| 210 | string_->lexiconcxx . . $ $anonymous_type_a07610201251503c_0#lexicon. = lexicon_or_normalizer; |
| 211 | } |
| 212 | |
| 213 | return ctx->rccxx . . $ _grn_ctx#rc.; |
| 214 | } |
| 215 | |
| 216 | grn_objcxx . . $ grn_obj# * |
| 217 | grn_string_open_cxx . . $ grn_string_open_(bc90bc1ba05096ea).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 218 | const char *str, |
| 219 | unsigned int str_len, |
| 220 | grn_objcxx . . $ grn_obj# *lexicon_or_normalizer, |
| 221 | int flags, |
| 222 | grn_encodingcxx . . $ grn_encoding# encoding) |
| 223 | { |
| 224 | grn_stringcxx . . $ grn_string# *string_; |
| 225 | grn_objcxx . . $ grn_obj# *string; |
| 226 | |
| 227 | if (!str || !str_len) { |
| 228 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 229 | } |
| 230 | |
| 231 | string_ = GRN_CALLOCcxx . . $ `lib/grn_alloc.h:42:9`!(sizeof(grn_string)); |
| 232 | if (!string_) { |
| 233 | GRN_LOGcxx . . $ `include/groonga/groonga.h:2493:9`!(ctx, GRN_LOG_ALERT, |
| 234 | "[string][open] failed to allocate memory"); |
| 235 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 236 | } |
| 237 | |
| 238 | string = (grn_objcxx . . $ grn_obj# *)string_; |
| 239 | grn_string_initcxx . . $ grn_string_init(6b836d3fe11755a8).(ctx, string, lexicon_or_normalizer, flags, encoding); |
| 240 | string->headercxx . . $ _grn_obj#header..impl_flagscxx . . $ _grn_obj_header#impl_flags. |= GRN_OBJ_ALLOCATEDcxx . . $ `lib/grn_ctx.h:163:9`!; |
| 241 | string_->originalcxx . . $ $anonymous_type_a07610201251503c_0#original. = str; |
| 242 | string_->original_length_in_bytescxx . . $ $anonymous_type_a07610201251503c_0#original_length_in_bytes. = str_len; |
| 243 | |
| 244 | if (!lexicon_or_normalizer) { |
| 245 | return (grn_objcxx . . $ grn_obj# *)grn_fake_string_opencxx . . $ grn_fake_string_open(673c29f59d2e4697).(ctx, string_); |
| 246 | } |
| 247 | |
| 248 | { |
| 249 | grn_objcxx . . $ grn_obj# normalizers; |
| 250 | GRN_PTR_INITcxx . . $ `include/groonga/groonga.h:2869:9`!(&normalizers, GRN_OBJ_VECTORcxx . . $ `include/groonga/groonga.h:2734:9`!, GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!); |
| 251 | if (string_->lexiconcxx . . $ $anonymous_type_a07610201251503c_0#lexicon.) { |
| 252 | grn_obj_get_infocxx . . $ grn_obj_get_info(333a81d4a8f20670).(ctx, |
| 253 | string_->lexiconcxx . . $ $anonymous_type_a07610201251503c_0#lexicon., |
| 254 | GRN_INFO_NORMALIZERScxx . . $ GRN_INFO_NORMALIZERS., |
| 255 | &normalizers); |
| 256 | } else { |
| 257 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! is_normalizer_auto = (lexicon_or_normalizer == GRN_NORMALIZER_AUTOcxx . . $ `include/groonga/string.h:57:9`!); |
| 258 | if (is_normalizer_auto) { |
| 259 | grn_objcxx . . $ grn_obj# *normalizer = grn_ctx_getcxx . . $ grn_ctx_get(70fde0087014f9ea).(ctx, GRN_NORMALIZER_AUTO_NAMEcxx . . $ `lib/grn_normalizer.h:32:9`!, -1); |
| 260 | if (!normalizer) { |
| 261 | grn_obj_closecxx . . $ grn_obj_close(4865d068a46d0f83).(ctx, string); |
| 262 | ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT, |
| 263 | "[string][open] NormalizerAuto normalizer isn't available"); |
| 264 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 265 | } |
| 266 | GRN_PTR_PUTcxx . . $ `include/groonga/groonga.h:3218:9`!(ctx, &normalizers, normalizer); |
| 267 | } else { |
| 268 | grn_objcxx . . $ grn_obj# *normalizer = lexicon_or_normalizer; |
| 269 | GRN_PTR_PUTcxx . . $ `include/groonga/groonga.h:3218:9`!(ctx, &normalizers, normalizer); |
| 270 | } |
| 271 | } |
| 272 | size_tcxx . . $ size_t# n = GRN_PTR_VECTOR_SIZEcxx . . $ `include/groonga/groonga.h:3265:9`!(&normalizers); |
| 273 | if (n == 0) { |
| 274 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &normalizers); |
| 275 | return (grn_objcxx . . $ grn_obj# *)grn_fake_string_opencxx . . $ grn_fake_string_open(673c29f59d2e4697).(ctx, string_); |
| 276 | } |
| 277 | char *previous_normalized = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 278 | unsigned int previous_normalized_length_in_bytes = 0; |
| 279 | int16_tcxx . . $ int16_t# *previous_checks = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 280 | uint8_tcxx . . $ uint8_t# *previous_types = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 281 | uint64_tcxx . . $ uint64_t# *previous_offsets = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 282 | unsigned int previous_n_characters = 0; |
| 283 | size_tcxx . . $ size_t# i; |
| 284 | for (i = 0; i < n; i++) { |
| 285 | grn_objcxx . . $ grn_obj# *normalizer = GRN_PTR_VALUE_ATcxx . . $ `include/groonga/groonga.h:3150:9`!(&normalizers, i); |
| 286 | string_->normalizer_indexcxx . . $ $anonymous_type_a07610201251503c_0#normalizer_index. = (uint32_tcxx . . $ uint32_t#)i; |
| 287 | if (i > 0) { |
| 288 | previous_normalized = string_->normalizedcxx . . $ $anonymous_type_a07610201251503c_0#normalized.; |
| 289 | previous_normalized_length_in_bytes = |
| 290 | string_->normalized_length_in_bytescxx . . $ $anonymous_type_a07610201251503c_0#normalized_length_in_bytes.; |
| 291 | previous_n_characters = string_->n_characterscxx . . $ $anonymous_type_a07610201251503c_0#n_characters.; |
| 292 | previous_checks = string_->checkscxx . . $ $anonymous_type_a07610201251503c_0#checks.; |
| 293 | previous_types = string_->ctypescxx . . $ $anonymous_type_a07610201251503c_0#ctypes.; |
| 294 | previous_offsets = string_->offsetscxx . . $ $anonymous_type_a07610201251503c_0#offsets.; |
| 295 | string_->originalcxx . . $ $anonymous_type_a07610201251503c_0#original. = previous_normalized; |
| 296 | string_->original_length_in_bytescxx . . $ $anonymous_type_a07610201251503c_0#original_length_in_bytes. = previous_normalized_length_in_bytes; |
| 297 | } |
| 298 | grn_normalizer_normalizecxx . . $ grn_normalizer_normalize(d825b4ed5bf12304).(ctx, normalizer, string); |
| 299 | if (i > 0) { |
| 300 | if (ctx->rccxx . . $ _grn_ctx#rc. != GRN_SUCCESScxx . . $ GRN_SUCCESS.) { |
| 301 | break; |
| 302 | } |
| 303 | if (previous_checks) { |
| 304 | if (string_->checkscxx . . $ $anonymous_type_a07610201251503c_0#checks.) { |
| 305 | unsigned int previous_i = 0; |
| 306 | unsigned int current_i = 0; |
| 307 | for (current_i = 0; |
| 308 | current_i < string_->normalized_length_in_bytescxx . . $ $anonymous_type_a07610201251503c_0#normalized_length_in_bytes.; |
| 309 | current_i++) { |
| 310 | int16_tcxx . . $ int16_t# current_check = string_->checkscxx . . $ $anonymous_type_a07610201251503c_0#checks.[current_i]; |
| 311 | if (current_check > 0) { |
| 312 | int16_tcxx . . $ int16_t# previous_check = previous_checks[previous_i]; |
| 313 | /* TODO: How to merge check? This logic may be |
| 314 | * wrong. We need many cases. We have only a few cases |
| 315 | * in |
| 316 | * test/command/suite/normalizers/multiple/options/ .*/ |
| 317 | if (previous_check > current_check) { |
| 318 | string_->checkscxx . . $ $anonymous_type_a07610201251503c_0#checks.[current_i] = previous_check; |
| 319 | } |
| 320 | previous_i += (unsigned int)current_check; |
| 321 | } |
| 322 | } |
| 323 | } |
| 324 | GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(previous_checks); |
| 325 | } |
| 326 | if (previous_types) { |
| 327 | /* |
| 328 | * Currently, ctypes are merged only in limited cases. |
| 329 | * Specifically, we merge only GRN_CHAR_BLANK when the |
| 330 | * number of characters in the first normalized result is equal to |
| 331 | * that in the latter normalized result, and previous_types has |
| 332 | * GRN_CHAR_BLANK set. |
| 333 | * |
| 334 | * In other words, this works only when NormalizerTable performs |
| 335 | * normalization without changing the number of characters. |
| 336 | * |
| 337 | * The latter normalizer is NormalizerTable, and users can define any |
| 338 | * normalization pattern in NormalizerTable. |
| 339 | * |
| 340 | * It is difficult to handle all such cases with a single |
| 341 | * implementation here. |
| 342 | * Therefore, we currently support only this simple case. |
| 343 | */ |
| 344 | if (string_->ctypescxx . . $ $anonymous_type_a07610201251503c_0#ctypes. && |
| 345 | string_->n_characterscxx . . $ $anonymous_type_a07610201251503c_0#n_characters. == previous_n_characters) { |
| 346 | unsigned int character_i = 0; |
| 347 | for (character_i = 0; character_i < previous_n_characters; |
| 348 | character_i++) { |
| 349 | if (previous_types[character_i] & GRN_CHAR_BLANKcxx . . $ `include/groonga/string.h:59:9`!) { |
| 350 | string_->ctypescxx . . $ $anonymous_type_a07610201251503c_0#ctypes.[character_i] |= GRN_CHAR_BLANKcxx . . $ `include/groonga/string.h:59:9`!; |
| 351 | } |
| 352 | } |
| 353 | } |
| 354 | GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(previous_types); |
| 355 | } |
| 356 | if (previous_offsets) { |
| 357 | if (string_->offsetscxx . . $ $anonymous_type_a07610201251503c_0#offsets.) { |
| 358 | uint64_tcxx . . $ uint64_t# previous_offset = 0; |
| 359 | const char *previous_start = string_->originalcxx . . $ $anonymous_type_a07610201251503c_0#original.; |
| 360 | const char *previous_end = |
| 361 | previous_start + string_->original_length_in_bytescxx . . $ $anonymous_type_a07610201251503c_0#original_length_in_bytes.; |
| 362 | unsigned int previous_i = 0; |
| 363 | unsigned int current_i = 0; |
| 364 | for (current_i = 0; |
| 365 | current_i <= string_->n_characterscxx . . $ $anonymous_type_a07610201251503c_0#n_characters.; |
| 366 | current_i++) { |
| 367 | while (string_->offsetscxx . . $ $anonymous_type_a07610201251503c_0#offsets.[current_i] > previous_offset) { |
| 368 | int previous_character_length = |
| 369 | grn_charlencxx . . $ grn_charlen(d229e8bf7c87f0f0).(ctx, previous_start, previous_end); |
| 370 | if (previous_character_length == 0) { |
| 371 | ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT, |
| 372 | "[string][open] invalid character in normalized string: " |
| 373 | "<%.*s>", |
| 374 | (int)(previous_end - previous_start), |
| 375 | previous_start); |
| 376 | break; |
| 377 | } |
| 378 | previous_start += previous_character_length; |
| 379 | previous_offset += (uint64_tcxx . . $ uint64_t#)previous_character_length; |
| 380 | previous_i++; |
| 381 | } |
| 382 | if (ctx->rccxx . . $ _grn_ctx#rc. != GRN_SUCCESScxx . . $ GRN_SUCCESS.) { |
| 383 | break; |
| 384 | } |
| 385 | string_->offsetscxx . . $ $anonymous_type_a07610201251503c_0#offsets.[current_i] = previous_offsets[previous_i]; |
| 386 | } |
| 387 | } |
| 388 | GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(previous_offsets); |
| 389 | } |
| 390 | GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(previous_normalized); |
| 391 | } |
| 392 | if (ctx->rccxx . . $ _grn_ctx#rc. != GRN_SUCCESScxx . . $ GRN_SUCCESS.) { |
| 393 | break; |
| 394 | } |
| 395 | } |
| 396 | string_->originalcxx . . $ $anonymous_type_a07610201251503c_0#original. = str; |
| 397 | string_->original_length_in_bytescxx . . $ $anonymous_type_a07610201251503c_0#original_length_in_bytes. = str_len; |
| 398 | string_->normalizer_indexcxx . . $ $anonymous_type_a07610201251503c_0#normalizer_index. = 0; |
| 399 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &normalizers); |
| 400 | } |
| 401 | if (ctx->rccxx . . $ _grn_ctx#rc. != GRN_SUCCESScxx . . $ GRN_SUCCESS.) { |
| 402 | grn_obj_closecxx . . $ grn_obj_close(4865d068a46d0f83).(ctx, string); |
| 403 | string = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 404 | } |
| 405 | |
| 406 | return string; |
| 407 | } |
| 408 | |
| 409 | grn_objcxx . . $ grn_obj# * |
| 410 | grn_string_opencxx . . $ grn_string_open(e91f62a415156742).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 411 | const char *str, |
| 412 | unsigned int str_len, |
| 413 | grn_objcxx . . $ grn_obj# *lexicon_or_normalizer, |
| 414 | int flags) |
| 415 | { |
| 416 | return grn_string_open_cxx . . $ grn_string_open_(bc90bc1ba05096ea).(ctx, |
| 417 | str, |
| 418 | str_len, |
| 419 | lexicon_or_normalizer, |
| 420 | flags, |
| 421 | ctx->encodingcxx . . $ _grn_ctx#encoding.); |
| 422 | } |
| 423 | |
| 424 | grn_rccxx . . $ grn_rc# |
| 425 | grn_string_get_originalcxx . . $ grn_string_get_original(87996916c40b1978).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *string, |
| 426 | const char **original, |
| 427 | unsigned int *length_in_bytes) |
| 428 | { |
| 429 | grn_rccxx . . $ grn_rc# rc; |
| 430 | grn_stringcxx . . $ grn_string# *string_ = (grn_stringcxx . . $ grn_string# *)string; |
| 431 | GRN_API_ENTERcxx . . $ `lib/grn_ctx.h:41:9`!; |
| 432 | if (string_) { |
| 433 | if (original) { *original = string_->originalcxx . . $ $anonymous_type_a07610201251503c_0#original.; } |
| 434 | if (length_in_bytes) { |
| 435 | *length_in_bytes = string_->original_length_in_bytescxx . . $ $anonymous_type_a07610201251503c_0#original_length_in_bytes.; |
| 436 | } |
| 437 | rc = GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 438 | } else { |
| 439 | rc = GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.; |
| 440 | } |
| 441 | GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(rc); |
| 442 | } |
| 443 | |
| 444 | grn_rccxx . . $ grn_rc# |
| 445 | grn_string_set_originalcxx . . $ grn_string_set_original(6df5a48525cbe78d).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 446 | grn_objcxx . . $ grn_obj# *string, |
| 447 | const char *original, |
| 448 | unsigned int length_in_bytes) |
| 449 | { |
| 450 | grn_rccxx . . $ grn_rc# rc; |
| 451 | grn_stringcxx . . $ grn_string# *string_ = (grn_stringcxx . . $ grn_string# *)string; |
| 452 | GRN_API_ENTERcxx . . $ `lib/grn_ctx.h:41:9`!; |
| 453 | if (string_) { |
| 454 | grn_string_fincxx . . $ grn_string_fin(4865d068a46d0f83).(ctx, string); |
| 455 | string_->originalcxx . . $ $anonymous_type_a07610201251503c_0#original. = original; |
| 456 | string_->original_length_in_bytescxx . . $ $anonymous_type_a07610201251503c_0#original_length_in_bytes. = length_in_bytes; |
| 457 | rc = GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 458 | } else { |
| 459 | rc = GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.; |
| 460 | } |
| 461 | GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(rc); |
| 462 | } |
| 463 | |
| 464 | int |
| 465 | grn_string_get_flagscxx . . $ grn_string_get_flags(358588dbcc6428f9).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *string) |
| 466 | { |
| 467 | int flags = 0; |
| 468 | grn_stringcxx . . $ grn_string# *string_ = (grn_stringcxx . . $ grn_string# *)string; |
| 469 | GRN_API_ENTERcxx . . $ `lib/grn_ctx.h:41:9`!; |
| 470 | if (string_) { |
| 471 | flags = string_->flagscxx . . $ $anonymous_type_a07610201251503c_0#flags.; |
| 472 | } |
| 473 | GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(flags); |
| 474 | } |
| 475 | |
| 476 | grn_rccxx . . $ grn_rc# |
| 477 | grn_string_get_normalizedcxx . . $ grn_string_get_normalized(fcb0da4d05783f05).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *string, |
| 478 | const char **normalized, |
| 479 | unsigned int *length_in_bytes, |
| 480 | unsigned int *n_characters) |
| 481 | { |
| 482 | grn_rccxx . . $ grn_rc# rc; |
| 483 | grn_stringcxx . . $ grn_string# *string_ = (grn_stringcxx . . $ grn_string# *)string; |
| 484 | GRN_API_ENTERcxx . . $ `lib/grn_ctx.h:41:9`!; |
| 485 | if (string_) { |
| 486 | if (normalized) { *normalized = string_->normalizedcxx . . $ $anonymous_type_a07610201251503c_0#normalized.; } |
| 487 | if (length_in_bytes) { |
| 488 | *length_in_bytes = string_->normalized_length_in_bytescxx . . $ $anonymous_type_a07610201251503c_0#normalized_length_in_bytes.; |
| 489 | } |
| 490 | if (n_characters) { *n_characters = string_->n_characterscxx . . $ $anonymous_type_a07610201251503c_0#n_characters.; } |
| 491 | rc = GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 492 | } else { |
| 493 | if (normalized) { *normalized = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; } |
| 494 | if (length_in_bytes) { *length_in_bytes = 0; } |
| 495 | if (n_characters) { *n_characters = 0; } |
| 496 | rc = GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.; |
| 497 | } |
| 498 | GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(rc); |
| 499 | } |
| 500 | |
| 501 | grn_rccxx . . $ grn_rc# |
| 502 | grn_string_set_normalizedcxx . . $ grn_string_set_normalized(37302c144f2ed6b9).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *string, |
| 503 | char *normalized, unsigned int length_in_bytes, |
| 504 | unsigned int n_characters) |
| 505 | { |
| 506 | grn_rccxx . . $ grn_rc# rc; |
| 507 | grn_stringcxx . . $ grn_string# *string_ = (grn_stringcxx . . $ grn_string# *)string; |
| 508 | GRN_API_ENTERcxx . . $ `lib/grn_ctx.h:41:9`!; |
| 509 | if (string_) { |
| 510 | if (string_->normalizedcxx . . $ $anonymous_type_a07610201251503c_0#normalized.) { GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(string_->normalized); } |
| 511 | string_->normalizedcxx . . $ $anonymous_type_a07610201251503c_0#normalized. = normalized; |
| 512 | string_->normalized_length_in_bytescxx . . $ $anonymous_type_a07610201251503c_0#normalized_length_in_bytes. = length_in_bytes; |
| 513 | string_->n_characterscxx . . $ $anonymous_type_a07610201251503c_0#n_characters. = n_characters; |
| 514 | rc = GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 515 | } else { |
| 516 | rc = GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.; |
| 517 | } |
| 518 | GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(rc); |
| 519 | } |
| 520 | |
| 521 | const int16_tcxx . . $ int16_t# * |
| 522 | grn_string_get_checkscxx . . $ grn_string_get_checks(392ec27081c21988).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *string) |
| 523 | { |
| 524 | int16_tcxx . . $ int16_t# *checks = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 525 | grn_stringcxx . . $ grn_string# *string_ = (grn_stringcxx . . $ grn_string# *)string; |
| 526 | GRN_API_ENTERcxx . . $ `lib/grn_ctx.h:41:9`!; |
| 527 | if (string_) { |
| 528 | checks = string_->checkscxx . . $ $anonymous_type_a07610201251503c_0#checks.; |
| 529 | } else { |
| 530 | checks = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 531 | } |
| 532 | GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(checks); |
| 533 | } |
| 534 | |
| 535 | grn_rccxx . . $ grn_rc# |
| 536 | grn_string_set_checkscxx . . $ grn_string_set_checks(c32306852f1cd29).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *string, int16_tcxx . . $ int16_t# *checks) |
| 537 | { |
| 538 | grn_rccxx . . $ grn_rc# rc; |
| 539 | grn_stringcxx . . $ grn_string# *string_ = (grn_stringcxx . . $ grn_string# *)string; |
| 540 | GRN_API_ENTERcxx . . $ `lib/grn_ctx.h:41:9`!; |
| 541 | if (string_) { |
| 542 | if (string_->checkscxx . . $ $anonymous_type_a07610201251503c_0#checks.) { GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(string_->checks); } |
| 543 | string_->checkscxx . . $ $anonymous_type_a07610201251503c_0#checks. = checks; |
| 544 | rc = GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 545 | } else { |
| 546 | rc = GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.; |
| 547 | } |
| 548 | GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(rc); |
| 549 | } |
| 550 | |
| 551 | const uint8_tcxx . . $ uint8_t# * |
| 552 | grn_string_get_typescxx . . $ grn_string_get_types(e641985a04b6a30).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *string) |
| 553 | { |
| 554 | uint8_tcxx . . $ uint8_t# *types = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 555 | grn_stringcxx . . $ grn_string# *string_ = (grn_stringcxx . . $ grn_string# *)string; |
| 556 | GRN_API_ENTERcxx . . $ `lib/grn_ctx.h:41:9`!; |
| 557 | if (string_) { |
| 558 | types = string_->ctypescxx . . $ $anonymous_type_a07610201251503c_0#ctypes.; |
| 559 | } else { |
| 560 | types = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 561 | } |
| 562 | GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(types); |
| 563 | } |
| 564 | |
| 565 | grn_rccxx . . $ grn_rc# |
| 566 | grn_string_set_typescxx . . $ grn_string_set_types(5769a8ee0f73e59a).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *string, uint8_tcxx . . $ uint8_t# *types) |
| 567 | { |
| 568 | grn_rccxx . . $ grn_rc# rc; |
| 569 | grn_stringcxx . . $ grn_string# *string_ = (grn_stringcxx . . $ grn_string# *)string; |
| 570 | GRN_API_ENTERcxx . . $ `lib/grn_ctx.h:41:9`!; |
| 571 | if (string_) { |
| 572 | if (string_->ctypescxx . . $ $anonymous_type_a07610201251503c_0#ctypes.) { GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(string_->ctypes); } |
| 573 | string_->ctypescxx . . $ $anonymous_type_a07610201251503c_0#ctypes. = types; |
| 574 | rc = GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 575 | } else { |
| 576 | rc = GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.; |
| 577 | } |
| 578 | GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(rc); |
| 579 | } |
| 580 | |
| 581 | const uint64_tcxx . . $ uint64_t# * |
| 582 | grn_string_get_offsetscxx . . $ grn_string_get_offsets(29c3efd045e091f0).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *string) |
| 583 | { |
| 584 | uint64_tcxx . . $ uint64_t# *offsets = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 585 | grn_stringcxx . . $ grn_string# *string_ = (grn_stringcxx . . $ grn_string# *)string; |
| 586 | GRN_API_ENTERcxx . . $ `lib/grn_ctx.h:41:9`!; |
| 587 | if (string_) { |
| 588 | offsets = string_->offsetscxx . . $ $anonymous_type_a07610201251503c_0#offsets.; |
| 589 | } else { |
| 590 | offsets = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 591 | } |
| 592 | GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(offsets); |
| 593 | } |
| 594 | |
| 595 | grn_rccxx . . $ grn_rc# |
| 596 | grn_string_set_offsetscxx . . $ grn_string_set_offsets(e29362ae0756aae).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *string, uint64_tcxx . . $ uint64_t# *offsets) |
| 597 | { |
| 598 | grn_rccxx . . $ grn_rc# rc; |
| 599 | grn_stringcxx . . $ grn_string# *string_ = (grn_stringcxx . . $ grn_string# *)string; |
| 600 | GRN_API_ENTERcxx . . $ `lib/grn_ctx.h:41:9`!; |
| 601 | if (string_) { |
| 602 | if (string_->offsetscxx . . $ $anonymous_type_a07610201251503c_0#offsets.) { GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(string_->offsets); } |
| 603 | string_->offsetscxx . . $ $anonymous_type_a07610201251503c_0#offsets. = offsets; |
| 604 | rc = GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 605 | } else { |
| 606 | rc = GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.; |
| 607 | } |
| 608 | GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(rc); |
| 609 | } |
| 610 | |
| 611 | grn_encodingcxx . . $ grn_encoding# |
| 612 | grn_string_get_encodingcxx . . $ grn_string_get_encoding(a50aff468d99e115).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *string) |
| 613 | { |
| 614 | grn_encodingcxx . . $ grn_encoding# encoding = GRN_ENC_NONEcxx . . $ GRN_ENC_NONE.; |
| 615 | grn_stringcxx . . $ grn_string# *string_ = (grn_stringcxx . . $ grn_string# *)string; |
| 616 | GRN_API_ENTERcxx . . $ `lib/grn_ctx.h:41:9`!; |
| 617 | if (string_) { |
| 618 | encoding = string_->encodingcxx . . $ $anonymous_type_a07610201251503c_0#encoding.; |
| 619 | } |
| 620 | GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(encoding); |
| 621 | } |
| 622 | |
| 623 | grn_objcxx . . $ grn_obj# * |
| 624 | grn_string_get_tablecxx . . $ grn_string_get_table(e9f40e4080908c1e).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *string) |
| 625 | { |
| 626 | grn_objcxx . . $ grn_obj# *table = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 627 | grn_stringcxx . . $ grn_string# *string_ = (grn_stringcxx . . $ grn_string# *)string; |
| 628 | GRN_API_ENTERcxx . . $ `lib/grn_ctx.h:41:9`!; |
| 629 | if (string_) { |
| 630 | table = string_->lexiconcxx . . $ $anonymous_type_a07610201251503c_0#lexicon.; |
| 631 | } |
| 632 | GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(table); |
| 633 | } |
| 634 | |
| 635 | grn_rccxx . . $ grn_rc# |
| 636 | grn_string_inspectcxx . . $ grn_string_inspect(d825b4ed5bf12304).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *buffer, grn_objcxx . . $ grn_obj# *string) |
| 637 | { |
| 638 | grn_stringcxx . . $ grn_string# *string_ = (grn_stringcxx . . $ grn_string# *)string; |
| 639 | |
| 640 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buffer, "#<string:"); |
| 641 | |
| 642 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buffer, " original:<"); |
| 643 | GRN_TEXT_PUTcxx . . $ `include/groonga/groonga.h:2773:9`!(ctx, buffer, |
| 644 | string_->original, |
| 645 | string_->original_length_in_bytes); |
| 646 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buffer, ">"); |
| 647 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buffer, "("); |
| 648 | grn_text_ulltoacxx . . $ grn_text_ulltoa(cf35b313a8fea93f).(ctx, buffer, string_->original_length_in_bytescxx . . $ $anonymous_type_a07610201251503c_0#original_length_in_bytes.); |
| 649 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buffer, ")"); |
| 650 | |
| 651 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buffer, " normalized:<"); |
| 652 | GRN_TEXT_PUTcxx . . $ `include/groonga/groonga.h:2773:9`!(ctx, buffer, |
| 653 | string_->normalized, |
| 654 | string_->normalized_length_in_bytes); |
| 655 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buffer, ">"); |
| 656 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buffer, "("); |
| 657 | grn_text_ulltoacxx . . $ grn_text_ulltoa(cf35b313a8fea93f).(ctx, buffer, string_->normalized_length_in_bytescxx . . $ $anonymous_type_a07610201251503c_0#normalized_length_in_bytes.); |
| 658 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buffer, ")"); |
| 659 | |
| 660 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buffer, " n_characters:"); |
| 661 | grn_text_ulltoacxx . . $ grn_text_ulltoa(cf35b313a8fea93f).(ctx, buffer, string_->n_characterscxx . . $ $anonymous_type_a07610201251503c_0#n_characters.); |
| 662 | |
| 663 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buffer, " encoding:"); |
| 664 | grn_inspect_encodingcxx . . $ grn_inspect_encoding(b359c70c7e73b39).(ctx, buffer, string_->encodingcxx . . $ $anonymous_type_a07610201251503c_0#encoding.); |
| 665 | |
| 666 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buffer, " flags:"); |
| 667 | if (string_->flagscxx . . $ $anonymous_type_a07610201251503c_0#flags. & GRN_STRING_REMOVE_BLANKcxx . . $ `include/groonga/string.h:52:9`!) { |
| 668 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buffer, "REMOVE_BLANK|"); |
| 669 | } |
| 670 | if (string_->flagscxx . . $ $anonymous_type_a07610201251503c_0#flags. & GRN_STRING_WITH_TYPEScxx . . $ `include/groonga/string.h:53:9`!) { |
| 671 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buffer, "WITH_TYPES|"); |
| 672 | } |
| 673 | if (string_->flagscxx . . $ $anonymous_type_a07610201251503c_0#flags. & GRN_STRING_WITH_CHECKScxx . . $ `include/groonga/string.h:54:9`!) { |
| 674 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buffer, "WITH_CHECKS|"); |
| 675 | } |
| 676 | if (string_->flagscxx . . $ $anonymous_type_a07610201251503c_0#flags. & GRN_STRING_REMOVE_TOKENIZED_DELIMITERcxx . . $ `include/groonga/string.h:55:9`!) { |
| 677 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buffer, "REMOVE_TOKENIZED_DELIMITER|"); |
| 678 | } |
| 679 | if (GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(buffer)[GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(buffer) - 1] == '|') { |
| 680 | grn_bulk_truncatecxx . . $ grn_bulk_truncate(f9a66385f261f61d).(ctx, buffer, GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(buffer) - 1); |
| 681 | } |
| 682 | |
| 683 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buffer, ">"); |
| 684 | |
| 685 | return GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 686 | } |
| 687 | |
| 688 | uint32_tcxx . . $ uint32_t# |
| 689 | grn_string_get_normalizer_indexcxx . . $ grn_string_get_normalizer_index(8dd58acc9865e889).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *string) |
| 690 | { |
| 691 | uint32_tcxx . . $ uint32_t# index = 0; |
| 692 | grn_stringcxx . . $ grn_string# *string_ = (grn_stringcxx . . $ grn_string# *)string; |
| 693 | GRN_API_ENTERcxx . . $ `lib/grn_ctx.h:41:9`!; |
| 694 | if (string_) { |
| 695 | index = string_->normalizer_indexcxx . . $ $anonymous_type_a07610201251503c_0#normalizer_index.; |
| 696 | } |
| 697 | GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(index); |
| 698 | } |
| 699 | |
| 700 | grn_rccxx . . $ grn_rc# |
| 701 | grn_string_fincxx . . $ grn_string_fin(4865d068a46d0f83).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *string) |
| 702 | { |
| 703 | grn_rccxx . . $ grn_rc# rc; |
| 704 | grn_stringcxx . . $ grn_string# *string_ = (grn_stringcxx . . $ grn_string# *)string; |
| 705 | if (string_) { |
| 706 | if (string_->normalizedcxx . . $ $anonymous_type_a07610201251503c_0#normalized.) { |
| 707 | GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(string_->normalized); |
| 708 | string_->normalizedcxx . . $ $anonymous_type_a07610201251503c_0#normalized. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 709 | string_->normalized_length_in_bytescxx . . $ $anonymous_type_a07610201251503c_0#normalized_length_in_bytes. = 0; |
| 710 | string_->n_characterscxx . . $ $anonymous_type_a07610201251503c_0#n_characters. = 0; |
| 711 | } |
| 712 | if (string_->checkscxx . . $ $anonymous_type_a07610201251503c_0#checks.) { |
| 713 | GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(string_->checks); |
| 714 | string_->checkscxx . . $ $anonymous_type_a07610201251503c_0#checks. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 715 | } |
| 716 | if (string_->ctypescxx . . $ $anonymous_type_a07610201251503c_0#ctypes.) { |
| 717 | GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(string_->ctypes); |
| 718 | string_->ctypescxx . . $ $anonymous_type_a07610201251503c_0#ctypes. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 719 | } |
| 720 | if (string_->offsetscxx . . $ $anonymous_type_a07610201251503c_0#offsets.) { |
| 721 | GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(string_->offsets); |
| 722 | string_->ctypescxx . . $ $anonymous_type_a07610201251503c_0#ctypes. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 723 | } |
| 724 | rc = GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 725 | } else { |
| 726 | rc = GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.; |
| 727 | } |
| 728 | return rc; |
| 729 | } |
| 730 | |
| 731 | grn_rccxx . . $ grn_rc# |
| 732 | grn_string_closecxx . . $ grn_string_close(4865d068a46d0f83).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *string) |
| 733 | { |
| 734 | grn_rccxx . . $ grn_rc# rc; |
| 735 | grn_stringcxx . . $ grn_string# *string_ = (grn_stringcxx . . $ grn_string# *)string; |
| 736 | if (string_) { |
| 737 | grn_string_fincxx . . $ grn_string_fin(4865d068a46d0f83).(ctx, string); |
| 738 | GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(string); |
| 739 | rc = GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 740 | } else { |
| 741 | rc = GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.; |
| 742 | } |
| 743 | return rc; |
| 744 | } |