1#!/bin/sh 2 3HOME=$(dirname $0)/.. 4SCHEMA=${SCHEMA:-$1} 5PREFIX=${PREFIX:-$2} 6OUTDIR=${OUTDIR:-$3} 7OUTDIR=${OUTDIR:-'.'} 8INCLUDE=${INCLUDE:-$HOME/include} 9FLATCC=${FLATCC:-$HOME/bin/flatcc} 10 11if [ "x$SCHEMA" = "x" ]; then 12 echo "Missing schema arg" 13 echo "usage: $(basename $0) schema-file name-prefix [outdir]" 14 exit 1 15fi 16 17if [ "x$PREFIX" = "x" ]; then 18 echo "Missing prefix arg" 19 echo "usage: $(basename $0) schema-file name-prefix [outdir]" 20 exit 1 21fi 22 23echo "flatcc doc for schema: '$SCHEMA' with name prefix: '$PREFIX'" 24 25echo "generating $OUTDIR/$PREFIX.doc" 26 27$FLATCC $SCHEMA -a --json --stdout | \ 28 clang - -E -DNDEBUG -I $INCLUDE | \ 29 clang-format -style="WebKit" | \ 30 grep "^static.* $PREFIX\w*(" | \ 31 cut -f 1 -d '{' | \ 32 grep -v deprecated | \ 33 grep -v ");$" | \ 34 sed 's/__tmp//g' | \ 35 sed 's/)/);/g' \ 36 > $OUTDIR/$PREFIX.doc 37