From 4ced1b0ba41334ce94d0a9b511b363a6031da136 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Wed, 4 Oct 2023 22:12:45 -0500 Subject: [PATCH] Cleanup: Have enumeration types support "none" and have the "// enum" comment at the end. This makes the code more consistent with the intended style practices. --- level_0/f_file/c/file/common.h | 2 +- level_0/f_iki/c/iki/common.h | 2 +- level_0/f_print/c/print/common.h | 4 +++- level_0/f_socket/c/socket/common.h | 22 ++++++++++++---------- level_0/f_type/c/type/file.h | 2 +- level_0/f_utf/c/utf/common.h | 2 +- level_1/fl_conversion/c/conversion/common.h | 2 +- level_2/fll_error/c/error/common.h | 6 ++++-- 8 files changed, 24 insertions(+), 18 deletions(-) diff --git a/level_0/f_file/c/file/common.h b/level_0/f_file/c/file/common.h index cc71a5d..186e79f 100644 --- a/level_0/f_file/c/file/common.h +++ b/level_0/f_file/c/file/common.h @@ -362,7 +362,7 @@ extern "C" { */ #ifndef _di_f_file_stat_flags_e_ enum { - f_file_stat_flag_none_e = 0, + f_file_stat_flag_none_e = 0x0, f_file_stat_flag_exclusive_e = 0x1, f_file_stat_flag_group_e = 0x2, f_file_stat_flag_owner_e = 0x4, diff --git a/level_0/f_iki/c/iki/common.h b/level_0/f_iki/c/iki/common.h index f2f5f33..7fd7e9b 100644 --- a/level_0/f_iki/c/iki/common.h +++ b/level_0/f_iki/c/iki/common.h @@ -45,7 +45,7 @@ extern "C" { */ #ifndef _di_f_iki_state_flag_e_ enum { - f_iki_state_flag_none_e = 0, + f_iki_state_flag_none_e = 0x0, f_iki_state_flag_utf_fail_on_valid_not_e = 0x1, }; // enum #endif // _di_f_iki_state_flag_e_ diff --git a/level_0/f_print/c/print/common.h b/level_0/f_print/c/print/common.h index 5cbb668..0feef3b 100644 --- a/level_0/f_print/c/print/common.h +++ b/level_0/f_print/c/print/common.h @@ -322,6 +322,7 @@ extern "C" { * Provide type format flags. * * f_print_format_type_*: + * - none: No type set. * - character: "c", Type is a 1-byte unsigned character. * - character_safe: "C", Type is a 1-byte unsigned character, where control characters and invalid UTF-8 are replaced. * - color_after: "]", Type is a f_color_set_t such that the f_color_set_t.after is used. @@ -352,7 +353,8 @@ extern "C" { */ #ifndef _di_f_print_format_type_e_ enum { - f_print_format_type_character_e = 1, + f_print_format_type_none_e = 0, + f_print_format_type_character_e, f_print_format_type_character_safe_e, f_print_format_type_color_after_e, f_print_format_type_color_before_e, diff --git a/level_0/f_socket/c/socket/common.h b/level_0/f_socket/c/socket/common.h index 345b8ae..6221a4a 100644 --- a/level_0/f_socket/c/socket/common.h +++ b/level_0/f_socket/c/socket/common.h @@ -129,13 +129,14 @@ extern "C" { f_socket_address_family_wanpipe_e = AF_WANPIPE, f_socket_address_family_x25_e = AF_X25, f_socket_address_family_max_e = AF_MAX, - }; + }; // enum #endif // _di_f_socket_address_family_e_ /** * Socket Closes. * * f_socket_close_*: + * - None: No value set. * - fast: Fast Socket close, as in close(). * - read: Read close, as in shutdown(, SHUT_RD). * - read_write: Read/Write close, as in shutdown(, SHUT_RDWR). @@ -143,11 +144,12 @@ extern "C" { */ #ifndef _di_f_socket_close_e_ enum { - f_socket_close_fast_e = 1, + f_socket_close_none_e = 0, + f_socket_close_fast_e, f_socket_close_read_e, f_socket_close_write_e, f_socket_close_read_write_e, - }; + }; // enum #endif // _di_f_socket_close_e_ /** @@ -183,7 +185,7 @@ extern "C" { f_socket_flag_truncate_e = MSG_TRUNC, f_socket_flag_wait_all_e = MSG_WAITALL, f_socket_flag_wait_not_e = MSG_DONTWAIT, - }; + }; // enum #endif // _di_f_socket_flag_e_ /** @@ -241,7 +243,7 @@ extern "C" { f_socket_level_tipc_e = SOL_TIPC, f_socket_level_tls_e = SOL_TLS, f_socket_level_x25_e = SOL_X25, - }; + }; // enum #endif // _di_f_socket_level_e_ /** @@ -263,7 +265,7 @@ extern "C" { f_socket_message_flag_record_end_e = MSG_EOR, f_socket_message_flag_truncate_e = MSG_TRUNC, f_socket_message_flag_truncate_control_e = MSG_CTRUNC, - }; + }; // enum #endif // _di_f_socket_message_flag_e_ /** @@ -399,7 +401,7 @@ extern "C" { f_socket_option_type_e = SO_TYPE, f_socket_option_wifi_status_e = SO_WIFI_STATUS, f_socket_option_zero_copy_e = SO_ZEROCOPY, - }; + }; // enum #endif // _di_f_socket_option_e_ /** @@ -521,7 +523,7 @@ extern "C" { f_socket_protocol_wesp_e = 141, f_socket_protocol_xns_idp_e = 22, f_socket_protocol_xtp_e = 36, - }; + }; // enum #endif // _di_f_socket_protocol_e_ /** @@ -621,7 +623,7 @@ extern "C" { f_socket_protocol_family_wanpipe_e = PF_WANPIPE, f_socket_protocol_family_x25_e = PF_X25, f_socket_protocol_family_max_e = PF_MAX, - }; + }; // enum #endif // _di_f_socket_protocol_family_e_ /** @@ -645,7 +647,7 @@ extern "C" { f_socket_type_nonblocking_e = SOCK_NONBLOCK, f_socket_type_raw_e = SOCK_RAW, f_socket_type_stream_e = SOCK_STREAM, - }; + }; // enum #endif // _di_f_socket_type_e_ #ifdef __cplusplus diff --git a/level_0/f_type/c/type/file.h b/level_0/f_type/c/type/file.h index f82c34b..7c82875 100644 --- a/level_0/f_type/c/type/file.h +++ b/level_0/f_type/c/type/file.h @@ -276,7 +276,7 @@ extern "C" { #else f_poll_hang_up_read_e = 0x2000, #endif // POLLRDHUP - }; + }; // enum #endif // _di_f_poll_e_ /** diff --git a/level_0/f_utf/c/utf/common.h b/level_0/f_utf/c/utf/common.h index 3b1e9a3..3cf696b 100644 --- a/level_0/f_utf/c/utf/common.h +++ b/level_0/f_utf/c/utf/common.h @@ -382,7 +382,7 @@ extern "C" { */ #ifndef _di_f_utf_width_e_ enum { - F_utf_width_none_e, + F_utf_width_none_e = 0, F_utf_width_ambiguous_e, F_utf_width_full_e, F_utf_width_half_e, diff --git a/level_1/fl_conversion/c/conversion/common.h b/level_1/fl_conversion/c/conversion/common.h index 7e8f078..ef5390b 100644 --- a/level_1/fl_conversion/c/conversion/common.h +++ b/level_1/fl_conversion/c/conversion/common.h @@ -94,7 +94,7 @@ extern "C" { fl_conversion_data_flag_endian_big_e = 0x1, fl_conversion_data_flag_endian_little_e = 0x2, fl_conversion_data_flag_negative_e = 0x4, - }; + }; // enum #endif // _di_fl_conversion_data_flag_e_ #ifdef __cplusplus diff --git a/level_2/fll_error/c/error/common.h b/level_2/fll_error/c/error/common.h index 9471c12..add8695 100644 --- a/level_2/fll_error/c/error/common.h +++ b/level_2/fll_error/c/error/common.h @@ -20,6 +20,7 @@ extern "C" { * Error file types. * * fll_error_file_type_*: + * - none: No error. * - file: File error. * - link: Link error. * - directory: Directory error. @@ -29,7 +30,8 @@ extern "C" { */ #ifndef _di_fll_error_file_type_e_ enum { - fll_error_file_type_file_e = 1, + fll_error_file_type_none_e = 0, + fll_error_file_type_file_e, fll_error_file_type_link_e, fll_error_file_type_directory_e, fll_error_file_type_path_e, @@ -48,7 +50,7 @@ extern "C" { */ #ifndef _di_fll_error_file_flag_e_ enum { - fll_error_file_flag_none_e = 0, + fll_error_file_flag_none_e = 0x0, fll_error_file_flag_fallback_e = 0x1, fll_error_file_flag_simple_e = 0x2, }; // enum -- 1.8.3.1