Below is the file 'src/lsi/makeabi' from this revision. You can also download the file.

#!/bin/sh

INFILE=$1

if [ "X${INFILE}" = "X" ]
then
	echo "Usage: $0 abispec"
	exit 1
fi

ABI=abi.c
HEADER=abi.lh

FNCOUNT=0

do_function()
{
	echo "	vm_intfn_${ARG1}," >>${ABI}
	echo "fndefint ${ARG1} ${FNCOUNT};" >>${HEADER}
	FNCOUNT=$((${FNCOUNT}+1))
}

cat <<EOF >${ABI}
/* abi.c */
/* autogenerated - do not edit */

#include "abi.h"

vm_intfn vm_intfn_table[] = {
EOF

cat <<EOF >${HEADER}
/* abi.lh */
/* autogenerated - do not edit */

EOF

while read TYPE ARG1 ARG2
do
	case "$TYPE" in
		function) do_function
			;;
	esac
done <${INFILE}

cat <<EOF >>${ABI}
};

const int vm_intfn_size = sizeof(vm_intfn_table) / sizeof(vm_intfn);
EOF