Rename F_supported to F_supported and F_supported_not to F_support_not to avoid past tense.
Add a static empty range to make initialization assignment even easier.
For fss_write:
- Add most of the ignore range handling.
- Add support for the multiple Content per Object and handle errors for standards that do not support this.
- Lost of clean up and simplifications.
- Add a lot of fixme and todo comments for things not yet completed.
There is still a lot to do with fss_write.
The common write functionality is mostly done.
The standard specific functionality is not written for anything except FSS Payload.
*ambient = cap_get_ambient(value);
if (*ambient == -1) {
- return F_status_set_error(F_supported_not);
+ return F_status_set_error(F_support_not);
}
return F_none;
if (errno == ENOMEM) return F_status_set_error(F_memory_not);
if (errno == ENOTDIR) return F_status_set_error(F_directory_not);
if (errno == EPERM) return F_status_set_error(F_prohibited);
- if (errno == EROFS) return F_status_set_error(F_supported_not);
+ if (errno == EROFS) return F_status_set_error(F_support_not);
return F_status_set_error(F_failure);
}
if (errno == ENOMEM) return F_status_set_error(F_memory_not);
if (errno == ENOTDIR) return F_status_set_error(F_directory_not);
if (errno == EPERM) return F_status_set_error(F_prohibited);
- if (errno == EROFS) return F_status_set_error(F_supported_not);
+ if (errno == EROFS) return F_status_set_error(F_support_not);
return F_status_set_error(F_failure);
}
if (errno == ENOMEM) return F_status_set_error(F_memory_not);
if (errno == ENOTDIR) return F_status_set_error(F_directory_not);
if (errno == EPERM) return F_status_set_error(F_prohibited);
- if (errno == EROFS) return F_status_set_error(F_supported_not);
+ if (errno == EROFS) return F_status_set_error(F_support_not);
return F_status_set_error(F_failure);
}
if (errno == ENOMEM) return F_status_set_error(F_memory_not);
if (errno == ENOTDIR) return F_status_set_error(F_directory_not);
if (errno == EPERM) return F_status_set_error(F_prohibited);
- if (errno == EROFS) return F_status_set_error(F_supported_not);
+ if (errno == EROFS) return F_status_set_error(F_support_not);
return F_status_set_error(F_failure);
}
if (errno == ENOMEM) return F_status_set_error(F_memory_not);
if (errno == ENOTDIR) return F_status_set_error(F_directory_not);
if (errno == EPERM) return F_status_set_error(F_prohibited);
- if (errno == EROFS) return F_status_set_error(F_supported_not);
+ if (errno == EROFS) return F_status_set_error(F_support_not);
return F_status_set_error(F_failure);
}
*
* F_implemented_not (with error bit) if this function is not available (due to not having libcap support compiled in).
* F_parameter (with error bit) if a parameter is invalid.
- * F_supported_not (with error bit) if the system does not support ambient capabilities.
+ * F_support_not (with error bit) if the system does not support ambient capabilities.
*
* F_failure (with error bit) on any other failure.
*
* F_name_not (with error bit) if the file name is too long.
* F_parameter (with error bit) if a parameter is invalid.
* F_prohibited (with error bit) if the file system does not permit this operation.
- * F_supported_not (with error bit) if the file system does not support this operation.
+ * F_support_not (with error bit) if the file system does not support this operation.
*
* F_failure (with error bit) on any other failure.
*
* F_name_not (with error bit) if the file name is too long.
* F_parameter (with error bit) if a parameter is invalid.
* F_prohibited (with error bit) if the file system does not permit this operation.
- * F_supported_not (with error bit) if the file system does not support this operation.
+ * F_support_not (with error bit) if the file system does not support this operation.
*
* F_failure (with error bit) on any other failure.
*
* F_name_not (with error bit) if the file name is too long.
* F_parameter (with error bit) if a parameter is invalid.
* F_prohibited (with error bit) if the file system does not permit this operation.
- * F_supported_not (with error bit) if the file system does not support this operation.
+ * F_support_not (with error bit) if the file system does not support this operation.
*
* F_failure (with error bit) on any other failure.
*
* F_name_not (with error bit) if the file name is too long.
* F_parameter (with error bit) if a parameter is invalid.
* F_prohibited (with error bit) if the file system does not permit this operation.
- * F_supported_not (with error bit) if the file system does not support this operation.
+ * F_support_not (with error bit) if the file system does not support this operation.
*
* F_failure (with error bit) on any other failure.
*
* F_name_not (with error bit) if the file name is too long.
* F_parameter (with error bit) if a parameter is invalid.
* F_prohibited (with error bit) if the file system does not permit this operation.
- * F_supported_not (with error bit) if the file system does not support this operation.
+ * F_support_not (with error bit) if the file system does not support this operation.
*
* F_failure (with error bit) on any other error.
*
return F_none;
}
- return F_supported_not;
+ return F_support_not;
}
#endif // _di_f_file_clone_
return F_none;
}
- return F_supported_not;
+ return F_support_not;
}
#endif // _di_f_file_copy_
if (!path.used) return F_data_not;
if (!macro_f_file_type_is_fifo(mode) && !macro_f_file_type_is_character(mode) && !macro_f_file_type_is_block(mode)) {
- return F_status_set_error(F_supported_not);
+ return F_status_set_error(F_support_not);
}
const dev_t device = makedev(major, minor);
if (!path.used) return F_data_not;
if (!macro_f_file_type_is_fifo(mode) && !macro_f_file_type_is_character(mode) && !macro_f_file_type_is_block(mode)) {
- return F_status_set_error(F_supported_not);
+ return F_status_set_error(F_support_not);
}
const dev_t device = makedev(major, minor);
if (!path.used) return F_data_not;
if (!macro_f_file_type_is_fifo(mode) && !macro_f_file_type_is_character(mode) && !macro_f_file_type_is_block(mode)) {
- return F_status_set_error(F_supported_not);
+ return F_status_set_error(F_support_not);
}
return private_f_file_create_node(path, mode, device);
if (!path.used) return F_data_not;
if (!macro_f_file_type_is_fifo(mode) && !macro_f_file_type_is_character(mode) && !macro_f_file_type_is_block(mode)) {
- return F_status_set_error(F_supported_not);
+ return F_status_set_error(F_support_not);
}
return private_f_file_create_node_at(directory, path, mode, device);
* F_prohibited (with error bit) if file system does not allow for making changes.
* F_read_only (with error bit) if file is read-only.
* F_space_not (with error bit) if file system is out of space (or file system quota is reached).
- * F_supported_not if copying a given type of file is unsupported.
+ * F_support_not if copying a given type of file is unsupported.
* F_failure (with error bit) for any other error.
*/
#ifndef _di_f_file_clone_
* F_prohibited (with error bit) if file system does not allow for making changes.
* F_read_only (with error bit) if file is read-only.
* F_space_not (with error bit) if file system is out of space (or file system quota is reached).
- * F_supported_not if copying a given type of file is unsupported.
+ * F_support_not if copying a given type of file is unsupported.
* F_failure (with error bit) for any other error.
*/
#ifndef _di_f_file_copy_
* F_parameter (with error bit) if a parameter is invalid.
* F_prohibited (with error bit) if file system does not allow for making changes.
* F_space_not (with error bit) if file system is out of space (or file system quota is reached).
- * F_supported_not (with error bit) for unsupported file types.
+ * F_support_not (with error bit) for unsupported file types.
* F_failure (with error bit) for any other error.
*
* @see makedev()
* F_parameter (with error bit) if a parameter is invalid.
* F_prohibited (with error bit) if file system does not allow for making changes.
* F_space_not (with error bit) if file system is out of space (or file system quota is reached).
- * F_supported_not (with error bit) for unsupported file types.
+ * F_support_not (with error bit) for unsupported file types.
* F_failure (with error bit) for any other error.
*
* @see makedev()
* F_parameter (with error bit) if a parameter is invalid.
* F_prohibited (with error bit) if file system does not allow for making changes.
* F_space_not (with error bit) if file system is out of space (or file system quota is reached).
- * F_supported_not (with error bit) for unsupported file types.
+ * F_support_not (with error bit) for unsupported file types.
* F_failure (with error bit) for any other error.
*
* @see mkfifo()
* F_parameter (with error bit) if a parameter is invalid.
* F_prohibited (with error bit) if file system does not allow for making changes.
* F_space_not (with error bit) if file system is out of space (or file system quota is reached).
- * F_supported_not (with error bit) for unsupported file types.
+ * F_support_not (with error bit) for unsupported file types.
* F_failure (with error bit) for any other error.
*
* @see mkfifoat()
* F_parameter (with error bit) if a parameter is invalid.
* F_prohibited (with error bit) if file system does not allow for making changes.
* F_space_not (with error bit) if file system is out of space (or file system quota is reached).
- * F_supported_not (with error bit) for unsupported file types.
+ * F_support_not (with error bit) for unsupported file types.
* F_failure (with error bit) for any other error.
*
* @see mknod()
* F_prohibited (with error bit) if file system does not allow for making changes.
* F_space_not (with error bit) if file system is out of space (or file system quota is reached).
* F_failure (with error bit) for any other error.
- * F_supported_not (with error bit) for unsupported file types.
+ * F_support_not (with error bit) for unsupported file types.
*
* @see mknodat()
*/
* F_input_output (with error bit) on I/O error.
* F_parameter (with error bit) if a parameter is invalid.
* F_space_not (with error bit) if file system is out of space (or file system quota is reached).
- * F_supported_not (with error bit) if the file system or file type does not support flushing.
+ * F_support_not (with error bit) if the file system or file type does not support flushing.
* F_failure (with error bit) on any other failure.
*
* @see fsync()
* F_parameter (with error bit) if a parameter is invalid.
* F_prohibited (with error bit) if file system does not allow for making changes.
* F_read_only (with error bit) if file is read-only.
- * F_supported_not (with error bit) fo unsupported file types.
+ * F_support_not (with error bit) fo unsupported file types.
* F_failure (with error bit) for any other error.
*
* @see open()
if (errno == EROFS) return F_status_set_error(F_read_only);
if (errno == ETXTBSY) return F_status_set_error(F_busy);
if (errno == EISDIR) return F_status_set_error(F_directory);
- if (errno == EOPNOTSUPP) return F_status_set_error(F_supported_not);
+ if (errno == EOPNOTSUPP) return F_status_set_error(F_support_not);
return F_status_set_error(F_failure);
}
* F_parameter (with error bit) if a parameter is invalid.
* F_prohibited (with error bit) if file system does not allow for making changes.
* F_read_only (with error bit) if file is read-only.
- * F_supported_not (with error bit) fo unsupported file types.
+ * F_support_not (with error bit) fo unsupported file types.
* F_failure (with error bit) for any other error.
*
* @see fopen()
* F_parameter (with error bit) if a parameter is invalid.
* F_prohibited (with error bit) if file system does not allow for making changes.
* F_read_only (with error bit) if file is read-only.
- * F_supported_not (with error bit) fo unsupported file types.
+ * F_support_not (with error bit) fo unsupported file types.
* F_failure (with error bit) for any other error.
*
* @see fileno()
if (fsync(file.id) < 0) {
if (errno == EBADF) return F_status_set_error(F_file_descriptor);
if (errno == EDQUOT) return F_status_set_error(F_filesystem_quota_block);
- if (errno == EINVAL) return F_status_set_error(F_supported_not);
+ if (errno == EINVAL) return F_status_set_error(F_support_not);
if (errno == EIO) return F_status_set_error(F_input_output);
if (errno == ENOSPC) return F_status_set_error(F_space_not);
- if (errno == EROFS) return F_status_set_error(F_supported_not);
+ if (errno == EROFS) return F_status_set_error(F_support_not);
return F_status_set_error(F_file_synchronize);
}
if (errno == ENOMEM) return F_status_set_error(F_memory_not);
if (errno == ENOSPC) return F_status_set_error(F_space_not);
if (errno == ENOTDIR) return F_status_set_error(F_file_type_not_directory);
- if (errno == EOPNOTSUPP) return F_status_set_error(F_supported_not);
+ if (errno == EOPNOTSUPP) return F_status_set_error(F_support_not);
if (errno == EPERM) return F_status_set_error(F_prohibited);
if (errno == EROFS) return F_status_set_error(F_read_only);
if (errno == ETXTBSY) return F_status_set_error(F_busy);
if (errno == ENOMEM) return F_status_set_error(F_memory_not);
if (errno == ENOSPC) return F_status_set_error(F_space_not);
if (errno == ENOTDIR) return F_status_set_error(F_file_type_not_directory);
- if (errno == EOPNOTSUPP) return F_status_set_error(F_supported_not);
+ if (errno == EOPNOTSUPP) return F_status_set_error(F_support_not);
if (errno == EPERM) return F_status_set_error(F_prohibited);
if (errno == EROFS) return F_status_set_error(F_read_only);
if (errno == ETXTBSY) return F_status_set_error(F_busy);
* F_prohibited (with error bit) if file system does not allow for making changes.
* F_read_only (with error bit) if file is read-only.
* F_space_not (with error bit) if file system is out of space (or file system quota is reached).
- * F_supported_not if copying a given type of file is unsupported.
+ * F_support_not if copying a given type of file is unsupported.
* F_failure (with error bit) for any other error.
*
* @see open()
* F_parameter (with error bit) if a parameter is invalid.
* F_prohibited (with error bit) if file system does not allow for making changes.
* F_space_not (with error bit) if file system is out of space (or file system quota is reached).
- * F_supported_not (with error bit) for unsupported file types.
+ * F_support_not (with error bit) for unsupported file types.
* F_failure (with error bit) for any other error.
*
* @see mkfifo()
* F_parameter (with error bit) if a parameter is invalid.
* F_prohibited (with error bit) if file system does not allow for making changes.
* F_space_not (with error bit) if file system is out of space (or file system quota is reached).
- * F_supported_not (with error bit) for unsupported file types.
+ * F_support_not (with error bit) for unsupported file types.
* F_failure (with error bit) for any other error.
*
* @see mkfifoat()
* F_parameter (with error bit) if a parameter is invalid.
* F_prohibited (with error bit) if file system does not allow for making changes.
* F_space_not (with error bit) if file system is out of space (or file system quota is reached).
- * F_supported_not (with error bit) for unsupported file types.
+ * F_support_not (with error bit) for unsupported file types.
* F_failure (with error bit) for any other error.
*
* @see mknod()
* F_prohibited (with error bit) if file system does not allow for making changes.
* F_space_not (with error bit) if file system is out of space (or file system quota is reached).
* F_failure (with error bit) for any other error.
- * F_supported_not (with error bit) for unsupported file types.
+ * F_support_not (with error bit) for unsupported file types.
*
* @see mknodat()
*
* F_input_output (with error bit) on I/O error.
* F_parameter (with error bit) if a parameter is invalid.
* F_space_not (with error bit) if file system is out of space (or file system quota is reached).
- * F_supported_not (with error bit) if the file system or file type does not support flushing.
+ * F_support_not (with error bit) if the file system or file type does not support flushing.
* F_file_synchronize (with error bit) on any other failure.
*
* @see f_file_clone_at()
* The details on how these work are specific to individual specifications.
* The notes below provide the intended purpose but be sure to still read the individual function documentation.
*
- * Only "next" and "end" are only meaningful for a Content and will be treated as "none" for an Object.
+ * The "next" and "end" are only meaningful for a Content and will be treated as "none" for an Object.
*
* f_fss_complete_*:
* - none: Disable completeness.
if (sigqueue(id, signal, value) == -1) {
if (errno == EAGAIN) return F_status_set_error(F_resource_not);
- if (errno == ENOSYS) return F_status_set_error(F_supported_not);
+ if (errno == ENOSYS) return F_status_set_error(F_support_not);
if (errno == EINVAL) return F_status_set_error(F_parameter);
if (errno == ESRCH) return F_status_set_error(F_found_not);
* F_found_not (with error bit) if the given PID was found.
* F_parameter (with error bit) if a parameter is invalid.
* F_resource_not (with error bit) if the max signals is reached.
- * F_supported_not (with error bit) if this action is not supported by the current OS.
+ * F_support_not (with error bit) if this action is not supported by the current OS.
*
* F_failure (with error bit) for any other error.
*
if (errno == EOPNOTSUPP) return F_status_set_error(F_stream_not);
if (errno == EPROTO) return F_status_set_error(F_protocol);
if (errno == EPERM) return F_status_set_error(F_prohibited);
- if (errno == ESOCKTNOSUPPORT) return F_status_set_error(F_supported_not);
+ if (errno == ESOCKTNOSUPPORT) return F_status_set_error(F_support_not);
if (errno == EPROTONOSUPPORT) return F_status_set_error(F_protocol_not);
if (errno == ETIMEDOUT) return F_status_set_error(F_time_out);
result = shutdown(socket->id, SHUT_RDWR);
}
else {
- return F_status_set_error(F_supported_not);
+ return F_status_set_error(F_support_not);
}
if (result == -1) {
if (errno == EADDRINUSE) return F_status_set_error(F_busy_address);
if (errno == EBADF) return F_status_set_error(F_file_descriptor);
if (errno == ENOTSOCK) return F_status_set_error(F_socket_not);
- if (errno == EOPNOTSUPP) return F_status_set_error(F_supported_not);
+ if (errno == EOPNOTSUPP) return F_status_set_error(F_support_not);
return F_status_set_error(F_failure);
}
* F_protocol_not (with error bit) if the given protocol is unknown or is unsupported.
* F_socket_not (with error bit) if the id is not a socket descriptor.
* F_stream_not (with error bit) the socket type is not a stream.
- * F_supported_not (with error bit) if this socket type is not supported.
+ * F_support_not (with error bit) if this socket type is not supported.
* F_time_out (with error bit) if a timeout occurred.
*
* F_failure (with error bit) for any other error.
* F_parameter (with error bit) if a parameter is invalid.
* F_socket_not (with error bit) if the id is not a socket descriptor.
* F_space_not (with error bit) if file system is out of space (or file system quota is reached).
- * F_supported_not (with error bit) if this socket does not support the listen() operation.
+ * F_support_not (with error bit) if this socket does not support the listen() operation.
*
* F_failure (with error bit) for any other error.
*
* F_busy_address (with error bit) if address is already in use (therefore unavailable).
* F_file_descriptor (with error bit) if id is an invalid descriptor.
* F_socket_not (with error bit) if the id is not a socket descriptor.
- * F_supported_not (with error bit) if this socket does not support the listen() operation.
+ * F_support_not (with error bit) if this socket does not support the listen() operation.
*
* F_failure (with error bit) for any other error.
*
F_string_too_small,
F_success,
F_success_not,
- F_supported,
- F_supported_not,
+ F_support,
+ F_support_not,
F_syntax,
F_syntax_not,
F_terminate,
const f_string_static_t f_status_type_not_s = macro_f_string_static_t_initialize(F_status_type_not_s, 0, F_status_type_not_s_length);
const f_string_static_t f_status_success_s = macro_f_string_static_t_initialize(F_status_success_s, 0, F_status_success_s_length);
const f_string_static_t f_status_success_not_s = macro_f_string_static_t_initialize(F_status_success_not_s, 0, F_status_success_not_s_length);
- const f_string_static_t f_status_supported_s = macro_f_string_static_t_initialize(F_status_supported_s, 0, F_status_supported_s_length);
- const f_string_static_t f_status_supported_not_s = macro_f_string_static_t_initialize(F_status_supported_not_s, 0, F_status_supported_not_s_length);
+ const f_string_static_t f_status_support_s = macro_f_string_static_t_initialize(F_status_support_s, 0, F_status_support_s_length);
+ const f_string_static_t f_status_support_not_s = macro_f_string_static_t_initialize(F_status_support_not_s, 0, F_status_support_not_s_length);
const f_string_static_t f_status_user_s = macro_f_string_static_t_initialize(F_status_user_s, 0, F_status_user_s_length);
const f_string_static_t f_status_user_not_s = macro_f_string_static_t_initialize(F_status_user_not_s, 0, F_status_user_not_s_length);
const f_string_static_t f_status_utf_s = macro_f_string_static_t_initialize(F_status_utf_s, 0, F_status_utf_s_length);
break;
- case F_supported:
- *name = f_status_supported_s;
+ case F_support:
+ *name = f_status_support_s;
break;
- case F_supported_not:
- *name = f_status_supported_not_s;
+ case F_support_not:
+ *name = f_status_support_not_s;
break;
#define F_status_type_not_s "F_type_not"
#define F_status_success_s "F_success"
#define F_status_success_not_s "F_success_not"
- #define F_status_supported_s "F_supported"
- #define F_status_supported_not_s "F_supported_not"
+ #define F_status_support_s "F_support"
+ #define F_status_support_not_s "F_support_not"
#define F_status_user_s "F_user"
#define F_status_user_not_s "F_user_not"
#define F_status_utf_s "F_utf"
#define F_status_string_too_small_s_length 18
#define F_status_success_s_length 9
#define F_status_success_not_s_length 13
- #define F_status_supported_s_length 11
- #define F_status_supported_not_s_length 15
+ #define F_status_support_s_length 9
+ #define F_status_support_not_s_length 13
#define F_status_syntax_s_length 8
#define F_status_syntax_not_s_length 12
#define F_status_terminate_s_length 11
extern const f_string_static_t f_status_type_not_s;
extern const f_string_static_t f_status_success_s;
extern const f_string_static_t f_status_success_not_s;
- extern const f_string_static_t f_status_supported_s;
- extern const f_string_static_t f_status_supported_not_s;
+ extern const f_string_static_t f_status_support_s;
+ extern const f_string_static_t f_status_support_not_s;
extern const f_string_static_t f_status_user_s;
extern const f_string_static_t f_status_user_not_s;
extern const f_string_static_t f_status_utf_s;
extern "C" {
#endif
+#ifndef _di_f_string_range_empty_c_
+ const f_string_range_t f_string_range_empty_c = { 1, 0 };
+#endif // _di_f_string_range_empty_c_
+
#ifdef __cplusplus
} // extern "C"
#endif
range.stop = 0;
#endif // _di_f_string_range_t_
+/**
+ * Provide a static empty range.
+ *
+ * This is intended to represent an empty or disabled range.
+ */
+#ifndef _di_f_string_range_empty_c_
+ extern const f_string_range_t f_string_range_empty_c;
+#endif // _di_f_string_range_empty_c_
+
#ifdef __cplusplus
} // extern "C"
#endif
if (error) {
if (error == EINVAL) return F_status_set_error(F_parameter);
- if (error == ENOTSUP) return F_status_set_error(F_supported_not);
+ if (error == ENOTSUP) return F_status_set_error(F_support_not);
return F_status_set_error(F_failure);
}
const int error = pthread_getcpuclockid(id_thread, id_clock);
if (error) {
- if (error == ENOENT) return F_status_set_error(F_supported_not);
+ if (error == ENOENT) return F_status_set_error(F_support_not);
if (error == ESRCH) return F_status_set_error(F_found_not);
return F_status_set_error(F_failure);
if (error) {
if (error == EDEADLK) return F_status_set_error(F_deadlock);
if (error == EINVAL) return F_status_set_error(F_parameter);
- if (error == EPERM) return F_status_set_error(F_supported_not);
+ if (error == EPERM) return F_status_set_error(F_support_not);
if (error == ESRCH) return F_status_set_error(F_found_not);
return F_status_set_error(F_failure);
if (error == EBUSY) return F_busy;
if (error == EDEADLK) return F_status_set_error(F_deadlock);
if (error == EINVAL) return F_status_set_error(F_parameter);
- if (error == EPERM) return F_status_set_error(F_supported_not);
+ if (error == EPERM) return F_status_set_error(F_support_not);
if (error == ESRCH) return F_status_set_error(F_found_not);
return F_status_set_error(F_failure);
if (error == EBUSY) return F_busy;
if (error == EDEADLK) return F_status_set_error(F_deadlock);
if (error == EINVAL) return F_status_set_error(F_parameter);
- if (error == EPERM) return F_status_set_error(F_supported_not);
+ if (error == EPERM) return F_status_set_error(F_support_not);
if (error == ESRCH) return F_status_set_error(F_found_not);
if (error == ETIMEDOUT) return F_time;
if (error) {
if (error == EINVAL) return F_status_set_error(F_parameter);
if (error == EPERM) return F_status_set_error(F_prohibited);
- if (error == ENOTSUP) return F_status_set_error(F_supported_not);
+ if (error == ENOTSUP) return F_status_set_error(F_support_not);
return F_status_set_error(F_failure);
}
const int error = pthread_getschedparam(id, policy, parameter);
if (error) {
- if (error == ENOTSUP) return F_status_set_error(F_supported_not);
+ if (error == ENOTSUP) return F_status_set_error(F_support_not);
return F_status_set_error(F_failure);
}
if (sem_init(semaphore, shared, value) == -1) {
if (errno == EINVAL) return F_status_set_error(F_parameter);
- if (errno == ENOSYS) return F_status_set_error(F_supported_not);
+ if (errno == ENOSYS) return F_status_set_error(F_support_not);
return F_status_set_error(F_failure);
}
if (error) {
if (error == EAGAIN) return F_status_set_error(F_resource_not);
- if (error == ENOSYS) return F_status_set_error(F_supported_not);
+ if (error == ENOSYS) return F_status_set_error(F_support_not);
if (error == EINVAL) return F_status_set_error(F_parameter);
if (error == ESRCH) return F_status_set_error(F_found_not);
* F_none on success.
*
* F_parameter (with error bit) if a parameter is invalid.
- * F_supported_not (with error bit) if the scope is not supported by the current OS (such as Linux not supporting PTHREAD_SCOPE_PROCESS).
+ * F_support_not (with error bit) if the scope is not supported by the current OS (such as Linux not supporting PTHREAD_SCOPE_PROCESS).
*
* F_failure (with error bit) on any other error.
*
* F_none on success.
*
* F_found_not (with error bit) if no thread by the given ID was found.
- * F_supported_not (with error bit) if per-CPU clocks are not supported by the OS.
+ * F_support_not (with error bit) if per-CPU clocks are not supported by the OS.
*
* F_failure (with error bit) on any other error.
*
* F_deadlock (with error bit) if operation would cause a deadlock.ead.
* F_found_not (with error bit) if no thread by the given ID was found.
* F_parameter (with error bit) if a parameter is invalid.
- * F_supported_not (with error bit) if the thread is not joinable or is already being joined by another thread.
+ * F_support_not (with error bit) if the thread is not joinable or is already being joined by another thread.
*
* F_failure (with error bit) on any other error.
*
* F_deadlock (with error bit) if operation would cause a deadlock.ead.
* F_found_not (with error bit) if no thread by the given ID was found.
* F_parameter (with error bit) if a parameter is invalid.
- * F_supported_not (with error bit) if the thread is not joinable or is already being joined by another thread.
+ * F_support_not (with error bit) if the thread is not joinable or is already being joined by another thread.
*
* F_failure (with error bit) on any other error.
*
* F_deadlock (with error bit) if operation would cause a deadlock.
* F_found_not (with error bit) if no thread by the given ID was found.
* F_parameter (with error bit) if a parameter is invalid.
- * F_supported_not (with error bit) if the thread is not joinable or is already being joined by another thread.
+ * F_support_not (with error bit) if the thread is not joinable or is already being joined by another thread.
*
* F_failure (with error bit) on any other error.
*
*
* F_parameter (with error bit) if a parameter is invalid.
* F_prohibited (with error bit) if not allowed to perform the operation.
- * F_supported_not (with error bit) if the protocol is not supported.
+ * F_support_not (with error bit) if the protocol is not supported.
*
* F_failure (with error bit) on any other error.
*
* F_none on success.
*
* F_parameter (with error bit) if a parameter is invalid.
- * F_supported_not (with error bit) if the policy or scheduling parameter is invalid.
+ * F_support_not (with error bit) if the policy or scheduling parameter is invalid.
*
* F_failure (with error bit) on any other error.
*
* F_none on success.
*
* F_parameter (with error bit) if a parameter is invalid.
- * F_supported_not (with error bit) if the system does not support the process shared semaphore (shared == true).
+ * F_support_not (with error bit) if the system does not support the process shared semaphore (shared == true).
*
* F_failure (with error bit) on any other error.
*
* F_file_found_not (with error bit) if the file was not found and the O_CREAT is not set.
* F_name_not (with error bit) if file name is too long.
* F_parameter (with error bit) if a parameter is invalid.
- * F_supported_not (with error bit) if the system does not support the process shared semaphore (shared == true).
+ * F_support_not (with error bit) if the system does not support the process shared semaphore (shared == true).
* F_memory_not (with error bit) if out of memory.
*
* F_failure (with error bit) on any other error.
* F_found_not (with error bit) if no thread by the given ID was found.
* F_parameter (with error bit) if a parameter is invalid.
* F_resource_not (with error bit) if the max signals is reached.
- * F_supported_not (with error bit) if this action is not supported by the current OS.
+ * F_support_not (with error bit) if this action is not supported by the current OS.
*
* F_failure (with error bit) on any other error.
*
f_status_t status = f_file_clone(path_source, path_destination, recurse.size_block, recurse.flag);
- if (F_status_is_error(status) || status == F_supported_not) {
+ if (F_status_is_error(status) || status == F_support_not) {
if (status == F_status_set_error(F_memory_not)) {
return F_status_set_error(status);
}
f_status_t status = f_file_copy(path_source, path_destination, mode, recurse.size_block, recurse.flag);
- if (F_status_is_error(status) || status == F_supported_not) {
+ if (F_status_is_error(status) || status == F_support_not) {
if (status == F_status_set_error(F_memory_not)) {
return F_status_set_error(status);
}
* If f_fss_complete_full_e, this will write any appropriate open and close aspects of this object.
* If f_fss_complete_full_trim_e, this will write any appropriate open and close aspects of this object, but will omit whitespace before and after the object (inside the quotes).
* If f_fss_complete_partial_e, this will write any appropriate open and close aspects of this object.
- * If f_fss_complete_partial_tim, this will write any appropriate open and close aspects of this object, but will omit whitespace before and after the object (inside the quotes).
+ * If f_fss_complete_partial_trim, this will write any appropriate open and close aspects of this object, but will omit whitespace before and after the object (inside the quotes).
* @param state
* A state for providing flags and handling interrupts during long running operations.
* There is no print_error().
if (as.capability) {
const f_status_t status = f_capability_process_set(as.capability);
- if (F_status_is_error(status) && F_status_set_fine(status) != F_supported_not) {
+ if (F_status_is_error(status) && F_status_set_fine(status) != F_support_not) {
if (parameter && parameter->option & FL_execute_parameter_option_exit_d) {
exit(F_execute_capability);
}
return F_none;
}
- if (fl_string_dynamic_compare(name, f_status_supported_s) == F_equal_to) {
- *code = F_supported;
+ if (fl_string_dynamic_compare(name, f_status_support_s) == F_equal_to) {
+ *code = F_support;
return F_none;
}
- if (fl_string_dynamic_compare(name, f_status_supported_not_s) == F_equal_to) {
- *code = F_supported_not;
+ if (fl_string_dynamic_compare(name, f_status_support_not_s) == F_equal_to) {
+ *code = F_support_not;
return F_none;
}
if (main->pipe & fll_program_data_pipe_input_e) {
control_print_error_pipe_supported_not(main);
- status = F_status_set_error(F_supported_not);
+ status = F_status_set_error(F_support_not);
}
else if (main->parameters.remaining.used) {
control_data_t data = control_data_t_initialize;
return F_status_set_error(F_number);
}
- if (status == F_parameter || status == F_found_not || status == F_interrupt || status == F_supported_not || status == F_critical) {
+ if (status == F_parameter || status == F_found_not || status == F_interrupt || status == F_support_not || status == F_critical) {
return F_status_set_error(status);
}
}
else {
if (action->status == F_none) {
- action->status = F_status_set_error(F_supported_not);
+ action->status = F_status_set_error(F_support_not);
if (F_status_is_error_not(status_action)) {
status_action = action->status;
}
else if (action->type == controller_entry_action_type_failsafe_e || action->type == controller_entry_action_type_item_e) {
if (fl_string_dynamic_compare(controller_main_s, action->parameters.array[0]) == F_equal_to) {
- action->status = F_status_set_error(F_supported_not);
+ action->status = F_status_set_error(F_support_not);
if (F_status_is_error_not(status_action)) {
status_action = action->status;
action->code = controller_entry_timeout_code_stop_d;
}
else {
- action->status = F_status_set_error(F_supported_not);
+ action->status = F_status_set_error(F_support_not);
if (F_status_is_error_not(status_action)) {
status_action = action->status;
action->code |= controller_entry_rule_code_wait_d;
}
else {
- action->status = F_status_set_error(F_supported_not);
+ action->status = F_status_set_error(F_support_not);
if (global.main->error.verbosity > f_console_verbosity_quiet_e) {
f_file_stream_lock(global.main->error.to);
controller_unlock_print_flush(global.main->error.to, global.thread);
}
- status = F_status_set_error(F_supported_not);
+ status = F_status_set_error(F_support_not);
break;
}
status = f_capability_from_text(cache->action.generic, &rule->capability);
- if (F_status_is_error(status) && F_status_set_fine(status) != F_supported_not) {
+ if (F_status_is_error(status) && F_status_set_fine(status) != F_support_not) {
if (F_status_set_fine(status) == F_memory_not) {
// Get the current line number within the settings item.
if (F_status_set_fine(status) == F_none_eol) {
fss_basic_list_write_error_parameter_unsupported_eol_print(main);
- return F_status_set_error(F_supported_not);
+ return F_status_set_error(F_support_not);
}
if (F_status_is_error(status)) {
fll_print_format("%r%[%QThe FSS-0002 (Basic List) standard only supports one content per object.%]%r", main->error.to, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s);
}
- status = F_status_set_error(F_supported_not);
+ status = F_status_set_error(F_support_not);
break;
}
if (F_status_set_fine(status) == F_none_eol) {
fss_basic_write_error_parameter_unsupported_eol_print(main);
- return F_status_set_error(F_supported_not);
+ return F_status_set_error(F_support_not);
}
if (F_status_is_error(status)) {
if (F_status_set_fine(status) == F_none_eol) {
fss_basic_write_error_parameter_unsupported_eol_print(main);
- return F_status_set_error(F_supported_not);
+ return F_status_set_error(F_support_not);
}
if (F_status_is_error(status)) {
fll_print_format("%r%[%QThe FSS-0000 (Basic) standard only supports one content per object.%]%r", main->error.to, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s);
}
- status = F_status_set_error(F_supported_not);
+ status = F_status_set_error(F_support_not);
break;
}
if (F_status_set_fine(status) == F_none_eol) {
fss_basic_write_error_parameter_unsupported_eol_print(main);
- status = F_status_set_error(F_supported_not);
+ status = F_status_set_error(F_support_not);
break;
}
if (F_status_set_fine(status) == F_none_eol) {
fss_embedded_list_write_error_parameter_unsupported_eol_print(main);
- return F_status_set_error(F_supported_not);
+ return F_status_set_error(F_support_not);
}
if (F_status_is_error(status)) {
fll_print_format("%r%[%QThe FSS-0008 (Embedded List) standard only supports one content per object.%]%r", main->error.to, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s);
}
- status = F_status_set_error(F_supported_not);
+ status = F_status_set_error(F_support_not);
break;
}
if (F_status_set_fine(status) == F_none_eol) {
fss_extended_list_write_error_parameter_unsupported_eol_print(main);
- return F_status_set_error(F_supported_not);
+ return F_status_set_error(F_support_not);
}
if (F_status_is_error(status)) {
fll_print_format("%r%[%QThe FSS-0003 (Extended List) standard only supports one content per object.%]%r", main->error.to, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s);
}
- status = F_status_set_error(F_supported_not);
+ status = F_status_set_error(F_support_not);
break;
}
if (F_status_set_fine(status) == F_none_eol) {
fss_extended_write_error_parameter_unsupported_eol_print(main);
- return F_status_set_error(F_supported_not);
+ return F_status_set_error(F_support_not);
}
if (F_status_is_error(status)) {
if (F_status_set_fine(status) == F_none_eol) {
fss_extended_write_error_parameter_unsupported_eol_print(main);
- return F_status_set_error(F_supported_not);
+ return F_status_set_error(F_support_not);
}
if (F_status_is_error(status)) {
if (F_status_set_fine(status) == F_none_eol) {
fss_extended_write_error_parameter_unsupported_eol_print(main);
- status = F_status_set_error(F_supported_not);
+ status = F_status_set_error(F_support_not);
break;
}
#endif
#ifndef _di_fss_write_basic_process_content_
- void fss_write_basic_process_content(fll_program_data_t * const main, void * const setting, const f_string_static_t * const content) {
+ void fss_write_basic_process_content(fll_program_data_t * const main, void * const setting, const bool last) {
if (macro_fss_write_setting(setting)->flag & fss_write_flag_partial_e) {
macro_fss_write_setting(setting)->status = fl_fss_basic_content_write(
- *content,
- f_fss_complete_none_e,
+ *macro_fss_write_setting(setting)->content,
+ f_fss_complete_none_e, // @fixme each of these needs to have "partial", "trim", etc..
macro_fss_write_setting(setting)->state,
¯o_fss_write_setting(setting)->range,
¯o_fss_write_setting(setting)->buffer
}
else {
macro_fss_write_setting(setting)->status = fl_fss_basic_content_write(
- *content,
+ *macro_fss_write_setting(setting)->content,
(macro_fss_write_setting(setting)->flag & fss_write_flag_trim_e) ? f_fss_complete_full_trim_e : f_fss_complete_full_e,
macro_fss_write_setting(setting)->state,
¯o_fss_write_setting(setting)->range,
}
if (F_status_set_fine(macro_fss_write_setting(setting)->status) == F_none_eol) {
- macro_fss_write_setting(setting)->status = F_status_set_error(F_supported_not);
+ macro_fss_write_setting(setting)->status = F_status_set_error(F_support_not);
fss_write_print_line_first_locked(macro_fss_write_setting(setting), main->error);
- fss_write_print_error_unsupported_eol(macro_fss_write_setting(setting), main->error, fss_write_basic_standard_s);
+ fss_write_print_error_unsupported_eol(macro_fss_write_setting(setting), main->error);
fss_write_print_line_last_locked(macro_fss_write_setting(setting), main->error);
return;
#endif // _di_fss_write_basic_process_help_
#ifndef _di_fss_write_basic_process_object_
- void fss_write_basic_process_object(fll_program_data_t * const main, void * const setting, const f_string_static_t * const object) {
+ void fss_write_basic_process_object(fll_program_data_t * const main, void * const setting) {
if (macro_fss_write_setting(setting)->flag & fss_write_flag_partial_e) {
macro_fss_write_setting(setting)->status = fl_fss_basic_object_write(
- *object,
+ *macro_fss_write_setting(setting)->object,
(macro_fss_write_setting(setting)->flag & fss_write_flag_single_e) ? f_fss_quote_type_single_e : f_fss_quote_type_double_e,
f_fss_complete_none_e,
macro_fss_write_setting(setting)->state,
}
else {
macro_fss_write_setting(setting)->status = fl_fss_basic_object_write(
- *object,
+ *macro_fss_write_setting(setting)->object,
(macro_fss_write_setting(setting)->flag & fss_write_flag_single_e) ? f_fss_quote_type_single_e : f_fss_quote_type_double_e,
(macro_fss_write_setting(setting)->flag & fss_write_flag_trim_e) ? f_fss_complete_full_trim_e : f_fss_complete_full_e,
macro_fss_write_setting(setting)->state,
}
if (F_status_set_fine(macro_fss_write_setting(setting)->status) == F_none_eol) {
- macro_fss_write_setting(setting)->status = F_status_set_error(F_supported_not);
+ macro_fss_write_setting(setting)->status = F_status_set_error(F_support_not);
fss_write_print_line_first_locked(macro_fss_write_setting(setting), main->error);
- fss_write_print_error_unsupported_eol(macro_fss_write_setting(setting), main->error, fss_write_basic_standard_s);
+ fss_write_print_error_unsupported_eol(macro_fss_write_setting(setting), main->error);
fss_write_print_line_last_locked(macro_fss_write_setting(setting), main->error);
return;
}
#endif // _di_fss_write_basic_process_object_
-#ifndef _di_fss_write_basic_process_normal_
- void fss_write_basic_process_normal(fll_program_data_t * const main, void * const setting) {
-
- f_string_statics_t * const data = (macro_fss_write_setting(setting)->flag & fss_write_flag_object_e) ? ¯o_fss_write_setting(setting)->objects : ¯o_fss_write_setting(setting)->contents;
-
- for (f_array_length_t i = 0; i < data->used; ++i) {
-
- // @todo replace all signal checks with forked main process that independently checks and assigns main->signal_received.
- if (!((++main->signal_check) % fss_write_signal_check_d)) {
- if (fll_program_standard_signal_received(main)) {
- macro_fss_write_setting(setting)->status = F_status_set_error(F_interrupt);
-
- return;
- }
-
- main->signal_check = 0;
- }
-
- fss_write_process_set(
- main,
- macro_fss_write_setting(setting),
- (macro_fss_write_setting(setting)->flag & fss_write_flag_object_e) ? ¯o_fss_write_setting(setting)->objects.array[i] : 0,
- (macro_fss_write_setting(setting)->flag & fss_write_flag_content_e) ? ¯o_fss_write_setting(setting)->contents.array[i] : 0
- );
-
- if (F_status_is_error(macro_fss_write_setting(setting)->status)) break;
- } // for
- }
-#endif // _di_fss_write_basic_process_normal_
-
-#ifndef _di_fss_write_basic_process_pipe_
- void fss_write_basic_process_pipe(fll_program_data_t * const main, void * const setting) {
-
- // @todo
- }
-#endif // _di_fss_write_basic_process_pipe_
-
#ifdef __cplusplus
} // extern "C"
#endif
*
* This alters setting.status.
* This uses and alters setting.buffer.
- * @param content
- * The string representing the Content to write to the buffer.
+ * @param last
+ * If TRUE, then this is the last Content in the Content set.
+ * If FALSE, then this is not the last Content in the Content set.
*/
#ifndef _di_fss_write_basic_process_content_
- extern void fss_write_basic_process_content(fll_program_data_t * const main, void * const setting, const f_string_static_t * const content);
+ extern void fss_write_basic_process_content(fll_program_data_t * const main, void * const setting, const bool last);
#endif // _di_fss_write_basic_process_content_
/**
#endif // _di_fss_write_basic_process_help_
/**
- * Process normally, writing to the output for FSS-0000 (Basic).
- *
- * @param main
- * The main program data.
- * @param setting
- * The main program settings.
- * Must be of type (fss_write_setting_t *).
- *
- * This alters setting.status:
- * F_none on success.
- * F_interrupt on (exit) signal received.
- *
- * F_parameter (with error bit) if main is NULL or setting is NULL.
- */
-#ifndef _di_fss_write_basic_process_normal_
- extern void fss_write_basic_process_normal(fll_program_data_t * const main, void * const setting);
-#endif // _di_fss_write_basic_process_normal_
-
-/**
* Process a single Object, printing the FSS-0000 (Basic) if valid or an error if invalid.
*
* @param main
*
* This alters setting.status.
* This uses and alters setting.buffer.
- * @param object
- * The string representing the Object to write to the buffer.
*/
#ifndef _di_fss_write_basic_process_object_
- extern void fss_write_basic_process_object(fll_program_data_t * const main, void * const setting, const f_string_static_t * const object);
+ extern void fss_write_basic_process_object(fll_program_data_t * const main, void * const setting);
#endif // _di_fss_write_basic_process_object_
-/**
- * Process the pipe, reading from the pipe and writing to the output for FSS-0000 (Basic).
- *
- * @param main
- * The main program data.
- * @param setting
- * The main program settings.
- * Must be of type (fss_write_setting_t *).
- *
- * This alters setting.status:
- * F_none on success.
- * F_data_not on success but pipe contained no relevant data.
- * F_basic on success and the basic has been printed.
- * F_interrupt on (exit) signal received.
- *
- * F_parameter (with error bit) if main is NULL or setting is NULL.
- */
-#ifndef _di_fss_write_basic_process_pipe_
- extern void fss_write_basic_process_pipe(fll_program_data_t * const main, void * const setting);
-#endif // _di_fss_write_basic_process_pipe_
-
#ifdef __cplusplus
} // extern "C"
#endif
setting.state.data = (void *) &data;
setting.program_name = &fss_write_basic_program_name_s;
setting.program_name_long = &fss_write_basic_program_name_long_s;
+ setting.process_content = &fss_write_basic_process_content;
setting.process_help = &fss_write_basic_process_help;
- setting.process_pipe = &fss_write_basic_process_pipe;
setting.process_normal = &fss_write_basic_process_normal;
setting.process_object = &fss_write_basic_process_object;
- setting.process_content = &fss_write_basic_process_content;
+ setting.process_pipe = &fss_write_process_pipe;
+ setting.process_set = &fss_write_process_normal;
f_console_parameter_t parameters[] = fss_write_console_parameter_t_initialize;
data.parameters.array = parameters;
#endif
#ifndef _di_fss_write_basic_list_process_content_
- void fss_write_basic_list_process_content(fll_program_data_t * const main, void * const setting, const f_string_static_t * const content) {
+ void fss_write_basic_list_process_content(fll_program_data_t * const main, void * const setting, const bool last) {
if (macro_fss_write_setting(setting)->flag & fss_write_flag_partial_e) {
macro_fss_write_setting(setting)->status = fl_fss_basic_list_content_write(
- *content,
+ *macro_fss_write_setting(setting)->content,
f_fss_complete_none_e,
¯o_fss_write_setting(setting)->prepend,
macro_fss_write_setting(setting)->state,
}
else {
macro_fss_write_setting(setting)->status = fl_fss_basic_list_content_write(
- *content,
+ *macro_fss_write_setting(setting)->content,
(macro_fss_write_setting(setting)->flag & fss_write_flag_trim_e) ? f_fss_complete_full_trim_e : f_fss_complete_full_e,
¯o_fss_write_setting(setting)->prepend,
macro_fss_write_setting(setting)->state,
}
if (F_status_set_fine(macro_fss_write_setting(setting)->status) == F_none_eol) {
- macro_fss_write_setting(setting)->status = F_status_set_error(F_supported_not);
+ macro_fss_write_setting(setting)->status = F_status_set_error(F_support_not);
fss_write_print_line_first_locked(macro_fss_write_setting(setting), main->error);
- fss_write_print_error_unsupported_eol(macro_fss_write_setting(setting), main->error, fss_write_basic_list_standard_s);
+ fss_write_print_error_unsupported_eol(macro_fss_write_setting(setting), main->error);
fss_write_print_line_last_locked(macro_fss_write_setting(setting), main->error);
return;
}
#endif // _di_fss_write_basic_list_process_help_
-#ifndef _di_fss_write_basic_list_process_normal_
- void fss_write_basic_list_process_normal(fll_program_data_t * const main, void * const setting) {
-
- // @todo
- }
-#endif // _di_fss_write_basic_list_process_normal_
-
#ifndef _di_fss_write_basic_list_process_object_
- void fss_write_basic_list_process_object(fll_program_data_t * const main, void * const setting, const f_string_static_t * const object) {
+ void fss_write_basic_list_process_object(fll_program_data_t * const main, void * const setting) {
if (macro_fss_write_setting(setting)->flag & fss_write_flag_partial_e) {
macro_fss_write_setting(setting)->status = fl_fss_basic_list_object_write(
- *object,
- f_fss_complete_none_e,
+ *macro_fss_write_setting(setting)->object,
+ f_fss_complete_none_e, // @fixme each of these needs to have "partial", "trim", etc..
macro_fss_write_setting(setting)->state,
¯o_fss_write_setting(setting)->range,
¯o_fss_write_setting(setting)->buffer
}
else {
macro_fss_write_setting(setting)->status = fl_fss_basic_list_object_write(
- *object,
+ *macro_fss_write_setting(setting)->object,
(macro_fss_write_setting(setting)->flag & fss_write_flag_trim_e) ? f_fss_complete_full_trim_e : f_fss_complete_full_e,
macro_fss_write_setting(setting)->state,
¯o_fss_write_setting(setting)->range,
}
if (F_status_set_fine(macro_fss_write_setting(setting)->status) == F_none_eol) {
- macro_fss_write_setting(setting)->status = F_status_set_error(F_supported_not);
+ macro_fss_write_setting(setting)->status = F_status_set_error(F_support_not);
fss_write_print_line_first_locked(macro_fss_write_setting(setting), main->error);
- fss_write_print_error_unsupported_eol(macro_fss_write_setting(setting), main->error, fss_write_basic_list_standard_s);
+ fss_write_print_error_unsupported_eol(macro_fss_write_setting(setting), main->error);
fss_write_print_line_last_locked(macro_fss_write_setting(setting), main->error);
return;
}
#endif // _di_fss_write_basic_list_process_object_
-#ifndef _di_fss_write_basic_list_process_pipe_
- void fss_write_basic_list_process_pipe(fll_program_data_t * const main, void * const setting) {
-
- // @todo
- }
-#endif // _di_fss_write_basic_list_process_pipe_
-
#ifdef __cplusplus
} // extern "C"
#endif
*
* This alters setting.status.
* This uses and alters setting.buffer.
- * @param content
- * The string representing the Content to write to the buffer.
+ * @param last
+ * If TRUE, then this is the last Content in the Content set.
+ * If FALSE, then this is not the last Content in the Content set.
*/
#ifndef _di_fss_write_basic_list_process_content_
- extern void fss_write_basic_list_process_content(fll_program_data_t * const main, void * const setting, const f_string_static_t * const content);
+ extern void fss_write_basic_list_process_content(fll_program_data_t * const main, void * const setting, const bool last);
#endif // _di_fss_write_basic_list_process_content_
/**
#endif // _di_fss_write_basic_list_process_help_
/**
- * Process normally, writing to the output.
- *
- * @param main
- * The main program data.
- * @param setting
- * The main program settings.
- * Must be of type (fss_write_setting_t *).
- *
- * This alters setting.status:
- * F_none on success.
- * F_interrupt on (exit) signal received.
- *
- * F_parameter (with error bit) if main is NULL or setting is NULL.
- */
-#ifndef _di_fss_write_basic_list_process_normal_
- extern void fss_write_basic_list_process_normal(fll_program_data_t * const main, void * const setting);
-#endif // _di_fss_write_basic_list_process_normal_
-
-/**
* Process a single Object, printing the FSS-0002 (Basic List) if valid or an error if invalid.
*
* @param main
*
* This alters setting.status.
* This uses and alters setting.buffer.
- * @param object
- * The string representing the Object to write to the buffer.
*/
#ifndef _di_fss_write_basic_list_process_object_
- extern void fss_write_basic_list_process_object(fll_program_data_t * const main, void * const setting, const f_string_static_t * const object);
+ extern void fss_write_basic_list_process_object(fll_program_data_t * const main, void * const setting);
#endif // _di_fss_write_basic_list_process_object_
-/**
- * Process the pipe, reading from the pipe and writing to the output.
- *
- * @param main
- * The main program data.
- * @param setting
- * The main program settings.
- * Must be of type (fss_write_setting_t *).
- *
- * This alters setting.status:
- * F_none on success.
- * F_data_not on success but pipe contained no relevant data.
- * F_basic_list on success and the basic_list has been printed.
- * F_interrupt on (exit) signal received.
- *
- * F_parameter (with error bit) if main is NULL or setting is NULL.
- */
-#ifndef _di_fss_write_basic_list_process_pipe_
- extern void fss_write_basic_list_process_pipe(fll_program_data_t * const main, void * const setting);
-#endif // _di_fss_write_basic_list_process_pipe_
-
#ifdef __cplusplus
} // extern "C"
#endif
setting.state.data = (void *) &data;
setting.program_name = &fss_write_basic_list_program_name_s;
setting.program_name_long = &fss_write_basic_list_program_name_long_s;
+ setting.process_content = &fss_write_basic_list_process_content;
setting.process_help = &fss_write_basic_list_process_help;
- setting.process_pipe = &fss_write_basic_list_process_pipe;
setting.process_normal = &fss_write_basic_list_process_normal;
setting.process_object = &fss_write_basic_list_process_object;
- setting.process_content = &fss_write_basic_list_process_content;
+ setting.process_pipe = &fss_write_basic_list_process_pipe;
+ setting.process_set = &fss_write_process_normal;
f_console_parameter_t parameters[] = fss_write_console_parameter_t_initialize;
data.parameters.array = parameters;
#endif
#ifndef _di_fss_write_embedded_list_process_content_
- void fss_write_embedded_list_process_content(fll_program_data_t * const main, void * const setting, const f_string_static_t * const content) {
+ void fss_write_embedded_list_process_content(fll_program_data_t * const main, void * const setting, const bool last) {
if (macro_fss_write_setting(setting)->flag & fss_write_flag_partial_e) {
macro_fss_write_setting(setting)->status = fl_fss_embedded_list_content_write(
- *content,
- f_fss_complete_none_e,
+ *macro_fss_write_setting(setting)->content,
+ f_fss_complete_none_e, // @fixme each of these needs to have "partial", "trim", etc..
¯o_fss_write_setting(setting)->prepend,
- ¯o_fss_write_setting(setting)->ignores,
+ macro_fss_write_setting(setting)->ignores,
macro_fss_write_setting(setting)->state,
¯o_fss_write_setting(setting)->range,
¯o_fss_write_setting(setting)->buffer
}
else {
macro_fss_write_setting(setting)->status = fl_fss_embedded_list_content_write(
- *content,
+ *macro_fss_write_setting(setting)->content,
(macro_fss_write_setting(setting)->flag & fss_write_flag_trim_e) ? f_fss_complete_full_trim_e : f_fss_complete_full_e,
¯o_fss_write_setting(setting)->prepend,
- ¯o_fss_write_setting(setting)->ignores,
+ macro_fss_write_setting(setting)->ignores,
macro_fss_write_setting(setting)->state,
¯o_fss_write_setting(setting)->range,
¯o_fss_write_setting(setting)->buffer
}
if (F_status_set_fine(macro_fss_write_setting(setting)->status) == F_none_eol) {
- macro_fss_write_setting(setting)->status = F_status_set_error(F_supported_not);
+ macro_fss_write_setting(setting)->status = F_status_set_error(F_support_not);
fss_write_print_line_first_locked(macro_fss_write_setting(setting), main->error);
- fss_write_print_error_unsupported_eol(macro_fss_write_setting(setting), main->error, fss_write_embedded_list_standard_s);
+ fss_write_print_error_unsupported_eol(macro_fss_write_setting(setting), main->error);
fss_write_print_line_last_locked(macro_fss_write_setting(setting), main->error);
return;
}
#endif // _di_fss_write_embedded_list_process_help_
-#ifndef _di_fss_write_embedded_list_process_normal_
- void fss_write_embedded_list_process_normal(fll_program_data_t * const main, void * const setting) {
-
- // @todo
- }
-#endif // _di_fss_write_embedded_list_process_normal_
-
#ifndef _di_fss_write_embedded_list_process_object_
- void fss_write_embedded_list_process_object(fll_program_data_t * const main, void * const setting, const f_string_static_t * const object) {
+ void fss_write_embedded_list_process_object(fll_program_data_t * const main, void * const setting) {
if (macro_fss_write_setting(setting)->flag & fss_write_flag_partial_e) {
macro_fss_write_setting(setting)->status = fl_fss_embedded_list_object_write(
- *object,
+ *macro_fss_write_setting(setting)->object,
f_fss_complete_none_e,
macro_fss_write_setting(setting)->state,
¯o_fss_write_setting(setting)->range,
}
else {
macro_fss_write_setting(setting)->status = fl_fss_embedded_list_object_write(
- *object,
+ *macro_fss_write_setting(setting)->object,
(macro_fss_write_setting(setting)->flag & fss_write_flag_trim_e) ? f_fss_complete_full_trim_e : f_fss_complete_full_e,
macro_fss_write_setting(setting)->state,
¯o_fss_write_setting(setting)->range,
}
if (F_status_set_fine(macro_fss_write_setting(setting)->status) == F_none_eol) {
- macro_fss_write_setting(setting)->status = F_status_set_error(F_supported_not);
+ macro_fss_write_setting(setting)->status = F_status_set_error(F_support_not);
fss_write_print_line_first_locked(macro_fss_write_setting(setting), main->error);
- fss_write_print_error_unsupported_eol(macro_fss_write_setting(setting), main->error, fss_write_embedded_list_standard_s);
+ fss_write_print_error_unsupported_eol(macro_fss_write_setting(setting), main->error);
fss_write_print_line_last_locked(macro_fss_write_setting(setting), main->error);
return;
}
#endif // _di_fss_write_embedded_list_process_object_
-#ifndef _di_fss_write_embedded_list_process_pipe_
- void fss_write_embedded_list_process_pipe(fll_program_data_t * const main, void * const setting) {
-
- // @todo
- }
-#endif // _di_fss_write_embedded_list_process_pipe_
-
#ifdef __cplusplus
} // extern "C"
#endif
*
* This alters setting.status.
* This uses and alters setting.buffer.
- * @param content
- * The string representing the Content to write to the buffer.
+ * @param last
+ * If TRUE, then this is the last Content in the Content set.
+ * If FALSE, then this is not the last Content in the Content set.
*/
#ifndef _di_fss_write_embedded_list_process_content_
- extern void fss_write_embedded_list_process_content(fll_program_data_t * const main, void * const setting, const f_string_static_t * const content);
+ extern void fss_write_embedded_list_process_content(fll_program_data_t * const main, void * const setting, const bool last);
#endif // _di_fss_write_embedded_list_process_content_
/**
#endif // _di_fss_write_embedded_list_process_help_
/**
- * Process normally, writing to the output.
- *
- * @param main
- * The main program data.
- * @param setting
- * The main program settings.
- * Must be of type (fss_write_setting_t *).
- *
- * This alters setting.status:
- * F_none on success.
- * F_interrupt on (exit) signal received.
- *
- * F_parameter (with error bit) if main is NULL or setting is NULL.
- */
-#ifndef _di_fss_write_embedded_list_process_normal_
- extern void fss_write_embedded_list_process_normal(fll_program_data_t * const main, void * const setting);
-#endif // _di_fss_write_embedded_list_process_normal_
-
-/**
* Process a single Object, printing the FSS-0008 (Embedded List) if valid or an error if invalid.
*
* @param main
*
* This alters setting.status.
* This uses and alters setting.buffer.
- * @param object
- * The string representing the Object to write to the buffer.
*/
#ifndef _di_fss_write_embedded_list_process_object_
- extern void fss_write_embedded_list_process_object(fll_program_data_t * const main, void * const setting, const f_string_static_t * const object);
+ extern void fss_write_embedded_list_process_object(fll_program_data_t * const main, void * const setting);
#endif // _di_fss_write_embedded_list_process_object_
-/**
- * Process the pipe, reading from the pipe and writing to the output.
- *
- * @param main
- * The main program data.
- * @param setting
- * The main program settings.
- * Must be of type (fss_write_setting_t *).
- *
- * This alters setting.status:
- * F_none on success.
- * F_data_not on success but pipe contained no relevant data.
- * F_embedded_list on success and the embedded_list has been printed.
- * F_interrupt on (exit) signal received.
- *
- * F_parameter (with error bit) if main is NULL or setting is NULL.
- */
-#ifndef _di_fss_write_embedded_list_process_pipe_
- extern void fss_write_embedded_list_process_pipe(fll_program_data_t * const main, void * const setting);
-#endif // _di_fss_write_embedded_list_process_pipe_
-
#ifdef __cplusplus
} // extern "C"
#endif
setting.state.data = (void *) &data;
setting.program_name = &fss_write_embedded_list_program_name_s;
setting.program_name_long = &fss_write_embedded_list_program_name_long_s;
+ setting.process_content = &fss_write_embedded_list_process_content;
setting.process_help = &fss_write_embedded_list_process_help;
- setting.process_pipe = &fss_write_embedded_list_process_pipe;
setting.process_normal = &fss_write_embedded_list_process_normal;
setting.process_object = &fss_write_embedded_list_process_object;
- setting.process_content = &fss_write_embedded_list_process_content;
+ setting.process_pipe = &fss_write_embedded_list_process_pipe;
+ setting.process_set = &fss_write_process_normal;
+ setting.flag |= fss_write_flag_ignore_e;
f_console_parameter_t parameters[] = fss_write_console_parameter_t_initialize;
data.parameters.array = parameters;
#endif
#ifndef _di_fss_write_extended_process_content_
- void fss_write_extended_process_content(fll_program_data_t * const main, void * const setting, const f_string_static_t * const content) {
+ void fss_write_extended_process_content(fll_program_data_t * const main, void * const setting, const bool last) {
if (macro_fss_write_setting(setting)->flag & fss_write_flag_partial_e) {
macro_fss_write_setting(setting)->status = fl_fss_extended_content_write(
- *content,
+ *macro_fss_write_setting(setting)->content,
(macro_fss_write_setting(setting)->flag & fss_write_flag_single_e) ? f_fss_quote_type_single_e : f_fss_quote_type_double_e,
- f_fss_complete_none_e,
+ f_fss_complete_none_e, // @fixme each of these needs to have "partial", "trim", etc..
macro_fss_write_setting(setting)->state,
¯o_fss_write_setting(setting)->range,
¯o_fss_write_setting(setting)->buffer
}
else {
macro_fss_write_setting(setting)->status = fl_fss_extended_content_write(
- *content,
+ *macro_fss_write_setting(setting)->content,
(macro_fss_write_setting(setting)->flag & fss_write_flag_single_e) ? f_fss_quote_type_single_e : f_fss_quote_type_double_e,
(macro_fss_write_setting(setting)->flag & fss_write_flag_trim_e) ? f_fss_complete_full_trim_e : f_fss_complete_full_e,
macro_fss_write_setting(setting)->state,
}
if (F_status_set_fine(macro_fss_write_setting(setting)->status) == F_none_eol) {
- macro_fss_write_setting(setting)->status = F_status_set_error(F_supported_not);
+ macro_fss_write_setting(setting)->status = F_status_set_error(F_support_not);
fss_write_print_line_first_locked(macro_fss_write_setting(setting), main->error);
- fss_write_print_error_unsupported_eol(macro_fss_write_setting(setting), main->error, fss_write_extended_standard_s);
+ fss_write_print_error_unsupported_eol(macro_fss_write_setting(setting), main->error);
fss_write_print_line_last_locked(macro_fss_write_setting(setting), main->error);
return;
}
#endif // _di_fss_write_extended_process_help_
-#ifndef _di_fss_write_extended_process_normal_
- void fss_write_extended_process_normal(fll_program_data_t * const main, void * const setting) {
-
- // @todo
- }
-#endif // _di_fss_write_extended_process_normal_
-
#ifndef _di_fss_write_extended_process_object_
- void fss_write_extended_process_object(fll_program_data_t * const main, void * const setting, const f_string_static_t * const object) {
+ void fss_write_extended_process_object(fll_program_data_t * const main, void * const setting) {
if (macro_fss_write_setting(setting)->flag & fss_write_flag_partial_e) {
macro_fss_write_setting(setting)->status = fl_fss_extended_object_write(
- *object,
+ *macro_fss_write_setting(setting)->object,
(macro_fss_write_setting(setting)->flag & fss_write_flag_single_e) ? f_fss_quote_type_single_e : f_fss_quote_type_double_e,
f_fss_complete_none_e,
macro_fss_write_setting(setting)->state,
}
else {
macro_fss_write_setting(setting)->status = fl_fss_extended_object_write(
- *object,
+ *macro_fss_write_setting(setting)->object,
(macro_fss_write_setting(setting)->flag & fss_write_flag_single_e) ? f_fss_quote_type_single_e : f_fss_quote_type_double_e,
(macro_fss_write_setting(setting)->flag & fss_write_flag_trim_e) ? f_fss_complete_full_trim_e : f_fss_complete_full_e,
macro_fss_write_setting(setting)->state,
}
if (F_status_set_fine(macro_fss_write_setting(setting)->status) == F_none_eol) {
- macro_fss_write_setting(setting)->status = F_status_set_error(F_supported_not);
+ macro_fss_write_setting(setting)->status = F_status_set_error(F_support_not);
fss_write_print_line_first_locked(macro_fss_write_setting(setting), main->error);
- fss_write_print_error_unsupported_eol(macro_fss_write_setting(setting), main->error, fss_write_extended_standard_s);
+ fss_write_print_error_unsupported_eol(macro_fss_write_setting(setting), main->error);
fss_write_print_line_last_locked(macro_fss_write_setting(setting), main->error);
return;
}
#endif // _di_fss_write_extended_process_object_
-#ifndef _di_fss_write_extended_process_pipe_
- void fss_write_extended_process_pipe(fll_program_data_t * const main, void * const setting) {
-
- // @todo
- }
-#endif // _di_fss_write_extended_process_pipe_
-
#ifdef __cplusplus
} // extern "C"
#endif
*
* This alters setting.status.
* This uses and alters setting.buffer.
- * @param content
- * The string representing the Content to write to the buffer.
+ * @param last
+ * If TRUE, then this is the last Content in the Content set.
+ * If FALSE, then this is not the last Content in the Content set.
*/
#ifndef _di_fss_write_extended_process_content_
- extern void fss_write_extended_process_content(fll_program_data_t * const main, void * const setting, const f_string_static_t * const content);
+ extern void fss_write_extended_process_content(fll_program_data_t * const main, void * const setting, const bool last);
#endif // _di_fss_write_extended_process_content_
/**
#endif // _di_fss_write_extended_process_help_
/**
- * Process normally, writing to the output.
- *
- * @param main
- * The main program data.
- * @param setting
- * The main program settings.
- * Must be of type (fss_write_setting_t *).
- *
- * This alters setting.status:
- * F_none on success.
- * F_interrupt on (exit) signal received.
- *
- * F_parameter (with error bit) if main is NULL or setting is NULL.
- */
-#ifndef _di_fss_write_extended_process_normal_
- extern void fss_write_extended_process_normal(fll_program_data_t * const main, void * const setting);
-#endif // _di_fss_write_extended_process_normal_
-
-/**
* Process a single Object, printing the FSS-0001 (Extended) if valid or an error if invalid.
*
* @param main
*
* This alters setting.status.
* This uses and alters setting.buffer.
- * @param object
- * The string representing the Object to write to the buffer.
*/
#ifndef _di_fss_write_extended_process_object_
- extern void fss_write_extended_process_object(fll_program_data_t * const main, void * const setting, const f_string_static_t * const object);
+ extern void fss_write_extended_process_object(fll_program_data_t * const main, void * const setting);
#endif // _di_fss_write_extended_process_object_
-/**
- * Process the pipe, reading from the pipe and writing to the output.
- *
- * @param main
- * The main program data.
- * @param setting
- * The main program settings.
- * Must be of type (fss_write_setting_t *).
- *
- * This alters setting.status:
- * F_none on success.
- * F_data_not on success but pipe contained no relevant data.
- * F_extended on success and the extended has been printed.
- * F_interrupt on (exit) signal received.
- *
- * F_parameter (with error bit) if main is NULL or setting is NULL.
- */
-#ifndef _di_fss_write_extended_process_pipe_
- extern void fss_write_extended_process_pipe(fll_program_data_t * const main, void * const setting);
-#endif // _di_fss_write_extended_process_pipe_
-
#ifdef __cplusplus
} // extern "C"
#endif
setting.state.data = (void *) &data;
setting.program_name = &fss_write_extended_program_name_s;
setting.program_name_long = &fss_write_extended_program_name_long_s;
+ setting.process_content = &fss_write_exended_process_content;
setting.process_help = &fss_write_extended_process_help;
- setting.process_pipe = &fss_write_extended_process_pipe;
setting.process_normal = &fss_write_extended_process_normal;
setting.process_object = &fss_write_exended_process_object;
- setting.process_content = &fss_write_exended_process_content;
+ setting.process_pipe = &fss_write_extended_process_pipe;
+ setting.process_set = &fss_write_process_normal;
f_console_parameter_t parameters[] = fss_write_console_parameter_t_initialize;
data.parameters.array = parameters;
#endif
#ifndef _di_fss_write_extended_list_process_content_
- void fss_write_extended_list_process_content(fll_program_data_t * const main, void * const setting, const f_string_static_t * const content) {
+ void fss_write_extended_list_process_content(fll_program_data_t * const main, void * const setting, const bool last) {
if (macro_fss_write_setting(setting)->flag & fss_write_flag_partial_e) {
macro_fss_write_setting(setting)->status = fl_fss_extended_list_content_write(
- *content,
- f_fss_complete_none_e,
+ *macro_fss_write_setting(setting)->content,
+ last ? f_fss_complete_partial_e : f_fss_complete_partial_trim_e, // @fixme each of these needs to have "partial", "trim", etc..
¯o_fss_write_setting(setting)->prepend,
- ¯o_fss_write_setting(setting)->ignores,
+ macro_fss_write_setting(setting)->ignores,
macro_fss_write_setting(setting)->state,
¯o_fss_write_setting(setting)->range,
¯o_fss_write_setting(setting)->buffer
}
else {
macro_fss_write_setting(setting)->status = fl_fss_extended_list_content_write(
- *content,
+ *macro_fss_write_setting(setting)->content,
(macro_fss_write_setting(setting)->flag & fss_write_flag_trim_e) ? f_fss_complete_full_trim_e : f_fss_complete_full_e,
¯o_fss_write_setting(setting)->prepend,
- ¯o_fss_write_setting(setting)->ignores,
+ macro_fss_write_setting(setting)->ignores,
macro_fss_write_setting(setting)->state,
¯o_fss_write_setting(setting)->range,
¯o_fss_write_setting(setting)->buffer
}
if (F_status_set_fine(macro_fss_write_setting(setting)->status) == F_none_eol) {
- macro_fss_write_setting(setting)->status = F_status_set_error(F_supported_not);
+ macro_fss_write_setting(setting)->status = F_status_set_error(F_support_not);
fss_write_print_line_first_locked(macro_fss_write_setting(setting), main->error);
- fss_write_print_error_unsupported_eol(macro_fss_write_setting(setting), main->error, fss_write_extended_list_standard_s);
+ fss_write_print_error_unsupported_eol(macro_fss_write_setting(setting), main->error);
fss_write_print_line_last_locked(macro_fss_write_setting(setting), main->error);
return;
}
#endif // _di_fss_write_extended_list_process_help_
-#ifndef _di_fss_write_extended_list_process_normal_
- void fss_write_extended_list_process_normal(fll_program_data_t * const main, void * const setting) {
-
- // @todo
- }
-#endif // _di_fss_write_extended_list_process_normal_
-
#ifndef _di_fss_write_extended_list_process_object_
- void fss_write_extended_list_process_object(fll_program_data_t * const main, void * const setting, const f_string_static_t * const object) {
+ void fss_write_extended_list_process_object(fll_program_data_t * const main, void * const setting) {
if (macro_fss_write_setting(setting)->flag & fss_write_flag_partial_e) {
macro_fss_write_setting(setting)->status = fl_fss_extended_list_object_write(
- *object,
+ *macro_fss_write_setting(setting)->object,
f_fss_complete_none_e,
macro_fss_write_setting(setting)->state,
¯o_fss_write_setting(setting)->range,
}
else {
macro_fss_write_setting(setting)->status = fl_fss_extended_list_object_write(
- *object,
+ *macro_fss_write_setting(setting)->object,
(macro_fss_write_setting(setting)->flag & fss_write_flag_trim_e) ? f_fss_complete_full_trim_e : f_fss_complete_full_e,
macro_fss_write_setting(setting)->state,
¯o_fss_write_setting(setting)->range,
}
if (F_status_set_fine(macro_fss_write_setting(setting)->status) == F_none_eol) {
- macro_fss_write_setting(setting)->status = F_status_set_error(F_supported_not);
+ macro_fss_write_setting(setting)->status = F_status_set_error(F_support_not);
fss_write_print_line_first_locked(macro_fss_write_setting(setting), main->error);
- fss_write_print_error_unsupported_eol(macro_fss_write_setting(setting), main->error, fss_write_extended_list_standard_s);
+ fss_write_print_error_unsupported_eol(macro_fss_write_setting(setting), main->error);
fss_write_print_line_last_locked(macro_fss_write_setting(setting), main->error);
return;
}
#endif // _di_fss_write_extended_list_process_object_
-#ifndef _di_fss_write_extended_list_process_pipe_
- void fss_write_extended_list_process_pipe(fll_program_data_t * const main, void * const setting) {
-
- // @todo
- }
-#endif // _di_fss_write_extended_list_process_pipe_
-
#ifdef __cplusplus
} // extern "C"
#endif
*
* This alters setting.status.
* This uses and alters setting.buffer.
- * @param content
- * The string representing the Content to write to the buffer.
+ * @param last
+ * If TRUE, then this is the last Content in the Content set.
+ * If FALSE, then this is not the last Content in the Content set.
*/
#ifndef _di_fss_write_extended_list_process_content_
- extern void fss_write_extended_list_process_content(fll_program_data_t * const main, void * const setting, const f_string_static_t * const content);
+ extern void fss_write_extended_list_process_content(fll_program_data_t * const main, void * const setting, const bool last);
#endif // _di_fss_write_extended_list_process_content_
/**
#endif // _di_fss_write_extended_list_process_help_
/**
- * Process normally, writing to the output.
- *
- * @param main
- * The main program data.
- * @param setting
- * The main program settings.
- * Must be of type (fss_write_setting_t *).
- *
- * This alters setting.status:
- * F_none on success.
- * F_interrupt on (exit) signal received.
- *
- * F_parameter (with error bit) if main is NULL or setting is NULL.
- */
-#ifndef _di_fss_write_extended_list_process_normal_
- extern void fss_write_extended_list_process_normal(fll_program_data_t * const main, void * const setting);
-#endif // _di_fss_write_extended_list_process_normal_
-
-/**
* Process a single Object, printing the FSS-0003 (Extended List) if valid or an error if invalid.
*
* @param main
*
* This alters setting.status.
* This uses and alters setting.buffer.
- * @param object
- * The string representing the Object to write to the buffer.
*/
#ifndef _di_fss_write_extended_list_process_object_
- extern void fss_write_extended_list_process_object(fll_program_data_t * const main, void * const setting, const f_string_static_t * const object);
+ extern void fss_write_extended_list_process_object(fll_program_data_t * const main, void * const setting);
#endif // _di_fss_write_extended_list_process_object_
-/**
- * Process the pipe, reading from the pipe and writing to the output.
- *
- * @param main
- * The main program data.
- * @param setting
- * The main program settings.
- * Must be of type (fss_write_setting_t *).
- *
- * This alters setting.status:
- * F_none on success.
- * F_data_not on success but pipe contained no relevant data.
- * F_extended_list on success and the extended_list has been printed.
- * F_interrupt on (exit) signal received.
- *
- * F_parameter (with error bit) if main is NULL or setting is NULL.
- */
-#ifndef _di_fss_write_extended_list_process_pipe_
- extern void fss_write_extended_list_process_pipe(fll_program_data_t * const main, void * const setting);
-#endif // _di_fss_write_extended_list_process_pipe_
-
#ifdef __cplusplus
} // extern "C"
#endif
setting.state.data = (void *) &data;
setting.program_name = &fss_write_extended_list_program_name_s;
setting.program_name_long = &fss_write_extended_list_program_name_long_s;
+ setting.process_content = &fss_write_exended_list_process_content;
setting.process_help = &fss_write_extended_list_process_help;
- setting.process_pipe = &fss_write_extended_list_process_pipe;
setting.process_normal = &fss_write_extended_list_process_normal;
setting.process_object = &fss_write_exended_list_process_object;
- setting.process_content = &fss_write_exended_list_process_content;
+ setting.process_pipe = &fss_write_extended_list_process_pipe;
+ setting.process_set = &fss_write_process_normal;
+ setting.flag |= fss_write_flag_ignore_e;
f_console_parameter_t parameters[] = fss_write_console_parameter_t_initialize;
data.parameters.array = parameters;
f_string_dynamic_resize(0, &setting->escaped);
f_string_dynamic_resize(0, &setting->block);
f_string_dynamic_resize(0, &setting->buffer);
- f_string_dynamic_resize(0, &setting->object);
- f_string_dynamic_resize(0, &setting->content);
f_string_dynamic_resize(0, &setting->prepend);
- f_string_ranges_resize(0, &setting->ignores);
+ f_string_rangess_resize(0, &setting->ignoress);
f_string_dynamics_resize(0, &setting->objects);
- f_string_dynamics_resize(0, &setting->contents);
+ f_string_dynamicss_resize(0, &setting->contentss);
return F_none;
}
return;
}
- // Construct the array without allocating any more memory by setting this as a static string (used > 0, size = 0).
+ // Construct the array without allocating any more memory for the string data by setting this as a static string (used > 0, size = 0).
for (f_array_length_t index = 0; setting->objects.used < values->used; ) {
index = values->array[setting->objects.used];
}
if ((main->parameters.array[fss_write_parameter_content_e].result & f_console_result_value_e) && main->parameters.array[fss_write_parameter_content_e].values.used) {
- f_array_lengths_t * const values = &main->parameters.array[fss_write_parameter_content_e].values;
- setting->contents.used = 0;
+ if (setting->flag & fss_write_flag_object_e) {
+ if (!(setting->flag & fss_write_flag_content_multiple_e)) {
+ if (main->parameters.array[fss_write_parameter_content_e].values.used > main->parameters.array[fss_write_parameter_object_e].values.used) {
+ setting->status = F_status_set_error(F_support_not);
- setting->status = f_string_dynamics_resize(values->used, &setting->contents);
+ fss_write_print_error_one_content_only(setting, main->error);
+
+ return;
+ }
+ }
+ }
+
+ f_array_length_t stub_object_array[1] = { 0 };
+ f_array_lengths_t stub_object = macro_f_array_lengths_t_initialize(stub_object_array, 0, 1);
+
+ f_array_lengths_t * const values_content = &main->parameters.array[fss_write_parameter_content_e].values;
+ f_array_lengths_t * const values_object = main->parameters.array[fss_write_parameter_object_e].values.used
+ ? &main->parameters.array[fss_write_parameter_object_e].values
+ : &stub_object;
+
+ setting->contentss.used = 0;
+
+ setting->status = f_string_dynamicss_increase_by(values_object->used, &setting->contentss);
if (F_status_is_error(setting->status)) {
- fss_write_print_error(setting, main->error, "f_string_dynamics_resize");
+ fss_write_print_error(setting, main->error, "f_string_dynamicss_increase_by");
return;
}
- // Construct the array without allocating any more memory by setting this as a static string (used > 0, size = 0).
- for (f_array_length_t index = 0; setting->contents.used < values->used; ) {
+ f_array_length_t i = 0; // For Contents.
+ f_array_length_t j = 0; // For Objects.
+ f_array_length_t k = 0;
+ f_array_length_t total = 0;
+ f_array_length_t index = 0;
- index = values->array[setting->contents.used];
+ // Construct the array without allocating any more memory for the string data by setting this as a static string (used > 0, size = 0).
+ while (i < values_content->used) {
- setting->contents.array[setting->contents.used].string = main->parameters.arguments.array[index].string;
- setting->contents.array[setting->contents.used].used = main->parameters.arguments.array[index].used;
- setting->contents.array[setting->contents.used++].size = 0;
- } // for
+ // Determine the total Content associated with the given Object.
+ for (total = 0; i + total < values_content->used && (j + 1 >= values_object->used || values_content->array[i + total] < values_object->array[j + 1]); ++total) {
+ // Do nothing.
+ } // for
+
+
+ if (!total) {
+ ++setting->contentss.used;
+
+ if (++j < values_object->used) continue;
+
+ break;
+ }
+
+ setting->status = f_string_dynamics_increase_by(total, &setting->contentss.array[j]);
+
+ if (F_status_is_error(setting->status)) {
+ fss_write_print_error(setting, main->error, "f_string_dynamics_increase_by");
+
+ return;
+ }
+
+ for (k = 0; k < total; ++k) {
+
+ index = values_content->array[i++];
+
+ setting->contentss.array[j].array[setting->contentss.array[j].used].string = main->parameters.arguments.array[index].string;
+ setting->contentss.array[j].array[setting->contentss.array[j].used].used = main->parameters.arguments.array[index].used;
+ setting->contentss.array[j].array[setting->contentss.array[j].used++].size = 0;
+ } // for
+ } // while
+
+ if (total) {
+ ++setting->contentss.used;
+ }
setting->flag |= fss_write_flag_content_e;
}
}
if ((main->parameters.array[fss_write_parameter_ignore_e].result & f_console_result_value_e) && main->parameters.array[fss_write_parameter_ignore_e].values.used) {
-
if (main->parameters.array[fss_write_parameter_ignore_e].values.used % 2 != 0) {
setting->status = F_status_set_error(F_parameter);
return;
}
- setting->ignores.used = 0;
+ // Only process if the standard designates that the ingore is supported.
+ if (setting->flag & fss_write_flag_ignore_e) {
+ f_array_length_t stub_data_array[1] = { 0 };
+ f_array_lengths_t stub_data = macro_f_array_lengths_t_initialize(stub_data_array, 0, 1);
- setting->status = f_string_ranges_increase_by(main->parameters.array[fss_write_parameter_ignore_e].values.used / 2, &setting->ignores);
+ f_array_lengths_t * const values_ignore = &main->parameters.array[fss_write_parameter_ignore_e].values;
+ f_array_lengths_t * const values_data = main->parameters.array[fss_write_parameter_object_e].values.used
+ ? &main->parameters.array[fss_write_parameter_object_e].values
+ : main->parameters.array[fss_write_parameter_content_e].values.used
+ ? &main->parameters.array[fss_write_parameter_content_e].values
+ : &stub_data;
- if (F_status_is_error(setting->status)) {
- fss_write_print_error(setting, main->error, "f_string_ranges_increase_by");
+ setting->ignoress.used = 0;
- return;
- }
+ setting->status = f_string_rangess_increase_by(values_data->used, &setting->ignoress);
- f_array_length_t index = 0;
+ if (F_status_is_error(setting->status)) {
+ fss_write_print_error(setting, main->error, "f_string_rangess_increase_by");
- for (f_array_length_t i = 0; i < main->parameters.array[fss_write_parameter_ignore_e].values.used; i += 2) {
+ return;
+ }
- index = main->parameters.array[fss_write_parameter_ignore_e].values.array[i];
+ f_array_length_t i = 0; // For Ignores.
+ f_array_length_t j = 0; // For Objects/Contents.
+ f_array_length_t k = 0;
+ f_array_length_t total = 0;
+ f_array_length_t index = 0;
+ f_number_unsigned_t number_start = 0;
+ f_number_unsigned_t number_stop = 0;
- setting->status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, main->parameters.arguments.array[index], &setting->ignores.array[setting->ignores.used].start);
+ // Construct the array without allocating any more memory for the string data by setting this as a static string (used > 0, size = 0).
+ while (i < values_ignore->used) {
- if (F_status_is_error(setting->status)) {
- fss_write_print_line_first_locked(setting, main->error);
- fll_program_print_error_parameter_integer_not(main->error, f_console_symbol_long_normal_s, fss_write_long_ignore_s, main->parameters.arguments.array[index]);
- fss_write_print_line_last_locked(setting, main->error);
+ // Determine the total Ignore associated with the given Object/Content.
+ for (total = 0; i + total < values_ignore->used && (j + 1 >= values_data->used || values_ignore->array[i + total] < values_data->array[j + 1]); ++total) {
+ // Do nothing.
+ } // for
- return;
- }
+ if (!total) {
+ ++setting->ignoress.used;
- index = main->parameters.array[fss_write_parameter_ignore_e].values.array[i + 1];
+ if (++j < values_data->used) continue;
- setting->status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, main->parameters.arguments.array[index], &setting->ignores.array[setting->ignores.used].stop);
+ break;
+ }
- if (F_status_is_error(setting->status)) {
- fss_write_print_line_first_locked(setting, main->error);
- fll_program_print_error_parameter_integer_not(main->error, f_console_symbol_long_normal_s, fss_write_long_ignore_s, main->parameters.arguments.array[index]);
- fss_write_print_line_last_locked(setting, main->error);
+ setting->status = f_string_ranges_increase_by(total, &setting->ignoress.array[j]);
- return;
- }
+ if (F_status_is_error(setting->status)) {
+ fss_write_print_error(setting, main->error, "f_string_ranges_increase_by");
- if (setting->ignores.array[setting->ignores.used].stop > setting->ignores.array[setting->ignores.used].start) {
- setting->status = F_status_set_error(F_parameter);
+ return;
+ }
- fss_write_print_line_first_locked(setting, main->error);
- fll_program_print_error_parameter_range_start_before_stop(main->error, f_console_symbol_long_normal_s, fss_write_long_ignore_s, main->parameters.arguments.array[main->parameters.array[fss_write_parameter_ignore_e].values.array[i]], main->parameters.arguments.array[index]);
- fss_write_print_line_last_locked(setting, main->error);
+ for (k = 0; k < total; ++k) {
- return;
+ index = values_ignore->array[i++];
+
+ setting->status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, main->parameters.arguments.array[index], &setting->ignoress.array[j].array[setting->ignoress.array[j].used].start);
+
+ if (F_status_is_error(setting->status)) {
+ fss_write_print_line_first_locked(setting, main->error);
+ fll_program_print_error_parameter_integer_not(main->error, f_console_symbol_long_normal_s, fss_write_long_ignore_s, main->parameters.arguments.array[index]);
+ fss_write_print_line_last_locked(setting, main->error);
+
+ return;
+ }
+
+ index = values_ignore->array[i++];
+
+ setting->status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, main->parameters.arguments.array[index], &setting->ignoress.array[j].array[setting->ignoress.array[j].used].stop);
+
+ if (F_status_is_error(setting->status)) {
+ fss_write_print_line_first_locked(setting, main->error);
+ fll_program_print_error_parameter_integer_not(main->error, f_console_symbol_long_normal_s, fss_write_long_ignore_s, main->parameters.arguments.array[index]);
+ fss_write_print_line_last_locked(setting, main->error);
+
+ return;
+ }
+
+ if (setting->ignoress.array[j].array[setting->ignoress.array[j].used].stop > setting->ignoress.array[j].array[setting->ignoress.array[j].used].start) {
+ setting->status = F_status_set_error(F_parameter);
+
+ fss_write_print_line_first_locked(setting, main->error);
+ fll_program_print_error_parameter_range_start_before_stop(
+ main->error,
+ f_console_symbol_long_normal_s,
+ fss_write_long_ignore_s,
+ main->parameters.arguments.array[values_ignore->array[i - 1]],
+ main->parameters.arguments.array[index]
+ );
+ fss_write_print_line_last_locked(setting, main->error);
+
+ return;
+ }
+
+ ++setting->ignoress.array[j].used;
+ } // for
+ } // while
+
+ if (total) {
+ ++setting->ignoress.used;
}
+ }
+ else {
- ++setting->ignores.used;
- } // for
+ // Still validate the parameters, even if not being used.
+ f_array_length_t i = 0;
+ f_array_length_t index = 0;
+ f_string_range_t number = f_string_range_t_initialize;
+
+ while (i < main->parameters.array[fss_write_parameter_ignore_e].values.used) {
+
+ index = main->parameters.array[fss_write_parameter_ignore_e].values.array[i++];
+
+ setting->status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, main->parameters.arguments.array[index], &number.start);
+
+ if (F_status_is_error(setting->status)) {
+ fss_write_print_line_first_locked(setting, main->error);
+ fll_program_print_error_parameter_integer_not(main->error, f_console_symbol_long_normal_s, fss_write_long_ignore_s, main->parameters.arguments.array[index]);
+ fss_write_print_line_last_locked(setting, main->error);
- setting->flag |= fss_write_flag_ignore_e;
+ return;
+ }
+
+ index = main->parameters.array[fss_write_parameter_ignore_e].values.array[i++];
+
+ setting->status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, main->parameters.arguments.array[index], &number.stop);
+
+ if (F_status_is_error(setting->status)) {
+ fss_write_print_line_first_locked(setting, main->error);
+ fll_program_print_error_parameter_integer_not(main->error, f_console_symbol_long_normal_s, fss_write_long_ignore_s, main->parameters.arguments.array[index]);
+ fss_write_print_line_last_locked(setting, main->error);
+
+ return;
+ }
+
+ if (number.start > number.stop) {
+ setting->status = F_status_set_error(F_parameter);
+
+ fss_write_print_line_first_locked(setting, main->error);
+ fll_program_print_error_parameter_range_start_before_stop(
+ main->error,
+ f_console_symbol_long_normal_s,
+ fss_write_long_ignore_s,
+ main->parameters.arguments.array[main->parameters.array[fss_write_parameter_ignore_e].values.array[i - 1]],
+ main->parameters.arguments.array[index]
+ );
+ fss_write_print_line_last_locked(setting, main->error);
+
+ return;
+ }
+ } // while
+ }
}
else if (main->parameters.array[fss_write_parameter_ignore_e].result & f_console_result_found_e) {
setting->status = F_status_set_error(F_parameter);
return;
}
+ else {
+
+ // There is no Object or Content, so remove ignores if set.
+ if (setting->flag & fss_write_flag_ignore_e) {
+ setting->flag -= fss_write_flag_ignore_e;
+ }
+ }
if (main->parameters.array[fss_write_parameter_partial_e].result & f_console_result_found_e) {
setting->flag |= fss_write_flag_partial_e;
return;
}
- if (main->parameters.array[fss_write_parameter_object_e].locations.used != main->parameters.array[fss_write_parameter_content_e].locations.used && !(setting->flag & fss_write_flag_partial_e)) {
+ if (main->parameters.array[fss_write_parameter_object_e].locations.used > main->parameters.array[fss_write_parameter_content_e].locations.used && !(setting->flag & fss_write_flag_partial_e)) {
setting->status = F_status_set_error(F_parameter);
- fss_write_print_line_first_locked(setting, main->error);
- fll_program_print_error_parameter_both_specified_same_amount_without(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, fss_write_long_object_s, fss_write_long_content_s, fss_write_long_partial_s);
- fss_write_print_line_last_locked(setting, main->error);
+ fss_write_print_error_parameter_same_times_at_least(setting, main->error);
return;
}
* Flags used to represent flags passed to the main function.
*
* fss_write_flag_*_e:
- * - none: No modes in use.
- * - content: The Content being written is specified.
- * - double: Operate using double quotes.
- * - file_to: Using a specified destination file.
- * - help: Print help.
- * - ignore: Ignore a given range within a Content.
- * - object: The Object being written is specified.
- * - partial: Do not write end of Object/Content character.
- * - prepend: Prepend the given white space characters to the start of each multi-line Content.
- * - printed: Designate that the first line has been print for the main output.
- * - single: Operate using single quotes.
- * - trim: Trim Object names.
- * - version: Print version.
+ * - none: No modes in use.
+ * - content: The Content being written is specified.
+ * - content_multiple: Designate that multiple Content is allowed for an Object for this standard rather than a single Content per Object.
+ * - double: Operate using double quotes.
+ * - file_to: Using a specified destination file.
+ * - help: Print help.
+ * - ignore: Ignore a given range within a Content (specify flag before setting loading to designate ignores is supported by standard).
+ * - object: The Object being written is specified.
+ * - partial: Do not write end of Object/Content character.
+ * - prepend: Prepend the given white space characters to the start of each multi-line Content.
+ * - single: Operate using single quotes.
+ * - trim: Trim Object names.
+ * - version: Print version.
*/
#ifndef _di_fss_write_flag_e_
enum {
- fss_write_flag_none_e = 0x0,
- fss_write_flag_content_e = 0x1,
- fss_write_flag_double_e = 0x2,
- fss_write_flag_file_to_e = 0x4,
- fss_write_flag_help_e = 0x8,
- fss_write_flag_ignore_e = 0x10,
- fss_write_flag_object_e = 0x20,
- fss_write_flag_partial_e = 0x40,
- fss_write_flag_prepend_e = 0x80,
- fss_write_flag_printed_e = 0x100,
- fss_write_flag_single_e = 0x200,
- fss_write_flag_trim_e = 0x400,
- fss_write_flag_version_e = 0x800,
+ fss_write_flag_none_e = 0x0,
+ fss_write_flag_content_e = 0x1,
+ fss_write_flag_content_multiple_e = 0x2,
+ fss_write_flag_double_e = 0x4,
+ fss_write_flag_file_to_e = 0x8,
+ fss_write_flag_help_e = 0x10,
+ fss_write_flag_ignore_e = 0x20,
+ fss_write_flag_object_e = 0x40,
+ fss_write_flag_partial_e = 0x80,
+ fss_write_flag_prepend_e = 0x100,
+ fss_write_flag_single_e = 0x200,
+ fss_write_flag_trim_e = 0x400,
+ fss_write_flag_version_e = 0x800,
};
#endif // _di_fss_write_flag_e_
* 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.
*
- * quote: This holds the quote used during processing.
+ * quote: This holds the quote used during processing.
+ * standard: A human-friendly string describing the standard in use, such as "FSS-0000 (Basic)".
*
* escaped: A buffer used for escaping strings during processing.
* block: A buffer used to storing one or more blocks while processing a file line by line.
* buffer: A buffer used during processing the file.
- * object: A buffer used to hold an Object during processing.
- * content: A buffer used to hold a Content during processing.
* prepend: A string to prepend to each multi-line Content.
*
- * ignores: An array of ranges passed as values to the "--ignore" parameter.
- * objects: An array of objects passed as values to the "--object" parameter.
- * contents: An array of objects passed as values to the "--content" parameter and must match the length of objects.
+ * ignoress: An array of range sets passed as values to the "--ignore" parameter or via the input pipe.
+ * objects: An array of objects passed as values to the "--object" parameter or via the input pipe.
+ * contentss: An array of content sets passed as values to the "--content" parameter or via the input pipe.
*
- * process_help: Process help (generally printing help).
- * process_normal: Process normally (data from parameters and files).
- * process_pipe: Process using the data from input pipe.
+ * object: A pointer to a specific Object used during processing.
+ * content: A pointer to a specific Content used during processing.
+ * contents: A pointer to a specific set of Content used during processing.
+ *
+ * content_separator: A standard format specific string used to separate Content.
+ * program_name: The short name of the program.
+ * program_name_long: The human friendly name of the program.
+ *
+ * process_content: Process a single Content.
+ * process_help: Process help (generally printing help).
+ * process_normal: Process normally (data from parameters and files).
+ * process_object: Process a single Object.
+ * process_pipe: Process using the data from input pipe.
+ * process_set: Process a set of Object and one or more Content.
*/
#ifndef _di_fss_write_setting_t_
typedef struct {
f_string_static_t line_last;
f_string_static_t quote;
+ f_string_static_t standard;
f_string_dynamic_t escaped;
f_string_dynamic_t block;
f_string_dynamic_t buffer;
- f_string_dynamic_t object;
- f_string_dynamic_t content;
f_string_dynamic_t prepend;
- f_string_ranges_t ignores;
+ f_string_rangess_t ignoress;
f_string_dynamics_t objects;
- f_string_dynamics_t contents;
+ f_string_dynamicss_t contentss;
+ f_string_ranges_t *ignores;
+ f_string_static_t *object;
+ f_string_static_t *content;
+ f_string_statics_t *contents;
+
+ const f_string_static_t *content_separator;
const f_string_static_t *program_name;
const f_string_static_t *program_name_long;
+ void (*process_content)(fll_program_data_t * const main, void * const setting, const bool last);
void (*process_help)(fll_program_data_t * const main, void * const setting);
void (*process_normal)(fll_program_data_t * const main, void * const setting);
+ void (*process_object)(fll_program_data_t * const main, void * const setting);
void (*process_pipe)(fll_program_data_t * const main, void * const setting);
- void (*process_object)(fll_program_data_t * const main, void * const setting, const f_string_static_t * const object);
- void (*process_content)(fll_program_data_t * const main, void * const setting, const f_string_static_t * const content);
+ void (*process_set)(fll_program_data_t * const main, void * const setting);
} fss_write_setting_t;
#define fss_write_setting_t_initialize \
f_string_range_t_initialize, \
f_string_static_t_initialize, \
f_string_static_t_initialize, \
+ f_string_static_t_initialize, \
f_string_dynamic_t_initialize, \
f_string_dynamic_t_initialize, \
f_string_dynamic_t_initialize, \
f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_ranges_t_initialize, \
- f_string_dynamics_t_initialize, \
+ f_string_rangess_t_initialize, \
f_string_dynamics_t_initialize, \
+ f_string_dynamicss_t_initialize, \
+ 0, \
+ 0, \
+ 0, \
+ 0, \
+ 0, \
+ 0, \
0, \
0, \
0, \
}
#endif // _di_fss_write_main_
-#ifndef _di_fss_write_process_set_
- void fss_write_process_set(fll_program_data_t * const main, fss_write_setting_t * const setting, const f_string_static_t * const object, const f_string_static_t * const content) {
+#ifndef _di_fss_write_process_normal_
+ void fss_write_process_normal(fll_program_data_t * const main, void * const setting) {
- setting->buffer.used = 0;
+ fss_write_process_normal_data(
+ main,
+ macro_fss_write_setting(setting),
+ (macro_fss_write_setting(setting)->flag & fss_write_flag_object_e)
+ ? macro_fss_write_setting(setting)->objects.used
+ : macro_fss_write_setting(setting)->contentss.used
+ );
+ }
+#endif // _di_fss_write_process_normal_
- if (object) {
- if (object->used) {
- setting->range.start = 0;
- setting->range.stop = object->used - 1;
+#ifndef _di_fss_write_process_normal_data_
+ void fss_write_process_normal_data(fll_program_data_t * const main, fss_write_setting_t * const setting, const f_array_length_t length) {
+
+ setting->ignores = 0;
+ setting->object = 0;
+ setting->content = 0;
+ setting->contents = 0;
+
+ for (f_array_length_t i = 0; i < length; ++i) {
+
+ // @todo replace all signal checks with forked main process that independently checks and assigns main->signal_received.
+ if (!((++main->signal_check) % fss_write_signal_check_d)) {
+ if (fll_program_standard_signal_received(main)) {
+ setting->status = F_status_set_error(F_interrupt);
+
+ return;
+ }
+
+ main->signal_check = 0;
+ }
+
+ if (setting->objects.used) {
+ setting->object = &setting->objects.array[i];
+ }
+
+ if (setting->contentss.used) {
+ setting->contents = &setting->contentss.array[i];
+ }
+
+ if (setting->ignoress.used) {
+ setting->ignores = &setting->ignoress.array[i];
+ }
+
+ setting->process_set(main, setting);
+ if (F_status_is_error(setting->status)) break;
+ } // for
+ }
+#endif // _di_fss_write_process_normal_data_
+
+#ifndef _di_fss_write_process_pipe_
+ void fss_write_process_pipe(fll_program_data_t * const main, void * const void_setting) {
+
+ fss_write_setting_t * const setting = macro_fss_write_setting(void_setting);
+
+ f_status_t status_pipe = F_none;
+ f_file_t input = f_file_t_initialize;
+ input.id = F_type_descriptor_input_d;
+ input.size_read = setting->state.step_large;
+
+ f_array_length_t total = 0;
+ f_array_length_t length = 0;
+ f_array_length_t ignore_start = 0;
+ f_string_range_t range = f_string_range_t_initialize;
+
+ const f_array_length_t used_objects = setting->objects.used;
+ const f_array_length_t used_contentss = setting->contentss.used;
+ const f_array_length_t used_ignoress = setting->ignoress.used;
+
+ // 0x0 = nothing printed, 0x1 = something printed, 0x2 = ignore enabled, 0x4 = added Content for Object.
+ uint8_t flag = 0;
+
+ // 0x0 = start new object/content set, 0x1 = processing object, 0x2 = processing content, 0x3 = end object/content set.
+ uint8_t state = 0;
+
+ // This is processed in a single set, so there is only ever one Object added.
+ setting->status = f_string_dynamics_increase(setting->state.step_small, &setting->objects);
+
+ if (F_status_is_error(setting->status)) {
+ fss_write_print_error(setting, main->error, "f_string_dynamics_increase");
+
+ return;
+ }
+
+ // This is processed in a single set, so there is only ever one Content added.
+ setting->status = f_string_dynamicss_increase(setting->state.step_small, &setting->contentss);
+
+ if (F_status_is_error(setting->status)) {
+ fss_write_print_error(setting, main->error, "f_string_dynamicss_increase");
+
+ return;
+ }
+
+ // This is processed in a single set, so there is only ever one Ignores added.
+ setting->status = f_string_rangess_increase(setting->state.step_small, &setting->ignoress);
+
+ if (F_status_is_error(setting->status)) {
+ fss_write_print_error(setting, main->error, "f_string_rangess_increase");
+
+ return;
+ }
+
+ setting->status = f_string_dynamics_increase(setting->state.step_small, &setting->contentss.array[used_contentss]);
+
+ if (F_status_is_error(setting->status)) {
+ fss_write_print_error(setting, main->error, "f_string_dynamics_increase");
+
+ return;
+ }
+
+ for (;;) {
+
+ if (!((++main->signal_check) % fss_write_signal_check_d)) {
+ if (fll_program_standard_signal_received(main)) {
+ fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received);
+
+ setting->status = F_status_set_error(F_interrupt);
+
+ break;
+ }
+
+ main->signal_check = 0;
+ }
+
+ if (range.start > range.stop) {
+ if (status_pipe == F_none_eof) break;
+
+ setting->block.used = 0;
+
+ status_pipe = f_file_read_block(input, &setting->block);
+
+ if (F_status_is_error(status_pipe)) {
+ fss_write_print_error(setting, main->error, "f_file_read_block");
+
+ status_pipe = F_status_set_error(F_pipe);
+
+ break;
+ }
+
+ if (!setting->block.used) break;
+
+ range.start = 0;
+ range.stop = setting->block.used - 1;
+ }
+
+ // Start Object.
+ if (!state || state == 0x1) {
+ if (!state) {
+ setting->objects.array[used_objects].used = 0;
+
+ state = 0x1;
+ }
+
+ // Reset the "has Content for Object" flag and associated contents array used length.
+ flag -= flag | 0x4;
+ setting->contentss.array[used_contentss].used = 0;
+
+ if (setting->objects.array[used_objects].used + setting->block.used > setting->objects.array[used_objects].size) {
+ setting->status = f_string_dynamic_increase_by(setting->block.used, &setting->objects.array[used_objects]);
+
+ if (F_status_is_error(setting->status)) {
+ fss_write_print_error(setting, main->error, "f_string_dynamic_increase_by");
+
+ break;
+ }
+ }
+
+ for (; range.start <= range.stop; ++range.start) {
+
+ if (setting->block.string[range.start] == fss_write_pipe_content_start_s.string[0]) {
+ state = 0x2;
+ ++range.start;
+
+ break;
+ }
+
+ if (setting->block.string[range.start] == fss_write_pipe_content_end_s.string[0]) {
+ state = 0x3;
+ ++range.start;
+
+ break;
+ }
+
+ if (setting->block.string[range.start] == fss_write_pipe_content_ignore_s.string[0]) {
+
+ // @todo implement this, populating the ignores array, continue until no ignores is found, so set a new state to represent this.
+ continue;
+ }
+
+ setting->objects.array[used_objects].string[setting->objects.array[used_objects].used++] = setting->block.string[range.start];
+ } // for
+
+ if (F_status_is_error(setting->status)) break;
+
+ // If the start of Content is not found, then fetch the next block.
+ if (state == 0x1) continue;
+
+ // If the end of the current block is reached, fetch the next block.
+ if (range.start > range.stop) continue;
+ }
+
+ // Start Content.
+ if (state == 0x2) {
+
+ // Check to see if the Content supports multiple Content per Object.
+ if (flag & 0x4) {
+ if (!(setting->flag & fss_write_flag_content_multiple_e)) {
+ setting->status = F_status_set_error(F_support_not);
+
+ fss_write_print_error_one_content_only(setting, main->error);
+
+ break;
+ }
+
+ setting->status = f_string_dynamics_increase(setting->state.step_small, &setting->contentss.array[used_contentss]);
+
+ if (F_status_is_error(setting->status)) {
+ fss_write_print_error(setting, main->error, "f_string_dynamics_increase");
+
+ break;
+ }
+ }
+
+ if (range.start <= range.stop) {
+ total = (range.stop - range.start) + 1;
+ }
+ else {
+ total = 0;
+ }
+
+ if (total) {
+ setting->status = f_string_dynamic_increase_by(total, &setting->contentss.array[used_contentss].array[setting->contentss.array[used_contentss].used]);
+
+ if (F_status_is_error(setting->status)) {
+ fss_write_print_error(setting, main->error, "f_string_dynamic_increase_by");
+
+ break;
+ }
+
+ for (; range.start <= range.stop; ++range.start) {
+
+ if (setting->block.string[range.start] == fss_write_pipe_content_start_s.string[0]) {
+ setting->status = F_status_set_error(F_support_not);
+
+ fss_write_print_error_one_content_only(setting, main->error);
+
+ break;
+ }
+
+ if (setting->block.string[range.start] == fss_write_pipe_content_end_s.string[0]) {
+ state = 0x3;
+ ++range.start;
+
+ break;
+ }
+
+ if (setting->block.string[range.start] == fss_write_pipe_content_ignore_s.string[0]) {
+
+ // @todo implement this (a single fss_write_pipe_content_ignore_s followed by another fss_write_pipe_content_ignore_s should act as a delimit). (also consider delimits for other special escapes as well.)
+ continue;
+ }
+
+ setting->contentss.array[used_contentss].array[setting->contentss.array[used_contentss].used].string[setting->contentss.array[used_contentss].array[setting->contentss.array[used_contentss].used].used++] = setting->block.string[range.start];
+ } // for
+
+ if (F_status_is_error(setting->status)) break;
+
+ ++setting->contentss.array[used_contentss].used;
+ flag |= 0x4;
+ }
+ else {
+ state = 0x3;
+ }
+ }
+
+ // End Object or Content set.
+ if (state == 0x3) {
+ if (setting->flag & fss_write_flag_partial_e) {
+ if (setting->flag & fss_write_flag_content_e) {
+ setting->object = 0;
+ setting->contents = &setting->contentss.array[used_contentss];
+ }
+ else {
+ setting->object = &setting->objects.array[used_objects];
+ setting->contents = 0;
+ }
+ }
+ else {
+ setting->object = &setting->objects.array[used_objects];
+ setting->contents = &setting->contentss.array[used_contentss];
+ }
+
+ setting->ignores = &setting->ignoress.array[used_contentss];
+
+ setting->process_set(main, void_setting);
+ if (F_status_is_error(setting->status)) break;
+
+ state = 0;
+ flag |= 0x1;
+
+ continue;
+ }
+ } // for
+
+ // If the pipe ended before finishing, then attempt to wrap up.
+ if (F_status_is_error_not(setting->status) && status_pipe == F_none_eof && state) {
+ if (setting->flag & fss_write_flag_partial_e) {
+ if (setting->flag & fss_write_flag_content_e) {
+ setting->object = 0;
+ setting->contents = &setting->contentss.array[used_contentss];
+ }
+ else {
+ setting->object = &setting->objects.array[used_objects];
+ setting->contents = 0;
+ }
}
else {
- setting->range.start = 1;
- setting->range.stop = 0;
+ setting->object = &setting->objects.array[used_objects];
+ setting->contents = &setting->contentss.array[used_contentss];
}
- setting->process_object(main, (void *) setting, object);
- if (F_status_is_error(setting->status)) return;
+ setting->ignores = &setting->ignoress.array[used_contentss];
+
+ setting->process_set(main, void_setting);
+
+ flag |= 0x1;
}
- if (content) {
- if (content->used) {
+ setting->block.used = 0;
+ setting->buffer.used = 0;
+ setting->ignoress.used = used_ignoress;
+ setting->objects.used = used_objects;
+ setting->contentss.used = used_contentss;
+
+ if (F_status_is_error_not(setting->status)) {
+ setting->status = (flag & 0x1) ? F_none : F_data_not;
+
+ // Print newline character to separate data printed from pipe.
+ if ((setting->flag & fss_write_flag_partial_e) && setting->objects.used) {
+ fll_print_dynamic(f_string_eol_s, main->output.to); // @fixme review this, should this be sending to message or not at all?
+ }
+ }
+ }
+#endif // _di_fss_write_process_pipe_
+
+#ifndef _di_fss_write_process_set_
+ void fss_write_process_set(fll_program_data_t * const main, void * const void_setting) {
+
+ fss_write_setting_t * const setting = macro_fss_write_setting(void_setting);
+
+ setting->buffer.used = 0;
+
+ if (setting->object) {
+ if (setting->object->used) {
setting->range.start = 0;
- setting->range.stop = content->used - 1;
+ setting->range.stop = setting->object->used - 1;
}
else {
setting->range.start = 1;
setting->range.stop = 0;
}
- setting->process_content(main, (void *) setting, content);
+ setting->process_object(main, void_setting);
if (F_status_is_error(setting->status)) return;
}
- if (setting->buffer.used) {
- fss_write_print_line_first_locked(setting, main->message);
+ if (setting->contents) {
+ for (f_array_length_t i = 0; i < setting->contents->used; ++i) {
+
+ if (setting->contents->array[i].used) {
+ setting->range.start = 0;
+ setting->range.stop = setting->contents->array[i].used - 1;
+ }
+ else {
+ setting->range.start = 1;
+ setting->range.stop = 0;
+ }
- f_file_stream_lock(main->output.to);
+ setting->content = &setting->contents->array[i];
- f_print_dynamic(setting->buffer, main->output.to);
- f_print_dynamic_raw(f_string_eol_s, main->output.to);
+ setting->process_content(main, void_setting, i + 1 == setting->contents->used);
+ if (F_status_is_error(setting->status)) return;
+ } // for
+ }
- f_file_stream_unlock(main->output.to);
+ if (setting->buffer.used) {
+ fll_print_dynamic(setting->buffer, main->output.to);
}
}
#endif // _di_fss_write_process_set_
#endif // _di_fss_write_main_
/**
+ * Process normally, writing to the output for the assigned FSS format.
+ *
+ * @param main
+ * The main program data.
+ * @param setting
+ * The main program settings.
+ * Must be of type (fss_write_setting_t *).
+ *
+ * This alters setting.status:
+ * status from fss_write_process_normal_data().
+ *
+ * Errors (with error bit) from fss_write_process_normal_data().
+ *
+ * @see fss_write_process_normal_data()
+ */
+#ifndef _di_fss_write_process_normal_
+ extern void fss_write_process_normal(fll_program_data_t * const main, void * const setting);
+#endif // _di_fss_write_process_normal_
+
+/**
+ * Process the data normally, writing to the output for the assigned FSS format.
+ *
+ * @param main
+ * The main program data.
+ * @param setting
+ * The main program settings.
+ * Must be of type (fss_write_setting_t *).
+ *
+ * This alters setting.status:
+ * F_none on success.
+ * F_interrupt on (exit) signal received.
+ *
+ * F_parameter (with error bit) if main is NULL or setting is NULL.
+ */
+#ifndef _di_fss_write_process_normal_data_
+ void fss_write_process_normal_data(fll_program_data_t * const main, fss_write_setting_t * const setting, const f_array_length_t length);
+#endif // _di_fss_write_process_normal_data_
+
+/**
+ * Process the pipe, reading from the pipe and writing to the output for the assigned FSS format.
+ *
+ * @param main
+ * The main program data.
+ * @param setting
+ * The main program settings.
+ * Must be of type (fss_write_setting_t *).
+ *
+ * This alters setting.status:
+ * F_none on success.
+ * F_data_not on success but pipe contained no relevant data.
+ * F_basic on success and the basic has been printed.
+ * F_interrupt on (exit) signal received.
+ *
+ * F_parameter (with error bit) if main is NULL or setting is NULL.
+ */
+#ifndef _di_fss_write_process_pipe_
+ extern void fss_write_process_pipe(fll_program_data_t * const main, void * const setting);
+#endif // _di_fss_write_process_pipe_
+
+/**
* Process a given Object and Content, printing the assigned FSS format if valid or an error if invalid.
*
* @param main
* The main program data.
* @param setting
* The main program settings.
+ * Must be of type (fss_write_setting_t *).
+ *
+ * Set setting.object to 0 to not use an Object.
+ * Set setting.contents to 0 to not use an Content set.
*
* This alters setting.status:
* F_none on success.
* F_parameter (with error bit) if main is NULL or setting is NULL.
* @param object
* The object to validate and print.
- * Set pointer address to 0 to not use.
+ * Set to setting.objects.used to not use.
* @param content
* The content to escape and print.
- * Set pointer address to 0 to not use.
+ * Set start to 1 and stop to 0 to not use.
*/
#ifndef _di_fss_write_process_set_
- extern void fss_write_process_set(fll_program_data_t * const main, fss_write_setting_t * const setting, const f_string_static_t * const object, const f_string_static_t * const content);
+ extern void fss_write_process_set(fll_program_data_t * const main, void * const setting);
#endif // _di_fss_write_process_set_
#ifdef __cplusplus
if (!main || !setting || F_status_is_error(setting->status) || (setting->flag & fss_write_flag_version_e)) return;
+ setting->standard = fss_write_basic_standard_s;
setting->program_name = &fss_write_program_name_s;
setting->program_name_long = &fss_write_program_name_long_s;
+ setting->process_content = &fss_write_basic_process_content;
setting->process_help = &fss_write_main_process_help;
- setting->process_pipe = &fss_write_basic_process_pipe;
- setting->process_normal = &fss_write_basic_process_normal;
setting->process_object = &fss_write_basic_process_object;
- setting->process_content = &fss_write_basic_process_content;
+ setting->process_pipe = &fss_write_process_pipe;
+ setting->process_normal = &fss_write_process_normal;
+ setting->process_set = &fss_write_process_set;
if (main->parameters.array[fss_write_parameter_as_e].result & f_console_result_value_e && main->parameters.array[fss_write_parameter_as_e].values.used) {
fl_string_dynamic_compare(argv[index], fss_write_format_code_long_0000_s) == F_equal_to ||
fl_string_dynamic_compare(argv[index], fss_write_format_code_human_0000_s) == F_equal_to) {
+ setting->standard = fss_write_basic_standard_s;
setting->program_name = &fss_write_basic_program_name_s;
setting->program_name_long = &fss_write_basic_program_name_long_s;
+ setting->process_content = &fss_write_basic_process_content;
setting->process_help = &fss_write_basic_process_help;
- setting->process_pipe = &fss_write_basic_process_pipe;
- setting->process_normal = &fss_write_basic_process_normal;
setting->process_object = &fss_write_basic_process_object;
- setting->process_content = &fss_write_basic_process_content;
+ setting->process_pipe = &fss_write_process_pipe;
+ setting->process_normal = &fss_write_process_normal;
+ setting->process_set = &fss_write_process_set;
+ setting->flag -= setting->flag & fss_write_flag_ignore_e; // Not supported by basic.
+ setting->flag -= setting->flag & fss_write_flag_content_multiple_e; // Not supported by payload.
}
else if (fl_string_dynamic_compare(argv[index], fss_write_format_code_short_0001_s) == F_equal_to ||
fl_string_dynamic_compare(argv[index], fss_write_format_code_long_0001_s) == F_equal_to ||
fl_string_dynamic_compare(argv[index], fss_write_format_code_human_0001_s) == F_equal_to) {
+ setting->standard = fss_write_extended_standard_s;
+ setting->content_separator = 0; // Not used by extended.
setting->program_name = &fss_write_extended_program_name_s;
setting->program_name_long = &fss_write_extended_program_name_long_s;
+ setting->process_content = &fss_write_extended_process_content;
setting->process_help = &fss_write_extended_process_help;
- setting->process_pipe = &fss_write_extended_process_pipe;
- setting->process_normal = &fss_write_extended_process_normal;
setting->process_object = &fss_write_extended_process_object;
- setting->process_content = &fss_write_extended_process_content;
+ setting->process_pipe = &fss_write_process_pipe;
+ setting->process_normal = &fss_write_process_normal;
+ setting->process_set = &fss_write_process_set;
+ setting->flag -= setting->flag & fss_write_flag_ignore_e; // Not supported by extended.
+ setting->flag |= fss_write_flag_content_multiple_e;
}
else if (fl_string_dynamic_compare(argv[index], fss_write_format_code_short_0002_s) == F_equal_to ||
fl_string_dynamic_compare(argv[index], fss_write_format_code_long_0002_s) == F_equal_to ||
fl_string_dynamic_compare(argv[index], fss_write_format_code_human_0002_s) == F_equal_to) {
+ setting->standard = fss_write_basic_list_standard_s;
setting->program_name = &fss_write_basic_list_program_name_s;
setting->program_name_long = &fss_write_basic_list_program_name_long_s;
+ setting->process_content = &fss_write_basic_list_process_content;
setting->process_help = &fss_write_basic_list_process_help;
- setting->process_pipe = &fss_write_basic_list_process_pipe;
- setting->process_normal = &fss_write_basic_list_process_normal;
setting->process_object = &fss_write_basic_list_process_object;
- setting->process_content = &fss_write_basic_list_process_content;
+ setting->process_pipe = &fss_write_process_pipe;
+ setting->process_normal = &fss_write_process_normal;
+ setting->process_set = &fss_write_process_set;
+ setting->flag -= setting->flag & fss_write_flag_ignore_e; // Not supported by basic list.
+ setting->flag -= setting->flag & fss_write_flag_content_multiple_e; // Not supported by basic list.
}
else if (fl_string_dynamic_compare(argv[index], fss_write_format_code_short_0003_s) == F_equal_to ||
fl_string_dynamic_compare(argv[index], fss_write_format_code_long_0003_s) == F_equal_to ||
fl_string_dynamic_compare(argv[index], fss_write_format_code_human_0003_s) == F_equal_to) {
+ setting->standard = fss_write_extended_list_standard_s;
setting->program_name = &fss_write_extended_list_program_name_s;
setting->program_name_long = &fss_write_extended_list_program_name_long_s;
+ setting->process_content = &fss_write_extended_list_process_content;
setting->process_help = &fss_write_extended_list_process_help;
- setting->process_pipe = &fss_write_extended_list_process_pipe;
- setting->process_normal = &fss_write_extended_list_process_normal;
setting->process_object = &fss_write_extended_list_process_object;
- setting->process_content = &fss_write_extended_list_process_content;
+ setting->process_pipe = &fss_write_process_pipe;
+ setting->process_normal = &fss_write_process_normal;
+ setting->process_set = &fss_write_process_set;
+ setting->flag |= fss_write_flag_ignore_e;
+ setting->flag -= setting->flag & fss_write_flag_content_multiple_e; // Not supported by extended list.
}
else if (fl_string_dynamic_compare(argv[index], fss_write_format_code_short_0008_s) == F_equal_to ||
fl_string_dynamic_compare(argv[index], fss_write_format_code_long_0008_s) == F_equal_to ||
fl_string_dynamic_compare(argv[index], fss_write_format_code_human_0008_s) == F_equal_to) {
+ setting->standard = fss_write_embedded_list_standard_s;
setting->program_name = &fss_write_embedded_list_program_name_s;
setting->program_name_long = &fss_write_embedded_list_program_name_long_s;
+ setting->process_content = &fss_write_embedded_list_process_content;
setting->process_help = &fss_write_embedded_list_process_help;
- setting->process_pipe = &fss_write_embedded_list_process_pipe;
- setting->process_normal = &fss_write_embedded_list_process_normal;
setting->process_object = &fss_write_embedded_list_process_object;
- setting->process_content = &fss_write_embedded_list_process_content;
+ setting->process_pipe = &fss_write_process_pipe;
+ setting->process_normal = &fss_write_process_normal;
+ setting->process_set = &fss_write_process_set;
+ setting->flag |= fss_write_flag_ignore_e;
+ setting->flag |= fss_write_flag_content_multiple_e;
}
else if (fl_string_dynamic_compare(argv[index], fss_write_format_code_short_000e_s) == F_equal_to ||
fl_string_dynamic_compare(argv[index], fss_write_format_code_long_000e_s) == F_equal_to ||
fl_string_dynamic_compare(argv[index], fss_write_format_code_human_000e_s) == F_equal_to) {
+ setting->standard = fss_write_payload_standard_s;
setting->program_name = &fss_write_payload_program_name_s;
setting->program_name_long = &fss_write_payload_program_name_long_s;
+ setting->process_content = 0; // Not used by payload.
setting->process_help = &fss_write_payload_process_help;
- setting->process_pipe = &fss_write_payload_process_pipe;
- setting->process_normal = &fss_write_payload_process_normal;
+ setting->process_normal = &fss_write_process_normal;
setting->process_object = 0; // Not used by payload.
- setting->process_content = 0; // Not used by payload.
+ setting->process_pipe = &fss_write_payload_process_pipe;
+ setting->process_set = &fss_write_payload_process_set;
+ setting->flag -= setting->flag & fss_write_flag_ignore_e; // Not supported by payload.
+ setting->flag -= setting->flag & fss_write_flag_content_multiple_e; // Not supported by payload.
}
else {
if (setting->flag & fss_write_flag_help_e) {
}
#endif // _di_fss_write_print_error_file_
-#ifndef _di_fss_write_print_error_parameter_same_times_
- f_status_t fss_write_print_error_parameter_same_times(fss_write_setting_t * const setting, const fl_print_t print) {
+#ifndef _di_fss_write_print_error_parameter_same_times_at_least_
+ f_status_t fss_write_print_error_parameter_same_times_at_least(fss_write_setting_t * const setting, const fl_print_t print) {
if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
fl_print_format("%[%r%r%]", print.to, print.notable, f_console_symbol_long_normal_s, fss_write_long_object_s, print.notable);
fl_print_format("%[' parameter and the '%]", print.to, print.context, print.context);
fl_print_format("%[%r%r%]", print.to, print.notable, f_console_symbol_long_normal_s, fss_write_long_content_s, print.notable);
- fl_print_format("%[' parameter the same number of times when not specifying the '%]", print.to, print.context, print.context);
+ fl_print_format("%[' parameter at least the same number of times when not specifying the '%]", print.to, print.context, print.context);
fl_print_format("%[%r%r%]", print.to, print.notable, f_console_symbol_long_normal_s, fss_write_long_partial_s, print.notable);
fl_print_format("%[' parameter.%]%r", print.to, print.context, print.context, f_string_eol_s);
fss_write_print_line_last_unlocked(setting, print);
return F_none;
}
-#endif // _di_fss_write_print_error_parameter_same_times_
+#endif // _di_fss_write_print_error_parameter_same_times_at_least_
-// @todo replace fss_basic_write_error_parameter_value_missing_print with fll_program_print_error_parameter_missing_value.
-
-#ifndef _di_fss_write_print_error_parameter_unsupported_eol_object_
- f_status_t fss_write_print_error_parameter_unsupported_eol_object(fss_write_setting_t * const setting, const fl_print_t print, const f_string_static_t standard) {
+#ifndef _di_fss_write_print_error_one_content_only_
+ f_status_t fss_write_print_error_one_content_only(fss_write_setting_t * const setting, const fl_print_t print) {
if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
f_file_stream_lock(print.to);
fss_write_print_line_first_unlocked(setting, print);
- fl_print_format("%[%QThe %r standard does not support end of line character '%]", print.to, print.context, print.prefix, standard, print.context);
- fl_print_format("%[\\n%]", print.to, print.notable, print.notable);
- fl_print_format("%[' (%]", print.to, print.context, print.context);
- fl_print_format("%[U+000A%]", print.to, print.notable, print.notable);
- fl_print_format("%[) in objects.%]%r", print.to, print.context, print.context, f_string_eol_s);
+ fl_print_format("%[%QThe%] ", print.to, print.context, print.prefix, print.context);
+ fl_print_format("%[%r%]", print.to, print.notable, setting->standard, print.notable);
+ fl_print_format(" %[standard only supports one Content per Object.%]%r", print.to, print.context, print.context, f_string_eol_s);
fss_write_print_line_last_unlocked(setting, print);
f_file_stream_unlock(print.to);
return F_none;
}
-#endif // _di_fss_write_print_error_parameter_unsupported_eol_object_
-
-#ifndef _di_fss_write_print_error_one_content_only_
- f_status_t fss_write_print_error_one_content_only(fss_write_setting_t * const setting, const fl_print_t print, const f_string_static_t standard) {
-
- if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
-
- fll_print_format("%r%[%QThe %Q standard only supports one content per object.%]%r", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error, standard, f_string_eol_s);
-
- return F_none;
- }
#endif // _di_fss_write_print_error_one_content_only_
#ifndef _fss_write_print_error_prepend_only_whitespace_
#endif // _fss_write_print_error_prepend_only_whitespace_
#ifndef _di_fss_write_print_error_unsupported_eol_
- f_status_t fss_write_print_error_unsupported_eol(fss_write_setting_t * const setting, const fl_print_t print, const f_string_static_t standard) {
+ f_status_t fss_write_print_error_unsupported_eol(fss_write_setting_t * const setting, const fl_print_t print) {
if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
f_file_stream_lock(print.to);
- fl_print_format("%r%[%QThe %Q standard does not support end of line character '%]", print.to, f_string_eol_s, print.set->error, print.prefix, standard, print.set->error);
+ fss_write_print_line_first_unlocked(setting, print);
+ fl_print_format("%[%QThe%] ", print.to, print.context, print.prefix, print.context);
+ fl_print_format("%[%r%]", print.to, print.notable, setting->standard, print.notable);
+ fl_print_format(" %[standard does not support end of line character '%]", print.to, print.context, print.context);
+ fss_write_print_line_last_unlocked(setting, print);
+
fl_print_format("%[\\n%]", print.to, print.set->notable, print.set->notable);
fl_print_format("%[' (%]", print.to, print.set->error, print.set->error);
fl_print_format("%[U+000A%]", print.to, print.set->notable, print.set->notable);
- fl_print_format("%[) in objects.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s);
+ fl_print_format("%[) in Objects.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s);
f_file_stream_unlock(print.to);
#ifndef _di_fss_write_print_line_first_locked_
f_status_t fss_write_print_line_first_locked(fss_write_setting_t * const setting, const fl_print_t print) {
- if (setting->flag & fss_write_flag_printed_e) return F_output_not;
-
- if (F_status_is_error(setting->status)) {
- if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
- }
- else {
-
- // Always set to true to regardless of whether printed actually happened for non-errors.
- setting->flag |= fss_write_flag_printed_e;
+ if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
- if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
+ if (!F_status_is_error(setting->status)) {
if (print.verbosity == f_console_verbosity_error_e) return F_output_not;
+ if (setting->flag & fss_write_flag_file_to_e) return F_output_not;
}
f_print_dynamic_raw(setting->line_first, print.to);
#ifndef _di_fss_write_print_line_first_unlocked_
f_status_t fss_write_print_line_first_unlocked(fss_write_setting_t * const setting, const fl_print_t print) {
- if (setting->flag & fss_write_flag_printed_e) return F_output_not;
-
- if (F_status_is_error(setting->status)) {
- if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
- }
- else {
-
- // Always set to true to regardless of whether printed actually happened for non-errors.
- setting->flag |= fss_write_flag_printed_e;
+ if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
- if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
+ if (!F_status_is_error(setting->status)) {
if (print.verbosity == f_console_verbosity_error_e) return F_output_not;
+ if (setting->flag & fss_write_flag_file_to_e) return F_output_not;
}
fll_print_dynamic_raw(setting->line_first, print.to);
#endif // _di_fss_write_print_error_file_
/**
- * Print an error message about the object and content parameters not being specified the same number of times.
+ * Print an error message about the object and content parameters not being specified at least the same number of times when partial is not requested.
*
* @param setting
* The main program settings.
*
* @see fll_error_print()
*/
-#ifndef _di_fss_write_print_error_parameter_same_times_
- extern f_status_t fss_write_print_error_parameter_same_times(fss_write_setting_t * const setting, const fl_print_t print);
-#endif // _di_fss_write_print_error_parameter_same_times_
+#ifndef _di_fss_write_print_error_parameter_same_times_at_least_
+ extern f_status_t fss_write_print_error_parameter_same_times_at_least(fss_write_setting_t * const setting, const fl_print_t print);
+#endif // _di_fss_write_print_error_parameter_same_times_at_least_
/**
- * Print an error message about a parameter a new line character '\n' (U+000A) being unsupported for an Object for the given standard.
+ * Print an message about a multiple Content being unsupported for a particular standard.
*
* @param setting
* The main program settings.
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
- * @param standard
- * The string used to communicate the standad that does not support the EOL character.
- *
- * @return
- * F_none on success.
- * F_output_not on success, but no printing is performed.
- *
- * @see fll_error_print()
- */
-#ifndef _di_fss_write_print_error_parameter_unsupported_eol_object_
- extern f_status_t fss_write_print_error_parameter_unsupported_eol_object(fss_write_setting_t * const setting, const fl_print_t print, const f_string_static_t standard);
-#endif // _di_fss_write_print_error_parameter_unsupported_eol_object_
-
-/**
- * Print an message about a multiple Content being unsupported.
- *
- * @param setting
- * The main program settings.
- *
- * This does not alter setting.status.
- * @param print
- * Designates the how and where to print.
- * @param standard
- * A string representing the standard name, such as "FSS-0000 (Basic)".
*
* @return
* F_none on success.
* F_output_not on success, but no printing is performed.
*/
#ifndef _di_fss_write_print_error_one_content_only_
- extern f_status_t fss_write_print_error_one_content_only(fss_write_setting_t * const setting, const fl_print_t print, const f_string_static_t standard);
+ extern f_status_t fss_write_print_error_one_content_only(fss_write_setting_t * const setting, const fl_print_t print);
#endif // _di_fss_write_print_error_one_content_only_
/**
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
- * @param standard
- * A string representing the standard name, such as "FSS-0000 (Basic)".
*
* @return
* F_none on success.
* F_output_not on success, but no printing is performed.
*/
#ifndef _di_fss_write_print_error_unsupported_eol_
- extern f_status_t fss_write_print_error_unsupported_eol(fss_write_setting_t * const setting, const fl_print_t print, const f_string_static_t standard);
+ extern f_status_t fss_write_print_error_unsupported_eol(fss_write_setting_t * const setting, const fl_print_t print);
#endif // _di_fss_write_print_error_unsupported_eol_
/**
}
#endif // _di_fss_write_payload_process_help_
-#ifndef _di_fss_write_payload_process_normal_
- void fss_write_payload_process_normal(fll_program_data_t * const main, void * const setting) {
-
- f_string_statics_t * const data = (macro_fss_write_setting(setting)->flag & fss_write_flag_object_e) ? ¯o_fss_write_setting(setting)->objects : ¯o_fss_write_setting(setting)->contents;
-
- for (f_array_length_t i = 0; i < data->used; ++i) {
-
- // @todo replace all signal checks with forked main process that independently checks and assigns main->signal_received.
- if (!((++main->signal_check) % fss_write_signal_check_d)) {
- if (fll_program_standard_signal_received(main)) {
- macro_fss_write_setting(setting)->status = F_status_set_error(F_interrupt);
-
- return;
- }
-
- main->signal_check = 0;
- }
-
- fss_write_payload_process_set(
- main,
- macro_fss_write_setting(setting),
- (macro_fss_write_setting(setting)->flag & fss_write_flag_object_e) ? ¯o_fss_write_setting(setting)->objects.array[i] : 0,
- (macro_fss_write_setting(setting)->flag & fss_write_flag_content_e) ? ¯o_fss_write_setting(setting)->contents.array[i] : 0
- );
-
- if (F_status_is_error(macro_fss_write_setting(setting)->status)) break;
- } // for
- }
-#endif // _di_fss_write_payload_process_normal_
-
#ifndef _di_fss_write_payload_process_pipe_
- void fss_write_payload_process_pipe(fll_program_data_t * const main, void * const setting) {
+ void fss_write_payload_process_pipe(fll_program_data_t * const main, void * const void_setting) {
f_status_t status_pipe = F_none;
f_file_t input = f_file_t_initialize;
input.id = F_type_descriptor_input_d;
input.size_read = fss_write_common_allocation_large_d;
+ fss_write_setting_t * const setting = macro_fss_write_setting(void_setting);
+
f_array_length_t total = 0;
f_array_length_t length = 0;
f_string_range_t range = f_string_range_t_initialize;
- // 0x0 = nothing printed, 0x1 = something printed, 0x2 = "payload" matched.
- uint8_t printed = 0;
+ const f_array_length_t used_objects = setting->objects.used;
+ const f_array_length_t used_contentss = setting->contentss.used;
+ const f_array_length_t used_ignoress = setting->ignoress.used;
+
+ // 0x0 = nothing printed, 0x1 = something printed, 0x2 = ignore enabled, 0x4 = added Content for Object, 0x8 = "payload" matched.
+ uint8_t flag = 0;
// 0x0 = start new object/content set, 0x1 = processing object, 0x2 = processing content, 0x3 = end object/content set, 0x4 = processing payload content.
uint8_t state = 0;
+ setting->objects.used = 0;
+ setting->contentss.used = 0;
+
+ // This is processed in a set, so there is only ever one Object.
+ setting->status = f_string_dynamics_increase(setting->state.step_small, &setting->objects);
+
+ if (F_status_is_error(setting->status)) {
+ fss_write_print_error(setting, main->error, "f_string_dynamics_increase");
+
+ return;
+ }
+
+ // This is processed in a set, so there is only ever one Content set.
+ setting->status = f_string_dynamicss_increase(setting->state.step_small, &setting->contentss);
+
+ if (F_status_is_error(setting->status)) {
+ fss_write_print_error(setting, main->error, "f_string_dynamicss_increase");
+
+ return;
+ }
+
+ setting->status = f_string_dynamics_increase(setting->state.step_small, &setting->contentss.array[0]);
+
+ if (F_status_is_error(setting->status)) {
+ fss_write_print_error(setting, main->error, "f_string_dynamics_increase");
+
+ return;
+ }
+
for (;;) {
if (!((++main->signal_check) % fss_write_signal_check_d)) {
if (fll_program_standard_signal_received(main)) {
- fll_program_print_signal_received(main->warning, macro_fss_write_setting(setting)->line_first, main->signal_received);
+ fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received);
- macro_fss_write_setting(setting)->status = F_status_set_error(F_interrupt);
+ setting->status = F_status_set_error(F_interrupt);
break;
}
if (range.start > range.stop) {
if (status_pipe == F_none_eof) break;
- macro_fss_write_setting(setting)->block.used = 0;
+ setting->block.used = 0;
- status_pipe = f_file_read_block(input, ¯o_fss_write_setting(setting)->block);
+ status_pipe = f_file_read_block(input, &setting->block);
if (F_status_is_error(status_pipe)) {
- fss_write_print_error(macro_fss_write_setting(setting), main->error, "f_file_read_block");
+ fss_write_print_error(setting, main->error, "f_file_read_block");
status_pipe = F_status_set_error(F_pipe);
break;
}
- if (!macro_fss_write_setting(setting)->block.used) break;
+ if (!setting->block.used) break;
range.start = 0;
- range.stop = macro_fss_write_setting(setting)->block.used - 1;
+ range.stop = setting->block.used - 1;
}
+ // Begin Object.
if (!state || state == 0x1) {
if (!state) {
- macro_fss_write_setting(setting)->object.used = 0;
- macro_fss_write_setting(setting)->content.used = 0;
+ setting->objects.array[used_objects].used = 0;
state = 0x1;
}
- if (macro_fss_write_setting(setting)->object.used + macro_fss_write_setting(setting)->block.used > macro_fss_write_setting(setting)->object.size) {
- macro_fss_write_setting(setting)->status = f_string_dynamic_increase_by(macro_fss_write_setting(setting)->block.used, ¯o_fss_write_setting(setting)->object);
+ // Reset the "has Content for Object" flag and associated contents array used length.
+ flag -= flag | 0x4;
+ setting->contentss.array[used_contentss].used = 0;
+
+ if (setting->objects.array[used_objects].used + setting->block.used > setting->objects.array[used_objects].size) {
+ setting->status = f_string_dynamic_increase_by(setting->block.used, &setting->objects.array[used_objects]);
- if (F_status_is_error(macro_fss_write_setting(setting)->status)) {
- fss_write_print_error(macro_fss_write_setting(setting), main->error, "f_string_dynamic_increase_by");
+ if (F_status_is_error(setting->status)) {
+ fss_write_print_error(setting, main->error, "f_string_dynamic_increase_by");
break;
}
for (; range.start <= range.stop; ++range.start) {
- if (macro_fss_write_setting(setting)->block.string[range.start] == fss_write_pipe_content_start_s.string[0]) {
+ if (setting->block.string[range.start] == fss_write_pipe_content_start_s.string[0]) {
state = 0x2;
++range.start;
break;
}
- if (macro_fss_write_setting(setting)->block.string[range.start] == fss_write_pipe_content_end_s.string[0]) {
+ if (setting->block.string[range.start] == fss_write_pipe_content_end_s.string[0]) {
state = 0x3;
++range.start;
break;
}
- if (macro_fss_write_setting(setting)->block.string[range.start] == fss_write_pipe_content_ignore_s.string[0]) {
+ if (setting->block.string[range.start] == fss_write_pipe_content_ignore_s.string[0]) {
- // This is not used by objects.
+ // @todo implement this (a single fss_write_pipe_content_ignore_s followed by another fss_write_pipe_content_ignore_s should act as a delimit). (also consider delimits for other special escapes as well.)
continue;
}
- macro_fss_write_setting(setting)->object.string[macro_fss_write_setting(setting)->object.used++] = macro_fss_write_setting(setting)->block.string[range.start];
+ setting->objects.array[used_objects].string[setting->objects.array[used_objects].used++] = setting->block.string[range.start];
} // for
- if (F_status_is_error(macro_fss_write_setting(setting)->status)) break;
+ if (F_status_is_error(setting->status)) break;
- // If the start of content was not found, then fetch the next block.
+ // If the start of Content was not found, then fetch the next block.
if (state == 0x1) continue;
// If the end of the current block is reached, fetch the next block.
if (range.start > range.stop) continue;
}
+ // Begin Content.
if (state == 0x2) {
+
+ // Check to see if the Content supports multiple Content per Object.
+ if (flag & 0x4) {
+ if (!(setting->flag & fss_write_flag_content_multiple_e)) {
+ setting->status = F_status_set_error(F_support_not);
+
+ fss_write_print_error_one_content_only(setting, main->error);
+
+ break;
+ }
+
+ setting->status = f_string_dynamics_increase(setting->state.step_small, &setting->contentss.array[used_contentss]);
+
+ if (F_status_is_error(setting->status)) {
+ fss_write_print_error(setting, main->error, "f_string_dynamics_increase");
+
+ break;
+ }
+ }
+
if (range.start <= range.stop) {
total = (range.stop - range.start) + 1;
}
}
// When payload is provided, all data at this point is part of the payload until the end of the pipe.
- if (fl_string_dynamic_compare(f_fss_string_payload_s, macro_fss_write_setting(setting)->object) == F_equal_to) {
+ if (fl_string_dynamic_compare(f_fss_string_payload_s, setting->objects.array[used_objects]) == F_equal_to) {
if (total > 1) {
- macro_fss_write_setting(setting)->status = f_string_dynamic_increase_by(total, ¯o_fss_write_setting(setting)->content);
+ setting->status = f_string_dynamic_increase_by(total, &setting->contentss.array[used_contentss].array[0]);
- if (F_status_is_error(macro_fss_write_setting(setting)->status)) {
- fss_write_print_error(macro_fss_write_setting(setting), main->error, "f_string_dynamic_increase_by");
+ if (F_status_is_error(setting->status)) {
+ fss_write_print_error(setting, main->error, "f_string_dynamic_increase_by");
break;
}
- memcpy(macro_fss_write_setting(setting)->content.string, macro_fss_write_setting(setting)->block.string + range.start, sizeof(f_char_t) * total);
+ memcpy(setting->contentss.array[used_contentss].array[0].string, setting->block.string + range.start, sizeof(f_char_t) * total);
- macro_fss_write_setting(setting)->content.used += total;
+ setting->contentss.array[used_contentss].array[0].used += total;
}
state = 0x4;
- printed |= 0x2;
+ flag |= 0x8;
// Designate to read next block from pipe.
- range.start = 1; // fss_write_payload_process_set ??
+ range.start = 1;
range.stop = 0;
continue;
}
if (total) {
- macro_fss_write_setting(setting)->status = f_string_dynamic_increase_by(total, ¯o_fss_write_setting(setting)->content);
+ setting->status = f_string_dynamic_increase_by(total, &setting->contentss.array[used_contentss].array[0]);
- if (F_status_is_error(macro_fss_write_setting(setting)->status)) {
- fss_write_print_error(macro_fss_write_setting(setting), main->error, "f_string_dynamic_increase_by");
+ if (F_status_is_error(setting->status)) {
+ fss_write_print_error(setting, main->error, "f_string_dynamic_increase_by");
break;
}
for (; range.start <= range.stop; ++range.start) {
- if (macro_fss_write_setting(setting)->block.string[range.start] == fss_write_pipe_content_start_s.string[0]) {
- macro_fss_write_setting(setting)->status = F_status_set_error(F_supported_not);
+ if (setting->block.string[range.start] == fss_write_pipe_content_start_s.string[0]) {
+ setting->status = F_status_set_error(F_support_not);
- if (main->error.verbosity > f_console_verbosity_quiet_e) {
- fss_write_print_line_first_locked(macro_fss_write_setting(setting), main->error);
- fss_write_print_error_one_content_only(macro_fss_write_setting(setting), main->error, fss_write_payload_standard_s);
- fss_write_print_line_last_locked(macro_fss_write_setting(setting), main->error);
- }
+ fss_write_print_error_one_content_only(setting, main->error);
break;
}
- if (macro_fss_write_setting(setting)->block.string[range.start] == fss_write_pipe_content_end_s.string[0]) {
+ if (setting->block.string[range.start] == fss_write_pipe_content_end_s.string[0]) {
state = 0x3;
++range.start;
break;
}
- if (macro_fss_write_setting(setting)->block.string[range.start] == fss_write_pipe_content_ignore_s.string[0]) {
+ if (setting->block.string[range.start] == fss_write_pipe_content_ignore_s.string[0]) {
- // This is not used by this program.
+ // @todo implement this (a single fss_write_pipe_content_ignore_s followed by another fss_write_pipe_content_ignore_s should act as a delimit).
continue;
}
- macro_fss_write_setting(setting)->content.string[macro_fss_write_setting(setting)->content.used++] = macro_fss_write_setting(setting)->block.string[range.start];
+ setting->contentss.array[used_contentss].array[0].string[setting->contentss.array[used_contentss].array[0].used++] = setting->block.string[range.start];
} // for
- if (F_status_is_error(macro_fss_write_setting(setting)->status)) break;
+ if (F_status_is_error(setting->status)) break;
+
+ ++setting->contentss.array[used_contentss].used;
+ flag |= 0x4;
}
else {
state = 0x3;
}
}
+ // End Object or Content set.
if (state == 0x3) {
- if (macro_fss_write_setting(setting)->flag & fss_write_flag_partial_e) {
- if (macro_fss_write_setting(setting)->flag & fss_write_flag_content_e) {
- fss_write_payload_process_set(main, macro_fss_write_setting(setting), 0, ¯o_fss_write_setting(setting)->content);
+ if (setting->flag & fss_write_flag_partial_e) {
+ if (setting->flag & fss_write_flag_content_e) {
+ setting->object = 0;
+ setting->contents = &setting->contentss.array[used_contentss];
}
else {
- fss_write_payload_process_set(main, macro_fss_write_setting(setting), ¯o_fss_write_setting(setting)->object, 0);
+ setting->object = &setting->objects.array[used_objects];
+ setting->contents = 0;
}
}
else {
- fss_write_payload_process_set(main, macro_fss_write_setting(setting), ¯o_fss_write_setting(setting)->object, ¯o_fss_write_setting(setting)->content);
+ setting->object = &setting->objects.array[used_objects];
+ setting->contents = &setting->contentss.array[used_contentss];
}
- if (F_status_is_error(macro_fss_write_setting(setting)->status)) break;
+ setting->ignores = &setting->ignoress.array[used_ignoress];
+
+ fss_write_payload_process_set(main, void_setting);
+ if (F_status_is_error(setting->status)) break;
state = 0;
- printed |= 0x1;
+ flag |= 0x1;
continue;
}
+ // Payload Object.
if (state == 0x4) {
- if (macro_fss_write_setting(setting)->block.used && range.start <= range.stop) {
+ if (setting->block.used && range.start <= range.stop) {
length = (range.stop - range.start) + 1;
- macro_fss_write_setting(setting)->status = f_string_dynamic_increase_by(length + 1, ¯o_fss_write_setting(setting)->content);
+ setting->status = f_string_dynamic_increase_by(length + 1, &setting->contentss.array[used_contentss].array[0]);
- if (F_status_is_error(macro_fss_write_setting(setting)->status)) {
- fss_write_print_error(macro_fss_write_setting(setting), main->error, "f_string_dynamic_increase_by");
+ if (F_status_is_error(setting->status)) {
+ fss_write_print_error(setting, main->error, "f_string_dynamic_increase_by");
break;
}
- memcpy(macro_fss_write_setting(setting)->content.string + range.start, macro_fss_write_setting(setting)->block.string, sizeof(f_char_t) * length);
+ memcpy(setting->contentss.array[used_contentss].array[0].string + range.start, setting->block.string, sizeof(f_char_t) * length);
- macro_fss_write_setting(setting)->content.used += length;
+ setting->contentss.array[used_contentss].array[0].used += length;
}
// Designate to read next block from pipe.
} // for
// If the pipe ended before finishing, then attempt to wrap up.
- if (F_status_is_error_not(macro_fss_write_setting(setting)->status) && status_pipe == F_none_eof && state) {
- if (macro_fss_write_setting(setting)->flag & fss_write_flag_partial_e) {
- if (macro_fss_write_setting(setting)->flag & fss_write_flag_content_e) {
- fss_write_payload_process_set(main, macro_fss_write_setting(setting), 0, ¯o_fss_write_setting(setting)->content);
+ if (F_status_is_error_not(setting->status) && status_pipe == F_none_eof && state) {
+ if (setting->flag & fss_write_flag_partial_e) {
+ if (setting->flag & fss_write_flag_content_e) {
+ setting->object = 0;
+ setting->contents = &setting->contentss.array[used_contentss];
}
else {
- fss_write_payload_process_set(main, macro_fss_write_setting(setting), ¯o_fss_write_setting(setting)->object, 0);
+ setting->object = &setting->objects.array[used_objects];
+ setting->contents = 0;
}
}
else {
- fss_write_payload_process_set(main, macro_fss_write_setting(setting), ¯o_fss_write_setting(setting)->object, ¯o_fss_write_setting(setting)->content);
+ setting->object = &setting->objects.array[used_objects];
+ setting->contents = &setting->contentss.array[used_contentss];
}
- printed |= 0x1;
- }
+ setting->ignores = &setting->ignoress.array[used_ignoress];
+
+ fss_write_payload_process_set(main, void_setting);
- macro_fss_write_setting(setting)->block.used = 0;
- macro_fss_write_setting(setting)->object.used = 0;
- macro_fss_write_setting(setting)->content.used = 0;
- macro_fss_write_setting(setting)->buffer.used = 0;
+ flag |= 0x1;
+ }
- if (F_status_is_error_not(macro_fss_write_setting(setting)->status)) {
- if (printed & 0x1) {
- if (printed & 0x2) {
- macro_fss_write_setting(setting)->status = F_payload;
+ setting->block.used = 0;
+ setting->buffer.used = 0;
+ setting->objects.used = used_objects;
+ setting->contentss.used = used_contentss;
+ setting->ignoress.used = used_ignoress;
+
+ if (F_status_is_error_not(setting->status)) {
+ if (flag & 0x1) {
+ if (flag & 0x8) {
+ setting->status = F_payload;
}
else {
- macro_fss_write_setting(setting)->status = F_none;
+ setting->status = F_none;
}
}
else {
- macro_fss_write_setting(setting)->status = F_data_not;
+ setting->status = F_data_not;
}
// Print newline character to separate data printed from pipe.
- if ((macro_fss_write_setting(setting)->flag & fss_write_flag_partial_e) && macro_fss_write_setting(setting)->objects.used) {
- fll_print_dynamic(f_string_eol_s, main->output.to);
+ if ((setting->flag & fss_write_flag_partial_e) && setting->objects.used) {
+ fll_print_dynamic(f_string_eol_s, main->output.to); // @fixme review this, should this be sending to message or not at all?
}
- else if (macro_fss_write_setting(setting)->contents.used) {
- fll_print_dynamic(f_fss_payload_header_close_s, main->output.to);
+ else if (setting->contentss.used) {
+ if (flag & 0x8) {
+ fll_print_dynamic(f_fss_payload_header_close_s, main->output.to);
+ }
}
}
}
#endif // _di_fss_write_payload_process_pipe_
#ifndef _di_fss_write_payload_process_set_
- void fss_write_payload_process_set(fll_program_data_t * const main, fss_write_setting_t * const setting, const f_string_static_t *object, const f_string_static_t *content) {
+ void fss_write_payload_process_set(fll_program_data_t * const main, void * const void_setting) {
+
+ fss_write_setting_t * const setting = macro_fss_write_setting(void_setting);
- if (object) {
- if (content) {
- if (object->used) {
+ if (setting->object) {
+ if (setting->contents && setting->contents->used) {
+ if (setting->object->used) {
setting->range.start = 0;
- setting->range.stop = object->used - 1;
+ setting->range.stop = setting->object->used - 1;
}
else {
setting->range.start = 1;
setting->range.stop = 0;
}
- setting->status = fll_fss_payload_write(*object, *content, setting->flag & fss_write_flag_trim_e, setting->flag & fss_write_flag_prepend_e ? &setting->prepend : 0, setting->state, &setting->buffer);
+ setting->status = fll_fss_payload_write(*setting->object, setting->contents->array[0], setting->flag & fss_write_flag_trim_e, setting->flag & fss_write_flag_prepend_e ? &setting->prepend : 0, setting->state, &setting->buffer);
if (F_status_set_fine(setting->status) == F_none_eol) {
- setting->status = F_status_set_error(F_supported_not);
+ setting->status = F_status_set_error(F_support_not);
fss_write_print_line_first_locked(setting, main->error);
- fss_write_print_error_unsupported_eol(setting, main->error, fss_write_payload_standard_s);
+ fss_write_print_error_unsupported_eol(setting, main->error);
fss_write_print_line_last_locked(setting, main->error);
return;
else {
bool complete = f_fss_complete_none_e;
- if (object->used) {
+ if (setting->object->used) {
setting->range.start = 0;
- setting->range.stop = object->used - 1;
+ setting->range.stop = setting->object->used - 1;
}
else {
setting->range.start = 1;
setting->range.stop = 0;
}
- if (content) {
+ if (setting->contents && setting->contents->used) {
if (main->parameters.array[fss_write_parameter_trim_e].result & f_console_result_found_e) {
complete = f_fss_complete_full_trim_e;
}
}
}
- setting->status = fl_fss_basic_list_object_write(*object, complete, setting->state, &setting->range, &setting->buffer);
+ setting->status = fl_fss_basic_list_object_write(*setting->object, complete, setting->state, &setting->range, &setting->buffer);
if (F_status_set_fine(setting->status) == F_none_eol) {
- setting->status = F_status_set_error(F_supported_not);
+ setting->status = F_status_set_error(F_support_not);
fss_write_print_line_first_locked(setting, main->error);
- fss_write_print_error_unsupported_eol(setting, main->error, fss_write_payload_standard_s);
+ fss_write_print_error_unsupported_eol(setting, main->error);
fss_write_print_line_last_locked(setting, main->error);
return;
}
}
}
- else if (content && content->used) {
+ else if (setting->contents && setting->contents->used && setting->contents->array[0].used) {
setting->range.start = 0;
- setting->range.stop = content->used - 1;
+ setting->range.stop = setting->contents->array[0].used - 1;
const f_string_static_t *prepend = 0;
prepend = &main->parameters.arguments.array[index];
}
- setting->status = fl_fss_basic_list_content_write(*content, object ? f_fss_complete_full_e : f_fss_complete_none_e, prepend, setting->state, &setting->range, &setting->buffer);
+ setting->status = fl_fss_basic_list_content_write(setting->contents->array[0], setting->object ? f_fss_complete_full_e : f_fss_complete_none_e, prepend, setting->state, &setting->range, &setting->buffer);
if (F_status_is_error(setting->status)) {
fss_write_print_error(setting, main->error, "fl_fss_payload_content_write");
}
}
- if (!object || !content) {
+ if (!setting->object || !(setting->contents && setting->contents->used)) {
setting->status = f_string_dynamic_append(f_string_eol_s, &setting->buffer);
if (F_status_is_error(setting->status)) {
#endif // _di_fss_write_payload_process_help_
/**
- * Process normally, writing to the output.
- *
- * @param main
- * The main program data.
- * @param setting
- * The main program settings.
- * Must be of type (fss_write_setting_t *).
- *
- * This alters setting.status:
- * F_none on success.
- * F_interrupt on (exit) signal received.
- *
- * F_parameter (with error bit) if main is NULL or setting is NULL.
- */
-#ifndef _di_fss_write_payload_process_normal_
- extern void fss_write_payload_process_normal(fll_program_data_t * const main, void * const setting);
-#endif // _di_fss_write_payload_process_normal_
-
-/**
* Process the pipe, reading from the pipe and writing to the output.
*
* @param main
* The main program data.
* @param setting
* The main program settings.
+ * Must be of type (fss_write_setting_t *).
+ *
+ * Set setting.object to 0 to not use an Object.
+ * Set setting.contents to 0 to not use an Content set.
+ *
+ * This standard only supports a single Content per Object.
+ * The setting.contents.array[0] must exist (settings.contents.used == 1), or it is treated as if (settings.contents == 0).
*
* This alters setting.status:
* F_none on success.
* F_interrupt on (exit) signal received.
*
* F_parameter (with error bit) if main is NULL or setting is NULL.
- * @param object
- * The object to validate and print.
- * Set pointer address to 0 to not use.
- * @param content
- * The content to escape and print.
- * Set pointer address to 0 to not use.
*/
#ifndef _di_fss_write_payload_process_set_
- extern void fss_write_payload_process_set(fll_program_data_t * const main, fss_write_setting_t * const setting, const f_string_static_t *object, const f_string_static_t *content);
+ extern void fss_write_payload_process_set(fll_program_data_t * const main, void * const setting);
#endif // _di_fss_write_payload_process_set_
/**
setting.state.data = (void *) &data;
setting.program_name = &fss_write_payload_program_name_s;
setting.program_name_long = &fss_write_payload_program_name_long_s;
+ setting.process_content = 0; // Not used by payload.
setting.process_help = &fss_write_payload_process_help;
- setting.process_pipe = &fss_write_payload_process_pipe;
- setting.process_normal = &fss_write_payload_process_normal;
+ setting.process_normal = &fss_write_process_normal;
setting.process_object = 0; // Not used by payload.
- setting.process_content = 0; // Not used by payload.
+ setting.process_pipe = &fss_write_payload_process_pipe;
+ setting.process_set = &fss_write_payload_process_set;
f_console_parameter_t parameters[] = fss_write_console_parameter_t_initialize;
data.parameters.array = parameters;