27 Smalltalk silentLoading:true. |
27 Smalltalk silentLoading:true. |
28 |
28 |
29 Compiler stcCompilation:#never. |
29 Compiler stcCompilation:#never. |
30 Compiler warnSTXSpecials:false. |
30 Compiler warnSTXSpecials:false. |
31 Compiler warnings:false. |
31 Compiler warnings:false. |
32 Object userInterruptSignal handlerBlock:[:ex | Smalltalk exit]. |
|
33 |
32 |
34 readOnly := false. |
33 [ |
35 args := Smalltalk commandLineArguments. |
34 readOnly := false. |
36 args do:[:arg | |
35 args := Smalltalk commandLineArguments. |
37 |inFile outFile baseName className class| |
36 args do:[:arg | |
|
37 |inFile outFile baseName className class| |
38 |
38 |
39 arg = '-r' ifTrue:[ |
39 arg = '-r' ifTrue:[ |
40 readOnly := true |
40 readOnly := true |
|
41 ]. |
|
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. |
|
51 |
|
52 readOnly ifFalse:[ |
|
53 baseName := inFile withoutSuffix. |
|
54 className := baseName baseName. |
|
55 outFile := baseName withSuffix:'cls'. |
|
56 |
|
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 ]. |
|
65 ]. |
|
66 readOnly := false. |
|
67 ] |
41 ]. |
68 ]. |
42 (arg startsWith:'-') ifFalse:[ |
69 ] on:UserInterruptSignal do:[:ex| |
43 inFile := arg asFilename. |
70 ('stbc [error]: aborted by user') errorPrintCR. |
44 ('stbc [info]: loading ' , inFile name , ' ...') errorPrintCR. |
71 Smalltalk exit. |
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. |
|
51 |
|
52 readOnly ifFalse:[ |
|
53 baseName := inFile withoutSuffix. |
|
54 className := baseName baseName. |
|
55 outFile := baseName construct:'.cls'. |
|
56 |
|
57 className := Smalltalk classNameForFile:className. |
|
58 class := Smalltalk classNamed:className. |
|
59 class notNil ifTrue:[ |
|
60 ('stbc [info]: saving ' , class name , ' ...') errorPrintCR. |
|
61 class binaryFileOutWithSourceMode:#reference |
|
62 ] ifFalse:[ |
|
63 ('stbc [error]: no class for ' , className) errorPrintCR |
|
64 ]. |
|
65 ]. |
|
66 readOnly := false. |
|
67 ] |
|
68 ]. |
72 ]. |
69 ! |
73 ! |
70 |
74 ('stbc [info]: done') errorPrintCR. |
71 Smalltalk exit. |
75 Smalltalk exit. |
72 ! |
76 ! |