blob: 9e23efd8509678aaec9d53cbcc3bf611c59ddea1 (
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
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
131
132
133
134
135
136
137
138
|
#!/bin/bash
#
# Convert all SCXML IRP tests from the W3C for specific datamodels
#
ME=`basename $0`
DIR="$( cd "$( dirname "$0" )" && pwd )"
cd $DIR
while [ "$1" != "" ]; do
case $1 in
ecma )
ECMA=$1
shift ;;
c89 )
C89=$1
shift ;;
lua )
LUA=$1
shift ;;
jexl )
JEXL=$1
shift ;;
namespace )
NAMESPACE=$1
shift ;;
xpath )
XPATH=$1
shift ;;
promela )
PROMELA=$1
shift ;;
prolog )
PROLOG=$1
shift ;;
* )
echo "unknown datamodel $1"
exit 1
esac
done
TXMLS=`ls txml/*.txml`
TRANSFORM="java -jar /Users/sradomski/Developer/Applications/SaxonHE9-4-0-7J/saxon9he.jar"
# see http://saxon.sourceforge.net/saxon6.5.1/using-xsl.html
for TXML in $TXMLS
do
echo -n "Processing $TXML for "
TARGETFILE=`basename $TXML .txml`.scxml
if [ "$ECMA" != "" ]; then
echo -n "ecma " && $TRANSFORM $TXML confEcma.xsl -o:ecma/$TARGETFILE
fi
if [ "$C89" != "" ]; then
echo -n "c89 " && $TRANSFORM $TXML confC89.xsl -o:c89/$TARGETFILE
fi
if [ "$JEXL" != "" ]; then
echo -n "jexl " && $TRANSFORM $TXML confJEXL.xsl -o:jexl/$TARGETFILE
fi
if [ "$NAMESPACE" != "" ]; then
echo -n "namespace " && $TRANSFORM ecma/$TARGETFILE confNamespace.xsl -o:namespace/$TARGETFILE
fi
if [ "$XPATH" != "" ]; then
echo -n "xpath " && $TRANSFORM $TXML confXPath.xsl -o:xpath/$TARGETFILE
fi
if [ "$PROMELA" != "" ]; then
echo -n "promela " && $TRANSFORM $TXML confPromela.xsl -o:promela/$TARGETFILE
fi
if [ "$PROLOG" != "" ]; then
echo -n "prolog " && $TRANSFORM $TXML confProlog.xsl -o:prolog/$TARGETFILE
fi
if [ "$LUA" != "" ]; then
echo -n "lua " && $TRANSFORM $TXML confLua.xsl -o:lua/$TARGETFILE
fi
echo
done
# make sure substitutions are idempotent!
if [ "$LUA" != "" ]; then
# percent needs to be escaped in lua patterns
sed -i.orig 's/this%20is%20some%20content/this%%20is%%20some%%20content/g' ./lua/test520.scxml
# x-www-form-urlencode will not preserve the type and we default to string
sed -i.orig 's/Var1==2/tonumber(Var1)==2/g' ./lua/test567.scxml
fi
if [ "$NAMESPACE" != "" ]; then
# unnamespace embedded xml in namespace tests
sed -i.orig 's/scxml:book/book/g' ./namespace/test557.scxml
sed -i.orig 's/scxml:book/book/g' ./namespace/test561.scxml
fi
cp txml/*.txt ecma/
cp txml/*.txt namespace/
cp txml/*.txt xpath/
cp txml/*.txt promela/
cp txml/*.txt prolog/
cp txml/*.txt lua/
cp txml/*.txt jexl/
find ./ecma -type f -exec grep -Ili 'datamodel="xpath"' {} \; |xargs rm -fv
find ./namespace -type f -exec grep -Ili 'datamodel="xpath"' {} \; |xargs rm -fv
find ./xpath -type f -exec grep -Ili 'datamodel="ecmascript"' {} \; |xargs rm -fv
find ./promela -type f -exec grep -Ili 'datamodel="xpath"' {} \; |xargs rm -fv
find ./promela -type f -exec grep -Ili 'datamodel="ecmascript"' {} \; |xargs rm -fv
find ./promela -type f -exec grep -Ili 'datamodel="null"' {} \; |xargs rm -fv
find ./prolog -type f -exec grep -Ili 'datamodel="xpath"' {} \; |xargs rm -fv
find ./prolog -type f -exec grep -Ili 'datamodel="ecmascript"' {} \; |xargs rm -fv
find ./prolog -type f -exec grep -Ili 'datamodel="null"' {} \; |xargs rm -fv
find ./lua -type f -exec grep -Ili 'datamodel="xpath"' {} \; |xargs rm -fv
find ./lua -type f -exec grep -Ili 'datamodel="ecmascript"' {} \; |xargs rm -fv
find ./lua -type f -exec grep -Ili 'datamodel="null"' {} \; |xargs rm -fv
find ./jexl -type f -exec grep -Ili 'datamodel="xpath"' {} \; |xargs rm -fv
find ./jexl -type f -exec grep -Ili 'datamodel="ecmascript"' {} \; |xargs rm -fv
find ./jexl -type f -exec grep -Ili 'datamodel="null"' {} \; |xargs rm -fv
# test436 is the null datamodel
mv ./ecma/test436.scxml ./null
rm ./namespace/test436.scxml
rm ./xpath/test436.scxml
rm ./promela/test436.scxml
rm ./prolog/test436.scxml
rm ./lua/test436.scxml
rm ./jexl/test436.scxml
# format all SCXML files
SCXMLS=`find . -type f -name '*.scxml'`
for SCXML in $SCXMLS
do
mv $SCXML $SCXML.unformatted.xml
xmllint --format $SCXML.unformatted.xml > $SCXML
rm $SCXML.unformatted.xml
done
|