You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
479 B
24 lines
479 B
3 years ago
|
#!/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
|