author | penk |
Fri, 25 Jul 2003 14:25:56 +0200 | |
changeset 7525 | d6eeec4dd9da |
parent 7520 | 03cbfda8cf8b |
child 7526 | 97c36c93e3d9 |
permissions | -rw-r--r-- |
1 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1988 by Claus Gittinger |
6853 | 3 |
All Rights Reserved |
1 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
5363 | 13 |
"{ Package: 'stx:libbasic' }" |
14 |
||
1 | 15 |
Object subclass:#Smalltalk |
6853 | 16 |
instanceVariableNames:'' |
17 |
classVariableNames:'StartBlocks ImageStartBlocks ExitBlocks CachedClasses SystemPath |
|
18 |
StartupClass StartupSelector StartupArguments CommandLine |
|
19 |
CommandName CommandLineArguments CachedAbbreviations |
|
20 |
SilentLoading Initializing StandAlone HeadlessOperation |
|
21 |
DebuggingStandAlone LogDoits LoadBinaries RealSystemPath |
|
22 |
ResourcePath SourcePath BitmapPath BinaryPath FileInPath |
|
23 |
PackagePath BinaryDirName ResourceDirName SourceDirName |
|
24 |
BitmapDirName PackageDirName FileInDirName ChangeFileName |
|
25 |
ImageStartTime ImageRestartTime DemoMode SaveEmergencyImage |
|
26 |
SpecialObjectArray CallbackSignal KnownPackages' |
|
27 |
poolDictionaries:'' |
|
28 |
category:'System-Support' |
|
1 | 29 |
! |
30 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
31 |
!Smalltalk class methodsFor:'documentation'! |
70 | 32 |
|
617 | 33 |
copyright |
34 |
" |
|
35 |
COPYRIGHT (c) 1988 by Claus Gittinger |
|
6853 | 36 |
All Rights Reserved |
617 | 37 |
|
38 |
This software is furnished under a license and may be used |
|
39 |
only in accordance with the terms of that license and with the |
|
40 |
inclusion of the above copyright notice. This software may not |
|
41 |
be provided or otherwise made available to, or used by, any |
|
42 |
other person. No title to or ownership of the software is |
|
43 |
hereby transferred. |
|
44 |
" |
|
95 | 45 |
! |
46 |
||
70 | 47 |
documentation |
48 |
" |
|
49 |
This is one of the central classes in the system; |
|
50 |
it provides all system-startup, shutdown and maintenance support. |
|
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
51 |
Also global variables are (conceptionally) kept here. |
70 | 52 |
|
53 |
As you will notice, this is NOT a Dictionary |
|
3062
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
54 |
- my implementation of globals is totally different |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
55 |
due to the need to be able to access globals from c-code as well, |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
56 |
I do not use associations for globals, but instead keep the |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
57 |
name<->value relations in the VM and access globals via utility |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
58 |
functions found there. |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
59 |
|
70 | 60 |
However, it provides the known enumeration protocol. |
3062
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
61 |
It may change to become a subclass of collection at some time, |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
62 |
to inherit more collection stuff ... |
70 | 63 |
|
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
64 |
|
1286 | 65 |
[Instance variables:] |
6853 | 66 |
none - all handling is done in the VM |
1286 | 67 |
|
68 |
[Class variables:] |
|
69 |
||
6853 | 70 |
StartBlocks <Collection> blocks to be executed in a separate process after |
71 |
everything has been initialized. These blocks will |
|
72 |
be deleted after execution and therefore not be |
|
73 |
executed after an image restart. Initial processes |
|
74 |
(such as the Launcher) are usually started here. |
|
75 |
These blocks are added by smalltalk.rc/private.rc etc. |
|
76 |
via #addStartBlock during early initialization. |
|
77 |
||
78 |
ImageStartBlocks |
|
79 |
<Collection> blocks to be executed in a separate process after |
|
80 |
everything has been initialized. These blocks will be |
|
81 |
executed after an image restart. |
|
82 |
These blocks are usually added by smalltalk_r.rc etc. |
|
83 |
||
84 |
ExitBlocks <Collection> blocks to evaluate before system is |
|
85 |
left. Not currently used (GNU-ST compatibility). |
|
86 |
||
87 |
SystemPath <Collection> path to search for system files (sources, bitmaps etc) |
|
88 |
Set to a default here, but typically changed from some |
|
89 |
startup.rc file |
|
90 |
||
91 |
PackagePath <Collection> path to search for package. |
|
92 |
This is going to replace the above systemPath, and a classes |
|
93 |
resources will eventually searched in its package directory. |
|
94 |
This list defines the path, where packages are searched for, |
|
95 |
initially this is something like /opt/smalltalk/packages. |
|
96 |
Set to a default here, but typically changed from some |
|
97 |
startup.rc file |
|
98 |
||
99 |
StartupClass <Class> class and selector, where the system starts up |
|
100 |
StartupSelector <Symbol> (right after VM initialization) |
|
101 |
StartupArguments <Array> If an image is saved while those being nonNil, |
|
102 |
the image will come up there. |
|
6881 | 103 |
Allows for customized images to be generated from a standard ST/X. |
104 |
StandAlone programs also set those during initialization. |
|
6853 | 105 |
|
106 |
CommandLine <String> Unix (OS-) command line |
|
107 |
||
108 |
CommandName <String> the command (i.e. argv[0]) |
|
109 |
||
110 |
CommandLineArguments <Array> Unix (OS-) command line arguments broken into words |
|
111 |
CommandName has been stripped off. |
|
112 |
(initially set by the VM) |
|
113 |
||
114 |
SilentLoading <Boolean> suppresses messages during fileIn and in compiler |
|
115 |
(can be set to true from a customized main.c) |
|
116 |
||
117 |
Initializing <Boolean> true while (re-)initializing |
|
118 |
Controls the behavior of certain error |
|
119 |
reporters (for example: suppress dialogBoxes) |
|
120 |
while the system is not yet fit for full operation. |
|
121 |
||
122 |
StandAlone <Boolean> true, if this is a standalone app; |
|
123 |
if true the process scheduler watches for |
|
124 |
which processes are still running, and |
|
125 |
exits ST/X, when the last non-background |
|
126 |
and non-system process exits. |
|
6881 | 127 |
Can be set in an application-specific startup script, |
128 |
or, for standAlone programs, by C-code during initialization. |
|
3062
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
129 |
|
6853 | 130 |
HeadlessOperation if true, a non-existing Display connection |
131 |
<Boolean> will NOT lead to an error-exit during startup. |
|
132 |
Default is false. |
|
6881 | 133 |
Can be set in an application-specific startup script, |
134 |
or, for standAlone programs, by C-code during initialization. |
|
6853 | 135 |
|
136 |
LogDoits <Boolean> if true, doits are also logged in the changes |
|
137 |
file. Default is false, since the changes file |
|
138 |
may become huge if every tiny doIt is saved there ... |
|
139 |
||
140 |
LoadBinaries <Boolean> if true, we attempt to load classes rom a binary |
|
141 |
file, if present. If false, this is always suppressed. |
|
142 |
||
143 |
SaveEmergencyImage <Boolean> if true (the default), an emergency image |
|
144 |
is saved, if the main Display looses its |
|
145 |
connection. This is useful if you have a |
|
146 |
flaky display connection (serial line) |
|
147 |
and want to have your stuff saved automatically |
|
148 |
in case of a broken connection. |
|
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
149 |
|
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
150 |
strictly private classVariables (helpers): |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
151 |
|
6853 | 152 |
CachedClasses <Collection> known classes (cached for faster class enumeration) |
153 |
||
154 |
CachedAbbreviations |
|
155 |
<Dictionary> className to filename mappings |
|
156 |
||
157 |
RealSystemPath <Collection> cached collection of directories along the path |
|
158 |
which really exist. Caching avoids long checks |
|
159 |
for existing directories on broken NFS volumes. |
|
160 |
||
161 |
SourcePath <Collection> cached names of really existing directories |
|
162 |
BitmapPath These are remembered, since in NFS systems, |
|
163 |
ResourcePath the time to lookup files may become long |
|
164 |
BinaryPath (especially, if some directories are on machines |
|
165 |
FileInPath which are not up ...). |
|
166 |
Therefore, the set of really |
|
167 |
existing directories is cached when the SystemPath |
|
168 |
is walked the first time. |
|
169 |
A consequence is that you have to invoke |
|
170 |
flushSystemPath, when you create any of those |
|
171 |
directories while running |
|
172 |
(and want the running ST/X to look there) |
|
3062
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
173 |
|
1286 | 174 |
|
175 |
[author:] |
|
6853 | 176 |
Claus Gittinger |
3062
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
177 |
|
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
178 |
[see also:] |
6853 | 179 |
ObjectMemory |
70 | 180 |
" |
1 | 181 |
! ! |
182 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
183 |
!Smalltalk class methodsFor:'initialization'! |
1 | 184 |
|
617 | 185 |
initGlobalsFromEnvironment |
186 |
"setup globals from the shell-environment" |
|
187 |
||
188 |
|envString i langString terrString| |
|
189 |
||
5406 | 190 |
StandAlone isNil ifTrue:[ |
6853 | 191 |
StandAlone := false. |
5406 | 192 |
]. |
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
193 |
HeadlessOperation isNil ifTrue:[ |
6853 | 194 |
HeadlessOperation := false. |
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
195 |
]. |
5406 | 196 |
|
617 | 197 |
" |
198 |
extract Language and LanguageTerritory from LANG variable. |
|
5846 | 199 |
valid are for example: |
6853 | 200 |
en_en / en |
201 |
en_us |
|
202 |
en_gb |
|
203 |
de_de / de |
|
204 |
de_at (for Austria) |
|
5846 | 205 |
" |
206 |
||
207 |
Language := #en. |
|
994
6163ae7aaf9b
territory defaults to #us (instead of #usa)
Claus Gittinger <cg@exept.de>
parents:
977
diff
changeset
|
208 |
LanguageTerritory := #us. |
617 | 209 |
|
5846 | 210 |
|
211 |
"Format of LANG is: language[_territory][.codeset][@modifier] |
|
6853 | 212 |
language ISO-639 Language code |
213 |
territory ISO-3166 Contry code" |
|
5846 | 214 |
|
617 | 215 |
envString := OperatingSystem getEnvironment:'LANG'. |
3991
7b53bc45bf91
(isNil or:[isEmpty ]) -> (size == 0)
Claus Gittinger <cg@exept.de>
parents:
3988
diff
changeset
|
216 |
envString size > 0 ifTrue:[ |
6853 | 217 |
i := envString indexOf:$@. |
218 |
(i ~~ 0) ifTrue:[ |
|
219 |
envString := envString copyTo:(i - 1). |
|
220 |
LanguageModifier := (envString copyFrom:(i + 1)) asLowercase asSymbol. |
|
221 |
] ifFalse:[ |
|
222 |
LanguageModifier := nil. |
|
223 |
]. |
|
224 |
i := envString indexOf:$.. |
|
225 |
(i ~~ 0) ifTrue:[ |
|
226 |
envString := envString copyTo:(i - 1). |
|
227 |
LanguageCodeset := (envString copyFrom:(i + 1)) asLowercase asSymbol |
|
228 |
] ifFalse:[ |
|
229 |
LanguageCodeset := #'iso8859-1'. |
|
230 |
]. |
|
231 |
i := envString indexOf:$_. |
|
232 |
(i == 0) ifTrue:[ |
|
233 |
langString := envString. |
|
234 |
terrString := envString |
|
235 |
] ifFalse:[ |
|
236 |
langString := envString copyTo:(i - 1). |
|
237 |
terrString := envString copyFrom:(i + 1) |
|
238 |
]. |
|
239 |
Language := langString asLowercase asSymbol. |
|
240 |
LanguageTerritory := terrString asLowercase asSymbol |
|
617 | 241 |
]. |
242 |
||
243 |
" |
|
244 |
Smalltalk initGlobalsFromEnvironment |
|
245 |
" |
|
994
6163ae7aaf9b
territory defaults to #us (instead of #usa)
Claus Gittinger <cg@exept.de>
parents:
977
diff
changeset
|
246 |
|
6163ae7aaf9b
territory defaults to #us (instead of #usa)
Claus Gittinger <cg@exept.de>
parents:
977
diff
changeset
|
247 |
"Modified: 22.2.1996 / 16:59:12 / cg" |
617 | 248 |
! |
249 |
||
250 |
initInterrupts |
|
251 |
"initialize interrupts" |
|
252 |
||
253 |
OperatingSystem enableUserInterrupts. |
|
254 |
OperatingSystem enableHardSignalInterrupts. |
|
6390
41d5c47c33f0
Catch sigPWR and sigHUP on restart
Stefan Vogel <sv@exept.de>
parents:
6366
diff
changeset
|
255 |
OperatingSystem enableCrashSignalInterrupts. |
617 | 256 |
|
257 |
ObjectMemory userInterruptHandler:self. |
|
258 |
ObjectMemory signalInterruptHandler:self. |
|
259 |
ObjectMemory recursionInterruptHandler:self. |
|
260 |
||
963
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
261 |
" |
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
262 |
Smalltalk initInterrupts |
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
263 |
" |
2873
5bc8c81c4a34
Catch fpExeceptionInterrupt after image restart.
Stefan Vogel <sv@exept.de>
parents:
2844
diff
changeset
|
264 |
|
5bc8c81c4a34
Catch fpExeceptionInterrupt after image restart.
Stefan Vogel <sv@exept.de>
parents:
2844
diff
changeset
|
265 |
"Modified: 20.8.1997 / 09:35:49 / stefan" |
617 | 266 |
! |
267 |
||
268 |
initStandardStreams |
|
269 |
"initialize some well-known streams" |
|
270 |
||
271 |
Stdout := NonPositionableExternalStream forStdout. |
|
272 |
Stderr := NonPositionableExternalStream forStderr. |
|
273 |
Stdin := NonPositionableExternalStream forStdin. |
|
274 |
Printer := PrinterStream. |
|
275 |
Transcript := Stderr |
|
276 |
||
963
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
277 |
" |
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
278 |
Smalltalk initStandardStreams |
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
279 |
" |
617 | 280 |
! |
281 |
||
282 |
initStandardTools |
|
283 |
"predefine some tools which we will need later |
|
284 |
- if the view-classes exist, |
|
285 |
they will redefine Inspector and Debugger for graphical interfaces" |
|
286 |
||
287 |
"redefine debug-tools, if view-classes exist" |
|
288 |
||
289 |
Display notNil ifTrue:[ |
|
6853 | 290 |
InspectorView notNil ifTrue:[ |
291 |
Inspector := InspectorView |
|
292 |
]. |
|
293 |
DebugView notNil ifTrue:[ |
|
294 |
Debugger := DebugView |
|
295 |
]. |
|
296 |
Display initialize |
|
617 | 297 |
] |
963
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
298 |
|
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
299 |
" |
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
300 |
Smalltalk initStandardTools |
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
301 |
" |
617 | 302 |
! |
303 |
||
304 |
initSystemPath |
|
305 |
"setup path where system files are searched for. |
|
306 |
the default path is set to: |
|
6853 | 307 |
. |
308 |
$HOME (if defined) |
|
309 |
$HOME/.smalltalk (if defined & existing) |
|
310 |
$SMALLTALK_LIBDIR (if defined & existing) |
|
311 |
$STX_LIBDIR (if defined & existing) |
|
312 |
$STX_TOPDIR (if defined & existing) |
|
4001
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
313 |
|
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
314 |
unix: |
6853 | 315 |
/opt/smalltalk (if existing) |
316 |
/opt/smalltalk/release (if existing) |
|
317 |
/usr/local/lib/smalltalk (if existing) |
|
318 |
/usr/lib/smalltalk (if existing) |
|
319 |
/lib/smalltalk (if existing) |
|
4001
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
320 |
|
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
321 |
win32: |
6853 | 322 |
\smalltalk (if existing) |
323 |
\programs\smalltalk (if existing) |
|
324 |
\programs\exept\smalltalk (if existing) |
|
325 |
registry info (if present) |
|
4001
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
326 |
|
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
327 |
vms: |
6853 | 328 |
$stx:lib (if existing) |
329 |
$stx:root (if existing) |
|
617 | 330 |
|
331 |
of course, it is possible to add entries from the 'smalltalk.rc' |
|
332 |
startup file; add expressions such as: |
|
6853 | 333 |
Smalltalk systemPath addFirst:'/foo/bar/baz'. |
334 |
or: |
|
335 |
Smalltalk systemPath addLast:'/fee/foe/foo'. |
|
4001
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
336 |
|
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
337 |
However, smalltalk.rc itself must be found along the above path. |
617 | 338 |
" |
339 |
||
2928 | 340 |
ChangeFileName := 'changes'. |
341 |
OperatingSystem isVMSlike ifTrue:[ |
|
6853 | 342 |
BitmapDirName := 'bitmaps.dir'. |
343 |
BinaryDirName := 'binary.dir'. |
|
344 |
SourceDirName := 'source.dir'. |
|
345 |
ResourceDirName := 'resources.dir'. |
|
346 |
FileInDirName := 'filein.dir'. |
|
347 |
PackageDirName := 'packages.dir'. |
|
2928 | 348 |
] ifFalse:[ |
6853 | 349 |
BitmapDirName := 'bitmaps'. |
350 |
BinaryDirName := 'binary'. |
|
351 |
SourceDirName := 'source'. |
|
352 |
ResourceDirName := 'resources'. |
|
353 |
FileInDirName := 'fileIn'. |
|
354 |
PackageDirName := 'packages'. |
|
2928 | 355 |
]. |
356 |
||
680 | 357 |
SystemPath isNil ifTrue:[ |
6853 | 358 |
SystemPath := OperatingSystem defaultSystemPath. |
359 |
self flushPathCaches |
|
5139 | 360 |
]. |
361 |
||
5144 | 362 |
PackagePath isNil ifTrue:[ |
6853 | 363 |
PackagePath := OperatingSystem defaultPackagePath. |
5144 | 364 |
]. |
617 | 365 |
|
366 |
" |
|
367 |
Smalltalk initSystemPath |
|
368 |
Smalltalk systemPath |
|
369 |
" |
|
5139 | 370 |
|
5145 | 371 |
"Modified: / 24.12.1999 / 00:23:35 / cg" |
617 | 372 |
! |
373 |
||
374 |
initUserPreferences |
|
375 |
"setup other stuff" |
|
376 |
||
377 |
LogDoits := false. |
|
378 |
LoadBinaries := false. |
|
6854 | 379 |
SaveEmergencyImage := (StandAlone ~~ true). |
3062
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
380 |
|
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
381 |
"Modified: / 24.10.1997 / 18:22:47 / cg" |
617 | 382 |
! |
383 |
||
384 |
initializeModules |
|
385 |
"perform module specific initialization and |
|
386 |
send #initialize to all classes. |
|
387 |
Notice: this is not called when an image is restarted" |
|
4963 | 388 |
|
389 |
" TODO: |
|
390 |
change VM/stc to invoke #Smalltalk initializeClass:aClass |
|
391 |
(instead of directly sending #initialize) |
|
392 |
This will allow us to wrap an exception handler around classes |
|
393 |
#initialize methods." |
|
394 |
||
617 | 395 |
%{ |
1688
8a42db1eea60
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1682
diff
changeset
|
396 |
__init_registered_modules__(3); |
4963 | 397 |
|
1481 | 398 |
@global(DemoMode) = __getDemoMode() ? true : false; |
5410 | 399 |
RETURN (self); |
400 |
%}. |
|
401 |
^ self primitiveFailed |
|
402 |
||
617 | 403 |
! |
404 |
||
325 | 405 |
initializeSystem |
24 | 406 |
"initialize all other classes; setup dispatcher processes etc. |
3499 | 407 |
This one is the very first entry into the smalltalk world, |
408 |
right after startup, ususally immediately followed by Smalltalk>>start. |
|
2090
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
409 |
Notice: |
7525 | 410 |
this is not called when an image is restarted; in this |
411 |
case the show starts in Smalltalk>>restart." |
|
211 | 412 |
|
6841
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
413 |
|idx| |
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
414 |
|
3499 | 415 |
Initializing := true. |
6841
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
416 |
|
3499 | 417 |
AbstractOperatingSystem initializeConcreteClass. |
418 |
||
5400 | 419 |
CommandLineArguments isNil ifTrue:[ |
7525 | 420 |
CommandLineArguments := #('stx'). |
5400 | 421 |
]. |
4006
c7ad38c52eb9
must set CommandLineArguments earlier (to be available in initializeSystem)
Claus Gittinger <cg@exept.de>
parents:
4001
diff
changeset
|
422 |
CommandLine := CommandLineArguments copy. |
c7ad38c52eb9
must set CommandLineArguments earlier (to be available in initializeSystem)
Claus Gittinger <cg@exept.de>
parents:
4001
diff
changeset
|
423 |
CommandLineArguments := CommandLineArguments asOrderedCollection. |
6842 | 424 |
CommandName := CommandLineArguments removeFirst. "/ the command |
4006
c7ad38c52eb9
must set CommandLineArguments earlier (to be available in initializeSystem)
Claus Gittinger <cg@exept.de>
parents:
4001
diff
changeset
|
425 |
|
4028
b46539f16af5
added --silentStartup argument
Claus Gittinger <cg@exept.de>
parents:
4026
diff
changeset
|
426 |
SilentLoading := (CommandLineArguments includes:'--silentStartup'). |
348 | 427 |
|
6841
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
428 |
DebuggingStandAlone := false. |
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
429 |
|
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
430 |
StandAlone ifTrue:[ |
7525 | 431 |
InfoPrinting := false. |
432 |
ObjectMemory infoPrinting:false. |
|
433 |
||
434 |
idx := CommandLineArguments indexOf:'--debug'. |
|
435 |
idx ~~ 0 ifTrue:[ |
|
436 |
DebuggingStandAlone := true. |
|
437 |
]. |
|
438 |
DebuggingStandAlone ifTrue:[ |
|
439 |
Inspector := MiniInspector. |
|
440 |
Debugger := MiniDebugger. |
|
441 |
]. |
|
6841
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
442 |
] ifFalse:[ |
7525 | 443 |
"/ |
444 |
"/ define low-level debugging tools - graphical classes are not prepared yet |
|
445 |
"/ to handle things. |
|
446 |
"/ This will bring us into the MiniDebugger when an error occurs during startup. |
|
447 |
"/ |
|
448 |
Inspector := MiniInspector. |
|
449 |
Debugger := MiniDebugger. |
|
6841
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
450 |
]. |
1 | 451 |
|
2090
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
452 |
"/ |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
453 |
"/ start catching SIGSEGV and SIGBUS |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
454 |
"/ |
713
32540afb8ffc
setup SIGSEGV/SIGBUS handling early - to catch those during startup
Claus Gittinger <cg@exept.de>
parents:
706
diff
changeset
|
455 |
OperatingSystem enableHardSignalInterrupts. |
32540afb8ffc
setup SIGSEGV/SIGBUS handling early - to catch those during startup
Claus Gittinger <cg@exept.de>
parents:
706
diff
changeset
|
456 |
|
1 | 457 |
self initGlobalsFromEnvironment. |
458 |
||
2090
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
459 |
"/ |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
460 |
"/ sorry - there are some, which MUST be initialized before .. |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
461 |
"/ reason: if any error happens during init, we need Signals, Stdout etc. to be there |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
462 |
"/ |
1 | 463 |
Object initialize. |
423 | 464 |
Signal initialize. |
2907 | 465 |
Filename initialize. |
326 | 466 |
ObjectMemory initialize. |
2504
ece15ffbcb69
Initialize OperatingSystem early (needed for some signals).
Stefan Vogel <sv@exept.de>
parents:
2485
diff
changeset
|
467 |
OperatingSystem initialize. |
596
ecb1d732dade
require Stream to be initialized before ExternalStream is
Claus Gittinger <cg@exept.de>
parents:
592
diff
changeset
|
468 |
Stream initialize. |
7525 | 469 |
PositionableStream initialize. |
1 | 470 |
ExternalStream initialize. |
211 | 471 |
|
472 |
self initStandardStreams. "/ setup Stdin, Stdout etc. |
|
1 | 473 |
|
2090
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
474 |
"/ |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
475 |
"/ sorry, path must be set before ... |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
476 |
"/ 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
|
477 |
"/ |
1 | 478 |
self initSystemPath. |
479 |
||
480 |
Compiler := ByteCodeCompiler. |
|
481 |
Compiler isNil ifTrue:[ |
|
7525 | 482 |
" |
483 |
ByteCodeCompiler is not in the system (i.e. has not been linked in) |
|
484 |
this allows at least immediate evaluations for runtime systems without compiler |
|
485 |
NOTICE: a parser is always needed, otherwise we cannot read resource files etc. |
|
486 |
" |
|
487 |
Compiler := Parser |
|
1 | 488 |
]. |
489 |
||
2090
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
490 |
"/ |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
491 |
"/ another one, to be initialized before others |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
492 |
"/ |
2077
6b5dc412dd15
must initialize Processor before doing modulInits
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
493 |
ProcessorScheduler initialize. |
6b5dc412dd15
must initialize Processor before doing modulInits
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
494 |
|
2090
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
495 |
"/ |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
496 |
"/ now, finally, initialize all other classes |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
497 |
"/ |
325 | 498 |
self initializeModules. |
499 |
||
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
500 |
ImageStartTime := AbsoluteTime now. |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
501 |
|
70 | 502 |
self initInterrupts. |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
503 |
self initUserPreferences. |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
504 |
|
2090
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
505 |
"/ |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
506 |
"/ 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
|
507 |
"/ 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
|
508 |
"/ (especially: streams and signals can now be used) |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
509 |
"/ |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
510 |
ObjectMemory changed:#initialized. |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
511 |
|
2504
ece15ffbcb69
Initialize OperatingSystem early (needed for some signals).
Stefan Vogel <sv@exept.de>
parents:
2485
diff
changeset
|
512 |
"Modified: 8.1.1997 / 19:58:12 / stefan" |
2907 | 513 |
"Modified: 7.9.1997 / 23:34:44 / cg" |
325 | 514 |
! |
1 | 515 |
|
617 | 516 |
isInitialized |
517 |
"this returns true, if the system is properly initialized; |
|
518 |
i.e. false during startup. Especially, the whole viewing stuff is |
|
519 |
not working correctly until initialized." |
|
520 |
||
521 |
^ Initializing not |
|
1 | 522 |
! |
523 |
||
477
8710aba7876b
oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents:
457
diff
changeset
|
524 |
reinitStandardStreams |
8710aba7876b
oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents:
457
diff
changeset
|
525 |
"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
|
526 |
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
|
527 |
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
|
528 |
(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
|
529 |
|
8710aba7876b
oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents:
457
diff
changeset
|
530 |
Stdout reOpen. Stderr reOpen. Stdin reOpen. |
161 | 531 |
! ! |
532 |
||
7295 | 533 |
!Smalltalk class methodsFor:'Compatibility-Squeak'! |
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
534 |
|
4872 | 535 |
beep |
536 |
Screen current beep |
|
537 |
! |
|
538 |
||
4599 | 539 |
garbageCollect |
540 |
ObjectMemory garbageCollect |
|
541 |
! |
|
542 |
||
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
543 |
garbageCollectMost |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
544 |
"collect recently created garbage; return the amount of freeSpace. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
545 |
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
|
546 |
newSpace + freeListSpace is returned." |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
547 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
548 |
ObjectMemory scavenge. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
549 |
^ ObjectMemory freeSpace |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
550 |
+ (ObjectMemory newSpaceSize - ObjectMemory newSpaceUsed) |
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 |
! |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
553 |
|
4870 | 554 |
isMorphic |
555 |
^ false |
|
556 |
! |
|
557 |
||
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
558 |
registerExternalObject: anObject |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
559 |
"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
|
560 |
If it is already there, just return its index. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
561 |
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
|
562 |
primitive code (via the global Smalltalk:SpecialObjectArray)" |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
563 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
564 |
| objects firstEmptyIndex obj sz newObjects | |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
565 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
566 |
objects := SpecialObjectArray. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
567 |
objects isNil ifTrue:[ |
6853 | 568 |
objects := Array new:5. |
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 |
"find the first empty slot and look if already registered" |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
572 |
firstEmptyIndex := 0. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
573 |
1 to: objects size do: [:i | |
6853 | 574 |
obj := objects at: i. |
575 |
obj == anObject ifTrue: [^ i]. "object already there, just return its index" |
|
576 |
(obj == nil and: [firstEmptyIndex = 0]) ifTrue: [ |
|
577 |
firstEmptyIndex := i |
|
578 |
] |
|
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
579 |
]. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
580 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
581 |
"if no empty slots, expand the array" |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
582 |
firstEmptyIndex = 0 ifTrue: [ |
6853 | 583 |
sz := objects size. |
584 |
newObjects := objects species new: sz + 20. "grow linearly" |
|
585 |
newObjects replaceFrom: 1 to: sz with: objects startingAt: 1. |
|
586 |
firstEmptyIndex := sz + 1. |
|
587 |
SpecialObjectArray := newObjects. |
|
588 |
objects := newObjects |
|
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
589 |
]. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
590 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
591 |
objects at: firstEmptyIndex put: anObject. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
592 |
^ firstEmptyIndex |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
593 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
594 |
! |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
595 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
596 |
unregisterExternalObject: anObject |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
597 |
"Unregister the given object in the external objects array. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
598 |
Do nothing if it isn't registered." |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
599 |
|
5913 | 600 |
|objects| |
601 |
||
602 |
anObject isNil ifTrue:[^ self]. |
|
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
603 |
objects := SpecialObjectArray. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
604 |
1 to: objects size do: [:i | |
6853 | 605 |
(objects at: i) == anObject ifTrue: [ |
606 |
objects at: i put: nil |
|
607 |
] |
|
5913 | 608 |
]. |
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
609 |
! ! |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
610 |
|
7295 | 611 |
!Smalltalk class methodsFor:'Compatibility-V''Age'! |
6722
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
612 |
|
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
613 |
allClassesImplementing:aSelector |
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
614 |
^ self allClasses select:[:cls | cls implements:aSelector]. |
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
615 |
! ! |
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
616 |
|
7295 | 617 |
!Smalltalk class methodsFor:'Compatibility-VW5.4'! |
6094
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
618 |
|
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
619 |
defineClass:nameSymbol superclass:superclass indexedType:indexed private:private instanceVariableNames:instVars classInstanceVariableNames:classInstVars imports:imports category:category attributes:annotations |
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
620 |
|newClass| |
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
621 |
|
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
622 |
indexed == #none ifTrue:[ |
6853 | 623 |
newClass := superclass |
624 |
subclass:nameSymbol |
|
625 |
instanceVariableNames:instVars |
|
626 |
classVariableNames:'' |
|
627 |
poolDictionaries:'' |
|
628 |
category:category |
|
629 |
inEnvironment:self. |
|
630 |
classInstVars size > 0 ifTrue:[ |
|
631 |
newClass class instanceVariableNames:classInstVars. |
|
632 |
]. |
|
633 |
^ newClass |
|
6851 | 634 |
]. |
635 |
self shouldImplement. |
|
6094
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
636 |
! ! |
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
637 |
|
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
638 |
!Smalltalk class methodsFor:'accessing'! |
453 | 639 |
|
3083 | 640 |
associationAt:aKey |
641 |
"return a key-value association for aKey. |
|
642 |
Since ST/X's Smalltalk as no real dictionary, this is |
|
643 |
simulated here." |
|
644 |
||
645 |
|val| |
|
646 |
||
647 |
val := self at:aKey ifAbsent:nil. |
|
648 |
val isNil ifTrue:[^ nil]. |
|
649 |
^ Association key:aKey value:val |
|
650 |
||
651 |
"Created: / 1.11.1997 / 13:27:20 / cg" |
|
652 |
! |
|
653 |
||
3610
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
654 |
associationAt:aKey ifAbsent:exceptionBlock |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
655 |
"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
|
656 |
from exceptionBlock, if no such key is present. |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
657 |
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
|
658 |
simulated here." |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
659 |
|
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
660 |
|val| |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
661 |
|
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
662 |
val := self at:aKey ifAbsent:nil. |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
663 |
val isNil ifTrue:[^ exceptionBlock value]. |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
664 |
^ Association key:aKey value:val |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
665 |
|
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
666 |
"Created: / 18.6.1998 / 17:05:24 / cg" |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
667 |
! |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
668 |
|
453 | 669 |
at:aKey |
670 |
"retrieve the value stored under aKey, a symbol. |
|
1956 | 671 |
Return nil if not present |
672 |
(this will be changed to trigger an error - better use #at:ifAbsent:)" |
|
453 | 673 |
|
6851 | 674 |
aKey class == String ifTrue:[self error:'expected symbol']. |
6080
15ea3cbf6003
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
6074
diff
changeset
|
675 |
|
453 | 676 |
%{ /* NOCONTEXT */ |
677 |
RETURN ( __GLOBAL_GET(aKey) ); |
|
5406 | 678 |
%}. |
5410 | 679 |
^ self primitiveFailed |
453 | 680 |
! |
681 |
||
682 |
at:aKey ifAbsent:aBlock |
|
683 |
"retrieve the value stored at aKey. |
|
684 |
If there is nothing stored under this key, return the value of |
|
685 |
the evaluation of aBlock." |
|
686 |
||
687 |
(self includesKey:aKey) ifTrue:[ |
|
6853 | 688 |
^ self at:aKey |
453 | 689 |
]. |
690 |
^ aBlock value |
|
691 |
||
692 |
" |
|
693 |
Smalltalk at:#fooBar <- returns nil |
|
694 |
Smalltalk at:#fooBar ifAbsent:['sorry'] <- no error |
|
695 |
" |
|
696 |
! |
|
697 |
||
4870 | 698 |
at:aKey ifPresent:aBlock |
699 |
"try to retrieve the value stored at aKey. |
|
700 |
If there is nothing stored under this key, do nothing. |
|
701 |
Otherwise, evaluate aBlock, passing the retrieved value as argument." |
|
702 |
||
703 |
(self includesKey:aKey) ifTrue:[ |
|
6853 | 704 |
^ aBlock value:(self at:aKey) |
4870 | 705 |
]. |
706 |
^ nil |
|
707 |
||
708 |
" |
|
709 |
Smalltalk at:#fooBar ifPresent:[:what | Transcript showCR:what]. |
|
710 |
Smalltalk at:#Object ifPresent:[:what | Transcript showCR:what]. |
|
711 |
" |
|
712 |
||
713 |
! |
|
714 |
||
453 | 715 |
at:aKey put:aValue |
1222 | 716 |
"store the argument aValue under aKey, a symbol. |
717 |
Return aValue (sigh)." |
|
453 | 718 |
|
719 |
|oldValue| |
|
720 |
||
721 |
%{ |
|
722 |
oldValue = __GLOBAL_SET(aKey, aValue, (OBJ *)0); |
|
723 |
%}. |
|
724 |
CachedClasses notNil ifTrue:[ |
|
6853 | 725 |
oldValue isBehavior ifTrue:[ |
726 |
oldValue name == aKey ifTrue:[ |
|
727 |
CachedClasses remove:oldValue ifAbsent:[] |
|
728 |
] |
|
729 |
]. |
|
730 |
aValue isBehavior ifTrue:[ |
|
1956 | 731 |
"/ aValue isMeta ifTrue:[ |
732 |
"/ "/ this should not happen |
|
733 |
"/ ('SMALLTALK: store a Metaclass: ' , aValue name , ' as ' , aKey) infoPrintCR. |
|
734 |
"/ ]. |
|
735 |
||
6853 | 736 |
aValue name == aKey ifTrue:[ |
737 |
CachedClasses add:aValue |
|
738 |
] ifFalse:[ |
|
739 |
CachedClasses := nil |
|
740 |
] |
|
741 |
]. |
|
453 | 742 |
]. |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
743 |
^ aValue. |
1955 | 744 |
"/ |
745 |
"/%{ /* NOCONTEXT */ |
|
746 |
"/ (void) __GLOBAL_SET(aKey, aValue, (OBJ *)0); |
|
747 |
"/%}. |
|
748 |
"/ CachedClasses := nil. |
|
749 |
"/ ^ aValue |
|
1222 | 750 |
|
751 |
"Modified: 19.4.1996 / 11:31:49 / cg" |
|
453 | 752 |
! |
753 |
||
617 | 754 |
includesKey:aKey |
755 |
"return true, if the key is known" |
|
453 | 756 |
|
6231 | 757 |
"/ for debugging - this is a common mistake, |
758 |
"/ to try to access a class by nameString, instead |
|
759 |
"/ of by symbol. |
|
760 |
||
761 |
"/ aKey class == String ifTrue:[self halt]. |
|
4391 | 762 |
|
453 | 763 |
%{ /* NOCONTEXT */ |
617 | 764 |
RETURN ( __GLOBAL_KEYKNOWN(aKey) ); |
5410 | 765 |
%}. |
766 |
^ self primitiveFailed |
|
453 | 767 |
! |
768 |
||
769 |
keyAtValue:anObject |
|
770 |
"return the symbol under which anObject is stored - or nil" |
|
771 |
||
772 |
self keysDo:[:aKey | |
|
6853 | 773 |
(self at:aKey) == anObject ifTrue:[^ aKey] |
453 | 774 |
]. |
775 |
^ nil |
|
776 |
||
777 |
"Smalltalk keyAtValue:Object" |
|
778 |
! |
|
779 |
||
780 |
keys |
|
781 |
"return a collection with all keys in the Smalltalk dictionary" |
|
782 |
||
783 |
|keys| |
|
784 |
||
785 |
keys := IdentitySet new. |
|
786 |
self keysDo:[:k | keys add:k]. |
|
787 |
^ keys |
|
617 | 788 |
! |
789 |
||
790 |
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
|
791 |
"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
|
792 |
WARNING: |
6853 | 793 |
this is somewhat dangerous: conceptionally, the association is removed, |
794 |
to which machine & byte compiled code refers if it accesses a global. |
|
795 |
If there are still global accesses in some literalArray or from machine-compiled code, |
|
796 |
it continues to reference the globals value via that obsolete association and gets a nil |
|
797 |
value. (which is correct) |
|
798 |
However, if that global is later reintroduced, a new association will be created and |
|
799 |
the new global now referenced via the new association. |
|
800 |
The old accesses will still see nil, although the globals value is actually non-nil |
|
801 |
(this is questionable). |
|
802 |
To avoid this problem, the #removeClass: method never removed the key." |
|
617 | 803 |
|
804 |
CachedClasses := nil. |
|
805 |
||
806 |
%{ /* NOCONTEXT */ |
|
807 |
RETURN ( __GLOBAL_REMOVE(aKey) ); |
|
5410 | 808 |
%}. |
809 |
^ self primitiveFailed |
|
810 |
||
2705
ed04a67da248
added #values for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
2681
diff
changeset
|
811 |
! |
ed04a67da248
added #values for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
2681
diff
changeset
|
812 |
|
ed04a67da248
added #values for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
2681
diff
changeset
|
813 |
values |
ed04a67da248
added #values for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
2681
diff
changeset
|
814 |
"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
|
815 |
|
ed04a67da248
added #values for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
2681
diff
changeset
|
816 |
|values| |
ed04a67da248
added #values for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
2681
diff
changeset
|
817 |
|
ed04a67da248
added #values for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
2681
diff
changeset
|
818 |
values := OrderedCollection new. |
ed04a67da248
added #values for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
2681
diff
changeset
|
819 |
self do:[:v | values add:v]. |
ed04a67da248
added #values for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
2681
diff
changeset
|
820 |
^ values |
ed04a67da248
added #values for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
2681
diff
changeset
|
821 |
|
ed04a67da248
added #values for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
2681
diff
changeset
|
822 |
"Created: 20.6.1997 / 16:58:28 / cg" |
453 | 823 |
! ! |
824 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
825 |
!Smalltalk class methodsFor:'binary storage'! |
453 | 826 |
|
2476 | 827 |
addGlobalsForBinaryStorageTo:globalDictionary |
453 | 828 |
|pools| |
829 |
||
830 |
pools := Set new. |
|
2465
1dfcacbbd376
ignore nil values when adding globals (binary storage)
Claus Gittinger <cg@exept.de>
parents:
2418
diff
changeset
|
831 |
|
879 | 832 |
self keysAndValuesDo:[:key :value | |
6853 | 833 |
(key includes:$:) ifFalse:[ "/ skip classVars |
834 |
(value ~~ self |
|
835 |
and:[value notNil]) ifTrue:[ |
|
836 |
value isClass ifTrue:[ |
|
837 |
value addGlobalsForBinaryStorageTo:globalDictionary. |
|
838 |
pools addAll:value sharedPools |
|
839 |
] ifFalse:[ |
|
840 |
globalDictionary at:(key->value) put:self |
|
841 |
]. |
|
842 |
value notNil ifTrue:[ |
|
843 |
globalDictionary at:value put:self |
|
844 |
] |
|
845 |
] |
|
846 |
] |
|
453 | 847 |
]. |
848 |
||
849 |
pools do:[:poolDictionary| |
|
6853 | 850 |
poolDictionary addGlobalsForBinaryStorageTo:globalDictionary |
453 | 851 |
] |
2465
1dfcacbbd376
ignore nil values when adding globals (binary storage)
Claus Gittinger <cg@exept.de>
parents:
2418
diff
changeset
|
852 |
|
1dfcacbbd376
ignore nil values when adding globals (binary storage)
Claus Gittinger <cg@exept.de>
parents:
2418
diff
changeset
|
853 |
"Modified: 19.3.1997 / 18:15:25 / cg" |
2476 | 854 |
"Created: 21.3.1997 / 15:40:31 / cg" |
453 | 855 |
! |
856 |
||
879 | 857 |
storeBinaryDefinitionOf:anObject on:stream manager:manager |
453 | 858 |
|string| |
859 |
||
860 |
anObject class == Association ifTrue:[ |
|
6853 | 861 |
string := 'Smalltalk associationAt: ', anObject key storeString |
453 | 862 |
] ifFalse: [ |
6853 | 863 |
string := 'Smalltalk at: ', (self keyAtValue: anObject) storeString |
453 | 864 |
]. |
865 |
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
|
866 |
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
|
867 |
"/ 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
|
868 |
|
1dfcacbbd376
ignore nil values when adding globals (binary storage)
Claus Gittinger <cg@exept.de>
parents:
2418
diff
changeset
|
869 |
"Modified: 19.3.1997 / 18:49:14 / cg" |
453 | 870 |
! ! |
871 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
872 |
!Smalltalk class methodsFor:'browsing'! |
453 | 873 |
|
617 | 874 |
browseAllCallsOn:aSelectorSymbol |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
875 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
876 |
|
617 | 877 |
"startup a browser for all methods sending a particular message" |
878 |
||
6020 | 879 |
UserPreferences systemBrowserClass browseAllCallsOn:aSelectorSymbol |
617 | 880 |
|
881 |
" |
|
882 |
Smalltalk browseAllCallsOn:#at:put: |
|
883 |
" |
|
884 |
! |
|
885 |
||
886 |
browseAllSelect:aBlock |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
887 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
888 |
|
617 | 889 |
"startup a browser for all methods for which aBlock returns true" |
890 |
||
6020 | 891 |
UserPreferences systemBrowserClass browseAllSelect:aBlock |
617 | 892 |
|
893 |
" |
|
894 |
Smalltalk browseAllSelect:[:m | m literals isNil] |
|
895 |
" |
|
896 |
! |
|
897 |
||
453 | 898 |
browseChanges |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
899 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
900 |
|
453 | 901 |
"startup a changes browser" |
902 |
||
903 |
ChangesBrowser notNil ifTrue:[ |
|
6853 | 904 |
ChangesBrowser open |
453 | 905 |
] ifFalse:[ |
6853 | 906 |
self warn:'no ChangesBrowser built in' |
453 | 907 |
] |
908 |
||
909 |
" |
|
910 |
Smalltalk browseChanges |
|
911 |
" |
|
912 |
! |
|
913 |
||
6970 | 914 |
browseClass:aClass |
915 |
"{ Pragma: +optSpace }" |
|
916 |
||
917 |
"startup a browser on aClass" |
|
918 |
||
919 |
UserPreferences systemBrowserClass browseClass:aClass |
|
920 |
||
921 |
" |
|
922 |
Smalltalk browseClass:Array |
|
923 |
" |
|
924 |
! |
|
925 |
||
6819 | 926 |
browseImplementorsMatching:aSelectorSymbolOrMatchPattern |
927 |
"{ Pragma: +optSpace }" |
|
928 |
||
929 |
"startup a browser for all methods implementing a message matching" |
|
930 |
||
931 |
UserPreferences systemBrowserClass browseImplementorsMatching:aSelectorSymbolOrMatchPattern |
|
932 |
||
933 |
" |
|
934 |
Smalltalk browseImplementorsOf:#'at:put:' |
|
935 |
Smalltalk browseImplementorsMatching:#'at:*' |
|
936 |
" |
|
937 |
! |
|
938 |
||
453 | 939 |
browseImplementorsOf:aSelectorSymbol |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
940 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
941 |
|
453 | 942 |
"startup a browser for all methods implementing a particular message" |
943 |
||
6020 | 944 |
UserPreferences systemBrowserClass browseImplementorsOf:aSelectorSymbol |
453 | 945 |
|
946 |
" |
|
947 |
Smalltalk browseImplementorsOf:#at:put: |
|
948 |
" |
|
6970 | 949 |
! |
950 |
||
951 |
browseInClass:aClass |
|
952 |
"{ Pragma: +optSpace }" |
|
953 |
||
954 |
"startup a full browser showing aClass" |
|
955 |
||
956 |
UserPreferences systemBrowserClass openInClass:aClass |
|
957 |
||
958 |
" |
|
959 |
Smalltalk browseInClass:Array |
|
960 |
" |
|
961 |
! |
|
962 |
||
963 |
browseInClass:aClass selector:selector |
|
964 |
"{ Pragma: +optSpace }" |
|
965 |
||
966 |
"startup a full browser showing aClass>>selector" |
|
967 |
||
968 |
UserPreferences systemBrowserClass openInClass:aClass selector:selector |
|
969 |
||
970 |
" |
|
971 |
Smalltalk browseInClass:Array selector:#at: |
|
972 |
" |
|
453 | 973 |
! ! |
974 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
975 |
!Smalltalk class methodsFor:'class management'! |
453 | 976 |
|
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
977 |
changeCategoryOf:aClass to:newCategory |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
978 |
"change a classes category, add a change record, |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
979 |
send change notifications" |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
980 |
|
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
981 |
|ns| |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
982 |
|
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
983 |
aClass category ~= newCategory ifTrue:[ |
6853 | 984 |
aClass category:(newCategory withoutSeparators asSymbol). |
985 |
Project addChangeRecordForClass:aClass. |
|
986 |
||
987 |
"notify change of category" |
|
988 |
ns := aClass environment ? self. |
|
989 |
ns changed:#organization. |
|
990 |
ns ~~ self ifTrue:[ |
|
991 |
self changed:#organization. |
|
992 |
] |
|
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
993 |
]. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
994 |
|
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
995 |
" |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
996 |
Smalltalk changeCategoryOf:NewApplication to:#myApplications |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
997 |
" |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
998 |
|
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
999 |
"Modified: / 11.2.2000 / 11:36:27 / cg" |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1000 |
! |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1001 |
|
5306
806182135518
VW5i compatibility defineNameSpace: added
Claus Gittinger <cg@exept.de>
parents:
5285
diff
changeset
|
1002 |
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
|
1003 |
NameSpace name:name |
5306
806182135518
VW5i compatibility defineNameSpace: added
Claus Gittinger <cg@exept.de>
parents:
5285
diff
changeset
|
1004 |
|
806182135518
VW5i compatibility defineNameSpace: added
Claus Gittinger <cg@exept.de>
parents:
5285
diff
changeset
|
1005 |
! |
806182135518
VW5i compatibility defineNameSpace: added
Claus Gittinger <cg@exept.de>
parents:
5285
diff
changeset
|
1006 |
|
5892
df4661be9da2
added individual cachedClass-flush
Claus Gittinger <cg@exept.de>
parents:
5881
diff
changeset
|
1007 |
flushCachedClass:aClass |
5895 | 1008 |
CachedClasses notNil ifTrue:[ |
6853 | 1009 |
CachedClasses remove:aClass ifAbsent:[] |
5895 | 1010 |
] |
5892
df4661be9da2
added individual cachedClass-flush
Claus Gittinger <cg@exept.de>
parents:
5881
diff
changeset
|
1011 |
! |
df4661be9da2
added individual cachedClass-flush
Claus Gittinger <cg@exept.de>
parents:
5881
diff
changeset
|
1012 |
|
453 | 1013 |
flushCachedClasses |
7430
e07639f21626
flush subclassInfo when cached classes are flushed
Stefan Vogel <sv@exept.de>
parents:
7366
diff
changeset
|
1014 |
CachedClasses := nil. |
e07639f21626
flush subclassInfo when cached classes are flushed
Stefan Vogel <sv@exept.de>
parents:
7366
diff
changeset
|
1015 |
Class flushSubclassInfo. |
5580
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1016 |
|
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1017 |
" |
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1018 |
Smalltalk flushCachedClasses |
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1019 |
" |
453 | 1020 |
! |
1021 |
||
1022 |
removeClass:aClass |
|
1023 |
"remove the argument, aClass from the smalltalk dictionary; |
|
1024 |
we have to flush the caches since these methods are now void. |
|
1025 |
Also, class variables of aClass are removed." |
|
1026 |
||
4781 | 1027 |
|sym cSym names oldName oldNameSym actualName wrongName ns ons| |
453 | 1028 |
|
4099 | 1029 |
aClass isNil ifTrue:[^ self]. |
4781 | 1030 |
|
453 | 1031 |
oldName := aClass name. |
4781 | 1032 |
sym := oldNameSym := oldName asSymbol. |
1033 |
((self at:oldNameSym) == aClass) ifFalse:[ |
|
7181 | 1034 |
"check other name ..." |
1035 |
(self includes:aClass) ifFalse:[ |
|
1036 |
'Smalltalk [warning]: no such class: ' errorPrint. oldName errorPrintCR. |
|
1037 |
^ self |
|
1038 |
]. |
|
1039 |
" |
|
1040 |
the class has changed its name - without telling me ... |
|
1041 |
what should be done in this case ? |
|
1042 |
" |
|
1043 |
'Smalltalk [warning]: class ' errorPrint. oldName errorPrint. |
|
1044 |
' has changed its name' errorPrintCR. |
|
1045 |
||
1046 |
"/ |
|
1047 |
"/ might be an alias (i.e. removing a compatibility name) |
|
1048 |
"/ |
|
1049 |
actualName := self keyAtValue:aClass. |
|
1050 |
('Smalltalk [info]: ' , oldName , ' is actually stored as ' , actualName , '.') infoPrintCR. |
|
1051 |
sym := actualName asSymbol. |
|
1052 |
oldName := actualName asString. |
|
1053 |
wrongName := true. |
|
453 | 1054 |
]. |
1055 |
||
4781 | 1056 |
ns := aClass nameSpace. |
1057 |
aClass topOwningClass notNil ifTrue:[ |
|
7181 | 1058 |
ons := aClass topOwningClass nameSpace |
4781 | 1059 |
]. |
1060 |
||
453 | 1061 |
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
|
1062 |
|
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1063 |
"/ |
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1064 |
"/ 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
|
1065 |
"/ |
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1066 |
"/ self removeKey:sym. "/ remove key - this actually fails, if there are |
7181 | 1067 |
"/ still compiled code references." |
453 | 1068 |
|
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1069 |
"remove private classes" |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1070 |
|
2485
9f4a11a4521f
new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents:
2476
diff
changeset
|
1071 |
aClass privateClassesSorted do:[:somePrivateClass | |
7181 | 1072 |
aClass privateClassesAt:(somePrivateClass nameWithoutPrefix) asSymbol put:nil. |
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1073 |
]. |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1074 |
|
453 | 1075 |
"remove class variables" |
1076 |
||
1077 |
names := aClass classVariableString asCollectionOfWords. |
|
1078 |
names do:[:name | |
|
7181 | 1079 |
cSym := (sym , ':' , name) asSymbol. |
1080 |
self at:cSym asSymbol put:nil. |
|
1081 |
||
1082 |
"/ |
|
1083 |
"/ see comment in removeKey: on why we dont remove it here |
|
1084 |
"/ |
|
1085 |
"/ self removeKey:cSym |
|
453 | 1086 |
]. |
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1087 |
|
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1088 |
|
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1089 |
"/ actually could get along with less flushing |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1090 |
"/ (entries for aClass and subclasses only) |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1091 |
"/ 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
|
1092 |
"/ 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
|
1093 |
"/ expensive then cache flushing. |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1094 |
"/ |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1095 |
"/ aClass allSubclassesDo:[:aSubclass | |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1096 |
"/ ObjectMemory flushInlineCachesForClass:aSubclass. |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1097 |
"/ ObjectMemory flushMethodCacheFor:aSubclass |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1098 |
"/ ]. |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1099 |
"/ ObjectMemory flushInlineCachesForClass:aClass. |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1100 |
"/ ObjectMemory flushMethodCacheFor:aClass |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1101 |
|
453 | 1102 |
ObjectMemory flushInlineCaches. |
1103 |
ObjectMemory flushMethodCache. |
|
1104 |
||
7181 | 1105 |
aClass addChangeRecordForClassRemove. |
453 | 1106 |
self changed:#classRemove with:aClass. |
1107 |
||
1655 | 1108 |
aClass category:#'* removed *'. |
1109 |
||
5326 | 1110 |
self flushCachedClasses. |
1111 |
Class flushSubclassInfo. |
|
1112 |
||
3627
452f2e1ff1b4
removeClass - care for aliases.
Claus Gittinger <cg@exept.de>
parents:
3626
diff
changeset
|
1113 |
wrongName == true ifTrue:[ |
7181 | 1114 |
"/ |
1115 |
"/ an alias (i.e. removing a compatibility name) |
|
1116 |
"/ |
|
1117 |
"/ check if there are more refs to it ... |
|
1118 |
[self includes:aClass] whileTrue:[ |
|
1119 |
actualName := self keyAtValue:aClass. |
|
1120 |
('Smalltalk [info]: ' , aClass name , ' is also registered under the name ' , actualName |
|
1121 |
, ' - remove that binding too.') infoPrintCR. |
|
1122 |
self at:actualName put:nil. |
|
1123 |
]. |
|
4724
44793fe70787
recompile ns classes after a class remove
Claus Gittinger <cg@exept.de>
parents:
4723
diff
changeset
|
1124 |
]. |
44793fe70787
recompile ns classes after a class remove
Claus Gittinger <cg@exept.de>
parents:
4723
diff
changeset
|
1125 |
|
4781 | 1126 |
ns ~~ Smalltalk ifTrue:[ |
7181 | 1127 |
ons notNil ifTrue:[ |
1128 |
ClassBuilder |
|
1129 |
recompileGlobalAccessorsTo:oldNameSym |
|
1130 |
in:ons |
|
1131 |
except:nil |
|
1132 |
]. |
|
1133 |
(ns notNil and:[ns ~~ ons]) ifTrue:[ |
|
1134 |
ClassBuilder |
|
1135 |
recompileGlobalAccessorsTo:oldNameSym |
|
1136 |
in:ns |
|
1137 |
except:nil |
|
1138 |
]. |
|
3627
452f2e1ff1b4
removeClass - care for aliases.
Claus Gittinger <cg@exept.de>
parents:
3626
diff
changeset
|
1139 |
]. |
452f2e1ff1b4
removeClass - care for aliases.
Claus Gittinger <cg@exept.de>
parents:
3626
diff
changeset
|
1140 |
|
452f2e1ff1b4
removeClass - care for aliases.
Claus Gittinger <cg@exept.de>
parents:
3626
diff
changeset
|
1141 |
"Modified: / 20.6.1998 / 13:26:10 / cg" |
617 | 1142 |
! |
1143 |
||
1144 |
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
|
1145 |
"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
|
1146 |
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
|
1147 |
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
|
1148 |
|
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1149 |
|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
|
1150 |
oldNameSpace newNameSpace oldBaseName newBaseName privateClasses |
5610
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1151 |
oldBaseNameWithoutPrefix newBaseNameWithoutPrefix i1 i2 nm ns subns |
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1152 |
oldMetaclass newMetaclass| |
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1153 |
|
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1154 |
"/ check for all intermediate namespaces / owning classes |
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1155 |
i1 := 1. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1156 |
i2 := 1. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1157 |
ns := self. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1158 |
[i2 ~~ 0] whileTrue:[ |
6853 | 1159 |
i2 := newName indexOfSubCollection:'::' startingAt:i1. |
1160 |
i2 ~~ 0 ifTrue:[ |
|
1161 |
nm := newName copyFrom:i1 to:i2-1. |
|
1162 |
ns isNameSpace ifTrue:[ |
|
1163 |
subns := ns at:nm asSymbol ifAbsent:nil. |
|
1164 |
subns isNil ifTrue:[ |
|
1165 |
self error:'Nonexisting namespace: ',nm. |
|
1166 |
^ nil. |
|
1167 |
]. |
|
1168 |
] ifFalse:[ |
|
1169 |
subns := ns privateClassesAt:nm asSymbol. |
|
1170 |
subns isNil ifTrue:[ |
|
1171 |
self error:'Cannot create a namespace below a class' |
|
1172 |
] |
|
1173 |
]. |
|
1174 |
ns := subns. |
|
1175 |
i1 := i2 + 2. |
|
1176 |
]. |
|
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1177 |
]. |
617 | 1178 |
|
1179 |
oldName := aClass name. |
|
6734 | 1180 |
oldNameSpace := aClass topNameSpace. |
2319
640bb389f90a
recompile when moving classes across namespaces
Claus Gittinger <cg@exept.de>
parents:
2317
diff
changeset
|
1181 |
oldBaseName := aClass nameWithoutNameSpacePrefix. |
3698
8bce45214d24
fixed renaming of a private class (must recompile owner)
Claus Gittinger <cg@exept.de>
parents:
3678
diff
changeset
|
1182 |
oldBaseNameWithoutPrefix := aClass nameWithoutPrefix. |
617 | 1183 |
oldSym := oldName asSymbol. |
2485
9f4a11a4521f
new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents:
2476
diff
changeset
|
1184 |
privateClasses := aClass privateClassesSorted. |
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1185 |
|
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1186 |
((self at:oldSym) ~~ aClass) ifTrue:[ |
6853 | 1187 |
'Smalltalk [warning]: rename failed - name is different from key' errorPrintCR. |
1188 |
^ self |
|
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1189 |
]. |
617 | 1190 |
|
1525
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1191 |
"/ rename the class |
617 | 1192 |
|
1847
6e567214b167
care for className being a symbol, when renaming classes
Claus Gittinger <cg@exept.de>
parents:
1758
diff
changeset
|
1193 |
newSym := newName asSymbol. |
6e567214b167
care for className being a symbol, when renaming classes
Claus Gittinger <cg@exept.de>
parents:
1758
diff
changeset
|
1194 |
aClass setName:newSym. |
617 | 1195 |
|
1525
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1196 |
"/ store it in Smalltalk |
617 | 1197 |
|
1198 |
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
|
1199 |
|
5610
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1200 |
"/ change the owning class |
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1201 |
ns isNameSpace ifFalse:[ |
6853 | 1202 |
aClass isPrivate ifTrue:[ |
1203 |
aClass class setOwningClass:ns. |
|
1204 |
] ifFalse:[ |
|
1205 |
oldMetaclass := aClass class. |
|
1206 |
||
1207 |
"/ sigh - must make a PrivateMetaclass from Metaclass |
|
1208 |
newMetaclass := PrivateMetaclass new. |
|
1209 |
newMetaclass flags:(oldMetaclass flags). |
|
1210 |
newMetaclass setSuperclass:(oldMetaclass superclass). |
|
1211 |
newMetaclass instSize:(oldMetaclass instSize). |
|
1212 |
newMetaclass setInstanceVariableString:(oldMetaclass instanceVariableString). |
|
1213 |
newMetaclass setMethodDictionary:(oldMetaclass methodDictionary). |
|
1214 |
newMetaclass setSoleInstance:aClass. |
|
1215 |
newMetaclass setOwningClass:ns. |
|
1216 |
||
1217 |
aClass changeClassTo:newMetaclass. |
|
1218 |
ObjectMemory flushCaches. |
|
1219 |
] |
|
5610
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1220 |
] ifTrue:[ |
6853 | 1221 |
aClass isPrivate ifTrue:[ |
1222 |
aClass class setOwningClass:nil. |
|
1223 |
] |
|
5610
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1224 |
]. |
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1225 |
|
878
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1226 |
"/ |
1525
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1227 |
"/ 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
|
1228 |
"/ |
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1229 |
"/ self removeKey:oldSym. |
617 | 1230 |
self at:newSym put:aClass. |
1231 |
||
1525
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1232 |
"/ 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
|
1233 |
|
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1234 |
oldNameToNewName := IdentityDictionary new. |
617 | 1235 |
|
1236 |
names := aClass classVariableString asCollectionOfWords. |
|
1237 |
names do:[:name | |
|
6853 | 1238 |
oldCVSym := (oldSym , ':' , name) asSymbol. |
1239 |
value := self at:oldCVSym. |
|
1240 |
self at:oldCVSym put:nil. |
|
1241 |
||
1242 |
"/ |
|
1243 |
"/ see comment in #removeKey: on why we dont remove it it here |
|
1244 |
"/ |
|
1245 |
"/ self removeKey:cSym. |
|
1246 |
||
1247 |
newCVSym := (newSym , ':' , name) asSymbol. |
|
1248 |
self at:newCVSym put:value. |
|
1249 |
||
1250 |
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
|
1251 |
]. |
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1252 |
|
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1253 |
"/ 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
|
1254 |
|
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1255 |
oldNameToNewName keysAndValuesDo:[:oldNameSym :newNameSym | |
6853 | 1256 |
aClass withAllSubclasses do:[:aSubClass | |
1257 |
Transcript showCR:'changing global accesses from ''' , oldNameSym , ''' into ''' , newNameSym , ''' in class: ''' , aSubClass name , ''' ...'. |
|
1258 |
aSubClass instAndClassSelectorsAndMethodsDo:[:sel :aMethod | |
|
1259 |
aMethod changeLiteral:oldNameSym to:newNameSym |
|
1260 |
]. |
|
1261 |
]. |
|
1262 |
||
1263 |
"/ and also in privateClasses ? ... |
|
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1264 |
|
2485
9f4a11a4521f
new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents:
2476
diff
changeset
|
1265 |
"/ privateClasses size > 0 ifTrue:[ |
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1266 |
"/ privateClasses do:[:aPrivateClass | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1267 |
"/ aPrivateClass withAllSubclasses do:[:aSubClass | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1268 |
"/ aSubClass class methodDictionary do:[:aMethod | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1269 |
"/ aMethod changeLiteral:oldNameSym to:newNameSym |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1270 |
"/ ]. |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1271 |
"/ aSubClass methodDictionary do:[:aMethod | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1272 |
"/ aMethod changeLiteral:oldNameSym to:newNameSym |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1273 |
"/ ] |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1274 |
"/ ]. |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1275 |
"/ ] |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1276 |
"/ ] |
617 | 1277 |
]. |
1278 |
||
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1279 |
aClass addChangeRecordForClassRename:oldSym to:newSym. |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1280 |
|
5333
d80386e06d21
rename into other namespace did not work
Claus Gittinger <cg@exept.de>
parents:
5328
diff
changeset
|
1281 |
"/ 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
|
1282 |
aClass setEnvironment:nil. |
6734 | 1283 |
newNameSpace := aClass topNameSpace. |
2405
939f4e751ef3
dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents:
2379
diff
changeset
|
1284 |
|
2485
9f4a11a4521f
new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents:
2476
diff
changeset
|
1285 |
privateClasses size > 0 ifTrue:[ |
6853 | 1286 |
"/ must rename privateClasses as well |
1287 |
Class withoutUpdatingChangesDo:[ |
|
1288 |
privateClasses do:[:aPrivateClass | |
|
1289 |
self renameClass:aPrivateClass |
|
1290 |
to:(newSym , '::' , aPrivateClass nameWithoutPrefix). |
|
5916
4364f9ae4254
when renaming a class, no changeRecrd for its private-class renames
Claus Gittinger <cg@exept.de>
parents:
5913
diff
changeset
|
1291 |
|
6853 | 1292 |
Transcript showCR:'recompiling methods in ''' , newNameSpace name , ''' accessing ''' , oldName , '::' , aPrivateClass nameWithoutPrefix , ''' ...'. |
1293 |
ClassBuilder |
|
1294 |
recompileGlobalAccessorsTo:(oldName , '::' , aPrivateClass nameWithoutPrefix) asSymbol |
|
1295 |
in:newNameSpace |
|
1296 |
except:nil. |
|
1297 |
] |
|
1298 |
] |
|
2405
939f4e751ef3
dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents:
2379
diff
changeset
|
1299 |
]. |
939f4e751ef3
dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents:
2379
diff
changeset
|
1300 |
|
2319
640bb389f90a
recompile when moving classes across namespaces
Claus Gittinger <cg@exept.de>
parents:
2317
diff
changeset
|
1301 |
oldNameSpace ~~ newNameSpace ifTrue:[ |
5246
2ca7b20c4108
create namespaces as requried, when renaming a class
Claus Gittinger <cg@exept.de>
parents:
5214
diff
changeset
|
1302 |
|
6853 | 1303 |
"/ all those referencing the class from the old nameSpace |
1304 |
"/ must be recompiled ... |
|
1305 |
"/ (to now access the global from smalltalk) |
|
1306 |
||
1307 |
oldNameSpace ~~ Smalltalk ifTrue:[ |
|
1308 |
Transcript showCR:'recompiling methods in ''' , oldNameSpace name , ''' accessing ''' , oldName , ''' ...'. |
|
1309 |
||
1310 |
ClassBuilder |
|
1311 |
recompileGlobalAccessorsTo:oldName asSymbol |
|
1312 |
in:oldNameSpace |
|
1313 |
except:nil. |
|
1314 |
]. |
|
1315 |
||
1316 |
"/ all referencing the class in the new namespace |
|
1317 |
"/ as well; to now access the new class. |
|
1318 |
||
1319 |
(newNameSpace notNil and:[newNameSpace ~~ Smalltalk]) ifTrue:[ |
|
1320 |
Transcript showCR:'recompiling methods in ''' , newNameSpace name , ''' accessing ''' , oldBaseName , ''' ...'. |
|
1321 |
||
1322 |
ClassBuilder |
|
1323 |
recompileGlobalAccessorsTo:oldBaseName asSymbol |
|
1324 |
in:newNameSpace |
|
1325 |
except:nil. |
|
1326 |
]. |
|
3698
8bce45214d24
fixed renaming of a private class (must recompile owner)
Claus Gittinger <cg@exept.de>
parents:
3678
diff
changeset
|
1327 |
] ifFalse:[ |
6853 | 1328 |
"/ all references to a global with my new name in my owning class |
1329 |
"/ must now be redirected to myself. |
|
1330 |
||
1331 |
aClass isPrivate ifTrue:[ |
|
1332 |
newBaseName := aClass nameWithoutNameSpacePrefix. |
|
1333 |
newBaseNameWithoutPrefix := aClass nameWithoutPrefix. |
|
1334 |
||
1335 |
Transcript showCR:'recompiling methods accessing ''' , oldBaseNameWithoutPrefix , ''' in: ''' , aClass owningClass name , ''' ...'. |
|
1336 |
aClass owningClass recompileMethodsAccessingGlobal:oldBaseNameWithoutPrefix. |
|
1337 |
aClass owningClass class recompileMethodsAccessingGlobal:oldBaseNameWithoutPrefix. |
|
1338 |
||
1339 |
Transcript showCR:'recompiling methods accessing ''' , oldBaseName , ''' in: ''' , aClass owningClass name , ''' ...'. |
|
1340 |
aClass owningClass recompileMethodsAccessingGlobal:oldBaseName. |
|
1341 |
aClass owningClass class recompileMethodsAccessingGlobal:oldBaseName. |
|
1342 |
||
1343 |
Transcript showCR:'recompiling methods accessing ''' , newBaseNameWithoutPrefix , ''' in: ''' , aClass owningClass name , ''' ...'. |
|
1344 |
aClass owningClass recompileMethodsAccessingGlobal:newBaseNameWithoutPrefix. |
|
1345 |
aClass owningClass class recompileMethodsAccessingGlobal:newBaseNameWithoutPrefix. |
|
1346 |
||
1347 |
Transcript showCR:'recompiling methods accessing ''' , newBaseName , ''' in: ''' , aClass owningClass name , ''' ...'. |
|
1348 |
aClass owningClass recompileMethodsAccessingGlobal:newBaseName. |
|
1349 |
aClass owningClass class recompileMethodsAccessingGlobal:newBaseName. |
|
1350 |
] |
|
4040
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1351 |
]. |
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1352 |
|
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1353 |
aClass changed:#definition. |
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1354 |
"/ 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
|
1355 |
aClass allSubclassesDo:[:subClass | |
6853 | 1356 |
subClass changed:#definition. |
4040
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1357 |
]. |
5613
b534e427f028
change message when renaming a class
Claus Gittinger <cg@exept.de>
parents:
5611
diff
changeset
|
1358 |
self changed:#definition. |
b534e427f028
change message when renaming a class
Claus Gittinger <cg@exept.de>
parents:
5611
diff
changeset
|
1359 |
Smalltalk changed:#classRename with:(Array with:aClass with:oldName). |
3698
8bce45214d24
fixed renaming of a private class (must recompile owner)
Claus Gittinger <cg@exept.de>
parents:
3678
diff
changeset
|
1360 |
|
8bce45214d24
fixed renaming of a private class (must recompile owner)
Claus Gittinger <cg@exept.de>
parents:
3678
diff
changeset
|
1361 |
"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
|
1362 |
"Modified: / 18.6.1996 / 14:20:50 / stefan" |
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1363 |
"Modified: / 11.2.2000 / 01:12:38 / cg" |
453 | 1364 |
! ! |
1365 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1366 |
!Smalltalk class methodsFor:'copying'! |
453 | 1367 |
|
617 | 1368 |
deepCopy |
1410 | 1369 |
"redefined to return self - there is only one Smalltalk dictionary" |
453 | 1370 |
|
1371 |
^ self |
|
1410 | 1372 |
|
1373 |
"Modified: 18.5.1996 / 12:13:33 / cg" |
|
453 | 1374 |
! |
1375 |
||
1376 |
deepCopyUsing:aDictionary |
|
1410 | 1377 |
"redefined to return self - there is only one Smalltalk dictionary" |
453 | 1378 |
|
1379 |
^ self |
|
1410 | 1380 |
|
1381 |
"Modified: 18.5.1996 / 12:13:36 / cg" |
|
453 | 1382 |
! |
1383 |
||
617 | 1384 |
shallowCopy |
1410 | 1385 |
"redefined to return self - there is only one Smalltalk dictionary" |
617 | 1386 |
|
1387 |
^ self |
|
1410 | 1388 |
|
1389 |
"Modified: 18.5.1996 / 12:13:39 / cg" |
|
617 | 1390 |
! |
1391 |
||
1392 |
simpleDeepCopy |
|
1410 | 1393 |
"redefined to return self - there is only one Smalltalk dictionary" |
453 | 1394 |
|
1395 |
^ self |
|
1410 | 1396 |
|
1397 |
"Modified: 18.5.1996 / 12:13:42 / cg" |
|
453 | 1398 |
! ! |
1399 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1400 |
!Smalltalk class methodsFor:'debugging ST/X'! |
453 | 1401 |
|
7325 | 1402 |
compileTrace:aBoolean |
1403 |
"dump generated inline code (NOOP if VM was compiled without the trace-debug option)" |
|
1404 |
%{ |
|
1405 |
extern char __compileTrace__; |
|
1406 |
||
1407 |
__compileTrace__ = (aBoolean == true) ? 1 : 0; |
|
1408 |
%} |
|
1409 |
" |
|
1410 |
Smalltalk compileTrace:true |
|
1411 |
Smalltalk compileTrace:false |
|
1412 |
" |
|
1413 |
! |
|
1414 |
||
453 | 1415 |
debugBreakPoint |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1416 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1417 |
|
453 | 1418 |
"call the dummy debug function, on which a breakpoint |
1419 |
can be put in adb, sdb, dbx or gdb. |
|
1420 |
WARNING: this method is for debugging only |
|
6853 | 1421 |
it will be removed without notice." |
453 | 1422 |
%{ |
2212 | 1423 |
__PATCHUPCONTEXTS(__context); |
808
1919838112d1
renamed debugBreakPoint -> __debugBreakPoint__
Claus Gittinger <cg@exept.de>
parents:
796
diff
changeset
|
1424 |
__debugBreakPoint__(); |
5410 | 1425 |
RETURN(self); |
1426 |
%}. |
|
1427 |
^ self primitiveFailed |
|
1428 |
||
1429 |
||
453 | 1430 |
! |
1431 |
||
617 | 1432 |
exitWithCoreDump |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1433 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1434 |
|
617 | 1435 |
"abort program and dump core" |
1436 |
||
4096
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1437 |
OperatingSystem exitWithCoreDump |
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1438 |
"/ never returns |
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1439 |
|
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1440 |
"Be careful evaluating this |
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1441 |
Smalltalk exitWithCoreDump |
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1442 |
" |
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1443 |
|
617 | 1444 |
! |
1445 |
||
1446 |
fatalAbort |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1447 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1448 |
|
617 | 1449 |
"report a fatal-error, print a stack backtrace and exit with core dump. |
1450 |
(You may turn off the stack print with debugPrinting:false)" |
|
1451 |
%{ |
|
1452 |
__fatal0(__context, "fatalAbort"); |
|
1453 |
/* NEVER RETURNS */ |
|
5410 | 1454 |
%}. |
1455 |
^ self primitiveFailed |
|
1456 |
||
617 | 1457 |
! |
1458 |
||
1459 |
fatalAbort:aMessage |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1460 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1461 |
|
617 | 1462 |
"report a fatal-error; print a stack backtrace and exit with core dump |
1463 |
(You may turn off the stack print with debugPrinting:false)" |
|
1464 |
||
1465 |
%{ |
|
1466 |
char *msg; |
|
1467 |
||
1468 |
if (__isString(aMessage)) |
|
6853 | 1469 |
msg = (char *) __stringVal(aMessage); |
617 | 1470 |
else |
6853 | 1471 |
msg = "fatalAbort"; |
617 | 1472 |
|
1473 |
__fatal0(__context, msg); |
|
1474 |
/* NEVER RETURNS */ |
|
5410 | 1475 |
%}. |
1476 |
^ self primitiveFailed |
|
1477 |
||
5441 | 1478 |
! |
1479 |
||
1480 |
vmInstructionTrace:aBoolean |
|
1481 |
||
1482 |
||
453 | 1483 |
! ! |
1484 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1485 |
!Smalltalk class methodsFor:'enumerating'! |
453 | 1486 |
|
1487 |
allBehaviorsDo:aBlock |
|
5580
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1488 |
"evaluate the argument, aBlock for all classes and metaclasses in the system" |
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1489 |
|
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1490 |
self allClassesAndMetaclassesDo:aBlock |
453 | 1491 |
|
1492 |
" |
|
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
1493 |
Smalltalk allBehaviorsDo:[:aClass | aClass name printCR] |
453 | 1494 |
" |
1495 |
! |
|
1496 |
||
6217
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1497 |
allClassCategories |
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1498 |
"return a set of all class categories in the system" |
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1499 |
|
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1500 |
|allCategories| |
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1501 |
|
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1502 |
allCategories := Set new. |
7124
da253fd03ba1
Do not sort categories in #allClassCategories.
Stefan Vogel <sv@exept.de>
parents:
7105
diff
changeset
|
1503 |
Smalltalk allClassesDo:[:cls | |category| |
da253fd03ba1
Do not sort categories in #allClassCategories.
Stefan Vogel <sv@exept.de>
parents:
7105
diff
changeset
|
1504 |
category := cls category. |
da253fd03ba1
Do not sort categories in #allClassCategories.
Stefan Vogel <sv@exept.de>
parents:
7105
diff
changeset
|
1505 |
category notNil ifTrue:[ |
da253fd03ba1
Do not sort categories in #allClassCategories.
Stefan Vogel <sv@exept.de>
parents:
7105
diff
changeset
|
1506 |
allCategories add:category. |
da253fd03ba1
Do not sort categories in #allClassCategories.
Stefan Vogel <sv@exept.de>
parents:
7105
diff
changeset
|
1507 |
]. |
da253fd03ba1
Do not sort categories in #allClassCategories.
Stefan Vogel <sv@exept.de>
parents:
7105
diff
changeset
|
1508 |
]. |
da253fd03ba1
Do not sort categories in #allClassCategories.
Stefan Vogel <sv@exept.de>
parents:
7105
diff
changeset
|
1509 |
|
7125
947dc98dd66c
Return #allClassCategories as Set (to fit comment and make
Stefan Vogel <sv@exept.de>
parents:
7124
diff
changeset
|
1510 |
^ allCategories. |
6217
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1511 |
|
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1512 |
" |
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1513 |
Smalltalk allClassCategories |
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1514 |
" |
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1515 |
|
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1516 |
"Created: / 17.11.2001 / 12:13:09 / cg" |
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1517 |
! |
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1518 |
|
5579
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1519 |
allClassesAndMetaclassesDo:aBlock |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1520 |
"evaluate the argument, aBlock for all classes and metaclasses in the system." |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1521 |
|
5940
804fb27727a6
oops - allClassesAndMetaclassesDo: evaluated block twice for
Claus Gittinger <cg@exept.de>
parents:
5916
diff
changeset
|
1522 |
|already| |
804fb27727a6
oops - allClassesAndMetaclassesDo: evaluated block twice for
Claus Gittinger <cg@exept.de>
parents:
5916
diff
changeset
|
1523 |
|
804fb27727a6
oops - allClassesAndMetaclassesDo: evaluated block twice for
Claus Gittinger <cg@exept.de>
parents:
5916
diff
changeset
|
1524 |
already := IdentitySet new. |
804fb27727a6
oops - allClassesAndMetaclassesDo: evaluated block twice for
Claus Gittinger <cg@exept.de>
parents:
5916
diff
changeset
|
1525 |
self allClassesDo:[:eachClass | |cls| |
6853 | 1526 |
cls := eachClass theNonMetaclass. |
1527 |
(already includes:cls) ifFalse:[ |
|
1528 |
aBlock value:cls. |
|
1529 |
already add:cls. |
|
1530 |
]. |
|
1531 |
cls := cls class. |
|
1532 |
(already includes:cls) ifFalse:[ |
|
1533 |
aBlock value:cls. |
|
1534 |
already add:cls. |
|
1535 |
]. |
|
5579
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1536 |
]. |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1537 |
! |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1538 |
|
453 | 1539 |
allClassesDo:aBlock |
5580
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1540 |
"evaluate the argument, aBlock for all classes in the system." |
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1541 |
|
5765 | 1542 |
self allClasses do:aBlock |
453 | 1543 |
|
1544 |
" |
|
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
1545 |
Smalltalk allClassesDo:[:aClass | aClass name printCR] |
453 | 1546 |
" |
1547 |
! |
|
1548 |
||
1299 | 1549 |
allClassesInCategory:aCategory |
1550 |
"return a collection of for all classes in aCategory; |
|
1551 |
The order of the classes is not defined." |
|
1552 |
||
1553 |
|coll| |
|
1554 |
||
1555 |
coll := OrderedCollection new. |
|
1556 |
self allClassesInCategory:aCategory do:[:aClass | |
|
6853 | 1557 |
coll add:aClass |
1299 | 1558 |
]. |
1559 |
^ coll |
|
1560 |
||
1561 |
" |
|
1562 |
Smalltalk allClassesInCategory:'Views-Basic' |
|
1563 |
" |
|
1564 |
||
1565 |
"Modified: 25.4.1996 / 18:06:13 / cg" |
|
1566 |
! |
|
1567 |
||
453 | 1568 |
allClassesInCategory:aCategory do:aBlock |
1569 |
"evaluate the argument, aBlock for all classes in the aCategory; |
|
1570 |
The order of the classes is not defined." |
|
1571 |
||
1572 |
aCategory notNil ifTrue:[ |
|
6853 | 1573 |
self allClassesDo:[:aClass | |
1574 |
aClass isMeta ifFalse:[ |
|
1575 |
(aClass category = aCategory) ifTrue:[ |
|
1576 |
aBlock value:aClass |
|
1577 |
] |
|
1578 |
] |
|
1579 |
] |
|
453 | 1580 |
] |
1581 |
||
1582 |
" |
|
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
1583 |
Smalltalk allClassesInCategory:'Views-Basic' do:[:aClass | aClass name printCR] |
453 | 1584 |
" |
1585 |
! |
|
1586 |
||
1587 |
allClassesInCategory:aCategory inOrderDo:aBlock |
|
1588 |
"evaluate the argument, aBlock for all classes in aCategory; |
|
1589 |
superclasses come first - then subclasses" |
|
1590 |
||
1591 |
|classes| |
|
1592 |
||
1593 |
aCategory notNil ifTrue:[ |
|
6853 | 1594 |
classes := OrderedCollection new. |
1595 |
self allClassesInCategory:aCategory do:[:aClass | |
|
1596 |
classes add:aClass |
|
1597 |
]. |
|
1598 |
classes topologicalSort:[:a :b | b isSubclassOf:a]. |
|
1599 |
classes do:aBlock |
|
453 | 1600 |
] |
1601 |
||
1602 |
" |
|
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
1603 |
Smalltalk allClassesInCategory:'Views-Basic' inOrderDo:[:aClass | aClass name printCR] |
453 | 1604 |
" |
6217
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1605 |
|
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1606 |
"Modified: / 17.11.2001 / 12:18:15 / cg" |
617 | 1607 |
! |
1608 |
||
5406 | 1609 |
allClassesInOrderDo:aBlock |
1610 |
"evaluate the argument, aBlock for all classes in the system; |
|
1611 |
Evaluation order is by inheritance: superclasses come first." |
|
1612 |
||
1613 |
|already| |
|
1614 |
||
1615 |
already := IdentitySet new. |
|
5580
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1616 |
self allClassesDo:[:aClass | |
6853 | 1617 |
(already includes:aClass) ifFalse:[ |
1618 |
aClass allSuperclasses reverseDo:[:cls | |
|
1619 |
(already includes:aClass) ifFalse:[ |
|
1620 |
already add:cls. |
|
1621 |
aBlock value:cls. |
|
1622 |
]. |
|
1623 |
]. |
|
1624 |
already add:aClass. |
|
1625 |
aBlock value:aClass. |
|
1626 |
] |
|
5406 | 1627 |
]. |
1628 |
||
1629 |
" |
|
1630 |
Smalltalk allClassesInOrderDo:[:aClass | aClass name printCR] |
|
1631 |
" |
|
1632 |
! |
|
1633 |
||
617 | 1634 |
allKeysDo:aBlock |
1635 |
"evaluate the argument, aBlock for all keys in the Smalltalk dictionary" |
|
1636 |
||
1637 |
^ self keysDo:aBlock |
|
1638 |
! |
|
1639 |
||
6722
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
1640 |
allMethodCategories |
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
1641 |
"return a set of all method categories in the system" |
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
1642 |
|
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
1643 |
|allCategories| |
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
1644 |
|
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
1645 |
allCategories := Set new. |
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
1646 |
Smalltalk allClassesDo:[:cls | |
6929 | 1647 |
allCategories addAll:cls categories. |
6722
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
1648 |
]. |
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
1649 |
|
7432 | 1650 |
^ allCategories. |
6722
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
1651 |
|
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
1652 |
" |
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
1653 |
Smalltalk allMethodCategories |
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
1654 |
" |
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
1655 |
! |
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
1656 |
|
617 | 1657 |
associationsDo:aBlock |
1658 |
"evaluate the argument, aBlock for all key/value pairs |
|
1659 |
in the Smalltalk dictionary" |
|
1660 |
||
1661 |
self keysDo:[:aKey | |
|
6853 | 1662 |
aBlock value:(aKey -> (self at:aKey)) |
617 | 1663 |
] |
1664 |
||
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
1665 |
"Smalltalk associationsDo:[:assoc | assoc printCR]" |
617 | 1666 |
! |
1667 |
||
5406 | 1668 |
basicKeys |
1669 |
"for rel > 5 only" |
|
1670 |
||
1671 |
self primitiveFailed |
|
1672 |
||
1673 |
||
1674 |
||
1675 |
||
1676 |
||
1677 |
||
1678 |
! |
|
1679 |
||
617 | 1680 |
do:aBlock |
1681 |
"evaluate the argument, aBlock for all values in the Smalltalk dictionary" |
|
1682 |
||
1683 |
|work| |
|
1684 |
||
1685 |
%{ /* 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
|
1686 |
__GLOBALS_DO(&aBlock, &work); |
5406 | 1687 |
RETURN (self); |
1688 |
%}. |
|
1689 |
self keysDo:[:aKey | |
|
6853 | 1690 |
aBlock value:(self at:aKey) |
5406 | 1691 |
] |
617 | 1692 |
! |
1693 |
||
1694 |
keysAndValuesDo:aBlock |
|
1695 |
"evaluate the two-arg block, aBlock for all keys and values" |
|
1696 |
||
1697 |
self keysDo:[:aKey | |
|
6853 | 1698 |
aBlock value:aKey value:(self at:aKey) |
617 | 1699 |
] |
1700 |
! |
|
1701 |
||
1702 |
keysDo:aBlock |
|
1703 |
"evaluate the argument, aBlock for all keys in the Smalltalk dictionary" |
|
1704 |
|work| |
|
1705 |
||
1706 |
%{ /* 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
|
1707 |
__GLOBALKEYS_DO(&aBlock, &work); |
5406 | 1708 |
RETURN (self); |
1709 |
%}. |
|
1710 |
self basicKeys do:[:aKey | |
|
6853 | 1711 |
aBlock value:aKey |
5406 | 1712 |
] |
453 | 1713 |
! ! |
1714 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1715 |
!Smalltalk class methodsFor:'inspecting'! |
453 | 1716 |
|
1717 |
inspectorClass |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1718 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1719 |
|
453 | 1720 |
"redefined to launch a DictionaryInspector |
1721 |
(instead of the default Inspector)." |
|
1722 |
||
1723 |
^ DictionaryInspectorView |
|
1724 |
! ! |
|
1725 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1726 |
!Smalltalk class methodsFor:'message control'! |
453 | 1727 |
|
1728 |
silentLoading |
|
1729 |
"returns the Silentloading class variable." |
|
1730 |
||
1731 |
^ SilentLoading |
|
1732 |
! |
|
1733 |
||
1734 |
silentLoading:aBoolean |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1735 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1736 |
|
453 | 1737 |
"allows access to the Silentloading class variable, which controls |
1738 |
messages from all kinds of system onto the transcript. |
|
1739 |
You can save a snapshot with this flag set to true, which makes |
|
1740 |
the image come up silent. Can also be set, to read in files unlogged." |
|
1741 |
||
1742 |
|prev| |
|
1743 |
||
1744 |
prev := SilentLoading. |
|
1745 |
SilentLoading := aBoolean. |
|
1746 |
^ prev |
|
1747 |
! ! |
|
1748 |
||
4957 | 1749 |
!Smalltalk class methodsFor:'misc accessing'! |
1750 |
||
1751 |
beHeadless:aBoolean |
|
1752 |
"set/clear the headlessOperation flag." |
|
1753 |
||
1754 |
HeadlessOperation := aBoolean |
|
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
1755 |
! |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
1756 |
|
6564 | 1757 |
standAloneApp:aBoolean |
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
1758 |
"set/clear the StandAlone flag." |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
1759 |
|
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
1760 |
StandAlone := aBoolean |
4957 | 1761 |
! ! |
1762 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1763 |
!Smalltalk class methodsFor:'misc stuff'! |
453 | 1764 |
|
617 | 1765 |
addExitBlock:aBlock |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1766 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1767 |
|
617 | 1768 |
"add a block to be executed when Smalltalk finishes. |
1769 |
This feature is currently not used anywhere - but could be useful for |
|
1770 |
cleanup in stand alone applications." |
|
1771 |
||
1772 |
ExitBlocks isNil ifTrue:[ |
|
6853 | 1773 |
ExitBlocks := OrderedCollection with:aBlock |
617 | 1774 |
] ifFalse:[ |
6853 | 1775 |
ExitBlocks add:aBlock |
617 | 1776 |
] |
1777 |
! |
|
1778 |
||
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1779 |
addImageStartBlock:aBlock |
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1780 |
"{ Pragma: +optSpace }" |
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1781 |
|
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1782 |
"add a blocks to be executed in a separate process after |
2681 | 1783 |
everything has been initialized. |
1784 |
These blocks will be executed after an image restart." |
|
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1785 |
|
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1786 |
ImageStartBlocks isNil ifTrue:[ |
6853 | 1787 |
ImageStartBlocks := OrderedCollection with:aBlock |
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1788 |
] ifFalse:[ |
6853 | 1789 |
ImageStartBlocks add:aBlock |
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1790 |
] |
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1791 |
|
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1792 |
"Created: 9.9.1996 / 16:48:20 / stefan" |
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1793 |
! |
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1794 |
|
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1795 |
addStartBlock:aBlock |
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1796 |
"{ Pragma: +optSpace }" |
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1797 |
|
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1798 |
"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
|
1799 |
everything has been initialized. These blocks will |
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1800 |
be deleted after execution and therefore not be |
2681 | 1801 |
executed after an image restart. |
1802 |
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
|
1803 |
|
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1804 |
StartBlocks isNil ifTrue:[ |
6853 | 1805 |
StartBlocks := OrderedCollection with:aBlock |
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1806 |
] ifFalse:[ |
6853 | 1807 |
StartBlocks add:aBlock |
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1808 |
] |
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1809 |
|
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1810 |
"Created: 9.9.1996 / 16:46:53 / stefan" |
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1811 |
! |
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1812 |
|
453 | 1813 |
exit |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1814 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1815 |
|
3976
bfba94385ed0
added #aboutToExit notification
Claus Gittinger <cg@exept.de>
parents:
3971
diff
changeset
|
1816 |
"finish the Smalltalk system" |
bfba94385ed0
added #aboutToExit notification
Claus Gittinger <cg@exept.de>
parents:
3971
diff
changeset
|
1817 |
|
bfba94385ed0
added #aboutToExit notification
Claus Gittinger <cg@exept.de>
parents:
3971
diff
changeset
|
1818 |
ObjectMemory changed:#aboutToExit. "/ for ST/X backward compatibility |
453 | 1819 |
ObjectMemory changed:#aboutToQuit. "/ for ST-80 compatibility |
1820 |
ExitBlocks notNil ifTrue:[ |
|
6853 | 1821 |
ExitBlocks do:[:aBlock | |
1822 |
aBlock value |
|
1823 |
] |
|
453 | 1824 |
]. |
1825 |
OperatingSystem exit |
|
4096
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1826 |
"/ never returns |
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1827 |
|
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1828 |
"Be careful evaluating this |
453 | 1829 |
Smalltalk exit |
1830 |
" |
|
1831 |
! |
|
1832 |
||
1833 |
sleep:aDelay |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1834 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1835 |
|
453 | 1836 |
"wait for aDelay seconds. |
1837 |
OBSOLETE: this is historical leftover and will be removed" |
|
1838 |
||
1839 |
OperatingSystem sleep:aDelay |
|
1840 |
! ! |
|
1841 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1842 |
!Smalltalk class methodsFor:'queries'! |
453 | 1843 |
|
1844 |
allClasses |
|
1845 |
"return an unordered collection of all classes in the system. |
|
1846 |
Only globally anchored classes are returned |
|
1847 |
(i.e. anonymous ones have to be aquired by Behavior allSubInstances)" |
|
1848 |
||
1849 |
|classes| |
|
1850 |
||
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
1851 |
"/ you may wonder, what this while is for, here ... |
453 | 1852 |
"/ the reason is that if we modify the class hierarchy in |
4067 | 1853 |
"/ another view (background fileIn), while building up the |
453 | 1854 |
"/ cachedClasses set, this may be flushed (invalidated) by the |
1855 |
"/ other process in the meanwhile. |
|
1856 |
"/ If that happens, we restart the set-building here |
|
1857 |
"/ |
|
1858 |
[(classes := CachedClasses) isNil] whileTrue:[ |
|
6853 | 1859 |
CachedClasses := classes := IdentitySet new:800. |
1860 |
self keysAndValuesDo:[:sym :anObject | |
|
1861 |
anObject notNil ifTrue:[ |
|
1862 |
anObject isBehavior ifTrue:[ |
|
1863 |
"/ sigh - would like to skip over aliases |
|
1864 |
"/ but this cannot be done simply by comparing |
|
1865 |
"/ the classes name against the store-key |
|
1866 |
"/ i.e. cannot do: |
|
1867 |
"/ anObject name == sym ifTrue:[ |
|
1868 |
"/ classes add:anObject |
|
1869 |
"/ ] |
|
1870 |
"/ because that would lead to ignore all java |
|
1871 |
"/ classes, which are stored under a different |
|
1872 |
"/ key. |
|
1873 |
||
1874 |
(anObject name == sym |
|
1875 |
or:[anObject isJavaClass]) ifTrue:[ |
|
1876 |
classes add:anObject |
|
1877 |
]. |
|
1878 |
] |
|
1879 |
] |
|
1880 |
] |
|
453 | 1881 |
]. |
1882 |
^ classes |
|
1883 |
||
4618
f5a0e70205c9
oops - do not check for classes name = key (java stuff)
Claus Gittinger <cg@exept.de>
parents:
4607
diff
changeset
|
1884 |
"CachedClasses := nil. |
453 | 1885 |
Smalltalk allClasses |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
1886 |
|
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
1887 |
to get the list sorted by name: |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
1888 |
|
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
1889 |
Smalltalk allClasses asSortedCollection:[:a :b | a name < b name] |
453 | 1890 |
" |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
1891 |
|
5278 | 1892 |
"Modified: / 23.2.2000 / 10:49:46 / cg" |
453 | 1893 |
! |
1894 |
||
5579
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1895 |
allClassesAndMetaclasses |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1896 |
"return an unordered collection of all classes with their metaclasses in the system." |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1897 |
|
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1898 |
|classes| |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1899 |
|
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1900 |
classes := IdentitySet new. |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1901 |
self allClassesDo:[:eachClass | |
6853 | 1902 |
classes add:(eachClass theNonMetaclass). |
1903 |
classes add:(eachClass theMetaclass). |
|
5579
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1904 |
]. |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1905 |
^ classes |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1906 |
! |
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1907 |
|
4642 | 1908 |
allClassesWithAllPrivateClasses |
1909 |
"return an unordered collection of all classes in the Smalltalk namespace. |
|
1910 |
Only globally anchored classes are returned |
|
1911 |
(i.e. anonymous ones have to be aquired by Behavior allSubInstances)" |
|
1912 |
||
1913 |
^ self allClasses select:[:aClass | |
|
6853 | 1914 |
|owner| |
1915 |
||
1916 |
(aClass isNameSpace not |
|
1917 |
or:[aClass == Smalltalk]) |
|
1918 |
and:[ |
|
1919 |
owner := aClass topOwningClass. |
|
1920 |
(owner ? aClass) nameSpace == Smalltalk |
|
1921 |
] |
|
4642 | 1922 |
] |
1923 |
||
1924 |
" |
|
1925 |
Smalltalk allClassesWithAllPrivateClasses |
|
1926 |
" |
|
1927 |
! |
|
1928 |
||
617 | 1929 |
cellAt:aName |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1930 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
1931 |
|
617 | 1932 |
"return the address of a global cell |
1933 |
- used internally for compiler only" |
|
1934 |
||
1935 |
%{ /* NOCONTEXT */ |
|
1936 |
RETURN ( __GLOBAL_GETCELL(aName) ); |
|
5406 | 1937 |
%}. |
5410 | 1938 |
^ self primitiveFailed |
1939 |
||
617 | 1940 |
! |
1941 |
||
6539 | 1942 |
classCategoryCompletion:aPartialCategory |
1943 |
"given a partial class category name, return an array consisting of |
|
1944 |
2 entries: 1st: collection consisting of matching categories |
|
7126 | 1945 |
2nd: the longest match" |
6539 | 1946 |
|
1947 |
|matches best lcName| |
|
1948 |
||
1949 |
matches := IdentitySet new. |
|
1950 |
||
1951 |
"/ search for exact match |
|
1952 |
self allClassesDo:[:aClass | |
|
7126 | 1953 |
|category| |
1954 |
||
1955 |
category := aClass category. |
|
1956 |
(category notNil and:[category startsWith:aPartialCategory]) ifTrue:[ |
|
1957 |
matches add:category |
|
1958 |
] |
|
6539 | 1959 |
]. |
1960 |
matches isEmpty ifTrue:[ |
|
7126 | 1961 |
"/ search for case-ignoring match |
1962 |
lcName := aPartialCategory asLowercase. |
|
1963 |
self allClassesDo:[:aClass | |
|
1964 |
|category| |
|
1965 |
||
1966 |
category := aClass category. |
|
1967 |
(category notNil and:[category asLowercase startsWith:lcName]) ifTrue:[ |
|
1968 |
matches add:category |
|
1969 |
]. |
|
1970 |
]. |
|
6539 | 1971 |
]. |
1972 |
||
1973 |
matches isEmpty ifTrue:[ |
|
7126 | 1974 |
^ Array with:aPartialCategory with:(Array with:aPartialCategory) |
6539 | 1975 |
]. |
1976 |
matches size == 1 ifTrue:[ |
|
7126 | 1977 |
^ Array with:matches first with:(matches asArray) |
6539 | 1978 |
]. |
1979 |
matches := matches asSortedCollection. |
|
1980 |
best := matches longestCommonPrefix. |
|
1981 |
^ Array with:best with:matches asArray |
|
1982 |
||
1983 |
" |
|
1984 |
Smalltalk classCategoryCompletion:'Sys' |
|
1985 |
Smalltalk classCategoryCompletion:'System' |
|
1986 |
Smalltalk classCategoryCompletion:'System-BinaryStorage' |
|
1987 |
" |
|
1988 |
! |
|
1989 |
||
453 | 1990 |
classNamed:aString |
1991 |
"return the class with name aString, or nil if absent. |
|
7520
03cbfda8cf8b
allow for namespace::name in #classNamed.
Claus Gittinger <cg@exept.de>
parents:
7432
diff
changeset
|
1992 |
To get to the metaClass, append ' class' to the string. |
03cbfda8cf8b
allow for namespace::name in #classNamed.
Claus Gittinger <cg@exept.de>
parents:
7432
diff
changeset
|
1993 |
To get a nameSpace or private class, prefix the name as required." |
03cbfda8cf8b
allow for namespace::name in #classNamed.
Claus Gittinger <cg@exept.de>
parents:
7432
diff
changeset
|
1994 |
|
03cbfda8cf8b
allow for namespace::name in #classNamed.
Claus Gittinger <cg@exept.de>
parents:
7432
diff
changeset
|
1995 |
|cls sym nonMeta idx ns nm| |
453 | 1996 |
|
1997 |
"be careful, to not invent new symbols ..." |
|
1998 |
sym := aString asSymbolIfInterned. |
|
1999 |
sym notNil ifTrue:[ |
|
7520
03cbfda8cf8b
allow for namespace::name in #classNamed.
Claus Gittinger <cg@exept.de>
parents:
7432
diff
changeset
|
2000 |
cls := self at:sym ifAbsent:nil. |
03cbfda8cf8b
allow for namespace::name in #classNamed.
Claus Gittinger <cg@exept.de>
parents:
7432
diff
changeset
|
2001 |
cls isBehavior ifTrue:[^ cls]. |
03cbfda8cf8b
allow for namespace::name in #classNamed.
Claus Gittinger <cg@exept.de>
parents:
7432
diff
changeset
|
2002 |
cls isNil ifTrue:[ |
03cbfda8cf8b
allow for namespace::name in #classNamed.
Claus Gittinger <cg@exept.de>
parents:
7432
diff
changeset
|
2003 |
idx := sym indexOfSubCollection:'::'. |
03cbfda8cf8b
allow for namespace::name in #classNamed.
Claus Gittinger <cg@exept.de>
parents:
7432
diff
changeset
|
2004 |
idx ~~ 0 ifTrue:[ |
03cbfda8cf8b
allow for namespace::name in #classNamed.
Claus Gittinger <cg@exept.de>
parents:
7432
diff
changeset
|
2005 |
ns := sym copyTo:idx-1. |
03cbfda8cf8b
allow for namespace::name in #classNamed.
Claus Gittinger <cg@exept.de>
parents:
7432
diff
changeset
|
2006 |
nm := sym copyFrom:idx+2. |
03cbfda8cf8b
allow for namespace::name in #classNamed.
Claus Gittinger <cg@exept.de>
parents:
7432
diff
changeset
|
2007 |
ns := Smalltalk at:ns asSymbol. |
03cbfda8cf8b
allow for namespace::name in #classNamed.
Claus Gittinger <cg@exept.de>
parents:
7432
diff
changeset
|
2008 |
ns notNil ifTrue:[ |
03cbfda8cf8b
allow for namespace::name in #classNamed.
Claus Gittinger <cg@exept.de>
parents:
7432
diff
changeset
|
2009 |
ns isNameSpace ifTrue:[ |
03cbfda8cf8b
allow for namespace::name in #classNamed.
Claus Gittinger <cg@exept.de>
parents:
7432
diff
changeset
|
2010 |
cls := ns at:(nm asSymbol). |
03cbfda8cf8b
allow for namespace::name in #classNamed.
Claus Gittinger <cg@exept.de>
parents:
7432
diff
changeset
|
2011 |
] ifFalse:[ |
03cbfda8cf8b
allow for namespace::name in #classNamed.
Claus Gittinger <cg@exept.de>
parents:
7432
diff
changeset
|
2012 |
ns isBehavior ifTrue:[ |
03cbfda8cf8b
allow for namespace::name in #classNamed.
Claus Gittinger <cg@exept.de>
parents:
7432
diff
changeset
|
2013 |
cls := ns privateClassesAt:(nm asSymbol). |
03cbfda8cf8b
allow for namespace::name in #classNamed.
Claus Gittinger <cg@exept.de>
parents:
7432
diff
changeset
|
2014 |
] |
03cbfda8cf8b
allow for namespace::name in #classNamed.
Claus Gittinger <cg@exept.de>
parents:
7432
diff
changeset
|
2015 |
] |
03cbfda8cf8b
allow for namespace::name in #classNamed.
Claus Gittinger <cg@exept.de>
parents:
7432
diff
changeset
|
2016 |
]. |
03cbfda8cf8b
allow for namespace::name in #classNamed.
Claus Gittinger <cg@exept.de>
parents:
7432
diff
changeset
|
2017 |
cls isBehavior ifTrue:[^ cls]. |
03cbfda8cf8b
allow for namespace::name in #classNamed.
Claus Gittinger <cg@exept.de>
parents:
7432
diff
changeset
|
2018 |
]. |
03cbfda8cf8b
allow for namespace::name in #classNamed.
Claus Gittinger <cg@exept.de>
parents:
7432
diff
changeset
|
2019 |
]. |
453 | 2020 |
]. |
1480
df0bea6285f8
Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
2021 |
(aString endsWith:' class') ifTrue:[ |
6863 | 2022 |
nonMeta := self classNamed:(aString copyWithoutLast:6). |
2023 |
nonMeta notNil ifTrue:[ |
|
2024 |
^ nonMeta theMetaclass |
|
2025 |
]. |
|
453 | 2026 |
]. |
2027 |
^ nil |
|
2028 |
||
2029 |
" |
|
2030 |
Smalltalk classNamed:'Object' |
|
2031 |
Smalltalk classNamed:'fooBar' |
|
2032 |
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
|
2033 |
Smalltalk classNamed:'Object class' |
453 | 2034 |
Smalltalk classNamed:'Metaclass' |
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2035 |
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
|
2036 |
Smalltalk classNamed:'Array class' |
453 | 2037 |
" |
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2038 |
|
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2039 |
"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
|
2040 |
"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
|
2041 |
"Modified: 19.6.1996 / 14:22:21 / stefan" |
453 | 2042 |
! |
2043 |
||
2044 |
classNames |
|
2045 |
"return a collection of all classNames in the system" |
|
2046 |
||
2047 |
^ self allClasses collect:[:aClass | aClass name] |
|
2048 |
||
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2049 |
" |
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2050 |
Smalltalk classNames |
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2051 |
" |
453 | 2052 |
! |
2053 |
||
2054 |
classnameCompletion:aPartialClassName |
|
2055 |
"given a partial classname, return an array consisting of |
|
2056 |
2 entries: 1st: collection consisting of matching names |
|
6853 | 2057 |
2nd: the best (longest) match" |
6403
2b81e1bc42ea
better classNameCompletion (namespaces)
Claus Gittinger <cg@exept.de>
parents:
6390
diff
changeset
|
2058 |
|
6472
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2059 |
^ self |
6853 | 2060 |
classnameCompletion:aPartialClassName inEnvironment:self |
6472
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2061 |
! |
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2062 |
|
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2063 |
classnameCompletion:aPartialClassName inEnvironment:anEnvironment |
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2064 |
"given a partial classname, return an array consisting of |
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2065 |
2 entries: 1st: collection consisting of matching names |
6853 | 2066 |
2nd: the best (longest) match" |
6472
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2067 |
|
6438
9df1edfc0b54
class-name completion (ith namespace-prefix)
Claus Gittinger <cg@exept.de>
parents:
6421
diff
changeset
|
2068 |
|searchName matches ignCaseMatches best isMatchString cls nsPrefix | |
9df1edfc0b54
class-name completion (ith namespace-prefix)
Claus Gittinger <cg@exept.de>
parents:
6421
diff
changeset
|
2069 |
|
9df1edfc0b54
class-name completion (ith namespace-prefix)
Claus Gittinger <cg@exept.de>
parents:
6421
diff
changeset
|
2070 |
aPartialClassName isEmpty ifTrue:[ |
6853 | 2071 |
^ Array with:aPartialClassName with:#() |
6438
9df1edfc0b54
class-name completion (ith namespace-prefix)
Claus Gittinger <cg@exept.de>
parents:
6421
diff
changeset
|
2072 |
]. |
9df1edfc0b54
class-name completion (ith namespace-prefix)
Claus Gittinger <cg@exept.de>
parents:
6421
diff
changeset
|
2073 |
|
9df1edfc0b54
class-name completion (ith namespace-prefix)
Claus Gittinger <cg@exept.de>
parents:
6421
diff
changeset
|
2074 |
(aPartialClassName startsWith:'Smalltalk::') ifTrue:[ |
6853 | 2075 |
nsPrefix := 'Smalltalk::'. |
2076 |
searchName := aPartialClassName copyFrom:'Smalltalk::' size + 1 |
|
6438
9df1edfc0b54
class-name completion (ith namespace-prefix)
Claus Gittinger <cg@exept.de>
parents:
6421
diff
changeset
|
2077 |
] ifFalse:[ |
6853 | 2078 |
nsPrefix := ''. |
2079 |
searchName := aPartialClassName. |
|
2379 | 2080 |
]. |
2081 |
||
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2082 |
(searchName at:1) isLowercase ifTrue:[ |
6853 | 2083 |
searchName := searchName copy asUppercaseFirst |
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2084 |
]. |
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2085 |
|
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2086 |
isMatchString := searchName includesMatchCharacters. |
1451 | 2087 |
matches := OrderedCollection new. |
2523
04db1fd74e0d
try ignoring case in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
2514
diff
changeset
|
2088 |
ignCaseMatches := OrderedCollection new. |
6472
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2089 |
anEnvironment allClassesDo:[:aClass | |
6853 | 2090 |
|className addIt| |
2091 |
||
2092 |
className := aClass name. |
|
2093 |
aClass isMeta ifFalse:[ |
|
1451 | 2094 |
|
6853 | 2095 |
isMatchString ifTrue:[ |
2096 |
addIt := searchName match:className |
|
2097 |
] ifFalse:[ |
|
2098 |
addIt := className startsWith:searchName |
|
2099 |
]. |
|
2100 |
addIt ifTrue:[ |
|
2101 |
matches add:(nsPrefix , aClass name) |
|
2102 |
] ifFalse:[ |
|
2103 |
"/ try ignoring case |
|
2104 |
isMatchString ifTrue:[ |
|
2105 |
addIt := searchName match:className ignoreCase:true |
|
2106 |
] ifFalse:[ |
|
2107 |
addIt := className asLowercase startsWith:searchName asLowercase |
|
2108 |
]. |
|
2109 |
addIt ifTrue:[ |
|
2110 |
ignCaseMatches add:(nsPrefix , aClass name) |
|
2111 |
] |
|
2112 |
] |
|
2113 |
] |
|
453 | 2114 |
]. |
1451 | 2115 |
|
453 | 2116 |
matches isEmpty ifTrue:[ |
6853 | 2117 |
matches := ignCaseMatches |
6403
2b81e1bc42ea
better classNameCompletion (namespaces)
Claus Gittinger <cg@exept.de>
parents:
6390
diff
changeset
|
2118 |
]. |
2523
04db1fd74e0d
try ignoring case in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
2514
diff
changeset
|
2119 |
matches isEmpty ifTrue:[ |
6853 | 2120 |
^ Array with:searchName with:(Array with:searchName) |
453 | 2121 |
]. |
2122 |
matches size == 1 ifTrue:[ |
|
6853 | 2123 |
best := matches first. |
2124 |
^ Array with:best with:(matches asArray) |
|
453 | 2125 |
]. |
1451 | 2126 |
matches := matches asSortedCollection. |
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2127 |
isMatchString ifTrue:[ |
6853 | 2128 |
best := searchName. |
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2129 |
] ifFalse:[ |
6853 | 2130 |
best := matches longestCommonPrefix. |
6403
2b81e1bc42ea
better classNameCompletion (namespaces)
Claus Gittinger <cg@exept.de>
parents:
6390
diff
changeset
|
2131 |
]. |
2b81e1bc42ea
better classNameCompletion (namespaces)
Claus Gittinger <cg@exept.de>
parents:
6390
diff
changeset
|
2132 |
|
6472
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2133 |
cls := anEnvironment classNamed:best. |
6403
2b81e1bc42ea
better classNameCompletion (namespaces)
Claus Gittinger <cg@exept.de>
parents:
6390
diff
changeset
|
2134 |
(cls isBehavior and:[cls isNameSpace]) ifTrue:[ |
6853 | 2135 |
(matches conform:[:each | each = best |
2136 |
or:[each startsWith:(best , '::')]]) |
|
2137 |
ifTrue:[ |
|
2138 |
best := best , '::' |
|
2139 |
]. |
|
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2140 |
]. |
453 | 2141 |
^ Array with:best with:matches asArray |
2142 |
||
2143 |
" |
|
2144 |
Smalltalk classnameCompletion:'Arr' |
|
2145 |
Smalltalk classnameCompletion:'Arra' |
|
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2146 |
Smalltalk classnameCompletion:'arra' |
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2147 |
Smalltalk classnameCompletion:'*rray' |
453 | 2148 |
" |
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2149 |
|
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2150 |
"Created: 24.11.1995 / 17:24:45 / cg" |
2523
04db1fd74e0d
try ignoring case in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
2514
diff
changeset
|
2151 |
"Modified: 3.4.1997 / 18:25:01 / cg" |
453 | 2152 |
! |
2153 |
||
2004
b660837fe0c7
renamed #currentNameSpace to #defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2154 |
defaultNameSpace |
b660837fe0c7
renamed #currentNameSpace to #defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2155 |
"return the default namespace, where new classes are installed, |
b660837fe0c7
renamed #currentNameSpace to #defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2156 |
if NO special nameSpace handler is present" |
b660837fe0c7
renamed #currentNameSpace to #defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2157 |
|
2029
55ddf4c547ab
ask the current project for the defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
2004
diff
changeset
|
2158 |
|p| |
55ddf4c547ab
ask the current project for the defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
2004
diff
changeset
|
2159 |
|
55ddf4c547ab
ask the current project for the defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
2004
diff
changeset
|
2160 |
(Project notNil and:[(p := Project current) notNil]) ifTrue:[ |
6853 | 2161 |
^ p defaultNameSpace |
2029
55ddf4c547ab
ask the current project for the defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
2004
diff
changeset
|
2162 |
]. |
55ddf4c547ab
ask the current project for the defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
2004
diff
changeset
|
2163 |
|
2004
b660837fe0c7
renamed #currentNameSpace to #defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2164 |
^ self |
b660837fe0c7
renamed #currentNameSpace to #defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2165 |
|
b660837fe0c7
renamed #currentNameSpace to #defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2166 |
"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
|
2167 |
"Modified: 2.1.1997 / 20:01:31 / cg" |
2004
b660837fe0c7
renamed #currentNameSpace to #defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2168 |
! |
b660837fe0c7
renamed #currentNameSpace to #defaultNameSpace
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2169 |
|
5736 | 2170 |
globalnameCompletion:aPartialGlobalName |
2171 |
"given a partial globalName, return an array consisting of |
|
2172 |
2 entries: 1st: collection consisting of matching names |
|
6853 | 2173 |
2nd: the best (longest) match" |
5736 | 2174 |
|
2175 |
|searchName matches ignCaseMatches best isMatchString| |
|
2176 |
||
2177 |
searchName := aPartialGlobalName. |
|
2178 |
searchName isEmpty ifTrue:[ |
|
6853 | 2179 |
^ Array with:searchName with:#() |
5736 | 2180 |
]. |
2181 |
||
2182 |
(searchName at:1) isLowercase ifTrue:[ |
|
6853 | 2183 |
searchName := searchName copy asUppercaseFirst |
5736 | 2184 |
]. |
2185 |
||
2186 |
isMatchString := searchName includesMatchCharacters. |
|
2187 |
matches := OrderedCollection new. |
|
2188 |
ignCaseMatches := OrderedCollection new. |
|
2189 |
self keysDo:[:aGlobalName | |
|
6853 | 2190 |
| addIt| |
2191 |
||
2192 |
isMatchString ifTrue:[ |
|
2193 |
addIt := searchName match:aGlobalName |
|
2194 |
] ifFalse:[ |
|
2195 |
addIt := aGlobalName startsWith:searchName |
|
2196 |
]. |
|
2197 |
addIt ifTrue:[ |
|
2198 |
matches add:aGlobalName |
|
2199 |
] ifFalse:[ |
|
2200 |
"/ try ignoring case |
|
2201 |
isMatchString ifTrue:[ |
|
2202 |
addIt := searchName match:aGlobalName ignoreCase:true |
|
2203 |
] ifFalse:[ |
|
2204 |
addIt := aGlobalName asLowercase startsWith:searchName asLowercase |
|
2205 |
]. |
|
2206 |
addIt ifTrue:[ |
|
2207 |
ignCaseMatches add:aGlobalName |
|
2208 |
] |
|
2209 |
] |
|
5736 | 2210 |
]. |
2211 |
||
2212 |
matches isEmpty ifTrue:[ |
|
6853 | 2213 |
matches := ignCaseMatches |
5736 | 2214 |
]. |
2215 |
||
2216 |
matches isEmpty ifTrue:[ |
|
6853 | 2217 |
^ Array with:searchName with:(Array with:searchName) |
5736 | 2218 |
]. |
2219 |
matches size == 1 ifTrue:[ |
|
6853 | 2220 |
^ Array with:matches first with:(matches asArray) |
5736 | 2221 |
]. |
2222 |
matches := matches asSortedCollection. |
|
2223 |
isMatchString ifTrue:[ |
|
6853 | 2224 |
best := searchName. |
5736 | 2225 |
] ifFalse:[ |
6853 | 2226 |
best := matches longestCommonPrefix. |
5736 | 2227 |
]. |
2228 |
^ Array with:best with:matches asArray |
|
2229 |
||
2230 |
" |
|
2231 |
Smalltalk globalnameCompletion:'Arr' |
|
2232 |
Smalltalk globalnameCompletion:'Arra' |
|
2233 |
Smalltalk globalnameCompletion:'arra' |
|
2234 |
Smalltalk globalnameCompletion:'*rray' |
|
2235 |
" |
|
2236 |
||
2237 |
"Created: 24.11.1995 / 17:24:45 / cg" |
|
2238 |
"Modified: 3.4.1997 / 18:25:01 / cg" |
|
2239 |
! |
|
2240 |
||
6472
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2241 |
hasNamespaces |
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2242 |
"can be redefined by dummy namespaces/environments, to suppress |
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2243 |
the namespace display in a browser (PocketSmalltalk)" |
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2244 |
|
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2245 |
^ true |
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2246 |
! |
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2247 |
|
617 | 2248 |
includes:something |
2249 |
"this should come from Collection. |
|
2250 |
will change the inheritance - Smalltalk is actually a collection" |
|
2251 |
||
2252 |
self do:[:element | element = something ifTrue:[^ true]]. |
|
2253 |
^ false |
|
2254 |
! |
|
2255 |
||
5327
5e5602d156fa
#isNamespace renamed to #isNameSpace
Claus Gittinger <cg@exept.de>
parents:
5326
diff
changeset
|
2256 |
isNameSpace |
1706 | 2257 |
^ true |
2258 |
||
2259 |
"Created: 11.10.1996 / 18:10:43 / cg" |
|
2260 |
! |
|
2261 |
||
5371
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
2262 |
isTopLevelNameSpace |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
2263 |
^ true |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
2264 |
! |
6376d1fcf30f
use #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5365
diff
changeset
|
2265 |
|
4458 | 2266 |
isTopLevelNamespace |
5365 | 2267 |
"obsolete - use isTopLevelNameSpace" |
2268 |
||
7432 | 2269 |
<resource:#obsolete> |
2270 |
||
4458 | 2271 |
^ true |
2272 |
||
2273 |
"Created: 11.10.1996 / 18:10:43 / cg" |
|
2274 |
! |
|
2275 |
||
5505
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2276 |
methodProtocolCompletion:aPartialProtocolName |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2277 |
"given a partial method protocol name, return an array consisting of |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2278 |
2 entries: 1st: collection consisting of matching protocols |
6853 | 2279 |
2nd: the longest match" |
5505
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2280 |
|
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2281 |
|matches best lcName| |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2282 |
|
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2283 |
matches := IdentitySet new. |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2284 |
|
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2285 |
"/ search for exact match |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2286 |
self allClassesDo:[:aClass | |
6853 | 2287 |
aClass instAndClassSelectorsAndMethodsDo:[:aSelector :aMethod | |
2288 |
|protocol| |
|
2289 |
||
2290 |
protocol := aMethod category. |
|
2291 |
(protocol notNil and:[protocol startsWith:aPartialProtocolName]) ifTrue:[ |
|
2292 |
matches add:protocol |
|
2293 |
] |
|
2294 |
]. |
|
5505
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2295 |
]. |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2296 |
matches isEmpty ifTrue:[ |
6853 | 2297 |
"/ search for case-ignoring match |
2298 |
lcName := aPartialProtocolName asLowercase. |
|
2299 |
self allClassesDo:[:aClass | |
|
2300 |
aClass instAndClassSelectorsAndMethodsDo:[:aSelector :aMethod | |
|
2301 |
|protocol| |
|
2302 |
||
2303 |
protocol := aMethod category. |
|
2304 |
(protocol asLowercase startsWith:lcName) ifTrue:[ |
|
2305 |
matches add:protocol |
|
2306 |
] |
|
2307 |
]. |
|
2308 |
]. |
|
5505
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2309 |
]. |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2310 |
|
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2311 |
matches isEmpty ifTrue:[ |
6853 | 2312 |
^ Array with:aPartialProtocolName with:(Array with:aPartialProtocolName) |
5505
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2313 |
]. |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2314 |
matches size == 1 ifTrue:[ |
6853 | 2315 |
^ Array with:matches first with:(matches asArray) |
5505
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2316 |
]. |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2317 |
matches := matches asSortedCollection. |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2318 |
best := matches longestCommonPrefix. |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2319 |
^ Array with:best with:matches asArray |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2320 |
|
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2321 |
" |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2322 |
Smalltalk methodProtocolCompletion:'doc' |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2323 |
Smalltalk methodProtocolCompletion:'docu' |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2324 |
Smalltalk methodProtocolCompletion:'documenta' |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2325 |
" |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2326 |
! |
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2327 |
|
617 | 2328 |
numberOfGlobals |
2329 |
"return the number of global variables in the system" |
|
2330 |
||
2331 |
|tally "{ Class: SmallInteger }" | |
|
2332 |
||
2333 |
tally := 0. |
|
2334 |
self do:[:obj | tally := tally + 1]. |
|
2335 |
^ tally |
|
2336 |
||
2337 |
"Smalltalk numberOfGlobals" |
|
2338 |
! |
|
2339 |
||
3260 | 2340 |
referencesAny:aCollection |
2341 |
"redefined, since the references are only kept in the VM's symbol table" |
|
2342 |
||
2343 |
self keysAndValuesDo:[:key :val | |
|
6853 | 2344 |
aCollection do:[:anObject | |
2345 |
(key == anObject) ifTrue:[^ true]. |
|
2346 |
(val == anObject ) ifTrue:[^ true]. |
|
2347 |
] |
|
3260 | 2348 |
]. |
2349 |
^ super referencesAny:aCollection |
|
2350 |
||
2351 |
"Created: / 2.2.1998 / 16:01:20 / cg" |
|
2352 |
! |
|
2353 |
||
617 | 2354 |
referencesDerivedInstanceOf:aClass |
2355 |
"redefined, since the references are only kept in the VM's symbol table" |
|
2356 |
||
2357 |
self keysAndValuesDo:[:key :val | |
|
6853 | 2358 |
(key isKindOf:aClass) ifTrue:[^ true]. |
2359 |
(val isKindOf:aClass) ifTrue:[^ true]. |
|
617 | 2360 |
]. |
2361 |
^ super referencesDerivedInstanceOf:aClass |
|
2362 |
! |
|
2363 |
||
2364 |
referencesInstanceOf:aClass |
|
2365 |
"redefined, since the references are only kept in the VM's symbol table" |
|
2366 |
||
2367 |
self keysAndValuesDo:[:key :val | |
|
6853 | 2368 |
(key isMemberOf:aClass) ifTrue:[^ true]. |
2369 |
(val isMemberOf:aClass) ifTrue:[^ true]. |
|
617 | 2370 |
]. |
2371 |
^ super referencesInstanceOf:aClass |
|
2372 |
! |
|
2373 |
||
6074
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
2374 |
referencesObject:anObject |
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
2375 |
"redefined, since the references are only kept in the VM's symbol table" |
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
2376 |
|
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
2377 |
self keysAndValuesDo:[:key :val | |
6853 | 2378 |
(key == anObject) ifTrue:[^ true]. |
2379 |
(val == anObject ) ifTrue:[^ true]. |
|
6074
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
2380 |
]. |
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
2381 |
^ super referencesObject:anObject |
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
2382 |
|
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
2383 |
"Modified: / 3.2.1998 / 14:22:46 / cg" |
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
2384 |
! |
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
2385 |
|
4354
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
2386 |
resolveName:nameIn inClass:aClass |
3026 | 2387 |
"resolve aName as if compiled within aClass; |
2388 |
i.e. if it has a private class with this name, return it; |
|
2389 |
if aName is known within the classes namespace, return that. |
|
2390 |
Otherwise, return a global with that name. |
|
2391 |
This should be used whereever Smalltalk>>at: used to be used, |
|
2392 |
to resolve a global by name." |
|
2393 |
||
4354
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
2394 |
|aName sym cls ns| |
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
2395 |
|
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
2396 |
nameIn isNil ifTrue:[^ nil]. |
4356 | 2397 |
nameIn isBehavior ifTrue:[^ nameIn]. "/ already resolved |
4354
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
2398 |
aName := nameIn. |
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
2399 |
|
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
2400 |
(aName startsWith:'Smalltalk::') ifTrue:[ |
6853 | 2401 |
aName := aName copyFrom:12. |
2402 |
^ self at:(aName asSymbol) ifAbsent:nil. |
|
4354
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
2403 |
]. |
3026 | 2404 |
|
2405 |
sym := aName asSymbol. |
|
2406 |
||
2407 |
cls := aClass privateClassesAt:sym. |
|
2408 |
cls notNil ifTrue:[^ cls]. |
|
2409 |
||
2410 |
ns := aClass nameSpace. |
|
2411 |
(ns notNil and:[ns ~~ Smalltalk]) ifTrue:[ |
|
6853 | 2412 |
ns isNameSpace ifTrue:[ |
2413 |
cls := ns at:sym ifAbsent:nil. |
|
2414 |
] ifFalse:[ |
|
2415 |
cls := ns privateClassesAt:sym |
|
2416 |
]. |
|
2417 |
cls notNil ifTrue:[^ cls]. |
|
3025 | 2418 |
]. |
3026 | 2419 |
^ self at:sym ifAbsent:nil. |
4356 | 2420 |
|
2421 |
"Modified: / 9.7.1999 / 01:18:07 / cg" |
|
3025 | 2422 |
! |
2423 |
||
453 | 2424 |
selectorCompletion:aPartialSymbolName |
2425 |
"given a partial selector, return an array consisting of |
|
2426 |
2 entries: 1st: collection consisting of matching implemented selectors |
|
6853 | 2427 |
2nd: the longest match" |
3565
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
2428 |
|
6472
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2429 |
^ self |
6853 | 2430 |
selectorCompletion:aPartialSymbolName inEnvironment:self |
6472
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2431 |
! |
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2432 |
|
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2433 |
selectorCompletion:aPartialSymbolName inEnvironment:anEnvironment |
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2434 |
"given a partial selector, return an array consisting of |
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2435 |
2 entries: 1st: collection consisting of matching implemented selectors |
6853 | 2436 |
2nd: the longest match" |
6472
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2437 |
|
3565
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
2438 |
|matches best lcSym| |
453 | 2439 |
|
2440 |
matches := IdentitySet new. |
|
3565
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
2441 |
|
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
2442 |
"/ search for exact match |
6472
72a32fbfa191
allow for completion algorithm to be used on another ns
Claus Gittinger <cg@exept.de>
parents:
6438
diff
changeset
|
2443 |
anEnvironment allClassesDo:[:aClass | |
6853 | 2444 |
aClass instAndClassSelectorsAndMethodsDo:[:aSelector :aMethod | |
2445 |
(aSelector startsWith:aPartialSymbolName) ifTrue:[ |
|
2446 |
matches add:aSelector |
|
2447 |
] |
|
2448 |
]. |
|
3565
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
2449 |
]. |
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
2450 |
matches isEmpty ifTrue:[ |
6853 | 2451 |
"/ search for case-ignoring match |
2452 |
lcSym := aPartialSymbolName asLowercase. |
|
2453 |
anEnvironment allClassesDo:[:aClass | |
|
2454 |
aClass instAndClassSelectorsAndMethodsDo:[:aSelector :aMethod | |
|
2455 |
(aSelector asLowercase startsWith:lcSym) ifTrue:[ |
|
2456 |
matches add:aSelector |
|
2457 |
] |
|
2458 |
]. |
|
2459 |
]. |
|
3565
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
2460 |
]. |
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
2461 |
|
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
2462 |
matches isEmpty ifTrue:[ |
6853 | 2463 |
^ Array with:aPartialSymbolName with:(Array with:aPartialSymbolName) |
3565
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
2464 |
]. |
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
2465 |
matches size == 1 ifTrue:[ |
6853 | 2466 |
^ Array with:matches first with:(matches asArray) |
453 | 2467 |
]. |
2468 |
matches := matches asSortedCollection. |
|
2469 |
best := matches longestCommonPrefix. |
|
2470 |
^ Array with:best with:matches asArray |
|
2471 |
||
2472 |
" |
|
2473 |
Smalltalk selectorCompletion:'at:p' |
|
2474 |
Smalltalk selectorCompletion:'nextP' |
|
3565
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
2475 |
Smalltalk selectorCompletion:'nextp' |
453 | 2476 |
" |
1461
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1455
diff
changeset
|
2477 |
|
3565
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
2478 |
"Modified: / 7.6.1996 / 08:44:33 / stefan" |
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
2479 |
"Modified: / 14.6.1998 / 15:54:03 / cg" |
453 | 2480 |
! ! |
2481 |
||
4431 | 2482 |
!Smalltalk class methodsFor:'queries-system'! |
2483 |
||
7348 | 2484 |
dialectName |
2485 |
^ 'SmalltalkX' |
|
2486 |
||
2487 |
" |
|
2488 |
Smalltalk dialectName |
|
2489 |
" |
|
2490 |
! |
|
2491 |
||
2492 |
dialectReleaseVersion |
|
2493 |
^ self versionString |
|
2494 |
||
2495 |
" |
|
2496 |
Smalltalk dialectReleaseVersion |
|
2497 |
" |
|
2498 |
! |
|
2499 |
||
4970 | 2500 |
isDolphinSmalltalk |
2501 |
"return false here - this may be useful to write portable |
|
2502 |
applications - add #isDolphinSmalltalk to your dolphin, |
|
2503 |
returning true there." |
|
2504 |
||
2505 |
^ false |
|
2506 |
! |
|
2507 |
||
2508 |
isSmalltalkMT |
|
2509 |
"return false here - this may be useful to write portable |
|
2510 |
applications - add #isSmalltalkMT to your smalltalk-MT, |
|
2511 |
returning true there." |
|
2512 |
||
2513 |
^ false |
|
2514 |
! |
|
2515 |
||
4431 | 2516 |
isSmalltalkV |
2517 |
"return false here - this may be useful to write portable |
|
2518 |
applications - add #isSmalltalkV to your smalltalkV, |
|
2519 |
returning true there." |
|
2520 |
||
2521 |
^ false |
|
2522 |
! |
|
2523 |
||
2524 |
isSmalltalkX |
|
2525 |
"return true here - this may be useful to write portable |
|
2526 |
applications - add #isSmalltalkX to your other smalltalks, |
|
2527 |
returning false there." |
|
2528 |
||
2529 |
^ true |
|
2530 |
! |
|
2531 |
||
2532 |
isSqueak |
|
2533 |
"return false here - this may be useful to write portable |
|
2534 |
applications - add #isSqueak to your squeak, |
|
2535 |
returning true there." |
|
2536 |
||
2537 |
^ false |
|
2538 |
! |
|
2539 |
||
2540 |
isVisualAge |
|
2541 |
"return false here - this may be useful to write portable |
|
2542 |
applications - add #isVisualAge to your visualAge, |
|
2543 |
returning true there." |
|
2544 |
||
2545 |
^ false |
|
2546 |
! |
|
2547 |
||
2548 |
isVisualWorks |
|
2549 |
"return false here - this may be useful to write portable |
|
2550 |
applications - add #isVisualWorks to your visualWorks, |
|
2551 |
returning true there." |
|
2552 |
||
2553 |
^ false |
|
2554 |
! ! |
|
2555 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
2556 |
!Smalltalk class methodsFor:'startup'! |
1 | 2557 |
|
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2558 |
displayInitializationDone |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2559 |
"inform the restart, that the display has been initialized" |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2560 |
|
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2561 |
CallbackSignal raiseRequest. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2562 |
! |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2563 |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2564 |
mainStartup:graphicalMode |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2565 |
"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
|
2566 |
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
|
2567 |
|
7043
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
2568 |
|process imageName thisIsARestart| |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2569 |
|
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2570 |
imageName := ObjectMemory imageName. |
2249
cdb6c87f0707
send returnFromSnapshot notification later -
Claus Gittinger <cg@exept.de>
parents:
2212
diff
changeset
|
2571 |
thisIsARestart := imageName notNil. |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2572 |
|
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2573 |
" |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2574 |
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
|
2575 |
" |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2576 |
Display notNil ifTrue:[ |
7039
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2577 |
Display deviceIOTimeoutErrorSignal handlerBlock:[:ex | |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2578 |
SaveEmergencyImage == true ifTrue:[ |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2579 |
'Display [warning]: broken display connection - emergency save in ''crash.img''.' infoPrintCR. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2580 |
ObjectMemory primSnapShotOn:'crash.img'. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2581 |
]. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2582 |
'Display [warning]: broken display connection - exit.' infoPrintCR. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2583 |
Smalltalk exit. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2584 |
]. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2585 |
Display startDispatch. |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2586 |
]. |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2587 |
|
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2588 |
Initializing := false. |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2589 |
|
2074
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
2590 |
"/ 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
|
2591 |
"/ 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
|
2592 |
"/ 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
|
2593 |
"/ 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
|
2594 |
|
7043
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
2595 |
process := [ |
7039
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2596 |
StartBlocks notNil ifTrue:[ |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2597 |
StartBlocks do:[:aBlock| |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2598 |
aBlock value |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2599 |
]. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2600 |
StartBlocks := nil. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2601 |
]. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2602 |
ImageStartBlocks notNil ifTrue:[ |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2603 |
ImageStartBlocks do:[:aBlock| |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2604 |
aBlock value |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2605 |
]. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2606 |
]. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2607 |
StandAlone ifFalse:[ |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2608 |
(SilentLoading == true) ifFalse:[ "i.e. undefined counts as false" |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2609 |
thisIsARestart ifTrue:[ |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2610 |
Transcript cr. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2611 |
Transcript showCR:('Smalltalk restarted from:' |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2612 |
, imageName |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2613 |
, ' (saved ' |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2614 |
, ObjectMemory imageSaveTime printString |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2615 |
, ')' ). |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2616 |
] ifFalse:[ |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2617 |
Transcript showCR:(self hello). |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2618 |
Transcript showCR:(self copyrightString). |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2619 |
Transcript cr. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2620 |
]. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2621 |
Transcript cr. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2622 |
]. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2623 |
|
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2624 |
DemoMode==true ifTrue:[ |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2625 |
Transcript showCR:'*** Restricted use: ***'. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2626 |
Transcript showCR:'*** This program may be used for education only. ***'. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2627 |
Transcript showCR:'*** Please read the files COPYRIGHT and LICENSE ***'. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2628 |
Transcript showCR:'*** for more details. ***'. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2629 |
Transcript cr. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2630 |
]. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2631 |
]. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2632 |
|
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2633 |
thisIsARestart ifTrue:[ |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2634 |
"/ |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2635 |
"/ the final late notification - users can now assume that |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2636 |
"/ views, forms etc. have been recreated. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2637 |
|
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2638 |
ObjectMemory changed:#returnFromSnapshot. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2639 |
] |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2640 |
|
7040 | 2641 |
] newProcess. |
2642 |
||
7043
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
2643 |
process priority:8. |
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
2644 |
process name:'start block handler'. |
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
2645 |
process beGroupLeader. |
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
2646 |
process resume. |
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
2647 |
process := nil. |
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
2648 |
|
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
2649 |
|
2074
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
2650 |
"/ 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
|
2651 |
"/ message. |
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
2652 |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2653 |
(StartupClass notNil and:[StartupSelector notNil]) ifTrue:[ |
7039
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2654 |
" |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2655 |
allow more customization by reading an image specific rc-file |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2656 |
" |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2657 |
thisIsARestart ifTrue:[ |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2658 |
(imageName asFilename hasSuffix:'img') ifTrue:[ |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2659 |
imageName := imageName copyWithoutLast:4 |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2660 |
]. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2661 |
self fileIn:(imageName , '.rc') |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2662 |
]. |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2663 |
|
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2664 |
"/ Display notNil ifTrue:[ |
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2665 |
"/ Display exitOnLastClose:true. |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2666 |
"/ ]. |
2086 | 2667 |
"/ Processor exitWhenNoMoreUserProcesses:true. |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2668 |
|
7043
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
2669 |
process := [ |
7039
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2670 |
StandAlone ifTrue:[ |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2671 |
AbortSignal handle:[:ex | |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2672 |
OperatingSystem exit:1 |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2673 |
] do:[ |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2674 |
StartupClass perform:StartupSelector withArguments:StartupArguments. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2675 |
] |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2676 |
] ifFalse:[ |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2677 |
StartupClass perform:StartupSelector withArguments:StartupArguments. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2678 |
]. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2679 |
|
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2680 |
"/ |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2681 |
"/ non-GUI apps exit after the startup; |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2682 |
"/ assume that GUI apps have created & opened some view ... |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2683 |
"/ |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2684 |
Display isNil ifTrue:[ |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2685 |
Smalltalk exit. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2686 |
]. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2687 |
"/ |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2688 |
"/ GUI apps exit after the last user process has finished |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2689 |
"/ |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2690 |
Display exitOnLastClose:true. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2691 |
Processor exitWhenNoMoreUserProcesses:true. |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2692 |
] newProcess. |
7043
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
2693 |
process priority:8. |
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
2694 |
process name:'main'. |
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
2695 |
process beGroupLeader. |
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
2696 |
process resume. |
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
2697 |
process := true. "do not refer to process" |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2698 |
]. |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2699 |
|
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2700 |
" |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2701 |
if view-classes exist, start dispatching; |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2702 |
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
|
2703 |
" |
4957 | 2704 |
((Display notNil and:[graphicalMode]) |
7043
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
2705 |
or:[process notNil |
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2706 |
or:[HeadlessOperation]]) ifTrue:[ |
7039
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2707 |
Processor dispatchLoop. |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2708 |
] ifFalse:[ |
7039
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2709 |
StandAlone ifFalse:[ |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2710 |
self readEvalPrint |
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2711 |
] |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2712 |
]. |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2713 |
|
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2714 |
"done - the last process finished" |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2715 |
|
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2716 |
self exit |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2717 |
|
3062
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
2718 |
"Created: / 18.7.1996 / 21:07:39 / cg" |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
2719 |
"Modified: / 9.9.1996 / 17:42:50 / stefan" |
3483 | 2720 |
"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
|
2721 |
! |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2722 |
|
453 | 2723 |
readEvalPrint |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
2724 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
2725 |
|
453 | 2726 |
"simple read-eval-print loop for non-graphical Minitalk" |
2727 |
||
2728 |
|text| |
|
2729 |
||
2730 |
'ST- ' print. |
|
2731 |
Stdin skipSeparators. |
|
2732 |
Stdin atEnd ifFalse:[ |
|
6853 | 2733 |
text := Stdin nextChunk. |
2734 |
[text notNil] whileTrue:[ |
|
2735 |
AbortSignal handle:[:ex | |
|
2736 |
'evaluation aborted' printCR |
|
2737 |
] do:[ |
|
2738 |
Compiler isNil ifTrue:[ |
|
2739 |
'No evaluator class available (Compiler == nil)' printCR. |
|
2740 |
^ self |
|
2741 |
]. |
|
2742 |
(Compiler evaluate:text) printCR. |
|
2743 |
]. |
|
2744 |
'ST- ' print. |
|
2745 |
text := Stdin nextChunk |
|
2746 |
]. |
|
453 | 2747 |
]. |
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
2748 |
'' printCR |
453 | 2749 |
! |
2750 |
||
1 | 2751 |
restart |
24 | 2752 |
"startup after an image has been loaded; |
10 | 2753 |
there are three change-notifications made to dependents of ObjectMemory, |
2754 |
which allow a stepwise re-init: #earlyRestart, #restarted and #returnFromSnapshot. |
|
335 | 2755 |
|
3096
881660d6e997
added #earlySystemInitialization change message (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3092
diff
changeset
|
2756 |
#earlySystemInstallation is sent for ST80 compatibility |
881660d6e997
added #earlySystemInitialization change message (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3092
diff
changeset
|
2757 |
|
10 | 2758 |
#earlyRestart is send first, nothing has been setup yet. |
6853 | 2759 |
(should be used to flush all device dependent entries) |
335 | 2760 |
|
10 | 2761 |
#restarted is send right after. |
6853 | 2762 |
(should be used to recreate external resources (fds, bitmaps etc) |
335 | 2763 |
|
10 | 2764 |
#returnFromSnapshot is sent last |
6853 | 2765 |
(should be used to restart processes, reOpen Streams which cannot |
2766 |
be automatically be reopened (i.e. Sockets, Pipes) and so on. |
|
2767 |
(Notice that positionable fileStreams are already reopened and repositioned) |
|
1 | 2768 |
" |
10 | 2769 |
|
4503
99718971ba26
Redirect Transcript to Stderr during restart-initialization.
Stefan Vogel <sv@exept.de>
parents:
4490
diff
changeset
|
2770 |
|deb insp transcript idx| |
1 | 2771 |
|
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2772 |
"/ |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2773 |
"/ when we arrive here, all objects from our previous life |
3971 | 2774 |
"/ 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
|
2775 |
"/ handles, display information etc. |
3971 | 2776 |
"/ also, dynamically loaded modules have not yet been reloaded yet. |
2777 |
"/ and the concrete OS, concrete FileName etc. are still refering to |
|
2778 |
"/ 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
|
2779 |
|
1 | 2780 |
Initializing := true. |
3499 | 2781 |
AbstractOperatingSystem initializeConcreteClass. |
2782 |
||
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2783 |
ImageRestartTime := AbsoluteTime now. |
335 | 2784 |
|
1580
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2785 |
CommandLine := CommandLineArguments copy. |
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2786 |
CommandLineArguments := CommandLineArguments asOrderedCollection. |
6842 | 2787 |
CommandName := CommandLineArguments removeFirst. "/ the command |
1580
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2788 |
|
1582 | 2789 |
idx := CommandLineArguments indexOf:'-q'. |
6881 | 2790 |
idx == 0 ifTrue:[ |
2791 |
idx := CommandLineArguments indexOf:'--silent'. |
|
2792 |
]. |
|
1582 | 2793 |
idx ~~ 0 ifTrue:[ |
6853 | 2794 |
Object infoPrinting:false. |
2795 |
ObjectMemory infoPrinting:false. |
|
2796 |
CommandLineArguments removeAtIndex:idx. |
|
1582 | 2797 |
]. |
2798 |
||
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2799 |
"/ |
3971 | 2800 |
"/ start catching SIGSEGV and SIGBUS |
2801 |
||
2802 |
OperatingSystem enableHardSignalInterrupts. |
|
2803 |
||
2907 | 2804 |
"/ reinit Filename |
2805 |
Filename reinitialize. |
|
2806 |
||
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2807 |
"/ |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2808 |
"/ 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
|
2809 |
|
329 | 2810 |
self flushPathCaches. |
1 | 2811 |
|
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2812 |
"/ |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2813 |
"/ 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
|
2814 |
"/ 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
|
2815 |
|
477
8710aba7876b
oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents:
457
diff
changeset
|
2816 |
self reinitStandardStreams. |
8710aba7876b
oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents:
457
diff
changeset
|
2817 |
|
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2818 |
"/ |
4503
99718971ba26
Redirect Transcript to Stderr during restart-initialization.
Stefan Vogel <sv@exept.de>
parents:
4490
diff
changeset
|
2819 |
"/ redirect Transcript to Stderr during startup |
99718971ba26
Redirect Transcript to Stderr during restart-initialization.
Stefan Vogel <sv@exept.de>
parents:
4490
diff
changeset
|
2820 |
|
99718971ba26
Redirect Transcript to Stderr during restart-initialization.
Stefan Vogel <sv@exept.de>
parents:
4490
diff
changeset
|
2821 |
transcript := Transcript. |
99718971ba26
Redirect Transcript to Stderr during restart-initialization.
Stefan Vogel <sv@exept.de>
parents:
4490
diff
changeset
|
2822 |
Transcript := Stderr. |
99718971ba26
Redirect Transcript to Stderr during restart-initialization.
Stefan Vogel <sv@exept.de>
parents:
4490
diff
changeset
|
2823 |
|
99718971ba26
Redirect Transcript to Stderr during restart-initialization.
Stefan Vogel <sv@exept.de>
parents:
4490
diff
changeset
|
2824 |
"/ |
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2825 |
"/ temporary switch back to dumb interface - |
4503
99718971ba26
Redirect Transcript to Stderr during restart-initialization.
Stefan Vogel <sv@exept.de>
parents:
4490
diff
changeset
|
2826 |
"/ to handle errors while view-stuff is not yet reinitialized |
1 | 2827 |
|
2828 |
insp := Inspector. |
|
2829 |
deb := Debugger. |
|
684
3e0b5a8ec381
invalidate display connection during early startup
Claus Gittinger <cg@exept.de>
parents:
680
diff
changeset
|
2830 |
deb notNil ifTrue:[ |
6853 | 2831 |
deb reinitialize |
684
3e0b5a8ec381
invalidate display connection during early startup
Claus Gittinger <cg@exept.de>
parents:
680
diff
changeset
|
2832 |
]. |
1 | 2833 |
Inspector := MiniInspector. |
2834 |
Debugger := MiniDebugger. |
|
2835 |
||
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2836 |
"/ 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
|
2837 |
"/ 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
|
2838 |
"/ 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
|
2839 |
"/ this code. |
3155
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
2840 |
"/ 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
|
2841 |
"/ ObjectFileLoader; therefore, must reload before doing any notifications. |
335 | 2842 |
|
1100
eebf3ed54b23
reloadAllObjectFiles now called explicit (its too late via ObjMem changed)
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
2843 |
ObjectFileLoader notNil ifTrue:[ |
6853 | 2844 |
ObjectFileLoader reloadAllRememberedObjectFiles. |
1100
eebf3ed54b23
reloadAllObjectFiles now called explicit (its too late via ObjMem changed)
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
2845 |
]. |
eebf3ed54b23
reloadAllObjectFiles now called explicit (its too late via ObjMem changed)
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
2846 |
|
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2847 |
"/ |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2848 |
"/ invalidate all display connections. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2849 |
"/ This is required to avoid trouble if someone accesses |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2850 |
"/ a display during early startup. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2851 |
|
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2852 |
Screen notNil ifTrue:[ |
6853 | 2853 |
Screen allScreens do:[:aDisplay | |
2854 |
aDisplay invalidateConnection |
|
2855 |
]. |
|
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2856 |
]. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2857 |
|
3155
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
2858 |
ObjectMemory changed:#earlySystemInstallation. |
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
2859 |
|
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2860 |
"/ |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2861 |
"/ reinitialize the Processor - restartable processes |
4109 | 2862 |
"/ 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
|
2863 |
"/ |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2864 |
Processor reinitialize. |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2865 |
|
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2866 |
"/ |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2867 |
"/ 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
|
2868 |
"/ (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
|
2869 |
|
3022 | 2870 |
ObjectMemory |
6853 | 2871 |
changed:#earlyRestart; changed:#restarted. |
1 | 2872 |
|
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2873 |
"/ |
3526
78245608c0b8
no need for last change (restarting processes).
Claus Gittinger <cg@exept.de>
parents:
3523
diff
changeset
|
2874 |
"/ start catching SIGINT and SIGQUIT |
78245608c0b8
no need for last change (restarting processes).
Claus Gittinger <cg@exept.de>
parents:
3523
diff
changeset
|
2875 |
|
78245608c0b8
no need for last change (restarting processes).
Claus Gittinger <cg@exept.de>
parents:
3523
diff
changeset
|
2876 |
OperatingSystem enableUserInterrupts. |
6390
41d5c47c33f0
Catch sigPWR and sigHUP on restart
Stefan Vogel <sv@exept.de>
parents:
6366
diff
changeset
|
2877 |
OperatingSystem enableCrashSignalInterrupts. |
3526
78245608c0b8
no need for last change (restarting processes).
Claus Gittinger <cg@exept.de>
parents:
3523
diff
changeset
|
2878 |
|
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2879 |
"/ 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
|
2880 |
"/ 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
|
2881 |
"/ -fastStart argument. |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2882 |
|
6881 | 2883 |
idx := CommandLineArguments indexOf:'--faststart'. |
1580
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2884 |
idx ~~ 0 ifTrue:[ |
6853 | 2885 |
CommandLineArguments removeAtIndex:idx. |
1580
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2886 |
] ifFalse:[ |
6853 | 2887 |
CallbackSignal := QuerySignal new. |
2888 |
[ |
|
2889 |
Class withoutUpdatingChangesDo:[ |
|
2890 |
(self fileIn:(self commandName , '_r.rc')) ifFalse:[ |
|
2891 |
"no _r.rc file where executable is; try default smalltalk_r.rc" |
|
2892 |
self fileIn:'smalltalk_r.rc' |
|
2893 |
]. |
|
2894 |
] |
|
2895 |
] on:CallbackSignal do:[:ex| |
|
2896 |
"/ now, display and view-stuff works; |
|
2897 |
"/ back to the previous debugging interface |
|
2898 |
||
2899 |
Inspector := insp. |
|
2900 |
Debugger := deb. |
|
2901 |
||
2902 |
"/ reinstall Transcript, if not changed during restart. |
|
2903 |
"/ if there was no Transcript, go to stderr |
|
2904 |
||
2905 |
(transcript notNil and:[Transcript == Stderr]) ifTrue:[ |
|
2906 |
Transcript := transcript. |
|
2907 |
]. |
|
2908 |
Initializing := false. |
|
2909 |
ex proceed. |
|
2910 |
]. |
|
2911 |
CallbackSignal := nil. |
|
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2912 |
]. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2913 |
|
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2914 |
"/ reinitialization (restart) of Display is normally performed |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2915 |
"/ in the restart script. If this has not been run for some reason, |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2916 |
"/ do in now. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2917 |
Initializing ifTrue:[ |
6853 | 2918 |
Display notNil ifTrue:[ |
2919 |
[ |
|
2920 |
Display reinitializeFor:Screen defaultDisplayName. |
|
2921 |
] on:Screen deviceOpenErrorSignal do:[ |
|
2922 |
'Smalltalk [error]: Cannot restart connection to: ' errorPrint. |
|
2923 |
Screen defaultDisplayName errorPrintCR. |
|
6852
7e4ea7876711
more changes for better standAlone operation
Claus Gittinger <cg@exept.de>
parents:
6851
diff
changeset
|
2924 |
OperatingSystem exit:1. |
6853 | 2925 |
]. |
2926 |
]. |
|
2927 |
"/ now, display and view-stuff works; |
|
2928 |
"/ back to the previous debugging interface |
|
2929 |
||
2930 |
Inspector := insp. |
|
2931 |
Debugger := deb. |
|
2932 |
||
2933 |
"/ reinstall Transcript, if not changed during restart. |
|
2934 |
"/ if there was no Transcript, go to stderr |
|
2935 |
||
2936 |
(transcript notNil and:[Transcript == Stderr]) ifTrue:[ |
|
2937 |
Transcript := transcript. |
|
2938 |
]. |
|
2939 |
Initializing := false. |
|
7 | 2940 |
]. |
2941 |
||
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2942 |
self mainStartup:true |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2943 |
|
3526
78245608c0b8
no need for last change (restarting processes).
Claus Gittinger <cg@exept.de>
parents:
3523
diff
changeset
|
2944 |
"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
|
2945 |
"Modified: / 3.8.1999 / 09:42:21 / stefan" |
1 | 2946 |
! |
2947 |
||
617 | 2948 |
start |
2949 |
"main startup, if there is a Display, initialize it |
|
2950 |
and start dispatching; otherwise go into a read-eval-print loop." |
|
2951 |
||
6852
7e4ea7876711
more changes for better standAlone operation
Claus Gittinger <cg@exept.de>
parents:
6851
diff
changeset
|
2952 |
|idx graphicalMode arg didReadRCFile| |
960
e3b75f50d0cd
changes for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
2953 |
|
e3b75f50d0cd
changes for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
2954 |
graphicalMode := true. |
617 | 2955 |
Initializing := true. |
2956 |
||
2957 |
" |
|
2958 |
while reading patches- and rc-file, do not add things into change-file |
|
2959 |
" |
|
2960 |
Class withoutUpdatingChangesDo:[ |
|
7275 | 2961 |
|myName defaultRC prevCatchSetting| |
2962 |
||
2963 |
"/ |
|
2964 |
"/ look for any '-q', '-e' or '-f' command line arguments |
|
2965 |
"/ and handle them; |
|
2966 |
"/ read startup and patches file |
|
2967 |
"/ |
|
2968 |
idx := CommandLineArguments indexOf:'-q'. |
|
6881 | 2969 |
idx == 0 ifTrue:[ |
2970 |
idx := CommandLineArguments indexOf:'--silent'. |
|
2971 |
]. |
|
7275 | 2972 |
idx ~~ 0 ifTrue:[ |
2973 |
Object infoPrinting:false. |
|
2974 |
ObjectMemory infoPrinting:false. |
|
2975 |
CommandLineArguments removeAtIndex:idx. |
|
2976 |
]. |
|
2977 |
||
2978 |
StandAlone ifFalse:[ |
|
2979 |
"/ look for a '-e filename' argument - this will force evaluation of |
|
2980 |
"/ filename only, no standard startup |
|
2981 |
||
2982 |
idx := CommandLineArguments indexOf:'-e'. |
|
6881 | 2983 |
idx == 0 ifTrue:[ |
2984 |
idx := CommandLineArguments indexOf:'--execute'. |
|
2985 |
]. |
|
7275 | 2986 |
idx ~~ 0 ifTrue:[ |
2987 |
arg := CommandLineArguments at:idx + 1. |
|
2988 |
||
2989 |
CommandLineArguments |
|
2990 |
removeAtIndex:idx+1; removeAtIndex:idx. |
|
2991 |
||
2992 |
arg = '-' ifTrue:[ |
|
2993 |
self fileInStream:Stdin |
|
2994 |
lazy:nil |
|
2995 |
silent:nil |
|
2996 |
logged:false |
|
2997 |
addPath:nil |
|
2998 |
] ifFalse:[ |
|
2999 |
self fileIn:arg. |
|
3000 |
]. |
|
3001 |
self exit |
|
3002 |
]. |
|
3003 |
]. |
|
3004 |
||
3005 |
"/ look for a '-f filename' argument - this will force evaluation of |
|
3006 |
"/ filename instead of smalltalk.rc |
|
3007 |
||
3008 |
idx := CommandLineArguments indexOf:'-f'. |
|
6881 | 3009 |
idx == 0 ifTrue:[ |
3010 |
idx := CommandLineArguments indexOf:'--file'. |
|
3011 |
]. |
|
7275 | 3012 |
idx ~~ 0 ifTrue:[ |
3013 |
myName := (CommandLineArguments at:idx + 1). |
|
3014 |
CommandLineArguments |
|
3015 |
removeAtIndex:idx+1; removeAtIndex:idx. |
|
3016 |
CommandLine at:1 put:myName. |
|
3017 |
(self secureFileIn:myName) ifFalse:[ |
|
3018 |
('Smalltalk [error]: startup file ', myName, ' not found.') errorPrintCR. |
|
3019 |
OperatingSystem exit:1. |
|
3020 |
]. |
|
3021 |
] ifFalse:[ |
|
3022 |
"/ look for <command>.rc |
|
3023 |
"/ if not found, read smalltalk.rc (or stxapp.rc for standAlone operation) |
|
3024 |
||
3025 |
didReadRCFile := false. |
|
3026 |
||
3027 |
myName := self commandName asFilename withSuffix:'rc'. |
|
3028 |
(didReadRCFile := self secureFileIn:myName) ifFalse:[ |
|
3029 |
StandAlone ifFalse:[ |
|
3030 |
defaultRC := 'smalltalk.rc' |
|
3031 |
] ifTrue:[ |
|
3032 |
defaultRC := 'stxapp.rc' |
|
3033 |
]. |
|
3034 |
||
3035 |
didReadRCFile := self secureFileIn:defaultRC. |
|
3036 |
didReadRCFile ifFalse:[ |
|
3037 |
StandAlone ifFalse:[ |
|
3038 |
'Smalltalk [warning]: no startup rc-file found. Going into line-by-line interpreter.' infoPrintCR. |
|
3039 |
graphicalMode := false. |
|
3040 |
] |
|
3041 |
] |
|
3042 |
]. |
|
3043 |
||
3044 |
"/ ('StandAlone is %1' bindWith:StandAlone) printCR. |
|
3045 |
"/ ('Headless is %1' bindWith:HeadlessOperation) printCR. |
|
3046 |
"/ ('Display is %1' bindWith:Display) printCR. |
|
3047 |
"/ ('Screen is %1' bindWith:Screen) printCR. |
|
3048 |
||
3049 |
didReadRCFile ifFalse:[ |
|
3050 |
StandAlone ifFalse:[ |
|
3051 |
"/ its a smalltalk - proceed in interpreter. |
|
3052 |
'Smalltalk [warning]: no startup rc-file found. Going into line-by-line interpreter.' infoPrintCR. |
|
3053 |
graphicalMode := false. |
|
3054 |
] ifTrue:[ |
|
3055 |
"/ its an application - try harder |
|
3056 |
||
3057 |
Screen notNil ifTrue:[ |
|
3058 |
[ |
|
3059 |
Screen openDefaultDisplay:nil. |
|
3060 |
] on:Screen deviceOpenErrorSignal do:[:ex| |
|
3061 |
('Smalltalk [error]: No Display connection to: ', ex parameter printString) errorPrintCR. |
|
3062 |
'Smalltalk [info]: Either set the DISPLAY environment variable,' infoPrintCR. |
|
3063 |
'Smalltalk [info]: or start smalltalk with a -display argument.' infoPrintCR. |
|
3064 |
HeadlessOperation == true ifFalse:[ |
|
3065 |
OperatingSystem exit:1. |
|
3066 |
]. |
|
3067 |
]. |
|
3068 |
||
3069 |
Display notNil ifTrue:[ |
|
3070 |
(self secureFileIn:'display.rc') ifFalse:[ |
|
3071 |
'Smalltalk [warning]: no display.rc found; screen setting might be wrong.' infoPrintCR. |
|
3072 |
] |
|
3073 |
]. |
|
3074 |
] |
|
3075 |
] |
|
3076 |
]. |
|
3077 |
]. |
|
617 | 3078 |
]. |
3079 |
||
6841
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
3080 |
StandAlone ifFalse:[ |
7275 | 3081 |
" |
3082 |
enable the graphical debugger/inspector |
|
3083 |
(they could have been (re)defined as autoloaded in the patches file) |
|
3084 |
" |
|
3085 |
self initStandardTools. |
|
963
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
3086 |
]. |
617 | 3087 |
|
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3088 |
(Display isNil or:[HeadlessOperation]) ifTrue:[ |
7275 | 3089 |
graphicalMode := false. |
2074
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
3090 |
]. |
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
3091 |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3092 |
self mainStartup:graphicalMode |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3093 |
|
5146 | 3094 |
"Modified: / 24.12.1999 / 00:26:54 / cg" |
1097 | 3095 |
! ! |
3096 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
3097 |
!Smalltalk class methodsFor:'startup queries'! |
1097 | 3098 |
|
1580
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
3099 |
commandLine |
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
3100 |
"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
|
3101 |
|
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
3102 |
^ CommandLine |
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
3103 |
|
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
3104 |
"Created: 19.7.1996 / 11:09:06 / cg" |
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
3105 |
! |
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
3106 |
|
6806 | 3107 |
commandLineArgumentNamed:aString |
6842 | 3108 |
"extract a named argument from the command line arguments." |
6806 | 3109 |
|
3110 |
|args index| |
|
3111 |
||
3112 |
args := self commandLineArguments. |
|
3113 |
index := args indexOf:aString. |
|
3114 |
(index between:1 and:(args size - 1)) ifTrue:[ |
|
6853 | 3115 |
^ args at:index+1 |
6806 | 3116 |
]. |
3117 |
^ nil. |
|
3118 |
||
3119 |
" |
|
3120 |
self commandLineArgumentNamed:'-display' |
|
3121 |
" |
|
3122 |
! |
|
3123 |
||
1097 | 3124 |
commandLineArguments |
1580
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
3125 |
"return the user command line arguments; |
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
3126 |
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
|
3127 |
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
|
3128 |
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
|
3129 |
the commandLineArguments will be #('foo' 'bar' 'baz'). |
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
3130 |
In contrast, the value returned by #commandLine will be the full set of words." |
1097 | 3131 |
|
3132 |
^ CommandLineArguments |
|
1580
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
3133 |
|
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
3134 |
"Modified: 19.7.1996 / 11:11:03 / cg" |
1097 | 3135 |
! |
3136 |
||
3137 |
commandName |
|
3138 |
"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
|
3139 |
can be something else for standAlone apps." |
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
3140 |
|
6842 | 3141 |
^ CommandName. |
1580
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
3142 |
|
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
3143 |
"Modified: 19.7.1996 / 11:11:16 / cg" |
1097 | 3144 |
! |
3145 |
||
4957 | 3146 |
isHeadless |
3147 |
"return true, if this is a headless application |
|
3148 |
i.e. no default Display connection is required/used" |
|
3149 |
||
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3150 |
^ HeadlessOperation |
4957 | 3151 |
! |
3152 |
||
1097 | 3153 |
isStandAloneApp |
3154 |
"return true, if this is a standAlone application |
|
3155 |
(in contrast to a full smalltalk system)." |
|
3156 |
||
3157 |
^ StandAlone |
|
617 | 3158 |
! |
3159 |
||
3160 |
startupArguments |
|
3161 |
"return the arguments passed to StartupClass" |
|
3162 |
||
3163 |
^ StartupArguments |
|
70 | 3164 |
! |
3165 |
||
3166 |
startupClass |
|
3167 |
"return the class, that will get the start message when smalltalk |
|
3168 |
starts and its non-nil. Usually this is nil, but saving an image |
|
3169 |
with a non-nil StartupClass allows stand-alone applications" |
|
3170 |
||
3171 |
^ StartupClass |
|
3172 |
! |
|
3173 |
||
617 | 3174 |
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
|
3175 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
3176 |
|
617 | 3177 |
"set the class, selector and arguments to be performed when smalltalk |
3178 |
starts. Setting those before saving a snapshot, will make the saved |
|
3179 |
image come up executing your application (instead of the normal mainloop)" |
|
3180 |
||
3181 |
StartupClass := aClass. |
|
3182 |
StartupSelector := aSymbol. |
|
3183 |
StartupArguments := anArrayOrNil |
|
3184 |
! |
|
3185 |
||
70 | 3186 |
startupSelector |
3187 |
"return the selector, that will be sent to StartupClass" |
|
3188 |
||
3189 |
^ StartupSelector |
|
3190 |
! ! |
|
3191 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
3192 |
!Smalltalk class methodsFor:'system environment'! |
1069 | 3193 |
|
3194 |
language |
|
3195 |
"return the language setting" |
|
3196 |
||
3197 |
^ Language |
|
1307 | 3198 |
|
3199 |
" |
|
3200 |
Smalltalk language |
|
3201 |
" |
|
3202 |
||
3203 |
"Modified: 26.4.1996 / 17:10:05 / cg" |
|
3204 |
! |
|
3205 |
||
3206 |
language:aLanguageSymbol |
|
3207 |
"set the language" |
|
3208 |
||
3209 |
Language := aLanguageSymbol. |
|
3210 |
self changed:#Language |
|
3211 |
||
3212 |
" |
|
3213 |
Smalltalk language:#de |
|
3214 |
" |
|
3215 |
||
3216 |
"Modified: 26.4.1996 / 17:13:34 / cg" |
|
1069 | 3217 |
! |
3218 |
||
3219 |
languageTerritory |
|
3220 |
"return the language territory setting" |
|
3221 |
||
3222 |
^ LanguageTerritory |
|
1307 | 3223 |
! |
3224 |
||
3225 |
languageTerritory:aTerritorySymbol |
|
3226 |
"set the language territory" |
|
3227 |
||
3228 |
LanguageTerritory := aTerritorySymbol. |
|
3229 |
self changed:#LanguageTerritory |
|
3230 |
||
3231 |
" |
|
3232 |
Time now |
|
3233 |
||
3234 |
Smalltalk languageTerritory:#us. |
|
3235 |
Time now |
|
3236 |
||
3237 |
Smalltalk languageTerritory:#de. |
|
3238 |
Time now |
|
3239 |
" |
|
3240 |
||
3241 |
"Modified: 26.4.1996 / 17:12:39 / cg" |
|
1069 | 3242 |
! ! |
3243 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
3244 |
!Smalltalk class methodsFor:'system management'! |
70 | 3245 |
|
617 | 3246 |
compressSources |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
3247 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
3248 |
|
617 | 3249 |
"compress the sources file, and remove all method source strings |
3250 |
from the system and replace them by refs to a string in the source file. |
|
3251 |
This is a bit different in ST/X than in other smalltalks, |
|
3252 |
since we use per-class sourcefiles for the compiled classes, |
|
3253 |
and a mix of in-memory strings and one-for-all sourceFile for |
|
3254 |
incremental compiled methods. |
|
3255 |
Therefore, only those sources which are not coming from compiled |
|
3256 |
methods are put into the 'st.src' file - all others are untouched. |
|
3257 |
This is being automated - so dont care for now." |
|
3258 |
||
7105
44c02807ca41
More openErrorSignal change preparations
Stefan Vogel <sv@exept.de>
parents:
7085
diff
changeset
|
3259 |
|newStream table source pos fileName| |
44c02807ca41
More openErrorSignal change preparations
Stefan Vogel <sv@exept.de>
parents:
7085
diff
changeset
|
3260 |
|
617 | 3261 |
" |
3262 |
first, find all methods which contain either a string-ref |
|
3263 |
or an external string in the 'st.src' file |
|
3264 |
" |
|
3265 |
newStream := 'src.tmp' asFilename writeStream. |
|
7105
44c02807ca41
More openErrorSignal change preparations
Stefan Vogel <sv@exept.de>
parents:
7085
diff
changeset
|
3266 |
newStream checkNilFileStream. |
617 | 3267 |
|
3268 |
table := IdentityDictionary new:100. |
|
3269 |
||
3270 |
Method allSubInstancesDo:[:aMethod | |
|
7054
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3271 |
source := nil. |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3272 |
aMethod sourcePosition notNil ifTrue:[ |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3273 |
aMethod sourceFilename = 'st.src' ifTrue:[ |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3274 |
source := aMethod source. |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3275 |
] |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3276 |
] ifFalse:[ |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3277 |
source := aMethod source |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3278 |
]. |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3279 |
|
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3280 |
source notNil ifTrue:[ |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3281 |
pos := newStream position1Based. |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3282 |
newStream nextChunkPut:source. |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3283 |
|
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3284 |
" |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3285 |
dont change the methods info - maybe some write error |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3286 |
occurs later, in that case we abort and leave everything |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3287 |
untouched. |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3288 |
" |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3289 |
table at:aMethod put:pos |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3290 |
] |
617 | 3291 |
]. |
3292 |
||
3293 |
newStream close. |
|
3294 |
||
3295 |
" |
|
3296 |
now, rename the new source file, |
|
3297 |
" |
|
3298 |
fileName := (ObjectMemory nameForSources). |
|
1693 | 3299 |
'src.tmp' asFilename renameTo:fileName. |
617 | 3300 |
|
3301 |
"good - now go over all changed methods, and change their |
|
3302 |
source reference" |
|
3303 |
||
3304 |
table keysAndValuesDo:[:aMethod :pos | |
|
7054
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3305 |
aMethod localSourceFilename:fileName position:pos. |
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
3306 |
"/ aMethod printCR. |
617 | 3307 |
]. |
3308 |
||
3309 |
" |
|
3310 |
Smalltalk compressSources |
|
3311 |
" |
|
1693 | 3312 |
|
2176
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2170
diff
changeset
|
3313 |
"Modified: 16.1.1997 / 01:25:58 / cg" |
617 | 3314 |
! |
3315 |
||
3044 | 3316 |
generateSingleSourceFile |
3317 |
"{ Pragma: +optSpace }" |
|
3318 |
||
3319 |
"generate the sources file, and remove all method source strings |
|
3320 |
from the system and replace them by refs to a string in the source file. |
|
3321 |
This makes the image independent from the per-class source files |
|
3322 |
and makes transportation of endUser applications easier, since |
|
3323 |
only 3 files (executable, image and sourceFile) need to be |
|
3324 |
transported." |
|
3325 |
||
3326 |
|newStream table source pos fileName| |
|
3327 |
||
3328 |
newStream := 'src.tmp' asFilename writeStream. |
|
7105
44c02807ca41
More openErrorSignal change preparations
Stefan Vogel <sv@exept.de>
parents:
7085
diff
changeset
|
3329 |
newStream checkNilFileStream. |
3044 | 3330 |
|
3331 |
table := IdentityDictionary new:100. |
|
3332 |
||
3333 |
Method allSubInstancesDo:[:aMethod | |
|
7054
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3334 |
source := aMethod source. |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3335 |
source notNil ifTrue:[ |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3336 |
pos := newStream position1Based. |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3337 |
newStream nextChunkPut:source. |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3338 |
|
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3339 |
" |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3340 |
dont change the methods info - maybe some write error |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3341 |
occurs later, in that case we abort and leave everything |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3342 |
untouched. |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3343 |
" |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3344 |
table at:aMethod put:pos |
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3345 |
] |
3044 | 3346 |
]. |
3347 |
||
3348 |
newStream close. |
|
3349 |
||
3350 |
" |
|
3351 |
now, rename the new source file, |
|
3352 |
" |
|
3353 |
fileName := (ObjectMemory nameForSources). |
|
3354 |
'src.tmp' asFilename renameTo:fileName. |
|
3355 |
||
3356 |
"good - now go over all changed methods, and change their |
|
3357 |
source reference" |
|
3358 |
||
3359 |
table keysAndValuesDo:[:aMethod :pos | |
|
7054
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
7043
diff
changeset
|
3360 |
aMethod localSourceFilename:fileName position:pos. |
3044 | 3361 |
"/ aMethod printCR. |
3362 |
]. |
|
3363 |
||
3364 |
" |
|
3365 |
Smalltalk generateSingleSourceFile |
|
3366 |
" |
|
3367 |
||
3368 |
"Modified: 16.1.1997 / 01:25:58 / cg" |
|
3369 |
"Created: 17.10.1997 / 13:00:56 / cg" |
|
3370 |
! |
|
3371 |
||
3915
e32e63ee0d79
extracted autoload-class generation into extra method
Claus Gittinger <cg@exept.de>
parents:
3866
diff
changeset
|
3372 |
installAutoloadedClassNamed:clsName category:cat package:package revision:revisionOrNil |
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3373 |
"create & install an autoload stub for a class named: clsName, |
3915
e32e63ee0d79
extracted autoload-class generation into extra method
Claus Gittinger <cg@exept.de>
parents:
3866
diff
changeset
|
3374 |
to be loaded from package. |
e32e63ee0d79
extracted autoload-class generation into extra method
Claus Gittinger <cg@exept.de>
parents:
3866
diff
changeset
|
3375 |
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
|
3376 |
(otherwise, the newest revision will be loaded" |
e32e63ee0d79
extracted autoload-class generation into extra method
Claus Gittinger <cg@exept.de>
parents:
3866
diff
changeset
|
3377 |
|
e32e63ee0d79
extracted autoload-class generation into extra method
Claus Gittinger <cg@exept.de>
parents:
3866
diff
changeset
|
3378 |
|clsSym cls| |
e32e63ee0d79
extracted autoload-class generation into extra method
Claus Gittinger <cg@exept.de>
parents:
3866
diff
changeset
|
3379 |
|
e32e63ee0d79
extracted autoload-class generation into extra method
Claus Gittinger <cg@exept.de>
parents:
3866
diff
changeset
|
3380 |
clsSym := clsName asSymbol. |
e32e63ee0d79
extracted autoload-class generation into extra method
Claus Gittinger <cg@exept.de>
parents:
3866
diff
changeset
|
3381 |
|
e32e63ee0d79
extracted autoload-class generation into extra method
Claus Gittinger <cg@exept.de>
parents:
3866
diff
changeset
|
3382 |
"/ install if not already compiled-in |
5716 | 3383 |
(cls := self at:clsSym) isNil ifTrue:[ |
7248 | 3384 |
Autoload subclass:clsSym |
3385 |
instanceVariableNames:'' |
|
3386 |
classVariableNames:'' |
|
3387 |
poolDictionaries:'' |
|
3388 |
category:cat |
|
3389 |
inEnvironment:Smalltalk. |
|
3390 |
||
3391 |
cls := self at:clsSym. |
|
3392 |
cls isNil ifTrue:[ |
|
3393 |
('Smalltalk [warning]: failed to install ' , clsName , ' as autoloaded.') infoPrintCR. |
|
3394 |
] ifFalse:[ |
|
3395 |
cls package:package asSymbol. |
|
3396 |
revisionOrNil notNil ifTrue:[ |
|
3397 |
cls setBinaryRevision:revisionOrNil |
|
3398 |
] |
|
3399 |
] |
|
5716 | 3400 |
] ifFalse:[ |
7248 | 3401 |
"/ class already present - however, check for category/package change |
3402 |
package ~= cls package ifTrue:[ |
|
3403 |
cls package:package asSymbol. |
|
3404 |
]. |
|
3405 |
cat ~= cls category ifTrue:[ |
|
3406 |
cls category:cat. |
|
7249 | 3407 |
Smalltalk changed:#organization. |
7248 | 3408 |
]. |
5716 | 3409 |
]. |
3915
e32e63ee0d79
extracted autoload-class generation into extra method
Claus Gittinger <cg@exept.de>
parents:
3866
diff
changeset
|
3410 |
|
e32e63ee0d79
extracted autoload-class generation into extra method
Claus Gittinger <cg@exept.de>
parents:
3866
diff
changeset
|
3411 |
"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
|
3412 |
! |
e32e63ee0d79
extracted autoload-class generation into extra method
Claus Gittinger <cg@exept.de>
parents:
3866
diff
changeset
|
3413 |
|
3044 | 3414 |
installAutoloadedClasses |
3415 |
"read the standard abbreviation file; install all classes found there as |
|
3416 |
autoloaded. This takes some time ..." |
|
3417 |
||
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3418 |
|dirsConsulted p| |
4458 | 3419 |
|
3420 |
"/ new scheme: look for a directory called 'packages' |
|
3421 |
"/ and enumerate its abbrev.stc files... |
|
5067
335c866e150c
walk packagePath when reading abbrevs & autoloaded classes.
Claus Gittinger <cg@exept.de>
parents:
5065
diff
changeset
|
3422 |
dirsConsulted := Set new. |
5162 | 3423 |
|
3424 |
"/ no longer - only consult the packagePath ... |
|
3425 |
"/ f := Smalltalk getSystemFileName:'packages'. |
|
3426 |
"/ f notNil ifTrue:[ |
|
3427 |
"/ f := f asFilename. |
|
3428 |
"/ f isDirectory ifTrue:[ |
|
3429 |
"/ ('Smalltalk [info]: installing autoloaded classes found under ''' , f pathName ,'''') infoPrintCR. |
|
3430 |
"/ self |
|
3431 |
"/ recursiveInstallAutoloadedClassesFrom:f |
|
3432 |
"/ rememberIn:dirsConsulted |
|
7286 | 3433 |
"/ maxLevels:15 |
5162 | 3434 |
"/ noAutoload:false |
3435 |
"/ packageTop:f. |
|
3436 |
"/ ]. |
|
3437 |
"/ ]. |
|
3438 |
||
3439 |
"/ along the package-path |
|
5788 | 3440 |
(p := self packagePath) do:[:aPath | |
7286 | 3441 |
(dirsConsulted includes:aPath) ifFalse:[ |
3442 |
('Smalltalk [info]: installing autoloaded classes found under ''' , aPath ,'''') infoPrintCR. |
|
3443 |
self |
|
3444 |
recursiveInstallAutoloadedClassesFrom:aPath |
|
3445 |
rememberIn:dirsConsulted |
|
3446 |
maxLevels:15 |
|
3447 |
noAutoload:false |
|
3448 |
packageTop:aPath. |
|
3449 |
] |
|
5788 | 3450 |
]. |
3451 |
p size == 0 ifTrue:[ |
|
7286 | 3452 |
('Smalltalk [info]: installing autoloaded classes found under ''../../..''') infoPrintCR. |
3453 |
self |
|
3454 |
recursiveInstallAutoloadedClassesFrom:'../../..' |
|
3455 |
rememberIn:dirsConsulted |
|
3456 |
maxLevels:15 |
|
3457 |
noAutoload:false |
|
3458 |
packageTop:'../../..'. |
|
5788 | 3459 |
]. |
3460 |
||
4458 | 3461 |
"/ old scheme: look for a single file called 'abbrev.stc' in the |
3462 |
"/ include directory. This will vanish. |
|
3463 |
||
5096 | 3464 |
"/ ('Smalltalk [info]: installing autoloaded classes from ''include/abbrev.stc''') infoPrintCR. |
3465 |
"/ self installAutoloadedClassesFrom:'include/abbrev.stc' |
|
3044 | 3466 |
|
3467 |
" |
|
3468 |
Smalltalk installAutoloadedClasses |
|
3469 |
" |
|
3470 |
||
5096 | 3471 |
"Created: / 14.2.1997 / 17:32:57 / cg" |
3472 |
"Modified: / 13.12.1999 / 11:56:50 / cg" |
|
3044 | 3473 |
! |
3474 |
||
3475 |
installAutoloadedClassesFrom:anAbbrevFilePath |
|
3476 |
"read the given abbreviation file; install all classes found there as |
|
3477 |
autoloaded. This takes some time ..." |
|
3478 |
||
4458 | 3479 |
|f s| |
3044 | 3480 |
|
3481 |
f := self getSystemFileName:anAbbrevFilePath. |
|
6714
f4ab666995e0
Search packagePath for autoloaded classes
Stefan Vogel <sv@exept.de>
parents:
6711
diff
changeset
|
3482 |
f isNil ifTrue:[f := self getPackageFileName:anAbbrevFilePath]. |
3044 | 3483 |
|
3484 |
f notNil ifTrue:[ |
|
7085
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3485 |
f := f asFilename. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3486 |
f isDirectory ifTrue:[ |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3487 |
f := f construct:'abbrev.stc' |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3488 |
]. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3489 |
[ |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3490 |
s := f readStream. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3491 |
self installAutoloadedClassesFromStream:s. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3492 |
s close. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3493 |
] on:FileStream openErrorSignal do:[:ex| "do nothing"]. |
3044 | 3494 |
] |
3495 |
||
3496 |
" |
|
3497 |
Smalltalk installAutoloadedClassesFrom:'include/abbrev.stc' |
|
3498 |
" |
|
3499 |
||
3915
e32e63ee0d79
extracted autoload-class generation into extra method
Claus Gittinger <cg@exept.de>
parents:
3866
diff
changeset
|
3500 |
"Modified: / 5.11.1998 / 15:10:51 / cg" |
3044 | 3501 |
! |
3502 |
||
4458 | 3503 |
installAutoloadedClassesFromStream:anAbbrevFileStream |
5112 | 3504 |
"read the given abbreviation file; |
3505 |
install all classes found there as autoloaded, and also update the |
|
3506 |
abbreviation (className-to-fileName mapping) table. |
|
3507 |
This takes some time ..." |
|
4458 | 3508 |
|
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3509 |
|s2 l clsName abbrev package cat cls words w abbrevs oldAbbrev nameKey| |
5109
9da015b8ae46
update abbrevs on the fly when installing autoloaded classes.
Claus Gittinger <cg@exept.de>
parents:
5108
diff
changeset
|
3510 |
|
9da015b8ae46
update abbrevs on the fly when installing autoloaded classes.
Claus Gittinger <cg@exept.de>
parents:
5108
diff
changeset
|
3511 |
"/ 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
|
3512 |
CachedAbbreviations isNil ifTrue:[ |
7248 | 3513 |
CachedAbbreviations := IdentityDictionary new. |
5109
9da015b8ae46
update abbrevs on the fly when installing autoloaded classes.
Claus Gittinger <cg@exept.de>
parents:
5108
diff
changeset
|
3514 |
]. |
9da015b8ae46
update abbrevs on the fly when installing autoloaded classes.
Claus Gittinger <cg@exept.de>
parents:
5108
diff
changeset
|
3515 |
abbrevs := CachedAbbreviations. |
4458 | 3516 |
|
5112 | 3517 |
KnownPackages isNil ifTrue:[ |
7248 | 3518 |
KnownPackages := Set new. |
5112 | 3519 |
]. |
3520 |
||
4458 | 3521 |
"/ yes, create any required nameSpace, without asking user. |
3522 |
Class createNameSpaceQuerySignal answer:true do:[ |
|
3523 |
||
7248 | 3524 |
[anAbbrevFileStream atEnd] whileFalse:[ |
3525 |
l := anAbbrevFileStream nextLine withoutSeparators. |
|
3526 |
l notEmpty ifTrue:[ |
|
3527 |
"/ must do it manually, caring for quoted strings. |
|
4685
d145298696b7
more package loading support
Claus Gittinger <cg@exept.de>
parents:
4642
diff
changeset
|
3528 |
"/ words := line asCollectionOfWords. |
d145298696b7
more package loading support
Claus Gittinger <cg@exept.de>
parents:
4642
diff
changeset
|
3529 |
|
7248 | 3530 |
words := OrderedCollection new. |
3531 |
s2 := l readStream. |
|
3532 |
[s2 atEnd] whileFalse:[ |
|
3533 |
s2 skipSeparators. |
|
3534 |
s2 peek == $' ifTrue:[ |
|
3535 |
s2 next. |
|
3536 |
w := s2 upTo:$'. |
|
3537 |
s2 skipSeparators. |
|
3538 |
] ifFalse:[ |
|
3539 |
w := s2 upToSeparator |
|
3540 |
]. |
|
3541 |
words add:w |
|
3542 |
]. |
|
3543 |
words size < 3 ifTrue:[ |
|
3544 |
'Smalltalk [warning]: bad abbrev entry' errorPrint. |
|
3545 |
anAbbrevFileStream isFileStream ifTrue:[ |
|
3546 |
' (in ''' errorPrint. |
|
3547 |
anAbbrevFileStream pathName errorPrint. |
|
3548 |
''')' errorPrint |
|
3549 |
]. |
|
3550 |
': ' errorPrint. l errorPrintCR |
|
3551 |
] ifFalse:[ |
|
3552 |
clsName := (words at:1) asSymbol. |
|
3553 |
abbrev := (words at:2). |
|
3554 |
package := (words at:3) asSymbol. |
|
3555 |
cat := words at:4 ifAbsent:nil. |
|
5117 | 3556 |
"/ KnownPackages add:package. |
5112 | 3557 |
|
7248 | 3558 |
(cat size == 0) ifTrue:[ |
3559 |
cat := 'autoloaded' |
|
3560 |
]. |
|
3561 |
||
3562 |
"/ on the fly, update the abbreviations |
|
3563 |
clsName ~= abbrev ifTrue:[ |
|
3564 |
nameKey := clsName asSymbol. |
|
3565 |
oldAbbrev := abbrevs at:nameKey ifAbsent:nil. |
|
3566 |
(oldAbbrev notNil and:[oldAbbrev ~= abbrev]) ifTrue:[ |
|
3567 |
StandAlone ifFalse:[ |
|
3568 |
('Smalltalk [warning]: conflict for: ' , clsName , ' in ' , (anAbbrevFileStream pathName)) infoPrintCR. |
|
3569 |
('Smalltalk [warning]: (' , oldAbbrev , ' <-> ' , abbrev , ')') infoPrintCR |
|
3570 |
]. |
|
3571 |
abbrevs at:nameKey put:abbrev. |
|
3572 |
] ifFalse:[ |
|
3573 |
cls := self classNamed:abbrev. |
|
3574 |
||
3575 |
cls notNil ifTrue:[ |
|
3576 |
cls name ~= clsName ifTrue:[ |
|
3577 |
"/ ok, there is a class named after this abbrev ... |
|
3578 |
"/ this is only a conflict, if the other class has no |
|
3579 |
"/ abbreviation (or the same). |
|
3580 |
(abbrevs at:(cls name asSymbol) ifAbsent:cls name) = abbrev ifTrue:[ |
|
3581 |
cls isNameSpace ifFalse:[ |
|
3582 |
package = cls package ifTrue:[ |
|
3583 |
StandAlone ifFalse:[ |
|
3584 |
('Smalltalk [warning]: conflict for: ' , cls name , ' in ' , (anAbbrevFileStream pathName)) infoPrintCR. |
|
3585 |
('Smalltalk [warning]: (' , clsName , ' -> ' , abbrev , ')') infoPrintCR |
|
3586 |
] |
|
3587 |
] |
|
3588 |
] |
|
3589 |
] |
|
3590 |
] |
|
3591 |
]. |
|
3592 |
abbrevs at:clsName asSymbol put:abbrev. |
|
3593 |
] |
|
3594 |
]. |
|
3595 |
||
3596 |
"/ ' autoloaded: ' print. clsName print. ' in ' print. cat printCR. |
|
3597 |
||
3598 |
self installAutoloadedClassNamed:clsName category:cat package:package revision:nil. |
|
3599 |
] |
|
3600 |
] |
|
3601 |
] |
|
4458 | 3602 |
] |
3603 |
! |
|
3604 |
||
3044 | 3605 |
loadBinaries |
3606 |
"return true, if binaries should be loaded into the system, |
|
3607 |
false if this should be suppressed. The default is false (for now)." |
|
3608 |
||
3609 |
^ LoadBinaries |
|
3610 |
! |
|
3611 |
||
3612 |
loadBinaries:aBoolean |
|
3613 |
"{ Pragma: +optSpace }" |
|
3614 |
||
3615 |
"turn on/off loading of binary objects" |
|
3616 |
||
3617 |
aBoolean ifTrue:[ |
|
6853 | 3618 |
(ObjectFileLoader notNil and:[ObjectFileLoader canLoadObjectFiles]) ifTrue:[ |
3619 |
LoadBinaries := true. |
|
3620 |
^ self |
|
3621 |
]. |
|
3622 |
'Smalltalk [info]: this system does not support binary loading' infoPrintCR. |
|
617 | 3623 |
]. |
3044 | 3624 |
LoadBinaries := false |
3625 |
||
3626 |
"Modified: 10.1.1997 / 15:11:00 / cg" |
|
3627 |
! |
|
3628 |
||
3629 |
logDoits |
|
3630 |
"return true if doits should go into the changes file |
|
3631 |
as well as changes - by default, this is off, since |
|
3632 |
it can blow up the changes file enormously ... |
|
3633 |
" |
|
3634 |
||
3635 |
^ LogDoits |
|
3636 |
||
3637 |
" |
|
3638 |
LogDoits := false |
|
3639 |
LogDoits := true |
|
3640 |
" |
|
3641 |
! |
|
3642 |
||
3643 |
logDoits:aBoolean |
|
3644 |
"{ Pragma: +optSpace }" |
|
3645 |
||
3646 |
"turn on/off logging of doits in the changes file. |
|
3647 |
By default, this is off, since it can blow up the |
|
3648 |
changes file enormously ... |
|
3649 |
" |
|
3650 |
||
3651 |
LogDoits := aBoolean |
|
3652 |
||
3653 |
! |
|
3654 |
||
3655 |
makeBytecodeMethods |
|
3656 |
"{ Pragma: +optSpace }" |
|
3657 |
||
3658 |
"walk over all methods and make each a bytecode method |
|
3659 |
iff it does not contain primitive C code. |
|
3660 |
Experimental and not yet used." |
|
3661 |
||
3662 |
Method allSubInstancesDo:[:aMethod | |
|
6853 | 3663 |
|newMethod| |
3664 |
||
3665 |
aMethod hasPrimitiveCode ifFalse:[ |
|
3666 |
newMethod := aMethod asByteCodeMethod. |
|
3667 |
newMethod ~~ aMethod ifTrue:[ |
|
3668 |
aMethod becomeSameAs:newMethod |
|
3669 |
] |
|
3670 |
]. |
|
3044 | 3671 |
]. |
3672 |
||
3673 |
" |
|
3674 |
Smalltalk makeBytecodeMethods |
|
3675 |
" |
|
3676 |
||
3677 |
"Modified: 16.1.1997 / 01:25:58 / cg" |
|
3678 |
"Created: 17.10.1997 / 13:52:19 / cg" |
|
3062
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3679 |
! |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3680 |
|
5117 | 3681 |
recursiveInstallAutoloadedClassesFrom:aDirectory rememberIn:dirsConsulted maxLevels:maxLevels noAutoload:noAutoloadIn packageTop:packageTopPath |
4458 | 3682 |
"read all abbrev.stc files from and under aDirectory |
5363 | 3683 |
and install autoloaded classes. |
3684 |
If a file called NOAUTOLOAD is found, no classes there and below are installed as autoloaded |
|
3685 |
(however, the directories are searched for packages) |
|
3686 |
If a file called NOPACKAGES is found, no further searching is done in that directory or below." |
|
4458 | 3687 |
|
7085
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3688 |
|abbrevStream dir noAutoloadHere dirName pkgName directoryContents| |
4458 | 3689 |
|
5075 | 3690 |
maxLevels == 0 ifTrue:[ |
5077 | 3691 |
"/ 'Smalltalk [warning]: max directory nesting reached.' infoPrintCR. |
7085
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3692 |
^ self |
5075 | 3693 |
]. |
5074 | 3694 |
|
4458 | 3695 |
dir := aDirectory asFilename. |
6188 | 3696 |
|
5110
283e7eb8c359
remember where we have been when searching for abbrev.stc-files.
Claus Gittinger <cg@exept.de>
parents:
5109
diff
changeset
|
3697 |
(dirsConsulted includes:dir pathName) ifTrue:[ |
7085
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3698 |
^ self |
5110
283e7eb8c359
remember where we have been when searching for abbrev.stc-files.
Claus Gittinger <cg@exept.de>
parents:
5109
diff
changeset
|
3699 |
]. |
283e7eb8c359
remember where we have been when searching for abbrev.stc-files.
Claus Gittinger <cg@exept.de>
parents:
5109
diff
changeset
|
3700 |
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
|
3701 |
|
5363 | 3702 |
(dir construct:'NOPACKAGES') exists ifTrue:[ |
7085
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3703 |
^ self. |
5363 | 3704 |
]. |
6188 | 3705 |
noAutoloadHere := noAutoloadIn. |
3706 |
noAutoloadHere ifFalse:[ |
|
7085
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3707 |
(dir construct:'NOAUTOLOAD') exists ifTrue:[ |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3708 |
noAutoloadHere := true. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3709 |
]. |
6188 | 3710 |
] ifTrue:[ |
7085
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3711 |
(dir construct:'AUTOLOAD') exists ifTrue:[ |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3712 |
noAutoloadHere := false. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3713 |
]. |
5108 | 3714 |
]. |
5117 | 3715 |
|
3716 |
((dir construct:'loadAll') exists |
|
6188 | 3717 |
or:[(dir construct:'abbrev.stc') exists |
3718 |
or:[(dir construct:(dir baseName , '.prj')) exists]]) ifTrue:[ |
|
7085
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3719 |
KnownPackages isNil ifTrue:[ |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3720 |
KnownPackages := Set new. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3721 |
]. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3722 |
dirName := dir pathName. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3723 |
pkgName := dirName copyFrom:(packageTopPath asFilename pathName) size + 1 + 1. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3724 |
KnownPackages add:pkgName |
5117 | 3725 |
]. |
3726 |
||
3727 |
"/ |
|
3728 |
"/ suppress installation as autoloaded in this and everything |
|
3729 |
"/ below; however, still traverse the directories to find packages ... |
|
3730 |
"/ |
|
6188 | 3731 |
noAutoloadHere ifFalse:[ |
7085
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3732 |
[ |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3733 |
abbrevStream := (dir construct:'abbrev.stc') asFilename readStream. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3734 |
self installAutoloadedClassesFromStream:abbrevStream. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3735 |
abbrevStream close. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3736 |
] on:FileStream openErrorSignal do:[:ex| "ignore this file"]. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3737 |
]. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3738 |
|
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3739 |
[ |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3740 |
directoryContents := dir directoryContents. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3741 |
] on:FileStream openErrorSignal do:[:ex| |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3742 |
"non-accessable directory: we are done" |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3743 |
^ self |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3744 |
]. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3745 |
|
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3746 |
directoryContents do:[:aFilename | |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3747 |
|f| |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3748 |
|
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3749 |
(#( |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3750 |
'doc' |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3751 |
'CVS' |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3752 |
'bitmaps' |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3753 |
'resources' |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3754 |
'source' |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3755 |
) includes:aFilename) ifFalse:[ |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3756 |
((dir baseName ~= 'stx') |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3757 |
or:[ |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3758 |
(#( |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3759 |
'configurations' |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3760 |
'include' |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3761 |
'rules' |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3762 |
'stc' |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3763 |
'support' |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3764 |
) includes:aFilename) not]) |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3765 |
ifTrue:[ |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3766 |
f := dir construct:aFilename. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3767 |
f isDirectory ifTrue:[ |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3768 |
self |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3769 |
recursiveInstallAutoloadedClassesFrom:f |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3770 |
rememberIn:dirsConsulted |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3771 |
maxLevels:maxLevels-1 |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3772 |
noAutoload:noAutoloadHere |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3773 |
packageTop:packageTopPath. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3774 |
] |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3775 |
] |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3776 |
]. |
4458 | 3777 |
]. |
3778 |
||
5117 | 3779 |
" |
3780 |
Smalltalk installAutoloadedClasses |
|
3781 |
" |
|
4458 | 3782 |
! |
3783 |
||
6033
be1b7877b425
+ #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
6031
diff
changeset
|
3784 |
replaceReferencesTo:anObject with:newRef |
be1b7877b425
+ #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
6031
diff
changeset
|
3785 |
|toAdd| |
be1b7877b425
+ #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
6031
diff
changeset
|
3786 |
|
be1b7877b425
+ #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
6031
diff
changeset
|
3787 |
toAdd := OrderedCollection new. |
be1b7877b425
+ #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
6031
diff
changeset
|
3788 |
self keysAndValuesDo:[:key :val | |
6853 | 3789 |
(key == anObject) ifTrue:[ |
3790 |
self shouldImplement. |
|
3791 |
]. |
|
3792 |
(val == anObject ) ifTrue:[ |
|
3793 |
toAdd add:(key -> newRef) |
|
3794 |
]. |
|
6033
be1b7877b425
+ #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
6031
diff
changeset
|
3795 |
]. |
be1b7877b425
+ #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
6031
diff
changeset
|
3796 |
toAdd do:[:each | |
6853 | 3797 |
self at:(each key) put:(each value) |
6033
be1b7877b425
+ #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
6031
diff
changeset
|
3798 |
]. |
be1b7877b425
+ #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
6031
diff
changeset
|
3799 |
! |
be1b7877b425
+ #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
6031
diff
changeset
|
3800 |
|
3062
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3801 |
saveEmergencyImage:aBoolean |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3802 |
"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
|
3803 |
emergency image in case of a broken display connection. |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3804 |
The default is true. |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3805 |
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
|
3806 |
(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
|
3807 |
a crash. In multiheaded applications, this only affects |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3808 |
crashes of the master Display connection (the initial connection); |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3809 |
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
|
3810 |
like window destroy from the windowManager." |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3811 |
|
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3812 |
SaveEmergencyImage := aBoolean |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3813 |
|
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3814 |
"Modified: / 24.10.1997 / 18:22:26 / cg" |
3083 | 3815 |
! |
3816 |
||
3626
5a69787e857c
added hook make apps VW compatible w.r.t. system-organizaton.
Claus Gittinger <cg@exept.de>
parents:
3624
diff
changeset
|
3817 |
systemOrganization |
5a69787e857c
added hook make apps VW compatible w.r.t. system-organizaton.
Claus Gittinger <cg@exept.de>
parents:
3624
diff
changeset
|
3818 |
"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
|
3819 |
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
|
3820 |
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
|
3821 |
from #organization, which keeps track of method categories of that class. |
7432 | 3822 |
Since in ST/X, Smalltalk is a class, there is now a conflict. |
3626
5a69787e857c
added hook make apps VW compatible w.r.t. system-organizaton.
Claus Gittinger <cg@exept.de>
parents:
3624
diff
changeset
|
3823 |
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
|
3824 |
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
|
3825 |
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
|
3826 |
|
5a69787e857c
added hook make apps VW compatible w.r.t. system-organizaton.
Claus Gittinger <cg@exept.de>
parents:
3624
diff
changeset
|
3827 |
^ SystemOrganizer for:nil |
5a69787e857c
added hook make apps VW compatible w.r.t. system-organizaton.
Claus Gittinger <cg@exept.de>
parents:
3624
diff
changeset
|
3828 |
|
5a69787e857c
added hook make apps VW compatible w.r.t. system-organizaton.
Claus Gittinger <cg@exept.de>
parents:
3624
diff
changeset
|
3829 |
"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
|
3830 |
"Modified: / 20.6.1998 / 12:41:34 / cg" |
3044 | 3831 |
! ! |
3832 |
||
3833 |
!Smalltalk class methodsFor:'system management-fileIn'! |
|
3834 |
||
3835 |
fileIn:aFileName |
|
3836 |
"read in the named file - look for it in some standard places; |
|
4712 | 3837 |
return true if ok, false if failed. |
3838 |
This method can load almost anything which makes sense: |
|
6853 | 3839 |
.st - source files |
3840 |
.cls - binary smalltalk bytecode files |
|
3841 |
.so - binary compiled machine code class libraries |
|
3842 |
[.class - java bytecode -- soon to come]" |
|
3044 | 3843 |
|
3844 |
^ self fileIn:aFileName lazy:nil silent:nil logged:false |
|
3845 |
||
3846 |
" |
|
3847 |
Smalltalk fileIn:'source/TicTacToe.st' |
|
4712 | 3848 |
Smalltalk fileIn:'binary/TicTacToe.cls' |
3849 |
Smalltalk fileIn:'binary/TicTacToe.so' |
|
3044 | 3850 |
" |
3851 |
||
3852 |
"Created: 28.10.1995 / 17:06:28 / cg" |
|
3853 |
! |
|
3854 |
||
5687 | 3855 |
fileIn:aFileName inPackage:aPackageID |
3856 |
"read in the named file in a packages directory." |
|
3857 |
||
3858 |
|dir| |
|
3859 |
||
3860 |
dir := self getPackageDirectoryForPackage:aPackageID. |
|
6096 | 3861 |
dir isNil ifTrue:[^ false]. |
3862 |
||
3863 |
dir := dir asFilename. |
|
3864 |
^ (self fileIn:(dir construct:aFileName)) |
|
3865 |
or:[ self fileIn:((dir construct:'source') construct:aFileName) ] |
|
5687 | 3866 |
! |
3867 |
||
3044 | 3868 |
fileIn:aFileName lazy:lazy |
3869 |
"read in the named file - look for it in some standard places; |
|
3870 |
return true if ok, false if failed. |
|
3871 |
If lazy is true, no code is generated for methods, instead stubs |
|
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 |
||
3877 |
^ self fileIn:aFileName lazy:lazy silent:nil logged:false |
|
3878 |
||
3879 |
" |
|
3880 |
Smalltalk fileIn:'source/TicTacToe.st' lazy:true |
|
3881 |
" |
|
3882 |
||
3883 |
"Created: 28.10.1995 / 17:06:36 / cg" |
|
3884 |
! |
|
3885 |
||
3886 |
fileIn:aFileName lazy:lazy silent:silent |
|
3887 |
"read in the named file - look for it in some standard places; |
|
3888 |
return true if ok, false if failed. |
|
3889 |
If lazy is true, no code is generated for methods, instead stubs |
|
3890 |
are created which compile themself when first executed. This allows |
|
3891 |
for much faster fileIn (but slows down the first execution later). |
|
3892 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
3893 |
code which is known to be syntactically correct. |
|
3894 |
If silent is true, no compiler messages are output to the transcript. |
|
3895 |
Giving nil for silent/lazy will use the current settings." |
|
3896 |
||
3897 |
^ self fileIn:aFileName lazy:lazy silent:silent logged:false |
|
3898 |
||
3899 |
"Created: 28.10.1995 / 17:06:41 / cg" |
|
3900 |
! |
|
3901 |
||
3902 |
fileIn:aFileNameOrString lazy:lazy silent:silent logged:logged |
|
3903 |
"read in the named file - look for it in some standard places; |
|
3904 |
return true if ok, false if failed. |
|
3905 |
If lazy is true, no code is generated for methods, instead stubs |
|
3906 |
are created which compile themself when first executed. This allows |
|
3907 |
for much faster fileIn (but slows down the first execution later). |
|
3908 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
3909 |
code which is known to be syntactically correct. |
|
3910 |
If silent is true, no compiler messages are output to the transcript. |
|
4712 | 3911 |
Giving nil for silent/lazy will use the current settings. |
3912 |
This method can load almost anything which makes sense: |
|
6853 | 3913 |
.st - source files |
3914 |
.cls - binary smalltalk bytecode files |
|
3915 |
.so - binary compiled machine code class libraries |
|
3916 |
[.class - java bytecode -- soon to come]" |
|
3044 | 3917 |
|
3918 |
|fileNameString aStream path morePath bos| |
|
3919 |
||
3920 |
fileNameString := aFileNameOrString asString. |
|
3921 |
||
3922 |
" |
|
3923 |
an object or shared object ? |
|
3924 |
" |
|
3925 |
(ObjectFileLoader notNil |
|
3926 |
and:[ObjectFileLoader hasValidBinaryExtension:fileNameString]) ifTrue:[ |
|
6853 | 3927 |
"/ LoadBinaries ifFalse:[^ false]. |
3928 |
path := self getBinaryFileName:fileNameString. |
|
3929 |
path isNil ifTrue:[ |
|
3930 |
path := self getSystemFileName:fileNameString. |
|
3931 |
]. |
|
3932 |
path isNil ifTrue:[^ false]. |
|
3933 |
^ (ObjectFileLoader loadObjectFile:path) notNil |
|
3044 | 3934 |
]. |
3935 |
||
3936 |
(fileNameString asFilename hasSuffix:'cls') ifTrue:[ |
|
6853 | 3937 |
BinaryObjectStorage notNil ifTrue:[ |
3938 |
aStream := self systemFileStreamFor:fileNameString. |
|
3952
05c36f8e87b4
fixed fileIn of byteCode (.cls) files
Claus Gittinger <cg@exept.de>
parents:
3915
diff
changeset
|
3939 |
"/ path := self getBinaryFileName:fileNameString. |
05c36f8e87b4
fixed fileIn of byteCode (.cls) files
Claus Gittinger <cg@exept.de>
parents:
3915
diff
changeset
|
3940 |
"/ path isNil ifTrue:[^ false]. |
05c36f8e87b4
fixed fileIn of byteCode (.cls) files
Claus Gittinger <cg@exept.de>
parents:
3915
diff
changeset
|
3941 |
"/ aStream := path asFilename readStream. |
6853 | 3942 |
aStream notNil ifTrue:[ |
3943 |
aStream binary. |
|
3944 |
bos := BinaryObjectStorage onOld:aStream. |
|
3945 |
bos next. |
|
3946 |
bos close. |
|
3947 |
^ true |
|
3948 |
]. |
|
3949 |
^ false |
|
3950 |
] |
|
3044 | 3951 |
]. |
3952 |
||
3953 |
(fileNameString startsWith:'source/') ifTrue:[ |
|
6853 | 3954 |
aStream := self sourceFileStreamFor:(fileNameString copyFrom:8) |
3044 | 3955 |
] ifFalse:[ |
6853 | 3956 |
(fileNameString startsWith:'fileIn/') ifTrue:[ |
3957 |
aStream := self fileInFileStreamFor:(fileNameString copyFrom:8) |
|
3958 |
] ifFalse:[ |
|
3959 |
aStream := self systemFileStreamFor:fileNameString. |
|
3960 |
aStream isNil ifTrue:[ |
|
3961 |
OperatingSystem isUNIXlike ifTrue:[ |
|
3962 |
(fileNameString startsWith:'/') ifFalse:[ |
|
3963 |
aStream := self systemFileStreamFor:('lib/' , fileNameString). |
|
3964 |
] |
|
3965 |
] |
|
3966 |
]. |
|
3967 |
(aStream notNil and:[fileNameString includes:$/]) ifTrue:[ |
|
3968 |
"/ temporarily prepend the files directory |
|
3969 |
"/ to the searchPath. |
|
3970 |
"/ This allows fileIn-driver files to refer to local |
|
3971 |
"/ files via a relative path, and drivers to fileIn other |
|
3972 |
"/ drivers ... |
|
3973 |
morePath := aStream pathName asFilename directoryName. |
|
3974 |
] |
|
3975 |
] |
|
3044 | 3976 |
]. |
3977 |
aStream isNil ifTrue:[^ false]. |
|
3978 |
^ self fileInStream:aStream lazy:lazy silent:silent logged:logged addPath:morePath |
|
3979 |
||
3980 |
" |
|
3981 |
Smalltalk fileIn:'source/TicTacToe.st' lazy:true silent:true |
|
3982 |
" |
|
3983 |
||
3952
05c36f8e87b4
fixed fileIn of byteCode (.cls) files
Claus Gittinger <cg@exept.de>
parents:
3915
diff
changeset
|
3984 |
"Modified: / 16.2.1999 / 10:03:26 / cg" |
3044 | 3985 |
! |
3986 |
||
3987 |
fileIn:aFileName logged:logged |
|
3988 |
"read in the named file - look for it in some standard places; |
|
3989 |
return true if ok, false if failed. |
|
3990 |
The argument logged controls, if the changefile is to be updated." |
|
3991 |
||
3992 |
^ self fileIn:aFileName lazy:nil silent:nil logged:logged |
|
3993 |
||
3994 |
" |
|
3995 |
Smalltalk fileIn:'source/TicTacToe.st' logged:false |
|
3996 |
" |
|
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
3997 |
! |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
3998 |
|
1 | 3999 |
fileInChanges |
4000 |
"read in the last changes file - bringing the system to the state it |
|
70 | 4001 |
had when left the last time. |
4002 |
WARNING: this method is rubbish: it should only read things after the |
|
6853 | 4003 |
last '**snapshot**' - entry |
4004 |
(instead of the complete changes file)." |
|
1 | 4005 |
|
70 | 4006 |
" |
400 | 4007 |
do NOT update the changes file now ... |
70 | 4008 |
" |
2928 | 4009 |
self fileIn:ChangeFileName logged:false |
1 | 4010 |
|
77 | 4011 |
" |
4012 |
Smalltalk fileInChanges |
|
4013 |
" |
|
1 | 4014 |
! |
4015 |
||
3044 | 4016 |
fileInClass:aClassName |
4017 |
"find a source/object file for aClassName and -if found - load it. |
|
4018 |
search is in some standard places trying driver-file (.ld), object-file (.o) and |
|
4019 |
finally source file (.st) in that order. |
|
4020 |
The file is first searched for using the class name, then the abbreviated name." |
|
4021 |
||
3155
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
4022 |
^ self |
6853 | 4023 |
fileInClass:aClassName |
4024 |
package:nil |
|
4025 |
initialize:true |
|
4026 |
lazy:false |
|
4027 |
silent:nil |
|
3155
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
4028 |
|
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
4029 |
"Modified: / 9.1.1998 / 14:41:46 / cg" |
3044 | 4030 |
! |
4031 |
||
4032 |
fileInClass:aClassName fromObject:aFileName |
|
4033 |
"read in the named object file and dynamic-link it into the system |
|
4034 |
- look for it in some standard places. |
|
4035 |
Only install the named class from this object file. |
|
4036 |
Return true if ok, false if failed." |
|
4037 |
||
4038 |
|path ok| |
|
4039 |
||
4040 |
" |
|
4041 |
check if the dynamic loader class is in |
|
4042 |
" |
|
4043 |
(LoadBinaries not or:[ObjectFileLoader isNil]) ifTrue:[^ false]. |
|
4044 |
||
4045 |
(path := self getBinaryFileName:aFileName) isNil ifTrue:[^ false]. |
|
4046 |
ok := (ObjectFileLoader loadClass:aClassName fromObjectFile:path) notNil. |
|
4047 |
ok ifTrue:[ |
|
6853 | 4048 |
SilentLoading ifFalse:[ |
4049 |
Transcript show:' loaded ' , aClassName , ' from ' ; showCR:aFileName. |
|
4050 |
] |
|
3044 | 4051 |
]. |
4052 |
^ ok |
|
4053 |
||
4054 |
" |
|
4055 |
Smalltalk fileInClass:'AbstractPath' fromObject:'../../goodies/Paths/AbstrPath.so' |
|
4056 |
Smalltalk fileInClass:'ClockView' fromObject:'../../libwidg3/libwidg3.so' |
|
4057 |
" |
|
4058 |
||
4059 |
"Modified: 10.9.1996 / 20:43:52 / cg" |
|
4060 |
! |
|
4061 |
||
4062 |
fileInClass:aClassName initialize:doInit |
|
4063 |
"find a source/object file for aClassName and -if found - load it. |
|
4064 |
search is in some standard places trying driver-file (.ld), object-file (.o) and |
|
4065 |
finally source file (.st) in that order. |
|
4066 |
The file is first searched for using the class name, then the abbreviated name." |
|
4067 |
||
3155
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
4068 |
^ self |
6853 | 4069 |
fileInClass:aClassName |
4070 |
package:nil |
|
4071 |
initialize:doInit |
|
4072 |
lazy:false |
|
4073 |
silent:nil |
|
3155
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
4074 |
|
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
4075 |
"Modified: / 9.1.1998 / 14:42:02 / cg" |
3044 | 4076 |
! |
4077 |
||
4078 |
fileInClass:aClassName initialize:doInit lazy:loadLazy |
|
4079 |
"find a source/object file for aClassName and -if found - load it. |
|
4080 |
search is in some standard places trying driver-file (.ld), object-file (.o) and |
|
4081 |
finally source file (.st) in that order. |
|
4082 |
The file is first searched for using the class name, then the abbreviated name." |
|
4083 |
||
3155
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
4084 |
^ self |
6853 | 4085 |
fileInClass:aClassName |
4086 |
package:nil |
|
4087 |
initialize:doInit |
|
4088 |
lazy:loadLazy |
|
4089 |
silent:nil |
|
3155
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
4090 |
|
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
4091 |
"Modified: / 9.1.1998 / 14:42:19 / cg" |
3044 | 4092 |
! |
4093 |
||
4094 |
fileInClass:aClassName initialize:doInit lazy:loadLazy silent:beSilent |
|
4095 |
"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
|
4096 |
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
|
4097 |
finally source file (.st), in that order. |
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
4098 |
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
|
4099 |
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
|
4100 |
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
|
4101 |
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
|
4102 |
nil uses the value from SilentLoading." |
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
4103 |
|
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
4104 |
^ self |
6853 | 4105 |
fileInClass:aClassName |
4106 |
package:nil |
|
4107 |
initialize:doInit |
|
4108 |
lazy:loadLazy |
|
4109 |
silent:beSilent |
|
3155
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
4110 |
|
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
4111 |
"Modified: / 9.1.1998 / 14:42:28 / cg" |
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
4112 |
! |
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
4113 |
|
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
4114 |
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
|
4115 |
"find a source/object file for aClassName and -if found - load it. |
3044 | 4116 |
This is the workhorse for autoloading. |
4117 |
Search is in some standard places, trying driver-file (.ld), object-file (.so / .o) and |
|
4118 |
finally source file (.st), in that order. |
|
4119 |
The file is first searched for using the class name, then the abbreviated name. |
|
4120 |
The argument doInit controlls if the class should be sent a #initialize after the |
|
4121 |
load; loadLazy tells if it should be loaded lazyly. beSilent tells if the compiler |
|
4122 |
should not send notes to the transcript; it can be true, false or nil, where |
|
4123 |
nil uses the value from SilentLoading." |
|
4124 |
||
7366
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4125 |
|shortName longName libName newClass ok wasLazy wasSilent sharedLibExtension inStream mgr |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4126 |
fn packageDir packageFile bos| |
3044 | 4127 |
|
4128 |
wasLazy := Compiler compileLazy:loadLazy. |
|
4129 |
beSilent notNil ifTrue:[ |
|
7366
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4130 |
wasSilent := self silentLoading:beSilent. |
617 | 4131 |
]. |
3044 | 4132 |
|
4026
96712578b0da
care for namespace/prefix in className when filing in.
Claus Gittinger <cg@exept.de>
parents:
4006
diff
changeset
|
4133 |
longName := aClassName copyReplaceAll:$: with:$_. |
96712578b0da
care for namespace/prefix in className when filing in.
Claus Gittinger <cg@exept.de>
parents:
4006
diff
changeset
|
4134 |
|
3044 | 4135 |
[ |
7366
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4136 |
Class withoutUpdatingChangesDo: |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4137 |
[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4138 |
|zarFn zar entry| |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4139 |
|
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4140 |
ok := false. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4141 |
|
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4142 |
shortName := self fileNameForClass:aClassName. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4143 |
package notNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4144 |
packageDir := package asString. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4145 |
packageDir := packageDir copyReplaceAll:$: with:$/. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4146 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4147 |
|
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4148 |
Class packageQuerySignal answer:package |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4149 |
do:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4150 |
|
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4151 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4152 |
first, look for a loader-driver file (in fileIn/xxx.ld) |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4153 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4154 |
(ok := self fileIn:('fileIn/' , shortName , '.ld') lazy:loadLazy silent:beSilent) |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4155 |
ifFalse:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4156 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4157 |
try abbreviated driver-file (in fileIn/xxx.ld) |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4158 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4159 |
shortName ~= aClassName ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4160 |
ok := self fileIn:('fileIn/' , longName , '.ld') lazy:loadLazy silent:beSilent |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4161 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4162 |
ok ifFalse:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4163 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4164 |
then, if dynamic linking is available, |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4165 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4166 |
(LoadBinaries and:[ObjectFileLoader notNil]) ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4167 |
sharedLibExtension := ObjectFileLoader sharedLibraryExtension. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4168 |
|
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4169 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4170 |
first look for a class packages shared binary in binary/xxx.o |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4171 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4172 |
libName := self libraryFileNameOfClass:aClassName. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4173 |
libName notNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4174 |
(ok := self fileInClass:aClassName fromObject:(libName, sharedLibExtension)) |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4175 |
ifFalse:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4176 |
sharedLibExtension ~= '.o' ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4177 |
ok := self fileInClass:aClassName fromObject:(libName, '.o') |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4178 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4179 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4180 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4181 |
|
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4182 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4183 |
then, look for a shared binary in binary/xxx.o |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4184 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4185 |
ok ifFalse:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4186 |
(ok := self fileInClass:aClassName fromObject:(shortName, sharedLibExtension)) |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4187 |
ifFalse:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4188 |
sharedLibExtension ~= '.o' ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4189 |
ok := self fileInClass:aClassName fromObject:(shortName, '.o') |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4190 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4191 |
ok ifFalse:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4192 |
shortName ~= aClassName ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4193 |
(ok := self fileInClass:aClassName fromObject:(longName, sharedLibExtension)) |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4194 |
ifFalse:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4195 |
sharedLibExtension ~= '.o' ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4196 |
ok := self fileInClass:aClassName fromObject:(longName, '.o') |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4197 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4198 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4199 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4200 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4201 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4202 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4203 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4204 |
|
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4205 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4206 |
if that did not work, look for a compiled-bytecode file ... |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4207 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4208 |
ok ifFalse:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4209 |
(ok := self fileIn:(shortName , '.cls') lazy:loadLazy silent:beSilent) |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4210 |
ifFalse:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4211 |
shortName ~= aClassName ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4212 |
ok := self fileIn:(longName , '.cls') lazy:loadLazy silent:beSilent |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4213 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4214 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4215 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4216 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4217 |
if that did not work, and the classes package is known, |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4218 |
look for an st-cls file |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4219 |
in a package subdir of the source-directory ... |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4220 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4221 |
ok ifFalse:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4222 |
(packageDir notNil and:[BinaryObjectStorage notNil]) ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4223 |
packageFile := self getPackageFileName:(packageDir , '/classes/' , shortName , '.cls'). |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4224 |
packageFile isNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4225 |
packageFile := (packageDir , '/classes/' , shortName , '.cls'). |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4226 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4227 |
(ok := self fileIn:packageFile lazy:loadLazy silent:beSilent) |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4228 |
ifFalse:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4229 |
shortName ~= aClassName ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4230 |
packageFile := self getPackageFileName:(packageDir , '/classes/' , longName , '.cls'). |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4231 |
packageFile isNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4232 |
packageFile := (packageDir , '/classes/' , longName , '.cls'). |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4233 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4234 |
ok := self fileIn:packageFile lazy:loadLazy silent:beSilent |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4235 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4236 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4237 |
|
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4238 |
zarFn := self getPackageFileName:(packageDir , '/classes.zip'). |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4239 |
zarFn notNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4240 |
zar := ZipArchive oldFileNamed:zarFn. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4241 |
zar notNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4242 |
entry := zar extract:(shortName , '.cls'). |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4243 |
(entry isNil and:[shortName ~= longName]) ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4244 |
entry := zar extract:(longName , '.cls'). |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4245 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4246 |
entry notNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4247 |
bos := BinaryObjectStorage onOld:(entry asByteArray readStream). |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4248 |
bos next. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4249 |
bos close. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4250 |
ok := true |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4251 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4252 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4253 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4254 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4255 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4256 |
|
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4257 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4258 |
if that did not work, look for an st-source file ... |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4259 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4260 |
ok ifFalse:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4261 |
fn := shortName , '.st'. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4262 |
(ok := self fileIn:fn lazy:loadLazy silent:beSilent) |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4263 |
ifFalse:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4264 |
shortName ~= longName ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4265 |
fn := longName , '.st'. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4266 |
ok := self fileIn:fn lazy:loadLazy silent:beSilent |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4267 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4268 |
ok ifFalse:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4269 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4270 |
... and in the standard source-directory |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4271 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4272 |
fn := 'source/' , shortName , '.st'. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4273 |
(ok := self fileIn:fn lazy:loadLazy silent:beSilent) |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4274 |
ifFalse:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4275 |
shortName ~= longName ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4276 |
fn := 'source/' , longName , '.st'. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4277 |
ok := self fileIn:fn lazy:loadLazy silent:beSilent |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4278 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4279 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4280 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4281 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4282 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4283 |
if that did not work, and the classes package is known, |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4284 |
look for an st-source file |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4285 |
in a package subdir of the source-directory ... |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4286 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4287 |
ok ifFalse:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4288 |
packageDir notNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4289 |
packageFile := self getPackageFileName:(packageDir , '/source/' , shortName , '.st'). |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4290 |
packageFile isNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4291 |
packageFile := (packageDir , '/source/' , shortName , '.st'). |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4292 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4293 |
fn := packageFile. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4294 |
(ok := self fileIn:packageFile lazy:loadLazy silent:beSilent) |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4295 |
ifFalse:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4296 |
shortName ~= aClassName ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4297 |
packageFile := self getPackageFileName:(packageDir , '/source/' , longName , '.st'). |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4298 |
packageFile isNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4299 |
packageFile := (packageDir , '/source/' , longName , '.st'). |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4300 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4301 |
fn := packageFile. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4302 |
ok := self fileIn:packageFile lazy:loadLazy silent:beSilent |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4303 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4304 |
ok ifFalse:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4305 |
|
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4306 |
packageFile := self getPackageFileName:(packageDir , '/' , shortName , '.st'). |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4307 |
packageFile isNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4308 |
packageFile := (packageDir , '/' , shortName , '.st'). |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4309 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4310 |
fn := packageFile. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4311 |
(ok := self fileIn:packageFile lazy:loadLazy silent:beSilent) |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4312 |
ifFalse:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4313 |
shortName ~= aClassName ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4314 |
packageFile := self getPackageFileName:(packageDir , '/' , longName , '.st'). |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4315 |
packageFile isNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4316 |
packageFile := (packageDir , '/' , longName , '.st'). |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4317 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4318 |
fn := packageFile. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4319 |
ok := self fileIn:packageFile lazy:loadLazy silent:beSilent |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4320 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4321 |
ok ifFalse:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4322 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4323 |
... and in the standard source-directory |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4324 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4325 |
fn := 'source/' , packageDir , '/' , shortName , '.st'. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4326 |
(ok := self fileIn:fn lazy:loadLazy silent:beSilent) |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4327 |
ifFalse:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4328 |
shortName ~= aClassName ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4329 |
fn := 'source/' , packageDir , '/' , longName , '.st'. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4330 |
ok := self fileIn:fn lazy:loadLazy silent:beSilent |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4331 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4332 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4333 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4334 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4335 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4336 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4337 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4338 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4339 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4340 |
if that did not work, and the classes package is known, |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4341 |
look for a zipArchive containing a class entry. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4342 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4343 |
ok ifFalse:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4344 |
packageDir notNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4345 |
zarFn := self getPackageFileName:(packageDir , '/source.zip'). |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4346 |
zarFn isNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4347 |
zarFn := packageDir asFilename withSuffix:'zip'. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4348 |
zarFn := self getSourceFileName:zarFn. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4349 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4350 |
zarFn notNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4351 |
zar := ZipArchive oldFileNamed:zarFn. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4352 |
zar notNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4353 |
entry := zar extract:(shortName , '.st'). |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4354 |
(entry isNil and:[shortName ~= longName]) ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4355 |
entry := zar extract:(longName , '.st'). |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4356 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4357 |
entry notNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4358 |
fn := zarFn. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4359 |
ok := self |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4360 |
fileInStream:(entry asString readStream) |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4361 |
lazy:loadLazy |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4362 |
silent:beSilent |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4363 |
logged:false |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4364 |
addPath:nil |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4365 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4366 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4367 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4368 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4369 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4370 |
|
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4371 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4372 |
if that did not work, |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4373 |
look for a zipArchive containing a class entry. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4374 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4375 |
ok ifFalse:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4376 |
zarFn := self getSourceFileName:'source.zip'. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4377 |
zarFn notNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4378 |
zar := ZipArchive oldFileNamed:zarFn. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4379 |
zar notNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4380 |
entry := zar extract:(zarFn := shortName , '.st'). |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4381 |
(entry isNil and:[shortName ~= longName]) ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4382 |
entry := zar extract:(zarFn := longName , '.st'). |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4383 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4384 |
entry notNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4385 |
fn := zarFn. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4386 |
ok := self |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4387 |
fileInStream:(entry asString readStream) |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4388 |
lazy:loadLazy |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4389 |
silent:beSilent |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4390 |
logged:false |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4391 |
addPath:nil |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4392 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4393 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4394 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4395 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4396 |
ok ifFalse:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4397 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4398 |
new: if there is a sourceCodeManager, ask it for the classes sourceCode |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4399 |
" |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4400 |
(mgr := Smalltalk at:#SourceCodeManager) notNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4401 |
inStream := mgr getMostRecentSourceStreamForClassNamed:aClassName. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4402 |
inStream notNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4403 |
fn := nil. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4404 |
ok := self fileInStream:inStream lazy:loadLazy silent:beSilent logged:false addPath:nil. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4405 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4406 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4407 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4408 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4409 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4410 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4411 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4412 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4413 |
|
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4414 |
ok ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4415 |
newClass := self at:(aClassName asSymbol). |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4416 |
newClass notNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4417 |
fn notNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4418 |
newClass classFilename isNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4419 |
newClass setClassFilename:fn |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4420 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4421 |
]. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4422 |
|
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4423 |
doInit ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4424 |
newClass initialize |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4425 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4426 |
] |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4427 |
]. |
6421
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4428 |
] ensure:[ |
7366
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4429 |
Compiler compileLazy:wasLazy. |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4430 |
wasSilent notNil ifTrue:[ |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4431 |
self silentLoading:wasSilent |
8669460eb2fc
care for valid classFileName after fileIn
Claus Gittinger <cg@exept.de>
parents:
7364
diff
changeset
|
4432 |
] |
3044 | 4433 |
]. |
4434 |
||
4435 |
^ newClass |
|
4436 |
||
3155
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
4437 |
"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
|
4438 |
"Modified: / 5.6.1999 / 14:53:01 / cg" |
3044 | 4439 |
! |
4440 |
||
4441 |
fileInClassLibrary:aClassLibraryName |
|
4442 |
"find an object file containing a binary class library in some standard places |
|
4443 |
and load it. This install all of its contained classes. |
|
4712 | 4444 |
Return true if ok, false if not. |
4445 |
Notice: the argument may not have an extension (by purpose); |
|
6853 | 4446 |
the sharedLib extension (.dll / .so / .sl) is added here, to |
4447 |
make the caller independent of the underlying operatingSystem." |
|
4712 | 4448 |
|
4449 |
|path fn| |
|
3044 | 4450 |
|
4451 |
ObjectFileLoader isNil ifTrue:[^ false]. |
|
4712 | 4452 |
|
6837 | 4453 |
fn := aClassLibraryName asFilename withSuffix:(ObjectFileLoader sharedLibrarySuffix). |
6836 | 4454 |
fn := fn pathName. |
4712 | 4455 |
|
4456 |
path := self getBinaryFileName:fn. |
|
4457 |
path isNil ifTrue:[ |
|
6853 | 4458 |
path := self getSystemFileName:fn. |
4712 | 4459 |
]. |
4460 |
path isNil ifTrue:[^ false]. |
|
4461 |
||
4714 | 4462 |
^ (ObjectFileLoader loadObjectFile:path) notNil |
3044 | 4463 |
|
4464 |
" |
|
4465 |
Smalltalk fileInClassLibrary:'libtable' |
|
4466 |
Smalltalk fileInClassLibrary:'binary/libwidg3' |
|
4467 |
" |
|
4468 |
||
4469 |
"Modified: 8.1.1997 / 17:58:56 / cg" |
|
617 | 4470 |
! |
4471 |
||
6025 | 4472 |
fileInClassLibrary:aClassLibraryName inPackage:packageID |
4473 |
"find an object file containing a binary class library in some standard places |
|
4474 |
and load it. This install all of its contained classes. |
|
4475 |
Return true if ok, false if not. |
|
4476 |
Notice: the argument may not have an extension (by purpose); |
|
6853 | 4477 |
the sharedLib extension (.dll / .so / .sl) is added here, to |
4478 |
make the caller independent of the underlying operatingSystem." |
|
6025 | 4479 |
|
4480 |
|path fn| |
|
4481 |
||
4482 |
ObjectFileLoader isNil ifTrue:[^ false]. |
|
4483 |
||
6837 | 4484 |
fn := aClassLibraryName asFilename withSuffix:(ObjectFileLoader sharedLibrarySuffix). |
4485 |
fn := fn pathName. |
|
6025 | 4486 |
|
4487 |
path := self getPackageDirectoryForPackage:packageID. |
|
4488 |
path isNil ifTrue:[^ false]. |
|
4489 |
path := path asFilename construct:fn. |
|
4490 |
path exists ifFalse:[^ false]. |
|
4491 |
||
4492 |
^ (ObjectFileLoader loadObjectFile:path pathName) notNil |
|
4493 |
||
4494 |
" |
|
4495 |
Smalltalk fileInClassLibrary:'libtable' |
|
4496 |
Smalltalk fileInClassLibrary:'binary/libwidg3' |
|
4497 |
Smalltalk fileInClassLibrary:'refactoryBrowser' inPackage:'stx:goodies/refactoryBrowser' |
|
4498 |
" |
|
4499 |
||
4500 |
"Modified: 8.1.1997 / 17:58:56 / cg" |
|
4501 |
! |
|
4502 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
4503 |
fileInStream:aStream lazy:lazy silent:silent logged:logged addPath:morePath |
617 | 4504 |
"read sourceCode from aStream; |
4505 |
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
|
4506 |
If lazy is true, no code is generated for methods, instead stubs |
617 | 4507 |
are created which compile themself when first executed. This allows |
4508 |
for much faster fileIn (but slows down the first execution later). |
|
4509 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
4510 |
code which is known to be syntactically correct. |
|
4511 |
If silent is true, no compiler messages are output to the transcript. |
|
4512 |
Giving nil for silent/lazy will use the current settings. |
|
4513 |
If morePath is nonNil, it is prepended to the systemPath temporarily during the |
|
4514 |
fileIn. This allows for st-expressions to refer to more files (i.e. fileIn more) |
|
4515 |
using a relative path." |
|
4516 |
||
4517 |
|wasLazy wasSilent oldSystemPath oldRealPath| |
|
4518 |
||
4519 |
aStream isNil ifTrue:[^ false]. |
|
4520 |
||
4521 |
lazy notNil ifTrue:[wasLazy := Compiler compileLazy:lazy]. |
|
4522 |
silent notNil ifTrue:[wasSilent := self silentLoading:silent]. |
|
4523 |
[ |
|
6853 | 4524 |
Class updateChangeFileQuerySignal answer:logged do:[ |
4525 |
Class updateChangeListQuerySignal answer:logged do:[ |
|
4526 |
oldSystemPath := SystemPath copy. |
|
4527 |
morePath notNil ifTrue:[ |
|
4528 |
SystemPath addFirst:morePath. |
|
4529 |
oldRealPath := RealSystemPath. |
|
4530 |
RealSystemPath := nil. |
|
4531 |
]. |
|
4532 |
aStream fileIn |
|
4533 |
] |
|
4534 |
] |
|
6421
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4535 |
] ensure:[ |
6853 | 4536 |
morePath notNil ifTrue:[ |
4537 |
SystemPath := oldSystemPath. |
|
4538 |
RealSystemPath := oldRealPath. |
|
4539 |
]. |
|
4540 |
lazy notNil ifTrue:[Compiler compileLazy:wasLazy]. |
|
4541 |
silent notNil ifTrue:[self silentLoading:wasSilent]. |
|
4542 |
aStream close |
|
617 | 4543 |
]. |
4544 |
^ true |
|
4545 |
||
4546 |
" |
|
4547 |
Smalltalk fileInStream:('source/TicTacToe.st' asFilename readStream) lazy:true silent:true |
|
4548 |
" |
|
1896 | 4549 |
|
4550 |
"Modified: 5.11.1996 / 20:03:35 / cg" |
|
617 | 4551 |
! |
4552 |
||
5881
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4553 |
isClassLibraryLoaded:name |
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4554 |
"return true, if a particular class library is already loaded" |
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4555 |
|
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4556 |
ObjectMemory |
6853 | 4557 |
binaryModuleInfo |
4558 |
do:[:entry | |
|
4559 |
entry type == #classLibrary ifTrue:[ |
|
4560 |
entry libraryName = name ifTrue:[ |
|
4561 |
^ true "/ already loaded |
|
4562 |
] |
|
4563 |
]. |
|
4564 |
]. |
|
5881
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4565 |
|
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4566 |
^ false |
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4567 |
|
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4568 |
" |
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4569 |
Smalltalk isClassLibraryLoaded:'libbasic' |
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4570 |
Smalltalk isClassLibraryLoaded:'libwidg3' |
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4571 |
" |
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4572 |
! |
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4573 |
|
3044 | 4574 |
loadClassLibraryIfAbsent:name |
4575 |
"dynamically load a classLibrary, if not already loaded |
|
4576 |
and the system supports dynamic loading. |
|
4577 |
Return true, if the library is loaded, false if not. |
|
4578 |
This entry is called without system specific filename |
|
4579 |
extensions - it is portable among different architectures |
|
4580 |
as long as corresponding files (x.so / x.dll / x.sl / x.o) |
|
4581 |
are be present ..." |
|
4582 |
||
5881
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4583 |
(self isClassLibraryLoaded:name) ifTrue:[ ^ true ]. "/ already loaded |
3044 | 4584 |
^ self fileInClassLibrary:name |
4585 |
||
4586 |
" |
|
4587 |
Smalltalk loadClassLibraryIfAbsent:'libbasic' |
|
4588 |
Smalltalk loadClassLibraryIfAbsent:'libwidg3' |
|
4589 |
" |
|
4590 |
||
4591 |
"Modified: 31.10.1996 / 16:57:24 / cg" |
|
4592 |
! |
|
4593 |
||
4594 |
secureFileIn:aFileName |
|
4595 |
"read in the named file, looking for it at standard places. |
|
4596 |
Catch any error during fileIn. Return true if ok, false if failed" |
|
4597 |
||
4598 |
|retVal| |
|
4599 |
||
4600 |
retVal := false. |
|
4601 |
||
4602 |
(SignalSet with:AbortSignal with:Process terminateSignal) |
|
6853 | 4603 |
handle:[:ex | |
4604 |
ex return |
|
4605 |
] do:[ |
|
4606 |
retVal := self fileIn:aFileName |
|
4607 |
]. |
|
3044 | 4608 |
^ retVal |
4609 |
! |
|
4610 |
||
4611 |
silentFileIn:aFilename |
|
4612 |
"same as fileIn:, but do not output 'compiled...'-messages on Transcript. |
|
4613 |
Main use is during startup." |
|
4614 |
||
4615 |
|wasSilent| |
|
4616 |
||
4617 |
wasSilent := self silentLoading:true. |
|
4618 |
[ |
|
6853 | 4619 |
self fileIn:aFilename |
6421
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4620 |
] ensure:[ |
6853 | 4621 |
self silentLoading:wasSilent |
3044 | 4622 |
] |
4623 |
! ! |
|
4624 |
||
4625 |
!Smalltalk class methodsFor:'system management-files'! |
|
4626 |
||
4627 |
bitmapFileStreamFor:aFileName |
|
4628 |
"search aFileName in some standard places; |
|
4629 |
return a readonly fileStream or nil if not found. |
|
5089 | 4630 |
Searches in subdirectories named 'bitmaps' in the SystemPath. |
4631 |
Notice: this does not look in the package-specific bitmaps directories." |
|
3044 | 4632 |
|
4633 |
|aString| |
|
4634 |
||
4635 |
aString := self getBitmapFileName:aFileName. |
|
4636 |
aString notNil ifTrue:[ |
|
7085
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
4637 |
^ aString asFilename readStreamOrNil |
3044 | 4638 |
]. |
4639 |
^ nil |
|
4640 |
! |
|
4641 |
||
5040 | 4642 |
bitmapFromFileNamed:aFileName forClass:aClass |
4643 |
"search aFileName in some standard places: |
|
5089 | 4644 |
first in the redefinable bitmaps path, |
4645 |
then in the classes own package directory if existing. |
|
5040 | 4646 |
Return an image or nil." |
4647 |
||
5089 | 4648 |
^ self imageFromFileNamed:aFileName inPackage:(aClass package) |
5040 | 4649 |
|
4650 |
" |
|
4651 |
Smalltalk bitmapFromFileNamed:'SmalltalkX.xbm' forClass:View |
|
4652 |
" |
|
4653 |
! |
|
4654 |
||
4655 |
bitmapFromFileNamed:aFileName inPackage:aPackage |
|
4656 |
"search aFileName in some standard places: |
|
5089 | 4657 |
first in the redefinable bitmaps path, |
4658 |
then in the package directory if existing. |
|
5040 | 4659 |
Return an image or nil." |
4660 |
||
5089 | 4661 |
^ self imageFromFileNamed:aFileName inPackage:aPackage |
5040 | 4662 |
|
4663 |
" |
|
4664 |
Smalltalk bitmapFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libview' |
|
5041 | 4665 |
Smalltalk bitmapFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libtool' |
5040 | 4666 |
" |
4667 |
! |
|
4668 |
||
3044 | 4669 |
classNameForFile:aFileName |
4670 |
"return the className which corresponds to an abbreviated fileName, |
|
4671 |
or nil if no special translation applies. The given filename arg may |
|
4672 |
include a '.st' suffix (but no other)." |
|
4673 |
||
4674 |
|fn| |
|
4675 |
||
4676 |
(aFileName asFilename hasSuffix:'st') ifTrue:[ |
|
6853 | 4677 |
fn := aFileName copyWithoutLast:3 |
3044 | 4678 |
] ifFalse:[ |
6853 | 4679 |
fn := aFileName |
3044 | 4680 |
]. |
4681 |
^ self filenameAbbreviations keyAtEqualValue:fn ifAbsent:[fn]. |
|
4682 |
||
4683 |
" |
|
4684 |
Smalltalk classNameForFile:'DrawObj' |
|
4685 |
Smalltalk classNameForFile:'DrawObj.st' |
|
4686 |
Smalltalk classNameForFile:'ArrColl.st' |
|
4687 |
Smalltalk classNameForFile:'ArrColl.chg' |
|
4688 |
" |
|
4689 |
||
4690 |
"Modified: 11.12.1995 / 14:51:10 / cg" |
|
4691 |
! |
|
4692 |
||
4693 |
constructPathFor:aDirectoryName |
|
4694 |
"search for aDirectory in SystemPath; |
|
4695 |
return a collection of pathes which include that directory." |
|
4696 |
||
4697 |
^ self realSystemPath select:[:dirName | |
|
6853 | 4698 |
|fullPath| |
4699 |
||
4700 |
fullPath := dirName asFilename construct:aDirectoryName. |
|
4701 |
"/ fullPath exists and:[fullPath isDirectory and:[fullPath isReadable]] |
|
4702 |
fullPath isDirectory and:[fullPath isReadable] |
|
3044 | 4703 |
]. |
4704 |
! |
|
4705 |
||
4706 |
fileInFileStreamFor:aFileName |
|
4707 |
"search aFileName in some standard places; |
|
4708 |
return a readonly fileStream or nil if not found. |
|
4709 |
Searches in subdirectories named 'fileIn' in SystemPath" |
|
4710 |
||
4711 |
|aString| |
|
4712 |
||
4713 |
aString := self getFileInFileName:aFileName. |
|
4714 |
aString notNil ifTrue:[ |
|
7085
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
4715 |
^ aString asFilename readStreamOrNil |
3044 | 4716 |
]. |
4717 |
^ nil |
|
4718 |
! |
|
4719 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
4720 |
fileNameForClass:aClassOrClassName |
617 | 4721 |
"return a good filename for aClassOrClassName - |
4722 |
using the abbreviation file if there is one" |
|
4723 |
||
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
4724 |
|fileName abbrev cls fullClassName shortClassName| |
617 | 4725 |
|
4726 |
aClassOrClassName isBehavior ifTrue:[ |
|
6853 | 4727 |
cls := aClassOrClassName theNonMetaclass. |
4728 |
fullClassName := cls name. |
|
4729 |
shortClassName := cls nameWithoutPrefix. |
|
617 | 4730 |
] ifFalse:[ |
6853 | 4731 |
fullClassName := shortClassName := aClassOrClassName. |
4732 |
shortClassName := shortClassName copyFrom:(shortClassName lastIndexOf:$:)+1. |
|
617 | 4733 |
]. |
4734 |
||
4748 | 4735 |
fileName := fullClassName asSymbol. |
617 | 4736 |
|
4737 |
"look for abbreviation" |
|
4738 |
||
4739 |
abbrev := self filenameAbbreviations at:fileName ifAbsent:[nil]. |
|
4740 |
abbrev notNil ifTrue:[^ abbrev]. |
|
4741 |
||
4742 |
"no abbreviation found - if its a short name, take it" |
|
4743 |
||
4744 |
OperatingSystem maxFileNameLength < (fileName size + 3) ifTrue:[ |
|
6853 | 4745 |
"this will only be triggered on sys5.3/DOS type systems" |
4746 |
('Smalltalk [info]: cant find short for ' , fileName , ' in abbreviation file') infoPrintCR. |
|
617 | 4747 |
]. |
4748 | 4748 |
|
4749 |
fileName := shortClassName asSymbol. |
|
4750 |
^ fileName asString |
|
617 | 4751 |
" |
4752 |
Smalltalk fileNameForClass:SmallInteger |
|
4753 |
Smalltalk fileNameForClass:'SmallInteger' |
|
3678 | 4754 |
Smalltalk fileNameForClass:'UnixOperatingSystem' |
4746 | 4755 |
Smalltalk fileNameForClass:'Launcher' |
617 | 4756 |
Smalltalk fileNameForClass:'SomeUnknownClass' |
4746 | 4757 |
Smalltalk fileNameForClass:OSI::FTAMOperation |
4758 |
Smalltalk fileNameForClass:'OSI::Foobar' |
|
617 | 4759 |
" |
4760 |
||
6151
e36a9b339582
isMeta/soleInstance -> theMetaclass / theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
6121
diff
changeset
|
4761 |
"Modified: / 5.11.2001 / 16:49:17 / cg" |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
4762 |
! |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
4763 |
|
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
4764 |
filenameAbbreviations |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
4765 |
"return a dictionary containing the classname-to-filename |
617 | 4766 |
mappings. (needed for sys5.3 users, where filenames are limited |
4767 |
to 14 chars)" |
|
4768 |
||
4769 |
CachedAbbreviations isNil ifTrue:[ |
|
6853 | 4770 |
self readAbbreviations |
617 | 4771 |
]. |
4772 |
^ CachedAbbreviations |
|
4773 |
||
4774 |
"flush with: |
|
4775 |
||
4776 |
CachedAbbreviations := nil |
|
4777 |
" |
|
4778 |
" |
|
4779 |
Smalltalk filenameAbbreviations |
|
4780 |
" |
|
4781 |
! |
|
4782 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
4783 |
flushPathCaches |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
4784 |
"{ Pragma: +optSpace }" |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
4785 |
|
2378 | 4786 |
"forget pathCaches - these are collections containing valid directory names, |
4787 |
where system files (resource, bitmaps etc.) are found. |
|
4788 |
A flush is only required, if a new system directory has been created while |
|
4789 |
the system is active, and those files should override the others |
|
4790 |
(for example, if you created a private resource directory)" |
|
4791 |
||
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
4792 |
RealSystemPath := ResourcePath := SourcePath := |
5052 | 4793 |
BitmapPath := BinaryPath := FileInPath := nil |
2378 | 4794 |
|
4795 |
" |
|
4796 |
Smalltalk flushPathCaches |
|
4797 |
" |
|
617 | 4798 |
! |
4799 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
4800 |
getBinaryFileName:aFileName |
617 | 4801 |
"search aFileName in some standard places |
4802 |
(subdirectories named 'binary' in SystemPath); |
|
4803 |
return the absolute filename or nil if none is found." |
|
4804 |
||
1562
850a88ecff97
searchPath: dont use it, if fileName starts with "./" or "../"
Claus Gittinger <cg@exept.de>
parents:
1553
diff
changeset
|
4805 |
BinaryPath isNil ifTrue:[ |
6853 | 4806 |
BinaryPath := self constructPathFor:BinaryDirName |
617 | 4807 |
]. |
4808 |
||
2928 | 4809 |
^ 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
|
4810 |
|
850a88ecff97
searchPath: dont use it, if fileName starts with "./" or "../"
Claus Gittinger <cg@exept.de>
parents:
1553
diff
changeset
|
4811 |
"Modified: 18.7.1996 / 15:53:49 / cg" |
453 | 4812 |
! |
4813 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
4814 |
getBitmapFileName:aFileName |
617 | 4815 |
"search aFileName in some standard places |
4816 |
(subdirectories named 'bitmaps' in SystemPath); |
|
4817 |
return the absolute filename or nil if none is found." |
|
4818 |
||
2974 | 4819 |
|f| |
4820 |
||
617 | 4821 |
BitmapPath isNil ifTrue:[ |
6853 | 4822 |
BitmapPath := self constructPathFor:BitmapDirName |
617 | 4823 |
]. |
4824 |
||
2974 | 4825 |
"/ first, try a bitmaps subdir along the path. |
4826 |
f := self searchPath:BitmapPath for:aFileName in:BitmapDirName. |
|
4827 |
f isNil ifTrue:[ |
|
6853 | 4828 |
"/ then, try it itself along the path. |
4829 |
f := self searchPath:self realSystemPath for:aFileName in:nil |
|
2974 | 4830 |
]. |
4831 |
^ f |
|
617 | 4832 |
|
4833 |
" |
|
4834 |
Smalltalk getBitmapFileName:'SBrowser.xbm' |
|
4835 |
" |
|
1562
850a88ecff97
searchPath: dont use it, if fileName starts with "./" or "../"
Claus Gittinger <cg@exept.de>
parents:
1553
diff
changeset
|
4836 |
|
850a88ecff97
searchPath: dont use it, if fileName starts with "./" or "../"
Claus Gittinger <cg@exept.de>
parents:
1553
diff
changeset
|
4837 |
"Modified: 18.7.1996 / 15:53:55 / cg" |
617 | 4838 |
! |
4839 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
4840 |
getFileInFileName:aFileName |
617 | 4841 |
"search aFileName in some standard places |
4842 |
(subdirectories named 'fileIn' in SystemPath); |
|
4843 |
return the absolute filename or nil if none is found." |
|
4844 |
||
1562
850a88ecff97
searchPath: dont use it, if fileName starts with "./" or "../"
Claus Gittinger <cg@exept.de>
parents:
1553
diff
changeset
|
4845 |
FileInPath isNil ifTrue:[ |
6853 | 4846 |
FileInPath := self constructPathFor:FileInDirName |
617 | 4847 |
]. |
4848 |
||
2928 | 4849 |
^ 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
|
4850 |
|
850a88ecff97
searchPath: dont use it, if fileName starts with "./" or "../"
Claus Gittinger <cg@exept.de>
parents:
1553
diff
changeset
|
4851 |
"Modified: 18.7.1996 / 15:53:59 / cg" |
617 | 4852 |
! |
4853 |
||
5550
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4854 |
getPackageDirectoryForPackage:aPackageID |
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4855 |
"search for a particular package; return its directory, or nil" |
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4856 |
|
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4857 |
|packageDir| |
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4858 |
|
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4859 |
packageDir := aPackageID copyReplaceAll:$: with:$/. |
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4860 |
self packagePath do:[:aPath | |
6853 | 4861 |
|dir| |
4862 |
||
4863 |
dir := aPath asFilename construct:packageDir. |
|
4864 |
(dir exists and:[dir isDirectory]) ifTrue:[^ dir]. |
|
5550
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4865 |
]. |
5785
872483483444
oops - getPackageDirectoryForPackage now cares for the case
Claus Gittinger <cg@exept.de>
parents:
5781
diff
changeset
|
4866 |
|
872483483444
oops - getPackageDirectoryForPackage now cares for the case
Claus Gittinger <cg@exept.de>
parents:
5781
diff
changeset
|
4867 |
"/ not found - special case for the stx package ... |
872483483444
oops - getPackageDirectoryForPackage now cares for the case
Claus Gittinger <cg@exept.de>
parents:
5781
diff
changeset
|
4868 |
(aPackageID upTo:$:) = 'stx' ifTrue:[ |
6853 | 4869 |
packageDir := aPackageID copyFrom:(aPackageID indexOf:$:) + 1. |
4870 |
packageDir := '../../' , packageDir. |
|
4871 |
packageDir := packageDir asFilename. |
|
4872 |
(packageDir exists and:[packageDir isDirectory]) ifTrue:[^ packageDir]. |
|
5785
872483483444
oops - getPackageDirectoryForPackage now cares for the case
Claus Gittinger <cg@exept.de>
parents:
5781
diff
changeset
|
4873 |
]. |
5550
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4874 |
^ nil |
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4875 |
|
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4876 |
" |
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4877 |
Smalltalk getPackageDirectoryForPackage:(Array package) |
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4878 |
Smalltalk getPackageDirectoryForPackage:'stx:goodies/bitmaps' |
5785
872483483444
oops - getPackageDirectoryForPackage now cares for the case
Claus Gittinger <cg@exept.de>
parents:
5781
diff
changeset
|
4879 |
Smalltalk getPackageDirectoryForPackage:'stx:libview' |
5550
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4880 |
" |
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4881 |
! |
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
4882 |
|
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
4883 |
getPackageFileName:aFileName |
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
4884 |
"search aFileName in some standard places |
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
4885 |
(packagePath and subdirectories named 'packages' in SystemPath); |
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
4886 |
return the absolute filename or nil if none is found." |
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
4887 |
|
5052 | 4888 |
|f| |
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
4889 |
|
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
4890 |
"/ search along packagePath ... |
5052 | 4891 |
f := self searchPath:self packagePath for:aFileName in:nil. |
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
4892 |
f isNil ifTrue:[ |
6853 | 4893 |
"/ search under packages-directory along systemPath ... |
4894 |
f := self searchPath:self realSystemPath for:aFileName in:PackageDirName. |
|
4895 |
"/ kludge - allow for stx-directory to be named differently |
|
4896 |
f isNil ifTrue:[ |
|
4897 |
(aFileName startsWith:'stx') ifTrue:[ |
|
4898 |
(aFileName startsWith:'stx' , Filename separator) ifTrue:[ |
|
4899 |
f := '../..' asFilename construct:(aFileName copyFrom:5). |
|
4900 |
f exists ifTrue:[ |
|
4901 |
^ f pathName |
|
4902 |
]. |
|
4903 |
] |
|
4904 |
]. |
|
4905 |
]. |
|
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
4906 |
]. |
5878
b89d789e1705
always return a string from #getPackageFileName
Claus Gittinger <cg@exept.de>
parents:
5860
diff
changeset
|
4907 |
(f notNil and:[(f := f asFilename) exists]) ifTrue:[ |
6853 | 4908 |
^ f pathName |
5878
b89d789e1705
always return a string from #getPackageFileName
Claus Gittinger <cg@exept.de>
parents:
5860
diff
changeset
|
4909 |
]. |
b89d789e1705
always return a string from #getPackageFileName
Claus Gittinger <cg@exept.de>
parents:
5860
diff
changeset
|
4910 |
^ nil |
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
4911 |
|
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
4912 |
" |
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
4913 |
Smalltalk getPackageFileName:'stx/libview/resources/normal.style' |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
4914 |
Smalltalk getPackageFileName:'stx/libview/source.zip' |
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
4915 |
" |
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
4916 |
! |
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
4917 |
|
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
4918 |
getResourceFileName:aFileName |
617 | 4919 |
"search aFileName in some standard places |
4920 |
(subdirectories named 'resource' in SystemPath); |
|
4921 |
return the absolute filename or nil if none is found." |
|
4922 |
||
2974 | 4923 |
|f| |
4924 |
||
617 | 4925 |
ResourcePath isNil ifTrue:[ |
6853 | 4926 |
ResourcePath := self constructPathFor:ResourceDirName |
617 | 4927 |
]. |
4928 |
||
2974 | 4929 |
"/ first, try a resource subdir along the path. |
4930 |
f := self searchPath:ResourcePath for:aFileName in:ResourceDirName. |
|
4931 |
f isNil ifTrue:[ |
|
6853 | 4932 |
"/ then, try it itself along the path. |
4933 |
f := self searchPath:self realSystemPath for:aFileName in:nil |
|
2974 | 4934 |
]. |
4935 |
^ f |
|
617 | 4936 |
|
4937 |
" |
|
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
4938 |
Smalltalk getResourceFileName:'SystemBrowser.rs' |
617 | 4939 |
" |
1562
850a88ecff97
searchPath: dont use it, if fileName starts with "./" or "../"
Claus Gittinger <cg@exept.de>
parents:
1553
diff
changeset
|
4940 |
|
850a88ecff97
searchPath: dont use it, if fileName starts with "./" or "../"
Claus Gittinger <cg@exept.de>
parents:
1553
diff
changeset
|
4941 |
"Modified: 18.7.1996 / 15:54:03 / cg" |
617 | 4942 |
! |
4943 |
||
5053
0d8cc1eb0545
added #getResourceFileStream:forClass:
Claus Gittinger <cg@exept.de>
parents:
5052
diff
changeset
|
4944 |
getResourceFileName:aFileName forClass:aClassOrNil |
5043 | 4945 |
"search aFileName in some standard places |
4946 |
(subdirectories named 'resource' in SystemPath); |
|
4947 |
and in aClasses package directory. |
|
4948 |
Return the absolute filename or nil if none is found." |
|
4949 |
||
5065 | 4950 |
|pkgOrNil| |
4951 |
||
4952 |
aClassOrNil notNil ifTrue:[ |
|
6853 | 4953 |
pkgOrNil := aClassOrNil package. |
5065 | 4954 |
]. |
4955 |
^ self getResourceFileName:aFileName forPackage:pkgOrNil. |
|
4956 |
||
4957 |
" |
|
4958 |
Smalltalk getResourceFileName:'SystemBrowser.rs' forClass:SystemBrowser |
|
4959 |
" |
|
4960 |
! |
|
4961 |
||
4962 |
getResourceFileName:aFileName forPackage:aPackageIDOrNil |
|
4963 |
"search aFileName in some standard places |
|
4964 |
(subdirectories named 'resource' in SystemPath); |
|
4965 |
and in a packages directory. |
|
4966 |
Return the absolute filename or nil if none is found." |
|
4967 |
||
5080 | 4968 |
|f dir packageDir| |
5043 | 4969 |
|
4970 |
f := self getResourceFileName:aFileName. |
|
4971 |
f notNil ifTrue:[^ f]. |
|
4972 |
||
5065 | 4973 |
aPackageIDOrNil notNil ifTrue:[ |
6853 | 4974 |
packageDir := aPackageIDOrNil copyReplaceAll:$: with:$/. |
4975 |
self packagePath do:[:aPath | |
|
4976 |
|pD| |
|
4977 |
||
4978 |
pD := aPath asFilename construct:packageDir. |
|
4979 |
pD exists ifTrue:[ |
|
4980 |
f := pD construct:aFileName. |
|
4981 |
f exists ifTrue:[ |
|
4982 |
^ f pathName |
|
4983 |
]. |
|
4984 |
f := (pD construct:'resources') construct:aFileName. |
|
4985 |
f exists ifTrue:[ |
|
4986 |
^ f pathName |
|
4987 |
]. |
|
4988 |
]. |
|
4989 |
]. |
|
4990 |
||
4991 |
dir := Smalltalk getPackageDirectoryForPackage:(aPackageIDOrNil ? 'stx:libview'). |
|
4992 |
dir notNil ifTrue:[ |
|
4993 |
f := (dir asFilename construct:'resources') construct:aFileName. |
|
4994 |
f exists ifTrue:[ |
|
4995 |
^ f pathName |
|
4996 |
]. |
|
4997 |
f := (dir asFilename construct:'styles') construct:aFileName. |
|
4998 |
f exists ifTrue:[ |
|
4999 |
^ f pathName |
|
5000 |
]. |
|
5001 |
]. |
|
5043 | 5002 |
]. |
5003 |
^ nil |
|
5004 |
||
5005 |
" |
|
5065 | 5006 |
Smalltalk getResourceFileName:'SystemBrowser.rs' forPackage:'stx:libtool' |
5080 | 5007 |
Smalltalk getResourceFileName:'normal.style' forPackage:'stx:libview' |
5043 | 5008 |
" |
5009 |
! |
|
5010 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
5011 |
getSourceFileName:aFileName |
617 | 5012 |
"search aFileName in some standard places |
5013 |
(subdirectories named 'source' in SystemPath); |
|
736 | 5014 |
return the absolute filename or nil if none is found. |
5015 |
This is used to find a sourceFile for a methods source, |
|
5016 |
if no sourceCodeManager is available." |
|
617 | 5017 |
|
2959 | 5018 |
|f| |
5019 |
||
617 | 5020 |
SourcePath isNil ifTrue:[ |
6853 | 5021 |
SourcePath := self constructPathFor:SourceDirName |
617 | 5022 |
]. |
5023 |
||
2959 | 5024 |
"/ first, try a source subdir along the path. |
4770 | 5025 |
SourcePath notNil ifTrue:[ |
6853 | 5026 |
f := self searchPath:SourcePath for:aFileName in:SourceDirName. |
4770 | 5027 |
]. |
2959 | 5028 |
f isNil ifTrue:[ |
6853 | 5029 |
"/ then, try it itself along the path. |
5030 |
f := self searchPath:self realSystemPath for:aFileName in:nil |
|
2959 | 5031 |
]. |
5032 |
^ f |
|
191 | 5033 |
|
5034 |
" |
|
736 | 5035 |
Smalltalk getSourceFileName:'Smalltalk.st' |
5036 |
Smalltalk getSourceFileName:'ArrColl.st' |
|
191 | 5037 |
" |
1562
850a88ecff97
searchPath: dont use it, if fileName starts with "./" or "../"
Claus Gittinger <cg@exept.de>
parents:
1553
diff
changeset
|
5038 |
|
850a88ecff97
searchPath: dont use it, if fileName starts with "./" or "../"
Claus Gittinger <cg@exept.de>
parents:
1553
diff
changeset
|
5039 |
"Modified: 18.7.1996 / 15:54:07 / cg" |
617 | 5040 |
! |
5041 |
||
2896 | 5042 |
getSystemFileName:aFileNameOrString |
5043 |
"search aFileNameOrString in some standard places; |
|
617 | 5044 |
return the absolute filename or nil if none is found. |
4150 | 5045 |
see comment in Smalltalk>>initSystemPath. |
5046 |
This should be used to access resources such as bitmaps, doc-files, |
|
5047 |
and other help files. |
|
5048 |
" |
|
617 | 5049 |
|
5050 |
"credits for this method go to Markus ...." |
|
5051 |
||
2933 | 5052 |
|fn nameString| |
2896 | 5053 |
|
5054 |
fn := aFileNameOrString asFilename. |
|
2933 | 5055 |
nameString := fn name. |
2896 | 5056 |
fn isAbsolute ifTrue:[ |
6853 | 5057 |
"dont use path for absolute file names" |
5058 |
||
5059 |
^ nameString |
|
191 | 5060 |
]. |
5061 |
||
617 | 5062 |
self realSystemPath do:[:dirName | |
6853 | 5063 |
|realName| |
5064 |
||
5065 |
realName := dirName asFilename construct:nameString. |
|
5066 |
"/ |
|
5067 |
"/ here, we also return true if its a directory |
|
5068 |
"/ (Even if unreadable). |
|
5069 |
"/ It could be that the file itself is still readable. |
|
5070 |
"/ |
|
5071 |
(realName isDirectory or:[realName isReadable]) ifTrue: [ |
|
5072 |
^ realName name |
|
5073 |
] |
|
191 | 5074 |
]. |
617 | 5075 |
^ nil |
4150 | 5076 |
|
5077 |
" |
|
5078 |
Smalltalk getSystemFileName:'doc/online/english/TOP.html' |
|
5079 |
Smalltalk getSystemFileName:'bitmaps/SBrowser.xbm' |
|
5080 |
Smalltalk getSystemFileName:'bitmaps/foo' |
|
5081 |
Smalltalk getSystemFileName:'resources/View.rs' |
|
5082 |
Smalltalk getSystemFileName:'resources/iris.style' |
|
5083 |
" |
|
5084 |
||
5085 |
"Modified: / 6.5.1999 / 10:40:37 / cg" |
|
617 | 5086 |
! |
5087 |
||
5089 | 5088 |
imageFromFileNamed:aFileName forClass:aClass |
5089 |
"search aFileName in some standard places: |
|
5090 |
first in the redefinable bitmaps path, then in the classes |
|
5091 |
own package directory if existing. |
|
5092 |
Return an image or nil." |
|
5093 |
||
5113 | 5094 |
|package nm img| |
5095 |
||
5096 |
package := aClass package. |
|
5097 |
img := self imageFromFileNamed:aFileName inPackage:package. |
|
5098 |
img isNil ifTrue:[ |
|
6853 | 5099 |
package ~= 'stx:goodies' ifTrue:[ |
5100 |
"/ try under the goodies package ... |
|
5101 |
img := Smalltalk imageFromFileNamed:aFileName inPackage:'stx:goodies'. |
|
5102 |
]. |
|
5103 |
img isNil ifTrue:[ |
|
5104 |
(aFileName startsWith:'bitmaps') ifFalse:[ |
|
5105 |
nm := 'bitmaps/' , aFileName. |
|
5106 |
img := Smalltalk imageFromFileNamed:nm forClass:self. |
|
5107 |
img isNil ifTrue:[ |
|
5108 |
img := Smalltalk imageFromFileNamed:nm inPackage:'stx:goodies'. |
|
5109 |
] |
|
5110 |
]. |
|
5111 |
||
5112 |
img isNil ifTrue:[ |
|
5113 |
img := Smalltalk imageFromFileNamed:aFileName inPackage:'stx:goodies'. |
|
5114 |
]. |
|
5115 |
] |
|
5113 | 5116 |
]. |
5117 |
^ img |
|
5089 | 5118 |
|
5119 |
" |
|
5120 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' forClass:View |
|
5121 |
" |
|
5122 |
! |
|
5123 |
||
5124 |
imageFromFileNamed:aFileName inPackage:aPackage |
|
5125 |
"search aFileName in some standard places: |
|
5126 |
first in the redefinable bitmaps path, then in the |
|
5127 |
package directory if existing. |
|
5128 |
Return an image or nil." |
|
5129 |
||
5130 |
|i f dir| |
|
5131 |
||
5132 |
i := Image fromFile:aFileName resolution:100. |
|
5860 | 5133 |
i notNil ifTrue:[^ i]. |
5134 |
||
5135 |
f := self getBitmapFileName:aFileName. |
|
5136 |
f notNil ifTrue:[ |
|
6853 | 5137 |
i := Image fromFile:f. |
5138 |
i notNil ifTrue:[^ i]. |
|
5860 | 5139 |
]. |
5140 |
dir := self projectDirectoryForPackage:aPackage. |
|
5141 |
dir isNil ifTrue:[^ nil]. |
|
5142 |
||
5143 |
((f := aFileName) startsWith:'bitmaps/') ifFalse:[ |
|
6853 | 5144 |
i := Image fromFile:(dir asFilename construct:f). |
5145 |
i notNil ifTrue:[^ i]. |
|
5860 | 5146 |
|
6853 | 5147 |
f := 'bitmaps/' , aFileName. |
5860 | 5148 |
]. |
5149 |
^ Image fromFile:(dir asFilename construct:f). |
|
5089 | 5150 |
|
5151 |
" |
|
5587
4c4d67ad0e51
avoid obsoleteMessage warning (Filename ,)
Claus Gittinger <cg@exept.de>
parents:
5580
diff
changeset
|
5152 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libview' |
4c4d67ad0e51
avoid obsoleteMessage warning (Filename ,)
Claus Gittinger <cg@exept.de>
parents:
5580
diff
changeset
|
5153 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libtool' |
4c4d67ad0e51
avoid obsoleteMessage warning (Filename ,)
Claus Gittinger <cg@exept.de>
parents:
5580
diff
changeset
|
5154 |
Smalltalk imageFromFileNamed:'bitmaps/gifImages/garfield.gif' inPackage:'stx:goodies' |
5089 | 5155 |
" |
5156 |
! |
|
5157 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
5158 |
libraryFileNameOfClass:aClassOrClassName |
617 | 5159 |
"for a given class, return the name of a classLibrary which contains |
5160 |
binary code for it. |
|
5161 |
Read the libinfo file 'liblist.stc' (which is created during the compilation process) |
|
5162 |
for an entry for aClassOrClassName. |
|
5163 |
Search for the className in the first col, and return the value found in |
|
5164 |
the 2nd col. |
|
5165 |
Return nil if no entry is found. |
|
5166 |
||
5167 |
A nil returns means that this class is either built-in or not present |
|
5168 |
in a package-class library (i.e. either as separate .o or separate .st file). |
|
5169 |
Otherwise, the returned name is the classLibrary object of that class. |
|
5170 |
The classes code can be loaded from that file if binary loading is supported." |
|
5171 |
||
5172 |
|aStream line words n aClassName| |
|
5173 |
||
5174 |
aClassOrClassName isBehavior ifTrue:[ |
|
6853 | 5175 |
aClassName := aClassOrClassName name |
617 | 5176 |
] ifFalse:[ |
6853 | 5177 |
aClassName := aClassOrClassName |
617 | 5178 |
]. |
5179 |
aClassName := aClassName asString. |
|
5180 |
||
5181 |
#('include/liblist.stc') "/ filenames |
|
5182 |
with:#(2) "/ column |
|
5183 |
do:[:fileName :col | |
|
5184 |
||
6853 | 5185 |
aStream := self systemFileStreamFor:fileName. |
5186 |
aStream notNil ifTrue:[ |
|
5187 |
[aStream atEnd] whileFalse:[ |
|
5188 |
line := aStream nextLine. |
|
5189 |
line notNil ifTrue:[ |
|
5190 |
(line startsWith:'#') ifFalse:[ |
|
5191 |
words := line asCollectionOfWords. |
|
5192 |
(n := words size) > 1 ifTrue:[ |
|
5193 |
(words at:1) = aClassName ifTrue:[ |
|
5194 |
n >= col ifTrue:[ |
|
5195 |
aStream close. |
|
5196 |
^ (words at:col) withoutSeparators |
|
5197 |
] |
|
5198 |
] |
|
5199 |
] |
|
5200 |
] |
|
5201 |
] |
|
5202 |
]. |
|
5203 |
aStream close |
|
5204 |
]. |
|
617 | 5205 |
]. |
5206 |
||
5207 |
^ nil |
|
5208 |
||
5209 |
" |
|
5210 |
Smalltalk libraryFileNameOfClass:'ClockView' |
|
5211 |
Smalltalk libraryFileNameOfClass:'Bag' |
|
5212 |
" |
|
5213 |
||
5214 |
"Modified: 6.11.1995 / 15:41:39 / cg" |
|
5215 |
! |
|
5216 |
||
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5217 |
packagePath |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5218 |
"return a collection of additional directorynames, where smalltalk |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5219 |
looks for package directories. |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5220 |
Notice, that directories named 'packages' under the systemPath are |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5221 |
always consulted - even if not in the packagePath" |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5222 |
|
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5223 |
^ PackagePath |
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 |
Smalltalk packagePath |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5227 |
Smalltalk packagePath addLast:'/opt/smalltalk' |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5228 |
Smalltalk packagePath addFirst:'/usr/local/otherPackages' |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5229 |
" |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5230 |
! |
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 |
packagePath:aPath |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5233 |
"set the packagePath; |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5234 |
a collection of additional directorynames, where smalltalk |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5235 |
looks for package directories. |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5236 |
Notice, that directories named 'packages' under the systemPath are |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5237 |
always consulted - even if not in the packagePath" |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5238 |
|
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5239 |
PackagePath := aPath asOrderedCollection |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5240 |
|
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5241 |
" |
6852
7e4ea7876711
more changes for better standAlone operation
Claus Gittinger <cg@exept.de>
parents:
6851
diff
changeset
|
5242 |
Smalltalk packagePath:#( '.' '/opt/stx' '/opt/smalltalk' '/usr/local/otherPackages') |
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5243 |
" |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5244 |
! |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5245 |
|
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5246 |
projectDirectoryForClass:aClass |
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5247 |
"given a class, return the path to its package directory; |
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5248 |
nil if not found." |
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5249 |
|
5040 | 5250 |
|pkg| |
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5251 |
|
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5252 |
pkg := aClass package. |
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5253 |
pkg isNil ifTrue:[^ nil]. |
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5254 |
|
5040 | 5255 |
^ self projectDirectoryForPackage:pkg. |
5256 |
||
5257 |
" |
|
5258 |
Smalltalk projectDirectoryForClass:Array |
|
5259 |
Smalltalk projectDirectoryForClass:View |
|
5260 |
" |
|
5261 |
! |
|
5262 |
||
5263 |
projectDirectoryForPackage:aPackage |
|
5264 |
"given a packageID, return the path to its package directory; |
|
5265 |
nil if not found." |
|
5266 |
||
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
5267 |
|prj prjDir| |
5040 | 5268 |
|
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5269 |
"/ there might be a package specific resource directory ... |
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5270 |
"/ in the directory, from which the project was loaded |
5040 | 5271 |
prj := Project projectWithId:aPackage. |
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5272 |
prj notNil ifTrue:[ |
6853 | 5273 |
prjDir := prj directory. |
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5274 |
]. |
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5275 |
(prjDir notNil and:[prjDir asFilename exists]) ifFalse:[ |
6853 | 5276 |
prjDir := Smalltalk getPackageFileName:(aPackage copyReplaceAll:$: with:$/). |
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5277 |
]. |
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5278 |
^ prjDir |
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5279 |
|
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5280 |
" |
5040 | 5281 |
Smalltalk projectDirectoryForPackage:'stx:libbasic' |
5282 |
Smalltalk projectDirectoryForPackage:'exept:smartcard' |
|
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5283 |
" |
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5284 |
! |
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5285 |
|
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
5286 |
readAbbreviations |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
5287 |
"read classname to filename mappings from include/abbrev.stc. |
617 | 5288 |
sigh - all for those poor sys5.3 or MSDOS people with short filenames ..." |
5289 |
||
5067
335c866e150c
walk packagePath when reading abbrevs & autoloaded classes.
Claus Gittinger <cg@exept.de>
parents:
5065
diff
changeset
|
5290 |
|aStream f dirsConsulted| |
4420 | 5291 |
|
5292 |
CachedAbbreviations := IdentityDictionary new. |
|
5293 |
||
4458 | 5294 |
"/ new scheme: look for a directory called 'packages' |
5295 |
"/ and enumerate its abbrev.stc files... |
|
5067
335c866e150c
walk packagePath when reading abbrevs & autoloaded classes.
Claus Gittinger <cg@exept.de>
parents:
5065
diff
changeset
|
5296 |
dirsConsulted := Set new. |
4458 | 5297 |
f := Smalltalk getSystemFileName:'packages'. |
5298 |
f notNil ifTrue:[ |
|
6853 | 5299 |
f := f asFilename. |
5300 |
f isDirectory ifTrue:[ |
|
5301 |
('Smalltalk [info]: reading all class abbreviations found under ''' , f pathName ,'''') infoPrintCR. |
|
5302 |
self recursiveReadAllAbbreviationsFrom:f. |
|
5303 |
dirsConsulted add:f pathName. |
|
5304 |
]. |
|
4458 | 5305 |
]. |
5306 |
||
5067
335c866e150c
walk packagePath when reading abbrevs & autoloaded classes.
Claus Gittinger <cg@exept.de>
parents:
5065
diff
changeset
|
5307 |
"/ and along the package-path |
335c866e150c
walk packagePath when reading abbrevs & autoloaded classes.
Claus Gittinger <cg@exept.de>
parents:
5065
diff
changeset
|
5308 |
self packagePath do:[:aPath | |
6853 | 5309 |
(dirsConsulted includes:aPath) ifFalse:[ |
5310 |
('Smalltalk [info]: reading all class abbreviations found under ''' , aPath ,'''') infoPrintCR. |
|
5311 |
self recursiveReadAllAbbreviationsFrom:aPath. |
|
5312 |
dirsConsulted add:aPath |
|
5313 |
] |
|
5067
335c866e150c
walk packagePath when reading abbrevs & autoloaded classes.
Claus Gittinger <cg@exept.de>
parents:
5065
diff
changeset
|
5314 |
]. |
335c866e150c
walk packagePath when reading abbrevs & autoloaded classes.
Claus Gittinger <cg@exept.de>
parents:
5065
diff
changeset
|
5315 |
|
4458 | 5316 |
"/ old scheme: look for a single file called 'abbrev.stc' in the |
5317 |
"/ include directory. This will vanish. |
|
5318 |
||
617 | 5319 |
aStream := self systemFileStreamFor:'include/abbrev.stc'. |
5320 |
aStream notNil ifTrue:[ |
|
6853 | 5321 |
('Smalltalk [info]: reading additional abbreviations from ''' , aStream pathName ,'''') infoPrintCR. |
5322 |
self readAbbreviationsFromStream:aStream. |
|
5323 |
aStream close. |
|
5262 | 5324 |
"/ ] ifFalse:[ |
5325 |
"/ ('Smalltalk [warning]: no global''include/abbrev.stc'' file found') infoPrintCR |
|
617 | 5326 |
]. |
4420 | 5327 |
^ CachedAbbreviations |
191 | 5328 |
|
5329 |
" |
|
617 | 5330 |
Smalltalk readAbbreviations |
191 | 5331 |
" |
617 | 5332 |
|
5091 | 5333 |
"Modified: / 10.12.1999 / 17:48:53 / cg" |
617 | 5334 |
! |
5335 |
||
4458 | 5336 |
readAbbreviationsFromStream:aStream |
4420 | 5337 |
"read classname to filename mappings from aStream. |
5338 |
sigh - all for those poor sys5.3 or MSDOS people with short filenames ..." |
|
5339 |
||
5095
9bbf3cf594e5
no warning for same-abbrev, if packages differ.
Claus Gittinger <cg@exept.de>
parents:
5093
diff
changeset
|
5340 |
|abbrevs line words nm abbrev pkg key oldAbbrev cls s w| |
4420 | 5341 |
|
5342 |
abbrevs := CachedAbbreviations. |
|
5343 |
||
5344 |
[aStream atEnd] whileFalse:[ |
|
6853 | 5345 |
line := aStream nextLine. |
5346 |
line notNil ifTrue:[ |
|
5347 |
(line startsWith:'#') ifFalse:[ |
|
5348 |
||
5349 |
"/ must do it manually, caring for quoted strings. |
|
4685
d145298696b7
more package loading support
Claus Gittinger <cg@exept.de>
parents:
4642
diff
changeset
|
5350 |
"/ words := line asCollectionOfWords. |
d145298696b7
more package loading support
Claus Gittinger <cg@exept.de>
parents:
4642
diff
changeset
|
5351 |
|
6853 | 5352 |
words := OrderedCollection new. |
5353 |
s := line readStream. |
|
5354 |
[s atEnd] whileFalse:[ |
|
5355 |
s skipSeparators. |
|
5356 |
s peek == $' ifTrue:[ |
|
5357 |
s next. |
|
5358 |
w := s upTo:$'. |
|
5359 |
s skipSeparators. |
|
5360 |
] ifFalse:[ |
|
5361 |
w := s upToSeparator |
|
5362 |
]. |
|
5363 |
words add:w |
|
5364 |
]. |
|
5365 |
words size >= 3 ifTrue:[ |
|
5366 |
nm := (words at:1) withoutSeparators. |
|
5367 |
abbrev := (words at:2) withoutSeparators. |
|
5368 |
pkg := (words at:3) withoutSeparators. |
|
5369 |
nm ~= abbrev ifTrue:[ |
|
5370 |
key := nm asSymbol. |
|
5371 |
oldAbbrev := abbrevs at:key ifAbsent:nil. |
|
5372 |
oldAbbrev notNil ifTrue:[ |
|
5373 |
oldAbbrev ~= abbrev ifTrue:[ |
|
5374 |
StandAlone ifFalse:[ |
|
5375 |
('Smalltalk [warning]: conflict for: ' , nm , ' in ' , (aStream pathName)) infoPrintCR. |
|
5376 |
('Smalltalk [warning]: (' , oldAbbrev , ' <-> ' , abbrev , ')') infoPrintCR |
|
5377 |
] |
|
5378 |
]. |
|
5379 |
] ifFalse:[ |
|
5380 |
cls := self classNamed:abbrev. |
|
5381 |
||
5382 |
cls notNil ifTrue:[ |
|
5383 |
cls name ~= nm ifTrue:[ |
|
5384 |
"/ ok, there is a class named after this abbrev ... |
|
5385 |
"/ this is only a conflict, if the other class has no |
|
5386 |
"/ abbreviation (or the same). |
|
5387 |
(abbrevs at:(cls name asSymbol) ifAbsent:cls name) = abbrev ifTrue:[ |
|
5388 |
cls isNameSpace ifFalse:[ |
|
5389 |
pkg = cls package ifTrue:[ |
|
5390 |
StandAlone ifFalse:[ |
|
5391 |
('Smalltalk [warning]: conflict for: ' , cls name , ' in ' , (aStream pathName)) infoPrintCR. |
|
5392 |
('Smalltalk [warning]: (' , nm , ' -> ' , abbrev , ')') infoPrintCR |
|
5393 |
] |
|
5394 |
] |
|
5395 |
] |
|
5396 |
] |
|
5397 |
] |
|
5398 |
]. |
|
5399 |
abbrevs at:nm asSymbol put:abbrev. |
|
5400 |
] |
|
5401 |
] |
|
5402 |
] ifFalse:[ |
|
5403 |
('Smalltalk [warning]: malformed line in ' , (aStream pathName)) infoPrintCR. |
|
5404 |
] |
|
5405 |
] |
|
5406 |
] |
|
4420 | 5407 |
]. |
5091 | 5408 |
|
5095
9bbf3cf594e5
no warning for same-abbrev, if packages differ.
Claus Gittinger <cg@exept.de>
parents:
5093
diff
changeset
|
5409 |
"Modified: / 13.12.1999 / 11:54:17 / cg" |
4420 | 5410 |
! |
5411 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
5412 |
realSystemPath |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
5413 |
"return the realSystemPath - thats the directorynames from |
617 | 5414 |
SystemPath which exist and are readable" |
5415 |
||
5044 | 5416 |
|nP| |
5417 |
||
617 | 5418 |
RealSystemPath isNil ifTrue:[ |
6853 | 5419 |
OperatingSystem isVMSlike ifTrue:[ |
5420 |
"/ temporary kludge: since we cannot currently |
|
5421 |
"/ check for existance of a name like 'volume:', |
|
5422 |
"/ leave those in the Path without a check. |
|
5423 |
RealSystemPath := SystemPath select:[:dirName | |
|
5424 |
|f| |
|
5425 |
||
5426 |
f := dirName asFilename. |
|
5427 |
f isVolumeOnly ifTrue:[ |
|
5428 |
true |
|
5429 |
] ifFalse:[ |
|
5430 |
(f isDirectory) and:[f isReadable] |
|
5431 |
] |
|
5432 |
] |
|
5433 |
] ifFalse:[ |
|
5434 |
RealSystemPath := SystemPath select:[:dirName | |
|
5435 |
|f| |
|
5436 |
||
5437 |
f := dirName asFilename. |
|
5438 |
(f isDirectory) and:[f isReadable] |
|
5439 |
]. |
|
5440 |
RealSystemPath := RealSystemPath collect:[:dirName | |
|
5441 |
|f| |
|
5442 |
||
5443 |
f := dirName asFilename pathName. |
|
5444 |
]. |
|
5445 |
"/ remove duplicates (but keep order) |
|
5446 |
nP := OrderedCollection new. |
|
5447 |
RealSystemPath do:[:p | |
|
5448 |
(nP includes:p) ifFalse:[ |
|
5449 |
nP add:p |
|
5450 |
] |
|
5451 |
]. |
|
5452 |
RealSystemPath := nP. |
|
5453 |
]. |
|
617 | 5454 |
]. |
5455 |
^ RealSystemPath |
|
5456 |
! |
|
5457 |
||
4458 | 5458 |
recursiveReadAllAbbreviationsFrom:aDirectory |
7286 | 5459 |
self recursiveReadAllAbbreviationsFrom:aDirectory maxLevels:15 |
4957 | 5460 |
! |
5461 |
||
5462 |
recursiveReadAllAbbreviationsFrom:aDirectory maxLevels:maxLevels |
|
4458 | 5463 |
"read all abbreviations from and under aDirectory." |
5464 |
||
7085
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5465 |
|abbrevStream dir directoryContents| |
4458 | 5466 |
|
5075 | 5467 |
maxLevels == 0 ifTrue:[ |
5077 | 5468 |
"/ 'Smalltalk [warning]: max directory nesting reached.' infoPrintCR. |
7085
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5469 |
^ self |
5075 | 5470 |
]. |
4957 | 5471 |
|
4458 | 5472 |
dir := aDirectory asFilename. |
5057 | 5473 |
dir exists ifFalse:[^ self]. |
4458 | 5474 |
|
7085
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5475 |
[ |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5476 |
abbrevStream := (dir construct:'abbrev.stc') asFilename readStream. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5477 |
self readAbbreviationsFromStream:abbrevStream. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5478 |
abbrevStream close. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5479 |
] on:FileStream openErrorSignal do:[:ex| "ignore this file"]. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5480 |
|
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5481 |
[ |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5482 |
directoryContents := dir directoryContents. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5483 |
] on:FileStream openErrorSignal do:[:ex| |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5484 |
"non-accessable directory: we are done" |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5485 |
^ self |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5486 |
]. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5487 |
|
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5488 |
directoryContents do:[:aFilename | |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5489 |
|f| |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5490 |
|
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5491 |
(#( |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5492 |
'doc' |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5493 |
'CVS' |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5494 |
'bitmaps' |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5495 |
'resources' |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5496 |
'source' |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5497 |
) includes:aFilename) ifFalse:[ |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5498 |
f := dir construct:aFilename. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5499 |
f isDirectory ifTrue:[ |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5500 |
self recursiveReadAllAbbreviationsFrom:f maxLevels:maxLevels-1 |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5501 |
] |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5502 |
]. |
4458 | 5503 |
]. |
5504 |
! |
|
5505 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
5506 |
resourceFileStreamFor:aFileName |
617 | 5507 |
"search aFileName in some standard places; |
5508 |
return a readonly fileStream or nil if not found. |
|
5509 |
Searches in subdirectories named 'resource' in SystemPath" |
|
5510 |
||
5053
0d8cc1eb0545
added #getResourceFileStream:forClass:
Claus Gittinger <cg@exept.de>
parents:
5052
diff
changeset
|
5511 |
^ self resourceFileStreamFor:aFileName forClass:nil |
0d8cc1eb0545
added #getResourceFileStream:forClass:
Claus Gittinger <cg@exept.de>
parents:
5052
diff
changeset
|
5512 |
! |
0d8cc1eb0545
added #getResourceFileStream:forClass:
Claus Gittinger <cg@exept.de>
parents:
5052
diff
changeset
|
5513 |
|
0d8cc1eb0545
added #getResourceFileStream:forClass:
Claus Gittinger <cg@exept.de>
parents:
5052
diff
changeset
|
5514 |
resourceFileStreamFor:aFileName forClass:aClassOrNil |
0d8cc1eb0545
added #getResourceFileStream:forClass:
Claus Gittinger <cg@exept.de>
parents:
5052
diff
changeset
|
5515 |
"search aFileName in some standard places and in the classes |
0d8cc1eb0545
added #getResourceFileStream:forClass:
Claus Gittinger <cg@exept.de>
parents:
5052
diff
changeset
|
5516 |
package-resource directory. |
0d8cc1eb0545
added #getResourceFileStream:forClass:
Claus Gittinger <cg@exept.de>
parents:
5052
diff
changeset
|
5517 |
Return a readonly fileStream or nil if not found. |
0d8cc1eb0545
added #getResourceFileStream:forClass:
Claus Gittinger <cg@exept.de>
parents:
5052
diff
changeset
|
5518 |
Searches in subdirectories named 'resource' in SystemPath" |
0d8cc1eb0545
added #getResourceFileStream:forClass:
Claus Gittinger <cg@exept.de>
parents:
5052
diff
changeset
|
5519 |
|
617 | 5520 |
|aString| |
5521 |
||
5053
0d8cc1eb0545
added #getResourceFileStream:forClass:
Claus Gittinger <cg@exept.de>
parents:
5052
diff
changeset
|
5522 |
aString := self getResourceFileName:aFileName forClass:aClassOrNil. |
617 | 5523 |
aString notNil ifTrue:[ |
7085
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5524 |
^ aString asFilename readStreamOrNil |
617 | 5525 |
]. |
5526 |
^ nil |
|
5527 |
! |
|
5528 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
5529 |
searchPath:aPath for:aFileName in:aDirName |
617 | 5530 |
"search aPath for a subdirectory named aDirectory with a file |
5531 |
named aFileName" |
|
5532 |
||
2928 | 5533 |
|f| |
5534 |
||
5535 |
((f := aFileName asFilename) isAbsolute |
|
5536 |
or:[f isExplicitRelative]) ifTrue:[ |
|
6853 | 5537 |
"/ |
5538 |
"/ dont use path for absolute or explicit .-relative file names |
|
5539 |
"/ |
|
5540 |
^ aFileName |
|
5786
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
5541 |
]. |
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
5542 |
|
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
5543 |
aPath notNil ifTrue:[ |
6853 | 5544 |
aPath do:[:dirName | |
5545 |
|realName dir| |
|
5546 |
||
5547 |
dir := dirName asFilename. |
|
5548 |
aDirName notNil ifTrue:[ |
|
5549 |
realName := (dir construct:aDirName) construct:aFileName. |
|
5550 |
] ifFalse:[ |
|
5551 |
realName := dir construct:aFileName. |
|
5552 |
]. |
|
5553 |
(realName isReadable) ifTrue:[ |
|
5554 |
^ realName name |
|
5555 |
] |
|
5556 |
]. |
|
5786
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
5557 |
]. |
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
5558 |
|
354c5cb654d1
resource access (if stx is not the TOP-dirs name)
Claus Gittinger <cg@exept.de>
parents:
5785
diff
changeset
|
5559 |
^ nil. |
1562
850a88ecff97
searchPath: dont use it, if fileName starts with "./" or "../"
Claus Gittinger <cg@exept.de>
parents:
1553
diff
changeset
|
5560 |
|
4129
15c7aac46056
#isReadable is ok as check - no need for #exists
Claus Gittinger <cg@exept.de>
parents:
4113
diff
changeset
|
5561 |
"Modified: / 29.4.1999 / 15:06:43 / cg" |
617 | 5562 |
! |
5563 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
5564 |
sourceDirectoryNameOfClass:aClassOrClassName |
617 | 5565 |
"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
|
5566 |
Read the files 'abbrev.stc' and 'liblist.stc' (which are created during the compilation process) |
617 | 5567 |
for an entry for aClassOrClassName. |
5568 |
Search for the className in the first col, and return the value found in |
|
5569 |
the 3rd col. |
|
5570 |
Return nil if no entry is found." |
|
5571 |
||
5572 |
|aStream line words n aClassName| |
|
5573 |
||
5574 |
aClassOrClassName isBehavior ifTrue:[ |
|
6853 | 5575 |
aClassName := aClassOrClassName name |
617 | 5576 |
] ifFalse:[ |
6853 | 5577 |
aClassName := aClassOrClassName |
191 | 5578 |
]. |
617 | 5579 |
aClassName := aClassName asString. |
5580 |
||
728
50cf1c907c28
again search liblist for a classes source directory
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
5581 |
#('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
|
5582 |
with:#(3 2) "/ column |
617 | 5583 |
do:[:fileName :col | |
5584 |
||
6853 | 5585 |
aStream := self systemFileStreamFor:fileName. |
5586 |
aStream notNil ifTrue:[ |
|
5587 |
[aStream atEnd] whileFalse:[ |
|
5588 |
line := aStream nextLine. |
|
5589 |
line notNil ifTrue:[ |
|
5590 |
(line startsWith:'#') ifFalse:[ |
|
5591 |
words := line asCollectionOfWords. |
|
5592 |
(n := words size) > 1 ifTrue:[ |
|
5593 |
(words at:1) = aClassName ifTrue:[ |
|
5594 |
n >= col ifTrue:[ |
|
5595 |
aStream close. |
|
5596 |
^ (words at:col) withoutSeparators |
|
5597 |
] |
|
5598 |
] |
|
5599 |
] |
|
5600 |
] |
|
5601 |
] |
|
5602 |
]. |
|
5603 |
aStream close |
|
5604 |
]. |
|
617 | 5605 |
]. |
5606 |
||
5607 |
^ nil |
|
191 | 5608 |
|
5609 |
" |
|
617 | 5610 |
Smalltalk sourceDirectoryNameOfClass:'ClockView' |
5611 |
Smalltalk sourceDirectoryNameOfClass:'Bag' |
|
5612 |
Smalltalk sourceDirectoryNameOfClass:'GLWireCubeDemoView' |
|
5613 |
Smalltalk sourceDirectoryNameOfClass:'SomeNonExistingClass' |
|
5614 |
" |
|
5615 |
||
5616 |
"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
|
5617 |
"Modified: 9.12.1995 / 23:54:14 / cg" |
2033 | 5618 |
"Modified: 3.1.1997 / 11:26:44 / stefan" |
617 | 5619 |
! |
5620 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
5621 |
sourceFileStreamFor:aFileName |
617 | 5622 |
"search aFileName in some standard places; |
5623 |
return a readonly fileStream or nil if not found. |
|
5624 |
Searches in subdirectories named 'source' in SystemPath" |
|
5625 |
||
5626 |
|aString| |
|
5627 |
||
5628 |
aString := self getSourceFileName:aFileName. |
|
5629 |
aString notNil ifTrue:[ |
|
7085
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5630 |
^ aString asFilename readStreamOrNil |
617 | 5631 |
]. |
5632 |
^ nil |
|
5633 |
! |
|
5634 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
5635 |
systemFileStreamFor:aFileName |
617 | 5636 |
"search aFileName in some standard places; |
5637 |
return a readonly fileStream or nil if not found. |
|
5638 |
see comment in Smalltalk>>initSystemPath" |
|
5639 |
||
5640 |
|aString| |
|
5641 |
||
5642 |
aString := self getSystemFileName:aFileName. |
|
5643 |
aString notNil ifTrue:[ |
|
7085
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5644 |
^ aString asFilename readStreamOrNil |
617 | 5645 |
]. |
5646 |
^ nil |
|
5647 |
! |
|
5648 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
5649 |
systemPath |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
5650 |
"return a collection of directorynames, where smalltalk |
617 | 5651 |
looks for system files |
5652 |
(usually in subdirs such as resources, bitmaps, source etc.) |
|
5653 |
see comment in Smalltalk>>initSystemPath." |
|
5654 |
||
5655 |
^ SystemPath |
|
5656 |
||
5657 |
" |
|
5658 |
Smalltalk systemPath |
|
5659 |
Smalltalk systemPath addLast:'someOtherDirectoryPath' |
|
5660 |
" |
|
5661 |
! |
|
5662 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
5663 |
systemPath:aPath |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
5664 |
"set the collection of directorynames, where smalltalk |
617 | 5665 |
looks for system files |
5666 |
(usually in subdirs such as resources, bitmaps, source etc.) |
|
5667 |
see comment in Smalltalk>>initSystemPath." |
|
5668 |
||
5669 |
SystemPath := aPath. |
|
5670 |
self flushPathCaches |
|
5671 |
||
5672 |
" |
|
5673 |
Smalltalk systemPath |
|
5674 |
Smalltalk systemPath:(Smalltalk systemPath copy addLast:'someOtherDirectoryPath') |
|
191 | 5675 |
" |
1 | 5676 |
! ! |
2 | 5677 |
|
4718 | 5678 |
!Smalltalk class methodsFor:'system management-packages'! |
5679 |
||
5112 | 5680 |
knownPackages |
5681 |
^ KnownPackages ? #() |
|
5682 |
! |
|
5683 |
||
7281 | 5684 |
loadExtensionsForPackage:aPackageId |
5685 |
|packageDirName| |
|
5686 |
||
5687 |
packageDirName := aPackageId copyReplaceAll:$: with:$/. |
|
5688 |
||
5689 |
packageDirName := self getPackageFileName:packageDirName. |
|
5690 |
packageDirName isNil ifTrue:[ |
|
5691 |
^ false |
|
5692 |
]. |
|
5693 |
^ self loadExtensionsFromDirectory:packageDirName |
|
5694 |
! |
|
5695 |
||
5696 |
loadExtensionsFromDirectory:packageDirOrString |
|
5697 |
|packageDir f| |
|
5698 |
||
5699 |
packageDir := packageDirOrString asFilename. |
|
5700 |
||
5701 |
f := packageDir construct:'extensions.st'. |
|
5702 |
f exists ifTrue:[ |
|
5703 |
f fileIn. |
|
5704 |
SilentLoading ifFalse:[ |
|
5705 |
Transcript showCR:('loaded extensions: ' , f pathName). |
|
5706 |
]. |
|
5707 |
^ true |
|
5708 |
]. |
|
5709 |
^ false |
|
5710 |
! |
|
5711 |
||
4718 | 5712 |
loadPackage:aPackageIdOrPackage |
4741 | 5713 |
"make certain, that some particular package is loaded into the system. |
5714 |
Experimental." |
|
4718 | 5715 |
|
5716 |
(aPackageIdOrPackage isSymbol |
|
5717 |
or:[aPackageIdOrPackage isString]) ifTrue:[ |
|
6853 | 5718 |
^ self loadPackageWithId:aPackageIdOrPackage asAutoloaded:false |
6851 | 5719 |
]. |
5720 |
self shouldImplement. |
|
4718 | 5721 |
|
5722 |
" |
|
5723 |
Smalltalk loadPackage:'stx:libbasic' |
|
5724 |
Smalltalk loadPackage:'stx:goodies/persistency' |
|
5725 |
Smalltalk loadPackage:'cg:cparser' |
|
5726 |
Smalltalk loadPackage:'cg:rose' |
|
5727 |
" |
|
5728 |
! |
|
5729 |
||
5730 |
loadPackage:packageId fromAllSourceFilesInDirectory:aDirectory |
|
5731 |
"load all source files found in aDirectory and treat them like |
|
4741 | 5732 |
a package. Allows for initial import of alien ST-code as a new package. |
5733 |
Experimental." |
|
4718 | 5734 |
|
5735 |
|p t new anyFail| |
|
5736 |
||
5737 |
"/ problem: dependencies. |
|
5738 |
"/ solution: repeat twice, so that superclasses are present the second time |
|
5739 |
||
5740 |
Class packageQuerySignal answer:packageId asSymbol do:[ |
|
6853 | 5741 |
|any| |
5742 |
||
5743 |
2 timesRepeat:[ |
|
5744 |
anyFail := false. |
|
5745 |
aDirectory directoryContents do:[:file | |
|
5746 |
|fn| |
|
5747 |
||
5748 |
fn := aDirectory construct:file. |
|
5749 |
(fn hasSuffix:'st') ifTrue:[ |
|
5750 |
Metaclass confirmationQuerySignal answer:false do:[ |
|
5751 |
(self fileIn:fn) ifFalse:[ |
|
5752 |
anyFail := true |
|
5753 |
] ifTrue:[ |
|
5754 |
any := true. |
|
5755 |
] |
|
5756 |
] |
|
5757 |
] |
|
5758 |
]. |
|
5759 |
any ifFalse:[ |
|
5760 |
^ false "/ no file found |
|
5761 |
] |
|
5762 |
]. |
|
4718 | 5763 |
]. |
5764 |
||
5765 |
new := (p := Project projectWithId:packageId) isNil. |
|
5766 |
new ifTrue:[ p := Project new]. |
|
5767 |
||
5768 |
p name:packageId. |
|
5769 |
p directory:aDirectory. |
|
4726 | 5770 |
p package:packageId. |
4718 | 5771 |
t := packageId asCollectionOfSubstringsSeparatedByAny:'/\:'. |
5772 |
p repositoryModule:(t first). |
|
5773 |
p repositoryDirectory:(packageId copyFrom:t first size + 2). |
|
5774 |
p isLoaded:true. |
|
5775 |
||
5776 |
new ifTrue:[Project addLoadedProject:p]. |
|
5777 |
^ anyFail not |
|
5778 |
||
5779 |
! |
|
5780 |
||
4723 | 5781 |
loadPackage:packageId fromClassLibrary:aFilename |
4741 | 5782 |
"load a package from a compiled classLib. |
5783 |
Experimental." |
|
4723 | 5784 |
|
5785 |
|p t new| |
|
5786 |
||
5787 |
(self fileIn:aFilename) ifFalse:[ |
|
6853 | 5788 |
(self fileInClassLibrary:aFilename) ifFalse:[ |
5789 |
self warn:'Failed to load the package ', packageId printString. |
|
5790 |
^ false. |
|
5791 |
] |
|
4723 | 5792 |
]. |
5793 |
||
5794 |
new := (p := Project projectWithId:packageId) isNil. |
|
5795 |
new ifTrue:[ p := Project new]. |
|
5796 |
||
5797 |
p name:packageId. |
|
5798 |
p directory:aFilename directory. |
|
4726 | 5799 |
p package:packageId. |
4723 | 5800 |
t := packageId asCollectionOfSubstringsSeparatedByAny:'/\:'. |
5801 |
p repositoryModule:(t first). |
|
5802 |
p repositoryDirectory:(packageId copyFrom:t first size + 2). |
|
5803 |
p isLoaded:true. |
|
5804 |
||
5805 |
new ifTrue:[Project addLoadedProject:p]. |
|
5806 |
^ true |
|
5807 |
! |
|
5808 |
||
4718 | 5809 |
loadPackage:packageId fromLoadAllFile:aFilename |
4741 | 5810 |
"load a package from a loadAll - loader script. |
5811 |
Experimental." |
|
4718 | 5812 |
|
5813 |
|p t new| |
|
5814 |
||
4846
6fbaeb342ec6
do not open confirmers when loading a package
Claus Gittinger <cg@exept.de>
parents:
4781
diff
changeset
|
5815 |
Metaclass confirmationQuerySignal answer:false |
6fbaeb342ec6
do not open confirmers when loading a package
Claus Gittinger <cg@exept.de>
parents:
4781
diff
changeset
|
5816 |
do:[ |
6853 | 5817 |
(self fileIn:aFilename) ifFalse:[ |
5818 |
self warn:'Failed to load the package ', packageId printString. |
|
5819 |
^ false. |
|
5820 |
] |
|
4718 | 5821 |
]. |
5822 |
||
5823 |
new := (p := Project projectWithId:packageId) isNil. |
|
5824 |
new ifTrue:[ p := Project new]. |
|
5825 |
||
5826 |
p name:packageId. |
|
5827 |
p directory:aFilename directory. |
|
4726 | 5828 |
p package:packageId. |
4718 | 5829 |
t := packageId asCollectionOfSubstringsSeparatedByAny:'/\:'. |
5830 |
p repositoryModule:(t first). |
|
5831 |
p repositoryDirectory:(packageId copyFrom:t first size + 2). |
|
5832 |
p isLoaded:true. |
|
5833 |
||
5834 |
new ifTrue:[Project addLoadedProject:p]. |
|
5835 |
^ true |
|
5836 |
! |
|
5837 |
||
4722 | 5838 |
loadPackage:aPackageId fromProjectFile:f asAutoloaded:doLoadAsAutoloaded |
4741 | 5839 |
"load a package from a .prj spec. |
5840 |
Experimental." |
|
5841 |
||
4756
76982048a91a
first try to load package from prj file.
Claus Gittinger <cg@exept.de>
parents:
4748
diff
changeset
|
5842 |
|
5601 | 5843 |
"/ not yet implemented ... |
5844 |
^ false. |
|
5845 |
||
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
5846 |
"/ |prj fn| |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
5847 |
"/ |
5601 | 5848 |
"/ prj := Project new loadFromProjectFile:f asFilename pathName. |
5849 |
"/ "/ no - also allow for applications to be loaded this way |
|
5850 |
"/ "/ prj type == #library ifFalse:[ ^ false]. |
|
5851 |
"/ self halt. |
|
5852 |
"/ "/ load all prerequisites ... |
|
5853 |
"/ prj prerequisites do:[:aRequiredPackage | |
|
5854 |
"/ self halt. |
|
5855 |
"/ ]. |
|
5856 |
"/ |
|
5857 |
"/ "/ see if there is a class library ... |
|
5858 |
"/ fn := prj directory asFilename construct:(prj name , ObjectFileLoader sharedLibraryExtension). |
|
5859 |
"/ fn exists ifTrue:[ |
|
5860 |
"/ "/ load that classLibrary ... |
|
5861 |
"/ self fileIn:fn pathName. |
|
5862 |
"/ ]. |
|
5863 |
"/ |
|
5864 |
"/ "/ now, for all other classes, file-them in |
|
5865 |
"/ "/ or declare as autoloaded ... |
|
5866 |
"/ |
|
5867 |
"/ prj classes do:[:aClassOrName | |ns| |
|
5868 |
"/ aClassOrName isBehavior ifFalse:[ |
|
5869 |
"/ ((self includesKey:aClassOrName) not |
|
5870 |
"/ and:[(ns := prj defaultNameSpace) isNil |
|
5871 |
"/ or:[ns == self |
|
5872 |
"/ or:[(ns includesKey:aClassOrName) not]]]) |
|
5873 |
"/ ifTrue:[ |
|
5874 |
"/ "/ must load a corresponding source or cls-file |
|
5875 |
"/ self halt. |
|
5876 |
"/ ] |
|
5877 |
"/ ] |
|
5878 |
"/ ]. |
|
5879 |
"/ prj isLoaded:true. |
|
5880 |
"/ prj directory:f asFilename directoryName. |
|
5881 |
"/ Project addLoadedProject:prj. |
|
5882 |
"/ ^ true |
|
4756
76982048a91a
first try to load package from prj file.
Claus Gittinger <cg@exept.de>
parents:
4748
diff
changeset
|
5883 |
|
76982048a91a
first try to load package from prj file.
Claus Gittinger <cg@exept.de>
parents:
4748
diff
changeset
|
5884 |
" |
76982048a91a
first try to load package from prj file.
Claus Gittinger <cg@exept.de>
parents:
4748
diff
changeset
|
5885 |
Smalltalk loadPackage:'exept:osi/asn1' |
76982048a91a
first try to load package from prj file.
Claus Gittinger <cg@exept.de>
parents:
4748
diff
changeset
|
5886 |
Smalltalk |
6853 | 5887 |
loadPackage:'exept:osi/asn1' |
5888 |
fromProjectFile:'../../../exept/osi/asn1/asn1.prj' |
|
5889 |
asAutoloaded:false |
|
4756
76982048a91a
first try to load package from prj file.
Claus Gittinger <cg@exept.de>
parents:
4748
diff
changeset
|
5890 |
" |
4722 | 5891 |
! |
5892 |
||
5893 |
loadPackage:aPackageId fromZIPArchive:f asAutoloaded:doLoadAsAutoloaded |
|
4741 | 5894 |
"load a package from a .zip delivery file. |
5895 |
Experimental." |
|
5896 |
||
5601 | 5897 |
"/ not yet implemented ... |
4722 | 5898 |
^ false |
5899 |
! |
|
5900 |
||
4718 | 5901 |
loadPackageWithId:aPackageId |
4741 | 5902 |
"make certain, that some particular package is loaded into the system. |
5903 |
Experimental." |
|
5904 |
||
4718 | 5905 |
|
5906 |
^ self loadPackageWithId:aPackageId asAutoloaded:false |
|
5907 |
||
5908 |
" |
|
5909 |
Smalltalk loadPackageWithId:'stx:libbasic' |
|
5910 |
Smalltalk loadPackageWithId:'stx:goodies/persistency' |
|
5911 |
Smalltalk loadPackageWithId:'cg:cparser' |
|
5912 |
Smalltalk loadPackageWithId:'cg:rose' |
|
5913 |
Smalltalk loadPackageWithId:'detemobil:smc' |
|
5914 |
" |
|
5915 |
! |
|
5916 |
||
5917 |
loadPackageWithId:aPackageId asAutoloaded:doLoadAsAutoloaded |
|
4741 | 5918 |
"make certain, that some particular package is loaded into the system. |
5919 |
Experimental." |
|
4718 | 5920 |
|
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5921 |
|pkg packageDirName packageBaseName packageDir| |
4718 | 5922 |
|
5923 |
pkg := Project projectWithId:aPackageId. |
|
5924 |
(pkg notNil and:[pkg isLoaded]) ifTrue:[ |
|
6853 | 5925 |
"/ ('Smalltalk [info]: Package ' , aPackageId , ' already loaded.') infoPrintCR. |
5926 |
(doLoadAsAutoloaded |
|
5927 |
or:[pkg areAllClassesLoaded]) ifTrue:[ |
|
5928 |
^ true |
|
5929 |
]. |
|
4718 | 5930 |
]. |
5931 |
||
5932 |
"/ ok; not yet loaded. |
|
5933 |
"/ try to locate the package; try the following: |
|
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5934 |
"/ $(packagePath)/<packageDir>/... |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5935 |
"/ $(SYSPATH)/packages/<packageDir> |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5936 |
|
4718 | 5937 |
packageDirName := aPackageId copyReplaceAll:$: with:$/. |
5938 |
packageBaseName := packageDirName asFilename baseName. |
|
5939 |
||
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5940 |
packageDir := self getPackageFileName:packageDirName. |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5941 |
packageDir isNil ifTrue:[ |
6853 | 5942 |
"/ for convenience: try ../../.. as well |
5943 |
"/ (when executing in thedevelopment environment) |
|
5944 |
packageDir := '../../..' asFilename construct:packageDirName. |
|
5945 |
packageDir exists ifTrue:[ |
|
5946 |
packageDir := packageDir pathName |
|
5947 |
] ifFalse:[ |
|
5948 |
('Smalltalk [warning]: cannot find packageDirectory: ' , packageDirName) errorPrintCR. |
|
5949 |
^ false |
|
5950 |
] |
|
4718 | 5951 |
]. |
5952 |
||
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5953 |
^ self |
6853 | 5954 |
loadPackageWithId:aPackageId |
5955 |
name:packageBaseName |
|
5956 |
fromDirectory:packageDir |
|
5957 |
asAutoloaded:doLoadAsAutoloaded |
|
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5958 |
|
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5959 |
|
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5960 |
|
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5961 |
" |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5962 |
Smalltalk loadPackageWithId:'stx:libbasic' |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5963 |
Smalltalk loadPackageWithId:'stx:goodies/persistency' |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5964 |
Smalltalk loadPackageWithId:'exept:ctypes' |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5965 |
" |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5966 |
! |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5967 |
|
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5968 |
loadPackageWithId:aPackageId name:packageName fromDirectory:packageDirOrString asAutoloaded:doLoadAsAutoloaded |
6243 | 5969 |
|f s packageDir shLibName| |
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5970 |
|
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5971 |
packageDir := packageDirOrString asFilename. |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5972 |
|
4718 | 5973 |
"/ .prj ? |
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5974 |
f := (packageDir construct:packageName) withSuffix:'prj'. |
4718 | 5975 |
f exists ifTrue:[ |
7281 | 5976 |
(self loadPackage:aPackageId fromProjectFile:f asAutoloaded:doLoadAsAutoloaded) ifTrue:[ |
5977 |
SilentLoading ifFalse:[ |
|
5978 |
Transcript showCR:('Smalltalk [info]: loaded package: ' , aPackageId , ' from project file: ' , f pathName). |
|
5979 |
]. |
|
5980 |
^ true |
|
5981 |
] |
|
4718 | 5982 |
]. |
5983 |
"/ loadAll ? |
|
5984 |
f := packageDir construct:'loadAll'. |
|
5985 |
f exists ifTrue:[ |
|
7281 | 5986 |
(self loadPackage:aPackageId fromLoadAllFile:f) ifTrue:[ |
5987 |
SilentLoading ifFalse:[ |
|
5988 |
Transcript showCR:('loaded package: ' , aPackageId , ' from loadAll file: ' , f pathName). |
|
5989 |
]. |
|
5990 |
^ true |
|
5991 |
] |
|
4718 | 5992 |
]. |
5807
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
5993 |
"/ .zip ? |
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
5994 |
f := (packageDir construct:packageName) withSuffix:'zip'. |
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
5995 |
f exists ifTrue:[ |
7281 | 5996 |
(self loadPackage:aPackageId fromZIPArchive:f asAutoloaded:doLoadAsAutoloaded) ifTrue:[ |
5997 |
SilentLoading ifFalse:[ |
|
5998 |
Transcript showCR:('loaded package: ' , aPackageId , ' from zip file: ' , f pathName). |
|
5999 |
]. |
|
6000 |
^ true |
|
6001 |
] |
|
5807
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
6002 |
]. |
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
6003 |
|
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
6004 |
shLibName := packageName , ObjectFileLoader sharedLibraryExtension. |
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
6005 |
|
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
6006 |
"/ .so ? |
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
6007 |
f := packageDir construct:shLibName. |
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
6008 |
f exists ifTrue:[ |
7281 | 6009 |
(self loadPackage:aPackageId fromClassLibrary:f) ifTrue:[ |
6010 |
SilentLoading ifFalse:[ |
|
6011 |
Transcript showCR:('loaded package: ' , aPackageId , ' from binary classLib file: ' , f pathName). |
|
6012 |
]. |
|
7290 | 6013 |
doLoadAsAutoloaded ifFalse:[ |
6014 |
"/ force autoloading... |
|
6015 |
Smalltalk allClassesDo:[:eachClass | |
|
6016 |
eachClass package == aPackageId ifTrue:[ eachClass autoload]. |
|
6017 |
]. |
|
6018 |
]. |
|
7281 | 6019 |
^ true |
7290 | 6020 |
] |
5807
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
6021 |
]. |
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
6022 |
|
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
6023 |
"/ abbrev.stc ? |
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
6024 |
f := packageDir construct:'abbrev.stc'. |
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
6025 |
f exists ifTrue:[ |
7281 | 6026 |
Smalltalk installAutoloadedClassesFrom:f pathName. |
6027 |
||
6028 |
doLoadAsAutoloaded ifFalse:[ |
|
6029 |
"/ force autoloading... |
|
7290 | 6030 |
Smalltalk allClassesDo:[:eachClass | |
6031 |
eachClass package == aPackageId ifTrue:[ eachClass autoload]. |
|
7281 | 6032 |
]. |
6033 |
]. |
|
6034 |
||
6035 |
self loadExtensionsFromDirectory:packageDirOrString. |
|
6036 |
SilentLoading ifFalse:[ |
|
6037 |
Transcript showCR:('loaded package: ' , aPackageId , ' from abbrev file: ' , f pathName). |
|
6038 |
]. |
|
6039 |
^ true |
|
5807
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
6040 |
]. |
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
6041 |
|
7290 | 6042 |
"/ "/ lib/loadAll ? (will vanish) |
6043 |
"/ f := (packageDir construct:'lib') construct:'loadAll'. |
|
6044 |
"/ f exists ifTrue:[ |
|
6045 |
"/ (self loadPackage:aPackageId fromLoadAllFile:f) ifTrue:[ |
|
6046 |
"/ SilentLoading ifFalse:[ |
|
6047 |
"/ Transcript showCR:('loaded package: ' , aPackageId , ' from loadAll file: ' , f pathName). |
|
6048 |
"/ ]. |
|
6049 |
"/ ^ true |
|
6050 |
"/ ] |
|
6051 |
"/ ]. |
|
6052 |
"/ |
|
6053 |
"/ "/ /lib/.so ? (will vanish) |
|
6054 |
"/ f := (packageDir construct:'lib') construct:shLibName. |
|
6055 |
"/ f exists ifTrue:[ |
|
6056 |
"/ (self loadPackage:aPackageId fromClassLibrary:f) ifTrue:[ |
|
6057 |
"/ SilentLoading ifFalse:[ |
|
6058 |
"/ Transcript showCR:('loaded package: ' , aPackageId , ' from binary classLib file: ' , f pathName). |
|
6059 |
"/ ]. |
|
6060 |
"/ ^ true |
|
6061 |
"/ ] |
|
6062 |
"/ ]. |
|
5807
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
6063 |
|
5175
c3e71ead8e06
when loading a package, and a .so file could not be found
Claus Gittinger <cg@exept.de>
parents:
5168
diff
changeset
|
6064 |
"/ 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
|
6065 |
packageDir directoryContentsAsFilenamesDo:[:aFilename | |
7281 | 6066 |
(aFilename hasSuffix:ObjectFileLoader sharedLibrarySuffix) ifTrue:[ |
6067 |
(self loadPackage:aPackageId fromClassLibrary:aFilename) ifTrue:[ |
|
6068 |
SilentLoading ifFalse:[ |
|
6069 |
Transcript showCR:('loaded package: ' , aPackageId , ' from binary classLib file: ' , aFilename pathName). |
|
6070 |
]. |
|
7290 | 6071 |
doLoadAsAutoloaded ifFalse:[ |
6072 |
"/ force autoloading... |
|
6073 |
Smalltalk allClassesDo:[:eachClass | |
|
6074 |
eachClass package == aPackageId ifTrue:[ eachClass autoload]. |
|
6075 |
]. |
|
6076 |
]. |
|
7281 | 6077 |
^ true |
6078 |
] |
|
6079 |
] |
|
5175
c3e71ead8e06
when loading a package, and a .so file could not be found
Claus Gittinger <cg@exept.de>
parents:
5168
diff
changeset
|
6080 |
]. |
5807
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
6081 |
|
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
6082 |
"/ source files |
4737 | 6083 |
(self loadPackage:aPackageId fromAllSourceFilesInDirectory:packageDir) ifTrue:[ |
7281 | 6084 |
SilentLoading ifFalse:[ |
6085 |
Transcript showCR:('loaded package: ' , aPackageId , ' from source files in:' , packageDir pathName). |
|
6086 |
]. |
|
6087 |
^ true |
|
4737 | 6088 |
]. |
6089 |
^ false |
|
6090 |
||
4718 | 6091 |
" |
6092 |
Smalltalk loadPackageWithId:'stx:libbasic' |
|
6093 |
Smalltalk loadPackageWithId:'stx:goodies/persistency' |
|
4722 | 6094 |
Smalltalk loadPackageWithId:'exept:ctypes' |
4718 | 6095 |
" |
6096 |
! ! |
|
6097 |
||
6711 | 6098 |
!Smalltalk class methodsFor:'system management-undeclared variables'! |
6099 |
||
6100 |
clearUndeclaredVariables |
|
6101 |
"remove all undeclared variables" |
|
6102 |
||
6103 |
(Smalltalk at:#Undeclared) do:[:eachKey | |
|
6853 | 6104 |
Smalltalk removeKey:(self undeclaredPrefix , eachKey) asSymbol. |
6711 | 6105 |
]. |
6106 |
(Smalltalk at:#Undeclared) removeAll. |
|
6107 |
Smalltalk removeKey:#Undeclared. |
|
6108 |
! |
|
6109 |
||
6110 |
undeclaredPrefix |
|
6111 |
"the prefix used for undeclared variables" |
|
6112 |
||
6113 |
^ 'Undeclared:::' |
|
6114 |
||
6115 |
"Created: / 31.10.1997 / 01:13:10 / cg" |
|
6116 |
! ! |
|
6117 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
6118 |
!Smalltalk class methodsFor:'time-versions'! |
453 | 6119 |
|
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6120 |
configuration |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6121 |
"{ Pragma: +optSpace }" |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
6122 |
|
453 | 6123 |
"for developers only: return the configuration, with which |
6124 |
this smalltalk was compiled." |
|
6125 |
||
567 | 6126 |
%{ /* NOCONTEXT */ |
453 | 6127 |
extern char *__getConfigurationString(); |
6128 |
||
6129 |
RETURN (__MKSTRING(__getConfigurationString() COMMA_SND)); |
|
5406 | 6130 |
%}. |
5445 | 6131 |
^ 'unknownOS/unknownCONF:unknownPACK' |
6132 |
||
6133 |
" |
|
6134 |
Smalltalk configuration |
|
453 | 6135 |
" |
6136 |
! |
|
6137 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6138 |
copyrightString |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6139 |
"{ Pragma: +optSpace }" |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
6140 |
|
453 | 6141 |
"return a copyright string" |
6142 |
||
567 | 6143 |
%{ /* NOCONTEXT */ |
829
fc386319f41c
removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents:
822
diff
changeset
|
6144 |
#ifndef __getCopyrightString |
fc386319f41c
removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents:
822
diff
changeset
|
6145 |
extern OBJ __getCopyrightString(); |
568 | 6146 |
#endif |
6147 |
||
829
fc386319f41c
removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents:
822
diff
changeset
|
6148 |
RETURN (__getCopyrightString()); |
5410 | 6149 |
%}. |
6150 |
^ self primitiveFailed |
|
453 | 6151 |
|
6152 |
" |
|
6153 |
Smalltalk copyrightString |
|
6154 |
" |
|
6155 |
! |
|
6156 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6157 |
distributorString |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6158 |
"{ Pragma: +optSpace }" |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
6159 |
|
567 | 6160 |
"return a string describing the distributor of this software" |
6161 |
||
6162 |
%{ /* NOCONTEXT */ |
|
829
fc386319f41c
removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents:
822
diff
changeset
|
6163 |
#ifndef __getDistributorString |
fc386319f41c
removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents:
822
diff
changeset
|
6164 |
extern OBJ __getDistributorString(); |
568 | 6165 |
#endif |
6166 |
||
829
fc386319f41c
removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents:
822
diff
changeset
|
6167 |
RETURN (__getDistributorString()); |
5410 | 6168 |
%}. |
5445 | 6169 |
^ 'eXept Software AG, Germany' |
5410 | 6170 |
|
567 | 6171 |
" |
6172 |
Smalltalk distributorString |
|
6173 |
" |
|
6174 |
! |
|
6175 |
||
1645 | 6176 |
expirationTime |
6177 |
"{ Pragma: +optSpace }" |
|
6178 |
||
6179 |
"for developers only: return the time when the system will expire. |
|
6180 |
after this time it will not run any longer. |
|
6181 |
It returns nil, if no expiration time has been set (system runs forever :-))" |
|
6182 |
||
6183 |
|exp| |
|
6184 |
||
6185 |
%{ |
|
6186 |
extern unsigned int __getExpirationTime(); |
|
6187 |
||
6188 |
exp = __MKUINT(__getExpirationTime()); |
|
6189 |
%}. |
|
6190 |
exp == 0 ifTrue:[ |
|
6853 | 6191 |
^ nil |
1645 | 6192 |
]. |
6193 |
^ AbsoluteTime new fromOSTime:(exp * 1000). "OSTime is ms since 1970" |
|
6194 |
||
6195 |
" |
|
6196 |
Smalltalk expirationTime |
|
6197 |
" |
|
6198 |
! |
|
6199 |
||
3062
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
6200 |
fullVersionString |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
6201 |
"{ Pragma: +optSpace }" |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
6202 |
|
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
6203 |
"return a full version string" |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
6204 |
|
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
6205 |
^ 'Smalltalk/X release ' , self versionString , ' of ' , self versionDate |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
6206 |
|
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
6207 |
" |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
6208 |
Smalltalk fullVersionString |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
6209 |
" |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
6210 |
|
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
6211 |
"Created: / 27.10.1997 / 17:03:09 / cg" |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
6212 |
"Modified: / 27.10.1997 / 17:04:02 / cg" |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
6213 |
! |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
6214 |
|
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6215 |
hello |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6216 |
"{ Pragma: +optSpace }" |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
6217 |
|
453 | 6218 |
"return a greeting string" |
6219 |
||
6220 |
"stupid: this should come from a resource file ... |
|
6221 |
but I dont use it here, to allow mini-systems without |
|
6222 |
Resource-stuff." |
|
6223 |
||
6187 | 6224 |
|proto lang| |
1307 | 6225 |
|
6226 |
lang := Language. |
|
5641 | 6227 |
(lang == #de) ifTrue:[ |
6853 | 6228 |
proto := 'Willkommen bei %1 (Version %2 vom %3)' |
5641 | 6229 |
] ifFalse:[ (lang == #fr) ifTrue:[ |
6853 | 6230 |
proto := 'Salut, Bienvenue à %1 (version %2 de %3)' |
5641 | 6231 |
] ifFalse:[ (lang == #it) ifTrue:[ |
6853 | 6232 |
proto := 'Ciao, benvenuto al %1 (versione %2 di %3)' |
5641 | 6233 |
] ifFalse:[ (lang == #es) ifTrue:[ |
5657
5dd08c2a4930
hpux lex/bison does not like 8-bit characters (in string consts)
Claus Gittinger <cg@exept.de>
parents:
5653
diff
changeset
|
6234 |
"/ proto := 'Hola, bienvenida a %1 (versión %2 de %3)' |
5641 | 6235 |
] ifFalse:[ (lang == #es) ifTrue:[ |
5657
5dd08c2a4930
hpux lex/bison does not like 8-bit characters (in string consts)
Claus Gittinger <cg@exept.de>
parents:
5653
diff
changeset
|
6236 |
"/ proto := 'Oi, benvindo a %1 (versão %2 de %3)' |
5641 | 6237 |
] ifFalse:[ (lang == #no) ifTrue:[ |
6853 | 6238 |
proto := 'Hei, verdenmottakelse til %1 (versjon %2 av %3)' |
5641 | 6239 |
]]]]]]. |
1307 | 6240 |
|
6241 |
"/ ... more needed here ... |
|
6242 |
||
6243 |
proto isNil ifTrue:[ |
|
6853 | 6244 |
proto := 'Hello World - here is %1 version %2 of %3'. |
453 | 6245 |
]. |
1307 | 6246 |
|
6187 | 6247 |
^ proto bindWith:('SmallTalk/X' allBold) |
6853 | 6248 |
with:(self versionString) |
6249 |
with:(self versionDate) |
|
453 | 6250 |
|
6251 |
" |
|
1307 | 6252 |
Smalltalk language:#us. |
6253 |
Smalltalk hello |
|
6254 |
||
6255 |
Smalltalk language:#de. |
|
6256 |
Smalltalk hello |
|
1412 | 6257 |
|
5641 | 6258 |
Smalltalk language:#no. |
6259 |
Smalltalk hello |
|
6260 |
||
1422 | 6261 |
Transcript showCR:(Smalltalk hello) |
6262 |
Stdout showCR:(Smalltalk hello) |
|
453 | 6263 |
" |
1307 | 6264 |
|
1412 | 6265 |
"Modified: 18.5.1996 / 14:25:13 / cg" |
617 | 6266 |
! |
6267 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6268 |
imageRestartTime |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6269 |
"return a timestamp for the moment when this image was restarted. |
1069 | 6270 |
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
|
6271 |
|
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6272 |
^ ImageRestartTime |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6273 |
|
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6274 |
" |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6275 |
Smalltalk imageStartTime |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6276 |
Smalltalk imageRestartTime |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6277 |
" |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6278 |
|
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6279 |
"Created: 13.12.1995 / 17:44:20 / cg" |
1069 | 6280 |
"Modified: 6.3.1996 / 11:56:35 / cg" |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6281 |
! |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6282 |
|
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6283 |
imageSaveTime |
3988 | 6284 |
"{ Pragma: +optSpace }" |
6285 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6286 |
"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
|
6287 |
|
eebf3ed54b23
reloadAllObjectFiles now called explicit (its too late via ObjMem changed)
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
6288 |
^ ObjectMemory imageSaveTime |
eebf3ed54b23
reloadAllObjectFiles now called explicit (its too late via ObjMem changed)
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
6289 |
! |
eebf3ed54b23
reloadAllObjectFiles now called explicit (its too late via ObjMem changed)
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
6290 |
|
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6291 |
imageStartTime |
3988 | 6292 |
"{ Pragma: +optSpace }" |
6293 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6294 |
"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
|
6295 |
(i.e. the first initial start without an image)" |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6296 |
|
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6297 |
^ ImageStartTime |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6298 |
|
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6299 |
" |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6300 |
Smalltalk imageStartTime |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6301 |
Smalltalk imageRestartTime |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6302 |
" |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6303 |
|
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6304 |
"Created: 13.12.1995 / 17:44:14 / cg" |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6305 |
"Modified: 13.12.1995 / 17:45:47 / cg" |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6306 |
! |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
6307 |
|
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6308 |
majorVersionNr |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6309 |
"{ Pragma: +optSpace }" |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
6310 |
|
617 | 6311 |
"return the major version number. |
6312 |
This is only incremented for very fundamental changes, |
|
6313 |
which make old object files totally incompatible |
|
6314 |
(for example, if the layout/representation of fundamental |
|
3382 | 6315 |
classes changes). |
6316 |
||
3988 | 6317 |
ST/X revision Naming is: |
7362
1af5f648cdb2
major version bumb (due to class-layout change)
Claus Gittinger <cg@exept.de>
parents:
7348
diff
changeset
|
6318 |
<major>.<minor>.<revision>.<release>" |
1af5f648cdb2
major version bumb (due to class-layout change)
Claus Gittinger <cg@exept.de>
parents:
7348
diff
changeset
|
6319 |
|
1af5f648cdb2
major version bumb (due to class-layout change)
Claus Gittinger <cg@exept.de>
parents:
7348
diff
changeset
|
6320 |
^ 5 |
617 | 6321 |
|
6322 |
" |
|
6323 |
Smalltalk majorVersionNr |
|
6324 |
" |
|
1941
51332fe23542
bumped version to 3 (I guess, nameSpaces are a major step)
Claus Gittinger <cg@exept.de>
parents:
1917
diff
changeset
|
6325 |
|
51332fe23542
bumped version to 3 (I guess, nameSpaces are a major step)
Claus Gittinger <cg@exept.de>
parents:
1917
diff
changeset
|
6326 |
"Modified: 8.11.1996 / 19:59:21 / cg" |
617 | 6327 |
! |
6328 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6329 |
minorVersionNr |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6330 |
"{ Pragma: +optSpace }" |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
6331 |
|
617 | 6332 |
"return the minor version number. |
6333 |
This is incremented for changes which make some old object |
|
6334 |
files incompatible, or the protocol changes such that some |
|
3988 | 6335 |
classes need rework. |
6336 |
||
6337 |
ST/X revision Naming is: |
|
7362
1af5f648cdb2
major version bumb (due to class-layout change)
Claus Gittinger <cg@exept.de>
parents:
7348
diff
changeset
|
6338 |
<major>.<minor>.<revision>.<release>" |
3988 | 6339 |
|
5322 | 6340 |
^ 1 |
617 | 6341 |
|
6342 |
" |
|
6343 |
Smalltalk minorVersionNr |
|
6344 |
" |
|
1941
51332fe23542
bumped version to 3 (I guess, nameSpaces are a major step)
Claus Gittinger <cg@exept.de>
parents:
1917
diff
changeset
|
6345 |
|
3092 | 6346 |
"Modified: / 3.11.1997 / 14:49:48 / cg" |
617 | 6347 |
! |
6348 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6349 |
releaseIdentification |
1552 | 6350 |
"{ Pragma: +optSpace }" |
6351 |
||
6352 |
"for developers only: return the release |
|
6353 |
(to further identify the version in case of errors)" |
|
6354 |
||
6355 |
%{ /* NOCONTEXT */ |
|
1553 | 6356 |
extern OBJ __getRel(); |
6357 |
||
6358 |
RETURN (__getRel()); |
|
5410 | 6359 |
%}. |
5445 | 6360 |
^ 'ST/X_experimental' |
1552 | 6361 |
|
6362 |
" |
|
6363 |
Smalltalk releaseIdentification |
|
6364 |
" |
|
6365 |
! |
|
6366 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6367 |
releaseNr |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6368 |
"{ Pragma: +optSpace }" |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
6369 |
|
617 | 6370 |
"return the revision number. |
6371 |
Incremented for releases which fix bugs/add features but did not find |
|
3988 | 6372 |
their way to the outside world. |
6373 |
||
6374 |
ST/X revision Naming is: |
|
6853 | 6375 |
<major>.<minor>.<revision>.<release>" |
4334 | 6376 |
|
6861 | 6377 |
^ 1 |
617 | 6378 |
|
6379 |
" |
|
6380 |
Smalltalk releaseNr |
|
6381 |
" |
|
732
29a49feab799
release bump - that seems to be a good one
Claus Gittinger <cg@exept.de>
parents:
728
diff
changeset
|
6382 |
|
29a49feab799
release bump - that seems to be a good one
Claus Gittinger <cg@exept.de>
parents:
728
diff
changeset
|
6383 |
"Created: 10.12.1995 / 01:42:19 / cg" |
617 | 6384 |
! |
6385 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6386 |
revisionNr |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6387 |
"{ Pragma: +optSpace }" |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
6388 |
|
617 | 6389 |
"return the revision number. |
6390 |
Incremented for releases which fix bugs/add features |
|
6391 |
and represent a stable workable version which got published |
|
3988 | 6392 |
to the outside world. |
6393 |
||
6394 |
ST/X revision Naming is: |
|
7000 | 6395 |
<major>.<minor>.<revision>.<release>" |
6396 |
||
7364 | 6397 |
^ 1 |
617 | 6398 |
|
6399 |
" |
|
6400 |
Smalltalk revisionNr |
|
6715 | 6401 |
Smalltalk hello |
617 | 6402 |
" |
1941
51332fe23542
bumped version to 3 (I guess, nameSpaces are a major step)
Claus Gittinger <cg@exept.de>
parents:
1917
diff
changeset
|
6403 |
|
3624 | 6404 |
"Modified: / 19.6.1998 / 04:29:10 / cg" |
617 | 6405 |
! |
6406 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6407 |
timeStamp |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6408 |
"return a string useful for timestamping a file. |
617 | 6409 |
The returned string is padded with spaces for a constant |
6410 |
length (to avoid changing a files size in fileOut with unchanged |
|
6411 |
class)." |
|
6412 |
||
5373 | 6413 |
^ ('''' , self timeStampString , '''') paddedTo:80 with:(Character space) |
617 | 6414 |
! |
6415 |
||
3611
f55f117dfd4a
added #timeStamp: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
3610
diff
changeset
|
6416 |
timeStamp:aStream |
f55f117dfd4a
added #timeStamp: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
3610
diff
changeset
|
6417 |
"write a string useful for timestamping a file onto aStream. |
f55f117dfd4a
added #timeStamp: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
3610
diff
changeset
|
6418 |
ST80 compatibility" |
f55f117dfd4a
added #timeStamp: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
3610
diff
changeset
|
6419 |
|
f55f117dfd4a
added #timeStamp: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
3610
diff
changeset
|
6420 |
aStream nextPutAll:(self timeStamp). |
f55f117dfd4a
added #timeStamp: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
3610
diff
changeset
|
6421 |
|
f55f117dfd4a
added #timeStamp: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
3610
diff
changeset
|
6422 |
"Created: / 18.6.1998 / 17:22:58 / cg" |
f55f117dfd4a
added #timeStamp: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
3610
diff
changeset
|
6423 |
! |
f55f117dfd4a
added #timeStamp: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
3610
diff
changeset
|
6424 |
|
5373 | 6425 |
timeStampString |
6426 |
"return a string useful for timestamping a file." |
|
6427 |
||
6428 |
^ ('From Smalltalk/X, Version:' , (Smalltalk versionString) , ' on ' |
|
6429 |
, Date today printString , ' at ' , Time now printString |
|
6430 |
) |
|
6431 |
! |
|
6432 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6433 |
versionDate |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6434 |
"{ Pragma: +optSpace }" |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
6435 |
|
617 | 6436 |
"return the executables build date - thats the date when the smalltalk |
6437 |
executable was built" |
|
6438 |
||
6439 |
%{ /* NOCONTEXT */ |
|
6440 |
extern char *__getBuildDateString(); |
|
6441 |
||
6442 |
RETURN (__MKSTRING(__getBuildDateString() COMMA_SND) ); |
|
5410 | 6443 |
%}. |
5445 | 6444 |
^ 'today' |
6445 |
||
6446 |
" |
|
6447 |
Smalltalk versionDate |
|
617 | 6448 |
" |
6449 |
! |
|
6450 |
||
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6451 |
versionString |
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6452 |
"{ Pragma: +optSpace }" |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
6453 |
|
617 | 6454 |
"return the version string" |
6455 |
||
6456 |
^ (self majorVersionNr printString , |
|
6457 |
'.', |
|
6458 |
self minorVersionNr printString , |
|
6459 |
'.', |
|
6460 |
self revisionNr printString) |
|
6461 |
||
6462 |
" |
|
6463 |
Smalltalk versionString |
|
6464 |
" |
|
5427 | 6465 |
! |
6466 |
||
6467 |
vmMajorVersionNr |
|
6468 |
"{ Pragma: +optSpace }" |
|
6469 |
||
6470 |
"return the VMs major version number." |
|
6471 |
%{ |
|
6472 |
RETURN (__MKSMALLINT(4)); |
|
6473 |
%}. |
|
6474 |
^ 4 |
|
6475 |
||
6476 |
" |
|
6477 |
Smalltalk vmMajorVersionNr |
|
6478 |
" |
|
6479 |
||
2 | 6480 |
! ! |
453 | 6481 |
|
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
6482 |
!Smalltalk class methodsFor:'documentation'! |
630 | 6483 |
|
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6484 |
version |
7525 | 6485 |
^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.585 2003-07-25 12:25:56 penk Exp $' |
630 | 6486 |
! ! |