summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorMitya Selivanov <automainint@guattari.tech>2023-03-27 05:31:45 +0200
committerMitya Selivanov <automainint@guattari.tech>2023-03-27 05:31:45 +0200
commit57aa67d435a11f3ffd0ac0d3472ca9288115a8d0 (patch)
treef305a14462579f336de2264eb8a35ae261ea59cc /source
parentb17726fe51a1c7c1eccaef2e90cbab7ee022557f (diff)
downloadkit-57aa67d435a11f3ffd0ac0d3472ca9288115a8d0.zip
Header-only version; replace Python code with C code
Diffstat (limited to 'source')
-rw-r--r--source/kit/CMakeLists.txt10
-rw-r--r--source/kit/array_ref.h4
-rw-r--r--source/kit/file.h4
-rw-r--r--source/kit/string_ref.h4
-rw-r--r--source/kit_test/CMakeLists.txt6
-rw-r--r--source/test/unittests/CMakeLists.txt11
6 files changed, 23 insertions, 16 deletions
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
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/mutex.h>
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/status.h>
@@ -24,4 +20,8 @@ target_sources(
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/sha256.h>
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/file.h>
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/array_ref.h>
- $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/mersenne_twister_64.h>)
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/mersenne_twister_64.h>
+ 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
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/bench.h>
- $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/test.h>)
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/test.h>
+ 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)