aboutsummaryrefslogtreecommitdiff
path: root/flatcc/scripts/flatcc-doc.sh
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2023-07-16 02:03:33 +0200
committerToni Uhlig <matzeton@googlemail.com>2023-07-16 02:03:33 +0200
commitb31e4bc16d1df62b50c6f77a77041f9e7b6c906d (patch)
tree024c74c13d918aa6bde302aab6836fa33607613c /flatcc/scripts/flatcc-doc.sh
parentba6815ef8fb8ae472412b5af2837a7caba2799c2 (diff)
parent5a40295c4cf0af5ea8da9ced04a4ce7d3621a080 (diff)
Merge commit '5a40295c4cf0af5ea8da9ced04a4ce7d3621a080' as 'flatcc'
Diffstat (limited to 'flatcc/scripts/flatcc-doc.sh')
-rwxr-xr-xflatcc/scripts/flatcc-doc.sh36
1 files changed, 36 insertions, 0 deletions
diff --git a/flatcc/scripts/flatcc-doc.sh b/flatcc/scripts/flatcc-doc.sh
new file mode 100755
index 0000000..902ae5c
--- /dev/null
+++ b/flatcc/scripts/flatcc-doc.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+HOME=$(dirname $0)/..
+SCHEMA=${SCHEMA:-$1}
+PREFIX=${PREFIX:-$2}
+OUTDIR=${OUTDIR:-$3}
+OUTDIR=${OUTDIR:-'.'}
+INCLUDE=${INCLUDE:-$HOME/include}
+FLATCC=${FLATCC:-$HOME/bin/flatcc}
+
+if [ "x$SCHEMA" = "x" ]; then
+ echo "Missing schema arg"
+ echo "usage: $(basename $0) schema-file name-prefix [outdir]"
+ exit 1
+fi
+
+if [ "x$PREFIX" = "x" ]; then
+ echo "Missing prefix arg"
+ echo "usage: $(basename $0) schema-file name-prefix [outdir]"
+ exit 1
+fi
+
+echo "flatcc doc for schema: '$SCHEMA' with name prefix: '$PREFIX'"
+
+echo "generating $OUTDIR/$PREFIX.doc"
+
+$FLATCC $SCHEMA -a --json --stdout | \
+ clang - -E -DNDEBUG -I $INCLUDE | \
+ clang-format -style="WebKit" | \
+ grep "^static.* $PREFIX\w*(" | \
+ cut -f 1 -d '{' | \
+ grep -v deprecated | \
+ grep -v ");$" | \
+ sed 's/__tmp//g' | \
+ sed 's/)/);/g' \
+ > $OUTDIR/$PREFIX.doc