Go to the source code of this file.
Functions | |
| size_t | ck_tokenizer_utf8_normalize_nfc (const char *src, size_t src_len, char *dst, size_t dst_size) |
| size_t | ck_utf8_byte_to_offset (const char *str, size_t len, size_t byte_offset) |
| int | ck_utf8_char_length (unsigned char c) |
| size_t | ck_utf8_count_chars (const char *str, size_t len) |
| int | ck_utf8_from_cp (uint32_t cp, char *out) |
| bool | ck_utf8_is_valid (const char *str, size_t len) |
| bool | ck_utf8_is_whitespace (uint32_t cp) |
| int32_t | ck_utf8_next_char (const char **str, int *out_len) |
| size_t | ck_utf8_offset_to_byte (const char *str, size_t len, size_t n) |
| size_t | ck_utf8_validate (const char *str, size_t len) |
Variables | ||
| struct { | ||
| uint32_t end | ||
| uint32_t start | ||
| } | CK_UTF8_WHITESPACE_RANGES [] | |
| size_t ck_tokenizer_utf8_normalize_nfc | ( | const char * | src, |
| size_t | src_len, | ||
| char * | dst, | ||
| size_t | dst_size | ||
| ) |
Definition at line 240 of file utf8.c.
| size_t ck_utf8_byte_to_offset | ( | const char * | str, |
| size_t | len, | ||
| size_t | byte_offset | ||
| ) |
Get the character index from byte offset.
| str | String |
| len | String length in bytes |
| byte_offset | Byte offset |
Definition at line 187 of file utf8.c.
References ck_utf8_char_length(), and ck_utf8_count_chars().
| int ck_utf8_char_length | ( | unsigned char | c | ) |
Get the length of a UTF-8 character from its first byte.
| c | First byte of UTF-8 character |
Definition at line 12 of file utf8.c.
Referenced by ck_utf8_byte_to_offset(), ck_utf8_count_chars(), ck_utf8_next_char(), ck_utf8_offset_to_byte(), and ck_utf8_validate().
| size_t ck_utf8_count_chars | ( | const char * | str, |
| size_t | len | ||
| ) |
Count UTF-8 characters in a string.
| str | String to count |
| len | Length in bytes, or -1 for null-terminated |
Definition at line 82 of file utf8.c.
References ck_utf8_char_length().
Referenced by ck_utf8_byte_to_offset().
| int ck_utf8_from_cp | ( | uint32_t | cp, |
| char * | out | ||
| ) |
Write a Unicode code point as UTF-8.
| cp | Unicode code point |
| out | Output buffer (must have 4+ bytes) |
Definition at line 144 of file utf8.c.
| bool ck_utf8_is_valid | ( | const char * | str, |
| size_t | len | ||
| ) |
Check if a byte sequence is valid UTF-8.
| str | String to check |
| len | Length in bytes |
Definition at line 78 of file utf8.c.
References ck_utf8_validate().
| bool ck_utf8_is_whitespace | ( | uint32_t | cp | ) |
Check if character is whitespace (Unicode White_Space property).
| cp | Unicode code point |
Definition at line 229 of file utf8.c.
References CK_UTF8_WHITESPACE_RANGES, end, and start.
| int32_t ck_utf8_next_char | ( | const char ** | str, |
| int * | out_len | ||
| ) |
Get next UTF-8 character, return its code point.
| str | String pointer (will be updated) |
| out_len | Output: length of character in bytes |
Definition at line 104 of file utf8.c.
References ck_utf8_char_length(), ck_utf8_decode_2(), ck_utf8_decode_3(), ck_utf8_decode_4(), and out_len.
| size_t ck_utf8_offset_to_byte | ( | const char * | str, |
| size_t | len, | ||
| size_t | n | ||
| ) |
Get the byte offset of the N-th character.
| str | String |
| len | String length in bytes |
| n | Character index (0-based) |
Definition at line 166 of file utf8.c.
References ck_utf8_char_length().
| size_t ck_utf8_validate | ( | const char * | str, |
| size_t | len | ||
| ) |
Validate a UTF-8 string.
| str | String to validate |
| len | Length in bytes, or -1 for null-terminated |
Definition at line 25 of file utf8.c.
References ck_utf8_char_length().
Referenced by ck_utf8_is_valid().
| const struct { ... } CK_UTF8_WHITESPACE_RANGES[] |
Referenced by ck_utf8_is_whitespace().
| uint32_t end |
Definition at line 215 of file utf8.c.
Referenced by ck_accum_multi_parallel_work(), ck_accum_parallel_work(), ck_adamw_parallel_work(), ck_attention_f16_split_work(), ck_attention_oracle_exact_dump_layer(), ck_attention_vec_dump_parse_env_int(), ck_audio_conv2d_whc_grouped_f32_range(), ck_audio_glu_split_f32_range(), ck_audio_relative_shift_f32_range(), ck_bf16_convert_work(), ck_bf16_round_work(), ck_env_int_default(), ck_gemm_nt_bf16_exact_rows(), ck_gemm_nt_bf16_storage_exact_rows(), ck_gemm_nt_fp32_exact_rows(), ck_gemma4_embed_range(), ck_gemma4_prepare_bf16_range(), ck_gemma4_prepare_q5_range(), ck_gemv_bf16_rows(), ck_gemv_bf16_storage_rows(), ck_ir_v2_apply_meta(), ck_ir_v2_apply_weight_dtypes(), ck_ir_v2_find_array_end(), ck_ir_v2_find_key(), ck_ir_v2_find_key(), ck_ir_v2_next_object(), ck_ir_v2_parse_bool(), ck_ir_v2_parse_bool(), ck_ir_v2_parse_buffers(), ck_ir_v2_parse_float(), ck_ir_v2_parse_int(), ck_ir_v2_parse_json(), ck_ir_v2_parse_nodes(), ck_ir_v2_parse_string(), ck_ir_v2_parse_string(), ck_ir_v2_parse_string_field(), ck_ir_v2_skip_string(), ck_ir_v2_skip_ws(), ck_moe_q4k_mixed_parallel_work(), ck_moe_q4k_q5k_parallel_work(), ck_moe_q4k_q5k_quantize_work(), ck_moe_shared_q4k_parallel_work(), ck_moe_shared_q8_0_parallel_work(), ck_nvfp4_gemv_rows(), ck_parallel_for_worker(), ck_parse_env_int(), ck_patch_projection_bf16_native_work(), ck_scale_parallel_work(), ck_ssm_conv1d_llama_channel_range(), ck_ssm_conv1d_llama_fma_channel_range(), ck_sum_sq_parallel_work(), ck_threadpool_parallel_for_n(), ck_utf8_is_whitespace(), ds_mla_kv_decompress_bf16_rows(), gemm_q4_packed_vnni_x8_q8k_4m_range_fn(), load_manifest(), load_manifest(), load_manifest(), mamba2_rmsnorm_gate_f32(), parse_eos_ids(), parse_eos_ids(), parse_float_field_in_range(), parse_float_field_in_range(), parse_float_field_in_range(), parse_float_field_in_range(), parse_int_field_in_range(), parse_int_field_in_range(), parse_int_field_in_range(), parse_int_field_in_range(), run_benchmark(), run_benchmark(), topology_discover_numa(), topology_measure_memory_bandwidth_ex(), trim_string(), and vision_mrope_yarn_corr_dims().
| uint32_t start |
Definition at line 214 of file utf8.c.
Referenced by bump_bytes(), ck_accum_multi_parallel_work(), ck_accum_parallel_work(), ck_adamw_parallel_work(), ck_ir_v2_apply_weight_dtypes(), ck_ir_v2_next_object(), ck_ir_v2_parse_bindings(), ck_ir_v2_parse_buffers(), ck_ir_v2_parse_nodes(), ck_ir_v2_parse_shape(), ck_ir_v2_parse_string(), ck_ir_v2_parse_string(), ck_scale_parallel_work(), ck_sum_sq_parallel_work(), ck_utf8_is_whitespace(), encode_text_segment(), find_object_range(), find_object_range(), find_object_range(), find_object_range(), group_limited_topk_router_f32_impl(), load_manifest(), load_manifest(), load_manifest(), mamba2_rmsnorm_gate_f32(), run_benchmark(), run_benchmark(), sample_token(), sample_token(), sample_token(), sample_topk(), sample_topk(), sample_topk(), topology_discover_numa(), topology_measure_memory_bandwidth_ex(), trim_string(), and vision_mrope_yarn_corr_dims().