Debian Codegraph @

ConvertJDK117

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2
3 #
4 # Bourne Shell Script
5 #
6 # Description:
7 # Convert Tritonus 1.81 java source code
8 # so that it work with Java Development Kit 1.1.7 and
9 # the Collections API for JDK 1.1
10 #
11 # Author:
12 # Peter Pilgrim
13 # Wed Jan 05 21:15:56 GMT 2000
14 #
15
16 # ********************************************************************************
17 PrintUsagescip-shell shell shell-project 0.0.0 PrintUsage().()
18 # ********************************************************************************
19 {
20 catscip-shell system . . cat. << EOF
21 USAGE: $myname
22 [ --classpath (-cp) <CLASSPATH> ]
23 [ --dryrun (-dr) ] [ --force ]
24 [ --verbose (-v) | --noverbose (+v) ]
25 [ --help (-h) | --usage (-u) ]
26
27 OPTIONS:
28 '--dryrun' dry run and test the configuration, do not configure the
29 '-dr' the run-time stub file.
30 '--verbose' generates verbose output also.
31 '-v'
32 '--help' produces this brief text and exits gracefully.
33 '-h' '-u'
34
35 DESCRIPTION:
36
37 This program '$myname' converts Tritonus 1.81
38 Java source code so that it compiles with Java Development Kit 1.1.7
39 and the Collections API for JDK 1.1 The Collections API for JDK1.1 can
40 be found on the Javasoft web pages under the InfoBus product line.
41
42 Peter Pilgrim Wed Jan 05 21:18:41 GMT 2000
43 EOF
44
45 echoscip-shell system . . echo. '$RCSfile: ConvertJDK117,v $ $Revision: 1.1.1.1 $ $Author: pfisterer $ $Date: 2000/04/13 19:13:57 $'
46 exit 0
47 }
48
49 # ********************************************************************************
50 BackupFilescip-shell shell shell-project 0.0.0 BackupFile(). ()
51 # ********************************************************************************
52 {
53 # Backup a file by renaming it.
54 ThisFile=$1
55 if [scip-shell system . . `[`. -f ${ThisFile} ]; then
56 if [scip-shell system . . `[`. -f ${ThisFile}.bak ]; then
57 (set $VerboseOpt; ${PrefixCmd} /bin/rmscip-shell filesystem . . `/bin/rm`. -f ${ThisFile}.bak )
58 fi
59 (set $VerboseOpt; ${PrefixCmd} mv ${ThisFile} ${ThisFile}.bak )
60 fi
61 }
62
63 # ********************************************************************************
64 SysWarnscip-shell shell shell-project 0.0.0 SysWarn().()
65 # ********************************************************************************
66 {
67 # Log an message string to the standard out and do NOT exit
68 echoscip-shell system . . echo. "$myname: *WARNING* : $1" 1>&2
69 }
70
71 # ********************************************************************************
72 SysErrorscip-shell shell shell-project 0.0.0 SysError().()
73 # ********************************************************************************
74 {
75 # Log an message string to the standard error and exit
76 echoscip-shell system . . echo. "$myname: *ERROR* : $1" 1>&2
77 exit 1
78 }
79
80 # ********************************************************************************
81 SignalCatcherscip-shell shell shell-project 0.0.0 SignalCatcher().()
82 # ********************************************************************************
83 {
84 # A generic signal handler for the shell script.
85 echoscip-shell system . . echo.
86 echoscip-shell system . . echo. "$myname: Got Signal $1"
87 exit 3
88 }
89
90 # ********************************************************************************
91 CleanUpscip-shell shell shell-project 0.0.0 CleanUp(). ()
92 # ********************************************************************************
93 {
94 echoscip-shell system . . echo. "$myname:Finished (total:$total, errors:$errors, cmpltd:$cmpltd, ignored:$ignored, counter:$counter )"
95 /bin/rmscip-shell filesystem . . `/bin/rm`. -f DUMMY_FILE $TempFile1 $TempFile2
96 }
97
98
99
100 # ********************************************************************************
101 # MAIN MAIN MAIN MAIN MAIN MAIN MAIN MAIN MAIN MAIN MAIN MAIN MAIN MAIN MAIN
102 # ********************************************************************************
103
104 myname=`basenamescip-shell system . . basename. $0`
105
106 debug=
107 verbose=
108 silent=
109 VerboseOpt="+x"
110 PrefixCmd=""
111 DryRunFlag=0
112
113 cmpltd=0
114 errors=0
115 total=0
116 ignored=0
117 counter=0
118
119
120 #
121 # Interpret the command line arguments (the GNU way!)
122 #
123 while [scip-shell system . . `[`. $# -gt 0 ]
124 do
125 #
126 # Interpret cli argument
127 #
128 case $1 in
129
130 # **** The standard CLI options begin here ****
131 -silent | -quiet | \
132 --silence | --silenc | --silenc | --silen | --sile | --sil | \
133 --quiet | --quie | --qui | --qu | --q | -q )
134 silent=yes
135 verbose=
136 VerboseOpt="+x"
137 ;;
138
139 -verbose | --verbose | --verbos | --verbo | --verb | \
140 --ver | --ve | --v | -v )
141 verbose=yes
142 VerboseOpt="-x"
143 ;;
144
145 --debug | --debu | --deb | -debug | -debu | -deb )
146 debug=yes
147 ;;
148
149 --dryrun | --dryru | --dryr | --dry | --dr | -dr | \
150 -dryrun | -dryru | -dryr | -dry | -dr | -dr )
151 PrefixCmd="echo =>"
152 DryRunFlag=1
153 ;;
154
155 --help | --hel | --he | --h | -help | -hel | -he | -h | \
156 --usage | --usag | --usa | --us | --u | \
157 -usage | -usag | -usa | -us | -u )
158 PrintUsagescip-shell shell shell-project 0.0.0 PrintUsage().
159 exit 0
160 ;;
161
162 --* | -*)
163 SysErrorscip-shell shell shell-project 0.0.0 SysError(). "unknown cli option: '$1'. Try '--help' for more info"
164 break;;
165
166 *) break;;
167
168 esac
169 shift
170 done
171
172 #
173 # Trap any signals
174 #
175 trap 'CleanUp "Cleaning"' 0
176 trap 'SignalCatcher "(SIGHUP)"' 1
177 trap 'SignalCatcher "(SIGINT)"' 2
178 trap 'SignalCatcher "(SIGQUIT)"' 3
179 trap 'SignalCatcher "(SIGTERM)"' 15
180
181 echoscip-shell system . . echo. "$myname: converting to JDK 1.1.7 and compatible Collections API"
182 JavaSourceFiles=`findscip-shell system . . find. . -name "*.java" -print`
183
184 # Create a `sed(1)' file to replace
185 SedFile=collections.sed
186 /bin/rmscip-shell filesystem . . `/bin/rm`. -f $SedFile
187
188 # List of Collections API
189 ReplaceClassList="
190 Collection
191 Comparable
192 Comparator
193 Iterator
194 List
195 ListIterator
196 Map
197 Set
198 SortedMap
199 SortedSet
200 AbstractCollection
201 AbstractList
202 AbstractMap
203 AbstractSequentialList
204 AbstractSet
205 ArrayList
206 Arrays
207 Collections
208 HashMap
209 HashSet
210 Hashtable
211 LinkedList
212 Random
213 SubList
214 TreeMap
215 TreeSet
216 Vector
217 ConcurrentModificationException
218 NoSuchElementException
219 UnsupportedOperationException"
220
221 # Create the sed script file
222 for Class in $ReplaceClassList
223 do
224 ## ============================================================
225 ## WARNING EMBEDDED TABS HERE!!!
226 ## ============================================================
227 echoscip-shell system . . echo. "s/ java.util.$Class/ com.sun.java.util.collections.$Class/g" >> $SedFile
228 echoscip-shell system . . echo. "s/ java.util.$Class/ com.sun.java.util.collections.$Class/g" >> $SedFile
229 ## ============================================================
230 ## added to convert ConcurrentModificationException,
231 ## NoSuchElementException and UnsupportedOperationException
232 ## MP20000326
233 ## ============================================================
234 echoscip-shell system . . echo. "s/ java.lang.$Class/ com.sun.java.util.collections.$Class/g" >> $SedFile
235 echoscip-shell system . . echo. "s/ java.lang.$Class/ com.sun.java.util.collections.$Class/g" >> $SedFile
236 done
237
238 # find all java source file and run sed script through them
239 for SrcFile in $JavaSourceFiles
240 do
241 let total=total+1
242 temp=`grepscip-shell system . . grep. "java.util." $SrcFile`
243 if [scip-shell system . . `[`. "x$temp" != "x" ]; then
244 echoscip-shell system . . echo. -n " [$counter] $SrcFile "
245
246 NewFile=${SrcFile}.new
247 BackFile=${SrcFile}.bak
248 [scip-shell system . . `[`. -f $NewFile ] && /bin/rmscip-shell filesystem . . `/bin/rm`. -f $NewFile
249 sedscip-shell system . . sed. -f $SedFile $SrcFile > $NewFile
250 status=$?
251 let counter=counter+1
252 if [scip-shell system . . `[`. $DryRunFlag -ne 0 ]; then
253 echoscip-shell system . . echo. "*DRYRUN*"
254 continue
255 fi
256 if [scip-shell system . . `[`. $status -eq 0 ]; then
257 # backup the original original
258 [scip-shell system . . `[`. -f $BackFile ] && /bin/rmscip-shell filesystem . . `/bin/rm`. -f $BackFile
259 mvscip-shell system . . mv. $SrcFile $BackFile; status=$?
260 if [scip-shell system . . `[`. $status -ne 0 ]; then
261 let errors=errors+1
262 echoscip-shell system . . echo. "*FAILED*"
263 SysErrorscip-shell shell shell-project 0.0.0 SysError(). "command failed mv $SrcFile $BackFile (status:$status)"
264 fi
265 # the output sed file becomes the new Java source file
266 mvscip-shell system . . mv. $NewFile $SrcFile; status=$?
267 if [scip-shell system . . `[`. $status -ne 0 ]; then
268 let errors=errors+1
269 echoscip-shell system . . echo. "*FAILED*"
270 SysErrorscip-shell shell shell-project 0.0.0 SysError(). "command failed mv $NewFile $SrcFile (status:$status)"
271 fi
272 let cmpltd=cmpltd+1
273 echoscip-shell system . . echo. "*DONE*"
274 else
275 let errors=errors+1
276 echoscip-shell system . . echo. "*FAILED*"
277 fi
278 ## echo "**** DEATH 69 ****"; exit 69
279 else
280 let ignored=ignored+1
281 fi
282
283 done
284
285 if [scip-shell system . . `[`. $DryRunFlag -ne 0 ]; then
286 echoscip-shell system . . echo. "*DRYRUN*"
287 continue
288 fi
289
290 if [scip-shell system . . `[`. $errors -eq 0 ]; then
291 catscip-shell system . . cat. <<XEOF
292 There were apparently no errors detected. It looks like the conversion
293 process worked. You should be able to compile again with JDK 1.1.7
294 BTW: You do have a backup of the ORIGINAL distribution. Dont you?
295 XEOF
296 fi
297
298 # fini