The cost of the system call for checking if a signal is received is more expensive than I have previously imagined.
I also was not sure where I should handle the signals and I arbitrarily put them inside loops.
Reduce the number of checks.
Reduce the number of the system call to check the process signal using modulus math.
The performance difference is most notable when using the byte_dump program.
This focuses on solving the immediate performance bug.
I still have not done any extensive performance investigations and I expect this to still have significant room for improvement.
#define byte_dump_option_wide_d 0x1
+ #define byte_dump_signal_check_d 10000
+
#define byte_dump_sequence_acknowledge_s "␆"
#define byte_dump_sequence_acknowledge_negative_s "␕"
#define byte_dump_sequence_backspace_s "␈"
memset(&invalid, 0, sizeof(char) * main->width);
if (byte_get >= 0) {
- for (;;) {
+ for (uint16_t signal_check = 0; ; ) {
- if (byte_dump_signal_received(main)) {
- return F_status_set_error(F_interrupt);
+ if (!((++signal_check) % byte_dump_signal_check_d)) {
+ if (byte_dump_signal_received(main)) {
+ return F_status_set_error(F_interrupt);
+ }
+
+ signal_check = 0;
}
byte_get = getc(file.stream);
if (status == F_child) {
break;
}
- else if (F_status_set_fine(status) == F_interrupt || fake_signal_received(main)) {
+ else if (F_status_set_fine(status) == F_interrupt || !(i % fake_signal_check_short_d) && fake_signal_received(main)) {
status = F_status_set_error(F_interrupt);
break;
}
fake_operation_skeleton,
};
+ #define fake_signal_check_d 10000
+ #define fake_signal_check_tiny_d 4
+ #define fake_signal_check_short_d 16
+
#define fake_operations_total_d 4
#define fake_operations_initialize { 0, 0, 0, 0 }
f_signal_t signal;
uint8_t operation;
+ uint16_t signal_check;
mode_t umask;
int child;
0, \
0, \
0, \
+ 0, \
f_string_dynamics_t_initialize, \
f_string_dynamic_t_initialize, \
f_string_dynamics_t_initialize, \
for (f_array_length_t i = 0; i < files.used; ++i) {
+ if (!(i % fake_signal_check_short_d) && fake_signal_received(main)) {
+ *status = F_status_set_error(F_interrupt);
+ break;
+ }
+
if (!files.array[i].used) continue;
path_source.used = source.used;
break;
}
- if (fake_signal_received(main)) {
- *status = F_status_set_error(F_interrupt);
- break;
- }
-
*status = f_directory_is(path_source.string);
if (*status == F_true) {
break;
}
- if (fake_signal_received(main)) {
- *status = F_status_set_error(F_interrupt);
- break;
- }
-
*status = f_file_copy(path_source.string, destination_file.string, mode, F_file_default_read_size_d, F_false);
if (F_status_is_error(*status)) {
if (!directorys[i]->used) continue;
- if (fake_signal_received(main)) {
- *status = F_status_set_error(F_interrupt);
-
- return;
- }
-
// @todo implement this in a common function and use across project for creating parent directories.
for (f_array_length_t j = 0; j < directorys[i]->used; ++j) {
int return_code = 0;
- if (fake_signal_received(main)) {
- *status = F_status_set_error(F_interrupt);
-
- macro_f_string_dynamic_t_delete_simple(path);
- macro_f_string_dynamics_t_delete_simple(arguments);
- }
- else {
- // child processes should receive all signals, without blocking.
- f_signal_how_t signals = f_signal_how_t_initialize;
- f_signal_set_empty(&signals.block);
- f_signal_set_fill(&signals.block_not);
+ // Child processes should receive all signals, without blocking.
+ f_signal_how_t signals = f_signal_how_t_initialize;
+ f_signal_set_empty(&signals.block);
+ f_signal_set_fill(&signals.block_not);
- fl_execute_parameter_t parameter = macro_fl_execute_parameter_t_initialize(FL_execute_parameter_option_path_d, 0, &data_build.environment, &signals, 0);
+ fl_execute_parameter_t parameter = macro_fl_execute_parameter_t_initialize(FL_execute_parameter_option_path_d, 0, &data_build.environment, &signals, 0);
- *status = fll_execute_program(path.string, arguments, ¶meter, 0, (void *) &return_code);
+ *status = fll_execute_program(path.string, arguments, ¶meter, 0, (void *) &return_code);
- macro_f_string_dynamics_t_delete_simple(arguments);
+ macro_f_string_dynamics_t_delete_simple(arguments);
- if (fake_signal_received(main)) {
- *status = F_status_set_error(F_interrupt);
- }
- else if (*status != F_child) {
- if (F_status_is_error(*status)) {
- if (F_status_set_fine(*status) == F_failure) {
- if (main->error.verbosity != f_console_verbosity_quiet) {
- flockfile(main->error.to.stream);
+ if (fake_signal_received(main)) {
+ *status = F_status_set_error(F_interrupt);
+ }
+ else if (*status != F_child) {
+ if (F_status_is_error(*status)) {
+ if (F_status_set_fine(*status) == F_failure) {
+ if (main->error.verbosity != f_console_verbosity_quiet) {
+ flockfile(main->error.to.stream);
- fl_print_format("%c%[%SFailed to execute script: '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
- fl_print_format("%[%Q%]", main->error.to.stream, main->error.notable, path, main->error.notable);
- fl_print_format("%['.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
+ fl_print_format("%c%[%SFailed to execute script: '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%Q%]", main->error.to.stream, main->error.notable, path, main->error.notable);
+ fl_print_format("%['.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
- funlockfile(main->error.to.stream);
- }
- }
- else {
- fll_error_print(main->error, F_status_set_fine(*status), "fll_execute_program", F_true);
+ funlockfile(main->error.to.stream);
}
}
else {
- fake_build_touch(main, file_stage, status);
+ fll_error_print(main->error, F_status_set_fine(*status), "fll_execute_program", F_true);
}
}
+ else {
+ fake_build_touch(main, file_stage, status);
+ }
}
macro_f_string_dynamic_t_delete_simple(path);
parameter_file_path[parameter_file_path_length] = 0;
- if (fake_signal_received(main)) {
- *status = F_status_set_error(F_interrupt);
-
- return 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) {
parameter_file_path[parameter_file_path_length] = 0;
- if (fake_signal_received(main)) {
- *status = F_status_set_error(F_interrupt);
-
- return 0;
- }
-
*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) {
parameter_file_path[parameter_file_path_length] = 0;
- if (fake_signal_received(main)) {
- *status = F_status_set_error(F_interrupt);
-
- return 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) {
parameter_file_path[parameter_file_path_length] = 0;
- if (fake_signal_received(main)) {
- *status = F_status_set_error(F_interrupt);
-
- return 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) {
break;
}
- if (fake_signal_received(main)) {
- *status = F_status_set_error(F_interrupt);
- break;
- }
-
*status = f_file_name_directory(sources[i]->array[j].string, sources[i]->array[j].used, &source_path);
if (F_status_is_error(*status)) {
*status = fake_file_buffer(main, main->file_data_build_settings.string, &buffer);
}
- if (fake_signal_received(main)) {
- *status = F_status_set_error(F_interrupt);
- }
- else if (F_status_is_error_not(*status)) {
+ if (F_status_is_error_not(*status)) {
f_string_range_t range = macro_f_string_range_t_initialize(buffer.used);
f_fss_delimits_t delimits = f_fss_delimits_t_initialize;
fll_error_print(main->error, F_status_set_fine(*status), function, F_true);
}
}
- else if (!fake_signal_received(main)) {
+ else {
const f_string_t settings_single_name[] = {
fake_build_setting_name_build_compiler_s,
fake_build_setting_name_build_indexer_s,
*status = F_status_set_error(F_failure);
}
}
-
- if (fake_signal_received(main)) {
- *status = F_status_set_error(F_interrupt);
- }
}
#endif // _di_fake_build_load_setting_defaults_
if (fake_signal_received(main)) {
*status = F_status_set_error(F_interrupt);
+
+ return;
}
const f_string_t names[] = {
break;
}
- if (fake_signal_received(main)) {
- *status = F_status_set_error(F_interrupt);
- break;
- }
-
*status = f_file_name_directory(sources[i]->array[j].string, sources[i]->array[j].used, &destination_path);
if (F_status_is_error(*status)) {
break;
}
- if (fake_signal_received(main)) {
- *status = F_status_set_error(F_interrupt);
- break;
- }
-
*status = f_directory_exists(destination_path.string);
if (*status == F_false) {
if (F_status_is_error(*status)) return;
- f_mode_t mode = f_mode_t_initialize;
-
- macro_f_mode_t_set_default_umask(mode, main->umask);
-
if (fake_signal_received(main)) {
*status = F_status_set_error(F_interrupt);
return;
}
+ f_mode_t mode = f_mode_t_initialize;
+
+ macro_f_mode_t_set_default_umask(mode, main->umask);
+
*status = f_file_touch(file.string, mode.regular, F_false);
if (F_status_is_error(*status)) {
fflush(main->output.to.stream);
}
- if (fake_signal_received(main)) {
- *status = F_status_set_error(F_interrupt);
-
- return 0;
- }
-
int return_code = 0;
if (program.used) {
fake_main_t *main = (fake_main_t *) state_ptr->custom;
- if (fake_signal_received(main)) {
- return F_status_set_error(F_interrupt);
+ if (!((++main->signal_check) % fake_signal_check_d)) {
+ if (fake_signal_received(main)) {
+ return F_status_set_error(F_interrupt);
+ }
+
+ main->signal_check = 0;
}
return F_interrupt_not;
fake_main_t *main = (fake_main_t *) state_ptr->custom;
- if (fake_signal_received(main)) {
- return F_status_set_error(F_interrupt);
+ if (!((++main->signal_check) % fake_signal_check_d)) {
+ if (fake_signal_received(main)) {
+ return F_status_set_error(F_interrupt);
+ }
+
+ main->signal_check = 0;
}
return F_interrupt_not;
for (uint8_t i = 0; i < 3; ++i) {
- if (fake_signal_received(main)) {
- return F_status_set_error(F_interrupt);
- }
-
if (parameters_value[i]->used) {
memset(&directory_stat, 0, sizeof(struct stat));
for (f_array_length_t i = 0; i < list_objects.used; ++i) {
- if (fake_signal_received(main)) {
+ if (!(i % fake_signal_check_short_d) && fake_signal_received(main)) {
*status = F_status_set_error(F_interrupt);
break;
}
}
}
- if (fake_signal_received(main)) {
- *status = F_status_set_error(F_interrupt);
- }
-
if (F_status_is_error_not(*status) && data_make->setting_make.load_build) {
f_string_static_t stub = f_string_static_t_initialize;
f_string_map_multis_t define = f_string_map_multis_t_initialize;
- if (fake_signal_received(main)) {
- *status = F_status_set_error(F_interrupt);
- }
- else {
-
- // 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);
- }
+ // 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);
if (F_status_is_error_not(*status) && settings.objects.used) {
const f_string_t settings_name[] = {
break;
}
- if (fake_signal_received(main)) {
- *status = F_status_set_error(F_interrupt);
- break;
- }
-
*status = f_environment_set(define.array[i].name.string, combined.string, F_true);
if (F_status_is_error(*status)) {
return status;
}
- if (fake_signal_received(main)) {
- macro_fake_make_data_t_delete_simple(data_make);
-
- return F_status_set_error(F_interrupt);
- }
-
status = f_path_current(F_true, &data_make.path.stack.array[0]);
if (F_status_is_error(status)) {
operation = 0;
operation_name = 0;
- if (fake_signal_received(main)) {
+ if (!(i % fake_signal_check_short_d) && fake_signal_received(main)) {
*status = F_status_set_error(F_interrupt);
break;
}
for (uint8_t i = 0; i < 20; ++i) {
- if (fake_signal_received(main)) {
- return F_status_set_error(F_interrupt);
- }
-
status = fake_skeleton_operate_directory_create(main, *parameters_value[i]);
if (F_status_is_error(status)) {
f_string_dynamic_t content = f_string_dynamic_t_initialize;
if (F_status_is_error_not(status)) {
- if (fake_signal_received(main)) {
- status = F_status_set_error(F_interrupt);
- }
-
content.string = fake_make_skeleton_content_defines_s;
content.used = fake_make_skeleton_content_defines_s_length;
content.size = content.used;
}
if (F_status_is_error_not(status)) {
- if (fake_signal_received(main)) {
- status = F_status_set_error(F_interrupt);
- }
-
content.string = fake_make_skeleton_content_dependencies_s;
content.used = fake_make_skeleton_content_dependencies_s_length;
content.size = content.used;
}
if (F_status_is_error_not(status)) {
- if (fake_signal_received(main)) {
- status = F_status_set_error(F_interrupt);
- }
-
status = fake_skeleton_operate_file_create(main, file_data_build_process_post, F_true, content);
}
if (F_status_is_error_not(status)) {
- if (fake_signal_received(main)) {
- status = F_status_set_error(F_interrupt);
- }
-
status = fake_skeleton_operate_file_create(main, file_data_build_process_pre, F_true, content);
}
if (F_status_is_error_not(status)) {
- if (fake_signal_received(main)) {
- status = F_status_set_error(F_interrupt);
- }
-
content.string = fake_make_skeleton_content_settings_s;
content.used = fake_make_skeleton_content_settings_s_length;
content.size = content.used;
}
if (F_status_is_error_not(status)) {
- if (fake_signal_received(main)) {
- status = F_status_set_error(F_interrupt);
- }
-
status = fake_skeleton_operate_file_create(main, main->file_documents_readme, F_false, content);
}
if (F_status_is_error_not(status)) {
- if (fake_signal_received(main)) {
- status = F_status_set_error(F_interrupt);
- }
-
content.string = fake_make_skeleton_content_fakefile_s;
content.used = fake_make_skeleton_content_fakefile_s_length;
content.size = content.used;
#endif // _di_firewall_default_allocation_step_
#ifndef _di_firewall_defines_
+ #define firewall_signal_check_d 10000
+
#define firewall_tool_s "tool"
#define firewall_tool_iptables_s "iptables"
#define firewall_tool_ip6tables_s "ip6tables"
chain = firewall_chain_custom_id;
}
- for (; i < local.rule_objects.used; ++i) {
+ for (uint16_t signal_check = 0; i < local.rule_objects.used; ++i) {
- status = firewall_signal_received(main);
+ if (!((++signal_check) % firewall_signal_check_d)) {
+ if (firewall_signal_received(main)) {
+ macro_f_string_dynamic_t_delete_simple(ip_list);
+ macro_f_string_dynamic_t_delete_simple(argument);
+ macro_f_string_dynamics_t_delete_simple(arguments);
+ macro_f_string_dynamic_t_delete_simple(device);
+ macro_f_string_dynamic_t_delete_simple(protocol);
- if (status) {
- macro_f_string_dynamic_t_delete_simple(ip_list);
- macro_f_string_dynamic_t_delete_simple(argument);
- macro_f_string_dynamics_t_delete_simple(arguments);
- macro_f_string_dynamic_t_delete_simple(device);
- macro_f_string_dynamic_t_delete_simple(protocol);
+ return F_status_set_error(F_interrupt);
+ }
- return F_status_set_error(F_interrupt);
+ signal_check = 0;
}
length = macro_firewall_structure_size(local.rule_objects, i);
for (r = repeat; r > 0; --r) {
- status = firewall_signal_received(main);
-
- if (status) {
- macro_f_string_dynamic_t_delete_simple(ip_list);
- macro_f_string_dynamic_t_delete_simple(argument);
- macro_f_string_dynamics_t_delete_simple(arguments);
- macro_f_string_dynamic_t_delete_simple(device);
- macro_f_string_dynamic_t_delete_simple(protocol);
-
- return F_status_set_error(F_interrupt);
- }
-
// first add the program name
f_string_dynamics_resize(0, &arguments);
reserved->has_stop = F_false;
reserved->has_main = F_false;
- while (i < local->chain_objects.used) {
+ for (uint16_t signal_check = 0; i < local->chain_objects.used; ) {
new_chain = F_true;
j = 0;
- status = firewall_signal_received(main);
-
- if (status) {
- macro_f_string_dynamics_t_delete_simple(arguments);
+ if (!((++signal_check) % firewall_signal_check_d)) {
+ if (firewall_signal_received(main)) {
+ macro_f_string_dynamics_t_delete_simple(arguments);
- return F_status_set_error(F_interrupt);
+ return F_status_set_error(F_interrupt);
+ }
}
// skip globally reserved chain name: main
#endif // _di_fss_basic_list_read_program_name_
#ifndef _di_fss_basic_list_read_defines_
+ #define fss_basic_list_read_signal_check_d 10000
+
#define fss_basic_list_pipe_content_end_s '\f'
#define fss_basic_list_pipe_content_ignore_s '\v'
#define fss_basic_list_pipe_content_start_s '\b'
#endif // _di_fss_basic_list_write_program_name_
#ifndef _di_fss_basic_list_write_defines_
+ #define fss_basic_list_write_signal_check_d 10000
+
#define fss_basic_list_write_pipe_content_end_s '\f'
#define fss_basic_list_write_pipe_content_ignore_s '\v'
#define fss_basic_list_write_pipe_content_start_s '\b'
#endif // _di_fss_basic_read_program_name_
#ifndef _di_fss_basic_read_defines_
+ #define fss_basic_read_signal_check_d 10000
+
#define fss_basic_read_pipe_content_end_s '\f'
#define fss_basic_read_pipe_content_ignore_s '\v'
#define fss_basic_read_pipe_content_start_s '\b'
#endif // _di_fss_basic_write_program_name_
#ifndef _di_fss_basic_write_defines_
+ #define fss_basic_write_signal_check_d 10000
+
#define fss_basic_write_pipe_content_end_s '\f'
#define fss_basic_write_pipe_content_ignore_s '\v'
#define fss_basic_write_pipe_content_start_s '\b'
#endif // _di_fss_embedded_list_read_program_name_
#ifndef _di_fss_embedded_list_read_defines_
+ #define fss_embedded_list_read_signal_check_d 10000
+
#define fss_embedded_list_read_pipe_content_end_s '\f'
#define fss_embedded_list_read_pipe_content_ignore_s '\v'
#define fss_embedded_list_read_pipe_content_start_s '\b'
#endif // _di_fss_embedded_list_write_program_name_
#ifndef _di_fss_embedded_list_write_defines_
+ #define fss_embedded_list_write_signal_check_d 10000
+
#define fss_embedded_list_write_pipe_content_end_s '\f'
#define fss_embedded_list_write_pipe_content_ignore_s '\v'
#define fss_embedded_list_write_pipe_content_start_s '\b'
#endif // _di_fss_extended_list_read_program_name_
#ifndef _di_fss_extended_list_read_defines_
+ #define fss_extended_list_read_signal_check_d 10000
+
#define fss_extended_list_read_pipe_content_end '\f'
#define fss_extended_list_read_pipe_content_ignore '\v'
#define fss_extended_list_read_pipe_content_start '\b'
#endif // _di_fss_extended_list_write_program_name_
#ifndef _di_fss_extended_list_write_defines_
+ #define fss_extended_list_write_signal_check_d 10000
+
#define fss_extended_list_write_pipe_content_end_s '\f'
#define fss_extended_list_write_pipe_content_ignore_s '\v'
#define fss_extended_list_write_pipe_content_start_s '\b'
if (F_status_is_error_not(status) && main->parameters[fss_extended_read_parameter_delimit].result == f_console_result_additional) {
f_array_length_t location = 0;
f_array_length_t length = 0;
+ uint16_t signal_check = 0;
// Set the value to 0 to allow for detecting mode based on what is provided.
data.delimit_mode = 0;
for (f_array_length_t i = 0; i < main->parameters[fss_extended_read_parameter_delimit].values.used; ++i) {
- if (fss_extended_read_signal_received(main)) {
- status = F_status_set_error(F_signal);
- break;
+ if (!((++signal_check) % fss_extended_read_signal_check_d)) {
+ if (fss_extended_read_signal_received(main)) {
+ status = F_status_set_error(F_signal);
+ break;
+ }
+
+ signal_check = 0;
}
location = main->parameters[fss_extended_read_parameter_delimit].values.array[i];
if (F_status_is_error_not(status) && main->remaining.used > 0) {
f_file_t file = f_file_t_initialize;
f_array_length_t size_file = 0;
+ uint16_t signal_check = 0;
for (f_array_length_t i = 0; i < main->remaining.used; ++i) {
- if (fss_extended_read_signal_received(main)) {
- status = F_status_set_error(F_signal);
- break;
+ if (!((++signal_check) % fss_extended_read_signal_check_d)) {
+ if (fss_extended_read_signal_received(main)) {
+ status = F_status_set_error(F_signal);
+ break;
+ }
+
+ signal_check = 0;
}
data.files.array[data.files.used].range.start = data.buffer.used;
#endif // _di_fss_extended_read_program_name_
#ifndef _di_fss_extended_read_defines_
+ #define fss_extended_read_signal_check_d 10000
+
#define fss_extended_read_pipe_content_end_s '\f'
#define fss_extended_read_pipe_content_ignore_s '\v'
#define fss_extended_read_pipe_content_start_s '\b'
f_array_length_t position_depth = 0;
f_array_length_t position_at = 0;
f_array_length_t position_name = 0;
+ uint16_t signal_check = 0;
for (f_array_length_t i = 0; i < data->depths.used; ++i) {
- if (fss_extended_read_signal_received(main)) {
- return F_status_set_error(F_interrupt);
+ if (!((++signal_check) % fss_extended_read_signal_check_d)) {
+ if (fss_extended_read_signal_received(main)) {
+ return F_status_set_error(F_interrupt);
+ }
+
+ signal_check = 0;
}
data->depths.array[i].depth = 0;
for (f_array_length_t j = i + 1; j < data->depths.used; ++j) {
- if (fss_extended_read_signal_received(main)) {
- return F_status_set_error(F_interrupt);
+ if (!((++signal_check) % fss_extended_read_signal_check_d)) {
+ if (fss_extended_read_signal_received(main)) {
+ return F_status_set_error(F_interrupt);
+ }
+
+ signal_check = 0;
}
if (data->depths.array[i].depth == data->depths.array[j].depth) {
if (main->parameters[fss_extended_write_parameter_partial].result == f_console_result_found) {
if (main->parameters[fss_extended_write_parameter_object].result == f_console_result_additional) {
contents.used = 0;
+ uint16_t signal_check = 0;
for (f_array_length_t i = 0; i < main->parameters[fss_extended_write_parameter_object].values.used; ++i) {
- if (fss_extended_write_signal_received(main)) {
- status = F_status_set_error(F_interrupt);
- break;
+ if (!((++signal_check) % fss_extended_write_signal_check_d)) {
+ if (fss_extended_write_signal_received(main)) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+
+ signal_check = 0;
}
object.string = arguments->argv[main->parameters[fss_extended_write_parameter_object].values.array[i]];
f_array_length_t object_next = 0;
f_array_length_t content_current = 0;
- for (; i < main->parameters[fss_extended_write_parameter_object].values.used; ++i) {
+ for (uint16_t signal_check = 0; i < main->parameters[fss_extended_write_parameter_object].values.used; ++i) {
- if (fss_extended_write_signal_received(main)) {
- status = F_status_set_error(F_interrupt);
- break;
+ if (!((++signal_check) % fss_extended_write_signal_check_d)) {
+ if (fss_extended_write_signal_received(main)) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+
+ signal_check = 0;
}
object_current = main->parameters[fss_extended_write_parameter_object].locations.array[i];
#endif // _di_fss_extended_write_program_name_
#ifndef _di_fss_extended_write_defines_
+ #define fss_extended_write_signal_check_d 10000
+
#define fss_extended_write_pipe_content_end_s '\f'
#define fss_extended_write_pipe_content_ignore_s '\v'
#define fss_extended_write_pipe_content_start_s '\b'
// 0x0 = start new object/content set, 0x1 = processing object, 0x2 = new individual content, 0x3 = processing content, 0x4 = end object/content set.
uint8_t state = 0;
- for (;;) {
+ for (uint16_t signal_check = 0; ; ) {
- if (fss_extended_write_signal_received(main)) {
- return F_status_set_error(F_interrupt);
+ if (!((++signal_check) % fss_extended_write_signal_check_d)) {
+ if (fss_extended_write_signal_received(main)) {
+ return F_status_set_error(F_interrupt);
+ }
+
+ signal_check = 0;
}
if (range.start > range.stop) {
}
if (F_status_is_error_not(status)) {
+ uint16_t signal_check = 0;
for (f_array_length_t i = 0; i < main->remaining.used; ++i) {
- if (fss_identify_signal_received(main)) {
- status = F_status_set_error(F_interrupt);
- break;
+ if (!((++signal_check) % fss_identify_signal_check_d)) {
+ if (fss_identify_signal_received(main)) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+
+ signal_check = 0;
}
if (main->parameters[fss_identify_parameter_line].result == f_console_result_additional) {
#endif // _di_fss_identify_program_name_
#ifndef _di_fss_identify_defines_
+ #define fss_identify_signal_check_d 10000
+
#define fss_identify_short_content_s "c"
#define fss_identify_short_line_s "l"
#define fss_identify_short_name_s "n"
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 status = F_none;
+ uint16_t signal_check = 0;
buffer->used = 0;
range->stop = 0;
do {
- if (fss_identify_signal_received(main)) {
- status = F_status_set_error(F_interrupt);
- break;
+ if (!((++signal_check) % fss_identify_signal_check_d)) {
+ if (fss_identify_signal_received(main)) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+
+ signal_check = 0;
}
if (buffer->used + file.size_read > buffer->size) {
}
if (main->remaining.used > 0) {
+ uint16_t signal_check = 0;
+
flockfile(main->output.to.stream);
for (f_array_length_t i = 0; i < main->remaining.used; ++i) {
- if (fss_status_code_signal_received(main)) {
- status = F_status_set_error(F_interrupt);
- break;
+ if (!((++signal_check) % fss_status_code_signal_check_d)) {
+ if (fss_status_code_signal_received(main)) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+
+ signal_check = 0;
}
status2 = fss_status_code_process_check(main, arguments->argv[main->remaining.array[i]]);
}
if (main->remaining.used > 0) {
+ uint16_t signal_check = 0;
+
flockfile(main->output.to.stream);
for (f_array_length_t i = 0; i < main->remaining.used; ++i) {
- if (fss_status_code_signal_received(main)) {
- status = F_status_set_error(F_interrupt);
- break;
+ if (!((++signal_check) % fss_status_code_signal_check_d)) {
+ if (fss_status_code_signal_received(main)) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+
+ signal_check = 0;
}
status2 = fss_status_code_process_number(main, arguments->argv[main->remaining.array[i]]);
}
if (main->remaining.used > 0) {
+ uint16_t signal_check = 0;
+
flockfile(main->output.to.stream);
for (f_array_length_t i = 0; i < main->remaining.used; ++i) {
- if (fss_status_code_signal_received(main)) {
- status = F_status_set_error(F_interrupt);
- break;
+ if (!((++signal_check) % fss_status_code_signal_check_d)) {
+ if (fss_status_code_signal_received(main)) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+
+ signal_check = 0;
}
status2 = fss_status_code_process_normal(main, arguments->argv[main->remaining.array[i]]);
#endif // _di_fss_status_code_program_name_
#ifndef _di_fss_status_code_defines_
+ #define fss_status_code_signal_check_d 10000
+
#define fss_status_code_short_is_fine_s "f"
#define fss_status_code_short_is_warning_s "w"
#define fss_status_code_short_is_error_s "e"
f_array_length_t total = 0;
f_file_t file = f_file_t_initialize;
- for (; i < main->remaining.used; ++i) {
+ for (uint16_t signal_check = 0; i < main->remaining.used; ++i) {
- if (iki_read_signal_received(main)) {
- status = F_status_set_error(F_interrupt);
- break;
+ if (!((++signal_check) % iki_read_signal_check_d)) {
+ if (iki_read_signal_received(main)) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+
+ signal_check = 0;
}
macro_f_file_t_reset(file);
#endif // _di_iki_read_program_name_
#ifndef _di_iki_read_defines_
+ #define iki_read_signal_check_d 10000
+
enum {
iki_read_mode_content = 1,
iki_read_mode_literal,
range.start = 0;
- for (; i < main->parameters[iki_read_parameter_name].values.used; ++i) {
+ for (uint16_t signal_check = 0; i < main->parameters[iki_read_parameter_name].values.used; ++i) {
- if (iki_read_signal_received(main)) {
- macro_f_string_dynamic_t_delete_simple(name);
+ if (!((++signal_check) % iki_read_signal_check_d)) {
+ if (iki_read_signal_received(main)) {
+ macro_f_string_dynamic_t_delete_simple(name);
+
+ return F_status_set_error(F_interrupt);
+ }
- return F_status_set_error(F_interrupt);
+ signal_check = 0;
}
index = main->parameters[iki_read_parameter_name].values.array[i];
f_array_length_t previous = 0;
f_string_range_t range = f_string_range_t_initialize;
+ uint16_t signal_check = 0;
range.start = 0;
for (f_status_t status_pipe = F_none; ; ) {
- if (iki_write_signal_received(main)) {
- status = F_status_set_error(F_interrupt);
- break;
+ if (!((++signal_check) % iki_write_signal_check_d)) {
+ if (iki_write_signal_received(main)) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+
+ signal_check = 0;
}
if (status_pipe != F_none_eof) {
if (F_status_is_error_not(status)) {
f_string_static_t object = f_string_static_t_initialize;
f_string_static_t content = f_string_static_t_initialize;
+ uint16_t signal_check = 0;
for (f_array_length_t i = 0; i < main->parameters[iki_write_parameter_object].values.used; ++i) {
- if (iki_write_signal_received(main)) {
- status = F_status_set_error(F_interrupt);
- break;
+ if (!((++signal_check) % iki_write_signal_check_d)) {
+ if (iki_write_signal_received(main)) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+
+ signal_check = 0;
}
object.string = arguments->argv[main->parameters[iki_write_parameter_object].values.array[i]];
#endif // _di_iki_write_program_name_
#ifndef _di_iki_write_defines_
+ #define iki_write_signal_check_d 10000
+
#define iki_write_short_file_s "f"
#define iki_write_short_content_s "c"
#define iki_write_short_double_s "d"
}
if (main->remaining.used > 0) {
+ uint16_t signal_check = 0;
+
flockfile(main->output.to.stream);
for (f_array_length_t i = 0; i < main->remaining.used; ++i) {
- if (status_code_signal_received(main)) {
- status = F_status_set_error(F_signal);
- break;
+ if (!((++signal_check) % status_code_signal_check_d)) {
+ if (status_code_signal_received(main)) {
+ status = F_status_set_error(F_signal);
+ break;
+ }
+
+ signal_check = 0;
}
status2 = status_code_process_check(main, arguments->argv[main->remaining.array[i]]);
}
if (main->remaining.used > 0) {
+ uint16_t signal_check = 0;
+
flockfile(main->output.to.stream);
for (f_array_length_t i = 0; i < main->remaining.used; ++i) {
- if (status_code_signal_received(main)) {
- status = F_status_set_error(F_signal);
- break;
+ if (!((++signal_check) % status_code_signal_check_d)) {
+ if (status_code_signal_received(main)) {
+ status = F_status_set_error(F_signal);
+ break;
+ }
+
+ signal_check = 0;
}
status2 = status_code_process_number(main, arguments->argv[main->remaining.array[i]]);
}
if (main->remaining.used > 0) {
+ uint16_t signal_check = 0;
+
flockfile(main->output.to.stream);
for (f_array_length_t i = 0; i < main->remaining.used; ++i) {
- if (status_code_signal_received(main)) {
- status = F_status_set_error(F_signal);
- break;
+ if (!((++signal_check) % status_code_signal_check_d)) {
+ if (status_code_signal_received(main)) {
+ status = F_status_set_error(F_signal);
+ break;
+ }
+
+ signal_check = 0;
}
status2 = status_code_process_normal(main, arguments->argv[main->remaining.array[i]]);
#endif // _di_status_code_program_name_
#ifndef _di_status_code_defines_
+ #define status_code_signal_check_d 10000
+
#define status_code_short_is_fine_s "f"
#define status_code_short_is_warning_s "w"
#define status_code_short_is_error_s "e"
flockfile(data->file.stream);
- while (*character.string && F_status_is_error_not(status)) {
+ for (uint16_t signal_check = 0; *character.string && F_status_is_error_not(status); ) {
- status = utf8_signal_received(data);
+ if (!((++signal_check) % utf8_signal_check_d)) {
+ if (utf8_signal_received(data)) {
+ utf8_print_signal_received(data, status);
- if (status) {
- utf8_print_signal_received(data, status);
-
- status = F_status_set_error(F_signal);
- break;
- }
- else {
- status = F_none;
+ status = F_status_set_error(F_signal);
+ break;
+ }
}
+ status = F_none;
character.used = macro_f_utf_byte_width(*character.string);
// Re-adjust used if buffer ended before the character is supposed to end.
if (status == F_utf) {
valid = F_false;
}
- } // while
+ } // for
if (F_status_is_error_not(status) && !(data->mode & utf8_mode_from_binary_d)) {
if (mode_codepoint != utf8_codepoint_mode_ready && mode_codepoint != utf8_codepoint_mode_end && mode_codepoint != utf8_codepoint_mode_bad_end) {
bool valid = F_true;
bool next = F_true;
uint8_t mode_codepoint = utf8_codepoint_mode_ready;
+ uint16_t signal_check = 0;
f_array_length_t i = 0;
f_array_length_t j = 0;
for (i = 0; F_status_is_fine(status) && i < data->buffer.used; ) {
- status = utf8_signal_received(data);
+ if (!((++signal_check) % utf8_signal_check_d)) {
+ if (utf8_signal_received(data)) {
+ utf8_print_signal_received(data, status);
- if (status) {
- utf8_print_signal_received(data, status);
-
- status = F_status_set_error(F_signal);
- break;
- }
- else {
- status = F_none;
+ status = F_status_set_error(F_signal);
+ break;
+ }
}
+ status = F_none;
+
// Get the current width only when processing a new block.
if (next) {
character.used = macro_f_utf_byte_width(data->buffer.string[i]);
f_status_t status = F_none;
bool valid = F_true;
bool next = F_true;
+ uint16_t signal_check = 0;
f_array_length_t i = 0;
f_array_length_t j = 0;
for (i = 0; F_status_is_fine(status) && i < data->buffer.used; ) {
- status = utf8_signal_received(data);
+ if (!((++signal_check) % utf8_signal_check_d)) {
+ if (utf8_signal_received(data)) {
+ utf8_print_signal_received(data, status);
- if (status) {
- utf8_print_signal_received(data, status);
-
- status = F_status_set_error(F_signal);
- break;
- }
- else {
- status = F_none;
+ status = F_status_set_error(F_signal);
+ break;
+ }
}
+ status = F_none;
+
// Get the current width only when processing a new block.
if (next) {
character.used = macro_f_utf_byte_width(data->buffer.string[i]);
f_file_t file = macro_f_file_t_initialize(0, -1, F_file_flag_read_only_d, 32768, F_file_default_write_size_d);
- for (; i < main->parameters[utf8_parameter_from_file].values.used && status != F_signal; ++i) {
+ for (uint16_t signal_check = 0; i < main->parameters[utf8_parameter_from_file].values.used && status != F_signal; ++i) {
- if (utf8_signal_received(&data)) {
- status = F_status_set_error(F_signal);
- break;
+ if (!((++signal_check) % utf8_signal_check_d)) {
+ if (utf8_signal_received(&data)) {
+ status = F_status_set_error(F_signal);
+ break;
+ }
+
+ signal_check = 0;
}
index = main->parameters[utf8_parameter_from_file].values.array[i];
f_array_length_t i = 0;
f_array_length_t index = 0;
- for (; F_status_is_error_not(status) && i < main->remaining.used; ++i) {
+ for (uint16_t signal_check = 0; F_status_is_error_not(status) && i < main->remaining.used; ++i) {
- if (utf8_signal_received(&data)) {
- status = F_status_set_error(F_signal);
- break;
+ if (!((++signal_check) % utf8_signal_check_d)) {
+ if (utf8_signal_received(&data)) {
+ status = F_status_set_error(F_signal);
+ break;
+ }
+
+ signal_check = 0;
}
index = main->remaining.array[i];
#endif // _di_utf8_default_allocation_step_
#ifndef _di_utf8_defines_
+ #define utf8_signal_check_d 10000
+
#define utf8_string_from_s "from"
#define utf8_string_to_s "to"