File: guib

package info (click to toggle)
espresso 6.7-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 311,068 kB
  • sloc: f90: 447,429; ansic: 52,566; sh: 40,631; xml: 37,561; tcl: 20,077; lisp: 5,923; makefile: 4,503; python: 4,379; perl: 1,219; cpp: 761; fortran: 618; java: 568; awk: 128
file content (89 lines) | stat: -rwxr-xr-x 2,325 bytes parent folder | download | duplicates (7)
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
#!/bin/sh 
# ----------------------------------------------------------------------
#  PROGRAM: guib
#  USAGE:   guib module-file
#  PURPOSE: tries to be a simple GUI based on module definition file
# ----------------------------------------------------------------------
#  Anton Kokalj
#  Jozef Stefan Institute, Ljubljana, Slovenia
#  INFM DEMOCRITOS National Simulation Center, Trieste, Italy
#  Email: Tone.Kokalj@ijs.si
# ======================================================================
#  Copyright (c) 2002,2003 Anton Kokalj
# ======================================================================
#
#
# This file is distributed under the terms of the GNU General Public
# License. See the file `COPYING' in the root directory of the present
# distribution, or http://www.gnu.org/copyleft/gpl.txt .
#
# 
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT.  IN NO EVENT SHALL ANTON KOKALJ BE LIABLE FOR ANY
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#

if test "x`type readlink`" = "x"; then
    # no readlink cmd; make a function-substitute
    readlink() {
        echo `ls -l $1 | awk '{print $NF}'`
    }
fi

pathname() {
    file=`type -p $1`
    if test $? -gt 0; then
        file=`which $1`
        if test $? -gt 0; then
            # give-up
            file=$1
        fi
    fi
    echo $file
}

pathdir() {
    file=`pathname $1`
    
    while test -h $file; do  
        file=`readlink $file`
    done

    dir=`dirname $file`
    ( cd $dir; pwd )
}

if test -z "$GUIB" ; then
    # try to guess the GUIB value
    export GUIB=`pathdir $0`
fi


if test $# -eq 1 ; then
    if test \( "$1" = "-v" \) -o \( "$1" = "--version" \) ; then
	version=`cat $GUIB/VERSION`
	echo $version
	exit 0
    fi
else
    echo "
Usage: $0 GUIB-definition-file
"
    exit 1
fi

if test -d $GUIB/bin ; then
    echo "
GUIB: using the \"$GUIB/itkwish\" interpreter
"
    $GUIB/bin/itkwish $GUIB/guib.tcl $@
else
    echo "
GUIB: using the system default \"tclsh\" interpreter
"
    tclsh $GUIB/guib.tcl $@
fi