From: Kevin Day Date: Mon, 5 Dec 2022 01:02:32 +0000 (-0600) Subject: Progress: Continue program related work, updating fss_write. X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=87e4d642bb7f4b272a0eb6c240abc0ec64c23fa5;p=fll Progress: Continue program related work, updating fss_write. 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. --- diff --git a/level_0/f_capability/c/capability.c b/level_0/f_capability/c/capability.c index 2f50e6b..8ed51d9 100644 --- a/level_0/f_capability/c/capability.c +++ b/level_0/f_capability/c/capability.c @@ -394,7 +394,7 @@ extern "C" { *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; @@ -598,7 +598,7 @@ extern "C" { 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); } @@ -617,7 +617,7 @@ extern "C" { 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); } @@ -645,7 +645,7 @@ extern "C" { 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); } @@ -664,7 +664,7 @@ extern "C" { 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); } @@ -850,7 +850,7 @@ extern "C" { 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); } diff --git a/level_0/f_capability/c/capability.h b/level_0/f_capability/c/capability.h index 2b36b26..84feb6c 100644 --- a/level_0/f_capability/c/capability.h +++ b/level_0/f_capability/c/capability.h @@ -61,7 +61,7 @@ extern "C" { * * 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. * @@ -304,7 +304,7 @@ extern "C" { * 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. * @@ -334,7 +334,7 @@ extern "C" { * 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. * @@ -365,7 +365,7 @@ extern "C" { * 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. * @@ -395,7 +395,7 @@ extern "C" { * 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. * @@ -666,7 +666,7 @@ extern "C" { * 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. * diff --git a/level_0/f_file/c/file.c b/level_0/f_file/c/file.c index e842f15..ec8a556 100644 --- a/level_0/f_file/c/file.c +++ b/level_0/f_file/c/file.c @@ -116,7 +116,7 @@ extern "C" { return F_none; } - return F_supported_not; + return F_support_not; } #endif // _di_f_file_clone_ @@ -239,7 +239,7 @@ extern "C" { return F_none; } - return F_supported_not; + return F_support_not; } #endif // _di_f_file_copy_ @@ -268,7 +268,7 @@ extern "C" { 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); @@ -284,7 +284,7 @@ extern "C" { 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); @@ -318,7 +318,7 @@ extern "C" { 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); @@ -332,7 +332,7 @@ extern "C" { 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); diff --git a/level_0/f_file/c/file.h b/level_0/f_file/c/file.h index e8536c7..63a46e5 100644 --- a/level_0/f_file/c/file.h +++ b/level_0/f_file/c/file.h @@ -167,7 +167,7 @@ extern "C" { * 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_ @@ -250,7 +250,7 @@ extern "C" { * 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_ @@ -371,7 +371,7 @@ extern "C" { * 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() @@ -415,7 +415,7 @@ extern "C" { * 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() @@ -447,7 +447,7 @@ extern "C" { * 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() @@ -482,7 +482,7 @@ extern "C" { * 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() @@ -516,7 +516,7 @@ extern "C" { * 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() @@ -555,7 +555,7 @@ extern "C" { * 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() */ @@ -664,7 +664,7 @@ extern "C" { * 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() @@ -1408,7 +1408,7 @@ extern "C" { * 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() diff --git a/level_0/f_file/c/file/stream.c b/level_0/f_file/c/file/stream.c index 5938412..4069643 100644 --- a/level_0/f_file/c/file/stream.c +++ b/level_0/f_file/c/file/stream.c @@ -124,7 +124,7 @@ extern "C" { 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); } diff --git a/level_0/f_file/c/file/stream.h b/level_0/f_file/c/file/stream.h index a5b3fc0..f46fd3a 100644 --- a/level_0/f_file/c/file/stream.h +++ b/level_0/f_file/c/file/stream.h @@ -164,7 +164,7 @@ extern "C" { * 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() @@ -359,7 +359,7 @@ extern "C" { * 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() diff --git a/level_0/f_file/c/private-file.c b/level_0/f_file/c/private-file.c index 9a6cdd8..314af28 100644 --- a/level_0/f_file/c/private-file.c +++ b/level_0/f_file/c/private-file.c @@ -343,10 +343,10 @@ extern "C" { 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); } @@ -545,7 +545,7 @@ extern "C" { 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); @@ -579,7 +579,7 @@ extern "C" { 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); diff --git a/level_0/f_file/c/private-file.h b/level_0/f_file/c/private-file.h index 1be050d..cfbd13e 100644 --- a/level_0/f_file/c/private-file.h +++ b/level_0/f_file/c/private-file.h @@ -85,7 +85,7 @@ extern "C" { * 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() @@ -290,7 +290,7 @@ extern "C" { * 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() @@ -328,7 +328,7 @@ extern "C" { * 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() @@ -369,7 +369,7 @@ extern "C" { * 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() @@ -415,7 +415,7 @@ extern "C" { * 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() * @@ -443,7 +443,7 @@ extern "C" { * 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() diff --git a/level_0/f_fss/c/fss/common.h b/level_0/f_fss/c/fss/common.h index 4556cba..2183ef1 100644 --- a/level_0/f_fss/c/fss/common.h +++ b/level_0/f_fss/c/fss/common.h @@ -179,7 +179,7 @@ extern "C" { * 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. diff --git a/level_0/f_signal/c/signal.c b/level_0/f_signal/c/signal.c index 06d9e76..86e2836 100644 --- a/level_0/f_signal/c/signal.c +++ b/level_0/f_signal/c/signal.c @@ -102,7 +102,7 @@ extern "C" { 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); diff --git a/level_0/f_signal/c/signal.h b/level_0/f_signal/c/signal.h index 85f87c6..feafbce 100644 --- a/level_0/f_signal/c/signal.h +++ b/level_0/f_signal/c/signal.h @@ -164,7 +164,7 @@ extern "C" { * 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. * diff --git a/level_0/f_socket/c/socket.c b/level_0/f_socket/c/socket.c index e4d9410..f4ed967 100644 --- a/level_0/f_socket/c/socket.c +++ b/level_0/f_socket/c/socket.c @@ -33,7 +33,7 @@ extern "C" { 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); @@ -224,7 +224,7 @@ extern "C" { 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) { @@ -264,7 +264,7 @@ extern "C" { 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); } diff --git a/level_0/f_socket/c/socket.h b/level_0/f_socket/c/socket.h index d7a4daf..03d333d 100644 --- a/level_0/f_socket/c/socket.h +++ b/level_0/f_socket/c/socket.h @@ -66,7 +66,7 @@ extern "C" { * 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. @@ -292,7 +292,7 @@ extern "C" { * 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. * @@ -319,7 +319,7 @@ extern "C" { * 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. * diff --git a/level_0/f_status/c/status.h b/level_0/f_status/c/status.h index 0e5cb97..152a984 100644 --- a/level_0/f_status/c/status.h +++ b/level_0/f_status/c/status.h @@ -463,8 +463,8 @@ extern "C" { 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, diff --git a/level_0/f_status_string/c/status_string.c b/level_0/f_status_string/c/status_string.c index 11b6260..fd52cc9 100644 --- a/level_0/f_status_string/c/status_string.c +++ b/level_0/f_status_string/c/status_string.c @@ -350,8 +350,8 @@ extern "C" { 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); @@ -2353,13 +2353,13 @@ extern "C" { 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; diff --git a/level_0/f_status_string/c/status_string.h b/level_0/f_status_string/c/status_string.h index 56bea80..2294570 100644 --- a/level_0/f_status_string/c/status_string.h +++ b/level_0/f_status_string/c/status_string.h @@ -503,8 +503,8 @@ extern "C" { #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" @@ -788,8 +788,8 @@ extern "C" { #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 @@ -1101,8 +1101,8 @@ extern "C" { 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; diff --git a/level_0/f_string/c/string/range.c b/level_0/f_string/c/string/range.c index f5d0dad..9763e26 100644 --- a/level_0/f_string/c/string/range.c +++ b/level_0/f_string/c/string/range.c @@ -6,6 +6,10 @@ 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 diff --git a/level_0/f_string/c/string/range.h b/level_0/f_string/c/string/range.h index bc6f818..5b050c7 100644 --- a/level_0/f_string/c/string/range.h +++ b/level_0/f_string/c/string/range.h @@ -42,6 +42,15 @@ extern "C" { 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 diff --git a/level_0/f_thread/c/thread.c b/level_0/f_thread/c/thread.c index 204f28c..ce37ffd 100644 --- a/level_0/f_thread/c/thread.c +++ b/level_0/f_thread/c/thread.c @@ -379,7 +379,7 @@ extern "C" { 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); } @@ -657,7 +657,7 @@ extern "C" { 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); @@ -950,7 +950,7 @@ extern "C" { 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); @@ -969,7 +969,7 @@ extern "C" { 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); @@ -988,7 +988,7 @@ extern "C" { 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; @@ -1378,7 +1378,7 @@ extern "C" { 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); } @@ -1642,7 +1642,7 @@ extern "C" { 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); } @@ -1695,7 +1695,7 @@ extern "C" { 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); } @@ -1895,7 +1895,7 @@ extern "C" { 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); diff --git a/level_0/f_thread/c/thread.h b/level_0/f_thread/c/thread.h index 964147a..0af6d8c 100644 --- a/level_0/f_thread/c/thread.h +++ b/level_0/f_thread/c/thread.h @@ -492,7 +492,7 @@ extern "C" { * 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. * @@ -853,7 +853,7 @@ extern "C" { * 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. * @@ -1238,7 +1238,7 @@ extern "C" { * 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. * @@ -1267,7 +1267,7 @@ extern "C" { * 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. * @@ -1301,7 +1301,7 @@ extern "C" { * 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. * @@ -1800,7 +1800,7 @@ extern "C" { * * 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. * @@ -2129,7 +2129,7 @@ extern "C" { * 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. * @@ -2202,7 +2202,7 @@ extern "C" { * 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. * @@ -2311,7 +2311,7 @@ extern "C" { * 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. @@ -2481,7 +2481,7 @@ extern "C" { * 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. * diff --git a/level_1/fl_directory/c/private-directory.c b/level_1/fl_directory/c/private-directory.c index 949f719..b56cb16 100644 --- a/level_1/fl_directory/c/private-directory.c +++ b/level_1/fl_directory/c/private-directory.c @@ -164,7 +164,7 @@ extern "C" { 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); } @@ -376,7 +376,7 @@ extern "C" { 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); } diff --git a/level_1/fl_fss/c/fss/basic.h b/level_1/fl_fss/c/fss/basic.h index 7105da9..9f81c05 100644 --- a/level_1/fl_fss/c/fss/basic.h +++ b/level_1/fl_fss/c/fss/basic.h @@ -220,7 +220,7 @@ extern "C" { * 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(). diff --git a/level_2/fll_execute/c/private-execute.c b/level_2/fll_execute/c/private-execute.c index 5c7738d..69f3943 100644 --- a/level_2/fll_execute/c/private-execute.c +++ b/level_2/fll_execute/c/private-execute.c @@ -72,7 +72,7 @@ extern "C" { 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); } diff --git a/level_2/fll_status_string/c/status_string.c b/level_2/fll_status_string/c/status_string.c index 0da8300..acf0280 100644 --- a/level_2/fll_status_string/c/status_string.c +++ b/level_2/fll_status_string/c/status_string.c @@ -1968,14 +1968,14 @@ extern "C" { 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; } diff --git a/level_3/control/c/control.c b/level_3/control/c/control.c index 74953d4..41e66ac 100644 --- a/level_3/control/c/control.c +++ b/level_3/control/c/control.c @@ -111,7 +111,7 @@ extern "C" { 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; diff --git a/level_3/controller/c/controller/private-controller.c b/level_3/controller/c/controller/private-controller.c index 6cef297..0b2c3ae 100644 --- a/level_3/controller/c/controller/private-controller.c +++ b/level_3/controller/c/controller/private-controller.c @@ -699,7 +699,7 @@ extern "C" { 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); } diff --git a/level_3/controller/c/entry/private-entry.c b/level_3/controller/c/entry/private-entry.c index 63177f2..a1f12bb 100644 --- a/level_3/controller/c/entry/private-entry.c +++ b/level_3/controller/c/entry/private-entry.c @@ -445,7 +445,7 @@ extern "C" { } 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; @@ -472,7 +472,7 @@ extern "C" { } 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; @@ -501,7 +501,7 @@ extern "C" { 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; @@ -572,7 +572,7 @@ extern "C" { 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); diff --git a/level_3/controller/c/rule/private-rule.c b/level_3/controller/c/rule/private-rule.c index 4d17383..20910ec 100644 --- a/level_3/controller/c/rule/private-rule.c +++ b/level_3/controller/c/rule/private-rule.c @@ -2506,7 +2506,7 @@ extern "C" { 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; } @@ -5006,7 +5006,7 @@ extern "C" { 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. diff --git a/level_3/fss_basic_list_write/c/private-write.c b/level_3/fss_basic_list_write/c/private-write.c index 94debe1..9371235 100644 --- a/level_3/fss_basic_list_write/c/private-write.c +++ b/level_3/fss_basic_list_write/c/private-write.c @@ -90,7 +90,7 @@ extern "C" { 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)) { @@ -271,7 +271,7 @@ extern "C" { 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; } diff --git a/level_3/fss_basic_write/c/private-write.c b/level_3/fss_basic_write/c/private-write.c index 2662304..1bc27cc 100644 --- a/level_3/fss_basic_write/c/private-write.c +++ b/level_3/fss_basic_write/c/private-write.c @@ -90,7 +90,7 @@ extern "C" { 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)) { @@ -115,7 +115,7 @@ extern "C" { 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)) { @@ -273,7 +273,7 @@ extern "C" { 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; } @@ -294,7 +294,7 @@ extern "C" { 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; } diff --git a/level_3/fss_embedded_list_write/c/private-write.c b/level_3/fss_embedded_list_write/c/private-write.c index f9751ca..d4bc709 100644 --- a/level_3/fss_embedded_list_write/c/private-write.c +++ b/level_3/fss_embedded_list_write/c/private-write.c @@ -96,7 +96,7 @@ extern "C" { 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)) { @@ -283,7 +283,7 @@ extern "C" { 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; } diff --git a/level_3/fss_extended_list_write/c/private-write.c b/level_3/fss_extended_list_write/c/private-write.c index 94a943f..3b3b40e 100644 --- a/level_3/fss_extended_list_write/c/private-write.c +++ b/level_3/fss_extended_list_write/c/private-write.c @@ -90,7 +90,7 @@ extern "C" { 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)) { @@ -274,7 +274,7 @@ extern "C" { 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; } diff --git a/level_3/fss_extended_write/c/private-write.c b/level_3/fss_extended_write/c/private-write.c index 0482c33..798e2d7 100644 --- a/level_3/fss_extended_write/c/private-write.c +++ b/level_3/fss_extended_write/c/private-write.c @@ -96,7 +96,7 @@ extern "C" { 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)) { @@ -124,7 +124,7 @@ extern "C" { 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)) { @@ -324,7 +324,7 @@ extern "C" { 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; } diff --git a/level_3/fss_write/c/basic/fss_write.c b/level_3/fss_write/c/basic/fss_write.c index 9f3a3a5..21c039f 100644 --- a/level_3/fss_write/c/basic/fss_write.c +++ b/level_3/fss_write/c/basic/fss_write.c @@ -8,12 +8,12 @@ extern "C" { #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 @@ -21,7 +21,7 @@ extern "C" { } 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, @@ -30,10 +30,10 @@ extern "C" { } 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; @@ -55,11 +55,11 @@ extern "C" { #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, @@ -69,7 +69,7 @@ extern "C" { } 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, @@ -79,10 +79,10 @@ extern "C" { } 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; @@ -94,43 +94,6 @@ extern "C" { } #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 diff --git a/level_3/fss_write/c/basic/fss_write.h b/level_3/fss_write/c/basic/fss_write.h index 416d2f1..6a05ea8 100644 --- a/level_3/fss_write/c/basic/fss_write.h +++ b/level_3/fss_write/c/basic/fss_write.h @@ -63,11 +63,12 @@ extern "C" { * * 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_ /** @@ -90,25 +91,6 @@ extern "C" { #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 @@ -119,34 +101,11 @@ extern "C" { * * 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 diff --git a/level_3/fss_write/c/basic/main.c b/level_3/fss_write/c/basic/main.c index 9c1d28b..c329c3c 100644 --- a/level_3/fss_write/c/basic/main.c +++ b/level_3/fss_write/c/basic/main.c @@ -7,11 +7,12 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { 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; diff --git a/level_3/fss_write/c/basic_list/fss_write.c b/level_3/fss_write/c/basic_list/fss_write.c index 435c14d..f2d86a1 100644 --- a/level_3/fss_write/c/basic_list/fss_write.c +++ b/level_3/fss_write/c/basic_list/fss_write.c @@ -8,11 +8,11 @@ extern "C" { #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, @@ -22,7 +22,7 @@ extern "C" { } 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, @@ -32,10 +32,10 @@ extern "C" { } 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; @@ -56,20 +56,13 @@ extern "C" { } #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 @@ -77,7 +70,7 @@ extern "C" { } 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, @@ -86,10 +79,10 @@ extern "C" { } 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; @@ -101,13 +94,6 @@ extern "C" { } #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 diff --git a/level_3/fss_write/c/basic_list/fss_write.h b/level_3/fss_write/c/basic_list/fss_write.h index 6ea235f..d27f6e0 100644 --- a/level_3/fss_write/c/basic_list/fss_write.h +++ b/level_3/fss_write/c/basic_list/fss_write.h @@ -64,11 +64,12 @@ extern "C" { * * 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_ /** @@ -91,25 +92,6 @@ extern "C" { #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 @@ -120,34 +102,11 @@ extern "C" { * * 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 diff --git a/level_3/fss_write/c/basic_list/main.c b/level_3/fss_write/c/basic_list/main.c index e8f6e86..2c5b01f 100644 --- a/level_3/fss_write/c/basic_list/main.c +++ b/level_3/fss_write/c/basic_list/main.c @@ -7,11 +7,12 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { 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; diff --git a/level_3/fss_write/c/embedded_list/fss_write.c b/level_3/fss_write/c/embedded_list/fss_write.c index 08d5669..69c2743 100644 --- a/level_3/fss_write/c/embedded_list/fss_write.c +++ b/level_3/fss_write/c/embedded_list/fss_write.c @@ -8,14 +8,14 @@ extern "C" { #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 @@ -23,10 +23,10 @@ extern "C" { } 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 @@ -34,10 +34,10 @@ extern "C" { } 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; @@ -58,19 +58,12 @@ extern "C" { } #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, @@ -79,7 +72,7 @@ extern "C" { } 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, @@ -88,10 +81,10 @@ extern "C" { } 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; @@ -103,13 +96,6 @@ extern "C" { } #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 diff --git a/level_3/fss_write/c/embedded_list/fss_write.h b/level_3/fss_write/c/embedded_list/fss_write.h index c94289a..a6f7275 100644 --- a/level_3/fss_write/c/embedded_list/fss_write.h +++ b/level_3/fss_write/c/embedded_list/fss_write.h @@ -63,11 +63,12 @@ extern "C" { * * 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_ /** @@ -90,25 +91,6 @@ extern "C" { #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 @@ -119,34 +101,11 @@ extern "C" { * * 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 diff --git a/level_3/fss_write/c/embedded_list/main.c b/level_3/fss_write/c/embedded_list/main.c index 494543a..253b605 100644 --- a/level_3/fss_write/c/embedded_list/main.c +++ b/level_3/fss_write/c/embedded_list/main.c @@ -7,11 +7,13 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { 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; diff --git a/level_3/fss_write/c/extended/fss_write.c b/level_3/fss_write/c/extended/fss_write.c index 447a899..3883a9d 100644 --- a/level_3/fss_write/c/extended/fss_write.c +++ b/level_3/fss_write/c/extended/fss_write.c @@ -8,13 +8,13 @@ extern "C" { #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 @@ -22,7 +22,7 @@ extern "C" { } 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, @@ -32,10 +32,10 @@ extern "C" { } 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; @@ -56,19 +56,12 @@ extern "C" { } #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, @@ -78,7 +71,7 @@ extern "C" { } 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, @@ -88,10 +81,10 @@ extern "C" { } 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; @@ -103,13 +96,6 @@ extern "C" { } #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 diff --git a/level_3/fss_write/c/extended/fss_write.h b/level_3/fss_write/c/extended/fss_write.h index 74fd129..d6dffa0 100644 --- a/level_3/fss_write/c/extended/fss_write.h +++ b/level_3/fss_write/c/extended/fss_write.h @@ -63,11 +63,12 @@ extern "C" { * * 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_ /** @@ -90,25 +91,6 @@ extern "C" { #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 @@ -119,34 +101,11 @@ extern "C" { * * 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 diff --git a/level_3/fss_write/c/extended/main.c b/level_3/fss_write/c/extended/main.c index 0da93cc..322f590 100644 --- a/level_3/fss_write/c/extended/main.c +++ b/level_3/fss_write/c/extended/main.c @@ -7,11 +7,12 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { 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; diff --git a/level_3/fss_write/c/extended_list/fss_write.c b/level_3/fss_write/c/extended_list/fss_write.c index 2020156..a0b5871 100644 --- a/level_3/fss_write/c/extended_list/fss_write.c +++ b/level_3/fss_write/c/extended_list/fss_write.c @@ -8,14 +8,14 @@ extern "C" { #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 @@ -23,10 +23,10 @@ extern "C" { } 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 @@ -34,10 +34,10 @@ extern "C" { } 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; @@ -58,19 +58,12 @@ extern "C" { } #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, @@ -79,7 +72,7 @@ extern "C" { } 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, @@ -88,10 +81,10 @@ extern "C" { } 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; @@ -103,13 +96,6 @@ extern "C" { } #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 diff --git a/level_3/fss_write/c/extended_list/fss_write.h b/level_3/fss_write/c/extended_list/fss_write.h index 0197115..d7a9d41 100644 --- a/level_3/fss_write/c/extended_list/fss_write.h +++ b/level_3/fss_write/c/extended_list/fss_write.h @@ -63,11 +63,12 @@ extern "C" { * * 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_ /** @@ -90,25 +91,6 @@ extern "C" { #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 @@ -119,34 +101,11 @@ extern "C" { * * 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 diff --git a/level_3/fss_write/c/extended_list/main.c b/level_3/fss_write/c/extended_list/main.c index efd2e94..8bd3e77 100644 --- a/level_3/fss_write/c/extended_list/main.c +++ b/level_3/fss_write/c/extended_list/main.c @@ -7,11 +7,13 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { 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; diff --git a/level_3/fss_write/c/main/common.c b/level_3/fss_write/c/main/common.c index ab242a4..20553dd 100644 --- a/level_3/fss_write/c/main/common.c +++ b/level_3/fss_write/c/main/common.c @@ -55,13 +55,11 @@ extern "C" { 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; } @@ -211,7 +209,7 @@ extern "C" { 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]; @@ -234,27 +232,81 @@ extern "C" { } 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; } @@ -318,7 +370,6 @@ extern "C" { } 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); @@ -329,58 +380,160 @@ extern "C" { 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); @@ -391,6 +544,13 @@ extern "C" { 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; @@ -418,12 +578,10 @@ extern "C" { 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; } diff --git a/level_3/fss_write/c/main/common.h b/level_3/fss_write/c/main/common.h index 1e4a824..555a116 100644 --- a/level_3/fss_write/c/main/common.h +++ b/level_3/fss_write/c/main/common.h @@ -240,35 +240,35 @@ extern "C" { * 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_ @@ -288,22 +288,32 @@ extern "C" { * 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 { @@ -318,26 +328,32 @@ extern "C" { 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 \ @@ -348,15 +364,20 @@ extern "C" { 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, \ diff --git a/level_3/fss_write/c/main/fss_write.c b/level_3/fss_write/c/main/fss_write.c index 1989ec4..ae13fce 100644 --- a/level_3/fss_write/c/main/fss_write.c +++ b/level_3/fss_write/c/main/fss_write.c @@ -42,48 +42,395 @@ extern "C" { } #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_ diff --git a/level_3/fss_write/c/main/fss_write.h b/level_3/fss_write/c/main/fss_write.h index a5727a0..795a1cc 100644 --- a/level_3/fss_write/c/main/fss_write.h +++ b/level_3/fss_write/c/main/fss_write.h @@ -78,12 +78,76 @@ extern "C" { #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. @@ -92,13 +156,13 @@ extern "C" { * 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 diff --git a/level_3/fss_write/c/main/main.c b/level_3/fss_write/c/main/main.c index f7ccea3..b1d9231 100644 --- a/level_3/fss_write/c/main/main.c +++ b/level_3/fss_write/c/main/main.c @@ -56,13 +56,15 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { 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) { @@ -77,73 +79,98 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { 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) { diff --git a/level_3/fss_write/c/main/print.c b/level_3/fss_write/c/main/print.c index 3cee7a8..cac7e2d 100644 --- a/level_3/fss_write/c/main/print.c +++ b/level_3/fss_write/c/main/print.c @@ -31,8 +31,8 @@ extern "C" { } #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; @@ -43,7 +43,7 @@ extern "C" { 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); @@ -52,40 +52,25 @@ extern "C" { 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_ @@ -106,17 +91,22 @@ extern "C" { #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); @@ -161,18 +151,11 @@ extern "C" { #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); @@ -184,18 +167,11 @@ extern "C" { #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); diff --git a/level_3/fss_write/c/main/print.h b/level_3/fss_write/c/main/print.h index 5740c9c..6ac12f8 100644 --- a/level_3/fss_write/c/main/print.h +++ b/level_3/fss_write/c/main/print.h @@ -62,7 +62,7 @@ extern "C" { #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. @@ -77,12 +77,12 @@ extern "C" { * * @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. @@ -90,37 +90,13 @@ extern "C" { * 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_ /** @@ -150,15 +126,13 @@ extern "C" { * 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_ /** diff --git a/level_3/fss_write/c/payload/fss_write.c b/level_3/fss_write/c/payload/fss_write.c index 63b8fee..740344f 100644 --- a/level_3/fss_write/c/payload/fss_write.c +++ b/level_3/fss_write/c/payload/fss_write.c @@ -14,61 +14,66 @@ extern "C" { } #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; } @@ -79,37 +84,41 @@ extern "C" { 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; } @@ -117,39 +126,60 @@ extern "C" { 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; } @@ -158,113 +188,120 @@ extern "C" { } // 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. @@ -274,72 +311,84 @@ extern "C" { } // 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; @@ -354,16 +403,16 @@ extern "C" { 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; } @@ -372,13 +421,13 @@ extern "C" { } } - 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; @@ -391,9 +440,9 @@ extern "C" { } } } - 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; @@ -403,7 +452,7 @@ extern "C" { 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"); @@ -412,7 +461,7 @@ extern "C" { } } - 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)) { diff --git a/level_3/fss_write/c/payload/fss_write.h b/level_3/fss_write/c/payload/fss_write.h index eb342b0..12da9c6 100644 --- a/level_3/fss_write/c/payload/fss_write.h +++ b/level_3/fss_write/c/payload/fss_write.h @@ -73,25 +73,6 @@ extern "C" { #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 @@ -119,21 +100,22 @@ extern "C" { * 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_ /** diff --git a/level_3/fss_write/c/payload/main.c b/level_3/fss_write/c/payload/main.c index eae873b..7f9344f 100644 --- a/level_3/fss_write/c/payload/main.c +++ b/level_3/fss_write/c/payload/main.c @@ -8,11 +8,12 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { 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;