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