author | Stefan Vogel <sv@exept.de> |
Fri, 20 Jun 2003 09:32:25 +0200 | |
changeset 7435 | c5afb1b0fd1b |
parent 7432 | 155245708ca3 |
child 7520 | 03cbfda8cf8b |
permissions | -rw-r--r-- |
1 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1988 by Claus Gittinger |
6853 | 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 |
6853 | 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 |
poolDictionaries:'' |
|
28 |
category:'System-Support' |
|
1 | 29 |
! |
30 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
31 |
!Smalltalk class methodsFor:'documentation'! |
70 | 32 |
|
617 | 33 |
copyright |
34 |
" |
|
35 |
COPYRIGHT (c) 1988 by Claus Gittinger |
|
6853 | 36 |
All Rights Reserved |
617 | 37 |
|
38 |
This software is furnished under a license and may be used |
|
39 |
only in accordance with the terms of that license and with the |
|
40 |
inclusion of the above copyright notice. This software may not |
|
41 |
be provided or otherwise made available to, or used by, any |
|
42 |
other person. No title to or ownership of the software is |
|
43 |
hereby transferred. |
|
44 |
" |
|
95 | 45 |
! |
46 |
||
70 | 47 |
documentation |
48 |
" |
|
49 |
This is one of the central classes in the system; |
|
50 |
it provides all system-startup, shutdown and maintenance support. |
|
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
51 |
Also global variables are (conceptionally) kept here. |
70 | 52 |
|
53 |
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
|
54 |
- my implementation of globals is totally different |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
55 |
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
|
56 |
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
|
57 |
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
|
58 |
functions found there. |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
59 |
|
70 | 60 |
However, it provides the known enumeration protocol. |
3062
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
61 |
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
|
62 |
to inherit more collection stuff ... |
70 | 63 |
|
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
64 |
|
1286 | 65 |
[Instance variables:] |
6853 | 66 |
none - all handling is done in the VM |
1286 | 67 |
|
68 |
[Class variables:] |
|
69 |
||
6853 | 70 |
StartBlocks <Collection> blocks to be executed in a separate process after |
71 |
everything has been initialized. These blocks will |
|
72 |
be deleted after execution and therefore not be |
|
73 |
executed after an image restart. Initial processes |
|
74 |
(such as the Launcher) are usually started here. |
|
75 |
These blocks are added by smalltalk.rc/private.rc etc. |
|
76 |
via #addStartBlock during early initialization. |
|
77 |
||
78 |
ImageStartBlocks |
|
79 |
<Collection> blocks to be executed in a separate process after |
|
80 |
everything has been initialized. These blocks will be |
|
81 |
executed after an image restart. |
|
82 |
These blocks are usually added by smalltalk_r.rc etc. |
|
83 |
||
84 |
ExitBlocks <Collection> blocks to evaluate before system is |
|
85 |
left. Not currently used (GNU-ST compatibility). |
|
86 |
||
87 |
SystemPath <Collection> path to search for system files (sources, bitmaps etc) |
|
88 |
Set to a default here, but typically changed from some |
|
89 |
startup.rc file |
|
90 |
||
91 |
PackagePath <Collection> path to search for package. |
|
92 |
This is going to replace the above systemPath, and a classes |
|
93 |
resources will eventually searched in its package directory. |
|
94 |
This list defines the path, where packages are searched for, |
|
95 |
initially this is something like /opt/smalltalk/packages. |
|
96 |
Set to a default here, but typically changed from some |
|
97 |
startup.rc file |
|
98 |
||
99 |
StartupClass <Class> class and selector, where the system starts up |
|
100 |
StartupSelector <Symbol> (right after VM initialization) |
|
101 |
StartupArguments <Array> If an image is saved while those being nonNil, |
|
102 |
the image will come up there. |
|
6881 | 103 |
Allows for customized images to be generated from a standard ST/X. |
104 |
StandAlone programs also set those during initialization. |
|
6853 | 105 |
|
106 |
CommandLine <String> Unix (OS-) command line |
|
107 |
||
108 |
CommandName <String> the command (i.e. argv[0]) |
|
109 |
||
110 |
CommandLineArguments <Array> Unix (OS-) command line arguments broken into words |
|
111 |
CommandName has been stripped off. |
|
112 |
(initially set by the VM) |
|
113 |
||
114 |
SilentLoading <Boolean> suppresses messages during fileIn and in compiler |
|
115 |
(can be set to true from a customized main.c) |
|
116 |
||
117 |
Initializing <Boolean> true while (re-)initializing |
|
118 |
Controls the behavior of certain error |
|
119 |
reporters (for example: suppress dialogBoxes) |
|
120 |
while the system is not yet fit for full operation. |
|
121 |
||
122 |
StandAlone <Boolean> true, if this is a standalone app; |
|
123 |
if true the process scheduler watches for |
|
124 |
which processes are still running, and |
|
125 |
exits ST/X, when the last non-background |
|
126 |
and non-system process exits. |
|
6881 | 127 |
Can be set in an application-specific startup script, |
128 |
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
|
129 |
|
6853 | 130 |
HeadlessOperation if true, a non-existing Display connection |
131 |
<Boolean> will NOT lead to an error-exit during startup. |
|
132 |
Default is false. |
|
6881 | 133 |
Can be set in an application-specific startup script, |
134 |
or, for standAlone programs, by C-code during initialization. |
|
6853 | 135 |
|
136 |
LogDoits <Boolean> if true, doits are also logged in the changes |
|
137 |
file. Default is false, since the changes file |
|
138 |
may become huge if every tiny doIt is saved there ... |
|
139 |
||
140 |
LoadBinaries <Boolean> if true, we attempt to load classes rom a binary |
|
141 |
file, if present. If false, this is always suppressed. |
|
142 |
||
143 |
SaveEmergencyImage <Boolean> if true (the default), an emergency image |
|
144 |
is saved, if the main Display looses its |
|
145 |
connection. This is useful if you have a |
|
146 |
flaky display connection (serial line) |
|
147 |
and want to have your stuff saved automatically |
|
148 |
in case of a broken connection. |
|
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
149 |
|
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
150 |
strictly private classVariables (helpers): |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
151 |
|
6853 | 152 |
CachedClasses <Collection> known classes (cached for faster class enumeration) |
153 |
||
154 |
CachedAbbreviations |
|
155 |
<Dictionary> className to filename mappings |
|
156 |
||
157 |
RealSystemPath <Collection> cached collection of directories along the path |
|
158 |
which really exist. Caching avoids long checks |
|
159 |
for existing directories on broken NFS volumes. |
|
160 |
||
161 |
SourcePath <Collection> cached names of really existing directories |
|
162 |
BitmapPath These are remembered, since in NFS systems, |
|
163 |
ResourcePath the time to lookup files may become long |
|
164 |
BinaryPath (especially, if some directories are on machines |
|
165 |
FileInPath which are not up ...). |
|
166 |
Therefore, the set of really |
|
167 |
existing directories is cached when the SystemPath |
|
168 |
is walked the first time. |
|
169 |
A consequence is that you have to invoke |
|
170 |
flushSystemPath, when you create any of those |
|
171 |
directories while running |
|
172 |
(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
|
173 |
|
1286 | 174 |
|
175 |
[author:] |
|
6853 | 176 |
Claus Gittinger |
3062
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
177 |
|
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
178 |
[see also:] |
6853 | 179 |
ObjectMemory |
70 | 180 |
" |
1 | 181 |
! ! |
182 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
183 |
!Smalltalk class methodsFor:'initialization'! |
1 | 184 |
|
617 | 185 |
initGlobalsFromEnvironment |
186 |
"setup globals from the shell-environment" |
|
187 |
||
188 |
|envString i langString terrString| |
|
189 |
||
5406 | 190 |
StandAlone isNil ifTrue:[ |
6853 | 191 |
StandAlone := false. |
5406 | 192 |
]. |
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
193 |
HeadlessOperation isNil ifTrue:[ |
6853 | 194 |
HeadlessOperation := false. |
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
195 |
]. |
5406 | 196 |
|
617 | 197 |
" |
198 |
extract Language and LanguageTerritory from LANG variable. |
|
5846 | 199 |
valid are for example: |
6853 | 200 |
en_en / en |
201 |
en_us |
|
202 |
en_gb |
|
203 |
de_de / de |
|
204 |
de_at (for Austria) |
|
5846 | 205 |
" |
206 |
||
207 |
Language := #en. |
|
994
6163ae7aaf9b
territory defaults to #us (instead of #usa)
Claus Gittinger <cg@exept.de>
parents:
977
diff
changeset
|
208 |
LanguageTerritory := #us. |
617 | 209 |
|
5846 | 210 |
|
211 |
"Format of LANG is: language[_territory][.codeset][@modifier] |
|
6853 | 212 |
language ISO-639 Language code |
213 |
territory ISO-3166 Contry code" |
|
5846 | 214 |
|
617 | 215 |
envString := OperatingSystem getEnvironment:'LANG'. |
3991
7b53bc45bf91
(isNil or:[isEmpty ]) -> (size == 0)
Claus Gittinger <cg@exept.de>
parents:
3988
diff
changeset
|
216 |
envString size > 0 ifTrue:[ |
6853 | 217 |
i := envString indexOf:$@. |
218 |
(i ~~ 0) ifTrue:[ |
|
219 |
envString := envString copyTo:(i - 1). |
|
220 |
LanguageModifier := (envString copyFrom:(i + 1)) asLowercase asSymbol. |
|
221 |
] ifFalse:[ |
|
222 |
LanguageModifier := nil. |
|
223 |
]. |
|
224 |
i := envString indexOf:$.. |
|
225 |
(i ~~ 0) ifTrue:[ |
|
226 |
envString := envString copyTo:(i - 1). |
|
227 |
LanguageCodeset := (envString copyFrom:(i + 1)) asLowercase asSymbol |
|
228 |
] ifFalse:[ |
|
229 |
LanguageCodeset := #'iso8859-1'. |
|
230 |
]. |
|
231 |
i := envString indexOf:$_. |
|
232 |
(i == 0) ifTrue:[ |
|
233 |
langString := envString. |
|
234 |
terrString := envString |
|
235 |
] ifFalse:[ |
|
236 |
langString := envString copyTo:(i - 1). |
|
237 |
terrString := envString copyFrom:(i + 1) |
|
238 |
]. |
|
239 |
Language := langString asLowercase asSymbol. |
|
240 |
LanguageTerritory := terrString asLowercase asSymbol |
|
617 | 241 |
]. |
242 |
||
243 |
" |
|
244 |
Smalltalk initGlobalsFromEnvironment |
|
245 |
" |
|
994
6163ae7aaf9b
territory defaults to #us (instead of #usa)
Claus Gittinger <cg@exept.de>
parents:
977
diff
changeset
|
246 |
|
6163ae7aaf9b
territory defaults to #us (instead of #usa)
Claus Gittinger <cg@exept.de>
parents:
977
diff
changeset
|
247 |
"Modified: 22.2.1996 / 16:59:12 / cg" |
617 | 248 |
! |
249 |
||
250 |
initInterrupts |
|
251 |
"initialize interrupts" |
|
252 |
||
253 |
OperatingSystem enableUserInterrupts. |
|
254 |
OperatingSystem enableHardSignalInterrupts. |
|
6390
41d5c47c33f0
Catch sigPWR and sigHUP on restart
Stefan Vogel <sv@exept.de>
parents:
6366
diff
changeset
|
255 |
OperatingSystem enableCrashSignalInterrupts. |
617 | 256 |
|
257 |
ObjectMemory userInterruptHandler:self. |
|
258 |
ObjectMemory signalInterruptHandler:self. |
|
259 |
ObjectMemory recursionInterruptHandler:self. |
|
260 |
||
963
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
261 |
" |
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
262 |
Smalltalk initInterrupts |
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
263 |
" |
2873
5bc8c81c4a34
Catch fpExeceptionInterrupt after image restart.
Stefan Vogel <sv@exept.de>
parents:
2844
diff
changeset
|
264 |
|
5bc8c81c4a34
Catch fpExeceptionInterrupt after image restart.
Stefan Vogel <sv@exept.de>
parents:
2844
diff
changeset
|
265 |
"Modified: 20.8.1997 / 09:35:49 / stefan" |
617 | 266 |
! |
267 |
||
268 |
initStandardStreams |
|
269 |
"initialize some well-known streams" |
|
270 |
||
271 |
Stdout := NonPositionableExternalStream forStdout. |
|
272 |
Stderr := NonPositionableExternalStream forStderr. |
|
273 |
Stdin := NonPositionableExternalStream forStdin. |
|
274 |
Printer := PrinterStream. |
|
275 |
Transcript := Stderr |
|
276 |
||
963
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
277 |
" |
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
278 |
Smalltalk initStandardStreams |
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
279 |
" |
617 | 280 |
! |
281 |
||
282 |
initStandardTools |
|
283 |
"predefine some tools which we will need later |
|
284 |
- if the view-classes exist, |
|
285 |
they will redefine Inspector and Debugger for graphical interfaces" |
|
286 |
||
287 |
"redefine debug-tools, if view-classes exist" |
|
288 |
||
289 |
Display notNil ifTrue:[ |
|
6853 | 290 |
InspectorView notNil ifTrue:[ |
291 |
Inspector := InspectorView |
|
292 |
]. |
|
293 |
DebugView notNil ifTrue:[ |
|
294 |
Debugger := DebugView |
|
295 |
]. |
|
296 |
Display initialize |
|
617 | 297 |
] |
963
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
298 |
|
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 |
Smalltalk initStandardTools |
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
301 |
" |
617 | 302 |
! |
303 |
||
304 |
initSystemPath |
|
305 |
"setup path where system files are searched for. |
|
306 |
the default path is set to: |
|
6853 | 307 |
. |
308 |
$HOME (if defined) |
|
309 |
$HOME/.smalltalk (if defined & existing) |
|
310 |
$SMALLTALK_LIBDIR (if defined & existing) |
|
311 |
$STX_LIBDIR (if defined & existing) |
|
312 |
$STX_TOPDIR (if defined & existing) |
|
4001
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
313 |
|
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
314 |
unix: |
6853 | 315 |
/opt/smalltalk (if existing) |
316 |
/opt/smalltalk/release (if existing) |
|
317 |
/usr/local/lib/smalltalk (if existing) |
|
318 |
/usr/lib/smalltalk (if existing) |
|
319 |
/lib/smalltalk (if existing) |
|
4001
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
320 |
|
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
321 |
win32: |
6853 | 322 |
\smalltalk (if existing) |
323 |
\programs\smalltalk (if existing) |
|
324 |
\programs\exept\smalltalk (if existing) |
|
325 |
registry info (if present) |
|
4001
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
326 |
|
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
327 |
vms: |
6853 | 328 |
$stx:lib (if existing) |
329 |
$stx:root (if existing) |
|
617 | 330 |
|
331 |
of course, it is possible to add entries from the 'smalltalk.rc' |
|
332 |
startup file; add expressions such as: |
|
6853 | 333 |
Smalltalk systemPath addFirst:'/foo/bar/baz'. |
334 |
or: |
|
335 |
Smalltalk systemPath addLast:'/fee/foe/foo'. |
|
4001
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
336 |
|
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
337 |
However, smalltalk.rc itself must be found along the above path. |
617 | 338 |
" |
339 |
||
2928 | 340 |
ChangeFileName := 'changes'. |
341 |
OperatingSystem isVMSlike ifTrue:[ |
|
6853 | 342 |
BitmapDirName := 'bitmaps.dir'. |
343 |
BinaryDirName := 'binary.dir'. |
|
344 |
SourceDirName := 'source.dir'. |
|
345 |
ResourceDirName := 'resources.dir'. |
|
346 |
FileInDirName := 'filein.dir'. |
|
347 |
PackageDirName := 'packages.dir'. |
|
2928 | 348 |
] ifFalse:[ |
6853 | 349 |
BitmapDirName := 'bitmaps'. |
350 |
BinaryDirName := 'binary'. |
|
351 |
SourceDirName := 'source'. |
|
352 |
ResourceDirName := 'resources'. |
|
353 |
FileInDirName := 'fileIn'. |
|
354 |
PackageDirName := 'packages'. |
|
2928 | 355 |
]. |
356 |
||
680 | 357 |
SystemPath isNil ifTrue:[ |
6853 | 358 |
SystemPath := OperatingSystem defaultSystemPath. |
359 |
self flushPathCaches |
|
5139 | 360 |
]. |
361 |
||
5144 | 362 |
PackagePath isNil ifTrue:[ |
6853 | 363 |
PackagePath := OperatingSystem defaultPackagePath. |
5144 | 364 |
]. |
617 | 365 |
|
366 |
" |
|
367 |
Smalltalk initSystemPath |
|
368 |
Smalltalk systemPath |
|
369 |
" |
|
5139 | 370 |
|
5145 | 371 |
"Modified: / 24.12.1999 / 00:23:35 / cg" |
617 | 372 |
! |
373 |
||
374 |
initUserPreferences |
|
375 |
"setup other stuff" |
|
376 |
||
377 |
LogDoits := false. |
|
378 |
LoadBinaries := false. |
|
6854 | 379 |
SaveEmergencyImage := (StandAlone ~~ true). |
3062
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
380 |
|
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
381 |
"Modified: / 24.10.1997 / 18:22:47 / cg" |
617 | 382 |
! |
383 |
||
384 |
initializeModules |
|
385 |
"perform module specific initialization and |
|
386 |
send #initialize to all classes. |
|
387 |
Notice: this is not called when an image is restarted" |
|
4963 | 388 |
|
389 |
" TODO: |
|
390 |
change VM/stc to invoke #Smalltalk initializeClass:aClass |
|
391 |
(instead of directly sending #initialize) |
|
392 |
This will allow us to wrap an exception handler around classes |
|
393 |
#initialize methods." |
|
394 |
||
617 | 395 |
%{ |
1688
8a42db1eea60
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1682
diff
changeset
|
396 |
__init_registered_modules__(3); |
4963 | 397 |
|
1481 | 398 |
@global(DemoMode) = __getDemoMode() ? true : false; |
5410 | 399 |
RETURN (self); |
400 |
%}. |
|
401 |
^ self primitiveFailed |
|
402 |
||
617 | 403 |
! |
404 |
||
325 | 405 |
initializeSystem |
24 | 406 |
"initialize all other classes; setup dispatcher processes etc. |
3499 | 407 |
This one is the very first entry into the smalltalk world, |
408 |
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
|
409 |
Notice: |
6853 | 410 |
this is not called when an image is restarted; in this |
411 |
case the show starts in Smalltalk>>restart." |
|
211 | 412 |
|
6841
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
413 |
|idx| |
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
414 |
|
3499 | 415 |
Initializing := true. |
6841
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
416 |
|
3499 | 417 |
AbstractOperatingSystem initializeConcreteClass. |
418 |
||
5400 | 419 |
CommandLineArguments isNil ifTrue:[ |
6853 | 420 |
CommandLineArguments := #('stx'). |
5400 | 421 |
]. |
4006
c7ad38c52eb9
must set CommandLineArguments earlier (to be available in initializeSystem)
Claus Gittinger <cg@exept.de>
parents:
4001
diff
changeset
|
422 |
CommandLine := CommandLineArguments copy. |
c7ad38c52eb9
must set CommandLineArguments earlier (to be available in initializeSystem)
Claus Gittinger <cg@exept.de>
parents:
4001
diff
changeset
|
423 |
CommandLineArguments := CommandLineArguments asOrderedCollection. |
6842 | 424 |
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
|
425 |
|
4028
b46539f16af5
added --silentStartup argument
Claus Gittinger <cg@exept.de>
parents:
4026
diff
changeset
|
426 |
SilentLoading := (CommandLineArguments includes:'--silentStartup'). |
348 | 427 |
|
6841
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
428 |
DebuggingStandAlone := false. |
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
429 |
|
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
430 |
StandAlone ifTrue:[ |
6853 | 431 |
InfoPrinting := false. |
432 |
ObjectMemory infoPrinting:false. |
|
433 |
||
6881 | 434 |
idx := CommandLineArguments indexOf:'--debug'. |
6853 | 435 |
idx ~~ 0 ifTrue:[ |
436 |
DebuggingStandAlone := true. |
|
437 |
]. |
|
438 |
DebuggingStandAlone ifTrue:[ |
|
439 |
Inspector := MiniInspector. |
|
440 |
Debugger := MiniDebugger. |
|
441 |
]. |
|
6841
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
442 |
] ifFalse:[ |
6853 | 443 |
"/ |
444 |
"/ define low-level debugging tools - graphical classes are not prepared yet |
|
445 |
"/ to handle things. |
|
446 |
"/ This will bring us into the MiniDebugger when an error occurs during startup. |
|
447 |
"/ |
|
448 |
Inspector := MiniInspector. |
|
449 |
Debugger := MiniDebugger. |
|
6841
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
450 |
]. |
1 | 451 |
|
2090
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
452 |
"/ |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
453 |
"/ start catching SIGSEGV and SIGBUS |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
454 |
"/ |
713
32540afb8ffc
setup SIGSEGV/SIGBUS handling early - to catch those during startup
Claus Gittinger <cg@exept.de>
parents:
706
diff
changeset
|
455 |
OperatingSystem enableHardSignalInterrupts. |
32540afb8ffc
setup SIGSEGV/SIGBUS handling early - to catch those during startup
Claus Gittinger <cg@exept.de>
parents:
706
diff
changeset
|
456 |
|
1 | 457 |
self initGlobalsFromEnvironment. |
458 |
||
2090
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
459 |
"/ |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
460 |
"/ 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
|
461 |
"/ 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
|
462 |
"/ |
1 | 463 |
Object initialize. |
423 | 464 |
Signal initialize. |
2907 | 465 |
Filename initialize. |
326 | 466 |
ObjectMemory initialize. |
2504
ece15ffbcb69
Initialize OperatingSystem early (needed for some signals).
Stefan Vogel <sv@exept.de>
parents:
2485
diff
changeset
|
467 |
OperatingSystem initialize. |
596
ecb1d732dade
require Stream to be initialized before ExternalStream is
Claus Gittinger <cg@exept.de>
parents:
592
diff
changeset
|
468 |
Stream initialize. |
1 | 469 |
ExternalStream initialize. |
211 | 470 |
|
471 |
self initStandardStreams. "/ setup Stdin, Stdout etc. |
|
1 | 472 |
|
2090
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
473 |
"/ |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
474 |
"/ sorry, path must be set before ... |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
475 |
"/ 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
|
476 |
"/ |
1 | 477 |
self initSystemPath. |
478 |
||
479 |
Compiler := ByteCodeCompiler. |
|
480 |
Compiler isNil ifTrue:[ |
|
6853 | 481 |
" |
482 |
ByteCodeCompiler is not in the system (i.e. has not been linked in) |
|
483 |
this allows at least immediate evaluations for runtime systems without compiler |
|
484 |
NOTICE: a parser is always needed, otherwise we cannot read resource files etc. |
|
485 |
" |
|
486 |
Compiler := Parser |
|
1 | 487 |
]. |
488 |
||
2090
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
489 |
"/ |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
490 |
"/ another one, to be initialized before others |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
491 |
"/ |
2077
6b5dc412dd15
must initialize Processor before doing modulInits
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
492 |
ProcessorScheduler initialize. |
6b5dc412dd15
must initialize Processor before doing modulInits
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
493 |
|
2090
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
494 |
"/ |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
495 |
"/ now, finally, initialize all other classes |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
496 |
"/ |
325 | 497 |
self initializeModules. |
498 |
||
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
499 |
ImageStartTime := AbsoluteTime now. |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
500 |
|
70 | 501 |
self initInterrupts. |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
502 |
self initUserPreferences. |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
503 |
|
2090
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
504 |
"/ |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
505 |
"/ 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
|
506 |
"/ 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
|
507 |
"/ (especially: streams and signals can now be used) |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
508 |
"/ |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
509 |
ObjectMemory changed:#initialized. |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
510 |
|
2504
ece15ffbcb69
Initialize OperatingSystem early (needed for some signals).
Stefan Vogel <sv@exept.de>
parents:
2485
diff
changeset
|
511 |
"Modified: 8.1.1997 / 19:58:12 / stefan" |
2907 | 512 |
"Modified: 7.9.1997 / 23:34:44 / cg" |
325 | 513 |
! |
1 | 514 |
|
617 | 515 |
isInitialized |
516 |
"this returns true, if the system is properly initialized; |
|
517 |
i.e. false during startup. Especially, the whole viewing stuff is |
|
518 |
not working correctly until initialized." |
|
519 |
||
520 |
^ Initializing not |
|
1 | 521 |
! |
522 |
||
477
8710aba7876b
oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents:
457
diff
changeset
|
523 |
reinitStandardStreams |
8710aba7876b
oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents:
457
diff
changeset
|
524 |
"reinitialize some well-known streams. |
8710aba7876b
oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents:
457
diff
changeset
|
525 |
Tis must be done very early during startup, to allow for |
8710aba7876b
oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents:
457
diff
changeset
|
526 |
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
|
527 |
(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
|
528 |
|
8710aba7876b
oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents:
457
diff
changeset
|
529 |
Stdout reOpen. Stderr reOpen. Stdin reOpen. |
161 | 530 |
! ! |
531 |
||
7295 | 532 |
!Smalltalk class methodsFor:'Compatibility-Squeak'! |
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
533 |
|
4872 | 534 |
beep |
535 |
Screen current beep |
|
536 |
! |
|
537 |
||
4599 | 538 |
garbageCollect |
539 |
ObjectMemory garbageCollect |
|
540 |
! |
|
541 |
||
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
542 |
garbageCollectMost |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
543 |
"collect recently created garbage; return the amount of freeSpace. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
544 |
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
|
545 |
newSpace + freeListSpace is returned." |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
546 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
547 |
ObjectMemory scavenge. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
548 |
^ ObjectMemory freeSpace |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
549 |
+ (ObjectMemory newSpaceSize - ObjectMemory newSpaceUsed) |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
550 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
551 |
! |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
552 |
|
4870 | 553 |
isMorphic |
554 |
^ false |
|
555 |
! |
|
556 |
||
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
557 |
registerExternalObject: anObject |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
558 |
"Register the given object in the external objects array and return its index. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
559 |
If it is already there, just return its index. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
560 |
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
|
561 |
primitive code (via the global Smalltalk:SpecialObjectArray)" |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
562 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
563 |
| objects firstEmptyIndex obj sz newObjects | |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
564 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
565 |
objects := SpecialObjectArray. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
566 |
objects isNil ifTrue:[ |
6853 | 567 |
objects := Array new:5. |
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
568 |
]. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
569 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
570 |
"find the first empty slot and look if already registered" |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
571 |
firstEmptyIndex := 0. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
572 |
1 to: objects size do: [:i | |
6853 | 573 |
obj := objects at: i. |
574 |
obj == anObject ifTrue: [^ i]. "object already there, just return its index" |
|
575 |
(obj == nil and: [firstEmptyIndex = 0]) ifTrue: [ |
|
576 |
firstEmptyIndex := i |
|
577 |
] |
|
4584
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 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
580 |
"if no empty slots, expand the array" |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
581 |
firstEmptyIndex = 0 ifTrue: [ |
6853 | 582 |
sz := objects size. |
583 |
newObjects := objects species new: sz + 20. "grow linearly" |
|
584 |
newObjects replaceFrom: 1 to: sz with: objects startingAt: 1. |
|
585 |
firstEmptyIndex := sz + 1. |
|
586 |
SpecialObjectArray := newObjects. |
|
587 |
objects := newObjects |
|
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
588 |
]. |
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 at: firstEmptyIndex put: anObject. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
591 |
^ firstEmptyIndex |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
592 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
593 |
! |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
594 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
595 |
unregisterExternalObject: anObject |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
596 |
"Unregister the given object in the external objects array. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
597 |
Do nothing if it isn't registered." |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
598 |
|
5913 | 599 |
|objects| |
600 |
||
601 |
anObject isNil ifTrue:[^ self]. |
|
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
602 |
objects := SpecialObjectArray. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
603 |
1 to: objects size do: [:i | |
6853 | 604 |
(objects at: i) == anObject ifTrue: [ |
605 |
objects at: i put: nil |
|
606 |
] |
|
5913 | 607 |
]. |
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
608 |
! ! |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
609 |
|
7295 | 610 |
!Smalltalk class methodsFor:'Compatibility-V''Age'! |
6722
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
611 |
|
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
612 |
allClassesImplementing:aSelector |
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
613 |
^ self allClasses select:[:cls | cls implements:aSelector]. |
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
614 |
! ! |
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
615 |
|
7295 | 616 |
!Smalltalk class methodsFor:'Compatibility-VW5.4'! |
6094
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
617 |
|
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
618 |
defineClass:nameSymbol superclass:superclass indexedType:indexed private:private instanceVariableNames:instVars classInstanceVariableNames:classInstVars imports:imports category:category attributes:annotations |
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
619 |
|newClass| |
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
620 |
|
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
621 |
indexed == #none ifTrue:[ |
6853 | 622 |
newClass := superclass |
623 |
subclass:nameSymbol |
|
624 |
instanceVariableNames:instVars |
|
625 |
classVariableNames:'' |
|
626 |
poolDictionaries:'' |
|
627 |
category:category |
|
628 |
inEnvironment:self. |
|
629 |
classInstVars size > 0 ifTrue:[ |
|
630 |
newClass class instanceVariableNames:classInstVars. |
|
631 |
]. |
|
632 |
^ newClass |
|
6851 | 633 |
]. |
634 |
self shouldImplement. |
|
6094
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
635 |
! ! |
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
636 |
|
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
637 |
!Smalltalk class methodsFor:'accessing'! |
453 | 638 |
|
3083 | 639 |
associationAt:aKey |
640 |
"return a key-value association for aKey. |
|
641 |
Since ST/X's Smalltalk as no real dictionary, this is |
|
642 |
simulated here." |
|
643 |
||
644 |
|val| |
|
645 |
||
646 |
val := self at:aKey ifAbsent:nil. |
|
647 |
val isNil ifTrue:[^ nil]. |
|
648 |
^ Association key:aKey value:val |
|
649 |
||
650 |
"Created: / 1.11.1997 / 13:27:20 / cg" |
|
651 |
! |
|
652 |
||
3610
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
653 |
associationAt:aKey ifAbsent:exceptionBlock |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
654 |
"return a key-value association for aKey, or the value |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
655 |
from exceptionBlock, if no such key is present. |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
656 |
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
|
657 |
simulated here." |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
658 |
|
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
659 |
|val| |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
660 |
|
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
661 |
val := self at:aKey ifAbsent:nil. |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
662 |
val isNil ifTrue:[^ exceptionBlock value]. |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
663 |
^ Association key:aKey value:val |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
664 |
|
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
665 |
"Created: / 18.6.1998 / 17:05:24 / cg" |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
666 |
! |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
667 |
|
453 | 668 |
at:aKey |
669 |
"retrieve the value stored under aKey, a symbol. |
|
1956 | 670 |
Return nil if not present |
671 |
(this will be changed to trigger an error - better use #at:ifAbsent:)" |
|
453 | 672 |
|
6851 | 673 |
aKey class == String ifTrue:[self error:'expected symbol']. |
6080
15ea3cbf6003
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
6074
diff
changeset
|
674 |
|
453 | 675 |
%{ /* NOCONTEXT */ |
676 |
RETURN ( __GLOBAL_GET(aKey) ); |
|
5406 | 677 |
%}. |
5410 | 678 |
^ self primitiveFailed |
453 | 679 |
! |
680 |
||
681 |
at:aKey ifAbsent:aBlock |
|
682 |
"retrieve the value stored at aKey. |
|
683 |
If there is nothing stored under this key, return the value of |
|
684 |
the evaluation of aBlock." |
|
685 |
||
686 |
(self includesKey:aKey) ifTrue:[ |
|
6853 | 687 |
^ self at:aKey |
453 | 688 |
]. |
689 |
^ aBlock value |
|
690 |
||
691 |
" |
|
692 |
Smalltalk at:#fooBar <- returns nil |
|
693 |
Smalltalk at:#fooBar ifAbsent:['sorry'] <- no error |
|
694 |
" |
|
695 |
! |
|
696 |
||
4870 | 697 |
at:aKey ifPresent:aBlock |
698 |
"try to retrieve the value stored at aKey. |
|
699 |
If there is nothing stored under this key, do nothing. |
|
700 |
Otherwise, evaluate aBlock, passing the retrieved value as argument." |
|
701 |
||
702 |
(self includesKey:aKey) ifTrue:[ |
|
6853 | 703 |
^ aBlock value:(self at:aKey) |
4870 | 704 |
]. |
705 |
^ nil |
|
706 |
||
707 |
" |
|
708 |
Smalltalk at:#fooBar ifPresent:[:what | Transcript showCR:what]. |
|
709 |
Smalltalk at:#Object ifPresent:[:what | Transcript showCR:what]. |
|
710 |
" |
|
711 |
||
712 |
! |
|
713 |
||
453 | 714 |
at:aKey put:aValue |
1222 | 715 |
"store the argument aValue under aKey, a symbol. |
716 |
Return aValue (sigh)." |
|
453 | 717 |
|
718 |
|oldValue| |
|
719 |
||
720 |
%{ |
|
721 |
oldValue = __GLOBAL_SET(aKey, aValue, (OBJ *)0); |
|
722 |
%}. |
|
723 |
CachedClasses notNil ifTrue:[ |
|
6853 | 724 |
oldValue isBehavior ifTrue:[ |
725 |
oldValue name == aKey ifTrue:[ |
|
726 |
CachedClasses remove:oldValue ifAbsent:[] |
|
727 |
] |
|
728 |
]. |
|
729 |
aValue isBehavior ifTrue:[ |
|
1956 | 730 |
"/ aValue isMeta ifTrue:[ |
731 |
"/ "/ this should not happen |
|
732 |
"/ ('SMALLTALK: store a Metaclass: ' , aValue name , ' as ' , aKey) infoPrintCR. |
|
733 |
"/ ]. |
|
734 |
||
6853 | 735 |
aValue name == aKey ifTrue:[ |
736 |
CachedClasses add:aValue |
|
737 |
] ifFalse:[ |
|
738 |
CachedClasses := nil |
|
739 |
] |
|
740 |
]. |
|
453 | 741 |
]. |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
742 |
^ aValue. |
1955 | 743 |
"/ |
744 |
"/%{ /* NOCONTEXT */ |
|
745 |
"/ (void) __GLOBAL_SET(aKey, aValue, (OBJ *)0); |
|
746 |
"/%}. |
|
747 |
"/ CachedClasses := nil. |
|
748 |
"/ ^ aValue |
|
1222 | 749 |
|
750 |
"Modified: 19.4.1996 / 11:31:49 / cg" |
|
453 | 751 |
! |
752 |
||
617 | 753 |
includesKey:aKey |
754 |
"return true, if the key is known" |
|
453 | 755 |
|
6231 | 756 |
"/ for debugging - this is a common mistake, |
757 |
"/ to try to access a class by nameString, instead |
|
758 |
"/ of by symbol. |
|
759 |
||
760 |
"/ aKey class == String ifTrue:[self halt]. |
|
4391 | 761 |
|
453 | 762 |
%{ /* NOCONTEXT */ |
617 | 763 |
RETURN ( __GLOBAL_KEYKNOWN(aKey) ); |
5410 | 764 |
%}. |
765 |
^ self primitiveFailed |
|
453 | 766 |
! |
767 |
||
768 |
keyAtValue:anObject |
|
769 |
"return the symbol under which anObject is stored - or nil" |
|
770 |
||
771 |
self keysDo:[:aKey | |
|
6853 | 772 |
(self at:aKey) == anObject ifTrue:[^ aKey] |
453 | 773 |
]. |
774 |
^ nil |
|
775 |
||
776 |
"Smalltalk keyAtValue:Object" |
|
777 |
! |
|
778 |
||
779 |
keys |
|
780 |
"return a collection with all keys in the Smalltalk dictionary" |
|
781 |
||
782 |
|keys| |
|
783 |
||
784 |
keys := IdentitySet new. |
|
785 |
self keysDo:[:k | keys add:k]. |
|
786 |
^ keys |
|
617 | 787 |
! |
788 |
||
789 |
removeKey:aKey |
|
878
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
790 |
"remove the association stored under the key-argument from the globals dictionary. |
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
791 |
WARNING: |
6853 | 792 |
this is somewhat dangerous: conceptionally, the association is removed, |
793 |
to which machine & byte compiled code refers if it accesses a global. |
|
794 |
If there are still global accesses in some literalArray or from machine-compiled code, |
|
795 |
it continues to reference the globals value via that obsolete association and gets a nil |
|
796 |
value. (which is correct) |
|
797 |
However, if that global is later reintroduced, a new association will be created and |
|
798 |
the new global now referenced via the new association. |
|
799 |
The old accesses will still see nil, although the globals value is actually non-nil |
|
800 |
(this is questionable). |
|
801 |
To avoid this problem, the #removeClass: method never removed the key." |
|
617 | 802 |
|
803 |
CachedClasses := nil. |
|
804 |
||
805 |
%{ /* NOCONTEXT */ |
|
806 |
RETURN ( __GLOBAL_REMOVE(aKey) ); |
|
5410 | 807 |
%}. |
808 |
^ self primitiveFailed |
|
809 |
||
2705
ed04a67da248
added #values for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
2681
diff
changeset
|
810 |
! |
ed04a67da248
added #values for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
2681
diff
changeset
|
811 |
|
ed04a67da248
added #values for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
2681
diff
changeset
|
812 |
values |
ed04a67da248
added #values for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
2681
diff
changeset
|
813 |
"return a collection with all values in the Smalltalk dictionary" |
ed04a67da248
added #values for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
2681
diff
changeset
|
814 |
|
ed04a67da248
added #values for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
2681
diff
changeset
|
815 |
|values| |
ed04a67da248
added #values for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
2681
diff
changeset
|
816 |
|
ed04a67da248
added #values for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
2681
diff
changeset
|
817 |
values := OrderedCollection new. |
ed04a67da248
added #values for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
2681
diff
changeset
|
818 |
self do:[:v | values add:v]. |
ed04a67da248
added #values for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
2681
diff
changeset
|
819 |
^ values |
ed04a67da248
added #values for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
2681
diff
changeset
|
820 |
|
ed04a67da248
added #values for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
2681
diff
changeset
|
821 |
"Created: 20.6.1997 / 16:58:28 / cg" |
453 | 822 |
! ! |
823 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
824 |
!Smalltalk class methodsFor:'binary storage'! |
453 | 825 |
|
2476 | 826 |
addGlobalsForBinaryStorageTo:globalDictionary |
453 | 827 |
|pools| |
828 |
||
829 |
pools := Set new. |
|
2465
1dfcacbbd376
ignore nil values when adding globals (binary storage)
Claus Gittinger <cg@exept.de>
parents:
2418
diff
changeset
|
830 |
|
879 | 831 |
self keysAndValuesDo:[:key :value | |
6853 | 832 |
(key includes:$:) ifFalse:[ "/ skip classVars |
833 |
(value ~~ self |
|
834 |
and:[value notNil]) ifTrue:[ |
|
835 |
value isClass ifTrue:[ |
|
836 |
value addGlobalsForBinaryStorageTo:globalDictionary. |
|
837 |
pools addAll:value sharedPools |
|
838 |
] ifFalse:[ |
|
839 |
globalDictionary at:(key->value) put:self |
|
840 |
]. |
|
841 |
value notNil ifTrue:[ |
|
842 |
globalDictionary at:value put:self |
|
843 |
] |
|
844 |
] |
|
845 |
] |
|
453 | 846 |
]. |
847 |
||
848 |
pools do:[:poolDictionary| |
|
6853 | 849 |
poolDictionary addGlobalsForBinaryStorageTo:globalDictionary |
453 | 850 |
] |
2465
1dfcacbbd376
ignore nil values when adding globals (binary storage)
Claus Gittinger <cg@exept.de>
parents:
2418
diff
changeset
|
851 |
|
1dfcacbbd376
ignore nil values when adding globals (binary storage)
Claus Gittinger <cg@exept.de>
parents:
2418
diff
changeset
|
852 |
"Modified: 19.3.1997 / 18:15:25 / cg" |
2476 | 853 |
"Created: 21.3.1997 / 15:40:31 / cg" |
453 | 854 |
! |
855 |
||
879 | 856 |
storeBinaryDefinitionOf:anObject on:stream manager:manager |
453 | 857 |
|string| |
858 |
||
859 |
anObject class == Association ifTrue:[ |
|
6853 | 860 |
string := 'Smalltalk associationAt: ', anObject key storeString |
453 | 861 |
] ifFalse: [ |
6853 | 862 |
string := 'Smalltalk at: ', (self keyAtValue: anObject) storeString |
453 | 863 |
]. |
864 |
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
|
865 |
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
|
866 |
"/ 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
|
867 |
|
1dfcacbbd376
ignore nil values when adding globals (binary storage)
Claus Gittinger <cg@exept.de>
parents:
2418
diff
changeset
|
868 |
"Modified: 19.3.1997 / 18:49:14 / cg" |
453 | 869 |
! ! |
870 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
871 |
!Smalltalk class methodsFor:'browsing'! |
453 | 872 |
|
617 | 873 |
browseAllCallsOn:aSelectorSymbol |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
874 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
875 |
|
617 | 876 |
"startup a browser for all methods sending a particular message" |
877 |
||
6020 | 878 |
UserPreferences systemBrowserClass browseAllCallsOn:aSelectorSymbol |
617 | 879 |
|
880 |
" |
|
881 |
Smalltalk browseAllCallsOn:#at:put: |
|
882 |
" |
|
883 |
! |
|
884 |
||
885 |
browseAllSelect:aBlock |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
886 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
887 |
|
617 | 888 |
"startup a browser for all methods for which aBlock returns true" |
889 |
||
6020 | 890 |
UserPreferences systemBrowserClass browseAllSelect:aBlock |
617 | 891 |
|
892 |
" |
|
893 |
Smalltalk browseAllSelect:[:m | m literals isNil] |
|
894 |
" |
|
895 |
! |
|
896 |
||
453 | 897 |
browseChanges |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
898 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
899 |
|
453 | 900 |
"startup a changes browser" |
901 |
||
902 |
ChangesBrowser notNil ifTrue:[ |
|
6853 | 903 |
ChangesBrowser open |
453 | 904 |
] ifFalse:[ |
6853 | 905 |
self warn:'no ChangesBrowser built in' |
453 | 906 |
] |
907 |
||
908 |
" |
|
909 |
Smalltalk browseChanges |
|
910 |
" |
|
911 |
! |
|
912 |
||
6970 | 913 |
browseClass:aClass |
914 |
"{ Pragma: +optSpace }" |
|
915 |
||
916 |
"startup a browser on aClass" |
|
917 |
||
918 |
UserPreferences systemBrowserClass browseClass:aClass |
|
919 |
||
920 |
" |
|
921 |
Smalltalk browseClass:Array |
|
922 |
" |
|
923 |
! |
|
924 |
||
6819 | 925 |
browseImplementorsMatching:aSelectorSymbolOrMatchPattern |
926 |
"{ Pragma: +optSpace }" |
|
927 |
||
928 |
"startup a browser for all methods implementing a message matching" |
|
929 |
||
930 |
UserPreferences systemBrowserClass browseImplementorsMatching:aSelectorSymbolOrMatchPattern |
|
931 |
||
932 |
" |
|
933 |
Smalltalk browseImplementorsOf:#'at:put:' |
|
934 |
Smalltalk browseImplementorsMatching:#'at:*' |
|
935 |
" |
|
936 |
! |
|
937 |
||
453 | 938 |
browseImplementorsOf:aSelectorSymbol |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
939 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
940 |
|
453 | 941 |
"startup a browser for all methods implementing a particular message" |
942 |
||
6020 | 943 |
UserPreferences systemBrowserClass browseImplementorsOf:aSelectorSymbol |
453 | 944 |
|
945 |
" |
|
946 |
Smalltalk browseImplementorsOf:#at:put: |
|
947 |
" |
|
6970 | 948 |
! |
949 |
||
950 |
browseInClass:aClass |
|
951 |
"{ Pragma: +optSpace }" |
|
952 |
||
953 |
"startup a full browser showing aClass" |
|
954 |
||
955 |
UserPreferences systemBrowserClass openInClass:aClass |
|
956 |
||
957 |
" |
|
958 |
Smalltalk browseInClass:Array |
|
959 |
" |
|
960 |
! |
|
961 |
||
962 |
browseInClass:aClass selector:selector |
|
963 |
"{ Pragma: +optSpace }" |
|
964 |
||
965 |
"startup a full browser showing aClass>>selector" |
|
966 |
||
967 |
UserPreferences systemBrowserClass openInClass:aClass selector:selector |
|
968 |
||
969 |
" |
|
970 |
Smalltalk browseInClass:Array selector:#at: |
|
971 |
" |
|
453 | 972 |
! ! |
973 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
974 |
!Smalltalk class methodsFor:'class management'! |
453 | 975 |
|
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
976 |
changeCategoryOf:aClass to:newCategory |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
977 |
"change a classes category, add a change record, |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
978 |
send change notifications" |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
979 |
|
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
980 |
|ns| |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
981 |
|
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
982 |
aClass category ~= newCategory ifTrue:[ |
6853 | 983 |
aClass category:(newCategory withoutSeparators asSymbol). |
984 |
Project addChangeRecordForClass:aClass. |
|
985 |
||
986 |
"notify change of category" |
|
987 |
ns := aClass environment ? self. |
|
988 |
ns changed:#organization. |
|
989 |
ns ~~ self ifTrue:[ |
|
990 |
self changed:#organization. |
|
991 |
] |
|
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
992 |
]. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
993 |
|
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
994 |
" |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
995 |
Smalltalk changeCategoryOf:NewApplication to:#myApplications |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
996 |
" |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
997 |
|
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
998 |
"Modified: / 11.2.2000 / 11:36:27 / cg" |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
999 |
! |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1000 |
|
5306
806182135518
VW5i compatibility defineNameSpace: added
Claus Gittinger <cg@exept.de>
parents:
5285
diff
changeset
|
1001 |
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
|
1002 |
NameSpace name:name |
5306
806182135518
VW5i compatibility defineNameSpace: added
Claus Gittinger <cg@exept.de>
parents:
5285
diff
changeset
|
1003 |
|
806182135518
VW5i compatibility defineNameSpace: added
Claus Gittinger <cg@exept.de>
parents:
5285
diff
changeset
|
1004 |
! |
806182135518
VW5i compatibility defineNameSpace: added
Claus Gittinger <cg@exept.de>
parents:
5285
diff
changeset
|
1005 |
|
5892
df4661be9da2
added individual cachedClass-flush
Claus Gittinger <cg@exept.de>
parents:
5881
diff
changeset
|
1006 |
flushCachedClass:aClass |
5895 | 1007 |
CachedClasses notNil ifTrue:[ |
6853 | 1008 |
CachedClasses remove:aClass ifAbsent:[] |
5895 | 1009 |
] |
5892
df4661be9da2
added individual cachedClass-flush
Claus Gittinger <cg@exept.de>
parents:
5881
diff
changeset
|
1010 |
! |
df4661be9da2
added individual cachedClass-flush
Claus Gittinger <cg@exept.de>
parents:
5881
diff
changeset
|
1011 |
|
453 | 1012 |
flushCachedClasses |
7430
e07639f21626
flush subclassInfo when cached classes are flushed
Stefan Vogel <sv@exept.de>
parents:
7366
diff
changeset
|
1013 |
CachedClasses := nil. |
e07639f21626
flush subclassInfo when cached classes are flushed
Stefan Vogel <sv@exept.de>
parents:
7366
diff
changeset
|
1014 |
Class flushSubclassInfo. |
5580
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1015 |
|
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1016 |
" |
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1017 |
Smalltalk flushCachedClasses |
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1018 |
" |
453 | 1019 |
! |
1020 |
||
1021 |
removeClass:aClass |
|
1022 |
"remove the argument, aClass from the smalltalk dictionary; |
|
1023 |
we have to flush the caches since these methods are now void. |
|
1024 |
Also, class variables of aClass are removed." |
|
1025 |
||
4781 | 1026 |
|sym cSym names oldName oldNameSym actualName wrongName ns ons| |
453 | 1027 |
|
4099 | 1028 |
aClass isNil ifTrue:[^ self]. |
4781 | 1029 |
|
453 | 1030 |
oldName := aClass name. |
4781 | 1031 |
sym := oldNameSym := oldName asSymbol. |
1032 |
((self at:oldNameSym) == aClass) ifFalse:[ |
|
7181 | 1033 |
"check other name ..." |
1034 |
(self includes:aClass) ifFalse:[ |
|
1035 |
'Smalltalk [warning]: no such class: ' errorPrint. oldName errorPrintCR. |
|
1036 |
^ self |
|
1037 |
]. |
|
1038 |
" |
|
1039 |
the class has changed its name - without telling me ... |
|
1040 |
what should be done in this case ? |
|
1041 |
" |
|
1042 |
'Smalltalk [warning]: class ' errorPrint. oldName errorPrint. |
|
1043 |
' has changed its name' errorPrintCR. |
|
1044 |
||
1045 |
"/ |
|
1046 |
"/ might be an alias (i.e. removing a compatibility name) |
|
1047 |
"/ |
|
1048 |
actualName := self keyAtValue:aClass. |
|
1049 |
('Smalltalk [info]: ' , oldName , ' is actually stored as ' , actualName , '.') infoPrintCR. |
|
1050 |
sym := actualName asSymbol. |
|
1051 |
oldName := actualName asString. |
|
1052 |
wrongName := true. |
|
453 | 1053 |
]. |
1054 |
||
4781 | 1055 |
ns := aClass nameSpace. |
1056 |
aClass topOwningClass notNil ifTrue:[ |
|
7181 | 1057 |
ons := aClass topOwningClass nameSpace |
4781 | 1058 |
]. |
1059 |
||
453 | 1060 |
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
|
1061 |
|
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1062 |
"/ |
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1063 |
"/ 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
|
1064 |
"/ |
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1065 |
"/ self removeKey:sym. "/ remove key - this actually fails, if there are |
7181 | 1066 |
"/ still compiled code references." |
453 | 1067 |
|
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1068 |
"remove private classes" |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1069 |
|
2485
9f4a11a4521f
new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents:
2476
diff
changeset
|
1070 |
aClass privateClassesSorted do:[:somePrivateClass | |
7181 | 1071 |
aClass privateClassesAt:(somePrivateClass nameWithoutPrefix) asSymbol put:nil. |
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1072 |
]. |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1073 |
|
453 | 1074 |
"remove class variables" |
1075 |
||
1076 |
names := aClass classVariableString asCollectionOfWords. |
|
1077 |
names do:[:name | |
|
7181 | 1078 |
cSym := (sym , ':' , name) asSymbol. |
1079 |
self at:cSym asSymbol put:nil. |
|
1080 |
||
1081 |
"/ |
|
1082 |
"/ see comment in removeKey: on why we dont remove it here |
|
1083 |
"/ |
|
1084 |
"/ self removeKey:cSym |
|
453 | 1085 |
]. |
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1086 |
|
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1087 |
|
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1088 |
"/ actually could get along with less flushing |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1089 |
"/ (entries for aClass and subclasses only) |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1090 |
"/ 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
|
1091 |
"/ 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
|
1092 |
"/ expensive then cache flushing. |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1093 |
"/ |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1094 |
"/ aClass allSubclassesDo:[:aSubclass | |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1095 |
"/ ObjectMemory flushInlineCachesForClass:aSubclass. |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1096 |
"/ ObjectMemory flushMethodCacheFor:aSubclass |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1097 |
"/ ]. |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1098 |
"/ ObjectMemory flushInlineCachesForClass:aClass. |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1099 |
"/ ObjectMemory flushMethodCacheFor:aClass |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1100 |
|
453 | 1101 |
ObjectMemory flushInlineCaches. |
1102 |
ObjectMemory flushMethodCache. |
|
1103 |
||
7181 | 1104 |
aClass addChangeRecordForClassRemove. |
453 | 1105 |
self changed:#classRemove with:aClass. |
1106 |
||
1655 | 1107 |
aClass category:#'* removed *'. |
1108 |
||
5326 | 1109 |
self flushCachedClasses. |
1110 |
Class flushSubclassInfo. |
|
1111 |
||
3627
452f2e1ff1b4
removeClass - care for aliases.
Claus Gittinger <cg@exept.de>
parents:
3626
diff
changeset
|
1112 |
wrongName == true ifTrue:[ |
7181 | 1113 |
"/ |
1114 |
"/ an alias (i.e. removing a compatibility name) |
|
1115 |
"/ |
|
1116 |
"/ check if there are more refs to it ... |
|
1117 |
[self includes:aClass] whileTrue:[ |
|
1118 |
actualName := self keyAtValue:aClass. |
|
1119 |
('Smalltalk [info]: ' , aClass name , ' is also registered under the name ' , actualName |
|
1120 |
, ' - remove that binding too.') infoPrintCR. |
|
1121 |
self at:actualName put:nil. |
|
1122 |
]. |
|
4724
44793fe70787
recompile ns classes after a class remove
Claus Gittinger <cg@exept.de>
parents:
4723
diff
changeset
|
1123 |
]. |
44793fe70787
recompile ns classes after a class remove
Claus Gittinger <cg@exept.de>
parents:
4723
diff
changeset
|
1124 |
|
4781 | 1125 |
ns ~~ Smalltalk ifTrue:[ |
7181 | 1126 |
ons notNil ifTrue:[ |
1127 |
ClassBuilder |
|
1128 |
recompileGlobalAccessorsTo:oldNameSym |
|
1129 |
in:ons |
|
1130 |
except:nil |
|
1131 |
]. |
|
1132 |
(ns notNil and:[ns ~~ ons]) ifTrue:[ |
|
1133 |
ClassBuilder |
|
1134 |
recompileGlobalAccessorsTo:oldNameSym |
|
1135 |
in:ns |
|
1136 |
except:nil |
|
1137 |
]. |
|
3627
452f2e1ff1b4
removeClass - care for aliases.
Claus Gittinger <cg@exept.de>
parents:
3626
diff
changeset
|
1138 |
]. |
452f2e1ff1b4
removeClass - care for aliases.
Claus Gittinger <cg@exept.de>
parents:
3626
diff
changeset
|
1139 |
|
452f2e1ff1b4
removeClass - care for aliases.
Claus Gittinger <cg@exept.de>
parents:
3626
diff
changeset
|
1140 |
"Modified: / 20.6.1998 / 13:26:10 / cg" |
617 | 1141 |
! |
1142 |
||
1143 |
renameClass:aClass to:newName |
|
1525
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1144 |
"rename aClass to newName. Most of the work is in |
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1145 |
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
|
1146 |
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
|
1147 |
|
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1148 |
|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
|
1149 |
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
|
1150 |
oldBaseNameWithoutPrefix newBaseNameWithoutPrefix i1 i2 nm ns subns |
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1151 |
oldMetaclass newMetaclass| |
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1152 |
|
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1153 |
"/ check for all intermediate namespaces / owning classes |
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1154 |
i1 := 1. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1155 |
i2 := 1. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1156 |
ns := self. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1157 |
[i2 ~~ 0] whileTrue:[ |
6853 | 1158 |
i2 := newName indexOfSubCollection:'::' startingAt:i1. |
1159 |
i2 ~~ 0 ifTrue:[ |
|
1160 |
nm := newName copyFrom:i1 to:i2-1. |
|
1161 |
ns isNameSpace ifTrue:[ |
|
1162 |
subns := ns at:nm asSymbol ifAbsent:nil. |
|
1163 |
subns isNil ifTrue:[ |
|
1164 |
self error:'Nonexisting namespace: ',nm. |
|
1165 |
^ nil. |
|
1166 |
]. |
|
1167 |
] ifFalse:[ |
|
1168 |
subns := ns privateClassesAt:nm asSymbol. |
|
1169 |
subns isNil ifTrue:[ |
|
1170 |
self error:'Cannot create a namespace below a class' |
|
1171 |
] |
|
1172 |
]. |
|
1173 |
ns := subns. |
|
1174 |
i1 := i2 + 2. |
|
1175 |
]. |
|
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1176 |
]. |
617 | 1177 |
|
1178 |
oldName := aClass name. |
|
6734 | 1179 |
oldNameSpace := aClass topNameSpace. |
2319
640bb389f90a
recompile when moving classes across namespaces
Claus Gittinger <cg@exept.de>
parents:
2317
diff
changeset
|
1180 |
oldBaseName := aClass nameWithoutNameSpacePrefix. |
3698
8bce45214d24
fixed renaming of a private class (must recompile owner)
Claus Gittinger <cg@exept.de>
parents:
3678
diff
changeset
|
1181 |
oldBaseNameWithoutPrefix := aClass nameWithoutPrefix. |
617 | 1182 |
oldSym := oldName asSymbol. |
2485
9f4a11a4521f
new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents:
2476
diff
changeset
|
1183 |
privateClasses := aClass privateClassesSorted. |
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1184 |
|
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1185 |
((self at:oldSym) ~~ aClass) ifTrue:[ |
6853 | 1186 |
'Smalltalk [warning]: rename failed - name is different from key' errorPrintCR. |
1187 |
^ self |
|
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1188 |
]. |
617 | 1189 |
|
1525
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1190 |
"/ rename the class |
617 | 1191 |
|
1847
6e567214b167
care for className being a symbol, when renaming classes
Claus Gittinger <cg@exept.de>
parents:
1758
diff
changeset
|
1192 |
newSym := newName asSymbol. |
6e567214b167
care for className being a symbol, when renaming classes
Claus Gittinger <cg@exept.de>
parents:
1758
diff
changeset
|
1193 |
aClass setName:newSym. |
617 | 1194 |
|
1525
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1195 |
"/ store it in Smalltalk |
617 | 1196 |
|
1197 |
self at:oldSym put:nil. |
|
1525
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1198 |
|
5610
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1199 |
"/ change the owning class |
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1200 |
ns isNameSpace ifFalse:[ |
6853 | 1201 |
aClass isPrivate ifTrue:[ |
1202 |
aClass class setOwningClass:ns. |
|
1203 |
] ifFalse:[ |
|
1204 |
oldMetaclass := aClass class. |
|
1205 |
||
1206 |
"/ sigh - must make a PrivateMetaclass from Metaclass |
|
1207 |
newMetaclass := PrivateMetaclass new. |
|
1208 |
newMetaclass flags:(oldMetaclass flags). |
|
1209 |
newMetaclass setSuperclass:(oldMetaclass superclass). |
|
1210 |
newMetaclass instSize:(oldMetaclass instSize). |
|
1211 |
newMetaclass setInstanceVariableString:(oldMetaclass instanceVariableString). |
|
1212 |
newMetaclass setMethodDictionary:(oldMetaclass methodDictionary). |
|
1213 |
newMetaclass setSoleInstance:aClass. |
|
1214 |
newMetaclass setOwningClass:ns. |
|
1215 |
||
1216 |
aClass changeClassTo:newMetaclass. |
|
1217 |
ObjectMemory flushCaches. |
|
1218 |
] |
|
5610
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1219 |
] ifTrue:[ |
6853 | 1220 |
aClass isPrivate ifTrue:[ |
1221 |
aClass class setOwningClass:nil. |
|
1222 |
] |
|
5610
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1223 |
]. |
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1224 |
|
878
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1225 |
"/ |
1525
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1226 |
"/ 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
|
1227 |
"/ |
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1228 |
"/ self removeKey:oldSym. |
617 | 1229 |
self at:newSym put:aClass. |
1230 |
||
1525
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1231 |
"/ 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
|
1232 |
|
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1233 |
oldNameToNewName := IdentityDictionary new. |
617 | 1234 |
|
1235 |
names := aClass classVariableString asCollectionOfWords. |
|
1236 |
names do:[:name | |
|
6853 | 1237 |
oldCVSym := (oldSym , ':' , name) asSymbol. |
1238 |
value := self at:oldCVSym. |
|
1239 |
self at:oldCVSym put:nil. |
|
1240 |
||
1241 |
"/ |
|
1242 |
"/ see comment in #removeKey: on why we dont remove it it here |
|
1243 |
"/ |
|
1244 |
"/ self removeKey:cSym. |
|
1245 |
||
1246 |
newCVSym := (newSym , ':' , name) asSymbol. |
|
1247 |
self at:newCVSym put:value. |
|
1248 |
||
1249 |
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
|
1250 |
]. |
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1251 |
|
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1252 |
"/ 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
|
1253 |
|
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1254 |
oldNameToNewName keysAndValuesDo:[:oldNameSym :newNameSym | |
6853 | 1255 |
aClass withAllSubclasses do:[:aSubClass | |
1256 |
Transcript showCR:'changing global accesses from ''' , oldNameSym , ''' into ''' , newNameSym , ''' in class: ''' , aSubClass name , ''' ...'. |
|
1257 |
aSubClass instAndClassSelectorsAndMethodsDo:[:sel :aMethod | |
|
1258 |
aMethod changeLiteral:oldNameSym to:newNameSym |
|
1259 |
]. |
|
1260 |
]. |
|
1261 |
||
1262 |
"/ and also in privateClasses ? ... |
|
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1263 |
|
2485
9f4a11a4521f
new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents:
2476
diff
changeset
|
1264 |
"/ privateClasses size > 0 ifTrue:[ |
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1265 |
"/ privateClasses do:[:aPrivateClass | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1266 |
"/ aPrivateClass withAllSubclasses do:[:aSubClass | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1267 |
"/ aSubClass class methodDictionary do:[:aMethod | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1268 |
"/ aMethod changeLiteral:oldNameSym to:newNameSym |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1269 |
"/ ]. |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1270 |
"/ aSubClass methodDictionary do:[:aMethod | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1271 |
"/ aMethod changeLiteral:oldNameSym to:newNameSym |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1272 |
"/ ] |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1273 |
"/ ]. |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1274 |
"/ ] |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1275 |
"/ ] |
617 | 1276 |
]. |
1277 |
||
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1278 |
aClass addChangeRecordForClassRename:oldSym to:newSym. |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1279 |
|
5333
d80386e06d21
rename into other namespace did not work
Claus Gittinger <cg@exept.de>
parents:
5328
diff
changeset
|
1280 |
"/ 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
|
1281 |
aClass setEnvironment:nil. |
6734 | 1282 |
newNameSpace := aClass topNameSpace. |
2405
939f4e751ef3
dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents:
2379
diff
changeset
|
1283 |
|
2485
9f4a11a4521f
new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents:
2476
diff
changeset
|
1284 |
privateClasses size > 0 ifTrue:[ |
6853 | 1285 |
"/ must rename privateClasses as well |
1286 |
Class withoutUpdatingChangesDo:[ |
|
1287 |
privateClasses do:[:aPrivateClass | |
|
1288 |
self renameClass:aPrivateClass |
|
1289 |
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
|
1290 |
|
6853 | 1291 |
Transcript showCR:'recompiling methods in ''' , newNameSpace name , ''' accessing ''' , oldName , '::' , aPrivateClass nameWithoutPrefix , ''' ...'. |
1292 |
ClassBuilder |
|
1293 |
recompileGlobalAccessorsTo:(oldName , '::' , aPrivateClass nameWithoutPrefix) asSymbol |
|
1294 |
in:newNameSpace |
|
1295 |
except:nil. |
|
1296 |
] |
|
1297 |
] |
|
2405
939f4e751ef3
dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents:
2379
diff
changeset
|
1298 |
]. |
939f4e751ef3
dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents:
2379
diff
changeset
|
1299 |
|
2319
640bb389f90a
recompile when moving classes across namespaces
Claus Gittinger <cg@exept.de>
parents:
2317
diff
changeset
|
1300 |
oldNameSpace ~~ newNameSpace ifTrue:[ |
5246
2ca7b20c4108
create namespaces as requried, when renaming a class
Claus Gittinger <cg@exept.de>
parents:
5214
diff
changeset
|
1301 |
|
6853 | 1302 |
"/ all those referencing the class from the old nameSpace |
1303 |
"/ must be recompiled ... |
|
1304 |
"/ (to now access the global from smalltalk) |
|
1305 |
||
1306 |
oldNameSpace ~~ Smalltalk ifTrue:[ |
|
1307 |
Transcript showCR:'recompiling methods in ''' , oldNameSpace name , ''' accessing ''' , oldName , ''' ...'. |
|
1308 |
||
1309 |
ClassBuilder |
|
1310 |
recompileGlobalAccessorsTo:oldName asSymbol |
|
1311 |
in:oldNameSpace |
|
1312 |
except:nil. |
|
1313 |
]. |
|
1314 |
||
1315 |
"/ all referencing the class in the new namespace |
|
1316 |
"/ as well; to now access the new class. |
|
1317 |
||
1318 |
(newNameSpace notNil and:[newNameSpace ~~ Smalltalk]) ifTrue:[ |
|
1319 |
Transcript showCR:'recompiling methods in ''' , newNameSpace name , ''' accessing ''' , oldBaseName , ''' ...'. |
|
1320 |
||
1321 |
ClassBuilder |
|
1322 |
recompileGlobalAccessorsTo:oldBaseName asSymbol |
|
1323 |
in:newNameSpace |
|
1324 |
except:nil. |
|
1325 |
]. |
|
3698
8bce45214d24
fixed renaming of a private class (must recompile owner)
Claus Gittinger <cg@exept.de>
parents:
3678
diff
changeset
|
1326 |
] ifFalse:[ |
6853 | 1327 |
"/ all references to a global with my new name in my owning class |
1328 |
"/ must now be redirected to myself. |
|
1329 |
||
1330 |
aClass isPrivate ifTrue:[ |
|
1331 |
newBaseName := aClass nameWithoutNameSpacePrefix. |
|
1332 |
newBaseNameWithoutPrefix := aClass nameWithoutPrefix. |
|
1333 |
||
1334 |
Transcript showCR:'recompiling methods accessing ''' , oldBaseNameWithoutPrefix , ''' in: ''' , aClass owningClass name , ''' ...'. |
|
1335 |
aClass owningClass recompileMethodsAccessingGlobal:oldBaseNameWithoutPrefix. |
|
1336 |
aClass owningClass class recompileMethodsAccessingGlobal:oldBaseNameWithoutPrefix. |
|
1337 |
||
1338 |
Transcript showCR:'recompiling methods accessing ''' , oldBaseName , ''' in: ''' , aClass owningClass name , ''' ...'. |
|
1339 |
aClass owningClass recompileMethodsAccessingGlobal:oldBaseName. |
|
1340 |
aClass owningClass class recompileMethodsAccessingGlobal:oldBaseName. |
|
1341 |
||
1342 |
Transcript showCR:'recompiling methods accessing ''' , newBaseNameWithoutPrefix , ''' in: ''' , aClass owningClass name , ''' ...'. |
|
1343 |
aClass owningClass recompileMethodsAccessingGlobal:newBaseNameWithoutPrefix. |
|
1344 |
aClass owningClass class recompileMethodsAccessingGlobal:newBaseNameWithoutPrefix. |
|
1345 |
||
1346 |
Transcript showCR:'recompiling methods accessing ''' , newBaseName , ''' in: ''' , aClass owningClass name , ''' ...'. |
|
1347 |
aClass owningClass recompileMethodsAccessingGlobal:newBaseName. |
|
1348 |
aClass owningClass class recompileMethodsAccessingGlobal:newBaseName. |
|
1349 |
] |
|
4040
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1350 |
]. |
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1351 |
|
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1352 |
aClass changed:#definition. |
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1353 |
"/ 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
|
1354 |
aClass allSubclassesDo:[:subClass | |
6853 | 1355 |
subClass changed:#definition. |
4040
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1356 |
]. |
5613
b534e427f028
change message when renaming a class
Claus Gittinger <cg@exept.de>
parents:
5611
diff
changeset
|
1357 |
self changed:#definition. |
b534e427f028
change message when renaming a class
Claus Gittinger <cg@exept.de>
parents:
5611
diff
changeset
|
1358 |
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
|
1359 |
|
8bce45214d24
fixed renaming of a private class (must recompile owner)
Claus Gittinger <cg@exept.de>
parents:
3678
diff
changeset
|
1360 |
"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
|
1361 |
"Modified: / 18.6.1996 / 14:20:50 / stefan" |
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1362 |
"Modified: / 11.2.2000 / 01:12:38 / cg" |
453 | 1363 |
! ! |
1364 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1365 |
!Smalltalk class methodsFor:'copying'! |
453 | 1366 |
|
617 | 1367 |
deepCopy |
1410 | 1368 |
"redefined to return self - there is only one Smalltalk dictionary" |
453 | 1369 |
|
1370 |
^ self |
|
1410 | 1371 |
|
1372 |
"Modified: 18.5.1996 / 12:13:33 / cg" |
|
453 | 1373 |
! |
1374 |
||
1375 |
deepCopyUsing:aDictionary |
|
1410 | 1376 |
"redefined to return self - there is only one Smalltalk dictionary" |
453 | 1377 |
|
1378 |
^ self |
|
1410 | 1379 |
|
1380 |
"Modified: 18.5.1996 / 12:13:36 / cg" |
|
453 | 1381 |
! |
1382 |
||
617 | 1383 |
shallowCopy |
1410 | 1384 |
"redefined to return self - there is only one Smalltalk dictionary" |
617 | 1385 |
|
1386 |
^ self |
|
1410 | 1387 |
|
1388 |
"Modified: 18.5.1996 / 12:13:39 / cg" |
|
617 | 1389 |
! |
1390 |
||
1391 |
simpleDeepCopy |
|
1410 | 1392 |
"redefined to return self - there is only one Smalltalk dictionary" |
453 | 1393 |
|
1394 |
^ self |
|
1410 | 1395 |
|
1396 |
"Modified: 18.5.1996 / 12:13:42 / cg" |
|
453 | 1397 |
! ! |
1398 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1399 |
!Smalltalk class methodsFor:'debugging ST/X'! |
453 | 1400 |
|
7325 | 1401 |
compileTrace:aBoolean |
1402 |
"dump generated inline code (NOOP if VM was compiled without the trace-debug option)" |
|
1403 |
%{ |
|
1404 |
extern char __compileTrace__; |
|
1405 |
||
1406 |
__compileTrace__ = (aBoolean == true) ? 1 : 0; |
|
1407 |
%} |
|
1408 |
" |
|
1409 |
Smalltalk compileTrace:true |
|
1410 |
Smalltalk compileTrace:false |
|
1411 |
" |
|
1412 |
! |
|
1413 |
||
453 | 1414 |
debugBreakPoint |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1415 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1416 |
|
453 | 1417 |
"call the dummy debug function, on which a breakpoint |
1418 |
can be put in adb, sdb, dbx or gdb. |
|
1419 |
WARNING: this method is for debugging only |
|
6853 | 1420 |
it will be removed without notice." |
453 | 1421 |
%{ |
2212 | 1422 |
__PATCHUPCONTEXTS(__context); |
808
1919838112d1
renamed debugBreakPoint -> __debugBreakPoint__
Claus Gittinger <cg@exept.de>
parents:
796
diff
changeset
|
1423 |
__debugBreakPoint__(); |
5410 | 1424 |
RETURN(self); |
1425 |
%}. |
|
1426 |
^ self primitiveFailed |
|
1427 |
||
1428 |
||
453 | 1429 |
! |
1430 |
||
617 | 1431 |
exitWithCoreDump |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1432 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1433 |
|
617 | 1434 |
"abort program and dump core" |
1435 |
||
4096
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1436 |
OperatingSystem exitWithCoreDump |
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1437 |
"/ never returns |
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1438 |
|
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1439 |
"Be careful evaluating this |
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1440 |
Smalltalk exitWithCoreDump |
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1441 |
" |
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1442 |
|
617 | 1443 |
! |
1444 |
||
1445 |
fatalAbort |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1446 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1447 |
|
617 | 1448 |
"report a fatal-error, print a stack backtrace and exit with core dump. |
1449 |
(You may turn off the stack print with debugPrinting:false)" |
|
1450 |
%{ |
|
1451 |
__fatal0(__context, "fatalAbort"); |
|
1452 |
/* NEVER RETURNS */ |
|
5410 | 1453 |
%}. |
1454 |
^ self primitiveFailed |
|
1455 |
||
617 | 1456 |
! |
1457 |
||
1458 |
fatalAbort:aMessage |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1459 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1460 |
|
617 | 1461 |
"report a fatal-error; print a stack backtrace and exit with core dump |
1462 |
(You may turn off the stack print with debugPrinting:false)" |
|
1463 |
||
1464 |
%{ |
|
1465 |
char *msg; |
|
1466 |
||
1467 |
if (__isString(aMessage)) |
|
6853 | 1468 |
msg = (char *) __stringVal(aMessage); |
617 | 1469 |
else |
6853 | 1470 |
msg = "fatalAbort"; |
617 | 1471 |
|
1472 |
__fatal0(__context, msg); |
|
1473 |
/* NEVER RETURNS */ |
|
5410 | 1474 |
%}. |
1475 |
^ self primitiveFailed |
|
1476 |
||
5441 | 1477 |
! |
1478 |
||
1479 |
vmInstructionTrace:aBoolean |
|
1480 |
||
1481 |
||
453 | 1482 |
! ! |
1483 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1484 |
!Smalltalk class methodsFor:'enumerating'! |
453 | 1485 |
|
1486 |
allBehaviorsDo:aBlock |
|
5580
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1487 |
"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
|
1488 |
|
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1489 |
self allClassesAndMetaclassesDo:aBlock |
453 | 1490 |
|
1491 |
" |
|
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
1492 |
Smalltalk allBehaviorsDo:[:aClass | aClass name printCR] |
453 | 1493 |
" |
1494 |
! |
|
1495 |
||
6217
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1496 |
allClassCategories |
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1497 |
"return a set of all class categories in the system" |
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1498 |
|
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1499 |
|allCategories| |
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1500 |
|
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1501 |
allCategories := Set new. |
7124
da253fd03ba1
Do not sort categories in #allClassCategories.
Stefan Vogel <sv@exept.de>
parents:
7105
diff
changeset
|
1502 |
Smalltalk allClassesDo:[:cls | |category| |
da253fd03ba1
Do not sort categories in #allClassCategories.
Stefan Vogel <sv@exept.de>
parents:
7105
diff
changeset
|
1503 |
category := cls category. |
da253fd03ba1
Do not sort categories in #allClassCategories.
Stefan Vogel <sv@exept.de>
parents:
7105
diff
changeset
|
1504 |
category notNil ifTrue:[ |
da253fd03ba1
Do not sort categories in #allClassCategories.
Stefan Vogel <sv@exept.de>
parents:
7105
diff
changeset
|
1505 |
allCategories add:category. |
da253fd03ba1
Do not sort categories in #allClassCategories.
Stefan Vogel <sv@exept.de>
parents:
7105
diff
changeset
|
1506 |
]. |
da253fd03ba1
Do not sort categories in #allClassCategories.
Stefan Vogel <sv@exept.de>
parents:
7105
diff
changeset
|
1507 |
]. |
da253fd03ba1
Do not sort categories in #allClassCategories.
Stefan Vogel <sv@exept.de>
parents:
7105
diff
changeset
|
1508 |
|
7125
947dc98dd66c
Return #allClassCategories as Set (to fit comment and make
Stefan Vogel <sv@exept.de>
parents:
7124
diff
changeset
|
1509 |
^ allCategories. |
6217
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1510 |
|
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1511 |
" |
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1512 |
Smalltalk allClassCategories |
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1513 |
" |
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1514 |
|
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1515 |
"Created: / 17.11.2001 / 12:13:09 / cg" |
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1516 |
! |
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1517 |
|
5579
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1518 |
allClassesAndMetaclassesDo:aBlock |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1519 |
"evaluate the argument, aBlock for all classes and metaclasses in the system." |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1520 |
|
5940
804fb27727a6
oops - allClassesAndMetaclassesDo: evaluated block twice for
Claus Gittinger <cg@exept.de>
parents:
5916
diff
changeset
|
1521 |
|already| |
804fb27727a6
oops - allClassesAndMetaclassesDo: evaluated block twice for
Claus Gittinger <cg@exept.de>
parents:
5916
diff
changeset
|
1522 |
|
804fb27727a6
oops - allClassesAndMetaclassesDo: evaluated block twice for
Claus Gittinger <cg@exept.de>
parents:
5916
diff
changeset
|
1523 |
already := IdentitySet new. |
804fb27727a6
oops - allClassesAndMetaclassesDo: evaluated block twice for
Claus Gittinger <cg@exept.de>
parents:
5916
diff
changeset
|
1524 |
self allClassesDo:[:eachClass | |cls| |
6853 | 1525 |
cls := eachClass theNonMetaclass. |
1526 |
(already includes:cls) ifFalse:[ |
|
1527 |
aBlock value:cls. |
|
1528 |
already add:cls. |
|
1529 |
]. |
|
1530 |
cls := cls class. |
|
1531 |
(already includes:cls) ifFalse:[ |
|
1532 |
aBlock value:cls. |
|
1533 |
already add:cls. |
|
1534 |
]. |
|
5579
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1535 |
]. |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1536 |
! |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1537 |
|
453 | 1538 |
allClassesDo:aBlock |
5580
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1539 |
"evaluate the argument, aBlock for all classes in the system." |
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1540 |
|
5765 | 1541 |
self allClasses do:aBlock |
453 | 1542 |
|
1543 |
" |
|
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
1544 |
Smalltalk allClassesDo:[:aClass | aClass name printCR] |
453 | 1545 |
" |
1546 |
! |
|
1547 |
||
1299 | 1548 |
allClassesInCategory:aCategory |
1549 |
"return a collection of for all classes in aCategory; |
|
1550 |
The order of the classes is not defined." |
|
1551 |
||
1552 |
|coll| |
|
1553 |
||
1554 |
coll := OrderedCollection new. |
|
1555 |
self allClassesInCategory:aCategory do:[:aClass | |
|
6853 | 1556 |
coll add:aClass |
1299 | 1557 |
]. |
1558 |
^ coll |
|
1559 |
||
1560 |
" |
|
1561 |
Smalltalk allClassesInCategory:'Views-Basic' |
|
1562 |
" |
|
1563 |
||
1564 |
"Modified: 25.4.1996 / 18:06:13 / cg" |
|
1565 |
! |
|
1566 |
||
453 | 1567 |
allClassesInCategory:aCategory do:aBlock |
1568 |
"evaluate the argument, aBlock for all classes in the aCategory; |
|
1569 |
The order of the classes is not defined." |
|
1570 |
||
1571 |
aCategory notNil ifTrue:[ |
|
6853 | 1572 |
self allClassesDo:[:aClass | |
1573 |
aClass isMeta ifFalse:[ |
|
1574 |
(aClass category = aCategory) ifTrue:[ |
|
1575 |
aBlock value:aClass |
|
1576 |
] |
|
1577 |
] |
|
1578 |
] |
|
453 | 1579 |
] |
1580 |
||
1581 |
" |
|
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
1582 |
Smalltalk allClassesInCategory:'Views-Basic' do:[:aClass | aClass name printCR] |
453 | 1583 |
" |
1584 |
! |
|
1585 |
||
1586 |
allClassesInCategory:aCategory inOrderDo:aBlock |
|
1587 |
"evaluate the argument, aBlock for all classes in aCategory; |
|
1588 |
superclasses come first - then subclasses" |
|
1589 |
||
1590 |
|classes| |
|
1591 |
||
1592 |
aCategory notNil ifTrue:[ |
|
6853 | 1593 |
classes := OrderedCollection new. |
1594 |
self allClassesInCategory:aCategory do:[:aClass | |
|
1595 |
classes add:aClass |
|
1596 |
]. |
|
1597 |
classes topologicalSort:[:a :b | b isSubclassOf:a]. |
|
1598 |
classes do:aBlock |
|
453 | 1599 |
] |
1600 |
||
1601 |
" |
|
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
1602 |
Smalltalk allClassesInCategory:'Views-Basic' inOrderDo:[:aClass | aClass name printCR] |
453 | 1603 |
" |
6217
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1604 |
|
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1605 |
"Modified: / 17.11.2001 / 12:18:15 / cg" |
617 | 1606 |
! |
1607 |
||
5406 | 1608 |
allClassesInOrderDo:aBlock |
1609 |
"evaluate the argument, aBlock for all classes in the system; |
|
1610 |
Evaluation order is by inheritance: superclasses come first." |
|
1611 |
||
1612 |
|already| |
|
1613 |
||
1614 |
already := IdentitySet new. |
|
5580
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1615 |
self allClassesDo:[:aClass | |
6853 | 1616 |
(already includes:aClass) ifFalse:[ |
1617 |
aClass allSuperclasses reverseDo:[:cls | |
|
1618 |
(already includes:aClass) ifFalse:[ |
|
1619 |
already add:cls. |
|
1620 |
aBlock value:cls. |
|
1621 |
]. |
|
1622 |
]. |
|
1623 |
already add:aClass. |
|
1624 |
aBlock value:aClass. |
|
1625 |
] |
|
5406 | 1626 |
]. |
1627 |
||
1628 |
" |
|
1629 |
Smalltalk allClassesInOrderDo:[:aClass | aClass name printCR] |
|
1630 |
" |
|
1631 |
! |
|
1632 |
||
617 | 1633 |
allKeysDo:aBlock |
1634 |
"evaluate the argument, aBlock for all keys in the Smalltalk dictionary" |
|
1635 |
||
1636 |
^ self keysDo:aBlock |
|
1637 |
! |
|
1638 |
||
6722
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
1639 |
allMethodCategories |
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
1640 |
"return a set of all method categories in the system" |
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
1641 |
|
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
1642 |
|allCategories| |
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
1643 |
|
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
1644 |
allCategories := Set new. |
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
1645 |
Smalltalk allClassesDo:[:cls | |
6929 | 1646 |
allCategories addAll:cls categories. |
6722
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
1647 |
]. |
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
1648 |
|
7432 | 1649 |
^ allCategories. |
6722
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
1650 |
|
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
1651 |
" |
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
1652 |
Smalltalk allMethodCategories |
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
1653 |
" |
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
1654 |
! |
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
1655 |
|
617 | 1656 |
associationsDo:aBlock |
1657 |
"evaluate the argument, aBlock for all key/value pairs |
|
1658 |
in the Smalltalk dictionary" |
|
1659 |
||
1660 |
self keysDo:[:aKey | |
|
6853 | 1661 |
aBlock value:(aKey -> (self at:aKey)) |
617 | 1662 |
] |
1663 |
||
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
1664 |
"Smalltalk associationsDo:[:assoc | assoc printCR]" |
617 | 1665 |
! |
1666 |
||
5406 | 1667 |
basicKeys |
1668 |
"for rel > 5 only" |
|
1669 |
||
1670 |
self primitiveFailed |
|
1671 |
||
1672 |
||
1673 |
||
1674 |
||
1675 |
||
1676 |
||
1677 |
! |
|
1678 |
||
617 | 1679 |
do:aBlock |
1680 |
"evaluate the argument, aBlock for all values in the Smalltalk dictionary" |
|
1681 |
||
1682 |
|work| |
|
1683 |
||
1684 |
%{ /* 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
|
1685 |
__GLOBALS_DO(&aBlock, &work); |
5406 | 1686 |
RETURN (self); |
1687 |
%}. |
|
1688 |
self keysDo:[:aKey | |
|
6853 | 1689 |
aBlock value:(self at:aKey) |
5406 | 1690 |
] |
617 | 1691 |
! |
1692 |
||
1693 |
keysAndValuesDo:aBlock |
|
1694 |
"evaluate the two-arg block, aBlock for all keys and values" |
|
1695 |
||
1696 |
self keysDo:[:aKey | |
|
6853 | 1697 |
aBlock value:aKey value:(self at:aKey) |
617 | 1698 |
] |
1699 |
! |
|
1700 |
||
1701 |
keysDo:aBlock |
|
1702 |
"evaluate the argument, aBlock for all keys in the Smalltalk dictionary" |
|
1703 |
|work| |
|
1704 |
||
1705 |
%{ /* 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
|
1706 |
__GLOBALKEYS_DO(&aBlock, &work); |
5406 | 1707 |
RETURN (self); |
1708 |
%}. |
|
1709 |
self basicKeys do:[:aKey | |
|
6853 | 1710 |
aBlock value:aKey |
5406 | 1711 |
] |
453 | 1712 |
! ! |
1713 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1714 |
!Smalltalk class methodsFor:'inspecting'! |
453 | 1715 |
|
1716 |
inspectorClass |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1717 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1718 |
|
453 | 1719 |
"redefined to launch a DictionaryInspector |
1720 |
(instead of the default Inspector)." |
|
1721 |
||
1722 |
^ DictionaryInspectorView |
|
1723 |
! ! |
|
1724 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1725 |
!Smalltalk class methodsFor:'message control'! |
453 | 1726 |
|
1727 |
silentLoading |
|
1728 |
"returns the Silentloading class variable." |
|
1729 |
||
1730 |
^ SilentLoading |
|
1731 |
! |
|
1732 |
||
1733 |
silentLoading:aBoolean |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1734 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1735 |
|
453 | 1736 |
"allows access to the Silentloading class variable, which controls |
1737 |
messages from all kinds of system onto the transcript. |
|
1738 |
You can save a snapshot with this flag set to true, which makes |
|
1739 |
the image come up silent. Can also be set, to read in files unlogged." |
|
1740 |
||
1741 |
|prev| |
|
1742 |
||
1743 |
prev := SilentLoading. |
|
1744 |
SilentLoading := aBoolean. |
|
1745 |
^ prev |
|
1746 |
! ! |
|
1747 |
||
4957 | 1748 |
!Smalltalk class methodsFor:'misc accessing'! |
1749 |
||
1750 |
beHeadless:aBoolean |
|
1751 |
"set/clear the headlessOperation flag." |
|
1752 |
||
1753 |
HeadlessOperation := aBoolean |
|
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
1754 |
! |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
1755 |
|
6564 | 1756 |
standAloneApp:aBoolean |
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
1757 |
"set/clear the StandAlone flag." |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
1758 |
|
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
1759 |
StandAlone := aBoolean |
4957 | 1760 |
! ! |
1761 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1762 |
!Smalltalk class methodsFor:'misc stuff'! |
453 | 1763 |
|
617 | 1764 |
addExitBlock:aBlock |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1765 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1766 |
|
617 | 1767 |
"add a block to be executed when Smalltalk finishes. |
1768 |
This feature is currently not used anywhere - but could be useful for |
|
1769 |
cleanup in stand alone applications." |
|
1770 |
||
1771 |
ExitBlocks isNil ifTrue:[ |
|
6853 | 1772 |
ExitBlocks := OrderedCollection with:aBlock |
617 | 1773 |
] ifFalse:[ |
6853 | 1774 |
ExitBlocks add:aBlock |
617 | 1775 |
] |
1776 |
! |
|
1777 |
||
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1778 |
addImageStartBlock:aBlock |
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1779 |
"{ Pragma: +optSpace }" |
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1780 |
|
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1781 |
"add a blocks to be executed in a separate process after |
2681 | 1782 |
everything has been initialized. |
1783 |
These blocks will be executed after an image restart." |
|
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1784 |
|
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1785 |
ImageStartBlocks isNil ifTrue:[ |
6853 | 1786 |
ImageStartBlocks := OrderedCollection with:aBlock |
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1787 |
] ifFalse:[ |
6853 | 1788 |
ImageStartBlocks add:aBlock |
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1789 |
] |
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1790 |
|
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1791 |
"Created: 9.9.1996 / 16:48:20 / stefan" |
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1792 |
! |
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1793 |
|
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1794 |
addStartBlock:aBlock |
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1795 |
"{ Pragma: +optSpace }" |
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1796 |
|
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1797 |
"add a blocks to be executed in a separate process after |
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1798 |
everything has been initialized. These blocks will |
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1799 |
be deleted after execution and therefore not be |
2681 | 1800 |
executed after an image restart. |
1801 |
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
|
1802 |
|
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1803 |
StartBlocks isNil ifTrue:[ |
6853 | 1804 |
StartBlocks := OrderedCollection with:aBlock |
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1805 |
] ifFalse:[ |
6853 | 1806 |
StartBlocks add:aBlock |
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1807 |
] |
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1808 |
|
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1809 |
"Created: 9.9.1996 / 16:46:53 / stefan" |
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1810 |
! |
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1811 |
|
453 | 1812 |
exit |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1813 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1814 |
|
3976
bfba94385ed0
added #aboutToExit notification
Claus Gittinger <cg@exept.de>
parents:
3971
diff
changeset
|
1815 |
"finish the Smalltalk system" |
bfba94385ed0
added #aboutToExit notification
Claus Gittinger <cg@exept.de>
parents:
3971
diff
changeset
|
1816 |
|
bfba94385ed0
added #aboutToExit notification
Claus Gittinger <cg@exept.de>
parents:
3971
diff
changeset
|
1817 |
ObjectMemory changed:#aboutToExit. "/ for ST/X backward compatibility |
453 | 1818 |
ObjectMemory changed:#aboutToQuit. "/ for ST-80 compatibility |
1819 |
ExitBlocks notNil ifTrue:[ |
|
6853 | 1820 |
ExitBlocks do:[:aBlock | |
1821 |
aBlock value |
|
1822 |
] |
|
453 | 1823 |
]. |
1824 |
OperatingSystem exit |
|
4096
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1825 |
"/ never returns |
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1826 |
|
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1827 |
"Be careful evaluating this |
453 | 1828 |
Smalltalk exit |
1829 |
" |
|
1830 |
! |
|
1831 |
||
1832 |
sleep:aDelay |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1833 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1834 |
|
453 | 1835 |
"wait for aDelay seconds. |
1836 |
OBSOLETE: this is historical leftover and will be removed" |
|
1837 |
||
1838 |
OperatingSystem sleep:aDelay |
|
1839 |
! ! |
|
1840 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1841 |
!Smalltalk class methodsFor:'queries'! |
453 | 1842 |
|
1843 |
allClasses |
|
1844 |
"return an unordered collection of all classes in the system. |
|
1845 |
Only globally anchored classes are returned |
|
1846 |
(i.e. anonymous ones have to be aquired by Behavior allSubInstances)" |
|
1847 |
||
1848 |
|classes| |
|
1849 |
||
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
1850 |
"/ you may wonder, what this while is for, here ... |
453 | 1851 |
"/ the reason is that if we modify the class hierarchy in |
4067 | 1852 |
"/ another view (background fileIn), while building up the |
453 | 1853 |
"/ cachedClasses set, this may be flushed (invalidated) by the |
1854 |
"/ other process in the meanwhile. |
|
1855 |
"/ If that happens, we restart the set-building here |
|
1856 |
"/ |
|
1857 |
[(classes := CachedClasses) isNil] whileTrue:[ |
|
6853 | 1858 |
CachedClasses := classes := IdentitySet new:800. |
1859 |
self keysAndValuesDo:[:sym :anObject | |
|
1860 |
anObject notNil ifTrue:[ |
|
1861 |
anObject isBehavior ifTrue:[ |
|
1862 |
"/ sigh - would like to skip over aliases |
|
1863 |
"/ but this cannot be done simply by comparing |
|
1864 |
"/ the classes name against the store-key |
|
1865 |
"/ i.e. cannot do: |
|
1866 |
"/ anObject name == sym ifTrue:[ |
|
1867 |
"/ classes add:anObject |
|
1868 |
"/ ] |
|
1869 |
"/ because that would lead to ignore all java |
|
1870 |
"/ classes, which are stored under a different |
|
1871 |
"/ key. |
|
1872 |
||
1873 |
(anObject name == sym |
|
1874 |
or:[anObject isJavaClass]) ifTrue:[ |
|
1875 |
classes add:anObject |
|
1876 |
]. |
|
1877 |
] |
|
1878 |
] |
|
1879 |
] |
|
453 | 1880 |
]. |
1881 |
^ classes |
|
1882 |
||
4618
f5a0e70205c9
oops - do not check for classes name = key (java stuff)
Claus Gittinger <cg@exept.de>
parents:
4607
diff
changeset
|
1883 |
"CachedClasses := nil. |
453 | 1884 |
Smalltalk allClasses |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
1885 |
|
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
1886 |
to get the list sorted by name: |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
1887 |
|
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
1888 |
Smalltalk allClasses asSortedCollection:[:a :b | a name < b name] |
453 | 1889 |
" |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
1890 |
|
5278 | 1891 |
"Modified: / 23.2.2000 / 10:49:46 / cg" |
453 | 1892 |
! |
1893 |
||
5579
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1894 |
allClassesAndMetaclasses |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1895 |
"return an unordered collection of all classes with their metaclasses in the system." |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1896 |
|
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1897 |
|classes| |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1898 |
|
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1899 |
classes := IdentitySet new. |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1900 |
self allClassesDo:[:eachClass | |
6853 | 1901 |
classes add:(eachClass theNonMetaclass). |
1902 |
classes add:(eachClass theMetaclass). |
|
5579
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1903 |
]. |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1904 |
^ classes |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1905 |
! |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1906 |
|
4642 | 1907 |
allClassesWithAllPrivateClasses |
1908 |
"return an unordered collection of all classes in the Smalltalk namespace. |
|
1909 |
Only globally anchored classes are returned |
|
1910 |
(i.e. anonymous ones have to be aquired by Behavior allSubInstances)" |
|
1911 |
||
1912 |
^ self allClasses select:[:aClass | |
|
6853 | 1913 |
|owner| |
1914 |
||
1915 |
(aClass isNameSpace not |
|
1916 |
or:[aClass == Smalltalk]) |
|
1917 |
and:[ |
|
1918 |
owner := aClass topOwningClass. |
|
1919 |
(owner ? aClass) nameSpace == Smalltalk |
|
1920 |
] |
|
4642 | 1921 |
] |
1922 |
||
1923 |
" |
|
1924 |
Smalltalk allClassesWithAllPrivateClasses |
|
1925 |
" |
|
1926 |
! |
|
1927 |
||
617 | 1928 |
cellAt:aName |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1929 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1930 |
|
617 | 1931 |
"return the address of a global cell |
1932 |
- used internally for compiler only" |
|
1933 |
||
1934 |
%{ /* NOCONTEXT */ |
|
1935 |
RETURN ( __GLOBAL_GETCELL(aName) ); |
|
5406 | 1936 |
%}. |
5410 | 1937 |
^ self primitiveFailed |
1938 |
||
617 | 1939 |
! |
1940 |
||
6539 | 1941 |
classCategoryCompletion:aPartialCategory |
1942 |
"given a partial class category name, return an array consisting of |
|
1943 |
2 entries: 1st: collection consisting of matching categories |
|
7126 | 1944 |
2nd: the longest match" |
6539 | 1945 |
|
1946 |
|matches best lcName| |
|
1947 |
||
1948 |
matches := IdentitySet new. |
|
1949 |
||
1950 |
"/ search for exact match |
|
1951 |
self allClassesDo:[:aClass | |
|
7126 | 1952 |
|category| |
1953 |
||
1954 |
category := aClass category. |
|
1955 |
(category notNil and:[category startsWith:aPartialCategory]) ifTrue:[ |
|
1956 |
matches add:category |
|
1957 |
] |
|
6539 | 1958 |
]. |
1959 |
matches isEmpty ifTrue:[ |
|
7126 | 1960 |
"/ search for case-ignoring match |
1961 |
lcName := aPartialCategory asLowercase. |
|
1962 |
self allClassesDo:[:aClass | |
|
1963 |
|category| |
|
1964 |
||
1965 |
category := aClass category. |
|
1966 |
(category notNil and:[category asLowercase startsWith:lcName]) ifTrue:[ |
|
1967 |
matches add:category |
|
1968 |
]. |
|
1969 |
]. |
|
6539 | 1970 |
]. |
1971 |
||
1972 |
matches isEmpty ifTrue:[ |
|
7126 | 1973 |
^ Array with:aPartialCategory with:(Array with:aPartialCategory) |
6539 | 1974 |
]. |
1975 |
matches size == 1 ifTrue:[ |
|
7126 | 1976 |
^ Array with:matches first with:(matches asArray) |
6539 | 1977 |
]. |
1978 |
matches := matches asSortedCollection. |
|
1979 |
best := matches longestCommonPrefix. |
|
1980 |
^ Array with:best with:matches asArray |
|
1981 |
||
1982 |
" |
|
1983 |
Smalltalk classCategoryCompletion:'Sys' |
|
1984 |
Smalltalk classCategoryCompletion:'System' |
|
1985 |
Smalltalk classCategoryCompletion:'System-BinaryStorage' |
|
1986 |
" |
|
1987 |
! |
|
1988 |
||
453 | 1989 |
classNamed:aString |
1990 |
"return the class with name aString, or nil if absent. |
|
1480
df0bea6285f8
Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
1991 |
To get to the metaClass, append ' class' to the string." |
453 | 1992 |
|
6863 | 1993 |
|cls sym nonMeta| |
453 | 1994 |
|
1995 |
"be careful, to not invent new symbols ..." |
|
1996 |
sym := aString asSymbolIfInterned. |
|
1997 |
sym notNil ifTrue:[ |
|
6863 | 1998 |
cls := self at:sym ifAbsent:[]. |
1999 |
cls isBehavior ifTrue:[^ cls] |
|
453 | 2000 |
]. |
1480
df0bea6285f8
Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
2001 |
(aString endsWith:' class') ifTrue:[ |
6863 | 2002 |
nonMeta := self classNamed:(aString copyWithoutLast:6). |
2003 |
nonMeta notNil ifTrue:[ |
|
2004 |
^ nonMeta theMetaclass |
|
2005 |
]. |
|
453 | 2006 |
]. |
2007 |
^ nil |
|
2008 |
||
2009 |
" |
|
2010 |
Smalltalk classNamed:'Object' |
|
2011 |
Smalltalk classNamed:'fooBar' |
|
2012 |
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
|
2013 |
Smalltalk classNamed:'Object class' |
453 | 2014 |
Smalltalk classNamed:'Metaclass' |
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2015 |
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
|
2016 |
Smalltalk classNamed:'Array class' |
453 | 2017 |
" |
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2018 |
|
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2019 |
"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
|
2020 |
"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
|
2021 |
"Modified: 19.6.1996 / 14:22:21 / stefan" |
453 | 2022 |
! |
2023 |
||
2024 |
classNames |
|
2025 |
"return a collection of all classNames in the system" |
|
2026 |
||
2027 |
^ self allClasses collect:[:aClass | aClass name] |
|
2028 |
||
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2029 |
" |
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2030 |
Smalltalk classNames |
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2031 |
" |
453 | 2032 |
! |
2033 |
||
2034 |
classnameCompletion:aPartialClassName |
|
2035 |
"given a partial classname, return an array consisting of |
|
2036 |
2 entries: 1st: collection consisting of matching names |
|
6853 | 2037 |
2nd: the best (longest) match" |
6403
2b81e1bc42ea
better classNameCompletion (namespaces)
Claus Gittinger <cg@exept.de>
parents:
6390
diff
changeset
|
2038 |
|
6472
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2039 |
^ self |
6853 | 2040 |
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
|
2041 |
! |
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2042 |
|
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2043 |
classnameCompletion:aPartialClassName inEnvironment:anEnvironment |
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2044 |
"given a partial classname, return an array consisting of |
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2045 |
2 entries: 1st: collection consisting of matching names |
6853 | 2046 |
2nd: the best (longest) match" |
6472
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2047 |
|
6438
9df1edfc0b54
class-name completion (ith namespace-prefix)
Claus Gittinger <cg@exept.de>
parents:
6421
diff
changeset
|
2048 |
|searchName matches ignCaseMatches best isMatchString cls nsPrefix | |
9df1edfc0b54
class-name completion (ith namespace-prefix)
Claus Gittinger <cg@exept.de>
parents:
6421
diff
changeset
|
2049 |
|
9df1edfc0b54
class-name completion (ith namespace-prefix)
Claus Gittinger <cg@exept.de>
parents:
6421
diff
changeset
|
2050 |
aPartialClassName isEmpty ifTrue:[ |
6853 | 2051 |
^ Array with:aPartialClassName with:#() |
6438
9df1edfc0b54
class-name completion (ith namespace-prefix)
Claus Gittinger <cg@exept.de>
parents:
6421
diff
changeset
|
2052 |
]. |
9df1edfc0b54
class-name completion (ith namespace-prefix)
Claus Gittinger <cg@exept.de>
parents:
6421
diff
changeset
|
2053 |
|
9df1edfc0b54
class-name completion (ith namespace-prefix)
Claus Gittinger <cg@exept.de>
parents:
6421
diff
changeset
|
2054 |
(aPartialClassName startsWith:'Smalltalk::') ifTrue:[ |
6853 | 2055 |
nsPrefix := 'Smalltalk::'. |
2056 |
searchName := aPartialClassName copyFrom:'Smalltalk::' size + 1 |
|
6438
9df1edfc0b54
class-name completion (ith namespace-prefix)
Claus Gittinger <cg@exept.de>
parents:
6421
diff
changeset
|
2057 |
] ifFalse:[ |
6853 | 2058 |
nsPrefix := ''. |
2059 |
searchName := aPartialClassName. |
|
2379 | 2060 |
]. |
2061 |
||
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2062 |
(searchName at:1) isLowercase ifTrue:[ |
6853 | 2063 |
searchName := searchName copy asUppercaseFirst |
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2064 |
]. |
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2065 |
|
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2066 |
isMatchString := searchName includesMatchCharacters. |
1451 | 2067 |
matches := OrderedCollection new. |
2523
04db1fd74e0d
try ignoring case in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
2514
diff
changeset
|
2068 |
ignCaseMatches := OrderedCollection new. |
6472
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2069 |
anEnvironment allClassesDo:[:aClass | |
6853 | 2070 |
|className addIt| |
2071 |
||
2072 |
className := aClass name. |
|
2073 |
aClass isMeta ifFalse:[ |
|
1451 | 2074 |
|
6853 | 2075 |
isMatchString ifTrue:[ |
2076 |
addIt := searchName match:className |
|
2077 |
] ifFalse:[ |
|
2078 |
addIt := className startsWith:searchName |
|
2079 |
]. |
|
2080 |
addIt ifTrue:[ |
|
2081 |
matches add:(nsPrefix , aClass name) |
|
2082 |
] ifFalse:[ |
|
2083 |
"/ try ignoring case |
|
2084 |
isMatchString ifTrue:[ |
|
2085 |
addIt := searchName match:className ignoreCase:true |
|
2086 |
] ifFalse:[ |
|
2087 |
addIt := className asLowercase startsWith:searchName asLowercase |
|
2088 |
]. |
|
2089 |
addIt ifTrue:[ |
|
2090 |
ignCaseMatches add:(nsPrefix , aClass name) |
|
2091 |
] |
|
2092 |
] |
|
2093 |
] |
|
453 | 2094 |
]. |
1451 | 2095 |
|
453 | 2096 |
matches isEmpty ifTrue:[ |
6853 | 2097 |
matches := ignCaseMatches |
6403
2b81e1bc42ea
better classNameCompletion (namespaces)
Claus Gittinger <cg@exept.de>
parents:
6390
diff
changeset
|
2098 |
]. |
2523
04db1fd74e0d
try ignoring case in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
2514
diff
changeset
|
2099 |
matches isEmpty ifTrue:[ |
6853 | 2100 |
^ Array with:searchName with:(Array with:searchName) |
453 | 2101 |
]. |
2102 |
matches size == 1 ifTrue:[ |
|
6853 | 2103 |
best := matches first. |
2104 |
^ Array with:best with:(matches asArray) |
|
453 | 2105 |
]. |
1451 | 2106 |
matches := matches asSortedCollection. |
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2107 |
isMatchString ifTrue:[ |
6853 | 2108 |
best := searchName. |
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2109 |
] ifFalse:[ |
6853 | 2110 |
best := matches longestCommonPrefix. |
6403
2b81e1bc42ea
better classNameCompletion (namespaces)
Claus Gittinger <cg@exept.de>
parents:
6390
diff
changeset
|
2111 |
]. |
2b81e1bc42ea
better classNameCompletion (namespaces)
Claus Gittinger <cg@exept.de>
parents:
6390
diff
changeset
|
2112 |
|
6472
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2113 |
cls := anEnvironment classNamed:best. |
6403
2b81e1bc42ea
better classNameCompletion (namespaces)
Claus Gittinger <cg@exept.de>
parents:
6390
diff
changeset
|
2114 |
(cls isBehavior and:[cls isNameSpace]) ifTrue:[ |
6853 | 2115 |
(matches conform:[:each | each = best |
2116 |
or:[each startsWith:(best , '::')]]) |
|
2117 |
ifTrue:[ |
|
2118 |
best := best , '::' |
|
2119 |
]. |
|
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2120 |
]. |
453 | 2121 |
^ Array with:best with:matches asArray |
2122 |
||
2123 |
" |
|
2124 |
Smalltalk classnameCompletion:'Arr' |
|
2125 |
Smalltalk classnameCompletion:'Arra' |
|
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2126 |
Smalltalk classnameCompletion:'arra' |
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2127 |
Smalltalk classnameCompletion:'*rray' |
453 | 2128 |
" |
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2129 |
|
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2130 |
"Created: 24.11.1995 / 17:24:45 / cg" |
2523
04db1fd74e0d
try ignoring case in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
2514
diff
changeset
|
2131 |
"Modified: 3.4.1997 / 18:25:01 / cg" |
453 | 2132 |
! |
2133 |
||
2004
b660837fe0c7
renamed #currentNameSpace to #defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2134 |
defaultNameSpace |
b660837fe0c7
renamed #currentNameSpace to #defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2135 |
"return the default namespace, where new classes are installed, |
b660837fe0c7
renamed #currentNameSpace to #defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2136 |
if NO special nameSpace handler is present" |
b660837fe0c7
renamed #currentNameSpace to #defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2137 |
|
2029
55ddf4c547ab
ask the current project for the defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
2004
diff
changeset
|
2138 |
|p| |
55ddf4c547ab
ask the current project for the defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
2004
diff
changeset
|
2139 |
|
55ddf4c547ab
ask the current project for the defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
2004
diff
changeset
|
2140 |
(Project notNil and:[(p := Project current) notNil]) ifTrue:[ |
6853 | 2141 |
^ p defaultNameSpace |
2029
55ddf4c547ab
ask the current project for the defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
2004
diff
changeset
|
2142 |
]. |
55ddf4c547ab
ask the current project for the defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
2004
diff
changeset
|
2143 |
|
2004
b660837fe0c7
renamed #currentNameSpace to #defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2144 |
^ self |
b660837fe0c7
renamed #currentNameSpace to #defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2145 |
|
b660837fe0c7
renamed #currentNameSpace to #defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2146 |
"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
|
2147 |
"Modified: 2.1.1997 / 20:01:31 / cg" |
2004
b660837fe0c7
renamed #currentNameSpace to #defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2148 |
! |
b660837fe0c7
renamed #currentNameSpace to #defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2149 |
|
5736 | 2150 |
globalnameCompletion:aPartialGlobalName |
2151 |
"given a partial globalName, return an array consisting of |
|
2152 |
2 entries: 1st: collection consisting of matching names |
|
6853 | 2153 |
2nd: the best (longest) match" |
5736 | 2154 |
|
2155 |
|searchName matches ignCaseMatches best isMatchString| |
|
2156 |
||
2157 |
searchName := aPartialGlobalName. |
|
2158 |
searchName isEmpty ifTrue:[ |
|
6853 | 2159 |
^ Array with:searchName with:#() |
5736 | 2160 |
]. |
2161 |
||
2162 |
(searchName at:1) isLowercase ifTrue:[ |
|
6853 | 2163 |
searchName := searchName copy asUppercaseFirst |
5736 | 2164 |
]. |
2165 |
||
2166 |
isMatchString := searchName includesMatchCharacters. |
|
2167 |
matches := OrderedCollection new. |
|
2168 |
ignCaseMatches := OrderedCollection new. |
|
2169 |
self keysDo:[:aGlobalName | |
|
6853 | 2170 |
| addIt| |
2171 |
||
2172 |
isMatchString ifTrue:[ |
|
2173 |
addIt := searchName match:aGlobalName |
|
2174 |
] ifFalse:[ |
|
2175 |
addIt := aGlobalName startsWith:searchName |
|
2176 |
]. |
|
2177 |
addIt ifTrue:[ |
|
2178 |
matches add:aGlobalName |
|
2179 |
] ifFalse:[ |
|
2180 |
"/ try ignoring case |
|
2181 |
isMatchString ifTrue:[ |
|
2182 |
addIt := searchName match:aGlobalName ignoreCase:true |
|
2183 |
] ifFalse:[ |
|
2184 |
addIt := aGlobalName asLowercase startsWith:searchName asLowercase |
|
2185 |
]. |
|
2186 |
addIt ifTrue:[ |
|
2187 |
ignCaseMatches add:aGlobalName |
|
2188 |
] |
|
2189 |
] |
|
5736 | 2190 |
]. |
2191 |
||
2192 |
matches isEmpty ifTrue:[ |
|
6853 | 2193 |
matches := ignCaseMatches |
5736 | 2194 |
]. |
2195 |
||
2196 |
matches isEmpty ifTrue:[ |
|
6853 | 2197 |
^ Array with:searchName with:(Array with:searchName) |
5736 | 2198 |
]. |
2199 |
matches size == 1 ifTrue:[ |
|
6853 | 2200 |
^ Array with:matches first with:(matches asArray) |
5736 | 2201 |
]. |
2202 |
matches := matches asSortedCollection. |
|
2203 |
isMatchString ifTrue:[ |
|
6853 | 2204 |
best := searchName. |
5736 | 2205 |
] ifFalse:[ |
6853 | 2206 |
best := matches longestCommonPrefix. |
5736 | 2207 |
]. |
2208 |
^ Array with:best with:matches asArray |
|
2209 |
||
2210 |
" |
|
2211 |
Smalltalk globalnameCompletion:'Arr' |
|
2212 |
Smalltalk globalnameCompletion:'Arra' |
|
2213 |
Smalltalk globalnameCompletion:'arra' |
|
2214 |
Smalltalk globalnameCompletion:'*rray' |
|
2215 |
" |
|
2216 |
||
2217 |
"Created: 24.11.1995 / 17:24:45 / cg" |
|
2218 |
"Modified: 3.4.1997 / 18:25:01 / cg" |
|
2219 |
! |
|
2220 |
||
6472
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2221 |
hasNamespaces |
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2222 |
"can be redefined by dummy namespaces/environments, to suppress |
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2223 |
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
|
2224 |
|
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2225 |
^ true |
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2226 |
! |
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2227 |
|
617 | 2228 |
includes:something |
2229 |
"this should come from Collection. |
|
2230 |
will change the inheritance - Smalltalk is actually a collection" |
|
2231 |
||
2232 |
self do:[:element | element = something ifTrue:[^ true]]. |
|
2233 |
^ false |
|
2234 |
! |
|
2235 |
||
5327
5e5602d156fa
#isNamespace renamed to #isNameSpace
Claus Gittinger <cg@exept.de>
parents:
5326
diff
changeset
|
2236 |
isNameSpace |
1706 | 2237 |
^ true |
2238 |
||
2239 |
"Created: 11.10.1996 / 18:10:43 / cg" |
|
2240 |
! |
|
2241 |
||
5371
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
2242 |
isTopLevelNameSpace |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
2243 |
^ true |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
2244 |
! |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
2245 |
|
4458 | 2246 |
isTopLevelNamespace |
5365 | 2247 |
"obsolete - use isTopLevelNameSpace" |
2248 |
||
7432 | 2249 |
<resource:#obsolete> |
2250 |
||
4458 | 2251 |
^ true |
2252 |
||
2253 |
"Created: 11.10.1996 / 18:10:43 / cg" |
|
2254 |
! |
|
2255 |
||
5505
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2256 |
methodProtocolCompletion:aPartialProtocolName |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2257 |
"given a partial method protocol name, return an array consisting of |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2258 |
2 entries: 1st: collection consisting of matching protocols |
6853 | 2259 |
2nd: the longest match" |
5505
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2260 |
|
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2261 |
|matches best lcName| |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2262 |
|
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2263 |
matches := IdentitySet new. |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2264 |
|
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2265 |
"/ search for exact match |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2266 |
self allClassesDo:[:aClass | |
6853 | 2267 |
aClass instAndClassSelectorsAndMethodsDo:[:aSelector :aMethod | |
2268 |
|protocol| |
|
2269 |
||
2270 |
protocol := aMethod category. |
|
2271 |
(protocol notNil and:[protocol startsWith:aPartialProtocolName]) ifTrue:[ |
|
2272 |
matches add:protocol |
|
2273 |
] |
|
2274 |
]. |
|
5505
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2275 |
]. |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2276 |
matches isEmpty ifTrue:[ |
6853 | 2277 |
"/ search for case-ignoring match |
2278 |
lcName := aPartialProtocolName asLowercase. |
|
2279 |
self allClassesDo:[:aClass | |
|
2280 |
aClass instAndClassSelectorsAndMethodsDo:[:aSelector :aMethod | |
|
2281 |
|protocol| |
|
2282 |
||
2283 |
protocol := aMethod category. |
|
2284 |
(protocol asLowercase startsWith:lcName) ifTrue:[ |
|
2285 |
matches add:protocol |
|
2286 |
] |
|
2287 |
]. |
|
2288 |
]. |
|
5505
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2289 |
]. |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2290 |
|
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2291 |
matches isEmpty ifTrue:[ |
6853 | 2292 |
^ Array with:aPartialProtocolName with:(Array with:aPartialProtocolName) |
5505
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2293 |
]. |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2294 |
matches size == 1 ifTrue:[ |
6853 | 2295 |
^ Array with:matches first with:(matches asArray) |
5505
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2296 |
]. |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2297 |
matches := matches asSortedCollection. |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2298 |
best := matches longestCommonPrefix. |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2299 |
^ Array with:best with:matches asArray |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2300 |
|
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2301 |
" |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2302 |
Smalltalk methodProtocolCompletion:'doc' |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2303 |
Smalltalk methodProtocolCompletion:'docu' |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2304 |
Smalltalk methodProtocolCompletion:'documenta' |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2305 |
" |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2306 |
! |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2307 |
|
617 | 2308 |
numberOfGlobals |
2309 |
"return the number of global variables in the system" |
|
2310 |
||
2311 |
|tally "{ Class: SmallInteger }" | |
|
2312 |
||
2313 |
tally := 0. |
|
2314 |
self do:[:obj | tally := tally + 1]. |
|
2315 |
^ tally |
|
2316 |
||
2317 |
"Smalltalk numberOfGlobals" |
|
2318 |
! |
|
2319 |
||
3260 | 2320 |
referencesAny:aCollection |
2321 |
"redefined, since the references are only kept in the VM's symbol table" |
|
2322 |
||
2323 |
self keysAndValuesDo:[:key :val | |
|
6853 | 2324 |
aCollection do:[:anObject | |
2325 |
(key == anObject) ifTrue:[^ true]. |
|
2326 |
(val == anObject ) ifTrue:[^ true]. |
|
2327 |
] |
|
3260 | 2328 |
]. |
2329 |
^ super referencesAny:aCollection |
|
2330 |
||
2331 |
"Created: / 2.2.1998 / 16:01:20 / cg" |
|
2332 |
! |
|
2333 |
||
617 | 2334 |
referencesDerivedInstanceOf:aClass |
2335 |
"redefined, since the references are only kept in the VM's symbol table" |
|
2336 |
||
2337 |
self keysAndValuesDo:[:key :val | |
|
6853 | 2338 |
(key isKindOf:aClass) ifTrue:[^ true]. |
2339 |
(val isKindOf:aClass) ifTrue:[^ true]. |
|
617 | 2340 |
]. |
2341 |
^ super referencesDerivedInstanceOf:aClass |
|
2342 |
! |
|
2343 |
||
2344 |
referencesInstanceOf:aClass |
|
2345 |
"redefined, since the references are only kept in the VM's symbol table" |
|
2346 |
||
2347 |
self keysAndValuesDo:[:key :val | |
|
6853 | 2348 |
(key isMemberOf:aClass) ifTrue:[^ true]. |
2349 |
(val isMemberOf:aClass) ifTrue:[^ true]. |
|
617 | 2350 |
]. |
2351 |
^ super referencesInstanceOf:aClass |
|
2352 |
! |
|
2353 |
||
6074
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
2354 |
referencesObject:anObject |
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
2355 |
"redefined, since the references are only kept in the VM's symbol table" |
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
2356 |
|
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
2357 |
self keysAndValuesDo:[:key :val | |
6853 | 2358 |
(key == anObject) ifTrue:[^ true]. |
2359 |
(val == anObject ) ifTrue:[^ true]. |
|
6074
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
2360 |
]. |
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
2361 |
^ super referencesObject:anObject |
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
2362 |
|
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
2363 |
"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
|
2364 |
! |
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
2365 |
|
4354
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
2366 |
resolveName:nameIn inClass:aClass |
3026 | 2367 |
"resolve aName as if compiled within aClass; |
2368 |
i.e. if it has a private class with this name, return it; |
|
2369 |
if aName is known within the classes namespace, return that. |
|
2370 |
Otherwise, return a global with that name. |
|
2371 |
This should be used whereever Smalltalk>>at: used to be used, |
|
2372 |
to resolve a global by name." |
|
2373 |
||
4354
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
2374 |
|aName sym cls ns| |
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
2375 |
|
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
2376 |
nameIn isNil ifTrue:[^ nil]. |
4356 | 2377 |
nameIn isBehavior ifTrue:[^ nameIn]. "/ already resolved |
4354
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
2378 |
aName := nameIn. |
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
2379 |
|
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
2380 |
(aName startsWith:'Smalltalk::') ifTrue:[ |
6853 | 2381 |
aName := aName copyFrom:12. |
2382 |
^ self at:(aName asSymbol) ifAbsent:nil. |
|
4354
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
2383 |
]. |
3026 | 2384 |
|
2385 |
sym := aName asSymbol. |
|
2386 |
||
2387 |
cls := aClass privateClassesAt:sym. |
|
2388 |
cls notNil ifTrue:[^ cls]. |
|
2389 |
||
2390 |
ns := aClass nameSpace. |
|
2391 |
(ns notNil and:[ns ~~ Smalltalk]) ifTrue:[ |
|
6853 | 2392 |
ns isNameSpace ifTrue:[ |
2393 |
cls := ns at:sym ifAbsent:nil. |
|
2394 |
] ifFalse:[ |
|
2395 |
cls := ns privateClassesAt:sym |
|
2396 |
]. |
|
2397 |
cls notNil ifTrue:[^ cls]. |
|
3025 | 2398 |
]. |
3026 | 2399 |
^ self at:sym ifAbsent:nil. |
4356 | 2400 |
|
2401 |
"Modified: / 9.7.1999 / 01:18:07 / cg" |
|
3025 | 2402 |
! |
2403 |
||
453 | 2404 |
selectorCompletion:aPartialSymbolName |
2405 |
"given a partial selector, return an array consisting of |
|
2406 |
2 entries: 1st: collection consisting of matching implemented selectors |
|
6853 | 2407 |
2nd: the longest match" |
3565
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
2408 |
|
6472
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2409 |
^ self |
6853 | 2410 |
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
|
2411 |
! |
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2412 |
|
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2413 |
selectorCompletion:aPartialSymbolName inEnvironment:anEnvironment |
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2414 |
"given a partial selector, return an array consisting of |
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2415 |
2 entries: 1st: collection consisting of matching implemented selectors |
6853 | 2416 |
2nd: the longest match" |
6472
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2417 |
|
3565
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
2418 |
|matches best lcSym| |
453 | 2419 |
|
2420 |
matches := IdentitySet new. |
|
3565
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
2421 |
|
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
2422 |
"/ search for exact match |
6472
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2423 |
anEnvironment allClassesDo:[:aClass | |
6853 | 2424 |
aClass instAndClassSelectorsAndMethodsDo:[:aSelector :aMethod | |
2425 |
(aSelector startsWith:aPartialSymbolName) ifTrue:[ |
|
2426 |
matches add:aSelector |
|
2427 |
] |
|
2428 |
]. |
|
3565
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
2429 |
]. |
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
2430 |
matches isEmpty ifTrue:[ |
6853 | 2431 |
"/ search for case-ignoring match |
2432 |
lcSym := aPartialSymbolName asLowercase. |
|
2433 |
anEnvironment allClassesDo:[:aClass | |
|
2434 |
aClass instAndClassSelectorsAndMethodsDo:[:aSelector :aMethod | |
|
2435 |
(aSelector asLowercase startsWith:lcSym) ifTrue:[ |
|
2436 |
matches add:aSelector |
|
2437 |
] |
|
2438 |
]. |
|
2439 |
]. |
|
3565
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
2440 |
]. |
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
2441 |
|
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
2442 |
matches isEmpty ifTrue:[ |
6853 | 2443 |
^ Array with:aPartialSymbolName with:(Array with:aPartialSymbolName) |
3565
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
2444 |
]. |
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
2445 |
matches size == 1 ifTrue:[ |
6853 | 2446 |
^ Array with:matches first with:(matches asArray) |
453 | 2447 |
]. |
2448 |
matches := matches asSortedCollection. |
|
2449 |
best := matches longestCommonPrefix. |
|
2450 |
^ Array with:best with:matches asArray |
|
2451 |
||
2452 |
" |
|
2453 |
Smalltalk selectorCompletion:'at:p' |
|
2454 |
Smalltalk selectorCompletion:'nextP' |
|
3565
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
2455 |
Smalltalk selectorCompletion:'nextp' |
453 | 2456 |
" |
1461
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1455
diff
changeset
|
2457 |
|
3565
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
2458 |
"Modified: / 7.6.1996 / 08:44:33 / stefan" |
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
2459 |
"Modified: / 14.6.1998 / 15:54:03 / cg" |
453 | 2460 |
! ! |
2461 |
||
4431 | 2462 |
!Smalltalk class methodsFor:'queries-system'! |
2463 |
||
7348 | 2464 |
dialectName |
2465 |
^ 'SmalltalkX' |
|
2466 |
||
2467 |
" |
|
2468 |
Smalltalk dialectName |
|
2469 |
" |
|
2470 |
! |
|
2471 |
||
2472 |
dialectReleaseVersion |
|
2473 |
^ self versionString |
|
2474 |
||
2475 |
" |
|
2476 |
Smalltalk dialectReleaseVersion |
|
2477 |
" |
|
2478 |
! |
|
2479 |
||
4970 | 2480 |
isDolphinSmalltalk |
2481 |
"return false here - this may be useful to write portable |
|
2482 |
applications - add #isDolphinSmalltalk to your dolphin, |
|
2483 |
returning true there." |
|
2484 |
||
2485 |
^ false |
|
2486 |
! |
|
2487 |
||
2488 |
isSmalltalkMT |
|
2489 |
"return false here - this may be useful to write portable |
|
2490 |
applications - add #isSmalltalkMT to your smalltalk-MT, |
|
2491 |
returning true there." |
|
2492 |
||
2493 |
^ false |
|
2494 |
! |
|
2495 |
||
4431 | 2496 |
isSmalltalkV |
2497 |
"return false here - this may be useful to write portable |
|
2498 |
applications - add #isSmalltalkV to your smalltalkV, |
|
2499 |
returning true there." |
|
2500 |
||
2501 |
^ false |
|
2502 |
! |
|
2503 |
||
2504 |
isSmalltalkX |
|
2505 |
"return true here - this may be useful to write portable |
|
2506 |
applications - add #isSmalltalkX to your other smalltalks, |
|
2507 |
returning false there." |
|
2508 |
||
2509 |
^ true |
|
2510 |
! |
|
2511 |
||
2512 |
isSqueak |
|
2513 |
"return false here - this may be useful to write portable |
|
2514 |
applications - add #isSqueak to your squeak, |
|
2515 |
returning true there." |
|
2516 |
||
2517 |
^ false |
|
2518 |
! |
|
2519 |
||
2520 |
isVisualAge |
|
2521 |
"return false here - this may be useful to write portable |
|
2522 |
applications - add #isVisualAge to your visualAge, |
|
2523 |
returning true there." |
|
2524 |
||
2525 |
^ false |
|
2526 |
! |
|
2527 |
||
2528 |
isVisualWorks |
|
2529 |
"return false here - this may be useful to write portable |
|
2530 |
applications - add #isVisualWorks to your visualWorks, |
|
2531 |
returning true there." |
|
2532 |
||
2533 |
^ false |
|
2534 |
! ! |
|
2535 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
2536 |
!Smalltalk class methodsFor:'startup'! |
1 | 2537 |
|
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2538 |
displayInitializationDone |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2539 |
"inform the restart, that the display has been initialized" |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2540 |
|
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2541 |
CallbackSignal raiseRequest. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2542 |
! |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2543 |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2544 |
mainStartup:graphicalMode |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2545 |
"common start/restart action, if there is a Display, initialize it |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2546 |
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
|
2547 |
|
7043
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
2548 |
|process imageName thisIsARestart| |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2549 |
|
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2550 |
imageName := ObjectMemory imageName. |
2249
cdb6c87f0707
send returnFromSnapshot notification later -
Claus Gittinger <cg@exept.de>
parents:
2212
diff
changeset
|
2551 |
thisIsARestart := imageName notNil. |
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 |
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
|
2555 |
" |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2556 |
Display notNil ifTrue:[ |
7039
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2557 |
Display deviceIOTimeoutErrorSignal handlerBlock:[:ex | |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2558 |
SaveEmergencyImage == true ifTrue:[ |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2559 |
'Display [warning]: broken display connection - emergency save in ''crash.img''.' infoPrintCR. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2560 |
ObjectMemory primSnapShotOn:'crash.img'. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2561 |
]. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2562 |
'Display [warning]: broken display connection - exit.' infoPrintCR. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2563 |
Smalltalk exit. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2564 |
]. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2565 |
Display startDispatch. |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2566 |
]. |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2567 |
|
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2568 |
Initializing := false. |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2569 |
|
2074
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
2570 |
"/ 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
|
2571 |
"/ 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
|
2572 |
"/ 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
|
2573 |
"/ 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
|
2574 |
|
7043
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
2575 |
process := [ |
7039
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2576 |
StartBlocks notNil ifTrue:[ |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2577 |
StartBlocks do:[:aBlock| |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2578 |
aBlock value |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2579 |
]. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2580 |
StartBlocks := nil. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2581 |
]. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2582 |
ImageStartBlocks notNil ifTrue:[ |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2583 |
ImageStartBlocks do:[:aBlock| |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2584 |
aBlock value |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2585 |
]. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2586 |
]. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2587 |
StandAlone ifFalse:[ |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2588 |
(SilentLoading == true) ifFalse:[ "i.e. undefined counts as false" |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2589 |
thisIsARestart ifTrue:[ |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2590 |
Transcript cr. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2591 |
Transcript showCR:('Smalltalk restarted from:' |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2592 |
, imageName |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2593 |
, ' (saved ' |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2594 |
, ObjectMemory imageSaveTime printString |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2595 |
, ')' ). |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2596 |
] ifFalse:[ |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2597 |
Transcript showCR:(self hello). |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2598 |
Transcript showCR:(self copyrightString). |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2599 |
Transcript cr. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2600 |
]. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2601 |
Transcript cr. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2602 |
]. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2603 |
|
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2604 |
DemoMode==true ifTrue:[ |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2605 |
Transcript showCR:'*** Restricted use: ***'. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2606 |
Transcript showCR:'*** This program may be used for education only. ***'. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2607 |
Transcript showCR:'*** Please read the files COPYRIGHT and LICENSE ***'. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2608 |
Transcript showCR:'*** for more details. ***'. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2609 |
Transcript cr. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2610 |
]. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2611 |
]. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2612 |
|
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2613 |
thisIsARestart ifTrue:[ |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2614 |
"/ |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2615 |
"/ the final late notification - users can now assume that |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2616 |
"/ views, forms etc. have been recreated. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2617 |
|
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2618 |
ObjectMemory changed:#returnFromSnapshot. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2619 |
] |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2620 |
|
7040 | 2621 |
] newProcess. |
2622 |
||
7043
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
2623 |
process priority:8. |
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
2624 |
process name:'start block handler'. |
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
2625 |
process beGroupLeader. |
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
2626 |
process resume. |
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
2627 |
process := nil. |
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
2628 |
|
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
2629 |
|
2074
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
2630 |
"/ 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
|
2631 |
"/ message. |
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
2632 |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2633 |
(StartupClass notNil and:[StartupSelector notNil]) ifTrue:[ |
7039
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2634 |
" |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2635 |
allow more customization by reading an image specific rc-file |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2636 |
" |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2637 |
thisIsARestart ifTrue:[ |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2638 |
(imageName asFilename hasSuffix:'img') ifTrue:[ |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2639 |
imageName := imageName copyWithoutLast:4 |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2640 |
]. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2641 |
self fileIn:(imageName , '.rc') |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2642 |
]. |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2643 |
|
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2644 |
"/ Display notNil ifTrue:[ |
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2645 |
"/ Display exitOnLastClose:true. |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2646 |
"/ ]. |
2086 | 2647 |
"/ Processor exitWhenNoMoreUserProcesses:true. |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2648 |
|
7043
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
2649 |
process := [ |
7039
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2650 |
StandAlone ifTrue:[ |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2651 |
AbortSignal handle:[:ex | |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2652 |
OperatingSystem exit:1 |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2653 |
] do:[ |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2654 |
StartupClass perform:StartupSelector withArguments:StartupArguments. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2655 |
] |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2656 |
] ifFalse:[ |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2657 |
StartupClass perform:StartupSelector withArguments:StartupArguments. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2658 |
]. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2659 |
|
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2660 |
"/ |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2661 |
"/ non-GUI apps exit after the startup; |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2662 |
"/ assume that GUI apps have created & opened some view ... |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2663 |
"/ |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2664 |
Display isNil ifTrue:[ |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2665 |
Smalltalk exit. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2666 |
]. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2667 |
"/ |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2668 |
"/ GUI apps exit after the last user process has finished |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2669 |
"/ |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2670 |
Display exitOnLastClose:true. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2671 |
Processor exitWhenNoMoreUserProcesses:true. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2672 |
] newProcess. |
7043
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
2673 |
process priority:8. |
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
2674 |
process name:'main'. |
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
2675 |
process beGroupLeader. |
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
2676 |
process resume. |
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
2677 |
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
|
2678 |
]. |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2679 |
|
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2680 |
" |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2681 |
if view-classes exist, start dispatching; |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2682 |
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
|
2683 |
" |
4957 | 2684 |
((Display notNil and:[graphicalMode]) |
7043
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
2685 |
or:[process notNil |
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2686 |
or:[HeadlessOperation]]) ifTrue:[ |
7039
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2687 |
Processor dispatchLoop. |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2688 |
] ifFalse:[ |
7039
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2689 |
StandAlone ifFalse:[ |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2690 |
self readEvalPrint |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2691 |
] |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2692 |
]. |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2693 |
|
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2694 |
"done - the last process finished" |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2695 |
|
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2696 |
self exit |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2697 |
|
3062
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
2698 |
"Created: / 18.7.1996 / 21:07:39 / cg" |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
2699 |
"Modified: / 9.9.1996 / 17:42:50 / stefan" |
3483 | 2700 |
"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
|
2701 |
! |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2702 |
|
453 | 2703 |
readEvalPrint |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
2704 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
2705 |
|
453 | 2706 |
"simple read-eval-print loop for non-graphical Minitalk" |
2707 |
||
2708 |
|text| |
|
2709 |
||
2710 |
'ST- ' print. |
|
2711 |
Stdin skipSeparators. |
|
2712 |
Stdin atEnd ifFalse:[ |
|
6853 | 2713 |
text := Stdin nextChunk. |
2714 |
[text notNil] whileTrue:[ |
|
2715 |
AbortSignal handle:[:ex | |
|
2716 |
'evaluation aborted' printCR |
|
2717 |
] do:[ |
|
2718 |
Compiler isNil ifTrue:[ |
|
2719 |
'No evaluator class available (Compiler == nil)' printCR. |
|
2720 |
^ self |
|
2721 |
]. |
|
2722 |
(Compiler evaluate:text) printCR. |
|
2723 |
]. |
|
2724 |
'ST- ' print. |
|
2725 |
text := Stdin nextChunk |
|
2726 |
]. |
|
453 | 2727 |
]. |
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
2728 |
'' printCR |
453 | 2729 |
! |
2730 |
||
1 | 2731 |
restart |
24 | 2732 |
"startup after an image has been loaded; |
10 | 2733 |
there are three change-notifications made to dependents of ObjectMemory, |
2734 |
which allow a stepwise re-init: #earlyRestart, #restarted and #returnFromSnapshot. |
|
335 | 2735 |
|
3096
881660d6e997
added #earlySystemInitialization change message (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3092
diff
changeset
|
2736 |
#earlySystemInstallation is sent for ST80 compatibility |
881660d6e997
added #earlySystemInitialization change message (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3092
diff
changeset
|
2737 |
|
10 | 2738 |
#earlyRestart is send first, nothing has been setup yet. |
6853 | 2739 |
(should be used to flush all device dependent entries) |
335 | 2740 |
|
10 | 2741 |
#restarted is send right after. |
6853 | 2742 |
(should be used to recreate external resources (fds, bitmaps etc) |
335 | 2743 |
|
10 | 2744 |
#returnFromSnapshot is sent last |
6853 | 2745 |
(should be used to restart processes, reOpen Streams which cannot |
2746 |
be automatically be reopened (i.e. Sockets, Pipes) and so on. |
|
2747 |
(Notice that positionable fileStreams are already reopened and repositioned) |
|
1 | 2748 |
" |
10 | 2749 |
|
4503
99718971ba26
Redirect Transcript to Stderr during restart-initialization.
Stefan Vogel <sv@exept.de>
parents:
4490
diff
changeset
|
2750 |
|deb insp transcript idx| |
1 | 2751 |
|
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2752 |
"/ |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2753 |
"/ when we arrive here, all objects from our previous life |
3971 | 2754 |
"/ 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
|
2755 |
"/ handles, display information etc. |
3971 | 2756 |
"/ also, dynamically loaded modules have not yet been reloaded yet. |
2757 |
"/ and the concrete OS, concrete FileName etc. are still refering to |
|
2758 |
"/ 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
|
2759 |
|
1 | 2760 |
Initializing := true. |
3499 | 2761 |
AbstractOperatingSystem initializeConcreteClass. |
2762 |
||
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2763 |
ImageRestartTime := AbsoluteTime now. |
335 | 2764 |
|
1580
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2765 |
CommandLine := CommandLineArguments copy. |
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2766 |
CommandLineArguments := CommandLineArguments asOrderedCollection. |
6842 | 2767 |
CommandName := CommandLineArguments removeFirst. "/ the command |
1580
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2768 |
|
1582 | 2769 |
idx := CommandLineArguments indexOf:'-q'. |
6881 | 2770 |
idx == 0 ifTrue:[ |
2771 |
idx := CommandLineArguments indexOf:'--silent'. |
|
2772 |
]. |
|
1582 | 2773 |
idx ~~ 0 ifTrue:[ |
6853 | 2774 |
Object infoPrinting:false. |
2775 |
ObjectMemory infoPrinting:false. |
|
2776 |
CommandLineArguments removeAtIndex:idx. |
|
1582 | 2777 |
]. |
2778 |
||
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2779 |
"/ |
3971 | 2780 |
"/ start catching SIGSEGV and SIGBUS |
2781 |
||
2782 |
OperatingSystem enableHardSignalInterrupts. |
|
2783 |
||
2907 | 2784 |
"/ reinit Filename |
2785 |
Filename reinitialize. |
|
2786 |
||
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2787 |
"/ |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2788 |
"/ 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
|
2789 |
|
329 | 2790 |
self flushPathCaches. |
1 | 2791 |
|
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2792 |
"/ |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2793 |
"/ 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
|
2794 |
"/ 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
|
2795 |
|
477
8710aba7876b
oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents:
457
diff
changeset
|
2796 |
self reinitStandardStreams. |
8710aba7876b
oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents:
457
diff
changeset
|
2797 |
|
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2798 |
"/ |
4503
99718971ba26
Redirect Transcript to Stderr during restart-initialization.
Stefan Vogel <sv@exept.de>
parents:
4490
diff
changeset
|
2799 |
"/ redirect Transcript to Stderr during startup |
99718971ba26
Redirect Transcript to Stderr during restart-initialization.
Stefan Vogel <sv@exept.de>
parents:
4490
diff
changeset
|
2800 |
|
99718971ba26
Redirect Transcript to Stderr during restart-initialization.
Stefan Vogel <sv@exept.de>
parents:
4490
diff
changeset
|
2801 |
transcript := Transcript. |
99718971ba26
Redirect Transcript to Stderr during restart-initialization.
Stefan Vogel <sv@exept.de>
parents:
4490
diff
changeset
|
2802 |
Transcript := Stderr. |
99718971ba26
Redirect Transcript to Stderr during restart-initialization.
Stefan Vogel <sv@exept.de>
parents:
4490
diff
changeset
|
2803 |
|
99718971ba26
Redirect Transcript to Stderr during restart-initialization.
Stefan Vogel <sv@exept.de>
parents:
4490
diff
changeset
|
2804 |
"/ |
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2805 |
"/ temporary switch back to dumb interface - |
4503
99718971ba26
Redirect Transcript to Stderr during restart-initialization.
Stefan Vogel <sv@exept.de>
parents:
4490
diff
changeset
|
2806 |
"/ to handle errors while view-stuff is not yet reinitialized |
1 | 2807 |
|
2808 |
insp := Inspector. |
|
2809 |
deb := Debugger. |
|
684
3e0b5a8ec381
invalidate display connection during early startup
Claus Gittinger <cg@exept.de>
parents:
680
diff
changeset
|
2810 |
deb notNil ifTrue:[ |
6853 | 2811 |
deb reinitialize |
684
3e0b5a8ec381
invalidate display connection during early startup
Claus Gittinger <cg@exept.de>
parents:
680
diff
changeset
|
2812 |
]. |
1 | 2813 |
Inspector := MiniInspector. |
2814 |
Debugger := MiniDebugger. |
|
2815 |
||
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2816 |
"/ 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
|
2817 |
"/ 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
|
2818 |
"/ 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
|
2819 |
"/ this code. |
3155
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
2820 |
"/ 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
|
2821 |
"/ ObjectFileLoader; therefore, must reload before doing any notifications. |
335 | 2822 |
|
1100
eebf3ed54b23
reloadAllObjectFiles now called explicit (its too late via ObjMem changed)
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
2823 |
ObjectFileLoader notNil ifTrue:[ |
6853 | 2824 |
ObjectFileLoader reloadAllRememberedObjectFiles. |
1100
eebf3ed54b23
reloadAllObjectFiles now called explicit (its too late via ObjMem changed)
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
2825 |
]. |
eebf3ed54b23
reloadAllObjectFiles now called explicit (its too late via ObjMem changed)
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
2826 |
|
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2827 |
"/ |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2828 |
"/ invalidate all display connections. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2829 |
"/ This is required to avoid trouble if someone accesses |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2830 |
"/ a display during early startup. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2831 |
|
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2832 |
Screen notNil ifTrue:[ |
6853 | 2833 |
Screen allScreens do:[:aDisplay | |
2834 |
aDisplay invalidateConnection |
|
2835 |
]. |
|
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2836 |
]. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2837 |
|
3155
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
2838 |
ObjectMemory changed:#earlySystemInstallation. |
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
2839 |
|
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2840 |
"/ |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2841 |
"/ reinitialize the Processor - restartable processes |
4109 | 2842 |
"/ 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
|
2843 |
"/ |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2844 |
Processor reinitialize. |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2845 |
|
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2846 |
"/ |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2847 |
"/ 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
|
2848 |
"/ (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
|
2849 |
|
3022 | 2850 |
ObjectMemory |
6853 | 2851 |
changed:#earlyRestart; changed:#restarted. |
1 | 2852 |
|
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2853 |
"/ |
3526
78245608c0b8
no need for last change (restarting processes).
Claus Gittinger <cg@exept.de>
parents:
3523
diff
changeset
|
2854 |
"/ start catching SIGINT and SIGQUIT |
78245608c0b8
no need for last change (restarting processes).
Claus Gittinger <cg@exept.de>
parents:
3523
diff
changeset
|
2855 |
|
78245608c0b8
no need for last change (restarting processes).
Claus Gittinger <cg@exept.de>
parents:
3523
diff
changeset
|
2856 |
OperatingSystem enableUserInterrupts. |
6390
41d5c47c33f0
Catch sigPWR and sigHUP on restart
Stefan Vogel <sv@exept.de>
parents:
6366
diff
changeset
|
2857 |
OperatingSystem enableCrashSignalInterrupts. |
3526
78245608c0b8
no need for last change (restarting processes).
Claus Gittinger <cg@exept.de>
parents:
3523
diff
changeset
|
2858 |
|
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2859 |
"/ 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
|
2860 |
"/ 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
|
2861 |
"/ -fastStart argument. |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2862 |
|
6881 | 2863 |
idx := CommandLineArguments indexOf:'--faststart'. |
1580
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2864 |
idx ~~ 0 ifTrue:[ |
6853 | 2865 |
CommandLineArguments removeAtIndex:idx. |
1580
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2866 |
] ifFalse:[ |
6853 | 2867 |
CallbackSignal := QuerySignal new. |
2868 |
[ |
|
2869 |
Class withoutUpdatingChangesDo:[ |
|
2870 |
(self fileIn:(self commandName , '_r.rc')) ifFalse:[ |
|
2871 |
"no _r.rc file where executable is; try default smalltalk_r.rc" |
|
2872 |
self fileIn:'smalltalk_r.rc' |
|
2873 |
]. |
|
2874 |
] |
|
2875 |
] on:CallbackSignal do:[:ex| |
|
2876 |
"/ now, display and view-stuff works; |
|
2877 |
"/ back to the previous debugging interface |
|
2878 |
||
2879 |
Inspector := insp. |
|
2880 |
Debugger := deb. |
|
2881 |
||
2882 |
"/ reinstall Transcript, if not changed during restart. |
|
2883 |
"/ if there was no Transcript, go to stderr |
|
2884 |
||
2885 |
(transcript notNil and:[Transcript == Stderr]) ifTrue:[ |
|
2886 |
Transcript := transcript. |
|
2887 |
]. |
|
2888 |
Initializing := false. |
|
2889 |
ex proceed. |
|
2890 |
]. |
|
2891 |
CallbackSignal := nil. |
|
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2892 |
]. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2893 |
|
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2894 |
"/ reinitialization (restart) of Display is normally performed |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2895 |
"/ 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
|
2896 |
"/ do in now. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2897 |
Initializing ifTrue:[ |
6853 | 2898 |
Display notNil ifTrue:[ |
2899 |
[ |
|
2900 |
Display reinitializeFor:Screen defaultDisplayName. |
|
2901 |
] on:Screen deviceOpenErrorSignal do:[ |
|
2902 |
'Smalltalk [error]: Cannot restart connection to: ' errorPrint. |
|
2903 |
Screen defaultDisplayName errorPrintCR. |
|
6852
7e4ea7876711
more changes for better standAlone operation
Claus Gittinger <cg@exept.de>
parents:
6851
diff
changeset
|
2904 |
OperatingSystem exit:1. |
6853 | 2905 |
]. |
2906 |
]. |
|
2907 |
"/ now, display and view-stuff works; |
|
2908 |
"/ back to the previous debugging interface |
|
2909 |
||
2910 |
Inspector := insp. |
|
2911 |
Debugger := deb. |
|
2912 |
||
2913 |
"/ reinstall Transcript, if not changed during restart. |
|
2914 |
"/ if there was no Transcript, go to stderr |
|
2915 |
||
2916 |
(transcript notNil and:[Transcript == Stderr]) ifTrue:[ |
|
2917 |
Transcript := transcript. |
|
2918 |
]. |
|
2919 |
Initializing := false. |
|
7 | 2920 |
]. |
2921 |
||
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2922 |
self mainStartup:true |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2923 |
|
3526
78245608c0b8
no need for last change (restarting processes).
Claus Gittinger <cg@exept.de>
parents:
3523
diff
changeset
|
2924 |
"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
|
2925 |
"Modified: / 3.8.1999 / 09:42:21 / stefan" |
1 | 2926 |
! |
2927 |
||
617 | 2928 |
start |
2929 |
"main startup, if there is a Display, initialize it |
|
2930 |
and start dispatching; otherwise go into a read-eval-print loop." |
|
2931 |
||
6852
7e4ea7876711
more changes for better standAlone operation
Claus Gittinger <cg@exept.de>
parents:
6851
diff
changeset
|
2932 |
|idx graphicalMode arg didReadRCFile| |
960
e3b75f50d0cd
changes for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
2933 |
|
e3b75f50d0cd
changes for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
2934 |
graphicalMode := true. |
617 | 2935 |
Initializing := true. |
2936 |
||
2937 |
" |
|
2938 |
while reading patches- and rc-file, do not add things into change-file |
|
2939 |
" |
|
2940 |
Class withoutUpdatingChangesDo:[ |
|
7275 | 2941 |
|myName defaultRC prevCatchSetting| |
2942 |
||
2943 |
"/ |
|
2944 |
"/ look for any '-q', '-e' or '-f' command line arguments |
|
2945 |
"/ and handle them; |
|
2946 |
"/ read startup and patches file |
|
2947 |
"/ |
|
2948 |
idx := CommandLineArguments indexOf:'-q'. |
|
6881 | 2949 |
idx == 0 ifTrue:[ |
2950 |
idx := CommandLineArguments indexOf:'--silent'. |
|
2951 |
]. |
|
7275 | 2952 |
idx ~~ 0 ifTrue:[ |
2953 |
Object infoPrinting:false. |
|
2954 |
ObjectMemory infoPrinting:false. |
|
2955 |
CommandLineArguments removeAtIndex:idx. |
|
2956 |
]. |
|
2957 |
||
2958 |
StandAlone ifFalse:[ |
|
2959 |
"/ look for a '-e filename' argument - this will force evaluation of |
|
2960 |
"/ filename only, no standard startup |
|
2961 |
||
2962 |
idx := CommandLineArguments indexOf:'-e'. |
|
6881 | 2963 |
idx == 0 ifTrue:[ |
2964 |
idx := CommandLineArguments indexOf:'--execute'. |
|
2965 |
]. |
|
7275 | 2966 |
idx ~~ 0 ifTrue:[ |
2967 |
arg := CommandLineArguments at:idx + 1. |
|
2968 |
||
2969 |
CommandLineArguments |
|
2970 |
removeAtIndex:idx+1; removeAtIndex:idx. |
|
2971 |
||
2972 |
arg = '-' ifTrue:[ |
|
2973 |
self fileInStream:Stdin |
|
2974 |
lazy:nil |
|
2975 |
silent:nil |
|
2976 |
logged:false |
|
2977 |
addPath:nil |
|
2978 |
] ifFalse:[ |
|
2979 |
self fileIn:arg. |
|
2980 |
]. |
|
2981 |
self exit |
|
2982 |
]. |
|
2983 |
]. |
|
2984 |
||
2985 |
"/ look for a '-f filename' argument - this will force evaluation of |
|
2986 |
"/ filename instead of smalltalk.rc |
|
2987 |
||
2988 |
idx := CommandLineArguments indexOf:'-f'. |
|
6881 | 2989 |
idx == 0 ifTrue:[ |
2990 |
idx := CommandLineArguments indexOf:'--file'. |
|
2991 |
]. |
|
7275 | 2992 |
idx ~~ 0 ifTrue:[ |
2993 |
myName := (CommandLineArguments at:idx + 1). |
|
2994 |
CommandLineArguments |
|
2995 |
removeAtIndex:idx+1; removeAtIndex:idx. |
|
2996 |
CommandLine at:1 put:myName. |
|
2997 |
(self secureFileIn:myName) ifFalse:[ |
|
2998 |
('Smalltalk [error]: startup file ', myName, ' not found.') errorPrintCR. |
|
2999 |
OperatingSystem exit:1. |
|
3000 |
]. |
|
3001 |
] ifFalse:[ |
|
3002 |
"/ look for <command>.rc |
|
3003 |
"/ if not found, read smalltalk.rc (or stxapp.rc for standAlone operation) |
|
3004 |
||
3005 |
didReadRCFile := false. |
|
3006 |
||
3007 |
myName := self commandName asFilename withSuffix:'rc'. |
|
3008 |
(didReadRCFile := self secureFileIn:myName) ifFalse:[ |
|
3009 |
StandAlone ifFalse:[ |
|
3010 |
defaultRC := 'smalltalk.rc' |
|
3011 |
] ifTrue:[ |
|
3012 |
defaultRC := 'stxapp.rc' |
|
3013 |
]. |
|
3014 |
||
3015 |
didReadRCFile := self secureFileIn:defaultRC. |
|
3016 |
didReadRCFile ifFalse:[ |
|
3017 |
StandAlone ifFalse:[ |
|
3018 |
'Smalltalk [warning]: no startup rc-file found. Going into line-by-line interpreter.' infoPrintCR. |
|
3019 |
graphicalMode := false. |
|
3020 |
] |
|
3021 |
] |
|
3022 |
]. |
|
3023 |
||
3024 |
"/ ('StandAlone is %1' bindWith:StandAlone) printCR. |
|
3025 |
"/ ('Headless is %1' bindWith:HeadlessOperation) printCR. |
|
3026 |
"/ ('Display is %1' bindWith:Display) printCR. |
|
3027 |
"/ ('Screen is %1' bindWith:Screen) printCR. |
|
3028 |
||
3029 |
didReadRCFile ifFalse:[ |
|
3030 |
StandAlone ifFalse:[ |
|
3031 |
"/ its a smalltalk - proceed in interpreter. |
|
3032 |
'Smalltalk [warning]: no startup rc-file found. Going into line-by-line interpreter.' infoPrintCR. |
|
3033 |
graphicalMode := false. |
|
3034 |
] ifTrue:[ |
|
3035 |
"/ its an application - try harder |
|
3036 |
||
3037 |
Screen notNil ifTrue:[ |
|
3038 |
[ |
|
3039 |
Screen openDefaultDisplay:nil. |
|
3040 |
] on:Screen deviceOpenErrorSignal do:[:ex| |
|
3041 |
('Smalltalk [error]: No Display connection to: ', ex parameter printString) errorPrintCR. |
|
3042 |
'Smalltalk [info]: Either set the DISPLAY environment variable,' infoPrintCR. |
|
3043 |
'Smalltalk [info]: or start smalltalk with a -display argument.' infoPrintCR. |
|
3044 |
HeadlessOperation == true ifFalse:[ |
|
3045 |
OperatingSystem exit:1. |
|
3046 |
]. |
|
3047 |
]. |
|
3048 |
||
3049 |
Display notNil ifTrue:[ |
|
3050 |
(self secureFileIn:'display.rc') ifFalse:[ |
|
3051 |
'Smalltalk [warning]: no display.rc found; screen setting might be wrong.' infoPrintCR. |
|
3052 |
] |
|
3053 |
]. |
|
3054 |
] |
|
3055 |
] |
|
3056 |
]. |
|
3057 |
]. |
|
617 | 3058 |
]. |
3059 |
||
6841
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
3060 |
StandAlone ifFalse:[ |
7275 | 3061 |
" |
3062 |
enable the graphical debugger/inspector |
|
3063 |
(they could have been (re)defined as autoloaded in the patches file) |
|
3064 |
" |
|
3065 |
self initStandardTools. |
|
963
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
3066 |
]. |
617 | 3067 |
|
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3068 |
(Display isNil or:[HeadlessOperation]) ifTrue:[ |
7275 | 3069 |
graphicalMode := false. |
2074
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
3070 |
]. |
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
3071 |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3072 |
self mainStartup:graphicalMode |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3073 |
|
5146 | 3074 |
"Modified: / 24.12.1999 / 00:26:54 / cg" |
1097 | 3075 |
! ! |
3076 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
3077 |
!Smalltalk class methodsFor:'startup queries'! |
1097 | 3078 |
|
1580
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
3079 |
commandLine |
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
3080 |
"return the full command line arguments (with which ST/X was started)" |
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
3081 |
|
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
3082 |
^ CommandLine |
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
3083 |
|
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
3084 |
"Created: 19.7.1996 / 11:09:06 / cg" |
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
3085 |
! |
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
3086 |
|
6806 | 3087 |
commandLineArgumentNamed:aString |
6842 | 3088 |
"extract a named argument from the command line arguments." |
6806 | 3089 |
|
3090 |
|args index| |
|
3091 |
||
3092 |
args := self commandLineArguments. |
|
3093 |
index := args indexOf:aString. |
|
3094 |
(index between:1 and:(args size - 1)) ifTrue:[ |
|
6853 | 3095 |
^ args at:index+1 |
6806 | 3096 |
]. |
3097 |
^ nil. |
|
3098 |
||
3099 |
" |
|
3100 |
self commandLineArgumentNamed:'-display' |
|
3101 |
" |
|
3102 |
! |
|
3103 |
||
1097 | 3104 |
commandLineArguments |
1580
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
3105 |
"return the user command line arguments; |
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
3106 |
This is a collection of strings (separated command line words), |
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
3107 |
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
|
3108 |
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
|
3109 |
the commandLineArguments will be #('foo' 'bar' 'baz'). |
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
3110 |
In contrast, the value returned by #commandLine will be the full set of words." |
1097 | 3111 |
|
3112 |
^ CommandLineArguments |
|
1580
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
3113 |
|
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
3114 |
"Modified: 19.7.1996 / 11:11:03 / cg" |
1097 | 3115 |
! |
3116 |
||
3117 |
commandName |
|
3118 |
"return the excutables name - this is normally 'smalltalk', but |
|
1580
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
3119 |
can be something else for standAlone apps." |
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
3120 |
|
6842 | 3121 |
^ CommandName. |
1580
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
3122 |
|
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
3123 |
"Modified: 19.7.1996 / 11:11:16 / cg" |
1097 | 3124 |
! |
3125 |
||
4957 | 3126 |
isHeadless |
3127 |
"return true, if this is a headless application |
|
3128 |
i.e. no default Display connection is required/used" |
|
3129 |
||
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3130 |
^ HeadlessOperation |
4957 | 3131 |
! |
3132 |
||
1097 | 3133 |
isStandAloneApp |
3134 |
"return true, if this is a standAlone application |
|
3135 |
(in contrast to a full smalltalk system)." |
|
3136 |
||
3137 |
^ StandAlone |
|
617 | 3138 |
! |
3139 |
||
3140 |
startupArguments |
|
3141 |
"return the arguments passed to StartupClass" |
|
3142 |
||
3143 |
^ StartupArguments |
|
70 | 3144 |
! |
3145 |
||
3146 |
startupClass |
|
3147 |
"return the class, that will get the start message when smalltalk |
|
3148 |
starts and its non-nil. Usually this is nil, but saving an image |
|
3149 |
with a non-nil StartupClass allows stand-alone applications" |
|
3150 |
||
3151 |
^ StartupClass |
|
3152 |
! |
|
3153 |
||
617 | 3154 |
startupClass:aClass selector:aSymbol arguments:anArrayOrNil |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
3155 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
3156 |
|
617 | 3157 |
"set the class, selector and arguments to be performed when smalltalk |
3158 |
starts. Setting those before saving a snapshot, will make the saved |
|
3159 |
image come up executing your application (instead of the normal mainloop)" |
|
3160 |
||
3161 |
StartupClass := aClass. |
|
3162 |
StartupSelector := aSymbol. |
|
3163 |
StartupArguments := anArrayOrNil |
|
3164 |
! |
|
3165 |
||
70 | 3166 |
startupSelector |
3167 |
"return the selector, that will be sent to StartupClass" |
|
3168 |
||
3169 |
^ StartupSelector |
|
3170 |
! ! |
|
3171 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
3172 |
!Smalltalk class methodsFor:'system environment'! |
1069 | 3173 |
|
3174 |
language |
|
3175 |
"return the language setting" |
|
3176 |
||
3177 |
^ Language |
|
1307 | 3178 |
|
3179 |
" |
|
3180 |
Smalltalk language |
|
3181 |
" |
|
3182 |
||
3183 |
"Modified: 26.4.1996 / 17:10:05 / cg" |
|
3184 |
! |
|
3185 |
||
3186 |
language:aLanguageSymbol |
|
3187 |
"set the language" |
|
3188 |
||
3189 |
Language := aLanguageSymbol. |
|
3190 |
self changed:#Language |
|
3191 |
||
3192 |
" |
|
3193 |
Smalltalk language:#de |
|
3194 |
" |
|
3195 |
||
3196 |
"Modified: 26.4.1996 / 17:13:34 / cg" |
|
1069 | 3197 |
! |
3198 |
||
3199 |
languageTerritory |
|
3200 |
"return the language territory setting" |
|
3201 |
||
3202 |
^ LanguageTerritory |
|
1307 | 3203 |
! |
3204 |
||
3205 |
languageTerritory:aTerritorySymbol |
|
3206 |
"set the language territory" |
|
3207 |
||
3208 |
LanguageTerritory := aTerritorySymbol. |
|
3209 |
self changed:#LanguageTerritory |
|
3210 |
||
3211 |
" |
|
3212 |
Time now |
|
3213 |
||
3214 |
Smalltalk languageTerritory:#us. |
|
3215 |
Time now |
|
3216 |
||
3217 |
Smalltalk languageTerritory:#de. |
|
3218 |
Time now |
|
3219 |
" |
|
3220 |
||
3221 |
"Modified: 26.4.1996 / 17:12:39 / cg" |
|
1069 | 3222 |
! ! |
3223 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
3224 |
!Smalltalk class methodsFor:'system management'! |
70 | 3225 |
|
617 | 3226 |
compressSources |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
3227 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
3228 |
|
617 | 3229 |
"compress the sources file, and remove all method source strings |
3230 |
from the system and replace them by refs to a string in the source file. |
|
3231 |
This is a bit different in ST/X than in other smalltalks, |
|
3232 |
since we use per-class sourcefiles for the compiled classes, |
|
3233 |
and a mix of in-memory strings and one-for-all sourceFile for |
|
3234 |
incremental compiled methods. |
|
3235 |
Therefore, only those sources which are not coming from compiled |
|
3236 |
methods are put into the 'st.src' file - all others are untouched. |
|
3237 |
This is being automated - so dont care for now." |
|
3238 |
||
7105
44c02807ca41
More openErrorSignal change preparations
Stefan Vogel <sv@exept.de>
parents:
7085
diff
changeset
|
3239 |
|newStream table source pos fileName| |
44c02807ca41
More openErrorSignal change preparations
Stefan Vogel <sv@exept.de>
parents:
7085
diff
changeset
|
3240 |
|
617 | 3241 |
" |
3242 |
first, find all methods which contain either a string-ref |
|
3243 |
or an external string in the 'st.src' file |
|
3244 |
" |
|
3245 |
newStream := 'src.tmp' asFilename writeStream. |
|
7105
44c02807ca41
More openErrorSignal change preparations
Stefan Vogel <sv@exept.de>
parents:
7085
diff
changeset
|
3246 |
newStream checkNilFileStream. |
617 | 3247 |
|
3248 |
table := IdentityDictionary new:100. |
|
3249 |
||
3250 |
Method allSubInstancesDo:[:aMethod | |
|
7054
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3251 |
source := nil. |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3252 |
aMethod sourcePosition notNil ifTrue:[ |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3253 |
aMethod sourceFilename = 'st.src' ifTrue:[ |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3254 |
source := aMethod source. |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3255 |
] |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3256 |
] ifFalse:[ |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3257 |
source := aMethod source |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3258 |
]. |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3259 |
|
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3260 |
source notNil ifTrue:[ |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3261 |
pos := newStream position1Based. |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3262 |
newStream nextChunkPut:source. |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3263 |
|
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3264 |
" |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3265 |
dont change the methods info - maybe some write error |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3266 |
occurs later, in that case we abort and leave everything |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3267 |
untouched. |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3268 |
" |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3269 |
table at:aMethod put:pos |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3270 |
] |
617 | 3271 |
]. |
3272 |
||
3273 |
newStream close. |
|
3274 |
||
3275 |
" |
|
3276 |
now, rename the new source file, |
|
3277 |
" |
|
3278 |
fileName := (ObjectMemory nameForSources). |
|
1693 | 3279 |
'src.tmp' asFilename renameTo:fileName. |
617 | 3280 |
|
3281 |
"good - now go over all changed methods, and change their |
|
3282 |
source reference" |
|
3283 |
||
3284 |
table keysAndValuesDo:[:aMethod :pos | |
|
7054
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3285 |
aMethod localSourceFilename:fileName position:pos. |
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
3286 |
"/ aMethod printCR. |
617 | 3287 |
]. |
3288 |
||
3289 |
" |
|
3290 |
Smalltalk compressSources |
|
3291 |
" |
|
1693 | 3292 |
|
2176
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2170
diff
changeset
|
3293 |
"Modified: 16.1.1997 / 01:25:58 / cg" |
617 | 3294 |
! |
3295 |
||
3044 | 3296 |
generateSingleSourceFile |
3297 |
"{ Pragma: +optSpace }" |
|
3298 |
||
3299 |
"generate the sources file, and remove all method source strings |
|
3300 |
from the system and replace them by refs to a string in the source file. |
|
3301 |
This makes the image independent from the per-class source files |
|
3302 |
and makes transportation of endUser applications easier, since |
|
3303 |
only 3 files (executable, image and sourceFile) need to be |
|
3304 |
transported." |
|
3305 |
||
3306 |
|newStream table source pos fileName| |
|
3307 |
||
3308 |
newStream := 'src.tmp' asFilename writeStream. |
|
7105
44c02807ca41
More openErrorSignal change preparations
Stefan Vogel <sv@exept.de>
parents:
7085
diff
changeset
|
3309 |
newStream checkNilFileStream. |
3044 | 3310 |
|
3311 |
table := IdentityDictionary new:100. |
|
3312 |
||
3313 |
Method allSubInstancesDo:[:aMethod | |
|
7054
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3314 |
source := aMethod source. |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3315 |
source notNil ifTrue:[ |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3316 |
pos := newStream position1Based. |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3317 |
newStream nextChunkPut:source. |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3318 |
|
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3319 |
" |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3320 |
dont change the methods info - maybe some write error |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3321 |
occurs later, in that case we abort and leave everything |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3322 |
untouched. |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3323 |
" |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3324 |
table at:aMethod put:pos |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3325 |
] |
3044 | 3326 |
]. |
3327 |
||
3328 |
newStream close. |
|
3329 |
||
3330 |
" |
|
3331 |
now, rename the new source file, |
|
3332 |
" |
|
3333 |
fileName := (ObjectMemory nameForSources). |
|
3334 |
'src.tmp' asFilename renameTo:fileName. |
|
3335 |
||
3336 |
"good - now go over all changed methods, and change their |
|
3337 |
source reference" |
|
3338 |
||
3339 |
table keysAndValuesDo:[:aMethod :pos | |
|
7054
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3340 |
aMethod localSourceFilename:fileName position:pos. |
3044 | 3341 |
"/ aMethod printCR. |
3342 |
]. |
|
3343 |
||
3344 |
" |
|
3345 |
Smalltalk generateSingleSourceFile |
|
3346 |
" |
|
3347 |
||
3348 |
"Modified: 16.1.1997 / 01:25:58 / cg" |
|
3349 |
"Created: 17.10.1997 / 13:00:56 / cg" |
|
3350 |
! |
|
3351 |
||
3915
e32e63ee0d79
extracted autoload-class generation into extra method
Claus Gittinger <cg@exept.de>
parents:
3866
diff
changeset
|
3352 |
installAutoloadedClassNamed:clsName category:cat package:package revision:revisionOrNil |
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3353 |
"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
|
3354 |
to be loaded from package. |
e32e63ee0d79
extracted autoload-class generation into extra method
Claus Gittinger <cg@exept.de>
parents:
3866
diff
changeset
|
3355 |
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
|
3356 |
(otherwise, the newest revision will be loaded" |
e32e63ee0d79
extracted autoload-class generation into extra method
Claus Gittinger <cg@exept.de>
parents:
3866
diff
changeset
|
3357 |
|
e32e63ee0d79
extracted autoload-class generation into extra method
Claus Gittinger <cg@exept.de>
parents:
3866
diff
changeset
|
3358 |
|clsSym cls| |
e32e63ee0d79
extracted autoload-class generation into extra method
Claus Gittinger <cg@exept.de>
parents:
3866
diff
changeset
|
3359 |
|
e32e63ee0d79
extracted autoload-class generation into extra method
Claus Gittinger <cg@exept.de>
parents:
3866
diff
changeset
|
3360 |
clsSym := clsName asSymbol. |
e32e63ee0d79
extracted autoload-class generation into extra method
Claus Gittinger <cg@exept.de>
parents:
3866
diff
changeset
|
3361 |
|
e32e63ee0d79
extracted autoload-class generation into extra method
Claus Gittinger <cg@exept.de>
parents:
3866
diff
changeset
|
3362 |
"/ install if not already compiled-in |
5716 | 3363 |
(cls := self at:clsSym) isNil ifTrue:[ |
7248 | 3364 |
Autoload subclass:clsSym |
3365 |
instanceVariableNames:'' |
|
3366 |
classVariableNames:'' |
|
3367 |
poolDictionaries:'' |
|
3368 |
category:cat |
|
3369 |
inEnvironment:Smalltalk. |
|
3370 |
||
3371 |
cls := self at:clsSym. |
|
3372 |
cls isNil ifTrue:[ |
|
3373 |
('Smalltalk [warning]: failed to install ' , clsName , ' as autoloaded.') infoPrintCR. |
|
3374 |
] ifFalse:[ |
|
3375 |
cls package:package asSymbol. |
|
3376 |
revisionOrNil notNil ifTrue:[ |
|
3377 |
cls setBinaryRevision:revisionOrNil |
|
3378 |
] |
|
3379 |
] |
|
5716 | 3380 |
] ifFalse:[ |
7248 | 3381 |
"/ class already present - however, check for category/package change |
3382 |
package ~= cls package ifTrue:[ |
|
3383 |
cls package:package asSymbol. |
|
3384 |
]. |
|
3385 |
cat ~= cls category ifTrue:[ |
|
3386 |
cls category:cat. |
|
7249 | 3387 |
Smalltalk changed:#organization. |
7248 | 3388 |
]. |
5716 | 3389 |
]. |
3915
e32e63ee0d79
extracted autoload-class generation into extra method
Claus Gittinger <cg@exept.de>
parents:
3866
diff
changeset
|
3390 |
|
e32e63ee0d79
extracted autoload-class generation into extra method
Claus Gittinger <cg@exept.de>
parents:
3866
diff
changeset
|
3391 |
"Created: / 5.11.1998 / 15:10:25 / cg" |
e32e63ee0d79
extracted autoload-class generation into extra method
Claus Gittinger <cg@exept.de>
parents:
3866
diff
changeset
|
3392 |
! |
e32e63ee0d79
extracted autoload-class generation into extra method
Claus Gittinger <cg@exept.de>
parents:
3866
diff
changeset
|
3393 |
|
3044 | 3394 |
installAutoloadedClasses |
3395 |
"read the standard abbreviation file; install all classes found there as |
|
3396 |
autoloaded. This takes some time ..." |
|
3397 |
||
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3398 |
|dirsConsulted p| |
4458 | 3399 |
|
3400 |
"/ new scheme: look for a directory called 'packages' |
|
3401 |
"/ and enumerate its abbrev.stc files... |
|
5067
335c866e150c
walk packagePath when reading abbrevs & autoloaded classes.
Claus Gittinger <cg@exept.de>
parents:
5065
diff
changeset
|
3402 |
dirsConsulted := Set new. |
5162 | 3403 |
|
3404 |
"/ no longer - only consult the packagePath ... |
|
3405 |
"/ f := Smalltalk getSystemFileName:'packages'. |
|
3406 |
"/ f notNil ifTrue:[ |
|
3407 |
"/ f := f asFilename. |
|
3408 |
"/ f isDirectory ifTrue:[ |
|
3409 |
"/ ('Smalltalk [info]: installing autoloaded classes found under ''' , f pathName ,'''') infoPrintCR. |
|
3410 |
"/ self |
|
3411 |
"/ recursiveInstallAutoloadedClassesFrom:f |
|
3412 |
"/ rememberIn:dirsConsulted |
|
7286 | 3413 |
"/ maxLevels:15 |
5162 | 3414 |
"/ noAutoload:false |
3415 |
"/ packageTop:f. |
|
3416 |
"/ ]. |
|
3417 |
"/ ]. |
|
3418 |
||
3419 |
"/ along the package-path |
|
5788 | 3420 |
(p := self packagePath) do:[:aPath | |
7286 | 3421 |
(dirsConsulted includes:aPath) ifFalse:[ |
3422 |
('Smalltalk [info]: installing autoloaded classes found under ''' , aPath ,'''') infoPrintCR. |
|
3423 |
self |
|
3424 |
recursiveInstallAutoloadedClassesFrom:aPath |
|
3425 |
rememberIn:dirsConsulted |
|
3426 |
maxLevels:15 |
|
3427 |
noAutoload:false |
|
3428 |
packageTop:aPath. |
|
3429 |
] |
|
5788 | 3430 |
]. |
3431 |
p size == 0 ifTrue:[ |
|
7286 | 3432 |
('Smalltalk [info]: installing autoloaded classes found under ''../../..''') infoPrintCR. |
3433 |
self |
|
3434 |
recursiveInstallAutoloadedClassesFrom:'../../..' |
|
3435 |
rememberIn:dirsConsulted |
|
3436 |
maxLevels:15 |
|
3437 |
noAutoload:false |
|
3438 |
packageTop:'../../..'. |
|
5788 | 3439 |
]. |
3440 |
||
4458 | 3441 |
"/ old scheme: look for a single file called 'abbrev.stc' in the |
3442 |
"/ include directory. This will vanish. |
|
3443 |
||
5096 | 3444 |
"/ ('Smalltalk [info]: installing autoloaded classes from ''include/abbrev.stc''') infoPrintCR. |
3445 |
"/ self installAutoloadedClassesFrom:'include/abbrev.stc' |
|
3044 | 3446 |
|
3447 |
" |
|
3448 |
Smalltalk installAutoloadedClasses |
|
3449 |
" |
|
3450 |
||
5096 | 3451 |
"Created: / 14.2.1997 / 17:32:57 / cg" |
3452 |
"Modified: / 13.12.1999 / 11:56:50 / cg" |
|
3044 | 3453 |
! |
3454 |
||
3455 |
installAutoloadedClassesFrom:anAbbrevFilePath |
|
3456 |
"read the given abbreviation file; install all classes found there as |
|
3457 |
autoloaded. This takes some time ..." |
|
3458 |
||
4458 | 3459 |
|f s| |
3044 | 3460 |
|
3461 |
f := self getSystemFileName:anAbbrevFilePath. |
|
6714
f4ab666995e0
Search packagePath for autoloaded classes
Stefan Vogel <sv@exept.de>
parents:
6711
diff
changeset
|
3462 |
f isNil ifTrue:[f := self getPackageFileName:anAbbrevFilePath]. |
3044 | 3463 |
|
3464 |
f notNil ifTrue:[ |
|
7085
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3465 |
f := f asFilename. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3466 |
f isDirectory ifTrue:[ |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3467 |
f := f construct:'abbrev.stc' |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3468 |
]. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3469 |
[ |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3470 |
s := f readStream. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3471 |
self installAutoloadedClassesFromStream:s. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3472 |
s close. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3473 |
] on:FileStream openErrorSignal do:[:ex| "do nothing"]. |
3044 | 3474 |
] |
3475 |
||
3476 |
" |
|
3477 |
Smalltalk installAutoloadedClassesFrom:'include/abbrev.stc' |
|
3478 |
" |
|
3479 |
||
3915
e32e63ee0d79
extracted autoload-class generation into extra method
Claus Gittinger <cg@exept.de>
parents:
3866
diff
changeset
|
3480 |
"Modified: / 5.11.1998 / 15:10:51 / cg" |
3044 | 3481 |
! |
3482 |
||
4458 | 3483 |
installAutoloadedClassesFromStream:anAbbrevFileStream |
5112 | 3484 |
"read the given abbreviation file; |
3485 |
install all classes found there as autoloaded, and also update the |
|
3486 |
abbreviation (className-to-fileName mapping) table. |
|
3487 |
This takes some time ..." |
|
4458 | 3488 |
|
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3489 |
|s2 l clsName abbrev package cat cls words w abbrevs oldAbbrev nameKey| |
5109
9da015b8ae46
update abbrevs on the fly when installing autoloaded classes.
Claus Gittinger <cg@exept.de>
parents:
5108
diff
changeset
|
3490 |
|
9da015b8ae46
update abbrevs on the fly when installing autoloaded classes.
Claus Gittinger <cg@exept.de>
parents:
5108
diff
changeset
|
3491 |
"/ on the fly, update the abbreviations |
9da015b8ae46
update abbrevs on the fly when installing autoloaded classes.
Claus Gittinger <cg@exept.de>
parents:
5108
diff
changeset
|
3492 |
CachedAbbreviations isNil ifTrue:[ |
7248 | 3493 |
CachedAbbreviations := IdentityDictionary new. |
5109
9da015b8ae46
update abbrevs on the fly when installing autoloaded classes.
Claus Gittinger <cg@exept.de>
parents:
5108
diff
changeset
|
3494 |
]. |
9da015b8ae46
update abbrevs on the fly when installing autoloaded classes.
Claus Gittinger <cg@exept.de>
parents:
5108
diff
changeset
|
3495 |
abbrevs := CachedAbbreviations. |
4458 | 3496 |
|
5112 | 3497 |
KnownPackages isNil ifTrue:[ |
7248 | 3498 |
KnownPackages := Set new. |
5112 | 3499 |
]. |
3500 |
||
4458 | 3501 |
"/ yes, create any required nameSpace, without asking user. |
3502 |
Class createNameSpaceQuerySignal answer:true do:[ |
|
3503 |
||
7248 | 3504 |
[anAbbrevFileStream atEnd] whileFalse:[ |
3505 |
l := anAbbrevFileStream nextLine withoutSeparators. |
|
3506 |
l notEmpty ifTrue:[ |
|
3507 |
"/ must do it manually, caring for quoted strings. |
|
4685
d145298696b7
more package loading support
Claus Gittinger <cg@exept.de>
parents:
4642
diff
changeset
|
3508 |
"/ words := line asCollectionOfWords. |
d145298696b7
more package loading support
Claus Gittinger <cg@exept.de>
parents:
4642
diff
changeset
|
3509 |
|
7248 | 3510 |
words := OrderedCollection new. |
3511 |
s2 := l readStream. |
|
3512 |
[s2 atEnd] whileFalse:[ |
|
3513 |
s2 skipSeparators. |
|
3514 |
s2 peek == $' ifTrue:[ |
|
3515 |
s2 next. |
|
3516 |
w := s2 upTo:$'. |
|
3517 |
s2 skipSeparators. |
|
3518 |
] ifFalse:[ |
|
3519 |
w := s2 upToSeparator |
|
3520 |
]. |
|
3521 |
words add:w |
|
3522 |
]. |
|
3523 |
words size < 3 ifTrue:[ |
|
3524 |
'Smalltalk [warning]: bad abbrev entry' errorPrint. |
|
3525 |
anAbbrevFileStream isFileStream ifTrue:[ |
|
3526 |
' (in ''' errorPrint. |
|
3527 |
anAbbrevFileStream pathName errorPrint. |
|
3528 |
''')' errorPrint |
|
3529 |
]. |
|
3530 |
': ' errorPrint. l errorPrintCR |
|
3531 |
] ifFalse:[ |
|
3532 |
clsName := (words at:1) asSymbol. |
|
3533 |
abbrev := (words at:2). |
|
3534 |
package := (words at:3) asSymbol. |
|
3535 |
cat := words at:4 ifAbsent:nil. |
|
5117 | 3536 |
"/ KnownPackages add:package. |
5112 | 3537 |
|
7248 | 3538 |
(cat size == 0) ifTrue:[ |
3539 |
cat := 'autoloaded' |
|
3540 |
]. |
|
3541 |
||
3542 |
"/ on the fly, update the abbreviations |
|
3543 |
clsName ~= abbrev ifTrue:[ |
|
3544 |
nameKey := clsName asSymbol. |
|
3545 |
oldAbbrev := abbrevs at:nameKey ifAbsent:nil. |
|
3546 |
(oldAbbrev notNil and:[oldAbbrev ~= abbrev]) ifTrue:[ |
|
3547 |
StandAlone ifFalse:[ |
|
3548 |
('Smalltalk [warning]: conflict for: ' , clsName , ' in ' , (anAbbrevFileStream pathName)) infoPrintCR. |
|
3549 |
('Smalltalk [warning]: (' , oldAbbrev , ' <-> ' , abbrev , ')') infoPrintCR |
|
3550 |
]. |
|
3551 |
abbrevs at:nameKey put:abbrev. |
|
3552 |
] ifFalse:[ |
|
3553 |
cls := self classNamed:abbrev. |
|
3554 |
||
3555 |
cls notNil ifTrue:[ |
|
3556 |
cls name ~= clsName ifTrue:[ |
|
3557 |
"/ ok, there is a class named after this abbrev ... |
|
3558 |
"/ this is only a conflict, if the other class has no |
|
3559 |
"/ abbreviation (or the same). |
|
3560 |
(abbrevs at:(cls name asSymbol) ifAbsent:cls name) = abbrev ifTrue:[ |
|
3561 |
cls isNameSpace ifFalse:[ |
|
3562 |
package = cls package ifTrue:[ |
|
3563 |
StandAlone ifFalse:[ |
|
3564 |
('Smalltalk [warning]: conflict for: ' , cls name , ' in ' , (anAbbrevFileStream pathName)) infoPrintCR. |
|
3565 |
('Smalltalk [warning]: (' , clsName , ' -> ' , abbrev , ')') infoPrintCR |
|
3566 |
] |
|
3567 |
] |
|
3568 |
] |
|
3569 |
] |
|
3570 |
] |
|
3571 |
]. |
|
3572 |
abbrevs at:clsName asSymbol put:abbrev. |
|
3573 |
] |
|
3574 |
]. |
|
3575 |
||
3576 |
"/ ' autoloaded: ' print. clsName print. ' in ' print. cat printCR. |
|
3577 |
||
3578 |
self installAutoloadedClassNamed:clsName category:cat package:package revision:nil. |
|
3579 |
] |
|
3580 |
] |
|
3581 |
] |
|
4458 | 3582 |
] |
3583 |
! |
|
3584 |
||
3044 | 3585 |
loadBinaries |
3586 |
"return true, if binaries should be loaded into the system, |
|
3587 |
false if this should be suppressed. The default is false (for now)." |
|
3588 |
||
3589 |
^ LoadBinaries |
|
3590 |
! |
|
3591 |
||
3592 |
loadBinaries:aBoolean |
|
3593 |
"{ Pragma: +optSpace }" |
|
3594 |
||
3595 |
"turn on/off loading of binary objects" |
|
3596 |
||
3597 |
aBoolean ifTrue:[ |
|
6853 | 3598 |
(ObjectFileLoader notNil and:[ObjectFileLoader canLoadObjectFiles]) ifTrue:[ |
3599 |
LoadBinaries := true. |
|
3600 |
^ self |
|
3601 |
]. |
|
3602 |
'Smalltalk [info]: this system does not support binary loading' infoPrintCR. |
|
617 | 3603 |
]. |
3044 | 3604 |
LoadBinaries := false |
3605 |
||
3606 |
"Modified: 10.1.1997 / 15:11:00 / cg" |
|
3607 |
! |
|
3608 |
||
3609 |
logDoits |
|
3610 |
"return true if doits should go into the changes file |
|
3611 |
as well as changes - by default, this is off, since |
|
3612 |
it can blow up the changes file enormously ... |
|
3613 |
" |
|
3614 |
||
3615 |
^ LogDoits |
|
3616 |
||
3617 |
" |
|
3618 |
LogDoits := false |
|
3619 |
LogDoits := true |
|
3620 |
" |
|
3621 |
! |
|
3622 |
||
3623 |
logDoits:aBoolean |
|
3624 |
"{ Pragma: +optSpace }" |
|
3625 |
||
3626 |
"turn on/off logging of doits in the changes file. |
|
3627 |
By default, this is off, since it can blow up the |
|
3628 |
changes file enormously ... |
|
3629 |
" |
|
3630 |
||
3631 |
LogDoits := aBoolean |
|
3632 |
||
3633 |
! |
|
3634 |
||
3635 |
makeBytecodeMethods |
|
3636 |
"{ Pragma: +optSpace }" |
|
3637 |
||
3638 |
"walk over all methods and make each a bytecode method |
|
3639 |
iff it does not contain primitive C code. |
|
3640 |
Experimental and not yet used." |
|
3641 |
||
3642 |
Method allSubInstancesDo:[:aMethod | |
|
6853 | 3643 |
|newMethod| |
3644 |
||
3645 |
aMethod hasPrimitiveCode ifFalse:[ |
|
3646 |
newMethod := aMethod asByteCodeMethod. |
|
3647 |
newMethod ~~ aMethod ifTrue:[ |
|
3648 |
aMethod becomeSameAs:newMethod |
|
3649 |
] |
|
3650 |
]. |
|
3044 | 3651 |
]. |
3652 |
||
3653 |
" |
|
3654 |
Smalltalk makeBytecodeMethods |
|
3655 |
" |
|
3656 |
||
3657 |
"Modified: 16.1.1997 / 01:25:58 / cg" |
|
3658 |
"Created: 17.10.1997 / 13:52:19 / cg" |
|
3062
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3659 |
! |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3660 |
|
5117 | 3661 |
recursiveInstallAutoloadedClassesFrom:aDirectory rememberIn:dirsConsulted maxLevels:maxLevels noAutoload:noAutoloadIn packageTop:packageTopPath |
4458 | 3662 |
"read all abbrev.stc files from and under aDirectory |
5363 | 3663 |
and install autoloaded classes. |
3664 |
If a file called NOAUTOLOAD is found, no classes there and below are installed as autoloaded |
|
3665 |
(however, the directories are searched for packages) |
|
3666 |
If a file called NOPACKAGES is found, no further searching is done in that directory or below." |
|
4458 | 3667 |
|
7085
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3668 |
|abbrevStream dir noAutoloadHere dirName pkgName directoryContents| |
4458 | 3669 |
|
5075 | 3670 |
maxLevels == 0 ifTrue:[ |
5077 | 3671 |
"/ 'Smalltalk [warning]: max directory nesting reached.' infoPrintCR. |
7085
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3672 |
^ self |
5075 | 3673 |
]. |
5074 | 3674 |
|
4458 | 3675 |
dir := aDirectory asFilename. |
6188 | 3676 |
|
5110
283e7eb8c359
remember where we have been when searching for abbrev.stc-files.
Claus Gittinger <cg@exept.de>
parents:
5109
diff
changeset
|
3677 |
(dirsConsulted includes:dir pathName) ifTrue:[ |
7085
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3678 |
^ self |
5110
283e7eb8c359
remember where we have been when searching for abbrev.stc-files.
Claus Gittinger <cg@exept.de>
parents:
5109
diff
changeset
|
3679 |
]. |
283e7eb8c359
remember where we have been when searching for abbrev.stc-files.
Claus Gittinger <cg@exept.de>
parents:
5109
diff
changeset
|
3680 |
dirsConsulted add:dir pathName. |
283e7eb8c359
remember where we have been when searching for abbrev.stc-files.
Claus Gittinger <cg@exept.de>
parents:
5109
diff
changeset
|
3681 |
|
5363 | 3682 |
(dir construct:'NOPACKAGES') exists ifTrue:[ |
7085
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3683 |
^ self. |
5363 | 3684 |
]. |
6188 | 3685 |
noAutoloadHere := noAutoloadIn. |
3686 |
noAutoloadHere ifFalse:[ |
|
7085
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3687 |
(dir construct:'NOAUTOLOAD') exists ifTrue:[ |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3688 |
noAutoloadHere := true. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3689 |
]. |
6188 | 3690 |
] ifTrue:[ |
7085
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3691 |
(dir construct:'AUTOLOAD') exists ifTrue:[ |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3692 |
noAutoloadHere := false. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3693 |
]. |
5108 | 3694 |
]. |
5117 | 3695 |
|
3696 |
((dir construct:'loadAll') exists |
|
6188 | 3697 |
or:[(dir construct:'abbrev.stc') exists |
3698 |
or:[(dir construct:(dir baseName , '.prj')) exists]]) ifTrue:[ |
|
7085
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3699 |
KnownPackages isNil ifTrue:[ |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3700 |
KnownPackages := Set new. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3701 |
]. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3702 |
dirName := dir pathName. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3703 |
pkgName := dirName copyFrom:(packageTopPath asFilename pathName) size + 1 + 1. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3704 |
KnownPackages add:pkgName |
5117 | 3705 |
]. |
3706 |
||
3707 |
"/ |
|
3708 |
"/ suppress installation as autoloaded in this and everything |
|
3709 |
"/ below; however, still traverse the directories to find packages ... |
|
3710 |
"/ |
|
6188 | 3711 |
noAutoloadHere ifFalse:[ |
7085
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3712 |
[ |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3713 |
abbrevStream := (dir construct:'abbrev.stc') asFilename readStream. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3714 |
self installAutoloadedClassesFromStream:abbrevStream. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3715 |
abbrevStream close. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3716 |
] 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
|
3717 |
]. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3718 |
|
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3719 |
[ |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3720 |
directoryContents := dir directoryContents. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3721 |
] on:FileStream openErrorSignal do:[:ex| |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3722 |
"non-accessable directory: we are done" |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3723 |
^ self |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3724 |
]. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3725 |
|
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3726 |
directoryContents do:[:aFilename | |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3727 |
|f| |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3728 |
|
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3729 |
(#( |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3730 |
'doc' |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3731 |
'CVS' |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3732 |
'bitmaps' |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3733 |
'resources' |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3734 |
'source' |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3735 |
) includes:aFilename) ifFalse:[ |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3736 |
((dir baseName ~= 'stx') |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3737 |
or:[ |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3738 |
(#( |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3739 |
'configurations' |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3740 |
'include' |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3741 |
'rules' |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3742 |
'stc' |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3743 |
'support' |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3744 |
) includes:aFilename) not]) |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3745 |
ifTrue:[ |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3746 |
f := dir construct:aFilename. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3747 |
f isDirectory ifTrue:[ |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3748 |
self |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3749 |
recursiveInstallAutoloadedClassesFrom:f |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3750 |
rememberIn:dirsConsulted |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3751 |
maxLevels:maxLevels-1 |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3752 |
noAutoload:noAutoloadHere |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3753 |
packageTop:packageTopPath. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3754 |
] |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3755 |
] |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3756 |
]. |
4458 | 3757 |
]. |
3758 |
||
5117 | 3759 |
" |
3760 |
Smalltalk installAutoloadedClasses |
|
3761 |
" |
|
4458 | 3762 |
! |
3763 |
||
6033
be1b7877b425
+ #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
6031
diff
changeset
|
3764 |
replaceReferencesTo:anObject with:newRef |
be1b7877b425
+ #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
6031
diff
changeset
|
3765 |
|toAdd| |
be1b7877b425
+ #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
6031
diff
changeset
|
3766 |
|
be1b7877b425
+ #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
6031
diff
changeset
|
3767 |
toAdd := OrderedCollection new. |
be1b7877b425
+ #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
6031
diff
changeset
|
3768 |
self keysAndValuesDo:[:key :val | |
6853 | 3769 |
(key == anObject) ifTrue:[ |
3770 |
self shouldImplement. |
|
3771 |
]. |
|
3772 |
(val == anObject ) ifTrue:[ |
|
3773 |
toAdd add:(key -> newRef) |
|
3774 |
]. |
|
6033
be1b7877b425
+ #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
6031
diff
changeset
|
3775 |
]. |
be1b7877b425
+ #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
6031
diff
changeset
|
3776 |
toAdd do:[:each | |
6853 | 3777 |
self at:(each key) put:(each value) |
6033
be1b7877b425
+ #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
6031
diff
changeset
|
3778 |
]. |
be1b7877b425
+ #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
6031
diff
changeset
|
3779 |
! |
be1b7877b425
+ #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
6031
diff
changeset
|
3780 |
|
3062
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3781 |
saveEmergencyImage:aBoolean |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3782 |
"set/clear the flag which controls if ST/X should save an |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3783 |
emergency image in case of a broken display connection. |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3784 |
The default is true. |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3785 |
This may be useful, if you work with an unsecure display |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3786 |
(serial line), and want to have a chance of proceeding after |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3787 |
a crash. In multiheaded applications, this only affects |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3788 |
crashes of the master Display connection (the initial connection); |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3789 |
errors on other displays are reported to the views and treated |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3790 |
like window destroy from the windowManager." |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3791 |
|
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3792 |
SaveEmergencyImage := aBoolean |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3793 |
|
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3794 |
"Modified: / 24.10.1997 / 18:22:26 / cg" |
3083 | 3795 |
! |
3796 |
||
3626
5a69787e857c
added hook make apps VW compatible w.r.t. system-organizaton.
Claus Gittinger <cg@exept.de>
parents:
3624
diff
changeset
|
3797 |
systemOrganization |
5a69787e857c
added hook make apps VW compatible w.r.t. system-organizaton.
Claus Gittinger <cg@exept.de>
parents:
3624
diff
changeset
|
3798 |
"for partial ST80 compatibility; |
5a69787e857c
added hook make apps VW compatible w.r.t. system-organizaton.
Claus Gittinger <cg@exept.de>
parents:
3624
diff
changeset
|
3799 |
In ST80, Smalltalk organization returns a systemOrganizer, which |
5a69787e857c
added hook make apps VW compatible w.r.t. system-organizaton.
Claus Gittinger <cg@exept.de>
parents:
3624
diff
changeset
|
3800 |
keeps track of class-categories, while all classes return a classOrganizer |
5a69787e857c
added hook make apps VW compatible w.r.t. system-organizaton.
Claus Gittinger <cg@exept.de>
parents:
3624
diff
changeset
|
3801 |
from #organization, which keeps track of method categories of that class. |
7432 | 3802 |
Since in ST/X, Smalltalk is a class, there is now a conflict. |
3626
5a69787e857c
added hook make apps VW compatible w.r.t. system-organizaton.
Claus Gittinger <cg@exept.de>
parents:
3624
diff
changeset
|
3803 |
To make a workaround possible, use #systemOrganization when porting |
5a69787e857c
added hook make apps VW compatible w.r.t. system-organizaton.
Claus Gittinger <cg@exept.de>
parents:
3624
diff
changeset
|
3804 |
VW apps to ST/X to get the class-categories. |
5a69787e857c
added hook make apps VW compatible w.r.t. system-organizaton.
Claus Gittinger <cg@exept.de>
parents:
3624
diff
changeset
|
3805 |
Read the documentation in SystemOrganizer for more info." |
5a69787e857c
added hook make apps VW compatible w.r.t. system-organizaton.
Claus Gittinger <cg@exept.de>
parents:
3624
diff
changeset
|
3806 |
|
5a69787e857c
added hook make apps VW compatible w.r.t. system-organizaton.
Claus Gittinger <cg@exept.de>
parents:
3624
diff
changeset
|
3807 |
^ SystemOrganizer for:nil |
5a69787e857c
added hook make apps VW compatible w.r.t. system-organizaton.
Claus Gittinger <cg@exept.de>
parents:
3624
diff
changeset
|
3808 |
|
5a69787e857c
added hook make apps VW compatible w.r.t. system-organizaton.
Claus Gittinger <cg@exept.de>
parents:
3624
diff
changeset
|
3809 |
"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
|
3810 |
"Modified: / 20.6.1998 / 12:41:34 / cg" |
3044 | 3811 |
! ! |
3812 |
||
3813 |
!Smalltalk class methodsFor:'system management-fileIn'! |
|
3814 |
||
3815 |
fileIn:aFileName |
|
3816 |
"read in the named file - look for it in some standard places; |
|
4712 | 3817 |
return true if ok, false if failed. |
3818 |
This method can load almost anything which makes sense: |
|
6853 | 3819 |
.st - source files |
3820 |
.cls - binary smalltalk bytecode files |
|
3821 |
.so - binary compiled machine code class libraries |
|
3822 |
[.class - java bytecode -- soon to come]" |
|
3044 | 3823 |
|
3824 |
^ self fileIn:aFileName lazy:nil silent:nil logged:false |
|
3825 |
||
3826 |
" |
|
3827 |
Smalltalk fileIn:'source/TicTacToe.st' |
|
4712 | 3828 |
Smalltalk fileIn:'binary/TicTacToe.cls' |
3829 |
Smalltalk fileIn:'binary/TicTacToe.so' |
|
3044 | 3830 |
" |
3831 |
||
3832 |
"Created: 28.10.1995 / 17:06:28 / cg" |
|
3833 |
! |
|
3834 |
||
5687 | 3835 |
fileIn:aFileName inPackage:aPackageID |
3836 |
"read in the named file in a packages directory." |
|
3837 |
||
3838 |
|dir| |
|
3839 |
||
3840 |
dir := self getPackageDirectoryForPackage:aPackageID. |
|
6096 | 3841 |
dir isNil ifTrue:[^ false]. |
3842 |
||
3843 |
dir := dir asFilename. |
|
3844 |
^ (self fileIn:(dir construct:aFileName)) |
|
3845 |
or:[ self fileIn:((dir construct:'source') construct:aFileName) ] |
|
5687 | 3846 |
! |
3847 |
||
3044 | 3848 |
fileIn:aFileName lazy:lazy |
3849 |
"read in the named file - look for it in some standard places; |
|
3850 |
return true if ok, false if failed. |
|
3851 |
If lazy is true, no code is generated for methods, instead stubs |
|
3852 |
are created which compile themself when first executed. This allows |
|
3853 |
for much faster fileIn (but slows down the first execution later). |
|
3854 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
3855 |
code which is known to be syntactically correct." |
|
3856 |
||
3857 |
^ self fileIn:aFileName lazy:lazy silent:nil logged:false |
|
3858 |
||
3859 |
" |
|
3860 |
Smalltalk fileIn:'source/TicTacToe.st' lazy:true |
|
3861 |
" |
|
3862 |
||
3863 |
"Created: 28.10.1995 / 17:06:36 / cg" |
|
3864 |
! |
|
3865 |
||
3866 |
fileIn:aFileName lazy:lazy silent:silent |
|
3867 |
"read in the named file - look for it in some standard places; |
|
3868 |
return true if ok, false if failed. |
|
3869 |
If lazy is true, no code is generated for methods, instead stubs |
|
3870 |
are created which compile themself when first executed. This allows |
|
3871 |
for much faster fileIn (but slows down the first execution later). |
|
3872 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
3873 |
code which is known to be syntactically correct. |
|
3874 |
If silent is true, no compiler messages are output to the transcript. |
|
3875 |
Giving nil for silent/lazy will use the current settings." |
|
3876 |
||
3877 |
^ self fileIn:aFileName lazy:lazy silent:silent logged:false |
|
3878 |
||
3879 |
"Created: 28.10.1995 / 17:06:41 / cg" |
|
3880 |
! |
|
3881 |
||
3882 |
fileIn:aFileNameOrString lazy:lazy silent:silent logged:logged |
|
3883 |
"read in the named file - look for it in some standard places; |
|
3884 |
return true if ok, false if failed. |
|
3885 |
If lazy is true, no code is generated for methods, instead stubs |
|
3886 |
are created which compile themself when first executed. This allows |
|
3887 |
for much faster fileIn (but slows down the first execution later). |
|
3888 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
3889 |
code which is known to be syntactically correct. |
|
3890 |
If silent is true, no compiler messages are output to the transcript. |
|
4712 | 3891 |
Giving nil for silent/lazy will use the current settings. |
3892 |
This method can load almost anything which makes sense: |
|
6853 | 3893 |
.st - source files |
3894 |
.cls - binary smalltalk bytecode files |
|
3895 |
.so - binary compiled machine code class libraries |
|
3896 |
[.class - java bytecode -- soon to come]" |
|
3044 | 3897 |
|
3898 |
|fileNameString aStream path morePath bos| |
|
3899 |
||
3900 |
fileNameString := aFileNameOrString asString. |
|
3901 |
||
3902 |
" |
|
3903 |
an object or shared object ? |
|
3904 |
" |
|
3905 |
(ObjectFileLoader notNil |
|
3906 |
and:[ObjectFileLoader hasValidBinaryExtension:fileNameString]) ifTrue:[ |
|
6853 | 3907 |
"/ LoadBinaries ifFalse:[^ false]. |
3908 |
path := self getBinaryFileName:fileNameString. |
|
3909 |
path isNil ifTrue:[ |
|
3910 |
path := self getSystemFileName:fileNameString. |
|
3911 |
]. |
|
3912 |
path isNil ifTrue:[^ false]. |
|
3913 |
^ (ObjectFileLoader loadObjectFile:path) notNil |
|
3044 | 3914 |
]. |
3915 |
||
3916 |
(fileNameString asFilename hasSuffix:'cls') ifTrue:[ |
|
6853 | 3917 |
BinaryObjectStorage notNil ifTrue:[ |
3918 |
aStream := self systemFileStreamFor:fileNameString. |
|
3952
05c36f8e87b4
fixed fileIn of byteCode (.cls) files
Claus Gittinger <cg@exept.de>
parents:
3915
diff
changeset
|
3919 |
"/ path := self getBinaryFileName:fileNameString. |
05c36f8e87b4
fixed fileIn of byteCode (.cls) files
Claus Gittinger <cg@exept.de>
parents:
3915
diff
changeset
|
3920 |
"/ path isNil ifTrue:[^ false]. |
05c36f8e87b4
fixed fileIn of byteCode (.cls) files
Claus Gittinger <cg@exept.de>
parents:
3915
diff
changeset
|
3921 |
"/ aStream := path asFilename readStream. |
6853 | 3922 |
aStream notNil ifTrue:[ |
3923 |
aStream binary. |
|
3924 |
bos := BinaryObjectStorage onOld:aStream. |
|
3925 |
bos next. |
|
3926 |
bos close. |
|
3927 |
^ true |
|
3928 |
]. |
|
3929 |
^ false |
|
3930 |
] |
|
3044 | 3931 |
]. |
3932 |
||
3933 |
(fileNameString startsWith:'source/') ifTrue:[ |
|
6853 | 3934 |
aStream := self sourceFileStreamFor:(fileNameString copyFrom:8) |
3044 | 3935 |
] ifFalse:[ |
6853 | 3936 |
(fileNameString startsWith:'fileIn/') ifTrue:[ |
3937 |
aStream := self fileInFileStreamFor:(fileNameString copyFrom:8) |
|
3938 |
] ifFalse:[ |
|
3939 |
aStream := self systemFileStreamFor:fileNameString. |
|
3940 |
aStream isNil ifTrue:[ |
|
3941 |
OperatingSystem isUNIXlike ifTrue:[ |
|
3942 |
(fileNameString startsWith:'/') ifFalse:[ |
|
3943 |
aStream := self systemFileStreamFor:('lib/' , fileNameString). |
|
3944 |
] |
|
3945 |
] |
|
3946 |
]. |
|
3947 |
(aStream notNil and:[fileNameString includes:$/]) ifTrue:[ |
|
3948 |
"/ temporarily prepend the files directory |
|
3949 |
"/ to the searchPath. |
|
3950 |
"/ This allows fileIn-driver files to refer to local |
|
3951 |
"/ files via a relative path, and drivers to fileIn other |
|
3952 |
"/ drivers ... |
|
3953 |
morePath := aStream pathName asFilename directoryName. |
|
3954 |
] |
|
3955 |
] |
|
3044 | 3956 |
]. |
3957 |
aStream isNil ifTrue:[^ false]. |
|
3958 |
^ self fileInStream:aStream lazy:lazy silent:silent logged:logged addPath:morePath |
|
3959 |
||
3960 |
" |
|
3961 |
Smalltalk fileIn:'source/TicTacToe.st' lazy:true silent:true |
|
3962 |
" |
|
3963 |
||
3952
05c36f8e87b4
fixed fileIn of byteCode (.cls) files
Claus Gittinger <cg@exept.de>
parents:
3915
diff
changeset
|
3964 |
"Modified: / 16.2.1999 / 10:03:26 / cg" |
3044 | 3965 |
! |
3966 |
||
3967 |
fileIn:aFileName logged:logged |
|
3968 |
"read in the named file - look for it in some standard places; |
|
3969 |
return true if ok, false if failed. |
|
3970 |
The argument logged controls, if the changefile is to be updated." |
|
3971 |
||
3972 |
^ self fileIn:aFileName lazy:nil silent:nil logged:logged |
|
3973 |
||
3974 |
" |
|
3975 |
Smalltalk fileIn:'source/TicTacToe.st' logged:false |
|
3976 |
" |
|
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
3977 |
! |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
3978 |
|
1 | 3979 |
fileInChanges |
3980 |
"read in the last changes file - bringing the system to the state it |
|
70 | 3981 |
had when left the last time. |
3982 |
WARNING: this method is rubbish: it should only read things after the |
|
6853 | 3983 |
last '**snapshot**' - entry |
3984 |
(instead of the complete changes file)." |
|
1 | 3985 |
|
70 | 3986 |
" |
400 | 3987 |
do NOT update the changes file now ... |
70 | 3988 |
" |
2928 | 3989 |
self fileIn:ChangeFileName logged:false |
1 | 3990 |
|
77 | 3991 |
" |
3992 |
Smalltalk fileInChanges |
|
3993 |
" |
|
1 | 3994 |
! |
3995 |
||
3044 | 3996 |
fileInClass:aClassName |
3997 |
"find a source/object file for aClassName and -if found - load it. |
|
3998 |
search is in some standard places trying driver-file (.ld), object-file (.o) and |
|
3999 |
finally source file (.st) in that order. |
|
4000 |
The file is first searched for using the class name, then the abbreviated name." |
|
4001 |
||
3155
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
4002 |
^ self |
6853 | 4003 |
fileInClass:aClassName |
4004 |
package:nil |
|
4005 |
initialize:true |
|
4006 |
lazy:false |
|
4007 |
silent:nil |
|
3155
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
4008 |
|
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
4009 |
"Modified: / 9.1.1998 / 14:41:46 / cg" |
3044 | 4010 |
! |
4011 |
||
4012 |
fileInClass:aClassName fromObject:aFileName |
|
4013 |
"read in the named object file and dynamic-link it into the system |
|
4014 |
- look for it in some standard places. |
|
4015 |
Only install the named class from this object file. |
|
4016 |
Return true if ok, false if failed." |
|
4017 |
||
4018 |
|path ok| |
|
4019 |
||
4020 |
" |
|
4021 |
check if the dynamic loader class is in |
|
4022 |
" |
|
4023 |
(LoadBinaries not or:[ObjectFileLoader isNil]) ifTrue:[^ false]. |
|
4024 |
||
4025 |
(path := self getBinaryFileName:aFileName) isNil ifTrue:[^ false]. |
|
4026 |
ok := (ObjectFileLoader loadClass:aClassName fromObjectFile:path) notNil. |
|
4027 |
ok ifTrue:[ |
|
6853 | 4028 |
SilentLoading ifFalse:[ |
4029 |
Transcript show:' loaded ' , aClassName , ' from ' ; showCR:aFileName. |
|
4030 |
] |
|
3044 | 4031 |
]. |
4032 |
^ ok |
|
4033 |
||
4034 |
" |
|
4035 |
Smalltalk fileInClass:'AbstractPath' fromObject:'../../goodies/Paths/AbstrPath.so' |
|
4036 |
Smalltalk fileInClass:'ClockView' fromObject:'../../libwidg3/libwidg3.so' |
|
4037 |
" |
|
4038 |
||
4039 |
"Modified: 10.9.1996 / 20:43:52 / cg" |
|
4040 |
! |
|
4041 |
||
4042 |
fileInClass:aClassName initialize:doInit |
|
4043 |
"find a source/object file for aClassName and -if found - load it. |
|
4044 |
search is in some standard places trying driver-file (.ld), object-file (.o) and |
|
4045 |
finally source file (.st) in that order. |
|
4046 |
The file is first searched for using the class name, then the abbreviated name." |
|
4047 |
||
3155
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
4048 |
^ self |
6853 | 4049 |
fileInClass:aClassName |
4050 |
package:nil |
|
4051 |
initialize:doInit |
|
4052 |
lazy:false |
|
4053 |
silent:nil |
|
3155
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
4054 |
|
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
4055 |
"Modified: / 9.1.1998 / 14:42:02 / cg" |
3044 | 4056 |
! |
4057 |
||
4058 |
fileInClass:aClassName initialize:doInit lazy:loadLazy |
|
4059 |
"find a source/object file for aClassName and -if found - load it. |
|
4060 |
search is in some standard places trying driver-file (.ld), object-file (.o) and |
|
4061 |
finally source file (.st) in that order. |
|
4062 |
The file is first searched for using the class name, then the abbreviated name." |
|
4063 |
||
3155
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
4064 |
^ self |
6853 | 4065 |
fileInClass:aClassName |
4066 |
package:nil |
|
4067 |
initialize:doInit |
|
4068 |
lazy:loadLazy |
|
4069 |
silent:nil |
|
3155
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
4070 |
|
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
4071 |
"Modified: / 9.1.1998 / 14:42:19 / cg" |
3044 | 4072 |
! |
4073 |
||
4074 |
fileInClass:aClassName initialize:doInit lazy:loadLazy silent:beSilent |
|
4075 |
"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
|
4076 |
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
|
4077 |
finally source file (.st), in that order. |
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
4078 |
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
|
4079 |
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
|
4080 |
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
|
4081 |
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
|
4082 |
nil uses the value from SilentLoading." |
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
4083 |
|
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
4084 |
^ self |
6853 | 4085 |
fileInClass:aClassName |
4086 |
package:nil |
|
4087 |
initialize:doInit |
|
4088 |
lazy:loadLazy |
|
4089 |
silent:beSilent |
|
3155
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
4090 |
|
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
4091 |
"Modified: / 9.1.1998 / 14:42:28 / cg" |
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
4092 |
! |
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
4093 |
|
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
4094 |
fileInClass:aClassName package:package initialize:doInit lazy:loadLazy silent:beSilent |
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
4095 |
"find a source/object file for aClassName and -if found - load it. |
3044 | 4096 |
This is the workhorse for autoloading. |
4097 |
Search is in some standard places, trying driver-file (.ld), object-file (.so / .o) and |
|
4098 |
finally source file (.st), in that order. |
|
4099 |
The file is first searched for using the class name, then the abbreviated name. |
|
4100 |
The argument doInit controlls if the class should be sent a #initialize after the |
|
4101 |
load; loadLazy tells if it should be loaded lazyly. beSilent tells if the compiler |
|
4102 |
should not send notes to the transcript; it can be true, false or nil, where |
|
4103 |
nil uses the value from SilentLoading." |
|
4104 |
||
7366
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4105 |
|shortName longName libName newClass ok wasLazy wasSilent sharedLibExtension inStream mgr |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4106 |
fn packageDir packageFile bos| |
3044 | 4107 |
|
4108 |
wasLazy := Compiler compileLazy:loadLazy. |
|
4109 |
beSilent notNil ifTrue:[ |
|
7366
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4110 |
wasSilent := self silentLoading:beSilent. |
617 | 4111 |
]. |
3044 | 4112 |
|
4026
96712578b0da
care for namespace/prefix in className when filing in.
Claus Gittinger <cg@exept.de>
parents:
4006
diff
changeset
|
4113 |
longName := aClassName copyReplaceAll:$: with:$_. |
96712578b0da
care for namespace/prefix in className when filing in.
Claus Gittinger <cg@exept.de>
parents:
4006
diff
changeset
|
4114 |
|
3044 | 4115 |
[ |
7366
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4116 |
Class withoutUpdatingChangesDo: |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4117 |
[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4118 |
|zarFn zar entry| |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4119 |
|
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4120 |
ok := false. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4121 |
|
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4122 |
shortName := self fileNameForClass:aClassName. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4123 |
package notNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4124 |
packageDir := package asString. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4125 |
packageDir := packageDir copyReplaceAll:$: with:$/. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4126 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4127 |
|
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4128 |
Class packageQuerySignal answer:package |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4129 |
do:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4130 |
|
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4131 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4132 |
first, look for a loader-driver file (in fileIn/xxx.ld) |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4133 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4134 |
(ok := self fileIn:('fileIn/' , shortName , '.ld') lazy:loadLazy silent:beSilent) |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4135 |
ifFalse:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4136 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4137 |
try abbreviated driver-file (in fileIn/xxx.ld) |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4138 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4139 |
shortName ~= aClassName ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4140 |
ok := self fileIn:('fileIn/' , longName , '.ld') lazy:loadLazy silent:beSilent |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4141 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4142 |
ok ifFalse:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4143 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4144 |
then, if dynamic linking is available, |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4145 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4146 |
(LoadBinaries and:[ObjectFileLoader notNil]) ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4147 |
sharedLibExtension := ObjectFileLoader sharedLibraryExtension. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4148 |
|
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4149 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4150 |
first look for a class packages shared binary in binary/xxx.o |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4151 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4152 |
libName := self libraryFileNameOfClass:aClassName. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4153 |
libName notNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4154 |
(ok := self fileInClass:aClassName fromObject:(libName, sharedLibExtension)) |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4155 |
ifFalse:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4156 |
sharedLibExtension ~= '.o' ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4157 |
ok := self fileInClass:aClassName fromObject:(libName, '.o') |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4158 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4159 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4160 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4161 |
|
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4162 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4163 |
then, look for a shared binary in binary/xxx.o |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4164 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4165 |
ok ifFalse:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4166 |
(ok := self fileInClass:aClassName fromObject:(shortName, sharedLibExtension)) |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4167 |
ifFalse:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4168 |
sharedLibExtension ~= '.o' ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4169 |
ok := self fileInClass:aClassName fromObject:(shortName, '.o') |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4170 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4171 |
ok ifFalse:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4172 |
shortName ~= aClassName ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4173 |
(ok := self fileInClass:aClassName fromObject:(longName, sharedLibExtension)) |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4174 |
ifFalse:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4175 |
sharedLibExtension ~= '.o' ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4176 |
ok := self fileInClass:aClassName fromObject:(longName, '.o') |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4177 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4178 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4179 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4180 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4181 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4182 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4183 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4184 |
|
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4185 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4186 |
if that did not work, look for a compiled-bytecode file ... |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4187 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4188 |
ok ifFalse:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4189 |
(ok := self fileIn:(shortName , '.cls') lazy:loadLazy silent:beSilent) |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4190 |
ifFalse:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4191 |
shortName ~= aClassName ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4192 |
ok := self fileIn:(longName , '.cls') lazy:loadLazy silent:beSilent |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4193 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4194 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4195 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4196 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4197 |
if that did not work, and the classes package is known, |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4198 |
look for an st-cls file |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4199 |
in a package subdir of the source-directory ... |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4200 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4201 |
ok ifFalse:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4202 |
(packageDir notNil and:[BinaryObjectStorage notNil]) ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4203 |
packageFile := self getPackageFileName:(packageDir , '/classes/' , shortName , '.cls'). |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4204 |
packageFile isNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4205 |
packageFile := (packageDir , '/classes/' , shortName , '.cls'). |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4206 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4207 |
(ok := self fileIn:packageFile lazy:loadLazy silent:beSilent) |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4208 |
ifFalse:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4209 |
shortName ~= aClassName ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4210 |
packageFile := self getPackageFileName:(packageDir , '/classes/' , longName , '.cls'). |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4211 |
packageFile isNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4212 |
packageFile := (packageDir , '/classes/' , longName , '.cls'). |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4213 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4214 |
ok := self fileIn:packageFile lazy:loadLazy silent:beSilent |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4215 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4216 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4217 |
|
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4218 |
zarFn := self getPackageFileName:(packageDir , '/classes.zip'). |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4219 |
zarFn notNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4220 |
zar := ZipArchive oldFileNamed:zarFn. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4221 |
zar notNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4222 |
entry := zar extract:(shortName , '.cls'). |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4223 |
(entry isNil and:[shortName ~= longName]) ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4224 |
entry := zar extract:(longName , '.cls'). |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4225 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4226 |
entry notNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4227 |
bos := BinaryObjectStorage onOld:(entry asByteArray readStream). |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4228 |
bos next. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4229 |
bos close. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4230 |
ok := true |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4231 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4232 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4233 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4234 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4235 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4236 |
|
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4237 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4238 |
if that did not work, look for an st-source file ... |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4239 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4240 |
ok ifFalse:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4241 |
fn := shortName , '.st'. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4242 |
(ok := self fileIn:fn lazy:loadLazy silent:beSilent) |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4243 |
ifFalse:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4244 |
shortName ~= longName ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4245 |
fn := longName , '.st'. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4246 |
ok := self fileIn:fn lazy:loadLazy silent:beSilent |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4247 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4248 |
ok ifFalse:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4249 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4250 |
... and in the standard source-directory |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4251 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4252 |
fn := 'source/' , shortName , '.st'. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4253 |
(ok := self fileIn:fn lazy:loadLazy silent:beSilent) |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4254 |
ifFalse:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4255 |
shortName ~= longName ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4256 |
fn := 'source/' , longName , '.st'. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4257 |
ok := self fileIn:fn lazy:loadLazy silent:beSilent |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4258 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4259 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4260 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4261 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4262 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4263 |
if that did not work, and the classes package is known, |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4264 |
look for an st-source file |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4265 |
in a package subdir of the source-directory ... |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4266 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4267 |
ok ifFalse:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4268 |
packageDir notNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4269 |
packageFile := self getPackageFileName:(packageDir , '/source/' , shortName , '.st'). |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4270 |
packageFile isNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4271 |
packageFile := (packageDir , '/source/' , shortName , '.st'). |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4272 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4273 |
fn := packageFile. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4274 |
(ok := self fileIn:packageFile lazy:loadLazy silent:beSilent) |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4275 |
ifFalse:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4276 |
shortName ~= aClassName ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4277 |
packageFile := self getPackageFileName:(packageDir , '/source/' , longName , '.st'). |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4278 |
packageFile isNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4279 |
packageFile := (packageDir , '/source/' , longName , '.st'). |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4280 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4281 |
fn := packageFile. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4282 |
ok := self fileIn:packageFile lazy:loadLazy silent:beSilent |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4283 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4284 |
ok ifFalse:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4285 |
|
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4286 |
packageFile := self getPackageFileName:(packageDir , '/' , shortName , '.st'). |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4287 |
packageFile isNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4288 |
packageFile := (packageDir , '/' , shortName , '.st'). |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4289 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4290 |
fn := packageFile. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4291 |
(ok := self fileIn:packageFile lazy:loadLazy silent:beSilent) |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4292 |
ifFalse:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4293 |
shortName ~= aClassName ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4294 |
packageFile := self getPackageFileName:(packageDir , '/' , longName , '.st'). |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4295 |
packageFile isNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4296 |
packageFile := (packageDir , '/' , longName , '.st'). |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4297 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4298 |
fn := packageFile. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4299 |
ok := self fileIn:packageFile lazy:loadLazy silent:beSilent |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4300 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4301 |
ok ifFalse:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4302 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4303 |
... and in the standard source-directory |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4304 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4305 |
fn := 'source/' , packageDir , '/' , shortName , '.st'. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4306 |
(ok := self fileIn:fn lazy:loadLazy silent:beSilent) |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4307 |
ifFalse:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4308 |
shortName ~= aClassName ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4309 |
fn := 'source/' , packageDir , '/' , longName , '.st'. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4310 |
ok := self fileIn:fn lazy:loadLazy silent:beSilent |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4311 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4312 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4313 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4314 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4315 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4316 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4317 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4318 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4319 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4320 |
if that did not work, and the classes package is known, |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4321 |
look for a zipArchive containing a class entry. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4322 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4323 |
ok ifFalse:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4324 |
packageDir notNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4325 |
zarFn := self getPackageFileName:(packageDir , '/source.zip'). |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4326 |
zarFn isNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4327 |
zarFn := packageDir asFilename withSuffix:'zip'. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4328 |
zarFn := self getSourceFileName:zarFn. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4329 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4330 |
zarFn notNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4331 |
zar := ZipArchive oldFileNamed:zarFn. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4332 |
zar notNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4333 |
entry := zar extract:(shortName , '.st'). |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4334 |
(entry isNil and:[shortName ~= longName]) ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4335 |
entry := zar extract:(longName , '.st'). |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4336 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4337 |
entry notNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4338 |
fn := zarFn. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4339 |
ok := self |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4340 |
fileInStream:(entry asString readStream) |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4341 |
lazy:loadLazy |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4342 |
silent:beSilent |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4343 |
logged:false |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4344 |
addPath:nil |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4345 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4346 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4347 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4348 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4349 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4350 |
|
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4351 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4352 |
if that did not work, |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4353 |
look for a zipArchive containing a class entry. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4354 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4355 |
ok ifFalse:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4356 |
zarFn := self getSourceFileName:'source.zip'. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4357 |
zarFn notNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4358 |
zar := ZipArchive oldFileNamed:zarFn. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4359 |
zar notNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4360 |
entry := zar extract:(zarFn := shortName , '.st'). |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4361 |
(entry isNil and:[shortName ~= longName]) ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4362 |
entry := zar extract:(zarFn := longName , '.st'). |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4363 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4364 |
entry notNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4365 |
fn := zarFn. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4366 |
ok := self |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4367 |
fileInStream:(entry asString readStream) |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4368 |
lazy:loadLazy |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4369 |
silent:beSilent |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4370 |
logged:false |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4371 |
addPath:nil |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4372 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4373 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4374 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4375 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4376 |
ok ifFalse:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4377 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4378 |
new: if there is a sourceCodeManager, ask it for the classes sourceCode |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4379 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4380 |
(mgr := Smalltalk at:#SourceCodeManager) notNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4381 |
inStream := mgr getMostRecentSourceStreamForClassNamed:aClassName. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4382 |
inStream notNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4383 |
fn := nil. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4384 |
ok := self fileInStream:inStream lazy:loadLazy silent:beSilent logged:false addPath:nil. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4385 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4386 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4387 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4388 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4389 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4390 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4391 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4392 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4393 |
|
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4394 |
ok ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4395 |
newClass := self at:(aClassName asSymbol). |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4396 |
newClass notNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4397 |
fn notNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4398 |
newClass classFilename isNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4399 |
newClass setClassFilename:fn |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4400 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4401 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4402 |
|
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4403 |
doInit ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4404 |
newClass initialize |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4405 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4406 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4407 |
]. |
6421
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4408 |
] ensure:[ |
7366
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4409 |
Compiler compileLazy:wasLazy. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4410 |
wasSilent notNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4411 |
self silentLoading:wasSilent |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4412 |
] |
3044 | 4413 |
]. |
4414 |
||
4415 |
^ newClass |
|
4416 |
||
3155
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
4417 |
"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
|
4418 |
"Modified: / 5.6.1999 / 14:53:01 / cg" |
3044 | 4419 |
! |
4420 |
||
4421 |
fileInClassLibrary:aClassLibraryName |
|
4422 |
"find an object file containing a binary class library in some standard places |
|
4423 |
and load it. This install all of its contained classes. |
|
4712 | 4424 |
Return true if ok, false if not. |
4425 |
Notice: the argument may not have an extension (by purpose); |
|
6853 | 4426 |
the sharedLib extension (.dll / .so / .sl) is added here, to |
4427 |
make the caller independent of the underlying operatingSystem." |
|
4712 | 4428 |
|
4429 |
|path fn| |
|
3044 | 4430 |
|
4431 |
ObjectFileLoader isNil ifTrue:[^ false]. |
|
4712 | 4432 |
|
6837 | 4433 |
fn := aClassLibraryName asFilename withSuffix:(ObjectFileLoader sharedLibrarySuffix). |
6836 | 4434 |
fn := fn pathName. |
4712 | 4435 |
|
4436 |
path := self getBinaryFileName:fn. |
|
4437 |
path isNil ifTrue:[ |
|
6853 | 4438 |
path := self getSystemFileName:fn. |
4712 | 4439 |
]. |
4440 |
path isNil ifTrue:[^ false]. |
|
4441 |
||
4714 | 4442 |
^ (ObjectFileLoader loadObjectFile:path) notNil |
3044 | 4443 |
|
4444 |
" |
|
4445 |
Smalltalk fileInClassLibrary:'libtable' |
|
4446 |
Smalltalk fileInClassLibrary:'binary/libwidg3' |
|
4447 |
" |
|
4448 |
||
4449 |
"Modified: 8.1.1997 / 17:58:56 / cg" |
|
617 | 4450 |
! |
4451 |
||
6025 | 4452 |
fileInClassLibrary:aClassLibraryName inPackage:packageID |
4453 |
"find an object file containing a binary class library in some standard places |
|
4454 |
and load it. This install all of its contained classes. |
|
4455 |
Return true if ok, false if not. |
|
4456 |
Notice: the argument may not have an extension (by purpose); |
|
6853 | 4457 |
the sharedLib extension (.dll / .so / .sl) is added here, to |
4458 |
make the caller independent of the underlying operatingSystem." |
|
6025 | 4459 |
|
4460 |
|path fn| |
|
4461 |
||
4462 |
ObjectFileLoader isNil ifTrue:[^ false]. |
|
4463 |
||
6837 | 4464 |
fn := aClassLibraryName asFilename withSuffix:(ObjectFileLoader sharedLibrarySuffix). |
4465 |
fn := fn pathName. |
|
6025 | 4466 |
|
4467 |
path := self getPackageDirectoryForPackage:packageID. |
|
4468 |
path isNil ifTrue:[^ false]. |
|
4469 |
path := path asFilename construct:fn. |
|
4470 |
path exists ifFalse:[^ false]. |
|
4471 |
||
4472 |
^ (ObjectFileLoader loadObjectFile:path pathName) notNil |
|
4473 |
||
4474 |
" |
|
4475 |
Smalltalk fileInClassLibrary:'libtable' |
|
4476 |
Smalltalk fileInClassLibrary:'binary/libwidg3' |
|
4477 |
Smalltalk fileInClassLibrary:'refactoryBrowser' inPackage:'stx:goodies/refactoryBrowser' |
|
4478 |
" |
|
4479 |
||
4480 |
"Modified: 8.1.1997 / 17:58:56 / cg" |
|
4481 |
! |
|
4482 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
4483 |
fileInStream:aStream lazy:lazy silent:silent logged:logged addPath:morePath |
617 | 4484 |
"read sourceCode from aStream; |
4485 |
return true if ok, false if failed. |
|
878
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
4486 |
If lazy is true, no code is generated for methods, instead stubs |
617 | 4487 |
are created which compile themself when first executed. This allows |
4488 |
for much faster fileIn (but slows down the first execution later). |
|
4489 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
4490 |
code which is known to be syntactically correct. |
|
4491 |
If silent is true, no compiler messages are output to the transcript. |
|
4492 |
Giving nil for silent/lazy will use the current settings. |
|
4493 |
If morePath is nonNil, it is prepended to the systemPath temporarily during the |
|
4494 |
fileIn. This allows for st-expressions to refer to more files (i.e. fileIn more) |
|
4495 |
using a relative path." |
|
4496 |
||
4497 |
|wasLazy wasSilent oldSystemPath oldRealPath| |
|
4498 |
||
4499 |
aStream isNil ifTrue:[^ false]. |
|
4500 |
||
4501 |
lazy notNil ifTrue:[wasLazy := Compiler compileLazy:lazy]. |
|
4502 |
silent notNil ifTrue:[wasSilent := self silentLoading:silent]. |
|
4503 |
[ |
|
6853 | 4504 |
Class updateChangeFileQuerySignal answer:logged do:[ |
4505 |
Class updateChangeListQuerySignal answer:logged do:[ |
|
4506 |
oldSystemPath := SystemPath copy. |
|
4507 |
morePath notNil ifTrue:[ |
|
4508 |
SystemPath addFirst:morePath. |
|
4509 |
oldRealPath := RealSystemPath. |
|
4510 |
RealSystemPath := nil. |
|
4511 |
]. |
|
4512 |
aStream fileIn |
|
4513 |
] |
|
4514 |
] |
|
6421
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4515 |
] ensure:[ |
6853 | 4516 |
morePath notNil ifTrue:[ |
4517 |
SystemPath := oldSystemPath. |
|
4518 |
RealSystemPath := oldRealPath. |
|
4519 |
]. |
|
4520 |
lazy notNil ifTrue:[Compiler compileLazy:wasLazy]. |
|
4521 |
silent notNil ifTrue:[self silentLoading:wasSilent]. |
|
4522 |
aStream close |
|
617 | 4523 |
]. |
4524 |
^ true |
|
4525 |
||
4526 |
" |
|
4527 |
Smalltalk fileInStream:('source/TicTacToe.st' asFilename readStream) lazy:true silent:true |
|
4528 |
" |
|
1896 | 4529 |
|
4530 |
"Modified: 5.11.1996 / 20:03:35 / cg" |
|
617 | 4531 |
! |
4532 |
||
5881
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4533 |
isClassLibraryLoaded:name |
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4534 |
"return true, if a particular class library is already loaded" |
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4535 |
|
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4536 |
ObjectMemory |
6853 | 4537 |
binaryModuleInfo |
4538 |
do:[:entry | |
|
4539 |
entry type == #classLibrary ifTrue:[ |
|
4540 |
entry libraryName = name ifTrue:[ |
|
4541 |
^ true "/ already loaded |
|
4542 |
] |
|
4543 |
]. |
|
4544 |
]. |
|
5881
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4545 |
|
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4546 |
^ false |
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4547 |
|
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4548 |
" |
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4549 |
Smalltalk isClassLibraryLoaded:'libbasic' |
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4550 |
Smalltalk isClassLibraryLoaded:'libwidg3' |
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4551 |
" |
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4552 |
! |
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4553 |
|
3044 | 4554 |
loadClassLibraryIfAbsent:name |
4555 |
"dynamically load a classLibrary, if not already loaded |
|
4556 |
and the system supports dynamic loading. |
|
4557 |
Return true, if the library is loaded, false if not. |
|
4558 |
This entry is called without system specific filename |
|
4559 |
extensions - it is portable among different architectures |
|
4560 |
as long as corresponding files (x.so / x.dll / x.sl / x.o) |
|
4561 |
are be present ..." |
|
4562 |
||
5881
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4563 |
(self isClassLibraryLoaded:name) ifTrue:[ ^ true ]. "/ already loaded |
3044 | 4564 |
^ self fileInClassLibrary:name |
4565 |
||
4566 |
" |
|
4567 |
Smalltalk loadClassLibraryIfAbsent:'libbasic' |
|
4568 |
Smalltalk loadClassLibraryIfAbsent:'libwidg3' |
|
4569 |
" |
|
4570 |
||
4571 |
"Modified: 31.10.1996 / 16:57:24 / cg" |
|
4572 |
! |
|
4573 |
||
4574 |
secureFileIn:aFileName |
|
4575 |
"read in the named file, looking for it at standard places. |
|
4576 |
Catch any error during fileIn. Return true if ok, false if failed" |
|
4577 |
||
4578 |
|retVal| |
|
4579 |
||
4580 |
retVal := false. |
|
4581 |
||
4582 |
(SignalSet with:AbortSignal with:Process terminateSignal) |
|
6853 | 4583 |
handle:[:ex | |
4584 |
ex return |
|
4585 |
] do:[ |
|
4586 |
retVal := self fileIn:aFileName |
|
4587 |
]. |
|
3044 | 4588 |
^ retVal |
4589 |
! |
|
4590 |
||
4591 |
silentFileIn:aFilename |
|
4592 |
"same as fileIn:, but do not output 'compiled...'-messages on Transcript. |
|
4593 |
Main use is during startup." |
|
4594 |
||
4595 |
|wasSilent| |
|
4596 |
||
4597 |
wasSilent := self silentLoading:true. |
|
4598 |
[ |
|
6853 | 4599 |
self fileIn:aFilename |
6421
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4600 |
] ensure:[ |
6853 | 4601 |
self silentLoading:wasSilent |
3044 | 4602 |
] |
4603 |
! ! |
|
4604 |
||
4605 |
!Smalltalk class methodsFor:'system management-files'! |
|
4606 |
||
4607 |
bitmapFileStreamFor:aFileName |
|
4608 |
"search aFileName in some standard places; |
|
4609 |
return a readonly fileStream or nil if not found. |
|
5089 | 4610 |
Searches in subdirectories named 'bitmaps' in the SystemPath. |
4611 |
Notice: this does not look in the package-specific bitmaps directories." |
|
3044 | 4612 |
|
4613 |
|aString| |
|
4614 |
||
4615 |
aString := self getBitmapFileName:aFileName. |
|
4616 |
aString notNil ifTrue:[ |
|
7085
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
4617 |
^ aString asFilename readStreamOrNil |
3044 | 4618 |
]. |
4619 |
^ nil |
|
4620 |
! |
|
4621 |
||
5040 | 4622 |
bitmapFromFileNamed:aFileName forClass:aClass |
4623 |
"search aFileName in some standard places: |
|
5089 | 4624 |
first in the redefinable bitmaps path, |
4625 |
then in the classes own package directory if existing. |
|
5040 | 4626 |
Return an image or nil." |
4627 |
||
5089 | 4628 |
^ self imageFromFileNamed:aFileName inPackage:(aClass package) |
5040 | 4629 |
|
4630 |
" |
|
4631 |
Smalltalk bitmapFromFileNamed:'SmalltalkX.xbm' forClass:View |
|
4632 |
" |
|
4633 |
! |
|
4634 |
||
4635 |
bitmapFromFileNamed:aFileName inPackage:aPackage |
|
4636 |
"search aFileName in some standard places: |
|
5089 | 4637 |
first in the redefinable bitmaps path, |
4638 |
then in the package directory if existing. |
|
5040 | 4639 |
Return an image or nil." |
4640 |
||
5089 | 4641 |
^ self imageFromFileNamed:aFileName inPackage:aPackage |
5040 | 4642 |
|
4643 |
" |
|
4644 |
Smalltalk bitmapFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libview' |
|
5041 | 4645 |
Smalltalk bitmapFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libtool' |
5040 | 4646 |
" |
4647 |
! |
|
4648 |
||
3044 | 4649 |
classNameForFile:aFileName |
4650 |
"return the className which corresponds to an abbreviated fileName, |
|
4651 |
or nil if no special translation applies. The given filename arg may |
|
4652 |
include a '.st' suffix (but no other)." |
|
4653 |
||
4654 |
|fn| |
|
4655 |
||
4656 |
(aFileName asFilename hasSuffix:'st') ifTrue:[ |
|
6853 | 4657 |
fn := aFileName copyWithoutLast:3 |
3044 | 4658 |
] ifFalse:[ |
6853 | 4659 |
fn := aFileName |
3044 | 4660 |
]. |
4661 |
^ self filenameAbbreviations keyAtEqualValue:fn ifAbsent:[fn]. |
|
4662 |
||
4663 |
" |
|
4664 |
Smalltalk classNameForFile:'DrawObj' |
|
4665 |
Smalltalk classNameForFile:'DrawObj.st' |
|
4666 |
Smalltalk classNameForFile:'ArrColl.st' |
|
4667 |
Smalltalk classNameForFile:'ArrColl.chg' |
|
4668 |
" |
|
4669 |
||
4670 |
"Modified: 11.12.1995 / 14:51:10 / cg" |
|
4671 |
! |
|
4672 |
||
4673 |
constructPathFor:aDirectoryName |
|
4674 |
"search for aDirectory in SystemPath; |
|
4675 |
return a collection of pathes which include that directory." |
|
4676 |
||
4677 |
^ self realSystemPath select:[:dirName | |
|
6853 | 4678 |
|fullPath| |
4679 |
||
4680 |
fullPath := dirName asFilename construct:aDirectoryName. |
|
4681 |
"/ fullPath exists and:[fullPath isDirectory and:[fullPath isReadable]] |
|
4682 |
fullPath isDirectory and:[fullPath isReadable] |
|
3044 | 4683 |
]. |
4684 |
! |
|
4685 |
||
4686 |
fileInFileStreamFor:aFileName |
|
4687 |
"search aFileName in some standard places; |
|
4688 |
return a readonly fileStream or nil if not found. |
|
4689 |
Searches in subdirectories named 'fileIn' in SystemPath" |
|
4690 |
||
4691 |
|aString| |
|
4692 |
||
4693 |
aString := self getFileInFileName:aFileName. |
|
4694 |
aString notNil ifTrue:[ |
|
7085
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
4695 |
^ aString asFilename readStreamOrNil |
3044 | 4696 |
]. |
4697 |
^ nil |
|
4698 |
! |
|
4699 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
4700 |
fileNameForClass:aClassOrClassName |
617 | 4701 |
"return a good filename for aClassOrClassName - |
4702 |
using the abbreviation file if there is one" |
|
4703 |
||
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
4704 |
|fileName abbrev cls fullClassName shortClassName| |
617 | 4705 |
|
4706 |
aClassOrClassName isBehavior ifTrue:[ |
|
6853 | 4707 |
cls := aClassOrClassName theNonMetaclass. |
4708 |
fullClassName := cls name. |
|
4709 |
shortClassName := cls nameWithoutPrefix. |
|
617 | 4710 |
] ifFalse:[ |
6853 | 4711 |
fullClassName := shortClassName := aClassOrClassName. |
4712 |
shortClassName := shortClassName copyFrom:(shortClassName lastIndexOf:$:)+1. |
|
617 | 4713 |
]. |
4714 |
||
4748 | 4715 |
fileName := fullClassName asSymbol. |
617 | 4716 |
|
4717 |
"look for abbreviation" |
|
4718 |
||
4719 |
abbrev := self filenameAbbreviations at:fileName ifAbsent:[nil]. |
|
4720 |
abbrev notNil ifTrue:[^ abbrev]. |
|
4721 |
||
4722 |
"no abbreviation found - if its a short name, take it" |
|
4723 |
||
4724 |
OperatingSystem maxFileNameLength < (fileName size + 3) ifTrue:[ |
|
6853 | 4725 |
"this will only be triggered on sys5.3/DOS type systems" |
4726 |
('Smalltalk [info]: cant find short for ' , fileName , ' in abbreviation file') infoPrintCR. |
|
617 | 4727 |
]. |
4748 | 4728 |
|
4729 |
fileName := shortClassName asSymbol. |
|
4730 |
^ fileName asString |
|
617 | 4731 |
" |
4732 |
Smalltalk fileNameForClass:SmallInteger |
|
4733 |
Smalltalk fileNameForClass:'SmallInteger' |
|
3678 | 4734 |
Smalltalk fileNameForClass:'UnixOperatingSystem' |
4746 | 4735 |
Smalltalk fileNameForClass:'Launcher' |
617 | 4736 |
Smalltalk fileNameForClass:'SomeUnknownClass' |
4746 | 4737 |
Smalltalk fileNameForClass:OSI::FTAMOperation |
4738 |
Smalltalk fileNameForClass:'OSI::Foobar' |
|
617 | 4739 |
" |
4740 |
||
6151
e36a9b339582
isMeta/soleInstance -> theMetaclass / theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
6121
diff
changeset
|
4741 |
"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
|
4742 |
! |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
4743 |
|
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
4744 |
filenameAbbreviations |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
4745 |
"return a dictionary containing the classname-to-filename |
617 | 4746 |
mappings. (needed for sys5.3 users, where filenames are limited |
4747 |
to 14 chars)" |
|
4748 |
||
4749 |
CachedAbbreviations isNil ifTrue:[ |
|
6853 | 4750 |
self readAbbreviations |
617 | 4751 |
]. |
4752 |
^ CachedAbbreviations |
|
4753 |
||
4754 |
"flush with: |
|
4755 |
||
4756 |
CachedAbbreviations := nil |
|
4757 |
" |
|
4758 |
" |
|
4759 |
Smalltalk filenameAbbreviations |
|
4760 |
" |
|
4761 |
! |
|
4762 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
4763 |
flushPathCaches |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
4764 |
"{ Pragma: +optSpace }" |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
4765 |
|
2378 | 4766 |
"forget pathCaches - these are collections containing valid directory names, |
4767 |
where system files (resource, bitmaps etc.) are found. |
|
4768 |
A flush is only required, if a new system directory has been created while |
|
4769 |
the system is active, and those files should override the others |
|
4770 |
(for example, if you created a private resource directory)" |
|
4771 |
||
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
4772 |
RealSystemPath := ResourcePath := SourcePath := |
5052 | 4773 |
BitmapPath := BinaryPath := FileInPath := nil |
2378 | 4774 |
|
4775 |
" |
|
4776 |
Smalltalk flushPathCaches |
|
4777 |
" |
|
617 | 4778 |
! |
4779 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
4780 |
getBinaryFileName:aFileName |
617 | 4781 |
"search aFileName in some standard places |
4782 |
(subdirectories named 'binary' in SystemPath); |
|
4783 |
return the absolute filename or nil if none is found." |
|
4784 |
||
1562
850a88ecff97
searchPath: dont use it, if fileName starts with "./" or "../"
Claus Gittinger <cg@exept.de>
parents:
1553
diff
changeset
|
4785 |
BinaryPath isNil ifTrue:[ |
6853 | 4786 |
BinaryPath := self constructPathFor:BinaryDirName |
617 | 4787 |
]. |
4788 |
||
2928 | 4789 |
^ 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
|
4790 |
|
850a88ecff97
searchPath: dont use it, if fileName starts with "./" or "../"
Claus Gittinger <cg@exept.de>
parents:
1553
diff
changeset
|
4791 |
"Modified: 18.7.1996 / 15:53:49 / cg" |
453 | 4792 |
! |
4793 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
4794 |
getBitmapFileName:aFileName |
617 | 4795 |
"search aFileName in some standard places |
4796 |
(subdirectories named 'bitmaps' in SystemPath); |
|
4797 |
return the absolute filename or nil if none is found." |
|
4798 |
||
2974 | 4799 |
|f| |
4800 |
||
617 | 4801 |
BitmapPath isNil ifTrue:[ |
6853 | 4802 |
BitmapPath := self constructPathFor:BitmapDirName |
617 | 4803 |
]. |
4804 |
||
2974 | 4805 |
"/ first, try a bitmaps subdir along the path. |
4806 |
f := self searchPath:BitmapPath for:aFileName in:BitmapDirName. |
|
4807 |
f isNil ifTrue:[ |
|
6853 | 4808 |
"/ then, try it itself along the path. |
4809 |
f := self searchPath:self realSystemPath for:aFileName in:nil |
|
2974 | 4810 |
]. |
4811 |
^ f |
|
617 | 4812 |
|
4813 |
" |
|
4814 |
Smalltalk getBitmapFileName:'SBrowser.xbm' |
|
4815 |
" |
|
1562
850a88ecff97
searchPath: dont use it, if fileName starts with "./" or "../"
Claus Gittinger <cg@exept.de>
parents:
1553
diff
changeset
|
4816 |
|
850a88ecff97
searchPath: dont use it, if fileName starts with "./" or "../"
Claus Gittinger <cg@exept.de>
parents:
1553
diff
changeset
|
4817 |
"Modified: 18.7.1996 / 15:53:55 / cg" |
617 | 4818 |
! |
4819 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
4820 |
getFileInFileName:aFileName |
617 | 4821 |
"search aFileName in some standard places |
4822 |
(subdirectories named 'fileIn' in SystemPath); |
|
4823 |
return the absolute filename or nil if none is found." |
|
4824 |
||
1562
850a88ecff97
searchPath: dont use it, if fileName starts with "./" or "../"
Claus Gittinger <cg@exept.de>
parents:
1553
diff
changeset
|
4825 |
FileInPath isNil ifTrue:[ |
6853 | 4826 |
FileInPath := self constructPathFor:FileInDirName |
617 | 4827 |
]. |
4828 |
||
2928 | 4829 |
^ self searchPath:FileInPath for:aFileName in:FileInDirName |
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:53:59 / cg" |
617 | 4832 |
! |
4833 |
||
5550
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4834 |
getPackageDirectoryForPackage:aPackageID |
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4835 |
"search for a particular package; return its directory, or nil" |
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4836 |
|
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4837 |
|packageDir| |
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4838 |
|
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4839 |
packageDir := aPackageID copyReplaceAll:$: with:$/. |
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4840 |
self packagePath do:[:aPath | |
6853 | 4841 |
|dir| |
4842 |
||
4843 |
dir := aPath asFilename construct:packageDir. |
|
4844 |
(dir exists and:[dir isDirectory]) ifTrue:[^ dir]. |
|
5550
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4845 |
]. |
5785
872483483444
oops - getPackageDirectoryForPackage now cares for the case
Claus Gittinger <cg@exept.de>
parents:
5781
diff
changeset
|
4846 |
|
872483483444
oops - getPackageDirectoryForPackage now cares for the case
Claus Gittinger <cg@exept.de>
parents:
5781
diff
changeset
|
4847 |
"/ 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
|
4848 |
(aPackageID upTo:$:) = 'stx' ifTrue:[ |
6853 | 4849 |
packageDir := aPackageID copyFrom:(aPackageID indexOf:$:) + 1. |
4850 |
packageDir := '../../' , packageDir. |
|
4851 |
packageDir := packageDir asFilename. |
|
4852 |
(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
|
4853 |
]. |
5550
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4854 |
^ nil |
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4855 |
|
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4856 |
" |
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4857 |
Smalltalk getPackageDirectoryForPackage:(Array package) |
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4858 |
Smalltalk getPackageDirectoryForPackage:'stx:goodies/bitmaps' |
5785
872483483444
oops - getPackageDirectoryForPackage now cares for the case
Claus Gittinger <cg@exept.de>
parents:
5781
diff
changeset
|
4859 |
Smalltalk getPackageDirectoryForPackage:'stx:libview' |
5550
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4860 |
" |
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4861 |
! |
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4862 |
|
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
4863 |
getPackageFileName:aFileName |
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
4864 |
"search aFileName in some standard places |
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
4865 |
(packagePath and subdirectories named 'packages' in SystemPath); |
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
4866 |
return the absolute filename or nil if none is found." |
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
4867 |
|
5052 | 4868 |
|f| |
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
4869 |
|
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
4870 |
"/ search along packagePath ... |
5052 | 4871 |
f := self searchPath:self packagePath for:aFileName in:nil. |
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
4872 |
f isNil ifTrue:[ |
6853 | 4873 |
"/ search under packages-directory along systemPath ... |
4874 |
f := self searchPath:self realSystemPath for:aFileName in:PackageDirName. |
|
4875 |
"/ kludge - allow for stx-directory to be named differently |
|
4876 |
f isNil ifTrue:[ |
|
4877 |
(aFileName startsWith:'stx') ifTrue:[ |
|
4878 |
(aFileName startsWith:'stx' , Filename separator) ifTrue:[ |
|
4879 |
f := '../..' asFilename construct:(aFileName copyFrom:5). |
|
4880 |
f exists ifTrue:[ |
|
4881 |
^ f pathName |
|
4882 |
]. |
|
4883 |
] |
|
4884 |
]. |
|
4885 |
]. |
|
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
4886 |
]. |
5878
b89d789e1705
always return a string from #getPackageFileName
Claus Gittinger <cg@exept.de>
parents:
5860
diff
changeset
|
4887 |
(f notNil and:[(f := f asFilename) exists]) ifTrue:[ |
6853 | 4888 |
^ f pathName |
5878
b89d789e1705
always return a string from #getPackageFileName
Claus Gittinger <cg@exept.de>
parents:
5860
diff
changeset
|
4889 |
]. |
b89d789e1705
always return a string from #getPackageFileName
Claus Gittinger <cg@exept.de>
parents:
5860
diff
changeset
|
4890 |
^ nil |
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
4891 |
|
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
4892 |
" |
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
4893 |
Smalltalk getPackageFileName:'stx/libview/resources/normal.style' |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
4894 |
Smalltalk getPackageFileName:'stx/libview/source.zip' |
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
4895 |
" |
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
4896 |
! |
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
4897 |
|
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
4898 |
getResourceFileName:aFileName |
617 | 4899 |
"search aFileName in some standard places |
4900 |
(subdirectories named 'resource' in SystemPath); |
|
4901 |
return the absolute filename or nil if none is found." |
|
4902 |
||
2974 | 4903 |
|f| |
4904 |
||
617 | 4905 |
ResourcePath isNil ifTrue:[ |
6853 | 4906 |
ResourcePath := self constructPathFor:ResourceDirName |
617 | 4907 |
]. |
4908 |
||
2974 | 4909 |
"/ first, try a resource subdir along the path. |
4910 |
f := self searchPath:ResourcePath for:aFileName in:ResourceDirName. |
|
4911 |
f isNil ifTrue:[ |
|
6853 | 4912 |
"/ then, try it itself along the path. |
4913 |
f := self searchPath:self realSystemPath for:aFileName in:nil |
|
2974 | 4914 |
]. |
4915 |
^ f |
|
617 | 4916 |
|
4917 |
" |
|
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
4918 |
Smalltalk getResourceFileName:'SystemBrowser.rs' |
617 | 4919 |
" |
1562
850a88ecff97
searchPath: dont use it, if fileName starts with "./" or "../"
Claus Gittinger <cg@exept.de>
parents:
1553
diff
changeset
|
4920 |
|
850a88ecff97
searchPath: dont use it, if fileName starts with "./" or "../"
Claus Gittinger <cg@exept.de>
parents:
1553
diff
changeset
|
4921 |
"Modified: 18.7.1996 / 15:54:03 / cg" |
617 | 4922 |
! |
4923 |
||
5053
0d8cc1eb0545
added #getResourceFileStream:forClass:
Claus Gittinger <cg@exept.de>
parents:
5052
diff
changeset
|
4924 |
getResourceFileName:aFileName forClass:aClassOrNil |
5043 | 4925 |
"search aFileName in some standard places |
4926 |
(subdirectories named 'resource' in SystemPath); |
|
4927 |
and in aClasses package directory. |
|
4928 |
Return the absolute filename or nil if none is found." |
|
4929 |
||
5065 | 4930 |
|pkgOrNil| |
4931 |
||
4932 |
aClassOrNil notNil ifTrue:[ |
|
6853 | 4933 |
pkgOrNil := aClassOrNil package. |
5065 | 4934 |
]. |
4935 |
^ self getResourceFileName:aFileName forPackage:pkgOrNil. |
|
4936 |
||
4937 |
" |
|
4938 |
Smalltalk getResourceFileName:'SystemBrowser.rs' forClass:SystemBrowser |
|
4939 |
" |
|
4940 |
! |
|
4941 |
||
4942 |
getResourceFileName:aFileName forPackage:aPackageIDOrNil |
|
4943 |
"search aFileName in some standard places |
|
4944 |
(subdirectories named 'resource' in SystemPath); |
|
4945 |
and in a packages directory. |
|
4946 |
Return the absolute filename or nil if none is found." |
|
4947 |
||
5080 | 4948 |
|f dir packageDir| |
5043 | 4949 |
|
4950 |
f := self getResourceFileName:aFileName. |
|
4951 |
f notNil ifTrue:[^ f]. |
|
4952 |
||
5065 | 4953 |
aPackageIDOrNil notNil ifTrue:[ |
6853 | 4954 |
packageDir := aPackageIDOrNil copyReplaceAll:$: with:$/. |
4955 |
self packagePath do:[:aPath | |
|
4956 |
|pD| |
|
4957 |
||
4958 |
pD := aPath asFilename construct:packageDir. |
|
4959 |
pD exists ifTrue:[ |
|
4960 |
f := pD construct:aFileName. |
|
4961 |
f exists ifTrue:[ |
|
4962 |
^ f pathName |
|
4963 |
]. |
|
4964 |
f := (pD construct:'resources') construct:aFileName. |
|
4965 |
f exists ifTrue:[ |
|
4966 |
^ f pathName |
|
4967 |
]. |
|
4968 |
]. |
|
4969 |
]. |
|
4970 |
||
4971 |
dir := Smalltalk getPackageDirectoryForPackage:(aPackageIDOrNil ? 'stx:libview'). |
|
4972 |
dir notNil ifTrue:[ |
|
4973 |
f := (dir asFilename construct:'resources') construct:aFileName. |
|
4974 |
f exists ifTrue:[ |
|
4975 |
^ f pathName |
|
4976 |
]. |
|
4977 |
f := (dir asFilename construct:'styles') construct:aFileName. |
|
4978 |
f exists ifTrue:[ |
|
4979 |
^ f pathName |
|
4980 |
]. |
|
4981 |
]. |
|
5043 | 4982 |
]. |
4983 |
^ nil |
|
4984 |
||
4985 |
" |
|
5065 | 4986 |
Smalltalk getResourceFileName:'SystemBrowser.rs' forPackage:'stx:libtool' |
5080 | 4987 |
Smalltalk getResourceFileName:'normal.style' forPackage:'stx:libview' |
5043 | 4988 |
" |
4989 |
! |
|
4990 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
4991 |
getSourceFileName:aFileName |
617 | 4992 |
"search aFileName in some standard places |
4993 |
(subdirectories named 'source' in SystemPath); |
|
736 | 4994 |
return the absolute filename or nil if none is found. |
4995 |
This is used to find a sourceFile for a methods source, |
|
4996 |
if no sourceCodeManager is available." |
|
617 | 4997 |
|
2959 | 4998 |
|f| |
4999 |
||
617 | 5000 |
SourcePath isNil ifTrue:[ |
6853 | 5001 |
SourcePath := self constructPathFor:SourceDirName |
617 | 5002 |
]. |
5003 |
||
2959 | 5004 |
"/ first, try a source subdir along the path. |
4770 | 5005 |
SourcePath notNil ifTrue:[ |
6853 | 5006 |
f := self searchPath:SourcePath for:aFileName in:SourceDirName. |
4770 | 5007 |
]. |
2959 | 5008 |
f isNil ifTrue:[ |
6853 | 5009 |
"/ then, try it itself along the path. |
5010 |
f := self searchPath:self realSystemPath for:aFileName in:nil |
|
2959 | 5011 |
]. |
5012 |
^ f |
|
191 | 5013 |
|
5014 |
" |
|
736 | 5015 |
Smalltalk getSourceFileName:'Smalltalk.st' |
5016 |
Smalltalk getSourceFileName:'ArrColl.st' |
|
191 | 5017 |
" |
1562
850a88ecff97
searchPath: dont use it, if fileName starts with "./" or "../"
Claus Gittinger <cg@exept.de>
parents:
1553
diff
changeset
|
5018 |
|
850a88ecff97
searchPath: dont use it, if fileName starts with "./" or "../"
Claus Gittinger <cg@exept.de>
parents:
1553
diff
changeset
|
5019 |
"Modified: 18.7.1996 / 15:54:07 / cg" |
617 | 5020 |
! |
5021 |
||
2896 | 5022 |
getSystemFileName:aFileNameOrString |
5023 |
"search aFileNameOrString in some standard places; |
|
617 | 5024 |
return the absolute filename or nil if none is found. |
4150 | 5025 |
see comment in Smalltalk>>initSystemPath. |
5026 |
This should be used to access resources such as bitmaps, doc-files, |
|
5027 |
and other help files. |
|
5028 |
" |
|
617 | 5029 |
|
5030 |
"credits for this method go to Markus ...." |
|
5031 |
||
2933 | 5032 |
|fn nameString| |
2896 | 5033 |
|
5034 |
fn := aFileNameOrString asFilename. |
|
2933 | 5035 |
nameString := fn name. |
2896 | 5036 |
fn isAbsolute ifTrue:[ |
6853 | 5037 |
"dont use path for absolute file names" |
5038 |
||
5039 |
^ nameString |
|
191 | 5040 |
]. |
5041 |
||
617 | 5042 |
self realSystemPath do:[:dirName | |
6853 | 5043 |
|realName| |
5044 |
||
5045 |
realName := dirName asFilename construct:nameString. |
|
5046 |
"/ |
|
5047 |
"/ here, we also return true if its a directory |
|
5048 |
"/ (Even if unreadable). |
|
5049 |
"/ It could be that the file itself is still readable. |
|
5050 |
"/ |
|
5051 |
(realName isDirectory or:[realName isReadable]) ifTrue: [ |
|
5052 |
^ realName name |
|
5053 |
] |
|
191 | 5054 |
]. |
617 | 5055 |
^ nil |
4150 | 5056 |
|
5057 |
" |
|
5058 |
Smalltalk getSystemFileName:'doc/online/english/TOP.html' |
|
5059 |
Smalltalk getSystemFileName:'bitmaps/SBrowser.xbm' |
|
5060 |
Smalltalk getSystemFileName:'bitmaps/foo' |
|
5061 |
Smalltalk getSystemFileName:'resources/View.rs' |
|
5062 |
Smalltalk getSystemFileName:'resources/iris.style' |
|
5063 |
" |
|
5064 |
||
5065 |
"Modified: / 6.5.1999 / 10:40:37 / cg" |
|
617 | 5066 |
! |
5067 |
||
5089 | 5068 |
imageFromFileNamed:aFileName forClass:aClass |
5069 |
"search aFileName in some standard places: |
|
5070 |
first in the redefinable bitmaps path, then in the classes |
|
5071 |
own package directory if existing. |
|
5072 |
Return an image or nil." |
|
5073 |
||
5113 | 5074 |
|package nm img| |
5075 |
||
5076 |
package := aClass package. |
|
5077 |
img := self imageFromFileNamed:aFileName inPackage:package. |
|
5078 |
img isNil ifTrue:[ |
|
6853 | 5079 |
package ~= 'stx:goodies' ifTrue:[ |
5080 |
"/ try under the goodies package ... |
|
5081 |
img := Smalltalk imageFromFileNamed:aFileName inPackage:'stx:goodies'. |
|
5082 |
]. |
|
5083 |
img isNil ifTrue:[ |
|
5084 |
(aFileName startsWith:'bitmaps') ifFalse:[ |
|
5085 |
nm := 'bitmaps/' , aFileName. |
|
5086 |
img := Smalltalk imageFromFileNamed:nm forClass:self. |
|
5087 |
img isNil ifTrue:[ |
|
5088 |
img := Smalltalk imageFromFileNamed:nm inPackage:'stx:goodies'. |
|
5089 |
] |
|
5090 |
]. |
|
5091 |
||
5092 |
img isNil ifTrue:[ |
|
5093 |
img := Smalltalk imageFromFileNamed:aFileName inPackage:'stx:goodies'. |
|
5094 |
]. |
|
5095 |
] |
|
5113 | 5096 |
]. |
5097 |
^ img |
|
5089 | 5098 |
|
5099 |
" |
|
5100 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' forClass:View |
|
5101 |
" |
|
5102 |
! |
|
5103 |
||
5104 |
imageFromFileNamed:aFileName inPackage:aPackage |
|
5105 |
"search aFileName in some standard places: |
|
5106 |
first in the redefinable bitmaps path, then in the |
|
5107 |
package directory if existing. |
|
5108 |
Return an image or nil." |
|
5109 |
||
5110 |
|i f dir| |
|
5111 |
||
5112 |
i := Image fromFile:aFileName resolution:100. |
|
5860 | 5113 |
i notNil ifTrue:[^ i]. |
5114 |
||
5115 |
f := self getBitmapFileName:aFileName. |
|
5116 |
f notNil ifTrue:[ |
|
6853 | 5117 |
i := Image fromFile:f. |
5118 |
i notNil ifTrue:[^ i]. |
|
5860 | 5119 |
]. |
5120 |
dir := self projectDirectoryForPackage:aPackage. |
|
5121 |
dir isNil ifTrue:[^ nil]. |
|
5122 |
||
5123 |
((f := aFileName) startsWith:'bitmaps/') ifFalse:[ |
|
6853 | 5124 |
i := Image fromFile:(dir asFilename construct:f). |
5125 |
i notNil ifTrue:[^ i]. |
|
5860 | 5126 |
|
6853 | 5127 |
f := 'bitmaps/' , aFileName. |
5860 | 5128 |
]. |
5129 |
^ Image fromFile:(dir asFilename construct:f). |
|
5089 | 5130 |
|
5131 |
" |
|
5587
4c4d67ad0e51
avoid obsoleteMessage warning (Filename ,)
Claus Gittinger <cg@exept.de>
parents:
5580
diff
changeset
|
5132 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libview' |
4c4d67ad0e51
avoid obsoleteMessage warning (Filename ,)
Claus Gittinger <cg@exept.de>
parents:
5580
diff
changeset
|
5133 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libtool' |
4c4d67ad0e51
avoid obsoleteMessage warning (Filename ,)
Claus Gittinger <cg@exept.de>
parents:
5580
diff
changeset
|
5134 |
Smalltalk imageFromFileNamed:'bitmaps/gifImages/garfield.gif' inPackage:'stx:goodies' |
5089 | 5135 |
" |
5136 |
! |
|
5137 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
5138 |
libraryFileNameOfClass:aClassOrClassName |
617 | 5139 |
"for a given class, return the name of a classLibrary which contains |
5140 |
binary code for it. |
|
5141 |
Read the libinfo file 'liblist.stc' (which is created during the compilation process) |
|
5142 |
for an entry for aClassOrClassName. |
|
5143 |
Search for the className in the first col, and return the value found in |
|
5144 |
the 2nd col. |
|
5145 |
Return nil if no entry is found. |
|
5146 |
||
5147 |
A nil returns means that this class is either built-in or not present |
|
5148 |
in a package-class library (i.e. either as separate .o or separate .st file). |
|
5149 |
Otherwise, the returned name is the classLibrary object of that class. |
|
5150 |
The classes code can be loaded from that file if binary loading is supported." |
|
5151 |
||
5152 |
|aStream line words n aClassName| |
|
5153 |
||
5154 |
aClassOrClassName isBehavior ifTrue:[ |
|
6853 | 5155 |
aClassName := aClassOrClassName name |
617 | 5156 |
] ifFalse:[ |
6853 | 5157 |
aClassName := aClassOrClassName |
617 | 5158 |
]. |
5159 |
aClassName := aClassName asString. |
|
5160 |
||
5161 |
#('include/liblist.stc') "/ filenames |
|
5162 |
with:#(2) "/ column |
|
5163 |
do:[:fileName :col | |
|
5164 |
||
6853 | 5165 |
aStream := self systemFileStreamFor:fileName. |
5166 |
aStream notNil ifTrue:[ |
|
5167 |
[aStream atEnd] whileFalse:[ |
|
5168 |
line := aStream nextLine. |
|
5169 |
line notNil ifTrue:[ |
|
5170 |
(line startsWith:'#') ifFalse:[ |
|
5171 |
words := line asCollectionOfWords. |
|
5172 |
(n := words size) > 1 ifTrue:[ |
|
5173 |
(words at:1) = aClassName ifTrue:[ |
|
5174 |
n >= col ifTrue:[ |
|
5175 |
aStream close. |
|
5176 |
^ (words at:col) withoutSeparators |
|
5177 |
] |
|
5178 |
] |
|
5179 |
] |
|
5180 |
] |
|
5181 |
] |
|
5182 |
]. |
|
5183 |
aStream close |
|
5184 |
]. |
|
617 | 5185 |
]. |
5186 |
||
5187 |
^ nil |
|
5188 |
||
5189 |
" |
|
5190 |
Smalltalk libraryFileNameOfClass:'ClockView' |
|
5191 |
Smalltalk libraryFileNameOfClass:'Bag' |
|
5192 |
" |
|
5193 |
||
5194 |
"Modified: 6.11.1995 / 15:41:39 / cg" |
|
5195 |
! |
|
5196 |
||
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5197 |
packagePath |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5198 |
"return a collection of additional directorynames, where smalltalk |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5199 |
looks for package directories. |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5200 |
Notice, that directories named 'packages' under the systemPath are |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5201 |
always consulted - even if not in the packagePath" |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5202 |
|
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5203 |
^ PackagePath |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5204 |
|
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5205 |
" |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5206 |
Smalltalk packagePath |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5207 |
Smalltalk packagePath addLast:'/opt/smalltalk' |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5208 |
Smalltalk packagePath addFirst:'/usr/local/otherPackages' |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5209 |
" |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5210 |
! |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5211 |
|
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5212 |
packagePath:aPath |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5213 |
"set the packagePath; |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5214 |
a collection of additional directorynames, where smalltalk |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5215 |
looks for package directories. |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5216 |
Notice, that directories named 'packages' under the systemPath are |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5217 |
always consulted - even if not in the packagePath" |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5218 |
|
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5219 |
PackagePath := aPath asOrderedCollection |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5220 |
|
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5221 |
" |
6852
7e4ea7876711
more changes for better standAlone operation
Claus Gittinger <cg@exept.de>
parents:
6851
diff
changeset
|
5222 |
Smalltalk packagePath:#( '.' '/opt/stx' '/opt/smalltalk' '/usr/local/otherPackages') |
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5223 |
" |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5224 |
! |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5225 |
|
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5226 |
projectDirectoryForClass:aClass |
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5227 |
"given a class, return the path to its package directory; |
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5228 |
nil if not found." |
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5229 |
|
5040 | 5230 |
|pkg| |
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5231 |
|
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5232 |
pkg := aClass package. |
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5233 |
pkg isNil ifTrue:[^ nil]. |
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5234 |
|
5040 | 5235 |
^ self projectDirectoryForPackage:pkg. |
5236 |
||
5237 |
" |
|
5238 |
Smalltalk projectDirectoryForClass:Array |
|
5239 |
Smalltalk projectDirectoryForClass:View |
|
5240 |
" |
|
5241 |
! |
|
5242 |
||
5243 |
projectDirectoryForPackage:aPackage |
|
5244 |
"given a packageID, return the path to its package directory; |
|
5245 |
nil if not found." |
|
5246 |
||
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
5247 |
|prj prjDir| |
5040 | 5248 |
|
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5249 |
"/ there might be a package specific resource directory ... |
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5250 |
"/ in the directory, from which the project was loaded |
5040 | 5251 |
prj := Project projectWithId:aPackage. |
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5252 |
prj notNil ifTrue:[ |
6853 | 5253 |
prjDir := prj directory. |
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5254 |
]. |
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5255 |
(prjDir notNil and:[prjDir asFilename exists]) ifFalse:[ |
6853 | 5256 |
prjDir := Smalltalk getPackageFileName:(aPackage copyReplaceAll:$: with:$/). |
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5257 |
]. |
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5258 |
^ prjDir |
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5259 |
|
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5260 |
" |
5040 | 5261 |
Smalltalk projectDirectoryForPackage:'stx:libbasic' |
5262 |
Smalltalk projectDirectoryForPackage:'exept:smartcard' |
|
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5263 |
" |
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5264 |
! |
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5265 |
|
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
5266 |
readAbbreviations |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
5267 |
"read classname to filename mappings from include/abbrev.stc. |
617 | 5268 |
sigh - all for those poor sys5.3 or MSDOS people with short filenames ..." |
5269 |
||
5067
335c866e150c
walk packagePath when reading abbrevs & autoloaded classes.
Claus Gittinger <cg@exept.de>
parents:
5065
diff
changeset
|
5270 |
|aStream f dirsConsulted| |
4420 | 5271 |
|
5272 |
CachedAbbreviations := IdentityDictionary new. |
|
5273 |
||
4458 | 5274 |
"/ new scheme: look for a directory called 'packages' |
5275 |
"/ and enumerate its abbrev.stc files... |
|
5067
335c866e150c
walk packagePath when reading abbrevs & autoloaded classes.
Claus Gittinger <cg@exept.de>
parents:
5065
diff
changeset
|
5276 |
dirsConsulted := Set new. |
4458 | 5277 |
f := Smalltalk getSystemFileName:'packages'. |
5278 |
f notNil ifTrue:[ |
|
6853 | 5279 |
f := f asFilename. |
5280 |
f isDirectory ifTrue:[ |
|
5281 |
('Smalltalk [info]: reading all class abbreviations found under ''' , f pathName ,'''') infoPrintCR. |
|
5282 |
self recursiveReadAllAbbreviationsFrom:f. |
|
5283 |
dirsConsulted add:f pathName. |
|
5284 |
]. |
|
4458 | 5285 |
]. |
5286 |
||
5067
335c866e150c
walk packagePath when reading abbrevs & autoloaded classes.
Claus Gittinger <cg@exept.de>
parents:
5065
diff
changeset
|
5287 |
"/ and along the package-path |
335c866e150c
walk packagePath when reading abbrevs & autoloaded classes.
Claus Gittinger <cg@exept.de>
parents:
5065
diff
changeset
|
5288 |
self packagePath do:[:aPath | |
6853 | 5289 |
(dirsConsulted includes:aPath) ifFalse:[ |
5290 |
('Smalltalk [info]: reading all class abbreviations found under ''' , aPath ,'''') infoPrintCR. |
|
5291 |
self recursiveReadAllAbbreviationsFrom:aPath. |
|
5292 |
dirsConsulted add:aPath |
|
5293 |
] |
|
5067
335c866e150c
walk packagePath when reading abbrevs & autoloaded classes.
Claus Gittinger <cg@exept.de>
parents:
5065
diff
changeset
|
5294 |
]. |
335c866e150c
walk packagePath when reading abbrevs & autoloaded classes.
Claus Gittinger <cg@exept.de>
parents:
5065
diff
changeset
|
5295 |
|
4458 | 5296 |
"/ old scheme: look for a single file called 'abbrev.stc' in the |
5297 |
"/ include directory. This will vanish. |
|
5298 |
||
617 | 5299 |
aStream := self systemFileStreamFor:'include/abbrev.stc'. |
5300 |
aStream notNil ifTrue:[ |
|
6853 | 5301 |
('Smalltalk [info]: reading additional abbreviations from ''' , aStream pathName ,'''') infoPrintCR. |
5302 |
self readAbbreviationsFromStream:aStream. |
|
5303 |
aStream close. |
|
5262 | 5304 |
"/ ] ifFalse:[ |
5305 |
"/ ('Smalltalk [warning]: no global''include/abbrev.stc'' file found') infoPrintCR |
|
617 | 5306 |
]. |
4420 | 5307 |
^ CachedAbbreviations |
191 | 5308 |
|
5309 |
" |
|
617 | 5310 |
Smalltalk readAbbreviations |
191 | 5311 |
" |
617 | 5312 |
|
5091 | 5313 |
"Modified: / 10.12.1999 / 17:48:53 / cg" |
617 | 5314 |
! |
5315 |
||
4458 | 5316 |
readAbbreviationsFromStream:aStream |
4420 | 5317 |
"read classname to filename mappings from aStream. |
5318 |
sigh - all for those poor sys5.3 or MSDOS people with short filenames ..." |
|
5319 |
||
5095
9bbf3cf594e5
no warning for same-abbrev, if packages differ.
Claus Gittinger <cg@exept.de>
parents:
5093
diff
changeset
|
5320 |
|abbrevs line words nm abbrev pkg key oldAbbrev cls s w| |
4420 | 5321 |
|
5322 |
abbrevs := CachedAbbreviations. |
|
5323 |
||
5324 |
[aStream atEnd] whileFalse:[ |
|
6853 | 5325 |
line := aStream nextLine. |
5326 |
line notNil ifTrue:[ |
|
5327 |
(line startsWith:'#') ifFalse:[ |
|
5328 |
||
5329 |
"/ must do it manually, caring for quoted strings. |
|
4685
d145298696b7
more package loading support
Claus Gittinger <cg@exept.de>
parents:
4642
diff
changeset
|
5330 |
"/ words := line asCollectionOfWords. |
d145298696b7
more package loading support
Claus Gittinger <cg@exept.de>
parents:
4642
diff
changeset
|
5331 |
|
6853 | 5332 |
words := OrderedCollection new. |
5333 |
s := line readStream. |
|
5334 |
[s atEnd] whileFalse:[ |
|
5335 |
s skipSeparators. |
|
5336 |
s peek == $' ifTrue:[ |
|
5337 |
s next. |
|
5338 |
w := s upTo:$'. |
|
5339 |
s skipSeparators. |
|
5340 |
] ifFalse:[ |
|
5341 |
w := s upToSeparator |
|
5342 |
]. |
|
5343 |
words add:w |
|
5344 |
]. |
|
5345 |
words size >= 3 ifTrue:[ |
|
5346 |
nm := (words at:1) withoutSeparators. |
|
5347 |
abbrev := (words at:2) withoutSeparators. |
|
5348 |
pkg := (words at:3) withoutSeparators. |
|
5349 |
nm ~= abbrev ifTrue:[ |
|
5350 |
key := nm asSymbol. |
|
5351 |
oldAbbrev := abbrevs at:key ifAbsent:nil. |
|
5352 |
oldAbbrev notNil ifTrue:[ |
|
5353 |
oldAbbrev ~= abbrev ifTrue:[ |
|
5354 |
StandAlone ifFalse:[ |
|
5355 |
('Smalltalk [warning]: conflict for: ' , nm , ' in ' , (aStream pathName)) infoPrintCR. |
|
5356 |
('Smalltalk [warning]: (' , oldAbbrev , ' <-> ' , abbrev , ')') infoPrintCR |
|
5357 |
] |
|
5358 |
]. |
|
5359 |
] ifFalse:[ |
|
5360 |
cls := self classNamed:abbrev. |
|
5361 |
||
5362 |
cls notNil ifTrue:[ |
|
5363 |
cls name ~= nm ifTrue:[ |
|
5364 |
"/ ok, there is a class named after this abbrev ... |
|
5365 |
"/ this is only a conflict, if the other class has no |
|
5366 |
"/ abbreviation (or the same). |
|
5367 |
(abbrevs at:(cls name asSymbol) ifAbsent:cls name) = abbrev ifTrue:[ |
|
5368 |
cls isNameSpace ifFalse:[ |
|
5369 |
pkg = cls package ifTrue:[ |
|
5370 |
StandAlone ifFalse:[ |
|
5371 |
('Smalltalk [warning]: conflict for: ' , cls name , ' in ' , (aStream pathName)) infoPrintCR. |
|
5372 |
('Smalltalk [warning]: (' , nm , ' -> ' , abbrev , ')') infoPrintCR |
|
5373 |
] |
|
5374 |
] |
|
5375 |
] |
|
5376 |
] |
|
5377 |
] |
|
5378 |
]. |
|
5379 |
abbrevs at:nm asSymbol put:abbrev. |
|
5380 |
] |
|
5381 |
] |
|
5382 |
] ifFalse:[ |
|
5383 |
('Smalltalk [warning]: malformed line in ' , (aStream pathName)) infoPrintCR. |
|
5384 |
] |
|
5385 |
] |
|
5386 |
] |
|
4420 | 5387 |
]. |
5091 | 5388 |
|
5095
9bbf3cf594e5
no warning for same-abbrev, if packages differ.
Claus Gittinger <cg@exept.de>
parents:
5093
diff
changeset
|
5389 |
"Modified: / 13.12.1999 / 11:54:17 / cg" |
4420 | 5390 |
! |
5391 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
5392 |
realSystemPath |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
5393 |
"return the realSystemPath - thats the directorynames from |
617 | 5394 |
SystemPath which exist and are readable" |
5395 |
||
5044 | 5396 |
|nP| |
5397 |
||
617 | 5398 |
RealSystemPath isNil ifTrue:[ |
6853 | 5399 |
OperatingSystem isVMSlike ifTrue:[ |
5400 |
"/ temporary kludge: since we cannot currently |
|
5401 |
"/ check for existance of a name like 'volume:', |
|
5402 |
"/ leave those in the Path without a check. |
|
5403 |
RealSystemPath := SystemPath select:[:dirName | |
|
5404 |
|f| |
|
5405 |
||
5406 |
f := dirName asFilename. |
|
5407 |
f isVolumeOnly ifTrue:[ |
|
5408 |
true |
|
5409 |
] ifFalse:[ |
|
5410 |
(f isDirectory) and:[f isReadable] |
|
5411 |
] |
|
5412 |
] |
|
5413 |
] ifFalse:[ |
|
5414 |
RealSystemPath := SystemPath select:[:dirName | |
|
5415 |
|f| |
|
5416 |
||
5417 |
f := dirName asFilename. |
|
5418 |
(f isDirectory) and:[f isReadable] |
|
5419 |
]. |
|
5420 |
RealSystemPath := RealSystemPath collect:[:dirName | |
|
5421 |
|f| |
|
5422 |
||
5423 |
f := dirName asFilename pathName. |
|
5424 |
]. |
|
5425 |
"/ remove duplicates (but keep order) |
|
5426 |
nP := OrderedCollection new. |
|
5427 |
RealSystemPath do:[:p | |
|
5428 |
(nP includes:p) ifFalse:[ |
|
5429 |
nP add:p |
|
5430 |
] |
|
5431 |
]. |
|
5432 |
RealSystemPath := nP. |
|
5433 |
]. |
|
617 | 5434 |
]. |
5435 |
^ RealSystemPath |
|
5436 |
! |
|
5437 |
||
4458 | 5438 |
recursiveReadAllAbbreviationsFrom:aDirectory |
7286 | 5439 |
self recursiveReadAllAbbreviationsFrom:aDirectory maxLevels:15 |
4957 | 5440 |
! |
5441 |
||
5442 |
recursiveReadAllAbbreviationsFrom:aDirectory maxLevels:maxLevels |
|
4458 | 5443 |
"read all abbreviations from and under aDirectory." |
5444 |
||
7085
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5445 |
|abbrevStream dir directoryContents| |
4458 | 5446 |
|
5075 | 5447 |
maxLevels == 0 ifTrue:[ |
5077 | 5448 |
"/ 'Smalltalk [warning]: max directory nesting reached.' infoPrintCR. |
7085
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5449 |
^ self |
5075 | 5450 |
]. |
4957 | 5451 |
|
4458 | 5452 |
dir := aDirectory asFilename. |
5057 | 5453 |
dir exists ifFalse:[^ self]. |
4458 | 5454 |
|
7085
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5455 |
[ |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5456 |
abbrevStream := (dir construct:'abbrev.stc') asFilename readStream. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5457 |
self readAbbreviationsFromStream:abbrevStream. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5458 |
abbrevStream close. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5459 |
] 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
|
5460 |
|
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5461 |
[ |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5462 |
directoryContents := dir directoryContents. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5463 |
] on:FileStream openErrorSignal do:[:ex| |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5464 |
"non-accessable directory: we are done" |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5465 |
^ self |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5466 |
]. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5467 |
|
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5468 |
directoryContents do:[:aFilename | |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5469 |
|f| |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5470 |
|
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5471 |
(#( |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5472 |
'doc' |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5473 |
'CVS' |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5474 |
'bitmaps' |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5475 |
'resources' |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5476 |
'source' |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5477 |
) includes:aFilename) ifFalse:[ |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5478 |
f := dir construct:aFilename. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5479 |
f isDirectory ifTrue:[ |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5480 |
self recursiveReadAllAbbreviationsFrom:f maxLevels:maxLevels-1 |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5481 |
] |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5482 |
]. |
4458 | 5483 |
]. |
5484 |
! |
|
5485 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
5486 |
resourceFileStreamFor:aFileName |
617 | 5487 |
"search aFileName in some standard places; |
5488 |
return a readonly fileStream or nil if not found. |
|
5489 |
Searches in subdirectories named 'resource' in SystemPath" |
|
5490 |
||
5053
0d8cc1eb0545
added #getResourceFileStream:forClass:
Claus Gittinger <cg@exept.de>
parents:
5052
diff
changeset
|
5491 |
^ self resourceFileStreamFor:aFileName forClass:nil |
0d8cc1eb0545
added #getResourceFileStream:forClass:
Claus Gittinger <cg@exept.de>
parents:
5052
diff
changeset
|
5492 |
! |
0d8cc1eb0545
added #getResourceFileStream:forClass:
Claus Gittinger <cg@exept.de>
parents:
5052
diff
changeset
|
5493 |
|
0d8cc1eb0545
added #getResourceFileStream:forClass:
Claus Gittinger <cg@exept.de>
parents:
5052
diff
changeset
|
5494 |
resourceFileStreamFor:aFileName forClass:aClassOrNil |
0d8cc1eb0545
added #getResourceFileStream:forClass:
Claus Gittinger <cg@exept.de>
parents:
5052
diff
changeset
|
5495 |
"search aFileName in some standard places and in the classes |
0d8cc1eb0545
added #getResourceFileStream:forClass:
Claus Gittinger <cg@exept.de>
parents:
5052
diff
changeset
|
5496 |
package-resource directory. |
0d8cc1eb0545
added #getResourceFileStream:forClass:
Claus Gittinger <cg@exept.de>
parents:
5052
diff
changeset
|
5497 |
Return a readonly fileStream or nil if not found. |
0d8cc1eb0545
added #getResourceFileStream:forClass:
Claus Gittinger <cg@exept.de>
parents:
5052
diff
changeset
|
5498 |
Searches in subdirectories named 'resource' in SystemPath" |
0d8cc1eb0545
added #getResourceFileStream:forClass:
Claus Gittinger <cg@exept.de>
parents:
5052
diff
changeset
|
5499 |
|
617 | 5500 |
|aString| |
5501 |
||
5053
0d8cc1eb0545
added #getResourceFileStream:forClass:
Claus Gittinger <cg@exept.de>
parents:
5052
diff
changeset
|
5502 |
aString := self getResourceFileName:aFileName forClass:aClassOrNil. |
617 | 5503 |
aString notNil ifTrue:[ |
7085
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5504 |
^ aString asFilename readStreamOrNil |
617 | 5505 |
]. |
5506 |
^ nil |
|
5507 |
! |
|
5508 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
5509 |
searchPath:aPath for:aFileName in:aDirName |
617 | 5510 |
"search aPath for a subdirectory named aDirectory with a file |
5511 |
named aFileName" |
|
5512 |
||
2928 | 5513 |
|f| |
5514 |
||
5515 |
((f := aFileName asFilename) isAbsolute |
|
5516 |
or:[f isExplicitRelative]) ifTrue:[ |
|
6853 | 5517 |
"/ |
5518 |
"/ dont use path for absolute or explicit .-relative file names |
|
5519 |
"/ |
|
5520 |
^ aFileName |
|
5786
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
5521 |
]. |
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
5522 |
|
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
5523 |
aPath notNil ifTrue:[ |
6853 | 5524 |
aPath do:[:dirName | |
5525 |
|realName dir| |
|
5526 |
||
5527 |
dir := dirName asFilename. |
|
5528 |
aDirName notNil ifTrue:[ |
|
5529 |
realName := (dir construct:aDirName) construct:aFileName. |
|
5530 |
] ifFalse:[ |
|
5531 |
realName := dir construct:aFileName. |
|
5532 |
]. |
|
5533 |
(realName isReadable) ifTrue:[ |
|
5534 |
^ realName name |
|
5535 |
] |
|
5536 |
]. |
|
5786
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
5537 |
]. |
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
5538 |
|
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
5539 |
^ nil. |
1562
850a88ecff97
searchPath: dont use it, if fileName starts with "./" or "../"
Claus Gittinger <cg@exept.de>
parents:
1553
diff
changeset
|
5540 |
|
4129
15c7aac46056
#isReadable is ok as check - no need for #exists
Claus Gittinger <cg@exept.de>
parents:
4113
diff
changeset
|
5541 |
"Modified: / 29.4.1999 / 15:06:43 / cg" |
617 | 5542 |
! |
5543 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
5544 |
sourceDirectoryNameOfClass:aClassOrClassName |
617 | 5545 |
"for a given class, return the pathname relative to TOP of the classes source code. |
728
50cf1c907c28
again search liblist for a classes source directory
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
5546 |
Read the files 'abbrev.stc' and 'liblist.stc' (which are created during the compilation process) |
617 | 5547 |
for an entry for aClassOrClassName. |
5548 |
Search for the className in the first col, and return the value found in |
|
5549 |
the 3rd col. |
|
5550 |
Return nil if no entry is found." |
|
5551 |
||
5552 |
|aStream line words n aClassName| |
|
5553 |
||
5554 |
aClassOrClassName isBehavior ifTrue:[ |
|
6853 | 5555 |
aClassName := aClassOrClassName name |
617 | 5556 |
] ifFalse:[ |
6853 | 5557 |
aClassName := aClassOrClassName |
191 | 5558 |
]. |
617 | 5559 |
aClassName := aClassName asString. |
5560 |
||
728
50cf1c907c28
again search liblist for a classes source directory
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
5561 |
#('include/abbrev.stc' 'include/liblist.stc') "/ filenames |
50cf1c907c28
again search liblist for a classes source directory
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
5562 |
with:#(3 2) "/ column |
617 | 5563 |
do:[:fileName :col | |
5564 |
||
6853 | 5565 |
aStream := self systemFileStreamFor:fileName. |
5566 |
aStream notNil ifTrue:[ |
|
5567 |
[aStream atEnd] whileFalse:[ |
|
5568 |
line := aStream nextLine. |
|
5569 |
line notNil ifTrue:[ |
|
5570 |
(line startsWith:'#') ifFalse:[ |
|
5571 |
words := line asCollectionOfWords. |
|
5572 |
(n := words size) > 1 ifTrue:[ |
|
5573 |
(words at:1) = aClassName ifTrue:[ |
|
5574 |
n >= col ifTrue:[ |
|
5575 |
aStream close. |
|
5576 |
^ (words at:col) withoutSeparators |
|
5577 |
] |
|
5578 |
] |
|
5579 |
] |
|
5580 |
] |
|
5581 |
] |
|
5582 |
]. |
|
5583 |
aStream close |
|
5584 |
]. |
|
617 | 5585 |
]. |
5586 |
||
5587 |
^ nil |
|
191 | 5588 |
|
5589 |
" |
|
617 | 5590 |
Smalltalk sourceDirectoryNameOfClass:'ClockView' |
5591 |
Smalltalk sourceDirectoryNameOfClass:'Bag' |
|
5592 |
Smalltalk sourceDirectoryNameOfClass:'GLWireCubeDemoView' |
|
5593 |
Smalltalk sourceDirectoryNameOfClass:'SomeNonExistingClass' |
|
5594 |
" |
|
5595 |
||
5596 |
"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
|
5597 |
"Modified: 9.12.1995 / 23:54:14 / cg" |
2033 | 5598 |
"Modified: 3.1.1997 / 11:26:44 / stefan" |
617 | 5599 |
! |
5600 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
5601 |
sourceFileStreamFor:aFileName |
617 | 5602 |
"search aFileName in some standard places; |
5603 |
return a readonly fileStream or nil if not found. |
|
5604 |
Searches in subdirectories named 'source' in SystemPath" |
|
5605 |
||
5606 |
|aString| |
|
5607 |
||
5608 |
aString := self getSourceFileName:aFileName. |
|
5609 |
aString notNil ifTrue:[ |
|
7085
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5610 |
^ aString asFilename readStreamOrNil |
617 | 5611 |
]. |
5612 |
^ nil |
|
5613 |
! |
|
5614 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
5615 |
systemFileStreamFor:aFileName |
617 | 5616 |
"search aFileName in some standard places; |
5617 |
return a readonly fileStream or nil if not found. |
|
5618 |
see comment in Smalltalk>>initSystemPath" |
|
5619 |
||
5620 |
|aString| |
|
5621 |
||
5622 |
aString := self getSystemFileName:aFileName. |
|
5623 |
aString notNil ifTrue:[ |
|
7085
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5624 |
^ aString asFilename readStreamOrNil |
617 | 5625 |
]. |
5626 |
^ nil |
|
5627 |
! |
|
5628 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
5629 |
systemPath |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
5630 |
"return a collection of directorynames, where smalltalk |
617 | 5631 |
looks for system files |
5632 |
(usually in subdirs such as resources, bitmaps, source etc.) |
|
5633 |
see comment in Smalltalk>>initSystemPath." |
|
5634 |
||
5635 |
^ SystemPath |
|
5636 |
||
5637 |
" |
|
5638 |
Smalltalk systemPath |
|
5639 |
Smalltalk systemPath addLast:'someOtherDirectoryPath' |
|
5640 |
" |
|
5641 |
! |
|
5642 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
5643 |
systemPath:aPath |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
5644 |
"set the collection of directorynames, where smalltalk |
617 | 5645 |
looks for system files |
5646 |
(usually in subdirs such as resources, bitmaps, source etc.) |
|
5647 |
see comment in Smalltalk>>initSystemPath." |
|
5648 |
||
5649 |
SystemPath := aPath. |
|
5650 |
self flushPathCaches |
|
5651 |
||
5652 |
" |
|
5653 |
Smalltalk systemPath |
|
5654 |
Smalltalk systemPath:(Smalltalk systemPath copy addLast:'someOtherDirectoryPath') |
|
191 | 5655 |
" |
1 | 5656 |
! ! |
2 | 5657 |
|
4718 | 5658 |
!Smalltalk class methodsFor:'system management-packages'! |
5659 |
||
5112 | 5660 |
knownPackages |
5661 |
^ KnownPackages ? #() |
|
5662 |
! |
|
5663 |
||
7281 | 5664 |
loadExtensionsForPackage:aPackageId |
5665 |
|packageDirName| |
|
5666 |
||
5667 |
packageDirName := aPackageId copyReplaceAll:$: with:$/. |
|
5668 |
||
5669 |
packageDirName := self getPackageFileName:packageDirName. |
|
5670 |
packageDirName isNil ifTrue:[ |
|
5671 |
^ false |
|
5672 |
]. |
|
5673 |
^ self loadExtensionsFromDirectory:packageDirName |
|
5674 |
! |
|
5675 |
||
5676 |
loadExtensionsFromDirectory:packageDirOrString |
|
5677 |
|packageDir f| |
|
5678 |
||
5679 |
packageDir := packageDirOrString asFilename. |
|
5680 |
||
5681 |
f := packageDir construct:'extensions.st'. |
|
5682 |
f exists ifTrue:[ |
|
5683 |
f fileIn. |
|
5684 |
SilentLoading ifFalse:[ |
|
5685 |
Transcript showCR:('loaded extensions: ' , f pathName). |
|
5686 |
]. |
|
5687 |
^ true |
|
5688 |
]. |
|
5689 |
^ false |
|
5690 |
! |
|
5691 |
||
4718 | 5692 |
loadPackage:aPackageIdOrPackage |
4741 | 5693 |
"make certain, that some particular package is loaded into the system. |
5694 |
Experimental." |
|
4718 | 5695 |
|
5696 |
(aPackageIdOrPackage isSymbol |
|
5697 |
or:[aPackageIdOrPackage isString]) ifTrue:[ |
|
6853 | 5698 |
^ self loadPackageWithId:aPackageIdOrPackage asAutoloaded:false |
6851 | 5699 |
]. |
5700 |
self shouldImplement. |
|
4718 | 5701 |
|
5702 |
" |
|
5703 |
Smalltalk loadPackage:'stx:libbasic' |
|
5704 |
Smalltalk loadPackage:'stx:goodies/persistency' |
|
5705 |
Smalltalk loadPackage:'cg:cparser' |
|
5706 |
Smalltalk loadPackage:'cg:rose' |
|
5707 |
" |
|
5708 |
! |
|
5709 |
||
5710 |
loadPackage:packageId fromAllSourceFilesInDirectory:aDirectory |
|
5711 |
"load all source files found in aDirectory and treat them like |
|
4741 | 5712 |
a package. Allows for initial import of alien ST-code as a new package. |
5713 |
Experimental." |
|
4718 | 5714 |
|
5715 |
|p t new anyFail| |
|
5716 |
||
5717 |
"/ problem: dependencies. |
|
5718 |
"/ solution: repeat twice, so that superclasses are present the second time |
|
5719 |
||
5720 |
Class packageQuerySignal answer:packageId asSymbol do:[ |
|
6853 | 5721 |
|any| |
5722 |
||
5723 |
2 timesRepeat:[ |
|
5724 |
anyFail := false. |
|
5725 |
aDirectory directoryContents do:[:file | |
|
5726 |
|fn| |
|
5727 |
||
5728 |
fn := aDirectory construct:file. |
|
5729 |
(fn hasSuffix:'st') ifTrue:[ |
|
5730 |
Metaclass confirmationQuerySignal answer:false do:[ |
|
5731 |
(self fileIn:fn) ifFalse:[ |
|
5732 |
anyFail := true |
|
5733 |
] ifTrue:[ |
|
5734 |
any := true. |
|
5735 |
] |
|
5736 |
] |
|
5737 |
] |
|
5738 |
]. |
|
5739 |
any ifFalse:[ |
|
5740 |
^ false "/ no file found |
|
5741 |
] |
|
5742 |
]. |
|
4718 | 5743 |
]. |
5744 |
||
5745 |
new := (p := Project projectWithId:packageId) isNil. |
|
5746 |
new ifTrue:[ p := Project new]. |
|
5747 |
||
5748 |
p name:packageId. |
|
5749 |
p directory:aDirectory. |
|
4726 | 5750 |
p package:packageId. |
4718 | 5751 |
t := packageId asCollectionOfSubstringsSeparatedByAny:'/\:'. |
5752 |
p repositoryModule:(t first). |
|
5753 |
p repositoryDirectory:(packageId copyFrom:t first size + 2). |
|
5754 |
p isLoaded:true. |
|
5755 |
||
5756 |
new ifTrue:[Project addLoadedProject:p]. |
|
5757 |
^ anyFail not |
|
5758 |
||
5759 |
! |
|
5760 |
||
4723 | 5761 |
loadPackage:packageId fromClassLibrary:aFilename |
4741 | 5762 |
"load a package from a compiled classLib. |
5763 |
Experimental." |
|
4723 | 5764 |
|
5765 |
|p t new| |
|
5766 |
||
5767 |
(self fileIn:aFilename) ifFalse:[ |
|
6853 | 5768 |
(self fileInClassLibrary:aFilename) ifFalse:[ |
5769 |
self warn:'Failed to load the package ', packageId printString. |
|
5770 |
^ false. |
|
5771 |
] |
|
4723 | 5772 |
]. |
5773 |
||
5774 |
new := (p := Project projectWithId:packageId) isNil. |
|
5775 |
new ifTrue:[ p := Project new]. |
|
5776 |
||
5777 |
p name:packageId. |
|
5778 |
p directory:aFilename directory. |
|
4726 | 5779 |
p package:packageId. |
4723 | 5780 |
t := packageId asCollectionOfSubstringsSeparatedByAny:'/\:'. |
5781 |
p repositoryModule:(t first). |
|
5782 |
p repositoryDirectory:(packageId copyFrom:t first size + 2). |
|
5783 |
p isLoaded:true. |
|
5784 |
||
5785 |
new ifTrue:[Project addLoadedProject:p]. |
|
5786 |
^ true |
|
5787 |
! |
|
5788 |
||
4718 | 5789 |
loadPackage:packageId fromLoadAllFile:aFilename |
4741 | 5790 |
"load a package from a loadAll - loader script. |
5791 |
Experimental." |
|
4718 | 5792 |
|
5793 |
|p t new| |
|
5794 |
||
4846
6fbaeb342ec6
do not open confirmers when loading a package
Claus Gittinger <cg@exept.de>
parents:
4781
diff
changeset
|
5795 |
Metaclass confirmationQuerySignal answer:false |
6fbaeb342ec6
do not open confirmers when loading a package
Claus Gittinger <cg@exept.de>
parents:
4781
diff
changeset
|
5796 |
do:[ |
6853 | 5797 |
(self fileIn:aFilename) ifFalse:[ |
5798 |
self warn:'Failed to load the package ', packageId printString. |
|
5799 |
^ false. |
|
5800 |
] |
|
4718 | 5801 |
]. |
5802 |
||
5803 |
new := (p := Project projectWithId:packageId) isNil. |
|
5804 |
new ifTrue:[ p := Project new]. |
|
5805 |
||
5806 |
p name:packageId. |
|
5807 |
p directory:aFilename directory. |
|
4726 | 5808 |
p package:packageId. |
4718 | 5809 |
t := packageId asCollectionOfSubstringsSeparatedByAny:'/\:'. |
5810 |
p repositoryModule:(t first). |
|
5811 |
p repositoryDirectory:(packageId copyFrom:t first size + 2). |
|
5812 |
p isLoaded:true. |
|
5813 |
||
5814 |
new ifTrue:[Project addLoadedProject:p]. |
|
5815 |
^ true |
|
5816 |
! |
|
5817 |
||
4722 | 5818 |
loadPackage:aPackageId fromProjectFile:f asAutoloaded:doLoadAsAutoloaded |
4741 | 5819 |
"load a package from a .prj spec. |
5820 |
Experimental." |
|
5821 |
||
4756
76982048a91a
first try to load package from prj file.
Claus Gittinger <cg@exept.de>
parents:
4748
diff
changeset
|
5822 |
|
5601 | 5823 |
"/ not yet implemented ... |
5824 |
^ false. |
|
5825 |
||
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
5826 |
"/ |prj fn| |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
5827 |
"/ |
5601 | 5828 |
"/ prj := Project new loadFromProjectFile:f asFilename pathName. |
5829 |
"/ "/ no - also allow for applications to be loaded this way |
|
5830 |
"/ "/ prj type == #library ifFalse:[ ^ false]. |
|
5831 |
"/ self halt. |
|
5832 |
"/ "/ load all prerequisites ... |
|
5833 |
"/ prj prerequisites do:[:aRequiredPackage | |
|
5834 |
"/ self halt. |
|
5835 |
"/ ]. |
|
5836 |
"/ |
|
5837 |
"/ "/ see if there is a class library ... |
|
5838 |
"/ fn := prj directory asFilename construct:(prj name , ObjectFileLoader sharedLibraryExtension). |
|
5839 |
"/ fn exists ifTrue:[ |
|
5840 |
"/ "/ load that classLibrary ... |
|
5841 |
"/ self fileIn:fn pathName. |
|
5842 |
"/ ]. |
|
5843 |
"/ |
|
5844 |
"/ "/ now, for all other classes, file-them in |
|
5845 |
"/ "/ or declare as autoloaded ... |
|
5846 |
"/ |
|
5847 |
"/ prj classes do:[:aClassOrName | |ns| |
|
5848 |
"/ aClassOrName isBehavior ifFalse:[ |
|
5849 |
"/ ((self includesKey:aClassOrName) not |
|
5850 |
"/ and:[(ns := prj defaultNameSpace) isNil |
|
5851 |
"/ or:[ns == self |
|
5852 |
"/ or:[(ns includesKey:aClassOrName) not]]]) |
|
5853 |
"/ ifTrue:[ |
|
5854 |
"/ "/ must load a corresponding source or cls-file |
|
5855 |
"/ self halt. |
|
5856 |
"/ ] |
|
5857 |
"/ ] |
|
5858 |
"/ ]. |
|
5859 |
"/ prj isLoaded:true. |
|
5860 |
"/ prj directory:f asFilename directoryName. |
|
5861 |
"/ Project addLoadedProject:prj. |
|
5862 |
"/ ^ true |
|
4756
76982048a91a
first try to load package from prj file.
Claus Gittinger <cg@exept.de>
parents:
4748
diff
changeset
|
5863 |
|
76982048a91a
first try to load package from prj file.
Claus Gittinger <cg@exept.de>
parents:
4748
diff
changeset
|
5864 |
" |
76982048a91a
first try to load package from prj file.
Claus Gittinger <cg@exept.de>
parents:
4748
diff
changeset
|
5865 |
Smalltalk loadPackage:'exept:osi/asn1' |
76982048a91a
first try to load package from prj file.
Claus Gittinger <cg@exept.de>
parents:
4748
diff
changeset
|
5866 |
Smalltalk |
6853 | 5867 |
loadPackage:'exept:osi/asn1' |
5868 |
fromProjectFile:'../../../exept/osi/asn1/asn1.prj' |
|
5869 |
asAutoloaded:false |
|
4756
76982048a91a
first try to load package from prj file.
Claus Gittinger <cg@exept.de>
parents:
4748
diff
changeset
|
5870 |
" |
4722 | 5871 |
! |
5872 |
||
5873 |
loadPackage:aPackageId fromZIPArchive:f asAutoloaded:doLoadAsAutoloaded |
|
4741 | 5874 |
"load a package from a .zip delivery file. |
5875 |
Experimental." |
|
5876 |
||
5601 | 5877 |
"/ not yet implemented ... |
4722 | 5878 |
^ false |
5879 |
! |
|
5880 |
||
4718 | 5881 |
loadPackageWithId:aPackageId |
4741 | 5882 |
"make certain, that some particular package is loaded into the system. |
5883 |
Experimental." |
|
5884 |
||
4718 | 5885 |
|
5886 |
^ self loadPackageWithId:aPackageId asAutoloaded:false |
|
5887 |
||
5888 |
" |
|
5889 |
Smalltalk loadPackageWithId:'stx:libbasic' |
|
5890 |
Smalltalk loadPackageWithId:'stx:goodies/persistency' |
|
5891 |
Smalltalk loadPackageWithId:'cg:cparser' |
|
5892 |
Smalltalk loadPackageWithId:'cg:rose' |
|
5893 |
Smalltalk loadPackageWithId:'detemobil:smc' |
|
5894 |
" |
|
5895 |
! |
|
5896 |
||
5897 |
loadPackageWithId:aPackageId asAutoloaded:doLoadAsAutoloaded |
|
4741 | 5898 |
"make certain, that some particular package is loaded into the system. |
5899 |
Experimental." |
|
4718 | 5900 |
|
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5901 |
|pkg packageDirName packageBaseName packageDir| |
4718 | 5902 |
|
5903 |
pkg := Project projectWithId:aPackageId. |
|
5904 |
(pkg notNil and:[pkg isLoaded]) ifTrue:[ |
|
6853 | 5905 |
"/ ('Smalltalk [info]: Package ' , aPackageId , ' already loaded.') infoPrintCR. |
5906 |
(doLoadAsAutoloaded |
|
5907 |
or:[pkg areAllClassesLoaded]) ifTrue:[ |
|
5908 |
^ true |
|
5909 |
]. |
|
4718 | 5910 |
]. |
5911 |
||
5912 |
"/ ok; not yet loaded. |
|
5913 |
"/ try to locate the package; try the following: |
|
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5914 |
"/ $(packagePath)/<packageDir>/... |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5915 |
"/ $(SYSPATH)/packages/<packageDir> |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5916 |
|
4718 | 5917 |
packageDirName := aPackageId copyReplaceAll:$: with:$/. |
5918 |
packageBaseName := packageDirName asFilename baseName. |
|
5919 |
||
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5920 |
packageDir := self getPackageFileName:packageDirName. |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5921 |
packageDir isNil ifTrue:[ |
6853 | 5922 |
"/ for convenience: try ../../.. as well |
5923 |
"/ (when executing in thedevelopment environment) |
|
5924 |
packageDir := '../../..' asFilename construct:packageDirName. |
|
5925 |
packageDir exists ifTrue:[ |
|
5926 |
packageDir := packageDir pathName |
|
5927 |
] ifFalse:[ |
|
5928 |
('Smalltalk [warning]: cannot find packageDirectory: ' , packageDirName) errorPrintCR. |
|
5929 |
^ false |
|
5930 |
] |
|
4718 | 5931 |
]. |
5932 |
||
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5933 |
^ self |
6853 | 5934 |
loadPackageWithId:aPackageId |
5935 |
name:packageBaseName |
|
5936 |
fromDirectory:packageDir |
|
5937 |
asAutoloaded:doLoadAsAutoloaded |
|
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5938 |
|
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5939 |
|
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5940 |
|
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5941 |
" |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5942 |
Smalltalk loadPackageWithId:'stx:libbasic' |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5943 |
Smalltalk loadPackageWithId:'stx:goodies/persistency' |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5944 |
Smalltalk loadPackageWithId:'exept:ctypes' |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5945 |
" |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5946 |
! |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5947 |
|
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5948 |
loadPackageWithId:aPackageId name:packageName fromDirectory:packageDirOrString asAutoloaded:doLoadAsAutoloaded |
6243 | 5949 |
|f s packageDir shLibName| |
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5950 |
|
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5951 |
packageDir := packageDirOrString asFilename. |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5952 |
|
4718 | 5953 |
"/ .prj ? |
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5954 |
f := (packageDir construct:packageName) withSuffix:'prj'. |
4718 | 5955 |
f exists ifTrue:[ |
7281 | 5956 |
(self loadPackage:aPackageId fromProjectFile:f asAutoloaded:doLoadAsAutoloaded) ifTrue:[ |
5957 |
SilentLoading ifFalse:[ |
|
5958 |
Transcript showCR:('Smalltalk [info]: loaded package: ' , aPackageId , ' from project file: ' , f pathName). |
|
5959 |
]. |
|
5960 |
^ true |
|
5961 |
] |
|
4718 | 5962 |
]. |
5963 |
"/ loadAll ? |
|
5964 |
f := packageDir construct:'loadAll'. |
|
5965 |
f exists ifTrue:[ |
|
7281 | 5966 |
(self loadPackage:aPackageId fromLoadAllFile:f) ifTrue:[ |
5967 |
SilentLoading ifFalse:[ |
|
5968 |
Transcript showCR:('loaded package: ' , aPackageId , ' from loadAll file: ' , f pathName). |
|
5969 |
]. |
|
5970 |
^ true |
|
5971 |
] |
|
4718 | 5972 |
]. |
5807
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
5973 |
"/ .zip ? |
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
5974 |
f := (packageDir construct:packageName) withSuffix:'zip'. |
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
5975 |
f exists ifTrue:[ |
7281 | 5976 |
(self loadPackage:aPackageId fromZIPArchive:f asAutoloaded:doLoadAsAutoloaded) ifTrue:[ |
5977 |
SilentLoading ifFalse:[ |
|
5978 |
Transcript showCR:('loaded package: ' , aPackageId , ' from zip file: ' , f pathName). |
|
5979 |
]. |
|
5980 |
^ true |
|
5981 |
] |
|
5807
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
5982 |
]. |
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
5983 |
|
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
5984 |
shLibName := packageName , ObjectFileLoader sharedLibraryExtension. |
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
5985 |
|
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
5986 |
"/ .so ? |
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
5987 |
f := packageDir construct:shLibName. |
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
5988 |
f exists ifTrue:[ |
7281 | 5989 |
(self loadPackage:aPackageId fromClassLibrary:f) ifTrue:[ |
5990 |
SilentLoading ifFalse:[ |
|
5991 |
Transcript showCR:('loaded package: ' , aPackageId , ' from binary classLib file: ' , f pathName). |
|
5992 |
]. |
|
7290 | 5993 |
doLoadAsAutoloaded ifFalse:[ |
5994 |
"/ force autoloading... |
|
5995 |
Smalltalk allClassesDo:[:eachClass | |
|
5996 |
eachClass package == aPackageId ifTrue:[ eachClass autoload]. |
|
5997 |
]. |
|
5998 |
]. |
|
7281 | 5999 |
^ true |
7290 | 6000 |
] |
5807
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
6001 |
]. |
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
6002 |
|
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
6003 |
"/ abbrev.stc ? |
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
6004 |
f := packageDir construct:'abbrev.stc'. |
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
6005 |
f exists ifTrue:[ |
7281 | 6006 |
Smalltalk installAutoloadedClassesFrom:f pathName. |
6007 |
||
6008 |
doLoadAsAutoloaded ifFalse:[ |
|
6009 |
"/ force autoloading... |
|
7290 | 6010 |
Smalltalk allClassesDo:[:eachClass | |
6011 |
eachClass package == aPackageId ifTrue:[ eachClass autoload]. |
|
7281 | 6012 |
]. |
6013 |
]. |
|
6014 |
||
6015 |
self loadExtensionsFromDirectory:packageDirOrString. |
|
6016 |
SilentLoading ifFalse:[ |
|
6017 |
Transcript showCR:('loaded package: ' , aPackageId , ' from abbrev file: ' , f pathName). |
|
6018 |
]. |
|
6019 |
^ true |
|
5807
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
6020 |
]. |
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
6021 |
|
7290 | 6022 |
"/ "/ lib/loadAll ? (will vanish) |
6023 |
"/ f := (packageDir construct:'lib') construct:'loadAll'. |
|
6024 |
"/ f exists ifTrue:[ |
|
6025 |
"/ (self loadPackage:aPackageId fromLoadAllFile:f) ifTrue:[ |
|
6026 |
"/ SilentLoading ifFalse:[ |
|
6027 |
"/ Transcript showCR:('loaded package: ' , aPackageId , ' from loadAll file: ' , f pathName). |
|
6028 |
"/ ]. |
|
6029 |
"/ ^ true |
|
6030 |
"/ ] |
|
6031 |
"/ ]. |
|
6032 |
"/ |
|
6033 |
"/ "/ /lib/.so ? (will vanish) |
|
6034 |
"/ f := (packageDir construct:'lib') construct:shLibName. |
|
6035 |
"/ f exists ifTrue:[ |
|
6036 |
"/ (self loadPackage:aPackageId fromClassLibrary:f) ifTrue:[ |
|
6037 |
"/ SilentLoading ifFalse:[ |
|
6038 |
"/ Transcript showCR:('loaded package: ' , aPackageId , ' from binary classLib file: ' , f pathName). |
|
6039 |
"/ ]. |
|
6040 |
"/ ^ true |
|
6041 |
"/ ] |
|
6042 |
"/ ]. |
|
5807
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
6043 |
|
5175
c3e71ead8e06
when loading a package, and a .so file could not be found
Claus Gittinger <cg@exept.de>
parents:
5168
diff
changeset
|
6044 |
"/ any .so ? -> load the first one found (maybe not a good idea) |
c3e71ead8e06
when loading a package, and a .so file could not be found
Claus Gittinger <cg@exept.de>
parents:
5168
diff
changeset
|
6045 |
packageDir directoryContentsAsFilenamesDo:[:aFilename | |
7281 | 6046 |
(aFilename hasSuffix:ObjectFileLoader sharedLibrarySuffix) ifTrue:[ |
6047 |
(self loadPackage:aPackageId fromClassLibrary:aFilename) ifTrue:[ |
|
6048 |
SilentLoading ifFalse:[ |
|
6049 |
Transcript showCR:('loaded package: ' , aPackageId , ' from binary classLib file: ' , aFilename pathName). |
|
6050 |
]. |
|
7290 | 6051 |
doLoadAsAutoloaded ifFalse:[ |
6052 |
"/ force autoloading... |
|
6053 |
Smalltalk allClassesDo:[:eachClass | |
|
6054 |
eachClass package == aPackageId ifTrue:[ eachClass autoload]. |
|
6055 |
]. |
|
6056 |
]. |
|
7281 | 6057 |
^ true |
6058 |
] |
|
6059 |
] |
|
5175
c3e71ead8e06
when loading a package, and a .so file could not be found
Claus Gittinger <cg@exept.de>
parents:
5168
diff
changeset
|
6060 |
]. |
5807
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
6061 |
|
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
6062 |
"/ source files |
4737 | 6063 |
(self loadPackage:aPackageId fromAllSourceFilesInDirectory:packageDir) ifTrue:[ |
7281 | 6064 |
SilentLoading ifFalse:[ |
6065 |
Transcript showCR:('loaded package: ' , aPackageId , ' from source files in:' , packageDir pathName). |
|
6066 |
]. |
|
6067 |
^ true |
|
4737 | 6068 |
]. |
6069 |
^ false |
|
6070 |
||
4718 | 6071 |
" |
6072 |
Smalltalk loadPackageWithId:'stx:libbasic' |
|
6073 |
Smalltalk loadPackageWithId:'stx:goodies/persistency' |
|
4722 | 6074 |
Smalltalk loadPackageWithId:'exept:ctypes' |
4718 | 6075 |
" |
6076 |
! ! |
|
6077 |
||
6711 | 6078 |
!Smalltalk class methodsFor:'system management-undeclared variables'! |
6079 |
||
6080 |
clearUndeclaredVariables |
|
6081 |
"remove all undeclared variables" |
|
6082 |
||
6083 |
(Smalltalk at:#Undeclared) do:[:eachKey | |
|
6853 | 6084 |
Smalltalk removeKey:(self undeclaredPrefix , eachKey) asSymbol. |
6711 | 6085 |
]. |
6086 |
(Smalltalk at:#Undeclared) removeAll. |
|
6087 |
Smalltalk removeKey:#Undeclared. |
|
6088 |
! |
|
6089 |
||
6090 |
undeclaredPrefix |
|
6091 |
"the prefix used for undeclared variables" |
|
6092 |
||
6093 |
^ 'Undeclared:::' |
|
6094 |
||
6095 |
"Created: / 31.10.1997 / 01:13:10 / cg" |
|
6096 |
! ! |
|
6097 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
6098 |
!Smalltalk class methodsFor:'time-versions'! |
453 | 6099 |
|
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6100 |
configuration |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6101 |
"{ Pragma: +optSpace }" |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
6102 |
|
453 | 6103 |
"for developers only: return the configuration, with which |
6104 |
this smalltalk was compiled." |
|
6105 |
||
567 | 6106 |
%{ /* NOCONTEXT */ |
453 | 6107 |
extern char *__getConfigurationString(); |
6108 |
||
6109 |
RETURN (__MKSTRING(__getConfigurationString() COMMA_SND)); |
|
5406 | 6110 |
%}. |
5445 | 6111 |
^ 'unknownOS/unknownCONF:unknownPACK' |
6112 |
||
6113 |
" |
|
6114 |
Smalltalk configuration |
|
453 | 6115 |
" |
6116 |
! |
|
6117 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6118 |
copyrightString |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6119 |
"{ Pragma: +optSpace }" |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
6120 |
|
453 | 6121 |
"return a copyright string" |
6122 |
||
567 | 6123 |
%{ /* NOCONTEXT */ |
829
fc386319f41c
removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents:
822
diff
changeset
|
6124 |
#ifndef __getCopyrightString |
fc386319f41c
removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents:
822
diff
changeset
|
6125 |
extern OBJ __getCopyrightString(); |
568 | 6126 |
#endif |
6127 |
||
829
fc386319f41c
removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents:
822
diff
changeset
|
6128 |
RETURN (__getCopyrightString()); |
5410 | 6129 |
%}. |
6130 |
^ self primitiveFailed |
|
453 | 6131 |
|
6132 |
" |
|
6133 |
Smalltalk copyrightString |
|
6134 |
" |
|
6135 |
! |
|
6136 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6137 |
distributorString |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6138 |
"{ Pragma: +optSpace }" |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
6139 |
|
567 | 6140 |
"return a string describing the distributor of this software" |
6141 |
||
6142 |
%{ /* NOCONTEXT */ |
|
829
fc386319f41c
removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents:
822
diff
changeset
|
6143 |
#ifndef __getDistributorString |
fc386319f41c
removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents:
822
diff
changeset
|
6144 |
extern OBJ __getDistributorString(); |
568 | 6145 |
#endif |
6146 |
||
829
fc386319f41c
removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents:
822
diff
changeset
|
6147 |
RETURN (__getDistributorString()); |
5410 | 6148 |
%}. |
5445 | 6149 |
^ 'eXept Software AG, Germany' |
5410 | 6150 |
|
567 | 6151 |
" |
6152 |
Smalltalk distributorString |
|
6153 |
" |
|
6154 |
! |
|
6155 |
||
1645 | 6156 |
expirationTime |
6157 |
"{ Pragma: +optSpace }" |
|
6158 |
||
6159 |
"for developers only: return the time when the system will expire. |
|
6160 |
after this time it will not run any longer. |
|
6161 |
It returns nil, if no expiration time has been set (system runs forever :-))" |
|
6162 |
||
6163 |
|exp| |
|
6164 |
||
6165 |
%{ |
|
6166 |
extern unsigned int __getExpirationTime(); |
|
6167 |
||
6168 |
exp = __MKUINT(__getExpirationTime()); |
|
6169 |
%}. |
|
6170 |
exp == 0 ifTrue:[ |
|
6853 | 6171 |
^ nil |
1645 | 6172 |
]. |
6173 |
^ AbsoluteTime new fromOSTime:(exp * 1000). "OSTime is ms since 1970" |
|
6174 |
||
6175 |
" |
|
6176 |
Smalltalk expirationTime |
|
6177 |
" |
|
6178 |
! |
|
6179 |
||
3062
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
6180 |
fullVersionString |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
6181 |
"{ Pragma: +optSpace }" |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
6182 |
|
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
6183 |
"return a full version string" |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
6184 |
|
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
6185 |
^ 'Smalltalk/X release ' , self versionString , ' of ' , self versionDate |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
6186 |
|
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
6187 |
" |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
6188 |
Smalltalk fullVersionString |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
6189 |
" |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
6190 |
|
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
6191 |
"Created: / 27.10.1997 / 17:03:09 / cg" |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
6192 |
"Modified: / 27.10.1997 / 17:04:02 / cg" |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
6193 |
! |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
6194 |
|
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6195 |
hello |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6196 |
"{ Pragma: +optSpace }" |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
6197 |
|
453 | 6198 |
"return a greeting string" |
6199 |
||
6200 |
"stupid: this should come from a resource file ... |
|
6201 |
but I dont use it here, to allow mini-systems without |
|
6202 |
Resource-stuff." |
|
6203 |
||
6187 | 6204 |
|proto lang| |
1307 | 6205 |
|
6206 |
lang := Language. |
|
5641 | 6207 |
(lang == #de) ifTrue:[ |
6853 | 6208 |
proto := 'Willkommen bei %1 (Version %2 vom %3)' |
5641 | 6209 |
] ifFalse:[ (lang == #fr) ifTrue:[ |
6853 | 6210 |
proto := 'Salut, Bienvenue à %1 (version %2 de %3)' |
5641 | 6211 |
] ifFalse:[ (lang == #it) ifTrue:[ |
6853 | 6212 |
proto := 'Ciao, benvenuto al %1 (versione %2 di %3)' |
5641 | 6213 |
] ifFalse:[ (lang == #es) ifTrue:[ |
5657
5dd08c2a4930
hpux lex/bison does not like 8-bit characters (in string consts)
Claus Gittinger <cg@exept.de>
parents:
5653
diff
changeset
|
6214 |
"/ proto := 'Hola, bienvenida a %1 (versión %2 de %3)' |
5641 | 6215 |
] ifFalse:[ (lang == #es) ifTrue:[ |
5657
5dd08c2a4930
hpux lex/bison does not like 8-bit characters (in string consts)
Claus Gittinger <cg@exept.de>
parents:
5653
diff
changeset
|
6216 |
"/ proto := 'Oi, benvindo a %1 (versão %2 de %3)' |
5641 | 6217 |
] ifFalse:[ (lang == #no) ifTrue:[ |
6853 | 6218 |
proto := 'Hei, verdenmottakelse til %1 (versjon %2 av %3)' |
5641 | 6219 |
]]]]]]. |
1307 | 6220 |
|
6221 |
"/ ... more needed here ... |
|
6222 |
||
6223 |
proto isNil ifTrue:[ |
|
6853 | 6224 |
proto := 'Hello World - here is %1 version %2 of %3'. |
453 | 6225 |
]. |
1307 | 6226 |
|
6187 | 6227 |
^ proto bindWith:('SmallTalk/X' allBold) |
6853 | 6228 |
with:(self versionString) |
6229 |
with:(self versionDate) |
|
453 | 6230 |
|
6231 |
" |
|
1307 | 6232 |
Smalltalk language:#us. |
6233 |
Smalltalk hello |
|
6234 |
||
6235 |
Smalltalk language:#de. |
|
6236 |
Smalltalk hello |
|
1412 | 6237 |
|
5641 | 6238 |
Smalltalk language:#no. |
6239 |
Smalltalk hello |
|
6240 |
||
1422 | 6241 |
Transcript showCR:(Smalltalk hello) |
6242 |
Stdout showCR:(Smalltalk hello) |
|
453 | 6243 |
" |
1307 | 6244 |
|
1412 | 6245 |
"Modified: 18.5.1996 / 14:25:13 / cg" |
617 | 6246 |
! |
6247 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6248 |
imageRestartTime |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6249 |
"return a timestamp for the moment when this image was restarted. |
1069 | 6250 |
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
|
6251 |
|
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6252 |
^ ImageRestartTime |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6253 |
|
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6254 |
" |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6255 |
Smalltalk imageStartTime |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6256 |
Smalltalk imageRestartTime |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6257 |
" |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6258 |
|
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6259 |
"Created: 13.12.1995 / 17:44:20 / cg" |
1069 | 6260 |
"Modified: 6.3.1996 / 11:56:35 / cg" |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6261 |
! |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6262 |
|
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6263 |
imageSaveTime |
3988 | 6264 |
"{ Pragma: +optSpace }" |
6265 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6266 |
"return a timestamp for the moment when this image was saved" |
1100
eebf3ed54b23
reloadAllObjectFiles now called explicit (its too late via ObjMem changed)
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
6267 |
|
eebf3ed54b23
reloadAllObjectFiles now called explicit (its too late via ObjMem changed)
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
6268 |
^ ObjectMemory imageSaveTime |
eebf3ed54b23
reloadAllObjectFiles now called explicit (its too late via ObjMem changed)
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
6269 |
! |
eebf3ed54b23
reloadAllObjectFiles now called explicit (its too late via ObjMem changed)
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
6270 |
|
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6271 |
imageStartTime |
3988 | 6272 |
"{ Pragma: +optSpace }" |
6273 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6274 |
"return a timestamp for the moment when this system started the first time |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6275 |
(i.e. the first initial start without an image)" |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6276 |
|
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6277 |
^ ImageStartTime |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6278 |
|
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6279 |
" |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6280 |
Smalltalk imageStartTime |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6281 |
Smalltalk imageRestartTime |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6282 |
" |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6283 |
|
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6284 |
"Created: 13.12.1995 / 17:44:14 / cg" |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6285 |
"Modified: 13.12.1995 / 17:45:47 / cg" |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6286 |
! |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6287 |
|
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6288 |
majorVersionNr |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6289 |
"{ Pragma: +optSpace }" |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
6290 |
|
617 | 6291 |
"return the major version number. |
6292 |
This is only incremented for very fundamental changes, |
|
6293 |
which make old object files totally incompatible |
|
6294 |
(for example, if the layout/representation of fundamental |
|
3382 | 6295 |
classes changes). |
6296 |
||
3988 | 6297 |
ST/X revision Naming is: |
7362
1af5f648cdb2
major version bumb (due to class-layout change)
Claus Gittinger <cg@exept.de>
parents:
7348
diff
changeset
|
6298 |
<major>.<minor>.<revision>.<release>" |
1af5f648cdb2
major version bumb (due to class-layout change)
Claus Gittinger <cg@exept.de>
parents:
7348
diff
changeset
|
6299 |
|
1af5f648cdb2
major version bumb (due to class-layout change)
Claus Gittinger <cg@exept.de>
parents:
7348
diff
changeset
|
6300 |
^ 5 |
617 | 6301 |
|
6302 |
" |
|
6303 |
Smalltalk majorVersionNr |
|
6304 |
" |
|
1941
51332fe23542
bumped version to 3 (I guess, nameSpaces are a major step)
Claus Gittinger <cg@exept.de>
parents:
1917
diff
changeset
|
6305 |
|
51332fe23542
bumped version to 3 (I guess, nameSpaces are a major step)
Claus Gittinger <cg@exept.de>
parents:
1917
diff
changeset
|
6306 |
"Modified: 8.11.1996 / 19:59:21 / cg" |
617 | 6307 |
! |
6308 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6309 |
minorVersionNr |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6310 |
"{ Pragma: +optSpace }" |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
6311 |
|
617 | 6312 |
"return the minor version number. |
6313 |
This is incremented for changes which make some old object |
|
6314 |
files incompatible, or the protocol changes such that some |
|
3988 | 6315 |
classes need rework. |
6316 |
||
6317 |
ST/X revision Naming is: |
|
7362
1af5f648cdb2
major version bumb (due to class-layout change)
Claus Gittinger <cg@exept.de>
parents:
7348
diff
changeset
|
6318 |
<major>.<minor>.<revision>.<release>" |
3988 | 6319 |
|
5322 | 6320 |
^ 1 |
617 | 6321 |
|
6322 |
" |
|
6323 |
Smalltalk minorVersionNr |
|
6324 |
" |
|
1941
51332fe23542
bumped version to 3 (I guess, nameSpaces are a major step)
Claus Gittinger <cg@exept.de>
parents:
1917
diff
changeset
|
6325 |
|
3092 | 6326 |
"Modified: / 3.11.1997 / 14:49:48 / cg" |
617 | 6327 |
! |
6328 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6329 |
releaseIdentification |
1552 | 6330 |
"{ Pragma: +optSpace }" |
6331 |
||
6332 |
"for developers only: return the release |
|
6333 |
(to further identify the version in case of errors)" |
|
6334 |
||
6335 |
%{ /* NOCONTEXT */ |
|
1553 | 6336 |
extern OBJ __getRel(); |
6337 |
||
6338 |
RETURN (__getRel()); |
|
5410 | 6339 |
%}. |
5445 | 6340 |
^ 'ST/X_experimental' |
1552 | 6341 |
|
6342 |
" |
|
6343 |
Smalltalk releaseIdentification |
|
6344 |
" |
|
6345 |
! |
|
6346 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6347 |
releaseNr |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6348 |
"{ Pragma: +optSpace }" |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
6349 |
|
617 | 6350 |
"return the revision number. |
6351 |
Incremented for releases which fix bugs/add features but did not find |
|
3988 | 6352 |
their way to the outside world. |
6353 |
||
6354 |
ST/X revision Naming is: |
|
6853 | 6355 |
<major>.<minor>.<revision>.<release>" |
4334 | 6356 |
|
6861 | 6357 |
^ 1 |
617 | 6358 |
|
6359 |
" |
|
6360 |
Smalltalk releaseNr |
|
6361 |
" |
|
732
29a49feab799
release bump - that seems to be a good one
Claus Gittinger <cg@exept.de>
parents:
728
diff
changeset
|
6362 |
|
29a49feab799
release bump - that seems to be a good one
Claus Gittinger <cg@exept.de>
parents:
728
diff
changeset
|
6363 |
"Created: 10.12.1995 / 01:42:19 / cg" |
617 | 6364 |
! |
6365 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6366 |
revisionNr |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6367 |
"{ Pragma: +optSpace }" |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
6368 |
|
617 | 6369 |
"return the revision number. |
6370 |
Incremented for releases which fix bugs/add features |
|
6371 |
and represent a stable workable version which got published |
|
3988 | 6372 |
to the outside world. |
6373 |
||
6374 |
ST/X revision Naming is: |
|
7000 | 6375 |
<major>.<minor>.<revision>.<release>" |
6376 |
||
7364 | 6377 |
^ 1 |
617 | 6378 |
|
6379 |
" |
|
6380 |
Smalltalk revisionNr |
|
6715 | 6381 |
Smalltalk hello |
617 | 6382 |
" |
1941
51332fe23542
bumped version to 3 (I guess, nameSpaces are a major step)
Claus Gittinger <cg@exept.de>
parents:
1917
diff
changeset
|
6383 |
|
3624 | 6384 |
"Modified: / 19.6.1998 / 04:29:10 / cg" |
617 | 6385 |
! |
6386 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6387 |
timeStamp |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6388 |
"return a string useful for timestamping a file. |
617 | 6389 |
The returned string is padded with spaces for a constant |
6390 |
length (to avoid changing a files size in fileOut with unchanged |
|
6391 |
class)." |
|
6392 |
||
5373 | 6393 |
^ ('''' , self timeStampString , '''') paddedTo:80 with:(Character space) |
617 | 6394 |
! |
6395 |
||
3611
f55f117dfd4a
added #timeStamp: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
3610
diff
changeset
|
6396 |
timeStamp:aStream |
f55f117dfd4a
added #timeStamp: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
3610
diff
changeset
|
6397 |
"write a string useful for timestamping a file onto aStream. |
f55f117dfd4a
added #timeStamp: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
3610
diff
changeset
|
6398 |
ST80 compatibility" |
f55f117dfd4a
added #timeStamp: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
3610
diff
changeset
|
6399 |
|
f55f117dfd4a
added #timeStamp: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
3610
diff
changeset
|
6400 |
aStream nextPutAll:(self timeStamp). |
f55f117dfd4a
added #timeStamp: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
3610
diff
changeset
|
6401 |
|
f55f117dfd4a
added #timeStamp: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
3610
diff
changeset
|
6402 |
"Created: / 18.6.1998 / 17:22:58 / cg" |
f55f117dfd4a
added #timeStamp: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
3610
diff
changeset
|
6403 |
! |
f55f117dfd4a
added #timeStamp: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
3610
diff
changeset
|
6404 |
|
5373 | 6405 |
timeStampString |
6406 |
"return a string useful for timestamping a file." |
|
6407 |
||
6408 |
^ ('From Smalltalk/X, Version:' , (Smalltalk versionString) , ' on ' |
|
6409 |
, Date today printString , ' at ' , Time now printString |
|
6410 |
) |
|
6411 |
! |
|
6412 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6413 |
versionDate |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6414 |
"{ Pragma: +optSpace }" |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
6415 |
|
617 | 6416 |
"return the executables build date - thats the date when the smalltalk |
6417 |
executable was built" |
|
6418 |
||
6419 |
%{ /* NOCONTEXT */ |
|
6420 |
extern char *__getBuildDateString(); |
|
6421 |
||
6422 |
RETURN (__MKSTRING(__getBuildDateString() COMMA_SND) ); |
|
5410 | 6423 |
%}. |
5445 | 6424 |
^ 'today' |
6425 |
||
6426 |
" |
|
6427 |
Smalltalk versionDate |
|
617 | 6428 |
" |
6429 |
! |
|
6430 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6431 |
versionString |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6432 |
"{ Pragma: +optSpace }" |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
6433 |
|
617 | 6434 |
"return the version string" |
6435 |
||
6436 |
^ (self majorVersionNr printString , |
|
6437 |
'.', |
|
6438 |
self minorVersionNr printString , |
|
6439 |
'.', |
|
6440 |
self revisionNr printString) |
|
6441 |
||
6442 |
" |
|
6443 |
Smalltalk versionString |
|
6444 |
" |
|
5427 | 6445 |
! |
6446 |
||
6447 |
vmMajorVersionNr |
|
6448 |
"{ Pragma: +optSpace }" |
|
6449 |
||
6450 |
"return the VMs major version number." |
|
6451 |
%{ |
|
6452 |
RETURN (__MKSMALLINT(4)); |
|
6453 |
%}. |
|
6454 |
^ 4 |
|
6455 |
||
6456 |
" |
|
6457 |
Smalltalk vmMajorVersionNr |
|
6458 |
" |
|
6459 |
||
2 | 6460 |
! ! |
453 | 6461 |
|
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
6462 |
!Smalltalk class methodsFor:'documentation'! |
630 | 6463 |
|
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6464 |
version |
7432 | 6465 |
^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.583 2003-06-20 07:13:15 stefan Exp $' |
630 | 6466 |
! ! |