From: Kevin Day Date: Thu, 5 Oct 2023 04:19:44 +0000 (-0500) Subject: Progress: Begin adding FSS Payload processing code. X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=007e67e1ca77cd5a9fcb19448f3bd692d989a6f5;p=fll Progress: Begin adding FSS Payload processing code. This will use the f_abstruse project. This is very incomplete and is mostly drafted out. Update the Featureless Make stand alone build with the latest changes. Apply the related cleanups from 4ced1b0ba41334ce94d0a9b511b363a6031da136 (Cleanup: Have enumeration types support "none" and have the "// enum" comment at the end.). Add some documentation comments. --- diff --git a/build/level_0/settings b/build/level_0/settings index 745f3c5..0ffaf7b 100644 --- a/build/level_0/settings +++ b/build/level_0/settings @@ -46,7 +46,7 @@ build_sources_library private-directory.c build_sources_library environment.c build_sources_library execute.c build_sources_library file.c private-file.c file/common.c file/stream.c -build_sources_library fss.c fss/common.c fss/item.c fss/named.c fss/nest.c fss/quote.c fss/set.c fss/set_quote.c fss/simple_packet.c +build_sources_library fss.c fss/common.c fss/item.c fss/named.c fss/nest.c fss/payload.c fss/quote.c fss/set.c fss/set_quote.c fss/simple_packet.c build_sources_library iki.c iki/common.c iki/data.c private-iki.c iki/private-data.c build_sources_library limit.c limit/set.c limit/value.c build_sources_library memory.c memory/array.c memory/arrays.c @@ -96,7 +96,7 @@ build_sources_headers directory.h directory/common.h directory/listing.h directo build_sources_headers environment.h environment/common.h build_sources_headers execute.h execute/common.h build_sources_headers file.h file/common.h file/stream.h -build_sources_headers fss.h fss/common.h fss/item.h fss/named.h fss/nest.h fss/quote.h fss/set.h fss/set_quote.h fss/simple_packet.h +build_sources_headers fss.h fss/common.h fss/item.h fss/named.h fss/nest.h fss/payload.h fss/quote.h fss/set.h fss/set_quote.h fss/simple_packet.h build_sources_headers iki.h iki/common.h iki/data.h build_sources_headers limit.h limit/set.h limit/value.h build_sources_headers memory.h memory/array.h memory/arrays.h memory/common.h diff --git a/build/level_1/settings b/build/level_1/settings index 924c12e..fb4658e 100644 --- a/build/level_1/settings +++ b/build/level_1/settings @@ -38,7 +38,7 @@ build_sources_library control_group.c build_sources_library conversion.c private-conversion.c conversion/common.c build_sources_library directory.c private-directory.c build_sources_library environment.c -build_sources_library private-fss.c fss/basic.c fss/basic_list.c fss/embedded_list.c fss/extended.c fss/extended_list.c +build_sources_library private-fss.c fss/basic.c fss/basic_list.c fss/embedded_list.c fss/extended.c fss/extended_list.c fss/payload.c build_sources_library iki.c build_sources_library path.c build_sources_library print.c private-print.c print/common.c @@ -50,7 +50,7 @@ build_sources_headers conversion.h conversion/common.h build_sources_headers directory.h directory/common.h build_sources_headers environment.h build_sources_headers execute.h execute/common.h -build_sources_headers fss.h fss/basic.h fss/basic_list.h fss/embedded_list.h fss/extended.h fss/extended_list.h +build_sources_headers fss.h fss/basic.h fss/basic_list.h fss/embedded_list.h fss/extended.h fss/extended_list.h fss/payload.h build_sources_headers iki.h build_sources_headers path.h build_sources_headers print.h print/common.h diff --git a/build/monolithic/settings b/build/monolithic/settings index bd861a1..886e92b 100644 --- a/build/monolithic/settings +++ b/build/monolithic/settings @@ -46,7 +46,7 @@ build_sources_library level_0/private-directory.c build_sources_library level_0/environment.c build_sources_library level_0/execute.c build_sources_library level_0/file.c level_0/private-file.c level_0/file/common.c level_0/file/stream.c -build_sources_library level_0/fss.c level_0/fss/common.c level_0/fss/item.c level_0/fss/named.c level_0/fss/nest.c level_0/fss/quote.c level_0/fss/set.c level_0/fss/set_quote.c level_0/fss/simple_packet.c +build_sources_library level_0/fss.c level_0/fss/common.c level_0/fss/item.c level_0/fss/named.c level_0/fss/nest.c level_0/fss/payload.c level_0/fss/quote.c level_0/fss/set.c level_0/fss/set_quote.c level_0/fss/simple_packet.c build_sources_library level_0/iki.c level_0/iki/common.c level_0/iki/data.c level_0/private-iki.c level_0/iki/private-data.c build_sources_library level_0/limit.c level_0/limit/set.c level_0/limit/value.c build_sources_library level_0/memory.c level_0/memory/array.c level_0/memory/arrays.c @@ -86,7 +86,7 @@ build_sources_library level_1/control_group.c build_sources_library level_1/conversion.c level_1/private-conversion.c level_1/conversion/common.c build_sources_library level_1/directory.c level_1/private-directory.c build_sources_library level_1/environment.c -build_sources_library level_1/private-fss.c level_1/fss/basic.c level_1/fss/basic_list.c level_1/fss/embedded_list.c level_1/fss/extended.c level_1/fss/extended_list.c +build_sources_library level_1/private-fss.c level_1/fss/basic.c level_1/fss/basic_list.c level_1/fss/embedded_list.c level_1/fss/extended.c level_1/fss/extended_list.c level_1/fss/payload.c build_sources_library level_1/iki.c build_sources_library level_1/path.c build_sources_library level_1/print.c level_1/private-print.c level_1/print/common.c @@ -117,7 +117,7 @@ build_sources_headers level_0/directory.h level_0/directory/common.h level_0/dir build_sources_headers level_0/environment.h level_0/environment/common.h build_sources_headers level_0/execute.h level_0/execute/common.h build_sources_headers level_0/file.h level_0/file/common.h level_0/file/stream.h -build_sources_headers level_0/fss.h level_0/fss/common.h level_0/fss/item.h level_0/fss/named.h level_0/fss/nest.h level_0/fss/quote.h level_0/fss/set.h level_0/fss/set_quote.h level_0/fss/simple_packet.h +build_sources_headers level_0/fss.h level_0/fss/common.h level_0/fss/item.h level_0/fss/named.h level_0/fss/nest.h level_0/fss/payload.h level_0/fss/quote.h level_0/fss/set.h level_0/fss/set_quote.h level_0/fss/simple_packet.h build_sources_headers level_0/iki.h level_0/iki/common.h level_0/iki/data.h build_sources_headers level_0/limit.h level_0/limit/set.h level_0/limit/value.h build_sources_headers level_0/memory.h level_0/memory/array.h level_0/memory/arrays.h level_0/memory/common.h @@ -150,7 +150,7 @@ build_sources_headers level_1/conversion.h level_1/conversion/common.h build_sources_headers level_1/directory.h level_1/directory/common.h build_sources_headers level_1/environment.h build_sources_headers level_1/execute.h level_1/execute/common.h -build_sources_headers level_1/fss.h level_1/fss/basic.h level_1/fss/basic_list.h level_1/fss/embedded_list.h level_1/fss/extended.h level_1/fss/extended_list.h +build_sources_headers level_1/fss.h level_1/fss/basic.h level_1/fss/basic_list.h level_1/fss/embedded_list.h level_1/fss/extended.h level_1/fss/extended_list.h level_1/fss/payload.h build_sources_headers level_1/iki.h build_sources_headers level_1/path.h build_sources_headers level_1/print.h level_1/print/common.h diff --git a/build/scripts/test.sh b/build/scripts/test.sh index 98d6925..60117c8 100644 --- a/build/scripts/test.sh +++ b/build/scripts/test.sh @@ -71,7 +71,7 @@ test_main() { local verbose= local verbose_common= - local projects="f_type f_status f_memory f_type_array f_string f_utf f_account f_capability f_color f_compare f_console f_control_group f_conversion f_directory f_environment f_execute f_file f_fss f_iki f_limit f_network f_parse f_path f_pipe f_print f_rip f_serialize f_signal f_socket f_status_string f_thread f_time fl_control_group fl_conversion fl_directory fl_environment fl_execute fl_fss fl_iki fl_path fl_print fl_status_string fl_utf_file fll_control_group fll_error fll_execute fll_file fll_fss fll_fss_status_string fll_iki fll_print fll_program" + local projects="f_type f_status f_memory f_type_array f_string f_utf f_abstruse f_account f_capability f_color f_compare f_console f_control_group f_conversion f_directory f_environment f_execute f_file f_fss f_iki f_limit f_network f_parse f_path f_pipe f_print f_rip f_serialize f_signal f_socket f_status_string f_thread f_time fl_control_group fl_conversion fl_directory fl_environment fl_execute fl_fss fl_iki fl_path fl_print fl_status_string fl_utf_file fll_control_group fll_error fll_execute fll_file fll_fss fll_fss_status_string fll_iki fll_print fll_program" local projects_no_tests="f_type" local programs="fss_read" diff --git a/build/stand_alone/fake.config.h b/build/stand_alone/fake.config.h index 848e7c2..8d20155 100644 --- a/build/stand_alone/fake.config.h +++ b/build/stand_alone/fake.config.h @@ -15,6 +15,22 @@ // echo "#define _di_private_inline_f_print_to_error_" >> /tmp/sorted.txt // echo "#define _di_private_inline_private_f_print_to_error_" >> /tmp/sorted.txt +#define _di_f_abstruse_e_ +#define _di_f_abstruse_maps_delete_callback_ +#define _di_f_abstruse_maps_destroy_callback_ +#define _di_f_abstruse_mapss_delete_callback_ +#define _di_f_abstruse_mapss_destroy_callback_ +#define _di_f_abstruse_mapss_t_ +#define _di_f_abstruse_maps_t_ +#define _di_f_abstruse_map_t_ +#define _di_f_abstruses_delete_callback_ +#define _di_f_abstruses_destroy_callback_ +#define _di_f_abstrusess_delete_callback_ +#define _di_f_abstrusess_destroy_callback_ +#define _di_f_abstrusess_t_ +#define _di_f_abstruses_t_ +#define _di_f_abstruse_t_ +#define _di_f_abstruse_type_t_ #define _di_f_account_by_id_ #define _di_f_account_by_name_ //#define _di_f_account_d_ @@ -304,7 +320,6 @@ #define _di_f_directory_listings_t_ //#define _di_f_directory_listing_t_ //#define _di_f_directory_max_d_ -#define _di_f_directory_mode_ //#define _di_f_directory_open_ #define _di_f_directory_open_at_ //#define _di_f_directory_recurse_do_delete_ @@ -528,12 +543,8 @@ //#define _di_f_fss_is_zero_width_ #define _di_f_fss_item_delete_ #define _di_f_fss_item_destroy_ -#define _di_f_fss_items_adjust_ -#define _di_f_fss_items_decimate_by_ -#define _di_f_fss_items_decrease_by_ #define _di_f_fss_items_delete_callback_ #define _di_f_fss_items_destroy_callback_ -#define _di_f_fss_items_resize_ #define _di_f_fss_itemss_delete_callback_ #define _di_f_fss_itemss_destroy_callback_ #define _di_f_fss_itemss_t_ @@ -557,14 +568,16 @@ #define _di_f_fss_nestss_t_ #define _di_f_fss_nests_t_ #define _di_f_fss_nest_t_ +#define _di_f_fss_payload_comment_header_s_ +#define _di_f_fss_payload_object_header_s_ +#define _di_f_fss_payload_object_payload_s_ +#define _di_f_fss_payload_object_signature_s_ #define _di_f_fss_payload_s_ +#define _di_f_fss_payload_write_e_ //#define _di_f_fss_placeholder_s_ //#define _di_f_fss_quote_type_e_ #define _di_f_fss_s_ //#define _di_f_fss_seek_to_eol_ -#define _di_f_fss_set_adjust_ -#define _di_f_fss_set_decimate_by_ -#define _di_f_fss_set_decrease_by_ //#define _di_f_fss_set_delete_ #define _di_f_fss_set_destroy_ #define _di_f_fss_set_quote_delete_ @@ -588,19 +601,11 @@ #define _di_f_fss_simple_packet_destroy_ #define _di_f_fss_simple_packet_extract_ #define _di_f_fss_simple_packet_extract_range_ -#define _di_f_fss_simple_packet_ranges_append_ -#define _di_f_fss_simple_packet_ranges_append_all_ -#define _di_f_fss_simple_packet_rangess_append_ -#define _di_f_fss_simple_packet_rangess_append_all_ #define _di_f_fss_simple_packet_rangess_t_ #define _di_f_fss_simple_packet_ranges_t_ #define _di_f_fss_simple_packet_range_t_ -#define _di_f_fss_simple_packets_append_ -#define _di_f_fss_simple_packets_append_all_ #define _di_f_fss_simple_packets_delete_callback_ #define _di_f_fss_simple_packets_destroy_callback_ -#define _di_f_fss_simple_packetss_append_ -#define _di_f_fss_simple_packetss_append_all_ #define _di_f_fss_simple_packetss_delete_callback_ #define _di_f_fss_simple_packetss_destroy_callback_ #define _di_f_fss_simple_packetss_t_ @@ -764,6 +769,7 @@ #define _di_fl_fss_extended_list_object_write_ //#define _di_fl_fss_extended_object_read_ #define _di_fl_fss_extended_object_write_ +#define _di_fl_fss_payload_header_write_ //#define _di_fl_iki_read_ //#define _di_f_limit_process_ #define _di_f_limit_setss_delete_callback_ @@ -1464,7 +1470,6 @@ #define _di_f_string_triples_append_all_ #define _di_f_string_triples_delete_callback_ #define _di_f_string_triples_destroy_callback_ -#define _di_f_string_tripless_adjust_ #define _di_f_string_tripless_append_ #define _di_f_string_tripless_append_all_ #define _di_f_string_tripless_delete_callback_ @@ -1800,7 +1805,6 @@ #define _di_f_utf_string_append_ #define _di_f_utf_string_append_assure_ #define _di_f_utf_string_append_assure_nulless_ -#define _di_f_utf_string_append_mash_ #define _di_f_utf_string_append_nulless_ #define _di_f_utf_string_dynamic_append_ #define _di_f_utf_string_dynamic_append_assure_ @@ -1830,11 +1834,11 @@ #define _di_f_utf_string_dynamic_prepend_nulless_ #define _di_f_utf_string_dynamics_append_ #define _di_f_utf_string_dynamics_append_all_ +#define _di_f_utf_string_dynamics_delete_callback_ +#define _di_f_utf_string_dynamics_destroy_callback_ #define _di_f_utf_string_dynamic_seek_line_ #define _di_f_utf_string_dynamic_seek_line_to_ #define _di_f_utf_string_dynamic_seek_to_ -#define _di_f_utf_string_dynamics_delete_callback_ -#define _di_f_utf_string_dynamics_destroy_callback_ #define _di_f_utf_string_dynamicss_append_ #define _di_f_utf_string_dynamicss_append_all_ #define _di_f_utf_string_dynamicss_delete_callback_ diff --git a/build/stand_alone/fake.settings b/build/stand_alone/fake.settings index 40876f0..5d17a15 100644 --- a/build/stand_alone/fake.settings +++ b/build/stand_alone/fake.settings @@ -44,7 +44,7 @@ build_sources_library fll/level_0/private-directory.c build_sources_program fll/level_0/environment.c build_sources_program fll/level_0/execute.c build_sources_program fll/level_0/file.c fll/level_0/private-file.c fll/level_0/file/common.c fll/level_0/file/stream.c -build_sources_program fll/level_0/fss.c fll/level_0/fss/common.c fll/level_0/fss/item.c fll/level_0/fss/named.c fll/level_0/fss/nest.c fll/level_0/fss/quote.c fll/level_0/fss/set.c fll/level_0/fss/set_quote.c fll/level_0/fss/simple_packet.c +build_sources_program fll/level_0/fss.c fll/level_0/fss/common.c fll/level_0/fss/item.c fll/level_0/fss/named.c fll/level_0/fss/nest.c fll/level_0/fss/payload.c fll/level_0/fss/quote.c fll/level_0/fss/set.c fll/level_0/fss/set_quote.c fll/level_0/fss/simple_packet.c build_sources_program fll/level_0/iki.c fll/level_0/private-iki.c fll/level_0/iki/common.c fll/level_0/iki/private-data.c fll/level_0/iki/data.c build_sources_program fll/level_0/limit.c fll/level_0/limit/set.c fll/level_0/limit/value.c build_sources_program fll/level_0/memory.c fll/level_0/memory/array.c fll/level_0/memory/arrays.c @@ -68,7 +68,7 @@ build_sources_program fll/level_1/control_group.c build_sources_program fll/level_1/conversion.c fll/level_1/private-conversion.c fll/level_1/conversion/common.c build_sources_program fll/level_1/directory.c fll/level_1/private-directory.c build_sources_program fll/level_1/environment.c -build_sources_program fll/level_1/private-fss.c fll/level_1/fss/basic.c fll/level_1/fss/basic_list.c fll/level_1/fss/embedded_list.c fll/level_1/fss/extended.c fll/level_1/fss/extended_list.c +build_sources_program fll/level_1/private-fss.c fll/level_1/fss/basic.c fll/level_1/fss/basic_list.c fll/level_1/fss/embedded_list.c fll/level_1/fss/extended.c fll/level_1/fss/extended_list.c fll/level_1/fss/payload.c build_sources_program fll/level_1/iki.c build_sources_program fll/level_1/path.c build_sources_program fll/level_1/print.c fll/level_1/private-print.c fll/level_1/print/common.c diff --git a/level_0/f_fss/c/fss.h b/level_0/f_fss/c/fss.h index b7ce096..48b9e8b 100644 --- a/level_0/f_fss/c/fss.h +++ b/level_0/f_fss/c/fss.h @@ -30,6 +30,7 @@ #include #include #include +#include #ifdef __cplusplus extern "C" { diff --git a/level_0/f_fss/c/fss/common.h b/level_0/f_fss/c/fss/common.h index f212755..dbfd475 100644 --- a/level_0/f_fss/c/fss/common.h +++ b/level_0/f_fss/c/fss/common.h @@ -134,6 +134,7 @@ extern "C" { * Codes for every known FSS standard. * * f_fss_*_e: + * - none: No type set. * - basic: FSS-0000: Basic. * - extended: FSS-0001: Extended. * - basic_list: FSS-0002: Basic List. @@ -150,10 +151,12 @@ extern "C" { * - basic_rule: FSS-000D: Basic Rule. * - payload: FSS-000E: Payload. * - simple_packet: FSS-000F: Simple Packet. + * - encrypted_simple_packet: FSS-0010: Encrypted Simple Packet. */ #ifndef _di_f_fss_e_ enum { - f_fss_basic_e = 1, + f_fss_none_e = 0, + f_fss_basic_e, f_fss_extended_e, f_fss_basic_list_e, f_fss_extended_list_e, @@ -169,6 +172,7 @@ extern "C" { f_fss_basic_rule_e, f_fss_payload_e, f_fss_simple_packet_e, + f_fss_encrypted_simple_packet_e, }; // enum #endif // _di_f_fss_e_ @@ -192,7 +196,7 @@ extern "C" { */ #ifndef _di_f_fss_complete_e_ enum { - f_fss_complete_none_e = 1, + f_fss_complete_none_e = 0, f_fss_complete_end_e, f_fss_complete_full_e, f_fss_complete_full_trim_e, @@ -269,7 +273,7 @@ enum { */ #ifndef _di_f_fss_state_flag_e_ enum { - f_fss_state_flag_none_e = 0, + f_fss_state_flag_none_e = 0x0, f_fss_state_flag_utf_fail_on_valid_not_e = 0x1, }; // enum #endif // _di_f_fss_state_flag_e_ diff --git a/level_0/f_fss/c/fss/payload.c b/level_0/f_fss/c/fss/payload.c new file mode 100644 index 0000000..60a8a09 --- /dev/null +++ b/level_0/f_fss/c/fss/payload.c @@ -0,0 +1,27 @@ +#include "../fss.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_f_fss_payload_s_ + #ifndef _di_f_fss_payload_comment_header_s_ + const f_string_static_t f_fss_payload_comment_header_s = macro_f_string_static_t_initialize_1(F_fss_payload_comment_header_s, 0, F_fss_payload_comment_header_s_length); + #endif // _di_f_fss_payload_comment_header_s_ + + #ifndef _di_f_fss_payload_object_header_s_ + const f_string_static_t f_fss_payload_object_header_s = macro_f_string_static_t_initialize_1(F_fss_payload_object_header_s, 0, F_fss_payload_object_header_s_length); + #endif // _di_f_fss_payload_object_header_s_ + + #ifndef _di_f_fss_payload_object_payload_s_ + const f_string_static_t f_fss_payload_object_payload_s = macro_f_string_static_t_initialize_1(F_fss_payload_object_payload_s, 0, F_fss_payload_object_payload_s_length); + #endif // _di_f_fss_payload_object_payload_s_ + + #ifndef _di_f_fss_payload_object_signature_s_ + const f_string_static_t f_fss_payload_object_signature_s = macro_f_string_static_t_initialize_1(F_fss_payload_object_signature_s, 0, F_fss_payload_object_signature_s_length); + #endif // _di_f_fss_payload_object_signature_s_ +#endif // _di_f_fss_payload_s_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/c/fss/payload.h b/level_0/f_fss/c/fss/payload.h new file mode 100644 index 0000000..28e42b6 --- /dev/null +++ b/level_0/f_fss/c/fss/payload.h @@ -0,0 +1,84 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Defines set data to be used for/by project fss. + * + * This is auto-included by fss.h and should not need to be explicitly included. + */ +#ifndef _F_fss_payload_h +#define _F_fss_payload_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Flags used by the FSS-000E (Simple Packet) write functions. + * + * Values of f_fss_payload_write_*_e: + * - none: No write flag set. + * - comment_header: Print the header comment for the Simple Packet, "# fss-000f\n". + * - header_content: Print the header content. + * - header_object: Print the header object, "header:\n". + * - payload_object: Print the payload object, "payload:\n". + * - signature_content: Print the signature content. + * - signature_object: Print the signature object, "signature:\n". + */ +#ifndef _di_f_fss_payload_write_e_ + enum { + f_fss_payload_write_none_e = 0x0, + f_fss_payload_write_comment_header_e = 0x1, + f_fss_payload_write_header_content_e = 0x2, + f_fss_payload_write_header_object_e = 0x4, + f_fss_payload_write_payload_object_e = 0x8, + f_fss_payload_write_signature_content_e = 0x10, + f_fss_payload_write_signature_object_e = 0x20, + }; // enum +#endif // _di_f_fss_payload_write_e_ + +/** + * FSS Simple Packet strings. + * + * f_fss_payload_*_s: + * - header_comment: The header comment string for Simple Packet (FSS-000E). + * - header_object: The header object. + * - payload_object: The payload object. + * - signature_object: The signature object. + */ +#ifndef _di_f_fss_payload_s_ + #define F_fss_payload_comment_header_s "# fss-000e" + #define F_fss_payload_object_header_s "header:\n" + #define F_fss_payload_object_payload_s "payload:\n" + #define F_fss_payload_object_signature_s "signature:\n" + + #define F_fss_payload_comment_header_s_length 10 + #define F_fss_payload_object_header_s_length 8 + #define F_fss_payload_object_payload_s_length 9 + #define F_fss_payload_object_signature_s_length 11 + + #ifndef _di_f_fss_payload_comment_header_s_ + extern const f_string_static_t f_fss_payload_comment_header_s; + #endif // _di_f_fss_payload_comment_header_s_ + + #ifndef _di_f_fss_payload_object_header_s_ + extern const f_string_static_t f_fss_payload_object_header_s; + #endif // _di_f_fss_payload_object_header_s_ + + #ifndef _di_f_fss_payload_object_payload_s_ + extern const f_string_static_t f_fss_payload_object_payload_s; + #endif // _di_f_fss_payload_object_payload_s_ + + #ifndef _di_f_fss_payload_object_signature_s_ + extern const f_string_static_t f_fss_payload_object_signature_s; + #endif // _di_f_fss_payload_object_signature_s_ +#endif // _di_f_fss_payload_s_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _F_fss_payload_h diff --git a/level_0/f_fss/data/build/settings b/level_0/f_fss/data/build/settings index 64e5be8..bf77e7a 100644 --- a/level_0/f_fss/data/build/settings +++ b/level_0/f_fss/data/build/settings @@ -31,9 +31,9 @@ build_language c build_libraries -lc build_libraries-individual -lf_memory -lf_string -lf_type_array -lf_utf -build_sources_library fss.c fss/common.c fss/item.c fss/named.c fss/nest.c fss/quote.c fss/set.c fss/set_quote.c fss/simple_packet.c +build_sources_library fss.c fss/common.c fss/item.c fss/named.c fss/nest.c fss/payload.c fss/quote.c fss/set.c fss/set_quote.c fss/simple_packet.c -build_sources_headers fss.h fss/common.h fss/item.h fss/named.h fss/nest.h fss/quote.h fss/set.h fss/set_quote.h fss/simple_packet.h +build_sources_headers fss.h fss/common.h fss/item.h fss/named.h fss/nest.h fss/payload.h fss/quote.h fss/set.h fss/set_quote.h fss/simple_packet.h build_script yes build_shared yes diff --git a/level_0/f_fss/data/build/settings-mocks b/level_0/f_fss/data/build/settings-mocks index 4c5a30a..d2815f2 100644 --- a/level_0/f_fss/data/build/settings-mocks +++ b/level_0/f_fss/data/build/settings-mocks @@ -30,10 +30,10 @@ build_language c build_libraries -lc build_libraries-individual -lf_memory -lf_string -lf_type_array -lf_utf -build_sources_library fss.c fss/common.c fss/item.c fss/named.c fss/nest.c fss/quote.c fss/set.c fss/set_quote.c fss/simple_packet.c +build_sources_library fss.c fss/common.c fss/item.c fss/named.c fss/nest.c fss/payload.c fss/quote.c fss/set.c fss/set_quote.c fss/simple_packet.c build_sources_library ../../tests/unit/c/mock-fss.c -build_sources_headers fss.h fss/common.h fss/item.h fss/named.h fss/nest.h fss/quote.h fss/set.h fss/set_quote.h fss/simple_packet.h +build_sources_headers fss.h fss/common.h fss/item.h fss/named.h fss/nest.h fss/payload.h fss/quote.h fss/set.h fss/set_quote.h fss/simple_packet.h build_script yes build_shared yes diff --git a/level_1/fl_fss/c/fss/basic.h b/level_1/fl_fss/c/fss/basic.h index fced4c0..358c533 100644 --- a/level_1/fl_fss/c/fss/basic.h +++ b/level_1/fl_fss/c/fss/basic.h @@ -55,6 +55,8 @@ extern "C" { * Error bit designates an error but must be passed along with F_interrupt. * All other statuses are ignored. * + * Must not be NULL. + * * This alters state.status: * F_fss_found_content on success and content was found (start location is at end of content). * F_fss_found_content_not on success and no content was found (start location is after character designating this is not a content). @@ -112,6 +114,8 @@ extern "C" { * When state.interrupt() returns, only F_interrupt and F_interrupt_not are processed. * Error bit designates an error but must be passed along with F_interrupt. * + * Must not be NULL. + * * This alters state.status: * F_okay on success. * F_okay_eos on success after reaching the end of the buffer. @@ -165,6 +169,8 @@ extern "C" { * Error bit designates an error but must be passed along with F_interrupt. * All other statuses are ignored. * + * Must not be NULL. + * * This alters state.status: * F_fss_found_object on success and object was found (start location is at end of object). * F_fss_found_object_content_not on success but object ended at the line so there can be no content. @@ -236,6 +242,8 @@ extern "C" { * Error bit designates an error but must be passed along with F_interrupt. * All other statuses are ignored. * + * Must not be NULL. + * * This alters state.status: * F_okay on success. * F_okay_eos on success after reaching the end of the buffer. diff --git a/level_1/fl_fss/c/fss/basic_list.h b/level_1/fl_fss/c/fss/basic_list.h index 02fdf2a..97bc733 100644 --- a/level_1/fl_fss/c/fss/basic_list.h +++ b/level_1/fl_fss/c/fss/basic_list.h @@ -60,6 +60,8 @@ extern "C" { * Error bit designates an error but must be passed along with F_interrupt. * All other statuses are ignored. * + * Must not be NULL. + * * This alters state.status: * F_fss_found_content on success and content was found (start location is at end of content). * F_fss_found_content_not on success and no content was found (start location is after character designating this is not a content). @@ -126,6 +128,8 @@ extern "C" { * Error bit designates an error but must be passed along with F_interrupt. * All other statuses are ignored. * + * Must not be NULL. + * * This alters state.status: * F_okay on success. * F_okay_eol on success after reaching the end of the line. @@ -184,6 +188,8 @@ extern "C" { * Error bit designates an error but must be passed along with F_interrupt. * All other statuses are ignored. * + * Must not be NULL. + * * This alters state.status: * F_fss_found_object on success and object was found (start location is at end of object). * F_fss_found_object_not on success and no object was found (start location is after character designating this is not an object). @@ -251,6 +257,8 @@ extern "C" { * Error bit designates an error but must be passed along with F_interrupt. * All other statuses are ignored. * + * Must not be NULL. + * * This alters state.status: * F_okay on success. * F_okay_eos on success after reaching the end of the buffer. diff --git a/level_1/fl_fss/c/fss/embedded_list.h b/level_1/fl_fss/c/fss/embedded_list.h index b229ae3..bbc0b85 100644 --- a/level_1/fl_fss/c/fss/embedded_list.h +++ b/level_1/fl_fss/c/fss/embedded_list.h @@ -64,6 +64,8 @@ extern "C" { * Error bit designates an error but must be passed along with F_interrupt. * All other statuses are ignored. * + * Must not be NULL. + * * This alters state.status: * F_fss_found_content on success and content was found (start location is at end of content). * F_fss_found_content_not on success and no content was found (start location is after character designating this is not a content). @@ -135,6 +137,8 @@ extern "C" { * Error bit designates an error but must be passed along with F_interrupt. * All other statuses are ignored. * + * Must not be NULL. + * * This alters state.status: * F_okay on success. * F_okay_eos on success after reaching the end of the buffer. @@ -192,6 +196,8 @@ extern "C" { * Error bit designates an error but must be passed along with F_interrupt. * All other statuses are ignored. * + * Must not be NULL. + * * This alters state.status: * F_fss_found_object on success and object was found (start location is at end of object). * F_fss_found_object_not on success and no object was found (start location is after character designating this is not an object). @@ -259,6 +265,8 @@ extern "C" { * Error bit designates an error but must be passed along with F_interrupt. * All other statuses are ignored. * + * Must not be NULL. + * * This alters state.status: * F_okay on success. * F_okay_eos on success after reaching the end of the buffer. diff --git a/level_1/fl_fss/c/fss/extended.h b/level_1/fl_fss/c/fss/extended.h index 70563b5..8c3e69d 100644 --- a/level_1/fl_fss/c/fss/extended.h +++ b/level_1/fl_fss/c/fss/extended.h @@ -58,6 +58,8 @@ extern "C" { * Error bit designates an error but must be passed along with F_interrupt. * All other statuses are ignored. * + * Must not be NULL. + * * This alters state.status: * F_fss_found_content on success and content was found (start location is at end of content). * F_fss_found_content_not on success and no content was found (start location is after character designating this is not a content). @@ -126,6 +128,8 @@ extern "C" { * Error bit designates an error but must be passed along with F_interrupt. * All other statuses are ignored. * + * Must not be NULL. + * * This alters state.status: * F_okay on success. * F_okay_eos on success after reaching the end of the buffer. @@ -188,6 +192,8 @@ extern "C" { * Error bit designates an error but must be passed along with F_interrupt. * All other statuses are ignored. * + * Must not be NULL. + * * This alters state.status: * F_fss_found_object on success and object was found (start location is at end of object). * F_fss_found_object_content_not on success but object ended at the line so there can be no content. @@ -258,6 +264,8 @@ extern "C" { * Error bit designates an error but must be passed along with F_interrupt. * All other statuses are ignored. * + * Must not be NULL. + * * This alters state.status: * F_okay on success. * F_okay_eos on success after reaching the end of the buffer. diff --git a/level_1/fl_fss/c/fss/extended_list.h b/level_1/fl_fss/c/fss/extended_list.h index 5b656b5..0f0b7df 100644 --- a/level_1/fl_fss/c/fss/extended_list.h +++ b/level_1/fl_fss/c/fss/extended_list.h @@ -62,6 +62,8 @@ extern "C" { * Error bit designates an error but must be passed along with F_interrupt. * All other statuses are ignored. * + * Must not be NULL. + * * This alters state.status: * F_fss_found_content on success and content was found (start location is at end of content). * F_fss_found_content_not on success and no content was found (start location is after character designating this is not a content). @@ -133,6 +135,8 @@ extern "C" { * Error bit designates an error but must be passed along with F_interrupt. * All other statuses are ignored. * + * Must not be NULL. + * * This alters state.status: * F_okay on success. * F_okay_eos on success after reaching the end of the buffer. @@ -190,6 +194,8 @@ extern "C" { * Error bit designates an error but must be passed along with F_interrupt. * All other statuses are ignored. * + * Must not be NULL. + * * This alters state.status: * F_fss_found_object on success and object was found (start location is at end of object). * F_fss_found_object_not on success and no object was found (start location is after character designating this is not an object). @@ -257,6 +263,8 @@ extern "C" { * Error bit designates an error but must be passed along with F_interrupt. * All other statuses are ignored. * + * Must not be NULL. + * * This alters state.status: * F_okay on success. * F_okay_eos on success after reaching the end of the buffer. diff --git a/level_1/fl_fss/c/fss/payload.c b/level_1/fl_fss/c/fss/payload.c new file mode 100644 index 0000000..bc9f29d --- /dev/null +++ b/level_1/fl_fss/c/fss/payload.c @@ -0,0 +1,181 @@ +#include "payload.h" +#include "../private-fss.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_fl_fss_payload_header_write_ + void fl_fss_payload_header_write(const f_abstruse_maps_t headers, const f_abstruse_maps_t * const signatures, f_string_dynamic_t * const destination, f_state_t * const state) { + #ifndef _di_level_1_parameter_checking_ + if (!state) return; + + if (!destination) { + state->status = F_status_set_error(F_parameter); + + return; + } + #endif // _di_level_1_parameter_checking_ + + if (state->code & f_fss_payload_write_comment_header_e) { + // @todo flag for writing "# fss-000c" + } + + if (state->code & f_fss_payload_write_header_object_e) { + // @todo flag for writing "header:" + } + +/* + if (state->code & f_fss_payload_write_header_content_e) { + for (f_number_unsigned_t i = 0; i < headers.used ; ++i) { + + switch () { + f_abstruse_none_e: + f_abstruse_void_e: + f_abstruse_voids_e: + f_abstruse_strings_e: + break; + + f_abstruse_signed_e: + f_abstruse_unsigned_e: + // @todo + break; + + f_abstruse_int8s_e: + f_abstruse_int16s_e: + f_abstruse_int32s_e: + f_abstruse_int64s_e: + f_abstruse_signeds_e: + // @todo + break; + + f_abstruse_uint8s_e: + f_abstruse_uint16s_e: + f_abstruse_uint32s_e: + f_abstruse_uint64s_e: + f_abstruse_unsigneds_e: + // @todo + break; + + f_abstruse_string_e: + f_abstruse_strings_e: + // @todo + break; + + f_abstruse_dynamic_e: + f_abstruse_dynamics_e: + // @todo + break; + + f_abstruse_map_e: + f_abstruse_maps_e: + // @todo + break; + + f_abstruse_map_multi_e: + f_abstruse_map_multis_e: + // @todo + break; + + f_abstruse_quantity_e: + f_abstruse_quantitys_e: + // @todo + break; + + f_abstruse_range_e: + f_abstruse_ranges_e: + // @todo + break; + + f_abstruse_triple_e: + f_abstruse_triples_e: + // @todo + break; + } + } // for + } + + if (state->code & f_fss_payload_write_signature_object_e) { + // @todo flag for writing "signature:" + } + + if ((state->code & f_fss_payload_write_signature_content_e) && !signatures) { + for (f_number_unsigned_t i = 0; i < signatures->used ; ++i) { + + switch () { + f_abstruse_none_e: + f_abstruse_void_e: + f_abstruse_voids_e: + f_abstruse_strings_e: + break; + + f_abstruse_signed_e: + f_abstruse_unsigned_e: + // @todo + break; + + f_abstruse_int8s_e: + f_abstruse_int16s_e: + f_abstruse_int32s_e: + f_abstruse_int64s_e: + f_abstruse_signeds_e: + // @todo + break; + + f_abstruse_uint8s_e: + f_abstruse_uint16s_e: + f_abstruse_uint32s_e: + f_abstruse_uint64s_e: + f_abstruse_unsigneds_e: + // @todo + break; + + f_abstruse_string_e: + f_abstruse_strings_e: + // @todo + break; + + f_abstruse_dynamic_e: + f_abstruse_dynamics_e: + // @todo + break; + + f_abstruse_map_e: + f_abstruse_maps_e: + // @todo + break; + + f_abstruse_map_multi_e: + f_abstruse_map_multis_e: + // @todo + break; + + f_abstruse_quantity_e: + f_abstruse_quantitys_e: + // @todo + break; + + f_abstruse_range_e: + f_abstruse_ranges_e: + // @todo + break; + + f_abstruse_triple_e: + f_abstruse_triples_e: + // @todo + break; + } + } // for + } +*/ + if (state->code & f_fss_payload_write_payload_object_e) { + // @todo flag for writing "payload:" + } + + state->status = F_okay; + } +#endif // _di_fl_fss_payload_header_write_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_1/fl_fss/c/fss/payload.h b/level_1/fl_fss/c/fss/payload.h new file mode 100644 index 0000000..729328b --- /dev/null +++ b/level_1/fl_fss/c/fss/payload.h @@ -0,0 +1,93 @@ +/** + * FLL - Level 1 + * + * Project: FSS + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * This is the fss-000e implementation. + */ +#ifndef _FL_fss_payload_h +#define _FL_fss_payload_h + +// Libc includes. +#include +#include + +// FLL-0 includes. +#include +#include +#include +#include +#include +#include +#include + +// FLL-1 includes. +#include + +#ifdef __cplusplus +extern "C" { +#endif + +// @todo fl_fss_payload_header_read() to build an array of f_abstruse for the headers? + +/** + * Write standard header of the FSS-000E (Payload). + * + * This implementation does not handle the following f_abstruse_*_e: + * - none. + * - strings. + * - void. + * - voids. + * + * @param headers + * An abstruse map representing individual headers. + * Ultimately, all headers are cast to a string or a binary representation (depending on implementation). + * @param signatures + * (optional) An abstruse map representing individual signature headers. + * Ultimately, all headers are cast to a string or a binary representation (depending on implementation). + * Set to NULL to not use. + * @param destination + * The string in which the resulting header is appended to. + * Must not be NULL. + * @param state + * @todo update this as appropriate after implementing this function. + * A state for providing flags and handling interrupts during long running operations. + * There is no state.handle(). + * There is no "callbacks" structure. + * There is no data structure passed to these functions. + * + * When state.interrupt() returns, only F_interrupt and F_interrupt_not are processed. + * Error bit designates an error but must be passed along with F_interrupt. + * All other statuses are ignored. + * + * Must not be NULL. + * + * This alters state.status: + * F_okay on success. + * F_okay_eos on success after reaching the end of the buffer. + * F_okay_stop on success after reaching the range stop. + * F_data_not if object is empty (object.used is 0). + * F_data_not_eos no data to write due start location being greater than or equal to buffer size. + * F_data_not_stop no data to write due start location being greater than stop location. + * + * F_interrupt (with error bit) if stopping due to an interrupt. + * F_okay_eol (with error bit) after reaching an EOL, which is not supported by the standard. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_array_increase(). + * Errors (with error bit) from: f_memory_array_increase_by(). + * + * @see f_memory_array_increase() + * @see f_memory_array_increase_by() + */ +#ifndef _di_fl_fss_payload_header_write_ + extern void fl_fss_payload_header_write(const f_abstruse_maps_t headers, const f_abstruse_maps_t * const signatures, f_string_dynamic_t * const destination, f_state_t * const state); +#endif // _di_fl_fss_payload_header_write_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _FL_fss_payload_h diff --git a/level_1/fl_fss/data/build/dependencies b/level_1/fl_fss/data/build/dependencies index 9877054..e01bf7b 100644 --- a/level_1/fl_fss/data/build/dependencies +++ b/level_1/fl_fss/data/build/dependencies @@ -5,5 +5,6 @@ f_status f_memory f_string f_utf +f_abstruse f_file f_fss diff --git a/level_1/fl_fss/data/build/settings b/level_1/fl_fss/data/build/settings index 48f9f61..84ebe7e 100644 --- a/level_1/fl_fss/data/build/settings +++ b/level_1/fl_fss/data/build/settings @@ -30,11 +30,11 @@ build_indexer_arguments rcs build_language c build_libraries -lc -build_libraries-individual -lf_file -lf_fss -lf_memory -lf_string -lf_type_array -lf_utf +build_libraries-individual -lf_abstruse -lf_file -lf_fss -lf_memory -lf_string -lf_type_array -lf_utf -build_sources_library private-fss.c fss/basic.c fss/basic_list.c fss/embedded_list.c fss/extended.c fss/extended_list.c +build_sources_library private-fss.c fss/basic.c fss/basic_list.c fss/embedded_list.c fss/extended.c fss/extended_list.c fss/payload.c -build_sources_headers fss.h fss/basic.h fss/basic_list.h fss/embedded_list.h fss/extended.h fss/extended_list.h +build_sources_headers fss.h fss/basic.h fss/basic_list.h fss/embedded_list.h fss/extended.h fss/extended_list.h fss/payload.h build_script yes build_shared yes diff --git a/level_3/fake/data/build/dependencies b/level_3/fake/data/build/dependencies index 447774b..bf212aa 100644 --- a/level_3/fake/data/build/dependencies +++ b/level_3/fake/data/build/dependencies @@ -6,6 +6,7 @@ f_memory f_type_array f_string f_utf +f_abstruse f_account f_capability f_color