author | Stefan Vogel <sv@exept.de> |
Mon, 17 Dec 2001 17:28:49 +0100 | |
changeset 480 | c5c3ae2d0475 |
parent 399 | 5a842f5d7196 |
child 609 | f0f51d4a0066 |
permissions | -rw-r--r-- |
127 | 1 |
"/ |
2 |
"/ $Header$ |
|
3 |
"/ |
|
399 | 4 |
"/ MIMEType: application/x-smalltalk-source |
5 |
"/ |
|
209 | 6 |
"/ ST/X startup command file: |
7 |
"/ |
|
127 | 8 |
"/ bytecode compiler frontend for smalltalk |
161 | 9 |
"/ usage: stbc file.st |
127 | 10 |
"/ |
161 | 11 |
"/ creates file.cls, which can be binary loaded. |
12 |
"/ |
|
13 |
"/ Notice: |
|
14 |
"/ this is an experiment to provide a tool which looks like javac; |
|
15 |
"/ stbc is actually not used in the current system. |
|
16 |
"/ (the same functionality is provided by the browsers fileOut-binary function) |
|
17 |
"/ |
|
18 |
"/ By the way - this is an example for a headless application. |
|
127 | 19 |
|
20 |
"/ load the files, save binary versions |
|
21 |
||
381
45c00a5b27ab
allow reading of .st files without writing them (-r)
Stefan Vogel <sv@exept.de>
parents:
209
diff
changeset
|
22 |
|args readOnly| |
127 | 23 |
|
382 | 24 |
ObjectMemory infoPrinting: false. |
25 |
"/ObjectMemory debugPrinting: true. |
|
26 |
Object infoPrinting: false. |
|
27 |
Smalltalk silentLoading:true. |
|
28 |
||
161 | 29 |
Compiler stcCompilation:#never. |
387 | 30 |
Compiler warnSTXSpecials:false. |
31 |
Compiler warnings:false. |
|
127 | 32 |
|
480 | 33 |
[ |
34 |
readOnly := false. |
|
35 |
args := Smalltalk commandLineArguments. |
|
36 |
args do:[:arg | |
|
37 |
|inFile outFile baseName className class| |
|
38 |
||
39 |
arg = '-r' ifTrue:[ |
|
40 |
readOnly := true |
|
128 | 41 |
]. |
480 | 42 |
(arg startsWith:'-') ifFalse:[ |
43 |
inFile := arg asFilename. |
|
44 |
('stbc [info]: loading ' , inFile name , ' ...') errorPrintCR. |
|
45 |
Object errorSignal handle:[:ex | |
|
46 |
'stbc [error]: error while loading: ' errorPrint. ex errorString errorPrintCR. |
|
47 |
] do:[ |
|
48 |
Smalltalk fileIn:inFile name. |
|
49 |
]. |
|
50 |
('stbc [info]: loaded ' , inFile name) errorPrintCR. |
|
127 | 51 |
|
480 | 52 |
readOnly ifFalse:[ |
53 |
baseName := inFile withoutSuffix. |
|
54 |
className := baseName baseName. |
|
55 |
outFile := baseName withSuffix:'cls'. |
|
127 | 56 |
|
480 | 57 |
className := Smalltalk classNameForFile:className. |
58 |
class := Smalltalk classNamed:className. |
|
59 |
class notNil ifTrue:[ |
|
60 |
('stbc [info]: saving ' , class name , ' into ', outFile pathName, ' ...') errorPrintCR. |
|
61 |
class binaryFileOutWithSourceMode:#reference as:outFile. |
|
62 |
] ifFalse:[ |
|
63 |
('stbc [error]: no class for ' , className) errorPrintCR |
|
64 |
]. |
|
381
45c00a5b27ab
allow reading of .st files without writing them (-r)
Stefan Vogel <sv@exept.de>
parents:
209
diff
changeset
|
65 |
]. |
480 | 66 |
readOnly := false. |
67 |
] |
|
68 |
]. |
|
69 |
] on:UserInterruptSignal do:[:ex| |
|
70 |
('stbc [error]: aborted by user') errorPrintCR. |
|
71 |
Smalltalk exit. |
|
127 | 72 |
]. |
73 |
! |
|
480 | 74 |
('stbc [info]: done') errorPrintCR. |
127 | 75 |
Smalltalk exit. |
76 |
! |