File: jas

package info (click to toggle)
jas 2.5.4408-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, jessie, jessie-kfreebsd, sid, stretch
  • size: 10,976 kB
  • ctags: 15,216
  • sloc: java: 111,905; python: 11,461; ruby: 9,204; makefile: 401; xml: 240; sh: 194
file content (130 lines) | stat: -rw-r--r-- 3,667 bytes parent folder | download | duplicates (2)
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#!/bin/bash
# $Id: jas 3905 2012-03-10 12:17:22Z kredel $
#
SCRIPT_LANG="python"
SCRIPT_LANG="ruby"
#
DEBUG=0
#
# setup required libs: JAVA_LIBS="../lib/log4j.jar:../lib/junit.jar:../lib/jas.jar"
#
if [ -f "../lib/log4j.jar" ] ; then
   JAVA_LIBS="../lib/log4j.jar"
elif [ -f "lib/log4j.jar" ] ; then
   JAVA_LIBS="lib/log4j.jar"
else
   echo "===========================================" 
   echo "Error: library log4j.jar not found" 
   echo "Please install log4j.jar in lib/ or ../lib/" 
   echo "===========================================" 
   exit 0
fi
#
if [ -f "../lib/junit.jar" ] ; then
   JAVA_LIBS="$JAVA_LIBS:../lib/junit.jar"
elif [ -f "lib/junit.jar" ] ; then
   JAVA_LIBS="$JAVA_LIBS:lib/junit.jar"
else
   echo "===========================================" 
   echo "Warning: library junit.jar not found" 
   echo "Please install junit.jar in lib/ or ../lib/" 
   echo "===========================================" 
fi
#
if [ -d "examples" ] ; then
   JAVA_LIBS="$JAVA_LIBS:examples"
fi
if [ -d "edu/jas" ] ; then
   JAVA_LIBS="$JAVA_LIBS:."
elif [ -f "../lib/jas.jar" ] ; then
   JAVA_LIBS="$JAVA_LIBS:../lib/jas.jar"
elif [ -f "lib/jas.jar" ] ; then
   JAVA_LIBS="$JAVA_LIBS:lib/jas.jar"
elif [ -f "jas.jar" ] ; then
   JAVA_LIBS="$JAVA_LIBS:jas.jar"
else
   echo "===========================================" 
   echo "Error: library jas.jar not found" 
   echo "Please install jas.jar in lib/ or ../lib/" 
   echo "===========================================" 
   exit 0
fi
#
#JAVA_LIBS="$JAVA_LIBS:."
#
#JAVA_OPTS="-J-verbose:gc -J-Xms1100M -J-Xmx1900M"
JAVA_OPTS="-J-verbose:gc -J-Xms350M -J-Xmx800M"
#JAVA_OPTS="-J-verbose:gc"
SCRIPT_OPTS=""
#
# check for scripting language
# Scanning for args is aborted by '--'.
#set -- $JAS_OPTS "$@"
#echo "jas_args: " $*
while [ $# -gt 0 ]
do
    case "$1" in
    # use python
    -py*|-jy*) 
         SCRIPT_LANG="python"
         ;;
    # use ruby
    -rb*|-ruby|-jr*) 
         SCRIPT_LANG="ruby"
         ;;
    -h|--help)
         help_requested=true
         ;;
    -d)
         DEBUG=1
         ;;
    -v|--verbose)
         SCRIPT_OPTS="-v"
         ;;
    --) break ;;
    # Other opts go through  
    -*) jas_args=("${jas_args[@]}" "$1") ;;
    # Abort processing on first non-opt arg 
    *) jas_args=("${jas_args[@]}" "$1")
        break ;;
    esac
    shift
done

if [ "$SCRIPT_LANG" = "ruby" ]; then
   if [ -f "examples/jas.rb" ] ; then
      echo -n "" 
   else 
      echo "===========================================" 
      echo "Error: library examples/jas.rb not found" 
      echo "Please install examples/jas.rb" 
      echo "===========================================" 
      exit 0
   fi
fi


#echo "jas_args: " $jas_args
# Put the jas_args back into the position arguments $1, $2 etc
set -- "${jas_args[@]}"

if [ -n "$help_requested" ] ; then
  echo "JAS options:" >&2
  echo "-py|-jy   : use Python scripting with jython" >&2
  echo "-rb|-jr   : use Ruby scripting with jruby" >&2
  echo "-d        : debug this script" >&2
  echo "-v        : verbose option for scripting language" >&2
  echo "-h|--help : this infos" >&2
  echo "--        : pass remaining arguments through to Jython|JRuby" >&2
  exit 0
fi

#
if [ "$SCRIPT_LANG" = "python" ]; then
   [[ $DEBUG > 0 ]] && echo jython $SCRIPT_OPTS -J-cp "$JAVA_LIBS" $JAVA_OPTS $* 
   jython $SCRIPT_OPTS -J-cp "$JAVA_LIBS" $JAVA_OPTS $* 
elif [ "$SCRIPT_LANG" = "ruby" ]; then
   [[ $DEBUG > 0 ]] && echo jruby $SCRIPT_OPTS -J-cp "$JAVA_LIBS" $JAVA_OPTS -S jirb --noinspect --readline -r "examples/jas.rb" $*
   jruby $SCRIPT_OPTS -J-cp "$JAVA_LIBS" $JAVA_OPTS -S jirb --noinspect --readline -r "examples/jas.rb" $*
fi
#