From 7d0644c62125f9e6906dc96ef88acdb8e8adaed2 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sat, 8 Feb 2025 16:09:32 -0600 Subject: [PATCH] Feature: Add f_void_call_t as a standard function callback. This is likely to be very common. Set this up to make the code cleaner when using this callback. There are no plans to implement any other types of callbacks as a standard. --- build/level_0/settings | 2 +- build/monolithic/settings | 2 +- build/stand_alone/byte_dump.config.h | 1 + build/stand_alone/example.config.h | 1 + build/stand_alone/fake.config.h | 1 + build/stand_alone/firewall.config.h | 1 + build/stand_alone/utf8.config.h | 1 + level_0/f_thread/c/thread.c | 4 ++-- level_0/f_thread/c/thread.h | 4 ++-- level_0/f_type/c/type/void.h | 32 ++++++++++++++++++++++++++++ 10 files changed, 43 insertions(+), 6 deletions(-) create mode 100644 level_0/f_type/c/type/void.h diff --git a/build/level_0/settings b/build/level_0/settings index ade4fd598..156a38266 100644 --- a/build/level_0/settings +++ b/build/level_0/settings @@ -122,7 +122,7 @@ build_sources_headers string/map_multi.h string/map_multis.h string/map_multiss. build_sources_headers string/static.h string/statics.h string/staticss.h build_sources_headers string/triple.h string/triples.h string/tripless.h build_sources_headers time.h time/common.h -build_sources_headers type.h type/cell.h type/file.h type/fll.h type/mode.h type/number.h type/pid.h type/quantity.h type/range.h type/range_double.h type/state.h type/status.h type/time.h +build_sources_headers type.h type/cell.h type/file.h type/fll.h type/mode.h type/number.h type/pid.h type/quantity.h type/range.h type/range_double.h type/state.h type/status.h type/time.h type/void.h build_sources_headers type_array.h type_array_file.h type_array/common.h type_array/cell.h type_array/file.h type_array/fll_id.h type_array/int8.h type_array/int16.h type_array/int32.h type_array/int64.h type_array/int128.h type_array/number_signed.h type_array/number_unsigned.h type_array/pid.h type_array/poll.h type_array/quantity.h type_array/quantitys.h type_array/quantityss.h type_array/range.h type_array/ranges.h type_array/rangess.h type_array/range_double.h type_array/range_doubles.h type_array/range_doubless.h type_array/state.h type_array/status.h type_array/uint8.h type_array/uint16.h type_array/uint32.h type_array/uint64.h type_array/uint128.h build_sources_headers utf.h utf/common.h utf/convert.h utf/dynamic.h utf/dynamics.h utf/dynamicss.h utf/is.h utf/is_character.h utf/map.h utf/maps.h utf/mapss.h utf/map_multi.h utf/map_multis.h utf/map_multiss.h utf/static.h utf/statics.h utf/staticss.h utf/string.h utf/triple.h utf/triples.h utf/tripless.h diff --git a/build/monolithic/settings b/build/monolithic/settings index 528f4408d..14379e291 100644 --- a/build/monolithic/settings +++ b/build/monolithic/settings @@ -143,7 +143,7 @@ build_sources_headers level_0/string/map_multi.h level_0/string/map_multis.h lev build_sources_headers level_0/string/static.h level_0/string/statics.h level_0/string/staticss.h build_sources_headers level_0/string/triple.h level_0/string/triples.h level_0/string/tripless.h build_sources_headers level_0/time.h level_0/time/common.h -build_sources_headers level_0/type.h level_0/type/cell.h level_0/type/file.h level_0/type/fll.h level_0/type/mode.h level_0/type/number.h level_0/type/pid.h level_0/type/quantity.h level_0/type/range.h level_0/type/range_double.h level_0/type/state.h level_0/type/status.h level_0/type/time.h +build_sources_headers level_0/type.h level_0/type/cell.h level_0/type/file.h level_0/type/fll.h level_0/type/mode.h level_0/type/number.h level_0/type/pid.h level_0/type/quantity.h level_0/type/range.h level_0/type/range_double.h level_0/type/state.h level_0/type/status.h level_0/type/time.h level_0/type/void.h build_sources_headers level_0/type_array.h level_0/type_array_file.h level_0/type_array/common.h level_0/type_array/cell.h level_0/type_array/file.h level_0/type_array/fll_id.h level_0/type_array/int8.h level_0/type_array/int16.h level_0/type_array/int32.h level_0/type_array/int64.h level_0/type_array/int128.h level_0/type_array/number_signed.h level_0/type_array/number_unsigned.h level_0/type_array/pid.h level_0/type_array/poll.h level_0/type_array/quantity.h level_0/type_array/quantitys.h level_0/type_array/quantityss.h level_0/type_array/range.h level_0/type_array/ranges.h level_0/type_array/rangess.h level_0/type_array/range_double.h level_0/type_array/range_doubles.h level_0/type_array/range_doubless.h level_0/type_array/state.h level_0/type_array/status.h level_0/type_array/uint8.h level_0/type_array/uint16.h level_0/type_array/uint32.h level_0/type_array/uint64.h level_0/type_array/uint128.h build_sources_headers level_0/utf.h level_0/utf/common.h level_0/utf/convert.h level_0/utf/dynamic.h level_0/utf/dynamics.h level_0/utf/dynamicss.h level_0/utf/is.h level_0/utf/is_character.h level_0/utf/map.h level_0/utf/maps.h level_0/utf/mapss.h level_0/utf/map_multi.h level_0/utf/map_multis.h level_0/utf/map_multiss.h level_0/utf/static.h level_0/utf/statics.h level_0/utf/staticss.h level_0/utf/string.h level_0/utf/triple.h level_0/utf/triples.h level_0/utf/tripless.h diff --git a/build/stand_alone/byte_dump.config.h b/build/stand_alone/byte_dump.config.h index a8afed659..eca41c0d7 100644 --- a/build/stand_alone/byte_dump.config.h +++ b/build/stand_alone/byte_dump.config.h @@ -1460,6 +1460,7 @@ #define _di_f_utf_unicode_string_to_ #define _di_f_utf_unicode_to_ #define _di_f_utf_width_e_ +#define _di_f_void_call_t_ //#define _di_fl_conversion_data_base_10_c_ #define _di_fl_conversion_data_base_12_c_ #define _di_fl_conversion_data_base_16_c_ diff --git a/build/stand_alone/example.config.h b/build/stand_alone/example.config.h index 89a196b6a..4b5a71e56 100644 --- a/build/stand_alone/example.config.h +++ b/build/stand_alone/example.config.h @@ -1425,6 +1425,7 @@ #define _di_f_utf_unicode_string_to_ #define _di_f_utf_unicode_to_ #define _di_f_utf_width_e_ +#define _di_f_void_call_t_ //#define _di_fl_print_debug_s_ //#define _di_fl_print_error_s_ //#define _di_fl_print_format_ diff --git a/build/stand_alone/fake.config.h b/build/stand_alone/fake.config.h index 09ee98022..d7cdced36 100644 --- a/build/stand_alone/fake.config.h +++ b/build/stand_alone/fake.config.h @@ -1892,6 +1892,7 @@ //#define _di_f_utf_unicode_string_to_ //#define _di_f_utf_unicode_to_ #define _di_f_utf_width_e_ +#define _di_f_void_call_t_ //#define _di_fl_control_group_apply_ //#define _di_fl_conversion_data_base_10_c_ #define _di_fl_conversion_data_base_12_c_ diff --git a/build/stand_alone/firewall.config.h b/build/stand_alone/firewall.config.h index efe20b77f..4920bf3f1 100644 --- a/build/stand_alone/firewall.config.h +++ b/build/stand_alone/firewall.config.h @@ -1955,6 +1955,7 @@ #define _di_f_utf_unicode_string_to_ #define _di_f_utf_unicode_to_ #define _di_f_utf_width_e_ +#define _di_f_void_call_t_ //#define _di_fl_control_group_apply_ #define _di_fl_conversion_data_base_10_c_ #define _di_fl_conversion_data_base_12_c_ diff --git a/build/stand_alone/utf8.config.h b/build/stand_alone/utf8.config.h index 3fe348704..7b9ffe559 100644 --- a/build/stand_alone/utf8.config.h +++ b/build/stand_alone/utf8.config.h @@ -1478,6 +1478,7 @@ //#define _di_f_utf_unicode_string_to_ //#define _di_f_utf_unicode_to_ #define _di_f_utf_width_e_ +#define _di_f_void_call_t_ //#define _di_fl_conversion_data_base_10_c_ #define _di_fl_conversion_data_base_12_c_ #define _di_fl_conversion_data_base_16_c_ diff --git a/level_0/f_thread/c/thread.c b/level_0/f_thread/c/thread.c index 2a9a6c261..e789c0244 100644 --- a/level_0/f_thread/c/thread.c +++ b/level_0/f_thread/c/thread.c @@ -5,7 +5,7 @@ extern "C" { #endif #ifndef _di_f_thread_at_fork_ - f_status_t f_thread_at_fork(void (*before) (void), void (*after_parent) (void), void (*after_child) (void)) { + f_status_t f_thread_at_fork(const f_void_call_t before, const f_void_call_t after_parent, const f_void_call_t after_child) { #ifndef _di_level_0_parameter_checking_ if (!before) return F_status_set_error(F_parameter); if (!after_parent) return F_status_set_error(F_parameter); @@ -1722,7 +1722,7 @@ extern "C" { #endif // _di_f_thread_mutex_unlock_ #ifndef _di_f_thread_once_ - f_status_t f_thread_once(void (*routine) (void), f_thread_once_t * const once) { + f_status_t f_thread_once(const f_void_call_t routine, f_thread_once_t * const once) { #ifndef _di_level_0_parameter_checking_ if (!routine) return F_status_set_error(F_parameter); if (!once) return F_status_set_error(F_parameter); diff --git a/level_0/f_thread/c/thread.h b/level_0/f_thread/c/thread.h index 9ccc0dc77..7f64a06d0 100644 --- a/level_0/f_thread/c/thread.h +++ b/level_0/f_thread/c/thread.h @@ -78,7 +78,7 @@ extern "C" { * @see pthread_atfork() */ #ifndef _di_f_thread_at_fork_ - extern f_status_t f_thread_at_fork(void (*before) (void), void (*after_parent) (void), void (*after_child) (void)); + extern f_status_t f_thread_at_fork(const f_void_call_t before, const f_void_call_t after_parent, const f_void_call_t after_child); #endif // _di_f_thread_at_fork_ /** @@ -2305,7 +2305,7 @@ extern "C" { * @see pthread_once() */ #ifndef _di_f_thread_once_ - extern f_status_t f_thread_once(void (*routine) (void), f_thread_once_t * const once); + extern f_status_t f_thread_once(const f_void_call_t routine, f_thread_once_t * const once); #endif // _di_f_thread_once_ /** diff --git a/level_0/f_type/c/type/void.h b/level_0/f_type/c/type/void.h new file mode 100644 index 000000000..bdbe5c9c4 --- /dev/null +++ b/level_0/f_type/c/type/void.h @@ -0,0 +1,32 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Defines pid type data. + * + * This is auto-included by type.h and should not need to be explicitly included. + */ +#ifndef _F_type_void_h +#define _F_type_void_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * A generic callback function that accepts no parameters and returns no parameters. + */ +#ifndef _di_f_void_call_t_ + typedef void (*f_void_call_t) (void); + + #define f_void_call_t_initialize 0 +#endif // _di_f_void_call_t_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _F_type_void_h -- 2.47.3