#!/bin/bash

idx=0
tmpfile=$(mktemp statestringsXXX)
echo '    "",' >> $${tmpfile}
for statename in $(grep -E '^#define ACTOR_STATE_[A-Z0-9_]+\s*1 << [0-9]+\s*// [0-9]+' $1 | cut -d ' ' -f 2);
do
    echo "    \"${statename}\"," >> ${tmpfile}
    idx=$((idx + 1))
done
echo '};' >> ${tmpfile}
echo "char *ACTOR_STATE_STRING_NAMES[${idx}] = {" > $2
cat ${tmpfile} >> ${2}
rm -f ${tmpfile}

