From 57aa67d435a11f3ffd0ac0d3472ca9288115a8d0 Mon Sep 17 00:00:00 2001 From: Mitya Selivanov Date: Mon, 27 Mar 2023 05:31:45 +0200 Subject: Header-only version; replace Python code with C code --- source/kit/CMakeLists.txt | 10 +++++----- source/kit/array_ref.h | 4 ++-- source/kit/file.h | 4 ++++ source/kit/string_ref.h | 4 ++++ source/kit_test/CMakeLists.txt | 6 +++--- source/test/unittests/CMakeLists.txt | 11 +++++------ 6 files changed, 23 insertions(+), 16 deletions(-) (limited to 'source') diff --git a/source/kit/CMakeLists.txt b/source/kit/CMakeLists.txt index a0206b3..2e89133 100644 --- a/source/kit/CMakeLists.txt +++ b/source/kit/CMakeLists.txt @@ -1,9 +1,5 @@ target_sources( kit - PRIVATE - input_buffer.c secure_random.c sha256.c thread.posix.c - atomic.win32.c condition_variable.c thread.win32.c input_stream.c file.c - allocator.c array_ref.c dynamic_array.c mutex.c mersenne_twister_64.c PUBLIC $ $ @@ -24,4 +20,8 @@ target_sources( $ $ $ - $) + $ + PRIVATE + input_buffer.c secure_random.c sha256.c thread.posix.c atomic.win32.c + condition_variable.c thread.win32.c input_stream.c file.c allocator.c + array_ref.c dynamic_array.c mutex.c mersenne_twister_64.c) diff --git a/source/kit/array_ref.h b/source/kit/array_ref.h index 029c20c..39f1e8b 100644 --- a/source/kit/array_ref.h +++ b/source/kit/array_ref.h @@ -24,13 +24,13 @@ int kit_ar_compare(ptrdiff_t left_element_size, ptrdiff_t left_size, struct { \ ptrdiff_t size; \ type_ *values; \ - } + } #define KIT_AR(type_) \ struct { \ ptrdiff_t size; \ type_ const *values; \ - } + } #define KIT_AR_MUT_WRAP(name_, element_type_, array_) \ struct { \ diff --git a/source/kit/file.h b/source/kit/file.h index b00ec4f..a773e02 100644 --- a/source/kit/file.h +++ b/source/kit/file.h @@ -88,6 +88,10 @@ void kit_path_list_destroy(kit_path_list_t list); # define path_list_t kit_path_list_t # define file_enum_folder kit_file_enum_folder # define path_list_destroy kit_path_list_destroy + +# define PATH_NONE KIT_PATH_NONE +# define PATH_FILE KIT_PATH_FILE +# define PATH_FOLDER KIT_PATH_FOLDER #endif #ifdef __cplusplus diff --git a/source/kit/string_ref.h b/source/kit/string_ref.h index 4b2cabd..1497bb0 100644 --- a/source/kit/string_ref.h +++ b/source/kit/string_ref.h @@ -35,6 +35,9 @@ static kit_str_t kit_str(ptrdiff_t const size, #define KIT_SZ(static_str_) \ kit_str(sizeof(static_str_) - 1, (static_str_)) +#define KIT_WRAP_STR(string_) \ + kit_str((string_).size, (string_).values) + #ifndef KIT_DISABLE_SHORT_NAMES # define string_mut_t kit_string_mut_t # define string_ref_t kit_string_ref_t @@ -42,6 +45,7 @@ static kit_str_t kit_str(ptrdiff_t const size, # define str_t kit_str_t # define SZ KIT_SZ +# define WRAP_STR KIT_WRAP_STR #endif #ifdef __cplusplus diff --git a/source/kit_test/CMakeLists.txt b/source/kit_test/CMakeLists.txt index 0e61fe3..56aa9a4 100644 --- a/source/kit_test/CMakeLists.txt +++ b/source/kit_test/CMakeLists.txt @@ -1,7 +1,7 @@ target_sources( kit_test - PRIVATE - test.c bench.c PUBLIC $ - $) + $ + PRIVATE + test.c bench.c) diff --git a/source/test/unittests/CMakeLists.txt b/source/test/unittests/CMakeLists.txt index b8a6dca..e071ed4 100644 --- a/source/test/unittests/CMakeLists.txt +++ b/source/test/unittests/CMakeLists.txt @@ -1,9 +1,8 @@ target_sources( kit_test_suite PRIVATE - async_function.test.c bigint.test.c mutex.test.c - test_duration.test.c main.test.c string_ref.test.c atomic.test.c foo.bench.c - thread.test.c array_ref.test.c input_stream.test.c sha256.test.c - lower_bound.test.c secure_random.test.c condition_variable.test.c - mersenne_twister_64.test.c input_buffer.test.c move_back.test.c dynamic_array.test.c - file.test.c) + async_function.test.c bigint.test.c mutex.test.c test_duration.test.c + main.test.c string_ref.test.c atomic.test.c foo.bench.c thread.test.c + array_ref.test.c input_stream.test.c sha256.test.c lower_bound.test.c + secure_random.test.c condition_variable.test.c mersenne_twister_64.test.c + input_buffer.test.c move_back.test.c dynamic_array.test.c file.test.c) -- cgit v1.2.3