diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2023-07-16 02:03:33 +0200 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2023-07-16 02:03:33 +0200 |
commit | b31e4bc16d1df62b50c6f77a77041f9e7b6c906d (patch) | |
tree | 024c74c13d918aa6bde302aab6836fa33607613c /flatcc/scripts/flatcc-doc.sh | |
parent | ba6815ef8fb8ae472412b5af2837a7caba2799c2 (diff) | |
parent | 5a40295c4cf0af5ea8da9ced04a4ce7d3621a080 (diff) |
Merge commit '5a40295c4cf0af5ea8da9ced04a4ce7d3621a080' as 'flatcc'
Diffstat (limited to 'flatcc/scripts/flatcc-doc.sh')
-rwxr-xr-x | flatcc/scripts/flatcc-doc.sh | 36 |
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 |