The unified diff between revisions [afdbb938..] and [a81fe555..] is displayed below. It can also be downloaded as a raw diff.

This diff has been restricted to the following files: 'src/lsi/makeabi'

#
# old_revision [afdbb9388305ae66464ad4acb0437922656e3059]
# new_revision [a81fe5550c21fa983b4e344e07c29b9cecdf75ea]
#
# add_file "src/lsi/makeabi"
#  content [54d8bf7ee907e67849843b113a8c6f5039ec020b]
# 
#   set "src/lsi/makeabi"
#  attr "mtn:execute"
# value "true"
#
============================================================
--- /dev/null	
+++ src/lsi/makeabi	54d8bf7ee907e67849843b113a8c6f5039ec020b
@@ -0,0 +1,88 @@
+#!/bin/sh
+
+INFILE=$1
+
+if [ "X${INFILE}" = "X" ]
+then
+	echo "Usage: $0 abispec"
+	exit 1
+fi
+
+if [ ! -f "${INFILE}" ]
+then
+	echo "$0: ${INFILE}: not found"
+	exit 1
+fi
+
+ABI=abi.c
+HEADER=abi.lh
+
+
+# This is pretty evil. We use sed to produce shell commands which set
+# variables which contain 8-character chunks of the sha1 hash.
+# eval takes care of defining them in the current shell, rather than in
+# a subshell.
+for VER in `sha1 -n ${INFILE} | sed 's/\(........\)\(........\)\(........\)\(........\)\(........\).*$/ABIVER1=\1 ABIVER2=\2 ABIVER3=\3 ABIVER4=\4 ABIVER5=\5/'`
+do
+	eval ${VER}
+done
+
+
+FNCOUNT=0
+
+do_function()
+{
+	echo "	vm_intfn_${ARG1}," >>${ABI}
+	echo "fndefint ${ARG1} ${FNCOUNT};" >>${HEADER}
+	FNCOUNT=$((${FNCOUNT}+1))
+}
+
+do_function_v()
+{
+	echo "	vm_intfn_${ARG1}," >>${ABI}
+	echo "fndefint_v ${ARG1} ${FNCOUNT};" >>${HEADER}
+	FNCOUNT=$((${FNCOUNT}+1))
+}
+
+cat <<EOF >${ABI}
+/* abi.c */
+/* autogenerated - do not edit */
+
+#include "abi.h"
+
+const long vm_abiversion1 = 0x${ABIVER1};
+const long vm_abiversion2 = 0x${ABIVER2};
+const long vm_abiversion3 = 0x${ABIVER3};
+const long vm_abiversion4 = 0x${ABIVER4};
+const long vm_abiversion5 = 0x${ABIVER5};
+
+vm_intfn vm_intfn_table[] = {
+EOF
+
+cat <<EOF >${HEADER}
+/* abi.lh */
+/* autogenerated - do not edit */
+
+constant __abiversion1 0x${ABIVER1};
+constant __abiversion2 0x${ABIVER2};
+constant __abiversion3 0x${ABIVER3};
+constant __abiversion4 0x${ABIVER4};
+constant __abiversion5 0x${ABIVER5};
+
+EOF
+
+while read TYPE ARG1 ARG2
+do
+	case "$TYPE" in
+		function) do_function
+			;;
+		function_v) do_function_v
+			;;
+	esac
+done <${INFILE}
+
+cat <<EOF >>${ABI}
+};
+
+const int vm_intfn_size = sizeof(vm_intfn_table) / sizeof(vm_intfn);
+EOF