#ifndef _di_level_1_parameter_checking_
if (!state) return;
- if (!range || !found || !delimits || !comments) {
+ if (!range || !found || !delimits || !comments || !state->data) {
state->status = F_status_set_error(F_parameter);
return;
if (state->status == F_data_not) return;
if (state->status == F_okay_eos || state->status == F_okay_stop) return;
- state->status = f_memory_array_increase(state->step_small, sizeof(f_fss_nest_t), (void **) &found->depth, &found->used, &found->size);
- if (F_status_is_error(state->status)) return;
+ fl_fss_data_embedded_list_t * const cache = (fl_fss_data_embedded_list_t *) state->data;
- f_number_unsigneds_t positions_start = f_number_unsigneds_t_initialize;
-
- state->status = f_memory_array_increase(state->step_small, sizeof(f_number_unsigned_t), (void **) &positions_start.array, &positions_start.used, &positions_start.size);
- if (F_status_is_error(state->status)) return;
-
- f_ranges_t objects = f_ranges_t_initialize;
-
- state->status = f_memory_array_increase(state->step_small, sizeof(f_range_t), (void **) &objects.array, &objects.used, &objects.size);
-
- if (F_status_is_error(state->status)) {
- f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &positions_start.array, &positions_start.used, &positions_start.size);
+ if (!cache->positions || !cache->objects || !cache->slashes) {
+ state->status = F_status_set_error(F_parameter);
return;
}
- f_number_unsigneds_t slashes = f_number_unsigneds_t_initialize;
+ cache->positions->used = 0;
+ cache->objects->used = 0;
+ cache->slashes->used = 0;
- state->status = f_memory_array_increase(state->step_small, sizeof(f_number_unsigned_t), (void **) &slashes.array, &slashes.used, &slashes.size);
+ state->status = f_memory_array_increase(state->step_small, sizeof(f_fss_nest_t), (void **) &found->depth, &found->used, &found->size);
+ if (F_status_is_error(state->status)) return;
- if (F_status_is_error(state->status)) {
- f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &positions_start.array, &positions_start.used, &positions_start.size);
- f_memory_array_resize(0, sizeof(f_range_t), (void **) &objects.array, &objects.used, &objects.size);
+ state->status = f_memory_array_increase(state->step_small, sizeof(f_number_unsigned_t), (void **) &cache->objects->array, &cache->objects->used, &cache->objects->size);
+ if (F_status_is_error(state->status)) return;
- return;
- }
+ state->status = f_memory_array_increase(state->step_small, sizeof(f_number_unsigned_t), (void **) &cache->positions->array, &cache->positions->used, &cache->positions->size);
+ if (F_status_is_error(state->status)) return;
+
+ state->status = f_memory_array_increase(state->step_small, sizeof(f_number_unsigned_t), (void **) &cache->slashes->array, &cache->slashes->used, &cache->slashes->size);
+ if (F_status_is_error(state->status)) return;
const f_number_unsigned_t delimits_used = delimits->used;
const f_number_unsigned_t comments_used = comments->used;
f_number_unsigned_t before_list_open = position_previous;
- bool is_open = F_false;
+ uint8_t is_open = F_false;
// 0x0 = false, 0x1 = true, 0x2 = false, but there is a delimited comment, comment_delimit is set.
uint8_t graph_first = 0x0;
// Initialize depth 1 start position.
- // Positions_start.used is used as a max depth (such that positions_start.used == max depth + 1).
- positions_start.array[0] = range->start;
- positions_start.used = 1;
+ // Positions_start.used is used as a max depth (such that cache->positions->used == max depth + 1).
+ cache->positions->array[0] = range->start;
+ cache->positions->used = 1;
- slashes.array[0] = 0;
- slashes.used = 1;
+ cache->slashes->array[0] = 0;
+ cache->slashes->used = 1;
while (range->start <= range->stop && range->start < buffer.used) {
delimits->used = delimits_used;
comments->used = comments_used;
- f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &positions_start.array, &positions_start.used, &positions_start.size);
- f_memory_array_resize(0, sizeof(f_range_t), (void **) &objects.array, &objects.used, &objects.size);
- f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &slashes.array, &slashes.used, &slashes.size);
-
state->status = (range->start >= buffer.used) ? F_end_not_nest_eos : F_end_not_nest_stop;
return;
}
else {
if (range->start >= buffer.used || range->start > range->stop) {
- f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &positions_start.array, &positions_start.used, &positions_start.size);
- f_memory_array_resize(0, sizeof(f_range_t), (void **) &objects.array, &objects.used, &objects.size);
- f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &slashes.array, &slashes.used, &slashes.size);
-
state->status = (range->start >= buffer.used) ? F_okay_eos : F_okay_stop;
return;
if (buffer.string[range->start] == f_fss_slash_s.string[0]) {
slash_first = range->start;
slash_last = range->start;
- slashes.array[depth] = 1;
+ cache->slashes->array[depth] = 1;
position_previous = range->start++;
if (buffer.string[range->start] == f_fss_slash_s.string[0]) {
slash_last = range->start++;
- ++slashes.array[depth];
+ ++cache->slashes->array[depth];
}
else {
state->status = f_utf_buffer_increment(buffer, range, 1);
delimits->used = delimits_used;
comments->used = comments_used;
- f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &positions_start.array, &positions_start.used, &positions_start.size);
- f_memory_array_resize(0, sizeof(f_range_t), (void **) &objects.array, &objects.used, &objects.size);
- f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &slashes.array, &slashes.used, &slashes.size);
-
state->status = (range->start >= buffer.used) ? F_end_not_nest_eos : F_end_not_nest_stop;
return;
delimits->used = delimits_used;
comments->used = comments_used;
- f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &positions_start.array, &positions_start.used, &positions_start.size);
- f_memory_array_resize(0, sizeof(f_range_t), (void **) &objects.array, &objects.used, &objects.size);
- f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &slashes.array, &slashes.used, &slashes.size);
-
state->status = (range->start >= buffer.used) ? F_data_not_eos : F_data_not_stop;
return;
delimits->used = delimits_used;
comments->used = comments_used;
- f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &positions_start.array, &positions_start.used, &positions_start.size);
- f_memory_array_resize(0, sizeof(f_range_t), (void **) &objects.array, &objects.used, &objects.size);
- f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &slashes.array, &slashes.used, &slashes.size);
-
state->status = (range->start >= buffer.used) ? F_end_not_nest_eos : F_end_not_nest_stop;
return;
delimits->used = delimits_used;
comments->used = comments_used;
- f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &positions_start.array, &positions_start.used, &positions_start.size);
- f_memory_array_resize(0, sizeof(f_range_t), (void **) &objects.array, &objects.used, &objects.size);
- f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &slashes.array, &slashes.used, &slashes.size);
-
state->status = (range->start >= buffer.used) ? F_data_not_eos : F_data_not_stop;
return;
if (is_open) {
bool is_object = F_false;
- if (slashes.array[depth] % 2 == 0) {
+ if (cache->slashes->array[depth] % 2 == 0) {
is_object = F_true;
}
range->start = slash_first;
- state->status = f_memory_array_increase_by((slashes.array[depth] / 2) + 1, sizeof(f_number_unsigned_t), (void **) &delimits->array, &delimits->used, &delimits->size);
+ state->status = f_memory_array_increase_by((cache->slashes->array[depth] / 2) + 1, sizeof(f_number_unsigned_t), (void **) &delimits->array, &delimits->used, &delimits->size);
if (F_status_is_error(state->status)) break;
// Apply slash delimits, only slashes and placeholders should be present.
- while (slashes.array[depth]) {
+ while (cache->slashes->array[depth]) {
if (buffer.string[range->start] == f_fss_slash_s.string[0]) {
- if (slashes.array[depth] % 2 == 1) {
+ if (cache->slashes->array[depth] % 2 == 1) {
delimits->array[delimits->used++] = range->start;
}
- --slashes.array[depth];
+ --cache->slashes->array[depth];
}
// Delimit slashes and placeholders are required to be in the ASCII range.
// When slashes are even, the object is valid and needs to be processed.
if (is_object) {
- if (++depth > positions_start.size) {
- state->status = f_memory_array_increase(state->step_small, sizeof(f_number_unsigned_t), (void **) &positions_start.array, &positions_start.used, &positions_start.size);
- if (F_status_is_error(state->status)) break;
+ ++depth;
- state->status = f_memory_array_increase(state->step_small, sizeof(f_range_t), (void **) &objects.array, &objects.used, &objects.size);
+ if (depth >= cache->objects->size) {
+ state->status = f_memory_array_resize(depth + 2, sizeof(f_range_t), (void **) &cache->objects->array, &cache->objects->used, &cache->objects->size);
if (F_status_is_error(state->status)) break;
+ }
- state->status = f_memory_array_increase(state->step_small, sizeof(f_number_unsigned_t), (void **) &slashes.array, &slashes.used, &slashes.size);
+ if (depth >= cache->positions->size) {
+ state->status = f_memory_array_resize(depth + 2, sizeof(f_number_unsigned_t), (void **) &cache->positions->array, &cache->positions->used, &cache->positions->size);
if (F_status_is_error(state->status)) break;
}
- if (positions_start.used < depth) {
- positions_start.used = depth;
- slashes.used = depth;
+ if (depth >= cache->slashes->size) {
+ state->status = f_memory_array_resize(depth + 2, sizeof(f_number_unsigned_t), (void **) &cache->slashes->array, &cache->slashes->used, &cache->slashes->size);
+ if (F_status_is_error(state->status)) break;
}
- positions_start.array[depth] = newline_last + 1;
+ cache->objects->array[depth].start = line_start;
+ cache->objects->array[depth].stop = before_list_open;
+ cache->positions->array[depth] = newline_last + 1;
+ cache->slashes->array[depth] = 0;
+
+ if (cache->objects->used < depth) {
+ cache->objects->used = depth;
+ }
- objects.array[depth].start = line_start;
- objects.array[depth].stop = before_list_open;
+ if (cache->positions->used < depth) {
+ cache->positions->used = depth;
+ }
- slashes.array[depth] = 0;
+ if (cache->slashes->used < depth) {
+ cache->slashes->used = depth;
+ }
}
}
else {
delimits->used = delimits_used;
comments->used = comments_used;
- f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &positions_start.array, &positions_start.used, &positions_start.size);
- f_memory_array_resize(0, sizeof(f_range_t), (void **) &objects.array, &objects.used, &objects.size);
- f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &slashes.array, &slashes.used, &slashes.size);
-
state->status = (range->start >= buffer.used) ? F_end_not_nest_eos : F_end_not_nest_stop;
return;
delimits->used = delimits_used;
comments->used = comments_used;
- f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &positions_start.array, &positions_start.used, &positions_start.size);
- f_memory_array_resize(0, sizeof(f_range_t), (void **) &objects.array, &objects.used, &objects.size);
- f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &slashes.array, &slashes.used, &slashes.size);
-
state->status = (range->start >= buffer.used) ? F_data_not_eos : F_data_not_stop;
return;
if (buffer.string[range->start] == f_fss_eol_s.string[0]) {
++depth;
- if (depth >= positions_start.size) {
- state->status = f_memory_array_increase(state->step_small, sizeof(f_number_unsigned_t), (void **) &positions_start.array, &positions_start.used, &positions_start.size);
+ if (depth >= cache->objects->size) {
+ state->status = f_memory_array_resize(depth + 2, sizeof(f_range_t), (void **) &cache->objects->array, &cache->objects->used, &cache->objects->size);
if (F_status_is_error(state->status)) break;
+ }
- state->status = f_memory_array_increase(state->step_small, sizeof(f_range_t), (void **) &objects.array, &objects.used, &objects.size);
+ if (depth >= cache->positions->size) {
+ state->status = f_memory_array_resize(depth + 2, sizeof(f_number_unsigned_t), (void **) &cache->positions->array, &cache->positions->used, &cache->positions->size);
if (F_status_is_error(state->status)) break;
+ }
- state->status = f_memory_array_increase(state->step_small, sizeof(f_number_unsigned_t), (void **) &slashes.array, &slashes.used, &slashes.size);
+ if (depth >= cache->slashes->size) {
+ state->status = f_memory_array_resize(depth + 2, sizeof(f_number_unsigned_t), (void **) &cache->slashes->array, &cache->slashes->used, &cache->slashes->size);
if (F_status_is_error(state->status)) break;
}
- if (positions_start.used <= depth) {
- positions_start.used = depth + 1;
- slashes.used = depth + 1;
- }
+ cache->objects->array[depth].start = line_start;
+ cache->objects->array[depth].stop = before_list_open;
+ cache->positions->array[depth] = range->start + 1;
+ cache->slashes->array[depth] = 0;
- positions_start.array[depth] = range->start + 1;
+ if (cache->objects->used <= depth) {
+ cache->objects->used = depth + 1;
+ }
- objects.array[depth].start = line_start;
- objects.array[depth].stop = before_list_open;
+ if (cache->positions->used <= depth) {
+ cache->positions->used = depth + 1;
+ }
- slashes.array[depth] = 0;
+ if (cache->slashes->used <= depth) {
+ cache->slashes->used = depth + 1;
+ }
if (graph_first == 0x2) {
state->status = f_memory_array_increase(state->step_small, sizeof(f_number_unsigned_t), (void **) &delimits->array, &delimits->used, &delimits->size);
delimits->used = delimits_used;
comments->used = comments_used;
- f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &positions_start.array, &positions_start.used, &positions_start.size);
- f_memory_array_resize(0, sizeof(f_range_t), (void **) &objects.array, &objects.used, &objects.size);
- f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &slashes.array, &slashes.used, &slashes.size);
-
state->status = (range->start >= buffer.used) ? F_end_not_nest_eos : F_end_not_nest_stop;
return;
delimits->used = delimits_used;
comments->used = comments_used;
- f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &positions_start.array, &positions_start.used, &positions_start.size);
- f_memory_array_resize(0, sizeof(f_range_t), (void **) &objects.array, &objects.used, &objects.size);
- f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &slashes.array, &slashes.used, &slashes.size);
-
state->status = (range->start >= buffer.used) ? F_data_not_eos : F_data_not_stop;
return;
delimits->used = delimits_used;
comments->used = comments_used;
- f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &positions_start.array, &positions_start.used, &positions_start.size);
- f_memory_array_resize(0, sizeof(f_range_t), (void **) &objects.array, &objects.used, &objects.size);
- f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &slashes.array, &slashes.used, &slashes.size);
-
state->status = (range->start >= buffer.used) ? F_end_not_nest_eos : F_end_not_nest_stop;
return;
delimits->used = delimits_used;
comments->used = comments_used;
- f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &positions_start.array, &positions_start.used, &positions_start.size);
- f_memory_array_resize(0, sizeof(f_range_t), (void **) &objects.array, &objects.used, &objects.size);
- f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &slashes.array, &slashes.used, &slashes.size);
-
state->status = (range->start >= buffer.used) ? F_data_not_eos : F_data_not_stop;
return;
}
if (buffer.string[range->start] == f_fss_eol_s.string[0]) {
- state->status = f_memory_array_increase(state->step_small, sizeof(f_fss_nest_t), (void **) &found->depth, &found->used, &found->size);
- if (F_status_is_error(state->status)) break;
+ if (depth >= found->used) {
+ state->status = f_memory_array_resize(depth + 2, sizeof(f_fss_nest_t), (void **) &found->depth, &found->used, &found->size);
+ if (F_status_is_error(state->status)) break;
+ }
- if (found->depth[depth].used == found->depth[depth].size) {
+ if (found->depth[depth].used >= found->depth[depth].size) {
state->status = f_memory_array_increase(state->step_small, sizeof(f_fss_item_t), (void **) &found->depth[depth].array, &found->depth[depth].used, &found->depth[depth].size);
if (F_status_is_error(state->status)) break;
}
found->depth[depth].array[position].parent = found->depth[depth - 1].used;
// Only assign object positions for nested objects.
- found->depth[depth].array[position].object.start = objects.array[depth].start;
- found->depth[depth].array[position].object.stop = objects.array[depth].stop;
+ found->depth[depth].array[position].object.start = cache->objects->array[depth].start;
+ found->depth[depth].array[position].object.stop = cache->objects->array[depth].stop;
}
- found->depth[depth].array[position].content.array[0].start = positions_start.array[depth];
+ found->depth[depth].array[position].content.array[0].start = cache->positions->array[depth];
found->depth[depth].array[position].content.array[0].stop = newline_last;
found->depth[depth].array[position].content.used = 1;
state->status = f_utf_buffer_increment(buffer, range, 1);
if (F_status_is_error(state->status)) break;
- f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &positions_start.array, &positions_start.used, &positions_start.size);
- f_memory_array_resize(0, sizeof(f_range_t), (void **) &objects.array, &objects.used, &objects.size);
- f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &slashes.array, &slashes.used, &slashes.size);
-
if (range->start >= buffer.used) {
state->status = F_okay_eos;
} else if (range->start > range->stop) {
delimits->used = delimits_used;
comments->used = comments_used;
- f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &positions_start.array, &positions_start.used, &positions_start.size);
- f_memory_array_resize(0, sizeof(f_range_t), (void **) &objects.array, &objects.used, &objects.size);
- f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &slashes.array, &slashes.used, &slashes.size);
-
state->status = (range->start >= buffer.used) ? F_end_not_nest_eos : F_end_not_nest_stop;
return;
delimits->used = delimits_used;
comments->used = comments_used;
- f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &positions_start.array, &positions_start.used, &positions_start.size);
- f_memory_array_resize(0, sizeof(f_range_t), (void **) &objects.array, &objects.used, &objects.size);
- f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &slashes.array, &slashes.used, &slashes.size);
-
state->status = (range->start >= buffer.used) ? F_data_not_eos : F_data_not_stop;
return;
if (F_status_is_error(state->status)) break;
} // while
- f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &positions_start.array, &positions_start.used, &positions_start.size);
- f_memory_array_resize(0, sizeof(f_range_t), (void **) &objects.array, &objects.used, &objects.size);
- f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &slashes.array, &slashes.used, &slashes.size);
-
delimits->used = delimits_used;
comments->used = comments_used;