summaryrefslogtreecommitdiff
path: root/lib/hitomezashi_utils.c
diff options
context:
space:
mode:
authoruntir_l <87096069+untir-l@users.noreply.github.com>2022-02-24 14:57:35 +0000
committeruntir-l <87096069+untir-l@users.noreply.github.com>2022-02-25 09:56:49 +0000
commitc23118e8e48d043e4bb9b4d813a498af8d454d73 (patch)
tree265947d2a848e8a3fb27106be38c8ae95b2fffe0 /lib/hitomezashi_utils.c
parent8a7dde79de6edee01571d2eb4a333d8256f4c342 (diff)
downloadhitomezashi-c23118e8e48d043e4bb9b4d813a498af8d454d73.tar
hitomezashi-c23118e8e48d043e4bb9b4d813a498af8d454d73.tar.gz
hitomezashi-c23118e8e48d043e4bb9b4d813a498af8d454d73.zip
Add web app frontend, restructure almost everything
- Add web app frontend code - Add .html, .js, .wasm to .gitignore - Restructure Makefile to work with emmake, add build targets for web app, add .html, .js, .wasm to make clean - Explain the pattern in the README - Add explanation of web frontend to README - Restructure README generally for better clarity - Remove "make web app version" from todos in README - Set Doxygen to EXTRACT_ALL so trivial and useless doc comments are not needed when the naming suffices to be explanatory. - Move ascii_binary_str_to_ints to library code in new file hitomezashi_utils.c (and corresponding header) as web app also needs it. - Fix SDL2 include path so it also works with Emscripten - Remove some cluttering and unnecessary doc comments - Improve some doc comments
Diffstat (limited to 'lib/hitomezashi_utils.c')
-rw-r--r--lib/hitomezashi_utils.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/hitomezashi_utils.c b/lib/hitomezashi_utils.c
new file mode 100644
index 0000000..32832de
--- /dev/null
+++ b/lib/hitomezashi_utils.c
@@ -0,0 +1,22 @@
+#include "hitomezashi_utils.h"
+
+#include <stddef.h>
+#include <stdlib.h>
+
+char *hitomezashi_ascii_binary_str_to_ints(char *ascii_str, size_t len) {
+ char *res = malloc(len);
+ for (int i = 0; i < len; ++i) {
+ switch (ascii_str[i]) {
+ case '0':;
+ res[i] = 0;
+ break;
+ case '1':;
+ res[i] = 1;
+ break;
+ default:;
+ free(res);
+ return NULL;
+ }
+ }
+ return res;
+}