| 1 | /* |
| 2 | Copyright (C) 2009-2017 Brazil |
| 3 | Copyright (C) 2018-2025 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 | #include "grn.h"cxx . . $ `<file>/lib/grn.h`/ |
| 20 | #include <limits.h> |
| 21 | #include <stdarg.h> |
| 22 | #include <string.h> |
| 23 | #include "grn_db.h"cxx . . $ `<file>/lib/grn_db.h`/ |
| 24 | #include "grn_float.h"cxx . . $ `<file>/lib/grn_float.h`/ |
| 25 | #include "grn_str.h"cxx . . $ `<file>/lib/grn_str.h`/ |
| 26 | #include "grn_table.h"cxx . . $ `<file>/lib/grn_table.h`/ |
| 27 | #include "grn_nfkc.h"cxx . . $ `<file>/lib/grn_nfkc.h`/ |
| 28 | |
| 29 | #ifndef _ISOC99_SOURCEcxx . . $ `<external>/18206667465210621810/features.h:222:10`! |
| 30 | # define _ISOC99_SOURCE |
| 31 | #endif /* _ISOC99_SOURCE */ |
| 32 | #include <math.h> |
| 33 | |
| 34 | #if defined(HAVE__GMTIME64_S) && defined(__GNUC__cxx . . $ `<built-in>:8:9`!) |
| 35 | # ifdef _WIN64 |
| 36 | # define gmtime_s(tm, time) _gmtime64_s(tm, time) |
| 37 | # else /* _WIN64 */ |
| 38 | # define gmtime_s(tm, time) _gmtime32_s(tm, time) |
| 39 | # endif /* _WIN64 */ |
| 40 | #endif /* defined(HAVE__GMTIME64_S) && defined(__GNUC__) */ |
| 41 | |
| 42 | static inline int |
| 43 | grn_str_charlen_utf8cxx . . $ grn_str_charlen_utf8(4818c0a2d5114b19).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 44 | const unsigned char *str, |
| 45 | const unsigned char *end) |
| 46 | { |
| 47 | /* MEMO: This function allows non-null-terminated string as str. */ |
| 48 | /* But requires the end of string. */ |
| 49 | if (end <= str || !*str) { |
| 50 | return 0; |
| 51 | } |
| 52 | if (*str & 0x80) { |
| 53 | grn_bit_scan_rev_resultcxx . . $ grn_bit_scan_rev_result# i; |
| 54 | grn_bit_scan_rev_resultcxx . . $ grn_bit_scan_rev_result# len; |
| 55 | GRN_BIT_SCAN_REVcxx . . $ `lib/grn.h:427:11`!(~(((uint32_t)*str) << 24), len); |
| 56 | len = 31 - len; |
| 57 | if ((unsigned int)(len - 2) >= 3) { /* (len == 1 || len >= 5) */ |
| 58 | GRN_LOGcxx . . $ `include/groonga/groonga.h:2493:9`!(ctx, |
| 59 | GRN_LOG_WARNING, |
| 60 | "grn_str_charlen_utf8(): first byte is invalid"); |
| 61 | return 0; |
| 62 | } |
| 63 | if (str + len > end) { |
| 64 | GRN_LOGcxx . . $ `include/groonga/groonga.h:2493:9`!(ctx, |
| 65 | GRN_LOG_WARNING, |
| 66 | "grn_str_charlen_utf8(): incomplete character"); |
| 67 | return 0; |
| 68 | } |
| 69 | for (i = 1; i < len; ++i) { |
| 70 | if ((str[i] & 0xc0) != 0x80) { |
| 71 | GRN_LOGcxx . . $ `include/groonga/groonga.h:2493:9`!(ctx, |
| 72 | GRN_LOG_WARNING, |
| 73 | "grn_str_charlen_utf8(): <%d>th byte is invalid", |
| 74 | i + 1); |
| 75 | return 0; |
| 76 | } |
| 77 | } |
| 78 | return len; |
| 79 | } else { |
| 80 | return 1; |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | unsigned int |
| 85 | grn_str_charlencxx . . $ grn_str_charlen(a865b2e5985991ca).(grn_ctxcxx . . $ grn_ctx# *ctx, const char *str, grn_encodingcxx . . $ grn_encoding# encoding) |
| 86 | { |
| 87 | /* MEMO: This function requires null-terminated string as str.*/ |
| 88 | unsigned char *p = (unsigned char *)str; |
| 89 | if (!*p) { |
| 90 | return 0; |
| 91 | } |
| 92 | switch (encoding) { |
| 93 | case GRN_ENC_EUC_JPcxx . . $ GRN_ENC_EUC_JP.: |
| 94 | if (*p & 0x80) { |
| 95 | if (*(p + 1)) { |
| 96 | return 2; |
| 97 | } else { |
| 98 | /* This is invalid character */ |
| 99 | GRN_LOGcxx . . $ `include/groonga/groonga.h:2493:9`!(ctx, |
| 100 | GRN_LOG_WARNING, |
| 101 | "invalid euc-jp string end on grn_str_charlen"); |
| 102 | return 0; |
| 103 | } |
| 104 | } |
| 105 | return 1; |
| 106 | case GRN_ENC_UTF8cxx . . $ GRN_ENC_UTF8.: |
| 107 | if (*p & 0x80) { |
| 108 | unsigned int b; |
| 109 | unsigned int w; |
| 110 | unsigned int size; |
| 111 | for (b = 0x40, w = 0; b && (*p & b); b >>= 1, w++) |
| 112 | ; |
| 113 | if (w == 0) { |
| 114 | GRN_LOGcxx . . $ `include/groonga/groonga.h:2493:9`!(ctx, |
| 115 | GRN_LOG_WARNING, |
| 116 | "invalid utf8 string(1) on grn_str_charlen"); |
| 117 | return 0; |
| 118 | } |
| 119 | for (size = 1; w--; size++) { |
| 120 | if (!*++p || (*p & 0xc0) != 0x80) { |
| 121 | GRN_LOGcxx . . $ `include/groonga/groonga.h:2493:9`!(ctx, |
| 122 | GRN_LOG_WARNING, |
| 123 | "invalid utf8 string(2) on grn_str_charlen"); |
| 124 | return 0; |
| 125 | } |
| 126 | } |
| 127 | return size; |
| 128 | } else { |
| 129 | return 1; |
| 130 | } |
| 131 | case GRN_ENC_SJIScxx . . $ GRN_ENC_SJIS.: |
| 132 | if (*p & 0x80) { |
| 133 | /* we regard 0xa0 as JIS X 0201 KANA. adjusted to other tools. */ |
| 134 | if (0xa0 <= *p && *p <= 0xdf) { |
| 135 | /* hankaku-kana */ |
| 136 | return 1; |
| 137 | } else if (!(*(p + 1))) { |
| 138 | /* This is invalid character */ |
| 139 | GRN_LOGcxx . . $ `include/groonga/groonga.h:2493:9`!(ctx, |
| 140 | GRN_LOG_WARNING, |
| 141 | "invalid sjis string end on grn_str_charlen"); |
| 142 | return 0; |
| 143 | } else { |
| 144 | return 2; |
| 145 | } |
| 146 | } else { |
| 147 | return 1; |
| 148 | } |
| 149 | default: |
| 150 | return 1; |
| 151 | } |
| 152 | return 0; |
| 153 | } |
| 154 | |
| 155 | int |
| 156 | grn_charlen_cxx . . $ grn_charlen_(b4b53c9e31f93d3e).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 157 | const char *str, |
| 158 | const char *end, |
| 159 | grn_encodingcxx . . $ grn_encoding# encoding) |
| 160 | { |
| 161 | /* MEMO: This function allows non-null-terminated string as str. */ |
| 162 | /* But requires the end of string. */ |
| 163 | unsigned char *p = (unsigned char *)str; |
| 164 | if (p >= (unsigned char *)end) { |
| 165 | return 0; |
| 166 | } |
| 167 | switch (encoding) { |
| 168 | case GRN_ENC_EUC_JPcxx . . $ GRN_ENC_EUC_JP.: |
| 169 | if (*p & 0x80) { |
| 170 | if ((p + 1) < (unsigned char *)end) { |
| 171 | return 2; |
| 172 | } else { |
| 173 | /* This is invalid character */ |
| 174 | GRN_LOGcxx . . $ `include/groonga/groonga.h:2493:9`!(ctx, |
| 175 | GRN_LOG_WARNING, |
| 176 | "invalid euc-jp string end on grn_charlen"); |
| 177 | return 0; |
| 178 | } |
| 179 | } |
| 180 | return 1; |
| 181 | case GRN_ENC_UTF8cxx . . $ GRN_ENC_UTF8.: |
| 182 | return grn_str_charlen_utf8cxx . . $ grn_str_charlen_utf8(4818c0a2d5114b19).(ctx, p, (unsigned char *)end); |
| 183 | case GRN_ENC_SJIScxx . . $ GRN_ENC_SJIS.: |
| 184 | if (*p & 0x80) { |
| 185 | /* we regard 0xa0 as JIS X 0201 KANA. adjusted to other tools. */ |
| 186 | if (0xa0 <= *p && *p <= 0xdf) { |
| 187 | /* hankaku-kana */ |
| 188 | return 1; |
| 189 | } else if (++p >= (unsigned char *)end) { |
| 190 | /* This is invalid character */ |
| 191 | GRN_LOGcxx . . $ `include/groonga/groonga.h:2493:9`!(ctx, GRN_LOG_WARNING, "invalid sjis string end on grn_charlen"); |
| 192 | return 0; |
| 193 | } else { |
| 194 | return 2; |
| 195 | } |
| 196 | } else { |
| 197 | return 1; |
| 198 | } |
| 199 | default: |
| 200 | return 1; |
| 201 | } |
| 202 | return 0; |
| 203 | } |
| 204 | |
| 205 | int |
| 206 | grn_charlencxx . . $ grn_charlen(d229e8bf7c87f0f0).(grn_ctxcxx . . $ grn_ctx# *ctx, const char *str, const char *end) |
| 207 | { |
| 208 | return grn_charlen_cxx . . $ grn_charlen_(b4b53c9e31f93d3e).(ctx, str, end, ctx->encodingcxx . . $ _grn_ctx#encoding.); |
| 209 | } |
| 210 | |
| 211 | static unsigned char symbolcxx . . $ symbol.[] = { |
| 212 | ',', '.', 0, ':', ';', '?', '!', 0, 0, 0, '`', 0, '^', '~', |
| 213 | '_', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '-', '-', '/', |
| 214 | '\\', 0, 0, '|', 0, 0, 0, '\'', 0, '"', '(', ')', 0, 0, |
| 215 | '[', ']', '{', '}', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 216 | '+', '-', 0, 0, 0, '=', 0, '<', '>', 0, 0, 0, 0, 0, |
| 217 | 0, 0, 0, 0, 0, 0, '$', 0, 0, '%', '#', '&', '*', '@', |
| 218 | 0, 0, 0, 0, 0, 0, 0, 0}; |
| 219 | |
| 220 | static inline grn_rccxx . . $ grn_rc# |
| 221 | normalize_euccxx . . $ normalize_euc(72a51f2029f0fbdb).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_strcxx . . $ grn_str# *nstr) |
| 222 | { |
| 223 | static uint16_tcxx . . $ uint16_t# hankana[] = { |
| 224 | 0xa1a1, 0xa1a3, 0xa1d6, 0xa1d7, 0xa1a2, 0xa1a6, 0xa5f2, 0xa5a1, |
| 225 | 0xa5a3, 0xa5a5, 0xa5a7, 0xa5a9, 0xa5e3, 0xa5e5, 0xa5e7, 0xa5c3, |
| 226 | 0xa1bc, 0xa5a2, 0xa5a4, 0xa5a6, 0xa5a8, 0xa5aa, 0xa5ab, 0xa5ad, |
| 227 | 0xa5af, 0xa5b1, 0xa5b3, 0xa5b5, 0xa5b7, 0xa5b9, 0xa5bb, 0xa5bd, |
| 228 | 0xa5bf, 0xa5c1, 0xa5c4, 0xa5c6, 0xa5c8, 0xa5ca, 0xa5cb, 0xa5cc, |
| 229 | 0xa5cd, 0xa5ce, 0xa5cf, 0xa5d2, 0xa5d5, 0xa5d8, 0xa5db, 0xa5de, |
| 230 | 0xa5df, 0xa5e0, 0xa5e1, 0xa5e2, 0xa5e4, 0xa5e6, 0xa5e8, 0xa5e9, |
| 231 | 0xa5ea, 0xa5eb, 0xa5ec, 0xa5ed, 0xa5ef, 0xa5f3, 0xa1ab, 0xa1eb}; |
| 232 | static unsigned char dakuten[] = { |
| 233 | 0xf4, 0, 0, 0, 0, 0xac, 0, 0xae, 0, 0xb0, 0, |
| 234 | 0xb2, 0, 0xb4, 0, 0xb6, 0, 0xb8, 0, 0xba, 0, 0xbc, |
| 235 | 0, 0xbe, 0, 0xc0, 0, 0xc2, 0, 0, 0xc5, 0, 0xc7, |
| 236 | 0, 0xc9, 0, 0, 0, 0, 0, 0, 0xd0, 0, 0, |
| 237 | 0xd3, 0, 0, 0xd6, 0, 0, 0xd9, 0, 0, 0xdc}; |
| 238 | static unsigned char handaku[] = |
| 239 | {0xd1, 0, 0, 0xd4, 0, 0, 0xd7, 0, 0, 0xda, 0, 0, 0xdd}; |
| 240 | int16_tcxx . . $ int16_t# *ch; |
| 241 | const unsigned char *s, *s_, *e; |
| 242 | unsigned char *d, *d0, *d_, b; |
| 243 | uint_least8_tcxx . . $ uint_least8_t# *cp, *ctypes, ctype; |
| 244 | unsigned int size = nstr->orig_blencxx . . $ $anonymous_type_8b55e593c0863bb2_0#orig_blen.; |
| 245 | unsigned int length = 0; |
| 246 | int removeblankp = nstr->flagscxx . . $ $anonymous_type_8b55e593c0863bb2_0#flags. & GRN_STR_REMOVEBLANKcxx . . $ `include/groonga/string.h:40:9`!; |
| 247 | if (!(nstr->normcxx . . $ $anonymous_type_8b55e593c0863bb2_0#norm. = GRN_MALLOCcxx . . $ `lib/grn_alloc.h:41:9`!(size * 2 + 1))) { |
| 248 | return GRN_NO_MEMORY_AVAILABLEcxx . . $ GRN_NO_MEMORY_AVAILABLE.; |
| 249 | } |
| 250 | d0 = (unsigned char *)nstr->normcxx . . $ $anonymous_type_8b55e593c0863bb2_0#norm.; |
| 251 | if (nstr->flagscxx . . $ $anonymous_type_8b55e593c0863bb2_0#flags. & GRN_STR_WITH_CHECKScxx . . $ `include/groonga/string.h:42:9`!) { |
| 252 | if (!(nstr->checkscxx . . $ $anonymous_type_8b55e593c0863bb2_0#checks. = GRN_MALLOCcxx . . $ `lib/grn_alloc.h:41:9`!(size * 2 * sizeof(int16_t) + 1))) { |
| 253 | GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(nstr->norm); |
| 254 | nstr->normcxx . . $ $anonymous_type_8b55e593c0863bb2_0#norm. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 255 | return GRN_NO_MEMORY_AVAILABLEcxx . . $ GRN_NO_MEMORY_AVAILABLE.; |
| 256 | } |
| 257 | } |
| 258 | ch = nstr->checkscxx . . $ $anonymous_type_8b55e593c0863bb2_0#checks.; |
| 259 | if (nstr->flagscxx . . $ $anonymous_type_8b55e593c0863bb2_0#flags. & GRN_STR_WITH_CTYPEScxx . . $ `include/groonga/string.h:41:9`!) { |
| 260 | if (!(nstr->ctypescxx . . $ $anonymous_type_8b55e593c0863bb2_0#ctypes. = GRN_MALLOCcxx . . $ `lib/grn_alloc.h:41:9`!(size + 1))) { |
| 261 | GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(nstr->checks); |
| 262 | GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(nstr->norm); |
| 263 | nstr->checkscxx . . $ $anonymous_type_8b55e593c0863bb2_0#checks. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 264 | nstr->normcxx . . $ $anonymous_type_8b55e593c0863bb2_0#norm. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 265 | return GRN_NO_MEMORY_AVAILABLEcxx . . $ GRN_NO_MEMORY_AVAILABLE.; |
| 266 | } |
| 267 | } |
| 268 | cp = ctypes = nstr->ctypescxx . . $ $anonymous_type_8b55e593c0863bb2_0#ctypes.; |
| 269 | e = (unsigned char *)nstr->origcxx . . $ $anonymous_type_8b55e593c0863bb2_0#orig. + size; |
| 270 | for (s = s_ = (unsigned char *)nstr->origcxx . . $ $anonymous_type_8b55e593c0863bb2_0#orig., d = d_ = d0; s < e; s++) { |
| 271 | if ((*s & 0x80)) { |
| 272 | if (((s + 1) < e) && (*(s + 1) & 0x80)) { |
| 273 | unsigned char c1 = *s++, c2 = *s, c3 = 0; |
| 274 | switch (c1 >> 4) { |
| 275 | case 0x08: |
| 276 | if (c1 == 0x8e && 0xa0 <= c2 && c2 <= 0xdf) { |
| 277 | uint16_tcxx . . $ uint16_t# c = hankana[c2 - 0xa0]; |
| 278 | switch (c) { |
| 279 | case 0xa1ab: |
| 280 | if (d > d0 + 1 && d[-2] == 0xa5 && 0xa6 <= d[-1] && |
| 281 | d[-1] <= 0xdb && (b = dakuten[d[-1] - 0xa6])) { |
| 282 | *(d - 1) = b; |
| 283 | if (ch) { |
| 284 | ch[-1] += 2; |
| 285 | s_ += 2; |
| 286 | } |
| 287 | continue; |
| 288 | } else { |
| 289 | *d++ = (unsigned char)(c >> 8); |
| 290 | *d = (unsigned char)(c & 0xff); |
| 291 | } |
| 292 | break; |
| 293 | case 0xa1eb: |
| 294 | if (d > d0 + 1 && d[-2] == 0xa5 && 0xcf <= d[-1] && |
| 295 | d[-1] <= 0xdb && (b = handaku[d[-1] - 0xcf])) { |
| 296 | *(d - 1) = b; |
| 297 | if (ch) { |
| 298 | ch[-1] += 2; |
| 299 | s_ += 2; |
| 300 | } |
| 301 | continue; |
| 302 | } else { |
| 303 | *d++ = (unsigned char)(c >> 8); |
| 304 | *d = (unsigned char)(c & 0xff); |
| 305 | } |
| 306 | break; |
| 307 | default: |
| 308 | *d++ = (unsigned char)(c >> 8); |
| 309 | *d = (unsigned char)(c & 0xff); |
| 310 | break; |
| 311 | } |
| 312 | ctype = GRN_CHAR_KATAKANAcxx . . $ GRN_CHAR_KATAKANA.; |
| 313 | } else { |
| 314 | *d++ = c1; |
| 315 | *d = c2; |
| 316 | ctype = GRN_CHAR_OTHERScxx . . $ GRN_CHAR_OTHERS.; |
| 317 | } |
| 318 | break; |
| 319 | case 0x09: |
| 320 | *d++ = c1; |
| 321 | *d = c2; |
| 322 | ctype = GRN_CHAR_OTHERScxx . . $ GRN_CHAR_OTHERS.; |
| 323 | break; |
| 324 | case 0x0a: |
| 325 | switch (c1 & 0x0f) { |
| 326 | case 1: |
| 327 | switch (c2) { |
| 328 | case 0xbc: |
| 329 | *d++ = c1; |
| 330 | *d = c2; |
| 331 | ctype = GRN_CHAR_KATAKANAcxx . . $ GRN_CHAR_KATAKANA.; |
| 332 | break; |
| 333 | case 0xb9: |
| 334 | *d++ = c1; |
| 335 | *d = c2; |
| 336 | ctype = GRN_CHAR_KANJIcxx . . $ GRN_CHAR_KANJI.; |
| 337 | break; |
| 338 | case 0xa1: |
| 339 | if (removeblankp) { |
| 340 | if (cp > ctypes) { |
| 341 | *(cp - 1) |= GRN_STR_BLANKcxx . . $ `lib/grn_str.h:51:9`!; |
| 342 | } |
| 343 | continue; |
| 344 | } else { |
| 345 | *d = ' '; |
| 346 | ctype = GRN_STR_BLANKcxx . . $ `lib/grn_str.h:51:9`! | GRN_CHAR_SYMBOLcxx . . $ GRN_CHAR_SYMBOL.; |
| 347 | } |
| 348 | break; |
| 349 | default: |
| 350 | if (c2 >= 0xa4 && (c3 = symbolcxx . . $ symbol.[c2 - 0xa4])) { |
| 351 | *d = c3; |
| 352 | ctype = GRN_CHAR_SYMBOLcxx . . $ GRN_CHAR_SYMBOL.; |
| 353 | } else { |
| 354 | *d++ = c1; |
| 355 | *d = c2; |
| 356 | ctype = GRN_CHAR_OTHERScxx . . $ GRN_CHAR_OTHERS.; |
| 357 | } |
| 358 | break; |
| 359 | } |
| 360 | break; |
| 361 | case 2: |
| 362 | *d++ = c1; |
| 363 | *d = c2; |
| 364 | ctype = GRN_CHAR_SYMBOLcxx . . $ GRN_CHAR_SYMBOL.; |
| 365 | break; |
| 366 | case 3: |
| 367 | c3 = c2 - 0x80; |
| 368 | if ('a' <= c3 && c3 <= 'z') { |
| 369 | ctype = GRN_CHAR_ALPHAcxx . . $ GRN_CHAR_ALPHA.; |
| 370 | *d = c3; |
| 371 | } else if ('A' <= c3 && c3 <= 'Z') { |
| 372 | ctype = GRN_CHAR_ALPHAcxx . . $ GRN_CHAR_ALPHA.; |
| 373 | *d = c3 + 0x20; |
| 374 | } else if ('0' <= c3 && c3 <= '9') { |
| 375 | ctype = GRN_CHAR_DIGITcxx . . $ GRN_CHAR_DIGIT.; |
| 376 | *d = c3; |
| 377 | } else { |
| 378 | ctype = GRN_CHAR_OTHERScxx . . $ GRN_CHAR_OTHERS.; |
| 379 | *d++ = c1; |
| 380 | *d = c2; |
| 381 | } |
| 382 | break; |
| 383 | case 4: |
| 384 | *d++ = c1; |
| 385 | *d = c2; |
| 386 | ctype = GRN_CHAR_HIRAGANAcxx . . $ GRN_CHAR_HIRAGANA.; |
| 387 | break; |
| 388 | case 5: |
| 389 | *d++ = c1; |
| 390 | *d = c2; |
| 391 | ctype = GRN_CHAR_KATAKANAcxx . . $ GRN_CHAR_KATAKANA.; |
| 392 | break; |
| 393 | case 6: |
| 394 | case 7: |
| 395 | case 8: |
| 396 | *d++ = c1; |
| 397 | *d = c2; |
| 398 | ctype = GRN_CHAR_SYMBOLcxx . . $ GRN_CHAR_SYMBOL.; |
| 399 | break; |
| 400 | default: |
| 401 | *d++ = c1; |
| 402 | *d = c2; |
| 403 | ctype = GRN_CHAR_OTHERScxx . . $ GRN_CHAR_OTHERS.; |
| 404 | break; |
| 405 | } |
| 406 | break; |
| 407 | default: |
| 408 | *d++ = c1; |
| 409 | *d = c2; |
| 410 | ctype = GRN_CHAR_KANJIcxx . . $ GRN_CHAR_KANJI.; |
| 411 | break; |
| 412 | } |
| 413 | } else { |
| 414 | /* skip invalid character */ |
| 415 | continue; |
| 416 | } |
| 417 | } else { |
| 418 | unsigned char c = *s; |
| 419 | switch (c >> 4) { |
| 420 | case 0: |
| 421 | case 1: |
| 422 | /* skip unprintable ascii */ |
| 423 | if (cp > ctypes) { |
| 424 | *(cp - 1) |= GRN_STR_BLANKcxx . . $ `lib/grn_str.h:51:9`!; |
| 425 | } |
| 426 | continue; |
| 427 | case 2: |
| 428 | if (c == 0x20) { |
| 429 | if (removeblankp) { |
| 430 | if (cp > ctypes) { |
| 431 | *(cp - 1) |= GRN_STR_BLANKcxx . . $ `lib/grn_str.h:51:9`!; |
| 432 | } |
| 433 | continue; |
| 434 | } else { |
| 435 | *d = ' '; |
| 436 | ctype = GRN_STR_BLANKcxx . . $ `lib/grn_str.h:51:9`! | GRN_CHAR_SYMBOLcxx . . $ GRN_CHAR_SYMBOL.; |
| 437 | } |
| 438 | } else { |
| 439 | *d = c; |
| 440 | ctype = GRN_CHAR_SYMBOLcxx . . $ GRN_CHAR_SYMBOL.; |
| 441 | } |
| 442 | break; |
| 443 | case 3: |
| 444 | *d = c; |
| 445 | ctype = (c <= 0x39) ? GRN_CHAR_DIGITcxx . . $ GRN_CHAR_DIGIT. : GRN_CHAR_SYMBOLcxx . . $ GRN_CHAR_SYMBOL.; |
| 446 | break; |
| 447 | case 4: |
| 448 | *d = ('A' <= c) ? c + 0x20 : c; |
| 449 | ctype = (c == 0x40) ? GRN_CHAR_SYMBOLcxx . . $ GRN_CHAR_SYMBOL. : GRN_CHAR_ALPHAcxx . . $ GRN_CHAR_ALPHA.; |
| 450 | break; |
| 451 | case 5: |
| 452 | *d = (c <= 'Z') ? c + 0x20 : c; |
| 453 | ctype = (c <= 0x5a) ? GRN_CHAR_ALPHAcxx . . $ GRN_CHAR_ALPHA. : GRN_CHAR_SYMBOLcxx . . $ GRN_CHAR_SYMBOL.; |
| 454 | break; |
| 455 | case 6: |
| 456 | *d = c; |
| 457 | ctype = (c == 0x60) ? GRN_CHAR_SYMBOLcxx . . $ GRN_CHAR_SYMBOL. : GRN_CHAR_ALPHAcxx . . $ GRN_CHAR_ALPHA.; |
| 458 | break; |
| 459 | case 7: |
| 460 | *d = c; |
| 461 | ctype = (c <= 0x7a) ? GRN_CHAR_ALPHAcxx . . $ GRN_CHAR_ALPHA. |
| 462 | : (c == 0x7f ? GRN_CHAR_OTHERScxx . . $ GRN_CHAR_OTHERS. : GRN_CHAR_SYMBOLcxx . . $ GRN_CHAR_SYMBOL.); |
| 463 | break; |
| 464 | default: |
| 465 | *d = c; |
| 466 | ctype = GRN_CHAR_OTHERScxx . . $ GRN_CHAR_OTHERS.; |
| 467 | break; |
| 468 | } |
| 469 | } |
| 470 | d++; |
| 471 | length++; |
| 472 | if (cp) { |
| 473 | *cp++ = ctype; |
| 474 | } |
| 475 | if (ch) { |
| 476 | *ch++ = (int16_tcxx . . $ int16_t#)(s + 1 - s_); |
| 477 | s_ = s + 1; |
| 478 | while (++d_ < d) { |
| 479 | *ch++ = 0; |
| 480 | } |
| 481 | } |
| 482 | } |
| 483 | if (cp) { |
| 484 | *cp = GRN_CHAR_NULLcxx . . $ GRN_CHAR_NULL.; |
| 485 | } |
| 486 | *d = '\0'; |
| 487 | nstr->lengthcxx . . $ $anonymous_type_8b55e593c0863bb2_0#length. = length; |
| 488 | nstr->norm_blencxx . . $ $anonymous_type_8b55e593c0863bb2_0#norm_blen. = (unsigned int)(d - (unsigned char *)nstr->normcxx . . $ $anonymous_type_8b55e593c0863bb2_0#norm.); |
| 489 | return GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 490 | } |
| 491 | |
| 492 | #ifdef GRN_WITH_NFKCcxx . . $ `build/config.h:110:9`! |
| 493 | static inline grn_rccxx . . $ grn_rc# |
| 494 | normalize_utf8cxx . . $ normalize_utf8(72a51f2029f0fbdb).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_strcxx . . $ grn_str# *nstr) |
| 495 | { |
| 496 | int16_tcxx . . $ int16_t# *ch; |
| 497 | const unsigned char *s, *s_, *s__ = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, *p, *p2, *pe, *e; |
| 498 | unsigned char *d, *d_, *de; |
| 499 | uint_least8_tcxx . . $ uint_least8_t# *cp; |
| 500 | unsigned int length = 0; |
| 501 | int ls; |
| 502 | int lp; |
| 503 | unsigned int size = nstr->orig_blencxx . . $ $anonymous_type_8b55e593c0863bb2_0#orig_blen.; |
| 504 | unsigned int ds = size * 3; |
| 505 | int removeblankp = nstr->flagscxx . . $ $anonymous_type_8b55e593c0863bb2_0#flags. & GRN_STR_REMOVEBLANKcxx . . $ `include/groonga/string.h:40:9`!; |
| 506 | if (!(nstr->normcxx . . $ $anonymous_type_8b55e593c0863bb2_0#norm. = GRN_MALLOCcxx . . $ `lib/grn_alloc.h:41:9`!(ds + 1))) { |
| 507 | return GRN_NO_MEMORY_AVAILABLEcxx . . $ GRN_NO_MEMORY_AVAILABLE.; |
| 508 | } |
| 509 | if (nstr->flagscxx . . $ $anonymous_type_8b55e593c0863bb2_0#flags. & GRN_STR_WITH_CHECKScxx . . $ `include/groonga/string.h:42:9`!) { |
| 510 | if (!(nstr->checkscxx . . $ $anonymous_type_8b55e593c0863bb2_0#checks. = GRN_MALLOCcxx . . $ `lib/grn_alloc.h:41:9`!(ds * sizeof(int16_t) + 1))) { |
| 511 | GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(nstr->norm); |
| 512 | nstr->normcxx . . $ $anonymous_type_8b55e593c0863bb2_0#norm. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 513 | return GRN_NO_MEMORY_AVAILABLEcxx . . $ GRN_NO_MEMORY_AVAILABLE.; |
| 514 | } |
| 515 | } |
| 516 | ch = nstr->checkscxx . . $ $anonymous_type_8b55e593c0863bb2_0#checks.; |
| 517 | if (nstr->flagscxx . . $ $anonymous_type_8b55e593c0863bb2_0#flags. & GRN_STR_WITH_CTYPEScxx . . $ `include/groonga/string.h:41:9`!) { |
| 518 | if (!(nstr->ctypescxx . . $ $anonymous_type_8b55e593c0863bb2_0#ctypes. = GRN_MALLOCcxx . . $ `lib/grn_alloc.h:41:9`!(ds + 1))) { |
| 519 | if (nstr->checkscxx . . $ $anonymous_type_8b55e593c0863bb2_0#checks.) { |
| 520 | GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(nstr->checks); |
| 521 | nstr->checkscxx . . $ $anonymous_type_8b55e593c0863bb2_0#checks. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 522 | } |
| 523 | GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(nstr->norm); |
| 524 | nstr->normcxx . . $ $anonymous_type_8b55e593c0863bb2_0#norm. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 525 | return GRN_NO_MEMORY_AVAILABLEcxx . . $ GRN_NO_MEMORY_AVAILABLE.; |
| 526 | } |
| 527 | } |
| 528 | cp = nstr->ctypescxx . . $ $anonymous_type_8b55e593c0863bb2_0#ctypes.; |
| 529 | d = (unsigned char *)nstr->normcxx . . $ $anonymous_type_8b55e593c0863bb2_0#norm.; |
| 530 | de = d + ds; |
| 531 | d_ = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 532 | e = (unsigned char *)nstr->origcxx . . $ $anonymous_type_8b55e593c0863bb2_0#orig. + size; |
| 533 | for (s = s_ = (unsigned char *)nstr->origcxx . . $ $anonymous_type_8b55e593c0863bb2_0#orig.;; s += ls) { |
| 534 | if (!(ls = grn_str_charlen_utf8cxx . . $ grn_str_charlen_utf8(4818c0a2d5114b19).(ctx, s, e))) { |
| 535 | break; |
| 536 | } |
| 537 | if ((p = (unsigned char *)grn_nfkc_decomposecxx . . $ grn_nfkc_decompose(366f986dcc4a6ef).(s))) { |
| 538 | pe = p + strlencxx . . $ strlen(751346f8406fd082).((char *)p); |
| 539 | } else { |
| 540 | p = s; |
| 541 | pe = p + ls; |
| 542 | } |
| 543 | if (d_ && (p2 = (unsigned char *)grn_nfkc_composecxx . . $ grn_nfkc_compose(95490b1495f9e841).(d_, p))) { |
| 544 | p = p2; |
| 545 | pe = p + strlencxx . . $ strlen(751346f8406fd082).((char *)p); |
| 546 | if (cp) { |
| 547 | cp--; |
| 548 | } |
| 549 | if (ch) { |
| 550 | ch -= (d - d_); |
| 551 | s_ = s__; |
| 552 | } |
| 553 | d = d_; |
| 554 | length--; |
| 555 | } |
| 556 | for (;; p += lp) { |
| 557 | if (!(lp = grn_str_charlen_utf8cxx . . $ grn_str_charlen_utf8(4818c0a2d5114b19).(ctx, p, pe))) { |
| 558 | break; |
| 559 | } |
| 560 | if ((*p == ' ' && removeblankp) || |
| 561 | *p < 0x20 /* skip unprintable ascii */) { |
| 562 | if (cp > nstr->ctypescxx . . $ $anonymous_type_8b55e593c0863bb2_0#ctypes.) { |
| 563 | *(cp - 1) |= GRN_STR_BLANKcxx . . $ `lib/grn_str.h:51:9`!; |
| 564 | } |
| 565 | } else { |
| 566 | if (de <= d + lp) { |
| 567 | unsigned char *norm; |
| 568 | ds += (ds >> 1) + (unsigned int)lp; |
| 569 | if (!(norm = GRN_REALLOCcxx . . $ `lib/grn_alloc.h:43:9`!(nstr->norm, ds + 1))) { |
| 570 | if (nstr->ctypescxx . . $ $anonymous_type_8b55e593c0863bb2_0#ctypes.) { |
| 571 | GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(nstr->ctypes); |
| 572 | nstr->ctypescxx . . $ $anonymous_type_8b55e593c0863bb2_0#ctypes. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 573 | } |
| 574 | if (nstr->checkscxx . . $ $anonymous_type_8b55e593c0863bb2_0#checks.) { |
| 575 | GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(nstr->checks); |
| 576 | nstr->checkscxx . . $ $anonymous_type_8b55e593c0863bb2_0#checks. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 577 | } |
| 578 | GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(nstr->norm); |
| 579 | nstr->normcxx . . $ $anonymous_type_8b55e593c0863bb2_0#norm. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 580 | return GRN_NO_MEMORY_AVAILABLEcxx . . $ GRN_NO_MEMORY_AVAILABLE.; |
| 581 | } |
| 582 | de = norm + ds; |
| 583 | d = norm + (d - (unsigned char *)nstr->normcxx . . $ $anonymous_type_8b55e593c0863bb2_0#norm.); |
| 584 | nstr->normcxx . . $ $anonymous_type_8b55e593c0863bb2_0#norm. = (char *)norm; |
| 585 | if (ch) { |
| 586 | int16_tcxx . . $ int16_t# *checks; |
| 587 | if (!(checks = |
| 588 | GRN_REALLOCcxx . . $ `lib/grn_alloc.h:43:9`!(nstr->checks, ds * sizeof(int16_t) + 1))) { |
| 589 | if (nstr->ctypescxx . . $ $anonymous_type_8b55e593c0863bb2_0#ctypes.) { |
| 590 | GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(nstr->ctypes); |
| 591 | nstr->ctypescxx . . $ $anonymous_type_8b55e593c0863bb2_0#ctypes. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 592 | } |
| 593 | GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(nstr->checks); |
| 594 | nstr->checkscxx . . $ $anonymous_type_8b55e593c0863bb2_0#checks. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 595 | GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(nstr->norm); |
| 596 | nstr->normcxx . . $ $anonymous_type_8b55e593c0863bb2_0#norm. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 597 | return GRN_NO_MEMORY_AVAILABLEcxx . . $ GRN_NO_MEMORY_AVAILABLE.; |
| 598 | } |
| 599 | ch = checks + (ch - nstr->checkscxx . . $ $anonymous_type_8b55e593c0863bb2_0#checks.); |
| 600 | nstr->checkscxx . . $ $anonymous_type_8b55e593c0863bb2_0#checks. = checks; |
| 601 | } |
| 602 | if (cp) { |
| 603 | uint_least8_tcxx . . $ uint_least8_t# *ctypes; |
| 604 | if (!(ctypes = GRN_REALLOCcxx . . $ `lib/grn_alloc.h:43:9`!(nstr->ctypes, ds + 1))) { |
| 605 | GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(nstr->ctypes); |
| 606 | nstr->ctypescxx . . $ $anonymous_type_8b55e593c0863bb2_0#ctypes. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 607 | if (nstr->checkscxx . . $ $anonymous_type_8b55e593c0863bb2_0#checks.) { |
| 608 | GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(nstr->checks); |
| 609 | nstr->checkscxx . . $ $anonymous_type_8b55e593c0863bb2_0#checks. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 610 | } |
| 611 | GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(nstr->norm); |
| 612 | nstr->normcxx . . $ $anonymous_type_8b55e593c0863bb2_0#norm. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 613 | return GRN_NO_MEMORY_AVAILABLEcxx . . $ GRN_NO_MEMORY_AVAILABLE.; |
| 614 | } |
| 615 | cp = ctypes + (cp - nstr->ctypescxx . . $ $anonymous_type_8b55e593c0863bb2_0#ctypes.); |
| 616 | nstr->ctypescxx . . $ $anonymous_type_8b55e593c0863bb2_0#ctypes. = ctypes; |
| 617 | } |
| 618 | } |
| 619 | grn_memcpycxx . . $ `include/groonga/portability.h:32:13`!(d, p, (size_t)lp); |
| 620 | d_ = d; |
| 621 | d += lp; |
| 622 | length++; |
| 623 | if (cp) { |
| 624 | *cp++ = grn_nfkc_char_typecxx . . $ grn_nfkc_char_type(9f045321b9ef9a8a).(p); |
| 625 | } |
| 626 | if (ch) { |
| 627 | int i; |
| 628 | if (s_ == s + ls) { |
| 629 | *ch++ = -1; |
| 630 | } else { |
| 631 | *ch++ = (int16_tcxx . . $ int16_t#)(s + ls - s_); |
| 632 | s__ = s_; |
| 633 | s_ = s + ls; |
| 634 | } |
| 635 | for (i = lp; i > 1; i--) { |
| 636 | *ch++ = 0; |
| 637 | } |
| 638 | } |
| 639 | } |
| 640 | } |
| 641 | } |
| 642 | if (cp) { |
| 643 | *cp = GRN_CHAR_NULLcxx . . $ GRN_CHAR_NULL.; |
| 644 | } |
| 645 | *d = '\0'; |
| 646 | nstr->lengthcxx . . $ $anonymous_type_8b55e593c0863bb2_0#length. = length; |
| 647 | nstr->norm_blencxx . . $ $anonymous_type_8b55e593c0863bb2_0#norm_blen. = (unsigned int)(d - (unsigned char *)nstr->normcxx . . $ $anonymous_type_8b55e593c0863bb2_0#norm.); |
| 648 | return GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 649 | } |
| 650 | #endif /* GRN_WITH_NFKC */ |
| 651 | |
| 652 | static inline grn_rccxx . . $ grn_rc# |
| 653 | normalize_sjiscxx . . $ normalize_sjis(72a51f2029f0fbdb).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_strcxx . . $ grn_str# *nstr) |
| 654 | { |
| 655 | static uint16_tcxx . . $ uint16_t# hankana[] = { |
| 656 | 0x8140, 0x8142, 0x8175, 0x8176, 0x8141, 0x8145, 0x8392, 0x8340, |
| 657 | 0x8342, 0x8344, 0x8346, 0x8348, 0x8383, 0x8385, 0x8387, 0x8362, |
| 658 | 0x815b, 0x8341, 0x8343, 0x8345, 0x8347, 0x8349, 0x834a, 0x834c, |
| 659 | 0x834e, 0x8350, 0x8352, 0x8354, 0x8356, 0x8358, 0x835a, 0x835c, |
| 660 | 0x835e, 0x8360, 0x8363, 0x8365, 0x8367, 0x8369, 0x836a, 0x836b, |
| 661 | 0x836c, 0x836d, 0x836e, 0x8371, 0x8374, 0x8377, 0x837a, 0x837d, |
| 662 | 0x837e, 0x8380, 0x8381, 0x8382, 0x8384, 0x8386, 0x8388, 0x8389, |
| 663 | 0x838a, 0x838b, 0x838c, 0x838d, 0x838f, 0x8393, 0x814a, 0x814b}; |
| 664 | static unsigned char dakuten[] = { |
| 665 | 0x94, 0, 0, 0, 0, 0x4b, 0, 0x4d, 0, 0x4f, 0, |
| 666 | 0x51, 0, 0x53, 0, 0x55, 0, 0x57, 0, 0x59, 0, 0x5b, |
| 667 | 0, 0x5d, 0, 0x5f, 0, 0x61, 0, 0, 0x64, 0, 0x66, |
| 668 | 0, 0x68, 0, 0, 0, 0, 0, 0, 0x6f, 0, 0, |
| 669 | 0x72, 0, 0, 0x75, 0, 0, 0x78, 0, 0, 0x7b}; |
| 670 | static unsigned char handaku[] = |
| 671 | {0x70, 0, 0, 0x73, 0, 0, 0x76, 0, 0, 0x79, 0, 0, 0x7c}; |
| 672 | int16_tcxx . . $ int16_t# *ch; |
| 673 | const unsigned char *s, *s_; |
| 674 | unsigned char *d, *d0, *d_, b, *e; |
| 675 | uint_least8_tcxx . . $ uint_least8_t# *cp, *ctypes, ctype; |
| 676 | unsigned int size = nstr->orig_blencxx . . $ $anonymous_type_8b55e593c0863bb2_0#orig_blen.; |
| 677 | unsigned int length = 0; |
| 678 | int removeblankp = nstr->flagscxx . . $ $anonymous_type_8b55e593c0863bb2_0#flags. & GRN_STR_REMOVEBLANKcxx . . $ `include/groonga/string.h:40:9`!; |
| 679 | if (!(nstr->normcxx . . $ $anonymous_type_8b55e593c0863bb2_0#norm. = GRN_MALLOCcxx . . $ `lib/grn_alloc.h:41:9`!(size * 2 + 1))) { |
| 680 | return GRN_NO_MEMORY_AVAILABLEcxx . . $ GRN_NO_MEMORY_AVAILABLE.; |
| 681 | } |
| 682 | d0 = (unsigned char *)nstr->normcxx . . $ $anonymous_type_8b55e593c0863bb2_0#norm.; |
| 683 | if (nstr->flagscxx . . $ $anonymous_type_8b55e593c0863bb2_0#flags. & GRN_STR_WITH_CHECKScxx . . $ `include/groonga/string.h:42:9`!) { |
| 684 | if (!(nstr->checkscxx . . $ $anonymous_type_8b55e593c0863bb2_0#checks. = GRN_MALLOCcxx . . $ `lib/grn_alloc.h:41:9`!(size * 2 * sizeof(int16_t) + 1))) { |
| 685 | GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(nstr->norm); |
| 686 | nstr->normcxx . . $ $anonymous_type_8b55e593c0863bb2_0#norm. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 687 | return GRN_NO_MEMORY_AVAILABLEcxx . . $ GRN_NO_MEMORY_AVAILABLE.; |
| 688 | } |
| 689 | } |
| 690 | ch = nstr->checkscxx . . $ $anonymous_type_8b55e593c0863bb2_0#checks.; |
| 691 | if (nstr->flagscxx . . $ $anonymous_type_8b55e593c0863bb2_0#flags. & GRN_STR_WITH_CTYPEScxx . . $ `include/groonga/string.h:41:9`!) { |
| 692 | if (!(nstr->ctypescxx . . $ $anonymous_type_8b55e593c0863bb2_0#ctypes. = GRN_MALLOCcxx . . $ `lib/grn_alloc.h:41:9`!(size + 1))) { |
| 693 | GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(nstr->checks); |
| 694 | GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(nstr->norm); |
| 695 | nstr->checkscxx . . $ $anonymous_type_8b55e593c0863bb2_0#checks. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 696 | nstr->normcxx . . $ $anonymous_type_8b55e593c0863bb2_0#norm. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 697 | return GRN_NO_MEMORY_AVAILABLEcxx . . $ GRN_NO_MEMORY_AVAILABLE.; |
| 698 | } |
| 699 | } |
| 700 | cp = ctypes = nstr->ctypescxx . . $ $anonymous_type_8b55e593c0863bb2_0#ctypes.; |
| 701 | e = (unsigned char *)nstr->origcxx . . $ $anonymous_type_8b55e593c0863bb2_0#orig. + size; |
| 702 | for (s = s_ = (unsigned char *)nstr->origcxx . . $ $anonymous_type_8b55e593c0863bb2_0#orig., d = d_ = d0; s < e; s++) { |
| 703 | if ((*s & 0x80)) { |
| 704 | if (0xa0 <= *s && *s <= 0xdf) { |
| 705 | uint16_tcxx . . $ uint16_t# c = hankana[*s - 0xa0]; |
| 706 | switch (c) { |
| 707 | case 0x814a: |
| 708 | if (d > d0 + 1 && d[-2] == 0x83 && 0x45 <= d[-1] && d[-1] <= 0x7a && |
| 709 | (b = dakuten[d[-1] - 0x45])) { |
| 710 | *(d - 1) = b; |
| 711 | if (ch) { |
| 712 | ch[-1]++; |
| 713 | s_++; |
| 714 | } |
| 715 | continue; |
| 716 | } else { |
| 717 | *d++ = (unsigned char)(c >> 8); |
| 718 | *d = (unsigned char)(c & 0xff); |
| 719 | } |
| 720 | break; |
| 721 | case 0x814b: |
| 722 | if (d > d0 + 1 && d[-2] == 0x83 && 0x6e <= d[-1] && d[-1] <= 0x7a && |
| 723 | (b = handaku[d[-1] - 0x6e])) { |
| 724 | *(d - 1) = b; |
| 725 | if (ch) { |
| 726 | ch[-1]++; |
| 727 | s_++; |
| 728 | } |
| 729 | continue; |
| 730 | } else { |
| 731 | *d++ = (unsigned char)(c >> 8); |
| 732 | *d = (unsigned char)(c & 0xff); |
| 733 | } |
| 734 | break; |
| 735 | default: |
| 736 | *d++ = (unsigned char)(c >> 8); |
| 737 | *d = (unsigned char)(c & 0xff); |
| 738 | break; |
| 739 | } |
| 740 | ctype = GRN_CHAR_KATAKANAcxx . . $ GRN_CHAR_KATAKANA.; |
| 741 | } else { |
| 742 | if ((s + 1) < e && 0x40 <= *(s + 1) && *(s + 1) <= 0xfc) { |
| 743 | unsigned char c1 = *s++, c2 = *s, c3 = 0; |
| 744 | if (0x81 <= c1 && c1 <= 0x87) { |
| 745 | switch (c1 & 0x0f) { |
| 746 | case 1: |
| 747 | switch (c2) { |
| 748 | case 0x5b: |
| 749 | *d++ = c1; |
| 750 | *d = c2; |
| 751 | ctype = GRN_CHAR_KATAKANAcxx . . $ GRN_CHAR_KATAKANA.; |
| 752 | break; |
| 753 | case 0x58: |
| 754 | *d++ = c1; |
| 755 | *d = c2; |
| 756 | ctype = GRN_CHAR_KANJIcxx . . $ GRN_CHAR_KANJI.; |
| 757 | break; |
| 758 | case 0x40: |
| 759 | if (removeblankp) { |
| 760 | if (cp > ctypes) { |
| 761 | *(cp - 1) |= GRN_STR_BLANKcxx . . $ `lib/grn_str.h:51:9`!; |
| 762 | } |
| 763 | continue; |
| 764 | } else { |
| 765 | *d = ' '; |
| 766 | ctype = GRN_STR_BLANKcxx . . $ `lib/grn_str.h:51:9`! | GRN_CHAR_SYMBOLcxx . . $ GRN_CHAR_SYMBOL.; |
| 767 | } |
| 768 | break; |
| 769 | default: |
| 770 | if (0x43 <= c2 && c2 <= 0x7e && (c3 = symbolcxx . . $ symbol.[c2 - 0x43])) { |
| 771 | *d = c3; |
| 772 | ctype = GRN_CHAR_SYMBOLcxx . . $ GRN_CHAR_SYMBOL.; |
| 773 | } else if (0x7f <= c2 && c2 <= 0x97 && |
| 774 | (c3 = symbolcxx . . $ symbol.[c2 - 0x44])) { |
| 775 | *d = c3; |
| 776 | ctype = GRN_CHAR_SYMBOLcxx . . $ GRN_CHAR_SYMBOL.; |
| 777 | } else { |
| 778 | *d++ = c1; |
| 779 | *d = c2; |
| 780 | ctype = GRN_CHAR_OTHERScxx . . $ GRN_CHAR_OTHERS.; |
| 781 | } |
| 782 | break; |
| 783 | } |
| 784 | break; |
| 785 | case 2: |
| 786 | c3 = c2 - 0x1f; |
| 787 | if (0x4f <= c2 && c2 <= 0x58) { |
| 788 | ctype = GRN_CHAR_DIGITcxx . . $ GRN_CHAR_DIGIT.; |
| 789 | *d = c2 - 0x1f; |
| 790 | } else if (0x60 <= c2 && c2 <= 0x79) { |
| 791 | ctype = GRN_CHAR_ALPHAcxx . . $ GRN_CHAR_ALPHA.; |
| 792 | *d = c2 + 0x01; |
| 793 | } else if (0x81 <= c2 && c2 <= 0x9a) { |
| 794 | ctype = GRN_CHAR_ALPHAcxx . . $ GRN_CHAR_ALPHA.; |
| 795 | *d = c2 - 0x20; |
| 796 | } else if (0x9f <= c2 && c2 <= 0xf1) { |
| 797 | *d++ = c1; |
| 798 | *d = c2; |
| 799 | ctype = GRN_CHAR_HIRAGANAcxx . . $ GRN_CHAR_HIRAGANA.; |
| 800 | } else { |
| 801 | *d++ = c1; |
| 802 | *d = c2; |
| 803 | ctype = GRN_CHAR_OTHERScxx . . $ GRN_CHAR_OTHERS.; |
| 804 | } |
| 805 | break; |
| 806 | case 3: |
| 807 | if (0x40 <= c2 && c2 <= 0x96) { |
| 808 | *d++ = c1; |
| 809 | *d = c2; |
| 810 | ctype = GRN_CHAR_KATAKANAcxx . . $ GRN_CHAR_KATAKANA.; |
| 811 | } else { |
| 812 | *d++ = c1; |
| 813 | *d = c2; |
| 814 | ctype = GRN_CHAR_SYMBOLcxx . . $ GRN_CHAR_SYMBOL.; |
| 815 | } |
| 816 | break; |
| 817 | case 4: |
| 818 | case 7: |
| 819 | *d++ = c1; |
| 820 | *d = c2; |
| 821 | ctype = GRN_CHAR_SYMBOLcxx . . $ GRN_CHAR_SYMBOL.; |
| 822 | break; |
| 823 | default: |
| 824 | *d++ = c1; |
| 825 | *d = c2; |
| 826 | ctype = GRN_CHAR_OTHERScxx . . $ GRN_CHAR_OTHERS.; |
| 827 | break; |
| 828 | } |
| 829 | } else { |
| 830 | *d++ = c1; |
| 831 | *d = c2; |
| 832 | ctype = GRN_CHAR_KANJIcxx . . $ GRN_CHAR_KANJI.; |
| 833 | } |
| 834 | } else { |
| 835 | /* skip invalid character */ |
| 836 | continue; |
| 837 | } |
| 838 | } |
| 839 | } else { |
| 840 | unsigned char c = *s; |
| 841 | switch (c >> 4) { |
| 842 | case 0: |
| 843 | case 1: |
| 844 | /* skip unprintable ascii */ |
| 845 | if (cp > ctypes) { |
| 846 | *(cp - 1) |= GRN_STR_BLANKcxx . . $ `lib/grn_str.h:51:9`!; |
| 847 | } |
| 848 | continue; |
| 849 | case 2: |
| 850 | if (c == 0x20) { |
| 851 | if (removeblankp) { |
| 852 | if (cp > ctypes) { |
| 853 | *(cp - 1) |= GRN_STR_BLANKcxx . . $ `lib/grn_str.h:51:9`!; |
| 854 | } |
| 855 | continue; |
| 856 | } else { |
| 857 | *d = ' '; |
| 858 | ctype = GRN_STR_BLANKcxx . . $ `lib/grn_str.h:51:9`! | GRN_CHAR_SYMBOLcxx . . $ GRN_CHAR_SYMBOL.; |
| 859 | } |
| 860 | } else { |
| 861 | *d = c; |
| 862 | ctype = GRN_CHAR_SYMBOLcxx . . $ GRN_CHAR_SYMBOL.; |
| 863 | } |
| 864 | break; |
| 865 | case 3: |
| 866 | *d = c; |
| 867 | ctype = (c <= 0x39) ? GRN_CHAR_DIGITcxx . . $ GRN_CHAR_DIGIT. : GRN_CHAR_SYMBOLcxx . . $ GRN_CHAR_SYMBOL.; |
| 868 | break; |
| 869 | case 4: |
| 870 | *d = ('A' <= c) ? c + 0x20 : c; |
| 871 | ctype = (c == 0x40) ? GRN_CHAR_SYMBOLcxx . . $ GRN_CHAR_SYMBOL. : GRN_CHAR_ALPHAcxx . . $ GRN_CHAR_ALPHA.; |
| 872 | break; |
| 873 | case 5: |
| 874 | *d = (c <= 'Z') ? c + 0x20 : c; |
| 875 | ctype = (c <= 0x5a) ? GRN_CHAR_ALPHAcxx . . $ GRN_CHAR_ALPHA. : GRN_CHAR_SYMBOLcxx . . $ GRN_CHAR_SYMBOL.; |
| 876 | break; |
| 877 | case 6: |
| 878 | *d = c; |
| 879 | ctype = (c == 0x60) ? GRN_CHAR_SYMBOLcxx . . $ GRN_CHAR_SYMBOL. : GRN_CHAR_ALPHAcxx . . $ GRN_CHAR_ALPHA.; |
| 880 | break; |
| 881 | case 7: |
| 882 | *d = c; |
| 883 | ctype = (c <= 0x7a) ? GRN_CHAR_ALPHAcxx . . $ GRN_CHAR_ALPHA. |
| 884 | : (c == 0x7f ? GRN_CHAR_OTHERScxx . . $ GRN_CHAR_OTHERS. : GRN_CHAR_SYMBOLcxx . . $ GRN_CHAR_SYMBOL.); |
| 885 | break; |
| 886 | default: |
| 887 | *d = c; |
| 888 | ctype = GRN_CHAR_OTHERScxx . . $ GRN_CHAR_OTHERS.; |
| 889 | break; |
| 890 | } |
| 891 | } |
| 892 | d++; |
| 893 | length++; |
| 894 | if (cp) { |
| 895 | *cp++ = ctype; |
| 896 | } |
| 897 | if (ch) { |
| 898 | *ch++ = (int16_tcxx . . $ int16_t#)(s + 1 - s_); |
| 899 | s_ = s + 1; |
| 900 | while (++d_ < d) { |
| 901 | *ch++ = 0; |
| 902 | } |
| 903 | } |
| 904 | } |
| 905 | if (cp) { |
| 906 | *cp = GRN_CHAR_NULLcxx . . $ GRN_CHAR_NULL.; |
| 907 | } |
| 908 | *d = '\0'; |
| 909 | nstr->lengthcxx . . $ $anonymous_type_8b55e593c0863bb2_0#length. = length; |
| 910 | nstr->norm_blencxx . . $ $anonymous_type_8b55e593c0863bb2_0#norm_blen. = (unsigned int)(d - (unsigned char *)nstr->normcxx . . $ $anonymous_type_8b55e593c0863bb2_0#norm.); |
| 911 | return GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 912 | } |
| 913 | |
| 914 | static inline grn_rccxx . . $ grn_rc# |
| 915 | normalize_nonecxx . . $ normalize_none(72a51f2029f0fbdb).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_strcxx . . $ grn_str# *nstr) |
| 916 | { |
| 917 | int16_tcxx . . $ int16_t# *ch; |
| 918 | const unsigned char *s, *s_, *e; |
| 919 | unsigned char *d, *d0, *d_; |
| 920 | uint_least8_tcxx . . $ uint_least8_t# *cp, *ctypes, ctype; |
| 921 | unsigned int size = nstr->orig_blencxx . . $ $anonymous_type_8b55e593c0863bb2_0#orig_blen.; |
| 922 | unsigned int length = 0; |
| 923 | int removeblankp = nstr->flagscxx . . $ $anonymous_type_8b55e593c0863bb2_0#flags. & GRN_STR_REMOVEBLANKcxx . . $ `include/groonga/string.h:40:9`!; |
| 924 | if (!(nstr->normcxx . . $ $anonymous_type_8b55e593c0863bb2_0#norm. = GRN_MALLOCcxx . . $ `lib/grn_alloc.h:41:9`!(size + 1))) { |
| 925 | return GRN_NO_MEMORY_AVAILABLEcxx . . $ GRN_NO_MEMORY_AVAILABLE.; |
| 926 | } |
| 927 | d0 = (unsigned char *)nstr->normcxx . . $ $anonymous_type_8b55e593c0863bb2_0#norm.; |
| 928 | if (nstr->flagscxx . . $ $anonymous_type_8b55e593c0863bb2_0#flags. & GRN_STR_WITH_CHECKScxx . . $ `include/groonga/string.h:42:9`!) { |
| 929 | if (!(nstr->checkscxx . . $ $anonymous_type_8b55e593c0863bb2_0#checks. = GRN_MALLOCcxx . . $ `lib/grn_alloc.h:41:9`!(size * sizeof(int16_t) + 1))) { |
| 930 | GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(nstr->norm); |
| 931 | nstr->normcxx . . $ $anonymous_type_8b55e593c0863bb2_0#norm. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 932 | return GRN_NO_MEMORY_AVAILABLEcxx . . $ GRN_NO_MEMORY_AVAILABLE.; |
| 933 | } |
| 934 | } |
| 935 | ch = nstr->checkscxx . . $ $anonymous_type_8b55e593c0863bb2_0#checks.; |
| 936 | if (nstr->flagscxx . . $ $anonymous_type_8b55e593c0863bb2_0#flags. & GRN_STR_WITH_CTYPEScxx . . $ `include/groonga/string.h:41:9`!) { |
| 937 | if (!(nstr->ctypescxx . . $ $anonymous_type_8b55e593c0863bb2_0#ctypes. = GRN_MALLOCcxx . . $ `lib/grn_alloc.h:41:9`!(size + 1))) { |
| 938 | GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(nstr->checks); |
| 939 | GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(nstr->norm); |
| 940 | nstr->checkscxx . . $ $anonymous_type_8b55e593c0863bb2_0#checks. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 941 | nstr->normcxx . . $ $anonymous_type_8b55e593c0863bb2_0#norm. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 942 | return GRN_NO_MEMORY_AVAILABLEcxx . . $ GRN_NO_MEMORY_AVAILABLE.; |
| 943 | } |
| 944 | } |
| 945 | cp = ctypes = nstr->ctypescxx . . $ $anonymous_type_8b55e593c0863bb2_0#ctypes.; |
| 946 | e = (unsigned char *)nstr->origcxx . . $ $anonymous_type_8b55e593c0863bb2_0#orig. + size; |
| 947 | for (s = s_ = (unsigned char *)nstr->origcxx . . $ $anonymous_type_8b55e593c0863bb2_0#orig., d = d_ = d0; s < e; s++) { |
| 948 | unsigned char c = *s; |
| 949 | switch (c >> 4) { |
| 950 | case 0: |
| 951 | case 1: |
| 952 | /* skip unprintable ascii */ |
| 953 | if (cp > ctypes) { |
| 954 | *(cp - 1) |= GRN_STR_BLANKcxx . . $ `lib/grn_str.h:51:9`!; |
| 955 | } |
| 956 | continue; |
| 957 | case 2: |
| 958 | if (c == 0x20) { |
| 959 | if (removeblankp) { |
| 960 | if (cp > ctypes) { |
| 961 | *(cp - 1) |= GRN_STR_BLANKcxx . . $ `lib/grn_str.h:51:9`!; |
| 962 | } |
| 963 | continue; |
| 964 | } else { |
| 965 | *d = ' '; |
| 966 | ctype = GRN_STR_BLANKcxx . . $ `lib/grn_str.h:51:9`! | GRN_CHAR_SYMBOLcxx . . $ GRN_CHAR_SYMBOL.; |
| 967 | } |
| 968 | } else { |
| 969 | *d = c; |
| 970 | ctype = GRN_CHAR_SYMBOLcxx . . $ GRN_CHAR_SYMBOL.; |
| 971 | } |
| 972 | break; |
| 973 | case 3: |
| 974 | *d = c; |
| 975 | ctype = (c <= 0x39) ? GRN_CHAR_DIGITcxx . . $ GRN_CHAR_DIGIT. : GRN_CHAR_SYMBOLcxx . . $ GRN_CHAR_SYMBOL.; |
| 976 | break; |
| 977 | case 4: |
| 978 | *d = ('A' <= c) ? c + 0x20 : c; |
| 979 | ctype = (c == 0x40) ? GRN_CHAR_SYMBOLcxx . . $ GRN_CHAR_SYMBOL. : GRN_CHAR_ALPHAcxx . . $ GRN_CHAR_ALPHA.; |
| 980 | break; |
| 981 | case 5: |
| 982 | *d = (c <= 'Z') ? c + 0x20 : c; |
| 983 | ctype = (c <= 0x5a) ? GRN_CHAR_ALPHAcxx . . $ GRN_CHAR_ALPHA. : GRN_CHAR_SYMBOLcxx . . $ GRN_CHAR_SYMBOL.; |
| 984 | break; |
| 985 | case 6: |
| 986 | *d = c; |
| 987 | ctype = (c == 0x60) ? GRN_CHAR_SYMBOLcxx . . $ GRN_CHAR_SYMBOL. : GRN_CHAR_ALPHAcxx . . $ GRN_CHAR_ALPHA.; |
| 988 | break; |
| 989 | case 7: |
| 990 | *d = c; |
| 991 | ctype = (c <= 0x7a) ? GRN_CHAR_ALPHAcxx . . $ GRN_CHAR_ALPHA. |
| 992 | : (c == 0x7f ? GRN_CHAR_OTHERScxx . . $ GRN_CHAR_OTHERS. : GRN_CHAR_SYMBOLcxx . . $ GRN_CHAR_SYMBOL.); |
| 993 | break; |
| 994 | default: |
| 995 | *d = c; |
| 996 | ctype = GRN_CHAR_OTHERScxx . . $ GRN_CHAR_OTHERS.; |
| 997 | break; |
| 998 | } |
| 999 | d++; |
| 1000 | length++; |
| 1001 | if (cp) { |
| 1002 | *cp++ = ctype; |
| 1003 | } |
| 1004 | if (ch) { |
| 1005 | *ch++ = (int16_tcxx . . $ int16_t#)(s + 1 - s_); |
| 1006 | s_ = s + 1; |
| 1007 | while (++d_ < d) { |
| 1008 | *ch++ = 0; |
| 1009 | } |
| 1010 | } |
| 1011 | } |
| 1012 | if (cp) { |
| 1013 | *cp = GRN_CHAR_NULLcxx . . $ GRN_CHAR_NULL.; |
| 1014 | } |
| 1015 | *d = '\0'; |
| 1016 | nstr->lengthcxx . . $ $anonymous_type_8b55e593c0863bb2_0#length. = length; |
| 1017 | nstr->norm_blencxx . . $ $anonymous_type_8b55e593c0863bb2_0#norm_blen. = (unsigned int)(d - (unsigned char *)nstr->normcxx . . $ $anonymous_type_8b55e593c0863bb2_0#norm.); |
| 1018 | return GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 1019 | } |
| 1020 | |
| 1021 | /* use cp1252 as latin1 */ |
| 1022 | static inline grn_rccxx . . $ grn_rc# |
| 1023 | normalize_latin1cxx . . $ normalize_latin1(72a51f2029f0fbdb).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_strcxx . . $ grn_str# *nstr) |
| 1024 | { |
| 1025 | int16_tcxx . . $ int16_t# *ch; |
| 1026 | const unsigned char *s, *s_, *e; |
| 1027 | unsigned char *d, *d0, *d_; |
| 1028 | uint_least8_tcxx . . $ uint_least8_t# *cp, *ctypes, ctype; |
| 1029 | unsigned int size = nstr->orig_blencxx . . $ $anonymous_type_8b55e593c0863bb2_0#orig_blen.; |
| 1030 | unsigned int length = 0; |
| 1031 | int removeblankp = nstr->flagscxx . . $ $anonymous_type_8b55e593c0863bb2_0#flags. & GRN_STR_REMOVEBLANKcxx . . $ `include/groonga/string.h:40:9`!; |
| 1032 | if (!(nstr->normcxx . . $ $anonymous_type_8b55e593c0863bb2_0#norm. = GRN_MALLOCcxx . . $ `lib/grn_alloc.h:41:9`!(size + 1))) { |
| 1033 | return GRN_NO_MEMORY_AVAILABLEcxx . . $ GRN_NO_MEMORY_AVAILABLE.; |
| 1034 | } |
| 1035 | d0 = (unsigned char *)nstr->normcxx . . $ $anonymous_type_8b55e593c0863bb2_0#norm.; |
| 1036 | if (nstr->flagscxx . . $ $anonymous_type_8b55e593c0863bb2_0#flags. & GRN_STR_WITH_CHECKScxx . . $ `include/groonga/string.h:42:9`!) { |
| 1037 | if (!(nstr->checkscxx . . $ $anonymous_type_8b55e593c0863bb2_0#checks. = GRN_MALLOCcxx . . $ `lib/grn_alloc.h:41:9`!(size * sizeof(int16_t) + 1))) { |
| 1038 | GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(nstr->norm); |
| 1039 | nstr->normcxx . . $ $anonymous_type_8b55e593c0863bb2_0#norm. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 1040 | return GRN_NO_MEMORY_AVAILABLEcxx . . $ GRN_NO_MEMORY_AVAILABLE.; |
| 1041 | } |
| 1042 | } |
| 1043 | ch = nstr->checkscxx . . $ $anonymous_type_8b55e593c0863bb2_0#checks.; |
| 1044 | if (nstr->flagscxx . . $ $anonymous_type_8b55e593c0863bb2_0#flags. & GRN_STR_WITH_CTYPEScxx . . $ `include/groonga/string.h:41:9`!) { |
| 1045 | if (!(nstr->ctypescxx . . $ $anonymous_type_8b55e593c0863bb2_0#ctypes. = GRN_MALLOCcxx . . $ `lib/grn_alloc.h:41:9`!(size + 1))) { |
| 1046 | GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(nstr->checks); |
| 1047 | GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(nstr->norm); |
| 1048 | nstr->checkscxx . . $ $anonymous_type_8b55e593c0863bb2_0#checks. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 1049 | nstr->normcxx . . $ $anonymous_type_8b55e593c0863bb2_0#norm. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 1050 | return GRN_NO_MEMORY_AVAILABLEcxx . . $ GRN_NO_MEMORY_AVAILABLE.; |
| 1051 | } |
| 1052 | } |
| 1053 | cp = ctypes = nstr->ctypescxx . . $ $anonymous_type_8b55e593c0863bb2_0#ctypes.; |
| 1054 | e = (unsigned char *)nstr->origcxx . . $ $anonymous_type_8b55e593c0863bb2_0#orig. + size; |
| 1055 | for (s = s_ = (unsigned char *)nstr->origcxx . . $ $anonymous_type_8b55e593c0863bb2_0#orig., d = d_ = d0; s < e; s++) { |
| 1056 | unsigned char c = *s; |
| 1057 | switch (c >> 4) { |
| 1058 | case 0: |
| 1059 | case 1: |
| 1060 | /* skip unprintable ascii */ |
| 1061 | if (cp > ctypes) { |
| 1062 | *(cp - 1) |= GRN_STR_BLANKcxx . . $ `lib/grn_str.h:51:9`!; |
| 1063 | } |
| 1064 | continue; |
| 1065 | case 2: |
| 1066 | if (c == 0x20) { |
| 1067 | if (removeblankp) { |
| 1068 | if (cp > ctypes) { |
| 1069 | *(cp - 1) |= GRN_STR_BLANKcxx . . $ `lib/grn_str.h:51:9`!; |
| 1070 | } |
| 1071 | continue; |
| 1072 | } else { |
| 1073 | *d = ' '; |
| 1074 | ctype = GRN_STR_BLANKcxx . . $ `lib/grn_str.h:51:9`! | GRN_CHAR_SYMBOLcxx . . $ GRN_CHAR_SYMBOL.; |
| 1075 | } |
| 1076 | } else { |
| 1077 | *d = c; |
| 1078 | ctype = GRN_CHAR_SYMBOLcxx . . $ GRN_CHAR_SYMBOL.; |
| 1079 | } |
| 1080 | break; |
| 1081 | case 3: |
| 1082 | *d = c; |
| 1083 | ctype = (c <= 0x39) ? GRN_CHAR_DIGITcxx . . $ GRN_CHAR_DIGIT. : GRN_CHAR_SYMBOLcxx . . $ GRN_CHAR_SYMBOL.; |
| 1084 | break; |
| 1085 | case 4: |
| 1086 | *d = ('A' <= c) ? c + 0x20 : c; |
| 1087 | ctype = (c == 0x40) ? GRN_CHAR_SYMBOLcxx . . $ GRN_CHAR_SYMBOL. : GRN_CHAR_ALPHAcxx . . $ GRN_CHAR_ALPHA.; |
| 1088 | break; |
| 1089 | case 5: |
| 1090 | *d = (c <= 'Z') ? c + 0x20 : c; |
| 1091 | ctype = (c <= 0x5a) ? GRN_CHAR_ALPHAcxx . . $ GRN_CHAR_ALPHA. : GRN_CHAR_SYMBOLcxx . . $ GRN_CHAR_SYMBOL.; |
| 1092 | break; |
| 1093 | case 6: |
| 1094 | *d = c; |
| 1095 | ctype = (c == 0x60) ? GRN_CHAR_SYMBOLcxx . . $ GRN_CHAR_SYMBOL. : GRN_CHAR_ALPHAcxx . . $ GRN_CHAR_ALPHA.; |
| 1096 | break; |
| 1097 | case 7: |
| 1098 | *d = c; |
| 1099 | ctype = (c <= 0x7a) ? GRN_CHAR_ALPHAcxx . . $ GRN_CHAR_ALPHA. |
| 1100 | : (c == 0x7f ? GRN_CHAR_OTHERScxx . . $ GRN_CHAR_OTHERS. : GRN_CHAR_SYMBOLcxx . . $ GRN_CHAR_SYMBOL.); |
| 1101 | break; |
| 1102 | case 8: |
| 1103 | if (c == 0x8a || c == 0x8c || c == 0x8e) { |
| 1104 | *d = c + 0x10; |
| 1105 | ctype = GRN_CHAR_ALPHAcxx . . $ GRN_CHAR_ALPHA.; |
| 1106 | } else { |
| 1107 | *d = c; |
| 1108 | ctype = GRN_CHAR_SYMBOLcxx . . $ GRN_CHAR_SYMBOL.; |
| 1109 | } |
| 1110 | break; |
| 1111 | case 9: |
| 1112 | if (c == 0x9a || c == 0x9c || c == 0x9e || c == 0x9f) { |
| 1113 | *d = (c == 0x9f) ? c + 0x60 : c; |
| 1114 | ctype = GRN_CHAR_ALPHAcxx . . $ GRN_CHAR_ALPHA.; |
| 1115 | } else { |
| 1116 | *d = c; |
| 1117 | ctype = GRN_CHAR_SYMBOLcxx . . $ GRN_CHAR_SYMBOL.; |
| 1118 | } |
| 1119 | break; |
| 1120 | case 0x0c: |
| 1121 | *d = c + 0x20; |
| 1122 | ctype = GRN_CHAR_ALPHAcxx . . $ GRN_CHAR_ALPHA.; |
| 1123 | break; |
| 1124 | case 0x0d: |
| 1125 | *d = (c == 0xd7 || c == 0xdf) ? c : c + 0x20; |
| 1126 | ctype = (c == 0xd7) ? GRN_CHAR_SYMBOLcxx . . $ GRN_CHAR_SYMBOL. : GRN_CHAR_ALPHAcxx . . $ GRN_CHAR_ALPHA.; |
| 1127 | break; |
| 1128 | case 0x0e: |
| 1129 | *d = c; |
| 1130 | ctype = GRN_CHAR_ALPHAcxx . . $ GRN_CHAR_ALPHA.; |
| 1131 | break; |
| 1132 | case 0x0f: |
| 1133 | *d = c; |
| 1134 | ctype = (c == 0xf7) ? GRN_CHAR_SYMBOLcxx . . $ GRN_CHAR_SYMBOL. : GRN_CHAR_ALPHAcxx . . $ GRN_CHAR_ALPHA.; |
| 1135 | break; |
| 1136 | default: |
| 1137 | *d = c; |
| 1138 | ctype = GRN_CHAR_OTHERScxx . . $ GRN_CHAR_OTHERS.; |
| 1139 | break; |
| 1140 | } |
| 1141 | d++; |
| 1142 | length++; |
| 1143 | if (cp) { |
| 1144 | *cp++ = ctype; |
| 1145 | } |
| 1146 | if (ch) { |
| 1147 | *ch++ = (int16_tcxx . . $ int16_t#)(s + 1 - s_); |
| 1148 | s_ = s + 1; |
| 1149 | while (++d_ < d) { |
| 1150 | *ch++ = 0; |
| 1151 | } |
| 1152 | } |
| 1153 | } |
| 1154 | if (cp) { |
| 1155 | *cp = GRN_CHAR_NULLcxx . . $ GRN_CHAR_NULL.; |
| 1156 | } |
| 1157 | *d = '\0'; |
| 1158 | nstr->lengthcxx . . $ $anonymous_type_8b55e593c0863bb2_0#length. = length; |
| 1159 | nstr->norm_blencxx . . $ $anonymous_type_8b55e593c0863bb2_0#norm_blen. = (unsigned int)(d - (unsigned char *)nstr->normcxx . . $ $anonymous_type_8b55e593c0863bb2_0#norm.); |
| 1160 | return GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 1161 | } |
| 1162 | |
| 1163 | static inline grn_rccxx . . $ grn_rc# |
| 1164 | normalize_koi8rcxx . . $ normalize_koi8r(72a51f2029f0fbdb).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_strcxx . . $ grn_str# *nstr) |
| 1165 | { |
| 1166 | int16_tcxx . . $ int16_t# *ch; |
| 1167 | const unsigned char *s, *s_, *e; |
| 1168 | unsigned char *d, *d0, *d_; |
| 1169 | uint_least8_tcxx . . $ uint_least8_t# *cp, *ctypes, ctype; |
| 1170 | unsigned int size = nstr->orig_blencxx . . $ $anonymous_type_8b55e593c0863bb2_0#orig_blen.; |
| 1171 | unsigned int length = 0; |
| 1172 | int removeblankp = nstr->flagscxx . . $ $anonymous_type_8b55e593c0863bb2_0#flags. & GRN_STR_REMOVEBLANKcxx . . $ `include/groonga/string.h:40:9`!; |
| 1173 | if (!(nstr->normcxx . . $ $anonymous_type_8b55e593c0863bb2_0#norm. = GRN_MALLOCcxx . . $ `lib/grn_alloc.h:41:9`!(size + 1))) { |
| 1174 | return GRN_NO_MEMORY_AVAILABLEcxx . . $ GRN_NO_MEMORY_AVAILABLE.; |
| 1175 | } |
| 1176 | d0 = (unsigned char *)nstr->normcxx . . $ $anonymous_type_8b55e593c0863bb2_0#norm.; |
| 1177 | if (nstr->flagscxx . . $ $anonymous_type_8b55e593c0863bb2_0#flags. & GRN_STR_WITH_CHECKScxx . . $ `include/groonga/string.h:42:9`!) { |
| 1178 | if (!(nstr->checkscxx . . $ $anonymous_type_8b55e593c0863bb2_0#checks. = GRN_MALLOCcxx . . $ `lib/grn_alloc.h:41:9`!(size * sizeof(int16_t) + 1))) { |
| 1179 | GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(nstr->norm); |
| 1180 | nstr->normcxx . . $ $anonymous_type_8b55e593c0863bb2_0#norm. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 1181 | return GRN_NO_MEMORY_AVAILABLEcxx . . $ GRN_NO_MEMORY_AVAILABLE.; |
| 1182 | } |
| 1183 | } |
| 1184 | ch = nstr->checkscxx . . $ $anonymous_type_8b55e593c0863bb2_0#checks.; |
| 1185 | if (nstr->flagscxx . . $ $anonymous_type_8b55e593c0863bb2_0#flags. & GRN_STR_WITH_CTYPEScxx . . $ `include/groonga/string.h:41:9`!) { |
| 1186 | if (!(nstr->ctypescxx . . $ $anonymous_type_8b55e593c0863bb2_0#ctypes. = GRN_MALLOCcxx . . $ `lib/grn_alloc.h:41:9`!(size + 1))) { |
| 1187 | GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(nstr->checks); |
| 1188 | GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(nstr->norm); |
| 1189 | nstr->checkscxx . . $ $anonymous_type_8b55e593c0863bb2_0#checks. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 1190 | nstr->normcxx . . $ $anonymous_type_8b55e593c0863bb2_0#norm. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 1191 | return GRN_NO_MEMORY_AVAILABLEcxx . . $ GRN_NO_MEMORY_AVAILABLE.; |
| 1192 | } |
| 1193 | } |
| 1194 | cp = ctypes = nstr->ctypescxx . . $ $anonymous_type_8b55e593c0863bb2_0#ctypes.; |
| 1195 | e = (unsigned char *)nstr->origcxx . . $ $anonymous_type_8b55e593c0863bb2_0#orig. + size; |
| 1196 | for (s = s_ = (unsigned char *)nstr->origcxx . . $ $anonymous_type_8b55e593c0863bb2_0#orig., d = d_ = d0; s < e; s++) { |
| 1197 | unsigned char c = *s; |
| 1198 | switch (c >> 4) { |
| 1199 | case 0: |
| 1200 | case 1: |
| 1201 | /* skip unprintable ascii */ |
| 1202 | if (cp > ctypes) { |
| 1203 | *(cp - 1) |= GRN_STR_BLANKcxx . . $ `lib/grn_str.h:51:9`!; |
| 1204 | } |
| 1205 | continue; |
| 1206 | case 2: |
| 1207 | if (c == 0x20) { |
| 1208 | if (removeblankp) { |
| 1209 | if (cp > ctypes) { |
| 1210 | *(cp - 1) |= GRN_STR_BLANKcxx . . $ `lib/grn_str.h:51:9`!; |
| 1211 | } |
| 1212 | continue; |
| 1213 | } else { |
| 1214 | *d = ' '; |
| 1215 | ctype = GRN_STR_BLANKcxx . . $ `lib/grn_str.h:51:9`! | GRN_CHAR_SYMBOLcxx . . $ GRN_CHAR_SYMBOL.; |
| 1216 | } |
| 1217 | } else { |
| 1218 | *d = c; |
| 1219 | ctype = GRN_CHAR_SYMBOLcxx . . $ GRN_CHAR_SYMBOL.; |
| 1220 | } |
| 1221 | break; |
| 1222 | case 3: |
| 1223 | *d = c; |
| 1224 | ctype = (c <= 0x39) ? GRN_CHAR_DIGITcxx . . $ GRN_CHAR_DIGIT. : GRN_CHAR_SYMBOLcxx . . $ GRN_CHAR_SYMBOL.; |
| 1225 | break; |
| 1226 | case 4: |
| 1227 | *d = ('A' <= c) ? c + 0x20 : c; |
| 1228 | ctype = (c == 0x40) ? GRN_CHAR_SYMBOLcxx . . $ GRN_CHAR_SYMBOL. : GRN_CHAR_ALPHAcxx . . $ GRN_CHAR_ALPHA.; |
| 1229 | break; |
| 1230 | case 5: |
| 1231 | *d = (c <= 'Z') ? c + 0x20 : c; |
| 1232 | ctype = (c <= 0x5a) ? GRN_CHAR_ALPHAcxx . . $ GRN_CHAR_ALPHA. : GRN_CHAR_SYMBOLcxx . . $ GRN_CHAR_SYMBOL.; |
| 1233 | break; |
| 1234 | case 6: |
| 1235 | *d = c; |
| 1236 | ctype = (c == 0x60) ? GRN_CHAR_SYMBOLcxx . . $ GRN_CHAR_SYMBOL. : GRN_CHAR_ALPHAcxx . . $ GRN_CHAR_ALPHA.; |
| 1237 | break; |
| 1238 | case 7: |
| 1239 | *d = c; |
| 1240 | ctype = (c <= 0x7a) ? GRN_CHAR_ALPHAcxx . . $ GRN_CHAR_ALPHA. |
| 1241 | : (c == 0x7f ? GRN_CHAR_OTHERScxx . . $ GRN_CHAR_OTHERS. : GRN_CHAR_SYMBOLcxx . . $ GRN_CHAR_SYMBOL.); |
| 1242 | break; |
| 1243 | case 0x0a: |
| 1244 | *d = c; |
| 1245 | ctype = (c == 0xa3) ? GRN_CHAR_ALPHAcxx . . $ GRN_CHAR_ALPHA. : GRN_CHAR_OTHERScxx . . $ GRN_CHAR_OTHERS.; |
| 1246 | break; |
| 1247 | case 0x0b: |
| 1248 | if (c == 0xb3) { |
| 1249 | *d = c - 0x10; |
| 1250 | ctype = GRN_CHAR_ALPHAcxx . . $ GRN_CHAR_ALPHA.; |
| 1251 | } else { |
| 1252 | *d = c; |
| 1253 | ctype = GRN_CHAR_OTHERScxx . . $ GRN_CHAR_OTHERS.; |
| 1254 | } |
| 1255 | break; |
| 1256 | case 0x0c: |
| 1257 | case 0x0d: |
| 1258 | *d = c; |
| 1259 | ctype = GRN_CHAR_ALPHAcxx . . $ GRN_CHAR_ALPHA.; |
| 1260 | break; |
| 1261 | case 0x0e: |
| 1262 | case 0x0f: |
| 1263 | *d = c - 0x20; |
| 1264 | ctype = GRN_CHAR_ALPHAcxx . . $ GRN_CHAR_ALPHA.; |
| 1265 | break; |
| 1266 | default: |
| 1267 | *d = c; |
| 1268 | ctype = GRN_CHAR_OTHERScxx . . $ GRN_CHAR_OTHERS.; |
| 1269 | break; |
| 1270 | } |
| 1271 | d++; |
| 1272 | length++; |
| 1273 | if (cp) { |
| 1274 | *cp++ = ctype; |
| 1275 | } |
| 1276 | if (ch) { |
| 1277 | *ch++ = (int16_tcxx . . $ int16_t#)(s + 1 - s_); |
| 1278 | s_ = s + 1; |
| 1279 | while (++d_ < d) { |
| 1280 | *ch++ = 0; |
| 1281 | } |
| 1282 | } |
| 1283 | } |
| 1284 | if (cp) { |
| 1285 | *cp = GRN_CHAR_NULLcxx . . $ GRN_CHAR_NULL.; |
| 1286 | } |
| 1287 | *d = '\0'; |
| 1288 | nstr->lengthcxx . . $ $anonymous_type_8b55e593c0863bb2_0#length. = length; |
| 1289 | nstr->norm_blencxx . . $ $anonymous_type_8b55e593c0863bb2_0#norm_blen. = (unsigned int)(d - (unsigned char *)nstr->normcxx . . $ $anonymous_type_8b55e593c0863bb2_0#norm.); |
| 1290 | return GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 1291 | } |
| 1292 | |
| 1293 | static grn_strcxx . . $ grn_str# * |
| 1294 | grn_fakenstr_opencxx . . $ grn_fakenstr_open(6cad2e5a20732834).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 1295 | const char *str, |
| 1296 | size_t str_len, |
| 1297 | grn_encodingcxx . . $ grn_encoding# encoding, |
| 1298 | int flags) |
| 1299 | { |
| 1300 | /* TODO: support GRN_STR_REMOVEBLANK flag and ctypes */ |
| 1301 | grn_strcxx . . $ grn_str# *nstr; |
| 1302 | if (!(nstr = GRN_CALLOCcxx . . $ `lib/grn_alloc.h:42:9`!(sizeof(grn_str)))) { |
| 1303 | GRN_LOGcxx . . $ `include/groonga/groonga.h:2493:9`!(ctx, |
| 1304 | GRN_LOG_ALERT, |
| 1305 | "memory allocation on grn_fakenstr_open failed !"); |
| 1306 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 1307 | } |
| 1308 | if (!(nstr->normcxx . . $ $anonymous_type_8b55e593c0863bb2_0#norm. = GRN_MALLOCcxx . . $ `lib/grn_alloc.h:41:9`!(str_len + 1))) { |
| 1309 | GRN_LOGcxx . . $ `include/groonga/groonga.h:2493:9`!(ctx, |
| 1310 | GRN_LOG_ALERT, |
| 1311 | "memory allocation for keyword on grn_snip_add_cond failed !"); |
| 1312 | GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(nstr); |
| 1313 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 1314 | } |
| 1315 | nstr->origcxx . . $ $anonymous_type_8b55e593c0863bb2_0#orig. = str; |
| 1316 | nstr->orig_blencxx . . $ $anonymous_type_8b55e593c0863bb2_0#orig_blen. = (unsigned int)str_len; |
| 1317 | grn_memcpycxx . . $ `include/groonga/portability.h:32:13`!(nstr->norm, str, str_len); |
| 1318 | nstr->normcxx . . $ $anonymous_type_8b55e593c0863bb2_0#norm.[str_len] = '\0'; |
| 1319 | nstr->norm_blencxx . . $ $anonymous_type_8b55e593c0863bb2_0#norm_blen. = (unsigned int)str_len; |
| 1320 | nstr->ctypescxx . . $ $anonymous_type_8b55e593c0863bb2_0#ctypes. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 1321 | nstr->flagscxx . . $ $anonymous_type_8b55e593c0863bb2_0#flags. = flags; |
| 1322 | |
| 1323 | if (flags & GRN_STR_WITH_CHECKScxx . . $ `include/groonga/string.h:42:9`!) { |
| 1324 | int16_tcxx . . $ int16_t# f = 0; |
| 1325 | unsigned char c; |
| 1326 | size_t i; |
| 1327 | if (!(nstr->checkscxx . . $ $anonymous_type_8b55e593c0863bb2_0#checks. = (int16_tcxx . . $ int16_t# *)GRN_MALLOCcxx . . $ `lib/grn_alloc.h:41:9`!(sizeof(int16_t) * str_len))) { |
| 1328 | GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(nstr->norm); |
| 1329 | GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(nstr); |
| 1330 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 1331 | } |
| 1332 | switch (encoding) { |
| 1333 | case GRN_ENC_EUC_JPcxx . . $ GRN_ENC_EUC_JP.: |
| 1334 | for (i = 0; i < str_len; i++) { |
| 1335 | if (!f) { |
| 1336 | c = (unsigned char)str[i]; |
| 1337 | f = ((c >= 0xa1U && c <= 0xfeU) || c == 0x8eU ? 2 |
| 1338 | : (c == 0x8fU ? 3 : 1)); |
| 1339 | nstr->checkscxx . . $ $anonymous_type_8b55e593c0863bb2_0#checks.[i] = f; |
| 1340 | } else { |
| 1341 | nstr->checkscxx . . $ $anonymous_type_8b55e593c0863bb2_0#checks.[i] = 0; |
| 1342 | } |
| 1343 | f--; |
| 1344 | } |
| 1345 | break; |
| 1346 | case GRN_ENC_SJIScxx . . $ GRN_ENC_SJIS.: |
| 1347 | for (i = 0; i < str_len; i++) { |
| 1348 | if (!f) { |
| 1349 | c = (unsigned char)str[i]; |
| 1350 | f = (c >= 0x81U && ((c <= 0x9fU) || (c >= 0xe0U && c <= 0xfcU)) ? 2 |
| 1351 | : 1); |
| 1352 | nstr->checkscxx . . $ $anonymous_type_8b55e593c0863bb2_0#checks.[i] = f; |
| 1353 | } else { |
| 1354 | nstr->checkscxx . . $ $anonymous_type_8b55e593c0863bb2_0#checks.[i] = 0; |
| 1355 | } |
| 1356 | f--; |
| 1357 | } |
| 1358 | break; |
| 1359 | case GRN_ENC_UTF8cxx . . $ GRN_ENC_UTF8.: |
| 1360 | for (i = 0; i < str_len; i++) { |
| 1361 | if (!f) { |
| 1362 | c = (unsigned char)str[i]; |
| 1363 | f = (c & 0x80U ? (c & 0x20U ? (c & 0x10U ? 4 : 3) : 2) : 1); |
| 1364 | nstr->checkscxx . . $ $anonymous_type_8b55e593c0863bb2_0#checks.[i] = f; |
| 1365 | } else { |
| 1366 | nstr->checkscxx . . $ $anonymous_type_8b55e593c0863bb2_0#checks.[i] = 0; |
| 1367 | } |
| 1368 | f--; |
| 1369 | } |
| 1370 | break; |
| 1371 | default: |
| 1372 | for (i = 0; i < str_len; i++) { |
| 1373 | nstr->checkscxx . . $ $anonymous_type_8b55e593c0863bb2_0#checks.[i] = 1; |
| 1374 | } |
| 1375 | break; |
| 1376 | } |
| 1377 | } else { |
| 1378 | nstr->checkscxx . . $ $anonymous_type_8b55e593c0863bb2_0#checks. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 1379 | } |
| 1380 | return nstr; |
| 1381 | } |
| 1382 | |
| 1383 | grn_strcxx . . $ grn_str# * |
| 1384 | grn_str_open_cxx . . $ grn_str_open_(8098434ec04b6983).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 1385 | const char *str, |
| 1386 | unsigned int str_len, |
| 1387 | int flags, |
| 1388 | grn_encodingcxx . . $ grn_encoding# encoding) |
| 1389 | { |
| 1390 | grn_rccxx . . $ grn_rc# rc; |
| 1391 | grn_strcxx . . $ grn_str# *nstr; |
| 1392 | if (!str || !str_len) { |
| 1393 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 1394 | } |
| 1395 | |
| 1396 | if (!(flags & GRN_STR_NORMALIZEcxx . . $ `include/groonga/string.h:43:9`!)) { |
| 1397 | return grn_fakenstr_opencxx . . $ grn_fakenstr_open(6cad2e5a20732834).(ctx, str, str_len, encoding, flags); |
| 1398 | } |
| 1399 | |
| 1400 | if (!(nstr = GRN_MALLOCcxx . . $ `lib/grn_alloc.h:41:9`!(sizeof(grn_str)))) { |
| 1401 | GRN_LOGcxx . . $ `include/groonga/groonga.h:2493:9`!(ctx, GRN_LOG_ALERT, "memory allocation on grn_str_open failed !"); |
| 1402 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 1403 | } |
| 1404 | nstr->origcxx . . $ $anonymous_type_8b55e593c0863bb2_0#orig. = str; |
| 1405 | nstr->orig_blencxx . . $ $anonymous_type_8b55e593c0863bb2_0#orig_blen. = str_len; |
| 1406 | nstr->normcxx . . $ $anonymous_type_8b55e593c0863bb2_0#norm. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 1407 | nstr->norm_blencxx . . $ $anonymous_type_8b55e593c0863bb2_0#norm_blen. = 0; |
| 1408 | nstr->checkscxx . . $ $anonymous_type_8b55e593c0863bb2_0#checks. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 1409 | nstr->ctypescxx . . $ $anonymous_type_8b55e593c0863bb2_0#ctypes. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 1410 | nstr->encodingcxx . . $ $anonymous_type_8b55e593c0863bb2_0#encoding. = encoding; |
| 1411 | nstr->flagscxx . . $ $anonymous_type_8b55e593c0863bb2_0#flags. = flags; |
| 1412 | switch (encoding) { |
| 1413 | case GRN_ENC_EUC_JPcxx . . $ GRN_ENC_EUC_JP.: |
| 1414 | rc = normalize_euccxx . . $ normalize_euc(72a51f2029f0fbdb).(ctx, nstr); |
| 1415 | break; |
| 1416 | case GRN_ENC_UTF8cxx . . $ GRN_ENC_UTF8.: |
| 1417 | #ifdef GRN_WITH_NFKCcxx . . $ `build/config.h:110:9`! |
| 1418 | rc = normalize_utf8cxx . . $ normalize_utf8(72a51f2029f0fbdb).(ctx, nstr); |
| 1419 | #else /* GRN_WITH_NFKC */ |
| 1420 | rc = normalize_none(ctx, nstr); |
| 1421 | #endif /* GRN_WITH_NFKC */ |
| 1422 | break; |
| 1423 | case GRN_ENC_SJIScxx . . $ GRN_ENC_SJIS.: |
| 1424 | rc = normalize_sjiscxx . . $ normalize_sjis(72a51f2029f0fbdb).(ctx, nstr); |
| 1425 | break; |
| 1426 | case GRN_ENC_LATIN1cxx . . $ GRN_ENC_LATIN1.: |
| 1427 | rc = normalize_latin1cxx . . $ normalize_latin1(72a51f2029f0fbdb).(ctx, nstr); |
| 1428 | break; |
| 1429 | case GRN_ENC_KOI8Rcxx . . $ GRN_ENC_KOI8R.: |
| 1430 | rc = normalize_koi8rcxx . . $ normalize_koi8r(72a51f2029f0fbdb).(ctx, nstr); |
| 1431 | break; |
| 1432 | default: |
| 1433 | rc = normalize_nonecxx . . $ normalize_none(72a51f2029f0fbdb).(ctx, nstr); |
| 1434 | break; |
| 1435 | } |
| 1436 | if (rc) { |
| 1437 | grn_str_closecxx . . $ grn_str_close(72a51f2029f0fbdb).(ctx, nstr); |
| 1438 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 1439 | } |
| 1440 | return nstr; |
| 1441 | } |
| 1442 | |
| 1443 | grn_strcxx . . $ grn_str# * |
| 1444 | grn_str_opencxx . . $ grn_str_open(d2bdcd0ea226bd57).(grn_ctxcxx . . $ grn_ctx# *ctx, const char *str, unsigned int str_len, int flags) |
| 1445 | { |
| 1446 | return grn_str_open_cxx . . $ grn_str_open_(8098434ec04b6983).(ctx, str, str_len, flags, ctx->encodingcxx . . $ _grn_ctx#encoding.); |
| 1447 | } |
| 1448 | |
| 1449 | grn_rccxx . . $ grn_rc# |
| 1450 | grn_str_closecxx . . $ grn_str_close(72a51f2029f0fbdb).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_strcxx . . $ grn_str# *nstr) |
| 1451 | { |
| 1452 | if (nstr) { |
| 1453 | if (nstr->normcxx . . $ $anonymous_type_8b55e593c0863bb2_0#norm.) { |
| 1454 | GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(nstr->norm); |
| 1455 | } |
| 1456 | if (nstr->ctypescxx . . $ $anonymous_type_8b55e593c0863bb2_0#ctypes.) { |
| 1457 | GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(nstr->ctypes); |
| 1458 | } |
| 1459 | if (nstr->checkscxx . . $ $anonymous_type_8b55e593c0863bb2_0#checks.) { |
| 1460 | GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(nstr->checks); |
| 1461 | } |
| 1462 | GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(nstr); |
| 1463 | return GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 1464 | } else { |
| 1465 | return GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.; |
| 1466 | } |
| 1467 | } |
| 1468 | |
| 1469 | static const char *grn_enc_stringcxx . . $ grn_enc_string.[] = { |
| 1470 | "default", "none", "euc_jp", "utf8", "sjis", "latin1", "koi8r"}; |
| 1471 | |
| 1472 | const char * |
| 1473 | grn_encoding_to_stringcxx . . $ grn_encoding_to_string(9da28ca6a864c8da).(grn_encodingcxx . . $ grn_encoding# enc) |
| 1474 | { |
| 1475 | if (enc < (sizeof(grn_enc_stringcxx . . $ grn_enc_string.) / sizeof(char *))) { |
| 1476 | return grn_enc_stringcxx . . $ grn_enc_string.[enc]; |
| 1477 | } else { |
| 1478 | return "unknown"; |
| 1479 | } |
| 1480 | } |
| 1481 | |
| 1482 | grn_encodingcxx . . $ grn_encoding# |
| 1483 | grn_encoding_parsecxx . . $ grn_encoding_parse(32570f06a4d1f2d3).(const char *str) |
| 1484 | { |
| 1485 | grn_encodingcxx . . $ grn_encoding# e = GRN_ENC_UTF8cxx . . $ GRN_ENC_UTF8.; |
| 1486 | int i = sizeof(grn_enc_stringcxx . . $ grn_enc_string.) / sizeof(grn_enc_stringcxx . . $ grn_enc_string.[0]); |
| 1487 | while (i--) { |
| 1488 | if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(str, grn_enc_stringcxx . . $ grn_enc_string.[i])) { |
| 1489 | e = (grn_encodingcxx . . $ grn_encoding#)i; |
| 1490 | } |
| 1491 | } |
| 1492 | return e; |
| 1493 | } |
| 1494 | |
| 1495 | size_t |
| 1496 | grn_str_lencxx . . $ grn_str_len(445e83e90ccdb2bf).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 1497 | const char *str, |
| 1498 | const char *end, |
| 1499 | grn_encodingcxx . . $ grn_encoding# encoding, |
| 1500 | const char **last) |
| 1501 | { |
| 1502 | size_t len, tlen; |
| 1503 | const char *p = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 1504 | for (len = 0; str < end; len++) { |
| 1505 | p = str; |
| 1506 | if (!(tlen = grn_charlen_cxx . . $ grn_charlen_(b4b53c9e31f93d3e).(ctx, str, end, encoding))) { |
| 1507 | break; |
| 1508 | } |
| 1509 | str += tlen; |
| 1510 | } |
| 1511 | if (last) { |
| 1512 | *last = str; |
| 1513 | } |
| 1514 | return len; |
| 1515 | } |
| 1516 | |
| 1517 | int |
| 1518 | grn_isspacecxx . . $ grn_isspace(f8f88a86d74aa1ba).(const char *str, grn_encodingcxx . . $ grn_encoding# encoding) |
| 1519 | { |
| 1520 | const unsigned char *s = (const unsigned char *)str; |
| 1521 | if (!s) { |
| 1522 | return 0; |
| 1523 | } |
| 1524 | switch (s[0]) { |
| 1525 | case ' ': |
| 1526 | case '\f': |
| 1527 | case '\n': |
| 1528 | case '\r': |
| 1529 | case '\t': |
| 1530 | case '\v': |
| 1531 | return 1; |
| 1532 | case 0x81: |
| 1533 | if (encoding == GRN_ENC_SJIScxx . . $ GRN_ENC_SJIS. && s[1] == 0x40) { |
| 1534 | return 2; |
| 1535 | } |
| 1536 | break; |
| 1537 | case 0xA1: |
| 1538 | if (encoding == GRN_ENC_EUC_JPcxx . . $ GRN_ENC_EUC_JP. && s[1] == 0xA1) { |
| 1539 | return 2; |
| 1540 | } |
| 1541 | break; |
| 1542 | case 0xE3: |
| 1543 | if (encoding == GRN_ENC_UTF8cxx . . $ GRN_ENC_UTF8. && s[1] == 0x80 && s[2] == 0x80) { |
| 1544 | return 3; |
| 1545 | } |
| 1546 | break; |
| 1547 | default: |
| 1548 | break; |
| 1549 | } |
| 1550 | return 0; |
| 1551 | } |
| 1552 | |
| 1553 | int8_tcxx . . $ int8_t# |
| 1554 | grn_atoi8cxx . . $ grn_atoi8(152a5960b5dc2e0b).(const char *nptr, const char *end, const char **rest) |
| 1555 | { |
| 1556 | const char *p = nptr; |
| 1557 | int8_tcxx . . $ int8_t# v = 0, t, n = 0, o = 0; |
| 1558 | if (p < end && *p == '-') { |
| 1559 | p++; |
| 1560 | n = 1; |
| 1561 | o = 1; |
| 1562 | } |
| 1563 | while (p < end && *p >= '0' && *p <= '9') { |
| 1564 | t = (int8_tcxx . . $ int8_t#)(v * 10 - (*p - '0')); |
| 1565 | if (t > v || (!n && t == INT8_MINcxx . . $ `<external>/3415975807581488833/stdint.h:111:10`!)) { |
| 1566 | v = 0; |
| 1567 | break; |
| 1568 | } |
| 1569 | v = t; |
| 1570 | o = 0; |
| 1571 | p++; |
| 1572 | } |
| 1573 | if (rest) { |
| 1574 | *rest = o ? nptr : p; |
| 1575 | } |
| 1576 | return n ? v : -v; |
| 1577 | } |
| 1578 | |
| 1579 | uint8_tcxx . . $ uint8_t# |
| 1580 | grn_atoui8cxx . . $ grn_atoui8(f990af94c3e406d4).(const char *nptr, const char *end, const char **rest) |
| 1581 | { |
| 1582 | uint8_tcxx . . $ uint8_t# v = 0, t; |
| 1583 | while (nptr < end && *nptr >= '0' && *nptr <= '9') { |
| 1584 | t = (uint8_tcxx . . $ uint8_t#)(v * 10 + (*nptr - '0')); |
| 1585 | if (t < v) { |
| 1586 | v = 0; |
| 1587 | break; |
| 1588 | } |
| 1589 | v = t; |
| 1590 | nptr++; |
| 1591 | } |
| 1592 | if (rest) { |
| 1593 | *rest = nptr; |
| 1594 | } |
| 1595 | return v; |
| 1596 | } |
| 1597 | |
| 1598 | int16_tcxx . . $ int16_t# |
| 1599 | grn_atoi16cxx . . $ grn_atoi16(4913b82ede25a538).(const char *nptr, const char *end, const char **rest) |
| 1600 | { |
| 1601 | const char *p = nptr; |
| 1602 | int16_tcxx . . $ int16_t# v = 0, t, n = 0, o = 0; |
| 1603 | if (p < end && *p == '-') { |
| 1604 | p++; |
| 1605 | n = 1; |
| 1606 | o = 1; |
| 1607 | } |
| 1608 | while (p < end && *p >= '0' && *p <= '9') { |
| 1609 | t = (int16_tcxx . . $ int16_t#)(v * 10 - (*p - '0')); |
| 1610 | if (t > v || (!n && t == INT16_MINcxx . . $ `<external>/3415975807581488833/stdint.h:112:10`!)) { |
| 1611 | v = 0; |
| 1612 | break; |
| 1613 | } |
| 1614 | v = t; |
| 1615 | o = 0; |
| 1616 | p++; |
| 1617 | } |
| 1618 | if (rest) { |
| 1619 | *rest = o ? nptr : p; |
| 1620 | } |
| 1621 | return n ? v : -v; |
| 1622 | } |
| 1623 | |
| 1624 | uint16_tcxx . . $ uint16_t# |
| 1625 | grn_atoui16cxx . . $ grn_atoui16(d1cca3e5e0f31bcc).(const char *nptr, const char *end, const char **rest) |
| 1626 | { |
| 1627 | uint16_tcxx . . $ uint16_t# v = 0, t; |
| 1628 | while (nptr < end && *nptr >= '0' && *nptr <= '9') { |
| 1629 | t = (uint16_tcxx . . $ uint16_t#)(v * 10 + (*nptr - '0')); |
| 1630 | if (t < v) { |
| 1631 | v = 0; |
| 1632 | break; |
| 1633 | } |
| 1634 | v = t; |
| 1635 | nptr++; |
| 1636 | } |
| 1637 | if (rest) { |
| 1638 | *rest = nptr; |
| 1639 | } |
| 1640 | return v; |
| 1641 | } |
| 1642 | |
| 1643 | int |
| 1644 | grn_atoicxx . . $ grn_atoi(adf3ff2c2b114929).(const char *nptr, const char *end, const char **rest) |
| 1645 | { |
| 1646 | const char *p = nptr; |
| 1647 | int v = 0, t, n = 0, o = 0; |
| 1648 | if (p < end && *p == '-') { |
| 1649 | p++; |
| 1650 | n = 1; |
| 1651 | o = 1; |
| 1652 | } |
| 1653 | while (p < end && *p >= '0' && *p <= '9') { |
| 1654 | t = v * 10 - (*p - '0'); |
| 1655 | if (t > v || (!n && t == INT32_MINcxx . . $ `<external>/3415975807581488833/stdint.h:113:10`!)) { |
| 1656 | v = 0; |
| 1657 | break; |
| 1658 | } |
| 1659 | v = t; |
| 1660 | o = 0; |
| 1661 | p++; |
| 1662 | } |
| 1663 | if (rest) { |
| 1664 | *rest = o ? nptr : p; |
| 1665 | } |
| 1666 | return n ? v : -v; |
| 1667 | } |
| 1668 | |
| 1669 | unsigned int |
| 1670 | grn_atouicxx . . $ grn_atoui(2da3fe788a18ce64).(const char *nptr, const char *end, const char **rest) |
| 1671 | { |
| 1672 | unsigned int v = 0, t; |
| 1673 | while (nptr < end && *nptr >= '0' && *nptr <= '9') { |
| 1674 | t = v * 10 + (unsigned int)(*nptr - '0'); |
| 1675 | if (t < v) { |
| 1676 | v = 0; |
| 1677 | break; |
| 1678 | } |
| 1679 | v = t; |
| 1680 | nptr++; |
| 1681 | } |
| 1682 | if (rest) { |
| 1683 | *rest = nptr; |
| 1684 | } |
| 1685 | return v; |
| 1686 | } |
| 1687 | |
| 1688 | int64_tcxx . . $ int64_t# |
| 1689 | grn_atollcxx . . $ grn_atoll(e3438c906dd00acd).(const char *nptr, const char *end, const char **rest) |
| 1690 | { |
| 1691 | const char *p = nptr; |
| 1692 | int o = 0; |
| 1693 | int64_tcxx . . $ int64_t# v = 0; |
| 1694 | if (p < end && *p == '-') { |
| 1695 | p++; |
| 1696 | o = 1; |
| 1697 | while (p < end && *p >= '0' && *p <= '9') { |
| 1698 | int64_tcxx . . $ int64_t# t = v * 10 - (*p - '0'); |
| 1699 | if (t > v) { |
| 1700 | v = 0; |
| 1701 | break; |
| 1702 | } |
| 1703 | v = t; |
| 1704 | o = 0; |
| 1705 | p++; |
| 1706 | } |
| 1707 | } else { |
| 1708 | while (p < end && *p >= '0' && *p <= '9') { |
| 1709 | int64_tcxx . . $ int64_t# t = v * 10 + (*p - '0'); |
| 1710 | if (t < v) { |
| 1711 | v = 0; |
| 1712 | break; |
| 1713 | } |
| 1714 | v = t; |
| 1715 | p++; |
| 1716 | } |
| 1717 | } |
| 1718 | if (rest) { |
| 1719 | *rest = o ? nptr : p; |
| 1720 | } |
| 1721 | return v; |
| 1722 | } |
| 1723 | |
| 1724 | uint64_tcxx . . $ uint64_t# |
| 1725 | grn_atoullcxx . . $ grn_atoull(bd2852887cfac9d6).(const char *nptr, const char *end, const char **rest) |
| 1726 | { |
| 1727 | uint64_tcxx . . $ uint64_t# v = 0, t; |
| 1728 | while (nptr < end && *nptr >= '0' && *nptr <= '9') { |
| 1729 | t = v * 10 + (uint64_tcxx . . $ uint64_t#)(*nptr - '0'); |
| 1730 | if (t < v) { |
| 1731 | v = 0; |
| 1732 | break; |
| 1733 | } |
| 1734 | v = t; |
| 1735 | nptr++; |
| 1736 | } |
| 1737 | if (rest) { |
| 1738 | *rest = nptr; |
| 1739 | } |
| 1740 | return v; |
| 1741 | } |
| 1742 | |
| 1743 | unsigned int |
| 1744 | grn_htouicxx . . $ grn_htoui(2da3fe788a18ce64).(const char *nptr, const char *end, const char **rest) |
| 1745 | { |
| 1746 | unsigned int v = 0, t; |
| 1747 | while (nptr < end) { |
| 1748 | switch (*nptr) { |
| 1749 | case '0': |
| 1750 | case '1': |
| 1751 | case '2': |
| 1752 | case '3': |
| 1753 | case '4': |
| 1754 | case '5': |
| 1755 | case '6': |
| 1756 | case '7': |
| 1757 | case '8': |
| 1758 | case '9': |
| 1759 | t = v * 16 + (unsigned int)(*nptr++ - '0'); |
| 1760 | break; |
| 1761 | case 'a': |
| 1762 | case 'b': |
| 1763 | case 'c': |
| 1764 | case 'd': |
| 1765 | case 'e': |
| 1766 | case 'f': |
| 1767 | t = v * 16 + (unsigned int)(*nptr++ - 'a') + 10; |
| 1768 | break; |
| 1769 | case 'A': |
| 1770 | case 'B': |
| 1771 | case 'C': |
| 1772 | case 'D': |
| 1773 | case 'E': |
| 1774 | case 'F': |
| 1775 | t = v * 16 + (unsigned int)(*nptr++ - 'A') + 10; |
| 1776 | break; |
| 1777 | default: |
| 1778 | v = 0; |
| 1779 | goto exit; |
| 1780 | } |
| 1781 | if (t < v) { |
| 1782 | v = 0; |
| 1783 | goto exit; |
| 1784 | } |
| 1785 | v = t; |
| 1786 | } |
| 1787 | exit: |
| 1788 | if (rest) { |
| 1789 | *rest = nptr; |
| 1790 | } |
| 1791 | return v; |
| 1792 | } |
| 1793 | |
| 1794 | void |
| 1795 | grn_itohcxx . . $ grn_itoh(8d45ad636653b6f2).(unsigned int i, char *p, unsigned int len) |
| 1796 | { |
| 1797 | static const char *hex = "0123456789ABCDEF"; |
| 1798 | p += len - 1; |
| 1799 | while (len--) { |
| 1800 | *p-- = hex[i & 0xf]; |
| 1801 | i >>= 4; |
| 1802 | } |
| 1803 | } |
| 1804 | |
| 1805 | grn_rccxx . . $ grn_rc# |
| 1806 | grn_itoacxx . . $ grn_itoa(33e71d0fc16b913b).(int i, char *p, char *end, char **rest) |
| 1807 | { |
| 1808 | char *q; |
| 1809 | if (p >= end) { |
| 1810 | return GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.; |
| 1811 | } |
| 1812 | q = p; |
| 1813 | if (i < 0) { |
| 1814 | *p++ = '-'; |
| 1815 | q = p; |
| 1816 | if (i == INT_MINcxx . . $ `<external>/2419331716647297546/limits.h:118:9`!) { |
| 1817 | if (p >= end) { |
| 1818 | return GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.; |
| 1819 | } |
| 1820 | *p++ = (char)((-(i % 10)) + '0'); |
| 1821 | i /= 10; |
| 1822 | } |
| 1823 | i = -i; |
| 1824 | } |
| 1825 | do { |
| 1826 | if (p >= end) { |
| 1827 | return GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.; |
| 1828 | } |
| 1829 | *p++ = (char)(i % 10 + '0'); |
| 1830 | } while ((i /= 10) > 0); |
| 1831 | if (rest) { |
| 1832 | *rest = p; |
| 1833 | } |
| 1834 | for (p--; q < p; q++, p--) { |
| 1835 | char t = *q; |
| 1836 | *q = *p; |
| 1837 | *p = t; |
| 1838 | } |
| 1839 | return GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 1840 | } |
| 1841 | |
| 1842 | grn_rccxx . . $ grn_rc# |
| 1843 | grn_itoa_paddedcxx . . $ grn_itoa_padded(3aed0f8ccd493c05).(int i, char *p, char *end, char ch) |
| 1844 | { |
| 1845 | char *q; |
| 1846 | if (p >= end) { |
| 1847 | return GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.; |
| 1848 | } |
| 1849 | if (i < 0) { |
| 1850 | *p++ = '-'; |
| 1851 | if (i == INT_MINcxx . . $ `<external>/2419331716647297546/limits.h:118:9`!) { |
| 1852 | if (p >= end) { |
| 1853 | return GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.; |
| 1854 | } |
| 1855 | *p++ = (char)((-(i % 10)) + '0'); |
| 1856 | i /= 10; |
| 1857 | } |
| 1858 | i = -i; |
| 1859 | } |
| 1860 | q = end - 1; |
| 1861 | do { |
| 1862 | if (q < p) { |
| 1863 | return GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.; |
| 1864 | } |
| 1865 | *q-- = (char)(i % 10 + '0'); |
| 1866 | } while ((i /= 10) > 0); |
| 1867 | while (q >= p) { |
| 1868 | *q-- = ch; |
| 1869 | } |
| 1870 | return GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 1871 | } |
| 1872 | |
| 1873 | grn_rccxx . . $ grn_rc# |
| 1874 | grn_lltoacxx . . $ grn_lltoa(818d36cd4dfb4adb).(int64_tcxx . . $ int64_t# i, char *p, char *end, char **rest) |
| 1875 | { |
| 1876 | char *q; |
| 1877 | if (p >= end) { |
| 1878 | return GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.; |
| 1879 | } |
| 1880 | q = p; |
| 1881 | if (i < 0) { |
| 1882 | *p++ = '-'; |
| 1883 | q = p; |
| 1884 | if (i == INT64_MINcxx . . $ `<external>/3415975807581488833/stdint.h:114:10`!) { |
| 1885 | *p++ = (char)((-(i % 10)) + '0'); |
| 1886 | i /= 10; |
| 1887 | } |
| 1888 | i = -i; |
| 1889 | } |
| 1890 | do { |
| 1891 | if (p >= end) { |
| 1892 | return GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.; |
| 1893 | } |
| 1894 | *p++ = (char)(i % 10 + '0'); |
| 1895 | } while ((i /= 10) > 0); |
| 1896 | if (rest) { |
| 1897 | *rest = p; |
| 1898 | } |
| 1899 | for (p--; q < p; q++, p--) { |
| 1900 | char t = *q; |
| 1901 | *q = *p; |
| 1902 | *p = t; |
| 1903 | } |
| 1904 | return GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 1905 | } |
| 1906 | |
| 1907 | grn_rccxx . . $ grn_rc# |
| 1908 | grn_ulltoacxx . . $ grn_ulltoa(21641f6ae377f469).(uint64_tcxx . . $ uint64_t# i, char *p, char *end, char **rest) |
| 1909 | { |
| 1910 | char *q; |
| 1911 | if (p >= end) { |
| 1912 | return GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.; |
| 1913 | } |
| 1914 | q = p; |
| 1915 | do { |
| 1916 | if (p >= end) { |
| 1917 | return GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.; |
| 1918 | } |
| 1919 | *p++ = (char)(i % 10 + '0'); |
| 1920 | } while ((i /= 10) > 0); |
| 1921 | if (rest) { |
| 1922 | *rest = p; |
| 1923 | } |
| 1924 | for (p--; q < p; q++, p--) { |
| 1925 | char t = *q; |
| 1926 | *q = *p; |
| 1927 | *p = t; |
| 1928 | } |
| 1929 | return GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 1930 | } |
| 1931 | |
| 1932 | #define I2Bcxx . . $ `lib/str.c:1932:9`!(i) \ |
| 1933 | ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(i) & \ |
| 1934 | 0x3f]) |
| 1935 | |
| 1936 | #define B2Icxx . . $ `lib/str.c:1936:9`!(b) \ |
| 1937 | (((b) < '+' || 'z' < (b)) \ |
| 1938 | ? 0xff \ |
| 1939 | : "\x3e\xff\xff\xff\x3f\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\xff\xff" \ |
| 1940 | "\xff\xff\xff\xff\xff\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b" \ |
| 1941 | "\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\xff\xff\xff" \ |
| 1942 | "\xff\xff\xff\x1a\x1b\x1c\x1d\x1e\x1f\x20\x21\x22\x23\x24\x25\x26\x27" \ |
| 1943 | "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33"[(b) - '+']) |
| 1944 | |
| 1945 | #define MASKcxx . . $ `lib/str.c:1945:9`! 0x34d34d34 |
| 1946 | |
| 1947 | char * |
| 1948 | grn_itobcxx . . $ grn_itob(76b3be8b15f1dbe5).(grn_idcxx . . $ grn_id# id, char *p) |
| 1949 | { |
| 1950 | id ^= MASKcxx . . $ `lib/str.c:1945:9`!; |
| 1951 | *p++ = I2Bcxx . . $ `lib/str.c:1932:9`!(id >> 24); |
| 1952 | *p++ = I2Bcxx . . $ `lib/str.c:1932:9`!(id >> 18); |
| 1953 | *p++ = I2Bcxx . . $ `lib/str.c:1932:9`!(id >> 12); |
| 1954 | *p++ = I2Bcxx . . $ `lib/str.c:1932:9`!(id >> 6); |
| 1955 | *p++ = I2Bcxx . . $ `lib/str.c:1932:9`!(id); |
| 1956 | return p; |
| 1957 | } |
| 1958 | |
| 1959 | grn_idcxx . . $ grn_id# |
| 1960 | grn_btoicxx . . $ grn_btoi(33ab057182e9f89d).(char *b) |
| 1961 | { |
| 1962 | uint8_tcxx . . $ uint8_t# i; |
| 1963 | grn_idcxx . . $ grn_id# id = 0; |
| 1964 | int len = 5; |
| 1965 | while (len--) { |
| 1966 | char c = *b++; |
| 1967 | if ((i = (uint8_tcxx . . $ uint8_t#)B2Icxx . . $ `lib/str.c:1936:9`!(c)) == 0xff) { |
| 1968 | return 0; |
| 1969 | } |
| 1970 | id = (id << 6) + i; |
| 1971 | } |
| 1972 | return id ^ MASKcxx . . $ `lib/str.c:1945:9`!; |
| 1973 | } |
| 1974 | |
| 1975 | #define I2B32Hcxx . . $ `lib/str.c:1975:9`!(i) ("0123456789ABCDEFGHIJKLMNOPQRSTUV"[(i) & 0x1f]) |
| 1976 | |
| 1977 | char * |
| 1978 | grn_lltob32hcxx . . $ grn_lltob32h(a9665d948aa03972).(int64_tcxx . . $ int64_t# i, char *p) |
| 1979 | { |
| 1980 | uint64_tcxx . . $ uint64_t# u = (uint64_tcxx . . $ uint64_t#)i + 0x8000000000000000ULL; |
| 1981 | *p++ = I2B32Hcxx . . $ `lib/str.c:1975:9`!(u >> 60); |
| 1982 | *p++ = I2B32Hcxx . . $ `lib/str.c:1975:9`!(u >> 55); |
| 1983 | *p++ = I2B32Hcxx . . $ `lib/str.c:1975:9`!(u >> 50); |
| 1984 | *p++ = I2B32Hcxx . . $ `lib/str.c:1975:9`!(u >> 45); |
| 1985 | *p++ = I2B32Hcxx . . $ `lib/str.c:1975:9`!(u >> 40); |
| 1986 | *p++ = I2B32Hcxx . . $ `lib/str.c:1975:9`!(u >> 35); |
| 1987 | *p++ = I2B32Hcxx . . $ `lib/str.c:1975:9`!(u >> 30); |
| 1988 | *p++ = I2B32Hcxx . . $ `lib/str.c:1975:9`!(u >> 25); |
| 1989 | *p++ = I2B32Hcxx . . $ `lib/str.c:1975:9`!(u >> 20); |
| 1990 | *p++ = I2B32Hcxx . . $ `lib/str.c:1975:9`!(u >> 15); |
| 1991 | *p++ = I2B32Hcxx . . $ `lib/str.c:1975:9`!(u >> 10); |
| 1992 | *p++ = I2B32Hcxx . . $ `lib/str.c:1975:9`!(u >> 5); |
| 1993 | *p++ = I2B32Hcxx . . $ `lib/str.c:1975:9`!(u); |
| 1994 | return p; |
| 1995 | } |
| 1996 | |
| 1997 | char * |
| 1998 | grn_ulltob32hcxx . . $ grn_ulltob32h(d2dea573f08ae648).(uint64_tcxx . . $ uint64_t# i, char *p) |
| 1999 | { |
| 2000 | char lb = (i >> 59) & 0x10; |
| 2001 | i += 0x8000000000000000ULL; |
| 2002 | *p++ = lb + I2B32Hcxx . . $ `lib/str.c:1975:9`!(i >> 60); |
| 2003 | *p++ = I2B32Hcxx . . $ `lib/str.c:1975:9`!(i >> 55); |
| 2004 | *p++ = I2B32Hcxx . . $ `lib/str.c:1975:9`!(i >> 50); |
| 2005 | *p++ = I2B32Hcxx . . $ `lib/str.c:1975:9`!(i >> 45); |
| 2006 | *p++ = I2B32Hcxx . . $ `lib/str.c:1975:9`!(i >> 40); |
| 2007 | *p++ = I2B32Hcxx . . $ `lib/str.c:1975:9`!(i >> 35); |
| 2008 | *p++ = I2B32Hcxx . . $ `lib/str.c:1975:9`!(i >> 30); |
| 2009 | *p++ = I2B32Hcxx . . $ `lib/str.c:1975:9`!(i >> 25); |
| 2010 | *p++ = I2B32Hcxx . . $ `lib/str.c:1975:9`!(i >> 20); |
| 2011 | *p++ = I2B32Hcxx . . $ `lib/str.c:1975:9`!(i >> 15); |
| 2012 | *p++ = I2B32Hcxx . . $ `lib/str.c:1975:9`!(i >> 10); |
| 2013 | *p++ = I2B32Hcxx . . $ `lib/str.c:1975:9`!(i >> 5); |
| 2014 | *p++ = I2B32Hcxx . . $ `lib/str.c:1975:9`!(i); |
| 2015 | return p; |
| 2016 | } |
| 2017 | |
| 2018 | grn_rccxx . . $ grn_rc# |
| 2019 | grn_atoncxx . . $ grn_aton(544d61017b0b1e75).( |
| 2020 | grn_ctxcxx . . $ grn_ctx# *ctx, const char *p, const char *end, const char **rest, grn_objcxx . . $ grn_obj# *res) |
| 2021 | { |
| 2022 | grn_rccxx . . $ grn_rc# rc = GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 2023 | |
| 2024 | if (*p == '+') { |
| 2025 | p++; |
| 2026 | } |
| 2027 | |
| 2028 | switch (*p) { |
| 2029 | case '-': |
| 2030 | case '0': |
| 2031 | case '1': |
| 2032 | case '2': |
| 2033 | case '3': |
| 2034 | case '4': |
| 2035 | case '5': |
| 2036 | case '6': |
| 2037 | case '7': |
| 2038 | case '8': |
| 2039 | case '9': |
| 2040 | { |
| 2041 | int64_tcxx . . $ int64_t# int64; |
| 2042 | char rest_char; |
| 2043 | int64 = grn_atollcxx . . $ grn_atoll(e3438c906dd00acd).(p, end, rest); |
| 2044 | rest_char = **rest; |
| 2045 | if (end == *rest) { |
| 2046 | if ((int64_tcxx . . $ int64_t#)INT32_MINcxx . . $ `<external>/3415975807581488833/stdint.h:113:10`! <= int64 && int64 <= (int64_tcxx . . $ int64_t#)INT32_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:118:10`!) { |
| 2047 | grn_obj_reinitcxx . . $ grn_obj_reinit(fc9ea836325dd1d2).(ctx, res, GRN_DB_INT32cxx . . $ GRN_DB_INT32., 0); |
| 2048 | GRN_INT32_SETcxx . . $ `include/groonga/groonga.h:2904:9`!(ctx, res, int64); |
| 2049 | } else if ((int64_tcxx . . $ int64_t#)INT32_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:118:10`! < int64 && int64 <= (int64_tcxx . . $ int64_t#)UINT32_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:124:10`!) { |
| 2050 | grn_obj_reinitcxx . . $ grn_obj_reinit(fc9ea836325dd1d2).(ctx, res, GRN_DB_UINT32cxx . . $ GRN_DB_UINT32., 0); |
| 2051 | GRN_UINT32_SETcxx . . $ `include/groonga/groonga.h:2909:9`!(ctx, res, int64); |
| 2052 | } else { |
| 2053 | grn_obj_reinitcxx . . $ grn_obj_reinit(fc9ea836325dd1d2).(ctx, res, GRN_DB_INT64cxx . . $ GRN_DB_INT64., 0); |
| 2054 | GRN_INT64_SETcxx . . $ `include/groonga/groonga.h:2914:9`!(ctx, res, int64); |
| 2055 | } |
| 2056 | } else { |
| 2057 | if (*p != '-' && rest_char >= '0' && rest_char <= '9') { |
| 2058 | uint64_tcxx . . $ uint64_t# uint64 = grn_atoullcxx . . $ grn_atoull(bd2852887cfac9d6).(p, end, rest); |
| 2059 | if (end == *rest) { |
| 2060 | grn_obj_reinitcxx . . $ grn_obj_reinit(fc9ea836325dd1d2).(ctx, res, GRN_DB_UINT64cxx . . $ GRN_DB_UINT64., 0); |
| 2061 | GRN_UINT64_SETcxx . . $ `include/groonga/groonga.h:2919:9`!(ctx, res, uint64); |
| 2062 | } |
| 2063 | } |
| 2064 | if (end != *rest) { |
| 2065 | if (rest_char == '.' || rest_char == 'e' || rest_char == 'E' || |
| 2066 | (rest_char >= '0' && rest_char <= '9')) { |
| 2067 | grn_objcxx . . $ grn_obj# buffer; |
| 2068 | char *rest_float; |
| 2069 | double d; |
| 2070 | errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = 0; |
| 2071 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&buffer, 0); |
| 2072 | GRN_TEXT_SETcxx . . $ `include/groonga/groonga.h:2761:9`!(ctx, &buffer, p, end - p); |
| 2073 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, &buffer, '\0'); |
| 2074 | d = strtodcxx . . $ strtod(3dfe5620a0d3160e).(GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&buffer), &rest_float); |
| 2075 | if (errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! == 0 && rest_float + 1 == GRN_BULK_CURRcxx . . $ `include/groonga/groonga.h:2650:9`!(&buffer)) { |
| 2076 | grn_obj_reinitcxx . . $ grn_obj_reinit(fc9ea836325dd1d2).(ctx, res, GRN_DB_FLOATcxx . . $ GRN_DB_FLOAT., 0); |
| 2077 | GRN_FLOAT_SETcxx . . $ `include/groonga/groonga.h:2934:9`!(ctx, res, d); |
| 2078 | *rest = end; |
| 2079 | } else { |
| 2080 | rc = GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.; |
| 2081 | } |
| 2082 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &buffer); |
| 2083 | } |
| 2084 | } |
| 2085 | } |
| 2086 | } |
| 2087 | break; |
| 2088 | default: |
| 2089 | rc = GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.; |
| 2090 | break; |
| 2091 | } |
| 2092 | |
| 2093 | return rc; |
| 2094 | } |
| 2095 | |
| 2096 | int |
| 2097 | grn_str_tokcxx . . $ grn_str_tok(edef019617c279c5).(const char *str, |
| 2098 | size_t str_len, |
| 2099 | char delim, |
| 2100 | const char **tokbuf, |
| 2101 | int buf_size, |
| 2102 | const char **rest) |
| 2103 | { |
| 2104 | const char **tok = tokbuf, **tok_end = tokbuf + buf_size; |
| 2105 | if (buf_size > 0) { |
| 2106 | const char *str_end = str + str_len; |
| 2107 | for (;; str++) { |
| 2108 | if (str == str_end) { |
| 2109 | *tok++ = str; |
| 2110 | break; |
| 2111 | } |
| 2112 | if (delim == *str) { |
| 2113 | // *str = '\0'; |
| 2114 | *tok++ = str; |
| 2115 | if (tok == tok_end) { |
| 2116 | break; |
| 2117 | } |
| 2118 | } |
| 2119 | } |
| 2120 | } |
| 2121 | if (rest) { |
| 2122 | *rest = str; |
| 2123 | } |
| 2124 | return (int)(tok - tokbuf); |
| 2125 | } |
| 2126 | |
| 2127 | static inline int |
| 2128 | op_getopt_flagcxx . . $ op_getopt_flag(5ed685dc442382ba).(int *flags, |
| 2129 | const grn_str_getopt_optcxx . . $ grn_str_getopt_opt# *o, |
| 2130 | int argc, |
| 2131 | char *const argv[], |
| 2132 | int i, |
| 2133 | const char *optvalue) |
| 2134 | { |
| 2135 | switch (o->opcxx . . $ $anonymous_type_946308ef283cea1e_1#op.) { |
| 2136 | case GETOPT_OP_NONEcxx . . $ GETOPT_OP_NONE.: |
| 2137 | break; |
| 2138 | case GETOPT_OP_ONcxx . . $ GETOPT_OP_ON.: |
| 2139 | *flags |= o->flagcxx . . $ $anonymous_type_946308ef283cea1e_1#flag.; |
| 2140 | break; |
| 2141 | case GETOPT_OP_OFFcxx . . $ GETOPT_OP_OFF.: |
| 2142 | *flags &= ~o->flagcxx . . $ $anonymous_type_946308ef283cea1e_1#flag.; |
| 2143 | break; |
| 2144 | case GETOPT_OP_UPDATEcxx . . $ GETOPT_OP_UPDATE.: |
| 2145 | *flags = o->flagcxx . . $ $anonymous_type_946308ef283cea1e_1#flag.; |
| 2146 | break; |
| 2147 | default: |
| 2148 | return i; |
| 2149 | } |
| 2150 | if (o->argcxx . . $ $anonymous_type_946308ef283cea1e_1#arg.) { |
| 2151 | if (optvalue) { |
| 2152 | *o->argcxx . . $ $anonymous_type_946308ef283cea1e_1#arg. = (char *)optvalue; |
| 2153 | } else if (++i < argc) { |
| 2154 | *o->argcxx . . $ $anonymous_type_946308ef283cea1e_1#arg. = argv[i]; |
| 2155 | } else { |
| 2156 | return -1; |
| 2157 | } |
| 2158 | } |
| 2159 | return i; |
| 2160 | } |
| 2161 | |
| 2162 | int |
| 2163 | grn_str_getoptcxx . . $ grn_str_getopt(1f77e49aad5fba88).(int argc, |
| 2164 | char *const argv[], |
| 2165 | const grn_str_getopt_optcxx . . $ grn_str_getopt_opt# *opts, |
| 2166 | int *flags) |
| 2167 | { |
| 2168 | int i; |
| 2169 | for (i = 1; i < argc; i++) { |
| 2170 | const char *v = argv[i]; |
| 2171 | if (*v == '-') { |
| 2172 | const grn_str_getopt_optcxx . . $ grn_str_getopt_opt# *o; |
| 2173 | int found; |
| 2174 | if (*++v == '-') { |
| 2175 | const char *eq; |
| 2176 | size_t len; |
| 2177 | found = 0; |
| 2178 | v++; |
| 2179 | for (eq = v; *eq != '\0' && *eq != '='; eq++) { |
| 2180 | } |
| 2181 | len = (size_t)(eq - v); |
| 2182 | for (o = opts; o->optcxx . . $ $anonymous_type_946308ef283cea1e_1#opt. != '\0' || o->longoptcxx . . $ $anonymous_type_946308ef283cea1e_1#longopt. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; o++) { |
| 2183 | if (o->longoptcxx . . $ $anonymous_type_946308ef283cea1e_1#longopt. && strlencxx . . $ strlen(751346f8406fd082).(o->longoptcxx . . $ $anonymous_type_946308ef283cea1e_1#longopt.) == len && |
| 2184 | !memcmpcxx . . $ memcmp(36f949851efa3055).(v, o->longoptcxx . . $ $anonymous_type_946308ef283cea1e_1#longopt., len)) { |
| 2185 | i = op_getopt_flagcxx . . $ op_getopt_flag(5ed685dc442382ba).(flags, |
| 2186 | o, |
| 2187 | argc, |
| 2188 | argv, |
| 2189 | i, |
| 2190 | (*eq == '\0' ? NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! : eq + 1)); |
| 2191 | if (i < 0) { |
| 2192 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, |
| 2193 | "%s: option '--%s' needs argument.\n", |
| 2194 | argv[0], |
| 2195 | o->longoptcxx . . $ $anonymous_type_946308ef283cea1e_1#longopt.); |
| 2196 | return -1; |
| 2197 | } |
| 2198 | found = 1; |
| 2199 | break; |
| 2200 | } |
| 2201 | } |
| 2202 | if (!found) { |
| 2203 | goto exit; |
| 2204 | } |
| 2205 | } else { |
| 2206 | const char *p; |
| 2207 | for (p = v; *p; p++) { |
| 2208 | found = 0; |
| 2209 | for (o = opts; o->optcxx . . $ $anonymous_type_946308ef283cea1e_1#opt. != '\0' || o->longoptcxx . . $ $anonymous_type_946308ef283cea1e_1#longopt. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; o++) { |
| 2210 | if (o->optcxx . . $ $anonymous_type_946308ef283cea1e_1#opt. && *p == o->optcxx . . $ $anonymous_type_946308ef283cea1e_1#opt.) { |
| 2211 | i = op_getopt_flagcxx . . $ op_getopt_flag(5ed685dc442382ba).(flags, o, argc, argv, i, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 2212 | if (i < 0) { |
| 2213 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, |
| 2214 | "%s: option '-%c' needs argument.\n", |
| 2215 | argv[0], |
| 2216 | *p); |
| 2217 | return -1; |
| 2218 | } |
| 2219 | found = 1; |
| 2220 | break; |
| 2221 | } |
| 2222 | } |
| 2223 | if (!found) { |
| 2224 | goto exit; |
| 2225 | } |
| 2226 | } |
| 2227 | } |
| 2228 | } else { |
| 2229 | break; |
| 2230 | } |
| 2231 | } |
| 2232 | return i; |
| 2233 | exit: |
| 2234 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "%s: cannot recognize option '%s'.\n", argv[0], argv[i]); |
| 2235 | return -1; |
| 2236 | } |
| 2237 | |
| 2238 | #define UNIT_SIZEcxx . . $ `lib/str.c:2238:9`! (1 << 12) |
| 2239 | #define UNIT_MASKcxx . . $ `lib/str.c:2239:9`! (UNIT_SIZEcxx . . $ `lib/str.c:2238:9`! - 1) |
| 2240 | |
| 2241 | static size_t grn_bulk_margin_sizecxx . . $ grn_bulk_margin_size. = 0; |
| 2242 | |
| 2243 | grn_rccxx . . $ grn_rc# |
| 2244 | grn_bulk_resizecxx . . $ grn_bulk_resize(f9a66385f261f61d).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *buf, size_t new_size) |
| 2245 | { |
| 2246 | new_size += grn_bulk_margin_sizecxx . . $ grn_bulk_margin_size. + 1; |
| 2247 | if (!GRN_BULK_OUTPcxx . . $ `include/groonga/groonga.h:2598:9`!(buf) && new_size <= GRN_BULK_BUFSIZEcxx . . $ `include/groonga/groonga.h:2594:9`!) { |
| 2248 | return GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 2249 | } |
| 2250 | |
| 2251 | { |
| 2252 | size_t rounded_new_size; |
| 2253 | rounded_new_size = (new_size + (UNIT_MASKcxx . . $ `lib/str.c:2239:9`!)) & (size_t)(~UNIT_MASKcxx . . $ `lib/str.c:2239:9`!); |
| 2254 | if (rounded_new_size < new_size) { |
| 2255 | size_t current_size = GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(buf); |
| 2256 | grn_rccxx . . $ grn_rc# rc = GRN_NOT_ENOUGH_SPACEcxx . . $ GRN_NOT_ENOUGH_SPACE.; |
| 2257 | ERRcxx . . $ `lib/grn_error.h:156:9`!(rc, |
| 2258 | "[bulk][resize] too large size: " |
| 2259 | "<%" GRN_FMT_SIZEcxx . . $ `lib/grn.h:408:11`! "> -> <%" GRN_FMT_SIZEcxx . . $ `lib/grn.h:408:11`! ">(<%" GRN_FMT_SIZEcxx . . $ `lib/grn.h:408:11`! ">)", |
| 2260 | current_size, |
| 2261 | new_size, |
| 2262 | rounded_new_size); |
| 2263 | return rc; |
| 2264 | } |
| 2265 | new_size = rounded_new_size; |
| 2266 | } |
| 2267 | |
| 2268 | if (GRN_BULK_OUTPcxx . . $ `include/groonga/groonga.h:2598:9`!(buf)) { |
| 2269 | char *head = buf->ucxx . . $ _grn_obj#u..bcxx . . $ _grn_obj#$anonymous_type_6#b..headcxx . . $ _grn_obj#$anonymous_type_6#$anonymous_type_7#head. - (buf->ucxx . . $ _grn_obj#u..bcxx . . $ _grn_obj#$anonymous_type_6#b..headcxx . . $ _grn_obj#$anonymous_type_6#$anonymous_type_7#head. ? grn_bulk_margin_sizecxx . . $ grn_bulk_margin_size. : 0); |
| 2270 | if (!(head = GRN_REALLOCcxx . . $ `lib/grn_alloc.h:43:9`!(head, new_size))) { |
| 2271 | return GRN_NO_MEMORY_AVAILABLEcxx . . $ GRN_NO_MEMORY_AVAILABLE.; |
| 2272 | } |
| 2273 | buf->ucxx . . $ _grn_obj#u..bcxx . . $ _grn_obj#$anonymous_type_6#b..currcxx . . $ _grn_obj#$anonymous_type_6#$anonymous_type_7#curr. = head + grn_bulk_margin_sizecxx . . $ grn_bulk_margin_size. + GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(buf); |
| 2274 | buf->ucxx . . $ _grn_obj#u..bcxx . . $ _grn_obj#$anonymous_type_6#b..headcxx . . $ _grn_obj#$anonymous_type_6#$anonymous_type_7#head. = head + grn_bulk_margin_sizecxx . . $ grn_bulk_margin_size.; |
| 2275 | buf->ucxx . . $ _grn_obj#u..bcxx . . $ _grn_obj#$anonymous_type_6#b..tailcxx . . $ _grn_obj#$anonymous_type_6#$anonymous_type_7#tail. = head + new_size; |
| 2276 | } else { |
| 2277 | char *head; |
| 2278 | if (!(head = GRN_MALLOCcxx . . $ `lib/grn_alloc.h:41:9`!(new_size))) { |
| 2279 | return GRN_NO_MEMORY_AVAILABLEcxx . . $ GRN_NO_MEMORY_AVAILABLE.; |
| 2280 | } |
| 2281 | grn_memcpycxx . . $ `include/groonga/portability.h:32:13`!(head, GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(buf), GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(buf)); |
| 2282 | buf->ucxx . . $ _grn_obj#u..bcxx . . $ _grn_obj#$anonymous_type_6#b..currcxx . . $ _grn_obj#$anonymous_type_6#$anonymous_type_7#curr. = head + grn_bulk_margin_sizecxx . . $ grn_bulk_margin_size. + GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(buf); |
| 2283 | buf->ucxx . . $ _grn_obj#u..bcxx . . $ _grn_obj#$anonymous_type_6#b..headcxx . . $ _grn_obj#$anonymous_type_6#$anonymous_type_7#head. = head + grn_bulk_margin_sizecxx . . $ grn_bulk_margin_size.; |
| 2284 | buf->ucxx . . $ _grn_obj#u..bcxx . . $ _grn_obj#$anonymous_type_6#b..tailcxx . . $ _grn_obj#$anonymous_type_6#$anonymous_type_7#tail. = head + new_size; |
| 2285 | buf->headercxx . . $ _grn_obj#header..impl_flagscxx . . $ _grn_obj_header#impl_flags. |= GRN_OBJ_OUTPLACEcxx . . $ `include/groonga/groonga.h:936:9`!; |
| 2286 | } |
| 2287 | |
| 2288 | return GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 2289 | } |
| 2290 | |
| 2291 | grn_rccxx . . $ grn_rc# |
| 2292 | grn_bulk_reinitcxx . . $ grn_bulk_reinit(f9a66385f261f61d).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *buf, size_t size) |
| 2293 | { |
| 2294 | GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(buf); |
| 2295 | return grn_bulk_resizecxx . . $ grn_bulk_resize(f9a66385f261f61d).(ctx, buf, size); |
| 2296 | } |
| 2297 | |
| 2298 | static size_t |
| 2299 | grn_bulk_compute_new_sizecxx . . $ grn_bulk_compute_new_size(44979b7263dd8a44).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *buf, size_t new_size) |
| 2300 | { |
| 2301 | if ((GRN_BULK_OUTPcxx . . $ `include/groonga/groonga.h:2598:9`!(buf) || |
| 2302 | (new_size + grn_bulk_margin_sizecxx . . $ grn_bulk_margin_size. + 1) > GRN_BULK_BUFSIZEcxx . . $ `include/groonga/groonga.h:2594:9`!) && |
| 2303 | (new_size < (UINT32_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:124:10`! / 2))) { |
| 2304 | new_size *= 2; |
| 2305 | } |
| 2306 | return new_size; |
| 2307 | } |
| 2308 | |
| 2309 | grn_rccxx . . $ grn_rc# |
| 2310 | grn_bulk_writecxx . . $ grn_bulk_write(4609c18fd87cf054).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *buf, const char *str, size_t len) |
| 2311 | { |
| 2312 | grn_rccxx . . $ grn_rc# rc = GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 2313 | char *curr; |
| 2314 | if (GRN_BULK_RESTcxx . . $ `include/groonga/groonga.h:2638:9`!(buf) < len) { |
| 2315 | size_t new_size; |
| 2316 | new_size = grn_bulk_compute_new_sizecxx . . $ grn_bulk_compute_new_size(44979b7263dd8a44).(ctx, buf, GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(buf) + len); |
| 2317 | if ((rc = grn_bulk_resizecxx . . $ grn_bulk_resize(f9a66385f261f61d).(ctx, buf, new_size))) { |
| 2318 | return rc; |
| 2319 | } |
| 2320 | } |
| 2321 | if (len > 0) { |
| 2322 | curr = GRN_BULK_CURRcxx . . $ `include/groonga/groonga.h:2650:9`!(buf); |
| 2323 | grn_memcpycxx . . $ `include/groonga/portability.h:32:13`!(curr, str, len); |
| 2324 | GRN_BULK_INCR_LENcxx . . $ `include/groonga/groonga.h:2627:9`!(buf, len); |
| 2325 | } |
| 2326 | return rc; |
| 2327 | } |
| 2328 | |
| 2329 | grn_rccxx . . $ grn_rc# |
| 2330 | grn_bulk_write_fromcxx . . $ grn_bulk_write_from(d8dd2947254981a1).( |
| 2331 | grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *bulk, const char *str, size_t from, size_t len) |
| 2332 | { |
| 2333 | grn_rccxx . . $ grn_rc# rc = grn_bulk_truncatecxx . . $ grn_bulk_truncate(f9a66385f261f61d).(ctx, bulk, from); |
| 2334 | if (!rc) { |
| 2335 | rc = grn_bulk_writecxx . . $ grn_bulk_write(4609c18fd87cf054).(ctx, bulk, str, len); |
| 2336 | } |
| 2337 | return rc; |
| 2338 | } |
| 2339 | |
| 2340 | grn_rccxx . . $ grn_rc# |
| 2341 | grn_bulk_reservecxx . . $ grn_bulk_reserve(f9a66385f261f61d).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *buf, size_t len) |
| 2342 | { |
| 2343 | grn_rccxx . . $ grn_rc# rc = GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 2344 | if (GRN_BULK_RESTcxx . . $ `include/groonga/groonga.h:2638:9`!(buf) < len) { |
| 2345 | size_t new_size; |
| 2346 | new_size = grn_bulk_compute_new_sizecxx . . $ grn_bulk_compute_new_size(44979b7263dd8a44).(ctx, buf, GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(buf) + len); |
| 2347 | if ((rc = grn_bulk_resizecxx . . $ grn_bulk_resize(f9a66385f261f61d).(ctx, buf, new_size))) { |
| 2348 | return rc; |
| 2349 | } |
| 2350 | } |
| 2351 | return rc; |
| 2352 | } |
| 2353 | |
| 2354 | grn_rccxx . . $ grn_rc# |
| 2355 | grn_bulk_spacecxx . . $ grn_bulk_space(f9a66385f261f61d).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *buf, size_t len) |
| 2356 | { |
| 2357 | grn_rccxx . . $ grn_rc# rc = grn_bulk_reservecxx . . $ grn_bulk_reserve(f9a66385f261f61d).(ctx, buf, len); |
| 2358 | if (!rc) { |
| 2359 | GRN_BULK_INCR_LENcxx . . $ `include/groonga/groonga.h:2627:9`!(buf, len); |
| 2360 | } |
| 2361 | return rc; |
| 2362 | } |
| 2363 | |
| 2364 | static grn_rccxx . . $ grn_rc# |
| 2365 | grn_bulk_space_clearcxx . . $ grn_bulk_space_clear(f9a66385f261f61d).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *buf, size_t len) |
| 2366 | { |
| 2367 | grn_rccxx . . $ grn_rc# rc = grn_bulk_reservecxx . . $ grn_bulk_reserve(f9a66385f261f61d).(ctx, buf, len); |
| 2368 | if (!rc) { |
| 2369 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(GRN_BULK_CURRcxx . . $ `include/groonga/groonga.h:2650:9`!(buf), 0, len); |
| 2370 | GRN_BULK_INCR_LENcxx . . $ `include/groonga/groonga.h:2627:9`!(buf, len); |
| 2371 | } |
| 2372 | return rc; |
| 2373 | } |
| 2374 | |
| 2375 | grn_rccxx . . $ grn_rc# |
| 2376 | grn_bulk_truncatecxx . . $ grn_bulk_truncate(f9a66385f261f61d).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *bulk, size_t len) |
| 2377 | { |
| 2378 | if (GRN_BULK_OUTPcxx . . $ `include/groonga/groonga.h:2598:9`!(bulk)) { |
| 2379 | if ((size_t)(bulk->ucxx . . $ _grn_obj#u..bcxx . . $ _grn_obj#$anonymous_type_6#b..tailcxx . . $ _grn_obj#$anonymous_type_6#$anonymous_type_7#tail. - bulk->ucxx . . $ _grn_obj#u..bcxx . . $ _grn_obj#$anonymous_type_6#b..headcxx . . $ _grn_obj#$anonymous_type_6#$anonymous_type_7#head.) < len) { |
| 2380 | return grn_bulk_space_clearcxx . . $ grn_bulk_space_clear(f9a66385f261f61d).(ctx, bulk, len - GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(bulk)); |
| 2381 | } else { |
| 2382 | if (GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(bulk) < len) { |
| 2383 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(GRN_BULK_CURRcxx . . $ `include/groonga/groonga.h:2650:9`!(bulk), 0, len - GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(bulk)); |
| 2384 | } |
| 2385 | bulk->ucxx . . $ _grn_obj#u..bcxx . . $ _grn_obj#$anonymous_type_6#b..currcxx . . $ _grn_obj#$anonymous_type_6#$anonymous_type_7#curr. = bulk->ucxx . . $ _grn_obj#u..bcxx . . $ _grn_obj#$anonymous_type_6#b..headcxx . . $ _grn_obj#$anonymous_type_6#$anonymous_type_7#head. + len; |
| 2386 | } |
| 2387 | } else { |
| 2388 | if (GRN_BULK_BUFSIZEcxx . . $ `include/groonga/groonga.h:2594:9`! < len) { |
| 2389 | return grn_bulk_space_clearcxx . . $ grn_bulk_space_clear(f9a66385f261f61d).(ctx, bulk, len - GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(bulk)); |
| 2390 | } else { |
| 2391 | if (GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(bulk) < len) { |
| 2392 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(GRN_BULK_CURRcxx . . $ `include/groonga/groonga.h:2650:9`!(bulk), 0, len - GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(bulk)); |
| 2393 | } |
| 2394 | bulk->headercxx . . $ _grn_obj#header..flagscxx . . $ _grn_obj_header#flags. &= (grn_obj_flagscxx . . $ grn_obj_flags#)(~GRN_BULK_BUFSIZE_MAXcxx . . $ `include/groonga/groonga.h:2596:9`!); |
| 2395 | bulk->headercxx . . $ _grn_obj#header..flagscxx . . $ _grn_obj_header#flags. += (grn_obj_flagscxx . . $ grn_obj_flags#)len; |
| 2396 | } |
| 2397 | } |
| 2398 | return GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 2399 | } |
| 2400 | |
| 2401 | grn_rccxx . . $ grn_rc# |
| 2402 | grn_text_itoacxx . . $ grn_text_itoa(1bfdfa8473156571).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *buf, int i) |
| 2403 | { |
| 2404 | grn_rccxx . . $ grn_rc# rc = GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 2405 | for (;;) { |
| 2406 | char *curr = GRN_BULK_CURRcxx . . $ `include/groonga/groonga.h:2650:9`!(buf); |
| 2407 | char *tail = GRN_BULK_TAILcxx . . $ `include/groonga/groonga.h:2654:9`!(buf); |
| 2408 | if (grn_itoacxx . . $ grn_itoa(33e71d0fc16b913b).(i, curr, tail, &curr)) { |
| 2409 | size_t new_size; |
| 2410 | new_size = |
| 2411 | grn_bulk_compute_new_sizecxx . . $ grn_bulk_compute_new_size(44979b7263dd8a44).(ctx, buf, GRN_BULK_WSIZEcxx . . $ `include/groonga/groonga.h:2635:9`!(buf) + UNIT_SIZEcxx . . $ `lib/str.c:2238:9`!); |
| 2412 | if ((rc = grn_bulk_resizecxx . . $ grn_bulk_resize(f9a66385f261f61d).(ctx, buf, new_size))) { |
| 2413 | return rc; |
| 2414 | } |
| 2415 | } else { |
| 2416 | GRN_BULK_SET_CURRcxx . . $ `include/groonga/groonga.h:2619:9`!(buf, curr); |
| 2417 | break; |
| 2418 | } |
| 2419 | } |
| 2420 | return rc; |
| 2421 | } |
| 2422 | |
| 2423 | grn_rccxx . . $ grn_rc# |
| 2424 | grn_text_itoa_paddedcxx . . $ grn_text_itoa_padded(db8cafa5940ac01e).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *buf, int i, char ch, size_t len) |
| 2425 | { |
| 2426 | grn_rccxx . . $ grn_rc# rc = GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 2427 | char *curr; |
| 2428 | if ((rc = grn_bulk_reservecxx . . $ grn_bulk_reserve(f9a66385f261f61d).(ctx, buf, len))) { |
| 2429 | return rc; |
| 2430 | } |
| 2431 | curr = GRN_BULK_CURRcxx . . $ `include/groonga/groonga.h:2650:9`!(buf); |
| 2432 | if (!grn_itoa_paddedcxx . . $ grn_itoa_padded(3aed0f8ccd493c05).(i, curr, curr + len, ch)) { |
| 2433 | GRN_BULK_SET_CURRcxx . . $ `include/groonga/groonga.h:2619:9`!(buf, curr + len); |
| 2434 | } |
| 2435 | return rc; |
| 2436 | } |
| 2437 | |
| 2438 | grn_rccxx . . $ grn_rc# |
| 2439 | grn_text_lltoacxx . . $ grn_text_lltoa(1b142823d3915b88).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *buf, long long int i) |
| 2440 | { |
| 2441 | grn_rccxx . . $ grn_rc# rc = GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 2442 | for (;;) { |
| 2443 | char *curr = GRN_BULK_CURRcxx . . $ `include/groonga/groonga.h:2650:9`!(buf); |
| 2444 | char *tail = GRN_BULK_TAILcxx . . $ `include/groonga/groonga.h:2654:9`!(buf); |
| 2445 | char *end; |
| 2446 | if (grn_lltoacxx . . $ grn_lltoa(818d36cd4dfb4adb).(i, curr, tail, &end)) { |
| 2447 | size_t new_size; |
| 2448 | new_size = |
| 2449 | grn_bulk_compute_new_sizecxx . . $ grn_bulk_compute_new_size(44979b7263dd8a44).(ctx, buf, GRN_BULK_WSIZEcxx . . $ `include/groonga/groonga.h:2635:9`!(buf) + UNIT_SIZEcxx . . $ `lib/str.c:2238:9`!); |
| 2450 | if ((rc = grn_bulk_resizecxx . . $ grn_bulk_resize(f9a66385f261f61d).(ctx, buf, new_size))) { |
| 2451 | return rc; |
| 2452 | } |
| 2453 | } else { |
| 2454 | GRN_BULK_SET_CURRcxx . . $ `include/groonga/groonga.h:2619:9`!(buf, end); |
| 2455 | break; |
| 2456 | } |
| 2457 | } |
| 2458 | return rc; |
| 2459 | } |
| 2460 | |
| 2461 | grn_rccxx . . $ grn_rc# |
| 2462 | grn_text_ulltoacxx . . $ grn_text_ulltoa(cf35b313a8fea93f).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *buf, unsigned long long int i) |
| 2463 | { |
| 2464 | grn_rccxx . . $ grn_rc# rc = GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 2465 | for (;;) { |
| 2466 | char *curr = GRN_BULK_CURRcxx . . $ `include/groonga/groonga.h:2650:9`!(buf); |
| 2467 | char *tail = GRN_BULK_TAILcxx . . $ `include/groonga/groonga.h:2654:9`!(buf); |
| 2468 | char *end; |
| 2469 | if (grn_ulltoacxx . . $ grn_ulltoa(21641f6ae377f469).(i, curr, tail, &end)) { |
| 2470 | size_t new_size; |
| 2471 | new_size = |
| 2472 | grn_bulk_compute_new_sizecxx . . $ grn_bulk_compute_new_size(44979b7263dd8a44).(ctx, buf, GRN_BULK_WSIZEcxx . . $ `include/groonga/groonga.h:2635:9`!(buf) + UNIT_SIZEcxx . . $ `lib/str.c:2238:9`!); |
| 2473 | if ((rc = grn_bulk_resizecxx . . $ grn_bulk_resize(f9a66385f261f61d).(ctx, buf, new_size))) { |
| 2474 | return rc; |
| 2475 | } |
| 2476 | } else { |
| 2477 | GRN_BULK_SET_CURRcxx . . $ `include/groonga/groonga.h:2619:9`!(buf, end); |
| 2478 | break; |
| 2479 | } |
| 2480 | } |
| 2481 | return rc; |
| 2482 | } |
| 2483 | |
| 2484 | static inline grn_rccxx . . $ grn_rc# |
| 2485 | grn_text_ftoa_adjustcxx . . $ grn_text_ftoa_adjust(f9a66385f261f61d).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *buf, size_t before_size) |
| 2486 | { |
| 2487 | size_t length = GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(buf) - before_size; |
| 2488 | char *start = GRN_BULK_CURRcxx . . $ `include/groonga/groonga.h:2650:9`!(buf) - length; |
| 2489 | if (start[length - 1] == '.') { |
| 2490 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, buf, '0'); |
| 2491 | return GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 2492 | } else { |
| 2493 | char *p, *q; |
| 2494 | start[length] = '\0'; |
| 2495 | if ((p = strchrcxx . . $ `<external>/13506128340496143423/string.h:264:11`!(start, 'e'))) { |
| 2496 | for (q = p; *(q - 2) != '.' && *(q - 1) == '0'; q--) { |
| 2497 | length--; |
| 2498 | } |
| 2499 | grn_memmovecxx . . $ `include/groonga/portability.h:39:11`!(q, p, (size_t)(start + length - q)); |
| 2500 | } else { |
| 2501 | for (q = start + length; *(q - 2) != '.' && *(q - 1) == '0'; q--) { |
| 2502 | length--; |
| 2503 | } |
| 2504 | } |
| 2505 | return grn_bulk_truncatecxx . . $ grn_bulk_truncate(f9a66385f261f61d).(ctx, buf, before_size + length); |
| 2506 | } |
| 2507 | } |
| 2508 | |
| 2509 | #ifdef GRN_HAVE_BFLOAT16 |
| 2510 | grn_rc |
| 2511 | grn_text_bf16toa(grn_ctx *ctx, grn_obj *buf, grn_bfloat16 value) |
| 2512 | { |
| 2513 | return grn_text_f32toa(ctx, buf, grn_bfloat16_to_float32(value)); |
| 2514 | } |
| 2515 | #endif |
| 2516 | |
| 2517 | grn_rccxx . . $ grn_rc# |
| 2518 | grn_text_f32toacxx . . $ grn_text_f32toa(1baff083bef0534b).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *buf, float f) |
| 2519 | { |
| 2520 | size_t before_size = GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(buf); |
| 2521 | grn_rccxx . . $ grn_rc# rc = grn_text_printfcxx . . $ grn_text_printf(34596149d4dc0292).(ctx, buf, "%#.*g", FLT_DIGcxx . . $ `<external>/8223903785965736313/float.h:53:9`! + 1, f); |
| 2522 | if (rc != GRN_SUCCESScxx . . $ GRN_SUCCESS.) { |
| 2523 | return rc; |
| 2524 | } |
| 2525 | return grn_text_ftoa_adjustcxx . . $ grn_text_ftoa_adjust(f9a66385f261f61d).(ctx, buf, before_size); |
| 2526 | } |
| 2527 | |
| 2528 | grn_rccxx . . $ grn_rc# |
| 2529 | grn_text_ftoacxx . . $ grn_text_ftoa(bba05b37cb576d9a).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *buf, double d) |
| 2530 | { |
| 2531 | size_t before_size = GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(buf); |
| 2532 | grn_rccxx . . $ grn_rc# rc = grn_text_printfcxx . . $ grn_text_printf(34596149d4dc0292).(ctx, buf, "%#.*g", DBL_DIGcxx . . $ `<external>/8223903785965736313/float.h:54:9`! + 1, d); |
| 2533 | if (rc != GRN_SUCCESScxx . . $ GRN_SUCCESS.) { |
| 2534 | return rc; |
| 2535 | } |
| 2536 | return grn_text_ftoa_adjustcxx . . $ grn_text_ftoa_adjust(f9a66385f261f61d).(ctx, buf, before_size); |
| 2537 | } |
| 2538 | |
| 2539 | grn_rccxx . . $ grn_rc# |
| 2540 | grn_text_itohcxx . . $ grn_text_itoh(e68b8e6654e398dd).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *buf, unsigned int i, size_t len) |
| 2541 | { |
| 2542 | grn_rccxx . . $ grn_rc# rc = GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 2543 | if (GRN_BULK_RESTcxx . . $ `include/groonga/groonga.h:2638:9`!(buf) < len) { |
| 2544 | size_t new_size; |
| 2545 | new_size = grn_bulk_compute_new_sizecxx . . $ grn_bulk_compute_new_size(44979b7263dd8a44).(ctx, buf, GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(buf) + len); |
| 2546 | if ((rc = grn_bulk_resizecxx . . $ grn_bulk_resize(f9a66385f261f61d).(ctx, buf, new_size))) { |
| 2547 | return rc; |
| 2548 | } |
| 2549 | } |
| 2550 | grn_itohcxx . . $ grn_itoh(8d45ad636653b6f2).(i, GRN_BULK_CURRcxx . . $ `include/groonga/groonga.h:2650:9`!(buf), (unsigned int)len); |
| 2551 | GRN_BULK_INCR_LENcxx . . $ `include/groonga/groonga.h:2627:9`!(buf, len); |
| 2552 | return rc; |
| 2553 | } |
| 2554 | |
| 2555 | grn_rccxx . . $ grn_rc# |
| 2556 | grn_text_itobcxx . . $ grn_text_itob(aedbc3eaefbe393f).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *buf, grn_idcxx . . $ grn_id# id) |
| 2557 | { |
| 2558 | size_t len = 5; |
| 2559 | grn_rccxx . . $ grn_rc# rc = GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 2560 | if (GRN_BULK_RESTcxx . . $ `include/groonga/groonga.h:2638:9`!(buf) < len) { |
| 2561 | size_t new_size; |
| 2562 | new_size = grn_bulk_compute_new_sizecxx . . $ grn_bulk_compute_new_size(44979b7263dd8a44).(ctx, buf, GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(buf) + len); |
| 2563 | if ((rc = grn_bulk_resizecxx . . $ grn_bulk_resize(f9a66385f261f61d).(ctx, buf, new_size))) { |
| 2564 | return rc; |
| 2565 | } |
| 2566 | } |
| 2567 | grn_itobcxx . . $ grn_itob(76b3be8b15f1dbe5).(id, GRN_BULK_CURRcxx . . $ `include/groonga/groonga.h:2650:9`!(buf)); |
| 2568 | GRN_BULK_INCR_LENcxx . . $ `include/groonga/groonga.h:2627:9`!(buf, len); |
| 2569 | return rc; |
| 2570 | } |
| 2571 | |
| 2572 | grn_rccxx . . $ grn_rc# |
| 2573 | grn_text_lltob32hcxx . . $ grn_text_lltob32h(1b142823d3915b88).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *buf, long long int i) |
| 2574 | { |
| 2575 | size_t len = 13; |
| 2576 | grn_rccxx . . $ grn_rc# rc = GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 2577 | if (GRN_BULK_RESTcxx . . $ `include/groonga/groonga.h:2638:9`!(buf) < len) { |
| 2578 | size_t new_size; |
| 2579 | new_size = grn_bulk_compute_new_sizecxx . . $ grn_bulk_compute_new_size(44979b7263dd8a44).(ctx, buf, GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(buf) + len); |
| 2580 | if ((rc = grn_bulk_resizecxx . . $ grn_bulk_resize(f9a66385f261f61d).(ctx, buf, new_size))) { |
| 2581 | return rc; |
| 2582 | } |
| 2583 | } |
| 2584 | grn_lltob32hcxx . . $ grn_lltob32h(a9665d948aa03972).(i, GRN_BULK_CURRcxx . . $ `include/groonga/groonga.h:2650:9`!(buf)); |
| 2585 | GRN_BULK_INCR_LENcxx . . $ `include/groonga/groonga.h:2627:9`!(buf, len); |
| 2586 | return rc; |
| 2587 | } |
| 2588 | |
| 2589 | grn_rccxx . . $ grn_rc# |
| 2590 | grn_text_esccxx . . $ grn_text_esc(4609c18fd87cf054).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *buf, const char *s, size_t len) |
| 2591 | { |
| 2592 | const char *e; |
| 2593 | int l; |
| 2594 | grn_rccxx . . $ grn_rc# rc = GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 2595 | |
| 2596 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, buf, '"'); |
| 2597 | for (e = s + len; s < e; s += l) { |
| 2598 | l = grn_charlencxx . . $ grn_charlen(d229e8bf7c87f0f0).(ctx, s, e); |
| 2599 | if (l == 0) { |
| 2600 | rc = grn_bulk_writecxx . . $ grn_bulk_write(4609c18fd87cf054).(ctx, buf, "\\u", 2); |
| 2601 | if (rc != GRN_SUCCESScxx . . $ GRN_SUCCESS.) { |
| 2602 | return rc; |
| 2603 | } |
| 2604 | rc = grn_text_itohcxx . . $ grn_text_itoh(e68b8e6654e398dd).(ctx, buf, (uint8_tcxx . . $ uint8_t#)*s, 4); |
| 2605 | if (rc != GRN_SUCCESScxx . . $ GRN_SUCCESS.) { |
| 2606 | GRN_BULK_INCR_LENcxx . . $ `include/groonga/groonga.h:2627:9`!(buf, -2); |
| 2607 | return rc; |
| 2608 | } |
| 2609 | l = 1; |
| 2610 | continue; |
| 2611 | } |
| 2612 | if (l == 1) { |
| 2613 | switch (*s) { |
| 2614 | case '"': |
| 2615 | grn_bulk_writecxx . . $ grn_bulk_write(4609c18fd87cf054).(ctx, buf, "\\\"", 2); |
| 2616 | break; |
| 2617 | case '\\': |
| 2618 | grn_bulk_writecxx . . $ grn_bulk_write(4609c18fd87cf054).(ctx, buf, "\\\\", 2); |
| 2619 | break; |
| 2620 | case '\b': |
| 2621 | grn_bulk_writecxx . . $ grn_bulk_write(4609c18fd87cf054).(ctx, buf, "\\b", 2); |
| 2622 | break; |
| 2623 | case '\f': |
| 2624 | grn_bulk_writecxx . . $ grn_bulk_write(4609c18fd87cf054).(ctx, buf, "\\f", 2); |
| 2625 | break; |
| 2626 | case '\n': |
| 2627 | grn_bulk_writecxx . . $ grn_bulk_write(4609c18fd87cf054).(ctx, buf, "\\n", 2); |
| 2628 | break; |
| 2629 | case '\r': |
| 2630 | grn_bulk_writecxx . . $ grn_bulk_write(4609c18fd87cf054).(ctx, buf, "\\r", 2); |
| 2631 | break; |
| 2632 | case '\t': |
| 2633 | grn_bulk_writecxx . . $ grn_bulk_write(4609c18fd87cf054).(ctx, buf, "\\t", 2); |
| 2634 | break; |
| 2635 | case '\x00': |
| 2636 | case '\x01': |
| 2637 | case '\x02': |
| 2638 | case '\x03': |
| 2639 | case '\x04': |
| 2640 | case '\x05': |
| 2641 | case '\x06': |
| 2642 | case '\x07': |
| 2643 | case '\x0b': |
| 2644 | case '\x0e': |
| 2645 | case '\x0f': |
| 2646 | case '\x10': |
| 2647 | case '\x11': |
| 2648 | case '\x12': |
| 2649 | case '\x13': |
| 2650 | case '\x14': |
| 2651 | case '\x15': |
| 2652 | case '\x16': |
| 2653 | case '\x17': |
| 2654 | case '\x18': |
| 2655 | case '\x19': |
| 2656 | case '\x1a': |
| 2657 | case '\x1b': |
| 2658 | case '\x1c': |
| 2659 | case '\x1d': |
| 2660 | case '\x1e': |
| 2661 | case '\x1f': |
| 2662 | case '\x7f': |
| 2663 | if (!(rc = grn_bulk_writecxx . . $ grn_bulk_write(4609c18fd87cf054).(ctx, buf, "\\u", 2))) { |
| 2664 | if ((rc = grn_text_itohcxx . . $ grn_text_itoh(e68b8e6654e398dd).(ctx, buf, (unsigned int)(*s), 4))) { |
| 2665 | GRN_BULK_INCR_LENcxx . . $ `include/groonga/groonga.h:2627:9`!(buf, -2); |
| 2666 | return rc; |
| 2667 | } |
| 2668 | } else { |
| 2669 | return rc; |
| 2670 | } |
| 2671 | break; |
| 2672 | default: |
| 2673 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, buf, *s); |
| 2674 | } |
| 2675 | } else if (l == 3) { |
| 2676 | if (*s == '\xe2' && *(s + 1) == '\x80') { |
| 2677 | switch (*(s + 2)) { |
| 2678 | case '\xa8': /* \u2028 */ |
| 2679 | grn_bulk_writecxx . . $ grn_bulk_write(4609c18fd87cf054).(ctx, buf, "\\u2028", 6); |
| 2680 | break; |
| 2681 | case '\xa9': /* \u2029 */ |
| 2682 | grn_bulk_writecxx . . $ grn_bulk_write(4609c18fd87cf054).(ctx, buf, "\\u2029", 6); |
| 2683 | break; |
| 2684 | default: |
| 2685 | grn_bulk_writecxx . . $ grn_bulk_write(4609c18fd87cf054).(ctx, buf, s, (size_t)l); |
| 2686 | } |
| 2687 | } else { |
| 2688 | grn_bulk_writecxx . . $ grn_bulk_write(4609c18fd87cf054).(ctx, buf, s, (size_t)l); |
| 2689 | } |
| 2690 | } else { |
| 2691 | grn_bulk_writecxx . . $ grn_bulk_write(4609c18fd87cf054).(ctx, buf, s, (size_t)l); |
| 2692 | } |
| 2693 | } |
| 2694 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, buf, '"'); |
| 2695 | return rc; |
| 2696 | } |
| 2697 | |
| 2698 | grn_rccxx . . $ grn_rc# |
| 2699 | grn_text_code_pointcxx . . $ grn_text_code_point(aedbc3eaefbe393f).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *buffer, uint32_tcxx . . $ uint32_t# code_point) |
| 2700 | { |
| 2701 | GRN_API_ENTERcxx . . $ `lib/grn_ctx.h:41:9`!; |
| 2702 | |
| 2703 | if (ctx->encodingcxx . . $ _grn_ctx#encoding. != GRN_ENC_UTF8cxx . . $ GRN_ENC_UTF8.) { |
| 2704 | ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_FUNCTION_NOT_IMPLEMENTED, |
| 2705 | "[text][code-point] UTF-8 is only supported: %s", |
| 2706 | grn_encoding_to_string(ctx->encoding)); |
| 2707 | } |
| 2708 | |
| 2709 | if (code_point == 0x00 || code_point > 0x10FFFF || |
| 2710 | /* surrogate */ |
| 2711 | (0xD800 <= code_point && code_point <= 0xDFFF)) { |
| 2712 | code_point = 0xFFFD; /* U+FFFD REPLACEMENT CHARACTER */ |
| 2713 | } |
| 2714 | if (code_point <= 0x7F) { |
| 2715 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, buffer, (char)code_point); |
| 2716 | } else if (code_point <= 0x07FF) { |
| 2717 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, buffer, (char)(((code_point & 0x0007C0) >> 6) | 0x60)); |
| 2718 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, buffer, (char)(((code_point & 0x00003F)) | 0x80)); |
| 2719 | } else if (code_point <= 0xFFFF) { |
| 2720 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, buffer, (char)(((code_point & 0x00F000) >> 12) | 0xE0)); |
| 2721 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, buffer, (char)(((code_point & 0x000FC0) >> 6) | 0x80)); |
| 2722 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, buffer, (char)(((code_point & 0x00003F)) | 0x80)); |
| 2723 | } else if (code_point <= 0x10FFFF) { |
| 2724 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, buffer, (char)(((code_point & 0x1C0000) >> 18) | 0xE0)); |
| 2725 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, buffer, (char)(((code_point & 0x03F000) >> 12) | 0xE0)); |
| 2726 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, buffer, (char)(((code_point & 0x000FC0) >> 6) | 0x80)); |
| 2727 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, buffer, (char)(((code_point & 0x00003F)) | 0x80)); |
| 2728 | } else { |
| 2729 | ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_FUNCTION_NOT_IMPLEMENTED, |
| 2730 | "[text][code-point] out of range: %#x", |
| 2731 | code_point); |
| 2732 | } |
| 2733 | |
| 2734 | GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(ctx->rc); |
| 2735 | } |
| 2736 | |
| 2737 | grn_rccxx . . $ grn_rc# |
| 2738 | grn_text_escape_xmlcxx . . $ grn_text_escape_xml(4609c18fd87cf054).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *buf, const char *s, size_t len) |
| 2739 | { |
| 2740 | const char *e; |
| 2741 | int l; |
| 2742 | grn_rccxx . . $ grn_rc# rc = GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 2743 | |
| 2744 | for (e = s + len; s < e; s += l) { |
| 2745 | if (!(l = grn_charlencxx . . $ grn_charlen(d229e8bf7c87f0f0).(ctx, s, e))) { |
| 2746 | break; |
| 2747 | } |
| 2748 | if (l == 1) { |
| 2749 | switch (*s) { |
| 2750 | case '"': |
| 2751 | grn_bulk_writecxx . . $ grn_bulk_write(4609c18fd87cf054).(ctx, buf, """, 6); |
| 2752 | break; |
| 2753 | case '<': |
| 2754 | grn_bulk_writecxx . . $ grn_bulk_write(4609c18fd87cf054).(ctx, buf, "<", 4); |
| 2755 | break; |
| 2756 | case '>': |
| 2757 | grn_bulk_writecxx . . $ grn_bulk_write(4609c18fd87cf054).(ctx, buf, ">", 4); |
| 2758 | break; |
| 2759 | case '&': |
| 2760 | grn_bulk_writecxx . . $ grn_bulk_write(4609c18fd87cf054).(ctx, buf, "&", 5); |
| 2761 | break; |
| 2762 | default: |
| 2763 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, buf, *s); |
| 2764 | } |
| 2765 | } else { |
| 2766 | grn_bulk_writecxx . . $ grn_bulk_write(4609c18fd87cf054).(ctx, buf, s, (size_t)l); |
| 2767 | } |
| 2768 | } |
| 2769 | return rc; |
| 2770 | } |
| 2771 | |
| 2772 | #define TOK_ESCcxx . . $ `lib/str.c:2772:9`! (0x80) |
| 2773 | |
| 2774 | const char * |
| 2775 | grn_text_unesc_tokcxx . . $ grn_text_unesc_tok(ee2b918276aaefd9).( |
| 2776 | grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *buf, const char *s, const char *e, uint8_tcxx . . $ uint8_t# *tok_type) |
| 2777 | { |
| 2778 | const char *p; |
| 2779 | int len; |
| 2780 | uint8_tcxx . . $ uint8_t# stat = GRN_TOK_VOIDcxx . . $ `lib/grn_str.h:140:9`!; |
| 2781 | for (p = s; p < e; p += len) { |
| 2782 | if (!(len = grn_charlencxx . . $ grn_charlen(d229e8bf7c87f0f0).(ctx, p, e))) { |
| 2783 | p = e; |
| 2784 | stat &= (uint8_tcxx . . $ uint8_t#)(~TOK_ESCcxx . . $ `lib/str.c:2772:9`!); |
| 2785 | goto exit; |
| 2786 | } |
| 2787 | switch (stat) { |
| 2788 | case GRN_TOK_VOIDcxx . . $ `lib/grn_str.h:140:9`!: |
| 2789 | if (*p == ' ') { |
| 2790 | continue; |
| 2791 | } |
| 2792 | switch (*p) { |
| 2793 | case '"': |
| 2794 | stat = GRN_TOK_STRINGcxx . . $ `lib/grn_str.h:142:9`!; |
| 2795 | break; |
| 2796 | case '\'': |
| 2797 | stat = GRN_TOK_QUOTEcxx . . $ `lib/grn_str.h:143:9`!; |
| 2798 | break; |
| 2799 | case ')': |
| 2800 | case '(': |
| 2801 | GRN_TEXT_PUTcxx . . $ `include/groonga/groonga.h:2773:9`!(ctx, buf, p, len); |
| 2802 | p += len; |
| 2803 | stat = GRN_TOK_SYMBOLcxx . . $ `lib/grn_str.h:141:9`!; |
| 2804 | goto exit; |
| 2805 | case '\\': |
| 2806 | stat = GRN_TOK_SYMBOLcxx . . $ `lib/grn_str.h:141:9`! | TOK_ESCcxx . . $ `lib/str.c:2772:9`!; |
| 2807 | break; |
| 2808 | default: |
| 2809 | stat = GRN_TOK_SYMBOLcxx . . $ `lib/grn_str.h:141:9`!; |
| 2810 | GRN_TEXT_PUTcxx . . $ `include/groonga/groonga.h:2773:9`!(ctx, buf, p, len); |
| 2811 | break; |
| 2812 | } |
| 2813 | break; |
| 2814 | case GRN_TOK_SYMBOLcxx . . $ `lib/grn_str.h:141:9`!: |
| 2815 | if (*p == ' ') { |
| 2816 | goto exit; |
| 2817 | } |
| 2818 | switch (*p) { |
| 2819 | case '\'': |
| 2820 | case '"': |
| 2821 | case ')': |
| 2822 | case '(': |
| 2823 | goto exit; |
| 2824 | case '\\': |
| 2825 | stat |= TOK_ESCcxx . . $ `lib/str.c:2772:9`!; |
| 2826 | break; |
| 2827 | default: |
| 2828 | GRN_TEXT_PUTcxx . . $ `include/groonga/groonga.h:2773:9`!(ctx, buf, p, len); |
| 2829 | break; |
| 2830 | } |
| 2831 | break; |
| 2832 | case GRN_TOK_STRINGcxx . . $ `lib/grn_str.h:142:9`!: |
| 2833 | switch (*p) { |
| 2834 | case '"': |
| 2835 | p += len; |
| 2836 | goto exit; |
| 2837 | case '\\': |
| 2838 | stat |= TOK_ESCcxx . . $ `lib/str.c:2772:9`!; |
| 2839 | break; |
| 2840 | default: |
| 2841 | GRN_TEXT_PUTcxx . . $ `include/groonga/groonga.h:2773:9`!(ctx, buf, p, len); |
| 2842 | break; |
| 2843 | } |
| 2844 | break; |
| 2845 | case GRN_TOK_QUOTEcxx . . $ `lib/grn_str.h:143:9`!: |
| 2846 | switch (*p) { |
| 2847 | case '\'': |
| 2848 | p += len; |
| 2849 | goto exit; |
| 2850 | case '\\': |
| 2851 | stat |= TOK_ESCcxx . . $ `lib/str.c:2772:9`!; |
| 2852 | break; |
| 2853 | default: |
| 2854 | GRN_TEXT_PUTcxx . . $ `include/groonga/groonga.h:2773:9`!(ctx, buf, p, len); |
| 2855 | break; |
| 2856 | } |
| 2857 | break; |
| 2858 | case GRN_TOK_SYMBOLcxx . . $ `lib/grn_str.h:141:9`! | TOK_ESCcxx . . $ `lib/str.c:2772:9`!: |
| 2859 | case GRN_TOK_STRINGcxx . . $ `lib/grn_str.h:142:9`! | TOK_ESCcxx . . $ `lib/str.c:2772:9`!: |
| 2860 | case GRN_TOK_QUOTEcxx . . $ `lib/grn_str.h:143:9`! | TOK_ESCcxx . . $ `lib/str.c:2772:9`!: |
| 2861 | switch (*p) { |
| 2862 | case 'b': |
| 2863 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, buf, '\b'); |
| 2864 | break; |
| 2865 | case 'f': |
| 2866 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, buf, '\f'); |
| 2867 | break; |
| 2868 | case 'n': |
| 2869 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, buf, '\n'); |
| 2870 | break; |
| 2871 | case 'r': |
| 2872 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, buf, '\r'); |
| 2873 | break; |
| 2874 | case 't': |
| 2875 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, buf, '\t'); |
| 2876 | break; |
| 2877 | default: |
| 2878 | GRN_TEXT_PUTcxx . . $ `include/groonga/groonga.h:2773:9`!(ctx, buf, p, len); |
| 2879 | break; |
| 2880 | } |
| 2881 | stat &= (uint8_tcxx . . $ uint8_t#)(~TOK_ESCcxx . . $ `lib/str.c:2772:9`!); |
| 2882 | break; |
| 2883 | } |
| 2884 | } |
| 2885 | exit: |
| 2886 | *tok_type = stat; |
| 2887 | return p; |
| 2888 | } |
| 2889 | |
| 2890 | grn_rccxx . . $ grn_rc# |
| 2891 | grn_text_benccxx . . $ grn_text_benc(aedbc3eaefbe393f).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *buf, unsigned int v) |
| 2892 | { |
| 2893 | grn_rccxx . . $ grn_rc# rc = GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 2894 | uint8_tcxx . . $ uint8_t# *p; |
| 2895 | size_t required_size = 5; |
| 2896 | if (GRN_BULK_RESTcxx . . $ `include/groonga/groonga.h:2638:9`!(buf) < required_size) { |
| 2897 | size_t new_size; |
| 2898 | new_size = |
| 2899 | grn_bulk_compute_new_sizecxx . . $ grn_bulk_compute_new_size(44979b7263dd8a44).(ctx, buf, GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(buf) + required_size); |
| 2900 | if ((rc = grn_bulk_resizecxx . . $ grn_bulk_resize(f9a66385f261f61d).(ctx, buf, new_size))) { |
| 2901 | return rc; |
| 2902 | } |
| 2903 | } |
| 2904 | p = (uint8_tcxx . . $ uint8_t# *)GRN_BULK_CURRcxx . . $ `include/groonga/groonga.h:2650:9`!(buf); |
| 2905 | GRN_B_ENCcxx . . $ `lib/grn_io.h:564:9`!(v, p); |
| 2906 | GRN_BULK_SET_CURRcxx . . $ `include/groonga/groonga.h:2619:9`!(buf, (char *)p); |
| 2907 | return rc; |
| 2908 | } |
| 2909 | |
| 2910 | /* 0x00 - 0x7f */ |
| 2911 | static const int_least8_tcxx . . $ int_least8_t# urlenc_tblcxx . . $ urlenc_tbl.[] = { |
| 2912 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 2913 | 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, |
| 2914 | 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2915 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2916 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}; |
| 2917 | |
| 2918 | grn_rccxx . . $ grn_rc# |
| 2919 | grn_text_urlenccxx . . $ grn_text_urlenc(4609c18fd87cf054).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *buf, const char *s, size_t len) |
| 2920 | { |
| 2921 | const char *e, c = '%'; |
| 2922 | for (e = s + len; s < e; s++) { |
| 2923 | if ((signed char)*s < 0 || urlenc_tblcxx . . $ urlenc_tbl.[(int)*s]) { |
| 2924 | if (!grn_bulk_writecxx . . $ grn_bulk_write(4609c18fd87cf054).(ctx, buf, &c, 1)) { |
| 2925 | if (grn_text_itohcxx . . $ grn_text_itoh(e68b8e6654e398dd).(ctx, buf, (unsigned int)(*s), 2)) { |
| 2926 | GRN_BULK_INCR_LENcxx . . $ `include/groonga/groonga.h:2627:9`!(buf, -1); |
| 2927 | } |
| 2928 | } |
| 2929 | } else { |
| 2930 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, buf, *s); |
| 2931 | } |
| 2932 | } |
| 2933 | return GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 2934 | } |
| 2935 | |
| 2936 | static const char *weekdayscxx . . $ weekdays.[7] = { |
| 2937 | "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; |
| 2938 | static const char *monthscxx . . $ months.[12] = {"Jan", |
| 2939 | "Feb", |
| 2940 | "Mar", |
| 2941 | "Apr", |
| 2942 | "May", |
| 2943 | "Jun", |
| 2944 | "Jul", |
| 2945 | "Aug", |
| 2946 | "Sep", |
| 2947 | "Oct", |
| 2948 | "Nov", |
| 2949 | "Dec"}; |
| 2950 | |
| 2951 | grn_rccxx . . $ grn_rc# |
| 2952 | grn_text_time2rfc1123cxx . . $ grn_text_time2rfc1123(1bfdfa8473156571).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *bulk, int sec) |
| 2953 | { |
| 2954 | time_tcxx . . $ time_t# tsec; |
| 2955 | struct tmcxx . . $ tm# *t; |
| 2956 | #ifdef HAVE__GMTIME64_S |
| 2957 | struct tm tm; |
| 2958 | tsec = (time_t)sec; |
| 2959 | t = (gmtime_s(&tm, &tsec) == 0) ? &tm : NULL; |
| 2960 | #else /* HAVE__GMTIME64_S */ |
| 2961 | # ifdef HAVE_GMTIME_Rcxx . . $ `build/config.h:173:9`! |
| 2962 | struct tmcxx . . $ tm# tm; |
| 2963 | tsec = (time_tcxx . . $ time_t#)sec; |
| 2964 | t = gmtime_rcxx . . $ gmtime_r(92e3d173686db852).(&tsec, &tm); |
| 2965 | # else /* HAVE_GMTIME_R */ |
| 2966 | tsec = (time_t)sec; |
| 2967 | t = gmtime(&tsec); |
| 2968 | # endif /* HAVE_GMTIME_R */ |
| 2969 | #endif /* HAVE__GMTIME64_S */ |
| 2970 | if (t) { |
| 2971 | GRN_TEXT_SETcxx . . $ `include/groonga/groonga.h:2761:9`!(ctx, bulk, weekdays[t->tm_wday], 3); |
| 2972 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, bulk, ", "); |
| 2973 | grn_text_itoa_paddedcxx . . $ grn_text_itoa_padded(db8cafa5940ac01e).(ctx, bulk, t->tm_mdaycxx . . $ tm#tm_mday., '0', 2); |
| 2974 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, bulk, " "); |
| 2975 | GRN_TEXT_PUTcxx . . $ `include/groonga/groonga.h:2773:9`!(ctx, bulk, months[t->tm_mon], 3); |
| 2976 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, bulk, " "); |
| 2977 | grn_text_itoacxx . . $ grn_text_itoa(1bfdfa8473156571).(ctx, bulk, t->tm_yearcxx . . $ tm#tm_year. + 1900); |
| 2978 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, bulk, " "); |
| 2979 | grn_text_itoa_paddedcxx . . $ grn_text_itoa_padded(db8cafa5940ac01e).(ctx, bulk, t->tm_hourcxx . . $ tm#tm_hour., '0', 2); |
| 2980 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, bulk, ":"); |
| 2981 | grn_text_itoa_paddedcxx . . $ grn_text_itoa_padded(db8cafa5940ac01e).(ctx, bulk, t->tm_mincxx . . $ tm#tm_min., '0', 2); |
| 2982 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, bulk, ":"); |
| 2983 | grn_text_itoa_paddedcxx . . $ grn_text_itoa_padded(db8cafa5940ac01e).(ctx, bulk, t->tm_seccxx . . $ tm#tm_sec., '0', 2); |
| 2984 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, bulk, " GMT"); |
| 2985 | } else { |
| 2986 | GRN_TEXT_SETScxx . . $ `include/groonga/groonga.h:2783:9`!(ctx, bulk, "Mon, 16 Mar 1980 20:40:00 GMT"); |
| 2987 | } |
| 2988 | return GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 2989 | } |
| 2990 | |
| 2991 | grn_rccxx . . $ grn_rc# |
| 2992 | grn_text_printfcxx . . $ grn_text_printf(34596149d4dc0292).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *bulk, const char *format, ...) |
| 2993 | { |
| 2994 | va_listcxx . . $ va_list# args; |
| 2995 | |
| 2996 | va_startcxx . . $ `<external>/8293021631987149590/stdarg.h:51:9`!(args, format); |
| 2997 | grn_rccxx . . $ grn_rc# rc = grn_text_printfvcxx . . $ grn_text_printfv(26ae3e66154406).(ctx, bulk, format, args); |
| 2998 | va_endcxx . . $ `<external>/8293021631987149590/stdarg.h:53:9`!(args); |
| 2999 | |
| 3000 | return rc; |
| 3001 | } |
| 3002 | |
| 3003 | grn_rccxx . . $ grn_rc# |
| 3004 | grn_text_printfvcxx . . $ grn_text_printfv(26ae3e66154406).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *bulk, const char *format, va_listcxx . . $ va_list# args) |
| 3005 | { |
| 3006 | int written_size = -1; |
| 3007 | const size_t rest_size = GRN_BULK_RESTcxx . . $ `include/groonga/groonga.h:2638:9`!(bulk); |
| 3008 | |
| 3009 | #ifdef WIN32 |
| 3010 | bool is_written = false; |
| 3011 | if (rest_size > 0) { |
| 3012 | va_list copied_args; |
| 3013 | va_copy(copied_args, args); |
| 3014 | written_size = |
| 3015 | vsnprintf(GRN_BULK_CURR(bulk), rest_size, format, copied_args); |
| 3016 | va_end(copied_args); |
| 3017 | is_written = (written_size >= 0 && ((size_t)written_size + 1 <= rest_size)); |
| 3018 | } |
| 3019 | |
| 3020 | if (!is_written) { |
| 3021 | va_list copied_args; |
| 3022 | va_copy(copied_args, args); |
| 3023 | const int to_be_written_size = vsnprintf(NULL, 0, format, copied_args); |
| 3024 | va_end(copied_args); |
| 3025 | |
| 3026 | if (to_be_written_size < 0) { |
| 3027 | return GRN_INVALID_ARGUMENT; |
| 3028 | } |
| 3029 | const size_t required_size = |
| 3030 | (size_t)to_be_written_size + 1; /* for terminate '\0'. */ |
| 3031 | const grn_rc rc = grn_bulk_reserve(ctx, bulk, required_size); |
| 3032 | if (rc) { |
| 3033 | return rc; |
| 3034 | } |
| 3035 | va_copy(copied_args, args); |
| 3036 | written_size = |
| 3037 | vsnprintf(GRN_BULK_CURR(bulk), required_size, format, copied_args); |
| 3038 | va_end(copied_args); |
| 3039 | } |
| 3040 | #else /* WIN32 */ |
| 3041 | va_listcxx . . $ va_list# copied_args; |
| 3042 | va_copycxx . . $ `<external>/8293021631987149590/stdarg.h:57:9`!(copied_args, args); |
| 3043 | written_size = vsnprintfcxx . . $ vsnprintf(a85eea89d1bd834f).(GRN_BULK_CURRcxx . . $ `include/groonga/groonga.h:2650:9`!(bulk), rest_size, format, copied_args); |
| 3044 | va_endcxx . . $ `<external>/8293021631987149590/stdarg.h:53:9`!(copied_args); |
| 3045 | const boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! is_written = |
| 3046 | (written_size >= 0 && ((size_t)written_size + 1 <= rest_size)); |
| 3047 | if (!is_written) { |
| 3048 | const size_t required_size = |
| 3049 | (size_t)written_size + 1; /* "+ 1" for terminate '\0'. */ |
| 3050 | const grn_rccxx . . $ grn_rc# rc = grn_bulk_reservecxx . . $ grn_bulk_reserve(f9a66385f261f61d).(ctx, bulk, required_size); |
| 3051 | if (rc) { |
| 3052 | return rc; |
| 3053 | } |
| 3054 | va_copycxx . . $ `<external>/8293021631987149590/stdarg.h:57:9`!(copied_args, args); |
| 3055 | written_size = |
| 3056 | vsnprintfcxx . . $ vsnprintf(a85eea89d1bd834f).(GRN_BULK_CURRcxx . . $ `include/groonga/groonga.h:2650:9`!(bulk), required_size, format, copied_args); |
| 3057 | va_endcxx . . $ `<external>/8293021631987149590/stdarg.h:53:9`!(copied_args); |
| 3058 | } |
| 3059 | #endif /* WIN32 */ |
| 3060 | |
| 3061 | if (written_size < 0) { |
| 3062 | return GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.; |
| 3063 | } |
| 3064 | |
| 3065 | GRN_BULK_INCR_LENcxx . . $ `include/groonga/groonga.h:2627:9`!(bulk, written_size); |
| 3066 | return GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 3067 | } |
| 3068 | |
| 3069 | grn_rccxx . . $ grn_rc# |
| 3070 | grn_text_vprintfcxx . . $ grn_text_vprintf(26ae3e66154406).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *bulk, const char *format, va_listcxx . . $ va_list# args) |
| 3071 | { |
| 3072 | return grn_text_printfvcxx . . $ grn_text_printfv(26ae3e66154406).(ctx, bulk, format, args); |
| 3073 | } |
| 3074 | |
| 3075 | grn_rccxx . . $ grn_rc# |
| 3076 | grn_bulk_fincxx . . $ grn_bulk_fin(4865d068a46d0f83).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *buf) |
| 3077 | { |
| 3078 | if (!(buf->headercxx . . $ _grn_obj#header..impl_flagscxx . . $ _grn_obj_header#impl_flags. & GRN_OBJ_REFERcxx . . $ `include/groonga/groonga.h:935:9`!)) { |
| 3079 | if (GRN_BULK_OUTPcxx . . $ `include/groonga/groonga.h:2598:9`!(buf) && buf->ucxx . . $ _grn_obj#u..bcxx . . $ _grn_obj#$anonymous_type_6#b..headcxx . . $ _grn_obj#$anonymous_type_6#$anonymous_type_7#head.) { |
| 3080 | GRN_REALLOCcxx . . $ `lib/grn_alloc.h:43:9`!(buf->u.b.head - grn_bulk_margin_size, 0); |
| 3081 | } |
| 3082 | } |
| 3083 | buf->headercxx . . $ _grn_obj#header..flagscxx . . $ _grn_obj_header#flags. = 0; |
| 3084 | buf->headercxx . . $ _grn_obj#header..impl_flagscxx . . $ _grn_obj_header#impl_flags. &= (uint8_tcxx . . $ uint8_t#)(~GRN_OBJ_DO_SHALLOW_COPYcxx . . $ `include/groonga/groonga.h:2732:9`!); |
| 3085 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(&(buf->ucxx . . $ _grn_obj#u.), 0, sizeof(buf->ucxx . . $ _grn_obj#u.)); |
| 3086 | return GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 3087 | } |
| 3088 | |
| 3089 | grn_rccxx . . $ grn_rc# |
| 3090 | grn_substringcxx . . $ grn_substring(473fce51820fcb75).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 3091 | char **str, |
| 3092 | char **str_end, |
| 3093 | int start, |
| 3094 | int end, |
| 3095 | grn_encodingcxx . . $ grn_encoding# encoding) |
| 3096 | { |
| 3097 | int i; |
| 3098 | int l; |
| 3099 | char *s = *str, *e = *str_end; |
| 3100 | for (i = 0; s < e; i++, s += l) { |
| 3101 | if (i == start) { |
| 3102 | *str = s; |
| 3103 | } |
| 3104 | if (!(l = grn_charlencxx . . $ grn_charlen(d229e8bf7c87f0f0).(ctx, s, e))) { |
| 3105 | return GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.; |
| 3106 | } |
| 3107 | if (i == end) { |
| 3108 | *str_end = s; |
| 3109 | break; |
| 3110 | } |
| 3111 | } |
| 3112 | return GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 3113 | } |
| 3114 | |
| 3115 | static void |
| 3116 | grn_text_atojcxx . . $ grn_text_atoj(d7e845e76ba38b73).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *bulk, grn_objcxx . . $ grn_obj# *obj, grn_idcxx . . $ grn_id# id) |
| 3117 | { |
| 3118 | grn_objcxx . . $ grn_obj# buf; |
| 3119 | if (obj->headercxx . . $ _grn_obj#header..typecxx . . $ _grn_obj_header#type. == GRN_ACCESSORcxx . . $ `include/groonga/groonga.h:880:9`!) { |
| 3120 | grn_accessorcxx . . $ grn_accessor# *a = (grn_accessorcxx . . $ grn_accessor# *)obj; |
| 3121 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&buf, 0); |
| 3122 | for (;;) { |
| 3123 | GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(&buf); |
| 3124 | switch (a->actioncxx . . $ _grn_accessor#action.) { |
| 3125 | case GRN_ACCESSOR_GET_IDcxx . . $ GRN_ACCESSOR_GET_ID.: |
| 3126 | GRN_UINT32_PUTcxx . . $ `include/groonga/groonga.h:3182:9`!(ctx, &buf, id); |
| 3127 | buf.headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain. = GRN_DB_UINT32cxx . . $ GRN_DB_UINT32.; |
| 3128 | break; |
| 3129 | case GRN_ACCESSOR_GET_KEYcxx . . $ GRN_ACCESSOR_GET_KEY.: |
| 3130 | grn_table_get_key2cxx . . $ grn_table_get_key2(bd0cb75328e85567).(ctx, a->objcxx . . $ _grn_accessor#obj., id, &buf); |
| 3131 | buf.headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain. = DB_OBJcxx . . $ `lib/grn_db.h:62:9`!(a->obj)->headercxx . . $ $anonymous_type_4a7c1014017e4c5d_0#header..domaincxx . . $ _grn_obj_header#domain.; |
| 3132 | break; |
| 3133 | case GRN_ACCESSOR_GET_VALUEcxx . . $ GRN_ACCESSOR_GET_VALUE.: |
| 3134 | grn_obj_get_valuecxx . . $ grn_obj_get_value(6e06fec66698a6a).(ctx, a->objcxx . . $ _grn_accessor#obj., id, &buf); |
| 3135 | buf.headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain. = GRN_DB_INT32cxx . . $ GRN_DB_INT32.; /* fix me */ |
| 3136 | break; |
| 3137 | case GRN_ACCESSOR_GET_SCOREcxx . . $ GRN_ACCESSOR_GET_SCORE.: |
| 3138 | { |
| 3139 | double score = grn_table_get_scorecxx . . $ grn_table_get_score(ca33257a3eac4acc).(ctx, a->objcxx . . $ _grn_accessor#obj., id); |
| 3140 | int32_tcxx . . $ int32_t# int32_score = (int32_tcxx . . $ int32_t#)score; |
| 3141 | GRN_INT32_PUTcxx . . $ `include/groonga/groonga.h:3177:9`!(ctx, &buf, int32_score); |
| 3142 | } |
| 3143 | buf.headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain. = GRN_DB_INT32cxx . . $ GRN_DB_INT32.; |
| 3144 | break; |
| 3145 | case GRN_ACCESSOR_GET_NSUBRECScxx . . $ GRN_ACCESSOR_GET_NSUBRECS.: |
| 3146 | { |
| 3147 | uint32_tcxx . . $ uint32_t# vs; |
| 3148 | grn_rset_recinfocxx . . $ grn_rset_recinfo# *ri = |
| 3149 | (grn_rset_recinfocxx . . $ grn_rset_recinfo# *)grn_obj_get_value_cxx . . $ grn_obj_get_value_(8830938a2f981d6d).(ctx, a->objcxx . . $ _grn_accessor#obj., id, &vs); |
| 3150 | GRN_INT32_PUTcxx . . $ `include/groonga/groonga.h:3177:9`!(ctx, &buf, ri->n_subrecs); |
| 3151 | } |
| 3152 | buf.headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain. = GRN_DB_INT32cxx . . $ GRN_DB_INT32.; |
| 3153 | break; |
| 3154 | case GRN_ACCESSOR_GET_COLUMN_VALUEcxx . . $ GRN_ACCESSOR_GET_COLUMN_VALUE.: |
| 3155 | if ((a->objcxx . . $ _grn_accessor#obj.->headercxx . . $ _grn_obj#header..flagscxx . . $ _grn_obj_header#flags. & GRN_OBJ_COLUMN_TYPE_MASKcxx . . $ `include/groonga/groonga.h:726:9`!) == |
| 3156 | GRN_OBJ_COLUMN_VECTORcxx . . $ `include/groonga/groonga.h:736:9`!) { |
| 3157 | if (a->nextcxx . . $ _grn_accessor#next.) { |
| 3158 | grn_idcxx . . $ grn_id# *idp; |
| 3159 | grn_obj_get_valuecxx . . $ grn_obj_get_value(6e06fec66698a6a).(ctx, a->objcxx . . $ _grn_accessor#obj., id, &buf); |
| 3160 | idp = (grn_idcxx . . $ grn_id# *)GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(&buf); |
| 3161 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, '['); |
| 3162 | size_t vs; |
| 3163 | for (vs = GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(&buf) / sizeof(grn_idcxx . . $ grn_id#); vs--; idp++) { |
| 3164 | grn_text_atojcxx . . $ grn_text_atoj(d7e845e76ba38b73).(ctx, bulk, (grn_objcxx . . $ grn_obj# *)a->nextcxx . . $ _grn_accessor#next., *idp); |
| 3165 | if (vs) { |
| 3166 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, ','); |
| 3167 | } |
| 3168 | } |
| 3169 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, ']'); |
| 3170 | } else { |
| 3171 | grn_text_atojcxx . . $ grn_text_atoj(d7e845e76ba38b73).(ctx, bulk, a->objcxx . . $ _grn_accessor#obj., id); |
| 3172 | } |
| 3173 | goto exit; |
| 3174 | } else { |
| 3175 | grn_obj_get_valuecxx . . $ grn_obj_get_value(6e06fec66698a6a).(ctx, a->objcxx . . $ _grn_accessor#obj., id, &buf); |
| 3176 | } |
| 3177 | break; |
| 3178 | case GRN_ACCESSOR_GET_DB_OBJcxx . . $ GRN_ACCESSOR_GET_DB_OBJ.: |
| 3179 | /* todo */ |
| 3180 | break; |
| 3181 | case GRN_ACCESSOR_LOOKUPcxx . . $ GRN_ACCESSOR_LOOKUP.: |
| 3182 | /* todo */ |
| 3183 | break; |
| 3184 | case GRN_ACCESSOR_FUNCALLcxx . . $ GRN_ACCESSOR_FUNCALL.: |
| 3185 | /* todo */ |
| 3186 | break; |
| 3187 | } |
| 3188 | if (a->nextcxx . . $ _grn_accessor#next.) { |
| 3189 | a = a->nextcxx . . $ _grn_accessor#next.; |
| 3190 | id = *((grn_idcxx . . $ grn_id# *)GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(&buf)); |
| 3191 | } else { |
| 3192 | break; |
| 3193 | } |
| 3194 | } |
| 3195 | } else { |
| 3196 | switch (obj->headercxx . . $ _grn_obj#header..typecxx . . $ _grn_obj_header#type.) { |
| 3197 | case GRN_COLUMN_FIX_SIZEcxx . . $ `include/groonga/groonga.h:900:9`!: |
| 3198 | GRN_VALUE_FIX_SIZE_INITcxx . . $ `include/groonga/groonga.h:2738:9`!(&buf, 0, DB_OBJcxx . . $ `lib/grn_db.h:62:9`!(obj)->range); |
| 3199 | break; |
| 3200 | case GRN_COLUMN_VAR_SIZEcxx . . $ `include/groonga/groonga.h:901:9`!: |
| 3201 | if ((obj->headercxx . . $ _grn_obj#header..flagscxx . . $ _grn_obj_header#flags. & GRN_OBJ_COLUMN_TYPE_MASKcxx . . $ `include/groonga/groonga.h:726:9`!) == |
| 3202 | GRN_OBJ_COLUMN_VECTORcxx . . $ `include/groonga/groonga.h:736:9`!) { |
| 3203 | grn_objcxx . . $ grn_obj# *range = grn_ctx_atcxx . . $ grn_ctx_at(ac4544c8400954c9).(ctx, DB_OBJcxx . . $ `lib/grn_db.h:62:9`!(obj)->rangecxx . . $ $anonymous_type_4a7c1014017e4c5d_0#range.); |
| 3204 | if (range->headercxx . . $ _grn_obj#header..flagscxx . . $ _grn_obj_header#flags. & GRN_OBJ_KEY_VAR_SIZEcxx . . $ `include/groonga/groonga.h:820:9`!) { |
| 3205 | GRN_VALUE_VAR_SIZE_INITcxx . . $ `include/groonga/groonga.h:2743:9`!(&buf, GRN_OBJ_VECTORcxx . . $ `include/groonga/groonga.h:2734:9`!, DB_OBJcxx . . $ `lib/grn_db.h:62:9`!(obj)->range); |
| 3206 | } else { |
| 3207 | GRN_VALUE_FIX_SIZE_INITcxx . . $ `include/groonga/groonga.h:2738:9`!(&buf, GRN_OBJ_VECTORcxx . . $ `include/groonga/groonga.h:2734:9`!, DB_OBJcxx . . $ `lib/grn_db.h:62:9`!(obj)->range); |
| 3208 | } |
| 3209 | } else { |
| 3210 | GRN_VALUE_VAR_SIZE_INITcxx . . $ `include/groonga/groonga.h:2743:9`!(&buf, 0, DB_OBJcxx . . $ `lib/grn_db.h:62:9`!(obj)->range); |
| 3211 | } |
| 3212 | break; |
| 3213 | case GRN_COLUMN_INDEXcxx . . $ `include/groonga/groonga.h:902:9`!: |
| 3214 | GRN_UINT32_INITcxx . . $ `include/groonga/groonga.h:2854:9`!(&buf, 0); |
| 3215 | break; |
| 3216 | default: |
| 3217 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&buf, 0); |
| 3218 | break; |
| 3219 | } |
| 3220 | grn_obj_get_valuecxx . . $ grn_obj_get_value(6e06fec66698a6a).(ctx, obj, id, &buf); |
| 3221 | } |
| 3222 | grn_text_otojcxx . . $ grn_text_otoj(1909183af06c6849).(ctx, bulk, &buf, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 3223 | exit: |
| 3224 | grn_obj_closecxx . . $ grn_obj_close(4865d068a46d0f83).(ctx, &buf); |
| 3225 | } |
| 3226 | |
| 3227 | grn_rccxx . . $ grn_rc# |
| 3228 | grn_text_otojcxx . . $ grn_text_otoj(1909183af06c6849).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *bulk, grn_objcxx . . $ grn_obj# *obj, grn_obj_formatcxx . . $ grn_obj_format# *format) |
| 3229 | { |
| 3230 | grn_objcxx . . $ grn_obj# buf; |
| 3231 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&buf, 0); |
| 3232 | switch (obj->headercxx . . $ _grn_obj#header..typecxx . . $ _grn_obj_header#type.) { |
| 3233 | case GRN_BULKcxx . . $ `include/groonga/groonga.h:868:9`!: |
| 3234 | switch (obj->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain.) { |
| 3235 | case GRN_DB_VOIDcxx . . $ GRN_DB_VOID.: |
| 3236 | case GRN_DB_SHORT_TEXTcxx . . $ GRN_DB_SHORT_TEXT.: |
| 3237 | case GRN_DB_TEXTcxx . . $ GRN_DB_TEXT.: |
| 3238 | case GRN_DB_LONG_TEXTcxx . . $ GRN_DB_LONG_TEXT.: |
| 3239 | grn_text_esccxx . . $ grn_text_esc(4609c18fd87cf054).(ctx, bulk, GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(obj), GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(obj)); |
| 3240 | break; |
| 3241 | case GRN_DB_BOOLcxx . . $ GRN_DB_BOOL.: |
| 3242 | if (*((unsigned char *)GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(obj))) { |
| 3243 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, bulk, "true"); |
| 3244 | } else { |
| 3245 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, bulk, "false"); |
| 3246 | } |
| 3247 | break; |
| 3248 | case GRN_DB_INT8cxx . . $ GRN_DB_INT8.: |
| 3249 | grn_text_itoacxx . . $ grn_text_itoa(1bfdfa8473156571).(ctx, bulk, GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(obj) ? GRN_INT8_VALUEcxx . . $ `include/groonga/groonga.h:3098:9`!(obj) : 0); |
| 3250 | break; |
| 3251 | case GRN_DB_UINT8cxx . . $ GRN_DB_UINT8.: |
| 3252 | grn_text_lltoacxx . . $ grn_text_lltoa(1b142823d3915b88).(ctx, bulk, GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(obj) ? GRN_UINT8_VALUEcxx . . $ `include/groonga/groonga.h:3099:9`!(obj) : 0); |
| 3253 | break; |
| 3254 | case GRN_DB_INT16cxx . . $ GRN_DB_INT16.: |
| 3255 | grn_text_itoacxx . . $ grn_text_itoa(1bfdfa8473156571).(ctx, bulk, GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(obj) ? GRN_INT16_VALUEcxx . . $ `include/groonga/groonga.h:3100:9`!(obj) : 0); |
| 3256 | break; |
| 3257 | case GRN_DB_UINT16cxx . . $ GRN_DB_UINT16.: |
| 3258 | grn_text_lltoacxx . . $ grn_text_lltoa(1b142823d3915b88).(ctx, |
| 3259 | bulk, |
| 3260 | GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(obj) ? GRN_UINT16_VALUEcxx . . $ `include/groonga/groonga.h:3101:9`!(obj) : 0); |
| 3261 | break; |
| 3262 | case GRN_DB_INT32cxx . . $ GRN_DB_INT32.: |
| 3263 | grn_text_itoacxx . . $ grn_text_itoa(1bfdfa8473156571).(ctx, bulk, GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(obj) ? GRN_INT32_VALUEcxx . . $ `include/groonga/groonga.h:3102:9`!(obj) : 0); |
| 3264 | break; |
| 3265 | case GRN_DB_UINT32cxx . . $ GRN_DB_UINT32.: |
| 3266 | grn_text_lltoacxx . . $ grn_text_lltoa(1b142823d3915b88).(ctx, |
| 3267 | bulk, |
| 3268 | GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(obj) ? GRN_UINT32_VALUEcxx . . $ `include/groonga/groonga.h:3103:9`!(obj) : 0); |
| 3269 | break; |
| 3270 | case GRN_DB_INT64cxx . . $ GRN_DB_INT64.: |
| 3271 | grn_text_lltoacxx . . $ grn_text_lltoa(1b142823d3915b88).(ctx, bulk, GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(obj) ? GRN_INT64_VALUEcxx . . $ `include/groonga/groonga.h:3104:9`!(obj) : 0); |
| 3272 | break; |
| 3273 | case GRN_DB_UINT64cxx . . $ GRN_DB_UINT64.: |
| 3274 | grn_text_ulltoacxx . . $ grn_text_ulltoa(cf35b313a8fea93f).(ctx, |
| 3275 | bulk, |
| 3276 | GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(obj) ? GRN_UINT64_VALUEcxx . . $ `include/groonga/groonga.h:3105:9`!(obj) : 0); |
| 3277 | break; |
| 3278 | #ifdef GRN_HAVE_BFLOAT16 |
| 3279 | case GRN_DB_BFLOAT16: |
| 3280 | grn_text_bf16toa(ctx, |
| 3281 | bulk, |
| 3282 | GRN_BULK_VSIZE(obj) ? GRN_BFLOAT16_VALUE(obj) : 0); |
| 3283 | break; |
| 3284 | #endif |
| 3285 | case GRN_DB_FLOAT32cxx . . $ GRN_DB_FLOAT32.: |
| 3286 | grn_text_f32toacxx . . $ grn_text_f32toa(1baff083bef0534b).(ctx, |
| 3287 | bulk, |
| 3288 | GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(obj) ? GRN_FLOAT32_VALUEcxx . . $ `include/groonga/groonga.h:3107:9`!(obj) : 0); |
| 3289 | break; |
| 3290 | case GRN_DB_FLOATcxx . . $ GRN_DB_FLOAT.: |
| 3291 | grn_text_ftoacxx . . $ grn_text_ftoa(bba05b37cb576d9a).(ctx, bulk, GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(obj) ? GRN_FLOAT_VALUEcxx . . $ `include/groonga/groonga.h:3108:9`!(obj) : 0); |
| 3292 | break; |
| 3293 | case GRN_DB_TIMEcxx . . $ GRN_DB_TIME.: |
| 3294 | { |
| 3295 | double dv = (double)(*((int64_tcxx . . $ int64_t# *)GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(obj))); |
| 3296 | dv /= 1000000.0; |
| 3297 | grn_text_ftoacxx . . $ grn_text_ftoa(bba05b37cb576d9a).(ctx, bulk, dv); |
| 3298 | } |
| 3299 | break; |
| 3300 | case GRN_DB_TOKYO_GEO_POINTcxx . . $ GRN_DB_TOKYO_GEO_POINT.: |
| 3301 | case GRN_DB_WGS84_GEO_POINTcxx . . $ GRN_DB_WGS84_GEO_POINT.: |
| 3302 | if (GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(obj) == sizeof(grn_geo_pointcxx . . $ grn_geo_point#)) { |
| 3303 | grn_geo_pointcxx . . $ grn_geo_point# *gp = (grn_geo_pointcxx . . $ grn_geo_point# *)GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(obj); |
| 3304 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, '"'); |
| 3305 | grn_text_itoacxx . . $ grn_text_itoa(1bfdfa8473156571).(ctx, bulk, gp->latitudecxx . . $ $anonymous_type_2a7e33a0c5c5f400_0#latitude.); |
| 3306 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, 'x'); |
| 3307 | grn_text_itoacxx . . $ grn_text_itoa(1bfdfa8473156571).(ctx, bulk, gp->longitudecxx . . $ $anonymous_type_2a7e33a0c5c5f400_0#longitude.); |
| 3308 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, '"'); |
| 3309 | } else { |
| 3310 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, bulk, "\"\""); |
| 3311 | } |
| 3312 | break; |
| 3313 | case GRN_DB_SHORT_BINARYcxx . . $ GRN_DB_SHORT_BINARY.: |
| 3314 | case GRN_DB_BINARYcxx . . $ GRN_DB_BINARY.: |
| 3315 | case GRN_DB_LONG_BINARYcxx . . $ GRN_DB_LONG_BINARY.: |
| 3316 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, '"'); |
| 3317 | grn_obj_castcxx . . $ grn_obj_cast(a6fd93da1614eccd).(ctx, obj, bulk, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!); |
| 3318 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, '"'); |
| 3319 | break; |
| 3320 | case GRN_DB_JSONcxx . . $ GRN_DB_JSON.: |
| 3321 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, '"'); |
| 3322 | { |
| 3323 | grn_objcxx . . $ grn_obj# json_text; |
| 3324 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&json_text, 0); |
| 3325 | grn_json_to_stringcxx . . $ grn_json_to_string(d825b4ed5bf12304).(ctx, obj, &json_text); |
| 3326 | const char *start = GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&json_text); |
| 3327 | const char *end = start + GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&json_text); |
| 3328 | while (start < end) { |
| 3329 | int length = grn_charlencxx . . $ grn_charlen(d229e8bf7c87f0f0).(ctx, start, end); |
| 3330 | if (length == 0) { |
| 3331 | break; |
| 3332 | } |
| 3333 | if (length == 1 && start[0] == '"') { |
| 3334 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, '\\'); |
| 3335 | } |
| 3336 | GRN_TEXT_PUTcxx . . $ `include/groonga/groonga.h:2773:9`!(ctx, bulk, start, length); |
| 3337 | start += length; |
| 3338 | } |
| 3339 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &json_text); |
| 3340 | } |
| 3341 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, '"'); |
| 3342 | break; |
| 3343 | default: |
| 3344 | if (format) { |
| 3345 | size_t j; |
| 3346 | size_t ncolumns = GRN_PTR_VECTOR_SIZEcxx . . $ `include/groonga/groonga.h:3265:9`!(&format->columns); |
| 3347 | grn_idcxx . . $ grn_id# id = GRN_RECORD_VALUEcxx . . $ `include/groonga/groonga.h:3110:9`!(obj); |
| 3348 | if (format->flagscxx . . $ _grn_obj_format#flags. & GRN_OBJ_FORMAT_WITH_COLUMN_NAMEScxx . . $ `include/groonga/output.h:28:9`!) { |
| 3349 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, bulk, "["); |
| 3350 | for (j = 0; j < ncolumns; j++) { |
| 3351 | grn_objcxx . . $ grn_obj# *column = GRN_PTR_VALUE_ATcxx . . $ `include/groonga/groonga.h:3150:9`!(&format->columns, j); |
| 3352 | grn_idcxx . . $ grn_id# range_id; |
| 3353 | if (j) { |
| 3354 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, ','); |
| 3355 | } |
| 3356 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, bulk, "["); |
| 3357 | GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(&buf); |
| 3358 | grn_column_name_cxx . . $ grn_column_name_(d825b4ed5bf12304).(ctx, column, &buf); |
| 3359 | grn_text_otojcxx . . $ grn_text_otoj(1909183af06c6849).(ctx, bulk, &buf, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 3360 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, ','); |
| 3361 | /* column range */ |
| 3362 | range_id = grn_obj_get_rangecxx . . $ grn_obj_get_range(8dd58acc9865e889).(ctx, column); |
| 3363 | if (range_id == GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!) { |
| 3364 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, bulk, "null"); |
| 3365 | } else { |
| 3366 | int name_len; |
| 3367 | grn_objcxx . . $ grn_obj# *range_obj; |
| 3368 | char name_buf[GRN_TABLE_MAX_KEY_SIZEcxx . . $ `include/groonga/table.h:26:9`!]; |
| 3369 | |
| 3370 | range_obj = grn_ctx_atcxx . . $ grn_ctx_at(ac4544c8400954c9).(ctx, range_id); |
| 3371 | name_len = |
| 3372 | grn_obj_namecxx . . $ grn_obj_name(a51d1bff955f2f21).(ctx, range_obj, name_buf, GRN_TABLE_MAX_KEY_SIZEcxx . . $ `include/groonga/table.h:26:9`!); |
| 3373 | GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(&buf); |
| 3374 | GRN_TEXT_PUTcxx . . $ `include/groonga/groonga.h:2773:9`!(ctx, &buf, name_buf, name_len); |
| 3375 | grn_text_otojcxx . . $ grn_text_otoj(1909183af06c6849).(ctx, bulk, &buf, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 3376 | } |
| 3377 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, bulk, "]"); |
| 3378 | } |
| 3379 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, bulk, "],"); |
| 3380 | } |
| 3381 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, '['); |
| 3382 | for (j = 0; j < ncolumns; j++) { |
| 3383 | grn_objcxx . . $ grn_obj# *column = GRN_PTR_VALUE_ATcxx . . $ `include/groonga/groonga.h:3150:9`!(&format->columns, j); |
| 3384 | if (j) { |
| 3385 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, ','); |
| 3386 | } |
| 3387 | grn_text_atojcxx . . $ grn_text_atoj(d7e845e76ba38b73).(ctx, bulk, column, id); |
| 3388 | } |
| 3389 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, ']'); |
| 3390 | } else { |
| 3391 | if (GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(obj) == 0) { |
| 3392 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, bulk, "null"); |
| 3393 | } else { |
| 3394 | grn_objcxx . . $ grn_obj# *table = grn_ctx_atcxx . . $ grn_ctx_at(ac4544c8400954c9).(ctx, obj->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain.); |
| 3395 | grn_idcxx . . $ grn_id# id = GRN_RECORD_VALUEcxx . . $ `include/groonga/groonga.h:3110:9`!(obj); |
| 3396 | if (table && table->headercxx . . $ _grn_obj#header..typecxx . . $ _grn_obj_header#type. != GRN_TABLE_NO_KEYcxx . . $ `include/groonga/groonga.h:898:9`!) { |
| 3397 | /* todo : temporal patch. grn_table_at() is kinda costful... */ |
| 3398 | if (grn_table_atcxx . . $ grn_table_at(c0317bb03c33a3cb).(ctx, table, id)) { |
| 3399 | grn_objcxx . . $ grn_obj# *accessor = grn_obj_columncxx . . $ grn_obj_column(c00e49795c44129a).(ctx, |
| 3400 | table, |
| 3401 | GRN_COLUMN_NAME_KEYcxx . . $ `include/groonga/column.h:63:9`!, |
| 3402 | GRN_COLUMN_NAME_KEY_LENcxx . . $ `include/groonga/column.h:72:9`!); |
| 3403 | if (accessor) { |
| 3404 | grn_obj_get_valuecxx . . $ grn_obj_get_value(6e06fec66698a6a).(ctx, accessor, id, &buf); |
| 3405 | grn_obj_unlinkcxx . . $ grn_obj_unlink(4865d068a46d0f83).(ctx, accessor); |
| 3406 | } |
| 3407 | } |
| 3408 | grn_text_otojcxx . . $ grn_text_otoj(1909183af06c6849).(ctx, bulk, &buf, format); |
| 3409 | } else { |
| 3410 | grn_text_lltoacxx . . $ grn_text_lltoa(1b142823d3915b88).(ctx, bulk, id); |
| 3411 | } |
| 3412 | } |
| 3413 | } |
| 3414 | } |
| 3415 | break; |
| 3416 | case GRN_UVECTORcxx . . $ `include/groonga/groonga.h:875:9`!: |
| 3417 | if (format) { |
| 3418 | if (format->flagscxx . . $ _grn_obj_format#flags. & GRN_OBJ_FORMAT_WITH_WEIGHTcxx . . $ `include/groonga/output.h:33:9`!) { |
| 3419 | uint32_tcxx . . $ uint32_t# i; |
| 3420 | uint32_tcxx . . $ uint32_t# n; |
| 3421 | grn_objcxx . . $ grn_obj# *domain; |
| 3422 | |
| 3423 | n = grn_uvector_sizecxx . . $ grn_uvector_size(8dd58acc9865e889).(ctx, obj); |
| 3424 | domain = grn_ctx_atcxx . . $ grn_ctx_at(ac4544c8400954c9).(ctx, obj->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain.); |
| 3425 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, bulk, "{"); |
| 3426 | for (i = 0; i < n; i++) { |
| 3427 | grn_idcxx . . $ grn_id# id; |
| 3428 | float weight; |
| 3429 | |
| 3430 | if (i > 0) { |
| 3431 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, ','); |
| 3432 | } |
| 3433 | id = grn_uvector_get_element_recordcxx . . $ grn_uvector_get_element_record(c5aebe30586be12f).(ctx, obj, i, &weight); |
| 3434 | if (domain) { |
| 3435 | if (domain->headercxx . . $ _grn_obj#header..typecxx . . $ _grn_obj_header#type. == GRN_TABLE_NO_KEYcxx . . $ `include/groonga/groonga.h:898:9`!) { |
| 3436 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, '"'); |
| 3437 | grn_text_ulltoacxx . . $ grn_text_ulltoa(cf35b313a8fea93f).(ctx, bulk, id); |
| 3438 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, '"'); |
| 3439 | } else { |
| 3440 | GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(&buf); |
| 3441 | grn_table_get_key2cxx . . $ grn_table_get_key2(bd0cb75328e85567).(ctx, domain, id, &buf); |
| 3442 | grn_text_otojcxx . . $ grn_text_otoj(1909183af06c6849).(ctx, bulk, &buf, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 3443 | } |
| 3444 | } else { |
| 3445 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, '"'); |
| 3446 | grn_text_ulltoacxx . . $ grn_text_ulltoa(cf35b313a8fea93f).(ctx, bulk, id); |
| 3447 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, '"'); |
| 3448 | } |
| 3449 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, ':'); |
| 3450 | if (format->flagscxx . . $ _grn_obj_format#flags. & GRN_OBJ_FORMAT_WEIGHT_FLOAT32cxx . . $ `include/groonga/output.h:36:9`!) { |
| 3451 | grn_text_f32toacxx . . $ grn_text_f32toa(1baff083bef0534b).(ctx, bulk, weight); |
| 3452 | } else { |
| 3453 | grn_text_ulltoacxx . . $ grn_text_ulltoa(cf35b313a8fea93f).(ctx, bulk, (uint64_tcxx . . $ uint64_t#)weight); |
| 3454 | } |
| 3455 | } |
| 3456 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, bulk, "}"); |
| 3457 | } else { |
| 3458 | /* TODO: Does we still need this code? If we don't need this, we should |
| 3459 | remove this. */ |
| 3460 | int i; |
| 3461 | grn_idcxx . . $ grn_id# *v = (grn_idcxx . . $ grn_id# *)GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(obj), |
| 3462 | *ve = (grn_idcxx . . $ grn_id# *)GRN_BULK_CURRcxx . . $ `include/groonga/groonga.h:2650:9`!(obj); |
| 3463 | size_t j; |
| 3464 | size_t ncolumns = GRN_PTR_VECTOR_SIZEcxx . . $ `include/groonga/groonga.h:3265:9`!(&format->columns); |
| 3465 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, bulk, "[["); |
| 3466 | grn_text_itoacxx . . $ grn_text_itoa(1bfdfa8473156571).(ctx, bulk, (int)(ve - v)); |
| 3467 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, ']'); |
| 3468 | if (v < ve) { |
| 3469 | if (format->flagscxx . . $ _grn_obj_format#flags. & GRN_OBJ_FORMAT_WITH_COLUMN_NAMEScxx . . $ `include/groonga/output.h:28:9`!) { |
| 3470 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, bulk, ",["); |
| 3471 | for (j = 0; j < ncolumns; j++) { |
| 3472 | grn_objcxx . . $ grn_obj# *column = GRN_PTR_VALUE_ATcxx . . $ `include/groonga/groonga.h:3150:9`!(&format->columns, j); |
| 3473 | grn_idcxx . . $ grn_id# range_id; |
| 3474 | if (j) { |
| 3475 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, ','); |
| 3476 | } |
| 3477 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, bulk, "["); |
| 3478 | GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(&buf); |
| 3479 | grn_column_name_cxx . . $ grn_column_name_(d825b4ed5bf12304).(ctx, column, &buf); |
| 3480 | grn_text_otojcxx . . $ grn_text_otoj(1909183af06c6849).(ctx, bulk, &buf, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 3481 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, ','); |
| 3482 | /* column range */ |
| 3483 | range_id = grn_obj_get_rangecxx . . $ grn_obj_get_range(8dd58acc9865e889).(ctx, column); |
| 3484 | if (range_id == GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!) { |
| 3485 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, bulk, "null"); |
| 3486 | } else { |
| 3487 | int name_len; |
| 3488 | grn_objcxx . . $ grn_obj# *range_obj; |
| 3489 | char name_buf[GRN_TABLE_MAX_KEY_SIZEcxx . . $ `include/groonga/table.h:26:9`!]; |
| 3490 | |
| 3491 | range_obj = grn_ctx_atcxx . . $ grn_ctx_at(ac4544c8400954c9).(ctx, range_id); |
| 3492 | name_len = grn_obj_namecxx . . $ grn_obj_name(a51d1bff955f2f21).(ctx, |
| 3493 | range_obj, |
| 3494 | name_buf, |
| 3495 | GRN_TABLE_MAX_KEY_SIZEcxx . . $ `include/groonga/table.h:26:9`!); |
| 3496 | GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(&buf); |
| 3497 | GRN_TEXT_PUTcxx . . $ `include/groonga/groonga.h:2773:9`!(ctx, &buf, name_buf, name_len); |
| 3498 | grn_text_otojcxx . . $ grn_text_otoj(1909183af06c6849).(ctx, bulk, &buf, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 3499 | } |
| 3500 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, bulk, "]"); |
| 3501 | } |
| 3502 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, ']'); |
| 3503 | } |
| 3504 | for (i = 0;; i++) { |
| 3505 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, bulk, ",["); |
| 3506 | for (j = 0; j < ncolumns; j++) { |
| 3507 | grn_objcxx . . $ grn_obj# *column = GRN_PTR_VALUE_ATcxx . . $ `include/groonga/groonga.h:3150:9`!(&format->columns, j); |
| 3508 | if (j) { |
| 3509 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, ','); |
| 3510 | } |
| 3511 | GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(&buf); |
| 3512 | grn_obj_get_valuecxx . . $ grn_obj_get_value(6e06fec66698a6a).(ctx, column, *v, &buf); |
| 3513 | grn_text_otojcxx . . $ grn_text_otoj(1909183af06c6849).(ctx, bulk, &buf, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 3514 | } |
| 3515 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, ']'); |
| 3516 | v++; |
| 3517 | if (v < ve) { |
| 3518 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, ','); |
| 3519 | } else { |
| 3520 | break; |
| 3521 | } |
| 3522 | } |
| 3523 | } |
| 3524 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, ']'); |
| 3525 | } |
| 3526 | } else { |
| 3527 | grn_objcxx . . $ grn_obj# *range = grn_ctx_atcxx . . $ grn_ctx_at(ac4544c8400954c9).(ctx, obj->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain.); |
| 3528 | if (range && range->headercxx . . $ _grn_obj#header..typecxx . . $ _grn_obj_header#type. == GRN_TYPEcxx . . $ `include/groonga/groonga.h:892:9`!) { |
| 3529 | grn_idcxx . . $ grn_id# value_size = ((struct _grn_typecxx . . $ _grn_type# *)range)->objcxx . . $ _grn_type#obj..rangecxx . . $ $anonymous_type_4a7c1014017e4c5d_0#range.; |
| 3530 | char *v = (char *)GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(obj), *ve = (char *)GRN_BULK_CURRcxx . . $ `include/groonga/groonga.h:2650:9`!(obj); |
| 3531 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, '['); |
| 3532 | if (v < ve) { |
| 3533 | for (;;) { |
| 3534 | grn_objcxx . . $ grn_obj# value; |
| 3535 | GRN_OBJ_INITcxx . . $ `include/groonga/groonga.h:947:9`!(&value, GRN_BULKcxx . . $ `include/groonga/groonga.h:868:9`!, 0, obj->header.domain); |
| 3536 | grn_bulk_write_fromcxx . . $ grn_bulk_write_from(d8dd2947254981a1).(ctx, &value, v, 0, value_size); |
| 3537 | grn_text_otojcxx . . $ grn_text_otoj(1909183af06c6849).(ctx, bulk, &value, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 3538 | |
| 3539 | v += value_size; |
| 3540 | if (v < ve) { |
| 3541 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, ','); |
| 3542 | } else { |
| 3543 | break; |
| 3544 | } |
| 3545 | } |
| 3546 | } |
| 3547 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, ']'); |
| 3548 | } else { |
| 3549 | grn_idcxx . . $ grn_id# *v = (grn_idcxx . . $ grn_id# *)GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(obj), |
| 3550 | *ve = (grn_idcxx . . $ grn_id# *)GRN_BULK_CURRcxx . . $ `include/groonga/groonga.h:2650:9`!(obj); |
| 3551 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, '['); |
| 3552 | if (v < ve) { |
| 3553 | for (;;) { |
| 3554 | if (range && range->headercxx . . $ _grn_obj#header..typecxx . . $ _grn_obj_header#type. != GRN_TABLE_NO_KEYcxx . . $ `include/groonga/groonga.h:898:9`!) { |
| 3555 | grn_objcxx . . $ grn_obj# key; |
| 3556 | GRN_OBJ_INITcxx . . $ `include/groonga/groonga.h:947:9`!(&key, GRN_BULKcxx . . $ `include/groonga/groonga.h:868:9`!, 0, range->header.domain); |
| 3557 | grn_table_get_key2cxx . . $ grn_table_get_key2(bd0cb75328e85567).(ctx, range, *v, &key); |
| 3558 | grn_text_otojcxx . . $ grn_text_otoj(1909183af06c6849).(ctx, bulk, &key, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 3559 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &key); |
| 3560 | } else { |
| 3561 | grn_text_lltoacxx . . $ grn_text_lltoa(1b142823d3915b88).(ctx, bulk, *v); |
| 3562 | } |
| 3563 | v++; |
| 3564 | if (v < ve) { |
| 3565 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, ','); |
| 3566 | } else { |
| 3567 | break; |
| 3568 | } |
| 3569 | } |
| 3570 | } |
| 3571 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, ']'); |
| 3572 | } |
| 3573 | } |
| 3574 | break; |
| 3575 | case GRN_VECTORcxx . . $ `include/groonga/groonga.h:877:9`!: |
| 3576 | if (obj->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain. == GRN_DB_VOIDcxx . . $ GRN_DB_VOID.) { |
| 3577 | ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT, "invalid obj->header.domain"); |
| 3578 | } else { |
| 3579 | unsigned int i, n; |
| 3580 | grn_objcxx . . $ grn_obj# value; |
| 3581 | grn_objcxx . . $ grn_obj# weight; |
| 3582 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! with_weight = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 3583 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! is_weight_float32 = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 3584 | |
| 3585 | GRN_VOID_INITcxx . . $ `include/groonga/groonga.h:2749:9`!(&value); |
| 3586 | if (format) { |
| 3587 | with_weight = (format->flagscxx . . $ _grn_obj_format#flags. & GRN_OBJ_FORMAT_WITH_WEIGHTcxx . . $ `include/groonga/output.h:33:9`!); |
| 3588 | is_weight_float32 = (format->flagscxx . . $ _grn_obj_format#flags. & GRN_OBJ_FORMAT_WEIGHT_FLOAT32cxx . . $ `include/groonga/output.h:36:9`!); |
| 3589 | } |
| 3590 | if (is_weight_float32) { |
| 3591 | GRN_FLOAT32_INITcxx . . $ `include/groonga/groonga.h:2862:9`!(&weight, 0); |
| 3592 | } else { |
| 3593 | GRN_UINT32_INITcxx . . $ `include/groonga/groonga.h:2854:9`!(&weight, 0); |
| 3594 | } |
| 3595 | n = grn_vector_sizecxx . . $ grn_vector_size(8dd58acc9865e889).(ctx, obj); |
| 3596 | if (with_weight) { |
| 3597 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, '{'); |
| 3598 | } else { |
| 3599 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, '['); |
| 3600 | } |
| 3601 | for (i = 0; i < n; i++) { |
| 3602 | const char *value_raw; |
| 3603 | float weight_raw; |
| 3604 | unsigned int length; |
| 3605 | grn_idcxx . . $ grn_id# domain; |
| 3606 | if (i) { |
| 3607 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, ','); |
| 3608 | } |
| 3609 | |
| 3610 | length = grn_vector_get_element_floatcxx . . $ grn_vector_get_element_float(1a20d0a474ae13cb).(ctx, |
| 3611 | obj, |
| 3612 | i, |
| 3613 | &value_raw, |
| 3614 | &weight_raw, |
| 3615 | &domain); |
| 3616 | if (domain != GRN_DB_VOIDcxx . . $ GRN_DB_VOID.) { |
| 3617 | grn_obj_reinitcxx . . $ grn_obj_reinit(fc9ea836325dd1d2).(ctx, &value, domain, 0); |
| 3618 | } else { |
| 3619 | grn_obj_reinitcxx . . $ grn_obj_reinit(fc9ea836325dd1d2).(ctx, &value, obj->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain., 0); |
| 3620 | } |
| 3621 | grn_bulk_writecxx . . $ grn_bulk_write(4609c18fd87cf054).(ctx, &value, value_raw, length); |
| 3622 | grn_text_otojcxx . . $ grn_text_otoj(1909183af06c6849).(ctx, bulk, &value, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 3623 | if (with_weight) { |
| 3624 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, ':'); |
| 3625 | if (is_weight_float32) { |
| 3626 | GRN_FLOAT32_SETcxx . . $ `include/groonga/groonga.h:2929:9`!(ctx, &weight, weight_raw); |
| 3627 | } else { |
| 3628 | GRN_UINT32_SETcxx . . $ `include/groonga/groonga.h:2909:9`!(ctx, &weight, weight_raw); |
| 3629 | } |
| 3630 | grn_text_otojcxx . . $ grn_text_otoj(1909183af06c6849).(ctx, bulk, &weight, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 3631 | } |
| 3632 | } |
| 3633 | if (with_weight) { |
| 3634 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, '}'); |
| 3635 | } else { |
| 3636 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, ']'); |
| 3637 | } |
| 3638 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &value); |
| 3639 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &weight); |
| 3640 | } |
| 3641 | break; |
| 3642 | case GRN_PVECTORcxx . . $ `include/groonga/groonga.h:876:9`!: |
| 3643 | if (format) { |
| 3644 | ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_FUNCTION_NOT_IMPLEMENTED, |
| 3645 | "cannot print GRN_PVECTOR using grn_obj_format"); |
| 3646 | } else { |
| 3647 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, '['); |
| 3648 | size_t n = GRN_PTR_VECTOR_SIZEcxx . . $ `include/groonga/groonga.h:3265:9`!(obj); |
| 3649 | size_t i; |
| 3650 | for (i = 0; i < n; i++) { |
| 3651 | grn_objcxx . . $ grn_obj# *value; |
| 3652 | |
| 3653 | if (i) { |
| 3654 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, ','); |
| 3655 | } |
| 3656 | value = GRN_PTR_VALUE_ATcxx . . $ `include/groonga/groonga.h:3150:9`!(obj, i); |
| 3657 | grn_text_otojcxx . . $ grn_text_otoj(1909183af06c6849).(ctx, bulk, value, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 3658 | } |
| 3659 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, ']'); |
| 3660 | } |
| 3661 | break; |
| 3662 | case GRN_TABLE_HASH_KEYcxx . . $ `include/groonga/groonga.h:895:9`!: |
| 3663 | case GRN_TABLE_PAT_KEYcxx . . $ `include/groonga/groonga.h:896:9`!: |
| 3664 | case GRN_TABLE_NO_KEYcxx . . $ `include/groonga/groonga.h:898:9`!: |
| 3665 | if (format) { |
| 3666 | int i; |
| 3667 | size_t ncolumns = GRN_PTR_VECTOR_SIZEcxx . . $ `include/groonga/groonga.h:3265:9`!(&format->columns); |
| 3668 | grn_table_cursorcxx . . $ grn_table_cursor# *tc = grn_table_cursor_opencxx . . $ grn_table_cursor_open(a4cddc3087c69e91).(ctx, |
| 3669 | obj, |
| 3670 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, |
| 3671 | 0, |
| 3672 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, |
| 3673 | 0, |
| 3674 | format->offsetcxx . . $ _grn_obj_format#offset., |
| 3675 | format->limitcxx . . $ _grn_obj_format#limit., |
| 3676 | GRN_CURSOR_ASCENDINGcxx . . $ `include/groonga/table.h:273:9`!); |
| 3677 | if (!tc) { |
| 3678 | ERRCLRcxx . . $ `lib/grn_error.h:37:9`!(ctx); |
| 3679 | } |
| 3680 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, bulk, "[["); |
| 3681 | grn_text_itoacxx . . $ grn_text_itoa(1bfdfa8473156571).(ctx, bulk, format->nhitscxx . . $ _grn_obj_format#nhits.); |
| 3682 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, ']'); |
| 3683 | if (format->flagscxx . . $ _grn_obj_format#flags. & GRN_OBJ_FORMAT_WITH_COLUMN_NAMEScxx . . $ `include/groonga/output.h:28:9`!) { |
| 3684 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, bulk, ",["); |
| 3685 | size_t j; |
| 3686 | for (j = 0; j < ncolumns; j++) { |
| 3687 | grn_objcxx . . $ grn_obj# *column = GRN_PTR_VALUE_ATcxx . . $ `include/groonga/groonga.h:3150:9`!(&format->columns, j); |
| 3688 | grn_idcxx . . $ grn_id# range_id; |
| 3689 | if (j) { |
| 3690 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, ','); |
| 3691 | } |
| 3692 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, bulk, "["); |
| 3693 | GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(&buf); |
| 3694 | grn_column_name_cxx . . $ grn_column_name_(d825b4ed5bf12304).(ctx, column, &buf); |
| 3695 | grn_text_otojcxx . . $ grn_text_otoj(1909183af06c6849).(ctx, bulk, &buf, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 3696 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, ','); |
| 3697 | /* column range */ |
| 3698 | range_id = grn_obj_get_rangecxx . . $ grn_obj_get_range(8dd58acc9865e889).(ctx, column); |
| 3699 | if (range_id == GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!) { |
| 3700 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, bulk, "null"); |
| 3701 | } else { |
| 3702 | int name_len; |
| 3703 | grn_objcxx . . $ grn_obj# *range_obj; |
| 3704 | char name_buf[GRN_TABLE_MAX_KEY_SIZEcxx . . $ `include/groonga/table.h:26:9`!]; |
| 3705 | |
| 3706 | range_obj = grn_ctx_atcxx . . $ grn_ctx_at(ac4544c8400954c9).(ctx, range_id); |
| 3707 | name_len = |
| 3708 | grn_obj_namecxx . . $ grn_obj_name(a51d1bff955f2f21).(ctx, range_obj, name_buf, GRN_TABLE_MAX_KEY_SIZEcxx . . $ `include/groonga/table.h:26:9`!); |
| 3709 | GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(&buf); |
| 3710 | GRN_TEXT_PUTcxx . . $ `include/groonga/groonga.h:2773:9`!(ctx, &buf, name_buf, name_len); |
| 3711 | grn_text_otojcxx . . $ grn_text_otoj(1909183af06c6849).(ctx, bulk, &buf, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 3712 | } |
| 3713 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, bulk, "]"); |
| 3714 | } |
| 3715 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, ']'); |
| 3716 | } |
| 3717 | if (tc) { |
| 3718 | grn_idcxx . . $ grn_id# id; |
| 3719 | for (i = 0; (id = grn_table_cursor_nextcxx . . $ grn_table_cursor_next(8dd58acc9865e889).(ctx, tc)) != GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!; i++) { |
| 3720 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, bulk, ",["); |
| 3721 | size_t j; |
| 3722 | for (j = 0; j < ncolumns; j++) { |
| 3723 | grn_objcxx . . $ grn_obj# *column = GRN_PTR_VALUE_ATcxx . . $ `include/groonga/groonga.h:3150:9`!(&format->columns, j); |
| 3724 | if (j) { |
| 3725 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, ','); |
| 3726 | } |
| 3727 | grn_text_atojcxx . . $ grn_text_atoj(d7e845e76ba38b73).(ctx, bulk, column, id); |
| 3728 | } |
| 3729 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, ']'); |
| 3730 | } |
| 3731 | grn_table_cursor_closecxx . . $ grn_table_cursor_close(4865d068a46d0f83).(ctx, tc); |
| 3732 | } |
| 3733 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, ']'); |
| 3734 | } else { |
| 3735 | int i; |
| 3736 | grn_idcxx . . $ grn_id# id; |
| 3737 | grn_objcxx . . $ grn_obj# *column = |
| 3738 | grn_obj_columncxx . . $ grn_obj_column(c00e49795c44129a).(ctx, obj, GRN_COLUMN_NAME_KEYcxx . . $ `include/groonga/column.h:63:9`!, GRN_COLUMN_NAME_KEY_LENcxx . . $ `include/groonga/column.h:72:9`!); |
| 3739 | grn_table_cursorcxx . . $ grn_table_cursor# *tc = grn_table_cursor_opencxx . . $ grn_table_cursor_open(a4cddc3087c69e91).(ctx, |
| 3740 | obj, |
| 3741 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, |
| 3742 | 0, |
| 3743 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, |
| 3744 | 0, |
| 3745 | 0, |
| 3746 | -1, |
| 3747 | GRN_CURSOR_ASCENDINGcxx . . $ `include/groonga/table.h:273:9`!); |
| 3748 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, '['); |
| 3749 | if (tc) { |
| 3750 | for (i = 0; (id = grn_table_cursor_nextcxx . . $ grn_table_cursor_next(8dd58acc9865e889).(ctx, tc)) != GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!; i++) { |
| 3751 | if (i) { |
| 3752 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, ','); |
| 3753 | } |
| 3754 | GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(&buf); |
| 3755 | grn_obj_get_valuecxx . . $ grn_obj_get_value(6e06fec66698a6a).(ctx, column, id, &buf); |
| 3756 | grn_text_esccxx . . $ grn_text_esc(4609c18fd87cf054).(ctx, bulk, GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(&buf), GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(&buf)); |
| 3757 | } |
| 3758 | grn_table_cursor_closecxx . . $ grn_table_cursor_close(4865d068a46d0f83).(ctx, tc); |
| 3759 | } |
| 3760 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, bulk, ']'); |
| 3761 | grn_obj_unlinkcxx . . $ grn_obj_unlink(4865d068a46d0f83).(ctx, column); |
| 3762 | } |
| 3763 | break; |
| 3764 | } |
| 3765 | grn_obj_closecxx . . $ grn_obj_close(4865d068a46d0f83).(ctx, &buf); |
| 3766 | return GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 3767 | } |
| 3768 | |
| 3769 | const char * |
| 3770 | grn_text_urldeccxx . . $ grn_text_urldec(7474df649d8c100).( |
| 3771 | grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *buf, const char *p, const char *e, char d) |
| 3772 | { |
| 3773 | while (p < e) { |
| 3774 | if (*p == d) { |
| 3775 | p++; |
| 3776 | break; |
| 3777 | } else if (*p == '%' && p + 3 <= e) { |
| 3778 | const char *r; |
| 3779 | unsigned int c = grn_htouicxx . . $ grn_htoui(2da3fe788a18ce64).(p + 1, p + 3, &r); |
| 3780 | if (p + 3 == r) { |
| 3781 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, buf, (char)c); |
| 3782 | p += 3; |
| 3783 | } else { |
| 3784 | GRN_LOGcxx . . $ `include/groonga/groonga.h:2493:9`!(ctx, GRN_LOG_NOTICE, "invalid %% sequence (%c%c)", p[1], p[2]); |
| 3785 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, buf, '%'); |
| 3786 | p += 1; |
| 3787 | } |
| 3788 | } else { |
| 3789 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, buf, *p); |
| 3790 | p++; |
| 3791 | } |
| 3792 | } |
| 3793 | return p; |
| 3794 | } |
| 3795 | |
| 3796 | const char * |
| 3797 | grn_text_cgideccxx . . $ grn_text_cgidec(5d8e45ee3c206d59).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 3798 | grn_objcxx . . $ grn_obj# *buf, |
| 3799 | const char *p, |
| 3800 | const char *e, |
| 3801 | const char *delimiters) |
| 3802 | { |
| 3803 | while (p < e) { |
| 3804 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! found_delimiter = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 3805 | const char *delimiter; |
| 3806 | for (delimiter = delimiters; *delimiter; delimiter++) { |
| 3807 | if (*p == *delimiter) { |
| 3808 | found_delimiter = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 3809 | break; |
| 3810 | } |
| 3811 | } |
| 3812 | if (found_delimiter) { |
| 3813 | p++; |
| 3814 | break; |
| 3815 | } |
| 3816 | |
| 3817 | if (*p == '+') { |
| 3818 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, buf, ' '); |
| 3819 | p++; |
| 3820 | } else if (*p == '%' && p + 3 <= e) { |
| 3821 | const char *r; |
| 3822 | unsigned int c = grn_htouicxx . . $ grn_htoui(2da3fe788a18ce64).(p + 1, p + 3, &r); |
| 3823 | if (p + 3 == r) { |
| 3824 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, buf, (char)c); |
| 3825 | p += 3; |
| 3826 | } else { |
| 3827 | GRN_LOGcxx . . $ `include/groonga/groonga.h:2493:9`!(ctx, GRN_LOG_NOTICE, "invalid %% sequence (%c%c)", p[1], p[2]); |
| 3828 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, buf, '%'); |
| 3829 | p += 1; |
| 3830 | } |
| 3831 | } else { |
| 3832 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, buf, *p); |
| 3833 | p++; |
| 3834 | } |
| 3835 | } |
| 3836 | return p; |
| 3837 | } |
| 3838 | |
| 3839 | void |
| 3840 | grn_str_url_path_normalizecxx . . $ grn_str_url_path_normalize(cc67929d906e7f3e).( |
| 3841 | grn_ctxcxx . . $ grn_ctx# *ctx, const char *path, size_t path_len, char *buf, size_t buf_len) |
| 3842 | { |
| 3843 | char *b = buf, *be = buf + buf_len - 1; |
| 3844 | const char *p = path, *pe = path + path_len, *pc; |
| 3845 | |
| 3846 | if (buf_len < 2) { |
| 3847 | return; |
| 3848 | } |
| 3849 | |
| 3850 | while (p < pe) { |
| 3851 | for (pc = p; pc < pe && *pc != '/'; pc++) { |
| 3852 | } |
| 3853 | if (*p == '.') { |
| 3854 | if (pc == p + 2 && *(p + 1) == '.') { |
| 3855 | /* '..' */ |
| 3856 | if (b - buf >= 2) { |
| 3857 | for (b -= 2; *b != '/' && b >= buf; b--) { |
| 3858 | } |
| 3859 | } |
| 3860 | if (*b == '/') { |
| 3861 | b++; |
| 3862 | ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT, "parent path doesn't exist."); |
| 3863 | } |
| 3864 | p = pc + 1; |
| 3865 | continue; |
| 3866 | } else if (pc == p + 1) { |
| 3867 | /* '.' */ |
| 3868 | p = pc + 1; |
| 3869 | continue; |
| 3870 | } |
| 3871 | } |
| 3872 | if (be - b >= pc - p) { |
| 3873 | grn_memcpycxx . . $ `include/groonga/portability.h:32:13`!(b, p, (size_t)(pc - p)); |
| 3874 | b += pc - p; |
| 3875 | p = pc; |
| 3876 | if (p < pe && *pc == '/' && be > b) { |
| 3877 | *b++ = '/'; |
| 3878 | p++; |
| 3879 | } |
| 3880 | } |
| 3881 | } |
| 3882 | *b = '\0'; |
| 3883 | } |
| 3884 | |
| 3885 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! |
| 3886 | grn_bulk_is_zerocxx . . $ grn_bulk_is_zero(a5760e5c319a06ee).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *obj) |
| 3887 | { |
| 3888 | const char *v = GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(obj); |
| 3889 | size_t s = GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(obj); |
| 3890 | for (; s; s--, v++) { |
| 3891 | if (*v) { |
| 3892 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 3893 | } |
| 3894 | } |
| 3895 | return truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 3896 | } |
| 3897 | |
| 3898 | char * |
| 3899 | grn_bulk_detachcxx . . $ grn_bulk_detach(f843dd299d9db84e).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *bulk) |
| 3900 | { |
| 3901 | if (GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(bulk) == 0) { |
| 3902 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 3903 | } |
| 3904 | |
| 3905 | char *data; |
| 3906 | if (GRN_BULK_OUTPcxx . . $ `include/groonga/groonga.h:2598:9`!(bulk)) { |
| 3907 | data = GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(bulk); |
| 3908 | bulk->headercxx . . $ _grn_obj#header..impl_flagscxx . . $ _grn_obj_header#impl_flags. &= (uint8_tcxx . . $ uint8_t#)(~GRN_OBJ_OUTPLACEcxx . . $ `include/groonga/groonga.h:936:9`!); |
| 3909 | } else { |
| 3910 | data = GRN_MALLOCcxx . . $ `lib/grn_alloc.h:41:9`!(GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(bulk)); |
| 3911 | if (!data) { |
| 3912 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 3913 | } |
| 3914 | memcpycxx . . $ memcpy(cc817cb175f282d).(data, GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(bulk), GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(bulk)); |
| 3915 | } |
| 3916 | GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(bulk); |
| 3917 | return data; |
| 3918 | } |