From: Kevin Day Date: Mon, 20 Jan 2025 23:59:19 +0000 (-0600) Subject: Update: Use the pre-defined typedef structure style for the main program type. X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=6263de5db3092ecceee16c9a6fa2dbb79e14c4b5;p=fll Update: Use the pre-defined typedef structure style for the main program type. Make sure that the typedef is defined early for a later defined type. This allows for circular use of the main, such as with callbacks. This is being done across all of my programs. --- diff --git a/level_3/byte_dump/c/main/common/type.h b/level_3/byte_dump/c/main/common/type.h index a11da68..351fa64 100644 --- a/level_3/byte_dump/c/main/common/type.h +++ b/level_3/byte_dump/c/main/common/type.h @@ -17,6 +17,13 @@ extern "C" { #endif /** + * Pre-define the main type so it can be used in child classes. + */ +#ifndef _di_byte_dump_main_t_typedef_ + typedef struct byte_dump_main_t_ byte_dump_main_t; +#endif // _di_byte_dump_main_t_typedef_ + +/** * A main structure for character row and column position (cell). * * Properties: @@ -119,10 +126,10 @@ extern "C" { * - setting: The settings data. */ #ifndef _di_byte_dump_main_t_ - typedef struct { + struct byte_dump_main_t_ { fll_program_data_t program; byte_dump_setting_t setting; - } byte_dump_main_t; + }; #define byte_dump_main_t_initialize \ { \ diff --git a/level_3/example/c/main/common/type.h b/level_3/example/c/main/common/type.h index 162c28f..e920659 100644 --- a/level_3/example/c/main/common/type.h +++ b/level_3/example/c/main/common/type.h @@ -17,6 +17,13 @@ extern "C" { #endif /** + * Pre-define the main type so it can be used in child classes. + */ +#ifndef _di_example_main_t_typedef_ + typedef struct example_main_t_ example_main_t; +#endif // _di_example_main_t_typedef_ + +/** * The example main program cache. * * buffer: A generic buffer. @@ -71,11 +78,11 @@ extern "C" { * setting: The settings data. */ #ifndef _di_example_main_t_ - typedef struct { + struct example_main_t_ { fll_program_data_t program; example_setting_t setting; example_cache_t cache; - } example_main_t; + }; #define example_main_t_initialize \ { \ diff --git a/level_3/fake/c/main/common/type.h b/level_3/fake/c/main/common/type.h index a75c48c..2cc113e 100644 --- a/level_3/fake/c/main/common/type.h +++ b/level_3/fake/c/main/common/type.h @@ -17,6 +17,13 @@ extern "C" { #endif /** + * Pre-define the main type so it can be used in child classes. + */ +#ifndef _di_fake_main_t_typedef_ + typedef struct fake_main_t_ fake_main_t; +#endif // _di_fake_main_t_typedef_ + +/** * A structure for managing the operation and if-condition states. * * Properties: @@ -142,7 +149,7 @@ extern "C" { * - cache_recurse_do: A cache for the directory recursion do function. */ #ifndef _di_fake_main_t_ - typedef struct { + struct fake_main_t_ { fll_program_data_t program; fake_setting_t setting; @@ -154,7 +161,7 @@ extern "C" { f_string_map_t cache_map; f_iki_data_t cache_iki; f_directory_recurse_do_t cache_recurse_do; - } fake_main_t; + }; #define fake_main_t_initialize \ { \ diff --git a/level_3/firewall/c/main/common/type.h b/level_3/firewall/c/main/common/type.h index 6b1c6b6..3675ded 100644 --- a/level_3/firewall/c/main/common/type.h +++ b/level_3/firewall/c/main/common/type.h @@ -17,6 +17,13 @@ extern "C" { #endif /** + * Pre-define the main type so it can be used in child classes. + */ +#ifndef _di_firewall_main_t_typedef_ + typedef struct firewall_main_t_ firewall_main_t; +#endif // _di_firewall_main_t_typedef_ + +/** * A cache used for during processing. * * Properties: @@ -184,12 +191,12 @@ extern "C" { * - cache: The firewall cache. */ #ifndef _di_firewall_main_t_ - typedef struct { + struct firewall_main_t_ { fll_program_data_t program; firewall_setting_t setting; firewall_data_t data; firewall_cache_t cache; - } firewall_main_t; + }; #define firewall_main_t_initialize \ { \ diff --git a/level_3/fss_identify/c/main/common/type.h b/level_3/fss_identify/c/main/common/type.h index 39fff47..d4fc145 100644 --- a/level_3/fss_identify/c/main/common/type.h +++ b/level_3/fss_identify/c/main/common/type.h @@ -17,6 +17,13 @@ extern "C" { #endif /** + * Pre-define the main type so it can be used in child classes. + */ +#ifndef _di_fss_identify_main_t_typedef_ + typedef struct fss_identify_main_t_ fss_identify_main_t; +#endif // _di_fss_identify_main_t_typedef_ + +/** * The fss identify main program settings. * * This is passed to the program-specific main entry point to designate program settings. @@ -85,10 +92,10 @@ extern "C" { * - setting: The settings data. */ #ifndef _di_fss_identify_main_t_ - typedef struct { + struct fss_identify_main_t_ { fll_program_data_t program; fss_identify_setting_t setting; - } fss_identify_main_t; + }; #define fss_identify_main_t_initialize \ { \ diff --git a/level_3/fss_read/c/main/common/type.h b/level_3/fss_read/c/main/common/type.h index e9d80e8..2dc576d 100644 --- a/level_3/fss_read/c/main/common/type.h +++ b/level_3/fss_read/c/main/common/type.h @@ -17,6 +17,13 @@ extern "C" { #endif /** + * Pre-define the main type so it can be used in child classes. + */ +#ifndef _di_fss_read_main_t_typedef_ + typedef struct fss_read_main_t_ fss_read_main_t; +#endif // _di_fss_read_main_t_typedef_ + +/** * A structure of parameters applied at some depth. * * depth: The depth number in which this is to be processed at. @@ -319,12 +326,12 @@ extern "C" { * setting: The settings data. */ #ifndef _di_fss_read_main_t_ - typedef struct { + struct fss_read_main_t_ { fss_read_cache_t cache; fss_read_callback_t callback; fll_program_data_t program; fss_read_setting_t setting; - } fss_read_main_t; + }; #define fss_read_main_t_initialize \ { \ diff --git a/level_3/fss_write/c/main/common/type.h b/level_3/fss_write/c/main/common/type.h index b8a9055..dcd3ec7 100644 --- a/level_3/fss_write/c/main/common/type.h +++ b/level_3/fss_write/c/main/common/type.h @@ -17,6 +17,13 @@ extern "C" { #endif /** + * Pre-define the main type so it can be used in child classes. + */ +#ifndef _di_fss_write_main_t_typedef_ + typedef struct fss_write_main_t_ fss_write_main_t; +#endif // _di_fss_write_main_t_typedef_ + +/** * The FSS write callbacks. * * process_content: Process a single Content. @@ -134,11 +141,11 @@ extern "C" { * setting: The settings data. */ #ifndef _di_fss_write_main_t_ - typedef struct { + struct fss_write_main_t_ { fss_write_callback_t callback; fll_program_data_t program; fss_write_setting_t setting; - } fss_write_main_t; + }; #define fss_write_main_t_initialize \ { \ diff --git a/level_3/iki_read/c/main/common/type.h b/level_3/iki_read/c/main/common/type.h index 16cfa86..631c22c 100644 --- a/level_3/iki_read/c/main/common/type.h +++ b/level_3/iki_read/c/main/common/type.h @@ -17,11 +17,11 @@ extern "C" { #endif /** - * Make the typedef for iki_read_main_t available to child structures. + * Pre-define the main type so it can be used in child classes. */ -#ifndef _di_iki_read_main_t__ +#ifndef _di_iki_read_main_t_typedef_ typedef struct iki_read_main_t_ iki_read_main_t; -#endif // _di_iki_read_main_t__ +#endif // _di_iki_read_main_t_typedef_ /** * The IKI read main program cache. diff --git a/level_3/iki_write/c/main/common/type.h b/level_3/iki_write/c/main/common/type.h index 876cf4e..05e08fb 100644 --- a/level_3/iki_write/c/main/common/type.h +++ b/level_3/iki_write/c/main/common/type.h @@ -17,6 +17,13 @@ extern "C" { #endif /** + * Pre-define the main type so it can be used in child classes. + */ +#ifndef _di_iki_write_main_t_typedef_ + typedef struct iki_write_main_t_ iki_write_main_t; +#endif // _di_iki_write_main_t_typedef_ + +/** * The IKI write main program cache. * * Properties: @@ -120,12 +127,12 @@ extern "C" { * - setting: The settings data. */ #ifndef _di_iki_write_main_t_ - typedef struct { + struct iki_write_main_t_ { iki_write_cache_t cache; iki_write_callback_t callback; fll_program_data_t program; iki_write_setting_t setting; - } iki_write_main_t; + }; #define iki_write_main_t_initialize \ { \ diff --git a/level_3/status_code/c/main/common/type.h b/level_3/status_code/c/main/common/type.h index 0fe3178..fe08127 100644 --- a/level_3/status_code/c/main/common/type.h +++ b/level_3/status_code/c/main/common/type.h @@ -17,6 +17,13 @@ extern "C" { #endif /** + * Pre-define the main type so it can be used in child classes. + */ +#ifndef _di_status_code_main_t_typedef_ + typedef struct status_code_main_t_ status_code_main_t; +#endif // _di_status_code_main_t_typedef_ + +/** * The status code main program settings. * * This is passed to the program-specific main entry point to designate program settings. @@ -66,10 +73,10 @@ extern "C" { * setting: The settings data. */ #ifndef _di_status_code_main_t_ - typedef struct { + struct status_code_main_t_ { fll_program_data_t program; status_code_setting_t setting; - } status_code_main_t; + }; #define status_code_main_t_initialize \ { \ diff --git a/level_3/utf8/c/main/common/type.h b/level_3/utf8/c/main/common/type.h index 2f6eaa0..7c10c6a 100644 --- a/level_3/utf8/c/main/common/type.h +++ b/level_3/utf8/c/main/common/type.h @@ -17,6 +17,13 @@ extern "C" { #endif /** + * Pre-define the main type so it can be used in child classes. + */ +#ifndef _di_utf8_main_t_typedef_ + typedef struct utf8_main_t_ utf8_main_t; +#endif // _di_utf8_main_t_typedef_ + +/** * The utf8 main program settings. * * This is passed to the program-specific main entry point to designate program settings. @@ -90,10 +97,10 @@ extern "C" { * - setting: The settings data. */ #ifndef _di_utf8_main_t_ - typedef struct { + struct utf8_main_t_ { fll_program_data_t program; utf8_setting_t setting; - } utf8_main_t; + }; #define utf8_main_t_initialize \ { \