summaryrefslogtreecommitdiff
path: root/cli/hitomezashi_cli.h
diff options
context:
space:
mode:
authoruntir_l <87096069+untir-l@users.noreply.github.com>2022-02-18 14:05:08 +0000
committeruntir-l <87096069+untir-l@users.noreply.github.com>2022-02-25 09:56:49 +0000
commit581bc2dd768ca0af390b9abb41a5c89f1bca19e3 (patch)
tree2b8ef613b6448099852c9bf3487915c13d3ceea7 /cli/hitomezashi_cli.h
parent1bc2a436583b0e898decf13e695a1908a894a38c (diff)
downloadhitomezashi-581bc2dd768ca0af390b9abb41a5c89f1bca19e3.tar
hitomezashi-581bc2dd768ca0af390b9abb41a5c89f1bca19e3.tar.gz
hitomezashi-581bc2dd768ca0af390b9abb41a5c89f1bca19e3.zip
Reorganise CLI and lib into separate dirs, add doc comments for Doxygen
Diffstat (limited to 'cli/hitomezashi_cli.h')
-rw-r--r--cli/hitomezashi_cli.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/cli/hitomezashi_cli.h b/cli/hitomezashi_cli.h
new file mode 100644
index 0000000..d83de7b
--- /dev/null
+++ b/cli/hitomezashi_cli.h
@@ -0,0 +1,39 @@
+/** @file */
+#ifndef HITOMEZASHI_CLI_H
+#define HITOMEZASHI_CLI_H
+
+#include <stddef.h>
+
+/** Exit codes for main().
+ */
+enum Hitomezashi_Cli_Exit_Code {
+ /** The program completed successfully. */
+ Hitomezashi_Cli_Exit_Code_Success = 0,
+ /** The arguments were invalid or the program could not handle them. */
+ Hitomezashi_Cli_Exit_Code_Err_Handle_Args = 1,
+ /** Printing the help text failed. */
+ Hitomezashi_Cli_Exit_Code_Err_Print_Help = 2,
+ /** Initialising SDL failed. */
+ Hitomezashi_Cli_Exit_Code_Err_Sdl_Init = 3,
+ /** hitomezashi_state_init() from libhitomezashi failed. */
+ Hitomezashi_Cli_Exit_Code_Err_State_Init = 4,
+ /** Saving the SDL_Surface on which the pattern was drawn as an image failed.
+ */
+ Hitomezashi_Cli_Exit_Code_Err_Save_Image = 5,
+};
+
+/** Read and parse arguments, ensure they are valid, and give back the
+ * information in usable form to the caller. Also calls hitomezashi_cli_help()
+ * if -h is passed.
+ */
+void hitomezashi_cli_handle_args(char **out_file_path, int *x_pattern_len,
+ int *y_pattern_len, char **x_pattern,
+ char **y_pattern, int *gap, int *thickness,
+ int argc, char **argv);
+/** Print the help text and exit. */
+void hitomezashi_cli_help(void);
+/** Convert a string composed of ASCII 0 and 1 digits, eg\. "01010", to an array
+ * of numeric 0s and 1s stored as char. */
+char *hitomezashi_cli_ascii_binary_str_to_ints(char *ascii_str, size_t n);
+
+#endif // HITOMEZASHI_CLI_H