aboutsummaryrefslogtreecommitdiff
path: root/extract-function-header.sh
diff options
context:
space:
mode:
authorGravatar Andres Erbsen <andreser@mit.edu>2017-06-18 15:46:40 -0400
committerGravatar Andres Erbsen <andreser@mit.edu>2017-06-18 15:47:33 -0400
commit87bf48fccf89460b8264bb5cedf6b0e966dde563 (patch)
tree4222fdb4f6e3b496623b28a26e994f07154e1a47 /extract-function-header.sh
parent989f6a49cb390b6279ee8ce0ed70eb993ff1b809 (diff)
compile X25519 C code from Makefile
Diffstat (limited to 'extract-function-header.sh')
-rwxr-xr-xextract-function-header.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/extract-function-header.sh b/extract-function-header.sh
new file mode 100755
index 000000000..e0db91ac9
--- /dev/null
+++ b/extract-function-header.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+case "$#" in
+ 0)
+ funcname=f
+ ;;
+ 1)
+ funcname="$1"
+ ;;
+ *)
+ exit 111
+ ;;
+esac
+
+cat <<"EOF"
+#include <stdint.h>
+
+#undef force_inline
+#define force_inline __attribute__((always_inline))
+
+EOF
+
+while IFS= read -r line; do
+ case "$line" in
+ *"λ '"*)
+ echo -n "void force_inline $funcname("
+ echo -n "uint64_t* out"
+ echo "$line" | grep -owP -- '\w+\d+' | \
+ while IFS= read -r arg; do
+ echo -n ", uint64_t $arg"
+ done
+ echo ');'
+ break
+ ;;
+ esac
+done
+