From 23e63540f2d3ff6da230d1a29aecf33b49d2874d Mon Sep 17 00:00:00 2001 From: Mitya Selivanov Date: Fri, 16 Feb 2024 02:37:41 +0100 Subject: Update kit --- source/kit/LICENSE | 30 +++++++++++++++++ source/kit/array_ref.h | 17 ++++------ source/kit/async_function.h | 61 +++++++++++++++++----------------- source/kit/atomic.h | 4 +-- source/kit/bigint.h | 50 ++++++++++++++-------------- source/kit/dynamic_array.h | 27 +++++++--------- source/kit/file.h | 70 ++++++++++++++++++---------------------- source/kit/input_buffer.h | 30 ++++++++--------- source/kit/input_stream.h | 19 +++++------ source/kit/lower_bound.h | 8 ++--- source/kit/mersenne_twister_64.h | 12 +++---- source/kit/move_back.h | 8 ++--- source/kit/parse.h | 3 -- source/kit/print.h | 24 +++++++------- source/kit/process.h | 3 -- source/kit/secure_random.h | 4 +-- source/kit/sha256.h | 8 ++--- source/kit/shared_memory.h | 15 ++++----- source/kit/shared_mutex.h | 35 +++++++++----------- source/kit/string_builder.h | 14 ++++---- source/kit/string_ref.h | 26 +++++++-------- source/kit/test.h | 32 +++++++++--------- source/kit/types.h | 4 +-- source/kit/utf8.h | 3 -- source/kit/xml.h | 22 ++++++------- 25 files changed, 249 insertions(+), 280 deletions(-) create mode 100644 source/kit/LICENSE (limited to 'source') diff --git a/source/kit/LICENSE b/source/kit/LICENSE new file mode 100644 index 0000000..8ac4c29 --- /dev/null +++ b/source/kit/LICENSE @@ -0,0 +1,30 @@ +Copyright (c) 2022-2024 Mitya Selivanov + +HTTP1 +Copyright (c) 2016 Christian C. Sachs + +miniz +Copyright (c) 2013-2014 RAD Game Tools and Valve Software +Copyright (c) 2010-2014 Rich Geldreich and Tenacious Software LLC + +C11 threads from Mesa +Copyright (c) 2022 Yonggang Luo +Copyright (c) 2012 yohhoy + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/source/kit/array_ref.h b/source/kit/array_ref.h index 3ca6918..3a7244e 100644 --- a/source/kit/array_ref.h +++ b/source/kit/array_ref.h @@ -46,15 +46,12 @@ i8 kit_ar_compare(i64 left_element_size, i64 left_size, } #endif -#ifndef KIT_DISABLE_SHORT_NAMES -# define ar_compare_fn kit_ar_compare_fn -# define ar_equal_bytes kit_ar_equal_bytes -# define ar_compare kit_ar_compare - -# define AR KIT_AR -# define AR_WRAP KIT_AR_WRAP -# define AR_EQUAL KIT_AR_EQUAL -# define AR_COMPARE KIT_AR_COMPARE -#endif +#define ar_compare_fn kit_ar_compare_fn +#define ar_equal_bytes kit_ar_equal_bytes +#define ar_compare kit_ar_compare +#define AR KIT_AR +#define AR_WRAP KIT_AR_WRAP +#define AR_EQUAL KIT_AR_EQUAL +#define AR_COMPARE KIT_AR_COMPARE #endif diff --git a/source/kit/async_function.h b/source/kit/async_function.h index e94fc31..70a81cd 100644 --- a/source/kit/async_function.h +++ b/source/kit/async_function.h @@ -200,37 +200,34 @@ static void kit_async_function_dispatch(void *promise) { } #endif -#ifndef KIT_DISABLE_SHORT_NAMES -# define af_void kit_af_void -# define af_state_machine kit_af_state_machine -# define af_type_void kit_af_type_void - -# define AF_STATE_DATA KIT_AF_STATE_DATA -# define AF_STATE KIT_AF_STATE -# define AF_DECL KIT_AF_DECL -# define CORO_IMPL KIT_CORO_IMPL -# define CORO_END KIT_CORO_END -# define CORO_DECL KIT_CORO_DECL -# define CORO KIT_CORO -# define CORO_DECL_VOID KIT_CORO_DECL_VOID -# define STATIC_CORO KIT_STATIC_CORO -# define STATIC_CORO_VOID KIT_STATIC_CORO_VOID -# define CORO_VOID KIT_CORO_VOID -# define AF_EXECUTE KIT_AF_EXECUTE -# define AF_NEXT KIT_AF_NEXT -# define AF_YIELD KIT_AF_YIELD -# define AF_YIELD_VOID KIT_AF_YIELD_VOID -# define AF_RETURN KIT_AF_RETURN -# define AF_RETURN_VOID KIT_AF_RETURN_VOID -# define AF_AWAIT KIT_AF_AWAIT -# define AF_YIELD_AWAIT KIT_AF_YIELD_AWAIT -# define AF_TYPE KIT_AF_TYPE -# define AF_INITIAL KIT_AF_INITIAL -# define AF_CREATE KIT_AF_CREATE -# define AF_INIT KIT_AF_INIT -# define AF_FINISHED KIT_AF_FINISHED -# define AF_FINISHED_N KIT_AF_FINISHED_N -# define AF_FINISHED_ALL KIT_AF_FINISHED_ALL -#endif +#define af_void kit_af_void +#define af_state_machine kit_af_state_machine +#define af_type_void kit_af_type_void +#define AF_STATE_DATA KIT_AF_STATE_DATA +#define AF_STATE KIT_AF_STATE +#define AF_DECL KIT_AF_DECL +#define CORO_IMPL KIT_CORO_IMPL +#define CORO_END KIT_CORO_END +#define CORO_DECL KIT_CORO_DECL +#define CORO KIT_CORO +#define CORO_DECL_VOID KIT_CORO_DECL_VOID +#define STATIC_CORO KIT_STATIC_CORO +#define STATIC_CORO_VOID KIT_STATIC_CORO_VOID +#define CORO_VOID KIT_CORO_VOID +#define AF_EXECUTE KIT_AF_EXECUTE +#define AF_NEXT KIT_AF_NEXT +#define AF_YIELD KIT_AF_YIELD +#define AF_YIELD_VOID KIT_AF_YIELD_VOID +#define AF_RETURN KIT_AF_RETURN +#define AF_RETURN_VOID KIT_AF_RETURN_VOID +#define AF_AWAIT KIT_AF_AWAIT +#define AF_YIELD_AWAIT KIT_AF_YIELD_AWAIT +#define AF_TYPE KIT_AF_TYPE +#define AF_INITIAL KIT_AF_INITIAL +#define AF_CREATE KIT_AF_CREATE +#define AF_INIT KIT_AF_INIT +#define AF_FINISHED KIT_AF_FINISHED +#define AF_FINISHED_N KIT_AF_FINISHED_N +#define AF_FINISHED_ALL KIT_AF_FINISHED_ALL #endif diff --git a/source/kit/atomic.h b/source/kit/atomic.h index a91cb4c..8ec7bad 100644 --- a/source/kit/atomic.h +++ b/source/kit/atomic.h @@ -214,8 +214,6 @@ u64 kit_atomic_fetch_add_explicit_64(u64 volatile *var, u64 value, # endif #endif -#ifndef KIT_DISABLE_SHORT_NAMES -# define ATOMIC KIT_ATOMIC -#endif +#define ATOMIC KIT_ATOMIC #endif diff --git a/source/kit/bigint.h b/source/kit/bigint.h index 28addb0..159996a 100644 --- a/source/kit/bigint.h +++ b/source/kit/bigint.h @@ -575,31 +575,29 @@ static kit_bigint_t kit_bi_from_base58(kit_str_t base58) { } #endif -#ifndef KIT_DISABLE_SHORT_NAMES -# define bigint_t kit_bigint_t -# define bi_u32 kit_bi_u32 -# define bi_u64 kit_bi_u64 -# define bi_i32 kit_bi_i32 -# define bi_i64 kit_bi_i64 -# define bi_is_zero kit_bi_is_zero -# define bi_is_neg kit_bi_is_neg -# define bi_equal kit_bi_equal -# define bi_compare kit_bi_compare -# define bi_carry kit_bi_carry -# define bi_inc kit_bi_inc -# define bi_dec kit_bi_dec -# define bi_add kit_bi_add -# define bi_neg kit_bi_neg -# define bi_sub kit_bi_sub -# define bi_mul kit_bi_mul -# define bi_div kit_bi_div -# define bi_serialize kit_bi_serialize -# define bi_deserialize kit_bi_deserialize -# define BIN KIT_BIN -# define DEC KIT_DEC -# define HEX KIT_HEX -# define BASE32 KIT_BASE32 -# define BASE58 KIT_BASE58 -#endif +#define bigint_t kit_bigint_t +#define bi_u32 kit_bi_u32 +#define bi_u64 kit_bi_u64 +#define bi_i32 kit_bi_i32 +#define bi_i64 kit_bi_i64 +#define bi_is_zero kit_bi_is_zero +#define bi_is_neg kit_bi_is_neg +#define bi_equal kit_bi_equal +#define bi_compare kit_bi_compare +#define bi_carry kit_bi_carry +#define bi_inc kit_bi_inc +#define bi_dec kit_bi_dec +#define bi_add kit_bi_add +#define bi_neg kit_bi_neg +#define bi_sub kit_bi_sub +#define bi_mul kit_bi_mul +#define bi_div kit_bi_div +#define bi_serialize kit_bi_serialize +#define bi_deserialize kit_bi_deserialize +#define BIN KIT_BIN +#define DEC KIT_DEC +#define HEX KIT_HEX +#define BASE32 KIT_BASE32 +#define BASE58 KIT_BASE58 #endif diff --git a/source/kit/dynamic_array.h b/source/kit/dynamic_array.h index e868917..571f344 100644 --- a/source/kit/dynamic_array.h +++ b/source/kit/dynamic_array.h @@ -110,20 +110,17 @@ void kit_da_resize_exact(kit_da_void_t *array, i64 element_size, } #endif -#ifndef KIT_DISABLE_SHORT_NAMES -# define da_void_t kit_da_void_t -# define da_init kit_da_init -# define da_resize kit_da_resize - -# define DA KIT_DA -# define DA_INIT KIT_DA_INIT -# define DA_CREATE KIT_DA_CREATE -# define DA_DESTROY KIT_DA_DESTROY -# define DA_RESIZE KIT_DA_RESIZE -# define DA_RESIZE_EXACT KIT_DA_RESIZE_EXACT -# define DA_APPEND KIT_DA_APPEND -# define DA_INSERT KIT_DA_INSERT -# define DA_ERASE KIT_DA_ERASE -#endif +#define da_void_t kit_da_void_t +#define da_init kit_da_init +#define da_resize kit_da_resize +#define DA KIT_DA +#define DA_INIT KIT_DA_INIT +#define DA_CREATE KIT_DA_CREATE +#define DA_DESTROY KIT_DA_DESTROY +#define DA_RESIZE KIT_DA_RESIZE +#define DA_RESIZE_EXACT KIT_DA_RESIZE_EXACT +#define DA_APPEND KIT_DA_APPEND +#define DA_INSERT KIT_DA_INSERT +#define DA_ERASE KIT_DA_ERASE #endif diff --git a/source/kit/file.h b/source/kit/file.h index a02d135..12f00a2 100644 --- a/source/kit/file.h +++ b/source/kit/file.h @@ -98,43 +98,37 @@ s32 kit_file_unmap(kit_mapped_file_t *mf); } #endif -#ifndef KIT_DISABLE_SHORT_NAMES -# define path_type_t kit_path_type_t -# define file_info_t kit_file_info_t -# define path_list_t kit_path_list_t -# define mapped_file_t kit_mapped_file_t - -# define get_env kit_get_env -# define path_norm kit_path_norm -# define path_join kit_path_join -# define path_user kit_path_user -# define path_cache kit_path_cache -# define path_data kit_path_data -# define path_index kit_path_index -# define path_take kit_path_take -# define folder_create kit_folder_create -# define folder_create_recursive kit_folder_create_recursive -# define file_remove kit_file_remove -# define folder_remove kit_folder_remove -# define file_remove_recursive kit_file_remove_recursive -# define path_type kit_path_type -# define file_info kit_file_info -# define folder_enum kit_folder_enum -# define path_list_destroy kit_path_list_destroy -# define file_map kit_file_map -# define file_sync kit_file_sync -# define file_unmap kit_file_unmap - -# define FILE_MAP_PRIVATE KIT_FILE_MAP_PRIVATE -# define FILE_MAP_SHARED KIT_FILE_MAP_SHARED - -# define PATH_DELIM_C KIT_PATH_DELIM_C -# define PATH_DELIM KIT_PATH_DELIM -# define ENV_HOME KIT_ENV_HOME - -# define PATH_NONE KIT_PATH_NONE -# define PATH_FILE KIT_PATH_FILE -# define PATH_FOLDER KIT_PATH_FOLDER -#endif +#define path_type_t kit_path_type_t +#define file_info_t kit_file_info_t +#define path_list_t kit_path_list_t +#define mapped_file_t kit_mapped_file_t +#define get_env kit_get_env +#define path_norm kit_path_norm +#define path_join kit_path_join +#define path_user kit_path_user +#define path_cache kit_path_cache +#define path_data kit_path_data +#define path_index kit_path_index +#define path_take kit_path_take +#define folder_create kit_folder_create +#define folder_create_recursive kit_folder_create_recursive +#define file_remove kit_file_remove +#define folder_remove kit_folder_remove +#define file_remove_recursive kit_file_remove_recursive +#define path_type kit_path_type +#define file_info kit_file_info +#define folder_enum kit_folder_enum +#define path_list_destroy kit_path_list_destroy +#define file_map kit_file_map +#define file_sync kit_file_sync +#define file_unmap kit_file_unmap +#define FILE_MAP_PRIVATE KIT_FILE_MAP_PRIVATE +#define FILE_MAP_SHARED KIT_FILE_MAP_SHARED +#define PATH_DELIM_C KIT_PATH_DELIM_C +#define PATH_DELIM KIT_PATH_DELIM +#define ENV_HOME KIT_ENV_HOME +#define PATH_NONE KIT_PATH_NONE +#define PATH_FILE KIT_PATH_FILE +#define PATH_FOLDER KIT_PATH_FOLDER #endif diff --git a/source/kit/input_buffer.h b/source/kit/input_buffer.h index 0114e3c..4320ee7 100644 --- a/source/kit/input_buffer.h +++ b/source/kit/input_buffer.h @@ -55,21 +55,19 @@ kit_ib_token_t kit_ib_while(kit_ib_token_t buf, } #endif -#ifndef KIT_DISABLE_SHORT_NAMES -# define input_buffer_t kit_input_buffer_t -# define ib_token_t kit_ib_token_t -# define ib_read_condition_fn kit_ib_read_condition_fn -# define ib_wrap kit_ib_wrap -# define ib_destroy kit_ib_destroy -# define ib_token kit_ib_token -# define ib_str kit_ib_str -# define ib_read kit_ib_read -# define ib_any kit_ib_any -# define ib_none kit_ib_none -# define ib_exact kit_ib_exact -# define ib_until kit_ib_until -# define ib_while kit_ib_while -# define IB_SKIP KIT_IB_SKIP -#endif +#define input_buffer_t kit_input_buffer_t +#define ib_token_t kit_ib_token_t +#define ib_read_condition_fn kit_ib_read_condition_fn +#define ib_wrap kit_ib_wrap +#define ib_destroy kit_ib_destroy +#define ib_token kit_ib_token +#define ib_str kit_ib_str +#define ib_read kit_ib_read +#define ib_any kit_ib_any +#define ib_none kit_ib_none +#define ib_exact kit_ib_exact +#define ib_until kit_ib_until +#define ib_while kit_ib_while +#define IB_SKIP KIT_IB_SKIP #endif diff --git a/source/kit/input_stream.h b/source/kit/input_stream.h index c60c9e3..51a7520 100644 --- a/source/kit/input_stream.h +++ b/source/kit/input_stream.h @@ -35,16 +35,13 @@ void kit_is_destroy(kit_is_handle_t in); } #endif -#ifndef KIT_DISABLE_SHORT_NAMES -# define is_read_fn kit_is_read_fn -# define is_handle_t kit_is_handle_t -# define is_wrap_string kit_is_wrap_string -# define is_wrap_file kit_is_wrap_file -# define is_destroy kit_is_destroy - -# define IS_WRAP_STRING KIT_IS_WRAP_STRING -# define IS_WRAP_FILE KIT_IS_WRAP_FILE -# define IS_READ KIT_IS_READ -#endif +#define is_read_fn kit_is_read_fn +#define is_handle_t kit_is_handle_t +#define is_wrap_string kit_is_wrap_string +#define is_wrap_file kit_is_wrap_file +#define is_destroy kit_is_destroy +#define IS_WRAP_STRING KIT_IS_WRAP_STRING +#define IS_WRAP_FILE KIT_IS_WRAP_FILE +#define IS_READ KIT_IS_READ #endif diff --git a/source/kit/lower_bound.h b/source/kit/lower_bound.h index 2ee04b9..eb437ed 100644 --- a/source/kit/lower_bound.h +++ b/source/kit/lower_bound.h @@ -35,10 +35,8 @@ extern "C" { } #endif -#ifndef KIT_DISABLE_SHORT_NAMES -# define LOWER_BOUND_INL KIT_LOWER_BOUND_INL -# define LOWER_BOUND KIT_LOWER_BOUND -# define LOWER_BOUND_REF KIT_LOWER_BOUND_REF -#endif +#define LOWER_BOUND_INL KIT_LOWER_BOUND_INL +#define LOWER_BOUND KIT_LOWER_BOUND +#define LOWER_BOUND_REF KIT_LOWER_BOUND_REF #endif diff --git a/source/kit/mersenne_twister_64.h b/source/kit/mersenne_twister_64.h index ab496a9..2709dd7 100644 --- a/source/kit/mersenne_twister_64.h +++ b/source/kit/mersenne_twister_64.h @@ -26,12 +26,10 @@ u64 kit_mt64_generate(kit_mt64_state_t *state); } #endif -#ifndef KIT_DISABLE_SHORT_NAMES -# define mt64_state_t kit_mt64_state_t -# define mt64_init_array kit_mt64_init_array -# define mt64_init kit_mt64_init -# define mt64_rotate kit_mt64_rotate -# define mt64_generate kit_mt64_generate -#endif +#define mt64_state_t kit_mt64_state_t +#define mt64_init_array kit_mt64_init_array +#define mt64_init kit_mt64_init +#define mt64_rotate kit_mt64_rotate +#define mt64_generate kit_mt64_generate #endif diff --git a/source/kit/move_back.h b/source/kit/move_back.h index b6eb979..1885f5d 100644 --- a/source/kit/move_back.h +++ b/source/kit/move_back.h @@ -42,10 +42,8 @@ extern "C" { } #endif -#ifndef KIT_DISABLE_SHORT_NAMES -# define MOVE_BACK_INL KIT_MOVE_BACK_INL -# define MOVE_BACK KIT_MOVE_BACK -# define MOVE_BACK_REF KIT_MOVE_BACK_REF -#endif +#define MOVE_BACK_INL KIT_MOVE_BACK_INL +#define MOVE_BACK KIT_MOVE_BACK +#define MOVE_BACK_REF KIT_MOVE_BACK_REF #endif diff --git a/source/kit/parse.h b/source/kit/parse.h index e07559a..efb8156 100644 --- a/source/kit/parse.h +++ b/source/kit/parse.h @@ -11,7 +11,4 @@ extern "C" { } #endif -#ifndef KIT_DISABLE_SHORT_NAMES -#endif - #endif diff --git a/source/kit/print.h b/source/kit/print.h index 799a011..5a64a20 100644 --- a/source/kit/print.h +++ b/source/kit/print.h @@ -32,18 +32,16 @@ s32 kit_print_esc(kit_str_builder_t *s, kit_str_t value, } #endif -#ifndef KIT_DISABLE_SHORT_NAMES -# define PRINT_ALIGN_RIGHT KIT_PRINT_ALIGN_RIGHT -# define PRINT_UNSIGNED KIT_PRINT_UNSIGNED -# define PRINT_BIN KIT_PRINT_BIN -# define PRINT_OCT KIT_PRINT_OCT -# define PRINT_DEC KIT_PRINT_DEC -# define PRINT_HEX KIT_PRINT_HEX -# define PRINT_PRECISE KIT_PRINT_PRECISE -# define PRINT_UTF8 KIT_PRINT_UTF8 -# define print_int kit_print_int -# define print_float kit_print_float -# define print_esckit_print_esc -#endif +#define PRINT_ALIGN_RIGHT KIT_PRINT_ALIGN_RIGHT +#define PRINT_UNSIGNED KIT_PRINT_UNSIGNED +#define PRINT_BIN KIT_PRINT_BIN +#define PRINT_OCT KIT_PRINT_OCT +#define PRINT_DEC KIT_PRINT_DEC +#define PRINT_HEX KIT_PRINT_HEX +#define PRINT_PRECISE KIT_PRINT_PRECISE +#define PRINT_UTF8 KIT_PRINT_UTF8 +#define print_int kit_print_int +#define print_float kit_print_float +#define print_esckit_print_esc #endif diff --git a/source/kit/process.h b/source/kit/process.h index 9ee7ccf..8031cc1 100644 --- a/source/kit/process.h +++ b/source/kit/process.h @@ -68,7 +68,4 @@ s32 kit_process_wait(kit_process_t *p); } #endif -#ifndef KIT_DISABLE_SHORT_NAMES -#endif - #endif diff --git a/source/kit/secure_random.h b/source/kit/secure_random.h index bfcbf98..d09ea56 100644 --- a/source/kit/secure_random.h +++ b/source/kit/secure_random.h @@ -13,8 +13,6 @@ s32 kit_secure_random(i64 size, void *data); } #endif -#ifndef KIT_DISABLE_SHORT_NAMES -# define secure_random kit_secure_random -#endif +#define secure_random kit_secure_random #endif diff --git a/source/kit/sha256.h b/source/kit/sha256.h index 92e9784..da05385 100644 --- a/source/kit/sha256.h +++ b/source/kit/sha256.h @@ -19,10 +19,8 @@ kit_sha256_hash_t kit_sha256(i64 size, u8 *data); } #endif -#ifndef KIT_DISABLE_SHORT_NAMES -# define SHA256_BLOCK_SIZE KIT_SHA256_BLOCK_SIZE -# define sha256_hash_t kit_sha256_hash_t -# define sha256 kit_sha256 -#endif +#define SHA256_BLOCK_SIZE KIT_SHA256_BLOCK_SIZE +#define sha256_hash_t kit_sha256_hash_t +#define sha256 kit_sha256 #endif diff --git a/source/kit/shared_memory.h b/source/kit/shared_memory.h index 0c0c1ce..a13ccee 100644 --- a/source/kit/shared_memory.h +++ b/source/kit/shared_memory.h @@ -38,14 +38,11 @@ s32 kit_shared_memory_clean(kit_str_t name); } #endif -#ifndef KIT_DISABLE_SHORT_NAMES -# define shared_memory_t kit_shared_memory_t -# define shared_memory_clean kit_shared_memory_clean -# define shared_memory_open kit_shared_memory_open -# define shared_memory_close kit_shared_memory_close - -# define SHARED_MEMORY_OPEN KIT_SHARED_MEMORY_OPEN -# define SHARED_MEMORY_CREATE KIT_SHARED_MEMORY_CREATE -#endif +#define shared_memory_t kit_shared_memory_t +#define shared_memory_clean kit_shared_memory_clean +#define shared_memory_open kit_shared_memory_open +#define shared_memory_close kit_shared_memory_close +#define SHARED_MEMORY_OPEN KIT_SHARED_MEMORY_OPEN +#define SHARED_MEMORY_CREATE KIT_SHARED_MEMORY_CREATE #endif diff --git a/source/kit/shared_mutex.h b/source/kit/shared_mutex.h index 3626939..d202090 100644 --- a/source/kit/shared_mutex.h +++ b/source/kit/shared_mutex.h @@ -153,29 +153,24 @@ static void kit_unique_unlock(kit_shared_mutex_t *m) { # pragma GCC diagnostic pop #endif -#ifndef KIT_DISABLE_SHORT_NAMES -# define shared_mutex_t kit_shared_mutex_t -# define shared_mutex_init kit_shared_mutex_init -# define shared_try_lock kit_shared_try_lock -# define shared_lock kit_shared_lock -# define shared_unlock kit_shared_unlock -# define unique_try_lock kit_unique_try_lock -# define unique_lock kit_unique_lock -# define unique_unlock kit_unique_unlock -#endif - #ifdef __cplusplus } #endif -#ifndef KIT_DISABLE_SHORT_NAMES -# define shared_mutex_init kit_shared_mutex_init -# define shared_try_lock kit_shared_try_lock -# define shared_lock kit_shared_lock -# define shared_unlock kit_shared_unlock -# define unique_try_lock kit_unique_try_lock -# define unique_lock kit_unique_lock -# define unique_unlock kit_unique_unlock -#endif +#define shared_mutex_t kit_shared_mutex_t +#define shared_mutex_init kit_shared_mutex_init +#define shared_try_lock kit_shared_try_lock +#define shared_lock kit_shared_lock +#define shared_unlock kit_shared_unlock +#define unique_try_lock kit_unique_try_lock +#define unique_lock kit_unique_lock +#define unique_unlock kit_unique_unlock +#define shared_mutex_init kit_shared_mutex_init +#define shared_try_lock kit_shared_try_lock +#define shared_lock kit_shared_lock +#define shared_unlock kit_shared_unlock +#define unique_try_lock kit_unique_try_lock +#define unique_lock kit_unique_lock +#define unique_unlock kit_unique_unlock #endif diff --git a/source/kit/string_builder.h b/source/kit/string_builder.h index 5cc12ee..c869afb 100644 --- a/source/kit/string_builder.h +++ b/source/kit/string_builder.h @@ -102,13 +102,11 @@ static s32 kit_str_erase(kit_str_builder_t *a, i64 index, i64 size) { } #endif -#ifndef KIT_DISABLE_SHORT_NAMES -# define str_builder_t kit_str_builder_t -# define str_build kit_str_build -# define substr_build kit_substr_build -# define str_append kit_str_append -# define str_insert kit_str_insert -# define str_erase kit_str_erase -#endif +#define str_builder_t kit_str_builder_t +#define str_build kit_str_build +#define substr_build kit_substr_build +#define str_append kit_str_append +#define str_insert kit_str_insert +#define str_erase kit_str_erase #endif diff --git a/source/kit/string_ref.h b/source/kit/string_ref.h index 8e76d06..e7ea809 100644 --- a/source/kit/string_ref.h +++ b/source/kit/string_ref.h @@ -118,22 +118,20 @@ static char *kit_make_bs(kit_str_t s) { #define KIT_WRAP_STR(...) \ kit_str((__VA_ARGS__).size, (__VA_ARGS__).values) -#ifndef KIT_DISABLE_SHORT_NAMES -# define BS(...) kit_make_bs(KIT_WRAP_STR(__VA_ARGS__)) -# define str_t kit_str_t -# define str kit_str -# define str_find kit_str_find -# define str_find_back kit_str_find_back -# define str_find_n kit_str_find_n -# define str_find_back_n kit_str_find_back_n -# define STR_NOT_FOUND KIT_STR_NOT_FOUND -# define SZ KIT_SZ -# define WRAP_BS KIT_WRAP_BS -# define WRAP_STR KIT_WRAP_STR -#endif - #ifdef __cplusplus } #endif +#define BS(...) kit_make_bs(KIT_WRAP_STR(__VA_ARGS__)) +#define str_t kit_str_t +#define str kit_str +#define str_find kit_str_find +#define str_find_back kit_str_find_back +#define str_find_n kit_str_find_n +#define str_find_back_n kit_str_find_back_n +#define STR_NOT_FOUND KIT_STR_NOT_FOUND +#define SZ KIT_SZ +#define WRAP_BS KIT_WRAP_BS +#define WRAP_STR KIT_WRAP_STR + #endif diff --git a/source/kit/test.h b/source/kit/test.h index b6be132..24a25c9 100644 --- a/source/kit/test.h +++ b/source/kit/test.h @@ -3,7 +3,7 @@ // test.h // https://guattari.tech/git/kit // -// Header-only unit-testing and microbenchmarks framework for C. +// Header-only unit-testing and microbenchmarks library for C. // // // - Define a unique KIT_TEST_FILE for each file to avoid name @@ -35,6 +35,7 @@ // } // // // main.c +// #define KIT_TEST_IMPLEMENTATION // #include "test.h" // int main(int argc, char **argv) { // return run_tests(argc, argv); @@ -44,7 +45,7 @@ // // The MIT License // -// Copyright (c) 2022-2023 Mitya Selivanov +// Copyright (c) 2022-2024 Mitya Selivanov // // Permission is hereby granted, free of charge, to any person // obtaining a copy of this software and associated documentation @@ -273,21 +274,18 @@ void kit_bench_register(char const *name, char const *file, int kit_run_benchmarks(int argc, char **argv); -#ifndef KIT_DISABLE_SHORT_NAMES -# define TEST KIT_TEST -# define REQUIRE KIT_REQUIRE -# define REQUIRE_EQ KIT_REQUIRE_EQ -# define BENCHMARK KIT_BENCHMARK -# define BENCHMARK_REPEAT KIT_BENCHMARK_REPEAT -# define BENCHMARK_BEGIN KIT_BENCHMARK_BEGIN -# define BENCHMARK_END KIT_BENCHMARK_END -# define DO_NOT_OPTIMIZE KIT_DO_NOT_OPTIMIZE - -# define test_register kit_test_register -# define run_tests kit_run_tests -# define bench_register kit_bench_register -# define run_benchmarks kit_run_benchmarks -#endif +#define TEST KIT_TEST +#define REQUIRE KIT_REQUIRE +#define REQUIRE_EQ KIT_REQUIRE_EQ +#define BENCHMARK KIT_BENCHMARK +#define BENCHMARK_REPEAT KIT_BENCHMARK_REPEAT +#define BENCHMARK_BEGIN KIT_BENCHMARK_BEGIN +#define BENCHMARK_END KIT_BENCHMARK_END +#define DO_NOT_OPTIMIZE KIT_DO_NOT_OPTIMIZE +#define test_register kit_test_register +#define run_tests kit_run_tests +#define bench_register kit_bench_register +#define run_benchmarks kit_run_benchmarks #ifdef __cplusplus } diff --git a/source/kit/types.h b/source/kit/types.h index cbb9a71..bbe8717 100644 --- a/source/kit/types.h +++ b/source/kit/types.h @@ -26,8 +26,8 @@ typedef double f64; // chars // -typedef signed char c8; -typedef signed int c32; +typedef char c8; +typedef int c32; typedef signed char b8; // 8-bit boolean typedef signed int b32; // 32-bit boolean diff --git a/source/kit/utf8.h b/source/kit/utf8.h index d053224..3dc6822 100644 --- a/source/kit/utf8.h +++ b/source/kit/utf8.h @@ -41,7 +41,4 @@ static s32 kit_utf8_encode(kit_str_builder_t *s, c32 value) { } #endif -#ifndef KIT_DISABLE_SHORT_NAMES -#endif - #endif diff --git a/source/kit/xml.h b/source/kit/xml.h index fdc9536..a4dd3d1 100644 --- a/source/kit/xml.h +++ b/source/kit/xml.h @@ -50,17 +50,15 @@ void kit_xml_destroy(kit_xml_t *xml); } #endif -#ifndef KIT_DISABLE_SHORT_NAMES -# define xml_t kit_xml_t -# define xml_property_t kit_xml_property_t -# define xml_parse_result_t kit_xml_parse_result_t -# define xml_text_t kit_xml_text_t -# define xml_parse kit_xml_parse -# define xml_print kit_xml_print -# define xml_full_text kit_xml_full_text -# define xml_has_property kit_xml_has_property -# define xml_property kit_xml_property -# define xml_destroy kit_xml_destroy -#endif +#define xml_t kit_xml_t +#define xml_property_t kit_xml_property_t +#define xml_parse_result_t kit_xml_parse_result_t +#define xml_text_t kit_xml_text_t +#define xml_parse kit_xml_parse +#define xml_print kit_xml_print +#define xml_full_text kit_xml_full_text +#define xml_has_property kit_xml_has_property +#define xml_property kit_xml_property +#define xml_destroy kit_xml_destroy #endif -- cgit v1.2.3