The -R/--raw parameters designate that the quotes and the escapes should be preserved.
This allows for cleaning up a file and only pulling out valid FSS format and then provide that FSS in its originally escaped and quoted forms.
This further allows for maintaining quotes and escapes on Objects or Content individually.
fll_program_print_help_option(output, context, fss_basic_list_read_short_name, fss_basic_list_read_long_name, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select Object with this name.");
fll_program_print_help_option(output, context, fss_basic_list_read_short_object, fss_basic_list_read_long_object, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the Object.");
fll_program_print_help_option(output, context, fss_basic_list_read_short_pipe, fss_basic_list_read_long_pipe, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print using the special pipe format.");
+ fll_program_print_help_option(output, context, fss_basic_list_read_short_raw, fss_basic_list_read_long_raw, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print with the original quotes and escapes.");
fll_program_print_help_option(output, context, fss_basic_list_read_short_select, fss_basic_list_read_long_select, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select sub-Content at this index.");
fll_program_print_help_option(output, context, fss_basic_list_read_short_total, fss_basic_list_read_long_total, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the total number of lines.");
fll_program_print_help_option(output, context, fss_basic_list_read_short_trim, fss_basic_list_read_long_trim, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Trim Object names on select or print.");
#define fss_basic_list_read_short_name "n"
#define fss_basic_list_read_short_object "o"
#define fss_basic_list_read_short_pipe "p"
+ #define fss_basic_list_read_short_raw "R"
#define fss_basic_list_read_short_select "s"
#define fss_basic_list_read_short_total "t"
#define fss_basic_list_read_short_trim "T"
#define fss_basic_list_read_long_name "name"
#define fss_basic_list_read_long_object "object"
#define fss_basic_list_read_long_pipe "pipe"
+ #define fss_basic_list_read_long_raw "raw"
#define fss_basic_list_read_long_select "select"
#define fss_basic_list_read_long_total "total"
#define fss_basic_list_read_long_trim "trim"
fss_basic_list_read_parameter_name,
fss_basic_list_read_parameter_object,
fss_basic_list_read_parameter_pipe,
+ fss_basic_list_read_parameter_raw,
fss_basic_list_read_parameter_select,
fss_basic_list_read_parameter_total,
fss_basic_list_read_parameter_trim,
f_console_parameter_t_initialize(fss_basic_list_read_short_name, fss_basic_list_read_long_name, 0, 1, f_console_type_normal), \
f_console_parameter_t_initialize(fss_basic_list_read_short_object, fss_basic_list_read_long_object, 0, 0, f_console_type_normal), \
f_console_parameter_t_initialize(fss_basic_list_read_short_pipe, fss_basic_list_read_long_pipe, 0, 0, f_console_type_normal), \
+ f_console_parameter_t_initialize(fss_basic_list_read_short_raw, fss_basic_list_read_long_raw, 0, 0, f_console_type_normal), \
f_console_parameter_t_initialize(fss_basic_list_read_short_select, fss_basic_list_read_long_select, 0, 1, f_console_type_normal), \
f_console_parameter_t_initialize(fss_basic_list_read_short_total, fss_basic_list_read_long_total, 0, 0, f_console_type_normal), \
f_console_parameter_t_initialize(fss_basic_list_read_short_trim, fss_basic_list_read_long_trim, 0, 0, f_console_type_normal), \
}
- #define fss_basic_list_read_total_parameters 22
+ #define fss_basic_list_read_total_parameters 23
#endif // _di_fss_basic_list_read_defines_
/**
* - line: A specific Content at a given line is to be selected (Think of this as select a row for some Content).
* - name: A specific Object name has been requested.
* - object: The Object is to be printed.
+ * - raw: Enable raw printing, where the quotes are printed and no delimits are applied.
* - select: A specific Content at a given position is to be selected (Think of this as select a column for some Content).
* - total: The total lines found and selected is printed instead of the Content.
* - trim: Empty space before and after Objects and Content will not be printed (They will be trimmed).
#define fss_basic_list_read_data_option_line 0x10
#define fss_basic_list_read_data_option_name 0x20
#define fss_basic_list_read_data_option_object 0x40
- #define fss_basic_list_read_data_option_select 0x80
- #define fss_basic_list_read_data_option_total 0x100
- #define fss_basic_list_read_data_option_trim 0x200
+ #define fss_basic_list_read_data_option_raw 0x80
+ #define fss_basic_list_read_data_option_select 0x100
+ #define fss_basic_list_read_data_option_total 0x200
+ #define fss_basic_list_read_data_option_trim 0x400
typedef struct {
uint16_t option;
f_fss_delimits_t delimits_object;
f_fss_delimits_t delimits_content;
f_fss_comments_t comments;
+ f_fss_quotes_t quotes;
} fss_basic_list_read_data_t;
#define fss_basic_list_read_data_t_initialize \
f_fss_contents_t_initialize, \
f_fss_delimits_t_initialize, \
f_fss_delimits_t_initialize, \
+ f_fss_quotes_t_initialize, \
f_fss_comments_t_initialize, \
}
#endif // _di_fss_basic_list_read_data_t_
f_array_lengths_t *delimits_object = fss_basic_list_read_delimit_object_is(0, data) ? &data->delimits_object : &except_none;
f_array_lengths_t *delimits_content = fss_basic_list_read_delimit_content_is(0, data) ? &data->delimits_content : &except_none;
+ if (data->option & fss_basic_list_read_data_option_raw) {
+ delimits_object = &except_none;
+ delimits_content = &except_none;
+ }
+
for (f_array_length_t i = 0; i < data->contents.used; ++i) {
if (!names[i]) continue;
f_array_lengths_t *delimits_object = fss_basic_list_read_delimit_object_is(0, data) ? &data->delimits_object : &except_none;
f_array_lengths_t *delimits_content = fss_basic_list_read_delimit_content_is(0, data) ? &data->delimits_content : &except_none;
+ if (data->option & fss_basic_list_read_data_option_raw) {
+ delimits_object = &except_none;
+ delimits_content = &except_none;
+ }
+
f_array_length_t at = 0;
f_status_t status = F_none;
f_array_lengths_t *delimits_object = fss_basic_list_read_delimit_object_is(0, data) ? &data->delimits_object : &except_none;
f_array_lengths_t *delimits_content = fss_basic_list_read_delimit_content_is(0, data) ? &data->delimits_content : &except_none;
+ if (data->option & fss_basic_list_read_data_option_raw) {
+ delimits_object = &except_none;
+ delimits_content = &except_none;
+ }
+
f_array_length_t line = 0;
f_status_t status = F_none;
data->option |= fss_basic_list_read_data_option_object;
}
+ if (main->parameters[fss_basic_list_read_parameter_raw].result == f_console_result_found) {
+ data->option |= fss_basic_list_read_data_option_raw;
+ }
+
if (main->parameters[fss_basic_list_read_parameter_select].result == f_console_result_additional) {
data->option |= fss_basic_list_read_data_option_select;
fll_program_print_help_option(output, context, fss_basic_read_short_name, fss_basic_read_long_name, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select Object with this name.");
fll_program_print_help_option(output, context, fss_basic_read_short_object, fss_basic_read_long_object, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the Object.");
fll_program_print_help_option(output, context, fss_basic_read_short_pipe, fss_basic_read_long_pipe, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print using the special pipe format.");
+ fll_program_print_help_option(output, context, fss_basic_read_short_raw, fss_basic_read_long_raw, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print with the original quotes and escapes.");
fll_program_print_help_option(output, context, fss_basic_read_short_select, fss_basic_read_long_select, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select sub-Content at this index.");
fll_program_print_help_option(output, context, fss_basic_read_short_total, fss_basic_read_long_total, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the total number of lines.");
fll_program_print_help_option(output, context, fss_basic_read_short_trim, fss_basic_read_long_trim, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Trim Object names on select or print.");
#define fss_basic_read_short_name "n"
#define fss_basic_read_short_object "o"
#define fss_basic_read_short_pipe "p"
+ #define fss_basic_read_short_raw "R"
#define fss_basic_read_short_select "s"
#define fss_basic_read_short_total "t"
#define fss_basic_read_short_trim "T"
#define fss_basic_read_long_name "name"
#define fss_basic_read_long_object "object"
#define fss_basic_read_long_pipe "pipe"
+ #define fss_basic_read_long_raw "raw"
#define fss_basic_read_long_select "select"
#define fss_basic_read_long_total "total"
#define fss_basic_read_long_trim "trim"
fss_basic_read_parameter_name,
fss_basic_read_parameter_object,
fss_basic_read_parameter_pipe,
+ fss_basic_read_parameter_raw,
fss_basic_read_parameter_select,
fss_basic_read_parameter_total,
fss_basic_read_parameter_trim,
f_console_parameter_t_initialize(fss_basic_read_short_name, fss_basic_read_long_name, 0, 1, f_console_type_normal), \
f_console_parameter_t_initialize(fss_basic_read_short_object, fss_basic_read_long_object, 0, 0, f_console_type_normal), \
f_console_parameter_t_initialize(fss_basic_read_short_pipe, fss_basic_read_long_pipe, 0, 0, f_console_type_normal), \
+ f_console_parameter_t_initialize(fss_basic_read_short_raw, fss_basic_read_long_raw, 0, 0, f_console_type_normal), \
f_console_parameter_t_initialize(fss_basic_read_short_select, fss_basic_read_long_select, 0, 1, f_console_type_normal), \
f_console_parameter_t_initialize(fss_basic_read_short_total, fss_basic_read_long_total, 0, 0, f_console_type_normal), \
f_console_parameter_t_initialize(fss_basic_read_short_trim, fss_basic_read_long_trim, 0, 0, f_console_type_normal), \
}
- #define fss_basic_read_total_parameters 22
+ #define fss_basic_read_total_parameters 23
#endif // _di_fss_basic_read_defines_
/**
macro_f_fss_contents_t_delete_simple(data->contents);
macro_f_fss_objects_t_delete_simple(data->objects);
macro_f_fss_delimits_t_delete_simple(data->delimits);
+ macro_f_fss_quotes_t_delete_simple(data->quotes);
}
#endif // _di_fss_basic_read_data_delete_simple_
* - line: A specific Content at a given line is to be selected (Think of this as select a row for some Content).
* - name: A specific Object name has been requested.
* - object: The Object is to be printed.
+ * - raw: Enable raw printing, where the quotes are printed and no delimits are applied.
* - select: A specific Content at a given position is to be selected (Think of this as select a column for some Content).
* - total: The total lines found and selected is printed instead of the Content.
* - trim: Empty space before and after Objects and Content will not be printed (They will be trimmed).
#define fss_basic_read_data_option_line 0x10
#define fss_basic_read_data_option_name 0x20
#define fss_basic_read_data_option_object 0x40
- #define fss_basic_read_data_option_select 0x80
- #define fss_basic_read_data_option_total 0x100
- #define fss_basic_read_data_option_trim 0x200
+ #define fss_basic_read_data_option_raw 0x80
+ #define fss_basic_read_data_option_select 0x100
+ #define fss_basic_read_data_option_total 0x200
+ #define fss_basic_read_data_option_trim 0x400
typedef struct {
uint16_t option;
f_fss_objects_t objects;
f_fss_contents_t contents;
f_fss_delimits_t delimits;
+ f_fss_quotes_t quotes;
} fss_basic_read_data_t;
#define fss_basic_read_data_t_initialize \
f_fss_objects_t_initialize, \
f_fss_contents_t_initialize, \
f_fss_delimits_t_initialize, \
+ f_fss_quotes_t_initialize, \
}
#endif // _di_fss_basic_read_data_t_
f_string_range_t input = macro_f_string_range_t_initialize(data->buffer.used);
data->delimits.used = 0;
+ data->quotes.used = 0;
- const f_status_t status = fll_fss_basic_read(data->buffer, state, &input, &data->objects, &data->contents, 0, &data->delimits, 0);
+ const f_status_t status = fll_fss_basic_read(data->buffer, state, &input, &data->objects, &data->contents, &data->quotes, &data->delimits, 0);
if (F_status_is_error(status)) {
const f_string_t file_name = fss_basic_read_file_identify(input.start, data->files);
if (data->option & fss_basic_read_data_option_object) {
if (data->option & fss_basic_read_data_option_trim) {
- fl_print_trim_except_dynamic_partial(data->buffer, data->objects.array[at], delimits_object, main->output.stream);
+ if (data->option & fss_basic_read_data_option_raw) {
+ if (data->quotes.array[at]) {
+ f_print_character_safely(data->quotes.array[at] == f_fss_quote_type_single ? f_fss_quote_single_s[0] : f_fss_quote_double_s[0], main->output.stream);
+ }
+
+ fl_print_trim_dynamic_partial(data->buffer, data->objects.array[at], main->output.stream);
+
+ if (data->quotes.array[at]) {
+ f_print_character_safely(data->quotes.array[at] == f_fss_quote_type_single ? f_fss_quote_single_s[0] : f_fss_quote_double_s[0], main->output.stream);
+ }
+ }
+ else {
+ fl_print_trim_except_dynamic_partial(data->buffer, data->objects.array[at], delimits_object, main->output.stream);
+ }
}
else {
- f_print_except_dynamic_partial(data->buffer, data->objects.array[at], delimits_object, main->output.stream);
+ if (data->option & fss_basic_read_data_option_raw) {
+ if (data->quotes.array[at]) {
+ f_print_character_safely(data->quotes.array[at] == f_fss_quote_type_single ? f_fss_quote_single_s[0] : f_fss_quote_double_s[0], main->output.stream);
+ }
+
+ f_print_dynamic_partial(data->buffer, data->objects.array[at], main->output.stream);
+
+ if (data->quotes.array[at]) {
+ f_print_character_safely(data->quotes.array[at] == f_fss_quote_type_single ? f_fss_quote_single_s[0] : f_fss_quote_double_s[0], main->output.stream);
+ }
+ }
+ else {
+ f_print_except_dynamic_partial(data->buffer, data->objects.array[at], delimits_object, main->output.stream);
+ }
}
if (data->option & fss_basic_read_data_option_content) {
}
if ((data->option & fss_basic_read_data_option_content) && data->contents.array[at].used) {
- f_print_except_dynamic_partial(data->buffer, data->contents.array[at].array[0], delimits_content, main->output.stream);
+ if (data->option & fss_basic_read_data_option_raw) {
+ f_print_dynamic_partial(data->buffer, data->contents.array[at].array[0], main->output.stream);
+ }
+ else {
+ f_print_except_dynamic_partial(data->buffer, data->contents.array[at].array[0], delimits_content, main->output.stream);
+ }
}
fss_basic_read_print_set_end(main);
data->option |= fss_basic_read_data_option_object;
}
+ if (main->parameters[fss_basic_read_parameter_raw].result == f_console_result_found) {
+ data->option |= fss_basic_read_data_option_raw;
+ }
+
if (main->parameters[fss_basic_read_parameter_select].result == f_console_result_additional) {
data->option |= fss_basic_read_data_option_select;
fll_program_print_help_option(output, context, fss_embedded_list_read_short_name, fss_embedded_list_read_long_name, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select Object with this name.");
fll_program_print_help_option(output, context, fss_embedded_list_read_short_object, fss_embedded_list_read_long_object, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the Object.");
fll_program_print_help_option(output, context, fss_embedded_list_read_short_pipe, fss_embedded_list_read_long_pipe, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print using the special pipe format.");
+ fll_program_print_help_option(output, context, fss_embedded_list_read_short_raw, fss_embedded_list_read_long_raw, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print with the original quotes and escapes.");
fll_program_print_help_option(output, context, fss_embedded_list_read_short_select, fss_embedded_list_read_long_select, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select sub-Content at this index.");
fll_program_print_help_option(output, context, fss_embedded_list_read_short_total, fss_embedded_list_read_long_total, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the total number of lines.");
fll_program_print_help_option(output, context, fss_embedded_list_read_short_trim, fss_embedded_list_read_long_trim, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Trim Object names on select or print.");
#define fss_embedded_list_read_short_name "n"
#define fss_embedded_list_read_short_object "o"
#define fss_embedded_list_read_short_pipe "p"
+ #define fss_embedded_list_read_short_raw "R"
#define fss_embedded_list_read_short_select "s"
#define fss_embedded_list_read_short_total "t"
#define fss_embedded_list_read_short_trim "T"
#define fss_embedded_list_read_long_name "name"
#define fss_embedded_list_read_long_object "object"
#define fss_embedded_list_read_long_pipe "pipe"
+ #define fss_embedded_list_read_long_raw "raw"
#define fss_embedded_list_read_long_select "select"
#define fss_embedded_list_read_long_total "total"
#define fss_embedded_list_read_long_trim "trim"
fss_embedded_list_read_parameter_name,
fss_embedded_list_read_parameter_object,
fss_embedded_list_read_parameter_pipe,
+ fss_embedded_list_read_parameter_raw,
fss_embedded_list_read_parameter_select,
fss_embedded_list_read_parameter_total,
fss_embedded_list_read_parameter_trim,
f_console_parameter_t_initialize(fss_embedded_list_read_short_name, fss_embedded_list_read_long_name, 0, 1, f_console_type_normal), \
f_console_parameter_t_initialize(fss_embedded_list_read_short_object, fss_embedded_list_read_long_object, 0, 0, f_console_type_normal), \
f_console_parameter_t_initialize(fss_embedded_list_read_short_pipe, fss_embedded_list_read_long_pipe, 0, 0, f_console_type_normal), \
+ f_console_parameter_t_initialize(fss_embedded_list_read_short_raw, fss_embedded_list_read_long_raw, 0, 0, f_console_type_normal), \
f_console_parameter_t_initialize(fss_embedded_list_read_short_select, fss_embedded_list_read_long_select, 0, 1, f_console_type_normal), \
f_console_parameter_t_initialize(fss_embedded_list_read_short_total, fss_embedded_list_read_long_total, 0, 0, f_console_type_normal), \
f_console_parameter_t_initialize(fss_embedded_list_read_short_trim, fss_embedded_list_read_long_trim, 0, 0, f_console_type_normal), \
}
- #define fss_embedded_list_read_total_parameters 22
+ #define fss_embedded_list_read_total_parameters 23
#endif // _di_fss_embedded_list_read_defines_
#ifndef _di_fss_embedded_list_read_delimit_mode_
const fss_embedded_list_read_skip_t parents = fss_embedded_list_read_skip_t_initialize;
+
+ if (main->parameters[fss_embedded_list_read_parameter_raw].result == f_console_result_found) {
+ f_fss_delimits_t except_none = f_fss_delimits_t_initialize;
+
+ return fss_embedded_list_read_main_process_for_depth(arguments, filename, depths, 0, line, parents, main, &except_none, &except_none);
+ }
+
return fss_embedded_list_read_main_process_for_depth(arguments, filename, depths, 0, line, parents, main, objects_delimits, contents_delimits);
}
#endif // _di_fss_embedded_list_read_main_process_file_
fll_program_print_help_option(output, context, fss_extended_list_read_short_name, fss_extended_list_read_long_name, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select Object with this name.");
fll_program_print_help_option(output, context, fss_extended_list_read_short_object, fss_extended_list_read_long_object, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the Object.");
fll_program_print_help_option(output, context, fss_extended_list_read_short_pipe, fss_extended_list_read_long_pipe, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print using the special pipe format.");
+ fll_program_print_help_option(output, context, fss_extended_list_read_short_raw, fss_extended_list_read_long_raw, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print with the original quotes and escapes.");
fll_program_print_help_option(output, context, fss_extended_list_read_short_select, fss_extended_list_read_long_select, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select sub-Content at this index.");
fll_program_print_help_option(output, context, fss_extended_list_read_short_total, fss_extended_list_read_long_total, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the total number of lines.");
fll_program_print_help_option(output, context, fss_extended_list_read_short_trim, fss_extended_list_read_long_trim, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Trim Object names on select or print.");
#define fss_extended_list_read_short_name "n"
#define fss_extended_list_read_short_object "o"
#define fss_extended_list_read_short_pipe "p"
+ #define fss_extended_list_read_short_raw "R"
#define fss_extended_list_read_short_select "s"
#define fss_extended_list_read_short_total "t"
#define fss_extended_list_read_short_trim "T"
#define fss_extended_list_read_long_name "name"
#define fss_extended_list_read_long_object "object"
#define fss_extended_list_read_long_pipe "pipe"
+ #define fss_extended_list_read_long_raw "raw"
#define fss_extended_list_read_long_select "select"
#define fss_extended_list_read_long_total "total"
#define fss_extended_list_read_long_trim "trim"
fss_extended_list_read_parameter_name,
fss_extended_list_read_parameter_object,
fss_extended_list_read_parameter_pipe,
+ fss_extended_list_read_parameter_raw,
fss_extended_list_read_parameter_select,
fss_extended_list_read_parameter_total,
fss_extended_list_read_parameter_trim,
f_console_parameter_t_initialize(fss_extended_list_read_short_name, fss_extended_list_read_long_name, 0, 1, f_console_type_normal), \
f_console_parameter_t_initialize(fss_extended_list_read_short_object, fss_extended_list_read_long_object, 0, 0, f_console_type_normal), \
f_console_parameter_t_initialize(fss_extended_list_read_short_pipe, fss_extended_list_read_long_pipe, 0, 0, f_console_type_normal), \
+ f_console_parameter_t_initialize(fss_extended_list_read_short_raw, fss_extended_list_read_long_raw, 0, 0, f_console_type_normal), \
f_console_parameter_t_initialize(fss_extended_list_read_short_select, fss_extended_list_read_long_select, 0, 1, f_console_type_normal), \
f_console_parameter_t_initialize(fss_extended_list_read_short_total, fss_extended_list_read_long_total, 0, 0, f_console_type_normal), \
f_console_parameter_t_initialize(fss_extended_list_read_short_trim, fss_extended_list_read_long_trim, 0, 0, f_console_type_normal), \
}
- #define fss_extended_list_read_total_parameters 22
+ #define fss_extended_list_read_total_parameters 23
#endif // _di_fss_extended_list_read_defines_
/**
* - line: A specific Content at a given line is to be selected (Think of this as select a row for some Content).
* - name: A specific Object name has been requested.
* - object: The Object is to be printed.
+ * - raw: Enable raw printing, where the quotes are printed and no delimits are applied.
* - select: A specific Content at a given position is to be selected (Think of this as select a column for some Content).
* - total: The total lines found and selected is printed instead of the Content.
* - trim: Empty space before and after Objects and Content will not be printed (They will be trimmed).
#define fss_extended_list_read_data_option_line 0x10
#define fss_extended_list_read_data_option_name 0x20
#define fss_extended_list_read_data_option_object 0x40
- #define fss_extended_list_read_data_option_select 0x80
- #define fss_extended_list_read_data_option_total 0x100
- #define fss_extended_list_read_data_option_trim 0x200
+ #define fss_extended_list_read_data_option_raw 0x80
+ #define fss_extended_list_read_data_option_select 0x100
+ #define fss_extended_list_read_data_option_total 0x200
+ #define fss_extended_list_read_data_option_trim 0x400
typedef struct {
uint16_t option;
f_fss_contents_t contents;
f_fss_delimits_t delimits_object;
f_fss_delimits_t delimits_content;
+ f_fss_quotes_t quotes;
f_fss_comments_t comments;
} fss_extended_list_read_data_t;
f_fss_contents_t_initialize, \
f_fss_delimits_t_initialize, \
f_fss_delimits_t_initialize, \
+ f_fss_quotes_t_initialize, \
f_fss_comments_t_initialize, \
}
#endif // _di_fss_extended_list_read_data_t_
f_array_lengths_t *delimits_object = fss_extended_list_read_delimit_object_is(0, data) ? &data->delimits_object : &except_none;
f_array_lengths_t *delimits_content = fss_extended_list_read_delimit_content_is(0, data) ? &data->delimits_content : &except_none;
+ if (data->option & fss_extended_list_read_data_option_raw) {
+ delimits_object = &except_none;
+ delimits_content = &except_none;
+ }
+
for (f_array_length_t i = 0; i < data->contents.used; ++i) {
if (!names[i]) continue;
f_array_lengths_t *delimits_object = fss_extended_list_read_delimit_object_is(0, data) ? &data->delimits_object : &except_none;
f_array_lengths_t *delimits_content = fss_extended_list_read_delimit_content_is(0, data) ? &data->delimits_content : &except_none;
+ if (data->option & fss_extended_list_read_data_option_raw) {
+ delimits_object = &except_none;
+ delimits_content = &except_none;
+ }
+
f_array_length_t at = 0;
f_status_t status = F_none;
f_array_lengths_t *delimits_object = fss_extended_list_read_delimit_object_is(0, data) ? &data->delimits_object : &except_none;
f_array_lengths_t *delimits_content = fss_extended_list_read_delimit_content_is(0, data) ? &data->delimits_content : &except_none;
+ if (data->option & fss_extended_list_read_data_option_raw) {
+ delimits_object = &except_none;
+ delimits_content = &except_none;
+ }
+
f_array_length_t line = 0;
f_status_t status = F_none;
data->option |= fss_extended_list_read_data_option_object;
}
+ if (main->parameters[fss_extended_list_read_parameter_raw].result == f_console_result_found) {
+ data->option |= fss_extended_list_read_data_option_raw;
+ }
+
if (main->parameters[fss_extended_list_read_parameter_select].result == f_console_result_additional) {
data->option |= fss_extended_list_read_data_option_select;
fll_program_print_help_option(output, context, fss_extended_read_short_name, fss_extended_read_long_name, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select Object with this name.");
fll_program_print_help_option(output, context, fss_extended_read_short_object, fss_extended_read_long_object, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the Object.");
fll_program_print_help_option(output, context, fss_extended_read_short_pipe, fss_extended_read_long_pipe, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print using the special pipe format.");
+ fll_program_print_help_option(output, context, fss_extended_read_short_raw, fss_extended_read_long_raw, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print with the original quotes and escapes.");
fll_program_print_help_option(output, context, fss_extended_read_short_select, fss_extended_read_long_select, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select sub-Content at this index.");
fll_program_print_help_option(output, context, fss_extended_read_short_total, fss_extended_read_long_total, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the total number of lines.");
fll_program_print_help_option(output, context, fss_extended_read_short_trim, fss_extended_read_long_trim, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Trim Object names on select or print.");
#define fss_extended_read_short_name "n"
#define fss_extended_read_short_object "o"
#define fss_extended_read_short_pipe "p"
+ #define fss_extended_read_short_raw "R"
#define fss_extended_read_short_select "s"
#define fss_extended_read_short_total "t"
#define fss_extended_read_short_trim "T"
#define fss_extended_read_long_name "name"
#define fss_extended_read_long_object "object"
#define fss_extended_read_long_pipe "pipe"
+ #define fss_extended_read_long_raw "raw"
#define fss_extended_read_long_select "select"
#define fss_extended_read_long_total "total"
#define fss_extended_read_long_trim "trim"
fss_extended_read_parameter_name,
fss_extended_read_parameter_object,
fss_extended_read_parameter_pipe,
+ fss_extended_read_parameter_raw,
fss_extended_read_parameter_select,
fss_extended_read_parameter_total,
fss_extended_read_parameter_trim,
f_console_parameter_t_initialize(fss_extended_read_short_name, fss_extended_read_long_name, 0, 1, f_console_type_normal), \
f_console_parameter_t_initialize(fss_extended_read_short_object, fss_extended_read_long_object, 0, 0, f_console_type_normal), \
f_console_parameter_t_initialize(fss_extended_read_short_pipe, fss_extended_read_long_pipe, 0, 0, f_console_type_normal), \
+ f_console_parameter_t_initialize(fss_extended_read_short_raw, fss_extended_read_long_raw, 0, 0, f_console_type_normal), \
f_console_parameter_t_initialize(fss_extended_read_short_select, fss_extended_read_long_select, 0, 1, f_console_type_normal), \
f_console_parameter_t_initialize(fss_extended_read_short_total, fss_extended_read_long_total, 0, 0, f_console_type_normal), \
f_console_parameter_t_initialize(fss_extended_read_short_trim, fss_extended_read_long_trim, 0, 0, f_console_type_normal), \
}
- #define fss_extended_read_total_parameters 22
+ #define fss_extended_read_total_parameters 23
#endif // _di_fss_extended_read_defines_
/**
macro_f_fss_objects_t_delete_simple(data->objects);
macro_f_fss_delimits_t_delete_simple(data->delimits_object);
macro_f_fss_delimits_t_delete_simple(data->delimits_content);
+ macro_f_fss_quotes_t_delete_simple(data->quotes_object);
+ macro_f_fss_quotess_t_delete_simple(data->quotes_content);
}
#endif // _di_fss_extended_read_data_delete_simple_
* - line: A specific Content at a given line is to be selected (Think of this as select a row for some Content).
* - name: A specific Object name has been requested.
* - object: The Object is to be printed.
+ * - raw: Enable raw printing, where the quotes are printed and no delimits are applied.
* - select: A specific Content at a given position is to be selected (Think of this as select a column for some Content).
* - total: The total lines found and selected is printed instead of the Content.
* - trim: Empty space before and after Objects and Content will not be printed (They will be trimmed).
#define fss_extended_read_data_option_line 0x10
#define fss_extended_read_data_option_name 0x20
#define fss_extended_read_data_option_object 0x40
- #define fss_extended_read_data_option_select 0x80
- #define fss_extended_read_data_option_total 0x100
- #define fss_extended_read_data_option_trim 0x200
+ #define fss_extended_read_data_option_raw 0x80
+ #define fss_extended_read_data_option_select 0x100
+ #define fss_extended_read_data_option_total 0x200
+ #define fss_extended_read_data_option_trim 0x400
typedef struct {
uint16_t option;
f_fss_contents_t contents;
f_fss_delimits_t delimits_object;
f_fss_delimits_t delimits_content;
+ f_fss_quotes_t quotes_object;
+ f_fss_quotess_t quotes_content;
} fss_extended_read_data_t;
#define fss_extended_read_data_t_initialize \
f_fss_contents_t_initialize, \
f_fss_delimits_t_initialize, \
f_fss_delimits_t_initialize, \
+ f_fss_quotes_t_initialize, \
+ f_fss_quotess_t_initialize, \
}
#endif // _di_fss_extended_read_data_t_
data->delimits_object.used = 0;
data->delimits_content.used = 0;
+ data->quotes_object.used = 0;
+ data->quotes_content.used = 0;
- const f_status_t status = fll_fss_extended_read(data->buffer, state, &input, &data->objects, &data->contents, 0, 0, &data->delimits_object, &data->delimits_content);
+ const f_status_t status = fll_fss_extended_read(data->buffer, state, &input, &data->objects, &data->contents, &data->quotes_object, &data->quotes_content, &data->delimits_object, &data->delimits_content);
if (F_status_is_error(status)) {
const f_string_t file_name = fss_extended_read_file_identify(input.start, data->files);
if ((data->option & fss_extended_read_data_option_object) || (data->option & fss_extended_read_data_option_content) && (data->contents.array[at].used || (data->option & fss_extended_read_data_option_empty))) {
if (data->option & fss_extended_read_data_option_object) {
if (data->option & fss_extended_read_data_option_trim) {
+ if ((data->option & fss_extended_read_data_option_raw) && data->quotes_object.array[at]) {
+ f_print_character_safely(data->quotes_object.array[at] == f_fss_quote_type_single ? f_fss_quote_single_s[0] : f_fss_quote_double_s[0], main->output.stream);
+ }
+
fl_print_trim_except_dynamic_partial(data->buffer, data->objects.array[at], delimits_object, main->output.stream);
+
+ if ((data->option & fss_extended_read_data_option_raw) && data->quotes_object.array[at]) {
+ f_print_character_safely(data->quotes_object.array[at] == f_fss_quote_type_single ? f_fss_quote_single_s[0] : f_fss_quote_double_s[0], main->output.stream);
+ }
}
else {
+ if ((data->option & fss_extended_read_data_option_raw) && data->quotes_object.array[at]) {
+ f_print_character_safely(data->quotes_object.array[at] == f_fss_quote_type_single ? f_fss_quote_single_s[0] : f_fss_quote_double_s[0], main->output.stream);
+ }
+
f_print_except_dynamic_partial(data->buffer, data->objects.array[at], delimits_object, main->output.stream);
+
+ if ((data->option & fss_extended_read_data_option_raw) && data->quotes_object.array[at]) {
+ f_print_character_safely(data->quotes_object.array[at] == f_fss_quote_type_single ? f_fss_quote_single_s[0] : f_fss_quote_double_s[0], main->output.stream);
+ }
}
if (data->option & fss_extended_read_data_option_content) {
if (data->select < data->contents.array[at].used) {
content_printed = F_true;
+ if ((data->option & fss_extended_read_data_option_raw) && data->quotes_content.array[at].array[data->select]) {
+ f_print_character_safely(data->quotes_content.array[at].array[data->select] == f_fss_quote_type_single ? f_fss_quote_single_s[0] : f_fss_quote_double_s[0], main->output.stream);
+ }
+
f_print_except_dynamic_partial(data->buffer, data->contents.array[at].array[data->select], delimits_content, main->output.stream);
+
+ if ((data->option & fss_extended_read_data_option_raw) && data->quotes_content.array[at].array[data->select]) {
+ f_print_character_safely(data->quotes_content.array[at].array[data->select] == f_fss_quote_type_single ? f_fss_quote_single_s[0] : f_fss_quote_double_s[0], main->output.stream);
+ }
}
}
else {
content_printed = F_true;
+ if ((data->option & fss_extended_read_data_option_raw) && data->quotes_content.array[at].array[i]) {
+ f_print_character_safely(data->quotes_content.array[at].array[i] == f_fss_quote_type_single ? f_fss_quote_single_s[0] : f_fss_quote_double_s[0], main->output.stream);
+ }
+
f_print_except_dynamic_partial(data->buffer, data->contents.array[at].array[i], delimits_content, main->output.stream);
+ if ((data->option & fss_extended_read_data_option_raw) && data->quotes_content.array[at].array[i]) {
+ f_print_character_safely(data->quotes_content.array[at].array[i] == f_fss_quote_type_single ? f_fss_quote_single_s[0] : f_fss_quote_double_s[0], main->output.stream);
+ }
+
if (i + 1 < data->contents.array[at].used && data->contents.array[at].array[i + 1].start <= data->contents.array[at].array[i + 1].stop) {
fss_extended_read_print_content_end(main);
}
f_array_lengths_t *delimits_object = fss_extended_read_delimit_object_is(0, data) ? &data->delimits_object : &except_none;
f_array_lengths_t *delimits_content = fss_extended_read_delimit_content_is((data->option & fss_extended_read_data_option_select) ? data->select : 0, data) ? &data->delimits_content : &except_none;
+ if (data->option & fss_extended_read_data_option_raw) {
+ delimits_object = &except_none;
+ delimits_content = &except_none;
+ }
+
for (f_array_length_t i = 0; i < data->contents.used; ++i) {
if (!names[i]) continue;
f_array_lengths_t *delimits_object = fss_extended_read_delimit_object_is(0, data) ? &data->delimits_object : &except_none;
f_array_lengths_t *delimits_content = fss_extended_read_delimit_content_is((data->option & fss_extended_read_data_option_select) ? data->select : 0, data) ? &data->delimits_content : &except_none;
+ if (data->option & fss_extended_read_data_option_raw) {
+ delimits_object = &except_none;
+ delimits_content = &except_none;
+ }
+
f_array_length_t at = 0;
for (f_array_length_t i = 0; i < data->objects.used; ++i) {
}
}
else {
+ if ((data->option & fss_extended_read_data_option_raw) && data->quotes_object.array[at]) {
+ f_print_character_safely(data->quotes_object.array[at] == f_fss_quote_type_single ? f_fss_quote_single_s[0] : f_fss_quote_double_s[0], main->output.stream);
+ }
+
fss_extended_read_print_at(i, *delimits_object, *delimits_content, main, data);
+
+ if ((data->option & fss_extended_read_data_option_raw) && data->quotes_object.array[at]) {
+ f_print_character_safely(data->quotes_object.array[at] == f_fss_quote_type_single ? f_fss_quote_single_s[0] : f_fss_quote_double_s[0], main->output.stream);
+ }
}
}
else if (data->option & fss_extended_read_data_option_columns) {
}
}
else {
+ if ((data->option & fss_extended_read_data_option_raw) && data->quotes_content.array[at].array[i]) {
+ f_print_character_safely(data->quotes_content.array[at].array[i] == f_fss_quote_type_single ? f_fss_quote_single_s[0] : f_fss_quote_double_s[0], main->output.stream);
+ }
+
fss_extended_read_print_at(i, *delimits_object, *delimits_content, main, data);
+
+ if ((data->option & fss_extended_read_data_option_raw) && data->quotes_content.array[at].array[i]) {
+ f_print_character_safely(data->quotes_content.array[at].array[i] == f_fss_quote_type_single ? f_fss_quote_single_s[0] : f_fss_quote_double_s[0], main->output.stream);
+ }
}
return F_none;
f_array_lengths_t *delimits_object = fss_extended_read_delimit_object_is(0, data) ? &data->delimits_object : &except_none;
f_array_lengths_t *delimits_content = fss_extended_read_delimit_content_is((data->option & fss_extended_read_data_option_select) ? data->select : 0, data) ? &data->delimits_content : &except_none;
+ if (data->option & fss_extended_read_data_option_raw) {
+ delimits_object = &except_none;
+ delimits_content = &except_none;
+ }
+
f_array_length_t line = 0;
for (f_array_length_t i = 0; i < data->contents.used; ++i) {
data->option |= fss_extended_read_data_option_object;
}
+ if (main->parameters[fss_extended_read_parameter_raw].result == f_console_result_found) {
+ data->option |= fss_extended_read_data_option_raw;
+ }
+
if (main->parameters[fss_extended_read_parameter_select].result == f_console_result_additional) {
data->option |= fss_extended_read_data_option_select;