Merge branch 'master' of https://scm.cri.ensmp.fr/git/Faustine
[Faustine.git] / interpretor / preprocessor / faust-0.9.47mr3 / tools / faust2appls / faust2graphviewer
1 #!/bin/bash
2
3 # Usage.
4 print_usage()
5 {
6 echo Usage : args of faust2graphviewer should be a \'.dsp\' file, or a list of \'.dsp\' files.
7 }
8
9
10 # prepare how we are going to open .pdf files
11 if [[ $(uname) == Darwin ]]; then
12 OPEN=open
13 else
14 OPEN=xdg-open
15 fi
16
17
18
19 # Main loop of this script :
20 for FILEPATH in $@ ; do
21 if [ -f $FILEPATH ] ; then
22 FILENAME=`basename $FILEPATH` &&
23 case $FILENAME in
24 *.dsp )
25 faust -o /dev/null -vec --task-graph $FILEPATH &&
26 dot -Tpdf $FILEPATH.dot -o ${FILEPATH%.dsp}-graph.pdf &&
27 rm $FILEPATH.dot &&
28 ${OPEN} ${FILEPATH%.dsp}-graph.pdf
29 ;;
30 * )
31 echo error : \'$FILEPATH\' does not have a \'.dsp\' extension.
32 exit 2
33 ;;
34 esac
35 else
36 print_usage
37 exit 1
38 fi
39 done
40 exit 0
41