Some of the append functions use *_adjust() functions and are now using *_resize() functions.
The f_string_dynamicss_t and similar structures are added.
This is done hastily with the expectation that I will get to writing unit tests eventually and will better review this code.
#endif // _di_f_fss_quote_type_
/**
- * Designate an fss quote.
+ * A number representing a quote type fom the FSS quote type enumeration.
*/
#ifndef _di_f_fss_quote_t_
typedef uint8_t f_fss_quote_t;
/**
* An array of f_fss_quotes_t.
*
- * array: The array of fss quotes.
+ * array: The array of an array of fss quote.
* size: Total amount of allocated space.
* used: Total number of allocated spaces used.
*/
}
}
- return status;
+ if (F_status_is_error(status)) return status;
+
+ return F_none;
}
#endif // !defined(_di_f_fss_items_adjust_) || !defined(_di_f_fss_items_decimate_by_)
}
}
- return status;
+ if (F_status_is_error(status)) return status;
+
+ return F_none;
}
#endif // !defined(_di_f_fss_items_decrease_by_) || !defined(_di_f_fss_items_increase_) || !defined(_di_f_fss_items_increase_by_) || !defined(_di_f_fss_items_resize_)
if (F_status_is_error(status)) return status;
macro_f_uint8ss_t_adjust(status, named->quotess, length)
+ if (F_status_is_error(status)) return status;
- return status;
+ return F_none;
}
#endif // !defined(_di_f_fss_nameds_adjust_) || !defined(_di_f_fss_nameds_decimate_by_)
if (F_status_is_error(status)) return status;
macro_f_uint8ss_t_resize(status, named->quotess, length)
+ if (F_status_is_error(status)) return status;
- return status;
+ return F_none;
}
#endif // !defined(_di_f_fss_nameds_decrease_by_) || !defined(_di_f_fss_nameds_increase_) || !defined(_di_f_fss_nameds_increase_by_) || !defined(_di_f_fss_nameds_resize_)
}
}
- return status;
+ if (F_status_is_error(status)) return status;
+
+ return F_none;
}
#endif // !defined(_di_f_fss_nameds_adjust_) || !defined(_di_f_fss_nameds_decimate_by_)
}
}
- return status;
+ if (F_status_is_error(status)) return status;
+
+ return F_none;
}
#endif // !defined(_di_f_fss_nameds_decrease_by_) || !defined(_di_f_fss_nameds_increase_) || !defined(_di_f_fss_nameds_increase_by_) || !defined(_di_f_fss_nameds_resize_)
}
}
- return status;
+ if (F_status_is_error(status)) return status;
+
+ return F_none;
}
#endif // !defined(_di_f_fss_nest_adjust_) || !defined(_di_f_fss_nest_decimate_by_)
}
}
- return status;
+ if (F_status_is_error(status)) return status;
+
+ return F_none;
}
#endif // !defined(_di_f_fss_nest_decrease_by_) || !defined(_di_f_fss_nest_increase_) || !defined(_di_f_fss_nest_increase_by_) || !defined(_di_f_fss_nest_resize_)
}
}
- return status;
+ if (F_status_is_error(status)) return status;
+
+ return F_none;
}
#endif // !defined(_di_f_fss_nests_adjust_) || !defined(_di_f_fss_nests_decimate_by_)
}
}
- return status;
+ if (F_status_is_error(status)) return status;
+
+ return F_none;
}
#endif // !defined(_di_f_fss_nests_decrease_by_) || !defined(_di_f_fss_nests_increase_) || !defined(_di_f_fss_nests_increase_by_) || !defined(_di_f_fss_nests_resize_)
if (F_status_is_error(status)) return status;
macro_f_fss_contents_t_adjust(status, set->contents, length);
+ if (F_status_is_error(status)) return status;
- return status;
+ return F_none;
}
#endif // !defined(_di_f_fss_set_adjust_) || !defined(_di_f_fss_set_decimate_by_)
if (F_status_is_error(status)) return status;
macro_f_fss_contents_t_resize(status, set->contents, length);
+ if (F_status_is_error(status)) return status;
- return status;
+ return F_none;
}
#endif // !defined(_di_f_fss_set_decrease_by_) || !defined(_di_f_fss_set_increase_) || !defined(_di_f_fss_set_increase_by_) || !defined(_di_f_fss_set_resize_)
if (F_status_is_error(status)) return status;
macro_f_fss_quotess_t_adjust(status, set_quote->contents_quote, length);
+ if (F_status_is_error(status)) return status;
- return status;
+ return F_none;
}
#endif // !defined(_di_f_fss_set_quote_adjust_) || !defined(_di_f_fss_set_quote_decimate_by_)
if (F_status_is_error(status)) return status;
macro_f_fss_quotess_t_resize(status, set_quote->contents_quote, length);
+ if (F_status_is_error(status)) return status;
- return status;
+ return F_none;
}
#endif // !defined(_di_f_fss_set_quote_decrease_by_) || !defined(_di_f_fss_set_quote_increase_) || !defined(_di_f_fss_set_quote_increase_by_) || !defined(_di_f_fss_set_quote_resize_)
}
}
- return status;
+ if (F_status_is_error(status)) return status;
+
+ return F_none;
}
#endif // !defined(_di_f_fss_set_quotes_adjust_) || !defined(_di_f_fss_set_quotes_decimate_by_)
}
}
- return status;
+ if (F_status_is_error(status)) return status;
+
+ return F_none;
}
#endif // !defined(_di_f_fss_set_quotes_decrease_by_) || !defined(_di_f_fss_set_quotes_increase_) || !defined(_di_f_fss_set_quotes_increase_by_) || !defined(_di_f_fss_set_quotes_resize_)
}
}
- return status;
+ if (F_status_is_error(status)) return status;
+
+ return F_none;
}
#endif // !defined(_di_f_fss_sets_adjust_) || !defined(_di_f_fss_sets_decimate_by_)
}
}
- return status;
+ if (F_status_is_error(status)) return status;
+
+ return F_none;
}
#endif // !defined(_di_f_fss_sets_decrease_by_) || !defined(_di_f_fss_sets_increase_) || !defined(_di_f_fss_sets_increase_by_) || !defined(_di_f_fss_sets_resize_)
f_status_t status = F_none;
if (destination->used + source.used > destination->size) {
- status = private_f_string_dynamics_adjust(destination->used + source.used, destination);
+ status = private_f_string_dynamics_resize(destination->used + source.used, destination);
if (F_status_is_error(status)) return status;
}
}
#endif // !defined(_di_f_string_dynamics_decrease_by_) || !defined(_di_f_string_dynamics_increase_) || !defined(_di_f_string_dynamics_increase_by_)
+#if !defined(_di_f_string_dynamicss_adjust_) || !defined(_di_f_string_dynamicss_append_) || !defined(_di_f_string_dynamicss_decimate_by_) || !defined(_di_f_string_map_multis_adjust_) || !defined(_di_f_string_map_multis_append_)
+ f_status_t private_f_string_dynamicss_adjust(const f_array_length_t length, f_string_dynamicss_t * const dynamicss) {
+
+ if (dynamicss->used + length > F_array_length_t_size_d) {
+ return F_status_set_error(F_array_too_large);
+ }
+
+ f_status_t status = F_none;
+
+ for (f_array_length_t i = length; i < dynamicss->size; ++i) {
+
+ status = private_f_string_dynamics_adjust(0, &dynamicss->array[i]);
+ if (F_status_is_error(status)) return status;
+ } // for
+
+ status = f_memory_adjust(dynamicss->size, length, sizeof(f_string_dynamics_t), (void **) & dynamicss->array);
+
+ if (F_status_is_error_not(status)) {
+ dynamicss->size = length;
+
+ if (dynamicss->used > dynamicss->size) {
+ dynamicss->used = length;
+ }
+ }
+
+ return status;
+ }
+#endif // !defined(_di_f_string_dynamicss_adjust_) || !defined(_di_f_string_dynamicss_append_) || !defined(_di_f_string_dynamicss_decimate_by_) || !defined(_di_f_string_map_multis_adjust_) || !defined(_di_f_string_map_multis_append_)
+
+#if !defined(_di_f_string_dynamicss_append_) || !defined(_di_f_string_map_multis_append_)
+ f_status_t private_f_string_dynamicss_append(const f_string_dynamicss_t source, f_string_dynamicss_t *destination) {
+
+ f_status_t status = F_none;
+
+ if (destination->used + source.used > destination->size) {
+ status = private_f_string_dynamicss_resize(destination->used + source.used, destination);
+ if (F_status_is_error(status)) return status;
+ }
+
+ for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) {
+
+ destination->array[destination->used].used = 0;
+
+ if (source.array[i].used) {
+ status = private_f_string_dynamics_append(source.array[i], &destination->array[destination->used]);
+ if (F_status_is_error(status)) return status;
+ }
+ } // for
+
+ return F_none;
+ }
+#endif // !defined(_di_f_string_dynamicss_append_) || !defined(_di_f_string_map_multis_append_)
+
+#if !defined(_di_f_string_dynamicss_decrease_by_) || !defined(_di_f_string_dynamicss_increase_) || !defined(_di_f_string_dynamicss_increase_by_)
+ f_status_t private_f_string_dynamicss_resize(const f_array_length_t length, f_string_dynamicss_t * const dynamicss) {
+
+ if (dynamicss->used + length > F_array_length_t_size_d) {
+ return F_status_set_error(F_array_too_large);
+ }
+
+ f_status_t status = F_none;
+
+ for (f_array_length_t i = length; i < dynamicss->size; ++i) {
+
+ status = private_f_string_dynamics_resize(0, &dynamicss->array[i]);
+ if (F_status_is_error(status)) return status;
+ } // for
+
+ status = f_memory_resize(dynamicss->size, length, sizeof(f_string_dynamics_t), (void **) & dynamicss->array);
+
+ if (F_status_is_error_not(status)) {
+ dynamicss->size = length;
+
+ if (dynamicss->used > dynamicss->size) {
+ dynamicss->used = length;
+ }
+ }
+
+ return status;
+ }
+#endif // !defined(_di_f_string_dynamicss_decrease_by_) || !defined(_di_f_string_dynamicss_increase_) || !defined(_di_f_string_dynamicss_increase_by_)
+
#if !defined(_di_f_string_map_multis_adjust_) || !defined(_di_f_string_map_multis_decimate_by_)
f_status_t private_f_string_map_multis_adjust(const f_array_length_t length, f_string_map_multis_t *map_multis) {
}
#endif // !defined(_di_f_string_map_multis_adjust_) || !defined(_di_f_string_map_multis_decimate_by_)
+#if !defined(_di_f_string_map_multiss_append_) || !defined(_di_f_string_map_multis_append_)
+ f_status_t private_f_string_map_multis_append(const f_string_map_multis_t source, f_string_map_multis_t *destination) {
+
+ f_status_t status = F_none;
+
+ if (destination->used + source.used > destination->size) {
+ status = private_f_string_map_multis_resize(destination->used + source.used, destination);
+ if (F_status_is_error(status)) return status;
+ }
+
+ for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) {
+
+ destination->array[destination->used].name.used = 0;
+ destination->array[destination->used].value.used = 0;
+
+ if (source.array[i].name.used) {
+ status = private_f_string_append(source.array[i].name.string, source.array[i].name.used, &destination->array[destination->used].name);
+ if (F_status_is_error(status)) return status;
+ }
+
+ if (source.array[i].value.used) {
+ status = private_f_string_dynamics_append(source.array[i].value, &destination->array[destination->used].value);
+ if (F_status_is_error(status)) return status;
+ }
+ } // for
+
+ return F_none;
+ }
+#endif // !defined(_di_f_string_map_multiss_append_) || !defined(_di_f_string_map_multis_append_)
+
#if !defined(_di_f_string_map_multis_decrease_by_) || !defined(_di_f_string_map_multis_increase_) || !defined(_di_f_string_map_multis_increase_by_) || !defined(_di_f_string_map_multis_terminate_) || !defined(_di_f_string_map_multis_terminate_after_)
f_status_t private_f_string_map_multis_resize(const f_array_length_t length, f_string_map_multis_t *map_multis) {
}
#endif // !defined(_di_f_string_map_multis_decrease_by_) || !defined(_di_f_string_map_multis_increase_) || !defined(_di_f_string_map_multis_increase_by_) || !defined(_di_f_string_map_multis_terminate_) || !defined(_di_f_string_map_multis_terminate_after_)
+#if !defined(_di_f_string_map_multiss_adjust_) || !defined(_di_f_string_map_multiss_decimate_by_)
+ f_status_t private_f_string_map_multiss_adjust(const f_array_length_t length, f_string_map_multiss_t *map_multiss) {
+
+ if (map_multiss->used + length > F_array_length_t_size_d) {
+ return F_status_set_error(F_array_too_large);
+ }
+
+ f_status_t status = F_none;
+
+ for (f_array_length_t i = length; i < map_multiss->size; ++i) {
+
+ status = private_f_string_map_multis_adjust(0, &map_multiss->array[i]);
+ if (F_status_is_error(status)) return status;
+ } // for
+
+ status = f_memory_adjust(map_multiss->size, length, sizeof(f_string_map_multis_t), (void **) & map_multiss->array);
+
+ if (F_status_is_error_not(status)) {
+ map_multiss->size = length;
+
+ if (map_multiss->used > map_multiss->size) {
+ map_multiss->used = length;
+ }
+ }
+
+ return status;
+ }
+#endif // !defined(_di_f_string_map_multiss_adjust_) || !defined(_di_f_string_map_multiss_decimate_by_)
+
+#if !defined(_di_f_string_map_multiss_decrease_by_) || !defined(_di_f_string_map_multiss_increase_) || !defined(_di_f_string_map_multiss_increase_by_) || !defined(_di_f_string_map_multiss_terminate_) || !defined(_di_f_string_map_multiss_terminate_after_)
+ f_status_t private_f_string_map_multiss_resize(const f_array_length_t length, f_string_map_multiss_t *map_multiss) {
+
+ if (map_multiss->used + length > F_array_length_t_size_d) {
+ return F_status_set_error(F_array_too_large);
+ }
+
+ f_status_t status = F_none;
+
+ for (f_array_length_t i = length; i < map_multiss->size; ++i) {
+
+ status = private_f_string_map_multis_resize(0, &map_multiss->array[i]);
+ if (F_status_is_error(status)) return status;
+ } // for
+
+ status = f_memory_resize(map_multiss->size, length, sizeof(f_string_map_multis_t), (void **) & map_multiss->array);
+
+ if (F_status_is_error_not(status)) {
+ map_multiss->size = length;
+
+ if (map_multiss->used > map_multiss->size) {
+ map_multiss->used = length;
+ }
+ }
+
+ return status;
+ }
+#endif // !defined(_di_f_string_map_multiss_decrease_by_) || !defined(_di_f_string_map_multiss_increase_) || !defined(_di_f_string_map_multiss_increase_by_) || !defined(_di_f_string_map_multiss_terminate_) || !defined(_di_f_string_map_multiss_terminate_after_)
+
#if !defined(_di_f_string_maps_adjust_) || !defined(_di_f_string_maps_decimate_by_)
f_status_t private_f_string_maps_adjust(const f_array_length_t length, f_string_maps_t *maps) {
}
#endif // !defined(_di_f_string_maps_adjust_) || !defined(_di_f_string_maps_decimate_by_)
+#if !defined(_di_f_string_mapss_append_) || !defined(_di_f_string_maps_append_)
+ f_status_t private_f_string_maps_append(const f_string_maps_t source, f_string_maps_t *destination) {
+
+ f_status_t status = F_none;
+
+ if (destination->used + source.used > destination->size) {
+ status = private_f_string_maps_resize(destination->used + source.used, destination);
+ if (F_status_is_error(status)) return status;
+ }
+
+ for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) {
+
+ destination->array[destination->used].name.used = 0;
+ destination->array[destination->used].value.used = 0;
+
+ if (source.array[i].name.used) {
+ status = private_f_string_append(source.array[i].name.string, source.array[i].name.used, &destination->array[destination->used].name);
+ if (F_status_is_error(status)) return status;
+ }
+
+ if (source.array[i].value.used) {
+ status = private_f_string_append(source.array[i].value.string, source.array[i].value.used, &destination->array[destination->used].value);
+ if (F_status_is_error(status)) return status;
+ }
+ } // for
+
+ return F_none;
+ }
+#endif // !defined(_di_f_string_mapss_append_) || !defined(_di_f_string_maps_append_)
+
#if !defined(_di_f_string_maps_decrease_by_) || !defined(_di_f_string_maps_increase_) || !defined(_di_f_string_maps_increase_by_) || !defined(_di_f_string_maps_terminate_) || !defined(_di_f_string_maps_terminate_after_)
f_status_t private_f_string_maps_resize(const f_array_length_t length, f_string_maps_t *maps) {
}
#endif // !defined(_di_f_string_maps_decrease_by_) || !defined(_di_f_string_maps_increase_) || !defined(_di_f_string_maps_increase_by_) || !defined(_di_f_string_maps_terminate_) || !defined(_di_f_string_maps_terminate_after_)
+#if !defined(_di_f_string_mapss_adjust_) || !defined(_di_f_string_mapss_decimate_by_)
+ f_status_t private_f_string_mapss_adjust(const f_array_length_t length, f_string_mapss_t *mapss) {
+
+ if (mapss->used + length > F_array_length_t_size_d) {
+ return F_status_set_error(F_array_too_large);
+ }
+
+ f_status_t status = F_none;
+
+ for (f_array_length_t i = length; i < mapss->size; ++i) {
+
+ status = private_f_string_maps_adjust(0, &mapss->array[i]);
+ if (F_status_is_error(status)) return status;
+ } // for
+
+ status = f_memory_adjust(mapss->size, length, sizeof(f_string_maps_t), (void **) & mapss->array);
+
+ if (F_status_is_error_not(status)) {
+ mapss->size = length;
+
+ if (mapss->used > mapss->size) {
+ mapss->used = length;
+ }
+ }
+
+ return status;
+ }
+#endif // !defined(_di_f_string_mapss_adjust_) || !defined(_di_f_string_mapss_decimate_by_)
+
+#if !defined(_di_f_string_mapss_decrease_by_) || !defined(_di_f_string_mapss_increase_) || !defined(_di_f_string_mapss_increase_by_) || !defined(_di_f_string_mapss_terminate_) || !defined(_di_f_string_mapss_terminate_after_)
+ f_status_t private_f_string_mapss_resize(const f_array_length_t length, f_string_mapss_t *mapss) {
+
+ if (mapss->used + length > F_array_length_t_size_d) {
+ return F_status_set_error(F_array_too_large);
+ }
+
+ f_status_t status = F_none;
+
+ for (f_array_length_t i = length; i < mapss->size; ++i) {
+
+ status = private_f_string_maps_resize(0, &mapss->array[i]);
+ if (F_status_is_error(status)) return status;
+ } // for
+
+ status = f_memory_resize(mapss->size, length, sizeof(f_string_maps_t), (void **) & mapss->array);
+
+ if (F_status_is_error_not(status)) {
+ mapss->size = length;
+
+ if (mapss->used > mapss->size) {
+ mapss->used = length;
+ }
+ }
+
+ return status;
+ }
+#endif // !defined(_di_f_string_mapss_decrease_by_) || !defined(_di_f_string_mapss_increase_) || !defined(_di_f_string_mapss_increase_by_) || !defined(_di_f_string_mapss_terminate_) || !defined(_di_f_string_mapss_terminate_after_)
+
#if !defined(_di_f_string_dynamic_mish_) || !defined(_di_f_string_dynamic_partial_mish_) || !defined(_di_f_string_dynamic_partial_prepend_assure_) || !defined(_di_f_string_dynamic_partial_prepend_) || !defined(_di_f_string_dynamic_prepend_assure_) || !defined(_di_f_string_dynamic_prepend_) || !defined(_di_f_string_mish_) || !defined(_di_f_string_prepend_assure_) || !defined(_di_f_string_prepend_)
f_status_t private_f_string_prepend(const f_string_t source, const f_array_length_t length, f_string_dynamic_t * const destination) {
*
* F_array_too_large (with error bit) if the combined array is too large.
*
- * Errors (with error bit) from: f_memory_adjust().
+ * Errors (with error bit) from: f_memory_resize().
*
+ * @see f_memory_resize()
* @see f_string_dynamics_append()
* @see f_string_map_multis_append()
*/
*
* @param length
* The new size to use.
+ * @param dynamicss
+ * The strings to adjust.
+ *
+ * @return
+ * F_none on success.
+ *
+ * F_array_too_large (with error bit) if the combined array is too large.
+ *
+ * Errors (with error bit) from: f_memory_adjust().
+ *
+ * @see f_memory_adjust()
+ * @see f_string_dynamicss_adjust()
+ * @see f_string_dynamicss_append()
+ * @see f_string_dynamicss_decimate_by()
+ * @see f_string_map_multis_adjust()
+ * @see f_string_map_multis_append()
+ */
+#if !defined(_di_f_string_dynamicss_adjust_) || !defined(_di_f_string_dynamicss_append_) || !defined(_di_f_string_dynamicss_decimate_by_) || !defined(_di_f_string_map_multis_adjust_) || !defined(_di_f_string_map_multis_append_)
+ extern f_status_t private_f_string_dynamicss_adjust(const f_array_length_t length, f_string_dynamicss_t * const dynamicss) F_attribute_visibility_internal_d;
+#endif // !defined(_di_f_string_dynamicss_adjust_) || !defined(_di_f_string_dynamicss_append_) || !defined(_di_f_string_dynamicss_decimate_by_) || !defined(_di_f_string_map_multis_adjust_) || !defined(_di_f_string_map_multis_append_)
+
+/**
+ * Private implementation for appending.
+ *
+ * Intended to be shared to each of the different implementation variations.
+ *
+ * @param source
+ * The source strings to append.
+ * @param destination
+ * The destination strings the source is appended onto.
+ *
+ * @return
+ * F_none on success.
+ *
+ * F_array_too_large (with error bit) if the combined array is too large.
+ *
+ * Errors (with error bit) from: f_memory_resize().
+ *
+ * @see f_memory_resize()
+ * @see f_string_dynamicss_append()
+ * @see f_string_map_multis_append()
+ */
+#if !defined(_di_f_string_dynamicss_append_) || !defined(_di_f_string_map_multis_append_)
+ extern f_status_t private_f_string_dynamicss_append(const f_string_dynamicss_t source, f_string_dynamicss_t *destination) F_attribute_visibility_internal_d;
+#endif // !defined(_di_f_string_dynamicss_append_) || !defined(_di_f_string_map_multis_append_)
+
+/**
+ * Private implementation for resizing.
+ *
+ * Intended to be shared to each of the different implementation variations.
+ *
+ * @param length
+ * The new size to use.
+ * @param dynamicss
+ * The strings to resize.
+ *
+ * @return
+ * F_none on success.
+ *
+ * F_array_too_large (with error bit) if the combined array is too large.
+ *
+ * Errors (with error bit) from: f_memory_resize().
+ *
+ * @see f_memory_resize()
+ * @see f_string_dynamicss_decrease_by()
+ * @see f_string_dynamicss_increase()
+ * @see f_string_dynamicss_increase_by()
+ */
+#if !defined(_di_f_string_dynamicss_decrease_by_) || !defined(_di_f_string_dynamicss_increase_) || !defined(_di_f_string_dynamicss_increase_by_)
+ extern f_status_t private_f_string_dynamicss_resize(const f_array_length_t length, f_string_dynamicss_t * const dynamicss) F_attribute_visibility_internal_d;
+#endif // !defined(_di_f_string_dynamicss_decrease_by_) || !defined(_di_f_string_dynamicss_increase_) || !defined(_di_f_string_dynamicss_increase_by_)
+
+/**
+ * Private implementation for resizing.
+ *
+ * Intended to be shared to each of the different implementation variations.
+ *
+ * @param length
+ * The new size to use.
* @param map_multis
* The map_multis to adjust.
*
#endif // !defined(_di_f_string_map_multis_adjust_) || !defined(_di_f_string_map_multis_decimate_by_)
/**
+ * Private implementation for appending.
+ *
+ * Intended to be shared to each of the different implementation variations.
+ *
+ * @param source
+ * The source strings to append.
+ * @param destination
+ * The destination strings the source is appended onto.
+ *
+ * @return
+ * F_none on success.
+ *
+ * F_array_too_large (with error bit) if the combined array is too large.
+ *
+ * Errors (with error bit) from: f_memory_resize().
+ * Errors (with error bit) from: f_string_map_multis_append().
+ * Errors (with error bit) from: f_string_map_multiss_append().
+ *
+ * @see f_memory_resize()
+ * @see f_string_map_multis_append()
+ * @see f_string_map_multiss_append()
+ */
+#if !defined(_di_f_string_map_multiss_append_) || !defined(_di_f_string_map_multis_append_)
+ extern f_status_t private_f_string_map_multis_append(const f_string_map_multis_t source, f_string_map_multis_t *destination) F_attribute_visibility_internal_d;
+#endif // !defined(_di_f_string_map_multiss_append_) || !defined(_di_f_string_map_multis_append_)
+
+/**
* Private implementation for resizing.
*
* Intended to be shared to each of the different implementation variations.
*
* @param length
* The new size to use.
+ * @param map_multiss
+ * The map_multiss to adjust.
+ *
+ * @return
+ * F_none on success.
+ *
+ * F_array_too_large (with error bit) if the combined array is too large.
+ *
+ * Errors (with error bit) from: f_memory_adjust().
+ *
+ * @see f_memory_adjust()
+ * @see f_string_map_multiss_adjust()
+ */
+#if !defined(_di_f_string_map_multiss_adjust_) || !defined(_di_f_string_map_multiss_decimate_by_)
+ extern f_status_t private_f_string_map_multiss_adjust(const f_array_length_t length, f_string_map_multiss_t *map_multiss) F_attribute_visibility_internal_d;
+#endif // !defined(_di_f_string_map_multiss_adjust_) || !defined(_di_f_string_map_multiss_decimate_by_)
+
+/**
+ * Private implementation for resizing.
+ *
+ * Intended to be shared to each of the different implementation variations.
+ *
+ * @param length
+ * The new size to use.
+ * @param map_multiss
+ * The map_multiss to resize.
+ *
+ * @return
+ * F_none on success.
+ *
+ * F_array_too_large (with error bit) if the combined array is too large.
+ *
+ * Errors (with error bit) from: f_memory_resize().
+ *
+ * @see f_memory_adjust()
+ * @see f_string_map_multiss_decrease_by()
+ * @see f_string_map_multiss_increase()
+ * @see f_string_map_multiss_increase_by()
+ * @see f_string_map_multiss_terminate()
+ * @see f_string_map_multiss_terminate_after()
+ */
+#if !defined(_di_f_string_map_multiss_decrease_by_) || !defined(_di_f_string_map_multiss_increase_) || !defined(_di_f_string_map_multiss_increase_by_) || !defined(_di_f_string_map_multiss_terminate_) || !defined(_di_f_string_map_multiss_terminate_after_)
+ extern f_status_t private_f_string_map_multiss_resize(const f_array_length_t length, f_string_map_multiss_t *map_multiss) F_attribute_visibility_internal_d;
+#endif // !defined(_di_f_string_map_multiss_decrease_by_) || !defined(_di_f_string_map_multiss_increase_) || !defined(_di_f_string_map_multiss_increase_by_) || !defined(_di_f_string_map_multiss_terminate_) || !defined(_di_f_string_map_multiss_terminate_after_)
+
+/**
+ * Private implementation for resizing.
+ *
+ * Intended to be shared to each of the different implementation variations.
+ *
+ * @param length
+ * The new size to use.
* @param maps
* The maps to adjust.
*
#endif // !defined(_di_f_string_maps_adjust_) || !defined(_di_f_string_maps_decimate_by_)
/**
+ * Private implementation for appending.
+ *
+ * Intended to be shared to each of the different implementation variations.
+ *
+ * @param source
+ * The source strings to append.
+ * @param destination
+ * The destination strings the source is appended onto.
+ *
+ * @return
+ * F_none on success.
+ *
+ * F_array_too_large (with error bit) if the combined array is too large.
+ *
+ * Errors (with error bit) from: f_memory_resize().
+ *
+ * @see f_memory_resize()
+ * @see f_string_maps_append()
+ * @see f_string_mapss_append()
+ */
+#if !defined(_di_f_string_mapss_append_) || !defined(_di_f_string_maps_append_)
+ extern f_status_t private_f_string_maps_append(const f_string_maps_t source, f_string_maps_t *destination) F_attribute_visibility_internal_d;
+#endif // !defined(_di_f_string_mapss_append_) || !defined(_di_f_string_maps_append_)
+
+/**
* Private implementation for resizing.
*
* Intended to be shared to each of the different implementation variations.
#endif // !defined(_di_f_string_maps_decrease_by_) || !defined(_di_f_string_maps_increase_) || !defined(_di_f_string_maps_increase_by_) || !defined(_di_f_string_maps_terminate_) || !defined(_di_f_string_maps_terminate_after_)
/**
+ * Private implementation for resizing.
+ *
+ * Intended to be shared to each of the different implementation variations.
+ *
+ * @param length
+ * The new size to use.
+ * @param mapss
+ * The mapss to adjust.
+ *
+ * @return
+ * F_none on success.
+ *
+ * F_array_too_large (with error bit) if the combined array is too large.
+ *
+ * Errors (with error bit) from: f_memory_adjust().
+ *
+ * @see f_memory_adjust()
+ * @see f_string_mapss_adjust()
+ */
+#if !defined(_di_f_string_mapss_adjust_) || !defined(_di_f_string_mapss_decimate_by_)
+ extern f_status_t private_f_string_mapss_adjust(const f_array_length_t length, f_string_mapss_t *mapss) F_attribute_visibility_internal_d;
+#endif // !defined(_di_f_string_mapss_adjust_) || !defined(_di_f_string_mapss_decimate_by_)
+
+/**
+ * Private implementation for resizing.
+ *
+ * Intended to be shared to each of the different implementation variations.
+ *
+ * @param length
+ * The new size to use.
+ * @param mapss
+ * The mapss to resize.
+ *
+ * @return
+ * F_none on success.
+ *
+ * F_array_too_large (with error bit) if the combined array is too large.
+ *
+ * Errors (with error bit) from: f_memory_resize().
+ *
+ * @see f_memory_adjust()
+ * @see f_string_mapss_decrease_by()
+ * @see f_string_mapss_increase()
+ * @see f_string_mapss_increase_by()
+ * @see f_string_mapss_terminate()
+ * @see f_string_mapss_terminate_after()
+ */
+#if !defined(_di_f_string_mapss_decrease_by_) || !defined(_di_f_string_mapss_increase_) || !defined(_di_f_string_mapss_increase_by_) || !defined(_di_f_string_mapss_terminate_) || !defined(_di_f_string_mapss_terminate_after_)
+ extern f_status_t private_f_string_mapss_resize(const f_array_length_t length, f_string_mapss_t *mapss) F_attribute_visibility_internal_d;
+#endif // !defined(_di_f_string_mapss_decrease_by_) || !defined(_di_f_string_mapss_increase_) || !defined(_di_f_string_mapss_increase_by_) || !defined(_di_f_string_mapss_terminate_) || !defined(_di_f_string_mapss_terminate_after_)
+
+/**
* Private implementation of f_string_prepend().
*
* Intended to be shared to each of the different implementation variations.
}
#endif // _di_f_string_dynamics_resize_
+#ifndef _di_f_string_dynamicss_adjust_
+ f_status_t f_string_dynamicss_adjust(const f_array_length_t length, f_string_dynamicss_t * const dynamicss) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!dynamicss) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ return private_f_string_dynamicss_adjust(length, dynamicss);
+ }
+#endif // _di_f_string_dynamicss_adjust_
+
+#ifndef _di_f_string_dynamicss_append_
+ f_status_t f_string_dynamicss_append(const f_string_dynamicss_t source, f_string_dynamicss_t *destination) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!destination) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ if (!source.used) {
+ return F_data_not;
+ }
+
+ return private_f_string_dynamicss_append(source, destination);
+ }
+#endif // _di_f_string_dynamicss_append_
+
+#ifndef _di_f_string_dynamicss_decimate_by_
+ f_status_t f_string_dynamicss_decimate_by(const f_array_length_t amount, f_string_dynamicss_t * const dynamicss) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!amount) return F_status_set_error(F_parameter);
+ if (!dynamicss) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ if (dynamicss->size - amount > 0) {
+ return private_f_string_dynamicss_adjust(dynamicss->size - amount, dynamicss);
+ }
+
+ return private_f_string_dynamicss_adjust(0, dynamicss);
+ }
+#endif // _di_f_string_dynamicss_decimate_by_
+
+#ifndef _di_f_string_dynamicss_decrease_by_
+ f_status_t f_string_dynamicss_decrease_by(const f_array_length_t amount, f_string_dynamicss_t * const dynamicss) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!amount) return F_status_set_error(F_parameter);
+ if (!dynamicss) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ if (dynamicss->size - amount > 0) {
+ return private_f_string_dynamicss_resize(dynamicss->size - amount, dynamicss);
+ }
+
+ return private_f_string_dynamicss_resize(0, dynamicss);
+ }
+#endif // _di_f_string_dynamicss_decrease_by_
+
+#ifndef _di_f_string_dynamicss_increase_
+ f_status_t f_string_dynamicss_increase(const uint16_t step, f_string_dynamicss_t * const dynamicss) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
+ if (!dynamicss) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ if (dynamicss->used + 1 > dynamicss->size) {
+ f_array_length_t size = dynamicss->used + step;
+
+ if (size > F_array_length_t_size_d) {
+ if (dynamicss->used + 1 > F_array_length_t_size_d) {
+ return F_status_set_error(F_array_too_large);
+ }
+
+ size = F_array_length_t_size_d;
+ }
+
+ return private_f_string_dynamicss_resize(size, dynamicss);
+ }
+
+ return F_data_not;
+ }
+#endif // _di_f_string_dynamicss_increase_
+
+#ifndef _di_f_string_dynamicss_increase_by_
+ f_status_t f_string_dynamicss_increase_by(const f_array_length_t amount, f_string_dynamicss_t * const dynamicss) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!dynamicss) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ if (dynamicss->used + amount > dynamicss->size) {
+ if (dynamicss->used + amount > F_array_length_t_size_d) {
+ return F_status_set_error(F_array_too_large);
+ }
+
+ return private_f_string_dynamicss_resize(dynamicss->used + amount, dynamicss);
+ }
+
+ return F_data_not;
+ }
+#endif // _di_f_string_dynamicss_increase_by_
+
+#ifndef _di_f_string_dynamicss_resize_
+ f_status_t f_string_dynamicss_resize(const f_array_length_t length, f_string_dynamicss_t * const dynamicss) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!dynamicss) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ return private_f_string_dynamicss_resize(length, dynamicss);
+ }
+#endif // _di_f_string_dynamicss_resize_
+
#ifdef __cplusplus
} // extern "C"
#endif
#endif // _di_f_string_dynamic_t_
/**
- * An array of static dynamics.
+ * An array of static strings.
*
- * array: The array of static dynamics.
+ * array: The array of static strings.
* size: Total amount of space available.
* used: Total number of space used.
*/
#endif // _di_f_string_dynamics_t_
/**
+ * An array of static strings.
+ *
+ * array: The array of static strings.
+ * size: Total amount of space available.
+ * used: Total number of space used.
+ */
+#ifndef _di_f_string_staticss_t_
+ typedef struct {
+ f_string_statics_t *array;
+
+ f_array_length_t size;
+ f_array_length_t used;
+ } f_string_staticss_t;
+
+ #define f_string_staticss_t_initialize { 0, 0, 0 }
+
+ #define macro_f_string_staticss_t_clear(staticss) \
+ staticss.array = 0; \
+ staticss.size = 0; \
+ staticss.used = 0;
+#endif // _di_f_string_staticss_t_
+
+/**
+ * An array of dynamic dynamicss.
+ *
+ * array: The array of dynamic dynamicss.
+ * size: Total amount of allocated space.
+ * used: Total number of allocated spaces used.
+ */
+#ifndef _di_f_string_dynamicss_t_
+ typedef f_string_staticss_t f_string_dynamicss_t;
+
+ #define f_string_dynamicss_t_initialize f_string_staticss_t_initialize
+
+ #define macro_f_string_dynamicss_t_clear(dynamicss) macro_f_string_staticss_t_clear(dynamicss)
+
+ #define macro_f_string_dynamicss_t_resize(status, dynamicss, length) status = f_string_dynamicss_resize(length, &dynamicss);
+ #define macro_f_string_dynamicss_t_adjust(status, dynamicss, length) status = f_string_dynamicss_adjust(length, &dynamicss);
+
+ #define macro_f_string_dynamicss_t_delete_simple(dynamicss) f_string_dynamicss_resize(0, &dynamicss);
+ #define macro_f_string_dynamicss_t_destroy_simple(dynamicss) f_string_dynamicss_adjust(0, &dynamicss);
+
+ #define macro_f_string_dynamicss_t_increase(status, step, dynamicss) status = f_string_dynamicss_increase(step, &dynamicss);
+ #define macro_f_string_dynamicss_t_increase_by(status, dynamicss, amount) status = f_string_dynamicss_increase_by(amount, &dynamicss);
+ #define macro_f_string_dynamicss_t_decrease_by(status, dynamicss, amount) status = f_string_dynamicss_decrease_by(amount, &dynamicss);
+ #define macro_f_string_dynamicss_t_decimate_by(status, dynamicss, amount) status = f_string_dynamicss_decimate_by(amount, &dynamicss);
+#endif // _di_f_string_dynamicss_t_
+
+/**
* Provide a static empty string.
*
* This is intended to represent an empty string.
extern f_status_t f_string_dynamics_resize(const f_array_length_t length, f_string_dynamics_t * const dynamics);
#endif // _di_f_string_dynamics_resize_
+/**
+ * Resize the dynamics string array.
+ *
+ * @param length
+ * The new size to use.
+ * @param dynamicss
+ * The array to resize.
+ *
+ * @return
+ * F_none on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_adjust().
+ */
+#ifndef _di_f_string_dynamicss_adjust_
+ extern f_status_t f_string_dynamicss_adjust(const f_array_length_t length, f_string_dynamicss_t * const dynamicss);
+#endif // _di_f_string_dynamicss_adjust_
+
+/**
+ * Append the source strings onto the destination.
+ *
+ * @param source
+ * The source strings to append.
+ * @param destination
+ * The destination strings the source is appended onto.
+ *
+ * @return
+ * F_none on success.
+ * F_data_not on success, but there is nothing to append (size == 0).
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ * F_string_too_large (with error bit) if the combined string is too large.
+ *
+ * Errors (with error bit) from: f_memory_resize().
+ */
+#ifndef _di_f_string_dynamicss_append_
+ extern f_status_t f_string_dynamicss_append(const f_string_dynamicss_t source, f_string_dynamicss_t *destination);
+#endif // _di_f_string_dynamicss_append_
+
+/**
+ * Resize the dynamics string array to a smaller size.
+ *
+ * This will resize making the array smaller based on (size - given length).
+ * If the given length is too small, then the resize will fail.
+ * This will not shrink the size to less than 0.
+ *
+ * @param amount
+ * A positive number representing how much to decimate the size by.
+ * @param dynamicss
+ * The array to resize.
+ *
+ * @return
+ * F_none on success.
+ * F_data_not on success, but there is no reason to increase size (size == 0).
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_resize().
+ */
+#ifndef _di_f_string_dynamicss_decimate_by_
+ extern f_status_t f_string_dynamicss_decimate_by(const f_array_length_t amount, f_string_dynamicss_t * const dynamicss);
+#endif // _di_f_string_dynamicss_decimate_by_
+
+/**
+ * Resize the dynamics string array to a smaller size.
+ *
+ * This will resize making the array smaller based on (size - given length).
+ * If the given length is too small, then the resize will fail.
+ * This will not shrink the size to less than 0.
+ *
+ * @param amount
+ * A positive number representing how much to decrease the size by.
+ * @param dynamicss
+ * The array to resize.
+ *
+ * @return
+ * F_none on success.
+ * F_data_not on success, but there is no reason to increase size (size == 0).
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_resize().
+ */
+#ifndef _di_f_string_dynamicss_decrease_by_
+ extern f_status_t f_string_dynamicss_decrease_by(const f_array_length_t amount, f_string_dynamicss_t * const dynamicss);
+#endif // _di_f_string_dynamicss_decrease_by_
+
+/**
+ * Increase the size of the dynamics string array, but only if necessary.
+ *
+ * If the given length is too large for the buffer, then attempt to set max buffer size (F_array_length_t_size_d).
+ * If already set to the maximum buffer size, then the resize will fail.
+ *
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
+ * @param dynamicss
+ * The array to resize.
+ *
+ * @return
+ * F_none on success.
+ * F_data_not on success, but there is no reason to increase size (used + 1 <= size).
+ *
+ * F_array_too_large (with error bit) if the new array length is too large.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_resize().
+ */
+#ifndef _di_f_string_dynamicss_increase_
+ extern f_status_t f_string_dynamicss_increase(const uint16_t step, f_string_dynamicss_t * const dynamicss);
+#endif // _di_f_string_dynamicss_increase_
+
+/**
+ * Resize the dynamics string array to a larger size.
+ *
+ * This will resize making the array larger based on the given length.
+ * If the given length is too large for the buffer, then attempt to set max buffer size (F_array_length_t_size_d).
+ * If already set to the maximum buffer size, then the resize will fail.
+ *
+ * @param amount
+ * A positive number representing how much to increase the size by.
+ * @param dynamicss
+ * The array to resize.
+ *
+ * @return
+ * F_none on success.
+ * F_data_not on success, but there is no reason to increase size (used + amount <= size).
+ *
+ * F_array_too_large (with error bit) if the new array length is too large.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_resize().
+ */
+#ifndef _di_f_string_dynamicss_increase_by_
+ extern f_status_t f_string_dynamicss_increase_by(const f_array_length_t amount, f_string_dynamicss_t * const dynamicss);
+#endif // _di_f_string_dynamicss_increase_by_
+
+/**
+ * Resize the dynamics string array.
+ *
+ * @param length
+ * The new size to use.
+ * @param dynamicss
+ * The array to resize.
+ *
+ * @return
+ * F_none on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_resize().
+ */
+#ifndef _di_f_string_dynamicss_resize_
+ extern f_status_t f_string_dynamicss_resize(const f_array_length_t length, f_string_dynamicss_t * const dynamicss);
+#endif // _di_f_string_dynamicss_resize_
+
#ifdef __cplusplus
} // extern "C"
#endif
}
#endif // _di_f_string_map_multis_resize_
-#ifndef _di_f_string_maps_adjust_
- f_status_t f_string_maps_adjust(const f_array_length_t length, f_string_maps_t * const maps) {
+#ifndef _di_f_string_map_multiss_adjust_
+ f_status_t f_string_map_multiss_adjust(const f_array_length_t length, f_string_map_multiss_t * const map_multiss) {
#ifndef _di_level_0_parameter_checking_
- if (!maps) return F_status_set_error(F_parameter);
+ if (!map_multiss) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- return private_f_string_maps_adjust(length, maps);
+ return private_f_string_map_multiss_adjust(length, map_multiss);
}
-#endif // _di_f_string_maps_adjust_
+#endif // _di_f_string_map_multiss_adjust_
-#ifndef _di_f_string_maps_append_
- f_status_t f_string_maps_append(const f_string_maps_t source, f_string_maps_t * const destination) {
+#ifndef _di_f_string_map_multiss_append_
+ f_status_t f_string_map_multiss_append(const f_string_map_multiss_t source, f_string_map_multiss_t * const destination) {
#ifndef _di_level_0_parameter_checking_
if (!destination) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- if (!source.used) return F_data_not;
-
f_status_t status = F_none;
if (destination->used + source.used > destination->size) {
- status = private_f_string_maps_resize(destination->used + source.used, destination);
+ status = private_f_string_map_multiss_resize(destination->used + source.used, destination);
if (F_status_is_error(status)) return status;
}
for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) {
- destination->array[destination->used].name.used = 0;
- destination->array[destination->used].value.used = 0;
+ destination->array[destination->used].used = 0;
- if (source.array[i].name.used) {
- status = private_f_string_append(source.array[i].name.string, source.array[i].name.used, &destination->array[destination->used].name);
- if (F_status_is_error(status)) return status;
- }
-
- if (source.array[i].value.used) {
- status = private_f_string_append(source.array[i].value.string, source.array[i].value.used, &destination->array[destination->used].value);
+ if (source.array[i].used) {
+ status = private_f_string_map_multis_append(source.array[i], &destination->array[destination->used]);
if (F_status_is_error(status)) return status;
}
} // for
return F_none;
}
+#endif // _di_f_string_map_multiss_append_
+
+#ifndef _di_f_string_map_multiss_decimate_by_
+ f_status_t f_string_map_multiss_decimate_by(const f_array_length_t amount, f_string_map_multiss_t * const map_multiss) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!amount) return F_status_set_error(F_parameter);
+ if (!map_multiss) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ if (map_multiss->size - amount > 0) {
+ return private_f_string_map_multiss_adjust(map_multiss->size - amount, map_multiss);
+ }
+
+ return private_f_string_map_multiss_adjust(0, map_multiss);
+ }
+#endif // _di_f_string_map_multiss_decimate_by_
+
+#ifndef _di_f_string_map_multiss_decrease_by_
+ f_status_t f_string_map_multiss_decrease_by(const f_array_length_t amount, f_string_map_multiss_t * const map_multiss) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!amount) return F_status_set_error(F_parameter);
+ if (!map_multiss) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ if (map_multiss->size - amount > 0) {
+ return private_f_string_map_multiss_resize(map_multiss->size - amount, map_multiss);
+ }
+
+ return private_f_string_map_multiss_resize(0, map_multiss);
+ }
+#endif // _di_f_string_map_multiss_decrease_by_
+
+#ifndef _di_f_string_map_multiss_increase_
+ f_status_t f_string_map_multiss_increase(const uint16_t step, f_string_map_multiss_t * const map_multiss) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
+ if (!map_multiss) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ if (map_multiss->used + 1 > map_multiss->size) {
+ f_array_length_t size = map_multiss->used + step;
+
+ if (size > F_array_length_t_size_d) {
+ if (map_multiss->used + 1 > F_array_length_t_size_d) {
+ return F_status_set_error(F_array_too_large);
+ }
+
+ size = F_array_length_t_size_d;
+ }
+
+ return private_f_string_map_multiss_resize(size, map_multiss);
+ }
+
+ return F_data_not;
+ }
+#endif // _di_f_string_map_multiss_increase_
+
+#ifndef _di_f_string_map_multiss_increase_by_
+ f_status_t f_string_map_multiss_increase_by(const f_array_length_t amount, f_string_map_multiss_t * const map_multiss) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!amount) return F_status_set_error(F_parameter);
+ if (!map_multiss) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ if (map_multiss->used + amount > map_multiss->size) {
+ if (map_multiss->used + amount > F_array_length_t_size_d) {
+ return F_status_set_error(F_array_too_large);
+ }
+
+ return private_f_string_map_multiss_resize(map_multiss->used + amount, map_multiss);
+ }
+
+ return F_data_not;
+ }
+#endif // _di_f_string_map_multiss_increase_by_
+
+#ifndef _di_f_string_map_multiss_resize_
+ f_status_t f_string_map_multiss_resize(const f_array_length_t length, f_string_map_multiss_t * const map_multiss) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!map_multiss) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ return private_f_string_map_multiss_resize(length, map_multiss);
+ }
+#endif // _di_f_string_map_multiss_resize_
+
+#ifndef _di_f_string_maps_adjust_
+ f_status_t f_string_maps_adjust(const f_array_length_t length, f_string_maps_t * const maps) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!maps) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ return private_f_string_maps_adjust(length, maps);
+ }
+#endif // _di_f_string_maps_adjust_
+
+#ifndef _di_f_string_maps_append_
+ f_status_t f_string_maps_append(const f_string_maps_t source, f_string_maps_t * const destination) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!destination) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ if (!source.used) return F_data_not;
+
+ return private_f_string_maps_append(source, destination);
+ }
#endif // _di_f_string_maps_append_
#ifndef _di_f_string_maps_decimate_by_
}
#endif // _di_f_string_maps_resize_
+#ifndef _di_f_string_mapss_adjust_
+ f_status_t f_string_mapss_adjust(const f_array_length_t length, f_string_mapss_t * const mapss) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!mapss) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ return private_f_string_mapss_adjust(length, mapss);
+ }
+#endif // _di_f_string_mapss_adjust_
+
+#ifndef _di_f_string_mapss_append_
+ f_status_t f_string_mapss_append(const f_string_mapss_t source, f_string_mapss_t * const destination) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!destination) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ if (!source.used) return F_data_not;
+
+ f_status_t status = F_none;
+
+ if (destination->used + source.used > destination->size) {
+ status = private_f_string_mapss_resize(destination->used + source.used, destination);
+ if (F_status_is_error(status)) return status;
+ }
+
+ for (f_array_length_t i = 0; i < source.used; ++i, ++destination->used) {
+
+ destination->array[destination->used].used = 0;
+
+ if (source.array[i].used) {
+ status = private_f_string_maps_append(source.array[i], &destination->array[destination->used]);
+ if (F_status_is_error(status)) return status;
+ }
+ } // for
+
+ return F_none;
+ }
+#endif // _di_f_string_mapss_append_
+
+#ifndef _di_f_string_mapss_decimate_by_
+ f_status_t f_string_mapss_decimate_by(const f_array_length_t amount, f_string_mapss_t * const mapss) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!amount) return F_status_set_error(F_parameter);
+ if (!mapss) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ if (mapss->size - amount > 0) {
+ return private_f_string_mapss_adjust(mapss->size - amount, mapss);
+ }
+
+ return private_f_string_mapss_adjust(0, mapss);
+ }
+#endif // _di_f_string_mapss_decimate_by_
+
+#ifndef _di_f_string_mapss_decrease_by_
+ f_status_t f_string_mapss_decrease_by(const f_array_length_t amount, f_string_mapss_t * const mapss) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!amount) return F_status_set_error(F_parameter);
+ if (!mapss) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ if (mapss->size - amount > 0) {
+ return private_f_string_mapss_resize(mapss->size - amount, mapss);
+ }
+
+ return private_f_string_mapss_resize(0, mapss);
+ }
+#endif // _di_f_string_mapss_decrease_by_
+
+#ifndef _di_f_string_mapss_increase_
+ f_status_t f_string_mapss_increase(const uint16_t step, f_string_mapss_t * const mapss) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!step) return F_status_set_error(F_parameter);
+ if (!mapss) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ if (mapss->used + 1 > mapss->size) {
+ f_array_length_t size = mapss->used + step;
+
+ if (size > F_array_length_t_size_d) {
+ if (mapss->used + 1 > F_array_length_t_size_d) {
+ return F_status_set_error(F_array_too_large);
+ }
+
+ size = F_array_length_t_size_d;
+ }
+
+ return private_f_string_mapss_resize(size, mapss);
+ }
+
+ return F_data_not;
+ }
+#endif // _di_f_string_mapss_increase_
+
+#ifndef _di_f_string_mapss_increase_by_
+ f_status_t f_string_mapss_increase_by(const f_array_length_t amount, f_string_mapss_t * const mapss) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!amount) return F_status_set_error(F_parameter);
+ if (!mapss) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ if (mapss->used + amount > mapss->size) {
+ if (mapss->used + amount > F_array_length_t_size_d) {
+ return F_status_set_error(F_array_too_large);
+ }
+
+ return private_f_string_mapss_resize(mapss->used + amount, mapss);
+ }
+
+ return F_data_not;
+ }
+#endif // _di_f_string_mapss_increase_by_
+
+#ifndef _di_f_string_mapss_resize_
+ f_status_t f_string_mapss_resize(const f_array_length_t length, f_string_mapss_t * const mapss) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!mapss) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ return private_f_string_mapss_resize(length, mapss);
+ }
+#endif // _di_f_string_mapss_resize_
+
#ifdef __cplusplus
} // extern "C"
#endif
#endif // _di_f_string_maps_t_
/**
+ * An array of string maps.
+ *
+ * array: the array of an array of string maps.
+ * size: total amount of allocated space.
+ * used: total number of allocated spaces used.
+ */
+#ifndef _di_f_string_mapss_t_
+ typedef struct {
+ f_string_maps_t *array;
+
+ f_array_length_t size;
+ f_array_length_t used;
+ } f_string_mapss_t;
+
+ #define f_string_mapss_t_initialize f_string_statics_t_initialize
+
+ #define macro_f_string_mapss_t_clear(maps) macro_f_memory_structure_clear(maps)
+
+ #define macro_f_string_mapss_t_resize(status, maps, length) status = f_string_mapss_resize(length, &maps);
+ #define macro_f_string_mapss_t_adjust(status, maps, length) status = f_string_mapss_adjust(length, &maps);
+
+ #define macro_f_string_mapss_t_delete_simple(maps) f_string_mapss_resize(0, &maps);
+ #define macro_f_string_mapss_t_destroy_simple(maps) f_string_mapss_adjust(0, &maps);
+
+ #define macro_f_string_mapss_t_increase(status, step, maps) status = f_string_mapss_increase(step, maps);
+ #define macro_f_string_mapss_t_increase_by(status, maps, amount) status = f_string_mapss_increase_by(amount, maps);
+ #define macro_f_string_mapss_t_decrease_by(status, maps, amount) status = f_string_mapss_decrease_by(amount, maps);
+ #define macro_f_string_mapss_t_decimate_by(status, maps, amount) status = f_string_mapss_decimate_by(amount, maps);
+#endif // _di_f_string_mapss_t_
+
+/**
* A string map consisting of a name and multiple values.
*
* name: A string representing the map name.
#endif // _di_f_string_map_multis_t_
/**
+ * An array of string maps.
+ *
+ * array: the array of an array of string maps.
+ * size: total amount of allocated space.
+ * used: total number of allocated spaces used.
+ */
+#ifndef _di_f_string_map_multiss_t_
+ typedef struct {
+ f_string_map_multis_t *array;
+
+ f_array_length_t size;
+ f_array_length_t used;
+ } f_string_map_multiss_t;
+
+ #define f_string_map_multiss_t_initialize f_string_statics_t_initialize
+
+ #define macro_f_string_map_multiss_t_clear(map_multis) macro_f_memory_structure_clear(map_multis)
+
+ #define macro_f_string_map_multiss_t_resize(status, map_multis, length) status = f_string_map_multiss_resize(length, &map_multis);
+ #define macro_f_string_map_multiss_t_adjust(status, map_multis, length) status = f_string_map_multiss_adjust(length, &map_multis);
+
+ #define macro_f_string_map_multiss_t_delete_simple(map_multis) f_string_map_multiss_resize(0, &map_multis);
+ #define macro_f_string_map_multiss_t_destroy_simple(map_multis) f_string_map_multiss_adjust(0, &map_multis);
+
+ #define macro_f_string_map_multiss_t_increase(status, step, map_multis) status = f_string_map_multiss_increase(step, &map_multis);
+ #define macro_f_string_map_multiss_t_increase_by(status, map_multis, amount) status = f_string_map_multiss_increase_by(amount, &map_multis);
+ #define macro_f_string_map_multiss_t_decrease_by(status, map_multis, amount) status = f_string_map_multiss_decrease_by(amount, &map_multis);
+ #define macro_f_string_map_multiss_t_decimate_by(status, map_multis, amount) status = f_string_map_multiss_decimate_by(amount, &map_multis);
+#endif // _di_f_string_map_multiss_t_
+
+/**
* Resize the map_multis array.
*
* @param length
extern f_status_t f_string_maps_resize(const f_array_length_t length, f_string_maps_t * const maps);
#endif // _di_f_string_maps_resize_
+/**
+ * Resize the string mapss array.
+ *
+ * @param length
+ * The new size to use.
+ * @param mapss
+ * The string mapss array to resize.
+ *
+ * @return
+ * F_none on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_resize().
+ */
+#ifndef _di_f_string_mapss_adjust_
+ extern f_status_t f_string_mapss_adjust(const f_array_length_t length, f_string_mapss_t * const mapss);
+#endif // _di_f_string_mapss_adjust_
+
+/**
+ * Append the source mapss onto the destination.
+ *
+ * @param source
+ * The source mapss to append.
+ * @param destination
+ * The destination mapss the source is appended onto.
+ *
+ * @return
+ * F_none on success.
+ * F_data_not on success, but there is nothing to append (size == 0).
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ * F_string_too_large (with error bit) if the combined string is too large.
+ *
+ * Errors (with error bit) from: f_memory_resize().
+ */
+#ifndef _di_f_string_mapss_append_
+ extern f_status_t f_string_mapss_append(const f_string_mapss_t source, f_string_mapss_t * const destination);
+#endif // _di_f_string_mapss_append_
+
+/**
+ * Resize the string mapss array to a smaller size.
+ *
+ * This will resize making the array smaller based on (size - given length).
+ * If the given length is too small, then the resize will fail.
+ * This will not shrink the size to less than 0.
+ *
+ * @param amount
+ * A positive number representing how much to decimate the size by.
+ * @param mapss
+ * The string mapss array to resize.
+ *
+ * @return
+ * F_none on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_resize().
+ */
+#ifndef _di_f_string_mapss_decimate_by_
+ extern f_status_t f_string_mapss_decimate_by(const f_array_length_t amount, f_string_mapss_t * const mapss);
+#endif // _di_f_string_mapss_decimate_by_
+
+/**
+ * Resize the string mapss array to a smaller size.
+ *
+ * This will resize making the array smaller based on (size - given length).
+ * If the given length is too small, then the resize will fail.
+ * This will not shrink the size to less than 0.
+ *
+ * @param amount
+ * A positive number representing how much to decrease the size by.
+ * @param mapss
+ * The string mapss array to resize.
+ *
+ * @return
+ * F_none on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_resize().
+ */
+#ifndef _di_f_string_mapss_decrease_by_
+ extern f_status_t f_string_mapss_decrease_by(const f_array_length_t amount, f_string_mapss_t * const mapss);
+#endif // _di_f_string_mapss_decrease_by_
+
+/**
+ * Increase the size of the string mapss array, but only if necessary.
+ *
+ * If the given length is too large for the buffer, then attempt to set max buffer size (F_array_length_t_size_d).
+ * If already set to the maximum buffer size, then the resize will fail.
+ *
+ * @param step
+ * The allocation step to use.
+ * Must be greater than 0.
+ * @param mapss
+ * The string mapss array to resize.
+ *
+ * @return
+ * F_none on success.
+ * F_data_not on success, but there is no reason to increase size (used + 1 <= size).
+ *
+ * F_array_too_large (with error bit) if the new array length is too large.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_resize().
+ */
+#ifndef _di_f_string_mapss_increase_
+ extern f_status_t f_string_mapss_increase(const uint16_t step, f_string_mapss_t * const mapss);
+#endif // _di_f_string_mapss_increase_
+
+/**
+ * Resize the string mapss array to a larger size.
+ *
+ * This will resize making the string larger based on the given length.
+ * If the given length is too large for the buffer, then attempt to set max buffer size (F_array_length_t_size_d).
+ * If already set to the maximum buffer size, then the resize will fail.
+ *
+ * @param amount
+ * A positive number representing how much to increase the size by.
+ * @param mapss
+ * The string mapss array to resize.
+ *
+ * @return
+ * F_none on success.
+ * F_data_not on success, but there is no reason to increase size (used + amount <= size).
+ *
+ * F_array_too_large (with error bit) if the new array length is too large.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_resize().
+ */
+#ifndef _di_f_string_mapss_increase_by_
+ extern f_status_t f_string_mapss_increase_by(const f_array_length_t amount, f_string_mapss_t * const mapss);
+#endif // _di_f_string_mapss_increase_by_
+
+/**
+ * Resize the string mapss array.
+ *
+ * @param length
+ * The new size to use.
+ * @param mapss
+ * The string mapss array to adjust.
+ *
+ * @return
+ * F_none on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_resize().
+ */
+#ifndef _di_f_string_mapss_resize_
+ extern f_status_t f_string_mapss_resize(const f_array_length_t length, f_string_mapss_t * const mapss);
+#endif // _di_f_string_mapss_resize_
+
#ifdef __cplusplus
} // extern "C"
#endif
* size: Total amount of allocated space.
* used: Total number of allocated spaces used.
*/
-#ifndef _di_f_array_t_int8_t_
+#ifndef _di_int8s_t_
typedef struct {
int8_t *array;
#endif // _di_f_array_lengthss_t_
/**
- * Macros for f_array_lengths_t, see type.h for typedefs.
+ * Macros for int8_t, see type.h for typedefs.
*/
-#ifndef _di_f_array_t_int8_t_
+#ifndef _di_f_int8_t_
#define macro_f_int8s_t_clear(int8s) macro_f_memory_structures_clear(int8s)
#define macro_f_int8s_t_resize(status, int8s, length) status = f_type_int8s_resize(length, &int8s);
#define macro_f_int8s_t_delete_simple(int8s) f_type_int8s_resize(0, &int8s);
#define macro_f_int8s_t_destroy_simple(int8s) f_type_int8s_adjust(0, &int8s);
-#endif // _di_int8s_t_
+#endif // _di_f_int8_t_
/**
- * Macros for f_array_lengths_t, see type.h for typedefs.
+ * Macros for f_int8s_t, see type.h for typedefs.
*/
-#ifndef _di_int8ss_t_
+#ifndef _di_f_int8ss_t_
#define macro_f_int8ss_t_clear(int8ss) macro_f_memory_structures_clear(int8ss)
#define macro_f_int8ss_t_resize(status, int8ss, length) status = f_type_int8ss_resize(length, &int8ss);
#define macro_f_int8ss_t_delete_simple(int8ss) f_type_int8ss_resize(0, &int8ss);
#define macro_f_int8ss_t_destroy_simple(int8ss) f_type_int8ss_adjust(0, &int8ss);
-#endif // _di_int8ss_t_
+#endif // _di_f_int8ss_t_
/**
- * Macros for f_array_lengths_t, see type.h for typedefs.
+ * Macros for f_uint8s_t, see type.h for typedefs.
*/
-#ifndef _di_uint8s_t_
+#ifndef _di_f_uint8s_t_
#define macro_f_uint8s_t_clear(uint8s) macro_f_memory_structures_clear(uint8s)
#define macro_f_uint8s_t_resize(status, uint8s, length) status = f_type_uint8s_resize(length, &uint8s);
#define macro_f_uint8s_t_increase_by(status, uint8s, amount) status = f_type_uint8s_increase_by(amount, &uint8s);
#define macro_f_uint8s_t_decrease_by(status, uint8s, amount) status = f_type_uint8s_decrease_by(amount, &uint8s);
#define macro_f_uint8s_t_decimate_by(status, uint8s, amount) status = f_type_uint8s_decimate_by(amount, &uint8s);
-#endif // _di_uint8s_t_
+#endif // _di_f_uint8s_t_
/**
- * Macros for f_array_lengths_t, see type.h for typedefs.
+ * Macros for f_uint8ss_t, see type.h for typedefs.
*/
-#ifndef _di_uint8ss_t_
+#ifndef _di_f_uint8ss_t_
#define macro_f_uint8ss_t_clear(uint8ss) macro_f_memory_structures_clear(uint8ss)
#define macro_f_uint8ss_t_resize(status, uint8ss, length) status = f_type_uint8ss_resize(length, &uint8ss);
#define macro_f_uint8ss_t_increase_by(status, uint8ss, amount) status = f_type_uint8ss_increase_by(amount, &uint8ss);
#define macro_f_uint8ss_t_decrease_by(status, uint8ss, amount) status = f_type_uint8ss_decrease_by(amount, &uint8ss);
#define macro_f_uint8ss_t_decimate_by(status, uint8ss, amount) status = f_type_uint8ss_decimate_by(amount, &uint8ss);
-#endif // _di_uint8ss_t_
+#endif // _di_f_uint8ss_t_
/**
- * Macros for f_array_lengths_t, see type.h for typedefs.
+ * Macros for f_int16s_t, see type.h for typedefs.
*/
-#ifndef _di_int16s_t_
+#ifndef _di_f_int16s_t_
#define macro_f_int16s_t_clear(int16s) macro_f_memory_structures_clear(int16s)
#define macro_f_int16s_t_resize(status, int16s, length) status = f_type_int16s_resize(length, &int16s);
#define macro_f_int16s_t_delete_simple(int16s) f_type_int16s_resize(0, &int16s);
#define macro_f_int16s_t_destroy_simple(int16s) f_type_int16s_adjust(0, &int16s);
-#endif // _di_int16s_t_
+#endif // _di_f_int16s_t_
/**
- * Macros for f_array_lengths_t, see type.h for typedefs.
+ * Macros for f_int16ss_t, see type.h for typedefs.
*/
-#ifndef _di_int16ss_t_
+#ifndef _di_f_int16ss_t_
#define macro_f_int16ss_t_clear(int16ss) macro_f_memory_structures_clear(int16ss)
#define macro_f_int16ss_t_resize(status, int16ss, length) status = f_type_int16ss_resize(length, &int16ss);
#define macro_f_int16ss_t_delete_simple(int16ss) f_type_int16ss_resize(0, &int16ss);
#define macro_f_int16ss_t_destroy_simple(int16ss) f_type_int16ss_adjust(0, &int16ss);
-#endif // _di_int16ss_t_
+#endif // _di_f_int16ss_t_
/**
- * Macros for f_array_lengths_t, see type.h for typedefs.
+ * Macros for f_uint16s_t, see type.h for typedefs.
*/
-#ifndef _di_uint16s_t_
+#ifndef _di_f_uint16s_t_
#define macro_f_uint16s_t_clear(uint16s) macro_f_memory_structures_clear(uint16s)
#define macro_f_uint16s_t_resize(status, uint16s, length) status = f_type_uint16s_resize(length, &uint16s);
#define macro_f_uint16s_t_increase_by(status, uint16s, amount) status = f_type_uint16s_increase_by(amount, &uint16s);
#define macro_f_uint16s_t_decrease_by(status, uint16s, amount) status = f_type_uint16s_decrease_by(amount, &uint16s);
#define macro_f_uint16s_t_decimate_by(status, uint16s, amount) status = f_type_uint16s_decimate_by(amount, &uint16s);
-#endif // _di_uint16s_t_
+#endif // _di_f_uint16s_t_
/**
- * Macros for f_array_lengths_t, see type.h for typedefs.
+ * Macros for f_uint16ss_t, see type.h for typedefs.
*/
-#ifndef _di_uint16ss_t_
+#ifndef _di_f_uint16ss_t_
#define macro_f_uint16ss_t_clear(uint16ss) macro_f_memory_structures_clear(uint16ss)
#define macro_f_uint16ss_t_resize(status, uint16ss, length) status = f_type_uint16ss_resize(length, &uint16ss);
#define macro_f_uint16ss_t_increase_by(status, uint16ss, amount) status = f_type_uint16ss_increase_by(amount, &uint16ss);
#define macro_f_uint16ss_t_decrease_by(status, uint16ss, amount) status = f_type_uint16ss_decrease_by(amount, &uint16ss);
#define macro_f_uint16ss_t_decimate_by(status, uint16ss, amount) status = f_type_uint16ss_decimate_by(amount, &uint16ss);
-#endif // _di_uint16ss_t_
+#endif // _di_f_uint16ss_t_
/**
- * Macros for f_array_lengths_t, see type.h for typedefs.
+ * Macros for f_int32s_t, see type.h for typedefs.
*/
-#ifndef _di_int32s_t_
+#ifndef _di_f_int32s_t_
#define macro_f_int32s_t_clear(int32s) macro_f_memory_structures_clear(int32s)
#define macro_f_int32s_t_resize(status, int32s, length) status = f_type_int32s_resize(length, &int32s);
#define macro_f_int32s_t_increase_by(status, int32s, amount) status = f_type_int32s_increase_by(amount, &int32s);
#define macro_f_int32s_t_decrease_by(status, int32s, amount) status = f_type_int32s_decrease_by(amount, &int32s);
#define macro_f_int32s_t_decimate_by(status, int32s, amount) status = f_type_int32s_decimate_by(amount, &int32s);
-#endif // _di_int32s_t_
+#endif // _di_f_int32s_t_
/**
* Macros for f_array_lengths_t, see type.h for typedefs.
*/
-#ifndef _di_int32ss_t_
+#ifndef _di_f_int32ss_t_
#define macro_f_int32ss_t_clear(int32ss) macro_f_memory_structures_clear(int32ss)
#define macro_f_int32ss_t_resize(status, int32ss, length) status = f_type_int32ss_resize(length, &int32ss);
#define macro_f_int32ss_t_increase_by(status, int32ss, amount) status = f_type_int32ss_increase_by(amount, &int32ss);
#define macro_f_int32ss_t_decrease_by(status, int32ss, amount) status = f_type_int32ss_decrease_by(amount, &int32ss);
#define macro_f_int32ss_t_decimate_by(status, int32ss, amount) status = f_type_int32ss_decimate_by(amount, &int32ss);
-#endif // _di_int32ss_t_
+#endif // _di_f_int32ss_t_
/**
- * Macros for f_array_lengths_t, see type.h for typedefs.
+ * Macros for f_uint32s_t, see type.h for typedefs.
*/
-#ifndef _di_uint32s_t_
+#ifndef _di_f_uint32s_t_
#define macro_f_uint32s_t_clear(uint32s) macro_f_memory_structures_clear(uint32s)
#define macro_f_uint32s_t_resize(status, uint32s, length) status = f_type_uint32s_resize(length, &uint32s);
#define macro_f_uint32s_t_increase_by(status, uint32s, amount) status = f_type_uint32s_increase_by(amount, &uint32s);
#define macro_f_uint32s_t_decrease_by(status, uint32s, amount) status = f_type_uint32s_decrease_by(amount, &uint32s);
#define macro_f_uint32s_t_decimate_by(status, uint32s, amount) status = f_type_uint32s_decimate_by(amount, &uint32s);
-#endif // _di_uint32s_t_
+#endif // _di_f_uint32s_t_
/**
- * Macros for f_array_lengths_t, see type.h for typedefs.
+ * Macros for f_uint32ss_t, see type.h for typedefs.
*/
-#ifndef _di_uint32ss_t_
+#ifndef _di_f_uint32ss_t_
#define macro_f_uint32ss_t_clear(uint32ss) macro_f_memory_structures_clear(uint32ss)
#define macro_f_uint32ss_t_resize(status, uint32ss, length) status = f_type_uint32ss_resize(length, &uint32ss);
#define macro_f_uint32ss_t_increase_by(status, uint32ss, amount) status = f_type_uint32ss_increase_by(amount, &uint32ss);
#define macro_f_uint32ss_t_decrease_by(status, uint32ss, amount) status = f_type_uint32ss_decrease_by(amount, &uint32ss);
#define macro_f_uint32ss_t_decimate_by(status, uint32ss, amount) status = f_type_uint32ss_decimate_by(amount, &uint32ss);
-#endif // _di_uint32ss_t_
+#endif // _di_f_uint32ss_t_
/**
- * Macros for f_array_lengths_t, see type.h for typedefs.
+ * Macros for f_int64s_t, see type.h for typedefs.
*/
-#ifndef _di_int64s_t_
+#ifndef _di_f_int64s_t_
#define macro_f_int64s_t_clear(int64s) macro_f_memory_structures_clear(int64s)
#define macro_f_int64s_t_resize(status, int64s, length) status = f_type_int64s_resize(length, &int64s);
#define macro_f_int64s_t_delete_simple(int64s) f_type_int64s_resize(0, &int64s);
#define macro_f_int64s_t_destroy_simple(int64s) f_type_int64s_adjust(0, &int64s);
-#endif // _di_int64s_t_
+#endif // _di_f_int64s_t_
/**
- * Macros for f_array_lengths_t, see type.h for typedefs.
+ * Macros for f_int64ss_t, see type.h for typedefs.
*/
-#ifndef _di_int64ss_t_
+#ifndef _di_f_int64ss_t_
#define macro_f_int64ss_t_clear(int64ss) macro_f_memory_structures_clear(int64ss)
#define macro_f_int64ss_t_resize(status, int64ss, length) status = f_type_int64ss_resize(length, &int64ss);
#define macro_f_int64ss_t_delete_simple(int64ss) f_type_int64ss_resize(0, &int64ss);
#define macro_f_int64ss_t_destroy_simple(int64ss) f_type_int64ss_adjust(0, &int64ss);
-#endif // _di_int64ss_t_
+#endif // _di_f_int64ss_t_
/**
- * Macros for f_array_lengths_t, see type.h for typedefs.
+ * Macros for f_uint64s_t, see type.h for typedefs.
*/
-#ifndef _di_uint64s_t_
+#ifndef _di_f_uint64s_t_
#define macro_f_uint64s_t_clear(uint64s) macro_f_memory_structures_clear(uint64s)
#define macro_f_uint64s_t_resize(status, uint64s, length) status = f_type_uint64s_resize(length, &uint64s);
#define macro_f_uint64s_t_delete_simple(uint64s) f_type_uint64s_resize(0, &uint64s);
#define macro_f_uint64s_t_destroy_simple(uint64s) f_type_uint64s_adjust(0, &uint64s);
-#endif // _di_uint64s_t_
+#endif // _di_f_uint64s_t_
/**
- * Macros for f_array_lengths_t, see type.h for typedefs.
+ * Macros for f_uint64ss_t, see type.h for typedefs.
*/
-#ifndef _di_uint64ss_t_
+#ifndef _di_f_uint64ss_t_
#define macro_f_uint64ss_t_clear(uint64ss) macro_f_memory_structures_clear(uint64ss)
#define macro_f_uint64ss_t_resize(status, uint64ss, length) status = f_type_uint64ss_resize(length, &uint64ss);
#define macro_f_uint64ss_t_delete_simple(uint64ss) f_type_uint64ss_resize(0, &uint64ss);
#define macro_f_uint64ss_t_destroy_simple(uint64ss) f_type_uint64ss_adjust(0, &uint64ss);
-#endif // _di_uint64ss_t_
+#endif // _di_f_uint64ss_t_
/**
- * Macros for f_array_lengths_t, see type.h for typedefs.
+ * Macros for f_int128s_t, see type.h for typedefs.
*/
-#ifndef _di_int128s_t_
+#ifndef _di_f_int128s_t_
#define macro_f_int128s_t_clear(int128s) macro_f_memory_structures_clear(int128s)
#define macro_f_int128s_t_resize(status, int128s, length) status = f_type_int128s_resize(length, &int128s);
#define macro_f_int128s_t_increase_by(status, int128s, amount) status = f_type_int128s_increase_by(amount, &int128s);
#define macro_f_int128s_t_decrease_by(status, int128s, amount) status = f_type_int128s_decrease_by(amount, &int128s);
#define macro_f_int128s_t_decimate_by(status, int128s, amount) status = f_type_int128s_decimate_by(amount, &int128s);
-#endif // _di_int128s_t_
+#endif // _di_f_int128s_t_
/**
- * Macros for f_array_lengths_t, see type.h for typedefs.
+ * Macros for f_int128ss_t, see type.h for typedefs.
*/
-#ifndef _di_int128ss_t_
+#ifndef _di_f_int128ss_t_
#define macro_f_int128ss_t_clear(int128ss) macro_f_memory_structures_clear(int128ss)
#define macro_f_int128ss_t_resize(status, int128ss, length) status = f_type_int128ss_resize(length, &int128ss);
#define macro_f_int128ss_t_increase_by(status, int128ss, amount) status = f_type_int128ss_increase_by(amount, &int128ss);
#define macro_f_int128ss_t_decrease_by(status, int128ss, amount) status = f_type_int128ss_decrease_by(amount, &int128ss);
#define macro_f_int128ss_t_decimate_by(status, int128ss, amount) status = f_type_int128ss_decimate_by(amount, &int128ss);
-#endif // _di_int128ss_t_
+#endif // _di_f_int128ss_t_
/**
- * Macros for f_array_lengths_t, see type.h for typedefs.
+ * Macros for f_uint128s_t, see type.h for typedefs.
*/
-#ifndef _di_uint128s_t_
+#ifndef _di_f_uint128s_t_
#define macro_f_uint128s_t_clear(uint128s) macro_f_memory_structures_clear(uint128s)
#define macro_f_uint128s_t_resize(status, uint128s, length) status = f_type_uint128s_resize(length, &uint128s);
#define macro_f_uint128s_t_increase_by(status, uint128s, amount) status = f_type_uint128s_increase_by(amount, &uint128s);
#define macro_f_uint128s_t_decrease_by(status, uint128s, amount) status = f_type_uint128s_decrease_by(amount, &uint128s);
#define macro_f_uint128s_t_decimate_by(status, uint128s, amount) status = f_type_uint128s_decimate_by(amount, &uint128s);
-#endif // _di_uint128s_t_
+#endif // _di_f_uint128s_t_
/**
- * Macros for f_array_lengths_t, see type.h for typedefs.
+ * Macros for f_uint128ss_t, see type.h for typedefs.
*/
-#ifndef _di_uint128ss_t_
+#ifndef _di_f_uint128ss_t_
#define macro_f_uint128ss_t_clear(uint128ss) macro_f_memory_structures_clear(uint128ss)
#define macro_f_uint128ss_t_resize(status, uint128ss, length) status = f_type_uint128ss_resize(length, &uint128ss);
#define macro_f_uint128ss_t_increase_by(status, uint128ss, amount) status = f_type_uint128ss_increase_by(amount, &uint128ss);
#define macro_f_uint128ss_t_decrease_by(status, uint128ss, amount) status = f_type_uint128ss_decrease_by(amount, &uint128ss);
#define macro_f_uint128ss_t_decimate_by(status, uint128ss, amount) status = f_type_uint128ss_decimate_by(amount, &uint128ss);
-#endif // _di_uint128ss_t_
+#endif // _di_f_uint128ss_t_
#ifdef __cplusplus
} // extern "C"
return status_allocation;
}
- destination->string[destination->used++] = quote ? quote : f_fss_delimit_quote_double_s.string[0];
- destination->string[destination->used++] = quote ? quote : f_fss_delimit_quote_double_s.string[0];
+ destination->string[destination->used++] = quote ? f_fss_delimit_quote_single_s.string[0] : f_fss_delimit_quote_double_s.string[0];
+ destination->string[destination->used++] = quote ? f_fss_delimit_quote_single_s.string[0] : f_fss_delimit_quote_double_s.string[0];
}
if (complete == f_fss_complete_partial_e || complete == f_fss_complete_partial_trim_e || complete == f_fss_complete_full_e || complete == f_fss_complete_full_trim_e) {
bool is_comment = F_false;
bool has_graph = F_false;
- bool do_prepend = F_true;
+ bool do_prepend = prepend ? F_true : F_false;
f_array_length_t i = 0;
f_array_length_t slash_count = 0;
if (F_status_set_fine(status) == F_interrupt) {
status = F_status_set_error(F_interrupt);
+
break;
}
}
do_prepend = F_false;
}
- if (content.string[range->start] == f_fss_eol_s.string[0]) {
+ if (content.string[range->start] == f_fss_eol_s.string[0] && prepend) {
do_prepend = F_true;
}
* If f_fss_complete_full_e, this will write any appropriate open and close aspects of this content, including the final newline.
* @param prepend
* A string of whitespace to prepend at the start of each line.
- * This should only be whitespace, anything else could product invalid content.
+ * This should only be whitespace, anything else could produce invalid content.
* Set the pointer address to 0 to disable.
* @param state
* A state for handling interrupts during long running operations.
bool is_comment = F_false;
bool ends_on_eol = F_false;
bool has_graph = F_false;
- bool do_prepend = F_true;
+ bool do_prepend = prepend ? F_true : F_false;
f_array_length_t i = 0;
f_array_length_t slash_count = 0;
if (range->start >= content.used || range->start > range->stop || content.string[range->start] == f_fss_eol_s.string[0]) {
- if (content.string[range->start] == f_fss_eol_s.string[0]) {
+ if (content.string[range->start] == f_fss_eol_s.string[0] && prepend) {
do_prepend = F_true;
ends_on_eol = F_true;
}
do_prepend = F_false;
}
- if (content.string[range->start] == f_fss_eol_s.string[0]) {
+ if (content.string[range->start] == f_fss_eol_s.string[0] && prepend) {
do_prepend = F_true;
ends_on_eol = F_true;
}
* If f_fss_complete_full_e, this will write any appropriate open and close aspects of this content, including the final newline.
* @param prepend
* A string of whitespace to prepend at the start of each line.
- * This should only be whitespace, anything else could product invalid content.
+ * This should only be whitespace, anything else could produce invalid content.
* Set the pointer address to 0 to disable.
* @param ignore
* An optional list of ranges within the string to ignore.
const f_array_length_t delimits_used = delimits->used;
uint8_t content_found = 0;
+ f_fss_quote_t quoted = 0;
while (range->start <= range->stop && range->start < buffer.used) {
f_string_range_t content_partial = f_string_range_t_initialize;
- f_fss_quote_t quoted = 0;
+
+ quoted = 0;
status = private_fl_fss_basic_read(buffer, F_false, state, range, &content_partial, "ed, delimits);
++found->used;
if (quotes) {
- quotes->array[quotes->used] = quoted;
+ quotes->array[quotes->used] = quoted == f_fss_quote_type_double_e ? f_string_ascii_quote_double_s.string[0] : f_string_ascii_quote_single_s.string[0];
quotes->used = found->used;
}
}
content_found = 2;
+
break;
}
else if (status == F_data_not_stop) {
}
content_found = 2;
+
break;
}
else if (status == F_terminated_not_group_eos || status == F_terminated_not_group_eos) {
if (content_found) {
content_found = 2;
}
+
break;
}
else if (F_status_is_error(status)) {
#endif // _di_fl_fss_extended_content_read_
#ifndef _di_fl_fss_extended_object_write_
-f_status_t fl_fss_extended_object_write(const f_string_static_t object, const f_fss_quote_t quote, const uint8_t complete, f_state_t state, f_string_range_t *range, f_string_dynamic_t *destination) {
+f_status_t fl_fss_extended_object_write(const f_string_static_t object, const f_fss_quote_t quoted, const uint8_t complete, f_state_t state, f_string_range_t *range, f_string_dynamic_t *destination) {
#ifndef _di_level_1_parameter_checking_
if (!range) return F_status_set_error(F_parameter);
if (!destination) return F_status_set_error(F_parameter);
const f_array_length_t used_start = destination->used;
- f_status_t status = private_fl_fss_basic_write(F_true, object, quote ? quote : f_fss_delimit_quote_double_s.string[0], state, range, destination);
+ f_status_t status = private_fl_fss_basic_write(F_true, object, quoted ? quoted : f_fss_delimit_quote_double_s.string[0], state, range, destination);
if (status == F_data_not_stop || status == F_data_not_eos) {
const f_status_t status_allocation = f_string_dynamic_increase_by(2, destination);
if (F_status_is_error(status_allocation)) return status_allocation;
- destination->string[destination->used++] = quote ? quote : f_fss_delimit_quote_double_s.string[0];
- destination->string[destination->used++] = quote ? quote : f_fss_delimit_quote_double_s.string[0];
+ destination->string[destination->used++] = quoted ? f_fss_delimit_quote_single_s.string[0] : f_fss_delimit_quote_double_s.string[0];
+ destination->string[destination->used++] = quoted ? f_fss_delimit_quote_single_s.string[0] : f_fss_delimit_quote_double_s.string[0];
}
if (complete == f_fss_complete_partial_e || complete == f_fss_complete_partial_trim_e || complete == f_fss_complete_full_e || complete == f_fss_complete_full_trim_e) {
f_status_t status2 = F_none;
if (complete == f_fss_complete_full_trim_e) {
- status2 = private_fl_fss_basic_write_object_trim(quote ? quote : f_fss_delimit_quote_double_s.string[0], used_start, state, destination);
+ status2 = private_fl_fss_basic_write_object_trim(quoted ? quoted : f_fss_delimit_quote_double_s.string[0], used_start, state, destination);
if (F_status_is_error(status2)) return status2;
}
#endif // _di_fl_fss_extended_object_write_
#ifndef _di_fl_fss_extended_content_write_
- f_status_t fl_fss_extended_content_write(const f_string_static_t content, const f_fss_quote_t quote, const uint8_t complete, f_state_t state, f_string_range_t *range, f_string_dynamic_t *destination) {
+ f_status_t fl_fss_extended_content_write(const f_string_static_t content, const f_fss_quote_t quoted, const uint8_t complete, f_state_t state, f_string_range_t *range, f_string_dynamic_t *destination) {
#ifndef _di_level_1_parameter_checking_
if (!range) return F_status_set_error(F_parameter);
if (!destination) return F_status_set_error(F_parameter);
#endif // _di_level_1_parameter_checking_
- // this operates exactly like an object, syntax-wise.
- const f_status_t status = private_fl_fss_basic_write(F_false, content, quote ? quote : f_fss_delimit_quote_double_s.string[0], state, range, destination);
+ // This operates exactly like an object, syntax-wise.
+ const f_status_t status = private_fl_fss_basic_write(F_false, content, quoted ? quoted : f_fss_delimit_quote_double_s.string[0], state, range, destination);
if (status == F_data_not_stop || status == F_data_not_eos) {
- // content that is empty must be represented by a quoted empty string.
+ // Content that is empty must be represented by a quoted empty string.
const f_status_t status_allocation = f_string_dynamic_increase_by(4, destination);
if (F_status_is_error(status_allocation)) return status_allocation;
- destination->string[destination->used++] = quote ? quote : f_fss_delimit_quote_double_s.string[0];
- destination->string[destination->used++] = quote ? quote : f_fss_delimit_quote_double_s.string[0];
+ destination->string[destination->used++] = quoted ? f_fss_delimit_quote_single_s.string[0] : f_fss_delimit_quote_double_s.string[0];
+ destination->string[destination->used++] = quoted ? f_fss_delimit_quote_single_s.string[0] : f_fss_delimit_quote_double_s.string[0];
- // content should be terminated, even if empty.
+ // Content should be terminated, even if empty.
if (complete == f_fss_complete_partial_e || complete == f_fss_complete_partial_trim_e || complete == f_fss_complete_full_e || complete == f_fss_complete_full_trim_e || complete == f_fss_complete_next_e) {
destination->string[destination->used++] = f_fss_extended_next_s.string[0];
}
*
* @param object
* The string to write as (does not stop at NULLS, they are ignored and not written).
- * @param quote
+ * @param quoted
* If 0, then double quotes are auto-inserted, when required.
* Otherwise, this is the type of quote to wrap the object in when writing.
* @param complete
* Errors (with error bit) from: f_utf_buffer_increment().
*/
#ifndef _di_fl_fss_extended_object_write_
- extern f_status_t fl_fss_extended_object_write(const f_string_static_t object, const f_fss_quote_t quote, const uint8_t complete, f_state_t state, f_string_range_t *range, f_string_dynamic_t *destination);
+ extern f_status_t fl_fss_extended_object_write(const f_string_static_t object, const f_fss_quote_t quoted, const uint8_t complete, f_state_t state, f_string_range_t *range, f_string_dynamic_t *destination);
#endif // _di_fl_fss_extended_object_write_
/**
*
* @param content
* The string to write as (does not stop at NULLS, they are ignored and not written).
- * @param quote
+ * @param quoted
* If 0, then double quotes are auto-inserted, when required.
* Otherwise, this is the type of quote to wrap the object in when writing.
* @param complete
* Errors (with error bit) from: f_utf_buffer_increment().
*/
#ifndef _di_fl_fss_extended_content_write_
- extern f_status_t fl_fss_extended_content_write(const f_string_static_t content, const f_fss_quote_t quote, const uint8_t complete, f_state_t state, f_string_range_t *range, f_string_dynamic_t *destination);
+ extern f_status_t fl_fss_extended_content_write(const f_string_static_t content, const f_fss_quote_t quoted, const uint8_t complete, f_state_t state, f_string_range_t *range, f_string_dynamic_t *destination);
#endif // _di_fl_fss_extended_content_write_
#ifdef __cplusplus
bool is_comment = F_false;
bool ends_on_eol = F_false;
bool has_graph = F_false;
- bool do_prepend = F_true;
+ bool do_prepend = prepend ? F_true : F_false;
f_array_length_t i = 0;
f_array_length_t slash_count = 0;
if (content.string[range->start] == f_fss_eol_s.string[0] || range->start >= content.used || range->start > range->stop) {
- if (content.string[range->start] == f_fss_eol_s.string[0]) {
+ if (content.string[range->start] == f_fss_eol_s.string[0] && prepend) {
do_prepend = F_true;
ends_on_eol = F_true;
}
do_prepend = F_false;
}
- if (content.string[range->start] == f_fss_eol_s.string[0]) {
+ if (content.string[range->start] == f_fss_eol_s.string[0] && prepend) {
do_prepend = F_true;
ends_on_eol = F_true;
}
* If f_fss_complete_full_e, this will write any appropriate open and close aspects of this content, including the final newline.
* @param prepend
* A string of whitespace to prepend at the start of each line.
- * This should only be whitespace, anything else could product invalid content.
+ * This should only be whitespace, anything else could produce invalid content.
* Set the pointer address to 0 to disable.
* @param ignore
* An optional list of ranges within the string to ignore.
#endif
#if !defined(_di_fl_fss_basic_object_write_) || !defined(_di_fl_fss_extended_object_write_)
- f_status_t private_fl_fss_basic_write_object_trim(const f_fss_quote_t quote, const f_array_length_t used_start, f_state_t state, f_string_dynamic_t *destination) {
+ f_status_t private_fl_fss_basic_write_object_trim(const f_fss_quote_t quoted, const f_array_length_t used_start, f_state_t state, f_string_dynamic_t *destination) {
f_status_t status = F_none;
f_string_range_t destination_range = macro_f_string_range_t_initialize(destination->used);
f_array_length_t i = 0;
uint8_t width = 0;
+ const char quote_char = quoted == f_fss_quote_type_double_e ? f_string_ascii_quote_double_s.string[0] : f_string_ascii_quote_single_s.string[0];
// If there are any spaces, then this will be quoted so find the first non-placeholder character.
for (; destination_range.start < destination->used; ++destination_range.start) {
if (destination->string[destination_range.start] != f_fss_delimit_placeholder_s.string[0]) break;
} // for
- if (destination->string[destination_range.start] == quote) {
+ if (destination->string[destination_range.start] == quote_char) {
const f_array_length_t front = destination_range.start;
for (++destination_range.start; destination_range.start < destination->used; ++destination_range.start) {
}
}
- if (destination->string[destination_range.start] == quote) {
+ if (destination->string[destination_range.start] == quote_char) {
--destination_range.start;
break;
}
#endif // !defined(_di_fl_fss_basic_list_object_write_) || !defined(_di_fl_fss_extended_list_object_write_)
#if !defined(_di_fl_fss_basic_object_read_) || !defined(_di_fl_fss_extended_object_read_) || !defined(_di_fl_fss_extended_content_read_)
- f_status_t private_fl_fss_basic_read(const f_string_static_t buffer, const bool object_as, f_state_t state, f_string_range_t *range, f_fss_object_t *found, f_fss_quote_t *quote, f_fss_delimits_t *delimits) {
+ f_status_t private_fl_fss_basic_read(const f_string_static_t buffer, const bool object_as, f_state_t state, f_string_range_t *range, f_fss_object_t *found, f_fss_quote_t *quoted, f_fss_delimits_t *delimits) {
f_status_t status = f_fss_skip_past_space(buffer, range);
if (F_status_is_error(status)) return status;
// Handle quoted support.
char quote_found = 0;
- if (quote) {
- *quote = 0;
+ if (quoted) {
+ *quoted = 0;
}
// Identify where the object begins.
}
if (status == F_true) {
- if (quote) {
+ if (quoted) {
if (quote_found == f_fss_delimit_quote_single_s.string[0]) {
- *quote = f_fss_quote_type_single_e;
+ *quoted = f_fss_quote_type_single_e;
}
else if (quote_found == f_fss_delimit_quote_double_s.string[0]) {
- *quote = f_fss_quote_type_double_e;
+ *quoted = f_fss_quote_type_double_e;
}
}
range->start = location;
if (status == F_true) {
- if (quote) {
+ if (quoted) {
if (quote_found == f_fss_delimit_quote_single_s.string[0]) {
- *quote = f_fss_quote_type_single_e;
+ *quoted = f_fss_quote_type_single_e;
}
else if (quote_found == f_fss_delimit_quote_double_s.string[0]) {
- *quote = f_fss_quote_type_double_e;
+ *quoted = f_fss_quote_type_double_e;
}
}
#endif // !defined(_di_fl_fss_basic_object_read_) || !defined(_di_fl_fss_extended_object_read_)
#if !defined(_di_fl_fss_basic_object_write_) || !defined(_di_fl_fss_extended_object_write_) || !defined(_di_fl_fss_extended_content_write_)
- f_status_t private_fl_fss_basic_write(const bool object_as, const f_string_static_t object, const f_fss_quote_t quote, f_state_t state, f_string_range_t *range, f_string_dynamic_t *destination) {
+ f_status_t private_fl_fss_basic_write(const bool object_as, const f_string_static_t object, const f_fss_quote_t quoted, f_state_t state, f_string_range_t *range, f_string_dynamic_t *destination) {
f_status_t status = f_fss_skip_past_space(object, range);
if (F_status_is_error(status)) return status;
const f_array_length_t input_start = range->start;
const f_array_length_t used_start = destination->used;
- bool quoted = F_false;
+ bool quoted_is = F_false;
bool commented = F_false;
f_array_length_t item_first = 0;
f_array_length_t item_total = 0;
f_array_length_t i = 0;
+ const char quote_char = quoted == f_fss_quote_type_double_e ? f_string_ascii_quote_double_s.string[0] : f_string_ascii_quote_single_s.string[0];
+
// Use placeholders for potential quote and potential delimited quote to avoid doing things such as memmove().
destination->string[destination->used++] = f_fss_delimit_placeholder_s.string[0];
destination->string[destination->used++] = f_fss_delimit_placeholder_s.string[0];
// If there is an initial quote, then this must be quoted and the existing quote must be delimited.
- if (object.string[input_start] == quote) {
- quoted = F_true;
+ if (object.string[input_start] == quote_char) {
+ quoted_is = F_true;
}
else if (object_as && object.string[input_start] == f_fss_comment_s.string[0]) {
commented = F_true;
if (range->start > range->stop || range->start >= object.used) {
// Slashes before the final quote must be escaped when quoted, add the delimit slashes.
- if (quoted) {
+ if (quoted_is) {
// If this is the first quote, then only a single delimit slash is needed.
if (item_first == input_start) {
break;
}
- if (object.string[range->start] == quote) {
+ if (object.string[range->start] == quote_char) {
item_first = range->start++;
status = f_fss_skip_past_delimit(object, range);
destination->string[destination->used++] = f_fss_delimit_slash_s.string[0];
} // for
- destination->string[destination->used++] = quote;
+ destination->string[destination->used++] = quote_char;
break;
}
if (F_status_is_error(status)) break;
if (status == F_true) {
- quoted = F_true;
+ quoted_is = F_true;
status = f_string_dynamic_increase_by(item_total, destination);
if (F_status_is_error(status)) break;
destination->string[destination->used++] = f_fss_delimit_slash_s.string[0];
} // for
- destination->string[destination->used++] = quote;
+ destination->string[destination->used++] = quote_char;
for (i = 0; i < width; ++i) {
destination->string[destination->used++] = object.string[range->start + i];
if (F_status_is_error(status)) break;
if (status == F_true) {
- quoted = F_true;
+ quoted_is = F_true;
}
width = macro_f_utf_byte_width(object.string[range->start]);
} // for
}
}
- else if (object.string[range->start] == quote) {
+ else if (object.string[range->start] == quote_char) {
item_first = range->start++;
// The very first quote, must be escaped, when quoting is disabled.
status = f_string_dynamic_increase(state.step_large, destination);
if (F_status_is_error(status)) break;
- destination->string[destination->used++] = quote;
+ destination->string[destination->used++] = quote_char;
break;
}
- if (object.string[range->start] == quote) {
+ if (object.string[range->start] == quote_char) {
status = f_string_dynamic_increase(state.step_large, destination);
if (F_status_is_error(status)) break;
- destination->string[destination->used++] = quote;
+ destination->string[destination->used++] = quote_char;
// The next quote must also be checked, so do not increment.
continue;
destination->string[destination->used++] = f_fss_delimit_slash_s.string[0];
}
- quoted = F_true;
+ quoted_is = F_true;
}
width = macro_f_utf_byte_width(object.string[range->start]);
status = f_string_dynamic_increase_by(1 + width, destination);
if (F_status_is_error(status)) break;
- destination->string[destination->used++] = quote;
+ destination->string[destination->used++] = quote_char;
for (i = 0; i < width; ++i) {
destination->string[destination->used++] = object.string[range->start + i];
break;
}
else if (object.string[range->start] != f_fss_delimit_placeholder_s.string[0]) {
- if (!quoted) {
+ if (!quoted_is) {
status = f_fss_is_space(object, *range);
if (F_status_is_error(status)) break;
if (status == F_true) {
- quoted = F_true;
+ quoted_is = F_true;
}
}
return status;
}
- if (quoted) {
+ if (quoted_is) {
status = f_string_dynamic_increase(state.step_large, destination);
if (F_status_is_error(status)) {
return status;
}
- destination->string[used_start] = quote;
- destination->string[destination->used++] = quote;
+ destination->string[used_start] = quote_char;
+ destination->string[destination->used++] = quote_char;
// The start quote may or may not need to be delimited in this case.
- if (destination->string[input_start] == quote) {
+ if (destination->string[input_start] == quote_char) {
for (i = input_start + 1; i <= range->stop && i < object.used; ++i) {
/**
* Trim a given object used by the basic and extended object write functions.
*
- * @param quote
+ * @param quoted
* If 0, then double quotes are auto-inserted, when required.
* Otherwise, this is the type of quote to wrap the object in when writing.
* @param used_start
* @see fl_fss_extended_object_write()
*/
#if !defined(_di_fl_fss_basic_object_write_) || !defined(_di_fl_fss_extended_object_write_)
- extern f_status_t private_fl_fss_basic_write_object_trim(const f_fss_quote_t quote, const f_array_length_t used_start, f_state_t state, f_string_dynamic_t *destination) F_attribute_visibility_internal_d;
+ extern f_status_t private_fl_fss_basic_write_object_trim(const f_fss_quote_t quoted, const f_array_length_t used_start, f_state_t state, f_string_dynamic_t *destination) F_attribute_visibility_internal_d;
#endif // !defined(_di_fl_fss_basic_object_write_) || !defined(_di_fl_fss_extended_object_write_)
/**
*
* Set to at least 4 to provide a UTF-8 friendly allocation step.
*/
-#ifndef _di_fake_default_allocation_step_
+#ifndef _di_fake_default_allocation_
#define fake_default_allocation_large_d 64
#define fake_default_allocation_small_d 8
-#endif // _di_fake_default_allocation_step_
+#endif // _di_fake_default_allocation_
/**
* The build operation utilizes pre-defined path structures.
#ifndef _di_fss_basic_list_write_defines_
#define fss_basic_list_write_signal_check_d 10000
- #define FSS_BASIC_LIST_WRITE_pipe_content_end_s '\f'
- #define FSS_BASIC_LIST_WRITE_pipe_content_ignore_s '\v'
- #define FSS_BASIC_LIST_WRITE_pipe_content_start_s '\b'
+ #define FSS_BASIC_LIST_WRITE_pipe_content_end_s "\f"
+ #define FSS_BASIC_LIST_WRITE_pipe_content_ignore_s "\v"
+ #define FSS_BASIC_LIST_WRITE_pipe_content_start_s "\b"
#define FSS_BASIC_LIST_WRITE_pipe_content_end_s_length 1
#define FSS_BASIC_LIST_WRITE_pipe_content_ignore_s_length 1
output.id = -1;
output.stream = 0;
- status = f_file_stream_open(argv[index], f_string_static_empty_s, &output);
+ status = f_file_stream_open(main->parameters.arguments.array[index], f_string_empty_s, &output);
if (F_status_is_error(status)) {
- fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, argv[index], f_file_operation_open_s, fll_error_file_type_file_e);
+ fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, main->parameters.arguments.array[index], f_file_operation_open_s, fll_error_file_type_file_e);
}
}
}
else if (main->parameters.array[fss_basic_list_write_parameter_prepend_e].result == f_console_result_additional_e) {
const f_array_length_t index = main->parameters.array[fss_basic_list_write_parameter_prepend_e].values.array[main->parameters.array[fss_basic_list_write_parameter_prepend_e].values.used - 1];
- if (argv[index].used) {
- f_string_range_t range = macro_f_string_range_t_initialize(argv[index].used);
+ if (main->parameters.arguments.array[index].used) {
+ f_string_range_t range = macro_f_string_range_t_initialize(main->parameters.arguments.array[index].used);
- for (; range.start < argv[index].used; ++range.start) {
+ for (; range.start < main->parameters.arguments.array[index].used; ++range.start) {
- status = f_fss_is_space(argv[index], range);
+ status = f_fss_is_space(main->parameters.arguments.array[index], range);
if (F_status_is_error(status)) break;
if (status == F_false) {
}
}
- f_fss_quote_t quote = F_fss_delimit_quote_double_s;
+ f_fss_quote_t quoted = f_fss_quote_type_double_e;
if (F_status_is_error_not(status)) {
if (main->parameters.array[fss_basic_list_write_parameter_double_e].result == f_console_result_found_e) {
if (main->parameters.array[fss_basic_list_write_parameter_single_e].result == f_console_result_found_e) {
if (main->parameters.array[fss_basic_list_write_parameter_double_e].location < main->parameters.array[fss_basic_list_write_parameter_single_e].location) {
- quote = F_fss_delimit_quote_single_s;
+ quoted = f_fss_quote_type_single_e;
}
}
}
else if (main->parameters.array[fss_basic_list_write_parameter_single_e].result == f_console_result_found_e) {
- quote = F_fss_delimit_quote_single_s;
+ quoted = f_fss_quote_type_single_e;
}
}
if (F_status_is_error_not(status)) {
if (main->process_pipe) {
- status = fss_basic_list_write_process_pipe(main, output, quote, &buffer);
+ status = fss_basic_list_write_process_pipe(main, output, quoted, &buffer);
if (F_status_is_error(status)) {
if (main->error.verbosity != f_console_verbosity_quiet_e) {
}
if (F_status_is_error_not(status)) {
- if (main->parameters.array[fss_basic_list_write_parameter_partial_e].result == f_console_result_found_e) {
+ f_array_length_t index = 0;
+ if (main->parameters.array[fss_basic_list_write_parameter_partial_e].result == f_console_result_found_e) {
if (main->parameters.array[fss_basic_list_write_parameter_object_e].result == f_console_result_additional_e) {
for (f_array_length_t i = 0; i < main->parameters.array[fss_basic_list_write_parameter_object_e].values.used; ++i) {
break;
}
- status = fss_basic_list_write_process(main, output, quote, &argv[main->parameters.array[fss_basic_list_write_parameter_object_e].values.array[i]], 0, &buffer);
+ index = main->parameters.array[fss_basic_list_write_parameter_object_e].values.array[i];
+
+ status = fss_basic_list_write_process(main, output, quoted, &main->parameters.arguments.array[index], 0, &buffer);
if (F_status_is_error(status)) break;
} // for
}
break;
}
- status = fss_basic_list_write_process(main, output, quote, 0, &argv[main->parameters.array[fss_basic_list_write_parameter_content_e].values.array[i]], &buffer);
+ index = main->parameters.array[fss_basic_list_write_parameter_content_e].values.array[i];
+
+ status = fss_basic_list_write_process(main, output, quoted, 0, &main->parameters.arguments.array[index], &buffer);
if (F_status_is_error(status)) break;
} // for
}
break;
}
- status = fss_basic_list_write_process(main, output, quote, &argv[main->parameters.array[fss_basic_list_write_parameter_object_e].values.array[i]], &argv[main->parameters.array[fss_basic_list_write_parameter_content_e].values.array[i]], &buffer);
+ index = main->parameters.array[fss_basic_list_write_parameter_object_e].values.array[i];
+
+ status = fss_basic_list_write_process(main, output, quoted, &main->parameters.arguments.array[index], &main->parameters.arguments.array[main->parameters.array[fss_basic_list_write_parameter_content_e].values.array[i]], &buffer);
if (F_status_is_error(status)) break;
} // for
}
#endif // _di_fss_basic_list_write_error_parameter_value_missing_print_
#ifndef _di_fss_basic_list_write_process_
- f_status_t fss_basic_list_write_process(fll_program_data_t * const main, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, f_string_dynamic_t *buffer) {
+ f_status_t fss_basic_list_write_process(fll_program_data_t * const main, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, f_string_dynamic_t * const buffer) {
f_status_t status = F_none;
f_state_t state = macro_f_state_t_initialize(fss_basic_list_write_common_allocation_large_d, fss_basic_list_write_common_allocation_small_d, 0, 0, 0, 0, 0);
range.start = 0;
range.stop = content->used - 1;
- status = fl_fss_basic_list_content_write(*content, object ? f_fss_complete_full_e : f_fss_complete_none_e, &main->prepend, state, &range, buffer);
+ f_string_static_t *prepend = 0;
+
+ if (main->parameters.array[fss_basic_list_write_parameter_prepend_e].result == f_console_result_additional_e) {
+ const f_array_length_t index = main->parameters.array[fss_basic_list_write_parameter_prepend_e].values.array[main->parameters.array[fss_basic_list_write_parameter_prepend_e].values.used - 1];
+
+ prepend = &main->parameters.arguments.array[index];
+ }
+
+ status = fl_fss_basic_list_content_write(*content, object ? f_fss_complete_full_e : f_fss_complete_none_e, prepend, state, &range, buffer);
if (F_status_is_error(status)) {
fll_error_print(main->error, F_status_set_fine(status), "fl_fss_basic_list_content_write", F_true);
}
if (!object || !content) {
- status = f_string_append(f_string_eol_s, 1, buffer);
+ status = f_string_dynamic_append(f_string_eol_s, buffer);
if (F_status_is_error(status)) {
- fll_error_print(main->error, F_status_set_fine(status), "f_string_append", F_true);
+ fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_append", F_true);
return status;
}
#endif // _di_fss_basic_list_write_process_
#ifndef _di_fss_basic_list_write_process_pipe_
- f_status_t fss_basic_list_write_process_pipe(fll_program_data_t * const main, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer) {
+ f_status_t fss_basic_list_write_process_pipe(fll_program_data_t * const main, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t * const buffer) {
f_status_t status = F_none;
f_status_t status_pipe = F_none;
for (; range.start <= range.stop; ++range.start) {
- if (block.string[range.start] == fss_basic_list_write_pipe_content_start_s) {
+ if (block.string[range.start] == fss_basic_list_write_pipe_content_start_s.string[0]) {
state = 0x2;
++range.start;
break;
}
- if (block.string[range.start] == fss_basic_list_write_pipe_content_end_s) {
+ if (block.string[range.start] == fss_basic_list_write_pipe_content_end_s.string[0]) {
state = 0x3;
++range.start;
break;
}
- if (block.string[range.start] == fss_basic_list_write_pipe_content_ignore_s) {
+ if (block.string[range.start] == fss_basic_list_write_pipe_content_ignore_s.string[0]) {
// This is not used by objects.
continue;
for (; range.start <= range.stop; ++range.start) {
- if (block.string[range.start] == fss_basic_list_write_pipe_content_start_s) {
+ if (block.string[range.start] == fss_basic_list_write_pipe_content_start_s.string[0]) {
if (main->error.verbosity != f_console_verbosity_quiet_e) {
fll_print_format("%r%[%sThis standard only supports one content per object.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s);
}
break;
}
- if (block.string[range.start] == fss_basic_list_write_pipe_content_end_s) {
+ if (block.string[range.start] == fss_basic_list_write_pipe_content_end_s.string[0]) {
state = 0x3;
++range.start;
break;
}
- if (block.string[range.start] == fss_basic_list_write_pipe_content_ignore_s) {
+ if (block.string[range.start] == fss_basic_list_write_pipe_content_ignore_s.string[0]) {
// This is not used by this program.
continue;
* F_failure (with error bit) for any othe failure.
*/
#ifndef _di_fss_basic_list_write_process_
- extern f_status_t fss_basic_list_write_process(fll_program_data_t * const main, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, f_string_dynamic_t *buffer) F_attribute_visibility_internal_d;
+ extern f_status_t fss_basic_list_write_process(fll_program_data_t * const main, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, f_string_dynamic_t * const buffer) F_attribute_visibility_internal_d;
#endif // _di_fss_basic_list_write_process_
/**
* F_failure (with error bit) for any othe failure.
*/
#ifndef _di_fss_basic_list_write_process_pipe_
- extern f_status_t fss_basic_list_write_process_pipe(fll_program_data_t * const main, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer) F_attribute_visibility_internal_d;
+ extern f_status_t fss_basic_list_write_process_pipe(fll_program_data_t * const main, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t * const buffer) F_attribute_visibility_internal_d;
#endif // _di_fss_basic_list_write_process_pipe_
#ifdef __cplusplus
}
if (!object || !content) {
- status = f_string_append(f_string_eol_s, 1, buffer);
+ status = f_string_dynamic_append(f_string_eol_s, buffer);
if (F_status_is_error(status)) {
- fll_error_print(main->error, F_status_set_fine(status), "f_string_append", F_true);
+ fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_append", F_true);
return status;
}
}
if (!object || !content) {
- status = f_string_append(f_string_eol_s, 1, buffer);
+ status = f_string_dynamic_append(f_string_eol_s, buffer);
if (F_status_is_error(status)) {
- fll_error_print(main->error, F_status_set_fine(status), "f_string_append", F_true);
+ fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_append", F_true);
return status;
}
}
if (!object || !content) {
- status = f_string_append(f_string_eol_s, 1, buffer);
+ status = f_string_dynamic_append(f_string_eol_s, buffer);
if (F_status_is_error(status)) {
- fll_error_print(main->error, F_status_set_fine(status), "f_string_append", F_true);
+ fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_append", F_true);
return status;
}
}
}
else if (!object) {
- status = f_string_append(f_string_eol_s, 1, buffer);
+ status = f_string_dynamic_append(f_string_eol_s, buffer);
if (F_status_is_error(status)) {
- fll_error_print(main->error, F_status_set_fine(status), "f_string_append", F_true);
+ fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_append", F_true);
return status;
}
}
if (!object || !content) {
- status = f_string_append(f_string_eol_s, 1, buffer);
+ status = f_string_dynamic_append(f_string_eol_s, buffer);
if (F_status_is_error(status)) {
- fll_error_print(main->error, F_status_set_fine(status), "f_string_append", F_true);
+ fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_append", F_true);
return status;
}