| 1 | #! /bin/bash -e |
| 2 | |
| 3 | # usage : faust2graph foo.dsp -> foo-sig.pdf |
| 4 | # usage : faust2graph -svg foo.dsp -> foo-sig.svg |
| 5 | |
| 6 | . usage.sh |
| 7 | |
| 8 | FILES="" |
| 9 | IGNORE="" |
| 10 | FORMAT="pdf" |
| 11 | |
| 12 | # Analyze command line |
| 13 | for p in $@; do |
| 14 | if [ $p = "-help" ] || [ $p = "-h" ]; then |
| 15 | usage faust2graph "[options] <file.dsp>" to display the graph of tasks |
| 16 | option "-svg" to display the SVG |
| 17 | exit |
| 18 | fi |
| 19 | if [ "$p" = -svg ]; then |
| 20 | FORMAT="svg" |
| 21 | elif [[ -f "$p" ]] && [ ${p: -4} == ".dsp" ]; then |
| 22 | FILES="$FILES $p" |
| 23 | else |
| 24 | IGNORE="$IGNORE $p" |
| 25 | fi |
| 26 | done |
| 27 | |
| 28 | for f in $FILES; do |
| 29 | faust -vec -tg $f -o /dev/null || exit |
| 30 | dot -T$FORMAT $f.dot -o $f.graph.$FORMAT || exit |
| 31 | rm $f.dot |
| 32 | done |