#!/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 " 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