I've noticed that when processing large files, the FSS programs cannot be interrupted using controlled interrupts rather than the standard interrupt signals.
The POSIX standard structure of interrupts, particularly in threads, is very poorly defined.
When a threaded program wishes to be triggered for an exit, the pthread_cancel() function works by immediately exiting the program rather than aborting.
This prevents proper deallocated and shutting down of programs, particularly those that handle interrupts.
This introduces a new f_state_t structure that allows passing a generalized state around that accepts (void *) arguments so that it is not tied to any particular implementation beyond the basic structure.
The FLL/FSS and IKI processing functions then take advantage of this and utilize the state.
There are performance concerns with this, but the need to have controlled interrupts is deemed far more important.
Furthermore, the generic function is open ended so that the caller can potentially implement some sort of optimization.
Now that an f_state_t structure exists I am finally compelled to move the allocation step functionality into this structure.
This will allow for more performance improvements (such as determining allocation step according to file size).
For large files (megabytes, gigabytes, etc..) the allocation step can be set to something large, such as 16384.
Doing so should reduce the amount of memory I/O needed for resize operations.
I have opted to use uint16_t, so there is a max step of 64k at this time.
This entire process needs additional reviewing before releasing.
I designed this with the intent to move the function parameters into the (void *) data property on the f_state_t structure.
This will allow for reducing the parameters passed.
This design will also allow for me to later on add additional state information that can be passed to the caller.
This also allows for better or more granular error handling and reporting.
More work is needed in this regard because many of the functions currently written need to utilize this (such as the recursive directory functions).
This focuses on the most basic utilization in the programs but I would like to perform file size tests so that I can at least have a very basic heuristic for determining the default allocation size for large (or small) files.
A new project fl_signal is provided with a basic interrupt callback for f_state_t as I believe a dirt simple callback will be commonly used.
The default allocation step is now broken up into large and small allocation steps.
build_sources_library account.c private-account.c capability.c color.c color-common.c console.c console-common.c control_group.c control_group-common.c conversion.c directory.c private-directory.c environment.c private-environment.c file.c file-common.c private-file.c fss.c private-fss.c fss_named.c fss_nest.c fss_set.c iki.c iki-common.c private-iki.c limit.c memory.c memory_structure.c private-memory.c path.c path-common.c private-path.c pipe.c print.c private-print.c serialize.c serialize-common.c private-serialize.c signal.c socket.c string.c string-common.c private-string.c string_dynamic.c string_map.c string_quantity.c string_range.c string_triple.c type_array.c private-type_array.c utf.c utf-common.c private-utf.c utf_dynamic.c utf_map.c utf_quantity.c utf_range.c utf_triple.c
build_sources_library-level thread.c private-thread.c
build_sources_program
-build_sources_headers account.h account-common.h capability.h capability-common.h color.h color-common.h console.h console-common.h control_group.h control_group-common.h conversion.h conversion-common.h directory.h directory_type.h directory-common.h environment.h environment-common.h execute.h execute-common.h file.h file-common.h fss.h private-fss.h fss-common.h fss_comment.h fss_delimit.h fss_named.h fss_nest.h fss_quote.h fss_set.h iki.h iki-common.h limit.h limit-common.h memory.h memory_structure.h memory-common.h path.h path-common.h pipe.h print.h serialize.h serialize-common.h signal.h signal-common.h socket.h socket-common.h status.h status_array.h string.h string-common.h private-string.h string_dynamic.h string_map.h string_quantity.h string_range.h string_triple.h type.h type_array.h private-type_array.h type_array-common.h utf.h utf-common.h utf_dynamic.h utf_map.h utf_quantity.h utf_range.h utf_triple.h
+build_sources_headers account.h account-common.h capability.h capability-common.h color.h color-common.h console.h console-common.h control_group.h control_group-common.h conversion.h conversion-common.h directory.h directory_type.h directory-common.h environment.h environment-common.h execute.h execute-common.h file.h file-common.h fss.h private-fss.h fss-common.h fss_comment.h fss_delimit.h fss_named.h fss_nest.h fss_quote.h fss_set.h iki.h iki-common.h limit.h limit-common.h memory.h memory_structure.h memory-common.h path.h path-common.h pipe.h print.h serialize.h serialize-common.h signal.h signal-common.h socket.h socket-common.h status.h string.h string-common.h private-string.h string_dynamic.h string_map.h string_quantity.h string_range.h string_triple.h type.h type_array.h private-type_array.h type_array-common.h utf.h utf-common.h utf_dynamic.h utf_map.h utf_quantity.h utf_range.h utf_triple.h
build_sources_headers-level thread.h thread-common.h
build_sources_script
build_sources_setting
build_libraries -lc -lcap
build_libraries-level -lfll_0
build_libraries-level_threadless -lfll_0
-build_sources_library console.c control_group.c conversion.c directory.c private-directory.c environment.c private-fss.c fss_basic.c fss_basic_list.c fss_embedded_list.c fss_extended.c fss_extended_list.c iki.c print.c private-print.c status.c string.c private-string.c utf.c private-utf.c utf_file.c private-utf_file.c
+build_sources_library console.c control_group.c conversion.c directory.c private-directory.c environment.c private-fss.c fss_basic.c fss_basic_list.c fss_embedded_list.c fss_extended.c fss_extended_list.c iki.c print.c private-print.c signal.c status.c string.c private-string.c utf.c private-utf.c utf_file.c private-utf_file.c
build_sources_library-level
build_sources_program
-build_sources_headers console.h control_group.h conversion.h directory.h environment.h execute.h execute-common.h fss.h fss_basic.h fss_basic_list.h fss_embedded_list.h fss_extended.h fss_extended_list.h fss_status.h iki.h print.h status.h string.h utf.h utf_file.h
+build_sources_headers console.h control_group.h conversion.h directory.h environment.h execute.h execute-common.h fss.h fss_basic.h fss_basic_list.h fss_embedded_list.h fss_extended.h fss_extended_list.h fss_status.h iki.h print.h signal.h signal-common.h status.h string.h utf.h utf_file.h
build_sources_headers-level
build_sources_script
build_sources_setting
build_libraries -lc -lcap
build_libraries-monolithic
build_libraries-monolithic_threadless
-build_sources_library level_0/account.c level_0/private-account.c level_0/capability.c level_0/color.c level_0/color-common.c level_0/console.c level_0/console-common.c level_0/control_group.c level_0/control_group-common.c level_0/conversion.c level_0/directory.c level_0/private-directory.c level_0/environment.c level_0/private-environment.c level_0/file.c level_0/file-common.c level_0/private-file.c level_0/fss.c level_0/private-fss.c level_0/fss_named.c level_0/fss_nest.c level_0/fss_set.c level_0/iki.c level_0/iki-common.c level_0/private-iki.c level_0/limit.c level_0/memory.c level_0/memory_structure.c level_0/private-memory.c level_0/path.c level_0/path-common.c level_0/private-path.c level_0/pipe.c level_0/print.c level_0/private-print.c level_0/serialize.c level_0/serialize-common.c level_0/private-serialize.c level_0/signal.c level_0/socket.c level_0/string.c level_0/string-common.c level_0/private-string.c level_0/string_dynamic.c level_0/string_map.c level_0/string_quantity.c level_0/string_range.c level_0/string_triple.c level_0/type_array.c level_0/private-type_array.c level_0/utf.c level_0/utf-common.c level_0/private-utf.c level_0/utf_dynamic.c level_0/utf_map.c level_0/utf_quantity.c level_0/utf_range.c level_0/utf_triple.c level_1/console.c level_1/control_group.c level_1/conversion.c level_1/directory.c level_1/private-directory.c level_1/environment.c level_1/private-fss.c level_1/fss_basic.c level_1/fss_basic_list.c level_1/fss_embedded_list.c level_1/fss_extended.c level_1/fss_extended_list.c level_1/iki.c level_1/print.c level_1/private-print.c level_1/status.c level_1/string.c level_1/private-string.c level_1/utf.c level_1/private-utf.c level_1/utf_file.c level_1/private-utf_file.c level_2/control_group.c level_2/error.c level_2/error-common.c level_2/private-error.c level_2/execute.c level_2/private-execute.c level_2/file.c level_2/private-file.c level_2/fss.c level_2/private-fss.c level_2/fss_basic.c level_2/fss_basic_list.c level_2/fss_embedded_list.c level_2/fss_extended.c level_2/fss_extended_list.c level_2/fss_status.c level_2/iki.c level_2/private-iki.c level_2/path.c level_2/program.c level_2/status.c
+build_sources_library level_0/account.c level_0/private-account.c level_0/capability.c level_0/color.c level_0/color-common.c level_0/console.c level_0/console-common.c level_0/control_group.c level_0/control_group-common.c level_0/conversion.c level_0/directory.c level_0/private-directory.c level_0/environment.c level_0/private-environment.c level_0/file.c level_0/file-common.c level_0/private-file.c level_0/fss.c level_0/private-fss.c level_0/fss_named.c level_0/fss_nest.c level_0/fss_set.c level_0/iki.c level_0/iki-common.c level_0/private-iki.c level_0/limit.c level_0/memory.c level_0/memory_structure.c level_0/private-memory.c level_0/path.c level_0/path-common.c level_0/private-path.c level_0/pipe.c level_0/print.c level_0/private-print.c level_0/serialize.c level_0/serialize-common.c level_0/private-serialize.c level_0/signal.c level_0/socket.c level_0/string.c level_0/string-common.c level_0/private-string.c level_0/string_dynamic.c level_0/string_map.c level_0/string_quantity.c level_0/string_range.c level_0/string_triple.c level_0/type_array.c level_0/private-type_array.c level_0/utf.c level_0/utf-common.c level_0/private-utf.c level_0/utf_dynamic.c level_0/utf_map.c level_0/utf_quantity.c level_0/utf_range.c level_0/utf_triple.c level_1/console.c level_1/control_group.c level_1/conversion.c level_1/directory.c level_1/private-directory.c level_1/environment.c level_1/private-fss.c level_1/fss_basic.c level_1/fss_basic_list.c level_1/fss_embedded_list.c level_1/fss_extended.c level_1/fss_extended_list.c level_1/iki.c level_1/print.c level_1/private-print.c level_1/signal.c level_1/status.c level_1/string.c level_1/private-string.c level_1/utf.c level_1/private-utf.c level_1/utf_file.c level_1/private-utf_file.c level_2/control_group.c level_2/error.c level_2/error-common.c level_2/private-error.c level_2/execute.c level_2/private-execute.c level_2/file.c level_2/private-file.c level_2/fss.c level_2/private-fss.c level_2/fss_basic.c level_2/fss_basic_list.c level_2/fss_embedded_list.c level_2/fss_extended.c level_2/fss_extended_list.c level_2/fss_status.c level_2/iki.c level_2/private-iki.c level_2/path.c level_2/program.c level_2/status.c
build_sources_library-monolithic level_0/thread.c level_0/private-thread.c
build_sources_program
-build_sources_headers level_0/account.h level_0/account-common.h level_0/capability.h level_0/capability-common.h level_0/color.h level_0/color-common.h level_0/console.h level_0/console-common.h level_0/control_group.h level_0/control_group-common.h level_0/conversion.h level_0/conversion-common.h level_0/directory.h level_0/directory_type.h level_0/directory-common.h level_0/environment.h level_0/environment-common.h level_0/execute.h level_0/execute-common.h level_0/file.h level_0/file-common.h level_0/fss.h level_0/private-fss.h level_0/fss-common.h level_0/fss_comment.h level_0/fss_delimit.h level_0/fss_named.h level_0/fss_nest.h level_0/fss_quote.h level_0/fss_set.h level_0/iki.h level_0/iki-common.h level_0/limit.h level_0/limit-common.h level_0/memory.h level_0/memory_structure.h level_0/memory-common.h level_0/path.h level_0/path-common.h level_0/pipe.h level_0/print.h level_0/serialize.h level_0/serialize-common.h level_0/signal.h level_0/signal-common.h level_0/socket.h level_0/socket-common.h level_0/status.h level_0/status_array.h level_0/string.h level_0/string-common.h level_0/private-string.h level_0/string_dynamic.h level_0/string_map.h level_0/string_quantity.h level_0/string_range.h level_0/string_triple.h level_0/type.h level_0/type_array.h level_0/private-type_array.h level_0/type_array-common.h level_0/utf.h level_0/utf-common.h level_0/utf_dynamic.h level_0/utf_map.h level_0/utf_quantity.h level_0/utf_range.h level_0/utf_triple.h level_1/console.h level_1/control_group.h level_1/conversion.h level_1/directory.h level_1/environment.h level_1/execute.h level_1/execute-common.h level_1/fss.h level_1/fss_basic.h level_1/fss_basic_list.h level_1/fss_embedded_list.h level_1/fss_extended.h level_1/fss_extended_list.h level_1/fss_status.h level_1/iki.h level_1/print.h level_1/status.h level_1/string.h level_1/utf.h level_1/utf_file.h level_2/control_group.h level_2/error.h level_2/error-common.h level_2/execute.h level_2/file.h level_2/fss.h level_2/fss_basic.h level_2/fss_basic_list.h level_2/fss_embedded_list.h level_2/fss_extended.h level_2/fss_extended_list.h level_2/fss_status.h level_2/iki.h level_2/path.h level_2/program.h level_2/status.h
+build_sources_headers level_0/account.h level_0/account-common.h level_0/capability.h level_0/capability-common.h level_0/color.h level_0/color-common.h level_0/console.h level_0/console-common.h level_0/control_group.h level_0/control_group-common.h level_0/conversion.h level_0/conversion-common.h level_0/directory.h level_0/directory_type.h level_0/directory-common.h level_0/environment.h level_0/environment-common.h level_0/execute.h level_0/execute-common.h level_0/file.h level_0/file-common.h level_0/fss.h level_0/private-fss.h level_0/fss-common.h level_0/fss_comment.h level_0/fss_delimit.h level_0/fss_named.h level_0/fss_nest.h level_0/fss_quote.h level_0/fss_set.h level_0/iki.h level_0/iki-common.h level_0/limit.h level_0/limit-common.h level_0/memory.h level_0/memory_structure.h level_0/memory-common.h level_0/path.h level_0/path-common.h level_0/pipe.h level_0/print.h level_0/serialize.h level_0/serialize-common.h level_0/signal.h level_0/signal-common.h level_0/socket.h level_0/socket-common.h level_0/status.h level_0/string.h level_0/string-common.h level_0/private-string.h level_0/string_dynamic.h level_0/string_map.h level_0/string_quantity.h level_0/string_range.h level_0/string_triple.h level_0/type.h level_0/type_array.h level_0/private-type_array.h level_0/type_array-common.h level_0/utf.h level_0/utf-common.h level_0/utf_dynamic.h level_0/utf_map.h level_0/utf_quantity.h level_0/utf_range.h level_0/utf_triple.h level_1/console.h level_1/control_group.h level_1/conversion.h level_1/directory.h level_1/environment.h level_1/execute.h level_1/execute-common.h level_1/fss.h level_1/fss_basic.h level_1/fss_basic_list.h level_1/fss_embedded_list.h level_1/fss_extended.h level_1/fss_extended_list.h level_1/fss_status.h level_1/iki.h level_1/print.h level_1/signal.h level_1/signal-common.h level_1/status.h level_1/string.h level_1/utf.h level_1/utf_file.h level_2/control_group.h level_2/error.h level_2/error-common.h level_2/execute.h level_2/file.h level_2/fss.h level_2/fss_basic.h level_2/fss_basic_list.h level_2/fss_embedded_list.h level_2/fss_extended.h level_2/fss_extended_list.h level_2/fss_status.h level_2/iki.h level_2/path.h level_2/program.h level_2/status.h
build_sources_headers-monolithic level_0/thread.h level_0/thread-common.h
build_sources_script
build_sources_setting
bash build/scripts/package.sh $verbose $color build -i
if [[ $? -eq 0 ]] ; then
- for i in f_type f_status f_memory f_type_array f_string f_utf f_account f_capability f_color f_console f_control_group f_conversion f_directory f_environment f_execute f_file f_fss f_iki f_limit f_path f_pipe f_print f_serialize f_signal f_socket f_thread fl_console fl_control_group fl_conversion fl_directory fl_environment fl_execute fl_fss fl_iki fl_print fl_status fl_string fl_utf fl_utf_file fll_control_group fll_error fll_execute fll_file fll_fss fll_iki fll_path fll_program fll_status ; do
+ for i in f_type f_status f_memory f_type_array f_string f_utf f_account f_capability f_color f_console f_control_group f_conversion f_directory f_environment f_execute f_file f_fss f_iki f_limit f_path f_pipe f_print f_serialize f_signal f_socket f_thread fl_console fl_control_group fl_conversion fl_directory fl_environment fl_execute fl_fss fl_iki fl_print fl_signal fl_status fl_string fl_utf fl_utf_file fll_control_group fll_error fll_execute fll_file fll_fss fll_iki fll_path fll_program fll_status ; do
echo && echo "Processing $i." &&
cd package/individual/$i-$2/ &&
#define macro_f_string_accounts_t_delete_simple(accounts) macro_f_memory_structure_delete_simple(values, sizeof(f_account_t), 0)
#define macro_f_string_accounts_t_destroy_simple(accounts) macro_f_memory_structure_destroy_simple(values, sizeof(f_account_t), 0)
- #define macro_f_string_accounts_t_increase(status, values) macro_f_memory_structure_increase(status, values, f_account_t)
+ #define macro_f_string_accounts_t_increase(status, step, values) macro_f_memory_structure_increase(status, step, values, f_account_t)
#define macro_f_string_accounts_t_increase_by(status, values, amount) macro_f_memory_structure_increase_by(status, values, f_account_t, amount)
#define macro_f_string_accounts_t_decrease_by(status, values, amount) macro_f_memory_structure_decrease_by(status, values, f_account_t, amount)
#define macro_f_string_accounts_t_decimate_by(status, values, amount) macro_f_memory_structure_decimate_by(status, values, f_account_t, amount)
if (needs_value.used > 0) {
i = needs_value.array[0];
- macro_f_array_lengths_t_increase(status, parameters.parameter[i].values)
+ macro_f_array_lengths_t_increase(status, f_memory_default_allocation_small, parameters.parameter[i].values)
if (F_status_is_error(status)) {
macro_f_array_lengths_t_delete_simple(needs_value);
continue;
}
- macro_f_array_lengths_t_increase(status, parameters.parameter[i].locations)
+ macro_f_array_lengths_t_increase(status, f_memory_default_allocation_small, parameters.parameter[i].locations)
if (F_status_is_error(status)) {
macro_f_array_lengths_t_delete_simple(needs_value);
return status;
}
- macro_f_array_lengths_t_increase(status, parameters.parameter[i].locations_sub)
+ macro_f_array_lengths_t_increase(status, f_memory_default_allocation_small, parameters.parameter[i].locations_sub)
if (F_status_is_error(status)) {
macro_f_array_lengths_t_delete_simple(needs_value);
if (strncmp(arguments.argv[location], parameters.parameter[i].symbol_other, argument_length + 1) != 0) continue;
- macro_f_array_lengths_t_increase(status, parameters.parameter[i].locations)
+ macro_f_array_lengths_t_increase(status, f_memory_default_allocation_small, parameters.parameter[i].locations)
if (F_status_is_error(status)) {
macro_f_array_lengths_t_delete_simple(needs_value);
return status;
}
- macro_f_array_lengths_t_increase(status, parameters.parameter[i].locations_sub)
+ macro_f_array_lengths_t_increase(status, f_memory_default_allocation_small, parameters.parameter[i].locations_sub)
if (F_status_is_error(status)) {
macro_f_array_lengths_t_delete_simple(needs_value);
// populate list of remaining parameters.parameter not associated with anything.
if (remaining->used == remaining->size) {
- macro_f_memory_structure_increment(status, (*remaining), 1, f_memory_default_allocation_step, macro_f_array_lengths_t_resize, F_array_too_large);
+ macro_f_memory_structure_increment(status, (*remaining), 1, f_memory_default_allocation_small, macro_f_array_lengths_t_resize, F_array_too_large);
if (F_status_is_error(status)) {
macro_f_array_lengths_t_delete_simple(needs_value);
return status;
* This is generally used for nftw() recursive operations to reduce the number of open file descriptors during recursion.
*/
#ifndef _di_f_directory_limitations_
- #define f_directory_default_allocation_step f_memory_default_allocation_step
+ #define f_directory_default_allocation_step f_memory_default_allocation_small
#define f_directory_descriptors_max 255
#define f_directory_name_max NAME_MAX
*
* The allocation macros apply to the path.
*
+ * step: The allocation step.
* status: The status code.
* path: The dynamically allocated path associated with the status code.
*/
#define macro_f_directory_status_t_delete_simple(statuses) macro_f_string_dynamic_t_delete_simple(statuses.path)
#define macro_f_directory_status_t_destroy_simple(statuses) macro_f_string_dynamic_t_destroy_simple(statuses.path)
- #define macro_f_directory_status_t_increase(status, values) macro_f_string_dynamic_t_increase(status, values)
+ #define macro_f_directory_status_t_increase(status, step, values) macro_f_string_dynamic_t_increase(status, step, values)
#define macro_f_directory_status_t_increase_by(status, values, amount) macro_f_string_dynamic_t_increase_by(status, values, amount)
#define macro_f_directory_status_t_decrease_by(status, values, amount) macro_f_string_dynamic_t_decrease_by(status, values, amount)
#define macro_f_directory_status_t_decimate_by(status, values, amount) macro_f_string_dynamic_t_decimate_by(status, values, amount)
* Recommended to be set to at least 4 to be UTF-8 friendlier.
*/
#ifndef _di_f_fss_default_allocation_step_
- #define f_fss_default_allocation_step f_memory_default_allocation_step
+ #define f_fss_default_allocation_step f_memory_default_allocation_small
#endif // _di_f_fss_default_allocation_step_
/**
#define macro_f_fss_headers_t_delete_simple(headers) macro_f_memory_structure_delete_simple(headers, f_fss_header_t)
#define macro_f_fss_headers_t_destroy_simple(headers) macro_f_memory_structure_destroy_simple(headers, f_fss_header_t)
- #define macro_f_fss_headers_t_increase(status, headers) macro_f_memory_structure_increase(status, headers, f_fss_header_t)
+ #define macro_f_fss_headers_t_increase(status, step, headers) macro_f_memory_structure_increase(status, step, headers, f_fss_header_t)
#define macro_f_fss_headers_t_increase_by(status, headers, amount) macro_f_memory_structure_increase_by(status, headers, f_fss_header_t, amount)
#define macro_f_fss_headers_t_decrease_by(status, headers, amount) macro_f_memory_structure_decrease_by(status, headers, f_fss_header_t, amount)
#define macro_f_fss_headers_t_decimate_by(status, headers, amount) macro_f_memory_structure_decimate_by(status, headers, f_fss_header_t, amount)
#define macro_f_fss_objects_t_delete_simple(objects) macro_f_string_ranges_t_delete_simple(objects)
#define macro_f_fss_objects_t_destroy_simple(objects) macro_f_string_ranges_t_destroy_simple(objects)
- #define macro_f_fss_objects_t_increase(status, objects) macro_f_string_ranges_t_increase(status, objects)
+ #define macro_f_fss_objects_t_increase(status, step, objects) macro_f_string_ranges_t_increase(status, step, objects)
#define macro_f_fss_objects_t_increase_by(status, objects, amount) macro_f_string_ranges_t_increase_by(status, objects, amount)
#define macro_f_fss_objects_t_decrease_by(status, objects, amount) macro_f_string_ranges_t_decrease_by(status, objects, amount)
#define macro_f_fss_objects_t_decimate_by(status, objects, amount) macro_f_string_ranges_t_decimate_by(status, objects, amount)
#define macro_f_fss_content_t_delete_simple(content) macro_f_string_ranges_t_delete_simple(content)
#define macro_f_fss_content_t_destroy_simple(content) macro_f_string_ranges_t_destroy_simple(content)
- #define macro_f_fss_content_t_increase(status, content) macro_f_string_ranges_t_increase(status, content)
+ #define macro_f_fss_content_t_increase(status, step, content) macro_f_string_ranges_t_increase(status, step, content)
#define macro_f_fss_content_t_increase_by(status, content, amount) macro_f_string_ranges_t_increase_by(status, content, amount)
#define macro_f_fss_content_t_decrease_by(status, content, amount) macro_f_string_ranges_t_decrease_by(status, content, amount)
#define macro_f_fss_content_t_decimate_by(status, content, amount) macro_f_string_ranges_t_decimate_by(status, content, amount)
#define macro_f_fss_contents_t_delete_simple(contents) macro_f_string_rangess_t_delete_simple(contents)
#define macro_f_fss_contents_t_destroy_simple(contents) macro_f_string_rangess_t_destroy_simple(contents)
- #define macro_f_fss_contents_t_increase(status, contents) macro_f_string_rangess_t_increase(status, contents)
+ #define macro_f_fss_contents_t_increase(status, step, contents) macro_f_string_rangess_t_increase(status, step, contents)
#define macro_f_fss_contents_t_increase_by(status, contents, amount) macro_f_string_rangess_t_increase_by(status, contents, amount)
#define macro_f_fss_contents_t_decrease_by(status, contents, amount) macro_f_string_rangess_t_decrease_by(status, contents, amount)
#define macro_f_fss_contents_t_decimate_by(status, contents, amount) macro_f_string_rangess_t_decimate_by(status, contents, amount)
#define macro_f_fss_comments_t_delete_simple(comments) macro_f_string_ranges_t_delete_simple(comments)
#define macro_f_fss_comments_t_destroy_simple(comments) macro_f_string_ranges_t_destroy_simple(comments)
- #define macro_f_fss_comments_t_increase(status, comments) macro_f_string_ranges_t_increase(status, comments)
+ #define macro_f_fss_comments_t_increase(status, step, comments) macro_f_string_ranges_t_increase(status, step, comments)
#define macro_f_fss_comments_t_increase_by(status, comments, amount) macro_f_string_ranges_t_increase_by(status, comments, amount)
#define macro_f_fss_comments_t_decrease_by(status, comments, amount) macro_f_string_ranges_t_decrease_by(status, comments, amount)
#define macro_f_fss_comments_t_decimate_by(status, comments, amount) macro_f_string_ranges_t_decimate_by(status, comments, amount)
#define macro_f_fss_commentss_t_delete_simple(commentss) macro_f_string_rangess_t_delete_simple(commentss)
#define macro_f_fss_commentss_t_destroy_simple(commentss) macro_f_string_rangess_t_destroy_simple(commentss)
- #define macro_f_fss_commentss_t_increase(status, commentss) macro_f_string_rangess_t_increase(status, commentss)
+ #define macro_f_fss_commentss_t_increase(status, step, commentss) macro_f_string_rangess_t_increase(status, step, commentss)
#define macro_f_fss_commentss_t_increase_by(status, commentss, amount) macro_f_string_rangess_t_increase_by(status, commentss, amount)
#define macro_f_fss_commentss_t_decrease_by(status, commentss, amount) macro_f_string_rangess_t_decrease_by(status, commentss, amount)
#define macro_f_fss_commentss_t_decimate_by(status, commentss, amount) macro_f_string_rangess_t_decimate_by(status, commentss, amount)
#define macro_f_fss_delimits_t_delete_simple(delimits) macro_f_array_lengths_t_delete_simple(delimits)
#define macro_f_fss_delimits_t_destroy_simple(delimits) macro_f_array_lengths_t_destroy_simple(delimits)
- #define macro_f_fss_delimits_t_increase(status, delimits) macro_f_array_lengths_t_increase(status, delimits)
+ #define macro_f_fss_delimits_t_increase(status, step, delimits) macro_f_array_lengths_t_increase(status, step, delimits)
#define macro_f_fss_delimits_t_increase_by(status, delimits, amount) macro_f_array_lengths_t_increase_by(status, delimits, amount)
#define macro_f_fss_delimits_t_decrease_by(status, delimits, amount) macro_f_array_lengths_t_decrease_by(status, delimits, amount)
#define macro_f_fss_delimits_t_decimate_by(status, delimits, amount) macro_f_array_lengths_t_decimate_by(status, delimits, amount)
#define macro_f_fss_delimitss_t_delete_simple(delimitss) macro_f_array_lengthss_t_delete_simple(delimitss)
#define macro_f_fss_delimitss_t_destroy_simple(delimitss) macro_f_array_lengthss_t_destroy_simple(delimitss)
- #define macro_f_fss_delimitss_t_increase(status, delimitss) macro_f_array_lengthss_t_increase(status, delimitss)
+ #define macro_f_fss_delimitss_t_increase(status, step, delimitss) macro_f_array_lengthss_t_increase(status, step, delimitss)
#define macro_f_fss_delimitss_t_increase_by(status, delimitss, amount) macro_f_array_lengthss_t_increase_by(status, delimitss, amount)
#define macro_f_fss_delimitss_t_decrease_by(status, delimitss, amount) macro_f_array_lengthss_t_decrease_by(status, delimitss, amount)
#define macro_f_fss_delimitss_t_decimate_by(status, delimitss, amount) macro_f_array_lengthss_t_decimate_by(status, delimitss, amount)
#endif // _di_f_fss_named_decrease_by_
#ifndef _di_f_fss_named_increase_
- f_status_t f_fss_named_increase(f_fss_named_t *named) {
+ f_status_t f_fss_named_increase(const uint16_t step, f_fss_named_t *named) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!named) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (named->objects.used + 1 > named->objects.size) {
- f_array_length_t size = named->objects.used + f_memory_default_allocation_step;
+ f_array_length_t size = named->objects.used + step;
if (size > f_array_length_t_size) {
if (named->objects.used + 1 > f_array_length_t_size) {
#endif // _di_f_fss_nameds_decrease_by_
#ifndef _di_f_fss_nameds_increase_
- f_status_t f_fss_nameds_increase(f_fss_nameds_t *nameds) {
+ f_status_t f_fss_nameds_increase(const uint16_t step, f_fss_nameds_t *nameds) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!nameds) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (nameds->used + 1 > nameds->size) {
- f_array_length_t size = nameds->used + f_memory_default_allocation_step;
+ f_array_length_t size = nameds->used + step;
if (size > f_array_length_t_size) {
if (nameds->used + 1 > f_array_length_t_size) {
#define macro_f_fss_named_t_delete_simple(named) f_fss_named_resize(0, &named);
#define macro_f_fss_named_t_destroy_simple(named) f_fss_named_adjust(0, &named);
- #define macro_f_fss_named_t_increase(status, named) status = f_fss_named_increase(&named);
+ #define macro_f_fss_named_t_increase(status, step, named) status = f_fss_named_increase(step, &named);
#define macro_f_fss_named_t_increase_by(status, named, amount) status = f_fss_named_increase_by(amount, &named);
#define macro_f_fss_named_t_decrease_by(status, named, amount) status = f_fss_named_decrease_by(amount, &named);
#define macro_f_fss_named_t_decimate_by(status, named, amount) status = f_fss_named_decimate_by(amount, &named);
#define macro_f_fss_nameds_t_delete_simple(nameds) f_fss_nameds_resize(0, &nameds);
#define macro_f_fss_nameds_t_destroy_simple(nameds) f_fss_nameds_adjust(0, &nameds);
- #define macro_f_fss_nameds_t_increase(status, nameds) status = f_fss_nameds_increase(&nameds);
+ #define macro_f_fss_nameds_t_increase(status, step, nameds) status = f_fss_nameds_increase(step, &nameds);
#define macro_f_fss_nameds_t_increase_by(status, nameds, amount) status = f_fss_nameds_increase_by(amount, &nameds);
#define macro_f_fss_nameds_t_decrease_by(status, nameds, amount) status = f_fss_nameds_decrease_by(amount, &nameds);
#define macro_f_fss_nameds_t_decimate_by(status, nameds, amount) status = f_fss_nameds_decimate_by(amount, &nameds);
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param named
* The named array to resize.
*
* F_parameter (with error bit) if a parameter is invalid.
*/
#ifndef _di_f_fss_named_increase_
- extern f_status_t f_fss_named_increase(f_fss_named_t *named);
+ extern f_status_t f_fss_named_increase(const uint16_t step, f_fss_named_t *named);
#endif // _di_f_fss_named_increase_
/**
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param nameds
* The nameds array to resize.
*
* F_parameter (with error bit) if a parameter is invalid.
*/
#ifndef _di_f_fss_nameds_increase_
- extern f_status_t f_fss_nameds_increase(f_fss_nameds_t *nameds);
+ extern f_status_t f_fss_nameds_increase(const uint16_t step, f_fss_nameds_t *nameds);
#endif // _di_f_fss_nameds_increase_
/**
#endif // _di_f_fss_items_decrease_by_
#ifndef _di_f_fss_items_increase_
- f_status_t f_fss_items_increase(f_fss_items_t *items) {
+ f_status_t f_fss_items_increase(const uint16_t step, f_fss_items_t *items) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!items) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (items->used + 1 > items->size) {
- f_array_length_t size = items->used + f_memory_default_allocation_step;
+ f_array_length_t size = items->used + step;
if (size > f_array_length_t_size) {
if (items->used + 1 > f_array_length_t_size) {
#endif // _di_f_fss_nest_decrease_by_
#ifndef _di_f_fss_nest_increase_
- f_status_t f_fss_nest_increase(f_fss_nest_t *nest) {
+ f_status_t f_fss_nest_increase(const uint16_t step, f_fss_nest_t *nest) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!nest) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (nest->used + 1 > nest->size) {
- f_array_length_t size = nest->used + f_memory_default_allocation_step;
+ f_array_length_t size = nest->used + step;
if (size > f_array_length_t_size) {
if (nest->used + 1 > f_array_length_t_size) {
#endif // _di_f_fss_nests_decrease_by_
#ifndef _di_f_fss_nests_increase_
- f_status_t f_fss_nests_increase(f_fss_nests_t *nests) {
+ f_status_t f_fss_nests_increase(const uint16_t step, f_fss_nests_t *nests) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!nests) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (nests->used + 1 > nests->size) {
- f_array_length_t size = nests->used + f_memory_default_allocation_step;
+ f_array_length_t size = nests->used + step;
if (size > f_array_length_t_size) {
if (nests->used + 1 > f_array_length_t_size) {
#define macro_f_fss_item_t_delete_simple(item) macro_f_fss_content_t_delete_simple(item.content)
#define macro_f_fss_item_t_destroy_simple(item) macro_f_fss_content_t_destroy_simple(item.content)
- #define macro_f_fss_item_t_increase(status, item) macro_f_fss_content_t_increase(status, item.content)
+ #define macro_f_fss_item_t_increase(status, step, item) macro_f_fss_content_t_increase(status, step, item.content)
#define macro_f_fss_item_t_increase_by(status, item, amount) macro_f_fss_content_t_increase_by(status, item.content, amount)
#define macro_f_fss_item_t_decrease_by(status, item, amount) macro_f_fss_content_t_decrease_by(status, item.content, amount)
#define macro_f_fss_item_t_decimate_by(status, item, amount) macro_f_fss_content_t_decimate_by(status, item.content, amount)
#define macro_f_fss_items_t_delete_simple(items) f_fss_items_resize(0, &items);
#define macro_f_fss_items_t_destroy_simple(items) f_fss_items_adjust(0, &items);
- #define macro_f_fss_items_t_increase(status, items) status = f_fss_items_increase(&items);
+ #define macro_f_fss_items_t_increase(status, step, items) status = f_fss_items_increase(step, &items);
#define macro_f_fss_items_t_increase_by(status, items, amount) status = f_fss_items_increase_by(amount, &items);
#define macro_f_fss_items_t_decrease_by(status, items, amount) status = f_fss_items_decrease_by(amount, &items);
#define macro_f_fss_items_t_decimate_by(status, items, amount) status = f_fss_items_decimate_by(amount, &items);
#define macro_f_fss_nest_t_delete_simple(nest) f_fss_nest_resize(0, &nest);
#define macro_f_fss_nest_t_destroy_simple(nest) f_fss_nest_adjust(0, &nest);
- #define macro_f_fss_nest_t_increase(status, nest) status = f_fss_nest_increase(&nest);
+ #define macro_f_fss_nest_t_increase(status, step, nest) status = f_fss_nest_increase(step, &nest);
#define macro_f_fss_nest_t_increase_by(status, nest, amount) status = f_fss_nest_increase_by(amount, &nest);
#define macro_f_fss_nest_t_decrease_by(status, nest, amount) status = f_fss_nest_decrease_by(amount, &nest);
#define macro_f_fss_nest_t_decimate_by(status, nest, amount) status = f_fss_nest_decimate_by(amount, &nest);
#define macro_f_fss_nests_t_delete_simple(nests) f_fss_nests_resize(0, &nests);
#define macro_f_fss_nests_t_destroy_simple(nests) f_fss_nests_adjust(0, &nests);
- #define macro_f_fss_nests_t_increase(status, nests) status = f_fss_nests_increase(&nests);
+ #define macro_f_fss_nests_t_increase(status, step, nests) status = f_fss_nests_increase(step, &nests);
#define macro_f_fss_nests_t_increase_by(status, nests, amount) status = f_fss_nests_increase_by(amount, &nests);
#define macro_f_fss_nests_t_decrease_by(status, nests, amount) status = f_fss_nests_decrease_by(amount, &nests);
#define macro_f_fss_nests_t_decimate_by(status, nests, amount) status = f_fss_nests_decimate_by(amount, &nests);
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param items
* The items array to resize.
*
* F_parameter (with error bit) if a parameter is invalid.
*/
#ifndef _di_f_fss_items_increase_
- extern f_status_t f_fss_items_increase(f_fss_items_t *items);
+ extern f_status_t f_fss_items_increase(const uint16_t step, f_fss_items_t *items);
#endif // _di_f_fss_items_increase_
/**
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param nest
* The nest array to resize.
*
* F_parameter (with error bit) if a parameter is invalid.
*/
#ifndef _di_f_fss_nest_increase_
- extern f_status_t f_fss_nest_increase(f_fss_nest_t *nest);
+ extern f_status_t f_fss_nest_increase(const uint16_t step, f_fss_nest_t *nest);
#endif // _di_f_fss_nest_increase_
/**
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param nests
* The nests array to resize.
*
* F_parameter (with error bit) if a parameter is invalid.
*/
#ifndef _di_f_fss_nests_increase_
- extern f_status_t f_fss_nests_increase(f_fss_nests_t *nests);
+ extern f_status_t f_fss_nests_increase(const uint16_t step, f_fss_nests_t *nests);
#endif // _di_f_fss_nests_increase_
/**
#define macro_f_fss_quotes_t_delete_simple(quotes) macro_f_uint8s_t_delete_simple(quotes)
#define macro_f_fss_quotes_t_destroy_simple(quotes) macro_f_uint8s_t_destroy_simple(quotes)
- #define macro_f_fss_quotes_t_increase(status, quotes) macro_f_uint8s_t_increase(status, quotes)
+ #define macro_f_fss_quotes_t_increase(status, step, quotes) macro_f_uint8s_t_increase(status, step, quotes)
#define macro_f_fss_quotes_t_increase_by(status, quotes, amount) macro_f_uint8s_t_increase_by(status, quotes, amount)
#define macro_f_fss_quotes_t_decrease_by(status, quotes, amount) macro_f_uint8s_t_decrease_by(status, quotes, amount)
#define macro_f_fss_quotes_t_decimate_by(status, quotes, amount) macro_f_uint8s_t_decimate_by(status, quotes, amount)
#define macro_f_fss_quotess_t_delete_simple(quotess) macro_f_uint8ss_t_delete_simple(quotess)
#define macro_f_fss_quotess_t_destroy_simple(quotess) macro_f_uint8ss_t_destroy_simple(quotess)
- #define macro_f_fss_quotess_t_increase(status, quotess) macro_f_uint8ss_t_increase(status, quotess)
+ #define macro_f_fss_quotess_t_increase(status, step, quotess) macro_f_uint8ss_t_increase(status, step, quotess)
#define macro_f_fss_quotess_t_increase_by(status, quotess, amount) macro_f_uint8ss_t_increase_by(status, quotess, amount)
#define macro_f_fss_quotess_t_decrease_by(status, quotess, amount) macro_f_uint8ss_t_decrease_by(status, quotess, amount)
#define macro_f_fss_quotess_t_decimate_by(status, quotess, amount) macro_f_uint8ss_t_decimate_by(status, quotess, amount)
#endif // _di_f_fss_set_decrease_by_
#ifndef _di_f_fss_set_increase_
- f_status_t f_fss_set_increase(f_fss_set_t *set) {
+ f_status_t f_fss_set_increase(const uint16_t step, f_fss_set_t *set) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!set) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (set->objects.used + 1 > set->objects.size) {
- f_array_length_t size = set->objects.used + f_memory_default_allocation_step;
+ f_array_length_t size = set->objects.used + step;
if (size > f_array_length_t_size) {
if (set->objects.used + 1 > f_array_length_t_size) {
#endif // _di_f_fss_set_quote_decrease_by_
#ifndef _di_f_fss_set_quote_increase_
- f_status_t f_fss_set_quote_increase(f_fss_set_quote_t *set_quote) {
+ f_status_t f_fss_set_quote_increase(const uint16_t step, f_fss_set_quote_t *set_quote) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!set_quote) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (set_quote->objects.used + 1 > set_quote->objects.size) {
- f_array_length_t size = set_quote->objects.used + f_memory_default_allocation_step;
+ f_array_length_t size = set_quote->objects.used + step;
if (size > f_array_length_t_size) {
if (set_quote->objects.used + 1 > f_array_length_t_size) {
#endif // _di_f_fss_set_quotes_decrease_by_
#ifndef _di_f_fss_set_quotes_increase_
- f_status_t f_fss_set_quotes_increase(f_fss_set_quotes_t *set_quotes) {
+ f_status_t f_fss_set_quotes_increase(const uint16_t step, f_fss_set_quotes_t *set_quotes) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!set_quotes) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (set_quotes->used + 1 > set_quotes->size) {
- f_array_length_t size = set_quotes->used + f_memory_default_allocation_step;
+ f_array_length_t size = set_quotes->used + step;
if (size > f_array_length_t_size) {
if (set_quotes->used + 1 > f_array_length_t_size) {
#endif // _di_f_fss_sets_decrease_by_
#ifndef _di_f_fss_sets_increase_
- f_status_t f_fss_sets_increase(f_fss_sets_t *sets) {
+ f_status_t f_fss_sets_increase(const uint16_t step, f_fss_sets_t *sets) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!sets) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (sets->used + 1 > sets->size) {
- f_array_length_t size = sets->used + f_memory_default_allocation_step;
+ f_array_length_t size = sets->used + step;
if (size > f_array_length_t_size) {
if (sets->used + 1 > f_array_length_t_size) {
#define macro_f_fss_set_t_delete_simple(set) f_fss_set_resize(0, &set);
#define macro_f_fss_set_t_destroy_simple(set) f_fss_set_adjust(0, &set);
- #define macro_f_fss_set_t_increase(status, set) status = f_fss_set_increase(&set);
+ #define macro_f_fss_set_t_increase(status, step, set) status = f_fss_set_increase(step, &set);
#define macro_f_fss_set_t_increase_by(status, set, amount) status = f_fss_set_increase_by(amount, &set);
#define macro_f_fss_set_t_decrease_by(status, set, amount) status = f_fss_set_decrease_by(amount, &set);
#define macro_f_fss_set_t_decimate_by(status, set, amount) status = f_fss_set_decimate_by(amount, &set);
#define macro_f_fss_sets_t_delete_simple(sets) f_fss_sets_resize(0, &sets);
#define macro_f_fss_sets_t_destroy_simple(sets) f_fss_sets_adjust(0, &sets);
- #define macro_f_fss_sets_t_increase(status, sets) status = f_fss_sets_increase(&sets);
+ #define macro_f_fss_sets_t_increase(status, step, sets) status = f_fss_sets_increase(step, &sets);
#define macro_f_fss_sets_t_increase_by(status, sets, amount) status = f_fss_sets_increase_by(amount, &sets);
#define macro_f_fss_sets_t_decrease_by(status, sets, amount) status = f_fss_sets_decrease_by(amount, &sets);
#define macro_f_fss_sets_t_decimate_by(status, sets, amount) status = f_fss_sets_decimate_by(amount, &sets);
#define macro_f_fss_set_quote_t_delete_simple(set_quote) f_fss_set_quote_resize(0, &set_quote);
#define macro_f_fss_set_quote_t_destroy_simple(set_quote) f_fss_set_quote_adjust(0, &set_quote);
- #define macro_f_fss_set_quote_t_increase(status, set_quote) status = f_fss_set_quote_increase(&set_quote);
+ #define macro_f_fss_set_quote_t_increase(status, step, set_quote) status = f_fss_set_quote_increase(step, &set_quote);
#define macro_f_fss_set_quote_t_increase_by(status, set_quote, amount) status = f_fss_set_quote_increase_by(amount, &set_quote);
#define macro_f_fss_set_quote_t_decrease_by(status, set_quote, amount) status = f_fss_set_quote_decrease_by(amount, &set_quote);
#define macro_f_fss_set_quote_t_decimate_by(status, set_quote, amount) status = f_fss_set_quote_decimate_by(amount, &set_quote);
#define macro_f_fss_set_quotes_t_delete_simple(set_quotes) f_fss_set_quotes_resize(0, &set_quotes);
#define macro_f_fss_set_quotes_t_destroy_simple(set_quotes) f_fss_set_quotes_adjust(0, &set_quotes);
- #define macro_f_fss_set_quotes_t_increase(status, set_quotes) status = f_fss_set_quotes_increase(&set_quotes);
+ #define macro_f_fss_set_quotes_t_increase(status, step, set_quotes) status = f_fss_set_quotes_increase(step, &set_quotes);
#define macro_f_fss_set_quotes_t_increase_by(status, set_quotes, amount) status = f_fss_set_quotes_increase_by(amount, &set_quotes);
#define macro_f_fss_set_quotes_t_decrease_by(status, set_quotes, amount) status = f_fss_set_quotes_decrease_by(amount, &set_quotes);
#define macro_f_fss_set_quotes_t_decimate_by(status, set_quotes, amount) status = f_fss_set_quotes_decimate_by(amount, &set_quotes);
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param set
* The set array to resize.
*
* F_parameter (with error bit) if a parameter is invalid.
*/
#ifndef _di_f_fss_set_increase_
- extern f_status_t f_fss_set_increase(f_fss_set_t *set);
+ extern f_status_t f_fss_set_increase(const uint16_t step, f_fss_set_t *set);
#endif // _di_f_fss_set_increase_
/**
* If the given length is too large for the buffer, then attempt to set_quote max buffer size (f_array_length_t_size).
* If already set_quote to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param set_quote
* The set_quote array to resize.
*
* F_parameter (with error bit) if a parameter is invalid.
*/
#ifndef _di_f_fss_set_quote_increase_
- extern f_status_t f_fss_set_quote_increase(f_fss_set_quote_t *set_quote);
+ extern f_status_t f_fss_set_quote_increase(const uint16_t step, f_fss_set_quote_t *set_quote);
#endif // _di_f_fss_set_quote_increase_
/**
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param set_quotes
* The set_quotes array to resize.
*
* F_parameter (with error bit) if a parameter is invalid.
*/
#ifndef _di_f_fss_set_quotes_increase_
- extern f_status_t f_fss_set_quotes_increase(f_fss_set_quotes_t *set_quotes);
+ extern f_status_t f_fss_set_quotes_increase(const uint16_t step, f_fss_set_quotes_t *set_quotes);
#endif // _di_f_fss_set_quotes_increase_
/**
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param sets
* The sets array to resize.
*
* F_parameter (with error bit) if a parameter is invalid.
*/
#ifndef _di_f_fss_sets_increase_
- extern f_status_t f_fss_sets_increase(f_fss_sets_t *sets);
+ extern f_status_t f_fss_sets_increase(const uint16_t step, f_fss_sets_t *sets);
#endif // _di_f_fss_sets_increase_
/**
/**
* Reallocate delimits array if necessary for appending a new delimit.
*
+ * state: The state.
* status: The return status to use.
* delimits: The delimit array to conditionally reallocate.
*/
#ifndef _di_macro_f_iki_allocate_delimits_if_necessary_
- #define macro_f_iki_allocate_delimits_if_necessary(status, delimits) \
+ #define macro_f_iki_allocate_delimits_if_necessary(state, status, delimits) \
status = F_none; \
if (delimits.used == delimits.size) { \
- if (delimits.used + f_iki_default_allocation_step > f_array_length_t_size) { \
+ if (delimits.used + state.step_small > f_array_length_t_size) { \
if (delimits.used == f_array_length_t_size) { \
status = F_status_set_error(F_string_too_large); \
} \
} \
} \
else { \
- macro_f_array_lengths_t_resize(status, delimits, delimits.size + f_iki_default_allocation_step); \
+ macro_f_array_lengths_t_resize(status, delimits, delimits.size + state.step_small); \
} \
}
#endif // _di_macro_f_iki_allocate_delimits_if_necessary_
/**
* Reallocate delimits array if necessary for appending a new ranges.
*
+ * state: The state.
* status: The return status to use.
* ranges: The delimit array to conditionally reallocate.
*/
#ifndef _di_macro_f_iki_allocate_ranges_if_necessary_
- #define macro_f_iki_allocate_ranges_if_necessary(status, ranges) \
+ #define macro_f_iki_allocate_ranges_if_necessary(state, status, ranges) \
status = F_none; \
if (ranges.used == ranges.size) { \
- if (ranges.used + f_iki_default_allocation_step > f_array_length_t_size) { \
+ if (ranges.used + state.step_small > f_array_length_t_size) { \
if (ranges.used == f_array_length_t_size) { \
status = F_status_set_error(F_string_too_large); \
} \
} \
} \
else { \
- macro_f_string_ranges_t_resize(status, ranges, ranges.size + f_iki_default_allocation_step); \
+ macro_f_string_ranges_t_resize(status, ranges, ranges.size + state.step_small); \
} \
}
#endif // _di_macro_f_iki_allocate_ranges_if_necessary_
#endif // _di_f_iki_object_partial_is_
#ifndef _di_f_iki_read_
- f_status_t f_iki_read(f_string_static_t *buffer, f_string_range_t *range, f_iki_variable_t *variable, f_iki_vocabulary_t *vocabulary, f_iki_content_t *content) {
+ f_status_t f_iki_read(f_state_t state, f_string_static_t *buffer, f_string_range_t *range, f_iki_variable_t *variable, f_iki_vocabulary_t *vocabulary, f_iki_content_t *content) {
#ifndef _di_level_0_parameter_checking_
if (!buffer) return F_status_set_error(F_parameter);
if (!range) return F_status_set_error(F_parameter);
// find the start and end of the vocabulary name.
while (range->start <= range->stop && range->start < buffer->used) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
+
if (buffer->string[range->start] == f_iki_syntax_placeholder) {
++range->start;
continue;
if (range->start == found_vocabulary.start) {
status = f_utf_buffer_increment(*buffer, range, 1);
- if (F_status_is_error(status)) {
- macro_f_array_lengths_t_delete_simple(delimits);
- return status;
- }
-
break;
}
status = f_utf_buffer_increment(*buffer, range, 1);
} while (F_status_is_fine(status) && buffer->string[range->start] == f_iki_syntax_placeholder);
- if (F_status_is_error(status)) {
- macro_f_array_lengths_t_delete_simple(delimits);
- return status;
- }
+ if (F_status_is_error(status)) break;
// found a valid vocabulary name.
if (buffer->string[range->start] == f_iki_syntax_quote_single || buffer->string[range->start] == f_iki_syntax_quote_double) {
quote = buffer->string[range->start];
++range->start;
+
break;
}
// this is not a valid vocabulary name so seek until a non-word, non-dash, or non-plus character.
macro_f_iki_seek_word_dash_plus(status, buffer, range, width_max, F_false);
- if (F_status_is_error(status)) {
- macro_f_array_lengths_t_delete_simple(delimits);
-
- return status;
- }
+ if (F_status_is_error(status)) break;
break;
}
}
status = f_utf_buffer_increment(*buffer, range, 1);
-
- if (F_status_is_error(status)) {
- macro_f_array_lengths_t_delete_simple(delimits);
-
- return status;
- }
+ if (F_status_is_error(status)) break;
} // while
break;
macro_f_iki_determine_width_max(buffer, range, width_max);
status = f_utf_is_word_dash_plus(buffer->string + range->start, width_max, F_false);
-
- if (F_status_is_error(status)) {
- macro_f_array_lengths_t_delete_simple(delimits);
-
- return status;
- }
+ if (F_status_is_error(status)) break;
// current word-dash-plus block is not a valid variable name, try again.
if (status == F_false) {
macro_f_iki_seek_word_dash_plus(status, buffer, range, width_max, F_true);
if (F_status_is_error(status)) {
- macro_f_array_lengths_t_delete_simple(delimits);
-
- return status;
+ break;
}
else if (range->start > range->stop) {
macro_f_array_lengths_t_delete_simple(delimits);
}
status = f_utf_buffer_increment(*buffer, range, 1);
+ if (F_status_is_error(status)) break;
+ } // while
- if (F_status_is_error(status)) {
- macro_f_array_lengths_t_delete_simple(delimits);
+ if (F_status_is_error(status)) {
+ macro_f_array_lengths_t_delete_simple(delimits);
- return status;
- }
- } // while
+ return status;
+ }
// process potentially valid content.
if (quote) {
while (range->start <= range->stop && range->start < buffer->used) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
+
if (buffer->string[range->start] == f_iki_syntax_placeholder) {
++range->start;
// this is a valid vocabulary name and content, but if it is delimited, save the delimit and ignore.
if (vocabulary_delimited) {
- macro_f_iki_allocate_delimits_if_necessary(status, delimits);
-
- if (F_status_is_error(status)) {
- macro_f_array_lengths_t_delete_simple(delimits);
-
- return status;
- }
+ macro_f_iki_allocate_delimits_if_necessary(state, status, delimits);
+ if (F_status_is_error(status)) break;
delimits.array[delimits.used] = vocabulary_slash_first;
++delimits.used;
break;
}
else {
- macro_f_iki_allocate_ranges_if_necessary(status, (*variable));
+ macro_f_iki_allocate_ranges_if_necessary(state, status, (*variable));
if (F_status_is_fine(status)) {
- macro_f_iki_allocate_ranges_if_necessary(status, (*vocabulary));
+ macro_f_iki_allocate_ranges_if_necessary(state, status, (*vocabulary));
}
if (F_status_is_fine(status)) {
- macro_f_iki_allocate_ranges_if_necessary(status, (*content));
+ macro_f_iki_allocate_ranges_if_necessary(state, status, (*content));
}
- if (F_status_is_error(status)) {
- macro_f_array_lengths_t_delete_simple(delimits);
- return status;
- }
+ if (F_status_is_error(status)) break;
variable->array[variable->used].start = found_vocabulary.start;
variable->array[variable->used].stop = range->start;
macro_f_array_lengths_t_resize(status, delimits, delimits.used + content_slash_delimits);
}
- if (F_status_is_error(status)) {
- macro_f_array_lengths_t_delete_simple(delimits);
-
- return status;
- }
+ if (F_status_is_error(status)) break;
}
content_range.start = content_slash_first;
}
status = f_utf_buffer_increment(*buffer, (&content_range), 1);
-
- if (F_status_is_error(status)) {
- macro_f_array_lengths_t_delete_simple(delimits);
- return status;
- }
+ if (F_status_is_error(status)) break;
} // while
+ if (F_status_is_error(status)) break;
+
// valid content's ending quote is not delimited, save and return.
if (content_slash_total % 2 == 0) {
// this is a valid vocabulary name and content, but if it is delimited, save the delimit and ignore.
if (vocabulary_delimited) {
- macro_f_iki_allocate_delimits_if_necessary(status, delimits);
-
- if (F_status_is_error(status)) {
- macro_f_array_lengths_t_delete_simple(delimits);
-
- return status;
- }
+ macro_f_iki_allocate_delimits_if_necessary(state, status, delimits);
+ if (F_status_is_error(status)) break;
delimits.array[delimits.used] = vocabulary_slash_first;
++delimits.used;
found_vocabulary.start = range->start;
}
else {
- macro_f_iki_allocate_ranges_if_necessary(status, (*variable));
+ macro_f_iki_allocate_ranges_if_necessary(state, status, (*variable));
if (F_status_is_fine(status)) {
- macro_f_iki_allocate_ranges_if_necessary(status, (*vocabulary));
+ macro_f_iki_allocate_ranges_if_necessary(state, status, (*vocabulary));
}
if (F_status_is_fine(status)) {
- macro_f_iki_allocate_ranges_if_necessary(status, (*content));
+ macro_f_iki_allocate_ranges_if_necessary(state, status, (*content));
}
- if (F_status_is_error(status)) {
- macro_f_array_lengths_t_delete_simple(delimits);
-
- return status;
- }
+ if (F_status_is_error(status)) break;
variable->array[variable->used].start = found_vocabulary.start;
variable->array[variable->used].stop = range->start;
++content_slash_total;
status = f_utf_buffer_increment(*buffer, range, 1);
-
- if (F_status_is_error(status)) {
- macro_f_array_lengths_t_delete_simple(delimits);
- return status;
- }
+ if (F_status_is_error(status)) break;
} // while
+
+ if (F_status_is_error(status)) break;
}
status = f_utf_buffer_increment(*buffer, range, 1);
-
- if (F_status_is_error(status)) {
- macro_f_array_lengths_t_delete_simple(delimits);
- return status;
- }
+ if (F_status_is_error(status)) break;
} // while
}
else {
find_next = F_true;
}
+ if (F_status_is_error(status)) {
+ macro_f_array_lengths_t_delete_simple(delimits);
+
+ return status;
+ }
+
if (find_next) {
macro_f_iki_seek_word_dash_plus(status, buffer, range, width_max, F_true);
found_vocabulary.start = range->start;
find_next = F_false;
}
+
} while (range->start <= range->stop && range->start < buffer->used);
for (f_array_length_t i = 0; i < delimits.used; ++i) {
* This will update the buffer at the given range with any placeholders to escaped data.
* Calling this more than once on the same buffer range could result in multiple escaping.
*
+ * @param state
+ * A state for handling interrupts during long running operations.
+ * There is no print_error() usage at this time (@todo this should be implemented and supported).
+ * There is no functions structure.
+ * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure).
+ *
+ * When interrupt() returns, only F_interrupt and F_interrupt_not are processed.
+ * Error bit designates an error but must be passed along with F_interrupt.
+ * All other statuses are ignored.
* @param buffer
* The string to process.
* @param range
* F_data_not_eos on success and EOS was reached, but there were no IKI vocabulary names found.
* F_data_not_stop on success and stop point was reached, but there were no IKI vocabulary names found.
*
+ * F_interrupt (with error bit) if stopping due to an interrupt.
* F_memory_not (with error bit) on out of memory.
* F_parameter (with error bit) if a parameter is invalid.
* F_string_too_large (with error bit) if a string length is too large to store in the buffer.
*/
#ifndef _di_f_iki_read_
- extern f_status_t f_iki_read(f_string_static_t *buffer, f_string_range_t *range, f_iki_variable_t *variable, f_iki_vocabulary_t *vocabulary, f_iki_content_t *content);
+ extern f_status_t f_iki_read(f_state_t state, f_string_static_t *buffer, f_string_range_t *range, f_iki_variable_t *variable, f_iki_vocabulary_t *vocabulary, f_iki_content_t *content);
#endif // _di_f_iki_read_
#ifdef __cplusplus
#define macro_f_limit_values_t_delete_simple(values) macro_f_memory_structure_delete_simple(values, f_limit_value_t)
#define macro_f_limit_values_t_destroy_simple(values) macro_f_memory_structure_destroy_simple(values, f_limit_value_t)
- #define macro_f_limit_values_t_increase(status, values) macro_f_memory_structure_increase(status, values, f_limit_value_t)
+ #define macro_f_limit_values_t_increase(status, step, values) macro_f_memory_structure_increase(status, step, values, f_limit_value_t)
#define macro_f_limit_values_t_increase_by(status, values, amount) macro_f_memory_structure_increase_by(status, values, f_limit_value_t, amount)
#define macro_f_limit_values_t_decrease_by(status, values, amount) macro_f_memory_structure_decrease_by(status, values, f_limit_value_t, amount)
#define macro_f_limit_values_t_decimate_by(status, values, amount) macro_f_memory_structure_decimate_by(status, values, f_limit_value_t, amount)
#define macro_f_limit_sets_t_delete_simple(sets) macro_f_memory_structure_delete_simple(sets, f_limit_set_t)
#define macro_f_limit_sets_t_destroy_simple(sets) macro_f_memory_structure_destroy_simple(sets, f_limit_set_t)
- #define macro_f_limit_sets_t_increase(status, sets) macro_f_memory_structure_increase(status, sets, f_limit_set_t)
+ #define macro_f_limit_sets_t_increase(status, step, sets) macro_f_memory_structure_increase(status, step, sets, f_limit_set_t)
#define macro_f_limit_sets_t_increase_by(status, sets, amount) macro_f_memory_structure_increase_by(status, sets, f_limit_set_t, amount)
#define macro_f_limit_sets_t_decrease_by(status, sets, amount) macro_f_memory_structure_decrease_by(status, sets, f_limit_set_t, amount)
#define macro_f_limit_sets_t_decimate_by(status, sets, amount) macro_f_memory_structure_decimate_by(status, sets, f_limit_set_t, amount)
* Other projects may provide their own values.
*/
#ifndef _di_f_memory_default_allocation_step_
- #define f_memory_default_allocation_step 4
+ #define f_memory_default_allocation_large 64
+ #define f_memory_default_allocation_small 4
#endif // _di_f_memory_default_allocation_step_
/**
/**
* Increase a generic memory structure.
*
- * status: the status to return.
- * structure: the structure to operate on.
- * type: the structure type.
+ * status: The status to return.
+ * step: The allocation step.
+ * structure: The structure to operate on.
+ * type: The structure type.
*/
#ifndef _di_macro_f_memory_structure_increase_
- #define macro_f_memory_structure_increase(status, structure, type) \
- status = f_memory_structure_increase(sizeof(type), (void **) &structure.array, &structure.used, &structure.size);
+ #define macro_f_memory_structure_increase(status, step, structure, type) \
+ status = f_memory_structure_increase(step, sizeof(type), (void **) &structure.array, &structure.used, &structure.size);
#endif // _di_macro_f_memory_structure_increase_
/**
* Increase a generic memory structure by some amount.
*
- * status: the status to return.
- * structure: the structure to operate on.
- * type: the structure type.
- * amount: the amount to increase the size of the array by.
+ * status: The status to return.
+ * structure: The structure to operate on.
+ * type: The structure type.
+ * amount: The amount to increase the size of the array by.
*/
#ifndef _di_macro_f_memory_structure_increase_by_
#define macro_f_memory_structure_increase_by(status, structure, type, amount) \
/**
* Decrease a generic memory structure by some amount.
*
- * status: the status to return.
- * structure: the structure to operate on.
- * type: the structure type.
- * amount: the amount to decrease the size of the array by.
+ * status: The status to return.
+ * structure: The structure to operate on.
+ * type: The structure type.
+ * amount: The amount to decrease the size of the array by.
*/
#ifndef _di_macro_f_memory_structure_decrease_by_
#define macro_f_memory_structure_decrease_by(status, structure, type, amount) \
/**
* Decimate a generic memory structure by some amount.
*
- * status: the status to return.
- * structure: the structure to operate on.
- * type: the structure type.
- * amount: the amount to decimate the size of the array by.
+ * status: The status to return.
+ * structure: The structure to operate on.
+ * type: The structure type.
+ * amount: The amount to decimate the size of the array by.
*/
#ifndef _di_macro_f_memory_structure_decimate_by_
#define macro_f_memory_structure_decimate_by(status, structure, type, amount) \
/**
* Resize a generic memory structures.
*
- * status: the status to return.
- * structures: the structures to operate on.
- * type_stucture: the structure type.
- * type_stuctures: the structures type.
- * length: the new size of the array.
- * type_length: the data type of the length variable type.
+ * status: The status to return.
+ * structures: The structures to operate on.
+ * type_stucture: The structure type.
+ * type_stuctures: The structures type.
+ * length: The new size of the array.
+ * type_length: The data type of the length variable type.
*/
#ifndef _di_macro_f_memory_structures_resize_
#define macro_f_memory_structures_resize(status, structures, type_structure, type_structures, length, type_length) \
/**
* Adjust a generic memory structures.
*
- * status: the status to return.
- * structures: the structures to operate on.
- * type_stucture: the structure type.
- * type_stuctures: the structures type.
- * length: the new size of the array.
- * type_length: the data type of the length variable type.
+ * status: The status to return.
+ * structures: The structures to operate on.
+ * type_stucture: The structure type.
+ * type_stuctures: The structures type.
+ * length: The new size of the array.
+ * type_length: The data type of the length variable type.
*/
#ifndef _di_macro_f_memory_structures_adjust_
#define macro_f_memory_structures_adjust(status, structures, type_structure, type_structures, length, type_length) \
/**
* Delete a generic memory structures.
*
- * status: the status to return.
- * structures: the structures to operate on.
- * type_stucture: the structure type.
- * type_stuctures: the structures type.
+ * status: The status to return.
+ * structures: The structures to operate on.
+ * type_stucture: The structure type.
+ * type_stuctures: The structures type.
*/
#ifndef _di_macro_f_memory_structures_delete_
#define macro_f_memory_structures_delete(status, structures, type_structure, type_structures) \
/**
* Destroy a generic memory structures.
*
- * status: the status to return.
- * structures: the structures to operate on.
- * type_stucture: the structure type.
- * type_stuctures: the structures type.
+ * status: The status to return.
+ * structures: The structures to operate on.
+ * type_stucture: The structure type.
+ * type_stuctures: The structures type.
*/
#ifndef _di_macro_f_memory_structures_destroy_
#define macro_f_memory_structures_destroy(status, structures, type_structure, type_structures) \
/**
* Delete a generic memory structures.
*
- * structures: the structures to operate on.
- * type_stucture: the structure type.
- * type_stuctures: the structures type.
+ * structures: The structures to operate on.
+ * type_stucture: The structure type.
+ * type_stuctures: The structures type.
*/
#ifndef _di_macro_f_memory_structures_delete_simple_
#define macro_f_memory_structures_delete_simple(structures, type_structure, type_structures) \
/**
* Destroy a generic memory structures.
*
- * structures: the structures to operate on.
- * type_stucture: the structure type.
- * type_stuctures: the structures type.
+ * structures: The structures to operate on.
+ * type_stucture: The structure type.
+ * type_stuctures: The structures type.
*/
#ifndef _di_macro_f_memory_structures_destroy_simple_
#define macro_f_memory_structures_destroy_simple(structures, type_structure, type_structures) \
*
* This only increases if the structure.used + 1 is greater than structure.size.
*
- * status: the status to return.
- * structures: the structures to operate on.
- * type_stuctures: the structures type.
- * type_length: the data type of the length variable type.
+ * status: The status to return.
+ * structures: The structures to operate on.
+ * type_stuctures: The structures type.
+ * type_length: The data type of the length variable type.
*/
#ifndef _di_macro_f_memory_structures_increase_
#define macro_f_memory_structures_increase(status, structures, type_structures, type_length) \
*
* This only increases if the structure.used + amount is greater than structure.size.
*
- * status: the status to return.
- * structures: the structures to operate on.
- * type_stuctures: the structures type.
- * type_length: the data type of the length variable type.
- * amount: the amount to increase by.
+ * status: The status to return.
+ * structures: The structures to operate on.
+ * type_stuctures: The structures type.
+ * type_length: The data type of the length variable type.
+ * amount: The amount to increase by.
*/
#ifndef _di_macro_f_memory_structures_increase_by_
#define macro_f_memory_structures_increase_by(status, structures, type_structures, type_length, amount) \
/**
* Decrease a generic memory structures by the given amount.
*
- * status: the status to return.
- * structures: the structures to operate on.
- * type_stucture: the structure type.
- * type_stuctures: the structures type.
- * type_length: the data type of the length variable type.
- * amount: the amount to decrease by.
+ * status: The status to return.
+ * structures: The structures to operate on.
+ * type_stucture: The structure type.
+ * type_stuctures: The structures type.
+ * type_length: The data type of the length variable type.
+ * amount: The amount to decrease by.
*/
#ifndef _di_macro_f_memory_structures_decrease_by_
#define macro_f_memory_structures_decrease_by(status, structures, type_structure, type_structures, type_length, amount) \
/**
* Decimate a generic memory structures by the given amount.
*
- * status: the status to return.
- * structures: the structures to operate on.
- * type_stucture: the structure type.
- * type_stuctures: the structures type.
- * type_length: the data type of the length variable type.
- * amount: the amount to decimate by.
+ * status: The status to return.
+ * structures: The structures to operate on.
+ * type_stucture: The structure type.
+ * type_stuctures: The structures type.
+ * type_length: The data type of the length variable type.
+ * amount: The amount to decimate by.
*/
#ifndef _di_macro_f_memory_structures_decimate_by_
#define macro_f_memory_structures_decimate_by(status, structures, type_structure, type_structures, type_length, amount) \
*
* Be sure to check size for error after calling this.
*
- * status: the status to return.
- * structures: the structures to operate on.
- * step: the step to increase by, must be less than or equal to step_default.
- * step_default: the default step to increase by if memory allows.
- * macro_resize: the resize structure macro to call that excepts the exact arguments: (status, structure, length).
- * error_too_large: the error status to return when f_array_length_t_size would be exceeded.
+ * status: The status to return.
+ * structures: The structures to operate on.
+ * step: The step to increase by, must be less than or equal to step_default.
+ * step_default: The default step to increase by if memory allows.
+ * macro_resize: The resize structure macro to call that excepts the exact arguments: (status, structure, length).
+ * error_too_large: The error status to return when f_array_length_t_size would be exceeded.
*/
#ifndef _di_macro_f_memory_structure_increment_
#define macro_f_memory_structure_increment(status, structure, step, step_default, macro_resize, error_too_large) \
#endif // _di_f_memory_structure_decrease_by_
#ifndef _di_f_memory_structure_increase_
- f_status_t f_memory_structure_increase(const size_t type_size, void **structure, f_array_length_t *used, f_array_length_t *size) {
+ f_status_t f_memory_structure_increase(const uint16_t step, const size_t type_size, void **structure, f_array_length_t *used, f_array_length_t *size) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!type_size) return F_status_set_error(F_parameter);
if (!structure) return F_status_set_error(F_parameter);
if (!used) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (*used + 1 > *size) {
- f_array_length_t length_new = *used + f_memory_default_allocation_step;
+ f_array_length_t length_new = *used + step;
if (length_new > f_array_length_t_size) {
if (*used + 1 > f_array_length_t_size) {
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param type_size
* The size of the structure type (such as: sizeof(structure_size)).
* Must be greater than 0.
* @see memset()
*/
#ifndef _di_f_memory_structure_increase_
- extern f_status_t f_memory_structure_increase(const size_t type_size, void **structure, f_array_length_t *used, f_array_length_t *size);
+ extern f_status_t f_memory_structure_increase(const uint16_t step, const size_t type_size, void **structure, f_array_length_t *used, f_array_length_t *size);
#endif // _di_f_memory_structure_increase_
/**
width = macro_f_utf_byte_width(serialize.string[i]);
if (serialize.string[i] == f_serialize_simple_splitter_s[0] || i + 1 >= serialize.used) {
- macro_f_memory_structure_increment(status, (*strings), 1, f_memory_default_allocation_step, macro_f_string_dynamics_t_resize, F_array_too_large);
+ macro_f_memory_structure_increment(status, (*strings), 1, f_memory_default_allocation_small, macro_f_string_dynamics_t_resize, F_array_too_large);
if (F_status_is_error(status)) return status;
if (start == i) {
width = macro_f_utf_byte_width(serialize.string[i]);
if (serialize.string[i] == f_serialize_simple_splitter_s[0] || i + 1 >= serialize.used) {
- macro_f_memory_structure_increment(status, (*locations), 1, f_memory_default_allocation_step, macro_f_string_ranges_t_resize, F_array_too_large);
+ macro_f_memory_structure_increment(status, (*locations), 1, f_memory_default_allocation_small, macro_f_string_ranges_t_resize, F_array_too_large);
if (F_status_is_error(status)) return status;
if (start == i) {
#define f_signal_t_initialize {0, 0, { 0 } }
#define macro_f_signal_t_initialize(flags, id, set) { flags, id, set }
+
+ #define macro_f_signal_t_clear(signal) \
+ signal.flags = 0; \
+ signal.id = 0; \
+ signal.set[0] = 0;
#endif // _di_f_signal_t_
/**
F_descriptor_not,
F_device,
F_device_not,
+ F_disable,
+ F_disable_not,
F_done,
F_done_not,
F_dummy,
F_dummy_not,
F_empty,
F_empty_not,
+ F_enable,
+ F_enable_not,
F_encoding,
F_encoding_not,
F_eoa,
+++ /dev/null
-/**
- * FLL - Level 0
- *
- * Project: Status
- * API Version: 0.5
- * Licenses: lgplv2.1
- *
- * Provides status arrays that require memory operations.
- *
- * Because memory requires status.h, this is moved to a separate file to reduce potential circular dependency issues.
- */
-#ifndef _F_status_array_h
-#define _F_status_array_h
-
-// fll-0 includes
-#include <fll/level_0/memory.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * An array of status codes.
- *
- * array: An array of status codes.
- * size: Total amount of allocated space.
- * used: Total number of allocated spaces used.
- */
-#ifndef _di_f_statuss_t_
- typedef struct {
- f_status_t *array;
-
- f_array_length_t size;
- f_array_length_t used;
- } f_statuss_t;
-
- #define f_statuss_t_initialize { 0, 0, 0 }
-
- #define macro_f_statuss_t_clear(statuss) macro_f_memory_structure_clear(statuss)
-
- #define macro_f_statuss_t_resize(status, statuss, length) macro_f_memory_structure_resize(status, statuss, f_status_t, length)
- #define macro_f_statuss_t_adjust(status, statuss, length) macro_f_memory_structure_adjust(status, statuss, f_status_t, length)
-
- #define macro_f_statuss_t_delete_simple(statuss) macro_f_memory_structure_delete_simple(statuss, f_status_t)
- #define macro_f_statuss_t_destroy_simple(statuss) macro_f_memory_structure_destroy_simple(statuss, f_status_t)
-
- #define macro_f_statuss_t_increase(status, statuss) macro_f_memory_structure_increase(status, statuss, f_status_t)
- #define macro_f_statuss_t_increase_by(status, statuss, amount) macro_f_memory_structure_increase_by(status, statuss, f_status_t, amount)
- #define macro_f_statuss_t_decrease_by(status, statuss, amount) macro_f_memory_structure_decrease_by(status, statuss, f_status_t, amount)
- #define macro_f_statuss_t_decimate_by(status, statuss, amount) macro_f_memory_structure_decimate_by(status, statuss, f_status_t, amount)
-#endif // _di_f_statuss_t_
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // _F_status_array_h
build_libraries-individual
build_sources_library
build_sources_program
-build_sources_headers status.h status_array.h
+build_sources_headers status.h
build_sources_script
build_sources_setting
build_script yes
#endif // _di_f_string_dynamic_decrease_by_
#ifndef _di_f_string_dynamic_increase_
- f_status_t f_string_dynamic_increase(f_string_dynamic_t *dynamic) {
+ f_status_t f_string_dynamic_increase(const uint16_t step, f_string_dynamic_t *dynamic) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!dynamic) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (dynamic->used + 1 > dynamic->size) {
- f_array_length_t size = dynamic->used + f_memory_default_allocation_step;
+ f_array_length_t size = dynamic->used + step;
if (size > f_array_length_t_size) {
if (dynamic->used + 1 > f_array_length_t_size) {
#endif // _di_f_string_dynamics_decrease_by_
#ifndef _di_f_string_dynamics_increase_
- f_status_t f_string_dynamics_increase(f_string_dynamics_t *dynamics) {
+ f_status_t f_string_dynamics_increase(const uint16_t step, f_string_dynamics_t *dynamics) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!dynamics) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (dynamics->used + 1 > dynamics->size) {
- f_array_length_t size = dynamics->used + f_memory_default_allocation_step;
+ f_array_length_t size = dynamics->used + step;
if (size > f_array_length_t_size) {
if (dynamics->used + 1 > f_array_length_t_size) {
#define macro_f_string_dynamic_t_delete_simple(dynamic) f_string_dynamic_resize(0, &dynamic);
#define macro_f_string_dynamic_t_destroy_simple(dynamic) f_string_dynamic_adjust(0, &dynamic);
- #define macro_f_string_dynamic_t_increase(status, dynamic) status = f_string_dynamic_increase(&dynamic);
+ #define macro_f_string_dynamic_t_increase(status, step, dynamic) status = f_string_dynamic_increase(step, &dynamic);
#define macro_f_string_dynamic_t_increase_by(status, dynamic, amount) status = f_string_dynamic_increase_by(amount, &dynamic);
#define macro_f_string_dynamic_t_decrease_by(status, dynamic, amount) status = f_string_dynamic_decrease_by(amount, &dynamic);
#define macro_f_string_dynamic_t_decimate_by(status, dynamic, amount) status = f_string_dynamic_decimate_by(amount, &dynamic);
#define macro_f_string_dynamics_t_delete_simple(dynamics) f_string_dynamics_resize(0, &dynamics);
#define macro_f_string_dynamics_t_destroy_simple(dynamics) f_string_dynamics_adjust(0, &dynamics);
- #define macro_f_string_dynamics_t_increase(status, dynamics) status = f_string_dynamics_increase(&dynamics);
+ #define macro_f_string_dynamics_t_increase(status, step, dynamics) status = f_string_dynamics_increase(step, &dynamics);
#define macro_f_string_dynamics_t_increase_by(status, dynamics, amount) status = f_string_dynamics_increase_by(amount, &dynamics);
#define macro_f_string_dynamics_t_decrease_by(status, dynamics, amount) status = f_string_dynamics_decrease_by(amount, &dynamics);
#define macro_f_string_dynamics_t_decimate_by(status, dynamics, amount) status = f_string_dynamics_decimate_by(amount, &dynamics);
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
- * @param amount
- * A positive number representing how much to increase the size by.
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param dynamic
* The string to resize.
*
* Errors (with error bit) from: f_memory_resize().
*/
#ifndef _di_f_string_dynamic_increase_
- extern f_status_t f_string_dynamic_increase(f_string_dynamic_t *dynamic);
+ extern f_status_t f_string_dynamic_increase(const uint16_t step, f_string_dynamic_t *dynamic);
#endif // _di_f_string_dynamic_increase_
/**
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param dynamics
* The array to resize.
*
* Errors (with error bit) from: f_memory_resize().
*/
#ifndef _di_f_string_dynamics_increase_
- extern f_status_t f_string_dynamics_increase(f_string_dynamics_t *dynamics);
+ extern f_status_t f_string_dynamics_increase(const uint16_t step, f_string_dynamics_t *dynamics);
#endif // _di_f_string_dynamics_increase_
/**
#endif // _di_f_string_map_multis_decrease_by_
#ifndef _di_f_string_map_multis_increase_
- f_status_t f_string_map_multis_increase(f_string_map_multis_t *map_multis) {
+ f_status_t f_string_map_multis_increase(const uint16_t step, f_string_map_multis_t *map_multis) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!map_multis) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (map_multis->used + 1 > map_multis->size) {
- f_array_length_t size = map_multis->used + f_memory_default_allocation_step;
+ f_array_length_t size = map_multis->used + step;
if (size > f_array_length_t_size) {
if (map_multis->used + 1 > f_array_length_t_size) {
#endif // _di_f_string_maps_decrease_by_
#ifndef _di_f_string_maps_increase_
- f_status_t f_string_maps_increase(f_string_maps_t *maps) {
+ f_status_t f_string_maps_increase(const uint16_t step, f_string_maps_t *maps) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!maps) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (maps->used + 1 > maps->size) {
- f_array_length_t size = maps->used + f_memory_default_allocation_step;
+ f_array_length_t size = maps->used + step;
if (size > f_array_length_t_size) {
if (maps->used + 1 > f_array_length_t_size) {
#define macro_f_string_maps_t_delete_simple(maps) f_string_maps_resize(0, &maps);
#define macro_f_string_maps_t_destroy_simple(maps) f_string_maps_adjust(0, &maps);
- #define macro_f_string_maps_t_increase(status, maps) status = f_string_maps_increase(maps);
+ #define macro_f_string_maps_t_increase(status, step, maps) status = f_string_maps_increase(step, maps);
#define macro_f_string_maps_t_increase_by(status, maps, amount) status = f_string_maps_increase_by(amount, maps);
#define macro_f_string_maps_t_decrease_by(status, maps, amount) status = f_string_maps_decrease_by(amount, maps);
#define macro_f_string_maps_t_decimate_by(status, maps, amount) status = f_string_maps_decimate_by(amount, maps);
#define macro_f_string_map_multis_t_delete_simple(map_multis) f_string_map_multis_resize(0, &map_multis);
#define macro_f_string_map_multis_t_destroy_simple(map_multis) f_string_map_multis_adjust(0, &map_multis);
- #define macro_f_string_map_multis_t_increase(status, map_multis) status = f_string_map_multis_increase(&map_multis);
+ #define macro_f_string_map_multis_t_increase(status, step, map_multis) status = f_string_map_multis_increase(step, &map_multis);
#define macro_f_string_map_multis_t_increase_by(status, map_multis, amount) status = f_string_map_multis_increase_by(amount, &map_multis);
#define macro_f_string_map_multis_t_decrease_by(status, map_multis, amount) status = f_string_map_multis_decrease_by(amount, &map_multis);
#define macro_f_string_map_multis_t_decimate_by(status, map_multis, amount) status = f_string_map_multis_decimate_by(amount, &map_multis);
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param map_multis
* The map_multis array to resize.
*
* Errors (with error bit) from: f_memory_resize().
*/
#ifndef _di_f_string_map_multis_increase_
- extern f_status_t f_string_map_multis_increase(f_string_map_multis_t *map_multis);
+ extern f_status_t f_string_map_multis_increase(const uint16_t step, f_string_map_multis_t *map_multis);
#endif // _di_f_string_map_multis_increase_
/**
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param maps
* The string maps array to resize.
*
* Errors (with error bit) from: f_memory_resize().
*/
#ifndef _di_f_string_maps_increase_
- extern f_status_t f_string_maps_increase(f_string_maps_t *maps);
+ extern f_status_t f_string_maps_increase(const uint16_t step, f_string_maps_t *maps);
#endif // _di_f_string_maps_increase_
/**
#endif // _di_f_string_quantitys_decrease_by_
#ifndef _di_f_string_quantitys_increase_
- f_status_t f_string_quantitys_increase(f_string_quantitys_t *quantitys) {
+ f_status_t f_string_quantitys_increase(const uint16_t step, f_string_quantitys_t *quantitys) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!quantitys) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (quantitys->used + 1 > quantitys->size) {
- f_array_length_t size = quantitys->used + f_memory_default_allocation_step;
+ f_array_length_t size = quantitys->used + step;
if (size > f_array_length_t_size) {
if (quantitys->used + 1 > f_array_length_t_size) {
#endif // _di_f_string_quantityss_decrease_by_
#ifndef _di_f_string_quantityss_increase_
- f_status_t f_string_quantityss_increase(f_string_quantityss_t *quantityss) {
+ f_status_t f_string_quantityss_increase(const uint16_t step, f_string_quantityss_t *quantityss) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!quantityss) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (quantityss->used + 1 > quantityss->size) {
- f_array_length_t size = quantityss->used + f_memory_default_allocation_step;
+ f_array_length_t size = quantityss->used + step;
if (size > f_array_length_t_size) {
if (quantityss->used + 1 > f_array_length_t_size) {
#define macro_f_string_quantitys_t_delete_simple(quantitys) f_string_quantitys_resize(0, &quantitys);
#define macro_f_string_quantitys_t_destroy_simple(quantitys) f_string_quantitys_adjust(0, &quantitys);
- #define macro_f_string_quantitys_t_increase(status, quantitys) status = f_string_quantitys_increase(&quantitys);
+ #define macro_f_string_quantitys_t_increase(status, step, quantitys) status = f_string_quantitys_increase(step, &quantitys);
#define macro_f_string_quantitys_t_increase_by(status, quantitys, amount) status = f_string_quantitys_increase_by(amount, &quantitys);
#define macro_f_string_quantitys_t_decrease_by(status, quantitys, amount) status = f_string_quantitys_decrease_by(amount, &quantitys);
#define macro_f_string_quantitys_t_decimate_by(status, quantitys, amount) status = f_string_quantitys_decimate_by(amount, &quantitys);
#define macro_f_string_quantityss_t_delete_simple(quantityss) f_string_quantityss_resize(0, &quantityss);
#define macro_f_string_quantityss_t_destroy_simple(quantityss) f_string_quantityss_adjust(0, &quantityss);
- #define macro_f_string_quantityss_t_increase(status, quantityss) status = f_string_quantityss_increase(&quantityss);
+ #define macro_f_string_quantityss_t_increase(status, step, quantityss) status = f_string_quantityss_increase(step, &quantityss);
#define macro_f_string_quantityss_t_increase_by(status, quantityss, amount) status = f_string_quantityss_increase_by(amount, &quantityss);
#define macro_f_string_quantityss_t_decrease_by(status, quantityss, amount) status = f_string_quantityss_decrease_by(amount, &quantityss);
#define macro_f_string_quantityss_t_decimate_by(status, quantityss, amount) status = f_string_quantityss_decimate_by(amount, &quantityss);
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param quantitys
* The string quantitys array to resize.
*
* Errors (with error bit) from: f_memory_resize().
*/
#ifndef _di_f_string_quantitys_increase_
- extern f_status_t f_string_quantitys_increase(f_string_quantitys_t *quantitys);
+ extern f_status_t f_string_quantitys_increase(const uint16_t step, f_string_quantitys_t *quantitys);
#endif // _di_f_string_quantitys_increase_
/**
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param quantityss
* The string quantityss array to resize.
*
* Errors (with error bit) from: f_memory_resize().
*/
#ifndef _di_f_string_quantityss_increase_
- extern f_status_t f_string_quantityss_increase(f_string_quantityss_t *quantityss);
+ extern f_status_t f_string_quantityss_increase(const uint16_t step, f_string_quantityss_t *quantityss);
#endif // _di_f_string_quantityss_increase_
/**
#endif // _di_f_string_ranges_decrease_by_
#ifndef _di_f_string_ranges_increase_
- f_status_t f_string_ranges_increase(f_string_ranges_t *ranges) {
+ f_status_t f_string_ranges_increase(const uint16_t step, f_string_ranges_t *ranges) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!ranges) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (ranges->used + 1 > ranges->size) {
- f_array_length_t size = ranges->used + f_memory_default_allocation_step;
+ f_array_length_t size = ranges->used + step;
if (size > f_array_length_t_size) {
if (ranges->used + 1 > f_array_length_t_size) {
#endif // _di_f_string_rangess_decrease_by_
#ifndef _di_f_string_rangess_increase_
- f_status_t f_string_rangess_increase(f_string_rangess_t *rangess) {
+ f_status_t f_string_rangess_increase(const uint16_t step, f_string_rangess_t *rangess) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!rangess) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (rangess->used + 1 > rangess->size) {
- f_array_length_t size = rangess->used + f_memory_default_allocation_step;
+ f_array_length_t size = rangess->used + step;
if (size > f_array_length_t_size) {
if (rangess->used + 1 > f_array_length_t_size) {
#define macro_f_string_ranges_t_delete_simple(ranges) f_string_ranges_resize(0, &ranges);
#define macro_f_string_ranges_t_destroy_simple(ranges) f_string_ranges_adjust(0, &ranges);
- #define macro_f_string_ranges_t_increase(status, ranges) status = f_string_ranges_increase(&ranges);
+ #define macro_f_string_ranges_t_increase(status, step, ranges) status = f_string_ranges_increase(step, &ranges);
#define macro_f_string_ranges_t_increase_by(status, ranges, amount) status = f_string_ranges_increase_by(amount, &ranges);
#define macro_f_string_ranges_t_decrease_by(status, ranges, amount) status = f_string_ranges_decrease_by(amount, &ranges);
#define macro_f_string_ranges_t_decimate_by(status, ranges, amount) status = f_string_ranges_decimate_by(amount, &ranges);
#define macro_f_string_rangess_t_delete_simple(rangess) f_string_rangess_resize(0, &rangess);
#define macro_f_string_rangess_t_destroy_simple(rangess) f_string_rangess_adjust(0, &rangess);
- #define macro_f_string_rangess_t_increase(status, rangess) status = f_string_rangess_increase(&rangess);
+ #define macro_f_string_rangess_t_increase(status, step, rangess) status = f_string_rangess_increase(step, &rangess);
#define macro_f_string_rangess_t_increase_by(status, rangess, amount) status = f_string_rangess_increase_by(amount, &rangess);
#define macro_f_string_rangess_t_decrease_by(status, rangess, amount) status = f_string_rangess_decrease_by(amount, &rangess);
#define macro_f_string_rangess_t_decimate_by(status, rangess, amount) status = f_string_rangess_decimate_by(amount, &rangess);
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param ranges
* The string ranges array to resize.
* F_data_not on success, but there is no reason to increase size (used + 1 <= size).
* Errors (with error bit) from: f_memory_resize().
*/
#ifndef _di_f_string_ranges_increase_
- extern f_status_t f_string_ranges_increase(f_string_ranges_t *ranges);
+ extern f_status_t f_string_ranges_increase(const uint16_t step, f_string_ranges_t *ranges);
#endif // _di_f_string_ranges_increase_
/**
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param rangess
* The string rangess array to resize.
*
* Errors (with error bit) from: f_memory_resize().
*/
#ifndef _di_f_string_rangess_increase_
- extern f_status_t f_string_rangess_increase(f_string_rangess_t *rangess);
+ extern f_status_t f_string_rangess_increase(const uint16_t step, f_string_rangess_t *rangess);
#endif // _di_f_string_rangess_increase_
/**
#endif // _di_f_string_triples_decrease_by_
#ifndef _di_f_string_triples_increase_
- f_status_t f_string_triples_increase(f_string_triples_t *triples) {
+ f_status_t f_string_triples_increase(const uint16_t step, f_string_triples_t *triples) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!triples) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (triples->used + 1 > triples->size) {
- f_array_length_t size = triples->used + f_memory_default_allocation_step;
+ f_array_length_t size = triples->used + f_memory_default_allocation_small;
if (size > f_array_length_t_size) {
if (triples->used + 1 > f_array_length_t_size) {
#define macro_f_string_triples_t_delete_simple(triples) f_string_triples_resize(0, &triples);
#define macro_f_string_triples_t_destroy_simple(triples) f_string_triples_adjust(0, &triples);
- #define macro_f_string_triples_t_increase(status, triples) status = f_string_triples_increase(triples);
+ #define macro_f_string_triples_t_increase(status, step, triples) status = f_string_triples_increase(step, triples);
#define macro_f_string_triples_t_increase_by(status, triples, amount) status = f_string_triples_increase_by(amount, triples);
#define macro_f_string_triples_t_decrease_by(status, triples, amount) status = f_string_triples_decrease_by(amount, triples);
#define macro_f_string_triples_t_decimate_by(status, triples, amount) status = f_string_triples_decimate_by(amount, triples);
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param triples
* The string triples array to resize.
*
* Errors (with error bit) from: f_memory_resize().
*/
#ifndef _di_f_string_triples_increase_
- extern f_status_t f_string_triples_increase(f_string_triples_t *triples);
+ extern f_status_t f_string_triples_increase(const uint16_t step, f_string_triples_t *triples);
#endif // _di_f_string_triples_increase_
/**
#define macro_f_thread_attributes_t_delete_simple(attributes) f_thread_attributes_resize(0, &attributes);
#define macro_f_thread_attributes_t_destroy_simple(attributes) f_thread_attributes_adjust(0, &attributes);
- #define macro_f_thread_attributes_t_increase(status, attributes) status = f_thread_attributes_increase(attributes);
+ #define macro_f_thread_attributes_t_increase(status, step, attributes) status = f_thread_attributes_increase(step, attributes);
#define macro_f_thread_attributes_t_increase_by(status, attributes, amount) status = f_thread_attributes_increase_by(amount, attributes);
#define macro_f_thread_attributes_t_decrease_by(status, attributes, amount) status = f_thread_attributes_decrease_by(amount, attributes);
#define macro_f_thread_attributes_t_decimate_by(status, attributes, amount) status = f_thread_attributes_decimate_by(amount, attributes);
#define macro_f_thread_barriers_t_delete_simple(barriers) f_thread_barriers_resize(0, &barriers);
#define macro_f_thread_barriers_t_destroy_simple(barriers) f_thread_barriers_adjust(0, &barriers);
- #define macro_f_thread_barriers_t_increase(status, barriers) status = f_thread_barriers_increase(barriers);
+ #define macro_f_thread_barriers_t_increase(status, step, barriers) status = f_thread_barriers_increase(step, barriers);
#define macro_f_thread_barriers_t_increase_by(status, barriers, amount) status = f_thread_barriers_increase_by(amount, barriers);
#define macro_f_thread_barriers_t_decrease_by(status, barriers, amount) status = f_thread_barriers_decrease_by(amount, barriers);
#define macro_f_thread_barriers_t_decimate_by(status, barriers, amount) status = f_thread_barriers_decimate_by(amount, barriers);
#define macro_f_thread_barrier_attributes_t_delete_simple(barrier_attributes) f_thread_barrier_attributes_resize(0, &barrier_attributes);
#define macro_f_thread_barrier_attributes_t_destroy_simple(barrier_attributes) f_thread_barrier_attributes_adjust(0, &barrier_attributes);
- #define macro_f_thread_barrier_attributes_t_increase(status, barrier_attributes) status = f_thread_barrier_attributes_increase(barrier_attributes);
+ #define macro_f_thread_barrier_attributes_t_increase(status, step, barrier_attributes) status = f_thread_barrier_attributes_increase(step, barrier_attributes);
#define macro_f_thread_barrier_attributes_t_increase_by(status, barrier_attributes, amount) status = f_thread_barrier_attributes_increase_by(amount, barrier_attributes);
#define macro_f_thread_barrier_attributes_t_decrease_by(status, barrier_attributes, amount) status = f_thread_barrier_attributes_decrease_by(amount, barrier_attributes);
#define macro_f_thread_barrier_attributes_t_decimate_by(status, barrier_attributes, amount) status = f_thread_barrier_attributes_decimate_by(amount, barrier_attributes);
#define macro_f_thread_conditions_t_delete_simple(conditions) f_thread_conditions_resize(0, &conditions);
#define macro_f_thread_conditions_t_destroy_simple(conditions) f_thread_conditions_adjust(0, &conditions);
- #define macro_f_thread_conditions_t_increase(status, conditions) status = f_thread_conditions_increase(conditions);
+ #define macro_f_thread_conditions_t_increase(status, step, conditions) status = f_thread_conditions_increase(step, conditions);
#define macro_f_thread_conditions_t_increase_by(status, conditions, amount) status = f_thread_conditions_increase_by(amount, conditions);
#define macro_f_thread_conditions_t_decrease_by(status, conditions, amount) status = f_thread_conditions_decrease_by(amount, conditions);
#define macro_f_thread_conditions_t_decimate_by(status, conditions, amount) status = f_thread_conditions_decimate_by(amount, conditions);
#define macro_f_thread_condition_attributes_t_delete_simple(attributes) f_thread_condition_attributes_resize(0, &condition_attributes);
#define macro_f_thread_condition_attributes_t_destroy_simple(attributes) f_thread_condition_attributes_adjust(0, &condition_attributes);
- #define macro_f_thread_condition_attributes_t_increase(status, attributes) status = f_thread_condition_attributes_increase(attributes);
+ #define macro_f_thread_condition_attributes_t_increase(status, step, attributes) status = f_thread_condition_attributes_increase(step, attributes);
#define macro_f_thread_condition_attributes_t_increase_by(status, attributes, amount) status = f_thread_condition_attributes_increase_by(amount, attributes);
#define macro_f_thread_condition_attributes_t_decrease_by(status, attributes, amount) status = f_thread_condition_attributes_decrease_by(amount, attributes);
#define macro_f_thread_condition_attributes_t_decimate_by(status, attributes, amount) status = f_thread_condition_attributes_decimate_by(amount, attributes);
#define macro_f_thread_ids_t_delete_simple(ids) macro_f_memory_structure_delete_simple(ids, f_thread_id_t)
#define macro_f_thread_ids_t_destroy_simple(ids) macro_f_memory_structure_destroy_simple(ids, f_thread_id_t)
- #define macro_f_thread_ids_t_increase(status, ids) macro_f_memory_structure_increase(status, ids, f_thread_id_t)
+ #define macro_f_thread_ids_t_increase(status, step, ids) macro_f_memory_structure_increase(status, step, ids, f_thread_id_t)
#define macro_f_thread_ids_t_increase_by(status, ids, amount) macro_f_memory_structure_increase_by(status, ids, f_thread_id_t, amount)
#define macro_f_thread_ids_t_decrease_by(status, ids, amount) macro_f_memory_structure_decrease_by(status, ids, f_thread_id_t, amount)
#define macro_f_thread_ids_t_decimate_by(status, ids, amount) macro_f_memory_structure_decimate_by(status, ids, f_thread_id_t, amount)
#define macro_f_thread_keys_t_delete_simple(keys) f_thread_keys_resize(0, &keys);
#define macro_f_thread_keys_t_destroy_simple(keys) f_thread_keys_adjust(0, &keys);
- #define macro_f_thread_keys_t_increase(status, keys) status = f_thread_keys_increase(keys);
+ #define macro_f_thread_keys_t_increase(status, step, keys) status = f_thread_keys_increase(step, keys);
#define macro_f_thread_keys_t_increase_by(status, keys, amount) status = f_thread_keys_increase_by(amount, keys);
#define macro_f_thread_keys_t_decrease_by(status, keys, amount) status = f_thread_keys_decrease_by(amount, keys);
#define macro_f_thread_keys_t_decimate_by(status, keys, amount) status = f_thread_keys_decimate_by(amount, keys);
#define macro_f_thread_locks_t_delete_simple(locks) macro_f_memory_structure_delete_simple(locks, f_thread_lock_t)
#define macro_f_thread_locks_t_destroy_simple(locks) macro_f_memory_structure_destroy_simple(locks, f_thread_lock_t)
- #define macro_f_thread_locks_t_increase(status, locks) macro_f_memory_structure_increase(status, locks, f_thread_lock_t)
+ #define macro_f_thread_locks_t_increase(status, step, locks) macro_f_memory_structure_increase(status, step, locks, f_thread_lock_t)
#define macro_f_thread_locks_t_increase_by(status, locks, amount) macro_f_memory_structure_increase_by(status, locks, f_thread_lock_t, amount)
#define macro_f_thread_locks_t_decrease_by(status, locks, amount) macro_f_memory_structure_decrease_by(status, locks, f_thread_lock_t, amount)
#define macro_f_thread_locks_t_decimate_by(status, locks, amount) macro_f_memory_structure_decimate_by(status, locks, f_thread_lock_t, amount)
#define macro_f_thread_lock_attributes_t_delete_simple(attributes) f_thread_lock_attributes_resize(0, &attributes);
#define macro_f_thread_lock_attributes_t_destroy_simple(attributes) f_thread_lock_attributes_adjust(0, &attributes);
- #define macro_f_thread_lock_attributes_t_increase(status, attributes) status = f_thread_lock_attributes_increase(attributes);
+ #define macro_f_thread_lock_attributes_t_increase(status, step, attributes) status = f_thread_lock_attributes_increase(step, attributes);
#define macro_f_thread_lock_attributes_t_increase_by(status, attributes, amount) status = f_thread_lock_attributes_increase_by(amount, attributes);
#define macro_f_thread_lock_attributes_t_decrease_by(status, attributes, amount) status = f_thread_lock_attributes_decrease_by(amount, attributes);
#define macro_f_thread_lock_attributes_t_decimate_by(status, attributes, amount) status = f_thread_lock_attributes_decimate_by(amount, attributes);
#define macro_f_thread_mutexs_t_delete_simple(mutexs) f_thread_mutexs_resize(0, &mutexs);
#define macro_f_thread_mutexs_t_destroy_simple(mutexs) f_thread_mutexs_adjust(0, &mutexs);
- #define macro_f_thread_mutexs_t_increase(status, mutexs) status = f_thread_mutexs_increase(mutexs);
+ #define macro_f_thread_mutexs_t_increase(status, step, mutexs) status = f_thread_mutexs_increase(step, mutexs);
#define macro_f_thread_mutexs_t_increase_by(status, mutexs, amount) status = f_thread_mutexs_increase_by(amount, mutexs);
#define macro_f_thread_mutexs_t_decrease_by(status, mutexs, amount) status = f_thread_mutexs_decrease_by(amount, mutexs);
#define macro_f_thread_mutexs_t_decimate_by(status, mutexs, amount) status = f_thread_mutexs_decimate_by(amount, mutexs);
#define macro_f_thread_mutex_attributes_t_delete_simple(attributes) f_thread_mutex_attributes_resize(0, &attributes);
#define macro_f_thread_mutex_attributes_t_destroy_simple(attributes) f_thread_mutex_attributes_adjust(0, &attributes);
- #define macro_f_thread_mutex_attributes_t_increase(status, attributes) status = f_thread_mutex_attributes_increase(attributes);
+ #define macro_f_thread_mutex_attributes_t_increase(status, step, attributes) status = f_thread_mutex_attributes_increase(step, attributes);
#define macro_f_thread_mutex_attributes_t_increase_by(status, attributes, amount) status = f_thread_mutex_attributes_increase_by(amount, attributes);
#define macro_f_thread_mutex_attributes_t_decrease_by(status, attributes, amount) status = f_thread_mutex_attributes_decrease_by(amount, attributes);
#define macro_f_thread_mutex_attributes_t_decimate_by(status, attributes, amount) status = f_thread_mutex_attributes_decimate_by(amount, attributes);
#define macro_f_thread_onces_t_delete_simple(onces) macro_f_memory_structure_delete_simple(onces, f_thread_once_t)
#define macro_f_thread_onces_t_destroy_simple(onces) macro_f_memory_structure_destroy_simple(onces, f_thread_once_t)
- #define macro_f_thread_onces_t_increase(status, onces) macro_f_memory_structure_increase(status, onces, f_thread_once_t)
+ #define macro_f_thread_onces_t_increase(status, step, onces) macro_f_memory_structure_increase(status, step, onces, f_thread_once_t)
#define macro_f_thread_onces_t_increase_by(status, onces, amount) macro_f_memory_structure_increase_by(status, onces, f_thread_once_t, amount)
#define macro_f_thread_onces_t_decrease_by(status, onces, amount) macro_f_memory_structure_decrease_by(status, onces, f_thread_once_t, amount)
#define macro_f_thread_onces_t_decimate_by(status, onces, amount) macro_f_memory_structure_decimate_by(status, onces, f_thread_once_t, amount)
#define macro_f_thread_semaphores_t_delete_simple(semaphores) f_thread_semaphores_resize(0, &semaphores);
#define macro_f_thread_semaphores_t_destroy_simple(semaphores) f_thread_semaphores_adjust(0, &semaphores);
- #define macro_f_thread_semaphores_t_increase(status, semaphores) status = f_thread_semaphores_increase(semaphores);
+ #define macro_f_thread_semaphores_t_increase(status, step, semaphores) status = f_thread_semaphores_increase(step, semaphores);
#define macro_f_thread_semaphores_t_increase_by(status, semaphores, amount) status = f_thread_semaphores_increase_by(amount, semaphores);
#define macro_f_thread_semaphores_t_decrease_by(status, semaphores, amount) status = f_thread_semaphores_decrease_by(amount, semaphores);
#define macro_f_thread_semaphores_t_decimate_by(status, semaphores, amount) status = f_thread_semaphores_decimate_by(amount, semaphores);
#define macro_f_thread_sets_t_delete_simple(sets) f_thread_sets_resize(0, &sets);
#define macro_f_thread_sets_t_destroy_simple(sets) f_thread_sets_adjust(0, &sets);
- #define macro_f_thread_sets_t_increase(status, sets) status = f_thread_sets_increase(sets);
+ #define macro_f_thread_sets_t_increase(status, step, sets) status = f_thread_sets_increase(step, sets);
#define macro_f_thread_sets_t_increase_by(status, sets, amount) status = f_thread_sets_increase_by(amount, sets);
#define macro_f_thread_sets_t_decrease_by(status, sets, amount) status = f_thread_sets_decrease_by(amount, sets);
#define macro_f_thread_sets_t_decimate_by(status, sets, amount) status = f_thread_sets_decimate_by(amount, sets);
#define macro_f_thread_spins_t_delete_simple(spins) f_thread_spins_resize(0, &spins);
#define macro_f_thread_spins_t_destroy_simple(spins) f_thread_spins_adjust(0, &spins);
- #define macro_f_thread_spins_t_increase(status, spins) status = f_thread_spins_increase(spins);
+ #define macro_f_thread_spins_t_increase(status, step, spins) status = f_thread_spins_increase(step, spins);
#define macro_f_thread_spins_t_increase_by(status, spins, amount) status = f_thread_spins_increase_by(amount, spins);
#define macro_f_thread_spins_t_decrease_by(status, spins, amount) status = f_thread_spins_decrease_by(amount, spins);
#define macro_f_thread_spins_t_decimate_by(status, spins, amount) status = f_thread_spins_decimate_by(amount, spins);
#endif // _di_f_thread_attributes_decrease_by_
#ifndef _di_f_thread_attributes_increase_
- f_status_t f_thread_attributes_increase(f_thread_attributes_t *attributes) {
+ f_status_t f_thread_attributes_increase(const uint16_t step, f_thread_attributes_t *attributes) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!attributes) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (attributes->used + 1 > attributes->size) {
- f_array_length_t size = attributes->used + f_memory_default_allocation_step;
+ f_array_length_t size = attributes->used + step;
if (size > f_array_length_t_size) {
if (attributes->used + 1 > f_array_length_t_size) {
#endif // _di_f_thread_barrier_attributes_decrease_by_
#ifndef _di_f_thread_barrier_attributes_increase_
- f_status_t f_thread_barrier_attributes_increase(f_thread_barrier_attributes_t *attributes) {
+ f_status_t f_thread_barrier_attributes_increase(const uint16_t step, f_thread_barrier_attributes_t *attributes) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!attributes) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (attributes->used + 1 > attributes->size) {
- f_array_length_t size = attributes->used + f_memory_default_allocation_step;
+ f_array_length_t size = attributes->used + step;
if (size > f_array_length_t_size) {
if (attributes->used + 1 > f_array_length_t_size) {
#endif // _di_f_thread_barriers_decrease_by_
#ifndef _di_f_thread_barriers_increase_
- f_status_t f_thread_barriers_increase(f_thread_barriers_t *barriers) {
+ f_status_t f_thread_barriers_increase(const uint16_t step, f_thread_barriers_t *barriers) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!barriers) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (barriers->used + 1 > barriers->size) {
- f_array_length_t size = barriers->used + f_memory_default_allocation_step;
+ f_array_length_t size = barriers->used + step;
if (size > f_array_length_t_size) {
if (barriers->used + 1 > f_array_length_t_size) {
#endif // _di_f_thread_condition_attributes_decrease_by_
#ifndef _di_f_thread_condition_attributes_increase_
- f_status_t f_thread_condition_attributes_increase(f_thread_condition_attributes_t *attributes) {
+ f_status_t f_thread_condition_attributes_increase(const uint16_t step, f_thread_condition_attributes_t *attributes) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!attributes) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (attributes->used + 1 > attributes->size) {
- f_array_length_t size = attributes->used + f_memory_default_allocation_step;
+ f_array_length_t size = attributes->used + step;
if (size > f_array_length_t_size) {
if (attributes->used + 1 > f_array_length_t_size) {
#endif // _di_f_thread_conditions_decrease_by_
#ifndef _di_f_thread_conditions_increase_
- f_status_t f_thread_conditions_increase(f_thread_conditions_t *conditions) {
+ f_status_t f_thread_conditions_increase(const uint16_t step, f_thread_conditions_t *conditions) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!conditions) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (conditions->used + 1 > conditions->size) {
- f_array_length_t size = conditions->used + f_memory_default_allocation_step;
+ f_array_length_t size = conditions->used + step;
if (size > f_array_length_t_size) {
if (conditions->used + 1 > f_array_length_t_size) {
#endif // _di_f_thread_keys_decrease_by_
#ifndef _di_f_thread_keys_increase_
- f_status_t f_thread_keys_increase(f_thread_keys_t *keys) {
+ f_status_t f_thread_keys_increase(const uint16_t step, f_thread_keys_t *keys) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!keys) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (keys->used + 1 > keys->size) {
- f_array_length_t size = keys->used + f_memory_default_allocation_step;
+ f_array_length_t size = keys->used + step;
if (size > f_array_length_t_size) {
if (keys->used + 1 > f_array_length_t_size) {
#endif // _di_f_thread_lock_attributes_decrease_by_
#ifndef _di_f_thread_lock_attributes_increase_
- f_status_t f_thread_lock_attributes_increase(f_thread_lock_attributes_t *attributes) {
+ f_status_t f_thread_lock_attributes_increase(const uint16_t step, f_thread_lock_attributes_t *attributes) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!attributes) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (attributes->used + 1 > attributes->size) {
- f_array_length_t size = attributes->used + f_memory_default_allocation_step;
+ f_array_length_t size = attributes->used + step;
if (size > f_array_length_t_size) {
if (attributes->used + 1 > f_array_length_t_size) {
#endif // _di_f_thread_locks_decrease_by_
#ifndef _di_f_thread_locks_increase_
- f_status_t f_thread_locks_increase(f_thread_locks_t *locks) {
+ f_status_t f_thread_locks_increase(const uint16_t step, f_thread_locks_t *locks) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!locks) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (locks->used + 1 > locks->size) {
- f_array_length_t size = locks->used + f_memory_default_allocation_step;
+ f_array_length_t size = locks->used + step;
if (size > f_array_length_t_size) {
if (locks->used + 1 > f_array_length_t_size) {
#endif // _di_f_thread_mutex_attributes_decrease_by_
#ifndef _di_f_thread_mutex_attributes_increase_
- f_status_t f_thread_mutex_attributes_increase(f_thread_mutex_attributes_t *attributes) {
+ f_status_t f_thread_mutex_attributes_increase(const uint16_t step, f_thread_mutex_attributes_t *attributes) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!attributes) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (attributes->used + 1 > attributes->size) {
- f_array_length_t size = attributes->used + f_memory_default_allocation_step;
+ f_array_length_t size = attributes->used + step;
if (size > f_array_length_t_size) {
if (attributes->used + 1 > f_array_length_t_size) {
#endif // _di_f_thread_mutexs_decrease_by_
#ifndef _di_f_thread_mutexs_increase_
- f_status_t f_thread_mutexs_increase(f_thread_mutexs_t *mutexs) {
+ f_status_t f_thread_mutexs_increase(const uint16_t step, f_thread_mutexs_t *mutexs) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!mutexs) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (mutexs->used + 1 > mutexs->size) {
- f_array_length_t size = mutexs->used + f_memory_default_allocation_step;
+ f_array_length_t size = mutexs->used + step;
if (size > f_array_length_t_size) {
if (mutexs->used + 1 > f_array_length_t_size) {
#endif // _di_f_thread_semaphores_decrease_by_
#ifndef _di_f_thread_semaphores_increase_
- f_status_t f_thread_semaphores_increase(f_thread_semaphores_t *semaphores) {
+ f_status_t f_thread_semaphores_increase(const uint16_t step, f_thread_semaphores_t *semaphores) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!semaphores) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (semaphores->used + 1 > semaphores->size) {
- f_array_length_t size = semaphores->used + f_memory_default_allocation_step;
+ f_array_length_t size = semaphores->used + step;
if (size > f_array_length_t_size) {
if (semaphores->used + 1 > f_array_length_t_size) {
#endif // _di_f_thread_sets_decrease_by_
#ifndef _di_f_thread_sets_increase_
- f_status_t f_thread_sets_increase(f_thread_sets_t *sets) {
+ f_status_t f_thread_sets_increase(const uint16_t step, f_thread_sets_t *sets) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!sets) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (sets->used + 1 > sets->size) {
- f_array_length_t size = sets->used + f_memory_default_allocation_step;
+ f_array_length_t size = sets->used + step;
if (size > f_array_length_t_size) {
if (sets->used + 1 > f_array_length_t_size) {
#endif // _di_f_thread_spins_decrease_by_
#ifndef _di_f_thread_spins_increase_
- f_status_t f_thread_spins_increase(f_thread_spins_t *spins) {
+ f_status_t f_thread_spins_increase(const uint16_t step, f_thread_spins_t *spins) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!spins) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (spins->used + 1 > spins->size) {
- f_array_length_t size = spins->used + f_memory_default_allocation_step;
+ f_array_length_t size = spins->used + step;
if (size > f_array_length_t_size) {
if (spins->used + 1 > f_array_length_t_size) {
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param attributes
* The string attributes array to resize.
*
* F_parameter (with error bit) if a parameter is invalid.
*/
#ifndef _di_f_thread_attributes_increase_
- extern f_status_t f_thread_attributes_increase(f_thread_attributes_t *attributes);
+ extern f_status_t f_thread_attributes_increase(const uint16_t step, f_thread_attributes_t *attributes);
#endif // _di_f_thread_attributes_increase_
/**
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param attributes
* The thread attributes array to resize.
*
* F_parameter (with error bit) if a parameter is invalid.
*/
#ifndef _di_f_thread_barrier_attributes_increase_
- extern f_status_t f_thread_barrier_attributes_increase(f_thread_barrier_attributes_t *attributes);
+ extern f_status_t f_thread_barrier_attributes_increase(const uint16_t step, f_thread_barrier_attributes_t *attributes);
#endif // _di_f_thread_barrier_attributes_increase_
/**
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param barriers
* The thread barriers array to resize.
*
* F_parameter (with error bit) if a parameter is invalid.
*/
#ifndef _di_f_thread_barriers_increase_
- extern f_status_t f_thread_barriers_increase(f_thread_barriers_t *barriers);
+ extern f_status_t f_thread_barriers_increase(const uint16_t step, f_thread_barriers_t *barriers);
#endif // _di_f_thread_barriers_increase_
/**
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param attributes
* The string attributes array to resize.
*
* F_parameter (with error bit) if a parameter is invalid.
*/
#ifndef _di_f_thread_condition_attributes_increase_
- extern f_status_t f_thread_condition_attributes_increase(f_thread_condition_attributes_t *attributes);
+ extern f_status_t f_thread_condition_attributes_increase(const uint16_t step, f_thread_condition_attributes_t *attributes);
#endif // _di_f_thread_condition_attributes_increase_
/**
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param conditions
* The string conditions array to resize.
*
* F_parameter (with error bit) if a parameter is invalid.
*/
#ifndef _di_f_thread_conditions_increase_
- extern f_status_t f_thread_conditions_increase(f_thread_conditions_t *conditions);
+ extern f_status_t f_thread_conditions_increase(const uint16_t step, f_thread_conditions_t *conditions);
#endif // _di_f_thread_conditions_increase_
/**
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param keys
* The string keys array to resize.
*
* F_parameter (with error bit) if a parameter is invalid.
*/
#ifndef _di_f_thread_keys_increase_
- extern f_status_t f_thread_keys_increase(f_thread_keys_t *keys);
+ extern f_status_t f_thread_keys_increase(const uint16_t step, f_thread_keys_t *keys);
#endif // _di_f_thread_keys_increase_
/**
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param attributes
* The string attributes array to resize.
*
* F_parameter (with error bit) if a parameter is invalid.
*/
#ifndef _di_f_thread_lock_attributes_increase_
- extern f_status_t f_thread_lock_attributes_increase(f_thread_lock_attributes_t *attributes);
+ extern f_status_t f_thread_lock_attributes_increase(const uint16_t step, f_thread_lock_attributes_t *attributes);
#endif // _di_f_thread_lock_attributes_increase_
/**
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param locks
* The string locks array to resize.
*
* F_parameter (with error bit) if a parameter is invalid.
*/
#ifndef _di_f_thread_locks_increase_
- extern f_status_t f_thread_locks_increase(f_thread_locks_t *locks);
+ extern f_status_t f_thread_locks_increase(const uint16_t step, f_thread_locks_t *locks);
#endif // _di_f_thread_locks_increase_
/**
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param attributes
* The string attributes array to resize.
*
* F_parameter (with error bit) if a parameter is invalid.
*/
#ifndef _di_f_thread_mutex_attributes_increase_
- extern f_status_t f_thread_mutex_attributes_increase(f_thread_mutex_attributes_t *attributes);
+ extern f_status_t f_thread_mutex_attributes_increase(const uint16_t step, f_thread_mutex_attributes_t *attributes);
#endif // _di_f_thread_mutex_attributes_increase_
/**
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param mutexs
* The string mutexs array to resize.
*
* F_parameter (with error bit) if a parameter is invalid.
*/
#ifndef _di_f_thread_mutexs_increase_
- extern f_status_t f_thread_mutexs_increase(f_thread_mutexs_t *mutexs);
+ extern f_status_t f_thread_mutexs_increase(const uint16_t step, f_thread_mutexs_t *mutexs);
#endif // _di_f_thread_mutexs_increase_
/**
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param semaphores
* The string semaphores array to resize.
*
* F_parameter (with error bit) if a parameter is invalid.
*/
#ifndef _di_f_thread_semaphores_increase_
- extern f_status_t f_thread_semaphores_increase(f_thread_semaphores_t *semaphores);
+ extern f_status_t f_thread_semaphores_increase(const uint16_t step, f_thread_semaphores_t *semaphores);
#endif // _di_f_thread_semaphores_increase_
/**
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param sets
* The string sets array to resize.
*
* F_parameter (with error bit) if a parameter is invalid.
*/
#ifndef _di_f_thread_sets_increase_
- extern f_status_t f_thread_sets_increase(f_thread_sets_t *sets);
+ extern f_status_t f_thread_sets_increase(const uint16_t step, f_thread_sets_t *sets);
#endif // _di_f_thread_sets_increase_
/**
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param spins
* The string spins array to resize.
*
* F_parameter (with error bit) if a parameter is invalid.
*/
#ifndef _di_f_thread_spins_increase_
- extern f_status_t f_thread_spins_increase(f_thread_spins_t *spins);
+ extern f_status_t f_thread_spins_increase(const uint16_t step, f_thread_spins_t *spins);
#endif // _di_f_thread_spins_increase_
/**
#endif
/**
- * Status type.
+ * Compiler-specific attribute visibility features.
+ *
+ * Use these macros for visibility-specific tweaks so that if these are not supported by any given compiler, then they can be easily disabled.
+ *
+ * f_attribute_visibility_internal provides a way to make some functions effectively private.
+ */
+#ifndef _di_f_attribute_visibility_
+ #define f_attribute_visibility_hidden __attribute__((visibility("hidden")))
+ #define f_attribute_visibility_internal __attribute__((visibility("internal")))
+ #define f_attribute_visibility_protected __attribute__((visibility("protected")))
+ #define f_attribute_visibility_public __attribute__((visibility("default")))
+#endif // _di_f_attribute_visibility_
+
+/**
+ * A status intended to be used as the return value status of some function or operation.
*/
#ifndef _di_f_type_status_t_
typedef uint16_t f_status_t;
#endif // _di_f_type_status_t_
/**
+ * A representation of a state to be shared between different levels for some function.
+ *
+ * This is used to provide advanced controls on different levels of the project to something outside.
+ *
+ * The allocate provides an allocation step so that the caller can determine a better performing allocation step for their purpose.
+ * For example, if the caller knows that they need to allocate a hundred megabytes of data of which is separated into blocks of 8k, then allocate could be set to 8192.
+ *
+ * There are two standard callbacks that are expected to be commonly available: interrupt() and handle().
+ * Additional callbacks are stored in the structure "callbacks" as defined by the class requiring the use of this structure (f_state_t).
+ *
+ * All state values may be NULL, in which case they are to be ignored.
+ *
+ * The general interpretation of the return results of interrupt() or any of the functions should have an error bit to designate an error and not an error bit to designate no error.
+ * In the case of interrupt(), the F_interrupt and F_interrupt_not must be returned as appropriate and if not an error (the F_interrupt and F_interrupt_not may have an error bit).
+ * To keep the logic simple, it is recommended that F_interrupt always be returned with the error bit set.
+ *
+ * The general interpretation of handle() is to either print an error message or to perform additional tasks when an error occurs (such as saving state data for use at a higher level).
+ * This allows for the error to be processed with all relevant data before the function returns.
+ *
+ * These two callbacks (handle() and interrupt()) accept the following parameters:
+ * - error: The current status code (with error bit as appropriate) (only passed to handle()).
+ * - state: The state data. Must be of type f_state_t. Must not be NULL.
+ * - internal: Additional data passed by the function being called, often containing internal data to the called function. May be NULL.
+ *
+ * The "custom" property on f_state_t is intended to be used so that the callback, such as the interrupt(), can make changes to something within the scope of the parent.
+ *
+ * For example:
+ * There exists some project "bob" with some functions "bob_does()" and "bob_interrupts()".
+ * The function "bob_does()" maintains a state (f_state_t) called "bob_state".
+ * The function "bob_does()" will call "f_talk()" that accepts a state (f_state_t) and defines the data structure type "f_interject_t" to be called interject.
+ * While "f_talk()" executes, "bob_interrupts()" is periodically with the state (f_state_t) "bob_state" as the first parameter and the data structure (f_interject_t) "interject" as the second parameter.
+ * If Bob interjects the talk, then bob_interrupts() would return F_interrupt.
+ * If Bob does not interject the talk, then bob_interrupts() would return F_interrupt_not.
+ * This response is handled within f_talk().
+ * The f_talk() function will then return status when done and might immediately return with F_interrupt (with error bit) if bob_interrupts() returns F_interrupt (with/without error bit).
+ *
+ * step_large: The allocation step to use for large buffers.
+ * step_small: The allocation step to use for small buffers.
+ * handle: A function to call on a specific error (allowing for the error to be handled before function returns). May be NULL.
+ * interrupt: A function to call for checking to see if an interrupt is to be called (return result is passed to and handled by caller). May be NULL.
+ * callbacks: A structure (defined by function/project using this) of additional functions to call. May be NULL.
+ * custom: A structure (defined by caller/parent) for holding custom data to be passed along to the interrupt() or one of the functions. May be NULL.
+ * data: A structure (defined by function) for holding data relevant to the function. May be NULL. May be required.
+ */
+#ifndef _di_f_type_state_t_
+ typedef struct {
+ uint16_t step_large;
+ uint16_t step_small;
+
+ f_status_t (*handle)(const f_status_t error, void *state, void *internal);
+ f_status_t (*interrupt)(void *state, void *internal);
+
+ void *callbacks;
+ void *custom;
+ void *data;
+ } f_state_t;
+
+ #define f_state_t_initialize { f_memory_default_allocation_large, f_memory_default_allocation_small, 0, 0, 0, 0, 0 }
+
+ #define macro_f_state_t_initialize(step_large, step_small, handle, interrupt, callbacks, custom, data) { \
+ step_large, \
+ step_small, \
+ handle, \
+ interrupt, \
+ callbacks, \
+ custom, \
+ data \
+ }
+
+ #define macro_f_state_t_clear(state) \
+ state.step_large = 0; \
+ state.step_small = 0; \
+ state.handle = 0; \
+ state.interrupt = 0; \
+ state.callbacks = 0; \
+ state.custom = 0; \
+ state.data = 0;
+#endif // _di_f_type_state_t_
+
+/**
* Conditional 128-bit support.
*
* This should work in GCC, but other compilers this may not be available.
#endif // _di_f_cell_t_
/**
- * Compiler-specific attribute visibility features.
+ * An array of f_cell_t.
*
- * Use these macros for visibility-specific tweaks so that if these are not supported by any given compiler, then they can be easily disabled.
+ * The macros are defined in type_array.h or type_array-common.h.
*
- * f_attribute_visibility_internal provides a way to make some functions effectively private.
+ * array: The array of f_cell_t.
+ * size: Total amount of allocated space.
+ * used: Total number of allocated spaces used.
*/
-#ifndef _di_f_attribute_visibility_
- #define f_attribute_visibility_hidden __attribute__((visibility("hidden")))
- #define f_attribute_visibility_internal __attribute__((visibility("internal")))
- #define f_attribute_visibility_protected __attribute__((visibility("protected")))
- #define f_attribute_visibility_public __attribute__((visibility("default")))
-#endif // _di_f_attribute_visibility_
+#ifndef _di_f_cells_t_
+ typedef struct {
+ f_cell_t *array;
+
+ f_array_length_t size;
+ f_array_length_t used;
+ } f_cells_t;
+
+ #define f_cells_t_initialize { 0, 0, 0 }
+#endif // _di_f_cells_t_
+
+/**
+ * This holds an array of f_cells_t.
+ *
+ * The macros are defined in type_array.h or type_array-common.h.
+ *
+ * array: The array of f_cell_t arrays.
+ * size: Total amount of allocated space.
+ * used: Total number of allocated spaces used.
+ */
+#ifndef _di_f_cellss_t_
+ typedef struct {
+ f_cells_t *array;
+
+ f_array_length_t size;
+ f_array_length_t used;
+ } f_cellss_t;
+
+ #define f_cellss_t_initialize { 0, 0, 0 }
+#endif // _di_f_cellss_t_
/**
* A structure representing a set of modes intended to be used by file or directory operations.
#endif // _di_f_array_lengthss_t_
/**
- * An array of f_cell_t.
- *
- * The macros are defined in type_array.h or type_array-common.h.
- *
- * array: The array of f_cell_t.
- * size: Total amount of allocated space.
- * used: Total number of allocated spaces used.
- */
-#ifndef _di_f_cells_t_
- typedef struct {
- f_cell_t *array;
-
- f_array_length_t size;
- f_array_length_t used;
- } f_cells_t;
-
- #define f_cells_t_initialize { 0, 0, 0 }
-#endif // _di_f_cells_t_
-
-/**
- * This holds an array of f_cells_t.
- *
- * The macros are defined in type_array.h or type_array-common.h.
- *
- * array: The array of f_cell_t arrays.
- * size: Total amount of allocated space.
- * used: Total number of allocated spaces used.
- */
-#ifndef _di_f_cellss_t_
- typedef struct {
- f_cells_t *array;
-
- f_array_length_t size;
- f_array_length_t used;
- } f_cellss_t;
-
- #define f_cellss_t_initialize { 0, 0, 0 }
-#endif // _di_f_cellss_t_
-
-/**
* An array of array int8_t.
*
* The macros are defined in type_array.h or type_array-common.h.
} f_int32s_t;
#define f_int32s_t_initialize { 0, 0, 0 }
+
+ #define macro_f_int32s_t_initialize(structure)
#endif // _di_int32s_t_
/**
#define f_uint128ss_t_initialize { 0, 0, 0 }
#endif // _di_uint128ss_t_
+/**
+ * This holds an array of f_status_t.
+ *
+ * The macros are defined in type_array.h or type_array-common.h.
+ *
+ * array: The array of f_status_t arrays.
+ * size: Total amount of allocated space.
+ * used: Total number of allocated spaces used.
+ */
+#ifndef _di_f_type_statuss_t_
+ typedef struct {
+ f_status_t *array;
+
+ f_array_length_t size;
+ f_array_length_t used;
+ } f_statuss_t;
+
+ #define f_statuss_t_initialize { 0, 0, 0 }
+#endif // _di_f_type_statuss_t_
+
+/**
+ * This holds an array of f_statuss_t.
+ *
+ * The macros are defined in type_array.h or type_array-common.h.
+ *
+ * array: The array of f_status_t arrays.
+ * size: Total amount of allocated space.
+ * used: Total number of allocated spaces used.
+ */
+#ifndef _di_f_type_statusss_t_
+ typedef struct {
+ f_statuss_t *array;
+
+ f_array_length_t size;
+ f_array_length_t used;
+ } f_statusss_t;
+
+ #define f_statusss_t_initialize { 0, 0, 0 }
+#endif // _di_f_type_statusss_t_
+
+/**
+ * This holds an array of f_state_t.
+ *
+ * The macros are defined in type_array.h or type_array-common.h.
+ *
+ * array: The array of f_state_t arrays.
+ * size: Total amount of allocated space.
+ * used: Total number of allocated spaces used.
+ */
+#ifndef _di_f_type_states_t_
+ typedef struct {
+ f_state_t *array;
+
+ f_array_length_t size;
+ f_array_length_t used;
+ } f_states_t;
+
+ #define f_states_t_initialize { 0, 0, 0 }
+#endif // _di_f_type_states_t_
+
+/**
+ * This holds an array of f_states_t.
+ *
+ * The macros are defined in type_array.h or type_array-common.h.
+ *
+ * array: The array of f_state_t arrays.
+ * size: Total amount of allocated space.
+ * used: Total number of allocated spaces used.
+ */
+#ifndef _di_f_type_statess_t_
+ typedef struct {
+ f_states_t *array;
+
+ f_array_length_t size;
+ f_array_length_t used;
+ } f_statess_t;
+
+ #define f_statess_t_initialize { 0, 0, 0 }
+#endif // _di_f_type_statess_t_
+
#ifdef __cplusplus
} // extern "C"
#endif
#endif
/**
+ * Macros for f_statuss_t, see type.h for typedefs.
+ */
+#ifndef _di_f_statuss_t_
+ #define macro_f_statuss_t_clear(statuss) macro_f_memory_structure_clear(statuss)
+
+ #define macro_f_statuss_t_resize(status, statuss, length) macro_f_memory_structure_resize(status, statuss, f_status_t, length)
+ #define macro_f_statuss_t_adjust(status, statuss, length) macro_f_memory_structure_adjust(status, statuss, f_status_t, length)
+
+ #define macro_f_statuss_t_delete_simple(statuss) macro_f_memory_structure_delete_simple(statuss, f_status_t)
+ #define macro_f_statuss_t_destroy_simple(statuss) macro_f_memory_structure_destroy_simple(statuss, f_status_t)
+
+ #define macro_f_statuss_t_increase(status, step, statuss) macro_f_memory_structure_increase(status, step, statuss, f_status_t)
+ #define macro_f_statuss_t_increase_by(status, statuss, amount) macro_f_memory_structure_increase_by(status, statuss, f_status_t, amount)
+ #define macro_f_statuss_t_decrease_by(status, statuss, amount) macro_f_memory_structure_decrease_by(status, statuss, f_status_t, amount)
+ #define macro_f_statuss_t_decimate_by(status, statuss, amount) macro_f_memory_structure_decimate_by(status, statuss, f_status_t, amount)
+#endif // _di_f_statuss_t_
+
+/**
+ * Macros for f_statusss_t, see type.h for typedefs.
+ */
+#ifndef _di_f_statusss_t_
+ #define macro_f_statusss_t_clear(rangess) macro_f_memory_structures_clear(rangess)
+
+ #define macro_f_statusss_t_resize(status, statusss, length) status = f_type_statusss_resize(length, &statusss);
+ #define macro_f_statusss_t_adjust(status, statusss, length) status = f_type_statusss_adjust(length, &statusss);
+
+ #define macro_f_statusss_t_delete_simple(statusss) f_type_statusss_resize(0, &statusss);
+ #define macro_f_statusss_t_destroy_simple(statusss) f_type_statusss_adjust(0, &statusss);
+
+ #define macro_f_statusss_t_increase(status, step, statusss) status = f_type_statusss_increase(step, &statusss);
+ #define macro_f_statusss_t_increase_by(status, statusss, amount) status = f_type_statusss_increase_by(amount, &statusss);
+ #define macro_f_statusss_t_decrease_by(status, statusss, amount) status = f_type_statusss_decrease_by(amount, &statusss);
+ #define macro_f_statusss_t_decimate_by(status, statusss, amount) status = f_type_statusss_decimate_by(amount, &statusss);
+#endif // _di_f_statusss_t_
+
+/**
+ * Macros for f_states_t, see type.h for typedefs.
+ */
+#ifndef _di_f_states_t_
+ #define macro_f_states_t_clear(states) macro_f_memory_structure_clear(states)
+
+ #define macro_f_states_t_resize(status, states, length) macro_f_memory_structure_resize(status, states, f_state_t, length)
+ #define macro_f_states_t_adjust(status, states, length) macro_f_memory_structure_adjust(status, states, f_state_t, length)
+
+ #define macro_f_states_t_delete_simple(states) macro_f_memory_structure_delete_simple(states, f_state_t)
+ #define macro_f_states_t_destroy_simple(states) macro_f_memory_structure_destroy_simple(states, f_state_t)
+
+ #define macro_f_states_t_increase(status,step, states) macro_f_memory_structure_increase(status, step, states, f_state_t)
+ #define macro_f_states_t_increase_by(status, states, amount) macro_f_memory_structure_increase_by(status, states, f_state_t, amount)
+ #define macro_f_states_t_decrease_by(status, states, amount) macro_f_memory_structure_decrease_by(status, states, f_state_t, amount)
+ #define macro_f_states_t_decimate_by(status, states, amount) macro_f_memory_structure_decimate_by(status, states, f_state_t, amount)
+#endif // _di_f_states_t_
+
+/**
+ * Macros for f_statess_t, see type.h for typedefs.
+ */
+#ifndef _di_f_statess_t_
+ #define macro_f_statess_t_clear(rangess) macro_f_memory_structures_clear(rangess)
+
+ #define macro_f_statess_t_resize(status, statess, length) status = f_type_statess_resize(length, &statess);
+ #define macro_f_statess_t_adjust(status, statess, length) status = f_type_statess_adjust(length, &statess);
+
+ #define macro_f_statess_t_delete_simple(statess) f_type_statess_resize(0, &statess);
+ #define macro_f_statess_t_destroy_simple(statess) f_type_statess_adjust(0, &statess);
+
+ #define macro_f_statess_t_increase(status, step, statess) status = f_type_statess_increase(step, &statess);
+ #define macro_f_statess_t_increase_by(status, statess, amount) status = f_type_statess_increase_by(amount, &statess);
+ #define macro_f_statess_t_decrease_by(status, statess, amount) status = f_type_statess_decrease_by(amount, &statess);
+ #define macro_f_statess_t_decimate_by(status, statess, amount) status = f_type_statess_decimate_by(amount, &statess);
+#endif // _di_f_statess_t_
+
+/**
* Macros for f_array_lengths_t, see type.h for typedefs.
*/
#ifndef _di_f_array_lengths_t_
#define macro_f_array_lengths_t_delete_simple(lengths) macro_f_memory_structure_delete_simple(lengths, f_array_length_t)
#define macro_f_array_lengths_t_destroy_simple(lengths) macro_f_memory_structure_destroy_simple(lengths, f_array_length_t)
- #define macro_f_array_lengths_t_increase(status, lengths) macro_f_memory_structure_increase(status, lengths, f_array_length_t)
+ #define macro_f_array_lengths_t_increase(status, step, lengths) macro_f_memory_structure_increase(status, step, lengths, f_array_length_t)
#define macro_f_array_lengths_t_increase_by(status, lengths, amount) macro_f_memory_structure_increase_by(status, lengths, f_array_length_t, amount)
#define macro_f_array_lengths_t_decrease_by(status, lengths, amount) macro_f_memory_structure_decrease_by(status, lengths, f_array_length_t, amount)
#define macro_f_array_lengths_t_decimate_by(status, lengths, amount) macro_f_memory_structure_decimate_by(status, lengths, f_array_length_t, amount)
#define macro_f_array_lengthss_t_delete_simple(lengths) f_type_array_lengthss_resize(0, &lengths);
#define macro_f_array_lengthss_t_destroy_simple(lengths) f_type_array_lengthss_adjust(0, &lengths);
- #define macro_f_array_lengthss_t_increase(status, lengths) status = f_type_array_lengthss_increase(&lengths);
- #define macro_f_array_lengthss_t_increase_by(status, lengths, amount) status = f_type_array_lengthss_increase(amount, &lengths);
+ #define macro_f_array_lengthss_t_increase(status, step, lengths) status = f_type_array_lengthss_increase(step, &lengths);
+ #define macro_f_array_lengthss_t_increase_by(status, lengths, amount) status = f_type_array_lengthss_increase_by(amount, &lengths);
#define macro_f_array_lengthss_t_decrease_by(status, lengths, amount) status = f_type_array_lengthss_decrease_by(amount, &lengths);
#define macro_f_array_lengthss_t_decimate_by(status, lengths, amount) status = f_type_array_lengthss_decimate_by(amount, &lengths);
#endif // _di_f_array_lengthss_t_
/**
- * Macros for f_array_lengths_t, see type.h for typedefs.
+ * Macros for f_cells_t, see type.h for typedefs.
*/
#ifndef _di_f_cells_t_
#define macro_f_cells_t_clear(cells) macro_f_memory_structure_clear(cells)
#define macro_f_cells_t_delete_simple(cells) macro_f_memory_structure_delete_simple(cells, f_cell_t)
#define macro_f_cells_t_destroy_simple(cells) macro_f_memory_structure_destroy_simple(cells, f_cell_t)
- #define macro_f_cells_t_increase(status, cells) macro_f_memory_structure_increase(status, cells, f_cell_t)
+ #define macro_f_cells_t_increase(status, step, cells) macro_f_memory_structure_increase(status, step, cells, f_cell_t)
#define macro_f_cells_t_increase_by(status, cells, amount) macro_f_memory_structure_increase_by(status, cells, f_cell_t, amount)
#define macro_f_cells_t_decrease_by(status, cells, amount) macro_f_memory_structure_decrease_by(status, cells, f_cell_t, amount)
#define macro_f_cells_t_decimate_by(status, cells, amount) macro_f_memory_structure_decimate_by(status, cells, f_cell_t, amount)
#endif // _di_f_cells_t_
/**
- * Macros for f_array_lengths_t, see type.h for typedefs.
+ * Macros for f_cellss_t, see type.h for typedefs.
*/
#ifndef _di_f_cellss_t_
#define macro_f_cellss_t_clear(rangess) macro_f_memory_structures_clear(rangess)
#define macro_f_cellss_t_delete_simple(cellss) f_type_cellss_resize(0, &cellss);
#define macro_f_cellss_t_destroy_simple(cellss) f_type_cellss_adjust(0, &cellss);
- #define macro_f_cellss_t_increase(status, cellss) status = f_type_cellss_increase(&cellss);
- #define macro_f_cellss_t_increase_by(status, cellss, amount) status = f_type_cellss_increase(amount, &cellss);
+ #define macro_f_cellss_t_increase(status, step, cellss) status = f_type_cellss_increase(step, &cellss);
+ #define macro_f_cellss_t_increase_by(status, cellss, amount) status = f_type_cellss_increase_by(amount, &cellss);
#define macro_f_cellss_t_decrease_by(status, cellss, amount) status = f_type_cellss_decrease_by(amount, &cellss);
#define macro_f_cellss_t_decimate_by(status, cellss, amount) status = f_type_cellss_decimate_by(amount, &cellss);
#endif // _di_f_cellss_t_
#define macro_f_int8s_t_delete_simple(int8s) macro_f_memory_structure_delete_simple(int8s, int8_t)
#define macro_f_int8s_t_destroy_simple(int8s) macro_f_memory_structure_destroy_simple(int8s, int8_t)
- #define macro_f_int8s_t_increase(status, int8s) macro_f_memory_structure_increase(status, int8s, int8_t)
+ #define macro_f_int8s_t_increase(status, step, int8s) macro_f_memory_structure_increase(status, step, int8s, int8_t)
#define macro_f_int8s_t_increase_by(status, int8s, amount) macro_f_memory_structure_increase_by(status, int8s, int8_t, amount)
#define macro_f_int8s_t_decrease_by(status, int8s, amount) macro_f_memory_structure_decrease_by(status, int8s, int8_t, amount)
#define macro_f_int8s_t_decimate_by(status, int8s, amount) macro_f_memory_structure_decimate_by(status, int8s, int8_t, amount)
#define macro_f_int8ss_t_resize(status, int8ss, length) status = f_type_int8ss_resize(length, &int8ss);
#define macro_f_int8ss_t_adjust(status, int8ss, length) status = f_type_int8ss_adjust(length, &int8ss);
- #define macro_f_int8ss_t_increase(status, int8ss) status = f_type_int8ss_increase(&int8ss);
- #define macro_f_int8ss_t_increase_by(status, int8ss, amount) status = f_type_int8ss_increase(amount, &int8ss);
+ #define macro_f_int8ss_t_increase(status, step, int8ss) status = f_type_int8ss_increase(step, &int8ss);
+ #define macro_f_int8ss_t_increase_by(status, int8ss, amount) status = f_type_int8ss_increase_by(amount, &int8ss);
#define macro_f_int8ss_t_decrease_by(status, int8ss, amount) status = f_type_int8ss_decrease_by(amount, &int8ss);
#define macro_f_int8ss_t_decimate_by(status, int8ss, amount) status = f_type_int8ss_decimate_by(amount, &int8ss);
#define macro_f_uint8s_t_resize(status, uint8s, length) macro_f_memory_structure_resize(status, uint8s, uint8_t, length)
#define macro_f_uint8s_t_adjust(status, uint8s, length) macro_f_memory_structure_adjust(status, uint8s, uint8_t, length)
- #define macro_f_uint8s_t_increase(status, uint8s) macro_f_memory_structure_increase(status, uint8s, uint8_t)
+ #define macro_f_uint8s_t_increase(status, step, uint8s) macro_f_memory_structure_increase(status, step, uint8s, uint8_t)
#define macro_f_uint8s_t_increase_by(status, uint8s, amount) macro_f_memory_structure_increase_by(status, uint8s, uint8_t, amount)
#define macro_f_uint8s_t_decrease_by(status, uint8s, amount) macro_f_memory_structure_decrease_by(status, uint8s, uint8_t, amount)
#define macro_f_uint8s_t_decimate_by(status, uint8s, amount) macro_f_memory_structure_decimate_by(status, uint8s, uint8_t, amount)
#define macro_f_uint8ss_t_delete_simple(uint8ss) f_type_uint8ss_resize(0, &uint8ss);
#define macro_f_uint8ss_t_destroy_simple(uint8ss) f_type_uint8ss_adjust(0, &uint8ss);
- #define macro_f_uint8ss_t_increase(status, uint8ss) status = f_type_uint8ss_increase(&uint8ss);
+ #define macro_f_uint8ss_t_increase(status, step, uint8ss) status = f_type_uint8ss_increase(step, &uint8ss);
#define macro_f_uint8ss_t_increase_by(status, uint8ss, amount) status = f_type_uint8ss_increase(amount, &uint8ss);
#define macro_f_uint8ss_t_decrease_by(status, uint8ss, amount) status = f_type_uint8ss_decrease_by(amount, &uint8ss);
#define macro_f_uint8ss_t_decimate_by(status, uint8ss, amount) status = f_type_uint8ss_decimate_by(amount, &uint8ss);
#define macro_f_int16s_t_delete_simple(int16s) macro_f_memory_structure_delete_simple(int16s, int16_t)
#define macro_f_int16s_t_destroy_simple(int16s) macro_f_memory_structure_destroy_simple(int16s, int16_t)
- #define macro_f_int16s_t_increase(status, int16s) macro_f_memory_structure_increase(status, int16s, int16_t)
+ #define macro_f_int16s_t_increase(status, step, int16s) macro_f_memory_structure_increase(status, step, int16s, int16_t)
#define macro_f_int16s_t_increase_by(status, int16s, amount) macro_f_memory_structure_increase_by(status, int16s, int16_t, amount)
#define macro_f_int16s_t_decrease_by(status, int16s, amount) macro_f_memory_structure_decrease_by(status, int16s, int16_t, amount)
#define macro_f_int16s_t_decimate_by(status, int16s, amount) macro_f_memory_structure_decimate_by(status, int16s, int16_t, amount)
#define macro_f_int16ss_t_resize(status, int16ss, length) status = f_type_int16ss_resize(length, &int16ss);
#define macro_f_int16ss_t_adjust(status, int16ss, length) status = f_type_int16ss_adjust(length, &int16ss);
- #define macro_f_int16ss_t_increase(status, int16ss) status = f_type_int16ss_increase(&int16ss);
+ #define macro_f_int16ss_t_increase(status, step, int16ss) status = f_type_int16ss_increase(step, &int16ss);
#define macro_f_int16ss_t_increase_by(status, int16ss, amount) status = f_type_int16ss_increase(amount, &int16ss);
#define macro_f_int16ss_t_decrease_by(status, int16ss, amount) status = f_type_int16ss_decrease_by(amount, &int16ss);
#define macro_f_int16ss_t_decimate_by(status, int16ss, amount) status = f_type_int16ss_decimate_by(amount, &int16ss);
#define macro_f_uint16s_t_delete_simple(uint16s) macro_f_memory_structure_delete_simple(uint16s, uint16_t)
#define macro_f_uint16s_t_destroy_simple(uint16s) macro_f_memory_structure_destroy_simple(uint16s, uint16_t)
- #define macro_f_uint16s_t_increase(status, uint16s) macro_f_memory_structure_increase(status, uint16s, uint16_t)
+ #define macro_f_uint16s_t_increase(status, step, uint16s) macro_f_memory_structure_increase(status, step, uint16s, uint16_t)
#define macro_f_uint16s_t_increase_by(status, uint16s, amount) macro_f_memory_structure_increase_by(status, uint16s, uint16_t, amount)
#define macro_f_uint16s_t_decrease_by(status, uint16s, amount) macro_f_memory_structure_decrease_by(status, uint16s, uint16_t, amount)
#define macro_f_uint16s_t_decimate_by(status, uint16s, amount) macro_f_memory_structure_decimate_by(status, uint16s, uint16_t, amount)
#define macro_f_uint16ss_t_delete_simple(uint16ss) f_type_uint16ss_resize(0, &uint16ss);
#define macro_f_uint16ss_t_destroy_simple(uint16ss) f_type_uint16ss_adjust(0, &uint16ss);
- #define macro_f_uint16ss_t_increase(status, uint16ss) status = f_type_uint16ss_increase(&uint16ss);
+ #define macro_f_uint16ss_t_increase(status, step, uint16ss) status = f_type_uint16ss_increase(step, &uint16ss);
#define macro_f_uint16ss_t_increase_by(status, uint16ss, amount) status = f_type_uint16ss_increase(amount, &uint16ss);
#define macro_f_uint16ss_t_decrease_by(status, uint16ss, amount) status = f_type_uint16ss_decrease_by(amount, &uint16ss);
#define macro_f_uint16ss_t_decimate_by(status, uint16ss, amount) status = f_type_uint16ss_decimate_by(amount, &uint16ss);
#define macro_f_int32s_t_delete_simple(int32s) macro_f_memory_structure_delete_simple(int32s, int32_t)
#define macro_f_int32s_t_destroy_simple(int32s) macro_f_memory_structure_destroy_simple(int32s, int32_t)
- #define macro_f_int32s_t_increase(status, int32s) macro_f_memory_structure_increase(status, int32s, int32_t)
+ #define macro_f_int32s_t_increase(status, step, int32s) macro_f_memory_structure_increase(status, step, int32s, int32_t)
#define macro_f_int32s_t_increase_by(status, int32s, amount) macro_f_memory_structure_increase_by(status, int32s, int32_t, amount)
#define macro_f_int32s_t_decrease_by(status, int32s, amount) macro_f_memory_structure_decrease_by(status, int32s, int32_t, amount)
#define macro_f_int32s_t_decimate_by(status, int32s, amount) macro_f_memory_structure_decimate_by(status, int32s, int32_t, amount)
#define macro_f_int32ss_t_delete_simple(int32ss) f_type_int32ss_resize(0, &int32ss);
#define macro_f_int32ss_t_destroy_simple(int32ss) f_type_int32ss_adjust(0, &int32ss);
- #define macro_f_int32ss_t_increase(status, int32ss) status = f_type_int32ss_increase(&int32ss);
+ #define macro_f_int32ss_t_increase(status, step, int32ss) status = f_type_int32ss_increase(step, &int32ss);
#define macro_f_int32ss_t_increase_by(status, int32ss, amount) status = f_type_int32ss_increase(amount, &int32ss);
#define macro_f_int32ss_t_decrease_by(status, int32ss, amount) status = f_type_int32ss_decrease_by(amount, &int32ss);
#define macro_f_int32ss_t_decimate_by(status, int32ss, amount) status = f_type_int32ss_decimate_by(amount, &int32ss);
#define macro_f_uint32s_t_delete_simple(uint32s) macro_f_memory_structure_delete_simple(uint32s, uint32_t)
#define macro_f_uint32s_t_destroy_simple(uint32s) macro_f_memory_structure_destroy_simple(uint32s, uint32_t)
- #define macro_f_uint32s_t_increase(status, uint32s) macro_f_memory_structure_increase(status, uint32s, uint32_t)
+ #define macro_f_uint32s_t_increase(status, step, uint32s) macro_f_memory_structure_increase(status, step, uint32s, uint32_t)
#define macro_f_uint32s_t_increase_by(status, uint32s, amount) macro_f_memory_structure_increase_by(status, uint32s, uint32_t, amount)
#define macro_f_uint32s_t_decrease_by(status, uint32s, amount) macro_f_memory_structure_decrease_by(status, uint32s, uint32_t, amount)
#define macro_f_uint32s_t_decimate_by(status, uint32s, amount) macro_f_memory_structure_decimate_by(status, uint32s, uint32_t, amount)
#define macro_f_uint32ss_t_delete_simple(uint32ss) f_type_uint32ss_resize(0, &uint32ss);
#define macro_f_uint32ss_t_destroy_simple(uint32ss) f_type_uint32ss_adjust(0, &uint32ss);
- #define macro_f_uint32ss_t_increase(status, uint32ss) status = f_type_uint32ss_increase(&uint32ss);
+ #define macro_f_uint32ss_t_increase(status, step, uint32ss) status = f_type_uint32ss_increase(step, &uint32ss);
#define macro_f_uint32ss_t_increase_by(status, uint32ss, amount) status = f_type_uint32ss_increase(amount, &uint32ss);
#define macro_f_uint32ss_t_decrease_by(status, uint32ss, amount) status = f_type_uint32ss_decrease_by(amount, &uint32ss);
#define macro_f_uint32ss_t_decimate_by(status, uint32ss, amount) status = f_type_uint32ss_decimate_by(amount, &uint32ss);
#define macro_f_int64s_t_delete_simple(int64s) macro_f_memory_structure_delete_simple(int64s, int64_t)
#define macro_f_int64s_t_destroy_simple(int64s) macro_f_memory_structure_destroy_simple(int64s, int64_t)
- #define macro_f_int64s_t_increase(status, int64s) macro_f_memory_structure_increase(status, int64s, int64_t)
+ #define macro_f_int64s_t_increase(status, step, int64s) macro_f_memory_structure_increase(status, step, int64s, int64_t)
#define macro_f_int64s_t_increase_by(status, int64s, amount) macro_f_memory_structure_increase_by(status, int64s, int64_t, amount)
#define macro_f_int64s_t_decrease_by(status, int64s, amount) macro_f_memory_structure_decrease_by(status, int64s, int64_t, amount)
#define macro_f_int64s_t_decimate_by(status, int64s, amount) macro_f_memory_structure_decimate_by(status, int64s, int64_t, amount)
#define macro_f_int64ss_t_resize(status, int64ss, length) status = f_type_int64ss_resize(length, &int64ss);
#define macro_f_int64ss_t_adjust(status, int64ss, length) status = f_type_int64ss_adjust(length, &int64ss);
- #define macro_f_int64ss_t_increase(status, int64ss) status = f_type_int64ss_increase(&int64ss);
+ #define macro_f_int64ss_t_increase(status, step, int64ss) status = f_type_int64ss_increase(step, &int64ss);
#define macro_f_int64ss_t_increase_by(status, int64ss, amount) status = f_type_int64ss_increase(amount, &int64ss);
#define macro_f_int64ss_t_decrease_by(status, int64ss, amount) status = f_type_int64ss_decrease_by(amount, &int64ss);
#define macro_f_int64ss_t_decimate_by(status, int64ss, amount) status = f_type_int64ss_decimate_by(amount, &int64ss);
#define macro_f_uint64s_t_delete_simple(uint64s) macro_f_memory_structure_delete_simple(uint64s, uint64_t)
#define macro_f_uint64s_t_destroy_simple(uint64s) macro_f_memory_structure_destroy_simple(uint64s, uint64_t)
- #define macro_f_uint64s_t_increase(status, uint64s) macro_f_memory_structure_increase(status, uint64s, uint64_t)
+ #define macro_f_uint64s_t_increase(status, step, uint64s) macro_f_memory_structure_increase(status, step, uint64s, uint64_t)
#define macro_f_uint64s_t_increase_by(status, uint64s, amount) macro_f_memory_structure_increase_by(status, uint64s, uint64_t, amount)
#define macro_f_uint64s_t_decrease_by(status, uint64s, amount) macro_f_memory_structure_decrease_by(status, uint64s, uint64_t, amount)
#define macro_f_uint64s_t_decimate_by(status, uint64s, amount) macro_f_memory_structure_decimate_by(status, uint64s, uint64_t, amount)
#define macro_f_uint64ss_t_resize(status, uint64ss, length) status = f_type_uint64ss_resize(length, &uint64ss);
#define macro_f_uint64ss_t_adjust(status, uint64ss, length) status = f_type_uint64ss_adjust(length, &uint64ss);
- #define macro_f_uint64ss_t_increase(status, uint64ss) status = f_type_uint64ss_increase(&uint64ss);
+ #define macro_f_uint64ss_t_increase(status, step, uint64ss) status = f_type_uint64ss_increase(step, &uint64ss);
#define macro_f_uint64ss_t_increase_by(status, uint64ss, amount) status = f_type_uint64ss_increase(amount, &uint64ss);
#define macro_f_uint64ss_t_decrease_by(status, uint64ss, amount) status = f_type_uint64ss_decrease_by(amount, &uint64ss);
#define macro_f_uint64ss_t_decimate_by(status, uint64ss, amount) status = f_type_uint64ss_decimate_by(amount, &uint64ss);
#define macro_f_int128s_t_delete_simple(int128s) macro_f_memory_structure_delete_simple(int128s, f_int128_t)
#define macro_f_int128s_t_destroy_simple(int128s) macro_f_memory_structure_destroy_simple(int128s, f_int128_t)
- #define macro_f_int128s_t_increase(status, int128s) macro_f_memory_structure_increase(status, int128s, f_int128_t)
+ #define macro_f_int128s_t_increase(status, step, int128s) macro_f_memory_structure_increase(status, step, int128s, f_int128_t)
#define macro_f_int128s_t_increase_by(status, int128s, amount) macro_f_memory_structure_increase_by(status, int128s, f_int128_t, amount)
#define macro_f_int128s_t_decrease_by(status, int128s, amount) macro_f_memory_structure_decrease_by(status, int128s, f_int128_t, amount)
#define macro_f_int128s_t_decimate_by(status, int128s, amount) macro_f_memory_structure_decimate_by(status, int128s, f_int128_t, amount)
#define macro_f_int128ss_t_delete_simple(int128ss) f_type_int128ss_resize(0, &int128ss);
#define macro_f_int128ss_t_destroy_simple(int128ss) f_type_int128ss_adjust(0, &int128ss);
- #define macro_f_int128ss_t_increase(status, int128ss) status = f_type_int128ss_increase(&int128ss);
+ #define macro_f_int128ss_t_increase(status, step, int128ss) status = f_type_int128ss_increase(step, &int128ss);
#define macro_f_int128ss_t_increase_by(status, int128ss, amount) status = f_type_int128ss_increase(amount, &int128ss);
#define macro_f_int128ss_t_decrease_by(status, int128ss, amount) status = f_type_int128ss_decrease_by(amount, &int128ss);
#define macro_f_int128ss_t_decimate_by(status, int128ss, amount) status = f_type_int128ss_decimate_by(amount, &int128ss);
#define macro_f_uint128s_t_delete_simple(uint128s) macro_f_memory_structure_delete_simple(uint128s, f_uint128_t)
#define macro_f_uint128s_t_destroy_simple(uint128s) macro_f_memory_structure_destroy_simple(uint128s, f_uint128_t)
- #define macro_f_uint128s_t_increase(status, uint128s) macro_f_memory_structure_increase(status, uint128s, f_uint128_t)
+ #define macro_f_uint128s_t_increase(status, step, uint128s) macro_f_memory_structure_increase(status, step, uint128s, f_uint128_t)
#define macro_f_uint128s_t_increase_by(status, uint128s, amount) macro_f_memory_structure_increase_by(status, uint128s, f_uint128_t, amount)
#define macro_f_uint128s_t_decrease_by(status, uint128s, amount) macro_f_memory_structure_decrease_by(status, uint128s, f_uint128_t, amount)
#define macro_f_uint128s_t_decimate_by(status, uint128s, amount) macro_f_memory_structure_decimate_by(status, uint128s, f_uint128_t, amount)
#define macro_f_uint128ss_t_delete_simple(uint128ss) f_type_uint128ss_resize(0, &uint128ss);
#define macro_f_uint128ss_t_destroy_simple(uint128ss) f_type_uint128ss_adjust(0, &uint128ss);
- #define macro_f_uint128ss_t_increase(status, uint128ss) status = f_type_uint128ss_increase(&uint128ss);
+ #define macro_f_uint128ss_t_increase(status, step, uint128ss) status = f_type_uint128ss_increase(step, &uint128ss);
#define macro_f_uint128ss_t_increase_by(status, uint128ss, amount) status = f_type_uint128ss_increase(amount, &uint128ss);
#define macro_f_uint128ss_t_decrease_by(status, uint128ss, amount) status = f_type_uint128ss_decrease_by(amount, &uint128ss);
#define macro_f_uint128ss_t_decimate_by(status, uint128ss, amount) status = f_type_uint128ss_decimate_by(amount, &uint128ss);
#endif // _di_f_type_cells_decrease_by_
#ifndef _di_f_type_cells_increase_
- f_status_t f_type_cells_increase(f_cells_t *cells) {
+ f_status_t f_type_cells_increase(const uint16_t step, f_cells_t *cells) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!cells) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (cells->used + 1 > cells->size) {
- f_array_length_t size = cells->used + f_memory_default_allocation_step;
+ f_array_length_t size = cells->used + step;
if (size > f_array_length_t_size) {
if (cells->used + 1 > f_array_length_t_size) {
#endif // _di_f_type_cellss_decrease_by_
#ifndef _di_f_type_cellss_increase_
- f_status_t f_type_cellss_increase(f_cellss_t *cellss) {
+ f_status_t f_type_cellss_increase(const uint16_t step, f_cellss_t *cellss) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!cellss) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (cellss->used + 1 > cellss->size) {
- f_array_length_t size = cellss->used + f_memory_default_allocation_step;
+ f_array_length_t size = cellss->used + step;
if (size > f_array_length_t_size) {
if (cellss->used + 1 > f_array_length_t_size) {
#endif // _di_f_type_array_lengths_decrease_by_
#ifndef _di_f_type_array_lengths_increase_
- f_status_t f_type_array_lengths_increase(f_array_lengths_t *lengths) {
+ f_status_t f_type_array_lengths_increase(const uint16_t step, f_array_lengths_t *lengths) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!lengths) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (lengths->used + 1 > lengths->size) {
- f_array_length_t size = lengths->used + f_memory_default_allocation_step;
+ f_array_length_t size = lengths->used + step;
if (size > f_array_length_t_size) {
if (lengths->used + 1 > f_array_length_t_size) {
#endif // _di_f_type_array_lengthss_decrease_by_
#ifndef _di_f_type_array_lengthss_increase_
- f_status_t f_type_array_lengthss_increase(f_array_lengthss_t *lengthss) {
+ f_status_t f_type_array_lengthss_increase(const uint16_t step, f_array_lengthss_t *lengthss) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!lengthss) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (lengthss->used + 1 > lengthss->size) {
- f_array_length_t size = lengthss->used + f_memory_default_allocation_step;
+ f_array_length_t size = lengthss->used + step;
if (size > f_array_length_t_size) {
if (lengthss->used + 1 > f_array_length_t_size) {
#endif // _di_f_type_int8s_decrease_by_
#ifndef _di_f_type_int8s_increase_
- f_status_t f_type_int8s_increase(f_int8s_t *int8s) {
+ f_status_t f_type_int8s_increase(const uint16_t step, f_int8s_t *int8s) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!int8s) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (int8s->used + 1 > int8s->size) {
- f_array_length_t size = int8s->used + f_memory_default_allocation_step;
+ f_array_length_t size = int8s->used + step;
if (size > f_array_length_t_size) {
if (int8s->used + 1 > f_array_length_t_size) {
#endif // _di_f_type_int8ss_decrease_by_
#ifndef _di_f_type_int8ss_increase_
- f_status_t f_type_int8ss_increase(f_int8ss_t *int8ss) {
+ f_status_t f_type_int8ss_increase(const uint16_t step, f_int8ss_t *int8ss) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!int8ss) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (int8ss->used + 1 > int8ss->size) {
- f_array_length_t size = int8ss->used + f_memory_default_allocation_step;
+ f_array_length_t size = int8ss->used + step;
if (size > f_array_length_t_size) {
if (int8ss->used + 1 > f_array_length_t_size) {
#endif // _di_f_type_uint8s_decrease_by_
#ifndef _di_f_type_uint8s_increase_
- f_status_t f_type_uint8s_increase(f_uint8s_t *uint8s) {
+ f_status_t f_type_uint8s_increase(const uint16_t step, f_uint8s_t *uint8s) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!uint8s) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (uint8s->used + 1 > uint8s->size) {
- f_array_length_t size = uint8s->used + f_memory_default_allocation_step;
+ f_array_length_t size = uint8s->used + step;
if (size > f_array_length_t_size) {
if (uint8s->used + 1 > f_array_length_t_size) {
#endif // _di_f_type_uint8ss_decrease_by_
#ifndef _di_f_type_uint8ss_increase_
- f_status_t f_type_uint8ss_increase(f_uint8ss_t *uint8ss) {
+ f_status_t f_type_uint8ss_increase(const uint16_t step, f_uint8ss_t *uint8ss) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!uint8ss) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (uint8ss->used + 1 > uint8ss->size) {
- f_array_length_t size = uint8ss->used + f_memory_default_allocation_step;
+ f_array_length_t size = uint8ss->used + step;
if (size > f_array_length_t_size) {
if (uint8ss->used + 1 > f_array_length_t_size) {
#endif // _di_f_type_int16s_decrease_by_
#ifndef _di_f_type_int16s_increase_
- f_status_t f_type_int16s_increase(f_int16s_t *int16s) {
+ f_status_t f_type_int16s_increase(const uint16_t step, f_int16s_t *int16s) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!int16s) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (int16s->used + 1 > int16s->size) {
- f_array_length_t size = int16s->used + f_memory_default_allocation_step;
+ f_array_length_t size = int16s->used + step;
if (size > f_array_length_t_size) {
if (int16s->used + 1 > f_array_length_t_size) {
#endif // _di_f_type_int16ss_decrease_by_
#ifndef _di_f_type_int16ss_increase_
- f_status_t f_type_int16ss_increase(f_int16ss_t *int16ss) {
+ f_status_t f_type_int16ss_increase(const uint16_t step, f_int16ss_t *int16ss) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!int16ss) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (int16ss->used + 1 > int16ss->size) {
- f_array_length_t size = int16ss->used + f_memory_default_allocation_step;
+ f_array_length_t size = int16ss->used + step;
if (size > f_array_length_t_size) {
if (int16ss->used + 1 > f_array_length_t_size) {
#endif // _di_f_type_uint16s_decrease_by_
#ifndef _di_f_type_uint16s_increase_
- f_status_t f_type_uint16s_increase(f_uint16s_t *uint16s) {
+ f_status_t f_type_uint16s_increase(const uint16_t step, f_uint16s_t *uint16s) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!uint16s) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (uint16s->used + 1 > uint16s->size) {
- f_array_length_t size = uint16s->used + f_memory_default_allocation_step;
+ f_array_length_t size = uint16s->used + step;
if (size > f_array_length_t_size) {
if (uint16s->used + 1 > f_array_length_t_size) {
#endif // _di_f_type_uint16ss_decrease_by_
#ifndef _di_f_type_uint16ss_increase_
- f_status_t f_type_uint16ss_increase(f_uint16ss_t *uint16ss) {
+ f_status_t f_type_uint16ss_increase(const uint16_t step, f_uint16ss_t *uint16ss) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!uint16ss) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (uint16ss->used + 1 > uint16ss->size) {
- f_array_length_t size = uint16ss->used + f_memory_default_allocation_step;
+ f_array_length_t size = uint16ss->used + step;
if (size > f_array_length_t_size) {
if (uint16ss->used + 1 > f_array_length_t_size) {
#endif // _di_f_type_int32s_decrease_by_
#ifndef _di_f_type_int32s_increase_
- f_status_t f_type_int32s_increase(f_int32s_t *int32s) {
+ f_status_t f_type_int32s_increase(const uint16_t step, f_int32s_t *int32s) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!int32s) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (int32s->used + 1 > int32s->size) {
- f_array_length_t size = int32s->used + f_memory_default_allocation_step;
+ f_array_length_t size = int32s->used + step;
if (size > f_array_length_t_size) {
if (int32s->used + 1 > f_array_length_t_size) {
#endif // _di_f_type_int32ss_decrease_by_
#ifndef _di_f_type_int32ss_increase_
- f_status_t f_type_int32ss_increase(f_int32ss_t *int32ss) {
+ f_status_t f_type_int32ss_increase(const uint16_t step, f_int32ss_t *int32ss) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!int32ss) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (int32ss->used + 1 > int32ss->size) {
- f_array_length_t size = int32ss->used + f_memory_default_allocation_step;
+ f_array_length_t size = int32ss->used + step;
if (size > f_array_length_t_size) {
if (int32ss->used + 1 > f_array_length_t_size) {
#endif // _di_f_type_uint32s_decrease_by_
#ifndef _di_f_type_uint32s_increase_
- f_status_t f_type_uint32s_increase(f_uint32s_t *uint32s) {
+ f_status_t f_type_uint32s_increase(const uint16_t step, f_uint32s_t *uint32s) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!uint32s) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (uint32s->used + 1 > uint32s->size) {
- f_array_length_t size = uint32s->used + f_memory_default_allocation_step;
+ f_array_length_t size = uint32s->used + step;
if (size > f_array_length_t_size) {
if (uint32s->used + 1 > f_array_length_t_size) {
#endif // _di_f_type_uint32ss_decrease_by_
#ifndef _di_f_type_uint32ss_increase_
- f_status_t f_type_uint32ss_increase(f_uint32ss_t *uint32ss) {
+ f_status_t f_type_uint32ss_increase(const uint16_t step, f_uint32ss_t *uint32ss) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!uint32ss) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (uint32ss->used + 1 > uint32ss->size) {
- f_array_length_t size = uint32ss->used + f_memory_default_allocation_step;
+ f_array_length_t size = uint32ss->used + step;
if (size > f_array_length_t_size) {
if (uint32ss->used + 1 > f_array_length_t_size) {
#endif // _di_f_type_int64s_decrease_by_
#ifndef _di_f_type_int64s_increase_
- f_status_t f_type_int64s_increase(f_int64s_t *int64s) {
+ f_status_t f_type_int64s_increase(const uint16_t step, f_int64s_t *int64s) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!int64s) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (int64s->used + 1 > int64s->size) {
- f_array_length_t size = int64s->used + f_memory_default_allocation_step;
+ f_array_length_t size = int64s->used + step;
if (size > f_array_length_t_size) {
if (int64s->used + 1 > f_array_length_t_size) {
#endif // _di_f_type_int64ss_decrease_by_
#ifndef _di_f_type_int64ss_increase_
- f_status_t f_type_int64ss_increase(f_int64ss_t *int64ss) {
+ f_status_t f_type_int64ss_increase(const uint16_t step, f_int64ss_t *int64ss) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!int64ss) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (int64ss->used + 1 > int64ss->size) {
- f_array_length_t size = int64ss->used + f_memory_default_allocation_step;
+ f_array_length_t size = int64ss->used + step;
if (size > f_array_length_t_size) {
if (int64ss->used + 1 > f_array_length_t_size) {
#endif // _di_f_type_uint64s_decrease_by_
#ifndef _di_f_type_uint64s_increase_
- f_status_t f_type_uint64s_increase(f_uint64s_t *uint64s) {
+ f_status_t f_type_uint64s_increase(const uint16_t step, f_uint64s_t *uint64s) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!uint64s) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (uint64s->used + 1 > uint64s->size) {
- f_array_length_t size = uint64s->used + f_memory_default_allocation_step;
+ f_array_length_t size = uint64s->used + step;
if (size > f_array_length_t_size) {
if (uint64s->used + 1 > f_array_length_t_size) {
#endif // _di_f_type_uint64ss_decrease_by_
#ifndef _di_f_type_uint64ss_increase_
- f_status_t f_type_uint64ss_increase(f_uint64ss_t *uint64ss) {
+ f_status_t f_type_uint64ss_increase(const uint16_t step, f_uint64ss_t *uint64ss) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!uint64ss) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (uint64ss->used + 1 > uint64ss->size) {
- f_array_length_t size = uint64ss->used + f_memory_default_allocation_step;
+ f_array_length_t size = uint64ss->used + step;
if (size > f_array_length_t_size) {
if (uint64ss->used + 1 > f_array_length_t_size) {
#endif // _di_f_type_int128s_decrease_by_
#ifndef _di_f_type_int128s_increase_
- f_status_t f_type_int128s_increase(f_int128s_t *int128s) {
+ f_status_t f_type_int128s_increase(const uint16_t step, f_int128s_t *int128s) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!int128s) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (int128s->used + 1 > int128s->size) {
- f_array_length_t size = int128s->used + f_memory_default_allocation_step;
+ f_array_length_t size = int128s->used + step;
if (size > f_array_length_t_size) {
if (int128s->used + 1 > f_array_length_t_size) {
#endif // _di_f_type_int128ss_decrease_by_
#ifndef _di_f_type_int128ss_increase_
- f_status_t f_type_int128ss_increase(f_int128ss_t *int128ss) {
+ f_status_t f_type_int128ss_increase(const uint16_t step, f_int128ss_t *int128ss) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!int128ss) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (int128ss->used + 1 > int128ss->size) {
- f_array_length_t size = int128ss->used + f_memory_default_allocation_step;
+ f_array_length_t size = int128ss->used + step;
if (size > f_array_length_t_size) {
if (int128ss->used + 1 > f_array_length_t_size) {
#endif // _di_f_type_uint128s_decrease_by_
#ifndef _di_f_type_uint128s_increase_
- f_status_t f_type_uint128s_increase(f_uint128s_t *uint128s) {
+ f_status_t f_type_uint128s_increase(const uint16_t step, f_uint128s_t *uint128s) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!uint128s) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (uint128s->used + 1 > uint128s->size) {
- f_array_length_t size = uint128s->used + f_memory_default_allocation_step;
+ f_array_length_t size = uint128s->used + step;
if (size > f_array_length_t_size) {
if (uint128s->used + 1 > f_array_length_t_size) {
#endif // _di_f_type_uint128ss_decrease_by_
#ifndef _di_f_type_uint128ss_increase_
- f_status_t f_type_uint128ss_increase(f_uint128ss_t *uint128ss) {
+ f_status_t f_type_uint128ss_increase(const uint16_t step, f_uint128ss_t *uint128ss) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!uint128ss) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (uint128ss->used + 1 > uint128ss->size) {
- f_array_length_t size = uint128ss->used + f_memory_default_allocation_step;
+ f_array_length_t size = uint128ss->used + step;
if (size > f_array_length_t_size) {
if (uint128ss->used + 1 > f_array_length_t_size) {
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param cells
* The string cells array to resize.
*
* Errors (with error bit) from: f_memory_resize().
*/
#ifndef _di_f_type_cells_increase_
- extern f_status_t f_type_cells_increase(f_cells_t *cells);
+ extern f_status_t f_type_cells_increase(const uint16_t step, f_cells_t *cells);
#endif // _di_f_type_cells_increase_
/**
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param cellss
* The string cellss array to resize.
*
* Errors (with error bit) from: f_memory_resize().
*/
#ifndef _di_f_type_cellss_increase_
- extern f_status_t f_type_cellss_increase(f_cellss_t *cellss);
+ extern f_status_t f_type_cellss_increase(const uint16_t step, f_cellss_t *cellss);
#endif // _di_f_type_cellss_increase_
/**
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param lengths
* The string lengths array to resize.
*
* Errors (with error bit) from: f_memory_resize().
*/
#ifndef _di_f_type_array_lengths_increase_
- extern f_status_t f_type_array_lengths_increase(f_array_lengths_t *lengths);
+ extern f_status_t f_type_array_lengths_increase(const uint16_t step, f_array_lengths_t *lengths);
#endif // _di_f_type_array_lengths_increase_
/**
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param lengthss
* The string lengthss array to resize.
*
* Errors (with error bit) from: f_memory_resize().
*/
#ifndef _di_f_type_array_lengthss_increase_
- extern f_status_t f_type_array_lengthss_increase(f_array_lengthss_t *lengthss);
+ extern f_status_t f_type_array_lengthss_increase(const uint16_t step, f_array_lengthss_t *lengthss);
#endif // _di_f_type_array_lengthss_increase_
/**
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param int8s
* The string int8s array to resize.
*
* Errors (with error bit) from: f_memory_resize().
*/
#ifndef _di_f_type_int8s_increase_
- extern f_status_t f_type_int8s_increase(f_int8s_t *int8s);
+ extern f_status_t f_type_int8s_increase(const uint16_t step, f_int8s_t *int8s);
#endif // _di_f_type_int8s_increase_
/**
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param int8ss
* The string int8ss array to resize.
*
* Errors (with error bit) from: f_memory_resize().
*/
#ifndef _di_f_type_int8ss_increase_
- extern f_status_t f_type_int8ss_increase(f_int8ss_t *int8ss);
+ extern f_status_t f_type_int8ss_increase(const uint16_t step, f_int8ss_t *int8ss);
#endif // _di_f_type_int8ss_increase_
/**
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param uint8s
* The string uint8s array to resize.
*
* Errors (with error bit) from: f_memory_resize().
*/
#ifndef _di_f_type_uint8s_increase_
- extern f_status_t f_type_uint8s_increase(f_uint8s_t *uint8s);
+ extern f_status_t f_type_uint8s_increase(const uint16_t step, f_uint8s_t *uint8s);
#endif // _di_f_type_uint8s_increase_
/**
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param uint8ss
* The string uint8ss array to resize.
*
* Errors (with error bit) from: f_memory_resize().
*/
#ifndef _di_f_type_uint8ss_increase_
- extern f_status_t f_type_uint8ss_increase(f_uint8ss_t *uint8ss);
+ extern f_status_t f_type_uint8ss_increase(const uint16_t step, f_uint8ss_t *uint8ss);
#endif // _di_f_type_uint8ss_increase_
/**
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param int16s
* The string int16s array to resize.
*
* Errors (with error bit) from: f_memory_resize().
*/
#ifndef _di_f_type_int16s_increase_
- extern f_status_t f_type_int16s_increase(f_int16s_t *int16s);
+ extern f_status_t f_type_int16s_increase(const uint16_t step, f_int16s_t *int16s);
#endif // _di_f_type_int16s_increase_
/**
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param int16ss
* The string int16ss array to resize.
*
* Errors (with error bit) from: f_memory_resize().
*/
#ifndef _di_f_type_int16ss_increase_
- extern f_status_t f_type_int16ss_increase(f_int16ss_t *int16ss);
+ extern f_status_t f_type_int16ss_increase(const uint16_t step, f_int16ss_t *int16ss);
#endif // _di_f_type_int16ss_increase_
/**
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param uint16s
* The string uint16s array to resize.
*
* Errors (with error bit) from: f_memory_resize().
*/
#ifndef _di_f_type_uint16s_increase_
- extern f_status_t f_type_uint16s_increase(f_uint16s_t *uint16s);
+ extern f_status_t f_type_uint16s_increase(const uint16_t step, f_uint16s_t *uint16s);
#endif // _di_f_type_uint16s_increase_
/**
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param uint16ss
* The string uint16ss array to resize.
*
* Errors (with error bit) from: f_memory_resize().
*/
#ifndef _di_f_type_uint16ss_increase_
- extern f_status_t f_type_uint16ss_increase(f_uint16ss_t *uint16ss);
+ extern f_status_t f_type_uint16ss_increase(const uint16_t step, f_uint16ss_t *uint16ss);
#endif // _di_f_type_uint16ss_increase_
/**
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param int32s
* The string int32s array to resize.
*
* Errors (with error bit) from: f_memory_resize().
*/
#ifndef _di_f_type_int32s_increase_
- extern f_status_t f_type_int32s_increase(f_int32s_t *int32s);
+ extern f_status_t f_type_int32s_increase(const uint16_t step, f_int32s_t *int32s);
#endif // _di_f_type_int32s_increase_
/**
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param int32ss
* The string int32ss array to resize.
*
* Errors (with error bit) from: f_memory_resize().
*/
#ifndef _di_f_type_int32ss_increase_
- extern f_status_t f_type_int32ss_increase(f_int32ss_t *int32ss);
+ extern f_status_t f_type_int32ss_increase(const uint16_t step, f_int32ss_t *int32ss);
#endif // _di_f_type_int32ss_increase_
/**
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param uint32s
* The string uint32s array to resize.
*
* Errors (with error bit) from: f_memory_resize().
*/
#ifndef _di_f_type_uint32s_increase_
- extern f_status_t f_type_uint32s_increase(f_uint32s_t *uint32s);
+ extern f_status_t f_type_uint32s_increase(const uint16_t step, f_uint32s_t *uint32s);
#endif // _di_f_type_uint32s_increase_
/**
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param uint32ss
* The string uint32ss array to resize.
*
* Errors (with error bit) from: f_memory_resize().
*/
#ifndef _di_f_type_uint32ss_increase_
- extern f_status_t f_type_uint32ss_increase(f_uint32ss_t *uint32ss);
+ extern f_status_t f_type_uint32ss_increase(const uint16_t step, f_uint32ss_t *uint32ss);
#endif // _di_f_type_uint32ss_increase_
/**
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param int64s
* The string int64s array to resize.
*
* Errors (with error bit) from: f_memory_resize().
*/
#ifndef _di_f_type_int64s_increase_
- extern f_status_t f_type_int64s_increase(f_int64s_t *int64s);
+ extern f_status_t f_type_int64s_increase(const uint16_t step, f_int64s_t *int64s);
#endif // _di_f_type_int64s_increase_
/**
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param int64ss
* The string int64ss array to resize.
*
* Errors (with error bit) from: f_memory_resize().
*/
#ifndef _di_f_type_int64ss_increase_
- extern f_status_t f_type_int64ss_increase(f_int64ss_t *int64ss);
+ extern f_status_t f_type_int64ss_increase(const uint16_t step, f_int64ss_t *int64ss);
#endif // _di_f_type_int64ss_increase_
/**
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param uint64s
* The string uint64s array to resize.
*
* Errors (with error bit) from: f_memory_resize().
*/
#ifndef _di_f_type_uint64s_increase_
- extern f_status_t f_type_uint64s_increase(f_uint64s_t *uint64s);
+ extern f_status_t f_type_uint64s_increase(const uint16_t step, f_uint64s_t *uint64s);
#endif // _di_f_type_uint64s_increase_
/**
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param uint64ss
* The string uint64ss array to resize.
*
* Errors (with error bit) from: f_memory_resize().
*/
#ifndef _di_f_type_uint64ss_increase_
- extern f_status_t f_type_uint64ss_increase(f_uint64ss_t *uint64ss);
+ extern f_status_t f_type_uint64ss_increase(const uint16_t step, f_uint64ss_t *uint64ss);
#endif // _di_f_type_uint64ss_increase_
/**
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param int128s
* The string int128s array to resize.
*
* Errors (with error bit) from: f_memory_resize().
*/
#ifndef _di_f_type_int128s_increase_
- extern f_status_t f_type_int128s_increase(f_int128s_t *int128s);
+ extern f_status_t f_type_int128s_increase(const uint16_t step, f_int128s_t *int128s);
#endif // _di_f_type_int128s_increase_
/**
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param int128ss
* The string int128ss array to resize.
*
* Errors (with error bit) from: f_memory_resize().
*/
#ifndef _di_f_type_int128ss_increase_
- extern f_status_t f_type_int128ss_increase(f_int128ss_t *int128ss);
+ extern f_status_t f_type_int128ss_increase(const uint16_t step, f_int128ss_t *int128ss);
#endif // _di_f_type_int128ss_increase_
/**
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param uint128s
* The string uint128s array to resize.
*
* Errors (with error bit) from: f_memory_resize().
*/
#ifndef _di_f_type_uint128s_increase_
- extern f_status_t f_type_uint128s_increase(f_uint128s_t *uint128s);
+ extern f_status_t f_type_uint128s_increase(const uint16_t step, f_uint128s_t *uint128s);
#endif // _di_f_type_uint128s_increase_
/**
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param uint128ss
* The string uint128ss array to resize.
*
* Errors (with error bit) from: f_memory_resize().
*/
#ifndef _di_f_type_uint128ss_increase_
- extern f_status_t f_type_uint128ss_increase(f_uint128ss_t *uint128ss);
+ extern f_status_t f_type_uint128ss_increase(const uint16_t step, f_uint128ss_t *uint128ss);
#endif // _di_f_type_uint128ss_increase_
/**
#endif // _di_f_utf_string_dynamic_decrease_by_
#ifndef _di_f_utf_string_dynamic_increase_
- f_status_t f_utf_string_dynamic_increase(f_utf_string_dynamic_t *dynamic) {
+ f_status_t f_utf_string_dynamic_increase(const uint16_t step, f_utf_string_dynamic_t *dynamic) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!dynamic) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (dynamic->used + 1 > dynamic->size) {
- f_array_length_t size = dynamic->used + f_memory_default_allocation_step;
+ f_array_length_t size = dynamic->used + step;
if (size > f_array_length_t_size) {
if (dynamic->used + 1 > f_array_length_t_size) {
#endif // _di_f_utf_string_dynamics_decrease_by_
#ifndef _di_f_utf_string_dynamics_increase_
- f_status_t f_utf_string_dynamics_increase(f_utf_string_dynamics_t *dynamics) {
+ f_status_t f_utf_string_dynamics_increase(const uint16_t step, f_utf_string_dynamics_t *dynamics) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!dynamics) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (dynamics->used + 1 > dynamics->size) {
- f_array_length_t size = dynamics->used + f_memory_default_allocation_step;
+ f_array_length_t size = dynamics->used + step;
if (size > f_array_length_t_size) {
if (dynamics->used + 1 > f_array_length_t_size) {
#define macro_f_utf_string_dynamic_t_delete_simple(dynamic) f_utf_string_dynamic_resize(0, &dynamic);
#define macro_f_utf_string_dynamic_t_destroy_simple(dynamic) f_utf_string_dynamic_adjust(0, &dynamic);
- #define macro_f_utf_string_dynamic_t_increase(status, dynamic) status = f_utf_string_dynamic_increase(&dynamic);
+ #define macro_f_utf_string_dynamic_t_increase(status, step, dynamic) status = f_utf_string_dynamic_increase(step, &dynamic);
#define macro_f_utf_string_dynamic_t_increase_by(status, dynamic, amount) status = f_utf_string_dynamic_increase_by(amount, &dynamic);
#define macro_f_utf_string_dynamic_t_decrease_by(status, dynamic, amount) status = f_utf_string_dynamic_decrease_by(amount, &dynamic);
#define macro_f_utf_string_dynamic_t_decimate_by(status, dynamic, amount) status = f_utf_string_dynamic_decimate_by(amount, &dynamic);
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
- * @param amount
- * A positive number representing how much to increase the size by.
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param dynamic
* The string to resize.
*
* Errors (with error bit) from: f_memory_resize().
*/
#ifndef _di_f_utf_string_dynamic_increase_
- extern f_status_t f_utf_string_dynamic_increase(f_utf_string_dynamic_t *dynamic);
+ extern f_status_t f_utf_string_dynamic_increase(const uint16_t step, f_utf_string_dynamic_t *dynamic);
#endif // _di_f_utf_string_dynamic_increase_
/**
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param dynamics
* The array to resize.
*
* Errors (with error bit) from: f_memory_resize().
*/
#ifndef _di_f_utf_string_dynamics_increase_
- extern f_status_t f_utf_string_dynamics_increase(f_utf_string_dynamics_t *dynamics);
+ extern f_status_t f_utf_string_dynamics_increase(const uint16_t step, f_utf_string_dynamics_t *dynamics);
#endif // _di_f_utf_string_dynamics_increase_
/**
#endif // _di_f_utf_string_map_multis_decrease_by_
#ifndef _di_f_utf_string_map_multis_increase_
- f_status_t f_utf_string_map_multis_increase(f_utf_string_map_multis_t *map_multis) {
+ f_status_t f_utf_string_map_multis_increase(const uint16_t step, f_utf_string_map_multis_t *map_multis) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!map_multis) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (map_multis->used + 1 > map_multis->size) {
- f_array_length_t size = map_multis->used + f_memory_default_allocation_step;
+ f_array_length_t size = map_multis->used + step;
if (size > f_array_length_t_size) {
if (map_multis->used + 1 > f_array_length_t_size) {
#endif // _di_f_utf_string_maps_decrease_by_
#ifndef _di_f_utf_string_maps_increase_
- f_status_t f_utf_string_maps_increase(f_utf_string_maps_t *maps) {
+ f_status_t f_utf_string_maps_increase(const uint16_t step, f_utf_string_maps_t *maps) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!maps) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (maps->used + 1 > maps->size) {
- f_array_length_t size = maps->used + f_memory_default_allocation_step;
+ f_array_length_t size = maps->used + step;
if (size > f_array_length_t_size) {
if (maps->used + 1 > f_array_length_t_size) {
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param map_multis
* The map_multis array to resize.
*
* Errors (with error bit) from: f_memory_resize().
*/
#ifndef _di_f_utf_string_map_multis_increase_
- extern f_status_t f_utf_string_map_multis_increase(f_utf_string_map_multis_t *map_multis);
+ extern f_status_t f_utf_string_map_multis_increase(const uint16_t step, f_utf_string_map_multis_t *map_multis);
#endif // _di_f_utf_string_map_multis_increase_
/**
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param maps
* The string maps array to resize.
*
* Errors (with error bit) from: f_memory_resize().
*/
#ifndef _di_f_utf_string_maps_increase_
- extern f_status_t f_utf_string_maps_increase(f_utf_string_maps_t *maps);
+ extern f_status_t f_utf_string_maps_increase(const uint16_t step, f_utf_string_maps_t *maps);
#endif // _di_f_utf_string_maps_increase_
/**
#endif // _di_f_utf_string_quantitys_decrease_by_
#ifndef _di_f_utf_string_quantitys_increase_
- f_status_t f_utf_string_quantitys_increase(f_utf_string_quantitys_t *quantitys) {
+ f_status_t f_utf_string_quantitys_increase(const uint16_t step, f_utf_string_quantitys_t *quantitys) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!quantitys) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (quantitys->used + 1 > quantitys->size) {
- f_array_length_t size = quantitys->used + f_memory_default_allocation_step;
+ f_array_length_t size = quantitys->used + step;
if (size > f_array_length_t_size) {
if (quantitys->used + 1 > f_array_length_t_size) {
#endif // _di_f_utf_string_quantityss_decrease_by_
#ifndef _di_f_utf_string_quantityss_increase_
- f_status_t f_utf_string_quantityss_increase(f_utf_string_quantityss_t *quantityss) {
+ f_status_t f_utf_string_quantityss_increase(const uint16_t step, f_utf_string_quantityss_t *quantityss) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!quantityss) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (quantityss->used + 1 > quantityss->size) {
- f_array_length_t size = quantityss->used + f_memory_default_allocation_step;
+ f_array_length_t size = quantityss->used + step;
if (size > f_array_length_t_size) {
if (quantityss->used + 1 > f_array_length_t_size) {
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param quantitys
* The string quantitys array to resize.
*
* Errors (with error bit) from: f_memory_resize().
*/
#ifndef _di_f_utf_string_quantitys_increase_
- extern f_status_t f_utf_string_quantitys_increase(f_utf_string_quantitys_t *quantitys);
+ extern f_status_t f_utf_string_quantitys_increase(const uint16_t step, f_utf_string_quantitys_t *quantitys);
#endif // _di_f_utf_string_quantitys_increase_
/**
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param quantityss
* The string quantityss array to resize.
*
* Errors (with error bit) from: f_memory_resize().
*/
#ifndef _di_f_utf_string_quantityss_increase_
- extern f_status_t f_utf_string_quantityss_increase(f_utf_string_quantityss_t *quantityss);
+ extern f_status_t f_utf_string_quantityss_increase(const uint16_t step, f_utf_string_quantityss_t *quantityss);
#endif // _di_f_utf_string_quantityss_increase_
/**
#endif // _di_f_utf_string_ranges_decrease_by_
#ifndef _di_f_utf_string_ranges_increase_
- f_status_t f_utf_string_ranges_increase(f_utf_string_ranges_t *ranges) {
+ f_status_t f_utf_string_ranges_increase(const uint16_t step, f_utf_string_ranges_t *ranges) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!ranges) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (ranges->used + 1 > ranges->size) {
- f_array_length_t size = ranges->used + f_memory_default_allocation_step;
+ f_array_length_t size = ranges->used + step;
if (size > f_array_length_t_size) {
if (ranges->used + 1 > f_array_length_t_size) {
#endif // _di_f_utf_string_rangess_decrease_by_
#ifndef _di_f_utf_string_rangess_increase_
- f_status_t f_utf_string_rangess_increase(f_utf_string_rangess_t *rangess) {
+ f_status_t f_utf_string_rangess_increase(const uint16_t step, f_utf_string_rangess_t *rangess) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!rangess) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (rangess->used + 1 > rangess->size) {
- f_array_length_t size = rangess->used + f_memory_default_allocation_step;
+ f_array_length_t size = rangess->used + step;
if (size > f_array_length_t_size) {
if (rangess->used + 1 > f_array_length_t_size) {
* Errors (with error bit) from: f_memory_resize().
*/
#ifndef _di_f_utf_string_ranges_increase_
- extern f_status_t f_utf_string_ranges_increase(f_utf_string_ranges_t *ranges);
+ extern f_status_t f_utf_string_ranges_increase(const uint16_t step, f_utf_string_ranges_t *ranges);
#endif // _di_f_utf_string_ranges_increase_
/**
* Errors (with error bit) from: f_memory_resize().
*/
#ifndef _di_f_utf_string_rangess_increase_
- extern f_status_t f_utf_string_rangess_increase(f_utf_string_rangess_t *rangess);
+ extern f_status_t f_utf_string_rangess_increase(const uint16_t step, f_utf_string_rangess_t *rangess);
#endif // _di_f_utf_string_rangess_increase_
/**
#endif // _di_f_utf_string_triples_decrease_by_
#ifndef _di_f_utf_string_triples_increase_
- f_status_t f_utf_string_triples_increase(f_utf_string_triples_t *triples) {
+ f_status_t f_utf_string_triples_increase(const uint16_t step, f_utf_string_triples_t *triples) {
#ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
if (!triples) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (triples->used + 1 > triples->size) {
- f_array_length_t size = triples->used + f_memory_default_allocation_step;
+ f_array_length_t size = triples->used + step;
if (size > f_array_length_t_size) {
if (triples->used + 1 > f_array_length_t_size) {
* If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
* If already set to the maximum buffer size, then the resize will fail.
*
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
* @param triples
* The string triples array to resize.
*
* Errors (with error bit) from: f_memory_resize().
*/
#ifndef _di_f_utf_string_triples_increase_
- extern f_status_t f_utf_string_triples_increase(f_utf_string_triples_t *triples);
+ extern f_status_t f_utf_string_triples_increase(const uint16_t step, f_utf_string_triples_t *triples);
#endif // _di_f_utf_string_triples_increase_
/**
// fll-0 includes
#include <fll/level_0/type.h>
#include <fll/level_0/status.h>
-#include <fll/level_0/status_array.h>
#include <fll/level_0/memory.h>
+#include <fll/level_0/type_array.h>
#include <fll/level_0/string.h>
#include <fll/level_0/utf.h>
#include <fll/level_0/directory.h>
const f_status_t status_failure = status;
- macro_f_memory_structure_increment(status, (*recurse.failures), 1, f_memory_default_allocation_step, macro_f_directory_statuss_t_resize, F_array_too_large);
+ macro_f_memory_structure_increment(status, (*recurse.failures), 1, f_memory_default_allocation_small, macro_f_directory_statuss_t_resize, F_array_too_large);
if (F_status_is_error(status)) return status;
f_directory_status_t failure = f_directory_status_t_initialize;
const f_status_t status_failure = status;
- macro_f_memory_structure_increment(status, (*recurse.failures), 1, f_memory_default_allocation_step, macro_f_directory_statuss_t_resize, F_array_too_large);
+ macro_f_memory_structure_increment(status, (*recurse.failures), 1, f_memory_default_allocation_small, macro_f_directory_statuss_t_resize, F_array_too_large);
if (F_status_is_error(status)) return status;
f_directory_status_t failure = f_directory_status_t_initialize;
return F_data_not;
}
- f_status_t status = f_string_maps_increase(environment);
+ f_status_t status = f_string_maps_increase(f_memory_default_allocation_small, environment);
if (F_status_is_error(status)) return status;
environment->array[environment->used].name.used = 0;
// When PATH is "", this is actually a valid search path for PWD.
// Append an equivalent representation of PWD (string used length is 0).
- macro_f_memory_structure_increment(status, (*paths), 1, f_memory_default_allocation_step, macro_f_string_dynamics_t_resize, F_array_too_large);
+ macro_f_memory_structure_increment(status, (*paths), 1, f_memory_default_allocation_small, macro_f_string_dynamics_t_resize, F_array_too_large);
if (F_status_is_error(status)) return status;
macro_f_string_dynamic_t_clear(paths->array[paths->used]);
for (i = 0; i <= length; ++i) {
if (i == length || path[i] == f_path_separator_variable_s[0]) {
- macro_f_memory_structure_increment(status, (*paths), 1, f_memory_default_allocation_step, macro_f_string_dynamics_t_resize, F_array_too_large);
+ macro_f_memory_structure_increment(status, (*paths), 1, f_memory_default_allocation_small, macro_f_string_dynamics_t_resize, F_array_too_large);
if (F_status_is_error(status)) return status;
if (!i) {
// When PATH is "", this is actually a valid search path for PWD.
// Therefore append an equivalent representation of PWD (string used length is 0).
- macro_f_memory_structure_increment(status, (*paths), 1, f_memory_default_allocation_step, macro_f_string_dynamics_t_resize, F_array_too_large);
+ macro_f_memory_structure_increment(status, (*paths), 1, f_memory_default_allocation_small, macro_f_string_dynamics_t_resize, F_array_too_large);
if (F_status_is_error(status)) return status;
macro_f_string_dynamic_t_clear(paths->array[paths->used]);
for (i = 0; i <= path.used; ++i) {
if (i == path.used || path.string[i] == f_path_separator_variable_s[0]) {
- macro_f_memory_structure_increment(status, (*paths), 1, f_memory_default_allocation_step, macro_f_string_dynamics_t_resize, F_array_too_large);
+ macro_f_memory_structure_increment(status, (*paths), 1, f_memory_default_allocation_small, macro_f_string_dynamics_t_resize, F_array_too_large);
if (F_status_is_error(status)) return status;
if (!i) {
// When PATH is "", this is actually a valid search path for PWD.
// Therefore append an equivalent representation of PWD (string used length is 0).
- macro_f_memory_structure_increment(status, (*paths), 1, f_memory_default_allocation_step, macro_f_string_dynamics_t_resize, F_array_too_large);
+ macro_f_memory_structure_increment(status, (*paths), 1, f_memory_default_allocation_small, macro_f_string_dynamics_t_resize, F_array_too_large);
if (F_status_is_error(status)) return status;
paths->array[paths->used].string = 0;
for (; i > 0; --i, --j) {
if (!j || path[j] == f_path_separator_variable_s[0]) {
- macro_f_memory_structure_increment(status, (*paths), 1, f_memory_default_allocation_step, macro_f_string_dynamics_t_resize, F_array_too_large);
+ macro_f_memory_structure_increment(status, (*paths), 1, f_memory_default_allocation_small, macro_f_string_dynamics_t_resize, F_array_too_large);
if (F_status_is_error(status)) return status;
if (path[j] == f_path_separator_variable_s[0]) {
// When PATH is "", this is actually a valid search path for PWD.
// Therefore append an equivalent representation of PWD (string used length is 0).
- macro_f_memory_structure_increment(status, (*paths), 1, f_memory_default_allocation_step, macro_f_string_dynamics_t_resize, F_array_too_large);
+ macro_f_memory_structure_increment(status, (*paths), 1, f_memory_default_allocation_small, macro_f_string_dynamics_t_resize, F_array_too_large);
if (F_status_is_error(status)) return status;
macro_f_string_dynamic_t_clear(paths->array[paths->used]);
for (; i > 0; --i, --j) {
if (!j || path.string[j] == f_path_separator_variable_s[0]) {
- macro_f_memory_structure_increment(status, (*paths), 1, f_memory_default_allocation_step, macro_f_string_dynamics_t_resize, F_array_too_large);
+ macro_f_memory_structure_increment(status, (*paths), 1, f_memory_default_allocation_small, macro_f_string_dynamics_t_resize, F_array_too_large);
if (F_status_is_error(status)) return status;
if (path.string[j] == f_path_separator_variable_s[0]) {
#endif
#ifndef _di_fl_fss_basic_object_read_
- f_status_t fl_fss_basic_object_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_object_t *found, f_fss_quote_t *quote, f_fss_delimits_t *delimits) {
+ f_status_t fl_fss_basic_object_read(const f_string_static_t buffer, f_state_t state, f_string_range_t *range, f_fss_object_t *found, f_fss_quote_t *quote, f_fss_delimits_t *delimits) {
#ifndef _di_level_1_parameter_checking_
if (!range) return F_status_set_error(F_parameter);
if (!found) return F_status_set_error(F_parameter);
const f_array_length_t delimits_used = delimits->used;
- f_status_t status = private_fl_fss_basic_read(buffer, F_true, range, found, quote, delimits);
+ f_status_t status = private_fl_fss_basic_read(buffer, F_true, state, range, found, quote, delimits);
if (F_status_is_error(status)) {
delimits->used = delimits_used;
#endif // _di_fl_fss_basic_object_read_
#ifndef _di_fl_fss_basic_content_read_
- f_status_t fl_fss_basic_content_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_content_t *found, f_fss_delimits_t *delimits) {
+ f_status_t fl_fss_basic_content_read(const f_string_static_t buffer, f_state_t state, f_string_range_t *range, f_fss_content_t *found, f_fss_delimits_t *delimits) {
#ifndef _di_level_1_parameter_checking_
if (!range) return F_status_set_error(F_parameter);
if (!found) return F_status_set_error(F_parameter);
return F_data_not_stop;
}
- macro_f_fss_content_t_increase(status, (*found))
+ macro_f_fss_content_t_increase(status, state.step_small, (*found))
if (F_status_is_error(status)) return status;
found->array[found->used].start = range->start;
for (;; ++range->start) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
+
status = f_fss_skip_past_delimit(buffer, range);
- if (F_status_is_error(status)) return status;
+ if (F_status_is_error(status)) break;
if (status == F_none_eos || status == F_none_stop) {
return status;
if (buffer.string[range->start] == f_fss_basic_close) break;
} // for
+ if (F_status_is_error(status)) {
+ return status;
+ }
+
found->array[found->used++].stop = range->start - 1;
status = f_utf_buffer_increment(buffer, range, 1);
#endif // _di_fl_fss_basic_content_read_
#ifndef _di_fl_fss_basic_object_write_string_
- f_status_t fl_fss_basic_object_write_string(const f_string_static_t object, const f_fss_quote_t quote, const uint8_t complete, f_string_range_t *range, f_string_dynamic_t *destination) {
+ f_status_t fl_fss_basic_object_write_string(const f_string_static_t object, const f_fss_quote_t quote, const uint8_t complete, f_state_t state, f_string_range_t *range, f_string_dynamic_t *destination) {
#ifndef _di_level_1_parameter_checking_
if (!range) return F_status_set_error(F_parameter);
if (!destination) return F_status_set_error(F_parameter);
const f_array_length_t destination_used = destination->used;
- f_status_t status = private_fl_fss_basic_write(F_true, object, quote ? quote : f_fss_delimit_quote_double, range, destination);
+ f_status_t status = private_fl_fss_basic_write(F_true, object, quote ? quote : f_fss_delimit_quote_double, state, range, destination);
if (status == F_data_not_stop || status == F_data_not_eos) {
f_status_t status2 = F_none;
if (complete == f_fss_complete_full_trim) {
- status2 = private_fl_fss_basic_write_object_trim(quote ? quote : f_fss_delimit_quote_double, destination_used, destination);
+ status2 = private_fl_fss_basic_write_object_trim(quote ? quote : f_fss_delimit_quote_double, destination_used, state, destination);
if (F_status_is_error(status2)) {
destination->used = destination_used;
}
}
- status2 = f_string_dynamic_increase(destination);
+ status2 = f_string_dynamic_increase(state.step_large, destination);
if (F_status_is_error(status2)) {
destination->used = destination_used;
#endif // _di_fl_fss_basic_object_write_string_
#ifndef _di_fl_fss_basic_content_write_string_
- f_status_t fl_fss_basic_content_write_string(const f_string_static_t content, const uint8_t complete, f_string_range_t *range, f_string_dynamic_t *destination) {
+ f_status_t fl_fss_basic_content_write_string(const f_string_static_t content, const uint8_t complete, f_state_t state, f_string_range_t *range, f_string_dynamic_t *destination) {
#ifndef _di_level_1_parameter_checking_
if (!range) return F_status_set_error(F_parameter);
if (!destination) return F_status_set_error(F_parameter);
// content should be terminated, even if empty.
if (complete == f_fss_complete_full || complete == f_fss_complete_full_trim || complete == f_fss_complete_end) {
- status = f_string_dynamic_increase(destination);
+ status = f_string_dynamic_increase(state.step_large, destination);
if (F_status_is_error(status)) return status;
destination->string[destination->used++] = f_fss_basic_close;
for (; range->start <= range->stop && range->start < content.used; ++range->start) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ return F_status_set_error(F_interrupt);
+ }
+ }
+
if (content.string[range->start] == f_fss_eol) {
destination->used = destination_used;
*
* @param buffer
* The buffer to read from.
+ * @param state
+ * A state for handling interrupts during long running operations.
+ * There is no print_error() usage at this time (@todo this should be implemented and supported).
+ * There is no functions structure.
+ * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure).
+ *
+ * When interrupt() returns, only F_interrupt and F_interrupt_not are processed.
+ * Error bit designates an error but must be passed along with F_interrupt.
+ * All other statuses are ignored.
* @param range
* The start/stop location within the buffer to be processed.
* The start location will be updated as the buffer is being processed.
* F_terminated_not_group_eos if EOS was reached before the a group termination was reached.
* F_terminated_not_group_stop if stop point was reached before the a group termination was reached.
*
+ * F_interrupt (with error bit) if stopping due to an interrupt.
* F_parameter (with error bit) if a parameter is invalid.
*
* Errors (with error bit) from: f_utf_buffer_increment().
* Errors (with error bit) from: f_fss_skip_past_space().
*/
#ifndef _di_fl_fss_basic_object_read_
- extern f_status_t fl_fss_basic_object_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_object_t *found, f_fss_quote_t *quote, f_fss_delimits_t *delimits);
+ extern f_status_t fl_fss_basic_object_read(const f_string_static_t buffer, f_state_t state, f_string_range_t *range, f_fss_object_t *found, f_fss_quote_t *quote, f_fss_delimits_t *delimits);
#endif // _di_fl_fss_basic_object_read_
/**
*
* @param buffer
* The buffer to read from.
+ * @param state
+ * A state for handling interrupts during long running operations.
+ * There is no print_error() usage at this time (@todo this should be implemented and supported).
+ * There is no functions structure.
+ * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure).
+ *
+ * When interrupt() returns, only F_interrupt and F_interrupt_not are processed.
+ * Error bit designates an error but must be passed along with F_interrupt.
+ * All other statuses are ignored.
* @param range
* The start/stop location within the buffer to be processed.
* The start location will be updated as the buffer is being processed.
* F_terminated_not_group_eos if EOS was reached before the a group termination was reached.
* F_terminated_not_group_stop if stop point was reached before the a group termination was reached.
*
+ * F_interrupt (with error bit) if stopping due to an interrupt.
* F_parameter (with error bit) if a parameter is invalid.
*
* Errors (with error bit) from: f_utf_buffer_increment().
* Errors (with error bit) from: f_fss_skip_past_space().
*/
#ifndef _di_fl_fss_basic_content_read_
- extern f_status_t fl_fss_basic_content_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_content_t *found, f_fss_delimits_t *delimits);
+ extern f_status_t fl_fss_basic_content_read(const f_string_static_t buffer, f_state_t state, f_string_range_t *range, f_fss_content_t *found, f_fss_delimits_t *delimits);
#endif // _di_fl_fss_basic_content_read_
/**
* If f_fss_complete_full_trim, this will write any appropriate open and close aspects of this object, but will omit whitespace before and after the object (inside the quotes).
* If f_fss_complete_partial, this will write any appropriate open and close aspects of this object.
* If f_fss_complete_partial_tim, this will write any appropriate open and close aspects of this object, but will omit whitespace before and after the object (inside the quotes).
+ * @param state
+ * A state for handling interrupts during long running operations.
+ * There is no print_error() usage at this time (@todo this should be implemented and supported).
+ * There is no functions structure.
+ * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure).
+ *
+ * When interrupt() returns, only F_interrupt and F_interrupt_not are processed.
+ * Error bit designates an error but must be passed along with F_interrupt.
+ * All other statuses are ignored.
* @param range
* The start/stop location within the object string to write as an object.
* @param destination
* F_data_not_eos no data to write due start location being greater than or equal to buffer size.
*
* F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete.
+ * F_interrupt (with error bit) if stopping due to an interrupt.
* F_memory_not (with error bit) on out of memory.
* F_none_eol (with error bit) after reaching an EOL, which is not supported by the standard.
* F_parameter (with error bit) if a parameter is invalid.
* Errors (with error bit) from: f_utf_buffer_increment().
*/
#ifndef _di_fl_fss_basic_object_write_string_
- extern f_status_t fl_fss_basic_object_write_string(const f_string_static_t object, const f_fss_quote_t quote, const uint8_t complete, f_string_range_t *range, f_string_dynamic_t *destination);
+ extern f_status_t fl_fss_basic_object_write_string(const f_string_static_t object, const f_fss_quote_t quote, const uint8_t complete, f_state_t state, f_string_range_t *range, f_string_dynamic_t *destination);
#endif // _di_fl_fss_basic_object_write_string_
/**
* If f_fss_complete_end, then the content followed by any appropriate "end" character designating the last content for some object, printing final newline, if applicable.
* If f_fss_complete_partial, this will write any appropriate open and close aspects of this content, except for the final newline.
* If f_fss_complete_full, this will write any appropriate open and close aspects of this content, including the final newline.
+ * @param state
+ * A state for handling interrupts during long running operations.
+ * There is no print_error() usage at this time (@todo this should be implemented and supported).
+ * There is no functions structure.
+ * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure).
+ *
+ * When interrupt() returns, only F_interrupt and F_interrupt_not are processed.
+ * Error bit designates an error but must be passed along with F_interrupt.
+ * All other statuses are ignored.
* @param range
* The start/stop location within the content string to write as an content.
* @param destination
* F_data_not_stop no data to write due start location being greater than stop location.
* F_data_not_eos no data to write due start location being greater than or equal to buffer size.
*
+ * F_interrupt (with error bit) if stopping due to an interrupt.
* F_memory_not (with error bit) on out of memory.
* F_none_eol (with error bit) after reaching an EOL, which is not supported by the standard.
* F_parameter (with error bit) if a parameter is invalid.
* F_string_too_large (with error bit) if appended string length is too large to store in the destination.
*/
#ifndef _di_fl_fss_basic_content_write_string_
- extern f_status_t fl_fss_basic_content_write_string(const f_string_static_t content, const uint8_t complete, f_string_range_t *range, f_string_dynamic_t *destination);
+ extern f_status_t fl_fss_basic_content_write_string(const f_string_static_t content, const uint8_t complete, f_state_t state, f_string_range_t *range, f_string_dynamic_t *destination);
#endif // _di_fl_fss_basic_content_write_string_
#ifdef __cplusplus
#endif
#ifndef _di_fl_fss_basic_list_object_read_
- f_status_t fl_fss_basic_list_object_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_object_t *found, f_fss_delimits_t *delimits) {
+ f_status_t fl_fss_basic_list_object_read(const f_string_static_t buffer, f_state_t state, f_string_range_t *range, f_fss_object_t *found, f_fss_delimits_t *delimits) {
#ifndef _di_level_1_parameter_checking_
if (!range) return F_status_set_error(F_parameter);
if (!found) return F_status_set_error(F_parameter);
// identify where the object ends.
while (range->start <= range->stop && range->start < buffer.used && buffer.string[range->start] != f_fss_eol) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
+
if (buffer.string[range->start] == f_fss_delimit_slash) {
slash_first = range->start;
slash_count = 1;
for (range->start++; range->start <= range->stop && range->start < buffer.used; range->start++) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
+
if (buffer.string[range->start] == f_fss_delimit_placeholder) {
continue;
} else if (buffer.string[range->start] != f_fss_delimit_slash) {
while (range->start <= range->stop && range->start < buffer.used) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
+
if (buffer.string[range->start] == f_fss_eol) break;
status = f_fss_is_space(buffer, *range);
graph_first = F_false;
// comments may only have whitespace before the '#', therefore only the first slash needs to be delimited.
- macro_f_fss_delimits_t_increase(status, (*delimits));
+ macro_f_fss_delimits_t_increase(status, state.step_small, (*delimits));
if (F_status_is_error(status)) break;
delimits->array[delimits->used++] = slash_first;
while (range->start <= range->stop && range->start < buffer.used) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
+
if (buffer.string[range->start] == f_fss_eol) break;
status = f_fss_is_space(buffer, *range);
#endif // _di_fl_fss_basic_list_object_read_
#ifndef _di_fl_fss_basic_list_content_read_
- f_status_t fl_fss_basic_list_content_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_content_t *found, f_fss_delimits_t *delimits, f_fss_comments_t *comments) {
+ f_status_t fl_fss_basic_list_content_read(const f_string_static_t buffer, f_state_t state, f_string_range_t *range, f_fss_content_t *found, f_fss_delimits_t *delimits, f_fss_comments_t *comments) {
#ifndef _di_level_1_parameter_checking_
if (!range) return F_status_set_error(F_parameter);
if (!found) return F_status_set_error(F_parameter);
private_macro_fl_fss_content_with_comments_return_on_overflow((buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, F_none_eos, F_none_stop);
- macro_f_fss_content_t_increase(status, (*found))
+ macro_f_fss_content_t_increase(status, state.step_small, (*found))
if (F_status_is_error(status)) return status;
found->array[found->used].start = range->start;
// identify where the content ends.
while (range->start <= range->stop && range->start < buffer.used) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
+
if (buffer.string[range->start] == f_fss_eol) {
if (graph_first == 0x2) {
- macro_f_fss_delimits_t_increase(status, (*delimits));
+ macro_f_fss_delimits_t_increase(status, state.step_small, (*delimits));
if (F_status_is_error(status)) break;
delimits->array[delimits->used++] = comment_delimit;
for (++range->start; range->start <= range->stop && range->start < buffer.used; ++range->start) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
+
if (buffer.string[range->start] == f_fss_delimit_placeholder) {
continue;
} else if (buffer.string[range->start] != f_fss_delimit_slash) {
while (range->start <= range->stop && range->start < buffer.used) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
+
if (buffer.string[range->start] == f_fss_eol) break;
status = f_fss_is_space(buffer, *range);
if (F_status_is_error(status)) break;
if (graph_first == 0x2) {
- macro_f_fss_delimits_t_increase(status, (*delimits));
+ macro_f_fss_delimits_t_increase(status, state.step_small, (*delimits));
if (F_status_is_error(status)) break;
delimits->array[delimits->used++] = comment_delimit;
while (range->start <= range->stop && range->start < buffer.used) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
+
if (buffer.string[range->start] == f_fss_eol) break;
status = f_fss_is_space(buffer, *range);
if (buffer.string[range->start] == f_fss_eol) {
if (graph_first == 0x2) {
- macro_f_fss_delimits_t_increase(status, (*delimits));
+ macro_f_fss_delimits_t_increase(status, state.step_small, (*delimits));
if (F_status_is_error(status)) break;
delimits->array[delimits->used++] = comment_delimit;
status = f_fss_seek_to_eol(buffer, range);
if (F_status_is_error(status)) break;
- macro_f_fss_comments_t_increase(status, (*comments))
+ macro_f_fss_comments_t_increase(status, state.step_small, (*comments))
if (F_status_is_error(status)) break;
if (range->start > range->stop || range->start >= buffer.used) {
#endif // _di_fl_fss_basic_list_content_read_
#ifndef _di_fl_fss_basic_list_object_write_string_
- f_status_t fl_fss_basic_list_object_write_string(const f_string_static_t object, const uint8_t complete, f_string_range_t *range, f_string_dynamic_t *destination) {
+ f_status_t fl_fss_basic_list_object_write_string(const f_string_static_t object, const uint8_t complete, f_state_t state, f_string_range_t *range, f_string_dynamic_t *destination) {
#ifndef _di_level_1_parameter_checking_
if (!destination) return F_status_set_error(F_parameter);
#endif // _di_level_1_parameter_checking_
// find the first graph character.
while (range->start <= range->stop && range->start < object.used) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
+
if (object.string[range->start] == f_fss_comment) {
// when a comment is found, escape it.
- status = f_string_dynamic_increase(destination);
+ status = f_string_dynamic_increase(state.step_large, destination);
if (F_status_is_error(status)) break;
destination->string[destination->used++] = f_fss_delimit_slash;
while (range->start <= range->stop && range->start < object.used) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
+
if (object.string[range->start] == f_fss_delimit_slash) {
slash_count = 1;
- for (range->start++; range->start <= range->stop && range->start < object.used; range->start++) {
+ for (++range->start; range->start <= range->stop && range->start < object.used; ++range->start) {
+
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
if (object.string[range->start] == f_fss_delimit_placeholder) {
continue;
if (complete == f_fss_complete_partial || complete == f_fss_complete_partial_trim || complete == f_fss_complete_full || complete == f_fss_complete_full_trim) {
if (complete == f_fss_complete_full_trim) {
- status = private_fl_fss_basic_list_write_object_trim(used_start, destination);
+ status = private_fl_fss_basic_list_write_object_trim(used_start, state, destination);
if (F_status_is_error(status)) {
destination->used = used_start;
#endif // _di_fl_fss_basic_list_object_write_string_
#ifndef _di_fl_fss_basic_list_content_write_string_
- f_status_t fl_fss_basic_list_content_write_string(const f_string_static_t content, const uint8_t complete, const f_string_static_t *prepend, f_string_range_t *range, f_string_dynamic_t *destination) {
+ f_status_t fl_fss_basic_list_content_write_string(const f_string_static_t content, const uint8_t complete, const f_string_static_t *prepend, f_state_t state, f_string_range_t *range, f_string_dynamic_t *destination) {
#ifndef _di_level_1_parameter_checking_
if (!range) return F_status_set_error(F_parameter);
if (!destination) return F_status_set_error(F_parameter);
if (status == F_none_stop || status == F_none_eos) {
if (complete == f_fss_complete_full || complete == f_fss_complete_full_trim || complete == f_fss_complete_end) {
- const f_status_t status_allocation = f_string_dynamic_increase(destination);
+ const f_status_t status_allocation = f_string_dynamic_increase(state.step_large, destination);
if (F_status_is_error(status_allocation)) return status_allocation;
destination->string[destination->used++] = f_fss_basic_list_close;
while (range->start <= range->stop && range->start < content.used) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
+
if (content.string[range->start] == f_fss_delimit_slash && !is_comment) {
slash_count = 1;
for (range->start++; range->start <= range->stop && range->start < content.used; range->start++) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
+
if (content.string[range->start] == f_fss_delimit_placeholder) continue;
if (content.string[range->start] != f_fss_delimit_slash) break;
range->start = start + 1;
- status = private_fl_fss_basic_list_write_add_until_end(content, range, destination);
+ status = private_fl_fss_basic_list_write_add_until_end(content, state, range, destination);
if (F_status_is_error(status)) break;
continue;
}
- status = f_string_dynamic_increase(destination);
+ status = f_string_dynamic_increase(state.step_large, destination);
if (F_status_is_error(status)) break;
destination->string[destination->used++] = f_fss_basic_list_open;
range->start = start + 1;
- status = private_fl_fss_basic_list_write_add_until_end(content, range, destination);
+ status = private_fl_fss_basic_list_write_add_until_end(content, state, range, destination);
if (F_status_is_error(status)) break;
continue;
}
- status = f_string_dynamic_increase(destination);
+ status = f_string_dynamic_increase(state.step_large, destination);
if (F_status_is_error(status)) break;
destination->string[destination->used++] = f_fss_basic_list_open;
}
if (complete == f_fss_complete_full || complete == f_fss_complete_full_trim || complete == f_fss_complete_end) {
- status = f_string_dynamic_increase(destination);
+ status = f_string_dynamic_increase(state.step_large, destination);
if (F_status_is_error(status)) return status;
// check to see if a newline exists, at the end.
*
* @param buffer
* The buffer to read from.
+ * @param state
+ * A state for handling interrupts during long running operations.
+ * There is no print_error() usage at this time (@todo this should be implemented and supported).
+ * There is no functions structure.
+ * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure).
+ *
+ * When interrupt() returns, only F_interrupt and F_interrupt_not are processed.
+ * Error bit designates an error but must be passed along with F_interrupt.
+ * All other statuses are ignored.
* @param range
* The start/stop location within the buffer to be processed.
* The start location will be updated as the buffer is being processed.
* F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete.
* F_complete_not_utf_eos (with error bit) if the end of buffer is reached before the complete UTF-8 character can be processed.
* F_complete_not_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed.
+ * F_interrupt (with error bit) if stopping due to an interrupt.
* F_memory_not (with error bit) on out of memory.
* F_parameter (with error bit) if a parameter is invalid.
* F_utf (with error bit) is returned on failure to read/process a UTF-8 character.
* Errors (with error bit) from: f_fss_skip_past_space().
*/
#ifndef _di_fl_fss_basic_list_object_read_
- extern f_status_t fl_fss_basic_list_object_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_object_t *found, f_fss_delimits_t *delimits);
+ extern f_status_t fl_fss_basic_list_object_read(const f_string_static_t buffer, f_state_t state, f_string_range_t *range, f_fss_object_t *found, f_fss_delimits_t *delimits);
#endif // _di_fl_fss_basic_list_object_read_
/**
*
* @param buffer
* The buffer to read from.
+ * @param state
+ * A state for handling interrupts during long running operations.
+ * There is no print_error() usage at this time (@todo this should be implemented and supported).
+ * There is no functions structure.
+ * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure).
+ *
+ * When interrupt() returns, only F_interrupt and F_interrupt_not are processed.
+ * Error bit designates an error but must be passed along with F_interrupt.
+ * All other statuses are ignored.
* @param range
* The start/stop location within the buffer to be processed.
* The start location will be updated as the buffer is being processed.
* F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete.
* F_complete_not_utf_eos (with error bit) if the end of buffer is reached before the complete UTF-8 character can be processed.
* F_complete_not_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed.
+ * F_interrupt (with error bit) if stopping due to an interrupt.
* F_memory_not (with error bit) on out of memory.
* F_parameter (with error bit) if a parameter is invalid.
* F_utf (with error bit) is returned on failure to read/process a UTF-8 character.
* Errors (with error bit) from: f_fss_skip_past_space().
*/
#ifndef _di_fl_fss_basic_list_content_read_
- extern f_status_t fl_fss_basic_list_content_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_content_t *found, f_fss_delimits_t *delimits, f_fss_comments_t *comments);
+ extern f_status_t fl_fss_basic_list_content_read(const f_string_static_t buffer, f_state_t state, f_string_range_t *range, f_fss_content_t *found, f_fss_delimits_t *delimits, f_fss_comments_t *comments);
#endif // _di_fl_fss_basic_list_content_read_
/**
* If f_fss_complete_full_trim, this will write any appropriate open and close aspects of this object, but will omit whitespace before and after the object.
* If f_fss_complete_partial, this will write any appropriate open and close aspects of this object.
* If f_fss_complete_partial_tim, this will write any appropriate open and close aspects of this object, but will omit whitespace before and after the object.
+ * @param state
+ * A state for handling interrupts during long running operations.
+ * There is no print_error() usage at this time (@todo this should be implemented and supported).
+ * There is no functions structure.
+ * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure).
+ *
+ * When interrupt() returns, only F_interrupt and F_interrupt_not are processed.
+ * Error bit designates an error but must be passed along with F_interrupt.
+ * All other statuses are ignored.
* @param range
* The start/stop location within the object string to write as an object.
* @param destination
* F_none_stop on success after reaching stopping point.
*
* F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete.
+ * F_interrupt (with error bit) if stopping due to an interrupt.
* F_memory_not (with error bit) on out of memory.
* F_none_eol (with error bit) after reaching an EOL, which is not supported by the standard.
* F_parameter (with error bit) if a parameter is invalid.
* Errors (with error bit) from: f_utf_buffer_increment().
*/
#ifndef _di_fl_fss_basic_list_object_write_string_
- extern f_status_t fl_fss_basic_list_object_write_string(const f_string_static_t object, const uint8_t complete, f_string_range_t *range, f_string_dynamic_t *destination);
+ extern f_status_t fl_fss_basic_list_object_write_string(const f_string_static_t object, const uint8_t complete, f_state_t state, f_string_range_t *range, f_string_dynamic_t *destination);
#endif // _di_fl_fss_basic_list_object_write_string_
/**
* A string of whitespace to prepend at the start of each line.
* This should only be whitespace, anything else could product invalid content.
* Set the pointer address to 0 to disable.
+ * @param state
+ * A state for handling interrupts during long running operations.
+ * There is no print_error() usage at this time (@todo this should be implemented and supported).
+ * There is no functions structure.
+ * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure).
+ *
+ * When interrupt() returns, only F_interrupt and F_interrupt_not are processed.
+ * Error bit designates an error but must be passed along with F_interrupt.
+ * All other statuses are ignored.
* @param range
* The start/stop location within the content string to write as an content.
* @param destination
* F_none_stop on success after reaching stopping point .
*
* F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete.
+ * F_interrupt (with error bit) if stopping due to an interrupt.
* F_memory_not (with error bit) on out of memory.
* F_parameter (with error bit) if a parameter is invalid.
* F_utf (with error bit) is returned on failure to read/process a UTF-8 character.
* Errors (with error bit) from: f_utf_buffer_increment().
*/
#ifndef _di_fl_fss_basic_list_content_write_string_
- extern f_status_t fl_fss_basic_list_content_write_string(const f_string_static_t content, const uint8_t complete, const f_string_static_t *prepend, f_string_range_t *range, f_string_dynamic_t *destination);
+ extern f_status_t fl_fss_basic_list_content_write_string(const f_string_static_t content, const uint8_t complete, const f_string_static_t *prepend, f_state_t state, f_string_range_t *range, f_string_dynamic_t *destination);
#endif // _di_fl_fss_basic_list_content_write_string_
#ifdef __cplusplus
#endif
#ifndef _di_fl_fss_embedded_list_object_read_
- f_status_t fl_fss_embedded_list_object_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_object_t *found, f_fss_delimits_t *delimits) {
+ f_status_t fl_fss_embedded_list_object_read(const f_string_static_t buffer, f_state_t state, f_string_range_t *range, f_fss_object_t *found, f_fss_delimits_t *delimits) {
#ifndef _di_level_1_parameter_checking_
if (!range) return F_status_set_error(F_parameter);
if (!found) return F_status_set_error(F_parameter);
if (F_status_is_error(status)) {
delimits->used = delimits_used;
+
return status;
}
// identify where the object ends.
while (range->start <= range->stop && range->start < buffer.used && buffer.string[range->start] != f_fss_eol) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
+
if (buffer.string[range->start] == f_fss_delimit_slash) {
slash_first = range->start;
slash_count = 1;
while (range->start <= range->stop && range->start < buffer.used && (buffer.string[range->start] == f_fss_delimit_placeholder || buffer.string[range->start] == f_fss_delimit_slash)) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
+
if (buffer.string[range->start] == f_fss_delimit_slash) slash_count++;
status = f_utf_buffer_increment(buffer, range, 1);
while (range->start <= range->stop && range->start < buffer.used) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
+
if (buffer.string[range->start] == f_fss_eol) break;
status = f_fss_is_graph(buffer, *range);
graph_first = F_false;
// comments may only have whitespace before the '#', therefore only the first slash needs to be delimited.
- macro_f_fss_delimits_t_increase(status, (*delimits));
+ macro_f_fss_delimits_t_increase(status, state.step_small, (*delimits));
if (F_status_is_error(status)) break;
delimits->array[delimits->used++] = slash_first;
while (range->start <= range->stop && range->start < buffer.used) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
+
if (buffer.string[range->start] == f_fss_eol) break;
status = f_fss_is_space(buffer, *range);
// seek to the end of the line when no valid object is found.
while (range->start <= range->stop && range->start < buffer.used && buffer.string[range->start] != f_fss_eol) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
+
status = f_utf_buffer_increment(buffer, range, 1);
if (F_status_is_error(status)) {
#endif // _di_fl_fss_embedded_list_object_read_
#ifndef _di_fl_fss_embedded_list_content_read_
- f_status_t fl_fss_embedded_list_content_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_nest_t *found, f_fss_delimits_t *delimits, f_fss_comments_t *comments) {
+ f_status_t fl_fss_embedded_list_content_read(const f_string_static_t buffer, f_state_t state, f_string_range_t *range, f_fss_nest_t *found, f_fss_delimits_t *delimits, f_fss_comments_t *comments) {
#ifndef _di_level_1_parameter_checking_
if (!range) return F_status_set_error(F_parameter);
if (!found) return F_status_set_error(F_parameter);
return status;
}
- macro_f_fss_nest_t_increase(status, (*found));
+ macro_f_fss_nest_t_increase(status, state.step_small, (*found));
if (F_status_is_error(status)) return status;
f_array_lengths_t positions_start = f_array_lengths_t_initialize;
macro_f_array_lengths_t_clear(positions_start)
- macro_f_array_lengths_t_resize(status, positions_start, f_fss_default_allocation_step)
+ macro_f_array_lengths_t_resize(status, positions_start, state.step_small)
if (F_status_is_error(status)) return status;
f_fss_objects_t objects = f_fss_objects_t_initialize;
macro_f_fss_objects_t_clear(objects)
- macro_f_fss_objects_t_resize(status, objects, f_fss_default_allocation_step)
+ macro_f_fss_objects_t_resize(status, objects, state.step_small)
if (F_status_is_error(status)) {
macro_f_array_lengths_t_delete_simple(positions_start);
while (range->start <= range->stop && range->start < buffer.used) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
+
if (buffer.string[range->start] == f_fss_eol) {
if (graph_first == 0x2) {
- macro_f_fss_delimits_t_increase(status, (*delimits));
+ macro_f_fss_delimits_t_increase(status, state.step_small, (*delimits));
if (F_status_is_error(status)) break;
delimits->array[delimits->used++] = comment_delimit;
while (range->start <= range->stop && range->start < buffer.used && (buffer.string[range->start] == f_fss_delimit_placeholder || buffer.string[range->start] == f_fss_delimit_slash)) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
+
position_previous = range->start;
if (buffer.string[range->start] == f_fss_delimit_slash) {
// When slash is odd and a (delimited) valid open/close is found, then save delimited positions and continue.
if (buffer.string[range->start] == f_fss_eol) {
if (graph_first == 0x2) {
- macro_f_fss_delimits_t_increase(status, (*delimits));
+ macro_f_fss_delimits_t_increase(status, state.step_small, (*delimits));
if (F_status_is_error(status)) break;
delimits->array[delimits->used++] = comment_delimit;
while (range->start <= range->stop && range->start < buffer.used) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
+
if (buffer.string[range->start] == f_fss_eol) {
if (graph_first == 0x2) {
- macro_f_fss_delimits_t_increase(status, (*delimits));
+ macro_f_fss_delimits_t_increase(status, state.step_small, (*delimits));
if (F_status_is_error(status)) break;
delimits->array[delimits->used++] = comment_delimit;
++depth;
if (depth > positions_start.size) {
- macro_f_array_lengths_t_resize(status, positions_start, positions_start.size + f_fss_default_allocation_step);
+ macro_f_array_lengths_t_resize(status, positions_start, positions_start.size + state.step_small);
if (F_status_is_error(status)) break;
}
}
}
else {
- macro_f_fss_delimits_t_increase(status, (*delimits));
+ macro_f_fss_delimits_t_increase(status, state.step_small, (*delimits));
if (F_status_is_error(status)) break;
delimits->array[delimits->used++] = slash_last;
while (range->start <= range->stop && range->start < buffer.used) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
+
if (buffer.string[range->start] == f_fss_eol) break;
if (buffer.string[range->start] != f_fss_delimit_placeholder) {
depth++;
if (depth >= positions_start.size) {
- macro_f_array_lengths_t_resize(status, positions_start, positions_start.size + f_fss_default_allocation_step);
+ macro_f_array_lengths_t_resize(status, positions_start, positions_start.size + state.step_small);
if (F_status_is_error(status)) break;
- macro_f_fss_objects_t_resize(status, objects, objects.size + f_fss_default_allocation_step);
+ macro_f_fss_objects_t_resize(status, objects, objects.size + state.step_small);
if (F_status_is_error(status)) break;
}
objects.array[depth].stop = before_list_open;
if (graph_first == 0x2) {
- macro_f_fss_delimits_t_increase(status, (*delimits));
+ macro_f_fss_delimits_t_increase(status, state.step_small, (*delimits));
if (F_status_is_error(status)) break;
delimits->array[delimits->used++] = comment_delimit;
if (F_status_is_error(status)) break;
if (graph_first == 0x2) {
- macro_f_fss_delimits_t_increase(status, (*delimits));
+ macro_f_fss_delimits_t_increase(status, state.step_small, (*delimits));
if (F_status_is_error(status)) break;
delimits->array[delimits->used++] = comment_delimit;
while (range->start <= range->stop && range->start < buffer.used) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
+
if (buffer.string[range->start] == f_fss_eol) {
newline_last = range->start;
line_start = range->start + 1;
while (range->start <= range->stop && range->start < buffer.used) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
+
position_previous = range->start;
status = f_utf_buffer_increment(buffer, range, 1);
}
if (buffer.string[range->start] == f_fss_eol) {
- macro_f_fss_nest_t_increase(status, (*found));
+ macro_f_fss_nest_t_increase(status, state.step_small, (*found));
if (F_status_is_error(status)) break;
if (found->depth[depth].used == found->depth[depth].size) {
- macro_f_fss_items_t_resize(status, found->depth[depth], found->depth[depth].size + f_fss_default_allocation_step);
+ macro_f_fss_items_t_resize(status, found->depth[depth], found->depth[depth].size + state.step_small);
if (F_status_is_error(status)) break;
}
}
if (graph_first == 0x2) {
- macro_f_fss_delimits_t_increase(status, (*delimits));
+ macro_f_fss_delimits_t_increase(status, state.step_small, (*delimits));
if (F_status_is_error(status)) break;
delimits->array[delimits->used++] = comment_delimit;
// No valid object close found, seek until EOL.
while (range->start <= range->stop && range->start < buffer.used) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
+
if (buffer.string[range->start] == f_fss_eol) {
if (graph_first == 0x2) {
- macro_f_fss_delimits_t_increase(status, (*delimits));
+ macro_f_fss_delimits_t_increase(status, state.step_small, (*delimits));
if (F_status_is_error(status)) break;
delimits->array[delimits->used++] = comment_delimit;
status = f_fss_seek_to_eol(buffer, range);
if (F_status_is_error(status)) break;
- macro_f_fss_comments_t_increase(status, (*comments))
+ macro_f_fss_comments_t_increase(status, state.step_small, (*comments))
if (F_status_is_error(status)) break;
if (range->start > range->stop || range->start >= buffer.used) {
}
else {
if (graph_first == 0x2) {
- macro_f_fss_delimits_t_increase(status, (*delimits));
+ macro_f_fss_delimits_t_increase(status, state.step_small, (*delimits));
if (F_status_is_error(status)) break;
delimits->array[delimits->used++] = comment_delimit;
#endif // _di_fl_fss_embedded_list_content_read_
#ifndef _di_fl_fss_embedded_list_object_write_string_
- f_status_t fl_fss_embedded_list_object_write_string(const f_string_static_t object, const uint8_t complete, f_string_range_t *range, f_string_dynamic_t *destination) {
+ f_status_t fl_fss_embedded_list_object_write_string(const f_string_static_t object, const uint8_t complete, f_state_t state, f_string_range_t *range, f_string_dynamic_t *destination) {
#ifndef _di_level_1_parameter_checking_
if (!destination) return F_status_set_error(F_parameter);
#endif // _di_level_1_parameter_checking_
// find the first graph character.
while (range->start <= range->stop && range->start < object.used) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
+
if (object.string[range->start] == f_fss_comment) {
// when a comment is found, escape it.
- status = f_string_dynamic_increase(destination);
+ status = f_string_dynamic_increase(state.step_large, destination);
if (F_status_is_error(status)) break;
destination->string[destination->used++] = f_fss_delimit_slash;
while (range->start <= range->stop && range->start < object.used) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
+
if (object.string[range->start] == f_fss_delimit_slash) {
slash_count = 1;
for (++range->start; range->start <= range->stop && range->start < object.used; ++range->start) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
+
if (object.string[range->start] == f_fss_delimit_placeholder) {
continue;
} else if (object.string[range->start] != f_fss_delimit_slash) {
if (complete == f_fss_complete_partial || complete == f_fss_complete_partial_trim || complete == f_fss_complete_full || complete == f_fss_complete_full_trim) {
if (complete == f_fss_complete_full_trim) {
- status = private_fl_fss_basic_list_write_object_trim(used_start, destination);
+ status = private_fl_fss_basic_list_write_object_trim(used_start, state, destination);
if (F_status_is_error(status)) {
destination->used = used_start;
#endif // _di_fl_fss_embedded_list_object_write_string_
#ifndef _di_fl_fss_embedded_list_content_write_string_
- f_status_t fl_fss_embedded_list_content_write_string(const f_string_static_t content, const uint8_t complete, const f_string_static_t *prepend, const f_string_ranges_t *ignore, f_string_range_t *range, f_string_dynamic_t *destination) {
+ f_status_t fl_fss_embedded_list_content_write_string(const f_string_static_t content, const uint8_t complete, const f_string_static_t *prepend, const f_string_ranges_t *ignore, f_state_t state, f_string_range_t *range, f_string_dynamic_t *destination) {
#ifndef _di_level_1_parameter_checking_
if (!range) return F_status_set_error(F_parameter);
if (!destination) return F_status_set_error(F_parameter);
while (range->start <= range->stop && range->start < content.used) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
+
if (content.string[range->start] == f_fss_delimit_slash && !is_comment) {
slash_count = 1;
for (++range->start; range->start <= range->stop && range->start < content.used; ++range->start) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
+
if (content.string[range->start] == f_fss_delimit_placeholder) continue;
if (content.string[range->start] != f_fss_delimit_slash) break;
range->start = start + 1;
- status = private_fl_fss_basic_list_write_add_until_end(content, range, destination);
+ status = private_fl_fss_basic_list_write_add_until_end(content, state, range, destination);
if (F_status_is_error(status)) break;
if (content.string[range->start] != f_fss_eol) {
if (ignore && ignore->used) {
- for (r = 0; r < ignore->used; r++) {
+ for (r = 0; r < ignore->used; ++r) {
if (start >= ignore->array[r].start && start <= ignore->array[r].stop) break;
} // for
if (r < ignore->used) {
- status = f_string_dynamic_increase(destination);
+ status = f_string_dynamic_increase(state.step_large, destination);
if (F_status_is_error(status)) break;
destination->string[destination->used++] = content.string[start];
range->start = start + 1;
- status = private_fl_fss_basic_list_write_add_until_end(content, range, destination);
+ status = private_fl_fss_basic_list_write_add_until_end(content, state, range, destination);
if (F_status_is_error(status)) break;
continue;
}
- status = f_string_dynamic_increase(destination);
+ status = f_string_dynamic_increase(state.step_large, destination);
if (F_status_is_error(status)) break;
destination->string[destination->used++] = content.string[start];
status = f_string_dynamic_increase_by(width, destination);
if (F_status_is_error(status)) break;
- for (i = 0; i < width; i++) {
+ for (i = 0; i < width; ++i) {
destination->string[destination->used++] = content.string[range->start + i];
} // for
}
*
* @param buffer
* The buffer to read from.
+ * @param state
+ * A state for handling interrupts during long running operations.
+ * There is no print_error() usage at this time (@todo this should be implemented and supported).
+ * There is no functions structure.
+ * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure).
+ *
+ * When interrupt() returns, only F_interrupt and F_interrupt_not are processed.
+ * Error bit designates an error but must be passed along with F_interrupt.
+ * All other statuses are ignored.
* @param range
* The start/stop location within the buffer to be processed.
* The start location will be updated as the buffer is being processed.
* F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete.
* F_complete_not_utf_eos (with error bit) if the end of buffer is reached before the complete UTF-8 character can be processed.
* F_complete_not_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed.
+ * F_interrupt (with error bit) if stopping due to an interrupt.
* F_memory_not (with error bit) on out of memory.
* F_parameter (with error bit) if a parameter is invalid.
* F_utf (with error bit) is returned on failure to read/process a UTF-8 character.
* Errors (with error bit) from: f_fss_skip_past_space().
*/
#ifndef _di_fl_fss_embedded_list_object_read_
- extern f_status_t fl_fss_embedded_list_object_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_object_t *found, f_fss_delimits_t *delimits);
+ extern f_status_t fl_fss_embedded_list_object_read(const f_string_static_t buffer, f_state_t state, f_string_range_t *range, f_fss_object_t *found, f_fss_delimits_t *delimits);
#endif // _di_fl_fss_embedded_list_object_read_
/**
*
* @param buffer
* The buffer to read from.
+ * @param state
+ * A state for handling interrupts during long running operations.
+ * There is no print_error() usage at this time (@todo this should be implemented and supported).
+ * There is no functions structure.
+ * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure).
+ *
+ * When interrupt() returns, only F_interrupt and F_interrupt_not are processed.
+ * Error bit designates an error but must be passed along with F_interrupt.
+ * All other statuses are ignored.
* @param range
* The start/stop location within the buffer to be processed.
* The start location will be updated as the buffer is being processed.
* F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete.
* F_complete_not_utf_eos (with error bit) if the end of buffer is reached before the complete UTF-8 character can be processed.
* F_complete_not_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed.
+ * F_interrupt (with error bit) if stopping due to an interrupt.
* F_memory_not (with error bit) on out of memory.
* F_parameter (with error bit) if a parameter is invalid.
* F_utf (with error bit) is returned on failure to read/process a UTF-8 character.
* Errors (with error bit) from: f_fss_skip_past_space().
*/
#ifndef _di_fl_fss_embedded_list_content_read_
- extern f_status_t fl_fss_embedded_list_content_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_nest_t *found, f_fss_delimits_t *delimits, f_fss_comments_t *comments);
+ extern f_status_t fl_fss_embedded_list_content_read(const f_string_static_t buffer, f_state_t state, f_string_range_t *range, f_fss_nest_t *found, f_fss_delimits_t *delimits, f_fss_comments_t *comments);
#endif // _di_fl_fss_embedded_list_content_read_
/**
* If f_fss_complete_full_trim, this will write any appropriate open and close aspects of this object, but will omit whitespace before and after the object.
* If f_fss_complete_partial, this will write any appropriate open and close aspects of this object.
* If f_fss_complete_partial_tim, this will write any appropriate open and close aspects of this object, but will omit whitespace before and after the object.
+ * @param state
+ * A state for handling interrupts during long running operations.
+ * There is no print_error() usage at this time (@todo this should be implemented and supported).
+ * There is no functions structure.
+ * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure).
+ *
+ * When interrupt() returns, only F_interrupt and F_interrupt_not are processed.
+ * Error bit designates an error but must be passed along with F_interrupt.
+ * All other statuses are ignored.
* @param range
* The start/stop location within the object string to write as an object.
* @param destination
* F_none_stop on success after reaching stopping point .
*
* F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete.
+ * F_interrupt (with error bit) if stopping due to an interrupt.
* F_memory_not (with error bit) on out of memory.
* F_none_eol (with error bit) after reaching an EOL, which is not supported by the standard.
* F_parameter (with error bit) if a parameter is invalid.
* Errors (with error bit) from: f_utf_buffer_increment().
*/
#ifndef _di_fl_fss_embedded_list_object_write_string_
- extern f_status_t fl_fss_embedded_list_object_write_string(const f_string_static_t object, const uint8_t complete, f_string_range_t *range, f_string_dynamic_t *destination);
+ extern f_status_t fl_fss_embedded_list_object_write_string(const f_string_static_t object, const uint8_t complete, f_state_t state, f_string_range_t *range, f_string_dynamic_t *destination);
#endif // _di_fl_fss_embedded_list_object_write_string_
/**
* These ranges are only checked/ignored if there is a valid nested object open or a valid nested object close.
* Any valid nested object open or valid nested object close inside an ingore range will not be escaped.
* Set the pointer address to 0 to disable.
+ * @param state
+ * A state for handling interrupts during long running operations.
+ * There is no print_error() usage at this time (@todo this should be implemented and supported).
+ * There is no functions structure.
+ * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure).
+ *
+ * When interrupt() returns, only F_interrupt and F_interrupt_not are processed.
+ * Error bit designates an error but must be passed along with F_interrupt.
+ * All other statuses are ignored.
* @param range
* The start/stop location within the content string to write as an content.
* @param destination
* F_none_stop on success after reaching stopping point.
*
* F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete.
+ * F_interrupt (with error bit) if stopping due to an interrupt.
* F_memory_not (with error bit) on out of memory.
* F_parameter (with error bit) if a parameter is invalid.
* F_utf (with error bit) is returned on failure to read/process a UTF-8 character.
* Errors (with error bit) from: f_utf_buffer_increment().
*/
#ifndef _di_fl_fss_embedded_list_content_write_string_
- extern f_status_t fl_fss_embedded_list_content_write_string(const f_string_static_t content, const uint8_t complete, const f_string_static_t *prepend, const f_string_ranges_t *ignore, f_string_range_t *range, f_string_dynamic_t *destination);
+ extern f_status_t fl_fss_embedded_list_content_write_string(const f_string_static_t content, const uint8_t complete, const f_string_static_t *prepend, const f_string_ranges_t *ignore, f_state_t state, f_string_range_t *range, f_string_dynamic_t *destination);
#endif // _di_fl_fss_embedded_list_content_write_string_
#ifdef __cplusplus
#endif
#ifndef _di_fl_fss_extended_object_read_
- f_status_t fl_fss_extended_object_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_object_t *found, f_fss_quote_t *quoted, f_fss_delimits_t *delimits) {
+ f_status_t fl_fss_extended_object_read(const f_string_static_t buffer, f_state_t state, f_string_range_t *range, f_fss_object_t *found, f_fss_quote_t *quoted, f_fss_delimits_t *delimits) {
#ifndef _di_level_1_parameter_checking_
if (!range) return F_status_set_error(F_parameter);
if (!found) return F_status_set_error(F_parameter);
const f_array_length_t delimits_used = delimits->used;
- f_status_t status = private_fl_fss_basic_read(buffer, F_true, range, found, quoted, delimits);
+ f_status_t status = private_fl_fss_basic_read(buffer, F_true, state, range, found, quoted, delimits);
if (F_status_is_error(status)) {
delimits->used = delimits_used;
#endif // _di_fl_fss_extended_object_read_
#ifndef _di_fl_fss_extended_content_read_
- f_status_t fl_fss_extended_content_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_content_t *found, f_fss_quotes_t *quotes, f_fss_delimits_t *delimits) {
+ f_status_t fl_fss_extended_content_read(const f_string_static_t buffer, f_state_t state, f_string_range_t *range, f_fss_content_t *found, f_fss_quotes_t *quotes, f_fss_delimits_t *delimits) {
#ifndef _di_level_1_parameter_checking_
if (!range) return F_status_set_error(F_parameter);
if (!found) return F_status_set_error(F_parameter);
if (F_status_is_error(status)) return status;
if (status == F_none_eol) {
- range->start++;
+ ++range->start;
+
return FL_fss_found_content_not;
}
uint8_t content_found = 0;
while (range->start <= range->stop && range->start < buffer.used) {
+
f_string_range_t content_partial = f_string_range_t_initialize;
f_fss_quote_t quoted = 0;
- status = private_fl_fss_basic_read(buffer, F_false, range, &content_partial, "ed, delimits);
+ status = private_fl_fss_basic_read(buffer, F_false, state, range, &content_partial, "ed, delimits);
if (status == FL_fss_found_object || status == FL_fss_found_object_content_not) {
if (found->used + 1 > found->size) {
- macro_f_string_ranges_t_increase(status_allocate, (*found));
+ macro_f_string_ranges_t_increase(status_allocate, state.step_small, (*found));
if (F_status_is_fine(status_allocate) && quotes) {
macro_f_fss_quotes_t_resize(status_allocate, (*quotes), found->size);
#endif // _di_fl_fss_extended_content_read_
#ifndef _di_fl_fss_extended_object_write_string_
-f_status_t fl_fss_extended_object_write_string(const f_string_static_t object, const f_fss_quote_t quote, const uint8_t complete, f_string_range_t *range, f_string_dynamic_t *destination) {
+f_status_t fl_fss_extended_object_write_string(const f_string_static_t object, const f_fss_quote_t quote, const uint8_t complete, f_state_t state, f_string_range_t *range, f_string_dynamic_t *destination) {
#ifndef _di_level_1_parameter_checking_
if (!range) return F_status_set_error(F_parameter);
if (!destination) return F_status_set_error(F_parameter);
const f_array_length_t used_start = destination->used;
- f_status_t status = private_fl_fss_basic_write(F_true, object, quote ? quote : f_fss_delimit_quote_double, range, destination);
+ f_status_t status = private_fl_fss_basic_write(F_true, object, quote ? quote : f_fss_delimit_quote_double, state, range, destination);
if (status == F_data_not_stop || status == F_data_not_eos) {
f_status_t status2 = F_none;
if (complete == f_fss_complete_full_trim) {
- status2 = private_fl_fss_basic_write_object_trim(quote ? quote : f_fss_delimit_quote_double, used_start, destination);
+ status2 = private_fl_fss_basic_write_object_trim(quote ? quote : f_fss_delimit_quote_double, used_start, state, destination);
if (F_status_is_error(status2)) return status2;
}
- status2 = f_string_dynamic_increase(destination);
+ status2 = f_string_dynamic_increase(state.step_large, destination);
if (F_status_is_error(status2)) return status2;
destination->string[destination->used++] = f_fss_extended_open;
#endif // _di_fl_fss_extended_object_write_string_
#ifndef _di_fl_fss_extended_content_write_string_
- f_status_t fl_fss_extended_content_write_string(const f_string_static_t content, const f_fss_quote_t quote, const uint8_t complete, f_string_range_t *range, f_string_dynamic_t *destination) {
+ f_status_t fl_fss_extended_content_write_string(const f_string_static_t content, const f_fss_quote_t quote, const uint8_t complete, f_state_t state, f_string_range_t *range, f_string_dynamic_t *destination) {
#ifndef _di_level_1_parameter_checking_
if (!range) return F_status_set_error(F_parameter);
if (!destination) return F_status_set_error(F_parameter);
#endif // _di_level_1_parameter_checking_
// this operates exactly like an object, syntax-wise.
- const f_status_t status = private_fl_fss_basic_write(F_false, content, quote ? quote : f_fss_delimit_quote_double, range, destination);
+ const f_status_t status = private_fl_fss_basic_write(F_false, content, quote ? quote : f_fss_delimit_quote_double, state, range, destination);
if (status == F_data_not_stop || status == F_data_not_eos) {
*
* @param buffer
* The buffer to read from.
+ * @param state
+ * A state for handling interrupts during long running operations.
+ * There is no print_error() usage at this time (@todo this should be implemented and supported).
+ * There is no functions structure.
+ * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure).
+ *
+ * When interrupt() returns, only F_interrupt and F_interrupt_not are processed.
+ * Error bit designates an error but must be passed along with F_interrupt.
+ * All other statuses are ignored.
* @param range
* The start/stop location within the buffer to be processed.
* The start location will be updated as the buffer is being processed.
* F_terminated_not_group_eos if EOS was reached before the a group termination was reached.
* F_terminated_not_group_stop if stop point was reached before the a group termination was reached.
*
+ * F_interrupt (with error bit) if stopping due to an interrupt.
* F_parameter (with error bit) if a parameter is invalid.
*
* Errors (with error bit) from: f_utf_buffer_increment().
* Errors (with error bit) from: f_fss_skip_past_space().
*/
#ifndef _di_fl_fss_extended_object_read_
- extern f_status_t fl_fss_extended_object_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_object_t *found, f_fss_quote_t *quoted, f_fss_delimits_t *delimits);
+ extern f_status_t fl_fss_extended_object_read(const f_string_static_t buffer, f_state_t state, f_string_range_t *range, f_fss_object_t *found, f_fss_quote_t *quoted, f_fss_delimits_t *delimits);
#endif // _di_fl_fss_extended_object_read_
/**
*
* @param buffer
* The buffer to read from.
+ * @param state
+ * A state for handling interrupts during long running operations.
+ * There is no print_error() usage at this time (@todo this should be implemented and supported).
+ * There is no functions structure.
+ * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure).
+ *
+ * When interrupt() returns, only F_interrupt and F_interrupt_not are processed.
+ * Error bit designates an error but must be passed along with F_interrupt.
+ * All other statuses are ignored.
* @param range
* The start/stop location within the buffer to be processed.
* The start location will be updated as the buffer is being processed.
* F_terminated_not_group_eos if EOS was reached before the a group termination was reached.
* F_terminated_not_group_stop if stop point was reached before the a group termination was reached.
*
+ * F_interrupt (with error bit) if stopping due to an interrupt.
* F_parameter (with error bit) if a parameter is invalid.
*
* Errors (with error bit) from: f_utf_buffer_increment().
* Errors (with error bit) from: f_fss_skip_past_space().
*/
#ifndef _di_fl_fss_extended_content_read_
- extern f_status_t fl_fss_extended_content_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_content_t *found, f_fss_quotes_t *quotes, f_fss_delimits_t *delimits);
+ extern f_status_t fl_fss_extended_content_read(const f_string_static_t buffer, f_state_t state, f_string_range_t *range, f_fss_content_t *found, f_fss_quotes_t *quotes, f_fss_delimits_t *delimits);
#endif // _di_fl_fss_extended_content_read_
/**
* If f_fss_complete_none, then only the object name is written.
* If f_fss_complete_full, this will write any appropriate open and close aspects of this object.
* If f_fss_complete_partial, this will write any appropriate open and close aspects of this object.
+ * @param state
+ * A state for handling interrupts during long running operations.
+ * There is no print_error() usage at this time (@todo this should be implemented and supported).
+ * There is no functions structure.
+ * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure).
+ *
+ * When interrupt() returns, only F_interrupt and F_interrupt_not are processed.
+ * Error bit designates an error but must be passed along with F_interrupt.
+ * All other statuses are ignored.
* @param range
* The start/stop location within the object string to write as an object.
* @param destination
* F_data_not_eos no data to write due start location being greater than or equal to buffer size.
*
* F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete.
+ * F_interrupt (with error bit) if stopping due to an interrupt.
* F_memory_not (with error bit) on out of memory.
* F_none_eol (with error bit) after reaching an EOL, which is not supported by the standard.
* F_parameter (with error bit) if a parameter is invalid.
* Errors (with error bit) from: f_utf_buffer_increment().
*/
#ifndef _di_fl_fss_extended_object_write_string_
- extern f_status_t fl_fss_extended_object_write_string(const f_string_static_t object, const f_fss_quote_t quote, const uint8_t complete, f_string_range_t *range, f_string_dynamic_t *destination);
+ extern f_status_t fl_fss_extended_object_write_string(const f_string_static_t object, const f_fss_quote_t quote, const uint8_t complete, f_state_t state, f_string_range_t *range, f_string_dynamic_t *destination);
#endif // _di_fl_fss_extended_object_write_string_
/**
* If f_fss_complete_end, then the content followed by any appropriate "end" character designating the last content for some object, printing final newline, if applicable.
* If f_fss_complete_partial, this will write any appropriate open and close aspects of this content, except for the final newline.
* If f_fss_complete_full, this will write any appropriate open and close aspects of this content, including the final newline.
+ * @param state
+ * A state for handling interrupts during long running operations.
+ * There is no print_error() usage at this time (@todo this should be implemented and supported).
+ * There is no functions structure.
+ * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure).
+ *
+ * When interrupt() returns, only F_interrupt and F_interrupt_not are processed.
+ * Error bit designates an error but must be passed along with F_interrupt.
+ * All other statuses are ignored.
* @param range
* The start/stop location within the content string to write as an content.
* @param destination
* F_data_not_eos no data to write due start location being greater than or equal to buffer size.
*
* F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete.
+ * F_interrupt (with error bit) if stopping due to an interrupt.
* F_memory_not (with error bit) on out of memory.
* F_none_eol (with error bit) after reaching an EOL, which is not supported by the standard.
* F_parameter (with error bit) if a parameter is invalid.
* Errors (with error bit) from: f_utf_buffer_increment().
*/
#ifndef _di_fl_fss_extended_content_write_string_
- extern f_status_t fl_fss_extended_content_write_string(const f_string_static_t content, const f_fss_quote_t quote, const uint8_t complete, f_string_range_t *range, f_string_dynamic_t *destination);
+ extern f_status_t fl_fss_extended_content_write_string(const f_string_static_t content, const f_fss_quote_t quote, const uint8_t complete, f_state_t state, f_string_range_t *range, f_string_dynamic_t *destination);
#endif // _di_fl_fss_extended_content_write_string_
#ifdef __cplusplus
#endif
#ifndef _di_fl_fss_extended_list_object_read_
- f_status_t fl_fss_extended_list_object_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_object_t *found, f_fss_delimits_t *delimits) {
+ f_status_t fl_fss_extended_list_object_read(const f_string_static_t buffer, f_state_t state, f_string_range_t *range, f_fss_object_t *found, f_fss_delimits_t *delimits) {
#ifndef _di_level_1_parameter_checking_
if (!range) return F_status_set_error(F_parameter);
if (!found) return F_status_set_error(F_parameter);
if (F_status_is_error(status)) {
delimits->used = delimits_used;
+
return status;
}
// identify where the object ends.
while (range->start <= range->stop && range->start < buffer.used && buffer.string[range->start] != f_fss_eol) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
+
if (buffer.string[range->start] == f_fss_delimit_slash) {
slash_first = range->start;
slash_count = 1;
while (range->start <= range->stop && range->start < buffer.used && (buffer.string[range->start] == f_fss_delimit_placeholder || buffer.string[range->start] == f_fss_delimit_slash)) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
+
if (buffer.string[range->start] == f_fss_delimit_slash) slash_count++;
status = f_utf_buffer_increment(buffer, range, 1);
while (range->start <= range->stop && range->start < buffer.used) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
+
if (buffer.string[range->start] == f_fss_eol) break;
status = f_fss_is_graph(buffer, *range);
graph_first = F_false;
// comments may only have whitespace before the '#', therefore only the first slash needs to be delimited.
- macro_f_fss_delimits_t_increase(status, (*delimits));
+ macro_f_fss_delimits_t_increase(status, state.step_small, (*delimits));
if (F_status_is_error(status)) break;
delimits->array[delimits->used++] = slash_first;
while (range->start <= range->stop && range->start < buffer.used) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
+
if (buffer.string[range->start] == f_fss_eol) break;
status = f_fss_is_space(buffer, *range);
// seek to the end of the line when no valid object is found.
while (range->start <= range->stop && range->start < buffer.used && buffer.string[range->start] != f_fss_eol) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
+
status = f_utf_buffer_increment(buffer, range, 1);
if (F_status_is_error(status)) {
#endif // _di_fl_fss_extended_list_object_read_
#ifndef _di_fl_fss_extended_list_content_read_
- f_status_t fl_fss_extended_list_content_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_content_t *found, f_fss_delimits_t *delimits, f_fss_comments_t *comments) {
+ f_status_t fl_fss_extended_list_content_read(const f_string_static_t buffer, f_state_t state, f_string_range_t *range, f_fss_content_t *found, f_fss_delimits_t *delimits, f_fss_comments_t *comments) {
#ifndef _di_level_1_parameter_checking_
if (!range) return F_status_set_error(F_parameter);
if (!found) return F_status_set_error(F_parameter);
private_macro_fl_fss_content_with_comments_return_on_overflow((buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, F_none_eos, F_none_stop);
- macro_f_fss_content_t_increase(status, (*found))
+ macro_f_fss_content_t_increase(status, state.step_small, (*found))
if (F_status_is_error(status)) return status;
found->array[found->used].start = range->start;
// identify where the content ends.
while (range->start <= range->stop && range->start < buffer.used) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
+
status = f_fss_skip_past_space(buffer, range);
- if (F_status_is_error(status)) return status;
+ if (F_status_is_error(status)) break;
if (status == F_none_eol) {
newline_last = range->start;
for (++range->start; range->start <= range->stop && range->start < buffer.used; ++range->start) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
+
if (buffer.string[range->start] == f_fss_delimit_placeholder) {
continue;
} else if (buffer.string[range->start] != f_fss_delimit_slash) {
while (range->start <= range->stop && range->start < buffer.used) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
+
if (buffer.string[range->start] == f_fss_eol) break;
status = f_fss_is_space(buffer, *range);
if (range->start > range->stop || range->start >= buffer.used) break;
if (buffer.string[range->start] == f_fss_eol) {
- macro_f_fss_delimits_t_increase(status, (*delimits));
+ macro_f_fss_delimits_t_increase(status, state.step_small, (*delimits));
if (F_status_is_error(status)) break;
delimits->array[delimits->used++] = slash_first;
}
}
else if (buffer.string[range->start] == f_fss_comment) {
- macro_f_fss_delimits_t_increase(status, (*delimits));
+ macro_f_fss_delimits_t_increase(status, state.step_small, (*delimits));
if (F_status_is_error(status)) break;
delimits->array[delimits->used++] = slash_first;
while (range->start <= range->stop && range->start < buffer.used) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
+
if (buffer.string[range->start] == f_fss_eol) break;
status = f_fss_is_space(buffer, *range);
status = f_fss_seek_to_eol(buffer, range);
if (F_status_is_error(status)) break;
- macro_f_fss_comments_t_increase(status, (*comments))
+ macro_f_fss_comments_t_increase(status, state.step_small, (*comments))
if (F_status_is_error(status)) break;
if (range->start > range->stop || range->start >= buffer.used) {
#endif // _di_fl_fss_extended_list_content_read_
#ifndef _di_fl_fss_extended_list_object_write_string_
- f_status_t fl_fss_extended_list_object_write_string(const f_string_static_t object, const uint8_t complete, f_string_range_t *range, f_string_dynamic_t *destination) {
+ f_status_t fl_fss_extended_list_object_write_string(const f_string_static_t object, const uint8_t complete, f_state_t state, f_string_range_t *range, f_string_dynamic_t *destination) {
#ifndef _di_level_1_parameter_checking_
if (!destination) return F_status_set_error(F_parameter);
#endif // _di_level_1_parameter_checking_
// find the first graph character.
while (range->start <= range->stop && range->start < object.used) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
+
if (object.string[range->start] == f_fss_comment) {
// when a comment is found, escape it.
- status = f_string_dynamic_increase(destination);
+ status = f_string_dynamic_increase(state.step_large, destination);
if (F_status_is_error(status)) break;
destination->string[destination->used++] = f_fss_delimit_slash;
while (range->start <= range->stop && range->start < object.used) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
+
if (object.string[range->start] == f_fss_delimit_slash) {
slash_count = 1;
for (++range->start; range->start <= range->stop && range->start < object.used; ++range->start) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
+
if (object.string[range->start] == f_fss_delimit_placeholder) {
continue;
} else if (object.string[range->start] != f_fss_delimit_slash) {
break;
}
- slash_count++;
+ ++slash_count;
} // for
if (F_status_is_error(status)) break;
if (complete == f_fss_complete_partial || complete == f_fss_complete_partial_trim || complete == f_fss_complete_full || complete == f_fss_complete_full_trim) {
if (complete == f_fss_complete_full_trim) {
- status = private_fl_fss_basic_list_write_object_trim(used_start, destination);
+ status = private_fl_fss_basic_list_write_object_trim(used_start, state, destination);
if (F_status_is_error(status)) {
destination->used = used_start;
#endif // _di_fl_fss_extended_list_object_write_string_
#ifndef _di_fl_fss_extended_list_content_write_string_
- f_status_t fl_fss_extended_list_content_write_string(const f_string_static_t content, const uint8_t complete, const f_string_static_t *prepend, const f_string_ranges_t *ignore, f_string_range_t *range, f_string_dynamic_t *destination) {
+ f_status_t fl_fss_extended_list_content_write_string(const f_string_static_t content, const uint8_t complete, const f_string_static_t *prepend, const f_string_ranges_t *ignore, f_state_t state, f_string_range_t *range, f_string_dynamic_t *destination) {
#ifndef _di_level_1_parameter_checking_
if (!range) return F_status_set_error(F_parameter);
if (!destination) return F_status_set_error(F_parameter);
while (range->start <= range->stop && range->start < content.used) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
+
if (content.string[range->start] == f_fss_delimit_slash && !is_comment) {
slash_count = 1;
for (++range->start; range->start <= range->stop && range->start < content.used; ++range->start) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
+
if (content.string[range->start] == f_fss_delimit_placeholder) continue;
if (content.string[range->start] != f_fss_delimit_slash) break;
range->start = start + 1;
- status = private_fl_fss_basic_list_write_add_until_end(content, range, destination);
+ status = private_fl_fss_basic_list_write_add_until_end(content, state, range, destination);
if (F_status_is_error(status)) break;
if (content.string[range->start] != f_fss_eol) {
} // for
if (r < ignore->used) {
- status = f_string_dynamic_increase(destination);
+ status = f_string_dynamic_increase(state.step_large, destination);
if (F_status_is_error(status)) break;
destination->string[destination->used++] = content.string[start];
range->start = start + 1;
- status = private_fl_fss_basic_list_write_add_until_end(content, range, destination);
+ status = private_fl_fss_basic_list_write_add_until_end(content, state, range, destination);
if (F_status_is_error(status)) break;
continue;
}
- status = f_string_dynamic_increase(destination);
+ status = f_string_dynamic_increase(state.step_large, destination);
if (F_status_is_error(status)) break;
destination->string[destination->used++] = content.string[start];
*
* @param buffer
* The buffer to read from.
+ * @param state
+ * A state for handling interrupts during long running operations.
+ * There is no print_error() usage at this time (@todo this should be implemented and supported).
+ * There is no functions structure.
+ * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure).
+ *
+ * When interrupt() returns, only F_interrupt and F_interrupt_not are processed.
+ * Error bit designates an error but must be passed along with F_interrupt.
+ * All other statuses are ignored.
* @param range
* The start/stop location within the buffer to be processed.
* The start location will be updated as the buffer is being processed.
* F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete.
* F_complete_not_utf_eos (with error bit) if the end of buffer is reached before the complete UTF-8 character can be processed.
* F_complete_not_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed.
+ * F_interrupt (with error bit) if stopping due to an interrupt.
* F_memory_not (with error bit) on out of memory.
* F_parameter (with error bit) if a parameter is invalid.
* F_utf (with error bit) is returned on failure to read/process a UTF-8 character.
* Errors (with error bit) from: f_fss_skip_past_space().
*/
#ifndef _di_fl_fss_extended_list_object_read_
- extern f_status_t fl_fss_extended_list_object_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_object_t *found, f_fss_delimits_t *delimits);
+ extern f_status_t fl_fss_extended_list_object_read(const f_string_static_t buffer, f_state_t state, f_string_range_t *range, f_fss_object_t *found, f_fss_delimits_t *delimits);
#endif // _di_fl_fss_extended_list_object_read_
/**
*
* @param buffer
* The buffer to read from.
+ * @param state
+ * A state for handling interrupts during long running operations.
+ * There is no print_error() usage at this time (@todo this should be implemented and supported).
+ * There is no functions structure.
+ * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure).
+ *
+ * When interrupt() returns, only F_interrupt and F_interrupt_not are processed.
+ * Error bit designates an error but must be passed along with F_interrupt.
+ * All other statuses are ignored.
* @param range
* The start/stop location within the buffer to be processed.
* The start location will be updated as the buffer is being processed.
* F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete.
* F_complete_not_utf_eos (with error bit) if the end of buffer is reached before the complete UTF-8 character can be processed.
* F_complete_not_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed.
+ * F_interrupt (with error bit) if stopping due to an interrupt.
* F_memory_not (with error bit) on out of memory.
* F_parameter (with error bit) if a parameter is invalid.
* F_utf (with error bit) is returned on failure to read/process a UTF-8 character.
* Errors (with error bit) from: f_fss_skip_past_space().
*/
#ifndef _di_fl_fss_extended_list_content_read_
- extern f_status_t fl_fss_extended_list_content_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_content_t *found, f_fss_delimits_t *delimits, f_fss_comments_t *comments);
+ extern f_status_t fl_fss_extended_list_content_read(const f_string_static_t buffer, f_state_t state, f_string_range_t *range, f_fss_content_t *found, f_fss_delimits_t *delimits, f_fss_comments_t *comments);
#endif // _di_fl_fss_extended_list_content_read_
/**
* If f_fss_complete_full_trim, this will write any appropriate open and close aspects of this object, but will omit whitespace before and after the object.
* If f_fss_complete_partial, this will write any appropriate open and close aspects of this object.
* If f_fss_complete_partial_tim, this will write any appropriate open and close aspects of this object, but will omit whitespace before and after the object.
+ * @param state
+ * A state for handling interrupts during long running operations.
+ * There is no print_error() usage at this time (@todo this should be implemented and supported).
+ * There is no functions structure.
+ * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure).
+ *
+ * When interrupt() returns, only F_interrupt and F_interrupt_not are processed.
+ * Error bit designates an error but must be passed along with F_interrupt.
+ * All other statuses are ignored.
* @param range
* The start/stop location within the object string to write as an object.
* @param destination
* F_none_stop on success after reaching stopping point .
*
* F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete.
+ * F_interrupt (with error bit) if stopping due to an interrupt.
* F_memory_not (with error bit) on out of memory.
* F_none_eol (with error bit) after reaching an EOL, which is not supported by the standard.
* F_parameter (with error bit) if a parameter is invalid.
* Errors (with error bit) from: f_utf_buffer_increment().
*/
#ifndef _di_fl_fss_extended_list_object_write_string_
- extern f_status_t fl_fss_extended_list_object_write_string(const f_string_static_t object, const uint8_t complete, f_string_range_t *range, f_string_dynamic_t *destination);
+ extern f_status_t fl_fss_extended_list_object_write_string(const f_string_static_t object, const uint8_t complete, f_state_t state, f_string_range_t *range, f_string_dynamic_t *destination);
#endif // _di_fl_fss_extended_list_object_write_string_
/**
* These ranges are only checked/ignored if there is a valid nested object open or a valid nested object close.
* Any valid nested object open or valid nested object close inside an ingore range will not be escaped.
* Set the pointer address to 0 to disable.
+ * @param state
+ * A state for handling interrupts during long running operations.
+ * There is no print_error() usage at this time (@todo this should be implemented and supported).
+ * There is no functions structure.
+ * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure).
+ *
+ * When interrupt() returns, only F_interrupt and F_interrupt_not are processed.
+ * Error bit designates an error but must be passed along with F_interrupt.
+ * All other statuses are ignored.
* @param range
* The start/stop location within the content string to write as an content.
* @param destination
* F_none_stop on success after reaching stopping point .
*
* F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete.
+ * F_interrupt (with error bit) if stopping due to an interrupt.
* F_memory_not (with error bit) on out of memory.
* F_parameter (with error bit) if a parameter is invalid.
* F_utf (with error bit) is returned on failure to read/process a UTF-8 character.
* Errors (with error bit) from: f_utf_buffer_increment().
*/
#ifndef _di_fl_fss_extended_list_content_write_string_
- extern f_status_t fl_fss_extended_list_content_write_string(const f_string_static_t content, const uint8_t complete, const f_string_static_t *prepend, const f_string_ranges_t *ignore, f_string_range_t *range, f_string_dynamic_t *destination);
+ extern f_status_t fl_fss_extended_list_content_write_string(const f_string_static_t content, const uint8_t complete, const f_string_static_t *prepend, const f_string_ranges_t *ignore, f_state_t state, f_string_range_t *range, f_string_dynamic_t *destination);
#endif // _di_fl_fss_extended_list_content_write_string_
#ifdef __cplusplus
#endif
#if !defined(_di_fl_fss_basic_object_write_string_) || !defined(_di_fl_fss_extended_object_write_string_)
- f_status_t private_fl_fss_basic_write_object_trim(const f_fss_quote_t quote, const f_array_length_t used_start, f_string_dynamic_t *destination) {
+ f_status_t private_fl_fss_basic_write_object_trim(const f_fss_quote_t quote, const f_array_length_t used_start, f_state_t state, f_string_dynamic_t *destination) {
f_status_t status = F_none;
f_string_range_t destination_range = macro_f_string_range_t_initialize(destination->used);
// if there are any spaces, then this will be quoted so find the first non-placeholder character.
for (; destination_range.start < destination->used; ++destination_range.start) {
+
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ destination->used = used_start;
+
+ return F_status_set_error(F_interrupt);
+ }
+ }
+
if (destination->string[destination_range.start] != f_fss_delimit_placeholder) break;
} // for
for (++destination_range.start; destination_range.start < destination->used; ++destination_range.start) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ destination->used = used_start;
+
+ return F_status_set_error(F_interrupt);
+ }
+ }
+
if (destination->string[destination_range.start] == f_fss_delimit_placeholder) {
continue;
}
} // for
// find the last quote.
- for (destination_range.start = destination->used - 1; destination_range.start > front; destination_range.start--) {
+ for (destination_range.start = destination->used - 1; destination_range.start > front; --destination_range.start) {
+
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ destination->used = used_start;
+
+ return F_status_set_error(F_interrupt);
+ }
+ }
if (destination->string[destination_range.start] == quote) {
- destination_range.start--;
+ --destination_range.start;
break;
}
} // for
for (; destination_range.start > front; destination_range.start--) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ destination->used = used_start;
+
+ return F_status_set_error(F_interrupt);
+ }
+ }
+
if (destination->string[destination_range.start] == f_fss_delimit_placeholder) {
continue;
}
if (F_status_is_error(status)) {
destination->used = used_start;
+
return status;
}
// if there is no whitespace between the quotes, post-trimming, then remove the quotes.
for (destination_range.start = front; destination_range.start < rear; ++destination_range.start) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ destination->used = used_start;
+
+ return F_status_set_error(F_interrupt);
+ }
+ }
+
status = f_fss_is_space(*destination, destination_range);
if (F_status_is_error(status)) {
destination->used = used_start;
+
return status;
}
#endif // !defined(_di_fl_fss_basic_object_write_string_) || !defined(_di_fl_fss_extended_object_write_string_)
#if !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_) || !defined(_di_fl_fss_embedded_list_content_write_string_)
- f_status_t private_fl_fss_basic_list_write_add_until_end(const f_string_static_t buffer, f_string_range_t *range, f_string_dynamic_t *destination) {
+ f_status_t private_fl_fss_basic_list_write_add_until_end(const f_string_static_t buffer, f_state_t state, f_string_range_t *range, f_string_dynamic_t *destination) {
f_status_t status = F_none;
for (; range->start <= range->stop && range->start < buffer.used; ++range->start) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ return F_status_set_error(F_interrupt);
+ }
+ }
+
if (buffer.string[range->start] == f_fss_delimit_placeholder) continue;
if (buffer.string[range->start] == f_fss_eol) break;
- status = f_string_dynamic_increase(destination);
+ status = f_string_dynamic_increase(state.step_large, destination);
if (F_status_is_error(status)) break;
destination->string[destination->used++] = buffer.string[range->start];
#endif // !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_) || !defined(_di_fl_fss_embedded_list_content_write_string_)
#if !defined(_di_fl_fss_basic_list_object_write_string_) || !defined(_di_fl_fss_extended_list_object_write_string_)
- f_status_t private_fl_fss_basic_list_write_object_trim(const f_array_length_t used_start, f_string_dynamic_t *destination) {
+ f_status_t private_fl_fss_basic_list_write_object_trim(const f_array_length_t used_start, f_state_t state, f_string_dynamic_t *destination) {
f_status_t status = F_none;
f_string_range_t destination_range = macro_f_string_range_t_initialize(destination->used);
for (; destination_range.start < destination->used; ++destination_range.start) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ return F_status_set_error(F_interrupt);
+ }
+ }
+
if (destination->string[destination_range.start] == f_fss_delimit_placeholder) {
continue;
}
} // for
} // for
- for (destination_range.start = destination->used - 1; destination_range.start > 0; destination_range.start--) {
+ for (destination_range.start = destination->used - 1; destination_range.start > 0; --destination_range.start) {
+
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ return F_status_set_error(F_interrupt);
+ }
+ }
if (destination->string[destination_range.start] == f_fss_delimit_placeholder) {
--destination->used;
#endif // !defined(_di_fl_fss_basic_list_object_write_string_) || !defined(_di_fl_fss_extended_list_object_write_string_)
#if !defined(_di_fl_fss_basic_object_read_) || !defined(_di_fl_fss_extended_object_read_) || !defined(_di_fl_fss_extended_content_read_)
- f_status_t private_fl_fss_basic_read(const f_string_static_t buffer, const bool object_as, f_string_range_t *range, f_fss_object_t *found, f_fss_quote_t *quote, f_fss_delimits_t *delimits) {
+ f_status_t private_fl_fss_basic_read(const f_string_static_t buffer, const bool object_as, f_state_t state, f_string_range_t *range, f_fss_object_t *found, f_fss_quote_t *quote, f_fss_delimits_t *delimits) {
f_status_t status = f_fss_skip_past_space(buffer, range);
if (F_status_is_error(status)) return status;
while (buffer.string[range->start] != f_fss_eol) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ return F_status_set_error(F_interrupt);
+ }
+ }
+
++range->start;
if (range->start >= buffer.used) {
while (range->start <= range->stop && range->start < buffer.used) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
+
status = f_fss_is_zero_width(buffer, *range);
- if (F_status_is_error(status)) return status;
+ if (F_status_is_error(status)) break;
if (status == F_true) {
status = f_utf_buffer_increment(buffer, range, 1);
- if (F_status_is_error(status)) return status;
+ if (F_status_is_error(status)) break;
continue;
}
if (buffer.string[range->start] != f_fss_delimit_slash) {
status = f_fss_is_space(buffer, *range);
- if (F_status_is_error(status)) return status;
+ if (F_status_is_error(status)) break;
// found the end of the object while processing the slash for potential delimits.
if (status == F_true) {
found->stop = range->start - 1;
status = f_utf_buffer_increment(buffer, range, 1);
- if (F_status_is_error(status)) return status;
+ if (F_status_is_error(status)) break;
if (buffer.string[range->start] == f_fss_eol) {
return FL_fss_found_object_content_not;
}
status = f_utf_buffer_increment(buffer, range, 1);
- if (F_status_is_error(status)) return status;
+ if (F_status_is_error(status)) break;
} // while
+ if (F_status_is_error(status)) return status;
+
if (range->start >= buffer.used) {
found->stop = buffer.used - 1;
// only the first slash before a quoted needs to be escaped (or not) as once there is a slash before a quoted, this cannot ever be a quote object.
// this simplifies the number of slashes needed.
- macro_f_fss_delimits_t_increase(status, (*delimits));
+ macro_f_fss_delimits_t_increase(status, state.step_small, (*delimits));
if (F_status_is_error(status)) return status;
delimits->array[delimits->used] = first_slash;
while (range->start <= range->stop && range->start < buffer.used) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
+
status = f_fss_is_space(buffer, *range);
- if (F_status_is_error(status)) return status;
+ if (F_status_is_error(status)) break;
if (status == F_true) break;
status = f_utf_buffer_increment(buffer, range, 1);
- if (F_status_is_error(status)) return status;
+ if (F_status_is_error(status)) break;
} // while
+ if (F_status_is_error(status)) return status;
+
found->stop = range->start - 1;
if (buffer.string[range->start] == f_fss_eol) {
while (range->start <= range->stop && range->start < buffer.used) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ return F_status_set_error(F_interrupt);
+ }
+ }
+
if (buffer.string[range->start] == f_fss_delimit_slash) {
first_slash = range->start;
slash_count = 1;
while (range->start <= range->stop && range->start < buffer.used) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ return F_status_set_error(F_interrupt);
+ }
+ }
+
if (buffer.string[range->start] == f_fss_delimit_placeholder) {
status = f_utf_buffer_increment(buffer, range, 1);
if (F_status_is_error(status)) return status;
++delimits->used;
}
- slash_count--;
+ --slash_count;
}
status = f_utf_buffer_increment(buffer, range, 1);
range->start = location + 1;
while (buffer.string[range->start] == f_fss_delimit_placeholder) {
+
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ return F_status_set_error(F_interrupt);
+ }
+ }
+
++range->start;
if (range->start >= buffer.used) return F_none_eos;
while (range->start <= range->stop && range->start < buffer.used && buffer.string[range->start] != f_fss_eol) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ return F_status_set_error(F_interrupt);
+ }
+ }
+
status = f_utf_buffer_increment(buffer, range, 1);
if (F_status_is_error(status)) return status;
} // while
++delimits->used;
}
- slash_count--;
+ --slash_count;
}
status = f_utf_buffer_increment(buffer, range, 1);
while (range->start <= range->stop && range->start < buffer.used) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ return F_status_set_error(F_interrupt);
+ }
+ }
+
if (buffer.string[range->start] == f_fss_eol) {
// move the start position to after the EOL.
while (range->start <= range->stop && range->start < buffer.used && buffer.string[range->start] != f_fss_eol) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ return F_status_set_error(F_interrupt);
+ }
+ }
+
status = f_utf_buffer_increment(buffer, range, 1);
if (F_status_is_error(status)) return status;
} // while
#endif // !defined(_di_fl_fss_basic_object_read_) || !defined(_di_fl_fss_extended_object_read_)
#if !defined(_di_fl_fss_basic_object_write_string_) || !defined(_di_fl_fss_extended_object_write_string_) || !defined(_di_fl_fss_extended_content_write_string_)
- f_status_t private_fl_fss_basic_write(const bool object_as, const f_string_static_t object, const f_fss_quote_t quote, f_string_range_t *range, f_string_dynamic_t *destination) {
+ f_status_t private_fl_fss_basic_write(const bool object_as, const f_string_static_t object, const f_fss_quote_t quote, f_state_t state, f_string_range_t *range, f_string_dynamic_t *destination) {
f_status_t status = f_fss_skip_past_space(object, range);
if (F_status_is_error(status)) return status;
for (; range->start <= range->stop && range->start < object.used; ) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
+
if (object.string[range->start] == f_fss_delimit_slash) {
item_first = range->start++;
item_total = 1;
for (; range->start <= range->stop && range->start < object.used; ++range->start) {
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ status = F_status_set_error(F_interrupt);
+ break;
+ }
+ }
+
if (object.string[range->start] == f_fss_delimit_slash) {
++item_total;
}
// if this is the first quote, then only a single delimit slash is needed.
if (item_first == input_start) {
- status = f_string_dynamic_increase(destination);
+ status = f_string_dynamic_increase(state.step_large, destination);
if (F_status_is_error(status)) break;
destination->string[destination->used++] = f_fss_delimit_slash;
// add the slashes that delimit the slashes.
if (item_first == input_start) {
- status = f_string_dynamic_increase(destination);
+ status = f_string_dynamic_increase(state.step_large, destination);
if (F_status_is_error(status)) break;
destination->string[destination->used++] = f_fss_delimit_slash;
// the very first quote, must be escaped, when quoting is disabled.
if (item_first == input_start) {
- status = f_string_dynamic_increase(destination);
+ status = f_string_dynamic_increase(state.step_large, destination);
if (F_status_is_error(status)) break;
destination->string[used_start + 1] = f_fss_delimit_slash;
if (range->start > range->stop || range->start >= object.used) {
- status = f_string_dynamic_increase(destination);
+ status = f_string_dynamic_increase(state.step_large, destination);
if (F_status_is_error(status)) break;
destination->string[destination->used++] = quote;
}
if (object.string[range->start] == quote) {
- status = f_string_dynamic_increase(destination);
+ status = f_string_dynamic_increase(state.step_large, destination);
if (F_status_is_error(status)) break;
destination->string[destination->used++] = quote;
if (status == F_true) {
if (item_first != input_start) {
- status = f_string_dynamic_increase(destination);
+ status = f_string_dynamic_increase(state.step_large, destination);
if (F_status_is_error(status)) break;
destination->string[destination->used++] = f_fss_delimit_slash;
}
if (quoted) {
- status = f_string_dynamic_increase(destination);
+ status = f_string_dynamic_increase(state.step_large, destination);
if (F_status_is_error(status)) {
destination->used = used_start;
if (destination->string[input_start] == quote) {
for (i = input_start + 1; i <= range->stop && i < object.used; ++i) {
+
+ if (state.interrupt) {
+ status = state.interrupt((void *) &state, 0);
+
+ if (F_status_set_fine(status) == F_interrupt) {
+ return F_status_set_error(F_interrupt);
+ }
+ }
+
if (object.string[i] != f_fss_delimit_placeholder) break;
} // for
* Otherwise, this is the type of quote to wrap the object in when writing.
* @param used_start
* The destination.used value before any operations were perfomed.
+ * @param state
+ * A state for handling interrupts during long running operations.
+ * There is no print_error() usage at this time (@todo this should be implemented and supported).
+ * There is no functions structure.
+ * There is no data structure passed to these functions.
+ *
+ * When interrupt() returns, only F_interrupt and F_interrupt_not are processed.
+ * Error bit designates an error but must be passed along with F_interrupt.
+ * All other statuses are ignored.
* @param destination
* The buffer where the object is written to.
*
* @return
* F_none on success.
*
+ * F_interrupt (with error bit) if stopping due to an interrupt.
+ *
* Errors (with error bit) from: f_fss_is_space().
*
* @see fl_fss_basic_object_write_string()
* @see fl_fss_extended_object_write_string()
*/
#if !defined(_di_fl_fss_basic_object_write_string_) || !defined(_di_fl_fss_extended_object_write_string_)
- extern f_status_t private_fl_fss_basic_write_object_trim(const f_fss_quote_t quote, const f_array_length_t used_start, f_string_dynamic_t *destination) f_attribute_visibility_internal;
+ extern f_status_t private_fl_fss_basic_write_object_trim(const f_fss_quote_t quote, const f_array_length_t used_start, f_state_t state, f_string_dynamic_t *destination) f_attribute_visibility_internal;
#endif // !defined(_di_fl_fss_basic_object_write_string_) || !defined(_di_fl_fss_extended_object_write_string_)
/**
*
* @param buffer
* The buffer to seek through.
+ * @param state
+ * A state for handling interrupts during long running operations.
+ * There is no print_error() usage at this time (@todo this should be implemented and supported).
+ * There is no functions structure.
+ * There is no data structure passed to these functions.
+ *
+ * When interrupt() returns, only F_interrupt and F_interrupt_not are processed.
+ * Error bit designates an error but must be passed along with F_interrupt.
+ * All other statuses are ignored.
* @param range
* The start/stop location within the buffer string to process.
* @param destination
* @return
* F_none on success.
*
+ * F_interrupt (with error bit) if stopping due to an interrupt.
+ *
* Errors (with error bit) from: f_string_dynamic_increase().
*
* @see fl_fss_basic_list_content_write_string()
* @see f_string_dynamic_increase()
*/
#if !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_) || !defined(_di_fl_fss_embedded_list_content_write_string_)
- extern f_status_t private_fl_fss_basic_list_write_add_until_end(const f_string_static_t buffer, f_string_range_t *range, f_string_dynamic_t *destination) f_attribute_visibility_internal;
+ extern f_status_t private_fl_fss_basic_list_write_add_until_end(const f_string_static_t buffer, f_state_t state, f_string_range_t *range, f_string_dynamic_t *destination) f_attribute_visibility_internal;
#endif // !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_) || !defined(_di_fl_fss_embedded_list_content_write_string_)
/**
* Trim a given object used by the basic list and extended list object write functions.
*
* @param used_start
- * The destination.used value before any operations were perfomed.
+ * The destination.used value before any operations were performed.
+ * @param state
+ * A state for handling interrupts during long running operations.
+ * There is no print_error() usage at this time (@todo this should be implemented and supported).
+ * There is no functions structure.
+ * There is no data structure passed to these functions.
+ *
+ * When interrupt() returns, only F_interrupt and F_interrupt_not are processed.
+ * Error bit designates an error but must be passed along with F_interrupt.
+ * All other statuses are ignored.
* @param destination
* The buffer where the object is written to.
*
* @return
* F_none on success.
*
+ * F_interrupt (with error bit) if stopping due to an interrupt.
+ *
* Errors (with error bit) from: f_fss_is_space().
*
* @see fl_fss_basic_list_object_write_string()
* @see fl_fss_extended_list_object_write_string()
*/
#if !defined(_di_fl_fss_basic_list_object_write_string_) || !defined(_di_fl_fss_extended_list_object_write_string_)
- extern f_status_t private_fl_fss_basic_list_write_object_trim(const f_array_length_t used_start, f_string_dynamic_t *destination) f_attribute_visibility_internal;
+ extern f_status_t private_fl_fss_basic_list_write_object_trim(const f_array_length_t used_start, f_state_t state, f_string_dynamic_t *destination) f_attribute_visibility_internal;
#endif // !defined(_di_fl_fss_basic_list_object_write_string_) || !defined(_di_fl_fss_extended_list_object_write_string_)
/**
*
* As Object, this checks if the first graph character is a comment character '#', or an escaped comment character '#'.
* As Content, this does nothing special in regards to a leading '#'.
+ * @param state
+ * A state for handling interrupts during long running operations.
+ * There is no print_error() usage at this time (@todo this should be implemented and supported).
+ * There is no functions structure.
+ * There is no data structure passed to these functions.
+ *
+ * When interrupt() returns, only F_interrupt and F_interrupt_not are processed.
+ * Error bit designates an error but must be passed along with F_interrupt.
+ * All other statuses are ignored.
* @param range
* The start/stop location within the buffer to be processed.
* The start location will be updated as the buffer is being processed.
* F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete.
* F_complete_not_utf_eos (with error bit) if the end of buffer is reached before the complete UTF-8 character can be processed.
* F_complete_not_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed.
+ * F_interrupt (with error bit) if stopping due to an interrupt.
* F_memory_not (with error bit) on out of memory.
* F_parameter (with error bit) if a parameter is invalid.
* F_utf (with error bit) is returned on failure to read/process a UTF-8 character.
* @see fl_fss_extended_content_read()
*/
#if !defined(_di_fl_fss_basic_object_read_) || !defined(_di_fl_fss_extended_object_read_) || !defined(_di_fl_fss_extended_content_read_)
- extern f_status_t private_fl_fss_basic_read(const f_string_static_t buffer, const bool object_as, f_string_range_t *range, f_fss_object_t *found, f_fss_quote_t *quoted, f_fss_delimits_t *delimits) f_attribute_visibility_internal;
+ extern f_status_t private_fl_fss_basic_read(const f_string_static_t buffer, const bool object_as, f_state_t state, f_string_range_t *range, f_fss_object_t *found, f_fss_quote_t *quoted, f_fss_delimits_t *delimits) f_attribute_visibility_internal;
#endif // !defined(_di_fl_fss_basic_object_read_) || !defined(_di_fl_fss_extended_object_read_) || !defined(_di_fl_fss_extended_content_read_)
/**
* @param quoted
* If 0, then double quotes are auto-inserted, if needed.
* Otherwise, this is the type of quote to wrap the object in when writing.
+ * @param state
+ * A state for handling interrupts during long running operations.
+ * There is no print_error() usage at this time (@todo this should be implemented and supported).
+ * There is no functions structure.
+ * There is no data structure passed to these functions.
+ *
+ * When interrupt() returns, only F_interrupt and F_interrupt_not are processed.
+ * Error bit designates an error but must be passed along with F_interrupt.
+ * All other statuses are ignored.
* @param range
* The start/stop location within the object string to write as an object.
* @param destination
* F_data_not_eos no data to write due start location being greater than or equal to buffer size.
*
* F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete.
+ * F_interrupt (with error bit) if stopping due to an interrupt.
* F_memory_not (with error bit) on out of memory.
* F_none_eol (with error bit) after reaching an EOL, which is not supported by the standard.
* F_parameter (with error bit) if a parameter is invalid.
* @see fl_fss_extended_content_write_string()
*/
#if !defined(fl_fss_basic_object_write_string) || !defined(fl_fss_extended_object_write_string) || !defined(_di_fl_fss_extended_content_write_string_)
- extern f_status_t private_fl_fss_basic_write(const bool object_as, const f_string_static_t object, const f_fss_quote_t quoted, f_string_range_t *range, f_string_dynamic_t *destination) f_attribute_visibility_internal;
+ extern f_status_t private_fl_fss_basic_write(const bool object_as, const f_string_static_t object, const f_fss_quote_t quoted, f_state_t state, f_string_range_t *range, f_string_dynamic_t *destination) f_attribute_visibility_internal;
#endif // !defined(fl_fss_basic_object_write_string) || !defined(fl_fss_extended_object_write_string) || !defined(_di_fl_fss_extended_content_write_string_)
#ifdef __cplusplus
#endif
#ifndef _di_fl_iki_read_
- f_status_t fl_iki_read(f_string_static_t *buffer, f_string_range_t *range, f_iki_variable_t *variable, f_iki_vocabulary_t *vocabulary, f_iki_content_t *content) {
+ f_status_t fl_iki_read(f_state_t state, f_string_static_t *buffer, f_string_range_t *range, f_iki_variable_t *variable, f_iki_vocabulary_t *vocabulary, f_iki_content_t *content) {
#ifndef _di_level_1_parameter_checking_
if (!buffer) return F_status_set_error(F_parameter);
if (!range) return F_status_set_error(F_parameter);
f_status_t status = F_none;
do {
- status = f_iki_read(buffer, range, variable, vocabulary, content);
+ status = f_iki_read(state, buffer, range, variable, vocabulary, content);
if (F_status_is_error(status)) return status;
if (status == F_data_not_eos || status == F_data_not_stop) {
* This does not verify if any vocabulary name is known.
* This only finds complete vocabulary names and their respective content.
*
+ * @param state
+ * A state for handling interrupts during long running operations.
+ * There is no print_error() usage at this time (@todo this should be implemented and supported).
+ * There is no functions structure.
+ * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure).
+ *
+ * When interrupt() returns, only F_interrupt and F_interrupt_not are processed.
+ * Error bit designates an error but must be passed along with F_interrupt.
+ * All other statuses are ignored.
* @param buffer
* The string to process.
* @param range
* F_data_not_eos on success and EOS was reached, but there were no IKI vocabularie names found.
* F_data_not_stop on success and stop point was reached, but there were no IKI vocabularie names found.
*
+ * F_interrupt (with error bit) if stopping due to an interrupt.
* F_memory_not (with error bit) on out of memory.
* F_parameter (with error bit) if a parameter is invalid.
* F_string_too_large (with error bit) if a string length is too large to store in the buffer.
* Errors (with error bit) from: f_iki_read().
*/
#ifndef _di_fl_iki_read_
- extern f_status_t fl_iki_read(f_string_static_t *buffer, f_string_range_t *range, f_iki_variable_t *variable, f_iki_vocabulary_t *vocabulary, f_iki_content_t *content);
+ extern f_status_t fl_iki_read(f_state_t state, f_string_static_t *buffer, f_string_range_t *range, f_iki_variable_t *variable, f_iki_vocabulary_t *vocabulary, f_iki_content_t *content);
#endif // _di_fl_iki_read_
#ifdef __cplusplus
--- /dev/null
+/**
+ * FLL - Level 1
+ *
+ * Project: Signal
+ * API Version: 0.5
+ * Licenses: lgplv2.1
+ *
+ * Defines common data to be used for/by project execute.
+ *
+ * This is auto-included by execute.h and should not need to be explicitly included.
+ */
+#ifndef _FL_signal_common_h
+#define _FL_signal_common_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * A structure intended to be used as the "data" structure for f_state_t for interrupt related functionality.
+ *
+ * interrupts: An array of signal codes to treat as interrupts.
+ * signal: The signal structure to use.
+ * trigger: The signal that triggered the interrupt, if applicable.
+ */
+#ifndef _di_fl_signal_interrupt_t_
+ typedef struct {
+ f_int32s_t interrupts;
+ f_signal_t signal;
+ int32_t trigger;
+ } fl_signal_interrupt_t;
+
+ #define fl_signal_interrupt_t_initialize { f_int32s_t_initialize, f_signal_t_initialize, 0 }
+
+ #define macro_fl_signal_interrupt_t_initialize(interrupts, signal) { interrupts, signal, 0 }
+
+ #define macro_fl_signal_interrupt_t_clear(structure) \
+ macro_f_int32s_t_clear(structure.interrupts) \
+ macro_f_signal_t_clear(structure.signal) \
+ structure.trigger = 0;
+#endif // _di_fl_signal_interrupt_t_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _FL_signal_common_h
--- /dev/null
+#include "signal.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_fl_signal_state_interrupt_
+ f_status_t fl_signal_state_interrupt(void *state, void *internal) {
+ #ifndef _di_level_1_parameter_checking_
+ if (!state) return F_status_set_error(F_parameter);
+ #endif // _di_level_1_parameter_checking_
+
+ f_state_t *state_ptr = (f_state_t *) state;
+
+ if (!state_ptr->custom) {
+ return F_status_set_error(F_parameter);
+ }
+
+ fl_signal_interrupt_t *signal_interrupt = (fl_signal_interrupt_t *) state_ptr->custom;
+
+ if (!signal_interrupt || !signal_interrupt->signal.id) {
+ return F_enable_not;
+ }
+
+ if (!signal_interrupt->interrupts.used) {
+ return F_interrupt_not;
+ }
+
+ struct signalfd_siginfo information;
+
+ memset(&information, 0, sizeof(struct signalfd_siginfo));
+
+ const f_status_t status = f_signal_read(signal_interrupt->signal, &information);
+
+ if (status == F_signal) {
+ for (f_array_length_t i = 0; i < signal_interrupt->interrupts.used; ++i) {
+
+ if (information.ssi_signo == signal_interrupt->interrupts.array[i]) {
+ signal_interrupt->trigger = information.ssi_signo;
+
+ return F_status_set_error(F_interrupt);
+ }
+ } // for
+ }
+
+ return F_interrupt_not;
+ }
+#endif // _di_fl_signal_state_interrupt_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 1
+ *
+ * Project: Signal
+ * API Version: 0.5
+ * Licenses: lgplv2.1
+ *
+ * Provides common signal functions.
+ */
+#ifndef _FL_signal_h
+#define _FL_signal_h
+
+// libc includes
+#include <signal.h>
+#include <string.h>
+#include <sys/signalfd.h>
+
+// fll-0 includes
+#include <fll/level_0/type.h>
+#include <fll/level_0/status.h>
+#include <fll/level_0/signal.h>
+
+// fll-1 signal includes
+#include <fll/level_1/signal-common.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Check to see if a given signal is received.
+ *
+ * Provides a simple interrupt checker for general use.
+ *
+ * This is intended to be explicitly use for the interrupt() callback defined in f_state_t.
+ *
+ * This check all interrupts provided in state->data.interrupts and if a signal is found, store that signal in state->data.trigger and returns F_interrupt (with error bit set).
+ * If state->data.signal.id is NULL, then F_enable_not is returned.
+ *
+ * @param state
+ * The state such that:
+ * - state->handle: Ignored.
+ * - state->interrupt: A pointer to this function.
+ * - state->callbacks: Ignored.
+ * - state->custom: The interrupt data, of the type fl_signal_interrupt_t (Must not be NULL).
+ * - state->data: Ignored.
+ * @param internal
+ * This is ignored.
+ *
+ * @return
+ * F_none on success.
+ * F_enable_not on success but signals are not requested to be processed.
+ * F_interrupt_not on success and no requested signal was found.
+ *
+ * F_interrupt (with error bit) if a requested signal is confirmed to be found.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * @see f_signal_read()
+ */
+#ifndef _di_fl_signal_state_interrupt_
+ extern f_status_t fl_signal_state_interrupt(void *state, void *internal);
+#endif // _di_fl_signal_state_interrupt_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _FL_signal_h
--- /dev/null
+# fss-0000
+
--- /dev/null
+# fss-0000
+
+f_type
+f_status
+f_signal
--- /dev/null
+# fss-0001
+
+project_name fl_iki
+
+version_major 0
+version_minor 5
+version_micro 4
+version_target major
+
+environment
+
+process_pre
+process_post
+
+modes individual
+modes_default individual
+
+build_compiler gcc
+build_indexer ar
+build_language c
+build_libraries -lc
+build_libraries-individual -lf_signal
+build_sources_library signal.c
+build_sources_program
+build_sources_headers signal.h signal-common.h
+build_sources_script
+build_sources_setting
+build_script yes
+build_shared yes
+build_static no
+
+path_headers fll/level_1
+path_headers_preserve no
+path_library_script script
+path_library_shared shared
+path_library_static static
+path_program_script script
+path_program_shared shared
+path_program_static static
+path_sources
+path_standard yes
+
+search_exclusive yes
+search_shared yes
+search_static yes
+
+defines_all
+defines_static
+defines_shared
+
+flags_all -z now -g -fdiagnostics-color=always -Wno-logical-not-parentheses -Wno-logical-op-parentheses -Wno-parentheses
+flags_shared
+flags_static
+flags_library -fPIC
+flags_program -fPIE
case F_device_not:
*string = FL_status_string_device_not;
break;
+ case F_disable:
+ *string = FL_status_string_disable;
+ break;
+ case F_disable_not:
+ *string = FL_status_string_disable_not;
+ break;
case F_done:
*string = FL_status_string_done;
break;
case F_empty_not:
*string = FL_status_string_empty_not;
break;
+ case F_enable:
+ *string = FL_status_string_enable;
+ break;
+ case F_enable_not:
+ *string = FL_status_string_enable_not;
+ break;
case F_encoding:
*string = FL_status_string_encoding;
break;
#define FL_status_string_descriptor_not "F_descriptor_not"
#define FL_status_string_device "F_device"
#define FL_status_string_device_not "F_device_not"
+ #define FL_status_string_disable "F_disable"
+ #define FL_status_string_disable_not "F_disable_not"
#define FL_status_string_done "F_done"
#define FL_status_string_done_not "F_done_not"
#define FL_status_string_dummy "F_dummy"
#define FL_status_string_dummy_not "F_dummy_not"
#define FL_status_string_empty "F_empty"
#define FL_status_string_empty_not "F_empty_not"
+ #define FL_status_string_enable "F_enable"
+ #define FL_status_string_enable_not "F_enable_not"
#define FL_status_string_encoding "F_encoding"
#define FL_status_string_encoding_not "F_encoding_not"
#define FL_status_string_eoa "F_eoa"
#define FL_status_string_descriptor_not_length 16
#define FL_status_string_device_length 8
#define FL_status_string_device_not_length 12
+ #define FL_status_string_disable_length 9
+ #define FL_status_string_disable_not_length 13
#define FL_status_string_done_length 6
#define FL_status_string_done_not_length 10
#define FL_status_string_dummy_length 7
#define FL_status_string_dummy_not_length 11
#define FL_status_string_empty_length 7
#define FL_status_string_empty_not_length 11
+ #define FL_status_string_enable_length 8
+ #define FL_status_string_enable_not_length 12
#define FL_status_string_encoding_length 10
#define FL_status_string_encoding_not_length 14
#define FL_status_string_eoa_length 5
#if !defined(_di_fll_execute_arguments_add_) || !defined(_di_fll_execute_arguments_add_set_) || !defined(_di_fll_execute_arguments_dynamic_add_) || !defined(_di_fll_execute_arguments_dynamic_add_set_)
f_status_t private_fll_execute_arguments_add(const f_string_t source, const f_array_length_t length, f_string_dynamics_t *arguments) {
- f_status_t status = f_string_dynamics_increase(arguments);
+ f_status_t status = f_string_dynamics_increase(f_memory_default_allocation_small, arguments);
if (F_status_is_error(status)) return status;
f_string_dynamic_t argument = f_string_dynamic_t_initialize;
#if !defined(_di_fll_execute_arguments_add_parameter_) || !defined(_di_fll_execute_arguments_add_parameter_set_) || !defined(_di_fll_execute_arguments_dynamic_add_parameter_) || !defined(_di_fll_execute_arguments_dynamic_add_parameter_set_)
f_status_t private_fll_execute_arguments_add_parameter(const f_string_t prefix, const f_array_length_t prefix_length, const f_string_t name, const f_array_length_t name_length, const f_string_t value, const f_array_length_t value_length, f_string_dynamics_t *arguments) {
- f_status_t status = f_string_dynamics_increase(arguments);
+ f_status_t status = f_string_dynamics_increase(f_memory_default_allocation_small, arguments);
if (F_status_is_error(status)) return status;
f_string_dynamic_t argument = f_string_dynamic_t_initialize;
return status;
}
- status = f_string_dynamics_increase(arguments);
+ status = f_string_dynamics_increase(f_memory_default_allocation_small, arguments);
if (F_status_is_error(status)) {
f_string_dynamic_resize(0, &argument);
if (F_status_is_error(status)) return status;
if (status == F_equal_to_not) continue;
- status = f_string_map_multis_increase(values[j]);
+ status = f_string_map_multis_increase(f_memory_default_allocation_small, values[j]);
if (F_status_is_error(status)) return status;
if (indexs) {
- macro_f_array_lengths_t_increase(status, (*indexs[j]));
+ macro_f_array_lengths_t_increase(status, f_memory_default_allocation_small, (*indexs[j]));
if (F_status_is_error(status)) return status;
}
if (F_status_is_error(status)) return status;
if (status == F_equal_to_not) continue;
- status = f_string_maps_increase(values[j]);
+ status = f_string_maps_increase(f_memory_default_allocation_small, values[j]);
if (F_status_is_error(status)) return status;
if (indexs) {
- macro_f_array_lengths_t_increase(status, (*indexs[j]));
+ macro_f_array_lengths_t_increase(status, f_memory_default_allocation_small, (*indexs[j]));
if (F_status_is_error(status)) return status;
}
map_multi = &values[j]->array[k];
}
else {
- status = f_string_map_multis_increase(values[j]);
+ status = f_string_map_multis_increase(f_memory_default_allocation_small, values[j]);
if (F_status_is_error(status)) return status;
if (indexs) {
- macro_f_array_lengths_t_increase(status, (*indexs[j]));
+ macro_f_array_lengths_t_increase(status, f_memory_default_allocation_small, (*indexs[j]));
if (F_status_is_error(status)) return status;
}
if (contents.array[i].used == 1) continue;
}
- status = f_string_dynamics_increase(&map_multi->value);
+ status = f_string_dynamics_increase(f_memory_default_allocation_small, &map_multi->value);
if (F_status_is_error(status)) return status;
for (k = 1; k < contents.array[i].used; k++) {
map = &values[j]->array[k];
}
else {
- status = f_string_maps_increase(values[j]);
+ status = f_string_maps_increase(f_memory_default_allocation_small, values[j]);
if (F_status_is_error(status)) return status;
if (indexs) {
- macro_f_array_lengths_t_increase(status, (*indexs[j]));
+ macro_f_array_lengths_t_increase(status, f_memory_default_allocation_small, (*indexs[j]));
if (F_status_is_error(status)) return status;
}
if (F_status_is_error(status)) return status;
if (status == F_equal_to_not) continue;
- status = f_string_dynamics_increase(values[j]);
+ status = f_string_dynamics_increase(f_memory_default_allocation_small, values[j]);
if (F_status_is_error(status)) return status;
if (indexs) {
- macro_f_array_lengths_t_increase(status, (*indexs[j]));
+ macro_f_array_lengths_t_increase(status, f_memory_default_allocation_small, (*indexs[j]));
if (F_status_is_error(status)) return status;
}
#endif
#ifndef _di_fll_fss_basic_read_
- f_status_t fll_fss_basic_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_objects_t *objects, f_fss_contents_t *contents, f_fss_quotes_t *objects_quoted, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits) {
+ f_status_t fll_fss_basic_read(const f_string_static_t buffer, f_state_t state, f_string_range_t *range, f_fss_objects_t *objects, f_fss_contents_t *contents, f_fss_quotes_t *objects_quoted, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits) {
#ifndef _di_level_2_parameter_checking_
if (!range) return F_status_set_error(F_parameter);
if (!objects) return F_status_set_error(F_parameter);
do {
if (objects->used == objects->size) {
- macro_f_fss_objects_t_increase(status2, (*objects))
+ macro_f_fss_objects_t_increase(status2, f_memory_default_allocation_small, (*objects))
if (F_status_is_error(status2)) return status2;
- macro_f_fss_contents_t_increase(status2, (*contents))
+ macro_f_fss_contents_t_increase(status2, f_memory_default_allocation_small, (*contents))
if (F_status_is_error(status2)) return status2;
if (objects_quoted) {
- macro_f_fss_quotes_t_increase(status2, (*objects_quoted))
+ macro_f_fss_quotes_t_increase(status2, f_memory_default_allocation_small, (*objects_quoted))
if (F_status_is_error(status2)) return status2;
}
}
quoted_object = &objects_quoted->array[objects_quoted->used];
}
- status = fl_fss_basic_object_read(buffer, range, &objects->array[objects->used], quoted_object, objects_delimits);
+ status = fl_fss_basic_object_read(buffer, state, range, &objects->array[objects->used], quoted_object, objects_delimits);
if (F_status_is_error(status)) return status;
if (range->start >= range->stop || range->start >= buffer.used) {
objects_quoted->used++;
}
- macro_f_fss_content_t_increase(status2, contents->array[contents->used])
+ macro_f_fss_content_t_increase(status2, f_memory_default_allocation_small, contents->array[contents->used])
if (F_status_is_error(status2)) return status2;
contents->used++;
if (status == FL_fss_found_object) {
found_data = F_true;
- status = fl_fss_basic_content_read(buffer, range, &contents->array[contents->used], contents_delimits ? contents_delimits : objects_delimits);
+ status = fl_fss_basic_content_read(buffer, state, range, &contents->array[contents->used], contents_delimits ? contents_delimits : objects_delimits);
if (F_status_is_error(status)) return status;
break;
else if (status == FL_fss_found_object_content_not) {
found_data = F_true;
- macro_f_fss_content_t_increase(status2, contents->array[contents->used])
+ macro_f_fss_content_t_increase(status2, f_memory_default_allocation_small, contents->array[contents->used])
if (F_status_is_error(status2)) return status2;
break;
#endif // _di_fll_fss_basic_read_
#ifndef _di_fll_fss_basic_write_string_
- f_status_t fll_fss_basic_write_string(const f_string_static_t object, const f_string_static_t content, const f_fss_quote_t quote, f_string_dynamic_t *destination) {
+ f_status_t fll_fss_basic_write_string(const f_string_static_t object, const f_string_static_t content, const f_fss_quote_t quote, f_state_t state, f_string_dynamic_t *destination) {
#ifndef _di_level_2_parameter_checking_
if (!destination) return F_status_set_error(F_parameter);
#endif // _di_level_2_parameter_checking_
f_status_t status = 0;
f_string_range_t range = macro_f_string_range_t_initialize(object.used);
- status = fl_fss_basic_object_write_string(object, quote, f_fss_complete_full, &range, destination);
+ status = fl_fss_basic_object_write_string(object, quote, f_fss_complete_full, state, &range, destination);
if (F_status_is_error(status) || status == F_data_not_stop || status == F_data_not_eos) {
return status;
range.start = 0;
range.stop = content.used - 1;
- status = fl_fss_basic_content_write_string(content, f_fss_complete_full, &range, destination);
+ status = fl_fss_basic_content_write_string(content, f_fss_complete_full, state, &range, destination);
if (F_status_is_error(status)) return status;
}
else {
- status = f_string_dynamic_increase(destination);
+ status = f_string_dynamic_increase(f_memory_default_allocation_small, destination);
if (F_status_is_error(status)) return status;
destination->string[destination->used++] = f_string_eol_s[0];
*
* @param buffer
* The buffer to read from.
+ * @param state
+ * A state for handling interrupts during long running operations.
+ * There is no print_error() usage at this time (@todo this should be implemented and supported).
+ * There is no functions structure.
+ * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure).
+ *
+ * When interrupt() returns, only F_interrupt and F_interrupt_not are processed.
+ * Error bit designates an error but must be passed along with F_interrupt.
+ * All other statuses are ignored.
* @param range
* The range within the buffer that is currently being read.
* @param objects
* F_data_not_stop no data to write due start location being greater than stop location.
*
* F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete.
+ * F_interrupt (with error bit) if stopping due to an interrupt.
* F_memory_not (with error bit) on out of memory.
* F_number_overflow (with error bit) if the maximimum buffer size is reached.
* F_parameter (with error bit) if a parameter is invalid.
* Errors (with error bit) from: fl_fss_basic_object_read().
*/
#ifndef _di_fll_fss_basic_read_
- extern f_status_t fll_fss_basic_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_objects_t *objects, f_fss_contents_t *contents, f_fss_quotes_t *objects_quoted, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits);
+ extern f_status_t fll_fss_basic_read(const f_string_static_t buffer, f_state_t state, f_string_range_t *range, f_fss_objects_t *objects, f_fss_contents_t *contents, f_fss_quotes_t *objects_quoted, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits);
#endif // _di_fll_fss_basic_read_
/**
* @param quote
* If 0, then double quotes are auto-inserted, when required.
* Otherwise, this is the type of quote to wrap the object in when writing.
+ * @param state
+ * A state for handling interrupts during long running operations.
+ * There is no print_error() usage at this time (@todo this should be implemented and supported).
+ * There is no functions structure.
+ * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure).
+ *
+ * When interrupt() returns, only F_interrupt and F_interrupt_not are processed.
+ * Error bit designates an error but must be passed along with F_interrupt.
+ * All other statuses are ignored.
* @param destination
* The buffer where the content is written to.
*
* F_data_not_stop no data to write due start location being greater than stop location.
*
* F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete.
+ * F_interrupt (with error bit) if stopping due to an interrupt.
* F_memory_not (with error bit) on out of memory.
* F_parameter (with error bit) if a parameter is invalid.
* F_utf (with error bit) is returned on failure to read/process a UTF-8 character.
* Errors (with error bit) from: f_string_dynamic_increase_by().
*/
#ifndef _di_fll_fss_basic_write_string_
- extern f_status_t fll_fss_basic_write_string(const f_string_static_t object, const f_string_static_t content, const f_fss_quote_t quote, f_string_dynamic_t *destination);
+ extern f_status_t fll_fss_basic_write_string(const f_string_static_t object, const f_string_static_t content, const f_fss_quote_t quote, f_state_t state, f_string_dynamic_t *destination);
#endif // _di_fll_fss_basic_write_string_
#ifdef __cplusplus
#endif
#ifndef _di_fll_fss_basic_list_read_
- f_status_t fll_fss_basic_list_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_objects_t *objects, f_fss_contents_t *contents, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits, f_fss_comments_t *comments) {
+ f_status_t fll_fss_basic_list_read(const f_string_static_t buffer, f_state_t state, f_string_range_t *range, f_fss_objects_t *objects, f_fss_contents_t *contents, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits, f_fss_comments_t *comments) {
#ifndef _di_level_2_parameter_checking_
if (!range) return F_status_set_error(F_parameter);
if (!objects) return F_status_set_error(F_parameter);
}
do {
- status = fl_fss_basic_list_object_read(buffer, range, &objects->array[objects->used], objects_delimits);
+ status = fl_fss_basic_list_object_read(buffer, state, range, &objects->array[objects->used], objects_delimits);
if (F_status_is_error(status)) return status;
if (range->start >= range->stop || range->start >= buffer.used) {
if (status == FL_fss_found_object || status == FL_fss_found_object_content_not) {
objects->used++;
- macro_f_fss_delimits_t_increase(status2, contents->array[contents->used])
+ macro_f_fss_delimits_t_increase(status2, f_memory_default_allocation_small, contents->array[contents->used])
if (F_status_is_error(status2)) return status2;
contents->used++;
if (status == FL_fss_found_object) {
found_data = F_true;
- status = fl_fss_basic_list_content_read(buffer, range, &contents->array[contents->used], contents_delimits ? contents_delimits : objects_delimits, comments);
+ status = fl_fss_basic_list_content_read(buffer, state, range, &contents->array[contents->used], contents_delimits ? contents_delimits : objects_delimits, comments);
if (F_status_is_error(status)) return status;
break;
else if (status == FL_fss_found_object_content_not) {
found_data = F_true;
- macro_f_fss_content_t_increase(status2, contents->array[contents->used])
+ macro_f_fss_content_t_increase(status2, f_memory_default_allocation_small, contents->array[contents->used])
if (F_status_is_error(status2)) return status2;
break;
#endif // _di_fll_fss_basic_list_read_
#ifndef _di_fll_fss_basic_list_write_string_
- f_status_t fll_fss_basic_list_write_string(const f_string_static_t object, const f_string_static_t content, const f_string_static_t *content_prepend, f_string_dynamic_t *destination) {
+ f_status_t fll_fss_basic_list_write_string(const f_string_static_t object, const f_string_static_t content, const f_string_static_t *content_prepend, f_state_t state, f_string_dynamic_t *destination) {
#ifndef _di_level_2_parameter_checking_
if (!destination) return F_status_set_error(F_parameter);
#endif // _di_level_2_parameter_checking_
f_status_t status = 0;
f_string_range_t range = macro_f_string_range_t_initialize(object.used);
- status = fl_fss_basic_list_object_write_string(object, f_fss_complete_full, &range, destination);
+ status = fl_fss_basic_list_object_write_string(object, f_fss_complete_full, state, &range, destination);
if (F_status_is_error(status) || status == F_data_not_stop || status == F_data_not_eos) {
return status;
range.stop = 0;
}
- status = fl_fss_basic_list_content_write_string(content, f_fss_complete_full, content_prepend, &range, destination);
+ status = fl_fss_basic_list_content_write_string(content, f_fss_complete_full, content_prepend, state, &range, destination);
}
return status;
*
* @param buffer
* The buffer to read from.
+ * @param state
+ * A state for handling interrupts during long running operations.
+ * There is no print_error() usage at this time (@todo this should be implemented and supported).
+ * There is no functions structure.
+ * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure).
+ *
+ * When interrupt() returns, only F_interrupt and F_interrupt_not are processed.
+ * Error bit designates an error but must be passed along with F_interrupt.
+ * All other statuses are ignored.
* @param range
* The range within the buffer that is currently being read.
* @param objects
* F_data_not_stop no data to write due start location being greater than stop location.
*
* F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete.
+ * F_interrupt (with error bit) if stopping due to an interrupt.
* F_memory_not (with error bit) on out of memory.
* F_number_overflow (with error bit) if the maximimum buffer size is reached.
* F_parameter (with error bit) if a parameter is invalid.
* Errors (with error bit) from: fl_fss_basic_list_object_read().
*/
#ifndef _di_fll_fss_basic_list_read_
- extern f_status_t fll_fss_basic_list_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_objects_t *objects, f_fss_contents_t *contents, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits, f_fss_comments_t *comments);
+ extern f_status_t fll_fss_basic_list_read(const f_string_static_t buffer, f_state_t state, f_string_range_t *range, f_fss_objects_t *objects, f_fss_contents_t *contents, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits, f_fss_comments_t *comments);
#endif // _di_fll_fss_basic_list_read_
/**
* @param content_prepend
* A string to prepend at the start of each line in content, such as spaces.
* Set the pointer address to 0 to disable.
+ * @param state
+ * A state for handling interrupts during long running operations.
+ * There is no print_error() usage at this time (@todo this should be implemented and supported).
+ * There is no functions structure.
+ * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure).
+ *
+ * When interrupt() returns, only F_interrupt and F_interrupt_not are processed.
+ * Error bit designates an error but must be passed along with F_interrupt.
+ * All other statuses are ignored.
* @param destination
* The buffer to write to.
*
* F_data_not_stop no data to write due start location being greater than stop location.
*
* F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete.
+ * F_interrupt (with error bit) if stopping due to an interrupt.
* F_memory_not (with error bit) on out of memory.
* F_parameter (with error bit) if a parameter is invalid.
* F_utf (with error bit) is returned on failure to read/process a UTF-8 character.
* Errors (with error bit) from: f_string_dynamic_increase_by().
*/
#ifndef _di_fll_fss_basic_list_write_string_
- extern f_status_t fll_fss_basic_list_write_string(const f_string_static_t object, const f_string_static_t content, const f_string_static_t *content_prepend, f_string_dynamic_t *destination);
+ extern f_status_t fll_fss_basic_list_write_string(const f_string_static_t object, const f_string_static_t content, const f_string_static_t *content_prepend, f_state_t state, f_string_dynamic_t *destination);
#endif // _di_fll_fss_basic_list_write_string_
#ifdef __cplusplus
#endif
#ifndef _di_fll_fss_embedded_list_read_
- f_status_t fll_fss_embedded_list_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_nest_t *nest, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits, f_fss_comments_t *comments) {
+ f_status_t fll_fss_embedded_list_read(const f_string_static_t buffer, f_state_t state, f_string_range_t *range, f_fss_nest_t *nest, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits, f_fss_comments_t *comments) {
#ifndef _di_level_2_parameter_checking_
if (!range) return F_status_set_error(F_parameter);
if (!nest) return F_status_set_error(F_parameter);
if (F_status_is_error(status)) return status;
}
- status = fl_fss_embedded_list_object_read(buffer, range, &nest->depth[0].array[nest->depth[0].used].object, objects_delimits);
+ status = fl_fss_embedded_list_object_read(buffer, state, range, &nest->depth[0].array[nest->depth[0].used].object, objects_delimits);
if (F_status_is_error(status)) return status;
if (range->start >= range->stop || range->start >= buffer.used) {
if (status == FL_fss_found_object) {
found_data = F_true;
- status = fl_fss_embedded_list_content_read(buffer, range, nest, contents_delimits ? contents_delimits : objects_delimits, comments);
+ status = fl_fss_embedded_list_content_read(buffer, state, range, nest, contents_delimits ? contents_delimits : objects_delimits, comments);
break;
}
else if (status == FL_fss_found_object_content_not) {
#endif // _di_fll_fss_embedded_list_read_
#ifndef _di_fll_fss_embedded_list_write_string_
- f_status_t fll_fss_embedded_list_write_string(const f_string_static_t object, const f_string_static_t content, const f_string_static_t *content_prepend, const f_string_ranges_t *ignore, f_string_dynamic_t *destination) {
+ f_status_t fll_fss_embedded_list_write_string(const f_string_static_t object, const f_string_static_t content, const f_string_static_t *content_prepend, const f_string_ranges_t *ignore, f_state_t state, f_string_dynamic_t *destination) {
#ifndef _di_level_2_parameter_checking_
if (!destination) return F_status_set_error(F_parameter);
#endif // _di_level_2_parameter_checking_
f_status_t status = 0;
f_string_range_t range = macro_f_string_range_t_initialize(object.used);
- status = fl_fss_embedded_list_object_write_string(object, f_fss_complete_full, &range, destination);
+ status = fl_fss_embedded_list_object_write_string(object, f_fss_complete_full, state, &range, destination);
if (F_status_is_error(status) || status == F_data_not_stop || status == F_data_not_eos) {
return status;
range.stop = 0;
}
- status = fl_fss_embedded_list_content_write_string(content, f_fss_complete_full, content_prepend, ignore, &range, destination);
+ status = fl_fss_embedded_list_content_write_string(content, f_fss_complete_full, content_prepend, ignore, state, &range, destination);
}
return status;
*
* @param buffer
* The buffer to read from.
+ * @param state
+ * A state for handling interrupts during long running operations.
+ * There is no print_error() usage at this time (@todo this should be implemented and supported).
+ * There is no functions structure.
+ * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure).
+ *
+ * When interrupt() returns, only F_interrupt and F_interrupt_not are processed.
+ * Error bit designates an error but must be passed along with F_interrupt.
+ * All other statuses are ignored.
* @param range
* The range within the buffer that is currently being read.
* @param nest
* F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete.
* F_complete_not_utf_eos (with error bit) if the end of buffer is reached before the complete UTF-8 character can be processed.
* F_complete_not_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed.
+ * F_interrupt (with error bit) if stopping due to an interrupt.
* F_memory_not (with error bit) on out of memory.
* F_number_overflow (with error bit) if the maximimum buffer size is reached.
* F_parameter (with error bit) if a parameter is invalid.
* Errors (with error bit) from: fl_fss_embedded_list_object_read().
*/
#ifndef _di_fll_fss_embedded_list_read_
- extern f_status_t fll_fss_embedded_list_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_nest_t *nest, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits, f_fss_comments_t *comments);
+ extern f_status_t fll_fss_embedded_list_read(const f_string_static_t buffer, f_state_t state, f_string_range_t *range, f_fss_nest_t *nest, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits, f_fss_comments_t *comments);
#endif // _di_fll_fss_embedded_list_read_
/**
* These ranges are only checked/ignored if there is a valid nested object open or a valid nested object close.
* Any valid nested object open or valid nested object close inside an ingore range will not be escaped.
* Set the pointer address to 0 to disable.
+ * @param state
+ * A state for handling interrupts during long running operations.
+ * There is no print_error() usage at this time (@todo this should be implemented and supported).
+ * There is no functions structure.
+ * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure).
+ *
+ * When interrupt() returns, only F_interrupt and F_interrupt_not are processed.
+ * Error bit designates an error but must be passed along with F_interrupt.
+ * All other statuses are ignored.
* @param destination
* The buffer where the content is written to.
*
* F_data_not_stop no data to write due start location being greater than stop location.
*
* F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete.
+ * F_interrupt (with error bit) if stopping due to an interrupt.
* F_memory_not (with error bit) on out of memory.
* F_parameter (with error bit) if a parameter is invalid.
* F_utf (with error bit) is returned on failure to read/process a UTF-8 character.
* Errors (with error bit) from: f_string_dynamic_increase_by().
*/
#ifndef _di_fll_fss_embedded_list_write_string_
- extern f_status_t fll_fss_embedded_list_write_string(const f_string_static_t object, const f_string_static_t content, const f_string_static_t *content_prepend, const f_string_ranges_t *ignore, f_string_dynamic_t *destination);
+ extern f_status_t fll_fss_embedded_list_write_string(const f_string_static_t object, const f_string_static_t content, const f_string_static_t *content_prepend, const f_string_ranges_t *ignore, f_state_t state, f_string_dynamic_t *destination);
#endif // _di_fll_fss_embedded_list_write_string_
#ifdef __cplusplus
#endif
#ifndef _di_fll_fss_extended_read_
- f_status_t fll_fss_extended_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_objects_t *objects, f_fss_contents_t *contents, f_fss_quotes_t *objects_quoted, f_fss_quotess_t *contents_quoted, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits) {
+ f_status_t fll_fss_extended_read(const f_string_static_t buffer, f_state_t state, f_string_range_t *range, f_fss_objects_t *objects, f_fss_contents_t *contents, f_fss_quotes_t *objects_quoted, f_fss_quotess_t *contents_quoted, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits) {
#ifndef _di_level_2_parameter_checking_
if (!range) return F_status_set_error(F_parameter);
if (!objects) return F_status_set_error(F_parameter);
do {
if (objects->used == objects->size) {
- macro_f_fss_objects_t_increase(status2, (*objects));
+ macro_f_fss_objects_t_increase(status2, f_memory_default_allocation_small, (*objects));
if (F_status_is_error(status2)) return status2;
- macro_f_fss_contents_t_increase(status2, (*contents));
+ macro_f_fss_contents_t_increase(status2, f_memory_default_allocation_small, (*contents));
if (F_status_is_error(status2)) return status2;
if (objects_quoted) {
- macro_f_fss_quotes_t_increase(status2, (*objects_quoted));
+ macro_f_fss_quotes_t_increase(status2, f_memory_default_allocation_small, (*objects_quoted));
if (F_status_is_error(status2)) return status2;
}
if (contents_quoted) {
- macro_f_fss_quotess_t_increase(status2, (*contents_quoted));
+ macro_f_fss_quotess_t_increase(status2, f_memory_default_allocation_small, (*contents_quoted));
if (F_status_is_error(status2)) return status2;
}
}
quoted_object = &objects_quoted->array[objects_quoted->used];
}
- status = fl_fss_extended_object_read(buffer, range, &objects->array[objects->used], quoted_object, objects_delimits);
+ status = fl_fss_extended_object_read(buffer, state, range, &objects->array[objects->used], quoted_object, objects_delimits);
if (F_status_is_error(status)) return status;
if (range->start >= range->stop || range->start >= buffer.used) {
objects_quoted->used++;
}
- macro_f_fss_content_t_increase(status2, contents->array[contents->used])
+ macro_f_fss_content_t_increase(status2, f_memory_default_allocation_small, contents->array[contents->used])
if (F_status_is_error(status2)) return status2;
contents->used++;
if (contents_quoted) {
- macro_f_fss_quotes_t_increase(status2, contents_quoted->array[contents_quoted->used])
+ macro_f_fss_quotes_t_increase(status2, f_memory_default_allocation_small, contents_quoted->array[contents_quoted->used])
if (F_status_is_error(status2)) return status2;
contents_quoted->used++;
found_data = F_true;
if (contents_quoted) {
- macro_f_fss_quotes_t_increase(status2, contents_quoted->array[contents_quoted->used])
+ macro_f_fss_quotes_t_increase(status2, f_memory_default_allocation_small, contents_quoted->array[contents_quoted->used])
if (F_status_is_error(status2)) return status2;
quoted_content = &contents_quoted->array[contents_quoted->used];
}
- status = fl_fss_extended_content_read(buffer, range, &contents->array[contents->used], quoted_content, contents_delimits ? contents_delimits : objects_delimits);
+ status = fl_fss_extended_content_read(buffer, state, range, &contents->array[contents->used], quoted_content, contents_delimits ? contents_delimits : objects_delimits);
if (F_status_is_error(status)) return status;
break;
#endif // _di_fll_fss_extended_read_
#ifndef _di_fll_fss_extended_write_string_
- f_status_t fll_fss_extended_write_string(const f_string_static_t object, const f_string_statics_t contents, const f_fss_quote_t quote, f_string_dynamic_t *destination) {
+ f_status_t fll_fss_extended_write_string(const f_string_static_t object, const f_string_statics_t contents, const f_fss_quote_t quote, f_state_t state, f_string_dynamic_t *destination) {
#ifndef _di_level_2_parameter_checking_
if (!destination) return F_status_set_error(F_parameter);
#endif // _di_level_2_parameter_checking_
f_status_t status = 0;
f_string_range_t range = macro_f_string_range_t_initialize(object.used);
- status = fl_fss_extended_object_write_string(object, quote, f_fss_complete_full, &range, destination);
+ status = fl_fss_extended_object_write_string(object, quote, f_fss_complete_full, state, &range, destination);
if (F_status_is_error(status) || status == F_data_not_stop || status == F_data_not_eos) {
return status;
range.stop = 0;
}
- status = fl_fss_extended_content_write_string(contents.array[i], quote, complete, &range, destination);
+ status = fl_fss_extended_content_write_string(contents.array[i], quote, complete, state, &range, destination);
if (F_status_is_error(status)) return status;
} // for
}
*
* @param buffer
* The buffer to read from.
+ * @param state
+ * A state for handling interrupts during long running operations.
+ * There is no print_error() usage at this time (@todo this should be implemented and supported).
+ * There is no functions structure.
+ * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure).
+ *
+ * When interrupt() returns, only F_interrupt and F_interrupt_not are processed.
+ * Error bit designates an error but must be passed along with F_interrupt.
+ * All other statuses are ignored.
* @param range
* The range within the buffer that is currently being read.
* @param objects
* F_data_not_eol if there is no data to write and EOL was reached (@todo: review related code and detemine what this is doing).
*
* F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete.
- * F_utf (with error bit) is returned on failure to read/process a UTF-8 character.
+ * F_interrupt (with error bit) if stopping due to an interrupt.
* F_memory_not (with error bit) on out of memory.
- * F_parameter (with error bit) if a parameter is invalid.
* F_number_overflow (with error bit) if the maximimum buffer size is reached.
+ * F_parameter (with error bit) if a parameter is invalid.
+ * F_utf (with error bit) is returned on failure to read/process a UTF-8 character.
*
* Errors (with error bit) from: fl_fss_extended_content_read().
* Errors (with error bit) from: fl_fss_extended_object_read().
*/
#ifndef _di_fll_fss_extended_read_
- extern f_status_t fll_fss_extended_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_objects_t *objects, f_fss_contents_t *contents, f_fss_quotes_t *objects_quoted, f_fss_quotess_t *contents_quoted, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits);
+ extern f_status_t fll_fss_extended_read(const f_string_static_t buffer, f_state_t state, f_string_range_t *range, f_fss_objects_t *objects, f_fss_contents_t *contents, f_fss_quotes_t *objects_quoted, f_fss_quotess_t *contents_quoted, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits);
#endif // _di_fll_fss_extended_read_
/**
* @param quote
* If 0, then double quotes are auto-inserted, when required.
* Otherwise, this is the type of quote to wrap the object in when writing.
+ * @param state
+ * A state for handling interrupts during long running operations.
+ * There is no print_error() usage at this time (@todo this should be implemented and supported).
+ * There is no functions structure.
+ * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure).
+ *
+ * When interrupt() returns, only F_interrupt and F_interrupt_not are processed.
+ * Error bit designates an error but must be passed along with F_interrupt.
+ * All other statuses are ignored.
* @param destination
* The buffer where the content is written to.
*
* F_data_not_stop no data to write due start location being greater than stop location.
*
* F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete.
+ * F_interrupt (with error bit) if stopping due to an interrupt.
* F_memory_not (with error bit) on out of memory.
* F_parameter (with error bit) if a parameter is invalid.
* F_utf (with error bit) is returned on failure to read/process a UTF-8 character.
* Errors (with error bit) from: f_string_dynamic_increase_by().
*/
#ifndef _di_fll_fss_extended_write_string_
- extern f_status_t fll_fss_extended_write_string(const f_string_static_t object, const f_string_statics_t contents, const f_fss_quote_t quote, f_string_dynamic_t *destination);
+ extern f_status_t fll_fss_extended_write_string(const f_string_static_t object, const f_string_statics_t contents, const f_fss_quote_t quote, f_state_t state, f_string_dynamic_t *destination);
#endif // _di_fll_fss_extended_write_string_
#ifdef __cplusplus
#endif
#ifndef _di_fll_fss_extended_list_read_
- f_status_t fll_fss_extended_list_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_objects_t *objects, f_fss_contents_t *contents, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits, f_fss_comments_t *comments) {
+ f_status_t fll_fss_extended_list_read(const f_string_static_t buffer, f_state_t state, f_string_range_t *range, f_fss_objects_t *objects, f_fss_contents_t *contents, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits, f_fss_comments_t *comments) {
#ifndef _di_level_2_parameter_checking_
if (!range) return F_status_set_error(F_parameter);
if (!objects) return F_status_set_error(F_parameter);
}
do {
- status = fl_fss_extended_list_object_read(buffer, range, &objects->array[objects->used], objects_delimits);
+ status = fl_fss_extended_list_object_read(buffer, state, range, &objects->array[objects->used], objects_delimits);
if (F_status_is_error(status)) return status;
if (range->start >= range->stop || range->start >= buffer.used) {
if (status == FL_fss_found_object || status == FL_fss_found_object_content_not) {
objects->used++;
- macro_f_fss_content_t_increase(status2, contents->array[contents->used])
+ macro_f_fss_content_t_increase(status2, f_memory_default_allocation_small, contents->array[contents->used])
if (F_status_is_error(status2)) return status2;
contents->used++;
if (status == FL_fss_found_object) {
found_data = F_true;
- status = fl_fss_extended_list_content_read(buffer, range, &contents->array[contents->used], contents_delimits ? contents_delimits : objects_delimits, comments);
+ status = fl_fss_extended_list_content_read(buffer, state, range, &contents->array[contents->used], contents_delimits ? contents_delimits : objects_delimits, comments);
if (F_status_is_error(status)) return status;
break;
else if (status == FL_fss_found_object_content_not) {
found_data = F_true;
- macro_f_fss_content_t_increase(status2, contents->array[contents->used])
+ macro_f_fss_content_t_increase(status2, f_memory_default_allocation_small, contents->array[contents->used])
if (F_status_is_error(status2)) return status2;
break;
#endif // _di_fll_fss_extended_list_read_
#ifndef _di_fll_fss_extended_list_write_string_
- f_status_t fll_fss_extended_list_write_string(const f_string_static_t object, const f_string_static_t content, const f_string_static_t *content_prepend, const f_string_ranges_t *ignore, f_string_dynamic_t *destination) {
+ f_status_t fll_fss_extended_list_write_string(const f_string_static_t object, const f_string_static_t content, const f_string_static_t *content_prepend, const f_string_ranges_t *ignore, f_state_t state, f_string_dynamic_t *destination) {
#ifndef _di_level_2_parameter_checking_
if (!destination) return F_status_set_error(F_parameter);
#endif // _di_level_2_parameter_checking_
f_status_t status = 0;
f_string_range_t range = macro_f_string_range_t_initialize(object.used);
- status = fl_fss_extended_list_object_write_string(object, f_fss_complete_full, &range, destination);
+ status = fl_fss_extended_list_object_write_string(object, f_fss_complete_full, state, &range, destination);
if (F_status_is_error(status) || status == F_data_not_stop || status == F_data_not_eos) {
return status;
range.stop = 0;
}
- status = fl_fss_extended_list_content_write_string(content, f_fss_complete_full, content_prepend, ignore, &range, destination);
+ status = fl_fss_extended_list_content_write_string(content, f_fss_complete_full, content_prepend, ignore, state, &range, destination);
}
return status;
*
* @param buffer
* The buffer to read from.
+ * @param state
+ * A state for handling interrupts during long running operations.
+ * There is no print_error() usage at this time (@todo this should be implemented and supported).
+ * There is no functions structure.
+ * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure).
+ *
+ * When interrupt() returns, only F_interrupt and F_interrupt_not are processed.
+ * Error bit designates an error but must be passed along with F_interrupt.
+ * All other statuses are ignored.
* @param range
* The range within the buffer that is currently being read.
* @param objects
* F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete.
* F_complete_not_utf_eos (with error bit) if the end of buffer is reached before the complete UTF-8 character can be processed.
* F_complete_not_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed.
+ * F_interrupt (with error bit) if stopping due to an interrupt.
* F_memory_not (with error bit) on out of memory.
* F_number_overflow (with error bit) if the maximimum buffer size is reached.
* F_parameter (with error bit) if a parameter is invalid.
* Errors (with error bit) from: fl_fss_extended_list_object_read().
*/
#ifndef _di_fll_fss_extended_list_read_
- extern f_status_t fll_fss_extended_list_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_objects_t *objects, f_fss_contents_t *contents, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits, f_fss_comments_t *comments);
+ extern f_status_t fll_fss_extended_list_read(const f_string_static_t buffer, f_state_t state, f_string_range_t *range, f_fss_objects_t *objects, f_fss_contents_t *contents, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits, f_fss_comments_t *comments);
#endif // _di_fll_fss_extended_list_read_
/**
* These ranges are only checked/ignored if there is a valid nested object open or a valid nested object close.
* Any valid nested object open or valid nested object close inside an ingore range will not be escaped.
* Set the pointer address to 0 to disable.
+ * @param state
+ * A state for handling interrupts during long running operations.
+ * There is no print_error() usage at this time (@todo this should be implemented and supported).
+ * There is no functions structure.
+ * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure).
+ *
+ * When interrupt() returns, only F_interrupt and F_interrupt_not are processed.
+ * Error bit designates an error but must be passed along with F_interrupt.
+ * All other statuses are ignored.
* @param destination
* The buffer where the content is written to.
*
* F_data_not_stop no data to write due start location being greater than stop location.
*
* F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete.
+ * F_interrupt (with error bit) if stopping due to an interrupt.
* F_memory_not (with error bit) on out of memory.
* F_parameter (with error bit) if a parameter is invalid.
* F_utf (with error bit) is returned on failure to read/process a UTF-8 character.
* Errors (with error bit) from: f_string_dynamic_increase_by().
*/
#ifndef _di_fll_fss_extended_list_write_string_
- extern f_status_t fll_fss_extended_list_write_string(const f_string_static_t object, const f_string_static_t content, const f_string_static_t *content_prepend, const f_string_ranges_t *ignore, f_string_dynamic_t *destination);
+ extern f_status_t fll_fss_extended_list_write_string(const f_string_static_t object, const f_string_static_t content, const f_string_static_t *content_prepend, const f_string_ranges_t *ignore, f_state_t state, f_string_dynamic_t *destination);
#endif // _di_fll_fss_extended_list_write_string_
#ifdef __cplusplus
}
else if (content.string[i]) {
if (escaped->used + 1 > escaped->size) {
- status = f_string_dynamic_increase_by(f_memory_default_allocation_step, escaped);
+ status = f_string_dynamic_increase_by(f_memory_default_allocation_small, escaped);
if (F_status_is_error(status)) return status;
}
}
else if (content.string[i]) {
if (unescaped->used + 1 > unescaped->size) {
- status = f_string_dynamic_increase_by(f_memory_default_allocation_step, unescaped);
+ status = f_string_dynamic_increase_by(f_memory_default_allocation_small, unescaped);
if (F_status_is_error(status)) return status;
}
status = F_none;
}
else {
- macro_f_memory_structure_increment(status, (*destination), 1, f_memory_default_allocation_step, macro_f_string_dynamics_t_resize, F_array_too_large);
+ macro_f_memory_structure_increment(status, (*destination), 1, f_memory_default_allocation_small, macro_f_string_dynamics_t_resize, F_array_too_large);
if (F_status_is_error(status)) break;
destination->array[destination->used] = ripped;
status = F_none;
}
else {
- macro_f_string_dynamics_t_increase(status, (*destination));
+ macro_f_string_dynamics_t_increase(status, f_memory_default_allocation_small, (*destination));
if (F_status_is_error(status)) return status;
destination->array[destination->used] = ripped;
return F_none;
}
+ if (fl_string_compare(string, FL_status_string_disable, length, FL_status_string_disable_length) == F_equal_to) {
+ *code = F_disable;
+
+ return F_none;
+ }
+
+ if (fl_string_compare(string, FL_status_string_disable_not, length, FL_status_string_disable_not_length) == F_equal_to) {
+ *code = F_disable_not;
+
+ return F_none;
+ }
+
if (fl_string_compare(string, FL_status_string_done, length, FL_status_string_done_length) == F_equal_to) {
*code = F_done;
return F_none;
}
+ if (fl_string_compare(string, FL_status_string_enable, length, FL_status_string_enable_length) == F_equal_to) {
+ *code = F_enable;
+
+ return F_none;
+ }
+
+ if (fl_string_compare(string, FL_status_string_enable_not, length, FL_status_string_enable_not_length) == F_equal_to) {
+ *code = F_enable_not;
+
+ return F_none;
+ }
+
if (fl_string_compare(string, FL_status_string_encoding, length, FL_status_string_encoding_length) == F_equal_to) {
*code = F_encoding;
#ifndef _di_controller_defines_
- // This specifically must be at least 2 for this project.
- #define controller_default_allocation_step 4
-
#define controller_default_program_script "bash"
#define controller_path_pid "/var/run/controller/controller-"
f_status_t controller_pids_increase(controller_pids_t *pids) {
if (pids->used + 1 > pids->size) {
- f_array_length_t size = pids->used + controller_default_allocation_step;
+ f_array_length_t size = pids->used + controller_common_allocation_small;
if (size > f_array_length_t_size) {
if (pids->used + 1 > f_array_length_t_size) {
f_status_t controller_processs_increase(controller_processs_t *processs) {
if (processs->used + 1 > processs->size) {
- f_array_length_t size = processs->used + controller_default_allocation_step;
+ f_array_length_t size = processs->used + controller_common_allocation_small;
if (size > f_array_length_t_size) {
if (processs->used + 1 > f_array_length_t_size) {
f_status_t controller_rule_ons_increase(controller_rule_ons_t *ons) {
if (ons->used + 1 > ons->size) {
- f_array_length_t size = ons->used + controller_default_allocation_step;
+ f_array_length_t size = ons->used + controller_common_allocation_small;
if (size > f_array_length_t_size) {
if (ons->used + 1 > f_array_length_t_size) {
f_status_t controller_rules_increase(controller_rules_t *rules) {
if (rules->used + 1 > rules->size) {
- f_array_length_t size = rules->used + controller_default_allocation_step;
+ f_array_length_t size = rules->used + controller_common_allocation_small;
if (size > f_array_length_t_size) {
if (rules->used + 1 > f_array_length_t_size) {
#endif // _di_controller_resource_limit_t_
/**
+ * Provide common/generic definitions.
+ *
+ * The controller_common_allocation_large or controller_common_allocation_small must be at least 2 for this project.
+ *
+ * controller_common_allocation_*:
+ * - large: An allocation step used for buffers that are anticipated to have large buffers.
+ * - small: An allocation step used for buffers that are anticipated to have small buffers.
+ */
+#ifndef _di_controller_common_
+ #define controller_common_allocation_large 256
+ #define controller_common_allocation_small 16
+#endif // _di_controller_common_
+
+/**
* Action related cache.
*
* line_action: The line in some file representing an Action.
controller_processs_t_initialize, \
controller_cache_t_initialize, \
}
-#endif // _di_controller_data_common_t_
+#endif // _di_controller_thread_t_
+
+/**
+ * A structure for passing data to the interrupt state function.
+ *
+ * is_normal: Boolean designating if this is operating in a normal state.
+ * thread: The thread data.
+ */
+#ifndef _di_controller_state_interrupt_t_
+ typedef struct {
+ bool is_normal;
+ controller_thread_t *thread;
+ } controller_state_interrupt_t;
+
+ #define controller_state_interrupt_t_initialize { \
+ F_true, \
+ 0, \
+ }
+
+ #define macro_controller_state_interrupt_t_initialize(is_normal, thread) { \
+ is_normal, \
+ thread, \
+ }
+#endif // _di_controller_state_interrupt_t_
/**
* A wrapper used for passing a common set of all data, particularly for sharing between threads.
*
* @return
* F_none on success.
- * F_data_not on success, but there is no reason to increase size (used + controller_default_allocation_step <= size).
+ * F_data_not on success, but there is no reason to increase size (used + controller_common_allocation_small <= size).
*
* F_array_too_large (with error bit) if the new array length is too large.
* F_memory_not (with error bit) on out of memory.
*
* @return
* F_none on success.
- * F_data_not on success, but there is no reason to increase size (used + controller_default_allocation_step <= size).
+ * F_data_not on success, but there is no reason to increase size (used + controller_common_allocation_small <= size).
*
* F_array_too_large (with error bit) if the new array length is too large.
* F_memory_not (with error bit) on out of memory.
*
* @return
* F_none on success.
- * F_data_not on success, but there is no reason to increase size (used + controller_default_allocation_step <= size).
+ * F_data_not on success, but there is no reason to increase size (used + controller_common_allocation_small <= size).
*
* F_array_too_large (with error bit) if the new array length is too large.
* F_memory_not (with error bit) on out of memory.
*
* @return
* F_none on success.
- * F_data_not on success, but there is no reason to increase size (used + controller_default_allocation_step <= size).
+ * F_data_not on success, but there is no reason to increase size (used + controller_common_allocation_small <= size).
*
* F_array_too_large (with error bit) if the new array length is too large.
* F_memory_not (with error bit) on out of memory.
cache->action.name_action.used = 0;
cache->action.name_item.used = 0;
- macro_f_array_lengths_t_increase_by(status, cache->ats, controller_default_allocation_step)
+ macro_f_array_lengths_t_increase_by(status, cache->ats, controller_common_allocation_small)
if (F_status_is_error(status)) {
controller_entry_error_print(is_entry, global.main->error, cache->action, F_status_set_fine(status), "macro_f_array_lengths_t_increase_by", F_true, global.thread);
if (error_has) break;
- macro_f_array_lengths_t_increase_by(status2, cache->ats, controller_default_allocation_step)
+ macro_f_array_lengths_t_increase_by(status2, cache->ats, controller_common_allocation_small)
if (F_status_is_error(status2)) {
controller_entry_error_print(is_entry, global.main->error, cache->action, F_status_set_fine(status2), "macro_f_array_lengths_t_increase_by", F_true, global.thread);
if (F_status_is_error(status)) return status;
}
- macro_f_array_lengths_t_increase_by(status, cache->ats, controller_default_allocation_step)
+ macro_f_array_lengths_t_increase_by(status, cache->ats, controller_common_allocation_small)
if (F_status_is_error(status)) {
controller_entry_error_print(is_entry, global->main->error, cache->action, F_status_set_fine(status), "macro_f_array_lengths_t_increase_by", F_true, global->thread);
return F_status_is_error(F_critical);
}
- macro_f_array_lengths_t_increase_by(status, cache->ats, controller_default_allocation_step)
+ macro_f_array_lengths_t_increase_by(status, cache->ats, controller_common_allocation_small)
if (F_status_is_error(status)) {
controller_entry_error_print(is_entry, global->main->error, cache->action, F_status_set_fine(status), "macro_f_array_lengths_t_increase_by", F_true, global->thread);
} // while
{
+ controller_state_interrupt_t custom = macro_controller_state_interrupt_t_initialize(F_true, global.thread);
+ f_state_t state = macro_f_state_t_initialize(controller_common_allocation_large, controller_common_allocation_small, 0, &controller_thread_signal_state_fss, 0, (void *) &custom, 0);
f_string_range_t range = content_range;
- status = fll_fss_extended_read(cache->buffer_file, &range, &cache->object_actions, &cache->content_actions, 0, 0, &cache->delimits, 0);
+ status = fll_fss_extended_read(cache->buffer_file, state, &range, &cache->object_actions, &cache->content_actions, 0, 0, &cache->delimits, 0);
}
if (F_status_is_error(status)) {
if (F_status_is_error_not(status)) {
if (cache->buffer_file.used) {
+ controller_state_interrupt_t custom = macro_controller_state_interrupt_t_initialize(is_entry, global.thread);
+ f_state_t state = macro_f_state_t_initialize(controller_common_allocation_large, controller_common_allocation_small, 0, &controller_thread_signal_state_fss, 0, (void *) &custom, 0);
f_string_range_t range = macro_f_string_range_t_initialize(cache->buffer_file.used);
- status = fll_fss_basic_list_read(cache->buffer_file, &range, &cache->object_items, &cache->content_items, &cache->delimits, 0, &cache->comments);
+ status = fll_fss_basic_list_read(cache->buffer_file, state, &range, &cache->object_items, &cache->content_items, &cache->delimits, 0, &cache->comments);
if (F_status_is_error(status)) {
controller_error_print(global.main->error, F_status_set_fine(status), "fll_fss_basic_list_read", F_true, global.thread);
cache->action.name_action.used = 0;
cache->action.name_item.used = 0;
- status = controller_entry_items_increase_by(controller_default_allocation_step, &entry->items);
+ status = controller_entry_items_increase_by(controller_common_allocation_small, &entry->items);
if (F_status_is_error(status)) {
controller_entry_error_print(is_entry, global.main->error, cache->action, F_status_set_fine(status), "controller_entry_items_increase_by", F_true, global.thread);
f_status_t status = F_none;
{
+ controller_state_interrupt_t custom = macro_controller_state_interrupt_t_initialize(is_entry, global.thread);
+ f_state_t state = macro_f_state_t_initialize(controller_common_allocation_large, controller_common_allocation_small, 0, &controller_thread_signal_state_fss, 0, (void *) &custom, 0);
f_string_range_t range = content_range;
- status = fll_fss_extended_read(cache->buffer_file, &range, &cache->object_actions, &cache->content_actions, 0, 0, &cache->delimits, 0);
+ status = fll_fss_extended_read(cache->buffer_file, state, &range, &cache->object_actions, &cache->content_actions, 0, 0, &cache->delimits, 0);
}
if (F_status_is_error(status)) {
if (object && object->start <= object->start) {
- status = f_string_dynamics_increase(parameters);
+ status = f_string_dynamics_increase(controller_common_allocation_small, parameters);
if (F_status_is_error(status)) {
controller_error_print(global.main->error, F_status_set_fine(status), "f_string_dynamics_increase", F_true, global.thread);
if (content->array[i].start > content->array[i].start) continue;
- status = f_string_dynamics_increase(parameters);
+ status = f_string_dynamics_increase(controller_common_allocation_small, parameters);
if (F_status_is_error(status)) {
controller_error_print(global.main->error, F_status_set_fine(status), "f_string_dynamics_increase", F_true, global.thread);
#endif // _di_controller_rule_actions_increase_by_
#ifndef _di_controller_rule_action_read_
- f_status_t controller_rule_action_read(const controller_global_t global, const uint8_t type, const uint8_t method, controller_cache_t *cache, controller_rule_item_t *item, controller_rule_actions_t *actions, f_string_range_t *range) {
+ f_status_t controller_rule_action_read(const bool is_normal, const controller_global_t global, const uint8_t type, const uint8_t method, controller_cache_t *cache, controller_rule_item_t *item, controller_rule_actions_t *actions, f_string_range_t *range) {
f_status_t status = F_none;
actions->array[actions->used].parameters.used = 0;
}
- status = fl_fss_extended_list_content_read(cache->buffer_item, range, &cache->content_action, &cache->delimits, &cache->comments);
+ {
+ controller_state_interrupt_t custom = macro_controller_state_interrupt_t_initialize(is_normal, global.thread);
+ f_state_t state = macro_f_state_t_initialize(controller_common_allocation_large, controller_common_allocation_small, 0, &controller_thread_signal_state_fss, 0, (void *) &custom, 0);
+
+ status = fl_fss_extended_list_content_read(cache->buffer_item, state, range, &cache->content_action, &cache->delimits, &cache->comments);
+ }
if (F_status_is_error(status)) {
controller_error_print(global.main->error, F_status_set_fine(status), "fl_fss_extended_list_content_read", F_true, global.thread);
if (item->type == controller_rule_item_type_script || item->type == controller_rule_item_type_utility) {
actions->array[actions->used].parameters.used = 0;
- status = f_string_dynamics_increase(&actions->array[actions->used].parameters);
+ status = f_string_dynamics_increase(controller_common_allocation_small, &actions->array[actions->used].parameters);
if (F_status_is_error(status)) {
controller_error_print(global.main->error, F_status_set_fine(status), "f_string_dynamics_increase", F_true, global.thread);
return status;
}
- // the object_actions and content_actions caches are being used for the purposes of getting the parameters a given the action.
- status = fll_fss_extended_read(cache->buffer_item, &cache->content_action.array[0], &cache->object_actions, &cache->content_actions, 0, 0, &cache->delimits, 0);
+ {
+ controller_state_interrupt_t custom = macro_controller_state_interrupt_t_initialize(is_normal, global.thread);
+ f_state_t state = macro_f_state_t_initialize(controller_common_allocation_large, controller_common_allocation_small, 0, &controller_thread_signal_state_fss, 0, (void *) &custom, 0);
+
+ // the object_actions and content_actions caches are being used for the purposes of getting the parameters a given the action.
+ status = fll_fss_extended_read(cache->buffer_item, state, &cache->content_action.array[0], &cache->object_actions, &cache->content_actions, 0, 0, &cache->delimits, 0);
+ }
if (F_status_is_error(status)) {
controller_error_print(global.main->error, F_status_set_fine(status), "fll_fss_extended_read", F_true, global.thread);
f_array_length_t j = 0;
for (; i < cache->object_actions.used; ++i) {
- status = controller_rule_actions_increase_by(controller_default_allocation_step, actions);
+ status = controller_rule_actions_increase_by(controller_common_allocation_small, actions);
if (F_status_is_error(status)) {
controller_error_print(global.main->error, F_status_set_fine(status), "controller_rule_actions_increase_by", F_true, global.thread);
actions->array[actions->used].parameters.used = 0;
actions->array[actions->used].status = F_known_not;
- status = f_string_dynamics_increase(&actions->array[actions->used].parameters);
+ status = f_string_dynamics_increase(controller_common_allocation_small, &actions->array[actions->used].parameters);
if (F_status_is_error(status)) {
controller_error_print(global.main->error, F_status_set_fine(status), "f_string_dynamics_increase", F_true, global.thread);
}
}
else {
-
cache->content_action.used = 0;
cache->delimits.used = 0;
- status = fl_fss_extended_content_read(cache->buffer_item, range, &cache->content_action, 0, &cache->delimits);
+ {
+ controller_state_interrupt_t custom = macro_controller_state_interrupt_t_initialize(is_normal, global.thread);
+ f_state_t state = macro_f_state_t_initialize(controller_common_allocation_large, controller_common_allocation_small, 0, &controller_thread_signal_state_fss, 0, (void *) &custom, 0);
+
+ status = fl_fss_extended_content_read(cache->buffer_item, state, range, &cache->content_action, 0, &cache->delimits);
+ }
if (F_status_is_error(status)) {
controller_error_print(global.main->error, F_status_set_fine(status), "fll_fss_extended_content_read", F_true, global.thread);
controller_error_print(global.main->error, F_status_set_fine(status), "fl_fss_apply_delimit", F_true, global.thread);
}
else if (item->type == controller_rule_item_type_script || item->type == controller_rule_item_type_utility) {
- status = f_string_dynamics_increase(&actions->array[actions->used].parameters);
+ status = f_string_dynamics_increase(controller_common_allocation_small, &actions->array[actions->used].parameters);
if (F_status_is_error(status)) {
controller_error_print(global.main->error, F_status_set_fine(status), "f_string_dynamics_increase", F_true, global.thread);
return status;
}
- status = f_string_dynamics_increase(&process->path_pids);
+ status = f_string_dynamics_increase(controller_common_allocation_small, &process->path_pids);
if (F_status_is_error(status)) {
fll_error_print(global.main->error, F_status_set_fine(status), "f_string_dynamics_increase", F_true);
#endif // _di_controller_rule_status_is_error_
#ifndef _di_controller_rule_item_read_
- f_status_t controller_rule_item_read(const controller_global_t global, controller_cache_t *cache, controller_rule_item_t *item) {
+ f_status_t controller_rule_item_read(const bool is_normal, const controller_global_t global, controller_cache_t *cache, controller_rule_item_t *item) {
f_status_t status = F_none;
-
+ controller_state_interrupt_t custom = macro_controller_state_interrupt_t_initialize(is_normal, global.thread);
+ f_state_t state = macro_f_state_t_initialize(controller_common_allocation_large, controller_common_allocation_small, 0, &controller_thread_signal_state_fss, 0, (void *) &custom, 0);
f_string_range_t range = macro_f_string_range_t_initialize(cache->buffer_item.used);
f_array_length_t last = 0;
for (; range.start < cache->buffer_item.used && range.start <= range.stop; last = range.start, cache->delimits.used = 0, cache->comments.used = 0) {
- status = fl_fss_extended_list_object_read(cache->buffer_item, &range, &cache->range_action, &cache->delimits);
+ status = fl_fss_extended_list_object_read(cache->buffer_item, state, &range, &cache->range_action, &cache->delimits);
if (F_status_is_error(status)) {
controller_error_print(global.main->error, F_status_set_fine(status), "fl_fss_extended_list_object_read", F_true, global.thread);
cache->delimits.used = 0;
// The current line is not an Extended List object, so the next possibility is a Basic List (and Extended List, both use the same Object structure).
- status = fl_fss_extended_object_read(cache->buffer_item, &range, &cache->range_action, 0, &cache->delimits);
+ status = fl_fss_extended_object_read(cache->buffer_item, state, &range, &cache->range_action, 0, &cache->delimits);
if (F_status_is_error(status)) {
controller_error_print(global.main->error, F_status_set_fine(status), "fl_fss_extended_object_read", F_true, global.thread);
method = controller_rule_action_method_extended;
}
- status = controller_rule_actions_increase_by(controller_default_allocation_step, &item->actions);
+ status = controller_rule_actions_increase_by(controller_common_allocation_small, &item->actions);
if (F_status_is_error(status)) {
controller_error_print(global.main->error, F_status_set_fine(status), "controller_rule_actions_increase_by", F_true, global.thread);
break;
}
- status = controller_rule_action_read(global, type, method, cache, item, &item->actions, &range);
+ status = controller_rule_action_read(is_normal, global, type, method, cache, item, &item->actions, &range);
if (F_status_is_error(status)) break;
} // for
}
if (F_status_is_error_not(status)) {
- status = f_type_array_lengths_increase(&process->stack);
+ status = f_type_array_lengths_increase(controller_common_allocation_small, &process->stack);
if (F_status_is_error(status)) {
controller_error_print(global.main->error, F_status_set_fine(status), "f_type_array_lengths_increase", F_true, global.thread);
rule->timestamp = cache->timestamp;
if (cache->buffer_file.used) {
+ controller_state_interrupt_t custom = macro_controller_state_interrupt_t_initialize(is_normal, global.thread);
+ f_state_t state = macro_f_state_t_initialize(controller_common_allocation_large, controller_common_allocation_small, 0, &controller_thread_signal_state_fss, 0, (void *) &custom, 0);
f_string_range_t range = macro_f_string_range_t_initialize(cache->buffer_file.used);
- status = fll_fss_basic_list_read(cache->buffer_file, &range, &cache->object_items, &cache->content_items, &cache->delimits, 0, &cache->comments);
+ status = fll_fss_basic_list_read(cache->buffer_file, state, &range, &cache->object_items, &cache->content_items, &cache->delimits, 0, &cache->comments);
if (F_status_is_error(status)) {
controller_error_print(global.main->error, F_status_set_fine(status), "fll_fss_basic_list_read", F_true, global.thread);
}
if (rule->items.array[rule->items.used].type) {
- status = controller_rule_item_read(global, cache, &rule->items.array[rule->items.used]);
+ status = controller_rule_item_read(is_normal, global, cache, &rule->items.array[rule->items.used]);
if (F_status_is_error(status)) break;
rule->items.used++;
else {
for_item = F_false;
- status = controller_rule_setting_read(global, *global.setting, cache, rule);
+ status = controller_rule_setting_read(is_normal, global, *global.setting, cache, rule);
if (F_status_is_error(status)) {
if (F_status_set_fine(status) == F_memory_not) {
#endif // _di_controller_rule_read_
#ifndef _di_controller_rule_setting_read_
- f_status_t controller_rule_setting_read(const controller_global_t global, const controller_setting_t setting, controller_cache_t *cache, controller_rule_t *rule) {
+ f_status_t controller_rule_setting_read(const bool is_normal, const controller_global_t global, const controller_setting_t setting, controller_cache_t *cache, controller_rule_t *rule) {
f_status_t status = F_none;
f_status_t status_return = F_none;
f_string_range_t range = macro_f_string_range_t_initialize(cache->buffer_item.used);
f_string_range_t range2 = f_string_range_t_initialize;
- status = fll_fss_extended_read(cache->buffer_item, &range, &cache->object_actions, &cache->content_actions, 0, 0, &cache->delimits, 0);
+ {
+ controller_state_interrupt_t custom = macro_controller_state_interrupt_t_initialize(is_normal, global.thread);
+ f_state_t state = macro_f_state_t_initialize(controller_common_allocation_large, controller_common_allocation_small, 0, &controller_thread_signal_state_fss, 0, (void *) &custom, 0);
+
+ status = fll_fss_extended_read(cache->buffer_item, state, &range, &cache->object_actions, &cache->content_actions, 0, 0, &cache->delimits, 0);
+ }
if (F_status_is_error(status)) {
controller_rule_error_print(global.main->error, cache->action, F_status_set_fine(status), "fll_fss_extended_read", F_true, F_false, global.thread);
// @todo this needs to be in a function such as f_int32s_increase().
if (rule->affinity.used + 1 > rule->affinity.size) {
- f_array_length_t size = rule->affinity.used + f_memory_default_allocation_step;
+ f_array_length_t size = rule->affinity.used + controller_common_allocation_small;
if (size > f_array_length_t_size) {
if (rule->affinity.used + 1 > f_array_length_t_size) {
setting_maps = &rule->parameter;
}
- status = f_string_maps_increase(setting_maps);
+ status = f_string_maps_increase(controller_common_allocation_small, setting_maps);
if (F_status_is_error(status)) {
controller_rule_error_print(global.main->error, cache->action, F_status_set_fine(status), "f_string_maps_increase", F_true, F_false, global.thread);
for (j = 1; j < cache->content_actions.array[i].used; ++j) {
- status = f_string_dynamics_increase(&rule->control_group.groups);
+ status = f_string_dynamics_increase(controller_common_allocation_small, &rule->control_group.groups);
if (F_status_is_error(status)) {
controller_rule_error_print(global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamics_increase", F_true, F_false, global.thread);
if (F_status_is_error(status)) continue;
- macro_f_limit_sets_t_increase(status, rule->limits);
+ macro_f_limit_sets_t_increase(status, controller_common_allocation_small, rule->limits);
if (F_status_is_error(status)) {
controller_rule_error_print(global.main->error, cache->action, F_status_set_fine(status), "f_limit_sets_increase", F_true, F_false, global.thread);
for (j = 0; j < cache->content_actions.array[i].used; ++j) {
- macro_f_array_lengths_t_increase_by(status, rule->groups, controller_default_allocation_step)
+ macro_f_array_lengths_t_increase_by(status, rule->groups, controller_common_allocation_small)
if (F_status_is_error(status)) {
controller_rule_error_print(global.main->error, cache->action, F_status_set_fine(status), "macro_f_array_lengths_t_increase_by", F_true, F_false, global.thread);
for (j = 0; j < cache->content_actions.array[i].used; ++j) {
- status = f_string_dynamics_increase(setting_values);
+ status = f_string_dynamics_increase(controller_common_allocation_small, setting_values);
if (F_status_is_error(status)) {
controller_rule_error_print(global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamics_increase", F_true, F_false, global.thread);
continue;
}
- status = f_string_dynamics_increase_by(controller_default_allocation_step, setting_values);
+ status = f_string_dynamics_increase_by(controller_common_allocation_small, setting_values);
if (F_status_is_error(status)) {
controller_rule_error_print(global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamics_increase_by", F_true, F_false, global.thread);
*
* This will automatically increase the size of the actions array as needed.
*
+ * @param is_normal
+ * If TRUE, then process as if this operates during a normal operation (entry and control).
+ * If FALSE, then process as if this operates during a an exit operation.
* @param global
* The global data.
* @param type
* @see f_fss_count_lines()
*/
#ifndef _di_controller_rule_action_read_
- extern f_status_t controller_rule_action_read(const controller_global_t global, const uint8_t type, const uint8_t method, controller_cache_t *cache, controller_rule_item_t *item, controller_rule_actions_t *actions, f_string_range_t *range) f_attribute_visibility_internal;
+ extern f_status_t controller_rule_action_read(const bool is_normal, const controller_global_t global, const uint8_t type, const uint8_t method, controller_cache_t *cache, controller_rule_item_t *item, controller_rule_actions_t *actions, f_string_range_t *range) f_attribute_visibility_internal;
#endif // _di_controller_rule_action_read_
/**
*
* This will perform additional FSS read functions as appropriate.
*
+ * @param is_normal
+ * If TRUE, then process as if this operates during a normal operation (entry and control).
+ * If FALSE, then process as if this operates during a an exit operation.
* @param global
* The global data.
* @param cache
* @see f_string_dynamic_terminate_after()
*/
#ifndef _di_controller_rule_item_read_
- extern f_status_t controller_rule_item_read(const controller_global_t global, controller_cache_t *cache, controller_rule_item_t *item) f_attribute_visibility_internal;
+ extern f_status_t controller_rule_item_read(const bool is_normal, const controller_global_t global, controller_cache_t *cache, controller_rule_item_t *item) f_attribute_visibility_internal;
#endif // _di_controller_rule_item_read_
/**
* Errors from this are not considered fatal, but the first error code encountered is returned.
* Memory failure errors are always immediately returned.
*
+ * @param is_normal
+ * If TRUE, then process as if this operates during a normal operation (entry and control).
+ * If FALSE, then process as if this operates during a an exit operation.
* @param global
* The global data.
* @param setting
* @see fll_path_canonical()
*/
#ifndef _di_controller_rule_setting_read_
- extern f_status_t controller_rule_setting_read(const controller_global_t global, const controller_setting_t setting, controller_cache_t *cache, controller_rule_t *rule) f_attribute_visibility_internal;
+ extern f_status_t controller_rule_setting_read(const bool is_normal, const controller_global_t global, const controller_setting_t setting, controller_cache_t *cache, controller_rule_t *rule) f_attribute_visibility_internal;
#endif // _di_controller_rule_setting_read_
/**
}
#endif // _di_controller_thread_signal_
+#ifndef _di_controller_thread_signal_state_fss_
+ f_status_t controller_thread_signal_state_fss(void *state, void *internal) {
+
+ if (!state) {
+ return F_interrupt_not;
+ }
+
+ f_state_t *state_ptr = (f_state_t *) state;
+
+ if (!state_ptr->custom) {
+ return F_interrupt_not;
+ }
+
+ controller_state_interrupt_t *custom = (controller_state_interrupt_t *) state_ptr->custom;
+ controller_thread_t *thread = custom->thread;
+
+ if (!controller_thread_is_enabled(custom->is_normal, thread)) {
+ return F_status_set_error(F_interrupt);
+ }
+
+ if (thread->signal == F_signal_interrupt || thread->signal == F_signal_abort || thread->signal == F_signal_quit || thread->signal == F_signal_termination) {
+ return F_status_set_error(F_interrupt);
+ }
+
+ return F_interrupt_not;
+ }
+#endif // _di_controller_thread_signal_state_fss_
+
+#ifndef _di_controller_thread_signal_state_iki_
+ f_status_t controller_thread_signal_state_iki(void *state, void *internal) {
+
+ if (!state) {
+ return F_interrupt_not;
+ }
+
+ f_state_t *state_ptr = (f_state_t *) state;
+
+ if (!state_ptr->custom) {
+ return F_interrupt_not;
+ }
+
+ controller_state_interrupt_t *custom = (controller_state_interrupt_t *) state_ptr->custom;
+ controller_thread_t *thread = custom->thread;
+
+ if (!controller_thread_is_enabled(custom->is_normal, thread)) {
+ return F_status_set_error(F_interrupt);
+ }
+
+ if (thread->signal == F_signal_interrupt || thread->signal == F_signal_abort || thread->signal == F_signal_quit || thread->signal == F_signal_termination) {
+ return F_status_set_error(F_interrupt);
+ }
+
+ return F_interrupt_not;
+ }
+#endif // _di_controller_thread_signal_state_iki_
+
#ifndef _di_controller_thread_signal_normal_
void * controller_thread_signal_normal(void *arguments) {
/**
* Thread for handling signals/interrupts.
*
- * Currently this only handles signals to exist, but may be updated to handle interrupt and hangup signals.
- *
* @param is_normal
* If TRUE, then process as if this operates during a normal operation (entry and control).
* If FALSE, then process as if this operates during a an exit operation.
#endif // _di_controller_thread_signal_
/**
+ * Callback passed to FSS functions for checking for interrupts.
+ *
+ * @param state
+ * The f_state_t data.
+ * @param internal
+ * Not used.
+ *
+ * @return
+ * F_interrupt_not if not interrupted.
+ *
+ * F_interrupt (with error bit) if interrupted.
+ */
+#ifndef _di_controller_thread_signal_state_fss_
+ extern f_status_t controller_thread_signal_state_fss(void *state, void *internal) f_attribute_visibility_internal;
+#endif // _di_controller_thread_signal_state_fss_
+
+/**
+ * Callback passed to IKI functions for checking for interrupts.
+ *
+ * @param state
+ * The f_state_t data.
+ * @param internal
+ * Not used.
+ *
+ * @return
+ * F_interrupt_not if not interrupted.
+ *
+ * F_interrupt (with error bit) if interrupted.
+ */
+#ifndef _di_controller_thread_signal_state_iki_
+ extern f_status_t controller_thread_signal_state_iki(void *state, void *internal) f_attribute_visibility_internal;
+#endif // _di_controller_thread_signal_state_iki_
+
+/**
* Thread for handling signals/interrupts during normal operations.
*
* Currently this only handles signals to exist, but may be updated to handle interrupt and hangup signals.
f_string_range_t range = macro_f_string_range_t_initialize(buffer.used);
f_fss_delimits_t delimits = f_fss_delimits_t_initialize;
- *status = fll_fss_extended_read(buffer, &range, &objects, &contents, 0, 0, &delimits, 0);
+ {
+ f_state_t state = macro_f_state_t_initialize(fake_common_allocation_large, fake_common_allocation_small, 0, &fake_signal_state_interrupt_fss, 0, (void *) &main, 0);
+
+ *status = fll_fss_extended_read(buffer, state, &range, &objects, &contents, 0, 0, &delimits, 0);
+ }
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);
#define fake_build_parameter_object_link_arguments_length 3
#endif // _di_fake_build_parameter_
+/**
+ * Provide common/generic definitions.
+ *
+ * fake_common_allocation_*:
+ * - large: An allocation step used for buffers that are anticipated to have large buffers.
+ * - small: An allocation step used for buffers that are anticipated to have small buffers.
+ */
#ifndef _di_fake_common_
+ #define fake_common_allocation_large 256
+ #define fake_common_allocation_small 16
+
#define fake_common_initial_buffer_max 131072 // 128k max default initial buffer size.
#define fake_common_setting_bool_yes "yes"
}
#endif // _di_fake_signal_read_
+#ifndef _di_fake_signal_state_interrupt_fss_
+ f_status_t fake_signal_state_interrupt_fss(void *state, void *internal) {
+
+ if (!state) {
+ return F_interrupt_not;
+ }
+
+ f_state_t *state_ptr = (f_state_t *) state;
+
+ if (!state_ptr->custom) {
+ 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);
+ }
+
+ return F_interrupt_not;
+ }
+#endif // _di_fake_signal_state_interrupt_fss_
+
+#ifndef _di_fake_signal_state_interrupt_iki_
+ f_status_t fake_signal_state_interrupt_iki(void *state, void *internal) {
+
+ if (!state) {
+ return F_interrupt_not;
+ }
+
+ f_state_t *state_ptr = (f_state_t *) state;
+
+ if (!state_ptr->custom) {
+ 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);
+ }
+
+ return F_interrupt_not;
+ }
+#endif // _di_fake_signal_state_interrupt_iki_
+
#ifndef _di_fake_validate_directories_
f_status_t fake_validate_parameter_directories(const f_console_arguments_t arguments, const fake_main_t main) {
#endif // _di_fake_signal_read_
/**
+ * Callback passed to FSS functions for checking for interrupts.
+ *
+ * @param state
+ * The f_state_t data.
+ * @param internal
+ * Not used.
+ *
+ * @return
+ * F_interrupt_not if not interrupted.
+ *
+ * F_interrupt (with error bit) if interrupted.
+ */
+#ifndef _di_fake_signal_state_interrupt_fss_
+ extern f_status_t fake_signal_state_interrupt_fss(void *state, void *internal) f_attribute_visibility_internal;
+#endif // _di_fake_signal_state_interrupt_fss_
+
+/**
+ * Callback passed to IKI functions for checking for interrupts.
+ *
+ * @param state
+ * The f_state_t data.
+ * @param internal
+ * Not used.
+ *
+ * @return
+ * F_interrupt_not if not interrupted.
+ *
+ * F_interrupt (with error bit) if interrupted.
+ */
+#ifndef _di_fake_signal_state_interrupt_iki_
+ extern f_status_t fake_signal_state_interrupt_iki(void *state, void *internal) f_attribute_visibility_internal;
+#endif // _di_fake_signal_state_interrupt_iki_
+
+/**
* Validate directories and print any relating error messages.
*
* This should not be called for skeleton as in that case the directories probably do not exist.
if (fake_signal_received(main)) {
*status = F_status_set_error(F_signal);
+
return;
}
if (fake_signal_received(main)) {
*status = F_status_set_error(F_signal);
+
return;
}
f_fss_delimits_t delimits = f_fss_delimits_t_initialize;
f_fss_comments_t comments = f_fss_comments_t_initialize;
- *status = fll_fss_basic_list_read(data_make->buffer, &range, &list_objects, &list_contents, &delimits, 0, &comments);
+ {
+ f_state_t state = macro_f_state_t_initialize(fake_common_allocation_large, fake_common_allocation_small, 0, &fake_signal_state_interrupt_fss, 0, (void *) &main, 0);
+
+ *status = fll_fss_basic_list_read(data_make->buffer, state, &range, &list_objects, &list_contents, &delimits, 0, &comments);
+ }
if (F_status_is_error(*status)) {
fake_print_error_fss(main, F_status_set_fine(*status), "fll_fss_basic_list_read", main.file_data_build_fakefile.string, range, F_true);
f_fss_set_t settings = f_fss_set_t_initialize;
+ f_state_t state = macro_f_state_t_initialize(fake_common_allocation_large, fake_common_allocation_small, 0, &fake_signal_state_interrupt_fss, 0, (void *) &main, 0);
+
const f_string_static_t name_settings = macro_f_string_static_t_initialize(fake_make_section_settings, fake_make_section_settings_length);
const f_string_static_t name_main = macro_f_string_static_t_initialize(fake_make_section_main, fake_make_section_main_length);
delimits.used = 0;
content_range = list_contents.array[i].array[0];
- *status = fll_fss_extended_read(data_make->buffer, &content_range, &settings.objects, &settings.contents, 0, 0, &delimits, 0);
+ *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(main, F_status_set_fine(*status), "fll_fss_extended_read", main.file_data_build_fakefile.string, content_range, F_true);
delimits.used = 0;
content_range = list_contents.array[i].array[0];
- *status = fll_fss_extended_read(data_make->buffer, &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);
+ *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(main, F_status_set_fine(*status), "fll_fss_extended_read", main.file_data_build_fakefile.string, content_range, F_true);
{
f_string_t function_name = "macro_f_string_map_multis_t_resize";
- macro_f_string_map_multis_t_resize(*status, data_make->setting_make.parameter, f_memory_default_allocation_step);
+ macro_f_string_map_multis_t_resize(*status, data_make->setting_make.parameter, f_memory_default_allocation_small);
if (F_status_is_error_not(*status)) {
data_make->setting_make.parameter.used = 1;
if (k == data_make->setting_build.environment.used) {
if (data_make->setting_build.environment.used + 1 > data_make->setting_build.environment.size) {
- *status = f_string_dynamics_increase_by(f_memory_default_allocation_step, &data_make->setting_build.environment);
+ *status = f_string_dynamics_increase_by(f_memory_default_allocation_small, &data_make->setting_build.environment);
if (F_status_is_error(*status)) {
fll_error_print(main.error, F_status_set_fine(*status), "f_string_dynamics_increase_by", F_true);
if (main.context.mode != f_color_mode_none) {
if (data_make->parameter.color.used >= data_make->parameter.color.size) {
- *status = f_string_dynamics_increase_by(f_memory_default_allocation_step, &data_make->parameter.color);
+ *status = f_string_dynamics_increase_by(f_memory_default_allocation_small, &data_make->parameter.color);
if (F_status_is_error(*status)) {
fll_error_print(main.error, F_status_set_fine(*status), "f_string_dynamics_increase_by", F_true);
if (main.error.verbosity != f_console_verbosity_normal) {
if (data_make->parameter.verbosity.used >= data_make->parameter.verbosity.size) {
- *status = f_string_dynamics_increase_by(f_memory_default_allocation_step, &data_make->parameter.verbosity);
+ *status = f_string_dynamics_increase_by(f_memory_default_allocation_small, &data_make->parameter.verbosity);
if (F_status_is_error(*status)) {
fll_error_print(main.error, F_status_set_fine(*status), "f_string_dynamics_increase_by", F_true);
for (j = 0; j < source[i]->used; j++) {
if (destination[i]->used >= destination[i]->size) {
- *status = f_string_dynamics_increase_by(f_memory_default_allocation_step, destination[i]);
+ *status = f_string_dynamics_increase_by(f_memory_default_allocation_small, destination[i]);
if (F_status_is_error(*status)) {
fll_error_print(main.error, F_status_set_fine(*status), "f_string_dynamics_increase_by", F_true);
}
if (destination[i]->used >= destination[i]->size) {
- *status = f_string_dynamics_increase_by(f_memory_default_allocation_step, destination[i]);
+ *status = f_string_dynamics_increase_by(f_memory_default_allocation_small, destination[i]);
if (F_status_is_error(*status)) {
fll_error_print(main.error, F_status_set_fine(*status), "f_string_dynamics_increase_by", F_true);
for (uint8_t i = 0; i < 7; i ++) {
if (destination[i]->used >= destination[i]->size) {
- *status = f_string_dynamics_increase_by(f_memory_default_allocation_step, destination[i]);
+ *status = f_string_dynamics_increase_by(f_memory_default_allocation_small, destination[i]);
if (F_status_is_error(*status)) {
fll_error_print(main.error, F_status_set_fine(*status), "f_string_dynamics_increase_by", F_true);
}
if (destination[i]->used >= destination[i]->size) {
- *status = f_string_dynamics_increase_by(f_memory_default_allocation_step, destination[i]);
+ *status = f_string_dynamics_increase_by(f_memory_default_allocation_small, destination[i]);
if (F_status_is_error(*status)) {
fll_error_print(main.error, F_status_set_fine(*status), "f_string_dynamics_increase_by", F_true);
f_array_lengths_t section_stack = f_array_lengths_t_initialize;
fake_make_data_t data_make = fake_make_data_t_initialize;
- status = f_string_dynamics_increase(&data_make.path.stack);
+ status = f_string_dynamics_increase(f_memory_default_allocation_small, &data_make.path.stack);
if (F_status_is_error(status)) {
fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamics_increase", F_true);
#ifndef _di_fake_make_operate_expand_
void fake_make_operate_expand(const fake_main_t main, const f_string_range_t section_name, const f_array_length_t operation, const f_string_static_t operation_name, const f_fss_content_t content, const f_fss_quotes_t quotes, fake_make_data_t *data_make, f_string_dynamics_t *arguments, f_status_t *status) {
+
if (F_status_is_error(*status)) return;
if (!content.used) return;
f_iki_vocabulary_t iki_vocabulary = f_iki_vocabulary_t_initialize;
f_iki_content_t iki_content = f_iki_content_t_initialize;
+ f_state_t state = macro_f_state_t_initialize(fake_common_allocation_large, fake_common_allocation_small, 0, &fake_signal_state_interrupt_iki, 0, (void *) &main, 0);
+
f_string_range_t range = f_string_range_t_initialize;
f_string_map_multis_t *parameter = &data_make->setting_make.parameter;
f_array_length_t l = 0;
f_array_length_t used_arguments = 0;
-
f_array_length_t previous = 0;
const f_string_t reserved_name[] = {
used_arguments = arguments->used;
- *status = fl_iki_read(&data_make->buffer, &range, &iki_variable, &iki_vocabulary, &iki_content);
+ *status = fl_iki_read(state, &data_make->buffer, &range, &iki_variable, &iki_vocabulary, &iki_content);
if (F_status_is_error(*status)) {
fll_error_print(data_make->error, F_status_set_fine(*status), "fl_iki_read", F_true);
}
if (arguments->used >= arguments->size) {
- *status = f_string_dynamics_increase_by(f_memory_default_allocation_step, arguments);
+ *status = f_string_dynamics_increase_by(f_memory_default_allocation_small, arguments);
if (F_status_is_error(*status)) {
fll_error_print(data_make->error, F_status_set_fine(*status), "f_string_dynamics_increase_by", F_true);
}
for (j = 0, previous = iki_variable.array[0].start; j < iki_variable.used; j++) {
+
parameter_is = F_false;
define_is = F_false;
if (fl_string_dynamic_partial_compare_string(reserved_name[k], data_make->buffer, reserved_length[k], iki_content.array[j]) == F_equal_to) {
if (arguments->used >= arguments->size) {
- *status = f_string_dynamics_increase_by(f_memory_default_allocation_step, arguments);
+ *status = f_string_dynamics_increase_by(f_memory_default_allocation_small, arguments);
if (F_status_is_error(*status)) {
fll_error_print(data_make->error, F_status_set_fine(*status), "f_string_dynamics_increase_by", F_true);
}
else {
if (arguments->used >= arguments->size) {
- *status = f_string_dynamics_increase_by(f_memory_default_allocation_step, arguments);
+ *status = f_string_dynamics_increase_by(f_memory_default_allocation_small, arguments);
if (F_status_is_error(*status)) {
fll_error_print(data_make->error, F_status_set_fine(*status), "f_string_dynamics_increase_by", F_true);
status = f_string_dynamic_append_nulless(value, &arguments->array[arguments->used]);
}
else {
- status = f_string_dynamics_increase_by(f_memory_default_allocation_step, arguments);
+ status = f_string_dynamics_increase_by(f_memory_default_allocation_small, arguments);
if (F_status_is_error_not(status)) {
status = f_string_dynamic_append_nulless(value, &arguments->array[arguments->used]);
status = f_string_dynamic_append_nulless(value, &arguments->array[arguments->used]);
}
else {
- status = f_string_dynamics_increase_by(f_memory_default_allocation_step, arguments);
+ status = f_string_dynamics_increase_by(f_memory_default_allocation_small, arguments);
if (F_status_is_error_not(status)) {
status = f_string_dynamic_append_nulless(value, &arguments->array[arguments->used]);
// add the operation id to the operation stack.
if (section_stack->used + 1 > section_stack->size) {
- macro_f_array_lengths_t_increase_by((*status), (*section_stack), f_memory_default_allocation_step);
+ macro_f_array_lengths_t_increase_by((*status), (*section_stack), f_memory_default_allocation_small);
if (F_status_is_error(*status)) {
fll_error_print(data_make->error, F_status_set_fine(*status), "macro_f_array_lengths_t_increase_by", F_true);
}
else {
if (data_make->path.stack.used == data_make->path.stack.size) {
- *status = f_string_dynamics_increase_by(f_memory_default_allocation_step, &data_make->path.stack);
+ *status = f_string_dynamics_increase_by(f_memory_default_allocation_small, &data_make->path.stack);
if (F_status_set_fine(*status) == F_array_too_large) {
fake_print_message_section_operation_path_stack_max(*main, data_make->error, F_array_too_large, "f_string_dynamics_increase_by", "path stack");
f_string_range_t input = f_string_range_t_initialize;
if (command == firewall_parameter_command_show) {
+
// Warning: these are hardcoded print commands (I am not certain how I am going to implement external 'show' rules as the default-firewall setting file is the wrong place to put this)
bool show_nat = F_true;
bool show_mangle = F_true;
if (F_status_is_error(status)) {
f_color_print(main->error.to.stream, main->context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol_s[0]);
+
firewall_delete_local_data(&local);
firewall_main_delete(main);
return status;
#endif // _di_firewall_paths_
#ifndef _di_firewall_default_allocation_step_
- #define firewall_default_allocation_step f_memory_default_allocation_step
+ #define firewall_default_allocation_step f_memory_default_allocation_small
#endif // _di_firewall_default_allocation_step_
#ifndef _di_firewall_defines_
// first add the program name
f_string_dynamics_resize(0, &arguments);
- status = f_string_dynamics_increase(&arguments);
+ status = f_string_dynamics_increase(f_memory_default_allocation_small, &arguments);
if (F_status_is_error(status)) break;
if (tool == firewall_program_ip46tables) {
f_fss_delimits_t delimits = f_fss_delimits_t_initialize;
{
+ f_state_t state = f_state_t_initialize;
f_string_range_t input = macro_f_string_range_t_initialize(local_buffer.used);
- status = fll_fss_basic_read(local_buffer, &input, &basic_objects, &basic_contents, 0, &delimits, 0);
+ status = fll_fss_basic_read(local_buffer, state, &input, &basic_objects, &basic_contents, 0, &delimits, 0);
}
if (F_status_set_error(status)) {
arguments.array[0].used = firewall_chain_create_command_length;
- status = f_string_dynamic_increase(&arguments.array[1]);
+ status = f_string_dynamic_increase(f_memory_default_allocation_small, &arguments.array[1]);
if (F_status_is_error(status)) {
arguments.used = 1;
f_fss_comments_t comments = f_fss_comments_t_initialize;
{
+ f_state_t state = f_state_t_initialize;
f_string_range_t input = macro_f_string_range_t_initialize(local->buffer.used);
- status = fll_fss_basic_list_read(local->buffer, &input, &local->chain_objects, &local->chain_contents, &delimits, 0, &comments);
+ status = fll_fss_basic_list_read(local->buffer, state, &input, &local->chain_objects, &local->chain_contents, &delimits, 0, &comments);
}
if (F_status_is_error(status)) {
}
f_status_t firewall_process_rules(f_string_range_t *range, firewall_local_data_t *local, firewall_main_t *main) {
+
+ f_status_t status = F_none;
f_fss_delimits_t delimits = f_fss_delimits_t_initialize;
- f_status_t status = fll_fss_extended_read(local->buffer, range, &local->rule_objects, &local->rule_contents, 0, 0, &delimits, 0);
+ {
+ f_state_t state = f_state_t_initialize;
+
+ status = fll_fss_extended_read(local->buffer, state, range, &local->rule_objects, &local->rule_contents, 0, 0, &delimits, 0);
+ }
if (F_status_is_error_not(status)) {
status = fl_fss_apply_delimit(delimits, &local->buffer);
#endif
/**
+ * Provide common/generic definitions.
+ *
+ * basic_list_read_common_allocation_*:
+ * - large: An allocation step used for buffers that are anticipated to have large buffers.
+ * - small: An allocation step used for buffers that are anticipated to have small buffers.
+ */
+#ifndef _di_fss_basic_list_read_common_
+ #define fss_basic_list_read_common_allocation_large 256
+ #define fss_basic_list_read_common_allocation_small 16
+#endif // _di_fss_basic_list_read_common_
+
+/**
* A structure of parameters applied at some depth.
*
* depth: The depth number in which this is to be processed at.
#ifndef _di_fss_basic_list_read_load_
f_status_t fss_basic_list_read_load(fss_basic_list_read_main_t * const main, fss_basic_list_read_data_t *data) {
+ f_state_t state = macro_f_state_t_initialize(fss_basic_list_read_common_allocation_large, fss_basic_list_read_common_allocation_small, 0, 0, 0, 0, 0);
f_string_range_t input = macro_f_string_range_t_initialize(data->buffer.used);
data->delimits_object.used = 0;
data->delimits_content.used = 0;
- const f_status_t status = fll_fss_basic_list_read(data->buffer, &input, &data->objects, &data->contents, &data->delimits_object, &data->delimits_content, &data->comments);
+ const f_status_t status = fll_fss_basic_list_read(data->buffer, state, &input, &data->objects, &data->contents, &data->delimits_object, &data->delimits_content, &data->comments);
if (F_status_is_error(status)) {
const f_string_t file_name = fss_basic_list_read_file_identify(input.start, data->files);
extern "C" {
#endif
+/**
+ * Provide common/generic definitions.
+ *
+ * basic_list_write_common_allocation_*:
+ * - large: An allocation step used for buffers that are anticipated to have large buffers.
+ * - small: An allocation step used for buffers that are anticipated to have small buffers.
+ */
+#ifndef _di_fss_basic_list_write_common_
+ #define fss_basic_list_write_common_allocation_large 256
+ #define fss_basic_list_write_common_allocation_small 16
+#endif // _di_fss_basic_list_write_common_
+
#ifdef __cplusplus
} // extern "C"
#endif
#ifndef _di_fss_basic_list_write_process_
f_status_t fss_basic_list_write_process(const fss_basic_list_write_main_t main, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, f_string_dynamic_t *buffer) {
- f_status_t status = F_none;
+ f_status_t status = F_none;
+ f_state_t state = macro_f_state_t_initialize(fss_basic_list_write_common_allocation_large, fss_basic_list_write_common_allocation_small, 0, 0, 0, 0, 0);
f_string_range_t range = f_string_range_t_initialize;
if (object) {
}
}
- status = fl_fss_basic_list_object_write_string(*object, complete, &range, buffer);
+ status = fl_fss_basic_list_object_write_string(*object, complete, state, &range, buffer);
if (F_status_set_fine(status) == F_none_eol) {
fss_basic_list_write_error_parameter_unsupported_eol_print(main);
if (F_status_is_error(status)) {
fll_error_print(main.error, F_status_set_fine(status), "fl_fss_basic_list_object_write_string", F_true);
+
return status;
}
}
range.start = 0;
range.stop = content->used - 1;
- status = fl_fss_basic_list_content_write_string(*content, object ? f_fss_complete_full : f_fss_complete_none, &main.prepend, &range, buffer);
+ status = fl_fss_basic_list_content_write_string(*content, object ? f_fss_complete_full : f_fss_complete_none, &main.prepend, state, &range, buffer);
if (F_status_is_error(status)) {
fll_error_print(main.error, F_status_set_fine(status), "fl_fss_basic_list_content_write_string", F_true);
+
return status;
}
}
if (F_status_is_error(status)) {
fll_error_print(main.error, F_status_set_fine(status), "f_string_append", F_true);
+
return status;
}
}
#ifndef _di_fss_basic_list_write_process_pipe_
f_status_t fss_basic_list_write_process_pipe(const fss_basic_list_write_main_t main, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer) {
+
f_status_t status = F_none;
f_status_t status_pipe = F_none;
}
}
- for (; range.start <= range.stop; range.start++) {
+ for (; range.start <= range.stop; ++range.start) {
if (block.string[range.start] == fss_basic_list_write_pipe_content_start) {
state = 0x2;
- range.start++;
+ ++range.start;
break;
}
if (block.string[range.start] == fss_basic_list_write_pipe_content_end) {
state = 0x3;
- range.start++;
+ ++range.start;
break;
}
}
}
- for (; range.start <= range.stop; range.start++) {
+ for (; range.start <= range.stop; ++range.start) {
if (block.string[range.start] == fss_basic_list_write_pipe_content_start) {
if (main.error.verbosity != f_console_verbosity_quiet) {
if (block.string[range.start] == fss_basic_list_write_pipe_content_end) {
state = 0x3;
- range.start++;
+ ++range.start;
break;
}
#endif
/**
+ * Provide common/generic definitions.
+ *
+ * basic_read_common_allocation_*:
+ * - large: An allocation step used for buffers that are anticipated to have large buffers.
+ * - small: An allocation step used for buffers that are anticipated to have small buffers.
+ */
+#ifndef _di_fss_basic_read_common_
+ #define fss_basic_read_common_allocation_large 256
+ #define fss_basic_read_common_allocation_small 16
+#endif // _di_fss_basic_read_common_
+
+/**
* A structure of parameters applied at some depth.
*
* depth: The depth number in which this is to be processed at.
#ifndef _di_fss_basic_read_load_
f_status_t fss_basic_read_load(fss_basic_read_main_t * const main, fss_basic_read_data_t *data) {
+ f_state_t state = macro_f_state_t_initialize(fss_basic_read_common_allocation_large, fss_basic_read_common_allocation_small, 0, 0, 0, 0, 0);
f_string_range_t input = macro_f_string_range_t_initialize(data->buffer.used);
data->delimits.used = 0;
- const f_status_t status = fll_fss_basic_read(data->buffer, &input, &data->objects, &data->contents, 0, &data->delimits, 0);
+ const f_status_t status = fll_fss_basic_read(data->buffer, state, &input, &data->objects, &data->contents, 0, &data->delimits, 0);
if (F_status_is_error(status)) {
const f_string_t file_name = fss_basic_read_file_identify(input.start, data->files);
extern "C" {
#endif
+/**
+ * Provide common/generic definitions.
+ *
+ * basic_write_common_allocation_*:
+ * - large: An allocation step used for buffers that are anticipated to have large buffers.
+ * - small: An allocation step used for buffers that are anticipated to have small buffers.
+ */
+#ifndef _di_fss_basic_write_common_
+ #define fss_basic_write_common_allocation_large 256
+ #define fss_basic_write_common_allocation_small 16
+#endif // _di_fss_basic_write_common_
+
#ifdef __cplusplus
} // extern "C"
#endif
#ifndef _di_fss_basic_write_process_
f_status_t fss_basic_write_process(const fss_basic_write_main_t main, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, f_string_dynamic_t *buffer) {
- f_status_t status = F_none;
+ f_status_t status = F_none;
+ f_state_t state = macro_f_state_t_initialize(fss_basic_write_common_allocation_large, fss_basic_write_common_allocation_small, 0, 0, 0, 0, 0);
f_string_range_t range = f_string_range_t_initialize;
if (object) {
}
}
- status = fl_fss_basic_object_write_string(*object, quote, complete, &range, buffer);
+ status = fl_fss_basic_object_write_string(*object, quote, complete, state, &range, buffer);
if (F_status_set_fine(status) == F_none_eol) {
fss_basic_write_error_parameter_unsupported_eol_print(main);
if (F_status_is_error(status)) {
fll_error_print(main.error, F_status_set_fine(status), "fl_fss_basic_object_write_string", F_true);
+
return status;
}
}
range.stop = 0;
}
- status = fl_fss_basic_content_write_string(*content, object ? f_fss_complete_full : f_fss_complete_none, &range, buffer);
+ status = fl_fss_basic_content_write_string(*content, object ? f_fss_complete_full : f_fss_complete_none, state, &range, buffer);
if (F_status_set_fine(status) == F_none_eol) {
fss_basic_write_error_parameter_unsupported_eol_print(main);
if (F_status_is_error(status)) {
fll_error_print(main.error, F_status_set_fine(status), "fl_fss_basic_content_write_string", F_true);
+
return status;
}
}
if (F_status_is_error(status)) {
fll_error_print(main.error, F_status_set_fine(status), "f_string_append", F_true);
+
return status;
}
}
#ifndef _di_fss_basic_write_process_pipe_
f_status_t fss_basic_write_process_pipe(const fss_basic_write_main_t main, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer) {
+
f_status_t status = F_none;
f_status_t status_pipe = F_none;
if (block.string[range.start] == fss_basic_write_pipe_content_start) {
state = 0x2;
- range.start++;
+ ++range.start;
break;
}
if (block.string[range.start] == fss_basic_write_pipe_content_end) {
state = 0x3;
- range.start++;
+ ++range.start;
break;
}
}
}
- for (; range.start <= range.stop; range.start++) {
+ for (; range.start <= range.stop; ++range.start) {
if (block.string[range.start] == fss_basic_write_pipe_content_start) {
if (main.error.verbosity != f_console_verbosity_quiet) {
if (block.string[range.start] == fss_basic_write_pipe_content_end) {
state = 0x3;
- range.start++;
+ ++range.start;
break;
}
fprintf(output.stream, "%c", f_string_eol_s[0]);
- fll_program_print_help_option(output, context, fss_embedded_list_read_short_at, fss_embedded_list_read_long_at, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select object at this numeric index.");
- fll_program_print_help_option(output, context, fss_embedded_list_read_short_content, fss_embedded_list_read_long_content, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the content (default).");
+ fll_program_print_help_option(output, context, fss_embedded_list_read_short_at, fss_embedded_list_read_long_at, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select Object at this numeric index.");
+ fll_program_print_help_option(output, context, fss_embedded_list_read_short_content, fss_embedded_list_read_long_content, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the Content (default).");
+ fll_program_print_help_option(output, context, fss_embedded_list_read_short_columns, fss_embedded_list_read_long_columns, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the total number of columns.");
fll_program_print_help_option(output, context, fss_embedded_list_read_short_delimit, fss_embedded_list_read_long_delimit, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Designate how to handle applying delimits.");
- fll_program_print_help_option(output, context, fss_embedded_list_read_short_depth, fss_embedded_list_read_long_depth, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select object at this numeric depth.");
- fll_program_print_help_option(output, context, fss_embedded_list_read_short_empty, fss_embedded_list_read_long_empty, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Include empty content when processing.");
- fll_program_print_help_option(output, context, fss_embedded_list_read_short_line, fss_embedded_list_read_long_line, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print only the content at the given line.");
- fll_program_print_help_option(output, context, fss_embedded_list_read_short_name, fss_embedded_list_read_long_name, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select object with this name.");
- fll_program_print_help_option(output, context, fss_embedded_list_read_short_object, fss_embedded_list_read_long_object, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the object.");
+ fll_program_print_help_option(output, context, fss_embedded_list_read_short_depth, fss_embedded_list_read_long_depth, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select Object at this numeric depth.");
+ fll_program_print_help_option(output, context, fss_embedded_list_read_short_empty, fss_embedded_list_read_long_empty, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Include empty Content when processing.");
+ fll_program_print_help_option(output, context, fss_embedded_list_read_short_line, fss_embedded_list_read_long_line, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print only the Content at the given line.");
+ fll_program_print_help_option(output, context, fss_embedded_list_read_short_name, fss_embedded_list_read_long_name, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select Object with this name.");
+ fll_program_print_help_option(output, context, fss_embedded_list_read_short_object, fss_embedded_list_read_long_object, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the Object.");
fll_program_print_help_option(output, context, fss_embedded_list_read_short_pipe, fss_embedded_list_read_long_pipe, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print using the special pipe format.");
- fll_program_print_help_option(output, context, fss_embedded_list_read_short_select, fss_embedded_list_read_long_select, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select sub-content at this index.");
+ fll_program_print_help_option(output, context, fss_embedded_list_read_short_select, fss_embedded_list_read_long_select, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select sub-Content at this index.");
fll_program_print_help_option(output, context, fss_embedded_list_read_short_total, fss_embedded_list_read_long_total, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the total number of lines.");
- fll_program_print_help_option(output, context, fss_embedded_list_read_short_trim, fss_embedded_list_read_long_trim, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Trim object names on select or print.");
+ fll_program_print_help_option(output, context, fss_embedded_list_read_short_trim, fss_embedded_list_read_long_trim, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Trim Object names on select or print.");
fll_program_print_help_usage(output, context, fss_embedded_list_read_name, "filename(s)");
fprintf(output.stream, "%c", f_string_eol_s[0]);
- fprintf(output.stream, " This program will print the content associated with the given object and content main based on the FSS-0002 Basic List standard.%c", f_string_eol_s[0]);
+ fprintf(output.stream, " This program will print the Content associated with the given Object and Content main based on the FSS-0002 Basic List standard.%c", f_string_eol_s[0]);
+
+ fprintf(output.stream, "%c", f_string_eol_s[0]);
+
+ fprintf(output.stream, " All numeric positions (indexes) start at 0 instead of 1.%c", f_string_eol_s[0]);
+ fprintf(output.stream, " For example, a file of 17 lines would range from 0 to 16.%c", f_string_eol_s[0]);
fprintf(output.stream, "%c", f_string_eol_s[0]);
fprintf(output.stream, " ");
f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_at);
- fprintf(output.stream, ": An object index at the specified depth.%c", f_string_eol_s[0]);
+ fprintf(output.stream, ": An Object index at the specified depth.%c", f_string_eol_s[0]);
fprintf(output.stream, " ");
f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_depth);
fprintf(output.stream, " ");
f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_name);
- fprintf(output.stream, ": An object name at the specified depth.%c", f_string_eol_s[0]);
+ fprintf(output.stream, ": An Object name at the specified depth.%c", f_string_eol_s[0]);
fprintf(output.stream, "%c", f_string_eol_s[0]);
fprintf(output.stream, " The parameter ");
f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_select);
- fprintf(output.stream, " selects a content index at a given depth.%c", f_string_eol_s[0]);
- fprintf(output.stream, " (This parameter is not synonymous with the depth parameter and does not relate to nested content).%c", f_string_eol_s[0]);
+ fprintf(output.stream, " selects a Content column.%c", f_string_eol_s[0]);
fprintf(output.stream, "%c", f_string_eol_s[0]);
fprintf(output.stream, " For parameters like ");
f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_depth);
- fprintf(output.stream, ", if the standard doesn't support nested content, then only a depth of 0 would be valid.%c", f_string_eol_s[0]);
+ fprintf(output.stream, ", if the standard doesn't support nested Content, then only a depth of 0 would be valid.%c", f_string_eol_s[0]);
fprintf(output.stream, " For parameters like ");
f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_select);
- fprintf(output.stream, ", if the standard doesn't support multiple content groups, then only a select of 0 would be valid.%c", f_string_eol_s[0]);
+ fprintf(output.stream, ", if the standard doesn't support multiple Content groups, then only a select of 0 would be valid.%c", f_string_eol_s[0]);
fprintf(output.stream, "%c", f_string_eol_s[0]);
f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_object);
fprintf(output.stream, " parameter and the ");
f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_content);
- fprintf(output.stream, " parameter, the entire object and content are printed, including the formatting.%c", f_string_eol_s[0]);
- fprintf(output.stream, " Both the object and content printed are already escaped.%c", f_string_eol_s[0]);
- fprintf(output.stream, " Both the object and content are separated by an EOL.%c", f_string_eol_s[0]);
+ fprintf(output.stream, " parameter, the entire Object and Content are printed, including the formatting.%c", f_string_eol_s[0]);
+ fprintf(output.stream, " Both the Object and Content printed are already escaped.%c", f_string_eol_s[0]);
+ fprintf(output.stream, " Both the Object and Content are separated by an EOL.%c", f_string_eol_s[0]);
fprintf(output.stream, "%c", f_string_eol_s[0]);
fprintf(output.stream, ": Do not apply delimits.%c", f_string_eol_s[0]);
fprintf(output.stream, " - ");
f_color_print(output.stream, context.set.notable, "%s", fss_embedded_list_read_delimit_mode_name_all);
- fprintf(output.stream, ": (default) apply all delimits.%c", f_string_eol_s[0]);
- fprintf(output.stream, " - a number, 0 or greater: apply delimits for the specified depth.%c", f_string_eol_s[0]);
- fprintf(output.stream, " - a number, 0 or greater, followed by a ");
+ fprintf(output.stream, ": (default) Apply all delimits.%c", f_string_eol_s[0]);
+ // @todo
+ //fprintf(output.stream, " - ");
+ //f_color_print(output.stream, context.set.notable, "%s", fss_embedded_list_read_delimit_mode_name_object);
+ //fprintf(output.stream, ": Apply delimits for Objects.%c", f_string_eol_s[0]);
+ //fprintf(output.stream, " - A number, 0 or greater: apply delimits for Content at the specified depth.%c", f_string_eol_s[0]);
+ //fprintf(output.stream, " - A number, 0 or greater, followed by a ");
f_color_print(output.stream, context.set.notable, "%s", fss_embedded_list_read_delimit_mode_name_greater);
- fprintf(output.stream, ": (such as '1+') apply delimits for the specified depth and any greater depth (numerically).%c", f_string_eol_s[0]);
- fprintf(output.stream, " - a number, 0 or greater, followed by a ");
+ fprintf(output.stream, ": (such as '1+') apply delimits for Content at the specified depth and any greater depth (numerically).%c", f_string_eol_s[0]);
+ fprintf(output.stream, " - A number, 0 or greater, followed by a ");
f_color_print(output.stream, context.set.notable, "%s", fss_embedded_list_read_delimit_mode_name_lesser);
- fprintf(output.stream, ": (such as '1-') apply delimits for the specified depth and any lesser depth (numerically).%c", f_string_eol_s[0]);
+ fprintf(output.stream, ": (such as '1-') apply delimits for Content at the specified depth and any lesser depth (numerically).%c", f_string_eol_s[0]);
+
+ fprintf(output.stream, "%c", f_string_eol_s[0]);
+
+ fprintf(output.stream, " The ");
+ f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_delimit);
+ fprintf(output.stream, " parameter may be specified multiple times to customize the delimit behavior.%c", f_string_eol_s[0]);
+
+ fprintf(output.stream, " The ");
+ f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_delimit);
+ fprintf(output.stream, " values ");
+ f_color_print(output.stream, context.set.notable, "%s", fss_embedded_list_read_delimit_mode_name_none);
+ fprintf(output.stream, " and ");
+ f_color_print(output.stream, context.set.notable, "%s", fss_embedded_list_read_delimit_mode_name_all);
+ fprintf(output.stream, ", overrule all other delimit values.%c", f_string_eol_s[0]);
+
+ fprintf(output.stream, "%c", f_string_eol_s[0]);
+
+ fprintf(output.stream, " The parameters ");
+ f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_columns);
+ fprintf(output.stream, " and ");
+ f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_select);
+ fprintf(output.stream, " refer to a Content column.%c", f_string_eol_s[0]);
+ fprintf(output.stream, " The word \"column\" is being loosely defined to refer to a specific Content.%c", f_string_eol_s[0]);
+ fprintf(output.stream, " This is not to be confused with a depth.%c", f_string_eol_s[0]);
fprintf(output.stream, "%c", f_string_eol_s[0]);
return F_none;
}
+ if (F_status_is_error_not(status) && main->parameters[fss_embedded_list_read_parameter_total].result == f_console_result_found) {
+ if (main->parameters[fss_embedded_list_read_parameter_columns].result == f_console_result_found) {
+ f_color_print(main->error.to.stream, main->context.set.error, "%sCannot specify the '", fll_error_print_error);
+ f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_total);
+ f_color_print(main->error.to.stream, main->context.set.error, "' parameter with the '");
+ f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_columns);
+ f_color_print(main->error.to.stream, main->context.set.error, "' parameter.%c", f_string_eol_s[0]);
+
+ status = F_status_set_error(F_parameter);
+ }
+ }
+
if (main->remaining.used > 0 || main->process_pipe) {
if (main->parameters[fss_embedded_list_read_parameter_at].result == f_console_result_found) {
f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error);
status = F_status_set_error(F_parameter);
}
- if (F_status_is_error_not(status) && main->parameters[fss_embedded_list_read_parameter_line].result == f_console_result_found) {
+ if (F_status_is_error_not(status) && main->parameters[fss_embedded_list_read_parameter_line].result == f_console_result_additional) {
f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error);
f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_line);
f_color_print(main->error.to.stream, main->context.set.error, "' requires a positive number.%c", f_string_eol_s[0]);
#define fss_embedded_list_read_short_at "a"
#define fss_embedded_list_read_short_content "c"
+ #define fss_embedded_list_read_short_columns "C"
#define fss_embedded_list_read_short_delimit "D"
#define fss_embedded_list_read_short_depth "d"
#define fss_embedded_list_read_short_empty "e"
#define fss_embedded_list_read_long_at "at"
#define fss_embedded_list_read_long_content "content"
+ #define fss_embedded_list_read_long_columns "columns"
#define fss_embedded_list_read_long_delimit "delimit"
#define fss_embedded_list_read_long_depth "depth"
#define fss_embedded_list_read_long_empty "empty"
fss_embedded_list_read_parameter_at,
fss_embedded_list_read_parameter_content,
+ fss_embedded_list_read_parameter_columns,
fss_embedded_list_read_parameter_delimit,
fss_embedded_list_read_parameter_depth,
fss_embedded_list_read_parameter_empty,
f_console_parameter_t_initialize(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, 0, f_console_type_inverse), \
f_console_parameter_t_initialize(fss_embedded_list_read_short_at, fss_embedded_list_read_long_at, 0, 1, f_console_type_normal), \
f_console_parameter_t_initialize(fss_embedded_list_read_short_content, fss_embedded_list_read_long_content, 0, 0, f_console_type_normal), \
+ f_console_parameter_t_initialize(fss_embedded_list_read_short_columns, fss_embedded_list_read_long_columns, 0, 0, f_console_type_normal), \
f_console_parameter_t_initialize(fss_embedded_list_read_short_delimit, fss_embedded_list_read_long_delimit, 0, 1, f_console_type_normal), \
f_console_parameter_t_initialize(fss_embedded_list_read_short_depth, fss_embedded_list_read_long_depth, 0, 1, f_console_type_normal), \
f_console_parameter_t_initialize(fss_embedded_list_read_short_empty, fss_embedded_list_read_long_empty, 0, 0, f_console_type_normal), \
f_console_parameter_t_initialize(fss_embedded_list_read_short_trim, fss_embedded_list_read_long_trim, 0, 0, f_console_type_normal), \
}
- #define fss_embedded_list_read_total_parameters 21
+ #define fss_embedded_list_read_total_parameters 22
#endif // _di_fss_embedded_list_read_defines_
#ifndef _di_fss_embedded_list_read_delimit_mode_
#endif
/**
+ * Provide common/generic definitions.
+ *
+ * embedded_list_read_common_allocation_*:
+ * - large: An allocation step used for buffers that are anticipated to have large buffers.
+ * - small: An allocation step used for buffers that are anticipated to have small buffers.
+ */
+#ifndef _di_fss_embedded_list_read_common_
+ #define fss_embedded_list_read_common_allocation_large 256
+ #define fss_embedded_list_read_common_allocation_small 16
+#endif // _di_fss_embedded_list_read_common_
+
+/**
* A structure of parameters applied at some depth.
*
* depth: the depth number in which this is to be processed at.
#ifndef _di_fss_embedded_list_read_main_process_file_
f_status_t fss_embedded_list_read_main_process_file(const f_console_arguments_t arguments, fss_embedded_list_read_main_t *main, const f_string_t filename, const fss_embedded_list_read_depths_t depths, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits, f_fss_comments_t *comments) {
+
f_status_t status = F_none;
{
+ f_state_t state = macro_f_state_t_initialize(fss_embedded_list_read_common_allocation_large, fss_embedded_list_read_common_allocation_small, 0, 0, 0, 0, 0);
f_string_range_t input = macro_f_string_range_t_initialize(main->buffer.used);
objects_delimits->used = 0;
contents_delimits->used = 0;
comments->used = 0;
- status = fll_fss_embedded_list_read(main->buffer, &input, &main->nest, objects_delimits, contents_delimits, comments);
+ status = fll_fss_embedded_list_read(main->buffer, state, &input, &main->nest, objects_delimits, contents_delimits, comments);
if (F_status_is_error(status)) {
// @todo: detect and replace fll_error_file_type_file with fll_error_file_type_pipe as appropriate.
* @param arguments
* The console arguments to pre-process.
* @param main
- * The program specific main.
+ * The main data.
* @param depths
* This stores the pre-processed depth parameters.
*
* @param arguments
* The console arguments passed to the program.
* @param main
- * The program specific main.
+ * The main data.
* @param file_name
* The name of the file being processed.
* @param depths
* The skip status of any parent lists.
* Set parents.length to 0 for depth 0.
* @param main
- * The program specific main.
+ * The main data.
* @param objects_delimits
* An array of delimits detected during processing, for top-level objects.
* @param contents_delimits
* Print the end of an content.
*
* @param main
- * The program specific main.
+ * The main data.
*/
#ifndef _di_fss_embedded_list_read_print_content_end_
extern void fss_embedded_list_read_print_content_end(const fss_embedded_list_read_main_t main) f_attribute_visibility_internal;
* This is only used in pipe output mode.
*
* @param main
- * The program specific main.
+ * The main data.
*/
#ifndef _di_fss_embedded_list_read_print_content_ignore_
extern void fss_embedded_list_read_print_content_ignore(const fss_embedded_list_read_main_t main) f_attribute_visibility_internal;
* Print the end of an object (which is essentially the start of a content).
*
* @param main
- * The program specific main.
+ * The main data.
*/
#ifndef _di_fss_embedded_list_read_print_object_end_
extern void fss_embedded_list_read_print_object_end(const fss_embedded_list_read_main_t main) f_attribute_visibility_internal;
* Print the end of an object/content set.
*
* @param main
- * The program specific main.
+ * The main data.
*/
#ifndef _di_fss_embedded_list_read_print_set_end_
extern void fss_embedded_list_read_print_set_end(const fss_embedded_list_read_main_t main) f_attribute_visibility_internal;
* Rewrite the object and content delimit ranges to be within the given depth range.
*
* @param main
- * The program specific main.
+ * The main data.
* @param objects_delimits
* An array of delimits detected during processing, for top-level objects.
* @param contents_delimits
* Write the given delimits at the given depth back into the new delimits array, specifically for contents.
*
* @param main
- * The program specific main.
+ * The main data.
* @param depth
* The depth in which to process.
* @param original_delimits
* Write the given delimits at the given depth back into the new delimits array, specifically for objects.
*
* @param main
- * The program specific main.
+ * The main data.
* @param depth
* The depth in which to process.
* @param original_delimits
* Determine if the given location is actually within another depth.
*
* @param main
- * The program specific main.
+ * The main data.
* @param depth
* The depth in which to process.
* @param location
extern "C" {
#endif
+
+/**
+ * Provide common/generic definitions.
+ *
+ * embedded_list_write_common_allocation_*:
+ * - large: An allocation step used for buffers that are anticipated to have large buffers.
+ * - small: An allocation step used for buffers that are anticipated to have small buffers.
+ */
+#ifndef _di_fss_embedded_list_write_common_
+ #define fss_embedded_list_write_common_allocation_large 256
+ #define fss_embedded_list_write_common_allocation_small 16
+#endif // _di_fss_embedded_list_write_common_
+
#ifdef __cplusplus
} // extern "C"
#endif
#ifndef _di_fss_embedded_list_write_process_
f_status_t fss_embedded_list_write_process(const fss_embedded_list_write_main_t main, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, const f_string_ranges_t *ignore, f_string_dynamic_t *buffer) {
- f_status_t status = F_none;
+ f_status_t status = F_none;
+ f_state_t state = macro_f_state_t_initialize(fss_embedded_list_write_common_allocation_large, fss_embedded_list_write_common_allocation_small, 0, 0, 0, 0, 0);
f_string_range_t range = f_string_range_t_initialize;
if (object) {
}
}
- status = fl_fss_embedded_list_object_write_string(*object, complete, &range, buffer);
+ status = fl_fss_embedded_list_object_write_string(*object, complete, state, &range, buffer);
if (F_status_set_fine(status) == F_none_eol) {
fss_embedded_list_write_error_parameter_unsupported_eol_print(main);
if (F_status_is_error(status)) {
fll_error_print(main.error, F_status_set_fine(status), "fl_fss_embedded_list_object_write_string", F_true);
+
return status;
}
}
range.start = 0;
range.stop = content->used - 1;
- status = fl_fss_embedded_list_content_write_string(*content, object ? f_fss_complete_full : f_fss_complete_none, &main.prepend, ignore, &range, buffer);
+ status = fl_fss_embedded_list_content_write_string(*content, object ? f_fss_complete_full : f_fss_complete_none, &main.prepend, ignore, state, &range, buffer);
if (F_status_is_error(status)) {
fll_error_print(main.error, F_status_set_fine(status), "fl_fss_embedded_list_content_write_string", F_true);
+
return status;
}
}
if (F_status_is_error(status)) {
fll_error_print(main.error, F_status_set_fine(status), "f_string_append", F_true);
+
return status;
}
}
#ifndef _di_fss_embedded_list_write_process_pipe_
f_status_t fss_embedded_list_write_process_pipe(const fss_embedded_list_write_main_t main, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer, f_string_ranges_t *ignore) {
+
f_status_t status = F_none;
f_status_t status_pipe = F_none;
}
}
- for (; range.start <= range.stop; range.start++) {
+ for (; range.start <= range.stop; ++range.start) {
if (block.string[range.start] == fss_embedded_list_write_pipe_content_start) {
state = 0x2;
- range.start++;
+ ++range.start;
break;
}
if (block.string[range.start] == fss_embedded_list_write_pipe_content_end) {
state = 0x3;
- range.start++;
+ ++range.start;
break;
}
}
}
- for (; range.start <= range.stop; range.start++) {
+ for (; range.start <= range.stop; ++range.start) {
if (block.string[range.start] == fss_embedded_list_write_pipe_content_start) {
if (main.error.verbosity != f_console_verbosity_quiet) {
#ifndef _di_fss_embedded_list_write_process_parameter_ignore_
f_status_t fss_embedded_list_write_process_parameter_ignore(const f_console_arguments_t arguments, const fss_embedded_list_write_main_t main, const f_array_lengths_t contents, const f_array_length_t location, f_string_ranges_t *ignore) {
+
f_status_t status = F_none;
f_array_length_t i = 0;
range.start = 0;
- for (; i < main.parameters[fss_embedded_list_write_parameter_ignore].locations.used; i++) {
+ for (; i < main.parameters[fss_embedded_list_write_parameter_ignore].locations.used; ++i) {
l = main.parameters[fss_embedded_list_write_parameter_ignore].locations.array[i];
if (F_status_is_error(status)) {
fll_error_print(main.error, F_status_set_fine(status), "fss_embedded_list_write_process_parameter_ignore", F_true);
+
return status;
}
}
if (F_status_is_error(status)) {
fll_error_parameter_integer_print(main.error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_embedded_list_write_long_ignore, arguments.argv[index]);
+
return status;
}
if (F_status_is_error(status)) {
fll_error_parameter_integer_print(main.error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_embedded_list_write_long_ignore, arguments.argv[index]);
+
return status;
}
extern "C" {
#endif
+
+/**
+ * Provide common/generic definitions.
+ *
+ * extended_list_read_common_allocation_*:
+ * - large: An allocation step used for buffers that are anticipated to have large buffers.
+ * - small: An allocation step used for buffers that are anticipated to have small buffers.
+ */
+#ifndef _di_fss_extended_list_read_common_
+ #define fss_extended_list_read_common_allocation_large 256
+ #define fss_extended_list_read_common_allocation_small 16
+#endif // _di_fss_extended_list_read_common_
+
/**
* A structure of parameters applied at some depth.
*
#ifndef _di_fss_extended_list_read_load_
f_status_t fss_extended_list_read_load(fss_extended_list_read_main_t * const main, fss_extended_list_read_data_t *data) {
+ f_state_t state = macro_f_state_t_initialize(fss_extended_list_read_common_allocation_large, fss_extended_list_read_common_allocation_small, 0, 0, 0, 0, 0);
f_string_range_t input = macro_f_string_range_t_initialize(data->buffer.used);
data->delimits_object.used = 0;
data->delimits_content.used = 0;
- const f_status_t status = fll_fss_extended_list_read(data->buffer, &input, &data->objects, &data->contents, &data->delimits_object, &data->delimits_content, &data->comments);
+ const f_status_t status = fll_fss_extended_list_read(data->buffer, state, &input, &data->objects, &data->contents, &data->delimits_object, &data->delimits_content, &data->comments);
if (F_status_is_error(status)) {
const f_string_t file_name = fss_extended_list_read_file_identify(input.start, data->files);
extern "C" {
#endif
+/**
+ * Provide common/generic definitions.
+ *
+ * extended_list_write_common_allocation_*:
+ * - large: An allocation step used for buffers that are anticipated to have large buffers.
+ * - small: An allocation step used for buffers that are anticipated to have small buffers.
+ */
+#ifndef _di_fss_extended_list_write_common_
+ #define fss_extended_list_write_common_allocation_large 256
+ #define fss_extended_list_write_common_allocation_small 16
+#endif // _di_fss_extended_list_write_common_
+
#ifdef __cplusplus
} // extern "C"
#endif
#ifndef _di_fss_extended_list_write_process_
f_status_t fss_extended_list_write_process(const fss_extended_list_write_main_t main, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, const f_string_ranges_t *ignore, f_string_dynamic_t *buffer) {
- f_status_t status = F_none;
+ f_status_t status = F_none;
+ f_state_t state = macro_f_state_t_initialize(fss_extended_list_write_common_allocation_large, fss_extended_list_write_common_allocation_small, 0, 0, 0, 0, 0);
f_string_range_t range = f_string_range_t_initialize;
if (object) {
}
}
- status = fl_fss_extended_list_object_write_string(*object, complete, &range, buffer);
+ status = fl_fss_extended_list_object_write_string(*object, complete, state, &range, buffer);
if (F_status_set_fine(status) == F_none_eol) {
fss_extended_list_write_error_parameter_unsupported_eol_print(main);
if (F_status_is_error(status)) {
fll_error_print(main.error, F_status_set_fine(status), "fl_fss_extended_list_object_write_string", F_true);
+
return status;
}
}
range.start = 0;
range.stop = content->used - 1;
- status = fl_fss_extended_list_content_write_string(*content, object ? f_fss_complete_full : f_fss_complete_none, &main.prepend, ignore, &range, buffer);
+ status = fl_fss_extended_list_content_write_string(*content, object ? f_fss_complete_full : f_fss_complete_none, &main.prepend, ignore, state, &range, buffer);
if (F_status_is_error(status)) {
fll_error_print(main.error, F_status_set_fine(status), "fl_fss_extended_list_content_write_string", F_true);
+
return status;
}
}
if (F_status_is_error(status)) {
fll_error_print(main.error, F_status_set_fine(status), "f_string_append", F_true);
+
return status;
}
}
#ifndef _di_fss_extended_list_write_process_pipe_
f_status_t fss_extended_list_write_process_pipe(const fss_extended_list_write_main_t main, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer, f_string_ranges_t *ignore) {
+
f_status_t status = F_none;
f_status_t status_pipe = F_none;
if (block.string[range.start] == fss_extended_list_write_pipe_content_start) {
state = 0x2;
- range.start++;
+ ++range.start;
break;
}
if (block.string[range.start] == fss_extended_list_write_pipe_content_end) {
state = 0x3;
- range.start++;
+ ++range.start;
break;
}
}
}
- for (; range.start <= range.stop; range.start++) {
+ for (; range.start <= range.stop; ++range.start) {
if (block.string[range.start] == fss_extended_list_write_pipe_content_start) {
if (main.error.verbosity != f_console_verbosity_quiet) {
#ifndef _di_fss_extended_list_write_process_parameter_ignore_
f_status_t fss_extended_list_write_process_parameter_ignore(const f_console_arguments_t arguments, const fss_extended_list_write_main_t main, const f_array_lengths_t contents, const f_array_length_t location, f_string_ranges_t *ignore) {
+
f_status_t status = F_none;
f_array_length_t i = 0;
range.start = 0;
- for (; i < main.parameters[fss_extended_list_write_parameter_ignore].locations.used; i++) {
+ for (; i < main.parameters[fss_extended_list_write_parameter_ignore].locations.used; ++i) {
l = main.parameters[fss_extended_list_write_parameter_ignore].locations.array[i];
if (ignore->size + f_fss_default_allocation_step > f_array_length_t_size) {
if (ignore->size + 1 > f_array_length_t_size) {
fll_error_print(main.error, F_string_too_large, "fss_extended_list_write_process_parameter_ignore", F_true);
+
return F_status_set_error(F_string_too_large);
}
if (F_status_is_error(status)) {
fll_error_print(main.error, F_status_set_fine(status), "fss_extended_list_write_process_parameter_ignore", F_true);
+
return status;
}
}
if (F_status_is_error(status)) {
fll_error_parameter_integer_print(main.error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_list_write_long_ignore, arguments.argv[index]);
+
return status;
}
#endif
/**
+ * Provide common/generic definitions.
+ *
+ * extended_read_common_allocation_*:
+ * - large: An allocation step used for buffers that are anticipated to have large buffers.
+ * - small: An allocation step used for buffers that are anticipated to have small buffers.
+ */
+#ifndef _di_fss_extended_read_common_
+ #define fss_extended_read_common_allocation_large 256
+ #define fss_extended_read_common_allocation_small 16
+#endif // _di_fss_extended_read_common_
+
+/**
* A structure of parameters applied at some depth.
*
* depth: The depth number in which this is to be processed at.
#ifndef _di_fss_extended_read_load_
f_status_t fss_extended_read_load(fss_extended_read_main_t * const main, fss_extended_read_data_t *data) {
+ f_state_t state = macro_f_state_t_initialize(fss_extended_read_common_allocation_large, fss_extended_read_common_allocation_small, 0, 0, 0, 0, 0);
f_string_range_t input = macro_f_string_range_t_initialize(data->buffer.used);
data->delimits_object.used = 0;
data->delimits_content.used = 0;
- const f_status_t status = fll_fss_extended_read(data->buffer, &input, &data->objects, &data->contents, 0, 0, &data->delimits_object, &data->delimits_content);
+ const f_status_t status = fll_fss_extended_read(data->buffer, state, &input, &data->objects, &data->contents, 0, 0, &data->delimits_object, &data->delimits_content);
if (F_status_is_error(status)) {
const f_string_t file_name = fss_extended_read_file_identify(input.start, data->files);
extern "C" {
#endif
+/**
+ * Provide common/generic definitions.
+ *
+ * extended_write_common_allocation_*:
+ * - large: An allocation step used for buffers that are anticipated to have large buffers.
+ * - small: An allocation step used for buffers that are anticipated to have small buffers.
+ */
+#ifndef _di_fss_extended_write_common_
+ #define fss_extended_write_common_allocation_large 256
+ #define fss_extended_write_common_allocation_small 16
+#endif // _di_fss_extended_write_common_
+
#ifdef __cplusplus
} // extern "C"
#endif
#ifndef _di_fss_extended_write_process_
f_status_t fss_extended_write_process(const fss_extended_write_main_t main, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_statics_t *contents, f_string_dynamic_t *buffer) {
- f_status_t status = F_none;
+ f_status_t status = F_none;
+ f_state_t state = macro_f_state_t_initialize(fss_extended_write_common_allocation_large, fss_extended_write_common_allocation_small, 0, 0, 0, 0, 0);
f_string_range_t range = f_string_range_t_initialize;
if (object) {
}
}
- status = fl_fss_extended_object_write_string(*object, quote, complete, &range, buffer);
+ status = fl_fss_extended_object_write_string(*object, quote, complete, state, &range, buffer);
if (F_status_set_fine(status) == F_none_eol) {
fss_extended_write_error_parameter_unsupported_eol_print(main);
if (F_status_is_error(status)) {
fll_error_print(main.error, F_status_set_fine(status), "fl_fss_extended_object_write_string", F_true);
+
return F_status_set_error(status);
}
}
range.stop = 0;
}
- status = fl_fss_extended_content_write_string(contents->array[i], quote, i + 1 < contents->used ? f_fss_complete_next : f_fss_complete_end, &range, buffer);
+ status = fl_fss_extended_content_write_string(contents->array[i], quote, i + 1 < contents->used ? f_fss_complete_next : f_fss_complete_end, state, &range, buffer);
if (F_status_set_fine(status) == F_none_eol) {
fss_extended_write_error_parameter_unsupported_eol_print(main);
if (F_status_is_error(status)) {
fll_error_print(main.error, F_status_set_fine(status), "fl_fss_extended_content_write_string", F_true);
+
return F_status_set_error(status);
}
} // for
if (F_status_is_error(status)) {
fll_error_print(main.error, F_status_set_fine(status), "f_string_append", F_true);
+
return status;
}
}
#ifndef _di_fss_extended_write_process_pipe_
f_status_t fss_extended_write_process_pipe(const fss_extended_write_main_t main, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer) {
+
f_status_t status = F_none;
f_status_t status_pipe = F_none;
if (!state || state == 0x1) {
if (!state) {
if (contents.used) {
- for (i = 0; i < contents.used; i++) {
+ for (i = 0; i < contents.used; ++i) {
contents.array[i].used = 0;
} // for
}
if (block.string[range.start] == fss_extended_write_pipe_content_start) {
state = 0x2;
- range.start++;
+ ++range.start;
break;
}
if (block.string[range.start] == fss_extended_write_pipe_content_end) {
state = 0x4;
- range.start++;
+ ++range.start;
break;
}
}
state = 0x3;
- contents.used++;
+ ++contents.used;
}
if (state == 0x3) {
}
if (total) {
- for (; range.start <= range.stop; range.start++) {
+ for (; range.start <= range.stop; ++range.start) {
if (block.string[range.start] == fss_extended_write_pipe_content_start) {
if (contents.used + 1 > contents.size) {
}
}
- contents.used++;
+ ++contents.used;
continue;
}
if (block.string[range.start] == fss_extended_write_pipe_content_end) {
state = 0x4;
- range.start++;
+ ++range.start;
break;
}
if (block.string[range.start] == fss_extended_write_pipe_content_ignore) {
+
// this is not used by this program.
continue;
}
#include <fll/level_1/conversion.h>
#include <fll/level_1/iki.h>
#include <fll/level_1/print.h>
+#include <fll/level_1/signal.h>
#include <fll/level_1/string.h>
// fll-2 includes
extern "C" {
#endif
+/**
+ * Provide common/generic definitions.
+ *
+ * iki_read_common_allocation_*:
+ * - large: An allocation step used for buffers that are anticipated to have large buffers.
+ * - small: An allocation step used for buffers that are anticipated to have small buffers.
+ */
+#ifndef _di_iki_read_common_
+ #define iki_read_common_allocation_large 256
+ #define iki_read_common_allocation_small 16
+#endif // _di_iki_read_common_
+
#ifdef __cplusplus
} // extern "C"
#endif
#ifndef _di_iki_read_process_at_
f_status_t iki_read_process_at(const f_console_arguments_t arguments, const f_string_t file_name, iki_read_main_t *main, f_string_range_t *range) {
- if (main->parameters[iki_read_parameter_line].result != f_console_result_additional) return F_false;
+
+ if (main->parameters[iki_read_parameter_line].result != f_console_result_additional) {
+ return F_false;
+ }
f_array_length_t line = 0;
#ifndef _di_iki_read_process_buffer_
f_status_t iki_read_process_buffer(const f_console_arguments_t arguments, const f_string_t file_name, iki_read_main_t *main) {
+
f_status_t status = F_none;
f_iki_variable_t variable = f_iki_variable_t_initialize;
#ifndef _di_iki_read_process_buffer_ranges_
f_status_t iki_read_process_buffer_ranges(const f_console_arguments_t arguments, const f_string_t file_name, iki_read_main_t *main, f_string_range_t *buffer_range, f_iki_variable_t *variable, f_iki_vocabulary_t *vocabulary, f_iki_content_t *content, f_string_ranges_t *ranges) {
+
f_status_t status = F_none;
bool unmatched = F_true;
- status = fl_iki_read(&main->buffer, buffer_range, variable, vocabulary, content);
+ {
+ f_state_t state = macro_f_state_t_initialize(iki_read_common_allocation_large, iki_read_common_allocation_small, 0, 0, 0, 0, 0);
+
+ status = fl_iki_read(state, &main->buffer, buffer_range, variable, vocabulary, content);
+ }
if (F_status_is_error(status)) {
fll_error_print(main->error, F_status_set_fine(status), "fl_iki_read", F_true);
+
return status;
}
#ifndef _di_iki_read_process_buffer_ranges_whole_
f_status_t iki_read_process_buffer_ranges_whole(const f_console_arguments_t arguments, const f_string_t file_name, const f_string_range_t buffer_range, iki_read_main_t *main, f_iki_variable_t *variable, f_iki_vocabulary_t *vocabulary, f_iki_content_t *content, f_string_ranges_t *ranges) {
+
f_status_t status = F_none;
f_string_range_t range = buffer_range;
- status = fl_iki_read(&main->buffer, &range, variable, vocabulary, content);
+ {
+ f_state_t state = macro_f_state_t_initialize(iki_read_common_allocation_large, iki_read_common_allocation_small, 0, 0, 0, 0, 0);
+
+ status = fl_iki_read(state, &main->buffer, &range, variable, vocabulary, content);
+ }
if (F_status_is_error(status)) {
fll_error_print(main->error, F_status_set_fine(status), "fl_iki_read", F_true);
+
return status;
}
if (!variable->used) {
f_print_dynamic_partial(main->output.stream, main->buffer, buffer_range);
+
return F_none;
}
#ifndef _di_iki_read_process_buffer_total_
f_status_t iki_read_process_buffer_total(const f_console_arguments_t arguments, const f_string_t file_name, iki_read_main_t *main, f_iki_variable_t *variable, f_iki_vocabulary_t *vocabulary, f_iki_content_t *content) {
+
f_status_t status = F_none;
f_string_range_t range = macro_f_string_range_t_initialize(main->buffer.used);
if (status == F_true) {
if (range.start > main->buffer.used) {
printf("0\n");
+
return F_none;
}
}
else if (status == F_data_not) {
printf("0\n");
+
return F_none;
}
- status = fl_iki_read(&main->buffer, &range, variable, vocabulary, content);
+ {
+ f_state_t state = macro_f_state_t_initialize(iki_read_common_allocation_large, iki_read_common_allocation_small, 0, 0, 0, 0, 0);
+
+ status = fl_iki_read(state, &main->buffer, &range, variable, vocabulary, content);
+ }
if (F_status_is_error(status)) {
fll_error_print(main->error, F_status_set_fine(status), "fl_iki_read", F_true);
+
return status;
}
range.stop = name.used - 1;
for (j = 0; j < vocabulary->used; j++) {
+
status = fl_string_dynamic_partial_compare(name, main->buffer, range, vocabulary->array[j]);
if (status == F_equal_to) total++;
range.start = 0;
for (; i < substitutions.used; i++) {
+
range.stop = substitutions.array[i].replace.used - 1;
status = fl_string_dynamic_partial_compare(substitutions.array[i].replace, main.buffer, range, content.array[index]);
fl_console
fl_conversion
fl_iki
+fl_signal
fl_string
fll_error
fll_program
build_indexer ar
build_language c
build_libraries -lc
-build_libraries-individual -lfll_error -lfll_program -lfl_console -lfl_conversion -lfl_iki -lfl_string -lf_color -lf_console -lf_conversion -lf_file -lf_iki -lf_memory -lf_path -lf_pipe -lf_print -lf_string -lf_type_array -lf_utf
+build_libraries-individual -lfll_error -lfll_program -lfl_console -lfl_conversion -lfl_iki -lfl_signal -lfl_string -lf_color -lf_console -lf_conversion -lf_file -lf_iki -lf_memory -lf_path -lf_pipe -lf_print -lf_signal -lf_string -lf_type_array -lf_utf
build_libraries-level -lfll_2 -lfll_1 -lfll_0
build_libraries-monolithic -lfll
build_sources_library iki_read.c private-common.c private-iki_read.c
#ifndef _di_iki_write_main_
f_status_t iki_write_main(const f_console_arguments_t arguments, iki_write_main_t *main) {
+
f_status_t status = F_none;
{
if (F_status_is_error(status)) {
iki_write_main_delete(main);
+
return status;
}
extern "C" {
#endif
+/**
+ * Provide common/generic definitions.
+ *
+ * iki_write_common_allocation_*:
+ * - large: An allocation step used for buffers that are anticipated to have large buffers.
+ * - small: An allocation step used for buffers that are anticipated to have small buffers.
+ */
+#ifndef _di_iki_write_common_
+ #define iki_write_common_allocation_large 256
+ #define iki_write_common_allocation_small 16
+#endif // _di_iki_write_common_
+
#ifdef __cplusplus
} // extern "C"
#endif