From: Kevin Day Date: Sat, 9 May 2020 01:26:45 +0000 (-0500) Subject: Cleanup: reword location to range X-Git-Tag: 0.5.0~280 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=631e622f850ad4adf6809559a7ba7243ef9c8fcf;p=fll Cleanup: reword location to range The word 'range' seems more appropriate than 'location'. --- diff --git a/level_1/fl_string/c/string.c b/level_1/fl_string/c/string.c index 41d8861..59e650e 100644 --- a/level_1/fl_string/c/string.c +++ b/level_1/fl_string/c/string.c @@ -362,23 +362,23 @@ extern "C" { #endif // _di_fl_string_dynamic_rip_nulless_ #ifndef _di_fl_string_dynamic_seek_line_to_ - f_return_status fl_string_dynamic_seek_line_to(const f_string_dynamic buffer, f_string_location *location, const int8_t seek_to_this) { + f_return_status fl_string_dynamic_seek_line_to(const f_string_dynamic buffer, f_string_location *range, const int8_t seek_to_this) { #ifndef _di_level_1_parameter_checking_ - if (location == 0) return f_status_set_error(f_invalid_parameter); - if (buffer.used <= location->start) return f_status_set_error(f_invalid_parameter); - if (buffer.used <= location->stop) return f_status_set_error(f_invalid_parameter); + if (range == 0) return f_status_set_error(f_invalid_parameter); + if (buffer.used <= range->start) return f_status_set_error(f_invalid_parameter); + if (buffer.used <= range->stop) return f_status_set_error(f_invalid_parameter); #endif // _di_level_1_parameter_checking_ if (buffer.used == 0) return f_none_on_eos; - if (location->start > location->stop) return f_none_on_stop; + if (range->start > range->stop) return f_none_on_stop; - while (buffer.string[location->start] != seek_to_this) { - if (buffer.string[location->start] == f_string_eol) return f_none_on_eol; + while (buffer.string[range->start] != seek_to_this) { + if (buffer.string[range->start] == f_string_eol) return f_none_on_eol; - location->start++; + range->start++; - if (location->start >= buffer.used) return f_none_on_eos; - if (location->start > location->stop) return f_none_on_stop; + if (range->start >= buffer.used) return f_none_on_eos; + if (range->start > range->stop) return f_none_on_stop; } // while return f_none; @@ -386,15 +386,15 @@ extern "C" { #endif // _di_fl_string_dynamic_seek_line_to_ #ifndef _di_fl_string_dynamic_seek_line_to_utf_character_ - f_return_status fl_string_dynamic_seek_line_to_utf_character(const f_string_dynamic buffer, f_string_location *location, const f_utf_character seek_to_this) { + f_return_status fl_string_dynamic_seek_line_to_utf_character(const f_string_dynamic buffer, f_string_location *range, const f_utf_character seek_to_this) { #ifndef _di_level_1_parameter_checking_ - if (location == 0) return f_status_set_error(f_invalid_parameter); - if (buffer.used <= location->start) return f_status_set_error(f_invalid_parameter); - if (buffer.used <= location->stop) return f_status_set_error(f_invalid_parameter); + if (range == 0) return f_status_set_error(f_invalid_parameter); + if (buffer.used <= range->start) return f_status_set_error(f_invalid_parameter); + if (buffer.used <= range->stop) return f_status_set_error(f_invalid_parameter); #endif // _di_level_1_parameter_checking_ if (buffer.used == 0) return f_none_on_eos; - if (location->start > location->stop) return f_none_on_stop; + if (range->start > range->stop) return f_none_on_stop; const unsigned short seek_width = f_macro_utf_character_width(seek_to_this); @@ -404,22 +404,22 @@ extern "C" { f_string_length width_max = 0; - while (location->start < buffer.used) { - width_max = (location->stop - location->start) + 1; + while (range->start < buffer.used) { + width_max = (range->stop - range->start) + 1; - if (width_max > buffer.used - location->start) { - width_max = buffer.used - location->start; + if (width_max > buffer.used - range->start) { + width_max = buffer.used - range->start; } - width = f_macro_utf_byte_width_is(buffer.string[location->start]); + width = f_macro_utf_byte_width_is(buffer.string[range->start]); if (width == 0) { width = 1; - if (buffer.string[location->start] == f_string_eol) return f_none_on_eol; + if (buffer.string[range->start] == f_string_eol) return f_none_on_eol; if (seek_width == width) { - if (buffer.string[location->start] == seek_to_this) return f_none; + if (buffer.string[range->start] == seek_to_this) return f_none; } } // Do not operate on UTF-8 fragments that are not the first byte of the character. @@ -427,21 +427,21 @@ extern "C" { return f_status_set_error(f_incomplete_utf); } else { - if (location->start + width >= buffer.used) return f_status_set_error(f_incomplete_utf_on_eos); - if (location->start + width > location->stop) return f_status_set_error(f_incomplete_utf_on_stop); + if (range->start + width >= buffer.used) return f_status_set_error(f_incomplete_utf_on_eos); + if (range->start + width > range->stop) return f_status_set_error(f_incomplete_utf_on_stop); if (width == seek_width) { f_utf_character character = 0; - status = f_utf_char_to_character(buffer.string + location->start, width_max, &character); + status = f_utf_char_to_character(buffer.string + range->start, width_max, &character); if (f_status_is_error(status)) return status; if (character == seek_to_this) return f_none; } } - location->start += width; + range->start += width; - if (location->start >= location->stop) return f_none_on_stop; + if (range->start >= range->stop) return f_none_on_stop; } // while return f_none_on_eos; @@ -449,30 +449,30 @@ extern "C" { #endif // _di_fl_string_dynamic_seek_line_to_utf_character_ #ifndef _di_fl_string_dynamic_seek_line_until_graph_ - f_return_status fl_string_dynamic_seek_line_until_graph(const f_string_dynamic buffer, f_string_location *location, const int8_t placeholder) { + f_return_status fl_string_dynamic_seek_line_until_graph(const f_string_dynamic buffer, f_string_location *range, const int8_t placeholder) { #ifndef _di_level_1_parameter_checking_ - if (location == 0) return f_status_set_error(f_invalid_parameter); - if (buffer.used <= location->start) return f_status_set_error(f_invalid_parameter); - if (buffer.used <= location->stop) return f_status_set_error(f_invalid_parameter); + if (range == 0) return f_status_set_error(f_invalid_parameter); + if (buffer.used <= range->start) return f_status_set_error(f_invalid_parameter); + if (buffer.used <= range->stop) return f_status_set_error(f_invalid_parameter); #endif // _di_level_1_parameter_checking_ if (buffer.used == 0) return f_none_on_eos; - if (location->start > location->stop) return f_none_on_stop; + if (range->start > range->stop) return f_none_on_stop; f_status status = f_none; unsigned short width = 0; - f_string_length width_max = (location->stop - location->start) + 1; + f_string_length width_max = (range->stop - range->start) + 1; - if (width_max > buffer.used - location->start) { - width_max = buffer.used - location->start; + if (width_max > buffer.used - range->start) { + width_max = buffer.used - range->start; } - while (buffer.string[location->start] == placeholder || (status = f_utf_is_graph(buffer.string + location->start, width_max)) == f_false) { + while (buffer.string[range->start] == placeholder || (status = f_utf_is_graph(buffer.string + range->start, width_max)) == f_false) { if (f_status_is_error(status)) return status; - if (buffer.string[location->start] == f_string_eol) return f_none_on_eol; + if (buffer.string[range->start] == f_string_eol) return f_none_on_eol; - width = f_macro_utf_byte_width_is(buffer.string[location->start]); + width = f_macro_utf_byte_width_is(buffer.string[range->start]); if (width == 0) { width = 1; @@ -482,19 +482,19 @@ extern "C" { return f_status_set_error(f_incomplete_utf); } else { - if (location->start + width >= buffer.used) return f_status_set_error(f_incomplete_utf_on_eos); - if (location->start + width > location->stop) return f_status_set_error(f_incomplete_utf_on_stop); + if (range->start + width >= buffer.used) return f_status_set_error(f_incomplete_utf_on_eos); + if (range->start + width > range->stop) return f_status_set_error(f_incomplete_utf_on_stop); } - location->start += width; + range->start += width; - if (location->start >= buffer.used) return f_none_on_eos; - if (location->start > location->stop) return f_none_on_stop; + if (range->start >= buffer.used) return f_none_on_eos; + if (range->start > range->stop) return f_none_on_stop; - width_max = (location->stop - location->start) + 1; + width_max = (range->stop - range->start) + 1; - if (width_max > buffer.used - location->start) { - width_max = buffer.used - location->start; + if (width_max > buffer.used - range->start) { + width_max = buffer.used - range->start; } } // while @@ -505,30 +505,30 @@ extern "C" { #endif // _di_fl_string_dynamic_seek_line_until_graph_ #ifndef _di_fl_string_dynamic_seek_line_until_non_graph_ - f_return_status fl_string_dynamic_seek_line_until_non_graph(const f_string_dynamic buffer, f_string_location *location, const int8_t placeholder) { + f_return_status fl_string_dynamic_seek_line_until_non_graph(const f_string_dynamic buffer, f_string_location *range, const int8_t placeholder) { #ifndef _di_level_1_parameter_checking_ - if (location == 0) return f_status_set_error(f_invalid_parameter); - if (buffer.used <= location->start) return f_status_set_error(f_invalid_parameter); - if (buffer.used <= location->stop) return f_status_set_error(f_invalid_parameter); + if (range == 0) return f_status_set_error(f_invalid_parameter); + if (buffer.used <= range->start) return f_status_set_error(f_invalid_parameter); + if (buffer.used <= range->stop) return f_status_set_error(f_invalid_parameter); #endif // _di_level_1_parameter_checking_ if (buffer.used == 0) return f_none_on_eos; - if (location->start > location->stop) return f_none_on_stop; + if (range->start > range->stop) return f_none_on_stop; f_status status = f_none; unsigned short width = 0; - f_string_length width_max = (location->stop - location->start) + 1; + f_string_length width_max = (range->stop - range->start) + 1; - if (width_max > buffer.used - location->start) { - width_max = buffer.used - location->start; + if (width_max > buffer.used - range->start) { + width_max = buffer.used - range->start; } - while (buffer.string[location->start] == placeholder || (status = f_utf_is_whitespace(buffer.string + location->start, width_max)) == f_false) { + while (buffer.string[range->start] == placeholder || (status = f_utf_is_whitespace(buffer.string + range->start, width_max)) == f_false) { if (f_status_is_error(status)) return status; - if (buffer.string[location->start] == f_string_eol) return f_none_on_eol; + if (buffer.string[range->start] == f_string_eol) return f_none_on_eol; - width = f_macro_utf_byte_width_is(buffer.string[location->start]); + width = f_macro_utf_byte_width_is(buffer.string[range->start]); if (width == 0) { width = 1; @@ -538,19 +538,19 @@ extern "C" { return f_status_set_error(f_incomplete_utf); } else { - if (location->start + width >= buffer.used) return f_status_set_error(f_incomplete_utf_on_eos); - if (location->start + width > location->stop) return f_status_set_error(f_incomplete_utf_on_stop); + if (range->start + width >= buffer.used) return f_status_set_error(f_incomplete_utf_on_eos); + if (range->start + width > range->stop) return f_status_set_error(f_incomplete_utf_on_stop); } - location->start += width; + range->start += width; - if (location->start >= buffer.used) return f_none_on_eos; - if (location->start > location->stop) return f_none_on_stop; + if (range->start >= buffer.used) return f_none_on_eos; + if (range->start > range->stop) return f_none_on_stop; - width_max = (location->stop - location->start) + 1; + width_max = (range->stop - range->start) + 1; - if (width_max > buffer.used - location->start) { - width_max = buffer.used - location->start; + if (width_max > buffer.used - range->start) { + width_max = buffer.used - range->start; } } // while @@ -561,21 +561,21 @@ extern "C" { #endif // _di_fl_string_dynamic_seek_line_until_non_graph_ #ifndef _di_fl_string_dynamic_seek_to_ - f_return_status fl_string_dynamic_seek_to(const f_string_dynamic buffer, f_string_location *location, const int8_t seek_to_this) { + f_return_status fl_string_dynamic_seek_to(const f_string_dynamic buffer, f_string_location *range, const int8_t seek_to_this) { #ifndef _di_level_1_parameter_checking_ - if (location == 0) return f_status_set_error(f_invalid_parameter); - if (buffer.used <= location->start) return f_status_set_error(f_invalid_parameter); - if (buffer.used <= location->stop) return f_status_set_error(f_invalid_parameter); + if (range == 0) return f_status_set_error(f_invalid_parameter); + if (buffer.used <= range->start) return f_status_set_error(f_invalid_parameter); + if (buffer.used <= range->stop) return f_status_set_error(f_invalid_parameter); #endif // _di_level_1_parameter_checking_ if (buffer.used == 0) return f_none_on_eos; - if (location->start > location->stop) return f_none_on_stop; + if (range->start > range->stop) return f_none_on_stop; - while (buffer.string[location->start] != seek_to_this) { - location->start++; + while (buffer.string[range->start] != seek_to_this) { + range->start++; - if (location->start >= buffer.used) return f_none_on_eos; - if (location->start > location->stop) return f_none_on_stop; + if (range->start >= buffer.used) return f_none_on_eos; + if (range->start > range->stop) return f_none_on_stop; } // while return f_none; @@ -583,15 +583,15 @@ extern "C" { #endif // _di_fl_string_dynamic_seek_to_ #ifndef _di_fl_string_dynamic_seek_to_utf_character_ - f_return_status fl_string_dynamic_seek_to_utf_character(const f_string_dynamic buffer, f_string_location *location, const f_utf_character seek_to_this) { + f_return_status fl_string_dynamic_seek_to_utf_character(const f_string_dynamic buffer, f_string_location *range, const f_utf_character seek_to_this) { #ifndef _di_level_1_parameter_checking_ - if (location == 0) return f_status_set_error(f_invalid_parameter); - if (buffer.used <= location->start) return f_status_set_error(f_invalid_parameter); - if (buffer.used <= location->stop) return f_status_set_error(f_invalid_parameter); + if (range == 0) return f_status_set_error(f_invalid_parameter); + if (buffer.used <= range->start) return f_status_set_error(f_invalid_parameter); + if (buffer.used <= range->stop) return f_status_set_error(f_invalid_parameter); #endif // _di_level_1_parameter_checking_ if (buffer.used == 0) return f_none_on_eos; - if (location->start > location->stop) return f_none_on_stop; + if (range->start > range->stop) return f_none_on_stop; const unsigned short seek_width = f_macro_utf_character_width(seek_to_this); @@ -601,20 +601,20 @@ extern "C" { f_string_length width_max = 0; - while (location->start < buffer.used) { - width_max = (location->stop - location->start) + 1; + while (range->start < buffer.used) { + width_max = (range->stop - range->start) + 1; - if (width_max > buffer.used - location->start) { - width_max = buffer.used - location->start; + if (width_max > buffer.used - range->start) { + width_max = buffer.used - range->start; } - width = f_macro_utf_byte_width_is(buffer.string[location->start]); + width = f_macro_utf_byte_width_is(buffer.string[range->start]); if (width == 0) { width = 1; if (seek_width == width) { - if (buffer.string[location->start] == seek_to_this) return f_none; + if (buffer.string[range->start] == seek_to_this) return f_none; } } // Do not operate on UTF-8 fragments that are not the first byte of the character. @@ -622,21 +622,21 @@ extern "C" { return f_status_set_error(f_incomplete_utf); } else { - if (location->start + width >= buffer.used) return f_status_set_error(f_incomplete_utf_on_eos); - if (location->start + width > location->stop) return f_status_set_error(f_incomplete_utf_on_stop); + if (range->start + width >= buffer.used) return f_status_set_error(f_incomplete_utf_on_eos); + if (range->start + width > range->stop) return f_status_set_error(f_incomplete_utf_on_stop); if (width == seek_width) { f_utf_character character = 0; - status = f_utf_char_to_character(buffer.string + location->start, width_max, &character); + status = f_utf_char_to_character(buffer.string + range->start, width_max, &character); if (f_status_is_error(status)) return status; if (character == seek_to_this) return f_none; } } - location->start += width; + range->start += width; - if (location->start >= location->stop) return f_none_on_stop; + if (range->start >= range->stop) return f_none_on_stop; } // while return f_none_on_eos; @@ -807,19 +807,19 @@ extern "C" { #endif // _di_fl_string_rip_nulless_ #ifndef _di_fl_string_seek_line_to_ - f_return_status fl_string_seek_line_to(const f_string string, f_string_location *location, const int8_t seek_to_this) { + f_return_status fl_string_seek_line_to(const f_string string, f_string_location *range, const int8_t seek_to_this) { #ifndef _di_level_1_parameter_checking_ - if (location == 0) return f_status_set_error(f_invalid_parameter); + if (range == 0) return f_status_set_error(f_invalid_parameter); #endif // _di_level_1_parameter_checking_ - if (location->start > location->stop) return f_none_on_stop; + if (range->start > range->stop) return f_none_on_stop; - while (string[location->start] != seek_to_this) { - if (string[location->start] == f_string_eol) return f_none_on_eol; + while (string[range->start] != seek_to_this) { + if (string[range->start] == f_string_eol) return f_none_on_eol; - location->start++; + range->start++; - if (location->start > location->stop) return f_none_on_stop; + if (range->start > range->stop) return f_none_on_stop; } // while return f_none; @@ -827,12 +827,12 @@ extern "C" { #endif // _di_fl_string_seek_line_to_ #ifndef _di_fl_string_seek_line_to_utf_character_ - f_return_status fl_string_seek_line_to_utf_character(const f_string string, f_string_location *location, const f_utf_character seek_to_this) { + f_return_status fl_string_seek_line_to_utf_character(const f_string string, f_string_location *range, const f_utf_character seek_to_this) { #ifndef _di_level_1_parameter_checking_ - if (location == 0) return f_status_set_error(f_invalid_parameter); + if (range == 0) return f_status_set_error(f_invalid_parameter); #endif // _di_level_1_parameter_checking_ - if (location->start > location->stop) return f_none_on_stop; + if (range->start > range->stop) return f_none_on_stop; const unsigned short seek_width = f_macro_utf_character_width(seek_to_this); @@ -840,20 +840,20 @@ extern "C" { unsigned short width = 0; - f_string_length width_max = (location->stop - location->start) + 1; + f_string_length width_max = (range->stop - range->start) + 1; - for (; location->start <= location->stop; location->start += width) { - width_max = (location->stop - location->start) + 1; + for (; range->start <= range->stop; range->start += width) { + width_max = (range->stop - range->start) + 1; - width = f_macro_utf_byte_width_is(string[location->start]); + width = f_macro_utf_byte_width_is(string[range->start]); if (width == 0) { width = 1; - if (string[location->start] == f_string_eol) return f_none_on_eol; + if (string[range->start] == f_string_eol) return f_none_on_eol; if (seek_width == width) { - if (string[location->start] == seek_to_this) return f_none; + if (string[range->start] == seek_to_this) return f_none; } } // Do not operate on UTF-8 fragments that are not the first byte of the character. @@ -861,11 +861,11 @@ extern "C" { return f_status_set_error(f_incomplete_utf); } else { - if (location->start + width > location->stop) return f_status_set_error(f_incomplete_utf_on_eos); + if (range->start + width > range->stop) return f_status_set_error(f_incomplete_utf_on_eos); if (width == seek_width) { f_utf_character character = 0; - status = f_utf_char_to_character(string + location->start, width_max, &character); + status = f_utf_char_to_character(string + range->start, width_max, &character); if (f_status_is_error(status)) return status; if (character == seek_to_this) return f_none; @@ -878,23 +878,23 @@ extern "C" { #endif // _di_fl_string_seek_line_to_utf_character_ #ifndef _di_fl_string_seek_line_until_graph_ - f_return_status fl_string_seek_line_until_graph(const f_string string, f_string_location *location, const int8_t placeholder) { + f_return_status fl_string_seek_line_until_graph(const f_string string, f_string_location *range, const int8_t placeholder) { #ifndef _di_level_1_parameter_checking_ - if (location == 0) return f_status_set_error(f_invalid_parameter); + if (range == 0) return f_status_set_error(f_invalid_parameter); #endif // _di_level_1_parameter_checking_ - if (location->start > location->stop) return f_none_on_stop; + if (range->start > range->stop) return f_none_on_stop; f_status status = f_none; unsigned short width = 0; - f_string_length width_max = (location->stop - location->start) + 1; + f_string_length width_max = (range->stop - range->start) + 1; - while (string[location->start] == placeholder || (status = f_utf_is_graph(string + location->start, width_max)) == f_false) { + while (string[range->start] == placeholder || (status = f_utf_is_graph(string + range->start, width_max)) == f_false) { if (f_status_is_error(status)) return status; - if (string[location->start] == f_string_eol) return f_none_on_eol; + if (string[range->start] == f_string_eol) return f_none_on_eol; - width = f_macro_utf_byte_width_is(string[location->start]); + width = f_macro_utf_byte_width_is(string[range->start]); if (width == 0) { width = 1; @@ -904,14 +904,14 @@ extern "C" { return f_status_set_error(f_incomplete_utf); } else { - if (location->start + width > location->stop) return f_status_set_error(f_incomplete_utf_on_stop); + if (range->start + width > range->stop) return f_status_set_error(f_incomplete_utf_on_stop); } - location->start += width; + range->start += width; - if (location->start > location->stop) return f_none_on_stop; + if (range->start > range->stop) return f_none_on_stop; - width_max = (location->stop - location->start) + 1; + width_max = (range->stop - range->start) + 1; } // while if (f_status_is_error(status)) return status; @@ -921,26 +921,26 @@ extern "C" { #endif // _di_fl_string_seek_line_until_graph_ #ifndef _di_fl_string_seek_line_until_non_graph_ - f_return_status fl_string_seek_line_until_non_graph(const f_string string, f_string_location *location, const int8_t placeholder) { + f_return_status fl_string_seek_line_until_non_graph(const f_string string, f_string_location *range, const int8_t placeholder) { #ifndef _di_level_1_parameter_checking_ - if (location == 0) return f_status_set_error(f_invalid_parameter); + if (range == 0) return f_status_set_error(f_invalid_parameter); #endif // _di_level_1_parameter_checking_ - if (location->start > location->stop) return f_none_on_stop; + if (range->start > range->stop) return f_none_on_stop; f_status status = f_none; unsigned short width = 0; - f_string_length width_max = (location->stop - location->start) + 1; + f_string_length width_max = (range->stop - range->start) + 1; - while (string[location->start] == placeholder || (status = f_utf_is_whitespace(string + location->start, width_max)) == f_false) { + while (string[range->start] == placeholder || (status = f_utf_is_whitespace(string + range->start, width_max)) == f_false) { if (f_status_is_error(status)) { return status; } - if (string[location->start] == f_string_eol) return f_none_on_eol; + if (string[range->start] == f_string_eol) return f_none_on_eol; - width = f_macro_utf_byte_width_is(string[location->start]); + width = f_macro_utf_byte_width_is(string[range->start]); if (width == 0) { width = 1; @@ -950,14 +950,14 @@ extern "C" { return f_status_set_error(f_incomplete_utf); } else { - if (location->start + width > location->stop) return f_status_set_error(f_incomplete_utf_on_stop); + if (range->start + width > range->stop) return f_status_set_error(f_incomplete_utf_on_stop); } - location->start += width; + range->start += width; - if (location->start > location->stop) return f_none_on_stop; + if (range->start > range->stop) return f_none_on_stop; - width_max = (location->stop - location->start) + 1; + width_max = (range->stop - range->start) + 1; } // while if (f_status_is_error(status)) return status; @@ -967,17 +967,17 @@ extern "C" { #endif // _di_fl_string_seek_line_until_non_graph_ #ifndef _di_fl_string_seek_to_ - f_return_status fl_string_seek_to(const f_string string, f_string_location *location, const int8_t seek_to_this) { + f_return_status fl_string_seek_to(const f_string string, f_string_location *range, const int8_t seek_to_this) { #ifndef _di_level_1_parameter_checking_ - if (location == 0) return f_status_set_error(f_invalid_parameter); + if (range == 0) return f_status_set_error(f_invalid_parameter); #endif // _di_level_1_parameter_checking_ - if (location->start > location->stop) return f_none_on_stop; + if (range->start > range->stop) return f_none_on_stop; - while (string[location->start] != seek_to_this) { - location->start++; + while (string[range->start] != seek_to_this) { + range->start++; - if (location->start > location->stop) return f_none_on_stop; + if (range->start > range->stop) return f_none_on_stop; } // while return f_none; @@ -985,12 +985,12 @@ extern "C" { #endif // _di_fl_string_seek_to_ #ifndef _di_fl_string_seek_to_utf_character_ - f_return_status fl_string_seek_to_utf_character(const f_string string, f_string_location *location, const f_utf_character seek_to_this) { + f_return_status fl_string_seek_to_utf_character(const f_string string, f_string_location *range, const f_utf_character seek_to_this) { #ifndef _di_level_1_parameter_checking_ - if (location == 0) return f_status_set_error(f_invalid_parameter); + if (range == 0) return f_status_set_error(f_invalid_parameter); #endif // _di_level_1_parameter_checking_ - if (location->start > location->stop) return f_none_on_stop; + if (range->start > range->stop) return f_none_on_stop; const unsigned short seek_width = f_macro_utf_character_width(seek_to_this); @@ -1000,16 +1000,16 @@ extern "C" { f_string_length width_max = 0; - for (; location->start <= location->stop; location->start += width) { - width_max = (location->stop - location->start) + 1; + for (; range->start <= range->stop; range->start += width) { + width_max = (range->stop - range->start) + 1; - width = f_macro_utf_byte_width_is(string[location->start]); + width = f_macro_utf_byte_width_is(string[range->start]); if (width == 0) { width = 1; if (seek_width == width) { - if (string[location->start] == seek_to_this) return f_none; + if (string[range->start] == seek_to_this) return f_none; } } // Do not operate on UTF-8 fragments that are not the first byte of the character. @@ -1017,11 +1017,11 @@ extern "C" { return f_status_set_error(f_incomplete_utf); } else { - if (location->start + width > location->stop) return f_status_set_error(f_incomplete_utf_on_stop); + if (range->start + width > range->stop) return f_status_set_error(f_incomplete_utf_on_stop); if (width == seek_width) { f_utf_character character = 0; - status = f_utf_char_to_character(string + location->start, width_max, &character); + status = f_utf_char_to_character(string + range->start, width_max, &character); if (f_status_is_error(status)) return status; if (character == seek_to_this) return f_none; diff --git a/level_1/fl_string/c/string.h b/level_1/fl_string/c/string.h index 4b73725..c33de73 100644 --- a/level_1/fl_string/c/string.h +++ b/level_1/fl_string/c/string.h @@ -748,7 +748,7 @@ extern "C" { * * @param buffer * The buffer to traverse. - * @param location + * @param range * A range within the buffer representing the start and stop locations. * The start location will be incremented by seek. * @param seek_to_this @@ -765,7 +765,7 @@ extern "C" { * @see fl_string_seek_line_to_utf_character() */ #ifndef _di_fl_string_dynamic_seek_line_to_ - extern f_return_status fl_string_dynamic_seek_line_to(const f_string_dynamic buffer, f_string_location *location, const int8_t seek_to_this); + extern f_return_status fl_string_dynamic_seek_line_to(const f_string_dynamic buffer, f_string_location *range, const int8_t seek_to_this); #endif // _di_fl_string_dynamic_seek_line_to_ /** @@ -773,7 +773,7 @@ extern "C" { * * @param buffer * The buffer to traverse. - * @param location + * @param range * A range within the buffer representing the start and stop locations. * The start location will be incremented by seek. * @param seek_to_this @@ -793,7 +793,7 @@ extern "C" { * @see fl_string_seek_line_to() */ #ifndef _di_fl_string_dynamic_seek_line_to_utf_character_ - extern f_return_status fl_string_dynamic_seek_line_to_utf_character(const f_string_dynamic buffer, f_string_location *location, const f_utf_character seek_to_this); + extern f_return_status fl_string_dynamic_seek_line_to_utf_character(const f_string_dynamic buffer, f_string_location *range, const f_utf_character seek_to_this); #endif // _di_fl_string_dynamic_seek_line_to_utf_character_ /** @@ -801,7 +801,7 @@ extern "C" { * * @param buffer * The buffer to traverse. - * @param location + * @param range * A range within the buffer representing the start and stop locations. * @param placeholder * A single-width character representing a placeholder to ignore (may be NULL). @@ -820,7 +820,7 @@ extern "C" { * @see fl_string_seek_line_until_graph() */ #ifndef _di_fl_string_dynamic_seek_line_until_graph_ - extern f_return_status fl_string_dynamic_seek_line_until_graph(const f_string_dynamic buffer, f_string_location *location, const int8_t placeholder); + extern f_return_status fl_string_dynamic_seek_line_until_graph(const f_string_dynamic buffer, f_string_location *range, const int8_t placeholder); #endif // _di_fl_string_dynamic_seek_line_until_graph_ /** @@ -828,7 +828,7 @@ extern "C" { * * @param buffer * The buffer to traverse. - * @param location + * @param range * A range within the buffer representing the start and stop locations. * @param placeholder * A single-width character representing a placeholder to ignore (may be NULL). @@ -848,7 +848,7 @@ extern "C" { * @see fl_string_seek_line_until_non_graph() */ #ifndef _di_fl_string_dynamic_seek_line_until_non_graph_ - extern f_return_status fl_string_dynamic_seek_line_until_non_graph(const f_string_dynamic buffer, f_string_location *location, const int8_t placeholder); + extern f_return_status fl_string_dynamic_seek_line_until_non_graph(const f_string_dynamic buffer, f_string_location *range, const int8_t placeholder); #endif // _di_fl_string_dynamic_seek_line_until_non_graph_ /** @@ -856,7 +856,7 @@ extern "C" { * * @param buffer * The buffer to traverse. - * @param location + * @param range * A range within the buffer representing the start and stop locations. * The start location will be incremented by seek. * @param seek_to_this @@ -876,7 +876,7 @@ extern "C" { * @see fl_string_seek_to_utf_character() */ #ifndef _di_fl_string_dynamic_seek_to_ - extern f_return_status fl_string_dynamic_seek_to(const f_string_dynamic buffer, f_string_location *location, const int8_t seek_to_this); + extern f_return_status fl_string_dynamic_seek_to(const f_string_dynamic buffer, f_string_location *range, const int8_t seek_to_this); #endif // _di_fl_string_dynamic_seek_to_ /** @@ -884,7 +884,7 @@ extern "C" { * * @param buffer * The buffer to traverse. - * @param location + * @param range * A range within the buffer representing the start and stop locations. * The start location will be incremented by seek. * @param seek_to_this @@ -905,7 +905,7 @@ extern "C" { * @see fl_string_seek_to_character() */ #ifndef _di_fl_string_dynamic_seek_to_utf_character_ - extern f_return_status fl_string_dynamic_seek_to_utf_character(const f_string_dynamic buffer, f_string_location *location, const f_utf_character seek_to_this); + extern f_return_status fl_string_dynamic_seek_to_utf_character(const f_string_dynamic buffer, f_string_location *range, const f_utf_character seek_to_this); #endif // _di_fl_string_dynamic_seek_to_utf_character_ /** @@ -1166,7 +1166,7 @@ extern "C" { * * @param string * The string to traverse. - * @param location + * @param range * A range within the buffer representing the start and stop locations. * The start location will be incremented by seek. * @param seek_to_this @@ -1183,7 +1183,7 @@ extern "C" { * @see fl_string_seek_line_to_utf_character() */ #ifndef _di_fl_string_seek_line_to_ - extern f_return_status fl_string_seek_line_to(const f_string string, f_string_location *location, const int8_t seek_to_this); + extern f_return_status fl_string_seek_line_to(const f_string string, f_string_location *range, const int8_t seek_to_this); #endif // _di_fl_string_seek_line_to_ /** @@ -1191,7 +1191,7 @@ extern "C" { * * @param string * The string to traverse. - * @param location + * @param range * A range within the buffer representing the start and stop locations. * The start location will be incremented by seek. * @param seek_to_this @@ -1209,7 +1209,7 @@ extern "C" { * @see fl_string_seek_line_to() */ #ifndef _di_fl_string_seek_line_to_utf_character_ - extern f_return_status fl_string_seek_line_to_utf_character(const f_string string, f_string_location *location, const f_utf_character seek_to_this); + extern f_return_status fl_string_seek_line_to_utf_character(const f_string string, f_string_location *range, const f_utf_character seek_to_this); #endif // _di_fl_string_seek_line_to_utf_character_ /** @@ -1217,7 +1217,7 @@ extern "C" { * * @param string * The string to traverse. - * @param location + * @param range * A range within the buffer representing the start and stop locations. * The start location will be incremented by seek. * @param placeholder @@ -1235,7 +1235,7 @@ extern "C" { * @see fl_string_dynamic_seek_line_until_graph() */ #ifndef _di_fl_string_seek_line_until_graph_ - extern f_return_status fl_string_seek_line_until_graph(const f_string string, f_string_location *location, const int8_t placeholder); + extern f_return_status fl_string_seek_line_until_graph(const f_string string, f_string_location *range, const int8_t placeholder); #endif // _di_fl_string_seek_line_until_graph_ /** @@ -1243,7 +1243,7 @@ extern "C" { * * @param string * The string to traverse. - * @param location + * @param range * A range within the buffer representing the start and stop locations. * The start location will be incremented by seek. * @param placeholder @@ -1262,7 +1262,7 @@ extern "C" { * @see fl_string_dynamic_seek_line_until_non_graph() */ #ifndef _di_fl_string_seek_line_until_non_graph_ - extern f_return_status fl_string_seek_line_until_non_graph(const f_string string, f_string_location *location, const int8_t placeholder); + extern f_return_status fl_string_seek_line_until_non_graph(const f_string string, f_string_location *range, const int8_t placeholder); #endif // _di_fl_string_seek_line_until_non_graph_ /** @@ -1270,7 +1270,7 @@ extern "C" { * * @param string * The string to traverse. - * @param location + * @param range * A range within the buffer representing the start and stop locations. * The start location will be incremented by seek. * @param seek_to_this @@ -1288,7 +1288,7 @@ extern "C" { * @see fl_string_seek_to_utf_character() */ #ifndef _di_fl_string_seek_to_ - extern f_return_status fl_string_seek_to(const f_string string, f_string_location *location, const int8_t seek_to_this); + extern f_return_status fl_string_seek_to(const f_string string, f_string_location *range, const int8_t seek_to_this); #endif // _di_fl_string_seek_to_ /** @@ -1296,7 +1296,7 @@ extern "C" { * * @param string * The string to traverse. - * @param location + * @param range * A range within the buffer representing the start and stop locations. * The start location will be incremented by seek. * @param seek_to_this @@ -1315,7 +1315,7 @@ extern "C" { * @see fl_string_seek_to() */ #ifndef _di_fl_string_seek_to_utf_character_ - extern f_return_status fl_string_seek_to_utf_character(const f_string string, f_string_location *location, const f_utf_character seek_to_this); + extern f_return_status fl_string_seek_to_utf_character(const f_string string, f_string_location *range, const f_utf_character seek_to_this); #endif // _di_fl_string_seek_to_utf_character_ #ifdef __cplusplus diff --git a/level_1/fl_utf/c/utf.c b/level_1/fl_utf/c/utf.c index ad61149..e508797 100644 --- a/level_1/fl_utf/c/utf.c +++ b/level_1/fl_utf/c/utf.c @@ -388,31 +388,31 @@ extern "C" { #endif // _di_fl_utf_string_dynamic_rip_nulless_ #ifndef _di_fl_utf_string_dynamic_seek_line_to_ - f_return_status fl_utf_string_dynamic_seek_line_to(const f_utf_string_dynamic buffer, f_utf_string_location *location, const f_utf_character seek_to_this) { + f_return_status fl_utf_string_dynamic_seek_line_to(const f_utf_string_dynamic buffer, f_utf_string_location *range, const f_utf_character seek_to_this) { #ifndef _di_level_1_parameter_checking_ - if (location == 0) return f_status_set_error(f_invalid_parameter); - if (buffer.used <= location->start) return f_status_set_error(f_invalid_parameter); - if (buffer.used <= location->stop) return f_status_set_error(f_invalid_parameter); + if (range == 0) return f_status_set_error(f_invalid_parameter); + if (buffer.used <= range->start) return f_status_set_error(f_invalid_parameter); + if (buffer.used <= range->stop) return f_status_set_error(f_invalid_parameter); #endif // _di_level_1_parameter_checking_ if (buffer.used == 0) return f_none_on_eos; - if (location->start > location->stop) return f_none_on_stop; + if (range->start > range->stop) return f_none_on_stop; - if (f_macro_utf_character_width_is(buffer.string[location->start]) == 1) { + if (f_macro_utf_character_width_is(buffer.string[range->start]) == 1) { return f_status_set_error(f_invalid_utf); } - while (buffer.string[location->start] != seek_to_this) { - if (buffer.string[location->start] == f_utf_character_eol) return f_none_on_eol; + while (buffer.string[range->start] != seek_to_this) { + if (buffer.string[range->start] == f_utf_character_eol) return f_none_on_eol; - location->start++; + range->start++; - if (f_macro_utf_character_width_is(buffer.string[location->start]) == 1) { + if (f_macro_utf_character_width_is(buffer.string[range->start]) == 1) { return f_status_set_error(f_invalid_utf); } - if (location->start >= buffer.used) return f_none_on_eos; - if (location->start > location->stop) return f_none_on_stop; + if (range->start >= buffer.used) return f_none_on_eos; + if (range->start > range->stop) return f_none_on_stop; } // while return f_none; @@ -420,33 +420,33 @@ extern "C" { #endif // _di_fl_utf_string_dynamic_seek_line_to_ #ifndef _di_fl_utf_string_dynamic_seek_line_to_char_ - f_return_status fl_utf_string_dynamic_seek_line_to_char(const f_utf_string_dynamic buffer, f_utf_string_location *location, const int8_t seek_to_this) { + f_return_status fl_utf_string_dynamic_seek_line_to_char(const f_utf_string_dynamic buffer, f_utf_string_location *range, const int8_t seek_to_this) { #ifndef _di_level_1_parameter_checking_ - if (location == 0) return f_status_set_error(f_invalid_parameter); - if (buffer.used <= location->start) return f_status_set_error(f_invalid_parameter); - if (buffer.used <= location->stop) return f_status_set_error(f_invalid_parameter); + if (range == 0) return f_status_set_error(f_invalid_parameter); + if (buffer.used <= range->start) return f_status_set_error(f_invalid_parameter); + if (buffer.used <= range->stop) return f_status_set_error(f_invalid_parameter); #endif // _di_level_1_parameter_checking_ if (buffer.used == 0) return f_none_on_eos; - if (location->start > location->stop) return f_none_on_stop; + if (range->start > range->stop) return f_none_on_stop; f_utf_character seek_to_character = seek_to_this << 24; - if (f_macro_utf_character_width_is(buffer.string[location->start]) == 1) { + if (f_macro_utf_character_width_is(buffer.string[range->start]) == 1) { return f_status_set_error(f_invalid_utf); } - while (buffer.string[location->start] != seek_to_character) { - if (buffer.string[location->start] == f_utf_character_eol) return f_none_on_eol; + while (buffer.string[range->start] != seek_to_character) { + if (buffer.string[range->start] == f_utf_character_eol) return f_none_on_eol; - location->start++; + range->start++; - if (f_macro_utf_character_width_is(buffer.string[location->start]) == 1) { + if (f_macro_utf_character_width_is(buffer.string[range->start]) == 1) { return f_status_set_error(f_invalid_utf); } - if (location->start >= buffer.used) return f_none_on_eos; - if (location->start > location->stop) return f_none_on_stop; + if (range->start >= buffer.used) return f_none_on_eos; + if (range->start > range->stop) return f_none_on_stop; } // while return f_none; @@ -454,37 +454,37 @@ extern "C" { #endif // _di_fl_utf_string_dynamic_seek_line_to_character_ #ifndef _di_fl_utf_string_dynamic_seek_line_until_graph_ - f_return_status fl_utf_string_dynamic_seek_line_until_graph(const f_utf_string_dynamic buffer, f_utf_string_location *location, const f_utf_character placeholder) { + f_return_status fl_utf_string_dynamic_seek_line_until_graph(const f_utf_string_dynamic buffer, f_utf_string_location *range, const f_utf_character placeholder) { #ifndef _di_level_1_parameter_checking_ - if (location == 0) return f_status_set_error(f_invalid_parameter); - if (buffer.used <= location->start) return f_status_set_error(f_invalid_parameter); - if (buffer.used <= location->stop) return f_status_set_error(f_invalid_parameter); + if (range == 0) return f_status_set_error(f_invalid_parameter); + if (buffer.used <= range->start) return f_status_set_error(f_invalid_parameter); + if (buffer.used <= range->stop) return f_status_set_error(f_invalid_parameter); #endif // _di_level_1_parameter_checking_ if (buffer.used == 0) return f_none_on_eos; - if (location->start > location->stop) return f_none_on_stop; + if (range->start > range->stop) return f_none_on_stop; f_status status = f_none; - if (f_macro_utf_character_width_is(buffer.string[location->start]) == 1) { + if (f_macro_utf_character_width_is(buffer.string[range->start]) == 1) { return f_status_set_error(f_invalid_utf); } - while (buffer.string[location->start] == placeholder || (status = f_utf_character_is_graph(buffer.string[location->start])) == f_false) { + while (buffer.string[range->start] == placeholder || (status = f_utf_character_is_graph(buffer.string[range->start])) == f_false) { if (f_status_is_error(status)) { return status; } - if (buffer.string[location->start] == f_utf_character_eol) return f_none_on_eol; + if (buffer.string[range->start] == f_utf_character_eol) return f_none_on_eol; - location->start++; + range->start++; - if (f_macro_utf_character_width_is(buffer.string[location->start]) == 1) { + if (f_macro_utf_character_width_is(buffer.string[range->start]) == 1) { return f_status_set_error(f_invalid_utf); } - if (location->start >= buffer.used) return f_none_on_eos; - if (location->start > location->stop) return f_none_on_stop; + if (range->start >= buffer.used) return f_none_on_eos; + if (range->start > range->stop) return f_none_on_stop; } // while if (f_status_is_error(status)) { @@ -496,37 +496,37 @@ extern "C" { #endif // _di_fl_utf_string_dynamic_seek_line_until_graph_ #ifndef _di_fl_utf_string_dynamic_seek_line_until_non_graph_ - f_return_status fl_utf_string_dynamic_seek_line_until_non_graph(const f_utf_string_dynamic buffer, f_utf_string_location *location, const f_utf_character placeholder) { + f_return_status fl_utf_string_dynamic_seek_line_until_non_graph(const f_utf_string_dynamic buffer, f_utf_string_location *range, const f_utf_character placeholder) { #ifndef _di_level_1_parameter_checking_ - if (location == 0) return f_status_set_error(f_invalid_parameter); - if (buffer.used <= location->start) return f_status_set_error(f_invalid_parameter); - if (buffer.used <= location->stop) return f_status_set_error(f_invalid_parameter); + if (range == 0) return f_status_set_error(f_invalid_parameter); + if (buffer.used <= range->start) return f_status_set_error(f_invalid_parameter); + if (buffer.used <= range->stop) return f_status_set_error(f_invalid_parameter); #endif // _di_level_1_parameter_checking_ if (buffer.used == 0) return f_none_on_eos; - if (location->start > location->stop) return f_none_on_stop; + if (range->start > range->stop) return f_none_on_stop; f_status status = f_none; - if (f_macro_utf_character_width_is(buffer.string[location->start]) == 1) { + if (f_macro_utf_character_width_is(buffer.string[range->start]) == 1) { return f_status_set_error(f_invalid_utf); } - while (buffer.string[location->start] == placeholder || (status = f_utf_character_is_whitespace(buffer.string[location->start])) == f_false) { + while (buffer.string[range->start] == placeholder || (status = f_utf_character_is_whitespace(buffer.string[range->start])) == f_false) { if (f_status_is_error(status)) { return status; } - if (buffer.string[location->start] == f_utf_character_eol) return f_none_on_eol; + if (buffer.string[range->start] == f_utf_character_eol) return f_none_on_eol; - location->start++; + range->start++; - if (f_macro_utf_character_width_is(buffer.string[location->start]) == 1) { + if (f_macro_utf_character_width_is(buffer.string[range->start]) == 1) { return f_status_set_error(f_invalid_utf); } - if (location->start >= buffer.used) return f_none_on_eos; - if (location->start > location->stop) return f_none_on_stop; + if (range->start >= buffer.used) return f_none_on_eos; + if (range->start > range->stop) return f_none_on_stop; } // while if (f_status_is_error(status)) { @@ -538,29 +538,29 @@ extern "C" { #endif // _di_fl_utf_string_dynamic_seek_line_until_non_graph_ #ifndef _di_fl_utf_string_dynamic_seek_to_ - f_return_status fl_utf_string_dynamic_seek_to(const f_utf_string_dynamic buffer, f_utf_string_location *location, const f_utf_character seek_to_this) { + f_return_status fl_utf_string_dynamic_seek_to(const f_utf_string_dynamic buffer, f_utf_string_location *range, const f_utf_character seek_to_this) { #ifndef _di_level_1_parameter_checking_ - if (location == 0) return f_status_set_error(f_invalid_parameter); - if (buffer.used <= location->start) return f_status_set_error(f_invalid_parameter); - if (buffer.used <= location->stop) return f_status_set_error(f_invalid_parameter); + if (range == 0) return f_status_set_error(f_invalid_parameter); + if (buffer.used <= range->start) return f_status_set_error(f_invalid_parameter); + if (buffer.used <= range->stop) return f_status_set_error(f_invalid_parameter); #endif // _di_level_1_parameter_checking_ if (buffer.used == 0) return f_none_on_eos; - if (location->start > location->stop) return f_none_on_stop; + if (range->start > range->stop) return f_none_on_stop; - if (f_macro_utf_character_width_is(buffer.string[location->start]) == 1) { + if (f_macro_utf_character_width_is(buffer.string[range->start]) == 1) { return f_status_set_error(f_invalid_utf); } - while (buffer.string[location->start] != seek_to_this) { - location->start++; + while (buffer.string[range->start] != seek_to_this) { + range->start++; - if (f_macro_utf_character_width_is(buffer.string[location->start]) == 1) { + if (f_macro_utf_character_width_is(buffer.string[range->start]) == 1) { return f_status_set_error(f_invalid_utf); } - if (location->start >= buffer.used) return f_none_on_eos; - if (location->start > location->stop) return f_none_on_stop; + if (range->start >= buffer.used) return f_none_on_eos; + if (range->start > range->stop) return f_none_on_stop; } // while return f_none; @@ -568,31 +568,31 @@ extern "C" { #endif // _di_fl_utf_string_dynamic_seek_to_ #ifndef _di_fl_utf_string_dynamic_seek_to_char_ - f_return_status fl_utf_string_dynamic_seek_to_char(const f_utf_string_dynamic buffer, f_utf_string_location *location, const int8_t seek_to_this) { + f_return_status fl_utf_string_dynamic_seek_to_char(const f_utf_string_dynamic buffer, f_utf_string_location *range, const int8_t seek_to_this) { #ifndef _di_level_1_parameter_checking_ - if (location == 0) return f_status_set_error(f_invalid_parameter); - if (buffer.used <= location->start) return f_status_set_error(f_invalid_parameter); - if (buffer.used <= location->stop) return f_status_set_error(f_invalid_parameter); + if (range == 0) return f_status_set_error(f_invalid_parameter); + if (buffer.used <= range->start) return f_status_set_error(f_invalid_parameter); + if (buffer.used <= range->stop) return f_status_set_error(f_invalid_parameter); #endif // _di_level_1_parameter_checking_ if (buffer.used == 0) return f_none_on_eos; - if (location->start > location->stop) return f_none_on_stop; + if (range->start > range->stop) return f_none_on_stop; f_utf_character seek_to_character = seek_to_this << 24; - if (f_macro_utf_character_width_is(buffer.string[location->start]) == 1) { + if (f_macro_utf_character_width_is(buffer.string[range->start]) == 1) { return f_status_set_error(f_invalid_utf); } - while (buffer.string[location->start] != seek_to_character) { - location->start++; + while (buffer.string[range->start] != seek_to_character) { + range->start++; - if (f_macro_utf_character_width_is(buffer.string[location->start]) == 1) { + if (f_macro_utf_character_width_is(buffer.string[range->start]) == 1) { return f_status_set_error(f_invalid_utf); } - if (location->start >= buffer.used) return f_none_on_eos; - if (location->start > location->stop) return f_none_on_stop; + if (range->start >= buffer.used) return f_none_on_eos; + if (range->start > range->stop) return f_none_on_stop; } // while return f_none; @@ -771,27 +771,27 @@ extern "C" { #endif // _di_fl_utf_string_rip_nulless_ #ifndef _di_fl_utf_string_seek_line_to_ - f_return_status fl_utf_string_seek_line_to(const f_utf_string string, f_utf_string_location *location, const f_utf_character seek_to_this) { + f_return_status fl_utf_string_seek_line_to(const f_utf_string string, f_utf_string_location *range, const f_utf_character seek_to_this) { #ifndef _di_level_1_parameter_checking_ - if (location == 0) return f_status_set_error(f_invalid_parameter); + if (range == 0) return f_status_set_error(f_invalid_parameter); #endif // _di_level_1_parameter_checking_ - if (location->start > location->stop) return f_none_on_stop; + if (range->start > range->stop) return f_none_on_stop; - if (f_macro_utf_character_width_is(string[location->start]) == 1) { + if (f_macro_utf_character_width_is(string[range->start]) == 1) { return f_status_set_error(f_invalid_utf); } - while (string[location->start] != seek_to_this) { - if (string[location->start] == f_utf_character_eol) return f_none_on_eol; + while (string[range->start] != seek_to_this) { + if (string[range->start] == f_utf_character_eol) return f_none_on_eol; - location->start++; + range->start++; - if (f_macro_utf_character_width_is(string[location->start]) == 1) { + if (f_macro_utf_character_width_is(string[range->start]) == 1) { return f_status_set_error(f_invalid_utf); } - if (location->start > location->stop) return f_none_on_stop; + if (range->start > range->stop) return f_none_on_stop; } // while return f_none; @@ -799,24 +799,24 @@ extern "C" { #endif // _di_fl_utf_string_seek_line_to_ #ifndef _di_fl_utf_string_seek_line_to_char_ - f_return_status fl_utf_string_seek_line_to_char(const f_utf_string string, f_utf_string_location *location, const int8_t seek_to_this) { + f_return_status fl_utf_string_seek_line_to_char(const f_utf_string string, f_utf_string_location *range, const int8_t seek_to_this) { #ifndef _di_level_1_parameter_checking_ - if (location == 0) return f_status_set_error(f_invalid_parameter); + if (range == 0) return f_status_set_error(f_invalid_parameter); #endif // _di_level_1_parameter_checking_ - if (location->start > location->stop) return f_none_on_stop; + if (range->start > range->stop) return f_none_on_stop; f_utf_character seek_to_character = seek_to_this << 24; f_status status = f_none; - for (; location->start <= location->stop; location->start++) { - if (f_macro_utf_character_width_is(string[location->start]) == 1) { + for (; range->start <= range->stop; range->start++) { + if (f_macro_utf_character_width_is(string[range->start]) == 1) { return f_status_set_error(f_invalid_utf); } - if (string[location->start] == f_utf_character_eol) return f_none_on_eol; - if (string[location->start] == seek_to_character) return f_none; + if (string[range->start] == f_utf_character_eol) return f_none_on_eol; + if (string[range->start] == seek_to_character) return f_none; } // for return f_none_on_stop; @@ -824,33 +824,33 @@ extern "C" { #endif // _di_fl_utf_string_seek_line_to_char_ #ifndef _di_fl_utf_string_seek_line_until_graph_ - f_return_status fl_utf_string_seek_line_until_graph(const f_utf_string string, f_utf_string_location *location, const f_utf_character placeholder) { + f_return_status fl_utf_string_seek_line_until_graph(const f_utf_string string, f_utf_string_location *range, const f_utf_character placeholder) { #ifndef _di_level_1_parameter_checking_ - if (location == 0) return f_status_set_error(f_invalid_parameter); + if (range == 0) return f_status_set_error(f_invalid_parameter); #endif // _di_level_1_parameter_checking_ - if (location->start > location->stop) return f_none_on_stop; + if (range->start > range->stop) return f_none_on_stop; f_status status = f_none; - if (f_macro_utf_character_width_is(string[location->start]) == 1) { + if (f_macro_utf_character_width_is(string[range->start]) == 1) { return f_status_set_error(f_invalid_utf); } - while (string[location->start] == placeholder || (status = f_utf_character_is_graph(string[location->start])) == f_false) { + while (string[range->start] == placeholder || (status = f_utf_character_is_graph(string[range->start])) == f_false) { if (f_status_is_error(status)) { return status; } - if (string[location->start] == f_utf_character_eol) return f_none_on_eol; + if (string[range->start] == f_utf_character_eol) return f_none_on_eol; - location->start++; + range->start++; - if (f_macro_utf_character_width_is(string[location->start]) == 1) { + if (f_macro_utf_character_width_is(string[range->start]) == 1) { return f_status_set_error(f_invalid_utf); } - if (location->start > location->stop) return f_none_on_stop; + if (range->start > range->stop) return f_none_on_stop; } // while if (f_status_is_error(status)) { @@ -862,33 +862,33 @@ extern "C" { #endif // _di_fl_utf_string_seek_line_until_graph_ #ifndef _di_fl_utf_string_seek_line_until_non_graph_ - f_return_status fl_utf_string_seek_line_until_non_graph(const f_utf_string string, f_utf_string_location *location, const f_utf_character placeholder) { + f_return_status fl_utf_string_seek_line_until_non_graph(const f_utf_string string, f_utf_string_location *range, const f_utf_character placeholder) { #ifndef _di_level_1_parameter_checking_ - if (location == 0) return f_status_set_error(f_invalid_parameter); + if (range == 0) return f_status_set_error(f_invalid_parameter); #endif // _di_level_1_parameter_checking_ - if (location->start > location->stop) return f_none_on_stop; + if (range->start > range->stop) return f_none_on_stop; f_status status = f_none; - if (f_macro_utf_character_width_is(string[location->start]) == 1) { + if (f_macro_utf_character_width_is(string[range->start]) == 1) { return f_status_set_error(f_invalid_utf); } - while (string[location->start] == placeholder || (status = f_utf_character_is_whitespace(string[location->start])) == f_false) { + while (string[range->start] == placeholder || (status = f_utf_character_is_whitespace(string[range->start])) == f_false) { if (f_status_is_error(status)) { return status; } - if (string[location->start] == f_utf_character_eol) return f_none_on_eol; + if (string[range->start] == f_utf_character_eol) return f_none_on_eol; - location->start++; + range->start++; - if (f_macro_utf_character_width_is(string[location->start]) == 1) { + if (f_macro_utf_character_width_is(string[range->start]) == 1) { return f_status_set_error(f_invalid_utf); } - if (location->start > location->stop) return f_none_on_stop; + if (range->start > range->stop) return f_none_on_stop; } // while if (f_status_is_error(status)) { @@ -900,25 +900,25 @@ extern "C" { #endif // _di_fl_utf_string_seek_line_until_non_graph_ #ifndef _di_fl_utf_string_seek_to_ - f_return_status fl_utf_string_seek_to(const f_utf_string string, f_utf_string_location *location, const f_utf_character seek_to_this) { + f_return_status fl_utf_string_seek_to(const f_utf_string string, f_utf_string_location *range, const f_utf_character seek_to_this) { #ifndef _di_level_1_parameter_checking_ - if (location == 0) return f_status_set_error(f_invalid_parameter); + if (range == 0) return f_status_set_error(f_invalid_parameter); #endif // _di_level_1_parameter_checking_ - if (location->start > location->stop) return f_none_on_stop; + if (range->start > range->stop) return f_none_on_stop; - if (f_macro_utf_character_width_is(string[location->start]) == 1) { + if (f_macro_utf_character_width_is(string[range->start]) == 1) { return f_status_set_error(f_invalid_utf); } - while (string[location->start] != seek_to_this) { - location->start++; + while (string[range->start] != seek_to_this) { + range->start++; - if (f_macro_utf_character_width_is(string[location->start]) == 1) { + if (f_macro_utf_character_width_is(string[range->start]) == 1) { return f_status_set_error(f_invalid_utf); } - if (location->start > location->stop) return f_none_on_stop; + if (range->start > range->stop) return f_none_on_stop; } // while return f_none; @@ -926,12 +926,12 @@ extern "C" { #endif // _di_fl_utf_string_seek_to_ #ifndef _di_fl_utf_string_seek_to_char_ - f_return_status fl_utf_string_seek_to_char(const f_utf_string string, f_utf_string_location *location, const int8_t seek_to_this) { + f_return_status fl_utf_string_seek_to_char(const f_utf_string string, f_utf_string_location *range, const int8_t seek_to_this) { #ifndef _di_level_1_parameter_checking_ - if (location == 0) return f_status_set_error(f_invalid_parameter); + if (range == 0) return f_status_set_error(f_invalid_parameter); #endif // _di_level_1_parameter_checking_ - if (location->start > location->stop) return f_none_on_stop; + if (range->start > range->stop) return f_none_on_stop; f_utf_character seek_to_character = seek_to_this << 24; @@ -941,12 +941,12 @@ extern "C" { return f_status_set_error(f_invalid_utf); } - while (location->start <= location->stop) { - if (string[location->start] == seek_to_character) return f_none; + while (range->start <= range->stop) { + if (string[range->start] == seek_to_character) return f_none; - location->start++; + range->start++; - if (f_macro_utf_character_width_is(string[location->start]) == 1) { + if (f_macro_utf_character_width_is(string[range->start]) == 1) { return f_status_set_error(f_invalid_utf); } } // while diff --git a/level_1/fl_utf/c/utf.h b/level_1/fl_utf/c/utf.h index 5e99cb0..de8d5bd 100644 --- a/level_1/fl_utf/c/utf.h +++ b/level_1/fl_utf/c/utf.h @@ -762,7 +762,7 @@ extern "C" { * * @param buffer * The buffer to traverse. - * @param location + * @param range * A range within the buffer representing the start and stop locations. * The start location will be incremented by seek. * @param seek_to_this @@ -780,7 +780,7 @@ extern "C" { * @see fl_utf_string_seek_line_to_char() */ #ifndef _di_fl_utf_string_dynamic_seek_line_to_ - extern f_return_status fl_utf_string_dynamic_seek_line_to(const f_utf_string_dynamic buffer, f_utf_string_location *location, const f_utf_character seek_to_this); + extern f_return_status fl_utf_string_dynamic_seek_line_to(const f_utf_string_dynamic buffer, f_utf_string_location *range, const f_utf_character seek_to_this); #endif // _di_fl_utf_string_dynamic_seek_line_to_ /** @@ -788,7 +788,7 @@ extern "C" { * * @param buffer * The buffer to traverse. - * @param location + * @param range * A range within the buffer representing the start and stop locations. * The start location will be incremented by seek. * @param seek_to_this @@ -805,7 +805,7 @@ extern "C" { * @see fl_utf_string_seek_line_to() */ #ifndef _di_fl_utf_string_seek_line_to_char_ - extern f_return_status fl_utf_string_dynamic_seek_line_to_char(const f_utf_string_dynamic buffer, f_utf_string_location *location, const int8_t seek_to_this); + extern f_return_status fl_utf_string_dynamic_seek_line_to_char(const f_utf_string_dynamic buffer, f_utf_string_location *range, const int8_t seek_to_this); #endif // _di_fl_utf_string_seek_line_to_char_ /** @@ -813,7 +813,7 @@ extern "C" { * * @param buffer * The buffer to traverse. - * @param location + * @param range * A range within the buffer representing the start and stop locations. * @param placeholder * A UTF-8 character representing a placeholder to ignore (may be NULL). @@ -828,7 +828,7 @@ extern "C" { * @see fl_utf_string_seek_line_until_graph() */ #ifndef _di_fl_utf_string_dynamic_seek_line_until_graph_ - extern f_return_status fl_utf_string_dynamic_seek_line_until_graph(const f_utf_string_dynamic buffer, f_utf_string_location *location, const f_utf_character placeholder); + extern f_return_status fl_utf_string_dynamic_seek_line_until_graph(const f_utf_string_dynamic buffer, f_utf_string_location *range, const f_utf_character placeholder); #endif // _di_fl_utf_string_dynamic_seek_line_until_graph_ /** @@ -836,7 +836,7 @@ extern "C" { * * @param buffer * The buffer to traverse. - * @param location + * @param range * A range within the buffer representing the start and stop locations. * @param placeholder * A single-width character representing a placeholder to ignore (may be NULL). @@ -852,7 +852,7 @@ extern "C" { * @see fl_utf_string_seek_line_until_non_graph() */ #ifndef _di_fl_utf_string_dynamic_seek_line_until_non_graph_ - extern f_return_status fl_utf_string_dynamic_seek_line_until_non_graph(const f_utf_string_dynamic buffer, f_utf_string_location *location, const f_utf_character placeholder); + extern f_return_status fl_utf_string_dynamic_seek_line_until_non_graph(const f_utf_string_dynamic buffer, f_utf_string_location *range, const f_utf_character placeholder); #endif // _di_fl_utf_string_dynamic_seek_line_until_non_graph_ /** @@ -860,7 +860,7 @@ extern "C" { * * @param buffer * The buffer to traverse. - * @param location + * @param range * A range within the buffer representing the start and stop locations. * The start location will be incremented by seek. * @param seek_to_this @@ -878,7 +878,7 @@ extern "C" { * @see fl_utf_string_seek_to_char() */ #ifndef _di_fl_utf_string_dynamic_seek_to_ - extern f_return_status fl_utf_string_dynamic_seek_to(const f_utf_string_dynamic buffer, f_utf_string_location *location, const f_utf_character seek_to_this); + extern f_return_status fl_utf_string_dynamic_seek_to(const f_utf_string_dynamic buffer, f_utf_string_location *range, const f_utf_character seek_to_this); #endif // _di_fl_utf_string_dynamic_seek_to_ /** @@ -886,7 +886,7 @@ extern "C" { * * @param buffer * The buffer to traverse. - * @param location + * @param range * A range within the buffer representing the start and stop locations. * The start location will be incremented by seek. * @param seek_to_this @@ -904,7 +904,7 @@ extern "C" { * @see fl_utf_string_seek_to_char() */ #ifndef _di_fl_utf_string_dynamic_seek_to_char_ - extern f_return_status fl_utf_string_dynamic_seek_to_char(const f_utf_string_dynamic buffer, f_utf_string_location *location, const int8_t seek_to_this); + extern f_return_status fl_utf_string_dynamic_seek_to_char(const f_utf_string_dynamic buffer, f_utf_string_location *range, const int8_t seek_to_this); #endif // _di_fl_utf_string_dynamic_seek_to_char_ /** @@ -912,7 +912,7 @@ extern "C" { * * @param buffer * The buffer to traverse. - * @param location + * @param range * A range within the buffer representing the start and stop locations. * The start location will be incremented by seek. * @param seek_to_this @@ -933,7 +933,7 @@ extern "C" { * @see fl_utf_string_seek_to_character() */ #ifndef _di_fl_utf_string_dynamic_seek_to_utf_character_ - extern f_return_status fl_utf_string_dynamic_seek_to_utf_character(const f_utf_string_dynamic buffer, f_utf_string_location *location, const f_utf_character seek_to_this); + extern f_return_status fl_utf_string_dynamic_seek_to_utf_character(const f_utf_string_dynamic buffer, f_utf_string_location *range, const f_utf_character seek_to_this); #endif // _di_fl_utf_string_dynamic_seek_to_utf_character_ /** @@ -1210,7 +1210,7 @@ extern "C" { * * @param string * The string to traverse. - * @param location + * @param range * A range within the buffer representing the start and stop locations. * The start location will be incremented by seek. * @param seek_to_this @@ -1227,7 +1227,7 @@ extern "C" { * @see fl_utf_string_seek_line_to_char() */ #ifndef _di_fl_utf_string_seek_line_to_ - extern f_return_status fl_utf_string_seek_line_to(const f_utf_string string, f_utf_string_location *location, const f_utf_character seek_to_this); + extern f_return_status fl_utf_string_seek_line_to(const f_utf_string string, f_utf_string_location *range, const f_utf_character seek_to_this); #endif // _di_fl_utf_string_seek_line_to_ /** @@ -1235,7 +1235,7 @@ extern "C" { * * @param string * The string to traverse. - * @param location + * @param range * A range within the buffer representing the start and stop locations. * The start location will be incremented by seek. * @param seek_to_this @@ -1251,7 +1251,7 @@ extern "C" { * @see fl_utf_string_seek_line_to() */ #ifndef _di_fl_utf_string_seek_line_to_char_ - extern f_return_status fl_utf_string_seek_line_to_char(const f_utf_string string, f_utf_string_location *location, const int8_t seek_to_this); + extern f_return_status fl_utf_string_seek_line_to_char(const f_utf_string string, f_utf_string_location *range, const int8_t seek_to_this); #endif // _di_fl_utf_string_seek_line_to_char_ /** @@ -1259,7 +1259,7 @@ extern "C" { * * @param string * The string to traverse. - * @param location + * @param range * A range within the buffer representing the start and stop locations. * The start location will be incremented by seek. * @param placeholder @@ -1278,7 +1278,7 @@ extern "C" { * @see fl_utf_string_dynamic_seek_line_until_graph() */ #ifndef _di_fl_utf_string_seek_line_until_graph_ - extern f_return_status fl_utf_string_seek_line_until_graph(const f_utf_string string, f_utf_string_location *location, const f_utf_character placeholder); + extern f_return_status fl_utf_string_seek_line_until_graph(const f_utf_string string, f_utf_string_location *range, const f_utf_character placeholder); #endif // _di_fl_utf_string_seek_line_until_graph_ /** @@ -1286,7 +1286,7 @@ extern "C" { * * @param string * The string to traverse. - * @param location + * @param range * A range within the buffer representing the start and stop locations. * The start location will be incremented by seek. * @param placeholder @@ -1306,7 +1306,7 @@ extern "C" { * @see fl_utf_string_dynamic_seek_line_until_non_graph() */ #ifndef _di_fl_utf_string_seek_line_until_non_graph_ - extern f_return_status fl_utf_string_seek_line_until_non_graph(const f_utf_string string, f_utf_string_location *location, const f_utf_character placeholder); + extern f_return_status fl_utf_string_seek_line_until_non_graph(const f_utf_string string, f_utf_string_location *range, const f_utf_character placeholder); #endif // _di_fl_utf_string_seek_line_until_non_graph_ /** @@ -1314,7 +1314,7 @@ extern "C" { * * @param string * The sting to traverse. - * @param location + * @param range * A range within the buffer representing the start and stop locations. * The start location will be incremented by seek. * @param seek_to_this @@ -1332,7 +1332,7 @@ extern "C" { * @see fl_utf_string_seek_to_char() */ #ifndef _di_fl_utf_string_seek_to_ - extern f_return_status fl_utf_string_seek_to(const f_utf_string string, f_utf_string_location *location, const f_utf_character seek_to_this); + extern f_return_status fl_utf_string_seek_to(const f_utf_string string, f_utf_string_location *range, const f_utf_character seek_to_this); #endif // _di_fl_utf_string_seek_to_ /** @@ -1340,7 +1340,7 @@ extern "C" { * * @param string * The string to traverse. - * @param location + * @param range * A range within the buffer representing the start and stop locations. * The start location will be incremented by seek. * @param seek_to_this @@ -1358,7 +1358,7 @@ extern "C" { * @see fl_utf_string_seek_to() */ #ifndef _di_fl_utf_string_seek_to_character_ - extern f_return_status fl_utf_string_seek_to_char(const f_utf_string string, f_utf_string_location *location, const int8_t seek_to_this); + extern f_return_status fl_utf_string_seek_to_char(const f_utf_string string, f_utf_string_location *range, const int8_t seek_to_this); #endif // _di_fl_utf_string__seek_to_character_ #ifdef __cplusplus