From d74d8c69dc63f547fc05cab71c94c606e959f238 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Tue, 1 Feb 2022 23:45:26 -0600 Subject: [PATCH] Progress: Continue mass converting to f_string_static_t. --- level_0/f_console/c/console-common.h | 2 + level_0/f_file/c/file-common.c | 19 ++ level_0/f_file/c/file-common.h | 230 ++++++++++----- level_0/f_file/c/file.c | 15 +- level_1/fl_directory/c/directory-common.h | 2 +- level_1/fl_directory/c/directory.c | 8 +- level_1/fl_directory/c/private-directory.c | 8 +- level_1/fl_print/c/print.h | 2 +- level_1/fl_utf_file/c/utf_file.c | 9 +- level_2/fll_control_group/c/control_group.c | 1 + level_2/fll_execute/c/execute.c | 14 +- level_2/fll_execute/c/private-execute.c | 37 +-- level_2/fll_execute/c/private-execute.h | 2 + level_2/fll_file/c/file.c | 6 +- level_2/fll_path/c/path.c | 24 +- level_2/fll_path/c/path.h | 13 +- level_3/controller/c/controller.c | 34 ++- level_3/controller/c/controller/controller.? | 0 .../controller/c/controller/private-controller.c | 59 ++-- level_3/controller/c/entry/private-entry.c | 12 +- level_3/controller/c/lock/private-lock_print.c | 2 +- level_3/controller/c/rule/private-rule.c | 51 ++-- level_3/controller/c/rule/private-rule.h | 17 ++ level_3/controller/c/rule/private-rule_print.c | 19 +- level_3/controller/c/rule/private-rule_print.h | 16 +- level_3/controller/c/thread/private-thread.c | 4 +- level_3/controller/c/thread/private-thread_entry.c | 2 +- .../controller/c/thread/private-thread_process.c | 10 +- level_3/fake/c/common.c | 2 + level_3/fake/c/common.h | 6 +- level_3/fake/c/private-build-library.c | 309 +++++++++++---------- level_3/fake/c/private-build-load.c | 102 +++---- level_3/fake/c/private-build-objects.c | 57 ++-- level_3/fake/c/private-build-program.c | 77 ++--- level_3/fake/c/private-build-skeleton.c | 10 +- level_3/fake/c/private-build.c | 74 +++-- level_3/fake/c/private-build.h | 22 +- level_3/fake/c/private-clean.c | 6 +- level_3/fake/c/private-common.h | 6 +- level_3/fake/c/private-fake-path_generate.c | 10 +- level_3/fake/c/private-fake.c | 21 +- level_3/fake/c/private-fake.h | 6 +- level_3/fake/c/private-make-load_fakefile.c | 12 +- level_3/fake/c/private-make-operate.c | 4 +- level_3/fake/c/private-make-operate_process.c | 4 +- level_3/fake/c/private-make-operate_process_type.c | 168 +++++------ level_3/fake/c/private-make-operate_validate.c | 66 ++--- level_3/fake/c/private-make.c | 4 +- level_3/fake/c/private-print.c | 2 +- level_3/fake/c/private-print.h | 2 +- level_3/fake/c/private-skeleton.c | 19 +- level_3/firewall/c/firewall.h | 2 +- level_3/firewall/c/private-firewall.c | 22 +- .../fss_basic_list_read/c/fss_basic_list_read.c | 12 +- level_3/fss_basic_read/c/fss_basic_read.c | 12 +- .../c/fss_embedded_list_read.c | 12 +- .../c/fss_extended_list_read.c | 12 +- level_3/fss_extended_read/c/fss_extended_read.c | 12 +- level_3/fss_identify/c/private-identify.c | 8 +- level_3/fss_payload_read/c/fss_payload_read.c | 12 +- level_3/iki_write/c/iki_write.c | 2 +- level_3/utf8/c/private-print.c | 6 +- level_3/utf8/c/private-print.h | 4 +- level_3/utf8/c/utf8.c | 4 +- 64 files changed, 991 insertions(+), 736 deletions(-) delete mode 100644 level_3/controller/c/controller/controller.? diff --git a/level_0/f_console/c/console-common.h b/level_0/f_console/c/console-common.h index cff7738..b756452 100644 --- a/level_0/f_console/c/console-common.h +++ b/level_0/f_console/c/console-common.h @@ -342,6 +342,8 @@ extern "C" { } f_console_parameters_t; #define f_console_parameters_t_initialize {0, f_string_dynamics_t_initialize, 0 } + + #define macro_f_console_parameters_initialize(parameter, used) { parameter, f_string_dynamics_t_initialize, used } #endif // _di_f_console_parameters_t_ /** diff --git a/level_0/f_file/c/file-common.c b/level_0/f_file/c/file-common.c index 4a93fc5..1bbb235 100644 --- a/level_0/f_file/c/file-common.c +++ b/level_0/f_file/c/file-common.c @@ -23,26 +23,45 @@ extern "C" { #endif // _di_f_file_type_ #ifndef _di_f_file_operation_strings_ + const f_string_static_t f_file_operation_access_s = macro_f_string_static_t_initialize(F_file_operation_access_s, 0, F_file_operation_access_s_length); + const f_string_static_t f_file_operation_analyze_s = macro_f_string_static_t_initialize(F_file_operation_analyze_s, 0, F_file_operation_analyze_s_length); const f_string_static_t f_file_operation_append_s = macro_f_string_static_t_initialize(F_file_operation_append_s, 0, F_file_operation_append_s_length); + const f_string_static_t f_file_operation_change_group_s = macro_f_string_static_t_initialize(F_file_operation_change_group_s, 0, F_file_operation_change_group_s_length); + const f_string_static_t f_file_operation_change_mode_s = macro_f_string_static_t_initialize(F_file_operation_change_mode_s, 0, F_file_operation_change_mode_s_length); + const f_string_static_t f_file_operation_change_owner_s = macro_f_string_static_t_initialize(F_file_operation_change_owner_s, 0, F_file_operation_change_owner_s_length); + const f_string_static_t f_file_operation_change_type_s = macro_f_string_static_t_initialize(F_file_operation_change_type_s, 0, F_file_operation_change_type_s_length); const f_string_static_t f_file_operation_clone_s = macro_f_string_static_t_initialize(F_file_operation_clone_s, 0, F_file_operation_clone_s_length); const f_string_static_t f_file_operation_close_s = macro_f_string_static_t_initialize(F_file_operation_close_s, 0, F_file_operation_close_s_length); const f_string_static_t f_file_operation_concatenate_s = macro_f_string_static_t_initialize(F_file_operation_concatenate_s, 0, F_file_operation_concatenate_s_length); const f_string_static_t f_file_operation_connect_s = macro_f_string_static_t_initialize(F_file_operation_connect_s, 0, F_file_operation_connect_s_length); const f_string_static_t f_file_operation_copy_s = macro_f_string_static_t_initialize(F_file_operation_copy_s, 0, F_file_operation_copy_s_length); const f_string_static_t f_file_operation_create_s = macro_f_string_static_t_initialize(F_file_operation_create_s, 0, F_file_operation_create_s_length); + const f_string_static_t f_file_operation_decrypt_s = macro_f_string_static_t_initialize(F_file_operation_decrypt_s, 0, F_file_operation_decrypt_s_length); const f_string_static_t f_file_operation_delete_s = macro_f_string_static_t_initialize(F_file_operation_delete_s, 0, F_file_operation_delete_s_length); const f_string_static_t f_file_operation_disconnect_s = macro_f_string_static_t_initialize(F_file_operation_disconnect_s, 0, F_file_operation_disconnect_s_length); + const f_string_static_t f_file_operation_encrypt_s = macro_f_string_static_t_initialize(F_file_operation_encrypt_s, 0, F_file_operation_encrypt_s_length); const f_string_static_t f_file_operation_find_s = macro_f_string_static_t_initialize(F_file_operation_find_s, 0, F_file_operation_find_s_length); const f_string_static_t f_file_operation_from_s = macro_f_string_static_t_initialize(F_file_operation_from_s, 0, F_file_operation_from_s_length); const f_string_static_t f_file_operation_flush_s = macro_f_string_static_t_initialize(F_file_operation_flush_s, 0, F_file_operation_flush_s_length); + const f_string_static_t f_file_operation_get_group_s = macro_f_string_static_t_initialize(F_file_operation_get_group_s, 0, F_file_operation_get_group_s_length); + const f_string_static_t f_file_operation_get_mode_s = macro_f_string_static_t_initialize(F_file_operation_get_mode_s, 0, F_file_operation_get_mode_s_length); + const f_string_static_t f_file_operation_get_owner_s = macro_f_string_static_t_initialize(F_file_operation_get_owner_s, 0, F_file_operation_get_owner_s_length); + const f_string_static_t f_file_operation_get_type_s = macro_f_string_static_t_initialize(F_file_operation_get_type_s, 0, F_file_operation_get_type_s_length); + const f_string_static_t f_file_operation_identify_s = macro_f_string_static_t_initialize(F_file_operation_identify_s, 0, F_file_operation_identify_s_length); const f_string_static_t f_file_operation_link_s = macro_f_string_static_t_initialize(F_file_operation_link_s, 0, F_file_operation_link_s_length); const f_string_static_t f_file_operation_list_s = macro_f_string_static_t_initialize(F_file_operation_list_s, 0, F_file_operation_list_s_length); + const f_string_static_t f_file_operation_move_s = macro_f_string_static_t_initialize(F_file_operation_move_s, 0, F_file_operation_move_s_length); const f_string_static_t f_file_operation_open_s = macro_f_string_static_t_initialize(F_file_operation_open_s, 0, F_file_operation_open_s_length); + const f_string_static_t f_file_operation_pipe_s = macro_f_string_static_t_initialize(F_file_operation_pipe_s, 0, F_file_operation_pipe_s_length); const f_string_static_t f_file_operation_process_s = macro_f_string_static_t_initialize(F_file_operation_process_s, 0, F_file_operation_process_s_length); const f_string_static_t f_file_operation_read_s = macro_f_string_static_t_initialize(F_file_operation_read_s, 0, F_file_operation_read_s_length); const f_string_static_t f_file_operation_receive_s = macro_f_string_static_t_initialize(F_file_operation_receive_s, 0, F_file_operation_receive_s_length); + const f_string_static_t f_file_operation_rename_s = macro_f_string_static_t_initialize(F_file_operation_rename_s, 0, F_file_operation_rename_s_length); const f_string_static_t f_file_operation_send_s = macro_f_string_static_t_initialize(F_file_operation_send_s, 0, F_file_operation_send_s_length); + const f_string_static_t f_file_operation_shred_s = macro_f_string_static_t_initialize(F_file_operation_shred_s, 0, F_file_operation_shred_s_length); + const f_string_static_t f_file_operation_stat_s = macro_f_string_static_t_initialize(F_file_operation_stat_s, 0, F_file_operation_stat_s_length); const f_string_static_t f_file_operation_to_s = macro_f_string_static_t_initialize(F_file_operation_to_s, 0, F_file_operation_to_s_length); + const f_string_static_t f_file_operation_touch_s = macro_f_string_static_t_initialize(F_file_operation_touch_s, 0, F_file_operation_touch_s_length); const f_string_static_t f_file_operation_truncate_s = macro_f_string_static_t_initialize(F_file_operation_truncate_s, 0, F_file_operation_truncate_s_length); const f_string_static_t f_file_operation_unlink_s = macro_f_string_static_t_initialize(F_file_operation_unlink_s, 0, F_file_operation_unlink_s_length); const f_string_static_t f_file_operation_verify_s = macro_f_string_static_t_initialize(F_file_operation_verify_s, 0, F_file_operation_verify_s_length); diff --git a/level_0/f_file/c/file-common.h b/level_0/f_file/c/file-common.h index d11b6e7..bccf3ee 100644 --- a/level_0/f_file/c/file-common.h +++ b/level_0/f_file/c/file-common.h @@ -384,105 +384,181 @@ extern "C" { * Provide common file operation strings. * * F_file_operation_*: - * - append: Append to a file. - * - clone: Clone a file. - * - close: Close a file. - * - concatenate: Concatenate a file. - * - connect: Connect to a file (such as a socket file). - * - copy: Copy a file. - * - create: Create a file. - * - delete: Delete a file. - * - disconnect: Disconnect from a file (such as a socket file). - * - find: Find a file. - * - from: Do something from a file. - * - flush: Flush a file. - * - link: Link a file. - * - list: List a file. - * - open: Open a file. - * - process: Process a file. - * - read: Read a file. - * - receive: Receive a file. - * - send: Send a file. - * - to: Do someting to a file. - * - truncate: Truncate a file. - * - unlink: Unlink a file. - * - verify: Verify a file. - * - wipe: Wipe a file. - * - write: Write a file. + * - access: Access a file. + * - analyze: Analyze a file. + * - append: Append to a file. + * - change_group: Change group of a file. + * - change_mode: Change mode of a file (read, write, execute, etc.. permissions). + * - change_owner: Change owner of a file. + * - change_type: Change type of a file. + * - clone: Clone a file. + * - close: Close a file. + * - concatenate: Concatenate a file. + * - connect: Connect to a file (such as a socket file). + * - copy: Copy a file. + * - create: Create a file. + * - decrypt: Decrypt a file. + * - delete: Delete a file. + * - disconnect: Disconnect from a file (such as a socket file). + * - encrypt: Encrypt a file. + * - find: Find a file. + * - from: Do something from a file. + * - flush: Flush a file. + * - get_group: Get group of a file. + * - get_mode: Get mode of a file (read, write, execute, etc.. permissions). + * - get_owner: Get owner of a file. + * - get_type: Get type of a file. + * - identify: Identify a file. + * - link: Link a file. + * - list: List a file. + * - move: Move a file. + * - open: Open a file. + * - pipe: Pipe a file. + * - process: Process a file. + * - read: Read a file. + * - receive: Receive a file. + * - rename: Rename a file. + * - send: Send a file. + * - shred: Shred a file. + * - stat: Determine file statistics. + * - to: Do someting to a file. + * - touch: Touch a file (Create it if it does not exist or update its last write time stamp). + * - truncate: Truncate a file. + * - unlink: Unlink a file. + * - verify: Verify a file. + * - wipe: Wipe a file. + * - write: Write a file. */ #ifndef _di_f_file_operation_strings_ - #define F_file_operation_append_s "append" - #define F_file_operation_clone_s "clone" - #define F_file_operation_close_s "close" - #define F_file_operation_concatenate_s "concatenate" - #define F_file_operation_connect_s "connect" - #define F_file_operation_copy_s "copy" - #define F_file_operation_create_s "create" - #define F_file_operation_delete_s "delete" - #define F_file_operation_disconnect_s "disconnect" - #define F_file_operation_find_s "find" - #define F_file_operation_from_s "from" - #define F_file_operation_flush_s "flush" - #define F_file_operation_link_s "link" - #define F_file_operation_list_s "list" - #define F_file_operation_open_s "open" - #define F_file_operation_process_s "process" - #define F_file_operation_read_s "read" - #define F_file_operation_receive_s "receive" - #define F_file_operation_send_s "send" - #define F_file_operation_to_s "to" - #define F_file_operation_truncate_s "truncate" - #define F_file_operation_unlink_s "unlink" - #define F_file_operation_verify_s "verify" - #define F_file_operation_wipe_s "wipe" - #define F_file_operation_write_s "write" - - #define F_file_operation_append_s_length 6 - #define F_file_operation_clone_s_length 5 - #define F_file_operation_close_s_length 5 - #define F_file_operation_concatenate_s_length 11 - #define F_file_operation_connect_s_length 7 - #define F_file_operation_copy_s_length 4 - #define F_file_operation_create_s_length 6 - #define F_file_operation_delete_s_length 6 - #define F_file_operation_disconnect_s_length 10 - #define F_file_operation_find_s_length 4 - #define F_file_operation_from_s_length 4 - #define F_file_operation_flush_s_length 5 - #define F_file_operation_link_s_length 4 - #define F_file_operation_list_s_length 4 - #define F_file_operation_open_s_length 4 - #define F_file_operation_process_s_length 7 - #define F_file_operation_read_s_length 4 - #define F_file_operation_receive_s_length 7 - #define F_file_operation_send_s_length 4 - #define F_file_operation_to_s_length 2 - #define F_file_operation_truncate_s_length 8 - #define F_file_operation_unlink_s_length 6 - #define F_file_operation_verify_s_length 6 - #define F_file_operation_wipe_s_length 4 - #define F_file_operation_write_s_length 5 - + #define F_file_operation_access_s "access" + #define F_file_operation_analyze_s "analyze" + #define F_file_operation_append_s "append" + #define F_file_operation_change_group_s "change group of" + #define F_file_operation_change_mode_s "change mode of" + #define F_file_operation_change_owner_s "change owner of" + #define F_file_operation_change_type_s "change type of" + #define F_file_operation_clone_s "clone" + #define F_file_operation_close_s "close" + #define F_file_operation_concatenate_s "concatenate" + #define F_file_operation_connect_s "connect" + #define F_file_operation_copy_s "copy" + #define F_file_operation_create_s "create" + #define F_file_operation_decrypt_s "decrypt" + #define F_file_operation_delete_s "delete" + #define F_file_operation_disconnect_s "disconnect" + #define F_file_operation_encrypt_s "encrypt" + #define F_file_operation_find_s "find" + #define F_file_operation_from_s "from" + #define F_file_operation_flush_s "flush" + #define F_file_operation_get_group_s "get group of" + #define F_file_operation_get_mode_s "get mode of" + #define F_file_operation_get_owner_s "get owner of" + #define F_file_operation_get_type_s "get type of" + #define F_file_operation_identify_s "identify" + #define F_file_operation_link_s "link" + #define F_file_operation_list_s "list" + #define F_file_operation_move_s "move" + #define F_file_operation_open_s "open" + #define F_file_operation_pipe_s "pipe" + #define F_file_operation_process_s "process" + #define F_file_operation_read_s "read" + #define F_file_operation_receive_s "receive" + #define F_file_operation_rename_s "rename" + #define F_file_operation_send_s "send" + #define F_file_operation_shred_s "shred" + #define F_file_operation_stat_s "stat" + #define F_file_operation_to_s "to" + #define F_file_operation_touch_s "touch" + #define F_file_operation_truncate_s "truncate" + #define F_file_operation_unlink_s "unlink" + #define F_file_operation_verify_s "verify" + #define F_file_operation_wipe_s "wipe" + #define F_file_operation_write_s "write" + + #define F_file_operation_access_s_length 6 + #define F_file_operation_analyze_s_length 7 + #define F_file_operation_append_s_length 6 + #define F_file_operation_change_group_s_length 15 + #define F_file_operation_change_mode_s_length 14 + #define F_file_operation_change_owner_s_length 15 + #define F_file_operation_change_type_s_length 14 + #define F_file_operation_clone_s_length 5 + #define F_file_operation_close_s_length 5 + #define F_file_operation_concatenate_s_length 11 + #define F_file_operation_connect_s_length 7 + #define F_file_operation_copy_s_length 4 + #define F_file_operation_create_s_length 6 + #define F_file_operation_decrypt_s_length 7 + #define F_file_operation_delete_s_length 6 + #define F_file_operation_disconnect_s_length 10 + #define F_file_operation_encrypt_s_length 7 + #define F_file_operation_find_s_length 4 + #define F_file_operation_from_s_length 4 + #define F_file_operation_flush_s_length 5 + #define F_file_operation_get_group_s_length 12 + #define F_file_operation_get_mode_s_length 11 + #define F_file_operation_get_owner_s_length 12 + #define F_file_operation_get_type_s_length 11 + #define F_file_operation_identify_s_length 8 + #define F_file_operation_link_s_length 4 + #define F_file_operation_list_s_length 4 + #define F_file_operation_move_s_length 4 + #define F_file_operation_open_s_length 4 + #define F_file_operation_pipe_s_length 4 + #define F_file_operation_process_s_length 7 + #define F_file_operation_read_s_length 4 + #define F_file_operation_rename_s_length 6 + #define F_file_operation_receive_s_length 7 + #define F_file_operation_send_s_length 4 + #define F_file_operation_shred_s_length 5 + #define F_file_operation_stat_s_length 4 + #define F_file_operation_to_s_length 2 + #define F_file_operation_touch_s_length 5 + #define F_file_operation_truncate_s_length 8 + #define F_file_operation_unlink_s_length 6 + #define F_file_operation_verify_s_length 6 + #define F_file_operation_wipe_s_length 4 + #define F_file_operation_write_s_length 5 + + extern const f_string_static_t f_file_operation_access_s; + extern const f_string_static_t f_file_operation_analyze_s; extern const f_string_static_t f_file_operation_append_s; + extern const f_string_static_t f_file_operation_change_group_s; + extern const f_string_static_t f_file_operation_change_mode_s; + extern const f_string_static_t f_file_operation_change_owner_s; + extern const f_string_static_t f_file_operation_change_type_s; extern const f_string_static_t f_file_operation_clone_s; extern const f_string_static_t f_file_operation_close_s; extern const f_string_static_t f_file_operation_concatenate_s; extern const f_string_static_t f_file_operation_connect_s; extern const f_string_static_t f_file_operation_copy_s; extern const f_string_static_t f_file_operation_create_s; + extern const f_string_static_t f_file_operation_decrypt_s; extern const f_string_static_t f_file_operation_delete_s; extern const f_string_static_t f_file_operation_disconnect_s; + extern const f_string_static_t f_file_operation_encrypt_s; extern const f_string_static_t f_file_operation_find_s; extern const f_string_static_t f_file_operation_from_s; extern const f_string_static_t f_file_operation_flush_s; + extern const f_string_static_t f_file_operation_get_group_s; + extern const f_string_static_t f_file_operation_get_mode_s; + extern const f_string_static_t f_file_operation_get_owner_s; + extern const f_string_static_t f_file_operation_get_type_s; + extern const f_string_static_t f_file_operation_identify_s; extern const f_string_static_t f_file_operation_link_s; extern const f_string_static_t f_file_operation_list_s; + extern const f_string_static_t f_file_operation_move_s; extern const f_string_static_t f_file_operation_open_s; + extern const f_string_static_t f_file_operation_pipe_s; extern const f_string_static_t f_file_operation_process_s; extern const f_string_static_t f_file_operation_read_s; extern const f_string_static_t f_file_operation_receive_s; + extern const f_string_static_t f_file_operation_rename_s; extern const f_string_static_t f_file_operation_send_s; + extern const f_string_static_t f_file_operation_shred_s; + extern const f_string_static_t f_file_operation_stat_s; extern const f_string_static_t f_file_operation_to_s; + extern const f_string_static_t f_file_operation_touch_s; extern const f_string_static_t f_file_operation_truncate_s; extern const f_string_static_t f_file_operation_unlink_s; extern const f_string_static_t f_file_operation_verify_s; diff --git a/level_0/f_file/c/file.c b/level_0/f_file/c/file.c index 4d23522..b774612 100644 --- a/level_0/f_file/c/file.c +++ b/level_0/f_file/c/file.c @@ -1501,8 +1501,7 @@ extern "C" { #ifndef _di_f_file_read_ f_status_t f_file_read(const f_file_t file, f_string_dynamic_t *buffer) { #ifndef _di_level_0_parameter_checking_ - if (!file.size_read) return F_status_set_error(F_parameter); - if (buffer->used > buffer->size) return F_status_set_error(F_parameter); + if (!buffer) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (file.id == -1) { @@ -1543,8 +1542,7 @@ extern "C" { #ifndef _di_f_file_read_block_ f_status_t f_file_read_block(const f_file_t file, f_string_dynamic_t *buffer) { #ifndef _di_level_0_parameter_checking_ - if (!file.size_read) return F_status_set_error(F_parameter); - if (buffer->used > buffer->size) return F_status_set_error(F_parameter); + if (!buffer) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (file.id == -1) { @@ -1587,8 +1585,7 @@ extern "C" { #ifndef _di_f_file_read_until_ f_status_t f_file_read_until(const f_file_t file, const f_array_length_t total, f_string_dynamic_t *buffer) { #ifndef _di_level_0_parameter_checking_ - if (!file.size_read) return F_status_set_error(F_parameter); - if (buffer->used > buffer->size) return F_status_set_error(F_parameter); + if (!buffer) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (file.id == -1) { @@ -2058,8 +2055,7 @@ extern "C" { #ifndef _di_f_file_stream_read_ f_status_t f_file_stream_read(const f_file_t file, f_string_dynamic_t *buffer) { #ifndef _di_level_0_parameter_checking_ - if (!file.size_read) return F_status_set_error(F_parameter); - if (buffer->used > buffer->size) return F_status_set_error(F_parameter); + if (!buffer) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (!file.stream) { @@ -2139,8 +2135,7 @@ extern "C" { #ifndef _di_f_file_stream_read_until_ f_status_t f_file_stream_read_until(const f_file_t file, const f_array_length_t total, f_string_dynamic_t *buffer) { #ifndef _di_level_0_parameter_checking_ - if (!file.size_read) return F_status_set_error(F_parameter); - if (buffer->used > buffer->size) return F_status_set_error(F_parameter); + if (!buffer) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (!file.stream) return F_status_set_error(F_file_closed); diff --git a/level_1/fl_directory/c/directory-common.h b/level_1/fl_directory/c/directory-common.h index 5113087..87f9b79 100644 --- a/level_1/fl_directory/c/directory-common.h +++ b/level_1/fl_directory/c/directory-common.h @@ -53,7 +53,7 @@ extern "C" { bool exclusive; f_file_t output; - void (*verbose)(const f_file_t, const f_string_t, const f_string_t); + void (*verbose)(const f_file_t, const f_string_static_t, const f_string_static_t); f_directory_statuss_t *failures; } fl_directory_recurse_t; diff --git a/level_1/fl_directory/c/directory.c b/level_1/fl_directory/c/directory.c index 2adc4df..b7ab091 100644 --- a/level_1/fl_directory/c/directory.c +++ b/level_1/fl_directory/c/directory.c @@ -128,7 +128,7 @@ extern "C" { } if (status == F_none && (!recurse.output.stream || recurse.output.id != -1) && recurse.verbose) { - recurse.verbose(recurse.output, source.string, destination.string); + recurse.verbose(recurse.output, source, destination); } return status; @@ -188,7 +188,7 @@ extern "C" { status = private_fl_directory_clone(static_source, static_destination, role, recurse, 1); if (status == F_none && (!recurse.output.stream || recurse.output.id != -1) && recurse.verbose) { - recurse.verbose(recurse.output, source.string, destination.string); + recurse.verbose(recurse.output, source, destination); } return status; @@ -258,7 +258,7 @@ extern "C" { } if (status == F_none && (!recurse.output.stream || recurse.output.id != -1) && recurse.verbose) { - recurse.verbose(recurse.output, source.string, destination.string); + recurse.verbose(recurse.output, source, destination); } return status; @@ -316,7 +316,7 @@ extern "C" { } if (status == F_none && (!recurse.output.stream || recurse.output.id != -1) && recurse.verbose) { - recurse.verbose(recurse.output, source.string, destination.string); + recurse.verbose(recurse.output, source, destination); } return status; diff --git a/level_1/fl_directory/c/private-directory.c b/level_1/fl_directory/c/private-directory.c index 211edb2..b84b146 100644 --- a/level_1/fl_directory/c/private-directory.c +++ b/level_1/fl_directory/c/private-directory.c @@ -121,7 +121,7 @@ extern "C" { status = private_fl_directory_clone(source_sub, destination_sub, role, recurse, depth + 1); if (status == F_none && (!recurse.output.stream || recurse.output.id != -1) && recurse.verbose) { - recurse.verbose(recurse.output, source_sub.string, destination_sub.string); + recurse.verbose(recurse.output, source_sub, destination_sub); } } } // for @@ -223,7 +223,7 @@ extern "C" { } if ((!recurse.output.stream || recurse.output.id != -1) && recurse.verbose) { - recurse.verbose(recurse.output, path_source.string, path_destination.string); + recurse.verbose(recurse.output, path_source, path_destination); } return F_none; @@ -332,7 +332,7 @@ extern "C" { status = private_fl_directory_copy(source_sub, destination_sub, mode, recurse, depth + 1); if (status == F_none && (!recurse.output.stream || recurse.output.id != -1) && recurse.verbose) { - recurse.verbose(recurse.output, source_sub.string, destination_sub.string); + recurse.verbose(recurse.output, source_sub, destination_sub); } } } // for @@ -438,7 +438,7 @@ extern "C" { } if ((!recurse.output.stream || recurse.output.id != -1) && recurse.verbose) { - recurse.verbose(recurse.output, path_source.string, path_destination.string); + recurse.verbose(recurse.output, path_source, path_destination); } return F_none; diff --git a/level_1/fl_print/c/print.h b/level_1/fl_print/c/print.h index 0fce758..8af1047 100644 --- a/level_1/fl_print/c/print.h +++ b/level_1/fl_print/c/print.h @@ -136,7 +136,7 @@ extern "C" { * - "q": Type is a f_string_static_t or f_string_dynamic_t and NULLs are ignored (not printed). * - "Q": Type is a f_string_static_t or f_string_dynamic_t and NULLs are ignored (not printed), where control characters and invalid UTF-8 are replaced. * - "r": Type is a f_string_static_t or f_string_dynamic_t and NULLs (and all other control characters) are printed. - * - "R": Type is a f_string_static_t or f_string_dynamic_t and NULLs are printed, but control characters and invalid UTF-8 are replaced. @todo not yet implemented. + * - "R": Type is a f_string_static_t or f_string_dynamic_t and NULLs are printed, but control characters and invalid UTF-8 are replaced. * - "uii", "UII": Type is a uint8_t digit. * - "ui", "UI": Type is a uint16_t digit. * - "u", "U": Type is a uint32_t digit. diff --git a/level_1/fl_utf_file/c/utf_file.c b/level_1/fl_utf_file/c/utf_file.c index 15a56a0..d15f40f 100644 --- a/level_1/fl_utf_file/c/utf_file.c +++ b/level_1/fl_utf_file/c/utf_file.c @@ -8,8 +8,7 @@ extern "C" { #ifndef _di_fl_utf_file_read_ f_status_t fl_utf_file_read(const f_file_t file, f_utf_string_dynamic_t *buffer) { #ifndef _di_level_1_parameter_checking_ - if (!file.size_read) return F_status_set_error(F_parameter); - if (buffer->used > buffer->size) return F_status_set_error(F_parameter); + if (!buffer) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (file.id < 0) { @@ -74,8 +73,7 @@ extern "C" { #ifndef _di_fl_utf_file_read_block_ f_status_t fl_utf_file_read_block(const f_file_t file, f_utf_string_dynamic_t *buffer) { #ifndef _di_level_1_parameter_checking_ - if (!file.size_read) return F_status_set_error(F_parameter); - if (buffer->used > buffer->size) return F_status_set_error(F_parameter); + if (!buffer) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (file.id < 0) return F_status_set_error(F_file); @@ -134,8 +132,7 @@ extern "C" { #ifndef _di_fl_utf_file_read_until_ f_status_t fl_utf_file_read_until(const f_file_t file, const f_array_length_t total, f_utf_string_dynamic_t *buffer) { #ifndef _di_level_1_parameter_checking_ - if (!file.size_read) return F_status_set_error(F_parameter); - if (buffer->used > buffer->size) return F_status_set_error(F_parameter); + if (!buffer) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (file.id < 0) { diff --git a/level_2/fll_control_group/c/control_group.c b/level_2/fll_control_group/c/control_group.c index 65e1baa..51a8af6 100644 --- a/level_2/fll_control_group/c/control_group.c +++ b/level_2/fll_control_group/c/control_group.c @@ -6,6 +6,7 @@ extern "C" { #ifndef _di_fll_control_group_prepare_ f_status_t fll_control_group_prepare(const f_control_group_t control_group) { + f_status_t status = F_none; if (control_group.path.used) { diff --git a/level_2/fll_execute/c/execute.c b/level_2/fll_execute/c/execute.c index 9eac775..77b573c 100644 --- a/level_2/fll_execute/c/execute.c +++ b/level_2/fll_execute/c/execute.c @@ -11,7 +11,10 @@ extern "C" { if (!arguments) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ - const f_status_t status = private_fll_execute_arguments_add(source, arguments); + f_status_t status = f_string_dynamics_increase(F_memory_default_allocation_small_d, arguments); + if (F_status_is_error(status)) return status; + + status = private_fll_execute_arguments_add(source, arguments); if (F_status_is_error(status)) return status; return F_none; @@ -55,12 +58,11 @@ extern "C" { if (!arguments) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ - f_status_t status = F_none; + f_status_t status = f_string_dynamics_increase_by(size, arguments); - for (f_array_length_t i = 0; i < size; ++i) { + for (f_array_length_t i = 0; F_status_is_error_not(status) && i < size; ++i) { status = private_fll_execute_arguments_add(source[i], arguments); - if (F_status_is_error(status)) return status; } // for return status; @@ -389,11 +391,11 @@ extern "C" { memcpy(&program_path, found->string, found->used); - f_string_dynamics_resize(0, &paths); - program_name.string = program_path; program_name.used = found->used; + f_string_dynamics_resize(0, &paths); + if (parameter && (parameter->option & FL_execute_parameter_option_path_d)) { fixed_arguments[0] = program_path; } diff --git a/level_2/fll_execute/c/private-execute.c b/level_2/fll_execute/c/private-execute.c index 28bf35d..fb195aa 100644 --- a/level_2/fll_execute/c/private-execute.c +++ b/level_2/fll_execute/c/private-execute.c @@ -8,20 +8,15 @@ extern "C" { #if !defined(_di_fll_execute_arguments_add_) || !defined(_di_fll_execute_arguments_add_set_) f_status_t private_fll_execute_arguments_add(const f_string_static_t source, f_string_dynamics_t *arguments) { - f_status_t status = f_string_dynamics_increase(F_memory_default_allocation_small_d, arguments); - if (F_status_is_error(status)) return status; - arguments->array[arguments->used].used = 0; - status = f_string_dynamic_increase_by(source.used + 1, &arguments->array[arguments->used]); + f_status_t status = f_string_dynamic_increase_by(source.used + 1, &arguments->array[arguments->used]); if (F_status_is_error(status)) return status; status = f_string_dynamic_append(source, &arguments->array[arguments->used]); + if (F_status_is_error(status)) return status; - if (F_status_is_error_not(status)) { - status = f_string_dynamic_terminate_after(&arguments->array[arguments->used]); - } - + status = f_string_dynamic_terminate_after(&arguments->array[arguments->used]); if (F_status_is_error(status)) return status; ++arguments->used; @@ -300,23 +295,20 @@ extern "C" { // Close the write pipe for the child. close(descriptors[1]); - char string_response[2] = { 0, 0 }; - - f_string_static_t response = f_string_static_t_initialize; - - response.string = string_response; - response.used = 0; - response.size = 2; + f_string_dynamic_t response = f_string_dynamic_t_initialize; const f_file_t file = macro_f_file_t_initialize(0, descriptors[0], F_file_flag_read_only_d, 1, 1); f_file_read_block(file, &response); if (!response.used || response.string[0] == '1') { + f_string_dynamic_resize(0, &response); + close(descriptors[0]); if (result) { int *r = (int *) result; + *r = F_execute_failure; } @@ -326,6 +318,8 @@ extern "C" { return F_child; } + + f_string_dynamic_resize(0, &response); } if (parameter && parameter->signals) { @@ -495,23 +489,20 @@ extern "C" { // Wait for parent to tell child to begin. if (as) { - char string_response[2] = { 0, 0 }; - - f_string_static_t response = f_string_static_t_initialize; - - response.string = string_response; - response.used = 0; - response.size = 2; + f_string_dynamic_t response = f_string_dynamic_t_initialize; const f_file_t file = macro_f_file_t_initialize(0, descriptors[0], F_file_flag_read_only_d, 1, 1); f_file_read_block(file, &response); if (!response.used || response.string[0] == '1') { + f_string_dynamic_resize(0, &response); + close(descriptors[0]); if (result) { f_status_t *r = (f_status_t *) result; + *r = F_status_set_error(F_failure); } @@ -521,6 +512,8 @@ extern "C" { return F_child; } + + f_string_dynamic_resize(0, &response); } if (parameter && parameter->signals) { diff --git a/level_2/fll_execute/c/private-execute.h b/level_2/fll_execute/c/private-execute.h index 844c238..59f6699 100644 --- a/level_2/fll_execute/c/private-execute.h +++ b/level_2/fll_execute/c/private-execute.h @@ -316,6 +316,7 @@ extern "C" { * The full path to the program or the program name to copy from. * @param arguments * An array of strings representing the arguments. + * The strings must be NULL terminated. * @param last_slash * A pointer to the last slash. * Set to NULL if there is no slash in the program_path. @@ -326,6 +327,7 @@ extern "C" { * The destination to copy the name to. * @param fixed_arguments * The array of arguments to be updated with the program name. + * This is a array of simple strings intended to be eventually directly passed to functions like exec(). * * @return * F_none on success. diff --git a/level_2/fll_file/c/file.c b/level_2/fll_file/c/file.c index b075cfd..1a5486e 100644 --- a/level_2/fll_file/c/file.c +++ b/level_2/fll_file/c/file.c @@ -34,7 +34,7 @@ extern "C" { if (F_status_set_fine(status) != F_mount) { if (status == F_none && (!recurse.output.stream || recurse.output.id != -1) && recurse.verbose) { - recurse.verbose(recurse.output, source.string, destination.string); + recurse.verbose(recurse.output, source, destination); } return status; @@ -57,7 +57,7 @@ extern "C" { status = f_directory_remove(source, recurse.depth_max, F_false); if (status == F_none && (!recurse.output.stream || recurse.output.id != -1) && recurse.verbose) { - recurse.verbose(recurse.output, source.string, destination.string); + recurse.verbose(recurse.output, source, destination); } } else { @@ -67,7 +67,7 @@ extern "C" { status = f_file_remove(source); if (status == F_none && (!recurse.output.stream || recurse.output.id != -1) && recurse.verbose) { - recurse.verbose(recurse.output, source.string, destination.string); + recurse.verbose(recurse.output, source, destination); } } diff --git a/level_2/fll_path/c/path.c b/level_2/fll_path/c/path.c index c37f475..636d029 100644 --- a/level_2/fll_path/c/path.c +++ b/level_2/fll_path/c/path.c @@ -5,12 +5,20 @@ extern "C" { #endif #ifndef _di_fll_path_canonical_ - f_status_t fll_path_canonical(const f_string_t path, f_string_dynamic_t *canonical) { + f_status_t fll_path_canonical(const f_string_static_t path, f_string_dynamic_t *canonical) { #ifndef _di_level_2_parameter_checking_ if (!canonical) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ f_status_t status = F_none; + + if (!path.used) { + status = f_path_current(F_true, canonical); + if (F_status_is_error(status)) return status; + + return F_none; + } + f_array_length_t at = 0; uint8_t previous_1 = f_path_separator_s.string[0]; @@ -21,14 +29,14 @@ extern "C" { canonical->used = 0; - if (path[0] == f_path_separator_s.string[0]) { + if (path.string[0] == f_path_separator_s.string[0]) { at = 1; } else { status = f_path_current(F_true, canonical); if (F_status_is_error(status)) return status; - if (!path[0]) { + if (!path.string[0] || path.used == 1) { return F_none; } @@ -38,9 +46,9 @@ extern "C" { status = f_string_dynamic_append_assure(f_path_separator_s, canonical); if (F_status_is_error(status)) return status; - for (; path[at]; ++at) { + for (; at < path.used && path.string[at]; ++at) { - if (!size_chunk && path[at] == f_path_separator_current_s.string[0]) { + if (!size_chunk && path.string[at] == f_path_separator_current_s.string[0]) { if (!previous_1 || previous_1 == f_path_separator_s.string[0]) { previous_1 = f_path_separator_current_s.string[0]; previous_2 = 0; @@ -60,7 +68,7 @@ extern "C" { } } } - else if (path[at] == f_path_separator_s.string[0]) { + else if (path.string[at] == f_path_separator_s.string[0]) { if (previous_1 == f_path_separator_s.string[0]) { size_chunk = 0; position = 0; @@ -79,7 +87,7 @@ extern "C" { } else { if (++size_chunk) { - status = f_string_append(path + position, size_chunk, canonical); + status = f_string_append(path.string + position, size_chunk, canonical); if (F_status_is_error(status)) return status; } } @@ -121,7 +129,7 @@ extern "C" { } else if (!(previous_1 == f_path_separator_current_s.string[0] || previous_1 == f_path_separator_s.string[0])) { if (size_chunk) { - status = f_string_append(path + position, size_chunk, canonical); + status = f_string_append(path.string + position, size_chunk, canonical); if (F_status_is_error(status)) return status; } } diff --git a/level_2/fll_path/c/path.h b/level_2/fll_path/c/path.h index 2c0fd20..e3ca84f 100644 --- a/level_2/fll_path/c/path.h +++ b/level_2/fll_path/c/path.h @@ -32,9 +32,11 @@ extern "C" { * This does not process symbolic links. * This has a max size of F_string_t_size_d. * + * An empty path (first character is NULL or path.used is 0) appends only the current path to canonical. + * * @param path * The source path to determine what the canonical path is. - * This is a NULL terminated string. + * This need not be NULL terminated. * @param canonical * The (allocated) canonical file path. * The canonical->used is reset to 0 before processing. @@ -46,10 +48,17 @@ extern "C" { * Errors (with error bit) from: f_path_current(). * Errors (with error bit) from: f_string_append(). * Errors (with error bit) from: f_string_append_assure(). + * Errors (with error bit) from: f_string_dynamic_append_assure(). * Errors (with error bit) from: f_string_dynamic_terminate_after(). + * + * @see f_path_current() + * @see f_string_append() + * @see f_string_append_assure() + * @see f_string_dynamic_append_assure() + * @see f_string_dynamic_terminate_after() */ #ifndef _di_fll_path_canonical_ - extern f_status_t fll_path_canonical(const f_string_t path, f_string_dynamic_t *canonical); + extern f_status_t fll_path_canonical(const f_string_static_t path, f_string_dynamic_t *canonical); #endif // _di_fll_path_canonical_ #ifdef __cplusplus diff --git a/level_3/controller/c/controller.c b/level_3/controller/c/controller.c index aab5cb9..78b0b46 100644 --- a/level_3/controller/c/controller.c +++ b/level_3/controller/c/controller.c @@ -181,14 +181,14 @@ extern "C" { memset(&address, 0, setting.control_socket.length); if (main->remaining.used) { - status = f_string_append_nulless(arguments->argv[main->remaining.array[0]], strnlen(arguments->argv[main->remaining.array[0]], F_console_parameter_size_d), &setting.name_entry); + status = f_string_dynamic_append(argv[main->remaining.array[0]], &setting.name_entry); } else { - status = f_string_dynamic_append_nulless(controller_default_s, &setting.name_entry); + status = f_string_dynamic_append(controller_default_s, &setting.name_entry); } if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), main->remaining.used ? "f_string_append_nulless" : "f_string_dynamic_append_nulless", F_true); + fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_append", F_true); controller_main_delete(main); @@ -227,14 +227,12 @@ extern "C" { status = F_status_set_error(F_parameter); } else if (main->parameters.array[controller_parameter_settings_e].locations.used) { - const f_array_length_t location = main->parameters.array[controller_parameter_settings_e].values.array[main->parameters.array[controller_parameter_settings_e].values.used - 1]; + const f_array_length_t index = main->parameters.array[controller_parameter_settings_e].values.array[main->parameters.array[controller_parameter_settings_e].values.used - 1]; - status = fll_path_canonical(arguments->argv[location], &setting.path_setting); + status = fll_path_canonical(argv[index], &setting.path_setting); if (F_status_is_error(status)) { - const f_string_static_t argv = macro_f_string_static_t_initialize(arguments->argv[location], 0, strnlen(arguments->argv[location], F_console_parameter_size_d); - - fll_error_file_print(main->error, F_status_set_fine(status), "fll_path_canonical", F_true, argv, f_file_operation_verify_s, fll_error_file_type_path_e); + fll_error_file_print(main->error, F_status_set_fine(status), "fll_path_canonical", F_true, argv[index], f_file_operation_verify_s, fll_error_file_type_path_e); } } else { @@ -268,13 +266,13 @@ extern "C" { status = F_status_set_error(F_parameter); } else if (main->parameters.array[controller_parameter_pid_e].locations.used) { - const f_array_length_t location = main->parameters.array[controller_parameter_pid_e].values.array[main->parameters.array[controller_parameter_pid_e].values.used - 1]; + const f_array_length_t index = main->parameters.array[controller_parameter_pid_e].values.array[main->parameters.array[controller_parameter_pid_e].values.used - 1]; - if (strnlen(arguments->argv[location], F_console_parameter_size_d)) { - status = fll_path_canonical(arguments->argv[location], &setting.path_pid); + if (argv[index].used) { + status = fll_path_canonical(argv[index], &setting.path_pid); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "fll_path_canonical", F_true, arguments->argv[location], "verify", fll_error_file_type_path_e); + fll_error_file_print(main->error, F_status_set_fine(status), "fll_path_canonical", F_true, argv[index], f_file_operation_verify_s, fll_error_file_type_path_e); } } else { @@ -327,13 +325,13 @@ extern "C" { status = F_status_set_error(F_parameter); } else if (main->parameters.array[controller_parameter_cgroup_e].locations.used) { - const f_array_length_t location = main->parameters.array[controller_parameter_cgroup_e].values.array[main->parameters.array[controller_parameter_cgroup_e].values.used - 1]; + const f_array_length_t index = main->parameters.array[controller_parameter_cgroup_e].values.array[main->parameters.array[controller_parameter_cgroup_e].values.used - 1]; - if (strnlen(arguments->argv[location], F_console_parameter_size_d)) { - status = fll_path_canonical(arguments->argv[location], &setting.path_cgroup); + if (argv[index].used) { + status = fll_path_canonical(argv[index], &setting.path_cgroup); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "fll_path_canonical", F_true, arguments->argv[location], "verify", fll_error_file_type_path_e); + fll_error_file_print(main->error, F_status_set_fine(status), "fll_path_canonical", F_true, argv[index], f_file_operation_verify_s, fll_error_file_type_path_e); } else { status = f_string_append_assure(F_path_separator_s, 1, &setting.path_cgroup); @@ -474,7 +472,7 @@ extern "C" { controller_unlock_print_flush(main->warning.to, 0); } else if (F_status_set_fine(status_delete) != F_interrupt) { - fll_error_file_print(main->warning, F_status_set_fine(status_delete), "controller_file_pid_delete", F_true, setting.path_pid.string, "delete", fll_error_file_type_file_e); + fll_error_file_print(main->warning, F_status_set_fine(status_delete), "controller_file_pid_delete", F_true, setting.path_pid, f_file_operation_delete_s, fll_error_file_type_file_e); } } } @@ -483,7 +481,7 @@ extern "C" { f_socket_disconnect(&setting.control_socket, f_socket_close_read_write_e); if (!setting.control_readonly) { - f_file_remove(setting.path_control.string); + f_file_remove(setting.path_control); } } diff --git a/level_3/controller/c/controller/controller.? b/level_3/controller/c/controller/controller.? deleted file mode 100644 index e69de29..0000000 diff --git a/level_3/controller/c/controller/private-controller.c b/level_3/controller/c/controller/private-controller.c index 2df8b8d..38078b7 100644 --- a/level_3/controller/c/controller/private-controller.c +++ b/level_3/controller/c/controller/private-controller.c @@ -103,17 +103,30 @@ extern "C" { return status; } - const f_array_length_t path_length = global.setting->path_setting.used ? global.setting->path_setting.used + F_path_separator_s_length + cache->action.name_file.used : cache->action.name_file.used; - char path[path_length + 1]; + f_string_static_t path = f_string_static_t_initialize; if (global.setting->path_setting.used) { - memcpy(path, global.setting->path_setting.string, global.setting->path_setting.used); - memcpy(path + global.setting->path_setting.used + F_path_separator_s_length, cache->action.name_file.string, cache->action.name_file.used); + path.used = global.setting->path_setting.used + F_path_separator_s_length + cache->action.name_file.used; + } + else { + path.used = cache->action.name_file.used; + } - path[global.setting->path_setting.used] = f_path_separator_s.string[0]; + char path_string[path.used + 1]; + path.string = path_string; + + if (global.setting->path_setting.used) { + memcpy(path_string, global.setting->path_setting.string, global.setting->path_setting.used); + memcpy(path_string + global.setting->path_setting.used + F_path_separator_s_length, cache->action.name_file.string, cache->action.name_file.used); + + path_string[global.setting->path_setting.used] = f_path_separator_s.string[0]; + } + else { + memcpy(path_string, cache->action.name_file.string, cache->action.name_file.used); } - path[path_length] = 0; + path_string[path.used] = 0; + status = f_file_stream_open(path, f_string_empty_s, &file); @@ -133,7 +146,7 @@ extern "C" { if (F_status_is_error(status)) { if (global.main->error.verbosity != f_console_verbosity_quiet_e) { - controller_print_error_file(global.thread, global.main->error, F_status_set_fine(status), "f_file_stream_read", F_true, path, "read", fll_error_file_type_file_e); + controller_print_error_file(global.thread, global.main->error, F_status_set_fine(status), "f_file_stream_read", F_true, path, f_file_operation_read_s, fll_error_file_type_file_e); } } } @@ -147,7 +160,7 @@ extern "C" { if (F_status_is_error(status)) { if (global.main->error.verbosity != f_console_verbosity_quiet_e) { - controller_print_error_file(global.thread, global.main->error, F_status_set_fine(status), "f_file_stat", F_true, path, "stat", fll_error_file_type_file_e); + controller_print_error_file(global.thread, global.main->error, F_status_set_fine(status), "f_file_stat", F_true, path, f_file_operation_stat_s, fll_error_file_type_file_e); } } else { @@ -168,17 +181,17 @@ extern "C" { f_status_t status = F_none; // the file exists, do not attempt to overwrite. - if (f_file_exists(path.string) == F_true) { + if (f_file_exists(path) == F_true) { return F_status_set_error(F_file_found); } { f_string_dynamic_t path_directory = f_string_dynamic_t_initialize; - status = f_file_name_directory(path.string, path.used, &path_directory); + status = f_file_name_directory(path, &path_directory); if (F_status_is_error_not(status)) { - status = f_directory_exists(path_directory.string); + status = f_directory_exists(path_directory); } f_string_dynamic_resize(0, &path_directory); @@ -195,7 +208,7 @@ extern "C" { file.flag = F_file_flag_write_only_d; - status = f_file_stream_open(path.string, f_file_open_mode_truncate_s.string, &file); + status = f_file_stream_open(path, f_file_open_mode_truncate_s, &file); if (F_status_is_error(status)) return status; fll_print_format("%i%r", file.stream, pid, f_string_eol_s); @@ -212,14 +225,14 @@ extern "C" { f_status_t controller_file_pid_delete(const pid_t pid, const f_string_static_t path) { // only delete if the file exists and there is no error while checking. - if (f_file_exists(path.string) != F_true) { + if (f_file_exists(path) != F_true) { return F_none; } f_status_t status = F_none; f_file_t pid_file = f_file_t_initialize; - status = f_file_stream_open(path.string, f_file_open_mode_read_s.string, &pid_file); + status = f_file_stream_open(path, f_file_open_mode_read_s, &pid_file); if (F_status_is_error(status)) return status; f_string_dynamic_t pid_buffer = f_string_dynamic_t_initialize; @@ -245,7 +258,7 @@ extern "C" { status = fl_conversion_string_to_decimal_unsigned(pid_buffer.string, range, &number); if (F_status_is_error_not(status) && number == pid) { - status = f_file_remove(path.string); + status = f_file_remove(path); } else { status = F_status_set_error(F_number_not); @@ -263,7 +276,7 @@ extern "C" { *pid = 0; - f_status_t status = f_file_exists(path.string); + f_status_t status = f_file_exists(path); if (F_status_is_error(status)) return status; if (status != F_true) { @@ -272,7 +285,7 @@ extern "C" { f_file_t pid_file = f_file_t_initialize; - status = f_file_stream_open(path.string, f_file_open_mode_read_s.string, &pid_file); + status = f_file_stream_open(path, f_file_open_mode_read_s, &pid_file); if (F_status_is_error(status)) return status; f_string_dynamic_t pid_buffer = f_string_dynamic_t_initialize; @@ -400,7 +413,7 @@ extern "C" { if (global->main->error.verbosity != f_console_verbosity_quiet_e) { controller_lock_print(global->main->error.to, global->thread); - controller_print_error_file(0, global->main->error, F_status_set_fine(status), "controller_file_pid_create", F_true, global->setting->path_pid.string, "create", fll_error_file_type_file_e); + controller_print_error_file(0, global->main->error, F_status_set_fine(status), "controller_file_pid_create", F_true, global->setting->path_pid, f_file_operation_create_s, fll_error_file_type_file_e); flockfile(global->main->error.to.stream); @@ -421,7 +434,7 @@ extern "C" { fl_print_format("%[' could not be written because the destination is read only.%]%r", global->main->warning.to.stream, global->main->warning.context, global->main->warning.context, f_string_eol_s); } else { - controller_print_error_file(0, global->main->warning, F_status_set_fine(status), "controller_file_pid_create", F_true, global->setting->path_pid.string, "create", fll_error_file_type_file_e); + controller_print_error_file(0, global->main->warning, F_status_set_fine(status), "controller_file_pid_create", F_true, global->setting->path_pid, f_file_operation_create_s, fll_error_file_type_file_e); } controller_entry_print_error_cache(is_entry, global->main->warning, cache->action); @@ -454,7 +467,7 @@ extern "C" { if (global->setting->path_control.used) { if (global->setting->control_readonly) { - if (f_file_exists(global->setting->path_control.string) != F_true) { + if (f_file_exists(global->setting->path_control) != F_true) { if (global->main->output.verbosity == f_console_verbosity_debug_e) { controller_lock_print(global->main->output.to, global->thread); @@ -492,7 +505,7 @@ extern "C" { } } else { - status = f_file_remove(global->setting->path_control.string); + status = f_file_remove(global->setting->path_control); if (F_status_set_fine(status) == F_memory_not) { controller_print_error(global->thread, global->main->error, F_status_set_fine(status), "f_file_remove", F_true); @@ -526,7 +539,7 @@ extern "C" { } } else { - status = f_file_role_change(global->setting->path_control.string, global->setting->control_user, global->setting->control_group, F_true); + status = f_file_role_change(global->setting->path_control, global->setting->control_user, global->setting->control_group, F_true); if (F_status_is_error(status)) { f_socket_disconnect(&global->setting->control_socket, f_socket_close_fast_e); @@ -550,7 +563,7 @@ extern "C" { } } else { - status = f_file_mode_set(global->setting->path_control.string, global->setting->control_mode); + status = f_file_mode_set(global->setting->path_control, global->setting->control_mode); if (F_status_is_error(status)) { f_socket_disconnect(&global->setting->control_socket, f_socket_close_fast_e); diff --git a/level_3/controller/c/entry/private-entry.c b/level_3/controller/c/entry/private-entry.c index d5c2ea3..cf89189 100644 --- a/level_3/controller/c/entry/private-entry.c +++ b/level_3/controller/c/entry/private-entry.c @@ -413,7 +413,7 @@ extern "C" { if (action->parameters.array[0].used) { // Force the path to be canonical (removing all '../' parts). - status = fll_path_canonical(action->parameters.array[0].string, &cache->buffer_path); + status = fll_path_canonical(action->parameters.array[0], &cache->buffer_path); if (F_status_is_error(status)) { // @todo instead call: fll_error_file_print(). @@ -447,7 +447,7 @@ extern "C" { if (action->parameters.array[1].used) { cache->buffer_path.used = 0; - status = f_file_name_base(action->parameters.array[1].string, action->parameters.array[1].used, &cache->buffer_path); + status = f_file_name_base(action->parameters.array[1], &cache->buffer_path); if (F_status_is_error(status)) { controller_entry_print_error(is_entry, global.main->error, cache->action, F_status_set_fine(status), "f_file_name_base", F_true, global.thread); @@ -2019,7 +2019,7 @@ extern "C" { if (f_path_is_relative(global.setting->path_control.string, global.setting->path_control.used) == F_true) { // Use the PID file path for creating a relative path to the control socket. - status = f_file_name_directory(global.setting->path_pid.string, global.setting->path_pid.used, &cache->action.generic); + status = f_file_name_directory(global.setting->path_pid, &cache->action.generic); if (F_status_is_error(status)) { controller_entry_print_error(is_entry, global.main->error, cache->action, F_status_set_fine(status), "f_file_name_directory", F_true, global.thread); @@ -2065,10 +2065,10 @@ extern "C" { break; } - status = fll_path_canonical(cache->action.generic.string, &global.setting->path_control); + status = fll_path_canonical(cache->action.generic, &global.setting->path_control); if (F_status_is_error(status)) { - controller_entry_print_error_file(is_entry, global.main->error, cache->action, F_status_set_fine(status), "fll_path_canonical", F_true, cache->action.generic.string, "analyze", fll_error_file_type_path_e, global.thread); + controller_entry_print_error_file(is_entry, global.main->error, cache->action, F_status_set_fine(status), "fll_path_canonical", F_true, cache->action.generic, f_file_operation_analyze_s, fll_error_file_type_path_e, global.thread); global.setting->path_control.used = 0; @@ -2116,7 +2116,7 @@ extern "C" { break; } - status = f_file_mode_from_string(cache->action.generic.string, global.main->umask, &mode_file, &replace); + status = f_file_mode_from_string(cache->action.generic, global.main->umask, &mode_file, &replace); if (F_status_is_error(status)) { controller_entry_setting_read_print_error_with_range(is_entry, global.main->error, " has an unsupported mode", cache->content_actions.array[i].array[0], ", because the format is unknown or contains invalid data", global.thread, cache); diff --git a/level_3/controller/c/lock/private-lock_print.c b/level_3/controller/c/lock/private-lock_print.c index 4455e29..f3e0bcb 100644 --- a/level_3/controller/c/lock/private-lock_print.c +++ b/level_3/controller/c/lock/private-lock_print.c @@ -17,7 +17,7 @@ extern "C" { fl_print_format("%r%[%QThe pid file '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, print.context); fl_print_format("%['Critical failure while attempting to establish '%]", print.to.stream, print.context, print.context); - fl_print_format("%[%s lock%]", print.to.stream, print.notable, read ? "read" : "write", print.notable); + fl_print_format("%[%r lock%]", print.to.stream, print.notable, read ? f_file_operation_read_s : f_file_operation_write_s, print.notable); if (status != F_failure) { fl_print_format(" %['due to%] ", print.to.stream, print.context, print.context); diff --git a/level_3/controller/c/rule/private-rule.c b/level_3/controller/c/rule/private-rule.c index fe63b1f..36d71a1 100644 --- a/level_3/controller/c/rule/private-rule.c +++ b/level_3/controller/c/rule/private-rule.c @@ -14,6 +14,11 @@ #ifdef __cplusplus extern "C" { #endif +#ifndef _di_controller_rule_string_s_ + const f_string_static_t controller_rule_needed_s = macro_f_string_static_t_initialize(CONTROLLER_rule_needed_s, 0, CONTROLLER_rule_needed_s_length); + const f_string_static_t controller_rule_wanted_s = macro_f_string_static_t_initialize(CONTROLLER_rule_wanted_s, 0, CONTROLLER_rule_wanted_s_length); + const f_string_static_t controller_rule_wished_s = macro_f_string_static_t_initialize(CONTROLLER_rule_wished_s, 0, CONTROLLER_rule_wished_s_length); +#endif // _di_controller_rule_print_string_s_ #ifndef _di_controller_rule_action_method_name_ f_string_static_t controller_rule_action_method_name(const uint8_t type) { @@ -1033,7 +1038,7 @@ extern "C" { status = fll_control_group_prepare(process->rule.cgroup); if (F_status_is_error(status)) { - controller_print_error_file(global.thread, global.main->error, F_status_set_fine(status), "fll_control_group_prepare", F_true, process->rule.cgroup.path.string, "prepare control groups for", fll_error_file_type_directory_e); + controller_print_error_file(global.thread, global.main->error, F_status_set_fine(status), "fll_control_group_prepare", F_true, process->rule.cgroup.path, controller_rule_print_control_groups_prepare_s, fll_error_file_type_directory_e); return status; } @@ -1193,7 +1198,7 @@ extern "C" { success = F_status_set_error(F_failure); // @todo make this more specific. - controller_rule_action_print_error_missing_pid(global.main->error, process->rule.alias.string); + controller_rule_action_print_error_missing_pid(global.main->error, process->rule.alias); } } else if (process->rule.items.array[i].type == controller_rule_item_type_utility_e) { @@ -1231,7 +1236,7 @@ extern "C" { success = F_status_set_error(F_failure); // @todo make this more specific. - controller_rule_action_print_error_missing_pid(global.main->error, process->rule.alias.string); + controller_rule_action_print_error_missing_pid(global.main->error, process->rule.alias); } } else { @@ -1559,16 +1564,16 @@ extern "C" { } } - status = f_file_exists(pid_file.string); + status = f_file_exists(pid_file); if (F_status_is_error(status)) { - controller_print_error_file(thread, main->error, F_status_set_fine(status), "f_file_exists", F_true, pid_file.string, f_file_operation_find_s, fll_error_file_type_file_e); + controller_print_error_file(thread, main->error, F_status_set_fine(status), "f_file_exists", F_true, pid_file, f_file_operation_find_s, fll_error_file_type_file_e); return status; } if (status == F_true) { - controller_print_error_file(thread, main->error, F_file_found, "f_file_exists", F_true, pid_file.string, f_file_operation_find_s, fll_error_file_type_file_e); + controller_print_error_file(thread, main->error, F_file_found, "f_file_exists", F_true, pid_file, f_file_operation_find_s, fll_error_file_type_file_e); return F_status_set_error(F_file_found); } @@ -2284,10 +2289,10 @@ extern "C" { uint8_t options_process = 0; - const f_string_t strings[3] = { - "needed", - "wanted", - "wished for", + const f_string_static_t strings[3] = { + controller_rule_needed_s, + controller_rule_wanted_s, + controller_rule_wished_s, }; f_string_dynamics_t empty = f_string_dynamics_t_initialize; @@ -2335,7 +2340,7 @@ extern "C" { if (global.main->error.verbosity != f_console_verbosity_quiet_e) { controller_lock_print(global.main->error.to, global.thread); - controller_rule_item_print_error_rule_not_loaded(global.main->error, dynamics[i]->array[j].string); + controller_rule_item_print_error_rule_not_loaded(global.main->error, dynamics[i]->array[j]); controller_rule_print_error_cache(global.main->error, process->cache.action, F_false); controller_unlock_print_flush(global.main->error.to, global.thread); @@ -2390,7 +2395,7 @@ extern "C" { if (i == 0) { controller_lock_print(global.main->error.to, global.thread); - controller_rule_item_print_error_need_want_wish(global.main->error, strings[i], dynamics[i]->array[j].string, "was not found"); + controller_rule_item_print_error_need_want_wish(global.main->error, strings[i], dynamics[i]->array[j], "was not found"); controller_rule_print_error_cache(global.main->error, process->cache.action, F_true); controller_unlock_print_flush(global.main->error.to, global.thread); @@ -2409,7 +2414,7 @@ extern "C" { if (global.main->warning.verbosity == f_console_verbosity_debug_e) { controller_lock_print(global.main->warning.to, global.thread); - controller_rule_item_print_error_need_want_wish(global.main->warning, strings[i], dynamics[i]->array[j].string, "was not found"); + controller_rule_item_print_error_need_want_wish(global.main->warning, strings[i], dynamics[i]->array[j], "was not found"); controller_rule_print_error_cache(global.main->warning, process->cache.action, F_true); @@ -2430,13 +2435,15 @@ extern "C" { if (found) { - // the dependency may have write locks, which needs to be avoided, so copy the alias from the rule. - char alias_other_buffer[global.setting->rules.array[id_rule].alias.used + 1]; + // The dependency may have write locks, which needs to be avoided, so copy the alias from the rule. + f_string_static_t alias_other_buffer = f_string_static_t_initialize; + alias_other_buffer.used = global.setting->rules.array[id_rule].alias.used; - memcpy(alias_other_buffer, global.setting->rules.array[id_rule].alias.string, global.setting->rules.array[id_rule].alias.used); - alias_other_buffer[global.setting->rules.array[id_rule].alias.used] = 0; + char alias_other_buffer_string[alias_other_buffer.used + 1]; + alias_other_buffer.string = alias_other_buffer_string; - const f_string_static_t alias_other = macro_f_string_static_t_initialize2(alias_other_buffer, global.setting->rules.array[id_rule].alias.used); + memcpy(alias_other_buffer_string, global.setting->rules.array[id_rule].alias.string, alias_other_buffer.used); + alias_other_buffer_string[alias_other_buffer.used] = 0; f_thread_unlock(&global.thread->lock.rule); @@ -2481,7 +2488,7 @@ extern "C" { } // Synchronously execute dependency. - status = controller_rule_process_begin(global, 0, alias_other, process->action, options_process, process->type, process->stack, dependency->cache); + status = controller_rule_process_begin(global, 0, alias_other_buffer, process->action, options_process, process->type, process->stack, dependency->cache); if (status == F_child || F_status_set_fine(status) == F_interrupt) { f_thread_unlock(&dependency->active); @@ -2785,7 +2792,7 @@ extern "C" { if (global.main->error.verbosity != f_console_verbosity_quiet_e) { controller_lock_print(global.main->error.to, global.thread); - controller_rule_item_print_error_rule_not_loaded(global.main->error, alias_rule.string); + controller_rule_item_print_error_rule_not_loaded(global.main->error, alias_rule); controller_rule_print_error_cache(global.main->error, cache.action, F_false); controller_unlock_print_flush(global.main->error.to, global.thread); @@ -3169,7 +3176,7 @@ extern "C" { if (global.main->error.verbosity != f_console_verbosity_quiet_e) { controller_lock_print(global.main->error.to, global.thread); - controller_rule_item_print_error_rule_not_loaded(global.main->error, process->rule.alias.string); + controller_rule_item_print_error_rule_not_loaded(global.main->error, process->rule.alias); controller_rule_print_error_cache(global.main->error, process->cache.action, F_false); controller_unlock_print_flush(global.main->error.to, global.thread); @@ -5308,7 +5315,7 @@ extern "C" { cache->buffer_path.used = 0; - status = f_file_name_base(setting_values->array[setting_values->used].string, setting_values->array[setting_values->used + 1].used, &cache->buffer_path); + status = f_file_name_base(setting_values->array[setting_values->used], &cache->buffer_path); if (F_status_is_error(status)) { setting_values->array[setting_values->used].used = 0; diff --git a/level_3/controller/c/rule/private-rule.h b/level_3/controller/c/rule/private-rule.h index 1a712ea..e1deb37 100644 --- a/level_3/controller/c/rule/private-rule.h +++ b/level_3/controller/c/rule/private-rule.h @@ -13,6 +13,23 @@ extern "C" { #endif /** + * Special strings used for rules. + */ +#ifndef _di_controller_rule_string_s_ + #define CONTROLLER_rule_needed_s "needed" + #define CONTROLLER_rule_wanted_s "wanted" + #define CONTROLLER_rule_wished_s "wished for" + + #define CONTROLLER_rule_needed_s_length 6 + #define CONTROLLER_rule_wanted_s_length 6 + #define CONTROLLER_rule_wished_s_length 10 + + extern const f_string_static_t controller_rule_needed_s; + extern const f_string_static_t controller_rule_wanted_s; + extern const f_string_static_t controller_rule_wished_s; +#endif // _di_controller_rule_print_string_s_ + +/** * Get a string representing the rule action method. * * @param type diff --git a/level_3/controller/c/rule/private-rule_print.c b/level_3/controller/c/rule/private-rule_print.c index a33dbcd..ca70efc 100644 --- a/level_3/controller/c/rule/private-rule_print.c +++ b/level_3/controller/c/rule/private-rule_print.c @@ -6,6 +6,9 @@ #ifdef __cplusplus extern "C" { #endif +#ifndef _di_controller_rule_print_string_s_ + const f_string_static_t controller_rule_print_control_groups_prepare_s = macro_f_string_static_t_initialize(CONTROLLER_rule_print_control_groups_prepare_s, 0, CONTROLLER_rule_print_control_groups_prepare_s_length); +#endif // _di_controller_rule_print_string_s_ #ifndef _di_controller_rule_print_error_ void controller_rule_print_error(controller_thread_t * const thread, const fl_print_t print, const controller_cache_action_t cache, const f_status_t status, const f_string_t function, const bool fallback, const bool item) { @@ -224,34 +227,34 @@ extern "C" { #endif // _di_controller_rule_item_print_error_execute_ #ifndef _di_controller_rule_action_print_error_missing_pid_ - void controller_rule_action_print_error_missing_pid(const fl_print_t print, const f_string_t alias) { + void controller_rule_action_print_error_missing_pid(const fl_print_t print, const f_string_static_t alias) { if (print.verbosity == f_console_verbosity_quiet_e) return; fl_print_format("%r%[%QThe rule '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, print.context); - fl_print_format("%[%S%]", print.to.stream, print.notable, alias, print.notable); + fl_print_format("%[%Q%]", print.to.stream, print.notable, alias, print.notable); fl_print_format("%[' is not designating a pid file.%]%r", print.to.stream, print.context, print.context, f_string_eol_s); } #endif // _di_controller_rule_action_print_error_missing_pid_ #ifndef _di_controller_rule_item_print_error_need_want_wish_ - void controller_rule_item_print_error_need_want_wish(const fl_print_t print, const f_string_t need_want_wish, const f_string_t value, const f_string_t why) { + void controller_rule_item_print_error_need_want_wish(const fl_print_t print, const f_string_static_t need_want_wish, const f_string_static_t value, const f_string_t why) { if (print.verbosity == f_console_verbosity_quiet_e) return; - fl_print_format("%r%[%QThe %s rule '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, need_want_wish, print.context); - fl_print_format("%[%S%]", print.to.stream, print.notable, value, print.notable); + fl_print_format("%r%[%QThe %r rule '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, need_want_wish, print.context); + fl_print_format("%[%Q%]", print.to.stream, print.notable, value, print.notable); fl_print_format("%[' %S.%]%r", print.to.stream, print.context, why, print.context, f_string_eol_s); } #endif // _di_controller_rule_item_print_error_need_want_wish_ #ifndef _di_controller_rule_item_print_error_rule_not_loaded_ - void controller_rule_item_print_error_rule_not_loaded(const fl_print_t print, const f_string_t alias) { + void controller_rule_item_print_error_rule_not_loaded(const fl_print_t print, const f_string_static_t alias) { if (print.verbosity == f_console_verbosity_quiet_e) return; fl_print_format("%r%[%QThe rule '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, print.context); - fl_print_format("%[%S%]", print.to.stream, print.notable, alias, print.notable); + fl_print_format("%[%Q%]", print.to.stream, print.notable, alias, print.notable); fl_print_format("%[' is no longer loaded.%]%r", print.to.stream, print.context, print.context, f_string_eol_s); } #endif // _di_controller_rule_item_print_error_rule_not_loaded_ @@ -312,7 +315,7 @@ extern "C" { fl_print_format("%rProcessing rule item action '%[%Q%]' setting ", global.main->output.to.stream, f_string_eol_s, global.main->context.set.title, name, global.main->context.set.title); if (name_sub.used) { - fl_print_format("'%[%S%]'", global.main->output.to.stream, global.main->context.set.notable, name_sub, global.main->context.set.notable); + fl_print_format("'%[%Q%]'", global.main->output.to.stream, global.main->context.set.notable, name_sub, global.main->context.set.notable); } else { f_print_terminated("value", global.main->output.to.stream); diff --git a/level_3/controller/c/rule/private-rule_print.h b/level_3/controller/c/rule/private-rule_print.h index 237d6bd..acc9251 100644 --- a/level_3/controller/c/rule/private-rule_print.h +++ b/level_3/controller/c/rule/private-rule_print.h @@ -13,6 +13,16 @@ extern "C" { #endif /** + * Special strings used for printing. + */ +#ifndef _di_controller_rule_print_string_s_ + #define CONTROLLER_rule_print_control_groups_prepare_s "prepare control groups for" + #define CONTROLLER_rule_print_control_groups_prepare_s_length 24 + + extern const f_string_static_t controller_rule_print_control_groups_prepare_s; +#endif // _di_controller_rule_print_string_s_ + +/** * Print generic error/warning information. * * This is essentially a wrapper to fll_error_print() that includes locking. @@ -118,7 +128,7 @@ extern "C" { * The rule alias of the rule that is missing the pid file designation. */ #ifndef _di_controller_rule_action_print_error_missing_pid_ - extern void controller_rule_action_print_error_missing_pid(const fl_print_t print, const f_string_t alias) F_attribute_visibility_internal_d; + extern void controller_rule_action_print_error_missing_pid(const fl_print_t print, const f_string_static_t alias) F_attribute_visibility_internal_d; #endif // _di_controller_rule_action_print_error_missing_pid_ /** @@ -135,7 +145,7 @@ extern "C" { * A short explanation on why this is an error or warning. */ #ifndef _di_controller_rule_item_print_error_need_want_wish_ - extern void controller_rule_item_print_error_need_want_wish(const fl_print_t print, const f_string_t need_want_wish, const f_string_t value, const f_string_t why) F_attribute_visibility_internal_d; + extern void controller_rule_item_print_error_need_want_wish(const fl_print_t print, const f_string_static_t need_want_wish, const f_string_static_t value, const f_string_t why) F_attribute_visibility_internal_d; #endif // _di_controller_rule_item_print_error_need_want_wish_ /** @@ -147,7 +157,7 @@ extern "C" { * The rule alias of the rule that is not loaded. */ #ifndef _di_controller_rule_item_print_error_rule_not_loaded_ - extern void controller_rule_item_print_error_rule_not_loaded(const fl_print_t print, const f_string_t alias) F_attribute_visibility_internal_d; + extern void controller_rule_item_print_error_rule_not_loaded(const fl_print_t print, const f_string_static_t alias) F_attribute_visibility_internal_d; #endif // _di_controller_rule_item_print_error_rule_not_loaded_ /** diff --git a/level_3/controller/c/thread/private-thread.c b/level_3/controller/c/thread/private-thread.c index c5cd4b9..76c50c1 100644 --- a/level_3/controller/c/thread/private-thread.c +++ b/level_3/controller/c/thread/private-thread.c @@ -72,7 +72,7 @@ extern "C" { for (; j < process->path_pids.used; ++j) { - if (process->path_pids.array[j].used && f_file_exists(process->path_pids.array[j].string) == F_true) { + if (process->path_pids.array[j].used && f_file_exists(process->path_pids.array[j]) == F_true) { break; } } // for @@ -218,7 +218,7 @@ extern "C" { if (main->parameters.array[controller_parameter_daemon_e].result == f_console_result_found_e) { setting->ready = controller_setting_ready_done_e; - if (f_file_exists(setting->path_pid.string) == F_true) { + if (f_file_exists(setting->path_pid) == F_true) { if (main->error.verbosity != f_console_verbosity_quiet_e) { controller_lock_print(main->error.to, &thread); diff --git a/level_3/controller/c/thread/private-thread_entry.c b/level_3/controller/c/thread/private-thread_entry.c index d8f82ed..22da8dc 100644 --- a/level_3/controller/c/thread/private-thread_entry.c +++ b/level_3/controller/c/thread/private-thread_entry.c @@ -38,7 +38,7 @@ extern "C" { if (F_status_is_error_not(*status) && *status != F_child) { if (main->parameters.array[controller_parameter_validate_e].result == f_console_result_none_e || main->parameters.array[controller_parameter_simulate_e].result == f_console_result_found_e) { - if (entry->setting->entry.pid == controller_entry_pid_require_e && f_file_exists(entry->setting->path_pid.string) == F_true) { + if (entry->setting->entry.pid == controller_entry_pid_require_e && f_file_exists(entry->setting->path_pid) == F_true) { if (main->error.verbosity != f_console_verbosity_quiet_e) { controller_lock_print(main->error.to, entry->global->thread); diff --git a/level_3/controller/c/thread/private-thread_process.c b/level_3/controller/c/thread/private-thread_process.c index 2f95c6f..f0210fa 100644 --- a/level_3/controller/c/thread/private-thread_process.c +++ b/level_3/controller/c/thread/private-thread_process.c @@ -119,7 +119,7 @@ extern "C" { for (j = 0; j < process->path_pids.used; ++j) { - if (process->path_pids.array[j].used && f_file_exists(process->path_pids.array[j].string) == F_true) { + if (process->path_pids.array[j].used && f_file_exists(process->path_pids.array[j]) == F_true) { status = controller_file_pid_read(process->path_pids.array[j], &pid); if (pid) { @@ -166,7 +166,7 @@ extern "C" { for (; spent < controller_thread_exit_process_cancel_total_d; ++spent) { - if (process->path_pids.array[j].used && f_file_exists(process->path_pids.array[j].string) == F_true) { + if (process->path_pids.array[j].used && f_file_exists(process->path_pids.array[j]) == F_true) { status = controller_file_pid_read(process->path_pids.array[j], &pid); if (pid) { @@ -181,7 +181,7 @@ extern "C" { continue; } else { - f_file_remove(process->path_pids.array[j].string); + f_file_remove(process->path_pids.array[j]); process->path_pids.array[j].used = 0; } } @@ -233,14 +233,14 @@ extern "C" { for (j = 0; j < process->path_pids.used; ++j) { - if (f_file_exists(process->path_pids.array[j].string) == F_true) { + if (f_file_exists(process->path_pids.array[j]) == F_true) { status = controller_file_pid_read(process->path_pids.array[j], &pid); if (pid) { f_signal_send(F_signal_kill, pid); } - f_file_remove(process->path_pids.array[j].string); + f_file_remove(process->path_pids.array[j]); process->path_pids.array[j].used = 0; } } // for diff --git a/level_3/fake/c/common.c b/level_3/fake/c/common.c index 2e5a5ed..433fd8d 100644 --- a/level_3/fake/c/common.c +++ b/level_3/fake/c/common.c @@ -171,6 +171,8 @@ extern "C" { f_string_dynamic_resize(0, &main->file_data_build_defines); f_string_dynamic_resize(0, &main->file_data_build_dependencies); + f_string_dynamic_resize(0, &main->file_data_build_process_post_s); + f_string_dynamic_resize(0, &main->file_data_build_process_pre_s); f_string_dynamic_resize(0, &main->file_data_build_fakefile); f_string_dynamic_resize(0, &main->file_data_build_settings); diff --git a/level_3/fake/c/common.h b/level_3/fake/c/common.h index 40a51c1..97cfd26 100644 --- a/level_3/fake/c/common.h +++ b/level_3/fake/c/common.h @@ -488,6 +488,8 @@ extern "C" { f_string_dynamic_t file_data_build_defines; f_string_dynamic_t file_data_build_dependencies; f_string_dynamic_t file_data_build_fakefile; + f_string_dynamic_t file_data_build_process_post_s; + f_string_dynamic_t file_data_build_process_pre_s; f_string_dynamic_t file_data_build_settings; f_string_dynamic_t file_documents_readme; @@ -497,7 +499,7 @@ extern "C" { #define fake_main_t_initialize \ { \ - macro_f_console_parameters_t_initialize(fake_console_parameter_t_initialize, fake_total_parameters_d) \ + f_console_parameters_t_initialize, \ f_array_lengths_t_initialize, \ F_false, \ fl_print_t_initialize, \ @@ -552,6 +554,8 @@ extern "C" { f_string_dynamic_t_initialize, \ f_string_dynamic_t_initialize, \ f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ f_color_context_t_initialize, \ } #endif // _di_fake_main_t_ diff --git a/level_3/fake/c/private-build-library.c b/level_3/fake/c/private-build-library.c index 8e84e56..7d785a8 100644 --- a/level_3/fake/c/private-build-library.c +++ b/level_3/fake/c/private-build-library.c @@ -13,7 +13,7 @@ extern "C" { #ifndef _di_fake_build_library_script_ int fake_build_library_script(fake_main_t * const main, const fake_build_data_t data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t *status) { - if (F_status_is_error(*status) || f_file_exists(file_stage.string) == F_true || *status == F_child) return main->child; + if (F_status_is_error(*status) || f_file_exists(file_stage) == F_true || *status == F_child) return main->child; fake_build_touch(main, file_stage, status); @@ -24,7 +24,7 @@ extern "C" { #ifndef _di_fake_build_library_shared_ int fake_build_library_shared(fake_main_t * const main, const fake_build_data_t data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t *status) { - if (F_status_is_error(*status) || f_file_exists(file_stage.string) == F_true || *status == F_child) return main->child; + if (F_status_is_error(*status) || f_file_exists(file_stage) == F_true || *status == F_child) return main->child; if (!data_build.setting.build_sources_library.used) return 0; if (main->output.verbosity != f_console_verbosity_quiet_e) { @@ -87,37 +87,43 @@ extern "C" { } } - const f_array_length_t parameter_file_name_length = fake_build_parameter_library_name_prefix_s.used + data_build.setting.project_name.used + fake_build_parameter_library_name_suffix_shared_s.used; - const f_array_length_t parameter_file_name_major_length = data_build.setting.version_major.used ? parameter_file_name_length + data_build.setting.version_major_prefix.used + data_build.setting.version_major.used : 0; - const f_array_length_t parameter_file_name_minor_length = data_build.setting.version_minor.used ? parameter_file_name_major_length + data_build.setting.version_minor_prefix.used + data_build.setting.version_minor.used : 0; - const f_array_length_t parameter_file_name_micro_length = data_build.setting.version_micro.used ? parameter_file_name_minor_length + data_build.setting.version_micro_prefix.used + data_build.setting.version_micro.used : 0; - const f_array_length_t parameter_file_name_nano_length = data_build.setting.version_nano.used ? parameter_file_name_micro_length + data_build.setting.version_nano_prefix.used + data_build.setting.version_nano.used : 0; + f_string_static_t parameter_file_name = f_string_static_t_initialize; + f_string_static_t parameter_file_name_major = f_string_static_t_initialize; + f_string_static_t parameter_file_name_minor = f_string_static_t_initialize; + f_string_static_t parameter_file_name_micro = f_string_static_t_initialize; + f_string_static_t parameter_file_name_nano = f_string_static_t_initialize; - char parameter_file_name[parameter_file_name_length + 1]; - char parameter_file_name_major[parameter_file_name_major_length + 1]; - char parameter_file_name_minor[parameter_file_name_minor_length + 1]; - char parameter_file_name_micro[parameter_file_name_micro_length + 1]; - char parameter_file_name_nano[parameter_file_name_nano_length + 1]; + parameter_file_name.used = fake_build_parameter_library_name_prefix_s.used + data_build.setting.project_name.used + fake_build_parameter_library_name_suffix_shared_s.used; + parameter_file_name_major.used = data_build.setting.version_major.used ? parameter_file_name.used + data_build.setting.version_major_prefix.used + data_build.setting.version_major.used : 0; + parameter_file_name_minor.used = data_build.setting.version_minor.used ? parameter_file_name_major.used + data_build.setting.version_minor_prefix.used + data_build.setting.version_minor.used : 0; + parameter_file_name_micro.used = data_build.setting.version_micro.used ? parameter_file_name_micro.used + data_build.setting.version_micro_prefix.used + data_build.setting.version_micro.used : 0; + parameter_file_name_nano.used = data_build.setting.version_nano.used ? parameter_file_name_nano.used + data_build.setting.version_nano_prefix.used + data_build.setting.version_nano.used : 0; - parameter_file_name[parameter_file_name_length] = 0; - parameter_file_name_major[parameter_file_name_major_length] = 0; - parameter_file_name_minor[parameter_file_name_minor_length] = 0; - parameter_file_name_micro[parameter_file_name_micro_length] = 0; - parameter_file_name_nano[parameter_file_name_nano_length] = 0; + char parameter_file_name_string[parameter_file_name.used + 1]; + char parameter_file_name_major_string[parameter_file_name_major.used + 1]; + char parameter_file_name_minor_string[parameter_file_name_minor.used + 1]; + char parameter_file_name_micro_string[parameter_file_name_micro.used + 1]; + char parameter_file_name_nano_string[parameter_file_name_nano.used + 1]; - memcpy(parameter_file_name, fake_build_parameter_library_name_prefix_s.string, fake_build_parameter_library_name_prefix_s.used); + parameter_file_name_string[parameter_file_name.used] = 0; + parameter_file_name_major_string[parameter_file_name_major.used] = 0; + parameter_file_name_minor_string[parameter_file_name_minor.used] = 0; + parameter_file_name_micro_string[parameter_file_name_micro.used] = 0; + parameter_file_name_nano_string[parameter_file_name_nano.used] = 0; - if (parameter_file_name_major_length) { - memcpy(parameter_file_name_major, fake_build_parameter_library_name_prefix_s.string, fake_build_parameter_library_name_prefix_s.used); + memcpy(parameter_file_name_string, fake_build_parameter_library_name_prefix_s.string, fake_build_parameter_library_name_prefix_s.used); - if (parameter_file_name_minor_length) { - memcpy(parameter_file_name_minor, fake_build_parameter_library_name_prefix_s.string, fake_build_parameter_library_name_prefix_s.used); + if (parameter_file_name_major.used) { + memcpy(parameter_file_name_major_string, fake_build_parameter_library_name_prefix_s.string, fake_build_parameter_library_name_prefix_s.used); - if (parameter_file_name_micro_length) { - memcpy(parameter_file_name_micro, fake_build_parameter_library_name_prefix_s.string, fake_build_parameter_library_name_prefix_s.used); + if (parameter_file_name_minor.used) { + memcpy(parameter_file_name_minor_string, fake_build_parameter_library_name_prefix_s.string, fake_build_parameter_library_name_prefix_s.used); - if (parameter_file_name_nano_length) { - memcpy(parameter_file_name_nano, fake_build_parameter_library_name_prefix_s.string, fake_build_parameter_library_name_prefix_s.used); + if (parameter_file_name_micro.used) { + memcpy(parameter_file_name_micro_string, fake_build_parameter_library_name_prefix_s.string, fake_build_parameter_library_name_prefix_s.used); + + if (parameter_file_name_nano.used) { + memcpy(parameter_file_name_nano_string, fake_build_parameter_library_name_prefix_s.string, fake_build_parameter_library_name_prefix_s.used); } } } @@ -125,19 +131,19 @@ extern "C" { f_array_length_t count = fake_build_parameter_library_name_prefix_s.used; - memcpy(parameter_file_name + count, data_build.setting.project_name.string, data_build.setting.project_name.used); + memcpy(parameter_file_name_string + count, data_build.setting.project_name.string, data_build.setting.project_name.used); - if (parameter_file_name_major_length) { - memcpy(parameter_file_name_major + count, data_build.setting.project_name.string, data_build.setting.project_name.used); + if (parameter_file_name_major.used) { + memcpy(parameter_file_name_major_string + count, data_build.setting.project_name.string, data_build.setting.project_name.used); - if (parameter_file_name_minor_length) { - memcpy(parameter_file_name_minor + count, data_build.setting.project_name.string, data_build.setting.project_name.used); + if (parameter_file_name_minor.used) { + memcpy(parameter_file_name_minor_string + count, data_build.setting.project_name.string, data_build.setting.project_name.used); - if (parameter_file_name_micro_length) { - memcpy(parameter_file_name_micro + count, data_build.setting.project_name.string, data_build.setting.project_name.used); + if (parameter_file_name_micro.used) { + memcpy(parameter_file_name_micro_string + count, data_build.setting.project_name.string, data_build.setting.project_name.used); - if (parameter_file_name_nano_length) { - memcpy(parameter_file_name_nano + count, data_build.setting.project_name.string, data_build.setting.project_name.used); + if (parameter_file_name_nano.used) { + memcpy(parameter_file_name_nano_string + count, data_build.setting.project_name.string, data_build.setting.project_name.used); } } } @@ -145,38 +151,38 @@ extern "C" { count += data_build.setting.project_name.used; - memcpy(parameter_file_name + count, fake_build_parameter_library_name_suffix_shared_s.string, fake_build_parameter_library_name_suffix_shared_s.used); + memcpy(parameter_file_name_string + count, fake_build_parameter_library_name_suffix_shared_s.string, fake_build_parameter_library_name_suffix_shared_s.used); - if (parameter_file_name_major_length) { - memcpy(parameter_file_name_major + count, fake_build_parameter_library_name_suffix_shared_s.string, fake_build_parameter_library_name_suffix_shared_s.used); + if (parameter_file_name_major.used) { + memcpy(parameter_file_name_major_string + count, fake_build_parameter_library_name_suffix_shared_s.string, fake_build_parameter_library_name_suffix_shared_s.used); - if (parameter_file_name_minor_length) { - memcpy(parameter_file_name_minor + count, fake_build_parameter_library_name_suffix_shared_s.string, fake_build_parameter_library_name_suffix_shared_s.used); + if (parameter_file_name_minor.used) { + memcpy(parameter_file_name_minor_string + count, fake_build_parameter_library_name_suffix_shared_s.string, fake_build_parameter_library_name_suffix_shared_s.used); - if (parameter_file_name_micro_length) { - memcpy(parameter_file_name_micro + count, fake_build_parameter_library_name_suffix_shared_s.string, fake_build_parameter_library_name_suffix_shared_s.used); + if (parameter_file_name_micro.used) { + memcpy(parameter_file_name_micro_string + count, fake_build_parameter_library_name_suffix_shared_s.string, fake_build_parameter_library_name_suffix_shared_s.used); - if (parameter_file_name_nano_length) { - memcpy(parameter_file_name_nano + count, fake_build_parameter_library_name_suffix_shared_s.string, fake_build_parameter_library_name_suffix_shared_s.used); + if (parameter_file_name_nano.used) { + memcpy(parameter_file_name_nano_string + count, fake_build_parameter_library_name_suffix_shared_s.string, fake_build_parameter_library_name_suffix_shared_s.used); } } } } - if (parameter_file_name_major_length) { + if (parameter_file_name_major.used) { count += fake_build_parameter_library_name_suffix_shared_s.used; if (data_build.setting.version_major_prefix.used) { - memcpy(parameter_file_name_major + count, data_build.setting.version_major_prefix.string, data_build.setting.version_major_prefix.used); + memcpy(parameter_file_name_major_string + count, data_build.setting.version_major_prefix.string, data_build.setting.version_major_prefix.used); - if (parameter_file_name_minor_length) { - memcpy(parameter_file_name_minor + count, data_build.setting.version_major_prefix.string, data_build.setting.version_major_prefix.used); + if (parameter_file_name_minor.used) { + memcpy(parameter_file_name_minor_string + count, data_build.setting.version_major_prefix.string, data_build.setting.version_major_prefix.used); - if (parameter_file_name_micro_length) { - memcpy(parameter_file_name_micro + count, data_build.setting.version_major_prefix.string, data_build.setting.version_major_prefix.used); + if (parameter_file_name_micro.used) { + memcpy(parameter_file_name_micro_string + count, data_build.setting.version_major_prefix.string, data_build.setting.version_major_prefix.used); - if (parameter_file_name_nano_length) { - memcpy(parameter_file_name_nano + count, data_build.setting.version_major_prefix.string, data_build.setting.version_major_prefix.used); + if (parameter_file_name_nano.used) { + memcpy(parameter_file_name_nano_string + count, data_build.setting.version_major_prefix.string, data_build.setting.version_major_prefix.used); } } } @@ -184,148 +190,154 @@ extern "C" { count += data_build.setting.version_major_prefix.used; } - memcpy(parameter_file_name_major + count, data_build.setting.version_major.string, data_build.setting.version_major.used); + memcpy(parameter_file_name_major_string + count, data_build.setting.version_major.string, data_build.setting.version_major.used); - if (parameter_file_name_minor_length) { - memcpy(parameter_file_name_minor + count, data_build.setting.version_major.string, data_build.setting.version_major.used); + if (parameter_file_name_minor.used) { + memcpy(parameter_file_name_minor_string + count, data_build.setting.version_major.string, data_build.setting.version_major.used); - if (parameter_file_name_micro_length) { - memcpy(parameter_file_name_micro + count, data_build.setting.version_major.string, data_build.setting.version_major.used); + if (parameter_file_name_micro.used) { + memcpy(parameter_file_name_micro_string + count, data_build.setting.version_major.string, data_build.setting.version_major.used); - if (parameter_file_name_nano_length) { - memcpy(parameter_file_name_nano + count, data_build.setting.version_major.string, data_build.setting.version_major.used); + if (parameter_file_name_nano.used) { + memcpy(parameter_file_name_nano_string + count, data_build.setting.version_major.string, data_build.setting.version_major.used); } } } - if (parameter_file_name_minor_length) { + if (parameter_file_name_minor.used) { count += data_build.setting.version_major.used; if (data_build.setting.version_minor_prefix.used) { - memcpy(parameter_file_name_minor + count, data_build.setting.version_minor_prefix.string, data_build.setting.version_minor_prefix.used); + memcpy(parameter_file_name_minor_string + count, data_build.setting.version_minor_prefix.string, data_build.setting.version_minor_prefix.used); - if (parameter_file_name_micro_length) { - memcpy(parameter_file_name_micro + count, data_build.setting.version_minor_prefix.string, data_build.setting.version_minor_prefix.used); + if (parameter_file_name_micro.used) { + memcpy(parameter_file_name_micro_string + count, data_build.setting.version_minor_prefix.string, data_build.setting.version_minor_prefix.used); - if (parameter_file_name_nano_length) { - memcpy(parameter_file_name_nano + count, data_build.setting.version_minor_prefix.string, data_build.setting.version_minor_prefix.used); + if (parameter_file_name_nano.used) { + memcpy(parameter_file_name_nano_string + count, data_build.setting.version_minor_prefix.string, data_build.setting.version_minor_prefix.used); } } count += data_build.setting.version_minor_prefix.used; } - memcpy(parameter_file_name_minor + count, data_build.setting.version_minor.string, data_build.setting.version_minor.used); + memcpy(parameter_file_name_minor_string + count, data_build.setting.version_minor.string, data_build.setting.version_minor.used); - if (parameter_file_name_micro_length) { - memcpy(parameter_file_name_micro + count, data_build.setting.version_minor.string, data_build.setting.version_minor.used); + if (parameter_file_name_micro.used) { + memcpy(parameter_file_name_micro_string + count, data_build.setting.version_minor.string, data_build.setting.version_minor.used); - if (parameter_file_name_nano_length) { - memcpy(parameter_file_name_nano + count, data_build.setting.version_minor.string, data_build.setting.version_minor.used); + if (parameter_file_name_nano.used) { + memcpy(parameter_file_name_nano_string + count, data_build.setting.version_minor.string, data_build.setting.version_minor.used); } } - if (parameter_file_name_micro_length) { + if (parameter_file_name_micro.used) { count += data_build.setting.version_minor.used; if (data_build.setting.version_micro_prefix.used) { - memcpy(parameter_file_name_micro + count, data_build.setting.version_micro_prefix.string, data_build.setting.version_micro_prefix.used); + memcpy(parameter_file_name_micro_string + count, data_build.setting.version_micro_prefix.string, data_build.setting.version_micro_prefix.used); - if (parameter_file_name_nano_length) { - memcpy(parameter_file_name_nano + count, data_build.setting.version_micro_prefix.string, data_build.setting.version_micro_prefix.used); + if (parameter_file_name_nano.used) { + memcpy(parameter_file_name_nano_string + count, data_build.setting.version_micro_prefix.string, data_build.setting.version_micro_prefix.used); } count += data_build.setting.version_micro_prefix.used; } - memcpy(parameter_file_name_micro + count, data_build.setting.version_micro.string, data_build.setting.version_micro.used); + memcpy(parameter_file_name_micro_string + count, data_build.setting.version_micro.string, data_build.setting.version_micro.used); - if (parameter_file_name_nano_length) { - memcpy(parameter_file_name_nano + count, data_build.setting.version_micro.string, data_build.setting.version_micro.used); + if (parameter_file_name_nano.used) { + memcpy(parameter_file_name_nano_string + count, data_build.setting.version_micro.string, data_build.setting.version_micro.used); count += data_build.setting.version_micro.used; if (data_build.setting.version_nano_prefix.used) { - memcpy(parameter_file_name_nano + count, data_build.setting.version_nano_prefix.string, data_build.setting.version_nano_prefix.used); + memcpy(parameter_file_name_nano_string + count, data_build.setting.version_nano_prefix.string, data_build.setting.version_nano_prefix.used); count += data_build.setting.version_nano_prefix.used; } - memcpy(parameter_file_name_nano + count, data_build.setting.version_nano.string, data_build.setting.version_nano.used); + memcpy(parameter_file_name_nano_string + count, data_build.setting.version_nano.string, data_build.setting.version_nano.used); } } } } { - f_array_length_t parameter_linker_length = fake_build_parameter_library_shared_prefix_s.used; - f_array_length_t parameter_file_path_length = main->path_build_libraries_shared.used; + f_string_static_t parameter_linker = f_string_static_t_initialize; + f_string_static_t parameter_file_path = f_string_static_t_initialize; + + parameter_linker.used = fake_build_parameter_library_shared_prefix_s.used; + parameter_file_path.used = main->path_build_libraries_shared.used; if (data_build.setting.version_file == fake_build_version_type_major_e) { - parameter_file_path_length += parameter_file_name_major_length; + parameter_file_path.used += parameter_file_name_major.used; } else if (data_build.setting.version_file == fake_build_version_type_minor_e) { - parameter_file_path_length += parameter_file_name_minor_length; + parameter_file_path.used += parameter_file_name_minor.used; } else if (data_build.setting.version_file == fake_build_version_type_micro_e) { - parameter_file_path_length += parameter_file_name_micro_length; + parameter_file_path.used += parameter_file_name_micro.used; } else if (data_build.setting.version_file == fake_build_version_type_nano_e) { - parameter_file_path_length += parameter_file_name_nano_length; + parameter_file_path.used += parameter_file_name_nano.used; } if (data_build.setting.version_target == fake_build_version_type_major_e) { - parameter_linker_length += parameter_file_name_major_length; + parameter_linker.used += parameter_file_name_major.used; } else if (data_build.setting.version_target == fake_build_version_type_minor_e) { - parameter_linker_length += parameter_file_name_minor_length; + parameter_linker.used += parameter_file_name_minor.used; } else if (data_build.setting.version_target == fake_build_version_type_micro_e) { - parameter_linker_length += parameter_file_name_micro_length; + parameter_linker.used += parameter_file_name_micro.used; } else if (data_build.setting.version_target == fake_build_version_type_nano_e) { - parameter_linker_length += parameter_file_name_nano_length; + parameter_linker.used += parameter_file_name_nano.used; } - char parameter_linker[parameter_linker_length + 1]; - char parameter_file_path[parameter_file_path_length + 1]; + char parameter_linker_string[parameter_linker.used + 1]; + char parameter_file_path_string[parameter_file_path.used + 1]; + + parameter_linker.string = parameter_linker_string; + parameter_file_path.string = parameter_file_path_string; - memcpy(parameter_linker, fake_build_parameter_library_shared_prefix_s.string, fake_build_parameter_library_shared_prefix_s.used); - memcpy(parameter_file_path, main->path_build_libraries_shared.string, main->path_build_libraries_shared.used); + memcpy(parameter_linker_string, fake_build_parameter_library_shared_prefix_s.string, fake_build_parameter_library_shared_prefix_s.used); + memcpy(parameter_file_path_string, main->path_build_libraries_shared.string, main->path_build_libraries_shared.used); if (data_build.setting.version_file == fake_build_version_type_major_e) { - memcpy(parameter_file_path + main->path_build_libraries_shared.used, parameter_file_name_major, parameter_file_name_major_length); + memcpy(parameter_file_path_string + main->path_build_libraries_shared.used, parameter_file_name_major_string, parameter_file_name_major.used); } else if (data_build.setting.version_file == fake_build_version_type_minor_e) { - memcpy(parameter_file_path + main->path_build_libraries_shared.used, parameter_file_name_minor, parameter_file_name_minor_length); + memcpy(parameter_file_path_string + main->path_build_libraries_shared.used, parameter_file_name_minor_string, parameter_file_name_minor.used); } else if (data_build.setting.version_file == fake_build_version_type_micro_e) { - memcpy(parameter_file_path + main->path_build_libraries_shared.used, parameter_file_name_micro, parameter_file_name_micro_length); + memcpy(parameter_file_path_string + main->path_build_libraries_shared.used, parameter_file_name_micro_string, parameter_file_name_micro.used); } else if (data_build.setting.version_file == fake_build_version_type_nano_e) { - memcpy(parameter_file_path + main->path_build_libraries_shared.used, parameter_file_name_nano, parameter_file_name_nano_length); + memcpy(parameter_file_path_string + main->path_build_libraries_shared.used, parameter_file_name_nano_string, parameter_file_name_nano.used); } if (data_build.setting.version_target == fake_build_version_type_major_e) { - memcpy(parameter_linker + fake_build_parameter_library_shared_prefix_s.used, parameter_file_name_major, parameter_file_name_major_length); + memcpy(parameter_linker_string + fake_build_parameter_library_shared_prefix_s.used, parameter_file_name_major_string, parameter_file_name_major.used); } else if (data_build.setting.version_target == fake_build_version_type_minor_e) { - memcpy(parameter_linker + fake_build_parameter_library_shared_prefix_s.used, parameter_file_name_minor, parameter_file_name_minor_length); + memcpy(parameter_linker_string + fake_build_parameter_library_shared_prefix_s.used, parameter_file_name_minor_string, parameter_file_name_minor.used); } else if (data_build.setting.version_target == fake_build_version_type_micro_e) { - memcpy(parameter_linker + fake_build_parameter_library_shared_prefix_s.used, parameter_file_name_micro, parameter_file_name_micro_length); + memcpy(parameter_linker_string + fake_build_parameter_library_shared_prefix_s.used, parameter_file_name_micro_string, parameter_file_name_micro.used); } else if (data_build.setting.version_target == fake_build_version_type_nano_e) { - memcpy(parameter_linker + fake_build_parameter_library_shared_prefix_s.used, parameter_file_name_nano, parameter_file_name_nano_length); + memcpy(parameter_linker_string + fake_build_parameter_library_shared_prefix_s.used, parameter_file_name_nano_string, parameter_file_name_nano.used); } - parameter_linker[parameter_linker_length] = 0; - parameter_file_path[parameter_file_path_length] = 0; + parameter_linker_string[parameter_linker.used] = 0; + parameter_file_path_string[parameter_file_path.used] = 0; const f_string_static_t values[] = { fake_build_parameter_library_shared_s, - macro_f_string_static_t_initialize(parameter_linker, 0, parameter_linker_length), + parameter_linker, fake_build_parameter_library_output_s, - macro_f_string_static_t_initialize(parameter_file_path, 0, parameter_file_path_length), + parameter_file_path, }; for (uint8_t i = 0; i < 4; ++i) { @@ -356,114 +368,119 @@ extern "C" { if (*status == F_child) return result; } - if (parameter_file_name_major_length) { - f_array_length_t parameter_file_path_length = main->path_build_libraries_shared.used + parameter_file_name_length; + if (parameter_file_name_major.used) { + f_string_static_t parameter_file_path = f_string_static_t_initialize; + parameter_file_path.used = main->path_build_libraries_shared.used + parameter_file_name.used; - char parameter_file_path[parameter_file_path_length + 1]; + char parameter_file_path_string[parameter_file_path.used + 1]; + parameter_file_path.string = parameter_file_path_string; - memcpy(parameter_file_path, main->path_build_libraries_shared.string, main->path_build_libraries_shared.used); - memcpy(parameter_file_path + main->path_build_libraries_shared.used, parameter_file_name, parameter_file_name_length); + memcpy(parameter_file_path.string, main->path_build_libraries_shared.string, main->path_build_libraries_shared.used); + memcpy(parameter_file_path.string + main->path_build_libraries_shared.used, parameter_file_name.string, parameter_file_name.used); - parameter_file_path[parameter_file_path_length] = 0; + parameter_file_path_string[parameter_file_path.used] = 0; *status = f_file_link(parameter_file_name_major, parameter_file_path); if (F_status_is_error_not(*status) && main->error.verbosity == f_console_verbosity_verbose_e) { - fll_print_format("Linked file '%S' to '%S'.%r", main->output.to.stream, parameter_file_path, parameter_file_name_major, f_string_eol_s); + fll_print_format("Linked file '%Q' to '%Q'.%r", main->output.to.stream, parameter_file_path, parameter_file_name_major, f_string_eol_s); } else if (F_status_is_error(*status)) { if (F_status_set_fine(*status) == F_file_found) { - fll_error_file_print(main->error, F_status_set_fine(*status), "f_file_link", F_true, parameter_file_path, "link", fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(*status), "f_file_link", F_true, parameter_file_path, f_file_operation_link_s, fll_error_file_type_file_e); return 0; } - fll_error_file_print(main->error, F_status_set_fine(*status), "f_file_link", F_true, parameter_file_name_major, "link", fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(*status), "f_file_link", F_true, parameter_file_name_major, f_file_operation_link_s, fll_error_file_type_file_e); return 0; } } - if (data_build.setting.version_file != fake_build_version_type_major_e && parameter_file_name_major_length) { + if (data_build.setting.version_file != fake_build_version_type_major_e && parameter_file_name_major.used) { + f_string_static_t parameter_file_path = f_string_static_t_initialize; + parameter_file_path.used = main->path_build_libraries_shared.used + parameter_file_name_major.used; - f_array_length_t parameter_file_path_length = main->path_build_libraries_shared.used + parameter_file_name_major_length; + char parameter_file_path_string[parameter_file_path.used + 1]; - char parameter_file_path[parameter_file_path_length + 1]; + memcpy(parameter_file_path.string, main->path_build_libraries_shared.string, main->path_build_libraries_shared.used); + memcpy(parameter_file_path.string + main->path_build_libraries_shared.used, parameter_file_name_major.string, parameter_file_name_major.used); - memcpy(parameter_file_path, main->path_build_libraries_shared.string, main->path_build_libraries_shared.used); - memcpy(parameter_file_path + main->path_build_libraries_shared.used, parameter_file_name_major, parameter_file_name_major_length); - - parameter_file_path[parameter_file_path_length] = 0; + parameter_file_path_string[parameter_file_path.used] = 0; + parameter_file_path.string = parameter_file_path_string; *status = f_file_link(parameter_file_name_minor, parameter_file_path); if (F_status_is_error_not(*status) && main->error.verbosity == f_console_verbosity_verbose_e) { - fll_print_format("Linked file '%S' to '%S'.%r", main->output.to.stream, parameter_file_path, parameter_file_name_minor, f_string_eol_s); + fll_print_format("Linked file '%Q' to '%Q'.%r", main->output.to.stream, parameter_file_path, parameter_file_name_minor, f_string_eol_s); } else if (F_status_is_error(*status)) { if (F_status_set_fine(*status) == F_file_found) { - fll_error_file_print(main->error, F_status_set_fine(*status), "f_file_link", F_true, parameter_file_path, "link", fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(*status), "f_file_link", F_true, parameter_file_path, f_file_operation_link_s, fll_error_file_type_file_e); return 0; } - fll_error_file_print(main->error, F_status_set_fine(*status), "f_file_link", F_true, parameter_file_name_minor, "link", fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(*status), "f_file_link", F_true, parameter_file_name_minor, f_file_operation_link_s, fll_error_file_type_file_e); return 0; } - if (data_build.setting.version_file != fake_build_version_type_minor_e && parameter_file_name_minor_length) { - - f_array_length_t parameter_file_path_length = main->path_build_libraries_shared.used + parameter_file_name_minor_length; + if (data_build.setting.version_file != fake_build_version_type_minor_e && parameter_file_name_minor.used) { + f_string_static_t parameter_file_path = f_string_static_t_initialize; + parameter_file_path.used = main->path_build_libraries_shared.used + parameter_file_name_minor.used; - char parameter_file_path[parameter_file_path_length + 1]; + char parameter_file_path_string[parameter_file_path.used + 1]; + parameter_file_path.string = parameter_file_path_string; - memcpy(parameter_file_path, main->path_build_libraries_shared.string, main->path_build_libraries_shared.used); - memcpy(parameter_file_path + main->path_build_libraries_shared.used, parameter_file_name_minor, parameter_file_name_minor_length); + memcpy(parameter_file_path.string, main->path_build_libraries_shared.string, main->path_build_libraries_shared.used); + memcpy(parameter_file_path.string + main->path_build_libraries_shared.used, parameter_file_name_minor.string, parameter_file_name_minor.used); - parameter_file_path[parameter_file_path_length] = 0; + parameter_file_path_string[parameter_file_path.used] = 0; *status = f_file_link(parameter_file_name_micro, parameter_file_path); if (F_status_is_error_not(*status) && main->error.verbosity == f_console_verbosity_verbose_e) { - fll_print_format("Linked file '%S' to '%S'.%r", main->output.to.stream, parameter_file_path, parameter_file_name_micro, f_string_eol_s); + fll_print_format("Linked file '%Q' to '%Q'.%r", main->output.to.stream, parameter_file_path, parameter_file_name_micro, f_string_eol_s); } else if (F_status_is_error(*status)) { if (F_status_set_fine(*status) == F_file_found) { - fll_error_file_print(main->error, F_status_set_fine(*status), "f_file_link", F_true, parameter_file_path, "link", fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(*status), "f_file_link", F_true, parameter_file_path, f_file_operation_link_s, fll_error_file_type_file_e); return 0; } - fll_error_file_print(main->error, F_status_set_fine(*status), "f_file_link", F_true, parameter_file_name_micro, "link", fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(*status), "f_file_link", F_true, parameter_file_name_micro, f_file_operation_link_s, fll_error_file_type_file_e); return 0; } - if (data_build.setting.version_file != fake_build_version_type_micro_e && parameter_file_name_micro_length) { - - f_array_length_t parameter_file_path_length = main->path_build_libraries_shared.used + parameter_file_name_micro_length; + if (data_build.setting.version_file != fake_build_version_type_micro_e && parameter_file_name_micro.used) { + f_string_static_t parameter_file_path = f_string_static_t_initialize; + parameter_file_path.used = main->path_build_libraries_shared.used + parameter_file_name_micro.used; - char parameter_file_path[parameter_file_path_length + 1]; + char parameter_file_path_string[parameter_file_path.used + 1]; + parameter_file_path.string = parameter_file_path_string; - memcpy(parameter_file_path, main->path_build_libraries_shared.string, main->path_build_libraries_shared.used); - memcpy(parameter_file_path + main->path_build_libraries_shared.used, parameter_file_name_micro, parameter_file_name_micro_length); + memcpy(parameter_file_path_string, main->path_build_libraries_shared.string, main->path_build_libraries_shared.used); + memcpy(parameter_file_path_string + main->path_build_libraries_shared.used, parameter_file_name_micro.string, parameter_file_name_micro.used); - parameter_file_path[parameter_file_path_length] = 0; + parameter_file_path_string[parameter_file_path.used] = 0; *status = f_file_link(parameter_file_name_nano, parameter_file_path); if (F_status_is_error_not(*status) && main->error.verbosity == f_console_verbosity_verbose_e) { - fll_print_format("Linked file '%S' to '%S'.%r", main->output.to.stream, parameter_file_path, parameter_file_name_nano, f_string_eol_s); + fll_print_format("Linked file '%Q' to '%Q'.%r", main->output.to.stream, parameter_file_path, parameter_file_name_nano, f_string_eol_s); } else if (F_status_is_error(*status)) { if (F_status_set_fine(*status) == F_file_found) { - fll_error_file_print(main->error, F_status_set_fine(*status), "f_file_link", F_true, parameter_file_path, "link", fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(*status), "f_file_link", F_true, parameter_file_path, f_file_operation_link_s, fll_error_file_type_file_e); return 0; } - fll_error_file_print(main->error, F_status_set_fine(*status), "f_file_link", F_true, parameter_file_name_nano, "link", fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(*status), "f_file_link", F_true, parameter_file_name_nano, f_file_operation_link_s, fll_error_file_type_file_e); return 0; } @@ -480,7 +497,7 @@ extern "C" { #ifndef _di_fake_build_library_static_ int fake_build_library_static(fake_main_t * const main, const fake_build_data_t data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t *status) { - if (F_status_is_error(*status) || f_file_exists(file_stage.string) == F_true || *status == F_child) return main->child; + if (F_status_is_error(*status) || f_file_exists(file_stage) == F_true || *status == F_child) return main->child; if (!data_build.setting.build_sources_library.used) return 0; if (main->output.verbosity != f_console_verbosity_quiet_e) { @@ -551,7 +568,7 @@ extern "C" { break; } - *status = f_file_name_directory(sources[i]->array[j].string, sources[i]->array[j].used, &source_path); + *status = f_file_name_directory(sources[i]->array[j], &source_path); if (F_status_is_error(*status)) { fll_error_print(main->error, F_status_set_fine(*status), "f_file_name_directory", F_true); diff --git a/level_3/fake/c/private-build-load.c b/level_3/fake/c/private-build-load.c index 60a1da2..511611c 100644 --- a/level_3/fake/c/private-build-load.c +++ b/level_3/fake/c/private-build-load.c @@ -116,7 +116,7 @@ extern "C" { } if (F_status_is_error(*status)) { - fake_print_error_fss(main, F_status_set_fine(*status), "fll_fss_extended_read", main->file_data_build_settings.string, range, F_true); + fake_print_error_fss(main, F_status_set_fine(*status), "fll_fss_extended_read", main->file_data_build_settings, range, F_true); } else { *status = fl_fss_apply_delimit(delimits, &buffer); @@ -499,7 +499,7 @@ extern "C" { settings_mode_names[j].used = 0; - *status = f_string_dynamic_increase_by(settings_length[j] + f_string_ascii_minus_s.used + modes->array[i].used, &settings_mode_names[j]); + *status = f_string_dynamic_increase_by(settings_value[j]->used + f_string_ascii_minus_s.used + modes->array[i].used, &settings_mode_names[j]); if (F_status_is_error(*status)) { function = "f_string_dynamic_increase_by"; @@ -507,13 +507,13 @@ extern "C" { break; } - memcpy(settings_mode_names[j].string, settings_name[j], settings_length[j]); - settings_mode_names[j].used = settings_length[j]; + memcpy(settings_mode_names[j].string, settings_name[j].string, settings_value[j]->used); + settings_mode_names[j].used = settings_value[j]->used; memcpy(settings_mode_names[j].string, f_string_ascii_minus_s.string, f_string_ascii_minus_s.used); settings_mode_names[j].used += f_string_ascii_minus_s.used; - memcpy(settings_mode_names[j].string + settings_mode_namesf[j].used, modes->array[i].string, modes->array[i].used); + memcpy(settings_mode_names[j].string + settings_mode_names[j].used, modes->array[i].string, modes->array[i].used); settings_mode_names[j].used += modes->array[i].used; } // for @@ -775,7 +775,7 @@ extern "C" { 0, // search_exclusive 0, // search_shared 0, // search_static - fake_build_version_type_micro_e, // version_file + fake_build_version_type_micro_e, // version_file 0, // version_major 0, // version_major_prefix 0, // version_micro @@ -784,42 +784,42 @@ extern "C" { 0, // version_minor_prefix 0, // version_nano 0, // version_nano_prefix - fake_build_version_type_major_e, // version_target + fake_build_version_type_major_e, // version_target }; - const char *settings_single_version_default_name[] = { - 0, // build_compiler - 0, // build_indexer - 0, // build_language - 0, // build_script - 0, // build_shared - 0, // build_static - 0, // path_headers - 0, // path_headers_preserve - 0, // path_language - 0, // path_library_script - 0, // path_library_shared - 0, // path_library_static - 0, // path_program_script - 0, // path_program_shared - 0, // path_program_static - 0, // path_sources - 0, // path_standard - 0, // process_post - 0, // process_pre - 0, // project_name - 0, // search_exclusive - 0, // search_shared - 0, // search_static + const f_string_static_t settings_single_version_default_name[] = { + f_string_empty_s, // build_compiler + f_string_empty_s, // build_indexer + f_string_empty_s, // build_language + f_string_empty_s, // build_script + f_string_empty_s, // build_shared + f_string_empty_s, // build_static + f_string_empty_s, // path_headers + f_string_empty_s, // path_headers_preserve + f_string_empty_s, // path_language + f_string_empty_s, // path_library_script + f_string_empty_s, // path_library_shared + f_string_empty_s, // path_library_static + f_string_empty_s, // path_program_script + f_string_empty_s, // path_program_shared + f_string_empty_s, // path_program_static + f_string_empty_s, // path_sources + f_string_empty_s, // path_standard + f_string_empty_s, // process_post + f_string_empty_s, // process_pre + f_string_empty_s, // project_name + f_string_empty_s, // search_exclusive + f_string_empty_s, // search_shared + f_string_empty_s, // search_static fake_build_version_micro_s, // version_file - 0, // version_major - 0, // version_major_prefix - 0, // version_micro - 0, // version_micro_prefix - 0, // version_minor - 0, // version_minor_prefix - 0, // version_nano - 0, // version_nano_prefix + f_string_empty_s, // version_major + f_string_empty_s, // version_major_prefix + f_string_empty_s, // version_micro + f_string_empty_s, // version_micro_prefix + f_string_empty_s, // version_minor + f_string_empty_s, // version_minor_prefix + f_string_empty_s, // version_nano + f_string_empty_s, // version_nano_prefix fake_build_version_major_s, // version_target }; @@ -881,10 +881,10 @@ extern "C" { } if (settings_single_type[i] == 1) { - if (fl_string_compare_trim(settings_single_source[i]->array[0].string, fake_common_setting_bool_yes_s, settings_single_source[i]->array[0].used, fake_common_setting_bool_yes_s_length) == F_equal_to) { + if (fl_string_dynamic_compare_trim(settings_single_source[i]->array[0], fake_common_setting_bool_yes_s) == F_equal_to) { *settings_single_bool[i] = F_true; } - else if (fl_string_compare_trim(settings_single_source[i]->array[0].string, fake_common_setting_bool_no_s, settings_single_source[i]->array[0].used, fake_common_setting_bool_no_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare_trim(settings_single_source[i]->array[0], fake_common_setting_bool_no_s) == F_equal_to) { *settings_single_bool[i] = F_false; } else { @@ -910,13 +910,13 @@ extern "C" { } } else if (settings_single_type[i] == 4) { - if (fl_string_compare_trim(settings_single_source[i]->array[0].string, fake_build_language_bash_s, settings_single_source[i]->array[0].used, fake_build_language_bash_s_length) == F_equal_to) { + if (fl_string_dynamic_compare_trim(settings_single_source[i]->array[0], fake_build_language_bash_s) == F_equal_to) { *settings_single_language[i] = fake_build_language_type_bash_e; } - else if (fl_string_compare_trim(settings_single_source[i]->array[0].string, fake_build_language_c_s, settings_single_source[i]->array[0].used, fake_build_language_c_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare_trim(settings_single_source[i]->array[0], fake_build_language_c_s) == F_equal_to) { *settings_single_language[i] = fake_build_language_type_c_e; } - else if (fl_string_compare_trim(settings_single_source[i]->array[0].string, fake_build_language_cpp_s, settings_single_source[i]->array[0].used, fake_build_language_cpp_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare_trim(settings_single_source[i]->array[0], fake_build_language_cpp_s) == F_equal_to) { *settings_single_language[i] = fake_build_language_type_cpp_e; } else { @@ -944,16 +944,16 @@ extern "C" { } } else if (settings_single_type[i] == 5) { - if (fl_string_compare_trim(settings_single_source[i]->array[0].string, fake_build_version_major_s, settings_single_source[i]->array[0].used, fake_build_version_major_s_length) == F_equal_to) { + if (fl_string_dynamic_compare_trim(settings_single_source[i]->array[0], fake_build_version_major_s) == F_equal_to) { *settings_single_version[i] = fake_build_version_type_major_e; } - else if (fl_string_compare_trim(settings_single_source[i]->array[0].string, fake_build_version_minor_s, settings_single_source[i]->array[0].used, fake_build_version_minor_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare_trim(settings_single_source[i]->array[0], fake_build_version_minor_s) == F_equal_to) { *settings_single_version[i] = fake_build_version_type_minor_e; } - else if (fl_string_compare_trim(settings_single_source[i]->array[0].string, fake_build_version_micro_s, settings_single_source[i]->array[0].used, fake_build_version_micro_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare_trim(settings_single_source[i]->array[0], fake_build_version_micro_s) == F_equal_to) { *settings_single_version[i] = fake_build_version_type_micro_e; } - else if (fl_string_compare_trim(settings_single_source[i]->array[0].string, fake_build_version_nano_s, settings_single_source[i]->array[0].used, fake_build_version_nano_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare_trim(settings_single_source[i]->array[0], fake_build_version_nano_s) == F_equal_to) { *settings_single_version[i] = fake_build_version_type_nano_e; } else { @@ -1336,7 +1336,7 @@ extern "C" { return; } - const f_string_t names[] = { + const f_string_static_t names[] = { fake_build_stage_libraries_script_s, fake_build_stage_libraries_shared_s, fake_build_stage_libraries_static_s, @@ -1373,10 +1373,10 @@ extern "C" { f_string_dynamic_t settings_file_base = f_string_dynamic_t_initialize; if (settings_file.used) { - *status = f_file_name_base(settings_file.string, settings_file.used, &settings_file_base); + *status = f_file_name_base(settings_file, &settings_file_base); } else { - *status = f_file_name_base(main->file_data_build_settings.string, main->file_data_build_settings.used, &settings_file_base); + *status = f_file_name_base(main->file_data_build_settings, &settings_file_base); } if (F_status_is_error(*status)) { diff --git a/level_3/fake/c/private-build-objects.c b/level_3/fake/c/private-build-objects.c index 94e7fbc..b0b439c 100644 --- a/level_3/fake/c/private-build-objects.c +++ b/level_3/fake/c/private-build-objects.c @@ -13,7 +13,7 @@ extern "C" { #ifndef _di_fake_build_objects_static_ int fake_build_objects_static(fake_main_t * const main, const fake_build_data_t data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t *status) { - if (F_status_is_error(*status) || f_file_exists(file_stage.string) == F_true || *status == F_child) return main->child; + if (F_status_is_error(*status) || f_file_exists(file_stage) == F_true || *status == F_child) return main->child; if (!data_build.setting.build_sources_library.used) return 0; if (main->output.verbosity != f_console_verbosity_quiet_e) { @@ -23,8 +23,8 @@ extern "C" { f_string_dynamic_t file_name = f_string_dynamic_t_initialize; f_string_dynamic_t destination_path = f_string_dynamic_t_initialize; f_string_dynamics_t arguments = f_string_dynamics_t_initialize; - f_array_length_t source_length = 0; - f_array_length_t destination_length = 0; + f_string_static_t destination = f_string_static_t_initialize; + f_string_static_t source = f_string_static_t_initialize; const f_string_static_t *path_sources = &main->path_sources; @@ -56,14 +56,13 @@ extern "C" { file_name.used = 0; destination_path.used = 0; + source.used = path_sources->used + sources[i]->array[j].used; - source_length = path_sources->used + sources[i]->array[j].used; + char source_string[source.used + 1]; - char source[source_length + 1]; - - memcpy(source, path_sources->string, path_sources->used); - memcpy(source + path_sources->used, sources[i]->array[j].string, sources[i]->array[j].used); - source[source_length] = 0; + memcpy(source_string, path_sources->string, path_sources->used); + memcpy(source_string + path_sources->used, sources[i]->array[j].string, sources[i]->array[j].used); + source_string[source.used] = 0; *status = fake_build_get_file_name_without_extension(main, sources[i]->array[j], &file_name); @@ -73,7 +72,7 @@ extern "C" { break; } - *status = f_file_name_directory(sources[i]->array[j].string, sources[i]->array[j].used, &destination_path); + *status = f_file_name_directory(sources[i]->array[j], &destination_path); if (F_status_is_error(*status)) { fll_error_print(main->error, F_status_set_fine(*status), "f_file_name_directory", F_true); @@ -94,6 +93,7 @@ extern "C" { if (F_status_is_error(*status)) { fll_error_print(main->error, F_status_set_fine(*status), "f_string_dynamic_append_assure", F_true); + break; } @@ -105,7 +105,7 @@ extern "C" { break; } - *status = f_directory_exists(destination_path.string); + *status = f_directory_exists(destination_path); if (*status == F_false) { if (main->error.verbosity != f_console_verbosity_quiet_e) { @@ -122,8 +122,9 @@ extern "C" { break; } - else if (*status == F_file_found_not) { - *status = f_directory_create(destination_path.string, mode.directory); + + if (*status == F_file_found_not) { + *status = f_directory_create(destination_path, mode.directory); if (F_status_is_error(*status)) { if (F_status_set_fine(*status) == F_file_found_not) { @@ -146,44 +147,46 @@ extern "C" { fll_print_format("Directory '%Q' created.%r", main->output.to.stream, destination_path, f_string_eol_s); } } - else if (F_status_is_error(*status)) { + + if (F_status_is_error(*status)) { fll_error_file_print(main->error, F_status_set_fine(*status), "f_directory_exists", F_true, destination_path, f_file_operation_create_s, fll_error_file_type_directory_e); break; } - destination_length = destination_path.used + file_name.used + fake_build_parameter_object_name_suffix_s.used; + destination.used = destination_path.used + file_name.used + fake_build_parameter_object_name_suffix_s.used; } else { - destination_length = main->path_build_objects.used + file_name.used + fake_build_parameter_object_name_suffix_s.used; + destination.used = main->path_build_objects.used + file_name.used + fake_build_parameter_object_name_suffix_s.used; } - char destination[destination_length + 1]; + char destination_string[destination.used + 1]; + destination.string = destination_string; if (destination_path.used) { - memcpy(destination, destination_path.string, destination_path.used); - memcpy(destination + destination_path.used, file_name.string, file_name.used); - memcpy(destination + destination_path.used + file_name.used, fake_build_parameter_object_name_suffix_s, fake_build_parameter_object_name_suffix_s.used); + memcpy(destination_string, destination_path.string, destination_path.used); + memcpy(destination_string + destination_path.used, file_name.string, file_name.used); + memcpy(destination_string + destination_path.used + file_name.used, fake_build_parameter_object_name_suffix_s.string, fake_build_parameter_object_name_suffix_s.used); } else { - memcpy(destination, main->path_build_objects.string, main->path_build_objects.used); - memcpy(destination + main->path_build_objects.used, file_name.string, file_name.used); - memcpy(destination + main->path_build_objects.used + file_name.used, fake_build_parameter_object_name_suffix_s, fake_build_parameter_object_name_suffix_s.used); + memcpy(destination_string, main->path_build_objects.string, main->path_build_objects.used); + memcpy(destination_string + main->path_build_objects.used, file_name.string, file_name.used); + memcpy(destination_string + main->path_build_objects.used + file_name.used, fake_build_parameter_object_name_suffix_s.string, fake_build_parameter_object_name_suffix_s.used); } - destination[destination_length] = 0; + destination_string[destination.used] = 0; const f_string_static_t values[] = { - macro_f_string_static_t_initialize(source, 0, source_length), + source, fake_build_parameter_object_compile_s, fake_build_parameter_object_static_s, fake_build_parameter_object_output_s, - macro_f_string_static_t_initialize(destination, 0, destination_length), + destination, }; for (uint8_t k = 0; k < 5; ++k) { - if (!lengths[k]) continue; + if (!values[k].used) continue; *status = fll_execute_arguments_add(values[k], &arguments); if (F_status_is_error(*status)) break; diff --git a/level_3/fake/c/private-build-program.c b/level_3/fake/c/private-build-program.c index c2f24b1..8c4b41a 100644 --- a/level_3/fake/c/private-build-program.c +++ b/level_3/fake/c/private-build-program.c @@ -13,7 +13,7 @@ extern "C" { #ifndef _di_fake_build_program_script_ int fake_build_program_script(fake_main_t * const main, const fake_build_data_t data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t *status) { - if (F_status_is_error(*status) || f_file_exists(file_stage.string) == F_true || *status == F_child) return main->child; + if (F_status_is_error(*status) || f_file_exists(file_stage) == F_true || *status == F_child) return main->child; fake_build_touch(main, file_stage, status); @@ -24,7 +24,7 @@ extern "C" { #ifndef _di_fake_build_program_shared_ int fake_build_program_shared(fake_main_t * const main, const fake_build_data_t data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t *status) { - if (F_status_is_error(*status) || f_file_exists(file_stage.string) == F_true || *status == F_child) return main->child; + if (F_status_is_error(*status) || f_file_exists(file_stage) == F_true || *status == F_child) return main->child; if (!data_build.setting.build_sources_program.used) return 0; if (main->output.verbosity != f_console_verbosity_quiet_e) { @@ -68,6 +68,7 @@ extern "C" { memcpy(source_string, path_sources->string, path_sources->used); memcpy(source_string + path_sources->used, sources[i]->array[j].string, sources[i]->array[j].used); + source_string[source.used] = 0; *status = fll_execute_arguments_add(source, &arguments); @@ -79,17 +80,20 @@ extern "C" { } if (F_status_is_error_not(*status)) { - f_array_length_t parameter_file_name_path_length = main->path_build_programs_shared.used + data_build.setting.project_name.used; + f_string_static_t parameter_file_name_path = f_string_static_t_initialize; + parameter_file_name_path.used = main->path_build_programs_shared.used + data_build.setting.project_name.used; + + char parameter_file_name_path_string[parameter_file_name_path.used + 1]; + parameter_file_name_path.string = parameter_file_name_path_string; - char parameter_file_name_path[parameter_file_name_path_length + 1]; + memcpy(parameter_file_name_path_string, main->path_build_programs_shared.string, main->path_build_programs_shared.used); + memcpy(parameter_file_name_path_string + main->path_build_programs_shared.used, data_build.setting.project_name.string, data_build.setting.project_name.used); - memcpy(parameter_file_name_path, main->path_build_programs_shared.string, main->path_build_programs_shared.used); - memcpy(parameter_file_name_path + main->path_build_programs_shared.used, data_build.setting.project_name.string, data_build.setting.project_name.used); - parameter_file_name_path[parameter_file_name_path_length] = 0; + parameter_file_name_path_string[parameter_file_name_path.used] = 0; const f_string_static_t values[] = { fake_build_parameter_library_output_s, - macro_f_string_static_t_initialize(parameter_file_name_path, 0, parameter_file_name_path_length), + parameter_file_name_path, }; for (uint8_t i = 0; i < 2; ++i) { @@ -104,13 +108,14 @@ extern "C" { // if project-specific library sources exist, then the -lproject_name needs to be added to the arguments. if (F_status_is_error_not(*status) && data_build.setting.build_sources_library.used) { f_string_static_t link_project_library = f_string_static_t_initialize; - link_project_library.used = fake_build_parameter_library_link_file_s_length + data_build.setting.project_name.used; + link_project_library.used = fake_build_parameter_library_link_file_s.used + data_build.setting.project_name.used; char link_project_library_string[link_project_library.used + 1]; link_project_library.string = link_project_library_string; - memcpy(link_project_library, fake_build_parameter_library_link_file_s.string, fake_build_parameter_library_link_file_s.used); - memcpy(link_project_library + fake_build_parameter_library_link_file_s.string, data_build.setting.project_name.string, data_build.setting.project_name.used); + memcpy(link_project_library_string, fake_build_parameter_library_link_file_s.string, fake_build_parameter_library_link_file_s.used); + memcpy(link_project_library_string + fake_build_parameter_library_link_file_s.used, data_build.setting.project_name.string, data_build.setting.project_name.used); + link_project_library_string[link_project_library.used] = 0; *status = fll_execute_arguments_add(link_project_library, &arguments); @@ -122,6 +127,7 @@ extern "C" { fll_error_print(main->error, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); macro_f_string_dynamics_t_delete_simple(arguments); + return 0; } @@ -140,7 +146,7 @@ extern "C" { #ifndef _di_fake_build_program_static_ int fake_build_program_static(fake_main_t * const main, const fake_build_data_t data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t *status) { - if (F_status_is_error(*status) || f_file_exists(file_stage.string) == F_true || *status == F_child) return main->child; + if (F_status_is_error(*status) || f_file_exists(file_stage) == F_true || *status == F_child) return main->child; if (!data_build.setting.build_sources_program.used) return 0; if (main->output.verbosity != f_console_verbosity_quiet_e) { @@ -186,6 +192,7 @@ extern "C" { memcpy(source_string, path_sources->string, path_sources->used); memcpy(source_string + path_sources->used, sources[i]->array[j].string, sources[i]->array[j].used); + source_string[source.used] = 0; *status = fll_execute_arguments_add(source, &arguments); @@ -197,42 +204,45 @@ extern "C" { } if (F_status_is_error_not(*status)) { - f_array_length_t source_library_length = main->path_build_libraries_static.used + fake_build_parameter_library_name_prefix_s_length + data_build.setting.project_name.used + fake_build_parameter_library_name_suffix_static_s_length; - - char source_library[source_library_length + 1]; + f_string_static_t source_library = f_string_static_t_initialize; + source_library.used = main->path_build_libraries_static.used + fake_build_parameter_library_name_prefix_s.used + data_build.setting.project_name.used + fake_build_parameter_library_name_suffix_static_s.used; - source_library_length = 0; + char source_library_string[source_library.used + 1]; + source_library.string = source_library_string; + source_library.used = 0; - // only include the library if there are sources that would result in it being built. + // Only include the library if there are sources that would result in it being built. if (data_build.setting.build_sources_library.used) { - memcpy(source_library, main->path_build_libraries_static.string, main->path_build_libraries_static.used); - source_library_length += main->path_build_libraries_static.used; + memcpy(source_library_string, main->path_build_libraries_static.string, main->path_build_libraries_static.used); + source_library.used += main->path_build_libraries_static.used; - memcpy(source_library + source_library_length, fake_build_parameter_library_name_prefix_s.string, fake_build_parameter_library_name_prefix_s.used); - source_library_length += fake_build_parameter_library_name_prefix_s.used; + memcpy(source_library_string + source_library.used, fake_build_parameter_library_name_prefix_s.string, fake_build_parameter_library_name_prefix_s.used); + source_library.used += fake_build_parameter_library_name_prefix_s.used; - memcpy(source_library + source_library_length, data_build.setting.project_name.string, data_build.setting.project_name.used); - source_library_length += data_build.setting.project_name.used; + memcpy(source_library_string + source_library.used, data_build.setting.project_name.string, data_build.setting.project_name.used); + source_library.used += data_build.setting.project_name.used; - memcpy(source_library + source_library_length, fake_build_parameter_library_name_suffix_static_s.string, fake_build_parameter_library_name_suffix_static_s.used); - source_library_length += fake_build_parameter_library_name_suffix_static_s.used; + memcpy(source_library_string + source_library.used, fake_build_parameter_library_name_suffix_static_s.string, fake_build_parameter_library_name_suffix_static_s.used); + source_library.used += fake_build_parameter_library_name_suffix_static_s.used; } - source_library.string[source_library_length] = 0; + source_library_string[source_library.used] = 0; - f_array_length_t parameter_file_name_path_length = main->path_build_programs_static.used + data_build.setting.project_name.used; + f_string_static_t parameter_file_name_path = f_string_static_t_initialize; + parameter_file_name_path.used = main->path_build_programs_static.used + data_build.setting.project_name.used; - char parameter_file_name_path[parameter_file_name_path_length + 1]; + char parameter_file_name_path_string[parameter_file_name_path.used + 1]; - memcpy(parameter_file_name_path, main->path_build_programs_static.string, main->path_build_programs_static.used); - memcpy(parameter_file_name_path + main->path_build_programs_static.used, data_build.setting.project_name.string, data_build.setting.project_name.used); - parameter_file_name_path[parameter_file_name_path_length] = 0; + memcpy(parameter_file_name_path_string, main->path_build_programs_static.string, main->path_build_programs_static.used); + memcpy(parameter_file_name_path_string + main->path_build_programs_static.used, data_build.setting.project_name.string, data_build.setting.project_name.used); + + parameter_file_name_path_string[parameter_file_name_path.used] = 0; const f_string_static_t values[] = { - macro_f_string_static_t_initialize(source_library, 0, source_library_length), + source_library, fake_build_parameter_library_static_s, fake_build_parameter_library_output_s, - macro_f_string_static_t_initialize(parameter_file_name_path, 0, parameter_file_name_path_length), + parameter_file_name_path, }; for (uint8_t i = 0; i < 4; ++i) { @@ -250,6 +260,7 @@ extern "C" { fll_error_print(main->error, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); macro_f_string_dynamics_t_delete_simple(arguments); + return 0; } diff --git a/level_3/fake/c/private-build-skeleton.c b/level_3/fake/c/private-build-skeleton.c index 428d655..13daf9e 100644 --- a/level_3/fake/c/private-build-skeleton.c +++ b/level_3/fake/c/private-build-skeleton.c @@ -13,7 +13,7 @@ extern "C" { #ifndef _di_fake_build_skeleton_ void fake_build_skeleton(fake_main_t * const main, const fake_build_data_t data_build, const mode_t mode, const f_string_static_t file_stage, f_status_t *status) { - if (F_status_is_error(*status) || f_file_exists(file_stage.string) == F_true || *status == F_child) return; + if (F_status_is_error(*status) || f_file_exists(file_stage) == F_true || *status == F_child) return; f_string_static_t path_headers = f_string_static_t_initialize; f_array_length_t directory_headers_length = main->path_build_includes.used + data_build.setting.path_headers.used; @@ -71,7 +71,7 @@ extern "C" { directorys[i]->string[j] = 0; - *status = f_directory_exists(directorys[i]->string); + *status = f_directory_exists(*directorys[i]); if (F_status_is_error(*status) || *status == F_false) { directorys[i]->string[j] = f_path_separator_s.string[0]; @@ -80,7 +80,7 @@ extern "C" { } if (*status == F_file_found_not) { - *status = f_directory_create(directorys[i]->string, mode); + *status = f_directory_create(*directorys[i], mode); } directorys[i]->string[j] = f_path_separator_s.string[0]; @@ -89,7 +89,7 @@ extern "C" { } // for if (F_status_is_fine(*status)) { - *status = f_directory_create(directorys[i]->string, mode); + *status = f_directory_create(*directorys[i], mode); } if (F_status_is_error(*status)) { @@ -98,7 +98,7 @@ extern "C" { continue; } - fll_error_file_print(main->error, F_status_set_fine(*status), "f_directory_create", F_true, directorys[i]->string, "create", fll_error_file_type_directory_e); + fll_error_file_print(main->error, F_status_set_fine(*status), "f_directory_create", F_true, *directorys[i], f_file_operation_create_s, fll_error_file_type_directory_e); return; } diff --git a/level_3/fake/c/private-build.c b/level_3/fake/c/private-build.c index 9efdd5a..3052e52 100644 --- a/level_3/fake/c/private-build.c +++ b/level_3/fake/c/private-build.c @@ -14,6 +14,14 @@ extern "C" { #endif +#ifndef _di_fake_build_strings_ + const f_string_static_t fake_build_header_files_s = macro_f_string_static_t_initialize(FAKE_build_header_files_s, 0, FAKE_build_header_files_s_length); + const f_string_static_t fake_build_header_files_shared_s = macro_f_string_static_t_initialize(FAKE_build_header_files_shared_s, 0, FAKE_build_header_files_shared_s_length); + const f_string_static_t fake_build_header_files_static_s = macro_f_string_static_t_initialize(FAKE_build_header_files_static_s, 0, FAKE_build_header_files_static_s_length); + const f_string_static_t fake_build_scripts_s = macro_f_string_static_t_initialize(FAKE_build_scripts_s, 0, FAKE_build_scripts_s_length); + const f_string_static_t fake_build_setting_files_s = macro_f_string_static_t_initialize(FAKE_build_setting_files_s, 0, FAKE_build_setting_files_s_length); +#endif // _di_fake_build_strings_ + #ifndef _di_fake_build_arguments_standard_add_ void fake_build_arguments_standard_add(fake_main_t * const main, const fake_build_data_t data_build, const bool is_shared, const bool is_library, f_string_dynamics_t *arguments, f_status_t *status) { @@ -283,9 +291,9 @@ extern "C" { #endif // _di_fake_build_arguments_standard_add_ #ifndef _di_fake_build_copy_ - void fake_build_copy(fake_main_t * const main, const f_mode_t mode, const f_string_t label, const f_string_static_t source, const f_string_static_t destination, const f_string_statics_t files, const f_string_static_t file_stage, const f_array_length_t preserve, f_status_t *status) { + void fake_build_copy(fake_main_t * const main, const f_mode_t mode, const f_string_static_t label, const f_string_static_t source, const f_string_static_t destination, const f_string_statics_t files, const f_string_static_t file_stage, const f_array_length_t preserve, f_status_t *status) { - if (F_status_is_error(*status) || f_file_exists(file_stage.string) == F_true || *status == F_child) return; + if (F_status_is_error(*status) || f_file_exists(file_stage) == F_true || *status == F_child) return; if (fake_signal_received(main)) { *status = F_status_set_error(F_interrupt); @@ -297,9 +305,10 @@ extern "C" { f_string_dynamic_t path_source = f_string_dynamic_t_initialize; f_string_dynamic_t destination_file = f_string_dynamic_t_initialize; f_string_dynamic_t destination_directory = f_string_dynamic_t_initialize; + f_string_static_t buffer = f_string_static_t_initialize; if (main->output.verbosity != f_console_verbosity_quiet_e) { - fll_print_format("%r%[Copying %S.%]%r", main->output.to.stream, f_string_eol_s, main->context.set.important, label, main->context.set.important, f_string_eol_s); + fll_print_format("%r%[Copying %Q.%]%r", main->output.to.stream, f_string_eol_s, main->context.set.important, label, main->context.set.important, f_string_eol_s); } macro_f_string_dynamic_t_resize(*status, path_source, source.used); @@ -331,6 +340,7 @@ extern "C" { if (!(i % fake_signal_check_short_d) && fake_signal_received(main)) { *status = F_status_set_error(F_interrupt); + break; } @@ -342,6 +352,7 @@ extern "C" { if (F_status_is_error(*status)) { fll_error_print(main->error, F_status_set_fine(*status), "f_string_dynamic_append_nulless", F_true); + break; } @@ -349,10 +360,11 @@ extern "C" { if (F_status_is_error(*status)) { fll_error_print(main->error, F_status_set_fine(*status), "f_string_dynamic_terminate_after", F_true); + break; } - *status = f_directory_is(path_source.string); + *status = f_directory_is(path_source); if (*status == F_true) { destination_directory.used = 0; @@ -361,13 +373,15 @@ extern "C" { if (F_status_is_error(*status)) { fll_error_print(main->error, F_status_set_fine(*status), "f_string_dynamic_append", F_true); + break; } - *status = f_file_name_base(path_source.string, path_source.used, &destination_directory); + *status = f_file_name_base(path_source, &destination_directory); if (F_status_is_error(*status)) { fll_error_print(main->error, F_status_set_fine(*status), "f_file_name_base", F_true); + break; } @@ -375,10 +389,11 @@ extern "C" { if (F_status_is_error(*status)) { fll_error_print(main->error, F_status_set_fine(*status), "f_string_dynamic_terminate_after", F_true); + break; } - *status = fl_directory_copy(path_source.string, destination_directory.string, path_source.used, destination_directory.used, mode, recurse); + *status = fl_directory_copy(path_source, destination_directory, mode, recurse); if (F_status_is_error(*status)) { if (main->error.verbosity == f_console_verbosity_verbose_e) { @@ -407,6 +422,7 @@ extern "C" { if (F_status_is_error(*status)) { fll_error_print(main->error, F_status_set_fine(*status), "f_string_dynamic_append_nulless", F_true); + break; } @@ -415,13 +431,18 @@ extern "C" { if (F_status_is_error(*status)) { fll_error_print(main->error, F_status_set_fine(*status), "f_string_dynamic_append_nulless", F_true); + break; } - *status = f_file_name_directory(path_source.string + preserve, path_source.used - preserve, &destination_directory); + buffer.string = path_source.string + preserve; + buffer.used = path_source.used - preserve; + + *status = f_file_name_directory(buffer, &destination_directory); if (F_status_is_error(*status)) { fll_error_print(main->error, F_status_set_fine(*status), "f_file_name_directory", F_true); + break; } @@ -429,13 +450,15 @@ extern "C" { if (F_status_is_error(*status)) { fll_error_print(main->error, F_status_set_fine(*status), "f_string_dynamic_terminate_after", F_true); + break; } - *status = fl_directory_create(destination_directory.string, destination_directory.used, F_file_mode_all_rwx_d); + *status = fl_directory_create(destination_directory, F_file_mode_all_rwx_d); if (F_status_is_error(*status)) { - fll_error_file_print(main->error, F_status_set_fine(*status), "fl_directory_create", F_true, destination_directory.string, "create", fll_error_file_type_directory_e); + fll_error_file_print(main->error, F_status_set_fine(*status), "fl_directory_create", F_true, destination_directory, f_file_operation_create_s, fll_error_file_type_directory_e); + break; } @@ -443,14 +466,16 @@ extern "C" { if (F_status_is_error(*status)) { fll_error_print(main->error, F_status_set_fine(*status), "f_string_append", F_true); + break; } } else { - *status = f_file_name_base(path_source.string, path_source.used, &destination_file); + *status = f_file_name_base(path_source, &destination_file); if (F_status_is_error(*status)) { fll_error_print(main->error, F_status_set_fine(*status), "f_file_name_base", F_true); + break; } } @@ -459,13 +484,15 @@ extern "C" { if (F_status_is_error(*status)) { fll_error_print(main->error, F_status_set_fine(*status), "f_string_dynamic_terminate_after", F_true); + break; } - *status = f_file_copy(path_source.string, destination_file.string, mode, F_file_default_read_size_d, F_false); + *status = f_file_copy(path_source, destination_file, mode, F_file_default_read_size_d, F_false); if (F_status_is_error(*status)) { - fake_print_error_build_operation_file(main, F_status_set_fine(*status), "f_file_copy", F_file_operation_copy_s, f_file_operation_to_s, path_source, destination_file, F_true); + fake_print_error_build_operation_file(main, F_status_set_fine(*status), "f_file_copy", f_file_operation_copy_s, f_file_operation_to_s, path_source, destination_file, F_true); + break; } @@ -475,6 +502,7 @@ extern "C" { } else if (F_status_is_error(*status)) { fll_error_file_print(main->error, F_status_set_fine(*status), "f_directory_is", F_true, path_source, f_file_operation_create_s, fll_error_file_type_file_e); + break; } @@ -496,7 +524,7 @@ extern "C" { #ifndef _di_fake_build_execute_process_script_ int fake_build_execute_process_script(fake_main_t * const main, const fake_build_data_t data_build, const f_string_static_t process_script, const f_string_static_t file_stage, f_status_t *status) { - if (F_status_is_error(*status) || f_file_exists(file_stage.string) == F_true || *status == F_child) return main->child; + if (F_status_is_error(*status) || f_file_exists(file_stage) == F_true || *status == F_child) return main->child; if (!process_script.used) return 0; f_string_dynamics_t arguments = f_string_dynamics_t_initialize; @@ -711,7 +739,7 @@ extern "C" { if (!path.used) return F_none; - f_status_t status = f_file_name_base(path.string, path.used, name); + f_status_t status = f_file_name_base(path, name); if (F_status_is_error(status)) { fll_error_print(main->error, F_status_set_fine(status), "f_file_name_base", F_true); @@ -725,6 +753,7 @@ extern "C" { if (name->string[i] == f_path_extension_separator_s.string[0]) { name->used = i; + break; } } // for @@ -778,7 +807,7 @@ extern "C" { main->child = fake_build_execute_process_script(main, data_build, data_build.setting.process_pre, stage.file_process_pre, &status); - fake_build_copy(main, mode, "setting files", main->path_data_settings, main->path_build_settings, data_build.setting.build_sources_setting, stage.file_sources_settings, 0, &status); + fake_build_copy(main, mode, fake_build_setting_files_s, main->path_data_settings, main->path_build_settings, data_build.setting.build_sources_setting, stage.file_sources_settings, 0, &status); if (data_build.setting.build_language == fake_build_language_type_bash_e) { fake_build_library_script(main, data_build, mode, stage.file_libraries_script, &status); @@ -786,7 +815,7 @@ extern "C" { fake_build_program_script(main, data_build, mode, stage.file_programs_script, &status); if (data_build.setting.build_script) { - fake_build_copy(main, mode, "scripts", main->path_sources_script, main->path_build_programs_script, data_build.setting.build_sources_script, stage.file_sources_script, 0, &status); + fake_build_copy(main, mode, fake_build_scripts_s, main->path_sources_script, main->path_build_programs_script, data_build.setting.build_sources_script, stage.file_sources_script, 0, &status); } } else { @@ -823,14 +852,14 @@ extern "C" { path_headers.used = directory_headers_length; path_headers.size = directory_headers_length + 1; - fake_build_copy(main, mode, "header files", path_sources, path_headers, data_build.setting.build_sources_headers, stage.file_sources_headers, data_build.setting.path_headers_preserve ? path_sources_base_length : 0, &status); + fake_build_copy(main, mode, fake_build_header_files_s, path_sources, path_headers, data_build.setting.build_sources_headers, stage.file_sources_headers, data_build.setting.path_headers_preserve ? path_sources_base_length : 0, &status); if (data_build.setting.build_shared) { - fake_build_copy(main, mode, "shared header files", path_sources, path_headers, data_build.setting.build_sources_headers_shared, stage.file_sources_headers, data_build.setting.path_headers_preserve ? path_sources_base_length : 0, &status); + fake_build_copy(main, mode, fake_build_header_files_shared_s, path_sources, path_headers, data_build.setting.build_sources_headers_shared, stage.file_sources_headers, data_build.setting.path_headers_preserve ? path_sources_base_length : 0, &status); } if (data_build.setting.build_static) { - fake_build_copy(main, mode, "static header files", path_sources, path_headers, data_build.setting.build_sources_headers_static, stage.file_sources_headers, data_build.setting.path_headers_preserve ? path_sources_base_length : 0, &status); + fake_build_copy(main, mode, fake_build_header_files_static_s, path_sources, path_headers, data_build.setting.build_sources_headers_static, stage.file_sources_headers, data_build.setting.path_headers_preserve ? path_sources_base_length : 0, &status); } } @@ -849,7 +878,7 @@ extern "C" { } if (data_build.setting.build_script) { - fake_build_copy(main, mode, "scripts", main->path_sources_script, main->path_build_programs_script, data_build.setting.build_sources_script, stage.file_sources_script, 0, &status); + fake_build_copy(main, mode, fake_build_scripts_s, main->path_sources_script, main->path_build_programs_script, data_build.setting.build_sources_script, stage.file_sources_script, 0, &status); } } @@ -869,6 +898,7 @@ extern "C" { if (fake_signal_received(main)) { *status = F_status_set_error(F_interrupt); + return; } @@ -876,10 +906,10 @@ extern "C" { macro_f_mode_t_set_default_umask(mode, main->umask); - *status = f_file_touch(file.string, mode.regular, F_false); + *status = f_file_touch(file, mode.regular, F_false); if (F_status_is_error(*status)) { - fll_error_file_print(main->error, F_status_set_fine(*status), "f_file_touch", F_true, file.string, "touch", fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(*status), "f_file_touch", F_true, file, f_file_operation_touch_s, fll_error_file_type_file_e); } } #endif // _di_fake_build_touch_ diff --git a/level_3/fake/c/private-build.h b/level_3/fake/c/private-build.h index 19cd74d..f824d5e 100644 --- a/level_3/fake/c/private-build.h +++ b/level_3/fake/c/private-build.h @@ -12,6 +12,26 @@ extern "C" { #endif +#ifndef _di_fake_build_strings_ + #define FAKE_build_header_files_s "header files" + #define FAKE_build_header_files_shared_s "shared header files" + #define FAKE_build_header_files_static_s "static header files" + #define FAKE_build_scripts_s "scripts" + #define FAKE_build_setting_files_s "setting files" + + #define FAKE_build_header_files_s_length 12 + #define FAKE_build_header_files_shared_s_length 19 + #define FAKE_build_header_files_static_s_length 19 + #define FAKE_build_scripts_s_length 7 + #define FAKE_build_setting_files_s_length 13 + + extern const f_string_static_t fake_build_header_files_s; + extern const f_string_static_t fake_build_header_files_shared_s; + extern const f_string_static_t fake_build_header_files_static_s; + extern const f_string_static_t fake_build_scripts_s; + extern const f_string_static_t fake_build_setting_files_s; +#endif // _di_fake_build_strings_ + /** * Add the standard arguments for building a library/program. * @@ -71,7 +91,7 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fake_build_copy_ - extern void fake_build_copy(fake_main_t * const main, const f_mode_t mode, const f_string_t label, const f_string_static_t source, const f_string_static_t destination, const f_string_statics_t files, const f_string_static_t file_stage, const f_array_length_t preserve, f_status_t *status) F_attribute_visibility_internal_d; + extern void fake_build_copy(fake_main_t * const main, const f_mode_t mode, const f_string_static_t label, const f_string_static_t source, const f_string_static_t destination, const f_string_statics_t files, const f_string_static_t file_stage, const f_array_length_t preserve, f_status_t *status) F_attribute_visibility_internal_d; #endif // _di_fake_build_copy_ /** diff --git a/level_3/fake/c/private-clean.c b/level_3/fake/c/private-clean.c index e37a0a6..7f691f6 100644 --- a/level_3/fake/c/private-clean.c +++ b/level_3/fake/c/private-clean.c @@ -30,10 +30,10 @@ extern "C" { } if (main->error.verbosity == f_console_verbosity_verbose_e) { - status = f_directory_remove_custom(main->path_build.string, F_directory_descriptors_max_d, F_true, fake_clean_remove_recursively_verbosely); + status = f_directory_remove_custom(main->path_build, F_directory_descriptors_max_d, F_true, fake_clean_remove_recursively_verbosely); } else { - status = f_directory_remove(main->path_build.string, F_directory_descriptors_max_d, F_true); + status = f_directory_remove(main->path_build, F_directory_descriptors_max_d, F_true); } if (F_status_set_fine(status) == F_file_found_not) { @@ -51,7 +51,7 @@ extern "C" { } if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_directory_remove", F_true, main->path_build.string, "remove", fll_error_file_type_directory_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_directory_remove", F_true, main->path_build, f_file_operation_delete_s, fll_error_file_type_directory_e); return status; } diff --git a/level_3/fake/c/private-common.h b/level_3/fake/c/private-common.h index d9ca21e..18eab55 100644 --- a/level_3/fake/c/private-common.h +++ b/level_3/fake/c/private-common.h @@ -314,7 +314,7 @@ extern "C" { #define FAKE_build_setting_name_build_sources_script_s_length 20 #define FAKE_build_setting_name_build_sources_settings_s_length 22 #define FAKE_build_setting_name_build_static_s_length 12 - #define FAKE_build_setting_name_environment_length_s 11 + #define FAKE_build_setting_name_environment_s_length 11 #define FAKE_build_setting_name_defines_s_length 7 #define FAKE_build_setting_name_defines_library_s_length 15 #define FAKE_build_setting_name_defines_library_shared_s_length 22 @@ -1039,6 +1039,7 @@ extern "C" { #define FAKE_make_parameter_variable_option_fakefile_s FAKE_make_parameter_variable_fakefile_s FAKE_make_parameter_iki_option_s #define FAKE_make_parameter_variable_option_mode_s FAKE_make_parameter_variable_mode_s FAKE_make_parameter_iki_option_s #define FAKE_make_parameter_variable_option_process_s FAKE_make_parameter_variable_process_s FAKE_make_parameter_iki_option_s + #define FAKE_make_parameter_variable_option_return_s FAKE_make_parameter_variable_return_s FAKE_make_parameter_iki_option_s #define FAKE_make_parameter_variable_option_settings_s FAKE_make_parameter_variable_settings_s FAKE_make_parameter_iki_option_s #define FAKE_make_parameter_variable_option_sources_s FAKE_make_parameter_variable_sources_s FAKE_make_parameter_iki_option_s #define FAKE_make_parameter_variable_option_verbosity_s FAKE_make_parameter_variable_verbosity_s FAKE_make_parameter_iki_option_s @@ -1051,6 +1052,7 @@ extern "C" { #define FAKE_make_parameter_variable_value_fakefile_s FAKE_make_parameter_variable_fakefile_s FAKE_make_parameter_iki_value_s #define FAKE_make_parameter_variable_value_mode_s FAKE_make_parameter_variable_mode_s FAKE_make_parameter_iki_value_s #define FAKE_make_parameter_variable_value_process_s FAKE_make_parameter_variable_process_s FAKE_make_parameter_iki_value_s + #define FAKE_make_parameter_variable_value_return_s FAKE_make_parameter_variable_return_s FAKE_make_parameter_iki_value_s #define FAKE_make_parameter_variable_value_settings_s FAKE_make_parameter_variable_settings_s FAKE_make_parameter_iki_value_s #define FAKE_make_parameter_variable_value_sources_s FAKE_make_parameter_variable_sources_s FAKE_make_parameter_iki_value_s #define FAKE_make_parameter_variable_value_verbosity_s FAKE_make_parameter_variable_verbosity_s FAKE_make_parameter_iki_value_s @@ -1079,6 +1081,7 @@ extern "C" { #define FAKE_make_parameter_variable_option_fakefile_s_length FAKE_make_parameter_variable_fakefile_s_length + FAKE_make_parameter_iki_option_s_length #define FAKE_make_parameter_variable_option_mode_s_length FAKE_make_parameter_variable_mode_s_length + FAKE_make_parameter_iki_option_s_length #define FAKE_make_parameter_variable_option_process_s_length FAKE_make_parameter_variable_process_s_length + FAKE_make_parameter_iki_option_s_length + #define FAKE_make_parameter_variable_option_return_s_length FAKE_make_parameter_variable_return_s_length + FAKE_make_parameter_iki_option_s_length #define FAKE_make_parameter_variable_option_settings_s_length FAKE_make_parameter_variable_settings_s_length + FAKE_make_parameter_iki_option_s_length #define FAKE_make_parameter_variable_option_sources_s_length FAKE_make_parameter_variable_sources_s_length + FAKE_make_parameter_iki_option_s_length #define FAKE_make_parameter_variable_option_verbosity_s_length FAKE_make_parameter_variable_verbosity_s_length + FAKE_make_parameter_iki_option_s_length @@ -1091,6 +1094,7 @@ extern "C" { #define FAKE_make_parameter_variable_value_fakefile_s_length FAKE_make_parameter_variable_fakefile_s_length + FAKE_make_parameter_iki_value_s_length #define FAKE_make_parameter_variable_value_mode_s_length FAKE_make_parameter_variable_mode_s_length + FAKE_make_parameter_iki_value_s_length #define FAKE_make_parameter_variable_value_process_s_length FAKE_make_parameter_variable_process_s_length + FAKE_make_parameter_iki_value_s_length + #define FAKE_make_parameter_variable_value_return_s_length FAKE_make_parameter_variable_return_s_length + FAKE_make_parameter_iki_value_s_length #define FAKE_make_parameter_variable_value_settings_s_length FAKE_make_parameter_variable_settings_s_length + FAKE_make_parameter_iki_value_s_length #define FAKE_make_parameter_variable_value_sources_s_length FAKE_make_parameter_variable_sources_s_length + FAKE_make_parameter_iki_value_s_length #define FAKE_make_parameter_variable_value_verbosity_s_length FAKE_make_parameter_variable_verbosity_s_length + FAKE_make_parameter_iki_value_s_length diff --git a/level_3/fake/c/private-fake-path_generate.c b/level_3/fake/c/private-fake-path_generate.c index 10400f7..bc16501 100644 --- a/level_3/fake/c/private-fake-path_generate.c +++ b/level_3/fake/c/private-fake-path_generate.c @@ -129,7 +129,7 @@ extern "C" { const uint8_t parameters_size[] = { 3, 3, - 4, + 6, 1, }; @@ -149,6 +149,8 @@ extern "C" { &main->file_data_build_defines, &main->file_data_build_dependencies, &main->file_data_build_fakefile, + &main->file_data_build_process_post_s, + &main->file_data_build_process_pre_s, &main->file_data_build_settings, }; @@ -194,6 +196,8 @@ extern "C" { fake_path_part_static_s, fake_file_defines_s, fake_file_dependencies_s, + fake_file_process_post_s, + fake_file_process_pre_s, main->fakefile, main->settings, fake_file_readme_s, @@ -208,12 +212,14 @@ extern "C" { &main->path_build_programs_static, &main->file_data_build_defines, &main->file_data_build_dependencies, + &main->file_data_build_process_post_s, + &main->file_data_build_process_pre_s, &main->file_data_build_fakefile, &main->file_data_build_settings, &main->file_documents_readme, }; - for (i = 0; i < 11; ++i) { + for (i = 0; i < 13; ++i) { status = f_string_dynamic_append_nulless(parameters_source[i], parameters_value[i]); diff --git a/level_3/fake/c/private-fake.c b/level_3/fake/c/private-fake.c index 84d8fa7..cdc8187 100644 --- a/level_3/fake/c/private-fake.c +++ b/level_3/fake/c/private-fake.c @@ -99,14 +99,14 @@ extern "C" { return F_status_set_error(F_interrupt); } - status = f_file_exists(path_file.string); + status = f_file_exists(path_file); if (status == F_true) { { f_array_length_t size_file = 0; name_function = "f_file_size"; - status = f_file_size(path_file.string, F_true, &size_file); + status = f_file_size(path_file, F_true, &size_file); if (F_status_is_error_not(status)) { if (size_file > fake_common_initial_buffer_max_d) { @@ -116,7 +116,8 @@ extern "C" { macro_f_string_dynamic_t_resize((status), (*buffer), size_file); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), name_function, F_true, path_file, "allocate buffer size for", fll_error_file_type_file_e); + const f_string_static_t message = macro_f_string_static_t_initialize("allocate buffer size for", 0, 24); + fll_error_file_print(main->error, F_status_set_fine(status), name_function, F_true, path_file, message, fll_error_file_type_file_e); f_string_dynamic_resize(0, buffer); @@ -128,7 +129,7 @@ extern "C" { } name_function = "f_file_open"; - status = f_file_stream_open(path_file, 0, &file); + status = f_file_stream_open(path_file, f_string_empty_s, &file); if (F_status_is_error_not(status)) { name_function = "f_file_read"; @@ -142,7 +143,7 @@ extern "C" { } if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), name_function, F_true, path_file, "read", fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), name_function, F_true, path_file, f_file_operation_read_s, fll_error_file_type_file_e); f_string_dynamic_resize(0, buffer); } @@ -562,13 +563,13 @@ extern "C" { if (parameters_value[i]->used) { memset(&directory_stat, 0, sizeof(struct stat)); - status = f_file_stat(parameters_value[i]->string, F_true, &directory_stat); + status = f_file_stat(*parameters_value[i], F_true, &directory_stat); if (status == F_status_set_error(F_file_found_not)) status = F_status_set_error(F_directory_found_not); if (F_status_is_error(status)) { if (F_status_set_fine(status) != F_directory_found_not || parameters_required[i]) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stat", F_true, parameters_value[i]->string, "access", fll_error_file_type_directory_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stat", F_true, *parameters_value[i], f_file_operation_access_s, fll_error_file_type_directory_e); return status; } @@ -592,19 +593,19 @@ extern "C" { #endif // _di_fake_validate_parameter_directories_ #ifndef _di_fake_verbose_print_clone_ - void fake_verbose_print_clone(const f_file_t output, const f_string_t source, const f_string_t destination) { + void fake_verbose_print_clone(const f_file_t output, const f_string_static_t source, const f_string_static_t destination) { fll_print_format("Cloned '%S' to '%S'.%r", output.stream, source, destination, f_string_eol_s); } #endif // _di_fake_verbose_print_clone_ #ifndef _di_fake_verbose_print_copy_ - void fake_verbose_print_copy(const f_file_t output, const f_string_t source, const f_string_t destination) { + void fake_verbose_print_copy(const f_file_t output, const f_string_static_t source, const f_string_static_t destination) { fll_print_format("Copied '%S' to '%S'.%r", output.stream, source, destination, f_string_eol_s); } #endif // _di_fake_verbose_print_copy_ #ifndef _di_fake_verbose_print_move_ - void fake_verbose_print_move(const f_file_t output, const f_string_t source, const f_string_t destination) { + void fake_verbose_print_move(const f_file_t output, const f_string_static_t source, const f_string_static_t destination) { fll_print_format("Moved '%S' to '%S'.%r", output.stream, source, destination, f_string_eol_s); } #endif // _di_fake_verbose_print_move_ diff --git a/level_3/fake/c/private-fake.h b/level_3/fake/c/private-fake.h index fe6095d..01a2afb 100644 --- a/level_3/fake/c/private-fake.h +++ b/level_3/fake/c/private-fake.h @@ -142,7 +142,7 @@ extern "C" { * The destination string. */ #ifndef _di_fake_verbose_print_clone_ - extern void fake_verbose_print_clone(const f_file_t output, const f_string_t source, const f_string_t destination) F_attribute_visibility_internal_d; + extern void fake_verbose_print_clone(const f_file_t output, const f_string_static_t source, const f_string_static_t destination) F_attribute_visibility_internal_d; #endif // _di_fake_verbose_print_clone_ /** @@ -156,7 +156,7 @@ extern "C" { * The destination string. */ #ifndef _di_fake_verbose_print_copy_ - extern void fake_verbose_print_copy(const f_file_t output, const f_string_t source, const f_string_t destination) F_attribute_visibility_internal_d; + extern void fake_verbose_print_copy(const f_file_t output, const f_string_static_t source, const f_string_static_t destination) F_attribute_visibility_internal_d; #endif // _di_fake_verbose_print_copy_ /** @@ -170,7 +170,7 @@ extern "C" { * The destination string. */ #ifndef _di_fake_verbose_print_move_ - extern void fake_verbose_print_move(const f_file_t output, const f_string_t source, const f_string_t destination) F_attribute_visibility_internal_d; + extern void fake_verbose_print_move(const f_file_t output, const f_string_static_t source, const f_string_static_t destination) F_attribute_visibility_internal_d; #endif // _di_fake_verbose_print_move_ #ifdef __cplusplus diff --git a/level_3/fake/c/private-make-load_fakefile.c b/level_3/fake/c/private-make-load_fakefile.c index 2f7b564..2443a33 100644 --- a/level_3/fake/c/private-make-load_fakefile.c +++ b/level_3/fake/c/private-make-load_fakefile.c @@ -27,7 +27,7 @@ extern "C" { data_make->fakefile.used = 0; - *status = fake_file_buffer(data_make->main, data_make->main->file_data_build_fakefile.string, &data_make->buffer); + *status = fake_file_buffer(data_make->main, data_make->main->file_data_build_fakefile, &data_make->buffer); if (F_status_is_error(*status)) return; if (!data_make->buffer.used) { @@ -59,7 +59,7 @@ extern "C" { } if (F_status_is_error(*status)) { - fake_print_error_fss(data_make->main, F_status_set_fine(*status), "fll_fss_basic_list_read", data_make->main->file_data_build_fakefile.string, range, F_true); + fake_print_error_fss(data_make->main, F_status_set_fine(*status), "fll_fss_basic_list_read", data_make->main->file_data_build_fakefile, range, F_true); } else { *status = fl_fss_apply_delimit(delimits, &data_make->buffer); @@ -127,7 +127,7 @@ extern "C" { *status = fll_fss_extended_read(data_make->buffer, state, &content_range, &settings.objects, &settings.contents, 0, 0, &delimits, 0); if (F_status_is_error(*status)) { - fake_print_error_fss(data_make->main, F_status_set_fine(*status), "fll_fss_extended_read", data_make->main->file_data_build_fakefile.string, content_range, F_true); + fake_print_error_fss(data_make->main, F_status_set_fine(*status), "fll_fss_extended_read", data_make->main->file_data_build_fakefile, content_range, F_true); break; } @@ -163,7 +163,7 @@ extern "C" { *status = fll_fss_extended_read(data_make->buffer, state, &content_range, &data_make->fakefile.array[data_make->fakefile.used].objects, &data_make->fakefile.array[data_make->fakefile.used].contents, 0, &data_make->fakefile.array[data_make->fakefile.used].quotess, &delimits, 0); if (F_status_is_error(*status)) { - fake_print_error_fss(data_make->main, F_status_set_fine(*status), "fll_fss_extended_read", data_make->main->file_data_build_fakefile.string, content_range, F_true); + fake_print_error_fss(data_make->main, F_status_set_fine(*status), "fll_fss_extended_read", data_make->main->file_data_build_fakefile, content_range, F_true); break; } @@ -397,7 +397,7 @@ extern "C" { f_string_map_multis_t define = f_string_map_multis_t_initialize; // Load the fakefile "settings" as if they are build "settings". - fake_build_load_setting_process(main, F_false, main->file_data_build_fakefile.string, data_make->buffer, settings->objects, settings->contents, &data_make->setting_build, &status); + fake_build_load_setting_process(main, F_false, main->file_data_build_fakefile, data_make->buffer, settings->objects, settings->contents, &data_make->setting_build, &status); if (F_status_is_error_not(status) && settings->objects.used) { const f_string_static_t settings_name[] = { @@ -457,7 +457,7 @@ extern "C" { break; } - status = f_environment_set(define.array[i].name.string, combined.string, F_true); + status = f_environment_set(define.array[i].name, combined, F_true); if (F_status_is_error(status)) { fll_error_print(main->error, F_status_set_fine(status), "f_environment_set", F_true); diff --git a/level_3/fake/c/private-make-operate.c b/level_3/fake/c/private-make-operate.c index 2fa7160..a6ae66b 100644 --- a/level_3/fake/c/private-make-operate.c +++ b/level_3/fake/c/private-make-operate.c @@ -54,7 +54,7 @@ extern "C" { return status; } - status = f_directory_open(data_make.path.stack.array[0].string, F_false, &data_make.path.top.id); + status = f_directory_open(data_make.path.stack.array[0], F_false, &data_make.path.top.id); if (F_status_is_error(status)) { fll_error_print(main->error, F_status_set_fine(status), "f_directory_open", F_true); @@ -912,7 +912,7 @@ extern "C" { status = f_string_dynamic_partial_append_nulless(data_make->buffer, range_name, &name); if (F_status_is_error(status)) return status; - status = f_environment_get(name.string, &value); + status = f_environment_get(name, &value); f_string_dynamic_resize(0, &name); } diff --git a/level_3/fake/c/private-make-operate_process.c b/level_3/fake/c/private-make-operate_process.c index f2faad0..e42db4f 100644 --- a/level_3/fake/c/private-make-operate_process.c +++ b/level_3/fake/c/private-make-operate_process.c @@ -354,10 +354,10 @@ extern "C" { } if (state_process->operation == fake_make_operation_type_link_e) { - *status = f_file_link(arguments.array[0].string, arguments.array[1].string); + *status = f_file_link(arguments.array[0], arguments.array[1]); if (F_status_is_error(*status)) { - fll_error_file_print(data_make->error, F_status_set_fine(*status), "f_file_link", F_true, arguments.array[1].string, "create link", fll_error_file_type_file_e); + fll_error_file_print(data_make->error, F_status_set_fine(*status), "f_file_link", F_true, arguments.array[1], f_file_operation_link_s, fll_error_file_type_file_e); } else if (data_make->main->error.verbosity == f_console_verbosity_verbose_e) { flockfile(data_make->main->output.to.stream); diff --git a/level_3/fake/c/private-make-operate_process_type.c b/level_3/fake/c/private-make-operate_process_type.c index d309bf7..d6867cb 100644 --- a/level_3/fake/c/private-make-operate_process_type.c +++ b/level_3/fake/c/private-make-operate_process_type.c @@ -20,7 +20,7 @@ extern "C" { f_status_t status_file = F_none; const f_array_length_t total = arguments.used - 1; - f_array_length_t destination_length = 0; + f_string_static_t destination = f_string_static_t_initialize; fl_directory_recurse_t recurse = fl_directory_recurse_t_initialize; f_mode_t mode = f_mode_t_initialize; @@ -44,10 +44,10 @@ extern "C" { // In this case, the destination could be a file, so confirm this. if (arguments.used == 2) { - status = f_directory_is(arguments.array[1].string); + status = f_directory_is(arguments.array[1]); if (F_status_is_error(status)) { - fll_error_file_print(data_make->error, F_status_set_fine(status), "f_directory_is", F_true, arguments.array[1].string, "identify", fll_error_file_type_directory_e); + fll_error_file_print(data_make->error, F_status_set_fine(status), "f_directory_is", F_true, arguments.array[1], f_file_operation_identify_s, fll_error_file_type_directory_e); return F_status_set_error(F_failure); } @@ -59,63 +59,64 @@ extern "C" { for (f_array_length_t i = 0; i < total; ++i) { - destination_length = arguments.array[total].used; + destination.used = arguments.array[total].used; if (existing) { - destination_length += arguments.array[i].used + 1; + destination.used += arguments.array[i].used + 1; } - char destination[destination_length + 1]; + char destination_string[destination.used + 1]; + destination.string = destination_string; - memcpy(destination, arguments.array[total].string, arguments.array[total].used); + memcpy(destination_string, arguments.array[total].string, arguments.array[total].used); if (existing) { - memcpy(destination + arguments.array[total].used + 1, arguments.array[i].string, arguments.array[i].used); - destination[arguments.array[total].used] = f_path_separator_s.string[0]; + memcpy(destination_string + arguments.array[total].used + 1, arguments.array[i].string, arguments.array[i].used); + destination_string[arguments.array[total].used] = f_path_separator_s.string[0]; } - destination[destination_length] = 0; + destination_string[destination.used] = 0; - status_file = f_directory_is(arguments.array[i].string); + status_file = f_directory_is(arguments.array[i]); if (status_file == F_true) { if (clone) { - status_file = fl_directory_clone(arguments.array[i].string, destination, arguments.array[i].used, destination_length, F_true, recurse); + status_file = fl_directory_clone(arguments.array[i], destination, F_true, recurse); } else { - status_file = fl_directory_copy(arguments.array[i].string, destination, arguments.array[i].used, destination_length, mode, recurse); + status_file = fl_directory_copy(arguments.array[i], destination, mode, recurse); } if (F_status_is_error(status_file)) { - fll_error_file_print(data_make->error, F_status_set_fine(status_file), clone ? "fl_directory_clone" : "fl_directory_copy", F_true, arguments.array[i].string, clone ? "clone" : "copy", fll_error_file_type_directory_e); + fll_error_file_print(data_make->error, F_status_set_fine(status_file), clone ? "fl_directory_clone" : "fl_directory_copy", F_true, arguments.array[i], clone ? f_file_operation_clone_s : f_file_operation_copy_s, fll_error_file_type_directory_e); status = F_status_set_error(F_failure); } } else if (status_file == F_false) { if (clone) { - status_file = f_file_clone(arguments.array[i].string, destination, F_true, recurse.size_block, recurse.exclusive); + status_file = f_file_clone(arguments.array[i], destination, F_true, recurse.size_block, recurse.exclusive); } else { - status_file = f_file_copy(arguments.array[i].string, destination, mode, recurse.size_block, recurse.exclusive); + status_file = f_file_copy(arguments.array[i], destination, mode, recurse.size_block, recurse.exclusive); } if (F_status_is_error(status_file)) { - fll_error_file_print(data_make->error, F_status_set_fine(status_file), clone ? "f_file_clone" : "f_file_copy", F_true, arguments.array[i].string, clone ? "clone" : "copy", fll_error_file_type_file_e); + fll_error_file_print(data_make->error, F_status_set_fine(status_file), clone ? "f_file_clone" : "f_file_copy", F_true, arguments.array[i], clone ? f_file_operation_clone_s : f_file_operation_copy_s, fll_error_file_type_file_e); status = F_status_set_error(F_failure); } else if (data_make->main->error.verbosity == f_console_verbosity_verbose_e) { flockfile(data_make->main->output.to.stream); - fl_print_format("%r%r '%[%Q%]' to '", data_make->main->output.to.stream, f_string_eol_s, clone ? "Cloned" : "Copied", data_make->main->context.set.notable, arguments.array[i], data_make->main->context.set.notable); - fl_print_format("%[%S%]'.%r", data_make->main->output.to.stream, f_string_eol_s, data_make->main->context.set.notable, destination, data_make->main->context.set.notable, f_string_eol_s); + fl_print_format("%r%s '%[%Q%]' to '", data_make->main->output.to.stream, f_string_eol_s, clone ? "Cloned" : "Copied", data_make->main->context.set.notable, arguments.array[i], data_make->main->context.set.notable); + fl_print_format("%[%Q%]'.%r", data_make->main->output.to.stream, data_make->main->context.set.notable, destination, data_make->main->context.set.notable, f_string_eol_s); funlockfile(data_make->main->output.to.stream); } } else if (F_status_is_error(status_file)) { - fll_error_file_print(data_make->error, F_status_set_fine(status_file), "f_directory_is", F_true, arguments.array[i].string, "identify", fll_error_file_type_directory_e); + fll_error_file_print(data_make->error, F_status_set_fine(status_file), "f_directory_is", F_true, arguments.array[i], f_file_operation_identify_s, fll_error_file_type_directory_e); return F_status_set_error(F_failure); } @@ -139,7 +140,7 @@ extern "C" { memset(&file_stat, 0, sizeof(struct stat)); - status = f_file_stat(arguments.array[i].string, F_false, &file_stat); + status = f_file_stat(arguments.array[i], F_false, &file_stat); if (F_status_is_error(status)) { if (F_status_set_fine(status) == F_file_found_not) { @@ -156,17 +157,17 @@ extern "C" { status = F_none; } else { - fll_error_file_print(data_make->error, F_status_set_fine(status), "f_file_stat", F_true, arguments.array[i].string, "delete", fll_error_file_type_file_e); + fll_error_file_print(data_make->error, F_status_set_fine(status), "f_file_stat", F_true, arguments.array[i], f_file_operation_delete_s, fll_error_file_type_file_e); return status; } } else if (macro_f_file_type_is_directory(file_stat.st_mode)) { if (data_make->main->error.verbosity == f_console_verbosity_verbose_e) { - status = f_directory_remove_custom(arguments.array[i].string, recursion_max, F_false, fake_clean_remove_recursively_verbosely); + status = f_directory_remove_custom(arguments.array[i], recursion_max, F_false, fake_clean_remove_recursively_verbosely); } else { - status = f_directory_remove(arguments.array[i].string, recursion_max, F_false); + status = f_directory_remove(arguments.array[i], recursion_max, F_false); } if (F_status_set_fine(status) == F_file_found_not) { @@ -178,7 +179,7 @@ extern "C" { } if (F_status_is_error(status)) { - fll_error_file_print(data_make->error, F_status_set_fine(status), "f_directory_remove", F_true, arguments.array[i].string, "delete", fll_error_file_type_directory_e); + fll_error_file_print(data_make->error, F_status_set_fine(status), "f_directory_remove", F_true, arguments.array[i], f_file_operation_delete_s, fll_error_file_type_directory_e); return status; } @@ -187,7 +188,7 @@ extern "C" { } } else { - status = f_file_remove(arguments.array[i].string); + status = f_file_remove(arguments.array[i]); if (F_status_set_fine(status) == F_file_found_not) { if (data_make->main->error.verbosity == f_console_verbosity_verbose_e) { @@ -198,7 +199,7 @@ extern "C" { } if (F_status_is_error(status)) { - fll_error_file_print(data_make->error, F_status_set_fine(status), "f_file_remove", F_true, arguments.array[i].string, "delete", fll_error_file_type_file_e); + fll_error_file_print(data_make->error, F_status_set_fine(status), "f_file_remove", F_true, arguments.array[i], f_file_operation_delete_s, fll_error_file_type_file_e); return status; } @@ -288,16 +289,16 @@ extern "C" { } if (all) { - status_file = fll_file_role_change_all(arguments.array[i].string, -1, id, F_false, fake_make_operation_recursion_depth_max_d); + status_file = fll_file_role_change_all(arguments.array[i], -1, id, F_false, fake_make_operation_recursion_depth_max_d); } else { - status_file = f_file_role_change(arguments.array[i].string, -1, id, F_false); + status_file = f_file_role_change(arguments.array[i], -1, id, F_false); } if (F_status_is_error(status_file)) { status = status_file; - fll_error_file_print(data_make->error, F_status_set_fine(status), all ? "fll_file_role_change_all" : "f_file_role_change", F_true, arguments.array[i].string, "change group of", fll_error_file_type_file_e); + fll_error_file_print(data_make->error, F_status_set_fine(status), all ? "fll_file_role_change_all" : "f_file_role_change", F_true, arguments.array[i], f_file_operation_change_group_s, fll_error_file_type_file_e); } else if (data_make->main->error.verbosity == f_console_verbosity_verbose_e) { flockfile(data_make->main->output.to.stream); @@ -406,7 +407,7 @@ extern "C" { else { for (f_array_length_t i = 2; i < arguments.used; ++i) { - if (f_environment_exists(arguments.array[i].) != F_true) { + if (f_environment_exists(arguments.array[i]) != F_true) { state_process->condition_result = fake_condition_result_false_e; break; @@ -482,12 +483,12 @@ extern "C" { for (f_array_length_t i = if_not ? 2 : 1; i < arguments.used; ++i) { - status = f_file_exists(arguments.array[i].string); + status = f_file_exists(arguments.array[i]); if (F_status_is_error(status)) { state_process->condition_result = fake_condition_result_error_e; - fll_error_file_print(data_make->error, F_status_set_fine(status), "f_file_exists", F_true, arguments.array[i].string, f_file_operation_find_s, fll_error_file_type_file_e); + fll_error_file_print(data_make->error, F_status_set_fine(status), "f_file_exists", F_true, arguments.array[i], f_file_operation_find_s, fll_error_file_type_file_e); break; } @@ -567,12 +568,12 @@ extern "C" { for (; i < arguments.used; ++i, mode_file = 0) { - status = f_file_mode_read(arguments.array[i].string, &mode_file); + status = f_file_mode_read(arguments.array[i], &mode_file); if (F_status_is_error(status)) { state_process->condition_result = fake_condition_result_error_e; - fll_error_file_print(data_make->error, F_status_set_fine(status), "f_file_mode_read", F_true, arguments.array[i].string, "get type of", fll_error_file_type_file_e); + fll_error_file_print(data_make->error, F_status_set_fine(status), "f_file_mode_read", F_true, arguments.array[i], f_file_operation_get_type_s, fll_error_file_type_file_e); break; } @@ -791,12 +792,12 @@ extern "C" { for (f_array_length_t i = if_not ? 3 : 2; i < arguments.used; ++i, id_file = 0) { - status = f_file_group_read(arguments.array[i].string, &id_file); + status = f_file_group_read(arguments.array[i], &id_file); if (F_status_is_error(status)) { state_process->condition_result = fake_condition_result_error_e; - fll_error_file_print(data_make->error, F_status_set_fine(status), "f_file_group_read", F_true, arguments.array[i].string, "get group of", fll_error_file_type_file_e); + fll_error_file_print(data_make->error, F_status_set_fine(status), "f_file_group_read", F_true, arguments.array[i], f_file_operation_get_group_s, fll_error_file_type_file_e); break; } @@ -863,12 +864,12 @@ extern "C" { for (f_array_length_t i = if_not ? 4 : 3; i < arguments.used; ++i, mode_file = 0) { - status = f_file_mode_read(arguments.array[i].string, &mode_file); + status = f_file_mode_read(arguments.array[i], &mode_file); if (F_status_is_error(status)) { state_process->condition_result = fake_condition_result_error_e; - fll_error_file_print(data_make->error, F_status_set_fine(status), "f_file_mode_read", F_true, arguments.array[i].string, "get mode of", fll_error_file_type_file_e); + fll_error_file_print(data_make->error, F_status_set_fine(status), "f_file_mode_read", F_true, arguments.array[i], f_file_operation_get_mode_s, fll_error_file_type_file_e); break; } @@ -926,12 +927,12 @@ extern "C" { for (f_array_length_t i = if_not ? 3 : 2; i < arguments.used; ++i, id_file = 0) { - status = f_file_owner_read(arguments.array[i].string, &id_file); + status = f_file_owner_read(arguments.array[i], &id_file); if (F_status_is_error(status)) { state_process->condition_result = fake_condition_result_error_e; - fll_error_file_print(data_make->error, F_status_set_fine(status), "f_file_owner_read", F_true, arguments.array[i].string, "get owner of", fll_error_file_type_file_e); + fll_error_file_print(data_make->error, F_status_set_fine(status), "f_file_owner_read", F_true, arguments.array[i], f_file_operation_get_owner_s, fll_error_file_type_file_e); break; } @@ -974,10 +975,10 @@ extern "C" { for (f_array_length_t i = 1; i < arguments.used; ++i, mode = 0) { - status = f_file_mode_read(arguments.array[i].string, &mode_file); + status = f_file_mode_read(arguments.array[i], &mode_file); if (F_status_is_error(status)) { - fll_error_file_print(data_make->error, F_status_set_fine(status), "f_file_mode_read", F_true, arguments.array[i].string, "change mode of", fll_error_file_type_file_e); + fll_error_file_print(data_make->error, F_status_set_fine(status), "f_file_mode_read", F_true, arguments.array[i], f_file_operation_change_group_s, fll_error_file_type_file_e); break; } @@ -985,20 +986,20 @@ extern "C" { status = f_file_mode_determine(mode_file, mode_rule, replace, macro_f_file_type_is_directory(mode_file), &mode); if (F_status_is_error(status)) { - fll_error_file_print(data_make->error, F_status_set_fine(status), "f_file_mode_determine", F_true, arguments.array[i].string, "change mode of", fll_error_file_type_file_e); + fll_error_file_print(data_make->error, F_status_set_fine(status), "f_file_mode_determine", F_true, arguments.array[i], f_file_operation_change_group_s, fll_error_file_type_file_e); break; } if (all) { - status = fll_file_mode_set_all(arguments.array[i].string, mode, fake_make_operation_recursion_depth_max_d); + status = fll_file_mode_set_all(arguments.array[i], mode, fake_make_operation_recursion_depth_max_d); } else { - status = f_file_mode_set(arguments.array[i].string, mode); + status = f_file_mode_set(arguments.array[i], mode); } if (F_status_is_error(status)) { - fll_error_file_print(data_make->error, F_status_set_fine(status), all ? "fll_file_mode_set_all" : "f_file_mode_set", F_true, arguments.array[i].string, "change mode of", fll_error_file_type_file_e); + fll_error_file_print(data_make->error, F_status_set_fine(status), all ? "fll_file_mode_set_all" : "f_file_mode_set", F_true, arguments.array[i], f_file_operation_change_group_s, fll_error_file_type_file_e); break; } @@ -1024,7 +1025,7 @@ extern "C" { fl_directory_recurse_t recurse = fl_directory_recurse_t_initialize; - f_array_length_t destination_length = 0; + f_string_static_t destination = f_string_static_t_initialize; if (data_make->main->error.verbosity == f_console_verbosity_verbose_e) { recurse.output = data_make->main->output.to; @@ -1035,10 +1036,10 @@ extern "C" { // In this case, the destination could be a file, so confirm this. if (arguments.used == 2) { - status_file = f_directory_is(arguments.array[1].string); + status_file = f_directory_is(arguments.array[1]); if (F_status_is_error(status_file)) { - fll_error_file_print(data_make->error, F_status_set_fine(status), "f_directory_is", F_true, arguments.array[1].string, "identify", fll_error_file_type_directory_e); + fll_error_file_print(data_make->error, F_status_set_fine(status), "f_directory_is", F_true, arguments.array[1], f_file_operation_identify_s, fll_error_file_type_directory_e); return F_status_set_error(F_failure); } @@ -1050,27 +1051,28 @@ extern "C" { for (f_array_length_t i = 0; i < total; ++i) { - destination_length = arguments.array[total].used; + destination.used = arguments.array[total].used; if (existing) { - destination_length += arguments.array[i].used + 1; + destination.used += arguments.array[i].used + 1; } - char destination[destination_length + 1]; + char destination_string[destination.used + 1]; + destination.string = destination_string; - memcpy(destination, arguments.array[total].string, arguments.array[total].used); + memcpy(destination_string, arguments.array[total].string, arguments.array[total].used); if (existing) { - memcpy(destination + arguments.array[total].used + 1, arguments.array[i].string, arguments.array[i].used); - destination[arguments.array[total].used] = f_path_separator_s.string[0]; + memcpy(destination_string + arguments.array[total].used + 1, arguments.array[i].string, arguments.array[i].used); + destination_string[arguments.array[total].used] = f_path_separator_s.string[0]; } - destination[destination_length] = 0; + destination_string[destination.used] = 0; - status_file = fll_file_move(arguments.array[i].string, destination, arguments.array[i].used, destination_length, recurse); + status_file = fll_file_move(arguments.array[i], destination, recurse); if (F_status_is_error(status_file)) { - fll_error_file_print(data_make->error, F_status_set_fine(status), "fll_file_move", F_true, arguments.array[i].string, "move", fll_error_file_type_directory_e); + fll_error_file_print(data_make->error, F_status_set_fine(status), "fll_file_move", F_true, arguments.array[i], f_file_operation_move_s, fll_error_file_type_directory_e); status = F_status_set_error(F_failure); } @@ -1106,16 +1108,16 @@ extern "C" { } if (all) { - status_file = fll_file_role_change_all(arguments.array[i].string, id, -1, F_false, fake_make_operation_recursion_depth_max_d); + status_file = fll_file_role_change_all(arguments.array[i], id, -1, F_false, fake_make_operation_recursion_depth_max_d); } else { - status_file = f_file_role_change(arguments.array[i].string, id, -1, F_false); + status_file = f_file_role_change(arguments.array[i], id, -1, F_false); } if (F_status_is_error(status_file)) { status = status_file; - fll_error_file_print(data_make->error, F_status_set_fine(status), all ? "fll_file_role_change_all" : "f_file_role_change", F_true, arguments.array[i].string, "change owner of", fll_error_file_type_file_e); + fll_error_file_print(data_make->error, F_status_set_fine(status), all ? "fll_file_role_change_all" : "f_file_role_change", F_true, arguments.array[i], f_file_operation_change_owner_s, fll_error_file_type_file_e); } else if (data_make->main->error.verbosity == f_console_verbosity_verbose_e) { fll_print_format("%s owner of '%Q' to %u.%r", data_make->main->output.to.stream, all ? "Recursively changed" : "Changed", arguments.array[i], id, f_string_eol_s); @@ -1229,25 +1231,27 @@ extern "C" { f_status_t status = F_none; - f_string_dynamic_resize(0, &data_make->path.stack.array[data_make->path.stack.used - 1]); + f_string_dynamic_t *argument = &data_make->path.stack.array[data_make->path.stack.used - 1]; + + f_string_dynamic_resize(0, argument); --data_make->path.stack.used; - status = f_path_change(data_make->path.stack.array[data_make->path.stack.used - 1].string); + status = f_path_change(argument->string); if (F_status_is_error(status)) { - fake_print_message_section_operation_path_stack_max(data_make->main, data_make->error, F_status_set_fine(status), "f_path_change", data_make->path.stack.array[data_make->path.stack.used - 1]); + fake_print_message_section_operation_path_stack_max(data_make->main, data_make->error, F_status_set_fine(status), "f_path_change", *argument); return 0; } if (data_make->main->error.verbosity == f_console_verbosity_verbose_e) { - status = fake_make_path_relative(data_make, data_make->path.stack.array[data_make->path.stack.used - 1]); + status = fake_make_path_relative(data_make, *argument); // The created relative path is for verbosity purposes and as such its failure to be processed should not be treated as a failure of the function. if (F_status_is_error(status)) { fll_error_print(data_make->error, F_status_set_fine(status), "fake_make_path_relative", F_true); - fll_print_format("Changed to project path '%[%Q%]'.%r", data_make->main->output.to.stream, data_make->main->context.set.notable, data_make->path.stack.array[data_make->path.stack.used - 1], data_make->main->context.set.notable, f_string_eol_s); + fll_print_format("Changed to project path '%[%Q%]'.%r", data_make->main->output.to.stream, data_make->main->context.set.notable, argument, data_make->main->context.set.notable, f_string_eol_s); } else { fll_print_format("Changed to project path '%[%Q%]'.%r", data_make->main->output.to.stream, data_make->main->context.set.notable, data_make->path_cache, data_make->main->context.set.notable, f_string_eol_s); @@ -1283,14 +1287,14 @@ extern "C" { else { status = f_string_dynamics_increase_by(F_memory_default_allocation_small_d, &data_make->path.stack); - if (F_status_set_fine(status) == F_array_too_large) { - fake_print_message_section_operation_path_stack_max(data_make->main, data_make->error, F_array_too_large, "f_string_dynamics_increase_by", fake_common_file_path_stack_s_length); + if (F_status_is_error(status)) { + if (F_status_set_fine(status) == F_array_too_large) { + fake_print_message_section_operation_path_stack_max(data_make->main, data_make->error, F_array_too_large, "f_string_dynamics_increase_by", fake_common_file_path_stack_s); - return status; - } + return status; + } - if (F_status_is_error(status)) { - fll_error_print(data_make->error, F_status_set_fine(status), "macro_f_string_dynamics_t_resize", F_true); + fll_error_print(data_make->error, F_status_set_fine(status), "f_string_dynamics_increase_by", F_true); return status; } @@ -1301,7 +1305,7 @@ extern "C" { status = f_string_dynamic_append(data_make->path_cache, &data_make->path.stack.array[data_make->path.stack.used]); if (F_status_is_error(status)) { - fll_error_print(data_make->error, F_status_set_fine(status), "f_string_dynamic_append_nulless", F_true); + fll_error_print(data_make->error, F_status_set_fine(status), "f_string_dynamic_append", F_true); return status; } @@ -1367,28 +1371,28 @@ extern "C" { for (f_array_length_t i = 1; i < arguments.used; ++i) { if (fl_string_dynamic_compare(fake_make_operation_argument_file_s, arguments.array[0]) == F_equal_to) { - status = f_file_touch(arguments.array[i].string, mode.regular, F_false); + status = f_file_touch(arguments.array[i], mode.regular, F_false); if (F_status_is_error(status)) { - if (F_status_is_error_not(fll_path_canonical(arguments.array[i].string, &data_make->path_cache))) { - fll_error_file_print(data_make->error, F_status_set_fine(status), "f_file_touch", F_true, data_make->path_cache.string, "touch", fll_error_file_type_file_e); + if (F_status_is_error_not(fll_path_canonical(arguments.array[i], &data_make->path_cache))) { + fll_error_file_print(data_make->error, F_status_set_fine(status), "f_file_touch", F_true, data_make->path_cache, f_file_operation_touch_s, fll_error_file_type_file_e); } else { - fll_error_file_print(data_make->error, F_status_set_fine(status), "f_file_touch", F_true, arguments.array[i].string, "touch", fll_error_file_type_file_e); + fll_error_file_print(data_make->error, F_status_set_fine(status), "f_file_touch", F_true, arguments.array[i], f_file_operation_touch_s, fll_error_file_type_file_e); } break; } } else if (fl_string_dynamic_compare(fake_make_operation_argument_directory_s, arguments.array[0]) == F_equal_to) { - status = f_directory_touch(arguments.array[i].string, mode.directory); + status = f_directory_touch(arguments.array[i], mode.directory); if (F_status_is_error(status)) { - if (F_status_is_error_not(fll_path_canonical(arguments.array[i].string, &data_make->path_cache))) { - fll_error_file_print(data_make->error, F_status_set_fine(status), "f_directory_touch", F_true, data_make->path_cache.string, "touch", fll_error_file_type_directory_e); + if (F_status_is_error_not(fll_path_canonical(arguments.array[i], &data_make->path_cache))) { + fll_error_file_print(data_make->error, F_status_set_fine(status), "f_directory_touch", F_true, data_make->path_cache, f_file_operation_touch_s, fll_error_file_type_directory_e); } else { - fll_error_file_print(data_make->error, F_status_set_fine(status), "f_directory_touch", F_true, arguments.array[i].string, "touch", fll_error_file_type_directory_e); + fll_error_file_print(data_make->error, F_status_set_fine(status), "f_directory_touch", F_true, arguments.array[i], f_file_operation_touch_s, fll_error_file_type_directory_e); } break; diff --git a/level_3/fake/c/private-make-operate_validate.c b/level_3/fake/c/private-make-operate_validate.c index 13c3743..467c62c 100644 --- a/level_3/fake/c/private-make-operate_validate.c +++ b/level_3/fake/c/private-make-operate_validate.c @@ -79,12 +79,16 @@ extern "C" { } else if (arguments.used) { if (arguments.array[0].used) { - char path_file[data_make->main->path_data_build.used + arguments.array[0].used + 1]; + f_string_static_t path_file = f_string_static_t_initialize; + path_file.used = data_make->main->path_data_build.used + arguments.array[0].used; - memcpy(path_file, data_make->main->path_data_build.string, data_make->main->path_data_build.used); - memcpy(path_file + data_make->main->path_data_build.used, arguments.array[0].string, arguments.array[0].used); + char path_file_string[path_file.used + 1]; + path_file.string = path_file_string; - path_file[data_make->main->path_data_build.used + arguments.array[0].used] = 0; + memcpy(path_file_string, data_make->main->path_data_build.string, data_make->main->path_data_build.used); + memcpy(path_file_string + data_make->main->path_data_build.used, arguments.array[0].string, arguments.array[0].used); + + path_file_string[path_file.used] = 0; f_status_t status_file = f_file_is(path_file, F_file_type_regular_d, F_false); @@ -93,7 +97,7 @@ extern "C" { flockfile(data_make->error.to.stream); fl_print_format("%r%[%QFailed to find file '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); - fl_print_format("%[%S%]", data_make->error.to.stream, data_make->error.notable, path_file, data_make->error.notable); + fl_print_format("%[%Q%]", data_make->error.to.stream, data_make->error.notable, path_file, data_make->error.notable); fl_print_format("%['.%]%r", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s); funlockfile(data_make->error.to.stream); @@ -110,7 +114,7 @@ extern "C" { flockfile(data_make->error.to.stream); fl_print_format("%r%[%QThe file '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); - fl_print_format("%[%S%]", data_make->error.to.stream, data_make->error.notable, path_file, data_make->error.notable); + fl_print_format("%[%Q%]", data_make->error.to.stream, data_make->error.notable, path_file, data_make->error.notable); fl_print_format("%[' must be a regular file.%]%r", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s); funlockfile(data_make->error.to.stream); @@ -168,7 +172,7 @@ extern "C" { for (f_array_length_t i = 0; i < arguments.used - 1; ++i) { - if (f_file_exists(arguments.array[i].string) != F_true) { + if (f_file_exists(arguments.array[i]) != F_true) { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { flockfile(data_make->error.to.stream); @@ -186,7 +190,7 @@ extern "C" { if (arguments.used > 2) { // The last file must be a directory. - f_status_t status_file = f_directory_is(arguments.array[arguments.used - 1].string); + f_status_t status_file = f_directory_is(arguments.array[arguments.used - 1]); if (status_file == F_false || status_file == F_file_found_not) { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { @@ -202,23 +206,23 @@ extern "C" { *status = F_status_set_error(F_failure); } else if (F_status_is_error(status_file)) { - fll_error_file_print(data_make->error, F_status_set_fine(status_file), "f_directory_is", F_true, arguments.array[arguments.used - 1].string, f_file_operation_find_s, fll_error_file_type_directory_e); + fll_error_file_print(data_make->error, F_status_set_fine(status_file), "f_directory_is", F_true, arguments.array[arguments.used - 1], f_file_operation_find_s, fll_error_file_type_directory_e); *status = F_status_set_error(F_failure); } } else { // When the first file is a directory, then the second, if it exists, must also be a directory. - f_status_t status_file = f_directory_is(arguments.array[0].string); + f_status_t status_file = f_directory_is(arguments.array[0]); if (status_file == F_true) { - status_file = f_directory_is(arguments.array[1].string); + status_file = f_directory_is(arguments.array[1]); if (status_file == F_false) { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { flockfile(data_make->error.to.stream); - fl_print_format("%r%[%QThe last file '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); + fl_print_format("%r%[%QThe second file '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); fl_print_format("%[%Q%]", data_make->error.to.stream, data_make->error.notable, arguments.array[1], data_make->error.notable); fl_print_format("%[' must be a valid directory.%]%r", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s); @@ -279,7 +283,7 @@ extern "C" { for (f_array_length_t i = 0; i < arguments.used - 1; ++i) { - if (f_file_exists(arguments.array[i].string) != F_true) { + if (f_file_exists(arguments.array[i]) != F_true) { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { flockfile(data_make->error.to.stream); @@ -297,7 +301,7 @@ extern "C" { if (arguments.used > 2) { // The last file must be a directory. - f_status_t status_file = f_directory_is(arguments.array[arguments.used - 1].string); + f_status_t status_file = f_directory_is(arguments.array[arguments.used - 1]); if (status_file == F_false || status_file == F_file_found_not) { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { @@ -313,23 +317,23 @@ extern "C" { *status = F_status_set_error(F_failure); } else if (F_status_is_error(status_file)) { - fll_error_file_print(data_make->error, F_status_set_fine(status_file), "f_directory_is", F_true, arguments.array[arguments.used - 1].string, "identify", fll_error_file_type_directory_e); + fll_error_file_print(data_make->error, F_status_set_fine(status_file), "f_directory_is", F_true, arguments.array[arguments.used - 1], f_file_operation_identify_s, fll_error_file_type_directory_e); *status = F_status_set_error(F_failure); } } else { // When the first file is a directory, then the second, if it exists, must also be a directory. - f_status_t status_file = f_directory_is(arguments.array[0].string); + f_status_t status_file = f_directory_is(arguments.array[0]); if (status_file == F_true) { - status_file = f_directory_is(arguments.array[1].string); + status_file = f_directory_is(arguments.array[1]); if (status_file == F_false) { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { flockfile(data_make->error.to.stream); - fl_print_format("%r%[%QThe last file '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); + fl_print_format("%r%[%QThe second file '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); fl_print_format("%[%Q%]", data_make->error.to.stream, data_make->error.notable, arguments.array[1], data_make->error.notable); fl_print_format("%[' must be a valid directory.%]%r", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s); @@ -532,7 +536,7 @@ extern "C" { for (f_array_length_t i = 1; i < arguments.used; ++i) { - status_file = f_file_is(arguments.array[i].string, F_file_type_regular_d, F_false); + status_file = f_file_is(arguments.array[i], F_file_type_regular_d, F_false); if (status_file == F_file_found_not) { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { @@ -549,7 +553,7 @@ extern "C" { } else if (F_status_is_error(status_file)) { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { - fll_error_file_print(data_make->error, F_status_set_fine(*status), "f_file_is", F_true, arguments.array[i].string, f_file_operation_find_s, fll_error_file_type_directory_e); + fll_error_file_print(data_make->error, F_status_set_fine(*status), "f_file_is", F_true, arguments.array[i], f_file_operation_find_s, fll_error_file_type_directory_e); } *status = status_file; @@ -963,14 +967,14 @@ extern "C" { else if (state_process->condition != fake_make_operation_if_type_if_exists_e && state_process->condition != fake_make_operation_if_type_if_is_e) { // The existence tests do not need to happen here for *_if_exists and *_if_is as those two types will handle performing them during the process stage. - status_file = f_file_exists(arguments.array[i].string); + status_file = f_file_exists(arguments.array[i]); if (status_file == F_false) { status_file = F_status_set_error(F_file_found_not); } if (F_status_is_error(status_file)) { - fll_error_file_print(data_make->error, F_status_set_fine(status_file), "f_file_exists", F_true, arguments.array[i].string, f_file_operation_find_s, fll_error_file_type_file_e); + fll_error_file_print(data_make->error, F_status_set_fine(status_file), "f_file_exists", F_true, arguments.array[i], f_file_operation_find_s, fll_error_file_type_file_e); if (F_status_is_error_not(*status)) { *status = F_status_set_error(status_file); @@ -1107,7 +1111,7 @@ extern "C" { for (f_array_length_t i = 0; i < arguments.used - 1; ++i) { - if (f_file_exists(arguments.array[i].string) != F_true) { + if (f_file_exists(arguments.array[i]) != F_true) { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { flockfile(data_make->error.to.stream); @@ -1125,7 +1129,7 @@ extern "C" { if (arguments.used > 2) { // The last file must be a directory. - f_status_t status_file = f_directory_is(arguments.array[arguments.used - 1].string); + f_status_t status_file = f_directory_is(arguments.array[arguments.used - 1]); if (status_file == F_false || status_file == F_file_found_not) { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { @@ -1141,24 +1145,24 @@ extern "C" { *status = F_status_set_error(F_failure); } else if (F_status_is_error(status_file)) { - fll_error_file_print(data_make->error, F_status_set_fine(status_file), "f_directory_is", F_true, arguments.array[arguments.used - 1].string, "identify", fll_error_file_type_directory_e); + fll_error_file_print(data_make->error, F_status_set_fine(status_file), "f_directory_is", F_true, arguments.array[arguments.used - 1], f_file_operation_identify_s, fll_error_file_type_directory_e); *status = F_status_set_error(F_failure); } } else { // When the first file is a directory, then the second, if it exists, must also be a directory. - f_status_t status_file = f_directory_is(arguments.array[0].string); + f_status_t status_file = f_directory_is(arguments.array[0]); if (status_file == F_true) { - status_file = f_directory_is(arguments.array[1].string); + status_file = f_directory_is(arguments.array[1]); if (status_file == F_false) { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { flockfile(data_make->error.to.stream); - fl_print_format("%r%[%QThe last file '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); - fl_print_format("%[%Q%]", data_make->error.to.stream, data_make->error.notable, arguments.array[arguments.used - 1], data_make->error.notable); + fl_print_format("%r%[%QThe second file '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context); + fl_print_format("%[%Q%]", data_make->error.to.stream, data_make->error.notable, arguments.array[1], data_make->error.notable); fl_print_format("%[' must be a valid directory.%]%r", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s); funlockfile(data_make->error.to.stream); @@ -1298,7 +1302,7 @@ extern "C" { } else if (arguments.used) { if (arguments.array[0].used) { - f_status_t status_file = f_file_is(arguments.array[0].string, F_file_type_directory_d, F_false); + f_status_t status_file = f_file_is(arguments.array[0], F_file_type_directory_d, F_false); if (status_file == F_file_found_not) { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { @@ -1315,7 +1319,7 @@ extern "C" { } else if (F_status_is_error(status_file)) { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { - fll_error_file_print(data_make->error, F_status_set_fine(*status), "f_file_is", F_true, data_make->main->file_data_build_fakefile.string, f_file_operation_find_s, fll_error_file_type_file_e); + fll_error_file_print(data_make->error, F_status_set_fine(*status), "f_file_is", F_true, data_make->main->file_data_build_fakefile, f_file_operation_find_s, fll_error_file_type_file_e); } *status = status_file; diff --git a/level_3/fake/c/private-make.c b/level_3/fake/c/private-make.c index 46a637c..db59bf1 100644 --- a/level_3/fake/c/private-make.c +++ b/level_3/fake/c/private-make.c @@ -19,7 +19,7 @@ extern "C" { data_make->path_cache.used = 0; - f_status_t status = fll_path_canonical(path.string, &data_make->path_cache); + f_status_t status = fll_path_canonical(path, &data_make->path_cache); if (F_status_is_error(status)) return status; if (data_make->path_cache.used < data_make->path.stack.array[0].used) { @@ -113,7 +113,7 @@ extern "C" { return F_status_set_error(F_parameter); } - const f_status_t status = f_file_mode_from_string(buffer.string, main->umask, mode, replace); + const f_status_t status = f_file_mode_from_string(buffer, main->umask, mode, replace); if (F_status_is_error(status)) { if (main->error.verbosity != f_console_verbosity_quiet_e) { diff --git a/level_3/fake/c/private-print.c b/level_3/fake/c/private-print.c index 86d5bd5..e0c5fdf 100644 --- a/level_3/fake/c/private-print.c +++ b/level_3/fake/c/private-print.c @@ -236,7 +236,7 @@ extern "C" { #endif // #ifndef _di_fake_print_error_build_operation_file_message_ #ifndef _di_fake_print_error_fss - bool fake_print_error_fss(fake_main_t * const main, const f_status_t status, const f_string_t function, const f_string_t path_file, const f_string_range_t range, const bool fallback) { + bool fake_print_error_fss(fake_main_t * const main, const f_status_t status, const f_string_t function, const f_string_static_t path_file, const f_string_range_t range, const bool fallback) { if (status == F_file_found_not) { if (main->error.verbosity != f_console_verbosity_quiet_e) { diff --git a/level_3/fake/c/private-print.h b/level_3/fake/c/private-print.h index b284235..ec5033e 100644 --- a/level_3/fake/c/private-print.h +++ b/level_3/fake/c/private-print.h @@ -99,7 +99,7 @@ extern "C" { * @see fl_print_format() */ #ifndef _di_fake_print_error_fss_ - extern bool fake_print_error_fss(fake_main_t * const main, const f_status_t status, const f_string_t function, const f_string_t path_file, const f_string_range_t range, const bool fallback) F_attribute_visibility_internal_d; + extern bool fake_print_error_fss(fake_main_t * const main, const f_status_t status, const f_string_t function, const f_string_static_t path_file, const f_string_range_t range, const bool fallback) F_attribute_visibility_internal_d; #endif // _di_fake_print_error_fss_ /** diff --git a/level_3/fake/c/private-skeleton.c b/level_3/fake/c/private-skeleton.c index 7e8b10b..bc843e7 100644 --- a/level_3/fake/c/private-skeleton.c +++ b/level_3/fake/c/private-skeleton.c @@ -55,9 +55,6 @@ extern "C" { } // for } - f_string_dynamic_t file_data_build_process_post = f_string_dynamic_t_initialize; - f_string_dynamic_t file_data_build_process_pre = f_string_dynamic_t_initialize; - if (F_status_is_error_not(status)) { status = fake_skeleton_operate_file_create(main, main->file_data_build_defines, F_false, fake_make_skeleton_content_defines_s); } @@ -67,11 +64,11 @@ extern "C" { } if (F_status_is_error_not(status)) { - status = fake_skeleton_operate_file_create(main, fake_file_data_build_process_post_s, F_true, fake_make_skeleton_content_process_post_s); + status = fake_skeleton_operate_file_create(main, main->file_data_build_process_post_s, F_true, fake_make_skeleton_content_process_post_s); } if (F_status_is_error_not(status)) { - status = fake_skeleton_operate_file_create(main, fake_file_data_build_process_pre_s, F_true, fake_make_skeleton_content_process_pre_s); + status = fake_skeleton_operate_file_create(main, main->file_data_build_process_pre_s, F_true, fake_make_skeleton_content_process_pre_s); } if (F_status_is_error_not(status)) { @@ -99,7 +96,7 @@ extern "C" { if (!path.used) return F_none; - status = f_directory_exists(path.string); + status = f_directory_exists(path); if (status == F_true) { if (main->error.verbosity == f_console_verbosity_verbose_e) { @@ -123,7 +120,7 @@ extern "C" { return F_status_set_warning(F_failure); } else if (status == F_file_found_not) { - status = f_directory_create(path.string, F_file_mode_all_rwx_d); + status = f_directory_create(path, F_file_mode_all_rwx_d); if (F_status_is_error(status)) { if (F_status_set_fine(status) == F_file_found_not) { @@ -163,7 +160,7 @@ extern "C" { if (!path.used) return F_none; - status = f_file_is(path.string, F_file_type_regular_d, F_false); + status = f_file_is(path, F_file_type_regular_d, F_false); if (status == F_true) { if (main->error.verbosity == f_console_verbosity_verbose_e) { @@ -175,7 +172,7 @@ extern "C" { // symbolic links might also be fine. if (status == F_false) { - status = f_file_is(path.string, F_file_type_link_d, F_false); + status = f_file_is(path, F_file_type_link_d, F_false); if (status == F_true) { if (main->error.verbosity == f_console_verbosity_verbose_e) { @@ -200,7 +197,7 @@ extern "C" { mode = F_file_mode_all_rwx_d; } - status = f_file_create(path.string, mode, F_true); + status = f_file_create(path, mode, F_true); if (F_status_is_error(status)) { if (F_status_set_fine(status) == F_file_found_not) { @@ -229,7 +226,7 @@ extern "C" { file.flag = F_file_flag_append_wo_d; file.size_write = content.used; - status = f_file_open(path.string, 0, &file); + status = f_file_open(path, 0, &file); if (F_status_is_error(status)) { fll_error_file_print(main->error, F_status_set_fine(status), "f_file_open", F_true, path, fake_common_file_populate_pre_s, fll_error_file_type_file_e); diff --git a/level_3/firewall/c/firewall.h b/level_3/firewall/c/firewall.h index 35e5e5f..ef58c8c 100644 --- a/level_3/firewall/c/firewall.h +++ b/level_3/firewall/c/firewall.h @@ -167,7 +167,7 @@ extern "C" { #define firewall_chain_postrouting_s "POSTROUTING" #define firewall_chain_prerouting_s "PREROUTING" - #define firewall_chain_length_s 5 + #define firewall_chain_s_length 5 #define firewall_chain_forward_s_length 7 #define firewall_chain_input_s_length 5 #define firewall_chain_none_s_length 4 diff --git a/level_3/firewall/c/private-firewall.c b/level_3/firewall/c/private-firewall.c index 2296d28..1374922 100644 --- a/level_3/firewall/c/private-firewall.c +++ b/level_3/firewall/c/private-firewall.c @@ -86,7 +86,7 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal f_string_dynamic_resize(0, &ip_list); // process chain rule - if (length >= firewall_chain_length_s && fl_string_compare(local.buffer.string + local.rule_objects.array[i].start, (f_string_t) firewall_chain_s, length, firewall_chain_length_s) == F_equal_to) { + if (length >= firewall_chain_s_length && fl_string_compare(local.buffer.string + local.rule_objects.array[i].start, (f_string_t) firewall_chain_s, length, firewall_chain_s_length) == F_equal_to) { if (chain == firewall_chain_custom_id_e) { // custom chains can only apply to themselves, so silently ignore chain commands specified within a custom chain. @@ -1060,19 +1060,19 @@ f_status_t firewall_create_custom_chains(firewall_main_t * const main, firewall_ arguments.array[1].string[arguments.array[1].used] = 0; main->chains.array[main->chains.used].string[main->chains.array[main->chains.used].used] = 0; - if (fl_string_compare(arguments.array[1].string, firewall_chain_forward_s, arguments.array[1].used, firewall_chain_forward_s_length) == F_equal_to) { + if (fl_string_dynamic_compare(arguments.array[1], firewall_chain_forward_s) == F_equal_to) { create_chain = F_false; } - else if (fl_string_compare(arguments.array[1].string, firewall_chain_input_s, arguments.array[1].used, firewall_chain_input_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(arguments.array[1], firewall_chain_input_s) == F_equal_to) { create_chain = F_false; } - else if (fl_string_compare(arguments.array[1].string, firewall_chain_output_s, arguments.array[1].used, firewall_chain_output_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(arguments.array[1], firewall_chain_output_s) == F_equal_to) { create_chain = F_false; } - else if (fl_string_compare(arguments.array[1].string, firewall_chain_postrouting_s, arguments.array[1].used, firewall_chain_postrouting_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(arguments.array[1], firewall_chain_postrouting_s) == F_equal_to) { create_chain = F_false; } - else if (fl_string_compare(arguments.array[1].string, firewall_chain_prerouting_s, arguments.array[1].used, firewall_chain_prerouting_s_length) == F_equal_to) { + else if (fl_string_dynamic_compare(arguments.array[1], firewall_chain_prerouting_s) == F_equal_to) { create_chain = F_false; } @@ -1080,7 +1080,7 @@ f_status_t firewall_create_custom_chains(firewall_main_t * const main, firewall_ firewall_print_debug_tool(main->warning, firewall_tool_iptables_s, arguments); tool = firewall_program_iptables_e; - status = fll_execute_program((f_string_t) firewall_tool_iptables_s, arguments, 0, 0, (void *) &return_code); + status = fll_execute_program(firewall_tool_iptables_s, arguments, 0, 0, (void *) &return_code); // immediately exit child process, @todo this may require additional memory deallocation and relating changes. if (status == F_child) { @@ -1155,7 +1155,7 @@ f_status_t firewall_delete_chains(firewall_main_t * const main) { f_string_dynamic_t argument[1] = f_string_dynamic_t_initialize; int return_code = 0; - argument[0].string = (f_string_t) "-F"; + argument[0].string = "-F"; argument[0].size = 2; argument[0].used = 2; @@ -1256,9 +1256,9 @@ f_status_t firewall_default_lock(firewall_main_t * const main) { arguments.used = 3; arguments.size = arguments.used; - arguments.array[0].string = (f_string_t) firewall_action_policy_command_s; - arguments.array[1].string = (f_string_t) chains[i]; - arguments.array[2].string = (f_string_t) "DROP"; + arguments.array[0].string = firewall_action_policy_command_s; + arguments.array[1].string = chains[i]; + arguments.array[2].string = "DROP"; arguments.array[0].used = firewall_action_append_command_s_length; arguments.array[1].used = lengths[i]; diff --git a/level_3/fss_basic_list_read/c/fss_basic_list_read.c b/level_3/fss_basic_list_read/c/fss_basic_list_read.c index 4b4ed37..fa9730c 100644 --- a/level_3/fss_basic_list_read/c/fss_basic_list_read.c +++ b/level_3/fss_basic_list_read/c/fss_basic_list_read.c @@ -548,7 +548,7 @@ extern "C" { status = f_file_stream_read(file, &data.buffer); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_read", F_true, "-", "read", fll_error_file_type_pipe_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_read", F_true, f_string_ascii_minus_s, f_file_operation_read_s, fll_error_file_type_pipe_e); } else if (data.buffer.used) { data.files.array[0].range.stop = data.buffer.used - 1; @@ -558,7 +558,7 @@ extern "C" { status = f_string_append_assure(f_string_eol_s, 1, &data.buffer); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_string_append_assure", F_true, "-", "read", fll_error_file_type_pipe_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_string_append_assure", F_true, f_string_ascii_minus_s, f_file_operation_read_s, fll_error_file_type_pipe_e); } } else { @@ -599,7 +599,7 @@ extern "C" { status = f_file_size_by_id(file.id, &size_file); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, arguments->argv[main->remaining.array[i]], "read", fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, arguments->argv[main->remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); break; } @@ -608,7 +608,7 @@ extern "C" { status = f_string_dynamic_resize(data.buffer.size + size_file, &data.buffer); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_string_dynamic_resize", F_true, arguments->argv[main->remaining.array[i]], "read", fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_string_dynamic_resize", F_true, arguments->argv[main->remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); break; } @@ -616,7 +616,7 @@ extern "C" { status = f_file_stream_read(file, &data.buffer); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_read", F_true, arguments->argv[main->remaining.array[i]], "read", fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_read", F_true, arguments->argv[main->remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); break; } @@ -629,7 +629,7 @@ extern "C" { status = f_string_append_assure(f_string_eol_s, 1, &data.buffer); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_string_append_assure", F_true, "-", "read", fll_error_file_type_pipe_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_string_append_assure", F_true, f_string_ascii_minus_s, f_file_operation_read_s, fll_error_file_type_pipe_e); } } } diff --git a/level_3/fss_basic_read/c/fss_basic_read.c b/level_3/fss_basic_read/c/fss_basic_read.c index da37c0e..d597454 100644 --- a/level_3/fss_basic_read/c/fss_basic_read.c +++ b/level_3/fss_basic_read/c/fss_basic_read.c @@ -543,7 +543,7 @@ extern "C" { status = f_file_stream_read(file, &data.buffer); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_read", F_true, "-", "read", fll_error_file_type_pipe_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_read", F_true, f_string_ascii_minus_s, f_file_operation_read_s, fll_error_file_type_pipe_e); } else if (data.buffer.used) { data.files.array[0].range.stop = data.buffer.used - 1; @@ -553,7 +553,7 @@ extern "C" { status = f_string_append_assure(f_string_eol_s, 1, &data.buffer); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_string_append_assure", F_true, "-", "read", fll_error_file_type_pipe_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_string_append_assure", F_true, f_string_ascii_minus_s, f_file_operation_read_s, fll_error_file_type_pipe_e); } } else { @@ -588,7 +588,7 @@ extern "C" { status = f_file_size_by_id(file.id, &size_file); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, arguments->argv[main->remaining.array[i]], "read", fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, arguments->argv[main->remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); break; } @@ -597,7 +597,7 @@ extern "C" { status = f_string_dynamic_resize(data.buffer.size + size_file, &data.buffer); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_string_dynamic_resize", F_true, arguments->argv[main->remaining.array[i]], "read", fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_string_dynamic_resize", F_true, arguments->argv[main->remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); break; } @@ -605,7 +605,7 @@ extern "C" { status = f_file_stream_read(file, &data.buffer); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_read", F_true, arguments->argv[main->remaining.array[i]], "read", fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_read", F_true, arguments->argv[main->remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); break; } @@ -619,7 +619,7 @@ extern "C" { status = f_string_append_assure(f_string_eol_s, 1, &data.buffer); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_string_append_assure", F_true, "-", "read", fll_error_file_type_pipe_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_string_append_assure", F_true, f_string_ascii_minus_s, f_file_operation_read_s, fll_error_file_type_pipe_e); } } } diff --git a/level_3/fss_embedded_list_read/c/fss_embedded_list_read.c b/level_3/fss_embedded_list_read/c/fss_embedded_list_read.c index d6e3062..52e4b1e 100644 --- a/level_3/fss_embedded_list_read/c/fss_embedded_list_read.c +++ b/level_3/fss_embedded_list_read/c/fss_embedded_list_read.c @@ -434,13 +434,13 @@ extern "C" { status = f_file_read(file, &main->buffer); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_read", F_true, "-", "read", fll_error_file_type_pipe_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_read", F_true, f_string_ascii_minus_s, f_file_operation_read_s, fll_error_file_type_pipe_e); } else { - status = fss_embedded_list_read_main_process_file(main, arguments, "-", depths, &objects_delimits, &contents_delimits, &comments); + status = fss_embedded_list_read_main_process_file(main, arguments, f_string_ascii_minus_s, depths, &objects_delimits, &contents_delimits, &comments); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "fss_embedded_list_read_main_process_file", F_true, "-", "read", fll_error_file_type_pipe_e); + fll_error_file_print(main->error, F_status_set_fine(status), "fss_embedded_list_read_main_process_file", F_true, f_string_ascii_minus_s, f_file_operation_read_s, fll_error_file_type_pipe_e); } } @@ -472,7 +472,7 @@ extern "C" { if (!main->quantity.total) { status = f_file_size_by_id(file.id, &main->quantity.total); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, arguments->argv[main->remaining.array[i]], "read", fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, arguments->argv[main->remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); f_file_stream_close(F_true, &file); @@ -496,7 +496,7 @@ extern "C" { f_file_stream_close(F_true, &file); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_read_until", F_true, arguments->argv[main->remaining.array[i]], "read", fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_read_until", F_true, arguments->argv[main->remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); break; } @@ -504,7 +504,7 @@ extern "C" { status = fss_embedded_list_read_main_process_file(main, arguments, arguments->argv[main->remaining.array[i]], depths, &objects_delimits, &contents_delimits, &comments); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "fss_embedded_list_read_main_process_file", F_true, arguments->argv[main->remaining.array[i]], "read", fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "fss_embedded_list_read_main_process_file", F_true, arguments->argv[main->remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); break; } diff --git a/level_3/fss_extended_list_read/c/fss_extended_list_read.c b/level_3/fss_extended_list_read/c/fss_extended_list_read.c index e3e1a52..83c8af5 100644 --- a/level_3/fss_extended_list_read/c/fss_extended_list_read.c +++ b/level_3/fss_extended_list_read/c/fss_extended_list_read.c @@ -543,7 +543,7 @@ extern "C" { status = f_file_stream_read(file, &data.buffer); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_read", F_true, "-", "read", fll_error_file_type_pipe_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_read", F_true, f_string_ascii_minus_s, f_file_operation_read_s, fll_error_file_type_pipe_e); } else if (data.buffer.used) { data.files.array[0].range.stop = data.buffer.used - 1; @@ -553,7 +553,7 @@ extern "C" { status = f_string_append_assure(f_string_eol_s, 1, &data.buffer); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_string_append_assure", F_true, "-", "read", fll_error_file_type_pipe_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_string_append_assure", F_true, f_string_ascii_minus_s, f_file_operation_read_s, fll_error_file_type_pipe_e); } } else { @@ -589,7 +589,7 @@ extern "C" { status = f_file_size_by_id(file.id, &size_file); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, arguments->argv[main->remaining.array[i]], "read", fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, arguments->argv[main->remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); break; } @@ -598,7 +598,7 @@ extern "C" { status = f_string_dynamic_resize(data.buffer.size + size_file, &data.buffer); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_string_dynamic_resize", F_true, arguments->argv[main->remaining.array[i]], "read", fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_string_dynamic_resize", F_true, arguments->argv[main->remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); break; } @@ -606,7 +606,7 @@ extern "C" { status = f_file_stream_read(file, &data.buffer); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_read", F_true, arguments->argv[main->remaining.array[i]], "read", fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_read", F_true, arguments->argv[main->remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); break; } @@ -619,7 +619,7 @@ extern "C" { status = f_string_append_assure(f_string_eol_s, 1, &data.buffer); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_string_append_assure", F_true, "-", "read", fll_error_file_type_pipe_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_string_append_assure", F_true, f_string_ascii_s, f_file_operation_read_s, fll_error_file_type_pipe_e); } } } diff --git a/level_3/fss_extended_read/c/fss_extended_read.c b/level_3/fss_extended_read/c/fss_extended_read.c index e936f5a..dba541f 100644 --- a/level_3/fss_extended_read/c/fss_extended_read.c +++ b/level_3/fss_extended_read/c/fss_extended_read.c @@ -545,7 +545,7 @@ extern "C" { status = f_file_stream_read(file, &data.buffer); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_read", F_true, "-", "read", fll_error_file_type_pipe_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_read", F_true, f_string_ascii_s, f_file_operation_read_s, fll_error_file_type_pipe_e); } else if (data.buffer.used) { data.files.array[0].range.stop = data.buffer.used - 1; @@ -555,7 +555,7 @@ extern "C" { status = f_string_append_assure(f_string_eol_s, 1, &data.buffer); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_string_append_assure", F_true, "-", "read", fll_error_file_type_pipe_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_string_append_assure", F_true, f_string_ascii_s, f_file_operation_read_s, fll_error_file_type_pipe_e); } } else { @@ -595,7 +595,7 @@ extern "C" { status = f_file_size_by_id(file.id, &size_file); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, arguments->argv[main->remaining.array[i]], "read", fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, arguments->argv[main->remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); break; } @@ -604,7 +604,7 @@ extern "C" { status = f_string_dynamic_resize(data.buffer.size + size_file, &data.buffer); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_string_dynamic_resize", F_true, arguments->argv[main->remaining.array[i]], "read", fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_string_dynamic_resize", F_true, arguments->argv[main->remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); break; } @@ -612,7 +612,7 @@ extern "C" { status = f_file_stream_read(file, &data.buffer); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_read", F_true, arguments->argv[main->remaining.array[i]], "read", fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_read", F_true, arguments->argv[main->remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); break; } @@ -626,7 +626,7 @@ extern "C" { status = f_string_append_assure(f_string_eol_s, 1, &data.buffer); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_string_append_assure", F_true, "-", "read", fll_error_file_type_pipe_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_string_append_assure", F_true, f_string_ascii_s, f_file_operation_read_s, fll_error_file_type_pipe_e); } } } diff --git a/level_3/fss_identify/c/private-identify.c b/level_3/fss_identify/c/private-identify.c index 3ef5c5d..b9852ae 100644 --- a/level_3/fss_identify/c/private-identify.c +++ b/level_3/fss_identify/c/private-identify.c @@ -8,7 +8,7 @@ extern "C" { #endif #ifndef _di_fss_identify_load_line_ - f_status_t fss_identify_load_line(fss_identify_main_t * const main, const f_file_t file, const f_string_t name, f_string_static_t *buffer, f_string_range_t *range) { + f_status_t fss_identify_load_line(fss_identify_main_t * const main, const f_file_t file, const f_string_static_t name, f_string_static_t *buffer, f_string_range_t *range) { f_status_t status = F_none; uint16_t signal_check = 0; @@ -32,7 +32,7 @@ extern "C" { status = f_string_dynamic_resize(buffer->size + file.size_read, buffer); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_string_dynamic_resize", F_true, name ? name : "-", "read", name ? fll_error_file_type_file_e : fll_error_file_type_pipe_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_string_dynamic_resize", F_true, name.used ? name : f_string_ascii_s, f_file_operation_read_s, name ? fll_error_file_type_file_e : fll_error_file_type_pipe_e); return status; } @@ -41,7 +41,7 @@ extern "C" { status = f_file_stream_read_block(file, buffer); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_read_block", F_true, name ? name : "-", "read", name ? fll_error_file_type_file_e : fll_error_file_type_pipe_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_read_block", F_true, name.used ? name : f_string_ascii_s, f_file_operation_read_s, name ? fll_error_file_type_file_e : fll_error_file_type_pipe_e); return status; } @@ -72,7 +72,7 @@ extern "C" { status = fll_fss_identify(buffer.string, range, &ids); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "fll_fss_identify", F_true, name ? name : "-", "read", name ? fll_error_file_type_file_e : fll_error_file_type_pipe_e); + fll_error_file_print(main->error, F_status_set_fine(status), "fll_fss_identify", F_true, name.used ? name : f_string_ascii_s, f_file_operation_read_s, name.used ? fll_error_file_type_file_e : fll_error_file_type_pipe_e); f_type_fll_ids_resize(0, &ids); diff --git a/level_3/fss_payload_read/c/fss_payload_read.c b/level_3/fss_payload_read/c/fss_payload_read.c index 944786b..eec2d70 100644 --- a/level_3/fss_payload_read/c/fss_payload_read.c +++ b/level_3/fss_payload_read/c/fss_payload_read.c @@ -565,7 +565,7 @@ extern "C" { status = f_file_stream_read(file, &data.buffer); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_read", F_true, "-", "read", fll_error_file_type_pipe_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_read", F_true, f_string_ascii_s, f_file_operation_read_s, fll_error_file_type_pipe_e); } else if (data.buffer.used) { data.files.array[0].range.stop = data.buffer.used - 1; @@ -575,7 +575,7 @@ extern "C" { status = f_string_append_assure(f_string_eol_s, 1, &data.buffer); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_string_append_assure", F_true, "-", "read", fll_error_file_type_pipe_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_string_append_assure", F_true, f_string_ascii_s, f_file_operation_read_s, fll_error_file_type_pipe_e); } } else { @@ -617,7 +617,7 @@ extern "C" { status = f_file_size_by_id(file.id, &size_file); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, arguments->argv[main->remaining.array[i]], "read", fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, arguments->argv[main->remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); break; } @@ -626,7 +626,7 @@ extern "C" { status = f_string_dynamic_resize(data.buffer.size + size_file, &data.buffer); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_string_dynamic_resize", F_true, arguments->argv[main->remaining.array[i]], "read", fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_string_dynamic_resize", F_true, arguments->argv[main->remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); break; } @@ -639,14 +639,14 @@ extern "C" { status = f_string_append_assure(f_string_eol_s, 1, &data.buffer); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_string_append_assure", F_true, "-", "read", fll_error_file_type_pipe_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_string_append_assure", F_true, f_string_ascii_s, f_file_operation_read_s, fll_error_file_type_pipe_e); } } status = f_file_stream_read(file, &data.buffer); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_read", F_true, arguments->argv[main->remaining.array[i]], "read", fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_read", F_true, arguments->argv[main->remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); break; } diff --git a/level_3/iki_write/c/iki_write.c b/level_3/iki_write/c/iki_write.c index 433452f..2ef52b5 100644 --- a/level_3/iki_write/c/iki_write.c +++ b/level_3/iki_write/c/iki_write.c @@ -324,7 +324,7 @@ extern "C" { status_pipe = f_file_read(pipe, &buffer); if (F_status_is_error(status_pipe)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_read_to", F_true, "-", "read", fll_error_file_type_pipe_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_read_to", F_true, f_string_ascii_s, f_file_operation_read_s, fll_error_file_type_pipe_e); status = F_status_set_error(F_pipe); diff --git a/level_3/utf8/c/private-print.c b/level_3/utf8/c/private-print.c index 01cae10..089f99c 100644 --- a/level_3/utf8/c/private-print.c +++ b/level_3/utf8/c/private-print.c @@ -153,7 +153,7 @@ extern "C" { #endif // _di_utf8_print_error_no_from_ #ifndef _di_utf8_print_error_no_value_ - void utf8_print_error_no_value(utf8_data_t * const data, const f_string_t parameter) { + void utf8_print_error_no_value(utf8_data_t * const data, const f_string_static_t parameter) { if (data->main->error.verbosity == f_console_verbosity_quiet_e) return; @@ -183,14 +183,14 @@ extern "C" { #endif // _di_utf8_print_error_parameter_file_name_empty_ #ifndef _di_utf8_print_error_parameter_file_not_found_ - void utf8_print_error_parameter_file_not_found(utf8_data_t * const data, const bool from, const f_string_t name) { + void utf8_print_error_parameter_file_not_found(utf8_data_t * const data, const bool from, const f_string_static_t name) { if (data->main->error.verbosity == f_console_verbosity_quiet_e) return; flockfile(data->main->error.to.stream); fl_print_format("%r%[%QFailed to find the %s file '%]", data->main->error.to.stream, f_string_eol_s, data->main->context.set.error, data->main->error.prefix, from ? utf8_string_from_s : utf8_string_to_s, data->main->context.set.error); - fl_print_format("%[%S%]", data->main->error.to.stream, data->main->context.set.notable, name, data->main->context.set.notable); + fl_print_format("%[%Q%]", data->main->error.to.stream, data->main->context.set.notable, name, data->main->context.set.notable); fl_print_format("%['.%]%r", data->main->error.to.stream, data->main->context.set.error, data->main->context.set.error, f_string_eol_s); funlockfile(data->main->error.to.stream); diff --git a/level_3/utf8/c/private-print.h b/level_3/utf8/c/private-print.h index 38170e1..d45df80 100644 --- a/level_3/utf8/c/private-print.h +++ b/level_3/utf8/c/private-print.h @@ -111,7 +111,7 @@ extern "C" { * The long parameter name. */ #ifndef _di_utf8_print_error_no_value_ - extern void utf8_print_error_no_value(utf8_data_t * const data, const f_string_t parameter) F_attribute_visibility_internal_d; + extern void utf8_print_error_no_value(utf8_data_t * const data, const f_string_static_t parameter) F_attribute_visibility_internal_d; #endif // _di_utf8_print_error_no_value_ /** @@ -138,7 +138,7 @@ extern "C" { * The file path name. */ #ifndef _di_utf8_print_error_parameter_file_not_found_ - extern void utf8_print_error_parameter_file_not_found(utf8_data_t * const data, const bool from, const f_string_t name) F_attribute_visibility_internal_d; + extern void utf8_print_error_parameter_file_not_found(utf8_data_t * const data, const bool from, const f_string_static_t name) F_attribute_visibility_internal_d; #endif // _di_utf8_print_error_parameter_file_not_found_ /** diff --git a/level_3/utf8/c/utf8.c b/level_3/utf8/c/utf8.c index 26736e3..82c66c7 100644 --- a/level_3/utf8/c/utf8.c +++ b/level_3/utf8/c/utf8.c @@ -308,8 +308,8 @@ extern "C" { index = main->parameters.array[utf8_parameter_from_file_e].values.array[i]; if (arguments->argv[index][0]) { - if (!f_file_exists(arguments->argv[index])) { - utf8_print_error_parameter_file_not_found(&data, F_true, arguments->argv[index]); + if (!f_file_exists(data.argv[index])) { + utf8_print_error_parameter_file_not_found(&data, F_true, data.argv[index]); if (F_status_is_error_not(status)) { status = F_status_set_error(F_file_found_not); -- 1.8.3.1