File: sisc.sh

package info (click to toggle)
sisc 1.16.6-1.2
  • links: PTS
  • area: main
  • in suites: bullseye
  • size: 8,492 kB
  • sloc: lisp: 69,834; xml: 19,482; java: 17,841; sh: 125; makefile: 54
file content (79 lines) | stat: -rw-r--r-- 2,005 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
#!/bin/sh

RLWRAP_FILE=~/.sisc-rlwrap
HEAP_LOCATION=/usr/share/sisc/sisc.shp

checkIfNonInteractive() {
# returns true if parameter for "non-interactive" was passed to the script
    case "-x" in
    "$@")
        return 1;
    esac
    case "--no-repl" in
    "$@")
        return 1;
    esac
    return 0;
};


if [ ! -d "$SISC_HOME" ]
then
   SISC_HOME="`dirname $0`"
   if [ ! -f "$SISC_HOME/sisc.jar" ]
   then 
     if [ -f /usr/share/java/sisc.jar ]
     then
       SISC_HOME="/usr/share/java"
     elif [ -f /usr/lib/sisc/sisc.jar ] 
     then 
       SISC_HOME="/usr/lib/sisc" 
     elif [ -f /usr/local/lib/sisc/sisc.jar ]
     then
       SISC_HOME="/usr/local/lib/sisc"
     fi
   fi
fi

if [ -r "$HOME/sisc.properties" ]
then
  PROPERTIES="-p $HOME/sisc.properties"
elif [ -r "$SISC_HOME/sisc.properties" ]
then
  PROPERTIES="-p $SISC_HOME/sisc.properties"
fi

# We'll attempt to use the rlwrap unix utility to get readline support
# for the REPL.  However, due to some weirdness in the way threading
# works in the JVM, interrupts using CTL-C will cause rlwrap to exit
# prematurely.  To remedy this, we call rlwrap recursively on this shell
# script, so that the script must terminate to exit through to rlwrap.

#If the rlwrap readline wrapper is in the path, enable it for SISC, 
#unless the -x or --no-repl switches were used
checkIfNonInteractive $@;
if [ "$?" -eq "0" ] && [ -z "$RLWRAPPED" ] && [ -x "`which rlwrap`" ]
then
  if [ ! -f $RLWRAP_FILE ]
  then
    touch $RLWRAP_FILE 
  fi
  RLWRAP="rlwrap -b '(){}[],+=&^%$#@\;|' -f $RLWRAP_FILE -l $RLWRAP_FILE "
  RLWRAPPED=yes rlwrap $0 $@
else
    EXTENSIONS=""
    if [ -z "$JAVA" ] || ! which $JAVA 
    then
      JAVA=java
    fi

        
    D=":"
    case `uname -s` in 
      CYGWIN* )
        D=";" ;;
    esac
      
    $JAVA $JAVAOPT -classpath $SISC_HOME/sisc-opt.jar${D}$SISC_HOME/sisc.jar${D}$SISC_HOME/sisc-lib.jar${D}$CLASSPATH -Dsisc.home=$SISC_HOME sisc.REPL -h "$HEAP_LOCATION" $PROPERTIES $EXTENSIONS "$@"
fi