Enable detection of quotes when processing extended content within the lists inside of the fakefile (except for the settings list).
fss-quoted.h must come before fss-named.h.
Be sure to include level_0/type_array.h.
Fix mistake in f_macro_uintX_tss_new() macros where the f_macro_memory_structures_new() has the wrong arguments.
Use fll_fss_snatch_map_apart() instead of fll_fss_snatch_map_mash_apart() when expanding iki variables.
The arguments need to be separated so they can potentially be passed to an exec() equivalent call as individual arguments.
Any operation that expects a single argument can still implode these strings before executing.
#endif
/**
- * This holds a named set of fss objects and contents.
+ * This holds a named set of fss objects, contents, and quotedss.
*
- * The objects and contents should each be of the same used and size.
+ * The objects, contents, and quotedss should each be of the same used and size.
* Any deviation to this would require implementing custom equivelents to the standard management macros.
*
* object: The name representing this set.
* objects: The array of objects.
* contents: The array of contents.
+ * quotedss: The array of quoted for each content.
*/
#ifndef _di_f_fss_named_
typedef struct {
f_fss_objects objects;
f_fss_contents contents;
+ f_fss_quotedss quotedss;
} f_fss_named;
- #define f_fss_named_initialize { f_fss_object_initialize, f_fss_objects_initialize, f_fss_contents_initialize }
+ #define f_fss_named_initialize { f_fss_object_initialize, f_fss_objects_initialize, f_fss_contents_initialize, f_fss_quotedss_initialize }
#define f_macro_fss_named_clear(set) \
f_macro_fss_object_clear(set.object) \
f_macro_fss_objects_clear(set.objects) \
- f_macro_fss_contents_clear(set.contents)
+ f_macro_fss_contents_clear(set.contents) \
+ f_macro_fss_quotedss_clear(set.quotedss)
#define f_macro_fss_named_new(status, set, length) \
f_macro_fss_objects_new(status, set.objects, length) \
if (F_status_is_fine(status)) { \
f_macro_fss_contents_new(status, set.contents, length) \
+ } \
+ if (F_status_is_fine(status)) { \
+ f_macro_fss_quotedss_new(status, set.quotedss, length) \
}
#define f_macro_fss_named_delete(status, set) \
f_macro_fss_objects_delete(status, set.objects) \
if (F_status_is_fine(status)) { \
f_macro_fss_contents_delete(status, set.contents) \
+ } \
+ if (F_status_is_fine(status)) { \
+ f_macro_fss_quotedss_delete(status, set.quotedss) \
}
#define f_macro_fss_named_destroy(status, set) \
f_macro_fss_objects_destroy(status, set.objects) \
if (F_status_is_fine(status)) { \
f_macro_fss_contents_destroy(status, set.contents) \
+ } \
+ if (F_status_is_fine(status)) { \
+ f_macro_fss_quotedss_destroy(status, set.quotedss) \
}
#define f_macro_fss_named_delete_simple(set) \
f_macro_fss_objects_delete_simple(set.objects) \
- f_macro_fss_contents_delete_simple(set.contents)
+ f_macro_fss_contents_delete_simple(set.contents) \
+ f_macro_fss_quotedss_delete_simple(set.quotedss)
#define f_macro_fss_named_destroy_simple(set) \
f_macro_fss_objects_destroy_simple(set.objects) \
- f_macro_fss_contents_destroy_simple(set.contents)
+ f_macro_fss_contents_destroy_simple(set.contents) \
+ f_macro_fss_quotedss_destroy_simple(set.quotedss)
#define f_macro_fss_named_resize(status, set, new_length) \
f_macro_fss_objects_resize(status, set.objects, new_length) \
if (F_status_is_fine(status)) { \
f_macro_fss_contents_resize(status, set.contents, new_length) \
+ } \
+ if (F_status_is_fine(status)) { \
+ f_macro_fss_quotedss_resize(status, set.quotedss, new_length) \
}
#define f_macro_fss_named_adjust(status, set, new_length) \
f_macro_fss_objects_adjust(status, set.objects, new_length) \
if (F_status_is_fine(status)) { \
f_macro_fss_contents_adjust(status, set.contents, new_length) \
+ } \
+ if (F_status_is_fine(status)) { \
+ f_macro_fss_quotedss_adjust(status, set.quotedss, new_length) \
}
#endif // _di_f_fss_named_
// fll-0 fss includes
#include <level_0/fss-common.h>
+#include <level_0/fss-quoted.h>
#include <level_0/fss-named.h>
#include <level_0/fss-nest.h>
-#include <level_0/fss-quoted.h>
#include <level_0/fss-set.h>
#ifdef __cplusplus
#define f_macro_array_lengthss_clear(lengths) f_macro_memory_structures_clear(lengths)
- #define f_macro_array_lengthss_new(status, lengths, length) f_macro_memory_structures_new(status, lengths, f_array_length, f_array_lengths, length)
+ #define f_macro_array_lengthss_new(status, lengths, length) f_macro_memory_structures_new(status, lengths, f_array_length, length)
#define f_macro_array_lengthss_delete(status, lengths) f_macro_memory_structures_delete(status, lengths, f_array_length, f_array_lengths)
#define f_macro_array_lengthss_destroy(status, lengths) f_macro_memory_structures_destroy(status, lengths, f_array_length, f_array_lengths)
#define f_macro_int8_tss_clear(numbers) f_macro_memory_structures_clear(numbers)
- #define f_macro_int8_tss_new(status, numbers, length) f_macro_memory_structures_new(status, numbers, int8_t, f_int8_ts, length)
+ #define f_macro_int8_tss_new(status, numbers, length) f_macro_memory_structures_new(status, numbers, int8_t, length)
#define f_macro_int8_tss_delete(status, numbers) f_macro_memory_structures_delete(status, numbers, int8_t, f_int8_ts)
#define f_macro_int8_tss_destroy(status, numbers) f_macro_memory_structures_destroy(status, numbers, int8_t, f_int8_ts)
#define f_macro_uint8_tss_clear(numbers) f_macro_memory_structures_clear(numbers)
- #define f_macro_uint8_tss_new(status, numbers, length) f_macro_memory_structures_new(status, numbers, uint8_t, f_uint8_ts, length)
+ #define f_macro_uint8_tss_new(status, numbers, length) f_macro_memory_structures_new(status, numbers, uint8_t, length)
#define f_macro_uint8_tss_delete(status, numbers) f_macro_memory_structures_delete(status, numbers, uint8_t, f_uint8_ts)
#define f_macro_uint8_tss_destroy(status, numbers) f_macro_memory_structures_destroy(status, numbers, uint8_t, f_uint8_ts)
#define f_macro_int16_tss_clear(numbers) f_macro_memory_structures_clear(numbers)
- #define f_macro_int16_tss_new(status, numbers, length) f_macro_memory_structures_new(status, numbers, int16_t, f_int16_ts, length)
+ #define f_macro_int16_tss_new(status, numbers, length) f_macro_memory_structures_new(status, numbers, int16_t, length)
#define f_macro_int16_tss_delete(status, numbers) f_macro_memory_structures_delete(status, numbers, int16_t, f_int16_ts)
#define f_macro_int16_tss_destroy(status, numbers) f_macro_memory_structures_destroy(status, numbers, int16_t, f_int16_ts)
#define f_macro_uint16_tss_clear(numbers) f_macro_memory_structures_clear(numbers)
- #define f_macro_uint16_tss_new(status, numbers, length) f_macro_memory_structures_new(status, numbers, uint16_t, f_uint16_ts, length)
+ #define f_macro_uint16_tss_new(status, numbers, length) f_macro_memory_structures_new(status, numbers, uint16_t, length)
#define f_macro_uint16_tss_delete(status, numbers) f_macro_memory_structures_delete(status, numbers, uint16_t, f_uint16_ts)
#define f_macro_uint16_tss_destroy(status, numbers) f_macro_memory_structures_destroy(status, numbers, uint16_t, f_uint16_ts)
#define f_macro_int32_tss_clear(numbers) f_macro_memory_structures_clear(numbers)
- #define f_macro_int32_tss_new(status, numbers, length) f_macro_memory_structures_new(status, numbers, int32_t, f_int32_ts, length)
+ #define f_macro_int32_tss_new(status, numbers, length) f_macro_memory_structures_new(status, numbers, int32_t, length)
#define f_macro_int32_tss_delete(status, numbers) f_macro_memory_structures_delete(status, numbers, int32_t, f_int32_ts)
#define f_macro_int32_tss_destroy(status, numbers) f_macro_memory_structures_destroy(status, numbers, int32_t, f_int32_ts)
#define f_macro_uint32_tss_clear(numbers) f_macro_memory_structures_clear(numbers)
- #define f_macro_uint32_tss_new(status, numbers, length) f_macro_memory_structures_new(status, numbers, uint32_t, f_uint32_ts, length)
+ #define f_macro_uint32_tss_new(status, numbers, length) f_macro_memory_structures_new(status, numbers, uint32_t, length)
#define f_macro_uint32_tss_delete(status, numbers) f_macro_memory_structures_delete(status, numbers, uint32_t, f_uint32_ts)
#define f_macro_uint32_tss_destroy(status, numbers) f_macro_memory_structures_destroy(status, numbers, uint32_t, f_uint32_ts)
#define f_macro_int64_tss_clear(numbers) f_macro_memory_structures_clear(numbers)
- #define f_macro_int64_tss_new(status, numbers, length) f_macro_memory_structures_new(status, numbers, int64_t, f_int64_ts, length)
+ #define f_macro_int64_tss_new(status, numbers, length) f_macro_memory_structures_new(status, numbers, int64_t, length)
#define f_macro_int64_tss_delete(status, numbers) f_macro_memory_structures_delete(status, numbers, int64_t, f_int64_ts)
#define f_macro_int64_tss_destroy(status, numbers) f_macro_memory_structures_destroy(status, numbers, int64_t, f_int64_ts)
#define f_macro_uint64_tss_clear(numbers) f_macro_memory_structures_clear(numbers)
- #define f_macro_uint64_tss_new(status, numbers, length) f_macro_memory_structures_new(status, numbers, uint64_t, f_uint64_ts, length)
+ #define f_macro_uint64_tss_new(status, numbers, length) f_macro_memory_structures_new(status, numbers, uint64_t, length)
#define f_macro_uint64_tss_delete(status, numbers) f_macro_memory_structures_delete(status, numbers, uint64_t, f_uint64_ts)
#define f_macro_uint64_tss_destroy(status, numbers) f_macro_memory_structures_destroy(status, numbers, uint64_t, f_uint64_ts)
#define f_macro_int128_tss_clear(numbers) f_macro_memory_structures_clear(numbers)
- #define f_macro_int128_tss_new(status, numbers, length) f_macro_memory_structures_new(status, numbers, __int128_t, f_int128_ts, length)
+ #define f_macro_int128_tss_new(status, numbers, length) f_macro_memory_structures_new(status, numbers, __int128_t, length)
#define f_macro_int128_tss_delete(status, numbers) f_macro_memory_structures_delete(status, numbers, __int128_t, f_int128_ts)
#define f_macro_int128_tss_destroy(status, numbers) f_macro_memory_structures_destroy(status, numbers, __int128_t, f_int128_ts)
#define f_macro_uint128_tss_clear(numbers) f_macro_memory_structures_clear(numbers)
- #define f_macro_uint128_tss_new(status, numbers, length) f_macro_memory_structures_new(status, numbers, __uint128_t, f_uint128_ts, length)
+ #define f_macro_uint128_tss_new(status, numbers, length) f_macro_memory_structures_new(status, numbers, __uint128_t, length)
#define f_macro_uint128_tss_delete(status, numbers) f_macro_memory_structures_delete(status, numbers, __uint128_t, f_uint128_ts)
#define f_macro_uint128_tss_destroy(status, numbers) f_macro_memory_structures_destroy(status, numbers, __uint128_t, f_uint128_ts)
#define f_macro_int128_tss_clear(numbers) f_macro_memory_structures_clear(numbers)
- #define f_macro_int128_tss_new(status, numbers, length) f_macro_memory_structures_new(status, numbers, int64_t, f_int128_ts, length)
+ #define f_macro_int128_tss_new(status, numbers, length) f_macro_memory_structures_new(status, numbers, int64_t, length)
#define f_macro_int128_tss_delete(status, numbers) f_macro_memory_structures_delete(status, numbers, int64_t, f_int128_ts)
#define f_macro_int128_tss_destroy(status, numbers) f_macro_memory_structures_destroy(status, numbers, int64_t, f_int128_ts)
#define f_macro_uint128_tss_clear(numbers) f_macro_memory_structures_clear(numbers)
- #define f_macro_uint128_tss_new(status, numbers, length) f_macro_memory_structures_new(status, numbers, uint64_t, f_uint128_ts, length)
+ #define f_macro_uint128_tss_new(status, numbers, length) f_macro_memory_structures_new(status, numbers, uint64_t, length)
#define f_macro_uint128_tss_delete(status, numbers) f_macro_memory_structures_delete(status, numbers, uint64_t, f_uint128_ts)
#define f_macro_uint128_tss_destroy(status, numbers) f_macro_memory_structures_destroy(status, numbers, uint64_t, f_uint128_ts)
// fll-0 includes
#include <level_0/type.h>
#include <level_0/status.h>
+#include <level_0/type_array.h>
#include <level_0/memory.h>
#include <level_0/string.h>
#include <level_0/utf.h>
continue;
}
- f_fss_quotedss quoted_contents = f_fss_quotedss_initialize;
-
content_range = list_contents.array[i].array[0];
- *status = fll_fss_extended_read(&data_make->buffer, &content_range, &settings.objects, &settings.contents, 0, "ed_contents);
+ *status = fll_fss_extended_read(&data_make->buffer, &content_range, &settings.objects, &settings.contents, 0, 0);
if (F_status_is_error(*status)) {
fake_print_error_fss(data.context, data.verbosity, *status, "fll_fss_extended_read", data.file_data_build_fakefile.string, content_range, F_true);
- f_macro_fss_quotedss_delete_simple(quoted_contents);
f_macro_fss_set_delete_simple(settings);
f_macro_fss_objects_delete_simple(list_objects);
f_macro_fss_contents_delete_simple(list_contents);
return;
}
- if (quoted_contents.used) {
- // @todo
- }
-
- f_macro_fss_quotedss_delete_simple(quoted_contents);
-
missing_settings = F_false;
continue;
}
content_range = list_contents.array[i].array[0];
- *status = fll_fss_extended_read(&data_make->buffer, &content_range, &data_make->fakefile.array[data_make->fakefile.used].objects, &data_make->fakefile.array[data_make->fakefile.used].contents, 0, 0);
+ *status = fll_fss_extended_read(&data_make->buffer, &content_range, &data_make->fakefile.array[data_make->fakefile.used].objects, &data_make->fakefile.array[data_make->fakefile.used].contents, 0, &data_make->fakefile.array[data_make->fakefile.used].quotedss);
if (F_status_is_error(*status)) {
fake_print_error_fss(data.context, data.verbosity, *status, "fll_fss_extended_read", data.file_data_build_fakefile.string, content_range, F_true);
&data_make->setting_make.parameter,
};
- *status = fll_fss_snatch_map_mash_apart(data_make->buffer, settings.objects, settings.contents, settings_name, settings_length, 2, " ", 1, settings_value, 0);
+ *status = fll_fss_snatch_map_apart(data_make->buffer, settings.objects, settings.contents, settings_name, settings_length, 2, settings_value, 0);
if (F_status_is_error(*status)) {
- fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fll_fss_snatch_map_mash_apart", F_true);
+ fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fll_fss_snatch_map_apart", F_true);
f_macro_fss_set_delete_simple(settings);
return;
#endif // _di_fake_make_operate_
#ifndef _di_fake_make_operation_expand_
- void fake_make_operation_expand(const fake_data data, const f_string_range section_name, const f_array_length operation, const f_string_static operation_name, const f_fss_content content, fake_make_data *data_make, f_string_dynamics *arguments, f_status *status) {
+ void fake_make_operation_expand(const fake_data data, const f_string_range section_name, const f_array_length operation, const f_string_static operation_name, const f_fss_content content, const f_fss_quoteds quoteds, fake_make_data *data_make, f_string_dynamics *arguments, f_status *status) {
if (F_status_is_error(*status)) return;
if (content.used == 0) return;
f_array_length k = 0;
f_array_length l = 0;
+ f_array_length used_arguments = 0;
+
f_string_length previous = 0;
for (; i < content.used; i++) {
+
if (content.array[i].start > content.array[i].stop) {
continue;
}
range = content.array[i];
+ used_arguments = arguments->used;
+
*status = fl_iki_read(&data_make->buffer, &range, &iki_variable, &iki_vocabulary, &iki_content);
if (F_status_is_error(*status)) {
fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_iki_read", F_true);
break;
}
- // @todo: consider designing a way to designate appending map as a single value string or multiple separate strings.
- // this could potential be done by considering single vs double quotes.
- // then arguments->used would have to be incremented based on this number.
if (map_multis->used) {
for (k = 0; k < map_multis->used; k++) {
*status = fl_string_dynamic_partial_compare_dynamic(map_multis->array[k].name, data_make->buffer, iki_content.array[j]);
if (*status == F_equal_to) {
if (map_multis->array[k].value.used) {
- for (l = 0; l < map_multis->array[k].value.used; l++) {
- if (l > 0) {
- *status = fl_string_append(" ", 1, &arguments->array[arguments->used]);
+ if (quoteds.array[i]) {
+ for (l = 0; l < map_multis->array[k].value.used; l++) {
+ if (l > 0) {
+ *status = fl_string_append(" ", 1, &arguments->array[arguments->used]);
+ if (F_status_is_error(*status)) {
+ fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_append", F_true);
+ break;
+ }
+ }
+
+ *status = fl_string_dynamic_append_nulless(map_multis->array[k].value.array[l], &arguments->array[arguments->used]);
if (F_status_is_error(*status)) {
- fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_append", F_true);
+ fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_dynamic_append_nulless", F_true);
+ break;
+ }
+ } // for
+ }
+ else {
+ if (arguments->used + map_multis->array[k].value.used > arguments->size) {
+ if (arguments->used + map_multis->array[k].value.used > F_buffer_too_large) {
+ *status = F_status_set_error(F_buffer_too_large);
+
+ fake_print_error(data.context, data.verbosity, F_buffer_too_large, "f_macro_string_dynamics_resize", F_true);
break;
}
- }
- *status = fl_string_dynamic_append_nulless(map_multis->array[k].value.array[l], &arguments->array[arguments->used]);
- if (F_status_is_error(*status)) {
- fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_dynamic_append_nulless", F_true);
- break;
+ f_macro_string_dynamics_resize((*status), (*arguments), arguments->used + map_multis->array[k].value.used);
+ if (F_status_is_error(*status)) {
+ fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "f_macro_string_dynamics_resize", F_true);
+ break;
+ }
}
- } // for
+
+ for (l = 0; l < map_multis->array[k].value.used; l++) {
+ *status = fl_string_dynamic_append_nulless(map_multis->array[k].value.array[l], &arguments->array[arguments->used]);
+ if (F_status_is_error(*status)) {
+ fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_dynamic_append_nulless", F_true);
+ break;
+ }
+
+ *status = fl_string_dynamic_terminate_after(&arguments->array[arguments->used]);
+ if (F_status_is_error(*status)) {
+ fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_terminate_after", F_true);
+ break;
+ }
+
+ arguments->used++;
+ } // for
+ }
}
break;
}
}
- *status = fl_string_dynamic_terminate_after(&arguments->array[arguments->used]);
- if (F_status_is_error(*status)) {
- fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_terminate_after", F_true);
- break;
- }
+ // if iki variable did not match (results in empty string) or iki variable is inside quotes, then increment.
+ if (used_arguments == arguments->used) {
+ *status = fl_string_dynamic_terminate_after(&arguments->array[arguments->used]);
+ if (F_status_is_error(*status)) {
+ fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_terminate_after", F_true);
+ break;
+ }
- arguments->used++;
+ arguments->used++;
+ }
f_macro_iki_variable_delete_simple(iki_variable);
f_macro_iki_vocabulary_delete_simple(iki_vocabulary);
operations[i] = operation;
- fake_make_operation_expand(data, section->name, operation, *operation_name, section->contents.array[i], data_make, &arguments[i], status);
+ fake_make_operation_expand(data, section->name, operation, *operation_name, section->contents.array[i], section->quotedss.array[i], data_make, &arguments[i], status);
if (F_status_is_error(*status)) {
has_error = F_true;
*status = F_none;
#endif // _di_fake_make_operate_
/**
- * Execute the make operation.
+ * For a given make operation section, expand the content into an arguments array.
*
* @param data
* The program data.
* @param section_name
+ * The section name.
* @param operation
+ * The operation being performed.
* @param operation_name
+ * The operation name.
* @param content
+ * The content array.
+ * @param quotedss
+ * The array of quoted associated with the content.
* @param data_make
* All make related setting data, including data from the fakefile and optionally build settings file.
* @param arguments
+ * The expanded arguments.
* @param section_id
* The array location id within the fakefile of the section to operate on.
* @param status
* Status codes (with error bit) are returned on any problem.
*/
#ifndef _di_fake_make_operation_expand_
- extern void fake_make_operation_expand(const fake_data data, const f_string_range section_name, const f_array_length operation, const f_string_static operation_name, const f_fss_content content, fake_make_data *data_make, f_string_dynamics *arguments, f_status *status) f_gcc_attribute_visibility_internal;
+ extern void fake_make_operation_expand(const fake_data data, const f_string_range section_name, const f_array_length operation, const f_string_static operation_name, const f_fss_content content, const f_fss_quoteds quoteds, fake_make_data *data_make, f_string_dynamics *arguments, f_status *status) f_gcc_attribute_visibility_internal;
#endif // _di_fake_make_operation_expand_
/**
parameter verbose4 +v and then " some"
main:
- print This is a line "(define = 'define:"example"') parameter:"verbose4"."
+ print This is a line "(define = 'define:"example"')." parameter:"verbose4"
invalid