author | ca |
Mon, 14 Jun 2004 17:09:01 +0200 | |
changeset 8405 | 079fd61dc699 |
parent 8383 | dea5311899c5 |
child 8445 | b6c4e1aa13af |
permissions | -rw-r--r-- |
1 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1988 by Claus Gittinger |
7616 | 3 |
All Rights Reserved |
1 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
5363 | 13 |
"{ Package: 'stx:libbasic' }" |
14 |
||
1 | 15 |
Object subclass:#Smalltalk |
7616 | 16 |
instanceVariableNames:'' |
17 |
classVariableNames:'StartBlocks ImageStartBlocks ExitBlocks CachedClasses SystemPath |
|
18 |
StartupClass StartupSelector StartupArguments CommandLine |
|
19 |
CommandName CommandLineArguments CachedAbbreviations |
|
20 |
SilentLoading Initializing StandAlone HeadlessOperation |
|
21 |
DebuggingStandAlone LogDoits LoadBinaries RealSystemPath |
|
22 |
ResourcePath SourcePath BitmapPath BinaryPath FileInPath |
|
23 |
PackagePath BinaryDirName ResourceDirName SourceDirName |
|
24 |
BitmapDirName PackageDirName FileInDirName ChangeFileName |
|
25 |
ImageStartTime ImageRestartTime DemoMode SaveEmergencyImage |
|
26 |
SpecialObjectArray CallbackSignal KnownPackages |
|
27 |
ClassesFailedToInitialize' |
|
28 |
poolDictionaries:'' |
|
29 |
category:'System-Support' |
|
1 | 30 |
! |
31 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
32 |
!Smalltalk class methodsFor:'documentation'! |
70 | 33 |
|
617 | 34 |
copyright |
35 |
" |
|
36 |
COPYRIGHT (c) 1988 by Claus Gittinger |
|
7616 | 37 |
All Rights Reserved |
617 | 38 |
|
39 |
This software is furnished under a license and may be used |
|
40 |
only in accordance with the terms of that license and with the |
|
41 |
inclusion of the above copyright notice. This software may not |
|
42 |
be provided or otherwise made available to, or used by, any |
|
43 |
other person. No title to or ownership of the software is |
|
44 |
hereby transferred. |
|
45 |
" |
|
95 | 46 |
! |
47 |
||
70 | 48 |
documentation |
49 |
" |
|
50 |
This is one of the central classes in the system; |
|
51 |
it provides all system-startup, shutdown and maintenance support. |
|
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
52 |
Also global variables are (conceptionally) kept here. |
70 | 53 |
|
54 |
As you will notice, this is NOT a Dictionary |
|
3062
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
55 |
- my implementation of globals is totally different |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
56 |
due to the need to be able to access globals from c-code as well, |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
57 |
I do not use associations for globals, but instead keep the |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
58 |
name<->value relations in the VM and access globals via utility |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
59 |
functions found there. |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
60 |
|
70 | 61 |
However, it provides the known enumeration protocol. |
3062
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
62 |
It may change to become a subclass of collection at some time, |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
63 |
to inherit more collection stuff ... |
70 | 64 |
|
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
65 |
|
1286 | 66 |
[Instance variables:] |
7616 | 67 |
none - all handling is done in the VM |
1286 | 68 |
|
69 |
[Class variables:] |
|
70 |
||
7616 | 71 |
StartBlocks <Collection> blocks to be executed in a separate process after |
72 |
everything has been initialized. These blocks will |
|
73 |
be deleted after execution and therefore not be |
|
74 |
executed after an image restart. Initial processes |
|
75 |
(such as the Launcher) are usually started here. |
|
76 |
These blocks are added by smalltalk.rc/private.rc etc. |
|
77 |
via #addStartBlock during early initialization. |
|
78 |
||
79 |
ImageStartBlocks |
|
80 |
<Collection> blocks to be executed in a separate process after |
|
81 |
everything has been initialized. These blocks will be |
|
82 |
executed after an image restart. |
|
83 |
These blocks are usually added by smalltalk_r.rc etc. |
|
84 |
||
85 |
ExitBlocks <Collection> blocks to evaluate before system is |
|
86 |
left. Not currently used (GNU-ST compatibility). |
|
87 |
||
88 |
SystemPath <Collection> path to search for system files (sources, bitmaps etc) |
|
89 |
Set to a default here, but typically changed from some |
|
90 |
startup.rc file |
|
91 |
||
92 |
PackagePath <Collection> path to search for package. |
|
93 |
This is going to replace the above systemPath, and a classes |
|
94 |
resources will eventually searched in its package directory. |
|
95 |
This list defines the path, where packages are searched for, |
|
96 |
initially this is something like /opt/smalltalk/packages. |
|
97 |
Set to a default here, but typically changed from some |
|
98 |
startup.rc file |
|
99 |
||
100 |
StartupClass <Class> class and selector, where the system starts up |
|
101 |
StartupSelector <Symbol> (right after VM initialization) |
|
102 |
StartupArguments <Array> If an image is saved while those being nonNil, |
|
103 |
the image will come up there. |
|
104 |
Allows for customized images to be generated from a standard ST/X. |
|
105 |
StandAlone programs also set those during initialization. |
|
106 |
||
107 |
CommandLine <String> Unix (OS-) command line |
|
108 |
||
109 |
CommandName <String> the command (i.e. argv[0]) |
|
110 |
||
111 |
CommandLineArguments <Array> Unix (OS-) command line arguments broken into words |
|
112 |
CommandName has been stripped off. |
|
113 |
(initially set by the VM) |
|
114 |
||
115 |
SilentLoading <Boolean> suppresses messages during fileIn and in compiler |
|
116 |
(can be set to true from a customized main.c) |
|
117 |
||
118 |
Initializing <Boolean> true while (re-)initializing |
|
119 |
Controls the behavior of certain error |
|
120 |
reporters (for example: suppress dialogBoxes) |
|
121 |
while the system is not yet fit for full operation. |
|
122 |
||
123 |
StandAlone <Boolean> true, if this is a standalone app; |
|
124 |
if true the process scheduler watches for |
|
125 |
which processes are still running, and |
|
126 |
exits ST/X, when the last non-background |
|
127 |
and non-system process exits. |
|
128 |
Can be set in an application-specific startup script, |
|
129 |
or, for standAlone programs, by C-code during initialization. |
|
3062
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
130 |
|
7616 | 131 |
HeadlessOperation if true, a non-existing Display connection |
132 |
<Boolean> will NOT lead to an error-exit during startup. |
|
133 |
Default is false. |
|
134 |
Can be set in an application-specific startup script, |
|
135 |
or, for standAlone programs, by C-code during initialization. |
|
136 |
||
137 |
LogDoits <Boolean> if true, doits are also logged in the changes |
|
138 |
file. Default is false, since the changes file |
|
139 |
may become huge if every tiny doIt is saved there ... |
|
140 |
||
141 |
LoadBinaries <Boolean> if true, we attempt to load classes rom a binary |
|
142 |
file, if present. If false, this is always suppressed. |
|
143 |
||
144 |
SaveEmergencyImage <Boolean> if true (the default), an emergency image |
|
145 |
is saved, if the main Display looses its |
|
146 |
connection. This is useful if you have a |
|
147 |
flaky display connection (serial line) |
|
148 |
and want to have your stuff saved automatically |
|
149 |
in case of a broken connection. |
|
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
150 |
|
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
151 |
strictly private classVariables (helpers): |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
152 |
|
7616 | 153 |
CachedClasses <Collection> known classes (cached for faster class enumeration) |
154 |
||
155 |
CachedAbbreviations |
|
156 |
<Dictionary> className to filename mappings |
|
157 |
||
158 |
RealSystemPath <Collection> cached collection of directories along the path |
|
159 |
which really exist. Caching avoids long checks |
|
160 |
for existing directories on broken NFS volumes. |
|
161 |
||
162 |
SourcePath <Collection> cached names of really existing directories |
|
163 |
BitmapPath These are remembered, since in NFS systems, |
|
164 |
ResourcePath the time to lookup files may become long |
|
165 |
BinaryPath (especially, if some directories are on machines |
|
166 |
FileInPath which are not up ...). |
|
167 |
Therefore, the set of really |
|
168 |
existing directories is cached when the SystemPath |
|
169 |
is walked the first time. |
|
170 |
A consequence is that you have to invoke |
|
171 |
flushSystemPath, when you create any of those |
|
172 |
directories while running |
|
173 |
(and want the running ST/X to look there) |
|
3062
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
174 |
|
1286 | 175 |
|
176 |
[author:] |
|
7616 | 177 |
Claus Gittinger |
3062
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
178 |
|
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
179 |
[see also:] |
7616 | 180 |
ObjectMemory |
70 | 181 |
" |
1 | 182 |
! ! |
183 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
184 |
!Smalltalk class methodsFor:'initialization'! |
1 | 185 |
|
617 | 186 |
initGlobalsFromEnvironment |
187 |
"setup globals from the shell-environment" |
|
188 |
||
189 |
|envString i langString terrString| |
|
190 |
||
5406 | 191 |
StandAlone isNil ifTrue:[ |
7779
6d88d32bdd64
Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents:
7763
diff
changeset
|
192 |
StandAlone := false. |
5406 | 193 |
]. |
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
194 |
HeadlessOperation isNil ifTrue:[ |
7779
6d88d32bdd64
Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents:
7763
diff
changeset
|
195 |
HeadlessOperation := false. |
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
196 |
]. |
5406 | 197 |
|
617 | 198 |
" |
199 |
extract Language and LanguageTerritory from LANG variable. |
|
5846 | 200 |
valid are for example: |
7779
6d88d32bdd64
Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents:
7763
diff
changeset
|
201 |
en_en / en |
6d88d32bdd64
Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents:
7763
diff
changeset
|
202 |
en_us |
6d88d32bdd64
Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents:
7763
diff
changeset
|
203 |
en_gb |
6d88d32bdd64
Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents:
7763
diff
changeset
|
204 |
de_de / de |
6d88d32bdd64
Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents:
7763
diff
changeset
|
205 |
de_at (for Austria) |
5846 | 206 |
" |
207 |
||
208 |
Language := #en. |
|
994
6163ae7aaf9b
territory defaults to #us (instead of #usa)
Claus Gittinger <cg@exept.de>
parents:
977
diff
changeset
|
209 |
LanguageTerritory := #us. |
617 | 210 |
|
5846 | 211 |
|
212 |
"Format of LANG is: language[_territory][.codeset][@modifier] |
|
7779
6d88d32bdd64
Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents:
7763
diff
changeset
|
213 |
language ISO-639 Language code |
6d88d32bdd64
Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents:
7763
diff
changeset
|
214 |
territory ISO-3166 Contry code" |
6d88d32bdd64
Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents:
7763
diff
changeset
|
215 |
|
6d88d32bdd64
Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents:
7763
diff
changeset
|
216 |
envString := OperatingSystem getLanguage. |
3991
7b53bc45bf91
(isNil or:[isEmpty ]) -> (size == 0)
Claus Gittinger <cg@exept.de>
parents:
3988
diff
changeset
|
217 |
envString size > 0 ifTrue:[ |
7779
6d88d32bdd64
Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents:
7763
diff
changeset
|
218 |
i := envString indexOf:$@. |
6d88d32bdd64
Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents:
7763
diff
changeset
|
219 |
(i ~~ 0) ifTrue:[ |
6d88d32bdd64
Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents:
7763
diff
changeset
|
220 |
envString := envString copyTo:(i - 1). |
6d88d32bdd64
Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents:
7763
diff
changeset
|
221 |
LanguageModifier := (envString copyFrom:(i + 1)) asLowercase asSymbol. |
6d88d32bdd64
Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents:
7763
diff
changeset
|
222 |
] ifFalse:[ |
6d88d32bdd64
Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents:
7763
diff
changeset
|
223 |
LanguageModifier := nil. |
6d88d32bdd64
Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents:
7763
diff
changeset
|
224 |
]. |
6d88d32bdd64
Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents:
7763
diff
changeset
|
225 |
i := envString indexOf:$.. |
6d88d32bdd64
Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents:
7763
diff
changeset
|
226 |
(i ~~ 0) ifTrue:[ |
6d88d32bdd64
Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents:
7763
diff
changeset
|
227 |
envString := envString copyTo:(i - 1). |
6d88d32bdd64
Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents:
7763
diff
changeset
|
228 |
LanguageCodeset := (envString copyFrom:(i + 1)) asLowercase asSymbol |
6d88d32bdd64
Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents:
7763
diff
changeset
|
229 |
] ifFalse:[ |
6d88d32bdd64
Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents:
7763
diff
changeset
|
230 |
LanguageCodeset := #'iso8859-1'. |
6d88d32bdd64
Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents:
7763
diff
changeset
|
231 |
]. |
6d88d32bdd64
Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents:
7763
diff
changeset
|
232 |
i := envString indexOf:$_. |
6d88d32bdd64
Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents:
7763
diff
changeset
|
233 |
(i == 0) ifTrue:[ |
6d88d32bdd64
Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents:
7763
diff
changeset
|
234 |
langString := envString. |
6d88d32bdd64
Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents:
7763
diff
changeset
|
235 |
terrString := envString |
6d88d32bdd64
Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents:
7763
diff
changeset
|
236 |
] ifFalse:[ |
6d88d32bdd64
Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents:
7763
diff
changeset
|
237 |
langString := envString copyTo:(i - 1). |
6d88d32bdd64
Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents:
7763
diff
changeset
|
238 |
terrString := envString copyFrom:(i + 1) |
6d88d32bdd64
Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents:
7763
diff
changeset
|
239 |
]. |
6d88d32bdd64
Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents:
7763
diff
changeset
|
240 |
Language := langString asLowercase asSymbol. |
6d88d32bdd64
Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents:
7763
diff
changeset
|
241 |
LanguageTerritory := terrString asLowercase asSymbol |
617 | 242 |
]. |
243 |
||
244 |
" |
|
245 |
Smalltalk initGlobalsFromEnvironment |
|
246 |
" |
|
994
6163ae7aaf9b
territory defaults to #us (instead of #usa)
Claus Gittinger <cg@exept.de>
parents:
977
diff
changeset
|
247 |
|
6163ae7aaf9b
territory defaults to #us (instead of #usa)
Claus Gittinger <cg@exept.de>
parents:
977
diff
changeset
|
248 |
"Modified: 22.2.1996 / 16:59:12 / cg" |
617 | 249 |
! |
250 |
||
251 |
initInterrupts |
|
252 |
"initialize interrupts" |
|
253 |
||
254 |
OperatingSystem enableUserInterrupts. |
|
255 |
OperatingSystem enableHardSignalInterrupts. |
|
6390
41d5c47c33f0
Catch sigPWR and sigHUP on restart
Stefan Vogel <sv@exept.de>
parents:
6366
diff
changeset
|
256 |
OperatingSystem enableCrashSignalInterrupts. |
617 | 257 |
|
258 |
ObjectMemory userInterruptHandler:self. |
|
259 |
ObjectMemory signalInterruptHandler:self. |
|
260 |
ObjectMemory recursionInterruptHandler:self. |
|
261 |
||
963
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
262 |
" |
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
263 |
Smalltalk initInterrupts |
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
264 |
" |
2873
5bc8c81c4a34
Catch fpExeceptionInterrupt after image restart.
Stefan Vogel <sv@exept.de>
parents:
2844
diff
changeset
|
265 |
|
5bc8c81c4a34
Catch fpExeceptionInterrupt after image restart.
Stefan Vogel <sv@exept.de>
parents:
2844
diff
changeset
|
266 |
"Modified: 20.8.1997 / 09:35:49 / stefan" |
617 | 267 |
! |
268 |
||
269 |
initStandardStreams |
|
270 |
"initialize some well-known streams" |
|
271 |
||
272 |
Stdout := NonPositionableExternalStream forStdout. |
|
273 |
Stderr := NonPositionableExternalStream forStderr. |
|
274 |
Stdin := NonPositionableExternalStream forStdin. |
|
275 |
Printer := PrinterStream. |
|
276 |
Transcript := Stderr |
|
277 |
||
963
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
278 |
" |
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
279 |
Smalltalk initStandardStreams |
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
280 |
" |
617 | 281 |
! |
282 |
||
283 |
initStandardTools |
|
284 |
"predefine some tools which we will need later |
|
285 |
- if the view-classes exist, |
|
286 |
they will redefine Inspector and Debugger for graphical interfaces" |
|
287 |
||
288 |
"redefine debug-tools, if view-classes exist" |
|
289 |
||
290 |
Display notNil ifTrue:[ |
|
7616 | 291 |
InspectorView notNil ifTrue:[ |
292 |
Inspector := InspectorView |
|
293 |
]. |
|
294 |
DebugView notNil ifTrue:[ |
|
295 |
Debugger := DebugView |
|
296 |
]. |
|
297 |
Display initialize |
|
617 | 298 |
] |
963
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
299 |
|
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
300 |
" |
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
301 |
Smalltalk initStandardTools |
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
302 |
" |
617 | 303 |
! |
304 |
||
305 |
initSystemPath |
|
306 |
"setup path where system files are searched for. |
|
307 |
the default path is set to: |
|
7616 | 308 |
. |
309 |
$HOME (if defined) |
|
310 |
$HOME/.smalltalk (if defined & existing) |
|
311 |
$SMALLTALK_LIBDIR (if defined & existing) |
|
312 |
$STX_LIBDIR (if defined & existing) |
|
313 |
$STX_TOPDIR (if defined & existing) |
|
4001
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
314 |
|
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
315 |
unix: |
7616 | 316 |
/opt/smalltalk (if existing) |
317 |
/opt/smalltalk/release (if existing) |
|
318 |
/usr/local/lib/smalltalk (if existing) |
|
319 |
/usr/lib/smalltalk (if existing) |
|
320 |
/lib/smalltalk (if existing) |
|
4001
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
321 |
|
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
322 |
win32: |
7616 | 323 |
\smalltalk (if existing) |
324 |
\programs\smalltalk (if existing) |
|
325 |
\programs\exept\smalltalk (if existing) |
|
326 |
registry info (if present) |
|
4001
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
327 |
|
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
328 |
vms: |
7616 | 329 |
$stx:lib (if existing) |
330 |
$stx:root (if existing) |
|
617 | 331 |
|
332 |
of course, it is possible to add entries from the 'smalltalk.rc' |
|
333 |
startup file; add expressions such as: |
|
7616 | 334 |
Smalltalk systemPath addFirst:'/foo/bar/baz'. |
335 |
or: |
|
336 |
Smalltalk systemPath addLast:'/fee/foe/foo'. |
|
4001
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
337 |
|
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
338 |
However, smalltalk.rc itself must be found along the above path. |
617 | 339 |
" |
340 |
||
2928 | 341 |
ChangeFileName := 'changes'. |
342 |
OperatingSystem isVMSlike ifTrue:[ |
|
7616 | 343 |
BitmapDirName := 'bitmaps.dir'. |
344 |
BinaryDirName := 'binary.dir'. |
|
345 |
SourceDirName := 'source.dir'. |
|
346 |
ResourceDirName := 'resources.dir'. |
|
347 |
FileInDirName := 'filein.dir'. |
|
348 |
PackageDirName := 'packages.dir'. |
|
2928 | 349 |
] ifFalse:[ |
7616 | 350 |
BitmapDirName := 'bitmaps'. |
351 |
BinaryDirName := 'binary'. |
|
352 |
SourceDirName := 'source'. |
|
353 |
ResourceDirName := 'resources'. |
|
354 |
FileInDirName := 'fileIn'. |
|
355 |
PackageDirName := 'packages'. |
|
2928 | 356 |
]. |
357 |
||
680 | 358 |
SystemPath isNil ifTrue:[ |
7616 | 359 |
SystemPath := OperatingSystem defaultSystemPath. |
360 |
self flushPathCaches |
|
5139 | 361 |
]. |
362 |
||
5144 | 363 |
PackagePath isNil ifTrue:[ |
7616 | 364 |
PackagePath := OperatingSystem defaultPackagePath. |
5144 | 365 |
]. |
617 | 366 |
|
367 |
" |
|
368 |
Smalltalk initSystemPath |
|
369 |
Smalltalk systemPath |
|
370 |
" |
|
5139 | 371 |
|
5145 | 372 |
"Modified: / 24.12.1999 / 00:23:35 / cg" |
617 | 373 |
! |
374 |
||
375 |
initUserPreferences |
|
376 |
"setup other stuff" |
|
377 |
||
378 |
LogDoits := false. |
|
379 |
LoadBinaries := false. |
|
6854 | 380 |
SaveEmergencyImage := (StandAlone ~~ true). |
3062
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
381 |
|
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
382 |
"Modified: / 24.10.1997 / 18:22:47 / cg" |
617 | 383 |
! |
384 |
||
7526 | 385 |
initializeClass:aClass |
386 |
"sent from VM via #initializeModules" |
|
387 |
||
7527 | 388 |
Error handle:[:ex | |
7616 | 389 |
ClassesFailedToInitialize isNil ifTrue:[ |
390 |
ClassesFailedToInitialize := IdentitySet new. |
|
391 |
]. |
|
392 |
ClassesFailedToInitialize add:aClass. |
|
393 |
('Smalltalk [warning]: error during initialize of ' , aClass name,': ', ex description printString) errorPrintCR. |
|
394 |
(Smalltalk commandLineArguments includes:'--debug') ifTrue:[ |
|
395 |
ex reject |
|
396 |
]. |
|
7527 | 397 |
] do:[ |
7616 | 398 |
aClass initialize |
7530 | 399 |
]. |
7526 | 400 |
! |
401 |
||
7563 | 402 |
initializeModules |
403 |
"perform module specific initialization and |
|
404 |
send #initialize to all classes. |
|
617 | 405 |
Notice: this is not called when an image is restarted" |
4963 | 406 |
|
7527 | 407 |
self initializeModulesOnce. |
408 |
ClassesFailedToInitialize size > 0 ifTrue:[ |
|
7616 | 409 |
('Smalltalk [info]: retry initialization of failed class(es)...') infoPrintCR. |
410 |
ClassesFailedToInitialize := nil. |
|
411 |
self initializeModulesOnce. |
|
412 |
ClassesFailedToInitialize size > 0 ifTrue:[ |
|
413 |
('Smalltalk [error]: class(es) persist to fail during initialize') errorPrintCR. |
|
414 |
] |
|
7527 | 415 |
]. |
416 |
! |
|
417 |
||
7563 | 418 |
initializeModulesOnce |
419 |
"perform module specific initialization and |
|
420 |
send #initialize to all classes. |
|
7527 | 421 |
Notice: this is not called when an image is restarted" |
4963 | 422 |
|
617 | 423 |
%{ |
1688
8a42db1eea60
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1682
diff
changeset
|
424 |
__init_registered_modules__(3); |
4963 | 425 |
|
1481 | 426 |
@global(DemoMode) = __getDemoMode() ? true : false; |
5410 | 427 |
RETURN (self); |
428 |
%}. |
|
429 |
^ self primitiveFailed |
|
617 | 430 |
! |
431 |
||
7563 | 432 |
initializeSystem |
433 |
"initialize all other classes; setup dispatcher processes etc. |
|
3499 | 434 |
This one is the very first entry into the smalltalk world, |
435 |
right after startup, ususally immediately followed by Smalltalk>>start. |
|
2090
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
436 |
Notice: |
8251
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
437 |
this is not called when an image is restarted; in this |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
438 |
case the show starts in Smalltalk>>restart." |
211 | 439 |
|
6841
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
440 |
|idx| |
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
441 |
|
3499 | 442 |
Initializing := true. |
6841
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
443 |
|
3499 | 444 |
AbstractOperatingSystem initializeConcreteClass. |
445 |
||
5400 | 446 |
CommandLineArguments isNil ifTrue:[ |
8251
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
447 |
CommandLineArguments := #('stx'). |
5400 | 448 |
]. |
4006
c7ad38c52eb9
must set CommandLineArguments earlier (to be available in initializeSystem)
Claus Gittinger <cg@exept.de>
parents:
4001
diff
changeset
|
449 |
CommandLine := CommandLineArguments copy. |
c7ad38c52eb9
must set CommandLineArguments earlier (to be available in initializeSystem)
Claus Gittinger <cg@exept.de>
parents:
4001
diff
changeset
|
450 |
CommandLineArguments := CommandLineArguments asOrderedCollection. |
6842 | 451 |
CommandName := CommandLineArguments removeFirst. "/ the command |
4006
c7ad38c52eb9
must set CommandLineArguments earlier (to be available in initializeSystem)
Claus Gittinger <cg@exept.de>
parents:
4001
diff
changeset
|
452 |
|
4028
b46539f16af5
added --silentStartup argument
Claus Gittinger <cg@exept.de>
parents:
4026
diff
changeset
|
453 |
SilentLoading := (CommandLineArguments includes:'--silentStartup'). |
348 | 454 |
|
6841
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
455 |
DebuggingStandAlone := false. |
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
456 |
|
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
457 |
StandAlone ifTrue:[ |
8251
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
458 |
InfoPrinting := false. |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
459 |
ObjectMemory infoPrinting:false. |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
460 |
|
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
461 |
idx := CommandLineArguments indexOf:'--debug'. |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
462 |
idx ~~ 0 ifTrue:[ |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
463 |
DebuggingStandAlone := true. |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
464 |
]. |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
465 |
DebuggingStandAlone ifTrue:[ |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
466 |
Inspector := MiniInspector. |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
467 |
Debugger := MiniDebugger. |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
468 |
]. |
6841
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
469 |
] ifFalse:[ |
8251
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
470 |
"/ |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
471 |
"/ define low-level debugging tools - graphical classes are not prepared yet |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
472 |
"/ to handle things. |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
473 |
"/ This will bring us into the MiniDebugger when an error occurs during startup. |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
474 |
"/ |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
475 |
Inspector := MiniInspector. |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
476 |
Debugger := MiniDebugger. |
6841
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
477 |
]. |
1 | 478 |
|
2090
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
479 |
"/ |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
480 |
"/ start catching SIGSEGV and SIGBUS |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
481 |
"/ |
713
32540afb8ffc
setup SIGSEGV/SIGBUS handling early - to catch those during startup
Claus Gittinger <cg@exept.de>
parents:
706
diff
changeset
|
482 |
OperatingSystem enableHardSignalInterrupts. |
32540afb8ffc
setup SIGSEGV/SIGBUS handling early - to catch those during startup
Claus Gittinger <cg@exept.de>
parents:
706
diff
changeset
|
483 |
|
1 | 484 |
self initGlobalsFromEnvironment. |
485 |
||
2090
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
486 |
"/ |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
487 |
"/ sorry - there are some, which MUST be initialized before .. |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
488 |
"/ reason: if any error happens during init, we need Signals, Stdout etc. to be there |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
489 |
"/ |
1 | 490 |
Object initialize. |
7704 | 491 |
Stream initialize. |
492 |
PositionableStream initialize. |
|
2907 | 493 |
Filename initialize. |
326 | 494 |
ObjectMemory initialize. |
2504
ece15ffbcb69
Initialize OperatingSystem early (needed for some signals).
Stefan Vogel <sv@exept.de>
parents:
2485
diff
changeset
|
495 |
OperatingSystem initialize. |
1 | 496 |
ExternalStream initialize. |
211 | 497 |
|
498 |
self initStandardStreams. "/ setup Stdin, Stdout etc. |
|
1 | 499 |
|
2090
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
500 |
"/ |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
501 |
"/ sorry, path must be set before ... |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
502 |
"/ reason: some classes need it during initialize (they might need resources, bitmaps etc) |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
503 |
"/ |
1 | 504 |
self initSystemPath. |
505 |
||
506 |
Compiler := ByteCodeCompiler. |
|
507 |
Compiler isNil ifTrue:[ |
|
8251
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
508 |
" |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
509 |
ByteCodeCompiler is not in the system (i.e. has not been linked in) |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
510 |
this allows at least immediate evaluations for runtime systems without compiler |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
511 |
NOTICE: a parser is always needed, otherwise we cannot read resource files etc. |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
512 |
" |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
513 |
Compiler := Parser |
1 | 514 |
]. |
515 |
||
2090
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
516 |
"/ |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
517 |
"/ another one, to be initialized before others |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
518 |
"/ |
2077
6b5dc412dd15
must initialize Processor before doing modulInits
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
519 |
ProcessorScheduler initialize. |
6b5dc412dd15
must initialize Processor before doing modulInits
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
520 |
|
2090
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
521 |
"/ |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
522 |
"/ now, finally, initialize all other classes |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
523 |
"/ |
325 | 524 |
self initializeModules. |
525 |
||
8251
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
526 |
ImageStartTime := Timestamp now. |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
527 |
|
70 | 528 |
self initInterrupts. |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
529 |
self initUserPreferences. |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
530 |
|
2090
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
531 |
"/ |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
532 |
"/ give classes a chance to perform 2nd-level initialization |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
533 |
"/ now, we are certain, that all other classes have been initialized |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
534 |
"/ (especially: streams and signals can now be used) |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
535 |
"/ |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
536 |
ObjectMemory changed:#initialized. |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
537 |
|
2504
ece15ffbcb69
Initialize OperatingSystem early (needed for some signals).
Stefan Vogel <sv@exept.de>
parents:
2485
diff
changeset
|
538 |
"Modified: 8.1.1997 / 19:58:12 / stefan" |
2907 | 539 |
"Modified: 7.9.1997 / 23:34:44 / cg" |
325 | 540 |
! |
1 | 541 |
|
7563 | 542 |
isInitialized |
543 |
"this returns true, if the system is properly initialized; |
|
544 |
i.e. false during startup. Especially, the whole viewing stuff is |
|
617 | 545 |
not working correctly until initialized." |
546 |
||
547 |
^ Initializing not |
|
1 | 548 |
! |
549 |
||
7563 | 550 |
reinitStandardStreams |
551 |
"reinitialize some well-known streams. |
|
552 |
Tis must be done very early during startup, to allow for |
|
477
8710aba7876b
oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents:
457
diff
changeset
|
553 |
debug and trace messages to be output |
8710aba7876b
oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents:
457
diff
changeset
|
554 |
(otherwise, the file-descriptors are invalid)" |
8710aba7876b
oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents:
457
diff
changeset
|
555 |
|
8710aba7876b
oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents:
457
diff
changeset
|
556 |
Stdout reOpen. Stderr reOpen. Stdin reOpen. |
161 | 557 |
! ! |
558 |
||
7295 | 559 |
!Smalltalk class methodsFor:'Compatibility-Squeak'! |
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
560 |
|
7563 | 561 |
beep |
562 |
Screen current beep |
|
563 |
! |
|
564 |
||
565 |
garbageCollect |
|
566 |
ObjectMemory garbageCollect |
|
567 |
! |
|
568 |
||
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
569 |
garbageCollectMost |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
570 |
"collect recently created garbage; return the amount of freeSpace. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
571 |
In ST/X, only the newSpace is collected here, and the sum of |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
572 |
newSpace + freeListSpace is returned." |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
573 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
574 |
ObjectMemory scavenge. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
575 |
^ ObjectMemory freeSpace |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
576 |
+ (ObjectMemory newSpaceSize - ObjectMemory newSpaceUsed) |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
577 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
578 |
! |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
579 |
|
7563 | 580 |
isMorphic |
581 |
^ false |
|
582 |
! |
|
583 |
||
584 |
registerExternalObject: anObject |
|
585 |
"Register the given object in the external objects array and return its index. |
|
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
586 |
If it is already there, just return its index. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
587 |
ExternalObjects are protected from GC and can be accessed easily from |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
588 |
primitive code (via the global Smalltalk:SpecialObjectArray)" |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
589 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
590 |
| objects firstEmptyIndex obj sz newObjects | |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
591 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
592 |
objects := SpecialObjectArray. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
593 |
objects isNil ifTrue:[ |
7616 | 594 |
objects := Array new:5. |
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
595 |
]. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
596 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
597 |
"find the first empty slot and look if already registered" |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
598 |
firstEmptyIndex := 0. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
599 |
1 to: objects size do: [:i | |
7616 | 600 |
obj := objects at: i. |
601 |
obj == anObject ifTrue: [^ i]. "object already there, just return its index" |
|
602 |
(obj == nil and: [firstEmptyIndex = 0]) ifTrue: [ |
|
603 |
firstEmptyIndex := i |
|
604 |
] |
|
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
605 |
]. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
606 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
607 |
"if no empty slots, expand the array" |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
608 |
firstEmptyIndex = 0 ifTrue: [ |
7616 | 609 |
sz := objects size. |
610 |
newObjects := objects species new: sz + 20. "grow linearly" |
|
611 |
newObjects replaceFrom: 1 to: sz with: objects startingAt: 1. |
|
612 |
firstEmptyIndex := sz + 1. |
|
613 |
SpecialObjectArray := newObjects. |
|
614 |
objects := newObjects |
|
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
615 |
]. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
616 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
617 |
objects at: firstEmptyIndex put: anObject. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
618 |
^ firstEmptyIndex |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
619 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
620 |
! |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
621 |
|
8278 | 622 |
renameClassNamed:oldName as:newName |
623 |
self renameClass:(self at:oldName) to:newName |
|
624 |
! |
|
625 |
||
7563 | 626 |
unregisterExternalObject: anObject |
627 |
"Unregister the given object in the external objects array. |
|
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
628 |
Do nothing if it isn't registered." |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
629 |
|
5913 | 630 |
|objects| |
631 |
||
632 |
anObject isNil ifTrue:[^ self]. |
|
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
633 |
objects := SpecialObjectArray. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
634 |
1 to: objects size do: [:i | |
7616 | 635 |
(objects at: i) == anObject ifTrue: [ |
636 |
objects at: i put: nil |
|
637 |
] |
|
5913 | 638 |
]. |
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
639 |
! ! |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
640 |
|
7295 | 641 |
!Smalltalk class methodsFor:'Compatibility-V''Age'! |
6722
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
642 |
|
7563 | 643 |
allClassesImplementing:aSelector |
644 |
^ self allClasses select:[:cls | cls implements:aSelector]. |
|
6722
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
645 |
! ! |
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
646 |
|
7295 | 647 |
!Smalltalk class methodsFor:'Compatibility-VW5.4'! |
6094
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
648 |
|
7563 | 649 |
defineClass:nameSymbol superclass:superclass indexedType:indexed private:private instanceVariableNames:instVars classInstanceVariableNames:classInstVars imports:imports category:category attributes:annotations |
6094
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
650 |
|newClass| |
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
651 |
|
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
652 |
indexed == #none ifTrue:[ |
7616 | 653 |
newClass := superclass |
654 |
subclass:nameSymbol |
|
655 |
instanceVariableNames:instVars |
|
656 |
classVariableNames:'' |
|
657 |
poolDictionaries:'' |
|
658 |
category:category |
|
659 |
inEnvironment:self. |
|
660 |
classInstVars size > 0 ifTrue:[ |
|
661 |
newClass class instanceVariableNames:classInstVars. |
|
662 |
]. |
|
663 |
^ newClass |
|
6851 | 664 |
]. |
665 |
self shouldImplement. |
|
6094
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
666 |
! ! |
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
667 |
|
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
668 |
!Smalltalk class methodsFor:'accessing'! |
453 | 669 |
|
7563 | 670 |
associationAt:aKey |
671 |
"return a key-value association for aKey. |
|
672 |
Since ST/X's Smalltalk as no real dictionary, this is |
|
3083 | 673 |
simulated here." |
674 |
||
675 |
|val| |
|
676 |
||
677 |
val := self at:aKey ifAbsent:nil. |
|
678 |
val isNil ifTrue:[^ nil]. |
|
679 |
^ Association key:aKey value:val |
|
680 |
||
681 |
"Created: / 1.11.1997 / 13:27:20 / cg" |
|
682 |
! |
|
683 |
||
7563 | 684 |
associationAt:aKey ifAbsent:exceptionBlock |
685 |
"return a key-value association for aKey, or the value |
|
3610
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
686 |
from exceptionBlock, if no such key is present. |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
687 |
Since ST/X's Smalltalk as no real dictionary, this is |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
688 |
simulated here." |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
689 |
|
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
690 |
|val| |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
691 |
|
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
692 |
val := self at:aKey ifAbsent:nil. |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
693 |
val isNil ifTrue:[^ exceptionBlock value]. |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
694 |
^ Association key:aKey value:val |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
695 |
|
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
696 |
"Created: / 18.6.1998 / 17:05:24 / cg" |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
697 |
! |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
698 |
|
7563 | 699 |
at:aKey |
700 |
"retrieve the value stored under aKey, a symbol. |
|
701 |
Return nil if not present |
|
1956 | 702 |
(this will be changed to trigger an error - better use #at:ifAbsent:)" |
453 | 703 |
|
6851 | 704 |
aKey class == String ifTrue:[self error:'expected symbol']. |
6080
15ea3cbf6003
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
6074
diff
changeset
|
705 |
|
453 | 706 |
%{ /* NOCONTEXT */ |
707 |
RETURN ( __GLOBAL_GET(aKey) ); |
|
5406 | 708 |
%}. |
5410 | 709 |
^ self primitiveFailed |
453 | 710 |
! |
711 |
||
7563 | 712 |
at:aKey ifAbsent:aBlock |
713 |
"retrieve the value stored at aKey. |
|
7565 | 714 |
If there is nothing stored under this key, return the value of |
715 |
the evaluation of aBlock." |
|
453 | 716 |
|
717 |
(self includesKey:aKey) ifTrue:[ |
|
7616 | 718 |
^ self at:aKey |
453 | 719 |
]. |
720 |
^ aBlock value |
|
721 |
||
722 |
" |
|
723 |
Smalltalk at:#fooBar <- returns nil |
|
724 |
Smalltalk at:#fooBar ifAbsent:['sorry'] <- no error |
|
725 |
" |
|
726 |
! |
|
727 |
||
7563 | 728 |
at:aKey ifPresent:aBlock |
729 |
"try to retrieve the value stored at aKey. |
|
730 |
If there is nothing stored under this key, do nothing. |
|
4870 | 731 |
Otherwise, evaluate aBlock, passing the retrieved value as argument." |
732 |
||
733 |
(self includesKey:aKey) ifTrue:[ |
|
7616 | 734 |
^ aBlock value:(self at:aKey) |
4870 | 735 |
]. |
736 |
^ nil |
|
737 |
||
738 |
" |
|
739 |
Smalltalk at:#fooBar ifPresent:[:what | Transcript showCR:what]. |
|
740 |
Smalltalk at:#Object ifPresent:[:what | Transcript showCR:what]. |
|
741 |
" |
|
742 |
||
743 |
! |
|
744 |
||
7563 | 745 |
at:aKey put:aValue |
746 |
"store the argument aValue under aKey, a symbol. |
|
747 |
Return aValue (sigh)." |
|
453 | 748 |
|
749 |
|oldValue| |
|
750 |
||
751 |
%{ |
|
752 |
oldValue = __GLOBAL_SET(aKey, aValue, (OBJ *)0); |
|
753 |
%}. |
|
754 |
CachedClasses notNil ifTrue:[ |
|
7616 | 755 |
oldValue isBehavior ifTrue:[ |
756 |
oldValue name == aKey ifTrue:[ |
|
757 |
CachedClasses remove:oldValue ifAbsent:[] |
|
758 |
] |
|
759 |
]. |
|
760 |
aValue isBehavior ifTrue:[ |
|
1956 | 761 |
"/ aValue isMeta ifTrue:[ |
762 |
"/ "/ this should not happen |
|
763 |
"/ ('SMALLTALK: store a Metaclass: ' , aValue name , ' as ' , aKey) infoPrintCR. |
|
764 |
"/ ]. |
|
765 |
||
7616 | 766 |
aValue name == aKey ifTrue:[ |
767 |
CachedClasses add:aValue |
|
768 |
] ifFalse:[ |
|
769 |
CachedClasses := nil |
|
770 |
] |
|
771 |
]. |
|
453 | 772 |
]. |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
773 |
^ aValue. |
1955 | 774 |
"/ |
775 |
"/%{ /* NOCONTEXT */ |
|
776 |
"/ (void) __GLOBAL_SET(aKey, aValue, (OBJ *)0); |
|
777 |
"/%}. |
|
778 |
"/ CachedClasses := nil. |
|
779 |
"/ ^ aValue |
|
1222 | 780 |
|
781 |
"Modified: 19.4.1996 / 11:31:49 / cg" |
|
453 | 782 |
! |
783 |
||
7563 | 784 |
includesKey:aKey |
785 |
"return true, if the key is known" |
|
786 |
||
787 |
"/ for debugging - this is a common mistake, |
|
6231 | 788 |
"/ to try to access a class by nameString, instead |
789 |
"/ of by symbol. |
|
790 |
||
791 |
"/ aKey class == String ifTrue:[self halt]. |
|
4391 | 792 |
|
453 | 793 |
%{ /* NOCONTEXT */ |
617 | 794 |
RETURN ( __GLOBAL_KEYKNOWN(aKey) ); |
5410 | 795 |
%}. |
796 |
^ self primitiveFailed |
|
453 | 797 |
! |
798 |
||
7563 | 799 |
keyAtValue:anObject |
800 |
"return the symbol under which anObject is stored - or nil" |
|
453 | 801 |
|
802 |
self keysDo:[:aKey | |
|
7616 | 803 |
(self at:aKey) == anObject ifTrue:[^ aKey] |
453 | 804 |
]. |
805 |
^ nil |
|
806 |
||
807 |
"Smalltalk keyAtValue:Object" |
|
808 |
! |
|
809 |
||
7563 | 810 |
keys |
811 |
"return a collection with all keys in the Smalltalk dictionary" |
|
812 |
||
813 |
|keys| |
|
453 | 814 |
|
815 |
keys := IdentitySet new. |
|
816 |
self keysDo:[:k | keys add:k]. |
|
817 |
^ keys |
|
617 | 818 |
! |
819 |
||
7563 | 820 |
removeKey:aKey |
821 |
"remove the association stored under the key-argument from the globals dictionary. |
|
878
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
822 |
WARNING: |
7616 | 823 |
this is somewhat dangerous: conceptionally, the association is removed, |
824 |
to which machine & byte compiled code refers if it accesses a global. |
|
825 |
If there are still global accesses in some literalArray or from machine-compiled code, |
|
826 |
it continues to reference the globals value via that obsolete association and gets a nil |
|
827 |
value. (which is correct) |
|
828 |
However, if that global is later reintroduced, a new association will be created and |
|
829 |
the new global now referenced via the new association. |
|
830 |
The old accesses will still see nil, although the globals value is actually non-nil |
|
831 |
(this is questionable). |
|
832 |
To avoid this problem, the #removeClass: method never removed the key." |
|
617 | 833 |
|
834 |
CachedClasses := nil. |
|
835 |
||
836 |
%{ /* NOCONTEXT */ |
|
837 |
RETURN ( __GLOBAL_REMOVE(aKey) ); |
|
5410 | 838 |
%}. |
839 |
^ self primitiveFailed |
|
840 |
||
2705
ed04a67da248
added #values for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
2681
diff
changeset
|
841 |
! |
ed04a67da248
added #values for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
2681
diff
changeset
|
842 |
|
7563 | 843 |
values |
844 |
"return a collection with all values in the Smalltalk dictionary" |
|
845 |
||
846 |
|values| |
|
2705
ed04a67da248
added #values for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
2681
diff
changeset
|
847 |
|
ed04a67da248
added #values for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
2681
diff
changeset
|
848 |
values := OrderedCollection new. |
ed04a67da248
added #values for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
2681
diff
changeset
|
849 |
self do:[:v | values add:v]. |
ed04a67da248
added #values for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
2681
diff
changeset
|
850 |
^ values |
ed04a67da248
added #values for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
2681
diff
changeset
|
851 |
|
ed04a67da248
added #values for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
2681
diff
changeset
|
852 |
"Created: 20.6.1997 / 16:58:28 / cg" |
453 | 853 |
! ! |
854 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
855 |
!Smalltalk class methodsFor:'binary storage'! |
453 | 856 |
|
7563 | 857 |
addGlobalsForBinaryStorageTo:globalDictionary |
858 |
|pools| |
|
859 |
||
860 |
pools := Set new. |
|
2465
1dfcacbbd376
ignore nil values when adding globals (binary storage)
Claus Gittinger <cg@exept.de>
parents:
2418
diff
changeset
|
861 |
|
879 | 862 |
self keysAndValuesDo:[:key :value | |
7616 | 863 |
(key includes:$:) ifFalse:[ "/ skip classVars |
864 |
(value ~~ self |
|
865 |
and:[value notNil]) ifTrue:[ |
|
866 |
value isClass ifTrue:[ |
|
867 |
value addGlobalsForBinaryStorageTo:globalDictionary. |
|
868 |
pools addAll:value sharedPools |
|
869 |
] ifFalse:[ |
|
870 |
globalDictionary at:(key->value) put:self |
|
871 |
]. |
|
872 |
value notNil ifTrue:[ |
|
873 |
globalDictionary at:value put:self |
|
874 |
] |
|
875 |
] |
|
876 |
] |
|
453 | 877 |
]. |
878 |
||
879 |
pools do:[:poolDictionary| |
|
7616 | 880 |
poolDictionary addGlobalsForBinaryStorageTo:globalDictionary |
453 | 881 |
] |
2465
1dfcacbbd376
ignore nil values when adding globals (binary storage)
Claus Gittinger <cg@exept.de>
parents:
2418
diff
changeset
|
882 |
|
1dfcacbbd376
ignore nil values when adding globals (binary storage)
Claus Gittinger <cg@exept.de>
parents:
2418
diff
changeset
|
883 |
"Modified: 19.3.1997 / 18:15:25 / cg" |
2476 | 884 |
"Created: 21.3.1997 / 15:40:31 / cg" |
453 | 885 |
! |
886 |
||
7563 | 887 |
storeBinaryDefinitionOf:anObject on:stream manager:manager |
888 |
|string| |
|
889 |
||
890 |
anObject class == Association ifTrue:[ |
|
7616 | 891 |
string := 'Smalltalk associationAt: ', anObject key storeString |
453 | 892 |
] ifFalse: [ |
7616 | 893 |
string := 'Smalltalk at: ', (self keyAtValue: anObject) storeString |
453 | 894 |
]. |
895 |
stream nextNumber:2 put:string size. |
|
2465
1dfcacbbd376
ignore nil values when adding globals (binary storage)
Claus Gittinger <cg@exept.de>
parents:
2418
diff
changeset
|
896 |
stream nextPutBytes:(string size) from:string startingAt:1. |
1dfcacbbd376
ignore nil values when adding globals (binary storage)
Claus Gittinger <cg@exept.de>
parents:
2418
diff
changeset
|
897 |
"/ string do:[:char | stream nextPut:char asciiValue] |
1dfcacbbd376
ignore nil values when adding globals (binary storage)
Claus Gittinger <cg@exept.de>
parents:
2418
diff
changeset
|
898 |
|
1dfcacbbd376
ignore nil values when adding globals (binary storage)
Claus Gittinger <cg@exept.de>
parents:
2418
diff
changeset
|
899 |
"Modified: 19.3.1997 / 18:49:14 / cg" |
453 | 900 |
! ! |
901 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
902 |
!Smalltalk class methodsFor:'browsing'! |
453 | 903 |
|
7563 | 904 |
browseAllCallsOn:aSelectorSymbol |
905 |
"{ Pragma: +optSpace }" |
|
906 |
||
907 |
"startup a browser for all methods sending a particular message" |
|
617 | 908 |
|
6020 | 909 |
UserPreferences systemBrowserClass browseAllCallsOn:aSelectorSymbol |
617 | 910 |
|
911 |
" |
|
912 |
Smalltalk browseAllCallsOn:#at:put: |
|
913 |
" |
|
914 |
! |
|
915 |
||
7563 | 916 |
browseAllSelect:aBlock |
917 |
"{ Pragma: +optSpace }" |
|
918 |
||
919 |
"startup a browser for all methods for which aBlock returns true" |
|
617 | 920 |
|
6020 | 921 |
UserPreferences systemBrowserClass browseAllSelect:aBlock |
617 | 922 |
|
923 |
" |
|
924 |
Smalltalk browseAllSelect:[:m | m literals isNil] |
|
925 |
" |
|
926 |
! |
|
927 |
||
7563 | 928 |
browseChanges |
929 |
"{ Pragma: +optSpace }" |
|
930 |
||
931 |
"startup a changes browser" |
|
932 |
||
933 |
ChangesBrowser notNil ifTrue:[ |
|
7616 | 934 |
ChangesBrowser open |
453 | 935 |
] ifFalse:[ |
7616 | 936 |
self warn:'no ChangesBrowser built in' |
453 | 937 |
] |
938 |
||
939 |
" |
|
940 |
Smalltalk browseChanges |
|
941 |
" |
|
942 |
! |
|
943 |
||
7563 | 944 |
browseClass:aClass |
945 |
"{ Pragma: +optSpace }" |
|
946 |
||
947 |
"startup a browser on aClass" |
|
6970 | 948 |
|
949 |
UserPreferences systemBrowserClass browseClass:aClass |
|
950 |
||
951 |
" |
|
952 |
Smalltalk browseClass:Array |
|
953 |
" |
|
954 |
! |
|
955 |
||
7563 | 956 |
browseImplementorsMatching:aSelectorSymbolOrMatchPattern |
957 |
"{ Pragma: +optSpace }" |
|
6819 | 958 |
|
959 |
"startup a browser for all methods implementing a message matching" |
|
960 |
||
961 |
UserPreferences systemBrowserClass browseImplementorsMatching:aSelectorSymbolOrMatchPattern |
|
962 |
||
963 |
" |
|
964 |
Smalltalk browseImplementorsOf:#'at:put:' |
|
965 |
Smalltalk browseImplementorsMatching:#'at:*' |
|
966 |
" |
|
967 |
! |
|
968 |
||
7563 | 969 |
browseImplementorsOf:aSelectorSymbol |
970 |
"{ Pragma: +optSpace }" |
|
971 |
||
972 |
"startup a browser for all methods implementing a particular message" |
|
453 | 973 |
|
6020 | 974 |
UserPreferences systemBrowserClass browseImplementorsOf:aSelectorSymbol |
453 | 975 |
|
976 |
" |
|
977 |
Smalltalk browseImplementorsOf:#at:put: |
|
978 |
" |
|
6970 | 979 |
! |
980 |
||
7563 | 981 |
browseInClass:aClass |
982 |
"{ Pragma: +optSpace }" |
|
983 |
||
984 |
"startup a full browser showing aClass" |
|
6970 | 985 |
|
986 |
UserPreferences systemBrowserClass openInClass:aClass |
|
987 |
||
988 |
" |
|
989 |
Smalltalk browseInClass:Array |
|
990 |
" |
|
991 |
! |
|
992 |
||
7563 | 993 |
browseInClass:aClass selector:selector |
994 |
"{ Pragma: +optSpace }" |
|
995 |
||
996 |
"startup a full browser showing aClass>>selector" |
|
6970 | 997 |
|
998 |
UserPreferences systemBrowserClass openInClass:aClass selector:selector |
|
999 |
||
1000 |
" |
|
1001 |
Smalltalk browseInClass:Array selector:#at: |
|
1002 |
" |
|
453 | 1003 |
! ! |
1004 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1005 |
!Smalltalk class methodsFor:'class management'! |
453 | 1006 |
|
7563 | 1007 |
changeCategoryOf:aClass to:newCategory |
1008 |
"change a classes category, add a change record, |
|
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1009 |
send change notifications" |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1010 |
|
8405 | 1011 |
|ns oldCategory| |
1012 |
||
1013 |
oldCategory := aClass category. |
|
1014 |
oldCategory ~= newCategory ifTrue:[ |
|
1015 |
aClass category:(newCategory withoutSeparators asSymbol). |
|
1016 |
||
1017 |
"notify change of category" |
|
1018 |
ns := aClass environment ? self. |
|
1019 |
ns changed:#organization with:(aClass -> oldCategory). |
|
1020 |
ns ~~ self ifTrue:[ |
|
1021 |
self changed:#organization with:(aClass -> oldCategory). |
|
1022 |
] |
|
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1023 |
]. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1024 |
|
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1025 |
" |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1026 |
Smalltalk changeCategoryOf:NewApplication to:#myApplications |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1027 |
" |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1028 |
|
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1029 |
"Modified: / 11.2.2000 / 11:36:27 / cg" |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1030 |
! |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1031 |
|
7563 | 1032 |
defineNameSpace: name private: private imports: imports category: category attributes: annotations |
5328
319b8e3ee60e
renamed Namespace to NameSpace
Claus Gittinger <cg@exept.de>
parents:
5327
diff
changeset
|
1033 |
NameSpace name:name |
5306
806182135518
VW5i compatibility defineNameSpace: added
Claus Gittinger <cg@exept.de>
parents:
5285
diff
changeset
|
1034 |
|
806182135518
VW5i compatibility defineNameSpace: added
Claus Gittinger <cg@exept.de>
parents:
5285
diff
changeset
|
1035 |
! |
806182135518
VW5i compatibility defineNameSpace: added
Claus Gittinger <cg@exept.de>
parents:
5285
diff
changeset
|
1036 |
|
7563 | 1037 |
flushCachedClass:aClass |
1038 |
CachedClasses notNil ifTrue:[ |
|
7616 | 1039 |
CachedClasses remove:aClass ifAbsent:[] |
5895 | 1040 |
] |
5892
df4661be9da2
added individual cachedClass-flush
Claus Gittinger <cg@exept.de>
parents:
5881
diff
changeset
|
1041 |
! |
df4661be9da2
added individual cachedClass-flush
Claus Gittinger <cg@exept.de>
parents:
5881
diff
changeset
|
1042 |
|
7563 | 1043 |
flushCachedClasses |
1044 |
CachedClasses := nil. |
|
1045 |
Class flushSubclassInfo. |
|
1046 |
||
1047 |
" |
|
5580
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1048 |
Smalltalk flushCachedClasses |
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1049 |
" |
453 | 1050 |
! |
1051 |
||
7563 | 1052 |
removeClass:aClass |
1053 |
"remove the argument, aClass from the smalltalk dictionary; |
|
453 | 1054 |
we have to flush the caches since these methods are now void. |
1055 |
Also, class variables of aClass are removed." |
|
1056 |
||
4781 | 1057 |
|sym cSym names oldName oldNameSym actualName wrongName ns ons| |
453 | 1058 |
|
4099 | 1059 |
aClass isNil ifTrue:[^ self]. |
4781 | 1060 |
|
453 | 1061 |
oldName := aClass name. |
4781 | 1062 |
sym := oldNameSym := oldName asSymbol. |
1063 |
((self at:oldNameSym) == aClass) ifFalse:[ |
|
7694
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1064 |
"check other name ..." |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1065 |
(self includes:aClass) ifFalse:[ |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1066 |
'Smalltalk [warning]: no such class: ' errorPrint. oldName errorPrintCR. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1067 |
^ self |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1068 |
]. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1069 |
" |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1070 |
the class has changed its name - without telling me ... |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1071 |
what should be done in this case ? |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1072 |
" |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1073 |
'Smalltalk [warning]: class ' errorPrint. oldName errorPrint. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1074 |
' has changed its name' errorPrintCR. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1075 |
|
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1076 |
"/ |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1077 |
"/ might be an alias (i.e. removing a compatibility name) |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1078 |
"/ |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1079 |
actualName := self keyAtValue:aClass. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1080 |
('Smalltalk [info]: ' , oldName , ' is actually stored as ' , actualName , '.') infoPrintCR. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1081 |
sym := actualName asSymbol. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1082 |
oldName := actualName asString. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1083 |
wrongName := true. |
453 | 1084 |
]. |
1085 |
||
4781 | 1086 |
ns := aClass nameSpace. |
1087 |
aClass topOwningClass notNil ifTrue:[ |
|
7694
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1088 |
ons := aClass topOwningClass nameSpace |
4781 | 1089 |
]. |
1090 |
||
453 | 1091 |
self at:sym put:nil. "nil it out for compiled accesses" |
878
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1092 |
|
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1093 |
"/ |
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1094 |
"/ see comment in removeKey: on why we dont remove it here |
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1095 |
"/ |
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1096 |
"/ self removeKey:sym. "/ remove key - this actually fails, if there are |
7694
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1097 |
"/ still compiled code references." |
453 | 1098 |
|
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1099 |
"remove private classes" |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1100 |
|
2485
9f4a11a4521f
new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents:
2476
diff
changeset
|
1101 |
aClass privateClassesSorted do:[:somePrivateClass | |
7694
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1102 |
aClass privateClassesAt:(somePrivateClass nameWithoutPrefix) asSymbol put:nil. |
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1103 |
]. |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1104 |
|
453 | 1105 |
"remove class variables" |
1106 |
||
1107 |
names := aClass classVariableString asCollectionOfWords. |
|
1108 |
names do:[:name | |
|
7694
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1109 |
cSym := (sym , ':' , name) asSymbol. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1110 |
self at:cSym asSymbol put:nil. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1111 |
|
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1112 |
"/ |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1113 |
"/ see comment in removeKey: on why we dont remove it here |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1114 |
"/ |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1115 |
"/ self removeKey:cSym |
453 | 1116 |
]. |
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1117 |
|
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1118 |
|
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1119 |
"/ actually could get along with less flushing |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1120 |
"/ (entries for aClass and subclasses only) |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1121 |
"/ but we have to delay this, until we have the set of subclasses |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1122 |
"/ at hand - for now, searching for all subclasses is way more |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1123 |
"/ expensive then cache flushing. |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1124 |
"/ |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1125 |
"/ aClass allSubclassesDo:[:aSubclass | |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1126 |
"/ ObjectMemory flushInlineCachesForClass:aSubclass. |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1127 |
"/ ObjectMemory flushMethodCacheFor:aSubclass |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1128 |
"/ ]. |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1129 |
"/ ObjectMemory flushInlineCachesForClass:aClass. |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1130 |
"/ ObjectMemory flushMethodCacheFor:aClass |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1131 |
|
453 | 1132 |
ObjectMemory flushInlineCaches. |
1133 |
ObjectMemory flushMethodCache. |
|
1134 |
||
7181 | 1135 |
aClass addChangeRecordForClassRemove. |
453 | 1136 |
self changed:#classRemove with:aClass. |
1137 |
||
7581
6912a7336e15
class category: sends a change notification;
Claus Gittinger <cg@exept.de>
parents:
7572
diff
changeset
|
1138 |
aClass setCategory:#'* removed *'. |
1655 | 1139 |
|
5326 | 1140 |
self flushCachedClasses. |
1141 |
Class flushSubclassInfo. |
|
1142 |
||
3627
452f2e1ff1b4
removeClass - care for aliases.
Claus Gittinger <cg@exept.de>
parents:
3626
diff
changeset
|
1143 |
wrongName == true ifTrue:[ |
7694
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1144 |
"/ |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1145 |
"/ an alias (i.e. removing a compatibility name) |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1146 |
"/ |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1147 |
"/ check if there are more refs to it ... |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1148 |
[self includes:aClass] whileTrue:[ |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1149 |
actualName := self keyAtValue:aClass. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1150 |
('Smalltalk [info]: ' , aClass name , ' is also registered under the name ' , actualName |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1151 |
, ' - remove that binding too.') infoPrintCR. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1152 |
self at:actualName put:nil. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1153 |
]. |
4724
44793fe70787
recompile ns classes after a class remove
Claus Gittinger <cg@exept.de>
parents:
4723
diff
changeset
|
1154 |
]. |
44793fe70787
recompile ns classes after a class remove
Claus Gittinger <cg@exept.de>
parents:
4723
diff
changeset
|
1155 |
|
4781 | 1156 |
ns ~~ Smalltalk ifTrue:[ |
7694
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1157 |
ons notNil ifTrue:[ |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1158 |
ClassBuilder |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1159 |
recompileGlobalAccessorsTo:oldNameSym |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1160 |
in:ons |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1161 |
except:nil |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1162 |
]. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1163 |
(ns notNil and:[ns ~~ ons]) ifTrue:[ |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1164 |
ClassBuilder |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1165 |
recompileGlobalAccessorsTo:oldNameSym |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1166 |
in:ns |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1167 |
except:nil |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1168 |
]. |
3627
452f2e1ff1b4
removeClass - care for aliases.
Claus Gittinger <cg@exept.de>
parents:
3626
diff
changeset
|
1169 |
]. |
452f2e1ff1b4
removeClass - care for aliases.
Claus Gittinger <cg@exept.de>
parents:
3626
diff
changeset
|
1170 |
|
452f2e1ff1b4
removeClass - care for aliases.
Claus Gittinger <cg@exept.de>
parents:
3626
diff
changeset
|
1171 |
"Modified: / 20.6.1998 / 13:26:10 / cg" |
617 | 1172 |
! |
1173 |
||
7563 | 1174 |
renameClass:aClass to:newName |
1175 |
"rename aClass to newName. Most of the work is in |
|
1525
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1176 |
renaming the classVariables (create & copy over values) |
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1177 |
and patching the classes methods to access the new variables." |
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1178 |
|
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1179 |
|oldName oldSym newSym names oldCVSym newCVSym value oldNameToNewName |
3698
8bce45214d24
fixed renaming of a private class (must recompile owner)
Claus Gittinger <cg@exept.de>
parents:
3678
diff
changeset
|
1180 |
oldNameSpace newNameSpace oldBaseName newBaseName privateClasses |
5610
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1181 |
oldBaseNameWithoutPrefix newBaseNameWithoutPrefix i1 i2 nm ns subns |
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1182 |
oldMetaclass newMetaclass newCategory| |
5610
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1183 |
|
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1184 |
"/ check for all intermediate namespaces / owning classes |
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1185 |
i1 := 1. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1186 |
i2 := 1. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1187 |
ns := self. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1188 |
[i2 ~~ 0] whileTrue:[ |
7996
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1189 |
i2 := newName indexOfSubCollection:'::' startingAt:i1. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1190 |
i2 ~~ 0 ifTrue:[ |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1191 |
nm := newName copyFrom:i1 to:i2-1. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1192 |
ns isNameSpace ifTrue:[ |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1193 |
subns := ns at:nm asSymbol ifAbsent:nil. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1194 |
subns isNil ifTrue:[ |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1195 |
self error:'Nonexisting namespace: ',nm. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1196 |
^ nil. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1197 |
]. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1198 |
] ifFalse:[ |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1199 |
subns := ns privateClassesAt:nm asSymbol. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1200 |
subns isNil ifTrue:[ |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1201 |
self error:'Cannot create a namespace below a class' |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1202 |
] |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1203 |
]. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1204 |
ns := subns. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1205 |
i1 := i2 + 2. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1206 |
]. |
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1207 |
]. |
617 | 1208 |
|
1209 |
oldName := aClass name. |
|
6734 | 1210 |
oldNameSpace := aClass topNameSpace. |
2319
640bb389f90a
recompile when moving classes across namespaces
Claus Gittinger <cg@exept.de>
parents:
2317
diff
changeset
|
1211 |
oldBaseName := aClass nameWithoutNameSpacePrefix. |
3698
8bce45214d24
fixed renaming of a private class (must recompile owner)
Claus Gittinger <cg@exept.de>
parents:
3678
diff
changeset
|
1212 |
oldBaseNameWithoutPrefix := aClass nameWithoutPrefix. |
617 | 1213 |
oldSym := oldName asSymbol. |
2485
9f4a11a4521f
new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents:
2476
diff
changeset
|
1214 |
privateClasses := aClass privateClassesSorted. |
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1215 |
|
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1216 |
((self at:oldSym) ~~ aClass) ifTrue:[ |
7996
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1217 |
'Smalltalk [warning]: rename failed - name is different from key' errorPrintCR. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1218 |
^ self |
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1219 |
]. |
617 | 1220 |
|
1525
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1221 |
"/ rename the class |
617 | 1222 |
|
1847
6e567214b167
care for className being a symbol, when renaming classes
Claus Gittinger <cg@exept.de>
parents:
1758
diff
changeset
|
1223 |
newSym := newName asSymbol. |
1525
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1224 |
|
5610
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1225 |
"/ change the owning class |
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1226 |
ns isNameSpace ifFalse:[ |
7996
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1227 |
aClass isPrivate ifTrue:[ |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1228 |
aClass class setOwningClass:ns. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1229 |
] ifFalse:[ |
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1230 |
"/ sigh - must make a PrivateMetaclass from Metaclass |
7996
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1231 |
oldMetaclass := aClass class. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1232 |
newMetaclass := PrivateMetaclass new. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1233 |
newMetaclass flags:(oldMetaclass flags). |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1234 |
newMetaclass setSuperclass:(oldMetaclass superclass). |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1235 |
newMetaclass instSize:(oldMetaclass instSize). |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1236 |
newMetaclass setInstanceVariableString:(oldMetaclass instanceVariableString). |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1237 |
newMetaclass setMethodDictionary:(oldMetaclass methodDictionary). |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1238 |
newMetaclass setSoleInstance:aClass. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1239 |
newMetaclass setOwningClass:ns. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1240 |
|
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1241 |
aClass changeClassTo:newMetaclass. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1242 |
ObjectMemory flushCaches. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1243 |
] |
5610
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1244 |
] ifTrue:[ |
7996
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1245 |
aClass isPrivate ifTrue:[ |
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1246 |
newCategory := aClass topOwningClass category. |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1247 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1248 |
"/ sigh - must make a Metaclass from PrivateMetaclass |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1249 |
oldMetaclass := aClass class. |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1250 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1251 |
newMetaclass := Metaclass new. |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1252 |
newMetaclass flags:(oldMetaclass flags). |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1253 |
newMetaclass setSuperclass:(oldMetaclass superclass). |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1254 |
newMetaclass instSize:(oldMetaclass instSize). |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1255 |
newMetaclass setInstanceVariableString:(oldMetaclass instanceVariableString). |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1256 |
newMetaclass setMethodDictionary:(oldMetaclass methodDictionary). |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1257 |
newMetaclass setSoleInstance:aClass. |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1258 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1259 |
aClass category:newCategory. |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1260 |
aClass changeClassTo:newMetaclass. |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1261 |
ObjectMemory flushCaches. |
7996
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1262 |
] |
5610
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1263 |
]. |
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1264 |
|
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1265 |
aClass setName:newSym. |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1266 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1267 |
"/ store it in Smalltalk |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1268 |
self at:oldSym put:nil. |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1269 |
|
878
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1270 |
"/ |
1525
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1271 |
"/ see comment in #removeKey: on why we dont remove it it here |
878
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1272 |
"/ |
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1273 |
"/ self removeKey:oldSym. |
617 | 1274 |
self at:newSym put:aClass. |
1275 |
||
1525
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1276 |
"/ create new class variables and copy over values |
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1277 |
|
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1278 |
oldNameToNewName := IdentityDictionary new. |
617 | 1279 |
|
1280 |
names := aClass classVariableString asCollectionOfWords. |
|
1281 |
names do:[:name | |
|
7996
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1282 |
oldCVSym := (oldSym , ':' , name) asSymbol. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1283 |
value := self at:oldCVSym. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1284 |
self at:oldCVSym put:nil. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1285 |
|
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1286 |
"/ |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1287 |
"/ see comment in #removeKey: on why we dont remove it it here |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1288 |
"/ |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1289 |
"/ self removeKey:cSym. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1290 |
|
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1291 |
newCVSym := (newSym , ':' , name) asSymbol. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1292 |
self at:newCVSym put:value. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1293 |
|
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1294 |
oldNameToNewName at:oldCVSym put:newCVSym. |
1525
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1295 |
]. |
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1296 |
|
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1297 |
"/ patch methods literal arrays from oldCVname to newCVname |
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1298 |
|
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1299 |
oldNameToNewName keysAndValuesDo:[:oldNameSym :newNameSym | |
7996
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1300 |
aClass withAllSubclasses do:[:aSubClass | |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1301 |
Transcript showCR:'changing global accesses from ''' , oldNameSym , ''' into ''' , newNameSym , ''' in class: ''' , aSubClass name , ''' ...'. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1302 |
aSubClass instAndClassSelectorsAndMethodsDo:[:sel :aMethod | |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1303 |
aMethod changeLiteral:oldNameSym to:newNameSym |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1304 |
]. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1305 |
]. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1306 |
|
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1307 |
"/ and also in privateClasses ? ... |
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1308 |
|
2485
9f4a11a4521f
new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents:
2476
diff
changeset
|
1309 |
"/ privateClasses size > 0 ifTrue:[ |
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1310 |
"/ privateClasses do:[:aPrivateClass | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1311 |
"/ aPrivateClass withAllSubclasses do:[:aSubClass | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1312 |
"/ aSubClass class methodDictionary do:[:aMethod | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1313 |
"/ aMethod changeLiteral:oldNameSym to:newNameSym |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1314 |
"/ ]. |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1315 |
"/ aSubClass methodDictionary do:[:aMethod | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1316 |
"/ aMethod changeLiteral:oldNameSym to:newNameSym |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1317 |
"/ ] |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1318 |
"/ ]. |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1319 |
"/ ] |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1320 |
"/ ] |
617 | 1321 |
]. |
1322 |
||
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1323 |
aClass addChangeRecordForClassRename:oldSym to:newSym. |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1324 |
|
5333
d80386e06d21
rename into other namespace did not work
Claus Gittinger <cg@exept.de>
parents:
5328
diff
changeset
|
1325 |
"/ clear the namespace (for namespace query to work) |
d80386e06d21
rename into other namespace did not work
Claus Gittinger <cg@exept.de>
parents:
5328
diff
changeset
|
1326 |
aClass setEnvironment:nil. |
6734 | 1327 |
newNameSpace := aClass topNameSpace. |
2405
939f4e751ef3
dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents:
2379
diff
changeset
|
1328 |
|
2485
9f4a11a4521f
new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents:
2476
diff
changeset
|
1329 |
privateClasses size > 0 ifTrue:[ |
7996
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1330 |
"/ must rename privateClasses as well |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1331 |
Class withoutUpdatingChangesDo:[ |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1332 |
privateClasses do:[:aPrivateClass | |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1333 |
self renameClass:aPrivateClass |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1334 |
to:(newSym , '::' , aPrivateClass nameWithoutPrefix). |
5916
4364f9ae4254
when renaming a class, no changeRecrd for its private-class renames
Claus Gittinger <cg@exept.de>
parents:
5913
diff
changeset
|
1335 |
|
7996
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1336 |
Transcript showCR:'recompiling methods in ''' , newNameSpace name , ''' accessing ''' , oldName , '::' , aPrivateClass nameWithoutPrefix , ''' ...'. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1337 |
ClassBuilder |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1338 |
recompileGlobalAccessorsTo:(oldName , '::' , aPrivateClass nameWithoutPrefix) asSymbol |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1339 |
in:newNameSpace |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1340 |
except:nil. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1341 |
] |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1342 |
] |
2405
939f4e751ef3
dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents:
2379
diff
changeset
|
1343 |
]. |
939f4e751ef3
dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents:
2379
diff
changeset
|
1344 |
|
2319
640bb389f90a
recompile when moving classes across namespaces
Claus Gittinger <cg@exept.de>
parents:
2317
diff
changeset
|
1345 |
oldNameSpace ~~ newNameSpace ifTrue:[ |
5246
2ca7b20c4108
create namespaces as requried, when renaming a class
Claus Gittinger <cg@exept.de>
parents:
5214
diff
changeset
|
1346 |
|
7996
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1347 |
"/ all those referencing the class from the old nameSpace |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1348 |
"/ must be recompiled ... |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1349 |
"/ (to now access the global from smalltalk) |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1350 |
|
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1351 |
oldNameSpace ~~ Smalltalk ifTrue:[ |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1352 |
Transcript showCR:'recompiling methods in ''' , oldNameSpace name , ''' accessing ''' , oldName , ''' ...'. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1353 |
|
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1354 |
ClassBuilder |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1355 |
recompileGlobalAccessorsTo:oldName asSymbol |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1356 |
in:oldNameSpace |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1357 |
except:nil. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1358 |
]. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1359 |
|
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1360 |
"/ all referencing the class in the new namespace |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1361 |
"/ as well; to now access the new class. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1362 |
|
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1363 |
(newNameSpace notNil and:[newNameSpace ~~ Smalltalk]) ifTrue:[ |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1364 |
Transcript showCR:'recompiling methods in ''' , newNameSpace name , ''' accessing ''' , oldBaseName , ''' ...'. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1365 |
|
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1366 |
ClassBuilder |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1367 |
recompileGlobalAccessorsTo:oldBaseName asSymbol |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1368 |
in:newNameSpace |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1369 |
except:nil. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1370 |
]. |
3698
8bce45214d24
fixed renaming of a private class (must recompile owner)
Claus Gittinger <cg@exept.de>
parents:
3678
diff
changeset
|
1371 |
] ifFalse:[ |
7996
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1372 |
"/ all references to a global with my new name in my owning class |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1373 |
"/ must now be redirected to myself. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1374 |
|
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1375 |
aClass isPrivate ifTrue:[ |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1376 |
newBaseName := aClass nameWithoutNameSpacePrefix. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1377 |
newBaseNameWithoutPrefix := aClass nameWithoutPrefix. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1378 |
|
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1379 |
Transcript showCR:'recompiling methods accessing ''' , oldBaseNameWithoutPrefix , ''' in: ''' , aClass owningClass name , ''' ...'. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1380 |
aClass owningClass recompileMethodsAccessingGlobal:oldBaseNameWithoutPrefix. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1381 |
aClass owningClass class recompileMethodsAccessingGlobal:oldBaseNameWithoutPrefix. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1382 |
|
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1383 |
Transcript showCR:'recompiling methods accessing ''' , oldBaseName , ''' in: ''' , aClass owningClass name , ''' ...'. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1384 |
aClass owningClass recompileMethodsAccessingGlobal:oldBaseName. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1385 |
aClass owningClass class recompileMethodsAccessingGlobal:oldBaseName. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1386 |
|
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1387 |
Transcript showCR:'recompiling methods accessing ''' , newBaseNameWithoutPrefix , ''' in: ''' , aClass owningClass name , ''' ...'. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1388 |
aClass owningClass recompileMethodsAccessingGlobal:newBaseNameWithoutPrefix. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1389 |
aClass owningClass class recompileMethodsAccessingGlobal:newBaseNameWithoutPrefix. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1390 |
|
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1391 |
Transcript showCR:'recompiling methods accessing ''' , newBaseName , ''' in: ''' , aClass owningClass name , ''' ...'. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1392 |
aClass owningClass recompileMethodsAccessingGlobal:newBaseName. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1393 |
aClass owningClass class recompileMethodsAccessingGlobal:newBaseName. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1394 |
] |
4040
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1395 |
]. |
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1396 |
|
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1397 |
aClass changed:#definition. |
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1398 |
"/ because of the change of my superclasses name ... |
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1399 |
aClass allSubclassesDo:[:subClass | |
7996
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1400 |
subClass changed:#definition. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1401 |
]. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1402 |
"/ because of the change of my superclasses name ... |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1403 |
aClass subclassesDo:[:subClass | |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1404 |
subClass addChangeRecordForClass:subClass. |
4040
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1405 |
]. |
5613
b534e427f028
change message when renaming a class
Claus Gittinger <cg@exept.de>
parents:
5611
diff
changeset
|
1406 |
self changed:#definition. |
b534e427f028
change message when renaming a class
Claus Gittinger <cg@exept.de>
parents:
5611
diff
changeset
|
1407 |
Smalltalk changed:#classRename with:(Array with:aClass with:oldName). |
3698
8bce45214d24
fixed renaming of a private class (must recompile owner)
Claus Gittinger <cg@exept.de>
parents:
3678
diff
changeset
|
1408 |
|
8bce45214d24
fixed renaming of a private class (must recompile owner)
Claus Gittinger <cg@exept.de>
parents:
3678
diff
changeset
|
1409 |
"Created: / 29.10.1995 / 19:58:32 / cg" |
8bce45214d24
fixed renaming of a private class (must recompile owner)
Claus Gittinger <cg@exept.de>
parents:
3678
diff
changeset
|
1410 |
"Modified: / 18.6.1996 / 14:20:50 / stefan" |
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1411 |
"Modified: / 11.2.2000 / 01:12:38 / cg" |
453 | 1412 |
! ! |
1413 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1414 |
!Smalltalk class methodsFor:'copying'! |
453 | 1415 |
|
7563 | 1416 |
deepCopy |
1417 |
"redefined to return self - there is only one Smalltalk dictionary" |
|
453 | 1418 |
|
1419 |
^ self |
|
1410 | 1420 |
|
1421 |
"Modified: 18.5.1996 / 12:13:33 / cg" |
|
453 | 1422 |
! |
1423 |
||
7563 | 1424 |
deepCopyUsing:aDictionary |
8383 | 1425 |
"return a deep copy of the receiver. |
1426 |
Redefined to return the receiver - there is only one Smalltalk dictionary" |
|
453 | 1427 |
|
1428 |
^ self |
|
1410 | 1429 |
|
1430 |
"Modified: 18.5.1996 / 12:13:36 / cg" |
|
453 | 1431 |
! |
1432 |
||
7563 | 1433 |
shallowCopy |
1434 |
"redefined to return self - there is only one Smalltalk dictionary" |
|
617 | 1435 |
|
1436 |
^ self |
|
1410 | 1437 |
|
1438 |
"Modified: 18.5.1996 / 12:13:39 / cg" |
|
617 | 1439 |
! |
1440 |
||
7563 | 1441 |
simpleDeepCopy |
1442 |
"redefined to return self - there is only one Smalltalk dictionary" |
|
453 | 1443 |
|
1444 |
^ self |
|
1410 | 1445 |
|
1446 |
"Modified: 18.5.1996 / 12:13:42 / cg" |
|
453 | 1447 |
! ! |
1448 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1449 |
!Smalltalk class methodsFor:'debugging ST/X'! |
453 | 1450 |
|
7563 | 1451 |
compileTrace:aBoolean |
1452 |
"dump generated inline code (NOOP if VM was compiled without the trace-debug option)" |
|
7325 | 1453 |
%{ |
1454 |
extern char __compileTrace__; |
|
1455 |
||
1456 |
__compileTrace__ = (aBoolean == true) ? 1 : 0; |
|
1457 |
%} |
|
1458 |
" |
|
1459 |
Smalltalk compileTrace:true |
|
1460 |
Smalltalk compileTrace:false |
|
1461 |
" |
|
1462 |
! |
|
1463 |
||
7563 | 1464 |
debugBreakPoint |
1465 |
"{ Pragma: +optSpace }" |
|
1466 |
||
1467 |
"call the dummy debug function, on which a breakpoint |
|
453 | 1468 |
can be put in adb, sdb, dbx or gdb. |
1469 |
WARNING: this method is for debugging only |
|
7694
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
1470 |
it will be removed without notice." |
453 | 1471 |
%{ |
2212 | 1472 |
__PATCHUPCONTEXTS(__context); |
808
1919838112d1
renamed debugBreakPoint -> __debugBreakPoint__
Claus Gittinger <cg@exept.de>
parents:
796
diff
changeset
|
1473 |
__debugBreakPoint__(); |
5410 | 1474 |
%}. |
7622 | 1475 |
^ self |
453 | 1476 |
! |
1477 |
||
7563 | 1478 |
exitWithCoreDump |
1479 |
"{ Pragma: +optSpace }" |
|
1480 |
||
1481 |
"abort program and dump core" |
|
1482 |
||
1483 |
OperatingSystem exitWithCoreDump |
|
4096
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1484 |
"/ never returns |
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1485 |
|
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1486 |
"Be careful evaluating this |
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1487 |
Smalltalk exitWithCoreDump |
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1488 |
" |
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1489 |
|
617 | 1490 |
! |
1491 |
||
7563 | 1492 |
fatalAbort |
1493 |
"{ Pragma: +optSpace }" |
|
1494 |
||
1495 |
"report a fatal-error, print a stack backtrace and exit with core dump. |
|
617 | 1496 |
(You may turn off the stack print with debugPrinting:false)" |
1497 |
%{ |
|
1498 |
__fatal0(__context, "fatalAbort"); |
|
1499 |
/* NEVER RETURNS */ |
|
5410 | 1500 |
%}. |
1501 |
^ self primitiveFailed |
|
1502 |
||
617 | 1503 |
! |
1504 |
||
7563 | 1505 |
fatalAbort:aMessage |
1506 |
"{ Pragma: +optSpace }" |
|
1507 |
||
1508 |
"report a fatal-error; print a stack backtrace and exit with core dump |
|
617 | 1509 |
(You may turn off the stack print with debugPrinting:false)" |
1510 |
||
1511 |
%{ |
|
1512 |
char *msg; |
|
1513 |
||
1514 |
if (__isString(aMessage)) |
|
7616 | 1515 |
msg = (char *) __stringVal(aMessage); |
617 | 1516 |
else |
7616 | 1517 |
msg = "fatalAbort"; |
617 | 1518 |
|
1519 |
__fatal0(__context, msg); |
|
1520 |
/* NEVER RETURNS */ |
|
5410 | 1521 |
%}. |
1522 |
^ self primitiveFailed |
|
1523 |
||
5441 | 1524 |
! |
1525 |
||
7563 | 1526 |
vmInstructionTrace:aBoolean |
1527 |
||
1528 |
||
1529 |
! ! |
|
1530 |
||
1531 |
!Smalltalk class methodsFor:'enumerating'! |
|
1532 |
||
453 | 1533 |
allBehaviorsDo:aBlock |
5580
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1534 |
"evaluate the argument, aBlock for all classes and metaclasses in the system" |
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1535 |
|
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1536 |
self allClassesAndMetaclassesDo:aBlock |
453 | 1537 |
|
1538 |
" |
|
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
1539 |
Smalltalk allBehaviorsDo:[:aClass | aClass name printCR] |
453 | 1540 |
" |
7563 | 1541 |
! |
1542 |
||
1543 |
allClassCategories |
|
1544 |
"return a set of all class categories in the system" |
|
1545 |
||
1546 |
|allCategories| |
|
6217
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1547 |
|
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1548 |
allCategories := Set new. |
7124
da253fd03ba1
Do not sort categories in #allClassCategories.
Stefan Vogel <sv@exept.de>
parents:
7105
diff
changeset
|
1549 |
Smalltalk allClassesDo:[:cls | |category| |
7616 | 1550 |
category := cls category. |
1551 |
category notNil ifTrue:[ |
|
1552 |
allCategories add:category. |
|
1553 |
]. |
|
7124
da253fd03ba1
Do not sort categories in #allClassCategories.
Stefan Vogel <sv@exept.de>
parents:
7105
diff
changeset
|
1554 |
]. |
da253fd03ba1
Do not sort categories in #allClassCategories.
Stefan Vogel <sv@exept.de>
parents:
7105
diff
changeset
|
1555 |
|
7125
947dc98dd66c
Return #allClassCategories as Set (to fit comment and make
Stefan Vogel <sv@exept.de>
parents:
7124
diff
changeset
|
1556 |
^ allCategories. |
6217
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1557 |
|
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1558 |
" |
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1559 |
Smalltalk allClassCategories |
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1560 |
" |
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1561 |
|
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1562 |
"Created: / 17.11.2001 / 12:13:09 / cg" |
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1563 |
! |
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1564 |
|
7563 | 1565 |
allClassesAndMetaclassesDo:aBlock |
1566 |
"evaluate the argument, aBlock for all classes and metaclasses in the system." |
|
5579
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1567 |
|
5940
804fb27727a6
oops - allClassesAndMetaclassesDo: evaluated block twice for
Claus Gittinger <cg@exept.de>
parents:
5916
diff
changeset
|
1568 |
|already| |
804fb27727a6
oops - allClassesAndMetaclassesDo: evaluated block twice for
Claus Gittinger <cg@exept.de>
parents:
5916
diff
changeset
|
1569 |
|
804fb27727a6
oops - allClassesAndMetaclassesDo: evaluated block twice for
Claus Gittinger <cg@exept.de>
parents:
5916
diff
changeset
|
1570 |
already := IdentitySet new. |
804fb27727a6
oops - allClassesAndMetaclassesDo: evaluated block twice for
Claus Gittinger <cg@exept.de>
parents:
5916
diff
changeset
|
1571 |
self allClassesDo:[:eachClass | |cls| |
7616 | 1572 |
cls := eachClass theNonMetaclass. |
1573 |
(already includes:cls) ifFalse:[ |
|
1574 |
aBlock value:cls. |
|
1575 |
already add:cls. |
|
1576 |
]. |
|
1577 |
cls := cls class. |
|
1578 |
(already includes:cls) ifFalse:[ |
|
1579 |
aBlock value:cls. |
|
1580 |
already add:cls. |
|
1581 |
]. |
|
5579
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1582 |
]. |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1583 |
! |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1584 |
|
7563 | 1585 |
allClassesDo:aBlock |
1586 |
"evaluate the argument, aBlock for all classes in the system." |
|
5580
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1587 |
|
5765 | 1588 |
self allClasses do:aBlock |
453 | 1589 |
|
1590 |
" |
|
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
1591 |
Smalltalk allClassesDo:[:aClass | aClass name printCR] |
453 | 1592 |
" |
1593 |
! |
|
1594 |
||
7563 | 1595 |
allClassesInCategory:aCategory |
1596 |
"return a collection of for all classes in aCategory; |
|
1299 | 1597 |
The order of the classes is not defined." |
1598 |
||
1599 |
|coll| |
|
1600 |
||
1601 |
coll := OrderedCollection new. |
|
1602 |
self allClassesInCategory:aCategory do:[:aClass | |
|
7616 | 1603 |
coll add:aClass |
1299 | 1604 |
]. |
1605 |
^ coll |
|
1606 |
||
1607 |
" |
|
1608 |
Smalltalk allClassesInCategory:'Views-Basic' |
|
1609 |
" |
|
1610 |
||
1611 |
"Modified: 25.4.1996 / 18:06:13 / cg" |
|
1612 |
! |
|
1613 |
||
7563 | 1614 |
allClassesInCategory:aCategory do:aBlock |
1615 |
"evaluate the argument, aBlock for all classes in the aCategory; |
|
453 | 1616 |
The order of the classes is not defined." |
1617 |
||
1618 |
aCategory notNil ifTrue:[ |
|
7616 | 1619 |
self allClassesDo:[:aClass | |
1620 |
aClass isMeta ifFalse:[ |
|
1621 |
(aClass category = aCategory) ifTrue:[ |
|
1622 |
aBlock value:aClass |
|
1623 |
] |
|
1624 |
] |
|
1625 |
] |
|
453 | 1626 |
] |
1627 |
||
1628 |
" |
|
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
1629 |
Smalltalk allClassesInCategory:'Views-Basic' do:[:aClass | aClass name printCR] |
453 | 1630 |
" |
1631 |
! |
|
1632 |
||
7563 | 1633 |
allClassesInCategory:aCategory inOrderDo:aBlock |
1634 |
"evaluate the argument, aBlock for all classes in aCategory; |
|
453 | 1635 |
superclasses come first - then subclasses" |
1636 |
||
1637 |
|classes| |
|
1638 |
||
1639 |
aCategory notNil ifTrue:[ |
|
7616 | 1640 |
classes := OrderedCollection new. |
1641 |
self allClassesInCategory:aCategory do:[:aClass | |
|
1642 |
classes add:aClass |
|
1643 |
]. |
|
1644 |
classes topologicalSort:[:a :b | b isSubclassOf:a]. |
|
1645 |
classes do:aBlock |
|
453 | 1646 |
] |
1647 |
||
1648 |
" |
|
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
1649 |
Smalltalk allClassesInCategory:'Views-Basic' inOrderDo:[:aClass | aClass name printCR] |
453 | 1650 |
" |
6217
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1651 |
|
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1652 |
"Modified: / 17.11.2001 / 12:18:15 / cg" |
617 | 1653 |
! |
1654 |
||
7563 | 1655 |
allClassesInOrderDo:aBlock |
1656 |
"evaluate the argument, aBlock for all classes in the system; |
|
5406 | 1657 |
Evaluation order is by inheritance: superclasses come first." |
1658 |
||
1659 |
|already| |
|
1660 |
||
1661 |
already := IdentitySet new. |
|
5580
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1662 |
self allClassesDo:[:aClass | |
7616 | 1663 |
(already includes:aClass) ifFalse:[ |
1664 |
aClass allSuperclasses reverseDo:[:cls | |
|
1665 |
(already includes:aClass) ifFalse:[ |
|
1666 |
already add:cls. |
|
1667 |
aBlock value:cls. |
|
1668 |
]. |
|
1669 |
]. |
|
1670 |
already add:aClass. |
|
1671 |
aBlock value:aClass. |
|
1672 |
] |
|
5406 | 1673 |
]. |
1674 |
||
1675 |
" |
|
1676 |
Smalltalk allClassesInOrderDo:[:aClass | aClass name printCR] |
|
1677 |
" |
|
1678 |
! |
|
1679 |
||
7563 | 1680 |
allKeysDo:aBlock |
1681 |
"evaluate the argument, aBlock for all keys in the Smalltalk dictionary" |
|
617 | 1682 |
|
1683 |
^ self keysDo:aBlock |
|
1684 |
! |
|
1685 |
||
7563 | 1686 |
allMethodCategories |
1687 |
"return a set of all method categories in the system" |
|
1688 |
||
1689 |
|allCategories| |
|
6722
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
1690 |
|
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
1691 |
allCategories := Set new. |
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
1692 |
Smalltalk allClassesDo:[:cls | |
7616 | 1693 |
allCategories addAll:cls categories. |
6722
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
1694 |
]. |
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
1695 |
|
7432 | 1696 |
^ allCategories. |
6722
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
1697 |
|
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
1698 |
" |
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
1699 |
Smalltalk allMethodCategories |
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
1700 |
" |
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
1701 |
! |
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
1702 |
|
7563 | 1703 |
associationsDo:aBlock |
1704 |
"evaluate the argument, aBlock for all key/value pairs |
|
617 | 1705 |
in the Smalltalk dictionary" |
1706 |
||
1707 |
self keysDo:[:aKey | |
|
7616 | 1708 |
aBlock value:(aKey -> (self at:aKey)) |
617 | 1709 |
] |
1710 |
||
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
1711 |
"Smalltalk associationsDo:[:assoc | assoc printCR]" |
617 | 1712 |
! |
1713 |
||
7563 | 1714 |
basicKeys |
1715 |
"for rel > 5 only" |
|
1716 |
||
1717 |
self primitiveFailed |
|
1718 |
||
1719 |
||
1720 |
||
1721 |
||
1722 |
||
1723 |
||
1724 |
! |
|
1725 |
||
1726 |
do:aBlock |
|
1727 |
"evaluate the argument, aBlock for all values in the Smalltalk dictionary" |
|
617 | 1728 |
|
1729 |
|work| |
|
1730 |
||
1731 |
%{ /* NOREGISTER - work may not be placed into a register here */ |
|
1688
8a42db1eea60
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1682
diff
changeset
|
1732 |
__GLOBALS_DO(&aBlock, &work); |
5406 | 1733 |
RETURN (self); |
1734 |
%}. |
|
1735 |
self keysDo:[:aKey | |
|
7616 | 1736 |
aBlock value:(self at:aKey) |
5406 | 1737 |
] |
617 | 1738 |
! |
1739 |
||
7563 | 1740 |
keysAndValuesDo:aBlock |
1741 |
"evaluate the two-arg block, aBlock for all keys and values" |
|
617 | 1742 |
|
1743 |
self keysDo:[:aKey | |
|
7616 | 1744 |
aBlock value:aKey value:(self at:aKey) |
617 | 1745 |
] |
1746 |
! |
|
1747 |
||
7563 | 1748 |
keysDo:aBlock |
1749 |
"evaluate the argument, aBlock for all keys in the Smalltalk dictionary" |
|
617 | 1750 |
|work| |
1751 |
||
1752 |
%{ /* NOREGISTER - work may not be placed into a register here */ |
|
1688
8a42db1eea60
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1682
diff
changeset
|
1753 |
__GLOBALKEYS_DO(&aBlock, &work); |
5406 | 1754 |
RETURN (self); |
1755 |
%}. |
|
1756 |
self basicKeys do:[:aKey | |
|
7616 | 1757 |
aBlock value:aKey |
5406 | 1758 |
] |
453 | 1759 |
! ! |
1760 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1761 |
!Smalltalk class methodsFor:'inspecting'! |
453 | 1762 |
|
7563 | 1763 |
inspectorClass |
1764 |
"{ Pragma: +optSpace }" |
|
1765 |
||
1766 |
"redefined to launch a DictionaryInspector |
|
453 | 1767 |
(instead of the default Inspector)." |
1768 |
||
1769 |
^ DictionaryInspectorView |
|
1770 |
! ! |
|
1771 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1772 |
!Smalltalk class methodsFor:'message control'! |
453 | 1773 |
|
7563 | 1774 |
silentLoading |
1775 |
"returns the Silentloading class variable." |
|
1776 |
||
1777 |
^ SilentLoading |
|
1778 |
! |
|
1779 |
||
1780 |
silentLoading:aBoolean |
|
1781 |
"{ Pragma: +optSpace }" |
|
1782 |
||
1783 |
"allows access to the Silentloading class variable, which controls |
|
453 | 1784 |
messages from all kinds of system onto the transcript. |
1785 |
You can save a snapshot with this flag set to true, which makes |
|
1786 |
the image come up silent. Can also be set, to read in files unlogged." |
|
1787 |
||
1788 |
|prev| |
|
1789 |
||
1790 |
prev := SilentLoading. |
|
1791 |
SilentLoading := aBoolean. |
|
1792 |
^ prev |
|
1793 |
! ! |
|
1794 |
||
4957 | 1795 |
!Smalltalk class methodsFor:'misc accessing'! |
1796 |
||
7563 | 1797 |
beHeadless:aBoolean |
1798 |
"set/clear the headlessOperation flag." |
|
1799 |
||
1800 |
HeadlessOperation := aBoolean |
|
1801 |
! |
|
1802 |
||
1803 |
standAloneApp:aBoolean |
|
1804 |
"set/clear the StandAlone flag." |
|
1805 |
||
1806 |
StandAlone := aBoolean |
|
4957 | 1807 |
! ! |
1808 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1809 |
!Smalltalk class methodsFor:'misc stuff'! |
453 | 1810 |
|
7563 | 1811 |
addExitBlock:aBlock |
1812 |
"{ Pragma: +optSpace }" |
|
1813 |
||
1814 |
"add a block to be executed when Smalltalk finishes. |
|
617 | 1815 |
This feature is currently not used anywhere - but could be useful for |
1816 |
cleanup in stand alone applications." |
|
1817 |
||
1818 |
ExitBlocks isNil ifTrue:[ |
|
7616 | 1819 |
ExitBlocks := OrderedCollection with:aBlock |
617 | 1820 |
] ifFalse:[ |
7616 | 1821 |
ExitBlocks add:aBlock |
617 | 1822 |
] |
1823 |
! |
|
1824 |
||
7563 | 1825 |
addImageStartBlock:aBlock |
1826 |
"{ Pragma: +optSpace }" |
|
1827 |
||
1828 |
"add a blocks to be executed in a separate process after |
|
2681 | 1829 |
everything has been initialized. |
1830 |
These blocks will be executed after an image restart." |
|
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1831 |
|
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1832 |
ImageStartBlocks isNil ifTrue:[ |
7616 | 1833 |
ImageStartBlocks := OrderedCollection with:aBlock |
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1834 |
] ifFalse:[ |
7616 | 1835 |
ImageStartBlocks add:aBlock |
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1836 |
] |
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1837 |
|
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1838 |
"Created: 9.9.1996 / 16:48:20 / stefan" |
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1839 |
! |
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1840 |
|
7563 | 1841 |
addStartBlock:aBlock |
1842 |
"{ Pragma: +optSpace }" |
|
1843 |
||
1844 |
"add a blocks to be executed in a separate process after |
|
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1845 |
everything has been initialized. These blocks will |
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1846 |
be deleted after execution and therefore not be |
2681 | 1847 |
executed after an image restart. |
1848 |
Initial processes are usually started here (see smalltalk.rc / private.rc)." |
|
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1849 |
|
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1850 |
StartBlocks isNil ifTrue:[ |
7616 | 1851 |
StartBlocks := OrderedCollection with:aBlock |
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1852 |
] ifFalse:[ |
7616 | 1853 |
StartBlocks add:aBlock |
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1854 |
] |
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1855 |
|
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1856 |
"Created: 9.9.1996 / 16:46:53 / stefan" |
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1857 |
! |
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1858 |
|
7563 | 1859 |
exit |
1860 |
"{ Pragma: +optSpace }" |
|
1861 |
||
1862 |
"finish the Smalltalk system" |
|
1863 |
||
1864 |
ObjectMemory changed:#aboutToExit. "/ for ST/X backward compatibility |
|
453 | 1865 |
ObjectMemory changed:#aboutToQuit. "/ for ST-80 compatibility |
1866 |
ExitBlocks notNil ifTrue:[ |
|
7616 | 1867 |
ExitBlocks do:[:aBlock | |
1868 |
aBlock value |
|
1869 |
] |
|
453 | 1870 |
]. |
1871 |
OperatingSystem exit |
|
4096
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1872 |
"/ never returns |
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1873 |
|
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1874 |
"Be careful evaluating this |
453 | 1875 |
Smalltalk exit |
1876 |
" |
|
1877 |
! |
|
1878 |
||
7563 | 1879 |
sleep:aDelay |
1880 |
"{ Pragma: +optSpace }" |
|
1881 |
||
1882 |
"wait for aDelay seconds. |
|
1883 |
OBSOLETE: this is historical leftover and will be removed" |
|
453 | 1884 |
|
8358 | 1885 |
<resource:#obsolete> |
7851 | 1886 |
self obsoleteMethodWarning:'use Delay>>waitForSeconds'. |
453 | 1887 |
OperatingSystem sleep:aDelay |
1888 |
! ! |
|
1889 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1890 |
!Smalltalk class methodsFor:'queries'! |
453 | 1891 |
|
7563 | 1892 |
allClasses |
1893 |
"return an unordered collection of all classes in the system. |
|
1894 |
Only globally anchored classes are returned |
|
453 | 1895 |
(i.e. anonymous ones have to be aquired by Behavior allSubInstances)" |
1896 |
||
1897 |
|classes| |
|
1898 |
||
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
1899 |
"/ you may wonder, what this while is for, here ... |
453 | 1900 |
"/ the reason is that if we modify the class hierarchy in |
4067 | 1901 |
"/ another view (background fileIn), while building up the |
453 | 1902 |
"/ cachedClasses set, this may be flushed (invalidated) by the |
1903 |
"/ other process in the meanwhile. |
|
1904 |
"/ If that happens, we restart the set-building here |
|
1905 |
"/ |
|
1906 |
[(classes := CachedClasses) isNil] whileTrue:[ |
|
7616 | 1907 |
CachedClasses := classes := IdentitySet new:800. |
1908 |
self keysAndValuesDo:[:sym :anObject | |
|
1909 |
anObject notNil ifTrue:[ |
|
1910 |
anObject isBehavior ifTrue:[ |
|
1911 |
"/ sigh - would like to skip over aliases |
|
1912 |
"/ but this cannot be done simply by comparing |
|
1913 |
"/ the classes name against the store-key |
|
1914 |
"/ i.e. cannot do: |
|
1915 |
"/ anObject name == sym ifTrue:[ |
|
1916 |
"/ classes add:anObject |
|
1917 |
"/ ] |
|
1918 |
"/ because that would lead to ignore all java |
|
1919 |
"/ classes, which are stored under a different |
|
1920 |
"/ key. |
|
1921 |
||
1922 |
(anObject name == sym |
|
1923 |
or:[anObject isJavaClass]) ifTrue:[ |
|
1924 |
classes add:anObject |
|
1925 |
]. |
|
1926 |
] |
|
1927 |
] |
|
1928 |
] |
|
453 | 1929 |
]. |
1930 |
^ classes |
|
1931 |
||
4618
f5a0e70205c9
oops - do not check for classes name = key (java stuff)
Claus Gittinger <cg@exept.de>
parents:
4607
diff
changeset
|
1932 |
"CachedClasses := nil. |
453 | 1933 |
Smalltalk allClasses |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
1934 |
|
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
1935 |
to get the list sorted by name: |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
1936 |
|
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
1937 |
Smalltalk allClasses asSortedCollection:[:a :b | a name < b name] |
453 | 1938 |
" |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
1939 |
|
5278 | 1940 |
"Modified: / 23.2.2000 / 10:49:46 / cg" |
453 | 1941 |
! |
1942 |
||
7563 | 1943 |
allClassesAndMetaclasses |
1944 |
"return an unordered collection of all classes with their metaclasses in the system." |
|
5579
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1945 |
|
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1946 |
|classes| |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1947 |
|
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1948 |
classes := IdentitySet new. |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1949 |
self allClassesDo:[:eachClass | |
7616 | 1950 |
classes add:(eachClass theNonMetaclass). |
1951 |
classes add:(eachClass theMetaclass). |
|
5579
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1952 |
]. |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1953 |
^ classes |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1954 |
! |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1955 |
|
7563 | 1956 |
allClassesWithAllPrivateClasses |
1957 |
"return an unordered collection of all classes in the Smalltalk namespace. |
|
4642 | 1958 |
Only globally anchored classes are returned |
1959 |
(i.e. anonymous ones have to be aquired by Behavior allSubInstances)" |
|
1960 |
||
1961 |
^ self allClasses select:[:aClass | |
|
7616 | 1962 |
|owner| |
1963 |
||
1964 |
(aClass isNameSpace not |
|
1965 |
or:[aClass == Smalltalk]) |
|
1966 |
and:[ |
|
1967 |
owner := aClass topOwningClass. |
|
1968 |
(owner ? aClass) nameSpace == Smalltalk |
|
1969 |
] |
|
4642 | 1970 |
] |
1971 |
||
1972 |
" |
|
1973 |
Smalltalk allClassesWithAllPrivateClasses |
|
1974 |
" |
|
1975 |
! |
|
1976 |
||
7563 | 1977 |
cellAt:aName |
1978 |
"{ Pragma: +optSpace }" |
|
1979 |
||
1980 |
"return the address of a global cell |
|
617 | 1981 |
- used internally for compiler only" |
1982 |
||
1983 |
%{ /* NOCONTEXT */ |
|
1984 |
RETURN ( __GLOBAL_GETCELL(aName) ); |
|
5406 | 1985 |
%}. |
5410 | 1986 |
^ self primitiveFailed |
1987 |
||
617 | 1988 |
! |
1989 |
||
7563 | 1990 |
classCategoryCompletion:aPartialCategory |
1991 |
"given a partial class category name, return an array consisting of |
|
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1992 |
2 entries: 1st: the best (longest) match |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1993 |
2nd: collection consisting of matching categories" |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1994 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1995 |
^ DoWhatIMeanSupport classCategoryCompletion:aPartialCategory in:self |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1996 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1997 |
" |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1998 |
Smalltalk classCategoryCompletion:'Sys' |
6539 | 1999 |
Smalltalk classCategoryCompletion:'System' |
2000 |
Smalltalk classCategoryCompletion:'System-BinaryStorage' |
|
2001 |
" |
|
2002 |
! |
|
2003 |
||
7563 | 2004 |
classNamed:aString |
2005 |
"return the class with name aString, or nil if absent. |
|
2006 |
To get to the metaClass, append ' class' to the string. |
|
7520
03cbfda8cf8b
allow for namespace::name in #classNamed.
Claus Gittinger <cg@exept.de>
parents:
7432
diff
changeset
|
2007 |
To get a nameSpace or private class, prefix the name as required." |
03cbfda8cf8b
allow for namespace::name in #classNamed.
Claus Gittinger <cg@exept.de>
parents:
7432
diff
changeset
|
2008 |
|
03cbfda8cf8b
allow for namespace::name in #classNamed.
Claus Gittinger <cg@exept.de>
parents:
7432
diff
changeset
|
2009 |
|cls sym nonMeta idx ns nm| |
453 | 2010 |
|
2011 |
"be careful, to not invent new symbols ..." |
|
2012 |
sym := aString asSymbolIfInterned. |
|
2013 |
sym notNil ifTrue:[ |
|
7616 | 2014 |
cls := self at:sym ifAbsent:nil. |
2015 |
cls isBehavior ifTrue:[^ cls]. |
|
2016 |
cls isNil ifTrue:[ |
|
2017 |
idx := sym indexOfSubCollection:'::'. |
|
2018 |
idx ~~ 0 ifTrue:[ |
|
2019 |
ns := sym copyTo:idx-1. |
|
2020 |
nm := sym copyFrom:idx+2. |
|
2021 |
ns := Smalltalk at:ns asSymbol. |
|
2022 |
ns notNil ifTrue:[ |
|
2023 |
ns isNameSpace ifTrue:[ |
|
2024 |
cls := ns at:(nm asSymbol). |
|
2025 |
] ifFalse:[ |
|
2026 |
ns isBehavior ifTrue:[ |
|
2027 |
cls := ns privateClassesAt:(nm asSymbol). |
|
2028 |
] |
|
2029 |
] |
|
2030 |
]. |
|
2031 |
cls isBehavior ifTrue:[^ cls]. |
|
2032 |
]. |
|
2033 |
]. |
|
453 | 2034 |
]. |
1480
df0bea6285f8
Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
2035 |
(aString endsWith:' class') ifTrue:[ |
7616 | 2036 |
nonMeta := self classNamed:(aString copyWithoutLast:6). |
2037 |
nonMeta notNil ifTrue:[ |
|
2038 |
^ nonMeta theMetaclass |
|
2039 |
]. |
|
453 | 2040 |
]. |
2041 |
^ nil |
|
2042 |
||
2043 |
" |
|
2044 |
Smalltalk classNamed:'Object' |
|
2045 |
Smalltalk classNamed:'fooBar' |
|
2046 |
Smalltalk classNamed:'true' |
|
1480
df0bea6285f8
Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
2047 |
Smalltalk classNamed:'Object class' |
453 | 2048 |
Smalltalk classNamed:'Metaclass' |
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2049 |
Smalltalk classNamed:'Array' |
1480
df0bea6285f8
Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
2050 |
Smalltalk classNamed:'Array class' |
453 | 2051 |
" |
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2052 |
|
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2053 |
"Created: 24.11.1995 / 17:30:22 / cg" |
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2054 |
"Modified: 24.11.1995 / 17:31:29 / cg" |
1480
df0bea6285f8
Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
2055 |
"Modified: 19.6.1996 / 14:22:21 / stefan" |
453 | 2056 |
! |
2057 |
||
7563 | 2058 |
classNames |
2059 |
"return a collection of all classNames in the system" |
|
2060 |
||
2061 |
^ self allClasses collect:[:aClass | aClass name] |
|
453 | 2062 |
|
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2063 |
" |
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2064 |
Smalltalk classNames |
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2065 |
" |
453 | 2066 |
! |
2067 |
||
7563 | 2068 |
classnameCompletion:aPartialClassName |
2069 |
"given a partial classname, return an array consisting of |
|
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2070 |
2 entries: 1st: the best (longest) match |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2071 |
2nd: collection consisting of matching names" |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2072 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2073 |
^ DoWhatIMeanSupport classnameCompletion:aPartialClassName inEnvironment:self |
6472
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2074 |
! |
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2075 |
|
7563 | 2076 |
classnameCompletion:aPartialClassName inEnvironment:anEnvironment |
2077 |
"given a partial classname, return an array consisting of |
|
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2078 |
2 entries: 1st: the best (longest) match |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2079 |
2nd: collection consisting of matching names" |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2080 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2081 |
^ DoWhatIMeanSupport classnameCompletion:aPartialClassName inEnvironment:anEnvironment |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2082 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2083 |
" |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2084 |
Smalltalk classnameCompletion:'Arr' |
453 | 2085 |
Smalltalk classnameCompletion:'Arra' |
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2086 |
Smalltalk classnameCompletion:'arra' |
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2087 |
Smalltalk classnameCompletion:'*rray' |
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2088 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2089 |
Smalltalk classnameCompletion:'Arr cl' |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2090 |
Smalltalk classnameCompletion:'*rray cl' |
453 | 2091 |
" |
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2092 |
|
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2093 |
"Created: 24.11.1995 / 17:24:45 / cg" |
2523
04db1fd74e0d
try ignoring case in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
2514
diff
changeset
|
2094 |
"Modified: 3.4.1997 / 18:25:01 / cg" |
453 | 2095 |
! |
2096 |
||
7563 | 2097 |
defaultNameSpace |
2098 |
"return the default namespace, where new classes are installed, |
|
2004
b660837fe0c7
renamed #currentNameSpace to #defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2099 |
if NO special nameSpace handler is present" |
b660837fe0c7
renamed #currentNameSpace to #defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2100 |
|
2029
55ddf4c547ab
ask the current project for the defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
2004
diff
changeset
|
2101 |
|p| |
55ddf4c547ab
ask the current project for the defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
2004
diff
changeset
|
2102 |
|
55ddf4c547ab
ask the current project for the defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
2004
diff
changeset
|
2103 |
(Project notNil and:[(p := Project current) notNil]) ifTrue:[ |
7616 | 2104 |
^ p defaultNameSpace |
2029
55ddf4c547ab
ask the current project for the defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
2004
diff
changeset
|
2105 |
]. |
55ddf4c547ab
ask the current project for the defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
2004
diff
changeset
|
2106 |
|
2004
b660837fe0c7
renamed #currentNameSpace to #defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2107 |
^ self |
b660837fe0c7
renamed #currentNameSpace to #defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2108 |
|
b660837fe0c7
renamed #currentNameSpace to #defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2109 |
"Created: 19.12.1996 / 23:49:25 / cg" |
2029
55ddf4c547ab
ask the current project for the defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
2004
diff
changeset
|
2110 |
"Modified: 2.1.1997 / 20:01:31 / cg" |
2004
b660837fe0c7
renamed #currentNameSpace to #defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2111 |
! |
b660837fe0c7
renamed #currentNameSpace to #defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2112 |
|
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2113 |
globalNameCompletion:aPartialGlobalName |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2114 |
"given a partial globalName, return an array consisting of |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2115 |
2 entries: 1st: the best (longest) match |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2116 |
2nd: collection consisting of matching names" |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2117 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2118 |
^ DoWhatIMeanSupport globalNameCompletion:aPartialGlobalName in:self |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2119 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2120 |
" |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2121 |
Smalltalk globalnameCompletion:'Arr' |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2122 |
Smalltalk globalnameCompletion:'Arra' |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2123 |
Smalltalk globalnameCompletion:'arra' |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2124 |
Smalltalk globalnameCompletion:'*rray' |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2125 |
" |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2126 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2127 |
"Created: 24.11.1995 / 17:24:45 / cg" |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2128 |
"Modified: 3.4.1997 / 18:25:01 / cg" |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2129 |
! |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2130 |
|
7563 | 2131 |
globalnameCompletion:aPartialGlobalName |
2132 |
"given a partial globalName, return an array consisting of |
|
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2133 |
2 entries: 1st: the best (longest) match |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2134 |
2nd: collection consisting of matching names" |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2135 |
|
8358 | 2136 |
<resource:#obsolete> |
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2137 |
self obsoleteMethodWarning:'use #globalNameCompletion:'. |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2138 |
^ DoWhatIMeanSupport globalNameCompletion:aPartialGlobalName in:self |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2139 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2140 |
" |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2141 |
Smalltalk globalnameCompletion:'Arr' |
5736 | 2142 |
Smalltalk globalnameCompletion:'Arra' |
2143 |
Smalltalk globalnameCompletion:'arra' |
|
2144 |
Smalltalk globalnameCompletion:'*rray' |
|
2145 |
" |
|
2146 |
||
2147 |
"Created: 24.11.1995 / 17:24:45 / cg" |
|
2148 |
"Modified: 3.4.1997 / 18:25:01 / cg" |
|
2149 |
! |
|
2150 |
||
7563 | 2151 |
hasNamespaces |
2152 |
"can be redefined by dummy namespaces/environments, to suppress |
|
6472
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2153 |
the namespace display in a browser (PocketSmalltalk)" |
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2154 |
|
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2155 |
^ true |
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2156 |
! |
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2157 |
|
7563 | 2158 |
includes:something |
2159 |
"this should come from Collection. |
|
2160 |
will change the inheritance - Smalltalk is actually a collection" |
|
617 | 2161 |
|
2162 |
self do:[:element | element = something ifTrue:[^ true]]. |
|
2163 |
^ false |
|
2164 |
! |
|
2165 |
||
7563 | 2166 |
isNameSpace |
1706 | 2167 |
^ true |
7563 | 2168 |
|
2169 |
"Created: 11.10.1996 / 18:10:43 / cg" |
|
2170 |
! |
|
2171 |
||
2172 |
isTopLevelNameSpace |
|
2173 |
^ true |
|
2174 |
! |
|
2175 |
||
2176 |
isTopLevelNamespace |
|
2177 |
"obsolete - use isTopLevelNameSpace" |
|
5365 | 2178 |
|
7432 | 2179 |
<resource:#obsolete> |
2180 |
||
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2181 |
self obsoleteMethodWarning:'use #isTopLevelNameSpace'. |
4458 | 2182 |
^ true |
2183 |
||
2184 |
"Created: 11.10.1996 / 18:10:43 / cg" |
|
2185 |
! |
|
2186 |
||
7563 | 2187 |
methodProtocolCompletion:aPartialProtocolName |
2188 |
"given a partial method protocol name, return an array consisting of |
|
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2189 |
2 entries: 1st: the best (longest) match |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2190 |
2nd: collection consisting of matching protocols" |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2191 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2192 |
^ DoWhatIMeanSupport methodProtocolCompletion:aPartialProtocolName in:self |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2193 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2194 |
" |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2195 |
Smalltalk methodProtocolCompletion:'doc' |
5505
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2196 |
Smalltalk methodProtocolCompletion:'docu' |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2197 |
Smalltalk methodProtocolCompletion:'documenta' |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2198 |
" |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2199 |
! |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2200 |
|
7563 | 2201 |
numberOfGlobals |
2202 |
"return the number of global variables in the system" |
|
2203 |
||
2204 |
|tally "{ Class: SmallInteger }" | |
|
617 | 2205 |
|
2206 |
tally := 0. |
|
2207 |
self do:[:obj | tally := tally + 1]. |
|
2208 |
^ tally |
|
2209 |
||
2210 |
"Smalltalk numberOfGlobals" |
|
2211 |
! |
|
2212 |
||
7563 | 2213 |
referencesAny:aCollection |
2214 |
"redefined, since the references are only kept in the VM's symbol table" |
|
3260 | 2215 |
|
2216 |
self keysAndValuesDo:[:key :val | |
|
7616 | 2217 |
aCollection do:[:anObject | |
2218 |
(key == anObject) ifTrue:[^ true]. |
|
2219 |
(val == anObject ) ifTrue:[^ true]. |
|
2220 |
] |
|
3260 | 2221 |
]. |
2222 |
^ super referencesAny:aCollection |
|
2223 |
||
2224 |
"Created: / 2.2.1998 / 16:01:20 / cg" |
|
2225 |
! |
|
2226 |
||
7563 | 2227 |
referencesDerivedInstanceOf:aClass |
2228 |
"redefined, since the references are only kept in the VM's symbol table" |
|
617 | 2229 |
|
2230 |
self keysAndValuesDo:[:key :val | |
|
7616 | 2231 |
(key isKindOf:aClass) ifTrue:[^ true]. |
2232 |
(val isKindOf:aClass) ifTrue:[^ true]. |
|
617 | 2233 |
]. |
2234 |
^ super referencesDerivedInstanceOf:aClass |
|
2235 |
! |
|
2236 |
||
7563 | 2237 |
referencesInstanceOf:aClass |
2238 |
"redefined, since the references are only kept in the VM's symbol table" |
|
617 | 2239 |
|
2240 |
self keysAndValuesDo:[:key :val | |
|
7616 | 2241 |
(key isMemberOf:aClass) ifTrue:[^ true]. |
2242 |
(val isMemberOf:aClass) ifTrue:[^ true]. |
|
617 | 2243 |
]. |
2244 |
^ super referencesInstanceOf:aClass |
|
2245 |
! |
|
2246 |
||
7563 | 2247 |
referencesObject:anObject |
2248 |
"redefined, since the references are only kept in the VM's symbol table" |
|
6074
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
2249 |
|
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
2250 |
self keysAndValuesDo:[:key :val | |
7616 | 2251 |
(key == anObject) ifTrue:[^ true]. |
2252 |
(val == anObject ) ifTrue:[^ true]. |
|
6074
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
2253 |
]. |
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
2254 |
^ super referencesObject:anObject |
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
2255 |
|
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
2256 |
"Modified: / 3.2.1998 / 14:22:46 / cg" |
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
2257 |
! |
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
2258 |
|
7563 | 2259 |
resolveName:nameIn inClass:aClass |
2260 |
"resolve aName as if compiled within aClass; |
|
3026 | 2261 |
i.e. if it has a private class with this name, return it; |
2262 |
if aName is known within the classes namespace, return that. |
|
2263 |
Otherwise, return a global with that name. |
|
2264 |
This should be used whereever Smalltalk>>at: used to be used, |
|
2265 |
to resolve a global by name." |
|
2266 |
||
4354
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
2267 |
|aName sym cls ns| |
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
2268 |
|
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
2269 |
nameIn isNil ifTrue:[^ nil]. |
4356 | 2270 |
nameIn isBehavior ifTrue:[^ nameIn]. "/ already resolved |
4354
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
2271 |
aName := nameIn. |
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
2272 |
|
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
2273 |
(aName startsWith:'Smalltalk::') ifTrue:[ |
7616 | 2274 |
aName := aName copyFrom:12. |
2275 |
^ self at:(aName asSymbol) ifAbsent:nil. |
|
4354
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
2276 |
]. |
3026 | 2277 |
|
2278 |
sym := aName asSymbol. |
|
2279 |
||
2280 |
cls := aClass privateClassesAt:sym. |
|
2281 |
cls notNil ifTrue:[^ cls]. |
|
2282 |
||
2283 |
ns := aClass nameSpace. |
|
2284 |
(ns notNil and:[ns ~~ Smalltalk]) ifTrue:[ |
|
7616 | 2285 |
ns isNameSpace ifTrue:[ |
2286 |
cls := ns at:sym ifAbsent:nil. |
|
2287 |
] ifFalse:[ |
|
2288 |
cls := ns privateClassesAt:sym |
|
2289 |
]. |
|
2290 |
cls notNil ifTrue:[^ cls]. |
|
3025 | 2291 |
]. |
3026 | 2292 |
^ self at:sym ifAbsent:nil. |
4356 | 2293 |
|
2294 |
"Modified: / 9.7.1999 / 01:18:07 / cg" |
|
3025 | 2295 |
! |
2296 |
||
7563 | 2297 |
selectorCompletion:aPartialSymbolName |
2298 |
"given a partial selector, return an array consisting of |
|
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2299 |
2 entries: 1st: the longest match |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2300 |
2nd: collection consisting of matching implemented selectors" |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2301 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2302 |
^ DoWhatIMeanSupport selectorCompletion:aPartialSymbolName inEnvironment:self |
6472
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2303 |
! |
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2304 |
|
7563 | 2305 |
selectorCompletion:aPartialSymbolName inEnvironment:anEnvironment |
2306 |
"given a partial selector, return an array consisting of |
|
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2307 |
2 entries: 1st: the longest match |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2308 |
2nd: collection consisting of matching implemented selectors" |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2309 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2310 |
^ DoWhatIMeanSupport selectorCompletion:aPartialSymbolName inEnvironment:anEnvironment |
453 | 2311 |
|
2312 |
" |
|
2313 |
Smalltalk selectorCompletion:'at:p' |
|
2314 |
Smalltalk selectorCompletion:'nextP' |
|
3565
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
2315 |
Smalltalk selectorCompletion:'nextp' |
453 | 2316 |
" |
1461
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1455
diff
changeset
|
2317 |
|
3565
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
2318 |
"Modified: / 7.6.1996 / 08:44:33 / stefan" |
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
2319 |
"Modified: / 14.6.1998 / 15:54:03 / cg" |
453 | 2320 |
! ! |
2321 |
||
4431 | 2322 |
!Smalltalk class methodsFor:'queries-system'! |
2323 |
||
7563 | 2324 |
dialectName |
2325 |
^ 'SmalltalkX' |
|
2326 |
||
2327 |
" |
|
2328 |
Smalltalk dialectName |
|
2329 |
" |
|
2330 |
! |
|
2331 |
||
2332 |
dialectReleaseVersion |
|
7348 | 2333 |
^ self versionString |
2334 |
||
2335 |
" |
|
2336 |
Smalltalk dialectReleaseVersion |
|
2337 |
" |
|
2338 |
! |
|
2339 |
||
7563 | 2340 |
isDolphinSmalltalk |
2341 |
"return false here - this may be useful to write portable |
|
4970 | 2342 |
applications - add #isDolphinSmalltalk to your dolphin, |
2343 |
returning true there." |
|
2344 |
||
2345 |
^ false |
|
2346 |
! |
|
2347 |
||
7563 | 2348 |
isSmalltalkMT |
2349 |
"return false here - this may be useful to write portable |
|
2350 |
applications - add #isSmalltalkMT to your smalltalk-MT, |
|
4970 | 2351 |
returning true there." |
2352 |
||
2353 |
^ false |
|
2354 |
! |
|
2355 |
||
7563 | 2356 |
isSmalltalkV |
2357 |
"return false here - this may be useful to write portable |
|
2358 |
applications - add #isSmalltalkV to your smalltalkV, |
|
4431 | 2359 |
returning true there." |
2360 |
||
2361 |
^ false |
|
2362 |
! |
|
2363 |
||
7563 | 2364 |
isSmalltalkX |
2365 |
"return true here - this may be useful to write portable |
|
2366 |
applications - add #isSmalltalkX to your other smalltalks, |
|
4431 | 2367 |
returning false there." |
2368 |
||
2369 |
^ true |
|
2370 |
! |
|
2371 |
||
7563 | 2372 |
isSqueak |
2373 |
"return false here - this may be useful to write portable |
|
2374 |
applications - add #isSqueak to your squeak, |
|
4431 | 2375 |
returning true there." |
2376 |
||
2377 |
^ false |
|
2378 |
! |
|
2379 |
||
7563 | 2380 |
isVisualAge |
2381 |
"return false here - this may be useful to write portable |
|
2382 |
applications - add #isVisualAge to your visualAge, |
|
4431 | 2383 |
returning true there." |
2384 |
||
2385 |
^ false |
|
2386 |
! |
|
2387 |
||
7563 | 2388 |
isVisualWorks |
2389 |
"return false here - this may be useful to write portable |
|
2390 |
applications - add #isVisualWorks to your visualWorks, |
|
4431 | 2391 |
returning true there." |
2392 |
||
2393 |
^ false |
|
2394 |
! ! |
|
2395 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
2396 |
!Smalltalk class methodsFor:'startup'! |
1 | 2397 |
|
7563 | 2398 |
displayInitializationDone |
2399 |
"inform the restart, that the display has been initialized" |
|
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2400 |
|
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2401 |
CallbackSignal raiseRequest. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2402 |
! |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2403 |
|
7563 | 2404 |
mainStartup:graphicalMode |
2405 |
"common start/restart action, if there is a Display, initialize it |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2406 |
and start dispatching; otherwise go into a read-eval-print loop." |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2407 |
|
7043
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
2408 |
|process imageName thisIsARestart| |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2409 |
|
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2410 |
imageName := ObjectMemory imageName. |
2249
cdb6c87f0707
send returnFromSnapshot notification later -
Claus Gittinger <cg@exept.de>
parents:
2212
diff
changeset
|
2411 |
thisIsARestart := imageName notNil. |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2412 |
|
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2413 |
" |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2414 |
if there is a display, start its event dispatcher |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2415 |
" |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2416 |
Display notNil ifTrue:[ |
7616 | 2417 |
Display deviceIOTimeoutErrorSignal handlerBlock:[:ex | |
2418 |
SaveEmergencyImage == true ifTrue:[ |
|
2419 |
'Display [warning]: broken display connection - emergency save in ''crash.img''.' infoPrintCR. |
|
2420 |
ObjectMemory primSnapShotOn:'crash.img'. |
|
2421 |
]. |
|
2422 |
'Display [warning]: broken display connection - exit.' infoPrintCR. |
|
2423 |
Smalltalk exit. |
|
2424 |
]. |
|
2425 |
Display startDispatch. |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2426 |
]. |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2427 |
|
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2428 |
Initializing := false. |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2429 |
|
2074
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
2430 |
"/ start a process, which evaluates all StartBlocks |
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
2431 |
"/ this used to be done right here (in this system-process), |
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
2432 |
"/ but lead to trouble, when it suspended. |
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
2433 |
"/ Therefore, it is now done by an extra user-process. |
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
2434 |
|
7043
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
2435 |
process := [ |
7616 | 2436 |
StartBlocks notNil ifTrue:[ |
2437 |
StartBlocks do:[:aBlock| |
|
2438 |
aBlock value |
|
2439 |
]. |
|
2440 |
StartBlocks := nil. |
|
2441 |
]. |
|
2442 |
ImageStartBlocks notNil ifTrue:[ |
|
2443 |
ImageStartBlocks do:[:aBlock| |
|
2444 |
aBlock value |
|
2445 |
]. |
|
2446 |
]. |
|
2447 |
StandAlone ifFalse:[ |
|
2448 |
(SilentLoading == true) ifFalse:[ "i.e. undefined counts as false" |
|
2449 |
thisIsARestart ifTrue:[ |
|
2450 |
Transcript cr. |
|
2451 |
Transcript showCR:('Smalltalk restarted from:' |
|
2452 |
, imageName |
|
2453 |
, ' (saved ' |
|
2454 |
, ObjectMemory imageSaveTime printString |
|
2455 |
, ')' ). |
|
2456 |
] ifFalse:[ |
|
2457 |
Transcript showCR:(self hello). |
|
2458 |
Transcript showCR:(self copyrightString). |
|
2459 |
Transcript cr. |
|
2460 |
]. |
|
2461 |
Transcript cr. |
|
2462 |
]. |
|
2463 |
||
2464 |
DemoMode==true ifTrue:[ |
|
2465 |
Transcript showCR:'*** Restricted use: ***'. |
|
2466 |
Transcript showCR:'*** This program may be used for education only. ***'. |
|
2467 |
Transcript showCR:'*** Please read the files COPYRIGHT and LICENSE ***'. |
|
2468 |
Transcript showCR:'*** for more details. ***'. |
|
2469 |
Transcript cr. |
|
2470 |
]. |
|
2471 |
]. |
|
2472 |
||
2473 |
thisIsARestart ifTrue:[ |
|
2474 |
"/ |
|
2475 |
"/ the final late notification - users can now assume that |
|
2476 |
"/ views, forms etc. have been recreated. |
|
2477 |
||
2478 |
ObjectMemory changed:#returnFromSnapshot. |
|
2479 |
] |
|
7039
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2480 |
|
7040 | 2481 |
] newProcess. |
2482 |
||
7043
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
2483 |
process priority:8. |
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
2484 |
process name:'start block handler'. |
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
2485 |
process beGroupLeader. |
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
2486 |
process resume. |
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
2487 |
process := nil. |
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
2488 |
|
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
2489 |
|
2074
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
2490 |
"/ start a process, which evaluates the startupClass>>startupSelector |
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
2491 |
"/ message. |
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
2492 |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2493 |
(StartupClass notNil and:[StartupSelector notNil]) ifTrue:[ |
7616 | 2494 |
" |
2495 |
allow more customization by reading an image specific rc-file |
|
2496 |
" |
|
2497 |
thisIsARestart ifTrue:[ |
|
2498 |
(imageName asFilename hasSuffix:'img') ifTrue:[ |
|
2499 |
imageName := imageName copyWithoutLast:4 |
|
2500 |
]. |
|
2501 |
self fileIn:(imageName , '.rc') |
|
2502 |
]. |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2503 |
|
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2504 |
"/ Display notNil ifTrue:[ |
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2505 |
"/ Display exitOnLastClose:true. |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2506 |
"/ ]. |
2086 | 2507 |
"/ Processor exitWhenNoMoreUserProcesses:true. |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2508 |
|
7616 | 2509 |
process := [ |
2510 |
StandAlone ifTrue:[ |
|
2511 |
AbortSignal handle:[:ex | |
|
2512 |
OperatingSystem exit:1 |
|
2513 |
] do:[ |
|
2514 |
StartupClass perform:StartupSelector withArguments:StartupArguments. |
|
2515 |
] |
|
2516 |
] ifFalse:[ |
|
2517 |
StartupClass perform:StartupSelector withArguments:StartupArguments. |
|
2518 |
]. |
|
2519 |
||
2520 |
"/ |
|
2521 |
"/ non-GUI apps exit after the startup; |
|
2522 |
"/ assume that GUI apps have created & opened some view ... |
|
2523 |
"/ |
|
2524 |
Display isNil ifTrue:[ |
|
2525 |
Smalltalk exit. |
|
2526 |
]. |
|
2527 |
"/ |
|
2528 |
"/ GUI apps exit after the last user process has finished |
|
2529 |
"/ |
|
2530 |
Display exitOnLastClose:true. |
|
2531 |
Processor exitWhenNoMoreUserProcesses:true. |
|
2532 |
] newProcess. |
|
2533 |
process priority:8. |
|
2534 |
process name:'main'. |
|
2535 |
process beGroupLeader. |
|
2536 |
process resume. |
|
2537 |
process := true. "do not refer to process" |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2538 |
]. |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2539 |
|
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2540 |
" |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2541 |
if view-classes exist, start dispatching; |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2542 |
otherwise go into a read-eval-print loop |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2543 |
" |
4957 | 2544 |
((Display notNil and:[graphicalMode]) |
7043
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
2545 |
or:[process notNil |
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2546 |
or:[HeadlessOperation]]) ifTrue:[ |
7616 | 2547 |
Processor dispatchLoop. |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2548 |
] ifFalse:[ |
7616 | 2549 |
StandAlone ifFalse:[ |
2550 |
self readEvalPrint |
|
2551 |
] |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2552 |
]. |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2553 |
|
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2554 |
"done - the last process finished" |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2555 |
|
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2556 |
self exit |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2557 |
|
3062
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
2558 |
"Created: / 18.7.1996 / 21:07:39 / cg" |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
2559 |
"Modified: / 9.9.1996 / 17:42:50 / stefan" |
3483 | 2560 |
"Modified: / 25.5.1998 / 15:02:57 / cg" |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2561 |
! |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2562 |
|
7563 | 2563 |
readEvalPrint |
2564 |
"{ Pragma: +optSpace }" |
|
2565 |
||
2566 |
"simple read-eval-print loop for non-graphical Minitalk" |
|
453 | 2567 |
|
2568 |
|text| |
|
2569 |
||
2570 |
'ST- ' print. |
|
2571 |
Stdin skipSeparators. |
|
2572 |
Stdin atEnd ifFalse:[ |
|
7616 | 2573 |
text := Stdin nextChunk. |
2574 |
[text notNil] whileTrue:[ |
|
2575 |
AbortSignal handle:[:ex | |
|
2576 |
'evaluation aborted' printCR |
|
2577 |
] do:[ |
|
2578 |
Compiler isNil ifTrue:[ |
|
2579 |
'No evaluator class available (Compiler == nil)' printCR. |
|
2580 |
^ self |
|
2581 |
]. |
|
2582 |
(Compiler evaluate:text) printCR. |
|
2583 |
]. |
|
2584 |
'ST- ' print. |
|
2585 |
text := Stdin nextChunk |
|
2586 |
]. |
|
453 | 2587 |
]. |
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
2588 |
'' printCR |
453 | 2589 |
! |
2590 |
||
7563 | 2591 |
restart |
2592 |
"startup after an image has been loaded; |
|
2593 |
there are three change-notifications made to dependents of ObjectMemory, |
|
10 | 2594 |
which allow a stepwise re-init: #earlyRestart, #restarted and #returnFromSnapshot. |
335 | 2595 |
|
3096
881660d6e997
added #earlySystemInitialization change message (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3092
diff
changeset
|
2596 |
#earlySystemInstallation is sent for ST80 compatibility |
881660d6e997
added #earlySystemInitialization change message (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3092
diff
changeset
|
2597 |
|
10 | 2598 |
#earlyRestart is send first, nothing has been setup yet. |
8251
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2599 |
(should be used to flush all device dependent entries) |
335 | 2600 |
|
10 | 2601 |
#restarted is send right after. |
8251
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2602 |
(should be used to recreate external resources (fds, bitmaps etc) |
335 | 2603 |
|
10 | 2604 |
#returnFromSnapshot is sent last |
8251
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2605 |
(should be used to restart processes, reOpen Streams which cannot |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2606 |
be automatically be reopened (i.e. Sockets, Pipes) and so on. |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2607 |
(Notice that positionable fileStreams are already reopened and repositioned) |
1 | 2608 |
" |
10 | 2609 |
|
4503
99718971ba26
Redirect Transcript to Stderr during restart-initialization.
Stefan Vogel <sv@exept.de>
parents:
4490
diff
changeset
|
2610 |
|deb insp transcript idx| |
1 | 2611 |
|
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2612 |
"/ |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2613 |
"/ when we arrive here, all objects from our previous life |
3971 | 2614 |
"/ have been reloaded - however, some may still contain invalid device |
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2615 |
"/ handles, display information etc. |
3971 | 2616 |
"/ also, dynamically loaded modules have not yet been reloaded yet. |
2617 |
"/ and the concrete OS, concrete FileName etc. are still refering to |
|
2618 |
"/ the previous classes. |
|
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2619 |
|
1 | 2620 |
Initializing := true. |
3499 | 2621 |
AbstractOperatingSystem initializeConcreteClass. |
2622 |
||
8251
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2623 |
ImageRestartTime := Timestamp now. |
335 | 2624 |
|
1580
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2625 |
CommandLine := CommandLineArguments copy. |
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2626 |
CommandLineArguments := CommandLineArguments asOrderedCollection. |
6842 | 2627 |
CommandName := CommandLineArguments removeFirst. "/ the command |
1580
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2628 |
|
1582 | 2629 |
idx := CommandLineArguments indexOf:'-q'. |
6881 | 2630 |
idx == 0 ifTrue:[ |
8251
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2631 |
idx := CommandLineArguments indexOf:'--silent'. |
6881 | 2632 |
]. |
1582 | 2633 |
idx ~~ 0 ifTrue:[ |
8251
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2634 |
Object infoPrinting:false. |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2635 |
ObjectMemory infoPrinting:false. |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2636 |
CommandLineArguments removeAtIndex:idx. |
1582 | 2637 |
]. |
2638 |
||
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2639 |
"/ |
3971 | 2640 |
"/ start catching SIGSEGV and SIGBUS |
2641 |
||
2642 |
OperatingSystem enableHardSignalInterrupts. |
|
2643 |
||
2907 | 2644 |
"/ reinit Filename |
2645 |
Filename reinitialize. |
|
2646 |
||
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2647 |
"/ |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2648 |
"/ flush cached path directories (may have changed in the meanwhile) |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2649 |
|
329 | 2650 |
self flushPathCaches. |
1 | 2651 |
|
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2652 |
"/ |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2653 |
"/ reinit the default streams: Stdin, Stdout and Stderr |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2654 |
"/ after that, we can write to stderr. |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2655 |
|
477
8710aba7876b
oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents:
457
diff
changeset
|
2656 |
self reinitStandardStreams. |
8710aba7876b
oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents:
457
diff
changeset
|
2657 |
|
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2658 |
"/ |
4503
99718971ba26
Redirect Transcript to Stderr during restart-initialization.
Stefan Vogel <sv@exept.de>
parents:
4490
diff
changeset
|
2659 |
"/ redirect Transcript to Stderr during startup |
99718971ba26
Redirect Transcript to Stderr during restart-initialization.
Stefan Vogel <sv@exept.de>
parents:
4490
diff
changeset
|
2660 |
|
99718971ba26
Redirect Transcript to Stderr during restart-initialization.
Stefan Vogel <sv@exept.de>
parents:
4490
diff
changeset
|
2661 |
transcript := Transcript. |
99718971ba26
Redirect Transcript to Stderr during restart-initialization.
Stefan Vogel <sv@exept.de>
parents:
4490
diff
changeset
|
2662 |
Transcript := Stderr. |
99718971ba26
Redirect Transcript to Stderr during restart-initialization.
Stefan Vogel <sv@exept.de>
parents:
4490
diff
changeset
|
2663 |
|
99718971ba26
Redirect Transcript to Stderr during restart-initialization.
Stefan Vogel <sv@exept.de>
parents:
4490
diff
changeset
|
2664 |
"/ |
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2665 |
"/ temporary switch back to dumb interface - |
4503
99718971ba26
Redirect Transcript to Stderr during restart-initialization.
Stefan Vogel <sv@exept.de>
parents:
4490
diff
changeset
|
2666 |
"/ to handle errors while view-stuff is not yet reinitialized |
1 | 2667 |
|
2668 |
insp := Inspector. |
|
2669 |
deb := Debugger. |
|
684
3e0b5a8ec381
invalidate display connection during early startup
Claus Gittinger <cg@exept.de>
parents:
680
diff
changeset
|
2670 |
deb notNil ifTrue:[ |
8251
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2671 |
deb reinitialize |
684
3e0b5a8ec381
invalidate display connection during early startup
Claus Gittinger <cg@exept.de>
parents:
680
diff
changeset
|
2672 |
]. |
1 | 2673 |
Inspector := MiniInspector. |
2674 |
Debugger := MiniDebugger. |
|
2675 |
||
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2676 |
"/ reload any dynamically loaded objects. |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2677 |
"/ this must be done before doing anything else below, |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2678 |
"/ because the Processor may restart processes which use |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2679 |
"/ this code. |
3155
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
2680 |
"/ Also, a dynamic object might be registered as dependent of |
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
2681 |
"/ ObjectFileLoader; therefore, must reload before doing any notifications. |
335 | 2682 |
|
1100
eebf3ed54b23
reloadAllObjectFiles now called explicit (its too late via ObjMem changed)
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
2683 |
ObjectFileLoader notNil ifTrue:[ |
8251
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2684 |
ObjectFileLoader reloadAllRememberedObjectFiles. |
1100
eebf3ed54b23
reloadAllObjectFiles now called explicit (its too late via ObjMem changed)
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
2685 |
]. |
eebf3ed54b23
reloadAllObjectFiles now called explicit (its too late via ObjMem changed)
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
2686 |
|
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2687 |
"/ |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2688 |
"/ invalidate all display connections. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2689 |
"/ This is required to avoid trouble if someone accesses |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2690 |
"/ a display during early startup. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2691 |
|
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2692 |
Screen notNil ifTrue:[ |
8251
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2693 |
Screen allScreens do:[:aDisplay | |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2694 |
aDisplay invalidateConnection |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2695 |
]. |
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2696 |
]. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2697 |
|
3155
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
2698 |
ObjectMemory changed:#earlySystemInstallation. |
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
2699 |
|
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2700 |
"/ |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2701 |
"/ reinitialize the Processor - restartable processes |
4109 | 2702 |
"/ are now restarted here (but not yet scheduled). |
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2703 |
"/ |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2704 |
Processor reinitialize. |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2705 |
|
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2706 |
"/ |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2707 |
"/ flush device handles & recreate OS resources (if possible) |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2708 |
"/ (mostly view/GC/color & font stuff) |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2709 |
|
3022 | 2710 |
ObjectMemory |
8251
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2711 |
changed:#earlyRestart; changed:#restarted. |
1 | 2712 |
|
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2713 |
"/ |
3526
78245608c0b8
no need for last change (restarting processes).
Claus Gittinger <cg@exept.de>
parents:
3523
diff
changeset
|
2714 |
"/ start catching SIGINT and SIGQUIT |
78245608c0b8
no need for last change (restarting processes).
Claus Gittinger <cg@exept.de>
parents:
3523
diff
changeset
|
2715 |
|
78245608c0b8
no need for last change (restarting processes).
Claus Gittinger <cg@exept.de>
parents:
3523
diff
changeset
|
2716 |
OperatingSystem enableUserInterrupts. |
6390
41d5c47c33f0
Catch sigPWR and sigHUP on restart
Stefan Vogel <sv@exept.de>
parents:
6366
diff
changeset
|
2717 |
OperatingSystem enableCrashSignalInterrupts. |
3526
78245608c0b8
no need for last change (restarting processes).
Claus Gittinger <cg@exept.de>
parents:
3523
diff
changeset
|
2718 |
|
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2719 |
"/ give user a chance to re-customize things |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2720 |
"/ reading if smalltalk_r.rc may be suppressed by the |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2721 |
"/ -fastStart argument. |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2722 |
|
6881 | 2723 |
idx := CommandLineArguments indexOf:'--faststart'. |
1580
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2724 |
idx ~~ 0 ifTrue:[ |
8251
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2725 |
CommandLineArguments removeAtIndex:idx. |
1580
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2726 |
] ifFalse:[ |
8251
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2727 |
CallbackSignal := QuerySignal new. |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2728 |
[ |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2729 |
Class withoutUpdatingChangesDo:[ |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2730 |
(self fileIn:(self commandName , '_r.rc')) ifFalse:[ |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2731 |
"no _r.rc file where executable is; try default smalltalk_r.rc" |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2732 |
self fileIn:'smalltalk_r.rc' |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2733 |
]. |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2734 |
] |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2735 |
] on:CallbackSignal do:[:ex| |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2736 |
"/ now, display and view-stuff works; |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2737 |
"/ back to the previous debugging interface |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2738 |
|
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2739 |
Inspector := insp. |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2740 |
Debugger := deb. |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2741 |
|
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2742 |
"/ reinstall Transcript, if not changed during restart. |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2743 |
"/ if there was no Transcript, go to stderr |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2744 |
|
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2745 |
(transcript notNil and:[Transcript == Stderr]) ifTrue:[ |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2746 |
Transcript := transcript. |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2747 |
]. |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2748 |
Initializing := false. |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2749 |
ex proceed. |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2750 |
]. |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2751 |
CallbackSignal := nil. |
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2752 |
]. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2753 |
|
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2754 |
"/ reinitialization (restart) of Display is normally performed |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2755 |
"/ in the restart script. If this has not been run for some reason, |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2756 |
"/ do in now. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2757 |
Initializing ifTrue:[ |
8251
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2758 |
Display notNil ifTrue:[ |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2759 |
[ |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2760 |
Display reinitializeFor:Screen defaultDisplayName. |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2761 |
] on:Screen deviceOpenErrorSignal do:[ |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2762 |
'Smalltalk [error]: Cannot restart connection to: ' errorPrint. |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2763 |
Screen defaultDisplayName errorPrintCR. |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2764 |
OperatingSystem exit:1. |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2765 |
]. |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2766 |
]. |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2767 |
"/ now, display and view-stuff works; |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2768 |
"/ back to the previous debugging interface |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2769 |
|
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2770 |
Inspector := insp. |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2771 |
Debugger := deb. |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2772 |
|
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2773 |
"/ reinstall Transcript, if not changed during restart. |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2774 |
"/ if there was no Transcript, go to stderr |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2775 |
|
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2776 |
(transcript notNil and:[Transcript == Stderr]) ifTrue:[ |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2777 |
Transcript := transcript. |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2778 |
]. |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2779 |
Initializing := false. |
7 | 2780 |
]. |
2781 |
||
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2782 |
self mainStartup:true |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2783 |
|
3526
78245608c0b8
no need for last change (restarting processes).
Claus Gittinger <cg@exept.de>
parents:
3523
diff
changeset
|
2784 |
"Modified: / 7.6.1998 / 02:48:00 / cg" |
4503
99718971ba26
Redirect Transcript to Stderr during restart-initialization.
Stefan Vogel <sv@exept.de>
parents:
4490
diff
changeset
|
2785 |
"Modified: / 3.8.1999 / 09:42:21 / stefan" |
1 | 2786 |
! |
2787 |
||
7563 | 2788 |
start |
2789 |
"main startup, if there is a Display, initialize it |
|
2790 |
and start dispatching; otherwise go into a read-eval-print loop." |
|
617 | 2791 |
|
6852
7e4ea7876711
more changes for better standAlone operation
Claus Gittinger <cg@exept.de>
parents:
6851
diff
changeset
|
2792 |
|idx graphicalMode arg didReadRCFile| |
960
e3b75f50d0cd
changes for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
2793 |
|
e3b75f50d0cd
changes for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
2794 |
graphicalMode := true. |
617 | 2795 |
Initializing := true. |
2796 |
||
2797 |
" |
|
2798 |
while reading patches- and rc-file, do not add things into change-file |
|
2799 |
" |
|
2800 |
Class withoutUpdatingChangesDo:[ |
|
7694
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2801 |
|myName defaultRC prevCatchSetting| |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2802 |
|
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2803 |
"/ |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2804 |
"/ look for any '-q', '-e' or '-f' command line arguments |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2805 |
"/ and handle them; |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2806 |
"/ read startup and patches file |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2807 |
"/ |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2808 |
idx := CommandLineArguments indexOf:'-q'. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2809 |
idx == 0 ifTrue:[ |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2810 |
idx := CommandLineArguments indexOf:'--silent'. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2811 |
]. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2812 |
idx ~~ 0 ifTrue:[ |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2813 |
Object infoPrinting:false. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2814 |
ObjectMemory infoPrinting:false. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2815 |
CommandLineArguments removeAtIndex:idx. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2816 |
]. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2817 |
|
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2818 |
StandAlone ifFalse:[ |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2819 |
"/ look for a '-e filename' or '--execute filename' argument |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2820 |
"/ this will force fileIn of filename only, no standard startup. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2821 |
|
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2822 |
idx := CommandLineArguments indexOf:'-e'. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2823 |
idx == 0 ifTrue:[ |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2824 |
idx := CommandLineArguments indexOf:'--execute'. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2825 |
]. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2826 |
idx ~~ 0 ifTrue:[ |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2827 |
arg := CommandLineArguments at:idx + 1. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2828 |
|
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2829 |
CommandLineArguments |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2830 |
removeAtIndex:idx+1; removeAtIndex:idx. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2831 |
|
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2832 |
arg = '-' ifTrue:[ |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2833 |
self fileInStream:Stdin |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2834 |
lazy:nil |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2835 |
silent:nil |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2836 |
logged:false |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2837 |
addPath:nil |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2838 |
] ifFalse:[ |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2839 |
self fileIn:arg. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2840 |
]. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2841 |
self exit |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2842 |
]. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2843 |
|
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2844 |
"/ look for a '-E expr' or '--eval expr' argument |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2845 |
"/ this will force evaluation of expr only, no standard startup |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2846 |
idx := CommandLineArguments indexOf:'-E'. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2847 |
idx == 0 ifTrue:[ |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2848 |
idx := CommandLineArguments indexOf:'--eval'. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2849 |
]. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2850 |
idx ~~ 0 ifTrue:[ |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2851 |
arg := CommandLineArguments at:idx + 1. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2852 |
|
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2853 |
CommandLineArguments |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2854 |
removeAtIndex:idx+1; removeAtIndex:idx. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2855 |
|
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2856 |
self |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2857 |
fileInStream:arg readStream |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2858 |
lazy:nil |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2859 |
silent:nil |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2860 |
logged:false |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2861 |
addPath:nil. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2862 |
|
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2863 |
self exit |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2864 |
]. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2865 |
]. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2866 |
|
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2867 |
"/ look for a '-f filename' or '--file filename' argument |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2868 |
"/ this will force evaluation of filename instead of smalltalk.rc |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2869 |
|
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2870 |
idx := CommandLineArguments indexOf:'-f'. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2871 |
idx == 0 ifTrue:[ |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2872 |
idx := CommandLineArguments indexOf:'--file'. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2873 |
]. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2874 |
idx ~~ 0 ifTrue:[ |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2875 |
myName := (CommandLineArguments at:idx + 1). |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2876 |
CommandLineArguments |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2877 |
removeAtIndex:idx+1; removeAtIndex:idx. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2878 |
CommandLine at:1 put:myName. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2879 |
CommandName := myName. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2880 |
(self secureFileIn:myName) ifFalse:[ |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2881 |
('Smalltalk [error]: startup file ', myName, ' not found.') errorPrintCR. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2882 |
OperatingSystem exit:1. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2883 |
]. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2884 |
] ifFalse:[ |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2885 |
"/ look for <command>.rc |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2886 |
"/ if not found, read smalltalk.rc (or stxapp.rc for standAlone operation) |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2887 |
|
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2888 |
didReadRCFile := false. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2889 |
|
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2890 |
myName := self commandName asFilename withSuffix:'rc'. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2891 |
(didReadRCFile := self secureFileIn:myName) ifFalse:[ |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2892 |
StandAlone ifFalse:[ |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2893 |
defaultRC := 'smalltalk.rc' |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2894 |
] ifTrue:[ |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2895 |
defaultRC := 'stxapp.rc' |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2896 |
]. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2897 |
|
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2898 |
didReadRCFile := self secureFileIn:defaultRC. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2899 |
didReadRCFile ifFalse:[ |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2900 |
StandAlone ifFalse:[ |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2901 |
'Smalltalk [warning]: no startup rc-file found. Going into line-by-line interpreter.' infoPrintCR. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2902 |
graphicalMode := false. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2903 |
] |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2904 |
] |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2905 |
]. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2906 |
|
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2907 |
"/ ('StandAlone is %1' bindWith:StandAlone) printCR. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2908 |
"/ ('Headless is %1' bindWith:HeadlessOperation) printCR. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2909 |
"/ ('Display is %1' bindWith:Display) printCR. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2910 |
"/ ('Screen is %1' bindWith:Screen) printCR. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2911 |
|
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2912 |
didReadRCFile ifFalse:[ |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2913 |
StandAlone ifFalse:[ |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2914 |
"/ its a smalltalk - proceed in interpreter. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2915 |
'Smalltalk [warning]: no startup rc-file found. Going into line-by-line interpreter.' infoPrintCR. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2916 |
graphicalMode := false. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2917 |
] ifTrue:[ |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2918 |
"/ its an application - try harder |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2919 |
|
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2920 |
Screen notNil ifTrue:[ |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2921 |
[ |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2922 |
Screen openDefaultDisplay:nil. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2923 |
] on:Screen deviceOpenErrorSignal do:[:ex| |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2924 |
('Smalltalk [error]: No Display connection to: ', ex parameter printString) errorPrintCR. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2925 |
'Smalltalk [info]: Either set the DISPLAY environment variable,' infoPrintCR. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2926 |
'Smalltalk [info]: or start smalltalk with a -display argument.' infoPrintCR. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2927 |
HeadlessOperation == true ifFalse:[ |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2928 |
OperatingSystem exit:1. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2929 |
]. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2930 |
]. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2931 |
|
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2932 |
Display notNil ifTrue:[ |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2933 |
(self secureFileIn:'display.rc') ifFalse:[ |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2934 |
'Smalltalk [warning]: no display.rc found; screen setting might be wrong.' infoPrintCR. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2935 |
] |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2936 |
]. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2937 |
] |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2938 |
] |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2939 |
]. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2940 |
]. |
617 | 2941 |
]. |
2942 |
||
6841
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
2943 |
StandAlone ifFalse:[ |
7694
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2944 |
" |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2945 |
enable the graphical debugger/inspector |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2946 |
(they could have been (re)defined as autoloaded in the patches file) |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2947 |
" |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2948 |
self initStandardTools. |
963
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
2949 |
]. |
617 | 2950 |
|
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2951 |
(Display isNil or:[HeadlessOperation]) ifTrue:[ |
7694
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
2952 |
graphicalMode := false. |
2074
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
2953 |
]. |
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
2954 |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2955 |
self mainStartup:graphicalMode |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2956 |
|
5146 | 2957 |
"Modified: / 24.12.1999 / 00:26:54 / cg" |
1097 | 2958 |
! ! |
2959 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
2960 |
!Smalltalk class methodsFor:'startup queries'! |
1097 | 2961 |
|
7563 | 2962 |
commandLine |
2963 |
"return the full command line arguments (with which ST/X was started)" |
|
1580
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2964 |
|
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2965 |
^ CommandLine |
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2966 |
|
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2967 |
"Created: 19.7.1996 / 11:09:06 / cg" |
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2968 |
! |
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2969 |
|
7563 | 2970 |
commandLineArgumentNamed:aString |
2971 |
"extract a named argument from the command line arguments." |
|
6806 | 2972 |
|
2973 |
|args index| |
|
2974 |
||
2975 |
args := self commandLineArguments. |
|
2976 |
index := args indexOf:aString. |
|
2977 |
(index between:1 and:(args size - 1)) ifTrue:[ |
|
7616 | 2978 |
^ args at:index+1 |
6806 | 2979 |
]. |
2980 |
^ nil. |
|
2981 |
||
2982 |
" |
|
2983 |
self commandLineArgumentNamed:'-display' |
|
2984 |
" |
|
2985 |
! |
|
2986 |
||
7563 | 2987 |
commandLineArguments |
2988 |
"return the user command line arguments; |
|
2989 |
This is a collection of strings (separated command line words), |
|
1580
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2990 |
from which the internal startup arguments have already been removed. |
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2991 |
I.e. if started with: 'smalltalk -I -f xxx foo bar baz', |
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2992 |
the commandLineArguments will be #('foo' 'bar' 'baz'). |
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2993 |
In contrast, the value returned by #commandLine will be the full set of words." |
1097 | 2994 |
|
2995 |
^ CommandLineArguments |
|
1580
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2996 |
|
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2997 |
"Modified: 19.7.1996 / 11:11:03 / cg" |
1097 | 2998 |
! |
2999 |
||
7563 | 3000 |
commandName |
3001 |
"return the excutables name - this is normally 'smalltalk', but |
|
3002 |
can be something else for standAlone apps." |
|
1580
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
3003 |
|
6842 | 3004 |
^ CommandName. |
1580
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
3005 |
|
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
3006 |
"Modified: 19.7.1996 / 11:11:16 / cg" |
1097 | 3007 |
! |
3008 |
||
7563 | 3009 |
isHeadless |
3010 |
"return true, if this is a headless application |
|
3011 |
i.e. no default Display connection is required/used" |
|
4957 | 3012 |
|
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3013 |
^ HeadlessOperation |
4957 | 3014 |
! |
3015 |
||
7563 | 3016 |
isStandAloneApp |
3017 |
"return true, if this is a standAlone application |
|
3018 |
(in contrast to a full smalltalk system)." |
|
1097 | 3019 |
|
3020 |
^ StandAlone |
|
617 | 3021 |
! |
3022 |
||
7563 | 3023 |
startupArguments |
3024 |
"return the arguments passed to StartupClass" |
|
3025 |
||
3026 |
^ StartupArguments |
|
3027 |
! |
|
3028 |
||
3029 |
startupClass |
|
3030 |
"return the class, that will get the start message when smalltalk |
|
70 | 3031 |
starts and its non-nil. Usually this is nil, but saving an image |
3032 |
with a non-nil StartupClass allows stand-alone applications" |
|
3033 |
||
3034 |
^ StartupClass |
|
3035 |
! |
|
3036 |
||
7563 | 3037 |
startupClass:aClass selector:aSymbol arguments:anArrayOrNil |
3038 |
"{ Pragma: +optSpace }" |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
3039 |
|
617 | 3040 |
"set the class, selector and arguments to be performed when smalltalk |
3041 |
starts. Setting those before saving a snapshot, will make the saved |
|
3042 |
image come up executing your application (instead of the normal mainloop)" |
|
3043 |
||
3044 |
StartupClass := aClass. |
|
3045 |
StartupSelector := aSymbol. |
|
3046 |
StartupArguments := anArrayOrNil |
|
3047 |
! |
|
3048 |
||
7563 | 3049 |
startupSelector |
3050 |
"return the selector, that will be sent to StartupClass" |
|
3051 |
||
3052 |
^ StartupSelector |
|
7811 | 3053 |
! |
3054 |
||
3055 |
wasStartedFromImage |
|
7819 | 3056 |
^ ImageRestartTime notNil |
7811 | 3057 |
|
3058 |
" |
|
3059 |
Smalltalk wasStartedFromImage |
|
3060 |
" |
|
70 | 3061 |
! ! |
3062 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
3063 |
!Smalltalk class methodsFor:'system environment'! |
1069 | 3064 |
|
7563 | 3065 |
language |
3066 |
"return the language setting" |
|
3067 |
||
3068 |
^ Language |
|
3069 |
||
3070 |
" |
|
3071 |
Smalltalk language |
|
1307 | 3072 |
" |
3073 |
||
3074 |
"Modified: 26.4.1996 / 17:10:05 / cg" |
|
3075 |
! |
|
3076 |
||
7563 | 3077 |
language:aLanguageSymbol |
3078 |
"set the language" |
|
3079 |
||
3080 |
Language := aLanguageSymbol. |
|
1307 | 3081 |
self changed:#Language |
3082 |
||
3083 |
" |
|
3084 |
Smalltalk language:#de |
|
3085 |
" |
|
3086 |
||
3087 |
"Modified: 26.4.1996 / 17:13:34 / cg" |
|
1069 | 3088 |
! |
3089 |
||
7563 | 3090 |
languageTerritory |
3091 |
"return the language territory setting" |
|
3092 |
||
3093 |
^ LanguageTerritory |
|
3094 |
! |
|
3095 |
||
3096 |
languageTerritory:aTerritorySymbol |
|
3097 |
"set the language territory" |
|
3098 |
||
3099 |
LanguageTerritory := aTerritorySymbol. |
|
1307 | 3100 |
self changed:#LanguageTerritory |
3101 |
||
3102 |
" |
|
3103 |
Time now |
|
3104 |
||
3105 |
Smalltalk languageTerritory:#us. |
|
3106 |
Time now |
|
3107 |
||
3108 |
Smalltalk languageTerritory:#de. |
|
3109 |
Time now |
|
3110 |
" |
|
3111 |
||
3112 |
"Modified: 26.4.1996 / 17:12:39 / cg" |
|
7992 | 3113 |
! |
3114 |
||
3115 |
setLanguage:aLanguageSymbol |
|
3116 |
"set the language withotu change notifications" |
|
3117 |
||
3118 |
Language := aLanguageSymbol. |
|
1069 | 3119 |
! ! |
3120 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
3121 |
!Smalltalk class methodsFor:'system management'! |
70 | 3122 |
|
7563 | 3123 |
compressSources |
3124 |
"{ Pragma: +optSpace }" |
|
3125 |
||
3126 |
"compress the sources file, and remove all method source strings |
|
617 | 3127 |
from the system and replace them by refs to a string in the source file. |
3128 |
This is a bit different in ST/X than in other smalltalks, |
|
3129 |
since we use per-class sourcefiles for the compiled classes, |
|
3130 |
and a mix of in-memory strings and one-for-all sourceFile for |
|
3131 |
incremental compiled methods. |
|
3132 |
Therefore, only those sources which are not coming from compiled |
|
3133 |
methods are put into the 'st.src' file - all others are untouched. |
|
3134 |
This is being automated - so dont care for now." |
|
3135 |
||
7105
44c02807ca41
More openErrorSignal change preparations
Stefan Vogel <sv@exept.de>
parents:
7085
diff
changeset
|
3136 |
|newStream table source pos fileName| |
44c02807ca41
More openErrorSignal change preparations
Stefan Vogel <sv@exept.de>
parents:
7085
diff
changeset
|
3137 |
|
617 | 3138 |
" |
3139 |
first, find all methods which contain either a string-ref |
|
3140 |
or an external string in the 'st.src' file |
|
3141 |
" |
|
3142 |
newStream := 'src.tmp' asFilename writeStream. |
|
7105
44c02807ca41
More openErrorSignal change preparations
Stefan Vogel <sv@exept.de>
parents:
7085
diff
changeset
|
3143 |
newStream checkNilFileStream. |
617 | 3144 |
|
3145 |
table := IdentityDictionary new:100. |
|
3146 |
||
3147 |
Method allSubInstancesDo:[:aMethod | |
|
7616 | 3148 |
source := nil. |
3149 |
aMethod sourcePosition notNil ifTrue:[ |
|
3150 |
aMethod sourceFilename = 'st.src' ifTrue:[ |
|
3151 |
source := aMethod source. |
|
3152 |
] |
|
3153 |
] ifFalse:[ |
|
3154 |
source := aMethod source |
|
3155 |
]. |
|
3156 |
||
3157 |
source notNil ifTrue:[ |
|
3158 |
pos := newStream position1Based. |
|
3159 |
newStream nextChunkPut:source. |
|
3160 |
||
3161 |
" |
|
3162 |
dont change the methods info - maybe some write error |
|
3163 |
occurs later, in that case we abort and leave everything |
|
3164 |
untouched. |
|
3165 |
" |
|
3166 |
table at:aMethod put:pos |
|
3167 |
] |
|
617 | 3168 |
]. |
3169 |
||
3170 |
newStream close. |
|
3171 |
||
3172 |
" |
|
3173 |
now, rename the new source file, |
|
3174 |
" |
|
3175 |
fileName := (ObjectMemory nameForSources). |
|
1693 | 3176 |
'src.tmp' asFilename renameTo:fileName. |
617 | 3177 |
|
3178 |
"good - now go over all changed methods, and change their |
|
3179 |
source reference" |
|
3180 |
||
3181 |
table keysAndValuesDo:[:aMethod :pos | |
|
7616 | 3182 |
aMethod localSourceFilename:fileName position:pos. |
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
3183 |
"/ aMethod printCR. |
617 | 3184 |
]. |
3185 |
||
3186 |
" |
|
3187 |
Smalltalk compressSources |
|
3188 |
" |
|
1693 | 3189 |
|
2176
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2170
diff
changeset
|
3190 |
"Modified: 16.1.1997 / 01:25:58 / cg" |
617 | 3191 |
! |
3192 |
||
7563 | 3193 |
generateSingleSourceFile |
3194 |
"{ Pragma: +optSpace }" |
|
3195 |
||
3196 |
"generate the sources file, and remove all method source strings |
|
3044 | 3197 |
from the system and replace them by refs to a string in the source file. |
3198 |
This makes the image independent from the per-class source files |
|
3199 |
and makes transportation of endUser applications easier, since |
|
3200 |
only 3 files (executable, image and sourceFile) need to be |
|
3201 |
transported." |
|
3202 |
||
3203 |
|newStream table source pos fileName| |
|
3204 |
||
3205 |
newStream := 'src.tmp' asFilename writeStream. |
|
7105
44c02807ca41
More openErrorSignal change preparations
Stefan Vogel <sv@exept.de>
parents:
7085
diff
changeset
|
3206 |
newStream checkNilFileStream. |
3044 | 3207 |
|
3208 |
table := IdentityDictionary new:100. |
|
3209 |
||
3210 |
Method allSubInstancesDo:[:aMethod | |
|
7616 | 3211 |
source := aMethod source. |
3212 |
source notNil ifTrue:[ |
|
3213 |
pos := newStream position1Based. |
|
3214 |
newStream nextChunkPut:source. |
|
3215 |
||
3216 |
" |
|
3217 |
dont change the methods info - maybe some write error |
|
3218 |
occurs later, in that case we abort and leave everything |
|
3219 |
untouched. |
|
3220 |
" |
|
3221 |
table at:aMethod put:pos |
|
3222 |
] |
|
3044 | 3223 |
]. |
3224 |
||
3225 |
newStream close. |
|
3226 |
||
3227 |
" |
|
3228 |
now, rename the new source file, |
|
3229 |
" |
|
3230 |
fileName := (ObjectMemory nameForSources). |
|
3231 |
'src.tmp' asFilename renameTo:fileName. |
|
3232 |
||
3233 |
"good - now go over all changed methods, and change their |
|
3234 |
source reference" |
|
3235 |
||
3236 |
table keysAndValuesDo:[:aMethod :pos | |
|
7616 | 3237 |
aMethod localSourceFilename:fileName position:pos. |
3044 | 3238 |
"/ aMethod printCR. |
3239 |
]. |
|
3240 |
||
3241 |
" |
|
3242 |
Smalltalk generateSingleSourceFile |
|
3243 |
" |
|
3244 |
||
3245 |
"Modified: 16.1.1997 / 01:25:58 / cg" |
|
3246 |
"Created: 17.10.1997 / 13:00:56 / cg" |
|
3247 |
! |
|
3248 |
||
7565 | 3249 |
installAutoloadedClassNamed:clsName category:cat package:package revision:revisionOrNil |
3250 |
"create & install an autoload stub for a class named: clsName, |
|
3251 |
to be loaded from package. |
|
3252 |
If revisionOrNil is non-nil, set it up to load exactly that revision |
|
3253 |
(otherwise, the newest revision will be loaded" |
|
3254 |
||
3255 |
self |
|
7616 | 3256 |
installAutoloadedClassNamed:clsName |
3257 |
category:cat |
|
3258 |
package:package |
|
3259 |
revision:revisionOrNil |
|
3260 |
numClassInstVars:nil. |
|
7565 | 3261 |
! |
3262 |
||
3263 |
installAutoloadedClassNamed:clsName category:cat package:package revision:revisionOrNil numClassInstVars:numClassInstVarsOrNil |
|
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3264 |
"create & install an autoload stub for a class named: clsName, |
3915
e32e63ee0d79
extracted autoload-class generation into extra method
Claus Gittinger <cg@exept.de>
parents:
3866
diff
changeset
|
3265 |
to be loaded from package. |
e32e63ee0d79
extracted autoload-class generation into extra method
Claus Gittinger <cg@exept.de>
parents:
3866
diff
changeset
|
3266 |
If revisionOrNil is non-nil, set it up to load exactly that revision |
e32e63ee0d79
extracted autoload-class generation into extra method
Claus Gittinger <cg@exept.de>
parents:
3866
diff
changeset
|
3267 |
(otherwise, the newest revision will be loaded" |
e32e63ee0d79
extracted autoload-class generation into extra method
Claus Gittinger <cg@exept.de>
parents:
3866
diff
changeset
|
3268 |
|
7565 | 3269 |
|clsSym cls| |
3270 |
||
3271 |
clsSym := clsName asSymbol. |
|
3272 |
||
3273 |
"/ install if not already compiled-in |
|
3274 |
(cls := self at:clsSym) isNil ifTrue:[ |
|
7694
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3275 |
Autoload subclass:clsSym |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3276 |
instanceVariableNames:'' |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3277 |
classVariableNames:'' |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3278 |
poolDictionaries:'' |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3279 |
category:cat |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3280 |
inEnvironment:Smalltalk. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3281 |
|
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3282 |
cls := self at:clsSym. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3283 |
cls isNil ifTrue:[ |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3284 |
('Smalltalk [warning]: failed to install ' , clsName , ' as autoloaded.') infoPrintCR. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3285 |
] ifFalse:[ |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3286 |
cls package:package asSymbol. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3287 |
revisionOrNil notNil ifTrue:[ |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3288 |
cls setBinaryRevision:revisionOrNil |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3289 |
] |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3290 |
] |
7565 | 3291 |
] ifFalse:[ |
7694
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3292 |
"/ class already present - however, check for category/package change |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3293 |
package ~= cls package ifTrue:[ |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3294 |
cls package:package asSymbol. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3295 |
]. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3296 |
cat ~= cls category ifTrue:[ |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3297 |
cls category:cat. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3298 |
]. |
7565 | 3299 |
]. |
3300 |
||
3301 |
"Created: / 5.11.1998 / 15:10:25 / cg" |
|
3915
e32e63ee0d79
extracted autoload-class generation into extra method
Claus Gittinger <cg@exept.de>
parents:
3866
diff
changeset
|
3302 |
! |
e32e63ee0d79
extracted autoload-class generation into extra method
Claus Gittinger <cg@exept.de>
parents:
3866
diff
changeset
|
3303 |
|
7563 | 3304 |
installAutoloadedClasses |
3305 |
"read the standard abbreviation file; install all classes found there as |
|
3044 | 3306 |
autoloaded. This takes some time ..." |
3307 |
||
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3308 |
|dirsConsulted p| |
4458 | 3309 |
|
3310 |
"/ new scheme: look for a directory called 'packages' |
|
3311 |
"/ and enumerate its abbrev.stc files... |
|
5067
335c866e150c
walk packagePath when reading abbrevs & autoloaded classes.
Claus Gittinger <cg@exept.de>
parents:
5065
diff
changeset
|
3312 |
dirsConsulted := Set new. |
5162 | 3313 |
|
3314 |
"/ along the package-path |
|
5788 | 3315 |
(p := self packagePath) do:[:aPath | |
7616 | 3316 |
(dirsConsulted includes:aPath) ifFalse:[ |
3317 |
('Smalltalk [info]: installing autoloaded classes found under ''' , aPath ,'''') infoPrintCR. |
|
3318 |
self |
|
3319 |
recursiveInstallAutoloadedClassesFrom:aPath |
|
3320 |
rememberIn:dirsConsulted |
|
3321 |
maxLevels:15 |
|
3322 |
noAutoload:false |
|
3323 |
packageTop:aPath. |
|
3324 |
] |
|
5788 | 3325 |
]. |
3326 |
p size == 0 ifTrue:[ |
|
7616 | 3327 |
('Smalltalk [info]: installing autoloaded classes found under ''../../..''') infoPrintCR. |
3328 |
self |
|
3329 |
recursiveInstallAutoloadedClassesFrom:'../../..' |
|
3330 |
rememberIn:dirsConsulted |
|
3331 |
maxLevels:15 |
|
3332 |
noAutoload:false |
|
3333 |
packageTop:'../../..'. |
|
5788 | 3334 |
]. |
3335 |
||
3044 | 3336 |
" |
3337 |
Smalltalk installAutoloadedClasses |
|
3338 |
" |
|
3339 |
||
5096 | 3340 |
"Created: / 14.2.1997 / 17:32:57 / cg" |
3341 |
"Modified: / 13.12.1999 / 11:56:50 / cg" |
|
3044 | 3342 |
! |
3343 |
||
7758 | 3344 |
installAutoloadedClassesFrom:anAbbrevFilePath |
3345 |
"read the given abbreviation file; install all classes found there as |
|
3346 |
autoloaded. This takes some time ..." |
|
3347 |
||
3348 |
|f s| |
|
3349 |
||
3350 |
f := self getSystemFileName:anAbbrevFilePath. |
|
3351 |
f isNil ifTrue:[f := self getPackageFileName:anAbbrevFilePath]. |
|
3352 |
||
3353 |
f notNil ifTrue:[ |
|
3354 |
f := f asFilename. |
|
3355 |
f isDirectory ifTrue:[ |
|
3356 |
f := f construct:'abbrev.stc' |
|
3357 |
]. |
|
3358 |
[ |
|
3359 |
s := f readStream. |
|
3360 |
self installAutoloadedClassesFromStream:s. |
|
3361 |
s close. |
|
3362 |
] on:FileStream openErrorSignal do:[:ex| "do nothing"]. |
|
3363 |
] |
|
3364 |
||
3365 |
" |
|
3366 |
Smalltalk installAutoloadedClassesFrom:'include/abbrev.stc' |
|
3367 |
" |
|
3368 |
||
3369 |
"Modified: / 5.11.1998 / 15:10:51 / cg" |
|
3370 |
! |
|
3371 |
||
3372 |
installAutoloadedClassesFromStream:anAbbrevFileStream |
|
3373 |
"read the given abbreviation file; |
|
3374 |
install all classes found there as autoloaded, and also update the |
|
3375 |
abbreviation (className-to-fileName mapping) table. |
|
3376 |
This takes some time ..." |
|
3377 |
||
3378 |
|s2 l clsName abbrev package cat numClassInstVars cls words w abbrevs oldAbbrev nameKey| |
|
3379 |
||
3380 |
"/ on the fly, update the abbreviations |
|
3381 |
||
3382 |
CachedAbbreviations isNil ifTrue:[ |
|
7759 | 3383 |
CachedAbbreviations := IdentityDictionary new. |
7758 | 3384 |
]. |
3385 |
abbrevs := CachedAbbreviations. |
|
3386 |
||
3387 |
KnownPackages isNil ifTrue:[ |
|
7759 | 3388 |
KnownPackages := Set new. |
7758 | 3389 |
]. |
3390 |
||
3391 |
"/ yes, create any required nameSpace, without asking user. |
|
3392 |
Class createNameSpaceQuerySignal answer:true do:[ |
|
3393 |
||
7759 | 3394 |
[anAbbrevFileStream atEnd] whileFalse:[ |
3395 |
l := anAbbrevFileStream nextLine withoutSeparators. |
|
3396 |
l notEmpty ifTrue:[ |
|
3397 |
"/ must do it manually, caring for quoted strings. |
|
7758 | 3398 |
"/ words := line asCollectionOfWords. |
3399 |
||
7759 | 3400 |
words := OrderedCollection new. |
3401 |
s2 := l readStream. |
|
3402 |
[s2 atEnd] whileFalse:[ |
|
3403 |
s2 skipSeparators. |
|
3404 |
s2 peek == $' ifTrue:[ |
|
3405 |
s2 next. |
|
3406 |
w := s2 upTo:$'. |
|
3407 |
s2 skipSeparators. |
|
3408 |
] ifFalse:[ |
|
3409 |
w := s2 upToSeparator |
|
3410 |
]. |
|
3411 |
words add:w |
|
3412 |
]. |
|
3413 |
words size < 3 ifTrue:[ |
|
3414 |
'Smalltalk [warning]: bad abbrev entry' errorPrint. |
|
3415 |
anAbbrevFileStream isFileStream ifTrue:[ |
|
3416 |
' (in ''' errorPrint. |
|
3417 |
anAbbrevFileStream pathName errorPrint. |
|
3418 |
''')' errorPrint |
|
3419 |
]. |
|
3420 |
': ' errorPrint. l errorPrintCR |
|
3421 |
] ifFalse:[ |
|
3422 |
clsName := (words at:1) asSymbol. |
|
3423 |
abbrev := (words at:2). |
|
3424 |
package := (words at:3) asSymbol. |
|
3425 |
cat := words at:4 ifAbsent:nil. |
|
3426 |
numClassInstVars := words at:5 ifAbsent:'0'. |
|
3427 |
numClassInstVars := Integer readFrom:numClassInstVars onError:[0]. |
|
7758 | 3428 |
|
3429 |
"/ KnownPackages add:package. |
|
3430 |
||
7759 | 3431 |
(cat size == 0) ifTrue:[ |
3432 |
cat := 'autoloaded' |
|
3433 |
]. |
|
3434 |
||
3435 |
"/ on the fly, update the abbreviations |
|
3436 |
clsName ~= abbrev ifTrue:[ |
|
3437 |
nameKey := clsName asSymbol. |
|
3438 |
oldAbbrev := abbrevs at:nameKey ifAbsent:nil. |
|
3439 |
(oldAbbrev notNil and:[oldAbbrev ~= abbrev]) ifTrue:[ |
|
3440 |
StandAlone ifFalse:[ |
|
3441 |
('Smalltalk [warning]: conflict for: ' , clsName , ' in ' , (anAbbrevFileStream pathName)) infoPrintCR. |
|
3442 |
('Smalltalk [warning]: (' , oldAbbrev , ' <-> ' , abbrev , ')') infoPrintCR |
|
3443 |
]. |
|
3444 |
] ifFalse:[ |
|
3445 |
cls := self classNamed:abbrev. |
|
3446 |
cls notNil ifTrue:[ |
|
3447 |
cls name ~= clsName ifTrue:[ |
|
3448 |
"/ ok, there is a class named after this abbrev ... |
|
3449 |
"/ this is only a conflict, if the other class has no |
|
3450 |
"/ abbreviation (or the same). |
|
3451 |
(abbrevs at:(cls name asSymbol) ifAbsent:cls name) = abbrev ifTrue:[ |
|
3452 |
cls isNameSpace ifFalse:[ |
|
3453 |
package = cls package ifTrue:[ |
|
3454 |
StandAlone ifFalse:[ |
|
3455 |
('Smalltalk [warning]: conflict for: ' , cls name , ' in ' , (anAbbrevFileStream pathName)) infoPrintCR. |
|
3456 |
('Smalltalk [warning]: (' , clsName , ' -> ' , abbrev , ')') infoPrintCR |
|
3457 |
] |
|
3458 |
] |
|
3459 |
] |
|
3460 |
] |
|
3461 |
] |
|
3462 |
]. |
|
3463 |
]. |
|
3464 |
abbrevs at:nameKey put:abbrev. |
|
3465 |
]. |
|
3466 |
||
3467 |
"/ ' autoloaded: ' print. clsName print. ' in ' print. cat printCR. |
|
3468 |
||
3469 |
self installAutoloadedClassNamed:clsName category:cat package:package revision:nil numClassInstVars:numClassInstVars. |
|
3470 |
] |
|
3471 |
] |
|
3472 |
] |
|
4458 | 3473 |
] |
3474 |
! |
|
3475 |
||
7758 | 3476 |
loadBinaries |
7563 | 3477 |
"return true, if binaries should be loaded into the system, |
3478 |
false if this should be suppressed. The default is false (for now)." |
|
3044 | 3479 |
|
3480 |
^ LoadBinaries |
|
3481 |
! |
|
3482 |
||
7758 | 3483 |
loadBinaries:aBoolean |
3484 |
"{ Pragma: +optSpace }" |
|
3485 |
||
3486 |
"turn on/off loading of binary objects" |
|
3044 | 3487 |
|
3488 |
aBoolean ifTrue:[ |
|
7616 | 3489 |
(ObjectFileLoader notNil and:[ObjectFileLoader canLoadObjectFiles]) ifTrue:[ |
3490 |
LoadBinaries := true. |
|
3491 |
^ self |
|
3492 |
]. |
|
3493 |
'Smalltalk [info]: this system does not support binary loading' infoPrintCR. |
|
617 | 3494 |
]. |
3044 | 3495 |
LoadBinaries := false |
3496 |
||
3497 |
"Modified: 10.1.1997 / 15:11:00 / cg" |
|
3498 |
! |
|
3499 |
||
7758 | 3500 |
logDoits |
3501 |
"return true if doits should go into the changes file |
|
3502 |
as well as changes - by default, this is off, since |
|
3503 |
it can blow up the changes file enormously ... |
|
3504 |
" |
|
3505 |
||
3506 |
^ LogDoits |
|
3507 |
||
3508 |
" |
|
3509 |
LogDoits := false |
|
3044 | 3510 |
LogDoits := true |
3511 |
" |
|
3512 |
! |
|
3513 |
||
7758 | 3514 |
logDoits:aBoolean |
3515 |
"{ Pragma: +optSpace }" |
|
3516 |
||
3517 |
"turn on/off logging of doits in the changes file. |
|
3518 |
By default, this is off, since it can blow up the |
|
3519 |
changes file enormously ... |
|
3520 |
" |
|
3521 |
||
3522 |
LogDoits := aBoolean |
|
3523 |
||
3524 |
! |
|
3525 |
||
3526 |
makeBytecodeMethods |
|
3527 |
"{ Pragma: +optSpace }" |
|
3528 |
||
3529 |
"walk over all methods and make each a bytecode method |
|
3530 |
iff it does not contain primitive C code. |
|
3531 |
Experimental and not yet used." |
|
3532 |
||
3533 |
Method allSubInstancesDo:[:aMethod | |
|
3534 |
|newMethod| |
|
3535 |
||
3536 |
aMethod hasPrimitiveCode ifFalse:[ |
|
3537 |
newMethod := aMethod asByteCodeMethod. |
|
3538 |
newMethod ~~ aMethod ifTrue:[ |
|
3539 |
aMethod becomeSameAs:newMethod |
|
3540 |
] |
|
3541 |
]. |
|
3542 |
]. |
|
3543 |
||
3544 |
" |
|
3545 |
Smalltalk makeBytecodeMethods |
|
3546 |
" |
|
3547 |
||
3548 |
"Modified: 16.1.1997 / 01:25:58 / cg" |
|
3549 |
"Created: 17.10.1997 / 13:52:19 / cg" |
|
3550 |
! |
|
3551 |
||
3552 |
recursiveInstallAutoloadedClassesFrom:aDirectory rememberIn:dirsConsulted maxLevels:maxLevels noAutoload:noAutoloadIn packageTop:packageTopPath |
|
3553 |
"read all abbrev.stc files from and under aDirectory |
|
3554 |
and install autoloaded classes. |
|
3555 |
If a file called NOAUTOLOAD is found, no classes there and below are installed as autoloaded |
|
3556 |
(however, the directories are searched for packages) |
|
3557 |
If a file called NOPACKAGES is found, no further searching is done in that directory or below." |
|
3558 |
||
3559 |
|abbrevStream dir noAutoloadHere dirName pkgName directoryContents| |
|
3560 |
||
3561 |
maxLevels == 0 ifTrue:[ |
|
3562 |
"/ 'Smalltalk [warning]: max directory nesting reached.' infoPrintCR. |
|
3563 |
^ self |
|
3564 |
]. |
|
3565 |
||
3566 |
dir := aDirectory asFilename. |
|
3567 |
||
3568 |
(dirsConsulted includes:dir pathName) ifTrue:[ |
|
3569 |
^ self |
|
3570 |
]. |
|
3571 |
dirsConsulted add:dir pathName. |
|
3572 |
||
3573 |
(dir construct:'NOPACKAGES') exists ifTrue:[ |
|
3574 |
^ self. |
|
3575 |
]. |
|
3576 |
(dir construct:'NOSUBAUTOLOAD') exists ifTrue:[ |
|
3577 |
^ self. |
|
3578 |
]. |
|
3579 |
noAutoloadHere := noAutoloadIn. |
|
3580 |
noAutoloadHere ifFalse:[ |
|
3581 |
(dir construct:'NOAUTOLOAD') exists ifTrue:[ |
|
3582 |
noAutoloadHere := true. |
|
3583 |
]. |
|
3584 |
] ifTrue:[ |
|
3585 |
(dir construct:'AUTOLOAD') exists ifTrue:[ |
|
3586 |
noAutoloadHere := false. |
|
3587 |
]. |
|
3588 |
]. |
|
3589 |
||
3590 |
((dir construct:'loadAll') exists |
|
3591 |
or:[(dir construct:'abbrev.stc') exists |
|
3592 |
or:[(dir construct:(dir baseName , '.prj')) exists]]) ifTrue:[ |
|
3593 |
KnownPackages isNil ifTrue:[ |
|
3594 |
KnownPackages := Set new. |
|
3595 |
]. |
|
3596 |
dirName := dir pathName. |
|
3597 |
pkgName := dirName copyFrom:(packageTopPath asFilename pathName) size + 1 + 1. |
|
3598 |
KnownPackages add:pkgName |
|
3599 |
]. |
|
3600 |
||
3601 |
"/ |
|
3602 |
"/ suppress installation as autoloaded in this and everything |
|
3603 |
"/ below; however, still traverse the directories to find packages ... |
|
3604 |
"/ |
|
3605 |
noAutoloadHere ifFalse:[ |
|
3606 |
[ |
|
3607 |
abbrevStream := (dir construct:'abbrev.stc') asFilename readStream. |
|
3608 |
self installAutoloadedClassesFromStream:abbrevStream. |
|
3609 |
abbrevStream close. |
|
3610 |
] on:FileStream openErrorSignal do:[:ex| "ignore this file"]. |
|
7085
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3611 |
]. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3612 |
|
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3613 |
[ |
7694
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3614 |
directoryContents := dir directoryContents. |
7085
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3615 |
] on:FileStream openErrorSignal do:[:ex| |
7694
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3616 |
"non-accessable directory: we are done" |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3617 |
^ self |
7085
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3618 |
]. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3619 |
|
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3620 |
directoryContents do:[:aFilename | |
7694
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3621 |
|f| |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3622 |
|
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3623 |
(#( |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3624 |
'doc' |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3625 |
'CVS' |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3626 |
'bitmaps' |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3627 |
'resources' |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3628 |
'source' |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3629 |
) includes:aFilename) ifFalse:[ |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3630 |
((dir baseName ~= 'stx') |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3631 |
or:[ |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3632 |
(#( |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3633 |
'configurations' |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3634 |
'include' |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3635 |
'rules' |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3636 |
'stc' |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3637 |
'support' |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3638 |
) includes:aFilename) not]) |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3639 |
ifTrue:[ |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3640 |
f := dir construct:aFilename. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3641 |
f isDirectory ifTrue:[ |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3642 |
self |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3643 |
recursiveInstallAutoloadedClassesFrom:f |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3644 |
rememberIn:dirsConsulted |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3645 |
maxLevels:maxLevels-1 |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3646 |
noAutoload:noAutoloadHere |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3647 |
packageTop:packageTopPath. |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3648 |
] |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3649 |
] |
a154c7582eca
fileNameForClass no longer uses abbreviations
Claus Gittinger <cg@exept.de>
parents:
7670
diff
changeset
|
3650 |
]. |
4458 | 3651 |
]. |
3652 |
||
5117 | 3653 |
" |
3654 |
Smalltalk installAutoloadedClasses |
|
3655 |
" |
|
4458 | 3656 |
! |
3657 |
||
7758 | 3658 |
replaceReferencesTo:anObject with:newRef |
3659 |
|toAdd| |
|
3660 |
||
3661 |
toAdd := OrderedCollection new. |
|
3662 |
self keysAndValuesDo:[:key :val | |
|
3663 |
(key == anObject) ifTrue:[ |
|
7616 | 3664 |
self shouldImplement. |
3665 |
]. |
|
3666 |
(val == anObject ) ifTrue:[ |
|
3667 |
toAdd add:(key -> newRef) |
|
3668 |
]. |
|
6033
be1b7877b425
+ #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
6031
diff
changeset
|
3669 |
]. |
be1b7877b425
+ #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
6031
diff
changeset
|
3670 |
toAdd do:[:each | |
7616 | 3671 |
self at:(each key) put:(each value) |
6033
be1b7877b425
+ #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
6031
diff
changeset
|
3672 |
]. |
7758 | 3673 |
! |
3674 |
||
3675 |
saveEmergencyImage:aBoolean |
|
3676 |
"set/clear the flag which controls if ST/X should save an |
|
3677 |
emergency image in case of a broken display connection. |
|
3678 |
The default is true. |
|
3679 |
This may be useful, if you work with an unsecure display |
|
3680 |
(serial line), and want to have a chance of proceeding after |
|
3681 |
a crash. In multiheaded applications, this only affects |
|
3682 |
crashes of the master Display connection (the initial connection); |
|
3683 |
errors on other displays are reported to the views and treated |
|
3684 |
like window destroy from the windowManager." |
|
3062
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3685 |
|
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3686 |
SaveEmergencyImage := aBoolean |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3687 |
|
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3688 |
"Modified: / 24.10.1997 / 18:22:26 / cg" |
3083 | 3689 |
! |
3690 |
||
7758 | 3691 |
systemOrganization |
3692 |
"for partial ST80 compatibility; |
|
3693 |
In ST80, Smalltalk organization returns a systemOrganizer, which |
|
3694 |
keeps track of class-categories, while all classes return a classOrganizer |
|
3695 |
from #organization, which keeps track of method categories of that class. |
|
3696 |
Since in ST/X, Smalltalk is a class, there is now a conflict. |
|
3697 |
To make a workaround possible, use #systemOrganization when porting |
|
3698 |
VW apps to ST/X to get the class-categories. |
|
3699 |
Read the documentation in SystemOrganizer for more info." |
|
3626
5a69787e857c
added hook make apps VW compatible w.r.t. system-organizaton.
Claus Gittinger <cg@exept.de>
parents:
3624
diff
changeset
|
3700 |
|
5a69787e857c
added hook make apps VW compatible w.r.t. system-organizaton.
Claus Gittinger <cg@exept.de>
parents:
3624
diff
changeset
|
3701 |
^ SystemOrganizer for:nil |
5a69787e857c
added hook make apps VW compatible w.r.t. system-organizaton.
Claus Gittinger <cg@exept.de>
parents:
3624
diff
changeset
|
3702 |
|
5a69787e857c
added hook make apps VW compatible w.r.t. system-organizaton.
Claus Gittinger <cg@exept.de>
parents:
3624
diff
changeset
|
3703 |
"Created: / 20.6.1998 / 12:24:02 / cg" |
5a69787e857c
added hook make apps VW compatible w.r.t. system-organizaton.
Claus Gittinger <cg@exept.de>
parents:
3624
diff
changeset
|
3704 |
"Modified: / 20.6.1998 / 12:41:34 / cg" |
7758 | 3705 |
! ! |
3706 |
||
3707 |
!Smalltalk class methodsFor:'system management-fileIn'! |
|
3708 |
||
3709 |
fileIn:aFileName |
|
3710 |
"read in the named file - look for it in some standard places; |
|
3711 |
return true if ok, false if failed. |
|
3712 |
This method can load almost anything which makes sense: |
|
7616 | 3713 |
.st - source files |
3714 |
.cls - binary smalltalk bytecode files |
|
3715 |
.so - binary compiled machine code class libraries |
|
3716 |
[.class - java bytecode -- soon to come]" |
|
3044 | 3717 |
|
3718 |
^ self fileIn:aFileName lazy:nil silent:nil logged:false |
|
3719 |
||
3720 |
" |
|
3721 |
Smalltalk fileIn:'source/TicTacToe.st' |
|
4712 | 3722 |
Smalltalk fileIn:'binary/TicTacToe.cls' |
3723 |
Smalltalk fileIn:'binary/TicTacToe.so' |
|
3044 | 3724 |
" |
3725 |
||
3726 |
"Created: 28.10.1995 / 17:06:28 / cg" |
|
3727 |
! |
|
3728 |
||
7758 | 3729 |
fileIn:aFileName inPackage:aPackageID |
3730 |
"read in the named file in a packages directory." |
|
3731 |
||
3732 |
|dir| |
|
3733 |
||
3734 |
dir := self getPackageDirectoryForPackage:aPackageID. |
|
3735 |
dir isNil ifTrue:[^ false]. |
|
6096 | 3736 |
|
3737 |
dir := dir asFilename. |
|
3738 |
^ (self fileIn:(dir construct:aFileName)) |
|
3739 |
or:[ self fileIn:((dir construct:'source') construct:aFileName) ] |
|
5687 | 3740 |
! |
3741 |
||
7758 | 3742 |
fileIn:aFileName lazy:lazy |
3743 |
"read in the named file - look for it in some standard places; |
|
3744 |
return true if ok, false if failed. |
|
3745 |
If lazy is true, no code is generated for methods, instead stubs |
|
3746 |
are created which compile themself when first executed. This allows |
|
3747 |
for much faster fileIn (but slows down the first execution later). |
|
3748 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
3749 |
code which is known to be syntactically correct." |
|
3750 |
||
3751 |
^ self fileIn:aFileName lazy:lazy silent:nil logged:false |
|
3752 |
||
3753 |
" |
|
3754 |
Smalltalk fileIn:'source/TicTacToe.st' lazy:true |
|
3044 | 3755 |
" |
3756 |
||
3757 |
"Created: 28.10.1995 / 17:06:36 / cg" |
|
3758 |
! |
|
3759 |
||
7758 | 3760 |
fileIn:aFileName lazy:lazy silent:silent |
3761 |
"read in the named file - look for it in some standard places; |
|
3762 |
return true if ok, false if failed. |
|
3763 |
If lazy is true, no code is generated for methods, instead stubs |
|
3764 |
are created which compile themself when first executed. This allows |
|
3765 |
for much faster fileIn (but slows down the first execution later). |
|
3766 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
3767 |
code which is known to be syntactically correct. |
|
3768 |
If silent is true, no compiler messages are output to the transcript. |
|
3769 |
Giving nil for silent/lazy will use the current settings." |
|
3770 |
||
3771 |
^ self fileIn:aFileName lazy:lazy silent:silent logged:false |
|
3772 |
||
3773 |
"Created: 28.10.1995 / 17:06:41 / cg" |
|
3774 |
! |
|
3775 |
||
3776 |
fileIn:aFileNameOrString lazy:lazy silent:silent logged:logged |
|
3777 |
"read in the named file - look for it in some standard places; |
|
3778 |
return true if ok, false if failed. |
|
3779 |
If lazy is true, no code is generated for methods, instead stubs |
|
3780 |
are created which compile themself when first executed. This allows |
|
3781 |
for much faster fileIn (but slows down the first execution later). |
|
3782 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
3783 |
code which is known to be syntactically correct. |
|
3784 |
If silent is true, no compiler messages are output to the transcript. |
|
3785 |
Giving nil for silent/lazy will use the current settings. |
|
3786 |
This method can load almost anything which makes sense: |
|
3787 |
.st - source files |
|
3788 |
.cls - binary smalltalk bytecode files |
|
3789 |
.so - binary compiled machine code class libraries |
|
3790 |
[.class - java bytecode -- soon to come]" |
|
3791 |
||
3792 |
|fileNameString aStream path morePath bos| |
|
3793 |
||
3794 |
fileNameString := aFileNameOrString asString. |
|
3795 |
||
3796 |
" |
|
3797 |
an object or shared object ? |
|
3798 |
" |
|
3799 |
(ObjectFileLoader notNil |
|
3800 |
and:[ObjectFileLoader hasValidBinaryExtension:fileNameString]) ifTrue:[ |
|
3801 |
"/ LoadBinaries ifFalse:[^ false]. |
|
3802 |
path := self getBinaryFileName:fileNameString. |
|
3803 |
path isNil ifTrue:[ |
|
3804 |
path := self getSystemFileName:fileNameString. |
|
3805 |
]. |
|
3806 |
path isNil ifTrue:[^ false]. |
|
3807 |
^ (ObjectFileLoader loadObjectFile:path) notNil |
|
3808 |
]. |
|
3809 |
||
3810 |
(fileNameString asFilename hasSuffix:'cls') ifTrue:[ |
|
3811 |
BinaryObjectStorage notNil ifTrue:[ |
|
3812 |
aStream := self systemFileStreamFor:fileNameString. |
|
3813 |
"/ path := self getBinaryFileName:fileNameString. |
|
3814 |
"/ path isNil ifTrue:[^ false]. |
|
3815 |
"/ aStream := path asFilename readStream. |
|
3816 |
aStream notNil ifTrue:[ |
|
3817 |
aStream binary. |
|
3818 |
bos := BinaryObjectStorage onOld:aStream. |
|
3819 |
bos next. |
|
3820 |
bos close. |
|
3821 |
^ true |
|
3822 |
]. |
|
3823 |
^ false |
|
3824 |
] |
|
3825 |
]. |
|
3826 |
||
3827 |
(fileNameString startsWith:'source/') ifTrue:[ |
|
3828 |
aStream := self sourceFileStreamFor:(fileNameString copyFrom:8) |
|
3829 |
] ifFalse:[ |
|
3830 |
(fileNameString startsWith:'fileIn/') ifTrue:[ |
|
3831 |
aStream := self fileInFileStreamFor:(fileNameString copyFrom:8) |
|
3832 |
] ifFalse:[ |
|
3833 |
aStream := self systemFileStreamFor:fileNameString. |
|
7616 | 3834 |
aStream isNil ifTrue:[ |
3835 |
OperatingSystem isUNIXlike ifTrue:[ |
|
3836 |
(fileNameString startsWith:'/') ifFalse:[ |
|
3837 |
aStream := self systemFileStreamFor:('lib/' , fileNameString). |
|
3838 |
] |
|
3839 |
] |
|
3840 |
]. |
|
3841 |
(aStream notNil and:[fileNameString includes:$/]) ifTrue:[ |
|
3842 |
"/ temporarily prepend the files directory |
|
3843 |
"/ to the searchPath. |
|
3844 |
"/ This allows fileIn-driver files to refer to local |
|
3845 |
"/ files via a relative path, and drivers to fileIn other |
|
3846 |
"/ drivers ... |
|
3847 |
morePath := aStream pathName asFilename directoryName. |
|
3848 |
] |
|
3849 |
] |
|
3044 | 3850 |
]. |
3851 |
aStream isNil ifTrue:[^ false]. |
|
3852 |
^ self fileInStream:aStream lazy:lazy silent:silent logged:logged addPath:morePath |
|
3853 |
||
3854 |
" |
|
3855 |
Smalltalk fileIn:'source/TicTacToe.st' lazy:true silent:true |
|
3856 |
" |
|
3857 |
||
3952
05c36f8e87b4
fixed fileIn of byteCode (.cls) files
Claus Gittinger <cg@exept.de>
parents:
3915
diff
changeset
|
3858 |
"Modified: / 16.2.1999 / 10:03:26 / cg" |
3044 | 3859 |
! |
3860 |
||
7758 | 3861 |
fileIn:aFileName logged:logged |
3862 |
"read in the named file - look for it in some standard places; |
|
3863 |
return true if ok, false if failed. |
|
3864 |
The argument logged controls, if the changefile is to be updated." |
|
3865 |
||
3866 |
^ self fileIn:aFileName lazy:nil silent:nil logged:logged |
|
3867 |
||
3868 |
" |
|
3869 |
Smalltalk fileIn:'source/TicTacToe.st' logged:false |
|
3870 |
" |
|
3871 |
! |
|
3872 |
||
3873 |
fileInChanges |
|
3874 |
"read in the last changes file - bringing the system to the state it |
|
70 | 3875 |
had when left the last time. |
3876 |
WARNING: this method is rubbish: it should only read things after the |
|
7616 | 3877 |
last '**snapshot**' - entry |
3878 |
(instead of the complete changes file)." |
|
1 | 3879 |
|
70 | 3880 |
" |
400 | 3881 |
do NOT update the changes file now ... |
70 | 3882 |
" |
2928 | 3883 |
self fileIn:ChangeFileName logged:false |
1 | 3884 |
|
77 | 3885 |
" |
3886 |
Smalltalk fileInChanges |
|
3887 |
" |
|
1 | 3888 |
! |
3889 |
||
7758 | 3890 |
fileInClass:aClassName |
3891 |
"find a source/object file for aClassName and -if found - load it. |
|
3892 |
search is in some standard places trying driver-file (.ld), object-file (.o) and |
|
3893 |
finally source file (.st) in that order. |
|
3894 |
The file is first searched for using the class name, then the abbreviated name." |
|
3895 |
||
3896 |
^ self |
|
3897 |
fileInClass:aClassName |
|
3898 |
package:nil |
|
3899 |
initialize:true |
|
3900 |
lazy:false |
|
3901 |
silent:nil |
|
3902 |
||
3903 |
"Modified: / 9.1.1998 / 14:41:46 / cg" |
|
3904 |
! |
|
3905 |
||
3906 |
fileInClass:aClassName fromObject:aFileName |
|
3907 |
"read in the named object file and dynamic-link it into the system |
|
3044 | 3908 |
- look for it in some standard places. |
3909 |
Only install the named class from this object file. |
|
3910 |
Return true if ok, false if failed." |
|
3911 |
||
3912 |
|path ok| |
|
3913 |
||
3914 |
" |
|
3915 |
check if the dynamic loader class is in |
|
3916 |
" |
|
3917 |
(LoadBinaries not or:[ObjectFileLoader isNil]) ifTrue:[^ false]. |
|
3918 |
||
3919 |
(path := self getBinaryFileName:aFileName) isNil ifTrue:[^ false]. |
|
3920 |
ok := (ObjectFileLoader loadClass:aClassName fromObjectFile:path) notNil. |
|
3921 |
ok ifTrue:[ |
|
7616 | 3922 |
SilentLoading ifFalse:[ |
3923 |
Transcript show:' loaded ' , aClassName , ' from ' ; showCR:aFileName. |
|
3924 |
] |
|
3044 | 3925 |
]. |
3926 |
^ ok |
|
3927 |
||
3928 |
" |
|
3929 |
Smalltalk fileInClass:'AbstractPath' fromObject:'../../goodies/Paths/AbstrPath.so' |
|
3930 |
Smalltalk fileInClass:'ClockView' fromObject:'../../libwidg3/libwidg3.so' |
|
3931 |
" |
|
3932 |
||
3933 |
"Modified: 10.9.1996 / 20:43:52 / cg" |
|
3934 |
! |
|
3935 |
||
7758 | 3936 |
fileInClass:aClassName initialize:doInit |
3937 |
"find a source/object file for aClassName and -if found - load it. |
|
3938 |
search is in some standard places trying driver-file (.ld), object-file (.o) and |
|
3044 | 3939 |
finally source file (.st) in that order. |
3940 |
The file is first searched for using the class name, then the abbreviated name." |
|
3941 |
||
3155
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
3942 |
^ self |
7616 | 3943 |
fileInClass:aClassName |
3944 |
package:nil |
|
3945 |
initialize:doInit |
|
3946 |
lazy:false |
|
3947 |
silent:nil |
|
3155
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
3948 |
|
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
3949 |
"Modified: / 9.1.1998 / 14:42:02 / cg" |
3044 | 3950 |
! |
3951 |
||
7758 | 3952 |
fileInClass:aClassName initialize:doInit lazy:loadLazy |
3953 |
"find a source/object file for aClassName and -if found - load it. |
|
3954 |
search is in some standard places trying driver-file (.ld), object-file (.o) and |
|
3955 |
finally source file (.st) in that order. |
|
3956 |
The file is first searched for using the class name, then the abbreviated name." |
|
3957 |
||
3958 |
^ self |
|
3959 |
fileInClass:aClassName |
|
3960 |
package:nil |
|
3961 |
initialize:doInit |
|
3962 |
lazy:loadLazy |
|
3963 |
silent:nil |
|
3964 |
||
3965 |
"Modified: / 9.1.1998 / 14:42:19 / cg" |
|
3966 |
! |
|
3967 |
||
3968 |
fileInClass:aClassName initialize:doInit lazy:loadLazy silent:beSilent |
|
7563 | 3969 |
"find a source/object file for aClassName and -if found - load it. |
3155
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
3970 |
Search is in some standard places, trying driver-file (.ld), object-file (.so / .o) and |
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
3971 |
finally source file (.st), in that order. |
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
3972 |
The file is first searched for using the class name, then the abbreviated name. |
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
3973 |
The argument doInit controlls if the class should be sent a #initialize after the |
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
3974 |
load; loadLazy tells if it should be loaded lazyly. beSilent tells if the compiler |
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
3975 |
should not send notes to the transcript; it can be true, false or nil, where |
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
3976 |
nil uses the value from SilentLoading." |
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
3977 |
|
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
3978 |
^ self |
7616 | 3979 |
fileInClass:aClassName |
3980 |
package:nil |
|
3981 |
initialize:doInit |
|
3982 |
lazy:loadLazy |
|
3983 |
silent:beSilent |
|
3155
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
3984 |
|
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
3985 |
"Modified: / 9.1.1998 / 14:42:28 / cg" |
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
3986 |
! |
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
3987 |
|
7758 | 3988 |
fileInClass:aClassName package:package initialize:doInit lazy:loadLazy silent:beSilent |
3989 |
"find a source/object file for aClassName and -if found - load it. |
|
3990 |
This is the workhorse for autoloading. |
|
3991 |
Search is in some standard places, trying driver-file (.ld), object-file (.so / .o) and |
|
3992 |
finally source file (.st), in that order. |
|
3993 |
The file is first searched for using the class name, then the abbreviated name. |
|
3994 |
The argument doInit controlls if the class should be sent a #initialize after the |
|
3995 |
load; loadLazy tells if it should be loaded lazyly. beSilent tells if the compiler |
|
3996 |
should not send notes to the transcript; it can be true, false or nil, where |
|
3997 |
nil uses the value from SilentLoading." |
|
3998 |
||
7763 | 3999 |
|classFileName alternativeClassFileName libName newClass ok wasLazy wasSilent sharedLibExtension inStream mgr |
7758 | 4000 |
fn packageDir packageFile bos| |
4001 |
||
4002 |
wasLazy := Compiler compileLazy:loadLazy. |
|
4003 |
beSilent notNil ifTrue:[ |
|
7763 | 4004 |
wasSilent := self silentLoading:beSilent. |
4005 |
]. |
|
4006 |
||
4007 |
classFileName := Smalltalk fileNameForClass:aClassName. |
|
4008 |
(classFileName = aClassName) ifTrue:[ |
|
4009 |
"/ no abbrev.stc translation for className |
|
4010 |
(aClassName includes:$:) ifTrue:[ |
|
4011 |
"/ a nameSpace name |
|
4012 |
alternativeClassFileName := classFileName copyFrom:(classFileName lastIndexOf:$:)+1 |
|
4013 |
]. |
|
4014 |
]. |
|
4015 |
||
4016 |
classFileName := classFileName copyReplaceAll:$: with:$_. |
|
7758 | 4017 |
|
4018 |
[ |
|
7763 | 4019 |
Class withoutUpdatingChangesDo: |
4020 |
[ |
|
4021 |
|zarFn zar entry| |
|
4022 |
||
4023 |
ok := false. |
|
4024 |
||
4025 |
package notNil ifTrue:[ |
|
4026 |
packageDir := package asString. |
|
4027 |
packageDir := packageDir copyReplaceAll:$: with:$/. |
|
4028 |
]. |
|
4029 |
||
4030 |
Class packageQuerySignal answer:package |
|
4031 |
do:[ |
|
4032 |
||
4033 |
" |
|
4034 |
first, look for a loader-driver file (in fileIn/xxx.ld) |
|
4035 |
" |
|
4036 |
(ok := self fileIn:('fileIn/' , classFileName , '.ld') lazy:loadLazy silent:beSilent) |
|
4037 |
ifFalse:[ |
|
4038 |
" |
|
4039 |
try abbreviated driver-file (in fileIn/xxx.ld) |
|
4040 |
" |
|
4041 |
alternativeClassFileName notNil ifTrue:[ |
|
4042 |
ok := self fileIn:('fileIn/' , alternativeClassFileName , '.ld') lazy:loadLazy silent:beSilent |
|
4043 |
]. |
|
4044 |
ok ifFalse:[ |
|
4045 |
" |
|
4046 |
then, if dynamic linking is available, |
|
4047 |
" |
|
4048 |
(LoadBinaries and:[ObjectFileLoader notNil]) ifTrue:[ |
|
4049 |
sharedLibExtension := ObjectFileLoader sharedLibraryExtension. |
|
4050 |
||
4051 |
" |
|
4052 |
first look for a class packages shared binary in binary/xxx.o |
|
4053 |
" |
|
4054 |
libName := self libraryFileNameOfClass:aClassName. |
|
4055 |
libName notNil ifTrue:[ |
|
4056 |
(ok := self fileInClass:aClassName fromObject:(libName, sharedLibExtension)) |
|
4057 |
ifFalse:[ |
|
4058 |
sharedLibExtension ~= '.o' ifTrue:[ |
|
4059 |
ok := self fileInClass:aClassName fromObject:(libName, '.o') |
|
4060 |
] |
|
4061 |
]. |
|
4062 |
]. |
|
4063 |
||
4064 |
" |
|
4065 |
then, look for a shared binary in binary/xxx.o |
|
4066 |
" |
|
4067 |
ok ifFalse:[ |
|
4068 |
(ok := self fileInClass:aClassName fromObject:(classFileName, sharedLibExtension)) |
|
4069 |
ifFalse:[ |
|
4070 |
sharedLibExtension ~= '.o' ifTrue:[ |
|
4071 |
ok := self fileInClass:aClassName fromObject:(classFileName, '.o') |
|
4072 |
]. |
|
4073 |
ok ifFalse:[ |
|
4074 |
alternativeClassFileName notNil ifTrue:[ |
|
4075 |
(ok := self fileInClass:aClassName fromObject:(alternativeClassFileName, sharedLibExtension)) |
|
4076 |
ifFalse:[ |
|
4077 |
sharedLibExtension ~= '.o' ifTrue:[ |
|
4078 |
ok := self fileInClass:aClassName fromObject:(alternativeClassFileName, '.o') |
|
4079 |
] |
|
4080 |
] |
|
4081 |
]. |
|
4082 |
]. |
|
4083 |
]. |
|
4084 |
]. |
|
4085 |
]. |
|
4086 |
||
4087 |
" |
|
4088 |
if that did not work, look for a compiled-bytecode file ... |
|
4089 |
" |
|
4090 |
ok ifFalse:[ |
|
4091 |
(ok := self fileIn:(classFileName , '.cls') lazy:loadLazy silent:beSilent) |
|
4092 |
ifFalse:[ |
|
4093 |
alternativeClassFileName notNil ifTrue:[ |
|
4094 |
ok := self fileIn:(alternativeClassFileName , '.cls') lazy:loadLazy silent:beSilent |
|
4095 |
] |
|
4096 |
] |
|
4097 |
]. |
|
4098 |
" |
|
4099 |
if that did not work, and the classes package is known, |
|
4100 |
look for an st-cls file |
|
4101 |
in a package subdir of the source-directory ... |
|
4102 |
" |
|
4103 |
ok ifFalse:[ |
|
4104 |
(packageDir notNil and:[BinaryObjectStorage notNil]) ifTrue:[ |
|
4105 |
packageFile := self getPackageFileName:(packageDir , '/classes/' , classFileName , '.cls'). |
|
4106 |
packageFile isNil ifTrue:[ |
|
4107 |
packageFile := (packageDir , '/classes/' , classFileName , '.cls'). |
|
4108 |
]. |
|
4109 |
(ok := self fileIn:packageFile lazy:loadLazy silent:beSilent) |
|
4110 |
ifFalse:[ |
|
4111 |
alternativeClassFileName notNil ifTrue:[ |
|
4112 |
packageFile := self getPackageFileName:(packageDir , '/classes/' , alternativeClassFileName , '.cls'). |
|
4113 |
packageFile isNil ifTrue:[ |
|
4114 |
packageFile := (packageDir , '/classes/' , alternativeClassFileName , '.cls'). |
|
4115 |
]. |
|
4116 |
ok := self fileIn:packageFile lazy:loadLazy silent:beSilent |
|
4117 |
] |
|
4118 |
]. |
|
4119 |
||
4120 |
zarFn := self getPackageFileName:(packageDir , '/classes.zip'). |
|
4121 |
zarFn notNil ifTrue:[ |
|
4122 |
zar := ZipArchive oldFileNamed:zarFn. |
|
4123 |
zar notNil ifTrue:[ |
|
4124 |
entry := zar extract:(classFileName , '.cls'). |
|
4125 |
(entry isNil and:[alternativeClassFileName notNil]) ifTrue:[ |
|
4126 |
entry := zar extract:(alternativeClassFileName , '.cls'). |
|
4127 |
]. |
|
4128 |
entry notNil ifTrue:[ |
|
4129 |
bos := BinaryObjectStorage onOld:(entry asByteArray readStream). |
|
4130 |
bos next. |
|
4131 |
bos close. |
|
4132 |
ok := true |
|
4133 |
]. |
|
4134 |
] |
|
4135 |
] |
|
4136 |
] |
|
4137 |
]. |
|
4138 |
||
4139 |
" |
|
4140 |
if that did not work, look for an st-source file ... |
|
4141 |
" |
|
4142 |
ok ifFalse:[ |
|
4143 |
fn := classFileName , '.st'. |
|
4144 |
(ok := self fileIn:fn lazy:loadLazy silent:beSilent) |
|
4145 |
ifFalse:[ |
|
4146 |
alternativeClassFileName notNil ifTrue:[ |
|
4147 |
fn := alternativeClassFileName , '.st'. |
|
4148 |
ok := self fileIn:fn lazy:loadLazy silent:beSilent |
|
4149 |
]. |
|
4150 |
ok ifFalse:[ |
|
4151 |
" |
|
4152 |
... and in the standard source-directory |
|
4153 |
" |
|
4154 |
fn := 'source/' , classFileName , '.st'. |
|
4155 |
(ok := self fileIn:fn lazy:loadLazy silent:beSilent) |
|
4156 |
ifFalse:[ |
|
4157 |
alternativeClassFileName notNil ifTrue:[ |
|
4158 |
fn := 'source/' , alternativeClassFileName , '.st'. |
|
4159 |
ok := self fileIn:fn lazy:loadLazy silent:beSilent |
|
4160 |
] |
|
4161 |
] |
|
4162 |
] |
|
4163 |
]. |
|
4164 |
" |
|
4165 |
if that did not work, and the classes package is known, |
|
4166 |
look for an st-source file |
|
4167 |
in a package subdir of the source-directory ... |
|
4168 |
" |
|
4169 |
ok ifFalse:[ |
|
4170 |
packageDir notNil ifTrue:[ |
|
4171 |
packageFile := self getPackageFileName:(packageDir , '/source/' , classFileName , '.st'). |
|
4172 |
packageFile isNil ifTrue:[ |
|
4173 |
packageFile := (packageDir , '/source/' , classFileName , '.st'). |
|
4174 |
]. |
|
4175 |
fn := packageFile. |
|
4176 |
(ok := self fileIn:packageFile lazy:loadLazy silent:beSilent) |
|
4177 |
ifFalse:[ |
|
4178 |
alternativeClassFileName notNil ifTrue:[ |
|
4179 |
packageFile := self getPackageFileName:(packageDir , '/source/' , alternativeClassFileName , '.st'). |
|
4180 |
packageFile isNil ifTrue:[ |
|
4181 |
packageFile := (packageDir , '/source/' , alternativeClassFileName , '.st'). |
|
4182 |
]. |
|
4183 |
fn := packageFile. |
|
4184 |
ok := self fileIn:packageFile lazy:loadLazy silent:beSilent |
|
4185 |
]. |
|
4186 |
ok ifFalse:[ |
|
4187 |
||
4188 |
packageFile := self getPackageFileName:(packageDir , '/' , classFileName , '.st'). |
|
4189 |
packageFile isNil ifTrue:[ |
|
4190 |
packageFile := (packageDir , '/' , classFileName , '.st'). |
|
4191 |
]. |
|
4192 |
fn := packageFile. |
|
4193 |
(ok := self fileIn:packageFile lazy:loadLazy silent:beSilent) |
|
4194 |
ifFalse:[ |
|
4195 |
alternativeClassFileName notNil ifTrue:[ |
|
4196 |
packageFile := self getPackageFileName:(packageDir , '/' , alternativeClassFileName , '.st'). |
|
4197 |
packageFile isNil ifTrue:[ |
|
4198 |
packageFile := (packageDir , '/' , alternativeClassFileName , '.st'). |
|
4199 |
]. |
|
4200 |
fn := packageFile. |
|
4201 |
ok := self fileIn:packageFile lazy:loadLazy silent:beSilent |
|
4202 |
]. |
|
4203 |
ok ifFalse:[ |
|
4204 |
" |
|
4205 |
... and in the standard source-directory |
|
4206 |
" |
|
4207 |
fn := 'source/' , packageDir , '/' , classFileName , '.st'. |
|
4208 |
(ok := self fileIn:fn lazy:loadLazy silent:beSilent) |
|
4209 |
ifFalse:[ |
|
4210 |
alternativeClassFileName notNil ifTrue:[ |
|
4211 |
fn := 'source/' , packageDir , '/' , alternativeClassFileName , '.st'. |
|
4212 |
ok := self fileIn:fn lazy:loadLazy silent:beSilent |
|
4213 |
] |
|
4214 |
] |
|
4215 |
] |
|
4216 |
]. |
|
4217 |
]. |
|
4218 |
]. |
|
4219 |
] |
|
4220 |
]. |
|
4221 |
" |
|
4222 |
if that did not work, and the classes package is known, |
|
4223 |
look for a zipArchive containing a class entry. |
|
4224 |
" |
|
4225 |
ok ifFalse:[ |
|
4226 |
packageDir notNil ifTrue:[ |
|
4227 |
zarFn := self getPackageFileName:(packageDir , '/source.zip'). |
|
4228 |
zarFn isNil ifTrue:[ |
|
4229 |
zarFn := packageDir asFilename withSuffix:'zip'. |
|
4230 |
zarFn := self getSourceFileName:zarFn. |
|
4231 |
]. |
|
4232 |
zarFn notNil ifTrue:[ |
|
4233 |
zar := ZipArchive oldFileNamed:zarFn. |
|
4234 |
zar notNil ifTrue:[ |
|
4235 |
entry := zar extract:(classFileName , '.st'). |
|
4236 |
(entry isNil and:[alternativeClassFileName notNil]) ifTrue:[ |
|
4237 |
entry := zar extract:(alternativeClassFileName , '.st'). |
|
4238 |
]. |
|
4239 |
entry notNil ifTrue:[ |
|
4240 |
fn := zarFn. |
|
4241 |
ok := self |
|
4242 |
fileInStream:(entry asString readStream) |
|
4243 |
lazy:loadLazy |
|
4244 |
silent:beSilent |
|
4245 |
logged:false |
|
4246 |
addPath:nil |
|
4247 |
]. |
|
4248 |
] |
|
4249 |
] |
|
4250 |
] |
|
4251 |
]. |
|
4252 |
||
4253 |
" |
|
4254 |
if that did not work, |
|
4255 |
look for a zipArchive containing a class entry. |
|
4256 |
" |
|
4257 |
ok ifFalse:[ |
|
4258 |
zarFn := self getSourceFileName:'source.zip'. |
|
4259 |
zarFn notNil ifTrue:[ |
|
4260 |
zar := ZipArchive oldFileNamed:zarFn. |
|
4261 |
zar notNil ifTrue:[ |
|
4262 |
entry := zar extract:(zarFn := classFileName , '.st'). |
|
4263 |
(entry isNil and:[alternativeClassFileName notNil]) ifTrue:[ |
|
4264 |
entry := zar extract:(zarFn := alternativeClassFileName , '.st'). |
|
4265 |
]. |
|
4266 |
entry notNil ifTrue:[ |
|
4267 |
fn := zarFn. |
|
4268 |
ok := self |
|
4269 |
fileInStream:(entry asString readStream) |
|
4270 |
lazy:loadLazy |
|
4271 |
silent:beSilent |
|
4272 |
logged:false |
|
4273 |
addPath:nil |
|
4274 |
]. |
|
4275 |
] |
|
4276 |
] |
|
4277 |
]. |
|
4278 |
ok ifFalse:[ |
|
4279 |
" |
|
4280 |
new: if there is a sourceCodeManager, ask it for the classes sourceCode |
|
4281 |
" |
|
4282 |
(mgr := Smalltalk at:#SourceCodeManager) notNil ifTrue:[ |
|
4283 |
inStream := mgr getMostRecentSourceStreamForClassNamed:aClassName. |
|
4284 |
inStream notNil ifTrue:[ |
|
4285 |
fn := nil. |
|
4286 |
ok := self fileInStream:inStream lazy:loadLazy silent:beSilent logged:false addPath:nil. |
|
4287 |
] |
|
4288 |
]. |
|
4289 |
]. |
|
4290 |
]. |
|
4291 |
]. |
|
4292 |
] |
|
4293 |
] |
|
4294 |
]. |
|
4295 |
||
4296 |
ok ifTrue:[ |
|
4297 |
newClass := self at:(aClassName asSymbol). |
|
4298 |
newClass notNil ifTrue:[ |
|
4299 |
fn notNil ifTrue:[ |
|
4300 |
newClass classFilename isNil ifTrue:[ |
|
4301 |
newClass setClassFilename:fn |
|
4302 |
]. |
|
4303 |
]. |
|
4304 |
||
4305 |
doInit ifTrue:[ |
|
4306 |
newClass initialize |
|
4307 |
] |
|
4308 |
] |
|
4309 |
]. |
|
6421
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4310 |
] ensure:[ |
7763 | 4311 |
Compiler compileLazy:wasLazy. |
4312 |
wasSilent notNil ifTrue:[ |
|
4313 |
self silentLoading:wasSilent |
|
4314 |
] |
|
3044 | 4315 |
]. |
4316 |
||
4317 |
^ newClass |
|
4318 |
||
3155
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
4319 |
"Created: / 9.1.1998 / 14:40:32 / cg" |
4277
74196836e8df
oops - care for module-prefix when filing in
Claus Gittinger <cg@exept.de>
parents:
4150
diff
changeset
|
4320 |
"Modified: / 5.6.1999 / 14:53:01 / cg" |
3044 | 4321 |
! |
4322 |
||
7758 | 4323 |
fileInClassLibrary:aClassLibraryName |
4324 |
"find an object file containing a binary class library in some standard places |
|
4325 |
and load it. This install all of its contained classes. |
|
4712 | 4326 |
Return true if ok, false if not. |
4327 |
Notice: the argument may not have an extension (by purpose); |
|
7616 | 4328 |
the sharedLib extension (.dll / .so / .sl) is added here, to |
4329 |
make the caller independent of the underlying operatingSystem." |
|
4712 | 4330 |
|
4331 |
|path fn| |
|
3044 | 4332 |
|
4333 |
ObjectFileLoader isNil ifTrue:[^ false]. |
|
4712 | 4334 |
|
6837 | 4335 |
fn := aClassLibraryName asFilename withSuffix:(ObjectFileLoader sharedLibrarySuffix). |
6836 | 4336 |
fn := fn pathName. |
4712 | 4337 |
|
4338 |
path := self getBinaryFileName:fn. |
|
4339 |
path isNil ifTrue:[ |
|
7616 | 4340 |
path := self getSystemFileName:fn. |
4712 | 4341 |
]. |
4342 |
path isNil ifTrue:[^ false]. |
|
4343 |
||
4714 | 4344 |
^ (ObjectFileLoader loadObjectFile:path) notNil |
3044 | 4345 |
|
4346 |
" |
|
4347 |
Smalltalk fileInClassLibrary:'libtable' |
|
4348 |
Smalltalk fileInClassLibrary:'binary/libwidg3' |
|
4349 |
" |
|
4350 |
||
4351 |
"Modified: 8.1.1997 / 17:58:56 / cg" |
|
617 | 4352 |
! |
4353 |
||
7758 | 4354 |
fileInClassLibrary:aClassLibraryName inPackage:packageID |
4355 |
"find an object file containing a binary class library in some standard places |
|
4356 |
and load it. This install all of its contained classes. |
|
4357 |
Return true if ok, false if not. |
|
4358 |
Notice: the argument may not have an extension (by purpose); |
|
7616 | 4359 |
the sharedLib extension (.dll / .so / .sl) is added here, to |
4360 |
make the caller independent of the underlying operatingSystem." |
|
6025 | 4361 |
|
4362 |
|path fn| |
|
4363 |
||
4364 |
ObjectFileLoader isNil ifTrue:[^ false]. |
|
4365 |
||
6837 | 4366 |
fn := aClassLibraryName asFilename withSuffix:(ObjectFileLoader sharedLibrarySuffix). |
4367 |
fn := fn pathName. |
|
6025 | 4368 |
|
4369 |
path := self getPackageDirectoryForPackage:packageID. |
|
4370 |
path isNil ifTrue:[^ false]. |
|
4371 |
path := path asFilename construct:fn. |
|
4372 |
path exists ifFalse:[^ false]. |
|
4373 |
||
4374 |
^ (ObjectFileLoader loadObjectFile:path pathName) notNil |
|
4375 |
||
4376 |
" |
|
4377 |
Smalltalk fileInClassLibrary:'libtable' |
|
4378 |
Smalltalk fileInClassLibrary:'binary/libwidg3' |
|
4379 |
Smalltalk fileInClassLibrary:'refactoryBrowser' inPackage:'stx:goodies/refactoryBrowser' |
|
4380 |
" |
|
4381 |
||
4382 |
"Modified: 8.1.1997 / 17:58:56 / cg" |
|
4383 |
! |
|
4384 |
||
7758 | 4385 |
fileInStream:aStream lazy:lazy silent:silent logged:logged addPath:morePath |
4386 |
"read sourceCode from aStream; |
|
4387 |
return true if ok, false if failed. |
|
4388 |
If lazy is true, no code is generated for methods, instead stubs |
|
4389 |
are created which compile themself when first executed. This allows |
|
4390 |
for much faster fileIn (but slows down the first execution later). |
|
4391 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
4392 |
code which is known to be syntactically correct. |
|
4393 |
If silent is true, no compiler messages are output to the transcript. |
|
4394 |
Giving nil for silent/lazy will use the current settings. |
|
4395 |
If morePath is nonNil, it is prepended to the systemPath temporarily during the |
|
4396 |
fileIn. This allows for st-expressions to refer to more files (i.e. fileIn more) |
|
4397 |
using a relative path." |
|
4398 |
||
4399 |
|wasLazy wasSilent oldSystemPath oldRealPath| |
|
4400 |
||
4401 |
aStream isNil ifTrue:[^ false]. |
|
4402 |
||
4403 |
lazy notNil ifTrue:[wasLazy := Compiler compileLazy:lazy]. |
|
4404 |
silent notNil ifTrue:[wasSilent := self silentLoading:silent]. |
|
8317
af17d81a91f5
Fix when fileIn changes SystemPath
Stefan Vogel <sv@exept.de>
parents:
8278
diff
changeset
|
4405 |
morePath notNil ifTrue:[ |
af17d81a91f5
Fix when fileIn changes SystemPath
Stefan Vogel <sv@exept.de>
parents:
8278
diff
changeset
|
4406 |
oldSystemPath := SystemPath copy. |
af17d81a91f5
Fix when fileIn changes SystemPath
Stefan Vogel <sv@exept.de>
parents:
8278
diff
changeset
|
4407 |
SystemPath addFirst:morePath. |
af17d81a91f5
Fix when fileIn changes SystemPath
Stefan Vogel <sv@exept.de>
parents:
8278
diff
changeset
|
4408 |
oldRealPath := RealSystemPath. |
af17d81a91f5
Fix when fileIn changes SystemPath
Stefan Vogel <sv@exept.de>
parents:
8278
diff
changeset
|
4409 |
RealSystemPath := nil. |
af17d81a91f5
Fix when fileIn changes SystemPath
Stefan Vogel <sv@exept.de>
parents:
8278
diff
changeset
|
4410 |
]. |
617 | 4411 |
[ |
8317
af17d81a91f5
Fix when fileIn changes SystemPath
Stefan Vogel <sv@exept.de>
parents:
8278
diff
changeset
|
4412 |
Class updateChangeFileQuerySignal answer:logged do:[ |
af17d81a91f5
Fix when fileIn changes SystemPath
Stefan Vogel <sv@exept.de>
parents:
8278
diff
changeset
|
4413 |
Class updateChangeListQuerySignal answer:logged do:[ |
af17d81a91f5
Fix when fileIn changes SystemPath
Stefan Vogel <sv@exept.de>
parents:
8278
diff
changeset
|
4414 |
aStream fileIn. |
af17d81a91f5
Fix when fileIn changes SystemPath
Stefan Vogel <sv@exept.de>
parents:
8278
diff
changeset
|
4415 |
] |
af17d81a91f5
Fix when fileIn changes SystemPath
Stefan Vogel <sv@exept.de>
parents:
8278
diff
changeset
|
4416 |
] |
6421
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4417 |
] ensure:[ |
8317
af17d81a91f5
Fix when fileIn changes SystemPath
Stefan Vogel <sv@exept.de>
parents:
8278
diff
changeset
|
4418 |
morePath notNil ifTrue:[ |
af17d81a91f5
Fix when fileIn changes SystemPath
Stefan Vogel <sv@exept.de>
parents:
8278
diff
changeset
|
4419 |
"take care, someone could have changed SystemPath during fileIn!!" |
af17d81a91f5
Fix when fileIn changes SystemPath
Stefan Vogel <sv@exept.de>
parents:
8278
diff
changeset
|
4420 |
(SystemPath copyFrom:2) = oldSystemPath ifTrue:[ |
af17d81a91f5
Fix when fileIn changes SystemPath
Stefan Vogel <sv@exept.de>
parents:
8278
diff
changeset
|
4421 |
SystemPath := oldSystemPath. |
af17d81a91f5
Fix when fileIn changes SystemPath
Stefan Vogel <sv@exept.de>
parents:
8278
diff
changeset
|
4422 |
RealSystemPath := oldRealPath. |
af17d81a91f5
Fix when fileIn changes SystemPath
Stefan Vogel <sv@exept.de>
parents:
8278
diff
changeset
|
4423 |
] ifFalse:[ |
af17d81a91f5
Fix when fileIn changes SystemPath
Stefan Vogel <sv@exept.de>
parents:
8278
diff
changeset
|
4424 |
(oldSystemPath includes:morePath) ifFalse:[ |
af17d81a91f5
Fix when fileIn changes SystemPath
Stefan Vogel <sv@exept.de>
parents:
8278
diff
changeset
|
4425 |
SystemPath remove:morePath ifAbsent:[]. |
af17d81a91f5
Fix when fileIn changes SystemPath
Stefan Vogel <sv@exept.de>
parents:
8278
diff
changeset
|
4426 |
]. |
af17d81a91f5
Fix when fileIn changes SystemPath
Stefan Vogel <sv@exept.de>
parents:
8278
diff
changeset
|
4427 |
RealSystemPath := nil. |
af17d81a91f5
Fix when fileIn changes SystemPath
Stefan Vogel <sv@exept.de>
parents:
8278
diff
changeset
|
4428 |
]. |
af17d81a91f5
Fix when fileIn changes SystemPath
Stefan Vogel <sv@exept.de>
parents:
8278
diff
changeset
|
4429 |
]. |
af17d81a91f5
Fix when fileIn changes SystemPath
Stefan Vogel <sv@exept.de>
parents:
8278
diff
changeset
|
4430 |
lazy notNil ifTrue:[Compiler compileLazy:wasLazy]. |
af17d81a91f5
Fix when fileIn changes SystemPath
Stefan Vogel <sv@exept.de>
parents:
8278
diff
changeset
|
4431 |
silent notNil ifTrue:[self silentLoading:wasSilent]. |
af17d81a91f5
Fix when fileIn changes SystemPath
Stefan Vogel <sv@exept.de>
parents:
8278
diff
changeset
|
4432 |
aStream close |
617 | 4433 |
]. |
4434 |
^ true |
|
4435 |
||
4436 |
" |
|
4437 |
Smalltalk fileInStream:('source/TicTacToe.st' asFilename readStream) lazy:true silent:true |
|
4438 |
" |
|
1896 | 4439 |
|
4440 |
"Modified: 5.11.1996 / 20:03:35 / cg" |
|
617 | 4441 |
! |
4442 |
||
7758 | 4443 |
isClassLibraryLoaded:name |
4444 |
"return true, if a particular class library is already loaded" |
|
4445 |
||
4446 |
ObjectMemory |
|
4447 |
binaryModuleInfo |
|
4448 |
do:[:entry | |
|
4449 |
entry type == #classLibrary ifTrue:[ |
|
4450 |
entry libraryName = name ifTrue:[ |
|
4451 |
^ true "/ already loaded |
|
4452 |
] |
|
4453 |
]. |
|
7616 | 4454 |
]. |
5881
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4455 |
|
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4456 |
^ false |
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4457 |
|
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4458 |
" |
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4459 |
Smalltalk isClassLibraryLoaded:'libbasic' |
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4460 |
Smalltalk isClassLibraryLoaded:'libwidg3' |
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4461 |
" |
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4462 |
! |
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4463 |
|
7758 | 4464 |
loadClassLibraryIfAbsent:name |
4465 |
"dynamically load a classLibrary, if not already loaded |
|
4466 |
and the system supports dynamic loading. |
|
4467 |
Return true, if the library is loaded, false if not. |
|
4468 |
This entry is called without system specific filename |
|
3044 | 4469 |
extensions - it is portable among different architectures |
4470 |
as long as corresponding files (x.so / x.dll / x.sl / x.o) |
|
4471 |
are be present ..." |
|
4472 |
||
5881
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4473 |
(self isClassLibraryLoaded:name) ifTrue:[ ^ true ]. "/ already loaded |
3044 | 4474 |
^ self fileInClassLibrary:name |
4475 |
||
4476 |
" |
|
4477 |
Smalltalk loadClassLibraryIfAbsent:'libbasic' |
|
4478 |
Smalltalk loadClassLibraryIfAbsent:'libwidg3' |
|
4479 |
" |
|
4480 |
||
4481 |
"Modified: 31.10.1996 / 16:57:24 / cg" |
|
7758 | 4482 |
! |
4483 |
||
4484 |
secureFileIn:aFileName |
|
4485 |
"read in the named file, looking for it at standard places. |
|
4486 |
Catch any error during fileIn. Return true if ok, false if failed" |
|
4487 |
||
4488 |
|retVal| |
|
4489 |
||
4490 |
retVal := false. |
|
4491 |
||
4492 |
(SignalSet with:AbortSignal with:Process terminateSignal) |
|
4493 |
handle:[:ex | |
|
4494 |
ex return |
|
4495 |
] do:[ |
|
4496 |
retVal := self fileIn:aFileName |
|
4497 |
]. |
|
4498 |
^ retVal |
|
4499 |
! |
|
4500 |
||
4501 |
silentFileIn:aFilename |
|
4502 |
"same as fileIn:, but do not output 'compiled...'-messages on Transcript. |
|
4503 |
Main use is during startup." |
|
4504 |
||
4505 |
|wasSilent| |
|
4506 |
||
4507 |
wasSilent := self silentLoading:true. |
|
4508 |
[ |
|
4509 |
self fileIn:aFilename |
|
4510 |
] ensure:[ |
|
4511 |
self silentLoading:wasSilent |
|
4512 |
] |
|
3044 | 4513 |
! ! |
4514 |
||
4515 |
!Smalltalk class methodsFor:'system management-files'! |
|
4516 |
||
7758 | 4517 |
bitmapFileStreamFor:aFileName |
4518 |
"search aFileName in some standard places; |
|
4519 |
return a readonly fileStream or nil if not found. |
|
4520 |
Searches in subdirectories named 'bitmaps' in the SystemPath. |
|
4521 |
Notice: this does not look in the package-specific bitmaps directories." |
|
4522 |
||
4523 |
|aString| |
|
4524 |
||
4525 |
aString := self getBitmapFileName:aFileName. |
|
4526 |
aString notNil ifTrue:[ |
|
4527 |
^ aString asFilename readStreamOrNil |
|
4528 |
]. |
|
4529 |
^ nil |
|
4530 |
! |
|
4531 |
||
4532 |
bitmapFromFileNamed:aFileName forClass:aClass |
|
7563 | 4533 |
"search aFileName in some standard places: |
5089 | 4534 |
first in the redefinable bitmaps path, |
4535 |
then in the classes own package directory if existing. |
|
5040 | 4536 |
Return an image or nil." |
4537 |
||
5089 | 4538 |
^ self imageFromFileNamed:aFileName inPackage:(aClass package) |
5040 | 4539 |
|
4540 |
" |
|
4541 |
Smalltalk bitmapFromFileNamed:'SmalltalkX.xbm' forClass:View |
|
4542 |
" |
|
4543 |
! |
|
4544 |
||
7758 | 4545 |
bitmapFromFileNamed:aFileName inPackage:aPackage |
4546 |
"search aFileName in some standard places: |
|
4547 |
first in the redefinable bitmaps path, |
|
4548 |
then in the package directory if existing. |
|
4549 |
Return an image or nil." |
|
4550 |
||
4551 |
^ self imageFromFileNamed:aFileName inPackage:aPackage |
|
4552 |
||
4553 |
" |
|
4554 |
Smalltalk bitmapFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libview' |
|
5041 | 4555 |
Smalltalk bitmapFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libtool' |
5040 | 4556 |
" |
4557 |
! |
|
4558 |
||
7758 | 4559 |
classNameForFile:aFileName |
4560 |
"return the className which corresponds to an abbreviated fileName, |
|
4561 |
or nil if no special translation applies. The given filename arg may |
|
4562 |
include a '.st' suffix (but no other)." |
|
4563 |
||
4564 |
|fn| |
|
4565 |
||
4566 |
(aFileName asFilename hasSuffix:'st') ifTrue:[ |
|
7616 | 4567 |
fn := aFileName copyWithoutLast:3 |
3044 | 4568 |
] ifFalse:[ |
7616 | 4569 |
fn := aFileName |
3044 | 4570 |
]. |
4571 |
^ self filenameAbbreviations keyAtEqualValue:fn ifAbsent:[fn]. |
|
4572 |
||
4573 |
" |
|
4574 |
Smalltalk classNameForFile:'DrawObj' |
|
4575 |
Smalltalk classNameForFile:'DrawObj.st' |
|
4576 |
Smalltalk classNameForFile:'ArrColl.st' |
|
4577 |
Smalltalk classNameForFile:'ArrColl.chg' |
|
4578 |
" |
|
4579 |
||
4580 |
"Modified: 11.12.1995 / 14:51:10 / cg" |
|
4581 |
! |
|
4582 |
||
7758 | 4583 |
constructPathFor:aDirectoryName |
4584 |
"search for aDirectory in SystemPath; |
|
4585 |
return a collection of pathes which include that directory." |
|
4586 |
||
4587 |
^ self realSystemPath select:[:dirName | |
|
4588 |
|fullPath| |
|
4589 |
||
4590 |
fullPath := dirName asFilename construct:aDirectoryName. |
|
4591 |
"/ fullPath exists and:[fullPath isDirectory and:[fullPath isReadable]] |
|
4592 |
fullPath isDirectory and:[fullPath isReadable] |
|
4593 |
]. |
|
4594 |
! |
|
4595 |
||
4596 |
fileInFileStreamFor:aFileName |
|
4597 |
"search aFileName in some standard places; |
|
4598 |
return a readonly fileStream or nil if not found. |
|
4599 |
Searches in subdirectories named 'fileIn' in SystemPath" |
|
4600 |
||
4601 |
|aString| |
|
4602 |
||
4603 |
aString := self getFileInFileName:aFileName. |
|
4604 |
aString notNil ifTrue:[ |
|
4605 |
^ aString asFilename readStreamOrNil |
|
4606 |
]. |
|
4607 |
^ nil |
|
4608 |
! |
|
4609 |
||
4610 |
fileNameForClass:aClassOrClassName |
|
4611 |
"return a filename for aClassOrClassName" |
|
4612 |
||
4613 |
|cls nm1 nm2| |
|
4614 |
||
4615 |
aClassOrClassName isBehavior ifTrue:[ |
|
8084
88bccdc5943d
fileNameForClass (when checking in): repl. colons by underlines
Claus Gittinger <cg@exept.de>
parents:
7999
diff
changeset
|
4616 |
nm1 := aClassOrClassName theNonMetaclass name. |
88bccdc5943d
fileNameForClass (when checking in): repl. colons by underlines
Claus Gittinger <cg@exept.de>
parents:
7999
diff
changeset
|
4617 |
nm2 := aClassOrClassName theNonMetaclass nameWithoutPrefix. |
7758 | 4618 |
] ifFalse:[ |
8084
88bccdc5943d
fileNameForClass (when checking in): repl. colons by underlines
Claus Gittinger <cg@exept.de>
parents:
7999
diff
changeset
|
4619 |
cls := Smalltalk classNamed:aClassOrClassName. |
88bccdc5943d
fileNameForClass (when checking in): repl. colons by underlines
Claus Gittinger <cg@exept.de>
parents:
7999
diff
changeset
|
4620 |
cls notNil ifTrue:[ |
88bccdc5943d
fileNameForClass (when checking in): repl. colons by underlines
Claus Gittinger <cg@exept.de>
parents:
7999
diff
changeset
|
4621 |
nm1 := cls theNonMetaclass name. |
88bccdc5943d
fileNameForClass (when checking in): repl. colons by underlines
Claus Gittinger <cg@exept.de>
parents:
7999
diff
changeset
|
4622 |
nm2 := cls theNonMetaclass nameWithoutPrefix. |
88bccdc5943d
fileNameForClass (when checking in): repl. colons by underlines
Claus Gittinger <cg@exept.de>
parents:
7999
diff
changeset
|
4623 |
] ifFalse:[ |
88bccdc5943d
fileNameForClass (when checking in): repl. colons by underlines
Claus Gittinger <cg@exept.de>
parents:
7999
diff
changeset
|
4624 |
nm1 := aClassOrClassName. |
88bccdc5943d
fileNameForClass (when checking in): repl. colons by underlines
Claus Gittinger <cg@exept.de>
parents:
7999
diff
changeset
|
4625 |
nm2 := (aClassOrClassName copyFrom:(aClassOrClassName lastIndexOf:$:)+1). |
88bccdc5943d
fileNameForClass (when checking in): repl. colons by underlines
Claus Gittinger <cg@exept.de>
parents:
7999
diff
changeset
|
4626 |
]. |
7758 | 4627 |
]. |
4628 |
nm1 := nm1 asSymbol. |
|
4629 |
nm2 := nm2 asSymbol. |
|
4630 |
||
4631 |
CachedAbbreviations notNil ifTrue:[ |
|
8084
88bccdc5943d
fileNameForClass (when checking in): repl. colons by underlines
Claus Gittinger <cg@exept.de>
parents:
7999
diff
changeset
|
4632 |
(CachedAbbreviations includesKey:nm1) ifTrue:[ |
88bccdc5943d
fileNameForClass (when checking in): repl. colons by underlines
Claus Gittinger <cg@exept.de>
parents:
7999
diff
changeset
|
4633 |
^ CachedAbbreviations at:nm1 |
88bccdc5943d
fileNameForClass (when checking in): repl. colons by underlines
Claus Gittinger <cg@exept.de>
parents:
7999
diff
changeset
|
4634 |
]. |
88bccdc5943d
fileNameForClass (when checking in): repl. colons by underlines
Claus Gittinger <cg@exept.de>
parents:
7999
diff
changeset
|
4635 |
(CachedAbbreviations includesKey:nm2) ifTrue:[ |
88bccdc5943d
fileNameForClass (when checking in): repl. colons by underlines
Claus Gittinger <cg@exept.de>
parents:
7999
diff
changeset
|
4636 |
^ CachedAbbreviations at:nm2 |
88bccdc5943d
fileNameForClass (when checking in): repl. colons by underlines
Claus Gittinger <cg@exept.de>
parents:
7999
diff
changeset
|
4637 |
]. |
88bccdc5943d
fileNameForClass (when checking in): repl. colons by underlines
Claus Gittinger <cg@exept.de>
parents:
7999
diff
changeset
|
4638 |
]. |
88bccdc5943d
fileNameForClass (when checking in): repl. colons by underlines
Claus Gittinger <cg@exept.de>
parents:
7999
diff
changeset
|
4639 |
^ nm1 copyReplaceAll:$: with:$_ |
88bccdc5943d
fileNameForClass (when checking in): repl. colons by underlines
Claus Gittinger <cg@exept.de>
parents:
7999
diff
changeset
|
4640 |
|
617 | 4641 |
" |
7723
ed4ce2184b37
Fix #filenameForClass: handling of abbreviations
Stefan Vogel <sv@exept.de>
parents:
7704
diff
changeset
|
4642 |
Smalltalk fileNameForClass:#Complex |
617 | 4643 |
Smalltalk fileNameForClass:'SmallInteger' |
3678 | 4644 |
Smalltalk fileNameForClass:'UnixOperatingSystem' |
4746 | 4645 |
Smalltalk fileNameForClass:'Launcher' |
617 | 4646 |
Smalltalk fileNameForClass:'SomeUnknownClass' |
4746 | 4647 |
Smalltalk fileNameForClass:OSI::FTAMOperation |
4648 |
Smalltalk fileNameForClass:'OSI::Foobar' |
|
617 | 4649 |
" |
4650 |
||
6151
e36a9b339582
isMeta/soleInstance -> theMetaclass / theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
6121
diff
changeset
|
4651 |
"Modified: / 5.11.2001 / 16:49:17 / cg" |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
4652 |
! |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
4653 |
|
7758 | 4654 |
filenameAbbreviations |
4655 |
"return a dictionary containing the classname-to-filename |
|
4656 |
mappings. (needed for sys5.3 users, where filenames are limited |
|
617 | 4657 |
to 14 chars)" |
4658 |
||
4659 |
CachedAbbreviations isNil ifTrue:[ |
|
7616 | 4660 |
self readAbbreviations |
617 | 4661 |
]. |
4662 |
^ CachedAbbreviations |
|
4663 |
||
4664 |
"flush with: |
|
4665 |
||
4666 |
CachedAbbreviations := nil |
|
4667 |
" |
|
4668 |
" |
|
4669 |
Smalltalk filenameAbbreviations |
|
4670 |
" |
|
4671 |
! |
|
4672 |
||
7758 | 4673 |
flushPathCaches |
4674 |
"{ Pragma: +optSpace }" |
|
4675 |
||
4676 |
"forget pathCaches - these are collections containing valid directory names, |
|
2378 | 4677 |
where system files (resource, bitmaps etc.) are found. |
4678 |
A flush is only required, if a new system directory has been created while |
|
4679 |
the system is active, and those files should override the others |
|
4680 |
(for example, if you created a private resource directory)" |
|
4681 |
||
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
4682 |
RealSystemPath := ResourcePath := SourcePath := |
5052 | 4683 |
BitmapPath := BinaryPath := FileInPath := nil |
2378 | 4684 |
|
4685 |
" |
|
4686 |
Smalltalk flushPathCaches |
|
4687 |
" |
|
617 | 4688 |
! |
4689 |
||
7758 | 4690 |
getBinaryFileName:aFileName |
4691 |
"search aFileName in some standard places |
|
4692 |
(subdirectories named 'binary' in SystemPath); |
|
4693 |
return the absolute filename or nil if none is found." |
|
4694 |
||
4695 |
BinaryPath isNil ifTrue:[ |
|
4696 |
BinaryPath := self constructPathFor:BinaryDirName |
|
617 | 4697 |
]. |
4698 |
||
2928 | 4699 |
^ self searchPath:BinaryPath for:aFileName in:BinaryDirName |
1562
850a88ecff97
searchPath: dont use it, if fileName starts with "./" or "../"
Claus Gittinger <cg@exept.de>
parents:
1553
diff
changeset
|
4700 |
|
850a88ecff97
searchPath: dont use it, if fileName starts with "./" or "../"
Claus Gittinger <cg@exept.de>
parents:
1553
diff
changeset
|
4701 |
"Modified: 18.7.1996 / 15:53:49 / cg" |
453 | 4702 |
! |
4703 |
||
7758 | 4704 |
getBitmapFileName:aFileName |
4705 |
"search aFileName in some standard places |
|
4706 |
(subdirectories named 'bitmaps' in SystemPath); |
|
4707 |
return the absolute filename or nil if none is found." |
|
4708 |
||
4709 |
|f| |
|
4710 |
||
4711 |
BitmapPath isNil ifTrue:[ |
|
7616 | 4712 |
BitmapPath := self constructPathFor:BitmapDirName |
617 | 4713 |
]. |
4714 |
||
2974 | 4715 |
"/ first, try a bitmaps subdir along the path. |
4716 |
f := self searchPath:BitmapPath for:aFileName in:BitmapDirName. |
|
4717 |
f isNil ifTrue:[ |
|
7616 | 4718 |
"/ then, try it itself along the path. |
4719 |
f := self searchPath:self realSystemPath for:aFileName in:nil |
|
2974 | 4720 |
]. |
4721 |
^ f |
|
617 | 4722 |
|
4723 |
" |
|
4724 |
Smalltalk getBitmapFileName:'SBrowser.xbm' |
|
4725 |
" |
|
1562
850a88ecff97
searchPath: dont use it, if fileName starts with "./" or "../"
Claus Gittinger <cg@exept.de>
parents:
1553
diff
changeset
|
4726 |
|
850a88ecff97
searchPath: dont use it, if fileName starts with "./" or "../"
Claus Gittinger <cg@exept.de>
parents:
1553
diff
changeset
|
4727 |
"Modified: 18.7.1996 / 15:53:55 / cg" |
617 | 4728 |
! |
4729 |
||
7758 | 4730 |
getFileInFileName:aFileName |
4731 |
"search aFileName in some standard places |
|
4732 |
(subdirectories named 'fileIn' in SystemPath); |
|
4733 |
return the absolute filename or nil if none is found." |
|
4734 |
||
4735 |
FileInPath isNil ifTrue:[ |
|
4736 |
FileInPath := self constructPathFor:FileInDirName |
|
4737 |
]. |
|
4738 |
||
4739 |
^ self searchPath:FileInPath for:aFileName in:FileInDirName |
|
4740 |
||
4741 |
"Modified: 18.7.1996 / 15:53:59 / cg" |
|
4742 |
! |
|
4743 |
||
4744 |
getPackageDirectoryForPackage:aPackageID |
|
4745 |
"search for a particular package; return its directory, or nil" |
|
5550
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4746 |
|
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4747 |
|packageDir| |
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4748 |
|
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4749 |
packageDir := aPackageID copyReplaceAll:$: with:$/. |
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4750 |
self packagePath do:[:aPath | |
7616 | 4751 |
|dir| |
4752 |
||
4753 |
dir := aPath asFilename construct:packageDir. |
|
4754 |
(dir exists and:[dir isDirectory]) ifTrue:[^ dir]. |
|
5550
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4755 |
]. |
5785
872483483444
oops - getPackageDirectoryForPackage now cares for the case
Claus Gittinger <cg@exept.de>
parents:
5781
diff
changeset
|
4756 |
|
872483483444
oops - getPackageDirectoryForPackage now cares for the case
Claus Gittinger <cg@exept.de>
parents:
5781
diff
changeset
|
4757 |
"/ not found - special case for the stx package ... |
872483483444
oops - getPackageDirectoryForPackage now cares for the case
Claus Gittinger <cg@exept.de>
parents:
5781
diff
changeset
|
4758 |
(aPackageID upTo:$:) = 'stx' ifTrue:[ |
7616 | 4759 |
packageDir := aPackageID copyFrom:(aPackageID indexOf:$:) + 1. |
4760 |
packageDir := '../../' , packageDir. |
|
4761 |
packageDir := packageDir asFilename. |
|
4762 |
(packageDir exists and:[packageDir isDirectory]) ifTrue:[^ packageDir]. |
|
5785
872483483444
oops - getPackageDirectoryForPackage now cares for the case
Claus Gittinger <cg@exept.de>
parents:
5781
diff
changeset
|
4763 |
]. |
5550
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4764 |
^ nil |
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4765 |
|
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4766 |
" |
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4767 |
Smalltalk getPackageDirectoryForPackage:(Array package) |
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4768 |
Smalltalk getPackageDirectoryForPackage:'stx:goodies/bitmaps' |
5785
872483483444
oops - getPackageDirectoryForPackage now cares for the case
Claus Gittinger <cg@exept.de>
parents:
5781
diff
changeset
|
4769 |
Smalltalk getPackageDirectoryForPackage:'stx:libview' |
5550
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4770 |
" |
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4771 |
! |
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4772 |
|
7758 | 4773 |
getPackageFileName:aFileName |
4774 |
"search aFileName in some standard places |
|
4775 |
(packagePath and subdirectories named 'packages' in SystemPath); |
|
4776 |
return the absolute filename or nil if none is found." |
|
4777 |
||
4778 |
|f| |
|
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
4779 |
|
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
4780 |
"/ search along packagePath ... |
5052 | 4781 |
f := self searchPath:self packagePath for:aFileName in:nil. |
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
4782 |
f isNil ifTrue:[ |
7616 | 4783 |
"/ search under packages-directory along systemPath ... |
4784 |
f := self searchPath:self realSystemPath for:aFileName in:PackageDirName. |
|
4785 |
"/ kludge - allow for stx-directory to be named differently |
|
4786 |
f isNil ifTrue:[ |
|
4787 |
(aFileName startsWith:'stx') ifTrue:[ |
|
4788 |
(aFileName startsWith:'stx' , Filename separator) ifTrue:[ |
|
4789 |
f := '../..' asFilename construct:(aFileName copyFrom:5). |
|
4790 |
f exists ifTrue:[ |
|
4791 |
^ f pathName |
|
4792 |
]. |
|
4793 |
] |
|
4794 |
]. |
|
4795 |
]. |
|
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
4796 |
]. |
5878
b89d789e1705
always return a string from #getPackageFileName
Claus Gittinger <cg@exept.de>
parents:
5860
diff
changeset
|
4797 |
(f notNil and:[(f := f asFilename) exists]) ifTrue:[ |
7616 | 4798 |
^ f pathName |
5878
b89d789e1705
always return a string from #getPackageFileName
Claus Gittinger <cg@exept.de>
parents:
5860
diff
changeset
|
4799 |
]. |
b89d789e1705
always return a string from #getPackageFileName
Claus Gittinger <cg@exept.de>
parents:
5860
diff
changeset
|
4800 |
^ nil |
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
4801 |
|
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
4802 |
" |
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
4803 |
Smalltalk getPackageFileName:'stx/libview/resources/normal.style' |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
4804 |
Smalltalk getPackageFileName:'stx/libview/source.zip' |
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
4805 |
" |
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
4806 |
! |
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
4807 |
|
7758 | 4808 |
getResourceFileName:aFileName |
4809 |
"search aFileName in some standard places |
|
4810 |
(subdirectories named 'resource' in SystemPath); |
|
4811 |
return the absolute filename or nil if none is found." |
|
4812 |
||
4813 |
|f| |
|
4814 |
||
4815 |
ResourcePath isNil ifTrue:[ |
|
4816 |
ResourcePath := self constructPathFor:ResourceDirName |
|
4817 |
]. |
|
4818 |
||
4819 |
"/ first, try a resource subdir along the path. |
|
4820 |
f := self searchPath:ResourcePath for:aFileName in:ResourceDirName. |
|
2974 | 4821 |
f isNil ifTrue:[ |
7616 | 4822 |
"/ then, try it itself along the path. |
4823 |
f := self searchPath:self realSystemPath for:aFileName in:nil |
|
2974 | 4824 |
]. |
4825 |
^ f |
|
617 | 4826 |
|
4827 |
" |
|
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
4828 |
Smalltalk getResourceFileName:'SystemBrowser.rs' |
617 | 4829 |
" |
1562
850a88ecff97
searchPath: dont use it, if fileName starts with "./" or "../"
Claus Gittinger <cg@exept.de>
parents:
1553
diff
changeset
|
4830 |
|
850a88ecff97
searchPath: dont use it, if fileName starts with "./" or "../"
Claus Gittinger <cg@exept.de>
parents:
1553
diff
changeset
|
4831 |
"Modified: 18.7.1996 / 15:54:03 / cg" |
617 | 4832 |
! |
4833 |
||
7758 | 4834 |
getResourceFileName:aFileName forClass:aClassOrNil |
4835 |
"search aFileName in some standard places |
|
4836 |
(subdirectories named 'resource' in SystemPath); |
|
4837 |
and in aClasses package directory. |
|
4838 |
Return the absolute filename or nil if none is found." |
|
4839 |
||
4840 |
|pkgOrNil| |
|
4841 |
||
4842 |
aClassOrNil notNil ifTrue:[ |
|
4843 |
pkgOrNil := aClassOrNil package. |
|
4844 |
]. |
|
4845 |
^ self getResourceFileName:aFileName forPackage:pkgOrNil. |
|
4846 |
||
4847 |
" |
|
4848 |
Smalltalk getResourceFileName:'SystemBrowser.rs' forClass:SystemBrowser |
|
4849 |
" |
|
4850 |
! |
|
4851 |
||
4852 |
getResourceFileName:aFileName forPackage:aPackageIDOrNil |
|
4853 |
"search aFileName in some standard places |
|
4854 |
(subdirectories named 'resource' in SystemPath); |
|
4855 |
and in a packages directory. |
|
4856 |
Return the absolute filename or nil if none is found." |
|
4857 |
||
4858 |
|f dir packageDir| |
|
4859 |
||
4860 |
f := self getResourceFileName:aFileName. |
|
4861 |
f notNil ifTrue:[^ f]. |
|
4862 |
||
4863 |
aPackageIDOrNil notNil ifTrue:[ |
|
4864 |
packageDir := aPackageIDOrNil copyReplaceAll:$: with:$/. |
|
4865 |
self packagePath do:[:aPath | |
|
7616 | 4866 |
|pD| |
4867 |
||
4868 |
pD := aPath asFilename construct:packageDir. |
|
4869 |
pD exists ifTrue:[ |
|
4870 |
f := pD construct:aFileName. |
|
4871 |
f exists ifTrue:[ |
|
4872 |
^ f pathName |
|
4873 |
]. |
|
4874 |
f := (pD construct:'resources') construct:aFileName. |
|
4875 |
f exists ifTrue:[ |
|
4876 |
^ f pathName |
|
4877 |
]. |
|
4878 |
]. |
|
4879 |
]. |
|
4880 |
||
4881 |
dir := Smalltalk getPackageDirectoryForPackage:(aPackageIDOrNil ? 'stx:libview'). |
|
4882 |
dir notNil ifTrue:[ |
|
4883 |
f := (dir asFilename construct:'resources') construct:aFileName. |
|
4884 |
f exists ifTrue:[ |
|
4885 |
^ f pathName |
|
4886 |
]. |
|
4887 |
f := (dir asFilename construct:'styles') construct:aFileName. |
|
4888 |
f exists ifTrue:[ |
|
4889 |
^ f pathName |
|
4890 |
]. |
|
4891 |
]. |
|
5043 | 4892 |
]. |
4893 |
^ nil |
|
4894 |
||
4895 |
" |
|
5065 | 4896 |
Smalltalk getResourceFileName:'SystemBrowser.rs' forPackage:'stx:libtool' |
5080 | 4897 |
Smalltalk getResourceFileName:'normal.style' forPackage:'stx:libview' |
5043 | 4898 |
" |
4899 |
! |
|
4900 |
||
7758 | 4901 |
getSourceFileName:aFileName |
7563 | 4902 |
"search aFileName in some standard places |
4903 |
(subdirectories named 'source' in SystemPath); |
|
736 | 4904 |
return the absolute filename or nil if none is found. |
4905 |
This is used to find a sourceFile for a methods source, |
|
4906 |
if no sourceCodeManager is available." |
|
617 | 4907 |
|
2959 | 4908 |
|f| |
4909 |
||
617 | 4910 |
SourcePath isNil ifTrue:[ |
7616 | 4911 |
SourcePath := self constructPathFor:SourceDirName |
617 | 4912 |
]. |
4913 |
||
2959 | 4914 |
"/ first, try a source subdir along the path. |
4770 | 4915 |
SourcePath notNil ifTrue:[ |
7616 | 4916 |
f := self searchPath:SourcePath for:aFileName in:SourceDirName. |
4770 | 4917 |
]. |
2959 | 4918 |
f isNil ifTrue:[ |
7616 | 4919 |
"/ then, try it itself along the path. |
4920 |
f := self searchPath:self realSystemPath for:aFileName in:nil |
|
2959 | 4921 |
]. |
4922 |
^ f |
|
191 | 4923 |
|
4924 |
" |
|
736 | 4925 |
Smalltalk getSourceFileName:'Smalltalk.st' |
4926 |
Smalltalk getSourceFileName:'ArrColl.st' |
|
191 | 4927 |
" |
1562
850a88ecff97
searchPath: dont use it, if fileName starts with "./" or "../"
Claus Gittinger <cg@exept.de>
parents:
1553
diff
changeset
|
4928 |
|
850a88ecff97
searchPath: dont use it, if fileName starts with "./" or "../"
Claus Gittinger <cg@exept.de>
parents:
1553
diff
changeset
|
4929 |
"Modified: 18.7.1996 / 15:54:07 / cg" |
617 | 4930 |
! |
4931 |
||
7758 | 4932 |
getSystemFileName:aFileNameOrString |
4933 |
"search aFileNameOrString in some standard places; |
|
4934 |
return the absolute filename or nil if none is found. |
|
4935 |
see comment in Smalltalk>>initSystemPath. |
|
4936 |
This should be used to access resources such as bitmaps, doc-files, |
|
4937 |
and other help files. |
|
4938 |
" |
|
4939 |
||
4940 |
"credits for this method go to Markus ...." |
|
4941 |
||
4942 |
|fn nameString| |
|
4943 |
||
4944 |
fn := aFileNameOrString asFilename. |
|
2933 | 4945 |
nameString := fn name. |
2896 | 4946 |
fn isAbsolute ifTrue:[ |
7616 | 4947 |
"dont use path for absolute file names" |
4948 |
||
4949 |
^ nameString |
|
191 | 4950 |
]. |
4951 |
||
617 | 4952 |
self realSystemPath do:[:dirName | |
7616 | 4953 |
|realName| |
4954 |
||
4955 |
realName := dirName asFilename construct:nameString. |
|
4956 |
"/ |
|
4957 |
"/ here, we also return true if its a directory |
|
4958 |
"/ (Even if unreadable). |
|
4959 |
"/ It could be that the file itself is still readable. |
|
4960 |
"/ |
|
4961 |
(realName isDirectory or:[realName isReadable]) ifTrue: [ |
|
4962 |
^ realName name |
|
4963 |
] |
|
191 | 4964 |
]. |
617 | 4965 |
^ nil |
4150 | 4966 |
|
4967 |
" |
|
4968 |
Smalltalk getSystemFileName:'doc/online/english/TOP.html' |
|
4969 |
Smalltalk getSystemFileName:'bitmaps/SBrowser.xbm' |
|
4970 |
Smalltalk getSystemFileName:'bitmaps/foo' |
|
4971 |
Smalltalk getSystemFileName:'resources/View.rs' |
|
4972 |
Smalltalk getSystemFileName:'resources/iris.style' |
|
4973 |
" |
|
4974 |
||
4975 |
"Modified: / 6.5.1999 / 10:40:37 / cg" |
|
617 | 4976 |
! |
4977 |
||
7758 | 4978 |
imageFromFileNamed:aFileName forClass:aClass |
4979 |
"search aFileName in some standard places: |
|
4980 |
first in the redefinable bitmaps path, then in the classes |
|
4981 |
own package directory if existing. |
|
5089 | 4982 |
Return an image or nil." |
4983 |
||
5113 | 4984 |
|package nm img| |
4985 |
||
4986 |
package := aClass package. |
|
4987 |
img := self imageFromFileNamed:aFileName inPackage:package. |
|
4988 |
img isNil ifTrue:[ |
|
7616 | 4989 |
package ~= 'stx:goodies' ifTrue:[ |
4990 |
"/ try under the goodies package ... |
|
4991 |
img := Smalltalk imageFromFileNamed:aFileName inPackage:'stx:goodies'. |
|
4992 |
]. |
|
4993 |
img isNil ifTrue:[ |
|
4994 |
(aFileName startsWith:'bitmaps') ifFalse:[ |
|
4995 |
nm := 'bitmaps/' , aFileName. |
|
4996 |
img := Smalltalk imageFromFileNamed:nm forClass:self. |
|
4997 |
img isNil ifTrue:[ |
|
4998 |
img := Smalltalk imageFromFileNamed:nm inPackage:'stx:goodies'. |
|
4999 |
] |
|
5000 |
]. |
|
5001 |
||
5002 |
img isNil ifTrue:[ |
|
5003 |
img := Smalltalk imageFromFileNamed:aFileName inPackage:'stx:goodies'. |
|
5004 |
]. |
|
5005 |
] |
|
5113 | 5006 |
]. |
5007 |
^ img |
|
5089 | 5008 |
|
5009 |
" |
|
5010 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' forClass:View |
|
5011 |
" |
|
5012 |
! |
|
5013 |
||
7758 | 5014 |
imageFromFileNamed:aFileName inPackage:aPackage |
5015 |
"search aFileName in some standard places: |
|
5016 |
first in the redefinable bitmaps path, then in the |
|
5017 |
package directory if existing. |
|
5089 | 5018 |
Return an image or nil." |
5019 |
||
5020 |
|i f dir| |
|
5021 |
||
5022 |
i := Image fromFile:aFileName resolution:100. |
|
5860 | 5023 |
i notNil ifTrue:[^ i]. |
5024 |
||
5025 |
f := self getBitmapFileName:aFileName. |
|
5026 |
f notNil ifTrue:[ |
|
7616 | 5027 |
i := Image fromFile:f. |
5028 |
i notNil ifTrue:[^ i]. |
|
5860 | 5029 |
]. |
5030 |
dir := self projectDirectoryForPackage:aPackage. |
|
5031 |
dir isNil ifTrue:[^ nil]. |
|
5032 |
||
5033 |
((f := aFileName) startsWith:'bitmaps/') ifFalse:[ |
|
7616 | 5034 |
i := Image fromFile:(dir asFilename construct:f). |
5035 |
i notNil ifTrue:[^ i]. |
|
5860 | 5036 |
|
7616 | 5037 |
f := 'bitmaps/' , aFileName. |
5860 | 5038 |
]. |
5039 |
^ Image fromFile:(dir asFilename construct:f). |
|
5089 | 5040 |
|
5041 |
" |
|
5587
4c4d67ad0e51
avoid obsoleteMessage warning (Filename ,)
Claus Gittinger <cg@exept.de>
parents:
5580
diff
changeset
|
5042 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libview' |
4c4d67ad0e51
avoid obsoleteMessage warning (Filename ,)
Claus Gittinger <cg@exept.de>
parents:
5580
diff
changeset
|
5043 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libtool' |
4c4d67ad0e51
avoid obsoleteMessage warning (Filename ,)
Claus Gittinger <cg@exept.de>
parents:
5580
diff
changeset
|
5044 |
Smalltalk imageFromFileNamed:'bitmaps/gifImages/garfield.gif' inPackage:'stx:goodies' |
5089 | 5045 |
" |
5046 |
! |
|
5047 |
||
7758 | 5048 |
libraryFileNameOfClass:aClassOrClassName |
5049 |
"for a given class, return the name of a classLibrary which contains |
|
5050 |
binary code for it. |
|
5051 |
Read the libinfo file 'liblist.stc' (which is created during the compilation process) |
|
5052 |
for an entry for aClassOrClassName. |
|
5053 |
Search for the className in the first col, and return the value found in |
|
5054 |
the 2nd col. |
|
5055 |
Return nil if no entry is found. |
|
5056 |
||
5057 |
A nil returns means that this class is either built-in or not present |
|
5058 |
in a package-class library (i.e. either as separate .o or separate .st file). |
|
5059 |
Otherwise, the returned name is the classLibrary object of that class. |
|
5060 |
The classes code can be loaded from that file if binary loading is supported." |
|
5061 |
||
5062 |
|aStream line words n aClassName| |
|
5063 |
||
5064 |
aClassOrClassName isBehavior ifTrue:[ |
|
5065 |
aClassName := aClassOrClassName name |
|
5066 |
] ifFalse:[ |
|
5067 |
aClassName := aClassOrClassName |
|
617 | 5068 |
]. |
5069 |
aClassName := aClassName asString. |
|
5070 |
||
5071 |
#('include/liblist.stc') "/ filenames |
|
5072 |
with:#(2) "/ column |
|
5073 |
do:[:fileName :col | |
|
5074 |
||
7616 | 5075 |
aStream := self systemFileStreamFor:fileName. |
5076 |
aStream notNil ifTrue:[ |
|
5077 |
[aStream atEnd] whileFalse:[ |
|
5078 |
line := aStream nextLine. |
|
5079 |
line notNil ifTrue:[ |
|
5080 |
(line startsWith:'#') ifFalse:[ |
|
5081 |
words := line asCollectionOfWords. |
|
5082 |
(n := words size) > 1 ifTrue:[ |
|
5083 |
(words at:1) = aClassName ifTrue:[ |
|
5084 |
n >= col ifTrue:[ |
|
5085 |
aStream close. |
|
5086 |
^ (words at:col) withoutSeparators |
|
5087 |
] |
|
5088 |
] |
|
5089 |
] |
|
5090 |
] |
|
5091 |
] |
|
5092 |
]. |
|
5093 |
aStream close |
|
5094 |
]. |
|
617 | 5095 |
]. |
5096 |
||
5097 |
^ nil |
|
5098 |
||
5099 |
" |
|
5100 |
Smalltalk libraryFileNameOfClass:'ClockView' |
|
5101 |
Smalltalk libraryFileNameOfClass:'Bag' |
|
5102 |
" |
|
5103 |
||
5104 |
"Modified: 6.11.1995 / 15:41:39 / cg" |
|
5105 |
! |
|
5106 |
||
7758 | 5107 |
packagePath |
5108 |
"return a collection of additional directorynames, where smalltalk |
|
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5109 |
looks for package directories. |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5110 |
Notice, that directories named 'packages' under the systemPath are |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5111 |
always consulted - even if not in the packagePath" |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5112 |
|
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5113 |
^ PackagePath |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5114 |
|
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5115 |
" |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5116 |
Smalltalk packagePath |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5117 |
Smalltalk packagePath addLast:'/opt/smalltalk' |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5118 |
Smalltalk packagePath addFirst:'/usr/local/otherPackages' |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5119 |
" |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5120 |
! |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5121 |
|
7758 | 5122 |
packagePath:aPath |
5123 |
"set the packagePath; |
|
5124 |
a collection of additional directorynames, where smalltalk |
|
5125 |
looks for package directories. |
|
5126 |
Notice, that directories named 'packages' under the systemPath are |
|
5127 |
always consulted - even if not in the packagePath" |
|
5128 |
||
5129 |
PackagePath := aPath asOrderedCollection |
|
5130 |
||
5131 |
" |
|
5132 |
Smalltalk packagePath:#( '.' '/opt/stx' '/opt/smalltalk' '/usr/local/otherPackages') |
|
5133 |
" |
|
5134 |
! |
|
5135 |
||
5136 |
projectDirectoryForClass:aClass |
|
5137 |
"given a class, return the path to its package directory; |
|
5138 |
nil if not found." |
|
5139 |
||
5140 |
|pkg| |
|
5141 |
||
5142 |
pkg := aClass package. |
|
5143 |
pkg isNil ifTrue:[^ nil]. |
|
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5144 |
|
5040 | 5145 |
^ self projectDirectoryForPackage:pkg. |
5146 |
||
5147 |
" |
|
5148 |
Smalltalk projectDirectoryForClass:Array |
|
5149 |
Smalltalk projectDirectoryForClass:View |
|
5150 |
" |
|
5151 |
! |
|
5152 |
||
7758 | 5153 |
projectDirectoryForPackage:aPackage |
5154 |
"given a packageID, return the path to its package directory; |
|
5155 |
nil if not found." |
|
5156 |
||
5157 |
|prj prjDir| |
|
5158 |
||
5159 |
"/ there might be a package specific resource directory ... |
|
5160 |
"/ in the directory, from which the project was loaded |
|
5161 |
prj := Project projectWithId:aPackage. |
|
5162 |
prj notNil ifTrue:[ |
|
5163 |
prjDir := prj directory. |
|
5164 |
]. |
|
5165 |
(prjDir notNil and:[prjDir asFilename exists]) ifFalse:[ |
|
5166 |
prjDir := Smalltalk getPackageFileName:(aPackage copyReplaceAll:$: with:$/). |
|
5167 |
]. |
|
5168 |
^ prjDir |
|
5169 |
||
5170 |
" |
|
5171 |
Smalltalk projectDirectoryForPackage:'stx:libbasic' |
|
5172 |
Smalltalk projectDirectoryForPackage:'exept:smartcard' |
|
5173 |
" |
|
5174 |
! |
|
5175 |
||
5176 |
readAbbreviations |
|
5177 |
"read classname to filename mappings from include/abbrev.stc. |
|
5178 |
sigh - all for those poor sys5.3 or MSDOS people with short filenames ..." |
|
5179 |
||
5180 |
"since installAutoloadedClasses also reads all abbreviations, use it" |
|
5181 |
||
5182 |
CachedAbbreviations := IdentityDictionary new. |
|
5183 |
self installAutoloadedClasses. |
|
5184 |
^ CachedAbbreviations. |
|
5185 |
||
5186 |
"/ |aStream f dirsConsulted| |
|
5187 |
"/ |
|
5188 |
"/ CachedAbbreviations := IdentityDictionary new. |
|
5189 |
"/ |
|
5190 |
"/ "/ new scheme: look for a directory called 'packages' |
|
5191 |
"/ "/ and enumerate its abbrev.stc files... |
|
5192 |
"/ dirsConsulted := Set new. |
|
5193 |
"/ f := Smalltalk getSystemFileName:'packages'. |
|
5194 |
"/ f notNil ifTrue:[ |
|
5195 |
"/ f := f asFilename. |
|
5196 |
"/ f isDirectory ifTrue:[ |
|
5197 |
"/ ('Smalltalk [info]: reading all class abbreviations found under ''' , f pathName ,'''') infoPrintCR. |
|
5198 |
"/ self recursiveReadAllAbbreviationsFrom:f. |
|
5199 |
"/ dirsConsulted add:f pathName. |
|
5200 |
"/ ]. |
|
5201 |
"/ ]. |
|
5202 |
"/ |
|
5203 |
"/ "/ and along the package-path |
|
5204 |
"/ self packagePath do:[:aPath | |
|
5205 |
"/ (dirsConsulted includes:aPath) ifFalse:[ |
|
5206 |
"/ ('Smalltalk [info]: reading all class abbreviations found under ''' , aPath ,'''') infoPrintCR. |
|
7613 | 5207 |
"/ self recursiveReadAllAbbreviationsFrom:aPath. |
5208 |
"/ dirsConsulted add:aPath |
|
5209 |
"/ ] |
|
5210 |
"/ ]. |
|
5211 |
"/ |
|
5212 |
"/ "/ old scheme: look for a single file called 'abbrev.stc' in the |
|
5213 |
"/ "/ include directory. This will vanish. |
|
5214 |
"/ |
|
5215 |
"/ aStream := self systemFileStreamFor:'include/abbrev.stc'. |
|
5216 |
"/ aStream notNil ifTrue:[ |
|
5217 |
"/ ('Smalltalk [info]: reading additional abbreviations from ''' , aStream pathName ,'''') infoPrintCR. |
|
5218 |
"/ self readAbbreviationsFromStream:aStream. |
|
5219 |
"/ aStream close. |
|
5220 |
"/"/ ] ifFalse:[ |
|
5221 |
"/"/ ('Smalltalk [warning]: no global''include/abbrev.stc'' file found') infoPrintCR |
|
5222 |
"/ ]. |
|
5223 |
"/ ^ CachedAbbreviations |
|
191 | 5224 |
|
5225 |
" |
|
617 | 5226 |
Smalltalk readAbbreviations |
191 | 5227 |
" |
617 | 5228 |
|
5091 | 5229 |
"Modified: / 10.12.1999 / 17:48:53 / cg" |
617 | 5230 |
! |
5231 |
||
7758 | 5232 |
readAbbreviationsFromStream:aStream |
5233 |
"read classname to filename mappings from aStream. |
|
5234 |
sigh - all for those poor sys5.3 or MSDOS people with short filenames ..." |
|
5235 |
||
5236 |
|abbrevs line words nm abbrev pkg key oldAbbrev cls s w| |
|
5237 |
||
5238 |
abbrevs := CachedAbbreviations. |
|
5239 |
||
5240 |
[aStream atEnd] whileFalse:[ |
|
5241 |
line := aStream nextLine. |
|
5242 |
line notNil ifTrue:[ |
|
5243 |
(line startsWith:'#') ifFalse:[ |
|
5244 |
||
5245 |
"/ must do it manually, caring for quoted strings. |
|
5246 |
"/ words := line asCollectionOfWords. |
|
5247 |
||
5248 |
words := OrderedCollection new. |
|
5249 |
s := line readStream. |
|
5250 |
[s atEnd] whileFalse:[ |
|
5251 |
s skipSeparators. |
|
5252 |
s peek == $' ifTrue:[ |
|
5253 |
s next. |
|
5254 |
w := s upTo:$'. |
|
5255 |
s skipSeparators. |
|
5256 |
] ifFalse:[ |
|
5257 |
w := s upToSeparator |
|
5258 |
]. |
|
5259 |
words add:w |
|
5260 |
]. |
|
5261 |
words size >= 3 ifTrue:[ |
|
5262 |
nm := (words at:1) withoutSeparators. |
|
5263 |
abbrev := (words at:2) withoutSeparators. |
|
5264 |
pkg := (words at:3) withoutSeparators. |
|
5265 |
nm ~= abbrev ifTrue:[ |
|
5266 |
key := nm asSymbol. |
|
5267 |
oldAbbrev := abbrevs at:key ifAbsent:nil. |
|
5268 |
oldAbbrev notNil ifTrue:[ |
|
5269 |
oldAbbrev ~= abbrev ifTrue:[ |
|
5270 |
StandAlone ifFalse:[ |
|
5271 |
('Smalltalk [warning]: conflict for: ' , nm , ' in ' , (aStream pathName)) infoPrintCR. |
|
5272 |
('Smalltalk [warning]: (' , oldAbbrev , ' <-> ' , abbrev , ')') infoPrintCR |
|
5273 |
] |
|
5274 |
]. |
|
5275 |
] ifFalse:[ |
|
5276 |
cls := self classNamed:abbrev. |
|
5277 |
||
5278 |
cls notNil ifTrue:[ |
|
7616 | 5279 |
cls name ~= nm ifTrue:[ |
5280 |
"/ ok, there is a class named after this abbrev ... |
|
5281 |
"/ this is only a conflict, if the other class has no |
|
5282 |
"/ abbreviation (or the same). |
|
5283 |
(abbrevs at:(cls name asSymbol) ifAbsent:cls name) = abbrev ifTrue:[ |
|
5284 |
cls isNameSpace ifFalse:[ |
|
5285 |
pkg = cls package ifTrue:[ |
|
5286 |
StandAlone ifFalse:[ |
|
5287 |
('Smalltalk [warning]: conflict for: ' , cls name , ' in ' , (aStream pathName)) infoPrintCR. |
|
5288 |
('Smalltalk [warning]: (' , nm , ' -> ' , abbrev , ')') infoPrintCR |
|
5289 |
] |
|
5290 |
] |
|
5291 |
] |
|
5292 |
] |
|
5293 |
] |
|
5294 |
]. |
|
5295 |
abbrevs at:nm asSymbol put:abbrev. |
|
5296 |
] |
|
5297 |
] |
|
5298 |
] ifFalse:[ |
|
5299 |
('Smalltalk [warning]: malformed line in ' , (aStream pathName)) infoPrintCR. |
|
5300 |
] |
|
5301 |
] |
|
5302 |
] |
|
4420 | 5303 |
]. |
5091 | 5304 |
|
5095
9bbf3cf594e5
no warning for same-abbrev, if packages differ.
Claus Gittinger <cg@exept.de>
parents:
5093
diff
changeset
|
5305 |
"Modified: / 13.12.1999 / 11:54:17 / cg" |
4420 | 5306 |
! |
5307 |
||
7758 | 5308 |
realSystemPath |
5309 |
"return the realSystemPath - thats the directorynames from |
|
5310 |
SystemPath which exist and are readable" |
|
5311 |
||
5312 |
|nP| |
|
5313 |
||
5314 |
RealSystemPath isNil ifTrue:[ |
|
5315 |
OperatingSystem isVMSlike ifTrue:[ |
|
5316 |
"/ temporary kludge: since we cannot currently |
|
7616 | 5317 |
"/ check for existance of a name like 'volume:', |
5318 |
"/ leave those in the Path without a check. |
|
5319 |
RealSystemPath := SystemPath select:[:dirName | |
|
5320 |
|f| |
|
5321 |
||
5322 |
f := dirName asFilename. |
|
5323 |
f isVolumeOnly ifTrue:[ |
|
5324 |
true |
|
5325 |
] ifFalse:[ |
|
5326 |
(f isDirectory) and:[f isReadable] |
|
5327 |
] |
|
5328 |
] |
|
5329 |
] ifFalse:[ |
|
5330 |
RealSystemPath := SystemPath select:[:dirName | |
|
5331 |
|f| |
|
5332 |
||
5333 |
f := dirName asFilename. |
|
5334 |
(f isDirectory) and:[f isReadable] |
|
5335 |
]. |
|
5336 |
RealSystemPath := RealSystemPath collect:[:dirName | |
|
5337 |
|f| |
|
5338 |
||
5339 |
f := dirName asFilename pathName. |
|
5340 |
]. |
|
5341 |
"/ remove duplicates (but keep order) |
|
5342 |
nP := OrderedCollection new. |
|
5343 |
RealSystemPath do:[:p | |
|
5344 |
(nP includes:p) ifFalse:[ |
|
5345 |
nP add:p |
|
5346 |
] |
|
5347 |
]. |
|
5348 |
RealSystemPath := nP. |
|
5349 |
]. |
|
617 | 5350 |
]. |
5351 |
^ RealSystemPath |
|
5352 |
! |
|
5353 |
||
7758 | 5354 |
recursiveReadAllAbbreviationsFrom:aDirectory |
5355 |
self recursiveReadAllAbbreviationsFrom:aDirectory maxLevels:15 |
|
5356 |
! |
|
5357 |
||
5358 |
recursiveReadAllAbbreviationsFrom:aDirectory maxLevels:maxLevels |
|
5359 |
"read all abbreviations from and under aDirectory." |
|
5360 |
||
5361 |
|abbrevStream dir directoryContents| |
|
5362 |
||
5363 |
maxLevels == 0 ifTrue:[ |
|
5364 |
"/ 'Smalltalk [warning]: max directory nesting reached.' infoPrintCR. |
|
7616 | 5365 |
^ self |
5075 | 5366 |
]. |
4957 | 5367 |
|
4458 | 5368 |
dir := aDirectory asFilename. |
5057 | 5369 |
dir exists ifFalse:[^ self]. |
4458 | 5370 |
|
7085
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5371 |
[ |
7616 | 5372 |
abbrevStream := (dir construct:'abbrev.stc') asFilename readStream. |
5373 |
self readAbbreviationsFromStream:abbrevStream. |
|
5374 |
abbrevStream close. |
|
7085
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5375 |
] on:FileStream openErrorSignal do:[:ex| "ignore this file"]. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5376 |
|
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5377 |
[ |
7616 | 5378 |
directoryContents := dir directoryContents. |
7085
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5379 |
] on:FileStream openErrorSignal do:[:ex| |
7616 | 5380 |
"non-accessable directory: we are done" |
5381 |
^ self |
|
7085
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5382 |
]. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5383 |
|
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5384 |
directoryContents do:[:aFilename | |
7616 | 5385 |
|f| |
5386 |
||
5387 |
(#( |
|
5388 |
'doc' |
|
5389 |
'CVS' |
|
5390 |
'bitmaps' |
|
5391 |
'resources' |
|
5392 |
'source' |
|
5393 |
) includes:aFilename) ifFalse:[ |
|
5394 |
f := dir construct:aFilename. |
|
5395 |
f isDirectory ifTrue:[ |
|
5396 |
self recursiveReadAllAbbreviationsFrom:f maxLevels:maxLevels-1 |
|
5397 |
] |
|
5398 |
]. |
|
4458 | 5399 |
]. |
5400 |
! |
|
5401 |
||
7758 | 5402 |
resourceFileStreamFor:aFileName |
5403 |
"search aFileName in some standard places; |
|
5404 |
return a readonly fileStream or nil if not found. |
|
5405 |
Searches in subdirectories named 'resource' in SystemPath" |
|
5406 |
||
5407 |
^ self resourceFileStreamFor:aFileName forClass:nil |
|
5408 |
! |
|
5409 |
||
5410 |
resourceFileStreamFor:aFileName forClass:aClassOrNil |
|
5411 |
"search aFileName in some standard places and in the classes |
|
5412 |
package-resource directory. |
|
5413 |
Return a readonly fileStream or nil if not found. |
|
5414 |
Searches in subdirectories named 'resource' in SystemPath" |
|
5415 |
||
5416 |
|aString| |
|
5417 |
||
5418 |
aString := self getResourceFileName:aFileName forClass:aClassOrNil. |
|
617 | 5419 |
aString notNil ifTrue:[ |
7616 | 5420 |
^ aString asFilename readStreamOrNil |
617 | 5421 |
]. |
5422 |
^ nil |
|
5423 |
! |
|
5424 |
||
7758 | 5425 |
searchPath:aPath for:aFileName in:aDirName |
5426 |
"search aPath for a subdirectory named aDirectory with a file |
|
5427 |
named aFileName" |
|
5428 |
||
5429 |
|f| |
|
5430 |
||
5431 |
((f := aFileName asFilename) isAbsolute |
|
5432 |
or:[f isExplicitRelative]) ifTrue:[ |
|
5433 |
"/ |
|
5434 |
"/ dont use path for absolute or explicit .-relative file names |
|
5435 |
"/ |
|
5436 |
^ aFileName |
|
5437 |
]. |
|
5438 |
||
5439 |
aPath notNil ifTrue:[ |
|
5440 |
aPath do:[:dirName | |
|
5441 |
|realName dir| |
|
5442 |
||
5443 |
dir := dirName asFilename. |
|
5444 |
aDirName notNil ifTrue:[ |
|
5445 |
realName := (dir construct:aDirName) construct:aFileName. |
|
5446 |
] ifFalse:[ |
|
5447 |
realName := dir construct:aFileName. |
|
5448 |
]. |
|
5449 |
(realName isReadable) ifTrue:[ |
|
5450 |
^ realName name |
|
5451 |
] |
|
5452 |
]. |
|
5453 |
]. |
|
5454 |
||
5455 |
^ nil. |
|
5456 |
||
5457 |
"Modified: / 29.4.1999 / 15:06:43 / cg" |
|
5458 |
! |
|
5459 |
||
5460 |
sourceDirectoryNameOfClass:aClassOrClassName |
|
5461 |
"for a given class, return the pathname relative to TOP of the classes source code. |
|
5462 |
Read the files 'abbrev.stc' and 'liblist.stc' (which are created during the compilation process) |
|
5463 |
for an entry for aClassOrClassName. |
|
5464 |
Search for the className in the first col, and return the value found in |
|
5465 |
the 3rd col. |
|
5466 |
Return nil if no entry is found." |
|
5467 |
||
5468 |
|aStream line words n aClassName| |
|
5469 |
||
5470 |
aClassOrClassName isBehavior ifTrue:[ |
|
5471 |
aClassName := aClassOrClassName name |
|
5472 |
] ifFalse:[ |
|
5473 |
aClassName := aClassOrClassName |
|
5474 |
]. |
|
5475 |
aClassName := aClassName asString. |
|
5476 |
||
5477 |
#('include/abbrev.stc' 'include/liblist.stc') "/ filenames |
|
5478 |
with:#(3 2) "/ column |
|
5479 |
do:[:fileName :col | |
|
5480 |
||
5481 |
aStream := self systemFileStreamFor:fileName. |
|
7616 | 5482 |
aStream notNil ifTrue:[ |
5483 |
[aStream atEnd] whileFalse:[ |
|
5484 |
line := aStream nextLine. |
|
5485 |
line notNil ifTrue:[ |
|
5486 |
(line startsWith:'#') ifFalse:[ |
|
5487 |
words := line asCollectionOfWords. |
|
5488 |
(n := words size) > 1 ifTrue:[ |
|
5489 |
(words at:1) = aClassName ifTrue:[ |
|
5490 |
n >= col ifTrue:[ |
|
5491 |
aStream close. |
|
5492 |
^ (words at:col) withoutSeparators |
|
5493 |
] |
|
5494 |
] |
|
5495 |
] |
|
5496 |
] |
|
5497 |
] |
|
5498 |
]. |
|
5499 |
aStream close |
|
5500 |
]. |
|
617 | 5501 |
]. |
5502 |
||
5503 |
^ nil |
|
191 | 5504 |
|
5505 |
" |
|
617 | 5506 |
Smalltalk sourceDirectoryNameOfClass:'ClockView' |
5507 |
Smalltalk sourceDirectoryNameOfClass:'Bag' |
|
5508 |
Smalltalk sourceDirectoryNameOfClass:'GLWireCubeDemoView' |
|
5509 |
Smalltalk sourceDirectoryNameOfClass:'SomeNonExistingClass' |
|
5510 |
" |
|
5511 |
||
5512 |
"Created: 6.11.1995 / 15:43:30 / cg" |
|
728
50cf1c907c28
again search liblist for a classes source directory
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
5513 |
"Modified: 9.12.1995 / 23:54:14 / cg" |
2033 | 5514 |
"Modified: 3.1.1997 / 11:26:44 / stefan" |
617 | 5515 |
! |
5516 |
||
7758 | 5517 |
sourceFileStreamFor:aFileName |
5518 |
"search aFileName in some standard places; |
|
5519 |
return a readonly fileStream or nil if not found. |
|
5520 |
Searches in subdirectories named 'source' in SystemPath" |
|
617 | 5521 |
|
5522 |
|aString| |
|
5523 |
||
5524 |
aString := self getSourceFileName:aFileName. |
|
5525 |
aString notNil ifTrue:[ |
|
7616 | 5526 |
^ aString asFilename readStreamOrNil |
617 | 5527 |
]. |
5528 |
^ nil |
|
7758 | 5529 |
! |
5530 |
||
5531 |
systemFileStreamFor:aFileName |
|
5532 |
"search aFileName in some standard places; |
|
5533 |
return a readonly fileStream or nil if not found. |
|
5534 |
see comment in Smalltalk>>initSystemPath" |
|
5535 |
||
5536 |
|aString| |
|
5537 |
||
5538 |
aString := self getSystemFileName:aFileName. |
|
5539 |
aString notNil ifTrue:[ |
|
5540 |
^ aString asFilename readStreamOrNil |
|
617 | 5541 |
]. |
5542 |
^ nil |
|
5543 |
! |
|
5544 |
||
7758 | 5545 |
systemPath |
5546 |
"return a collection of directorynames, where smalltalk |
|
7563 | 5547 |
looks for system files |
617 | 5548 |
(usually in subdirs such as resources, bitmaps, source etc.) |
5549 |
see comment in Smalltalk>>initSystemPath." |
|
5550 |
||
5551 |
^ SystemPath |
|
5552 |
||
5553 |
" |
|
5554 |
Smalltalk systemPath |
|
5555 |
Smalltalk systemPath addLast:'someOtherDirectoryPath' |
|
5556 |
" |
|
5557 |
! |
|
5558 |
||
7758 | 5559 |
systemPath:aPath |
5560 |
"set the collection of directorynames, where smalltalk |
|
5561 |
looks for system files |
|
5562 |
(usually in subdirs such as resources, bitmaps, source etc.) |
|
5563 |
see comment in Smalltalk>>initSystemPath." |
|
5564 |
||
5565 |
SystemPath := aPath. |
|
5566 |
self flushPathCaches |
|
5567 |
||
5568 |
" |
|
5569 |
Smalltalk systemPath |
|
617 | 5570 |
Smalltalk systemPath:(Smalltalk systemPath copy addLast:'someOtherDirectoryPath') |
191 | 5571 |
" |
7758 | 5572 |
! ! |
5573 |
||
5574 |
!Smalltalk class methodsFor:'system management-packages'! |
|
5575 |
||
5576 |
knownPackages |
|
5577 |
^ KnownPackages ? #() |
|
5578 |
! |
|
5579 |
||
5580 |
loadExtensionsForPackage:aPackageId |
|
5581 |
|packageDirName| |
|
5582 |
||
5583 |
packageDirName := aPackageId copyReplaceAll:$: with:$/. |
|
5584 |
||
5585 |
packageDirName := self getPackageFileName:packageDirName. |
|
5586 |
packageDirName isNil ifTrue:[ |
|
5587 |
^ false |
|
5588 |
]. |
|
5589 |
^ self loadExtensionsFromDirectory:packageDirName |
|
5590 |
! |
|
5591 |
||
5592 |
loadExtensionsFromDirectory:packageDirOrString |
|
5593 |
|packageDir f| |
|
5594 |
||
5595 |
packageDir := packageDirOrString asFilename. |
|
5596 |
||
5597 |
f := packageDir construct:'extensions.st'. |
|
5598 |
f exists ifTrue:[ |
|
5599 |
f fileIn. |
|
5600 |
SilentLoading ifFalse:[ |
|
5601 |
Transcript showCR:('loaded extensions: ' , f pathName). |
|
5602 |
]. |
|
5603 |
^ true |
|
5604 |
]. |
|
5605 |
^ false |
|
5606 |
! |
|
5607 |
||
5608 |
loadPackage:aPackageIdOrPackage |
|
5609 |
"make certain, that some particular package is loaded into the system. |
|
5610 |
Experimental." |
|
5611 |
||
5612 |
(aPackageIdOrPackage isSymbol |
|
5613 |
or:[aPackageIdOrPackage isString]) ifTrue:[ |
|
5614 |
^ self loadPackageWithId:aPackageIdOrPackage asAutoloaded:false |
|
5615 |
]. |
|
5616 |
self shouldImplement. |
|
5617 |
||
5618 |
" |
|
5619 |
Smalltalk loadPackage:'stx:libbasic' |
|
5620 |
Smalltalk loadPackage:'stx:goodies/persistency' |
|
5621 |
Smalltalk loadPackage:'cg:cparser' |
|
5622 |
Smalltalk loadPackage:'cg:rose' |
|
5623 |
" |
|
5624 |
! |
|
5625 |
||
5626 |
loadPackage:packageId fromAllSourceFilesInDirectory:aDirectory |
|
5627 |
"load all source files found in aDirectory and treat them like |
|
5628 |
a package. Allows for initial import of alien ST-code as a new package. |
|
5629 |
Experimental." |
|
5630 |
||
5631 |
|p t new anyFail| |
|
5632 |
||
5633 |
"/ problem: dependencies. |
|
5634 |
"/ solution: repeat twice, so that superclasses are present the second time |
|
5635 |
||
5636 |
Class packageQuerySignal answer:packageId asSymbol do:[ |
|
5637 |
|any| |
|
5638 |
||
5639 |
2 timesRepeat:[ |
|
7616 | 5640 |
anyFail := false. |
5641 |
aDirectory directoryContents do:[:file | |
|
5642 |
|fn| |
|
5643 |
||
5644 |
fn := aDirectory construct:file. |
|
5645 |
(fn hasSuffix:'st') ifTrue:[ |
|
5646 |
Metaclass confirmationQuerySignal answer:false do:[ |
|
5647 |
(self fileIn:fn) ifFalse:[ |
|
5648 |
anyFail := true |
|
5649 |
] ifTrue:[ |
|
5650 |
any := true. |
|
5651 |
] |
|
5652 |
] |
|
5653 |
] |
|
5654 |
]. |
|
5655 |
any ifFalse:[ |
|
5656 |
^ false "/ no file found |
|
5657 |
] |
|
5658 |
]. |
|
4718 | 5659 |
]. |
5660 |
||
5661 |
new := (p := Project projectWithId:packageId) isNil. |
|
5662 |
new ifTrue:[ p := Project new]. |
|
5663 |
||
5664 |
p name:packageId. |
|
5665 |
p directory:aDirectory. |
|
4726 | 5666 |
p package:packageId. |
4718 | 5667 |
t := packageId asCollectionOfSubstringsSeparatedByAny:'/\:'. |
5668 |
p repositoryModule:(t first). |
|
5669 |
p repositoryDirectory:(packageId copyFrom:t first size + 2). |
|
5670 |
p isLoaded:true. |
|
5671 |
||
5672 |
new ifTrue:[Project addLoadedProject:p]. |
|
5673 |
^ anyFail not |
|
5674 |
||
5675 |
! |
|
5676 |
||
7758 | 5677 |
loadPackage:packageId fromClassLibrary:aFilename |
5678 |
"load a package from a compiled classLib. |
|
5679 |
Experimental." |
|
5680 |
||
5681 |
|p t new| |
|
5682 |
||
5683 |
(self fileIn:aFilename) ifFalse:[ |
|
5684 |
(self fileInClassLibrary:aFilename) ifFalse:[ |
|
5685 |
self warn:'Failed to load the package ', packageId printString. |
|
5686 |
^ false. |
|
5687 |
] |
|
5688 |
]. |
|
5689 |
||
5690 |
new := (p := Project projectWithId:packageId) isNil. |
|
5691 |
new ifTrue:[ p := Project new]. |
|
5692 |
||
5693 |
p name:packageId. |
|
5694 |
p directory:aFilename directory. |
|
5695 |
p package:packageId. |
|
5696 |
t := packageId asCollectionOfSubstringsSeparatedByAny:'/\:'. |
|
5697 |
p repositoryModule:(t first). |
|
5698 |
p repositoryDirectory:(packageId copyFrom:t first size + 2). |
|
5699 |
p isLoaded:true. |
|
4723 | 5700 |
|
5701 |
new ifTrue:[Project addLoadedProject:p]. |
|
5702 |
^ true |
|
5703 |
! |
|
5704 |
||
7758 | 5705 |
loadPackage:packageId fromLoadAllFile:aFilename |
5706 |
"load a package from a loadAll - loader script. |
|
5707 |
Experimental." |
|
5708 |
||
5709 |
|p t new| |
|
5710 |
||
5711 |
Metaclass confirmationQuerySignal answer:false |
|
5712 |
do:[ |
|
5713 |
(self fileIn:aFilename) ifFalse:[ |
|
5714 |
self warn:'Failed to load the package ', packageId printString. |
|
5715 |
^ false. |
|
5716 |
] |
|
5717 |
]. |
|
5718 |
||
5719 |
new := (p := Project projectWithId:packageId) isNil. |
|
5720 |
new ifTrue:[ p := Project new]. |
|
5721 |
||
5722 |
p name:packageId. |
|
5723 |
p directory:aFilename directory. |
|
5724 |
p package:packageId. |
|
5725 |
t := packageId asCollectionOfSubstringsSeparatedByAny:'/\:'. |
|
5726 |
p repositoryModule:(t first). |
|
5727 |
p repositoryDirectory:(packageId copyFrom:t first size + 2). |
|
5728 |
p isLoaded:true. |
|
5729 |
||
5730 |
new ifTrue:[Project addLoadedProject:p]. |
|
5731 |
^ true |
|
5732 |
! |
|
5733 |
||
5734 |
loadPackage:aPackageId fromProjectFile:f asAutoloaded:doLoadAsAutoloaded |
|
5735 |
"load a package from a .prj spec. |
|
5736 |
Experimental." |
|
5737 |
||
5738 |
||
5739 |
"/ not yet implemented ... |
|
5740 |
^ false. |
|
5741 |
||
5742 |
"/ |prj fn| |
|
5743 |
"/ |
|
5744 |
"/ prj := Project new loadFromProjectFile:f asFilename pathName. |
|
5745 |
"/ "/ no - also allow for applications to be loaded this way |
|
5746 |
"/ "/ prj type == #library ifFalse:[ ^ false]. |
|
5747 |
"/ self halt. |
|
5748 |
"/ "/ load all prerequisites ... |
|
5749 |
"/ prj prerequisites do:[:aRequiredPackage | |
|
5750 |
"/ self halt. |
|
5751 |
"/ ]. |
|
5752 |
"/ |
|
5753 |
"/ "/ see if there is a class library ... |
|
5754 |
"/ fn := prj directory asFilename construct:(prj name , ObjectFileLoader sharedLibraryExtension). |
|
5755 |
"/ fn exists ifTrue:[ |
|
5756 |
"/ "/ load that classLibrary ... |
|
5757 |
"/ self fileIn:fn pathName. |
|
5758 |
"/ ]. |
|
5759 |
"/ |
|
5760 |
"/ "/ now, for all other classes, file-them in |
|
5601 | 5761 |
"/ "/ or declare as autoloaded ... |
5762 |
"/ |
|
5763 |
"/ prj classes do:[:aClassOrName | |ns| |
|
5764 |
"/ aClassOrName isBehavior ifFalse:[ |
|
5765 |
"/ ((self includesKey:aClassOrName) not |
|
5766 |
"/ and:[(ns := prj defaultNameSpace) isNil |
|
5767 |
"/ or:[ns == self |
|
5768 |
"/ or:[(ns includesKey:aClassOrName) not]]]) |
|
5769 |
"/ ifTrue:[ |
|
5770 |
"/ "/ must load a corresponding source or cls-file |
|
5771 |
"/ self halt. |
|
5772 |
"/ ] |
|
5773 |
"/ ] |
|
5774 |
"/ ]. |
|
5775 |
"/ prj isLoaded:true. |
|
5776 |
"/ prj directory:f asFilename directoryName. |
|
5777 |
"/ Project addLoadedProject:prj. |
|
5778 |
"/ ^ true |
|
4756
76982048a91a
first try to load package from prj file.
Claus Gittinger <cg@exept.de>
parents:
4748
diff
changeset
|
5779 |
|
76982048a91a
first try to load package from prj file.
Claus Gittinger <cg@exept.de>
parents:
4748
diff
changeset
|
5780 |
" |
76982048a91a
first try to load package from prj file.
Claus Gittinger <cg@exept.de>
parents:
4748
diff
changeset
|
5781 |
Smalltalk loadPackage:'exept:osi/asn1' |
76982048a91a
first try to load package from prj file.
Claus Gittinger <cg@exept.de>
parents:
4748
diff
changeset
|
5782 |
Smalltalk |
7616 | 5783 |
loadPackage:'exept:osi/asn1' |
5784 |
fromProjectFile:'../../../exept/osi/asn1/asn1.prj' |
|
5785 |
asAutoloaded:false |
|
4756
76982048a91a
first try to load package from prj file.
Claus Gittinger <cg@exept.de>
parents:
4748
diff
changeset
|
5786 |
" |
4722 | 5787 |
! |
5788 |
||
7758 | 5789 |
loadPackage:aPackageId fromZIPArchive:f asAutoloaded:doLoadAsAutoloaded |
5790 |
"load a package from a .zip delivery file. |
|
5791 |
Experimental." |
|
5792 |
||
5793 |
"/ not yet implemented ... |
|
5794 |
^ false |
|
5795 |
! |
|
5796 |
||
8378 | 5797 |
loadPackageFromAbbrevFile:aPackageId asAutoloaded:doLoadAsAutoloaded |
5798 |
|abbrevFile packageDir| |
|
5799 |
||
5800 |
packageDir := self packageDirectoryForPackageId:aPackageId. |
|
8380 | 5801 |
packageDir isNil ifTrue:[^ false]. |
8378 | 5802 |
|
5803 |
"/ abbrev.stc ? |
|
5804 |
abbrevFile := packageDir construct:'abbrev.stc'. |
|
5805 |
abbrevFile exists ifFalse:[^ false]. |
|
5806 |
||
5807 |
Smalltalk installAutoloadedClassesFrom:abbrevFile pathName. |
|
5808 |
||
5809 |
doLoadAsAutoloaded ifFalse:[ |
|
5810 |
"/ force autoloading... |
|
5811 |
Smalltalk allClassesDo:[:eachClass | |
|
8381 | 5812 |
eachClass package = aPackageId ifTrue:[ eachClass autoload]. |
8378 | 5813 |
]. |
5814 |
]. |
|
5815 |
||
5816 |
self loadExtensionsFromDirectory:packageDir. |
|
5817 |
SilentLoading ifFalse:[ |
|
5818 |
Transcript showCR:('loaded package: ' , aPackageId , ' from abbrev file: ' , abbrevFile pathName). |
|
5819 |
]. |
|
5820 |
^ true |
|
5821 |
! |
|
5822 |
||
7758 | 5823 |
loadPackageWithId:aPackageId |
5824 |
"make certain, that some particular package is loaded into the system. |
|
5825 |
Experimental." |
|
5826 |
||
5827 |
||
5828 |
^ self loadPackageWithId:aPackageId asAutoloaded:false |
|
5829 |
||
5830 |
" |
|
5831 |
Smalltalk loadPackageWithId:'stx:libbasic' |
|
5832 |
Smalltalk loadPackageWithId:'stx:goodies/persistency' |
|
5833 |
Smalltalk loadPackageWithId:'cg:cparser' |
|
5834 |
Smalltalk loadPackageWithId:'cg:rose' |
|
5835 |
Smalltalk loadPackageWithId:'detemobil:smc' |
|
5836 |
" |
|
5837 |
! |
|
5838 |
||
5839 |
loadPackageWithId:aPackageId asAutoloaded:doLoadAsAutoloaded |
|
5840 |
"make certain, that some particular package is loaded into the system. |
|
5841 |
Experimental." |
|
5842 |
||
8379 | 5843 |
|pkg packageDir| |
7758 | 5844 |
|
5845 |
pkg := Project projectWithId:aPackageId. |
|
5846 |
(pkg notNil and:[pkg isLoaded]) ifTrue:[ |
|
8378 | 5847 |
"/ ('Smalltalk [info]: Package ' , aPackageId , ' already loaded.') infoPrintCR. |
5848 |
(doLoadAsAutoloaded |
|
5849 |
or:[pkg areAllClassesLoaded]) ifTrue:[ |
|
5850 |
^ true |
|
5851 |
]. |
|
7758 | 5852 |
]. |
5853 |
||
5854 |
"/ ok; not yet loaded. |
|
5855 |
"/ try to locate the package; try the following: |
|
5856 |
"/ $(packagePath)/<packageDir>/... |
|
5857 |
"/ $(SYSPATH)/packages/<packageDir> |
|
8378 | 5858 |
packageDir := self packageDirectoryForPackageId:aPackageId. |
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5859 |
packageDir isNil ifTrue:[ |
8379 | 5860 |
('Smalltalk [warning]: cannot find packageDirectory: ' , packageDir name) errorPrintCR. |
8378 | 5861 |
^ false |
4718 | 5862 |
]. |
5863 |
||
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5864 |
^ self |
8378 | 5865 |
loadPackageWithId:aPackageId |
5866 |
fromDirectory:packageDir |
|
5867 |
asAutoloaded:doLoadAsAutoloaded |
|
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5868 |
|
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5869 |
" |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5870 |
Smalltalk loadPackageWithId:'stx:libbasic' |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5871 |
Smalltalk loadPackageWithId:'stx:goodies/persistency' |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5872 |
Smalltalk loadPackageWithId:'exept:ctypes' |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5873 |
" |
7758 | 5874 |
! |
5875 |
||
8378 | 5876 |
loadPackageWithId:aPackageId fromDirectory:packageDirOrString asAutoloaded:doLoadAsAutoloaded |
5877 |
|f packageDir packageName shLibName| |
|
7758 | 5878 |
|
5879 |
packageDir := packageDirOrString asFilename. |
|
8378 | 5880 |
packageName := packageDir baseName. |
7758 | 5881 |
|
5882 |
"/ .prj ? |
|
5883 |
f := (packageDir construct:packageName) withSuffix:'prj'. |
|
5884 |
f exists ifTrue:[ |
|
8370
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5885 |
(self loadPackage:aPackageId fromProjectFile:f asAutoloaded:doLoadAsAutoloaded) ifTrue:[ |
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5886 |
SilentLoading ifFalse:[ |
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5887 |
Transcript showCR:('Smalltalk [info]: loaded package: ' , aPackageId , ' from project file: ' , f pathName). |
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5888 |
]. |
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5889 |
^ true |
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5890 |
] |
7758 | 5891 |
]. |
5892 |
"/ loadAll ? |
|
5893 |
f := packageDir construct:'loadAll'. |
|
8370
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5894 |
f exists ifFalse:[ |
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5895 |
f := packageDir construct:'loadall'. |
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5896 |
]. |
7758 | 5897 |
f exists ifTrue:[ |
8370
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5898 |
(self loadPackage:aPackageId fromLoadAllFile:f) ifTrue:[ |
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5899 |
SilentLoading ifFalse:[ |
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5900 |
Transcript showCR:('loaded package: ' , aPackageId , ' from loadAll file: ' , f pathName). |
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5901 |
]. |
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5902 |
^ true |
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5903 |
] |
7758 | 5904 |
]. |
5905 |
"/ .zip ? |
|
5906 |
f := (packageDir construct:packageName) withSuffix:'zip'. |
|
5907 |
f exists ifTrue:[ |
|
8370
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5908 |
(self loadPackage:aPackageId fromZIPArchive:f asAutoloaded:doLoadAsAutoloaded) ifTrue:[ |
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5909 |
SilentLoading ifFalse:[ |
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5910 |
Transcript showCR:('loaded package: ' , aPackageId , ' from zip file: ' , f pathName). |
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5911 |
]. |
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5912 |
^ true |
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5913 |
] |
7758 | 5914 |
]. |
5915 |
||
5916 |
shLibName := packageName , ObjectFileLoader sharedLibraryExtension. |
|
5917 |
||
5918 |
"/ .so ? |
|
5919 |
f := packageDir construct:shLibName. |
|
5920 |
f exists ifTrue:[ |
|
8370
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5921 |
(self loadPackage:aPackageId fromClassLibrary:f) ifTrue:[ |
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5922 |
SilentLoading ifFalse:[ |
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5923 |
Transcript showCR:('loaded package: ' , aPackageId , ' from binary classLib file: ' , f pathName). |
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5924 |
]. |
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5925 |
doLoadAsAutoloaded ifFalse:[ |
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5926 |
"/ force autoloading... |
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5927 |
Smalltalk allClassesDo:[:eachClass | |
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5928 |
eachClass package == aPackageId ifTrue:[ eachClass autoload]. |
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5929 |
]. |
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5930 |
]. |
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5931 |
^ true |
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5932 |
] |
7758 | 5933 |
]. |
5934 |
||
5935 |
"/ abbrev.stc ? |
|
8378 | 5936 |
(self loadPackageFromAbbrevFile:aPackageId asAutoloaded:doLoadAsAutoloaded) ifTrue:[ |
8370
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5937 |
^ true |
7758 | 5938 |
]. |
5939 |
||
5940 |
"/ any .so ? -> load the first one found (maybe not a good idea) |
|
5941 |
packageDir directoryContentsAsFilenamesDo:[:aFilename | |
|
8370
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5942 |
(aFilename hasSuffix:ObjectFileLoader sharedLibrarySuffix) ifTrue:[ |
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5943 |
(self loadPackage:aPackageId fromClassLibrary:aFilename) ifTrue:[ |
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5944 |
SilentLoading ifFalse:[ |
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5945 |
Transcript showCR:('loaded package: ' , aPackageId , ' from binary classLib file: ' , aFilename pathName). |
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5946 |
]. |
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5947 |
doLoadAsAutoloaded ifFalse:[ |
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5948 |
"/ force autoloading... |
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5949 |
Smalltalk allClassesDo:[:eachClass | |
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5950 |
eachClass package == aPackageId ifTrue:[ eachClass autoload]. |
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5951 |
]. |
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5952 |
]. |
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5953 |
^ true |
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5954 |
] |
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5955 |
] |
5175
c3e71ead8e06
when loading a package, and a .so file could not be found
Claus Gittinger <cg@exept.de>
parents:
5168
diff
changeset
|
5956 |
]. |
5807
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
5957 |
|
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5958 |
"/ source files |
4737 | 5959 |
(self loadPackage:aPackageId fromAllSourceFilesInDirectory:packageDir) ifTrue:[ |
8370
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5960 |
SilentLoading ifFalse:[ |
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5961 |
Transcript showCR:('loaded package: ' , aPackageId , ' from source files in:' , packageDir pathName). |
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5962 |
]. |
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
5963 |
^ true |
4737 | 5964 |
]. |
5965 |
^ false |
|
5966 |
||
4718 | 5967 |
" |
5968 |
Smalltalk loadPackageWithId:'stx:libbasic' |
|
5969 |
Smalltalk loadPackageWithId:'stx:goodies/persistency' |
|
4722 | 5970 |
Smalltalk loadPackageWithId:'exept:ctypes' |
4718 | 5971 |
" |
8378 | 5972 |
! |
5973 |
||
5974 |
packageDirectoryForPackageId:aPackageId |
|
5975 |
|packageDirName packageDir| |
|
5976 |
||
5977 |
packageDirName := aPackageId copyReplaceAll:$: with:$/. |
|
5978 |
||
5979 |
packageDir := self getPackageFileName:packageDirName. |
|
5980 |
packageDir isNil ifTrue:[ |
|
5981 |
"/ for convenience: try ../../.. as well |
|
5982 |
"/ (when executing in thedevelopment environment) |
|
5983 |
packageDir := '../../..' asFilename construct:packageDirName. |
|
8379 | 5984 |
packageDir exists ifFalse:[ ^ nil]. |
5985 |
]. |
|
5986 |
^ packageDir asFilename |
|
8378 | 5987 |
|
5988 |
" |
|
5989 |
Smalltalk packageDirectoryForPackageId:'stx:libbasic' |
|
5990 |
Smalltalk packageDirectoryForPackageId:'stx:goodies/persistency' |
|
5991 |
Smalltalk packageDirectoryForPackageId:'exept:ctypes' |
|
5992 |
" |
|
4718 | 5993 |
! ! |
5994 |
||
7758 | 5995 |
!Smalltalk class methodsFor:'system management-undeclared variables'! |
5996 |
||
5997 |
clearUndeclaredVariables |
|
5998 |
"remove all undeclared variables" |
|
5999 |
||
6000 |
(Smalltalk at:#Undeclared) do:[:eachKey | |
|
6001 |
Smalltalk removeKey:(self undeclaredPrefix , eachKey) asSymbol. |
|
6002 |
]. |
|
6003 |
(Smalltalk at:#Undeclared) removeAll. |
|
6004 |
Smalltalk removeKey:#Undeclared. |
|
6005 |
! |
|
6006 |
||
6007 |
undeclaredPrefix |
|
7563 | 6008 |
"the prefix used for undeclared variables" |
6009 |
||
6010 |
^ 'Undeclared:::' |
|
6711 | 6011 |
|
6012 |
"Created: / 31.10.1997 / 01:13:10 / cg" |
|
7758 | 6013 |
! ! |
6014 |
||
6015 |
!Smalltalk class methodsFor:'time-versions'! |
|
6016 |
||
6017 |
configuration |
|
6018 |
"{ Pragma: +optSpace }" |
|
6019 |
||
6020 |
"for developers only: return the configuration, with which |
|
6021 |
this smalltalk was compiled." |
|
6022 |
||
6023 |
%{ /* NOCONTEXT */ |
|
6024 |
extern char *__getConfigurationString(); |
|
453 | 6025 |
|
6026 |
RETURN (__MKSTRING(__getConfigurationString() COMMA_SND)); |
|
5406 | 6027 |
%}. |
5445 | 6028 |
^ 'unknownOS/unknownCONF:unknownPACK' |
6029 |
||
6030 |
" |
|
6031 |
Smalltalk configuration |
|
453 | 6032 |
" |
6033 |
! |
|
6034 |
||
7758 | 6035 |
copyrightString |
6036 |
"{ Pragma: +optSpace }" |
|
6037 |
||
6038 |
"return a copyright string" |
|
6039 |
||
6040 |
%{ /* NOCONTEXT */ |
|
6041 |
#ifndef __getCopyrightString |
|
6042 |
extern OBJ __getCopyrightString(); |
|
6043 |
#endif |
|
6044 |
||
6045 |
RETURN (__getCopyrightString()); |
|
6046 |
%}. |
|
6047 |
^ self primitiveFailed |
|
6048 |
||
6049 |
" |
|
6050 |
Smalltalk copyrightString |
|
6051 |
" |
|
6052 |
! |
|
6053 |
||
6054 |
distributorString |
|
6055 |
"{ Pragma: +optSpace }" |
|
7563 | 6056 |
|
6057 |
"return a string describing the distributor of this software" |
|
567 | 6058 |
|
6059 |
%{ /* NOCONTEXT */ |
|
829
fc386319f41c
removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents:
822
diff
changeset
|
6060 |
#ifndef __getDistributorString |
fc386319f41c
removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents:
822
diff
changeset
|
6061 |
extern OBJ __getDistributorString(); |
568 | 6062 |
#endif |
6063 |
||
829
fc386319f41c
removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents:
822
diff
changeset
|
6064 |
RETURN (__getDistributorString()); |
5410 | 6065 |
%}. |
5445 | 6066 |
^ 'eXept Software AG, Germany' |
5410 | 6067 |
|
567 | 6068 |
" |
6069 |
Smalltalk distributorString |
|
6070 |
" |
|
6071 |
! |
|
6072 |
||
7758 | 6073 |
expirationTime |
6074 |
"{ Pragma: +optSpace }" |
|
6075 |
||
6076 |
"for developers only: return the time when the system will expire. |
|
6077 |
after this time it will not run any longer. |
|
6078 |
It returns nil, if no expiration time has been set (system runs forever :-))" |
|
6079 |
||
6080 |
|exp| |
|
6081 |
||
6082 |
%{ |
|
6083 |
extern unsigned int __getExpirationTime(); |
|
6084 |
||
6085 |
exp = __MKUINT(__getExpirationTime()); |
|
6086 |
%}. |
|
6087 |
exp == 0 ifTrue:[ |
|
8251
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
6088 |
^ nil |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
6089 |
]. |
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
6090 |
^ Timestamp new fromOSTime:(exp * 1000). "OSTime is ms since 1970" |
7758 | 6091 |
|
6092 |
" |
|
6093 |
Smalltalk expirationTime |
|
6094 |
" |
|
6095 |
! |
|
6096 |
||
6097 |
fullVersionString |
|
6098 |
"{ Pragma: +optSpace }" |
|
6099 |
||
6100 |
"return a full version string" |
|
6101 |
||
6102 |
^ 'Smalltalk/X release ' , self versionString , ' of ' , self versionDate |
|
6103 |
||
6104 |
" |
|
6105 |
Smalltalk fullVersionString |
|
6106 |
" |
|
6107 |
||
6108 |
"Created: / 27.10.1997 / 17:03:09 / cg" |
|
6109 |
"Modified: / 27.10.1997 / 17:04:02 / cg" |
|
6110 |
! |
|
6111 |
||
6112 |
hello |
|
6113 |
"{ Pragma: +optSpace }" |
|
6114 |
||
6115 |
"return a greeting string" |
|
6116 |
||
6117 |
"stupid: this should come from a resource file ... |
|
6118 |
but I dont use it here, to allow mini-systems without |
|
6119 |
Resource-stuff." |
|
6120 |
||
6121 |
|proto lang| |
|
6122 |
||
6123 |
lang := Language. |
|
6124 |
(lang == #de) ifTrue:[ |
|
6125 |
proto := 'Willkommen bei %1 (Version %2 vom %3)' |
|
6126 |
] ifFalse:[ (lang == #fr) ifTrue:[ |
|
8084
88bccdc5943d
fileNameForClass (when checking in): repl. colons by underlines
Claus Gittinger <cg@exept.de>
parents:
7999
diff
changeset
|
6127 |
proto := 'Salut, Bienvenue à %1 (version %2 de %3)' |
7758 | 6128 |
] ifFalse:[ (lang == #it) ifTrue:[ |
6129 |
proto := 'Ciao, benvenuto al %1 (versione %2 di %3)' |
|
6130 |
] ifFalse:[ (lang == #es) ifTrue:[ |
|
8084
88bccdc5943d
fileNameForClass (when checking in): repl. colons by underlines
Claus Gittinger <cg@exept.de>
parents:
7999
diff
changeset
|
6131 |
"/ proto := 'Hola, bienvenida a %1 (versión %2 de %3)' |
5641 | 6132 |
] ifFalse:[ (lang == #es) ifTrue:[ |
8084
88bccdc5943d
fileNameForClass (when checking in): repl. colons by underlines
Claus Gittinger <cg@exept.de>
parents:
7999
diff
changeset
|
6133 |
"/ proto := 'Oi, benvindo a %1 (versão %2 de %3)' |
5641 | 6134 |
] ifFalse:[ (lang == #no) ifTrue:[ |
7616 | 6135 |
proto := 'Hei, verdenmottakelse til %1 (versjon %2 av %3)' |
5641 | 6136 |
]]]]]]. |
1307 | 6137 |
|
6138 |
"/ ... more needed here ... |
|
6139 |
||
6140 |
proto isNil ifTrue:[ |
|
7616 | 6141 |
proto := 'Hello World - here is %1 version %2 of %3'. |
453 | 6142 |
]. |
1307 | 6143 |
|
6187 | 6144 |
^ proto bindWith:('SmallTalk/X' allBold) |
7616 | 6145 |
with:(self versionString) |
6146 |
with:(self versionDate) |
|
453 | 6147 |
|
6148 |
" |
|
1307 | 6149 |
Smalltalk language:#us. |
6150 |
Smalltalk hello |
|
6151 |
||
6152 |
Smalltalk language:#de. |
|
6153 |
Smalltalk hello |
|
1412 | 6154 |
|
5641 | 6155 |
Smalltalk language:#no. |
6156 |
Smalltalk hello |
|
6157 |
||
1422 | 6158 |
Transcript showCR:(Smalltalk hello) |
6159 |
Stdout showCR:(Smalltalk hello) |
|
453 | 6160 |
" |
1307 | 6161 |
|
1412 | 6162 |
"Modified: 18.5.1996 / 14:25:13 / cg" |
617 | 6163 |
! |
6164 |
||
7758 | 6165 |
imageRestartTime |
6166 |
"return a timestamp for the moment when this image was restarted. |
|
1069 | 6167 |
If we do not execute from an image (i.e. fresh start), return nil." |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6168 |
|
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6169 |
^ ImageRestartTime |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6170 |
|
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6171 |
" |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6172 |
Smalltalk imageStartTime |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6173 |
Smalltalk imageRestartTime |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6174 |
" |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6175 |
|
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6176 |
"Created: 13.12.1995 / 17:44:20 / cg" |
1069 | 6177 |
"Modified: 6.3.1996 / 11:56:35 / cg" |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6178 |
! |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6179 |
|
7758 | 6180 |
imageSaveTime |
6181 |
"{ Pragma: +optSpace }" |
|
6182 |
||
6183 |
"return a timestamp for the moment when this image was saved" |
|
6184 |
||
6185 |
^ ObjectMemory imageSaveTime |
|
6186 |
! |
|
6187 |
||
6188 |
imageStartTime |
|
6189 |
"{ Pragma: +optSpace }" |
|
6190 |
||
6191 |
"return a timestamp for the moment when this system started the first time |
|
6192 |
(i.e. the first initial start without an image)" |
|
6193 |
||
6194 |
^ ImageStartTime |
|
6195 |
||
6196 |
" |
|
6197 |
Smalltalk imageStartTime |
|
6198 |
Smalltalk imageRestartTime |
|
6199 |
" |
|
6200 |
||
6201 |
"Created: 13.12.1995 / 17:44:14 / cg" |
|
6202 |
"Modified: 13.12.1995 / 17:45:47 / cg" |
|
6203 |
! |
|
6204 |
||
6205 |
majorVersionNr |
|
6206 |
"{ Pragma: +optSpace }" |
|
7563 | 6207 |
|
6208 |
"return the major version number. |
|
617 | 6209 |
This is only incremented for very fundamental changes, |
6210 |
which make old object files totally incompatible |
|
6211 |
(for example, if the layout/representation of fundamental |
|
3382 | 6212 |
classes changes). |
6213 |
||
3988 | 6214 |
ST/X revision Naming is: |
7616 | 6215 |
<major>.<minor>.<revision>.<release>" |
7362
1af5f648cdb2
major version bumb (due to class-layout change)
Claus Gittinger <cg@exept.de>
parents:
7348
diff
changeset
|
6216 |
|
1af5f648cdb2
major version bumb (due to class-layout change)
Claus Gittinger <cg@exept.de>
parents:
7348
diff
changeset
|
6217 |
^ 5 |
617 | 6218 |
|
6219 |
" |
|
6220 |
Smalltalk majorVersionNr |
|
6221 |
" |
|
1941
51332fe23542
bumped version to 3 (I guess, nameSpaces are a major step)
Claus Gittinger <cg@exept.de>
parents:
1917
diff
changeset
|
6222 |
|
51332fe23542
bumped version to 3 (I guess, nameSpaces are a major step)
Claus Gittinger <cg@exept.de>
parents:
1917
diff
changeset
|
6223 |
"Modified: 8.11.1996 / 19:59:21 / cg" |
617 | 6224 |
! |
6225 |
||
7758 | 6226 |
minorVersionNr |
6227 |
"{ Pragma: +optSpace }" |
|
6228 |
||
6229 |
"return the minor version number. |
|
6230 |
This is incremented for changes which make some old object |
|
6231 |
files incompatible, or the protocol changes such that some |
|
6232 |
classes need rework. |
|
6233 |
||
6234 |
ST/X revision Naming is: |
|
7981 | 6235 |
<major>.<minor>.<revision>.<release>" |
6236 |
||
6237 |
^ 2 |
|
7758 | 6238 |
|
6239 |
" |
|
6240 |
Smalltalk minorVersionNr |
|
6241 |
" |
|
6242 |
||
6243 |
"Modified: / 3.11.1997 / 14:49:48 / cg" |
|
6244 |
! |
|
6245 |
||
6246 |
releaseIdentification |
|
6247 |
"{ Pragma: +optSpace }" |
|
6248 |
||
6249 |
"for developers only: return the release |
|
6250 |
(to further identify the version in case of errors)" |
|
6251 |
||
6252 |
%{ /* NOCONTEXT */ |
|
6253 |
extern OBJ __getRel(); |
|
6254 |
||
6255 |
RETURN (__getRel()); |
|
6256 |
%}. |
|
6257 |
^ 'ST/X_experimental' |
|
6258 |
||
6259 |
" |
|
6260 |
Smalltalk releaseIdentification |
|
6261 |
" |
|
6262 |
! |
|
6263 |
||
6264 |
releaseNr |
|
7563 | 6265 |
"{ Pragma: +optSpace }" |
6266 |
||
6267 |
"return the revision number. |
|
7758 | 6268 |
Incremented for releases which fix bugs/add features but did not find |
6269 |
their way to the outside world. |
|
3988 | 6270 |
|
6271 |
ST/X revision Naming is: |
|
7758 | 6272 |
<major>.<minor>.<revision>.<release>" |
7668 | 6273 |
|
8269 | 6274 |
^ 1 |
617 | 6275 |
|
6276 |
" |
|
6277 |
Smalltalk releaseNr |
|
6278 |
" |
|
732
29a49feab799
release bump - that seems to be a good one
Claus Gittinger <cg@exept.de>
parents:
728
diff
changeset
|
6279 |
|
29a49feab799
release bump - that seems to be a good one
Claus Gittinger <cg@exept.de>
parents:
728
diff
changeset
|
6280 |
"Created: 10.12.1995 / 01:42:19 / cg" |
617 | 6281 |
! |
6282 |
||
7758 | 6283 |
revisionNr |
6284 |
"{ Pragma: +optSpace }" |
|
6285 |
||
6286 |
"return the revision number. |
|
6287 |
Incremented for releases which fix bugs/add features |
|
617 | 6288 |
and represent a stable workable version which got published |
3988 | 6289 |
to the outside world. |
6290 |
||
6291 |
ST/X revision Naming is: |
|
7981 | 6292 |
<major>.<minor>.<revision>.<release>" |
6293 |
||
8269 | 6294 |
^ 2 |
617 | 6295 |
|
6296 |
" |
|
6297 |
Smalltalk revisionNr |
|
7670 | 6298 |
Smalltalk hello |
617 | 6299 |
" |
1941
51332fe23542
bumped version to 3 (I guess, nameSpaces are a major step)
Claus Gittinger <cg@exept.de>
parents:
1917
diff
changeset
|
6300 |
|
3624 | 6301 |
"Modified: / 19.6.1998 / 04:29:10 / cg" |
617 | 6302 |
! |
6303 |
||
7758 | 6304 |
timeStamp |
6305 |
"return a string useful for timestamping a file. |
|
6306 |
The returned string is padded with spaces for a constant |
|
6307 |
length (to avoid changing a files size in fileOut with unchanged |
|
6308 |
class)." |
|
6309 |
||
6310 |
^ ('''' , self timeStampString , '''') paddedTo:80 with:(Character space) |
|
6311 |
! |
|
6312 |
||
6313 |
timeStamp:aStream |
|
6314 |
"write a string useful for timestamping a file onto aStream. |
|
6315 |
ST80 compatibility" |
|
6316 |
||
6317 |
aStream nextPutAll:(self timeStamp). |
|
6318 |
||
6319 |
"Created: / 18.6.1998 / 17:22:58 / cg" |
|
6320 |
! |
|
6321 |
||
6322 |
timeStampString |
|
6323 |
"return a string useful for timestamping a file." |
|
6324 |
||
7962 | 6325 |
|dateString| |
6326 |
||
8115 | 6327 |
dateString := String streamContents:[:s | Date today printOn:s language:#en]. "/ MUST be english !!!! |
7962 | 6328 |
|
7758 | 6329 |
^ ('From Smalltalk/X, Version:' , (Smalltalk versionString) , ' on ' |
7962 | 6330 |
, dateString , ' at ' , Time now printString |
7758 | 6331 |
) |
6332 |
! |
|
6333 |
||
6334 |
versionDate |
|
6335 |
"{ Pragma: +optSpace }" |
|
6336 |
||
6337 |
"return the executables build date - thats the date when the smalltalk |
|
6338 |
executable was built" |
|
6339 |
||
6340 |
%{ /* NOCONTEXT */ |
|
6341 |
extern char *__getBuildDateString(); |
|
6342 |
||
6343 |
RETURN (__MKSTRING(__getBuildDateString() COMMA_SND) ); |
|
6344 |
%}. |
|
6345 |
^ 'today' |
|
6346 |
||
6347 |
" |
|
6348 |
Smalltalk versionDate |
|
6349 |
" |
|
6350 |
! |
|
6351 |
||
6352 |
versionString |
|
6353 |
"{ Pragma: +optSpace }" |
|
6354 |
||
6355 |
"return the version string" |
|
6356 |
||
6357 |
^ (self majorVersionNr printString , |
|
6358 |
'.', |
|
6359 |
self minorVersionNr printString , |
|
6360 |
'.', |
|
6361 |
self revisionNr printString) |
|
6362 |
||
6363 |
" |
|
6364 |
Smalltalk versionString |
|
6365 |
" |
|
6366 |
! |
|
6367 |
||
6368 |
vmMajorVersionNr |
|
6369 |
"{ Pragma: +optSpace }" |
|
6370 |
||
6371 |
"return the VMs major version number." |
|
6372 |
%{ |
|
6373 |
RETURN (__MKSMALLINT(4)); |
|
6374 |
%}. |
|
6375 |
^ 4 |
|
6376 |
||
6377 |
" |
|
6378 |
Smalltalk vmMajorVersionNr |
|
6379 |
" |
|
6380 |
||
2 | 6381 |
! ! |
453 | 6382 |
|
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
6383 |
!Smalltalk class methodsFor:'documentation'! |
630 | 6384 |
|
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6385 |
version |
8405 | 6386 |
^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.648 2004-06-14 15:09:01 ca Exp $' |
630 | 6387 |
! ! |