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