]> Kevux Git Server - fll/commitdiff
Progress: Begin adding FSS Payload processing code.
authorKevin Day <thekevinday@gmail.com>
Thu, 5 Oct 2023 04:19:44 +0000 (23:19 -0500)
committerKevin Day <thekevinday@gmail.com>
Thu, 5 Oct 2023 04:19:44 +0000 (23:19 -0500)
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.

22 files changed:
build/level_0/settings
build/level_1/settings
build/monolithic/settings
build/scripts/test.sh
build/stand_alone/fake.config.h
build/stand_alone/fake.settings
level_0/f_fss/c/fss.h
level_0/f_fss/c/fss/common.h
level_0/f_fss/c/fss/payload.c [new file with mode: 0644]
level_0/f_fss/c/fss/payload.h [new file with mode: 0644]
level_0/f_fss/data/build/settings
level_0/f_fss/data/build/settings-mocks
level_1/fl_fss/c/fss/basic.h
level_1/fl_fss/c/fss/basic_list.h
level_1/fl_fss/c/fss/embedded_list.h
level_1/fl_fss/c/fss/extended.h
level_1/fl_fss/c/fss/extended_list.h
level_1/fl_fss/c/fss/payload.c [new file with mode: 0644]
level_1/fl_fss/c/fss/payload.h [new file with mode: 0644]
level_1/fl_fss/data/build/dependencies
level_1/fl_fss/data/build/settings
level_3/fake/data/build/dependencies

index 745f3c530174ec101b3d9643ac45742248599700..0ffaf7b64055d2d2c0eaf986119651ad710e602f 100644 (file)
@@ -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
index 924c12e07e8f0630b8f8c25a7b488b9642f3f3dd..fb4658eb8b16b072fed3e7caad539d60db060583 100644 (file)
@@ -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
index bd861a140082c0505dad5afec80de619b3e05c10..886e92ba5735cae7b3bc83efc06034d362d26895 100644 (file)
@@ -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
index 98d6925e2b3ee4ca06b99f778ea0831e6d2b43be..60117c830e47ca1fd821c2a2af422e933ebb5521 100644 (file)
@@ -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"
 
index 848e7c205851b730440b6698f5f438a57dbe756e..8d20155aadf3d45d8065a99b4d7d02c9e56fe629 100644 (file)
 //   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_
 #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_
 //#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_
 #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_
 #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_
 #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_
 #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_
 #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_
 #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_
index 40876f0b5b7005c6c29bdc29069aeb544c7524e1..5d17a15245798a2e0ce22b0e2633e41e04e9f50e 100644 (file)
@@ -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
index b7ce0968805b108ec4b925d15020ade72194370a..48b9e8b247b579b8804cd63aa799492bc71783f0 100644 (file)
@@ -30,6 +30,7 @@
 #include <fll/level_0/fss/set.h>
 #include <fll/level_0/fss/set_quote.h>
 #include <fll/level_0/fss/simple_packet.h>
+#include <fll/level_0/fss/payload.h>
 
 #ifdef __cplusplus
 extern "C" {
index f212755f1487eb4d25079e49b28b1bab6e2a7d98..dbfd475ea8a59c1515699074b1773b427af279b7 100644 (file)
@@ -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 (file)
index 0000000..60a8a09
--- /dev/null
@@ -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 (file)
index 0000000..28e42b6
--- /dev/null
@@ -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
index 64e5be8883cc7370c16367c8f5217efd59f7bba8..bf77e7a0650be4ec3b4fc5d854eddbeb5c50ea3d 100644 (file)
@@ -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
index 4c5a30a45692807ddb6bed5d0077c8fb6fd58d99..d2815f20686fe13fa2e73e8c078426092d7abcc2 100644 (file)
@@ -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
index fced4c0043597a47194901a9083244cb40538043..358c533b78f1500fd61d15bbe267103d3d44e506 100644 (file)
@@ -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.
index 02fdf2a0e68c53c8b397e62e87baec9f4a031785..97bc73385ef64a2d0288afae40d7e820ed158a7e 100644 (file)
@@ -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.
index b229ae3030e87ec4e47a3564e29a53dba15376fc..bbc0b8547203b2ba6d45a23c6835356d94995c98 100644 (file)
@@ -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.
index 70563b58601a504a4b07471d4d7c746508df1145..8c3e69d6f4f4838833a54cd28797bf3e1eb3891f 100644 (file)
@@ -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.
index 5b656b5d78b319de45bce01224f84326ba05bd14..0f0b7df8487b1e456a026805895fa0fbd51bd67e 100644 (file)
@@ -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 (file)
index 0000000..bc9f29d
--- /dev/null
@@ -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 (file)
index 0000000..729328b
--- /dev/null
@@ -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 <ctype.h>
+#include <string.h>
+
+// FLL-0 includes.
+#include <fll/level_0/type.h>
+#include <fll/level_0/status.h>
+#include <fll/level_0/memory.h>
+#include <fll/level_0/string.h>
+#include <fll/level_0/utf.h>
+#include <fll/level_0/abstruse.h>
+#include <fll/level_0/fss.h>
+
+// FLL-1 includes.
+#include <fll/level_1/fss.h>
+
+#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
index 987705444b2b80a63c6b9a50d6421a1457964acc..e01bf7b5867645c21759972637b8029aa2280818 100644 (file)
@@ -5,5 +5,6 @@ f_status
 f_memory
 f_string
 f_utf
+f_abstruse
 f_file
 f_fss
index 48f9f610aa604aa25ed512d6a3974f5382e82d1f..84ebe7eb9a0b0e9e04bbac9387ce36ca451c3fa1 100644 (file)
@@ -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
index 447774bf6aa49add8523b24397ef8bc92495470d..bf212aa5a358c0560ccc5c83db46b9627d6ddf52 100644 (file)
@@ -6,6 +6,7 @@ f_memory
 f_type_array
 f_string
 f_utf
+f_abstruse
 f_account
 f_capability
 f_color