build_sources_program fll/level_2/print.c
build_sources_program fll/level_2/program.c fll/level_2/program/common.c fll/level_2/program/print.c fll/level_2/private-program.c
-build_sources_program program/utf8/main/common.c program/utf8/main/common/print.c program/utf8/main/common/string.c program/utf8/main/common/type.c program/utf8/main/bytesequence.c program/utf8/main/codepoint.c program/utf8/main/print.c program/utf8/main/print-error.c program/utf8/main/print-data.c program/utf8/main/process.c program/utf8/main/utf8.c
+build_sources_program program/utf8/main/common.c program/utf8/main/common/define.c program/utf8/main/common/enumeration.c program/utf8/main/common/print.c program/utf8/main/common/string.c program/utf8/main/common/type.c program/utf8/main/bytesequence.c program/utf8/main/codepoint.c program/utf8/main/print-data.c program/utf8/main/print-error.c program/utf8/main/print/message.c program/utf8/main/process.c program/utf8/main/utf8.c
build_sources_program program/utf8/main.c
build_sources_documentation man
* Perform the standard program setting unload process.
*
* @param main
- * The main program data.
- * @param setting
- * The main program settings.
+ * The main program and setting data.
* All buffers are deallocated.
*
- * This does not alter setting.state.status.
+ * This does not alter main.setting.state.status.
*
* @return
* F_none on success.
*
* F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: utf8_setting_delete().
+ * Errors (with error bit) from: byte_dump_setting_delete().
*
- * @see utf8_setting_delete()
+ * @see byte_dump_setting_delete()
*/
#ifndef _di_byte_dump_setting_unload_
- extern f_status_t byte_dump_setting_unload(fll_program_data_t * const main, byte_dump_setting_t * const setting);
+ extern f_status_t byte_dump_setting_unload(byte_dump_main_t * const main);
#endif // _di_byte_dump_setting_unload_
#ifdef __cplusplus
#endif // _di_byte_dump_setting_load_
#ifndef _di_byte_dump_setting_unload_
- f_status_t byte_dump_setting_unload(fll_program_data_t * const main, byte_dump_setting_t * const setting) {
+ f_status_t byte_dump_setting_unload(byte_dump_main_t * const main) {
- if (!main || !setting) return F_status_set_error(F_parameter);
+ if (!main) return F_status_set_error(F_parameter);
- byte_dump_setting_delete(setting);
+ byte_dump_setting_delete(&main->setting);
return F_none;
}
#endif // _di_control_setting_load_
#ifndef _di_control_setting_unload_
- f_status_t control_setting_unload(fll_program_data_t * const main, control_setting_t * const setting) {
+ f_status_t control_setting_unload(control_main_t * const main) {
- if (!main || !setting) return F_status_set_error(F_parameter);
+ if (!main) return F_status_set_error(F_parameter);
- control_setting_delete(setting);
+ control_setting_delete(&control_main_t->setting);
return F_none;
}
* Perform the standard program setting unload process.
*
* @param main
- * The main program data.
- * @param setting
- * The main program settings.
+ * The main program and setting data.
* All buffers are deallocated.
*
- * This does not alter setting.state.status.
+ * This does not alter main.setting.state.status.
*
* @return
* F_none on success.
*
* F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: utf8_setting_delete().
+ * Errors (with error bit) from: control_setting_delete().
*
- * @see utf8_setting_delete()
+ * @see control_setting_delete()
*/
#ifndef _di_control_setting_unload_
- extern f_status_t control_setting_unload(fll_program_data_t * const main, control_setting_t * const setting);
+ extern f_status_t control_setting_unload(control_main_t * const main);
#endif // _di_control_setting_unload_
#ifdef __cplusplus
#endif // _di_controller_setting_load_
#ifndef _di_controller_setting_unload_
- f_status_t controller_setting_unload(fll_program_data_t * const main, controller_setting_t * const setting) {
+ f_status_t controller_setting_unload(controller_main_t * const main) {
- if (!main || !setting) return F_status_set_error(F_parameter);
+ if (!main) return F_status_set_error(F_parameter);
- controller_setting_delete(setting);
+ controller_setting_delete(&main->setting);
return F_none;
}
f_string_dynamic_t path_setting;
f_color_context_t context;
- } controller_main_t;
+ } controller_main_t; // @todo refactor this name, and create a controller_main_t that holds the program data, settings, and possibly this.
#define controller_main_t_initialize \
{ \
* Perform the standard program setting unload process.
*
* @param main
- * The main program data.
- * @param setting
- * The main program settings.
+ * The main program and setting data.
* All buffers are deallocated.
*
- * This does not alter setting.state.status.
+ * This does not alter main.setting.state.status.
*
* @return
* F_none on success.
*
* F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: utf8_setting_delete().
+ * Errors (with error bit) from: controller_setting_delete().
*
- * @see utf8_setting_delete()
+ * @see controller_setting_delete()
*/
#ifndef _di_controller_setting_unload_
- extern f_status_t controller_setting_unload(fll_program_data_t * const main, controller_setting_t * const setting);
+ extern f_status_t controller_setting_unload(controller_main_t * const main);
#endif // _di_controller_setting_unload_
#ifdef __cplusplus
f_thread_mutex_lock(&thread->lock.print);
}
- fll_error_print(print, status, function, flag);
+ fll_error_print(*print, status, function, flag);
if (thread) {
f_thread_mutex_unlock(&thread->lock.print);
*
* F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: utf8_setting_delete().
+ * Errors (with error bit) from: fake_setting_delete().
*
- * @see utf8_setting_delete()
+ * @see fake_setting_delete()
*/
#ifndef _di_fake_setting_unload_
extern f_status_t fake_setting_unload(fake_main_t * const main);
*/
#ifndef _di_fake_print_flag_e_
enum {
- fake_print_flag_none_e = 0x0,
- fake_print_flag_debug_e = 0x1,
- fake_print_flag_error_e = 0x2,
- fake_print_flag_message_e = 0x4,
- fake_print_flag_warning_e = 0x8,
- fake_print_flag_file_to_e = 0x10,
- fake_print_flag_file_from_e = 0x20,
+ fake_print_flag_none_e = 0x0,
+ fake_print_flag_debug_e = 0x1,
+ fake_print_flag_error_e = 0x2,
+ fake_print_flag_message_e = 0x4,
+ fake_print_flag_warning_e = 0x8,
+ fake_print_flag_file_to_e = 0x10,
+ fake_print_flag_file_from_e = 0x20,
}; // enum
#endif // _di_fake_print_flag_e_
#endif // _di_firewall_setting_load_
#ifndef _di_firewall_setting_unload_
- f_status_t firewall_setting_unload(fll_program_data_t * const main, firewall_setting_t * const setting) {
+ f_status_t firewall_setting_unload(firewall_main_t * const main) {
- if (!main || !setting) return F_status_set_error(F_parameter);
+ if (!main) return F_status_set_error(F_parameter);
- firewall_setting_delete(setting);
+ firewall_setting_delete(&main->setting);
return F_none;
}
* Perform the standard program setting unload process.
*
* @param main
- * The main program data.
- * @param setting
- * The main program settings.
+ * The main program and setting data.
* All buffers are deallocated.
*
- * This does not alter setting.state.status.
+ * This does not alter main.setting.state.status.
*
* @return
* F_none on success.
*
* F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: utf8_setting_delete().
+ * Errors (with error bit) from: firewall_setting_delete().
*
- * @see utf8_setting_delete()
+ * @see firewall_setting_delete()
*/
#ifndef _di_firewall_setting_unload_
- extern f_status_t firewall_setting_unload(fll_program_data_t * const main, firewall_setting_t * const setting);
+ extern f_status_t firewall_setting_unload(firewall_main_t * const main);
#endif // _di_firewall_setting_unload_
#ifdef __cplusplus
#endif // _di_fss_basic_list_read_setting_load_
#ifndef _di_fss_basic_list_read_setting_unload_
- f_status_t fss_basic_list_read_setting_unload(fll_program_data_t * const main, fss_basic_list_read_setting_t * const setting) {
+ f_status_t fss_basic_list_read_setting_unload(fss_basic_list_read_main_t * const main) {
- if (!main || !setting) return F_status_set_error(F_parameter);
+ if (!main) return F_status_set_error(F_parameter);
- fss_basic_list_read_setting_delete(setting);
+ fss_basic_list_read_setting_delete(&main->setting);
return F_none;
}
* Perform the standard program setting unload process.
*
* @param main
- * The main program data.
- * @param setting
- * The main program settings.
+ * The main program and setting data.
* All buffers are deallocated.
*
- * This does not alter setting.state.status.
+ * This does not alter main.setting.state.status.
*
* @return
* F_none on success.
*
* F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: utf8_setting_delete().
+ * Errors (with error bit) from: fss_basic_list_read_setting_delete().
*
- * @see utf8_setting_delete()
+ * @see fss_basic_list_read_setting_delete()
*/
#ifndef _di_fss_basic_list_read_setting_unload_
- extern f_status_t fss_basic_list_read_setting_unload(fll_program_data_t * const main, fss_basic_list_read_setting_t * const setting);
+ extern f_status_t fss_basic_list_read_setting_unload(fss_basic_list_read_main_t * const main);
#endif // _di_fss_basic_list_read_setting_unload_
#ifdef __cplusplus
#endif // _di_fss_basic_read_setting_load_
#ifndef _di_fss_basic_read_setting_unload_
- f_status_t fss_basic_read_setting_unload(fll_program_data_t * const main, fss_basic_read_setting_t * const setting) {
+ f_status_t fss_basic_read_setting_unload(fss_basic_read_main_t * const main) {
- if (!main || !setting) return F_status_set_error(F_parameter);
+ if (!main) return F_status_set_error(F_parameter);
- fss_basic_read_setting_delete(setting);
+ fss_basic_read_setting_delete(&main->setting);
return F_none;
}
* Perform the standard program setting unload process.
*
* @param main
- * The main program data.
- * @param setting
- * The main program settings.
+ * The main program and setting data.
* All buffers are deallocated.
*
- * This does not alter setting.state.status.
+ * This does not alter main.setting.state.status.
*
* @return
* F_none on success.
*
* F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: utf8_setting_delete().
+ * Errors (with error bit) from: fss_basic_read_setting_delete().
*
- * @see utf8_setting_delete()
+ * @see fss_basic_read_setting_delete()
*/
#ifndef _di_fss_basic_read_setting_unload_
- extern f_status_t fss_basic_read_setting_unload(fll_program_data_t * const main, fss_basic_read_setting_t * const setting);
+ extern f_status_t fss_basic_read_setting_unload(fss_basic_read_main_t * const main);
#endif // _di_fss_basic_read_setting_unload_
#ifdef __cplusplus
#endif // _di_fss_embedded_list_read_setting_load_
#ifndef _di_fss_embedded_list_read_setting_unload_
- f_status_t fss_embedded_list_read_setting_unload(fll_program_data_t * const main, fss_embedded_list_read_setting_t * const setting) {
+ f_status_t fss_embedded_list_read_setting_unload(fss_embedded_list_read_main_t * const main) {
- if (!main || !setting) return F_status_set_error(F_parameter);
+ if (!main) return F_status_set_error(F_parameter);
- fss_embedded_list_read_setting_delete(setting);
+ fss_embedded_list_read_setting_delete(&main->setting);
return F_none;
}
* Perform the standard program setting unload process.
*
* @param main
- * The main program data.
- * @param setting
- * The main program settings.
+ * The main program and setting data.
* All buffers are deallocated.
*
- * This does not alter setting.state.status.
+ * This does not alter main.setting.state.status.
*
* @return
* F_none on success.
*
* F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: utf8_setting_delete().
+ * Errors (with error bit) from: fss_embedded_list_read_setting_delete().
*
- * @see utf8_setting_delete()
+ * @see fss_embedded_list_read_setting_delete()
*/
#ifndef _di_fss_embedded_list_read_setting_unload_
- extern f_status_t fss_embedded_list_read_setting_unload(fll_program_data_t * const main, fss_embedded_list_read_setting_t * const setting);
+ extern f_status_t fss_embedded_list_read_setting_unload(fss_embedded_list_read_main_t * const main);
#endif // _di_fss_embedded_list_read_setting_unload_
#ifdef __cplusplus
#endif // _di_fss_extended_list_read_setting_load_
#ifndef _di_fss_extended_list_read_setting_unload_
- f_status_t fss_extended_list_read_setting_unload(fll_program_data_t * const main, fss_extended_list_read_setting_t * const setting) {
+ f_status_t fss_extended_list_read_setting_unload(fss_extended_list_read_main_t * const main) {
- if (!main || !setting) return F_status_set_error(F_parameter);
+ if (!main) return F_status_set_error(F_parameter);
- fss_extended_list_read_setting_delete(setting);
+ fss_extended_list_read_setting_delete(&main->setting);
return F_none;
}
* Perform the standard program setting unload process.
*
* @param main
- * The main program data.
- * @param setting
- * The main program settings.
+ * The main program and setting data.
* All buffers are deallocated.
*
- * This does not alter setting.state.status.
+ * This does not alter main.setting.state.status.
*
* @return
* F_none on success.
*
* F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: utf8_setting_delete().
+ * Errors (with error bit) from: fss_extended_list_read_setting_delete().
*
- * @see utf8_setting_delete()
+ * @see fss_extended_list_read_setting_delete()
*/
#ifndef _di_fss_extended_list_read_setting_unload_
- extern f_status_t fss_extended_list_read_setting_unload(fll_program_data_t * const main, fss_extended_list_read_setting_t * const setting);
+ extern f_status_t fss_extended_list_read_setting_unload(fss_extended_list_read_main_t * const main);
#endif // _di_fss_extended_list_read_setting_unload_
#ifdef __cplusplus
#endif // _di_fss_extended_read_setting_load_
#ifndef _di_fss_extended_read_setting_unload_
- f_status_t fss_extended_read_setting_unload(fll_program_data_t * const main, fss_extended_read_setting_t * const setting) {
+ f_status_t fss_extended_read_setting_unload(fss_extended_read_main_t * const main) {
- if (!main || !setting) return F_status_set_error(F_parameter);
+ if (!main) return F_status_set_error(F_parameter);
- fss_extended_read_setting_delete(setting);
+ fss_extended_read_setting_delete(&main->setting);
return F_none;
}
* Perform the standard program setting unload process.
*
* @param main
- * The main program data.
- * @param setting
- * The main program settings.
+ * The main program and setting data.
* All buffers are deallocated.
*
- * This does not alter setting.state.status.
+ * This does not alter main.setting.state.status.
*
* @return
* F_none on success.
*
* F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: utf8_setting_delete().
+ * Errors (with error bit) from: fss_extended_read_setting_delete().
*
- * @see utf8_setting_delete()
+ * @see fss_extended_read_setting_delete()
*/
#ifndef _di_fss_extended_read_setting_unload_
- extern f_status_t fss_extended_read_setting_unload(fll_program_data_t * const main, fss_extended_read_setting_t * const setting);
+ extern f_status_t fss_extended_read_setting_unload(fss_extended_read_main_t * const main);
#endif // _di_fss_extended_read_setting_unload_
#ifdef __cplusplus
#endif // _di_fss_identify_setting_load_
#ifndef _di_fss_identify_setting_unload_
- f_status_t fss_identify_setting_unload(fll_program_data_t * const main, fss_identify_setting_t * const setting) {
+ f_status_t fss_identify_setting_unload(fss_identify_main_t * const main) {
- if (!main || !setting) return F_status_set_error(F_parameter);
+ if (!main) return F_status_set_error(F_parameter);
- fss_identify_setting_delete(setting);
+ fss_identify_setting_delete(&main->setting);
return F_none;
}
* Perform the standard program setting unload process.
*
* @param main
- * The main program data.
- * @param setting
- * The main program settings.
+ * The main program and setting data.
* All buffers are deallocated.
*
- * This does not alter setting.state.status.
+ * This does not alter main.setting.state.status.
*
* @return
* F_none on success.
*
* F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: utf8_setting_delete().
+ * Errors (with error bit) from: fss_identify_setting_delete().
*
- * @see utf8_setting_delete()
+ * @see fss_identify_setting_delete()
*/
#ifndef _di_fss_identify_setting_unload_
- extern f_status_t fss_identify_setting_unload(fll_program_data_t * const main, fss_identify_setting_t * const setting);
+ extern f_status_t fss_identify_setting_unload(fss_identify_main_t * const main);
#endif // _di_fss_identify_setting_unload_
#ifdef __cplusplus
#endif // _di_fss_payload_read_setting_load_
#ifndef _di_fss_payload_read_setting_unload_
- f_status_t fss_payload_read_setting_unload(fll_program_data_t * const main, fss_payload_read_setting_t * const setting) {
+ f_status_t fss_payload_read_setting_unload(fss_payload_read_main_t * const main) {
- if (!main || !setting) return F_status_set_error(F_parameter);
+ if (!main) return F_status_set_error(F_parameter);
- fss_payload_read_setting_delete(setting);
+ fss_payload_read_setting_delete(&main->setting);
return F_none;
}
* Perform the standard program setting unload process.
*
* @param main
- * The main program data.
- * @param setting
- * The main program settings.
+ * The main program and setting data.
* All buffers are deallocated.
*
- * This does not alter setting.state.status.
+ * This does not alter main.setting.state.status.
*
* @return
* F_none on success.
*
* F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: utf8_setting_delete().
+ * Errors (with error bit) from: fss_payload_read_setting_delete().
*
- * @see utf8_setting_delete()
+ * @see fss_payload_read_setting_delete()
*/
#ifndef _di_fss_payload_read_setting_unload_
- extern f_status_t fss_payload_read_setting_unload(fll_program_data_t * const main, fss_payload_read_setting_t * const setting);
+ extern f_status_t fss_payload_read_setting_unload(fss_payload_read_main_t * const main);
#endif // _di_fss_payload_read_setting_unload_
#ifdef __cplusplus
#endif // _di_fss_write_setting_load_
#ifndef _di_fss_write_setting_unload_
- f_status_t fss_write_setting_unload(fll_program_data_t * const main, fss_write_setting_t * const setting) {
+ f_status_t fss_write_setting_unload(fss_write_main_t * const main) {
- if (!main || !setting) return F_status_set_error(F_parameter);
+ if (!main) return F_status_set_error(F_parameter);
- fss_write_setting_delete(setting);
+ fss_write_setting_delete(&main->setting);
return F_none;
}
* Perform the standard program setting unload process.
*
* @param main
- * The main program data.
- * @param setting
- * The main program settings.
+ * The main program and setting data.
* All buffers are deallocated.
*
- * This does not alter setting.state.status.
+ * This does not alter main.setting.state.status.
*
* @return
* F_none on success.
*
* F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: utf8_setting_delete().
+ * Errors (with error bit) from: fss_write_setting_delete().
*
- * @see utf8_setting_delete()
+ * @see fss_write_setting_delete()
*/
#ifndef _di_fss_write_setting_unload_
- extern f_status_t fss_write_setting_unload(fll_program_data_t * const main, fss_write_setting_t * const setting);
+ extern f_status_t fss_write_setting_unload(fss_write_main_t * const main);
#endif // _di_fss_write_setting_unload_
#ifdef __cplusplus
if (!setting) return F_status_set_error(F_output_not);
if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
- fll_error_print(print, F_status_set_fine(setting->state.status), function, fll_error_file_flag_fallback_e);
+ fll_error_print(*print, F_status_set_fine(setting->state.status), function, fll_error_file_flag_fallback_e);
return F_none;
}
if (!setting) return F_status_set_error(F_output_not);
if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
- fll_error_file_print(print, F_status_set_fine(setting->state.status), function, fll_error_file_flag_fallback_e, name, operation, type);
+ fll_error_file_print(*print, F_status_set_fine(setting->state.status), function, fll_error_file_flag_fallback_e, name, operation, type);
return F_none;
}
#endif // _di_iki_read_setting_load_parameter_substitution_
#ifndef _di_iki_read_setting_unload_
- f_status_t iki_read_setting_unload(fll_program_data_t * const main, iki_read_setting_t * const setting) {
+ f_status_t iki_read_setting_unload(iki_read_main_t * const main) {
- if (!main || !setting) return F_status_set_error(F_parameter);
+ if (!main) return F_status_set_error(F_parameter);
- iki_read_setting_delete(setting);
+ iki_read_setting_delete(&main->setting);
return F_none;
}
* Perform the standard program setting unload process.
*
* @param main
- * The main program data.
- * @param setting
- * The main program settings.
+ * The main program and setting data.
* All buffers are deallocated.
*
- * This does not alter setting.state.status.
+ * This does not alter main.setting.state.status.
*
* @return
* F_none on success.
*
* F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: utf8_setting_delete().
+ * Errors (with error bit) from: iki_read_setting_delete().
*
- * @see utf8_setting_delete()
+ * @see iki_read_setting_delete()
*/
#ifndef _di_iki_read_setting_unload_
- extern f_status_t iki_read_setting_unload(fll_program_data_t * const main, iki_read_setting_t * const setting);
+ extern f_status_t iki_read_setting_unload(iki_read_main_t * const main);
#endif // _di_iki_read_setting_unload_
#ifdef __cplusplus
if (print.verbosity < f_console_verbosity_error_e) return F_output_not;
- fll_error_print(print, F_status_set_fine(setting->state.status), function, fll_error_file_flag_fallback_e);
+ fll_error_print(*print, F_status_set_fine(setting->state.status), function, fll_error_file_flag_fallback_e);
return F_none;
}
#endif // _di_iki_write_setting_load_
#ifndef _di_iki_write_setting_unload_
- f_status_t iki_write_setting_unload(fll_program_data_t * const main, iki_write_setting_t * const setting) {
+ f_status_t iki_write_setting_unload(iki_write_main_t * const main) {
- if (!main || !setting) return F_status_set_error(F_parameter);
+ if (!main) return F_status_set_error(F_parameter);
- iki_write_setting_delete(setting);
+ iki_write_setting_delete(&main->setting);
return F_none;
}
* Perform the standard program setting unload process.
*
* @param main
- * The main program data.
- * @param setting
- * The main program settings.
+ * The main program and setting data.
* All buffers are deallocated.
*
- * This does not alter setting.state.status.
+ * This does not alter main.setting.state.status.
*
* @return
* F_none on success.
*
* F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: utf8_setting_delete().
+ * Errors (with error bit) from: iki_write_setting_delete().
*
- * @see utf8_setting_delete()
+ * @see iki_write_setting_delete()
*/
#ifndef _di_iki_write_setting_unload_
- extern f_status_t iki_write_setting_unload(fll_program_data_t * const main, iki_write_setting_t * const setting);
+ extern f_status_t iki_write_setting_unload(iki_write_main_t * const main);
#endif // _di_iki_write_setting_unload_
#ifdef __cplusplus
if (!setting) return F_status_set_error(F_output_not);
if (print.verbosity < f_console_verbosity_error_e) return F_output_not;
- fll_error_print(print, F_status_set_fine(setting->state.status), function, fll_error_file_flag_fallback_e);
+ fll_error_print(*print, F_status_set_fine(setting->state.status), function, fll_error_file_flag_fallback_e);
return F_none;
}
if (!setting) return F_status_set_error(F_output_not);
if (print.verbosity < f_console_verbosity_error_e) return F_output_not;
- fll_error_file_print(print, F_status_set_fine(setting->state.status), function, fll_error_file_flag_fallback_e, name, operation, type);
+ fll_error_file_print(*print, F_status_set_fine(setting->state.status), function, fll_error_file_flag_fallback_e, name, operation, type);
return F_none;
}
#endif // _di_status_code_setting_load_
#ifndef _di_status_code_setting_unload_
- f_status_t status_code_setting_unload(fll_program_data_t * const main, status_code_setting_t * const setting) {
+ f_status_t status_code_setting_unload(status_code_main_t * const main) {
- if (!main || !setting) return F_status_set_error(F_parameter);
+ if (!main) return F_status_set_error(F_parameter);
- status_code_setting_delete(setting);
+ status_code_setting_delete(&main->setting);
return F_none;
}
* Perform the standard program setting unload process.
*
* @param main
- * The main program data.
- * @param setting
- * The main program settings.
+ * The main program and setting data.
* All buffers are deallocated.
*
- * This does not alter setting.state.status.
+ * This does not alter main.setting.state.status.
*
* @return
* F_none on success.
*
* F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: utf8_setting_delete().
+ * Errors (with error bit) from: status_code_setting_delete().
*
- * @see utf8_setting_delete()
+ * @see status_code_setting_delete()
*/
#ifndef _di_status_code_setting_unload_
- extern f_status_t status_code_setting_unload(fll_program_data_t * const main, status_code_setting_t * const setting);
+ extern f_status_t status_code_setting_unload(status_code_main_t * const main);
#endif // _di_status_code_setting_unload_
#ifdef __cplusplus
if (!setting) return F_status_set_error(F_output_not);
if (print.verbosity < f_console_verbosity_error_e) return F_output_not;
- fll_error_print(print, F_status_set_fine(setting->state.status), function, fll_error_file_flag_fallback_e);
+ fll_error_print(*print, F_status_set_fine(setting->state.status), function, fll_error_file_flag_fallback_e);
return F_none;
}
#endif
#ifndef _di_utf8_convert_bytesequence_
- void utf8_convert_bytesequence(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t sequence) {
+ void utf8_convert_bytesequence(utf8_main_t * const main, const f_string_static_t sequence) {
- if (!main || !setting) return;
+ if (!main) return;
bool valid_not = F_false;
uint32_t codepoint = 0;
if (sequence.used) {
- setting->state.status = f_utf_unicode_to(sequence.string, sequence.used, &codepoint);
+ main->setting.state.status = f_utf_unicode_to(sequence.string, sequence.used, &codepoint);
}
else {
- setting->state.status = F_status_set_error(F_utf_not);
+ main->setting.state.status = F_status_set_error(F_utf_not);
}
- if (F_status_is_error(setting->state.status)) {
- setting->state.status = F_status_set_fine(setting->state.status);
+ if (F_status_is_error(main->setting.state.status)) {
+ main->setting.state.status = F_status_set_fine(main->setting.state.status);
- if (setting->state.status == F_failure || setting->state.status == F_utf_not || setting->state.status == F_complete_not_utf || setting->state.status == F_utf_fragment || setting->state.status == F_valid_not) {
+ if (main->setting.state.status == F_failure || main->setting.state.status == F_utf_not || main->setting.state.status == F_complete_not_utf || main->setting.state.status == F_utf_fragment || main->setting.state.status == F_valid_not) {
valid_not = F_true;
- utf8_print_data_character_invalid(setting, main->output, sequence);
+ utf8_print_data_character_invalid(&main->program.output, sequence);
}
else {
- setting->state.status = F_status_set_error(setting->state.status);
+ main->setting.state.status = F_status_set_error(main->setting.state.status);
- utf8_print_error_decode(setting, main->error, sequence);
+ utf8_print_error_decode(&main->program.error, sequence);
return;
}
}
- else if (!(setting->flag & utf8_main_flag_verify_e)) {
- if (setting->mode & utf8_mode_to_bytesequence_e) {
- utf8_print_data_bytesequence(setting, main->output, sequence);
+ else if (!(main->setting.flag & utf8_main_flag_verify_e)) {
+ if (main->setting.mode & utf8_mode_to_bytesequence_e) {
+ utf8_print_data_bytesequence(&main->program.output, sequence);
}
- else if (setting->mode & utf8_mode_to_codepoint_e) {
- utf8_print_data_codepoint(setting, main->output, codepoint);
+ else if (main->setting.mode & utf8_mode_to_codepoint_e) {
+ utf8_print_data_codepoint(&main->program.output, codepoint);
}
else {
- utf8_print_data_combining_or_width(setting, main->output, sequence);
+ utf8_print_data_combining_or_width(&main->program.output, sequence);
}
}
- if (valid_not || F_status_is_error(setting->state.status)) {
- setting->state.status = F_utf_not;
+ if (valid_not || F_status_is_error(main->setting.state.status)) {
+ main->setting.state.status = F_utf_not;
}
else {
- setting->state.status = F_none;
+ main->setting.state.status = F_none;
}
}
#endif // _di_utf8_convert_bytesequence_
#ifndef _di_utf8_process_file_bytesequence_
- void utf8_process_file_bytesequence(fll_program_data_t * const main, utf8_setting_t * const setting, const f_file_t file) {
+ void utf8_process_file_bytesequence(utf8_main_t * const main, const f_file_t file) {
- if (!main || !setting) return;
+ if (!main) return;
bool valid = F_true;
bool next = F_true;
f_string_static_t sequence = macro_f_string_static_t_initialize(block, 0, 4);
do {
- setting->state.status = f_file_stream_read_block(file, &setting->buffer);
+ main->setting.state.status = f_file_stream_read_block(file, &main->setting.buffer);
- if (setting->state.status == F_none_eof && !setting->buffer.used) break;
+ if (main->setting.state.status == F_none_eof && !main->setting.buffer.used) break;
- for (i = 0; F_status_is_error_not(setting->state.status) && i < setting->buffer.used; ) {
+ for (i = 0; F_status_is_error_not(main->setting.state.status) && i < main->setting.buffer.used; ) {
- if (!((++main->signal_check) % utf8_signal_check_d)) {
- if (fll_program_standard_signal_received(main)) {
- fll_program_print_signal_received(main->warning, main->signal_received);
+ if (!((++main->program.signal_check) % utf8_signal_check_d)) {
+ if (fll_program_standard_signal_received(&main->program)) {
+ fll_program_print_signal_received(main->program.warning, main->program.signal_received);
- setting->state.status = F_interrupt;
+ main->setting.state.status = F_interrupt;
break;
}
- main->signal_check = 0;
+ main->program.signal_check = 0;
}
- setting->state.status = F_none;
+ main->setting.state.status = F_none;
// Get the current width only when processing a new block.
if (next) {
- sequence.used = macro_f_utf_byte_width(setting->buffer.string[i]);
+ sequence.used = macro_f_utf_byte_width(main->setting.buffer.string[i]);
next = F_false;
}
- for (; j < sequence.used && i < setting->buffer.used; ++j, ++i) {
- sequence.string[j] = setting->buffer.string[i];
+ for (; j < sequence.used && i < main->setting.buffer.used; ++j, ++i) {
+ sequence.string[j] = main->setting.buffer.string[i];
} // for
if (j == sequence.used) {
- if (setting->mode & utf8_mode_from_bytesequence_e) {
- utf8_convert_bytesequence(main, setting, sequence);
+ if (main->setting.mode & utf8_mode_from_bytesequence_e) {
+ utf8_convert_bytesequence(main, sequence);
}
else {
- utf8_detect_codepoint(main, setting, sequence, &mode_codepoint);
+ utf8_detect_codepoint(main, sequence, &mode_codepoint);
- if (F_status_is_error_not(setting->state.status) && setting->state.status != F_next) {
- utf8_convert_codepoint(main, setting, sequence, &mode_codepoint);
+ if (F_status_is_error_not(main->setting.state.status) && main->setting.state.status != F_next) {
+ utf8_convert_codepoint(main, sequence, &mode_codepoint);
}
}
- if (setting->state.status == F_utf_not) {
+ if (main->setting.state.status == F_utf_not) {
valid = F_false;
}
} // for
i = 0;
- setting->buffer.used = 0;
+ main->setting.buffer.used = 0;
- } while (F_status_is_error_not(setting->state.status) && setting->state.status != F_interrupt);
+ } while (F_status_is_error_not(main->setting.state.status) && main->setting.state.status != F_interrupt);
// Handle last (incomplete) sequence when the buffer ended before the sequence is supposed to end.
- if (F_status_is_error_not(setting->state.status) && setting->state.status != F_interrupt && next == F_false) {
+ if (F_status_is_error_not(main->setting.state.status) && main->setting.state.status != F_interrupt && next == F_false) {
sequence.used = j;
- if (setting->mode & utf8_mode_from_bytesequence_e) {
- utf8_convert_bytesequence(main, setting, sequence);
+ if (main->setting.mode & utf8_mode_from_bytesequence_e) {
+ utf8_convert_bytesequence(main, sequence);
}
else {
- utf8_detect_codepoint(main, setting, sequence, &mode_codepoint);
+ utf8_detect_codepoint(main, sequence, &mode_codepoint);
- if (F_status_is_error_not(setting->state.status) && setting->state.status != F_next) {
- utf8_convert_codepoint(main, setting, sequence, &mode_codepoint);
+ if (F_status_is_error_not(main->setting.state.status) && main->setting.state.status != F_next) {
+ utf8_convert_codepoint(main, sequence, &mode_codepoint);
}
}
- if (setting->state.status == F_utf_not) {
+ if (main->setting.state.status == F_utf_not) {
valid = F_false;
}
}
- setting->buffer.used = 0;
+ main->setting.buffer.used = 0;
- if (F_status_is_error(setting->state.status) || setting->state.status == F_interrupt) return;
+ if (F_status_is_error(main->setting.state.status) || main->setting.state.status == F_interrupt) return;
- setting->state.status = valid;
+ main->setting.state.status = valid;
}
#endif // _di_utf8_process_file_bytesequence_
* This automatically determines the output format and is also handles the verify process.
*
* @param main
- * The main program data.
- * @param setting
- * The main program settings.
- * @param sequence
- * A byte sequences representing a single character to convert.
- * This does not stop on NULL and will process all text until sequence.used.
+ * The main program and settings data.
*
* This alters setting.state.status:
* F_none on success.
* F_utf_not (with error bit) if not verifying and
*
* Errors (with error bit) from: f_utf_unicode_to()
+ * @param sequence
+ * A byte sequences representing a single character to convert.
+ * This does not stop on NULL and will process all text until sequence.used.
*/
#ifndef _di_utf8_convert_bytesequence_
- extern void utf8_convert_bytesequence(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t sequence);
+ extern void utf8_convert_bytesequence(utf8_main_t * const main, const f_string_static_t sequence);
#endif // _di_utf8_convert_bytesequence_
/**
* Process file as a bytesequence input, handling conversion or verification as appropriate.
*
* @param main
- * The main program data.
- * @param setting
- * The main program settings.
- * @param file
- * The file stream to process.
- * This file may contain NULLs.
+ * The main program and settings data.
*
* This alters setting.state.status:
* F_true on success and is valid.
*
* Errors (with error bit) from: utf8_convert_bytesequence()
* Errors (with error bit) from: utf8_detect_codepoint()
+ * @param file
+ * The file stream to process.
+ * This file may contain NULLs.
*
* @see fll_program_standard_signal_received()
* @see utf8_convert_bytesequence()
* @see utf8_detect_codepoint()
*/
#ifndef _di_utf8_process_file_bytesequence_
- extern void utf8_process_file_bytesequence(fll_program_data_t * const main, utf8_setting_t * const setting, const f_file_t file);
+ extern void utf8_process_file_bytesequence(utf8_main_t * const main, const f_file_t file);
#endif // _di_utf8_process_file_bytesequence_
#ifdef __cplusplus
#endif
#ifndef _di_utf8_convert_codepoint_
- void utf8_convert_codepoint(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t unicode, uint8_t *mode) {
+ void utf8_convert_codepoint(utf8_main_t * const main, const f_string_static_t unicode, uint8_t *mode) {
- if (!main || !setting) return;
+ if (!main) return;
- setting->state.status = F_none;
+ main->setting.state.status = F_none;
bool valid_not = F_false;
if (*mode != utf8_codepoint_mode_end_e) {
- if (setting->text.used + unicode.used >= setting->text.size) {
- setting->state.status = f_string_dynamic_increase_by(utf8_default_allocation_step_d, &setting->text);
- if (F_status_is_error(setting->state.status)) return;
+ if (main->setting.text.used + unicode.used >= main->setting.text.size) {
+ main->setting.state.status = f_string_dynamic_increase_by(utf8_default_allocation_step_d, &main->setting.text);
+ if (F_status_is_error(main->setting.state.status)) return;
}
for (f_array_length_t i = 0; i < unicode.used; ++i) {
- setting->text.string[setting->text.used++] = unicode.string[i];
+ main->setting.text.string[main->setting.text.used++] = unicode.string[i];
} // for
}
if (*mode == utf8_codepoint_mode_end_e) {
uint32_t codepoint = 0;
- setting->state.status = f_utf_unicode_string_to(setting->text.string, setting->text.used, &codepoint);
+ main->setting.state.status = f_utf_unicode_string_to(main->setting.text.string, main->setting.text.used, &codepoint);
- if (F_status_is_error(setting->state.status)) {
- setting->state.status = F_status_set_fine(setting->state.status);
+ if (F_status_is_error(main->setting.state.status)) {
+ main->setting.state.status = F_status_set_fine(main->setting.state.status);
- if (setting->state.status == F_failure || setting->state.status == F_utf_not || setting->state.status == F_complete_not_utf || setting->state.status == F_utf_fragment || setting->state.status == F_valid_not) {
+ if (main->setting.state.status == F_failure || main->setting.state.status == F_utf_not || main->setting.state.status == F_complete_not_utf || main->setting.state.status == F_utf_fragment || main->setting.state.status == F_valid_not) {
valid_not = F_true;
- utf8_print_data_character_invalid(setting, main->output, unicode);
+ utf8_print_data_character_invalid(&main->program.output, unicode);
}
else {
- setting->state.status = F_status_set_error(setting->state.status);
+ main->setting.state.status = F_status_set_error(main->setting.state.status);
- utf8_print_error_decode(setting, main->error, unicode);
+ utf8_print_error_decode(&main->program.error, unicode);
return;
}
}
- else if (!(setting->flag & utf8_main_flag_verify_e)) {
- if (setting->mode & utf8_mode_to_codepoint_e) {
- utf8_print_data_codepoint(setting, main->output, codepoint);
+ else if (!(main->setting.flag & utf8_main_flag_verify_e)) {
+ if (main->setting.mode & utf8_mode_to_codepoint_e) {
+ utf8_print_data_codepoint(&main->program.output, codepoint);
}
else {
f_char_t byte[4] = { 0, 0, 0, 0 };
f_string_static_t unicode = macro_f_string_static_t_initialize(byte, 0, 4);
- setting->state.status = f_utf_unicode_from(codepoint, 4, &unicode.string);
+ main->setting.state.status = f_utf_unicode_from(codepoint, 4, &unicode.string);
- if (F_status_is_error(setting->state.status)) {
- if (setting->mode & utf8_mode_to_bytesequence_e) {
- utf8_print_error_encode(setting, main->error, codepoint);
+ if (F_status_is_error(main->setting.state.status)) {
+ if (main->setting.mode & utf8_mode_to_bytesequence_e) {
+ utf8_print_error_encode(&main->program.error, codepoint);
}
else {
- utf8_print_data_combining_or_width_invalid(setting, main->output);
+ utf8_print_data_combining_or_width_invalid(&main->program.output);
}
}
- else if (setting->mode & utf8_mode_to_bytesequence_e) {
- setting->state.status = F_none;
+ else if (main->setting.mode & utf8_mode_to_bytesequence_e) {
+ main->setting.state.status = F_none;
unicode.used = macro_f_utf_byte_width(unicode.string[0]);
- utf8_print_data_bytesequence(setting, main->output, unicode);
+ utf8_print_data_bytesequence(&main->program.output, unicode);
}
else {
- setting->state.status = F_none;
+ main->setting.state.status = F_none;
- utf8_print_data_combining_or_width(setting, main->output, unicode);
+ utf8_print_data_combining_or_width(&main->program.output, unicode);
}
}
}
}
else if (*mode == utf8_codepoint_mode_bad_end_e) {
- setting->state.status = F_none;
+ main->setting.state.status = F_none;
- utf8_print_data_character_invalid(setting, main->output, unicode);
+ utf8_print_data_character_invalid(&main->program.output, unicode);
}
else {
- setting->state.status = F_none;
+ main->setting.state.status = F_none;
return;
}
*mode = utf8_codepoint_mode_ready_e;
- setting->text.used = 0;
+ main->setting.text.used = 0;
- if (valid_not || F_status_is_error(setting->state.status)) {
- setting->state.status = F_utf_not;
+ if (valid_not || F_status_is_error(main->setting.state.status)) {
+ main->setting.state.status = F_utf_not;
}
}
#endif // _di_utf8_convert_codepoint_
#ifndef _di_utf8_convert_raw_
- void utf8_convert_raw(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t hex, uint8_t *mode) {
+ void utf8_convert_raw(utf8_main_t * const main, const f_string_static_t hex, uint8_t *mode) {
- if (!main || !setting) return;
+ if (!main) return;
- setting->state.status = F_none;
+ main->setting.state.status = F_none;
bool valid_not = F_false;
if (*mode != utf8_codepoint_mode_raw_end_e) {
- if (setting->text.used + hex.used >= setting->text.size) {
- setting->state.status = f_string_dynamic_increase_by(utf8_default_allocation_step_d, &setting->text);
- if (F_status_is_error(setting->state.status)) return;
+ if (main->setting.text.used + hex.used >= main->setting.text.size) {
+ main->setting.state.status = f_string_dynamic_increase_by(utf8_default_allocation_step_d, &main->setting.text);
+ if (F_status_is_error(main->setting.state.status)) return;
}
for (f_array_length_t i = 0; i < hex.used; ++i) {
- setting->text.string[setting->text.used++] = hex.string[i];
+ main->setting.text.string[main->setting.text.used++] = hex.string[i];
} // for
}
{
f_number_unsigned_t number = 0;
- setting->state.status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, setting->text, &number);
+ main->setting.state.status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, main->setting.text, &number);
raw = (f_utf_char_t) number;
}
- if (F_status_is_error(setting->state.status)) {
- setting->state.status = F_status_set_fine(setting->state.status);
+ if (F_status_is_error(main->setting.state.status)) {
+ main->setting.state.status = F_status_set_fine(main->setting.state.status);
- if (setting->state.status == F_number || setting->state.status == F_utf_not || setting->state.status == F_complete_not_utf || setting->state.status == F_utf_fragment || setting->state.status == F_number_decimal || setting->state.status == F_number_negative || setting->state.status == F_number_positive || setting->state.status == F_number_overflow) {
+ if (main->setting.state.status == F_number || main->setting.state.status == F_utf_not || main->setting.state.status == F_complete_not_utf || main->setting.state.status == F_utf_fragment || main->setting.state.status == F_number_decimal || main->setting.state.status == F_number_negative || main->setting.state.status == F_number_positive || main->setting.state.status == F_number_overflow) {
valid_not = F_true;
- utf8_print_data_character_invalid(setting, main->output, hex);
+ utf8_print_data_character_invalid(&main->program.output, hex);
}
else {
- setting->state.status = F_status_set_error(setting->state.status);
+ main->setting.state.status = F_status_set_error(main->setting.state.status);
- utf8_print_error_decode(setting, main->error, hex);
+ utf8_print_error_decode(&main->program.error, hex);
return;
}
}
- else if (!(setting->flag & utf8_main_flag_verify_e)) {
+ else if (!(main->setting.flag & utf8_main_flag_verify_e)) {
// The width actually includes the leading '0x', which is not part of the width of the digit in binary form.
- uint8_t width = setting->text.used > 1 ? (setting->text.used - 2) / 2 : 0;
+ uint8_t width = main->setting.text.used > 1 ? (main->setting.text.used - 2) / 2 : 0;
- if ((setting->text.used - 2) % 2) {
+ if ((main->setting.text.used - 2) % 2) {
++width;
}
- if (setting->mode & utf8_mode_to_bytesequence_e) {
- utf8_print_data_raw_bytesequence(setting, main->output, raw, width);
+ if (main->setting.mode & utf8_mode_to_bytesequence_e) {
+ utf8_print_data_raw_bytesequence(&main->program.output, raw, width);
}
- else if (setting->mode & utf8_mode_to_codepoint_e) {
- utf8_print_data_raw_codepoint(setting, main->output, setting->text);
+ else if (main->setting.mode & utf8_mode_to_codepoint_e) {
+ utf8_print_data_raw_codepoint(&main->program.output, main->setting.text);
}
else {
- utf8_print_data_raw_combining_or_width(setting, main->output, width);
+ utf8_print_data_raw_combining_or_width(&main->program.output, width);
}
}
}
else if (*mode == utf8_codepoint_mode_bad_end_e) {
- setting->state.status = F_none;
+ main->setting.state.status = F_none;
- utf8_print_data_character_invalid(setting, main->output, hex);
+ utf8_print_data_character_invalid(&main->program.output, hex);
}
else {
- setting->state.status = F_none;
+ main->setting.state.status = F_none;
return;
}
*mode = utf8_codepoint_mode_ready_e;
- setting->text.used = 0;
+ main->setting.text.used = 0;
- if (valid_not || F_status_is_error(setting->state.status)) {
- setting->state.status = F_valid_not;
+ if (valid_not || F_status_is_error(main->setting.state.status)) {
+ main->setting.state.status = F_valid_not;
}
}
#endif // _di_utf8_convert_raw_
#ifndef _di_utf8_detect_codepoint_
- void utf8_detect_codepoint(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t unicode, uint8_t *mode) {
+ void utf8_detect_codepoint(utf8_main_t * const main, const f_string_static_t unicode, uint8_t *mode) {
- if (!main || !setting) return;
+ if (!main) return;
// Skip past NULL.
if (!unicode.string[0]) {
- setting->state.status = F_next;
+ main->setting.state.status = F_next;
return;
}
- setting->state.status = F_none;
+ main->setting.state.status = F_none;
if (unicode.string[0] == f_string_ascii_u_s.string[0] || unicode.string[0] == f_string_ascii_U_s.string[0] || unicode.string[0] == f_string_ascii_plus_s.string[0]) {
// Do nothing.
// Do nothing.
}
else if (unicode.string[0] == f_string_ascii_space_s.string[0]) {
- setting->state.status = F_space;
+ main->setting.state.status = F_space;
}
else if (macro_f_utf_byte_width_is(*unicode.string)) {
- setting->state.status = f_utf_is_whitespace(unicode.string, 4, F_true);
+ main->setting.state.status = f_utf_is_whitespace(unicode.string, 4, F_true);
- if (F_status_is_error(setting->state.status)) {
- if (F_status_set_fine(setting->state.status) == F_complete_not_utf || F_status_set_fine(setting->state.status) == F_utf_fragment) {
- setting->state.status = F_valid_not;
+ if (F_status_is_error(main->setting.state.status)) {
+ if (F_status_set_fine(main->setting.state.status) == F_complete_not_utf || F_status_set_fine(main->setting.state.status) == F_utf_fragment) {
+ main->setting.state.status = F_valid_not;
}
else {
return;
}
}
- setting->state.status = (setting->state.status == F_true) ? F_space : F_valid_not;
+ main->setting.state.status = (main->setting.state.status == F_true) ? F_space : F_valid_not;
}
else {
if (unicode.string[0] < 0x30 || unicode.string[0] > (0x39 && unicode.string[0] < 0x41) || (unicode.string[0] > 0x46 && unicode.string[0] < 0x61) || unicode.string[0] > 0x66) {
- setting->state.status = f_utf_is_whitespace(unicode.string, 4, F_true);
+ main->setting.state.status = f_utf_is_whitespace(unicode.string, 4, F_true);
- if (F_status_is_error(setting->state.status)) {
- if (F_status_set_fine(setting->state.status) == F_complete_not_utf || F_status_set_fine(setting->state.status) == F_utf_fragment) {
- setting->state.status = F_valid_not;
+ if (F_status_is_error(main->setting.state.status)) {
+ if (F_status_set_fine(main->setting.state.status) == F_complete_not_utf || F_status_set_fine(main->setting.state.status) == F_utf_fragment) {
+ main->setting.state.status = F_valid_not;
}
else {
return;
}
}
- setting->state.status = (setting->state.status == F_true) ? F_space : F_none;
+ main->setting.state.status = (main->setting.state.status == F_true) ? F_space : F_none;
}
}
- if (setting->state.status == F_valid_not) {
+ if (main->setting.state.status == F_valid_not) {
if (*mode != utf8_codepoint_mode_bad_e) {
if (*mode == utf8_codepoint_mode_bad_begin_e) {
*mode = utf8_codepoint_mode_bad_e;
}
else {
if (*mode == utf8_codepoint_mode_bad_e) {
- if (setting->state.status == F_space) {
+ if (main->setting.state.status == F_space) {
*mode = utf8_codepoint_mode_bad_end_e;
}
}
else if (*mode == utf8_codepoint_mode_ready_e) {
- if (setting->state.status == F_space) {
- setting->state.status = F_next;
+ if (main->setting.state.status == F_space) {
+ main->setting.state.status = F_next;
}
else if (unicode.string[0] == f_string_ascii_u_s.string[0] || unicode.string[0] == f_string_ascii_U_s.string[0]) {
*mode = utf8_codepoint_mode_begin_e;
- setting->text.used = 0;
+ main->setting.text.used = 0;
}
else if (unicode.string[0] == f_string_ascii_0_s.string[0]) {
*mode = utf8_codepoint_mode_raw_begin_e;
- setting->text.used = 0;
+ main->setting.text.used = 0;
}
else {
*mode = utf8_codepoint_mode_bad_e;
}
}
else if (*mode == utf8_codepoint_mode_raw_number_e) {
- if (setting->state.status == F_space) {
+ if (main->setting.state.status == F_space) {
*mode = utf8_codepoint_mode_raw_end_e;
}
}
else if (*mode == utf8_codepoint_mode_number_e) {
- if (setting->state.status == F_space) {
+ if (main->setting.state.status == F_space) {
*mode = utf8_codepoint_mode_end_e;
}
}
#endif // _di_utf8_detect_codepoint_
#ifndef _di_utf8_process_file_codepoint_
- void utf8_process_file_codepoint(fll_program_data_t * const main, utf8_setting_t * const setting, const f_file_t file) {
+ void utf8_process_file_codepoint(utf8_main_t * const main, const f_file_t file) {
- if (!main || !setting) return;
+ if (!main) return;
- setting->state.status = F_none;
+ main->setting.state.status = F_none;
bool valid = F_true;
bool next = F_true;
f_string_static_t sequence = macro_f_string_static_t_initialize(block, 0, 0);
do {
- setting->state.status = f_file_stream_read_block(file, &setting->buffer);
+ main->setting.state.status = f_file_stream_read_block(file, &main->setting.buffer);
- if (setting->state.status == F_none_eof && !setting->buffer.used) {
+ if (main->setting.state.status == F_none_eof && !main->setting.buffer.used) {
// Handle complete character, which must be explicitly set to end in this situation.
if (mode_codepoint == utf8_codepoint_mode_number_e || mode_codepoint == utf8_codepoint_mode_raw_number_e) {
if (mode_codepoint == utf8_codepoint_mode_number_e) {
mode_codepoint = utf8_codepoint_mode_end_e;
- utf8_convert_codepoint(main, setting, sequence, &mode_codepoint);
+ utf8_convert_codepoint(main, sequence, &mode_codepoint);
}
else if (mode_codepoint == utf8_codepoint_mode_raw_number_e) {
mode_codepoint = utf8_codepoint_mode_raw_end_e;
- utf8_convert_raw(main, setting, sequence, &mode_codepoint);
+ utf8_convert_raw(main, sequence, &mode_codepoint);
// Raw mode represents an invalid Unicode sequence.
valid = F_false;
j = 0;
next = F_true;
- setting->state.status = F_none_eof;
+ main->setting.state.status = F_none_eof;
mode_codepoint = utf8_codepoint_mode_ready_e;
}
break;
}
- for (i = 0; F_status_is_error_not(setting->state.status) && i < setting->buffer.used; ) {
+ for (i = 0; F_status_is_error_not(main->setting.state.status) && i < main->setting.buffer.used; ) {
- if (!((++main->signal_check) % utf8_signal_check_d)) {
- if (fll_program_standard_signal_received(main)) {
- fll_program_print_signal_received(main->warning, main->signal_received);
+ if (!((++main->program.signal_check) % utf8_signal_check_d)) {
+ if (fll_program_standard_signal_received(&main->program)) {
+ fll_program_print_signal_received(main->program.warning, main->program.signal_received);
- setting->state.status = F_status_set_error(F_interrupt);
+ main->setting.state.status = F_status_set_error(F_interrupt);
break;
}
- main->signal_check = 0;
+ main->program.signal_check = 0;
}
- setting->state.status = F_none;
+ main->setting.state.status = F_none;
// Get the current width only when processing a new block.
if (next) {
- sequence.used = macro_f_utf_byte_width(setting->buffer.string[i]);
+ sequence.used = macro_f_utf_byte_width(main->setting.buffer.string[i]);
next = F_false;
}
- for (; j < sequence.used && i < setting->buffer.used; ++j, ++i) {
- sequence.string[j] = setting->buffer.string[i];
+ for (; j < sequence.used && i < main->setting.buffer.used; ++j, ++i) {
+ sequence.string[j] = main->setting.buffer.string[i];
} // for
if (j >= sequence.used) {
- if (setting->mode & utf8_mode_from_bytesequence_e) {
- utf8_convert_bytesequence(main, setting, sequence);
+ if (main->setting.mode & utf8_mode_from_bytesequence_e) {
+ utf8_convert_bytesequence(main, sequence);
}
else {
- utf8_detect_codepoint(main, setting, sequence, &mode_codepoint);
+ utf8_detect_codepoint(main, sequence, &mode_codepoint);
- if (F_status_is_error_not(setting->state.status) && setting->state.status != F_next) {
+ if (F_status_is_error_not(main->setting.state.status) && main->setting.state.status != F_next) {
if (mode_codepoint == utf8_codepoint_mode_raw_begin_e || mode_codepoint == utf8_codepoint_mode_raw_number_e || mode_codepoint == utf8_codepoint_mode_raw_end_e) {
- utf8_convert_raw(main, setting, sequence, &mode_codepoint);
+ utf8_convert_raw(main, sequence, &mode_codepoint);
// Raw mode represents an invalid Unicode sequence.
valid = F_false;
}
else {
- utf8_convert_codepoint(main, setting, sequence, &mode_codepoint);
+ utf8_convert_codepoint(main, sequence, &mode_codepoint);
}
}
}
- if (setting->state.status == F_utf_not) {
+ if (main->setting.state.status == F_utf_not) {
valid = F_false;
}
}
} // for
- setting->buffer.used = 0;
+ main->setting.buffer.used = 0;
- } while (F_status_is_error_not(setting->state.status));
+ } while (F_status_is_error_not(main->setting.state.status));
// Handle last (incomplete) character when the buffer ended before the character is supposed to end.
- if (F_status_is_error_not(setting->state.status) && next == F_false) {
+ if (F_status_is_error_not(main->setting.state.status) && next == F_false) {
sequence.used = j;
- if (setting->mode & utf8_mode_from_bytesequence_e) {
- utf8_convert_bytesequence(main, setting, sequence);
+ if (main->setting.mode & utf8_mode_from_bytesequence_e) {
+ utf8_convert_bytesequence(main, sequence);
}
else {
- utf8_detect_codepoint(main, setting, sequence, &mode_codepoint);
+ utf8_detect_codepoint(main, sequence, &mode_codepoint);
- if (F_status_is_error_not(setting->state.status) && setting->state.status != F_next) {
+ if (F_status_is_error_not(main->setting.state.status) && main->setting.state.status != F_next) {
if (mode_codepoint == utf8_codepoint_mode_raw_begin_e || mode_codepoint == utf8_codepoint_mode_raw_number_e || mode_codepoint == utf8_codepoint_mode_raw_end_e) {
- utf8_convert_raw(main, setting, sequence, &mode_codepoint);
+ utf8_convert_raw(main, sequence, &mode_codepoint);
// Raw mode represents an invalid Unicode sequence.
valid = F_false;
}
else {
- utf8_convert_codepoint(main, setting, sequence, &mode_codepoint);
+ utf8_convert_codepoint(main, sequence, &mode_codepoint);
}
}
}
- if (setting->state.status == F_utf_not) {
+ if (main->setting.state.status == F_utf_not) {
valid = F_false;
}
}
- setting->buffer.used = 0;
+ main->setting.buffer.used = 0;
- if (F_status_is_error(setting->state.status)) return;
+ if (F_status_is_error(main->setting.state.status)) return;
- setting->state.status = valid;
+ main->setting.state.status = valid;
}
#endif // _di_utf8_process_file_codepoint_
* This automatically determines the output format and also handles the verify process.
*
* @param main
- * The main program data.
- * @param setting
- * The main program settings.
- * @param unicode
- * A set of bytes representing a single codepoint character to process.
- * @param mode
- * The codepoint mode the text is currently in.
+ * The main program and settings data.
*
* This alters setting.state.status:
* F_none on success.
* F_utf_not (with error bit) if not verifying and the Unicode value is invalid.
*
* Errors (with error bit) from: f_utf_unicode_to()
+ * @param unicode
+ * A set of bytes representing a single codepoint character to process.
+ * @param mode
+ * The codepoint mode the text is currently in.
*
* @see f_utf_unicode_to()
*/
#ifndef _di_utf8_convert_codepoint_
- extern void utf8_convert_codepoint(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t unicode, uint8_t *mode);
+ extern void utf8_convert_codepoint(utf8_main_t * const main, const f_string_static_t unicode, uint8_t *mode);
#endif // _di_utf8_convert_codepoint_
/**
* This automatically determines the output format and also handles the verify process.
*
* @param main
- * The main program data.
- * @param setting
- * The main program settings.
- * @param hex
- * A set of bytes representing hexidecimal digits of a character to process.
- * @param mode
- * The codepoint mode the text is currently in.
+ * The main program and settings data.
*
* This alters setting.state.status:
* F_none on success.
* F_valid_not (with error bit) if not verifying and the raw value is invalid.
*
* Errors (with error bit) from: fl_conversion_dynamic_to_unsigned_detect()
+ * @param hex
+ * A set of bytes representing hexidecimal digits of a character to process.
+ * @param mode
+ * The codepoint mode the text is currently in.
*
* @see fl_conversion_dynamic_to_unsigned_detect()
*/
#ifndef _di_utf8_convert_raw_
- extern void utf8_convert_raw(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t hex, uint8_t *mode);
+ extern void utf8_convert_raw(utf8_main_t * const main, const f_string_static_t hex, uint8_t *mode);
#endif // _di_utf8_convert_raw_
/**
* Detect a codepoint character.
*
* @param main
- * The main program data.
- * @param setting
- * The main program settings.
- * @param unicode
- * A set of bytes representing a single codepoint character to process.
- * @param mode
- * Designate the mode in which the curent state is being processed.
+ * The main program and settings data.
*
* This alters setting.state.status:
* F_none on success.
* F_space on success, but the character is whitespace.
*
* Errors (with error bit) from: f_utf_is_whitespace()
+ * @param unicode
+ * A set of bytes representing a single codepoint character to process.
+ * @param mode
+ * Designate the mode in which the curent state is being processed.
*/
#ifndef _di_utf8_detect_codepoint_
- extern void utf8_detect_codepoint(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t unicode, uint8_t *mode);
+ extern void utf8_detect_codepoint(utf8_main_t * const main, const f_string_static_t unicode, uint8_t *mode);
#endif // _di_utf8_detect_codepoint_
/**
* Process file as a codepoint input, handling conversion or verification as appropriate.
*
* @param main
- * The main program data.
- * @param setting
- * The main program settings.
- * @param file
- * The file stream to process.
- * This file may contain NULLs.
+ * The main program and settings data.
*
* This alters setting.state.status:
* F_true on success and is valid.
*
* Errors (with error bit) from: utf8_convert_bytesequence()
* Errors (with error bit) from: utf8_detect_codepoint()
+ * @param file
+ * The file stream to process.
+ * This file may contain NULLs.
*
* @see fll_program_standard_signal_received()
* @see utf8_convert_bytesequence()
* @see utf8_detect_codepoint()
*/
#ifndef _di_utf8_process_file_codepoint_
- extern void utf8_process_file_codepoint(fll_program_data_t * const main, utf8_setting_t * const setting, const f_file_t file);
+ extern void utf8_process_file_codepoint(utf8_main_t * const main, const f_file_t file);
#endif // _di_utf8_process_file_codepoint_
#ifdef __cplusplus
#endif // _di_utf8_setting_delete_
#ifndef _di_utf8_setting_load_
- void utf8_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, utf8_setting_t * const setting) {
+ void utf8_setting_load(const f_console_arguments_t arguments, utf8_main_t * const main) {
- if (!main || !setting) return;
+ if (!main) return;
- setting->state.step_small = utf8_allocation_console_d;
+ main->setting.state.step_small = utf8_allocation_console_d;
- f_console_parameter_process(arguments, &main->parameters, &setting->state, 0);
+ f_console_parameter_process(arguments, &main->program.parameters, &main->setting.state, 0);
- setting->state.step_small = utf8_allocation_small_d;
+ main->setting.state.step_small = utf8_allocation_small_d;
// Identify and pocess first/last parameters.
- if (main->parameters.array[utf8_parameter_line_first_no_e].result & f_console_result_found_e) {
- setting->flag -= setting->flag & utf8_main_flag_print_first_e;
+ if (main->program.parameters.array[utf8_parameter_line_first_no_e].result & f_console_result_found_e) {
+ main->setting.flag -= main->setting.flag & utf8_main_flag_print_first_e;
}
else {
- setting->flag |= utf8_main_flag_print_first_e;
+ main->setting.flag |= utf8_main_flag_print_first_e;
}
- if (main->parameters.array[utf8_parameter_line_last_no_e].result & f_console_result_found_e) {
- setting->flag -= setting->flag & utf8_main_flag_print_last_e;
+ if (main->program.parameters.array[utf8_parameter_line_last_no_e].result & f_console_result_found_e) {
+ main->setting.flag -= main->setting.flag & utf8_main_flag_print_last_e;
}
else {
- setting->flag |= utf8_main_flag_print_last_e;
+ main->setting.flag |= utf8_main_flag_print_last_e;
}
- if (F_status_is_error(setting->state.status)) {
- if ((setting->flag & utf8_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) {
- fll_print_dynamic_raw(f_string_eol_s, main->message.to);
+ if (F_status_is_error(main->setting.state.status)) {
+ if ((main->setting.flag & utf8_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);
}
- utf8_print_error(setting, main->error, macro_utf8_f(f_console_parameter_process));
+ utf8_print_error(&main->program.error, macro_utf8_f(f_console_parameter_process));
return;
}
const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e };
- setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main);
+ main->setting.state.status = fll_program_parameter_process_context(choices, modes, F_true, &main->program);
- if (F_status_is_error(setting->state.status)) {
- if ((setting->flag & utf8_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) {
- fll_print_dynamic_raw(f_string_eol_s, main->message.to);
+ if (F_status_is_error(main->setting.state.status)) {
+ if ((main->setting.flag & utf8_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);
}
- utf8_print_error(setting, main->error, macro_utf8_f(fll_program_parameter_process_context));
+ utf8_print_error(&main->program.error, macro_utf8_f(fll_program_parameter_process_context));
return;
}
const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e };
- setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
+ main->setting.state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, &main->program);
- if (F_status_is_error(setting->state.status)) {
- if ((setting->flag & utf8_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) {
- fll_print_dynamic_raw(f_string_eol_s, main->message.to);
+ if (F_status_is_error(main->setting.state.status)) {
+ if ((main->setting.flag & utf8_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);
}
- utf8_print_error(setting, main->error, macro_utf8_f(fll_program_parameter_process_verbosity));
+ utf8_print_error(&main->program.error, macro_utf8_f(fll_program_parameter_process_verbosity));
return;
}
choices.array = choices_array;
choices.used = 2;
- setting->state.status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
+ main->setting.state.status = f_console_parameter_prioritize_right(main->program.parameters, choices, &choice);
- if (F_status_is_error(setting->state.status)) {
- if ((setting->flag & utf8_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) {
- fll_print_dynamic_raw(f_string_eol_s, main->message.to);
+ if (F_status_is_error(main->setting.state.status)) {
+ if ((main->setting.flag & utf8_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);
}
- utf8_print_error(setting, main->error, macro_utf8_f(f_console_parameter_prioritize_right));
+ utf8_print_error(&main->program.error, macro_utf8_f(f_console_parameter_prioritize_right));
return;
}
if (choices.array[choice] == utf8_parameter_from_bytesequence_e) {
- setting->mode -= setting->mode & utf8_mode_from_codepoint_e;
- setting->mode |= utf8_mode_from_bytesequence_e;
+ main->setting.mode -= main->setting.mode & utf8_mode_from_codepoint_e;
+ main->setting.mode |= utf8_mode_from_bytesequence_e;
}
else if (choices.array[choice] == utf8_parameter_from_codepoint_e) {
- setting->mode -= setting->mode & utf8_mode_from_bytesequence_e;
- setting->mode |= utf8_mode_from_codepoint_e;
+ main->setting.mode -= main->setting.mode & utf8_mode_from_bytesequence_e;
+ main->setting.mode |= utf8_mode_from_codepoint_e;
}
}
choices.used = 4;
choice = 1;
- setting->state.status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
+ main->setting.state.status = f_console_parameter_prioritize_right(main->program.parameters, choices, &choice);
- if (F_status_is_error(setting->state.status)) {
- if ((setting->flag & utf8_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) {
- fll_print_dynamic_raw(f_string_eol_s, main->message.to);
+ if (F_status_is_error(main->setting.state.status)) {
+ if ((main->setting.flag & utf8_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);
}
- utf8_print_error(setting, main->error, macro_utf8_f(f_console_parameter_prioritize_right));
+ utf8_print_error(&main->program.error, macro_utf8_f(f_console_parameter_prioritize_right));
return;
}
if (choices.array[choice] == utf8_parameter_to_bytesequence_e) {
- setting->mode -= setting->mode & utf8_mode_to_codepoint_e;
- setting->mode -= setting->mode & utf8_mode_to_combining_e;
- setting->mode -= setting->mode & utf8_mode_to_width_e;
+ main->setting.mode -= main->setting.mode & utf8_mode_to_codepoint_e;
+ main->setting.mode -= main->setting.mode & utf8_mode_to_combining_e;
+ main->setting.mode -= main->setting.mode & utf8_mode_to_width_e;
- setting->mode |= utf8_mode_to_bytesequence_e;
+ main->setting.mode |= utf8_mode_to_bytesequence_e;
}
else if (choices.array[choice] == utf8_parameter_to_codepoint_e) {
- setting->mode -= setting->mode & utf8_mode_to_bytesequence_e;
- setting->mode -= setting->mode & utf8_mode_to_combining_e;
- setting->mode -= setting->mode & utf8_mode_to_width_e;
+ main->setting.mode -= main->setting.mode & utf8_mode_to_bytesequence_e;
+ main->setting.mode -= main->setting.mode & utf8_mode_to_combining_e;
+ main->setting.mode -= main->setting.mode & utf8_mode_to_width_e;
- setting->mode |= utf8_mode_to_codepoint_e;
+ main->setting.mode |= utf8_mode_to_codepoint_e;
}
else if (choices.array[choice] == utf8_parameter_to_combining_e) {
- setting->mode -= setting->mode & utf8_mode_to_bytesequence_e;
- setting->mode -= setting->mode & utf8_mode_to_codepoint_e;
+ main->setting.mode -= main->setting.mode & utf8_mode_to_bytesequence_e;
+ main->setting.mode -= main->setting.mode & utf8_mode_to_codepoint_e;
// --to_width may be specified with --to_combining.
- if (main->parameters.array[utf8_parameter_to_width_e].result & f_console_result_found_e) {
- setting->mode |= utf8_mode_to_width_e;
+ if (main->program.parameters.array[utf8_parameter_to_width_e].result & f_console_result_found_e) {
+ main->setting.mode |= utf8_mode_to_width_e;
}
- setting->mode |= utf8_mode_to_combining_e;
+ main->setting.mode |= utf8_mode_to_combining_e;
}
else if (choices.array[choice] == utf8_parameter_to_width_e) {
- setting->mode -= setting->mode & utf8_mode_to_bytesequence_e;
- setting->mode -= setting->mode & utf8_mode_to_codepoint_e;
+ main->setting.mode -= main->setting.mode & utf8_mode_to_bytesequence_e;
+ main->setting.mode -= main->setting.mode & utf8_mode_to_codepoint_e;
// --to_width may be specified with --to_combining.
- if (main->parameters.array[utf8_parameter_to_combining_e].result & f_console_result_found_e) {
- setting->mode |= utf8_mode_to_combining_e;
+ if (main->program.parameters.array[utf8_parameter_to_combining_e].result & f_console_result_found_e) {
+ main->setting.mode |= utf8_mode_to_combining_e;
}
- setting->mode |= utf8_mode_to_width_e;
+ main->setting.mode |= utf8_mode_to_width_e;
}
}
}
- if (main->parameters.array[utf8_parameter_help_e].result & f_console_result_found_e) {
- setting->flag |= utf8_main_flag_help_e;
+ if (main->program.parameters.array[utf8_parameter_help_e].result & f_console_result_found_e) {
+ main->setting.flag |= utf8_main_flag_help_e;
return;
}
- if (main->parameters.array[utf8_parameter_version_e].result & f_console_result_found_e) {
- setting->flag |= utf8_main_flag_version_e;
+ if (main->program.parameters.array[utf8_parameter_version_e].result & f_console_result_found_e) {
+ main->setting.flag |= utf8_main_flag_version_e;
return;
}
- if (main->parameters.array[utf8_parameter_copyright_e].result & f_console_result_found_e) {
- setting->flag |= utf8_main_flag_copyright_e;
+ if (main->program.parameters.array[utf8_parameter_copyright_e].result & f_console_result_found_e) {
+ main->setting.flag |= utf8_main_flag_copyright_e;
return;
}
- if (main->parameters.array[utf8_parameter_to_file_e].result & f_console_result_value_e) {
- if (main->parameters.array[utf8_parameter_to_file_e].values.used > 1) {
- setting->state.status = F_status_set_error(F_parameter);
+ if (main->program.parameters.array[utf8_parameter_to_file_e].result & f_console_result_value_e) {
+ if (main->program.parameters.array[utf8_parameter_to_file_e].values.used > 1) {
+ main->setting.state.status = F_status_set_error(F_parameter);
- if ((setting->flag & utf8_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) {
- fll_print_dynamic_raw(f_string_eol_s, main->message.to);
+ if ((main->setting.flag & utf8_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);
}
- utf8_print_error_parameter_file_to_too_many(setting, main->error);
+ utf8_print_error_parameter_file_to_too_many(&main->program.error);
return;
}
- if (main->parameters.arguments.array[main->parameters.array[utf8_parameter_to_file_e].values.array[0]].used) {
- setting->path_files_to.used = 0;
+ if (main->program.parameters.arguments.array[main->program.parameters.array[utf8_parameter_to_file_e].values.array[0]].used) {
+ main->setting.path_files_to.used = 0;
- setting->state.status = f_string_dynamics_increase_by(1, &setting->path_files_to);
+ main->setting.state.status = f_string_dynamics_increase_by(1, &main->setting.path_files_to);
- if (F_status_is_error(setting->state.status)) {
- if ((setting->flag & utf8_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) {
- fll_print_dynamic_raw(f_string_eol_s, main->message.to);
+ if (F_status_is_error(main->setting.state.status)) {
+ if ((main->setting.flag & utf8_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);
}
- utf8_print_error(setting, main->error, macro_utf8_f(f_string_dynamics_increase_by));
+ utf8_print_error(&main->program.error, macro_utf8_f(f_string_dynamics_increase_by));
return;
}
- setting->path_files_to.array[setting->path_files_to.used].used = 0;
+ main->setting.path_files_to.array[main->setting.path_files_to.used].used = 0;
- setting->state.status = f_string_dynamic_append_nulless(main->parameters.arguments.array[main->parameters.array[utf8_parameter_to_file_e].values.array[0]], &setting->path_files_to.array[0]);
+ main->setting.state.status = f_string_dynamic_append_nulless(main->program.parameters.arguments.array[main->program.parameters.array[utf8_parameter_to_file_e].values.array[0]], &main->setting.path_files_to.array[0]);
- if (F_status_is_error(setting->state.status)) {
- if ((setting->flag & utf8_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) {
- fll_print_dynamic_raw(f_string_eol_s, main->message.to);
+ if (F_status_is_error(main->setting.state.status)) {
+ if ((main->setting.flag & utf8_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);
}
- utf8_print_error(setting, main->error, macro_utf8_f(f_string_dynamic_append_nulless));
+ utf8_print_error(&main->program.error, macro_utf8_f(f_string_dynamic_append_nulless));
return;
}
- ++setting->path_files_to.used;
+ ++main->setting.path_files_to.used;
- setting->state.status = f_file_stream_open(main->parameters.arguments.array[main->parameters.array[utf8_parameter_to_file_e].values.array[0]], f_file_open_mode_append_s, &main->output.to);
+ main->setting.state.status = f_file_stream_open(main->program.parameters.arguments.array[main->program.parameters.array[utf8_parameter_to_file_e].values.array[0]], f_file_open_mode_append_s, &main->program.output.to);
- if (F_status_is_error(setting->state.status)) {
- if ((setting->flag & utf8_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) {
- fll_print_dynamic_raw(f_string_eol_s, main->message.to);
+ if (F_status_is_error(main->setting.state.status)) {
+ if ((main->setting.flag & utf8_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);
}
- utf8_print_error_file(setting, main->error, macro_utf8_f(f_file_stream_open), main->parameters.arguments.array[main->parameters.array[utf8_parameter_to_file_e].values.array[0]], f_file_operation_open_s, fll_error_file_type_file_e);
+ utf8_print_error_file(&main->program.error, macro_utf8_f(f_file_stream_open), main->program.parameters.arguments.array[main->program.parameters.array[utf8_parameter_to_file_e].values.array[0]], f_file_operation_open_s, fll_error_file_type_file_e);
return;
}
- setting->flag |= utf8_main_flag_file_to_e;
+ main->setting.flag |= utf8_main_flag_file_to_e;
}
else {
- if ((setting->flag & utf8_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) {
- fll_print_dynamic_raw(f_string_eol_s, main->message.to);
+ if ((main->setting.flag & utf8_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);
}
- utf8_print_error_parameter_file_name_empty(setting, main->error, main->parameters.array[utf8_parameter_to_file_e].values.array[0]);
+ utf8_print_error_parameter_file_name_empty(&main->program.error, main->program.parameters.array[utf8_parameter_to_file_e].values.array[0]);
- setting->state.status = F_status_set_error(F_parameter);
+ main->setting.state.status = F_status_set_error(F_parameter);
return;
}
}
- else if (main->parameters.array[utf8_parameter_to_file_e].result & f_console_result_found_e) {
- setting->state.status = F_status_set_error(F_parameter);
+ else if (main->program.parameters.array[utf8_parameter_to_file_e].result & f_console_result_found_e) {
+ main->setting.state.status = F_status_set_error(F_parameter);
- if ((setting->flag & utf8_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) {
- fll_print_dynamic_raw(f_string_eol_s, main->message.to);
+ if ((main->setting.flag & utf8_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_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, utf8_long_to_file_s);
+ fll_program_print_error_parameter_missing_value(main->program.error, f_console_symbol_long_normal_s, utf8_long_to_file_s);
return;
}
else {
- main->output.to = main->message.to;
- setting->flag -= setting->flag & utf8_main_flag_file_to_e;
+ main->program.output.to = main->program.message.to;
+ main->setting.flag -= main->setting.flag & utf8_main_flag_file_to_e;
}
- if (main->parameters.array[utf8_parameter_from_file_e].result & f_console_result_value_e) {
- setting->path_files_from.used = 0;
+ if (main->program.parameters.array[utf8_parameter_from_file_e].result & f_console_result_value_e) {
+ main->setting.path_files_from.used = 0;
- setting->state.status = f_string_dynamics_increase_by(main->parameters.array[utf8_parameter_from_file_e].values.used, &setting->path_files_from);
+ main->setting.state.status = f_string_dynamics_increase_by(main->program.parameters.array[utf8_parameter_from_file_e].values.used, &main->setting.path_files_from);
- if (F_status_is_error(setting->state.status)) {
- if ((setting->flag & utf8_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) {
- fll_print_dynamic_raw(f_string_eol_s, main->message.to);
+ if (F_status_is_error(main->setting.state.status)) {
+ if ((main->setting.flag & utf8_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);
}
- utf8_print_error(setting, main->error, macro_utf8_f(f_string_dynamics_increase_by));
+ utf8_print_error(&main->program.error, macro_utf8_f(f_string_dynamics_increase_by));
return;
}
- setting->path_files_from.used = main->parameters.array[utf8_parameter_from_file_e].values.used;
+ main->setting.path_files_from.used = main->program.parameters.array[utf8_parameter_from_file_e].values.used;
f_array_length_t i = 0;
f_array_length_t index = 0;
- for (; i < setting->path_files_from.used; ++i) {
+ for (; i < main->setting.path_files_from.used; ++i) {
- index = main->parameters.array[utf8_parameter_from_file_e].values.array[i];
- setting->path_files_from.array[i].used = 0;
+ index = main->program.parameters.array[utf8_parameter_from_file_e].values.array[i];
+ main->setting.path_files_from.array[i].used = 0;
- setting->state.status = f_string_dynamic_append_nulless(main->parameters.arguments.array[index], &setting->path_files_from.array[i]);
+ main->setting.state.status = f_string_dynamic_append_nulless(main->program.parameters.arguments.array[index], &main->setting.path_files_from.array[i]);
- if (F_status_is_error(setting->state.status)) {
- if ((setting->flag & utf8_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) {
- fll_print_dynamic_raw(f_string_eol_s, main->message.to);
+ if (F_status_is_error(main->setting.state.status)) {
+ if ((main->setting.flag & utf8_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_print(main->error, F_status_set_fine(setting->state.status), macro_utf8_f(f_string_dynamic_append_nulless), fll_error_file_flag_fallback_e);
+ fll_error_print(main->program.error, F_status_set_fine(main->setting.state.status), macro_utf8_f(f_string_dynamic_append_nulless), fll_error_file_flag_fallback_e);
break;
}
- if (main->parameters.arguments.array[index].used) {
- if (f_file_exists(main->parameters.arguments.array[index], F_true) != F_true) {
- utf8_print_error_parameter_file_not_found(setting, main->error, F_true, main->parameters.arguments.array[index]);
+ if (main->program.parameters.arguments.array[index].used) {
+ if (f_file_exists(main->program.parameters.arguments.array[index], F_true) != F_true) {
+ utf8_print_error_parameter_file_not_found(&main->program.error, F_true, main->program.parameters.arguments.array[index]);
- if (F_status_is_error_not(setting->state.status)) {
- setting->state.status = F_status_set_error(F_file_found_not);
+ if (F_status_is_error_not(main->setting.state.status)) {
+ main->setting.state.status = F_status_set_error(F_file_found_not);
}
}
}
else {
- if (F_status_is_error_not(setting->state.status)) {
- if ((setting->flag & utf8_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) {
- fll_print_dynamic_raw(f_string_eol_s, main->message.to);
+ if (F_status_is_error_not(main->setting.state.status)) {
+ if ((main->setting.flag & utf8_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);
}
}
- utf8_print_error_parameter_file_name_empty(setting, main->error, index);
+ utf8_print_error_parameter_file_name_empty(&main->program.error, index);
- if (F_status_is_error_not(setting->state.status)) {
- setting->state.status = F_status_set_error(F_parameter);
+ if (F_status_is_error_not(main->setting.state.status)) {
+ main->setting.state.status = F_status_set_error(F_parameter);
}
}
} // for
- if (F_status_is_error(setting->state.status)) return;
+ if (F_status_is_error(main->setting.state.status)) return;
- setting->flag |= utf8_main_flag_file_from_e;
+ main->setting.flag |= utf8_main_flag_file_from_e;
}
- else if (main->parameters.array[utf8_parameter_from_file_e].result & f_console_result_found_e) {
- setting->state.status = F_status_set_error(F_parameter);
+ else if (main->program.parameters.array[utf8_parameter_from_file_e].result & f_console_result_found_e) {
+ main->setting.state.status = F_status_set_error(F_parameter);
- if ((setting->flag & utf8_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) {
- fll_print_dynamic_raw(f_string_eol_s, main->message.to);
+ if ((main->setting.flag & utf8_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_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, utf8_long_from_file_s);
+ fll_program_print_error_parameter_missing_value(main->program.error, f_console_symbol_long_normal_s, utf8_long_from_file_s);
return;
}
else {
- setting->flag -= setting->flag & utf8_main_flag_file_from_e;
+ main->setting.flag -= main->setting.flag & utf8_main_flag_file_from_e;
}
- if (main->parameters.remaining.used) {
- setting->remaining.used = 0;
+ if (main->program.parameters.remaining.used) {
+ main->setting.remaining.used = 0;
- setting->state.status = f_string_dynamics_increase_by(main->parameters.remaining.used, &setting->remaining);
+ main->setting.state.status = f_string_dynamics_increase_by(main->program.parameters.remaining.used, &main->setting.remaining);
- if (F_status_is_error(setting->state.status)) {
- if ((setting->flag & utf8_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) {
- fll_print_dynamic_raw(f_string_eol_s, main->message.to);
+ if (F_status_is_error(main->setting.state.status)) {
+ if ((main->setting.flag & utf8_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);
}
- utf8_print_error(setting, main->error, macro_utf8_f(f_string_dynamics_increase_by));
+ utf8_print_error(&main->program.error, macro_utf8_f(f_string_dynamics_increase_by));
return;
}
// Construct the array without allocating any more memory by setting this as a static string (used > 0, size = 0).
- for (f_array_length_t index = 0; setting->remaining.used < main->parameters.remaining.used; ) {
+ for (f_array_length_t index = 0; main->setting.remaining.used < main->program.parameters.remaining.used; ) {
- index = main->parameters.remaining.array[setting->remaining.used];
+ index = main->program.parameters.remaining.array[main->setting.remaining.used];
- setting->remaining.array[setting->remaining.used].string = main->parameters.arguments.array[index].string;
- setting->remaining.array[setting->remaining.used].used = main->parameters.arguments.array[index].used;
- setting->remaining.array[setting->remaining.used++].size = 0;
+ main->setting.remaining.array[main->setting.remaining.used].string = main->program.parameters.arguments.array[index].string;
+ main->setting.remaining.array[main->setting.remaining.used].used = main->program.parameters.arguments.array[index].used;
+ main->setting.remaining.array[main->setting.remaining.used++].size = 0;
} // for
}
- if (!(main->parameters.array[utf8_parameter_from_file_e].result & f_console_result_found_e) && !((main->pipe & fll_program_data_pipe_input_e) || main->parameters.remaining.used)) {
- setting->state.status = F_status_set_error(F_parameter);
+ if (!(main->program.parameters.array[utf8_parameter_from_file_e].result & f_console_result_found_e) && !((main->program.pipe & fll_program_data_pipe_input_e) || main->program.parameters.remaining.used)) {
+ main->setting.state.status = F_status_set_error(F_parameter);
- if ((setting->flag & utf8_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) {
- fll_print_dynamic_raw(f_string_eol_s, main->message.to);
+ if ((main->setting.flag & utf8_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);
}
- utf8_print_error_no_from(setting, main->error);
+ utf8_print_error_no_from(&main->program.error);
return;
}
- if (!(setting->mode & utf8_mode_to_bytesequence_e)) {
- if ((main->parameters.array[utf8_parameter_separate_e].result & f_console_result_found_e) || (main->parameters.array[utf8_parameter_headers_e].result & f_console_result_found_e)) {
- setting->prepend = utf8_string_prepend_padding_s;
- setting->append = f_string_eol_s;
+ if (!(main->setting.mode & utf8_mode_to_bytesequence_e)) {
+ if ((main->program.parameters.array[utf8_parameter_separate_e].result & f_console_result_found_e) || (main->program.parameters.array[utf8_parameter_headers_e].result & f_console_result_found_e)) {
+ main->setting.prepend = utf8_string_prepend_padding_s;
+ main->setting.append = f_string_eol_s;
}
else {
- setting->prepend = f_string_space_s;
+ main->setting.prepend = f_string_space_s;
}
}
- if (main->parameters.array[utf8_parameter_headers_e].result & f_console_result_found_e) {
- if (main->parameters.array[utf8_parameter_separate_e].result & f_console_result_found_e) {
- if (main->parameters.array[utf8_parameter_headers_e].location < main->parameters.array[utf8_parameter_separate_e].location) {
- setting->flag |= utf8_main_flag_separate_e;
+ if (main->program.parameters.array[utf8_parameter_headers_e].result & f_console_result_found_e) {
+ if (main->program.parameters.array[utf8_parameter_separate_e].result & f_console_result_found_e) {
+ if (main->program.parameters.array[utf8_parameter_headers_e].location < main->program.parameters.array[utf8_parameter_separate_e].location) {
+ main->setting.flag |= utf8_main_flag_separate_e;
}
- else if (main->parameters.array[utf8_parameter_headers_e].location == main->parameters.array[utf8_parameter_separate_e].location) {
- if (main->parameters.array[utf8_parameter_headers_e].location_sub < main->parameters.array[utf8_parameter_separate_e].location_sub) {
- setting->flag |= utf8_main_flag_separate_e;
+ else if (main->program.parameters.array[utf8_parameter_headers_e].location == main->program.parameters.array[utf8_parameter_separate_e].location) {
+ if (main->program.parameters.array[utf8_parameter_headers_e].location_sub < main->program.parameters.array[utf8_parameter_separate_e].location_sub) {
+ main->setting.flag |= utf8_main_flag_separate_e;
}
else {
- setting->flag |= utf8_main_flag_header_e;
+ main->setting.flag |= utf8_main_flag_header_e;
}
}
else {
- setting->flag |= utf8_main_flag_header_e;
+ main->setting.flag |= utf8_main_flag_header_e;
}
}
else {
- setting->flag |= utf8_main_flag_header_e;
+ main->setting.flag |= utf8_main_flag_header_e;
}
}
- else if (main->parameters.array[utf8_parameter_separate_e].result & f_console_result_found_e) {
- setting->flag |= utf8_main_flag_separate_e;
+ else if (main->program.parameters.array[utf8_parameter_separate_e].result & f_console_result_found_e) {
+ main->setting.flag |= utf8_main_flag_separate_e;
}
- if (main->parameters.array[utf8_parameter_strip_invalid_e].result & f_console_result_found_e) {
- setting->flag |= utf8_main_flag_strip_invalid_e;
+ if (main->program.parameters.array[utf8_parameter_strip_invalid_e].result & f_console_result_found_e) {
+ main->setting.flag |= utf8_main_flag_strip_invalid_e;
}
- setting->valid_not = main->message.set->error;
+ main->setting.valid_not = main->program.message.set->error;
- if (main->pipe & fll_program_data_pipe_input_e) {
- setting->flag |= utf8_main_flag_pipe_e;
+ if (main->program.pipe & fll_program_data_pipe_input_e) {
+ main->setting.flag |= utf8_main_flag_pipe_e;
}
}
#endif // _di_utf8_setting_load_
#ifndef _di_utf8_setting_unload_
- f_status_t utf8_setting_unload(fll_program_data_t * const main, utf8_setting_t * const setting) {
+ f_status_t utf8_setting_unload(utf8_main_t * const main) {
- if (!main || !setting) return F_status_set_error(F_parameter);
+ if (!main) return F_status_set_error(F_parameter);
- utf8_setting_delete(setting);
+ utf8_setting_delete(&main->setting);
return F_none;
}
* @param arguments
* The parameters passed to the process (often referred to as command line arguments).
* @param main
- * The main program data.
- * @param setting
- * The main program settings.
+ * The main program data and settings.
*
- * This alters setting.state.status:
+ * This alters main.setting.state.status:
* F_none on success.
*
* Errors (with error bit) from: f_console_parameter_process().
* Errors (with error bit) from: fll_program_parameter_process_context().
- * @param state
- * A state for providing flags and handling interrupts during long running operations.
*
* @see f_console_parameter_process()
* @see fll_program_parameter_process_context()
*/
#ifndef _di_utf8_setting_load_
- extern void utf8_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, utf8_setting_t * const setting);
+ extern void utf8_setting_load(const f_console_arguments_t arguments, utf8_main_t * const main);
#endif // _di_utf8_setting_load_
/**
* Perform the standard program setting unload process.
*
* @param main
- * The main program data.
- * @param setting
- * The main program settings.
+ * The main program and setting data.
* All buffers are deallocated.
*
- * This does not alter setting.state.status.
+ * This does not alter main.setting.state.status.
*
* @return
* F_none on success.
* @see utf8_setting_delete()
*/
#ifndef _di_utf8_setting_unload_
- extern f_status_t utf8_setting_unload(fll_program_data_t * const main, utf8_setting_t * const setting);
+ extern f_status_t utf8_setting_unload(utf8_main_t * const main);
#endif // _di_utf8_setting_unload_
#ifdef __cplusplus
--- /dev/null
+#include "../utf8.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 3
+ *
+ * Project: UTF8
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Provides the common type structures.
+ *
+ * This is auto-included and should not need to be explicitly included.
+ */
+#ifndef _utf8_common_define_h
+#define _utf8_common_define_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Set to at least 4 to provide a UTF-8 friendly allocation step.
+ */
+#ifndef _di_utf8_default_d_
+ #define utf8_default_allocation_step_d 16
+#endif // _di_utf8_default_d_
+
+/**
+ * The program defines.
+ *
+ * utf8_*:
+ * - allocation_console: An allocation step used for small buffers specifically for console parameter.
+ * - allocation_large: An allocation step used for buffers that are anticipated to have large buffers.
+ * - allocation_small: An allocation step used for buffers that are anticipated to have small buffers.
+ * - signal_check: Number of iterations before performing signal check in non-threaded signal handling.
+ */
+#ifndef _di_utf8_d_
+ #define utf8_allocation_console_d 4
+ #define utf8_allocation_large_d 256
+ #define utf8_allocation_small_d 16
+ #define utf8_signal_check_d 20000
+#endif // _di_utf8_d_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _utf8_common_define_h
--- /dev/null
+#include "../utf8.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 3
+ *
+ * Project: UTF8
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Provides the common type structures.
+ *
+ * This is auto-included and should not need to be explicitly included.
+ */
+#ifndef _utf8_common_enumeration_h
+#define _utf8_common_enumeration_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Modes used to designate how to the input and output are to be processed.
+ *
+ * utf8_mode_*_e:
+ * - none: No flags set.
+ *
+ * utf8_mode_from_*_e:
+ * - bytesequence: The input format is bytesequence.
+ * - codepoint: The input format is codepoint (U+XXXX or U+XXXXXX).
+ *
+ * utf8_mode_to_*_e:
+ * - bytesequence: The output format is bytesequence.
+ * - codepoint: The output format is codepoint (U+XXXX or U+XXXXXX).
+ * - combining: The output format is whether or not character is combining (may be used with "width").
+ * - width: The output format is how wide the character is (may be used with "combining").
+ */
+#ifndef _di_utf8_modes_e_
+ enum {
+ utf8_mode_none_e = 0x0,
+ utf8_mode_from_bytesequence_e = 0x1,
+ utf8_mode_from_codepoint_e = 0x2,
+ utf8_mode_to_bytesequence_e = 0x4,
+ utf8_mode_to_codepoint_e = 0x8,
+ utf8_mode_to_combining_e = 0x10,
+ utf8_mode_to_width_e = 0x20,
+ }; // enum
+#endif // _di_utf8_modes_e_
+
+/**
+ * Flags passed to the main function or program.
+ *
+ * utf8_main_flag_*_e:
+ * - none: No flags set.
+ * - copyright: Print the copyright.
+ * - file_from: Using a specified source file.
+ * - file_to: Using a specified destination file.
+ * - header: Enable printing of headers.
+ * - help: Print help.
+ * - pipe: Use the input pipe.
+ * - print_first: When set, print new line to message output on program begin after loading settings.
+ * - print_last: When set, print new line to message output on program end.
+ * - separate: Enable printing of separators.
+ * - strip_invalid: Using strip invalid character mode.
+ * - verify: Using verify mode.
+ * - version: Print version.
+ */
+#ifndef _di_utf8_main_flag_e_
+ enum {
+ utf8_main_flag_none_e = 0x0,
+ utf8_main_flag_copyright_e = 0x1,
+ utf8_main_flag_file_from_e = 0x2,
+ utf8_main_flag_file_to_e = 0x4,
+ utf8_main_flag_header_e = 0x8,
+ utf8_main_flag_help_e = 0x10,
+ utf8_main_flag_pipe_e = 0x20,
+ utf8_main_flag_print_first_e = 0x40,
+ utf8_main_flag_print_last_e = 0x80,
+ utf8_main_flag_separate_e = 0x100,
+ utf8_main_flag_strip_invalid_e = 0x200,
+ utf8_main_flag_verify_e = 0x400,
+ utf8_main_flag_version_e = 0x800,
+ }; // enum
+#endif // _di_utf8_main_flag_e_
+
+/**
+ * Codepoint modes for converting to/from binary and codepoint values.
+ *
+ * The special "raw" format is used only for reading from codepoint format where that format represents binary character that is not a valid Unicode character.
+ * This is intended to be used to save and restore the original binary data even if that data is invalid.
+ *
+ * private_utf8_codepoint_mode_*:
+ * - ready: The codepoint has yet to be processed, skip leading spaces until first 'U' is matched.
+ * - begin: The first 'U' is matched, look for the '+'.
+ * - number: The '+' is matched, process numbers.
+ * - end: The last number is reached (at either white space or EOS/EOF).
+ * - bad: This is not a valid codepoint.
+ * - bad_begin: This is the beginning of an invalid codepoint.
+ * - bad_end: The end of bad is detected, which happens on white space or end of buffer.
+ * - raw_begin: This is the beginning of a potential raw data (matched '0').
+ * - raw_number: This is the confirmed beginning of raw data (matched 'X'), process numbers.
+ * - raw_end: The end of raw data is detected, which happens on white space or end of buffer.
+ */
+#ifndef _di_utf8_codepoint_modes_
+ enum {
+ utf8_codepoint_mode_ready_e = 1,
+ utf8_codepoint_mode_begin_e,
+ utf8_codepoint_mode_number_e,
+ utf8_codepoint_mode_end_e,
+ utf8_codepoint_mode_bad_e,
+ utf8_codepoint_mode_bad_begin_e,
+ utf8_codepoint_mode_bad_end_e,
+ utf8_codepoint_mode_raw_begin_e,
+ utf8_codepoint_mode_raw_number_e,
+ utf8_codepoint_mode_raw_end_e,
+ }; // enum
+#endif // _di__utf8_codepoint_modes_
+
+/**
+ * The main program parameters.
+ */
+#ifndef _di_utf8_parameter_e_
+ enum {
+ utf8_parameter_help_e,
+ utf8_parameter_copyright_e,
+ utf8_parameter_light_e,
+ utf8_parameter_dark_e,
+ utf8_parameter_no_color_e,
+ utf8_parameter_verbosity_quiet_e,
+ utf8_parameter_verbosity_error_e,
+ utf8_parameter_verbosity_normal_e,
+ utf8_parameter_verbosity_verbose_e,
+ utf8_parameter_verbosity_debug_e,
+ utf8_parameter_version_e,
+ utf8_parameter_line_first_no_e,
+ utf8_parameter_line_last_no_e,
+
+ utf8_parameter_from_bytesequence_e,
+ utf8_parameter_from_codepoint_e,
+ utf8_parameter_from_file_e,
+
+ utf8_parameter_headers_e,
+ utf8_parameter_separate_e,
+ utf8_parameter_strip_invalid_e,
+
+ utf8_parameter_to_bytesequence_e,
+ utf8_parameter_to_codepoint_e,
+ utf8_parameter_to_combining_e,
+ utf8_parameter_to_file_e,
+ utf8_parameter_to_width_e,
+
+ utf8_parameter_verify_e,
+ }; // enum
+
+ #define utf8_console_parameter_t_initialize \
+ { \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_copyright_s, f_console_standard_long_copyright_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \
+ \
+ macro_f_console_parameter_t_initialize_3(utf8_short_from_bytesequence_s, utf8_long_from_bytesequence_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(utf8_short_from_codepoint_s, utf8_long_from_codepoint_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(utf8_short_from_file_s, utf8_long_from_file_s, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(utf8_short_headers_s, utf8_long_headers_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(utf8_short_separate_s, utf8_long_separate_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(utf8_short_strip_invalid_s, utf8_long_strip_invalid_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(utf8_short_to_bytesequence_s, utf8_long_to_bytesequence_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(utf8_short_to_codepoint_s, utf8_long_to_codepoint_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(utf8_short_to_combining_s, utf8_long_to_combining_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(utf8_short_to_file_s, utf8_long_to_file_s, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(utf8_short_to_width_s, utf8_long_to_width_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(utf8_short_verify_s, utf8_long_verify_s, 0, f_console_flag_normal_e), \
+ }
+
+ #define utf8_total_parameters_d 25
+#endif // _di_utf8_parameter_e_
+
+/**
+ * Flags for fine-tuned print control.
+ *
+ * utf8_print_flag_*_e:
+ * - none: No flags set.
+ * - debug: Stream is for debug printing.
+ * - error: Stream is for error printing.
+ * - message: Stream is for message printing.
+ * - warning: Stream is for warning printing.
+ * - file_to: Stream is a destination file.
+ * - file_from: Stream is a source file.
+ */
+#ifndef _di_utf8_print_flag_e_
+ enum {
+ utf8_print_flag_none_e = 0x0,
+ utf8_print_flag_debug_e = 0x1,
+ utf8_print_flag_error_e = 0x2,
+ utf8_print_flag_message_e = 0x4,
+ utf8_print_flag_warning_e = 0x8,
+ utf8_print_flag_file_to_e = 0x10,
+ utf8_print_flag_file_from_e = 0x20,
+ }; // enum
+#endif // _di_utf8_print_flag_e_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _utf8_common_enumeration_h
#endif // _di_utf8_d_
/**
- * Modes used to designate how to the input and output are to be processed.
- *
- * utf8_mode_*_e:
- * - none: No flags set.
- *
- * utf8_mode_from_*_e:
- * - bytesequence: The input format is bytesequence.
- * - codepoint: The input format is codepoint (U+XXXX or U+XXXXXX).
- *
- * utf8_mode_to_*_e:
- * - bytesequence: The output format is bytesequence.
- * - codepoint: The output format is codepoint (U+XXXX or U+XXXXXX).
- * - combining: The output format is whether or not character is combining (may be used with "width").
- * - width: The output format is how wide the character is (may be used with "combining").
- */
-#ifndef _di_utf8_modes_e_
- enum {
- utf8_mode_none_e = 0x0,
- utf8_mode_from_bytesequence_e = 0x1,
- utf8_mode_from_codepoint_e = 0x2,
- utf8_mode_to_bytesequence_e = 0x4,
- utf8_mode_to_codepoint_e = 0x8,
- utf8_mode_to_combining_e = 0x10,
- utf8_mode_to_width_e = 0x20,
- }; // enum
-#endif // _di_utf8_modes_e_
-
-/**
- * Flags passed to the main function or program.
- *
- * utf8_main_flag_*_e:
- * - none: No flags set.
- * - copyright: Print the copyright.
- * - file_from: Using a specified source file.
- * - file_to: Using a specified destination file.
- * - header: Enable printing of headers.
- * - help: Print help.
- * - pipe: Use the input pipe.
- * - print_first: When set, print new line to message output on program begin after loading settings.
- * - print_last: When set, print new line to message output on program end.
- * - separate: Enable printing of separators.
- * - strip_invalid: Using strip invalid character mode.
- * - verify: Using verify mode.
- * - version: Print version.
- */
-#ifndef _di_utf8_main_flag_e_
- enum {
- utf8_main_flag_none_e = 0x0,
- utf8_main_flag_copyright_e = 0x1,
- utf8_main_flag_file_from_e = 0x2,
- utf8_main_flag_file_to_e = 0x4,
- utf8_main_flag_header_e = 0x8,
- utf8_main_flag_help_e = 0x10,
- utf8_main_flag_pipe_e = 0x20,
- utf8_main_flag_print_first_e = 0x40,
- utf8_main_flag_print_last_e = 0x80,
- utf8_main_flag_separate_e = 0x100,
- utf8_main_flag_strip_invalid_e = 0x200,
- utf8_main_flag_verify_e = 0x400,
- utf8_main_flag_version_e = 0x800,
- }; // enum
-#endif // _di_utf8_main_flag_e_
-
-/**
- * Codepoint modes for converting to/from binary and codepoint values.
- *
- * The special "raw" format is used only for reading from codepoint format where that format represents binary character that is not a valid Unicode character.
- * This is intended to be used to save and restore the original binary data even if that data is invalid.
- *
- * private_utf8_codepoint_mode_*:
- * - ready: The codepoint has yet to be processed, skip leading spaces until first 'U' is matched.
- * - begin: The first 'U' is matched, look for the '+'.
- * - number: The '+' is matched, process numbers.
- * - end: The last number is reached (at either white space or EOS/EOF).
- * - bad: This is not a valid codepoint.
- * - bad_begin: This is the beginning of an invalid codepoint.
- * - bad_end: The end of bad is detected, which happens on white space or end of buffer.
- * - raw_begin: This is the beginning of a potential raw data (matched '0').
- * - raw_number: This is the confirmed beginning of raw data (matched 'X'), process numbers.
- * - raw_end: The end of raw data is detected, which happens on white space or end of buffer.
- */
-#ifndef _di_utf8_codepoint_modes_
- enum {
- utf8_codepoint_mode_ready_e = 1,
- utf8_codepoint_mode_begin_e,
- utf8_codepoint_mode_number_e,
- utf8_codepoint_mode_end_e,
- utf8_codepoint_mode_bad_e,
- utf8_codepoint_mode_bad_begin_e,
- utf8_codepoint_mode_bad_end_e,
- utf8_codepoint_mode_raw_begin_e,
- utf8_codepoint_mode_raw_number_e,
- utf8_codepoint_mode_raw_end_e,
- }; // enum
-#endif // _di__utf8_codepoint_modes_
-
-/**
- * The main program parameters.
- */
-#ifndef _di_utf8_parameter_e_
- enum {
- utf8_parameter_help_e,
- utf8_parameter_copyright_e,
- utf8_parameter_light_e,
- utf8_parameter_dark_e,
- utf8_parameter_no_color_e,
- utf8_parameter_verbosity_quiet_e,
- utf8_parameter_verbosity_error_e,
- utf8_parameter_verbosity_normal_e,
- utf8_parameter_verbosity_verbose_e,
- utf8_parameter_verbosity_debug_e,
- utf8_parameter_version_e,
- utf8_parameter_line_first_no_e,
- utf8_parameter_line_last_no_e,
-
- utf8_parameter_from_bytesequence_e,
- utf8_parameter_from_codepoint_e,
- utf8_parameter_from_file_e,
-
- utf8_parameter_headers_e,
- utf8_parameter_separate_e,
- utf8_parameter_strip_invalid_e,
-
- utf8_parameter_to_bytesequence_e,
- utf8_parameter_to_codepoint_e,
- utf8_parameter_to_combining_e,
- utf8_parameter_to_file_e,
- utf8_parameter_to_width_e,
-
- utf8_parameter_verify_e,
- }; // enum
-
- #define utf8_console_parameter_t_initialize \
- { \
- macro_f_console_parameter_t_initialize_3(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_3(f_console_standard_short_copyright_s, f_console_standard_long_copyright_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_3(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_3(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_3(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_3(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_3(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_3(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_3(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_3(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_3(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \
- \
- macro_f_console_parameter_t_initialize_3(utf8_short_from_bytesequence_s, utf8_long_from_bytesequence_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_3(utf8_short_from_codepoint_s, utf8_long_from_codepoint_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_3(utf8_short_from_file_s, utf8_long_from_file_s, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_3(utf8_short_headers_s, utf8_long_headers_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_3(utf8_short_separate_s, utf8_long_separate_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_3(utf8_short_strip_invalid_s, utf8_long_strip_invalid_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_3(utf8_short_to_bytesequence_s, utf8_long_to_bytesequence_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_3(utf8_short_to_codepoint_s, utf8_long_to_codepoint_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_3(utf8_short_to_combining_s, utf8_long_to_combining_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_3(utf8_short_to_file_s, utf8_long_to_file_s, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_3(utf8_short_to_width_s, utf8_long_to_width_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_3(utf8_short_verify_s, utf8_long_verify_s, 0, f_console_flag_normal_e), \
- }
-
- #define utf8_total_parameters_d 25
-#endif // _di_utf8_parameter_e_
-
-/**
* The utf8 main program settings.
*
* This is passed to the program-specific main entry point to designate program settings.
}
#endif // _di_utf8_setting_t_
+/**
+ * The main program data as a single structure.
+ *
+ * program: The main program data.
+ * setting: The settings data.
+ */
+#ifndef _di_utf8_main_t_
+ typedef struct {
+ fll_program_data_t program;
+ utf8_setting_t setting;
+ } utf8_main_t;
+
+ #define utf8_main_t_initialize \
+ { \
+ fll_program_data_t_initialize, \
+ utf8_setting_t_initialize, \
+ }
+#endif // _di_utf8_main_t_
+
#ifdef __cplusplus
} // extern "C"
#endif
int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
- fll_program_data_t data = fll_program_data_t_initialize;
- utf8_setting_t setting = utf8_setting_t_initialize;
+ utf8_main_t data = utf8_main_t_initialize;
+
+ data.program.debug.flag |= utf8_print_flag_debug_e;
+ data.program.error.flag |= utf8_print_flag_error_e;
+ data.program.message.flag |= utf8_print_flag_message_e;
+ data.program.warning.flag |= utf8_print_flag_warning_e;
+ data.program.message.custom = (void *) &data;
+ data.program.output.custom = (void *) &data;
+ data.program.error.custom = (void *) &data;
+ data.program.warning.custom = (void *) &data;
+ data.program.debug.custom = (void *) &data;
f_console_parameter_t parameters[] = utf8_console_parameter_t_initialize;
- data.parameters.array = parameters;
- data.parameters.used = utf8_total_parameters_d;
- data.environment = envp;
+ data.program.parameters.array = parameters;
+ data.program.parameters.used = utf8_total_parameters_d;
+ data.program.environment = envp;
if (f_pipe_input_exists()) {
- data.pipe = fll_program_data_pipe_input_e;
+ data.program.pipe = fll_program_data_pipe_input_e;
}
- fll_program_standard_set_up(&data);
+ fll_program_standard_set_up(&data.program);
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
- utf8_setting_load(arguments, &data, &setting);
+ utf8_setting_load(arguments, &data);
}
- utf8_main(&data, &setting);
+ utf8_main(&data);
- utf8_setting_unload(&data, &setting);
+ utf8_setting_unload(&data);
- fll_program_data_delete(&data);
+ fll_program_data_delete(&data.program);
- fll_program_standard_set_down(&data);
+ fll_program_standard_set_down(&data.program);
- return (F_status_is_error(setting.state.status) || setting.state.status == F_false) ? 1 : 0;
+ return (F_status_is_error(data.setting.state.status) || data.setting.state.status == F_false) ? 1 : 0;
}
+++ /dev/null
-#include "utf8.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef _di_utf8_print_help_
- f_status_t utf8_print_help(utf8_setting_t * const setting, const fl_print_t print) {
-
- if (!setting) return F_status_set_error(F_output_not);
-
- f_file_stream_lock(print.to);
-
- fll_program_print_help_header(print, utf8_program_name_long_s, utf8_program_version_s);
-
- fll_program_print_help_option_standard(print);
-
- f_print_dynamic_raw(f_string_eol_s, print.to);
-
- fll_program_print_help_option(print, utf8_short_from_bytesequence_s, utf8_long_from_bytesequence_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "The expected input format is byte sequence (character data).");
- fll_program_print_help_option(print, utf8_short_from_codepoint_s, utf8_long_from_codepoint_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " The expected input format is codepoint (such as U+0000).");
- fll_program_print_help_option(print, utf8_short_from_file_s, utf8_long_from_file_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Use the given output as the input source.");
-
- f_print_dynamic_raw(f_string_eol_s, print.to);
-
- fll_program_print_help_option(print, utf8_short_to_bytesequence_s, utf8_long_to_bytesequence_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "The output format is byte sequence (character data).");
- fll_program_print_help_option(print, utf8_short_to_codepoint_s, utf8_long_to_codepoint_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " The output format is codepoint (such as U+0000).");
- fll_program_print_help_option(print, utf8_short_to_combining_s, utf8_long_to_combining_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " The output format is to print whether or not character is combining or not.");
- fll_program_print_help_option(print, utf8_short_to_file_s, utf8_long_to_file_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Use the given file as the output destination.");
- fll_program_print_help_option(print, utf8_short_to_width_s, utf8_long_to_width_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " The output format is to print the width of a character (either 0, 1, or 2).");
-
- f_print_dynamic_raw(f_string_eol_s, print.to);
-
- fll_program_print_help_option(print, utf8_short_headers_s, utf8_long_headers_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Print headers for each section (pipe, file, or parameter).");
- fll_program_print_help_option(print, utf8_short_separate_s, utf8_long_separate_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Separate characters by newlines (implied when printing headers).");
- fll_program_print_help_option(print, utf8_short_strip_invalid_s, utf8_long_strip_invalid_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "Strip invalid Unicode characters (do not print invalid sequences).");
- fll_program_print_help_option(print, utf8_short_verify_s, utf8_long_verify_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Only perform verification of valid sequences.");
-
- f_print_dynamic_raw(f_string_eol_s, print.to);
- f_print_dynamic_raw(f_string_eol_s, print.to);
-
- fll_program_print_help_usage(print, utf8_program_name_s, utf8_program_help_parameters_s);
-
- fl_print_format("%r The default behavior is to assume the expected input is byte sequences from the command line to be output to the screen as codepoints.%r%r", print.to, f_string_eol_s, f_string_eol_s, f_string_eol_s);
-
- fl_print_format(" Multiple input sources are allowed but only a single output destination is allowed.%r%r", print.to, f_string_eol_s, f_string_eol_s);
-
- fl_print_format(" When using the parameter '%[%r%r%]', no data is printed and 0 is returned if valid or 1 is returned if invalid.%r%r", print.to, print.set->notable, f_console_symbol_long_normal_s, utf8_long_verify_s, print.set->notable, f_string_eol_s, f_string_eol_s);
-
- fl_print_format(" When using the parameter '%[%r%r%]' with the parameter ", print.to, print.set->notable, f_console_symbol_long_normal_s, utf8_long_to_combining_s, print.set->notable);
- fl_print_format("'%[%r%r%]', the ", print.to, print.set->notable, f_console_symbol_long_normal_s, utf8_long_to_width_s, print.set->notable);
- fl_print_format("'%[%r%]' character is printed to represent the combining and the digits are used to represent widths.%r", print.to, print.set->notable, utf8_string_combining_is_s, print.set->notable, f_string_eol_s);
- fl_print_format(" The combining characters should be considered 1-width by themselves or 0-width when combined.%r", print.to, f_string_eol_s);
-
- f_file_stream_flush(print.to);
- f_file_stream_unlock(print.to);
-
- return F_none;
- }
-#endif // _di_utf8_print_help_
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
#endif
#ifndef _di_utf8_print_data_bytesequence_
- f_status_t utf8_print_data_bytesequence(utf8_setting_t * const setting, const fl_print_t print, const f_string_static_t sequence) {
+ f_status_t utf8_print_data_bytesequence(fl_print_t * const print, const f_string_static_t sequence) {
- if (!setting) return F_status_set_error(F_output_not);
+ if (!print->custom) return F_status_set_error(F_output_not);
- fl_print_format("%r%r%r", print.to, setting->prepend, sequence, setting->append);
+ utf8_main_t * const main = (utf8_main_t *) print->custom;
+
+ fl_print_format("%r%r%r", print->to, main->setting.prepend, sequence, main->setting.append);
return F_none;
}
#endif // _di_utf8_print_data_bytesequence_
#ifndef _di_utf8_print_data_character_invalid_
- f_status_t utf8_print_data_character_invalid(utf8_setting_t * const setting, const fl_print_t print, const f_string_static_t invalid) {
+ f_status_t utf8_print_data_character_invalid(fl_print_t * const print, const f_string_static_t invalid) {
+
+ if (!print->custom) return F_status_set_error(F_output_not);
+
+ utf8_main_t * const main = (utf8_main_t *) print->custom;
- if (!setting) return F_status_set_error(F_output_not);
- if (setting->flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return F_output_not;
+ if (main->setting.flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return F_output_not;
if (!invalid.used) return F_output_not;
- if ((setting->mode & utf8_mode_to_combining_e) || (setting->mode & utf8_mode_to_width_e)) {
- utf8_print_data_combining_or_width(setting, print, invalid);
+ if ((main->setting.mode & utf8_mode_to_combining_e) || (main->setting.mode & utf8_mode_to_width_e)) {
+ utf8_print_data_combining_or_width(print, invalid);
}
- else if (setting->mode & utf8_mode_to_bytesequence_e) {
- fl_print_format("%r%[%r%]%r", print.to, setting->prepend, setting->valid_not, invalid, setting->valid_not, setting->append);
+ else if (main->setting.mode & utf8_mode_to_bytesequence_e) {
+ fl_print_format("%r%[%r%]%r", print->to, main->setting.prepend, main->setting.valid_not, invalid, main->setting.valid_not, main->setting.append);
}
- else if (setting->mode & utf8_mode_from_codepoint_e) {
- fl_print_format("%r%[%Q%]%r", print.to, setting->prepend, setting->valid_not, invalid, setting->valid_not, setting->append);
+ else if (main->setting.mode & utf8_mode_from_codepoint_e) {
+ fl_print_format("%r%[%Q%]%r", print->to, main->setting.prepend, main->setting.valid_not, invalid, main->setting.valid_not, main->setting.append);
}
else {
- fl_print_format("%r%[0x", print.to, setting->prepend, setting->valid_not);
+ fl_print_format("%r%[0x", print->to, main->setting.prepend, main->setting.valid_not);
for (uint8_t i = 0; i < invalid.used; ++i) {
- fl_print_format("%02_uii", print.to, (uint8_t) invalid.string[i]);
+ fl_print_format("%02_uii", print->to, (uint8_t) invalid.string[i]);
} // for
- fl_print_format("%]%r", print.to, setting->valid_not, setting->append);
+ fl_print_format("%]%r", print->to, main->setting.valid_not, main->setting.append);
}
return F_none;
#endif // _di_utf8_print_data_character_invalid_
#ifndef _di_utf8_print_data_codepoint_
- f_status_t utf8_print_data_codepoint(utf8_setting_t * const setting, const fl_print_t print, const uint32_t codepoint) {
+ f_status_t utf8_print_data_codepoint(fl_print_t * const print, const uint32_t codepoint) {
- if (!setting) return F_status_set_error(F_output_not);
+ if (!print->custom) return F_status_set_error(F_output_not);
+
+ utf8_main_t * const main = (utf8_main_t *) print->custom;
if (codepoint < 0x10000) {
- fl_print_format("%rU+%04_U%r", print.to, setting->prepend, codepoint, setting->append);
+ fl_print_format("%rU+%04_U%r", print->to, main->setting.prepend, codepoint, main->setting.append);
}
else if (codepoint < 0x100000) {
- fl_print_format("%rU+%05_U%r", print.to, setting->prepend, codepoint, setting->append);
+ fl_print_format("%rU+%05_U%r", print->to, main->setting.prepend, codepoint, main->setting.append);
}
else {
- fl_print_format("%rU+%06_U%r", print.to, setting->prepend, codepoint, setting->append);
+ fl_print_format("%rU+%06_U%r", print->to, main->setting.prepend, codepoint, main->setting.append);
}
return F_none;
#endif // _di_utf8_print_data_codepoint_
#ifndef _di_utf8_print_data_combining_or_width_
- f_status_t utf8_print_data_combining_or_width(utf8_setting_t * const setting, const fl_print_t print, const f_string_static_t sequence) {
+ f_status_t utf8_print_data_combining_or_width(fl_print_t * const print, const f_string_static_t sequence) {
+
+ if (!print->custom) return F_status_set_error(F_output_not);
- if (!setting) return F_status_set_error(F_output_not);
+ utf8_main_t * const main = (utf8_main_t *) print->custom;
- if (setting->mode & utf8_mode_to_combining_e) {
+ if (main->setting.mode & utf8_mode_to_combining_e) {
f_status_t status = f_utf_is_combining(sequence.string, sequence.used);
if (status == F_true) {
- fl_print_format("%r%r%r", print.to, setting->prepend, utf8_string_combining_is_s, setting->append);
+ fl_print_format("%r%r%r", print->to, main->setting.prepend, utf8_string_combining_is_s, main->setting.append);
}
else if (status == F_false) {
status = f_utf_is_private(sequence.string, sequence.used);
if (status == F_true) {
- fl_print_format("%r%r%r", print.to, setting->prepend, utf8_string_unknown_s, setting->append);
+ fl_print_format("%r%r%r", print->to, main->setting.prepend, utf8_string_unknown_s, main->setting.append);
}
- else if (setting->mode & utf8_mode_to_width_e) {
- utf8_print_data_width(setting, print, sequence);
+ else if (main->setting.mode & utf8_mode_to_width_e) {
+ utf8_print_data_width(print, sequence);
}
else {
- fl_print_format("%r%r%r", print.to, setting->prepend, utf8_string_combining_not_s, setting->append);
+ fl_print_format("%r%r%r", print->to, main->setting.prepend, utf8_string_combining_not_s, main->setting.append);
}
}
else {
- utf8_print_data_combining_or_width_invalid(setting, print);
+ utf8_print_data_combining_or_width_invalid(print);
}
}
- else if (setting->mode & utf8_mode_to_width_e) {
- utf8_print_data_width(setting, print, sequence);
+ else if (main->setting.mode & utf8_mode_to_width_e) {
+ utf8_print_data_width(print, sequence);
}
return F_none;
#endif // _di_utf8_print_data_combining_or_width_
#ifndef _di_utf8_print_data_combining_or_width_invalid_
- f_status_t utf8_print_data_combining_or_width_invalid(utf8_setting_t * const setting, const fl_print_t print) {
+ f_status_t utf8_print_data_combining_or_width_invalid(fl_print_t * const print) {
- if (!setting) return F_status_set_error(F_output_not);
- if (setting->flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return F_output_not;
+ if (!print->custom) return F_status_set_error(F_output_not);
- fl_print_format("%r%[%r%]%r", print.to, setting->prepend, setting->valid_not, utf8_string_unknown_s, setting->valid_not, setting->append);
+ utf8_main_t * const main = (utf8_main_t *) print->custom;
+
+ if (main->setting.flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return F_output_not;
+
+ fl_print_format("%r%[%r%]%r", print->to, main->setting.prepend, main->setting.valid_not, utf8_string_unknown_s, main->setting.valid_not, main->setting.append);
return F_none;
}
#endif // _di_utf8_print_data_combining_or_width_invalid_
#ifndef _di_utf8_print_data_raw_bytesequence_
- f_status_t utf8_print_data_raw_bytesequence(utf8_setting_t * const setting, const fl_print_t print, const f_utf_char_t raw, const uint8_t width) {
+ f_status_t utf8_print_data_raw_bytesequence(fl_print_t * const print, const f_utf_char_t raw, const uint8_t width) {
+
+ if (!print->custom) return F_status_set_error(F_output_not);
- if (!setting) return F_status_set_error(F_output_not);
- if (setting->flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return F_output_not;
+ utf8_main_t * const main = (utf8_main_t *) print->custom;
+
+ if (main->setting.flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return F_output_not;
f_string_static_t character = macro_f_string_static_t_initialize(0, 0, width);
memset(byte, 0, sizeof(f_char_t) * width);
}
- fl_print_format("%r%[%r%]%r", print.to, setting->prepend, setting->valid_not, character, setting->valid_not, setting->append);
+ fl_print_format("%r%[%r%]%r", print->to, main->setting.prepend, main->setting.valid_not, character, main->setting.valid_not, main->setting.append);
return F_none;
}
#endif // _di_utf8_print_data_raw_bytesequence_
#ifndef _di_utf8_print_data_raw_codepoint_
- f_status_t utf8_print_data_raw_codepoint(utf8_setting_t * const setting, const fl_print_t print, const f_string_static_t raw) {
+ f_status_t utf8_print_data_raw_codepoint(fl_print_t * const print, const f_string_static_t raw) {
+
+ if (!print->custom) return F_status_set_error(F_output_not);
- if (!setting) return F_status_set_error(F_output_not);
- if (setting->flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return F_output_not;
+ utf8_main_t * const main = (utf8_main_t *) print->custom;
- fl_print_format("%r%[%r%]%r", print.to, setting->prepend, setting->valid_not, raw, setting->valid_not, setting->append);
+ if (main->setting.flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return F_output_not;
+
+ fl_print_format("%r%[%r%]%r", print->to, main->setting.prepend, main->setting.valid_not, raw, main->setting.valid_not, main->setting.append);
return F_none;
}
#endif // _di_utf8_print_data_raw_codepoint_
#ifndef _di_utf8_print_data_raw_combining_or_width_
- f_status_t utf8_print_data_raw_combining_or_width(utf8_setting_t * const setting, const fl_print_t print, const uint8_t width) {
+ f_status_t utf8_print_data_raw_combining_or_width(fl_print_t * const print, const uint8_t width) {
+
+ if (!print->custom) return F_status_set_error(F_output_not);
+
+ utf8_main_t * const main = (utf8_main_t *) print->custom;
- if (!setting) return F_status_set_error(F_output_not);
- if (setting->flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return F_output_not;
+ if (main->setting.flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return F_output_not;
- if (setting->mode & utf8_mode_to_combining_e) {
- utf8_print_data_combining_or_width_invalid(setting, print);
+ if (main->setting.mode & utf8_mode_to_combining_e) {
+ utf8_print_data_combining_or_width_invalid(print);
}
- else if (setting->mode & utf8_mode_to_width_e) {
+ else if (main->setting.mode & utf8_mode_to_width_e) {
const f_string_static_t *character = 0;
switch (width) {
character = &utf8_string_width_0_s;
}
- fl_print_format("%r%[%r%]%r", print.to, setting->prepend, setting->valid_not, *character, setting->valid_not, setting->append);
+ fl_print_format("%r%[%r%]%r", print->to, main->setting.prepend, main->setting.valid_not, *character, main->setting.valid_not, main->setting.append);
}
return F_none;
#endif // _di_utf8_print_data_raw_combining_or_width_
#ifndef _di_utf8_print_data_section_header_file_
- f_status_t utf8_print_data_section_header_file(utf8_setting_t * const setting, const fl_print_t print, const f_string_static_t name, const f_array_length_t index) {
+ f_status_t utf8_print_data_section_header_file(fl_print_t * const print, const f_string_static_t name, const f_array_length_t index) {
+
+ if (!print->custom) return F_status_set_error(F_output_not);
+
+ utf8_main_t * const main = (utf8_main_t *) print->custom;
- if (!setting) return F_status_set_error(F_output_not);
- if (!(setting->flag & (utf8_main_flag_header_e | utf8_main_flag_separate_e))) return F_output_not;
- if (setting->flag & utf8_main_flag_verify_e) return F_output_not;
+ if (!(main->setting.flag & (utf8_main_flag_header_e | utf8_main_flag_separate_e))) return F_output_not;
+ if (main->setting.flag & utf8_main_flag_verify_e) return F_output_not;
- f_file_stream_lock(print.to);
+ f_file_stream_lock(print->to);
- if (setting->flag & utf8_main_flag_header_e) {
+ if (main->setting.flag & utf8_main_flag_header_e) {
if (index) {
- f_print_dynamic_raw(f_string_eol_s, print.to);
+ f_print_dynamic_raw(f_string_eol_s, print->to);
}
- fl_print_format("%[File%] ", print.to, print.set->title, print.set->title);
+ fl_print_format("%[File%] ", print->to, print->set->title, print->set->title);
- if (setting->flag & utf8_main_flag_file_to_e) {
- fl_print_format("%[%Q%]: %Q.%r", print.to, print.set->notable, name, print.set->notable, setting->path_files_to.array[0], f_string_eol_s);
+ if (main->setting.flag & utf8_main_flag_file_to_e) {
+ fl_print_format("%[%Q%]: %Q.%r", print->to, print->set->notable, name, print->set->notable, main->setting.path_files_to.array[0], f_string_eol_s);
}
else {
- fl_print_format("%[%Q%]:%r", print.to, print.set->notable, name, print.set->notable, f_string_eol_s);
+ fl_print_format("%[%Q%]:%r", print->to, print->set->notable, name, print->set->notable, f_string_eol_s);
}
}
- f_file_stream_unlock(print.to);
+ f_file_stream_unlock(print->to);
return F_none;
}
#endif // _di_utf8_print_data_section_header_file_
#ifndef _di_utf8_print_data_section_header_parameter_
- f_status_t utf8_print_data_section_header_parameter(utf8_setting_t * const setting, const fl_print_t print, const f_array_length_t index) {
+ f_status_t utf8_print_data_section_header_parameter(fl_print_t * const print, const f_array_length_t index) {
- if (!setting) return F_status_set_error(F_output_not);
- if (!(setting->flag & (utf8_main_flag_header_e | utf8_main_flag_separate_e))) return F_output_not;
- if (setting->flag & utf8_main_flag_verify_e) return F_output_not;
+ if (!print->custom) return F_status_set_error(F_output_not);
- f_file_stream_lock(print.to);
+ utf8_main_t * const main = (utf8_main_t *) print->custom;
- if (setting->flag & utf8_main_flag_header_e) {
- if ((setting->flag & (utf8_main_flag_pipe_e | utf8_main_flag_file_from_e)) || index) {
- f_print_dynamic_raw(f_string_eol_s, print.to);
+ if (!(main->setting.flag & (utf8_main_flag_header_e | utf8_main_flag_separate_e))) return F_output_not;
+ if (main->setting.flag & utf8_main_flag_verify_e) return F_output_not;
+
+ f_file_stream_lock(print->to);
+
+ if (main->setting.flag & utf8_main_flag_header_e) {
+ if ((main->setting.flag & (utf8_main_flag_pipe_e | utf8_main_flag_file_from_e)) || index) {
+ f_print_dynamic_raw(f_string_eol_s, print->to);
}
- fl_print_format("%[Parameter%] ", print.to, print.set->title, print.set->title);
- fl_print_format("%[%ul%]:%r", print.to, print.set->notable, index, print.set->notable, f_string_eol_s);
+ fl_print_format("%[Parameter%] ", print->to, print->set->title, print->set->title);
+ fl_print_format("%[%ul%]:%r", print->to, print->set->notable, index, print->set->notable, f_string_eol_s);
}
else {
- if ((setting->flag & (utf8_main_flag_pipe_e | utf8_main_flag_file_from_e)) || index) {
- f_print_dynamic_raw(f_string_eol_s, print.to);
+ if ((main->setting.flag & (utf8_main_flag_pipe_e | utf8_main_flag_file_from_e)) || index) {
+ f_print_dynamic_raw(f_string_eol_s, print->to);
}
}
- f_file_stream_unlock(print.to);
+ f_file_stream_unlock(print->to);
return F_none;
}
#endif // _di_utf8_print_data_section_header_parameter_
#ifndef _di_utf8_print_data_section_header_pipe_
- f_status_t utf8_print_data_section_header_pipe(utf8_setting_t * const setting, const fl_print_t print) {
+ f_status_t utf8_print_data_section_header_pipe(fl_print_t * const print) {
+
+ if (!print->custom) return F_status_set_error(F_output_not);
- if (!setting) return F_status_set_error(F_output_not);
- if (!(setting->flag & (utf8_main_flag_header_e | utf8_main_flag_separate_e))) return F_output_not;
- if (setting->flag & utf8_main_flag_verify_e) return F_output_not;
+ utf8_main_t * const main = (utf8_main_t *) print->custom;
- if (setting->flag & utf8_main_flag_header_e) {
- fll_print_format("%[Pipe%]:%r", print.to, print.set->title, print.set->title, f_string_eol_s);
+ if (!(main->setting.flag & (utf8_main_flag_header_e | utf8_main_flag_separate_e))) return F_output_not;
+ if (main->setting.flag & utf8_main_flag_verify_e) return F_output_not;
+
+ if (main->setting.flag & utf8_main_flag_header_e) {
+ fll_print_format("%[Pipe%]:%r", print->to, print->set->title, print->set->title, f_string_eol_s);
}
return F_none;
#endif // _di_utf8_print_data_section_header_pipe_
#ifndef _di_utf8_print_data_width_
- f_status_t utf8_print_data_width(utf8_setting_t * const setting, const fl_print_t print, const f_string_static_t sequence) {
+ f_status_t utf8_print_data_width(fl_print_t * const print, const f_string_static_t sequence) {
- if (!setting) return F_status_set_error(F_output_not);
- if (print.verbosity < f_console_verbosity_error_e) return F_output_not;
+ if (!print->custom) return F_status_set_error(F_output_not);
+ if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
f_status_t status = f_utf_is_wide(sequence.string, sequence.used);
+ utf8_main_t * const main = (utf8_main_t *) print->custom;
+
if (status == F_true) {
- fl_print_format("%r%r%r", print.to, setting->prepend, utf8_string_width_2_s, setting->append);
+ fl_print_format("%r%r%r", print->to, main->setting.prepend, utf8_string_width_2_s, main->setting.append);
return F_output_not;
}
status = f_utf_is_graph(sequence.string, sequence.used);
if (status == F_true) {
- fl_print_format("%r%r%r", print.to, setting->prepend, utf8_string_width_1_s, setting->append);
+ fl_print_format("%r%r%r", print->to, main->setting.prepend, utf8_string_width_1_s, main->setting.append);
return F_output_not;
}
if (status == F_false) {
- fl_print_format("%r%r%r", print.to, setting->prepend, utf8_string_width_0_s, setting->append);
+ fl_print_format("%r%r%r", print->to, main->setting.prepend, utf8_string_width_0_s, main->setting.append);
return F_output_not;
}
}
- utf8_print_data_combining_or_width_invalid(setting, print);
+ utf8_print_data_combining_or_width_invalid(print);
return F_none;
}
* F_output_not (with error bit) if setting is NULL.
*/
#ifndef _di_utf8_print_data_bytesequence_
- extern f_status_t utf8_print_data_bytesequence(utf8_setting_t * const setting, const fl_print_t print, const f_string_static_t sequence);
+ extern f_status_t utf8_print_data_bytesequence(fl_print_t * const print, const f_string_static_t sequence);
#endif // _di_utf8_print_data_bytesequence_
/**
* @see utf8_print_combining_or_width()
*/
#ifndef _di_utf8_print_data_character_invalid_
- extern f_status_t utf8_print_data_character_invalid(utf8_setting_t * const setting, const fl_print_t print, const f_string_static_t invalid);
+ extern f_status_t utf8_print_data_character_invalid(fl_print_t * const print, const f_string_static_t invalid);
#endif // _di_utf8_print_data_character_invalid_
/**
* F_output_not (with error bit) if setting is NULL.
*/
#ifndef _di_utf8_print_data_codepoint_
- extern f_status_t utf8_print_data_codepoint(utf8_setting_t * const setting, const fl_print_t print, const uint32_t codepoint);
+ extern f_status_t utf8_print_data_codepoint(fl_print_t * const print, const uint32_t codepoint);
#endif // _di_utf8_print_data_codepoint_
/**
* F_output_not (with error bit) if setting is NULL.
*/
#ifndef _di_utf8_print_data_combining_or_width_
- extern f_status_t utf8_print_data_combining_or_width(utf8_setting_t * const setting, const fl_print_t print, const f_string_static_t sequence);
+ extern f_status_t utf8_print_data_combining_or_width(fl_print_t * const print, const f_string_static_t sequence);
#endif // _di_utf8_print_data_combining_or_width_
/**
* F_output_not (with error bit) if setting is NULL.
*/
#ifndef _di_utf8_print_data_combining_or_width_invalid_
- extern f_status_t utf8_print_data_combining_or_width_invalid(utf8_setting_t * const setting, const fl_print_t print);
+ extern f_status_t utf8_print_data_combining_or_width_invalid(fl_print_t * const print);
#endif // _di_utf8_print_data_combining_or_width_invalid_
/**
* F_output_not (with error bit) if setting is NULL.
*/
#ifndef _di_utf8_print_data_raw_bytesequence_
- extern f_status_t utf8_print_data_raw_bytesequence(utf8_setting_t * const setting, const fl_print_t print, const f_utf_char_t raw, const uint8_t width);
+ extern f_status_t utf8_print_data_raw_bytesequence(fl_print_t * const print, const f_utf_char_t raw, const uint8_t width);
#endif // _di_utf8_print_data_raw_bytesequence_
/**
* F_output_not (with error bit) if setting is NULL.
*/
#ifndef _di_utf8_print_data_raw_codepoint_
- extern f_status_t utf8_print_data_raw_codepoint(utf8_setting_t * const setting, const fl_print_t print, const f_string_static_t raw);
+ extern f_status_t utf8_print_data_raw_codepoint(fl_print_t * const print, const f_string_static_t raw);
#endif // _di_utf8_print_data_raw_codepoint_
/**
* @see utf8_print_data_width()
*/
#ifndef _di_utf8_print_data_raw_combining_or_width_
- extern f_status_t utf8_print_data_raw_combining_or_width(utf8_setting_t * const setting, const fl_print_t print, const uint8_t width);
+ extern f_status_t utf8_print_data_raw_combining_or_width(fl_print_t * const print, const uint8_t width);
#endif // _di_utf8_print_data_raw_combining_or_width_
/**
* F_output_not (with error bit) if setting is NULL.
*/
#ifndef _di_utf8_print_data_section_header_file_
- extern f_status_t utf8_print_data_section_header_file(utf8_setting_t * const setting, const fl_print_t print, const f_string_static_t name, const f_array_length_t index);
+ extern f_status_t utf8_print_data_section_header_file(fl_print_t * const print, const f_string_static_t name, const f_array_length_t index);
#endif // _di_utf8_print_data_section_header_file_
/**
* F_output_not (with error bit) if setting is NULL.
*/
#ifndef _di_utf8_print_data_section_header_parameter_
- extern f_status_t utf8_print_data_section_header_parameter(utf8_setting_t * const setting, const fl_print_t print, const f_array_length_t index);
+ extern f_status_t utf8_print_data_section_header_parameter(fl_print_t * const print, const f_array_length_t index);
#endif // _di_utf8_print_data_section_header_parameter_
/**
* Print the input pipe section header.
*
- * @param setting
- * The main program settings.
- *
- * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
+ * 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 setting is NULL.
*/
#ifndef _di_utf8_print_data_section_header_pipe_
- extern f_status_t utf8_print_data_section_header_pipe(utf8_setting_t * const setting, const fl_print_t print);
+ extern f_status_t utf8_print_data_section_header_pipe(fl_print_t * const print);
#endif // _di_utf8_print_data_section_header_pipe_
/**
* Print the width of the given character.
*
- * @param setting
- * The main program settings.
- *
- * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
+ *
+ * This does not alter print.custom.setting.state.status.
* @param sequence
* A byte sequences representing a single character whose width is to be printed.
*
* F_output_not (with error bit) if setting is NULL.
*/
#ifndef _di_utf8_print_data_width_
- extern f_status_t utf8_print_data_width(utf8_setting_t * const setting, const fl_print_t print, const f_string_static_t sequence);
+ extern f_status_t utf8_print_data_width(fl_print_t * const print, const f_string_static_t sequence);
#endif // _di_utf8_print_data_width_
#ifdef __cplusplus
#endif
#ifndef _di_utf8_print_error_
- f_status_t utf8_print_error(utf8_setting_t * const setting, const fl_print_t print, const f_string_t function) {
+ f_status_t utf8_print_error(fl_print_t * const print, const f_string_t function) {
- if (!setting) return F_status_set_error(F_output_not);
- if (print.verbosity < f_console_verbosity_error_e) return F_output_not;
+ if (!print->custom) return F_status_set_error(F_output_not);
+ if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
- fll_error_print(print, F_status_set_fine(setting->state.status), function, fll_error_file_flag_fallback_e);
+ utf8_main_t * const main = (utf8_main_t *) print->custom;
+
+ fll_error_print(*print, F_status_set_fine(main->setting.state.status), function, fll_error_file_flag_fallback_e);
return F_none;
}
#endif // _di_utf8_print_error_
#ifndef _di_utf8_print_error_decode_
- f_status_t utf8_print_error_decode(utf8_setting_t * const setting, const fl_print_t print, const f_string_static_t invalid) {
+ f_status_t utf8_print_error_decode(fl_print_t * const print, const f_string_static_t invalid) {
+
+ if (!print->custom) return F_status_set_error(F_output_not);
+ if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
+
+ utf8_main_t * const main = (utf8_main_t *) print->custom;
- if (!setting) return F_status_set_error(F_output_not);
- if (print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (setting->flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return F_output_not;
+ if (main->setting.flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return F_output_not;
- fl_print_format("%r%[%QFailed to decode character code '%]", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error);
+ fl_print_format("%r%[%QFailed to decode character code '%]", print->to, f_string_eol_s, print->set->error, print->prefix, print->set->error);
if (invalid.used) {
- fl_print_format("%[0x", print.to, print.set->notable);
+ fl_print_format("%[0x", print->to, print->set->notable);
for (uint8_t i = 0; i < invalid.used; ++i) {
- fl_print_format("%02_uii", print.to, (uint8_t) invalid.string[i]);
+ fl_print_format("%02_uii", print->to, (uint8_t) invalid.string[i]);
} // for
- fl_print_format("%]", print.to, print.set->notable);
+ fl_print_format("%]", print->to, print->set->notable);
}
- if (F_status_set_fine(setting->state.status) == F_utf_not) {
- fl_print_format("%[', not a valid UTF-8 character sequence.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s);
+ if (F_status_set_fine(main->setting.state.status) == F_utf_not) {
+ fl_print_format("%[', not a valid UTF-8 character sequence.%]%r", print->to, print->set->error, print->set->error, f_string_eol_s);
}
- else if (F_status_set_fine(setting->state.status) == F_complete_not_utf) {
- fl_print_format("%[', invalid UTF-8 (truncated).%]%r", print.to, print.set->error, print.set->error, f_string_eol_s);
+ else if (F_status_set_fine(main->setting.state.status) == F_complete_not_utf) {
+ fl_print_format("%[', invalid UTF-8 (truncated).%]%r", print->to, print->set->error, print->set->error, f_string_eol_s);
}
- else if (F_status_set_fine(setting->state.status) == F_utf_fragment) {
- fl_print_format("%[', invalid UTF-8 fragment.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s);
+ else if (F_status_set_fine(main->setting.state.status) == F_utf_fragment) {
+ fl_print_format("%[', invalid UTF-8 fragment.%]%r", print->to, print->set->error, print->set->error, f_string_eol_s);
}
else {
- fl_print_format("%[', error status code%] ", print.to, print.set->error, print.set->error, f_string_eol_s);
- fl_print_format("%[%ui%]", print.to, print.set->notable, F_status_set_fine(setting->state.status), print.set->notable);
- fl_print_format("%[.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s);
+ fl_print_format("%[', error status code%] ", print->to, print->set->error, print->set->error, f_string_eol_s);
+ fl_print_format("%[%ui%]", print->to, print->set->notable, F_status_set_fine(main->setting.state.status), print->set->notable);
+ fl_print_format("%[.%]%r", print->to, print->set->error, print->set->error, f_string_eol_s);
}
return F_none;
#endif // _di_utf8_print_error_decode_
#ifndef _di_utf8_print_error_encode_
- f_status_t utf8_print_error_encode(utf8_setting_t * const setting, const fl_print_t print, const uint32_t codepoint) {
+ f_status_t utf8_print_error_encode(fl_print_t * const print, const uint32_t codepoint) {
- if (!setting) return F_status_set_error(F_output_not);
- if (print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (setting->flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return F_output_not;
+ if (!print->custom) return F_status_set_error(F_output_not);
+ if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
- fl_print_format("%r%[%QFailed to encode Unicode codepoint '%]", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error);
- fl_print_format("%[U+%_U%]", print.to, print.set->notable, codepoint, print.set->notable);
+ utf8_main_t * const main = (utf8_main_t *) print->custom;
- if (F_status_set_fine(setting->state.status) == F_utf_not) {
- fl_print_format("%[', not a valid Unicode codepoint.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s);
+ if (main->setting.flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return F_output_not;
+
+ fl_print_format("%r%[%QFailed to encode Unicode codepoint '%]", print->to, f_string_eol_s, print->set->error, print->prefix, print->set->error);
+ fl_print_format("%[U+%_U%]", print->to, print->set->notable, codepoint, print->set->notable);
+
+ if (F_status_set_fine(main->setting.state.status) == F_utf_not) {
+ fl_print_format("%[', not a valid Unicode codepoint.%]%r", print->to, print->set->error, print->set->error, f_string_eol_s);
}
else {
- fl_print_format("%[', error status code%] ", print.to, print.set->error, print.set->error, f_string_eol_s);
- fl_print_format("%[%ui%]", print.to, print.set->notable, F_status_set_fine(setting->state.status), print.set->notable);
- fl_print_format("%[.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s);
+ fl_print_format("%[', error status code%] ", print->to, print->set->error, print->set->error, f_string_eol_s);
+ fl_print_format("%[%ui%]", print->to, print->set->notable, F_status_set_fine(main->setting.state.status), print->set->notable);
+ fl_print_format("%[.%]%r", print->to, print->set->error, print->set->error, f_string_eol_s);
}
return F_none;
#endif // _di_utf8_print_error_encode_
#ifndef _di_utf8_print_error_file_
- f_status_t utf8_print_error_file(utf8_setting_t * const setting, const fl_print_t print, const f_string_t function, const f_string_static_t name, const f_string_static_t operation, const uint8_t type) {
+ f_status_t utf8_print_error_file(fl_print_t * const print, const f_string_t function, const f_string_static_t name, const f_string_static_t operation, const uint8_t type) {
+
+ if (!print->custom) return F_status_set_error(F_output_not);
+ if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
- if (!setting) return F_status_set_error(F_output_not);
- if (print.verbosity < f_console_verbosity_error_e) return F_output_not;
+ utf8_main_t * const main = (utf8_main_t *) print->custom;
- fll_error_file_print(print, F_status_set_fine(setting->state.status), function, fll_error_file_flag_fallback_e, name, operation, type);
+ fll_error_file_print(*print, F_status_set_fine(main->setting.state.status), function, fll_error_file_flag_fallback_e, name, operation, type);
return F_none;
}
#endif // _di_utf8_print_error_file_
#ifndef _di_utf8_print_error_no_from_
- f_status_t utf8_print_error_no_from(utf8_setting_t * const setting, const fl_print_t print) {
+ f_status_t utf8_print_error_no_from(fl_print_t * const print) {
- if (!setting) return F_status_set_error(F_output_not);
- if (print.verbosity < f_console_verbosity_error_e) return F_output_not;
+ if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
- fll_print_format("%r%[%QNo from sources are specified, please pipe data, designate a file, or add parameters.%]%r", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error, f_string_eol_s);
+ fll_print_format("%r%[%QNo from sources are specified, please pipe data, designate a file, or add parameters.%]%r", print->to, f_string_eol_s, print->set->error, print->prefix, print->set->error, f_string_eol_s);
return F_none;
}
#endif // _di_utf8_print_error_no_from_
#ifndef _di_utf8_print_error_parameter_file_name_empty_
- f_status_t utf8_print_error_parameter_file_name_empty(utf8_setting_t * const setting, const fl_print_t print, const f_array_length_t index) {
+ f_status_t utf8_print_error_parameter_file_name_empty(fl_print_t * const print, const f_array_length_t index) {
- if (!setting) return F_status_set_error(F_output_not);
- if (print.verbosity < f_console_verbosity_error_e) return F_output_not;
+ if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
- f_file_stream_lock(print.to);
+ f_file_stream_lock(print->to);
- fl_print_format("%[%QNo file specified at parameter index%] ", print.to, print.set->error, print.prefix, print.set->error);
- fl_print_format("%[%ul%]", print.to, print.set->notable, index, print.set->notable);
- fl_print_format("%[.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s);
+ fl_print_format("%[%QNo file specified at parameter index%] ", print->to, print->set->error, print->prefix, print->set->error);
+ fl_print_format("%[%ul%]", print->to, print->set->notable, index, print->set->notable);
+ fl_print_format("%[.%]%r", print->to, print->set->error, print->set->error, f_string_eol_s);
- f_file_stream_unlock(print.to);
+ f_file_stream_unlock(print->to);
return F_none;
}
#endif // _di_utf8_print_error_parameter_file_name_empty_
#ifndef _di_utf8_print_error_parameter_file_not_found_
- f_status_t utf8_print_error_parameter_file_not_found(utf8_setting_t * const setting, const fl_print_t print, const bool from, const f_string_static_t name) {
+ f_status_t utf8_print_error_parameter_file_not_found(fl_print_t * const print, const bool from, const f_string_static_t name) {
- if (!setting) return F_status_set_error(F_output_not);
- if (print.verbosity < f_console_verbosity_error_e) return F_output_not;
+ if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
- f_file_stream_lock(print.to);
+ f_file_stream_lock(print->to);
- fl_print_format("%[%QFailed to find the %r file '%]", print.to, print.set->error, print.prefix, from ? utf8_string_from_s : utf8_string_to_s, print.set->error);
- fl_print_format("%[%Q%]", print.to, print.set->notable, name, print.set->notable);
- fl_print_format("%['.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s);
+ fl_print_format("%[%QFailed to find the %r file '%]", print->to, print->set->error, print->prefix, from ? utf8_string_from_s : utf8_string_to_s, print->set->error);
+ fl_print_format("%[%Q%]", print->to, print->set->notable, name, print->set->notable);
+ fl_print_format("%['.%]%r", print->to, print->set->error, print->set->error, f_string_eol_s);
- f_file_stream_unlock(print.to);
+ f_file_stream_unlock(print->to);
return F_none;
}
#endif // _di_utf8_print_error_parameter_file_not_found_
#ifndef _di_utf8_print_error_parameter_file_to_too_many_
- f_status_t utf8_print_error_parameter_file_to_too_many(utf8_setting_t * const setting, const fl_print_t print) {
+ f_status_t utf8_print_error_parameter_file_to_too_many(fl_print_t * const print) {
- if (!setting) return F_status_set_error(F_output_not);
- if (print.verbosity < f_console_verbosity_error_e) return F_output_not;
+ if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
- fll_print_format("%[%QToo many '%r' files specified, there may only be one '%r' file.%]%r", print.to, print.set->error, print.prefix, utf8_string_to_s, utf8_string_to_s, print.set->error, f_string_eol_s);
+ fll_print_format("%[%QToo many '%r' files specified, there may only be one '%r' file.%]%r", print->to, print->set->error, print->prefix, utf8_string_to_s, utf8_string_to_s, print->set->error, f_string_eol_s);
return F_none;
}
* @param print
* Designates the how and where to print.
*
+ * This does not alter print.custom.setting.state.status.
+ *
* @return
* F_none on success.
* F_output_not on success, but no printing is performed.
* @see fll_error_print()
*/
#ifndef _di_utf8_print_error_
- extern f_status_t utf8_print_error(utf8_setting_t * const setting, const fl_print_t print, const f_string_t function);
+ extern f_status_t utf8_print_error(fl_print_t * const print, const f_string_t function);
#endif // _di_utf8_print_error_
/**
* @see fl_print_format()
*/
#ifndef _di_utf8_print_error_decode_
- extern f_status_t utf8_print_error_decode(utf8_setting_t * const setting, const fl_print_t print, const f_string_static_t invalid);
+ extern f_status_t utf8_print_error_decode(fl_print_t * const print, const f_string_static_t invalid);
#endif // _di_utf8_print_error_decode_
/**
* This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
+ *
+ * This does not alter print.custom.setting.state.status.
* @param codepoint
* The codepoint that is invalid.
*
* @see fl_print_format()
*/
#ifndef _di_utf8_print_error_encode_
- extern f_status_t utf8_print_error_encode(utf8_setting_t * const setting, const fl_print_t print, const uint32_t codepoint);
+ extern f_status_t utf8_print_error_encode(fl_print_t * const print, const uint32_t codepoint);
#endif // _di_utf8_print_error_encode_
/**
* This does not alter setting.state.status.
* @param print
* Designates how printing is to be performed.
+ *
+ * This does not alter print.custom.setting.state.status.
* @param function
* The name of the function where the error happened.
* Set to 0 to disable.
* @see fll_error_file_print()
*/
#ifndef _di_utf8_print_error_file_
- extern f_status_t utf8_print_error_file(utf8_setting_t * const setting, const fl_print_t print, const f_string_t function, const f_string_static_t name, const f_string_static_t operation, const uint8_t type);
+ extern f_status_t utf8_print_error_file(fl_print_t * const print, const f_string_t function, const f_string_static_t name, const f_string_static_t operation, const uint8_t type);
#endif // _di_utf8_print_error_file_
/**
* @param print
* Designates how printing is to be performed.
*
+ * This does not alter print.custom.setting.state.status.
+ *
* @return
* F_none on success.
* F_output_not on success, but no printing is performed.
* @see fll_error_file_print()
*/
#ifndef _di_utf8_print_error_no_from_
- extern f_status_t utf8_print_error_no_from(utf8_setting_t * const setting, const fl_print_t print);
+ extern f_status_t utf8_print_error_no_from(fl_print_t * const print);
#endif // _di_utf8_print_error_no_from_
/**
* This does not alter setting.state.status.
* @param print
* Designates how printing is to be performed.
+ *
+ * This does not alter print.custom.setting.state.status.
* @param index
* The index within the argv[] array where the empty string is found.
*
* @see fl_print_format()
*/
#ifndef _di_utf8_print_error_parameter_file_name_empty_
- extern f_status_t utf8_print_error_parameter_file_name_empty(utf8_setting_t * const setting, const fl_print_t print, const f_array_length_t index);
+ extern f_status_t utf8_print_error_parameter_file_name_empty(fl_print_t * const print, const f_array_length_t index);
#endif // _di_utf8_print_error_parameter_file_name_empty_
/**
* This does not alter setting.state.status.
* @param print
* Designates how printing is to be performed.
+ *
+ * This does not alter print.custom.setting.state.status.
* @param from
* If TRUE, then this is a from file (source file).
* If FALSE, then this is a to file (destination file).
* @see fl_print_format()
*/
#ifndef _di_utf8_print_error_parameter_file_not_found_
- extern f_status_t utf8_print_error_parameter_file_not_found(utf8_setting_t * const setting, const fl_print_t print, const bool from, const f_string_static_t name);
+ extern f_status_t utf8_print_error_parameter_file_not_found(fl_print_t * const print, const bool from, const f_string_static_t name);
#endif // _di_utf8_print_error_parameter_file_not_found_
/**
* @param print
* Designates how printing is to be performed.
*
+ * This does not alter print.custom.setting.state.status.
+ *
* @return
* F_none on success.
* F_output_not on success, but no printing is performed.
* @see fll_print_format()
*/
#ifndef _di_utf8_print_error_parameter_file_to_too_many_
- extern f_status_t utf8_print_error_parameter_file_to_too_many(utf8_setting_t * const setting, const fl_print_t print);
+ extern f_status_t utf8_print_error_parameter_file_to_too_many(fl_print_t * const print);
#endif // _di_utf8_print_error_parameter_file_to_too_many_
#ifdef __cplusplus
--- /dev/null
+#include "../utf8.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_utf8_print_message_help_
+ f_status_t utf8_print_message_help(fl_print_t * const print) {
+
+ f_file_stream_lock(print->to);
+
+ fll_program_print_help_header(*print, utf8_program_name_long_s, utf8_program_version_s);
+
+ fll_program_print_help_option_standard(*print);
+
+ f_print_dynamic_raw(f_string_eol_s, print->to);
+
+ fll_program_print_help_option(*print, utf8_short_from_bytesequence_s, utf8_long_from_bytesequence_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "The expected input format is byte sequence (character data).");
+ fll_program_print_help_option(*print, utf8_short_from_codepoint_s, utf8_long_from_codepoint_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " The expected input format is codepoint (such as U+0000).");
+ fll_program_print_help_option(*print, utf8_short_from_file_s, utf8_long_from_file_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Use the given output as the input source.");
+
+ f_print_dynamic_raw(f_string_eol_s, print->to);
+
+ fll_program_print_help_option(*print, utf8_short_to_bytesequence_s, utf8_long_to_bytesequence_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "The output format is byte sequence (character data).");
+ fll_program_print_help_option(*print, utf8_short_to_codepoint_s, utf8_long_to_codepoint_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " The output format is codepoint (such as U+0000).");
+ fll_program_print_help_option(*print, utf8_short_to_combining_s, utf8_long_to_combining_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " The output format is to print whether or not character is combining or not.");
+ fll_program_print_help_option(*print, utf8_short_to_file_s, utf8_long_to_file_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Use the given file as the output destination.");
+ fll_program_print_help_option(*print, utf8_short_to_width_s, utf8_long_to_width_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " The output format is to print the width of a character (either 0, 1, or 2).");
+
+ f_print_dynamic_raw(f_string_eol_s, print->to);
+
+ fll_program_print_help_option(*print, utf8_short_headers_s, utf8_long_headers_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Print headers for each section (pipe, file, or parameter).");
+ fll_program_print_help_option(*print, utf8_short_separate_s, utf8_long_separate_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Separate characters by newlines (implied when printing headers).");
+ fll_program_print_help_option(*print, utf8_short_strip_invalid_s, utf8_long_strip_invalid_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "Strip invalid Unicode characters (do not print invalid sequences).");
+ fll_program_print_help_option(*print, utf8_short_verify_s, utf8_long_verify_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Only perform verification of valid sequences.");
+
+ f_print_dynamic_raw(f_string_eol_s, print->to);
+ f_print_dynamic_raw(f_string_eol_s, print->to);
+
+ fll_program_print_help_usage(*print, utf8_program_name_s, utf8_program_help_parameters_s);
+
+ fl_print_format("%r The default behavior is to assume the expected input is byte sequences from the command line to be output to the screen as codepoints.%r%r", print->to, f_string_eol_s, f_string_eol_s, f_string_eol_s);
+
+ fl_print_format(" Multiple input sources are allowed but only a single output destination is allowed.%r%r", print->to, f_string_eol_s, f_string_eol_s);
+
+ fl_print_format(" When using the parameter '%[%r%r%]', no data is printed and 0 is returned if valid or 1 is returned if invalid.%r%r", print->to, print->set->notable, f_console_symbol_long_normal_s, utf8_long_verify_s, print->set->notable, f_string_eol_s, f_string_eol_s);
+
+ fl_print_format(" When using the parameter '%[%r%r%]' with the parameter ", print->to, print->set->notable, f_console_symbol_long_normal_s, utf8_long_to_combining_s, print->set->notable);
+ fl_print_format("'%[%r%r%]', the ", print->to, print->set->notable, f_console_symbol_long_normal_s, utf8_long_to_width_s, print->set->notable);
+ fl_print_format("'%[%r%]' character is printed to represent the combining and the digits are used to represent widths.%r", print->to, print->set->notable, utf8_string_combining_is_s, print->set->notable, f_string_eol_s);
+ fl_print_format(" The combining characters should be considered 1-width by themselves or 0-width when combined.%r", print->to, f_string_eol_s);
+
+ f_file_stream_flush(print->to);
+ f_file_stream_unlock(print->to);
+
+ return F_none;
+ }
+#endif // _di_utf8_print_message_help_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
*
* This is auto-included and should not need to be explicitly included.
*/
-#ifndef _utf8_print_h
-#define _utf8_print_h
+#ifndef _utf8_print_message_h
+#define _utf8_print_message_h
#ifdef __cplusplus
extern "C" {
/**
* Print help.
*
- * @param setting
- * The main program settings.
- *
- * This does not alter setting.state.status.
* @param print
* The output structure to print to.
*
+ * This does not alter print.custom.setting.state.status.
+ *
* @return
* F_none on success.
* F_output_not on success, but no printing is performed.
* @see fll_program_print_help_option_standard()
* @see fll_program_print_help_usage()
*/
-#ifndef _di_utf8_print_help_
- extern f_status_t utf8_print_help(utf8_setting_t * const setting, const fl_print_t print);
-#endif // _di_utf8_print_help_
+#ifndef _di_utf8_print_message_help_
+ extern f_status_t utf8_print_message_help(fl_print_t * const print);
+#endif // _di_utf8_print_message_help_
#ifdef __cplusplus
} // extern "C"
#endif
-#endif // _utf8_print_h
+#endif // _utf8_print_message_h
#endif
#ifndef _di_utf8_process_text_
- void utf8_process_text(fll_program_data_t * const main, utf8_setting_t * const setting, f_string_static_t text) {
+ void utf8_process_text(utf8_main_t * const main, f_string_static_t text) {
- if (!main || !setting) return;
+ if (!main) return;
if (!text.used) {
- setting->state.status = F_true;
+ main->setting.state.status = F_true;
return;
}
- setting->state.status = F_none;
+ main->setting.state.status = F_none;
bool valid = F_true;
uint8_t mode_codepoint = utf8_codepoint_mode_ready_e;
utf8_process_text_width(&text);
- f_file_stream_lock(main->output.to);
+ f_file_stream_lock(main->program.output.to);
- for (; text.string[0] && F_status_is_error_not(setting->state.status); ) {
+ for (; text.string[0] && F_status_is_error_not(main->setting.state.status); ) {
- if (!((++main->signal_check) % utf8_signal_check_d)) {
- if (fll_program_standard_signal_received(main)) {
- fll_program_print_signal_received(main->warning, main->signal_received);
+ if (!((++main->program.signal_check) % utf8_signal_check_d)) {
+ if (fll_program_standard_signal_received(&main->program)) {
+ fll_program_print_signal_received(main->program.warning, main->program.signal_received);
- setting->state.status = F_status_set_error(F_interrupt);
+ main->setting.state.status = F_status_set_error(F_interrupt);
break;
}
- main->signal_check = 0;
+ main->program.signal_check = 0;
}
- setting->state.status = F_none;
+ main->setting.state.status = F_none;
- if (setting->mode & utf8_mode_from_bytesequence_e) {
- utf8_convert_bytesequence(main, setting, text);
+ if (main->setting.mode & utf8_mode_from_bytesequence_e) {
+ utf8_convert_bytesequence(main, text);
}
else {
- utf8_detect_codepoint(main, setting, text, &mode_codepoint);
+ utf8_detect_codepoint(main, text, &mode_codepoint);
- if (F_status_is_error(setting->state.status)) {
- fll_error_print(main->error, F_status_set_fine(setting->state.status), macro_utf8_f(utf8_detect_codepoint), fll_error_file_flag_fallback_e);
+ if (F_status_is_error(main->setting.state.status)) {
+ fll_error_print(main->program.error, F_status_set_fine(main->setting.state.status), macro_utf8_f(utf8_detect_codepoint), fll_error_file_flag_fallback_e);
break;
}
- if (F_status_is_error_not(setting->state.status) && setting->state.status != F_next) {
- utf8_convert_codepoint(main, setting, text, &mode_codepoint);
+ if (F_status_is_error_not(main->setting.state.status) && main->setting.state.status != F_next) {
+ utf8_convert_codepoint(main, text, &mode_codepoint);
}
}
- if (setting->state.status == F_utf_not) {
+ if (main->setting.state.status == F_utf_not) {
valid = F_false;
}
utf8_process_text_width(&text);
} // for
- if (F_status_is_error_not(setting->state.status) && !(setting->mode & utf8_mode_from_bytesequence_e)) {
+ if (F_status_is_error_not(main->setting.state.status) && !(main->setting.mode & utf8_mode_from_bytesequence_e)) {
if (mode_codepoint != utf8_codepoint_mode_ready_e && mode_codepoint != utf8_codepoint_mode_end_e && mode_codepoint != utf8_codepoint_mode_bad_end_e && mode_codepoint != utf8_codepoint_mode_raw_end_e) {
if (mode_codepoint == utf8_codepoint_mode_number_e) {
mode_codepoint = utf8_codepoint_mode_end_e;
text.used = 0;
if (mode_codepoint == utf8_codepoint_mode_raw_number_e) {
- utf8_convert_raw(main, setting, text, &mode_codepoint);
+ utf8_convert_raw(main, text, &mode_codepoint);
}
else {
- utf8_convert_codepoint(main, setting, text, &mode_codepoint);
+ utf8_convert_codepoint(main, text, &mode_codepoint);
}
}
}
- f_file_stream_unlock(main->output.to);
+ f_file_stream_unlock(main->program.output.to);
- if (F_status_is_error_not(setting->state.status)) {
- setting->state.status = valid;
+ if (F_status_is_error_not(main->setting.state.status)) {
+ main->setting.state.status = valid;
}
}
#endif // _di_utf8_process_text_
* Convert the text from one format to other another format or verify text.
*
* @param main
- * The main program data.
- * @param setting
- * The main program settings.
- * @param text
- * This represent a single text data.
- * This text is NULL terminated and can therefore not contain any NULLs.
+ * The main program and settings data.
*
* This alters setting.state.status:
* F_true on success and is valid.
* Errors (with error bit) from: utf8_convert_bytesequence()
* Errors (with error bit) from: utf8_convert_codepoint()
* Errors (with error bit) from: utf8_detect_codepoint()
+ * @param text
+ * This represent a single text data.
+ * This text is NULL terminated and can therefore not contain any NULLs.
*
* @see utf8_convert_bytesequence()
* @see utf8_convert_codepoint()
* @see utf8_signal_received()
*/
#ifndef _di_utf8_process_text_
- extern void utf8_process_text(fll_program_data_t * const main, utf8_setting_t * const setting, f_string_static_t text) F_attribute_visibility_internal_d;
+ extern void utf8_process_text(utf8_main_t * const main, f_string_static_t text) F_attribute_visibility_internal_d;
#endif // _di_utf8_process_text_
/**
#endif
#ifndef _di_utf8_main_
- void utf8_main(fll_program_data_t * const main, utf8_setting_t * const setting) {
+ void utf8_main(utf8_main_t * const main) {
- if (!main || !setting) return;
+ if (!main) return;
- if (F_status_is_error(setting->state.status)) {
- if ((setting->flag & utf8_main_flag_print_last_e) && main->message.verbosity > f_console_verbosity_error_e) {
- fll_print_dynamic_raw(f_string_eol_s, main->message.to);
+ if (F_status_is_error(main->setting.state.status)) {
+ if ((main->setting.flag & utf8_main_flag_print_last_e) && main->program.message.verbosity > f_console_verbosity_error_e) {
+ fll_print_dynamic_raw(f_string_eol_s, main->program.message.to);
}
return;
}
- if ((setting->flag & utf8_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) {
- fll_print_dynamic_raw(f_string_eol_s, main->message.to);
+ if ((main->setting.flag & utf8_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);
}
- setting->state.status = F_none;
+ main->setting.state.status = F_none;
- if (setting->flag & utf8_main_flag_help_e) {
- utf8_print_help(setting, main->message);
+ if (main->setting.flag & utf8_main_flag_help_e) {
+ utf8_print_message_help(&main->program.message);
return;
}
- if (setting->flag & utf8_main_flag_version_e) {
- fll_program_print_version(main->message, utf8_program_version_s);
+ if (main->setting.flag & utf8_main_flag_version_e) {
+ fll_program_print_version(main->program.message, utf8_program_version_s);
- if ((setting->flag & utf8_main_flag_print_last_e) && main->message.verbosity > f_console_verbosity_error_e) {
- fll_print_dynamic_raw(f_string_eol_s, main->message.to);
+ if ((main->setting.flag & utf8_main_flag_print_last_e) && main->program.message.verbosity > f_console_verbosity_error_e) {
+ fll_print_dynamic_raw(f_string_eol_s, main->program.message.to);
}
return;
}
- if (setting->flag & utf8_main_flag_copyright_e) {
- fll_program_print_copyright(main->message);
+ if (main->setting.flag & utf8_main_flag_copyright_e) {
+ fll_program_print_copyright(main->program.message);
- if ((setting->flag & utf8_main_flag_print_last_e) && main->message.verbosity > f_console_verbosity_error_e) {
- fll_print_dynamic_raw(f_string_eol_s, main->message.to);
+ if ((main->setting.flag & utf8_main_flag_print_last_e) && main->program.message.verbosity > f_console_verbosity_error_e) {
+ fll_print_dynamic_raw(f_string_eol_s, main->program.message.to);
}
return;
f_status_t valid = F_true;
- if (main->pipe & fll_program_data_pipe_input_e) {
+ if (main->program.pipe & fll_program_data_pipe_input_e) {
const f_file_t file = macro_f_file_t_initialize(F_type_input_d, F_type_descriptor_input_d, F_file_flag_read_only_d, 32768, F_file_default_write_size_d);
- utf8_print_data_section_header_pipe(setting, main->output);
+ utf8_print_data_section_header_pipe(&main->program.output);
- if (setting->mode & utf8_mode_from_bytesequence_e) {
- utf8_process_file_bytesequence(main, setting, file);
+ if (main->setting.mode & utf8_mode_from_bytesequence_e) {
+ utf8_process_file_bytesequence(main, file);
}
else {
- utf8_process_file_codepoint(main, setting, file);
+ utf8_process_file_codepoint(main, file);
}
- if (F_status_is_error_not(setting->state.status)) {
- if (setting->mode & utf8_mode_to_bytesequence_e) {
- if (setting->flag & utf8_main_flag_header_e) {
- fll_print_dynamic_raw(f_string_eol_s, main->output.to);
+ if (F_status_is_error_not(main->setting.state.status)) {
+ if (main->setting.mode & utf8_mode_to_bytesequence_e) {
+ if (main->setting.flag & utf8_main_flag_header_e) {
+ fll_print_dynamic_raw(f_string_eol_s, main->program.output.to);
}
- else if ((setting->flag & (utf8_main_flag_separate_e | utf8_main_flag_file_from_e)) || setting->remaining.used) {
- fll_print_dynamic_raw(f_string_eol_s, main->output.to);
+ else if ((main->setting.flag & (utf8_main_flag_separate_e | utf8_main_flag_file_from_e)) || main->setting.remaining.used) {
+ fll_print_dynamic_raw(f_string_eol_s, main->program.output.to);
}
}
}
- if (F_status_is_error(setting->state.status) && F_status_set_fine(setting->state.status) != F_utf_fragment && F_status_set_fine(setting->state.status) != F_complete_not_utf) {
- utf8_print_error_file(setting, main->error, setting->mode & utf8_mode_from_bytesequence_e ? macro_utf8_f(utf8_process_file_bytesequence) : macro_utf8_f(utf8_process_file_codepoint), f_string_empty_s, f_file_operation_process_s, fll_error_file_type_pipe_e);
+ if (F_status_is_error(main->setting.state.status) && F_status_set_fine(main->setting.state.status) != F_utf_fragment && F_status_set_fine(main->setting.state.status) != F_complete_not_utf) {
+ utf8_print_error_file(&main->program.error, main->setting.mode & utf8_mode_from_bytesequence_e ? macro_utf8_f(utf8_process_file_bytesequence) : macro_utf8_f(utf8_process_file_codepoint), f_string_empty_s, f_file_operation_process_s, fll_error_file_type_pipe_e);
}
}
// Process "from" files.
- if (F_status_is_error_not(setting->state.status) && (setting->flag & utf8_main_flag_file_from_e)) {
+ if (F_status_is_error_not(main->setting.state.status) && (main->setting.flag & utf8_main_flag_file_from_e)) {
f_file_t file = macro_f_file_t_initialize(0, -1, F_file_flag_read_only_d, 32768, F_file_default_write_size_d);
- for (f_array_length_t i = 0; i < setting->path_files_from.used && F_status_is_error_not(setting->state.status); ++i) {
+ for (f_array_length_t i = 0; i < main->setting.path_files_from.used && F_status_is_error_not(main->setting.state.status); ++i) {
- if (!((++main->signal_check) % utf8_signal_check_d)) {
- if (fll_program_standard_signal_received(main)) {
- setting->state.status = F_status_set_error(F_interrupt);
+ if (!((++main->program.signal_check) % utf8_signal_check_d)) {
+ if (fll_program_standard_signal_received(&main->program)) {
+ main->setting.state.status = F_status_set_error(F_interrupt);
break;
}
- main->signal_check = 0;
+ main->program.signal_check = 0;
}
- utf8_print_data_section_header_file(setting, main->output, setting->path_files_from.array[i], i);
+ utf8_print_data_section_header_file(&main->program.output, main->setting.path_files_from.array[i], i);
- setting->state.status = f_file_stream_open(setting->path_files_from.array[i], f_string_empty_s, &file);
+ main->setting.state.status = f_file_stream_open(main->setting.path_files_from.array[i], f_string_empty_s, &file);
- if (F_status_is_error(setting->state.status)) {
- utf8_print_error_file(setting, main->error, macro_utf8_f(f_file_stream_open), setting->path_files_from.array[i], f_file_operation_open_s, fll_error_file_type_file_e);
+ if (F_status_is_error(main->setting.state.status)) {
+ utf8_print_error_file(&main->program.error, macro_utf8_f(f_file_stream_open), main->setting.path_files_from.array[i], f_file_operation_open_s, fll_error_file_type_file_e);
break;
}
- if (setting->mode & utf8_mode_from_bytesequence_e) {
- utf8_process_file_bytesequence(main, setting, file);
+ if (main->setting.mode & utf8_mode_from_bytesequence_e) {
+ utf8_process_file_bytesequence(main, file);
}
else {
- utf8_process_file_codepoint(main, setting, file);
+ utf8_process_file_codepoint(main, file);
}
f_file_stream_flush(file);
f_file_stream_close(&file);
- if (setting->flag & utf8_main_flag_verify_e) {
- if (setting->state.status == F_false) {
+ if (main->setting.flag & utf8_main_flag_verify_e) {
+ if (main->setting.state.status == F_false) {
valid = F_false;
}
}
- if (F_status_is_error_not(setting->state.status)) {
- if (setting->mode & utf8_mode_to_bytesequence_e) {
- if (setting->flag & utf8_main_flag_header_e) {
- fll_print_dynamic_raw(f_string_eol_s, main->output.to);
+ if (F_status_is_error_not(main->setting.state.status)) {
+ if (main->setting.mode & utf8_mode_to_bytesequence_e) {
+ if (main->setting.flag & utf8_main_flag_header_e) {
+ fll_print_dynamic_raw(f_string_eol_s, main->program.output.to);
}
- else if ((setting->flag & utf8_main_flag_separate_e) && (setting->remaining.used || setting->path_files_from.used)) {
- fll_print_dynamic_raw(f_string_eol_s, main->output.to);
+ else if ((main->setting.flag & utf8_main_flag_separate_e) && (main->setting.remaining.used || main->setting.path_files_from.used)) {
+ fll_print_dynamic_raw(f_string_eol_s, main->program.output.to);
}
}
else {
- if (!(setting->flag & (utf8_main_flag_file_to_e | utf8_main_flag_header_e | utf8_main_flag_verify_e | utf8_main_flag_separate_e))) {
- fll_print_dynamic_raw(f_string_eol_s, main->output.to);
+ if (!(main->setting.flag & (utf8_main_flag_file_to_e | utf8_main_flag_header_e | utf8_main_flag_verify_e | utf8_main_flag_separate_e))) {
+ fll_print_dynamic_raw(f_string_eol_s, main->program.output.to);
}
}
}
- if (F_status_is_error(setting->state.status) && F_status_set_fine(setting->state.status) != F_utf_fragment && F_status_set_fine(setting->state.status) != F_complete_not_utf) {
+ if (F_status_is_error(main->setting.state.status) && F_status_set_fine(main->setting.state.status) != F_utf_fragment && F_status_set_fine(main->setting.state.status) != F_complete_not_utf) {
utf8_print_error_file(
- setting,
- main->error,
- (setting->mode & utf8_mode_from_bytesequence_e)
+ &main->program.error,
+ (main->setting.mode & utf8_mode_from_bytesequence_e)
? macro_utf8_f(utf8_process_file_bytesequence)
: macro_utf8_f(utf8_process_file_codepoint),
- setting->path_files_from.array[i],
+ main->setting.path_files_from.array[i],
f_file_operation_process_s,
fll_error_file_type_file_e
);
}
// Process remaining parameters.
- if (F_status_is_error_not(setting->state.status) && setting->remaining.used) {
- for (f_array_length_t i = 0; F_status_is_error_not(setting->state.status) && i < setting->remaining.used; ++i) {
+ if (F_status_is_error_not(main->setting.state.status) && main->setting.remaining.used) {
+ for (f_array_length_t i = 0; F_status_is_error_not(main->setting.state.status) && i < main->setting.remaining.used; ++i) {
- if (!((++main->signal_check) % utf8_signal_check_d)) {
- if (fll_program_standard_signal_received(main)) {
- setting->state.status = F_status_set_error(F_interrupt);
+ if (!((++main->program.signal_check) % utf8_signal_check_d)) {
+ if (fll_program_standard_signal_received(&main->program)) {
+ main->setting.state.status = F_status_set_error(F_interrupt);
break;
}
- main->signal_check = 0;
+ main->program.signal_check = 0;
}
- utf8_print_data_section_header_parameter(setting, main->output, i);
+ utf8_print_data_section_header_parameter(&main->program.output, i);
- utf8_process_text(main, setting, main->parameters.arguments.array[main->parameters.remaining.array[i]]);
+ utf8_process_text(main, main->program.parameters.arguments.array[main->program.parameters.remaining.array[i]]);
- if (setting->flag & utf8_main_flag_verify_e) {
- if (setting->state.status == F_false) {
+ if (main->setting.flag & utf8_main_flag_verify_e) {
+ if (main->setting.state.status == F_false) {
valid = F_false;
}
}
} // for
}
- if ((setting->flag & utf8_main_flag_print_last_e) && main->message.verbosity > f_console_verbosity_error_e) {
- fll_print_dynamic_raw(f_string_eol_s, main->message.to);
+ if ((main->setting.flag & utf8_main_flag_print_last_e) && main->program.message.verbosity > f_console_verbosity_error_e) {
+ fll_print_dynamic_raw(f_string_eol_s, main->program.message.to);
// The last line for data is not printed under certain circumstances, but when last line is printed to screen, print an extra last line.
- if (F_status_is_error_not(setting->state.status) && F_status_set_fine(setting->state.status) != F_interrupt) {
- if (!(setting->flag & (utf8_main_flag_file_to_e | utf8_main_flag_header_e | utf8_main_flag_separate_e))) {
- fll_print_dynamic_raw(f_string_eol_s, main->message.to);
+ if (F_status_is_error_not(main->setting.state.status) && F_status_set_fine(main->setting.state.status) != F_interrupt) {
+ if (!(main->setting.flag & (utf8_main_flag_file_to_e | utf8_main_flag_header_e | utf8_main_flag_separate_e))) {
+ fll_print_dynamic_raw(f_string_eol_s, main->program.message.to);
}
}
}
- if (F_status_set_fine(setting->state.status) == F_interrupt) return;
- if (F_status_is_error(setting->state.status)) return;
+ if (F_status_set_fine(main->setting.state.status) == F_interrupt) return;
+ if (F_status_is_error(main->setting.state.status)) return;
- if (setting->flag & utf8_main_flag_verify_e) {
- setting->state.status = valid;
+ if (main->setting.flag & utf8_main_flag_verify_e) {
+ main->setting.state.status = valid;
}
else {
- setting->state.status = F_none;
+ main->setting.state.status = F_none;
}
}
#endif // _di_utf8_main_
#include <fll/level_2/program.h>
// UTF-8 includes.
+#include <program/utf8/main/common/define.h>
+#include <program/utf8/main/common/enumeration.h>
#include <program/utf8/main/common/print.h>
#include <program/utf8/main/common/string.h>
#include <program/utf8/main/common/type.h>
#include <program/utf8/main/common.h>
#include <program/utf8/main/bytesequence.h>
#include <program/utf8/main/codepoint.h>
-#include <program/utf8/main/print.h>
#include <program/utf8/main/print/data.h>
#include <program/utf8/main/print/error.h>
+#include <program/utf8/main/print/message.h>
#include <program/utf8/main/process.h>
#ifdef __cplusplus
* - F_signal_termination
*
* @param main
- * The main program data.
- * @param setting
- * The main program settings.
+ * The main program data and settings.
*
- * This alters setting.state.status:
+ * This alters main.setting.state.status:
* F_none on success.
* F_true on success when performing verification and verify passed.
* F_false on success when performing verification and verify failed.
* F_parameter (with error bit) if main is NULL or setting is NULL.
*/
#ifndef _di_utf8_main_
- extern void utf8_main(fll_program_data_t * const main, utf8_setting_t * const setting);
+ extern void utf8_main(utf8_main_t * const main);
#endif // _di_utf8_main_
#ifdef __cplusplus
build_libraries-level -lfll_2 -lfll_1 -lfll_0
build_libraries-monolithic -lfll
-build_sources_library main/common.c main/common/print.c main/common/string.c main/common/type.c main/bytesequence.c main/codepoint.c main/print.c main/print/error.c main/print/data.c main/process.c main/utf8.c
+build_sources_library main/common.c main/common/define.c main/common/enumeration.c main/common/print.c main/common/string.c main/common/type.c main/bytesequence.c main/codepoint.c main/print/data.c main/print/error.c main/print/message.c main/process.c main/utf8.c
build_sources_program main/main.c
-build_sources_headers main/common.h main/common/print.h main/common/string.h main/common/type.h main/bytesequence.h main/codepoint.h main/print.h main/print/error.h main/print/data.h main/process.h main/utf8.h
+build_sources_headers main/common.h main/common/define.h main/common/enumeration.h main/common/print.h main/common/string.h main/common/type.h main/bytesequence.h main/codepoint.h main/print.h main/print/data.h main/print/error.h main/print/message.h main/process.h main/utf8.h
build_sources_documentation man