Set the flag size to 32-bit as 16-bits is often small for bitwise flags.
I try to keep structures like f_state_t as minimal as possible.
However, I feel that I need to pass information to functions to allow for more flexibility.
I have mixed opinions on this as this encroaches on the Keep It Simple concepts.
However, after consideration, I believe some of this complexity is necessary for the upcoming stable release.
Future development branches will be free to change this as the project exposes the good and the bad of such a decision.
*
* step_large: The allocation step to use for large buffers.
* step_small: The allocation step to use for small buffers.
+ * flag: A 32-bit digit intended for provided flags that are defined by the function.
* 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.
typedef struct {
uint16_t step_large;
uint16_t step_small;
+ uint32_t flag;
f_status_t (*handle)(const f_status_t error, void * const state, void * const internal);
f_status_t (*interrupt)(void * const state, void * const internal);
void *data;
} f_state_t;
- #define f_state_t_initialize { F_memory_default_allocation_large_d, F_memory_default_allocation_small_d, 0, 0, 0, 0, 0 }
+ #define f_state_t_initialize { F_memory_default_allocation_large_d, F_memory_default_allocation_small_d, 0, 0, 0, 0, 0, 0 }
- #define macro_f_state_t_initialize(step_large, step_small, handle, interrupt, callbacks, custom, data) { \
+ #define macro_f_state_t_initialize(step_large, step_small, flag, handle, interrupt, callbacks, custom, data) { \
step_large, \
step_small, \
+ flag, \
handle, \
interrupt, \
callbacks, \
int fake_2 = 2;
int fake_3 = 3;
- const f_state_t source = macro_f_state_t_initialize(12, 6, 0, 0, (void *) &fake_1, (void *) &fake_2, (void *) &fake_3);
+ const f_state_t source = macro_f_state_t_initialize(12, 6, 0, 0, 0, (void *) &fake_1, (void *) &fake_2, (void *) &fake_3);
f_states_t destination = f_states_t_initialize;
{
int fake_2 = 2;
int fake_3 = 3;
- const f_state_t state_data = macro_f_state_t_initialize(12, 6, 0, 0, (void *) &fake_1, (void *) &fake_2, (void *) &fake_3);
+ const f_state_t state_data = macro_f_state_t_initialize(12, 6, 0, 0, 0, (void *) &fake_1, (void *) &fake_2, (void *) &fake_3);
{
const f_status_t status = f_states_resize(length, &source);
if (F_status_is_error(status)) return status;
}
- const f_state_t state = macro_f_state_t_initialize(control_allocation_large_d, control_allocation_small_d, 0, &fll_program_standard_signal_state, 0, (void *) main, 0);
+ const f_state_t state = macro_f_state_t_initialize(control_allocation_large_d, control_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) main, 0);
f_string_static_t contents_array[main->parameters.remaining.used];
f_string_statics_t contents = macro_f_string_statics_t_initialize(contents_array, 0, main->parameters.remaining.used);
}
{
- f_state_t state = macro_f_state_t_initialize(control_allocation_large_d, control_allocation_small_d, 0, &fll_program_standard_signal_state, 0, (void *) main, 0);
+ f_state_t state = macro_f_state_t_initialize(control_allocation_large_d, control_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) main, 0);
f_string_range_t range_packet = macro_f_string_range_t_initialize2(data->cache.large.used);
status = fll_fss_basic_list_read(data->cache.large, state, &range_packet, &data->cache.packet_objects, &data->cache.packet_contents, &data->cache.delimits, 0, 0);
{
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_d, controller_common_allocation_small_d, 0, &controller_thread_signal_state_fss, 0, (void *) &custom, 0);
+ f_state_t state = macro_f_state_t_initialize(controller_common_allocation_large_d, controller_common_allocation_small_d, 0, 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, state, &range, &cache->object_actions, &cache->content_actions, 0, 0, &cache->delimits, 0);
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_d, controller_common_allocation_small_d, 0, &controller_thread_signal_state_fss, 0, (void *) &custom, 0);
+ f_state_t state = macro_f_state_t_initialize(controller_common_allocation_large_d, controller_common_allocation_small_d, 0, 0, &controller_thread_signal_state_fss, 0, (void *) &custom, 0);
f_string_range_t range = macro_f_string_range_t_initialize2(cache->buffer_file.used);
status = fll_fss_basic_list_read(cache->buffer_file, state, &range, &cache->object_items, &cache->content_items, &cache->delimits, 0, &cache->comments);
{
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_d, controller_common_allocation_small_d, 0, &controller_thread_signal_state_fss, 0, (void *) &custom, 0);
+ f_state_t state = macro_f_state_t_initialize(controller_common_allocation_large_d, controller_common_allocation_small_d, 0, 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, state, &range, &cache->object_actions, &cache->content_actions, 0, 0, &cache->delimits, 0);
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_d, controller_common_allocation_small_d, 0, &controller_thread_signal_state_fss, 0, (void *) &custom, 0);
+ f_state_t state = macro_f_state_t_initialize(controller_common_allocation_large_d, controller_common_allocation_small_d, 0, 0, &controller_thread_signal_state_fss, 0, (void *) &custom, 0);
if (method == controller_rule_action_method_extended_list_e) {
cache->comments.used = 0;
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_d, controller_common_allocation_small_d, 0, &controller_thread_signal_state_fss, 0, (void *) &custom, 0);
+ f_state_t state = macro_f_state_t_initialize(controller_common_allocation_large_d, controller_common_allocation_small_d, 0, 0, &controller_thread_signal_state_fss, 0, (void *) &custom, 0);
f_string_range_t range = macro_f_string_range_t_initialize2(cache->buffer_item.used);
f_array_length_t last = 0;
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_d, controller_common_allocation_small_d, 0, &controller_thread_signal_state_fss, 0, (void *) &custom, 0);
+ f_state_t state = macro_f_state_t_initialize(controller_common_allocation_large_d, controller_common_allocation_small_d, 0, 0, &controller_thread_signal_state_fss, 0, (void *) &custom, 0);
f_string_range_t range = macro_f_string_range_t_initialize2(cache->buffer_file.used);
status = fll_fss_basic_list_read(cache->buffer_file, state, &range, &cache->object_items, &cache->content_items, &cache->delimits, 0, &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_d, controller_common_allocation_small_d, 0, &controller_thread_signal_state_fss, 0, (void *) &custom, 0);
+ f_state_t state = macro_f_state_t_initialize(controller_common_allocation_large_d, controller_common_allocation_small_d, 0, 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);
}
f_fss_delimits_t delimits = f_fss_delimits_t_initialize;
{
- f_state_t state = macro_f_state_t_initialize(fake_common_allocation_large_d, fake_common_allocation_small_d, 0, &fll_program_standard_signal_state, 0, (void *) data->main, 0);
+ f_state_t state = macro_f_state_t_initialize(fake_common_allocation_large_d, fake_common_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) data->main, 0);
*status = fll_fss_extended_read(buffer, state, &range, &objects, &contents, 0, 0, &delimits, 0);
}
f_fss_comments_t comments = f_fss_comments_t_initialize;
{
- f_state_t state = macro_f_state_t_initialize(fake_common_allocation_large_d, fake_common_allocation_small_d, 0, &fll_program_standard_signal_state, 0, (void *) data_make->data, 0);
+ f_state_t state = macro_f_state_t_initialize(fake_common_allocation_large_d, fake_common_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) data_make->data, 0);
*status = fll_fss_basic_list_read(data_make->buffer, state, &range, &list_objects, &list_contents, &delimits, 0, &comments);
}
f_fss_set_t settings = f_fss_set_t_initialize;
- f_state_t state = macro_f_state_t_initialize(fake_common_allocation_large_d, fake_common_allocation_small_d, 0, &fll_program_standard_signal_state, 0, (void *) data_make->data, 0);
+ f_state_t state = macro_f_state_t_initialize(fake_common_allocation_large_d, fake_common_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) data_make->data, 0);
if (list_objects.used > data_make->fakefile.size) {
macro_f_fss_nameds_t_resize((*status), data_make->fakefile, list_objects.used);
f_iki_data_t iki_data = f_iki_data_t_initialize;
- f_state_t state = macro_f_state_t_initialize(fake_common_allocation_large_d, fake_common_allocation_small_d, 0, &fll_program_standard_signal_state, 0, (void *) data_make->data, 0);
+ f_state_t state = macro_f_state_t_initialize(fake_common_allocation_large_d, fake_common_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) data_make->data, 0);
f_string_range_t range = f_string_range_t_initialize;
f_string_map_multis_t *parameter = &data_make->setting_make.parameter;
#ifndef _di_fss_basic_list_read_load_
f_status_t fss_basic_list_read_load(fll_program_data_t * const main, fss_basic_list_read_data_t * const data) {
- f_state_t state = macro_f_state_t_initialize(fss_basic_list_read_common_allocation_large_d, fss_basic_list_read_common_allocation_small_d, 0, &fll_program_standard_signal_state, 0, (void *) main, 0);
+ f_state_t state = macro_f_state_t_initialize(fss_basic_list_read_common_allocation_large_d, fss_basic_list_read_common_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) main, 0);
f_string_range_t input = macro_f_string_range_t_initialize2(data->buffer.used);
data->delimits_object.used = 0;
f_status_t fss_basic_list_write_process(fll_program_data_t * const 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 * const buffer) {
f_status_t status = F_none;
- f_state_t state = macro_f_state_t_initialize(fss_basic_list_write_common_allocation_large_d, fss_basic_list_write_common_allocation_small_d, 0, &fll_program_standard_signal_state, 0, (void *) main, 0);
+ f_state_t state = macro_f_state_t_initialize(fss_basic_list_write_common_allocation_large_d, fss_basic_list_write_common_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) main, 0);
f_string_range_t range = f_string_range_t_initialize;
if (object) {
#ifndef _di_fss_basic_read_load_
f_status_t fss_basic_read_load(fll_program_data_t * const main, fss_basic_read_data_t * const data) {
- f_state_t state = macro_f_state_t_initialize(fss_basic_read_common_allocation_large_d, fss_basic_read_common_allocation_small_d, 0, &fll_program_standard_signal_state, 0, (void *) main, 0);
+ f_state_t state = macro_f_state_t_initialize(fss_basic_read_common_allocation_large_d, fss_basic_read_common_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) main, 0);
f_string_range_t input = macro_f_string_range_t_initialize2(data->buffer.used);
data->delimits.used = 0;
f_status_t fss_basic_write_process(fll_program_data_t * const 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_state_t state = macro_f_state_t_initialize(fss_basic_write_common_allocation_large_d, fss_basic_write_common_allocation_small_d, 0, &fll_program_standard_signal_state, 0, (void *) main, 0);
+ f_state_t state = macro_f_state_t_initialize(fss_basic_write_common_allocation_large_d, fss_basic_write_common_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) main, 0);
f_string_range_t range = f_string_range_t_initialize;
if (object) {
f_status_t status = F_none;
{
- f_state_t state = macro_f_state_t_initialize(fss_embedded_list_read_common_allocation_large_d, fss_embedded_list_read_common_allocation_small_d, 0, &fll_program_standard_signal_state, 0, (void *) data->main, 0);
+ f_state_t state = macro_f_state_t_initialize(fss_embedded_list_read_common_allocation_large_d, fss_embedded_list_read_common_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) data->main, 0);
f_string_range_t input = macro_f_string_range_t_initialize2(data->buffer.used);
objects_delimits->used = 0;
f_status_t fss_embedded_list_write_process(fll_program_data_t * const 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_state_t state = macro_f_state_t_initialize(fss_embedded_list_write_common_allocation_large_d, fss_embedded_list_write_common_allocation_small_d, 0, &fll_program_standard_signal_state, 0, (void *) main, 0);
+ f_state_t state = macro_f_state_t_initialize(fss_embedded_list_write_common_allocation_large_d, fss_embedded_list_write_common_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) main, 0);
f_string_range_t range = f_string_range_t_initialize;
if (object) {
#ifndef _di_fss_extended_list_read_load_
f_status_t fss_extended_list_read_load(fll_program_data_t * const main, fss_extended_list_read_data_t * const data) {
- f_state_t state = macro_f_state_t_initialize(fss_extended_list_read_common_allocation_large_d, fss_extended_list_read_common_allocation_small_d, 0, &fll_program_standard_signal_state, 0, (void *) main, 0);
+ f_state_t state = macro_f_state_t_initialize(fss_extended_list_read_common_allocation_large_d, fss_extended_list_read_common_allocation_small_d, 0, &fll_program_standard_signal_state, 0, 0, (void *) main, 0);
f_string_range_t input = macro_f_string_range_t_initialize2(data->buffer.used);
data->delimits_object.used = 0;
f_status_t fss_extended_list_write_process(fll_program_data_t * const 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_state_t state = macro_f_state_t_initialize(fss_extended_list_write_common_allocation_large_d, fss_extended_list_write_common_allocation_small_d, 0, &fll_program_standard_signal_state, 0, (void *) main, 0);
+ f_state_t state = macro_f_state_t_initialize(fss_extended_list_write_common_allocation_large_d, fss_extended_list_write_common_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) main, 0);
f_string_range_t range = f_string_range_t_initialize;
if (object) {
#ifndef _di_fss_extended_read_load_
f_status_t fss_extended_read_load(fll_program_data_t * const main, fss_extended_read_data_t * const data) {
- f_state_t state = macro_f_state_t_initialize(fss_extended_read_common_allocation_large_d, fss_extended_read_common_allocation_small_d, 0, &fll_program_standard_signal_state, 0, (void *) main, 0);
+ f_state_t state = macro_f_state_t_initialize(fss_extended_read_common_allocation_large_d, fss_extended_read_common_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) main, 0);
f_string_range_t input = macro_f_string_range_t_initialize2(data->buffer.used);
data->delimits_object.used = 0;
f_status_t fss_extended_write_process(fll_program_data_t * const 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_state_t state = macro_f_state_t_initialize(fss_extended_write_common_allocation_large_d, fss_extended_write_common_allocation_small_d, 0, &fll_program_standard_signal_state, 0, (void *) main, 0);
+ f_state_t state = macro_f_state_t_initialize(fss_extended_write_common_allocation_large_d, fss_extended_write_common_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) main, 0);
f_string_range_t range = f_string_range_t_initialize;
if (object) {
#ifndef _di_fss_payload_read_load_
f_status_t fss_payload_read_load(fll_program_data_t * const main, fss_payload_read_data_t * const data) {
- f_state_t state = macro_f_state_t_initialize(fss_payload_read_common_allocation_large_d, fss_payload_read_common_allocation_small_d, 0, &fll_program_standard_signal_state, 0, (void *) main, 0);
+ f_state_t state = macro_f_state_t_initialize(fss_payload_read_common_allocation_large_d, fss_payload_read_common_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) main, 0);
f_string_range_t input = macro_f_string_range_t_initialize2(data->buffer.used);
data->delimits_object.used = 0;
f_status_t fss_payload_write_process(fll_program_data_t * const 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_state_t state = macro_f_state_t_initialize(fss_payload_write_common_allocation_large_d, fss_payload_write_common_allocation_small_d, 0, &fll_program_standard_signal_state, 0, (void *) main, 0);
+ f_state_t state = macro_f_state_t_initialize(fss_payload_write_common_allocation_large_d, fss_payload_write_common_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) main, 0);
f_string_range_t range = f_string_range_t_initialize;
if (object) {
bool unmatched = F_true;
{
- f_state_t state = macro_f_state_t_initialize(iki_read_common_allocation_large_d, iki_read_common_allocation_small_d, 0, &fll_program_standard_signal_state, 0, (void *) data->main, 0);
+ f_state_t state = macro_f_state_t_initialize(iki_read_common_allocation_large_d, iki_read_common_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) data->main, 0);
status = fl_iki_read(state, &data->buffer, buffer_range, iki_data);
}
f_string_range_t range = buffer_range;
{
- f_state_t state = macro_f_state_t_initialize(iki_read_common_allocation_large_d, iki_read_common_allocation_small_d, 0, &fll_program_standard_signal_state, 0, (void *) data->main, 0);
+ f_state_t state = macro_f_state_t_initialize(iki_read_common_allocation_large_d, iki_read_common_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) data->main, 0);
status = fl_iki_read(state, &data->buffer, &range, iki_data);
}
}
{
- f_state_t state = macro_f_state_t_initialize(iki_read_common_allocation_large_d, iki_read_common_allocation_small_d, 0, &fll_program_standard_signal_state, 0, (void *) data->main, 0);
+ f_state_t state = macro_f_state_t_initialize(iki_read_common_allocation_large_d, iki_read_common_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) data->main, 0);
status = fl_iki_read(state, &data->buffer, &range, iki_data);
}