There has been a lot of interruptions with this particular pass.
Additional review is recommended.
I specifically need to review the iki_read for all of the parameters and make sure that there are no regressions.
Simplify the code, replacing f_iki_content_t, f_iki_delimits_t, and similar with direct types such as f_string_ranges_t and f_array_lengths_t.
This reduces some of the flexibility but increases the maintainability.
Make some of the print error functions accepts the symbols for both the first and second parameters.
Add additional error print functions.
Fix problem with --help printing.
Comment consistency improvements.
The iki_read program is updated to follow the design changes regarding programs.
Clarify certain aspects of the IKI specification.
* Historically, a "-" is used as a parameter.
* To be consistent with the historical use, "-" is referred to as "enable" and "+" is referred to as disable (which is the opposite of the usual mathematical interpetation of those symbols).
*
+ * @todo consider renaming "-" and "--" from "enable" to "normal" and "+" and "++" from "disable" to "inverse".
+ *
* f_console_*:
* - none: A basic parameter without any prefixes attached.
* - short_enable: An "enable" short parameter: "-".
#endif // _di_f_iki_vocabulary_0002_
/**
- * Designate an iki delimit location.
- */
-#ifndef _di_f_iki_delimit_t_
- typedef f_array_length_t f_iki_delimit_t;
-
- #define f_iki_delimit_t_initialize f_array_length_t_initialize
-
- #define macro_f_iki_delimits_t_initialize(array, size, used) macro_f_array_lengths_t_initialize(array, size, used)
-#endif // _di_f_iki_delimit_t_
-
-/**
- * An array of f_iki_delimit_t.
- *
- * array: The array of iki quote.
- * size: Total amount of allocated space.
- * used: Total number of allocated spaces used.
- */
-#ifndef _di_f_iki_delimits_t_
- typedef f_array_lengths_t f_iki_delimits_t;
-
- #define f_iki_delimits_t_initialize f_array_lengths_t_initialize
-
- #define macro_f_iki_delimits_t_initialize(array, size, used) macro_f_array_lengths_t_initialize(array, size, used)
- #define macro_f_iki_delimits_t_initialize2(array, length) macro_f_array_lengths_t_initialize2(array, length)
-
- #define macro_f_iki_delimits_t_clear(delimits) macro_f_array_lengths_t_clear(delimits)
-
- #define macro_f_iki_delimits_t_resize(status, delimits, length) macro_f_array_lengths_t_resize(status, delimits, length)
- #define macro_f_iki_delimits_t_adjust(status, delimits, length) macro_f_array_lengths_t_adjust(status, delimits, length)
-
- #define macro_f_iki_delimits_t_delete_simple(delimits) macro_f_array_lengths_t_delete_simple(delimits)
- #define macro_f_iki_delimits_t_destroy_simple(delimits) macro_f_array_lengths_t_destroy_simple(delimits)
-
- #define macro_f_iki_delimits_t_increase(status, step, delimits) macro_f_array_lengths_t_increase(status, step, delimits)
- #define macro_f_iki_delimits_t_increase_by(status, delimits, amount) macro_f_array_lengths_t_increase_by(status, delimits, amount)
- #define macro_f_iki_delimits_t_decrease_by(status, delimits, amount) macro_f_array_lengths_t_decrease_by(status, delimits, amount)
- #define macro_f_iki_delimits_t_decimate_by(status, delimits, amount) macro_f_array_lengths_t_decimate_by(status, delimits, amount)
-#endif // _di_f_iki_delimits_t_
-
-/**
- * An array of f_iki_delimits_t.
- *
- * array: The array of iki quotes.
- * size: Total amount of allocated space.
- * used: Total number of allocated spaces used.
- */
-#ifndef _di_f_iki_delimitss_t_
- typedef f_array_lengthss_t f_iki_delimitss_t;
-
- #define f_iki_delimitss_t_initialize f_array_lengthss_t_initialize
-
- #define macro_f_iki_delimitss_t_initialize(array, size, used) macro_f_array_lengthss_t_initialize(array, size, used)
- #define macro_f_iki_delimitss_t_initialize2(array, length) macro_f_array_lengthss_t_initialize2(array, length)
-
- #define macro_f_iki_delimitss_t_clear(delimitss) macro_f_array_lengthss_t_clear(delimitss)
-
- #define macro_f_iki_delimitss_t_resize(status, delimitss, length) macro_f_array_lengthss_t_resize(status, delimitss, length)
- #define macro_f_iki_delimitss_t_adjust(status, delimitss, length) macro_f_array_lengthss_t_adjust(status, delimitss, length)
-
- #define macro_f_iki_delimitss_t_delete_simple(delimitss) macro_f_array_lengthss_t_delete_simple(delimitss)
- #define macro_f_iki_delimitss_t_destroy_simple(delimitss) macro_f_array_lengthss_t_destroy_simple(delimitss)
-
- #define macro_f_iki_delimitss_t_increase(status, step, delimitss) macro_f_array_lengthss_t_increase(status, step, delimitss)
- #define macro_f_iki_delimitss_t_increase_by(status, delimitss, amount) macro_f_array_lengthss_t_increase_by(status, delimitss, amount)
- #define macro_f_iki_delimitss_t_decrease_by(status, delimitss, amount) macro_f_array_lengthss_t_decrease_by(status, delimitss, amount)
- #define macro_f_iki_delimitss_t_decimate_by(status, delimitss, amount) macro_f_array_lengthss_t_decimate_by(status, delimitss, amount)
-#endif // _di_f_iki_delimitss_t_
-
-/**
- * This holds an array of string ranges that represent the entire vocabulary name, content, and syntax.
- *
- * array: The array of variable.
- * size: Total amount of allocated space.
- * used: Total number of allocated spaces used.
- */
-#ifndef _di_f_iki_variable_t_
- typedef f_string_ranges_t f_iki_variable_t;
-
- #define f_iki_variable_t_initialize f_string_ranges_t_initialize
-
- #define macro_f_iki_variable_t_initialize(array, size, used) macro_f_string_ranges_t_initialize(array, size, used)
- #define macro_f_iki_variable_t_initialize2(array, length) macro_f_string_ranges_t_initialize2(array, length)
-
- #define macro_f_iki_variable_t_clear(variable) macro_f_string_ranges_t_clear(variable)
-
- #define macro_f_iki_variable_t_resize(status, variable, new_length) macro_f_string_ranges_t_resize(status, variable, new_length)
- #define macro_f_iki_variable_t_adjust(status, variable, new_length) macro_f_string_ranges_t_adjust(status, variable, new_length)
-
- #define macro_f_iki_variable_t_delete_simple(variable) macro_f_string_ranges_t_delete_simple(variable)
- #define macro_f_iki_variable_t_destroy_simple(variable) macro_f_string_ranges_t_destroy_simple(variable)
-
-#endif // _di_f_iki_variable_t_
-
-/**
- * This holds an array of string ranges that represent the entire vocabulary name, content, and syntax.
- *
- * array: The array of variable.
- * size: Total amount of allocated space.
- * used: Total number of allocated spaces used.
- */
-#ifndef _di_f_iki_variables_t_
- typedef f_string_rangess_t f_iki_variables_t;
-
- #define f_iki_variables_t_initialize f_string_rangess_t_initialize
-
- #define macro_f_iki_variables_t_initialize(array, size, used) macro_f_string_rangess_t_initialize(array, size, used)
- #define macro_f_iki_variables_t_initialize2(array, length) macro_f_string_rangess_t_initialize2(array, length)
-
- #define macro_f_iki_variables_t_clear(variable) macro_f_string_rangess_t_clear(variable)
-
- #define macro_f_iki_variables_t_resize(status, variable, new_length) macro_f_string_rangess_t_resize(status, variable, new_length)
- #define macro_f_iki_variables_t_adjust(status, variable, new_length) macro_f_string_rangess_t_adjust(status, variable, new_length)
-
- #define macro_f_iki_variables_t_delete_simple(variable) macro_f_string_rangess_t_delete_simple(variable)
- #define macro_f_iki_variables_t_destroy_simple(variable) macro_f_string_rangess_t_destroy_simple(variable)
-
-#endif // _di_f_iki_variables_t_
-
-/**
- * This holds an array of string ranges that represent the vocabulary names.
- *
- * array: The array of vocabulary names.
- * size: Total amount of allocated space.
- * used: Total number of allocated spaces used.
- */
-#ifndef _di_f_iki_vocabulary_t_
- typedef f_string_ranges_t f_iki_vocabulary_t;
-
- #define f_iki_vocabulary_t_initialize f_string_ranges_t_initialize
-
- #define macro_f_iki_vocabulary_t_initialize(array, size, used) macro_f_string_ranges_t_initialize(array, size, used)
- #define macro_f_iki_vocabulary_t_initialize2(array, length) macro_f_string_ranges_t_initialize2(array, length)
-
- #define macro_f_iki_vocabulary_t_clear(vocabulary) macro_f_string_ranges_t_clear(vocabulary)
-
- #define macro_f_iki_vocabulary_t_resize(status, vocabulary, new_length) macro_f_string_ranges_t_resize(status, vocabulary, new_length)
- #define macro_f_iki_vocabulary_t_adjust(status, vocabulary, new_length) macro_f_string_ranges_t_adjust(status, vocabulary, new_length)
-
- #define macro_f_iki_vocabulary_t_delete_simple(vocabulary) macro_f_string_ranges_t_delete_simple(vocabulary)
- #define macro_f_iki_vocabulary_t_destroy_simple(vocabulary) macro_f_string_ranges_t_destroy_simple(vocabulary)
-#endif // _di_f_iki_vocabulary_t_
-
-/**
- * This holds an array of f_iki_vocabulary_t.
- *
- * array: The array of content.
- * size: Total amount of allocated space.
- * used: Total number of allocated spaces used.
- */
-#ifndef _di_f_iki_vocabularys_t_
- typedef f_string_rangess_t f_iki_vocabularys_t;
-
- #define f_iki_vocabularys_t_initialize f_string_rangess_t_initialize
-
- #define macro_f_iki_vocabularys_t_initialize(array, size, used) macro_f_string_rangess_t_initialize(array, size, used)
- #define macro_f_iki_vocabularys_t_initialize2(array, length) macro_f_string_rangess_t_initialize2(array, length)
-
- #define macro_f_iki_vocabularys_t_clear(content) macro_f_string_rangess_t_clear(content)
-
- #define macro_f_iki_vocabularys_t_resize(status, content, new_length) macro_f_string_rangess_t_resize(status, content, new_length)
- #define macro_f_iki_vocabularys_t_adjust(status, content, new_length) macro_f_string_rangess_t_adjust(status, content, new_length)
-
- #define macro_f_iki_vocabularys_t_delete_simple(content) macro_f_string_rangess_t_delete_simple(content)
- #define macro_f_iki_vocabularys_t_destroy_simple(content) macro_f_string_rangess_t_destroy_simple(content)
-#endif // _di_f_iki_vocabularys_t_
-
-/**
- * This holds an array of string ranges that represent the content.
- *
- * The very first string range will represent the first content found.
- *
- * array: The array of content.
- * size: Total amount of allocated space.
- * used: Total number of allocated spaces used.
- */
-#ifndef _di_f_iki_content_t_
- typedef f_string_ranges_t f_iki_content_t;
-
- #define f_iki_content_t_initialize f_string_ranges_t_initialize
-
- #define macro_f_iki_content_t_initialize(array, size, used) macro_f_string_ranges_t_initialize(array, size, used)
- #define macro_f_iki_content_t_initialize2(array, length) macro_f_string_ranges_t_initialize2(array, length)
-
- #define macro_f_iki_content_t_clear(content) macro_f_string_ranges_t_clear(content)
-
- #define macro_f_iki_content_t_resize(status, content, new_length) macro_f_string_ranges_t_resize(status, content, new_length)
- #define macro_f_iki_content_t_adjust(status, content, new_length) macro_f_string_ranges_t_adjust(status, content, new_length)
-
- #define macro_f_iki_content_t_delete_simple(content) macro_f_string_ranges_t_delete_simple(content)
- #define macro_f_iki_content_t_destroy_simple(content) macro_f_string_ranges_t_destroy_simple(content)
-#endif // _di_f_iki_content_t_
-
-/**
- * This holds an array of f_iki_content_t.
- *
- * array: The array of content.
- * size: Total amount of allocated space.
- * used: Total number of allocated spaces used.
- */
-#ifndef _di_f_iki_contents_t_
- typedef f_string_rangess_t f_iki_contents_t;
-
- #define f_iki_contents_t_initialize f_string_rangess_t_initialize
-
- #define macro_f_iki_contents_t_initialize(array, size, used) macro_f_string_rangess_t_initialize(array, size, used)
- #define macro_f_iki_contents_t_initialize2(array, length) macro_f_string_rangess_t_initialize2(array, length)
-
- #define macro_f_iki_contents_t_clear(content) macro_f_string_rangess_t_clear(content)
-
- #define macro_f_iki_contents_t_resize(status, content, new_length) macro_f_string_rangess_t_resize(status, content, new_length)
- #define macro_f_iki_contents_t_adjust(status, content, new_length) macro_f_string_rangess_t_adjust(status, content, new_length)
-
- #define macro_f_iki_contents_t_delete_simple(content) macro_f_string_rangess_t_delete_simple(content)
- #define macro_f_iki_contents_t_destroy_simple(content) macro_f_string_rangess_t_destroy_simple(content)
-#endif // _di_f_iki_contents_t_
-
-/**
* This containg all of the IKI data.
*
- * content: A set of ranges representing the content list to store the content associated with the found vocabulary name.
+ * content: A set of ranges representing the content (variable value) list to store the content associated with the found vocabulary name.
* delimits: A delimits array representing where delimits exist within the buffer.
- * variable: A set of ranges representing the entire vocabulary name, content, and syntax.
- * vocabulary: A set of ranges representing the vocabulary name list to store the found vocabulary name.
+ * variable: A set of ranges representing the entire vocabulary (variable name), content, and the syntax.
+ * vocabulary: A set of ranges representing the vocabulary (variable name) list to store the found vocabulary name.
*/
#ifndef _di_f_iki_data_t_
typedef struct {
- f_iki_content_t content;
- f_iki_delimits_t delimits;
- f_iki_variable_t variable;
- f_iki_vocabulary_t vocabulary;
+ f_string_ranges_t content;
+ f_array_lengths_t delimits;
+ f_string_ranges_t variable;
+ f_string_ranges_t vocabulary;
} f_iki_data_t;
#define f_iki_data_t_initialize { \
- f_iki_content_t_initialize, \
- f_iki_delimits_t_initialize, \
- f_iki_variable_t_initialize, \
- f_iki_vocabulary_t_initialize, \
+ f_string_ranges_t_initialize, \
+ f_array_lengths_t_initialize, \
+ f_string_ranges_t_initialize, \
+ f_string_ranges_t_initialize, \
}
#define macro_f_iki_data_t_initialize(content, delimits, variable, vocabulary) { content, delimits, variable, vocabulary }
#define macro_f_iki_data_t_clear(data) \
- f_iki_content_t_clear(data.content) \
- f_iki_delimits_t_clear(data.delimits) \
- f_iki_variable_t_clear(data.variable) \
- f_iki_vocabulary_t_clear(data.vocabulary)
+ f_string_ranges_t_clear(data.content) \
+ f_array_lengths_t_clear(data.delimits) \
+ f_string_ranges_t_clear(data.variable) \
+ f_string_ranges_t_clear(data.vocabulary)
#define macro_f_iki_data_t_delete_simple(data) status = f_iki_data_delete(data);
#define macro_f_iki_data_t_destroy_simple(data) status = f_iki_data_destroy(data);
* Save the string size along with the string, so that strlen(..) commands can be avoided as much as possible.
*
* This is a sub-type of f_string_static_t, allowing it to be passed into any f_string_static_t type.
- * It is recommended that f_string_static_t are not otherwise casted into f_string_dynamic_t to avoid potential memory allocation issues.
+ *
+ * The size should only be set to 0 when the string is not allocated (and therefore deallocation attempts must not be made).
+ * This is necessary for the cases where f_string_static_t is used as a f_string_dynamic_t.
*
* string: The string.
* size: Total amount of allocated space.
/**
* A string that is analogous to f_string_dynamic_t but intended for static-only uses.
*
- * The f_string_static_t type should never be directly allocated or deallocated.
+ * The f_string_static_t type should always have size set to 0 to represent that it is a static string.
+ * This allows for easier integration with f_string_dynamic_t.
*
- * A special macro_f_string_static_t_initialize() is provided for the special purpose of easily initialize a static string.
- * A special macro_f_string_static_t_initialize2() is provided for the special purpose of easily initialize a static string with an identical used and size.
+ * If size is set to some value other than 0 for a static string, then take special care not to intermix it with f_string_dynamic_t.
+ *
+ * A special macro_f_string_static_t_initialize() is provided to easily initialize a static string.
+ * A special macro_f_string_static_t_initialize2() is provided to easily initialize a static string with an identical used and size.
*
* string: The string.
* size: Total amount of space available.
#ifndef _di_fll_program_data_t_
typedef struct {
f_console_parameters_t parameters;
- const f_string_t * environment;
+ const f_string_t *environment;
mode_t umask;
pid_t pid;
#endif // _di_fll_program_print_error_parameter_both_specified_same_amount_
#ifndef _di_fll_program_print_error_parameter_cannot_use_with_
- f_status_t fll_program_print_error_parameter_cannot_use_with(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t first, const f_string_static_t second) {
+ f_status_t fll_program_print_error_parameter_cannot_use_with(const fl_print_t print, const f_string_static_t symbol_first, const f_string_static_t symbol_second, const f_string_static_t first, const f_string_static_t second) {
if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
f_file_stream_lock(print.to);
fl_print_format("%[%QCannot specify the '%]", print.to.stream, print.set->error, print.prefix, print.set->error);
- fl_print_format("%[%Q%Q%]", print.to.stream, print.set->notable, symbol, first, print.set->notable);
+ fl_print_format("%[%Q%Q%]", print.to.stream, print.set->notable, symbol_first, first, print.set->notable);
fl_print_format("%[' parameter with the '%]", print.to.stream, print.set->error, print.set->error);
- fl_print_format("%[%Q%Q%]", print.to.stream, print.set->notable, symbol, second, print.set->notable);
+ fl_print_format("%[%Q%Q%]", print.to.stream, print.set->notable, symbol_second, second, print.set->notable);
fl_print_format("%[' parameter.%]%r", print.to.stream, print.set->error, print.set->error, f_string_eol_s);
f_file_stream_unlock(print.to);
}
#endif // _di_fll_program_print_error_parameter_cannot_use_with_
+#ifndef _di_fll_program_print_error_parameter_integer_not_
+ f_status_t fll_program_print_error_parameter_integer_not(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t parameter, const f_string_static_t value) {
+
+ if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
+
+ f_file_stream_lock(print.to);
+
+ fl_print_format("%[%QThe value '%]", print.to.stream, print.set->error, print.prefix, print.set->error);
+ fl_print_format("%[%Q%]", print.to.stream, print.set->notable, value, print.set->notable);
+ fl_print_format("%[' for the parameter '%]", print.to.stream, print.set->error, print.set->error);
+ fl_print_format("%[%Q%Q%]", print.to.stream, print.set->notable, symbol, parameter, print.set->notable);
+ fl_print_format("%[' is not a valid integer.%]%r", print.to.stream, print.set->error, print.set->error, f_string_eol_s);
+
+ f_file_stream_unlock(print.to);
+
+ return F_none;
+ }
+#endif // _di_fll_program_print_error_parameter_integer_not_
+
+#ifndef _di_fll_program_print_error_parameter_integer_not_negative_
+ f_status_t fll_program_print_error_parameter_integer_not_negative(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t parameter, const f_string_static_t value) {
+
+ if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
+
+ f_file_stream_lock(print.to);
+
+ fl_print_format("%[%QThe value '%]", print.to.stream, print.set->error, print.prefix, print.set->error);
+ fl_print_format("%[%Q%]", print.to.stream, print.set->notable, value, print.set->notable);
+ fl_print_format("%[' for the parameter '%]", print.to.stream, print.set->error, print.set->error);
+ fl_print_format("%[%Q%Q%]", print.to.stream, print.set->notable, symbol, parameter, print.set->notable);
+ fl_print_format("%[' is not a valid negative integer.%]%r", print.to.stream, print.set->error, print.set->error, f_string_eol_s);
+
+ f_file_stream_unlock(print.to);
+
+ return F_none;
+ }
+#endif // _di_fll_program_print_error_parameter_integer_not_negative_
+
+#ifndef _di_fll_program_print_error_parameter_integer_not_positive_
+ f_status_t fll_program_print_error_parameter_integer_not_positive(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t parameter, const f_string_static_t value) {
+
+ if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
+
+ f_file_stream_lock(print.to);
+
+ fl_print_format("%[%QThe value '%]", print.to.stream, print.set->error, print.prefix, print.set->error);
+ fl_print_format("%[%Q%]", print.to.stream, print.set->notable, value, print.set->notable);
+ fl_print_format("%[' for the parameter '%]", print.to.stream, print.set->error, print.set->error);
+ fl_print_format("%[%Q%Q%]", print.to.stream, print.set->notable, symbol, parameter, print.set->notable);
+ fl_print_format("%[' is not a valid positive integer.%]%r", print.to.stream, print.set->error, print.set->error, f_string_eol_s);
+
+ f_file_stream_unlock(print.to);
+
+ return F_none;
+ }
+#endif // _di_fll_program_print_error_parameter_integer_not_positive_
+
#ifndef _di_fll_program_print_error_parameter_missing_value_
f_status_t fll_program_print_error_parameter_missing_value(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t parameter) {
fl_print_format("%[%QThe parameter %]", print.to.stream, print.set->error, print.prefix, print.set->error);
fl_print_format("%[%Q%Q%]", print.to.stream, print.set->notable, symbol, parameter, print.set->notable);
- fl_print_format("%[ is specified, but no value is given.%]%r", print.to.stream, print.set->error, print.set->error, f_string_eol_s);
+ fl_print_format(" %[is specified, but no value is given.%]%r", print.to.stream, print.set->error, print.set->error, f_string_eol_s);
f_file_stream_unlock(print.to);
}
#endif // _di_fll_program_print_error_parameter_missing_value_
+#ifndef _di_fll_program_print_error_parameter_missing_value_requires_amount_
+ f_status_t fll_program_print_error_parameter_missing_value_requires_amount(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t parameter, const f_string_static_t amount) {
+
+ if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
+
+ f_file_stream_lock(print.to);
+
+ fl_print_format("%[%QThe parameter %]", print.to.stream, print.set->error, print.prefix, print.set->error);
+ fl_print_format("%[%Q%Q%]", print.to.stream, print.set->notable, symbol, parameter, print.set->notable);
+ fl_print_format("%[ is specified, but %]", print.to.stream, print.set->error, print.set->error);
+ fl_print_format("%[%Q%]", print.to.stream, print.set->notable, amount, print.set->notable);
+ fl_print_format(" %[values are not given.%]%r", print.to.stream, print.set->error, print.set->error, f_string_eol_s);
+
+ f_file_stream_unlock(print.to);
+
+ return F_none;
+ }
+#endif // _di_fll_program_print_error_parameter_missing_value_requires_amount_
+
#ifndef _di_fll_program_print_error_parameter_must_specify_once_
f_status_t fll_program_print_error_parameter_must_specify_once(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t parameter) {
* @param print
* The output structure.
* This locks, uses, and unlocks the file stream.
- * @param symbol
- * The symbol string prepended to both parameters.
+ * @param symbol_first
+ * The symbol string prepended to the first parameter.
+ * This is usually f_console_symbol_long_enable_s.
+ * @param symbol_second
+ * The symbol string prepended to the second parameter.
* This is usually f_console_symbol_long_enable_s.
* @param first
* The first parameter name.
* F_output_not on success, but no printing is performed.
*/
#ifndef _di_fll_program_print_error_parameter_cannot_use_with_
- extern f_status_t fll_program_print_error_parameter_cannot_use_with(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t first, const f_string_static_t second);
+ extern f_status_t fll_program_print_error_parameter_cannot_use_with(const fl_print_t print, const f_string_static_t symbol_first, const f_string_static_t symbol_second, const f_string_static_t first, const f_string_static_t second);
#endif // _di_fll_program_print_error_parameter_cannot_use_with_
/**
- * Print message about parameter not have the required value associated with this.
+ * Print message about parameter not being a valid integer.
+ *
+ * This is only printed when verbosity is not set to quiet.
+ *
+ * This uses the following:
+ * - print.set->error: For the error context.
+ * - print.set->strong: For the highlighting context
+ * - print.prefix: For the prefixing a string to the message (such as "ERROR:").
+ *
+ * @param print
+ * The output structure.
+ * This locks, uses, and unlocks the file stream.
+ * @param symbol
+ * The symbol string prepended to both parameters.
+ * This locks, uses, and unlocks the file stream.
+ * This is usually f_console_symbol_long_enable_s.
+ * @param parameter
+ * The parameter name.
+ * @param value
+ * The value.
+ *
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
+ */
+#ifndef _di_fll_program_print_error_parameter_integer_not_
+ extern f_status_t fll_program_print_error_parameter_integer_not(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t parameter, const f_string_static_t value);
+#endif // _di_fll_program_print_error_parameter_integer_not_
+
+/**
+ * Print message about parameter not being a negative integer.
+ *
+ * This is only printed when verbosity is not set to quiet.
+ *
+ * This uses the following:
+ * - print.set->error: For the error context.
+ * - print.set->strong: For the highlighting context
+ * - print.prefix: For the prefixing a string to the message (such as "ERROR:").
+ *
+ * @param print
+ * The output structure.
+ * This locks, uses, and unlocks the file stream.
+ * @param symbol
+ * The symbol string prepended to both parameters.
+ * This locks, uses, and unlocks the file stream.
+ * This is usually f_console_symbol_long_enable_s.
+ * @param parameter
+ * The parameter name.
+ * @param value
+ * The value.
+ *
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
+ */
+#ifndef _di_fll_program_print_error_parameter_integer_not_negative_
+ extern f_status_t fll_program_print_error_parameter_integer_not_negative(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t parameter, const f_string_static_t value);
+#endif // _di_fll_program_print_error_parameter_integer_not_negative_
+
+/**
+ * Print message about parameter not being a positive integer.
+ *
+ * This is only printed when verbosity is not set to quiet.
+ *
+ * This uses the following:
+ * - print.set->error: For the error context.
+ * - print.set->strong: For the highlighting context
+ * - print.prefix: For the prefixing a string to the message (such as "ERROR:").
+ *
+ * @param print
+ * The output structure.
+ * This locks, uses, and unlocks the file stream.
+ * @param symbol
+ * The symbol string prepended to both parameters.
+ * This locks, uses, and unlocks the file stream.
+ * This is usually f_console_symbol_long_enable_s.
+ * @param parameter
+ * The parameter name.
+ * @param value
+ * The value.
+ *
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
+ */
+#ifndef _di_fll_program_print_error_parameter_integer_not_positive_
+ extern f_status_t fll_program_print_error_parameter_integer_not_positive(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t parameter, const f_string_static_t value);
+#endif // _di_fll_program_print_error_parameter_integer_not_positive_
+
+/**
+ * Print message about parameter not have the required value associated with this parameter.
*
* This is only printed when verbosity is not set to quiet.
*
#endif // _di_fll_program_print_error_parameter_missing_value_
/**
+ * Print message about parameter not have the required amount of values associated with this parameter.
+ *
+ * This is only printed when verbosity is not set to quiet.
+ *
+ * This uses the following:
+ * - print.set->error: For the error context.
+ * - print.set->strong: For the highlighting context
+ * - print.prefix: For the prefixing a string to the message (such as "ERROR:").
+ *
+ * @param print
+ * The output structure.
+ * This locks, uses, and unlocks the file stream.
+ * @param symbol
+ * The symbol string prepended to both parameters.
+ * This locks, uses, and unlocks the file stream.
+ * This is usually f_console_symbol_long_enable_s.
+ * @param parameter
+ * The parameter name.
+ * @param amount
+ * A string representing the amount of missing parameters.
+ *
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
+ */
+#ifndef _di_fll_program_print_error_parameter_missing_value_requires_amount_
+ f_status_t fll_program_print_error_parameter_missing_value_requires_amount(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t parameter, const f_string_static_t amount);
+#endif // _di_fll_program_print_error_parameter_missing_value_requires_amount_
+
+/**
* Print message about parameter only being allowed to be used once.
*
* This is only printed when verbosity is not set to quiet.
*
* @param setting
* The program main setting data.
+ *
* This does not alter setting.status.
*
* @return
* The main program data.
* @param setting
* The main program settings.
- * This does not alter setting.status.
* All buffers are deallocated.
*
+ * This does not alter setting.status.
+ *
* @return
* F_none on success.
*
fll_program_print_help_option_long(print.to, context, byte_dump_long_simple_s, f_console_symbol_long_enable_s, " Display spaces for ASCII control codes.");
fll_program_print_help_option_long(print.to, context, byte_dump_long_classic_s, f_console_symbol_long_enable_s, "Display periods for ASCII control codes.");
+ f_print_dynamic_raw(f_string_eol_s, print.to.stream);
+ f_print_dynamic_raw(f_string_eol_s, print.to.stream);
+
fll_program_print_help_usage(print, byte_dump_program_name_s, fll_program_parameter_filenames_s);
//if (!(setting->flag & XXX_main_flag_line_last_no_e)) {
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param output
* The file to print to.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The program main setting data.
+ *
* This does not alter setting.status.
*
* @return
* The main program data.
* @param setting
* The main program settings.
- * This does not alter setting.status.
* All buffers are deallocated.
*
+ * This does not alter setting.status.
+ *
* @return
* F_none on success.
*
fll_program_print_help_option(print, control_short_settings_s, control_long_settings_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "Specify a directory path or a full path to the control settings file.");
fll_program_print_help_option(print, control_short_socket_s, control_long_socket_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Specify a directory path or a full path to the controller socket file.");
+ f_print_dynamic_raw(f_string_eol_s, print.to.stream);
+ f_print_dynamic_raw(f_string_eol_s, print.to.stream);
+
fll_program_print_help_usage(print, control_program_name_s, control_action_s);
fl_print_format("%r When the %[%r%r%] parameter represents a directory path then the file name is generated from either the", print.to.stream, f_string_eol_s, print.set->notable, f_console_symbol_long_enable_s, control_long_socket_s, print.set->notable);
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* The output structure to print to.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The program main setting data.
+ *
* This does not alter setting.status.
*
* @return
* The main program data.
* @param setting
* The main program settings.
- * This does not alter setting.status.
* All buffers are deallocated.
*
+ * This does not alter setting.status.
+ *
* @return
* F_none on success.
*
fll_program_print_help_option(print, controller_short_uninterruptible_s, controller_long_uninterruptible_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "Designate that this program cannot be interrupted by a signal.");
fll_program_print_help_option(print, controller_short_validate_s, controller_long_validate_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Validate the settings (entry and rules) without running (does not simulate).");
+ f_print_dynamic_raw(f_string_eol_s, print.to.stream);
+ f_print_dynamic_raw(f_string_eol_s, print.to.stream);
+
fll_program_print_help_usage(print, *main->program_name, controller_entry_s);
fl_print_format("%r When both the %[%r%r%] parameter and the", print.to.stream, f_string_eol_s, print.set->notable, f_console_symbol_long_enable_s, controller_long_simulate_s, print.set->notable);
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* The output structure to print to.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The program main setting data.
+ *
* This does not alter setting.status.
*
* @return
* The main program data.
* @param setting
* The main program settings.
- * This does not alter setting.status.
* All buffers are deallocated.
*
+ * This does not alter setting.status.
+ *
* @return
* F_none on success.
*
fll_program_print_help_option_other(print, fake_other_operation_make_s, " Build or compile the code based on fakefile (default).");
fll_program_print_help_option_other(print, fake_other_operation_skeleton_s, "Build a skeleton directory structure.");
+ f_print_dynamic_raw(f_string_eol_s, print.to.stream);
+ f_print_dynamic_raw(f_string_eol_s, print.to.stream);
+
fll_program_print_help_usage(print, fake_program_name_s, fake_program_help_parameters_s);
fl_print_format("%r When performing the %[%r%] operation, the", print.to.stream, f_string_eol_s, print.set->notable, fake_other_operation_build_s, print.set->notable);
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* The output structure to print to.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The program main setting data.
+ *
* This does not alter setting.status.
*
* @return
* The main program data.
* @param setting
* The main program settings.
- * This does not alter setting.status.
* All buffers are deallocated.
*
+ * This does not alter setting.status.
+ *
* @return
* F_none on success.
*
fl_print_format("%r %[%r%] Prevent all communication.", print.to.stream, f_string_eol_s, print.set->standout, firewall_command_lock_s, print.set->standout);
fl_print_format("%r %[%r%] Show active firewall settings.", print.to.stream, f_string_eol_s, print.set->standout, firewall_command_show_s, print.set->standout);
+ f_print_dynamic_raw(f_string_eol_s, print.to.stream);
+ f_print_dynamic_raw(f_string_eol_s, print.to.stream);
+
fll_program_print_help_usage(print, firewall_program_name_s, firewall_program_help_parameters_s);
f_print_dynamic_raw(setting->line_last, print.to.stream);
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* The output structure to print to.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The program main setting data.
+ *
* This does not alter setting.status.
*
* @return
* The main program data.
* @param setting
* The main program settings.
- * This does not alter setting.status.
* All buffers are deallocated.
*
+ * This does not alter setting.status.
+ *
* @return
* F_none on success.
*
if (main->parameters.array[parameter_code[i]].result == parameter_match[i]) {
if (main->error.verbosity > f_console_verbosity_quiet_e) {
- fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, fss_basic_list_read_long_columns_s, parameter_name[i]);
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, f_console_symbol_long_enable_s, fss_basic_list_read_long_columns_s, parameter_name[i]);
}
status = F_status_set_error(F_parameter);
if (F_status_is_error_not(status) && main->parameters.array[fss_basic_list_read_parameter_pipe_e].result == f_console_result_found_e) {
if (main->parameters.array[fss_basic_list_read_parameter_total_e].result == f_console_result_found_e) {
if (main->error.verbosity > f_console_verbosity_quiet_e) {
- fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, fss_basic_list_read_long_pipe_s, fss_basic_list_read_long_total_s);
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, f_console_symbol_long_enable_s, fss_basic_list_read_long_pipe_s, fss_basic_list_read_long_total_s);
}
status = F_status_set_error(F_parameter);
}
else if (main->parameters.array[fss_basic_list_read_parameter_line_e].result == f_console_result_additional_e) {
if (main->error.verbosity > f_console_verbosity_quiet_e) {
- fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, fss_basic_list_read_long_pipe_s, fss_basic_list_read_long_line_s);
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, f_console_symbol_long_enable_s, fss_basic_list_read_long_pipe_s, fss_basic_list_read_long_line_s);
}
status = F_status_set_error(F_parameter);
if (size_file) {
- // Enforce a max block read size to allow for interrupts to be processed beteween blocks.
+ // Enforce a max block read size to allow for interrupts to be processed between blocks.
if (size_file > fss_basic_list_read_block_max) {
file.size_read = fss_basic_list_read_block_read_large;
size_block = fss_basic_list_read_block_max;
fll_program_print_help_option(print, fss_basic_list_read_short_total_s, fss_basic_list_read_long_total_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the total number of lines.");
fll_program_print_help_option(print, fss_basic_list_read_short_trim_s, fss_basic_list_read_long_trim_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Trim Object names on select or print.");
+ f_print_dynamic_raw(f_string_eol_s, print.to.stream);
+ f_print_dynamic_raw(f_string_eol_s, print.to.stream);
+
fll_program_print_help_usage(print, fss_basic_list_read_program_name_s, fll_program_parameter_filenames_s);
fl_print_format("%r %[Notes:%]%r", print.to.stream, f_string_eol_s, print.set->important, print.set->important, f_string_eol_s);
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* The output structure to print to.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The program main setting data.
+ *
* This does not alter setting.status.
*
* @return
* The main program data.
* @param setting
* The main program settings.
- * This does not alter setting.status.
* All buffers are deallocated.
*
+ * This does not alter setting.status.
+ *
* @return
* F_none on success.
*
fll_program_print_help_option(print, fss_basic_list_write_short_single_s, fss_basic_list_write_long_single_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Use single quotes.");
fll_program_print_help_option(print, fss_basic_list_write_short_trim_s, fss_basic_list_write_long_trim_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Trim Object names.");
+ f_print_dynamic_raw(f_string_eol_s, print.to.stream);
+ f_print_dynamic_raw(f_string_eol_s, print.to.stream);
+
fll_program_print_help_usage(print, fss_basic_list_write_program_name_s, f_string_empty_s);
fl_print_format("%r The pipe uses the Backspace character '%[\\b%]' (%[U+0008%]) to designate the start of a Content.%r", print.to.stream, f_string_eol_s, print.set->notable, print.set->notable, print.set->notable, print.set->notable, f_string_eol_s);
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* The output structure to print to.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @return
* F_none on success.
- * F_failure (with error bit) for any othe failure.
+ * F_failure (with error bit) for any other failure.
*/
#ifndef _di_fss_basic_list_write_process_
extern f_status_t fss_basic_list_write_process(fll_program_data_t * const main, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, f_string_dynamic_t * const buffer) F_attribute_visibility_internal_d;
*
* @return
* F_none on success.
- * F_failure (with error bit) for any othe failure.
+ * F_failure (with error bit) for any other failure.
*/
#ifndef _di_fss_basic_list_write_process_pipe_
extern f_status_t fss_basic_list_write_process_pipe(fll_program_data_t * const main, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t * const buffer) F_attribute_visibility_internal_d;
*
* @param setting
* The program main setting data.
+ *
* This does not alter setting.status.
*
* @return
* The main program data.
* @param setting
* The main program settings.
- * This does not alter setting.status.
* All buffers are deallocated.
*
+ * This does not alter setting.status.
+ *
* @return
* F_none on success.
*
if (main->parameters.array[parameter_code[i]].result == parameter_match[i]) {
if (main->error.verbosity > f_console_verbosity_quiet_e) {
- fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, fss_basic_read_long_columns_s, parameter_name[i]);
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, f_console_symbol_long_enable_s, fss_basic_read_long_columns_s, parameter_name[i]);
}
status = F_status_set_error(F_parameter);
if (F_status_is_error_not(status) && main->parameters.array[fss_basic_read_parameter_pipe_e].result == f_console_result_found_e) {
if (main->parameters.array[fss_basic_read_parameter_total_e].result == f_console_result_found_e) {
if (main->error.verbosity > f_console_verbosity_quiet_e) {
- fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, fss_basic_read_long_pipe_s, fss_basic_read_long_total_s);
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, f_console_symbol_long_enable_s, fss_basic_read_long_pipe_s, fss_basic_read_long_total_s);
}
status = F_status_set_error(F_parameter);
}
else if (main->parameters.array[fss_basic_read_parameter_line_e].result == f_console_result_additional_e) {
if (main->error.verbosity > f_console_verbosity_quiet_e) {
- fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, fss_basic_read_long_pipe_s, fss_basic_read_long_line_s);
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, f_console_symbol_long_enable_s, fss_basic_read_long_pipe_s, fss_basic_read_long_line_s);
}
status = F_status_set_error(F_parameter);
if (size_file) {
- // Enforce a max block read size to allow for interrupts to be processed beteween blocks.
+ // Enforce a max block read size to allow for interrupts to be processed between blocks.
if (size_file > fss_basic_read_block_max) {
file.size_read = fss_basic_read_block_read_large;
size_block = fss_basic_read_block_max;
fll_program_print_help_option(print, fss_basic_read_short_total_s, fss_basic_read_long_total_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the total number of lines.");
fll_program_print_help_option(print, fss_basic_read_short_trim_s, fss_basic_read_long_trim_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Trim Object names on select or print.");
+ f_print_dynamic_raw(f_string_eol_s, print.to.stream);
+ f_print_dynamic_raw(f_string_eol_s, print.to.stream);
+
fll_program_print_help_usage(print, fss_basic_read_program_name_s, fll_program_parameter_filenames_s);
fl_print_format("%r %[Notes:%]%r", print.to.stream, f_string_eol_s, print.set->important, print.set->important, f_string_eol_s);
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* The output structure to print to.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The program main setting data.
+ *
* This does not alter setting.status.
*
* @return
* The main program data.
* @param setting
* The main program settings.
- * This does not alter setting.status.
* All buffers are deallocated.
*
+ * This does not alter setting.status.
+ *
* @return
* F_none on success.
*
fll_program_print_help_option(print, fss_basic_write_short_single_s, fss_basic_write_long_single_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Use single quotes.");
fll_program_print_help_option(print, fss_basic_write_short_trim_s, fss_basic_write_long_trim_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Trim Object names.");
+ f_print_dynamic_raw(f_string_eol_s, print.to.stream);
+ f_print_dynamic_raw(f_string_eol_s, print.to.stream);
+
fll_program_print_help_usage(print, fss_basic_write_program_name_s, f_string_empty_s);
fl_print_format("%r The pipe uses the Backspace character '%[\\b%]' (%[U+0008%]) to designate the start of a Content.%r", print.to.stream, f_string_eol_s, print.set->notable, print.set->notable, print.set->notable, print.set->notable, f_string_eol_s);
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* The output structure to print to.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @return
* F_none on success.
- * F_failure (with error bit) for any othe failure.
+ * F_failure (with error bit) for any other failure.
*/
#ifndef _di_fss_basic_write_process_
extern f_status_t fss_basic_write_process(fll_program_data_t * const main, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, f_string_dynamic_t *buffer) F_attribute_visibility_internal_d;
*
* @return
* F_none on success.
- * F_failure (with error bit) for any othe failure.
+ * F_failure (with error bit) for any other failure.
*/
#ifndef _di_fss_basic_write_process_pipe_
extern f_status_t fss_basic_write_process_pipe(fll_program_data_t * const main, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer) F_attribute_visibility_internal_d;
*
* @param setting
* The program main setting data.
+ *
* This does not alter setting.status.
*
* @return
* The main program data.
* @param setting
* The main program settings.
- * This does not alter setting.status.
* All buffers are deallocated.
*
+ * This does not alter setting.status.
+ *
* @return
* F_none on success.
*
if (F_status_is_error_not(status) && main->parameters.array[fss_embedded_list_read_parameter_total_e].result == f_console_result_found_e) {
if (main->parameters.array[fss_embedded_list_read_parameter_columns_e].result == f_console_result_found_e) {
if (main->error.verbosity > f_console_verbosity_quiet_e) {
- fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, fss_embedded_list_read_long_columns_s, fss_embedded_list_read_long_total_s);
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, f_console_symbol_long_enable_s, fss_embedded_list_read_long_columns_s, fss_embedded_list_read_long_total_s);
}
status = F_status_set_error(F_parameter);
if (main->parameters.array[fss_embedded_list_read_parameter_line_e].result == f_console_result_additional_e) {
if (F_status_is_error_not(status) && main->parameters.array[fss_embedded_list_read_parameter_total_e].result == f_console_result_found_e) {
if (main->error.verbosity > f_console_verbosity_quiet_e) {
- fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, fss_embedded_list_read_long_line_s, fss_embedded_list_read_long_total_s);
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, f_console_symbol_long_enable_s, fss_embedded_list_read_long_line_s, fss_embedded_list_read_long_total_s);
}
status = F_status_set_error(F_parameter);
if (main->parameters.array[fss_embedded_list_read_parameter_pipe_e].result == f_console_result_found_e) {
if (F_status_is_error_not(status) && main->parameters.array[fss_embedded_list_read_parameter_total_e].result == f_console_result_found_e) {
if (main->error.verbosity > f_console_verbosity_quiet_e) {
- fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, fss_embedded_list_read_long_pipe_s, fss_embedded_list_read_long_total_s);
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, f_console_symbol_long_enable_s, fss_embedded_list_read_long_pipe_s, fss_embedded_list_read_long_total_s);
}
status = F_status_set_error(F_parameter);
continue;
}
- // Enforce a max block read size to allow for interrupts to be processed beteween blocks.
+ // Enforce a max block read size to allow for interrupts to be processed between blocks.
if (size_file > fss_embedded_list_read_block_max) {
file.size_read = fss_embedded_list_read_block_read_large;
size_block = fss_embedded_list_read_block_max;
fll_program_print_help_option(print, fss_embedded_list_read_short_total_s, fss_embedded_list_read_long_total_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the total number of lines.");
fll_program_print_help_option(print, fss_embedded_list_read_short_trim_s, fss_embedded_list_read_long_trim_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Trim Object names on select or print.");
+ f_print_dynamic_raw(f_string_eol_s, print.to.stream);
+ f_print_dynamic_raw(f_string_eol_s, print.to.stream);
+
fll_program_print_help_usage(print, fss_embedded_list_read_program_name_s, fll_program_parameter_filenames_s);
fl_print_format("%r %[Notes:%]%r", print.to.stream, f_string_eol_s, print.set->important, print.set->important, f_string_eol_s);
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* The output structure to print to.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The program main setting data.
+ *
* This does not alter setting.status.
*
* @return
* The main program data.
* @param setting
* The main program settings.
- * This does not alter setting.status.
* All buffers are deallocated.
*
+ * This does not alter setting.status.
+ *
* @return
* F_none on success.
*
fll_program_print_help_option(print, fss_embedded_list_write_short_single_s, fss_embedded_list_write_long_single_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Use single quotes.");
fll_program_print_help_option(print, fss_embedded_list_write_short_trim_s, fss_embedded_list_write_long_trim_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Trim Object names.");
+ f_print_dynamic_raw(f_string_eol_s, print.to.stream);
+ f_print_dynamic_raw(f_string_eol_s, print.to.stream);
+
fll_program_print_help_usage(print, fss_embedded_list_write_program_name_s, f_string_empty_s);
fl_print_format("%r The pipe uses the Backspace character '%[\\b%]' (%[U+0008%]) to designate the start of a Content.%r", print.to.stream, f_string_eol_s, print.set->notable, print.set->notable, print.set->notable, print.set->notable, f_string_eol_s);
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* The output structure to print to.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @return
* F_none on success.
- * F_failure (with error bit) for any othe failure.
+ * F_failure (with error bit) for any other failure.
*/
#ifndef _di_fss_embedded_list_write_process_
extern f_status_t fss_embedded_list_write_process(fll_program_data_t * const main, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, const f_string_ranges_t *ignore, f_string_dynamic_t *buffer) F_attribute_visibility_internal_d;
*
* @return
* F_none on success.
- * F_failure (with error bit) for any othe failure.
+ * F_failure (with error bit) for any other failure.
*/
#ifndef _di_fss_embedded_list_write_process_pipe_
extern f_status_t fss_embedded_list_write_process_pipe(fll_program_data_t * const main, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer, f_string_ranges_t *ignore) F_attribute_visibility_internal_d;
*
* @return
* F_none on success.
- * F_failure (with error bit) for any othe failure.
+ * F_failure (with error bit) for any other failure.
*/
#ifndef _di_fss_embedded_list_write_process_parameter_ignore_
extern f_status_t fss_embedded_list_write_process_parameter_ignore(fll_program_data_t * const main, const f_array_lengths_t contents, const f_array_length_t location, f_string_ranges_t *ignore) F_attribute_visibility_internal_d;
*
* @param setting
* The program main setting data.
+ *
* This does not alter setting.status.
*
* @return
* The main program data.
* @param setting
* The main program settings.
- * This does not alter setting.status.
* All buffers are deallocated.
*
+ * This does not alter setting.status.
+ *
* @return
* F_none on success.
*
if (main->parameters.array[parameter_code[i]].result == parameter_match[i]) {
if (main->error.verbosity > f_console_verbosity_quiet_e) {
- fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, fss_extended_list_read_long_columns_s, parameter_name[i]);
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, f_console_symbol_long_enable_s, fss_extended_list_read_long_columns_s, parameter_name[i]);
}
status = F_status_set_error(F_parameter);
if (F_status_is_error_not(status) && main->parameters.array[fss_extended_list_read_parameter_pipe_e].result == f_console_result_found_e) {
if (main->parameters.array[fss_extended_list_read_parameter_total_e].result == f_console_result_found_e) {
if (main->error.verbosity > f_console_verbosity_quiet_e) {
- fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, fss_extended_list_read_long_pipe_s, fss_extended_list_read_long_total_s);
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, f_console_symbol_long_enable_s, fss_extended_list_read_long_pipe_s, fss_extended_list_read_long_total_s);
}
status = F_status_set_error(F_parameter);
}
else if (main->parameters.array[fss_extended_list_read_parameter_line_e].result == f_console_result_additional_e) {
if (main->error.verbosity > f_console_verbosity_quiet_e) {
- fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, fss_extended_list_read_long_pipe_s, fss_extended_list_read_long_line_s);
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, f_console_symbol_long_enable_s, fss_extended_list_read_long_pipe_s, fss_extended_list_read_long_line_s);
}
status = F_status_set_error(F_parameter);
if (size_file) {
- // Enforce a max block read size to allow for interrupts to be processed beteween blocks.
+ // Enforce a max block read size to allow for interrupts to be processed between blocks.
if (size_file > fss_extended_list_read_block_max) {
file.size_read = fss_extended_list_read_block_read_large;
size_block = fss_extended_list_read_block_max;
fll_program_print_help_option(print, fss_extended_list_read_short_total_s, fss_extended_list_read_long_total_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the total number of lines.");
fll_program_print_help_option(print, fss_extended_list_read_short_trim_s, fss_extended_list_read_long_trim_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Trim Object names on select or print.");
+ f_print_dynamic_raw(f_string_eol_s, print.to.stream);
+ f_print_dynamic_raw(f_string_eol_s, print.to.stream);
+
fll_program_print_help_usage(print, fss_extended_list_read_program_name_s, fll_program_parameter_filenames_s);
fl_print_format("%r %[Notes:%]%r", print.to.stream, f_string_eol_s, print.set->important, print.set->important, f_string_eol_s);
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* The output structure to print to.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The program main setting data.
+ *
* This does not alter setting.status.
*
* @return
* The main program data.
* @param setting
* The main program settings.
- * This does not alter setting.status.
* All buffers are deallocated.
*
+ * This does not alter setting.status.
+ *
* @return
* F_none on success.
*
fll_program_print_help_option(print, fss_extended_list_write_short_single_s, fss_extended_list_write_long_single_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Use single quotes.");
fll_program_print_help_option(print, fss_extended_list_write_short_trim_s, fss_extended_list_write_long_trim_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Trim Object names.");
+ f_print_dynamic_raw(f_string_eol_s, print.to.stream);
+ f_print_dynamic_raw(f_string_eol_s, print.to.stream);
+
fll_program_print_help_usage(print, fss_extended_list_write_program_name_s, f_string_empty_s);
fl_print_format("%r The pipe uses the Backspace character '%[\\b%]' (%[U+0008%]) to designate the start of a Content.%r", print.to.stream, f_string_eol_s, print.set->notable, print.set->notable, print.set->notable, print.set->notable, f_string_eol_s);
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @return
* F_none on success.
- * F_failure (with error bit) for any othe failure.
+ * F_failure (with error bit) for any other failure.
*/
#ifndef _di_fss_extended_list_write_process_
extern f_status_t fss_extended_list_write_process(fll_program_data_t * const main, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, const f_string_ranges_t *ignore, f_string_dynamic_t *buffer) F_attribute_visibility_internal_d;
*
* @return
* F_none on success.
- * F_failure (with error bit) for any othe failure.
+ * F_failure (with error bit) for any other failure.
*/
#ifndef _di_fss_extended_list_write_process_pipe_
extern f_status_t fss_extended_list_write_process_pipe(fll_program_data_t * const main, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer, f_string_ranges_t *ignore) F_attribute_visibility_internal_d;
*
* @return
* F_none on success.
- * F_failure (with error bit) for any othe failure.
+ * F_failure (with error bit) for any other failure.
*/
#ifndef _di_fss_extended_list_write_process_parameter_ignore_
extern f_status_t fss_extended_list_write_process_parameter_ignore(fll_program_data_t * const main, const f_array_lengths_t contents, const f_array_length_t location, f_string_ranges_t *ignore) F_attribute_visibility_internal_d;
*
* @param setting
* The program main setting data.
+ *
* This does not alter setting.status.
*
* @return
* The main program data.
* @param setting
* The main program settings.
- * This does not alter setting.status.
* All buffers are deallocated.
*
+ * This does not alter setting.status.
+ *
* @return
* F_none on success.
*
if (main->parameters.array[parameter_code[i]].result == parameter_match[i]) {
if (main->error.verbosity > f_console_verbosity_quiet_e) {
- fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, fss_extended_read_long_columns_s, parameter_name[i]);
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, f_console_symbol_long_enable_s, fss_extended_read_long_columns_s, parameter_name[i]);
}
status = F_status_set_error(F_parameter);
if (F_status_is_error_not(status) && main->parameters.array[fss_extended_read_parameter_pipe_e].result == f_console_result_found_e) {
if (main->parameters.array[fss_extended_read_parameter_total_e].result == f_console_result_found_e) {
if (main->error.verbosity > f_console_verbosity_quiet_e) {
- fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, fss_extended_read_long_pipe_s, fss_extended_read_long_total_s);
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, f_console_symbol_long_enable_s, fss_extended_read_long_pipe_s, fss_extended_read_long_total_s);
}
status = F_status_set_error(F_parameter);
}
else if (main->parameters.array[fss_extended_read_parameter_line_e].result == f_console_result_additional_e) {
if (main->error.verbosity > f_console_verbosity_quiet_e) {
- fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, fss_extended_read_long_pipe_s, fss_extended_read_long_line_s);
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, f_console_symbol_long_enable_s, fss_extended_read_long_pipe_s, fss_extended_read_long_line_s);
}
status = F_status_set_error(F_parameter);
if (size_file) {
- // Enforce a max block read size to allow for interrupts to be processed beteween blocks.
+ // Enforce a max block read size to allow for interrupts to be processed between blocks.
if (size_file > fss_extended_read_block_max) {
file.size_read = fss_extended_read_block_read_large;
size_block = fss_extended_read_block_max;
fll_program_print_help_option(print, fss_extended_read_short_total_s, fss_extended_read_long_total_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the total number of lines.");
fll_program_print_help_option(print, fss_extended_read_short_trim_s, fss_extended_read_long_trim_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Trim Object names on select or print.");
+ f_print_dynamic_raw(f_string_eol_s, print.to.stream);
+ f_print_dynamic_raw(f_string_eol_s, print.to.stream);
+
fll_program_print_help_usage(print, fss_extended_read_program_name_s, fll_program_parameter_filenames_s);
fl_print_format("%r %[Notes:%]%r", print.to.stream, f_string_eol_s, print.set->important, print.set->important, f_string_eol_s);
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* The output structure to print to.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The program main setting data.
+ *
* This does not alter setting.status.
*
* @return
* The main program data.
* @param setting
* The main program settings.
- * This does not alter setting.status.
* All buffers are deallocated.
*
+ * This does not alter setting.status.
+ *
* @return
* F_none on success.
*
fll_program_print_help_option(print, fss_extended_write_short_single_s, fss_extended_write_long_single_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Use single quotes.");
fll_program_print_help_option(print, fss_extended_write_short_trim_s, fss_extended_write_long_trim_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Trim Object names.");
+ f_print_dynamic_raw(f_string_eol_s, print.to.stream);
+ f_print_dynamic_raw(f_string_eol_s, print.to.stream);
+
fll_program_print_help_usage(print, fss_extended_write_program_name_s, f_string_empty_s);
fl_print_format("%r The pipe uses the Backspace character '%[\\b%]' (%[U+0008%]) to designate the start of a Content.%r", print.to.stream, f_string_eol_s, print.set->notable, print.set->notable, print.set->notable, print.set->notable, f_string_eol_s);
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* The output structure to print to.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @return
* F_none on success.
- * F_failure (with error bit) for any othe failure.
+ * F_failure (with error bit) for any other failure.
*/
#ifndef _di_fss_extended_write_error_parameter_at_least_once_print_
void fss_extended_write_error_parameter_at_least_once(fll_program_data_t * const main) F_attribute_visibility_internal_d;
*
* @return
* F_none on success.
- * F_failure (with error bit) for any othe failure.
+ * F_failure (with error bit) for any other failure.
*/
#ifndef _di_fss_extended_write_error_parameter_value_missing_print_
void fss_extended_write_error_parameter_value_missing_print(fll_program_data_t * const main, const f_string_static_t symbol, const f_string_static_t parameter) F_attribute_visibility_internal_d;
*
* @return
* F_none on success.
- * F_failure (with error bit) for any othe failure.
+ * F_failure (with error bit) for any other failure.
*/
#ifndef _di_fss_extended_write_error_parameter_unsupported_eol_print_
void fss_extended_write_error_parameter_unsupported_eol_print(fll_program_data_t * const main) F_attribute_visibility_internal_d;
*
* @return
* F_none on success.
- * F_failure (with error bit) for any othe failure.
+ * F_failure (with error bit) for any other failure.
*/
#ifndef _di_fss_extended_write_process_
extern f_status_t fss_extended_write_process(fll_program_data_t * const main, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_statics_t *contents, f_string_dynamic_t *buffer) F_attribute_visibility_internal_d;
*
* @return
* F_none on success.
- * F_failure (with error bit) for any othe failure.
+ * F_failure (with error bit) for any other failure.
*/
#ifndef _di_fss_extended_write_process_pipe_
extern f_status_t fss_extended_write_process_pipe(fll_program_data_t * const main, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer) F_attribute_visibility_internal_d;
*
* @param setting
* The program main setting data.
+ *
* This does not alter setting.status.
*
* @return
* The main program data.
* @param setting
* The main program settings.
- * This does not alter setting.status.
* All buffers are deallocated.
*
+ * This does not alter setting.status.
+ *
* @return
* F_none on success.
*
if (F_status_is_error_not(status) && main->parameters.array[fss_identify_parameter_total_e].result == f_console_result_found_e) {
if (main->parameters.array[fss_identify_parameter_object_e].result == f_console_result_found_e) {
if (main->error.verbosity > f_console_verbosity_quiet_e) {
- fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, fss_identify_long_object_s, fss_identify_long_total_s);
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, f_console_symbol_long_enable_s, fss_identify_long_object_s, fss_identify_long_total_s);
}
status = F_status_set_error(F_parameter);
}
else if (main->parameters.array[fss_identify_parameter_content_e].result == f_console_result_found_e) {
if (main->error.verbosity > f_console_verbosity_quiet_e) {
- fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, fss_identify_long_content_s, fss_identify_long_total_s);
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, f_console_symbol_long_enable_s, f_console_symbol_long_enable_s, fss_identify_long_content_s, fss_identify_long_total_s);
}
status = F_status_set_error(F_parameter);
fll_program_print_help_option(print, fss_identify_short_name_s, fss_identify_long_name_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select FSS using this full or partial type name or code.");
fll_program_print_help_option(print, fss_identify_short_total_s, fss_identify_long_total_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "Print the total Identifiers found.");
+ f_print_dynamic_raw(f_string_eol_s, print.to.stream);
+ f_print_dynamic_raw(f_string_eol_s, print.to.stream);
+
fll_program_print_help_usage(print, fss_identify_program_name_s, fll_program_parameter_filenames_s);
fl_print_format("%r The %[%r%r%] parameter refers to the file lines and not the lines in a given file.%r%r", print.to.stream, f_string_eol_s, print.set->notable, f_console_symbol_long_enable_s, fss_identify_long_line_s, print.set->notable, f_string_eol_s, f_string_eol_s);
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* The output structure to print to.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The program main setting data.
+ *
* This does not alter setting.status.
*
* @return
* The main program data.
* @param setting
* The main program settings.
- * This does not alter setting.status.
* All buffers are deallocated.
*
+ * This does not alter setting.status.
+ *
* @return
* F_none on success.
*
if (main->parameters.array[parameter_code[i]].result == parameter_match[i]) {
if (main->error.verbosity > f_console_verbosity_quiet_e) {
- fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, fss_payload_read_long_columns_s, parameter_name[i]);
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, f_console_symbol_long_enable_s, fss_payload_read_long_columns_s, parameter_name[i]);
}
status = F_status_set_error(F_parameter);
if (F_status_is_error_not(status) && main->parameters.array[fss_payload_read_parameter_pipe_e].result == f_console_result_found_e) {
if (main->parameters.array[fss_payload_read_parameter_total_e].result == f_console_result_found_e) {
if (main->error.verbosity > f_console_verbosity_quiet_e) {
- fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, fss_payload_read_long_pipe_s, fss_payload_read_long_total_s);
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, f_console_symbol_long_enable_s, fss_payload_read_long_pipe_s, fss_payload_read_long_total_s);
}
status = F_status_set_error(F_parameter);
}
else if (main->parameters.array[fss_payload_read_parameter_line_e].result == f_console_result_additional_e) {
if (main->error.verbosity > f_console_verbosity_quiet_e) {
- fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, fss_payload_read_long_pipe_s, fss_payload_read_long_line_s);
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, f_console_symbol_long_enable_s, fss_payload_read_long_pipe_s, fss_payload_read_long_line_s);
}
status = F_status_set_error(F_parameter);
if (size_file) {
- // Enforce a max block read size to allow for interrupts to be processed beteween blocks.
+ // Enforce a max block read size to allow for interrupts to be processed between blocks.
if (size_file > fss_payload_read_block_max) {
file.size_read = fss_payload_read_block_read_large;
size_block = fss_payload_read_block_max;
fll_program_print_help_option(print, fss_payload_read_short_total_s, fss_payload_read_long_total_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the total number of lines.");
fll_program_print_help_option(print, fss_payload_read_short_trim_s, fss_payload_read_long_trim_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Trim Object names on select or print.");
+ f_print_dynamic_raw(f_string_eol_s, print.to.stream);
+ f_print_dynamic_raw(f_string_eol_s, print.to.stream);
+
fll_program_print_help_usage(print, fss_payload_read_program_name_s, fll_program_parameter_filenames_s);
fl_print_format("%r %[Notes:%]%r", print.to.stream, f_string_eol_s, print.set->important, print.set->important, f_string_eol_s);
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* The output structure to print to.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The program main setting data.
+ *
* This does not alter setting.status.
*
* @return
* The main program data.
* @param setting
* The main program settings.
- * This does not alter setting.status.
* All buffers are deallocated.
*
+ * This does not alter setting.status.
+ *
* @return
* F_none on success.
*
fll_program_print_help_option(print, fss_payload_write_short_single_s, fss_payload_write_long_single_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Use single quotes.");
fll_program_print_help_option(print, fss_payload_write_short_trim_s, fss_payload_write_long_trim_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Trim Object names.");
+ f_print_dynamic_raw(f_string_eol_s, print.to.stream);
+ f_print_dynamic_raw(f_string_eol_s, print.to.stream);
+
fll_program_print_help_usage(print, fss_payload_write_program_name_s, f_string_empty_s);
fl_print_format("%r The pipe uses the Backspace character '%[\\b%]' (%[U+0008%]) to designate the start of a Content.%r", print.to.stream, f_string_eol_s, print.set->notable, print.set->notable, print.set->notable, print.set->notable, f_string_eol_s);
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* The output structure to print to.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @return
* F_none on success.
- * F_failure (with error bit) for any othe failure.
+ * F_failure (with error bit) for any other failure.
*/
#ifndef _di_fss_payload_write_process_
extern f_status_t fss_payload_write_process(fll_program_data_t * const main, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, f_string_dynamic_t *buffer) F_attribute_visibility_internal_d;
*
* @return
* F_none on success.
- * F_failure (with error bit) for any othe failure.
+ * F_failure (with error bit) for any other failure.
*/
#ifndef _di_fss_payload_write_process_pipe_
extern f_status_t fss_payload_write_process_pipe(fll_program_data_t * const main, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer) F_attribute_visibility_internal_d;
setting->status = F_status_set_error(F_parameter);
fss_status_code_print_line_first_locked(setting, main->error);
- fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, fss_status_code_long_error_s, fss_status_code_long_fine_s);
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, f_console_symbol_long_enable_s, fss_status_code_long_error_s, fss_status_code_long_fine_s);
fss_status_code_print_line_last_locked(setting, main->error);
return;
setting->status = F_status_set_error(F_parameter);
fss_status_code_print_line_first_locked(setting, main->error);
- fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, fss_status_code_long_warning_s, fss_status_code_long_fine_s);
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, f_console_symbol_long_enable_s, fss_status_code_long_warning_s, fss_status_code_long_fine_s);
fss_status_code_print_line_last_locked(setting, main->error);
return;
*
* @param setting
* The program main setting data.
+ *
* This does not alter setting.status.
*
* @return
* The main program data.
* @param setting
* The main program settings.
- * This does not alter setting.status.
* All buffers are deallocated.
*
+ * This does not alter setting.status.
+ *
* @return
* F_none on success.
*
fll_program_print_help_option(print, fss_status_code_short_error_s, fss_status_code_long_error_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print F_true or F_false if status code is an error or print number with error code bit set.");
fll_program_print_help_option(print, fss_status_code_short_number_s, fss_status_code_long_number_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Convert status code name to number.");
+ f_print_dynamic_raw(f_string_eol_s, print.to.stream);
+ f_print_dynamic_raw(f_string_eol_s, print.to.stream);
+
fll_program_print_help_usage(print, fss_status_code_program_name_s, fss_status_code_program_help_parameters_s);
f_print_dynamic_raw(setting->line_last, print.to.stream);
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* The output structure to print to.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
const f_string_static_t iki_read_program_name_long_s = macro_f_string_static_t_initialize(IKI_READ_program_name_long_s, 0, IKI_READ_program_name_long_s_length);
#endif // _di_iki_read_program_name_
+#ifndef _di_iki_read_strings_
+ const f_string_static_t iki_read_string_two_s = macro_f_string_static_t_initialize(IKI_READ_string_two_s, 0, IKI_READ_string_two_s_length);
+ const f_string_static_t iki_read_string_three_s = macro_f_string_static_t_initialize(IKI_READ_string_three_s, 0, IKI_READ_string_three_s_length);
+#endif // _di_iki_read_strings_
+
#ifndef _di_iki_read_parameters_
const f_string_static_t iki_read_short_at_s = macro_f_string_static_t_initialize(IKI_READ_short_at_s, 0, IKI_READ_short_at_s_length);
const f_string_static_t iki_read_short_content_s = macro_f_string_static_t_initialize(IKI_READ_short_content_s, 0, IKI_READ_short_content_s_length);
if (!setting) return F_status_set_error(F_parameter);
+ f_string_dynamic_resize(0, &setting->buffer);
+ f_string_dynamics_resize(0, &setting->names);
+ f_string_dynamics_resize(0, &setting->files);
+
+ f_string_maps_resize(0, &setting->replace);
+ f_string_triples_resize(0, &setting->substitute);
+ f_string_triples_resize(0, &setting->wrap);
+
+ f_iki_data_delete(&setting->data);
+
return F_none;
}
#endif // _di_iki_read_setting_delete_
}
}
- f_string_static_t * const args = main->parameters.arguments.array;
-
- if (!(main->parameters.remaining.used || (main->pipe & fll_program_data_pipe_input_e)) {
+ if (!(main->parameters.remaining.used || (main->pipe & fll_program_data_pipe_input_e))) {
setting->status = F_status_set_error(F_parameter);
iki_read_print_line_first_locked(setting, main->error);
return;
}
- //if (main->parameters.array[iki_read_parameter_strip_invalid_e].result == f_console_result_found_e) {
- // setting->flag |= iki_read_main_flag_strip_invalid_e;
- //}
+ if (main->parameters.array[iki_read_parameter_at_e].result == f_console_result_additional_e) {
+ if (main->parameters.array[iki_read_parameter_whole_e].result == f_console_result_found_e) {
+ setting->status = F_status_set_error(F_parameter);
+
+ iki_read_print_line_first_locked(setting, main->error);
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, f_console_symbol_long_enable_s, iki_read_long_at_s, iki_read_long_whole_s);
+ iki_read_print_line_last_locked(setting, main->error);
+
+ return;
+ }
+
+ const f_array_length_t index = main->parameters.array[iki_read_parameter_at_e].values.array[main->parameters.array[iki_read_parameter_at_e].values.used - 1];
+
+ setting->at = 0;
+
+ setting->status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, main->parameters.arguments.array[index], &setting->at);
+
+ if (F_status_is_error(setting->status)) {
+ setting->status = F_status_set_error(F_parameter);
+
+ iki_read_print_line_first_locked(setting, main->error);
+ fll_program_print_error_parameter_integer_not(main->error, f_console_symbol_long_enable_s, iki_read_long_at_s, main->parameters.arguments.array[index]);
+ iki_read_print_line_last_locked(setting, main->error);
+
+ return;
+ }
+
+ setting->flag |= iki_read_main_flag_at_e;
+ }
+ else if (main->parameters.array[iki_read_parameter_at_e].result == f_console_result_found_e) {
+ setting->status = F_status_set_error(F_parameter);
+
+ iki_read_print_line_first_locked(setting, main->error);
+ fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_enable_s, iki_read_long_at_s);
+ iki_read_print_line_last_locked(setting, main->error);
+
+ return;
+ }
+
+ if (main->parameters.array[iki_read_parameter_line_e].result == f_console_result_additional_e) {
+ const f_array_length_t index = main->parameters.array[iki_read_parameter_line_e].values.array[main->parameters.array[iki_read_parameter_line_e].values.used - 1];
+
+ setting->line = 0;
+
+ setting->status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, main->parameters.arguments.array[index], &setting->line);
+
+ if (F_status_is_error(setting->status)) {
+ setting->status = F_status_set_error(F_parameter);
+
+ iki_read_print_line_first_locked(setting, main->error);
+ fll_program_print_error_parameter_integer_not(main->error, f_console_symbol_long_enable_s, iki_read_long_line_s, main->parameters.arguments.array[index]);
+ iki_read_print_line_last_locked(setting, main->error);
+
+ return;
+ }
+
+ setting->flag |= iki_read_main_flag_line_e;
+ }
+ else if (main->parameters.array[iki_read_parameter_line_e].result == f_console_result_found_e) {
+ setting->status = F_status_set_error(F_parameter);
+
+ iki_read_print_line_first_locked(setting, main->error);
+ fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_enable_s, iki_read_long_line_s);
+ iki_read_print_line_last_locked(setting, main->error);
+
+ return;
+ }
+
+ if (main->parameters.array[iki_read_parameter_name_e].result == f_console_result_additional_e) {
+ setting->names.used = 0;
+
+ setting->status = f_string_dynamics_increase_by(main->parameters.array[iki_read_parameter_name_e].values.used, &setting->names);
+
+ if (F_status_is_error(setting->status)) {
+ iki_read_print_line_first_locked(setting, main->error);
+ fll_error_print(main->error, F_status_set_fine(setting->status), "f_string_dynamics_increase_by", F_true);
+ iki_read_print_line_last_locked(setting, main->error);
+
+ return;
+ }
+
+ // Distinctly append all names.
+ f_array_length_t i = 0;
+ f_array_length_t j = 0;
+ f_array_lengths_t *values = &main->parameters.array[iki_read_parameter_name_e].values;
+
+ for (; i < values->used; ++i) {
+
+ for (j = 0; j < setting->names.used; ++j) {
+ if (fl_string_dynamic_compare(main->parameters.arguments.array[values->array[i]], setting->names.array[j]) == F_equal_to) break;
+ } // for
+
+ if (j < setting->names.used) continue;
+
+ setting->names.array[setting->names.used].used = 0;
+
+ if (main->parameters.arguments.array[values->array[i]].used) {
+ setting->status = f_string_dynamics_append(main->parameters.arguments.array[values->array[i]], &setting->names);
+ if (F_status_is_error(setting->status)) break;
+ }
+ else {
+ setting->status = f_string_dynamics_append(f_string_empty_s, &setting->names);
+ if (F_status_is_error(setting->status)) break;
+ }
+ } // for
+
+ if (F_status_is_error(setting->status)) {
+ iki_read_print_line_first_locked(setting, main->error);
+ fll_error_print(main->error, F_status_set_fine(setting->status), "f_string_dynamics_append", F_true);
+ iki_read_print_line_last_locked(setting, main->error);
+
+ return;
+ }
+
+ setting->flag |= iki_read_main_flag_name_e;
+ }
+ else if (main->parameters.array[iki_read_parameter_name_e].result == f_console_result_found_e) {
+ setting->status = F_status_set_error(F_parameter);
+
+ iki_read_print_line_first_locked(setting, main->error);
+ fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_short_enable_s, iki_read_long_name_s);
+ iki_read_print_line_last_locked(setting, main->error);
+
+ return;
+ }
+
+ if (main->parameters.array[iki_read_parameter_replace_e].result != f_console_result_none_e) {
+ if (main->parameters.array[iki_read_parameter_replace_e].result == f_console_result_found_e || main->parameters.array[iki_read_parameter_replace_e].values.used % 2 != 0) {
+ setting->status = F_status_set_error(F_parameter);
+
+ iki_read_print_line_first_locked(setting, main->error);
+ fll_program_print_error_parameter_missing_value_requires_amount(main->error, f_console_symbol_short_enable_s, iki_read_long_replace_s, iki_read_string_two_s);
+ iki_read_print_line_last_locked(setting, main->error);
+
+ return;
+ }
+
+ const f_array_length_t total = main->parameters.array[iki_read_parameter_replace_e].values.used % 2;
+
+ setting->replace.used = 0;
+
+ setting->status = f_string_maps_resize(total, &setting->replace);
+
+ if (F_status_is_error(setting->status)) {
+ iki_read_print_line_first_locked(setting, main->error);
+ fll_error_print(main->error, F_status_set_fine(setting->status), "f_string_maps_resize", F_true);
+ iki_read_print_line_last_locked(setting, main->error);
+
+ return;
+ }
+
+ f_array_length_t at = 0;
+ f_array_length_t index = 0;
+ f_array_length_t i = 0;
+ f_array_length_t j = 0;
+
+ for (; i < total; ++i) {
+
+ // Replace any existing values so that each name exists only once.
+ for (j = 0; j < setting->replace.used; ++j) {
+ if (fl_string_dynamic_compare(main->parameters.arguments.array[i], setting->replace.array[j].name) == F_equal_to) break;
+ } // for
+
+ at = j;
+
+ // Static strings are being used, so if a dynamic string exists (size > 0), then de-allocate it.
+ if (setting->replace.array[at].name.size) {
+ setting->status = f_string_dynamic_resize(0, &setting->replace.array[at].name);
+ }
+
+ if (F_status_is_error_not(setting->status) && setting->replace.array[at].value.size) {
+ setting->status = f_string_dynamic_resize(0, &setting->replace.array[at].value);
+ }
+
+ if (F_status_is_error(setting->status)) {
+ iki_read_print_line_first_locked(setting, main->error);
+ fll_error_print(main->error, F_status_set_fine(setting->status), "f_string_dynamic_resize", F_true);
+ iki_read_print_line_last_locked(setting, main->error);
+
+ return;
+ }
+
+ index = main->parameters.array[iki_read_parameter_replace_e].values.array[i];
+
+ setting->replace.array[at].name.string = main->parameters.arguments.array[index].string;
+ setting->replace.array[at].name.used = main->parameters.arguments.array[index].used;
+ setting->replace.array[at].name.size = 0;
+
+ index = main->parameters.array[iki_read_parameter_replace_e].values.array[i + 1];
+
+ setting->replace.array[at].value.string = main->parameters.arguments.array[index].string;
+ setting->replace.array[at].value.used = main->parameters.arguments.array[index].used;
+ setting->replace.array[at].value.size = 0;
+
+ if (at == setting->wrap.used) {
+ ++setting->wrap.used;
+ }
+ } // for
+
+ setting->flag |= iki_read_main_flag_replace_e;
+ }
+
+ if (main->parameters.array[iki_read_parameter_substitute_e].result != f_console_result_none_e) {
+ if (main->parameters.array[iki_read_parameter_substitute_e].result == f_console_result_found_e || main->parameters.array[iki_read_parameter_substitute_e].values.used % 3 != 0) {
+ setting->status = F_status_set_error(F_parameter);
+
+ iki_read_print_line_first_locked(setting, main->error);
+ fll_program_print_error_parameter_missing_value_requires_amount(main->error, f_console_symbol_short_enable_s, iki_read_long_substitute_s, iki_read_string_three_s);
+ iki_read_print_line_last_locked(setting, main->error);
+
+ return;
+ }
+
+ const f_array_length_t total = main->parameters.array[iki_read_parameter_substitute_e].values.used % 3;
+
+ setting->substitute.used = 0;
+
+ setting->status = f_string_triples_resize(total, &setting->substitute);
+
+ if (F_status_is_error(setting->status)) {
+ iki_read_print_line_first_locked(setting, main->error);
+ fll_error_print(main->error, F_status_set_fine(setting->status), "f_string_triples_resize", F_true);
+ iki_read_print_line_last_locked(setting, main->error);
+
+ return;
+ }
+
+ f_array_length_t at = 0;
+ f_array_length_t index = 0;
+ f_array_length_t i = 0;
+ f_array_length_t j = 0;
+
+ for (; i < total; ++i) {
+
+ index = main->parameters.array[iki_read_parameter_substitute_e].values.array[i];
+
+ // Replace any existing values so that each name and value pair exists only once.
+ for (j = 0; j < setting->substitute.used; ++j) {
+
+ if (fl_string_dynamic_compare(main->parameters.arguments.array[index], setting->substitute.array[j].a) == F_equal_to) {
+ if (fl_string_dynamic_compare(main->parameters.arguments.array[main->parameters.array[iki_read_parameter_substitute_e].values.array[i + 1]], setting->substitute.array[j].b) == F_equal_to) {
+ break;
+ }
+ }
+ } // for
+
+ at = j;
+
+ // Static strings are being used, so if a dynamic string exists (size > 0), then de-allocate it.
+ if (setting->substitute.array[at].a.size) {
+ setting->status = f_string_dynamic_resize(0, &setting->substitute.array[at].a);
+ }
+
+ if (F_status_is_error_not(setting->status) && setting->substitute.array[at].b.size) {
+ setting->status = f_string_dynamic_resize(0, &setting->substitute.array[at].b);
+ }
+
+ if (F_status_is_error_not(setting->status) && setting->substitute.array[at].c.size) {
+ setting->status = f_string_dynamic_resize(0, &setting->substitute.array[at].c);
+ }
+
+ if (F_status_is_error(setting->status)) {
+ iki_read_print_line_first_locked(setting, main->error);
+ fll_error_print(main->error, F_status_set_fine(setting->status), "f_string_dynamic_resize", F_true);
+ iki_read_print_line_last_locked(setting, main->error);
+
+ return;
+ }
+
+ setting->substitute.array[at].a.string = main->parameters.arguments.array[index].string;
+ setting->substitute.array[at].a.used = main->parameters.arguments.array[index].used;
+ setting->substitute.array[at].a.size = 0;
+
+ index = main->parameters.array[iki_read_parameter_substitute_e].values.array[i + 1];
+
+ setting->substitute.array[at].b.string = main->parameters.arguments.array[index].string;
+ setting->substitute.array[at].b.used = main->parameters.arguments.array[index].used;
+ setting->substitute.array[at].b.size = 0;
+
+ index = main->parameters.array[iki_read_parameter_substitute_e].values.array[i + 2];
+
+ setting->substitute.array[at].c.string = main->parameters.arguments.array[index].string;
+ setting->substitute.array[at].c.used = main->parameters.arguments.array[index].used;
+ setting->substitute.array[at].c.size = 0;
+
+ if (at == setting->wrap.used) {
+ ++setting->wrap.used;
+ }
+ } // for
+
+ setting->flag |= iki_read_main_flag_substitute_e;
+ }
+
+ if (main->parameters.array[iki_read_parameter_wrap_e].result != f_console_result_none_e) {
+ if (main->parameters.array[iki_read_parameter_wrap_e].result == f_console_result_found_e || main->parameters.array[iki_read_parameter_wrap_e].values.used % 3 != 0) {
+ setting->status = F_status_set_error(F_parameter);
+
+ iki_read_print_line_first_locked(setting, main->error);
+ fll_program_print_error_parameter_missing_value_requires_amount(main->error, f_console_symbol_short_enable_s, iki_read_long_wrap_s, iki_read_string_three_s);
+ iki_read_print_line_last_locked(setting, main->error);
+
+ return;
+ }
+
+ const f_array_length_t total = main->parameters.array[iki_read_parameter_wrap_e].values.used % 3;
+
+ setting->wrap.used = 0;
+
+ setting->status = f_string_triples_resize(total, &setting->wrap);
+
+ if (F_status_is_error(setting->status)) {
+ iki_read_print_line_first_locked(setting, main->error);
+ fll_error_print(main->error, F_status_set_fine(setting->status), "f_string_triples_resize", F_true);
+ iki_read_print_line_last_locked(setting, main->error);
+
+ return;
+ }
+
+ f_array_length_t at = 0;
+ f_array_length_t index = 0;
+ f_array_length_t i = 0;
+ f_array_length_t j = 0;
+
+ for (; i < total; ++i) {
+
+ index = main->parameters.array[iki_read_parameter_wrap_e].values.array[i];
+
+ // Replace any existing values so that each name exists only once.
+ for (j = 0; j < setting->wrap.used; ++j) {
+ if (fl_string_dynamic_compare(main->parameters.arguments.array[index], setting->wrap.array[j].a) == F_equal_to) break;
+ } // for
+
+ at = j;
+
+ // Static strings are being used, so if a dynamic string exists (size > 0), then de-allocate it.
+ if (setting->wrap.array[at].a.size) {
+ setting->status = f_string_dynamic_resize(0, &setting->wrap.array[at].a);
+ }
+
+ if (F_status_is_error_not(setting->status) && setting->wrap.array[at].b.size) {
+ setting->status = f_string_dynamic_resize(0, &setting->wrap.array[at].b);
+ }
+
+ if (F_status_is_error_not(setting->status) && setting->wrap.array[at].c.size) {
+ setting->status = f_string_dynamic_resize(0, &setting->wrap.array[at].c);
+ }
+
+ if (F_status_is_error(setting->status)) {
+ iki_read_print_line_first_locked(setting, main->error);
+ fll_error_print(main->error, F_status_set_fine(setting->status), "f_string_dynamic_resize", F_true);
+ iki_read_print_line_last_locked(setting, main->error);
+
+ return;
+ }
+
+ setting->wrap.array[at].a.string = main->parameters.arguments.array[index].string;
+ setting->wrap.array[at].a.used = main->parameters.arguments.array[index].used;
+ setting->wrap.array[at].a.size = 0;
+
+ index = main->parameters.array[iki_read_parameter_wrap_e].values.array[i + 1];
+
+ setting->wrap.array[at].b.string = main->parameters.arguments.array[index].string;
+ setting->wrap.array[at].b.used = main->parameters.arguments.array[index].used;
+ setting->wrap.array[at].b.size = 0;
+
+ index = main->parameters.array[iki_read_parameter_wrap_e].values.array[i + 2];
+
+ setting->wrap.array[at].c.string = main->parameters.arguments.array[index].string;
+ setting->wrap.array[at].c.used = main->parameters.arguments.array[index].used;
+ setting->wrap.array[at].c.size = 0;
+
+ if (at == setting->wrap.used) {
+ ++setting->wrap.used;
+ }
+ } // for
+
+ setting->flag |= iki_read_main_flag_wrap_e;
+ }
+
+ if (main->parameters.array[iki_read_parameter_literal_e].result == f_console_result_found_e) {
+ const uint8_t ids[3] = {
+ iki_read_parameter_object_e,
+ iki_read_parameter_content_e,
+ iki_read_parameter_total_e,
+ };
+
+ const f_string_static_t names[3] = {
+ iki_read_long_object_s,
+ iki_read_long_content_s,
+ iki_read_long_total_s,
+ };
+
+ for (uint8_t i = 0; i < 3; ++i) {
+
+ if (main->parameters.array[ids[i]].result == f_console_result_found_e) {
+ setting->status = F_status_set_error(F_parameter);
+
+ iki_read_print_line_first_locked(setting, main->error);
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, f_console_symbol_long_enable_s, iki_read_long_literal_s, names[i]);
+ iki_read_print_line_last_locked(setting, main->error);
+
+ return;
+ }
+ } // for
+
+ setting->flag |= iki_read_main_flag_literal_e;
+ }
+ else if (main->parameters.array[iki_read_parameter_object_e].result == f_console_result_found_e) {
+ const uint8_t ids[2] = {
+ iki_read_parameter_content_e,
+ iki_read_parameter_total_e,
+ };
+
+ const f_string_static_t names[2] = {
+ iki_read_long_content_s,
+ iki_read_long_total_s,
+ };
+
+ for (uint8_t i = 0; i < 2; ++i) {
+
+ if (main->parameters.array[ids[i]].result == f_console_result_found_e) {
+ setting->status = F_status_set_error(F_parameter);
+
+ iki_read_print_line_first_locked(setting, main->error);
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, f_console_symbol_long_enable_s, iki_read_long_object_s, names[i]);
+ iki_read_print_line_last_locked(setting, main->error);
+
+ return;
+ }
+ } // for
+
+ setting->flag |= iki_read_main_flag_object_e;
+ }
+ else if (main->parameters.array[iki_read_parameter_content_e].result == f_console_result_found_e) {
+ if (main->parameters.array[iki_read_parameter_total_e].result == f_console_result_found_e) {
+ setting->status = F_status_set_error(F_parameter);
+
+ iki_read_print_line_first_locked(setting, main->error);
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, f_console_symbol_long_enable_s, iki_read_long_content_s, iki_read_long_total_s);
+ iki_read_print_line_last_locked(setting, main->error);
+
+ return;
+ }
+
+ setting->flag |= iki_read_main_flag_content_e;
+ }
+ else if (main->parameters.array[iki_read_parameter_total_e].result == f_console_result_found_e) {
+ if (main->parameters.array[iki_read_parameter_whole_e].result == f_console_result_found_e) {
+ setting->status = F_status_set_error(F_parameter);
+
+ iki_read_print_line_first_locked(setting, main->error);
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, f_console_symbol_long_enable_s, iki_read_long_total_s, iki_read_long_wrap_s);
+ iki_read_print_line_last_locked(setting, main->error);
+
+ return;
+ }
+
+ setting->flag |= iki_read_main_flag_total_e;
+ }
+ else {
+
+ // This is the default behavior.
+ setting->flag |= iki_read_main_flag_content_e;
+ }
+
+ if (main->parameters.remaining.used) {
+ setting->files.used = 0;
+
+ setting->status = f_string_dynamics_resize(main->parameters.remaining.used, &setting->files);
+
+ if (F_status_is_error(setting->status)) {
+ iki_read_print_line_first_locked(setting, main->error);
+ fll_error_print(main->error, F_status_set_fine(setting->status), "f_string_dynamics_resize", F_true);
+ iki_read_print_line_last_locked(setting, main->error);
+
+ return;
+ }
+
+ f_array_length_t index = 0;
+
+ for (f_array_length_t i = 0; i < main->parameters.remaining.used; ++i, ++setting->files.used) {
+
+ // Static strings are being used, so if a dynamic string exists (size > 0), then de-allocate it.
+ if (setting->files.array[setting->files.used].size) {
+ setting->status = f_string_dynamic_resize(0, &setting->files.array[setting->files.used]);
+
+ if (F_status_is_error(setting->status)) {
+ iki_read_print_line_first_locked(setting, main->error);
+ fll_error_print(main->error, F_status_set_fine(setting->status), "f_string_dynamic_resize", F_true);
+ iki_read_print_line_last_locked(setting, main->error);
+
+ return;
+ }
+ }
+
+ index = main->parameters.remaining.array[i];
+
+ setting->files.array[setting->files.used].string = main->parameters.arguments.array[index].string;
+ setting->files.array[setting->files.used].used = main->parameters.arguments.array[index].used;
+ setting->files.array[setting->files.used].size = 0;
+
+ setting->status = f_file_exists(setting->files.array[setting->files.used], F_true);
+
+ if (F_status_is_error(setting->status)) {
+ iki_read_print_line_first_locked(setting, main->error);
+ fll_error_file_print(main->error, F_status_set_fine(setting->status), "f_file_exists", F_true, setting->files.array[setting->files.used], f_file_operation_verify_s, fll_error_file_type_file_e);
+ iki_read_print_line_last_locked(setting, main->error);
+
+ return;
+ }
+ } // for
+ }
}
#endif // _di_iki_read_setting_load_
*/
#ifndef _di_iki_read_defines_
#define iki_read_signal_check_d 20000
-
- enum {
- iki_read_mode_content_e = 1,
- iki_read_mode_literal_e,
- iki_read_mode_object_e,
- iki_read_mode_total_e,
- };
#endif // _di_iki_read_defines_
/**
+ * A collection of static strings associated with IKI Read.
+ */
+#ifndef _di_iki_read_strings_
+ #define IKI_READ_string_two_s "two"
+ #define IKI_READ_string_three_s "three"
+
+ #define IKI_READ_string_two_s_length 3
+ #define IKI_READ_string_three_s_length 5
+
+ extern const f_string_static_t iki_read_string_two_s;
+ extern const f_string_static_t iki_read_string_three_s;
+#endif // _di_iki_read_strings_
+
+/**
* The main program parameters.
*/
#ifndef _di_iki_read_parameters_
#define iki_read_console_parameter_t_initialize \
{ \
- mac
macro_f_console_parameter_t_initialize4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_type_normal_e), \
macro_f_console_parameter_t_initialize4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_type_inverse_e), \
macro_f_console_parameter_t_initialize4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_type_inverse_e), \
extern const f_string_static_t iki_read_substitution_replace_s;
extern const f_string_static_t iki_read_substitution_vocabulary_s;
extern const f_string_static_t iki_read_substitution_with_s;
-
- typedef struct {
- f_string_static_t replace;
- f_string_static_t with;
- } iki_read_substitution_t;
-
- #define iki_read_substitution_t_initialize \
- { \
- f_string_static_t_initialize, \
- f_string_static_t_initialize, \
- }
-
- #define macro_iki_read_substitution_t_initialize(replace, with, extra) \
- { \
- replace, \
- with, \
- }
#endif // _di_iki_read_substitution_t_
-#ifndef _di_iki_read_substitutions_t_
- typedef struct {
- iki_read_substitution_t *array;
-
- f_array_length_t size;
- f_array_length_t used;
- } iki_read_substitutions_t;
-
- #define iki_read_substitutions_t_initialize { 0, 0, 0 }
-
- #define macro_iki_read_substitutions_t_clear(replacements) macro_f_memory_structure_clear(replacements)
-
- #define macro_iki_read_substitutions_t_delete_simple(replacements) macro_f_memory_structure_delete_simple(replacements, iki_read_substitution_t)
- #define macro_iki_read_substitutions_t_destroy_simple(replacements) macro_f_memory_structure_destroy_simple(replacements, iki_read_substitution_t)
-
- #define macro_iki_read_substitutions_t_resize(status, replacements, length) macro_f_memory_structure_resize(status, replacements, iki_read_substitution_t, length)
- #define macro_iki_read_substitutions_t_adjust(status, replacements, length) macro_f_memory_structure_adjust(status, replacements, iki_read_substitution_t, length)
-#endif // _di_iki_read_substitutions_t_
-
/**
* Flags used to represent flags passed to the main function.
*
* iki_read_main_flag_*_e:
- * - none: No modes in use.
- * - file_from: Using a specified source file.
- * - file_to: Using a specified destination file.
- * - help: Print help.
- * - header: Enable printing of headers.
- * - separate: Enable printing of separators.
- * - strip_invalid: Using strip invalid character mode.
- * - verify: Using verify mode.
- * - version: Print version.
+ * - none: No modes in use.
+ * - at: Selecting at a specific index.
+ * - content: Print Contents.
+ * - help: Print help.
+ * - literal: Print as literal data (printing entire variable).
+ * - line: Selecting at a specific line.
+ * - name: Selecting using a specific Vocabulary name.
+ * - object: Print Objects.
+ * - replace: Using replacements.
+ * - substitute: Using substitutions.
+ * - total: Enable printing of "total" count.
+ * - version: Print version.
+ * - whole: Print all data.
+ * - wrap: Using wrapping.
*/
#ifndef _di_iki_read_main_flag_e_
enum {
- iki_read_main_flag_none_e = 0x0,
- iki_read_main_flag_file_from_e = 0x1,
- iki_read_main_flag_file_to_e = 0x2,
- iki_read_main_flag_header_e = 0x4,
- iki_read_main_flag_help_e = 0x8,
- iki_read_main_flag_separate_e = 0x10,
- iki_read_main_flag_strip_invalid_e = 0x20,
- iki_read_main_flag_verify_e = 0x40,
- iki_read_main_flag_version_e = 0x80,
+ iki_read_main_flag_none_e = 0x0,
+ iki_read_main_flag_at_e = 0x1,
+ iki_read_main_flag_content_e = 0x2,
+ iki_read_main_flag_help_e = 0x4,
+ iki_read_main_flag_literal_e = 0x8,
+ iki_read_main_flag_line_e = 0x10,
+ iki_read_main_flag_name_e = 0x20,
+ iki_read_main_flag_object_e = 0x40,
+ iki_read_main_flag_replace_e = 0x80,
+ iki_read_main_flag_substitute_e = 0x100,
+ iki_read_main_flag_total_e = 0x200,
+ iki_read_main_flag_version_e = 0x400,
+ iki_read_main_flag_whole_e = 0x800,
+ iki_read_main_flag_wrap_e = 0x1000,
};
#endif // _di_iki_read_main_flag_e_
*
* status: The main status code, generally used by the load settings and main functions.
*
+ * at: The position representing the "at" index.
+ * line: The position representing the "line" index.
+ *
* line_first: A string expected to represent either "\n" or NULL to allow for easy handling of when to print first new line or not.
* line_last: A string expected to represent either "\n" or NULL to allow for easy handling of when to print last new line or not.
+ *
+ * buffer: A buffer used for loading the files and other miscellaneous tasks.
+ * name: A string representing the IKI vocabulary name being selected.
+ * files: An array of all files to process (except for the input pipe).
+ *
+ * replace: A map containing the Vocabulary name and its replacement as the value.
+ * substitute: A triple containing the Vocabulary name (a), Content to match (b), and the string used as the substitute (c).
+ * wrap: A triple containing the Vocabulary name (a), the string to prepend (b), and the string to append (c).
+ *
+ * map_replaces: A pointer representing an array with length of setting->data.vocabulary.used mapping the vocabulary location to a replace array location.
+ * map_wraps: A pointer representing an array with length of setting->data.vocabulary.used mapping the vocabulary location to a wrap array location.
+ *
+ * data: The loaded IKI data.
*/
#ifndef _di_iki_read_setting_t_
typedef struct {
f_status_t status;
+ f_array_length_t at;
+ f_array_length_t line;
+
f_string_static_t line_first;
f_string_static_t line_last;
+
+ f_string_dynamic_t buffer;
+ f_string_dynamics_t names;
+ f_string_dynamics_t files;
+
+ f_string_maps_t replace;
+ f_string_triples_t substitute;
+ f_string_triples_t wrap;
+
+ f_array_length_t *map_replaces;
+ f_array_length_t *map_wraps;
+
+ f_iki_data_t data;
} iki_read_setting_t;
#define iki_read_setting_t_initialize \
{ \
iki_read_main_flag_none_e, \
F_none, \
+ 0, \
+ 0, \
f_string_static_t_initialize, \
f_string_static_t_initialize, \
+ f_string_dynamic_t_initialize, \
+ f_string_dynamic_t_initialize, \
+ f_string_dynamics_t_initialize, \
+ f_string_maps_t_initialize, \
+ f_string_triples_t_initialize, \
+ f_string_triples_t_initialize, \
+ 0, \
+ 0, \
+ f_iki_data_t_initialize, \
}
#endif // _di_iki_read_setting_t_
*
* @param setting
* The program main setting data.
+ *
* This does not alter setting.status.
*
* @return
* F_none on success.
*
* Errors (with error bit) from: f_console_parameter_process().
+ * Errors (with error bit) from: f_file_exists().
+ * Errors (with error bit) from: f_string_dynamic_append().
+ * Errors (with error bit) from: f_string_dynamic_resize().
+ * Errors (with error bit) from: f_string_maps_resize().
+ * Errors (with error bit) from: f_string_triples_resize().
* Errors (with error bit) from: fll_program_parameter_process_context().
+ * Errors (with error bit) from: fll_program_parameter_process_verbosity().
*
* @see f_console_parameter_process()
+ * @see f_file_exists()
+ * @see f_string_dynamic_append()
+ * @see f_string_dynamic_resize()
+ * @see f_string_maps_resize()
+ * @see f_string_triples_resize()
* @see fll_program_parameter_process_context()
+ * @see fll_program_parameter_process_verbosity()
*/
#ifndef _di_iki_read_setting_load_
extern void iki_read_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, iki_read_setting_t * const setting);
* The main program data.
* @param setting
* The main program settings.
- * This does not alter setting.status.
* All buffers are deallocated.
*
+ * This does not alter setting.status.
+ *
* @return
* F_none on success.
*
#endif
#ifndef _di_iki_read_main_
- f_status_t iki_read_main(fll_program_data_t * const main, iki_read_setting_t * const setting) {
+ void iki_read_main(fll_program_data_t * const main, iki_read_setting_t * const setting) {
if (!main || !setting || F_status_is_error(setting->status)) return;
return;
}
- // ...
- //if (main->pipe & fll_program_data_pipe_input_e) {
+ if (main->pipe & fll_program_data_pipe_input_e) {
+ f_file_t file = f_file_t_initialize;
- // XXXXXXXXXXXXXXXXXXXX
+ file.id = F_type_descriptor_input_d;
- iki_read_data_t data = iki_read_data_t_initialize;
- data.main = main;
- data.argv = main->parameters.arguments.array;
+ setting->buffer.used = 0;
- status = F_none;
+ setting->status = f_file_read(file, &setting->buffer);
- if (main->parameters.remaining.used > 0 || (main->pipe & fll_program_data_pipe_input_e)) {
- if (main->parameters.array[iki_read_parameter_at_e].result == f_console_result_found_e) {
- if (main->error.verbosity > f_console_verbosity_quiet_e) {
- f_file_stream_lock(main->error.to);
-
- fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
- fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_at_s, main->error.notable);
- fl_print_format("%[' requires a positive number.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
-
- f_file_stream_unlock(main->error.to);
- }
-
- status = F_status_set_error(F_parameter);
- }
- else if (main->parameters.array[iki_read_parameter_at_e].result == f_console_result_additional_e) {
- const f_array_length_t index = main->parameters.array[iki_read_parameter_at_e].values.array[main->parameters.array[iki_read_parameter_at_e].values.used - 1];
-
- f_number_unsigned_t number = 0;
-
- status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, data.argv[index], &number);
-
- if (F_status_is_error(status)) {
- fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_unsigned_detect", F_true, iki_read_long_at_s, data.argv[index]);
-
- status = F_status_set_error(F_parameter);
- }
-
- data.at = number;
-
- if (main->parameters.array[iki_read_parameter_whole_e].result == f_console_result_found_e) {
- if (main->error.verbosity > f_console_verbosity_quiet_e) {
- fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, iki_read_long_at_s, iki_read_long_whole_s);
- }
-
- status = F_status_set_error(F_parameter);
- }
+ if (F_status_is_error(setting->status)) {
+ iki_read_print_line_first_locked(setting, main->error);
+ fll_error_file_print(main->error, F_status_set_fine(setting->status), "f_file_read", F_true, f_string_ascii_minus_s, f_file_operation_process_s, fll_error_file_type_file_e);
+ iki_read_print_line_last_locked(setting, main->error);
}
-
- if (main->parameters.array[iki_read_parameter_line_e].result == f_console_result_found_e) {
- if (main->error.verbosity > f_console_verbosity_quiet_e) {
- f_file_stream_lock(main->error.to);
-
- fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
- fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_line_s, main->error.notable);
- fl_print_format("%[' requires a positive number.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
-
- f_file_stream_unlock(main->error.to);
- }
-
- status = F_status_set_error(F_parameter);
- }
- else if (main->parameters.array[iki_read_parameter_line_e].result == f_console_result_additional_e) {
- const f_array_length_t index = main->parameters.array[iki_read_parameter_line_e].values.array[main->parameters.array[iki_read_parameter_line_e].values.used - 1];
-
- f_number_unsigned_t number = 0;
-
- status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, data.argv[index], &number);
-
- if (F_status_is_error(status)) {
- fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_unsigned_detect", F_true, iki_read_long_line_s, data.argv[index]);
-
- status = F_status_set_error(F_parameter);
- }
-
- data.line = number;
- }
-
- if (main->parameters.array[iki_read_parameter_name_e].result == f_console_result_found_e) {
- if (main->error.verbosity > f_console_verbosity_quiet_e) {
- f_file_stream_lock(main->error.to);
-
- fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
- fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_name_s, main->error.notable);
- fl_print_format("%[' requires a string.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
-
- f_file_stream_unlock(main->error.to);
- }
-
- status = F_status_set_error(F_parameter);
+ else {
+ iki_read_process_buffer(main, setting);
+ if (F_status_is_error(setting->status)) return;
}
+ }
- if (main->parameters.array[iki_read_parameter_replace_e].result != f_console_result_none_e) {
- if (main->parameters.array[iki_read_parameter_replace_e].result == f_console_result_found_e || main->parameters.array[iki_read_parameter_replace_e].values.used % 2 != 0) {
- if (main->error.verbosity > f_console_verbosity_quiet_e) {
- f_file_stream_lock(main->error.to);
+ if (setting->files.used) {
+ f_file_t file = f_file_t_initialize;
+ off_t size_block = 0;
+ off_t size_file = 0;
+ off_t size_read = 0;
- fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
- fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_replace_s, main->error.notable);
- fl_print_format("%[' requires 2 strings.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
+ for (f_array_length_t i = 0; i < setting->files.used; ++i) {
- f_file_stream_unlock(main->error.to);
- }
+ if (!((++main->signal_check) % iki_read_signal_check_d)) {
+ if (fll_program_standard_signal_received(main)) {
+ fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received);
- status = F_status_set_error(F_parameter);
- }
+ setting->status = F_status_set_error(F_interrupt);
- if (main->parameters.array[iki_read_parameter_total_e].result == f_console_result_found_e) {
- if (main->error.verbosity > f_console_verbosity_quiet_e) {
- fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, iki_read_long_replace_s, iki_read_long_total_s);
+ return;
}
- status = F_status_set_error(F_parameter);
+ main->signal_check = 0;
}
- }
- if (main->parameters.array[iki_read_parameter_substitute_e].result != f_console_result_none_e) {
- if (main->parameters.array[iki_read_parameter_substitute_e].result == f_console_result_found_e || main->parameters.array[iki_read_parameter_substitute_e].values.used % 3 != 0) {
- if (main->error.verbosity > f_console_verbosity_quiet_e) {
- f_file_stream_lock(main->error.to);
+ file.stream = 0;
+ file.id = -1;
- fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
- fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_substitute_s, main->error.notable);
- fl_print_format("%[' requires 3 strings.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
+ setting->status = f_file_stream_open(setting->files.array[i], f_string_empty_s, &file);
- f_file_stream_unlock(main->error.to);
- }
+ if (F_status_is_error(setting->status)) {
+ iki_read_print_line_first_locked(setting, main->error);
+ fll_error_file_print(main->error, F_status_set_fine(setting->status), "f_file_stream_open", F_true, setting->files.array[i], f_file_operation_process_s, fll_error_file_type_file_e);
+ iki_read_print_line_last_locked(setting, main->error);
- status = F_status_set_error(F_parameter);
+ return;
}
- if (main->parameters.array[iki_read_parameter_total_e].result == f_console_result_found_e) {
- if (main->error.verbosity > f_console_verbosity_quiet_e) {
- fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, iki_read_long_substitute_s, iki_read_long_total_s);
- }
+ setting->status = f_file_descriptor(&file);
- status = F_status_set_error(F_parameter);
- }
- }
-
- if (main->parameters.array[iki_read_parameter_literal_e].result == f_console_result_found_e) {
- if (main->parameters.array[iki_read_parameter_object_e].result == f_console_result_found_e) {
- if (main->error.verbosity > f_console_verbosity_quiet_e) {
- fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, iki_read_long_literal_s, iki_read_long_object_s);
- }
+ if (F_status_is_error(setting->status)) {
+ iki_read_print_line_first_locked(setting, main->error);
+ fll_error_file_print(main->error, F_status_set_fine(setting->status), "f_file_descriptor", F_true, setting->files.array[i], f_file_operation_process_s, fll_error_file_type_file_e);
+ iki_read_print_line_last_locked(setting, main->error);
- status = F_status_set_error(F_parameter);
+ return;
}
- if (main->parameters.array[iki_read_parameter_content_e].result == f_console_result_found_e) {
- if (main->error.verbosity > f_console_verbosity_quiet_e) {
- fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, iki_read_long_literal_s, iki_read_long_content_s);
- }
-
- status = F_status_set_error(F_parameter);
- }
-
- if (main->parameters.array[iki_read_parameter_total_e].result == f_console_result_found_e) {
- if (main->error.verbosity > f_console_verbosity_quiet_e) {
- fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, iki_read_long_literal_s, iki_read_long_total_s);
- }
-
- status = F_status_set_error(F_parameter);
- }
+ size_file = 0;
- data.mode = iki_read_mode_literal_e;
- }
- else if (main->parameters.array[iki_read_parameter_object_e].result == f_console_result_found_e) {
- if (main->parameters.array[iki_read_parameter_content_e].result == f_console_result_found_e) {
- if (main->error.verbosity > f_console_verbosity_quiet_e) {
- fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, iki_read_long_object_s, iki_read_long_content_s);
- }
+ setting->status = f_file_size_by_id(file, &size_file);
- status = F_status_set_error(F_parameter);
- }
+ if (F_status_is_error(setting->status)) {
+ iki_read_print_line_first_locked(setting, main->error);
+ fll_error_file_print(main->error, F_status_set_fine(setting->status), "f_file_size_by_id", F_true, setting->files.array[i], f_file_operation_analyze_s, fll_error_file_type_file_e);
+ iki_read_print_line_last_locked(setting, main->error);
- if (main->parameters.array[iki_read_parameter_total_e].result == f_console_result_found_e) {
- if (main->error.verbosity > f_console_verbosity_quiet_e) {
- fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, iki_read_long_object_s, iki_read_long_total_s);
- }
-
- status = F_status_set_error(F_parameter);
+ break;
}
- data.mode = iki_read_mode_object_e;
- }
- else if (main->parameters.array[iki_read_parameter_total_e].result == f_console_result_found_e) {
- data.mode = iki_read_mode_total_e;
- }
- else {
-
- // This is the default behavior, so there is no reason to check for the -c/--content parameter.
- data.mode = iki_read_mode_content_e;
- }
-
- if (main->parameters.array[iki_read_parameter_whole_e].result == f_console_result_found_e) {
- if (main->parameters.array[iki_read_parameter_total_e].result == f_console_result_found_e) {
- if (main->error.verbosity > f_console_verbosity_quiet_e) {
- fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, iki_read_long_whole_s, iki_read_long_total_s);
- }
+ // Skip past empty files.
+ if (!size_file) {
+ f_file_stream_flush(file);
+ f_file_stream_close(&file);
- status = F_status_set_error(F_parameter);
+ continue;
}
- }
- if (F_status_is_error(status)) {
- if (main->error.verbosity > f_console_verbosity_quiet_e) {
- fll_print_dynamic_raw(f_string_eol_s, main->error.to.stream);
- }
-
- iki_read_data_delete(&data);
-
- return F_status_set_error(F_parameter);
- }
-
- if (main->pipe & fll_program_data_pipe_input_e) {
- f_file_t file = f_file_t_initialize;
-
- file.id = F_type_descriptor_input_d;
-
- status = f_file_read(file, &data.buffer);
-
- if (F_status_is_error(status)) {
- fll_error_file_print(main->error, F_status_set_fine(status), "f_file_read", F_true, f_string_ascii_minus_s, f_file_operation_process_s, fll_error_file_type_file_e);
+ // Enforce a max block read size to allow for interrupts to be processed between blocks.
+ if (size_file > iki_read_block_max) {
+ file.size_read = iki_read_block_read_large;
+ size_block = iki_read_block_max;
}
else {
- status = iki_read_process_buffer(&data);
+ file.size_read = iki_read_block_read_small;
+ size_block = size_file;
}
- // Clear buffers before continuing.
- f_string_dynamic_resize(0, &data.buffer);
- }
-
- if (F_status_is_fine(status) && main->parameters.remaining.used > 0) {
- f_file_t file = f_file_t_initialize;
- off_t size_block = 0;
- off_t size_file = 0;
- off_t size_read = 0;
-
- for (f_array_length_t i = 0; i < main->parameters.remaining.used; ++i) {
-
- if (!((++main->signal_check) % iki_read_signal_check_d)) {
- if (fll_program_standard_signal_received(main)) {
- fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received);
-
- status = F_status_set_error(F_interrupt);
-
- break;
- }
+ // Pre-allocate entire file buffer plus space for the terminating NULL.
+ setting->status = f_string_dynamic_increase_by(size_file + 1, &setting->buffer);
- main->signal_check = 0;
- }
-
- file.stream = 0;
- file.id = -1;
-
- status = f_file_stream_open(data.argv[main->parameters.remaining.array[i]], f_string_empty_s, &file);
-
- if (F_status_is_error(status)) {
- fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, data.argv[main->parameters.remaining.array[i]], f_file_operation_process_s, fll_error_file_type_file_e);
-
- break;
- }
+ if (F_status_is_error(setting->status)) {
+ iki_read_print_line_first_locked(setting, main->error);
+ fll_error_file_print(main->error, F_status_set_fine(setting->status), "f_string_dynamic_increase_by", F_true, setting->files.array[i], f_file_operation_process_s, fll_error_file_type_file_e);
+ iki_read_print_line_last_locked(setting, main->error);
- size_file = 0;
+ break;
+ }
- status = f_file_size_by_id(file.id, &size_file);
+ for (size_read = 0; size_read < size_file; size_read += size_block) {
- if (F_status_is_error(status)) {
- fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, data.argv[main->parameters.remaining.array[i]], f_file_operation_process_s, fll_error_file_type_file_e);
+ // The signal check is always performed on each pass.
+ if (size_file > iki_read_block_max && fll_program_standard_signal_received(main)) {
+ fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received);
- f_file_stream_flush(file);
- f_file_stream_close(&file);
+ setting->status = F_status_set_error(F_interrupt);
break;
}
- // Skip past empty files.
- if (!size_file) {
- f_file_stream_flush(file);
- f_file_stream_close(&file);
-
- continue;
- }
-
- // Enforce a max block read size to allow for interrupts to be processed beteween blocks.
- if (size_file > iki_read_block_max) {
- file.size_read = iki_read_block_read_large;
- size_block = iki_read_block_max;
- }
- else {
- file.size_read = iki_read_block_read_small;
- size_block = size_file;
- }
-
- // Pre-allocate entire file buffer plus space for the terminating NULL.
- f_string_dynamic_increase_by(size_file + 1, &data.buffer);
-
- if (F_status_is_error(status)) {
- fll_error_file_print(main->error, F_status_set_fine(status), "f_string_dynamic_resize", F_true, data.argv[main->parameters.remaining.array[i]], f_file_operation_process_s, fll_error_file_type_file_e);
-
- f_file_stream_flush(file);
- f_file_stream_close(&file);
+ setting->status = f_file_stream_read_until(file, size_block, &setting->buffer);
+ if (F_status_is_error(setting->status)) break;
+ } // for
- break;
+ if (F_status_is_error(setting->status)) {
+ if (F_status_set_fine(setting->status) != F_interrupt) {
+ iki_read_print_line_first_locked(setting, main->error);
+ fll_error_file_print(main->error, F_status_set_fine(setting->status), "f_file_stream_read_until", F_true, setting->files.array[i], f_file_operation_process_s, fll_error_file_type_file_e);
+ iki_read_print_line_last_locked(setting, main->error);
}
- for (size_read = 0; size_read < size_file; size_read += size_block) {
-
- // The signal check is always performed on each pass.
- if (size_file > iki_read_block_max && fll_program_standard_signal_received(main)) {
- fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received);
-
- status = F_status_set_error(F_interrupt);
-
- break;
- }
-
- status = f_file_stream_read_until(file, size_block, &data.buffer);
- if (F_status_is_error(status)) break;
- } // for
+ break;
+ }
- f_file_stream_flush(file);
- f_file_stream_close(&file);
+ f_file_stream_flush(file);
+ f_file_stream_close(&file);
- if (F_status_is_error(status)) {
- if (F_status_set_fine(status) != F_interrupt) {
- fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_read_until", F_true, data.argv[main->parameters.remaining.array[i]], f_file_operation_process_s, fll_error_file_type_file_e);
- }
+ iki_read_process_buffer(main, setting);
+ if (F_status_is_error(setting->status)) return;
- break;
- }
+ setting->buffer.used = 0;
+ } // for
- status = iki_read_process_buffer(&data);
- if (F_status_is_error(status)) break;
+ if (F_status_is_error(setting->status)) {
+ f_file_stream_flush(file);
+ f_file_stream_close(&file);
- // Clear buffers before repeating the loop.
- f_string_dynamic_resize(0, &data.buffer);
- } // for
- }
- }
- else {
- if (main->error.verbosity > f_console_verbosity_quiet_e) {
- fll_print_format("%r%[%QYou failed to specify one or more files.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s);
+ return;
}
-
- status = F_status_set_error(F_parameter);
}
// Ensure a new line is always put at the end of the program execution, unless in quiet mode.
- if (main->output.verbosity != f_console_verbosity_quiet_e) {
- if (F_status_set_fine(status) == F_interrupt) {
- f_file_stream_flush(main->output.to);
- }
-
- fll_print_dynamic_raw(f_string_eol_s, main->message.to.stream);
- }
-
- iki_read_data_delete(&data);
-
- return status;
+ iki_read_print_line_last_locked(setting, main->message);
}
#endif // _di_iki_read_main_
// IKI Read includes.
#include <program/iki_read/common.h>
+#include <program/iki_read/print.h>
#ifdef __cplusplus
extern "C" {
* F_interrupt on (exit) signal received.
*
* F_parameter (with error bit) if main is NULL or setting is NULL.
+ * F_failure (with error bit) for any other failure.
*/
#ifndef _di_iki_read_main_
- extern f_status_t iki_read_main(fll_program_data_t * const main, iki_read_setting_t * const setting);
+ extern void iki_read_main(fll_program_data_t * const main, iki_read_setting_t * const setting);
#endif // _di_iki_read_main_
#ifdef __cplusplus
fll_program_standard_set_down(&data);
- return F_status_is_error(status) ? 1 : 0;
+ return F_status_is_error(setting.status) ? 1 : 0;
}
fll_program_print_help_option(print, iki_read_short_substitute_s, iki_read_long_substitute_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "Substitute the variable for the given name and matching content value with the given string.");
fll_program_print_help_option(print, iki_read_short_wrap_s, iki_read_long_wrap_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Prepend and append strings for the given name.");
+ f_print_dynamic_raw(f_string_eol_s, print.to.stream);
+ f_print_dynamic_raw(f_string_eol_s, print.to.stream);
+
fll_program_print_help_usage(print, iki_read_program_name_s, fll_program_parameter_filenames_s);
fl_print_format("%r %[Notes:%]%r", print.to.stream, f_string_eol_s, print.set->important, print.set->important, f_string_eol_s);
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* The output structure to print to.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
extern "C" {
#endif
-#ifndef _di_iki_read_data_delete_
- f_status_t iki_read_data_delete(fll_program_data_t * const main, iki_read_setting_t * const setting, iki_read_data_t * const data) {
-
- f_string_dynamic_resize(0, &data->buffer);
-
- return F_none;
- }
-#endif // _di_iki_read_data_delete_
-
#ifdef __cplusplus
} // extern "C"
#endif
#define iki_read_block_read_large 65536
#endif // _di_iki_read_common_
-/**
- * The program data.
- *
- * argv: The argument structure in the progam data parameters for simplifying syntax.
- * at: The processed at parameter value.
- * buffer: The buffer containing the file.
- * line: The processed line parameter value.
- * main: The main program data.
- * mode: The read mode to operate in.
- */
-#ifndef _di_iki_read_data_t_
- typedef struct {
- fll_program_data_t *main;
- f_string_static_t *argv;
-
- uint8_t mode;
-
- f_number_unsigned_t at;
- f_number_unsigned_t line;
-
- f_string_dynamic_t buffer;
- } iki_read_data_t;
-
- #define iki_read_data_t_initialize \
- { \
- 0, \
- 0, \
- 0, \
- 0, \
- 0, \
- f_string_dynamic_t_initialize, \
- }
-#endif // _di_iki_read_data_t_
-
-/**
- * Deallocate program data.
- *
- * @param data
- * The program data.
- *
- * @return
- * F_none on success.
- */
-#ifndef _di_iki_read_data_delete_
- extern f_status_t iki_read_data_delete(fll_program_data_t * const main, iki_read_setting_t * const setting, iki_read_data_t * const data) F_attribute_visibility_internal_d;
-#endif // _di_iki_read_data_delete_
-
#ifdef __cplusplus
} // extern "C"
#endif
#include "iki_read.h"
#include "private-common.h"
#include "private-print.h"
+#include "private-read.h"
#ifdef __cplusplus
extern "C" {
#endif
-#ifndef _di_iki_read_substitutions_print_
- void iki_read_substitutions_print(fll_program_data_t * const main, iki_read_setting_t * const setting, iki_read_data_t * const data, const f_iki_data_t iki_data, const f_string_ranges_t ranges, const iki_read_substitution_t replacement, const iki_read_substitution_t wraps, const iki_read_substitutions_t substitutions, const f_array_length_t index, const bool content_only) {
+#ifndef _di_iki_read_print_
+ void iki_read_print(fll_program_data_t * const main, iki_read_setting_t * const setting, const f_array_length_t index, const bool content_only) {
- uint8_t matched = F_false;
- f_array_length_t at = 0;
+ f_array_length_t at = setting->substitute.used;
- // Grab the last (right-most) match.
- for (f_array_length_t i = 0; i < substitutions.used; ++i) {
-
- if (fl_string_dynamic_partial_compare_string(substitutions.array[i].replace.string, data->buffer, substitutions.array[i].replace.used, iki_data.content.array[index]) == F_equal_to) {
- matched = F_true;
- at = i;
- }
- } // for
+ if (setting->substitute.used && (setting->flag & (iki_read_main_flag_content_e | iki_read_main_flag_literal_e))) {
+ at = iki_read_identify_substitution(setting, setting->data.vocabulary.array[index], setting->data.content.array[index]);
+ }
- if (matched) {
+ if (at < setting->substitute.used) {
if (content_only) {
- f_print_dynamic(substitutions.array[at].with, data->main->output.to.stream);
+ iki_read_print_wrap_prepend(main, setting, index);
+
+ f_print_dynamic(setting->substitute.array[at].c, main->output.to.stream);
+
+ iki_read_print_wrap_append(main, setting, index);
}
else {
- f_string_range_t range = macro_f_string_range_t_initialize(iki_data.variable.array[index].start, iki_data.content.array[index].start - 1);
+ f_string_range_t range = macro_f_string_range_t_initialize(setting->data.variable.array[index].start, setting->data.content.array[index].start - 1);
+
+ f_print_dynamic_partial(setting->buffer, range, main->output.to.stream);
- f_print_dynamic_partial(data->buffer, range, data->main->output.to.stream);
+ iki_read_print_wrap_prepend(main, setting, index);
- f_print_dynamic(substitutions.array[at].with, data->main->output.to.stream);
+ f_print_dynamic(setting->substitute.array[at].a, main->output.to.stream);
- range.start = iki_data.content.array[index].stop + 1;
- range.stop = iki_data.variable.array[index].stop;
+ iki_read_print_wrap_append(main, setting, index);
- f_print_dynamic_partial(data->buffer, range, data->main->output.to.stream);
+ f_print_dynamic(setting->substitute.array[at].c, main->output.to.stream);
}
}
- else if (replacement.replace.used) {
+ else if (setting->replace.used && setting->map_replaces[index] < setting->replace.used) {
if (content_only) {
+ iki_read_print_wrap_prepend(main, setting, index);
- // The wraps.replace represents the "before", which is a string to prepend.
- if (wraps.replace.used) {
- f_print_dynamic(wraps.replace, data->main->output.to.stream);
- }
+ f_print_dynamic(setting->replace.array[index].value, main->output.to.stream);
- f_print_dynamic(replacement.with, data->main->output.to.stream);
-
- // The wraps.replace represents the "after", which is a string to append.
- if (wraps.with.used) {
- f_print_dynamic(wraps.with, data->main->output.to.stream);
- }
+ iki_read_print_wrap_append(main, setting, index);
+ }
+ else if (setting->flag & iki_read_main_flag_object_e) {
+ f_print_dynamic(setting->replace.array[index].name, main->output.to.stream);
}
else {
- f_string_range_t range = macro_f_string_range_t_initialize(iki_data.variable.array[index].start, iki_data.content.array[index].start - 1);
+ f_string_range_t range = macro_f_string_range_t_initialize(setting->data.variable.array[index].start, setting->data.content.array[index].start - 1);
+
+ f_print_dynamic_partial(setting->buffer, setting->data.vocabulary.array[index], main->output.to.stream);
+ f_print_dynamic_partial(setting->buffer, range, main->output.to.stream);
- f_print_dynamic_partial(data->buffer, range, data->main->output.to.stream);
+ iki_read_print_wrap_prepend(main, setting, index);
- // The wraps.replace represents the "before", which is a string to prepend.
- if (wraps.replace.used) {
- f_print_dynamic(wraps.replace, data->main->output.to.stream);
- }
+ f_print_dynamic_partial(setting->buffer, setting->data.content.array[index], main->output.to.stream);
- f_print_dynamic(replacement.with, data->main->output.to.stream);
+ iki_read_print_wrap_append(main, setting, index);
- // The wraps.replace represents the "after", which is a string to append.
- if (wraps.with.used) {
- f_print_dynamic(wraps.with, data->main->output.to.stream);
- }
+ f_print_dynamic(setting->replace.array[index].value, main->output.to.stream);
- range.start = iki_data.content.array[index].stop + 1;
- range.stop = iki_data.variable.array[index].stop;
+ range.start = setting->data.content.array[index].stop + 1;
+ range.stop = setting->data.variable.array[index].stop;
- f_print_dynamic_partial(data->buffer, range, data->main->output.to.stream);
+ f_print_dynamic_partial(setting->buffer, range, main->output.to.stream);
}
}
else if (content_only) {
+ iki_read_print_wrap_prepend(main, setting, index);
- // The wraps.replace represents the "before", which is a string to prepend.
- if (wraps.replace.used) {
- f_print_dynamic(wraps.replace, data->main->output.to.stream);
- }
-
- f_print_dynamic_partial(data->buffer, ranges.array[index], data->main->output.to.stream);
+ f_print_dynamic_partial(setting->buffer, setting->data.content.array[index], main->output.to.stream);
- // The wraps.replace represents the "after", which is a string to append.
- if (wraps.with.used) {
- f_print_dynamic(wraps.with, data->main->output.to.stream);
- }
+ iki_read_print_wrap_append(main, setting, index);
+ }
+ else if (setting->flag & iki_read_main_flag_object_e) {
+ f_print_dynamic_partial(setting->buffer, setting->data.vocabulary.array[index], main->output.to.stream);
}
else {
- f_string_range_t range = macro_f_string_range_t_initialize(iki_data.variable.array[index].start, iki_data.content.array[index].start - 1);
+ f_string_range_t range = macro_f_string_range_t_initialize(setting->data.variable.array[index].start, setting->data.content.array[index].start - 1);
- f_print_dynamic_partial(data->buffer, range, data->main->output.to.stream);
+ f_print_dynamic_partial(setting->buffer, setting->data.vocabulary.array[index], main->output.to.stream);
+ f_print_dynamic_partial(setting->buffer, range, main->output.to.stream);
- // The wraps.replace represents the "before", which is a string to prepend.
- if (wraps.replace.used) {
- f_print_dynamic(wraps.replace, data->main->output.to.stream);
- }
+ iki_read_print_wrap_prepend(main, setting, index);
- f_print_dynamic_partial(data->buffer, iki_data.content.array[index], data->main->output.to.stream);
+ f_print_dynamic_partial(setting->buffer, setting->data.content.array[index], main->output.to.stream);
- // The wraps.replace represents the "after", which is a string to append.
- if (wraps.with.used) {
- f_print_dynamic(wraps.with, data->main->output.to.stream);
- }
+ iki_read_print_wrap_append(main, setting, index);
- range.start = iki_data.content.array[index].stop + 1;
- range.stop = iki_data.variable.array[index].stop;
+ range.start = setting->data.content.array[index].stop + 1;
+ range.stop = setting->data.variable.array[index].stop;
- f_print_dynamic_partial(data->buffer, range, data->main->output.to.stream);
+ f_print_dynamic_partial(setting->buffer, range, main->output.to.stream);
}
}
-#endif // _di_iki_read_substitutions_print_
+#endif // _di_iki_read_print_
+
+#ifndef _di_iki_read_print_wrap_append_
+ void iki_read_print_wrap_append(fll_program_data_t * const main, iki_read_setting_t * const setting, const f_array_length_t index) {
+
+ if (!(index < setting->wrap.used && setting->wrap.array[setting->map_wraps[index]].c.used)) return;
+
+ f_print_dynamic(setting->wrap.array[setting->map_wraps[index]].c, main->output.to.stream);
+ }
+#endif // _di_iki_read_print_wrap_append_
+
+#ifndef _di_iki_read_print_wrap_prepend_
+ void iki_read_print_wrap_prepend(fll_program_data_t * const main, iki_read_setting_t * const setting, const f_array_length_t index) {
+
+ if (!(index < setting->wrap.used && setting->wrap.array[setting->map_wraps[index]].b.used)) return;
+
+ f_print_dynamic(setting->wrap.array[setting->map_wraps[index]].b, main->output.to.stream);
+ }
+#endif // _di_iki_read_print_wrap_prepend_
#ifdef __cplusplus
} // extern "C"
#endif
/**
- * Print any applicable substitution and if there is none then print the given range at the given index.
- *
- * @param data
- * The program data.
- * @param iki_data
- * The IKI data.
- * @param ranges
- * The ranges containing the desired range to print as specified by index.
- * @param replacement
- * A simple substitution string for substitution, substituted only if there are no matches in the substitutions.
- * @param wraps
- * The wraps will prepend a string and append a string to the content for the given range at the given index.
- * This is only performed when substitutions has no match for the given range at the given index.
- * @param substitutions
- * The substitutions associated with the variable for the given range at the given index to use for potential printing.
+ * Print the given range at the given index.
+ *
+ * This detects and prints any applicable substitution matching the vocabulary at the given index.
+ * If there is no substitution, then this prints the given range at the given index.
+ *
+ * @param main
+ * The main program data.
+ * @param setting
+ * The main program settings.
+ *
+ * The setting.map_wraps is expected to be defined as a valid pointer to an array.
+ * The setting.map_replaces is expected to be defined as a valid pointer to an array.
+ *
+ * This does not alter setting.status.
* @param index
* The index used to identify the desired range in variable, content, and ranges.
* @param content_only
- * Set to TRUE to only print the content when printing substituted text.
- * Set to FALSE to print the entire variable when printing substituted text.
+ * Set to TRUE to only print the value (Content) when printing.
+ * Set to FALSE to print the entire variable when printing.
+ */
+#ifndef _di_iki_read_print_
+ extern void iki_read_print(fll_program_data_t * const main, iki_read_setting_t * const setting, const f_array_length_t index, const bool content_only) F_attribute_visibility_internal_d;
+#endif // _di_iki_read_print_
+
+/**
+ * Print the append part of the wrap at the given index, if valid.
+ *
+ * @param main
+ * The main program data.
+ * @param setting
+ * The main program settings.
+ *
+ * This does not alter setting.status.
+ * @param index
+ * The index within the setting->map_wraps array to print.
+ */
+#ifndef _di_iki_read_print_wrap_append_
+ extern void iki_read_print_wrap_append(fll_program_data_t * const main, iki_read_setting_t * const setting, const f_array_length_t index) F_attribute_visibility_internal_d;
+#endif // _di_iki_read_print_wrap_append_
+
+/**
+ * Print the prepend part of the wrap at the given index, if valid.
+ *
+ * @param main
+ * The main program data.
+ * @param setting
+ * The main program settings.
+ *
+ * This does not alter setting.status.
+ * @param index
+ * The index within the setting->map_wraps array to print.
*/
-#ifndef _di_iki_read_substitutions_print_
- extern void iki_read_substitutions_print(fll_program_data_t * const main, iki_read_setting_t * const setting, iki_read_data_t * const data, const f_iki_data_t iki_data, const f_string_ranges_t ranges, const iki_read_substitution_t replacement, const iki_read_substitution_t wraps, const iki_read_substitutions_t substitutions, const f_array_length_t index, const bool content_only) F_attribute_visibility_internal_d;
-#endif // _di_iki_read_substitutions_print_
+#ifndef _di_iki_read_print_wrap_prepend_
+ extern void iki_read_print_wrap_prepend(fll_program_data_t * const main, iki_read_setting_t * const setting, const f_array_length_t index) F_attribute_visibility_internal_d;
+#endif // _di_iki_read_print_wrap_prepend_
#ifdef __cplusplus
} // extern "C"
extern "C" {
#endif
-#ifndef _di_iki_read_process_at_
- f_status_t iki_read_process_at(fll_program_data_t * const main, iki_read_setting_t * const setting, iki_read_data_t * const data, f_string_range_t *range) {
+#ifndef _di_iki_read_identify_alteration_
+ void iki_read_identify_alteration(iki_read_setting_t * const setting) {
- if (data->main->parameters.array[iki_read_parameter_line_e].result != f_console_result_additional_e) {
- return F_false;
- }
+ register f_array_length_t i = 0;
- f_array_length_t line = 0;
+ if (setting->flag & (iki_read_main_flag_content_e | iki_read_main_flag_literal_e)) {
+ register f_array_length_t j = 0;
- range->start = 0;
- if (data->line > 0) {
- for (; line < data->line && range->start < data->buffer.used; ++range->start) {
- if (data->buffer.string[range->start] == f_string_eol_s.string[0]) ++line;
- } // for
- }
+ for (i = 0; i < setting->data.vocabulary.used; ++i) {
- if (line == data->line) {
- for (range->stop = range->start; range->stop < data->buffer.used; ++range->stop) {
- if (data->buffer.string[range->stop] == f_string_eol_s.string[0]) break;
- } // for
+ if (setting->replace.used) {
+ setting->map_replaces[i] = setting->replace.used;
- return F_true;
- }
+ j = setting->replace.used - 1;
- return F_data_not;
- }
-#endif // _di_iki_read_process_at_
+ do {
+ if (fl_string_dynamic_partial_compare_string(setting->replace.array[j].name.string, setting->buffer, setting->replace.array[j].name.used, setting->data.vocabulary.array[i]) == F_equal_to) {
+ setting->map_replaces[i] = j;
-#ifndef _di_iki_read_process_buffer_
- f_status_t iki_read_process_buffer(iki_read_data_t * const data) {
+ break;
+ }
- f_status_t status = F_none;
- f_iki_data_t iki_data = f_iki_data_t_initialize;
+ } while (j--);
+ }
- if (data->main->parameters.array[iki_read_parameter_whole_e].result == f_console_result_found_e) {
- f_string_range_t buffer_range = macro_f_string_range_t_initialize2(data->buffer.used);
+ if (setting->wrap.used) {
+ setting->map_wraps[i] = setting->wrap.used;
- status = iki_read_process_at(data, &buffer_range);
+ j = setting->wrap.used - 1;
- if (status == F_true) {
- if (buffer_range.start > data->buffer.used) {
- return F_data_not;
- }
- }
- else if (status == F_data_not) {
- return F_data_not;
- }
+ do {
+ if (fl_string_dynamic_partial_compare_string(setting->wrap.array[j].a.string, setting->buffer, setting->wrap.array[j].a.used, setting->data.vocabulary.array[i]) == F_equal_to) {
+ setting->map_wraps[i] = j;
- if (data->mode == iki_read_mode_content_e) {
- status = iki_read_process_buffer_ranges_whole(data, buffer_range, &iki_data, &iki_data.content);
- }
- else if (data->mode == iki_read_mode_literal_e) {
- status = iki_read_process_buffer_ranges_whole(data, buffer_range, &iki_data, &iki_data.variable);
- }
- else if (data->mode == iki_read_mode_object_e) {
- status = iki_read_process_buffer_ranges_whole(data, buffer_range, &iki_data, &iki_data.vocabulary);
- }
- }
- else if (data->mode == iki_read_mode_total_e) {
- status = iki_read_process_buffer_total(data, &iki_data);
+ break;
+ }
+
+ } while (j--);
+ }
+ } // for
}
else {
- f_string_range_t buffer_range = macro_f_string_range_t_initialize2(data->buffer.used);
+ for (i = 0; i < setting->data.vocabulary.used; ++i) {
- status = iki_read_process_at(data, &buffer_range);
+ if (setting->replace.used) {
+ setting->map_replaces[i] = setting->replace.used;
+ }
- if ((status == F_true && buffer_range.start > data->buffer.used) || status == F_data_not) {
- f_iki_data_delete(&iki_data);
+ if (setting->wrap.used) {
+ setting->map_wraps[i] = setting->wrap.used;
+ }
+ } // for
+ }
+ }
+#endif // _di_iki_read_identify_alteration_
- return F_data_not;
- }
+#ifndef _di_iki_read_identify_substitution_
+ f_array_length_t iki_read_identify_substitution(iki_read_setting_t * const setting, const f_string_range_t name, const f_string_range_t value) {
- if (data->mode == iki_read_mode_content_e) {
- status = iki_read_process_buffer_ranges(data, &buffer_range, &iki_data, &iki_data.content);
- }
- else if (data->mode == iki_read_mode_literal_e) {
- status = iki_read_process_buffer_ranges(data, &buffer_range, &iki_data, &iki_data.variable);
- }
- else if (data->mode == iki_read_mode_object_e) {
- status = iki_read_process_buffer_ranges(data, &buffer_range, &iki_data, &iki_data.vocabulary);
+ register f_array_length_t i = setting->substitute.used - 1;
+
+ do {
+ if (fl_string_dynamic_partial_compare_string(setting->substitute.array[i].a.string, setting->buffer, setting->substitute.array[i].a.used, name) == F_equal_to) {
+ if (fl_string_dynamic_partial_compare_string(setting->substitute.array[i].b.string, setting->buffer, setting->substitute.array[i].b.used, value) == F_equal_to) {
+ return i;
+ }
}
- }
- f_iki_data_delete(&iki_data);
+ } while (i--);
- return status;
+ return setting->substitute.used;
}
-#endif // _di_iki_read_process_buffer_
+#endif // _di_iki_read_identify_substitution_
-#ifndef _di_iki_read_process_buffer_ranges_
- f_status_t iki_read_process_buffer_ranges(iki_read_data_t * const data, f_string_range_t *buffer_range, f_iki_data_t *iki_data, f_string_ranges_t *ranges) {
+#ifndef _di_iki_read_process_line_
+ void iki_read_process_line(fll_program_data_t * const main, iki_read_setting_t * const setting, f_string_range_t *range) {
- f_status_t status = F_none;
+ if (!(setting->flag & iki_read_main_flag_line_e)) {
+ setting->status = F_false;
- bool unmatched = F_true;
+ return;
+ }
- {
- f_state_t state = macro_f_state_t_initialize(iki_read_common_allocation_large_d, iki_read_common_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) data->main, 0);
+ f_array_length_t line = 0;
- status = fl_iki_read(state, &data->buffer, buffer_range, iki_data);
+ range->start = 0;
+ if (setting->line) {
+ for (; line < setting->line && range->start < setting->buffer.used; ++range->start) {
+ if (setting->buffer.string[range->start] == f_string_eol_s.string[0]) ++line;
+ } // for
}
- if (F_status_is_error(status)) {
- fll_error_print(data->main->error, F_status_set_fine(status), "fl_iki_read", F_true);
+ if (line == setting->line) {
- return status;
+ // Find where the found line ends and set that as the range stop.
+ for (range->stop = range->start; range->stop < setting->buffer.used; ++range->stop) {
+ if (setting->buffer.string[range->stop] == f_string_eol_s.string[0]) break;
+ } // for
+
+ setting->status = F_true;
}
+ else {
+ setting->status = F_data_not;
+ }
+ }
+#endif // _di_iki_read_process_line_
- for (f_array_length_t i = 0; i < iki_data->delimits.used; ++i) {
- data->buffer.string[iki_data->delimits.array[i]] = f_iki_syntax_placeholder_s.string[0];
- } // for
+#ifndef _di_iki_read_process_buffer_
+ void iki_read_process_buffer(fll_program_data_t * const main, iki_read_setting_t * const setting) {
- const bool content_only = data->mode == iki_read_mode_content_e;
+ if (setting->flag & iki_read_main_flag_total_e) {
+ iki_read_process_buffer_total(main, setting);
- iki_read_substitution_t replacements[iki_data->variable.used];
- iki_read_substitution_t wraps[iki_data->variable.used];
- iki_read_substitutions_t substitutionss[iki_data->variable.used];
+ if (F_status_is_error_not(setting->status)) {
+ setting->status = F_none;
+ }
- memset(replacements, 0, sizeof(iki_read_substitution_t) * iki_data->variable.used);
- memset(wraps, 0, sizeof(iki_read_substitution_t) * iki_data->variable.used);
- memset(substitutionss, 0, sizeof(iki_read_substitutions_t) * iki_data->variable.used);
+ return;
+ }
- if (data->mode == iki_read_mode_literal_e || data->mode == iki_read_mode_content_e) {
- status = iki_read_replacements_identify(data, &iki_data->vocabulary, replacements);
+ f_string_range_t buffer_range = macro_f_string_range_t_initialize2(setting->buffer.used);
- if (F_status_is_error(status)) {
- fll_error_print(data->main->error, F_status_set_fine(status), "iki_read_replacements_identify", F_true);
+ iki_read_process_line(main, setting, &buffer_range);
- return status;
- }
+ if (setting->status == F_true) {
+ if (buffer_range.start > setting->buffer.used) {
+ setting->status = F_data_not;
- status = iki_read_wraps_identify(data, &iki_data->vocabulary, wraps);
+ return;
+ }
+ }
+ else if (setting->status == F_data_not) {
+ setting->status = F_data_not;
- if (F_status_is_error(status)) {
- fll_error_print(data->main->error, F_status_set_fine(status), "iki_read_wraps_identify", F_true);
+ return;
+ }
- return status;
- }
+ if (setting->flag & iki_read_main_flag_whole_e) {
+ iki_read_process_buffer_ranges_whole(main, setting, buffer_range);
+ }
+ else {
+ iki_read_process_buffer_ranges(main, setting, &buffer_range);
+ }
- status = iki_read_substitutions_identify(data, &iki_data->vocabulary, substitutionss);
+ if (F_status_is_error_not(setting->status)) {
+ setting->status = F_none;
+ }
+ }
+#endif // _di_iki_read_process_buffer_
- if (F_status_is_error(status)) {
- fll_error_print(data->main->error, F_status_set_fine(status), "iki_read_substitutions_identify", F_true);
+#ifndef _di_iki_read_process_buffer_ranges_
+ void iki_read_process_buffer_ranges(fll_program_data_t * const main, iki_read_setting_t * const setting, f_string_range_t *buffer_range) {
- for (f_array_length_t i = 0; i < iki_data->variable.used; ++i) {
- macro_iki_read_substitutions_t_delete_simple(substitutionss[i]);
- } // for
+ {
+ const f_state_t state = macro_f_state_t_initialize(iki_read_common_allocation_large_d, iki_read_common_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) main, 0);
- return status;
- }
+ setting->status = fl_iki_read(state, &setting->buffer, buffer_range, &setting->data);
}
- if (data->main->parameters.array[iki_read_parameter_name_e].result == f_console_result_additional_e) {
- f_string_dynamic_t name = f_string_dynamic_t_initialize;
+ if (F_status_is_error(setting->status)) {
+ iki_read_print_line_first_locked(setting, main->error);
+ fll_error_print(main->error, F_status_set_fine(setting->status), "fl_iki_read", F_true);
+ iki_read_print_line_last_locked(setting, main->error);
- f_array_length_t index = 0;
- f_array_length_t i = 0;
- f_array_length_t j = 0;
- f_array_length_t matches = 0;
- buffer_range->start = 0;
+ return;
+ }
- for (; i < data->main->parameters.array[iki_read_parameter_name_e].values.used; ++i) {
+ f_array_length_t i = 0;
+ f_array_length_t replaces[setting->data.vocabulary.used];
+ f_array_length_t wraps[setting->data.vocabulary.used];
- index = data->main->parameters.array[iki_read_parameter_name_e].values.array[i];
- name.used = 0;
+ setting->map_replaces = replaces;
+ setting->map_wraps = wraps;
- status = f_string_dynamic_append_nulless(data->argv[index], &name);
+ for (; i < setting->data.delimits.used; ++i) {
+ setting->buffer.string[setting->data.delimits.array[i]] = f_iki_syntax_placeholder_s.string[0];
+ } // for
- if (F_status_is_error(status)) {
- fll_error_print(data->main->error, F_status_set_fine(status), "f_string_dynamic_append_nulless", F_true);
+ iki_read_identify_alteration(setting);
- for (f_array_length_t i = 0; i < iki_data->variable.used; ++i) {
- macro_iki_read_substitutions_t_delete_simple(substitutionss[i]);
- } // for
+ if (setting->flag & iki_read_main_flag_name_e) {
+ f_array_length_t j = 0;
+ f_array_length_t matches = 0;
+ bool unmatched = F_true;
- f_string_dynamic_resize(0, &name);
- return status;
- }
+ flockfile(main->output.to.stream);
- buffer_range->stop = name.used - 1;
+ for (i = 0; i < setting->data.vocabulary.used; ++i) {
- flockfile(data->main->output.to.stream);
+ for (j = 0; j < setting->names.used; ++j) {
- for (j = 0; j < iki_data->vocabulary.used; ++j) {
+ if (fl_string_dynamic_partial_compare_string(setting->names.array[j].string, setting->buffer, setting->names.array[j].used, setting->data.vocabulary.array[i]) == F_equal_to) {
+ unmatched = F_false;
- status = fl_string_dynamic_partial_compare(name, data->buffer, *buffer_range, iki_data->vocabulary.array[j]);
+ if (setting->flag & iki_read_main_flag_at_e) {
+ if (matches < setting->at) {
+ matches++;
- if (status == F_equal_to) {
- unmatched = F_false;
+ continue;
+ }
- if (data->main->parameters.array[iki_read_parameter_at_e].result == f_console_result_additional_e) {
- if (matches++ != data->at) continue;
+ if (matches++ > setting->at) break;
}
- if (replacements[j].replace.used || wraps[j].replace.used || wraps[j].with.used || substitutionss[j].used) {
- iki_read_substitutions_print(data, *iki_data, *ranges, replacements[j], wraps[j], substitutionss[j], j, content_only);
- }
- else {
- f_print_dynamic_partial(data->buffer, ranges->array[j], data->main->output.to.stream);
- }
+ iki_read_print(main, setting, i, setting->flag & iki_read_main_flag_content_e);
- f_print_dynamic_raw(f_string_eol_s, data->main->output.to.stream);
+ f_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
}
} // for
-
- funlockfile(data->main->output.to.stream);
} // for
- f_string_dynamic_resize(0, &name);
+ funlockfile(main->output.to.stream);
if (unmatched) {
- status = F_data_not;
+ setting->status = F_data_not;
}
else {
- status = F_none;
+ setting->status = F_none;
}
}
- else if (ranges->used) {
- if (data->main->parameters.array[iki_read_parameter_at_e].result == f_console_result_additional_e) {
- if (data->at < ranges->used) {
- flockfile(data->main->output.to.stream);
+ else {
+ if (setting->data.variable.used) {
+ if (setting->flag & iki_read_main_flag_at_e) {
+ if (setting->at < setting->data.variable.used) {
+ flockfile(main->output.to.stream);
- if (replacements[data->at].replace.used || wraps[data->at].replace.used || wraps[data->at].with.used || substitutionss[data->at].used) {
- iki_read_substitutions_print(data, *iki_data, *ranges, replacements[data->at], wraps[data->at], substitutionss[data->at], data->at, content_only);
- }
- else {
- f_print_dynamic_partial(data->buffer, ranges->array[data->at], data->main->output.to.stream);
- }
+ iki_read_print(main, setting, setting->at, setting->flag & iki_read_main_flag_content_e);
- f_print_dynamic_raw(f_string_eol_s, data->main->output.to.stream);
+ f_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
- funlockfile(data->main->output.to.stream);
+ funlockfile(main->output.to.stream);
- status = F_none;
+ setting->status = F_none;
+ }
+ else {
+ setting->status = F_data_not;
+ }
}
else {
- status = F_data_not;
- }
- }
- else {
- flockfile(data->main->output.to.stream);
+ flockfile(main->output.to.stream);
- for (f_array_length_t i = 0; i < ranges->used; ++i) {
+ for (i = 0; i < setting->data.variable.used; ++i) {
- if (replacements[i].replace.used || wraps[i].replace.used || wraps[i].with.used || substitutionss[i].used) {
- iki_read_substitutions_print(data, *iki_data, *ranges, replacements[i], wraps[i], substitutionss[i], i, content_only);
- }
- else {
- f_print_dynamic_partial(data->buffer, ranges->array[i], data->main->output.to.stream);
- }
+ iki_read_print(main, setting, i, setting->flag & iki_read_main_flag_content_e);
- f_print_dynamic_raw(f_string_eol_s, data->main->output.to.stream);
- } // for
+ f_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
+ } // for
- funlockfile(data->main->output.to.stream);
+ funlockfile(main->output.to.stream);
- status = F_none;
+ setting->status = F_none;
+ }
+ }
+ else {
+ setting->status = F_data_not;
}
}
- else {
- status = F_data_not;
- }
-
- for (f_array_length_t i = 0; i < iki_data->variable.used; ++i) {
- macro_iki_read_substitutions_t_delete_simple(substitutionss[i]);
- } // for
-
- return status;
}
#endif // _di_iki_read_process_buffer_ranges_
#ifndef _di_iki_read_process_buffer_ranges_whole_
- f_status_t iki_read_process_buffer_ranges_whole(iki_read_data_t * const data, const f_string_range_t buffer_range, f_iki_data_t *iki_data, f_string_ranges_t *ranges) {
+ void iki_read_process_buffer_ranges_whole(fll_program_data_t * const main, iki_read_setting_t * const setting, const f_string_range_t buffer_range) {
- f_status_t status = F_none;
f_string_range_t range = buffer_range;
{
- f_state_t state = macro_f_state_t_initialize(iki_read_common_allocation_large_d, iki_read_common_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) data->main, 0);
-
- status = fl_iki_read(state, &data->buffer, &range, iki_data);
- }
+ const f_state_t state = macro_f_state_t_initialize(iki_read_common_allocation_large_d, iki_read_common_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) main, 0);
- if (F_status_is_error(status)) {
- fll_error_print(data->main->error, F_status_set_fine(status), "fl_iki_read", F_true);
-
- return status;
+ setting->status = fl_iki_read(state, &setting->buffer, &range, &setting->data);
}
- for (f_array_length_t i = 0; i < iki_data->delimits.used; ++i) {
- data->buffer.string[iki_data->delimits.array[i]] = f_iki_syntax_placeholder_s.string[0];
- } // for
-
- if (!iki_data->variable.used) {
- fll_print_dynamic_partial(data->buffer, buffer_range, data->main->output.to.stream);
+ if (F_status_is_error(setting->status)) {
+ iki_read_print_line_first_locked(setting, main->error);
+ fll_error_print(main->error, F_status_set_fine(setting->status), "fl_iki_read", F_true);
+ iki_read_print_line_last_locked(setting, main->error);
- return F_none;
+ return;
}
- const bool content_only = data->mode == iki_read_mode_content_e;
-
- iki_read_substitution_t replacements[iki_data->variable.used];
- iki_read_substitution_t wraps[iki_data->variable.used];
- iki_read_substitutions_t substitutionss[iki_data->variable.used];
-
- memset(replacements, 0, sizeof(iki_read_substitution_t) * iki_data->variable.used);
- memset(wraps, 0, sizeof(iki_read_substitution_t) * iki_data->variable.used);
- memset(substitutionss, 0, sizeof(iki_read_substitutions_t) * iki_data->variable.used);
-
- if (data->mode == iki_read_mode_literal_e || data->mode == iki_read_mode_content_e) {
- status = iki_read_replacements_identify(data, &iki_data->vocabulary, replacements);
-
- if (F_status_is_error(status)) {
- fll_error_print(data->main->error, F_status_set_fine(status), "iki_read_replacements_identify", F_true);
-
- return status;
- }
-
- status = iki_read_wraps_identify(data, &iki_data->vocabulary, wraps);
-
- if (F_status_is_error(status)) {
- fll_error_print(data->main->error, F_status_set_fine(status), "iki_read_wraps_identify", F_true);
+ f_array_length_t i = 0;
- return status;
- }
+ for (; i < setting->data.delimits.used; ++i) {
+ setting->buffer.string[setting->data.delimits.array[i]] = f_iki_syntax_placeholder_s.string[0];
+ } // for
- status = iki_read_substitutions_identify(data, &iki_data->vocabulary, substitutionss);
+ if (!setting->data.variable.used) {
+ fll_print_dynamic_partial(setting->buffer, buffer_range, main->output.to.stream);
- if (F_status_is_error(status)) {
- fll_error_print(data->main->error, F_status_set_fine(status), "iki_read_substitutions_identify", F_true);
+ setting->status = F_none;
- for (f_array_length_t i = 0; i < iki_data->variable.used; ++i) {
- macro_iki_read_substitutions_t_delete_simple(substitutionss[i]);
- } // for
-
- return status;
- }
+ return;
}
- f_string_dynamics_t names = f_string_dynamics_t_initialize;
- f_string_range_t name_range = f_string_range_t_initialize;
-
- bool name_missed = F_true;
-
- if (data->main->parameters.array[iki_read_parameter_name_e].result == f_console_result_additional_e) {
- f_array_length_t i = 0;
- f_array_length_t j = 0;
-
- for (f_array_length_t index = 0; i < data->main->parameters.array[iki_read_parameter_name_e].values.used; ++i) {
-
- index = data->main->parameters.array[iki_read_parameter_name_e].values.array[i];
-
- for (j = 0, name_missed = F_true; j < names.used; ++j) {
-
- if (fl_string_dynamic_compare(data->argv[index], names.array[j]) == F_equal_to) {
- name_missed = F_false;
-
- break;
- }
- } // for
-
- if (name_missed) {
- macro_f_memory_structure_increment(status, names, 1, F_iki_default_allocation_small_d, macro_f_string_dynamics_t_resize, F_array_too_large);
-
- if (F_status_is_error(status)) {
- fll_error_print(data->main->error, F_status_set_fine(status), "macro_f_memory_structure_increment", F_true);
-
- break;
- }
-
- status = f_string_dynamic_append_nulless(data->argv[index], &names.array[names.used]);
-
- if (F_status_is_error(status)) {
- fll_error_print(data->main->error, F_status_set_fine(status), "f_string_dynamic_append_nulless", F_true);
-
- break;
- }
-
- ++names.used;
- }
- } // for
-
- if (F_status_is_error(status)) {
- for (i = 0; i < iki_data->variable.used; ++i) {
- macro_iki_read_substitutions_t_delete_simple(substitutionss[i]);
- } // for
-
- f_string_dynamics_resize(0, &names);
-
- return status;
- }
- }
+ iki_read_identify_alteration(setting);
{
- f_array_length_t i = buffer_range.start;
f_array_length_t j = 0;
f_array_length_t k = 0;
- f_array_length_t stop = iki_data->variable.used;
+ f_array_length_t stop = setting->data.variable.used;
+ i = buffer_range.start;
range = buffer_range;
- name_range.start = 0;
- flockfile(data->main->output.to.stream);
+ flockfile(main->output.to.stream);
while (i <= range.stop && j < stop) {
- if (i < iki_data->variable.array[j].start) {
+ if (i < setting->data.variable.array[j].start) {
range.start = i;
- range.stop = iki_data->variable.array[j].start - 1;
+ range.stop = setting->data.variable.array[j].start - 1;
- f_print_dynamic_partial(data->buffer, range, data->main->output.to.stream);
+ f_print_dynamic_partial(setting->buffer, range, main->output.to.stream);
- range.start = iki_data->variable.array[j].stop + 1;
+ range.start = setting->data.variable.array[j].stop + 1;
range.stop = buffer_range.stop;
- i = iki_data->variable.array[j].start;
+ i = setting->data.variable.array[j].start;
}
- if (names.used) {
- name_missed = F_true;
-
- for (k = 0; k < names.used; ++k) {
- name_range.stop = names.array[k].used - 1;
-
- status = fl_string_dynamic_partial_compare(data->buffer, names.array[k], iki_data->vocabulary.array[j], name_range);
-
- if (status == F_equal_to) {
- name_missed = F_false;
- break;
- }
+ k = 0;
+ if (setting->names.used) {
+ for (; k < setting->names.used; ++k) {
+ if (fl_string_dynamic_partial_compare_string(setting->names.array[k].string, setting->buffer, setting->names.array[k].used, setting->data.vocabulary.array[j]) == F_equal_to) break;
} // for
- if (name_missed) {
- if (replacements[j].replace.used || wraps[j].replace.used || wraps[j].with.used || substitutionss[j].used) {
- iki_read_substitutions_print(data, *iki_data, iki_data->variable, replacements[j], wraps[j], substitutionss[j], j, F_false);
- }
- else {
- f_print_dynamic_partial(data->buffer, iki_data->variable.array[j], data->main->output.to.stream);
- }
- }
- else {
- if (replacements[j].replace.used || wraps[j].replace.used || wraps[j].with.used || substitutionss[j].used) {
- iki_read_substitutions_print(data, *iki_data, *ranges, replacements[j], wraps[j], substitutionss[j], j, content_only);
- }
- else {
- f_print_dynamic_partial(data->buffer, ranges->array[j], data->main->output.to.stream);
- }
+ if (k < setting->names.used) {
+ iki_read_print(main, setting, j, F_true);
}
}
else {
- if (replacements[j].replace.used || wraps[j].replace.used || wraps[j].with.used || substitutionss[j].used) {
- iki_read_substitutions_print(data, *iki_data, *ranges, replacements[j], wraps[j], substitutionss[j], j, content_only);
- }
- else {
- f_print_dynamic_partial(data->buffer, ranges->array[j], data->main->output.to.stream);
- }
+ iki_read_print(main, setting, j, F_true);
}
- i = iki_data->variable.array[j].stop + 1;
+ i = setting->data.variable.array[j].stop + 1;
++j;
} // while
if (i <= buffer_range.stop) {
range.start = i;
- f_print_dynamic_partial(data->buffer, range, data->main->output.to.stream);
+ f_print_dynamic_partial(setting->buffer, range, main->output.to.stream);
}
- funlockfile(data->main->output.to.stream);
+ funlockfile(main->output.to.stream);
}
- for (f_array_length_t i = 0; i < iki_data->variable.used; ++i) {
- macro_iki_read_substitutions_t_delete_simple(substitutionss[i]);
- } // for
-
- f_string_dynamics_resize(0, &names);
-
- return F_none;
+ setting->status = F_none;
}
#endif // _di_iki_read_process_buffer_ranges_whole_
#ifndef _di_iki_read_process_buffer_total_
- f_status_t iki_read_process_buffer_total(iki_read_data_t * const data, f_iki_data_t *iki_data) {
+ void iki_read_process_buffer_total(fll_program_data_t * const main, iki_read_setting_t * const setting) {
+
+ f_string_range_t range = macro_f_string_range_t_initialize2(setting->buffer.used);
- f_status_t status = F_none;
- f_string_range_t range = macro_f_string_range_t_initialize2(data->buffer.used);
+ iki_read_process_line(main, setting, &range);
- status = iki_read_process_at(data, &range);
+ if (setting->status == F_true) {
+ if (range.start > setting->buffer.used) {
+ fll_print_format("%r%r", main->output.to.stream, f_string_ascii_0_s, f_string_eol_s);
- if (status == F_true) {
- if (range.start > data->buffer.used) {
- fll_print_format("%r%r", data->main->output.to.stream, f_string_ascii_0_s, f_string_eol_s);
+ setting->status = F_none;
- return F_none;
+ return;
}
}
- else if (status == F_data_not) {
- fll_print_format("%r%r", data->main->output.to.stream, f_string_ascii_0_s, f_string_eol_s);
+ else if (setting->status == F_data_not) {
+ fll_print_format("%r%r", main->output.to.stream, f_string_ascii_0_s, f_string_eol_s);
- return F_none;
+ setting->status = F_none;
+
+ return;
}
{
- f_state_t state = macro_f_state_t_initialize(iki_read_common_allocation_large_d, iki_read_common_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) data->main, 0);
+ f_state_t state = macro_f_state_t_initialize(iki_read_common_allocation_large_d, iki_read_common_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) main, 0);
- status = fl_iki_read(state, &data->buffer, &range, iki_data);
+ setting->status = fl_iki_read(state, &setting->buffer, &range, &setting->data);
}
- if (F_status_is_error(status)) {
- fll_error_print(data->main->error, F_status_set_fine(status), "fl_iki_read", F_true);
+ if (F_status_is_error(setting->status)) {
+ fll_error_print(main->error, F_status_set_fine(setting->status), "fl_iki_read", F_true);
- return status;
+ return;
}
- for (f_array_length_t i = 0; i < iki_data->delimits.used; ++i) {
- data->buffer.string[iki_data->delimits.array[i]] = f_iki_syntax_placeholder_s.string[0];
- } // for
-
+ f_array_length_t i = 0;
f_array_length_t total = 0;
- if (data->main->parameters.array[iki_read_parameter_name_e].result == f_console_result_additional_e) {
+ for (; i < setting->data.delimits.used; ++i) {
+ setting->buffer.string[setting->data.delimits.array[i]] = f_iki_syntax_placeholder_s.string[0];
+ } // for
+
+ if (main->parameters.array[iki_read_parameter_name_e].result == f_console_result_additional_e) {
f_string_dynamic_t name = f_string_dynamic_t_initialize;
f_array_length_t index = 0;
- f_array_length_t i = 0;
f_array_length_t j = 0;
range.start = 0;
- for (; i < data->main->parameters.array[iki_read_parameter_name_e].values.used; ++i) {
+ for (i = 0; i < main->parameters.array[iki_read_parameter_name_e].values.used; ++i) {
- if (!((++data->main->signal_check) % iki_read_signal_check_d)) {
- if (fll_program_standard_signal_received(data->main)) {
+ if (!((++main->signal_check) % iki_read_signal_check_d)) {
+ if (fll_program_standard_signal_received(main)) {
fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received);
f_string_dynamic_resize(0, &name);
- return F_status_set_error(F_interrupt);
+ setting->status = F_status_set_error(F_interrupt);
+
+ return;
}
- data->main->signal_check = 0;
+ main->signal_check = 0;
}
- index = data->main->parameters.array[iki_read_parameter_name_e].values.array[i];
+ index = main->parameters.array[iki_read_parameter_name_e].values.array[i];
name.used = 0;
- status = f_string_dynamic_append_nulless(data->argv[index], &name);
+ setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[index], &name);
- if (F_status_is_error(status)) {
- fll_error_print(data->main->error, F_status_set_fine(status), "f_string_dynamic_append_nulless", F_true);
+ if (F_status_is_error(setting->status)) {
+ fll_error_print(main->error, F_status_set_fine(setting->status), "f_string_dynamic_append_nulless", F_true);
f_string_dynamic_resize(0, &name);
- return status;
+ return;
}
range.stop = name.used - 1;
- for (j = 0; j < iki_data->vocabulary.used; ++j) {
+ for (j = 0; j < setting->data.vocabulary.used; ++j) {
- status = fl_string_dynamic_partial_compare(name, data->buffer, range, iki_data->vocabulary.array[j]);
+ setting->status = fl_string_dynamic_partial_compare(name, setting->buffer, range, setting->data.vocabulary.array[j]);
- if (status == F_equal_to) ++total;
+ if (setting->status == F_equal_to) ++total;
} // for
} // for
f_string_dynamic_resize(0, &name);
}
else {
- total = iki_data->variable.used;
+ total = setting->data.variable.used;
}
- // if that at position is within the actual total, then the total at the given position is 1, otherwise is 0.
- if (data->main->parameters.array[iki_read_parameter_at_e].result == f_console_result_additional_e) {
- if (data->at < total) {
+ // If the "at" position is within the actual total, then the total at the given position is 1, otherwise is 0.
+ if (main->parameters.array[iki_read_parameter_at_e].result == f_console_result_additional_e) {
+ if (setting->at < total) {
total = 1;
}
else {
}
}
- fll_print_format("%ul%r", data->main->output.to.stream, total, f_string_eol_s);
+ fll_print_format("%ul%r", main->output.to.stream, total, f_string_eol_s);
- return F_none;
+ setting->status = F_none;
}
#endif // _di_iki_read_process_buffer_total_
-#ifndef _di_iki_read_replacements_identify_
- f_status_t iki_read_replacements_identify(iki_read_data_t * const data, f_iki_vocabulary_t *vocabulary, iki_read_substitution_t *replacements) {
-
- if (data->main->parameters.array[iki_read_parameter_replace_e].result != f_console_result_additional_e) {
- return F_none;
- }
-
- f_array_length_t i = 0;
- f_array_length_t j = 0;
-
- f_array_length_t index = 0;
- f_array_length_t index2 = 0;
-
- f_console_parameter_t *parameter = &data->main->parameters.array[iki_read_parameter_replace_e];
-
- for (; i < parameter->values.used; i += 2) {
-
- index = parameter->values.array[i];
-
- for (j = 0; j < vocabulary->used; ++j) {
-
- if (fl_string_dynamic_partial_compare_string(data->argv[index].string, data->buffer, data->argv[index].used, vocabulary->array[j]) == F_equal_to) {
- replacements[j].replace.used = F_true;
-
- index2 = parameter->values.array[i + 1];
- replacements[j].with = data->argv[index2];
- }
- } // for
- } // for
-
- return F_none;
- }
-#endif // _di_iki_read_replacements_identify_
-
-#ifndef _di_iki_read_substitutions_identify_
- f_status_t iki_read_substitutions_identify(iki_read_data_t * const data, f_iki_vocabulary_t *vocabulary, iki_read_substitutions_t *substitutionss) {
-
- if (data->main->parameters.array[iki_read_parameter_substitute_e].result != f_console_result_additional_e) {
- return F_none;
- }
-
- f_status_t status = F_none;
-
- f_array_length_t i = 0;
- f_array_length_t j = 0;
-
- f_array_length_t index = 0;
- f_array_length_t index2 = 0;
-
- f_console_parameter_t *parameter = &data->main->parameters.array[iki_read_parameter_substitute_e];
-
- for (; i < parameter->values.used; i += 3) {
-
- index = parameter->values.array[i];
-
- for (j = 0; j < vocabulary->used; ++j) {
-
- if (fl_string_dynamic_partial_compare_string(data->argv[index].string, data->buffer, data->argv[index].used, vocabulary->array[j]) == F_equal_to) {
- macro_f_memory_structure_increment(status, substitutionss[j], 1, F_iki_default_allocation_small_d, macro_iki_read_substitutions_t_resize, F_array_too_large);
- if (F_status_is_error(status)) return status;
-
- index2 = parameter->values.array[i + 1];
- substitutionss[j].array[substitutionss[j].used].replace = data->argv[index2];
-
- index2 = parameter->values.array[i + 2];
- substitutionss[j].array[substitutionss[j].used].with = data->argv[index2];
-
- ++substitutionss[j].used;
- }
- } // for
- } // for
-
- return F_none;
- }
-#endif // _di_iki_read_substitutions_identify_
-
-#ifndef _di_iki_read_wraps_identify_
- f_status_t iki_read_wraps_identify(iki_read_data_t * const data, f_iki_vocabulary_t *vocabulary, iki_read_substitution_t *wraps) {
-
- if (data->main->parameters.array[iki_read_parameter_wrap_e].result != f_console_result_additional_e) {
- return F_none;
- }
-
- f_array_length_t i = 0;
- f_array_length_t j = 0;
-
- f_array_length_t index = 0;
- f_array_length_t index2 = 0;
-
- f_console_parameter_t *parameter = &data->main->parameters.array[iki_read_parameter_wrap_e];
-
- for (; i < parameter->values.used; i += 3) {
-
- index = parameter->values.array[i];
-
- for (j = 0; j < vocabulary->used; ++j) {
-
- if (fl_string_dynamic_partial_compare_string(data->argv[index].string, data->buffer, data->argv[index].used, vocabulary->array[j]) == F_equal_to) {
- index2 = parameter->values.array[i + 1];
- wraps[j].replace = data->argv[index2];
-
- index2 = parameter->values.array[i + 2];
- wraps[j].with = data->argv[index2];
- }
- } // for
- } // for
-
- return F_none;
- }
-#endif // _di_iki_read_wraps_identify_
-
#ifdef __cplusplus
} // extern "C"
#endif
#endif
/**
- * Determine the range based on the --at parameter.
+ * Process the arguments, associating replacements and wraps with a given vocabulary.
*
- * If the --at parameter is not specified in the console arguments, then range is untouched.
- * The range.start will be greater than main->buffer.used if the --at range is not found before buffer end is reached.
+ * This does not handle substitutions because substitutions must match both name and value (Object and Content).
+ * This function does not know the value (Content).
*
- * @param data
- * The program data.
- * @param range
- * The range value to represent the --at values.
+ * @param setting
+ * The main program settings.
+ * @param replaces
+ * A map to the last matching replacment or a value of setting->data.vocabulary.used if there is no matching replacement.
+ * Must be an array of length setting->data.vocabulary.used.
+ * @param wraps
+ * A map to the last matching wrap or a value of setting->data.vocabulary.used if there is no matching wrap.
+ * Must be an array of length setting->data.vocabulary.used.
*
* @return
- * F_true is returned if the range is processed.
- * F_false is returned if the range is not processed.
- * F_data_not if the range is processed, but the requested line is out of range.
+ * The matching setting->data.vocabulary index or if no match then setting->data.vocabulary.used.
+ */
+#ifndef _di_iki_read_identify_alteration_
+ extern void iki_read_identify_alteration(iki_read_setting_t * const setting) F_attribute_visibility_internal_d;
+#endif // _di_iki_read_identify_alteration_
+
+/**
+ * Process the arguments, associating the last matching substitution with a given vocabulary name and value (Object and Content).
*
- * Status codes (with error bit) are returned on any problem.
+ * This function expects appropriate sanity checks are performed on the substitutions array before calling.
+ *
+ * @param setting
+ * The main program settings.
+ * @param name
+ * A range within setting->buffer representing the name (Object) to match.
+ * @param value
+ * A range within setting->buffer representing the value (Content) to match.
+ *
+ * @return
+ * The matched substitution.
+ * The value of setting->substitute.used is returned on no match.
+ */
+#ifndef _di_iki_read_identify_substitution_
+ extern f_array_length_t iki_read_identify_substitution(iki_read_setting_t * const setting, const f_string_range_t name, const f_string_range_t value) F_attribute_visibility_internal_d;
+#endif // _di_iki_read_identify_substitution_
+
+/**
+ * Determine the range based on the --line parameter.
+ *
+ * If the --line parameter is not specified in the console arguments, then range is untouched.
+ * The range.start will be greater than main->buffer.used if the --line is not found before buffer end is reached.
+ *
+ * @param main
+ * The main program data.
+ * @param setting
+ * The main program settings.
+ *
+ * This alters setting.status:
+ * F_true is returned if the range is processed.
+ * F_false is returned if the range is not processed.
+ * F_data_not if the range is processed, but the requested line is out of range.
+ * @param range
+ * The range value to represent the --line values.
*/
-#ifndef _di_iki_read_process_at_
- extern f_status_t iki_read_process_at(fll_program_data_t * const main, iki_read_setting_t * const setting, iki_read_data_t * const data, f_string_range_t *range) F_attribute_visibility_internal_d;
-#endif // _di_iki_read_process_at_
+#ifndef _di_iki_read_process_line_
+ extern void iki_read_process_line(fll_program_data_t * const main, iki_read_setting_t * const setting, f_string_range_t *range) F_attribute_visibility_internal_d;
+#endif // _di_iki_read_process_line_
/**
* Process a given buffer.
*
- * @param data
- * The program data.
+ * This will print error messages.
*
- * @return
- * F_none on success.
- * F_data_not on success, but nothing done.
+ * @param main
+ * The main program data.
+ * @param setting
+ * The main program settings.
*
- * Status codes (with error bit) are returned on any problem.
+ * This alters setting.status:
+ * F_none on success.
+ * F_data_not on success, but nothing done.
+ *
+ * F_interrupt (with error bit) on (exit) signal received.
+ *
+ * Errors (with error bit) from: iki_read_process_at().
+ * Errors (with error bit) from: iki_read_process_buffer_ranges().
+ * Errors (with error bit) from: iki_read_process_buffer_ranges_whole().
+ *
+ * @see iki_read_process_at()
+ * @see iki_read_process_buffer_ranges()
+ * @see iki_read_process_buffer_ranges_whole()
*/
#ifndef _di_iki_read_process_buffer_
- extern f_status_t iki_read_process_buffer(iki_read_data_t * const data) F_attribute_visibility_internal_d;
+ extern void iki_read_process_buffer(fll_program_data_t * const main, iki_read_setting_t * const setting) F_attribute_visibility_internal_d;
#endif // _di_iki_read_process_buffer_
/**
* Process a given buffer, printing the given range.
*
- * @param data
- * The program data.
+ * @param main
+ * The main program data.
+ * @param setting
+ * The main program settings.
* @param buffer_range
* The range within the buffer to process.
- * @param iki_data
- * The IKI data.
- * @param ranges
- * The ranges to print when matched.
- * Should be one of: variable, vocabulary, or content.
*
* @return
* F_none on success.
* Status codes (with error bit) are returned on any problem.
*/
#ifndef _di_iki_read_process_buffer_ranges_
- extern f_status_t iki_read_process_buffer_ranges(iki_read_data_t * const data, f_string_range_t *buffer_range, f_iki_data_t *iki_data, f_string_ranges_t *ranges) F_attribute_visibility_internal_d;
+ extern void iki_read_process_buffer_ranges(fll_program_data_t * const main, iki_read_setting_t * const setting, f_string_range_t *buffer_range) F_attribute_visibility_internal_d;
#endif // _di_iki_read_process_buffer_ranges_
/**
* Process a given buffer, printing the given buffer in whole mode based on the given ranges.
*
- * The entire variable is replaced with the range from the associated ranges.
+ * The entire variable is replaced with the value from the associated ranges.
*
- * @param data
- * The program data.
+ * @param main
+ * The main program data.
+ * @param setting
+ * The main program settings.
* @param buffer_range
* The range within the buffer to process.
- * @param iki_data
- * The IKI data.
- * @param ranges
- * The ranges to print when matched.
- * Should be one of: variable, vocabulary, or content.
*
* @return
* F_none on success.
* Status codes (with error bit) are returned on any problem.
*/
#ifndef _di_iki_read_process_buffer_ranges_whole_
- extern f_status_t iki_read_process_buffer_ranges_whole(iki_read_data_t * const data, const f_string_range_t buffer_range, f_iki_data_t *iki_data, f_string_ranges_t *ranges) F_attribute_visibility_internal_d;
+ extern void iki_read_process_buffer_ranges_whole(fll_program_data_t * const main, iki_read_setting_t * const setting, const f_string_range_t buffer_range) F_attribute_visibility_internal_d;
#endif // _di_iki_read_process_buffer_ranges_whole_
/**
* Process a given buffer, printing the total.
*
- * @param data
- * The program data.
- * @param iki_data
- * The IKI data.
+ * @param main
+ * The main program data.
+ * @param setting
+ * The main program settings.
*
* @return
* F_none on success.
* Status codes (with error bit) are returned on any problem.
*/
#ifndef _di_iki_read_process_buffer_total_
- extern f_status_t iki_read_process_buffer_total(iki_read_data_t * const data, f_iki_data_t *iki_data) F_attribute_visibility_internal_d;
+ extern void iki_read_process_buffer_total(fll_program_data_t * const main, iki_read_setting_t * const setting) F_attribute_visibility_internal_d;
#endif // _di_iki_read_process_buffer_total_
-/**
- * Process the arguments, associating replacement with a given vocabulary.
- *
- * The replace property is not used by the --replace option parameter.
- * The replace property is instead used to designate whether or not a match is found.
- * The replace.string property should, therefore, never be accessed because this would likely result in an invalid read.
- *
- * When multiple replacements are found, only use the last specified replacement (right-most).
- *
- * @param data
- * The program data.
- * @param vocabulary
- * The ranges representing a vocabulary.
- * @param replacements
- * An array of replacements representing an index in the respective vocabulary array.
- * This sets replacements[].replace.used to F_false when there are no matches and F_true when there are matches.
- *
- * @return
- * F_none on success.
- *
- * Status codes (with error bit) are returned on any problem.
- */
-#ifndef _di_iki_read_replacements_identify_
- extern f_status_t iki_read_replacements_identify(iki_read_data_t * const data, f_iki_vocabulary_t *vocabulary, iki_read_substitution_t *replacements) F_attribute_visibility_internal_d;
-#endif // _di_iki_read_replacements_identify_
-
-/**
- * Process the arguments, associating substitutions with a given vocabulary.
- *
- * @param data
- * The program data.
- * @param vocabulary
- * The ranges representing a vocabulary.
- * @param substitutionss
- * An array of substitutions with each index representing an index for in the respective vocabulary array.
- *
- * @return
- * F_none on success.
- *
- * Status codes (with error bit) are returned on any problem.
- */
-#ifndef _di_iki_read_substitutions_identify_
- extern f_status_t iki_read_substitutions_identify(iki_read_data_t * const data, f_iki_vocabulary_t *vocabulary, iki_read_substitutions_t *substitutionss) F_attribute_visibility_internal_d;
-#endif // _di_iki_read_substitutions_identify_
-
-/**
- * Process the arguments, associating wraps with a given vocabulary.
- *
- * @param data
- * The program data.
- * @param vocabulary
- * The ranges representing a vocabulary.
- * @param wraps
- * An array of substitutions with each index representing an index for in the respective vocabulary array.
- * The replacements[].replace is used to represent the "before".
- * The replacements[].with is used to represent the "after".
- *
- * @return
- * F_none on success.
- *
- * Status codes (with error bit) are returned on any problem.
- */
-#ifndef _di_iki_read_wraps_identify_
- extern f_status_t iki_read_wraps_identify(iki_read_data_t * const data, f_iki_vocabulary_t *vocabulary, iki_read_substitution_t *wraps) F_attribute_visibility_internal_d;
-#endif // _di_iki_read_wraps_identify_
-
#ifdef __cplusplus
} // extern "C"
#endif
return;
}
- f_string_static_t * const args = main->parameters.arguments.array;
-
const f_array_length_t index = main->parameters.array[iki_write_parameter_file_e].values.array[0];
main->output.to.id = -1;
main->output.to.stream = 0;
- setting->status = f_file_stream_open(args[index], f_string_empty_s, &main->output.to);
+ setting->status = f_file_stream_open(main->parameters.arguments.array[index], f_string_empty_s, &main->output.to);
if (F_status_is_error(setting->status)) {
iki_write_print_line_first_locked(setting, main->error);
- fll_error_file_print(main->error, F_status_set_fine(setting->status), "f_file_stream_open", F_true, args[index], f_file_operation_open_s, fll_error_file_type_file_e);
+ fll_error_file_print(main->error, F_status_set_fine(setting->status), "f_file_stream_open", F_true, main->parameters.arguments.array[index], f_file_operation_open_s, fll_error_file_type_file_e);
iki_write_print_line_last_locked(setting, main->error);
return;
*
* @param setting
* The program main setting data.
+ *
* This does not alter setting.status.
*
* @return
* F_none on success.
*
* Errors (with error bit) from: f_console_parameter_process().
+ * Errors (with error bit) from: f_file_stream_open().
+ * Errors (with error bit) from: f_string_dynamics_resize().
* Errors (with error bit) from: fll_program_parameter_process_context().
+ * Errors (with error bit) from: fll_program_parameter_process_verbosity().
*
* @see f_console_parameter_process()
+ * @see f_file_stream_open()
+ * @see f_string_dynamics_resize()
* @see fll_program_parameter_process_context()
+ * @see fll_program_parameter_process_verbosity()
*/
#ifndef _di_iki_write_setting_load_
extern void iki_write_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, iki_write_setting_t * const setting);
* The main program data.
* @param setting
* The main program settings.
- * This does not alter setting.status.
* All buffers are deallocated.
*
+ * This does not alter setting.status.
+ *
* @return
* F_none on success.
*
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* The output structure to print to.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
* @return
* F_none on success.
*
- * F_failure (with error bit) for any othe failure.
+ * F_failure (with error bit) for any other failure.
*/
#ifndef _di_iki_write_process_
extern f_status_t iki_write_process(fll_program_data_t * const main, iki_write_setting_t * const setting, const f_string_static_t object, const f_string_static_t content) F_attribute_visibility_internal_d;
setting->status = F_status_set_error(F_parameter);
status_code_print_line_first_locked(setting, main->error);
- fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, status_code_long_error_s, status_code_long_fine_s);
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, f_console_symbol_long_enable_s, status_code_long_error_s, status_code_long_fine_s);
status_code_print_line_last_locked(setting, main->error);
return;
setting->status = F_status_set_error(F_parameter);
status_code_print_line_first_locked(setting, main->error);
- fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, status_code_long_warning_s, status_code_long_fine_s);
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, f_console_symbol_long_enable_s, status_code_long_warning_s, status_code_long_fine_s);
status_code_print_line_last_locked(setting, main->error);
return;
*
* @param setting
* The program main setting data.
+ *
* This does not alter setting.status.
*
* @return
* The main program data.
* @param setting
* The main program settings.
- * This does not alter setting.status.
* All buffers are deallocated.
*
+ * This does not alter setting.status.
+ *
* @return
* F_none on success.
*
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* The output structure to print to.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
}
}
- f_string_static_t * const args = main->parameters.arguments.array;
-
if (main->parameters.array[utf8_parameter_to_file_e].result == f_console_result_additional_e) {
if (main->parameters.array[utf8_parameter_to_file_e].values.used > 1) {
setting->status = F_status_set_error(F_parameter);
return;
}
- if (args[main->parameters.array[utf8_parameter_to_file_e].values.array[0]].used) {
+ if (main->parameters.arguments.array[main->parameters.array[utf8_parameter_to_file_e].values.array[0]].used) {
setting->path_files_to.used = 0;
setting->status = f_string_dynamics_increase_by(1, &setting->path_files_to);
++setting->path_files_to.used;
- setting->status = f_file_stream_open(args[main->parameters.array[utf8_parameter_to_file_e].values.array[0]], f_file_open_mode_append_s, &main->output.to);
+ setting->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);
if (F_status_is_error(setting->status)) {
utf8_print_line_first_locked(setting, main->error);
- fll_error_file_print(main->error, F_status_set_fine(setting->status), "f_file_stream_open", F_true, args[main->parameters.array[utf8_parameter_to_file_e].values.array[0]], f_file_operation_open_s, fll_error_file_type_file_e);
+ fll_error_file_print(main->error, F_status_set_fine(setting->status), "f_file_stream_open", F_true, 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_line_last_locked(setting, main->error);
return;
break;
}
- if (args[index].used) {
- if (f_file_exists(args[index], F_true) != F_true) {
- utf8_print_error_parameter_file_not_found(main, setting, F_true, args[index]);
+ 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(main, setting, F_true, main->parameters.arguments.array[index]);
if (F_status_is_error_not(setting->status)) {
setting->status = F_status_set_error(F_file_found_not);
*
* @param setting
* The program main setting data.
+ *
* This does not alter setting.status.
*
* @return
* The main program data.
* @param setting
* The main program settings.
- * This does not alter setting.status.
* All buffers are deallocated.
*
+ * This does not alter setting.status.
+ *
* @return
* F_none on success.
*
* The main program data.
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
*
* @return
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* The output structure to print to.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
+ *
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
IKI Specifications:
IKI is a minimally structured WIKI-like syntax meant to be simpler than WIKI syntax.
- The IKI syntax provides a vocabulary name (with specific context associated with it) followed by quoted code that is associated with the given vocabulary name.
+ The IKI syntax provides a vocabulary name (with specific context associated with it) followed by quoted value that is associated with the given vocabulary name.
The vocabulary represents a list of allowed variable names that may also have specific contextual meaning defined by a given IKI specification.
- The variable name is considered the emphasis:"Object".
+ The variable name is considered the emphasis:"Object" and is also considered the vocabulary.
The variable value is considered the emphasis:"Content".
The IKI format will use code:"iki-0000" to represent an IKI with no explicitly defined vocabulary.
The following emphasis\:"is escaped to not be treated as IKI data".'
- Objects would be\:
+ Objects (also called vocabulary or variable name) would be\:
1) emphasis
2) url
3) code
- Contents would be\:
+ Contents (also called variable value) would be\:
1.1) emphasize some text
2.1) http://www.example.com/url with space/
3.1) const char *string = "My \"quoted\" C string.";