author | Claus Gittinger <cg@exept.de> |
Fri, 02 Aug 2002 19:27:04 +0200 | |
changeset 6707 | 790fc577c403 |
parent 6649 | 40637273cdc9 |
child 6711 | ae28c469a063 |
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 |
|
19 |
CommandLineArguments CachedAbbreviations SilentLoading |
|
20 |
Initializing StandAlone HeadlessOperation LogDoits LoadBinaries |
|
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 |
||
108 |
CommandLineArguments <Array> Unix (OS-) command line arguments broken into words |
|
109 |
(initially set by the VM) |
|
110 |
||
111 |
SilentLoading <Boolean> suppresses messages during fileIn and in compiler |
|
112 |
(can be set to true from a customized main.c) |
|
113 |
||
114 |
Initializing <Boolean> true while (re-)initializing |
|
115 |
Controls the behavior of certain error |
|
116 |
reporters (for example: suppress dialogBoxes) |
|
117 |
while the system is not yet fit for full operation. |
|
118 |
||
119 |
StandAlone <Boolean> true, if this is a standalone app; |
|
120 |
if true the process scheduler watches for |
|
121 |
which processes are still running, and |
|
122 |
exits ST/X, when the last non-background |
|
123 |
and non-system process exits. |
|
3062
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
124 |
|
5363 | 125 |
HeadlessOperation if true, a non-existing Display connection |
126 |
<Boolean> will NOT lead to an error-exit during startup. |
|
127 |
Default is false. |
|
128 |
Can be set in an application-specific startup script. |
|
129 |
||
130 |
LogDoits <Boolean> if true, doits are also logged in the changes |
|
131 |
file. Default is false, since the changes file |
|
132 |
may become huge if every tiny doIt is saved there ... |
|
133 |
||
134 |
LoadBinaries <Boolean> if true, we attempt to load classes rom a binary |
|
135 |
file, if present. If false, this is always suppressed. |
|
136 |
||
137 |
SaveEmergencyImage <Boolean> if true (the default), an emergency image |
|
138 |
is saved, if the main Display looses its |
|
139 |
connection. This is useful if you have a |
|
140 |
flaky display connection (serial line) |
|
141 |
and want to have your stuff saved automatically |
|
142 |
in case of a broken connection. |
|
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
143 |
|
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
144 |
strictly private classVariables (helpers): |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
145 |
|
5363 | 146 |
CachedClasses <Collection> known classes (cached for faster class enumeration) |
147 |
||
148 |
CachedAbbreviations |
|
149 |
<Dictionary> className to filename mappings |
|
150 |
||
151 |
RealSystemPath <Collection> cached collection of directories along the path |
|
152 |
which really exist. Caching avoids long checks |
|
153 |
for existing directories on broken NFS volumes. |
|
154 |
||
155 |
SourcePath <Collection> cached names of really existing directories |
|
156 |
BitmapPath These are remembered, since in NFS systems, |
|
157 |
ResourcePath the time to lookup files may become long |
|
158 |
BinaryPath (especially, if some directories are on machines |
|
159 |
FileInPath which are not up ...). |
|
160 |
Therefore, the set of really |
|
161 |
existing directories is cached when the SystemPath |
|
162 |
is walked the first time. |
|
163 |
A consequence is that you have to invoke |
|
164 |
flushSystemPath, when you create any of those |
|
165 |
directories while running |
|
166 |
(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
|
167 |
|
1286 | 168 |
|
169 |
[author:] |
|
5363 | 170 |
Claus Gittinger |
3062
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
171 |
|
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
172 |
[see also:] |
5363 | 173 |
ObjectMemory |
70 | 174 |
" |
1 | 175 |
! ! |
176 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
177 |
!Smalltalk class methodsFor:'initialization'! |
1 | 178 |
|
617 | 179 |
initGlobalsFromEnvironment |
180 |
"setup globals from the shell-environment" |
|
181 |
||
182 |
|envString i langString terrString| |
|
183 |
||
5406 | 184 |
StandAlone isNil ifTrue:[ |
185 |
StandAlone := false. |
|
186 |
]. |
|
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
187 |
HeadlessOperation isNil ifTrue:[ |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
188 |
HeadlessOperation := false. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
189 |
]. |
5406 | 190 |
|
617 | 191 |
" |
192 |
extract Language and LanguageTerritory from LANG variable. |
|
5846 | 193 |
valid are for example: |
194 |
en_en / en |
|
195 |
en_us |
|
196 |
en_gb |
|
197 |
de_de / de |
|
198 |
de_at (for Austria) |
|
199 |
" |
|
200 |
||
201 |
Language := #en. |
|
994
6163ae7aaf9b
territory defaults to #us (instead of #usa)
Claus Gittinger <cg@exept.de>
parents:
977
diff
changeset
|
202 |
LanguageTerritory := #us. |
617 | 203 |
|
5846 | 204 |
|
205 |
"Format of LANG is: language[_territory][.codeset][@modifier] |
|
206 |
language ISO-639 Language code |
|
207 |
territory ISO-3166 Contry code" |
|
208 |
||
617 | 209 |
envString := OperatingSystem getEnvironment:'LANG'. |
3991
7b53bc45bf91
(isNil or:[isEmpty ]) -> (size == 0)
Claus Gittinger <cg@exept.de>
parents:
3988
diff
changeset
|
210 |
envString size > 0 ifTrue:[ |
5846 | 211 |
i := envString indexOf:$@. |
212 |
(i ~~ 0) ifTrue:[ |
|
213 |
envString := envString copyTo:(i - 1). |
|
214 |
LanguageModifier := (envString copyFrom:(i + 1)) asLowercase asSymbol. |
|
215 |
] ifFalse:[ |
|
216 |
LanguageModifier := nil. |
|
217 |
]. |
|
218 |
i := envString indexOf:$.. |
|
219 |
(i ~~ 0) ifTrue:[ |
|
220 |
envString := envString copyTo:(i - 1). |
|
221 |
LanguageCodeset := (envString copyFrom:(i + 1)) asLowercase asSymbol |
|
222 |
] ifFalse:[ |
|
223 |
LanguageCodeset := #'iso8859-1'. |
|
224 |
]. |
|
5406 | 225 |
i := envString indexOf:$_. |
226 |
(i == 0) ifTrue:[ |
|
227 |
langString := envString. |
|
228 |
terrString := envString |
|
229 |
] ifFalse:[ |
|
230 |
langString := envString copyTo:(i - 1). |
|
231 |
terrString := envString copyFrom:(i + 1) |
|
232 |
]. |
|
233 |
Language := langString asLowercase asSymbol. |
|
234 |
LanguageTerritory := terrString asLowercase asSymbol |
|
617 | 235 |
]. |
236 |
||
237 |
" |
|
238 |
Smalltalk initGlobalsFromEnvironment |
|
239 |
" |
|
994
6163ae7aaf9b
territory defaults to #us (instead of #usa)
Claus Gittinger <cg@exept.de>
parents:
977
diff
changeset
|
240 |
|
6163ae7aaf9b
territory defaults to #us (instead of #usa)
Claus Gittinger <cg@exept.de>
parents:
977
diff
changeset
|
241 |
"Modified: 22.2.1996 / 16:59:12 / cg" |
617 | 242 |
! |
243 |
||
244 |
initInterrupts |
|
245 |
"initialize interrupts" |
|
246 |
||
247 |
OperatingSystem enableUserInterrupts. |
|
248 |
OperatingSystem enableHardSignalInterrupts. |
|
6390
41d5c47c33f0
Catch sigPWR and sigHUP on restart
Stefan Vogel <sv@exept.de>
parents:
6366
diff
changeset
|
249 |
OperatingSystem enableCrashSignalInterrupts. |
617 | 250 |
|
251 |
ObjectMemory userInterruptHandler:self. |
|
252 |
ObjectMemory signalInterruptHandler:self. |
|
253 |
ObjectMemory recursionInterruptHandler:self. |
|
254 |
||
963
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
255 |
" |
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
256 |
Smalltalk initInterrupts |
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
257 |
" |
2873
5bc8c81c4a34
Catch fpExeceptionInterrupt after image restart.
Stefan Vogel <sv@exept.de>
parents:
2844
diff
changeset
|
258 |
|
5bc8c81c4a34
Catch fpExeceptionInterrupt after image restart.
Stefan Vogel <sv@exept.de>
parents:
2844
diff
changeset
|
259 |
"Modified: 20.8.1997 / 09:35:49 / stefan" |
617 | 260 |
! |
261 |
||
262 |
initStandardStreams |
|
263 |
"initialize some well-known streams" |
|
264 |
||
265 |
Stdout := NonPositionableExternalStream forStdout. |
|
266 |
Stderr := NonPositionableExternalStream forStderr. |
|
267 |
Stdin := NonPositionableExternalStream forStdin. |
|
268 |
Printer := PrinterStream. |
|
269 |
Transcript := Stderr |
|
270 |
||
963
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
271 |
" |
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
272 |
Smalltalk initStandardStreams |
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
273 |
" |
617 | 274 |
! |
275 |
||
276 |
initStandardTools |
|
277 |
"predefine some tools which we will need later |
|
278 |
- if the view-classes exist, |
|
279 |
they will redefine Inspector and Debugger for graphical interfaces" |
|
280 |
||
281 |
"redefine debug-tools, if view-classes exist" |
|
282 |
||
283 |
Display notNil ifTrue:[ |
|
5499
a884d2f88f74
only init the debugger, if it was not set already
Claus Gittinger <cg@exept.de>
parents:
5455
diff
changeset
|
284 |
InspectorView notNil ifTrue:[ |
a884d2f88f74
only init the debugger, if it was not set already
Claus Gittinger <cg@exept.de>
parents:
5455
diff
changeset
|
285 |
Inspector := InspectorView |
a884d2f88f74
only init the debugger, if it was not set already
Claus Gittinger <cg@exept.de>
parents:
5455
diff
changeset
|
286 |
]. |
a884d2f88f74
only init the debugger, if it was not set already
Claus Gittinger <cg@exept.de>
parents:
5455
diff
changeset
|
287 |
DebugView notNil ifTrue:[ |
5504 | 288 |
Debugger := DebugView |
5499
a884d2f88f74
only init the debugger, if it was not set already
Claus Gittinger <cg@exept.de>
parents:
5455
diff
changeset
|
289 |
]. |
a884d2f88f74
only init the debugger, if it was not set already
Claus Gittinger <cg@exept.de>
parents:
5455
diff
changeset
|
290 |
Display initialize |
617 | 291 |
] |
963
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
292 |
|
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
293 |
" |
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
294 |
Smalltalk initStandardTools |
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
295 |
" |
617 | 296 |
! |
297 |
||
298 |
initSystemPath |
|
299 |
"setup path where system files are searched for. |
|
300 |
the default path is set to: |
|
5363 | 301 |
. |
302 |
$HOME (if defined) |
|
303 |
$HOME/.smalltalk (if defined & existing) |
|
304 |
$SMALLTALK_LIBDIR (if defined & existing) |
|
305 |
$STX_LIBDIR (if defined & existing) |
|
306 |
$STX_TOPDIR (if defined & existing) |
|
4001
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
307 |
|
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
308 |
unix: |
5363 | 309 |
/opt/smalltalk (if existing) |
310 |
/opt/smalltalk/release (if existing) |
|
311 |
/usr/local/lib/smalltalk (if existing) |
|
312 |
/usr/lib/smalltalk (if existing) |
|
313 |
/lib/smalltalk (if existing) |
|
4001
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
314 |
|
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
315 |
win32: |
5363 | 316 |
\smalltalk (if existing) |
317 |
\programs\smalltalk (if existing) |
|
318 |
\programs\exept\smalltalk (if existing) |
|
319 |
registry info (if present) |
|
4001
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
320 |
|
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
321 |
vms: |
5363 | 322 |
$stx:lib (if existing) |
323 |
$stx:root (if existing) |
|
617 | 324 |
|
325 |
of course, it is possible to add entries from the 'smalltalk.rc' |
|
326 |
startup file; add expressions such as: |
|
5363 | 327 |
Smalltalk systemPath addFirst:'/foo/bar/baz'. |
328 |
or: |
|
329 |
Smalltalk systemPath addLast:'/fee/foe/foo'. |
|
4001
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
330 |
|
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
331 |
However, smalltalk.rc itself must be found along the above path. |
617 | 332 |
" |
333 |
||
2928 | 334 |
ChangeFileName := 'changes'. |
335 |
OperatingSystem isVMSlike ifTrue:[ |
|
5363 | 336 |
BitmapDirName := 'bitmaps.dir'. |
337 |
BinaryDirName := 'binary.dir'. |
|
338 |
SourceDirName := 'source.dir'. |
|
339 |
ResourceDirName := 'resources.dir'. |
|
340 |
FileInDirName := 'filein.dir'. |
|
341 |
PackageDirName := 'packages.dir'. |
|
2928 | 342 |
] ifFalse:[ |
5363 | 343 |
BitmapDirName := 'bitmaps'. |
344 |
BinaryDirName := 'binary'. |
|
345 |
SourceDirName := 'source'. |
|
346 |
ResourceDirName := 'resources'. |
|
347 |
FileInDirName := 'fileIn'. |
|
348 |
PackageDirName := 'packages'. |
|
2928 | 349 |
]. |
350 |
||
680 | 351 |
SystemPath isNil ifTrue:[ |
5363 | 352 |
SystemPath := OperatingSystem defaultSystemPath. |
353 |
self flushPathCaches |
|
5139 | 354 |
]. |
355 |
||
5144 | 356 |
PackagePath isNil ifTrue:[ |
5363 | 357 |
PackagePath := OperatingSystem defaultPackagePath. |
5144 | 358 |
]. |
617 | 359 |
|
360 |
" |
|
361 |
Smalltalk initSystemPath |
|
362 |
Smalltalk systemPath |
|
363 |
" |
|
5139 | 364 |
|
5145 | 365 |
"Modified: / 24.12.1999 / 00:23:35 / cg" |
617 | 366 |
! |
367 |
||
368 |
initUserPreferences |
|
369 |
"setup other stuff" |
|
370 |
||
371 |
LogDoits := false. |
|
372 |
LoadBinaries := false. |
|
3062
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
373 |
SaveEmergencyImage := true. |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
374 |
|
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
375 |
"Modified: / 24.10.1997 / 18:22:47 / cg" |
617 | 376 |
! |
377 |
||
378 |
initializeModules |
|
379 |
"perform module specific initialization and |
|
380 |
send #initialize to all classes. |
|
381 |
Notice: this is not called when an image is restarted" |
|
4963 | 382 |
|
383 |
" TODO: |
|
384 |
change VM/stc to invoke #Smalltalk initializeClass:aClass |
|
385 |
(instead of directly sending #initialize) |
|
386 |
This will allow us to wrap an exception handler around classes |
|
387 |
#initialize methods." |
|
388 |
||
617 | 389 |
%{ |
1688
8a42db1eea60
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1682
diff
changeset
|
390 |
__init_registered_modules__(3); |
4963 | 391 |
|
1481 | 392 |
@global(DemoMode) = __getDemoMode() ? true : false; |
5410 | 393 |
RETURN (self); |
394 |
%}. |
|
395 |
^ self primitiveFailed |
|
396 |
||
617 | 397 |
! |
398 |
||
325 | 399 |
initializeSystem |
24 | 400 |
"initialize all other classes; setup dispatcher processes etc. |
3499 | 401 |
This one is the very first entry into the smalltalk world, |
402 |
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
|
403 |
Notice: |
5400 | 404 |
this is not called when an image is restarted; in this |
405 |
case the show starts in Smalltalk>>restart." |
|
211 | 406 |
|
3499 | 407 |
Initializing := true. |
408 |
AbstractOperatingSystem initializeConcreteClass. |
|
409 |
||
5400 | 410 |
CommandLineArguments isNil ifTrue:[ |
411 |
CommandLineArguments := #('stx'). |
|
412 |
]. |
|
4006
c7ad38c52eb9
must set CommandLineArguments earlier (to be available in initializeSystem)
Claus Gittinger <cg@exept.de>
parents:
4001
diff
changeset
|
413 |
CommandLine := CommandLineArguments copy. |
c7ad38c52eb9
must set CommandLineArguments earlier (to be available in initializeSystem)
Claus Gittinger <cg@exept.de>
parents:
4001
diff
changeset
|
414 |
CommandLineArguments := CommandLineArguments asOrderedCollection. |
c7ad38c52eb9
must set CommandLineArguments earlier (to be available in initializeSystem)
Claus Gittinger <cg@exept.de>
parents:
4001
diff
changeset
|
415 |
CommandLineArguments removeAtIndex:1. "/ the command |
c7ad38c52eb9
must set CommandLineArguments earlier (to be available in initializeSystem)
Claus Gittinger <cg@exept.de>
parents:
4001
diff
changeset
|
416 |
|
4028
b46539f16af5
added --silentStartup argument
Claus Gittinger <cg@exept.de>
parents:
4026
diff
changeset
|
417 |
SilentLoading := (CommandLineArguments includes:'--silentStartup'). |
348 | 418 |
|
2090
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
419 |
"/ |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
420 |
"/ define low-level debugging tools - graphical classes are not prepared yet |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
421 |
"/ to handle things. |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
422 |
"/ This will bring us into the MiniDebugger when an error occurs |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
423 |
"/ during startup |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
424 |
"/ |
211 | 425 |
Inspector := MiniInspector. |
426 |
Debugger := MiniDebugger. |
|
1 | 427 |
|
2090
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
428 |
"/ |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
429 |
"/ start catching SIGSEGV and SIGBUS |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
430 |
"/ |
713
32540afb8ffc
setup SIGSEGV/SIGBUS handling early - to catch those during startup
Claus Gittinger <cg@exept.de>
parents:
706
diff
changeset
|
431 |
OperatingSystem enableHardSignalInterrupts. |
32540afb8ffc
setup SIGSEGV/SIGBUS handling early - to catch those during startup
Claus Gittinger <cg@exept.de>
parents:
706
diff
changeset
|
432 |
|
1 | 433 |
self initGlobalsFromEnvironment. |
434 |
||
2090
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
435 |
"/ |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
436 |
"/ 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
|
437 |
"/ 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
|
438 |
"/ |
1 | 439 |
Object initialize. |
423 | 440 |
Signal initialize. |
2907 | 441 |
Filename initialize. |
326 | 442 |
ObjectMemory initialize. |
2504
ece15ffbcb69
Initialize OperatingSystem early (needed for some signals).
Stefan Vogel <sv@exept.de>
parents:
2485
diff
changeset
|
443 |
OperatingSystem initialize. |
596
ecb1d732dade
require Stream to be initialized before ExternalStream is
Claus Gittinger <cg@exept.de>
parents:
592
diff
changeset
|
444 |
Stream initialize. |
1 | 445 |
ExternalStream initialize. |
211 | 446 |
|
447 |
self initStandardStreams. "/ setup Stdin, Stdout etc. |
|
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 |
"/ sorry, path must be set before ... |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
451 |
"/ 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
|
452 |
"/ |
1 | 453 |
self initSystemPath. |
454 |
||
455 |
Compiler := ByteCodeCompiler. |
|
456 |
Compiler isNil ifTrue:[ |
|
5400 | 457 |
" |
458 |
ByteCodeCompiler is not in the system (i.e. has not been linked in) |
|
459 |
this allows at least immediate evaluations for runtime systems without compiler |
|
460 |
NOTICE: a parser is always needed, otherwise we cannot read resource files etc. |
|
461 |
" |
|
462 |
Compiler := Parser |
|
1 | 463 |
]. |
464 |
||
2090
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
465 |
"/ |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
466 |
"/ another one, to be initialized before others |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
467 |
"/ |
2077
6b5dc412dd15
must initialize Processor before doing modulInits
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
468 |
ProcessorScheduler initialize. |
6b5dc412dd15
must initialize Processor before doing modulInits
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
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 |
"/ now, finally, initialize all other classes |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
472 |
"/ |
325 | 473 |
self initializeModules. |
474 |
||
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
475 |
ImageStartTime := AbsoluteTime now. |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
476 |
|
70 | 477 |
self initInterrupts. |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
478 |
self initUserPreferences. |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
479 |
|
2090
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
480 |
"/ |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
481 |
"/ 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
|
482 |
"/ 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
|
483 |
"/ (especially: streams and signals can now be used) |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
484 |
"/ |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
485 |
ObjectMemory changed:#initialized. |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
486 |
|
2504
ece15ffbcb69
Initialize OperatingSystem early (needed for some signals).
Stefan Vogel <sv@exept.de>
parents:
2485
diff
changeset
|
487 |
"Modified: 8.1.1997 / 19:58:12 / stefan" |
2907 | 488 |
"Modified: 7.9.1997 / 23:34:44 / cg" |
325 | 489 |
! |
1 | 490 |
|
617 | 491 |
isInitialized |
492 |
"this returns true, if the system is properly initialized; |
|
493 |
i.e. false during startup. Especially, the whole viewing stuff is |
|
494 |
not working correctly until initialized." |
|
495 |
||
496 |
^ Initializing not |
|
1 | 497 |
! |
498 |
||
477
8710aba7876b
oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents:
457
diff
changeset
|
499 |
reinitStandardStreams |
8710aba7876b
oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents:
457
diff
changeset
|
500 |
"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
|
501 |
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
|
502 |
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
|
503 |
(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
|
504 |
|
8710aba7876b
oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents:
457
diff
changeset
|
505 |
Stdout reOpen. Stderr reOpen. Stdin reOpen. |
161 | 506 |
! ! |
507 |
||
5186 | 508 |
!Smalltalk class methodsFor:'Compatibility - Squeak'! |
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
509 |
|
4872 | 510 |
beep |
511 |
Screen current beep |
|
512 |
! |
|
513 |
||
4599 | 514 |
garbageCollect |
515 |
ObjectMemory garbageCollect |
|
516 |
! |
|
517 |
||
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
518 |
garbageCollectMost |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
519 |
"collect recently created garbage; return the amount of freeSpace. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
520 |
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
|
521 |
newSpace + freeListSpace is returned." |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
522 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
523 |
ObjectMemory scavenge. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
524 |
^ ObjectMemory freeSpace |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
525 |
+ (ObjectMemory newSpaceSize - ObjectMemory newSpaceUsed) |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
526 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
527 |
! |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
528 |
|
4870 | 529 |
isMorphic |
530 |
^ false |
|
531 |
! |
|
532 |
||
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
533 |
registerExternalObject: anObject |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
534 |
"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
|
535 |
If it is already there, just return its index. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
536 |
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
|
537 |
primitive code (via the global Smalltalk:SpecialObjectArray)" |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
538 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
539 |
| objects firstEmptyIndex obj sz newObjects | |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
540 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
541 |
objects := SpecialObjectArray. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
542 |
objects isNil ifTrue:[ |
5363 | 543 |
objects := Array new:5. |
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
544 |
]. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
545 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
546 |
"find the first empty slot and look if already registered" |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
547 |
firstEmptyIndex := 0. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
548 |
1 to: objects size do: [:i | |
5363 | 549 |
obj := objects at: i. |
550 |
obj == anObject ifTrue: [^ i]. "object already there, just return its index" |
|
551 |
(obj == nil and: [firstEmptyIndex = 0]) ifTrue: [ |
|
552 |
firstEmptyIndex := i |
|
553 |
] |
|
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
554 |
]. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
555 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
556 |
"if no empty slots, expand the array" |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
557 |
firstEmptyIndex = 0 ifTrue: [ |
5363 | 558 |
sz := objects size. |
559 |
newObjects := objects species new: sz + 20. "grow linearly" |
|
560 |
newObjects replaceFrom: 1 to: sz with: objects startingAt: 1. |
|
561 |
firstEmptyIndex := sz + 1. |
|
562 |
SpecialObjectArray := newObjects. |
|
563 |
objects := newObjects |
|
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
564 |
]. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
565 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
566 |
objects at: firstEmptyIndex put: anObject. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
567 |
^ firstEmptyIndex |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
568 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
569 |
! |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
570 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
571 |
unregisterExternalObject: anObject |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
572 |
"Unregister the given object in the external objects array. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
573 |
Do nothing if it isn't registered." |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
574 |
|
5913 | 575 |
|objects| |
576 |
||
577 |
anObject isNil ifTrue:[^ self]. |
|
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
578 |
objects := SpecialObjectArray. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
579 |
1 to: objects size do: [:i | |
5913 | 580 |
(objects at: i) == anObject ifTrue: [ |
581 |
objects at: i put: nil |
|
582 |
] |
|
583 |
]. |
|
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
584 |
! ! |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
585 |
|
6094
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
586 |
!Smalltalk class methodsFor:'Compatibility - VW5.4'! |
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
587 |
|
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
588 |
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
|
589 |
|newClass| |
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
590 |
|
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
591 |
indexed == #none ifTrue:[ |
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
592 |
newClass := superclass |
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
593 |
subclass:nameSymbol |
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
594 |
instanceVariableNames:instVars |
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
595 |
classVariableNames:'' |
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
596 |
poolDictionaries:'' |
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
597 |
category:category |
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
598 |
inEnvironment:self. |
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
599 |
classInstVars size > 0 ifTrue:[ |
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
600 |
newClass class instanceVariableNames:classInstVars. |
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
601 |
]. |
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
602 |
^ newClass |
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
603 |
]. |
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
604 |
self halt. |
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
605 |
! ! |
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
606 |
|
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
607 |
!Smalltalk class methodsFor:'accessing'! |
453 | 608 |
|
3083 | 609 |
associationAt:aKey |
610 |
"return a key-value association for aKey. |
|
611 |
Since ST/X's Smalltalk as no real dictionary, this is |
|
612 |
simulated here." |
|
613 |
||
614 |
|val| |
|
615 |
||
616 |
val := self at:aKey ifAbsent:nil. |
|
617 |
val isNil ifTrue:[^ nil]. |
|
618 |
^ Association key:aKey value:val |
|
619 |
||
620 |
"Created: / 1.11.1997 / 13:27:20 / cg" |
|
621 |
! |
|
622 |
||
3610
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
623 |
associationAt:aKey ifAbsent:exceptionBlock |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
624 |
"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
|
625 |
from exceptionBlock, if no such key is present. |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
626 |
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
|
627 |
simulated here." |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
628 |
|
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
629 |
|val| |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
630 |
|
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
631 |
val := self at:aKey ifAbsent:nil. |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
632 |
val isNil ifTrue:[^ exceptionBlock value]. |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
633 |
^ Association key:aKey value:val |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
634 |
|
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
635 |
"Created: / 18.6.1998 / 17:05:24 / cg" |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
636 |
! |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
637 |
|
453 | 638 |
at:aKey |
639 |
"retrieve the value stored under aKey, a symbol. |
|
1956 | 640 |
Return nil if not present |
641 |
(this will be changed to trigger an error - better use #at:ifAbsent:)" |
|
453 | 642 |
|
6080
15ea3cbf6003
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
6074
diff
changeset
|
643 |
"/ aKey class == String ifTrue:[self halt]. |
15ea3cbf6003
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
6074
diff
changeset
|
644 |
|
453 | 645 |
%{ /* NOCONTEXT */ |
646 |
RETURN ( __GLOBAL_GET(aKey) ); |
|
5406 | 647 |
%}. |
5410 | 648 |
^ self primitiveFailed |
453 | 649 |
! |
650 |
||
651 |
at:aKey ifAbsent:aBlock |
|
652 |
"retrieve the value stored at aKey. |
|
653 |
If there is nothing stored under this key, return the value of |
|
654 |
the evaluation of aBlock." |
|
655 |
||
656 |
(self includesKey:aKey) ifTrue:[ |
|
5363 | 657 |
^ self at:aKey |
453 | 658 |
]. |
659 |
^ aBlock value |
|
660 |
||
661 |
" |
|
662 |
Smalltalk at:#fooBar <- returns nil |
|
663 |
Smalltalk at:#fooBar ifAbsent:['sorry'] <- no error |
|
664 |
" |
|
665 |
! |
|
666 |
||
4870 | 667 |
at:aKey ifPresent:aBlock |
668 |
"try to retrieve the value stored at aKey. |
|
669 |
If there is nothing stored under this key, do nothing. |
|
670 |
Otherwise, evaluate aBlock, passing the retrieved value as argument." |
|
671 |
||
672 |
(self includesKey:aKey) ifTrue:[ |
|
5363 | 673 |
^ aBlock value:(self at:aKey) |
4870 | 674 |
]. |
675 |
^ nil |
|
676 |
||
677 |
" |
|
678 |
Smalltalk at:#fooBar ifPresent:[:what | Transcript showCR:what]. |
|
679 |
Smalltalk at:#Object ifPresent:[:what | Transcript showCR:what]. |
|
680 |
" |
|
681 |
||
682 |
! |
|
683 |
||
453 | 684 |
at:aKey put:aValue |
1222 | 685 |
"store the argument aValue under aKey, a symbol. |
686 |
Return aValue (sigh)." |
|
453 | 687 |
|
688 |
|oldValue| |
|
689 |
||
690 |
%{ |
|
691 |
oldValue = __GLOBAL_SET(aKey, aValue, (OBJ *)0); |
|
692 |
%}. |
|
693 |
CachedClasses notNil ifTrue:[ |
|
5363 | 694 |
oldValue isBehavior ifTrue:[ |
695 |
oldValue name == aKey ifTrue:[ |
|
696 |
CachedClasses remove:oldValue ifAbsent:[] |
|
697 |
] |
|
698 |
]. |
|
699 |
aValue isBehavior ifTrue:[ |
|
1956 | 700 |
"/ aValue isMeta ifTrue:[ |
701 |
"/ "/ this should not happen |
|
702 |
"/ ('SMALLTALK: store a Metaclass: ' , aValue name , ' as ' , aKey) infoPrintCR. |
|
703 |
"/ ]. |
|
704 |
||
5363 | 705 |
aValue name == aKey ifTrue:[ |
706 |
CachedClasses add:aValue |
|
707 |
] ifFalse:[ |
|
708 |
CachedClasses := nil |
|
709 |
] |
|
710 |
]. |
|
453 | 711 |
]. |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
712 |
^ aValue. |
1955 | 713 |
"/ |
714 |
"/%{ /* NOCONTEXT */ |
|
715 |
"/ (void) __GLOBAL_SET(aKey, aValue, (OBJ *)0); |
|
716 |
"/%}. |
|
717 |
"/ CachedClasses := nil. |
|
718 |
"/ ^ aValue |
|
1222 | 719 |
|
720 |
"Modified: 19.4.1996 / 11:31:49 / cg" |
|
453 | 721 |
! |
722 |
||
617 | 723 |
includesKey:aKey |
724 |
"return true, if the key is known" |
|
453 | 725 |
|
6231 | 726 |
"/ for debugging - this is a common mistake, |
727 |
"/ to try to access a class by nameString, instead |
|
728 |
"/ of by symbol. |
|
729 |
||
730 |
"/ aKey class == String ifTrue:[self halt]. |
|
4391 | 731 |
|
453 | 732 |
%{ /* NOCONTEXT */ |
617 | 733 |
RETURN ( __GLOBAL_KEYKNOWN(aKey) ); |
5410 | 734 |
%}. |
735 |
^ self primitiveFailed |
|
453 | 736 |
! |
737 |
||
738 |
keyAtValue:anObject |
|
739 |
"return the symbol under which anObject is stored - or nil" |
|
740 |
||
741 |
self keysDo:[:aKey | |
|
5363 | 742 |
(self at:aKey) == anObject ifTrue:[^ aKey] |
453 | 743 |
]. |
744 |
^ nil |
|
745 |
||
746 |
"Smalltalk keyAtValue:Object" |
|
747 |
! |
|
748 |
||
749 |
keys |
|
750 |
"return a collection with all keys in the Smalltalk dictionary" |
|
751 |
||
752 |
|keys| |
|
753 |
||
754 |
keys := IdentitySet new. |
|
755 |
self keysDo:[:k | keys add:k]. |
|
756 |
^ keys |
|
617 | 757 |
! |
758 |
||
759 |
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
|
760 |
"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
|
761 |
WARNING: |
5410 | 762 |
this is somewhat dangerous: conceptionally, the association is removed, |
763 |
to which machine & byte compiled code refers if it accesses a global. |
|
764 |
If there are still global accesses in some literalArray or from machine-compiled code, |
|
765 |
it continues to reference the globals value via that obsolete association and gets a nil |
|
766 |
value. (which is correct) |
|
767 |
However, if that global is later reintroduced, a new association will be created and |
|
768 |
the new global now referenced via the new association. |
|
769 |
The old accesses will still see nil, although the globals value is actually non-nil |
|
770 |
(this is questionable). |
|
771 |
To avoid this problem, the #removeClass: method never removed the key." |
|
617 | 772 |
|
773 |
CachedClasses := nil. |
|
774 |
||
775 |
%{ /* NOCONTEXT */ |
|
776 |
RETURN ( __GLOBAL_REMOVE(aKey) ); |
|
5410 | 777 |
%}. |
778 |
^ self primitiveFailed |
|
779 |
||
2705
ed04a67da248
added #values for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
2681
diff
changeset
|
780 |
! |
ed04a67da248
added #values for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
2681
diff
changeset
|
781 |
|
ed04a67da248
added #values for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
2681
diff
changeset
|
782 |
values |
ed04a67da248
added #values for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
2681
diff
changeset
|
783 |
"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
|
784 |
|
ed04a67da248
added #values for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
2681
diff
changeset
|
785 |
|values| |
ed04a67da248
added #values for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
2681
diff
changeset
|
786 |
|
ed04a67da248
added #values for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
2681
diff
changeset
|
787 |
values := OrderedCollection new. |
ed04a67da248
added #values for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
2681
diff
changeset
|
788 |
self do:[:v | values add:v]. |
ed04a67da248
added #values for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
2681
diff
changeset
|
789 |
^ values |
ed04a67da248
added #values for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
2681
diff
changeset
|
790 |
|
ed04a67da248
added #values for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
2681
diff
changeset
|
791 |
"Created: 20.6.1997 / 16:58:28 / cg" |
453 | 792 |
! ! |
793 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
794 |
!Smalltalk class methodsFor:'binary storage'! |
453 | 795 |
|
2476 | 796 |
addGlobalsForBinaryStorageTo:globalDictionary |
453 | 797 |
|pools| |
798 |
||
799 |
pools := Set new. |
|
2465
1dfcacbbd376
ignore nil values when adding globals (binary storage)
Claus Gittinger <cg@exept.de>
parents:
2418
diff
changeset
|
800 |
|
879 | 801 |
self keysAndValuesDo:[:key :value | |
5363 | 802 |
(key includes:$:) ifFalse:[ "/ skip classVars |
803 |
(value ~~ self |
|
804 |
and:[value notNil]) ifTrue:[ |
|
805 |
value isClass ifTrue:[ |
|
806 |
value addGlobalsForBinaryStorageTo:globalDictionary. |
|
807 |
pools addAll:value sharedPools |
|
808 |
] ifFalse:[ |
|
809 |
globalDictionary at:(key->value) put:self |
|
810 |
]. |
|
811 |
value notNil ifTrue:[ |
|
812 |
globalDictionary at:value put:self |
|
813 |
] |
|
814 |
] |
|
815 |
] |
|
453 | 816 |
]. |
817 |
||
818 |
pools do:[:poolDictionary| |
|
5363 | 819 |
poolDictionary addGlobalsForBinaryStorageTo:globalDictionary |
453 | 820 |
] |
2465
1dfcacbbd376
ignore nil values when adding globals (binary storage)
Claus Gittinger <cg@exept.de>
parents:
2418
diff
changeset
|
821 |
|
1dfcacbbd376
ignore nil values when adding globals (binary storage)
Claus Gittinger <cg@exept.de>
parents:
2418
diff
changeset
|
822 |
"Modified: 19.3.1997 / 18:15:25 / cg" |
2476 | 823 |
"Created: 21.3.1997 / 15:40:31 / cg" |
453 | 824 |
! |
825 |
||
879 | 826 |
storeBinaryDefinitionOf:anObject on:stream manager:manager |
453 | 827 |
|string| |
828 |
||
829 |
anObject class == Association ifTrue:[ |
|
5363 | 830 |
string := 'Smalltalk associationAt: ', anObject key storeString |
453 | 831 |
] ifFalse: [ |
5363 | 832 |
string := 'Smalltalk at: ', (self keyAtValue: anObject) storeString |
453 | 833 |
]. |
834 |
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
|
835 |
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
|
836 |
"/ 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
|
837 |
|
1dfcacbbd376
ignore nil values when adding globals (binary storage)
Claus Gittinger <cg@exept.de>
parents:
2418
diff
changeset
|
838 |
"Modified: 19.3.1997 / 18:49:14 / cg" |
453 | 839 |
! ! |
840 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
841 |
!Smalltalk class methodsFor:'browsing'! |
453 | 842 |
|
617 | 843 |
browseAllCallsOn:aSelectorSymbol |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
844 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
845 |
|
617 | 846 |
"startup a browser for all methods sending a particular message" |
847 |
||
6020 | 848 |
UserPreferences systemBrowserClass browseAllCallsOn:aSelectorSymbol |
617 | 849 |
|
850 |
" |
|
851 |
Smalltalk browseAllCallsOn:#at:put: |
|
852 |
" |
|
853 |
! |
|
854 |
||
855 |
browseAllSelect:aBlock |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
856 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
857 |
|
617 | 858 |
"startup a browser for all methods for which aBlock returns true" |
859 |
||
6020 | 860 |
UserPreferences systemBrowserClass browseAllSelect:aBlock |
617 | 861 |
|
862 |
" |
|
863 |
Smalltalk browseAllSelect:[:m | m literals isNil] |
|
864 |
" |
|
865 |
! |
|
866 |
||
453 | 867 |
browseChanges |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
868 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
869 |
|
453 | 870 |
"startup a changes browser" |
871 |
||
872 |
ChangesBrowser notNil ifTrue:[ |
|
5363 | 873 |
ChangesBrowser open |
453 | 874 |
] ifFalse:[ |
5363 | 875 |
self warn:'no ChangesBrowser built in' |
453 | 876 |
] |
877 |
||
878 |
" |
|
879 |
Smalltalk browseChanges |
|
880 |
" |
|
881 |
! |
|
882 |
||
883 |
browseImplementorsOf:aSelectorSymbol |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
884 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
885 |
|
453 | 886 |
"startup a browser for all methods implementing a particular message" |
887 |
||
6020 | 888 |
UserPreferences systemBrowserClass browseImplementorsOf:aSelectorSymbol |
453 | 889 |
|
890 |
" |
|
891 |
Smalltalk browseImplementorsOf:#at:put: |
|
892 |
" |
|
893 |
! ! |
|
894 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
895 |
!Smalltalk class methodsFor:'class management'! |
453 | 896 |
|
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
897 |
changeCategoryOf:aClass to:newCategory |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
898 |
"change a classes category, add a change record, |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
899 |
send change notifications" |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
900 |
|
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
901 |
|ns| |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
902 |
|
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
903 |
aClass category ~= newCategory ifTrue:[ |
5363 | 904 |
aClass category:(newCategory withoutSeparators asSymbol). |
905 |
Project addChangeRecordForClass:aClass. |
|
906 |
||
907 |
"notify change of category" |
|
908 |
ns := aClass environment ? self. |
|
909 |
ns changed:#organization. |
|
910 |
ns ~~ self ifTrue:[ |
|
911 |
self changed:#organization. |
|
912 |
] |
|
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
913 |
]. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
914 |
|
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
915 |
" |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
916 |
Smalltalk changeCategoryOf:NewApplication to:#myApplications |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
917 |
" |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
918 |
|
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
919 |
"Modified: / 11.2.2000 / 11:36:27 / cg" |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
920 |
! |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
921 |
|
5306
806182135518
VW5i compatibility defineNameSpace: added
Claus Gittinger <cg@exept.de>
parents:
5285
diff
changeset
|
922 |
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
|
923 |
NameSpace name:name |
5306
806182135518
VW5i compatibility defineNameSpace: added
Claus Gittinger <cg@exept.de>
parents:
5285
diff
changeset
|
924 |
|
806182135518
VW5i compatibility defineNameSpace: added
Claus Gittinger <cg@exept.de>
parents:
5285
diff
changeset
|
925 |
! |
806182135518
VW5i compatibility defineNameSpace: added
Claus Gittinger <cg@exept.de>
parents:
5285
diff
changeset
|
926 |
|
5892
df4661be9da2
added individual cachedClass-flush
Claus Gittinger <cg@exept.de>
parents:
5881
diff
changeset
|
927 |
flushCachedClass:aClass |
5895 | 928 |
CachedClasses notNil ifTrue:[ |
929 |
CachedClasses remove:aClass ifAbsent:[] |
|
930 |
] |
|
5892
df4661be9da2
added individual cachedClass-flush
Claus Gittinger <cg@exept.de>
parents:
5881
diff
changeset
|
931 |
! |
df4661be9da2
added individual cachedClass-flush
Claus Gittinger <cg@exept.de>
parents:
5881
diff
changeset
|
932 |
|
453 | 933 |
flushCachedClasses |
934 |
CachedClasses := nil |
|
5580
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
935 |
|
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
936 |
" |
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
937 |
Smalltalk flushCachedClasses |
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
938 |
" |
453 | 939 |
! |
940 |
||
941 |
removeClass:aClass |
|
942 |
"remove the argument, aClass from the smalltalk dictionary; |
|
943 |
we have to flush the caches since these methods are now void. |
|
944 |
Also, class variables of aClass are removed." |
|
945 |
||
4781 | 946 |
|sym cSym names oldName oldNameSym actualName wrongName ns ons| |
453 | 947 |
|
4099 | 948 |
aClass isNil ifTrue:[^ self]. |
4781 | 949 |
|
453 | 950 |
oldName := aClass name. |
4781 | 951 |
sym := oldNameSym := oldName asSymbol. |
952 |
((self at:oldNameSym) == aClass) ifFalse:[ |
|
6020 | 953 |
"check other name ..." |
954 |
(self includes:aClass) ifFalse:[ |
|
955 |
'Smalltalk [warning]: no such class: ' errorPrint. oldName errorPrintCR. |
|
956 |
^ self |
|
957 |
]. |
|
958 |
" |
|
959 |
the class has changed its name - without telling me ... |
|
960 |
what should be done in this case ? |
|
961 |
" |
|
962 |
'Smalltalk [warning]: class ' errorPrint. oldName errorPrint. |
|
963 |
' has changed its name' errorPrintCR. |
|
964 |
||
965 |
"/ |
|
966 |
"/ might be an alias (i.e. removing a compatibility name) |
|
967 |
"/ |
|
968 |
actualName := self keyAtValue:aClass. |
|
969 |
('Smalltalk [info]: ' , oldName , ' is actually stored as ' , actualName , '.') infoPrintCR. |
|
970 |
sym := actualName asSymbol. |
|
971 |
oldName := actualName asString. |
|
972 |
wrongName := true. |
|
453 | 973 |
]. |
974 |
||
4781 | 975 |
ns := aClass nameSpace. |
976 |
aClass topOwningClass notNil ifTrue:[ |
|
6020 | 977 |
ons := aClass topOwningClass nameSpace |
4781 | 978 |
]. |
979 |
||
453 | 980 |
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
|
981 |
|
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
982 |
"/ |
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
983 |
"/ 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
|
984 |
"/ |
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
985 |
"/ self removeKey:sym. "/ remove key - this actually fails, if there are |
6020 | 986 |
"/ still compiled code references." |
453 | 987 |
|
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
988 |
"remove private classes" |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
989 |
|
2485
9f4a11a4521f
new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents:
2476
diff
changeset
|
990 |
aClass privateClassesSorted do:[:somePrivateClass | |
6020 | 991 |
aClass privateClassesAt:(somePrivateClass nameWithoutPrefix) asSymbol put:nil. |
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
992 |
]. |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
993 |
|
453 | 994 |
"remove class variables" |
995 |
||
996 |
names := aClass classVariableString asCollectionOfWords. |
|
997 |
names do:[:name | |
|
6020 | 998 |
cSym := (sym , ':' , name) asSymbol. |
999 |
self at:cSym asSymbol put:nil. |
|
1000 |
||
1001 |
"/ |
|
1002 |
"/ see comment in removeKey: on why we dont remove it here |
|
1003 |
"/ |
|
1004 |
"/ self removeKey:cSym |
|
453 | 1005 |
]. |
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1006 |
|
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1007 |
|
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1008 |
"/ actually could get along with less flushing |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1009 |
"/ (entries for aClass and subclasses only) |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1010 |
"/ 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
|
1011 |
"/ 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
|
1012 |
"/ expensive then cache flushing. |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1013 |
"/ |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1014 |
"/ aClass allSubclassesDo:[:aSubclass | |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1015 |
"/ ObjectMemory flushInlineCachesForClass:aSubclass. |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1016 |
"/ ObjectMemory flushMethodCacheFor:aSubclass |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1017 |
"/ ]. |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1018 |
"/ ObjectMemory flushInlineCachesForClass:aClass. |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1019 |
"/ ObjectMemory flushMethodCacheFor:aClass |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1020 |
|
453 | 1021 |
ObjectMemory flushInlineCaches. |
1022 |
ObjectMemory flushMethodCache. |
|
1023 |
||
1024 |
aClass addChangeRecordForClassRemove:oldName. |
|
1025 |
self changed:#classRemove with:aClass. |
|
1026 |
||
1655 | 1027 |
aClass category:#'* removed *'. |
1028 |
||
5326 | 1029 |
self flushCachedClasses. |
1030 |
Class flushSubclassInfo. |
|
1031 |
||
3627
452f2e1ff1b4
removeClass - care for aliases.
Claus Gittinger <cg@exept.de>
parents:
3626
diff
changeset
|
1032 |
wrongName == true ifTrue:[ |
6020 | 1033 |
"/ |
1034 |
"/ an alias (i.e. removing a compatibility name) |
|
1035 |
"/ |
|
1036 |
"/ check if there are more refs to it ... |
|
1037 |
[self includes:aClass] whileTrue:[ |
|
1038 |
actualName := self keyAtValue:aClass. |
|
1039 |
('Smalltalk [info]: ' , aClass name , ' is also registered under the name ' , actualName |
|
1040 |
, ' - remove that binding too.') infoPrintCR. |
|
1041 |
self at:actualName put:nil. |
|
1042 |
]. |
|
4724
44793fe70787
recompile ns classes after a class remove
Claus Gittinger <cg@exept.de>
parents:
4723
diff
changeset
|
1043 |
]. |
44793fe70787
recompile ns classes after a class remove
Claus Gittinger <cg@exept.de>
parents:
4723
diff
changeset
|
1044 |
|
4781 | 1045 |
ns ~~ Smalltalk ifTrue:[ |
6020 | 1046 |
ons notNil ifTrue:[ |
1047 |
ClassBuilder |
|
1048 |
recompileGlobalAccessorsTo:oldNameSym |
|
1049 |
in:ons |
|
1050 |
except:nil |
|
1051 |
]. |
|
1052 |
(ns notNil and:[ns ~~ ons]) ifTrue:[ |
|
1053 |
ClassBuilder |
|
1054 |
recompileGlobalAccessorsTo:oldNameSym |
|
1055 |
in:ns |
|
1056 |
except:nil |
|
1057 |
]. |
|
3627
452f2e1ff1b4
removeClass - care for aliases.
Claus Gittinger <cg@exept.de>
parents:
3626
diff
changeset
|
1058 |
]. |
452f2e1ff1b4
removeClass - care for aliases.
Claus Gittinger <cg@exept.de>
parents:
3626
diff
changeset
|
1059 |
|
452f2e1ff1b4
removeClass - care for aliases.
Claus Gittinger <cg@exept.de>
parents:
3626
diff
changeset
|
1060 |
"Modified: / 20.6.1998 / 13:26:10 / cg" |
617 | 1061 |
! |
1062 |
||
1063 |
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
|
1064 |
"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
|
1065 |
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
|
1066 |
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
|
1067 |
|
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1068 |
|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
|
1069 |
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
|
1070 |
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
|
1071 |
oldMetaclass newMetaclass| |
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1072 |
|
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1073 |
"/ check for all intermediate namespaces / owning classes |
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1074 |
i1 := 1. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1075 |
i2 := 1. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1076 |
ns := self. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1077 |
[i2 ~~ 0] whileTrue:[ |
5371
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1078 |
i2 := newName indexOfSubCollection:'::' startingAt:i1. |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1079 |
i2 ~~ 0 ifTrue:[ |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1080 |
nm := newName copyFrom:i1 to:i2-1. |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1081 |
ns isNameSpace ifTrue:[ |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1082 |
subns := ns at:nm asSymbol ifAbsent:nil. |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1083 |
subns isNil ifTrue:[ |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1084 |
self error:'Nonexisting namespace: ',nm. |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1085 |
^ nil. |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1086 |
]. |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1087 |
] ifFalse:[ |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1088 |
subns := ns privateClassesAt:nm asSymbol. |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1089 |
subns isNil ifTrue:[ |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1090 |
self error:'Cannot create a namespace below a class' |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1091 |
] |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1092 |
]. |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1093 |
ns := subns. |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1094 |
i1 := i2 + 2. |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1095 |
]. |
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1096 |
]. |
617 | 1097 |
|
1098 |
oldName := aClass name. |
|
2405
939f4e751ef3
dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents:
2379
diff
changeset
|
1099 |
aClass isPrivate ifTrue:[ |
5371
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1100 |
oldNameSpace := aClass topOwningClass nameSpace. |
2405
939f4e751ef3
dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents:
2379
diff
changeset
|
1101 |
] ifFalse:[ |
5371
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1102 |
oldNameSpace := aClass nameSpace. |
2405
939f4e751ef3
dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents:
2379
diff
changeset
|
1103 |
]. |
2319
640bb389f90a
recompile when moving classes across namespaces
Claus Gittinger <cg@exept.de>
parents:
2317
diff
changeset
|
1104 |
oldBaseName := aClass nameWithoutNameSpacePrefix. |
3698
8bce45214d24
fixed renaming of a private class (must recompile owner)
Claus Gittinger <cg@exept.de>
parents:
3678
diff
changeset
|
1105 |
oldBaseNameWithoutPrefix := aClass nameWithoutPrefix. |
617 | 1106 |
oldSym := oldName asSymbol. |
2485
9f4a11a4521f
new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents:
2476
diff
changeset
|
1107 |
privateClasses := aClass privateClassesSorted. |
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1108 |
|
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1109 |
((self at:oldSym) ~~ aClass) ifTrue:[ |
5371
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1110 |
'Smalltalk [warning]: rename failed - name is different from key' errorPrintCR. |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1111 |
^ self |
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1112 |
]. |
617 | 1113 |
|
1525
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1114 |
"/ rename the class |
617 | 1115 |
|
1847
6e567214b167
care for className being a symbol, when renaming classes
Claus Gittinger <cg@exept.de>
parents:
1758
diff
changeset
|
1116 |
newSym := newName asSymbol. |
6e567214b167
care for className being a symbol, when renaming classes
Claus Gittinger <cg@exept.de>
parents:
1758
diff
changeset
|
1117 |
aClass setName:newSym. |
617 | 1118 |
|
1525
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1119 |
"/ store it in Smalltalk |
617 | 1120 |
|
1121 |
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
|
1122 |
|
5610
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1123 |
"/ change the owning class |
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1124 |
ns isNameSpace ifFalse:[ |
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1125 |
aClass isPrivate ifTrue:[ |
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1126 |
aClass class setOwningClass:ns. |
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1127 |
] ifFalse:[ |
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1128 |
oldMetaclass := aClass class. |
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1129 |
|
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1130 |
"/ sigh - must make a PrivateMetaclass from Metaclass |
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1131 |
newMetaclass := PrivateMetaclass new. |
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1132 |
newMetaclass flags:(oldMetaclass flags). |
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1133 |
newMetaclass setSuperclass:(oldMetaclass superclass). |
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1134 |
newMetaclass instSize:(oldMetaclass instSize). |
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1135 |
newMetaclass setInstanceVariableString:(oldMetaclass instanceVariableString). |
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1136 |
newMetaclass setMethodDictionary:(oldMetaclass methodDictionary). |
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1137 |
newMetaclass setSoleInstance:aClass. |
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1138 |
newMetaclass setOwningClass:ns. |
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1139 |
|
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1140 |
aClass changeClassTo:newMetaclass. |
5613
b534e427f028
change message when renaming a class
Claus Gittinger <cg@exept.de>
parents:
5611
diff
changeset
|
1141 |
ObjectMemory flushCaches. |
5610
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1142 |
] |
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1143 |
] ifTrue:[ |
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1144 |
aClass isPrivate ifTrue:[ |
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1145 |
aClass class setOwningClass:nil. |
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1146 |
] |
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1147 |
]. |
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1148 |
|
878
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1149 |
"/ |
1525
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1150 |
"/ 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
|
1151 |
"/ |
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1152 |
"/ self removeKey:oldSym. |
617 | 1153 |
self at:newSym put:aClass. |
1154 |
||
1525
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1155 |
"/ 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
|
1156 |
|
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1157 |
oldNameToNewName := IdentityDictionary new. |
617 | 1158 |
|
1159 |
names := aClass classVariableString asCollectionOfWords. |
|
1160 |
names do:[:name | |
|
5371
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1161 |
oldCVSym := (oldSym , ':' , name) asSymbol. |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1162 |
value := self at:oldCVSym. |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1163 |
self at:oldCVSym put:nil. |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1164 |
|
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1165 |
"/ |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1166 |
"/ see comment in #removeKey: on why we dont remove it it here |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1167 |
"/ |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1168 |
"/ self removeKey:cSym. |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1169 |
|
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1170 |
newCVSym := (newSym , ':' , name) asSymbol. |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1171 |
self at:newCVSym put:value. |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1172 |
|
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1173 |
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
|
1174 |
]. |
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1175 |
|
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1176 |
"/ 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
|
1177 |
|
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1178 |
oldNameToNewName keysAndValuesDo:[:oldNameSym :newNameSym | |
5371
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1179 |
aClass withAllSubclasses do:[:aSubClass | |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1180 |
Transcript showCR:'changing global accesses from ''' , oldNameSym , ''' into ''' , newNameSym , ''' in class: ''' , aSubClass name , ''' ...'. |
6080
15ea3cbf6003
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
6074
diff
changeset
|
1181 |
aSubClass instAndClassSelectorsAndMethodsDo:[:sel :aMethod | |
5371
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1182 |
aMethod changeLiteral:oldNameSym to:newNameSym |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1183 |
]. |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1184 |
]. |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1185 |
|
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1186 |
"/ and also in privateClasses ? ... |
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1187 |
|
2485
9f4a11a4521f
new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents:
2476
diff
changeset
|
1188 |
"/ privateClasses size > 0 ifTrue:[ |
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1189 |
"/ privateClasses do:[:aPrivateClass | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1190 |
"/ aPrivateClass withAllSubclasses do:[:aSubClass | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1191 |
"/ aSubClass class methodDictionary do:[:aMethod | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1192 |
"/ aMethod changeLiteral:oldNameSym to:newNameSym |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1193 |
"/ ]. |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1194 |
"/ aSubClass methodDictionary do:[:aMethod | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1195 |
"/ aMethod changeLiteral:oldNameSym to:newNameSym |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1196 |
"/ ] |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1197 |
"/ ]. |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1198 |
"/ ] |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1199 |
"/ ] |
617 | 1200 |
]. |
1201 |
||
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1202 |
aClass addChangeRecordForClassRename:oldSym to:newSym. |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1203 |
|
5333
d80386e06d21
rename into other namespace did not work
Claus Gittinger <cg@exept.de>
parents:
5328
diff
changeset
|
1204 |
"/ 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
|
1205 |
aClass setEnvironment:nil. |
2405
939f4e751ef3
dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents:
2379
diff
changeset
|
1206 |
aClass isPrivate ifTrue:[ |
5371
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1207 |
newNameSpace := aClass topOwningClass nameSpace. |
2405
939f4e751ef3
dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents:
2379
diff
changeset
|
1208 |
] ifFalse:[ |
5371
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1209 |
newNameSpace := aClass nameSpace. |
2405
939f4e751ef3
dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents:
2379
diff
changeset
|
1210 |
]. |
939f4e751ef3
dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents:
2379
diff
changeset
|
1211 |
|
2485
9f4a11a4521f
new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents:
2476
diff
changeset
|
1212 |
privateClasses size > 0 ifTrue:[ |
5371
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1213 |
"/ must rename privateClasses as well |
5916
4364f9ae4254
when renaming a class, no changeRecrd for its private-class renames
Claus Gittinger <cg@exept.de>
parents:
5913
diff
changeset
|
1214 |
Class withoutUpdatingChangesDo:[ |
4364f9ae4254
when renaming a class, no changeRecrd for its private-class renames
Claus Gittinger <cg@exept.de>
parents:
5913
diff
changeset
|
1215 |
privateClasses do:[:aPrivateClass | |
4364f9ae4254
when renaming a class, no changeRecrd for its private-class renames
Claus Gittinger <cg@exept.de>
parents:
5913
diff
changeset
|
1216 |
self renameClass:aPrivateClass |
4364f9ae4254
when renaming a class, no changeRecrd for its private-class renames
Claus Gittinger <cg@exept.de>
parents:
5913
diff
changeset
|
1217 |
to:(newSym , '::' , aPrivateClass nameWithoutPrefix). |
4364f9ae4254
when renaming a class, no changeRecrd for its private-class renames
Claus Gittinger <cg@exept.de>
parents:
5913
diff
changeset
|
1218 |
|
4364f9ae4254
when renaming a class, no changeRecrd for its private-class renames
Claus Gittinger <cg@exept.de>
parents:
5913
diff
changeset
|
1219 |
Transcript showCR:'recompiling methods in ''' , newNameSpace name , ''' accessing ''' , oldName , '::' , aPrivateClass nameWithoutPrefix , ''' ...'. |
6020 | 1220 |
ClassBuilder |
5916
4364f9ae4254
when renaming a class, no changeRecrd for its private-class renames
Claus Gittinger <cg@exept.de>
parents:
5913
diff
changeset
|
1221 |
recompileGlobalAccessorsTo:(oldName , '::' , aPrivateClass nameWithoutPrefix) asSymbol |
4364f9ae4254
when renaming a class, no changeRecrd for its private-class renames
Claus Gittinger <cg@exept.de>
parents:
5913
diff
changeset
|
1222 |
in:newNameSpace |
4364f9ae4254
when renaming a class, no changeRecrd for its private-class renames
Claus Gittinger <cg@exept.de>
parents:
5913
diff
changeset
|
1223 |
except:nil. |
4364f9ae4254
when renaming a class, no changeRecrd for its private-class renames
Claus Gittinger <cg@exept.de>
parents:
5913
diff
changeset
|
1224 |
] |
5371
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1225 |
] |
2405
939f4e751ef3
dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents:
2379
diff
changeset
|
1226 |
]. |
939f4e751ef3
dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents:
2379
diff
changeset
|
1227 |
|
2319
640bb389f90a
recompile when moving classes across namespaces
Claus Gittinger <cg@exept.de>
parents:
2317
diff
changeset
|
1228 |
oldNameSpace ~~ newNameSpace ifTrue:[ |
5246
2ca7b20c4108
create namespaces as requried, when renaming a class
Claus Gittinger <cg@exept.de>
parents:
5214
diff
changeset
|
1229 |
|
5371
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1230 |
"/ all those referencing the class from the old nameSpace |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1231 |
"/ must be recompiled ... |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1232 |
"/ (to now access the global from smalltalk) |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1233 |
|
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1234 |
oldNameSpace ~~ Smalltalk ifTrue:[ |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1235 |
Transcript showCR:'recompiling methods in ''' , oldNameSpace name , ''' accessing ''' , oldName , ''' ...'. |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1236 |
|
6020 | 1237 |
ClassBuilder |
5371
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1238 |
recompileGlobalAccessorsTo:oldName asSymbol |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1239 |
in:oldNameSpace |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1240 |
except:nil. |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1241 |
]. |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1242 |
|
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1243 |
"/ all referencing the class in the new namespace |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1244 |
"/ as well; to now access the new class. |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1245 |
|
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1246 |
(newNameSpace notNil and:[newNameSpace ~~ Smalltalk]) ifTrue:[ |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1247 |
Transcript showCR:'recompiling methods in ''' , newNameSpace name , ''' accessing ''' , oldBaseName , ''' ...'. |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1248 |
|
6020 | 1249 |
ClassBuilder |
5371
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1250 |
recompileGlobalAccessorsTo:oldBaseName asSymbol |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1251 |
in:newNameSpace |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1252 |
except:nil. |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1253 |
]. |
3698
8bce45214d24
fixed renaming of a private class (must recompile owner)
Claus Gittinger <cg@exept.de>
parents:
3678
diff
changeset
|
1254 |
] ifFalse:[ |
5371
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1255 |
"/ all references to a global with my new name in my owning class |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1256 |
"/ must now be redirected to myself. |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1257 |
|
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1258 |
aClass isPrivate ifTrue:[ |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1259 |
newBaseName := aClass nameWithoutNameSpacePrefix. |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1260 |
newBaseNameWithoutPrefix := aClass nameWithoutPrefix. |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1261 |
|
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1262 |
Transcript showCR:'recompiling methods accessing ''' , oldBaseNameWithoutPrefix , ''' in: ''' , aClass owningClass name , ''' ...'. |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1263 |
aClass owningClass recompileMethodsAccessingGlobal:oldBaseNameWithoutPrefix. |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1264 |
aClass owningClass class recompileMethodsAccessingGlobal:oldBaseNameWithoutPrefix. |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1265 |
|
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1266 |
Transcript showCR:'recompiling methods accessing ''' , oldBaseName , ''' in: ''' , aClass owningClass name , ''' ...'. |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1267 |
aClass owningClass recompileMethodsAccessingGlobal:oldBaseName. |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1268 |
aClass owningClass class recompileMethodsAccessingGlobal:oldBaseName. |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1269 |
|
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1270 |
Transcript showCR:'recompiling methods accessing ''' , newBaseNameWithoutPrefix , ''' in: ''' , aClass owningClass name , ''' ...'. |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1271 |
aClass owningClass recompileMethodsAccessingGlobal:newBaseNameWithoutPrefix. |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1272 |
aClass owningClass class recompileMethodsAccessingGlobal:newBaseNameWithoutPrefix. |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1273 |
|
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1274 |
Transcript showCR:'recompiling methods accessing ''' , newBaseName , ''' in: ''' , aClass owningClass name , ''' ...'. |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1275 |
aClass owningClass recompileMethodsAccessingGlobal:newBaseName. |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1276 |
aClass owningClass class recompileMethodsAccessingGlobal:newBaseName. |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1277 |
] |
4040
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1278 |
]. |
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1279 |
|
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1280 |
aClass changed:#definition. |
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1281 |
"/ 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
|
1282 |
aClass allSubclassesDo:[:subClass | |
5371
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
1283 |
subClass changed:#definition. |
4040
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1284 |
]. |
5613
b534e427f028
change message when renaming a class
Claus Gittinger <cg@exept.de>
parents:
5611
diff
changeset
|
1285 |
self changed:#definition. |
b534e427f028
change message when renaming a class
Claus Gittinger <cg@exept.de>
parents:
5611
diff
changeset
|
1286 |
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
|
1287 |
|
8bce45214d24
fixed renaming of a private class (must recompile owner)
Claus Gittinger <cg@exept.de>
parents:
3678
diff
changeset
|
1288 |
"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
|
1289 |
"Modified: / 18.6.1996 / 14:20:50 / stefan" |
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1290 |
"Modified: / 11.2.2000 / 01:12:38 / cg" |
453 | 1291 |
! ! |
1292 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1293 |
!Smalltalk class methodsFor:'copying'! |
453 | 1294 |
|
617 | 1295 |
deepCopy |
1410 | 1296 |
"redefined to return self - there is only one Smalltalk dictionary" |
453 | 1297 |
|
1298 |
^ self |
|
1410 | 1299 |
|
1300 |
"Modified: 18.5.1996 / 12:13:33 / cg" |
|
453 | 1301 |
! |
1302 |
||
1303 |
deepCopyUsing:aDictionary |
|
1410 | 1304 |
"redefined to return self - there is only one Smalltalk dictionary" |
453 | 1305 |
|
1306 |
^ self |
|
1410 | 1307 |
|
1308 |
"Modified: 18.5.1996 / 12:13:36 / cg" |
|
453 | 1309 |
! |
1310 |
||
617 | 1311 |
shallowCopy |
1410 | 1312 |
"redefined to return self - there is only one Smalltalk dictionary" |
617 | 1313 |
|
1314 |
^ self |
|
1410 | 1315 |
|
1316 |
"Modified: 18.5.1996 / 12:13:39 / cg" |
|
617 | 1317 |
! |
1318 |
||
1319 |
simpleDeepCopy |
|
1410 | 1320 |
"redefined to return self - there is only one Smalltalk dictionary" |
453 | 1321 |
|
1322 |
^ self |
|
1410 | 1323 |
|
1324 |
"Modified: 18.5.1996 / 12:13:42 / cg" |
|
453 | 1325 |
! ! |
1326 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1327 |
!Smalltalk class methodsFor:'debugging ST/X'! |
453 | 1328 |
|
1329 |
debugBreakPoint |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1330 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1331 |
|
453 | 1332 |
"call the dummy debug function, on which a breakpoint |
1333 |
can be put in adb, sdb, dbx or gdb. |
|
1334 |
WARNING: this method is for debugging only |
|
5410 | 1335 |
it will be removed without notice." |
453 | 1336 |
%{ |
2212 | 1337 |
__PATCHUPCONTEXTS(__context); |
808
1919838112d1
renamed debugBreakPoint -> __debugBreakPoint__
Claus Gittinger <cg@exept.de>
parents:
796
diff
changeset
|
1338 |
__debugBreakPoint__(); |
5410 | 1339 |
RETURN(self); |
1340 |
%}. |
|
1341 |
^ self primitiveFailed |
|
1342 |
||
1343 |
||
453 | 1344 |
! |
1345 |
||
617 | 1346 |
exitWithCoreDump |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1347 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1348 |
|
617 | 1349 |
"abort program and dump core" |
1350 |
||
4096
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1351 |
OperatingSystem exitWithCoreDump |
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1352 |
"/ never returns |
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1353 |
|
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1354 |
"Be careful evaluating this |
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1355 |
Smalltalk exitWithCoreDump |
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1356 |
" |
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1357 |
|
617 | 1358 |
! |
1359 |
||
1360 |
fatalAbort |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1361 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1362 |
|
617 | 1363 |
"report a fatal-error, print a stack backtrace and exit with core dump. |
1364 |
(You may turn off the stack print with debugPrinting:false)" |
|
1365 |
%{ |
|
1366 |
__fatal0(__context, "fatalAbort"); |
|
1367 |
/* NEVER RETURNS */ |
|
5410 | 1368 |
%}. |
1369 |
^ self primitiveFailed |
|
1370 |
||
617 | 1371 |
! |
1372 |
||
1373 |
fatalAbort:aMessage |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1374 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1375 |
|
617 | 1376 |
"report a fatal-error; print a stack backtrace and exit with core dump |
1377 |
(You may turn off the stack print with debugPrinting:false)" |
|
1378 |
||
1379 |
%{ |
|
1380 |
char *msg; |
|
1381 |
||
1382 |
if (__isString(aMessage)) |
|
5410 | 1383 |
msg = (char *) __stringVal(aMessage); |
617 | 1384 |
else |
5410 | 1385 |
msg = "fatalAbort"; |
617 | 1386 |
|
1387 |
__fatal0(__context, msg); |
|
1388 |
/* NEVER RETURNS */ |
|
5410 | 1389 |
%}. |
1390 |
^ self primitiveFailed |
|
1391 |
||
5441 | 1392 |
! |
1393 |
||
1394 |
vmInstructionTrace:aBoolean |
|
1395 |
||
1396 |
||
453 | 1397 |
! ! |
1398 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1399 |
!Smalltalk class methodsFor:'enumerating'! |
453 | 1400 |
|
1401 |
allBehaviorsDo:aBlock |
|
5580
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1402 |
"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
|
1403 |
|
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1404 |
self allClassesAndMetaclassesDo:aBlock |
453 | 1405 |
|
1406 |
" |
|
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
1407 |
Smalltalk allBehaviorsDo:[:aClass | aClass name printCR] |
453 | 1408 |
" |
1409 |
! |
|
1410 |
||
6217
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1411 |
allClassCategories |
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1412 |
"return a set of all class categories in the system" |
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1413 |
|
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1414 |
|allCategories| |
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1415 |
|
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1416 |
allCategories := Set new. |
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1417 |
Smalltalk allClassesDo:[:cls | |
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1418 |
allCategories add:cls category. |
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1419 |
]. |
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1420 |
|
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1421 |
allCategories := allCategories asOrderedCollection. |
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1422 |
allCategories sort. |
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1423 |
^ allCategories |
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1424 |
|
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1425 |
" |
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1426 |
Smalltalk allClassCategories |
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1427 |
" |
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1428 |
|
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1429 |
"Created: / 17.11.2001 / 12:13:09 / cg" |
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1430 |
! |
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1431 |
|
5579
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1432 |
allClassesAndMetaclassesDo:aBlock |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1433 |
"evaluate the argument, aBlock for all classes and metaclasses in the system." |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1434 |
|
5940
804fb27727a6
oops - allClassesAndMetaclassesDo: evaluated block twice for
Claus Gittinger <cg@exept.de>
parents:
5916
diff
changeset
|
1435 |
|already| |
804fb27727a6
oops - allClassesAndMetaclassesDo: evaluated block twice for
Claus Gittinger <cg@exept.de>
parents:
5916
diff
changeset
|
1436 |
|
804fb27727a6
oops - allClassesAndMetaclassesDo: evaluated block twice for
Claus Gittinger <cg@exept.de>
parents:
5916
diff
changeset
|
1437 |
already := IdentitySet new. |
804fb27727a6
oops - allClassesAndMetaclassesDo: evaluated block twice for
Claus Gittinger <cg@exept.de>
parents:
5916
diff
changeset
|
1438 |
self allClassesDo:[:eachClass | |cls| |
804fb27727a6
oops - allClassesAndMetaclassesDo: evaluated block twice for
Claus Gittinger <cg@exept.de>
parents:
5916
diff
changeset
|
1439 |
cls := eachClass theNonMetaclass. |
804fb27727a6
oops - allClassesAndMetaclassesDo: evaluated block twice for
Claus Gittinger <cg@exept.de>
parents:
5916
diff
changeset
|
1440 |
(already includes:cls) ifFalse:[ |
804fb27727a6
oops - allClassesAndMetaclassesDo: evaluated block twice for
Claus Gittinger <cg@exept.de>
parents:
5916
diff
changeset
|
1441 |
aBlock value:cls. |
804fb27727a6
oops - allClassesAndMetaclassesDo: evaluated block twice for
Claus Gittinger <cg@exept.de>
parents:
5916
diff
changeset
|
1442 |
already add:cls. |
804fb27727a6
oops - allClassesAndMetaclassesDo: evaluated block twice for
Claus Gittinger <cg@exept.de>
parents:
5916
diff
changeset
|
1443 |
]. |
6490 | 1444 |
cls := cls class. |
5940
804fb27727a6
oops - allClassesAndMetaclassesDo: evaluated block twice for
Claus Gittinger <cg@exept.de>
parents:
5916
diff
changeset
|
1445 |
(already includes:cls) ifFalse:[ |
804fb27727a6
oops - allClassesAndMetaclassesDo: evaluated block twice for
Claus Gittinger <cg@exept.de>
parents:
5916
diff
changeset
|
1446 |
aBlock value:cls. |
804fb27727a6
oops - allClassesAndMetaclassesDo: evaluated block twice for
Claus Gittinger <cg@exept.de>
parents:
5916
diff
changeset
|
1447 |
already add:cls. |
804fb27727a6
oops - allClassesAndMetaclassesDo: evaluated block twice for
Claus Gittinger <cg@exept.de>
parents:
5916
diff
changeset
|
1448 |
]. |
5579
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1449 |
]. |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1450 |
! |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1451 |
|
453 | 1452 |
allClassesDo:aBlock |
5580
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1453 |
"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
|
1454 |
|
5765 | 1455 |
self allClasses do:aBlock |
453 | 1456 |
|
1457 |
" |
|
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
1458 |
Smalltalk allClassesDo:[:aClass | aClass name printCR] |
453 | 1459 |
" |
1460 |
! |
|
1461 |
||
1299 | 1462 |
allClassesInCategory:aCategory |
1463 |
"return a collection of for all classes in aCategory; |
|
1464 |
The order of the classes is not defined." |
|
1465 |
||
1466 |
|coll| |
|
1467 |
||
1468 |
coll := OrderedCollection new. |
|
1469 |
self allClassesInCategory:aCategory do:[:aClass | |
|
5363 | 1470 |
coll add:aClass |
1299 | 1471 |
]. |
1472 |
^ coll |
|
1473 |
||
1474 |
" |
|
1475 |
Smalltalk allClassesInCategory:'Views-Basic' |
|
1476 |
" |
|
1477 |
||
1478 |
"Modified: 25.4.1996 / 18:06:13 / cg" |
|
1479 |
! |
|
1480 |
||
453 | 1481 |
allClassesInCategory:aCategory do:aBlock |
1482 |
"evaluate the argument, aBlock for all classes in the aCategory; |
|
1483 |
The order of the classes is not defined." |
|
1484 |
||
1485 |
aCategory notNil ifTrue:[ |
|
5580
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1486 |
self allClassesDo:[:aClass | |
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1487 |
aClass isMeta ifFalse:[ |
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1488 |
(aClass category = aCategory) ifTrue:[ |
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1489 |
aBlock value:aClass |
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1490 |
] |
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1491 |
] |
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1492 |
] |
453 | 1493 |
] |
1494 |
||
1495 |
" |
|
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
1496 |
Smalltalk allClassesInCategory:'Views-Basic' do:[:aClass | aClass name printCR] |
453 | 1497 |
" |
1498 |
! |
|
1499 |
||
1500 |
allClassesInCategory:aCategory inOrderDo:aBlock |
|
1501 |
"evaluate the argument, aBlock for all classes in aCategory; |
|
1502 |
superclasses come first - then subclasses" |
|
1503 |
||
1504 |
|classes| |
|
1505 |
||
1506 |
aCategory notNil ifTrue:[ |
|
5580
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1507 |
classes := OrderedCollection new. |
6217
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1508 |
self allClassesInCategory:aCategory do:[:aClass | |
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1509 |
classes add:aClass |
5580
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1510 |
]. |
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1511 |
classes topologicalSort:[:a :b | b isSubclassOf:a]. |
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1512 |
classes do:aBlock |
453 | 1513 |
] |
1514 |
||
1515 |
" |
|
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
1516 |
Smalltalk allClassesInCategory:'Views-Basic' inOrderDo:[:aClass | aClass name printCR] |
453 | 1517 |
" |
6217
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1518 |
|
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1519 |
"Modified: / 17.11.2001 / 12:18:15 / cg" |
617 | 1520 |
! |
1521 |
||
5406 | 1522 |
allClassesInOrderDo:aBlock |
1523 |
"evaluate the argument, aBlock for all classes in the system; |
|
1524 |
Evaluation order is by inheritance: superclasses come first." |
|
1525 |
||
1526 |
|already| |
|
1527 |
||
1528 |
already := IdentitySet new. |
|
5580
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1529 |
self allClassesDo:[:aClass | |
5406 | 1530 |
(already includes:aClass) ifFalse:[ |
1531 |
aClass allSuperclasses reverseDo:[:cls | |
|
1532 |
(already includes:aClass) ifFalse:[ |
|
1533 |
already add:cls. |
|
1534 |
aBlock value:cls. |
|
1535 |
]. |
|
1536 |
]. |
|
1537 |
already add:aClass. |
|
1538 |
aBlock value:aClass. |
|
1539 |
] |
|
1540 |
]. |
|
1541 |
||
1542 |
" |
|
1543 |
Smalltalk allClassesInOrderDo:[:aClass | aClass name printCR] |
|
1544 |
" |
|
1545 |
! |
|
1546 |
||
617 | 1547 |
allKeysDo:aBlock |
1548 |
"evaluate the argument, aBlock for all keys in the Smalltalk dictionary" |
|
1549 |
||
1550 |
^ self keysDo:aBlock |
|
1551 |
! |
|
1552 |
||
1553 |
associationsDo:aBlock |
|
1554 |
"evaluate the argument, aBlock for all key/value pairs |
|
1555 |
in the Smalltalk dictionary" |
|
1556 |
||
1557 |
self keysDo:[:aKey | |
|
5363 | 1558 |
aBlock value:(aKey -> (self at:aKey)) |
617 | 1559 |
] |
1560 |
||
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
1561 |
"Smalltalk associationsDo:[:assoc | assoc printCR]" |
617 | 1562 |
! |
1563 |
||
5406 | 1564 |
basicKeys |
1565 |
"for rel > 5 only" |
|
1566 |
||
1567 |
self primitiveFailed |
|
1568 |
||
1569 |
||
1570 |
||
1571 |
||
1572 |
||
1573 |
||
1574 |
! |
|
1575 |
||
617 | 1576 |
do:aBlock |
1577 |
"evaluate the argument, aBlock for all values in the Smalltalk dictionary" |
|
1578 |
||
1579 |
|work| |
|
1580 |
||
1581 |
%{ /* 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
|
1582 |
__GLOBALS_DO(&aBlock, &work); |
5406 | 1583 |
RETURN (self); |
1584 |
%}. |
|
1585 |
self keysDo:[:aKey | |
|
1586 |
aBlock value:(self at:aKey) |
|
1587 |
] |
|
617 | 1588 |
! |
1589 |
||
1590 |
keysAndValuesDo:aBlock |
|
1591 |
"evaluate the two-arg block, aBlock for all keys and values" |
|
1592 |
||
1593 |
self keysDo:[:aKey | |
|
5363 | 1594 |
aBlock value:aKey value:(self at:aKey) |
617 | 1595 |
] |
1596 |
! |
|
1597 |
||
1598 |
keysDo:aBlock |
|
1599 |
"evaluate the argument, aBlock for all keys in the Smalltalk dictionary" |
|
1600 |
|work| |
|
1601 |
||
1602 |
%{ /* 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
|
1603 |
__GLOBALKEYS_DO(&aBlock, &work); |
5406 | 1604 |
RETURN (self); |
1605 |
%}. |
|
1606 |
self basicKeys do:[:aKey | |
|
1607 |
aBlock value:aKey |
|
1608 |
] |
|
453 | 1609 |
! ! |
1610 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1611 |
!Smalltalk class methodsFor:'inspecting'! |
453 | 1612 |
|
1613 |
inspectorClass |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1614 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1615 |
|
453 | 1616 |
"redefined to launch a DictionaryInspector |
1617 |
(instead of the default Inspector)." |
|
1618 |
||
1619 |
^ DictionaryInspectorView |
|
1620 |
! ! |
|
1621 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1622 |
!Smalltalk class methodsFor:'message control'! |
453 | 1623 |
|
1624 |
silentLoading |
|
1625 |
"returns the Silentloading class variable." |
|
1626 |
||
1627 |
^ SilentLoading |
|
1628 |
! |
|
1629 |
||
1630 |
silentLoading:aBoolean |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1631 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1632 |
|
453 | 1633 |
"allows access to the Silentloading class variable, which controls |
1634 |
messages from all kinds of system onto the transcript. |
|
1635 |
You can save a snapshot with this flag set to true, which makes |
|
1636 |
the image come up silent. Can also be set, to read in files unlogged." |
|
1637 |
||
1638 |
|prev| |
|
1639 |
||
1640 |
prev := SilentLoading. |
|
1641 |
SilentLoading := aBoolean. |
|
1642 |
^ prev |
|
1643 |
! ! |
|
1644 |
||
4957 | 1645 |
!Smalltalk class methodsFor:'misc accessing'! |
1646 |
||
1647 |
beHeadless:aBoolean |
|
1648 |
"set/clear the headlessOperation flag." |
|
1649 |
||
1650 |
HeadlessOperation := aBoolean |
|
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
1651 |
! |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
1652 |
|
6564 | 1653 |
standAloneApp:aBoolean |
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
1654 |
"set/clear the StandAlone flag." |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
1655 |
|
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
1656 |
StandAlone := aBoolean |
4957 | 1657 |
! ! |
1658 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1659 |
!Smalltalk class methodsFor:'misc stuff'! |
453 | 1660 |
|
617 | 1661 |
addExitBlock:aBlock |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1662 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1663 |
|
617 | 1664 |
"add a block to be executed when Smalltalk finishes. |
1665 |
This feature is currently not used anywhere - but could be useful for |
|
1666 |
cleanup in stand alone applications." |
|
1667 |
||
1668 |
ExitBlocks isNil ifTrue:[ |
|
5363 | 1669 |
ExitBlocks := OrderedCollection with:aBlock |
617 | 1670 |
] ifFalse:[ |
5363 | 1671 |
ExitBlocks add:aBlock |
617 | 1672 |
] |
1673 |
! |
|
1674 |
||
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1675 |
addImageStartBlock:aBlock |
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1676 |
"{ Pragma: +optSpace }" |
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1677 |
|
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1678 |
"add a blocks to be executed in a separate process after |
2681 | 1679 |
everything has been initialized. |
1680 |
These blocks will be executed after an image restart." |
|
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1681 |
|
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1682 |
ImageStartBlocks isNil ifTrue:[ |
5363 | 1683 |
ImageStartBlocks := OrderedCollection with:aBlock |
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1684 |
] ifFalse:[ |
5363 | 1685 |
ImageStartBlocks add:aBlock |
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1686 |
] |
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1687 |
|
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1688 |
"Created: 9.9.1996 / 16:48:20 / stefan" |
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1689 |
! |
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1690 |
|
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1691 |
addStartBlock:aBlock |
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1692 |
"{ Pragma: +optSpace }" |
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1693 |
|
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1694 |
"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
|
1695 |
everything has been initialized. These blocks will |
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1696 |
be deleted after execution and therefore not be |
2681 | 1697 |
executed after an image restart. |
1698 |
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
|
1699 |
|
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1700 |
StartBlocks isNil ifTrue:[ |
5363 | 1701 |
StartBlocks := OrderedCollection with:aBlock |
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1702 |
] ifFalse:[ |
5363 | 1703 |
StartBlocks add:aBlock |
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1704 |
] |
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1705 |
|
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1706 |
"Created: 9.9.1996 / 16:46:53 / stefan" |
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1707 |
! |
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1708 |
|
453 | 1709 |
exit |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1710 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1711 |
|
3976
bfba94385ed0
added #aboutToExit notification
Claus Gittinger <cg@exept.de>
parents:
3971
diff
changeset
|
1712 |
"finish the Smalltalk system" |
bfba94385ed0
added #aboutToExit notification
Claus Gittinger <cg@exept.de>
parents:
3971
diff
changeset
|
1713 |
|
bfba94385ed0
added #aboutToExit notification
Claus Gittinger <cg@exept.de>
parents:
3971
diff
changeset
|
1714 |
ObjectMemory changed:#aboutToExit. "/ for ST/X backward compatibility |
453 | 1715 |
ObjectMemory changed:#aboutToQuit. "/ for ST-80 compatibility |
1716 |
ExitBlocks notNil ifTrue:[ |
|
5363 | 1717 |
ExitBlocks do:[:aBlock | |
1718 |
aBlock value |
|
1719 |
] |
|
453 | 1720 |
]. |
1721 |
OperatingSystem exit |
|
4096
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1722 |
"/ never returns |
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1723 |
|
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1724 |
"Be careful evaluating this |
453 | 1725 |
Smalltalk exit |
1726 |
" |
|
1727 |
! |
|
1728 |
||
1729 |
sleep:aDelay |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1730 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1731 |
|
453 | 1732 |
"wait for aDelay seconds. |
1733 |
OBSOLETE: this is historical leftover and will be removed" |
|
1734 |
||
1735 |
OperatingSystem sleep:aDelay |
|
1736 |
! ! |
|
1737 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1738 |
!Smalltalk class methodsFor:'queries'! |
453 | 1739 |
|
1740 |
allClasses |
|
1741 |
"return an unordered collection of all classes in the system. |
|
1742 |
Only globally anchored classes are returned |
|
1743 |
(i.e. anonymous ones have to be aquired by Behavior allSubInstances)" |
|
1744 |
||
1745 |
|classes| |
|
1746 |
||
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
1747 |
"/ you may wonder, what this while is for, here ... |
453 | 1748 |
"/ the reason is that if we modify the class hierarchy in |
4067 | 1749 |
"/ another view (background fileIn), while building up the |
453 | 1750 |
"/ cachedClasses set, this may be flushed (invalidated) by the |
1751 |
"/ other process in the meanwhile. |
|
1752 |
"/ If that happens, we restart the set-building here |
|
1753 |
"/ |
|
1754 |
[(classes := CachedClasses) isNil] whileTrue:[ |
|
5579
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1755 |
CachedClasses := classes := IdentitySet new:800. |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1756 |
self keysAndValuesDo:[:sym :anObject | |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1757 |
anObject notNil ifTrue:[ |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1758 |
anObject isBehavior ifTrue:[ |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1759 |
"/ sigh - would like to skip over aliases |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1760 |
"/ but this cannot be done simply by comparing |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1761 |
"/ the classes name against the store-key |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1762 |
"/ i.e. cannot do: |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1763 |
"/ anObject name == sym ifTrue:[ |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1764 |
"/ classes add:anObject |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1765 |
"/ ] |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1766 |
"/ because that would lead to ignore all java |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1767 |
"/ classes, which are stored under a different |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1768 |
"/ key. |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1769 |
|
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1770 |
(anObject name == sym |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1771 |
or:[anObject isJavaClass]) ifTrue:[ |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1772 |
classes add:anObject |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1773 |
]. |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1774 |
] |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1775 |
] |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1776 |
] |
453 | 1777 |
]. |
1778 |
^ classes |
|
1779 |
||
4618
f5a0e70205c9
oops - do not check for classes name = key (java stuff)
Claus Gittinger <cg@exept.de>
parents:
4607
diff
changeset
|
1780 |
"CachedClasses := nil. |
453 | 1781 |
Smalltalk allClasses |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
1782 |
|
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
1783 |
to get the list sorted by name: |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
1784 |
|
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
1785 |
Smalltalk allClasses asSortedCollection:[:a :b | a name < b name] |
453 | 1786 |
" |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
1787 |
|
5278 | 1788 |
"Modified: / 23.2.2000 / 10:49:46 / cg" |
453 | 1789 |
! |
1790 |
||
5579
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1791 |
allClassesAndMetaclasses |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1792 |
"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
|
1793 |
|
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1794 |
|classes| |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1795 |
|
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1796 |
classes := IdentitySet new. |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1797 |
self allClassesDo:[:eachClass | |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1798 |
classes add:(eachClass theNonMetaclass). |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1799 |
classes add:(eachClass theMetaclass). |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1800 |
]. |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1801 |
^ classes |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1802 |
! |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1803 |
|
4642 | 1804 |
allClassesWithAllPrivateClasses |
1805 |
"return an unordered collection of all classes in the Smalltalk namespace. |
|
1806 |
Only globally anchored classes are returned |
|
1807 |
(i.e. anonymous ones have to be aquired by Behavior allSubInstances)" |
|
1808 |
||
1809 |
^ self allClasses select:[:aClass | |
|
5363 | 1810 |
|owner| |
1811 |
||
1812 |
(aClass isNameSpace not |
|
1813 |
or:[aClass == Smalltalk]) |
|
1814 |
and:[ |
|
1815 |
owner := aClass topOwningClass. |
|
1816 |
(owner ? aClass) nameSpace == Smalltalk |
|
1817 |
] |
|
4642 | 1818 |
] |
1819 |
||
1820 |
" |
|
1821 |
Smalltalk allClassesWithAllPrivateClasses |
|
1822 |
" |
|
1823 |
! |
|
1824 |
||
617 | 1825 |
cellAt:aName |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1826 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1827 |
|
617 | 1828 |
"return the address of a global cell |
1829 |
- used internally for compiler only" |
|
1830 |
||
1831 |
%{ /* NOCONTEXT */ |
|
1832 |
RETURN ( __GLOBAL_GETCELL(aName) ); |
|
5406 | 1833 |
%}. |
5410 | 1834 |
^ self primitiveFailed |
1835 |
||
617 | 1836 |
! |
1837 |
||
6539 | 1838 |
classCategoryCompletion:aPartialCategory |
1839 |
"given a partial class category name, return an array consisting of |
|
1840 |
2 entries: 1st: collection consisting of matching categories |
|
1841 |
2nd: the longest match" |
|
1842 |
||
1843 |
|matches best lcName| |
|
1844 |
||
1845 |
matches := IdentitySet new. |
|
1846 |
||
1847 |
"/ search for exact match |
|
1848 |
self allClassesDo:[:aClass | |
|
1849 |
|category| |
|
1850 |
||
1851 |
category := aClass category. |
|
1852 |
(category notNil and:[category startsWith:aPartialCategory]) ifTrue:[ |
|
1853 |
matches add:category |
|
1854 |
] |
|
1855 |
]. |
|
1856 |
matches isEmpty ifTrue:[ |
|
1857 |
"/ search for case-ignoring match |
|
1858 |
lcName := aPartialCategory asLowercase. |
|
1859 |
self allClassesDo:[:aClass | |
|
1860 |
|category| |
|
1861 |
||
1862 |
category := aClass category. |
|
1863 |
(category asLowercase startsWith:lcName) ifTrue:[ |
|
1864 |
matches add:category |
|
1865 |
]. |
|
1866 |
]. |
|
1867 |
]. |
|
1868 |
||
1869 |
matches isEmpty ifTrue:[ |
|
1870 |
^ Array with:aPartialCategory with:(Array with:aPartialCategory) |
|
1871 |
]. |
|
1872 |
matches size == 1 ifTrue:[ |
|
1873 |
^ Array with:matches first with:(matches asArray) |
|
1874 |
]. |
|
1875 |
matches := matches asSortedCollection. |
|
1876 |
best := matches longestCommonPrefix. |
|
1877 |
^ Array with:best with:matches asArray |
|
1878 |
||
1879 |
" |
|
1880 |
Smalltalk classCategoryCompletion:'Sys' |
|
1881 |
Smalltalk classCategoryCompletion:'System' |
|
1882 |
Smalltalk classCategoryCompletion:'System-BinaryStorage' |
|
1883 |
" |
|
1884 |
! |
|
1885 |
||
453 | 1886 |
classNamed:aString |
1887 |
"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
|
1888 |
To get to the metaClass, append ' class' to the string." |
453 | 1889 |
|
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
1890 |
|cls sym meta| |
453 | 1891 |
|
1892 |
"be careful, to not invent new symbols ..." |
|
1893 |
sym := aString asSymbolIfInterned. |
|
1894 |
sym notNil ifTrue:[ |
|
5363 | 1895 |
cls := self at:sym ifAbsent:[]. |
1896 |
cls isBehavior ifTrue:[^ cls] |
|
453 | 1897 |
]. |
1480
df0bea6285f8
Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
1898 |
(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
|
1899 |
|
5363 | 1900 |
meta := self classNamed:(aString copyWithoutLast:6). |
1901 |
meta notNil ifTrue:[ |
|
1902 |
^ meta class |
|
1903 |
]. |
|
453 | 1904 |
]. |
1905 |
^ nil |
|
1906 |
||
1907 |
" |
|
1908 |
Smalltalk classNamed:'Object' |
|
1909 |
Smalltalk classNamed:'fooBar' |
|
1910 |
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
|
1911 |
Smalltalk classNamed:'Object class' |
453 | 1912 |
Smalltalk classNamed:'Metaclass' |
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
1913 |
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
|
1914 |
Smalltalk classNamed:'Array class' |
453 | 1915 |
" |
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
1916 |
|
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
1917 |
"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
|
1918 |
"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
|
1919 |
"Modified: 19.6.1996 / 14:22:21 / stefan" |
453 | 1920 |
! |
1921 |
||
1922 |
classNames |
|
1923 |
"return a collection of all classNames in the system" |
|
1924 |
||
1925 |
^ self allClasses collect:[:aClass | aClass name] |
|
1926 |
||
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
1927 |
" |
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
1928 |
Smalltalk classNames |
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
1929 |
" |
453 | 1930 |
! |
1931 |
||
1932 |
classnameCompletion:aPartialClassName |
|
1933 |
"given a partial classname, return an array consisting of |
|
1934 |
2 entries: 1st: collection consisting of matching names |
|
6403
2b81e1bc42ea
better classNameCompletion (namespaces)
Claus Gittinger <cg@exept.de>
parents:
6390
diff
changeset
|
1935 |
2nd: the best (longest) match" |
2b81e1bc42ea
better classNameCompletion (namespaces)
Claus Gittinger <cg@exept.de>
parents:
6390
diff
changeset
|
1936 |
|
6472
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
1937 |
^ self |
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
1938 |
classnameCompletion:aPartialClassName inEnvironment:self |
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
1939 |
! |
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
1940 |
|
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
1941 |
classnameCompletion:aPartialClassName inEnvironment:anEnvironment |
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
1942 |
"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
|
1943 |
2 entries: 1st: collection consisting of matching names |
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
1944 |
2nd: the best (longest) match" |
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
1945 |
|
6438
9df1edfc0b54
class-name completion (ith namespace-prefix)
Claus Gittinger <cg@exept.de>
parents:
6421
diff
changeset
|
1946 |
|searchName matches ignCaseMatches best isMatchString cls nsPrefix | |
9df1edfc0b54
class-name completion (ith namespace-prefix)
Claus Gittinger <cg@exept.de>
parents:
6421
diff
changeset
|
1947 |
|
9df1edfc0b54
class-name completion (ith namespace-prefix)
Claus Gittinger <cg@exept.de>
parents:
6421
diff
changeset
|
1948 |
aPartialClassName isEmpty ifTrue:[ |
9df1edfc0b54
class-name completion (ith namespace-prefix)
Claus Gittinger <cg@exept.de>
parents:
6421
diff
changeset
|
1949 |
^ Array with:aPartialClassName with:#() |
9df1edfc0b54
class-name completion (ith namespace-prefix)
Claus Gittinger <cg@exept.de>
parents:
6421
diff
changeset
|
1950 |
]. |
9df1edfc0b54
class-name completion (ith namespace-prefix)
Claus Gittinger <cg@exept.de>
parents:
6421
diff
changeset
|
1951 |
|
9df1edfc0b54
class-name completion (ith namespace-prefix)
Claus Gittinger <cg@exept.de>
parents:
6421
diff
changeset
|
1952 |
(aPartialClassName startsWith:'Smalltalk::') ifTrue:[ |
9df1edfc0b54
class-name completion (ith namespace-prefix)
Claus Gittinger <cg@exept.de>
parents:
6421
diff
changeset
|
1953 |
nsPrefix := 'Smalltalk::'. |
9df1edfc0b54
class-name completion (ith namespace-prefix)
Claus Gittinger <cg@exept.de>
parents:
6421
diff
changeset
|
1954 |
searchName := aPartialClassName copyFrom:'Smalltalk::' size + 1 |
9df1edfc0b54
class-name completion (ith namespace-prefix)
Claus Gittinger <cg@exept.de>
parents:
6421
diff
changeset
|
1955 |
] ifFalse:[ |
9df1edfc0b54
class-name completion (ith namespace-prefix)
Claus Gittinger <cg@exept.de>
parents:
6421
diff
changeset
|
1956 |
nsPrefix := ''. |
9df1edfc0b54
class-name completion (ith namespace-prefix)
Claus Gittinger <cg@exept.de>
parents:
6421
diff
changeset
|
1957 |
searchName := aPartialClassName. |
2379 | 1958 |
]. |
1959 |
||
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
1960 |
(searchName at:1) isLowercase ifTrue:[ |
6403
2b81e1bc42ea
better classNameCompletion (namespaces)
Claus Gittinger <cg@exept.de>
parents:
6390
diff
changeset
|
1961 |
searchName := searchName copy asUppercaseFirst |
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
1962 |
]. |
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
1963 |
|
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
1964 |
isMatchString := searchName includesMatchCharacters. |
1451 | 1965 |
matches := OrderedCollection new. |
2523
04db1fd74e0d
try ignoring case in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
2514
diff
changeset
|
1966 |
ignCaseMatches := OrderedCollection new. |
6472
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
1967 |
anEnvironment allClassesDo:[:aClass | |
6403
2b81e1bc42ea
better classNameCompletion (namespaces)
Claus Gittinger <cg@exept.de>
parents:
6390
diff
changeset
|
1968 |
|className addIt| |
2b81e1bc42ea
better classNameCompletion (namespaces)
Claus Gittinger <cg@exept.de>
parents:
6390
diff
changeset
|
1969 |
|
2b81e1bc42ea
better classNameCompletion (namespaces)
Claus Gittinger <cg@exept.de>
parents:
6390
diff
changeset
|
1970 |
className := aClass name. |
2b81e1bc42ea
better classNameCompletion (namespaces)
Claus Gittinger <cg@exept.de>
parents:
6390
diff
changeset
|
1971 |
aClass isMeta ifFalse:[ |
1451 | 1972 |
|
6403
2b81e1bc42ea
better classNameCompletion (namespaces)
Claus Gittinger <cg@exept.de>
parents:
6390
diff
changeset
|
1973 |
isMatchString ifTrue:[ |
2b81e1bc42ea
better classNameCompletion (namespaces)
Claus Gittinger <cg@exept.de>
parents:
6390
diff
changeset
|
1974 |
addIt := searchName match:className |
2b81e1bc42ea
better classNameCompletion (namespaces)
Claus Gittinger <cg@exept.de>
parents:
6390
diff
changeset
|
1975 |
] ifFalse:[ |
2b81e1bc42ea
better classNameCompletion (namespaces)
Claus Gittinger <cg@exept.de>
parents:
6390
diff
changeset
|
1976 |
addIt := className startsWith:searchName |
2b81e1bc42ea
better classNameCompletion (namespaces)
Claus Gittinger <cg@exept.de>
parents:
6390
diff
changeset
|
1977 |
]. |
2b81e1bc42ea
better classNameCompletion (namespaces)
Claus Gittinger <cg@exept.de>
parents:
6390
diff
changeset
|
1978 |
addIt ifTrue:[ |
6438
9df1edfc0b54
class-name completion (ith namespace-prefix)
Claus Gittinger <cg@exept.de>
parents:
6421
diff
changeset
|
1979 |
matches add:(nsPrefix , aClass name) |
6403
2b81e1bc42ea
better classNameCompletion (namespaces)
Claus Gittinger <cg@exept.de>
parents:
6390
diff
changeset
|
1980 |
] ifFalse:[ |
2b81e1bc42ea
better classNameCompletion (namespaces)
Claus Gittinger <cg@exept.de>
parents:
6390
diff
changeset
|
1981 |
"/ try ignoring case |
2b81e1bc42ea
better classNameCompletion (namespaces)
Claus Gittinger <cg@exept.de>
parents:
6390
diff
changeset
|
1982 |
isMatchString ifTrue:[ |
2b81e1bc42ea
better classNameCompletion (namespaces)
Claus Gittinger <cg@exept.de>
parents:
6390
diff
changeset
|
1983 |
addIt := searchName match:className ignoreCase:true |
2b81e1bc42ea
better classNameCompletion (namespaces)
Claus Gittinger <cg@exept.de>
parents:
6390
diff
changeset
|
1984 |
] ifFalse:[ |
2b81e1bc42ea
better classNameCompletion (namespaces)
Claus Gittinger <cg@exept.de>
parents:
6390
diff
changeset
|
1985 |
addIt := className asLowercase startsWith:searchName asLowercase |
2b81e1bc42ea
better classNameCompletion (namespaces)
Claus Gittinger <cg@exept.de>
parents:
6390
diff
changeset
|
1986 |
]. |
2b81e1bc42ea
better classNameCompletion (namespaces)
Claus Gittinger <cg@exept.de>
parents:
6390
diff
changeset
|
1987 |
addIt ifTrue:[ |
6438
9df1edfc0b54
class-name completion (ith namespace-prefix)
Claus Gittinger <cg@exept.de>
parents:
6421
diff
changeset
|
1988 |
ignCaseMatches add:(nsPrefix , aClass name) |
6403
2b81e1bc42ea
better classNameCompletion (namespaces)
Claus Gittinger <cg@exept.de>
parents:
6390
diff
changeset
|
1989 |
] |
2b81e1bc42ea
better classNameCompletion (namespaces)
Claus Gittinger <cg@exept.de>
parents:
6390
diff
changeset
|
1990 |
] |
2b81e1bc42ea
better classNameCompletion (namespaces)
Claus Gittinger <cg@exept.de>
parents:
6390
diff
changeset
|
1991 |
] |
453 | 1992 |
]. |
1451 | 1993 |
|
453 | 1994 |
matches isEmpty ifTrue:[ |
6403
2b81e1bc42ea
better classNameCompletion (namespaces)
Claus Gittinger <cg@exept.de>
parents:
6390
diff
changeset
|
1995 |
matches := ignCaseMatches |
2b81e1bc42ea
better classNameCompletion (namespaces)
Claus Gittinger <cg@exept.de>
parents:
6390
diff
changeset
|
1996 |
]. |
2523
04db1fd74e0d
try ignoring case in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
2514
diff
changeset
|
1997 |
matches isEmpty ifTrue:[ |
6403
2b81e1bc42ea
better classNameCompletion (namespaces)
Claus Gittinger <cg@exept.de>
parents:
6390
diff
changeset
|
1998 |
^ Array with:searchName with:(Array with:searchName) |
453 | 1999 |
]. |
2000 |
matches size == 1 ifTrue:[ |
|
6403
2b81e1bc42ea
better classNameCompletion (namespaces)
Claus Gittinger <cg@exept.de>
parents:
6390
diff
changeset
|
2001 |
best := matches first. |
2b81e1bc42ea
better classNameCompletion (namespaces)
Claus Gittinger <cg@exept.de>
parents:
6390
diff
changeset
|
2002 |
^ Array with:best with:(matches asArray) |
453 | 2003 |
]. |
1451 | 2004 |
matches := matches asSortedCollection. |
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2005 |
isMatchString ifTrue:[ |
6403
2b81e1bc42ea
better classNameCompletion (namespaces)
Claus Gittinger <cg@exept.de>
parents:
6390
diff
changeset
|
2006 |
best := searchName. |
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2007 |
] ifFalse:[ |
6403
2b81e1bc42ea
better classNameCompletion (namespaces)
Claus Gittinger <cg@exept.de>
parents:
6390
diff
changeset
|
2008 |
best := matches longestCommonPrefix. |
2b81e1bc42ea
better classNameCompletion (namespaces)
Claus Gittinger <cg@exept.de>
parents:
6390
diff
changeset
|
2009 |
]. |
2b81e1bc42ea
better classNameCompletion (namespaces)
Claus Gittinger <cg@exept.de>
parents:
6390
diff
changeset
|
2010 |
|
6472
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2011 |
cls := anEnvironment classNamed:best. |
6403
2b81e1bc42ea
better classNameCompletion (namespaces)
Claus Gittinger <cg@exept.de>
parents:
6390
diff
changeset
|
2012 |
(cls isBehavior and:[cls isNameSpace]) ifTrue:[ |
2b81e1bc42ea
better classNameCompletion (namespaces)
Claus Gittinger <cg@exept.de>
parents:
6390
diff
changeset
|
2013 |
(matches conform:[:each | each = best |
2b81e1bc42ea
better classNameCompletion (namespaces)
Claus Gittinger <cg@exept.de>
parents:
6390
diff
changeset
|
2014 |
or:[each startsWith:(best , '::')]]) |
2b81e1bc42ea
better classNameCompletion (namespaces)
Claus Gittinger <cg@exept.de>
parents:
6390
diff
changeset
|
2015 |
ifTrue:[ |
2b81e1bc42ea
better classNameCompletion (namespaces)
Claus Gittinger <cg@exept.de>
parents:
6390
diff
changeset
|
2016 |
best := best , '::' |
2b81e1bc42ea
better classNameCompletion (namespaces)
Claus Gittinger <cg@exept.de>
parents:
6390
diff
changeset
|
2017 |
]. |
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2018 |
]. |
453 | 2019 |
^ Array with:best with:matches asArray |
2020 |
||
2021 |
" |
|
2022 |
Smalltalk classnameCompletion:'Arr' |
|
2023 |
Smalltalk classnameCompletion:'Arra' |
|
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2024 |
Smalltalk classnameCompletion:'arra' |
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2025 |
Smalltalk classnameCompletion:'*rray' |
453 | 2026 |
" |
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2027 |
|
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2028 |
"Created: 24.11.1995 / 17:24:45 / cg" |
2523
04db1fd74e0d
try ignoring case in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
2514
diff
changeset
|
2029 |
"Modified: 3.4.1997 / 18:25:01 / cg" |
453 | 2030 |
! |
2031 |
||
2004
b660837fe0c7
renamed #currentNameSpace to #defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2032 |
defaultNameSpace |
b660837fe0c7
renamed #currentNameSpace to #defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2033 |
"return the default namespace, where new classes are installed, |
b660837fe0c7
renamed #currentNameSpace to #defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2034 |
if NO special nameSpace handler is present" |
b660837fe0c7
renamed #currentNameSpace to #defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2035 |
|
2029
55ddf4c547ab
ask the current project for the defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
2004
diff
changeset
|
2036 |
|p| |
55ddf4c547ab
ask the current project for the defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
2004
diff
changeset
|
2037 |
|
55ddf4c547ab
ask the current project for the defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
2004
diff
changeset
|
2038 |
(Project notNil and:[(p := Project current) notNil]) ifTrue:[ |
5363 | 2039 |
^ p defaultNameSpace |
2029
55ddf4c547ab
ask the current project for the defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
2004
diff
changeset
|
2040 |
]. |
55ddf4c547ab
ask the current project for the defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
2004
diff
changeset
|
2041 |
|
2004
b660837fe0c7
renamed #currentNameSpace to #defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2042 |
^ self |
b660837fe0c7
renamed #currentNameSpace to #defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2043 |
|
b660837fe0c7
renamed #currentNameSpace to #defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2044 |
"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
|
2045 |
"Modified: 2.1.1997 / 20:01:31 / cg" |
2004
b660837fe0c7
renamed #currentNameSpace to #defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2046 |
! |
b660837fe0c7
renamed #currentNameSpace to #defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2047 |
|
5736 | 2048 |
globalnameCompletion:aPartialGlobalName |
2049 |
"given a partial globalName, return an array consisting of |
|
2050 |
2 entries: 1st: collection consisting of matching names |
|
2051 |
2nd: the best (longest) match" |
|
2052 |
||
2053 |
|searchName matches ignCaseMatches best isMatchString| |
|
2054 |
||
2055 |
searchName := aPartialGlobalName. |
|
2056 |
searchName isEmpty ifTrue:[ |
|
2057 |
^ Array with:searchName with:#() |
|
2058 |
]. |
|
2059 |
||
2060 |
(searchName at:1) isLowercase ifTrue:[ |
|
2061 |
searchName := searchName copy asUppercaseFirst |
|
2062 |
]. |
|
2063 |
||
2064 |
isMatchString := searchName includesMatchCharacters. |
|
2065 |
matches := OrderedCollection new. |
|
2066 |
ignCaseMatches := OrderedCollection new. |
|
2067 |
self keysDo:[:aGlobalName | |
|
2068 |
| addIt| |
|
2069 |
||
2070 |
isMatchString ifTrue:[ |
|
2071 |
addIt := searchName match:aGlobalName |
|
2072 |
] ifFalse:[ |
|
2073 |
addIt := aGlobalName startsWith:searchName |
|
2074 |
]. |
|
2075 |
addIt ifTrue:[ |
|
2076 |
matches add:aGlobalName |
|
2077 |
] ifFalse:[ |
|
2078 |
"/ try ignoring case |
|
2079 |
isMatchString ifTrue:[ |
|
2080 |
addIt := searchName match:aGlobalName ignoreCase:true |
|
2081 |
] ifFalse:[ |
|
2082 |
addIt := aGlobalName asLowercase startsWith:searchName asLowercase |
|
2083 |
]. |
|
2084 |
addIt ifTrue:[ |
|
2085 |
ignCaseMatches add:aGlobalName |
|
2086 |
] |
|
2087 |
] |
|
2088 |
]. |
|
2089 |
||
2090 |
matches isEmpty ifTrue:[ |
|
2091 |
matches := ignCaseMatches |
|
2092 |
]. |
|
2093 |
||
2094 |
matches isEmpty ifTrue:[ |
|
2095 |
^ Array with:searchName with:(Array with:searchName) |
|
2096 |
]. |
|
2097 |
matches size == 1 ifTrue:[ |
|
2098 |
^ Array with:matches first with:(matches asArray) |
|
2099 |
]. |
|
2100 |
matches := matches asSortedCollection. |
|
2101 |
isMatchString ifTrue:[ |
|
2102 |
best := searchName. |
|
2103 |
] ifFalse:[ |
|
2104 |
best := matches longestCommonPrefix. |
|
2105 |
]. |
|
2106 |
^ Array with:best with:matches asArray |
|
2107 |
||
2108 |
" |
|
2109 |
Smalltalk globalnameCompletion:'Arr' |
|
2110 |
Smalltalk globalnameCompletion:'Arra' |
|
2111 |
Smalltalk globalnameCompletion:'arra' |
|
2112 |
Smalltalk globalnameCompletion:'*rray' |
|
2113 |
" |
|
2114 |
||
2115 |
"Created: 24.11.1995 / 17:24:45 / cg" |
|
2116 |
"Modified: 3.4.1997 / 18:25:01 / cg" |
|
2117 |
! |
|
2118 |
||
6472
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2119 |
hasNamespaces |
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2120 |
"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
|
2121 |
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
|
2122 |
|
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2123 |
^ true |
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2124 |
! |
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2125 |
|
617 | 2126 |
includes:something |
2127 |
"this should come from Collection. |
|
2128 |
will change the inheritance - Smalltalk is actually a collection" |
|
2129 |
||
2130 |
self do:[:element | element = something ifTrue:[^ true]]. |
|
2131 |
^ false |
|
2132 |
! |
|
2133 |
||
5327
5e5602d156fa
#isNamespace renamed to #isNameSpace
Claus Gittinger <cg@exept.de>
parents:
5326
diff
changeset
|
2134 |
isNameSpace |
1706 | 2135 |
^ true |
2136 |
||
2137 |
"Created: 11.10.1996 / 18:10:43 / cg" |
|
2138 |
! |
|
2139 |
||
5371
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
2140 |
isTopLevelNameSpace |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
2141 |
^ true |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
2142 |
! |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
2143 |
|
4458 | 2144 |
isTopLevelNamespace |
5365 | 2145 |
"obsolete - use isTopLevelNameSpace" |
2146 |
||
4458 | 2147 |
^ true |
2148 |
||
2149 |
"Created: 11.10.1996 / 18:10:43 / cg" |
|
2150 |
! |
|
2151 |
||
5505
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2152 |
methodProtocolCompletion:aPartialProtocolName |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2153 |
"given a partial method protocol name, return an array consisting of |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2154 |
2 entries: 1st: collection consisting of matching protocols |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2155 |
2nd: the longest match" |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2156 |
|
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2157 |
|matches best lcName| |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2158 |
|
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2159 |
matches := IdentitySet new. |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2160 |
|
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2161 |
"/ search for exact match |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2162 |
self allClassesDo:[:aClass | |
6080
15ea3cbf6003
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
6074
diff
changeset
|
2163 |
aClass instAndClassSelectorsAndMethodsDo:[:aSelector :aMethod | |
5505
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2164 |
|protocol| |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2165 |
|
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2166 |
protocol := aMethod category. |
5760 | 2167 |
(protocol notNil and:[protocol startsWith:aPartialProtocolName]) ifTrue:[ |
5505
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2168 |
matches add:protocol |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2169 |
] |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2170 |
]. |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2171 |
]. |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2172 |
matches isEmpty ifTrue:[ |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2173 |
"/ search for case-ignoring match |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2174 |
lcName := aPartialProtocolName asLowercase. |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2175 |
self allClassesDo:[:aClass | |
6080
15ea3cbf6003
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
6074
diff
changeset
|
2176 |
aClass instAndClassSelectorsAndMethodsDo:[:aSelector :aMethod | |
5505
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2177 |
|protocol| |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2178 |
|
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2179 |
protocol := aMethod category. |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2180 |
(protocol asLowercase startsWith:lcName) ifTrue:[ |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2181 |
matches add:protocol |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2182 |
] |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2183 |
]. |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2184 |
]. |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2185 |
]. |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2186 |
|
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2187 |
matches isEmpty ifTrue:[ |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2188 |
^ Array with:aPartialProtocolName with:(Array with:aPartialProtocolName) |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2189 |
]. |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2190 |
matches size == 1 ifTrue:[ |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2191 |
^ Array with:matches first with:(matches asArray) |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2192 |
]. |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2193 |
matches := matches asSortedCollection. |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2194 |
best := matches longestCommonPrefix. |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2195 |
^ Array with:best with:matches asArray |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2196 |
|
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2197 |
" |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2198 |
Smalltalk methodProtocolCompletion:'doc' |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2199 |
Smalltalk methodProtocolCompletion:'docu' |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2200 |
Smalltalk methodProtocolCompletion:'documenta' |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2201 |
" |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2202 |
! |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2203 |
|
617 | 2204 |
numberOfGlobals |
2205 |
"return the number of global variables in the system" |
|
2206 |
||
2207 |
|tally "{ Class: SmallInteger }" | |
|
2208 |
||
2209 |
tally := 0. |
|
2210 |
self do:[:obj | tally := tally + 1]. |
|
2211 |
^ tally |
|
2212 |
||
2213 |
"Smalltalk numberOfGlobals" |
|
2214 |
! |
|
2215 |
||
3260 | 2216 |
referencesAny:aCollection |
2217 |
"redefined, since the references are only kept in the VM's symbol table" |
|
2218 |
||
2219 |
self keysAndValuesDo:[:key :val | |
|
5363 | 2220 |
aCollection do:[:anObject | |
2221 |
(key == anObject) ifTrue:[^ true]. |
|
2222 |
(val == anObject ) ifTrue:[^ true]. |
|
2223 |
] |
|
3260 | 2224 |
]. |
2225 |
^ super referencesAny:aCollection |
|
2226 |
||
2227 |
"Created: / 2.2.1998 / 16:01:20 / cg" |
|
2228 |
! |
|
2229 |
||
617 | 2230 |
referencesDerivedInstanceOf:aClass |
2231 |
"redefined, since the references are only kept in the VM's symbol table" |
|
2232 |
||
2233 |
self keysAndValuesDo:[:key :val | |
|
5363 | 2234 |
(key isKindOf:aClass) ifTrue:[^ true]. |
2235 |
(val isKindOf:aClass) ifTrue:[^ true]. |
|
617 | 2236 |
]. |
2237 |
^ super referencesDerivedInstanceOf:aClass |
|
2238 |
! |
|
2239 |
||
2240 |
referencesInstanceOf:aClass |
|
2241 |
"redefined, since the references are only kept in the VM's symbol table" |
|
2242 |
||
2243 |
self keysAndValuesDo:[:key :val | |
|
5363 | 2244 |
(key isMemberOf:aClass) ifTrue:[^ true]. |
2245 |
(val isMemberOf:aClass) ifTrue:[^ true]. |
|
617 | 2246 |
]. |
2247 |
^ super referencesInstanceOf:aClass |
|
2248 |
! |
|
2249 |
||
6074
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
2250 |
referencesObject:anObject |
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
2251 |
"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
|
2252 |
|
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
2253 |
self keysAndValuesDo:[:key :val | |
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
2254 |
(key == anObject) ifTrue:[^ true]. |
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
2255 |
(val == anObject ) ifTrue:[^ true]. |
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
2256 |
]. |
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
2257 |
^ super referencesObject:anObject |
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
2258 |
|
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
2259 |
"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
|
2260 |
! |
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
2261 |
|
4354
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
2262 |
resolveName:nameIn inClass:aClass |
3026 | 2263 |
"resolve aName as if compiled within aClass; |
2264 |
i.e. if it has a private class with this name, return it; |
|
2265 |
if aName is known within the classes namespace, return that. |
|
2266 |
Otherwise, return a global with that name. |
|
2267 |
This should be used whereever Smalltalk>>at: used to be used, |
|
2268 |
to resolve a global by name." |
|
2269 |
||
4354
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
2270 |
|aName sym cls ns| |
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
2271 |
|
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
2272 |
nameIn isNil ifTrue:[^ nil]. |
4356 | 2273 |
nameIn isBehavior ifTrue:[^ nameIn]. "/ already resolved |
4354
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
2274 |
aName := nameIn. |
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
2275 |
|
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
2276 |
(aName startsWith:'Smalltalk::') ifTrue:[ |
5363 | 2277 |
aName := aName copyFrom:12. |
2278 |
^ self at:(aName asSymbol) ifAbsent:nil. |
|
4354
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
2279 |
]. |
3026 | 2280 |
|
2281 |
sym := aName asSymbol. |
|
2282 |
||
2283 |
cls := aClass privateClassesAt:sym. |
|
2284 |
cls notNil ifTrue:[^ cls]. |
|
2285 |
||
2286 |
ns := aClass nameSpace. |
|
2287 |
(ns notNil and:[ns ~~ Smalltalk]) ifTrue:[ |
|
5363 | 2288 |
ns isNameSpace ifTrue:[ |
2289 |
cls := ns at:sym ifAbsent:nil. |
|
2290 |
] ifFalse:[ |
|
2291 |
cls := ns privateClassesAt:sym |
|
2292 |
]. |
|
2293 |
cls notNil ifTrue:[^ cls]. |
|
3025 | 2294 |
]. |
3026 | 2295 |
^ self at:sym ifAbsent:nil. |
4356 | 2296 |
|
2297 |
"Modified: / 9.7.1999 / 01:18:07 / cg" |
|
3025 | 2298 |
! |
2299 |
||
453 | 2300 |
selectorCompletion:aPartialSymbolName |
2301 |
"given a partial selector, return an array consisting of |
|
2302 |
2 entries: 1st: collection consisting of matching implemented selectors |
|
5371
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
2303 |
2nd: the longest match" |
3565
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
2304 |
|
6472
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2305 |
^ self |
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2306 |
selectorCompletion:aPartialSymbolName inEnvironment:self |
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2307 |
! |
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2308 |
|
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2309 |
selectorCompletion:aPartialSymbolName inEnvironment:anEnvironment |
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2310 |
"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
|
2311 |
2 entries: 1st: collection consisting of matching implemented selectors |
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2312 |
2nd: the longest match" |
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2313 |
|
3565
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
2314 |
|matches best lcSym| |
453 | 2315 |
|
2316 |
matches := IdentitySet new. |
|
3565
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
2317 |
|
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
2318 |
"/ 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
|
2319 |
anEnvironment allClassesDo:[:aClass | |
6080
15ea3cbf6003
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
6074
diff
changeset
|
2320 |
aClass instAndClassSelectorsAndMethodsDo:[:aSelector :aMethod | |
5371
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
2321 |
(aSelector startsWith:aPartialSymbolName) ifTrue:[ |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
2322 |
matches add:aSelector |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
2323 |
] |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
2324 |
]. |
3565
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
2325 |
]. |
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
2326 |
matches isEmpty ifTrue:[ |
5371
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
2327 |
"/ search for case-ignoring match |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
2328 |
lcSym := aPartialSymbolName asLowercase. |
6472
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2329 |
anEnvironment allClassesDo:[:aClass | |
6080
15ea3cbf6003
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
6074
diff
changeset
|
2330 |
aClass instAndClassSelectorsAndMethodsDo:[:aSelector :aMethod | |
5371
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
2331 |
(aSelector asLowercase startsWith:lcSym) ifTrue:[ |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
2332 |
matches add:aSelector |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
2333 |
] |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
2334 |
]. |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
2335 |
]. |
3565
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
2336 |
]. |
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
2337 |
|
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
2338 |
matches isEmpty ifTrue:[ |
5371
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
2339 |
^ Array with:aPartialSymbolName with:(Array with:aPartialSymbolName) |
3565
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
2340 |
]. |
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
2341 |
matches size == 1 ifTrue:[ |
5371
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
2342 |
^ Array with:matches first with:(matches asArray) |
453 | 2343 |
]. |
2344 |
matches := matches asSortedCollection. |
|
2345 |
best := matches longestCommonPrefix. |
|
2346 |
^ Array with:best with:matches asArray |
|
2347 |
||
2348 |
" |
|
2349 |
Smalltalk selectorCompletion:'at:p' |
|
2350 |
Smalltalk selectorCompletion:'nextP' |
|
3565
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
2351 |
Smalltalk selectorCompletion:'nextp' |
453 | 2352 |
" |
1461
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1455
diff
changeset
|
2353 |
|
3565
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
2354 |
"Modified: / 7.6.1996 / 08:44:33 / stefan" |
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
2355 |
"Modified: / 14.6.1998 / 15:54:03 / cg" |
453 | 2356 |
! ! |
2357 |
||
4431 | 2358 |
!Smalltalk class methodsFor:'queries-system'! |
2359 |
||
4970 | 2360 |
isDolphinSmalltalk |
2361 |
"return false here - this may be useful to write portable |
|
2362 |
applications - add #isDolphinSmalltalk to your dolphin, |
|
2363 |
returning true there." |
|
2364 |
||
2365 |
^ false |
|
2366 |
! |
|
2367 |
||
2368 |
isSmalltalkMT |
|
2369 |
"return false here - this may be useful to write portable |
|
2370 |
applications - add #isSmalltalkMT to your smalltalk-MT, |
|
2371 |
returning true there." |
|
2372 |
||
2373 |
^ false |
|
2374 |
! |
|
2375 |
||
4431 | 2376 |
isSmalltalkV |
2377 |
"return false here - this may be useful to write portable |
|
2378 |
applications - add #isSmalltalkV to your smalltalkV, |
|
2379 |
returning true there." |
|
2380 |
||
2381 |
^ false |
|
2382 |
! |
|
2383 |
||
2384 |
isSmalltalkX |
|
2385 |
"return true here - this may be useful to write portable |
|
2386 |
applications - add #isSmalltalkX to your other smalltalks, |
|
2387 |
returning false there." |
|
2388 |
||
2389 |
^ true |
|
2390 |
! |
|
2391 |
||
2392 |
isSqueak |
|
2393 |
"return false here - this may be useful to write portable |
|
2394 |
applications - add #isSqueak to your squeak, |
|
2395 |
returning true there." |
|
2396 |
||
2397 |
^ false |
|
2398 |
! |
|
2399 |
||
2400 |
isVisualAge |
|
2401 |
"return false here - this may be useful to write portable |
|
2402 |
applications - add #isVisualAge to your visualAge, |
|
2403 |
returning true there." |
|
2404 |
||
2405 |
^ false |
|
2406 |
! |
|
2407 |
||
2408 |
isVisualWorks |
|
2409 |
"return false here - this may be useful to write portable |
|
2410 |
applications - add #isVisualWorks to your visualWorks, |
|
2411 |
returning true there." |
|
2412 |
||
2413 |
^ false |
|
2414 |
! ! |
|
2415 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
2416 |
!Smalltalk class methodsFor:'startup'! |
1 | 2417 |
|
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2418 |
displayInitializationDone |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2419 |
"inform the restart, that the display has been initialized" |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2420 |
|
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2421 |
CallbackSignal raiseRequest. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2422 |
! |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2423 |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2424 |
mainStartup:graphicalMode |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2425 |
"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
|
2426 |
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
|
2427 |
|
2249
cdb6c87f0707
send returnFromSnapshot notification later -
Claus Gittinger <cg@exept.de>
parents:
2212
diff
changeset
|
2428 |
|mainProcess standAloneProcess imageName thisIsARestart| |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2429 |
|
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2430 |
imageName := ObjectMemory imageName. |
2249
cdb6c87f0707
send returnFromSnapshot notification later -
Claus Gittinger <cg@exept.de>
parents:
2212
diff
changeset
|
2431 |
thisIsARestart := imageName notNil. |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2432 |
|
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2433 |
" |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2434 |
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
|
2435 |
" |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2436 |
Display notNil ifTrue:[ |
5410 | 2437 |
Display deviceIOTimeoutErrorSignal handlerBlock:[:ex | |
2438 |
SaveEmergencyImage == true ifTrue:[ |
|
2439 |
'Display [warning]: broken display connection - emergency save in ''crash.img''.' infoPrintCR. |
|
2440 |
ObjectMemory primSnapShotOn:'crash.img'. |
|
2441 |
]. |
|
2442 |
'Display [warning]: broken display connection - exit.' infoPrintCR. |
|
2443 |
Smalltalk exit. |
|
2444 |
]. |
|
3483 | 2445 |
"/ Display deviceIOErrorSignal handlerBlock:[:ex | |
2446 |
"/ 'Display [warning]: I/O error on display connection - exit.' infoPrintCR. |
|
2447 |
"/ ]. |
|
5410 | 2448 |
Display startDispatch. |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2449 |
]. |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2450 |
|
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2451 |
Initializing := false. |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2452 |
|
2074
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
2453 |
"/ 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
|
2454 |
"/ 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
|
2455 |
"/ 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
|
2456 |
"/ 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
|
2457 |
|
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
2458 |
mainProcess := [ |
5410 | 2459 |
StartBlocks notNil ifTrue:[ |
2460 |
StartBlocks do:[:aBlock| |
|
2461 |
aBlock value |
|
2462 |
]. |
|
2463 |
StartBlocks := nil. |
|
2464 |
]. |
|
2465 |
ImageStartBlocks notNil ifTrue:[ |
|
2466 |
ImageStartBlocks do:[:aBlock| |
|
2467 |
aBlock value |
|
2468 |
]. |
|
2469 |
]. |
|
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2470 |
StandAlone ifFalse:[ |
5410 | 2471 |
(SilentLoading == true) ifFalse:[ "i.e. undefined counts as false" |
2472 |
thisIsARestart ifTrue:[ |
|
2473 |
Transcript cr. |
|
2474 |
Transcript showCR:('Smalltalk restarted from:' |
|
2475 |
, imageName |
|
2476 |
, ' (saved ' |
|
2477 |
, ObjectMemory imageSaveTime printString |
|
2478 |
, ')' ). |
|
2479 |
] ifFalse:[ |
|
2480 |
Transcript showCR:(self hello). |
|
2481 |
Transcript showCR:(self copyrightString). |
|
2482 |
Transcript cr. |
|
2483 |
]. |
|
2484 |
Transcript cr. |
|
2485 |
]. |
|
2486 |
||
5455 | 2487 |
DemoMode==true ifTrue:[ |
5410 | 2488 |
Transcript showCR:'*** Restricted use: ***'. |
2489 |
Transcript showCR:'*** This program may be used for education only. ***'. |
|
2490 |
Transcript showCR:'*** Please read the files COPYRIGHT and LICENSE ***'. |
|
2491 |
Transcript showCR:'*** for more details. ***'. |
|
2492 |
Transcript cr. |
|
2493 |
]. |
|
2494 |
]. |
|
2495 |
||
2496 |
thisIsARestart ifTrue:[ |
|
2497 |
"/ |
|
2498 |
"/ the final late notification - users can now assume that |
|
2499 |
"/ views, forms etc. have been recreated. |
|
2500 |
||
2501 |
ObjectMemory changed:#returnFromSnapshot. |
|
2502 |
] |
|
2249
cdb6c87f0707
send returnFromSnapshot notification later -
Claus Gittinger <cg@exept.de>
parents:
2212
diff
changeset
|
2503 |
|
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
2504 |
] newProcess. |
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
2505 |
mainProcess priority:8. |
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
2506 |
mainProcess name:'start block handler'. |
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
2507 |
mainProcess beGroupLeader. |
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
2508 |
mainProcess resume. |
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
2509 |
|
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
2510 |
|
2074
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
2511 |
"/ 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
|
2512 |
"/ message. |
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
2513 |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2514 |
(StartupClass notNil and:[StartupSelector notNil]) ifTrue:[ |
5410 | 2515 |
" |
2516 |
allow more customization by reading an image specific rc-file |
|
2517 |
" |
|
2518 |
thisIsARestart ifTrue:[ |
|
2519 |
(imageName asFilename hasSuffix:'img') ifTrue:[ |
|
2520 |
imageName := imageName copyWithoutLast:4 |
|
2521 |
]. |
|
2522 |
self fileIn:(imageName , '.rc') |
|
2523 |
]. |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2524 |
|
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2525 |
"/ Display notNil ifTrue:[ |
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2526 |
"/ Display exitOnLastClose:true. |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2527 |
"/ ]. |
2086 | 2528 |
"/ Processor exitWhenNoMoreUserProcesses:true. |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2529 |
|
5410 | 2530 |
standAloneProcess := [ |
2531 |
StartupClass perform:StartupSelector withArguments:StartupArguments. |
|
2532 |
"/ |
|
2533 |
"/ non-GUI apps exit after the startup; |
|
2534 |
"/ assume that GUI apps have created & opened some view ... |
|
2535 |
"/ |
|
2536 |
Display isNil ifTrue:[ |
|
2537 |
Smalltalk exit. |
|
2538 |
]. |
|
2539 |
"/ |
|
2540 |
"/ GUI apps exit after the last user process has finished |
|
2541 |
"/ |
|
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2542 |
Display exitOnLastClose:true. |
5410 | 2543 |
Processor exitWhenNoMoreUserProcesses:true. |
2544 |
] newProcess. |
|
2545 |
standAloneProcess priority:8. |
|
2546 |
standAloneProcess name:'main'. |
|
2547 |
standAloneProcess beGroupLeader. |
|
2548 |
standAloneProcess resume. |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2549 |
]. |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2550 |
|
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2551 |
" |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2552 |
if view-classes exist, start dispatching; |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2553 |
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
|
2554 |
" |
4957 | 2555 |
((Display notNil and:[graphicalMode]) |
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2556 |
or:[standAloneProcess notNil |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2557 |
or:[HeadlessOperation]]) ifTrue:[ |
5410 | 2558 |
Processor dispatchLoop. |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2559 |
] ifFalse:[ |
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2560 |
StandAlone ifFalse:[ |
5410 | 2561 |
self readEvalPrint |
2562 |
] |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2563 |
]. |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2564 |
|
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2565 |
"done - the last process finished" |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2566 |
|
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2567 |
self exit |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2568 |
|
3062
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
2569 |
"Created: / 18.7.1996 / 21:07:39 / cg" |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
2570 |
"Modified: / 9.9.1996 / 17:42:50 / stefan" |
3483 | 2571 |
"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
|
2572 |
! |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2573 |
|
453 | 2574 |
readEvalPrint |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
2575 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
2576 |
|
453 | 2577 |
"simple read-eval-print loop for non-graphical Minitalk" |
2578 |
||
2579 |
|text| |
|
2580 |
||
2581 |
'ST- ' print. |
|
2582 |
Stdin skipSeparators. |
|
2583 |
Stdin atEnd ifFalse:[ |
|
5419 | 2584 |
text := Stdin nextChunk. |
2585 |
[text notNil] whileTrue:[ |
|
2586 |
AbortSignal handle:[:ex | |
|
2587 |
'evaluation aborted' printCR |
|
2588 |
] do:[ |
|
2589 |
Compiler isNil ifTrue:[ |
|
2590 |
'No evaluator class available (Compiler == nil)' printCR. |
|
2591 |
^ self |
|
2592 |
]. |
|
2593 |
(Compiler evaluate:text) printCR. |
|
2594 |
]. |
|
2595 |
'ST- ' print. |
|
2596 |
text := Stdin nextChunk |
|
2597 |
]. |
|
453 | 2598 |
]. |
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
2599 |
'' printCR |
453 | 2600 |
! |
2601 |
||
1 | 2602 |
restart |
24 | 2603 |
"startup after an image has been loaded; |
10 | 2604 |
there are three change-notifications made to dependents of ObjectMemory, |
2605 |
which allow a stepwise re-init: #earlyRestart, #restarted and #returnFromSnapshot. |
|
335 | 2606 |
|
3096
881660d6e997
added #earlySystemInitialization change message (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3092
diff
changeset
|
2607 |
#earlySystemInstallation is sent for ST80 compatibility |
881660d6e997
added #earlySystemInitialization change message (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3092
diff
changeset
|
2608 |
|
10 | 2609 |
#earlyRestart is send first, nothing has been setup yet. |
6390
41d5c47c33f0
Catch sigPWR and sigHUP on restart
Stefan Vogel <sv@exept.de>
parents:
6366
diff
changeset
|
2610 |
(should be used to flush all device dependent entries) |
335 | 2611 |
|
10 | 2612 |
#restarted is send right after. |
6390
41d5c47c33f0
Catch sigPWR and sigHUP on restart
Stefan Vogel <sv@exept.de>
parents:
6366
diff
changeset
|
2613 |
(should be used to recreate external resources (fds, bitmaps etc) |
335 | 2614 |
|
10 | 2615 |
#returnFromSnapshot is sent last |
6390
41d5c47c33f0
Catch sigPWR and sigHUP on restart
Stefan Vogel <sv@exept.de>
parents:
6366
diff
changeset
|
2616 |
(should be used to restart processes, reOpen Streams which cannot |
41d5c47c33f0
Catch sigPWR and sigHUP on restart
Stefan Vogel <sv@exept.de>
parents:
6366
diff
changeset
|
2617 |
be automatically be reopened (i.e. Sockets, Pipes) and so on. |
41d5c47c33f0
Catch sigPWR and sigHUP on restart
Stefan Vogel <sv@exept.de>
parents:
6366
diff
changeset
|
2618 |
(Notice that positionable fileStreams are already reopened and repositioned) |
1 | 2619 |
" |
10 | 2620 |
|
4503
99718971ba26
Redirect Transcript to Stderr during restart-initialization.
Stefan Vogel <sv@exept.de>
parents:
4490
diff
changeset
|
2621 |
|deb insp transcript idx| |
1 | 2622 |
|
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2623 |
"/ |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2624 |
"/ when we arrive here, all objects from our previous life |
3971 | 2625 |
"/ 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
|
2626 |
"/ handles, display information etc. |
3971 | 2627 |
"/ also, dynamically loaded modules have not yet been reloaded yet. |
2628 |
"/ and the concrete OS, concrete FileName etc. are still refering to |
|
2629 |
"/ 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
|
2630 |
|
1 | 2631 |
Initializing := true. |
3499 | 2632 |
AbstractOperatingSystem initializeConcreteClass. |
2633 |
||
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2634 |
ImageRestartTime := AbsoluteTime now. |
335 | 2635 |
|
1580
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2636 |
CommandLine := CommandLineArguments copy. |
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2637 |
CommandLineArguments := CommandLineArguments asOrderedCollection. |
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2638 |
CommandLineArguments removeAtIndex:1. "/ the command |
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2639 |
|
1582 | 2640 |
idx := CommandLineArguments indexOf:'-q'. |
2641 |
idx ~~ 0 ifTrue:[ |
|
6390
41d5c47c33f0
Catch sigPWR and sigHUP on restart
Stefan Vogel <sv@exept.de>
parents:
6366
diff
changeset
|
2642 |
Object infoPrinting:false. |
41d5c47c33f0
Catch sigPWR and sigHUP on restart
Stefan Vogel <sv@exept.de>
parents:
6366
diff
changeset
|
2643 |
ObjectMemory infoPrinting:false. |
41d5c47c33f0
Catch sigPWR and sigHUP on restart
Stefan Vogel <sv@exept.de>
parents:
6366
diff
changeset
|
2644 |
CommandLineArguments removeAtIndex:idx. |
1582 | 2645 |
]. |
2646 |
||
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2647 |
"/ |
3971 | 2648 |
"/ start catching SIGSEGV and SIGBUS |
2649 |
||
2650 |
OperatingSystem enableHardSignalInterrupts. |
|
2651 |
||
2907 | 2652 |
"/ reinit Filename |
2653 |
Filename reinitialize. |
|
2654 |
||
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2655 |
"/ |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2656 |
"/ 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
|
2657 |
|
329 | 2658 |
self flushPathCaches. |
1 | 2659 |
|
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2660 |
"/ |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2661 |
"/ 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
|
2662 |
"/ 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
|
2663 |
|
477
8710aba7876b
oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents:
457
diff
changeset
|
2664 |
self reinitStandardStreams. |
8710aba7876b
oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents:
457
diff
changeset
|
2665 |
|
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2666 |
"/ |
4503
99718971ba26
Redirect Transcript to Stderr during restart-initialization.
Stefan Vogel <sv@exept.de>
parents:
4490
diff
changeset
|
2667 |
"/ redirect Transcript to Stderr during startup |
99718971ba26
Redirect Transcript to Stderr during restart-initialization.
Stefan Vogel <sv@exept.de>
parents:
4490
diff
changeset
|
2668 |
|
99718971ba26
Redirect Transcript to Stderr during restart-initialization.
Stefan Vogel <sv@exept.de>
parents:
4490
diff
changeset
|
2669 |
transcript := Transcript. |
99718971ba26
Redirect Transcript to Stderr during restart-initialization.
Stefan Vogel <sv@exept.de>
parents:
4490
diff
changeset
|
2670 |
Transcript := Stderr. |
99718971ba26
Redirect Transcript to Stderr during restart-initialization.
Stefan Vogel <sv@exept.de>
parents:
4490
diff
changeset
|
2671 |
|
99718971ba26
Redirect Transcript to Stderr during restart-initialization.
Stefan Vogel <sv@exept.de>
parents:
4490
diff
changeset
|
2672 |
"/ |
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2673 |
"/ temporary switch back to dumb interface - |
4503
99718971ba26
Redirect Transcript to Stderr during restart-initialization.
Stefan Vogel <sv@exept.de>
parents:
4490
diff
changeset
|
2674 |
"/ to handle errors while view-stuff is not yet reinitialized |
1 | 2675 |
|
2676 |
insp := Inspector. |
|
2677 |
deb := Debugger. |
|
684
3e0b5a8ec381
invalidate display connection during early startup
Claus Gittinger <cg@exept.de>
parents:
680
diff
changeset
|
2678 |
deb notNil ifTrue:[ |
6390
41d5c47c33f0
Catch sigPWR and sigHUP on restart
Stefan Vogel <sv@exept.de>
parents:
6366
diff
changeset
|
2679 |
deb reinitialize |
684
3e0b5a8ec381
invalidate display connection during early startup
Claus Gittinger <cg@exept.de>
parents:
680
diff
changeset
|
2680 |
]. |
1 | 2681 |
Inspector := MiniInspector. |
2682 |
Debugger := MiniDebugger. |
|
2683 |
||
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2684 |
"/ 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
|
2685 |
"/ 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
|
2686 |
"/ 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
|
2687 |
"/ this code. |
3155
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
2688 |
"/ 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
|
2689 |
"/ ObjectFileLoader; therefore, must reload before doing any notifications. |
335 | 2690 |
|
1100
eebf3ed54b23
reloadAllObjectFiles now called explicit (its too late via ObjMem changed)
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
2691 |
ObjectFileLoader notNil ifTrue:[ |
6390
41d5c47c33f0
Catch sigPWR and sigHUP on restart
Stefan Vogel <sv@exept.de>
parents:
6366
diff
changeset
|
2692 |
ObjectFileLoader reloadAllRememberedObjectFiles. |
1100
eebf3ed54b23
reloadAllObjectFiles now called explicit (its too late via ObjMem changed)
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
2693 |
]. |
eebf3ed54b23
reloadAllObjectFiles now called explicit (its too late via ObjMem changed)
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
2694 |
|
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2695 |
"/ |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2696 |
"/ invalidate all display connections. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2697 |
"/ This is required to avoid trouble if someone accesses |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2698 |
"/ a display during early startup. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2699 |
|
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2700 |
Screen notNil ifTrue:[ |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2701 |
Screen allScreens do:[:aDisplay | |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2702 |
aDisplay invalidateConnection |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2703 |
]. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2704 |
]. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2705 |
|
3155
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
2706 |
ObjectMemory changed:#earlySystemInstallation. |
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
2707 |
|
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2708 |
"/ |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2709 |
"/ reinitialize the Processor - restartable processes |
4109 | 2710 |
"/ 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
|
2711 |
"/ |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2712 |
Processor reinitialize. |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2713 |
|
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2714 |
"/ |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2715 |
"/ 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
|
2716 |
"/ (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
|
2717 |
|
3022 | 2718 |
ObjectMemory |
6390
41d5c47c33f0
Catch sigPWR and sigHUP on restart
Stefan Vogel <sv@exept.de>
parents:
6366
diff
changeset
|
2719 |
changed:#earlyRestart; changed:#restarted. |
1 | 2720 |
|
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2721 |
"/ |
3526
78245608c0b8
no need for last change (restarting processes).
Claus Gittinger <cg@exept.de>
parents:
3523
diff
changeset
|
2722 |
"/ start catching SIGINT and SIGQUIT |
78245608c0b8
no need for last change (restarting processes).
Claus Gittinger <cg@exept.de>
parents:
3523
diff
changeset
|
2723 |
|
78245608c0b8
no need for last change (restarting processes).
Claus Gittinger <cg@exept.de>
parents:
3523
diff
changeset
|
2724 |
OperatingSystem enableUserInterrupts. |
6390
41d5c47c33f0
Catch sigPWR and sigHUP on restart
Stefan Vogel <sv@exept.de>
parents:
6366
diff
changeset
|
2725 |
OperatingSystem enableCrashSignalInterrupts. |
3526
78245608c0b8
no need for last change (restarting processes).
Claus Gittinger <cg@exept.de>
parents:
3523
diff
changeset
|
2726 |
|
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2727 |
"/ 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
|
2728 |
"/ 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
|
2729 |
"/ -fastStart argument. |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2730 |
|
1580
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2731 |
idx := CommandLineArguments indexOf:'-faststart'. |
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2732 |
idx ~~ 0 ifTrue:[ |
6390
41d5c47c33f0
Catch sigPWR and sigHUP on restart
Stefan Vogel <sv@exept.de>
parents:
6366
diff
changeset
|
2733 |
CommandLineArguments removeAtIndex:idx. |
1580
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2734 |
] ifFalse:[ |
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2735 |
CallbackSignal := QuerySignal new. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2736 |
[ |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2737 |
Class withoutUpdatingChangesDo:[ |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2738 |
(self fileIn:(self commandName , '_r.rc')) ifFalse:[ |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2739 |
"no _r.rc file where executable is; try default smalltalk_r.rc" |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2740 |
self fileIn:'smalltalk_r.rc' |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2741 |
]. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2742 |
] |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2743 |
] on:CallbackSignal do:[:ex| |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2744 |
"/ now, display and view-stuff works; |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2745 |
"/ back to the previous debugging interface |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2746 |
|
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2747 |
Inspector := insp. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2748 |
Debugger := deb. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2749 |
|
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2750 |
"/ reinstall Transcript, if not changed during restart. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2751 |
"/ if there was no Transcript, go to stderr |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2752 |
|
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2753 |
(transcript notNil and:[Transcript == Stderr]) ifTrue:[ |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2754 |
Transcript := transcript. |
6390
41d5c47c33f0
Catch sigPWR and sigHUP on restart
Stefan Vogel <sv@exept.de>
parents:
6366
diff
changeset
|
2755 |
]. |
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2756 |
Initializing := false. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2757 |
ex proceed. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2758 |
]. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2759 |
CallbackSignal := nil. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2760 |
]. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2761 |
|
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2762 |
"/ reinitialization (restart) of Display is normally performed |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2763 |
"/ 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
|
2764 |
"/ do in now. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2765 |
Initializing ifTrue:[ |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2766 |
Display notNil ifTrue:[ |
6565
8db6b50aeeb6
Catch deviceOpenErrorSignal on image restart
Stefan Vogel <sv@exept.de>
parents:
6564
diff
changeset
|
2767 |
[ |
8db6b50aeeb6
Catch deviceOpenErrorSignal on image restart
Stefan Vogel <sv@exept.de>
parents:
6564
diff
changeset
|
2768 |
Display reinitializeFor:Screen defaultDisplayName. |
8db6b50aeeb6
Catch deviceOpenErrorSignal on image restart
Stefan Vogel <sv@exept.de>
parents:
6564
diff
changeset
|
2769 |
] on:Screen deviceOpenErrorSignal do:[ |
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2770 |
'Smalltalk [error]: Cannot restart connection to: ' errorPrint. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2771 |
Screen defaultDisplayName errorPrintCR. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2772 |
Smalltalk exit. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2773 |
]. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2774 |
]. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2775 |
"/ now, display and view-stuff works; |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2776 |
"/ back to the previous debugging interface |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2777 |
|
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2778 |
Inspector := insp. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2779 |
Debugger := deb. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2780 |
|
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2781 |
"/ reinstall Transcript, if not changed during restart. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2782 |
"/ if there was no Transcript, go to stderr |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2783 |
|
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2784 |
(transcript notNil and:[Transcript == Stderr]) ifTrue:[ |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2785 |
Transcript := transcript. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2786 |
]. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2787 |
Initializing := false. |
7 | 2788 |
]. |
2789 |
||
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2790 |
self mainStartup:true |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2791 |
|
3526
78245608c0b8
no need for last change (restarting processes).
Claus Gittinger <cg@exept.de>
parents:
3523
diff
changeset
|
2792 |
"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
|
2793 |
"Modified: / 3.8.1999 / 09:42:21 / stefan" |
1 | 2794 |
! |
2795 |
||
617 | 2796 |
start |
2797 |
"main startup, if there is a Display, initialize it |
|
2798 |
and start dispatching; otherwise go into a read-eval-print loop." |
|
2799 |
||
2075
85e8e9cfebd3
allow standAlone apps to be mini-debugged with '-debug' flag
Claus Gittinger <cg@exept.de>
parents:
2074
diff
changeset
|
2800 |
|idx graphicalMode arg debuggingStandAlone| |
960
e3b75f50d0cd
changes for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
2801 |
|
e3b75f50d0cd
changes for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
2802 |
graphicalMode := true. |
2075
85e8e9cfebd3
allow standAlone apps to be mini-debugged with '-debug' flag
Claus Gittinger <cg@exept.de>
parents:
2074
diff
changeset
|
2803 |
debuggingStandAlone := false. |
617 | 2804 |
Initializing := true. |
2805 |
||
963
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
2806 |
"/ |
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
2807 |
"/ turn off info messages in standAlone app |
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
2808 |
"/ |
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
2809 |
StandAlone ifTrue:[ |
5410 | 2810 |
InfoPrinting := false. |
2811 |
ObjectMemory infoPrinting:false. |
|
2812 |
idx := CommandLineArguments indexOf:'-debug'. |
|
2813 |
idx ~~ 0 ifTrue:[ |
|
2814 |
CommandLineArguments removeAtIndex:idx. |
|
2815 |
debuggingStandAlone := true |
|
2816 |
] |
|
963
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
2817 |
]. |
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
2818 |
|
617 | 2819 |
" |
2820 |
while reading patches- and rc-file, do not add things into change-file |
|
2821 |
" |
|
2822 |
Class withoutUpdatingChangesDo:[ |
|
5410 | 2823 |
|myName defaultRC prevCatchSetting| |
2824 |
||
2825 |
"/ |
|
2826 |
"/ look for any '-q', '-e' or '-f' command line arguments |
|
2827 |
"/ and handle them; |
|
2828 |
"/ read startup and patches file |
|
2829 |
"/ |
|
2830 |
idx := CommandLineArguments indexOf:'-q'. |
|
2831 |
idx ~~ 0 ifTrue:[ |
|
2832 |
Object infoPrinting:false. |
|
2833 |
ObjectMemory infoPrinting:false. |
|
2834 |
CommandLineArguments removeAtIndex:idx. |
|
2835 |
]. |
|
2836 |
||
2837 |
StandAlone ifFalse:[ |
|
2838 |
"/ look for a '-e filename' argument - this will force evaluation of |
|
2839 |
"/ filename only, no standard startup |
|
2840 |
||
2841 |
idx := CommandLineArguments indexOf:'-e'. |
|
2842 |
idx ~~ 0 ifTrue:[ |
|
2843 |
arg := CommandLineArguments at:idx + 1. |
|
2844 |
||
2845 |
CommandLineArguments |
|
2846 |
removeAtIndex:idx+1; removeAtIndex:idx. |
|
2847 |
||
2848 |
arg = '-' ifTrue:[ |
|
2849 |
self fileInStream:Stdin |
|
2850 |
lazy:nil |
|
2851 |
silent:nil |
|
2852 |
logged:false |
|
2853 |
addPath:nil |
|
2854 |
] ifFalse:[ |
|
2855 |
self fileIn:arg. |
|
2856 |
]. |
|
2857 |
self exit |
|
2858 |
]. |
|
2859 |
]. |
|
2860 |
||
2861 |
"/ look for a '-f filename' argument - this will force evaluation of |
|
2862 |
"/ filename instead of smalltalk.rc |
|
2863 |
||
2864 |
idx := CommandLineArguments indexOf:'-f'. |
|
2865 |
idx ~~ 0 ifTrue:[ |
|
2866 |
myName := (CommandLineArguments at:idx + 1). |
|
2867 |
CommandLineArguments |
|
2868 |
removeAtIndex:idx+1; removeAtIndex:idx. |
|
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2869 |
CommandLine at:1 put:myName. |
6580
4a7851d0f2f5
Fix -f option if file does not end with .rc
Stefan Vogel <sv@exept.de>
parents:
6565
diff
changeset
|
2870 |
(self secureFileIn:myName) ifFalse:[ |
4a7851d0f2f5
Fix -f option if file does not end with .rc
Stefan Vogel <sv@exept.de>
parents:
6565
diff
changeset
|
2871 |
('Smalltalk [error]: startup file ', myName, ' not found.') errorPrintCR. |
4a7851d0f2f5
Fix -f option if file does not end with .rc
Stefan Vogel <sv@exept.de>
parents:
6565
diff
changeset
|
2872 |
self exit. |
5410 | 2873 |
]. |
6580
4a7851d0f2f5
Fix -f option if file does not end with .rc
Stefan Vogel <sv@exept.de>
parents:
6565
diff
changeset
|
2874 |
] ifFalse:[ |
4a7851d0f2f5
Fix -f option if file does not end with .rc
Stefan Vogel <sv@exept.de>
parents:
6565
diff
changeset
|
2875 |
"/ look for <command>.rc |
4a7851d0f2f5
Fix -f option if file does not end with .rc
Stefan Vogel <sv@exept.de>
parents:
6565
diff
changeset
|
2876 |
"/ if not found, read smalltalk.rc (or stxapp.rc for standAlone operation) |
4a7851d0f2f5
Fix -f option if file does not end with .rc
Stefan Vogel <sv@exept.de>
parents:
6565
diff
changeset
|
2877 |
|
4a7851d0f2f5
Fix -f option if file does not end with .rc
Stefan Vogel <sv@exept.de>
parents:
6565
diff
changeset
|
2878 |
myName := self commandName asFilename withSuffix:'rc'. |
4a7851d0f2f5
Fix -f option if file does not end with .rc
Stefan Vogel <sv@exept.de>
parents:
6565
diff
changeset
|
2879 |
(self secureFileIn:myName) ifFalse:[ |
5410 | 2880 |
StandAlone ifFalse:[ |
6580
4a7851d0f2f5
Fix -f option if file does not end with .rc
Stefan Vogel <sv@exept.de>
parents:
6565
diff
changeset
|
2881 |
defaultRC := 'smalltalk.rc' |
4a7851d0f2f5
Fix -f option if file does not end with .rc
Stefan Vogel <sv@exept.de>
parents:
6565
diff
changeset
|
2882 |
] ifTrue:[ |
4a7851d0f2f5
Fix -f option if file does not end with .rc
Stefan Vogel <sv@exept.de>
parents:
6565
diff
changeset
|
2883 |
defaultRC := 'stxapp.rc' |
4a7851d0f2f5
Fix -f option if file does not end with .rc
Stefan Vogel <sv@exept.de>
parents:
6565
diff
changeset
|
2884 |
]. |
4a7851d0f2f5
Fix -f option if file does not end with .rc
Stefan Vogel <sv@exept.de>
parents:
6565
diff
changeset
|
2885 |
|
4a7851d0f2f5
Fix -f option if file does not end with .rc
Stefan Vogel <sv@exept.de>
parents:
6565
diff
changeset
|
2886 |
(self secureFileIn:defaultRC) ifFalse:[ |
4a7851d0f2f5
Fix -f option if file does not end with .rc
Stefan Vogel <sv@exept.de>
parents:
6565
diff
changeset
|
2887 |
StandAlone ifFalse:[ |
4a7851d0f2f5
Fix -f option if file does not end with .rc
Stefan Vogel <sv@exept.de>
parents:
6565
diff
changeset
|
2888 |
'Smalltalk [warning]: no startup rc-file found. Going into line-by-line interpreter.' infoPrintCR. |
4a7851d0f2f5
Fix -f option if file does not end with .rc
Stefan Vogel <sv@exept.de>
parents:
6565
diff
changeset
|
2889 |
graphicalMode := false. |
4a7851d0f2f5
Fix -f option if file does not end with .rc
Stefan Vogel <sv@exept.de>
parents:
6565
diff
changeset
|
2890 |
] |
5410 | 2891 |
] |
6580
4a7851d0f2f5
Fix -f option if file does not end with .rc
Stefan Vogel <sv@exept.de>
parents:
6565
diff
changeset
|
2892 |
]. |
5410 | 2893 |
]. |
617 | 2894 |
]. |
2895 |
||
963
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
2896 |
StandAlone ifTrue:[ |
5410 | 2897 |
Debugger := Inspector := nil. |
2898 |
debuggingStandAlone ifTrue:[ |
|
2899 |
Debugger := MiniDebugger. |
|
2900 |
]. |
|
963
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
2901 |
] ifFalse:[ |
5410 | 2902 |
" |
2903 |
enable the graphical debugger/inspector |
|
2904 |
(they could have been (re)defined as autoloaded in the patches file) |
|
2905 |
" |
|
2906 |
self initStandardTools. |
|
963
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
2907 |
]. |
617 | 2908 |
|
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2909 |
(Display isNil or:[HeadlessOperation]) ifTrue:[ |
5410 | 2910 |
graphicalMode := false. |
2074
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
2911 |
]. |
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
2912 |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2913 |
self mainStartup:graphicalMode |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2914 |
|
5146 | 2915 |
"Modified: / 24.12.1999 / 00:26:54 / cg" |
1097 | 2916 |
! ! |
2917 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
2918 |
!Smalltalk class methodsFor:'startup queries'! |
1097 | 2919 |
|
1580
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2920 |
commandLine |
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2921 |
"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
|
2922 |
|
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2923 |
^ CommandLine |
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2924 |
|
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2925 |
"Created: 19.7.1996 / 11:09:06 / cg" |
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2926 |
! |
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2927 |
|
1097 | 2928 |
commandLineArguments |
1580
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2929 |
"return the user command line arguments; |
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2930 |
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
|
2931 |
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
|
2932 |
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
|
2933 |
the commandLineArguments will be #('foo' 'bar' 'baz'). |
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2934 |
In contrast, the value returned by #commandLine will be the full set of words." |
1097 | 2935 |
|
2936 |
^ CommandLineArguments |
|
1580
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2937 |
|
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2938 |
"Modified: 19.7.1996 / 11:11:03 / cg" |
1097 | 2939 |
! |
2940 |
||
2941 |
commandName |
|
2942 |
"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
|
2943 |
can be something else for standAlone apps." |
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2944 |
|
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2945 |
^ CommandLine at:1. |
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2946 |
|
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2947 |
"Modified: 19.7.1996 / 11:11:16 / cg" |
1097 | 2948 |
! |
2949 |
||
4957 | 2950 |
isHeadless |
2951 |
"return true, if this is a headless application |
|
2952 |
i.e. no default Display connection is required/used" |
|
2953 |
||
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2954 |
^ HeadlessOperation |
4957 | 2955 |
! |
2956 |
||
1097 | 2957 |
isStandAloneApp |
2958 |
"return true, if this is a standAlone application |
|
2959 |
(in contrast to a full smalltalk system)." |
|
2960 |
||
2961 |
^ StandAlone |
|
617 | 2962 |
! |
2963 |
||
2964 |
startupArguments |
|
2965 |
"return the arguments passed to StartupClass" |
|
2966 |
||
2967 |
^ StartupArguments |
|
70 | 2968 |
! |
2969 |
||
2970 |
startupClass |
|
2971 |
"return the class, that will get the start message when smalltalk |
|
2972 |
starts and its non-nil. Usually this is nil, but saving an image |
|
2973 |
with a non-nil StartupClass allows stand-alone applications" |
|
2974 |
||
2975 |
^ StartupClass |
|
2976 |
! |
|
2977 |
||
617 | 2978 |
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
|
2979 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
2980 |
|
617 | 2981 |
"set the class, selector and arguments to be performed when smalltalk |
2982 |
starts. Setting those before saving a snapshot, will make the saved |
|
2983 |
image come up executing your application (instead of the normal mainloop)" |
|
2984 |
||
2985 |
StartupClass := aClass. |
|
2986 |
StartupSelector := aSymbol. |
|
2987 |
StartupArguments := anArrayOrNil |
|
2988 |
! |
|
2989 |
||
70 | 2990 |
startupSelector |
2991 |
"return the selector, that will be sent to StartupClass" |
|
2992 |
||
2993 |
^ StartupSelector |
|
2994 |
! ! |
|
2995 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
2996 |
!Smalltalk class methodsFor:'system environment'! |
1069 | 2997 |
|
2998 |
language |
|
2999 |
"return the language setting" |
|
3000 |
||
3001 |
^ Language |
|
1307 | 3002 |
|
3003 |
" |
|
3004 |
Smalltalk language |
|
3005 |
" |
|
3006 |
||
3007 |
"Modified: 26.4.1996 / 17:10:05 / cg" |
|
3008 |
! |
|
3009 |
||
3010 |
language:aLanguageSymbol |
|
3011 |
"set the language" |
|
3012 |
||
3013 |
Language := aLanguageSymbol. |
|
3014 |
self changed:#Language |
|
3015 |
||
3016 |
" |
|
3017 |
Smalltalk language:#de |
|
3018 |
" |
|
3019 |
||
3020 |
"Modified: 26.4.1996 / 17:13:34 / cg" |
|
1069 | 3021 |
! |
3022 |
||
3023 |
languageTerritory |
|
3024 |
"return the language territory setting" |
|
3025 |
||
3026 |
^ LanguageTerritory |
|
1307 | 3027 |
! |
3028 |
||
3029 |
languageTerritory:aTerritorySymbol |
|
3030 |
"set the language territory" |
|
3031 |
||
3032 |
LanguageTerritory := aTerritorySymbol. |
|
3033 |
self changed:#LanguageTerritory |
|
3034 |
||
3035 |
" |
|
3036 |
Time now |
|
3037 |
||
3038 |
Smalltalk languageTerritory:#us. |
|
3039 |
Time now |
|
3040 |
||
3041 |
Smalltalk languageTerritory:#de. |
|
3042 |
Time now |
|
3043 |
" |
|
3044 |
||
3045 |
"Modified: 26.4.1996 / 17:12:39 / cg" |
|
1069 | 3046 |
! ! |
3047 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
3048 |
!Smalltalk class methodsFor:'system management'! |
70 | 3049 |
|
617 | 3050 |
compressSources |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
3051 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
3052 |
|
617 | 3053 |
"compress the sources file, and remove all method source strings |
3054 |
from the system and replace them by refs to a string in the source file. |
|
3055 |
This is a bit different in ST/X than in other smalltalks, |
|
3056 |
since we use per-class sourcefiles for the compiled classes, |
|
3057 |
and a mix of in-memory strings and one-for-all sourceFile for |
|
3058 |
incremental compiled methods. |
|
3059 |
Therefore, only those sources which are not coming from compiled |
|
3060 |
methods are put into the 'st.src' file - all others are untouched. |
|
3061 |
This is being automated - so dont care for now." |
|
3062 |
||
3063 |
" |
|
3064 |
first, find all methods which contain either a string-ref |
|
3065 |
or an external string in the 'st.src' file |
|
3066 |
" |
|
3067 |
|newStream table source pos fileName| |
|
3068 |
||
3069 |
newStream := 'src.tmp' asFilename writeStream. |
|
3070 |
newStream isNil ifTrue:[ |
|
5363 | 3071 |
self error:'cannot create new temporary source file' mayProceed:true. |
3072 |
^ self |
|
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
3073 |
]. |
617 | 3074 |
|
3075 |
table := IdentityDictionary new:100. |
|
3076 |
||
3077 |
Method allSubInstancesDo:[:aMethod | |
|
5363 | 3078 |
source := nil. |
3079 |
aMethod sourcePosition notNil ifTrue:[ |
|
3080 |
aMethod sourceFilename = 'st.src' ifTrue:[ |
|
3081 |
source := aMethod source. |
|
3082 |
] |
|
3083 |
] ifFalse:[ |
|
3084 |
source := aMethod source |
|
3085 |
]. |
|
3086 |
||
3087 |
source notNil ifTrue:[ |
|
3088 |
pos := newStream position. |
|
3089 |
newStream nextChunkPut:source. |
|
3090 |
||
3091 |
" |
|
3092 |
dont change the methods info - maybe some write error |
|
3093 |
occurs later, in that case we abort and leave everything |
|
3094 |
untouched. |
|
3095 |
" |
|
3096 |
table at:aMethod put:pos |
|
3097 |
] |
|
617 | 3098 |
]. |
3099 |
||
3100 |
newStream close. |
|
3101 |
||
3102 |
" |
|
3103 |
now, rename the new source file, |
|
3104 |
" |
|
3105 |
fileName := (ObjectMemory nameForSources). |
|
1693 | 3106 |
'src.tmp' asFilename renameTo:fileName. |
617 | 3107 |
|
3108 |
"good - now go over all changed methods, and change their |
|
3109 |
source reference" |
|
3110 |
||
3111 |
table keysAndValuesDo:[:aMethod :pos | |
|
5363 | 3112 |
aMethod localSourceFilename:fileName position:pos. |
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
3113 |
"/ aMethod printCR. |
617 | 3114 |
]. |
3115 |
||
3116 |
" |
|
3117 |
Smalltalk compressSources |
|
3118 |
" |
|
1693 | 3119 |
|
2176
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2170
diff
changeset
|
3120 |
"Modified: 16.1.1997 / 01:25:58 / cg" |
617 | 3121 |
! |
3122 |
||
3044 | 3123 |
generateSingleSourceFile |
3124 |
"{ Pragma: +optSpace }" |
|
3125 |
||
3126 |
"generate the sources file, and remove all method source strings |
|
3127 |
from the system and replace them by refs to a string in the source file. |
|
3128 |
This makes the image independent from the per-class source files |
|
3129 |
and makes transportation of endUser applications easier, since |
|
3130 |
only 3 files (executable, image and sourceFile) need to be |
|
3131 |
transported." |
|
3132 |
||
3133 |
|newStream table source pos fileName| |
|
3134 |
||
3135 |
newStream := 'src.tmp' asFilename writeStream. |
|
3136 |
newStream isNil ifTrue:[ |
|
5363 | 3137 |
self error:'cannot create new temporary source file' mayProceed:true. |
3138 |
^ self |
|
3044 | 3139 |
]. |
3140 |
||
3141 |
table := IdentityDictionary new:100. |
|
3142 |
||
3143 |
Method allSubInstancesDo:[:aMethod | |
|
5363 | 3144 |
source := aMethod source. |
3145 |
source notNil ifTrue:[ |
|
3146 |
pos := newStream position. |
|
3147 |
newStream nextChunkPut:source. |
|
3148 |
||
3149 |
" |
|
3150 |
dont change the methods info - maybe some write error |
|
3151 |
occurs later, in that case we abort and leave everything |
|
3152 |
untouched. |
|
3153 |
" |
|
3154 |
table at:aMethod put:pos |
|
3155 |
] |
|
3044 | 3156 |
]. |
3157 |
||
3158 |
newStream close. |
|
3159 |
||
3160 |
" |
|
3161 |
now, rename the new source file, |
|
3162 |
" |
|
3163 |
fileName := (ObjectMemory nameForSources). |
|
3164 |
'src.tmp' asFilename renameTo:fileName. |
|
3165 |
||
3166 |
"good - now go over all changed methods, and change their |
|
3167 |
source reference" |
|
3168 |
||
3169 |
table keysAndValuesDo:[:aMethod :pos | |
|
5363 | 3170 |
aMethod localSourceFilename:fileName position:pos. |
3044 | 3171 |
"/ aMethod printCR. |
3172 |
]. |
|
3173 |
||
3174 |
" |
|
3175 |
Smalltalk generateSingleSourceFile |
|
3176 |
" |
|
3177 |
||
3178 |
"Modified: 16.1.1997 / 01:25:58 / cg" |
|
3179 |
"Created: 17.10.1997 / 13:00:56 / cg" |
|
3180 |
! |
|
3181 |
||
3915
e32e63ee0d79
extracted autoload-class generation into extra method
Claus Gittinger <cg@exept.de>
parents:
3866
diff
changeset
|
3182 |
installAutoloadedClassNamed:clsName category:cat package:package revision:revisionOrNil |
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3183 |
"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
|
3184 |
to be loaded from package. |
e32e63ee0d79
extracted autoload-class generation into extra method
Claus Gittinger <cg@exept.de>
parents:
3866
diff
changeset
|
3185 |
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
|
3186 |
(otherwise, the newest revision will be loaded" |
e32e63ee0d79
extracted autoload-class generation into extra method
Claus Gittinger <cg@exept.de>
parents:
3866
diff
changeset
|
3187 |
|
e32e63ee0d79
extracted autoload-class generation into extra method
Claus Gittinger <cg@exept.de>
parents:
3866
diff
changeset
|
3188 |
|clsSym cls| |
e32e63ee0d79
extracted autoload-class generation into extra method
Claus Gittinger <cg@exept.de>
parents:
3866
diff
changeset
|
3189 |
|
e32e63ee0d79
extracted autoload-class generation into extra method
Claus Gittinger <cg@exept.de>
parents:
3866
diff
changeset
|
3190 |
clsSym := clsName asSymbol. |
e32e63ee0d79
extracted autoload-class generation into extra method
Claus Gittinger <cg@exept.de>
parents:
3866
diff
changeset
|
3191 |
|
e32e63ee0d79
extracted autoload-class generation into extra method
Claus Gittinger <cg@exept.de>
parents:
3866
diff
changeset
|
3192 |
"/ install if not already compiled-in |
5716 | 3193 |
(cls := self at:clsSym) isNil ifTrue:[ |
3194 |
Autoload subclass:clsSym |
|
3195 |
instanceVariableNames:'' |
|
3196 |
classVariableNames:'' |
|
3197 |
poolDictionaries:'' |
|
3198 |
category:cat |
|
3199 |
inEnvironment:Smalltalk. |
|
3200 |
||
3201 |
cls := self at:clsSym. |
|
3202 |
cls isNil ifTrue:[ |
|
3203 |
('Smalltalk [warning]: failed to install ' , clsName , ' as autoloaded.') infoPrintCR. |
|
3204 |
] ifFalse:[ |
|
3205 |
cls package:package asSymbol. |
|
3206 |
revisionOrNil notNil ifTrue:[ |
|
3207 |
cls setBinaryRevision:revisionOrNil |
|
3208 |
] |
|
3209 |
] |
|
3210 |
] ifFalse:[ |
|
3211 |
"/ class already present - however, check for same category/package |
|
3212 |
package ~= cls package ifTrue:[ |
|
3213 |
cls package:package asSymbol. |
|
3214 |
]. |
|
3215 |
cat ~= cls category ifTrue:[ |
|
3216 |
cls category:cat. |
|
3217 |
]. |
|
3218 |
]. |
|
3915
e32e63ee0d79
extracted autoload-class generation into extra method
Claus Gittinger <cg@exept.de>
parents:
3866
diff
changeset
|
3219 |
|
e32e63ee0d79
extracted autoload-class generation into extra method
Claus Gittinger <cg@exept.de>
parents:
3866
diff
changeset
|
3220 |
"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
|
3221 |
! |
e32e63ee0d79
extracted autoload-class generation into extra method
Claus Gittinger <cg@exept.de>
parents:
3866
diff
changeset
|
3222 |
|
3044 | 3223 |
installAutoloadedClasses |
3224 |
"read the standard abbreviation file; install all classes found there as |
|
3225 |
autoloaded. This takes some time ..." |
|
3226 |
||
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3227 |
|dirsConsulted p| |
4458 | 3228 |
|
3229 |
"/ new scheme: look for a directory called 'packages' |
|
3230 |
"/ and enumerate its abbrev.stc files... |
|
5067
335c866e150c
walk packagePath when reading abbrevs & autoloaded classes.
Claus Gittinger <cg@exept.de>
parents:
5065
diff
changeset
|
3231 |
dirsConsulted := Set new. |
5162 | 3232 |
|
3233 |
"/ no longer - only consult the packagePath ... |
|
3234 |
"/ f := Smalltalk getSystemFileName:'packages'. |
|
3235 |
"/ f notNil ifTrue:[ |
|
3236 |
"/ f := f asFilename. |
|
3237 |
"/ f isDirectory ifTrue:[ |
|
3238 |
"/ ('Smalltalk [info]: installing autoloaded classes found under ''' , f pathName ,'''') infoPrintCR. |
|
3239 |
"/ self |
|
3240 |
"/ recursiveInstallAutoloadedClassesFrom:f |
|
3241 |
"/ rememberIn:dirsConsulted |
|
3242 |
"/ maxLevels:5 |
|
3243 |
"/ noAutoload:false |
|
3244 |
"/ packageTop:f. |
|
3245 |
"/ ]. |
|
3246 |
"/ ]. |
|
3247 |
||
3248 |
"/ along the package-path |
|
5788 | 3249 |
(p := self packagePath) do:[:aPath | |
3250 |
(dirsConsulted includes:aPath) ifFalse:[ |
|
3251 |
('Smalltalk [info]: installing autoloaded classes found under ''' , aPath ,'''') infoPrintCR. |
|
3252 |
self |
|
3253 |
recursiveInstallAutoloadedClassesFrom:aPath |
|
3254 |
rememberIn:dirsConsulted |
|
3255 |
maxLevels:5 |
|
3256 |
noAutoload:false |
|
3257 |
packageTop:aPath. |
|
3258 |
] |
|
3259 |
]. |
|
3260 |
p size == 0 ifTrue:[ |
|
3261 |
('Smalltalk [info]: installing autoloaded classes found under ''../../..''') infoPrintCR. |
|
3262 |
self |
|
5789 | 3263 |
recursiveInstallAutoloadedClassesFrom:'../../..' |
5788 | 3264 |
rememberIn:dirsConsulted |
3265 |
maxLevels:5 |
|
3266 |
noAutoload:false |
|
3267 |
packageTop:'../../..'. |
|
3268 |
]. |
|
3269 |
||
4458 | 3270 |
"/ old scheme: look for a single file called 'abbrev.stc' in the |
3271 |
"/ include directory. This will vanish. |
|
3272 |
||
5096 | 3273 |
"/ ('Smalltalk [info]: installing autoloaded classes from ''include/abbrev.stc''') infoPrintCR. |
3274 |
"/ self installAutoloadedClassesFrom:'include/abbrev.stc' |
|
3044 | 3275 |
|
3276 |
" |
|
3277 |
Smalltalk installAutoloadedClasses |
|
3278 |
" |
|
3279 |
||
5096 | 3280 |
"Created: / 14.2.1997 / 17:32:57 / cg" |
3281 |
"Modified: / 13.12.1999 / 11:56:50 / cg" |
|
3044 | 3282 |
! |
3283 |
||
3284 |
installAutoloadedClassesFrom:anAbbrevFilePath |
|
3285 |
"read the given abbreviation file; install all classes found there as |
|
3286 |
autoloaded. This takes some time ..." |
|
3287 |
||
4458 | 3288 |
|f s| |
3044 | 3289 |
|
3290 |
f := self getSystemFileName:anAbbrevFilePath. |
|
3291 |
||
3292 |
f notNil ifTrue:[ |
|
6366 | 3293 |
f := f asFilename. |
3294 |
f isDirectory ifTrue:[ |
|
3295 |
f := f construct:'abbrev.stc' |
|
3296 |
]. |
|
3297 |
s := f readStream. |
|
3298 |
s notNil ifTrue:[ |
|
3299 |
self installAutoloadedClassesFromStream:s. |
|
3300 |
s close. |
|
3301 |
]. |
|
3044 | 3302 |
] |
3303 |
||
3304 |
" |
|
3305 |
Smalltalk installAutoloadedClassesFrom:'include/abbrev.stc' |
|
3306 |
" |
|
3307 |
||
3915
e32e63ee0d79
extracted autoload-class generation into extra method
Claus Gittinger <cg@exept.de>
parents:
3866
diff
changeset
|
3308 |
"Modified: / 5.11.1998 / 15:10:51 / cg" |
3044 | 3309 |
! |
3310 |
||
4458 | 3311 |
installAutoloadedClassesFromStream:anAbbrevFileStream |
5112 | 3312 |
"read the given abbreviation file; |
3313 |
install all classes found there as autoloaded, and also update the |
|
3314 |
abbreviation (className-to-fileName mapping) table. |
|
3315 |
This takes some time ..." |
|
4458 | 3316 |
|
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3317 |
|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
|
3318 |
|
9da015b8ae46
update abbrevs on the fly when installing autoloaded classes.
Claus Gittinger <cg@exept.de>
parents:
5108
diff
changeset
|
3319 |
"/ 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
|
3320 |
CachedAbbreviations isNil ifTrue:[ |
5811 | 3321 |
CachedAbbreviations := IdentityDictionary new. |
5109
9da015b8ae46
update abbrevs on the fly when installing autoloaded classes.
Claus Gittinger <cg@exept.de>
parents:
5108
diff
changeset
|
3322 |
]. |
9da015b8ae46
update abbrevs on the fly when installing autoloaded classes.
Claus Gittinger <cg@exept.de>
parents:
5108
diff
changeset
|
3323 |
abbrevs := CachedAbbreviations. |
4458 | 3324 |
|
5112 | 3325 |
KnownPackages isNil ifTrue:[ |
5811 | 3326 |
KnownPackages := Set new. |
5112 | 3327 |
]. |
3328 |
||
4458 | 3329 |
"/ yes, create any required nameSpace, without asking user. |
3330 |
Class createNameSpaceQuerySignal answer:true do:[ |
|
3331 |
||
5811 | 3332 |
[anAbbrevFileStream atEnd] whileFalse:[ |
3333 |
l := anAbbrevFileStream nextLine withoutSeparators. |
|
3334 |
l notEmpty ifTrue:[ |
|
3335 |
"/ must do it manually, caring for quoted strings. |
|
4685
d145298696b7
more package loading support
Claus Gittinger <cg@exept.de>
parents:
4642
diff
changeset
|
3336 |
"/ words := line asCollectionOfWords. |
d145298696b7
more package loading support
Claus Gittinger <cg@exept.de>
parents:
4642
diff
changeset
|
3337 |
|
5811 | 3338 |
words := OrderedCollection new. |
3339 |
s2 := l readStream. |
|
3340 |
[s2 atEnd] whileFalse:[ |
|
3341 |
s2 skipSeparators. |
|
3342 |
s2 peek == $' ifTrue:[ |
|
3343 |
s2 next. |
|
3344 |
w := s2 upTo:$'. |
|
3345 |
s2 skipSeparators. |
|
3346 |
] ifFalse:[ |
|
3347 |
w := s2 upToSeparator |
|
3348 |
]. |
|
3349 |
words add:w |
|
3350 |
]. |
|
3351 |
words size < 3 ifTrue:[ |
|
3352 |
'Smalltalk [warning]: bad abbrev entry' errorPrint. |
|
3353 |
anAbbrevFileStream isFileStream ifTrue:[ |
|
3354 |
' (in ''' errorPrint. |
|
3355 |
anAbbrevFileStream pathName errorPrint. |
|
3356 |
''')' errorPrint |
|
3357 |
]. |
|
3358 |
': ' errorPrint. l errorPrintCR |
|
3359 |
] ifFalse:[ |
|
3360 |
clsName := (words at:1) asSymbol. |
|
3361 |
abbrev := (words at:2). |
|
3362 |
package := (words at:3) asSymbol. |
|
5117 | 3363 |
"/ KnownPackages add:package. |
5112 | 3364 |
|
5811 | 3365 |
cat := words at:4 ifAbsent:nil. |
3366 |
||
3367 |
(cat size == 0) ifTrue:[ |
|
3368 |
cat := 'autoloaded' |
|
3369 |
]. |
|
3370 |
||
3371 |
"/ on the fly, update the abbreviations |
|
3372 |
clsName ~= abbrev ifTrue:[ |
|
3373 |
nameKey := clsName asSymbol. |
|
3374 |
oldAbbrev := abbrevs at:nameKey ifAbsent:nil. |
|
3375 |
(oldAbbrev notNil and:[oldAbbrev ~= abbrev]) ifTrue:[ |
|
3376 |
StandAlone ifFalse:[ |
|
3377 |
('Smalltalk [warning]: conflict for: ' , clsName , ' in ' , (anAbbrevFileStream pathName)) infoPrintCR. |
|
3378 |
('Smalltalk [warning]: (' , oldAbbrev , ' <-> ' , abbrev , ')') infoPrintCR |
|
3379 |
]. |
|
3380 |
abbrevs at:nameKey put:abbrev. |
|
3381 |
] ifFalse:[ |
|
3382 |
cls := self classNamed:abbrev. |
|
3383 |
||
3384 |
cls notNil ifTrue:[ |
|
3385 |
cls name ~= clsName ifTrue:[ |
|
3386 |
"/ ok, there is a class named after this abbrev ... |
|
3387 |
"/ this is only a conflict, if the other class has no |
|
3388 |
"/ abbreviation (or the same). |
|
3389 |
(abbrevs at:(cls name asSymbol) ifAbsent:cls name) = abbrev ifTrue:[ |
|
3390 |
cls isNameSpace ifFalse:[ |
|
3391 |
package = cls package ifTrue:[ |
|
3392 |
StandAlone ifFalse:[ |
|
3393 |
('Smalltalk [warning]: conflict for: ' , cls name , ' in ' , (anAbbrevFileStream pathName)) infoPrintCR. |
|
3394 |
('Smalltalk [warning]: (' , clsName , ' -> ' , abbrev , ')') infoPrintCR |
|
3395 |
] |
|
3396 |
] |
|
3397 |
] |
|
3398 |
] |
|
3399 |
] |
|
3400 |
]. |
|
3401 |
abbrevs at:clsName asSymbol put:abbrev. |
|
3402 |
] |
|
3403 |
]. |
|
3404 |
||
3405 |
"/ ' autoloaded: ' print. clsName print. ' in ' print. cat printCR. |
|
3406 |
||
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3407 |
self installAutoloadedClassNamed:clsName category:cat package:package revision:nil. |
5811 | 3408 |
] |
3409 |
] |
|
3410 |
] |
|
4458 | 3411 |
] |
3412 |
! |
|
3413 |
||
3044 | 3414 |
loadBinaries |
3415 |
"return true, if binaries should be loaded into the system, |
|
3416 |
false if this should be suppressed. The default is false (for now)." |
|
3417 |
||
3418 |
^ LoadBinaries |
|
3419 |
! |
|
3420 |
||
3421 |
loadBinaries:aBoolean |
|
3422 |
"{ Pragma: +optSpace }" |
|
3423 |
||
3424 |
"turn on/off loading of binary objects" |
|
3425 |
||
3426 |
aBoolean ifTrue:[ |
|
5363 | 3427 |
(ObjectFileLoader notNil and:[ObjectFileLoader canLoadObjectFiles]) ifTrue:[ |
3428 |
LoadBinaries := true. |
|
3429 |
^ self |
|
3430 |
]. |
|
3431 |
'Smalltalk [info]: this system does not support binary loading' infoPrintCR. |
|
617 | 3432 |
]. |
3044 | 3433 |
LoadBinaries := false |
3434 |
||
3435 |
"Modified: 10.1.1997 / 15:11:00 / cg" |
|
3436 |
! |
|
3437 |
||
3438 |
logDoits |
|
3439 |
"return true if doits should go into the changes file |
|
3440 |
as well as changes - by default, this is off, since |
|
3441 |
it can blow up the changes file enormously ... |
|
3442 |
" |
|
3443 |
||
3444 |
^ LogDoits |
|
3445 |
||
3446 |
" |
|
3447 |
LogDoits := false |
|
3448 |
LogDoits := true |
|
3449 |
" |
|
3450 |
! |
|
3451 |
||
3452 |
logDoits:aBoolean |
|
3453 |
"{ Pragma: +optSpace }" |
|
3454 |
||
3455 |
"turn on/off logging of doits in the changes file. |
|
3456 |
By default, this is off, since it can blow up the |
|
3457 |
changes file enormously ... |
|
3458 |
" |
|
3459 |
||
3460 |
LogDoits := aBoolean |
|
3461 |
||
3462 |
! |
|
3463 |
||
3464 |
makeBytecodeMethods |
|
3465 |
"{ Pragma: +optSpace }" |
|
3466 |
||
3467 |
"walk over all methods and make each a bytecode method |
|
3468 |
iff it does not contain primitive C code. |
|
3469 |
Experimental and not yet used." |
|
3470 |
||
3471 |
Method allSubInstancesDo:[:aMethod | |
|
5363 | 3472 |
|newMethod| |
3473 |
||
3474 |
aMethod hasPrimitiveCode ifFalse:[ |
|
3475 |
newMethod := aMethod asByteCodeMethod. |
|
3476 |
newMethod ~~ aMethod ifTrue:[ |
|
3477 |
aMethod becomeSameAs:newMethod |
|
3478 |
] |
|
3479 |
]. |
|
3044 | 3480 |
]. |
3481 |
||
3482 |
" |
|
3483 |
Smalltalk makeBytecodeMethods |
|
3484 |
" |
|
3485 |
||
3486 |
"Modified: 16.1.1997 / 01:25:58 / cg" |
|
3487 |
"Created: 17.10.1997 / 13:52:19 / cg" |
|
3062
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3488 |
! |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3489 |
|
5117 | 3490 |
recursiveInstallAutoloadedClassesFrom:aDirectory rememberIn:dirsConsulted maxLevels:maxLevels noAutoload:noAutoloadIn packageTop:packageTopPath |
4458 | 3491 |
"read all abbrev.stc files from and under aDirectory |
5363 | 3492 |
and install autoloaded classes. |
3493 |
If a file called NOAUTOLOAD is found, no classes there and below are installed as autoloaded |
|
3494 |
(however, the directories are searched for packages) |
|
3495 |
If a file called NOPACKAGES is found, no further searching is done in that directory or below." |
|
4458 | 3496 |
|
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3497 |
|abbrevStream dir noAutoloadHere dirName pkgName| |
4458 | 3498 |
|
5075 | 3499 |
maxLevels == 0 ifTrue:[ |
5077 | 3500 |
"/ 'Smalltalk [warning]: max directory nesting reached.' infoPrintCR. |
3501 |
^ self |
|
5075 | 3502 |
]. |
5074 | 3503 |
|
4458 | 3504 |
dir := aDirectory asFilename. |
6188 | 3505 |
|
5110
283e7eb8c359
remember where we have been when searching for abbrev.stc-files.
Claus Gittinger <cg@exept.de>
parents:
5109
diff
changeset
|
3506 |
(dirsConsulted includes:dir pathName) ifTrue:[ |
283e7eb8c359
remember where we have been when searching for abbrev.stc-files.
Claus Gittinger <cg@exept.de>
parents:
5109
diff
changeset
|
3507 |
^ self |
283e7eb8c359
remember where we have been when searching for abbrev.stc-files.
Claus Gittinger <cg@exept.de>
parents:
5109
diff
changeset
|
3508 |
]. |
283e7eb8c359
remember where we have been when searching for abbrev.stc-files.
Claus Gittinger <cg@exept.de>
parents:
5109
diff
changeset
|
3509 |
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
|
3510 |
|
5363 | 3511 |
(dir construct:'NOPACKAGES') exists ifTrue:[ |
3512 |
^ self. |
|
3513 |
]. |
|
6188 | 3514 |
noAutoloadHere := noAutoloadIn. |
3515 |
noAutoloadHere ifFalse:[ |
|
5117 | 3516 |
(dir construct:'NOAUTOLOAD') exists ifTrue:[ |
6188 | 3517 |
noAutoloadHere := true. |
3518 |
]. |
|
3519 |
] ifTrue:[ |
|
3520 |
(dir construct:'AUTOLOAD') exists ifTrue:[ |
|
3521 |
noAutoloadHere := false. |
|
5117 | 3522 |
]. |
5108 | 3523 |
]. |
5117 | 3524 |
|
3525 |
((dir construct:'loadAll') exists |
|
6188 | 3526 |
or:[(dir construct:'abbrev.stc') exists |
3527 |
or:[(dir construct:(dir baseName , '.prj')) exists]]) ifTrue:[ |
|
5117 | 3528 |
KnownPackages isNil ifTrue:[ |
3529 |
KnownPackages := Set new. |
|
3530 |
]. |
|
3531 |
dirName := dir pathName. |
|
3532 |
pkgName := dirName copyFrom:(packageTopPath asFilename pathName) size + 1 + 1. |
|
3533 |
KnownPackages add:pkgName |
|
3534 |
]. |
|
3535 |
||
3536 |
"/ |
|
3537 |
"/ suppress installation as autoloaded in this and everything |
|
3538 |
"/ below; however, still traverse the directories to find packages ... |
|
3539 |
"/ |
|
6188 | 3540 |
noAutoloadHere ifFalse:[ |
5117 | 3541 |
abbrevStream := (dir construct:'abbrev.stc') asFilename readStream. |
3542 |
abbrevStream notNil ifTrue:[ |
|
3543 |
"/ abbrevStream pathName printCR. |
|
3544 |
self installAutoloadedClassesFromStream:abbrevStream. |
|
3545 |
abbrevStream close. |
|
3546 |
]. |
|
4458 | 3547 |
]. |
3548 |
||
5831 | 3549 |
(dir directoryContents ? #()) do:[:aFilename | |
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
3550 |
|f| |
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
3551 |
|
5067
335c866e150c
walk packagePath when reading abbrevs & autoloaded classes.
Claus Gittinger <cg@exept.de>
parents:
5065
diff
changeset
|
3552 |
(#( |
335c866e150c
walk packagePath when reading abbrevs & autoloaded classes.
Claus Gittinger <cg@exept.de>
parents:
5065
diff
changeset
|
3553 |
'doc' |
335c866e150c
walk packagePath when reading abbrevs & autoloaded classes.
Claus Gittinger <cg@exept.de>
parents:
5065
diff
changeset
|
3554 |
'CVS' |
335c866e150c
walk packagePath when reading abbrevs & autoloaded classes.
Claus Gittinger <cg@exept.de>
parents:
5065
diff
changeset
|
3555 |
'bitmaps' |
335c866e150c
walk packagePath when reading abbrevs & autoloaded classes.
Claus Gittinger <cg@exept.de>
parents:
5065
diff
changeset
|
3556 |
'resources' |
335c866e150c
walk packagePath when reading abbrevs & autoloaded classes.
Claus Gittinger <cg@exept.de>
parents:
5065
diff
changeset
|
3557 |
'source' |
335c866e150c
walk packagePath when reading abbrevs & autoloaded classes.
Claus Gittinger <cg@exept.de>
parents:
5065
diff
changeset
|
3558 |
) includes:aFilename) ifFalse:[ |
5110
283e7eb8c359
remember where we have been when searching for abbrev.stc-files.
Claus Gittinger <cg@exept.de>
parents:
5109
diff
changeset
|
3559 |
((dir baseName ~= 'stx') |
283e7eb8c359
remember where we have been when searching for abbrev.stc-files.
Claus Gittinger <cg@exept.de>
parents:
5109
diff
changeset
|
3560 |
or:[ |
283e7eb8c359
remember where we have been when searching for abbrev.stc-files.
Claus Gittinger <cg@exept.de>
parents:
5109
diff
changeset
|
3561 |
(#( |
283e7eb8c359
remember where we have been when searching for abbrev.stc-files.
Claus Gittinger <cg@exept.de>
parents:
5109
diff
changeset
|
3562 |
'configurations' |
283e7eb8c359
remember where we have been when searching for abbrev.stc-files.
Claus Gittinger <cg@exept.de>
parents:
5109
diff
changeset
|
3563 |
'include' |
283e7eb8c359
remember where we have been when searching for abbrev.stc-files.
Claus Gittinger <cg@exept.de>
parents:
5109
diff
changeset
|
3564 |
'rules' |
283e7eb8c359
remember where we have been when searching for abbrev.stc-files.
Claus Gittinger <cg@exept.de>
parents:
5109
diff
changeset
|
3565 |
'stc' |
283e7eb8c359
remember where we have been when searching for abbrev.stc-files.
Claus Gittinger <cg@exept.de>
parents:
5109
diff
changeset
|
3566 |
'support' |
283e7eb8c359
remember where we have been when searching for abbrev.stc-files.
Claus Gittinger <cg@exept.de>
parents:
5109
diff
changeset
|
3567 |
) includes:aFilename) not]) |
283e7eb8c359
remember where we have been when searching for abbrev.stc-files.
Claus Gittinger <cg@exept.de>
parents:
5109
diff
changeset
|
3568 |
ifTrue:[ |
283e7eb8c359
remember where we have been when searching for abbrev.stc-files.
Claus Gittinger <cg@exept.de>
parents:
5109
diff
changeset
|
3569 |
f := dir construct:aFilename. |
283e7eb8c359
remember where we have been when searching for abbrev.stc-files.
Claus Gittinger <cg@exept.de>
parents:
5109
diff
changeset
|
3570 |
f isDirectory ifTrue:[ |
283e7eb8c359
remember where we have been when searching for abbrev.stc-files.
Claus Gittinger <cg@exept.de>
parents:
5109
diff
changeset
|
3571 |
self |
283e7eb8c359
remember where we have been when searching for abbrev.stc-files.
Claus Gittinger <cg@exept.de>
parents:
5109
diff
changeset
|
3572 |
recursiveInstallAutoloadedClassesFrom:f |
283e7eb8c359
remember where we have been when searching for abbrev.stc-files.
Claus Gittinger <cg@exept.de>
parents:
5109
diff
changeset
|
3573 |
rememberIn:dirsConsulted |
283e7eb8c359
remember where we have been when searching for abbrev.stc-files.
Claus Gittinger <cg@exept.de>
parents:
5109
diff
changeset
|
3574 |
maxLevels:maxLevels-1 |
6188 | 3575 |
noAutoload:noAutoloadHere |
5117 | 3576 |
packageTop:packageTopPath. |
5110
283e7eb8c359
remember where we have been when searching for abbrev.stc-files.
Claus Gittinger <cg@exept.de>
parents:
5109
diff
changeset
|
3577 |
] |
5067
335c866e150c
walk packagePath when reading abbrevs & autoloaded classes.
Claus Gittinger <cg@exept.de>
parents:
5065
diff
changeset
|
3578 |
] |
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
3579 |
]. |
4458 | 3580 |
]. |
3581 |
||
5117 | 3582 |
" |
3583 |
Smalltalk installAutoloadedClasses |
|
3584 |
" |
|
4458 | 3585 |
! |
3586 |
||
6033
be1b7877b425
+ #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
6031
diff
changeset
|
3587 |
replaceReferencesTo:anObject with:newRef |
be1b7877b425
+ #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
6031
diff
changeset
|
3588 |
|toAdd| |
be1b7877b425
+ #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
6031
diff
changeset
|
3589 |
|
be1b7877b425
+ #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
6031
diff
changeset
|
3590 |
toAdd := OrderedCollection new. |
be1b7877b425
+ #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
6031
diff
changeset
|
3591 |
self keysAndValuesDo:[:key :val | |
be1b7877b425
+ #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
6031
diff
changeset
|
3592 |
(key == anObject) ifTrue:[ |
be1b7877b425
+ #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
6031
diff
changeset
|
3593 |
self halt:'not implemented'. |
be1b7877b425
+ #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
6031
diff
changeset
|
3594 |
]. |
be1b7877b425
+ #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
6031
diff
changeset
|
3595 |
(val == anObject ) ifTrue:[ |
be1b7877b425
+ #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
6031
diff
changeset
|
3596 |
toAdd add:(key -> newRef) |
be1b7877b425
+ #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
6031
diff
changeset
|
3597 |
]. |
be1b7877b425
+ #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
6031
diff
changeset
|
3598 |
]. |
be1b7877b425
+ #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
6031
diff
changeset
|
3599 |
toAdd do:[:each | |
be1b7877b425
+ #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
6031
diff
changeset
|
3600 |
self at:(each key) put:(each value) |
be1b7877b425
+ #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
6031
diff
changeset
|
3601 |
]. |
be1b7877b425
+ #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
6031
diff
changeset
|
3602 |
! |
be1b7877b425
+ #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
6031
diff
changeset
|
3603 |
|
3062
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3604 |
saveEmergencyImage:aBoolean |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3605 |
"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
|
3606 |
emergency image in case of a broken display connection. |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3607 |
The default is true. |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3608 |
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
|
3609 |
(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
|
3610 |
a crash. In multiheaded applications, this only affects |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3611 |
crashes of the master Display connection (the initial connection); |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3612 |
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
|
3613 |
like window destroy from the windowManager." |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3614 |
|
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3615 |
SaveEmergencyImage := aBoolean |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3616 |
|
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3617 |
"Modified: / 24.10.1997 / 18:22:26 / cg" |
3083 | 3618 |
! |
3619 |
||
3626
5a69787e857c
added hook make apps VW compatible w.r.t. system-organizaton.
Claus Gittinger <cg@exept.de>
parents:
3624
diff
changeset
|
3620 |
systemOrganization |
5a69787e857c
added hook make apps VW compatible w.r.t. system-organizaton.
Claus Gittinger <cg@exept.de>
parents:
3624
diff
changeset
|
3621 |
"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
|
3622 |
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
|
3623 |
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
|
3624 |
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
|
3625 |
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
|
3626 |
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
|
3627 |
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
|
3628 |
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
|
3629 |
|
5a69787e857c
added hook make apps VW compatible w.r.t. system-organizaton.
Claus Gittinger <cg@exept.de>
parents:
3624
diff
changeset
|
3630 |
^ SystemOrganizer for:nil |
5a69787e857c
added hook make apps VW compatible w.r.t. system-organizaton.
Claus Gittinger <cg@exept.de>
parents:
3624
diff
changeset
|
3631 |
|
5a69787e857c
added hook make apps VW compatible w.r.t. system-organizaton.
Claus Gittinger <cg@exept.de>
parents:
3624
diff
changeset
|
3632 |
"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
|
3633 |
"Modified: / 20.6.1998 / 12:41:34 / cg" |
5a69787e857c
added hook make apps VW compatible w.r.t. system-organizaton.
Claus Gittinger <cg@exept.de>
parents:
3624
diff
changeset
|
3634 |
! |
5a69787e857c
added hook make apps VW compatible w.r.t. system-organizaton.
Claus Gittinger <cg@exept.de>
parents:
3624
diff
changeset
|
3635 |
|
3083 | 3636 |
underclaredPrefix |
3637 |
"the prefix used for undeclared variables" |
|
3638 |
||
3639 |
^ 'Undeclared:::' |
|
3640 |
||
3641 |
"Created: / 31.10.1997 / 01:13:10 / cg" |
|
3044 | 3642 |
! ! |
3643 |
||
3644 |
!Smalltalk class methodsFor:'system management-fileIn'! |
|
3645 |
||
3646 |
fileIn:aFileName |
|
3647 |
"read in the named file - look for it in some standard places; |
|
4712 | 3648 |
return true if ok, false if failed. |
3649 |
This method can load almost anything which makes sense: |
|
5363 | 3650 |
.st - source files |
3651 |
.cls - binary smalltalk bytecode files |
|
3652 |
.so - binary compiled machine code class libraries |
|
3653 |
[.class - java bytecode -- soon to come]" |
|
3044 | 3654 |
|
3655 |
^ self fileIn:aFileName lazy:nil silent:nil logged:false |
|
3656 |
||
3657 |
" |
|
3658 |
Smalltalk fileIn:'source/TicTacToe.st' |
|
4712 | 3659 |
Smalltalk fileIn:'binary/TicTacToe.cls' |
3660 |
Smalltalk fileIn:'binary/TicTacToe.so' |
|
3044 | 3661 |
" |
3662 |
||
3663 |
"Created: 28.10.1995 / 17:06:28 / cg" |
|
3664 |
! |
|
3665 |
||
5687 | 3666 |
fileIn:aFileName inPackage:aPackageID |
3667 |
"read in the named file in a packages directory." |
|
3668 |
||
3669 |
|dir| |
|
3670 |
||
3671 |
dir := self getPackageDirectoryForPackage:aPackageID. |
|
6096 | 3672 |
dir isNil ifTrue:[^ false]. |
3673 |
||
3674 |
dir := dir asFilename. |
|
3675 |
^ (self fileIn:(dir construct:aFileName)) |
|
3676 |
or:[ self fileIn:((dir construct:'source') construct:aFileName) ] |
|
5687 | 3677 |
! |
3678 |
||
3044 | 3679 |
fileIn:aFileName lazy:lazy |
3680 |
"read in the named file - look for it in some standard places; |
|
3681 |
return true if ok, false if failed. |
|
3682 |
If lazy is true, no code is generated for methods, instead stubs |
|
3683 |
are created which compile themself when first executed. This allows |
|
3684 |
for much faster fileIn (but slows down the first execution later). |
|
3685 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
3686 |
code which is known to be syntactically correct." |
|
3687 |
||
3688 |
^ self fileIn:aFileName lazy:lazy silent:nil logged:false |
|
3689 |
||
3690 |
" |
|
3691 |
Smalltalk fileIn:'source/TicTacToe.st' lazy:true |
|
3692 |
" |
|
3693 |
||
3694 |
"Created: 28.10.1995 / 17:06:36 / cg" |
|
3695 |
! |
|
3696 |
||
3697 |
fileIn:aFileName lazy:lazy silent:silent |
|
3698 |
"read in the named file - look for it in some standard places; |
|
3699 |
return true if ok, false if failed. |
|
3700 |
If lazy is true, no code is generated for methods, instead stubs |
|
3701 |
are created which compile themself when first executed. This allows |
|
3702 |
for much faster fileIn (but slows down the first execution later). |
|
3703 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
3704 |
code which is known to be syntactically correct. |
|
3705 |
If silent is true, no compiler messages are output to the transcript. |
|
3706 |
Giving nil for silent/lazy will use the current settings." |
|
3707 |
||
3708 |
^ self fileIn:aFileName lazy:lazy silent:silent logged:false |
|
3709 |
||
3710 |
"Created: 28.10.1995 / 17:06:41 / cg" |
|
3711 |
! |
|
3712 |
||
3713 |
fileIn:aFileNameOrString lazy:lazy silent:silent logged:logged |
|
3714 |
"read in the named file - look for it in some standard places; |
|
3715 |
return true if ok, false if failed. |
|
3716 |
If lazy is true, no code is generated for methods, instead stubs |
|
3717 |
are created which compile themself when first executed. This allows |
|
3718 |
for much faster fileIn (but slows down the first execution later). |
|
3719 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
3720 |
code which is known to be syntactically correct. |
|
3721 |
If silent is true, no compiler messages are output to the transcript. |
|
4712 | 3722 |
Giving nil for silent/lazy will use the current settings. |
3723 |
This method can load almost anything which makes sense: |
|
5841 | 3724 |
.st - source files |
3725 |
.cls - binary smalltalk bytecode files |
|
3726 |
.so - binary compiled machine code class libraries |
|
3727 |
[.class - java bytecode -- soon to come]" |
|
3044 | 3728 |
|
3729 |
|fileNameString aStream path morePath bos| |
|
3730 |
||
3731 |
fileNameString := aFileNameOrString asString. |
|
3732 |
||
3733 |
" |
|
3734 |
an object or shared object ? |
|
3735 |
" |
|
3736 |
(ObjectFileLoader notNil |
|
3737 |
and:[ObjectFileLoader hasValidBinaryExtension:fileNameString]) ifTrue:[ |
|
5841 | 3738 |
"/ LoadBinaries ifFalse:[^ false]. |
3739 |
path := self getBinaryFileName:fileNameString. |
|
3740 |
path isNil ifTrue:[ |
|
3741 |
path := self getSystemFileName:fileNameString. |
|
3742 |
]. |
|
3743 |
path isNil ifTrue:[^ false]. |
|
3744 |
^ (ObjectFileLoader loadObjectFile:path) notNil |
|
3044 | 3745 |
]. |
3746 |
||
3747 |
(fileNameString asFilename hasSuffix:'cls') ifTrue:[ |
|
5841 | 3748 |
BinaryObjectStorage notNil ifTrue:[ |
3749 |
aStream := self systemFileStreamFor:fileNameString. |
|
3952
05c36f8e87b4
fixed fileIn of byteCode (.cls) files
Claus Gittinger <cg@exept.de>
parents:
3915
diff
changeset
|
3750 |
"/ path := self getBinaryFileName:fileNameString. |
05c36f8e87b4
fixed fileIn of byteCode (.cls) files
Claus Gittinger <cg@exept.de>
parents:
3915
diff
changeset
|
3751 |
"/ path isNil ifTrue:[^ false]. |
05c36f8e87b4
fixed fileIn of byteCode (.cls) files
Claus Gittinger <cg@exept.de>
parents:
3915
diff
changeset
|
3752 |
"/ aStream := path asFilename readStream. |
5841 | 3753 |
aStream notNil ifTrue:[ |
3754 |
aStream binary. |
|
3755 |
bos := BinaryObjectStorage onOld:aStream. |
|
3756 |
bos next. |
|
3757 |
bos close. |
|
3758 |
^ true |
|
3759 |
]. |
|
3760 |
^ false |
|
3761 |
] |
|
3044 | 3762 |
]. |
3763 |
||
3764 |
(fileNameString startsWith:'source/') ifTrue:[ |
|
5841 | 3765 |
aStream := self sourceFileStreamFor:(fileNameString copyFrom:8) |
3044 | 3766 |
] ifFalse:[ |
5841 | 3767 |
(fileNameString startsWith:'fileIn/') ifTrue:[ |
3768 |
aStream := self fileInFileStreamFor:(fileNameString copyFrom:8) |
|
3769 |
] ifFalse:[ |
|
3770 |
aStream := self systemFileStreamFor:fileNameString. |
|
3771 |
aStream isNil ifTrue:[ |
|
3772 |
OperatingSystem isUNIXlike ifTrue:[ |
|
3773 |
(fileNameString startsWith:'/') ifFalse:[ |
|
3774 |
aStream := self systemFileStreamFor:('lib/' , fileNameString). |
|
3775 |
] |
|
3776 |
] |
|
3777 |
]. |
|
3778 |
(aStream notNil and:[fileNameString includes:$/]) ifTrue:[ |
|
3779 |
"/ temporarily prepend the files directory |
|
3780 |
"/ to the searchPath. |
|
3781 |
"/ This allows fileIn-driver files to refer to local |
|
3782 |
"/ files via a relative path, and drivers to fileIn other |
|
3783 |
"/ drivers ... |
|
3784 |
morePath := aStream pathName asFilename directoryName. |
|
3785 |
] |
|
3786 |
] |
|
3044 | 3787 |
]. |
3788 |
aStream isNil ifTrue:[^ false]. |
|
3789 |
^ self fileInStream:aStream lazy:lazy silent:silent logged:logged addPath:morePath |
|
3790 |
||
3791 |
" |
|
3792 |
Smalltalk fileIn:'source/TicTacToe.st' lazy:true silent:true |
|
3793 |
" |
|
3794 |
||
3952
05c36f8e87b4
fixed fileIn of byteCode (.cls) files
Claus Gittinger <cg@exept.de>
parents:
3915
diff
changeset
|
3795 |
"Modified: / 16.2.1999 / 10:03:26 / cg" |
3044 | 3796 |
! |
3797 |
||
3798 |
fileIn:aFileName logged:logged |
|
3799 |
"read in the named file - look for it in some standard places; |
|
3800 |
return true if ok, false if failed. |
|
3801 |
The argument logged controls, if the changefile is to be updated." |
|
3802 |
||
3803 |
^ self fileIn:aFileName lazy:nil silent:nil logged:logged |
|
3804 |
||
3805 |
" |
|
3806 |
Smalltalk fileIn:'source/TicTacToe.st' logged:false |
|
3807 |
" |
|
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
3808 |
! |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
3809 |
|
1 | 3810 |
fileInChanges |
3811 |
"read in the last changes file - bringing the system to the state it |
|
70 | 3812 |
had when left the last time. |
3813 |
WARNING: this method is rubbish: it should only read things after the |
|
5363 | 3814 |
last '**snapshot**' - entry |
3815 |
(instead of the complete changes file)." |
|
1 | 3816 |
|
70 | 3817 |
" |
400 | 3818 |
do NOT update the changes file now ... |
70 | 3819 |
" |
2928 | 3820 |
self fileIn:ChangeFileName logged:false |
1 | 3821 |
|
77 | 3822 |
" |
3823 |
Smalltalk fileInChanges |
|
3824 |
" |
|
1 | 3825 |
! |
3826 |
||
3044 | 3827 |
fileInClass:aClassName |
3828 |
"find a source/object file for aClassName and -if found - load it. |
|
3829 |
search is in some standard places trying driver-file (.ld), object-file (.o) and |
|
3830 |
finally source file (.st) in that order. |
|
3831 |
The file is first searched for using the class name, then the abbreviated name." |
|
3832 |
||
3155
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
3833 |
^ self |
5363 | 3834 |
fileInClass:aClassName |
3835 |
package:nil |
|
3836 |
initialize:true |
|
3837 |
lazy:false |
|
3838 |
silent:nil |
|
3155
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
3839 |
|
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
3840 |
"Modified: / 9.1.1998 / 14:41:46 / cg" |
3044 | 3841 |
! |
3842 |
||
3843 |
fileInClass:aClassName fromObject:aFileName |
|
3844 |
"read in the named object file and dynamic-link it into the system |
|
3845 |
- look for it in some standard places. |
|
3846 |
Only install the named class from this object file. |
|
3847 |
Return true if ok, false if failed." |
|
3848 |
||
3849 |
|path ok| |
|
3850 |
||
3851 |
" |
|
3852 |
check if the dynamic loader class is in |
|
3853 |
" |
|
3854 |
(LoadBinaries not or:[ObjectFileLoader isNil]) ifTrue:[^ false]. |
|
3855 |
||
3856 |
(path := self getBinaryFileName:aFileName) isNil ifTrue:[^ false]. |
|
3857 |
ok := (ObjectFileLoader loadClass:aClassName fromObjectFile:path) notNil. |
|
3858 |
ok ifTrue:[ |
|
5363 | 3859 |
SilentLoading ifFalse:[ |
3860 |
Transcript show:' loaded ' , aClassName , ' from ' ; showCR:aFileName. |
|
3861 |
] |
|
3044 | 3862 |
]. |
3863 |
^ ok |
|
3864 |
||
3865 |
" |
|
3866 |
Smalltalk fileInClass:'AbstractPath' fromObject:'../../goodies/Paths/AbstrPath.so' |
|
3867 |
Smalltalk fileInClass:'ClockView' fromObject:'../../libwidg3/libwidg3.so' |
|
3868 |
" |
|
3869 |
||
3870 |
"Modified: 10.9.1996 / 20:43:52 / cg" |
|
3871 |
! |
|
3872 |
||
3873 |
fileInClass:aClassName initialize:doInit |
|
3874 |
"find a source/object file for aClassName and -if found - load it. |
|
3875 |
search is in some standard places trying driver-file (.ld), object-file (.o) and |
|
3876 |
finally source file (.st) in that order. |
|
3877 |
The file is first searched for using the class name, then the abbreviated name." |
|
3878 |
||
3155
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
3879 |
^ self |
5363 | 3880 |
fileInClass:aClassName |
3881 |
package:nil |
|
3882 |
initialize:doInit |
|
3883 |
lazy:false |
|
3884 |
silent:nil |
|
3155
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
3885 |
|
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
3886 |
"Modified: / 9.1.1998 / 14:42:02 / cg" |
3044 | 3887 |
! |
3888 |
||
3889 |
fileInClass:aClassName initialize:doInit lazy:loadLazy |
|
3890 |
"find a source/object file for aClassName and -if found - load it. |
|
3891 |
search is in some standard places trying driver-file (.ld), object-file (.o) and |
|
3892 |
finally source file (.st) in that order. |
|
3893 |
The file is first searched for using the class name, then the abbreviated name." |
|
3894 |
||
3155
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
3895 |
^ self |
5363 | 3896 |
fileInClass:aClassName |
3897 |
package:nil |
|
3898 |
initialize:doInit |
|
3899 |
lazy:loadLazy |
|
3900 |
silent:nil |
|
3155
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
3901 |
|
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
3902 |
"Modified: / 9.1.1998 / 14:42:19 / cg" |
3044 | 3903 |
! |
3904 |
||
3905 |
fileInClass:aClassName initialize:doInit lazy:loadLazy silent:beSilent |
|
3906 |
"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
|
3907 |
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
|
3908 |
finally source file (.st), in that order. |
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
3909 |
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
|
3910 |
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
|
3911 |
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
|
3912 |
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
|
3913 |
nil uses the value from SilentLoading." |
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
3914 |
|
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
3915 |
^ self |
5363 | 3916 |
fileInClass:aClassName |
3917 |
package:nil |
|
3918 |
initialize:doInit |
|
3919 |
lazy:loadLazy |
|
3920 |
silent:beSilent |
|
3155
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
3921 |
|
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
3922 |
"Modified: / 9.1.1998 / 14:42:28 / cg" |
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
3923 |
! |
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
3924 |
|
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
3925 |
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
|
3926 |
"find a source/object file for aClassName and -if found - load it. |
3044 | 3927 |
This is the workhorse for autoloading. |
3928 |
Search is in some standard places, trying driver-file (.ld), object-file (.so / .o) and |
|
3929 |
finally source file (.st), in that order. |
|
3930 |
The file is first searched for using the class name, then the abbreviated name. |
|
3931 |
The argument doInit controlls if the class should be sent a #initialize after the |
|
3932 |
load; loadLazy tells if it should be loaded lazyly. beSilent tells if the compiler |
|
3933 |
should not send notes to the transcript; it can be true, false or nil, where |
|
3934 |
nil uses the value from SilentLoading." |
|
3935 |
||
4277
74196836e8df
oops - care for module-prefix when filing in
Claus Gittinger <cg@exept.de>
parents:
4150
diff
changeset
|
3936 |
|shortName longName libName newClass ok wasLazy wasSilent sharedLibExtension inStream mgr fn |
6421
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3937 |
packageDir packageFile bos| |
3044 | 3938 |
|
3939 |
wasLazy := Compiler compileLazy:loadLazy. |
|
3940 |
beSilent notNil ifTrue:[ |
|
6421
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3941 |
wasSilent := self silentLoading:beSilent. |
617 | 3942 |
]. |
3044 | 3943 |
|
4026
96712578b0da
care for namespace/prefix in className when filing in.
Claus Gittinger <cg@exept.de>
parents:
4006
diff
changeset
|
3944 |
longName := aClassName copyReplaceAll:$: with:$_. |
96712578b0da
care for namespace/prefix in className when filing in.
Claus Gittinger <cg@exept.de>
parents:
4006
diff
changeset
|
3945 |
|
3044 | 3946 |
[ |
6421
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3947 |
Class withoutUpdatingChangesDo: |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3948 |
[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3949 |
|zarFn zar entry| |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3950 |
|
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3951 |
ok := false. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3952 |
|
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3953 |
shortName := self fileNameForClass:aClassName. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3954 |
package notNil ifTrue:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3955 |
packageDir := package asString. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3956 |
packageDir := packageDir copyReplaceAll:$: with:$/. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3957 |
]. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3958 |
|
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3959 |
Class packageQuerySignal answer:package |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3960 |
do:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3961 |
|
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3962 |
" |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3963 |
first, look for a loader-driver file (in fileIn/xxx.ld) |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3964 |
" |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3965 |
(ok := self fileIn:('fileIn/' , shortName , '.ld') lazy:loadLazy silent:beSilent) |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3966 |
ifFalse:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3967 |
" |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3968 |
try abbreviated driver-file (in fileIn/xxx.ld) |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3969 |
" |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3970 |
shortName ~= aClassName ifTrue:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3971 |
ok := self fileIn:('fileIn/' , longName , '.ld') lazy:loadLazy silent:beSilent |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3972 |
]. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3973 |
ok ifFalse:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3974 |
" |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3975 |
then, if dynamic linking is available, |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3976 |
" |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3977 |
(LoadBinaries and:[ObjectFileLoader notNil]) ifTrue:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3978 |
sharedLibExtension := ObjectFileLoader sharedLibraryExtension. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3979 |
|
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3980 |
" |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3981 |
first look for a class packages shared binary in binary/xxx.o |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3982 |
" |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3983 |
libName := self libraryFileNameOfClass:aClassName. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3984 |
libName notNil ifTrue:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3985 |
(ok := self fileInClass:aClassName fromObject:(libName, sharedLibExtension)) |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3986 |
ifFalse:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3987 |
sharedLibExtension ~= '.o' ifTrue:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3988 |
ok := self fileInClass:aClassName fromObject:(libName, '.o') |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3989 |
] |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3990 |
]. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3991 |
]. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3992 |
|
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3993 |
" |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3994 |
then, look for a shared binary in binary/xxx.o |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3995 |
" |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3996 |
ok ifFalse:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3997 |
(ok := self fileInClass:aClassName fromObject:(shortName, sharedLibExtension)) |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3998 |
ifFalse:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
3999 |
sharedLibExtension ~= '.o' ifTrue:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4000 |
ok := self fileInClass:aClassName fromObject:(shortName, '.o') |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4001 |
]. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4002 |
ok ifFalse:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4003 |
shortName ~= aClassName ifTrue:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4004 |
(ok := self fileInClass:aClassName fromObject:(longName, sharedLibExtension)) |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4005 |
ifFalse:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4006 |
sharedLibExtension ~= '.o' ifTrue:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4007 |
ok := self fileInClass:aClassName fromObject:(longName, '.o') |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4008 |
] |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4009 |
] |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4010 |
]. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4011 |
]. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4012 |
]. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4013 |
]. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4014 |
]. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4015 |
|
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4016 |
" |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4017 |
if that did not work, look for a compiled-bytecode file ... |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4018 |
" |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4019 |
ok ifFalse:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4020 |
(ok := self fileIn:(shortName , '.cls') lazy:loadLazy silent:beSilent) |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4021 |
ifFalse:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4022 |
shortName ~= aClassName ifTrue:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4023 |
ok := self fileIn:(longName , '.cls') lazy:loadLazy silent:beSilent |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4024 |
] |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4025 |
] |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4026 |
]. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4027 |
" |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4028 |
if that did not work, and the classes package is known, |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4029 |
look for an st-cls file |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4030 |
in a package subdir of the source-directory ... |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4031 |
" |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4032 |
ok ifFalse:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4033 |
(packageDir notNil and:[BinaryObjectStorage notNil]) ifTrue:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4034 |
packageFile := self getPackageFileName:(packageDir , '/classes/' , shortName , '.cls'). |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4035 |
packageFile isNil ifTrue:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4036 |
packageFile := (packageDir , '/classes/' , shortName , '.cls'). |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4037 |
]. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4038 |
(ok := self fileIn:packageFile lazy:loadLazy silent:beSilent) |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4039 |
ifFalse:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4040 |
shortName ~= aClassName ifTrue:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4041 |
packageFile := self getPackageFileName:(packageDir , '/classes/' , longName , '.cls'). |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4042 |
packageFile isNil ifTrue:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4043 |
packageFile := (packageDir , '/classes/' , longName , '.cls'). |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4044 |
]. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4045 |
ok := self fileIn:packageFile lazy:loadLazy silent:beSilent |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4046 |
] |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4047 |
]. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4048 |
|
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4049 |
zarFn := self getPackageFileName:(packageDir , '/classes.zip'). |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4050 |
zarFn notNil ifTrue:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4051 |
zar := ZipArchive oldFileNamed:zarFn. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4052 |
zar notNil ifTrue:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4053 |
entry := zar extract:(shortName , '.cls'). |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4054 |
(entry isNil and:[shortName ~= longName]) ifTrue:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4055 |
entry := zar extract:(longName , '.cls'). |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4056 |
]. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4057 |
entry notNil ifTrue:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4058 |
bos := BinaryObjectStorage onOld:(entry asByteArray readStream). |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4059 |
bos next. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4060 |
bos close. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4061 |
ok := true |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4062 |
]. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4063 |
] |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4064 |
] |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4065 |
] |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4066 |
]. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4067 |
|
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4068 |
" |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4069 |
if that did not work, look for an st-source file ... |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4070 |
" |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4071 |
ok ifFalse:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4072 |
fn := shortName , '.st'. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4073 |
(ok := self fileIn:fn lazy:loadLazy silent:beSilent) |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4074 |
ifFalse:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4075 |
shortName ~= longName ifTrue:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4076 |
fn := longName , '.st'. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4077 |
ok := self fileIn:fn lazy:loadLazy silent:beSilent |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4078 |
]. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4079 |
ok ifFalse:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4080 |
" |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4081 |
... and in the standard source-directory |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4082 |
" |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4083 |
fn := 'source/' , shortName , '.st'. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4084 |
(ok := self fileIn:fn lazy:loadLazy silent:beSilent) |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4085 |
ifFalse:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4086 |
shortName ~= longName ifTrue:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4087 |
fn := 'source/' , longName , '.st'. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4088 |
ok := self fileIn:fn lazy:loadLazy silent:beSilent |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4089 |
] |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4090 |
] |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4091 |
] |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4092 |
]. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4093 |
" |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4094 |
if that did not work, and the classes package is known, |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4095 |
look for an st-source file |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4096 |
in a package subdir of the source-directory ... |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4097 |
" |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4098 |
ok ifFalse:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4099 |
packageDir notNil ifTrue:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4100 |
packageFile := self getPackageFileName:(packageDir , '/source/' , shortName , '.st'). |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4101 |
packageFile isNil ifTrue:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4102 |
packageFile := (packageDir , '/source/' , shortName , '.st'). |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4103 |
]. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4104 |
(ok := self fileIn:packageFile lazy:loadLazy silent:beSilent) |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4105 |
ifFalse:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4106 |
shortName ~= aClassName ifTrue:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4107 |
packageFile := self getPackageFileName:(packageDir , '/source/' , longName , '.st'). |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4108 |
packageFile isNil ifTrue:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4109 |
packageFile := (packageDir , '/source/' , longName , '.st'). |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4110 |
]. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4111 |
ok := self fileIn:packageFile lazy:loadLazy silent:beSilent |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4112 |
]. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4113 |
ok ifFalse:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4114 |
|
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4115 |
packageFile := self getPackageFileName:(packageDir , '/' , shortName , '.st'). |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4116 |
packageFile isNil ifTrue:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4117 |
packageFile := (packageDir , '/' , shortName , '.st'). |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4118 |
]. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4119 |
(ok := self fileIn:packageFile lazy:loadLazy silent:beSilent) |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4120 |
ifFalse:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4121 |
shortName ~= aClassName ifTrue:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4122 |
packageFile := self getPackageFileName:(packageDir , '/' , longName , '.st'). |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4123 |
packageFile isNil ifTrue:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4124 |
packageFile := (packageDir , '/' , longName , '.st'). |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4125 |
]. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4126 |
ok := self fileIn:packageFile lazy:loadLazy silent:beSilent |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4127 |
]. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4128 |
ok ifFalse:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4129 |
" |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4130 |
... and in the standard source-directory |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4131 |
" |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4132 |
fn := 'source/' , packageDir , '/' , shortName , '.st'. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4133 |
(ok := self fileIn:fn lazy:loadLazy silent:beSilent) |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4134 |
ifFalse:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4135 |
shortName ~= aClassName ifTrue:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4136 |
fn := 'source/' , packageDir , '/' , longName , '.st'. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4137 |
ok := self fileIn:fn lazy:loadLazy silent:beSilent |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4138 |
] |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4139 |
] |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4140 |
] |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4141 |
]. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4142 |
]. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4143 |
]. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4144 |
] |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4145 |
]. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4146 |
" |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4147 |
if that did not work, and the classes package is known, |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4148 |
look for a zipArchive containing a class entry. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4149 |
" |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4150 |
ok ifFalse:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4151 |
packageDir notNil ifTrue:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4152 |
zarFn := self getPackageFileName:(packageDir , '/source.zip'). |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4153 |
zarFn isNil ifTrue:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4154 |
zarFn := packageDir asFilename withSuffix:'zip'. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4155 |
zarFn := self getSourceFileName:zarFn. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4156 |
]. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4157 |
zarFn notNil ifTrue:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4158 |
zar := ZipArchive oldFileNamed:zarFn. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4159 |
zar notNil ifTrue:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4160 |
entry := zar extract:(shortName , '.st'). |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4161 |
(entry isNil and:[shortName ~= longName]) ifTrue:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4162 |
entry := zar extract:(longName , '.st'). |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4163 |
]. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4164 |
entry notNil ifTrue:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4165 |
ok := self |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4166 |
fileInStream:(entry asString readStream) |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4167 |
lazy:loadLazy |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4168 |
silent:beSilent |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4169 |
logged:false |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4170 |
addPath:nil |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4171 |
]. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4172 |
] |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4173 |
] |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4174 |
] |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4175 |
]. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4176 |
|
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4177 |
" |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4178 |
if that did not work, |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4179 |
look for a zipArchive containing a class entry. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4180 |
" |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4181 |
ok ifFalse:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4182 |
zarFn := self getSourceFileName:'source.zip'. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4183 |
zarFn notNil ifTrue:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4184 |
zar := ZipArchive oldFileNamed:zarFn. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4185 |
zar notNil ifTrue:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4186 |
entry := zar extract:(shortName , '.st'). |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4187 |
(entry isNil and:[shortName ~= longName]) ifTrue:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4188 |
entry := zar extract:(longName , '.st'). |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4189 |
]. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4190 |
entry notNil ifTrue:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4191 |
ok := self |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4192 |
fileInStream:(entry asString readStream) |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4193 |
lazy:loadLazy |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4194 |
silent:beSilent |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4195 |
logged:false |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4196 |
addPath:nil |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4197 |
]. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4198 |
] |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4199 |
] |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4200 |
]. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4201 |
ok ifFalse:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4202 |
" |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4203 |
new: if there is a sourceCodeManager, ask it for the classes sourceCode |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4204 |
" |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4205 |
(mgr := Smalltalk at:#SourceCodeManager) notNil ifTrue:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4206 |
inStream := mgr getMostRecentSourceStreamForClassNamed:aClassName. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4207 |
inStream notNil ifTrue:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4208 |
fn := nil. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4209 |
ok := self fileInStream:inStream lazy:loadLazy silent:beSilent logged:false addPath:nil. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4210 |
] |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4211 |
]. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4212 |
]. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4213 |
]. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4214 |
]. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4215 |
] |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4216 |
] |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4217 |
]. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4218 |
|
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4219 |
ok ifTrue:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4220 |
newClass := self at:(aClassName asSymbol). |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4221 |
newClass notNil ifTrue:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4222 |
fn notNil ifTrue:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4223 |
newClass classFilename isNil ifTrue:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4224 |
newClass setClassFilename:fn |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4225 |
]. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4226 |
]. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4227 |
|
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4228 |
doInit ifTrue:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4229 |
newClass initialize |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4230 |
] |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4231 |
] |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4232 |
]. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4233 |
] ensure:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4234 |
Compiler compileLazy:wasLazy. |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4235 |
wasSilent notNil ifTrue:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4236 |
self silentLoading:wasSilent |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4237 |
] |
3044 | 4238 |
]. |
4239 |
||
4240 |
^ newClass |
|
4241 |
||
3155
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
4242 |
"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
|
4243 |
"Modified: / 5.6.1999 / 14:53:01 / cg" |
3044 | 4244 |
! |
4245 |
||
4246 |
fileInClassLibrary:aClassLibraryName |
|
4247 |
"find an object file containing a binary class library in some standard places |
|
4248 |
and load it. This install all of its contained classes. |
|
4712 | 4249 |
Return true if ok, false if not. |
4250 |
Notice: the argument may not have an extension (by purpose); |
|
5363 | 4251 |
the sharedLib extension (.dll / .so / .sl) is added here, to |
4252 |
make the caller independent of the underlying operatingSystem." |
|
4712 | 4253 |
|
4254 |
|path fn| |
|
3044 | 4255 |
|
4256 |
ObjectFileLoader isNil ifTrue:[^ false]. |
|
4712 | 4257 |
|
4258 |
fn := aClassLibraryName , (ObjectFileLoader sharedLibraryExtension). |
|
4259 |
||
4260 |
path := self getBinaryFileName:fn. |
|
4261 |
path isNil ifTrue:[ |
|
5363 | 4262 |
path := self getSystemFileName:fn. |
4712 | 4263 |
]. |
4264 |
path isNil ifTrue:[^ false]. |
|
4265 |
||
4714 | 4266 |
^ (ObjectFileLoader loadObjectFile:path) notNil |
3044 | 4267 |
|
4268 |
" |
|
4269 |
Smalltalk fileInClassLibrary:'libtable' |
|
4270 |
Smalltalk fileInClassLibrary:'binary/libwidg3' |
|
4271 |
" |
|
4272 |
||
4273 |
"Modified: 8.1.1997 / 17:58:56 / cg" |
|
617 | 4274 |
! |
4275 |
||
6025 | 4276 |
fileInClassLibrary:aClassLibraryName inPackage:packageID |
4277 |
"find an object file containing a binary class library in some standard places |
|
4278 |
and load it. This install all of its contained classes. |
|
4279 |
Return true if ok, false if not. |
|
4280 |
Notice: the argument may not have an extension (by purpose); |
|
4281 |
the sharedLib extension (.dll / .so / .sl) is added here, to |
|
4282 |
make the caller independent of the underlying operatingSystem." |
|
4283 |
||
4284 |
|path fn| |
|
4285 |
||
4286 |
ObjectFileLoader isNil ifTrue:[^ false]. |
|
4287 |
||
4288 |
fn := aClassLibraryName , (ObjectFileLoader sharedLibraryExtension). |
|
4289 |
||
4290 |
path := self getPackageDirectoryForPackage:packageID. |
|
4291 |
path isNil ifTrue:[^ false]. |
|
4292 |
path := path asFilename construct:fn. |
|
4293 |
path exists ifFalse:[^ false]. |
|
4294 |
||
4295 |
^ (ObjectFileLoader loadObjectFile:path pathName) notNil |
|
4296 |
||
4297 |
" |
|
4298 |
Smalltalk fileInClassLibrary:'libtable' |
|
4299 |
Smalltalk fileInClassLibrary:'binary/libwidg3' |
|
4300 |
Smalltalk fileInClassLibrary:'refactoryBrowser' inPackage:'stx:goodies/refactoryBrowser' |
|
4301 |
" |
|
4302 |
||
4303 |
"Modified: 8.1.1997 / 17:58:56 / cg" |
|
4304 |
! |
|
4305 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
4306 |
fileInStream:aStream lazy:lazy silent:silent logged:logged addPath:morePath |
617 | 4307 |
"read sourceCode from aStream; |
4308 |
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
|
4309 |
If lazy is true, no code is generated for methods, instead stubs |
617 | 4310 |
are created which compile themself when first executed. This allows |
4311 |
for much faster fileIn (but slows down the first execution later). |
|
4312 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
4313 |
code which is known to be syntactically correct. |
|
4314 |
If silent is true, no compiler messages are output to the transcript. |
|
4315 |
Giving nil for silent/lazy will use the current settings. |
|
4316 |
If morePath is nonNil, it is prepended to the systemPath temporarily during the |
|
4317 |
fileIn. This allows for st-expressions to refer to more files (i.e. fileIn more) |
|
4318 |
using a relative path." |
|
4319 |
||
4320 |
|wasLazy wasSilent oldSystemPath oldRealPath| |
|
4321 |
||
4322 |
aStream isNil ifTrue:[^ false]. |
|
4323 |
||
4324 |
lazy notNil ifTrue:[wasLazy := Compiler compileLazy:lazy]. |
|
4325 |
silent notNil ifTrue:[wasSilent := self silentLoading:silent]. |
|
4326 |
[ |
|
6098 | 4327 |
Class updateChangeFileQuerySignal answer:logged do:[ |
4328 |
Class updateChangeListQuerySignal answer:logged do:[ |
|
4329 |
oldSystemPath := SystemPath copy. |
|
4330 |
morePath notNil ifTrue:[ |
|
4331 |
SystemPath addFirst:morePath. |
|
4332 |
oldRealPath := RealSystemPath. |
|
4333 |
RealSystemPath := nil. |
|
4334 |
]. |
|
4335 |
aStream fileIn |
|
4336 |
] |
|
4337 |
] |
|
6421
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4338 |
] ensure:[ |
6098 | 4339 |
morePath notNil ifTrue:[ |
4340 |
SystemPath := oldSystemPath. |
|
4341 |
RealSystemPath := oldRealPath. |
|
4342 |
]. |
|
4343 |
lazy notNil ifTrue:[Compiler compileLazy:wasLazy]. |
|
4344 |
silent notNil ifTrue:[self silentLoading:wasSilent]. |
|
4345 |
aStream close |
|
617 | 4346 |
]. |
4347 |
^ true |
|
4348 |
||
4349 |
" |
|
4350 |
Smalltalk fileInStream:('source/TicTacToe.st' asFilename readStream) lazy:true silent:true |
|
4351 |
" |
|
1896 | 4352 |
|
4353 |
"Modified: 5.11.1996 / 20:03:35 / cg" |
|
617 | 4354 |
! |
4355 |
||
5881
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4356 |
isClassLibraryLoaded:name |
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4357 |
"return true, if a particular class library is already loaded" |
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4358 |
|
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4359 |
ObjectMemory |
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4360 |
binaryModuleInfo |
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4361 |
do:[:entry | |
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4362 |
entry type == #classLibrary ifTrue:[ |
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4363 |
entry libraryName = name ifTrue:[ |
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4364 |
^ true "/ already loaded |
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4365 |
] |
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4366 |
]. |
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4367 |
]. |
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4368 |
|
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4369 |
^ false |
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4370 |
|
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4371 |
" |
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4372 |
Smalltalk isClassLibraryLoaded:'libbasic' |
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4373 |
Smalltalk isClassLibraryLoaded:'libwidg3' |
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4374 |
" |
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4375 |
! |
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4376 |
|
3044 | 4377 |
loadClassLibraryIfAbsent:name |
4378 |
"dynamically load a classLibrary, if not already loaded |
|
4379 |
and the system supports dynamic loading. |
|
4380 |
Return true, if the library is loaded, false if not. |
|
4381 |
This entry is called without system specific filename |
|
4382 |
extensions - it is portable among different architectures |
|
4383 |
as long as corresponding files (x.so / x.dll / x.sl / x.o) |
|
4384 |
are be present ..." |
|
4385 |
||
5881
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4386 |
(self isClassLibraryLoaded:name) ifTrue:[ ^ true ]. "/ already loaded |
3044 | 4387 |
^ self fileInClassLibrary:name |
4388 |
||
4389 |
" |
|
4390 |
Smalltalk loadClassLibraryIfAbsent:'libbasic' |
|
4391 |
Smalltalk loadClassLibraryIfAbsent:'libwidg3' |
|
4392 |
" |
|
4393 |
||
4394 |
"Modified: 31.10.1996 / 16:57:24 / cg" |
|
4395 |
! |
|
4396 |
||
4397 |
secureFileIn:aFileName |
|
4398 |
"read in the named file, looking for it at standard places. |
|
4399 |
Catch any error during fileIn. Return true if ok, false if failed" |
|
4400 |
||
4401 |
|retVal| |
|
4402 |
||
4403 |
retVal := false. |
|
4404 |
||
4405 |
(SignalSet with:AbortSignal with:Process terminateSignal) |
|
5363 | 4406 |
handle:[:ex | |
4407 |
ex return |
|
4408 |
] do:[ |
|
4409 |
retVal := self fileIn:aFileName |
|
4410 |
]. |
|
3044 | 4411 |
^ retVal |
4412 |
! |
|
4413 |
||
4414 |
silentFileIn:aFilename |
|
4415 |
"same as fileIn:, but do not output 'compiled...'-messages on Transcript. |
|
4416 |
Main use is during startup." |
|
4417 |
||
4418 |
|wasSilent| |
|
4419 |
||
4420 |
wasSilent := self silentLoading:true. |
|
4421 |
[ |
|
6421
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4422 |
self fileIn:aFilename |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4423 |
] ensure:[ |
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4424 |
self silentLoading:wasSilent |
3044 | 4425 |
] |
4426 |
! ! |
|
4427 |
||
4428 |
!Smalltalk class methodsFor:'system management-files'! |
|
4429 |
||
4430 |
bitmapFileStreamFor:aFileName |
|
4431 |
"search aFileName in some standard places; |
|
4432 |
return a readonly fileStream or nil if not found. |
|
5089 | 4433 |
Searches in subdirectories named 'bitmaps' in the SystemPath. |
4434 |
Notice: this does not look in the package-specific bitmaps directories." |
|
3044 | 4435 |
|
4436 |
|aString| |
|
4437 |
||
4438 |
aString := self getBitmapFileName:aFileName. |
|
4439 |
aString notNil ifTrue:[ |
|
5363 | 4440 |
^ aString asFilename readStream |
3044 | 4441 |
]. |
4442 |
^ nil |
|
4443 |
! |
|
4444 |
||
5040 | 4445 |
bitmapFromFileNamed:aFileName forClass:aClass |
4446 |
"search aFileName in some standard places: |
|
5089 | 4447 |
first in the redefinable bitmaps path, |
4448 |
then in the classes own package directory if existing. |
|
5040 | 4449 |
Return an image or nil." |
4450 |
||
5089 | 4451 |
^ self imageFromFileNamed:aFileName inPackage:(aClass package) |
5040 | 4452 |
|
4453 |
" |
|
4454 |
Smalltalk bitmapFromFileNamed:'SmalltalkX.xbm' forClass:View |
|
4455 |
" |
|
4456 |
! |
|
4457 |
||
4458 |
bitmapFromFileNamed:aFileName inPackage:aPackage |
|
4459 |
"search aFileName in some standard places: |
|
5089 | 4460 |
first in the redefinable bitmaps path, |
4461 |
then in the package directory if existing. |
|
5040 | 4462 |
Return an image or nil." |
4463 |
||
5089 | 4464 |
^ self imageFromFileNamed:aFileName inPackage:aPackage |
5040 | 4465 |
|
4466 |
" |
|
4467 |
Smalltalk bitmapFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libview' |
|
5041 | 4468 |
Smalltalk bitmapFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libtool' |
5040 | 4469 |
" |
4470 |
! |
|
4471 |
||
3044 | 4472 |
classNameForFile:aFileName |
4473 |
"return the className which corresponds to an abbreviated fileName, |
|
4474 |
or nil if no special translation applies. The given filename arg may |
|
4475 |
include a '.st' suffix (but no other)." |
|
4476 |
||
4477 |
|fn| |
|
4478 |
||
4479 |
(aFileName asFilename hasSuffix:'st') ifTrue:[ |
|
5363 | 4480 |
fn := aFileName copyWithoutLast:3 |
3044 | 4481 |
] ifFalse:[ |
5363 | 4482 |
fn := aFileName |
3044 | 4483 |
]. |
4484 |
^ self filenameAbbreviations keyAtEqualValue:fn ifAbsent:[fn]. |
|
4485 |
||
4486 |
" |
|
4487 |
Smalltalk classNameForFile:'DrawObj' |
|
4488 |
Smalltalk classNameForFile:'DrawObj.st' |
|
4489 |
Smalltalk classNameForFile:'ArrColl.st' |
|
4490 |
Smalltalk classNameForFile:'ArrColl.chg' |
|
4491 |
" |
|
4492 |
||
4493 |
"Modified: 11.12.1995 / 14:51:10 / cg" |
|
4494 |
! |
|
4495 |
||
4496 |
constructPathFor:aDirectoryName |
|
4497 |
"search for aDirectory in SystemPath; |
|
4498 |
return a collection of pathes which include that directory." |
|
4499 |
||
4500 |
^ self realSystemPath select:[:dirName | |
|
5363 | 4501 |
|fullPath| |
4502 |
||
4503 |
fullPath := dirName asFilename construct:aDirectoryName. |
|
4504 |
"/ fullPath exists and:[fullPath isDirectory and:[fullPath isReadable]] |
|
4505 |
fullPath isDirectory and:[fullPath isReadable] |
|
3044 | 4506 |
]. |
4507 |
! |
|
4508 |
||
4509 |
fileInFileStreamFor:aFileName |
|
4510 |
"search aFileName in some standard places; |
|
4511 |
return a readonly fileStream or nil if not found. |
|
4512 |
Searches in subdirectories named 'fileIn' in SystemPath" |
|
4513 |
||
4514 |
|aString| |
|
4515 |
||
4516 |
aString := self getFileInFileName:aFileName. |
|
4517 |
aString notNil ifTrue:[ |
|
5363 | 4518 |
^ aString asFilename readStream |
3044 | 4519 |
]. |
4520 |
^ nil |
|
4521 |
! |
|
4522 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
4523 |
fileNameForClass:aClassOrClassName |
617 | 4524 |
"return a good filename for aClassOrClassName - |
4525 |
using the abbreviation file if there is one" |
|
4526 |
||
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
4527 |
|fileName abbrev cls fullClassName shortClassName| |
617 | 4528 |
|
4529 |
aClassOrClassName isBehavior ifTrue:[ |
|
6151
e36a9b339582
isMeta/soleInstance -> theMetaclass / theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
6121
diff
changeset
|
4530 |
cls := aClassOrClassName theNonMetaclass. |
e36a9b339582
isMeta/soleInstance -> theMetaclass / theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
6121
diff
changeset
|
4531 |
fullClassName := cls name. |
e36a9b339582
isMeta/soleInstance -> theMetaclass / theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
6121
diff
changeset
|
4532 |
shortClassName := cls nameWithoutPrefix. |
617 | 4533 |
] ifFalse:[ |
6151
e36a9b339582
isMeta/soleInstance -> theMetaclass / theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
6121
diff
changeset
|
4534 |
fullClassName := shortClassName := aClassOrClassName. |
e36a9b339582
isMeta/soleInstance -> theMetaclass / theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
6121
diff
changeset
|
4535 |
shortClassName := shortClassName copyFrom:(shortClassName lastIndexOf:$:)+1. |
617 | 4536 |
]. |
4537 |
||
4748 | 4538 |
fileName := fullClassName asSymbol. |
617 | 4539 |
|
4540 |
"look for abbreviation" |
|
4541 |
||
4542 |
abbrev := self filenameAbbreviations at:fileName ifAbsent:[nil]. |
|
4543 |
abbrev notNil ifTrue:[^ abbrev]. |
|
4544 |
||
4545 |
"no abbreviation found - if its a short name, take it" |
|
4546 |
||
4547 |
OperatingSystem maxFileNameLength < (fileName size + 3) ifTrue:[ |
|
6151
e36a9b339582
isMeta/soleInstance -> theMetaclass / theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
6121
diff
changeset
|
4548 |
"this will only be triggered on sys5.3/DOS type systems" |
e36a9b339582
isMeta/soleInstance -> theMetaclass / theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
6121
diff
changeset
|
4549 |
('Smalltalk [info]: cant find short for ' , fileName , ' in abbreviation file') infoPrintCR. |
617 | 4550 |
]. |
4748 | 4551 |
|
4552 |
fileName := shortClassName asSymbol. |
|
4553 |
^ fileName asString |
|
617 | 4554 |
" |
4555 |
Smalltalk fileNameForClass:SmallInteger |
|
4556 |
Smalltalk fileNameForClass:'SmallInteger' |
|
3678 | 4557 |
Smalltalk fileNameForClass:'UnixOperatingSystem' |
4746 | 4558 |
Smalltalk fileNameForClass:'Launcher' |
617 | 4559 |
Smalltalk fileNameForClass:'SomeUnknownClass' |
4746 | 4560 |
Smalltalk fileNameForClass:OSI::FTAMOperation |
4561 |
Smalltalk fileNameForClass:'OSI::Foobar' |
|
617 | 4562 |
" |
4563 |
||
6151
e36a9b339582
isMeta/soleInstance -> theMetaclass / theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
6121
diff
changeset
|
4564 |
"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
|
4565 |
! |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
4566 |
|
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
4567 |
filenameAbbreviations |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
4568 |
"return a dictionary containing the classname-to-filename |
617 | 4569 |
mappings. (needed for sys5.3 users, where filenames are limited |
4570 |
to 14 chars)" |
|
4571 |
||
4572 |
CachedAbbreviations isNil ifTrue:[ |
|
5363 | 4573 |
self readAbbreviations |
617 | 4574 |
]. |
4575 |
^ CachedAbbreviations |
|
4576 |
||
4577 |
"flush with: |
|
4578 |
||
4579 |
CachedAbbreviations := nil |
|
4580 |
" |
|
4581 |
" |
|
4582 |
Smalltalk filenameAbbreviations |
|
4583 |
" |
|
4584 |
! |
|
4585 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
4586 |
flushPathCaches |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
4587 |
"{ Pragma: +optSpace }" |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
4588 |
|
2378 | 4589 |
"forget pathCaches - these are collections containing valid directory names, |
4590 |
where system files (resource, bitmaps etc.) are found. |
|
4591 |
A flush is only required, if a new system directory has been created while |
|
4592 |
the system is active, and those files should override the others |
|
4593 |
(for example, if you created a private resource directory)" |
|
4594 |
||
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
4595 |
RealSystemPath := ResourcePath := SourcePath := |
5052 | 4596 |
BitmapPath := BinaryPath := FileInPath := nil |
2378 | 4597 |
|
4598 |
" |
|
4599 |
Smalltalk flushPathCaches |
|
4600 |
" |
|
617 | 4601 |
! |
4602 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
4603 |
getBinaryFileName:aFileName |
617 | 4604 |
"search aFileName in some standard places |
4605 |
(subdirectories named 'binary' in SystemPath); |
|
4606 |
return the absolute filename or nil if none is found." |
|
4607 |
||
1562
850a88ecff97
searchPath: dont use it, if fileName starts with "./" or "../"
Claus Gittinger <cg@exept.de>
parents:
1553
diff
changeset
|
4608 |
BinaryPath isNil ifTrue:[ |
5363 | 4609 |
BinaryPath := self constructPathFor:BinaryDirName |
617 | 4610 |
]. |
4611 |
||
2928 | 4612 |
^ 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
|
4613 |
|
850a88ecff97
searchPath: dont use it, if fileName starts with "./" or "../"
Claus Gittinger <cg@exept.de>
parents:
1553
diff
changeset
|
4614 |
"Modified: 18.7.1996 / 15:53:49 / cg" |
453 | 4615 |
! |
4616 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
4617 |
getBitmapFileName:aFileName |
617 | 4618 |
"search aFileName in some standard places |
4619 |
(subdirectories named 'bitmaps' in SystemPath); |
|
4620 |
return the absolute filename or nil if none is found." |
|
4621 |
||
2974 | 4622 |
|f| |
4623 |
||
617 | 4624 |
BitmapPath isNil ifTrue:[ |
5363 | 4625 |
BitmapPath := self constructPathFor:BitmapDirName |
617 | 4626 |
]. |
4627 |
||
2974 | 4628 |
"/ first, try a bitmaps subdir along the path. |
4629 |
f := self searchPath:BitmapPath for:aFileName in:BitmapDirName. |
|
4630 |
f isNil ifTrue:[ |
|
5363 | 4631 |
"/ then, try it itself along the path. |
4632 |
f := self searchPath:self realSystemPath for:aFileName in:nil |
|
2974 | 4633 |
]. |
4634 |
^ f |
|
617 | 4635 |
|
4636 |
" |
|
4637 |
Smalltalk getBitmapFileName:'SBrowser.xbm' |
|
4638 |
" |
|
1562
850a88ecff97
searchPath: dont use it, if fileName starts with "./" or "../"
Claus Gittinger <cg@exept.de>
parents:
1553
diff
changeset
|
4639 |
|
850a88ecff97
searchPath: dont use it, if fileName starts with "./" or "../"
Claus Gittinger <cg@exept.de>
parents:
1553
diff
changeset
|
4640 |
"Modified: 18.7.1996 / 15:53:55 / cg" |
617 | 4641 |
! |
4642 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
4643 |
getFileInFileName:aFileName |
617 | 4644 |
"search aFileName in some standard places |
4645 |
(subdirectories named 'fileIn' in SystemPath); |
|
4646 |
return the absolute filename or nil if none is found." |
|
4647 |
||
1562
850a88ecff97
searchPath: dont use it, if fileName starts with "./" or "../"
Claus Gittinger <cg@exept.de>
parents:
1553
diff
changeset
|
4648 |
FileInPath isNil ifTrue:[ |
5363 | 4649 |
FileInPath := self constructPathFor:FileInDirName |
617 | 4650 |
]. |
4651 |
||
2928 | 4652 |
^ 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
|
4653 |
|
850a88ecff97
searchPath: dont use it, if fileName starts with "./" or "../"
Claus Gittinger <cg@exept.de>
parents:
1553
diff
changeset
|
4654 |
"Modified: 18.7.1996 / 15:53:59 / cg" |
617 | 4655 |
! |
4656 |
||
5550
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4657 |
getPackageDirectoryForPackage:aPackageID |
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4658 |
"search for a particular package; return its directory, or nil" |
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4659 |
|
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4660 |
|packageDir| |
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4661 |
|
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4662 |
packageDir := aPackageID copyReplaceAll:$: with:$/. |
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4663 |
self packagePath do:[:aPath | |
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4664 |
|dir| |
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4665 |
|
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4666 |
dir := aPath asFilename construct:packageDir. |
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4667 |
(dir exists and:[dir isDirectory]) ifTrue:[^ dir]. |
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4668 |
]. |
5785
872483483444
oops - getPackageDirectoryForPackage now cares for the case
Claus Gittinger <cg@exept.de>
parents:
5781
diff
changeset
|
4669 |
|
872483483444
oops - getPackageDirectoryForPackage now cares for the case
Claus Gittinger <cg@exept.de>
parents:
5781
diff
changeset
|
4670 |
"/ 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
|
4671 |
(aPackageID upTo:$:) = 'stx' ifTrue:[ |
872483483444
oops - getPackageDirectoryForPackage now cares for the case
Claus Gittinger <cg@exept.de>
parents:
5781
diff
changeset
|
4672 |
packageDir := aPackageID copyFrom:(aPackageID indexOf:$:) + 1. |
872483483444
oops - getPackageDirectoryForPackage now cares for the case
Claus Gittinger <cg@exept.de>
parents:
5781
diff
changeset
|
4673 |
packageDir := '../../' , packageDir. |
872483483444
oops - getPackageDirectoryForPackage now cares for the case
Claus Gittinger <cg@exept.de>
parents:
5781
diff
changeset
|
4674 |
packageDir := packageDir asFilename. |
872483483444
oops - getPackageDirectoryForPackage now cares for the case
Claus Gittinger <cg@exept.de>
parents:
5781
diff
changeset
|
4675 |
(packageDir exists and:[packageDir isDirectory]) ifTrue:[^ packageDir]. |
872483483444
oops - getPackageDirectoryForPackage now cares for the case
Claus Gittinger <cg@exept.de>
parents:
5781
diff
changeset
|
4676 |
]. |
5550
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4677 |
^ nil |
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4678 |
|
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4679 |
" |
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4680 |
Smalltalk getPackageDirectoryForPackage:(Array package) |
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4681 |
Smalltalk getPackageDirectoryForPackage:'stx:goodies/bitmaps' |
5785
872483483444
oops - getPackageDirectoryForPackage now cares for the case
Claus Gittinger <cg@exept.de>
parents:
5781
diff
changeset
|
4682 |
Smalltalk getPackageDirectoryForPackage:'stx:libview' |
5550
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4683 |
" |
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4684 |
! |
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4685 |
|
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
4686 |
getPackageFileName:aFileName |
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
4687 |
"search aFileName in some standard places |
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
4688 |
(packagePath and subdirectories named 'packages' in SystemPath); |
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
4689 |
return the absolute filename or nil if none is found." |
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
4690 |
|
5052 | 4691 |
|f| |
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
4692 |
|
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
4693 |
"/ search along packagePath ... |
5052 | 4694 |
f := self searchPath:self packagePath for:aFileName in:nil. |
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
4695 |
f isNil ifTrue:[ |
5786
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
4696 |
"/ search under packages-directory along systemPath ... |
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
4697 |
f := self searchPath:self realSystemPath for:aFileName in:PackageDirName. |
5787 | 4698 |
"/ kludge - allow for stx-directory to be named differently |
4699 |
f isNil ifTrue:[ |
|
4700 |
(aFileName startsWith:'stx') ifTrue:[ |
|
4701 |
(aFileName startsWith:'stx' , Filename separator) ifTrue:[ |
|
4702 |
f := '../..' asFilename construct:(aFileName copyFrom:5). |
|
4703 |
f exists ifTrue:[ |
|
4704 |
^ f pathName |
|
4705 |
]. |
|
4706 |
] |
|
4707 |
]. |
|
4708 |
]. |
|
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
4709 |
]. |
5878
b89d789e1705
always return a string from #getPackageFileName
Claus Gittinger <cg@exept.de>
parents:
5860
diff
changeset
|
4710 |
(f notNil and:[(f := f asFilename) exists]) ifTrue:[ |
b89d789e1705
always return a string from #getPackageFileName
Claus Gittinger <cg@exept.de>
parents:
5860
diff
changeset
|
4711 |
^ f pathName |
b89d789e1705
always return a string from #getPackageFileName
Claus Gittinger <cg@exept.de>
parents:
5860
diff
changeset
|
4712 |
]. |
b89d789e1705
always return a string from #getPackageFileName
Claus Gittinger <cg@exept.de>
parents:
5860
diff
changeset
|
4713 |
^ nil |
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
4714 |
|
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
4715 |
" |
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
4716 |
Smalltalk getPackageFileName:'stx/libview/resources/normal.style' |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
4717 |
Smalltalk getPackageFileName:'stx/libview/source.zip' |
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
4718 |
" |
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
4719 |
! |
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
4720 |
|
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
4721 |
getResourceFileName:aFileName |
617 | 4722 |
"search aFileName in some standard places |
4723 |
(subdirectories named 'resource' in SystemPath); |
|
4724 |
return the absolute filename or nil if none is found." |
|
4725 |
||
2974 | 4726 |
|f| |
4727 |
||
617 | 4728 |
ResourcePath isNil ifTrue:[ |
5363 | 4729 |
ResourcePath := self constructPathFor:ResourceDirName |
617 | 4730 |
]. |
4731 |
||
2974 | 4732 |
"/ first, try a resource subdir along the path. |
4733 |
f := self searchPath:ResourcePath for:aFileName in:ResourceDirName. |
|
4734 |
f isNil ifTrue:[ |
|
5363 | 4735 |
"/ then, try it itself along the path. |
4736 |
f := self searchPath:self realSystemPath for:aFileName in:nil |
|
2974 | 4737 |
]. |
4738 |
^ f |
|
617 | 4739 |
|
4740 |
" |
|
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
4741 |
Smalltalk getResourceFileName:'SystemBrowser.rs' |
617 | 4742 |
" |
1562
850a88ecff97
searchPath: dont use it, if fileName starts with "./" or "../"
Claus Gittinger <cg@exept.de>
parents:
1553
diff
changeset
|
4743 |
|
850a88ecff97
searchPath: dont use it, if fileName starts with "./" or "../"
Claus Gittinger <cg@exept.de>
parents:
1553
diff
changeset
|
4744 |
"Modified: 18.7.1996 / 15:54:03 / cg" |
617 | 4745 |
! |
4746 |
||
5053
0d8cc1eb0545
added #getResourceFileStream:forClass:
Claus Gittinger <cg@exept.de>
parents:
5052
diff
changeset
|
4747 |
getResourceFileName:aFileName forClass:aClassOrNil |
5043 | 4748 |
"search aFileName in some standard places |
4749 |
(subdirectories named 'resource' in SystemPath); |
|
4750 |
and in aClasses package directory. |
|
4751 |
Return the absolute filename or nil if none is found." |
|
4752 |
||
5065 | 4753 |
|pkgOrNil| |
4754 |
||
4755 |
aClassOrNil notNil ifTrue:[ |
|
5363 | 4756 |
pkgOrNil := aClassOrNil package. |
5065 | 4757 |
]. |
4758 |
^ self getResourceFileName:aFileName forPackage:pkgOrNil. |
|
4759 |
||
4760 |
" |
|
4761 |
Smalltalk getResourceFileName:'SystemBrowser.rs' forClass:SystemBrowser |
|
4762 |
" |
|
4763 |
! |
|
4764 |
||
4765 |
getResourceFileName:aFileName forPackage:aPackageIDOrNil |
|
4766 |
"search aFileName in some standard places |
|
4767 |
(subdirectories named 'resource' in SystemPath); |
|
4768 |
and in a packages directory. |
|
4769 |
Return the absolute filename or nil if none is found." |
|
4770 |
||
5080 | 4771 |
|f dir packageDir| |
5043 | 4772 |
|
4773 |
f := self getResourceFileName:aFileName. |
|
4774 |
f notNil ifTrue:[^ f]. |
|
4775 |
||
5065 | 4776 |
aPackageIDOrNil notNil ifTrue:[ |
5786
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
4777 |
packageDir := aPackageIDOrNil copyReplaceAll:$: with:$/. |
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
4778 |
self packagePath do:[:aPath | |
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
4779 |
|pD| |
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
4780 |
|
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
4781 |
pD := aPath asFilename construct:packageDir. |
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
4782 |
pD exists ifTrue:[ |
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
4783 |
f := pD construct:aFileName. |
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
4784 |
f exists ifTrue:[ |
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
4785 |
^ f pathName |
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
4786 |
]. |
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
4787 |
f := (pD construct:'resources') construct:aFileName. |
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
4788 |
f exists ifTrue:[ |
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
4789 |
^ f pathName |
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
4790 |
]. |
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
4791 |
]. |
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
4792 |
]. |
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
4793 |
|
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
4794 |
dir := Smalltalk getPackageDirectoryForPackage:(aPackageIDOrNil ? 'stx:libview'). |
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
4795 |
dir notNil ifTrue:[ |
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
4796 |
f := (dir asFilename construct:'resources') construct:aFileName. |
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
4797 |
f exists ifTrue:[ |
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
4798 |
^ f pathName |
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
4799 |
]. |
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
4800 |
f := (dir asFilename construct:'styles') construct:aFileName. |
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
4801 |
f exists ifTrue:[ |
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
4802 |
^ f pathName |
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
4803 |
]. |
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
4804 |
]. |
5043 | 4805 |
]. |
4806 |
^ nil |
|
4807 |
||
4808 |
" |
|
5065 | 4809 |
Smalltalk getResourceFileName:'SystemBrowser.rs' forPackage:'stx:libtool' |
5080 | 4810 |
Smalltalk getResourceFileName:'normal.style' forPackage:'stx:libview' |
5043 | 4811 |
" |
4812 |
! |
|
4813 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
4814 |
getSourceFileName:aFileName |
617 | 4815 |
"search aFileName in some standard places |
4816 |
(subdirectories named 'source' in SystemPath); |
|
736 | 4817 |
return the absolute filename or nil if none is found. |
4818 |
This is used to find a sourceFile for a methods source, |
|
4819 |
if no sourceCodeManager is available." |
|
617 | 4820 |
|
2959 | 4821 |
|f| |
4822 |
||
617 | 4823 |
SourcePath isNil ifTrue:[ |
5363 | 4824 |
SourcePath := self constructPathFor:SourceDirName |
617 | 4825 |
]. |
4826 |
||
2959 | 4827 |
"/ first, try a source subdir along the path. |
4770 | 4828 |
SourcePath notNil ifTrue:[ |
5363 | 4829 |
f := self searchPath:SourcePath for:aFileName in:SourceDirName. |
4770 | 4830 |
]. |
2959 | 4831 |
f isNil ifTrue:[ |
5363 | 4832 |
"/ then, try it itself along the path. |
4833 |
f := self searchPath:self realSystemPath for:aFileName in:nil |
|
2959 | 4834 |
]. |
4835 |
^ f |
|
191 | 4836 |
|
4837 |
" |
|
736 | 4838 |
Smalltalk getSourceFileName:'Smalltalk.st' |
4839 |
Smalltalk getSourceFileName:'ArrColl.st' |
|
191 | 4840 |
" |
1562
850a88ecff97
searchPath: dont use it, if fileName starts with "./" or "../"
Claus Gittinger <cg@exept.de>
parents:
1553
diff
changeset
|
4841 |
|
850a88ecff97
searchPath: dont use it, if fileName starts with "./" or "../"
Claus Gittinger <cg@exept.de>
parents:
1553
diff
changeset
|
4842 |
"Modified: 18.7.1996 / 15:54:07 / cg" |
617 | 4843 |
! |
4844 |
||
2896 | 4845 |
getSystemFileName:aFileNameOrString |
4846 |
"search aFileNameOrString in some standard places; |
|
617 | 4847 |
return the absolute filename or nil if none is found. |
4150 | 4848 |
see comment in Smalltalk>>initSystemPath. |
4849 |
This should be used to access resources such as bitmaps, doc-files, |
|
4850 |
and other help files. |
|
4851 |
" |
|
617 | 4852 |
|
4853 |
"credits for this method go to Markus ...." |
|
4854 |
||
2933 | 4855 |
|fn nameString| |
2896 | 4856 |
|
4857 |
fn := aFileNameOrString asFilename. |
|
2933 | 4858 |
nameString := fn name. |
2896 | 4859 |
fn isAbsolute ifTrue:[ |
5363 | 4860 |
"dont use path for absolute file names" |
4861 |
||
4862 |
^ nameString |
|
191 | 4863 |
]. |
4864 |
||
617 | 4865 |
self realSystemPath do:[:dirName | |
5363 | 4866 |
|realName| |
4867 |
||
4868 |
realName := dirName asFilename construct:nameString. |
|
4869 |
"/ |
|
4870 |
"/ here, we also return true if its a directory |
|
4871 |
"/ (Even if unreadable). |
|
4872 |
"/ It could be that the file itself is still readable. |
|
4873 |
"/ |
|
4874 |
(realName isDirectory or:[realName isReadable]) ifTrue: [ |
|
4875 |
^ realName name |
|
4876 |
] |
|
191 | 4877 |
]. |
617 | 4878 |
^ nil |
4150 | 4879 |
|
4880 |
" |
|
4881 |
Smalltalk getSystemFileName:'doc/online/english/TOP.html' |
|
4882 |
Smalltalk getSystemFileName:'bitmaps/SBrowser.xbm' |
|
4883 |
Smalltalk getSystemFileName:'bitmaps/foo' |
|
4884 |
Smalltalk getSystemFileName:'resources/View.rs' |
|
4885 |
Smalltalk getSystemFileName:'resources/iris.style' |
|
4886 |
" |
|
4887 |
||
4888 |
"Modified: / 6.5.1999 / 10:40:37 / cg" |
|
617 | 4889 |
! |
4890 |
||
5089 | 4891 |
imageFromFileNamed:aFileName forClass:aClass |
4892 |
"search aFileName in some standard places: |
|
4893 |
first in the redefinable bitmaps path, then in the classes |
|
4894 |
own package directory if existing. |
|
4895 |
Return an image or nil." |
|
4896 |
||
5113 | 4897 |
|package nm img| |
4898 |
||
4899 |
package := aClass package. |
|
4900 |
img := self imageFromFileNamed:aFileName inPackage:package. |
|
4901 |
img isNil ifTrue:[ |
|
5787 | 4902 |
package ~= 'stx:goodies' ifTrue:[ |
4903 |
"/ try under the goodies package ... |
|
4904 |
img := Smalltalk imageFromFileNamed:aFileName inPackage:'stx:goodies'. |
|
4905 |
]. |
|
4906 |
img isNil ifTrue:[ |
|
4907 |
(aFileName startsWith:'bitmaps') ifFalse:[ |
|
4908 |
nm := 'bitmaps/' , aFileName. |
|
4909 |
img := Smalltalk imageFromFileNamed:nm forClass:self. |
|
4910 |
img isNil ifTrue:[ |
|
4911 |
img := Smalltalk imageFromFileNamed:nm inPackage:'stx:goodies'. |
|
4912 |
] |
|
4913 |
]. |
|
4914 |
||
4915 |
img isNil ifTrue:[ |
|
4916 |
img := Smalltalk imageFromFileNamed:aFileName inPackage:'stx:goodies'. |
|
4917 |
]. |
|
4918 |
] |
|
5113 | 4919 |
]. |
4920 |
^ img |
|
5089 | 4921 |
|
4922 |
" |
|
4923 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' forClass:View |
|
4924 |
" |
|
4925 |
! |
|
4926 |
||
4927 |
imageFromFileNamed:aFileName inPackage:aPackage |
|
4928 |
"search aFileName in some standard places: |
|
4929 |
first in the redefinable bitmaps path, then in the |
|
4930 |
package directory if existing. |
|
4931 |
Return an image or nil." |
|
4932 |
||
4933 |
|i f dir| |
|
4934 |
||
4935 |
i := Image fromFile:aFileName resolution:100. |
|
5860 | 4936 |
i notNil ifTrue:[^ i]. |
4937 |
||
4938 |
f := self getBitmapFileName:aFileName. |
|
4939 |
f notNil ifTrue:[ |
|
4940 |
i := Image fromFile:f. |
|
4941 |
i notNil ifTrue:[^ i]. |
|
4942 |
]. |
|
4943 |
dir := self projectDirectoryForPackage:aPackage. |
|
4944 |
dir isNil ifTrue:[^ nil]. |
|
4945 |
||
4946 |
((f := aFileName) startsWith:'bitmaps/') ifFalse:[ |
|
4947 |
i := Image fromFile:(dir asFilename construct:f). |
|
4948 |
i notNil ifTrue:[^ i]. |
|
4949 |
||
4950 |
f := 'bitmaps/' , aFileName. |
|
4951 |
]. |
|
4952 |
^ Image fromFile:(dir asFilename construct:f). |
|
5089 | 4953 |
|
4954 |
" |
|
5587
4c4d67ad0e51
avoid obsoleteMessage warning (Filename ,)
Claus Gittinger <cg@exept.de>
parents:
5580
diff
changeset
|
4955 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libview' |
4c4d67ad0e51
avoid obsoleteMessage warning (Filename ,)
Claus Gittinger <cg@exept.de>
parents:
5580
diff
changeset
|
4956 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libtool' |
4c4d67ad0e51
avoid obsoleteMessage warning (Filename ,)
Claus Gittinger <cg@exept.de>
parents:
5580
diff
changeset
|
4957 |
Smalltalk imageFromFileNamed:'bitmaps/gifImages/garfield.gif' inPackage:'stx:goodies' |
5089 | 4958 |
" |
4959 |
! |
|
4960 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
4961 |
libraryFileNameOfClass:aClassOrClassName |
617 | 4962 |
"for a given class, return the name of a classLibrary which contains |
4963 |
binary code for it. |
|
4964 |
Read the libinfo file 'liblist.stc' (which is created during the compilation process) |
|
4965 |
for an entry for aClassOrClassName. |
|
4966 |
Search for the className in the first col, and return the value found in |
|
4967 |
the 2nd col. |
|
4968 |
Return nil if no entry is found. |
|
4969 |
||
4970 |
A nil returns means that this class is either built-in or not present |
|
4971 |
in a package-class library (i.e. either as separate .o or separate .st file). |
|
4972 |
Otherwise, the returned name is the classLibrary object of that class. |
|
4973 |
The classes code can be loaded from that file if binary loading is supported." |
|
4974 |
||
4975 |
|aStream line words n aClassName| |
|
4976 |
||
4977 |
aClassOrClassName isBehavior ifTrue:[ |
|
5363 | 4978 |
aClassName := aClassOrClassName name |
617 | 4979 |
] ifFalse:[ |
5363 | 4980 |
aClassName := aClassOrClassName |
617 | 4981 |
]. |
4982 |
aClassName := aClassName asString. |
|
4983 |
||
4984 |
#('include/liblist.stc') "/ filenames |
|
4985 |
with:#(2) "/ column |
|
4986 |
do:[:fileName :col | |
|
4987 |
||
5363 | 4988 |
aStream := self systemFileStreamFor:fileName. |
4989 |
aStream notNil ifTrue:[ |
|
4990 |
[aStream atEnd] whileFalse:[ |
|
4991 |
line := aStream nextLine. |
|
4992 |
line notNil ifTrue:[ |
|
4993 |
(line startsWith:'#') ifFalse:[ |
|
4994 |
words := line asCollectionOfWords. |
|
4995 |
(n := words size) > 1 ifTrue:[ |
|
4996 |
(words at:1) = aClassName ifTrue:[ |
|
4997 |
n >= col ifTrue:[ |
|
4998 |
aStream close. |
|
4999 |
^ (words at:col) withoutSeparators |
|
5000 |
] |
|
5001 |
] |
|
5002 |
] |
|
5003 |
] |
|
5004 |
] |
|
5005 |
]. |
|
5006 |
aStream close |
|
5007 |
]. |
|
617 | 5008 |
]. |
5009 |
||
5010 |
^ nil |
|
5011 |
||
5012 |
" |
|
5013 |
Smalltalk libraryFileNameOfClass:'ClockView' |
|
5014 |
Smalltalk libraryFileNameOfClass:'Bag' |
|
5015 |
" |
|
5016 |
||
5017 |
"Modified: 6.11.1995 / 15:41:39 / cg" |
|
5018 |
! |
|
5019 |
||
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5020 |
packagePath |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5021 |
"return a collection of additional directorynames, where smalltalk |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5022 |
looks for package directories. |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5023 |
Notice, that directories named 'packages' under the systemPath are |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5024 |
always consulted - even if not in the packagePath" |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5025 |
|
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5026 |
^ PackagePath |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5027 |
|
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5028 |
" |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5029 |
Smalltalk packagePath |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5030 |
Smalltalk packagePath addLast:'/opt/smalltalk' |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5031 |
Smalltalk packagePath addFirst:'/usr/local/otherPackages' |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5032 |
" |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5033 |
! |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5034 |
|
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5035 |
packagePath:aPath |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5036 |
"set the packagePath; |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5037 |
a collection of additional directorynames, where smalltalk |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5038 |
looks for package directories. |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5039 |
Notice, that directories named 'packages' under the systemPath are |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5040 |
always consulted - even if not in the packagePath" |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5041 |
|
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5042 |
PackagePath := aPath asOrderedCollection |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5043 |
|
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5044 |
" |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5045 |
Smalltalk packagePath:#( '.' '/opt/smalltalk' '/usr/local/otherPackages') |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5046 |
" |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5047 |
! |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5048 |
|
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5049 |
projectDirectoryForClass:aClass |
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5050 |
"given a class, return the path to its package directory; |
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5051 |
nil if not found." |
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5052 |
|
5040 | 5053 |
|pkg| |
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5054 |
|
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5055 |
pkg := aClass package. |
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5056 |
pkg isNil ifTrue:[^ nil]. |
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5057 |
|
5040 | 5058 |
^ self projectDirectoryForPackage:pkg. |
5059 |
||
5060 |
" |
|
5061 |
Smalltalk projectDirectoryForClass:Array |
|
5062 |
Smalltalk projectDirectoryForClass:View |
|
5063 |
" |
|
5064 |
! |
|
5065 |
||
5066 |
projectDirectoryForPackage:aPackage |
|
5067 |
"given a packageID, return the path to its package directory; |
|
5068 |
nil if not found." |
|
5069 |
||
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
5070 |
|prj prjDir| |
5040 | 5071 |
|
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5072 |
"/ there might be a package specific resource directory ... |
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5073 |
"/ in the directory, from which the project was loaded |
5040 | 5074 |
prj := Project projectWithId:aPackage. |
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5075 |
prj notNil ifTrue:[ |
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
5076 |
prjDir := prj directory. |
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5077 |
]. |
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5078 |
(prjDir notNil and:[prjDir asFilename exists]) ifFalse:[ |
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
5079 |
prjDir := Smalltalk getPackageFileName:(aPackage copyReplaceAll:$: with:$/). |
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5080 |
]. |
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5081 |
^ prjDir |
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5082 |
|
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5083 |
" |
5040 | 5084 |
Smalltalk projectDirectoryForPackage:'stx:libbasic' |
5085 |
Smalltalk projectDirectoryForPackage:'exept:smartcard' |
|
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5086 |
" |
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5087 |
! |
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5088 |
|
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
5089 |
readAbbreviations |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
5090 |
"read classname to filename mappings from include/abbrev.stc. |
617 | 5091 |
sigh - all for those poor sys5.3 or MSDOS people with short filenames ..." |
5092 |
||
5067
335c866e150c
walk packagePath when reading abbrevs & autoloaded classes.
Claus Gittinger <cg@exept.de>
parents:
5065
diff
changeset
|
5093 |
|aStream f dirsConsulted| |
4420 | 5094 |
|
5095 |
CachedAbbreviations := IdentityDictionary new. |
|
5096 |
||
4458 | 5097 |
"/ new scheme: look for a directory called 'packages' |
5098 |
"/ and enumerate its abbrev.stc files... |
|
5067
335c866e150c
walk packagePath when reading abbrevs & autoloaded classes.
Claus Gittinger <cg@exept.de>
parents:
5065
diff
changeset
|
5099 |
dirsConsulted := Set new. |
4458 | 5100 |
f := Smalltalk getSystemFileName:'packages'. |
5101 |
f notNil ifTrue:[ |
|
5363 | 5102 |
f := f asFilename. |
5103 |
f isDirectory ifTrue:[ |
|
5104 |
('Smalltalk [info]: reading all class abbreviations found under ''' , f pathName ,'''') infoPrintCR. |
|
5105 |
self recursiveReadAllAbbreviationsFrom:f. |
|
5106 |
dirsConsulted add:f pathName. |
|
5107 |
]. |
|
4458 | 5108 |
]. |
5109 |
||
5067
335c866e150c
walk packagePath when reading abbrevs & autoloaded classes.
Claus Gittinger <cg@exept.de>
parents:
5065
diff
changeset
|
5110 |
"/ and along the package-path |
335c866e150c
walk packagePath when reading abbrevs & autoloaded classes.
Claus Gittinger <cg@exept.de>
parents:
5065
diff
changeset
|
5111 |
self packagePath do:[:aPath | |
5363 | 5112 |
(dirsConsulted includes:aPath) ifFalse:[ |
5113 |
('Smalltalk [info]: reading all class abbreviations found under ''' , aPath ,'''') infoPrintCR. |
|
5114 |
self recursiveReadAllAbbreviationsFrom:aPath. |
|
5115 |
dirsConsulted add:aPath |
|
5116 |
] |
|
5067
335c866e150c
walk packagePath when reading abbrevs & autoloaded classes.
Claus Gittinger <cg@exept.de>
parents:
5065
diff
changeset
|
5117 |
]. |
335c866e150c
walk packagePath when reading abbrevs & autoloaded classes.
Claus Gittinger <cg@exept.de>
parents:
5065
diff
changeset
|
5118 |
|
4458 | 5119 |
"/ old scheme: look for a single file called 'abbrev.stc' in the |
5120 |
"/ include directory. This will vanish. |
|
5121 |
||
617 | 5122 |
aStream := self systemFileStreamFor:'include/abbrev.stc'. |
5123 |
aStream notNil ifTrue:[ |
|
5363 | 5124 |
('Smalltalk [info]: reading additional abbreviations from ''' , aStream pathName ,'''') infoPrintCR. |
5125 |
self readAbbreviationsFromStream:aStream. |
|
5126 |
aStream close. |
|
5262 | 5127 |
"/ ] ifFalse:[ |
5128 |
"/ ('Smalltalk [warning]: no global''include/abbrev.stc'' file found') infoPrintCR |
|
617 | 5129 |
]. |
4420 | 5130 |
^ CachedAbbreviations |
191 | 5131 |
|
5132 |
" |
|
617 | 5133 |
Smalltalk readAbbreviations |
191 | 5134 |
" |
617 | 5135 |
|
5091 | 5136 |
"Modified: / 10.12.1999 / 17:48:53 / cg" |
617 | 5137 |
! |
5138 |
||
4458 | 5139 |
readAbbreviationsFromStream:aStream |
4420 | 5140 |
"read classname to filename mappings from aStream. |
5141 |
sigh - all for those poor sys5.3 or MSDOS people with short filenames ..." |
|
5142 |
||
5095
9bbf3cf594e5
no warning for same-abbrev, if packages differ.
Claus Gittinger <cg@exept.de>
parents:
5093
diff
changeset
|
5143 |
|abbrevs line words nm abbrev pkg key oldAbbrev cls s w| |
4420 | 5144 |
|
5145 |
abbrevs := CachedAbbreviations. |
|
5146 |
||
5147 |
[aStream atEnd] whileFalse:[ |
|
5363 | 5148 |
line := aStream nextLine. |
5149 |
line notNil ifTrue:[ |
|
5150 |
(line startsWith:'#') ifFalse:[ |
|
5151 |
||
5152 |
"/ must do it manually, caring for quoted strings. |
|
4685
d145298696b7
more package loading support
Claus Gittinger <cg@exept.de>
parents:
4642
diff
changeset
|
5153 |
"/ words := line asCollectionOfWords. |
d145298696b7
more package loading support
Claus Gittinger <cg@exept.de>
parents:
4642
diff
changeset
|
5154 |
|
5363 | 5155 |
words := OrderedCollection new. |
5156 |
s := line readStream. |
|
5157 |
[s atEnd] whileFalse:[ |
|
5158 |
s skipSeparators. |
|
5159 |
s peek == $' ifTrue:[ |
|
5160 |
s next. |
|
5161 |
w := s upTo:$'. |
|
5162 |
s skipSeparators. |
|
5163 |
] ifFalse:[ |
|
5164 |
w := s upToSeparator |
|
5165 |
]. |
|
5166 |
words add:w |
|
5167 |
]. |
|
5168 |
words size >= 3 ifTrue:[ |
|
5169 |
nm := (words at:1) withoutSeparators. |
|
5170 |
abbrev := (words at:2) withoutSeparators. |
|
5171 |
pkg := (words at:3) withoutSeparators. |
|
5172 |
nm ~= abbrev ifTrue:[ |
|
5173 |
key := nm asSymbol. |
|
5174 |
oldAbbrev := abbrevs at:key ifAbsent:nil. |
|
5175 |
oldAbbrev notNil ifTrue:[ |
|
5176 |
oldAbbrev ~= abbrev ifTrue:[ |
|
5177 |
StandAlone ifFalse:[ |
|
5178 |
('Smalltalk [warning]: conflict for: ' , nm , ' in ' , (aStream pathName)) infoPrintCR. |
|
5179 |
('Smalltalk [warning]: (' , oldAbbrev , ' <-> ' , abbrev , ')') infoPrintCR |
|
5180 |
] |
|
5181 |
]. |
|
5182 |
] ifFalse:[ |
|
5183 |
cls := self classNamed:abbrev. |
|
5184 |
||
5185 |
cls notNil ifTrue:[ |
|
5186 |
cls name ~= nm ifTrue:[ |
|
5187 |
"/ ok, there is a class named after this abbrev ... |
|
5188 |
"/ this is only a conflict, if the other class has no |
|
5189 |
"/ abbreviation (or the same). |
|
5190 |
(abbrevs at:(cls name asSymbol) ifAbsent:cls name) = abbrev ifTrue:[ |
|
5191 |
cls isNameSpace ifFalse:[ |
|
5192 |
pkg = cls package ifTrue:[ |
|
5193 |
StandAlone ifFalse:[ |
|
5194 |
('Smalltalk [warning]: conflict for: ' , cls name , ' in ' , (aStream pathName)) infoPrintCR. |
|
5195 |
('Smalltalk [warning]: (' , nm , ' -> ' , abbrev , ')') infoPrintCR |
|
5196 |
] |
|
5197 |
] |
|
5198 |
] |
|
5199 |
] |
|
5200 |
] |
|
5201 |
]. |
|
5202 |
abbrevs at:nm asSymbol put:abbrev. |
|
5203 |
] |
|
5204 |
] |
|
5205 |
] ifFalse:[ |
|
5206 |
('Smalltalk [warning]: malformed line in ' , (aStream pathName)) infoPrintCR. |
|
5207 |
] |
|
5208 |
] |
|
5209 |
] |
|
4420 | 5210 |
]. |
5091 | 5211 |
|
5095
9bbf3cf594e5
no warning for same-abbrev, if packages differ.
Claus Gittinger <cg@exept.de>
parents:
5093
diff
changeset
|
5212 |
"Modified: / 13.12.1999 / 11:54:17 / cg" |
4420 | 5213 |
! |
5214 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
5215 |
realSystemPath |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
5216 |
"return the realSystemPath - thats the directorynames from |
617 | 5217 |
SystemPath which exist and are readable" |
5218 |
||
5044 | 5219 |
|nP| |
5220 |
||
617 | 5221 |
RealSystemPath isNil ifTrue:[ |
5363 | 5222 |
OperatingSystem isVMSlike ifTrue:[ |
5223 |
"/ temporary kludge: since we cannot currently |
|
5224 |
"/ check for existance of a name like 'volume:', |
|
5225 |
"/ leave those in the Path without a check. |
|
5226 |
RealSystemPath := SystemPath select:[:dirName | |
|
5227 |
|f| |
|
5228 |
||
5229 |
f := dirName asFilename. |
|
5230 |
f isVolumeOnly ifTrue:[ |
|
5231 |
true |
|
5232 |
] ifFalse:[ |
|
5233 |
(f isDirectory) and:[f isReadable] |
|
5234 |
] |
|
5235 |
] |
|
5236 |
] ifFalse:[ |
|
5237 |
RealSystemPath := SystemPath select:[:dirName | |
|
5238 |
|f| |
|
5239 |
||
5240 |
f := dirName asFilename. |
|
5241 |
(f isDirectory) and:[f isReadable] |
|
5242 |
]. |
|
5243 |
RealSystemPath := RealSystemPath collect:[:dirName | |
|
5244 |
|f| |
|
5245 |
||
5246 |
f := dirName asFilename pathName. |
|
5247 |
]. |
|
5248 |
"/ remove duplicates (but keep order) |
|
5249 |
nP := OrderedCollection new. |
|
5250 |
RealSystemPath do:[:p | |
|
5251 |
(nP includes:p) ifFalse:[ |
|
5252 |
nP add:p |
|
5253 |
] |
|
5254 |
]. |
|
5255 |
RealSystemPath := nP. |
|
5256 |
]. |
|
617 | 5257 |
]. |
5258 |
^ RealSystemPath |
|
5259 |
! |
|
5260 |
||
4458 | 5261 |
recursiveReadAllAbbreviationsFrom:aDirectory |
4957 | 5262 |
self recursiveReadAllAbbreviationsFrom:aDirectory maxLevels:5 |
5263 |
! |
|
5264 |
||
5265 |
recursiveReadAllAbbreviationsFrom:aDirectory maxLevels:maxLevels |
|
4458 | 5266 |
"read all abbreviations from and under aDirectory." |
5267 |
||
5268 |
|abbrevStream dir| |
|
5269 |
||
5075 | 5270 |
maxLevels == 0 ifTrue:[ |
5077 | 5271 |
"/ 'Smalltalk [warning]: max directory nesting reached.' infoPrintCR. |
5363 | 5272 |
^ self |
5075 | 5273 |
]. |
4957 | 5274 |
|
4458 | 5275 |
dir := aDirectory asFilename. |
5057 | 5276 |
dir exists ifFalse:[^ self]. |
4458 | 5277 |
|
5278 |
abbrevStream := (dir construct:'abbrev.stc') asFilename readStream. |
|
5279 |
abbrevStream notNil ifTrue:[ |
|
5363 | 5280 |
self readAbbreviationsFromStream:abbrevStream. |
5281 |
abbrevStream close. |
|
4458 | 5282 |
]. |
5283 |
||
5057 | 5284 |
(dir directoryContents ? #()) do:[:aFilename | |
5363 | 5285 |
|f| |
5286 |
||
5287 |
(#( |
|
5288 |
'doc' |
|
5289 |
'CVS' |
|
5290 |
'bitmaps' |
|
5291 |
'resources' |
|
5292 |
'source' |
|
5293 |
) includes:aFilename) ifFalse:[ |
|
5294 |
f := dir construct:aFilename. |
|
5295 |
f isDirectory ifTrue:[ |
|
5296 |
self recursiveReadAllAbbreviationsFrom:f maxLevels:maxLevels-1 |
|
5297 |
] |
|
5298 |
]. |
|
4458 | 5299 |
]. |
5300 |
! |
|
5301 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
5302 |
resourceFileStreamFor:aFileName |
617 | 5303 |
"search aFileName in some standard places; |
5304 |
return a readonly fileStream or nil if not found. |
|
5305 |
Searches in subdirectories named 'resource' in SystemPath" |
|
5306 |
||
5053
0d8cc1eb0545
added #getResourceFileStream:forClass:
Claus Gittinger <cg@exept.de>
parents:
5052
diff
changeset
|
5307 |
^ self resourceFileStreamFor:aFileName forClass:nil |
0d8cc1eb0545
added #getResourceFileStream:forClass:
Claus Gittinger <cg@exept.de>
parents:
5052
diff
changeset
|
5308 |
! |
0d8cc1eb0545
added #getResourceFileStream:forClass:
Claus Gittinger <cg@exept.de>
parents:
5052
diff
changeset
|
5309 |
|
0d8cc1eb0545
added #getResourceFileStream:forClass:
Claus Gittinger <cg@exept.de>
parents:
5052
diff
changeset
|
5310 |
resourceFileStreamFor:aFileName forClass:aClassOrNil |
0d8cc1eb0545
added #getResourceFileStream:forClass:
Claus Gittinger <cg@exept.de>
parents:
5052
diff
changeset
|
5311 |
"search aFileName in some standard places and in the classes |
0d8cc1eb0545
added #getResourceFileStream:forClass:
Claus Gittinger <cg@exept.de>
parents:
5052
diff
changeset
|
5312 |
package-resource directory. |
0d8cc1eb0545
added #getResourceFileStream:forClass:
Claus Gittinger <cg@exept.de>
parents:
5052
diff
changeset
|
5313 |
Return a readonly fileStream or nil if not found. |
0d8cc1eb0545
added #getResourceFileStream:forClass:
Claus Gittinger <cg@exept.de>
parents:
5052
diff
changeset
|
5314 |
Searches in subdirectories named 'resource' in SystemPath" |
0d8cc1eb0545
added #getResourceFileStream:forClass:
Claus Gittinger <cg@exept.de>
parents:
5052
diff
changeset
|
5315 |
|
617 | 5316 |
|aString| |
5317 |
||
5053
0d8cc1eb0545
added #getResourceFileStream:forClass:
Claus Gittinger <cg@exept.de>
parents:
5052
diff
changeset
|
5318 |
aString := self getResourceFileName:aFileName forClass:aClassOrNil. |
617 | 5319 |
aString notNil ifTrue:[ |
5363 | 5320 |
^ aString asFilename readStream |
617 | 5321 |
]. |
5322 |
^ nil |
|
5323 |
! |
|
5324 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
5325 |
searchPath:aPath for:aFileName in:aDirName |
617 | 5326 |
"search aPath for a subdirectory named aDirectory with a file |
5327 |
named aFileName" |
|
5328 |
||
2928 | 5329 |
|f| |
5330 |
||
5331 |
((f := aFileName asFilename) isAbsolute |
|
5332 |
or:[f isExplicitRelative]) ifTrue:[ |
|
5786
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
5333 |
"/ |
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
5334 |
"/ dont use path for absolute or explicit .-relative file names |
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
5335 |
"/ |
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
5336 |
^ aFileName |
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
5337 |
]. |
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
5338 |
|
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
5339 |
aPath notNil ifTrue:[ |
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
5340 |
aPath do:[:dirName | |
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
5341 |
|realName dir| |
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
5342 |
|
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
5343 |
dir := dirName asFilename. |
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
5344 |
aDirName notNil ifTrue:[ |
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
5345 |
realName := (dir construct:aDirName) construct:aFileName. |
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
5346 |
] ifFalse:[ |
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
5347 |
realName := dir construct:aFileName. |
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
5348 |
]. |
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
5349 |
(realName isReadable) ifTrue:[ |
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
5350 |
^ realName name |
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
5351 |
] |
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
5352 |
]. |
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
5353 |
]. |
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
5354 |
|
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
5355 |
^ nil. |
1562
850a88ecff97
searchPath: dont use it, if fileName starts with "./" or "../"
Claus Gittinger <cg@exept.de>
parents:
1553
diff
changeset
|
5356 |
|
4129
15c7aac46056
#isReadable is ok as check - no need for #exists
Claus Gittinger <cg@exept.de>
parents:
4113
diff
changeset
|
5357 |
"Modified: / 29.4.1999 / 15:06:43 / cg" |
617 | 5358 |
! |
5359 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
5360 |
sourceDirectoryNameOfClass:aClassOrClassName |
617 | 5361 |
"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
|
5362 |
Read the files 'abbrev.stc' and 'liblist.stc' (which are created during the compilation process) |
617 | 5363 |
for an entry for aClassOrClassName. |
5364 |
Search for the className in the first col, and return the value found in |
|
5365 |
the 3rd col. |
|
5366 |
Return nil if no entry is found." |
|
5367 |
||
5368 |
|aStream line words n aClassName| |
|
5369 |
||
5370 |
aClassOrClassName isBehavior ifTrue:[ |
|
5363 | 5371 |
aClassName := aClassOrClassName name |
617 | 5372 |
] ifFalse:[ |
5363 | 5373 |
aClassName := aClassOrClassName |
191 | 5374 |
]. |
617 | 5375 |
aClassName := aClassName asString. |
5376 |
||
728
50cf1c907c28
again search liblist for a classes source directory
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
5377 |
#('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
|
5378 |
with:#(3 2) "/ column |
617 | 5379 |
do:[:fileName :col | |
5380 |
||
5363 | 5381 |
aStream := self systemFileStreamFor:fileName. |
5382 |
aStream notNil ifTrue:[ |
|
5383 |
[aStream atEnd] whileFalse:[ |
|
5384 |
line := aStream nextLine. |
|
5385 |
line notNil ifTrue:[ |
|
5386 |
(line startsWith:'#') ifFalse:[ |
|
5387 |
words := line asCollectionOfWords. |
|
5388 |
(n := words size) > 1 ifTrue:[ |
|
5389 |
(words at:1) = aClassName ifTrue:[ |
|
5390 |
n >= col ifTrue:[ |
|
5391 |
aStream close. |
|
5392 |
^ (words at:col) withoutSeparators |
|
5393 |
] |
|
5394 |
] |
|
5395 |
] |
|
5396 |
] |
|
5397 |
] |
|
5398 |
]. |
|
5399 |
aStream close |
|
5400 |
]. |
|
617 | 5401 |
]. |
5402 |
||
5403 |
^ nil |
|
191 | 5404 |
|
5405 |
" |
|
617 | 5406 |
Smalltalk sourceDirectoryNameOfClass:'ClockView' |
5407 |
Smalltalk sourceDirectoryNameOfClass:'Bag' |
|
5408 |
Smalltalk sourceDirectoryNameOfClass:'GLWireCubeDemoView' |
|
5409 |
Smalltalk sourceDirectoryNameOfClass:'SomeNonExistingClass' |
|
5410 |
" |
|
5411 |
||
5412 |
"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
|
5413 |
"Modified: 9.12.1995 / 23:54:14 / cg" |
2033 | 5414 |
"Modified: 3.1.1997 / 11:26:44 / stefan" |
617 | 5415 |
! |
5416 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
5417 |
sourceFileStreamFor:aFileName |
617 | 5418 |
"search aFileName in some standard places; |
5419 |
return a readonly fileStream or nil if not found. |
|
5420 |
Searches in subdirectories named 'source' in SystemPath" |
|
5421 |
||
5422 |
|aString| |
|
5423 |
||
5424 |
aString := self getSourceFileName:aFileName. |
|
5425 |
aString notNil ifTrue:[ |
|
5363 | 5426 |
^ aString asFilename readStream |
617 | 5427 |
]. |
5428 |
^ nil |
|
5429 |
! |
|
5430 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
5431 |
systemFileStreamFor:aFileName |
617 | 5432 |
"search aFileName in some standard places; |
5433 |
return a readonly fileStream or nil if not found. |
|
5434 |
see comment in Smalltalk>>initSystemPath" |
|
5435 |
||
5436 |
|aString| |
|
5437 |
||
5438 |
aString := self getSystemFileName:aFileName. |
|
5439 |
aString notNil ifTrue:[ |
|
5363 | 5440 |
^ aString asFilename readStream |
617 | 5441 |
]. |
5442 |
^ nil |
|
5443 |
! |
|
5444 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
5445 |
systemPath |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
5446 |
"return a collection of directorynames, where smalltalk |
617 | 5447 |
looks for system files |
5448 |
(usually in subdirs such as resources, bitmaps, source etc.) |
|
5449 |
see comment in Smalltalk>>initSystemPath." |
|
5450 |
||
5451 |
^ SystemPath |
|
5452 |
||
5453 |
" |
|
5454 |
Smalltalk systemPath |
|
5455 |
Smalltalk systemPath addLast:'someOtherDirectoryPath' |
|
5456 |
" |
|
5457 |
! |
|
5458 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
5459 |
systemPath:aPath |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
5460 |
"set the collection of directorynames, where smalltalk |
617 | 5461 |
looks for system files |
5462 |
(usually in subdirs such as resources, bitmaps, source etc.) |
|
5463 |
see comment in Smalltalk>>initSystemPath." |
|
5464 |
||
5465 |
SystemPath := aPath. |
|
5466 |
self flushPathCaches |
|
5467 |
||
5468 |
" |
|
5469 |
Smalltalk systemPath |
|
5470 |
Smalltalk systemPath:(Smalltalk systemPath copy addLast:'someOtherDirectoryPath') |
|
191 | 5471 |
" |
1 | 5472 |
! ! |
2 | 5473 |
|
4718 | 5474 |
!Smalltalk class methodsFor:'system management-packages'! |
5475 |
||
5112 | 5476 |
knownPackages |
5477 |
^ KnownPackages ? #() |
|
5478 |
! |
|
5479 |
||
4718 | 5480 |
loadPackage:aPackageIdOrPackage |
4741 | 5481 |
"make certain, that some particular package is loaded into the system. |
5482 |
Experimental." |
|
4718 | 5483 |
|
5484 |
(aPackageIdOrPackage isSymbol |
|
5485 |
or:[aPackageIdOrPackage isString]) ifTrue:[ |
|
5363 | 5486 |
^ self loadPackageWithId:aPackageIdOrPackage asAutoloaded:false |
4718 | 5487 |
]. |
5488 |
self halt:'not yet implementd'. |
|
5489 |
||
5490 |
" |
|
5491 |
Smalltalk loadPackage:'stx:libbasic' |
|
5492 |
Smalltalk loadPackage:'stx:goodies/persistency' |
|
5493 |
Smalltalk loadPackage:'cg:cparser' |
|
5494 |
Smalltalk loadPackage:'cg:rose' |
|
5495 |
" |
|
5496 |
! |
|
5497 |
||
5498 |
loadPackage:packageId fromAllSourceFilesInDirectory:aDirectory |
|
5499 |
"load all source files found in aDirectory and treat them like |
|
4741 | 5500 |
a package. Allows for initial import of alien ST-code as a new package. |
5501 |
Experimental." |
|
4718 | 5502 |
|
5503 |
|p t new anyFail| |
|
5504 |
||
5505 |
"/ problem: dependencies. |
|
5506 |
"/ solution: repeat twice, so that superclasses are present the second time |
|
5507 |
||
5508 |
Class packageQuerySignal answer:packageId asSymbol do:[ |
|
5363 | 5509 |
|any| |
5510 |
||
5511 |
2 timesRepeat:[ |
|
5512 |
anyFail := false. |
|
5513 |
aDirectory directoryContents do:[:file | |
|
5514 |
|fn| |
|
5515 |
||
5516 |
fn := aDirectory construct:file. |
|
5517 |
(fn hasSuffix:'st') ifTrue:[ |
|
5518 |
Metaclass confirmationQuerySignal answer:false do:[ |
|
5519 |
(self fileIn:fn) ifFalse:[ |
|
5520 |
anyFail := true |
|
5521 |
] ifTrue:[ |
|
5522 |
any := true. |
|
5523 |
] |
|
5524 |
] |
|
5525 |
] |
|
5526 |
]. |
|
5527 |
any ifFalse:[ |
|
5528 |
^ false "/ no file found |
|
5529 |
] |
|
5530 |
]. |
|
4718 | 5531 |
]. |
5532 |
||
5533 |
new := (p := Project projectWithId:packageId) isNil. |
|
5534 |
new ifTrue:[ p := Project new]. |
|
5535 |
||
5536 |
p name:packageId. |
|
5537 |
p directory:aDirectory. |
|
4726 | 5538 |
p package:packageId. |
4718 | 5539 |
t := packageId asCollectionOfSubstringsSeparatedByAny:'/\:'. |
5540 |
p repositoryModule:(t first). |
|
5541 |
p repositoryDirectory:(packageId copyFrom:t first size + 2). |
|
5542 |
p isLoaded:true. |
|
5543 |
||
5544 |
new ifTrue:[Project addLoadedProject:p]. |
|
5545 |
^ anyFail not |
|
5546 |
||
5547 |
! |
|
5548 |
||
4723 | 5549 |
loadPackage:packageId fromClassLibrary:aFilename |
4741 | 5550 |
"load a package from a compiled classLib. |
5551 |
Experimental." |
|
4723 | 5552 |
|
5553 |
|p t new| |
|
5554 |
||
5555 |
(self fileIn:aFilename) ifFalse:[ |
|
6025 | 5556 |
(self fileInClassLibrary:aFilename) ifFalse:[ |
5557 |
self warn:'Failed to load the package ', packageId printString. |
|
5558 |
^ false. |
|
5559 |
] |
|
4723 | 5560 |
]. |
5561 |
||
5562 |
new := (p := Project projectWithId:packageId) isNil. |
|
5563 |
new ifTrue:[ p := Project new]. |
|
5564 |
||
5565 |
p name:packageId. |
|
5566 |
p directory:aFilename directory. |
|
4726 | 5567 |
p package:packageId. |
4723 | 5568 |
t := packageId asCollectionOfSubstringsSeparatedByAny:'/\:'. |
5569 |
p repositoryModule:(t first). |
|
5570 |
p repositoryDirectory:(packageId copyFrom:t first size + 2). |
|
5571 |
p isLoaded:true. |
|
5572 |
||
5573 |
new ifTrue:[Project addLoadedProject:p]. |
|
5574 |
^ true |
|
5575 |
! |
|
5576 |
||
4718 | 5577 |
loadPackage:packageId fromLoadAllFile:aFilename |
4741 | 5578 |
"load a package from a loadAll - loader script. |
5579 |
Experimental." |
|
4718 | 5580 |
|
5581 |
|p t new| |
|
5582 |
||
4846
6fbaeb342ec6
do not open confirmers when loading a package
Claus Gittinger <cg@exept.de>
parents:
4781
diff
changeset
|
5583 |
Metaclass confirmationQuerySignal answer:false |
6fbaeb342ec6
do not open confirmers when loading a package
Claus Gittinger <cg@exept.de>
parents:
4781
diff
changeset
|
5584 |
do:[ |
5363 | 5585 |
(self fileIn:aFilename) ifFalse:[ |
5586 |
self warn:'Failed to load the package ', packageId printString. |
|
5587 |
^ false. |
|
5588 |
] |
|
4718 | 5589 |
]. |
5590 |
||
5591 |
new := (p := Project projectWithId:packageId) isNil. |
|
5592 |
new ifTrue:[ p := Project new]. |
|
5593 |
||
5594 |
p name:packageId. |
|
5595 |
p directory:aFilename directory. |
|
4726 | 5596 |
p package:packageId. |
4718 | 5597 |
t := packageId asCollectionOfSubstringsSeparatedByAny:'/\:'. |
5598 |
p repositoryModule:(t first). |
|
5599 |
p repositoryDirectory:(packageId copyFrom:t first size + 2). |
|
5600 |
p isLoaded:true. |
|
5601 |
||
5602 |
new ifTrue:[Project addLoadedProject:p]. |
|
5603 |
^ true |
|
5604 |
! |
|
5605 |
||
4722 | 5606 |
loadPackage:aPackageId fromProjectFile:f asAutoloaded:doLoadAsAutoloaded |
4741 | 5607 |
"load a package from a .prj spec. |
5608 |
Experimental." |
|
5609 |
||
4756
76982048a91a
first try to load package from prj file.
Claus Gittinger <cg@exept.de>
parents:
4748
diff
changeset
|
5610 |
|
5601 | 5611 |
"/ not yet implemented ... |
5612 |
^ false. |
|
5613 |
||
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
5614 |
"/ |prj fn| |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
5615 |
"/ |
5601 | 5616 |
"/ prj := Project new loadFromProjectFile:f asFilename pathName. |
5617 |
"/ "/ no - also allow for applications to be loaded this way |
|
5618 |
"/ "/ prj type == #library ifFalse:[ ^ false]. |
|
5619 |
"/ self halt. |
|
5620 |
"/ "/ load all prerequisites ... |
|
5621 |
"/ prj prerequisites do:[:aRequiredPackage | |
|
5622 |
"/ self halt. |
|
5623 |
"/ ]. |
|
5624 |
"/ |
|
5625 |
"/ "/ see if there is a class library ... |
|
5626 |
"/ fn := prj directory asFilename construct:(prj name , ObjectFileLoader sharedLibraryExtension). |
|
5627 |
"/ fn exists ifTrue:[ |
|
5628 |
"/ "/ load that classLibrary ... |
|
5629 |
"/ self fileIn:fn pathName. |
|
5630 |
"/ ]. |
|
5631 |
"/ |
|
5632 |
"/ "/ now, for all other classes, file-them in |
|
5633 |
"/ "/ or declare as autoloaded ... |
|
5634 |
"/ |
|
5635 |
"/ prj classes do:[:aClassOrName | |ns| |
|
5636 |
"/ aClassOrName isBehavior ifFalse:[ |
|
5637 |
"/ ((self includesKey:aClassOrName) not |
|
5638 |
"/ and:[(ns := prj defaultNameSpace) isNil |
|
5639 |
"/ or:[ns == self |
|
5640 |
"/ or:[(ns includesKey:aClassOrName) not]]]) |
|
5641 |
"/ ifTrue:[ |
|
5642 |
"/ "/ must load a corresponding source or cls-file |
|
5643 |
"/ self halt. |
|
5644 |
"/ ] |
|
5645 |
"/ ] |
|
5646 |
"/ ]. |
|
5647 |
"/ prj isLoaded:true. |
|
5648 |
"/ prj directory:f asFilename directoryName. |
|
5649 |
"/ Project addLoadedProject:prj. |
|
5650 |
"/ ^ true |
|
4756
76982048a91a
first try to load package from prj file.
Claus Gittinger <cg@exept.de>
parents:
4748
diff
changeset
|
5651 |
|
76982048a91a
first try to load package from prj file.
Claus Gittinger <cg@exept.de>
parents:
4748
diff
changeset
|
5652 |
" |
76982048a91a
first try to load package from prj file.
Claus Gittinger <cg@exept.de>
parents:
4748
diff
changeset
|
5653 |
Smalltalk loadPackage:'exept:osi/asn1' |
76982048a91a
first try to load package from prj file.
Claus Gittinger <cg@exept.de>
parents:
4748
diff
changeset
|
5654 |
Smalltalk |
5601 | 5655 |
loadPackage:'exept:osi/asn1' |
5656 |
fromProjectFile:'../../../exept/osi/asn1/asn1.prj' |
|
5657 |
asAutoloaded:false |
|
4756
76982048a91a
first try to load package from prj file.
Claus Gittinger <cg@exept.de>
parents:
4748
diff
changeset
|
5658 |
" |
4722 | 5659 |
! |
5660 |
||
5661 |
loadPackage:aPackageId fromZIPArchive:f asAutoloaded:doLoadAsAutoloaded |
|
4741 | 5662 |
"load a package from a .zip delivery file. |
5663 |
Experimental." |
|
5664 |
||
5601 | 5665 |
"/ not yet implemented ... |
4722 | 5666 |
^ false |
5667 |
! |
|
5668 |
||
4718 | 5669 |
loadPackageWithId:aPackageId |
4741 | 5670 |
"make certain, that some particular package is loaded into the system. |
5671 |
Experimental." |
|
5672 |
||
4718 | 5673 |
|
5674 |
^ self loadPackageWithId:aPackageId asAutoloaded:false |
|
5675 |
||
5676 |
" |
|
5677 |
Smalltalk loadPackageWithId:'stx:libbasic' |
|
5678 |
Smalltalk loadPackageWithId:'stx:goodies/persistency' |
|
5679 |
Smalltalk loadPackageWithId:'cg:cparser' |
|
5680 |
Smalltalk loadPackageWithId:'cg:rose' |
|
5681 |
Smalltalk loadPackageWithId:'detemobil:smc' |
|
5682 |
" |
|
5683 |
! |
|
5684 |
||
5685 |
loadPackageWithId:aPackageId asAutoloaded:doLoadAsAutoloaded |
|
4741 | 5686 |
"make certain, that some particular package is loaded into the system. |
5687 |
Experimental." |
|
4718 | 5688 |
|
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5689 |
|pkg packageDirName packageBaseName packageDir| |
4718 | 5690 |
|
5691 |
pkg := Project projectWithId:aPackageId. |
|
5692 |
(pkg notNil and:[pkg isLoaded]) ifTrue:[ |
|
5593
a809bf62149b
dont output the 'package already loaded' message
Claus Gittinger <cg@exept.de>
parents:
5587
diff
changeset
|
5693 |
"/ ('Smalltalk [info]: Package ' , aPackageId , ' already loaded.') infoPrintCR. |
a809bf62149b
dont output the 'package already loaded' message
Claus Gittinger <cg@exept.de>
parents:
5587
diff
changeset
|
5694 |
(doLoadAsAutoloaded |
a809bf62149b
dont output the 'package already loaded' message
Claus Gittinger <cg@exept.de>
parents:
5587
diff
changeset
|
5695 |
or:[pkg areAllClassesLoaded]) ifTrue:[ |
a809bf62149b
dont output the 'package already loaded' message
Claus Gittinger <cg@exept.de>
parents:
5587
diff
changeset
|
5696 |
^ true |
a809bf62149b
dont output the 'package already loaded' message
Claus Gittinger <cg@exept.de>
parents:
5587
diff
changeset
|
5697 |
]. |
4718 | 5698 |
]. |
5699 |
||
5700 |
"/ ok; not yet loaded. |
|
5701 |
"/ try to locate the package; try the following: |
|
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5702 |
"/ $(packagePath)/<packageDir>/... |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5703 |
"/ $(SYSPATH)/packages/<packageDir> |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5704 |
|
4718 | 5705 |
packageDirName := aPackageId copyReplaceAll:$: with:$/. |
5706 |
packageBaseName := packageDirName asFilename baseName. |
|
5707 |
||
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5708 |
packageDir := self getPackageFileName:packageDirName. |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5709 |
packageDir isNil ifTrue:[ |
5593
a809bf62149b
dont output the 'package already loaded' message
Claus Gittinger <cg@exept.de>
parents:
5587
diff
changeset
|
5710 |
"/ for convenience: try ../../.. as well |
a809bf62149b
dont output the 'package already loaded' message
Claus Gittinger <cg@exept.de>
parents:
5587
diff
changeset
|
5711 |
"/ (when executing in thedevelopment environment) |
a809bf62149b
dont output the 'package already loaded' message
Claus Gittinger <cg@exept.de>
parents:
5587
diff
changeset
|
5712 |
packageDir := '../../..' asFilename construct:packageDirName. |
a809bf62149b
dont output the 'package already loaded' message
Claus Gittinger <cg@exept.de>
parents:
5587
diff
changeset
|
5713 |
packageDir exists ifTrue:[ |
a809bf62149b
dont output the 'package already loaded' message
Claus Gittinger <cg@exept.de>
parents:
5587
diff
changeset
|
5714 |
packageDir := packageDir pathName |
a809bf62149b
dont output the 'package already loaded' message
Claus Gittinger <cg@exept.de>
parents:
5587
diff
changeset
|
5715 |
] ifFalse:[ |
a809bf62149b
dont output the 'package already loaded' message
Claus Gittinger <cg@exept.de>
parents:
5587
diff
changeset
|
5716 |
('Smalltalk [warning]: cannot find packageDirectory: ' , packageDirName) errorPrintCR. |
a809bf62149b
dont output the 'package already loaded' message
Claus Gittinger <cg@exept.de>
parents:
5587
diff
changeset
|
5717 |
^ false |
a809bf62149b
dont output the 'package already loaded' message
Claus Gittinger <cg@exept.de>
parents:
5587
diff
changeset
|
5718 |
] |
4718 | 5719 |
]. |
5720 |
||
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5721 |
^ self |
5593
a809bf62149b
dont output the 'package already loaded' message
Claus Gittinger <cg@exept.de>
parents:
5587
diff
changeset
|
5722 |
loadPackageWithId:aPackageId |
a809bf62149b
dont output the 'package already loaded' message
Claus Gittinger <cg@exept.de>
parents:
5587
diff
changeset
|
5723 |
name:packageBaseName |
a809bf62149b
dont output the 'package already loaded' message
Claus Gittinger <cg@exept.de>
parents:
5587
diff
changeset
|
5724 |
fromDirectory:packageDir |
a809bf62149b
dont output the 'package already loaded' message
Claus Gittinger <cg@exept.de>
parents:
5587
diff
changeset
|
5725 |
asAutoloaded:doLoadAsAutoloaded |
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5726 |
|
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5727 |
|
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5728 |
|
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5729 |
" |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5730 |
Smalltalk loadPackageWithId:'stx:libbasic' |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5731 |
Smalltalk loadPackageWithId:'stx:goodies/persistency' |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5732 |
Smalltalk loadPackageWithId:'exept:ctypes' |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5733 |
" |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5734 |
! |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5735 |
|
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5736 |
loadPackageWithId:aPackageId name:packageName fromDirectory:packageDirOrString asAutoloaded:doLoadAsAutoloaded |
6243 | 5737 |
|f s packageDir shLibName| |
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5738 |
|
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5739 |
packageDir := packageDirOrString asFilename. |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5740 |
|
4718 | 5741 |
"/ .prj ? |
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5742 |
f := (packageDir construct:packageName) withSuffix:'prj'. |
4718 | 5743 |
f exists ifTrue:[ |
5601 | 5744 |
(self loadPackage:aPackageId fromProjectFile:f asAutoloaded:doLoadAsAutoloaded) ifTrue:[ |
6243 | 5745 |
SilentLoading ifFalse:[ |
5746 |
Transcript showCR:('Smalltalk [info]: loaded package: ' , aPackageId , ' from project file: ' , f pathName). |
|
5747 |
]. |
|
5601 | 5748 |
^ true |
5749 |
] |
|
4718 | 5750 |
]. |
5751 |
"/ loadAll ? |
|
5752 |
f := packageDir construct:'loadAll'. |
|
5753 |
f exists ifTrue:[ |
|
5601 | 5754 |
(self loadPackage:aPackageId fromLoadAllFile:f) ifTrue:[ |
6243 | 5755 |
SilentLoading ifFalse:[ |
5756 |
Transcript showCR:('loaded package: ' , aPackageId , ' from loadAll file: ' , f pathName). |
|
5757 |
]. |
|
5601 | 5758 |
^ true |
5759 |
] |
|
4718 | 5760 |
]. |
5807
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
5761 |
"/ .zip ? |
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
5762 |
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
|
5763 |
f exists ifTrue:[ |
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
5764 |
(self loadPackage:aPackageId fromZIPArchive:f asAutoloaded:doLoadAsAutoloaded) ifTrue:[ |
6243 | 5765 |
SilentLoading ifFalse:[ |
5766 |
Transcript showCR:('loaded package: ' , aPackageId , ' from zip file: ' , f pathName). |
|
5767 |
]. |
|
5807
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
5768 |
^ true |
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
5769 |
] |
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
5770 |
]. |
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
5771 |
|
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
5772 |
shLibName := packageName , ObjectFileLoader sharedLibraryExtension. |
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
5773 |
|
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
5774 |
"/ .so ? |
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
5775 |
f := packageDir construct:shLibName. |
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
5776 |
f exists ifTrue:[ |
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
5777 |
(self loadPackage:aPackageId fromClassLibrary:f) ifTrue:[ |
6243 | 5778 |
SilentLoading ifFalse:[ |
5779 |
Transcript showCR:('loaded package: ' , aPackageId , ' from binary classLib file: ' , f pathName). |
|
5780 |
]. |
|
5807
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
5781 |
^ true |
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
5782 |
] |
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
5783 |
]. |
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
5784 |
|
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
5785 |
"/ abbrev.stc ? |
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
5786 |
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
|
5787 |
f exists ifTrue:[ |
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
5788 |
Smalltalk installAutoloadedClassesFrom:f pathName. |
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
5789 |
|
6649 | 5790 |
doLoadAsAutoloaded ifFalse:[ |
5791 |
"/ force autoloading... |
|
5792 |
s := f readStream. |
|
5793 |
s contents do:[:eachLine | |
|
5794 |
|s className cls| |
|
5795 |
||
5796 |
s := eachLine readStream. |
|
5797 |
s skipSpaces. |
|
5798 |
className := s upTo:Character space. |
|
5799 |
cls := Smalltalk classNamed:className. |
|
5800 |
cls autoload |
|
5801 |
]. |
|
5802 |
s close. |
|
5807
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
5803 |
]. |
6243 | 5804 |
SilentLoading ifFalse:[ |
5805 |
Transcript showCR:('loaded package: ' , aPackageId , ' from abbrev file: ' , f pathName). |
|
5806 |
]. |
|
5807
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
5807 |
^ true |
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
5808 |
]. |
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
5809 |
|
5175
c3e71ead8e06
when loading a package, and a .so file could not be found
Claus Gittinger <cg@exept.de>
parents:
5168
diff
changeset
|
5810 |
"/ 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
|
5811 |
f := (packageDir construct:'lib') construct:'loadAll'. |
4722 | 5812 |
f exists ifTrue:[ |
5601 | 5813 |
(self loadPackage:aPackageId fromLoadAllFile:f) ifTrue:[ |
6243 | 5814 |
SilentLoading ifFalse:[ |
5815 |
Transcript showCR:('loaded package: ' , aPackageId , ' from loadAll file: ' , f pathName). |
|
5816 |
]. |
|
5601 | 5817 |
^ true |
5818 |
] |
|
4722 | 5819 |
]. |
5807
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
5820 |
|
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
5821 |
"/ /lib/.so ? (will vanish) |
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
5822 |
f := (packageDir construct:'lib') construct:shLibName. |
4718 | 5823 |
f exists ifTrue:[ |
5601 | 5824 |
(self loadPackage:aPackageId fromClassLibrary:f) ifTrue:[ |
6243 | 5825 |
SilentLoading ifFalse:[ |
5826 |
Transcript showCR:('loaded package: ' , aPackageId , ' from binary classLib file: ' , f pathName). |
|
5827 |
]. |
|
5601 | 5828 |
^ true |
5829 |
] |
|
4722 | 5830 |
]. |
5807
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
5831 |
|
5175
c3e71ead8e06
when loading a package, and a .so file could not be found
Claus Gittinger <cg@exept.de>
parents:
5168
diff
changeset
|
5832 |
"/ 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
|
5833 |
packageDir directoryContentsAsFilenamesDo:[:aFilename | |
5601 | 5834 |
(aFilename hasSuffix:ObjectFileLoader sharedLibrarySuffix) ifTrue:[ |
5835 |
(self loadPackage:aPackageId fromClassLibrary:aFilename) ifTrue:[ |
|
6243 | 5836 |
SilentLoading ifFalse:[ |
5837 |
Transcript showCR:('loaded package: ' , aPackageId , ' from binary classLib file: ' , aFilename pathName). |
|
5838 |
]. |
|
5601 | 5839 |
^ true |
5840 |
] |
|
5841 |
] |
|
5175
c3e71ead8e06
when loading a package, and a .so file could not be found
Claus Gittinger <cg@exept.de>
parents:
5168
diff
changeset
|
5842 |
]. |
5807
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
5843 |
|
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5844 |
"/ source files |
4737 | 5845 |
(self loadPackage:aPackageId fromAllSourceFilesInDirectory:packageDir) ifTrue:[ |
6243 | 5846 |
SilentLoading ifFalse:[ |
5847 |
Transcript showCR:('loaded package: ' , aPackageId , ' from source files in:' , packageDir pathName). |
|
5848 |
]. |
|
5601 | 5849 |
^ true |
4737 | 5850 |
]. |
5851 |
^ false |
|
5852 |
||
4718 | 5853 |
" |
5854 |
Smalltalk loadPackageWithId:'stx:libbasic' |
|
5855 |
Smalltalk loadPackageWithId:'stx:goodies/persistency' |
|
4722 | 5856 |
Smalltalk loadPackageWithId:'exept:ctypes' |
4718 | 5857 |
" |
5858 |
! ! |
|
5859 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
5860 |
!Smalltalk class methodsFor:'time-versions'! |
453 | 5861 |
|
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
5862 |
configuration |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
5863 |
"{ Pragma: +optSpace }" |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
5864 |
|
453 | 5865 |
"for developers only: return the configuration, with which |
5866 |
this smalltalk was compiled." |
|
5867 |
||
567 | 5868 |
%{ /* NOCONTEXT */ |
453 | 5869 |
extern char *__getConfigurationString(); |
5870 |
||
5871 |
RETURN (__MKSTRING(__getConfigurationString() COMMA_SND)); |
|
5406 | 5872 |
%}. |
5445 | 5873 |
^ 'unknownOS/unknownCONF:unknownPACK' |
5874 |
||
5875 |
" |
|
5876 |
Smalltalk configuration |
|
453 | 5877 |
" |
5878 |
! |
|
5879 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
5880 |
copyrightString |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
5881 |
"{ Pragma: +optSpace }" |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
5882 |
|
453 | 5883 |
"return a copyright string" |
5884 |
||
567 | 5885 |
%{ /* NOCONTEXT */ |
829
fc386319f41c
removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents:
822
diff
changeset
|
5886 |
#ifndef __getCopyrightString |
fc386319f41c
removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents:
822
diff
changeset
|
5887 |
extern OBJ __getCopyrightString(); |
568 | 5888 |
#endif |
5889 |
||
829
fc386319f41c
removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents:
822
diff
changeset
|
5890 |
RETURN (__getCopyrightString()); |
5410 | 5891 |
%}. |
5892 |
^ self primitiveFailed |
|
453 | 5893 |
|
5894 |
" |
|
5895 |
Smalltalk copyrightString |
|
5896 |
" |
|
5897 |
! |
|
5898 |
||
6585 | 5899 |
dialectName |
5900 |
^ 'SmalltalkX' |
|
5901 |
||
5902 |
" |
|
5903 |
Smalltalk dialectName |
|
5904 |
" |
|
5905 |
! |
|
5906 |
||
5907 |
dialectReleaseVersion |
|
5908 |
^ self versionString |
|
5909 |
||
5910 |
" |
|
5911 |
Smalltalk dialectReleaseVersion |
|
5912 |
" |
|
5913 |
! |
|
5914 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
5915 |
distributorString |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
5916 |
"{ Pragma: +optSpace }" |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
5917 |
|
567 | 5918 |
"return a string describing the distributor of this software" |
5919 |
||
5920 |
%{ /* NOCONTEXT */ |
|
829
fc386319f41c
removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents:
822
diff
changeset
|
5921 |
#ifndef __getDistributorString |
fc386319f41c
removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents:
822
diff
changeset
|
5922 |
extern OBJ __getDistributorString(); |
568 | 5923 |
#endif |
5924 |
||
829
fc386319f41c
removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents:
822
diff
changeset
|
5925 |
RETURN (__getDistributorString()); |
5410 | 5926 |
%}. |
5445 | 5927 |
^ 'eXept Software AG, Germany' |
5410 | 5928 |
|
567 | 5929 |
" |
5930 |
Smalltalk distributorString |
|
5931 |
" |
|
5932 |
! |
|
5933 |
||
1645 | 5934 |
expirationTime |
5935 |
"{ Pragma: +optSpace }" |
|
5936 |
||
5937 |
"for developers only: return the time when the system will expire. |
|
5938 |
after this time it will not run any longer. |
|
5939 |
It returns nil, if no expiration time has been set (system runs forever :-))" |
|
5940 |
||
5941 |
|exp| |
|
5942 |
||
5943 |
%{ |
|
5944 |
extern unsigned int __getExpirationTime(); |
|
5945 |
||
5946 |
exp = __MKUINT(__getExpirationTime()); |
|
5947 |
%}. |
|
5948 |
exp == 0 ifTrue:[ |
|
5363 | 5949 |
^ nil |
1645 | 5950 |
]. |
5951 |
^ AbsoluteTime new fromOSTime:(exp * 1000). "OSTime is ms since 1970" |
|
5952 |
||
5953 |
" |
|
5954 |
Smalltalk expirationTime |
|
5955 |
" |
|
5956 |
! |
|
5957 |
||
3062
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
5958 |
fullVersionString |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
5959 |
"{ Pragma: +optSpace }" |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
5960 |
|
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
5961 |
"return a full version string" |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
5962 |
|
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
5963 |
^ 'Smalltalk/X release ' , self versionString , ' of ' , self versionDate |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
5964 |
|
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
5965 |
" |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
5966 |
Smalltalk fullVersionString |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
5967 |
" |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
5968 |
|
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
5969 |
"Created: / 27.10.1997 / 17:03:09 / cg" |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
5970 |
"Modified: / 27.10.1997 / 17:04:02 / cg" |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
5971 |
! |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
5972 |
|
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
5973 |
hello |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
5974 |
"{ Pragma: +optSpace }" |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
5975 |
|
453 | 5976 |
"return a greeting string" |
5977 |
||
5978 |
"stupid: this should come from a resource file ... |
|
5979 |
but I dont use it here, to allow mini-systems without |
|
5980 |
Resource-stuff." |
|
5981 |
||
6187 | 5982 |
|proto lang| |
1307 | 5983 |
|
5984 |
lang := Language. |
|
5641 | 5985 |
(lang == #de) ifTrue:[ |
5986 |
proto := 'Willkommen bei %1 (Version %2 vom %3)' |
|
5987 |
] ifFalse:[ (lang == #fr) ifTrue:[ |
|
5988 |
proto := 'Salut, Bienvenue à %1 (version %2 de %3)' |
|
5989 |
] ifFalse:[ (lang == #it) ifTrue:[ |
|
5990 |
proto := 'Ciao, benvenuto al %1 (versione %2 di %3)' |
|
5991 |
] 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
|
5992 |
"/ proto := 'Hola, bienvenida a %1 (versión %2 de %3)' |
5641 | 5993 |
] 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
|
5994 |
"/ proto := 'Oi, benvindo a %1 (versão %2 de %3)' |
5641 | 5995 |
] ifFalse:[ (lang == #no) ifTrue:[ |
5996 |
proto := 'Hei, verdenmottakelse til %1 (versjon %2 av %3)' |
|
5997 |
]]]]]]. |
|
1307 | 5998 |
|
5999 |
"/ ... more needed here ... |
|
6000 |
||
6001 |
proto isNil ifTrue:[ |
|
5641 | 6002 |
proto := 'Hello World - here is %1 version %2 of %3'. |
453 | 6003 |
]. |
1307 | 6004 |
|
6187 | 6005 |
^ proto bindWith:('SmallTalk/X' allBold) |
5641 | 6006 |
with:(self versionString) |
6007 |
with:(self versionDate) |
|
453 | 6008 |
|
6009 |
" |
|
1307 | 6010 |
Smalltalk language:#us. |
6011 |
Smalltalk hello |
|
6012 |
||
6013 |
Smalltalk language:#de. |
|
6014 |
Smalltalk hello |
|
1412 | 6015 |
|
5641 | 6016 |
Smalltalk language:#no. |
6017 |
Smalltalk hello |
|
6018 |
||
1422 | 6019 |
Transcript showCR:(Smalltalk hello) |
6020 |
Stdout showCR:(Smalltalk hello) |
|
453 | 6021 |
" |
1307 | 6022 |
|
1412 | 6023 |
"Modified: 18.5.1996 / 14:25:13 / cg" |
617 | 6024 |
! |
6025 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6026 |
imageRestartTime |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6027 |
"return a timestamp for the moment when this image was restarted. |
1069 | 6028 |
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
|
6029 |
|
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6030 |
^ ImageRestartTime |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6031 |
|
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6032 |
" |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6033 |
Smalltalk imageStartTime |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6034 |
Smalltalk imageRestartTime |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6035 |
" |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6036 |
|
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6037 |
"Created: 13.12.1995 / 17:44:20 / cg" |
1069 | 6038 |
"Modified: 6.3.1996 / 11:56:35 / cg" |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6039 |
! |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6040 |
|
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6041 |
imageSaveTime |
3988 | 6042 |
"{ Pragma: +optSpace }" |
6043 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6044 |
"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
|
6045 |
|
eebf3ed54b23
reloadAllObjectFiles now called explicit (its too late via ObjMem changed)
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
6046 |
^ ObjectMemory imageSaveTime |
eebf3ed54b23
reloadAllObjectFiles now called explicit (its too late via ObjMem changed)
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
6047 |
! |
eebf3ed54b23
reloadAllObjectFiles now called explicit (its too late via ObjMem changed)
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
6048 |
|
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6049 |
imageStartTime |
3988 | 6050 |
"{ Pragma: +optSpace }" |
6051 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6052 |
"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
|
6053 |
(i.e. the first initial start without an image)" |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6054 |
|
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6055 |
^ ImageStartTime |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6056 |
|
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6057 |
" |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6058 |
Smalltalk imageStartTime |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6059 |
Smalltalk imageRestartTime |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6060 |
" |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6061 |
|
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6062 |
"Created: 13.12.1995 / 17:44:14 / cg" |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6063 |
"Modified: 13.12.1995 / 17:45:47 / cg" |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6064 |
! |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6065 |
|
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6066 |
majorVersionNr |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6067 |
"{ Pragma: +optSpace }" |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
6068 |
|
617 | 6069 |
"return the major version number. |
6070 |
This is only incremented for very fundamental changes, |
|
6071 |
which make old object files totally incompatible |
|
6072 |
(for example, if the layout/representation of fundamental |
|
3382 | 6073 |
classes changes). |
6074 |
||
3988 | 6075 |
ST/X revision Naming is: |
5363 | 6076 |
<major>.<minor>.<revision>.<release>" |
617 | 6077 |
|
5322 | 6078 |
^ 4 |
617 | 6079 |
|
6080 |
" |
|
6081 |
Smalltalk majorVersionNr |
|
6082 |
" |
|
1941
51332fe23542
bumped version to 3 (I guess, nameSpaces are a major step)
Claus Gittinger <cg@exept.de>
parents:
1917
diff
changeset
|
6083 |
|
51332fe23542
bumped version to 3 (I guess, nameSpaces are a major step)
Claus Gittinger <cg@exept.de>
parents:
1917
diff
changeset
|
6084 |
"Modified: 8.11.1996 / 19:59:21 / cg" |
617 | 6085 |
! |
6086 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6087 |
minorVersionNr |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6088 |
"{ Pragma: +optSpace }" |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
6089 |
|
617 | 6090 |
"return the minor version number. |
6091 |
This is incremented for changes which make some old object |
|
6092 |
files incompatible, or the protocol changes such that some |
|
3988 | 6093 |
classes need rework. |
6094 |
||
6095 |
ST/X revision Naming is: |
|
5363 | 6096 |
<major>.<minor>.<revision>.<release>" |
3988 | 6097 |
|
5322 | 6098 |
^ 1 |
617 | 6099 |
|
6100 |
" |
|
6101 |
Smalltalk minorVersionNr |
|
6102 |
" |
|
1941
51332fe23542
bumped version to 3 (I guess, nameSpaces are a major step)
Claus Gittinger <cg@exept.de>
parents:
1917
diff
changeset
|
6103 |
|
3092 | 6104 |
"Modified: / 3.11.1997 / 14:49:48 / cg" |
617 | 6105 |
! |
6106 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6107 |
releaseIdentification |
1552 | 6108 |
"{ Pragma: +optSpace }" |
6109 |
||
6110 |
"for developers only: return the release |
|
6111 |
(to further identify the version in case of errors)" |
|
6112 |
||
6113 |
%{ /* NOCONTEXT */ |
|
1553 | 6114 |
extern OBJ __getRel(); |
6115 |
||
6116 |
RETURN (__getRel()); |
|
5410 | 6117 |
%}. |
5445 | 6118 |
^ 'ST/X_experimental' |
1552 | 6119 |
|
6120 |
" |
|
6121 |
Smalltalk releaseIdentification |
|
6122 |
" |
|
6123 |
! |
|
6124 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6125 |
releaseNr |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6126 |
"{ Pragma: +optSpace }" |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
6127 |
|
617 | 6128 |
"return the revision number. |
6129 |
Incremented for releases which fix bugs/add features but did not find |
|
3988 | 6130 |
their way to the outside world. |
6131 |
||
6132 |
ST/X revision Naming is: |
|
5363 | 6133 |
<major>.<minor>.<revision>.<release>" |
4334 | 6134 |
|
6524 | 6135 |
^ 2 |
617 | 6136 |
|
6137 |
" |
|
6138 |
Smalltalk releaseNr |
|
6139 |
" |
|
732
29a49feab799
release bump - that seems to be a good one
Claus Gittinger <cg@exept.de>
parents:
728
diff
changeset
|
6140 |
|
29a49feab799
release bump - that seems to be a good one
Claus Gittinger <cg@exept.de>
parents:
728
diff
changeset
|
6141 |
"Created: 10.12.1995 / 01:42:19 / cg" |
617 | 6142 |
! |
6143 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6144 |
revisionNr |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6145 |
"{ Pragma: +optSpace }" |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
6146 |
|
617 | 6147 |
"return the revision number. |
6148 |
Incremented for releases which fix bugs/add features |
|
6149 |
and represent a stable workable version which got published |
|
3988 | 6150 |
to the outside world. |
6151 |
||
6152 |
ST/X revision Naming is: |
|
6031 | 6153 |
<major>.<minor>.<revision>.<release>" |
6154 |
||
6261 | 6155 |
^ 4 |
617 | 6156 |
|
6157 |
" |
|
6158 |
Smalltalk revisionNr |
|
6031 | 6159 |
Smalltalk hello |
617 | 6160 |
" |
1941
51332fe23542
bumped version to 3 (I guess, nameSpaces are a major step)
Claus Gittinger <cg@exept.de>
parents:
1917
diff
changeset
|
6161 |
|
3624 | 6162 |
"Modified: / 19.6.1998 / 04:29:10 / cg" |
617 | 6163 |
! |
6164 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6165 |
timeStamp |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6166 |
"return a string useful for timestamping a file. |
617 | 6167 |
The returned string is padded with spaces for a constant |
6168 |
length (to avoid changing a files size in fileOut with unchanged |
|
6169 |
class)." |
|
6170 |
||
5373 | 6171 |
^ ('''' , self timeStampString , '''') paddedTo:80 with:(Character space) |
617 | 6172 |
! |
6173 |
||
3611
f55f117dfd4a
added #timeStamp: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
3610
diff
changeset
|
6174 |
timeStamp:aStream |
f55f117dfd4a
added #timeStamp: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
3610
diff
changeset
|
6175 |
"write a string useful for timestamping a file onto aStream. |
f55f117dfd4a
added #timeStamp: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
3610
diff
changeset
|
6176 |
ST80 compatibility" |
f55f117dfd4a
added #timeStamp: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
3610
diff
changeset
|
6177 |
|
f55f117dfd4a
added #timeStamp: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
3610
diff
changeset
|
6178 |
aStream nextPutAll:(self timeStamp). |
f55f117dfd4a
added #timeStamp: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
3610
diff
changeset
|
6179 |
|
f55f117dfd4a
added #timeStamp: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
3610
diff
changeset
|
6180 |
"Created: / 18.6.1998 / 17:22:58 / cg" |
f55f117dfd4a
added #timeStamp: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
3610
diff
changeset
|
6181 |
! |
f55f117dfd4a
added #timeStamp: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
3610
diff
changeset
|
6182 |
|
5373 | 6183 |
timeStampString |
6184 |
"return a string useful for timestamping a file." |
|
6185 |
||
6186 |
^ ('From Smalltalk/X, Version:' , (Smalltalk versionString) , ' on ' |
|
6187 |
, Date today printString , ' at ' , Time now printString |
|
6188 |
) |
|
6189 |
! |
|
6190 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6191 |
versionDate |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6192 |
"{ Pragma: +optSpace }" |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
6193 |
|
617 | 6194 |
"return the executables build date - thats the date when the smalltalk |
6195 |
executable was built" |
|
6196 |
||
6197 |
%{ /* NOCONTEXT */ |
|
6198 |
extern char *__getBuildDateString(); |
|
6199 |
||
6200 |
RETURN (__MKSTRING(__getBuildDateString() COMMA_SND) ); |
|
5410 | 6201 |
%}. |
5445 | 6202 |
^ 'today' |
6203 |
||
6204 |
" |
|
6205 |
Smalltalk versionDate |
|
617 | 6206 |
" |
6207 |
! |
|
6208 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6209 |
versionString |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6210 |
"{ Pragma: +optSpace }" |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
6211 |
|
617 | 6212 |
"return the version string" |
6213 |
||
6214 |
^ (self majorVersionNr printString , |
|
6215 |
'.', |
|
6216 |
self minorVersionNr printString , |
|
6217 |
'.', |
|
6218 |
self revisionNr printString) |
|
6219 |
||
6220 |
" |
|
6221 |
Smalltalk versionString |
|
6222 |
" |
|
5427 | 6223 |
! |
6224 |
||
6225 |
vmMajorVersionNr |
|
6226 |
"{ Pragma: +optSpace }" |
|
6227 |
||
6228 |
"return the VMs major version number." |
|
6229 |
%{ |
|
6230 |
RETURN (__MKSMALLINT(4)); |
|
6231 |
%}. |
|
6232 |
^ 4 |
|
6233 |
||
6234 |
" |
|
6235 |
Smalltalk vmMajorVersionNr |
|
6236 |
" |
|
6237 |
||
2 | 6238 |
! ! |
453 | 6239 |
|
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
6240 |
!Smalltalk class methodsFor:'documentation'! |
630 | 6241 |
|
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6242 |
version |
6649 | 6243 |
^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.533 2002-07-18 13:22:36 stefan Exp $' |
630 | 6244 |
! ! |