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.

21 lines
372 B

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