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