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