Update specification to make this more clear.
The Extended List read functions are updated to handle this.
The Extended List read program is essentially copied from the Basic List read program and then updated accordingly.
The Extended List write functions and programs need to not escape the opening brace inside a content.
/**
* Read an fss-0008 content.
*
- * @fixme the recursive part of this is actually fss-0008 (Embedded) content, fss-0008 is not recursive, oops!
- *
* This will record where delimit placeholders exist but will not apply the delimits.
*
* This operates on the assumption that found.array[0].array[found.array[0].used].content is the current content being processed.
#endif // _di_fl_fss_extended_list_object_read_
#ifndef _di_fl_fss_extended_list_content_read_
- f_return_status fl_fss_extended_list_content_read(f_string_dynamic_t *buffer, f_string_range_t *range, f_fss_nest_t *found, f_fss_delimits_t *delimits, f_fss_comments_t *comments) {
+ f_return_status fl_fss_extended_list_content_read(f_string_dynamic_t *buffer, 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 (!buffer) return F_status_set_error(F_parameter);
if (!range) return F_status_set_error(F_parameter);
if (!comments) return F_status_set_error(F_parameter);
#endif // _di_level_1_parameter_checking_
- const f_array_length_t found_used = found->used;
+ const f_array_length_t delimits_used = delimits->used;
+ const f_array_length_t comments_used = comments->used;
f_status_t status = f_fss_skip_past_delimit(*buffer, range);
if (F_status_is_error(status)) return status;
- if (status == F_none_eos || status == F_none_stop) {
- return status;
- }
+ fl_macro_fss_content_with_comments_return_on_overflow((*buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, F_none_eos, F_none_stop);
- status = private_fl_fss_nest_increase(found);
+ status = private_fl_fss_ranges_increase(found);
if (F_status_is_error(status)) return status;
- f_string_lengths_t positions_start = f_string_lengths_t_initialize;
-
- f_macro_string_lengths_t_new(status, positions_start, f_fss_default_allocation_step);
- if (F_status_is_error(status)) return status;
-
- f_fss_objects_t objects = f_fss_objects_t_initialize;
-
- f_macro_fss_objects_t_new(status, objects, f_fss_default_allocation_step);
-
- if (F_status_is_error(status)) {
- f_macro_string_lengths_t_delete_simple(positions_start);
+ found->array[found->used].start = range->start;
- return status;
- }
-
- const f_array_length_t delimits_used = delimits->used;
- const f_array_length_t comments_used = comments->used;
-
- f_array_length_t depth = 0;
- f_array_length_t position = 0;
-
- f_string_length_t position_previous = range->start;
- f_string_length_t line_start = range->start;
f_string_length_t newline_last = range->start;
- f_string_length_t comment_delimit = 0;
-
f_string_length_t slash_first = 0;
- f_string_length_t slash_last = 0;
f_string_length_t slash_count = 0;
+ f_string_length_t start = 0;
- f_string_length_t before_list_open = position_previous;
-
- bool is_open = F_false;
-
- uint8_t graph_first = 0x0; // 0x0 = false, 0x1 = true, 0x2 = false, but there is a delimited comment, comment_delimit is set.
-
- // 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;
-
+ // identify where the content ends.
while (range->start <= range->stop && range->start < buffer->used) {
- if (buffer->string[range->start] == f_fss_eol) {
- if (graph_first == 0x2) {
- status = private_fl_fss_delimits_increase(delimits);
- if (F_status_is_error(status)) break;
-
- delimits->array[delimits->used++] = comment_delimit;
- }
+ status = f_fss_skip_past_space(*buffer, range);
+ if (F_status_is_error(status)) return status;
+ if (status == F_none_eol) {
newline_last = range->start;
- position_previous = range->start++;
- graph_first = 0x1;
-
- if (depth > 0) {
- fl_macro_fss_nest_return_on_overflow((*buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, F_unterminated_nest_eos, F_unterminated_nest_stop);
- }
- else {
- fl_macro_fss_nest_return_on_overflow_delimited((*buffer), (*range), (*found), positions_start, objects, F_none_eos, F_none_stop);
- }
-
- line_start = range->start;
+ range->start++;
continue;
}
if (buffer->string[range->start] == f_fss_delimit_slash) {
slash_first = range->start;
- slash_last = range->start;
slash_count = 1;
- position_previous = range->start;
-
- status = f_utf_buffer_increment(*buffer, range, 1);
- if (F_status_is_error(status)) break;
-
- 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)) {
- position_previous = range->start;
+ for (range->start++; range->start <= range->stop && range->start < buffer->used; ++range->start) {
- if (buffer->string[range->start] == f_fss_delimit_slash) {
- slash_last = range->start++;
+ if (buffer->string[range->start] == f_fss_delimit_placeholder) {
+ continue;
+ } else if (buffer->string[range->start] != f_fss_delimit_slash) {
+ break;
}
- status = f_utf_buffer_increment(*buffer, range, 1);
- if (F_status_is_error(status)) break;
- } // while
-
- if (F_status_is_error(status)) break;
+ slash_count++;
+ } // for
- if (depth > 0) {
- fl_macro_fss_nest_return_on_overflow((*buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, F_unterminated_nest_eos, F_unterminated_nest_stop);
- }
- else {
- fl_macro_fss_nest_return_on_overflow((*buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, F_data_not_eos, F_data_not_stop);
- }
+ if (range->start > range->stop || range->start >= buffer->used) break;
- // All slashes for an open are delimited (because it could represent a slash in the object name).
- // for example 'object {' = valid open, name 'object', 'object \{' represents 'object {', 'object \\{' = valid open, name 'object \', 'object \\\{' represents 'object \{', etc..
// Only the first slash before a close is delimited, all others are maintained.
- // for example '}' = valid close, '\}' represents '}', '\\}' represents '\}', '\\\}' represents '\\}', '\\\\}' represents '\\\}', and so on..
- // 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) {
- status = private_fl_fss_delimits_increase(delimits);
- if (F_status_is_error(status)) break;
-
- delimits->array[delimits->used++] = comment_delimit;
- }
-
- newline_last = range->start;
- position_previous = range->start++;
- line_start = range->start;
- graph_first = 0x1;
- }
- else if (buffer->string[range->start] == f_fss_extended_list_open || buffer->string[range->start] == f_fss_extended_list_close) {
- before_list_open = position_previous;
- is_open = F_false;
- graph_first = 0x0;
-
- if (buffer->string[range->start] == f_fss_extended_list_open) {
- is_open = F_true;
- }
-
- position_previous = range->start++;
+ // For example '}' = valid close, '\}' represents '}', '\\}' represents '\}', '\\\}' represents '\\}', '\\\\}' represents '\\\}', and so on..
+ // With one or more slashes, even if delimited, this line may never designate a valid content close.
+ if (buffer->string[range->start] == f_fss_extended_list_close) {
+ range->start++;
while (range->start <= range->stop && range->start < buffer->used) {
- if (buffer->string[range->start] == f_fss_eol) {
- if (graph_first == 0x2) {
- status = private_fl_fss_delimits_increase(delimits);
- if (F_status_is_error(status)) break;
-
- delimits->array[delimits->used++] = comment_delimit;
- }
-
- newline_last = range->start;
- line_start = range->start + 1;
- graph_first = 0x1;
- break;
- }
-
- if (buffer->string[range->start] != f_fss_delimit_placeholder) {
- status = f_fss_is_space(*buffer, *range);
- if (F_status_is_error(status)) break;
-
- if (status == F_false) break;
- }
-
- position_previous = range->start;
-
- status = f_utf_buffer_increment(*buffer, range, 1);
- if (F_status_is_error(status)) break;
- } // while
-
- if (F_status_is_error(status)) break;
-
- if (depth > 0) {
- fl_macro_fss_nest_return_on_overflow((*buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, F_unterminated_nest_eos, F_unterminated_nest_stop);
- }
- else {
- fl_macro_fss_nest_return_on_overflow((*buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, F_data_not_eos, F_data_not_stop);
- }
-
- // this is a valid object open/close that has been delimited, save the slash delimit positions.
- if (buffer->string[range->start] == f_fss_eol) {
- newline_last = range->start;
- line_start = range->start + 1;
- graph_first = 0x1;
-
- if (is_open) {
- bool is_object = F_false;
-
- if (slash_count % 2 == 0) {
- is_object = F_true;
- }
-
- range->start = slash_first;
-
- status = private_fl_fss_delimits_increase_by((slash_count / 2) + 1, delimits);
- if (F_status_is_error(status)) break;
-
- // apply slash delimits, only slashes and placeholders should be present.
- while (slash_count > 0) {
-
- if (buffer->string[range->start] == f_fss_delimit_slash) {
- if (slash_count % 2 == 1) {
- delimits->array[delimits->used++] = range->start;
- }
-
- slash_count--;
- }
-
- // Delimit slashes and placeholders are required to be in the ASCII range.
- position_previous = range->start++;
- } // while
-
- if (F_status_is_error(status)) break;
-
- // when slashes are even, the object is valid and needs to be processed.
- if (is_object) {
- depth++;
-
- if (depth > positions_start.size) {
- f_macro_string_lengths_t_resize(status, positions_start, positions_start.size + f_fss_default_allocation_step);
- if (F_status_is_error(status)) break;
- }
-
- if (positions_start.used < depth) {
- positions_start.used = depth;
- }
-
- positions_start.array[depth] = newline_last + 1;
-
- objects.array[depth].start = line_start;
- objects.array[depth].stop = before_list_open;
- }
- }
- else {
- status = private_fl_fss_delimits_increase(delimits);
- if (F_status_is_error(status)) break;
-
- delimits->array[delimits->used++] = slash_last;
- }
-
- range->start = newline_last;
- }
- }
- else if (graph_first == 0x1 && buffer->string[range->start] == f_fss_comment) {
- graph_first = 0x2;
- comment_delimit = slash_first;
- }
- else {
- graph_first = 0x0;
- }
- }
- else if (buffer->string[range->start] == f_fss_extended_list_open) {
- graph_first = 0x0;
- before_list_open = position_previous;
- position_previous = range->start;
-
- status = f_utf_buffer_increment(*buffer, range, 1);
- if (F_status_is_error(status)) break;
-
- while (range->start <= range->stop && range->start < buffer->used) {
-
- if (buffer->string[range->start] == f_fss_eol) break;
+ if (buffer->string[range->start] == f_fss_eol) break;
- if (buffer->string[range->start] != f_fss_delimit_placeholder) {
status = f_fss_is_space(*buffer, *range);
if (F_status_is_error(status)) break;
if (status == F_false) break;
- }
-
- position_previous = range->start;
-
- status = f_utf_buffer_increment(*buffer, range, 1);
- if (F_status_is_error(status)) break;
- } // while
-
- if (F_status_is_error(status)) break;
-
- if (depth > 0) {
- fl_macro_fss_nest_return_on_overflow((*buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, F_unterminated_nest_eos, F_unterminated_nest_stop);
- }
- else {
- fl_macro_fss_nest_return_on_overflow((*buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, F_data_not_eos, F_data_not_stop);
- }
-
- if (buffer->string[range->start] == f_fss_eol) {
- depth++;
-
- if (depth >= positions_start.size) {
- f_macro_string_lengths_t_resize(status, positions_start, positions_start.size + f_fss_default_allocation_step);
- if (F_status_is_error(status)) break;
- f_macro_fss_objects_t_resize(status, objects, objects.size + f_fss_default_allocation_step);
+ status = f_utf_buffer_increment(*buffer, range, 1);
if (F_status_is_error(status)) break;
- }
-
- if (positions_start.used <= depth) {
- positions_start.used = depth + 1;
- }
-
- positions_start.array[depth] = range->start + 1;
+ } // while
- objects.array[depth].start = line_start;
- objects.array[depth].stop = before_list_open;
+ if (range->start > range->stop || range->start >= buffer->used) break;
- if (graph_first == 0x2) {
+ if (buffer->string[range->start] == f_fss_eol) {
status = private_fl_fss_delimits_increase(delimits);
if (F_status_is_error(status)) break;
- delimits->array[delimits->used++] = comment_delimit;
+ delimits->array[delimits->used++] = slash_first;
+ continue;
}
-
- newline_last = range->start;
- line_start = range->start + 1;
- graph_first = 0x1;
}
- else {
-
- // No valid object close found, seek until EOL.
- status = f_fss_seek_to_eol(*buffer, range);
+ else if (buffer->string[range->start] == f_fss_comment) {
+ status = private_fl_fss_delimits_increase(delimits);
if (F_status_is_error(status)) break;
- if (graph_first == 0x2) {
- status = private_fl_fss_delimits_increase(delimits);
- if (F_status_is_error(status)) break;
-
- delimits->array[delimits->used++] = comment_delimit;
- }
+ delimits->array[delimits->used++] = slash_first;
+ }
- newline_last = range->start;
- line_start = range->start + 1;
- graph_first = 0x1;
+ status = f_fss_seek_to_eol(*buffer, range);
+ if (F_status_is_error(status)) break;
- while (range->start <= range->stop && range->start < buffer->used) {
+ continue;
+ }
- if (buffer->string[range->start] == f_fss_eol) {
- newline_last = range->start;
- line_start = range->start + 1;
- break;
- }
+ if (buffer->string[range->start] == f_fss_extended_list_close) {
+ range->start++;
- position_previous = range->start;
+ while (range->start <= range->stop && range->start < buffer->used) {
- status = f_utf_buffer_increment(*buffer, range, 1);
- if (F_status_is_error(status)) break;
- } // while
+ if (buffer->string[range->start] == f_fss_eol) break;
+ status = f_fss_is_space(*buffer, *range);
if (F_status_is_error(status)) break;
- if (depth > 0) {
- fl_macro_fss_nest_return_on_overflow((*buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, F_unterminated_nest_eos, F_unterminated_nest_stop);
- }
- else {
- fl_macro_fss_nest_return_on_overflow((*buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, F_data_not_eos, F_data_not_stop);
- }
- }
- }
- else if (buffer->string[range->start] == f_fss_extended_list_close) {
- graph_first = 0x0;
-
- while (range->start <= range->stop && range->start < buffer->used) {
-
- position_previous = range->start;
+ if (status == F_false) break;
status = f_utf_buffer_increment(*buffer, range, 1);
if (F_status_is_error(status)) break;
-
- if (buffer->string[range->start] == f_fss_eol) {
- break;
- }
-
- if (buffer->string[range->start] != f_fss_delimit_placeholder) {
- status = f_fss_is_space(*buffer, *range);
- if (F_status_is_error(status)) break;
-
- if (status == F_false) {
- break;
- }
- }
} // while
if (F_status_is_error(status)) break;
- if (depth > 0) {
- fl_macro_fss_nest_return_on_overflow((*buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, F_unterminated_nest_eos, F_unterminated_nest_stop);
- }
- else {
- fl_macro_fss_nest_return_on_overflow((*buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, F_data_not_eos, F_data_not_stop);
- }
+ if (range->start > range->stop || range->start >= buffer->used) break;
+ // found a valid content close, set stop point to last newline.
if (buffer->string[range->start] == f_fss_eol) {
- status = private_fl_fss_nest_increase(found);
- if (F_status_is_error(status)) break;
-
- if (found->depth[depth].used == found->depth[depth].size) {
- f_macro_fss_items_t_resize(status, found->depth[depth], found->depth[depth].size + f_fss_default_allocation_step);
- if (F_status_is_error(status)) break;
- }
-
- position = found->depth[depth].used;
-
- if (found->depth[depth].array[position].content.size != 1) {
- f_macro_fss_content_t_resize(status, found->depth[depth].array[position].content, 1);
- if (F_status_is_error(status)) break;
- }
-
- if (depth) {
- found->depth[depth].array[position].parent = found->depth[depth - 1].used;
+ range->start = newline_last + 1;
+ found->array[found->used++].stop = newline_last;
- // 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].content.array[0].start = positions_start.array[depth];
- found->depth[depth].array[position].content.array[0].stop = newline_last;
- found->depth[depth].array[position].content.used = 1;
-
- if (position >= found->depth[depth].used) {
- found->depth[depth].used++;
- }
-
- if (found->used < depth + 1) {
- found->used = depth + 1;
- }
-
- if (graph_first == 0x2) {
- status = private_fl_fss_delimits_increase(delimits);
- if (F_status_is_error(status)) break;
-
- delimits->array[delimits->used++] = comment_delimit;
- }
-
- newline_last = range->start;
- line_start = range->start + 1;
- graph_first = 0x1;
-
- if (!depth) {
- status = f_utf_buffer_increment(*buffer, range, 1);
- if (F_status_is_error(status)) break;
-
- fl_macro_fss_nest_return_on_overflow_delimited((*buffer), (*range), (*found), positions_start, objects, F_none_eos, F_none_stop)
-
- f_macro_string_lengths_t_delete_simple(positions_start);
- f_macro_fss_objects_t_delete_simple(objects);
-
- return FL_fss_found_content;
- }
-
- depth--;
+ return FL_fss_found_content;
}
- else {
-
- // No valid object close found, seek until EOL.
- while (range->start <= range->stop && range->start < buffer->used) {
-
- if (buffer->string[range->start] == f_fss_eol) {
- if (graph_first == 0x2) {
- status = private_fl_fss_delimits_increase(delimits);
- if (F_status_is_error(status)) break;
-
- delimits->array[delimits->used++] = comment_delimit;
- }
- newline_last = range->start;
- line_start = range->start + 1;
- graph_first = 0x1;
- break;
- }
-
- position_previous = range->start;
-
- status = f_utf_buffer_increment(*buffer, range, 1);
- if (F_status_is_error(status)) break;
- } // while
-
- if (F_status_is_error(status)) break;
-
- if (depth > 0) {
- fl_macro_fss_nest_return_on_overflow((*buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, F_unterminated_nest_eos, F_unterminated_nest_stop)
- }
- else {
- fl_macro_fss_nest_return_on_overflow((*buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, F_data_not_eos, F_data_not_stop)
- }
- }
+ continue;
}
- else if (graph_first == 0x1 && buffer->string[range->start] == f_fss_comment) {
- position = range->start;
+
+ if (buffer->string[range->start] == f_fss_comment) {
+ start = range->start;
status = f_fss_seek_to_eol(*buffer, range);
if (F_status_is_error(status)) break;
range->start--;
}
else {
- if (graph_first == 0x2) {
- status = private_fl_fss_delimits_increase(delimits);
- if (F_status_is_error(status)) break;
-
- delimits->array[delimits->used++] = comment_delimit;
- }
-
newline_last = range->start;
- graph_first = 0x1;
}
- comments->array[comments->used].start = position;
+ comments->array[comments->used].start = start;
comments->array[comments->used++].stop = range->start++;
continue;
}
- else if (buffer->string[range->start] != f_fss_eol) {
- position_previous = range->start;
-
- if (graph_first == 0x1) {
- status = f_fss_is_space(*buffer, *range);
- if (F_status_is_error(status)) break;
-
- if (status == F_false) {
- graph_first = 0x0;
- }
- }
-
- status = f_utf_buffer_increment(*buffer, range, 1);
- if (F_status_is_error(status)) break;
-
- if (range->start >= buffer->used || range->start > range->stop) {
- break;
- }
-
- continue;
- }
-
- position_previous = range->start;
- status = f_utf_buffer_increment(*buffer, range, 1);
+ // There is no possibility of a valid content close, so seek until newline.
+ status = f_fss_seek_to_eol(*buffer, range);
if (F_status_is_error(status)) break;
} // while
- f_macro_string_lengths_t_delete_simple(positions_start);
- f_macro_fss_objects_t_delete_simple(objects);
-
- delimits->used = delimits_used;
- comments->used = comments_used;
-
if (F_status_is_error(status)) {
+ delimits->used = delimits_used;
+ comments->used = comments_used;
return status;
}
- if (range->start > range->stop) {
- if (!depth) {
- return F_status_set_error(F_unterminated_stop);
- }
-
- return F_status_set_error(F_unterminated_nest_stop);
- }
-
- if (!depth) {
- return F_status_set_error(F_unterminated_eos);
- }
-
- return F_status_set_error(F_unterminated_nest_eos);
+ return FL_fss_found_content_not;
}
#endif // _di_fl_fss_extended_list_content_read_
slash_count++;
} // for
- if (content.string[range->start] == f_fss_extended_list_open || content.string[range->start] == f_fss_extended_list_close) {
+ if (content.string[range->start] == f_fss_extended_list_close) {
start = range->start++;
status = f_fss_skip_past_space(content, range);
if (F_status_is_error(status)) break;
- if (has_graph && content.string[range->start] == f_fss_extended_list_close) {
+ if (has_graph) {
// do nothing.
}
else if (content.string[range->start] == f_fss_eol || range->start >= content.used || range->start > range->stop) {
- if (content.string[range->start] == f_fss_eol) {
- ends_on_eol = F_true;
- }
- else {
- ends_on_eol = F_false;
- }
-
- // increase by total slashes + 1, along with the extended list open and possible newline.
- status = private_fl_fss_destination_increase_by(slash_count + 3, destination);
+ // increase by total slashes + 1 and extended list close.
+ status = private_fl_fss_destination_increase_by(2, destination);
if (F_status_is_error(status)) break;
- while (slash_count--) {
- destination->string[destination->used++] = f_fss_delimit_slash;
- } // while
-
destination->string[destination->used++] = f_fss_delimit_slash;
- destination->string[destination->used++] = content.string[start];
+ destination->string[destination->used++] = f_fss_extended_list_close;
range->start = start + 1;
continue;
}
}
- else if ((content.string[range->start] == f_fss_extended_list_open || (!has_graph && content.string[range->start] == f_fss_extended_list_close)) && !is_comment) {
+ else if (!has_graph && content.string[range->start] == f_fss_extended_list_close && !is_comment) {
start = range->start++;
if (do_prepend) {
}
}
- // increase by slash and extended list open and possible newline.
- status = private_fl_fss_destination_increase_by(3, destination);
+ // increase by slash and extended list close.
+ status = private_fl_fss_destination_increase_by(2, destination);
if (F_status_is_error(status)) break;
destination->string[destination->used++] = f_fss_delimit_slash;
/**
* Read an fss-0003 content.
*
- * @fixme the recursive part of this is actually fss-0008 (Embedded) content, fss-0003 is not recursive, oops!
- *
* This will record where delimit placeholders exist but will not apply the delimits.
*
- * This operates on the assumption that found.array[0].array[found.array[0].used].content is the current content being processed.
- * Therefore the object for this content will also need to be found.array[0].array[found.array[0].used].object.
- * The object at depth 0 will not be populated, but all nested objects will be populated at their respective depth along with the content.
+ * This does not utilize recursion and has a max content depth of 1, see fss-0008 (Embedded List) for that purpose.
*
* @param buffer
* The buffer to read from.
* Errors (with error bit) from: f_fss_skip_past_space().
*/
#ifndef _di_fl_fss_extended_list_content_read_
- extern f_return_status fl_fss_extended_list_content_read(f_string_dynamic_t *buffer, f_string_range_t *range, f_fss_nest_t *found, f_fss_delimits_t *delimits, f_fss_comments_t *comments);
+ extern f_return_status fl_fss_extended_list_content_read(f_string_dynamic_t *buffer, 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_
/**
}
#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_)
+#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_return_status 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 status = F_none;
return status;
}
-#endif // !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_)
+#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_return_status private_fl_fss_basic_list_write_object_trim(const f_string_length_t used_start, f_string_dynamic_t *destination) {
}
#endif // !defined(_di_fl_fss_basic_object_write_string_) || !defined(_di_fl_fss_extended_object_write_string_) || !defined(_di_fl_fss_extended_content_write_string_)
-#if !defined(_di_fl_fss_basic_object_write_string_) || !defined(_di_fl_fss_basic_content_write_string_) || !defined(_di_fl_fss_basic_list_object_write_string_) || !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_object_write_string_) || !defined(_di_fl_fss_extended_content_write_string_) || !defined(_di_fl_fss_extended_list_object_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_)
+#if !defined(_di_fl_fss_basic_object_write_string_) || !defined(_di_fl_fss_basic_content_write_string_) || !defined(_di_fl_fss_basic_list_object_write_string_) || !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_object_write_string_) || !defined(_di_fl_fss_extended_content_write_string_) || !defined(_di_fl_fss_extended_list_object_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_) || !defined(_di_fl_fss_embedded_list_object_read_) || !defined(_di_fl_fss_embedded_list_content_read_)
f_return_status private_fl_fss_delimits_increase(f_fss_delimits_t *delimits) {
f_status_t status = F_none;
return status;
}
-#endif // !defined(_di_fl_fss_basic_object_write_string_) || !defined(_di_fl_fss_basic_content_write_string_) || !defined(_di_fl_fss_basic_list_object_write_string_) || !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_object_write_string_) || !defined(_di_fl_fss_extended_content_write_string_) || !defined(_di_fl_fss_extended_list_object_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_)
+#endif // !defined(_di_fl_fss_basic_object_write_string_) || !defined(_di_fl_fss_basic_content_write_string_) || !defined(_di_fl_fss_basic_list_object_write_string_) || !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_object_write_string_) || !defined(_di_fl_fss_extended_content_write_string_) || !defined(_di_fl_fss_extended_list_object_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_) || !defined(_di_fl_fss_embedded_list_object_read_) || !defined(_di_fl_fss_embedded_list_content_read_)
-#if !defined(_di_fl_fss_basic_object_write_string_) || !defined(_di_fl_fss_basic_content_write_string_) || !defined(_di_fl_fss_basic_list_object_write_string_) || !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_object_write_string_) || !defined(_di_fl_fss_extended_content_write_string_) || !defined(_di_fl_fss_extended_list_object_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_)
+#if !defined(_di_fl_fss_basic_object_write_string_) || !defined(_di_fl_fss_basic_content_write_string_) || !defined(_di_fl_fss_basic_list_object_write_string_) || !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_object_write_string_) || !defined(_di_fl_fss_extended_content_write_string_) || !defined(_di_fl_fss_extended_list_object_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_) || !defined(_di_fl_fss_embedded_list_object_read_) || !defined(_di_fl_fss_embedded_list_content_read_)
f_return_status private_fl_fss_delimits_increase_by(const f_string_length_t amount, f_fss_delimits_t *delimits) {
f_status_t status = F_none;
return status;
}
-#endif // !defined(_di_fl_fss_basic_object_write_string_) || !defined(_di_fl_fss_basic_content_write_string_) || !defined(_di_fl_fss_basic_list_object_write_string_) || !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_object_write_string_) || !defined(_di_fl_fss_extended_content_write_string_) || !defined(_di_fl_fss_extended_list_object_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_)
+#endif // !defined(_di_fl_fss_basic_object_write_string_) || !defined(_di_fl_fss_basic_content_write_string_) || !defined(_di_fl_fss_basic_list_object_write_string_) || !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_object_write_string_) || !defined(_di_fl_fss_extended_content_write_string_) || !defined(_di_fl_fss_extended_list_object_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_) || !defined(_di_fl_fss_embedded_list_object_read_) || !defined(_di_fl_fss_embedded_list_content_read_)
-#if !defined(_di_fl_fss_basic_object_write_string_) || !defined(_di_fl_fss_basic_content_write_string_) || !defined(_di_fl_fss_basic_list_object_write_string_) || !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_object_write_string_) || !defined(_di_fl_fss_extended_content_write_string_) || !defined(_di_fl_fss_extended_list_object_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_)
+#if !defined(_di_fl_fss_basic_object_write_string_) || !defined(_di_fl_fss_basic_content_write_string_) || !defined(_di_fl_fss_basic_list_object_write_string_) || !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_object_write_string_) || !defined(_di_fl_fss_extended_content_write_string_) || !defined(_di_fl_fss_extended_list_object_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_) || !defined(_di_fl_fss_embedded_list_object_read_) || !defined(_di_fl_fss_embedded_list_content_read_)
f_return_status private_fl_fss_destination_increase(f_string_dynamic_t *destination) {
f_status_t status = F_none;
f_macro_string_dynamic_t_resize(status, (*destination), destination->size + f_fss_default_allocation_step);
return status;
}
-#endif // !defined(_di_fl_fss_basic_object_write_string_) || !defined(_di_fl_fss_basic_content_write_string_) || !defined(_di_fl_fss_basic_list_object_write_string_) || !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_object_write_string_) || !defined(_di_fl_fss_extended_content_write_string_) || !defined(_di_fl_fss_extended_list_object_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_)
+#endif // !defined(_di_fl_fss_basic_object_write_string_) || !defined(_di_fl_fss_basic_content_write_string_) || !defined(_di_fl_fss_basic_list_object_write_string_) || !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_object_write_string_) || !defined(_di_fl_fss_extended_content_write_string_) || !defined(_di_fl_fss_extended_list_object_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_) || !defined(_di_fl_fss_embedded_list_object_read_) || !defined(_di_fl_fss_embedded_list_content_read_)
-#if !defined(_di_fl_fss_basic_object_write_string_) || !defined(_di_fl_fss_basic_content_write_string_) || !defined(_di_fl_fss_basic_list_object_write_string_) || !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_object_write_string_) || !defined(_di_fl_fss_extended_content_write_string_) || !defined(_di_fl_fss_extended_list_object_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_)
+#if !defined(_di_fl_fss_basic_object_write_string_) || !defined(_di_fl_fss_basic_content_write_string_) || !defined(_di_fl_fss_basic_list_object_write_string_) || !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_object_write_string_) || !defined(_di_fl_fss_extended_content_write_string_) || !defined(_di_fl_fss_extended_list_object_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_) || !defined(_di_fl_fss_embedded_list_object_read_) || !defined(_di_fl_fss_embedded_list_content_read_)
f_return_status private_fl_fss_destination_increase_by(const f_string_length_t amount, f_string_dynamic_t *destination) {
f_status_t status = F_none;
f_macro_string_dynamic_t_resize(status, (*destination), destination->size + amount);
return status;
}
-#endif // !defined(_di_fl_fss_basic_object_write_string_) || !defined(_di_fl_fss_basic_content_write_string_) || !defined(_di_fl_fss_basic_list_object_write_string_) || !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_object_write_string_) || !defined(_di_fl_fss_extended_content_write_string_) || !defined(_di_fl_fss_extended_list_object_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_)
+#endif // !defined(_di_fl_fss_basic_object_write_string_) || !defined(_di_fl_fss_basic_content_write_string_) || !defined(_di_fl_fss_basic_list_object_write_string_) || !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_object_write_string_) || !defined(_di_fl_fss_extended_content_write_string_) || !defined(_di_fl_fss_extended_list_object_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_) || !defined(_di_fl_fss_embedded_list_object_read_) || !defined(_di_fl_fss_embedded_list_content_read_)
#if !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_)
f_return_status private_fl_fss_destination_prepend(const f_string_static_t *prepend, f_string_dynamic_t *destination) {
}
#endif // !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_)
-#if !defined(_di_fl_fss_extended_list_object_read_) || !defined(_di_fl_fss_extended_list_content_read_)
+#if !defined(_di_fl_fss_embedded_list_object_read_) || !defined(_di_fl_fss_embedded_list_content_read_)
f_return_status private_fl_fss_nest_increase(f_fss_nest_t *nest) {
f_status_t status = F_none;
return status;
}
-#endif // !defined(_di_fl_fss_extended_list_object_read_) || !defined(_di_fl_fss_extended_list_content_read_)
+#endif // !defined(_di_fl_fss_embedded_list_object_read_) || !defined(_di_fl_fss_embedded_list_content_read_)
-#if !defined(_di_fl_fss_basic_object_read_) || !defined(_di_fl_fss_basic_content_read_) || !defined(_di_fl_fss_extended_object_read_) || !defined(_di_fl_fss_extended_content_read_) || !defined(_di_fl_fss_basic_list_object_read_) || !defined(_di_fl_fss_basic_list_content_read_) || !defined(_di_fl_fss_extended_list_object_read_) || !defined(_di_fl_fss_extended_list_content_read_)
+#if !defined(_di_fl_fss_basic_object_read_) || !defined(_di_fl_fss_basic_content_read_) || !defined(_di_fl_fss_extended_object_read_) || !defined(_di_fl_fss_extended_content_read_) || !defined(_di_fl_fss_basic_list_object_read_) || !defined(_di_fl_fss_basic_list_content_read_) || !defined(_di_fl_fss_extended_list_object_read_) || !defined(_di_fl_fss_extended_list_content_read_) || !defined(_di_fl_fss_embedded_list_object_read_) || !defined(_di_fl_fss_embedded_list_content_read_)
f_return_status private_fl_fss_ranges_increase(f_string_ranges_t *ranges) {
f_status_t status = F_none;
return status;
}
-#endif // !defined(_di_fl_fss_basic_object_read_) || !defined(_di_fl_fss_basic_content_read_) || !defined(_di_fl_fss_extended_object_read_) || !defined(_di_fl_fss_extended_content_read_) || !defined(_di_fl_fss_basic_list_object_read_) || !defined(_di_fl_fss_basic_list_content_read_) || !defined(_di_fl_fss_extended_list_object_read_) || !defined(_di_fl_fss_extended_list_content_read_)
+#endif // !defined(_di_fl_fss_basic_object_read_) || !defined(_di_fl_fss_basic_content_read_) || !defined(_di_fl_fss_extended_object_read_) || !defined(_di_fl_fss_extended_content_read_) || !defined(_di_fl_fss_basic_list_object_read_) || !defined(_di_fl_fss_basic_list_content_read_) || !defined(_di_fl_fss_extended_list_object_read_) || !defined(_di_fl_fss_extended_list_content_read_) || !defined(_di_fl_fss_embedded_list_object_read_) || !defined(_di_fl_fss_embedded_list_content_read_)
#ifdef __cplusplus
} // extern "C"
* Errors (with error bit) from: private_fl_fss_destination_increase().
*
* @see fl_fss_basic_list_content_write_string()
+ * @see fl_fss_embedded_list_content_write_string()
* @see fl_fss_extended_list_content_write_string()
* @see private_fl_fss_destination_increase()
*/
-#if !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_list_content_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_)
extern f_return_status 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_gcc_attribute_visibility_internal;
-#endif // !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_)
+#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.
* F_memory_reallocation (with error bit) on reallocation error.
* F_array_too_large (with error bit) if appended string length is too large to store in the delimits.
*
- * @see fl_fss_basic_object_write_string()
* @see fl_fss_basic_content_write_string()
- * @see fl_fss_basic_list_object_write_string()
+ * @see fl_fss_basic_object_write_string()
* @see fl_fss_basic_list_content_write_string()
- * @see fl_fss_extended_object_write_string()
+ * @see fl_fss_basic_list_object_write_string()
+ * @see fl_fss_embedded_list_content_read()
+ * @see fl_fss_embedded_list_object_read()
* @see fl_fss_extended_content_write_string()
- * @see fl_fss_extended_list_object_write_string()
* @see fl_fss_extended_list_content_write_string()
+ * @see fl_fss_extended_list_object_write_string()
+ * @see fl_fss_extended_object_write_string()
*/
-#if !defined(_di_fl_fss_basic_object_write_string_) || !defined(_di_fl_fss_basic_content_write_string_) || !defined(_di_fl_fss_basic_list_object_write_string_) || !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_object_write_string_) || !defined(_di_fl_fss_extended_content_write_string_) || !defined(_di_fl_fss_extended_list_object_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_)
+#if !defined(_di_fl_fss_basic_object_write_string_) || !defined(_di_fl_fss_basic_content_write_string_) || !defined(_di_fl_fss_basic_list_object_write_string_) || !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_object_write_string_) || !defined(_di_fl_fss_extended_content_write_string_) || !defined(_di_fl_fss_extended_list_object_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_) || !defined(_di_fl_fss_embedded_list_object_read_) || !defined(_di_fl_fss_embedded_list_content_read_)
extern f_return_status private_fl_fss_delimits_increase(f_fss_delimits_t *delimits) f_gcc_attribute_visibility_internal;
-#endif // !defined(_di_fl_fss_basic_object_write_string_) || !defined(_di_fl_fss_basic_content_write_string_) || !defined(_di_fl_fss_basic_list_object_write_string_) || !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_object_write_string_) || !defined(_di_fl_fss_extended_content_write_string_) || !defined(_di_fl_fss_extended_list_object_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_)
+#endif // !defined(_di_fl_fss_basic_object_write_string_) || !defined(_di_fl_fss_basic_content_write_string_) || !defined(_di_fl_fss_basic_list_object_write_string_) || !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_object_write_string_) || !defined(_di_fl_fss_extended_content_write_string_) || !defined(_di_fl_fss_extended_list_object_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_) || !defined(_di_fl_fss_embedded_list_object_read_) || !defined(_di_fl_fss_embedded_list_content_read_)
/**
* Increase the size of delimits array by the given amount, but only if necessary.
* F_memory_reallocation (with error bit) on reallocation error.
* F_array_too_large (with error bit) if increased string length is too large to store in the delimits.
*
- * @see fl_fss_basic_object_write_string()
* @see fl_fss_basic_content_write_string()
- * @see fl_fss_basic_list_object_write_string()
+ * @see fl_fss_basic_object_write_string()
* @see fl_fss_basic_list_content_write_string()
- * @see fl_fss_extended_object_write_string()
+ * @see fl_fss_basic_list_object_write_string()
+ * @see fl_fss_embedded_list_content_read()
+ * @see fl_fss_embedded_list_object_read()
* @see fl_fss_extended_content_write_string()
- * @see fl_fss_extended_list_object_write_string()
* @see fl_fss_extended_list_content_write_string()
+ * @see fl_fss_extended_list_object_write_string()
+ * @see fl_fss_extended_object_write_string()
*/
-#if !defined(_di_fl_fss_basic_object_write_string_) || !defined(_di_fl_fss_basic_content_write_string_) || !defined(_di_fl_fss_basic_list_object_write_string_) || !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_object_write_string_) || !defined(_di_fl_fss_extended_content_write_string_) || !defined(_di_fl_fss_extended_list_object_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_)
+#if !defined(_di_fl_fss_basic_object_write_string_) || !defined(_di_fl_fss_basic_content_write_string_) || !defined(_di_fl_fss_basic_list_object_write_string_) || !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_object_write_string_) || !defined(_di_fl_fss_extended_content_write_string_) || !defined(_di_fl_fss_extended_list_object_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_) || !defined(_di_fl_fss_embedded_list_object_read_) || !defined(_di_fl_fss_embedded_list_content_read_)
extern f_return_status private_fl_fss_delimits_increase_by(const f_string_length_t amount, f_fss_delimits_t *delimits) f_gcc_attribute_visibility_internal;
-#endif // !defined(_di_fl_fss_basic_object_write_string_) || !defined(_di_fl_fss_basic_content_write_string_) || !defined(_di_fl_fss_basic_list_object_write_string_) || !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_object_write_string_) || !defined(_di_fl_fss_extended_content_write_string_) || !defined(_di_fl_fss_extended_list_object_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_)
+#endif // !defined(_di_fl_fss_basic_object_write_string_) || !defined(_di_fl_fss_basic_content_write_string_) || !defined(_di_fl_fss_basic_list_object_write_string_) || !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_object_write_string_) || !defined(_di_fl_fss_extended_content_write_string_) || !defined(_di_fl_fss_extended_list_object_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_) || !defined(_di_fl_fss_embedded_list_object_read_) || !defined(_di_fl_fss_embedded_list_content_read_)
/**
* Increase the size of destination buffer, but only if necessary.
* F_memory_reallocation (with error bit) on memory reallocation error.
* F_string_too_large (with error bit) if the new array length is too large.
*
- * @see fl_fss_basic_object_write_string()
* @see fl_fss_basic_content_write_string()
- * @see fl_fss_basic_list_object_write_string()
+ * @see fl_fss_basic_object_write_string()
* @see fl_fss_basic_list_content_write_string()
- * @see fl_fss_extended_object_write_string()
+ * @see fl_fss_basic_list_object_write_string()
+ * @see fl_fss_embedded_list_content_read()
+ * @see fl_fss_embedded_list_object_read()
* @see fl_fss_extended_content_write_string()
- * @see fl_fss_extended_list_object_write_string()
* @see fl_fss_extended_list_content_write_string()
+ * @see fl_fss_extended_list_object_write_string()
+ * @see fl_fss_extended_object_write_string()
*/
-#if !defined(_di_fl_fss_basic_object_write_string_) || !defined(_di_fl_fss_basic_content_write_string_) || !defined(_di_fl_fss_basic_list_object_write_string_) || !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_object_write_string_) || !defined(_di_fl_fss_extended_content_write_string_) || !defined(_di_fl_fss_extended_list_object_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_)
+#if !defined(_di_fl_fss_basic_object_write_string_) || !defined(_di_fl_fss_basic_content_write_string_) || !defined(_di_fl_fss_basic_list_object_write_string_) || !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_object_write_string_) || !defined(_di_fl_fss_extended_content_write_string_) || !defined(_di_fl_fss_extended_list_object_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_) || !defined(_di_fl_fss_embedded_list_object_read_) || !defined(_di_fl_fss_embedded_list_content_read_)
extern f_return_status private_fl_fss_destination_increase(f_string_dynamic_t *destination) f_gcc_attribute_visibility_internal;
-#endif // !defined(_di_fl_fss_basic_object_write_string_) || !defined(_di_fl_fss_basic_content_write_string_) || !defined(_di_fl_fss_basic_list_object_write_string_) || !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_object_write_string_) || !defined(_di_fl_fss_extended_content_write_string_) || !defined(_di_fl_fss_extended_list_object_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_)
+#endif // !defined(_di_fl_fss_basic_object_write_string_) || !defined(_di_fl_fss_basic_content_write_string_) || !defined(_di_fl_fss_basic_list_object_write_string_) || !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_object_write_string_) || !defined(_di_fl_fss_extended_content_write_string_) || !defined(_di_fl_fss_extended_list_object_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_) || !defined(_di_fl_fss_embedded_list_object_read_) || !defined(_di_fl_fss_embedded_list_content_read_)
/**
* Increase the size of destination buffer by the given amount, but only if necessary.
* F_memory_reallocation (with error bit) on memory reallocation error.
* F_string_too_large (with error bit) if the new array length is too large.
*
- * @see fl_fss_basic_object_write_string()
* @see fl_fss_basic_content_write_string()
- * @see fl_fss_basic_list_object_write_string()
+ * @see fl_fss_basic_object_write_string()
* @see fl_fss_basic_list_content_write_string()
- * @see fl_fss_extended_object_write_string()
+ * @see fl_fss_basic_list_object_write_string()
+ * @see fl_fss_embedded_list_content_read()
+ * @see fl_fss_embedded_list_object_read()
* @see fl_fss_extended_content_write_string()
- * @see fl_fss_extended_list_object_write_string()
* @see fl_fss_extended_list_content_write_string()
+ * @see fl_fss_extended_list_object_write_string()
+ * @see fl_fss_extended_object_write_string()
*/
-#if !defined(_di_fl_fss_basic_object_write_string_) || !defined(_di_fl_fss_basic_content_write_string_) || !defined(_di_fl_fss_basic_list_object_write_string_) || !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_object_write_string_) || !defined(_di_fl_fss_extended_content_write_string_) || !defined(_di_fl_fss_extended_list_object_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_)
+#if !defined(_di_fl_fss_basic_object_write_string_) || !defined(_di_fl_fss_basic_content_write_string_) || !defined(_di_fl_fss_basic_list_object_write_string_) || !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_object_write_string_) || !defined(_di_fl_fss_extended_content_write_string_) || !defined(_di_fl_fss_extended_list_object_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_) || !defined(_di_fl_fss_embedded_list_object_read_) || !defined(_di_fl_fss_embedded_list_content_read_)
extern f_return_status private_fl_fss_destination_increase_by(const f_string_length_t amount, f_string_dynamic_t *destination) f_gcc_attribute_visibility_internal;
-#endif // !defined(_di_fl_fss_basic_object_write_string_) || !defined(_di_fl_fss_basic_content_write_string_) || !defined(_di_fl_fss_basic_list_object_write_string_) || !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_object_write_string_) || !defined(_di_fl_fss_extended_content_write_string_) || !defined(_di_fl_fss_extended_list_object_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_)
+#endif // !defined(_di_fl_fss_basic_object_write_string_) || !defined(_di_fl_fss_basic_content_write_string_) || !defined(_di_fl_fss_basic_list_object_write_string_) || !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_object_write_string_) || !defined(_di_fl_fss_extended_content_write_string_) || !defined(_di_fl_fss_extended_list_object_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_) || !defined(_di_fl_fss_embedded_list_object_read_) || !defined(_di_fl_fss_embedded_list_content_read_)
/**
* Prepend the given string onto the destination buffer, allocating space as necessary.
* F_memory_reallocation (with error bit) on reallocation error.
* F_array_too_large (with error bit) if increased array length is too large to store in the range.
*
- * @see fl_fss_extended_list_object_read()
- * @see fl_fss_extended_list_content_read()
+ * @see fl_fss_embedded_list_object_read()
+ * @see fl_fss_embedded_list_content_read()
*/
-#if !defined(_di_fl_fss_extended_list_object_read_) || !defined(_di_fl_fss_extended_list_content_read_)
+#if !defined(_di_fl_fss_embedded_list_object_read_) || !defined(_di_fl_fss_embedded_list_content_read_)
extern f_return_status private_fl_fss_nest_increase(f_fss_nest_t *nest) f_gcc_attribute_visibility_internal;
-#endif // !defined(_di_fl_fss_extended_list_object_read_) || !defined(_di_fl_fss_extended_list_content_read_)
+#endif // !defined(_di_fl_fss_embedded_list_object_read_) || !defined(_di_fl_fss_embedded_list_content_read_)
/**
* Increase the size of a given range buffer, but only if necessary.
*
* @see fl_fss_basic_object_read()
* @see fl_fss_basic_content_read()
- * @see fl_fss_extended_object_read()
- * @see fl_fss_extended_content_read()
- * @see fl_fss_basic_list_object_read()
* @see fl_fss_basic_list_content_read()
- * @see fl_fss_extended_list_object_read()
+ * @see fl_fss_basic_list_object_read
+ * @see fl_fss_embedded_list_content_read()
+ * @see fl_fss_embedded_list_object_read()
+ * @see fl_fss_extended_content_read()
* @see fl_fss_extended_list_content_read()
+ * @see fl_fss_extended_list_object_read()
+ * @see fl_fss_extended_object_read()
*/
-#if !defined(_di_fl_fss_basic_object_read_) || !defined(_di_fl_fss_basic_content_read_) || !defined(_di_fl_fss_extended_object_read_) || !defined(_di_fl_fss_extended_content_read_) || !defined(_di_fl_fss_basic_list_object_read_) || !defined(_di_fl_fss_basic_list_content_read_) || !defined(_di_fl_fss_extended_list_object_read_) || !defined(_di_fl_fss_extended_list_content_read_)
+#if !defined(_di_fl_fss_basic_object_read_) || !defined(_di_fl_fss_basic_content_read_) || !defined(_di_fl_fss_extended_object_read_) || !defined(_di_fl_fss_extended_content_read_) || !defined(_di_fl_fss_basic_list_object_read_) || !defined(_di_fl_fss_basic_list_content_read_) || !defined(_di_fl_fss_extended_list_object_read_) || !defined(_di_fl_fss_extended_list_content_read_) || !defined(_di_fl_fss_embedded_list_object_read_) || !defined(_di_fl_fss_embedded_list_content_read_)
extern f_return_status private_fl_fss_ranges_increase(f_string_ranges_t *ranges) f_gcc_attribute_visibility_internal;
-#endif // !defined(_di_fl_fss_basic_object_read_) || !defined(_di_fl_fss_basic_content_read_) || !defined(_di_fl_fss_extended_object_read_) || !defined(_di_fl_fss_extended_content_read_) || !defined(_di_fl_fss_basic_list_object_read_) || !defined(_di_fl_fss_basic_list_content_read_) || !defined(_di_fl_fss_extended_list_object_read_) || !defined(_di_fl_fss_extended_list_content_read_)
+#endif // !defined(_di_fl_fss_basic_object_read_) || !defined(_di_fl_fss_basic_content_read_) || !defined(_di_fl_fss_extended_object_read_) || !defined(_di_fl_fss_extended_content_read_) || !defined(_di_fl_fss_basic_list_object_read_) || !defined(_di_fl_fss_basic_list_content_read_) || !defined(_di_fl_fss_extended_list_object_read_) || !defined(_di_fl_fss_extended_list_content_read_) || !defined(_di_fl_fss_embedded_list_object_read_) || !defined(_di_fl_fss_embedded_list_content_read_)
#ifdef __cplusplus
} // extern "C"
#endif
#ifndef _di_fll_fss_extended_list_read_
- f_return_status fll_fss_extended_list_read(f_string_dynamic_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) {
- #ifndef _di_level_3_parameter_checking_
+ f_return_status fll_fss_extended_list_read(f_string_dynamic_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) {
+ #ifndef _di_level_2_parameter_checking_
if (!buffer) return F_status_set_error(F_parameter);
if (!range) return F_status_set_error(F_parameter);
- if (!nest) return F_status_set_error(F_parameter);
+ if (!objects) return F_status_set_error(F_parameter);
+ if (!contents) return F_status_set_error(F_parameter);
if (!objects_delimits) return F_status_set_error(F_parameter);
- if (!comments) return F_status_set_error(F_parameter);
- #endif // _di_level_3_parameter_checking_
+ #endif // _di_level_2_parameter_checking_
f_status_t status = F_none;
f_status_t status2 = F_none;
- f_string_length_t initial_used = 0;
+ f_string_length_t initial_used = objects->used;
bool found_data = F_false;
- if (!nest->used) {
- f_macro_fss_nest_t_resize(status2, (*nest), f_fss_default_allocation_step);
- if (F_status_is_error(status2)) return status2;
- }
- else {
- initial_used = nest->depth[0].used;
- }
-
do {
- do {
- if (nest->depth[0].used == nest->depth[0].size) {
- f_macro_fss_items_t_resize(status2, nest->depth[0], nest->depth[0].used + f_fss_default_allocation_step);
- if (F_status_is_error(status)) return status;
- }
+ if (objects->used == objects->size) {
+ f_macro_fss_objects_t_resize(status2, (*objects), objects->used + f_fss_default_allocation_step);
+ if (F_status_is_error(status)) return status;
+
+ f_macro_fss_contents_t_resize(status2, (*contents), contents->used + f_fss_default_allocation_step);
+ if (F_status_is_error(status)) return status;
+ }
- status = fl_fss_extended_list_object_read(buffer, range, &nest->depth[0].array[nest->depth[0].used].object, objects_delimits);
+ do {
+ status = fl_fss_extended_list_object_read(buffer, 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++;
+
+ if (contents->array[contents->used].used == contents->array[contents->used].size) {
+ f_macro_fss_content_t_resize(status2, contents->array[contents->used], contents->array[contents->used].size + f_fss_default_allocation_step);
+ if (F_status_is_error(status2)) return status2;
+ }
+
+ contents->used++;
- // extended list requires content closure, so this could be an error.
return FL_fss_found_object_content_not;
}
if (status == FL_fss_found_object) {
found_data = F_true;
- status = fl_fss_extended_list_content_read(buffer, range, nest, contents_delimits ? contents_delimits : objects_delimits, comments);
+ status = fl_fss_extended_list_content_read(buffer, 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;
+
+ if (contents->array[contents->used].used == contents->array[contents->used].size) {
+ f_macro_fss_content_t_resize(status2, contents->array[contents->used], contents->array[contents->used].size + f_fss_default_allocation_step);
+ if (F_status_is_error(status2)) return status2;
+ }
+
break;
}
} while (status == FL_fss_found_object_not);
if (status == F_none_eos || status == F_none_stop) {
+ contents->array[contents->used].used++;
+ objects->used++;
+ contents->used++;
return status;
}
else if (status == F_data_not_eos || status == F_data_not_stop) {
// If at least some valid object was found, then return F_none equivalents.
- if (nest->depth[0].used > initial_used) {
- if (status == F_data_not_eos) return F_none_eos;
- if (status == F_data_not_stop) return F_none_stop;
- }
-
- return status;
- }
- else if (status == F_unterminated_eos || status == F_unterminated_stop || status == F_unterminated_nest_eos || status == F_unterminated_nest_stop) {
+ if (objects->used > initial_used) {
+ if (status == F_data_not_eos) {
+ return F_none_eos;
+ }
- // If at least some valid object was found, then return F_none equivalents.
- if (nest->depth[0].used > initial_used) {
- if (status == F_data_not_eos) return F_none_eos;
- if (status == F_data_not_stop) return F_none_stop;
+ if (status == F_data_not_stop) {
+ return F_none_stop;
+ }
}
return status;
else if (status != FL_fss_found_object && status != FL_fss_found_content && status != FL_fss_found_content_not && status != FL_fss_found_object_content_not) {
return status;
}
- // When content is found, the range->start is incremented, if content is found at range->stop, then range->start will be > range.stop.
else if (range->start >= range->stop || range->start >= buffer->used) {
+
+ // When content is found, the range->start is incremented, if content is found at range->stop, then range->start will be > range.stop.
+ if (status == FL_fss_found_object || status == FL_fss_found_content || status == FL_fss_found_content_not || status == FL_fss_found_object_content_not) {
+ objects->used++;
+ contents->used++;
+ }
+
if (range->start >= buffer->used) {
return F_none_eos;
}
return F_none_stop;
}
+
+ objects->used++;
+ contents->used++;
} while (range->start < f_string_length_t_size);
return F_status_is_error(F_number_overflow);
/**
* Read a buffer expected to be in fss-0003 format, getting all objects and their respective content.
*
+ * This does not utilize recursion and has a max content depth of 1, see fss-0008 (Embedded List) for that purpose.
+ *
* @param buffer
* The buffer to read from.
* @param range
* The range within the buffer that is currently being read.
- * @param nest
- * An nested set of all objects and content.
+ * @param objects
+ * This will be populated with all valid objects found.
+ * @param contents
+ * This will be populated with all valid contents found.
* @param objects_delimits
* An array of delimits for objects detected during processing.
* The caller is expected to decide if and when to process them.
* Errors (with error bit) from: fl_fss_extended_list_object_read().
*/
#ifndef _di_fll_fss_extended_list_read_
- extern f_return_status fll_fss_extended_list_read(f_string_dynamic_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_return_status fll_fss_extended_list_read(f_string_dynamic_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);
#endif // _di_fll_fss_extended_list_read_
/**
fprintf(output.stream, "%c", f_string_eol[0]);
- fprintf(output.stream, " This program will print the content associated with the given object and content data based on the FSS-0002 Basic List standard.%c", f_string_eol[0]);
+ fprintf(output.stream, " This program will print the content associated with the given object and content data based on the FSS-0003 Extended List standard.%c", f_string_eol[0]);
fprintf(output.stream, "%c", f_string_eol[0]);
{
f_console_parameter_id_t ids[3] = { fss_extended_list_read_parameter_no_color, fss_extended_list_read_parameter_light, fss_extended_list_read_parameter_dark };
- const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 3);
+ const f_console_parameter_ids_t choices = { ids, 3 };
status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context);
fss_extended_list_read_print_help(data->output, data->context);
fss_extended_list_read_delete_data(data);
- return F_none;
+ return status;
}
if (data->parameters[fss_extended_list_read_parameter_version].result == f_console_result_found) {
fll_program_print_version(data->output, fss_extended_list_read_version);
fss_extended_list_read_delete_data(data);
- return F_none;
+ return status;
}
if (data->remaining.used > 0 || data->process_pipe) {
status = F_status_set_error(F_parameter);
}
- if (data->parameters[fss_extended_list_read_parameter_object].result == f_console_result_found) {
- if (F_status_is_error_not(status) && data->parameters[fss_extended_list_read_parameter_line].result == f_console_result_additional) {
+ if (F_status_is_error_not(status) && data->parameters[fss_extended_list_read_parameter_object].result == f_console_result_found) {
+ if (data->parameters[fss_extended_list_read_parameter_line].result == f_console_result_additional) {
fl_color_print(data->error.to.stream, data->context.set.error, "%sCannot specify the '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_object);
fl_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '");
}
}
- if (data->parameters[fss_extended_list_read_parameter_line].result == f_console_result_additional) {
- if (F_status_is_error_not(status) && data->parameters[fss_extended_list_read_parameter_total].result == f_console_result_found) {
+ if (F_status_is_error_not(status) && data->parameters[fss_extended_list_read_parameter_line].result == f_console_result_additional) {
+ if (data->parameters[fss_extended_list_read_parameter_total].result == f_console_result_found) {
fl_color_print(data->error.to.stream, data->context.set.error, "%sCannot specify the '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_line);
fl_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '");
}
}
- if (data->parameters[fss_extended_list_read_parameter_pipe].result == f_console_result_found) {
- if (F_status_is_error_not(status) && data->parameters[fss_extended_list_read_parameter_total].result == f_console_result_found) {
+ if (F_status_is_error_not(status) && data->parameters[fss_extended_list_read_parameter_pipe].result == f_console_result_found) {
+ if (data->parameters[fss_extended_list_read_parameter_total].result == f_console_result_found) {
fl_color_print(data->error.to.stream, data->context.set.error, "%sCannot specify the '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_pipe);
fl_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '");
fss_extended_list_read_depths_t depths = fss_extended_list_read_depths_t_initialize;
- f_fss_delimits_t objects_delimits = f_fss_delimits_t_initialize;
- f_fss_delimits_t contents_delimits = f_fss_delimits_t_initialize;
+ f_fss_delimits_t delimits = f_fss_delimits_t_initialize;
f_fss_comments_t comments = f_fss_comments_t_initialize;
f_string_length_t original_size = data->quantity.total;
}
}
+ // This standard does not support nesting, so any depth greater than 0 can be predicted without processing the file.
+ if (F_status_is_error_not(status) && depths.array[0].depth > 0) {
+ macro_fss_extended_list_read_depths_t_delete_simple(depths);
+ f_macro_fss_delimits_t_delete_simple(delimits);
+ f_macro_fss_comments_t_delete_simple(comments);
+
+ if (data->parameters[fss_extended_list_read_parameter_total].result == f_console_result_found) {
+ fprintf(data->output.stream, "0%c", f_string_eol[0]);
+ }
+
+ fss_extended_list_read_delete_data(data);
+ return F_none;
+ }
+
if (F_status_is_error_not(status) && data->parameters[fss_extended_list_read_parameter_select].result == f_console_result_found) {
fl_color_print(data->error.to.stream, data->context.set.error, "%sThe '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_select);
fll_error_file_print(data->error, F_status_set_fine(status), "f_file_read", F_true, "-", "read", fll_error_file_type_pipe);
}
else {
- status = fss_extended_list_read_main_process_file(arguments, data, "-", depths, &objects_delimits, &contents_delimits, &comments);
+ status = fss_extended_list_read_main_process_file(arguments, data, "-", depths, &delimits, &comments);
if (F_status_is_error(status)) {
fll_error_file_print(data->error, F_status_set_fine(status), "fss_extended_list_read_main_process_file", F_true, "-", "read", fll_error_file_type_pipe);
}
// Clear buffers before continuing.
- f_macro_fss_nest_t_delete_simple(data->nest);
+ f_macro_fss_contents_t_delete_simple(data->contents);
+ f_macro_fss_objects_t_delete_simple(data->objects);
f_macro_string_dynamic_t_delete_simple(data->buffer);
}
if (!data->quantity.total) {
status = f_file_size_by_id(file.id, &data->quantity.total);
+
if (F_status_is_error(status)) {
fll_error_file_print(data->error, F_status_set_fine(status), "f_file_size_by_id", F_true, arguments.argv[data->remaining.array[i]], "read", fll_error_file_type_file);
break;
}
- status = fss_extended_list_read_main_process_file(arguments, data, arguments.argv[data->remaining.array[i]], depths, &objects_delimits, &contents_delimits, &comments);
+ status = fss_extended_list_read_main_process_file(arguments, data, arguments.argv[data->remaining.array[i]], depths, &delimits, &comments);
if (F_status_is_error(status)) {
fll_error_file_print(data->error, F_status_set_fine(status), "fss_extended_list_read_main_process_file", F_true, arguments.argv[data->remaining.array[i]], "read", fll_error_file_type_file);
}
// Clear buffers before repeating the loop.
- f_macro_fss_nest_t_delete_simple(data->nest);
+ f_macro_fss_contents_t_delete_simple(data->contents);
+ f_macro_fss_objects_t_delete_simple(data->objects);
f_macro_string_dynamic_t_delete_simple(data->buffer);
} // for
if (F_status_is_error(status)) {
- f_macro_fss_nest_t_delete_simple(data->nest);
+ f_macro_fss_contents_t_delete_simple(data->contents);
+ f_macro_fss_objects_t_delete_simple(data->objects);
f_macro_string_dynamic_t_delete_simple(data->buffer);
}
}
macro_fss_extended_list_read_depths_t_delete_simple(depths);
- f_macro_fss_delimits_t_delete_simple(objects_delimits);
- f_macro_fss_delimits_t_delete_simple(contents_delimits);
+ f_macro_fss_delimits_t_delete_simple(delimits);
f_macro_fss_comments_t_delete_simple(comments);
}
else {
f_macro_string_lengths_t_delete_simple(data->parameters[i].values);
} // for
- f_macro_fss_nest_t_delete_simple(data->nest);
-
+ f_macro_fss_contents_t_delete_simple(data->contents);
+ f_macro_fss_objects_t_delete_simple(data->objects);
f_macro_string_dynamic_t_delete_simple(data->buffer);
f_macro_string_lengths_t_delete_simple(data->remaining);
* API Version: 0.5
* Licenses: lgplv2.1
*
- * This is the FSS Basic List Read program
+ * This is the FSS Extended List Read program
* This program utilizes the Featureless Linux Library.
* This program processes files or other input in fss format and stores the results in the fss_extended_list_read_data_t.
*
f_console_parameter_t_initialize(f_console_standard_short_help, f_console_standard_long_help, 0, 0, f_console_type_normal), \
f_console_parameter_t_initialize(f_console_standard_short_light, f_console_standard_long_light, 0, 0, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_dark, f_console_standard_long_dark, 0, 0, f_console_type_inverse), \
- f_console_parameter_t_initialize(f_console_standard_short_no_color, f_console_standard_long_no_color, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_no_color, f_console_standard_long_no_color, 0, F_false, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_quiet, f_console_standard_long_quiet, 0, 0, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_normal, f_console_standard_long_normal, 0, 0, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_verbose, f_console_standard_long_verbose, 0, 0, f_console_type_inverse), \
fll_error_print_t error;
f_string_dynamic_t buffer;
- f_fss_nest_t nest;
+ f_fss_objects_t objects;
+ f_fss_contents_t contents;
f_string_quantity_t quantity;
uint8_t delimit_mode;
f_macro_file_t_initialize(f_type_output, f_type_descriptor_output, f_file_flag_write_only), \
fll_error_print_t_initialize, \
f_string_dynamic_t_initialize, \
- f_fss_nest_t_initialize, \
+ f_fss_objects_t_initialize, \
+ f_fss_contents_t_initialize, \
f_string_quantity_t_initialize, \
fss_extended_list_read_delimit_mode_all, \
0, \
f_return_status fss_extended_list_read_main_preprocess_depth(const f_console_arguments_t arguments, const fss_extended_list_read_data_t data, fss_extended_list_read_depths_t *depths) {
f_status_t status = F_none;
- const f_array_length_t values_total = data.parameters[fss_extended_list_read_parameter_depth].values.used + data.parameters[fss_extended_list_read_parameter_at].values.used + data.parameters[fss_extended_list_read_parameter_name].values.used;
-
- f_array_length_t values_order[values_total];
- f_array_length_t values_type[values_total];
-
- f_array_length_t i = 0;
- f_array_length_t j = 0;
-
- // determine the linear order in which all of the three parameter values are to be applied.
- if (values_total) {
- memset(values_order, 0, values_total);
-
- f_array_length_t k = 0;
- f_array_length_t l = 0;
-
- for (; j < data.parameters[fss_extended_list_read_parameter_depth].values.used; ++j) {
-
- values_order[i] = data.parameters[fss_extended_list_read_parameter_depth].values.array[j];
- values_type[i++] = fss_extended_list_read_parameter_depth;
- } // for
-
- if (i) {
- for (j = 0; j < data.parameters[fss_extended_list_read_parameter_at].values.used; ++j) {
-
- for (k = 0; k < i; ++k) {
-
- if (values_order[k] > data.parameters[fss_extended_list_read_parameter_at].values.array[j]) {
- for (l = i; l > k; --l) {
- values_order[l] = values_order[l - 1];
- values_type[l] = values_type[l - 1];
- } // for
-
- values_order[k] = data.parameters[fss_extended_list_read_parameter_at].values.array[j];
- values_type[k] = fss_extended_list_read_parameter_at;
- i++;
- break;
- }
- } // for
+ {
+ f_array_length_t depth_size = 1;
- if (k == i) {
- values_order[i] = data.parameters[fss_extended_list_read_parameter_at].values.array[j];
- values_type[i++] = fss_extended_list_read_parameter_at;
- }
- } // for
+ if (data.parameters[fss_extended_list_read_parameter_depth].result == f_console_result_additional) {
+ depth_size = data.parameters[fss_extended_list_read_parameter_depth].values.used;
}
- else {
- for (; j < data.parameters[fss_extended_list_read_parameter_at].values.used; ++j) {
- values_order[i] = data.parameters[fss_extended_list_read_parameter_at].values.array[j];
- values_type[i++] = fss_extended_list_read_parameter_at;
- } // for
+ macro_fss_extended_list_read_depths_t_new(status, (*depths), depth_size);
+
+ if (F_status_is_error(status)) {
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol[0]);
+ return status;
}
- if (i) {
- for (j = 0; j < data.parameters[fss_extended_list_read_parameter_name].values.used; ++j) {
+ depths->used = depth_size;
+ }
- for (k = 0; k < i; ++k) {
+ f_array_length_t position_depth = 0;
+ f_array_length_t position_at = 0;
+ f_array_length_t position_name = 0;
- if (values_order[k] > data.parameters[fss_extended_list_read_parameter_name].values.array[j]) {
- for (l = i; l > k; --l) {
- values_order[l] = values_order[l - 1];
- values_type[l] = values_type[l - 1];
- } // for
+ for (f_array_length_t i = 0; i < depths->used; i++) {
+ depths->array[i].depth = 0;
+ depths->array[i].index_at = 0;
+ depths->array[i].index_name = 0;
+ depths->array[i].value_at = 0;
- values_order[k] = data.parameters[fss_extended_list_read_parameter_name].values.array[j];
- values_type[k] = fss_extended_list_read_parameter_name;
- i++;
- break;
- }
- } // for
+ f_macro_string_dynamic_t_clear(depths->array[i].value_name);
- if (k == i) {
- values_order[i] = data.parameters[fss_extended_list_read_parameter_name].values.array[j];
- values_type[i++] = fss_extended_list_read_parameter_name;
- }
- } // for
+ if (!data.parameters[fss_extended_list_read_parameter_depth].values.used) {
+ position_depth = 0;
}
else {
- for (; j < data.parameters[fss_extended_list_read_parameter_name].values.used; ++j) {
+ position_depth = data.parameters[fss_extended_list_read_parameter_depth].values.array[i];
- values_order[i] = data.parameters[fss_extended_list_read_parameter_name].values.array[j];
- values_type[i++] = fss_extended_list_read_parameter_name;
- } // for
- }
- }
+ const f_string_range_t range = f_macro_string_range_t_initialize(strlen(arguments.argv[position_depth]));
- {
- i = 1;
+ status = fl_conversion_string_to_number_unsigned(arguments.argv[position_depth], &depths->array[i].depth, range);
- if (data.parameters[fss_extended_list_read_parameter_depth].result == f_console_result_additional) {
- i = data.parameters[fss_extended_list_read_parameter_depth].values.used + 1;
+ if (F_status_is_error(status)) {
+ fll_error_parameter_integer_print(data.error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_list_read_long_depth, arguments.argv[position_depth]);
+ return status;
+ }
}
- macro_fss_extended_list_read_depths_t_new(status, (*depths), i);
-
- if (F_status_is_error(status)) {
- fll_error_print(data.error, F_status_set_fine(status), "fss_extended_list_read_main_preprocess_depth", F_true);
- return status;
- }
- }
+ if (data.parameters[fss_extended_list_read_parameter_at].result == f_console_result_additional) {
+ for (; position_at < data.parameters[fss_extended_list_read_parameter_at].values.used; position_at++) {
- // provide default level-0 depth values.
- depths->array[0].depth = 0;
- depths->array[0].index_at = 0;
- depths->array[0].index_name = 0;
- depths->array[0].value_at = 0;
+ if (data.parameters[fss_extended_list_read_parameter_at].values.array[position_at] < position_depth) {
+ continue;
+ }
- {
- f_number_unsigned_t number = 0;
- bool first_depth = F_true;
+ if (i + 1 < depths->used && data.parameters[fss_extended_list_read_parameter_at].values.array[position_at] > data.parameters[fss_extended_list_read_parameter_depth].values.array[i + 1]) {
+ break;
+ }
- for (i = 0; i < values_total; ++i) {
+ depths->array[i].index_at = data.parameters[fss_extended_list_read_parameter_at].values.array[position_at];
- if (values_type[i] == fss_extended_list_read_parameter_depth || values_type[i] == fss_extended_list_read_parameter_at) {
- const f_string_range_t range = f_macro_string_range_t_initialize(strlen(arguments.argv[values_order[i]]));
+ const f_string_range_t range = f_macro_string_range_t_initialize(strlen(arguments.argv[depths->array[i].index_at]));
- status = fl_conversion_string_to_number_unsigned(arguments.argv[values_order[i]], &number, range);
+ status = fl_conversion_string_to_number_unsigned(arguments.argv[depths->array[i].index_at], &depths->array[i].value_at, range);
if (F_status_is_error(status)) {
- fll_error_parameter_integer_print(data.error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_list_read_long_depth, arguments.argv[values_order[i]]);
+ fll_error_parameter_integer_print(data.error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_list_read_long_at, arguments.argv[depths->array[i].index_at]);
return status;
}
- }
+ } // for
+ }
- if (values_type[i] == fss_extended_list_read_parameter_depth) {
+ if (data.parameters[fss_extended_list_read_parameter_name].result == f_console_result_additional) {
+ for (; position_name < data.parameters[fss_extended_list_read_parameter_name].values.used; position_name++) {
- if (first_depth) {
- if (i && number) {
- depths->array[++depths->used].index_at = 0;
- depths->array[depths->used].index_name = 0;
- depths->array[depths->used].value_at = 0;
- }
+ if (data.parameters[fss_extended_list_read_parameter_name].values.array[position_name] < position_depth) {
+ continue;
+ }
- first_depth = F_false;
- depths->array[depths->used].depth = number;
+ if (i + 1 < depths->used && data.parameters[fss_extended_list_read_parameter_name].values.array[position_name] > data.parameters[fss_extended_list_read_parameter_depth].values.array[i + 1]) {
+ break;
+ }
+
+ depths->array[i].index_name = data.parameters[fss_extended_list_read_parameter_name].values.array[position_name];
+
+ if (data.parameters[fss_extended_list_read_parameter_trim].result == f_console_result_found) {
+ status = fl_string_rip(arguments.argv[depths->array[i].index_name], strlen(arguments.argv[depths->array[i].index_name]), &depths->array[i].value_name);
}
else {
- depths->array[++depths->used].depth = number;
- depths->array[depths->used].index_at = 0;
- depths->array[depths->used].index_name = 0;
- depths->array[depths->used].value_at = 0;
+ status = fl_string_append(arguments.argv[depths->array[i].index_name], strlen(arguments.argv[depths->array[i].index_name]), &depths->array[i].value_name);
}
- }
- else if (values_type[i] == fss_extended_list_read_parameter_at) {
- depths->array[depths->used].index_at = values_order[i];
- depths->array[depths->used].value_at = number;
- }
- else if (values_type[i] == fss_extended_list_read_parameter_name) {
- depths->array[depths->used].index_name = values_order[i];
- depths->array[depths->used].value_name.used = 0;
- if (data.parameters[fss_extended_list_read_parameter_trim].result == f_console_result_found) {
- status = fl_string_rip(arguments.argv[values_order[i]], strnlen(arguments.argv[values_order[i]], f_console_length_size), &depths->array[depths->used].value_name);
+ if (F_status_is_error(status)) {
+ f_status_t status_code = F_status_set_fine(status);
- if (F_status_is_error(status)) {
- fll_error_print(data.error, F_status_set_fine(status), "fl_string_rip", F_true);
- return status;
+ // @todo: move error printing into common function.
+ if (status_code == F_memory_allocation || status_code == F_memory_reallocation) {
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol[0]);
}
- }
- else {
- status = fl_string_append(arguments.argv[values_order[i]], strnlen(arguments.argv[values_order[i]], f_console_length_size), &depths->array[depths->used].value_name);
+ else if (status_code == f_string_length_t_size) {
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sUnable to process '", fll_error_print_error);
+ fl_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_trim);
+ fl_color_print(data.error.to.stream, data.context.set.error, "' because the maximum buffer size was reached.%c", f_string_eol[0]);
+ }
+ else {
+ f_string_t function = "fl_string_append";
+
+ if (data.parameters[fss_extended_list_read_parameter_trim].result == f_console_result_found) {
+ function = "fl_string_rip";
+ }
- if (F_status_is_error(status)) {
- fll_error_print(data.error, F_status_set_fine(status), "fl_string_append", F_true);
- return status;
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sAn unhandled error (", fll_error_print_error);
+ fl_color_print(data.error.to.stream, data.context.set.notable, "%u", status_code);
+ fl_color_print(data.error.to.stream, data.context.set.error, ") has occurred while calling ");
+ fl_color_print(data.error.to.stream, data.context.set.notable, "%s()", function);
+ fl_color_print(data.error.to.stream, data.context.set.error, ".%c", f_string_eol[0]);
}
+
+ return status;
}
- }
- } // for
- depths->used++;
- }
+ if (!depths->array[i].value_name.used) {
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sThe '", fll_error_print_error);
+ fl_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_name);
+ fl_color_print(data.error.to.stream, data.context.set.error, "' must not be an empty string.%c", f_string_eol[0]);
- for (i = 0; i < depths->used; i++) {
+ return F_status_set_error(F_parameter);
+ }
+ } // for
+ }
+ } // for
+
+ for (f_array_length_t i = 0; i < depths->used; i++) {
- for (j = i + 1; j < depths->used; j++) {
+ for (f_array_length_t j = i + 1; j < depths->used; j++) {
if (depths->array[i].depth == depths->array[j].depth) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
fl_color_print(data.error.to.stream, data.context.set.error, "%sThe value '", fll_error_print_error);
fl_color_print(data.error.to.stream, data.context.set.notable, "%llu", depths->array[i].depth);
fl_color_print(data.error.to.stream, data.context.set.error, "' may only be specified once for the parameter '");
return F_status_set_error(F_parameter);
}
else if (depths->array[i].depth > depths->array[j].depth) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
fl_color_print(data.error.to.stream, data.context.set.error, "%sThe parameter '", fll_error_print_error);
fl_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_depth);
fl_color_print(data.error.to.stream, data.context.set.error, "' may not have the value '");
#endif // _di_fss_extended_list_read_main_preprocess_depth_
#ifndef _di_fss_extended_list_read_main_process_file_
- f_return_status fss_extended_list_read_main_process_file(const f_console_arguments_t arguments, fss_extended_list_read_data_t *data, const f_string_t filename, const fss_extended_list_read_depths_t depths, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits, f_fss_comments_t *comments) {
+ f_return_status fss_extended_list_read_main_process_file(const f_console_arguments_t arguments, fss_extended_list_read_data_t *data, const f_string_t filename, const fss_extended_list_read_depths_t depths, f_fss_delimits_t *delimits, f_fss_comments_t *comments) {
f_status_t status = F_none;
+ const f_string_lengths_t except_none = f_string_lengths_t_initialize;
+ bool delimited = F_true;
+
+ // for this standard, delimits would always be applied, except for when delimit_depth is greater than 0.
+ if (data->delimit_mode == fss_extended_list_read_delimit_mode_none || (data->delimit_depth && (data->delimit_mode == fss_extended_list_read_delimit_mode_depth || data->delimit_mode == fss_extended_list_read_delimit_mode_depth_greater))) {
+ delimited = F_false;
+ }
+
{
f_string_range_t input = f_macro_string_range_t_initialize(data->buffer.used);
- objects_delimits->used = 0;
- contents_delimits->used = 0;
+ delimits->used = 0;
comments->used = 0;
- status = fll_fss_extended_list_read(&data->buffer, &input, &data->nest, objects_delimits, contents_delimits, comments);
+ status = fll_fss_extended_list_read(&data->buffer, &input, &data->objects, &data->contents, delimits, 0, comments);
if (F_status_is_error(status)) {
// @todo: detect and replace fll_error_file_type_file with fll_error_file_type_pipe as appropriate.
fll_error_file_print(data->error, F_status_set_fine(status), "fll_fss_extended_list_read", F_true, filename, "process", fll_error_file_type_file);
}
else if (status == F_data_not_stop || status == F_data_not_eos) {
- f_macro_fss_nest_t_delete_simple(data->nest);
+ f_macro_fss_contents_t_delete_simple(data->contents);
+ f_macro_fss_objects_t_delete_simple(data->objects);
f_macro_string_dynamic_t_delete_simple(data->buffer);
if (data->parameters[fss_extended_list_read_parameter_total].result == f_console_result_found) {
}
if (F_status_is_error(status)) {
- f_macro_fss_nest_t_delete_simple(data->nest);
+ f_macro_fss_contents_t_delete_simple(data->contents);
+ f_macro_fss_objects_t_delete_simple(data->objects);
f_macro_string_dynamic_t_delete_simple(data->buffer);
return status;
} // for
}
- // Requested depths cannot be greater than contents depth.
- if (depths.used > data->nest.used) {
- if (data->parameters[fss_extended_list_read_parameter_total].result == f_console_result_found) {
- fprintf(data->output.stream, "0%c", f_string_eol[0]);
- return F_none;
- }
-
- return F_none;
- }
-
- {
- f_number_unsigned_t select = 0;
+ f_number_unsigned_t select = 0;
- if (data->parameters[fss_extended_list_read_parameter_select].result == f_console_result_additional) {
- const f_string_length_t index = data->parameters[fss_extended_list_read_parameter_select].values.array[data->parameters[fss_extended_list_read_parameter_select].values.used - 1];
- const f_string_range_t range = f_macro_string_range_t_initialize(strlen(arguments.argv[index]));
+ if (data->parameters[fss_extended_list_read_parameter_select].result == f_console_result_additional) {
+ const f_array_length_t index = data->parameters[fss_extended_list_read_parameter_select].values.array[data->parameters[fss_extended_list_read_parameter_select].values.used - 1];
+ const f_string_range_t range = f_macro_string_range_t_initialize(strlen(arguments.argv[index]));
- status = fl_conversion_string_to_number_unsigned(arguments.argv[index], &select, range);
+ status = fl_conversion_string_to_number_unsigned(arguments.argv[index], &select, range);
- if (F_status_is_error(status)) {
- fll_error_parameter_integer_print(data->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_list_read_long_select, arguments.argv[index]);
- return status;
- }
+ if (F_status_is_error(status)) {
+ fll_error_parameter_integer_print(data->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_list_read_long_select, arguments.argv[index]);
+ return status;
+ }
- // This standard does not support multiple content groups.
- if (select > 0) {
- return F_none;
- }
+ // This standard does not support multiple content groups.
+ if (select > 0) {
+ return F_none;
}
}
}
}
- fss_extended_list_read_process_delimits(*data, objects_delimits, contents_delimits);
-
- const fss_extended_list_read_skip_t parents = fss_extended_list_read_skip_t_initialize;
-
- return fss_extended_list_read_main_process_for_depth(arguments, filename, depths, 0, line, parents, data, objects_delimits, contents_delimits);
- }
-#endif // _di_fss_extended_list_read_main_process_file_
-
-#ifndef _di_fss_extended_list_read_main_process_for_depth_
- f_return_status fss_extended_list_read_main_process_for_depth(const f_console_arguments_t arguments, const f_string_t filename, const fss_extended_list_read_depths_t depths, const f_array_length_t depths_index, const f_array_length_t line, const fss_extended_list_read_skip_t parents, fss_extended_list_read_data_t *data, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits) {
-
- f_fss_items_t *items = &data->nest.depth[depths.array[depths_index].depth];
-
- bool skip[items->used];
-
- // setup defaults to be not skipped unless any given parent is skipped.
- memset(skip, F_false, sizeof(skip) * items->used);
-
- if (parents.used) {
- for (f_array_length_t i = 0; i < items->used; ++i) {
-
- if (items->array[i].parent >= parents.used || parents.skip[items->array[i].parent]) {
- skip[i] = F_true;
- }
- } // for
- }
-
- if (depths.array[depths_index].index_name || depths.array[depths_index].index_at) {
- const f_string_lengths_t except_none = f_string_lengths_t_initialize;
+ bool names[data->objects.used];
- f_array_length_t i = 0;
- f_array_length_t j = 0;
-
- if (!depths.array[depths_index].index_name || (depths.array[depths_index].index_at && depths.array[depths_index].index_at < depths.array[depths_index].index_name)) {
+ f_array_length_t i = 0;
+ f_array_length_t j = 0;
- // all other non-"at" parameters must be FALSE.
- for (; i < items->used; ++i) {
+ if (depths.array[0].index_name > 0) {
+ memset(names, 0, sizeof(bool) * data->objects.used);
- if (skip[i]) continue;
+ if (data->parameters[fss_extended_list_read_parameter_trim].result == f_console_result_found) {
+ for (i = 0; i < data->objects.used; i++) {
- if (j != depths.array[depths_index].value_at) {
- skip[i] = F_true;
+ if (fl_string_dynamic_partial_compare_except_trim_dynamic(depths.array[0].value_name, data->buffer, data->objects.array[i], except_none, *delimits) == F_equal_to) {
+ names[i] = 1;
+ }
+ } // for
+ }
+ else {
+ for (i = 0; i < data->objects.used; i++) {
+ if (fl_string_dynamic_partial_compare_except_dynamic(depths.array[0].value_name, data->buffer, data->objects.array[i], except_none, *delimits) == F_equal_to) {
+ names[i] = 1;
}
-
- ++j;
} // for
+ }
+ }
+ else {
+ memset(names, 1, sizeof(bool) * data->objects.used);
+ }
- if (depths.array[depths_index].value_at < items->used && !skip[depths.array[depths_index].value_at]) {
- if (depths.array[depths_index].index_name) {
+ bool include_empty = 0;
- if (data->parameters[fss_extended_list_read_parameter_trim].result == f_console_result_found) {
+ if (data->parameters[fss_extended_list_read_parameter_empty].result == f_console_result_found) {
+ include_empty = 1;
+ }
- if (fl_string_dynamic_partial_compare_except_trim_dynamic(depths.array[depths_index].value_name, data->buffer, items->array[depths.array[depths_index].value_at].object, except_none, *objects_delimits) != F_equal_to) {
- skip[depths.array[depths_index].value_at] = F_true;
- }
- }
- else {
- if (fl_string_dynamic_partial_compare_except_dynamic(depths.array[depths_index].value_name, data->buffer, items->array[depths.array[depths_index].value_at].object, except_none, *objects_delimits) != F_equal_to) {
- skip[depths.array[depths_index].value_at] = F_true;
- }
- }
+ if (data->parameters[fss_extended_list_read_parameter_object].result == f_console_result_found) {
+ if (data->parameters[fss_extended_list_read_parameter_total].result == f_console_result_found) {
+ if (depths.array[0].index_at > 0) {
+ if (depths.array[0].value_at < data->objects.used && names[depths.array[0].value_at]) {
+ fprintf(data->output.stream, "1%c", f_string_eol[0]);
+ }
+ else {
+ fprintf(data->output.stream, "0%c", f_string_eol[0]);
}
}
- }
- else {
-
- if (data->parameters[fss_extended_list_read_parameter_trim].result == f_console_result_found) {
+ else if (depths.array[0].index_name > 0) {
+ f_array_length_t total = 0;
- for (i = 0; i < items->used; ++i) {
+ for (i = 0; i < data->objects.used; i++) {
+ if (!names[i]) continue;
- if (skip[i]) continue;
-
- if (fl_string_dynamic_partial_compare_except_trim_dynamic(depths.array[depths_index].value_name, data->buffer, items->array[i].object, except_none, *objects_delimits) != F_equal_to) {
- skip[i] = F_true;
- }
+ total++;
} // for
+
+ fprintf(data->output.stream, "%llu%c", total, f_string_eol[0]);
}
else {
+ fprintf(data->output.stream, "%llu%c", data->objects.used, f_string_eol[0]);
+ }
- for (i = 0; i < items->used; ++i) {
+ return F_none;
+ }
- if (skip[i]) continue;
+ f_return_status (*print_object)(FILE *, const f_string_static_t, const f_string_range_t, const f_string_lengths_t) = &f_print_except_dynamic_partial;
- if (fl_string_dynamic_partial_compare_except_dynamic(depths.array[depths_index].value_name, data->buffer, items->array[i].object, except_none, *objects_delimits) != F_equal_to) {
- skip[i] = F_true;
- }
- } // for
- }
+ if (data->parameters[fss_extended_list_read_parameter_trim].result == f_console_result_found) {
+ print_object = &fl_print_trim_except_dynamic_partial;
+ }
- if (depths.array[depths_index].index_at) {
+ if (depths.array[0].index_at > 0) {
+ f_array_length_t at = 0;
+ f_array_length_t i = 0;
- // all other non-"at" parameters must be FALSE.
- for (i = 0, j = 0; i < items->used; ++i) {
+ for (; i < data->objects.used; i++) {
- if (skip[i]) continue;
+ if (names[i]) {
+ if (at == depths.array[0].value_at) {
+ print_object(data->output.stream, data->buffer, data->objects.array[i], delimited ? *delimits : except_none);
- if (j != depths.array[depths_index].value_at) {
- skip[i] = F_true;
- }
+ fss_extended_list_read_print_object_end(*data);
- ++j;
+ if (data->parameters[fss_extended_list_read_parameter_content].result == f_console_result_found) {
+ if (data->contents.array[i].used) {
+ fss_extended_list_read_print_content_ignore(*data);
+ f_print_except_dynamic_partial(data->output.stream, data->buffer, data->contents.array[i].array[0], delimited ? *delimits : except_none);
+ fss_extended_list_read_print_content_ignore(*data);
+ }
+ }
+
+ fss_extended_list_read_print_set_end(*data);
+ break;
+ }
+
+ at++;
+ }
} // for
- }
+
+ return F_none;
}
- }
- // if the current depth is not the final depth, then recurse into the next depth.
- if (depths_index + 1 < depths.used) {
- bool skip_next[data->nest.depth[depths.array[depths_index + 1].depth - 1].used];
+ for (i = 0; i < data->objects.used; i++) {
- fss_extended_list_read_skip_t parents_next = fss_extended_list_read_skip_t_initialize;
+ if (!names[i]) continue;
- if (depths.array[depths_index].depth + 1 == depths.array[depths_index + 1].depth) {
- parents_next.skip = skip;
- parents_next.used = items->used;
- }
- else {
- const f_array_length_t parents_depth = depths.array[depths_index + 1].depth - 1;
- const f_array_length_t depth_next = depths.array[depths_index + 1].depth;
+ print_object(data->output.stream, data->buffer, data->objects.array[i], delimited ? *delimits : except_none);
- parents_next.skip = skip_next;
- parents_next.used = data->nest.depth[parents_depth].used;
+ fss_extended_list_read_print_object_end(*data);
- memset(skip_next, F_true, sizeof(skip_next) * parents_next.used);
+ if (data->parameters[fss_extended_list_read_parameter_content].result == f_console_result_found) {
+ if (data->contents.array[i].used) {
+ fss_extended_list_read_print_content_ignore(*data);
+ f_print_except_dynamic_partial(data->output.stream, data->buffer, data->contents.array[i].array[0], delimited ? *delimits : except_none);
+ fss_extended_list_read_print_content_ignore(*data);
+ }
+ }
- f_fss_items_t *items_next = &data->nest.depth[depth_next];
- f_fss_items_t *items_previous = 0;
- f_fss_item_t *item_previous = 0;
+ fss_extended_list_read_print_set_end(*data);
+ } // for
- f_array_length_t i = 0;
- f_array_length_t j = 0;
+ return F_none;
+ }
- for (; i < items_next->used; ++i) {
+ if (depths.array[0].index_at > 0) {
+ if (depths.array[0].value_at >= data->objects.used) {
+ if (names[depths.array[0].value_at] && data->parameters[fss_extended_list_read_parameter_total].result == f_console_result_found) {
+ fprintf(data->output.stream, "0%c", f_string_eol[0]);
+ }
- j = depth_next;
+ return F_none;
+ }
- item_previous = &items_next->array[i];
- items_previous = &data->nest.depth[--j];
+ f_array_length_t at = 0;
+ f_array_length_t total = 0;
+ f_array_length_t line_current = 0;
- while (j > depths.array[depths_index].depth) {
+ for (; i < data->objects.used; i++) {
- item_previous = &items_previous->array[item_previous->parent];
- items_previous = &data->nest.depth[--j];
- } // while
+ if (names[i]) {
+ if (at == depths.array[0].value_at) {
+ if (data->parameters[fss_extended_list_read_parameter_total].result == f_console_result_found) {
+ if (!data->contents.array[i].used) {
+ fprintf(data->output.stream, "0%c", f_string_eol[0]);
+ }
+ else {
+ total = 1;
- if (skip[item_previous->parent]) {
- skip_next[items_next->array[i].parent] = F_true;
- }
- else {
- skip_next[items_next->array[i].parent] = F_false;
- }
- } // for
- }
+ for (j = data->contents.array[i].array[0].start; j <= data->contents.array[i].array[0].stop; j++) {
+ if (!data->buffer.string[j]) continue;
- return fss_extended_list_read_main_process_for_depth(arguments, filename, depths, depths_index + 1, line, parents_next, data, objects_delimits, contents_delimits);
- }
+ if (data->buffer.string[j] == f_string_eol[0]) {
+ total++;
+ }
+ } // for
- // process objects.
- f_array_length_t i = 0;
- f_array_length_t j = 0;
+ fprintf(data->output.stream, "%llu%c", total, f_string_eol[0]);
+ }
- if (data->parameters[fss_extended_list_read_parameter_object].result == f_console_result_found) {
- if (data->parameters[fss_extended_list_read_parameter_total].result == f_console_result_found) {
- f_array_length_t total = 0;
+ return F_none;
+ }
- for (i = 0; i < items->used; i++) {
- if (skip[i]) continue;
+ if (data->parameters[fss_extended_list_read_parameter_line].result == f_console_result_additional) {
+ if (!data->contents.array[i].used) {
+ if (include_empty && !line) {
+ fprintf(data->output.stream, "%c", f_string_eol[0]);
+ fss_extended_list_read_print_set_end(*data);
+ }
+ }
+ else {
+ i = data->contents.array[i].array[0].start;
+
+ if (!line) {
+ for (; i <= data->contents.array[i].array[0].stop; i++) {
+ if (!data->buffer.string[i]) continue;
+ if (data->buffer.string[i] == f_string_eol[0]) {
+ fprintf(data->output.stream, "%c", f_string_eol[0]);
+ break;
+ }
+
+ fprintf(data->output.stream, "%c", data->buffer.string[i]);
+ } // for
+ }
+ else {
+ line_current = 0;
- total++;
- } // for
+ for (; i <= data->contents.array[i].array[0].stop; i++) {
+ if (!data->buffer.string[i]) continue;
- fprintf(data->output.stream, "%llu%c", total, f_string_eol[0]);
+ if (data->buffer.string[i] == f_string_eol[0]) {
+ line_current++;
- return F_none;
- }
+ if (line_current == line) {
+ i++;
- f_return_status (*print_object)(FILE *, const f_string_static_t, const f_string_range_t, const f_string_lengths_t) = &f_print_except_dynamic_partial;
+ for (; i <= data->contents.array[i].array[0].stop; i++) {
+ if (!data->buffer.string[i]) continue;
- if (data->parameters[fss_extended_list_read_parameter_trim].result == f_console_result_found) {
- print_object = &fl_print_trim_except_dynamic_partial;
- }
+ if (data->buffer.string[i] == f_string_eol[0]) {
+ fprintf(data->output.stream, "%c", f_string_eol[0]);
+ break;
+ }
- for (i = 0; i < items->used; i++) {
+ fprintf(data->output.stream, "%c", data->buffer.string[i]);
+ } // for
- if (skip[i]) continue;
+ break;
+ }
+ }
+ } // for
+ }
+ }
- print_object(data->output.stream, data->buffer, items->array[i].object, *objects_delimits);
+ return F_none;
+ }
- if (data->parameters[fss_extended_list_read_parameter_content].result == f_console_result_found) {
- fss_extended_list_read_print_object_end(*data);
+ if (data->contents.array[i].used > 0) {
+ fss_extended_list_read_print_content_ignore(*data);
+ f_print_except_dynamic_partial(data->output.stream, data->buffer, data->contents.array[i].array[0], delimited ? *delimits : except_none);
+ fss_extended_list_read_print_content_ignore(*data);
- if (items->array[i].content.used) {
- f_print_except_dynamic_partial(data->output.stream, data->buffer, items->array[i].content.array[0], *contents_delimits);
+ fss_extended_list_read_print_set_end(*data);
+ }
+ else if (include_empty) {
+ fprintf(data->output.stream, "%c", f_string_eol[0]);
+ fss_extended_list_read_print_set_end(*data);
+ }
+
+ break;
}
- }
- fss_extended_list_read_print_set_end(*data);
+ at++;
+ }
} // for
return F_none;
}
- // process contents.
- bool include_empty = 0;
-
- if (data->parameters[fss_extended_list_read_parameter_empty].result == f_console_result_found) {
- include_empty = 1;
- }
-
if (data->parameters[fss_extended_list_read_parameter_total].result == f_console_result_found) {
f_array_length_t total = 0;
- for (i = 0; i < items->used; ++i) {
+ for (i = 0; i < data->objects.used; i++) {
+ if (!names[i]) continue;
- if (skip[i]) continue;
-
- if (!items->array[i].content.used) {
+ if (!data->contents.array[i].used) {
if (include_empty) {
total++;
}
continue;
}
- for (j = items->array[i].content.array[0].start; j <= items->array[i].content.array[0].stop; ++j) {
-
+ for (j = data->contents.array[i].array[0].start; j <= data->contents.array[i].array[0].stop; j++) {
if (!data->buffer.string[j]) continue;
if (data->buffer.string[j] == f_string_eol[0]) {
}
if (data->parameters[fss_extended_list_read_parameter_line].result == f_console_result_additional) {
- f_array_length_t line_current = 0;
-
- for (; i < items->used; ++i) {
-
- if (skip[i]) continue;
+ for (f_array_length_t line_current = 0; i < data->contents.used; i++) {
+ if (!names[i]) continue;
- if (!items->array[i].content.used) {
+ if (!data->contents.array[i].used) {
if (include_empty) {
if (line_current == line) {
+ fprintf(data->output.stream, "%c", f_string_eol[0]);
fss_extended_list_read_print_set_end(*data);
break;
}
continue;
}
- j = items->array[i].content.array[0].start;
+ j = data->contents.array[i].array[0].start;
if (line_current != line) {
- for (; j <= items->array[i].content.array[0].stop; ++j) {
+ for (; j <= data->contents.array[i].array[0].stop; j++) {
if (data->buffer.string[j] == f_string_eol[0]) {
line_current++;
if (line_current == line) {
- ++j;
+ j++;
break;
}
}
}
if (line_current == line) {
- if (j > items->array[i].content.array[0].stop) continue;
-
- for (; j <= items->array[i].content.array[0].stop; ++j) {
+ if (j > data->contents.array[i].array[0].stop) continue;
+ for (; j <= data->contents.array[i].array[0].stop; j++) {
if (!data->buffer.string[j]) continue;
if (data->buffer.string[j] == f_string_eol[0]) {
return F_none;
}
- for (i = 0; i < items->used; i++) {
-
- if (skip[i]) continue;
+ for (i = 0; i < data->contents.used; i++) {
+ if (!names[i]) continue;
- if (!items->array[i].content.used) {
+ if (!data->contents.array[i].used) {
if (include_empty) {
+ fprintf(data->output.stream, "%c", f_string_eol[0]);
fss_extended_list_read_print_set_end(*data);
}
continue;
}
- f_print_except_dynamic_partial(data->output.stream, data->buffer, items->array[i].content.array[0], *contents_delimits);
+ fss_extended_list_read_print_content_ignore(*data);
+ f_print_except_dynamic_partial(data->output.stream, data->buffer, data->contents.array[i].array[0], delimited ? *delimits : except_none);
+ fss_extended_list_read_print_content_ignore(*data);
- if (data->parameters[fss_extended_list_read_parameter_pipe].result == f_console_result_found) {
- fprintf(data->output.stream, "%c", fss_extended_list_read_pipe_content_end);
- }
+ fss_extended_list_read_print_set_end(*data);
} // for
return F_none;
}
-#endif // _di_fss_extended_list_read_main_process_for_depth_
+#endif // _di_fss_extended_list_read_main_process_file_
#ifndef _di_fss_extended_list_read_print_object_end_
void fss_extended_list_read_print_object_end(const fss_extended_list_read_data_t data) {
if (data.parameters[fss_extended_list_read_parameter_object].result == f_console_result_found && data.parameters[fss_extended_list_read_parameter_content].result == f_console_result_found) {
fprintf(data.output.stream, "%c%c", f_fss_extended_list_close, f_fss_extended_list_close_end);
}
- else {
+ else if (data.parameters[fss_extended_list_read_parameter_content].result == f_console_result_found) {
fprintf(data.output.stream, "%c", f_fss_eol);
}
}
if (data.parameters[fss_extended_list_read_parameter_object].result == f_console_result_found && data.parameters[fss_extended_list_read_parameter_content].result == f_console_result_found) {
fprintf(data.output.stream, "%c%c", f_fss_extended_list_close, f_fss_extended_list_close_end);
}
- else {
+ else if (data.parameters[fss_extended_list_read_parameter_content].result == f_console_result_found) {
fprintf(data.output.stream, "%c", f_fss_eol);
}
}
}
#endif // _di_fss_extended_list_read_print_set_end_
-#ifndef _di_fss_extended_list_read_process_delimits_
- void fss_extended_list_read_process_delimits(const fss_extended_list_read_data_t data, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits) {
-
- if (!data.nest.used) return;
-
- if ((!objects_delimits->used && !contents_delimits->used) || data.delimit_mode == fss_extended_list_read_delimit_mode_all) return;
-
- if (data.delimit_mode == fss_extended_list_read_delimit_mode_depth_lesser && data.nest.used < data.delimit_depth) return;
- if (data.delimit_mode == fss_extended_list_read_delimit_mode_depth_greater && data.delimit_depth == 0) return;
-
- if (data.delimit_mode == fss_extended_list_read_delimit_mode_none) {
- objects_delimits->used = 0;
- contents_delimits->used = 0;
- return;
- }
-
- if (data.delimit_mode == fss_extended_list_read_delimit_mode_depth || data.delimit_mode == fss_extended_list_read_delimit_mode_depth_greater) {
- if (data.delimit_depth >= data.nest.used) {
- objects_delimits->used = 0;
- contents_delimits->used = 0;
- return;
- }
- }
-
- const f_string_length_t original_objects_used = objects_delimits->used;
- const f_string_length_t original_contents_used = contents_delimits->used;
-
- f_string_length_t original_objects_delimits[original_objects_used];
- f_string_length_t original_contents_delimits[original_contents_used];
-
- memcpy(&original_objects_delimits, objects_delimits->array, original_objects_used * sizeof(f_string_length_t));
- memcpy(&original_contents_delimits, contents_delimits->array, original_contents_used * sizeof(f_string_length_t));
-
- objects_delimits->used = 0;
- contents_delimits->used = 0;
-
- if (data.delimit_mode == fss_extended_list_read_delimit_mode_depth) {
-
- // only depth 0 objects are stored in objects_delimits.
- if (data.delimit_depth) {
- fss_extended_list_read_process_delimits_objects(data, data.delimit_depth, original_contents_delimits, original_contents_used, contents_delimits);
- }
- else {
- fss_extended_list_read_process_delimits_objects(data, data.delimit_depth, original_objects_delimits, original_objects_used, objects_delimits);
- }
-
- fss_extended_list_read_process_delimits_contents(data, data.delimit_depth, original_contents_delimits, original_contents_used, contents_delimits);
- }
- else {
-
- if (data.delimit_mode == fss_extended_list_read_delimit_mode_depth_lesser) {
-
- // only depth 0 objects are stored in objects_delimits.
- fss_extended_list_read_process_delimits_objects(data, 0, original_objects_delimits, original_objects_used, objects_delimits);
- fss_extended_list_read_process_delimits_contents(data, 0, original_contents_delimits, original_contents_used, contents_delimits);
-
- for (f_array_length_t i = 1; i <= data.delimit_depth && i < data.nest.used; ++i) {
-
- fss_extended_list_read_process_delimits_objects(data, i, original_contents_delimits, original_contents_used, contents_delimits);
- fss_extended_list_read_process_delimits_contents(data, i, original_contents_delimits, original_contents_used, contents_delimits);
- } // for
- }
- else if (data.delimit_mode == fss_extended_list_read_delimit_mode_depth_greater) {
- for (f_array_length_t i = data.delimit_depth; i < data.nest.used; ++i) {
-
- fss_extended_list_read_process_delimits_objects(data, i, original_contents_delimits, original_contents_used, contents_delimits);
- fss_extended_list_read_process_delimits_contents(data, i, original_contents_delimits, original_contents_used, contents_delimits);
- } // for
- }
- }
- }
-#endif // _di_fss_extended_list_read_process_delimits_
-
-#ifndef _di_fss_extended_list_read_process_delimits_contents_
- void fss_extended_list_read_process_delimits_contents(const fss_extended_list_read_data_t data, const f_string_length_t depth, const f_string_length_t original_delimits[], const f_string_length_t original_used, f_fss_delimits_t *delimits) {
-
- if (!original_used) return;
-
- f_fss_items_t *items = &data.nest.depth[depth];
-
- if (!items->used) return;
-
- f_array_length_t i = 0;
- f_array_length_t j = 0;
- f_array_length_t k = 0;
- f_array_length_t l = 0;
- f_array_length_t m = 0;
-
- for (i = 0; i < items->used; ++i) {
-
- for (j = 0; j < original_used; ++j) {
-
- for (k = 0; k < items->array[i].content.used; ++k) {
-
- if (original_delimits[j] >= items->array[i].content.array[k].start && original_delimits[j] <= items->array[i].content.array[k].stop) {
-
- // preserve linear order when adding back delimits.
- if (delimits->used) {
- for (l = 0; l < delimits->used; ++l) {
-
- if (original_delimits[j] > delimits->array[l]) continue;
- if (original_delimits[j] == delimits->array[l]) break;
-
- for (m = delimits->used; m > l; --m) {
- delimits->array[m] = delimits->array[m - 1];
- } // for
-
- if (fss_extended_list_read_process_delimits_within_greater(data, depth, original_delimits[j]) == F_false) {
- delimits->array[l] = original_delimits[j];
- delimits->used++;
- }
-
- break;
- } // for
- }
- else if (fss_extended_list_read_process_delimits_within_greater(data, depth, original_delimits[j]) == F_false) {
- delimits->array[0] = original_delimits[j];
- delimits->used = 1;
- }
- }
- }
- } // for
- } // for
- }
-#endif // _di_fss_extended_list_read_process_delimits_contents_
-
-#ifndef _di_fss_extended_list_read_process_delimits_objects_
- void fss_extended_list_read_process_delimits_objects(const fss_extended_list_read_data_t data, const f_string_length_t depth, const f_string_length_t original_delimits[], const f_string_length_t original_used, f_fss_delimits_t *delimits) {
-
- if (!original_used) return;
-
- f_fss_items_t *items = &data.nest.depth[depth];
-
- if (!items->used) return;
-
- f_array_length_t i = 0;
- f_array_length_t j = 0;
- f_array_length_t k = 0;
- f_array_length_t l = 0;
-
- for (i = 0; i < items->used; ++i) {
-
- for (j = 0; j < original_used; ++j) {
-
- if (original_delimits[j] >= items->array[i].object.start && original_delimits[j] <= items->array[i].object.stop) {
-
- // preserve linear order when adding back delimits.
- if (delimits->used) {
- for (k = 0; k < delimits->used; ++k) {
-
- if (original_delimits[j] > delimits->array[k]) continue;
- if (original_delimits[j] == delimits->array[k]) break;
-
- for (l = delimits->used; l > k; --l) {
- delimits->array[l] = delimits->array[l - 1];
- } // for
-
- if (fss_extended_list_read_process_delimits_within_greater(data, depth, original_delimits[j]) == F_false) {
- delimits->array[k] = original_delimits[j];
- delimits->used++;
- }
-
- break;
- } // for
- }
- else if (fss_extended_list_read_process_delimits_within_greater(data, depth, original_delimits[j]) == F_false) {
- delimits->array[0] = original_delimits[j];
- delimits->used = 1;
- }
- }
- } // for
- } // for
- }
-#endif // _di_fss_extended_list_read_process_delimits_objects_
-
-#ifndef _di_fss_extended_list_read_process_delimits_within_greater_
- f_return_status fss_extended_list_read_process_delimits_within_greater(const fss_extended_list_read_data_t data, const f_string_length_t depth, const f_string_length_t location) {
-
- if (depth + 1 >= data.nest.used) return F_false;
-
- f_fss_items_t *items = 0;
-
- f_string_length_t i = 0;
- f_string_length_t j = 0;
-
- for (f_string_length_t d = depth + 1; d < data.nest.used; ++d) {
- items = &data.nest.depth[d];
-
- for (i = 0; i < items->used; ++i) {
-
- for (j = 0; j < items->array[i].content.used; ++j) {
-
- if (location >= items->array[i].content.array[j].start && location <= items->array[i].content.array[j].stop) {
- return F_true;
- }
- } // for
- } // for
- } // for
-
- return F_false;
- }
-#endif // _di_fss_extended_list_read_process_delimits_within_greater_
-
#ifdef __cplusplus
} // extern "C"
#endif
*
* depth: the depth number in which this is to be processed at.
*
- * index_at: position of the "--at" parameter value in the argv list, when 0 there is no parameter.
+ * index_at: position of the "--at" parameter value in the argv list, when 0 there is no parameter.
* index_name: position of the "--name" parameter value in the argv list, when 0 there is no parameter.
*
- * value_at: the value of the "--at" parameter, already processed and ready to use, only when index_at > 0.
+ * value_at: the value of the "--at" parameter, already processed and ready to use, only when index_at > 0.
* value_name: the value of the "--name" parameter, already processed and ready to use, only when index_name > 0.
*/
#ifndef _di_fss_extended_list_read_depth_t_
#endif // _di_fss_extended_list_read_depth_t_
/**
- * A structure containing a statically allocated array of booleans and the array length.
- *
- * skip: a statically allocated array representing list items that are to be skipped.
- * used: the length of the statically allocated skip array.
- */
-#ifndef _di_fss_extended_list_read_skip_t_
- typedef struct {
- bool *skip;
- f_array_length_t used;
- } fss_extended_list_read_skip_t;
-
- #define fss_extended_list_read_skip_t_initialize \
- { \
- 0, \
- 0, \
- }
-
- #define macro_fss_extended_list_read_skip_t_initialize(skip, used) \
- { \
- skip, \
- used, \
- }
-#endif // _di_fss_extended_list_read_skip_t_
-
-/**
* An array of depth parameters.
*
* array: the array of depths.
} \
if (!depths.used) f_macro_memory_structure_t_destroy_simple(depths, fss_extended_list_read_depth_t)
- #define macro_fss_extended_list_read_t_depths_resize(status, depths, new_length) \
+ #define macro_fss_extended_list_read_depths_t_resize(status, depths, new_length) \
status = F_none; \
if (new_length < depths.size) { \
f_array_length_t i = depths.size - new_length; \
* The name of the file being processed.
* @param depths
* The processed depth parameters.
- * @param objects_delimits
- * An array of delimits detected during processing, for top-level objects.
- * @param contents_delimits
- * An array of delimits detected during processing, for contents.
+ * @param delimits
+ * An array of delimits detected during processing.
* @param comments
* An array of ranges representing where comments are found within any valid content.
* This only stores comments found within valid content only.
*
- * @see fss_extended_list_read_main_preprocess_depth()
- * @see fss_extended_list_read_main_process_for_depth()
- *
* @return
* F_none on success.
*
* Status codes (with error bit) are returned on any problem.
+ *
+ * @see fss_extended_list_read_main_preprocess_depth()
*/
#ifndef _di_fss_extended_list_read_main_process_file_
- extern f_return_status fss_extended_list_read_main_process_file(const f_console_arguments_t arguments, fss_extended_list_read_data_t *data, const f_string_t file_name, const fss_extended_list_read_depths_t depths, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits, f_fss_comments_t *comments) f_gcc_attribute_visibility_internal;
+ extern f_return_status fss_extended_list_read_main_process_file(const f_console_arguments_t arguments, fss_extended_list_read_data_t *data, const f_string_t file_name, const fss_extended_list_read_depths_t depths, f_fss_delimits_t *delimits, f_fss_comments_t *comments) f_gcc_attribute_visibility_internal;
#endif // _di_fss_extended_list_read_main_process_file_
/**
- * Process the items for a given depth.
- *
- * This will recursively continue down the depth chain until the final depth is reached.
- *
- * @param arguments
- * The console arguments passed to the program.
- * @param file_name
- * The name of the file being processed.
- * @param depths
- * The array of all depth related parameter settings.
- * @param depths_index
- * The array location within depth being worked on.
- * @param line
- * The line number parameter value, used for printing a specific line number for content.
- * @param parents
- * The skip status of any parent lists.
- * Set parents.length to 0 for depth 0.
- * @param data
- * The program specific data.
- * @param objects_delimits
- * An array of delimits detected during processing, for top-level objects.
- * @param contents_delimits
- * An array of delimits detected during processing, for contents.
- *
- * @return
- * F_none on success.
- *
- * Status codes (with error bit) are returned on any problem.
- *
- * @see fss_extended_list_read_main_process_file()
- */
-#ifndef _di_fss_extended_list_read_main_process_for_depth_
- extern f_return_status fss_extended_list_read_main_process_for_depth(const f_console_arguments_t arguments, const f_string_t filename, const fss_extended_list_read_depths_t depths, const f_array_length_t depths_index, const f_array_length_t line, const fss_extended_list_read_skip_t parents, fss_extended_list_read_data_t *data, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits) f_gcc_attribute_visibility_internal;
-#endif // _di_fss_extended_list_read_main_process_for_depth_
-
-/**
- * Print the end of an content.
+ * Print the end of an object (which is essentially the start of a content).
*
* @param data
* The program specific data.
*/
-#ifndef _di_fss_extended_list_read_print_content_end_
- extern void fss_extended_list_read_print_content_end(const fss_extended_list_read_data_t data) f_gcc_attribute_visibility_internal;
-#endif // _di_fss_extended_list_read_print_content_end_
+#ifndef _di_fss_extended_list_read_print_object_end_
+ extern void fss_extended_list_read_print_object_end(const fss_extended_list_read_data_t data) f_gcc_attribute_visibility_internal;
+#endif // _di_fss_extended_list_read_print_object_end_
/**
* Print the ignore character for content.
#endif // _di_fss_extended_list_read_print_content_ignore_
/**
- * Print the end of an object (which is essentially the start of a content).
+ * Print the end of an content.
*
* @param data
* The program specific data.
*/
-#ifndef _di_fss_extended_list_read_print_object_end_
- extern void fss_extended_list_read_print_object_end(const fss_extended_list_read_data_t data) f_gcc_attribute_visibility_internal;
-#endif // _di_fss_extended_list_read_print_object_end_
+#ifndef _di_fss_extended_list_read_print_content_end_
+ extern void fss_extended_list_read_print_content_end(const fss_extended_list_read_data_t data) f_gcc_attribute_visibility_internal;
+#endif // _di_fss_extended_list_read_print_content_end_
/**
* Print the end of an object/content set.
extern void fss_extended_list_read_print_set_end(const fss_extended_list_read_data_t data) f_gcc_attribute_visibility_internal;
#endif // _di_fss_extended_list_read_print_set_end_
-/**
- * Rewrite the object and content delimit ranges to be within the given depth range.
- *
- * @param data
- * The program specific data.
- * @param objects_delimits
- * An array of delimits detected during processing, for top-level objects.
- * @param contents_delimits
- * An array of delimits detected during processing, for contents.
- *
- * @see fss_extended_list_read_main_process_file()
- */
-#ifndef _di_fss_extended_list_read_process_delimits_
- extern void fss_extended_list_read_process_delimits(const fss_extended_list_read_data_t data, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits) f_gcc_attribute_visibility_internal;
-#endif // _di_fss_extended_list_read_process_delimits_
-
-/**
- * Write the given delimits at the given depth back into the new delimits array, specifically for contents.
- *
- * @param data
- * The program specific data.
- * @param depth
- * The depth in which to process.
- * @param original_delimits
- * The original delimits structure.
- * @param original_used
- * The size of the original delimits structure.
- * @param delimits
- * The delimits array in which the delimits are written to.
- *
- * @see fss_extended_list_read_process_delimits()
- */
-#ifndef _di_fss_extended_list_read_process_delimits_contents_
- extern void fss_extended_list_read_process_delimits_contents(const fss_extended_list_read_data_t data, const f_string_length_t depth, const f_string_length_t original_delimits[], const f_string_length_t original_used, f_fss_delimits_t *delimits) f_gcc_attribute_visibility_internal;
-#endif // _di_fss_extended_list_read_process_delimits_contents_
-
-/**
- * Write the given delimits at the given depth back into the new delimits array, specifically for objects.
- *
- * @param data
- * The program specific data.
- * @param depth
- * The depth in which to process.
- * @param original_delimits
- * The original delimits structure.
- * @param original_used
- * The size of the original delimits structure.
- * @param delimits
- * The delimits array in which the delimits are written to.
- *
- * @see fss_extended_list_read_process_delimits()
- */
-#ifndef _di_fss_extended_list_read_process_delimits_objects_
- extern void fss_extended_list_read_process_delimits_objects(const fss_extended_list_read_data_t data, const f_string_length_t depth, const f_string_length_t original_delimits[], const f_string_length_t original_used, f_fss_delimits_t *delimits) f_gcc_attribute_visibility_internal;
-#endif // _di_fss_extended_list_read_process_delimits_objects_
-
-/**
- * Determine if the given location is actually within another depth.
- *
- * @param data
- * The program specific data.
- * @param depth
- * The depth in which to process.
- * @param location
- * The location to investigate.
- *
- * @return
- * TRUE if location is within a greater depth.
- * FALSE if location is not within a greater depth.
- *
- * @see fss_extended_list_read_process_delimits_objects()
- * @see fss_extended_list_read_process_delimits_contents()
- */
-#ifndef _di_fss_extended_list_read_process_delimits_within_greater_
- extern f_return_status fss_extended_list_read_process_delimits_within_greater(const fss_extended_list_read_data_t data, const f_string_length_t depth, const f_string_length_t location) f_gcc_attribute_visibility_internal;
-#endif // _di_fss_extended_list_read_process_delimits_within_greater_
-
#ifdef __cplusplus
} // extern "C"
#endif
Featureless Settings Specification: 0003 - Extended List:
Each Object starts at the beginning of a line and whitespace to the left of the Object is not treated as an object.
- An open-brace ({) followed by any whitespace until a newline terminates a valid Object.
+ An open-brace ({) followed by any whitespace until a newline terminates a possible valid Object.
+ An Object is not considered fully valid until a valid close-brace (}) is found, designating the end of the Content.
Non-whitespace may not follow the open-brace of a valid Object.
Content exists on every line following a valid object until the end of file (or string) or until a non-delimited close-brace (}).
There is no single-quote or double-quote delimitation in this specification.
Only the open-brace that would result in a valid Object or the close-brace that would terminate valid Content can be delimited.
- Each delimit slash in an open-brace is treated as a potential delimit such that two slashes represents a single delimited slash ('\\\{' would represent '\{').
- Only the first delimit slash in a close-brace is treated as a potential delimit ('\\\}' would represent '\\}').
+ When inside potentially valid Content (which follows a valid Object) the open-brace cannot be delimited because this standard is not-recursive.
+ When not inside any potentially valid Content (that is, there is no previous unclosed Object), then the Object may be delimited.
+ Likelwise, the close-brace may only be delimited if it is within any potentially valid Content.
+
+ Each delimit slash in a delimitable open-brace is treated as a potential delimit such that two slashes represents a single delimited slash ('\\\{' would represent '\{').
+ Only the first delimit slash in a delimitable close-brace is treated as a potential delimit ('\\\}' would represent '\\}').
Key\:
\s = whitespace, except newline.