blob: b01cadc725e8d19ad6721d191d16cef73af98672 (
plain)
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
|
#!/bin/sh
#
# Author: Marco Ladermann
# Date: Sat May 10 13:59:35 CEST 2003 @541 /Internet Time/
# Purpose: Starts the transformation process of a UI file to Java
# Changed:
#
# This software is free software. It is released under the terms of the
# GNU Lesser General Public Licence (LGPL)
# see http://www.gnu.org/copyleft/lesser.html
#
# These stylesheets are distributed in the hope that they will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
usage() {
juic=$(basename $0)
cat <<EOT
Usage: $juic [options] uifile...
Where options can be:
-outdir "dir" : output directory, defaults to current directory
-package "the.package.for.the.class" : Generates a package declaration
-main (true | false) : Generate a main method, defaults to "false"
-abstract (true | false) : Slots are declared abstract, defaults to "true"
-images dir : Path to images, defaults to "images"
-os (unix | msdos | mac) : Selects newline characters
EOT
exit 1
}
# Assume the directory structure
# ${UIXSL}/
# bin/
# xsl/
# common/
# java
UIXSLDIR=/usr/share/juic
UIXSL=${UIXSLDIR}/juic.xsl
ABSTRACT="true"
MAIN="false"
OUTDIR="."
IMAGES="images"
OS="unix"
PACKAGE=""
while [ -n "$1" ]
do
case "$1" in
-abstract) ABSTRACT=$2; shift; shift;;
-main) MAIN=$2; shift; shift;;
-outdir) OUTDIR=$2; shift; shift;;
-images) IMAGES=$2; shift; shift;;
-os) OS=$2; shift; shift;;
-package) PACKAGE=$2; shift; shift;;
-*) echo Unknown parameter $1; shift;;
*) break;;
esac
done
if [ -z "$1" ]
then
usage
fi
if [ $ABSTRACT = 'true' -a $MAIN = 'true' ]
then
echo "Option \"-main\" will be ignored, because class will be abstract"
MAIN="false"
fi
while [ -n "$1" ]
do
xsltproc --nonet --novalid \
--stringparam package "$PACKAGE" \
--stringparam outdir "$OUTDIR/" \
--stringparam images "$IMAGES/" \
--stringparam os $OS \
--stringparam genabstract $ABSTRACT \
--stringparam genmain $MAIN \
$UIXSL "$1"
shift
done
|