parent
7e535cf9a2
commit
018fa4b8c6
@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
INPUT=${1:-input}
|
||||
INPUT_PROC=.input-proc-$(uuidgen)
|
||||
|
||||
WIDTH=$(head -n 1 "$INPUT" | wc -c)
|
||||
|
||||
./cmkinput $INPUT > $INPUT_PROC || exit 1
|
||||
|
||||
echo "#include <input.h>"
|
||||
echo ""
|
||||
echo "const rawinput_t RAW_INPUT[] = {"
|
||||
while IFS= read -r line; do
|
||||
printf '0b'
|
||||
echo "$line," | sed 's/.\{8\}/& 0b/g'
|
||||
done < $INPUT_PROC
|
||||
unset line
|
||||
echo "};"
|
||||
|
||||
echo "const size_t INPUT_WIDTH = $WIDTH;"
|
||||
echo "const size_t RAW_INPUT_SIZE = sizeof(RAW_INPUT) / sizeof(rawinput_t);"
|
||||
rm -f $INPUT_PROC
|
@ -1,20 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
echo "#pragma once"
|
||||
echo ""
|
||||
|
||||
INPUT=${1:-input}
|
||||
|
||||
COLS=$(head -n 1 "$INPUT" | wc -c)
|
||||
echo "namespace input {"
|
||||
echo " constexpr const auto COLS = $COLS;"
|
||||
echo " constexpr const char DATA[][COLS] = {"
|
||||
while IFS= read -r line; do
|
||||
echo " \"$line\","
|
||||
done < $INPUT
|
||||
unset line
|
||||
echo " };"
|
||||
|
||||
echo " constexpr const auto ROWS = sizeof(DATA)/sizeof(DATA[0]);"
|
||||
echo "}"
|
Loading…
Reference in new issue