This gets the programs compiling.
I decided not to get everything correct and instead decided to get everything compiling.
The memory allocation needs to be fixed.
There are a lot of fixme and todo comments to address.
The payload and embedded list need special handling and are very much not implemented.
Individual standard differences need to be handled (and some are stubbed out or copied over, making them invalid).
#endif // _di_fss_read_basic_process_help_
#ifndef _di_fss_read_basic_process_load_
- void fss_read_basic_process_load(fss_read_main_t * const main) {
+ void fss_read_basic_process_load(void * const void_main) {
- if (!main) return;
+ if (!void_main) return;
+
+ fss_read_main_t * const main = (fss_read_main_t *) void_main;
- f_string_range_t input = macro_f_string_range_t_initialize_2(main->setting.buffer.used);
+ if (main->setting.buffer.used) {
+ main->setting.range.start = 0;
+ main->setting.range.stop = main->setting.buffer.used;
+ }
+ else {
+ main->setting.range.start = 1;
+ main->setting.range.stop = 0;
+ }
+ main->setting.comments.used = 0;
main->setting.delimits_object.used = 0;
main->setting.delimits_content.used = 0;
+ main->setting.nest.used = 0;
main->setting.quotes_object.used = 0;
main->setting.quotes_content.used = 0;
- fll_fss_basic_read(main->setting.buffer, &input, &main->setting.objects, &main->setting.contents, &main->setting.quotes_object, &main->setting.delimits_object, &main->setting.delimits_content, &main->setting.state);
+ fll_fss_basic_read(main->setting.buffer, &main->setting.range, &main->setting.objects, &main->setting.contents, &main->setting.quotes_object, &main->setting.delimits_object, &main->setting.delimits_content, &main->setting.state);
if (F_status_is_error(main->setting.state.status)) {
if (F_status_set_fine(main->setting.state.status) == F_interrupt) return;
F_status_set_fine(main->setting.state.status),
macro_fss_read_f(fll_fss_basic_read),
fll_error_file_flag_fallback_e,
- fss_read_file_identify(input.start, main->setting.files),
+ fss_read_file_identify(main->setting.range.start, main->setting.files),
f_file_operation_process_s,
fll_error_file_type_file_e
);
* The program and settings data.
*
* Must not be NULL.
+ * Must be of type fss_read_main_t.
*
* This alters main.setting.state.status:
* F_none on success.
* @see fss_read_file_identify()
*/
#ifndef _di_fss_read_basic_process_load_
- extern void fss_read_basic_process_load(fss_read_main_t * const main);
+ extern void fss_read_basic_process_load(void * const main);
#endif // _di_fss_read_basic_process_load_
#ifdef __cplusplus
data.program.output.flag |= fss_read_print_flag_out_e;
data.program.message.flag |= fss_read_print_flag_message_e | fss_read_print_flag_out_e;
data.program.warning.flag |= fss_read_print_flag_warning_e | fss_read_print_flag_out_e;
+
data.program.error.custom = (void *) &data;
data.program.debug.custom = (void *) &data;
data.program.message.custom = (void *) &data;
data.program.output.custom = (void *) &data;
data.program.warning.custom = (void *) &data;
- data.setting.flag |= fss_read_main_flag_quote_content_e | fss_read_main_flag_quote_object_e | fss_read_main_flag_line_single_e;
+ data.setting.flag |= fss_read_main_flag_line_single_e;
+ data.setting.flag |= fss_read_main_flag_quote_content_e | fss_read_main_flag_quote_object_e;
data.setting.state.custom = (void *) &data;
data.setting.standard = fss_read_basic_standard_s;
fll_program_print_help_usage(print, fss_read_basic_program_name_s, f_string_empty_s);
+ f_print_dynamic_raw(f_string_eol_s, print->to);
+
fss_read_print_message_help_note_header(print, fss_read_format_code_short_0000_s, fss_read_format_code_name_0000_s);
fss_read_print_message_help_pipe(print);
}
#endif // _di_fss_read_basic_list_process_help_
+#ifndef _di_fss_read_basic_list_process_load_
+ void fss_read_basic_list_process_load(void * const void_main) {
+
+ if (!void_main) return;
+
+ fss_read_main_t * const main = (fss_read_main_t *) void_main;
+
+ if (main->setting.buffer.used) {
+ main->setting.range.start = 0;
+ main->setting.range.stop = main->setting.buffer.used;
+ }
+ else {
+ main->setting.range.start = 1;
+ main->setting.range.stop = 0;
+ }
+
+ main->setting.comments.used = 0;
+ main->setting.delimits_object.used = 0;
+ main->setting.delimits_content.used = 0;
+ main->setting.nest.used = 0;
+ main->setting.quotes_object.used = 0;
+ main->setting.quotes_content.used = 0;
+
+ fll_fss_basic_list_read(main->setting.buffer, &main->setting.range, &main->setting.objects, &main->setting.contents, &main->setting.delimits_object, &main->setting.delimits_content, &main->setting.comments, &main->setting.state);
+
+ if (F_status_is_error(main->setting.state.status)) {
+ if (F_status_set_fine(main->setting.state.status) == F_interrupt) return;
+
+ fll_error_file_print(
+ &main->program.error,
+ F_status_set_fine(main->setting.state.status),
+ macro_fss_read_f(fll_fss_basic_list_read),
+ fll_error_file_flag_fallback_e,
+ fss_read_file_identify(main->setting.range.start, main->setting.files),
+ f_file_operation_process_s,
+ fll_error_file_type_file_e
+ );
+
+ return;
+ }
+
+ if (main->setting.state.status == F_data_not_stop || main->setting.state.status == F_data_not_eos) {
+ if (!(main->setting.flag & fss_read_main_flag_total_e)) {
+ main->setting.state.status = F_status_set_warning(main->setting.state.status);
+
+ return;
+ }
+ }
+
+ main->setting.state.status = F_none;
+ }
+#endif // _di_fss_read_basic_list_process_load_
+
#ifdef __cplusplus
} // extern "C"
#endif
extern void fss_read_basic_list_process_help(void * const main);
#endif // _di_fss_read_basic_list_process_help_
+/**
+ * Process the buffer, loading the FSS data.
+ *
+ * This will print an error message on error.
+ *
+ * @param main
+ * The program and settings data.
+ *
+ * Must not be NULL.
+ * Must be of type fss_read_main_t.
+ *
+ * This alters main.setting.state.status:
+ * F_none on success.
+ *
+ * F_data_not_stop (with warning bit) on no valid FSS data found and reached stopping point.
+ * F_data_not_eos (with warning bit) on no valid FSS data found and reached end of string.
+ *
+ * Errors (with error bit) from: fll_fss_basic_list_read()
+ *
+ * @see fll_fss_basic_list_read()
+ *
+ * @see fss_read_file_identify()
+ */
+#ifndef _di_fss_read_basic_list_process_load_
+ extern void fss_read_basic_list_process_load(void * const main);
+#endif // _di_fss_read_basic_list_process_load_
+
#ifdef __cplusplus
} // extern "C"
#endif
data.program.output.flag |= fss_read_print_flag_out_e;
data.program.message.flag |= fss_read_print_flag_message_e | fss_read_print_flag_out_e;
data.program.warning.flag |= fss_read_print_flag_warning_e | fss_read_print_flag_out_e;
+
data.program.error.custom = (void *) &data;
data.program.debug.custom = (void *) &data;
data.program.message.custom = (void *) &data;
data.program.output.custom = (void *) &data;
data.program.warning.custom = (void *) &data;
+ data.setting.flag |= fss_read_main_flag_trim_object_e;
+
data.setting.state.custom = (void *) &data;
data.setting.standard = fss_read_basic_list_standard_s;
data.callback.process_help = &fss_read_basic_list_process_help;
data.callback.process_last_line = &fss_read_process_last_line;
- //data.callback.process_load_depth = &fss_read_setting_load_depth;
+ data.callback.process_load_depth = &fss_read_setting_load_depth;
data.callback.process_normal = &fss_read_process_normal;
- //data.callback.process_at = &fss_read_process_normal_at;
- //data.callback.process_columns = &fss_read_process_normal_columns;
- //data.callback.process_line = &fss_read_process_normal_line;
- //data.callback.process_load = &fss_read_basic_process_load;
- //data.callback.process_name = &fss_read_process_normal_name;
- //data.callback.process_total = &fss_read_process_normal_total;
-
- //data.callback.print_at = &fss_read_print_at;
- //data.callback.print_content = &fss_read_print_content;
- //data.callback.print_content_ignore = &fss_read_print_content_ignore;
- //data.callback.print_object = &fss_read_print_object;
- //data.callback.print_object_end = &fss_read_print_object_end;
- //data.callback.print_set_end = &fss_read_print_set_end;
+ data.callback.process_at = &fss_read_process_normal_at;
+ data.callback.process_columns = &fss_read_process_normal_columns;
+ data.callback.process_line = &fss_read_process_normal_line;
+ data.callback.process_load = &fss_read_basic_list_process_load;
+ data.callback.process_name = &fss_read_process_normal_name;
+ data.callback.process_total = &fss_read_process_normal_total;
+
+ data.callback.print_at = &fss_read_print_at;
+ data.callback.print_content = &fss_read_print_content;
+ data.callback.print_content_ignore = &fss_read_print_content_ignore;
+ data.callback.print_object = &fss_read_print_object;
+ data.callback.print_object_end = &fss_read_basic_list_print_object_end;
+ data.callback.print_set_end = &fss_read_print_set_end_no_eol;
f_console_parameter_t parameters[] = fss_read_console_parameter_t_initialize;
data.program.parameters.array = parameters;
fll_program_print_help_usage(print, fss_read_basic_list_program_name_s, f_string_empty_s);
+ f_print_dynamic_raw(f_string_eol_s, print->to);
+
fss_read_print_message_help_note_header(print, fss_read_format_code_short_0002_s, fss_read_format_code_name_0002_s);
fss_read_print_message_help_pipe(print);
}
#endif // _di_fss_read_basic_list_print_help_
+#ifndef _di_fss_read_basic_list_print_object_end_
+ f_status_t fss_read_basic_list_print_object_end(fl_print_t * const print) {
+
+ if (!print || !print->custom) return F_status_set_error(F_output_not);
+
+ fss_read_main_t * const main = (fss_read_main_t *) print->custom;
+
+ f_file_stream_lock(print->to);
+
+ if (main->setting.flag & fss_read_main_flag_pipe_e) {
+ f_print_dynamic_raw(fss_read_pipe_content_start_s, print->to);
+ }
+ else {
+ if (main->setting.flag & fss_read_main_flag_content_e) {
+ f_print_dynamic_raw(f_fss_basic_list_open_s, print->to);
+ f_print_dynamic_raw(f_fss_basic_list_open_end_s, print->to);
+ }
+ else {
+ f_print_dynamic_raw(f_fss_eol_s, print->to);
+ }
+ }
+
+ f_file_stream_unlock(print->to);
+
+ return F_none;
+ }
+#endif // _di_fss_read_basic_list_print_object_end_
+
#ifdef __cplusplus
} // extern "C"
#endif
extern f_status_t fss_read_basic_list_print_help(fl_print_t * const print);
#endif // _di_fss_read_basic_list_print_help_
+/**
+ * Print the end of an Object (which is often the start of Content).
+ *
+ * This locks, uses, and unlocks the file stream.
+ *
+ * @param print
+ * The output structure to print to.
+ *
+ * The print.custom is expected to be of type fss_read_main_t.
+ *
+ * This does not alter print.custom.setting.state.status.
+ *
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if a parameter is NULL.
+ *
+ * @see f_file_stream_lock()
+ * @see f_file_stream_unlock()
+ * @see f_print_dynamic_raw()
+ */
+#ifndef _di_fss_read_basic_list_print_object_end_
+ extern f_status_t fss_read_basic_list_print_object_end(fl_print_t * const print);
+#endif // _di_fss_read_basic_list_print_object_end_
+
#ifdef __cplusplus
} // extern "C"
#endif
}
#endif // _di_fss_read_embedded_list_process_help_
+#ifndef _di_fss_read_embedded_list_process_load_
+ void fss_read_embedded_list_process_load(void * const void_main) {
+
+ if (!void_main) return;
+
+ fss_read_main_t * const main = (fss_read_main_t *) void_main;
+
+ if (main->setting.buffer.used) {
+ main->setting.range.start = 0;
+ main->setting.range.stop = main->setting.buffer.used;
+ }
+ else {
+ main->setting.range.start = 1;
+ main->setting.range.stop = 0;
+ }
+
+ main->setting.comments.used = 0;
+ main->setting.delimits_object.used = 0;
+ main->setting.delimits_content.used = 0;
+ main->setting.nest.used = 0;
+ main->setting.quotes_object.used = 0;
+ main->setting.quotes_content.used = 0;
+
+ fll_fss_embedded_list_read(main->setting.buffer, &main->setting.range, &main->setting.nest, &main->setting.delimits_object, &main->setting.delimits_content, &main->setting.comments, &main->setting.state);
+
+ if (F_status_is_error(main->setting.state.status)) {
+ if (F_status_set_fine(main->setting.state.status) == F_interrupt) return;
+
+ fll_error_file_print(
+ &main->program.error,
+ F_status_set_fine(main->setting.state.status),
+ macro_fss_read_f(fll_fss_embedded_list_read),
+ fll_error_file_flag_fallback_e,
+ fss_read_file_identify(main->setting.range.start, main->setting.files),
+ f_file_operation_process_s,
+ fll_error_file_type_file_e
+ );
+
+ return;
+ }
+
+ if (main->setting.state.status == F_data_not_stop || main->setting.state.status == F_data_not_eos) {
+ if (!(main->setting.flag & fss_read_main_flag_total_e)) {
+ main->setting.state.status = F_status_set_warning(main->setting.state.status);
+
+ return;
+ }
+ }
+
+ main->setting.state.status = F_none;
+ }
+#endif // _di_fss_read_embedded_list_process_load_
+
#ifdef __cplusplus
} // extern "C"
#endif
extern void fss_read_embedded_list_process_help(void * const main);
#endif // _di_fss_read_embedded_list_process_help_
+/**
+ * Process the buffer, loading the FSS data.
+ *
+ * This will print an error message on error.
+ *
+ * @param main
+ * The program and settings data.
+ *
+ * Must not be NULL.
+ * Must be of type fss_read_main_t.
+ *
+ * This alters main.setting.state.status:
+ * F_none on success.
+ *
+ * F_data_not_stop (with warning bit) on no valid FSS data found and reached stopping point.
+ * F_data_not_eos (with warning bit) on no valid FSS data found and reached end of string.
+ *
+ * Errors (with error bit) from: fll_fss_embedded_list_read()
+ *
+ * @see fll_fss_embedded_list_read()
+ *
+ * @see fss_read_file_identify()
+ */
+#ifndef _di_fss_read_embedded_list_process_load_
+ extern void fss_read_embedded_list_process_load(void * const main);
+#endif // _di_fss_read_embedded_list_process_load_
+
#ifdef __cplusplus
} // extern "C"
#endif
data.program.output.flag |= fss_read_print_flag_out_e;
data.program.message.flag |= fss_read_print_flag_message_e | fss_read_print_flag_out_e;
data.program.warning.flag |= fss_read_print_flag_warning_e | fss_read_print_flag_out_e;
+
data.program.error.custom = (void *) &data;
data.program.debug.custom = (void *) &data;
data.program.message.custom = (void *) &data;
data.program.output.custom = (void *) &data;
data.program.warning.custom = (void *) &data;
+ data.setting.flag |= fss_read_main_flag_depth_multiple_e;
+
data.setting.state.custom = (void *) &data;
data.setting.standard = fss_read_embedded_list_standard_s;
- data.setting.flag |= fss_read_main_flag_ignore_e;
- data.setting.flag |= fss_read_main_flag_content_multiple_e;
- data.setting.flag |= fss_read_main_flag_depth_support_e | fss_read_main_flag_select_support_e;
-
data.callback.process_help = &fss_read_embedded_list_process_help;
data.callback.process_last_line = &fss_read_process_last_line;
- //data.callback.process_load_depth = &fss_read_setting_load_depth;
+ data.callback.process_load_depth = &fss_read_setting_load_depth;
data.callback.process_normal = &fss_read_process_normal;
- //data.callback.process_at = &fss_read_process_normal_at;
- //data.callback.process_columns = &fss_read_process_normal_columns;
- //data.callback.process_line = &fss_read_process_normal_line;
- //data.callback.process_load = &fss_read_basic_process_load;
- //data.callback.process_name = &fss_read_process_normal_name;
- //data.callback.process_total = &fss_read_process_normal_total;
-
- //data.callback.print_at = &fss_read_print_at;
- //data.callback.print_content = &fss_read_print_content;
- //data.callback.print_content_ignore = &fss_read_print_content_ignore;
- //data.callback.print_object = &fss_read_print_object;
- //data.callback.print_object_end = &fss_read_print_object_end;
- //data.callback.print_set_end = &fss_read_print_set_end;
+ data.callback.process_at = &fss_read_process_normal_at;
+ data.callback.process_columns = &fss_read_process_normal_columns;
+ data.callback.process_line = &fss_read_process_normal_line;
+ data.callback.process_load = &fss_read_embedded_list_process_load;
+ data.callback.process_name = &fss_read_process_normal_name;
+ data.callback.process_total = &fss_read_process_normal_total;
+
+ data.callback.print_at = &fss_read_print_at;
+ data.callback.print_content = &fss_read_print_content;
+ data.callback.print_content_ignore = &fss_read_print_content_ignore;
+ data.callback.print_object = &fss_read_print_object;
+ data.callback.print_object_end = &fss_read_print_object_end;
+ data.callback.print_set_end = &fss_read_print_set_end;
f_console_parameter_t parameters[] = fss_read_console_parameter_t_initialize;
data.program.parameters.array = parameters;
fll_program_print_help_usage(print, fss_read_embedded_list_program_name_s, f_string_empty_s);
+ f_print_dynamic_raw(f_string_eol_s, print->to);
+
fss_read_print_message_help_note_header(print, fss_read_format_code_short_0008_s, fss_read_format_code_name_0008_s);
fss_read_print_message_help_pipe(print);
}
#endif // _di_fss_read_extended_process_help_
+#ifndef _di_fss_read_extended_process_load_
+ void fss_read_extended_process_load(void * const void_main) {
+
+ if (!void_main) return;
+
+ fss_read_main_t * const main = (fss_read_main_t *) void_main;
+
+ if (main->setting.buffer.used) {
+ main->setting.range.start = 0;
+ main->setting.range.stop = main->setting.buffer.used;
+ }
+ else {
+ main->setting.range.start = 1;
+ main->setting.range.stop = 0;
+ }
+
+ main->setting.comments.used = 0;
+ main->setting.delimits_object.used = 0;
+ main->setting.delimits_content.used = 0;
+ main->setting.nest.used = 0;
+ main->setting.quotes_object.used = 0;
+ main->setting.quotes_content.used = 0;
+
+ fll_fss_extended_read(main->setting.buffer, &main->setting.range, &main->setting.objects, &main->setting.contents, &main->setting.quotes_object, &main->setting.quotes_content, &main->setting.delimits_object, &main->setting.delimits_content, &main->setting.state);
+
+ if (F_status_is_error(main->setting.state.status)) {
+ if (F_status_set_fine(main->setting.state.status) == F_interrupt) return;
+
+ fll_error_file_print(
+ &main->program.error,
+ F_status_set_fine(main->setting.state.status),
+ macro_fss_read_f(fll_fss_extended_read),
+ fll_error_file_flag_fallback_e,
+ fss_read_file_identify(main->setting.range.start, main->setting.files),
+ f_file_operation_process_s,
+ fll_error_file_type_file_e
+ );
+
+ return;
+ }
+
+ if (main->setting.state.status == F_data_not_stop || main->setting.state.status == F_data_not_eos) {
+ if (!(main->setting.flag & fss_read_main_flag_total_e)) {
+ main->setting.state.status = F_status_set_warning(main->setting.state.status);
+
+ return;
+ }
+ }
+
+ main->setting.state.status = F_none;
+ }
+#endif // _di_fss_read_extended_process_load_
+
#ifdef __cplusplus
} // extern "C"
#endif
#endif // _di_fss_read_extended_process_help_
/**
- * Process a single Object, printing the FSS-0001 (Extended) if valid or an error if invalid.
+ * Process the buffer, loading the FSS data.
+ *
+ * This will print an error message on error.
*
* @param main
* The program and settings data.
+ *
+ * Must not be NULL.
* Must be of type fss_read_main_t.
*
- * This alters main.setting.state.status.
- * This uses and alters main.setting.buffer.
+ * This alters main.setting.state.status:
+ * F_none on success.
+ *
+ * F_data_not_stop (with warning bit) on no valid FSS data found and reached stopping point.
+ * F_data_not_eos (with warning bit) on no valid FSS data found and reached end of string.
+ *
+ * Errors (with error bit) from: fll_fss_extended_read()
+ *
+ * @see fll_fss_extended_read()
+ *
+ * @see fss_read_file_identify()
*/
-#ifndef _di_fss_read_extended_process_object_
- extern void fss_read_extended_process_object(void * const main);
-#endif // _di_fss_read_extended_process_object_
+#ifndef _di_fss_read_extended_process_load_
+ extern void fss_read_extended_process_load(void * const main);
+#endif // _di_fss_read_extended_process_load_
#ifdef __cplusplus
} // extern "C"
data.program.output.flag |= fss_read_print_flag_out_e;
data.program.message.flag |= fss_read_print_flag_message_e | fss_read_print_flag_out_e;
data.program.warning.flag |= fss_read_print_flag_warning_e | fss_read_print_flag_out_e;
+
data.program.error.custom = (void *) &data;
data.program.debug.custom = (void *) &data;
data.program.message.custom = (void *) &data;
data.program.output.custom = (void *) &data;
data.program.warning.custom = (void *) &data;
+ data.setting.flag |= fss_read_main_flag_line_single_e | fss_read_main_flag_content_multiple_e;
+ data.setting.flag |= fss_read_main_flag_quote_content_e | fss_read_main_flag_quote_object_e;
+
data.setting.state.custom = (void *) &data;
data.setting.standard = fss_read_extended_standard_s;
- data.setting.flag |= fss_read_main_flag_content_multiple_e;
- data.setting.flag |= fss_read_main_flag_quote_content_e | fss_read_main_flag_quote_object_e;
-
data.callback.process_help = &fss_read_extended_process_help;
data.callback.process_last_line = &fss_read_process_last_line;
- //data.callback.process_load_depth = &fss_read_setting_load_depth;
+ data.callback.process_load_depth = &fss_read_setting_load_depth;
data.callback.process_normal = &fss_read_process_normal;
- //data.callback.process_at = &fss_read_process_normal_at;
- //data.callback.process_columns = &fss_read_process_normal_columns;
- //data.callback.process_line = &fss_read_process_normal_line;
- //data.callback.process_load = &fss_read_basic_process_load;
- //data.callback.process_name = &fss_read_process_normal_name;
- //data.callback.process_total = &fss_read_process_normal_total;
-
- //data.callback.print_at = &fss_read_print_at;
- //data.callback.print_content = &fss_read_print_content;
- //data.callback.print_content_ignore = &fss_read_print_content_ignore;
- //data.callback.print_object = &fss_read_print_object;
- //data.callback.print_object_end = &fss_read_print_object_end;
- //data.callback.print_set_end = &fss_read_print_set_end;
+ data.callback.process_at = &fss_read_process_normal_at;
+ data.callback.process_columns = &fss_read_process_normal_columns;
+ data.callback.process_line = &fss_read_process_normal_line;
+ data.callback.process_load = &fss_read_extended_process_load;
+ data.callback.process_name = &fss_read_process_normal_name;
+ data.callback.process_total = &fss_read_process_normal_total;
+
+ data.callback.print_at = &fss_read_extended_print_at;
+ data.callback.print_content = &fss_read_print_content;
+ data.callback.print_content_ignore = &fss_read_print_content_ignore;
+ data.callback.print_object = &fss_read_print_object;
+ data.callback.print_object_end = &fss_read_print_object_end;
+ data.callback.print_set_end = &fss_read_print_set_end;
f_console_parameter_t parameters[] = fss_read_console_parameter_t_initialize;
data.program.parameters.array = parameters;
extern "C" {
#endif
+#ifndef _di_fss_read_extended_print_at_
+ f_status_t fss_read_extended_print_at(fl_print_t * const print, const f_array_length_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content) {
+
+ if (!print || !print->custom) return F_status_set_error(F_output_not);
+
+ fss_read_main_t * const main = (fss_read_main_t *) print->custom;
+
+ if (at >= main->setting.contents.used) return F_output_not;
+
+ // @todo This is copied from fss_read_print_at() and needs to be updated to handle multiple content.
+
+ if ((main->setting.flag & fss_read_main_flag_object_e) || (main->setting.flag & fss_read_main_flag_content_e) && (main->setting.contents.array[at].used || (main->setting.flag & fss_read_main_flag_empty_e))) {
+ if (main->setting.flag & fss_read_main_flag_object_e) {
+ if (main->callback.print_object) {
+ main->callback.print_object(&main->program.output, at, delimits_object);
+ }
+
+ if (main->setting.flag & fss_read_main_flag_content_e) {
+ if (main->callback.print_object_end) {
+ main->callback.print_object_end(&main->program.output);
+ }
+ }
+ }
+
+ if ((main->setting.flag & fss_read_main_flag_content_e) && main->setting.contents.array[at].used) {
+ if (main->callback.print_content) {
+ main->callback.print_content(&main->program.output, main->setting.contents.array[at].array[0], main->setting.quotes_content.array[at].array[0], delimits_content);
+ }
+ }
+
+ if (main->callback.print_set_end) {
+ main->callback.print_set_end(&main->program.output);
+ }
+ }
+
+ return F_none;
+ }
+#endif // _di_fss_read_extended_print_at_
+
#ifndef _di_fss_read_extended_print_help_
f_status_t fss_read_extended_print_help(fl_print_t * const print) {
fll_program_print_help_usage(print, fss_read_extended_program_name_s, f_string_empty_s);
+ f_print_dynamic_raw(f_string_eol_s, print->to);
+
fss_read_print_message_help_note_header(print, fss_read_format_code_short_0001_s, fss_read_format_code_name_0001_s);
fss_read_print_message_help_pipe(print);
#endif
/**
+ * Process printing the buffer according to "at" position and given delimits.
+ *
+ * This locks, uses, and unlocks the file stream.
+ *
+ * @param print
+ * The output structure to print to.
+ *
+ * The print.custom is expected to be of type fss_read_main_t.
+ *
+ * This does not alter print.custom.setting.state.status.
+ * @param at
+ * The "at" position to be printed.
+ * @param delimits_object
+ * The delimits array representing a delimited Object.
+ * This represents the positions within the current Object at the "at" position.
+ * @param delimits_content
+ * The delimits array representing a delimited Content.
+ * This represents the positions within the current Content at the "at" position.
+ *
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if a parameter is NULL.
+ *
+ * @see fll_print_dynamic_partial()
+ * @see fll_print_except_dynamic_partial()
+ * @see fll_print_trim_dynamic_partial()
+ * @see fll_print_trim_except_dynamic_partial()
+ *
+ * @see main.callback.print_object()
+ * @see main.callback.print_object_end()
+ * @see main.callback.print_set_end()
+ */
+#ifndef _di_fss_read_extended_print_at_
+ extern f_status_t fss_read_extended_print_at(fl_print_t * const print, const f_array_length_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content);
+#endif // _di_fss_read_extended_print_at_
+
+/**
* Print help for FSS-0001 (Extended).
*
* @param print
}
#endif // _di_fss_read_extended_list_process_help_
+#ifndef _di_fss_read_extended_list_process_load_
+ void fss_read_extended_list_process_load(void * const void_main) {
+
+ if (!void_main) return;
+
+ fss_read_main_t * const main = (fss_read_main_t *) void_main;
+
+ if (main->setting.buffer.used) {
+ main->setting.range.start = 0;
+ main->setting.range.stop = main->setting.buffer.used;
+ }
+ else {
+ main->setting.range.start = 1;
+ main->setting.range.stop = 0;
+ }
+
+ main->setting.comments.used = 0;
+ main->setting.delimits_object.used = 0;
+ main->setting.delimits_content.used = 0;
+ main->setting.nest.used = 0;
+ main->setting.quotes_object.used = 0;
+ main->setting.quotes_content.used = 0;
+
+ fll_fss_extended_list_read(main->setting.buffer, &main->setting.range, &main->setting.objects, &main->setting.contents, &main->setting.delimits_object, &main->setting.delimits_content, &main->setting.comments, &main->setting.state);
+
+ if (F_status_is_error(main->setting.state.status)) {
+ if (F_status_set_fine(main->setting.state.status) == F_interrupt) return;
+
+ fll_error_file_print(
+ &main->program.error,
+ F_status_set_fine(main->setting.state.status),
+ macro_fss_read_f(fll_fss_extended_list_read),
+ fll_error_file_flag_fallback_e,
+ fss_read_file_identify(main->setting.range.start, main->setting.files),
+ f_file_operation_process_s,
+ fll_error_file_type_file_e
+ );
+
+ return;
+ }
+
+ if (main->setting.state.status == F_data_not_stop || main->setting.state.status == F_data_not_eos) {
+ if (!(main->setting.flag & fss_read_main_flag_total_e)) {
+ main->setting.state.status = F_status_set_warning(main->setting.state.status);
+
+ return;
+ }
+ }
+
+ main->setting.state.status = F_none;
+ }
+#endif // _di_fss_read_extended_list_process_load_
+
#ifdef __cplusplus
} // extern "C"
#endif
extern void fss_read_extended_list_process_help(void * const main);
#endif // _di_fss_read_extended_list_process_help_
+/**
+ * Process the buffer, loading the FSS data.
+ *
+ * This will print an error message on error.
+ *
+ * @param main
+ * The program and settings data.
+ *
+ * Must not be NULL.
+ * Must be of type fss_read_main_t.
+ *
+ * This alters main.setting.state.status:
+ * F_none on success.
+ *
+ * F_data_not_stop (with warning bit) on no valid FSS data found and reached stopping point.
+ * F_data_not_eos (with warning bit) on no valid FSS data found and reached end of string.
+ *
+ * Errors (with error bit) from: fll_fss_extended_list_read()
+ *
+ * @see fll_fss_extended_list_read()
+ *
+ * @see fss_read_file_identify()
+ */
+#ifndef _di_fss_read_extended_list_process_load_
+ extern void fss_read_extended_list_process_load(void * const main);
+#endif // _di_fss_read_extended_list_process_load_
+
#ifdef __cplusplus
} // extern "C"
#endif
data.program.output.flag |= fss_read_print_flag_out_e;
data.program.message.flag |= fss_read_print_flag_message_e | fss_read_print_flag_out_e;
data.program.warning.flag |= fss_read_print_flag_warning_e | fss_read_print_flag_out_e;
+
data.program.error.custom = (void *) &data;
data.program.debug.custom = (void *) &data;
data.program.message.custom = (void *) &data;
data.program.output.custom = (void *) &data;
data.program.warning.custom = (void *) &data;
+ data.setting.flag |= fss_read_main_flag_trim_object_e;
+
data.setting.state.custom = (void *) &data;
data.setting.standard = fss_read_extended_list_standard_s;
- data.setting.flag |= fss_read_main_flag_ignore_e;
-
data.callback.process_help = &fss_read_extended_list_process_help;
data.callback.process_last_line = &fss_read_process_last_line;
- //data.callback.process_load_depth = &fss_read_setting_load_depth;
+ data.callback.process_load_depth = &fss_read_setting_load_depth;
data.callback.process_normal = &fss_read_process_normal;
- //data.callback.process_at = &fss_read_process_normal_at;
- //data.callback.process_columns = &fss_read_process_normal_columns;
- //data.callback.process_line = &fss_read_process_normal_line;
- //data.callback.process_load = &fss_read_basic_process_load;
- //data.callback.process_name = &fss_read_process_normal_name;
- //data.callback.process_total = &fss_read_process_normal_total;
-
- //data.callback.print_at = &fss_read_print_at;
- //data.callback.print_content = &fss_read_print_content;
- //data.callback.print_content_ignore = &fss_read_print_content_ignore;
- //data.callback.print_object = &fss_read_print_object;
- //data.callback.print_object_end = &fss_read_print_object_end;
- //data.callback.print_set_end = &fss_read_print_set_end;
+ data.callback.process_at = &fss_read_process_normal_at;
+ data.callback.process_columns = &fss_read_process_normal_columns;
+ data.callback.process_line = &fss_read_process_normal_line;
+ data.callback.process_load = &fss_read_extended_list_process_load;
+ data.callback.process_name = &fss_read_process_normal_name;
+ data.callback.process_total = &fss_read_process_normal_total;
+
+ data.callback.print_at = &fss_read_print_at;
+ data.callback.print_content = &fss_read_print_content;
+ data.callback.print_content_ignore = &fss_read_print_content_ignore;
+ data.callback.print_object = &fss_read_print_object;
+ data.callback.print_object_end = &fss_read_print_object_end;
+ data.callback.print_set_end = &fss_read_extended_list_print_set_end;
f_console_parameter_t parameters[] = fss_read_console_parameter_t_initialize;
data.program.parameters.array = parameters;
fll_program_print_help_usage(print, fss_read_extended_list_program_name_s, f_string_empty_s);
+ f_print_dynamic_raw(f_string_eol_s, print->to);
+
fss_read_print_message_help_note_header(print, fss_read_format_code_short_0003_s, fss_read_format_code_name_0003_s);
fss_read_print_message_help_pipe(print);
}
#endif // _di_fss_read_extended_list_print_help_
+#ifndef _di_fss_read_extended_list_print_set_end_
+ f_status_t fss_read_extended_list_print_set_end(fl_print_t * const print) {
+
+ if (!print || !print->custom) return F_status_set_error(F_output_not);
+
+ fss_read_main_t * const main = (fss_read_main_t *) print->custom;
+
+ // @todo
+ //fll_print_dynamic_raw((main->setting.flag & fss_read_main_flag_pipe_e) ? fss_read_pipe_content_end_s : f_string_eol_s, print->to);
+
+ return F_none;
+ }
+#endif // _di_fss_read_extended_list_print_set_end_
+
#ifdef __cplusplus
} // extern "C"
#endif
extern f_status_t fss_read_extended_list_print_help(fl_print_t * const print);
#endif // _di_fss_read_extended_list_print_help_
+/**
+ * Print the end of an Object/Content set.
+ *
+ * This locks, uses, and unlocks the file stream.
+ *
+ * @param print
+ * The output structure to print to.
+ *
+ * The print.custom is expected to be of type fss_read_main_t.
+ *
+ * This does not alter print.custom.setting.state.status.
+ *
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if a parameter is NULL.
+ *
+ * @see fll_print_dynamic_raw()
+ */
+#ifndef _di_fss_read_extended_list_print_set_end_
+ extern f_status_t fss_read_extended_list_print_set_end(fl_print_t * const print);
+#endif // _di_fss_read_extended_list_print_set_end_
+
#ifdef __cplusplus
} // extern "C"
#endif
f_file_t file = f_file_t_initialize;
+ fss_read_files_resize(((main->program.pipe & fll_program_data_pipe_input_e) ? 1 : 0) + parameters->remaining.used, &main->setting.files);
+
+ if (F_status_is_error(main->setting.state.status)) {
+ fss_read_print_error(&main->program.error, macro_fss_read_f(fss_read_files_resize));
+
+ return;
+ }
+
if (main->program.pipe & fll_program_data_pipe_input_e) {
file.id = F_type_descriptor_input_d;
file.stream = F_type_input_d;
main->setting.files.array[0].range.start = 0;
- main->setting.state.status = f_file_stream_read(file, &main->setting.buffer);
+ while (main->setting.state.status != F_none_eof) {
+
+ if (fss_read_signal_check(main)) break;
+
+ main->setting.state.status = f_file_stream_read_block(file, &main->setting.buffer);
+ if (F_status_is_error(main->setting.state.status)) break;
+ } // while
if (F_status_is_error(main->setting.state.status)) {
if ((main->setting.flag & fss_read_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) {
fll_print_dynamic_raw(f_string_eol_s, main->program.message.to);
}
- fll_error_file_print(&main->program.error, F_status_set_fine(main->setting.state.status), macro_fss_read_f(f_file_stream_read), fll_error_file_flag_fallback_e, f_string_ascii_minus_s, f_file_operation_read_s, fll_error_file_type_pipe_e);
+ fll_error_file_print(&main->program.error, F_status_set_fine(main->setting.state.status), macro_fss_read_f(f_file_stream_read_block), fll_error_file_flag_fallback_e, f_string_ascii_minus_s, f_file_operation_read_s, fll_error_file_type_pipe_e);
return;
}
#endif // _di_fss_read_setting_load_
#ifndef _di_fss_read_setting_load_depth_
- void fss_read_setting_load_depth(const f_console_arguments_t arguments, fss_read_main_t * const main, f_console_parameters_t * const parameters) {
+ void fss_read_setting_load_depth(const f_console_arguments_t arguments, void * const void_main, f_console_parameters_t * const parameters) {
- if (!main || !parameters) return;
+ if (!void_main || !parameters) return;
+
+ fss_read_main_t * const main = (fss_read_main_t *) void_main;
f_array_length_t i = 1;
i = parameters->array[fss_read_parameter_depth_e].values.used;
}
- if (i > main->setting.depths.size) {
- main->setting.state.status = fss_read_depths_resize(i, &main->setting.depths);
+ // @fixme: much of the logic in this depths handling was static and is now dynamic, this needs to be reviewed and updated.
+ if (i + 1 > main->setting.depths.size) {
+ main->setting.state.status = fss_read_depths_resize(i + 1, &main->setting.depths);
if (F_status_is_error(main->setting.state.status)) {
if ((main->setting.flag & fss_read_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) {
main->setting.depths.array[i].index_at = 0;
main->setting.depths.array[i].index_name = 0;
main->setting.depths.array[i].value_at = 0;
-
- // This dynamic string is actually a static string, so clear it between loops.
- macro_f_string_dynamic_t_clear(main->setting.depths.array[i].value_name);
+ main->setting.depths.array[i].value_name.used = 0; // @fixme this needs to be fully reset to 0.
if (!parameters->array[fss_read_parameter_depth_e].values.used) {
position_depth = 0;
} // for
if (main->callback.process_load_depth) {
- main->callback.process_load_depth(arguments, (void *) main);
+ main->callback.process_load_depth(arguments, (void *) main, parameters);
if (F_status_is_error(main->setting.state.status)) return;
}
* @param main
* The main program data.
*
+ * Must not be NULL.
+ * Must be of type fss_read_main_t.
+ *
* This calls main.callback.process_load_depth() if not NULL.
*
* This alters main.setting.state.status:
* @see fss_read_setting_load()
*/
#ifndef _di_fss_read_setting_load_depth_
- extern void fss_read_setting_load_depth(const f_console_arguments_t arguments, fss_read_main_t * const main, f_console_parameters_t * const parameters);
+ extern void fss_read_setting_load_depth(const f_console_arguments_t arguments, void * const main, f_console_parameters_t * const parameters);
#endif // _di_fss_read_setting_load_depth_
#ifdef __cplusplus
* - 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).
+ * - trim_object: Empty space before and after Objects (but not Content) will not be printed (They will be trimmed).
* - version: Print version.
*/
#ifndef _di_fss_read_main_flag_e_
fss_read_main_flag_select_e = 0x100000,
fss_read_main_flag_total_e = 0x200000,
fss_read_main_flag_trim_e = 0x400000,
- fss_read_main_flag_version_e = 0x800000,
+ fss_read_main_flag_trim_object_e = 0x800000,
+ fss_read_main_flag_version_e = 0x1000000,
}; // enum
#endif // _di_fss_read_main_flag_e_
-//@todo figure out if fss_read_main_flag_ignore_e is needed
-
/**
* The main program parameters.
*/
fss_read_parameter_line_first_no_e,
fss_read_parameter_line_last_no_e,
+ fss_read_parameter_as_e,
fss_read_parameter_at_e,
fss_read_parameter_content_e,
fss_read_parameter_columns_e,
{ \
macro_fll_program_console_parameter_standard_initialize, \
\
- macro_f_console_parameter_t_initialize_3(fss_read_short_at_s, fss_read_long_at_s, 0, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_3(fss_read_short_content_s, fss_read_long_content_s, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_3(fss_read_short_columns_s, fss_read_long_columns_s, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_3(fss_read_short_delimit_s, fss_read_long_delimit_s, 0, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_3(fss_read_short_depth_s, fss_read_long_depth_s, 0, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_3(fss_read_short_empty_s, fss_read_long_empty_s, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_3(fss_read_short_line_s, fss_read_long_line_s, 0, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_3(fss_read_short_name_s, fss_read_long_name_s, 0, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_3(fss_read_short_object_s, fss_read_long_object_s, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_3(fss_read_short_pipe_s, fss_read_long_pipe_s, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_3(fss_read_short_original_s, fss_read_long_original_s, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_3(fss_read_short_select_s, fss_read_long_select_s, 0, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_3(fss_read_short_total_s, fss_read_long_total_s, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_3(fss_read_short_trim_s, fss_read_long_trim_s, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_read_short_as_s, fss_read_long_as_s, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_read_short_at_s, fss_read_long_at_s, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_read_short_content_s, fss_read_long_content_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_read_short_columns_s, fss_read_long_columns_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_read_short_delimit_s, fss_read_long_delimit_s, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_read_short_depth_s, fss_read_long_depth_s, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_read_short_empty_s, fss_read_long_empty_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_read_short_line_s, fss_read_long_line_s, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_read_short_name_s, fss_read_long_name_s, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_read_short_object_s, fss_read_long_object_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_read_short_pipe_s, fss_read_long_pipe_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_read_short_original_s, fss_read_long_original_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_read_short_select_s, fss_read_long_select_s, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_read_short_total_s, fss_read_long_total_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_read_short_trim_s, fss_read_long_trim_s, 0, f_console_flag_normal_e), \
}
- #define fss_read_total_parameters_d 27
+ #define fss_read_total_parameters_d 28
#endif // _di_fss_read_parameter_e_
/**
"f_file_size_by_id",
"f_file_stream_open",
"f_file_stream_read",
+ "f_file_stream_read_block",
"f_file_stream_read_until",
"f_fss_is_space",
"f_rip_dynamic",
"fl_fss_extended_object_read",
"fl_fss_payload_content_read",
"fll_fss_basic_read",
+ "fll_fss_basic_list_read",
+ "fll_fss_embedded_list_read",
+ "fll_fss_extended_read",
+ "fll_fss_extended_list_read",
"fll_fss_payload_read",
"fll_program_parameter_process_context",
"fll_program_parameter_process_verbosity",
"fss_read_depths_resize",
+ "fss_read_files_resize",
"fss_read_setting_load_depth",
};
#endif // _di_fss_read_f_a_
fss_read_f_f_file_size_by_id_e,
fss_read_f_f_file_stream_open_e,
fss_read_f_f_file_stream_read_e,
+ fss_read_f_f_file_stream_read_block_e,
fss_read_f_f_file_stream_read_until_e,
fss_read_f_f_fss_is_space_e,
fss_read_f_f_rip_dynamic_e,
fss_read_f_fl_fss_extended_object_read_e,
fss_read_f_fl_fss_payload_content_read_e,
fss_read_f_fll_fss_basic_read_e,
+ fss_read_f_fll_fss_basic_list_read_e,
+ fss_read_f_fll_fss_embedded_list_read_e,
+ fss_read_f_fll_fss_extended_read_e,
+ fss_read_f_fll_fss_extended_list_read_e,
fss_read_f_fll_fss_payload_read_e,
fss_read_f_fll_program_parameter_process_context_e,
fss_read_f_fll_program_parameter_process_verbosity_e,
fss_read_f_fss_read_depths_resize_e,
+ fss_read_f_fss_read_files_resize_e,
fss_read_f_fss_read_setting_load_depth_e,
}; // enum
#endif // _di_fss_read_f_e_
#endif // _di_fss_read_delimit_mode_s_
#ifndef _di_fss_read_parameter_s_
+ const f_string_static_t fss_read_short_as_s = macro_f_string_static_t_initialize_1(FSS_READ_short_as_s, 0, FSS_READ_short_as_s_length);
const f_string_static_t fss_read_short_at_s = macro_f_string_static_t_initialize_1(FSS_READ_short_at_s, 0, FSS_READ_short_at_s_length);
const f_string_static_t fss_read_short_content_s = macro_f_string_static_t_initialize_1(FSS_READ_short_content_s, 0, FSS_READ_short_content_s_length);
const f_string_static_t fss_read_short_columns_s = macro_f_string_static_t_initialize_1(FSS_READ_short_columns_s, 0, FSS_READ_short_columns_s_length);
const f_string_static_t fss_read_short_total_s = macro_f_string_static_t_initialize_1(FSS_READ_short_total_s, 0, FSS_READ_short_total_s_length);
const f_string_static_t fss_read_short_trim_s = macro_f_string_static_t_initialize_1(FSS_READ_short_trim_s, 0, FSS_READ_short_trim_s_length);
+ const f_string_static_t fss_read_long_as_s = macro_f_string_static_t_initialize_1(FSS_READ_long_as_s, 0, FSS_READ_long_as_s_length);
const f_string_static_t fss_read_long_at_s = macro_f_string_static_t_initialize_1(FSS_READ_long_at_s, 0, FSS_READ_long_at_s_length);
const f_string_static_t fss_read_long_content_s = macro_f_string_static_t_initialize_1(FSS_READ_long_content_s, 0, FSS_READ_long_content_s_length);
const f_string_static_t fss_read_long_columns_s = macro_f_string_static_t_initialize_1(FSS_READ_long_columns_s, 0, FSS_READ_long_columns_s_length);
* The main program parameters.
*/
#ifndef _di_fss_read_parameter_s_
+ #define FSS_READ_short_as_s "A"
#define FSS_READ_short_at_s "a"
#define FSS_READ_short_content_s "c"
#define FSS_READ_short_columns_s "C"
#define FSS_READ_short_total_s "t"
#define FSS_READ_short_trim_s "T"
+ #define FSS_READ_long_as_s "as"
#define FSS_READ_long_at_s "at"
#define FSS_READ_long_content_s "content"
#define FSS_READ_long_columns_s "columns"
#define FSS_READ_long_total_s "total"
#define FSS_READ_long_trim_s "trim"
+ #define FSS_READ_short_as_s_length 1
#define FSS_READ_short_at_s_length 1
#define FSS_READ_short_content_s_length 1
#define FSS_READ_short_columns_s_length 1
#define FSS_READ_short_total_s_length 1
#define FSS_READ_short_trim_s_length 1
+ #define FSS_READ_long_as_s_length 2
#define FSS_READ_long_at_s_length 2
#define FSS_READ_long_content_s_length 7
#define FSS_READ_long_columns_s_length 7
#define FSS_READ_long_total_s_length 5
#define FSS_READ_long_trim_s_length 4
+ extern const f_string_static_t fss_read_short_as_s;
extern const f_string_static_t fss_read_short_at_s;
extern const f_string_static_t fss_read_short_content_s;
extern const f_string_static_t fss_read_short_columns_s;
extern const f_string_static_t fss_read_short_total_s;
extern const f_string_static_t fss_read_short_trim_s;
+ extern const f_string_static_t fss_read_long_as_s;
extern const f_string_static_t fss_read_long_at_s;
extern const f_string_static_t fss_read_long_content_s;
extern const f_string_static_t fss_read_long_columns_s;
f_string_ranges_resize(0, &setting->comments);
f_string_rangess_resize(0, &setting->contents);
+ f_fss_nest_resize(0, &setting->nest);
+
f_array_lengths_resize(0, &setting->delimits_object);
f_array_lengths_resize(0, &setting->delimits_content);
* process_last_line: Process printing last line if necessary when loading in a file (or pipe).
* process_load_depth: Process loading of the depth related parameters when loading the settings.
* process_normal: Process normally (data from parameters and files).
- * process_pipe: Process data piped to the program from standard input (stdin).
*
* process_at: Process at parameter, usually called by the process_normal() callback.
* process_columns: Process columns parameter, usually called by the process_normal() callback.
*
* print_at: Print at the given location, usually called by the process_normal() callback.
* print_object: Print the Object, usually called by the process_normal() callback.
- * print_content: Print the Object, usually called by the process_normal() callback.
+ * print_content: Print the Content, usually called by the process_normal() callback.
* print_content_ignore: Print the Content ignore character, usually called by several callbacks within the process_normal() callback for a pipe.
* print_object_end: Print the Object end, usually called by several callbacks within the process_normal() callback.
- * print_set_end: Print the set end, usually called by several callbacks within the process_normal() callback.
+ * print_set_end: Print the Content set end, usually called by several callbacks within the process_normal() callback.
*/
#ifndef _di_fss_read_callback_t_
typedef struct {
void (*process_help)(void * const main);
void (*process_last_line)(void * const main);
- void (*process_load_depth)(const f_console_arguments_t arguments, void * const main);
+ void (*process_load_depth)(const f_console_arguments_t arguments, void * const main, f_console_parameters_t * const parameters);
void (*process_normal)(void * const main);
- void (*process_pipe)(void * const main);
void (*process_at)(void * const main, const bool names[], const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content);
void (*process_columns)(void * const main, const bool names[]);
void (*process_name)(void * const main, bool names[]);
void (*process_total)(void * const main, const bool names[]);
- void (*print_at)(void * const main, const f_array_length_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content);
- void (*print_object)(fl_print_t * const print, const f_array_length_t at, const f_fss_delimits_t delimits);
- void (*print_content)(fl_print_t * const print, const f_string_range_t range, const uint8_t quote, const f_fss_delimits_t delimits);
- void (*print_content_ignore)(fl_print_t * const print);
- void (*print_object_end)(fl_print_t * const print);
- void (*print_set_end)(fl_print_t * const print);
+ f_status_t (*print_at)(fl_print_t * const print, const f_array_length_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content);
+ f_status_t (*print_object)(fl_print_t * const print, const f_array_length_t at, const f_fss_delimits_t delimits);
+ f_status_t (*print_content)(fl_print_t * const print, const f_string_range_t range, const uint8_t quote, const f_fss_delimits_t delimits);
+ f_status_t (*print_content_ignore)(fl_print_t * const print);
+ f_status_t (*print_object_end)(fl_print_t * const print);
+ f_status_t (*print_set_end)(fl_print_t * const print);
} fss_read_callback_t;
#define fss_read_callback_t_initialize \
0, \
0, \
0, \
- 0, \
}
#endif // _di_fss_read_callback_t_
* standard: A human-friendly string describing the standard in use, such as "FSS-0000 (Basic)".
* buffer: The buffer containing all loaded files (and STDIN pipe).
*
- * objects: The positions within the buffer representing Objects.
+ * comments: The positions within the buffer representing comments.
* contents: The positions within the buffer representing Contents.
* delimits_object: The positions within the buffer representing Object character delimits.
* delimits_content: The positions within the buffer representing Content character delimits.
- * comments: The positions within the buffer representing comments.
+ * nests: The positions within the buffer representing nested Objects and Contents.
+ * objects: The positions within the buffer representing Objects.
+ * quotes_object: The quotes within the Object structure.
+ * quotes_content: The quotes within the Content structure.
*/
#ifndef _di_fss_read_setting_t_
typedef struct {
f_string_static_t standard;
f_string_dynamic_t buffer;
- f_fss_objects_t objects;
+ f_fss_comments_t comments;
f_fss_contents_t contents;
f_fss_delimits_t delimits_object;
f_fss_delimits_t delimits_content;
- f_fss_comments_t comments;
+ f_fss_nest_t nest;
+ f_fss_objects_t objects;
+
f_uint8s_t quotes_object;
f_uint8ss_t quotes_content;
} fss_read_setting_t;
fss_read_depths_t_initialize, \
f_string_static_t_initialize, \
f_string_dynamic_t_initialize, \
- f_fss_objects_t_initialize, \
+ f_fss_comments_t_initialize, \
f_fss_contents_t_initialize, \
f_fss_delimits_t_initialize, \
f_fss_delimits_t_initialize, \
- f_fss_comments_t_initialize, \
+ f_fss_nest_t_initialize, \
+ f_fss_objects_t_initialize, \
f_uint8s_t_initialize, \
f_uint8ss_t_initialize, \
}
return;
}
- if (main->program.pipe & fll_program_data_pipe_input_e) {
- if (main->callback.process_pipe) {
- main->callback.process_pipe(void_main);
- }
- }
-
- if (F_status_is_error_not(main->setting.state.status)) {
- if (main->setting.flag & (fss_read_main_flag_object_e | fss_read_main_flag_content_e)) {
- if (main->callback.process_normal) {
- main->callback.process_normal(void_main);
- }
+ if (main->setting.flag & (fss_read_main_flag_object_e | fss_read_main_flag_content_e)) {
+ if (main->callback.process_normal) {
+ main->callback.process_normal(void_main);
}
}
data.program.output.flag |= fss_read_print_flag_out_e;
data.program.message.flag |= fss_read_print_flag_message_e | fss_read_print_flag_out_e;
data.program.warning.flag |= fss_read_print_flag_warning_e | fss_read_print_flag_out_e;
+
data.program.error.custom = (void *) &data;
data.program.debug.custom = (void *) &data;
data.program.message.custom = (void *) &data;
main->setting.standard = fss_read_basic_standard_s;
- main->callback.process_content = &fss_read_basic_process_content;
main->callback.process_help = &fss_read_main_process_help;
- main->callback.process_load_depth = 0;
+ main->callback.process_last_line = &fss_read_process_last_line;
+ main->callback.process_load_depth = &fss_read_setting_load_depth;
main->callback.process_normal = &fss_read_process_normal;
- main->callback.process_object = &fss_read_basic_process_object;
- main->callback.process_set = &fss_read_process_set;
+
+ main->callback.process_at = &fss_read_process_normal_at;
+ main->callback.process_columns = &fss_read_process_normal_columns;
+ main->callback.process_line = &fss_read_process_normal_line;
+ main->callback.process_load = 0;
+ main->callback.process_name = &fss_read_process_normal_name;
+ main->callback.process_total = &fss_read_process_normal_total;
+
+ main->callback.print_at = &fss_read_print_at;
+ main->callback.print_content = &fss_read_print_content;
+ main->callback.print_content_ignore = &fss_read_print_content_ignore;
+ main->callback.print_object = &fss_read_print_object;
+ main->callback.print_object_end = &fss_read_print_object_end;
+ main->callback.print_set_end = &fss_read_print_set_end;
if (main->program.parameters.array[fss_read_parameter_as_e].result & f_console_result_value_e && main->program.parameters.array[fss_read_parameter_as_e].values.used) {
main->setting.standard = fss_read_basic_standard_s;
- main->setting.flag -= main->setting.flag & fss_read_main_flag_ignore_e; // Not supported by basic.
- main->setting.flag -= main->setting.flag & fss_read_main_flag_content_multiple_e; // Not supported by basic.
+ // Remove flags not supported for this standard.
+ main->setting.flag -= main->setting.flag & fss_read_main_flag_content_multiple_e;
+ main->setting.flag -= main->setting.flag & fss_read_main_flag_depth_multiple_e;
+ main->setting.flag -= main->setting.flag & fss_read_main_flag_trim_object_e;
+
+ main->setting.flag |= fss_read_main_flag_line_single_e;
+ main->setting.flag |= fss_read_main_flag_quote_content_e | fss_read_main_flag_quote_object_e;
- main->callback.process_content = &fss_read_basic_process_content;
main->callback.process_help = &fss_read_basic_process_help;
- main->callback.process_load_depth = 0;
- main->callback.process_object = &fss_read_basic_process_object;
- main->callback.process_normal = &fss_read_process_normal;
- main->callback.process_set = &fss_read_process_set;
+ main->callback.process_load = &fss_read_basic_process_load;
+ main->callback.print_set_end = &fss_read_print_set_end;
+
+ main->callback.print_object_end = &fss_read_print_object_end;
}
else if (f_compare_dynamic(argv[index], fss_read_format_code_short_0001_s) == F_equal_to ||
f_compare_dynamic(argv[index], fss_read_format_code_long_0001_s) == F_equal_to ||
main->setting.standard = fss_read_extended_standard_s;
- main->setting.flag -= main->setting.flag & fss_read_main_flag_ignore_e; // Not supported by extended.
- main->setting.flag |= fss_read_main_flag_content_multiple_e;
+ // Remove flags not supported for this standard.
+ main->setting.flag -= main->setting.flag & fss_read_main_flag_depth_multiple_e;
+ main->setting.flag -= main->setting.flag & fss_read_main_flag_trim_object_e;
+
+ main->setting.flag |= fss_read_main_flag_line_single_e | fss_read_main_flag_content_multiple_e;
+ main->setting.flag |= fss_read_main_flag_quote_content_e | fss_read_main_flag_quote_object_e;
- main->callback.process_content = &fss_read_extended_process_content;
main->callback.process_help = &fss_read_extended_process_help;
- main->callback.process_load_depth = 0;
- main->callback.process_object = &fss_read_extended_process_object;
- main->callback.process_normal = &fss_read_process_normal;
- main->callback.process_set = &fss_read_process_set;
+ main->callback.process_load = &fss_read_extended_process_load;
+ main->callback.print_set_end = &fss_read_print_set_end_no_eol;
+
+ main->callback.print_object_end = &fss_read_print_object_end;
}
else if (f_compare_dynamic(argv[index], fss_read_format_code_short_0002_s) == F_equal_to ||
f_compare_dynamic(argv[index], fss_read_format_code_long_0002_s) == F_equal_to ||
main->setting.standard = fss_read_basic_list_standard_s;
- main->setting.flag -= main->setting.flag & fss_read_main_flag_ignore_e; // Not supported by basic list.
- main->setting.flag -= main->setting.flag & fss_read_main_flag_content_multiple_e; // Not supported by basic list.
+ // Remove flags not supported for this standard.
+ main->setting.flag -= main->setting.flag & fss_read_main_flag_line_single_e;
+ main->setting.flag -= main->setting.flag & fss_read_main_flag_content_multiple_e;
+ main->setting.flag -= main->setting.flag & fss_read_main_flag_depth_multiple_e;
+ main->setting.flag -= main->setting.flag & fss_read_main_flag_quote_content_e;
+ main->setting.flag -= main->setting.flag & fss_read_main_flag_quote_object_e;
+
+ main->setting.flag |= fss_read_main_flag_trim_object_e;
- main->callback.process_content = &fss_read_basic_list_process_content;
main->callback.process_help = &fss_read_basic_list_process_help;
- main->callback.process_load_depth = 0;
- main->callback.process_object = &fss_read_basic_list_process_object;
- main->callback.process_normal = &fss_read_process_normal;
- main->callback.process_set = &fss_read_process_set;
+ main->callback.process_load = &fss_read_basic_list_process_load;
+ main->callback.print_set_end = &fss_read_print_set_end;
+
+ main->callback.print_object_end = &fss_read_basic_list_print_object_end;
}
else if (f_compare_dynamic(argv[index], fss_read_format_code_short_0003_s) == F_equal_to ||
f_compare_dynamic(argv[index], fss_read_format_code_long_0003_s) == F_equal_to ||
main->setting.standard = fss_read_extended_list_standard_s;
- main->setting.flag |= fss_read_main_flag_ignore_e;
- main->setting.flag -= main->setting.flag & fss_read_main_flag_content_multiple_e; // Not supported by extended list.
+ // Remove flags not supported for this standard.
+ main->setting.flag -= main->setting.flag & fss_read_main_flag_line_single_e;
+ main->setting.flag -= main->setting.flag & fss_read_main_flag_content_multiple_e;
+ main->setting.flag -= main->setting.flag & fss_read_main_flag_depth_multiple_e;
+ main->setting.flag -= main->setting.flag & fss_read_main_flag_quote_content_e;
+ main->setting.flag -= main->setting.flag & fss_read_main_flag_quote_object_e;
+
+ main->setting.flag |= fss_read_main_flag_trim_object_e;
- main->callback.process_content = &fss_read_extended_list_process_content;
main->callback.process_help = &fss_read_extended_list_process_help;
- main->callback.process_load_depth = 0;
- main->callback.process_object = &fss_read_extended_list_process_object;
- main->callback.process_normal = &fss_read_process_normal;
- main->callback.process_set = &fss_read_process_set;
+ main->callback.process_load = &fss_read_extended_list_process_load;
+ main->callback.print_set_end = &fss_read_print_set_end;
+
+ main->callback.print_object_end = &fss_read_print_object_end;
}
else if (f_compare_dynamic(argv[index], fss_read_format_code_short_0008_s) == F_equal_to ||
f_compare_dynamic(argv[index], fss_read_format_code_long_0008_s) == F_equal_to ||
main->setting.standard = fss_read_embedded_list_standard_s;
- main->setting.flag |= fss_read_main_flag_ignore_e;
- main->setting.flag |= fss_read_main_flag_content_multiple_e;
+ // Remove flags not supported for this standard.
+ main->setting.flag -= main->setting.flag & fss_read_main_flag_line_single_e;
+ main->setting.flag -= main->setting.flag & fss_read_main_flag_quote_content_e;
+ main->setting.flag -= main->setting.flag & fss_read_main_flag_quote_object_e;
+
+ main->setting.flag |= fss_read_main_flag_trim_object_e;
+ main->setting.flag |= fss_read_main_flag_content_multiple_e | fss_read_main_flag_depth_multiple_e;
- main->callback.process_content = &fss_read_embedded_list_process_content;
main->callback.process_help = &fss_read_embedded_list_process_help;
- main->callback.process_load_depth = 0;
- main->callback.process_object = &fss_read_embedded_list_process_object;
- main->callback.process_normal = &fss_read_process_normal;
- main->callback.process_set = &fss_read_process_set;
+ main->callback.process_load = &fss_read_embedded_list_process_load;
+ main->callback.print_set_end = &fss_read_print_set_end;
+
+ main->callback.print_object_end = &fss_read_print_object_end;
}
else if (f_compare_dynamic(argv[index], fss_read_format_code_short_000e_s) == F_equal_to ||
f_compare_dynamic(argv[index], fss_read_format_code_long_000e_s) == F_equal_to ||
main->setting.standard = fss_read_payload_standard_s;
- main->setting.flag -= main->setting.flag & fss_read_main_flag_ignore_e; // Not supported by payload.
- main->setting.flag -= main->setting.flag & fss_read_main_flag_content_multiple_e; // Not supported by payload.
+ // Remove flags not supported for this standard.
+ main->setting.flag -= main->setting.flag & fss_read_main_flag_line_single_e;
+ main->setting.flag -= main->setting.flag & fss_read_main_flag_content_multiple_e;
+ main->setting.flag -= main->setting.flag & fss_read_main_flag_depth_multiple_e;
+ main->setting.flag -= main->setting.flag & fss_read_main_flag_quote_content_e;
+ main->setting.flag -= main->setting.flag & fss_read_main_flag_quote_object_e;
+
+ main->setting.flag |= fss_read_main_flag_trim_object_e;
- main->callback.process_content = 0; // Not used by payload.
main->callback.process_help = &fss_read_payload_process_help;
- main->callback.process_load_depth = 0;
- main->callback.process_normal = &fss_read_process_normal;
- main->callback.process_object = 0; // Not used by payload.
- main->callback.process_set = &fss_read_payload_process_set;
+ main->callback.process_load = &fss_read_payload_process_load;
+ main->callback.print_set_end = &fss_read_print_set_end;
+
+ main->callback.print_object_end = &fss_read_print_object_end;
}
else {
if (main->setting.flag & fss_read_main_flag_help_e) {
fll_program_print_help_usage(print, fss_read_program_name_s, f_string_empty_s);
+ f_print_dynamic_raw(f_string_eol_s, print->to);
+
fss_read_print_message_help_note_header(print, f_string_empty_s, f_string_empty_s);
fss_read_print_message_help_pipe(print);
if (at >= main->setting.objects.used) return F_output_not;
- if (main->setting.flag & fss_read_main_flag_trim_e) {
+ if (main->setting.flag & (fss_read_main_flag_trim_e | fss_read_main_flag_trim_object_e)) {
if (main->setting.flag & fss_read_main_flag_original_e) {
if (main->setting.quotes_object.array[at]) {
fss_read_print_quote(&main->program.output, main->setting.quotes_object.array[at]);
fss_read_main_t * const main = (fss_read_main_t *) print->custom;
- if (main->setting.flag & fss_read_main_flag_pipe_e) {
- fll_print_dynamic_raw(fss_read_pipe_content_start_s, print->to);
- }
- else {
- fll_print_dynamic_raw(f_fss_space_s, main->program.output.to);
-
- // @todo this is basic list read, move this appropriately and use "basic" for the common object end, which is a space.
- /*
- if (main->parameters.array[fss_read_parameter_content_e].result & f_console_result_found_e) {
- f_print_dynamic_raw(f_fss_basic_list_open_s, print->to);
- f_print_dynamic_raw(f_fss_basic_list_open_end_s, print->to);
- }
- else {
- f_print_dynamic_raw(f_fss_eol_s, print->to);
- }
- */
- }
+ fll_print_dynamic_raw((main->setting.flag & fss_read_main_flag_pipe_e) ? fss_read_pipe_content_start_s : f_fss_space_s, print->to);
return F_none;
}
fss_read_main_t * const main = (fss_read_main_t *) print->custom;
+ fll_print_dynamic_raw((main->setting.flag & fss_read_main_flag_pipe_e) ? fss_read_pipe_content_end_s : f_string_eol_s, print->to);
+
+ return F_none;
+ }
+#endif // _di_fss_read_print_set_end_
+
+#ifndef _di_fss_read_print_set_end_no_eol_
+ f_status_t fss_read_print_set_end_no_eol(fl_print_t * const print) {
+
+ if (!print || !print->custom) return F_status_set_error(F_output_not);
+
+ fss_read_main_t * const main = (fss_read_main_t *) print->custom;
+
if (main->setting.flag & fss_read_main_flag_pipe_e) {
fll_print_dynamic_raw(fss_read_pipe_content_end_s, print->to);
}
- else {
- fll_print_dynamic_raw(f_string_eol_s, main->program.output.to);
- }
return F_none;
}
-#endif // _di_fss_read_print_set_end_
+#endif // _di_fss_read_print_set_end_no_eol_
#ifdef __cplusplus
} // extern "C"
* @see fll_print_trim_dynamic_partial()
* @see fll_print_trim_except_dynamic_partial()
*
- * @see fss_read_print_quote()
- * @see fss_read_signal_check()
+ * @see main.callback.print_content()
* @see main.callback.print_object()
* @see main.callback.print_object_end()
* @see main.callback.print_set_end()
extern f_status_t fss_read_print_set_end(fl_print_t * const print);
#endif // _di_fss_read_print_set_end_
+/**
+ * Print the end of an Object/Content set.
+ *
+ * This is a variation of fss_read_print_set_end() that does not print the EOL.
+ *
+ * This locks, uses, and unlocks the file stream.
+ *
+ * @param print
+ * The output structure to print to.
+ *
+ * The print.custom is expected to be of type fss_read_main_t.
+ *
+ * This does not alter print.custom.setting.state.status.
+ *
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if a parameter is NULL.
+ *
+ * @see fll_print_dynamic_raw()
+ */
+#ifndef _di_fss_read_print_set_end_no_eol_
+ extern f_status_t fss_read_print_set_end_no_eol(fl_print_t * const print);
+#endif // _di_fss_read_print_set_end_no_eol_
+
#ifdef __cplusplus
} // extern "C"
#endif
if (!print) return;
- fl_print_format(" %[Notes:%]%r This program will print the data associated with the given Object and Content based on the FSS", print->to, f_string_eol_s);
+ fl_print_format(" %[Notes:%]%r This program will print the data associated with the given Object and Content based on the FSS", print->to, print->set->notable, print->set->notable, f_string_eol_s);
if (number.used) {
fl_print_format("-%Q", print->to, number);
if (!names[i]) continue;
if (fss_read_signal_check(main)) return;
- main->callback.print_at(main, i, *delimits_object, *delimits_content);
+ main->callback.print_at(&main->program.output, i, *delimits_object, *delimits_content);
} // for
}
}
}
else if (main->callback.print_at) {
- main->callback.print_at(main, i, delimits_object, delimits_content);
+ main->callback.print_at(&main->program.output, i, delimits_object, delimits_content);
}
main->setting.state.status = F_none;
f_array_length_t max = 0;
- for (f_array_length_t at = 0; at < main->setting.contents.used; ++at) {
+ if (main->setting.flag & fss_read_main_flag_content_multiple_e) {
+ for (f_array_length_t at = 0; at < main->setting.contents.used; ++at) {
- if (!names[at]) continue;
- if (fss_read_signal_check(main)) return;
+ if (!names[at]) continue;
+ if (fss_read_signal_check(main)) return;
- if (main->setting.contents.array[at].used > max) {
- max = main->setting.contents.array[at].used;
- }
- } // for
+ if (main->setting.contents.array[at].used > max) {
+ max = main->setting.contents.array[at].used;
+ }
+ } // for
+ }
+ else {
+ for (f_array_length_t at = 0; at < main->setting.contents.used; ++at) {
+
+ if (names[at]) {
+ max = 1;
+ break;
+ }
+
+ if (fss_read_signal_check(main)) return;
+ } // for
+ }
fss_read_print_number(&main->program.output, max);
if (line == main->setting.line) {
if (main->callback.print_at) {
main->callback.print_at(
- main,
+ &main->program.output,
i,
!(main->setting.flag & fss_read_main_flag_original_e) && fss_read_delimit_object_is(main, 0)
? main->setting.delimits_object
memset(names, F_false, sizeof(bool) * main->setting.objects.used);
- if (main->setting.flag & fss_read_main_flag_trim_e) {
+ if (main->setting.flag & (fss_read_main_flag_trim_e | fss_read_main_flag_trim_object_e)) {
for (i = 0; i < main->setting.objects.used; ++i) {
if (fss_read_signal_check(main)) return;
}
#endif // _di_fss_read_payload_process_help_
-#ifndef _di_fss_read_payload_process_pipe_
- void fss_read_payload_process_pipe(void * const void_main) {
+#ifndef _di_fss_read_payload_process_load_
+ void fss_read_payload_process_load(void * const void_main) {
if (!void_main) return;
fss_read_main_t * const main = (fss_read_main_t *) void_main;
- f_status_t status_pipe = F_none;
- f_file_t input = f_file_t_initialize;
- input.id = F_type_descriptor_input_d;
- input.size_read = fss_read_allocation_large_d;
-
- f_array_length_t total = 0;
- f_array_length_t length = 0;
- f_string_range_t range = f_string_range_t_initialize;
-
- // @todo much of this is copied from fss_write and needs to be updated or removed accordingly.
-
- const f_array_length_t used_objects = main->setting.objects.used;
- const f_array_length_t used_contents = main->setting.contents.used;
-
- // @fixme really? why am I setting a pointer to the used position, which may not even be allocated? Review this and perhaps first pre-allocate the space so the used is within the size.
- main->setting.object = &main->setting.objects.array[used_objects];
- main->setting.contents = &main->setting.contents.array[used_contents];
-
- // 0x0 = nothing printed, 0x1 = something printed, 0x2 = ignore enabled, 0x4 = added Content for Object, 0x8 = "payload" matched.
- uint8_t flag = 0;
-
- // 0x0 = start new object/content set, 0x1 = processing object, 0x2 = processing content, 0x3 = end object/content set, 0x4 = processing payload content.
- uint8_t state = 0;
-
- // This is processed in a single set, so there is only ever one Object added.
- main->setting.state.status = f_string_dynamics_increase(main->setting.state.step_small, &main->setting.objects);
-
- if (F_status_is_error(main->setting.state.status)) {
- fss_read_print_error(&main->program.error, macro_fss_read_f(f_string_dynamics_increase));
-
- return;
+ if (main->setting.buffer.used) {
+ main->setting.range.start = 0;
+ main->setting.range.stop = main->setting.buffer.used;
}
-
- // This is processed in a single set, so there is only ever one Content added.
- main->setting.state.status = f_string_dynamicss_increase(main->setting.state.step_small, &main->setting.contentss);
-
- if (F_status_is_error(main->setting.state.status)) {
- fss_read_print_error(&main->program.error, macro_fss_read_f(f_string_dynamicss_increase));
-
- return;
+ else {
+ main->setting.range.start = 1;
+ main->setting.range.stop = 0;
}
- main->setting.state.status = f_string_dynamics_increase(main->setting.state.step_small, main->setting.contents);
+ main->setting.comments.used = 0;
+ main->setting.delimits_object.used = 0;
+ main->setting.delimits_content.used = 0;
+ main->setting.nest.used = 0;
+ main->setting.quotes_object.used = 0;
+ main->setting.quotes_content.used = 0;
+
+ fll_fss_payload_read(main->setting.buffer, &main->setting.range, &main->setting.objects, &main->setting.contents, &main->setting.delimits_object, &main->setting.delimits_content, &main->setting.comments, &main->setting.state);
if (F_status_is_error(main->setting.state.status)) {
- fss_read_print_error(&main->program.error, macro_fss_read_f(f_string_dynamics_increase));
+ if (F_status_set_fine(main->setting.state.status) == F_interrupt) return;
+
+ fll_error_file_print(
+ &main->program.error,
+ F_status_set_fine(main->setting.state.status),
+ macro_fss_read_f(fll_fss_payload_read),
+ fll_error_file_flag_fallback_e,
+ fss_read_file_identify(main->setting.range.start, main->setting.files),
+ f_file_operation_process_s,
+ fll_error_file_type_file_e
+ );
return;
}
- // Reset all of the used data before starting the loop.
- main->setting.object->used = 0;
- main->setting.contents->used = 0;
-
- for (;;) {
-
- if (fss_read_signal_check(main)) return;
-
- if (range.start > range.stop) {
- if (status_pipe == F_none_eof) break;
-
- main->setting.block.used = 0;
-
- status_pipe = f_file_read_block(input, &main->setting.block);
-
- if (F_status_is_error(status_pipe)) {
- fss_read_print_error(&main->program.error, macro_fss_read_f(f_file_read_block));
-
- status_pipe = F_status_set_error(F_pipe);
-
- break;
- }
-
- if (!main->setting.block.used) break;
-
- range.start = 0;
- range.stop = main->setting.block.used - 1;
- status_pipe = F_none;
- }
-
- // Start Object.
- if (!state || state == 0x1) {
- if (!state) {
- main->setting.object->used = 0;
-
- state = 0x1;
- }
-
- // Reset the "has Content for Object" flag and associated contents array used length.
- flag -= flag | 0x4;
- main->setting.contents->used = 0;
-
- main->setting.state.status = f_string_dynamic_increase_by(main->setting.block.used, main->setting.object);
-
- if (F_status_is_error(main->setting.state.status)) {
- fss_read_print_error(&main->program.error, macro_fss_read_f(f_string_dynamic_increase_by));
-
- break;
- }
-
- for (; range.start <= range.stop && range.start < main->setting.block.used; ++range.start) {
-
- // Do not handle start/end while inside an ignore set.
- if (!(flag & 0x2)) {
- if (main->setting.block.string[range.start] == fss_read_pipe_content_start_s.string[0]) {
- state = 0x2;
- ++range.start;
-
- break;
- }
-
- if (main->setting.block.string[range.start] == fss_read_pipe_content_end_s.string[0]) {
- state = 0x3;
- ++range.start;
-
- break;
- }
- }
-
- // There currently is no support for "ignore" in Objects, but the Ignore should still be processed.
- if (main->setting.block.string[range.start] == fss_read_pipe_content_ignore_s.string[0]) {
-
- // Ignore is enabled.
- if (flag & 0x2) {
- flag -= 0x2;
- }
- else {
- flag |= 0x2;
- }
-
- continue;
- }
-
- main->setting.object->string[main->setting.object->used++] = main->setting.block.string[range.start];
- } // for
-
- if (F_status_is_error(main->setting.state.status)) break;
-
- // If the start of Content was not found, then fetch the next block.
- if (state == 0x1) continue;
-
- // If the end of the current block is reached, fetch the next block.
- if (range.start > range.stop) continue;
- }
-
- // Begin Content.
- if (state == 0x2) {
-
- // Check to see if the Content supports multiple Content per Object.
- if (flag & 0x4) {
- if (!(main->setting.flag & fss_read_main_flag_content_multiple_e)) {
- main->setting.state.status = F_status_set_error(F_support_not);
-
- fss_read_print_error_one_content_only(&main->program.error);
-
- break;
- }
-
- main->setting.state.status = f_string_dynamics_increase(main->setting.state.step_small, main->setting.contents);
-
- if (F_status_is_error(main->setting.state.status)) {
- fss_read_print_error(&main->program.error, macro_fss_read_f(f_string_dynamics_increase));
-
- break;
- }
- }
-
- if (range.start <= range.stop) {
- total = (range.stop - range.start) + 1;
- }
- else {
- total = 0;
- }
-
- // When payload is provided, all data at this point is part of the payload until the end of the pipe.
- if (f_compare_dynamic(f_fss_payload_s, *main->setting.object) == F_equal_to) {
- if (total > 1) {
- main->setting.state.status = f_string_dynamic_increase_by(total, &main->setting.contents->array[main->setting.contents->used]);
-
- if (F_status_is_error(main->setting.state.status)) {
- fss_read_print_error(&main->program.error, macro_fss_read_f(f_string_dynamic_increase_by));
-
- break;
- }
-
- memcpy(main->setting.contents->array[main->setting.contents->used].string, main->setting.block.string + range.start, sizeof(f_char_t) * total);
-
- main->setting.contents->array[main->setting.contents->used].used += total;
- }
-
- state = 0x4;
- flag |= 0x8;
-
- // Designate to read next block from pipe.
- range.start = 1;
- range.stop = 0;
-
- continue;
- }
-
- if (total) {
- main->setting.state.status = f_string_dynamic_increase_by(total, &main->setting.contents->array[main->setting.contents->used]);
-
- if (F_status_is_error(main->setting.state.status)) {
- fss_read_print_error(&main->program.error, macro_fss_read_f(f_string_dynamic_increase_by));
-
- break;
- }
-
- for (; range.start <= range.stop && range.start < main->setting.block.used; ++range.start) {
-
- // Do not handle start/end while inside an ignore set.
- if (!(flag & 0x2)) {
- if (main->setting.block.string[range.start] == fss_read_pipe_content_start_s.string[0]) {
- main->setting.state.status = F_status_set_error(F_support_not);
-
- fss_read_print_error_one_content_only(&main->program.error);
-
- break;
- }
-
- if (main->setting.block.string[range.start] == fss_read_pipe_content_end_s.string[0]) {
- state = 0x3;
- ++range.start;
-
- break;
- }
- }
-
- // There currently is no support for "ignore" in Contents, but the Ignore should still be processed.
- if (main->setting.block.string[range.start] == fss_read_pipe_content_ignore_s.string[0]) {
-
- // Ignore is enabled.
- if (flag & 0x2) {
- flag -= 0x2;
- }
- else {
- flag |= 0x2;
- }
-
- continue;
- }
-
- main->setting.contents->array[main->setting.contents->used].string[main->setting.contents->array[main->setting.contents->used].used++] = main->setting.block.string[range.start];
- } // for
+ if (main->setting.state.status == F_data_not_stop || main->setting.state.status == F_data_not_eos) {
+ if (!(main->setting.flag & fss_read_main_flag_total_e)) {
+ main->setting.state.status = F_status_set_warning(main->setting.state.status);
- if (F_status_is_error(main->setting.state.status)) break;
-
- ++main->setting.contents->used;
- flag |= 0x4;
- }
- else {
- state = 0x3;
- }
- }
-
- // End Object or Content set.
- if (state == 0x3) {
- fss_read_payload_process_set(void_main);
- if (F_status_is_error(main->setting.state.status)) break;
-
- state = 0;
- flag |= 0x1;
-
- // Reset all of the used data for next set.
- main->setting.object->used = 0;
- main->setting.contents->used = 0;
-
- continue;
- }
-
- // Payload Object.
- if (state == 0x4) {
- if (main->setting.block.used && range.start <= range.stop) {
- length = (range.stop - range.start) + 1;
-
- main->setting.state.status = f_string_dynamic_increase_by(length + 1, &main->setting.contents->array[main->setting.contents->used]);
-
- if (F_status_is_error(main->setting.state.status)) {
- fss_read_print_error(&main->program.error, macro_fss_read_f(f_string_dynamic_increase_by));
-
- break;
- }
-
- memcpy(main->setting.contents->array[main->setting.contents->used].string + range.start, main->setting.block.string, sizeof(f_char_t) * length);
-
- main->setting.contents->array[main->setting.contents->used].used += length;
- }
-
- // Designate to read next block from pipe.
- range.start = 1;
- range.stop = 0;
-
- // Reset all of the used data for next set.
- main->setting.object->used = 0;
- main->setting.contents->used = 0;
+ return;
}
- } // for
-
- // If the pipe ended before finishing, then attempt to wrap up.
- if (F_status_is_error_not(main->setting.state.status) && status_pipe == F_none_eof && state) {
- fss_read_payload_process_set(void_main);
-
- flag |= 0x1;
}
- main->setting.block.used = 0;
- main->setting.buffer.used = 0;
- main->setting.object->used = 0;
- main->setting.contents->used = 0;
- main->setting.objects.used = used_objects;
- main->setting.contentss.used = used_contents;
-
- if (F_status_is_error_not(main->setting.state.status)) {
- if (flag & 0x1) {
- if (flag & 0x8) {
- main->setting.state.status = F_payload;
- }
- else {
- main->setting.state.status = F_none;
- }
- }
- else {
- main->setting.state.status = F_data_not;
- }
-
- // Payload.
- if (main->setting.contentss.used && (flag & 0x8)) {
- fll_print_dynamic(f_fss_payload_header_close_s, main->program.output.to);
- }
- }
+ main->setting.state.status = F_none;
}
-#endif // _di_fss_read_payload_process_pipe_
+#endif // _di_fss_read_payload_process_load_
#ifndef _di_fss_read_payload_process_set_
void fss_read_payload_process_set(void * const void_main) {
fss_read_main_t * const main = (fss_read_main_t *) void_main;
- if ((!(main->setting.flag & fss_read_main_flag_partial_e) || (main->setting.flag & fss_read_main_flag_partial_e) && (main->setting.flag & fss_read_main_flag_object_e))) {
- if (main->setting.object && !(main->setting.flag & fss_read_main_flag_partial_e) && main->setting.contents && main->setting.contents->used) {
- if (main->setting.object->used) {
- main->setting.range.start = 0;
- main->setting.range.stop = main->setting.object->used - 1;
- }
- else {
- main->setting.range.start = 1;
- main->setting.range.stop = 0;
- }
-
- fll_fss_payload_write(
- *main->setting.object,
- main->setting.contents->array[0],
- (main->setting.flag & fss_read_main_flag_trim_e),
- (main->setting.flag & fss_read_main_flag_prepend_e)
- ? &main->setting.prepend
- : 0,
- &main->setting.buffer,
- &main->setting.state
- );
-
- if (F_status_set_fine(main->setting.state.status) == F_none_eol) {
- main->setting.state.status = F_status_set_error(F_support_not);
-
- fss_read_print_error_unsupported_eol(&main->program.error);
-
- return;
- }
-
- if (F_status_is_error(main->setting.state.status)) {
- fss_read_print_error(&main->program.error, macro_fss_read_f(fll_fss_payload_write));
-
- return;
- }
- }
- else {
- if (main->setting.object) {
- if (main->setting.object->used) {
- main->setting.range.start = 0;
- main->setting.range.stop = main->setting.object->used - 1;
- }
- else {
- main->setting.range.start = 1;
- main->setting.range.stop = 0;
- }
-
- fl_fss_basic_list_object_write(
- *main->setting.object,
- (main->setting.flag & fss_read_main_flag_partial_e)
- ? (main->setting.flag & fss_read_main_flag_trim_e)
- ? f_fss_complete_trim_e
- : f_fss_complete_none_e
- : (main->setting.flag & fss_read_main_flag_trim_e)
- ? f_fss_complete_full_trim_e
- : f_fss_complete_full_e,
- &main->setting.range,
- &main->setting.buffer,
- &main->setting.state
- );
-
- if (F_status_set_fine(main->setting.state.status) == F_none_eol) {
- main->setting.state.status = F_status_set_error(F_support_not);
-
- fss_read_print_error_unsupported_eol(&main->program.error);
-
- return;
- }
-
- if (F_status_is_error(main->setting.state.status)) {
- fss_read_print_error(&main->program.error, macro_fss_read_f(fl_fss_basic_list_object_write));
-
- return;
- }
- }
-
- if ((main->setting.flag & fss_read_main_flag_partial_e) && !(main->setting.flag & fss_read_main_flag_content_e) || !(main->setting.flag & (fss_read_main_flag_object_e | fss_read_main_flag_content_e))) {
- if (main->setting.flag & fss_read_main_flag_object_open_e) {
- main->setting.state.status = f_string_dynamic_append(f_fss_basic_list_open_s, &main->setting.buffer);
-
- if (F_status_is_error_not(main->setting.state.status)) {
- main->setting.state.status = f_string_dynamic_append(f_fss_basic_list_open_end_s, &main->setting.buffer);
- }
-
- if (F_status_is_error(main->setting.state.status)) {
- fss_read_print_error(&main->program.error, macro_fss_read_f(f_string_dynamic_append));
-
- return;
- }
- }
- }
- }
- }
- else {
- if (main->setting.contents && main->setting.contents->used && main->setting.contents->array[0].used) {
- main->setting.range.start = 0;
- main->setting.range.stop = main->setting.contents->array[0].used - 1;
-
- const f_string_static_t *prepend = 0;
-
- if (main->setting.flag & fss_read_main_flag_prepend_e) {
- const f_array_length_t index = main->program.parameters.array[fss_read_parameter_prepend_e].values.array[main->program.parameters.array[fss_read_parameter_prepend_e].location]];
-
- prepend = &main->program.parameters.arguments.array[index];
- }
-
- fl_fss_basic_list_content_write(
- main->setting.contents->array[0],
- main->setting.object
- ? f_fss_complete_full_e
- : f_fss_complete_none_e,
- prepend,
- &main->setting.range,
- &main->setting.buffer,
- &main->setting.state
- );
-
- if (F_status_is_error(main->setting.state.status)) {
- fss_read_print_error(&main->program.error, macro_fss_read_f(fl_fss_payload_content_write));
-
- return;
- }
- }
-
- if ((main->setting.flag & fss_read_main_flag_partial_e) && !(main->setting.flag & fss_read_main_flag_object_e) || !(main->setting.flag & (fss_read_main_flag_object_e | fss_read_main_flag_content_e))) {
- main->setting.state.status = f_string_dynamic_append(f_fss_basic_list_close_s, &main->setting.buffer);
-
- if (F_status_is_error(main->setting.state.status)) {
- fss_read_print_error(&main->program.error, macro_fss_read_f(f_string_dynamic_append));
-
- return;
- }
- }
- }
-
- if (!main->setting.object || !(main->setting.contents && main->setting.contents->used)) {
- main->setting.state.status = f_string_dynamic_append(f_string_eol_s, &main->setting.buffer);
-
- if (F_status_is_error(main->setting.state.status)) {
- fss_read_print_error(&main->program.error, macro_fss_read_f(f_string_dynamic_append));
-
- return;
- }
- }
-
- fll_print_dynamic(main->setting.buffer, main->program.output.to);
-
- main->setting.buffer.used = 0;
main->setting.state.status = F_none;
}
#endif // _di_fss_read_payload_process_set_
if ((main->program.parameters.array[fss_read_parameter_object_e].result & f_console_result_value_e) && values->used) {
for (f_array_length_t i = 0; i < values->used; ++i) {
+ if (fss_read_signal_check(main)) return;
+
if (f_compare_dynamic(argv[values->array[i]], fss_read_payload_s) == F_equal_to && i + 1 < values->used) {
main->setting.state.status = F_status_set_error(F_parameter);
#endif // _di_fss_read_payload_process_help_
/**
- * Process the pipe, reading from the pipe and writing to the output.
+ * Process the buffer, loading the FSS data.
+ *
+ * This will print an error message on error.
*
* @param main
* The program and settings data.
*
* This alters main.setting.state.status:
* F_none on success.
- * F_data_not on success but pipe contained no relevant data.
- * F_payload on success and the payload has been printed.
- * F_interrupt on (exit) signal received.
*
- * F_parameter (with error bit) if main is NULL or setting is NULL.
+ * F_data_not_stop (with warning bit) on no valid FSS data found and reached stopping point.
+ * F_data_not_eos (with warning bit) on no valid FSS data found and reached end of string.
*
- * Errors (with error bit) from: fss_read_signal_check().
+ * Errors (with error bit) from: fll_fss_payload_read()
*
- * @see fss_read_signal_check()
+ * @see fll_fss_payload_read()
+ *
+ * @see fss_read_file_identify()
*/
-#ifndef _di_fss_read_payload_process_pipe_
- extern void fss_read_payload_process_pipe(void * const main);
-#endif // _di_fss_read_payload_process_pipe_
+#ifndef _di_fss_read_payload_process_load_
+ extern void fss_read_payload_process_load(void * const main);
+#endif // _di_fss_read_payload_process_load_
/**
* Process a given object and content, printing the FSS if valid or an error if invalid.
* @param setting
* The main program settings.
*
- * This alters setting.process_help, setting.process_normal, and setting.process_pipe.
- *
* This alters setting.state.status:
* F_none on success.
- * F_interrupt on (exit) signal received.
*
* F_parameter (with error bit) if main is NULL or setting is NULL.
* F_parameter (with error bit) on parameter error.
* F_data_not on success but nothing was provided to operate with.
*
* @see fss_read_setting_load()
+ * @see fss_read_signal_check()
*/
#ifndef _di_fss_read_payload_setting_load_
extern void fss_read_payload_setting_load(const f_console_arguments_t arguments, fss_read_main_t * const main);
data.program.output.flag |= fss_read_print_flag_out_e;
data.program.message.flag |= fss_read_print_flag_message_e | fss_read_print_flag_out_e;
data.program.warning.flag |= fss_read_print_flag_warning_e | fss_read_print_flag_out_e;
+
data.program.error.custom = (void *) &data;
data.program.debug.custom = (void *) &data;
data.program.message.custom = (void *) &data;
data.program.output.custom = (void *) &data;
data.program.warning.custom = (void *) &data;
+ data.setting.flag |= fss_read_main_flag_trim_object_e;
+
data.setting.state.custom = (void *) &data;
data.setting.standard = fss_read_payload_standard_s;
- data.callback.process_pipe = &fss_read_payload_process_pipe;
data.callback.process_help = &fss_read_payload_process_help;
data.callback.process_last_line = &fss_read_process_last_line;
- //data.callback.process_load_depth = &fss_read_setting_load_depth;
+ data.callback.process_load_depth = &fss_read_setting_load_depth;
data.callback.process_normal = &fss_read_process_normal;
- //data.callback.process_at = &fss_read_process_normal_at;
- //data.callback.process_columns = &fss_read_process_normal_columns;
- //data.callback.process_line = &fss_read_process_normal_line;
- //data.callback.process_load = &fss_read_basic_process_load;
- //data.callback.process_name = &fss_read_process_normal_name;
- //data.callback.process_total = &fss_read_process_normal_total;
-
- //data.callback.print_at = &fss_read_print_at;
- //data.callback.print_content = &fss_read_print_content;
- //data.callback.print_content_ignore = &fss_read_print_content_ignore;
- //data.callback.print_object = &fss_read_print_object;
- //data.callback.print_object_end = &fss_read_print_object_end;
- //data.callback.print_set_end = &fss_read_print_set_end;
+ data.callback.process_at = &fss_read_process_normal_at;
+ data.callback.process_columns = &fss_read_process_normal_columns;
+ data.callback.process_line = &fss_read_process_normal_line;
+ data.callback.process_load = &fss_read_payload_process_load;
+ data.callback.process_name = &fss_read_process_normal_name;
+ data.callback.process_total = &fss_read_process_normal_total;
+
+ data.callback.print_at = &fss_read_print_at;
+ data.callback.print_content = &fss_read_print_content;
+ data.callback.print_content_ignore = &fss_read_print_content_ignore;
+ data.callback.print_object = &fss_read_print_object;
+ data.callback.print_object_end = &fss_read_print_object_end;
+ data.callback.print_set_end = &fss_read_print_set_end;
f_console_parameter_t parameters[] = fss_read_console_parameter_t_initialize;
data.program.parameters.array = parameters;
//
//The Content of the explicit Object of 'payload' will not contain any Content close pipe control codes when using --pipe.
+ /*
fl_print_format("%r The FSS-000E (Payload) specification does not support quoted names, therefore the parameters '%[%r%r%]'", print->to, f_string_eol_s, print->set->notable, f_console_symbol_long_normal_s, fss_read_long_single_s, print->set->notable);
fl_print_format(" and '%[%r%r%]' do nothing.%r%r", print->to, print->set->notable, f_console_symbol_long_normal_s, fss_read_long_double_s, print->set->notable, f_string_eol_s, f_string_eol_s);
fl_print_format(" This program does not use the parameter '%[%r%r%]', which therefore does nothing.%r", print->to, print->set->notable, f_console_symbol_long_normal_s, fss_read_long_ignore_s, print->set->notable, f_string_eol_s);
fl_print_format(" This parameter requires two values.%r", print->to, f_string_eol_s);
+ */
f_file_stream_flush(print->to);
f_file_stream_unlock(print->to);
data.program.output.flag |= fss_write_print_flag_out_e;
data.program.message.flag |= fss_write_print_flag_message_e | fss_write_print_flag_out_e;
data.program.warning.flag |= fss_write_print_flag_warning_e | fss_write_print_flag_out_e;
+
data.program.error.custom = (void *) &data;
data.program.debug.custom = (void *) &data;
data.program.message.custom = (void *) &data;
main->setting.standard = fss_write_basic_standard_s;
- main->setting.flag -= main->setting.flag & fss_write_main_flag_ignore_e; // Not supported by basic.
- main->setting.flag -= main->setting.flag & fss_write_main_flag_content_multiple_e; // Not supported by basic.
+ // Remove flags not supported for this standard.
+ main->setting.flag -= main->setting.flag & fss_write_main_flag_ignore_e;
+ main->setting.flag -= main->setting.flag & fss_write_main_flag_content_multiple_e;
main->callback.process_content = &fss_write_basic_process_content;
main->callback.process_help = &fss_write_basic_process_help;
main->setting.standard = fss_write_extended_standard_s;
- main->setting.flag -= main->setting.flag & fss_write_main_flag_ignore_e; // Not supported by extended.
+ // Remove flags not supported for this standard.
+ main->setting.flag -= main->setting.flag & fss_write_main_flag_ignore_e;
+
main->setting.flag |= fss_write_main_flag_content_multiple_e;
main->callback.process_content = &fss_write_extended_process_content;
main->setting.standard = fss_write_basic_list_standard_s;
- main->setting.flag -= main->setting.flag & fss_write_main_flag_ignore_e; // Not supported by basic list.
- main->setting.flag -= main->setting.flag & fss_write_main_flag_content_multiple_e; // Not supported by basic list.
+ // Remove flags not supported for this standard.
+ main->setting.flag -= main->setting.flag & fss_write_main_flag_ignore_e;
+ main->setting.flag -= main->setting.flag & fss_write_main_flag_content_multiple_e;
main->callback.process_content = &fss_write_basic_list_process_content;
main->callback.process_help = &fss_write_basic_list_process_help;
main->setting.standard = fss_write_extended_list_standard_s;
+ // Remove flags not supported for this standard.
+ main->setting.flag -= main->setting.flag & fss_write_main_flag_content_multiple_e;
+
main->setting.flag |= fss_write_main_flag_ignore_e;
- main->setting.flag -= main->setting.flag & fss_write_main_flag_content_multiple_e; // Not supported by extended list.
main->callback.process_content = &fss_write_extended_list_process_content;
main->callback.process_help = &fss_write_extended_list_process_help;
main->setting.standard = fss_write_payload_standard_s;
- main->setting.flag -= main->setting.flag & fss_write_main_flag_ignore_e; // Not supported by payload.
- main->setting.flag -= main->setting.flag & fss_write_main_flag_content_multiple_e; // Not supported by payload.
+ // Remove flags not supported for this standard.
+ main->setting.flag -= main->setting.flag & fss_write_main_flag_ignore_e;
+ main->setting.flag -= main->setting.flag & fss_write_main_flag_content_multiple_e;
main->callback.process_content = 0;
main->callback.process_help = &fss_write_payload_process_help;
data.program.output.flag |= fss_write_print_flag_out_e;
data.program.message.flag |= fss_write_print_flag_message_e | fss_write_print_flag_out_e;
data.program.warning.flag |= fss_write_print_flag_warning_e | fss_write_print_flag_out_e;
+
data.program.error.custom = (void *) &data;
data.program.debug.custom = (void *) &data;
data.program.message.custom = (void *) &data;