From f9f269624b948f19d00970d0fe30d89371129b9a Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Mon, 8 Jun 2020 18:29:15 -0500 Subject: [PATCH] Update: fl_serialized to f_serialize, renaming f_serialized to f_serialize There is nothing forcing the current functions in fl_serialized from being in f_serialize. Renamed f_serialized to f_serialize to be more consistent with the function names. To that end, I have renamed the functions like f_unserialize* to f_serialize_un. I have been unable to come up with a better name that is also reasonably short. --- build/level_0/settings | 4 +- build/level_1/settings | 4 +- build/monolithic/settings | 4 +- build/scripts/bootstrap-example.sh | 2 +- .../f_serialize/c/private-serialize.c | 20 ++--- level_0/f_serialize/c/private-serialize.h | 45 ++++++++++ .../f_serialize/c/serialize.c | 100 ++++++++++----------- .../f_serialize/c/serialize.h | 99 +++++++++++--------- .../data/build/defines | 0 .../f_serialize}/data/build/dependencies | 5 +- .../data/build/settings | 6 +- level_0/f_serialized/c/serialized.h | 45 ---------- level_0/f_serialized/data/build/dependencies | 3 - level_1/fl_serialized/c/private-serialized.h | 45 ---------- level_1/fl_serialized/data/build/defines | 2 - level_1/fl_serialized/data/build/settings | 52 ----------- level_3/fake/c/fake.h | 3 - 17 files changed, 174 insertions(+), 265 deletions(-) rename level_1/fl_serialized/c/private-serialized.c => level_0/f_serialize/c/private-serialize.c (56%) create mode 100644 level_0/f_serialize/c/private-serialize.h rename level_1/fl_serialized/c/serialized.c => level_0/f_serialize/c/serialize.c (55%) rename level_1/fl_serialized/c/serialized.h => level_0/f_serialize/c/serialize.h (58%) rename level_0/{f_serialized => f_serialize}/data/build/defines (100%) rename {level_1/fl_serialized => level_0/f_serialize}/data/build/dependencies (75%) rename level_0/{f_serialized => f_serialize}/data/build/settings (87%) delete mode 100644 level_0/f_serialized/c/serialized.h delete mode 100644 level_0/f_serialized/data/build/dependencies delete mode 100644 level_1/fl_serialized/c/private-serialized.h delete mode 100644 level_1/fl_serialized/data/build/defines delete mode 100644 level_1/fl_serialized/data/build/settings diff --git a/build/level_0/settings b/build/level_0/settings index 81f8794..df39f43 100644 --- a/build/level_0/settings +++ b/build/level_0/settings @@ -20,9 +20,9 @@ build_language c 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 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 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 serialized.h socket.h status.h status_array.h string.h type.h type_array.h utf.h +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_sources_setting build_script yes diff --git a/build/level_1/settings b/build/level_1/settings index 8010e03..097479e 100644 --- a/build/level_1/settings +++ b/build/level_1/settings @@ -20,9 +20,9 @@ build_language c 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 serialized.c private-serialized.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 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 serialized.h status.h string.h utf.h utf_file.h +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_sources_setting build_script yes diff --git a/build/monolithic/settings b/build/monolithic/settings index 1a16b71..9875047 100644 --- a/build/monolithic/settings +++ b/build/monolithic/settings @@ -20,9 +20,9 @@ build_language c 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/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/serialized.c level_1/private-serialized.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/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_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/serialized.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/serialized.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_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 build_sources_setting build_script yes diff --git a/build/scripts/bootstrap-example.sh b/build/scripts/bootstrap-example.sh index 8dc8e4a..0aebb33 100644 --- a/build/scripts/bootstrap-example.sh +++ b/build/scripts/bootstrap-example.sh @@ -23,7 +23,7 @@ if [[ $1 == "individual" ]] ; then bash build/scripts/package.sh build -i if [[ $? -eq 0 ]] ; then - for i in f_type f_status f_memory f_string f_utf f_color f_console f_conversion f_directory f_environment f_file f_fss f_path f_pipe f_print f_serialized f_socket fl_color fl_console fl_directory fl_fss fl_print fl_serialized fl_status fl_string fl_utf fl_utf_file fll_directory fll_execute fll_file fll_fss fll_program fll_status ; do + for i in f_type f_status f_memory f_string f_utf f_color f_console f_conversion f_directory f_environment f_file f_fss f_path f_pipe f_print f_serialize f_socket fl_color fl_console fl_directory fl_fss fl_print fl_status fl_string fl_utf fl_utf_file fll_directory fll_execute fll_file fll_fss fll_program fll_status ; do echo && echo "Processing $i." && cd package/individual/$i-$2/ && diff --git a/level_1/fl_serialized/c/private-serialized.c b/level_0/f_serialize/c/private-serialize.c similarity index 56% rename from level_1/fl_serialized/c/private-serialized.c rename to level_0/f_serialize/c/private-serialize.c index b9d5ac2..4e95015 100644 --- a/level_1/fl_serialized/c/private-serialized.c +++ b/level_0/f_serialize/c/private-serialize.c @@ -1,12 +1,12 @@ -#include -#include "private-serialized.h" +#include +#include "private-serialize.h" #ifdef __cplusplus extern "C" { #endif -#if !defined(_di_fl_unserialize_simple_find_) || !defined(_di_fl_unserialize_simple_get_) - f_return_status private_fl_unserialize_simple_find(const f_string_static serialized, const f_array_length index, f_string_range *location) { +#if !defined(_di_f_serialize_un_simple_find_) || !defined(_di_f_serialize_un_simple_get_) + f_return_status private_f_serialize_un_simple_find(const f_string_static serialize, const f_array_length index, f_string_range *location) { f_status status = F_none; f_array_length i = 0; @@ -15,10 +15,10 @@ extern "C" { unsigned short width = 0; - while (i < serialized.used) { - width = f_macro_utf_byte_width(serialized.string[i]); + while (i < serialize.used) { + width = f_macro_utf_byte_width(serialize.string[i]); - if (serialized.string[i] == f_serialized_simple_splitter) { + if (serialize.string[i] == f_serialize_simple_splitter) { if (current == index) { if (start == i) { // provide an invalid start to stop range to communicate that there is no data. @@ -36,7 +36,7 @@ extern "C" { start = i + width; current++; } - else if (i == serialized.used) { + else if (i == serialize.used) { if (current == index) { location->start = start; location->stop = i - 1; @@ -45,14 +45,14 @@ extern "C" { return F_none_eos; } - if (i + width > serialized.used) return F_status_set_error(F_incomplete_utf_eos); + if (i + width > serialize.used) return F_status_set_error(F_incomplete_utf_eos); i += width; } // while return F_data_not_eos; } -#endif // !defined(_di_fl_unserialize_simple_find_) || !defined(_di_fl_unserialize_simple_get_) +#endif // !defined(_di_f_serialize_un_simple_find_) || !defined(_di_f_serialize_un_simple_get_) #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_serialize/c/private-serialize.h b/level_0/f_serialize/c/private-serialize.h new file mode 100644 index 0000000..dbf038b --- /dev/null +++ b/level_0/f_serialize/c/private-serialize.h @@ -0,0 +1,45 @@ +/** + * FLL - Level 0 + * + * Project: Serialize + * 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_F_serialize_h +#define _PRIVATE_F_serialize_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Private implementation of f_serialize_un_simple_get(). + * + * Intended to be shared to each of the different implementation variations. + * + * @param serialize + * A serialize string to de-serialize. + * @param index + * An index position within the serialize string to get the deserialize positions of. + * @param location + * A location within the serialize string representing the string at the given index. + * + * @return + * F_none on success. + * F_none_eos on success at end of string. + * F_data_not_eos if end of string reached before index was reached. + * F_incomplete_utf_eos (with error bit) if end of string is reached before a complete UTF-8 character can be processed. + * F_parameter (with error bit) if a parameter is invalid. + */ +#if !defined(_di_f_serialize_un_simple_find_) || !defined(_di_f_serialize_un_simple_get_) + extern f_return_status private_f_serialize_un_simple_find(const f_string_static serialize, const f_array_length index, f_string_range *location) f_gcc_attribute_visibility_internal; +#endif // !defined(_di_f_serialize_un_simple_find_) || !defined(_di_f_serialize_un_simple_get_) + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _PRIVATE_F_serialize_h diff --git a/level_1/fl_serialized/c/serialized.c b/level_0/f_serialize/c/serialize.c similarity index 55% rename from level_1/fl_serialized/c/serialized.c rename to level_0/f_serialize/c/serialize.c index 9fd3733..9afea81 100644 --- a/level_1/fl_serialized/c/serialized.c +++ b/level_0/f_serialize/c/serialize.c @@ -1,41 +1,41 @@ -#include -#include "private-serialized.h" +#include +#include "private-serialize.h" #ifdef __cplusplus extern "C" { #endif -#ifndef _di_fl_serialize_simple_ - f_return_status fl_serialize_simple(const f_string_static value, f_string_dynamic *serialized) { +#ifndef _di_f_serialize_simple_ + f_return_status f_serialize_simple(const f_string_static value, f_string_dynamic *serialize) { #ifndef _di_level_0_parameter_checking_ - if (serialized == 0) return F_status_set_error(F_parameter); + if (serialize == 0) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ f_status status = F_none; - if (serialized->used + value.used + 1 >= serialized->size) { - f_macro_string_dynamic_resize(status, (*serialized), serialized->size + value.used + 1); + if (serialize->used + value.used + 1 >= serialize->size) { + f_macro_string_dynamic_resize(status, (*serialize), serialize->size + value.used + 1); if (F_status_is_error(status)) return status; } - if (serialized->used == 0) { - memcpy(serialized->string + serialized->used, value.string, value.used); - serialized->used += value.used; + if (serialize->used == 0) { + memcpy(serialize->string + serialize->used, value.string, value.used); + serialize->used += value.used; } else { - memcpy(serialized->string + serialized->used, f_serialized_simple_splitter_string, 1); - memcpy(serialized->string + serialized->used + 1, value.string, value.used); - serialized->used += value.used + 1; + memcpy(serialize->string + serialize->used, f_serialize_simple_splitter_string, 1); + memcpy(serialize->string + serialize->used + 1, value.string, value.used); + serialize->used += value.used + 1; } return F_none; } -#endif // _di_fl_serialize_simple_ +#endif // _di_f_serialize_simple_ -#ifndef _di_fl_unserialize_simple_ - f_return_status fl_unserialize_simple(const f_string_static serialized, f_string_dynamics *strings) { +#ifndef _di_f_serialize_un_simple_ + f_return_status f_serialize_un_simple(const f_string_static serialize, f_string_dynamics *strings) { #ifndef _di_level_0_parameter_checking_ - if (serialized.used == 0) return F_status_set_error(F_parameter); + if (serialize.used == 0) return F_status_set_error(F_parameter); if (strings == 0) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -46,12 +46,12 @@ extern "C" { uint8_t width = 0; - while (i < serialized.used) { - width = f_macro_utf_byte_width(serialized.string[i]); + while (i < serialize.used) { + width = f_macro_utf_byte_width(serialize.string[i]); - if (serialized.string[i] == f_serialized_simple_splitter || i + 1 >= serialized.used) { + if (serialize.string[i] == f_serialize_simple_splitter || i + 1 >= serialize.used) { if (strings->used >= strings->size) { - f_macro_string_dynamics_resize(status, (*strings), strings->size + f_serialized_default_allocation_step); + f_macro_string_dynamics_resize(status, (*strings), strings->size + f_serialize_default_allocation_step); if (F_status_is_error(status)) return status; } @@ -62,11 +62,11 @@ extern "C" { else { f_string_length total; - if (i + 1 >= serialized.used) { + if (i + 1 >= serialize.used) { total = (i - start) + 1; } else { - // subtract one from stop point to disclused the f_serialized_simple_splitter character. + // subtract one from stop point to disclused the f_serialize_simple_splitter character. total = ((i - 1) - start) + 1; } @@ -77,19 +77,19 @@ extern "C" { strings->array[strings->used].size = total; } - memcpy(strings->array[strings->used].string, serialized.string + start, total); + memcpy(strings->array[strings->used].string, serialize.string + start, total); strings->array[strings->used].used = total; strings->used++; } - if (i + width > serialized.used) { + if (i + width > serialize.used) { return F_status_set_error(F_incomplete_utf_eos); } start = i + width; } - else if (i + width > serialized.used) { + else if (i + width > serialize.used) { return F_status_set_error(F_incomplete_utf_eos); } @@ -98,12 +98,12 @@ extern "C" { return F_none; } -#endif // _di_fl_unserialize_simple_ +#endif // _di_f_serialize_un_simple_ -#ifndef _di_fl_unserialize_simple_map_ - f_return_status fl_unserialize_simple_map(const f_string_static serialized, f_string_ranges *locations) { +#ifndef _di_f_serialize_un_simple_map_ + f_return_status f_serialize_un_simple_map(const f_string_static serialize, f_string_ranges *locations) { #ifndef _di_level_0_parameter_checking_ - if (serialized.used == 0) return F_status_set_error(F_parameter); + if (serialize.used == 0) return F_status_set_error(F_parameter); if (locations == 0) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -114,12 +114,12 @@ extern "C" { uint8_t width = 0; - while (i < serialized.used) { - width = f_macro_utf_byte_width(serialized.string[i]); + while (i < serialize.used) { + width = f_macro_utf_byte_width(serialize.string[i]); - if (serialized.string[i] == f_serialized_simple_splitter || i + 1 >= serialized.used) { + if (serialize.string[i] == f_serialize_simple_splitter || i + 1 >= serialize.used) { if (locations->used >= locations->size) { - f_macro_string_ranges_resize(status, (*locations), locations->size + f_serialized_default_allocation_step); + f_macro_string_ranges_resize(status, (*locations), locations->size + f_serialize_default_allocation_step); if (F_status_is_error(status)) return status; } @@ -128,23 +128,23 @@ extern "C" { locations->array[locations->used].start = 1; locations->array[locations->used].stop = 0; } - else if (i + 1 >= serialized.used) { + else if (i + 1 >= serialize.used) { locations->array[locations->used].start = start; locations->array[locations->used].stop = i; } else { - // subtract one from stop point to disclused the f_serialized_simple_splitter character. + // subtract one from stop point to disclused the f_serialize_simple_splitter character. locations->array[locations->used].start = start; locations->array[locations->used].stop = i - 1; } locations->used++; - if (i + width > serialized.used) return F_status_set_error(F_incomplete_utf_eos); + if (i + width > serialize.used) return F_status_set_error(F_incomplete_utf_eos); start = i + width; } - else if (i + width > serialized.used) { + else if (i + width > serialize.used) { return F_status_set_error(F_incomplete_utf_eos); } @@ -153,29 +153,29 @@ extern "C" { return F_none; } -#endif // _di_fl_unserialize_simple_map_ +#endif // _di_f_serialize_un_simple_map_ -#ifndef _di_fl_unserialize_simple_find_ - f_return_status fl_unserialize_simple_find(const f_string_static serialized, const f_array_length index, f_string_range *range) { +#ifndef _di_f_serialize_un_simple_find_ + f_return_status f_serialize_un_simple_find(const f_string_static serialize, const f_array_length index, f_string_range *range) { #ifndef _di_level_0_parameter_checking_ - if (serialized.used == 0) return F_status_set_error(F_parameter); + if (serialize.used == 0) return F_status_set_error(F_parameter); if (range == 0) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - return private_fl_unserialize_simple_find(serialized, index, range); + return private_f_serialize_un_simple_find(serialize, index, range); } -#endif // _di_fl_unserialize_simple_find_ +#endif // _di_f_serialize_un_simple_find_ -#ifndef _di_fl_unserialize_simple_get_ - f_return_status fl_unserialize_simple_get(const f_string_static serialized, const f_array_length index, f_string_dynamic *dynamic) { +#ifndef _di_f_serialize_un_simple_get_ + f_return_status f_serialize_un_simple_get(const f_string_static serialize, const f_array_length index, f_string_dynamic *dynamic) { #ifndef _di_level_0_parameter_checking_ - if (serialized.used == 0) return F_status_set_error(F_parameter); + if (serialize.used == 0) return F_status_set_error(F_parameter); if (dynamic == 0) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ f_string_range range = f_string_range_initialize; - f_status status = private_fl_unserialize_simple_find(serialized, index, &range); + f_status status = private_f_serialize_un_simple_find(serialize, index, &range); if (F_status_is_error(status)) return status; if (status == F_data_not_eos) { @@ -192,12 +192,12 @@ extern "C" { if (F_status_is_error(status_allocation)) return status_allocation; } - memcpy(dynamic->string, serialized.string + range.start, total); + memcpy(dynamic->string, serialize.string + range.start, total); dynamic->used = total; return status; } -#endif // _di_fl_unserialize_simple_get_ +#endif // _di_f_serialize_un_simple_get_ #ifdef __cplusplus } // extern "C" diff --git a/level_1/fl_serialized/c/serialized.h b/level_0/f_serialize/c/serialize.h similarity index 58% rename from level_1/fl_serialized/c/serialized.h rename to level_0/f_serialize/c/serialize.h index 660425d..5d081da 100644 --- a/level_1/fl_serialized/c/serialized.h +++ b/level_0/f_serialize/c/serialize.h @@ -1,23 +1,23 @@ /** - * FLL - Level 1 + * FLL - Level 0 * - * Project: Serialized + * Project: Serialize * API Version: 0.5 * Licenses: lgplv2.1 * - * Provides string processing functionality for what is to be defined as a serialized string. + * Provides string processing functionality for what is to be defined as a serialize string. * Serialized strings are strings that can hold multiple values in a single variable. - * An example of serialized content is the PATH environment variable where ":" separates data. + * An example of serialize content is the PATH environment variable where ":" separates data. */ -#ifndef _FL_serialized_h -#define _FL_serialized_h +#ifndef _F_serialize_h +#define _F_serialize_h // libc includes #include // fll-0 includes #include -#include +#include #include #include #include @@ -26,6 +26,21 @@ extern "C" { #endif +#ifndef _di_f_serialize_splitters_ + #define f_serialize_simple_splitter ':' + #define f_serialize_delimited_splitter '\'' + #define f_serialize_delimited_delimiter '\\' + + #define f_serialize_simple_splitter_string ":" + #define f_serialize_delimited_splitter_string "'" + #define f_serialize_delimited_delimiter_string "\\" +#endif // _di_f_serialize_splitters_ + +#ifndef _di_f_serialize_default_allocation_step_ + // provide a UTF-8 friendly allocation step. + #define f_serialize_default_allocation_step 4 +#endif // _di_f_serialize_default_allocation_step_ + /** * Serialized a string using the Simple serialize algorithm. * @@ -37,21 +52,21 @@ extern "C" { * 3) value = "/usr/sbin", then: PATH="/bin:/sbin:/usr/sbin". * * @param value - * The string to append onto serialized. - * @param serialized - * The dynamic string that represents a serialized set of strings. + * The string to append onto serialize. + * @param serialize + * The dynamic string that represents a serialize set of strings. * * @return * F_none on success. * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. */ -#ifndef _di_fl_serialize_simple_ - extern f_return_status fl_serialize_simple(const f_string_static value, f_string_dynamic *serialized); -#endif // _di_fl_serialize_simple_ +#ifndef _di_f_serialize_simple_ + extern f_return_status f_serialize_simple(const f_string_static value, f_string_dynamic *serialize); +#endif // _di_f_serialize_simple_ /** - * De-serialized the entire serialized string into multiple separate strings using the Simple serialize algorithm. + * De-serialize the entire serialize string into multiple separate strings using the Simple serialize algorithm. * * The simple Serialize algorithm is akin to the PATH environment variable, example: PATH="/bin:/sbin:/usr/bin". * @@ -60,10 +75,10 @@ extern "C" { * 2) start = 5, stop = 9. * 3) start = 11, stop = 18. * - * @param serialized - * A serialized string to de-serialize. + * @param serialize + * A serialize string to de-serialize. * @param strings - * An array of strings de-serialized from serialized. + * An array of strings de-serialize from serialize. * * @return * F_none on success. @@ -71,12 +86,12 @@ extern "C" { * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. */ -#ifndef _di_fl_unserialize_simple_ - extern f_return_status fl_unserialize_simple(const f_string_static serialized, f_string_dynamics *strings); -#endif // _di_fl_unserialize_simple_ +#ifndef _di_f_serialize_un_simple_ + extern f_return_status f_serialize_un_simple(const f_string_static serialize, f_string_dynamics *strings); +#endif // _di_f_serialize_un_simple_ /** - * Identify string positions within a serialized string using the Simple serialize algorithm. + * Identify string positions within a serialize string using the Simple serialize algorithm. * * The simple Serialize algorithm is akin to the PATH environment variable, example: PATH="/bin:/sbin:/usr/bin". * @@ -85,10 +100,10 @@ extern "C" { * 2) start = 5, stop = 9. * 3) start = 11, stop = 18. * - * @param serialized - * A serialized string to de-serialize. + * @param serialize + * A serialize string to de-serialize. * @param locations - * The locations within the serialized string representing distinct separate strings. + * The locations within the serialize string representing distinct separate strings. * * @return * F_none on success. @@ -96,9 +111,9 @@ extern "C" { * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. */ -#ifndef _di_fl_unserialize_simple_map_ - extern f_return_status fl_unserialize_simple_map(const f_string_static serialized, f_string_ranges *locations); -#endif // _di_fl_unserialize_simple_map_ +#ifndef _di_f_serialize_un_simple_map_ + extern f_return_status f_serialize_un_simple_map(const f_string_static serialize, f_string_ranges *locations); +#endif // _di_f_serialize_un_simple_map_ /** * Unserialize and find the address for a specific string using the Simple serialize algorithm. @@ -110,12 +125,12 @@ extern "C" { * 2) with index = 1, start = 5, stop = 9. * 3) with index = 2, start = 11, stop = 18. * - * @param serialized - * A serialized string to de-serialize. + * @param serialize + * A serialize string to de-serialize. * @param index - * An index position within the serialized string to get the deserialized positions of. + * An index position within the serialize string to get the deserialize positions of. * @param location - * A location within the serialized string representing the string at the given index. + * A location within the serialize string representing the string at the given index. * * @return * F_none on success. @@ -124,9 +139,9 @@ extern "C" { * F_incomplete_utf_eos (with error bit) if end of string is reached before a complete UTF-8 character can be processed. * F_parameter (with error bit) if a parameter is invalid. */ -#ifndef _di_fl_unserialize_simple_find_ - extern f_return_status fl_unserialize_simple_find(const f_string_static serialized, const f_array_length index, f_string_range *location); -#endif // _di_fl_unserialize_simple_find_ +#ifndef _di_f_serialize_un_simple_find_ + extern f_return_status f_serialize_un_simple_find(const f_string_static serialize, const f_array_length index, f_string_range *location); +#endif // _di_f_serialize_un_simple_find_ /** * Unserialize and get a copy of a specific string using the Simple serialize algorithm. @@ -138,12 +153,12 @@ extern "C" { * 2) with index = 1, start = 5, stop = 9. * 3) with index = 2, start = 11, stop = 18. * - * @param serialized - * A serialized string to de-serialize. + * @param serialize + * A serialize string to de-serialize. * @param index - * An index position within the serialized string to get the deserialized positions of. + * An index position within the serialize string to get the deserialize positions of. * @param dynamic - * The unserialized string from the specified index. + * The unserialize string from the specified index. * * @return * F_none on success. @@ -153,12 +168,12 @@ extern "C" { * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. */ -#ifndef _di_fl_unserialize_simple_get_ - extern f_return_status fl_unserialize_simple_get(const f_string_static serialized, const f_array_length index, f_string_dynamic *dynamic); -#endif // _di_fl_unserialize_simple_get_ +#ifndef _di_f_serialize_un_simple_get_ + extern f_return_status f_serialize_un_simple_get(const f_string_static serialize, const f_array_length index, f_string_dynamic *dynamic); +#endif // _di_f_serialize_un_simple_get_ #ifdef __cplusplus } // extern "C" #endif -#endif // _FL_serialized_h +#endif // _F_serialize_h diff --git a/level_0/f_serialized/data/build/defines b/level_0/f_serialize/data/build/defines similarity index 100% rename from level_0/f_serialized/data/build/defines rename to level_0/f_serialize/data/build/defines diff --git a/level_1/fl_serialized/data/build/dependencies b/level_0/f_serialize/data/build/dependencies similarity index 75% rename from level_1/fl_serialized/data/build/dependencies rename to level_0/f_serialize/data/build/dependencies index 4b5018d..e783f2d 100644 --- a/level_1/fl_serialized/data/build/dependencies +++ b/level_0/f_serialize/data/build/dependencies @@ -1,6 +1,5 @@ -f_type -f_status f_memory +f_status f_string -f_serialized +f_type f_utf diff --git a/level_0/f_serialized/data/build/settings b/level_0/f_serialize/data/build/settings similarity index 87% rename from level_0/f_serialized/data/build/settings rename to level_0/f_serialize/data/build/settings index a2e00be..d779b3e 100644 --- a/level_0/f_serialized/data/build/settings +++ b/level_0/f_serialize/data/build/settings @@ -1,6 +1,6 @@ # fss-0001 -project_name f_serialized +project_name f_serialize version_major 0 version_minor 5 @@ -20,9 +20,9 @@ build_language c build_linker ar build_libraries -lc build_libraries-individual -lf_memory -build_sources_library +build_sources_library serialize.c private-serialize.c build_sources_program -build_sources_headers serialized.h +build_sources_headers serialize.h build_sources_script build_sources_setting build_script yes diff --git a/level_0/f_serialized/c/serialized.h b/level_0/f_serialized/c/serialized.h deleted file mode 100644 index a3cbe6a..0000000 --- a/level_0/f_serialized/c/serialized.h +++ /dev/null @@ -1,45 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Serialized - * API Version: 0.5 - * Licenses: lgplv2.1 - * - * Provides string processing functionality for what is to be defined as a serialized string. - * Serialized strings are strings that can hold multiple values in a single variable. - * An example of serialized content is the PATH environment variable where ":" separates data. - */ -#ifndef _F_serialized_h -#define _F_serialized_h - -// libc includes -#include - -// fll-0 includes -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _di_f_serialized_splitters_ - #define f_serialized_simple_splitter ':' - #define f_serialized_delimited_splitter '\'' - #define f_serialized_delimited_delimiter '\\' - - #define f_serialized_simple_splitter_string ":" - #define f_serialized_delimited_splitter_string "'" - #define f_serialized_delimited_delimiter_string "\\" -#endif // _di_f_serialized_splitters_ - -#ifndef _di_f_serialized_default_allocation_step_ - // provide a UTF-8 friendly allocation step. - #define f_serialized_default_allocation_step 4 -#endif // _di_f_serialized_default_allocation_step_ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _F_serialized_h diff --git a/level_0/f_serialized/data/build/dependencies b/level_0/f_serialized/data/build/dependencies deleted file mode 100644 index 9a8639a..0000000 --- a/level_0/f_serialized/data/build/dependencies +++ /dev/null @@ -1,3 +0,0 @@ -f_type -f_memory -f_string diff --git a/level_1/fl_serialized/c/private-serialized.h b/level_1/fl_serialized/c/private-serialized.h deleted file mode 100644 index 71f8d26..0000000 --- a/level_1/fl_serialized/c/private-serialized.h +++ /dev/null @@ -1,45 +0,0 @@ -/** - * FLL - Level 1 - * - * Project: Serialized - * 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_serialized_h -#define _PRIVATE_FL_serialized_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Private implementation of fl_unserialize_simple_get(). - * - * Intended to be shared to each of the different implementation variations. - * - * @param serialized - * A serialized string to de-serialize. - * @param index - * An index position within the serialized string to get the deserialized positions of. - * @param location - * A location within the serialized string representing the string at the given index. - * - * @return - * F_none on success. - * F_none_eos on success at end of string. - * F_data_not_eos if end of string reached before index was reached. - * F_incomplete_utf_eos (with error bit) if end of string is reached before a complete UTF-8 character can be processed. - * F_parameter (with error bit) if a parameter is invalid. - */ -#if !defined(_di_fl_unserialize_simple_find_) || !defined(_di_fl_unserialize_simple_get_) - extern f_return_status private_fl_unserialize_simple_find(const f_string_static serialized, const f_array_length index, f_string_range *location) f_gcc_attribute_visibility_internal; -#endif // !defined(_di_fl_unserialize_simple_find_) || !defined(_di_fl_unserialize_simple_get_) - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_FL_serialized_h diff --git a/level_1/fl_serialized/data/build/defines b/level_1/fl_serialized/data/build/defines deleted file mode 100644 index c665317..0000000 --- a/level_1/fl_serialized/data/build/defines +++ /dev/null @@ -1,2 +0,0 @@ -# fss-0000 - diff --git a/level_1/fl_serialized/data/build/settings b/level_1/fl_serialized/data/build/settings deleted file mode 100644 index a18cd1a..0000000 --- a/level_1/fl_serialized/data/build/settings +++ /dev/null @@ -1,52 +0,0 @@ -# fss-0001 - -project_name fl_serialized - -version_major 0 -version_minor 5 -version_micro 0 -version_target major - -environment - -process_pre -process_post - -modes individual -modes_default individual - -build_compiler gcc -build_language c -build_linker ar -build_libraries -lc -build_libraries-individual -lf_utf -lf_memory -build_sources_library serialized.c private-serialized.c -build_sources_program -build_sources_headers serialized.h -build_sources_script -build_sources_setting -build_script yes -build_shared yes -build_static yes - -path_headers level_1 -path_library_script script -path_library_shared shared -path_library_static static -path_program_script script -path_program_shared shared -path_program_static static - -search_exclusive yes -search_shared yes -search_static yes - -defines_all -defines_static -defines_shared - -flags_all -z now -g -flags_shared -flags_static -flags_library -fPIC -flags_program -fPIE diff --git a/level_3/fake/c/fake.h b/level_3/fake/c/fake.h index 3e549f8..9bf9e32 100644 --- a/level_3/fake/c/fake.h +++ b/level_3/fake/c/fake.h @@ -72,9 +72,6 @@ #include #include -// Temporary include, remove this. -#include - #ifdef __cplusplus extern "C" { #endif -- 1.8.3.1