File: tao.in

package info (click to toggle)
taopm 1.0-7
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 6,972 kB
  • sloc: sh: 9,809; cpp: 5,161; yacc: 2,298; lex: 464; makefile: 434; ansic: 57
file content (115 lines) | stat: -rwxr-xr-x 3,196 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#! /bin/sh
# @configure_input@
#
# Tao - A software package for sound synthesis with physical models
# Copyright (C) 1993-1999 Mark Pearson
# 
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
#
# tao - compile and execute a Tao script
#
# (C) Mark Pearson 1998-99
#
# This shell script takes the name of a Tao script (minus the .tao suffix) as
# its argument and translates it into a valid C++ program which is then
# compiled and linked with the Tao library `libtao'. If the input file is
# called `infile.tao' then the executable is placed in a file called
# `infile.exe'. If translation, compilation and linking all succeed the
# executable is launched with the -g option which turns graphics mode on
# and causes Tao's instrument visualisation window to open. The synthesis
# proceeds as soon as the right cursor key is pressed. This is because the
# system starts off in `pause' mode so that the image can be rotated and
# zoomed before everything starts happening. See the User Manual for more
# details.

TAODIR=@TAODIR@
CXX=@CXX@
CPPFLAGS="@CPPFLAGS@"
LDFLAGS="@LDFLAGS@"

echo "========================================"
echo "|    Tao (c) 1996-2000 Mark Pearson    |"
echo "| Sound Synthesis with Physical Models |"
echo "========================================"
echo

if test -z ${1}
then
    echo 'Usage: tao <name>   (compiles and launches script <name>.tao)'
    exit 1;
fi

if ! test -e ${1}.tao
then
    echo "Unable to find file \"${1}.tao\""
    exit 0
fi

echo "Parsing \"${1}.tao\""

taoparse ${1}.tao > ${1}.cc;

if grep PARSE_FAILED ${1}.cc @HAVENULL@
then
    echo
    echo "Parsing failed for \"${1}.tao\""
    exit 1
else
    {
    echo "Compiling \"${1}.cc\" to make \"${1}.exe\"";
    if test -e ${1}.exe;
    then
	    rm -f ${1}.exe;
    fi

    if $CXX -O2 $CPPFLAGS -DSCRIPTNAME=\"${1}\" \
	-o ${1}.exe ${1}.cc -ltao $LDFLAGS 2> /tmp/tao.c++errors; then
	errors=no
    else
        errors=yes
    fi

# Find the root directory of the distribution.
    
    distdir=`tao-config --distdir`   

# If there were C++ compiler errors parse them with the given sed script
# to make them more comprehensible to the Tao user.

    if test "$errors" = "yes"; then
	echo
	sed -f $distdir/user-scripts/error.parse /tmp/tao.c++errors
	echo
	echo "Compilation failed for \"${1}.cc\""
        exit 1

# Otherwise remove the temporary C++ file generated by Tao and execute
# the generated executable.

    else 
        {
	rm -f ${1}.cc;
	echo "Launching \"${1}.exe\""
	echo
	exec ./${1}.exe -g;
	exit 0
	}
    fi
    }
fi