From 25da0c6f416d4e93b360b9a51f8650ef0696ccfb Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Tue, 25 Apr 2023 21:29:25 -0500 Subject: [PATCH] Bugfix: Fix problems exposed by unit tests. The f_pipe_debug and f_pipe_warning are no more and there is now an f_pipe_output. The f_print_to* functions should not use parameter checking and should instead eturn F_file_descriptor_not when the descriptor is -1. The F_help and F_help_not to string conversion is missing. --- build/stand_alone/byte_dump.config.h | 3 +- build/stand_alone/firewall.config.h | 3 +- build/stand_alone/utf8.config.h | 3 +- level_0/f_print/c/print/to.c | 192 ++++++++---------------------- level_0/f_print/c/print/to.h | 41 +++++++ level_0/f_status_string/c/status_string.c | 10 ++ 6 files changed, 104 insertions(+), 148 deletions(-) diff --git a/build/stand_alone/byte_dump.config.h b/build/stand_alone/byte_dump.config.h index 8d42fde..3091404 100644 --- a/build/stand_alone/byte_dump.config.h +++ b/build/stand_alone/byte_dump.config.h @@ -164,10 +164,9 @@ #define _di_f_memory_structure_increase_by_ #define _di_f_memory_structure_resize_ -#define _di_f_pipe_debug_exists_ #define _di_f_pipe_error_exists_ //#define _di_f_pipe_input_exists_ -#define _di_f_pipe_warning_exists_ +#define _di_f_pipe_output_exists_ //#define _di_f_print_ //#define _di_f_print_character_ diff --git a/build/stand_alone/firewall.config.h b/build/stand_alone/firewall.config.h index a85348a..58ee930 100644 --- a/build/stand_alone/firewall.config.h +++ b/build/stand_alone/firewall.config.h @@ -410,10 +410,9 @@ #define _di_f_path_tree_hierarchy_standard_d_ #define _di_f_path_tree_kevux_standard_d_ -#define _di_f_pipe_debug_exists_ #define _di_f_pipe_error_exists_ //#define _di_f_pipe_input_exists_ -#define _di_f_pipe_warning_exists_ +#define _di_f_pipe_output_exists_ //#define _di_f_print_ #define _di_f_print_character_ diff --git a/build/stand_alone/utf8.config.h b/build/stand_alone/utf8.config.h index a761b48..daf7af6 100644 --- a/build/stand_alone/utf8.config.h +++ b/build/stand_alone/utf8.config.h @@ -163,10 +163,9 @@ #define _di_f_memory_structure_increase_by_ #define _di_f_memory_structure_resize_ -#define _di_f_pipe_debug_exists_ #define _di_f_pipe_error_exists_ //#define _di_f_pipe_input_exists_ -#define _di_f_pipe_warning_exists_ +#define _di_f_pipe_output_exists_ //#define _di_f_print_ #define _di_f_print_character_ diff --git a/level_0/f_print/c/print/to.c b/level_0/f_print/c/print/to.c index 83c50e2..b242f55 100644 --- a/level_0/f_print/c/print/to.c +++ b/level_0/f_print/c/print/to.c @@ -34,10 +34,8 @@ static inline f_status_t private_inline_f_print_to_error(void) { #ifndef _di_f_print_to_ f_status_t f_print_to(const f_string_t string, const f_array_length_t length, const f_file_t file) { - #ifndef _di_level_0_parameter_checking_ - if (file.id == -1) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + if (file.id == -1) return F_file_descriptor_not; if (!length || !string) return F_data_not; return private_f_print_to(string, length, file.id); @@ -46,9 +44,8 @@ static inline f_status_t private_inline_f_print_to_error(void) { #ifndef _di_f_print_to_character_ f_status_t f_print_to_character(const f_char_t character, const f_file_t file) { - #ifndef _di_level_0_parameter_checking_ - if (file.id == -1) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + + if (file.id == -1) return F_file_descriptor_not; if (write(file.id, &character, 1) == -1) { return private_inline_f_print_to_error(); @@ -60,9 +57,8 @@ static inline f_status_t private_inline_f_print_to_error(void) { #ifndef _di_f_print_to_character_safely_ f_status_t f_print_to_character_safely(const f_char_t character, const f_file_t file) { - #ifndef _di_level_0_parameter_checking_ - if (file.id == -1) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + + if (file.id == -1) return F_file_descriptor_not; return private_f_print_to_character_safely(character, file.id); } @@ -70,10 +66,8 @@ static inline f_status_t private_inline_f_print_to_error(void) { #ifndef _di_f_print_to_dynamic_ f_status_t f_print_to_dynamic(const f_string_static_t buffer, const f_file_t file) { - #ifndef _di_level_0_parameter_checking_ - if (file.id == -1) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + if (file.id == -1) return F_file_descriptor_not; if (!buffer.used || !buffer.string) return F_data_not; return private_f_print_to(buffer.string, buffer.used, file.id); @@ -82,13 +76,9 @@ static inline f_status_t private_inline_f_print_to_error(void) { #ifndef _di_f_print_to_dynamic_partial_ f_status_t f_print_to_dynamic_partial(const f_string_static_t buffer, const f_string_range_t range, const f_file_t file) { - #ifndef _di_level_0_parameter_checking_ - if (file.id == -1) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - if (!buffer.used || range.start > range.stop || range.start >= buffer.used || !buffer.string) { - return F_data_not; - } + if (file.id == -1) return F_file_descriptor_not; + if (!buffer.used || range.start > range.stop || range.start >= buffer.used || !buffer.string) return F_data_not; f_array_length_t length = (range.stop - range.start) + 1; @@ -102,13 +92,9 @@ static inline f_status_t private_inline_f_print_to_error(void) { #ifndef _di_f_print_to_dynamic_partial_raw_ f_status_t f_print_to_dynamic_partial_raw(const f_string_static_t buffer, const f_string_range_t range, const f_file_t file) { - #ifndef _di_level_0_parameter_checking_ - if (file.id == -1) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - if (!buffer.used || range.start > range.stop || range.start >= buffer.used || !buffer.string) { - return F_data_not; - } + if (file.id == -1) return F_file_descriptor_not; + if (!buffer.used || range.start > range.stop || range.start >= buffer.used || !buffer.string) return F_data_not; f_array_length_t length = (range.stop - range.start) + 1; @@ -122,13 +108,9 @@ static inline f_status_t private_inline_f_print_to_error(void) { #ifndef _di_f_print_to_dynamic_partial_raw_safely_ f_status_t f_print_to_dynamic_partial_raw_safely(const f_string_static_t buffer, const f_string_range_t range, const f_file_t file) { - #ifndef _di_level_0_parameter_checking_ - if (file.id == -1) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - if (!buffer.used || range.start > range.stop || range.start >= buffer.used || !buffer.string) { - return F_data_not; - } + if (file.id == -1) return F_file_descriptor_not; + if (!buffer.used || range.start > range.stop || range.start >= buffer.used || !buffer.string) return F_data_not; f_array_length_t length = (range.stop - range.start) + 1; @@ -142,13 +124,9 @@ static inline f_status_t private_inline_f_print_to_error(void) { #ifndef _di_f_print_to_dynamic_partial_safely_ f_status_t f_print_to_dynamic_partial_safely(const f_string_static_t buffer, const f_string_range_t range, const f_file_t file) { - #ifndef _di_level_0_parameter_checking_ - if (file.id == -1) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - if (!buffer.used || range.start > range.stop || range.start >= buffer.used || !buffer.string) { - return F_data_not; - } + if (file.id == -1) return F_file_descriptor_not; + if (!buffer.used || range.start > range.stop || range.start >= buffer.used || !buffer.string) return F_data_not; f_array_length_t length = (range.stop - range.start) + 1; @@ -162,10 +140,8 @@ static inline f_status_t private_inline_f_print_to_error(void) { #ifndef _di_f_print_to_dynamic_raw_ f_status_t f_print_to_dynamic_raw(const f_string_static_t buffer, const f_file_t file) { - #ifndef _di_level_0_parameter_checking_ - if (file.id == -1) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + if (file.id == -1) return F_file_descriptor_not; if (!buffer.used || !buffer.string) return F_data_not; return private_f_print_to_raw(buffer.string, buffer.used, file.id); @@ -174,10 +150,8 @@ static inline f_status_t private_inline_f_print_to_error(void) { #ifndef _di_f_print_to_dynamic_raw_safely_ f_status_t f_print_to_dynamic_raw_safely(const f_string_static_t buffer, const f_file_t file) { - #ifndef _di_level_0_parameter_checking_ - if (file.id == -1) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + if (file.id == -1) return F_file_descriptor_not; if (!buffer.used || !buffer.string) return F_data_not; return private_f_print_to_raw_safely(buffer.string, buffer.used, file.id); @@ -186,10 +160,8 @@ static inline f_status_t private_inline_f_print_to_error(void) { #ifndef _di_f_print_to_dynamic_safely_ f_status_t f_print_to_dynamic_safely(const f_string_static_t buffer, const f_file_t file) { - #ifndef _di_level_0_parameter_checking_ - if (file.id == -1) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + if (file.id == -1) return F_file_descriptor_not; if (!buffer.used || !buffer.string) return F_data_not; return private_f_print_to_safely(buffer.string, buffer.used, file.id); @@ -198,10 +170,8 @@ static inline f_status_t private_inline_f_print_to_error(void) { #ifndef _di_f_print_to_except_ f_status_t f_print_to_except(const f_string_t string, const f_array_length_t offset, const f_array_length_t length, const f_array_lengths_t except, const f_file_t file) { - #ifndef _di_level_0_parameter_checking_ - if (file.id == -1) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + if (file.id == -1) return F_file_descriptor_not; if (!length || !string) return F_data_not; return private_f_print_to_except(string, offset, length, except, file.id); @@ -210,10 +180,8 @@ static inline f_status_t private_inline_f_print_to_error(void) { #ifndef _di_f_print_to_except_dynamic_ f_status_t f_print_to_except_dynamic(const f_string_static_t buffer, const f_array_lengths_t except, const f_file_t file) { - #ifndef _di_level_0_parameter_checking_ - if (file.id == -1) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + if (file.id == -1) return F_file_descriptor_not; if (!buffer.used || !buffer.string) return F_data_not; return private_f_print_to_except(buffer.string, 0, buffer.used, except, file.id); @@ -222,10 +190,8 @@ static inline f_status_t private_inline_f_print_to_error(void) { #ifndef _di_f_print_to_except_dynamic_partial_ f_status_t f_print_to_except_dynamic_partial(const f_string_static_t buffer, const f_string_range_t range, const f_array_lengths_t except, const f_file_t file) { - #ifndef _di_level_0_parameter_checking_ - if (file.id == -1) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + if (file.id == -1) return F_file_descriptor_not; if (!buffer.used || range.start > range.stop || range.start >= buffer.used || !buffer.string) { return F_data_not; } @@ -242,10 +208,8 @@ static inline f_status_t private_inline_f_print_to_error(void) { #ifndef _di_f_print_to_except_dynamic_partial_raw_ f_status_t f_print_to_except_dynamic_partial_raw(const f_string_static_t buffer, const f_string_range_t range, const f_array_lengths_t except, const f_file_t file) { - #ifndef _di_level_0_parameter_checking_ - if (file.id == -1) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + if (file.id == -1) return F_file_descriptor_not; if (!buffer.used || range.start > range.stop || range.start >= buffer.used || !buffer.string) { return F_data_not; } @@ -262,10 +226,8 @@ static inline f_status_t private_inline_f_print_to_error(void) { #ifndef _di_f_print_to_except_dynamic_partial_raw_safely_ f_status_t f_print_to_except_dynamic_partial_raw_safely(const f_string_static_t buffer, const f_string_range_t range, const f_array_lengths_t except, const f_file_t file) { - #ifndef _di_level_0_parameter_checking_ - if (file.id == -1) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + if (file.id == -1) return F_file_descriptor_not; if (!buffer.used || range.start > range.stop || range.start >= buffer.used || !buffer.string) { return F_data_not; } @@ -282,10 +244,8 @@ static inline f_status_t private_inline_f_print_to_error(void) { #ifndef _di_f_print_to_except_dynamic_partial_safely_ f_status_t f_print_to_except_dynamic_partial_safely(const f_string_static_t buffer, const f_string_range_t range, const f_array_lengths_t except, const f_file_t file) { - #ifndef _di_level_0_parameter_checking_ - if (file.id == -1) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + if (file.id == -1) return F_file_descriptor_not; if (!buffer.used || range.start > range.stop || range.start >= buffer.used || !buffer.string) { return F_data_not; } @@ -302,10 +262,8 @@ static inline f_status_t private_inline_f_print_to_error(void) { #ifndef _di_f_print_to_except_dynamic_raw_ f_status_t f_print_to_except_dynamic_raw(const f_string_static_t buffer, const f_array_lengths_t except, const f_file_t file) { - #ifndef _di_level_0_parameter_checking_ - if (file.id == -1) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + if (file.id == -1) return F_file_descriptor_not; if (!buffer.used || !buffer.string) return F_data_not; return private_f_print_to_except_raw(buffer.string, 0, buffer.used, except, file.id); @@ -314,10 +272,8 @@ static inline f_status_t private_inline_f_print_to_error(void) { #ifndef _di_f_print_to_except_dynamic_raw_safely_ f_status_t f_print_to_except_dynamic_raw_safely(const f_string_static_t buffer, const f_array_lengths_t except, const f_file_t file) { - #ifndef _di_level_0_parameter_checking_ - if (file.id == -1) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + if (file.id == -1) return F_file_descriptor_not; if (!buffer.used || !buffer.string) return F_data_not; return private_f_print_to_except_raw_safely(buffer.string, 0, buffer.used, except, file.id); @@ -326,10 +282,8 @@ static inline f_status_t private_inline_f_print_to_error(void) { #ifndef _di_f_print_to_except_dynamic_safely_ f_status_t f_print_to_except_dynamic_safely(const f_string_static_t buffer, const f_array_lengths_t except, const f_file_t file) { - #ifndef _di_level_0_parameter_checking_ - if (file.id == -1) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + if (file.id == -1) return F_file_descriptor_not; if (!buffer.used || !buffer.string) return F_data_not; return private_f_print_to_except_safely(buffer.string, 0, buffer.used, except, file.id); @@ -338,10 +292,8 @@ static inline f_status_t private_inline_f_print_to_error(void) { #ifndef _di_f_print_to_except_in_ f_status_t f_print_to_except_in(const f_string_t string, const f_array_length_t offset, const f_array_length_t length, const f_array_lengths_t except_at, const f_string_ranges_t except_in, const f_file_t file) { - #ifndef _di_level_0_parameter_checking_ - if (file.id == -1) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + if (file.id == -1) return F_file_descriptor_not; if (!length || !string) return F_data_not; return private_f_print_to_except_in(string, offset, length, except_at, except_in, file.id); @@ -350,10 +302,8 @@ static inline f_status_t private_inline_f_print_to_error(void) { #ifndef _di_f_print_to_except_in_dynamic_ f_status_t f_print_to_except_in_dynamic(const f_string_static_t buffer, const f_array_lengths_t except_at, const f_string_ranges_t except_in, const f_file_t file) { - #ifndef _di_level_0_parameter_checking_ - if (file.id == -1) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + if (file.id == -1) return F_file_descriptor_not; if (!buffer.string || !buffer.used) return F_data_not; return private_f_print_to_except_in(buffer.string, 0, buffer.used, except_at, except_in, file.id); @@ -362,10 +312,8 @@ static inline f_status_t private_inline_f_print_to_error(void) { #ifndef _di_f_print_to_except_in_dynamic_partial_ f_status_t f_print_to_except_in_dynamic_partial(const f_string_static_t buffer, const f_string_range_t range, const f_array_lengths_t except_at, const f_string_ranges_t except_in, const f_file_t file) { - #ifndef _di_level_0_parameter_checking_ - if (file.id == -1) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + if (file.id == -1) return F_file_descriptor_not; if (!buffer.used || range.start > range.stop || range.start >= buffer.used || !buffer.string) { return F_data_not; } @@ -382,10 +330,8 @@ static inline f_status_t private_inline_f_print_to_error(void) { #ifndef _di_f_print_to_except_in_dynamic_partial_raw_ f_status_t f_print_to_except_in_dynamic_partial_raw(const f_string_static_t buffer, const f_string_range_t range, const f_array_lengths_t except_at, const f_string_ranges_t except_in, const f_file_t file) { - #ifndef _di_level_0_parameter_checking_ - if (file.id == -1) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + if (file.id == -1) return F_file_descriptor_not; if (!buffer.used || range.start > range.stop || range.start >= buffer.used || !buffer.string) { return F_data_not; } @@ -402,13 +348,9 @@ static inline f_status_t private_inline_f_print_to_error(void) { #ifndef _di_f_print_to_except_in_dynamic_partial_raw_safely_ f_status_t f_print_to_except_in_dynamic_partial_raw_safely(const f_string_static_t buffer, const f_string_range_t range, const f_array_lengths_t except_at, const f_string_ranges_t except_in, const f_file_t file) { - #ifndef _di_level_0_parameter_checking_ - if (file.id == -1) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - if (!buffer.used || range.start > range.stop || range.start >= buffer.used || !buffer.string) { - return F_data_not; - } + if (file.id == -1) return F_file_descriptor_not; + if (!buffer.used || range.start > range.stop || range.start >= buffer.used || !buffer.string) return F_data_not; f_array_length_t length = (range.stop - range.start) + 1; @@ -422,13 +364,9 @@ static inline f_status_t private_inline_f_print_to_error(void) { #ifndef _di_f_print_to_except_in_dynamic_partial_safely_ f_status_t f_print_to_except_in_dynamic_partial_safely(const f_string_static_t buffer, const f_string_range_t range, const f_array_lengths_t except_at, const f_string_ranges_t except_in, const f_file_t file) { - #ifndef _di_level_0_parameter_checking_ - if (file.id == -1) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - if (!buffer.used || range.start > range.stop || range.start >= buffer.used || !buffer.string) { - return F_data_not; - } + if (file.id == -1) return F_file_descriptor_not; + if (!buffer.used || range.start > range.stop || range.start >= buffer.used || !buffer.string) return F_data_not; f_array_length_t length = (range.stop - range.start) + 1; @@ -442,10 +380,8 @@ static inline f_status_t private_inline_f_print_to_error(void) { #ifndef _di_f_print_to_except_in_dynamic_raw_ f_status_t f_print_to_except_in_dynamic_raw(const f_string_static_t buffer, const f_array_lengths_t except_at, const f_string_ranges_t except_in, const f_file_t file) { - #ifndef _di_level_0_parameter_checking_ - if (file.id == -1) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + if (file.id == -1) return F_file_descriptor_not; if (!buffer.used || !buffer.string) return F_data_not; return private_f_print_to_except_in_raw(buffer.string, 0, buffer.used, except_at, except_in, file.id); @@ -454,10 +390,8 @@ static inline f_status_t private_inline_f_print_to_error(void) { #ifndef _di_f_print_to_except_in_dynamic_raw_safely_ f_status_t f_print_to_except_in_dynamic_raw_safely(const f_string_static_t buffer, const f_array_lengths_t except_at, const f_string_ranges_t except_in, const f_file_t file) { - #ifndef _di_level_0_parameter_checking_ - if (file.id == -1) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + if (file.id == -1) return F_file_descriptor_not; if (!buffer.used || !buffer.string) return F_data_not; return private_f_print_to_except_in_raw_safely(buffer.string, 0, buffer.used, except_at, except_in, file.id); @@ -466,10 +400,8 @@ static inline f_status_t private_inline_f_print_to_error(void) { #ifndef _di_f_print_to_except_in_dynamic_safely_ f_status_t f_print_to_except_in_dynamic_safely(const f_string_static_t buffer, const f_array_lengths_t except_at, const f_string_ranges_t except_in, const f_file_t file) { - #ifndef _di_level_0_parameter_checking_ - if (file.id == -1) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + if (file.id == -1) return F_file_descriptor_not; if (!buffer.used || !buffer.string) return F_data_not; return private_f_print_to_except_in_safely(buffer.string, 0, buffer.used, except_at, except_in, file.id); @@ -478,10 +410,8 @@ static inline f_status_t private_inline_f_print_to_error(void) { #ifndef _di_f_print_to_except_in_raw_ f_status_t f_print_to_except_in_raw(const f_string_t string, const f_array_length_t offset, const f_array_length_t length, const f_array_lengths_t except_at, const f_string_ranges_t except_in, const f_file_t file) { - #ifndef _di_level_0_parameter_checking_ - if (file.id == -1) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + if (file.id == -1) return F_file_descriptor_not; if (!length || !string) return F_data_not; return private_f_print_to_except_in_raw(string, offset, length, except_at, except_in, file.id); @@ -490,10 +420,8 @@ static inline f_status_t private_inline_f_print_to_error(void) { #ifndef _di_f_print_to_except_in_raw_safely_ f_status_t f_print_to_except_in_raw_safely(const f_string_t string, const f_array_length_t offset, const f_array_length_t length, const f_array_lengths_t except_at, const f_string_ranges_t except_in, const f_file_t file) { - #ifndef _di_level_0_parameter_checking_ - if (file.id == -1) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + if (file.id == -1) return F_file_descriptor_not; if (!length || !string) return F_data_not; return private_f_print_to_except_in_raw_safely(string, offset, length, except_at, except_in, file.id); @@ -502,10 +430,8 @@ static inline f_status_t private_inline_f_print_to_error(void) { #ifndef _di_f_print_to_except_in_safely_ f_status_t f_print_to_except_in_safely(const f_string_t string, const f_array_length_t offset, const f_array_length_t length, const f_array_lengths_t except_at, const f_string_ranges_t except_in, const f_file_t file) { - #ifndef _di_level_0_parameter_checking_ - if (file.id == -1) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + if (file.id == -1) return F_file_descriptor_not; if (!length || !string) return F_data_not; return private_f_print_to_except_in_safely(string, offset, length, except_at, except_in, file.id); @@ -514,10 +440,8 @@ static inline f_status_t private_inline_f_print_to_error(void) { #ifndef _di_f_print_to_except_raw_ f_status_t f_print_to_except_raw(const f_string_t string, const f_array_length_t offset, const f_array_length_t length, const f_array_lengths_t except, const f_file_t file) { - #ifndef _di_level_0_parameter_checking_ - if (file.id == -1) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + if (file.id == -1) return F_file_descriptor_not; if (!length || !string) return F_data_not; return private_f_print_to_except_raw(string, offset, length, except, file.id); @@ -526,10 +450,8 @@ static inline f_status_t private_inline_f_print_to_error(void) { #ifndef _di_f_print_to_except_raw_safely_ f_status_t f_print_to_except_raw_safely(const f_string_t string, const f_array_length_t offset, const f_array_length_t length, const f_array_lengths_t except, const f_file_t file) { - #ifndef _di_level_0_parameter_checking_ - if (file.id == -1) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + if (file.id == -1) return F_file_descriptor_not; if (!length || !string) return F_data_not; return private_f_print_to_except_raw_safely(string, offset, length, except, file.id); @@ -538,10 +460,8 @@ static inline f_status_t private_inline_f_print_to_error(void) { #ifndef _di_f_print_to_except_safely_ f_status_t f_print_to_except_safely(const f_string_t string, const f_array_length_t offset, const f_array_length_t length, const f_array_lengths_t except, const f_file_t file) { - #ifndef _di_level_0_parameter_checking_ - if (file.id == -1) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + if (file.id == -1) return F_file_descriptor_not; if (!length || !string) return F_data_not; return private_f_print_to_except_safely(string, offset, length, except, file.id); @@ -550,10 +470,8 @@ static inline f_status_t private_inline_f_print_to_error(void) { #ifndef _di_f_print_to_raw_ f_status_t f_print_to_raw(const f_string_t string, const f_array_length_t length, const f_file_t file) { - #ifndef _di_level_0_parameter_checking_ - if (file.id == -1) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + if (file.id == -1) return F_file_descriptor_not; if (!length || !string) return F_data_not; return private_f_print_to_raw(string, length, file.id); @@ -562,10 +480,8 @@ static inline f_status_t private_inline_f_print_to_error(void) { #ifndef _di_f_print_to_raw_safely_ f_status_t f_print_to_raw_safely(const f_string_t string, const f_array_length_t length, const f_file_t file) { - #ifndef _di_level_0_parameter_checking_ - if (file.id == -1) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + if (file.id == -1) return F_file_descriptor_not; if (!length || !string) return F_data_not; return private_f_print_to_raw_safely(string, length, file.id); @@ -574,11 +490,9 @@ static inline f_status_t private_inline_f_print_to_error(void) { #ifndef _di_f_print_to_raw_terminated_ f_status_t f_print_to_raw_terminated(const f_string_t string, const f_file_t file) { - #ifndef _di_level_0_parameter_checking_ - if (file.id == -1) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ -if (!string) return F_data_not; + if (file.id == -1) return F_file_descriptor_not; + if (!string) return F_data_not; // The f_print_raw_terminated() and f_print_terminated() are functionality identical due to being NULL terminated. return private_f_print_to_terminated(string, file.id); @@ -587,10 +501,8 @@ if (!string) return F_data_not; #ifndef _di_f_print_to_safely_ f_status_t f_print_to_safely(const f_string_t string, const f_array_length_t length, const f_file_t file) { - #ifndef _di_level_0_parameter_checking_ - if (file.id == -1) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + if (file.id == -1) return F_file_descriptor_not; if (!length || !string) return F_data_not; return private_f_print_to_safely(string, length, file.id); @@ -599,10 +511,8 @@ if (!string) return F_data_not; #ifndef _di_f_print_to_safely_terminated_ f_status_t f_print_to_safely_terminated(const f_string_t string, const f_file_t file) { - #ifndef _di_level_0_parameter_checking_ - if (file.id == -1) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + if (file.id == -1) return F_file_descriptor_not; if (!string) return F_data_not; f_array_length_t start = 0; @@ -691,10 +601,8 @@ if (!string) return F_data_not; #ifndef _di_f_print_to_terminated_ f_status_t f_print_to_terminated(const f_string_t string, const f_file_t file) { - #ifndef _di_level_0_parameter_checking_ - if (file.id == -1) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + if (file.id == -1) return F_file_descriptor_not; if (!string) return F_data_not; return private_f_print_to_terminated(string, file.id); diff --git a/level_0/f_print/c/print/to.h b/level_0/f_print/c/print/to.h index 79ebaf6..b01691b 100644 --- a/level_0/f_print/c/print/to.h +++ b/level_0/f_print/c/print/to.h @@ -35,6 +35,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * F_file_descriptor_not if file.id is -1. * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. @@ -71,6 +72,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * F_file_descriptor_not if file.id is -1. * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. @@ -111,6 +113,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * F_file_descriptor_not if file.id is -1. * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. @@ -149,6 +152,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * F_file_descriptor_not if file.id is -1. * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. @@ -189,6 +193,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * F_file_descriptor_not if file.id is -1. * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. @@ -231,6 +236,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * F_file_descriptor_not if file.id is -1. * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. @@ -278,6 +284,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * F_file_descriptor_not if file.id is -1. * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. @@ -321,6 +328,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * F_file_descriptor_not if file.id is -1. * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. @@ -357,6 +365,7 @@ extern "C" { * The string to output. * @param file * The file structure containing the file descriptor to output to. + * F_file_descriptor_not if file.id is -1. * * @return * F_none on success. @@ -406,6 +415,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * F_file_descriptor_not if file.id is -1. * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. @@ -447,6 +457,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * F_file_descriptor_not if file.id is -1. * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. @@ -493,6 +504,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * F_file_descriptor_not if file.id is -1. * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. @@ -535,6 +547,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * F_file_descriptor_not if file.id is -1. * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. @@ -579,6 +592,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * F_file_descriptor_not if file.id is -1. * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. @@ -625,6 +639,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * F_file_descriptor_not if file.id is -1. * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. @@ -676,6 +691,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * F_file_descriptor_not if file.id is -1. * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. @@ -723,6 +739,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * F_file_descriptor_not if file.id is -1. * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. @@ -767,6 +784,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * F_file_descriptor_not if file.id is -1. * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. @@ -816,6 +834,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * F_file_descriptor_not if file.id is -1. * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. @@ -861,6 +880,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * F_file_descriptor_not if file.id is -1. * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. @@ -915,6 +935,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * F_file_descriptor_not if file.id is -1. * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. @@ -963,6 +984,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * F_file_descriptor_not if file.id is -1. * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. @@ -1013,6 +1035,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * F_file_descriptor_not if file.id is -1. * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. @@ -1065,6 +1088,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * F_file_descriptor_not if file.id is -1. * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. @@ -1117,6 +1141,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * F_file_descriptor_not if file.id is -1. * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. @@ -1167,6 +1192,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * F_file_descriptor_not if file.id is -1. * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. @@ -1219,6 +1245,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * F_file_descriptor_not if file.id is -1. * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. @@ -1272,6 +1299,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * F_file_descriptor_not if file.id is -1. * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. @@ -1323,6 +1351,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * F_file_descriptor_not if file.id is -1. * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. @@ -1381,6 +1410,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * F_file_descriptor_not if file.id is -1. * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. @@ -1440,6 +1470,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * F_file_descriptor_not if file.id is -1. * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. @@ -1497,6 +1528,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * F_file_descriptor_not if file.id is -1. * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. @@ -1547,6 +1579,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * F_file_descriptor_not if file.id is -1. * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. @@ -1600,6 +1633,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * F_file_descriptor_not if file.id is -1. * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. @@ -1649,6 +1683,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * F_file_descriptor_not if file.id is -1. * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. @@ -1691,6 +1726,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * F_file_descriptor_not if file.id is -1. * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. @@ -1738,6 +1774,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * F_file_descriptor_not if file.id is -1. * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. @@ -1778,6 +1815,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * F_file_descriptor_not if file.id is -1. * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. @@ -1821,6 +1859,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * F_file_descriptor_not if file.id is -1. * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. @@ -1863,6 +1902,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * F_file_descriptor_not if file.id is -1. * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. @@ -1904,6 +1944,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * F_file_descriptor_not if file.id is -1. * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. diff --git a/level_0/f_status_string/c/status_string.c b/level_0/f_status_string/c/status_string.c index 77c6881..9d43555 100644 --- a/level_0/f_status_string/c/status_string.c +++ b/level_0/f_status_string/c/status_string.c @@ -1620,6 +1620,16 @@ extern "C" { break; + case F_help: + *name = f_status_help_s; + + break; + + case F_help_not: + *name = f_status_help_not_s; + + break; + case F_ignore: *name = f_status_ignore_s; -- 1.8.3.1