Some of the fl_fss functions can be moved to f_fss, now that f_utf is considered an exception-case core library.
Some of the fl_fss functions are being used within itself.
Use private functions to do this.
build_linker ar
build_libraries -lc
build_libraries-level
-build_sources_library console.c conversion.c directory.c private-directory.c environment.c private-environment.c file.c private-file.c memory.c path.c pipe.c print.c serialize.c private-serialize.c socket.c utf.c private-utf.c
+build_sources_library console.c conversion.c directory.c private-directory.c environment.c private-environment.c file.c private-file.c fss.c memory.c path.c pipe.c print.c serialize.c private-serialize.c socket.c utf.c private-utf.c
build_sources_program
build_sources_headers color.h console.h conversion.h directory.h directory_type.h environment.h file.h fss.h memory.h path.h pipe.h print.h serialize.h socket.h status.h status_array.h string.h type.h type_array.h utf.h
build_sources_script
build_linker ar
build_libraries -lc
build_libraries-level -lfll_0
-build_sources_library color.c console.c directory.c private-directory.c fss.c fss_basic.c fss_basic_list.c fss_extended.c fss_extended_list.c print.c status.c string.c private-string.c utf.c private-utf.c utf_file.c private-utf_file.c
+build_sources_library color.c console.c directory.c private-directory.c fss.c private-fss.c fss_basic.c fss_basic_list.c fss_extended.c fss_extended_list.c print.c status.c string.c private-string.c utf.c private-utf.c utf_file.c private-utf_file.c
build_sources_program
build_sources_headers color.h console.h directory.h fss.h fss_basic.h fss_basic_list.h fss_extended.h fss_extended_list.h fss_macro.h fss_status.h print.h status.h string.h utf.h utf_file.h
build_sources_script
build_linker ar
build_libraries -lc
build_libraries-monolithic
-build_sources_library level_0/console.c level_0/conversion.c level_0/directory.c level_0/private-directory.c level_0/environment.c level_0/private-environment.c level_0/file.c level_0/private-file.c level_0/memory.c level_0/path.c level_0/pipe.c level_0/print.c level_0/serialize.c level_0/private-serialize.c level_0/socket.c level_0/utf.c level_0/private-utf.c level_1/color.c level_1/console.c level_1/directory.c level_1/private-directory.c level_1/fss.c level_1/fss_basic.c level_1/fss_basic_list.c level_1/fss_extended.c level_1/fss_extended_list.c level_1/print.c level_1/status.c level_1/string.c level_1/private-string.c level_1/utf.c level_1/private-utf.c level_1/utf_file.c level_1/private-utf_file.c level_2/directory.c level_2/execute.c level_2/private-execute.c level_2/file.c level_2/fss.c level_2/fss_basic.c level_2/fss_basic_list.c level_2/fss_extended.c level_2/fss_extended_list.c level_2/fss_status.c level_2/program.c level_2/status.c
+build_sources_library level_0/console.c level_0/conversion.c level_0/directory.c level_0/private-directory.c level_0/environment.c level_0/private-environment.c level_0/file.c level_0/private-file.c level_0/fss.c level_0/memory.c level_0/path.c level_0/pipe.c level_0/print.c level_0/serialize.c level_0/private-serialize.c level_0/socket.c level_0/utf.c level_0/private-utf.c level_1/color.c level_1/console.c level_1/directory.c level_1/private-directory.c level_1/fss.c level_1/private-fss.c level_1/fss_basic.c level_1/fss_basic_list.c level_1/fss_extended.c level_1/fss_extended_list.c level_1/print.c level_1/status.c level_1/string.c level_1/private-string.c level_1/utf.c level_1/private-utf.c level_1/utf_file.c level_1/private-utf_file.c level_2/directory.c level_2/execute.c level_2/private-execute.c level_2/file.c level_2/fss.c level_2/fss_basic.c level_2/fss_basic_list.c level_2/fss_extended.c level_2/fss_extended_list.c level_2/fss_status.c level_2/program.c level_2/status.c
build_sources_program
build_sources_headers level_0/color.h level_0/console.h level_0/conversion.h level_0/directory.h level_0/directory_type.h level_0/environment.h level_0/file.h level_0/fss.h level_0/memory.h level_0/path.h level_0/pipe.h level_0/print.h level_0/serialize.h level_0/socket.h level_0/status.h level_0/status_array.h level_0/string.h level_0/type.h level_0/type_array.h level_0/utf.h level_1/color.h level_1/console.h level_1/directory.h level_1/fss.h level_1/fss_basic.h level_1/fss_basic_list.h level_1/fss_extended.h level_1/fss_extended_list.h level_1/fss_macro.h level_1/fss_status.h level_1/print.h level_1/status.h level_1/string.h level_1/utf.h level_1/utf_file.h level_2/directory.h level_2/execute.h level_2/file.h level_2/fss.h level_2/fss_basic.h level_2/fss_basic_list.h level_2/fss_extended.h level_2/fss_extended_list.h level_2/fss_status.h level_2/program.h level_2/status.h
build_sources_script
--- /dev/null
+#include <level_0/fss.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_f_fss_decrement_buffer_
+ f_return_status f_fss_decrement_buffer(const f_string_static buffer, f_string_range *location, const f_string_length step) {
+ #ifndef _di_level_0_parameter_checking_
+ if (buffer.used <= 0) return F_status_set_error(F_parameter);
+ if (location->start < 0) return F_status_set_error(F_parameter);
+ if (location->stop < location->start) return F_status_set_error(F_parameter);
+ if (location->start >= buffer.used) return F_status_set_error(F_parameter);
+ if (step < 1) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ if (location->start < 1) return F_none_eos;
+
+ f_string_length i = 0;
+ unsigned short width = 0;
+
+ do {
+ width = f_macro_utf_byte_width(buffer.string[location->start - 1]);
+
+ if (width > location->start) {
+ if (width > 1) {
+ return F_status_set_error(F_incomplete_utf_eos);
+ }
+
+ return F_none_eos;
+ }
+
+ i++;
+ location->start -= width;
+ } while (i < step);
+
+ return F_none;
+ }
+#endif // _di_f_fss_decrement_buffer_
+
+#ifndef _di_f_fss_increment_buffer_
+ f_return_status f_fss_increment_buffer(const f_string_static buffer, f_string_range *location, const f_string_length step) {
+ #ifndef _di_level_0_parameter_checking_
+ if (buffer.used <= 0) return F_status_set_error(F_parameter);
+ if (location->start < 0) return F_status_set_error(F_parameter);
+ if (location->stop < location->start) return F_status_set_error(F_parameter);
+ if (location->start >= buffer.used) return F_status_set_error(F_parameter);
+ if (step < 1) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ f_string_length i = 0;
+ unsigned short width = 0;
+
+ do {
+ width = f_macro_utf_byte_width(buffer.string[location->start]);
+
+ if (location->start + width > location->stop) {
+ if (width > 1) {
+ return F_status_set_error(F_incomplete_utf_stop);
+ }
+
+ location->start += width;
+ return F_none_stop;
+ }
+ else if (location->start + width >= buffer.used) {
+ if (width > 1) {
+ return F_status_set_error(F_incomplete_utf_eos);
+ }
+
+ location->start += width;
+ return F_none_eos;
+ }
+
+ i++;
+ location->start += width;
+ } while (i < step);
+
+ return F_none;
+ }
+#endif // _di_f_fss_increment_buffer_
+
+#ifndef _di_f_fss_is_graph_
+ f_return_status f_fss_is_graph(const f_string_static buffer, const f_string_range range) {
+ #ifndef _di_level_0_parameter_checking_
+ if (buffer.used <= 0) return F_status_set_error(F_parameter);
+ if (range.start < 0) return F_status_set_error(F_parameter);
+ if (range.stop < range.start) return F_status_set_error(F_parameter);
+ if (range.start >= buffer.used) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ f_string_length width_max = (range.stop - range.start) + 1;
+
+ if (width_max > buffer.used - range.start) {
+ width_max = buffer.used - range.start;
+ }
+
+ return f_utf_is_graph(buffer.string + range.start, width_max);
+ }
+#endif // _di_f_fss_is_graph_
+
+#ifndef _di_f_fss_is_space_
+ f_return_status f_fss_is_space(const f_string_static buffer, const f_string_range range) {
+ #ifndef _di_level_0_parameter_checking_
+ if (buffer.used <= 0) return F_status_set_error(F_parameter);
+ if (range.start < 0) return F_status_set_error(F_parameter);
+ if (range.stop < range.start) return F_status_set_error(F_parameter);
+ if (range.start >= buffer.used) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ f_string_length width_max = (range.stop - range.start) + 1;
+
+ if (width_max > buffer.used - range.start) {
+ width_max = buffer.used - range.start;
+ }
+
+ return f_utf_is_whitespace(buffer.string + range.start, width_max);
+ }
+#endif // _di_f_fss_is_space_
+
+#ifndef _di_f_fss_shift_delimiters_
+ f_return_status f_fss_shift_delimiters(f_string_dynamic *buffer, const f_string_range range) {
+ #ifndef _di_level_0_parameter_checking_
+ if (buffer->used <= 0) return F_status_set_error(F_parameter);
+ if (range.start < 0) return F_status_set_error(F_parameter);
+ if (range.stop < range.start) return F_status_set_error(F_parameter);
+ if (range.start >= buffer->used) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ f_string_length position = 0;
+ f_string_length distance = 0;
+ unsigned short utf_width = 0;
+ unsigned short i = 0;
+
+ position = range.start;
+
+ while (position < buffer->used && position <= range.stop) {
+ if (buffer->string[position] == f_fss_delimit_placeholder) {
+ distance++;
+ }
+
+ // do not waste time trying to process what is only going to be replaced with a delimit placeholder
+ if (position + distance >= buffer->used || position + distance > range.stop) {
+ break;
+ }
+
+ utf_width = f_macro_utf_byte_width_is(buffer->string[position]);
+ if (utf_width > 1) {
+ // not enough space in buffer or in range range to process UTF-8 character.
+ if (position + utf_width >= buffer->used || position + utf_width > range.stop) {
+ return F_status_set_error(F_utf);
+ }
+
+ if (distance > 0) {
+ while (utf_width > 0) {
+ buffer->string[position] = buffer->string[position + distance];
+ utf_width--;
+ position++;
+ }
+ }
+ }
+ else {
+ // shift everything down one for each placeholder found
+ if (distance > 0) {
+ buffer->string[position] = buffer->string[position + distance];
+ }
+
+ position++;
+ }
+ }
+
+ if (distance > 0) {
+ while (position < buffer->used + distance && position <= range.stop) {
+ buffer->string[position] = f_fss_delimit_placeholder;
+ position++;
+ }
+ }
+
+ return F_none;
+ }
+#endif // _di_f_fss_shift_delimiters_
+
+#ifndef _di_f_fss_skip_past_space_
+ f_return_status f_fss_skip_past_space(const f_string_static buffer, f_string_range *range) {
+ #ifndef _di_level_0_parameter_checking_
+ if (buffer.used <= 0) return F_status_set_error(F_parameter);
+ if (range == 0) return F_status_set_error(F_parameter);
+ if (range->start < 0) return F_status_set_error(F_parameter);
+ if (range->stop < range->start) return F_status_set_error(F_parameter);
+ if (range->start >= buffer.used) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ f_status status = F_none;
+ unsigned short width = 0;
+
+ f_string_length width_max = (range->stop - range->start) + 1;
+
+ if (width_max > buffer.used - range->start) {
+ width_max = buffer.used - range->start;
+ }
+
+ for (;;) {
+ if (buffer.string[range->start] != f_fss_delimit_placeholder) {
+ status = f_utf_is_whitespace(buffer.string + range->start, width_max);
+
+ if (status == F_false) {
+ status = f_utf_is_control(buffer.string + range->start, width_max);
+
+ if (status == F_false) {
+ status = f_utf_is_zero_width(buffer.string + range->start, width_max);
+
+ if (status == F_true) {
+ f_string_length next_width_max = 0;
+
+ for (f_string_length next = range->start + 1; next < buffer.used && next <= range->stop; next += f_macro_utf_byte_width_is(buffer.string[next])) {
+ next_width_max = (range->stop - next) + 1;
+
+ status = f_utf_is_whitespace(buffer.string + next, width_max);
+ if (status == F_true) {
+ // treat zero-width before a space like a space.
+ break;
+ }
+ else if (status == F_false) {
+ status = f_utf_is_control(buffer.string + next, width_max);
+
+ if (status == F_true) {
+ // treat zero-width before a control character like a space.
+ break;
+ }
+ else if (status == F_false) {
+ status = f_utf_is_zero_width(buffer.string + next, width_max);
+
+ if (status == F_true) {
+ // seek until a non-zero-width is reached.
+ continue;
+ }
+ else if (status == F_false) {
+ // treat zero-width as a non-whitespace non-control character when preceding a non-whitespace non-control character.
+ return F_none;
+ }
+ }
+ else if (F_status_is_error(status)) return status;
+ }
+ else if (F_status_is_error(status)) return status;
+ } // for
+ }
+ else if (status == F_false) {
+ // treat zero-width as a graph when preceding a non-whitespace non-control (that is not a zero-width).
+ return F_none;
+ }
+ else if (F_status_is_error(status)) return status;
+ }
+ else if (F_status_is_error(status)) return status;
+ }
+ else if (F_status_is_error(status)) return status;
+ }
+
+ if (buffer.string[range->start] == f_string_eol[0]) return F_none_eol;
+
+ width = f_macro_utf_byte_width_is(buffer.string[range->start]);
+
+ if (width == 0) {
+ width = 1;
+ }
+ // Do not operate on UTF-8 fragments that are not the first byte of the character.
+ else if (width == 1) {
+ return F_status_set_error(F_incomplete_utf);
+ }
+ else {
+ if (range->start + width >= buffer.used) return F_status_set_error(F_incomplete_utf_eos);
+ if (range->start + width > range->stop) return F_status_set_error(F_incomplete_utf_stop);
+ }
+
+ range->start += width;
+
+ if (range->start >= buffer.used) return F_none_eos;
+ if (range->start > range->stop) return F_none_stop;
+
+ width_max = (range->stop - range->start) + 1;
+
+ if (width_max > buffer.used - range->start) {
+ width_max = buffer.used - range->start;
+ }
+ } // for
+
+ if (F_status_is_error(status)) return status;
+
+ return F_none;
+ }
+#endif // _di_f_fss_skip_past_space_
+
+#ifndef _di_f_fss_skip_past_non_graph_
+ f_return_status f_fss_skip_past_non_graph(const f_string_static buffer, f_string_range *range) {
+ #ifndef _di_level_0_parameter_checking_
+ if (buffer.used <= 0) return F_status_set_error(F_parameter);
+ if (range == 0) return F_status_set_error(F_parameter);
+ if (range->start < 0) return F_status_set_error(F_parameter);
+ if (range->stop < range->start) return F_status_set_error(F_parameter);
+ if (range->start >= buffer.used) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ f_status status = F_none;
+ unsigned short width = 0;
+
+ f_string_length width_max = (range->stop - range->start) + 1;
+
+ if (width_max > buffer.used - range->start) {
+ width_max = buffer.used - range->start;
+ }
+
+ for (;;) {
+ if (buffer.string[range->start] != f_fss_delimit_placeholder) {
+ status = f_utf_is_graph(buffer.string + range->start, width_max);
+
+ if (status == F_true) {
+ // stop at a graph.
+ break;
+ }
+ else if (status == F_false) {
+ status = f_utf_is_zero_width(buffer.string + range->start, width_max);
+
+ if (status == F_true) {
+ f_string_length next_width_max = 0;
+
+ for (f_string_length next = range->start + 1; next < buffer.used && next <= range->stop; next += f_macro_utf_byte_width_is(buffer.string[next])) {
+ next_width_max = (range->stop - next) + 1;
+
+ status = f_utf_is_graph(buffer.string + next, width_max);
+ if (status == F_true) {
+ // treat zero-width as a graph when preceding a graph.
+ return F_none;
+ }
+ else if (status == F_false) {
+ status = f_utf_is_zero_width(buffer.string + next, width_max);
+
+ if (status == F_true) {
+ // seek until a non-zero-width is reached.
+ continue;
+ }
+ else if (status == F_false) {
+ // treat zero-width as a non-graph when preceding a non-graph (that is not a zero-width).
+ break;
+ }
+ else if (F_status_is_error(status)) return status;
+ }
+ else if (F_status_is_error(status)) return status;
+ } // for
+ }
+ else if (status == F_false) {
+ // continue on when non-graph and non-zero-width.
+ break;
+ }
+ else if (F_status_is_error(status)) return status;
+ }
+ else if (F_status_is_error(status)) return status;
+ }
+
+ if (F_status_is_error(status)) return status;
+
+ width = f_macro_utf_byte_width_is(buffer.string[range->start]);
+
+ if (width == 0) {
+ width = 1;
+ }
+ // Do not operate on UTF-8 fragments that are not the first byte of the character.
+ else if (width == 1) {
+ return F_status_set_error(F_incomplete_utf);
+ }
+ else {
+ if (range->start + width >= buffer.used) return F_status_set_error(F_incomplete_utf_eos);
+ if (range->start + width > range->stop) return F_status_set_error(F_incomplete_utf_stop);
+ }
+
+ range->start += width;
+
+ if (range->start >= buffer.used) return F_none_eos;
+ if (range->start > range->stop) return F_none_stop;
+
+ width_max = (range->stop - range->start) + 1;
+
+ if (width_max > buffer.used - range->start) {
+ width_max = buffer.used - range->start;
+ }
+ } // for
+
+ if (F_status_is_error(status)) return status;
+
+ return F_none;
+ }
+#endif // _di_f_fss_skip_past_non_graph_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
#define _F_fss_h
// fll-0 includes
+#include <level_0/type.h>
#include <level_0/status.h>
#include <level_0/memory.h>
#include <level_0/string.h>
-#include <level_0/type.h>
+#include <level_0/utf.h>
#ifdef __cplusplus
extern "C" {
}
#endif // _di_fss_nests_
+/**
+ * Continue to the previous character, based on step and character width.
+ *
+ * The start position must be at the start of a valid UTF-8 block.
+ *
+ * @param buffer
+ * The string to process.
+ * @param range
+ * The start and stop positions to be incremented.
+ * The start position will be incremented by step.
+ * @param step
+ * The number of steps to decrement the start position.
+ * The steps refer to characters and not integers.
+ * Essentially this number is considered against the width of every character found.
+ * (For ASCII each step would be (sizeof(int8_t), which is 1).
+ * (For UTF-8 character of width 3, each step would be (3 * sizeof(int8_t)).
+ *
+ * @return
+ * F_none on success.
+ * F_none_stop if the stop range is reached before all steps are completed.
+ * F_none_eos if the end of buffer is reached before all steps are completed.
+ * F_incomplete_utf_eos (with error bit) if the end of buffer is reached before the complete UTF-8 character can be processed.
+ * F_parameter (with error bit) if a parameter is invalid.
+ */
+#ifndef _di_f_fss_decrement_buffer_
+ extern f_return_status f_fss_decrement_buffer(const f_string_static buffer, f_string_range *range, const f_string_length step);
+#endif // _di_f_fss_decrement_buffer_
+
+/**
+ * Continue to the next character, based on step and character width.
+ *
+ * The start position must be at the start of a valid UTF-8 block.
+ *
+ * @param buffer
+ * The string to process.
+ * @param range
+ * The start and stop positions to be incremented.
+ * The start position will be incremented by step.
+ * @param step
+ * The number of steps to increment the start position.
+ * The steps refer to characters and not integers.
+ * Essentially this number is considered against the width of every character found.
+ * (For ASCII each step would be (sizeof(int8_t), which is 1).
+ * (For UTF-8 character of width 3, each step would be (3 * sizeof(int8_t)).
+ *
+ * @return
+ * F_none on success.
+ * F_none_stop if the stop range is reached before all steps are completed.
+ * F_none_eos if the end of buffer is reached before all steps are completed.
+ * F_incomplete_utf_stop (with error bit) if the stop range is reached before the complete UTF-8 character can be processed.
+ * F_incomplete_utf_eos (with error bit) if the end of buffer is reached before the complete UTF-8 character can be processed.
+ * F_parameter (with error bit) if a parameter is invalid.
+ */
+#ifndef _di_f_fss_increment_buffer_
+ extern f_return_status f_fss_increment_buffer(const f_string_static buffer, f_string_range *range, const f_string_length step);
+#endif // _di_f_fss_increment_buffer_
+
+/**
+ * Identify whether or not a character in the buffer is a graph (ASCII or UTF-8) character.
+ *
+ * @param buffer
+ * The string to process.
+ * @param range
+ * The character at the start position will be checked against the graph.
+ * @param header
+ * The header data to populate with results of this function.
+ *
+ * @return
+ * F_true if the character in the buffer is a graph character.
+ * F_false if the character in the buffer is not a graph character.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors from (with error bit): f_utf_is_graph().
+ *
+ * @see f_utf_is_graph()
+ */
+#ifndef _di_f_fss_is_graph_
+ extern f_return_status f_fss_is_graph(const f_string_static buffer, const f_string_range range);
+#endif // _di_f_fss_is_graph_
+
+/**
+ * Identify whether or not a character in the buffer is a space (ASCII or UTF-8) character.
+ *
+ * @param buffer
+ * The string to process.
+ * @param range
+ * The character at the start position will be checked against the graph.
+ * @param header
+ * The header data to populate with results of this function.
+ *
+ * @return
+ * F_true if the character in the buffer is a space character.
+ * F_false if the character in the buffer is not a space character.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors from (with error bit): f_utf_is_space().
+ *
+ * @see f_utf_is_space()
+ */
+#ifndef _di_f_fss_is_space_
+ extern f_return_status f_fss_is_space(const f_string_static buffer, const f_string_range range);
+#endif // _di_f_fss_is_space_
+
+/**
+ * Shift all of the delimiters to the end of the used buffer.
+ *
+ * This allows one to do a printf on the dynamic string without the delimiters arbitrarily stopping the output.
+ * No reallocations are performed, this will only shift characters.
+ *
+ * @param buffer
+ * The string to process.
+ * This gets updated.
+ * @param range
+ * A restriction on where within the buffer the shifting happens.
+ *
+ * @return
+ * F_none on success.
+ * F_utf (with error bit) if UTF-8 cannot be fully processed (buffer or range range not long enough).
+ * F_parameter (with error bit) if a parameter is invalid.
+ */
+#ifndef _di_f_fss_shift_delimiters_
+ extern f_return_status f_fss_shift_delimiters(f_string_dynamic *buffer, const f_string_range range);
+#endif // _di_f_fss_shift_delimiters_
+
+/**
+ * Skip past all whitespace and control characters, except newline.
+ *
+ * Zero-width characters are not skipped because they might be part of a graph character, such as combining characters.
+ * @todo needs consideration on how to handle zero-width before space/control vs zero-width before graph.
+ *
+ * @param buffer
+ * The string to process.
+ * @param range
+ * The start and stop positions in the buffer being processed.
+ * This increments range->start.
+ *
+ * @return
+ * F_none on success.
+ * F_none_eol on success and EOL was reached.
+ * F_none_eos on success and EOS was reached.
+ * F_none_stop on success and stop point was reached.
+ * F_incomplete_utf (with error bit) if an incomplete UTF-8 fragment was found.
+ * F_incomplete_utf_eos (with error bit) if unable to get entire UTF-8 sequence due to EOS.
+ * F_incomplete_utf_stop (with error bit) if unable to get entire UTF-8 sequence due to stop point reached.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors from (with error bit): f_utf_is_control().
+ * Errors from (with error bit): f_utf_is_whitespace().
+ * Errors from (with error bit): f_utf_is_zero_width().
+ *
+ * @see f_utf_is_control()
+ * @see f_utf_is_whitespace()
+ * @see f_utf_is_zero_width()
+ */
+#ifndef _di_f_fss_skip_past_space_
+ extern f_return_status f_fss_skip_past_space(const f_string_static buffer, f_string_range *range);
+#endif // _di_f_fss_skip_past_space_
+
+/**
+ * Skip past all non-graph and non-zero-width characters (whitespace and control characters).
+ *
+ * Zero-width characters are not skipped because they might be part of a graph character, such as combining characters.
+ * @todo needs consideration on how to handle zero-width before space/control vs zero-width before graph.
+ *
+ * @param buffer
+ * The string to process.
+ * @param range
+ * The start and stop positions in the buffer being processed.
+ * This increments range->start.
+ *
+ * @return
+ * F_none on success.
+ * F_none_eol on success and EOL was reached.
+ * F_none_eos on success and EOS was reached.
+ * F_none_stop on success and stop point was reached.
+ * F_incomplete_utf (with error bit) if an incomplete UTF-8 fragment was found.
+ * F_incomplete_utf_eos (with error bit) if unable to get entire UTF-8 sequence due to EOS.
+ * F_incomplete_utf_stop (with error bit) if unable to get entire UTF-8 sequence due to stop point reached.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors from (with error bit): f_utf_is_graph().
+ * Errors from (with error bit): f_utf_is_zero_width().
+ *
+ * @see f_utf_is_graph()
+ * @see f_utf_is_zero_width()
+ */
+#ifndef _di_f_fss_skip_past_non_graph_
+ extern f_return_status f_fss_skip_past_non_graph(const f_string_static buffer, f_string_range *range);
+#endif // _di_f_fss_skip_past_non_graph_
+
#ifdef __cplusplus
} // extern "C"
#endif
f_status
f_memory
f_string
+f_utf
build_language c
build_linker ar
build_libraries -lc
-build_libraries-individual -lf_memory
-build_sources_library
+build_libraries-individual -lf_utf -lf_memory
+build_sources_library fss.c
build_sources_program
build_sources_headers fss.h
build_sources_script
build_language c
build_linker ar
build_libraries -lc
-build_libraries-individual -lf_memory
+build_libraries-individual -lf_utf -lf_memory
build_sources_library serialize.c private-serialize.c
build_sources_program
build_sources_headers serialize.h
* These are provided for internal reduction in redundant code.
* These should not be exposed/used outside of this project.
*/
-#ifndef _PRIVATE_FL_utf_h
-#define _PRIVATE_FL_utf_h
+#ifndef _PRIVATE_F_utf_h
+#define _PRIVATE_F_utf_h
#ifdef __cplusplus
extern "C" {
* The number of bytes repesenting the character width.
*
* @return
- * F_true if a UTF-8 control character.
* F_false if not a UTF-8 control character.
+ * F_true if a UTF-8 control character.
* F_utf (with error bit) if character is an invalid UTF-8 character.
*
* @see iscntrl()
* The number of bytes repesenting the character width.
*
* @return
- * F_true if a UTF-8 control character.
* F_false if not a UTF-8 control character.
+ * F_true if a UTF-8 control character.
* F_utf (with error bit) if character is an invalid UTF-8 character.
*
* @see iscntrl()
* The number of bytes repesenting the character width.
*
* @return
- * F_true if a UTF-8 control character.
* F_false if not a UTF-8 control character.
+ * F_true if a UTF-8 control character.
* F_utf (with error bit) if character is an invalid UTF-8 character.
*
* @see iscntrl()
* The character to validate.
*
* @return
- * F_true if a UTF-8 control picture character.
* F_false if not a UTF-8 control picture character.
+ * F_true if a UTF-8 control picture character.
* F_utf (with error bit) if character is an invalid UTF-8 character.
*
* @see f_utf_character_is_control_picture()
* The number of bytes repesenting the character width.
*
* @return
- * F_true if a UTF-8 control character.
* F_false if not a UTF-8 control character.
+ * F_true if a UTF-8 control character.
* F_utf (with error bit) if character is an invalid UTF-8 character.
*
* @see iscntrl()
* The number of bytes repesenting the character width.
*
* @return
- * F_true if a UTF-8 control character.
* F_false if not a UTF-8 control character.
+ * F_true if a UTF-8 control character.
* F_utf (with error bit) if character is an invalid UTF-8 character.
*
* @see iscntrl()
* The number of bytes repesenting the character width.
*
* @return
- * F_true if a UTF-8 control character.
* F_false if not a UTF-8 control character.
+ * F_true if a UTF-8 control character.
* F_utf (with error bit) if character is an invalid UTF-8 character.
*
* @see iscntrl()
* The number of bytes repesenting the character width.
*
* @return
- * F_false if not a UTF-8 control character.
* F_true if a UTF-8 control character.
+ * F_false if not a UTF-8 control character.
* F_utf (with error bit) if character is an invalid UTF-8 character.
*
* @see iscntrl()
} // extern "C"
#endif
-#endif // _PRIVATE_FL_utf_h
+#endif // _PRIVATE_F_utf_h
#include <level_1/fss.h>
+#include "private-fss.h"
#ifdef __cplusplus
extern "C" {
#endif
-#ifndef _di_fl_fss_decrement_buffer_
- f_return_status fl_fss_decrement_buffer(const f_string_static buffer, f_string_range *location, const f_string_length step) {
- #ifndef _di_level_1_parameter_checking_
- if (buffer.used <= 0) return F_status_set_error(F_parameter);
- if (location->start < 0) return F_status_set_error(F_parameter);
- if (location->stop < location->start) return F_status_set_error(F_parameter);
- if (location->start >= buffer.used) return F_status_set_error(F_parameter);
- if (step < 1) return F_status_set_error(F_parameter);
- #endif // _di_level_1_parameter_checking_
-
- if (location->start < 1) return F_none_eos;
-
- f_string_length i = 0;
- unsigned short width = 0;
-
- do {
- width = f_macro_utf_byte_width(buffer.string[location->start - 1]);
-
- if (width > location->start) {
- if (width > 1) {
- return F_status_set_error(F_incomplete_utf_eos);
- }
-
- return F_none_eos;
- }
-
- i++;
- location->start -= width;
- } while (i < step);
-
- return F_none;
- }
-#endif // _di_fl_fss_decrement_buffer_
-
#ifndef _di_fl_fss_identify_
f_return_status fl_fss_identify(const f_string_static buffer, f_fss_header *header) {
#ifndef _di_level_1_parameter_checking_
if (buffer.used <= 0) return F_status_set_error(F_parameter);
#endif // _di_level_1_parameter_checking_
- register f_string_length i = 0;
-
- if (buffer.used < 10) {
- // "# fss-0000" is always at least 10 characters.
- return FL_fss_header_not;
- }
-
- // If this correctly follows the FSS specification, then this should be all that needs to be done (as well as atoh for ascii to hex).
- // All characters used in the identifier are only in the ascii equivalents of the characters, any similarly looking character or number representing in UTF-8 is considered invalid.
- if (buffer.string[i] == f_fss_type_header_open) {
- i++;
-
- if (buffer.string[i] == f_fss_type_header_part1) {
- i++;
-
- if (buffer.string[i] == f_fss_type_header_part2) {
- i++;
-
- if (buffer.string[i] == f_fss_type_header_part3) {
- i++;
-
- if (buffer.string[i] == f_fss_type_header_part4) {
- i++;
-
- if (buffer.string[i] == f_fss_type_header_part5) {
- i++;
-
- if (f_conversion_character_is_hexidecimal(buffer.string[i]) == F_true) {
- i++;
-
- if (f_conversion_character_is_hexidecimal(buffer.string[i]) == F_true) {
- i++;
-
- if (f_conversion_character_is_hexidecimal(buffer.string[i]) == F_true) {
- i++;
-
- if (f_conversion_character_is_hexidecimal(buffer.string[i]) == F_true) {
- i++;
-
- f_string_range range = f_string_range_initialize;
-
- range.start = i - 4;
- range.stop = i;
-
- // 1: A possibly valid header type was found, now convert it into its proper format and save the header type.
- const f_status status = f_conversion_string_to_hexidecimal_unsigned(buffer.string, &header->type, range);
- if (F_status_is_error(status)) return status;
-
- if (status == F_none) {
- // 2: At this point, we can still know the proper format for the file and still have a invalid header, handle accordingly.
- if (buffer.string[i] == f_fss_type_header_close) {
- header->length = i + 1;
-
- return F_none;
- }
- else {
- // if "# fss-0000" is there, regardless of whats next, we can guess this to be of fss-0000, even if its fss-00001 (this is a guess afterall).
- header->length = i + 1;
-
- return F_status_is_warning(FL_fss_accepted_invalid);
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- // people can miss spaces, so lets accept in an attempt to interpret the file anyway, but return values at this point are to be flagged as invalid.
- else if (buffer.string[i] == f_fss_type_header_part2) {
- i++;
-
- if (buffer.string[i] == f_fss_type_header_part3) {
- i++;
-
- if (buffer.string[i] == f_fss_type_header_part4) {
- i++;
-
- if (buffer.string[i] == f_fss_type_header_part5) {
- i++;
-
- if (f_conversion_character_is_hexidecimal(buffer.string[i]) == F_true) {
- i++;
-
- if (f_conversion_character_is_hexidecimal(buffer.string[i]) == F_true) {
- i++;
-
- if (f_conversion_character_is_hexidecimal(buffer.string[i]) == F_true) {
- i++;
-
- if (f_conversion_character_is_hexidecimal(buffer.string[i]) == F_true) {
- i++;
-
- f_string_range range = f_string_range_initialize;
-
- range.start = i - 4;
- range.stop = i;
-
- const f_status status = f_conversion_string_to_hexidecimal_unsigned(buffer.string, &header->type, range);
- if (F_status_is_error(status)) return status;
-
- header->length = i + 1;
-
- return F_status_is_warning(FL_fss_accepted_invalid);
- }
- }
- }
- }
- }
- }
- }
- }
- }
-
- // @todo At some point add checksum and compressions checks here, but the above statements will have to be adjusted accordingly.
- // 3: eventually this will be processing the checksum and 4: will be processing the compression.
-
- return FL_fss_header_not;
+ return private_fl_fss_identify(buffer, header);
}
#endif // _di_fl_fss_identify_
status = f_file_read_until(*file, &buffer, f_fss_max_header_length + 1);
if (F_status_is_error(status)) return status;
- return fl_fss_identify(buffer, header);
+ return private_fl_fss_identify(buffer, header);
}
#endif // _di_fl_fss_identify_file_
-#ifndef _di_fl_fss_increment_buffer_
- f_return_status fl_fss_increment_buffer(const f_string_static buffer, f_string_range *location, const f_string_length step) {
- #ifndef _di_level_1_parameter_checking_
- if (buffer.used <= 0) return F_status_set_error(F_parameter);
- if (location->start < 0) return F_status_set_error(F_parameter);
- if (location->stop < location->start) return F_status_set_error(F_parameter);
- if (location->start >= buffer.used) return F_status_set_error(F_parameter);
- if (step < 1) return F_status_set_error(F_parameter);
- #endif // _di_level_1_parameter_checking_
-
- f_string_length i = 0;
- unsigned short width = 0;
-
- do {
- width = f_macro_utf_byte_width(buffer.string[location->start]);
-
- if (location->start + width > location->stop) {
- if (width > 1) {
- return F_status_set_error(F_incomplete_utf_stop);
- }
-
- location->start += width;
- return F_none_stop;
- }
- else if (location->start + width >= buffer.used) {
- if (width > 1) {
- return F_status_set_error(F_incomplete_utf_eos);
- }
-
- location->start += width;
- return F_none_eos;
- }
-
- i++;
- location->start += width;
- } while (i < step);
-
- return F_none;
- }
-#endif // _di_fl_fss_increment_buffer_
-
-#ifndef _di_fl_fss_is_graph_
- f_return_status fl_fss_is_graph(const f_string_static buffer, const f_string_range range) {
- #ifndef _di_level_1_parameter_checking_
- if (buffer.used <= 0) return F_status_set_error(F_parameter);
- if (range.start < 0) return F_status_set_error(F_parameter);
- if (range.stop < range.start) return F_status_set_error(F_parameter);
- if (range.start >= buffer.used) return F_status_set_error(F_parameter);
- #endif // _di_level_1_parameter_checking_
-
- f_string_length width_max = (range.stop - range.start) + 1;
-
- if (width_max > buffer.used - range.start) {
- width_max = buffer.used - range.start;
- }
-
- return f_utf_is_graph(buffer.string + range.start, width_max);
- }
-#endif // _di_fl_fss_is_graph_
-
-#ifndef _di_fl_fss_is_space_
- f_return_status fl_fss_is_space(const f_string_static buffer, const f_string_range range) {
- #ifndef _di_level_1_parameter_checking_
- if (buffer.used <= 0) return F_status_set_error(F_parameter);
- if (range.start < 0) return F_status_set_error(F_parameter);
- if (range.stop < range.start) return F_status_set_error(F_parameter);
- if (range.start >= buffer.used) return F_status_set_error(F_parameter);
- #endif // _di_level_1_parameter_checking_
-
- f_string_length width_max = (range.stop - range.start) + 1;
-
- if (width_max > buffer.used - range.start) {
- width_max = buffer.used - range.start;
- }
-
- return f_utf_is_whitespace(buffer.string + range.start, width_max);
- }
-#endif // _di_fl_fss_is_space_
-
-#ifndef _di_fl_fss_shift_delimiters_
- f_return_status fl_fss_shift_delimiters(f_string_dynamic *buffer, const f_string_range range) {
- #ifndef _di_level_1_parameter_checking_
- if (buffer->used <= 0) return F_status_set_error(F_parameter);
- if (range.start < 0) return F_status_set_error(F_parameter);
- if (range.stop < range.start) return F_status_set_error(F_parameter);
- if (range.start >= buffer->used) return F_status_set_error(F_parameter);
- #endif // _di_level_1_parameter_checking_
-
- f_string_length position = 0;
- f_string_length distance = 0;
- unsigned short utf_width = 0;
- unsigned short i = 0;
-
- position = range.start;
-
- while (position < buffer->used && position <= range.stop) {
- if (buffer->string[position] == f_fss_delimit_placeholder) {
- distance++;
- }
-
- // do not waste time trying to process what is only going to be replaced with a delimit placeholder
- if (position + distance >= buffer->used || position + distance > range.stop) {
- break;
- }
-
- utf_width = f_macro_utf_byte_width_is(buffer->string[position]);
- if (utf_width > 1) {
- // not enough space in buffer or in range range to process UTF-8 character.
- if (position + utf_width >= buffer->used || position + utf_width > range.stop) {
- return F_status_set_error(F_utf);
- }
-
- if (distance > 0) {
- while (utf_width > 0) {
- buffer->string[position] = buffer->string[position + distance];
- utf_width--;
- position++;
- }
- }
- }
- else {
- // shift everything down one for each placeholder found
- if (distance > 0) {
- buffer->string[position] = buffer->string[position + distance];
- }
-
- position++;
- }
- }
-
- if (distance > 0) {
- while (position < buffer->used + distance && position <= range.stop) {
- buffer->string[position] = f_fss_delimit_placeholder;
- position++;
- }
- }
-
- return F_none;
- }
-#endif // _di_fl_fss_shift_delimiters_
-
-#ifndef _di_fl_fss_skip_past_space_
- f_return_status fl_fss_skip_past_space(const f_string_static buffer, f_string_range *range) {
- #ifndef _di_level_1_parameter_checking_
- if (buffer.used <= 0) return F_status_set_error(F_parameter);
- if (range == 0) return F_status_set_error(F_parameter);
- if (range->start < 0) return F_status_set_error(F_parameter);
- if (range->stop < range->start) return F_status_set_error(F_parameter);
- if (range->start >= buffer.used) return F_status_set_error(F_parameter);
- #endif // _di_level_1_parameter_checking_
-
- f_status status = F_none;
- unsigned short width = 0;
-
- f_string_length width_max = (range->stop - range->start) + 1;
-
- if (width_max > buffer.used - range->start) {
- width_max = buffer.used - range->start;
- }
-
- for (;;) {
- if (buffer.string[range->start] != f_fss_delimit_placeholder) {
- status = f_utf_is_whitespace(buffer.string + range->start, width_max);
-
- if (status == F_false) {
- status = f_utf_is_control(buffer.string + range->start, width_max);
-
- if (status == F_false) {
- status = f_utf_is_zero_width(buffer.string + range->start, width_max);
-
- if (status == F_true) {
- f_string_length next_width_max = 0;
-
- for (f_string_length next = range->start + 1; next < buffer.used && next <= range->stop; next += f_macro_utf_byte_width_is(buffer.string[next])) {
- next_width_max = (range->stop - next) + 1;
-
- status = f_utf_is_whitespace(buffer.string + next, width_max);
- if (status == F_true) {
- // treat zero-width before a space like a space.
- break;
- }
- else if (status == F_false) {
- status = f_utf_is_control(buffer.string + next, width_max);
-
- if (status == F_true) {
- // treat zero-width before a control character like a space.
- break;
- }
- else if (status == F_false) {
- status = f_utf_is_zero_width(buffer.string + next, width_max);
-
- if (status == F_true) {
- // seek until a non-zero-width is reached.
- continue;
- }
- else if (status == F_false) {
- // treat zero-width as a non-whitespace non-control character when preceding a non-whitespace non-control character.
- return F_none;
- }
- }
- else if (F_status_is_error(status)) return status;
- }
- else if (F_status_is_error(status)) return status;
- } // for
- }
- else if (status == F_false) {
- // treat zero-width as a graph when preceding a non-whitespace non-control (that is not a zero-width).
- return F_none;
- }
- else if (F_status_is_error(status)) return status;
- }
- else if (F_status_is_error(status)) return status;
- }
- else if (F_status_is_error(status)) return status;
- }
-
- if (buffer.string[range->start] == f_string_eol[0]) return F_none_eol;
-
- width = f_macro_utf_byte_width_is(buffer.string[range->start]);
-
- if (width == 0) {
- width = 1;
- }
- // Do not operate on UTF-8 fragments that are not the first byte of the character.
- else if (width == 1) {
- return F_status_set_error(F_incomplete_utf);
- }
- else {
- if (range->start + width >= buffer.used) return F_status_set_error(F_incomplete_utf_eos);
- if (range->start + width > range->stop) return F_status_set_error(F_incomplete_utf_stop);
- }
-
- range->start += width;
-
- if (range->start >= buffer.used) return F_none_eos;
- if (range->start > range->stop) return F_none_stop;
-
- width_max = (range->stop - range->start) + 1;
-
- if (width_max > buffer.used - range->start) {
- width_max = buffer.used - range->start;
- }
- } // for
-
- if (F_status_is_error(status)) return status;
-
- return F_none;
- }
-#endif // _di_fl_fss_skip_past_space_
-
-#ifndef _di_fl_fss_skip_past_non_graph_
- f_return_status fl_fss_skip_past_non_graph(const f_string_static buffer, f_string_range *range) {
- #ifndef _di_level_1_parameter_checking_
- if (buffer.used <= 0) return F_status_set_error(F_parameter);
- if (range == 0) return F_status_set_error(F_parameter);
- if (range->start < 0) return F_status_set_error(F_parameter);
- if (range->stop < range->start) return F_status_set_error(F_parameter);
- if (range->start >= buffer.used) return F_status_set_error(F_parameter);
- #endif // _di_level_1_parameter_checking_
-
- f_status status = F_none;
- unsigned short width = 0;
-
- f_string_length width_max = (range->stop - range->start) + 1;
-
- if (width_max > buffer.used - range->start) {
- width_max = buffer.used - range->start;
- }
-
- for (;;) {
- if (buffer.string[range->start] != f_fss_delimit_placeholder) {
- status = f_utf_is_graph(buffer.string + range->start, width_max);
-
- if (status == F_true) {
- // stop at a graph.
- break;
- }
- else if (status == F_false) {
- status = f_utf_is_zero_width(buffer.string + range->start, width_max);
-
- if (status == F_true) {
- f_string_length next_width_max = 0;
-
- for (f_string_length next = range->start + 1; next < buffer.used && next <= range->stop; next += f_macro_utf_byte_width_is(buffer.string[next])) {
- next_width_max = (range->stop - next) + 1;
-
- status = f_utf_is_graph(buffer.string + next, width_max);
- if (status == F_true) {
- // treat zero-width as a graph when preceding a graph.
- return F_none;
- }
- else if (status == F_false) {
- status = f_utf_is_zero_width(buffer.string + next, width_max);
-
- if (status == F_true) {
- // seek until a non-zero-width is reached.
- continue;
- }
- else if (status == F_false) {
- // treat zero-width as a non-graph when preceding a non-graph (that is not a zero-width).
- break;
- }
- else if (F_status_is_error(status)) return status;
- }
- else if (F_status_is_error(status)) return status;
- } // for
- }
- else if (status == F_false) {
- // continue on when non-graph and non-zero-width.
- break;
- }
- else if (F_status_is_error(status)) return status;
- }
- else if (F_status_is_error(status)) return status;
- }
-
- if (F_status_is_error(status)) return status;
-
- width = f_macro_utf_byte_width_is(buffer.string[range->start]);
-
- if (width == 0) {
- width = 1;
- }
- // Do not operate on UTF-8 fragments that are not the first byte of the character.
- else if (width == 1) {
- return F_status_set_error(F_incomplete_utf);
- }
- else {
- if (range->start + width >= buffer.used) return F_status_set_error(F_incomplete_utf_eos);
- if (range->start + width > range->stop) return F_status_set_error(F_incomplete_utf_stop);
- }
-
- range->start += width;
-
- if (range->start >= buffer.used) return F_none_eos;
- if (range->start > range->stop) return F_none_stop;
-
- width_max = (range->stop - range->start) + 1;
-
- if (width_max > buffer.used - range->start) {
- width_max = buffer.used - range->start;
- }
- } // for
-
- if (F_status_is_error(status)) {
- return status;
- }
-
- return F_none;
- }
-#endif // _di_fl_fss_skip_past_non_graph_
-
#ifdef __cplusplus
} // extern "C"
#endif
#endif
/**
- * Continue to the previous character, based on step and character width.
- *
- * The start position must be at the start of a valid UTF-8 block.
- *
- * @param buffer
- * The string to process.
- * @param range
- * The start and stop positions to be incremented.
- * The start position will be incremented by step.
- * @param step
- * The number of steps to decrement the start position.
- * The steps refer to characters and not integers.
- * Essentially this number is considered against the width of every character found.
- * (For ASCII each step would be (sizeof(int8_t), which is 1).
- * (For UTF-8 character of width 3, each step would be (3 * sizeof(int8_t)).
- *
- * @return
- * F_none on success.
- * F_none_stop if the stop range is reached before all steps are completed.
- * F_none_eos if the end of buffer is reached before all steps are completed.
- * F_incomplete_utf_eos (with error bit) if the end of buffer is reached before the complete UTF-8 character can be processed.
- * F_parameter (with error bit) if a parameter is invalid.
- */
-#ifndef _di_fl_fss_decrement_buffer_
- extern f_return_status fl_fss_decrement_buffer(const f_string_static buffer, f_string_range *range, const f_string_length step);
-#endif // _di_fl_fss_decrement_buffer_
-
-/**
* Identify FSS type from a buffered string.
*
* @param buffer
*
* @return
* F_none on success.
+ * FL_fss_header_not if no header is found.
+ * FL_fss_accepted_invalid (with warning bit) if header is technically invalid but can be identified.
* F_memory_reallocation (with error bit) on memory reallocation error.
* F_parameter (with error bit) if a parameter is invalid.
+ * FL_fss_header_not (with error bit) if the an error occurred prior to identifying a valid header.
*
+ * Errors from (with error bit): f_conversion_string_to_hexidecimal_unsigned().
* Errors from (with error bit): f_file_read_until().
* Errors from (with error bit): f_file_seek().
- * Errors from (with error bit): fl_fss_identify()
*
* @see f_file_read_until()
* @see fl_fss_identify()
extern f_return_status fl_fss_identify_file(f_file *file, f_fss_header *header);
#endif // _di_fl_fss_identify_file_
-/**
- * Continue to the next character, based on step and character width.
- *
- * The start position must be at the start of a valid UTF-8 block.
- *
- * @param buffer
- * The string to process.
- * @param range
- * The start and stop positions to be incremented.
- * The start position will be incremented by step.
- * @param step
- * The number of steps to increment the start position.
- * The steps refer to characters and not integers.
- * Essentially this number is considered against the width of every character found.
- * (For ASCII each step would be (sizeof(int8_t), which is 1).
- * (For UTF-8 character of width 3, each step would be (3 * sizeof(int8_t)).
- *
- * @return
- * F_none on success.
- * F_none_stop if the stop range is reached before all steps are completed.
- * F_none_eos if the end of buffer is reached before all steps are completed.
- * F_incomplete_utf_stop (with error bit) if the stop range is reached before the complete UTF-8 character can be processed.
- * F_incomplete_utf_eos (with error bit) if the end of buffer is reached before the complete UTF-8 character can be processed.
- * F_parameter (with error bit) if a parameter is invalid.
- */
-#ifndef _di_fl_fss_increment_buffer_
- extern f_return_status fl_fss_increment_buffer(const f_string_static buffer, f_string_range *range, const f_string_length step);
-#endif // _di_fl_fss_increment_buffer_
-
-/**
- * Identify whether or not a character in the buffer is a graph (ASCII or UTF-8) character.
- *
- * @param buffer
- * The string to process.
- * @param range
- * The character at the start position will be checked against the graph.
- * @param header
- * The header data to populate with results of this function.
- *
- * @return
- * F_true if the character in the buffer is a graph character.
- * F_false if the character in the buffer is not a graph character.
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * Errors from (with error bit): f_utf_is_graph().
- */
-#ifndef _di_fl_fss_is_graph_
- extern f_return_status fl_fss_is_graph(const f_string_static buffer, const f_string_range range);
-#endif // _di_fl_fss_is_graph_
-
-/**
- * Identify whether or not a character in the buffer is a space (ASCII or UTF-8) character.
- *
- * @param buffer
- * The string to process.
- * @param range
- * The character at the start position will be checked against the graph.
- * @param header
- * The header data to populate with results of this function.
- *
- * @return
- * F_true if the character in the buffer is a space character.
- * F_false if the character in the buffer is not a space character.
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * Errors from (with error bit): f_utf_is_space().
- */
-#ifndef _di_fl_fss_is_space_
- extern f_return_status fl_fss_is_space(const f_string_static buffer, const f_string_range range);
-#endif // _di_fl_fss_is_space_
-
-/**
- * Shift all of the delimiters to the end of the used buffer.
- *
- * This allows one to do a printf on the dynamic string without the delimiters arbitrarily stopping the output.
- * No reallocations are performed, this will only shift characters.
- *
- * @param buffer
- * The string to process.
- * This gets updated.
- * @param range
- * A restriction on where within the buffer the shifting happens.
- *
- * @return
- * F_none on success.
- * F_utf (with error bit) if UTF-8 cannot be fully processed (buffer or range range not long enough).
- * F_parameter (with error bit) if a parameter is invalid.
- */
-#ifndef _di_fl_fss_shift_delimiters_
- extern f_return_status fl_fss_shift_delimiters(f_string_dynamic *buffer, const f_string_range range);
-#endif // _di_fl_fss_shift_delimiters_
-
-/**
- * Skip past all whitespace and control characters, except newline.
- *
- * Zero-width characters are not skipped because they might be part of a graph character, such as combining characters.
- * @todo needs consideration on how to handle zero-width before space/control vs zero-width before graph.
- *
- * @param buffer
- * The string to process.
- * @param range
- * The start and stop positions in the buffer being processed.
- * This increments range->start.
- *
- * @return
- * F_none on success.
- * F_none_eol on success and EOL was reached.
- * F_none_eos on success and EOS was reached.
- * F_none_stop on success and stop point was reached.
- * F_incomplete_utf (with error bit) if an incomplete UTF-8 fragment was found.
- * F_incomplete_utf_eos (with error bit) if unable to get entire UTF-8 sequence due to EOS.
- * F_incomplete_utf_stop (with error bit) if unable to get entire UTF-8 sequence due to stop point reached.
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * Errors from (with error bit): f_utf_is_control().
- * Errors from (with error bit): f_utf_is_whitespace().
- * Errors from (with error bit): f_utf_is_zero_width().
- */
-#ifndef _di_fl_fss_skip_past_space_
- extern f_return_status fl_fss_skip_past_space(const f_string_static buffer, f_string_range *range);
-#endif // _di_fl_fss_skip_past_space_
-
-/**
- * Skip past all non-graph and non-zero-width characters (whitespace and control characters).
- *
- * Zero-width characters are not skipped because they might be part of a graph character, such as combining characters.
- * @todo needs consideration on how to handle zero-width before space/control vs zero-width before graph.
- *
- * @param buffer
- * The string to process.
- * @param range
- * The start and stop positions in the buffer being processed.
- * This increments range->start.
- *
- * @return
- * F_none on success.
- * F_none_eol on success and EOL was reached.
- * F_none_eos on success and EOS was reached.
- * F_none_stop on success and stop point was reached.
- * F_incomplete_utf (with error bit) if an incomplete UTF-8 fragment was found.
- * F_incomplete_utf_eos (with error bit) if unable to get entire UTF-8 sequence due to EOS.
- * F_incomplete_utf_stop (with error bit) if unable to get entire UTF-8 sequence due to stop point reached.
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * Errors from (with error bit): f_utf_is_graph().
- * Errors from (with error bit): f_utf_is_zero_width().
- */
-#ifndef _di_fl_fss_skip_past_non_graph_
- extern f_return_status fl_fss_skip_past_non_graph(const f_string_static buffer, f_string_range *range);
-#endif // _di_fl_fss_skip_past_non_graph_
-
#ifdef __cplusplus
} // extern "C"
#endif
// delimits must only be applied once a valid object is found
f_string_lengths delimits = f_string_lengths_initialize;
- status = fl_fss_skip_past_space(*buffer, location);
+ status = f_fss_skip_past_space(*buffer, location);
if (F_status_is_error(status)) return status;
fl_macro_fss_object_return_on_overflow((*buffer), (*location), (*found), delimits, F_data_not_eos, F_data_not_stop)
// return found nothing if this line only contains whitespace and delimit placeholders
if (buffer->string[location->start] == f_fss_basic_close) {
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
return FL_fss_found_object_not;
if (buffer->string[location->start] == f_fss_comment) {
fl_macro_fss_object_seek_till_newline((*buffer), (*location), delimits, F_data_not_eos, F_data_not_stop)
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
return FL_fss_found_object_not;
if (buffer->string[location->start] == f_fss_delimit_slash) {
f_string_length last_slash = location->start;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
while (location->start <= location->stop && location->start < buffer->used) {
if (buffer->string[location->start] == f_fss_delimit_placeholder) {
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
continue;
}
else {
- status = fl_fss_is_graph(*buffer, *location);
+ status = f_fss_is_graph(*buffer, *location);
if (status == F_false) {
found->stop = location->start - 1;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
return FL_fss_found_object;
last_slash = location->start;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
delimits.array[delimits.used] = last_slash;
delimits.used++;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
}
}
else if (buffer->string[location->start] == f_fss_delimit_single_quote || buffer->string[location->start] == f_fss_delimit_double_quote) {
quoted = buffer->string[location->start];
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
found->start = location->start;
// identify where the object ends
if (quoted == 0) {
status = F_none;
- while (buffer->string[location->start] == f_fss_delimit_placeholder || (status = fl_fss_is_space(*buffer, *location)) == F_false) {
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ while (buffer->string[location->start] == f_fss_delimit_placeholder || (status = f_fss_is_space(*buffer, *location)) == F_false) {
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
fl_macro_fss_object_delimited_return_on_overflow((*buffer), (*location), (*found), delimits, F_none_eos, F_none_stop)
if (F_status_is_error(status)) return status;
- status = fl_fss_is_space(*buffer, *location);
+ status = f_fss_is_space(*buffer, *location);
if (status == F_true) {
found->stop = location->start - 1;
return FL_fss_found_object_content_not;
}
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
return FL_fss_found_object;
f_string_length first_slash = location->start;
f_string_length slash_count = 1;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
while (location->start <= location->stop && location->start < buffer->used) {
if (buffer->string[location->start] == f_fss_delimit_placeholder) {
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
continue;
slash_count++;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
slash_count--;
}
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
fl_macro_fss_skip_past_delimit_placeholders((*buffer), (*location))
fl_macro_fss_object_delimited_return_on_overflow((*buffer), (*location), (*found), delimits, F_none_eos, F_none_stop)
- if ((status = fl_fss_is_graph(*buffer, *location)) == F_true) {
+ if ((status = f_fss_is_graph(*buffer, *location)) == F_true) {
while (location->start < buffer->used && location->start <= location->stop && buffer->string[location->start] != f_string_eol[0]) {
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
f_macro_string_lengths_delete_simple(delimits);
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
return FL_fss_found_object_not;
found->stop = length - 1;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
return FL_fss_found_object;
slash_count--;
}
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
else if (buffer->string[location->start] == quoted) {
found->stop = location->start - 1;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
while (location->start <= location->stop && location->start < buffer->used) {
location->start++;
return FL_fss_found_object_content_not;
}
- else if ((status = fl_fss_is_space(*buffer, *location)) == F_true) {
+ else if ((status = f_fss_is_space(*buffer, *location)) == F_true) {
fl_macro_fss_apply_delimit_placeholders((*buffer), delimits);
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
return FL_fss_found_object;
else if (buffer->string[location->start] != f_fss_delimit_placeholder) {
while (location->start < buffer->used && location->start <= location->stop && buffer->string[location->start] != f_string_eol[0]) {
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
f_macro_string_lengths_delete_simple(delimits);
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
return FL_fss_found_object_not;
}
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
return FL_fss_found_object_not;
}
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
// seek to the end of the line when no valid object is found
while (location->start < buffer->used && location->start <= location->stop && buffer->string[location->start] != f_string_eol[0]) {
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
f_macro_string_lengths_delete_simple(delimits);
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
return FL_fss_found_object_not;
// delimits must only be applied once a valid object is found
f_string_lengths delimits = f_string_lengths_initialize;
- fl_fss_skip_past_space(*buffer, location);
+ f_fss_skip_past_space(*buffer, location);
if (F_status_is_error(status)) return status;
fl_macro_fss_content_return_on_overflow((*buffer), (*location), (*found), delimits, F_none_eos, F_none_stop)
found->array[found->used].stop = location->start - 1;
found->used++;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
return FL_fss_found_content;
if (object.string[location->start] == f_fss_delimit_slash) {
while (location->start <= location->stop && location->start < object.used) {
if (object.string[location->start] == f_fss_delimit_placeholder) {
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
continue;
buffer->string[buffer_position.stop] = object.string[location->start];
buffer_position.stop++;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
buffer->string[buffer_position.stop + 1] = object.string[location->start];
buffer_position.stop += 2;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
}
}
buffer->string[buffer_position.stop + 1] = object.string[location->start];
buffer_position.stop += 2;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
}
else if (object.string[location->start] == f_fss_comment) {
while (location->start <= location->stop && location->start < object.used) {
if (object.string[location->start] == f_fss_delimit_placeholder) {
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
continue;
return F_none_eol;
}
- else if ((status = fl_fss_is_space(*buffer, *location)) == F_true || quoted) {
+ else if ((status = f_fss_is_space(*buffer, *location)) == F_true || quoted) {
pre_allocate_size++;
if (pre_allocate_size > buffer->size) {
while (location->start <= location->stop && location->start < object.used) {
if (object.string[location->start] == f_fss_delimit_placeholder) {
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
continue;
buffer_position.stop++;
slash_count++;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
fl_macro_fss_skip_past_delimit_placeholders(object, (*location));
buffer->string[buffer_position.stop] = object.string[location->start];
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
buffer_position.stop++;
buffer->string[buffer_position.stop] = object.string[location->start];
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
buffer_position.stop++;
buffer_position.stop++;
}
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
* F_parameter (with error bit) if a parameter is invalid.
* F_utf (with error bit) is returned on failure to read/process a UTF-8 character.
*
- * Errors from (with error bit): fl_fss_increment_buffer().
- * Errors from (with error bit): fl_fss_is_graph().
- * Errors from (with error bit): fl_fss_is_space().
- * Errors from (with error bit): fl_fss_skip_past_space().
+ * Errors from (with error bit): f_fss_increment_buffer().
+ * Errors from (with error bit): f_fss_is_graph().
+ * Errors from (with error bit): f_fss_is_space().
+ * Errors from (with error bit): f_fss_skip_past_space().
*/
#ifndef _di_fl_fss_basic_object_read_
extern f_return_status fl_fss_basic_object_read(f_string_dynamic *buffer, f_string_range *location, f_fss_object *found);
* F_parameter (with error bit) if a parameter is invalid.
* F_utf (with error bit) is returned on failure to read/process a UTF-8 character.
*
- * Errors from (with error bit): fl_fss_increment_buffer().
- * Errors from (with error bit): fl_fss_is_graph().
- * Errors from (with error bit): fl_fss_is_space().
- * Errors from (with error bit): fl_fss_skip_past_space().
+ * Errors from (with error bit): f_fss_increment_buffer().
+ * Errors from (with error bit): f_fss_is_graph().
+ * Errors from (with error bit): f_fss_is_space().
+ * Errors from (with error bit): f_fss_skip_past_space().
*/
#ifndef _di_fl_fss_basic_content_read_
extern f_return_status fl_fss_basic_content_read(f_string_dynamic *buffer, f_string_range *location, f_fss_content *found);
* F_parameter (with error bit) if a parameter is invalid.
* F_utf (with error bit) is returned on failure to read/process a UTF-8 character.
*
- * Errors from (with error bit): fl_fss_increment_buffer().
+ * Errors from (with error bit): f_fss_increment_buffer().
*/
#ifndef _di_fl_fss_basic_object_write_
extern f_return_status fl_fss_basic_object_write(f_string_dynamic *buffer, const f_string_static object, f_string_range *location);
* F_parameter (with error bit) if a parameter is invalid.
* F_utf (with error bit) is returned on failure to read/process a UTF-8 character.
*
- * Errors from (with error bit): fl_fss_increment_buffer().
+ * Errors from (with error bit): f_fss_increment_buffer().
*/
#ifndef _di_fl_fss_basic_content_write_
extern f_return_status fl_fss_basic_content_write(f_string_dynamic *buffer, const f_string_static content, f_string_range *location);
// delimits must only be applied once a valid object is found.
f_string_lengths delimits = f_string_lengths_initialize;
- fl_fss_skip_past_space(*buffer, location);
+ f_fss_skip_past_space(*buffer, location);
fl_macro_fss_object_return_on_overflow((*buffer), (*location), (*found), delimits, F_data_not_eos, F_data_not_stop)
// return found nothing if this line only contains whitespace and delimit placeholders.
if (buffer->string[location->start] == f_fss_comment) {
fl_macro_fss_object_seek_till_newline((*buffer), (*location), delimits, F_data_not_eos, F_data_not_stop)
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
return FL_fss_found_object_not;
f_string_length first_slash = location->start;
f_string_length slash_count = 1;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
while (location->start < buffer->used && location->start <= location->stop && (buffer->string[location->start] == f_fss_delimit_placeholder || buffer->string[location->start] == f_fss_delimit_slash)) {
slash_count++;
}
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
if (buffer->string[location->start] == f_fss_basic_list_open) {
f_string_length stop_point = location->start - 1;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
while (location->start < buffer->used && location->start <= location->stop) {
- if (buffer->string[location->start] == f_string_eol[0] || (status = fl_fss_is_graph(*buffer, *location)) == F_true) {
+ if (buffer->string[location->start] == f_string_eol[0] || (status = f_fss_is_graph(*buffer, *location)) == F_true) {
break;
}
if (F_status_is_error(status)) return status;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
slash_count--;
}
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
else if (buffer->string[location->start] == f_fss_basic_list_open) {
f_string_length stop_point = location->start - 1;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
while (location->start < buffer->used && location->start <= location->stop) {
- if (buffer->string[location->start] == f_string_eol[0] || (status = fl_fss_is_graph(*buffer, *location)) == F_true) {
+ if (buffer->string[location->start] == f_string_eol[0] || (status = f_fss_is_graph(*buffer, *location)) == F_true) {
break;
}
if (F_status_is_error(status)) return status;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
found->stop = stop_point;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
return FL_fss_found_object;
continue;
}
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
// seek to the end of the line when no valid object is found.
while (location->start < buffer->used && location->start <= location->stop && buffer->string[location->start] != f_string_eol[0]) {
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
fl_macro_fss_object_return_on_overflow((*buffer), (*location), (*found), delimits, F_data_not_eos, F_data_not_stop)
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
return FL_fss_found_object_not;
found_newline = F_true;
last_newline = location->start;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
fl_macro_fss_content_delimited_return_on_overflow((*buffer), (*location), (*found), delimits, F_none_eos, F_none_stop)
f_string_length first_slash = location->start;
f_string_length slash_count = 1;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
while (location->start < buffer->used && location->start <= location->stop && (buffer->string[location->start] == f_fss_delimit_placeholder || buffer->string[location->start] == f_fss_delimit_slash)) {
slash_count++;
}
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
if (buffer->string[location->start] == f_fss_basic_list_open) {
f_string_length stop_point = location->start - 1;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
while (location->start < buffer->used && location->start <= location->stop) {
- if (buffer->string[location->start] == f_string_eol[0] || (status = fl_fss_is_graph(*buffer, *location)) == F_true) {
+ if (buffer->string[location->start] == f_string_eol[0] || (status = f_fss_is_graph(*buffer, *location)) == F_true) {
break;
}
if (F_status_is_error(status)) return status;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
slash_count--;
}
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
continue;
}
else if (buffer->string[location->start] == f_fss_basic_list_open) {
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
while (location->start < buffer->used && location->start <= location->stop) {
- if (buffer->string[location->start] == f_string_eol[0] || (status = fl_fss_is_graph(*buffer, *location)) == F_true) {
+ if (buffer->string[location->start] == f_string_eol[0] || (status = f_fss_is_graph(*buffer, *location)) == F_true) {
break;
}
if (F_status_is_error(status)) return status;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
continue;
}
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
// comments are not allowed and this format has no way of "wrapping" a comment.
return F_status_set_error(FL_fss_found_comment);
}
- else if ((status = fl_fss_is_graph(object, *location)) == F_true) {
+ else if ((status = f_fss_is_graph(object, *location)) == F_true) {
break;
}
else if (F_status_is_error(status)) {
buffer_position.stop++;
}
- status = fl_fss_increment_buffer(object, location, 1);
+ status = f_fss_increment_buffer(object, location, 1);
if (F_status_is_error(status)) return status;
} // while
buffer->string[buffer_position.stop] = object.string[location->start];
buffer_position.stop++;
- status = fl_fss_increment_buffer(object, location, 1);
+ status = f_fss_increment_buffer(object, location, 1);
if (F_status_is_error(status)) return status;
while (location->start <= location->stop && location->start < object.used) {
if (object.string[location->start] == f_fss_delimit_placeholder) {
- status = fl_fss_increment_buffer(object, location, 1);
+ status = f_fss_increment_buffer(object, location, 1);
if (F_status_is_error(status)) return status;
continue;
buffer->string[buffer_position.stop] = object.string[location->start];
buffer_position.stop++;
- status = fl_fss_increment_buffer(object, location, 1);
+ status = f_fss_increment_buffer(object, location, 1);
if (F_status_is_error(status)) return status;
slash_count++;
buffer_position.stop++;
}
- status = fl_fss_increment_buffer(object, location, 1);
+ status = f_fss_increment_buffer(object, location, 1);
if (F_status_is_error(status)) return status;
} // while
buffer_position.stop++;
has_graph = F_true;
- status = fl_fss_increment_buffer(content, location, 1);
+ status = f_fss_increment_buffer(content, location, 1);
if (F_status_is_error(status)) return status;
while (location->start <= location->stop && location->start < content.used) {
if (content.string[location->start] == f_fss_delimit_placeholder) {
- status = fl_fss_increment_buffer(content, location, 1);
+ status = f_fss_increment_buffer(content, location, 1);
if (F_status_is_error(status)) return status;
continue;
buffer->string[buffer_position.stop] = content.string[location->start];
buffer_position.stop++;
- status = fl_fss_increment_buffer(content, location, 1);
+ status = f_fss_increment_buffer(content, location, 1);
if (F_status_is_error(status)) return status;
slash_count++;
if (content.string[location->start] == f_fss_basic_list_open) {
f_string_length start = location->start;
- status = fl_fss_increment_buffer(content, location, 1);
+ status = f_fss_increment_buffer(content, location, 1);
if (F_status_is_error(status)) return status;
while (location->start < content.used && location->start <= location->stop) {
- if (content.string[location->start] == f_string_eol[0] || (status = fl_fss_is_graph(content, *location)) == F_true) {
+ if (content.string[location->start] == f_string_eol[0] || (status = f_fss_is_graph(content, *location)) == F_true) {
break;
}
if (F_status_is_error(status)) return status;
- status = fl_fss_increment_buffer(content, location, 1);
+ status = f_fss_increment_buffer(content, location, 1);
if (F_status_is_error(status)) return status;
} // while
has_graph = F_true;
- status = fl_fss_increment_buffer(content, location, 1);
+ status = f_fss_increment_buffer(content, location, 1);
if (F_status_is_error(status)) return status;
while (location->start < content.used && location->start <= location->stop) {
- if (content.string[location->start] == f_string_eol[0] || (status = fl_fss_is_graph(content, *location)) == F_true) {
+ if (content.string[location->start] == f_string_eol[0] || (status = f_fss_is_graph(content, *location)) == F_true) {
break;
}
if (F_status_is_error(status)) return status;
- status = fl_fss_increment_buffer(content, location, 1);
+ status = f_fss_increment_buffer(content, location, 1);
if (F_status_is_error(status)) return status;
} // while
has_graph = F_false;
is_comment = F_false;
}
- else if ((status = fl_fss_is_graph(content, *location)) == F_true) {
+ else if ((status = f_fss_is_graph(content, *location)) == F_true) {
has_graph = F_true;
}
else if (F_status_is_error(status)) {
buffer_position.stop++;
}
- status = fl_fss_increment_buffer(content, location, 1);
+ status = f_fss_increment_buffer(content, location, 1);
if (F_status_is_error(status)) return status;
} // while
* F_parameter (with error bit) if a parameter is invalid.
* F_utf (with error bit) is returned on failure to read/process a UTF-8 character.
*
- * Errors from (with error bit): fl_fss_increment_buffer().
- * Errors from (with error bit): fl_fss_is_graph().
- * Errors from (with error bit): fl_fss_is_space().
- * Errors from (with error bit): fl_fss_skip_past_space().
+ * Errors from (with error bit): f_fss_increment_buffer().
+ * Errors from (with error bit): f_fss_is_graph().
+ * Errors from (with error bit): f_fss_is_space().
+ * Errors from (with error bit): f_fss_skip_past_space().
*/
#ifndef _di_fl_fss_basic_list_object_read_
extern f_return_status fl_fss_basic_list_object_read(f_string_dynamic *buffer, f_string_range *location, f_fss_object *found);
* F_parameter (with error bit) if a parameter is invalid.
* F_utf (with error bit) is returned on failure to read/process a UTF-8 character.
*
- * Errors from (with error bit): fl_fss_increment_buffer().
- * Errors from (with error bit): fl_fss_is_graph().
- * Errors from (with error bit): fl_fss_is_space().
- * Errors from (with error bit): fl_fss_skip_past_space().
+ * Errors from (with error bit): f_fss_increment_buffer().
+ * Errors from (with error bit): f_fss_is_graph().
+ * Errors from (with error bit): f_fss_is_space().
+ * Errors from (with error bit): f_fss_skip_past_space().
*/
#ifndef _di_fl_fss_basic_list_content_read_
extern f_return_status fl_fss_basic_list_content_read(f_string_dynamic *buffer, f_string_range *location, f_fss_content *found);
* F_parameter (with error bit) if a parameter is invalid.
* F_utf (with error bit) is returned on failure to read/process a UTF-8 character.
*
- * Errors from (with error bit): fl_fss_increment_buffer().
+ * Errors from (with error bit): f_fss_increment_buffer().
*/
#ifndef _di_fl_fss_basic_list_object_write_
extern f_return_status fl_fss_basic_list_object_write(const f_string_static object, f_string_range *location, f_string_dynamic *buffer);
* F_parameter (with error bit) if a parameter is invalid.
* F_utf (with error bit) is returned on failure to read/process a UTF-8 character.
*
- * Errors from (with error bit): fl_fss_increment_buffer().
+ * Errors from (with error bit): f_fss_increment_buffer().
*/
#ifndef _di_fl_fss_basic_list_content_write_
extern f_return_status fl_fss_basic_list_content_write(const f_string_static content, f_string_range *location, f_string_dynamic *buffer);
// delimits must only be applied once a valid object is found
f_string_lengths delimits = f_string_lengths_initialize;
- fl_fss_skip_past_space(*buffer, location);
+ f_fss_skip_past_space(*buffer, location);
fl_macro_fss_object_return_on_overflow((*buffer), (*location), (*found), delimits, F_data_not_eos, F_data_not_stop)
// return found nothing if this line only contains whitespace and delimit placeholders
if (buffer->string[location->start] == f_fss_extended_close) {
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
return FL_fss_found_object_not;
if (buffer->string[location->start] == f_fss_comment) {
fl_macro_fss_object_seek_till_newline((*buffer), (*location), delimits, F_data_not_eos, F_data_not_stop)
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
return FL_fss_found_object_not;
if (buffer->string[location->start] == f_fss_delimit_slash) {
f_string_length last_slash = location->start;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
while (location->start <= location->stop && location->start < buffer->used) {
if (buffer->string[location->start] == f_fss_delimit_placeholder) {
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
continue;
}
- else if ((status = fl_fss_is_space(*buffer, *location)) == F_true) {
+ else if ((status = f_fss_is_space(*buffer, *location)) == F_true) {
found->stop = location->start - 1;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
return FL_fss_found_object;
last_slash = location->start;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
delimits.array[delimits.used] = last_slash;
delimits.used++;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
}
}
else if (buffer->string[location->start] == f_fss_delimit_single_quote || buffer->string[location->start] == f_fss_delimit_double_quote) {
quoted = buffer->string[location->start];
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
found->start = location->start;
// identify where the object ends
if (quoted == 0) {
status = F_none;
- while (buffer->string[location->start] == f_fss_delimit_placeholder || (status = fl_fss_is_graph(*buffer, *location)) == F_true) {
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ while (buffer->string[location->start] == f_fss_delimit_placeholder || (status = f_fss_is_graph(*buffer, *location)) == F_true) {
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
fl_macro_fss_object_delimited_return_on_overflow((*buffer), (*location), (*found), delimits, F_none_eos, F_none_stop)
if (F_status_is_error(status)) return status;
- if ((status = fl_fss_is_space(*buffer, *location)) == F_true) {
+ if ((status = f_fss_is_space(*buffer, *location)) == F_true) {
found->stop = location->start - 1;
fl_macro_fss_apply_delimit_placeholders((*buffer), delimits);
return FL_fss_found_object_content_not;
}
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
return FL_fss_found_object;
f_string_length first_slash = location->start;
f_string_length slash_count = 1;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
while (location->start <= location->stop && location->start < buffer->used) {
if (buffer->string[location->start] == f_fss_delimit_placeholder) {
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
continue;
slash_count++;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
slash_count--;
}
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
fl_macro_fss_skip_past_delimit_placeholders((*buffer), (*location))
fl_macro_fss_object_return_on_overflow((*buffer), (*location), (*found), delimits, F_status_is_warning(F_unterminated_group_eos), F_status_is_warning(F_unterminated_group_stop))
- if ((status = fl_fss_is_graph(*buffer, *location)) == F_true) {
+ if ((status = f_fss_is_graph(*buffer, *location)) == F_true) {
while (location->start < buffer->used && location->start <= location->stop && buffer->string[location->start] != f_string_eol[0]) {
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
fl_macro_fss_object_return_on_overflow((*buffer), (*location), (*found), delimits, F_data_not_eos, F_data_not_stop)
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
return FL_fss_found_object_not;
found->stop = length - 1;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
return FL_fss_found_object;
slash_count--;
}
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
else if (buffer->string[location->start] == quoted) {
found->stop = location->start - 1;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
while (location->start <= location->stop && location->start < buffer->used) {
location->start++;
return FL_fss_found_object_content_not;
}
- else if ((status = fl_fss_is_space(*buffer, *location)) == F_true) {
+ else if ((status = f_fss_is_space(*buffer, *location)) == F_true) {
fl_macro_fss_apply_delimit_placeholders((*buffer), delimits);
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
return FL_fss_found_object;
}
else if (buffer->string[location->start] != f_fss_delimit_placeholder) {
while (location->start < buffer->used && location->start <= location->stop && buffer->string[location->start] != f_string_eol[0]) {
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
fl_macro_fss_object_return_on_overflow((*buffer), (*location), (*found), delimits, F_data_not_eos, F_data_not_stop)
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
return FL_fss_found_object_not;
}
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
return FL_fss_found_object_not;
}
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
// seek to the end of the line when no valid object is found
while (location->start < buffer->used && location->start <= location->stop && buffer->string[location->start] != f_string_eol[0]) {
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
fl_macro_fss_object_return_on_overflow((*buffer), (*location), (*found), delimits, F_data_not_eos, F_data_not_stop)
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
return FL_fss_found_object_not;
// delimits must only be applied once a valid object is found
f_string_lengths delimits = f_string_lengths_initialize;
- fl_fss_skip_past_space(*buffer, location);
+ f_fss_skip_past_space(*buffer, location);
fl_macro_fss_content_return_on_overflow((*buffer), (*location), (*found), delimits, F_none_eos, F_none_stop)
// return found nothing if this line only contains whitespace and delimit placeholders
if (buffer->string[location->start] == f_fss_extended_close) {
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
return FL_fss_found_content_not;
if (buffer->string[location->start] == f_fss_delimit_slash) {
f_string_length last_slash = location->start;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
while (location->start <= location->stop && location->start < buffer->used) {
if (buffer->string[location->start] == f_fss_delimit_placeholder) {
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
continue;
}
- else if ((status = fl_fss_is_space(*buffer, *location)) == F_true) {
+ else if ((status = f_fss_is_space(*buffer, *location)) == F_true) {
found->array[found->used].stop = location->start - 1;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
found->used++;
last_slash = location->start;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
delimits.array[delimits.used] = last_slash;
delimits.used++;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
}
}
else if (buffer->string[location->start] == f_fss_delimit_single_quote || buffer->string[location->start] == f_fss_delimit_double_quote) {
quoted = buffer->string[location->start];
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
found->array[found->used].start = location->start;
// identify where the content ends
if (quoted == 0) {
status = F_none;
- while (buffer->string[location->start] == f_fss_delimit_placeholder || (status = fl_fss_is_graph(*buffer, *location)) == F_true) {
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ while (buffer->string[location->start] == f_fss_delimit_placeholder || (status = f_fss_is_graph(*buffer, *location)) == F_true) {
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
fl_macro_fss_content_delimited_return_on_overflow((*buffer), (*location), (*found), delimits, F_none_eos, F_none_stop)
if (F_status_is_error(status)) return status;
- if ((status = fl_fss_is_space(*buffer, *location)) == F_true) {
+ if ((status = f_fss_is_space(*buffer, *location)) == F_true) {
found->array[found->used].stop = location->start - 1;
found->used++;
return FL_fss_found_content;
}
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
continue;
f_string_length first_slash = location->start;
f_string_length slash_count = 1;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
while (location->start <= location->stop && location->start < buffer->used) {
if (buffer->string[location->start] == f_fss_delimit_placeholder) {
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
continue;
slash_count++;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
slash_count--;
}
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
fl_macro_fss_skip_past_delimit_placeholders((*buffer), (*location))
fl_macro_fss_content_delimited_return_on_overflow((*buffer), (*location), (*found), delimits, F_none_eos, F_none_stop)
- if ((status = fl_fss_is_graph(*buffer, *location)) == F_true) {
+ if ((status = f_fss_is_graph(*buffer, *location)) == F_true) {
while (location->start < buffer->used && location->start <= location->stop && buffer->string[location->start] != f_string_eol[0]) {
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
fl_macro_fss_content_return_on_overflow((*buffer), (*location), (*found), delimits, F_status_is_warning(F_unterminated_group_eos), F_status_is_warning(F_unterminated_group_stop))
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
return F_status_is_warning(F_unterminated_group);
found->array[found->used].stop = length - 1;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
found->used++;
slash_count--;
}
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
}
else if (buffer->string[location->start] == quoted) {
found->array[found->used].stop = location->start - 1;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
while (location->start <= location->stop && location->start < buffer->used) {
found->used++;
return FL_fss_found_content;
}
- else if ((status = fl_fss_is_space(*buffer, *location)) == F_true) {
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ else if ((status = f_fss_is_space(*buffer, *location)) == F_true) {
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
found->used++;
}
else if (buffer->string[location->start] != f_fss_delimit_placeholder) {
while (location->start < buffer->used && location->start <= location->stop && buffer->string[location->start] != f_string_eol[0]) {
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
fl_macro_fss_content_return_on_overflow((*buffer), (*location), (*found), delimits, F_status_is_warning(F_unterminated_group_eos), F_status_is_warning(F_unterminated_group_stop))
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
return F_status_is_warning(F_unterminated_group);
}
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
found->array[found->used].stop = location->start - 1;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
found->used++;
}
}
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
// seek to the end of the line when no valid content is found
while (location->start < buffer->used && location->start <= location->stop && buffer->string[location->start] != f_string_eol[0]) {
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
fl_macro_fss_content_delimited_return_on_overflow((*buffer), (*location), (*found), delimits, F_none_eos, F_none_stop)
if (found->used == already_used) {
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
return FL_fss_found_content_not;
fl_macro_fss_apply_delimit_placeholders((*buffer), delimits);
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
return FL_fss_found_content;
if (object.string[location->start] == f_fss_delimit_slash) {
while (location->start <= location->stop && location->start < object.used) {
if (object.string[location->start] == f_fss_delimit_placeholder) {
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
continue;
buffer->string[buffer_position.stop] = object.string[location->start];
buffer_position.stop++;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
buffer->string[buffer_position.stop + 1] = object.string[location->start];
buffer_position.stop += 2;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
}
}
buffer->string[buffer_position.stop + 1] = object.string[location->start];
buffer_position.stop += 2;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
}
else if (object.string[location->start] == f_fss_comment) {
while (location->start <= location->stop && location->start < object.used) {
if (object.string[location->start] == f_fss_delimit_placeholder) {
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
continue;
return F_none_eol;
}
- else if ((status = fl_fss_is_space(*buffer, *location)) == F_true || quoted) {
+ else if ((status = f_fss_is_space(*buffer, *location)) == F_true || quoted) {
f_string_length first_space = location->start;
if (!quoted) {
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
while (location->start <= location->stop && location->start < object.used && isspace(object.string[location->start])) {
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
while (location->start <= location->stop && location->start < object.used) {
if (object.string[location->start] == f_fss_delimit_placeholder) {
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
continue;
buffer_position.stop++;
slash_count++;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
fl_macro_fss_skip_past_delimit_placeholders(object, (*location));
buffer->string[buffer_position.stop] = object.string[location->start];
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
buffer_position.stop++;
buffer->string[buffer_position.stop] = object.string[location->start];
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
buffer_position.stop++;
buffer->string[buffer_position.stop] = f_fss_delimit_slash;
buffer_position.stop++;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
while (location->start <= location->stop && location->start < content.used) {
if (content.string[location->start] == f_fss_delimit_placeholder) {
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
continue;
buffer->string[buffer_position.stop] = f_fss_delimit_slash;
buffer_position.stop++;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
buffer->string[buffer_position.stop + 1] = content.string[location->start];
buffer_position.stop += 2;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
}
}
buffer->string[buffer_position.stop + 1] = content.string[location->start];
buffer_position.stop += 2;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
}
return F_none_eol;
}
- if (content.string[location->start] != f_fss_delimit_placeholder && (status = fl_fss_is_space(*buffer, *location)) == F_true) {
+ if (content.string[location->start] != f_fss_delimit_placeholder && (status = f_fss_is_space(*buffer, *location)) == F_true) {
quoted = f_fss_delimit_double_quote;
pre_allocate_size += 2;
buffer->string[buffer_position.stop] = content.string[location->start];
buffer_position.stop++;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
buffer->string[buffer_position.stop] = f_fss_delimit_slash;
buffer_position.stop++;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
while (location->start <= location->stop && location->start < content.used) {
if (content.string[location->start] == f_fss_delimit_placeholder) {
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
continue;
buffer_position.stop++;
slash_count++;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
buffer_position.stop++;
}
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
* F_parameter (with error bit) if a parameter is invalid.
* F_utf (with error bit) is returned on failure to read/process a UTF-8 character.
*
- * Errors from (with error bit): fl_fss_increment_buffer().
- * Errors from (with error bit): fl_fss_is_graph().
- * Errors from (with error bit): fl_fss_is_space().
- * Errors from (with error bit): fl_fss_skip_past_space().
+ * Errors from (with error bit): f_fss_increment_buffer().
+ * Errors from (with error bit): f_fss_is_graph().
+ * Errors from (with error bit): f_fss_is_space().
+ * Errors from (with error bit): f_fss_skip_past_space().
*/
#ifndef _di_fl_fss_extended_object_read_
extern f_return_status fl_fss_extended_object_read(f_string_dynamic *buffer, f_string_range *location, f_fss_object *found);
* F_parameter (with error bit) if a parameter is invalid.
* F_utf (with error bit) is returned on failure to read/process a UTF-8 character.
*
- * Errors from (with error bit): fl_fss_increment_buffer().
- * Errors from (with error bit): fl_fss_is_graph().
- * Errors from (with error bit): fl_fss_is_space().
- * Errors from (with error bit): fl_fss_skip_past_space().
+ * Errors from (with error bit): f_fss_increment_buffer().
+ * Errors from (with error bit): f_fss_is_graph().
+ * Errors from (with error bit): f_fss_is_space().
+ * Errors from (with error bit): f_fss_skip_past_space().
*/
#ifndef _di_fl_fss_extended_content_read_
extern f_return_status fl_fss_extended_content_read(f_string_dynamic *buffer, f_string_range *location, f_fss_content *found);
* F_parameter (with error bit) if a parameter is invalid.
* F_utf (with error bit) is returned on failure to read/process a UTF-8 character.
*
- * Errors from (with error bit): fl_fss_increment_buffer().
+ * Errors from (with error bit): f_fss_increment_buffer().
*/
#ifndef _di_fl_fss_extended_object_write_
extern f_return_status fl_fss_extended_object_write(const f_string_static object, f_string_range *location, f_string_dynamic *buffer);
* F_parameter (with error bit) if a parameter is invalid.
* F_utf (with error bit) is returned on failure to read/process a UTF-8 character.
*
- * Errors from (with error bit): fl_fss_increment_buffer().
+ * Errors from (with error bit): f_fss_increment_buffer().
*/
#ifndef _di_fl_fss_extended_content_write_
extern f_return_status fl_fss_extended_content_write(const f_string_static content, f_string_range *location, f_string_dynamic *buffer);
// delimits must only be applied once a valid object is found.
f_string_lengths delimits = f_string_lengths_initialize;
- fl_fss_skip_past_space(*buffer, location);
+ f_fss_skip_past_space(*buffer, location);
fl_macro_fss_object_return_on_overflow((*buffer), (*location), (*found), delimits, F_data_not_eos, F_data_not_stop)
// return found nothing if this line only contains whitespace and delimit placeholders.
if (buffer->string[location->start] == f_string_eol[0]) {
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
return FL_fss_found_object_not;
if (buffer->string[location->start] == f_fss_comment) {
fl_macro_fss_object_seek_till_newline((*buffer), (*location), delimits, F_data_not_eos, F_data_not_stop)
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
return FL_fss_found_object_not;
f_string_length first_slash = location->start;
f_string_length slash_count = 1;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
while (location->start < buffer->used && location->start <= location->stop && (buffer->string[location->start] == f_fss_delimit_placeholder || buffer->string[location->start] == f_fss_delimit_slash)) {
slash_count++;
}
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
if (buffer->string[location->start] == f_fss_extended_list_open) {
f_string_length stop_point = location->start - 1;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
while (location->start < buffer->used && location->start <= location->stop) {
- if (buffer->string[location->start] == f_string_eol[0] || (status = fl_fss_is_graph(*buffer, *location)) == F_true) {
+ if (buffer->string[location->start] == f_string_eol[0] || (status = f_fss_is_graph(*buffer, *location)) == F_true) {
break;
}
if (F_status_is_error(status)) return status;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
slash_count--;
}
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
else if (buffer->string[location->start] == f_fss_extended_list_open) {
f_string_length stop_point = location->start - 1;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
while (location->start < buffer->used && location->start <= location->stop) {
- if (buffer->string[location->start] == f_string_eol[0] || (status = fl_fss_is_graph(*buffer, *location)) == F_true) {
+ if (buffer->string[location->start] == f_string_eol[0] || (status = f_fss_is_graph(*buffer, *location)) == F_true) {
break;
}
if (F_status_is_error(status)) return status;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
found->stop = stop_point;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
return FL_fss_found_object;
continue;
}
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
// seek to the end of the line when no valid object is found.
while (location->start < buffer->used && location->start <= location->stop && buffer->string[location->start] != f_string_eol[0]) {
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
} // while
fl_macro_fss_object_return_on_overflow((*buffer), (*location), (*found), delimits, F_data_not_eos, F_data_not_stop)
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) return status;
return FL_fss_found_object_not;
f_string_length slash_count = 1;
position_previous = location->start;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) {
f_macro_string_lengths_delete_simple(delimits);
f_macro_string_lengths_delete_simple(positions_start);
slash_count++;
}
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) {
f_macro_string_lengths_delete_simple(delimits);
f_macro_string_lengths_delete_simple(positions_start);
break;
}
- if (buffer->string[location->start] != f_fss_delimit_placeholder && (status = fl_fss_is_space(*buffer, *location)) == F_false) {
+ if (buffer->string[location->start] != f_fss_delimit_placeholder && (status = f_fss_is_space(*buffer, *location)) == F_false) {
break;
}
}
position_previous = location->start;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) {
f_macro_string_lengths_delete_simple(delimits);
f_macro_string_lengths_delete_simple(positions_start);
f_string_length before_list_open = position_previous;
position_previous = location->start;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) {
f_macro_string_lengths_delete_simple(delimits);
f_macro_string_lengths_delete_simple(positions_start);
break;
}
- if (buffer->string[location->start] != f_fss_delimit_placeholder && (status = fl_fss_is_space(*buffer, *location)) == F_false) {
+ if (buffer->string[location->start] != f_fss_delimit_placeholder && (status = f_fss_is_space(*buffer, *location)) == F_false) {
break;
}
}
position_previous = location->start;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) {
f_macro_string_lengths_delete_simple(delimits);
f_macro_string_lengths_delete_simple(positions_start);
}
position_previous = location->start;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) {
f_macro_string_lengths_delete_simple(delimits);
f_macro_string_lengths_delete_simple(positions_start);
else if (buffer->string[location->start] == f_fss_extended_list_close) {
while (location->start < buffer->used && location->start <= location->stop) {
position_previous = location->start;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) {
f_macro_string_lengths_delete_simple(delimits);
f_macro_string_lengths_delete_simple(positions_start);
break;
}
- if (buffer->string[location->start] != f_fss_delimit_placeholder && (status = fl_fss_is_space(*buffer, *location)) == F_false) {
+ if (buffer->string[location->start] != f_fss_delimit_placeholder && (status = f_fss_is_space(*buffer, *location)) == F_false) {
break;
}
line_start = location->start + 1;
if (depth == 0) {
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) {
f_macro_string_lengths_delete_simple(delimits);
f_macro_string_lengths_delete_simple(positions_start);
}
position_previous = location->start;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) {
f_macro_string_lengths_delete_simple(delimits);
f_macro_string_lengths_delete_simple(positions_start);
}
else if (buffer->string[location->start] != f_string_eol[0]) {
position_previous = location->start;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) {
f_macro_string_lengths_delete_simple(delimits);
f_macro_string_lengths_delete_simple(positions_start);
}
position_previous = location->start;
- status = fl_fss_increment_buffer(*buffer, location, 1);
+ status = f_fss_increment_buffer(*buffer, location, 1);
if (F_status_is_error(status)) {
f_macro_string_lengths_delete_simple(delimits);
f_macro_string_lengths_delete_simple(positions_start);
// comments are not allowed and this format has no way of "wrapping" a comment.
return F_status_set_error(FL_fss_found_comment);
}
- else if ((status = fl_fss_is_graph(object, *location)) == F_true) {
+ else if ((status = f_fss_is_graph(object, *location)) == F_true) {
break;
}
else if (F_status_is_error(status)) {
buffer_position.stop++;
}
- status = fl_fss_increment_buffer(object, location, 1);
+ status = f_fss_increment_buffer(object, location, 1);
if (F_status_is_error(status)) return status;
} // while
buffer->string[buffer_position.stop] = object.string[location->start];
buffer_position.stop++;
- status = fl_fss_increment_buffer(object, location, 1);
+ status = f_fss_increment_buffer(object, location, 1);
if (F_status_is_error(status)) return status;
while (location->start <= location->stop && location->start < object.used) {
if (object.string[location->start] == f_fss_delimit_placeholder) {
- status = fl_fss_increment_buffer(object, location, 1);
+ status = f_fss_increment_buffer(object, location, 1);
if (F_status_is_error(status)) return status;
continue;
buffer->string[buffer_position.stop] = object.string[location->start];
buffer_position.stop++;
- status = fl_fss_increment_buffer(object, location, 1);
+ status = f_fss_increment_buffer(object, location, 1);
if (F_status_is_error(status)) return status;
slash_count++;
buffer_position.stop++;
}
- status = fl_fss_increment_buffer(object, location, 1);
+ status = f_fss_increment_buffer(object, location, 1);
if (F_status_is_error(status)) return status;
} // while
buffer_position.stop++;
has_graph = F_true;
- status = fl_fss_increment_buffer(content, location, 1);
+ status = f_fss_increment_buffer(content, location, 1);
if (F_status_is_error(status)) return status;
while (location->start <= location->stop && location->start < content.used) {
if (content.string[location->start] == f_fss_delimit_placeholder) {
- status = fl_fss_increment_buffer(content, location, 1);
+ status = f_fss_increment_buffer(content, location, 1);
if (F_status_is_error(status)) return status;
continue;
buffer->string[buffer_position.stop] = content.string[location->start];
buffer_position.stop++;
- status = fl_fss_increment_buffer(content, location, 1);
+ status = f_fss_increment_buffer(content, location, 1);
if (F_status_is_error(status)) return status;
slash_count++;
if (content.string[location->start] == f_fss_extended_list_open) {
f_string_length start = location->start;
- status = fl_fss_increment_buffer(content, location, 1);
+ status = f_fss_increment_buffer(content, location, 1);
if (F_status_is_error(status)) return status;
while (location->start < content.used && location->start <= location->stop) {
- if (content.string[location->start] == f_string_eol[0] || (status = fl_fss_is_graph(content, *location)) == F_true) {
+ if (content.string[location->start] == f_string_eol[0] || (status = f_fss_is_graph(content, *location)) == F_true) {
break;
}
if (F_status_is_error(status)) return status;
- status = fl_fss_increment_buffer(content, location, 1);
+ status = f_fss_increment_buffer(content, location, 1);
if (F_status_is_error(status)) return status;
} // while
has_graph = F_true;
- status = fl_fss_increment_buffer(content, location, 1);
+ status = f_fss_increment_buffer(content, location, 1);
if (F_status_is_error(status)) return status;
while (location->start < content.used && location->start <= location->stop) {
- if (content.string[location->start] == f_string_eol[0] || (status = fl_fss_is_graph(content, *location)) == F_true) {
+ if (content.string[location->start] == f_string_eol[0] || (status = f_fss_is_graph(content, *location)) == F_true) {
break;
}
if (F_status_is_error(status)) return status;
- status = fl_fss_increment_buffer(content, location, 1);
+ status = f_fss_increment_buffer(content, location, 1);
if (F_status_is_error(status)) return status;
} // while
has_graph = F_false;
is_comment = F_false;
}
- else if ((status = fl_fss_is_graph(content, *location)) == F_true) {
+ else if ((status = f_fss_is_graph(content, *location)) == F_true) {
has_graph = F_true;
}
else if (F_status_is_error(status)) {
buffer_position.stop++;
}
- status = fl_fss_increment_buffer(content, location, 1);
+ status = f_fss_increment_buffer(content, location, 1);
if (F_status_is_error(status)) return status;
} // while
* F_parameter (with error bit) if a parameter is invalid.
* F_utf (with error bit) is returned on failure to read/process a UTF-8 character.
*
- * Errors from (with error bit): fl_fss_increment_buffer().
- * Errors from (with error bit): fl_fss_is_graph().
- * Errors from (with error bit): fl_fss_is_space().
- * Errors from (with error bit): fl_fss_skip_past_space().
+ * Errors from (with error bit): f_fss_increment_buffer().
+ * Errors from (with error bit): f_fss_is_graph().
+ * Errors from (with error bit): f_fss_is_space().
+ * Errors from (with error bit): f_fss_skip_past_space().
*/
#ifndef _di_fl_fss_extended_list_object_read_
extern f_return_status fl_fss_extended_list_object_read(f_string_dynamic *buffer, f_string_range *location, f_fss_object *found);
* F_parameter (with error bit) if a parameter is invalid.
* F_utf (with error bit) is returned on failure to read/process a UTF-8 character.
*
- * Errors from (with error bit): fl_fss_increment_buffer().
- * Errors from (with error bit): fl_fss_is_graph().
- * Errors from (with error bit): fl_fss_is_space().
- * Errors from (with error bit): fl_fss_skip_past_space().
+ * Errors from (with error bit): f_fss_increment_buffer().
+ * Errors from (with error bit): f_fss_is_graph().
+ * Errors from (with error bit): f_fss_is_space().
+ * Errors from (with error bit): 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 *buffer, f_string_range *location, f_fss_nest *found);
* F_parameter (with error bit) if a parameter is invalid.
* F_utf (with error bit) is returned on failure to read/process a UTF-8 character.
*
- * Errors from (with error bit): fl_fss_increment_buffer().
+ * Errors from (with error bit): f_fss_increment_buffer().
*/
#ifndef _di_fl_fss_extended_list_object_write_
extern f_return_status fl_fss_extended_list_object_write(const f_string_static object, f_string_range *location, f_string_dynamic *buffer);
* F_parameter (with error bit) if a parameter is invalid.
* F_utf (with error bit) is returned on failure to read/process a UTF-8 character.
*
- * Errors from (with error bit): fl_fss_increment_buffer().
+ * Errors from (with error bit): f_fss_increment_buffer().
*/
#ifndef _di_fl_fss_extended_list_content_write_
extern f_return_status fl_fss_extended_list_content_write(const f_string_static content, f_string_range *location, f_string_dynamic *buffer);
--- /dev/null
+#include <level_1/fss.h>
+#include "private-fss.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if !defined(_di_fl_fss_identify_) || !defined(_di_fl_fss_identify_file_)
+ f_return_status private_fl_fss_identify(const f_string_static buffer, f_fss_header *header) {
+ register f_string_length i = 0;
+
+ if (buffer.used < 10) {
+ // "# fss-0000" is always at least 10 characters.
+ return FL_fss_header_not;
+ }
+
+ // If this correctly follows the FSS specification, then this should be all that needs to be done (as well as atoh for ascii to hex).
+ // All characters used in the identifier are only in the ascii equivalents of the characters, any similarly looking character or number representing in UTF-8 is considered invalid.
+ if (buffer.string[i] == f_fss_type_header_open) {
+ i++;
+
+ if (buffer.string[i] == f_fss_type_header_part1) {
+ i++;
+
+ if (buffer.string[i] == f_fss_type_header_part2) {
+ i++;
+
+ if (buffer.string[i] == f_fss_type_header_part3) {
+ i++;
+
+ if (buffer.string[i] == f_fss_type_header_part4) {
+ i++;
+
+ if (buffer.string[i] == f_fss_type_header_part5) {
+ i++;
+
+ if (f_conversion_character_is_hexidecimal(buffer.string[i]) == F_true) {
+ i++;
+
+ if (f_conversion_character_is_hexidecimal(buffer.string[i]) == F_true) {
+ i++;
+
+ if (f_conversion_character_is_hexidecimal(buffer.string[i]) == F_true) {
+ i++;
+
+ if (f_conversion_character_is_hexidecimal(buffer.string[i]) == F_true) {
+ i++;
+
+ f_string_range range = f_string_range_initialize;
+
+ range.start = i - 4;
+ range.stop = i;
+
+ // 1: A possibly valid header type was found, now convert it into its proper format and save the header type.
+ const f_status status = f_conversion_string_to_hexidecimal_unsigned(buffer.string, &header->type, range);
+ if (F_status_is_error(status)) return status;
+
+ if (status == F_none) {
+ // 2: At this point, we can still know the proper format for the file and still have a invalid header, handle accordingly.
+ if (buffer.string[i] == f_fss_type_header_close) {
+ header->length = i + 1;
+
+ return F_none;
+ }
+ else {
+ // if "# fss-0000" is there, regardless of whats next, we can guess this to be of fss-0000, even if its fss-00001 (this is a guess afterall).
+ header->length = i + 1;
+
+ return F_status_is_warning(FL_fss_accepted_invalid);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ // people can miss spaces, so lets accept in an attempt to interpret the file anyway, but return values at this point are to be flagged as invalid.
+ else if (buffer.string[i] == f_fss_type_header_part2) {
+ i++;
+
+ if (buffer.string[i] == f_fss_type_header_part3) {
+ i++;
+
+ if (buffer.string[i] == f_fss_type_header_part4) {
+ i++;
+
+ if (buffer.string[i] == f_fss_type_header_part5) {
+ i++;
+
+ if (f_conversion_character_is_hexidecimal(buffer.string[i]) == F_true) {
+ i++;
+
+ if (f_conversion_character_is_hexidecimal(buffer.string[i]) == F_true) {
+ i++;
+
+ if (f_conversion_character_is_hexidecimal(buffer.string[i]) == F_true) {
+ i++;
+
+ if (f_conversion_character_is_hexidecimal(buffer.string[i]) == F_true) {
+ i++;
+
+ f_string_range range = f_string_range_initialize;
+
+ range.start = i - 4;
+ range.stop = i;
+
+ const f_status status = f_conversion_string_to_hexidecimal_unsigned(buffer.string, &header->type, range);
+ if (F_status_is_error(status)) return status;
+
+ header->length = i + 1;
+
+ return F_status_is_warning(FL_fss_accepted_invalid);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // @todo At some point add checksum and compressions checks here, but the above statements will have to be adjusted accordingly.
+ // 3: eventually this will be processing the checksum and 4: will be processing the compression.
+
+ return FL_fss_header_not;
+ }
+#endif // !defined(_di_fl_fss_identify_) || !defined(_di_fl_fss_identify_file_)
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 1
+ *
+ * Project: FSS
+ * API Version: 0.5
+ * Licenses: lgplv2.1
+ *
+ * These are provided for internal reduction in redundant code.
+ * These should not be exposed/used outside of this project.
+ */
+#ifndef _PRIVATE_FL_fss_h
+#define _PRIVATE_FL_fss_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Private implementation of fl_fss_identify().
+ *
+ * Intended to be shared to each of the different implementation variations.
+ *
+ * @param buffer
+ * The string to process.
+ * @param header
+ * The header data to populate with results of this function.
+ *
+ * @return
+ * F_none on success
+ * FL_fss_header_not if no header is found.
+ * FL_fss_accepted_invalid (with warning bit) if header is technically invalid but can be identified.
+ * FL_fss_header_not (with error bit) if the an error occurred prior to identifying a valid header.
+ *
+ * Errors from (with error bit): f_conversion_string_to_hexidecimal_unsigned().
+ *
+ * @see fl_fss_identify()
+ * @see fl_fss_identify_file()
+ */
+#if !defined(_di_fl_fss_identify_) || !defined(_di_fl_fss_identify_file_)
+ extern f_return_status private_fl_fss_identify(const f_string_static buffer, f_fss_header *header) f_gcc_attribute_visibility_internal;
+#endif // !defined(_di_fl_fss_identify_) || !defined(_di_fl_fss_identify_file_)
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _PRIVATE_FL_fss_h
f_status
f_memory
f_string
+f_utf
f_conversion
f_file
f_fss
-f_utf
build_language c
build_linker ar
build_libraries -lc
-build_libraries-individual -lf_file -lf_conversion -lf_utf -lf_memory
-build_sources_library fss.c fss_basic.c fss_basic_list.c fss_extended.c fss_extended_list.c
+build_libraries-individual -lf_fss -lf_file -lf_conversion -lf_utf -lf_memory
+build_sources_library fss.c private-fss.c fss_basic.c fss_basic_list.c fss_extended.c fss_extended_list.c
build_sources_program
build_sources_headers fss.h fss_basic.h fss_basic_list.h fss_extended.h fss_extended_list.h fss_macro.h fss_status.h
build_sources_script
build_language c
build_linker ar
build_libraries -lc
-build_libraries-individual -lfl_string -lfl_status -lfl_fss -lf_file -lf_conversion -lf_utf -lf_memory
+build_libraries-individual -lfl_string -lfl_status -lfl_fss -lf_file -lf_fss -lf_conversion -lf_utf -lf_memory
build_sources_library fss.c fss_basic.c fss_basic_list.c fss_extended.c fss_extended_list.c fss_status.c
build_sources_program
build_sources_headers fss.h fss_basic.h fss_basic_list.h fss_extended.h fss_extended_list.h fss_status.h
build_language c
build_linker ar
build_libraries -lc
-build_libraries-individual -lfll_program -lfll_execute -lfll_fss -lfl_utf -lfl_string -lfl_status -lfl_fss -lfl_directory -lfl_console -lfl_color -lf_print -lf_path -lf_file -lf_environment -lf_directory -lf_conversion -lf_console -lf_utf -lf_memory
+build_libraries-individual -lfll_program -lfll_execute -lfll_fss -lfl_utf -lfl_string -lfl_status -lfl_fss -lfl_directory -lfl_console -lfl_color -lf_print -lf_path -lf_file -lf_fss -lf_environment -lf_directory -lf_conversion -lf_console -lf_utf -lf_memory
build_libraries-level -lfll_2 -lfll_1 -lfll_0
build_libraries-monolithic -lfll
build_sources_library fake.c private-fake.c private-clean.c private-build.c private-make.c private-print.c private-skeleton.c
build_language c
build_linker ar
build_libraries -lc
-build_libraries-individual -lfll_program -lfll_fss -lfll_execute -lfl_string -lfl_status -lfl_fss -lfl_console -lf_conversion -lfl_color -lf_print -lf_pipe -lf_path -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory
+build_libraries-individual -lfll_program -lfll_fss -lfll_execute -lfl_string -lfl_status -lfl_fss -lfl_console -lf_conversion -lfl_color -lf_print -lf_pipe -lf_path -lf_fss -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory
build_libraries-level -lfll_2 -lfll_1 -lfll_0
build_libraries-monolithic -lfll
build_sources_library firewall.c private-firewall.c
build_language c
build_linker ar
build_libraries -lc
-build_libraries-individual -lfll_program -lfll_fss -lfll_file -lfll_execute -lf_path -lfl_string -lfl_status -lfl_print -lfl_fss -lfl_console -lf_conversion -lfl_color -lf_print -lf_pipe -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory
+build_libraries-individual -lfll_program -lfll_fss -lfll_file -lfll_execute -lf_path -lfl_string -lfl_status -lfl_print -lfl_fss -lfl_console -lf_conversion -lfl_color -lf_print -lf_pipe -lf_fss -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory
build_libraries-level -lfll_2 -lfll_1 -lfll_0
build_libraries-monolithic -lfll
build_sources_library fss_basic_list_read.c private-fss_basic_list_read.c
build_language c
build_linker ar
build_libraries -lc
-build_libraries-individual -lfll_program -lfll_fss -lfll_file -lfll_execute -lf_path -lfl_string -lfl_status -lfl_fss -lfl_console -lf_conversion -lfl_color -lf_print -lf_pipe -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory
+build_libraries-individual -lfll_program -lfll_fss -lfll_file -lfll_execute -lf_path -lfl_string -lfl_status -lfl_fss -lfl_console -lf_conversion -lfl_color -lf_print -lf_pipe -lf_fss -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory
build_libraries-level -lfll_2 -lfll_1 -lfll_0
build_libraries-monolithic -lfll
build_sources_library fss_basic_list_write.c
build_language c
build_linker ar
build_libraries -lc
-build_libraries-individual -lfll_program -lfll_fss -lfll_file -lfll_execute -lf_path -lfl_string -lfl_status -lfl_print -lfl_fss -lfl_console -lf_conversion -lfl_color -lf_print -lf_pipe -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory
+build_libraries-individual -lfll_program -lfll_fss -lfll_file -lfll_execute -lf_path -lfl_string -lfl_status -lfl_print -lfl_fss -lfl_console -lf_conversion -lfl_color -lf_print -lf_pipe -lf_fss -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory
build_libraries-level -lfll_2 -lfll_1 -lfll_0
build_libraries-monolithic -lfll
build_sources_library fss_basic_read.c private-fss_basic_read.c
build_language c
build_linker ar
build_libraries -lc
-build_libraries-individual -lfll_program -lfll_fss -lfll_file -lfll_execute -lf_path -lfl_string -lfl_status -lfl_fss -lfl_console -lf_conversion -lfl_color -lf_print -lf_pipe -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory
+build_libraries-individual -lfll_program -lfll_fss -lfll_file -lfll_execute -lf_path -lfl_string -lfl_status -lfl_fss -lfl_console -lf_conversion -lfl_color -lf_print -lf_pipe -lf_fss -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory
build_libraries-level -lfll_2 -lfll_1 -lfll_0
build_libraries-monolithic -lfll
build_sources_library fss_basic_write.c
build_language c
build_linker ar
build_libraries -lc
-build_libraries-individual -lfll_program -lfll_fss -lfll_file -lfll_execute -lf_path -lfl_string -lfl_status -lfl_print -lfl_fss -lfl_console -lf_conversion -lfl_color -lf_print -lf_pipe -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory
+build_libraries-individual -lfll_program -lfll_fss -lfll_file -lfll_execute -lf_path -lfl_string -lfl_status -lfl_print -lfl_fss -lfl_console -lf_conversion -lfl_color -lf_print -lf_pipe -lf_fss -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory
build_libraries-level -lfll_2 -lfll_1 -lfll_0
build_libraries-monolithic -lfll
build_sources_library fss_extended_list_read.c private-fss_extended_list_read.c
build_language c
build_linker ar
build_libraries -lc
-build_libraries-individual -lfll_program -lfll_fss -lfll_file -lfll_execute -lf_path -lfl_string -lfl_status -lfl_print -lfl_fss -lfl_console -lf_conversion -lfl_color -lf_print -lf_pipe -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory
+build_libraries-individual -lfll_program -lfll_fss -lfll_file -lfll_execute -lf_path -lfl_string -lfl_status -lfl_print -lfl_fss -lfl_console -lf_conversion -lfl_color -lf_print -lf_pipe -lf_fss -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory
build_libraries-level -lfll_2 -lfll_1 -lfll_0
build_libraries-monolithic -lfll
build_sources_library fss_extended_read.c private-fss_extended_read.c
build_language c
build_linker ar
build_libraries -lc
-build_libraries-individual -lfll_program -lfll_fss -lfll_file -lfll_execute -lf_path -lfl_string -lfl_status -lfl_fss -lf_conversion -lfl_color -lf_print -lf_pipe -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory
+build_libraries-individual -lfll_program -lfll_fss -lfll_file -lfll_execute -lf_path -lfl_string -lfl_status -lfl_fss -lf_conversion -lfl_color -lf_print -lf_pipe -lf_fss -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory
build_libraries-level -lfll_2 -lfll_1 -lfll_0
build_libraries-monolithic -lfll
build_sources_library fss_extended_write.c
build_language c
build_linker ar
build_libraries -lc
-build_libraries-individual -lfll_status -lfll_program -lfll_fss -lfll_file -lfll_execute -lf_path -lfl_utf -lfl_string -lfl_status -lfl_fss -lfl_console -lfl_color -lf_print -lf_pipe -lf_file -lf_environment -lf_directory -lf_conversion -lf_console -lf_utf -lf_memory
+build_libraries-individual -lfll_status -lfll_program -lfll_fss -lfll_file -lfll_execute -lf_path -lfl_utf -lfl_string -lfl_status -lfl_fss -lfl_console -lfl_color -lf_print -lf_pipe -lf_fss -lf_file -lf_environment -lf_directory -lf_conversion -lf_console -lf_utf -lf_memory
build_libraries-level -lfll_2 -lfll_1 -lfll_0
build_libraries-monolithic -lfll
build_sources_library fss_status_code.c private-fss_status_code.c
build_language c
build_linker ar
build_libraries -lc
-build_libraries-individual -lfll_program -lfll_fss -lfll_execute -lf_path -lfl_string -lfl_status -lfl_fss -lfl_console -lf_conversion -lfl_color -lf_print -lf_pipe -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory
+build_libraries-individual -lfll_program -lfll_fss -lfll_execute -lf_path -lfl_string -lfl_status -lfl_fss -lfl_console -lf_conversion -lfl_color -lf_print -lf_pipe -lf_fss -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory
build_libraries-level -lfll_2 -lfll_1 -lfll_0
build_libraries-monolithic -lfll
build_sources_library init.c private-init.c