author | Claus Gittinger <cg@exept.de> |
Wed, 11 Oct 2006 13:53:50 +0200 | |
changeset 10072 | 1bdc8f3c8583 |
parent 10071 | c3ac1c847c22 |
child 10087 | eb69f28fda88 |
permissions | -rw-r--r-- |
1 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1988 by Claus Gittinger |
10071 | 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 |
10054 | 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 |
|
21 |
DebuggingStandAlone LogDoits LoadBinaries RealSystemPath |
|
10069
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
22 |
ResourcePath SourcePath BinaryPath FileInPath PackagePath |
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
23 |
BinaryDirName ResourceDirName SourceDirName BitmapDirName |
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
24 |
PackageDirName FileInDirName ChangeFileName ImageStartTime |
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
25 |
ImageRestartTime DemoMode SaveEmergencyImage SpecialObjectArray |
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
26 |
CallbackSignal KnownPackages ClassesFailedToInitialize |
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
27 |
HasNoConsole' |
10054 | 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 |
10071 | 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:] |
10071 | 70 |
none - all handling is done in the VM |
1286 | 71 |
|
72 |
[Class variables:] |
|
73 |
||
10071 | 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 |
|
10071 | 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:] |
|
10071 | 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:] |
10071 | 183 |
ObjectMemory |
70 | 184 |
" |
8945 | 185 |
! |
186 |
||
187 |
readme_resources |
|
188 |
" |
|
189 |
What is a resource file: |
|
10071 | 190 |
resource files contain language transformation and sometimes |
191 |
UI-look specifics such as icons etc. |
|
8945 | 192 |
|
193 |
Where are resources stored in the image: |
|
10071 | 194 |
Resource files are only read on demand (i.e. when needed) and only read once |
195 |
i.e. they are cached in the image). |
|
196 |
The cached data is held in a per-class class-instVar named 'ClassResources'. |
|
197 |
With only a few exceptions, the only classes which need resources are the GUI |
|
198 |
classes under the SimpleView hierarchy. |
|
8945 | 199 |
|
200 |
How does the system find resources: |
|
10071 | 201 |
The idea is that the system-provided resource files can be overwritten |
202 |
by the user or an application configuration. |
|
203 |
This works via a hierarchy of directories where resources are searched for, |
|
204 |
with the systems standard resource-files being at the end of that chain. |
|
205 |
||
206 |
When searching for a resource file for class X, the following files are searched |
|
207 |
in order: |
|
208 |
{ResourcePath} / resources / X.rs |
|
209 |
{SystemPath} / (CLASSES-PACKAGE-PATH) / X.rs |
|
210 |
{ResourcePath} / (CLASSES-PACKAGE-PATH) / X.rs |
|
8945 | 211 |
" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
212 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
213 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
214 |
!Smalltalk class methodsFor:'initialization'! |
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 |
initGlobalsFromEnvironment |
617 | 217 |
"setup globals from the shell-environment" |
218 |
||
219 |
|envString i langString terrString| |
|
220 |
||
5406 | 221 |
StandAlone isNil ifTrue:[ |
10071 | 222 |
StandAlone := false. |
5406 | 223 |
]. |
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
224 |
HeadlessOperation isNil ifTrue:[ |
10071 | 225 |
HeadlessOperation := false. |
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
226 |
]. |
5406 | 227 |
|
617 | 228 |
" |
229 |
extract Language and LanguageTerritory from LANG variable. |
|
5846 | 230 |
valid are for example: |
10071 | 231 |
en_en / en |
232 |
en_us |
|
233 |
en_gb |
|
234 |
de_de / de |
|
235 |
de_at (for Austria) |
|
5846 | 236 |
" |
237 |
||
238 |
Language := #en. |
|
994
6163ae7aaf9b
territory defaults to #us (instead of #usa)
Claus Gittinger <cg@exept.de>
parents:
977
diff
changeset
|
239 |
LanguageTerritory := #us. |
617 | 240 |
|
5846 | 241 |
|
242 |
"Format of LANG is: language[_territory][.codeset][@modifier] |
|
10071 | 243 |
language ISO-639 Language code |
244 |
territory ISO-3166 Contry code" |
|
7779
6d88d32bdd64
Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents:
7763
diff
changeset
|
245 |
|
6d88d32bdd64
Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents:
7763
diff
changeset
|
246 |
envString := OperatingSystem getLanguage. |
3991
7b53bc45bf91
(isNil or:[isEmpty ]) -> (size == 0)
Claus Gittinger <cg@exept.de>
parents:
3988
diff
changeset
|
247 |
envString size > 0 ifTrue:[ |
10071 | 248 |
i := envString indexOf:$@. |
249 |
(i ~~ 0) ifTrue:[ |
|
250 |
envString := envString copyTo:(i - 1). |
|
251 |
LanguageModifier := (envString copyFrom:(i + 1)) asLowercase asSymbol. |
|
252 |
] ifFalse:[ |
|
253 |
LanguageModifier := nil. |
|
254 |
]. |
|
255 |
i := envString indexOf:$.. |
|
256 |
(i ~~ 0) ifTrue:[ |
|
257 |
envString := envString copyTo:(i - 1). |
|
258 |
LanguageCodeset := (envString copyFrom:(i + 1)) asLowercase asSymbol |
|
259 |
] ifFalse:[ |
|
260 |
LanguageCodeset := #'iso8859-1'. |
|
261 |
]. |
|
262 |
i := envString indexOf:$_. |
|
263 |
(i == 0) ifTrue:[ |
|
264 |
langString := envString. |
|
265 |
terrString := envString |
|
266 |
] ifFalse:[ |
|
267 |
langString := envString copyTo:(i - 1). |
|
268 |
terrString := envString copyFrom:(i + 1) |
|
269 |
]. |
|
270 |
Language := langString asLowercase asSymbol. |
|
271 |
LanguageTerritory := terrString asLowercase asSymbol |
|
617 | 272 |
]. |
273 |
||
274 |
" |
|
275 |
Smalltalk initGlobalsFromEnvironment |
|
276 |
" |
|
994
6163ae7aaf9b
territory defaults to #us (instead of #usa)
Claus Gittinger <cg@exept.de>
parents:
977
diff
changeset
|
277 |
|
6163ae7aaf9b
territory defaults to #us (instead of #usa)
Claus Gittinger <cg@exept.de>
parents:
977
diff
changeset
|
278 |
"Modified: 22.2.1996 / 16:59:12 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
279 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
280 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
281 |
initInterrupts |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
282 |
"initialize interrupts" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
283 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
284 |
OperatingSystem enableUserInterrupts. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
285 |
OperatingSystem enableHardSignalInterrupts. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
286 |
OperatingSystem enableCrashSignalInterrupts. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
287 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
288 |
ObjectMemory userInterruptHandler:self. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
289 |
ObjectMemory signalInterruptHandler:self. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
290 |
ObjectMemory recursionInterruptHandler:self. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
291 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
292 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
293 |
Smalltalk initInterrupts |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
294 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
295 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
296 |
"Modified: 20.8.1997 / 09:35:49 / stefan" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
297 |
! |
617 | 298 |
|
299 |
initStandardStreams |
|
300 |
"initialize some well-known streams" |
|
301 |
||
302 |
Stdout := NonPositionableExternalStream forStdout. |
|
303 |
Stderr := NonPositionableExternalStream forStderr. |
|
304 |
Stdin := NonPositionableExternalStream forStdin. |
|
305 |
Printer := PrinterStream. |
|
306 |
Transcript := Stderr |
|
307 |
||
963
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
308 |
" |
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
309 |
Smalltalk initStandardStreams |
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
310 |
" |
617 | 311 |
! |
312 |
||
313 |
initStandardTools |
|
314 |
"predefine some tools which we will need later |
|
315 |
- if the view-classes exist, |
|
316 |
they will redefine Inspector and Debugger for graphical interfaces" |
|
317 |
||
318 |
"redefine debug-tools, if view-classes exist" |
|
319 |
||
320 |
Display notNil ifTrue:[ |
|
10071 | 321 |
InspectorView notNil ifTrue:[ |
322 |
Inspector := InspectorView |
|
323 |
]. |
|
324 |
DebugView notNil ifTrue:[ |
|
325 |
Debugger := DebugView |
|
326 |
]. |
|
327 |
Display initialize |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
328 |
] |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
329 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
330 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
331 |
Smalltalk initStandardTools |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
332 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
333 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
334 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
335 |
initSystemPath |
617 | 336 |
"setup path where system files are searched for. |
337 |
the default path is set to: |
|
10071 | 338 |
. |
339 |
<directory of exe> (WIN32 only) |
|
340 |
$HOME (if defined) |
|
341 |
$HOME/.smalltalk (if defined & existing) |
|
342 |
$SMALLTALK_LIBDIR (if defined & existing) |
|
343 |
$STX_LIBDIR (if defined & existing) |
|
344 |
$STX_TOPDIR (if defined & existing) |
|
345 |
REGISTRY('HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X\<CurrentVersion>\LibDir') (WIN32 only) |
|
346 |
REGISTRY('HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X\LibDir') (WIN32 only) |
|
347 |
<standard places> |
|
9021 | 348 |
|
349 |
standard places (unix): |
|
10071 | 350 |
/opt/smalltalk/<release> (if existing) |
351 |
/opt/smalltalk (if existing) |
|
352 |
/usr/local/lib/smalltalk (if existing) |
|
353 |
/usr/lib/smalltalk (if existing) |
|
354 |
/lib/smalltalk (if existing) |
|
4001
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
355 |
|
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
356 |
win32: |
10071 | 357 |
\programs\exept\smalltalk (if existing) |
358 |
\programs\smalltalk (if existing) |
|
359 |
\smalltalk (if existing) |
|
4001
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
360 |
|
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
361 |
vms: |
10071 | 362 |
$stx:lib (if existing) |
363 |
$stx:root (if existing) |
|
617 | 364 |
|
365 |
of course, it is possible to add entries from the 'smalltalk.rc' |
|
366 |
startup file; add expressions such as: |
|
10071 | 367 |
Smalltalk systemPath addFirst:'/foo/bar/baz'. |
368 |
or: |
|
369 |
Smalltalk systemPath addLast:'/fee/foe/foo'. |
|
4001
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
370 |
|
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
371 |
However, smalltalk.rc itself must be found along the above path. |
617 | 372 |
" |
373 |
||
2928 | 374 |
ChangeFileName := 'changes'. |
375 |
OperatingSystem isVMSlike ifTrue:[ |
|
10071 | 376 |
BitmapDirName := 'bitmaps.dir'. |
377 |
BinaryDirName := 'binary.dir'. |
|
378 |
SourceDirName := 'source.dir'. |
|
379 |
ResourceDirName := 'resources.dir'. |
|
380 |
FileInDirName := 'filein.dir'. |
|
381 |
PackageDirName := 'packages.dir'. |
|
2928 | 382 |
] ifFalse:[ |
10071 | 383 |
BitmapDirName := 'bitmaps'. |
384 |
BinaryDirName := 'binary'. |
|
385 |
SourceDirName := 'source'. |
|
386 |
ResourceDirName := 'resources'. |
|
387 |
FileInDirName := 'fileIn'. |
|
388 |
PackageDirName := 'packages'. |
|
2928 | 389 |
]. |
390 |
||
680 | 391 |
SystemPath isNil ifTrue:[ |
10071 | 392 |
SystemPath := OperatingSystem defaultSystemPath. |
393 |
self flushPathCaches |
|
5139 | 394 |
]. |
395 |
||
5144 | 396 |
PackagePath isNil ifTrue:[ |
10071 | 397 |
PackagePath := OperatingSystem defaultPackagePath. |
5144 | 398 |
]. |
617 | 399 |
|
400 |
" |
|
401 |
Smalltalk initSystemPath |
|
402 |
Smalltalk systemPath |
|
403 |
" |
|
5139 | 404 |
|
5145 | 405 |
"Modified: / 24.12.1999 / 00:23:35 / cg" |
8583
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 |
initUserPreferences |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
409 |
"setup other stuff" |
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 |
LogDoits := false. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
412 |
LoadBinaries := false. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
413 |
SaveEmergencyImage := (StandAlone ~~ true). |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
414 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
415 |
"Modified: / 24.10.1997 / 18:22:47 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
416 |
! |
617 | 417 |
|
7526 | 418 |
initializeClass:aClass |
419 |
"sent from VM via #initializeModules" |
|
420 |
||
7527 | 421 |
Error handle:[:ex | |
10071 | 422 |
ClassesFailedToInitialize isNil ifTrue:[ |
423 |
ClassesFailedToInitialize := IdentitySet new. |
|
424 |
]. |
|
425 |
ClassesFailedToInitialize add:aClass. |
|
426 |
('Smalltalk [warning]: error during initialize of ' , aClass name,': ', ex description printString) errorPrintCR. |
|
427 |
(Smalltalk commandLineArguments includes:'--debug') ifTrue:[ |
|
428 |
ex reject |
|
429 |
]. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
430 |
] do:[ |
10071 | 431 |
aClass initialize |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
432 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
433 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
434 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
435 |
initializeModules |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
436 |
"perform module specific initialization and |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
437 |
send #initialize to all classes. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
438 |
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
|
439 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
440 |
self initializeModulesOnce. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
441 |
ClassesFailedToInitialize size > 0 ifTrue:[ |
10071 | 442 |
('Smalltalk [info]: retry initialization of failed class(es)...') infoPrintCR. |
443 |
ClassesFailedToInitialize := nil. |
|
444 |
self initializeModulesOnce. |
|
445 |
ClassesFailedToInitialize size > 0 ifTrue:[ |
|
446 |
('Smalltalk [error]: class(es) persist to fail during initialize') errorPrintCR. |
|
447 |
] |
|
7527 | 448 |
]. |
449 |
! |
|
450 |
||
7563 | 451 |
initializeModulesOnce |
452 |
"perform module specific initialization and |
|
453 |
send #initialize to all classes. |
|
7527 | 454 |
Notice: this is not called when an image is restarted" |
4963 | 455 |
|
617 | 456 |
%{ |
1688
8a42db1eea60
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1682
diff
changeset
|
457 |
__init_registered_modules__(3); |
4963 | 458 |
|
1481 | 459 |
@global(DemoMode) = __getDemoMode() ? true : false; |
5410 | 460 |
RETURN (self); |
461 |
%}. |
|
462 |
^ self primitiveFailed |
|
617 | 463 |
! |
464 |
||
7563 | 465 |
initializeSystem |
466 |
"initialize all other classes; setup dispatcher processes etc. |
|
3499 | 467 |
This one is the very first entry into the smalltalk world, |
468 |
right after startup, ususally immediately followed by Smalltalk>>start. |
|
10071 | 469 |
Notice: |
470 |
this is not called when an image is restarted; in this |
|
471 |
case the show starts in Smalltalk>>restart." |
|
211 | 472 |
|
6841
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
473 |
|idx| |
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
474 |
|
8964
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
475 |
NumberOfClassesHint := 4500. |
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
476 |
|
3499 | 477 |
Initializing := true. |
6841
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
478 |
|
3499 | 479 |
AbstractOperatingSystem initializeConcreteClass. |
480 |
||
5400 | 481 |
CommandLineArguments isNil ifTrue:[ |
10071 | 482 |
CommandLineArguments := #('stx'). |
5400 | 483 |
]. |
4006
c7ad38c52eb9
must set CommandLineArguments earlier (to be available in initializeSystem)
Claus Gittinger <cg@exept.de>
parents:
4001
diff
changeset
|
484 |
CommandLine := CommandLineArguments copy. |
c7ad38c52eb9
must set CommandLineArguments earlier (to be available in initializeSystem)
Claus Gittinger <cg@exept.de>
parents:
4001
diff
changeset
|
485 |
CommandLineArguments := CommandLineArguments asOrderedCollection. |
6842 | 486 |
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
|
487 |
|
4028
b46539f16af5
added --silentStartup argument
Claus Gittinger <cg@exept.de>
parents:
4026
diff
changeset
|
488 |
SilentLoading := (CommandLineArguments includes:'--silentStartup'). |
348 | 489 |
|
6841
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
490 |
DebuggingStandAlone := false. |
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
491 |
|
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
492 |
StandAlone ifTrue:[ |
10071 | 493 |
InfoPrinting := false. |
494 |
ObjectMemory infoPrinting:false. |
|
495 |
||
496 |
idx := CommandLineArguments indexOf:'--debug'. |
|
497 |
idx ~~ 0 ifTrue:[ |
|
498 |
DebuggingStandAlone := true. |
|
499 |
]. |
|
500 |
DebuggingStandAlone ifTrue:[ |
|
501 |
Inspector := MiniInspector. |
|
502 |
Debugger := MiniDebugger. |
|
503 |
]. |
|
6841
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
504 |
] ifFalse:[ |
10071 | 505 |
"/ |
506 |
"/ define low-level debugging tools - graphical classes are not prepared yet |
|
507 |
"/ to handle things. |
|
508 |
"/ This will bring us into the MiniDebugger when an error occurs during startup. |
|
509 |
"/ |
|
510 |
Inspector := MiniInspector. |
|
511 |
Debugger := MiniDebugger. |
|
6841
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
512 |
]. |
1 | 513 |
|
2090
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
514 |
"/ |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
515 |
"/ start catching SIGSEGV and SIGBUS |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
516 |
"/ |
713
32540afb8ffc
setup SIGSEGV/SIGBUS handling early - to catch those during startup
Claus Gittinger <cg@exept.de>
parents:
706
diff
changeset
|
517 |
OperatingSystem enableHardSignalInterrupts. |
32540afb8ffc
setup SIGSEGV/SIGBUS handling early - to catch those during startup
Claus Gittinger <cg@exept.de>
parents:
706
diff
changeset
|
518 |
|
1 | 519 |
self initGlobalsFromEnvironment. |
520 |
||
2090
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
521 |
"/ |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
522 |
"/ sorry - there are some, which MUST be initialized before .. |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
523 |
"/ reason: if any error happens during init, we need Signals, Stdout etc. to be there |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
524 |
"/ |
1 | 525 |
Object initialize. |
7704 | 526 |
Stream initialize. |
527 |
PositionableStream initialize. |
|
2907 | 528 |
Filename initialize. |
326 | 529 |
ObjectMemory initialize. |
2504
ece15ffbcb69
Initialize OperatingSystem early (needed for some signals).
Stefan Vogel <sv@exept.de>
parents:
2485
diff
changeset
|
530 |
OperatingSystem initialize. |
1 | 531 |
ExternalStream initialize. |
211 | 532 |
|
533 |
self initStandardStreams. "/ setup Stdin, Stdout etc. |
|
1 | 534 |
|
2090
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
535 |
"/ |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
536 |
"/ sorry, path must be set before ... |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
537 |
"/ reason: some classes need it during initialize (they might need resources, bitmaps etc) |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
538 |
"/ |
1 | 539 |
self initSystemPath. |
540 |
||
541 |
Compiler := ByteCodeCompiler. |
|
542 |
Compiler isNil ifTrue:[ |
|
10071 | 543 |
" |
544 |
ByteCodeCompiler is not in the system (i.e. has not been linked in) |
|
545 |
this allows at least immediate evaluations for runtime systems without compiler |
|
546 |
NOTICE: a parser is always needed, otherwise we cannot read resource files etc. |
|
547 |
" |
|
548 |
Compiler := Parser |
|
1 | 549 |
]. |
550 |
||
2090
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
551 |
"/ |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
552 |
"/ another one, to be initialized before others |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
553 |
"/ |
2077
6b5dc412dd15
must initialize Processor before doing modulInits
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
554 |
ProcessorScheduler initialize. |
6b5dc412dd15
must initialize Processor before doing modulInits
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
555 |
|
2090
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
556 |
"/ |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
557 |
"/ now, finally, initialize all other classes |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
558 |
"/ |
325 | 559 |
self initializeModules. |
560 |
||
8251
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
561 |
ImageStartTime := Timestamp now. |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
562 |
|
70 | 563 |
self initInterrupts. |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
564 |
self initUserPreferences. |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
565 |
|
2090
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
566 |
"/ |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
567 |
"/ give classes a chance to perform 2nd-level initialization |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
568 |
"/ now, we are certain, that all other classes have been initialized |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
569 |
"/ (especially: streams and signals can now be used) |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
570 |
"/ |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
571 |
ObjectMemory changed:#initialized. |
42653edf4cc5
added hook for 2nd stage initialization
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
572 |
|
2504
ece15ffbcb69
Initialize OperatingSystem early (needed for some signals).
Stefan Vogel <sv@exept.de>
parents:
2485
diff
changeset
|
573 |
"Modified: 8.1.1997 / 19:58:12 / stefan" |
2907 | 574 |
"Modified: 7.9.1997 / 23:34:44 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
575 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
576 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
577 |
isInitialized |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
578 |
"this returns true, if the system is properly initialized; |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
579 |
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
|
580 |
not working correctly until initialized." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
581 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
582 |
^ Initializing not |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
583 |
! |
1 | 584 |
|
7563 | 585 |
reinitStandardStreams |
586 |
"reinitialize some well-known streams. |
|
587 |
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
|
588 |
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
|
589 |
(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
|
590 |
|
8710aba7876b
oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents:
457
diff
changeset
|
591 |
Stdout reOpen. Stderr reOpen. Stdin reOpen. |
161 | 592 |
! ! |
593 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
594 |
!Smalltalk class methodsFor:'Compatibility-Squeak'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
595 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
596 |
beep |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
597 |
Screen current beep |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
598 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
599 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
600 |
garbageCollect |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
601 |
ObjectMemory garbageCollect |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
602 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
603 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
604 |
garbageCollectMost |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
605 |
"collect recently created garbage; return the amount of freeSpace. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
606 |
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
|
607 |
newSpace + freeListSpace is returned." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
608 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
609 |
ObjectMemory scavenge. |
10071 | 610 |
^ ObjectMemory freeSpace |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
611 |
+ (ObjectMemory newSpaceSize - ObjectMemory newSpaceUsed) |
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 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
614 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
615 |
isMorphic |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
616 |
^ false |
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 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
619 |
registerExternalObject: anObject |
7563 | 620 |
"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
|
621 |
If it is already there, just return its index. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
622 |
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
|
623 |
primitive code (via the global Smalltalk:SpecialObjectArray)" |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
624 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
625 |
| objects firstEmptyIndex obj sz newObjects | |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
626 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
627 |
objects := SpecialObjectArray. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
628 |
objects isNil ifTrue:[ |
10071 | 629 |
objects := Array new:5. |
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
630 |
]. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
631 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
632 |
"find the first empty slot and look if already registered" |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
633 |
firstEmptyIndex := 0. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
634 |
1 to: objects size do: [:i | |
10071 | 635 |
obj := objects at: i. |
636 |
obj == anObject ifTrue: [^ i]. "object already there, just return its index" |
|
637 |
(obj == nil and: [firstEmptyIndex = 0]) ifTrue: [ |
|
638 |
firstEmptyIndex := i |
|
639 |
] |
|
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
640 |
]. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
641 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
642 |
"if no empty slots, expand the array" |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
643 |
firstEmptyIndex = 0 ifTrue: [ |
10071 | 644 |
sz := objects size. |
645 |
newObjects := objects species new: sz + 20. "grow linearly" |
|
646 |
newObjects replaceFrom: 1 to: sz with: objects startingAt: 1. |
|
647 |
firstEmptyIndex := sz + 1. |
|
648 |
SpecialObjectArray := newObjects. |
|
649 |
objects := newObjects |
|
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
650 |
]. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
651 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
652 |
objects at: firstEmptyIndex put: anObject. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
653 |
^ firstEmptyIndex |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
654 |
|
8583
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 |
renameClassNamed:oldName as:newName |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
658 |
self renameClass:(self at:oldName) to:newName |
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 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
661 |
unregisterExternalObject: anObject |
10071 | 662 |
"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
|
663 |
Do nothing if it isn't registered." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
664 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
665 |
|objects| |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
666 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
667 |
anObject isNil ifTrue:[^ self]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
668 |
objects := SpecialObjectArray. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
669 |
1 to: objects size do: [:i | |
10071 | 670 |
(objects at: i) == anObject ifTrue: [ |
671 |
objects at: i put: nil |
|
672 |
] |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
673 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
674 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
675 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
676 |
!Smalltalk class methodsFor:'Compatibility-V''Age'! |
6722
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
677 |
|
7563 | 678 |
allClassesImplementing:aSelector |
9506 | 679 |
^ self allClassesForWhich:[:cls | cls implements:aSelector]. |
680 |
||
681 |
"Modified: / 10-08-2006 / 12:12:17 / cg" |
|
9090 | 682 |
! |
683 |
||
684 |
declareConstant:constantName poolName:poolName value:value |
|
685 |
|pool| |
|
686 |
||
687 |
pool := self classNamed:poolName. |
|
688 |
pool declareConstant:constantName value:value |
|
689 |
! |
|
690 |
||
691 |
declarePoolDictionary:poolDictionaryName |
|
692 |
SharedPool subclass:(poolDictionaryName asSymbol) |
|
10071 | 693 |
instanceVariableNames:'' |
694 |
classVariableNames:'' |
|
695 |
poolDictionaries:'' |
|
696 |
category:nil |
|
6722
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
697 |
! ! |
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
698 |
|
7295 | 699 |
!Smalltalk class methodsFor:'Compatibility-VW5.4'! |
6094
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
700 |
|
7563 | 701 |
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
|
702 |
|newClass| |
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
703 |
|
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
704 |
indexed == #none ifTrue:[ |
10071 | 705 |
newClass := superclass |
706 |
subclass:nameSymbol |
|
707 |
instanceVariableNames:instVars |
|
708 |
classVariableNames:'' |
|
709 |
poolDictionaries:'' |
|
710 |
category:category |
|
711 |
inEnvironment:self. |
|
712 |
classInstVars size > 0 ifTrue:[ |
|
713 |
newClass class instanceVariableNames:classInstVars. |
|
714 |
]. |
|
715 |
^ newClass |
|
6851 | 716 |
]. |
717 |
self shouldImplement. |
|
8583
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 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
720 |
!Smalltalk class methodsFor:'accessing'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
721 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
722 |
associationAt:aKey |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
723 |
"return a key-value association for aKey. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
724 |
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
|
725 |
simulated here." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
726 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
727 |
|val| |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
728 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
729 |
val := self at:aKey ifAbsent:nil. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
730 |
val isNil ifTrue:[^ nil]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
731 |
^ Association key:aKey value:val |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
732 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
733 |
"Created: / 1.11.1997 / 13:27:20 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
734 |
! |
3083 | 735 |
|
7563 | 736 |
associationAt:aKey ifAbsent:exceptionBlock |
737 |
"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
|
738 |
from exceptionBlock, if no such key is present. |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
739 |
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
|
740 |
simulated here." |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
741 |
|
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
742 |
|val| |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
743 |
|
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
744 |
val := self at:aKey ifAbsent:nil. |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
745 |
val isNil ifTrue:[^ exceptionBlock value]. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
746 |
^ Association key:aKey value:val |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
747 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
748 |
"Created: / 18.6.1998 / 17:05:24 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
749 |
! |
3610
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
750 |
|
7563 | 751 |
at:aKey |
10071 | 752 |
"retrieve the value stored under aKey, a symbol. |
753 |
Return nil if not present |
|
1956 | 754 |
(this will be changed to trigger an error - better use #at:ifAbsent:)" |
453 | 755 |
|
6851 | 756 |
aKey class == String ifTrue:[self error:'expected symbol']. |
6080
15ea3cbf6003
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
6074
diff
changeset
|
757 |
|
453 | 758 |
%{ /* NOCONTEXT */ |
759 |
RETURN ( __GLOBAL_GET(aKey) ); |
|
5406 | 760 |
%}. |
5410 | 761 |
^ self primitiveFailed |
453 | 762 |
! |
763 |
||
7563 | 764 |
at:aKey ifAbsent:aBlock |
765 |
"retrieve the value stored at aKey. |
|
7565 | 766 |
If there is nothing stored under this key, return the value of |
767 |
the evaluation of aBlock." |
|
453 | 768 |
|
769 |
(self includesKey:aKey) ifTrue:[ |
|
10071 | 770 |
^ self at:aKey |
453 | 771 |
]. |
772 |
^ aBlock value |
|
773 |
||
774 |
" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
775 |
Smalltalk at:#fooBar <- returns nil |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
776 |
Smalltalk at:#fooBar ifAbsent:['sorry'] <- no error |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
777 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
778 |
! |
453 | 779 |
|
7563 | 780 |
at:aKey ifPresent:aBlock |
781 |
"try to retrieve the value stored at aKey. |
|
782 |
If there is nothing stored under this key, do nothing. |
|
4870 | 783 |
Otherwise, evaluate aBlock, passing the retrieved value as argument." |
784 |
||
785 |
(self includesKey:aKey) ifTrue:[ |
|
10071 | 786 |
^ aBlock value:(self at:aKey) |
4870 | 787 |
]. |
788 |
^ nil |
|
789 |
||
790 |
" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
791 |
Smalltalk at:#fooBar ifPresent:[:what | Transcript showCR:what]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
792 |
Smalltalk at:#Object ifPresent:[:what | Transcript showCR:what]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
793 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
794 |
|
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 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
797 |
at:aKey put:aValue |
7563 | 798 |
"store the argument aValue under aKey, a symbol. |
799 |
Return aValue (sigh)." |
|
453 | 800 |
|
801 |
|oldValue| |
|
802 |
||
803 |
%{ |
|
804 |
oldValue = __GLOBAL_SET(aKey, aValue, (OBJ *)0); |
|
805 |
%}. |
|
806 |
CachedClasses notNil ifTrue:[ |
|
10071 | 807 |
oldValue isBehavior ifTrue:[ |
808 |
oldValue name == aKey ifTrue:[ |
|
809 |
CachedClasses remove:oldValue ifAbsent:[] |
|
810 |
] |
|
811 |
]. |
|
812 |
aValue isBehavior ifTrue:[ |
|
1956 | 813 |
"/ aValue isMeta ifTrue:[ |
814 |
"/ "/ this should not happen |
|
815 |
"/ ('SMALLTALK: store a Metaclass: ' , aValue name , ' as ' , aKey) infoPrintCR. |
|
816 |
"/ ]. |
|
817 |
||
10071 | 818 |
aValue name == aKey ifTrue:[ |
819 |
CachedClasses add:aValue |
|
820 |
] ifFalse:[ |
|
821 |
CachedClasses := nil |
|
822 |
] |
|
823 |
]. |
|
453 | 824 |
]. |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
825 |
^ aValue. |
1955 | 826 |
"/ |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
827 |
"/%{ /* NOCONTEXT */ |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
828 |
"/ (void) __GLOBAL_SET(aKey, aValue, (OBJ *)0); |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
829 |
"/%}. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
830 |
"/ CachedClasses := nil. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
831 |
"/ ^ aValue |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
832 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
833 |
"Modified: 19.4.1996 / 11:31:49 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
834 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
835 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
836 |
includesKey:aKey |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
837 |
"return true, if the key is known" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
838 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
839 |
"/ for debugging - this is a common mistake, |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
840 |
"/ to try to access a class by nameString, instead |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
841 |
"/ of by symbol. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
842 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
843 |
"/ aKey class == String ifTrue:[self halt]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
844 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
845 |
%{ /* NOCONTEXT */ |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
846 |
RETURN ( __GLOBAL_KEYKNOWN(aKey) ); |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
847 |
%}. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
848 |
^ self primitiveFailed |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
849 |
! |
453 | 850 |
|
7563 | 851 |
keyAtValue:anObject |
852 |
"return the symbol under which anObject is stored - or nil" |
|
453 | 853 |
|
854 |
self keysDo:[:aKey | |
|
10071 | 855 |
(self at:aKey) == anObject ifTrue:[^ aKey] |
453 | 856 |
]. |
857 |
^ nil |
|
858 |
||
859 |
"Smalltalk keyAtValue:Object" |
|
860 |
! |
|
861 |
||
7563 | 862 |
keys |
863 |
"return a collection with all keys in the Smalltalk dictionary" |
|
864 |
||
865 |
|keys| |
|
453 | 866 |
|
867 |
keys := IdentitySet new. |
|
868 |
self keysDo:[:k | keys add:k]. |
|
869 |
^ keys |
|
617 | 870 |
! |
871 |
||
7563 | 872 |
removeKey:aKey |
873 |
"remove the association stored under the key-argument from the globals dictionary. |
|
10071 | 874 |
WARNING: |
875 |
this is somewhat dangerous: conceptionally, the association is removed, |
|
876 |
to which machine & byte compiled code refers if it accesses a global. |
|
877 |
If there are still global accesses in some literalArray or from machine-compiled code, |
|
878 |
it continues to reference the globals value via that obsolete association and gets a nil |
|
879 |
value. (which is correct) |
|
880 |
However, if that global is later reintroduced, a new association will be created and |
|
881 |
the new global now referenced via the new association. |
|
882 |
The old accesses will still see nil, although the globals value is actually non-nil |
|
883 |
(this is questionable). |
|
884 |
To avoid this problem, the #removeClass: method never removed the key." |
|
617 | 885 |
|
886 |
CachedClasses := nil. |
|
887 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
888 |
%{ /* NOCONTEXT */ |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
889 |
RETURN ( __GLOBAL_REMOVE(aKey) ); |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
890 |
%}. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
891 |
^ self primitiveFailed |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
892 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
893 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
894 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
895 |
values |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
896 |
"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
|
897 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
898 |
|values| |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
899 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
900 |
values := OrderedCollection new. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
901 |
self do:[:v | values add:v]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
902 |
^ values |
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 |
"Created: 20.6.1997 / 16:58:28 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
905 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
906 |
|
10072 | 907 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
908 |
!Smalltalk class methodsFor:'browsing'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
909 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
910 |
browseAllCallsOn:aSelectorSymbol |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
911 |
"{ Pragma: +optSpace }" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
912 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
913 |
"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
|
914 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
915 |
UserPreferences systemBrowserClass browseAllCallsOn:aSelectorSymbol |
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 |
" |
10071 | 918 |
Smalltalk browseAllCallsOn:#at:put: |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
919 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
920 |
! |
617 | 921 |
|
7563 | 922 |
browseAllSelect:aBlock |
923 |
"{ Pragma: +optSpace }" |
|
924 |
||
925 |
"startup a browser for all methods for which aBlock returns true" |
|
617 | 926 |
|
6020 | 927 |
UserPreferences systemBrowserClass browseAllSelect:aBlock |
617 | 928 |
|
929 |
" |
|
930 |
Smalltalk browseAllSelect:[:m | m literals isNil] |
|
931 |
" |
|
932 |
! |
|
933 |
||
7563 | 934 |
browseChanges |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
935 |
"{ Pragma: +optSpace }" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
936 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
937 |
"startup a changes browser" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
938 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
939 |
ChangesBrowser notNil ifTrue:[ |
10071 | 940 |
ChangesBrowser open |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
941 |
] ifFalse:[ |
10071 | 942 |
self warn:'no ChangesBrowser built in' |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
943 |
] |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
944 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
945 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
946 |
Smalltalk browseChanges |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
947 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
948 |
! |
453 | 949 |
|
7563 | 950 |
browseClass:aClass |
951 |
"{ Pragma: +optSpace }" |
|
952 |
||
953 |
"startup a browser on aClass" |
|
6970 | 954 |
|
955 |
UserPreferences systemBrowserClass browseClass:aClass |
|
956 |
||
957 |
" |
|
10071 | 958 |
Smalltalk browseClass:Array |
6970 | 959 |
" |
960 |
! |
|
961 |
||
7563 | 962 |
browseImplementorsMatching:aSelectorSymbolOrMatchPattern |
963 |
"{ Pragma: +optSpace }" |
|
6819 | 964 |
|
965 |
"startup a browser for all methods implementing a message matching" |
|
966 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
967 |
UserPreferences systemBrowserClass browseImplementorsMatching:aSelectorSymbolOrMatchPattern |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
968 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
969 |
" |
10071 | 970 |
Smalltalk browseImplementorsOf:#'at:put:' |
971 |
Smalltalk browseImplementorsMatching:#'at:*' |
|
8583
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 |
! |
6819 | 974 |
|
7563 | 975 |
browseImplementorsOf:aSelectorSymbol |
976 |
"{ Pragma: +optSpace }" |
|
977 |
||
978 |
"startup a browser for all methods implementing a particular message" |
|
453 | 979 |
|
6020 | 980 |
UserPreferences systemBrowserClass browseImplementorsOf:aSelectorSymbol |
453 | 981 |
|
982 |
" |
|
10071 | 983 |
Smalltalk browseImplementorsOf:#at:put: |
8583
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 |
! |
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 |
browseInClass:aClass |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
988 |
"{ Pragma: +optSpace }" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
989 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
990 |
"startup a full browser showing aClass" |
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 |
UserPreferences systemBrowserClass openInClass:aClass |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
993 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
994 |
" |
10071 | 995 |
Smalltalk browseInClass:Array |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
996 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
997 |
! |
6970 | 998 |
|
7563 | 999 |
browseInClass:aClass selector:selector |
1000 |
"{ Pragma: +optSpace }" |
|
1001 |
||
1002 |
"startup a full browser showing aClass>>selector" |
|
6970 | 1003 |
|
1004 |
UserPreferences systemBrowserClass openInClass:aClass selector:selector |
|
1005 |
||
1006 |
" |
|
1007 |
Smalltalk browseInClass:Array selector:#at: |
|
1008 |
" |
|
453 | 1009 |
! ! |
1010 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1011 |
!Smalltalk class methodsFor:'class management'! |
453 | 1012 |
|
7563 | 1013 |
changeCategoryOf:aClass to:newCategory |
1014 |
"change a classes category, add a change record, |
|
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1015 |
send change notifications" |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1016 |
|
8405 | 1017 |
|ns oldCategory| |
1018 |
||
1019 |
oldCategory := aClass category. |
|
1020 |
oldCategory ~= newCategory ifTrue:[ |
|
10071 | 1021 |
aClass category:(newCategory withoutSeparators asSymbol). |
1022 |
||
1023 |
"notify change of category" |
|
1024 |
ns := aClass environment ? self. |
|
1025 |
ns changed:#organization with:(aClass -> oldCategory). |
|
1026 |
ns ~~ self ifTrue:[ |
|
1027 |
self changed:#organization with:(aClass -> oldCategory). |
|
1028 |
] |
|
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1029 |
]. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1030 |
|
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1031 |
" |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1032 |
Smalltalk changeCategoryOf:NewApplication to:#myApplications |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1033 |
" |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1034 |
|
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1035 |
"Modified: / 11.2.2000 / 11:36:27 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1036 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1037 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1038 |
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
|
1039 |
NameSpace name:name |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1040 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1041 |
! |
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 |
flushCachedClass:aClass |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1044 |
CachedClasses notNil ifTrue:[ |
10071 | 1045 |
CachedClasses remove:aClass ifAbsent:[] |
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 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1048 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1049 |
flushCachedClasses |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1050 |
CachedClasses := nil. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1051 |
Class flushSubclassInfo. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1052 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1053 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1054 |
Smalltalk flushCachedClasses |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1055 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1056 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1057 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1058 |
removeClass:aClass |
7563 | 1059 |
"remove the argument, aClass from the smalltalk dictionary; |
453 | 1060 |
we have to flush the caches since these methods are now void. |
1061 |
Also, class variables of aClass are removed." |
|
1062 |
||
4781 | 1063 |
|sym cSym names oldName oldNameSym actualName wrongName ns ons| |
453 | 1064 |
|
4099 | 1065 |
aClass isNil ifTrue:[^ self]. |
4781 | 1066 |
|
453 | 1067 |
oldName := aClass name. |
4781 | 1068 |
sym := oldNameSym := oldName asSymbol. |
1069 |
((self at:oldNameSym) == aClass) ifFalse:[ |
|
10071 | 1070 |
"check other name ..." |
1071 |
(self includes:aClass) ifFalse:[ |
|
1072 |
'Smalltalk [warning]: no such class: ' errorPrint. oldName errorPrintCR. |
|
1073 |
^ self |
|
1074 |
]. |
|
1075 |
" |
|
1076 |
the class has changed its name - without telling me ... |
|
1077 |
what should be done in this case ? |
|
1078 |
" |
|
1079 |
'Smalltalk [warning]: class ' errorPrint. oldName errorPrint. |
|
1080 |
' has changed its name' errorPrintCR. |
|
1081 |
||
1082 |
"/ |
|
1083 |
"/ might be an alias (i.e. removing a compatibility name) |
|
1084 |
"/ |
|
1085 |
actualName := self keyAtValue:aClass. |
|
1086 |
('Smalltalk [info]: ' , oldName , ' is actually stored as ' , actualName , '.') infoPrintCR. |
|
1087 |
sym := actualName asSymbol. |
|
1088 |
oldName := actualName asString. |
|
1089 |
wrongName := true. |
|
453 | 1090 |
]. |
1091 |
||
4781 | 1092 |
ns := aClass nameSpace. |
1093 |
aClass topOwningClass notNil ifTrue:[ |
|
10071 | 1094 |
ons := aClass topOwningClass nameSpace |
4781 | 1095 |
]. |
1096 |
||
453 | 1097 |
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
|
1098 |
|
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1099 |
"/ |
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1100 |
"/ 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
|
1101 |
"/ |
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1102 |
"/ self removeKey:sym. "/ remove key - this actually fails, if there are |
10071 | 1103 |
"/ still compiled code references." |
453 | 1104 |
|
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1105 |
"remove private classes" |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1106 |
|
2485
9f4a11a4521f
new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents:
2476
diff
changeset
|
1107 |
aClass privateClassesSorted do:[:somePrivateClass | |
10071 | 1108 |
aClass privateClassesAt:(somePrivateClass nameWithoutPrefix) asSymbol put:nil. |
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1109 |
]. |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1110 |
|
453 | 1111 |
"remove class variables" |
1112 |
||
1113 |
names := aClass classVariableString asCollectionOfWords. |
|
1114 |
names do:[:name | |
|
10071 | 1115 |
cSym := (sym , ':' , name) asSymbol. |
1116 |
self at:cSym asSymbol put:nil. |
|
1117 |
||
1118 |
"/ |
|
1119 |
"/ see comment in removeKey: on why we dont remove it here |
|
1120 |
"/ |
|
1121 |
"/ self removeKey:cSym |
|
453 | 1122 |
]. |
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1123 |
|
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1124 |
|
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1125 |
"/ actually could get along with less flushing |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1126 |
"/ (entries for aClass and subclasses only) |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1127 |
"/ 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
|
1128 |
"/ 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
|
1129 |
"/ expensive then cache flushing. |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1130 |
"/ |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1131 |
"/ aClass allSubclassesDo:[:aSubclass | |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1132 |
"/ ObjectMemory flushInlineCachesForClass:aSubclass. |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1133 |
"/ ObjectMemory flushMethodCacheFor:aSubclass |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1134 |
"/ ]. |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1135 |
"/ ObjectMemory flushInlineCachesForClass:aClass. |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1136 |
"/ ObjectMemory flushMethodCacheFor:aClass |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1137 |
|
453 | 1138 |
ObjectMemory flushInlineCaches. |
1139 |
ObjectMemory flushMethodCache. |
|
1140 |
||
7181 | 1141 |
aClass addChangeRecordForClassRemove. |
453 | 1142 |
self changed:#classRemove with:aClass. |
1143 |
||
7581
6912a7336e15
class category: sends a change notification;
Claus Gittinger <cg@exept.de>
parents:
7572
diff
changeset
|
1144 |
aClass setCategory:#'* removed *'. |
1655 | 1145 |
|
5326 | 1146 |
self flushCachedClasses. |
1147 |
Class flushSubclassInfo. |
|
1148 |
||
3627
452f2e1ff1b4
removeClass - care for aliases.
Claus Gittinger <cg@exept.de>
parents:
3626
diff
changeset
|
1149 |
wrongName == true ifTrue:[ |
10071 | 1150 |
"/ |
1151 |
"/ an alias (i.e. removing a compatibility name) |
|
1152 |
"/ |
|
1153 |
"/ check if there are more refs to it ... |
|
1154 |
[self includes:aClass] whileTrue:[ |
|
1155 |
actualName := self keyAtValue:aClass. |
|
1156 |
('Smalltalk [info]: ' , aClass name , ' is also registered under the name ' , actualName |
|
1157 |
, ' - remove that binding too.') infoPrintCR. |
|
1158 |
self at:actualName put:nil. |
|
1159 |
]. |
|
4724
44793fe70787
recompile ns classes after a class remove
Claus Gittinger <cg@exept.de>
parents:
4723
diff
changeset
|
1160 |
]. |
44793fe70787
recompile ns classes after a class remove
Claus Gittinger <cg@exept.de>
parents:
4723
diff
changeset
|
1161 |
|
4781 | 1162 |
ns ~~ Smalltalk ifTrue:[ |
10071 | 1163 |
ons notNil ifTrue:[ |
1164 |
ClassBuilder |
|
1165 |
recompileGlobalAccessorsTo:oldNameSym |
|
1166 |
in:ons |
|
1167 |
except:nil |
|
1168 |
]. |
|
1169 |
(ns notNil and:[ns ~~ ons]) ifTrue:[ |
|
1170 |
ClassBuilder |
|
1171 |
recompileGlobalAccessorsTo:oldNameSym |
|
1172 |
in:ns |
|
1173 |
except:nil |
|
1174 |
]. |
|
3627
452f2e1ff1b4
removeClass - care for aliases.
Claus Gittinger <cg@exept.de>
parents:
3626
diff
changeset
|
1175 |
]. |
452f2e1ff1b4
removeClass - care for aliases.
Claus Gittinger <cg@exept.de>
parents:
3626
diff
changeset
|
1176 |
|
452f2e1ff1b4
removeClass - care for aliases.
Claus Gittinger <cg@exept.de>
parents:
3626
diff
changeset
|
1177 |
"Modified: / 20.6.1998 / 13:26:10 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1178 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1179 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1180 |
renameClass:aClass to:newName |
7563 | 1181 |
"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
|
1182 |
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
|
1183 |
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
|
1184 |
|
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1185 |
|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
|
1186 |
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
|
1187 |
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
|
1188 |
oldMetaclass newMetaclass newCategory| |
5610
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1189 |
|
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1190 |
"/ check for all intermediate namespaces / owning classes |
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1191 |
i1 := 1. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1192 |
i2 := 1. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1193 |
ns := self. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1194 |
[i2 ~~ 0] whileTrue:[ |
10071 | 1195 |
i2 := newName indexOfSubCollection:'::' startingAt:i1. |
1196 |
i2 ~~ 0 ifTrue:[ |
|
1197 |
nm := newName copyFrom:i1 to:i2-1. |
|
1198 |
ns isNameSpace ifTrue:[ |
|
1199 |
subns := ns at:nm asSymbol ifAbsent:nil. |
|
1200 |
subns isNil ifTrue:[ |
|
1201 |
self error:'Nonexisting namespace: ',nm. |
|
1202 |
^ nil. |
|
1203 |
]. |
|
1204 |
] ifFalse:[ |
|
1205 |
subns := ns privateClassesAt:nm asSymbol. |
|
1206 |
subns isNil ifTrue:[ |
|
1207 |
self error:'Cannot create a namespace below a class' |
|
1208 |
] |
|
1209 |
]. |
|
1210 |
ns := subns. |
|
1211 |
i1 := i2 + 2. |
|
1212 |
]. |
|
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1213 |
]. |
617 | 1214 |
|
1215 |
oldName := aClass name. |
|
6734 | 1216 |
oldNameSpace := aClass topNameSpace. |
2319
640bb389f90a
recompile when moving classes across namespaces
Claus Gittinger <cg@exept.de>
parents:
2317
diff
changeset
|
1217 |
oldBaseName := aClass nameWithoutNameSpacePrefix. |
3698
8bce45214d24
fixed renaming of a private class (must recompile owner)
Claus Gittinger <cg@exept.de>
parents:
3678
diff
changeset
|
1218 |
oldBaseNameWithoutPrefix := aClass nameWithoutPrefix. |
617 | 1219 |
oldSym := oldName asSymbol. |
2485
9f4a11a4521f
new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents:
2476
diff
changeset
|
1220 |
privateClasses := aClass privateClassesSorted. |
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1221 |
|
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1222 |
((self at:oldSym) ~~ aClass) ifTrue:[ |
10071 | 1223 |
'Smalltalk [warning]: rename failed - name is different from key' errorPrintCR. |
1224 |
^ self |
|
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1225 |
]. |
617 | 1226 |
|
1525
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1227 |
"/ rename the class |
617 | 1228 |
|
1847
6e567214b167
care for className being a symbol, when renaming classes
Claus Gittinger <cg@exept.de>
parents:
1758
diff
changeset
|
1229 |
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
|
1230 |
|
5610
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1231 |
"/ change the owning class |
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1232 |
ns isNameSpace ifFalse:[ |
10071 | 1233 |
aClass isPrivate ifTrue:[ |
1234 |
aClass class setOwningClass:ns. |
|
1235 |
] ifFalse:[ |
|
1236 |
"/ sigh - must make a PrivateMetaclass from Metaclass |
|
1237 |
oldMetaclass := aClass class. |
|
1238 |
newMetaclass := PrivateMetaclass new. |
|
1239 |
newMetaclass flags:(oldMetaclass flags). |
|
1240 |
newMetaclass setSuperclass:(oldMetaclass superclass). |
|
1241 |
newMetaclass instSize:(oldMetaclass instSize). |
|
1242 |
newMetaclass setInstanceVariableString:(oldMetaclass instanceVariableString). |
|
1243 |
newMetaclass setMethodDictionary:(oldMetaclass methodDictionary). |
|
1244 |
newMetaclass setSoleInstance:aClass. |
|
1245 |
newMetaclass setOwningClass:ns. |
|
1246 |
||
1247 |
aClass changeClassTo:newMetaclass. |
|
1248 |
ObjectMemory flushCaches. |
|
1249 |
] |
|
5610
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1250 |
] ifTrue:[ |
10071 | 1251 |
aClass isPrivate ifTrue:[ |
1252 |
newCategory := aClass topOwningClass category. |
|
1253 |
||
1254 |
"/ sigh - must make a Metaclass from PrivateMetaclass |
|
1255 |
oldMetaclass := aClass class. |
|
1256 |
||
1257 |
newMetaclass := Metaclass new. |
|
1258 |
newMetaclass flags:(oldMetaclass flags). |
|
1259 |
newMetaclass setSuperclass:(oldMetaclass superclass). |
|
1260 |
newMetaclass instSize:(oldMetaclass instSize). |
|
1261 |
newMetaclass setInstanceVariableString:(oldMetaclass instanceVariableString). |
|
1262 |
newMetaclass setMethodDictionary:(oldMetaclass methodDictionary). |
|
1263 |
newMetaclass setSoleInstance:aClass. |
|
1264 |
||
1265 |
aClass category:newCategory. |
|
1266 |
aClass changeClassTo:newMetaclass. |
|
1267 |
ObjectMemory flushCaches. |
|
1268 |
] |
|
5610
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1269 |
]. |
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1270 |
|
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1271 |
aClass setName:newSym. |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1272 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1273 |
"/ store it in Smalltalk |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1274 |
self at:oldSym put:nil. |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1275 |
|
878
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1276 |
"/ |
1525
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1277 |
"/ 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
|
1278 |
"/ |
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1279 |
"/ self removeKey:oldSym. |
617 | 1280 |
self at:newSym put:aClass. |
1281 |
||
1525
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1282 |
"/ 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
|
1283 |
|
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1284 |
oldNameToNewName := IdentityDictionary new. |
617 | 1285 |
|
1286 |
names := aClass classVariableString asCollectionOfWords. |
|
1287 |
names do:[:name | |
|
10071 | 1288 |
oldCVSym := (oldSym , ':' , name) asSymbol. |
1289 |
value := self at:oldCVSym. |
|
1290 |
self at:oldCVSym put:nil. |
|
1291 |
||
1292 |
"/ |
|
1293 |
"/ see comment in #removeKey: on why we dont remove it it here |
|
1294 |
"/ |
|
1295 |
"/ self removeKey:cSym. |
|
1296 |
||
1297 |
newCVSym := (newSym , ':' , name) asSymbol. |
|
1298 |
self at:newCVSym put:value. |
|
1299 |
||
1300 |
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
|
1301 |
]. |
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1302 |
|
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1303 |
"/ 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
|
1304 |
|
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1305 |
oldNameToNewName keysAndValuesDo:[:oldNameSym :newNameSym | |
10071 | 1306 |
aClass withAllSubclasses do:[:aSubClass | |
1307 |
Transcript showCR:'changing global accesses from ''' , oldNameSym , ''' into ''' , newNameSym , ''' in class: ''' , aSubClass name , ''' ...'. |
|
1308 |
aSubClass instAndClassSelectorsAndMethodsDo:[:sel :aMethod | |
|
1309 |
aMethod changeLiteral:oldNameSym to:newNameSym |
|
1310 |
]. |
|
1311 |
]. |
|
1312 |
||
1313 |
"/ and also in privateClasses ? ... |
|
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1314 |
|
2485
9f4a11a4521f
new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents:
2476
diff
changeset
|
1315 |
"/ privateClasses size > 0 ifTrue:[ |
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1316 |
"/ privateClasses do:[:aPrivateClass | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1317 |
"/ aPrivateClass withAllSubclasses do:[:aSubClass | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1318 |
"/ aSubClass class methodDictionary do:[:aMethod | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1319 |
"/ aMethod changeLiteral:oldNameSym to:newNameSym |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1320 |
"/ ]. |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1321 |
"/ aSubClass methodDictionary do:[:aMethod | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1322 |
"/ aMethod changeLiteral:oldNameSym to:newNameSym |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1323 |
"/ ] |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1324 |
"/ ]. |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1325 |
"/ ] |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1326 |
"/ ] |
617 | 1327 |
]. |
1328 |
||
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1329 |
aClass addChangeRecordForClassRename:oldSym to:newSym. |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1330 |
|
5333
d80386e06d21
rename into other namespace did not work
Claus Gittinger <cg@exept.de>
parents:
5328
diff
changeset
|
1331 |
"/ 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
|
1332 |
aClass setEnvironment:nil. |
6734 | 1333 |
newNameSpace := aClass topNameSpace. |
2405
939f4e751ef3
dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents:
2379
diff
changeset
|
1334 |
|
2485
9f4a11a4521f
new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents:
2476
diff
changeset
|
1335 |
privateClasses size > 0 ifTrue:[ |
10071 | 1336 |
"/ must rename privateClasses as well |
1337 |
Class withoutUpdatingChangesDo:[ |
|
1338 |
privateClasses do:[:aPrivateClass | |
|
1339 |
self renameClass:aPrivateClass |
|
1340 |
to:(newSym , '::' , aPrivateClass nameWithoutPrefix). |
|
1341 |
||
1342 |
Transcript showCR:'recompiling methods in ''' , newNameSpace name , ''' accessing ''' , oldName , '::' , aPrivateClass nameWithoutPrefix , ''' ...'. |
|
1343 |
aClass theNonMetaclass recompileMethodsAccessingGlobal:(oldName , '::' , aPrivateClass nameWithoutPrefix) asSymbol. |
|
1344 |
aClass theMetaclass recompileMethodsAccessingGlobal:(oldName , '::' , aPrivateClass nameWithoutPrefix) asSymbol. |
|
1345 |
aClass theNonMetaclass recompileMethodsAccessingGlobal:(aPrivateClass nameWithoutPrefix) asSymbol. |
|
1346 |
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
|
1347 |
"/ ClassBuilder |
10071 | 1348 |
"/ recompileGlobalAccessorsTo:(oldName , '::' , aPrivateClass nameWithoutPrefix) asSymbol |
1349 |
"/ in:newNameSpace |
|
9822
38acd1c5eeab
recompile methods which access private classes when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
9819
diff
changeset
|
1350 |
"/ except:nil. |
10071 | 1351 |
] |
1352 |
] |
|
2405
939f4e751ef3
dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents:
2379
diff
changeset
|
1353 |
]. |
939f4e751ef3
dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents:
2379
diff
changeset
|
1354 |
|
2319
640bb389f90a
recompile when moving classes across namespaces
Claus Gittinger <cg@exept.de>
parents:
2317
diff
changeset
|
1355 |
oldNameSpace ~~ newNameSpace ifTrue:[ |
5246
2ca7b20c4108
create namespaces as requried, when renaming a class
Claus Gittinger <cg@exept.de>
parents:
5214
diff
changeset
|
1356 |
|
10071 | 1357 |
"/ all those referencing the class from the old nameSpace |
1358 |
"/ must be recompiled ... |
|
1359 |
"/ (to now access the global from smalltalk) |
|
1360 |
||
1361 |
oldNameSpace ~~ Smalltalk ifTrue:[ |
|
1362 |
Transcript showCR:'recompiling methods in ''' , oldNameSpace name , ''' accessing ''' , oldName , ''' ...'. |
|
1363 |
||
1364 |
ClassBuilder |
|
1365 |
recompileGlobalAccessorsTo:oldName asSymbol |
|
1366 |
in:oldNameSpace |
|
1367 |
except:nil. |
|
1368 |
]. |
|
1369 |
||
1370 |
"/ all referencing the class in the new namespace |
|
1371 |
"/ as well; to now access the new class. |
|
1372 |
||
1373 |
(newNameSpace notNil and:[newNameSpace ~~ Smalltalk]) ifTrue:[ |
|
1374 |
Transcript showCR:'recompiling methods in ''' , newNameSpace name , ''' accessing ''' , oldBaseName , ''' ...'. |
|
1375 |
||
1376 |
ClassBuilder |
|
1377 |
recompileGlobalAccessorsTo:oldBaseName asSymbol |
|
1378 |
in:newNameSpace |
|
1379 |
except:nil. |
|
1380 |
]. |
|
3698
8bce45214d24
fixed renaming of a private class (must recompile owner)
Claus Gittinger <cg@exept.de>
parents:
3678
diff
changeset
|
1381 |
] ifFalse:[ |
10071 | 1382 |
"/ all references to a global with my new name in my owning class |
1383 |
"/ must now be redirected to myself. |
|
1384 |
||
1385 |
aClass isPrivate ifTrue:[ |
|
1386 |
newBaseName := aClass nameWithoutNameSpacePrefix. |
|
1387 |
newBaseNameWithoutPrefix := aClass nameWithoutPrefix. |
|
1388 |
||
1389 |
Transcript showCR:'recompiling methods accessing ''' , oldBaseNameWithoutPrefix , ''' in: ''' , aClass owningClass name , ''' ...'. |
|
1390 |
aClass owningClass recompileMethodsAccessingGlobal:oldBaseNameWithoutPrefix. |
|
1391 |
aClass owningClass class recompileMethodsAccessingGlobal:oldBaseNameWithoutPrefix. |
|
1392 |
||
1393 |
Transcript showCR:'recompiling methods accessing ''' , oldBaseName , ''' in: ''' , aClass owningClass name , ''' ...'. |
|
1394 |
aClass owningClass recompileMethodsAccessingGlobal:oldBaseName. |
|
1395 |
aClass owningClass class recompileMethodsAccessingGlobal:oldBaseName. |
|
1396 |
||
1397 |
Transcript showCR:'recompiling methods accessing ''' , newBaseNameWithoutPrefix , ''' in: ''' , aClass owningClass name , ''' ...'. |
|
1398 |
aClass owningClass recompileMethodsAccessingGlobal:newBaseNameWithoutPrefix. |
|
1399 |
aClass owningClass class recompileMethodsAccessingGlobal:newBaseNameWithoutPrefix. |
|
1400 |
||
1401 |
Transcript showCR:'recompiling methods accessing ''' , newBaseName , ''' in: ''' , aClass owningClass name , ''' ...'. |
|
1402 |
aClass owningClass recompileMethodsAccessingGlobal:newBaseName. |
|
1403 |
aClass owningClass class recompileMethodsAccessingGlobal:newBaseName. |
|
1404 |
] |
|
4040
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1405 |
]. |
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1406 |
|
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1407 |
aClass changed:#definition. |
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1408 |
"/ 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
|
1409 |
aClass allSubclassesDo:[:subClass | |
10071 | 1410 |
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
|
1411 |
]. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1412 |
"/ 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
|
1413 |
aClass subclassesDo:[:subClass | |
10071 | 1414 |
subClass addChangeRecordForClass:subClass. |
4040
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1415 |
]. |
5613
b534e427f028
change message when renaming a class
Claus Gittinger <cg@exept.de>
parents:
5611
diff
changeset
|
1416 |
self changed:#definition. |
b534e427f028
change message when renaming a class
Claus Gittinger <cg@exept.de>
parents:
5611
diff
changeset
|
1417 |
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
|
1418 |
|
9822
38acd1c5eeab
recompile methods which access private classes when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
9819
diff
changeset
|
1419 |
"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
|
1420 |
"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
|
1421 |
"Modified: / 05-09-2006 / 12:52:25 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1422 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1423 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1424 |
!Smalltalk class methodsFor:'copying'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1425 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1426 |
deepCopy |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1427 |
"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
|
1428 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1429 |
^ self |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1430 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1431 |
"Modified: 18.5.1996 / 12:13:33 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1432 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1433 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1434 |
deepCopyUsing:aDictionary |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1435 |
"return a deep copy of the receiver. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1436 |
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
|
1437 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1438 |
^ self |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1439 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1440 |
"Modified: 18.5.1996 / 12:13:36 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1441 |
! |
453 | 1442 |
|
7563 | 1443 |
shallowCopy |
1444 |
"redefined to return self - there is only one Smalltalk dictionary" |
|
617 | 1445 |
|
1446 |
^ self |
|
1410 | 1447 |
|
1448 |
"Modified: 18.5.1996 / 12:13:39 / cg" |
|
617 | 1449 |
! |
1450 |
||
7563 | 1451 |
simpleDeepCopy |
1452 |
"redefined to return self - there is only one Smalltalk dictionary" |
|
453 | 1453 |
|
1454 |
^ self |
|
1410 | 1455 |
|
1456 |
"Modified: 18.5.1996 / 12:13:42 / cg" |
|
453 | 1457 |
! ! |
1458 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1459 |
!Smalltalk class methodsFor:'debugging ST/X'! |
453 | 1460 |
|
7563 | 1461 |
compileTrace:aBoolean |
1462 |
"dump generated inline code (NOOP if VM was compiled without the trace-debug option)" |
|
7325 | 1463 |
%{ |
1464 |
extern char __compileTrace__; |
|
1465 |
||
1466 |
__compileTrace__ = (aBoolean == true) ? 1 : 0; |
|
1467 |
%} |
|
1468 |
" |
|
1469 |
Smalltalk compileTrace:true |
|
1470 |
Smalltalk compileTrace:false |
|
1471 |
" |
|
1472 |
! |
|
1473 |
||
7563 | 1474 |
debugBreakPoint |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1475 |
"{ Pragma: +optSpace }" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1476 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1477 |
"call the dummy debug function, on which a breakpoint |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1478 |
can be put in adb, sdb, dbx or gdb. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1479 |
WARNING: this method is for debugging only |
10071 | 1480 |
it will be removed without notice." |
453 | 1481 |
%{ |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1482 |
__PATCHUPCONTEXTS(__context); |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1483 |
__debugBreakPoint__(); |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1484 |
%}. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1485 |
^ self |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1486 |
! |
453 | 1487 |
|
7563 | 1488 |
exitWithCoreDump |
1489 |
"{ Pragma: +optSpace }" |
|
1490 |
||
1491 |
"abort program and dump core" |
|
1492 |
||
1493 |
OperatingSystem exitWithCoreDump |
|
4096
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1494 |
"/ never returns |
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1495 |
|
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1496 |
"Be careful evaluating this |
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1497 |
Smalltalk exitWithCoreDump |
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1498 |
" |
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1499 |
|
617 | 1500 |
! |
1501 |
||
7563 | 1502 |
fatalAbort |
1503 |
"{ Pragma: +optSpace }" |
|
1504 |
||
1505 |
"report a fatal-error, print a stack backtrace and exit with core dump. |
|
617 | 1506 |
(You may turn off the stack print with debugPrinting:false)" |
1507 |
%{ |
|
1508 |
__fatal0(__context, "fatalAbort"); |
|
1509 |
/* NEVER RETURNS */ |
|
5410 | 1510 |
%}. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1511 |
^ self primitiveFailed |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1512 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1513 |
! |
617 | 1514 |
|
7563 | 1515 |
fatalAbort:aMessage |
1516 |
"{ Pragma: +optSpace }" |
|
1517 |
||
1518 |
"report a fatal-error; print a stack backtrace and exit with core dump |
|
617 | 1519 |
(You may turn off the stack print with debugPrinting:false)" |
1520 |
||
1521 |
%{ |
|
1522 |
char *msg; |
|
1523 |
||
1524 |
if (__isString(aMessage)) |
|
10071 | 1525 |
msg = (char *) __stringVal(aMessage); |
617 | 1526 |
else |
10071 | 1527 |
msg = "fatalAbort"; |
617 | 1528 |
|
1529 |
__fatal0(__context, msg); |
|
1530 |
/* NEVER RETURNS */ |
|
5410 | 1531 |
%}. |
1532 |
^ self primitiveFailed |
|
1533 |
||
5441 | 1534 |
! |
1535 |
||
7563 | 1536 |
vmInstructionTrace:aBoolean |
1537 |
||
1538 |
||
1539 |
! ! |
|
1540 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1541 |
!Smalltalk class methodsFor:'enumerating'! |
7563 | 1542 |
|
453 | 1543 |
allBehaviorsDo:aBlock |
5580
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1544 |
"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
|
1545 |
|
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1546 |
self allClassesAndMetaclassesDo:aBlock |
453 | 1547 |
|
1548 |
" |
|
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
1549 |
Smalltalk allBehaviorsDo:[:aClass | aClass name printCR] |
453 | 1550 |
" |
7563 | 1551 |
! |
1552 |
||
1553 |
allClassCategories |
|
1554 |
"return a set of all class categories in the system" |
|
1555 |
||
1556 |
|allCategories| |
|
6217
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1557 |
|
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1558 |
allCategories := Set new. |
7124
da253fd03ba1
Do not sort categories in #allClassCategories.
Stefan Vogel <sv@exept.de>
parents:
7105
diff
changeset
|
1559 |
Smalltalk allClassesDo:[:cls | |category| |
10071 | 1560 |
category := cls category. |
1561 |
category notNil ifTrue:[ |
|
1562 |
allCategories add:category. |
|
1563 |
]. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1564 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1565 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1566 |
^ allCategories. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1567 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1568 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1569 |
Smalltalk allClassCategories |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1570 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1571 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1572 |
"Created: / 17.11.2001 / 12:13:09 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1573 |
! |
6217
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1574 |
|
7563 | 1575 |
allClassesAndMetaclassesDo:aBlock |
1576 |
"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
|
1577 |
|
5940
804fb27727a6
oops - allClassesAndMetaclassesDo: evaluated block twice for
Claus Gittinger <cg@exept.de>
parents:
5916
diff
changeset
|
1578 |
|already| |
804fb27727a6
oops - allClassesAndMetaclassesDo: evaluated block twice for
Claus Gittinger <cg@exept.de>
parents:
5916
diff
changeset
|
1579 |
|
9259 | 1580 |
already := IdentitySet new:NumberOfClassesHint*3. |
5940
804fb27727a6
oops - allClassesAndMetaclassesDo: evaluated block twice for
Claus Gittinger <cg@exept.de>
parents:
5916
diff
changeset
|
1581 |
self allClassesDo:[:eachClass | |cls| |
10071 | 1582 |
cls := eachClass theNonMetaclass. |
1583 |
(already includes:cls) ifFalse:[ |
|
1584 |
aBlock value:cls. |
|
1585 |
already add:cls. |
|
1586 |
]. |
|
1587 |
cls := cls class. |
|
1588 |
(already includes:cls) ifFalse:[ |
|
1589 |
aBlock value:cls. |
|
1590 |
already add:cls. |
|
1591 |
]. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1592 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1593 |
! |
5579
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1594 |
|
7563 | 1595 |
allClassesDo:aBlock |
1596 |
"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
|
1597 |
|
5765 | 1598 |
self allClasses do:aBlock |
453 | 1599 |
|
1600 |
" |
|
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
1601 |
Smalltalk allClassesDo:[:aClass | aClass name printCR] |
453 | 1602 |
" |
1603 |
! |
|
1604 |
||
9506 | 1605 |
allClassesForWhich:filter |
10071 | 1606 |
"return a collection with all classes in the system, |
9506 | 1607 |
for which filter evaluates to true." |
1608 |
||
1609 |
|collectedClasses| |
|
1610 |
||
1611 |
collectedClasses := OrderedCollection new. |
|
1612 |
self allClassesForWhich:filter do:[:cls | |
|
10071 | 1613 |
collectedClasses add:cls |
9506 | 1614 |
]. |
1615 |
^ collectedClasses |
|
1616 |
||
1617 |
" |
|
10071 | 1618 |
Smalltalk |
1619 |
allClassesForWhich:[:cls | cls name startsWith:'Po'] |
|
9506 | 1620 |
" |
1621 |
||
1622 |
"Created: / 10-08-2006 / 12:11:31 / cg" |
|
1623 |
! |
|
1624 |
||
9292 | 1625 |
allClassesForWhich:filter do:aBlock |
1626 |
"evaluate the argument, aBlock for all classes in the system, for which filter evaluates to true." |
|
1627 |
||
1628 |
self allClassesDo:[:cls | |
|
10071 | 1629 |
(filter value:cls) ifTrue:[ aBlock value:cls ]. |
1630 |
]. |
|
1631 |
||
1632 |
" |
|
1633 |
Smalltalk |
|
1634 |
allClassesForWhich:[:cls | cls name startsWith:'Po'] |
|
1635 |
do:[:aClass | Transcript showCR:aClass name] |
|
9292 | 1636 |
" |
1637 |
! |
|
1638 |
||
7563 | 1639 |
allClassesInCategory:aCategory |
1640 |
"return a collection of for all classes in aCategory; |
|
1299 | 1641 |
The order of the classes is not defined." |
1642 |
||
9506 | 1643 |
^ self allClassesForWhich:[:cls | cls category = aCategory] |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1644 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1645 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1646 |
Smalltalk allClassesInCategory:'Views-Basic' |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1647 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1648 |
|
9506 | 1649 |
"Modified: / 10-08-2006 / 12:13:32 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1650 |
! |
1299 | 1651 |
|
7563 | 1652 |
allClassesInCategory:aCategory do:aBlock |
1653 |
"evaluate the argument, aBlock for all classes in the aCategory; |
|
453 | 1654 |
The order of the classes is not defined." |
1655 |
||
1656 |
aCategory notNil ifTrue:[ |
|
10071 | 1657 |
self allClassesForWhich:[:cls | cls category = aCategory] do:aBlock |
453 | 1658 |
] |
1659 |
||
1660 |
" |
|
9490 | 1661 |
Smalltalk allClassesInCategory:'Views-Basic' do:[:aClass | Transcript showCR:aClass] |
1662 |
" |
|
1663 |
||
1664 |
"Modified: / 09-08-2006 / 17:18:50 / fm" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1665 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1666 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1667 |
allClassesInCategory:aCategory inOrderDo:aBlock |
7563 | 1668 |
"evaluate the argument, aBlock for all classes in aCategory; |
453 | 1669 |
superclasses come first - then subclasses" |
1670 |
||
1671 |
|classes| |
|
1672 |
||
1673 |
aCategory notNil ifTrue:[ |
|
10071 | 1674 |
classes := OrderedCollection new. |
1675 |
self allClassesInCategory:aCategory do:[:aClass | |
|
1676 |
classes add:aClass |
|
1677 |
]. |
|
1678 |
classes topologicalSort:[:a :b | b isSubclassOf:a]. |
|
1679 |
classes do:aBlock |
|
453 | 1680 |
] |
1681 |
||
1682 |
" |
|
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
1683 |
Smalltalk allClassesInCategory:'Views-Basic' inOrderDo:[:aClass | aClass name printCR] |
453 | 1684 |
" |
6217
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1685 |
|
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1686 |
"Modified: / 17.11.2001 / 12:18:15 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1687 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1688 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1689 |
allClassesInOrderDo:aBlock |
7563 | 1690 |
"evaluate the argument, aBlock for all classes in the system; |
5406 | 1691 |
Evaluation order is by inheritance: superclasses come first." |
1692 |
||
1693 |
|already| |
|
1694 |
||
8964
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
1695 |
already := IdentitySet new:NumberOfClassesHint. |
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
1696 |
self allClassesDo:[:eachClass | |
10071 | 1697 |
(already includes:eachClass) ifFalse:[ |
1698 |
eachClass allSuperclasses reverseDo:[:eachSuperClass | |
|
1699 |
(already includes:eachSuperClass) ifFalse:[ |
|
1700 |
already add:eachSuperClass. |
|
1701 |
aBlock value:eachSuperClass. |
|
1702 |
]. |
|
1703 |
]. |
|
1704 |
already add:eachClass. |
|
1705 |
aBlock value:eachClass. |
|
1706 |
] |
|
8964
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
1707 |
]. |
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
1708 |
|
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
1709 |
" |
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
1710 |
Smalltalk allClassesInOrderDo:[:aClass | Transcript showCR:aClass name] |
5406 | 1711 |
" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1712 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1713 |
|
9506 | 1714 |
allClassesInPackage:aPackageID |
1715 |
"evaluate the argument, aBlock for all classes a package; |
|
1716 |
The order of the classes is not defined." |
|
1717 |
||
1718 |
^ self allClassesForWhich:[:cls | cls package = aPackageID] |
|
1719 |
||
1720 |
" |
|
10071 | 1721 |
Smalltalk allClassesInPackage:'bosch:dapasx' |
9506 | 1722 |
" |
1723 |
||
1724 |
"Created: / 10-08-2006 / 12:14:10 / cg" |
|
9512 | 1725 |
"Modified: / 10-08-2006 / 13:45:43 / cg" |
9506 | 1726 |
! |
1727 |
||
9490 | 1728 |
allClassesInPackage:aPackageID do:aBlock |
1729 |
"evaluate the argument, aBlock for all classes a package; |
|
1730 |
The order of the classes is not defined." |
|
1731 |
||
1732 |
^ self allClassesForWhich:[:cls | cls package = aPackageID] do:aBlock |
|
1733 |
||
1734 |
" |
|
10071 | 1735 |
Smalltalk allClassesInPackage:'bosch:dapasx' do:[:aClass | Transcript showCR:aClass] |
9490 | 1736 |
" |
1737 |
||
1738 |
"Created: / 09-08-2006 / 17:14:17 / fm" |
|
1739 |
! |
|
1740 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1741 |
allKeysDo:aBlock |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1742 |
"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
|
1743 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1744 |
^ self keysDo:aBlock |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1745 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1746 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1747 |
allMethodCategories |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1748 |
"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
|
1749 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1750 |
|allCategories| |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1751 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1752 |
allCategories := Set new. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1753 |
Smalltalk allClassesDo:[:cls | |
10071 | 1754 |
allCategories addAll:cls categories. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1755 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1756 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1757 |
^ allCategories. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1758 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1759 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1760 |
Smalltalk allMethodCategories |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1761 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1762 |
! |
6722
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
1763 |
|
9259 | 1764 |
allMethodsDo:aBlock |
1765 |
Smalltalk allClassesDo:[:eachClass | |
|
10071 | 1766 |
eachClass instAndClassSelectorsAndMethodsDo:[:sel :mthd | |
1767 |
aBlock value:mthd |
|
1768 |
] |
|
9259 | 1769 |
]. |
1770 |
! |
|
1771 |
||
7563 | 1772 |
associationsDo:aBlock |
10071 | 1773 |
"evaluate the argument, aBlock for all key/value pairs |
617 | 1774 |
in the Smalltalk dictionary" |
1775 |
||
1776 |
self keysDo:[:aKey | |
|
10071 | 1777 |
aBlock value:(aKey -> (self at:aKey)) |
617 | 1778 |
] |
1779 |
||
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
1780 |
"Smalltalk associationsDo:[:assoc | assoc printCR]" |
617 | 1781 |
! |
1782 |
||
7563 | 1783 |
basicKeys |
1784 |
"for rel > 5 only" |
|
1785 |
||
1786 |
self primitiveFailed |
|
1787 |
||
1788 |
||
1789 |
||
1790 |
||
1791 |
||
1792 |
||
1793 |
! |
|
1794 |
||
1795 |
do:aBlock |
|
1796 |
"evaluate the argument, aBlock for all values in the Smalltalk dictionary" |
|
617 | 1797 |
|
1798 |
|work| |
|
1799 |
||
1800 |
%{ /* 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
|
1801 |
__GLOBALS_DO(&aBlock, &work); |
5406 | 1802 |
RETURN (self); |
1803 |
%}. |
|
1804 |
self keysDo:[:aKey | |
|
10071 | 1805 |
aBlock value:(self at:aKey) |
5406 | 1806 |
] |
617 | 1807 |
! |
1808 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1809 |
keysAndValuesDo:aBlock |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1810 |
"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
|
1811 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1812 |
self keysDo:[:aKey | |
10071 | 1813 |
aBlock value:aKey value:(self at:aKey) |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1814 |
] |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1815 |
! |
617 | 1816 |
|
9077
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
1817 |
keysAndValuesSelect:selectBlockWith2Args thenCollect:collectBlockWith2Args |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
1818 |
|collected| |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
1819 |
|
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
1820 |
collected := OrderedCollection new. |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
1821 |
self keysAndValuesDo:[:eachKey :eachValue | |
10071 | 1822 |
(selectBlockWith2Args value:eachKey value:eachValue) ifTrue:[ |
1823 |
collected add:(collectBlockWith2Args value:eachKey value:eachValue) |
|
1824 |
]. |
|
9077
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
1825 |
]. |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
1826 |
^ collected |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
1827 |
|
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
1828 |
" |
10071 | 1829 |
Smalltalk |
1830 |
keysAndValuesSelect:[:nm :val | (nm startsWith:'Ab') and:[val notNil]] |
|
1831 |
thenCollect:[:nm :val | nm] |
|
9077
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
1832 |
" |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
1833 |
! |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
1834 |
|
7563 | 1835 |
keysDo:aBlock |
1836 |
"evaluate the argument, aBlock for all keys in the Smalltalk dictionary" |
|
617 | 1837 |
|work| |
1838 |
||
1839 |
%{ /* 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
|
1840 |
__GLOBALKEYS_DO(&aBlock, &work); |
5406 | 1841 |
RETURN (self); |
1842 |
%}. |
|
1843 |
self basicKeys do:[:aKey | |
|
10071 | 1844 |
aBlock value:aKey |
5406 | 1845 |
] |
453 | 1846 |
! ! |
1847 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1848 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1849 |
!Smalltalk class methodsFor:'message control'! |
453 | 1850 |
|
7563 | 1851 |
silentLoading |
1852 |
"returns the Silentloading class variable." |
|
1853 |
||
1854 |
^ SilentLoading |
|
1855 |
! |
|
1856 |
||
1857 |
silentLoading:aBoolean |
|
1858 |
"{ Pragma: +optSpace }" |
|
1859 |
||
1860 |
"allows access to the Silentloading class variable, which controls |
|
453 | 1861 |
messages from all kinds of system onto the transcript. |
1862 |
You can save a snapshot with this flag set to true, which makes |
|
1863 |
the image come up silent. Can also be set, to read in files unlogged." |
|
1864 |
||
1865 |
|prev| |
|
1866 |
||
1867 |
prev := SilentLoading. |
|
1868 |
SilentLoading := aBoolean. |
|
1869 |
^ prev |
|
1870 |
! ! |
|
1871 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1872 |
!Smalltalk class methodsFor:'misc accessing'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1873 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1874 |
beHeadless:aBoolean |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1875 |
"set/clear the headlessOperation flag." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1876 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1877 |
HeadlessOperation := aBoolean |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1878 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1879 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1880 |
standAloneApp:aBoolean |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1881 |
"set/clear the StandAlone flag." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1882 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1883 |
StandAlone := aBoolean |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1884 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1885 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1886 |
!Smalltalk class methodsFor:'misc stuff'! |
7563 | 1887 |
|
1888 |
addExitBlock:aBlock |
|
1889 |
"{ Pragma: +optSpace }" |
|
1890 |
||
1891 |
"add a block to be executed when Smalltalk finishes. |
|
617 | 1892 |
This feature is currently not used anywhere - but could be useful for |
1893 |
cleanup in stand alone applications." |
|
1894 |
||
1895 |
ExitBlocks isNil ifTrue:[ |
|
10071 | 1896 |
ExitBlocks := OrderedCollection with:aBlock |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1897 |
] ifFalse:[ |
10071 | 1898 |
ExitBlocks add:aBlock |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1899 |
] |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1900 |
! |
617 | 1901 |
|
7563 | 1902 |
addImageStartBlock:aBlock |
1903 |
"{ Pragma: +optSpace }" |
|
1904 |
||
1905 |
"add a blocks to be executed in a separate process after |
|
10071 | 1906 |
everything has been initialized. |
2681 | 1907 |
These blocks will be executed after an image restart." |
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1908 |
|
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1909 |
ImageStartBlocks isNil ifTrue:[ |
10071 | 1910 |
ImageStartBlocks := OrderedCollection with:aBlock |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1911 |
] ifFalse:[ |
10071 | 1912 |
ImageStartBlocks add:aBlock |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1913 |
] |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1914 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1915 |
"Created: 9.9.1996 / 16:48:20 / stefan" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1916 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1917 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1918 |
addStartBlock:aBlock |
7563 | 1919 |
"{ Pragma: +optSpace }" |
1920 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1921 |
"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
|
1922 |
everything has been initialized. These blocks will |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1923 |
be deleted after execution and therefore not be |
10071 | 1924 |
executed after an image restart. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1925 |
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
|
1926 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1927 |
StartBlocks isNil ifTrue:[ |
10071 | 1928 |
StartBlocks := OrderedCollection with:aBlock |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1929 |
] ifFalse:[ |
10071 | 1930 |
StartBlocks add:aBlock |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1931 |
] |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1932 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1933 |
"Created: 9.9.1996 / 16:46:53 / stefan" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1934 |
! |
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
1935 |
|
7563 | 1936 |
exit |
1937 |
"{ Pragma: +optSpace }" |
|
1938 |
||
1939 |
"finish the Smalltalk system" |
|
1940 |
||
8803 | 1941 |
self exit:0 |
1942 |
"not reached" |
|
1943 |
||
1944 |
"Be careful evaluating this |
|
1945 |
Smalltalk exit |
|
1946 |
" |
|
1947 |
! |
|
1948 |
||
1949 |
exit:statusInteger |
|
1950 |
"{ Pragma: +optSpace }" |
|
1951 |
||
1952 |
"finish the Smalltalk system" |
|
1953 |
||
7563 | 1954 |
ObjectMemory changed:#aboutToExit. "/ for ST/X backward compatibility |
453 | 1955 |
ObjectMemory changed:#aboutToQuit. "/ for ST-80 compatibility |
1956 |
ExitBlocks notNil ifTrue:[ |
|
10071 | 1957 |
ExitBlocks do:[:aBlock | |
1958 |
aBlock value |
|
1959 |
] |
|
8803 | 1960 |
]. |
1961 |
OperatingSystem exit:statusInteger |
|
1962 |
"not reached" |
|
4096
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1963 |
|
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1964 |
"Be careful evaluating this |
8803 | 1965 |
Smalltalk exit:1 |
453 | 1966 |
" |
1967 |
! ! |
|
1968 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1969 |
!Smalltalk class methodsFor:'queries'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1970 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1971 |
allClasses |
7563 | 1972 |
"return an unordered collection of all classes in the system. |
10071 | 1973 |
Only globally anchored classes are returned |
453 | 1974 |
(i.e. anonymous ones have to be aquired by Behavior allSubInstances)" |
1975 |
||
1976 |
|classes| |
|
1977 |
||
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
1978 |
"/ you may wonder, what this while is for, here ... |
453 | 1979 |
"/ the reason is that if we modify the class hierarchy in |
4067 | 1980 |
"/ another view (background fileIn), while building up the |
453 | 1981 |
"/ cachedClasses set, this may be flushed (invalidated) by the |
1982 |
"/ other process in the meanwhile. |
|
1983 |
"/ If that happens, we restart the set-building here |
|
1984 |
"/ |
|
1985 |
[(classes := CachedClasses) isNil] whileTrue:[ |
|
10071 | 1986 |
CachedClasses := classes := IdentitySet new:NumberOfClassesHint. |
1987 |
self keysAndValuesDo:[:eachName :eachGlobal | |
|
1988 |
(eachGlobal notNil and:[eachGlobal isBehavior]) ifTrue:[ |
|
1989 |
"/ sigh - would like to skip over aliases |
|
1990 |
"/ but this cannot be done simply by comparing |
|
1991 |
"/ the classes name against the store-key |
|
1992 |
"/ i.e. cannot do: |
|
1993 |
"/ anObject name == sym ifTrue:[ |
|
1994 |
"/ classes add:anObject |
|
1995 |
"/ ] |
|
1996 |
"/ because that would lead to ignore all java |
|
1997 |
"/ classes, which are stored under a different |
|
1998 |
"/ key. |
|
1999 |
||
2000 |
(eachGlobal name == eachName |
|
2001 |
or:[eachGlobal isJavaClass]) ifTrue:[ |
|
2002 |
classes add:eachGlobal |
|
2003 |
]. |
|
2004 |
] |
|
2005 |
]. |
|
2006 |
NumberOfClassesHint := classes size. |
|
453 | 2007 |
]. |
2008 |
^ classes |
|
2009 |
||
8964
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
2010 |
" |
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
2011 |
CachedClasses := nil. |
453 | 2012 |
Smalltalk allClasses |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2013 |
|
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2014 |
to get the list sorted by name: |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2015 |
|
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2016 |
Smalltalk allClasses asSortedCollection:[:a :b | a name < b name] |
453 | 2017 |
" |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2018 |
|
5278 | 2019 |
"Modified: / 23.2.2000 / 10:49:46 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2020 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2021 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2022 |
allClassesAndMetaclasses |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2023 |
"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
|
2024 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2025 |
|classes| |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2026 |
|
8964
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
2027 |
classes := IdentitySet new:NumberOfClassesHint*2. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2028 |
self allClassesDo:[:eachClass | |
10071 | 2029 |
classes add:(eachClass theNonMetaclass). |
2030 |
classes add:(eachClass theMetaclass). |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2031 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2032 |
^ classes |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2033 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2034 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2035 |
allClassesWithAllPrivateClasses |
7563 | 2036 |
"return an unordered collection of all classes in the Smalltalk namespace. |
10071 | 2037 |
Only globally anchored classes are returned |
4642 | 2038 |
(i.e. anonymous ones have to be aquired by Behavior allSubInstances)" |
2039 |
||
10071 | 2040 |
^ self allClasses select:[:aClass | |
2041 |
|owner| |
|
2042 |
||
2043 |
(aClass isNameSpace not or:[aClass == Smalltalk]) |
|
2044 |
and:[ |
|
2045 |
owner := aClass topOwningClass. |
|
2046 |
(owner ? aClass) nameSpace == Smalltalk |
|
2047 |
] |
|
4642 | 2048 |
] |
2049 |
||
2050 |
" |
|
2051 |
Smalltalk allClassesWithAllPrivateClasses |
|
2052 |
" |
|
2053 |
! |
|
2054 |
||
9227 | 2055 |
allImplementorsOf:aSelector |
2056 |
|implementors| |
|
2057 |
||
2058 |
implementors := OrderedCollection new. |
|
2059 |
self allClassesDo:[:cls | |
|
10071 | 2060 |
(cls includesSelector:aSelector) ifTrue:[ |
2061 |
implementors add:cls. |
|
2062 |
]. |
|
2063 |
(cls class includesSelector:aSelector) ifTrue:[ |
|
2064 |
implementors add:cls class. |
|
2065 |
]. |
|
9227 | 2066 |
]. |
2067 |
^ implementors |
|
2068 |
||
2069 |
" |
|
10071 | 2070 |
Smalltalk allImplementorsOf:#isNil |
2071 |
(Smalltalk allImplementorsOf:#add:) size |
|
9227 | 2072 |
" |
2073 |
! |
|
2074 |
||
9254 | 2075 |
allProjectIDs |
2076 |
|allProjects| |
|
2077 |
||
2078 |
allProjects := Set new. |
|
2079 |
self allClassesDo:[:eachClass | |
|
10071 | 2080 |
|cls pkg| |
2081 |
||
2082 |
cls := eachClass theNonMetaclass. |
|
2083 |
||
2084 |
pkg := cls package. |
|
2085 |
pkg "withoutSeparators" size > 0 ifTrue:[ |
|
2086 |
allProjects add:pkg. |
|
2087 |
] ifFalse:[ |
|
2088 |
"/ for now, nameSpaces are not in any package; |
|
2089 |
"/ this might change. Then, 0-sized packages are |
|
2090 |
"/ illegal, and the following should be enabled. |
|
2091 |
"/ self halt |
|
2092 |
]. |
|
2093 |
cls isJavaClass ifFalse:[ |
|
2094 |
cls instAndClassSelectorsAndMethodsDo:[:sel :mthd | |
|
2095 |
allProjects add:mthd package asSymbol. |
|
2096 |
]. |
|
2097 |
]. |
|
9254 | 2098 |
]. |
2099 |
allProjects := allProjects asOrderedCollection sort. |
|
2100 |
^ allProjects |
|
2101 |
||
2102 |
" |
|
2103 |
Smalltalk allProjectIDs |
|
2104 |
" |
|
2105 |
! |
|
2106 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2107 |
cellAt:aName |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2108 |
"{ Pragma: +optSpace }" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2109 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2110 |
"return the address of a global cell |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2111 |
- used internally for compiler only" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2112 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2113 |
%{ /* NOCONTEXT */ |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2114 |
RETURN ( __GLOBAL_GETCELL(aName) ); |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2115 |
%}. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2116 |
^ self primitiveFailed |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2117 |
|
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 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2120 |
classCategoryCompletion:aPartialCategory |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2121 |
"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
|
2122 |
2 entries: 1st: the best (longest) match |
10071 | 2123 |
2nd: collection consisting of matching categories" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2124 |
|
9508 | 2125 |
^ DoWhatIMeanSupport classCategoryCompletion:aPartialCategory inEnvironment:self |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2126 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2127 |
" |
10071 | 2128 |
Smalltalk classCategoryCompletion:'Sys' |
2129 |
Smalltalk classCategoryCompletion:'System' |
|
2130 |
Smalltalk classCategoryCompletion:'System-BinaryStorage' |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2131 |
" |
9508 | 2132 |
|
2133 |
"Modified: / 10-08-2006 / 13:06:34 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2134 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2135 |
|
8570 | 2136 |
classNamed:aString |
2137 |
"return the class with name aString, or nil if absent. |
|
2138 |
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
|
2139 |
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
|
2140 |
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
|
2141 |
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
|
2142 |
|
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
2143 |
|cls sym nonMeta idx prefix rest namespace| |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
2144 |
|
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
2145 |
"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
|
2146 |
But be careful, to not invent new symbols ..." |
453 | 2147 |
sym := aString asSymbolIfInterned. |
2148 |
sym notNil ifTrue:[ |
|
10071 | 2149 |
cls := self at:sym ifAbsent:nil. |
2150 |
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
|
2151 |
]. |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
2152 |
|
1480
df0bea6285f8
Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
2153 |
(aString endsWith:' class') ifTrue:[ |
10071 | 2154 |
nonMeta := self classNamed:(aString copyWithoutLast:6). |
2155 |
nonMeta notNil ifTrue:[ |
|
2156 |
^ nonMeta theMetaclass |
|
2157 |
]. |
|
9374
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
2158 |
]. |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
2159 |
|
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
2160 |
"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
|
2161 |
cls isNil ifTrue:[ |
10071 | 2162 |
idx := aString indexOfSubCollection:'::'. |
2163 |
idx ~~ 0 ifTrue:[ |
|
2164 |
prefix := aString copyTo:idx-1. |
|
2165 |
rest := aString copyFrom:idx+2. |
|
2166 |
namespace := self at:prefix asSymbolIfInterned ifAbsent:nil. |
|
2167 |
"namespace may be the owner of a private class. |
|
2168 |
NameSpaces and Behaviors have the same protocol" |
|
2169 |
[namespace isBehavior] whileTrue:[ |
|
2170 |
idx := rest indexOfSubCollection:'::'. |
|
2171 |
idx ~~ 0 ifTrue:[ |
|
2172 |
prefix := rest copyTo:idx-1. |
|
2173 |
rest := rest copyFrom:idx+2. |
|
2174 |
"this does an implicit autoload if required" |
|
2175 |
namespace := namespace privateClassesAt:prefix. |
|
2176 |
] ifFalse:[ |
|
2177 |
namespace isLoaded ifTrue:[ |
|
2178 |
cls := namespace privateClassesAt:rest. |
|
2179 |
cls isBehavior ifTrue:[^ cls]. |
|
2180 |
]. |
|
2181 |
namespace := nil. "force exit of loop" |
|
2182 |
]. |
|
2183 |
]. |
|
2184 |
]. |
|
9374
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
2185 |
]. |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
2186 |
|
453 | 2187 |
^ nil |
2188 |
||
2189 |
" |
|
10071 | 2190 |
Smalltalk classNamed:'Object' |
2191 |
Smalltalk classNamed:'Authentication::BasicAuthenticator::BasicAuthenticationData' |
|
2192 |
Smalltalk classNamed:'Authentication::BasicAuthenticator::BasicAuthenticationData class' |
|
2193 |
Smalltalk classNamed:'Authentication::BasicAuthenticator' |
|
2194 |
Smalltalk classNamed:'fooBar' |
|
2195 |
Smalltalk classNamed:'true' |
|
2196 |
Smalltalk classNamed:'Object class' |
|
2197 |
Smalltalk classNamed:'Metaclass' |
|
2198 |
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
|
2199 |
Smalltalk classNamed:'Array class' |
453 | 2200 |
" |
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2201 |
|
9468 | 2202 |
"Created: / 24-11-1995 / 17:30:22 / cg" |
2203 |
"Modified: / 19-06-1996 / 14:22:21 / stefan" |
|
2204 |
"Modified: / 03-08-2006 / 14:01:06 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2205 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2206 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2207 |
classNames |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2208 |
"return a collection of all classNames in the system" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2209 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2210 |
^ self allClasses collect:[:aClass | aClass name] |
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 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2213 |
Smalltalk classNames |
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 |
! |
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 |
classnameCompletion:aPartialClassName |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2218 |
"given a partial classname, return an array consisting of |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2219 |
2 entries: 1st: the best (longest) match |
10071 | 2220 |
2nd: collection consisting of matching names" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2221 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2222 |
^ DoWhatIMeanSupport classnameCompletion:aPartialClassName inEnvironment:self |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2223 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2224 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2225 |
classnameCompletion:aPartialClassName inEnvironment:anEnvironment |
7563 | 2226 |
"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
|
2227 |
2 entries: 1st: the best (longest) match |
10071 | 2228 |
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
|
2229 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2230 |
^ DoWhatIMeanSupport classnameCompletion:aPartialClassName inEnvironment:anEnvironment |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2231 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2232 |
" |
10071 | 2233 |
Smalltalk classnameCompletion:'Arr' |
2234 |
Smalltalk classnameCompletion:'Arra' |
|
2235 |
Smalltalk classnameCompletion:'arra' |
|
2236 |
Smalltalk classnameCompletion:'*rray' |
|
2237 |
||
2238 |
Smalltalk classnameCompletion:'Arr cl' |
|
2239 |
Smalltalk classnameCompletion:'*rray cl' |
|
453 | 2240 |
" |
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2241 |
|
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2242 |
"Created: 24.11.1995 / 17:24:45 / cg" |
2523
04db1fd74e0d
try ignoring case in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
2514
diff
changeset
|
2243 |
"Modified: 3.4.1997 / 18:25:01 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2244 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2245 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2246 |
defaultNameSpace |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2247 |
"return the default namespace, where new classes are installed, |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2248 |
if NO special nameSpace handler is present" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2249 |
|
9562
7d36dbb02bb3
code cleanup - remove old obsolete Project code
Claus Gittinger <cg@exept.de>
parents:
9550
diff
changeset
|
2250 |
^ Project defaultNameSpace. |
7d36dbb02bb3
code cleanup - remove old obsolete Project code
Claus Gittinger <cg@exept.de>
parents:
9550
diff
changeset
|
2251 |
|
7d36dbb02bb3
code cleanup - remove old obsolete Project code
Claus Gittinger <cg@exept.de>
parents:
9550
diff
changeset
|
2252 |
"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
|
2253 |
"Modified: / 17-08-2006 / 14:01:22 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2254 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2255 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2256 |
globalNameCompletion:aPartialGlobalName |
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2257 |
"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
|
2258 |
2 entries: 1st: the best (longest) match |
10071 | 2259 |
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
|
2260 |
|
9508 | 2261 |
^ 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
|
2262 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2263 |
" |
10071 | 2264 |
Smalltalk globalnameCompletion:'Arr' |
2265 |
Smalltalk globalnameCompletion:'Arra' |
|
2266 |
Smalltalk globalnameCompletion:'arra' |
|
2267 |
Smalltalk globalnameCompletion:'*rray' |
|
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2268 |
" |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2269 |
|
9508 | 2270 |
"Created: / 24-11-1995 / 17:24:45 / cg" |
2271 |
"Modified: / 10-08-2006 / 13:05:39 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2272 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2273 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2274 |
globalnameCompletion:aPartialGlobalName |
7563 | 2275 |
"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
|
2276 |
2 entries: 1st: the best (longest) match |
10071 | 2277 |
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
|
2278 |
|
8358 | 2279 |
<resource:#obsolete> |
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2280 |
self obsoleteMethodWarning:'use #globalNameCompletion:'. |
9508 | 2281 |
^ 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
|
2282 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2283 |
" |
10071 | 2284 |
Smalltalk globalnameCompletion:'Arr' |
2285 |
Smalltalk globalnameCompletion:'Arra' |
|
2286 |
Smalltalk globalnameCompletion:'arra' |
|
2287 |
Smalltalk globalnameCompletion:'*rray' |
|
5736 | 2288 |
" |
2289 |
||
9508 | 2290 |
"Created: / 24-11-1995 / 17:24:45 / cg" |
2291 |
"Modified: / 10-08-2006 / 13:05:48 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2292 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2293 |
|
9290 | 2294 |
hasNameSpaces |
2295 |
"can be redefined by dummy namespaces/environments, to suppress |
|
2296 |
the namespace display in a browser (PocketSmalltalk)" |
|
2297 |
||
2298 |
^ true |
|
2299 |
! |
|
2300 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2301 |
hasNamespaces |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2302 |
"can be redefined by dummy namespaces/environments, to suppress |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2303 |
the namespace display in a browser (PocketSmalltalk)" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2304 |
|
9290 | 2305 |
<resource:#obsolete> |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2306 |
^ true |
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 |
includes:something |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2310 |
"this should come from Collection. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2311 |
will change the inheritance - Smalltalk is actually a collection" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2312 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2313 |
self do:[:element | element = something ifTrue:[^ true]]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2314 |
^ false |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2315 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2316 |
|
10041
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
2317 |
isBrowserStartable |
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
2318 |
^ false. |
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
2319 |
|
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
2320 |
"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
|
2321 |
! |
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
2322 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2323 |
isNameSpace |
9227 | 2324 |
"return true, if the receiver is a nameSpace." |
2325 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2326 |
^ true |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2327 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2328 |
"Created: 11.10.1996 / 18:10:43 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2329 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2330 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2331 |
isTopLevelNameSpace |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2332 |
^ true |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2333 |
! |
7563 | 2334 |
|
2335 |
isTopLevelNamespace |
|
2336 |
"obsolete - use isTopLevelNameSpace" |
|
5365 | 2337 |
|
7432 | 2338 |
<resource:#obsolete> |
2339 |
||
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2340 |
self obsoleteMethodWarning:'use #isTopLevelNameSpace'. |
4458 | 2341 |
^ true |
2342 |
||
2343 |
"Created: 11.10.1996 / 18:10:43 / cg" |
|
2344 |
! |
|
2345 |
||
9081 | 2346 |
keyIsClassVariableNameKey:aKey |
2347 |
|i| |
|
2348 |
||
2349 |
i := aKey lastIndexOf:$:. |
|
2350 |
i ~~ 0 ifTrue:[ |
|
10071 | 2351 |
i > 1 ifTrue:[ |
2352 |
(aKey at:(i-1)) == $: ifFalse:[ |
|
2353 |
^ true. |
|
2354 |
]. |
|
2355 |
]. |
|
9081 | 2356 |
]. |
2357 |
^ false. |
|
2358 |
||
2359 |
" |
|
10071 | 2360 |
self keyIsClassVariableNameKey:'foo::bar' |
2361 |
self keyIsClassVariableNameKey:'foo:bar' |
|
2362 |
self keyIsClassVariableNameKey:':bar' |
|
2363 |
self keyIsClassVariableNameKey:'::bar' |
|
9081 | 2364 |
" |
2365 |
! |
|
2366 |
||
9374
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
2367 |
loadedClassNamed:aString |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
2368 |
"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
|
2369 |
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
|
2370 |
|
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
2371 |
|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
|
2372 |
|
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
2373 |
"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
|
2374 |
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
|
2375 |
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
|
2376 |
sym notNil ifTrue:[ |
10071 | 2377 |
cls := self at:sym ifAbsent:nil. |
2378 |
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
|
2379 |
]. |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
2380 |
|
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
2381 |
(aString endsWith:' class') ifTrue:[ |
10071 | 2382 |
nonMeta := self loadedClassNamed:(aString copyWithoutLast:6). |
2383 |
nonMeta notNil ifTrue:[ |
|
2384 |
^ nonMeta theMetaclass |
|
2385 |
]. |
|
9374
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
2386 |
]. |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
2387 |
^ nil |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
2388 |
|
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
2389 |
" |
10071 | 2390 |
Smalltalk loadedClassNamed:'Object' |
2391 |
Smalltalk loadedClassNamed:'Authentication::BasicAuthenticator::BasicAuthenticationData' |
|
2392 |
Smalltalk loadedClassNamed:'Authentication::BasicAuthenticator::BasicAuthenticationData class' |
|
2393 |
Smalltalk loadedClassNamed:'Authentication::BasicAuthenticator' |
|
2394 |
Smalltalk loadedClassNamed:'fooBar' |
|
2395 |
Smalltalk loadedClassNamed:'true' |
|
2396 |
Smalltalk loadedClassNamed:'Object class' |
|
2397 |
Smalltalk loadedClassNamed:'Metaclass' |
|
2398 |
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
|
2399 |
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
|
2400 |
" |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
2401 |
! |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
2402 |
|
7563 | 2403 |
methodProtocolCompletion:aPartialProtocolName |
2404 |
"given a partial method protocol name, return an array consisting of |
|
10071 | 2405 |
2 entries: 1st: the best (longest) match |
2406 |
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
|
2407 |
|
9508 | 2408 |
^ DoWhatIMeanSupport methodProtocolCompletion:aPartialProtocolName inEnvironment:self |
8583
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 |
" |
10071 | 2411 |
Smalltalk methodProtocolCompletion:'doc' |
2412 |
Smalltalk methodProtocolCompletion:'docu' |
|
2413 |
Smalltalk methodProtocolCompletion:'documenta' |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2414 |
" |
9508 | 2415 |
|
2416 |
"Modified: / 10-08-2006 / 13:05:20 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2417 |
! |
5505
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
2418 |
|
7563 | 2419 |
numberOfGlobals |
2420 |
"return the number of global variables in the system" |
|
2421 |
||
2422 |
|tally "{ Class: SmallInteger }" | |
|
617 | 2423 |
|
2424 |
tally := 0. |
|
2425 |
self do:[:obj | tally := tally + 1]. |
|
2426 |
^ tally |
|
2427 |
||
2428 |
"Smalltalk numberOfGlobals" |
|
2429 |
! |
|
2430 |
||
7563 | 2431 |
referencesAny:aCollection |
2432 |
"redefined, since the references are only kept in the VM's symbol table" |
|
3260 | 2433 |
|
2434 |
self keysAndValuesDo:[:key :val | |
|
10071 | 2435 |
aCollection do:[:anObject | |
2436 |
(key == anObject) ifTrue:[^ true]. |
|
2437 |
(val == anObject ) ifTrue:[^ true]. |
|
2438 |
] |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2439 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2440 |
^ super referencesAny:aCollection |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2441 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2442 |
"Created: / 2.2.1998 / 16:01:20 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2443 |
! |
3260 | 2444 |
|
7563 | 2445 |
referencesDerivedInstanceOf:aClass |
2446 |
"redefined, since the references are only kept in the VM's symbol table" |
|
617 | 2447 |
|
2448 |
self keysAndValuesDo:[:key :val | |
|
10071 | 2449 |
(key isKindOf:aClass) ifTrue:[^ true]. |
2450 |
(val isKindOf:aClass) ifTrue:[^ true]. |
|
617 | 2451 |
]. |
2452 |
^ super referencesDerivedInstanceOf:aClass |
|
2453 |
! |
|
2454 |
||
7563 | 2455 |
referencesInstanceOf:aClass |
2456 |
"redefined, since the references are only kept in the VM's symbol table" |
|
617 | 2457 |
|
2458 |
self keysAndValuesDo:[:key :val | |
|
10071 | 2459 |
(key isMemberOf:aClass) ifTrue:[^ true]. |
2460 |
(val isMemberOf:aClass) ifTrue:[^ true]. |
|
617 | 2461 |
]. |
2462 |
^ super referencesInstanceOf:aClass |
|
2463 |
! |
|
2464 |
||
7563 | 2465 |
referencesObject:anObject |
2466 |
"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
|
2467 |
|
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
2468 |
self keysAndValuesDo:[:key :val | |
10071 | 2469 |
(key == anObject) ifTrue:[^ true]. |
2470 |
(val == anObject ) ifTrue:[^ true]. |
|
6074
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
2471 |
]. |
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
2472 |
^ super referencesObject:anObject |
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
2473 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2474 |
"Modified: / 3.2.1998 / 14:22:46 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2475 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2476 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2477 |
resolveName:nameIn inClass:aClass |
7563 | 2478 |
"resolve aName as if compiled within aClass; |
3026 | 2479 |
i.e. if it has a private class with this name, return it; |
2480 |
if aName is known within the classes namespace, return that. |
|
2481 |
Otherwise, return a global with that name. |
|
2482 |
This should be used whereever Smalltalk>>at: used to be used, |
|
2483 |
to resolve a global by name." |
|
2484 |
||
4354
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
2485 |
|aName sym cls ns| |
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
2486 |
|
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
2487 |
nameIn isNil ifTrue:[^ nil]. |
4356 | 2488 |
nameIn isBehavior ifTrue:[^ nameIn]. "/ already resolved |
4354
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
2489 |
aName := nameIn. |
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
2490 |
|
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
2491 |
(aName startsWith:'Smalltalk::') ifTrue:[ |
10071 | 2492 |
aName := aName copyFrom:12. |
2493 |
^ self at:(aName asSymbol) ifAbsent:nil. |
|
4354
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
2494 |
]. |
3026 | 2495 |
|
2496 |
sym := aName asSymbol. |
|
2497 |
||
2498 |
cls := aClass privateClassesAt:sym. |
|
2499 |
cls notNil ifTrue:[^ cls]. |
|
2500 |
||
2501 |
ns := aClass nameSpace. |
|
2502 |
(ns notNil and:[ns ~~ Smalltalk]) ifTrue:[ |
|
10071 | 2503 |
ns isNameSpace ifTrue:[ |
2504 |
cls := ns at:sym ifAbsent:nil. |
|
2505 |
] ifFalse:[ |
|
2506 |
cls := ns privateClassesAt:sym |
|
2507 |
]. |
|
2508 |
cls notNil ifTrue:[^ cls]. |
|
3025 | 2509 |
]. |
3026 | 2510 |
^ self at:sym ifAbsent:nil. |
4356 | 2511 |
|
2512 |
"Modified: / 9.7.1999 / 01:18:07 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2513 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2514 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2515 |
selectorCompletion:aPartialSymbolName |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2516 |
"given a partial selector, return an array consisting of |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2517 |
2 entries: 1st: the longest match |
10071 | 2518 |
2nd: collection consisting of matching implemented selectors" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2519 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2520 |
^ DoWhatIMeanSupport selectorCompletion:aPartialSymbolName inEnvironment:self |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2521 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2522 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2523 |
selectorCompletion:aPartialSymbolName inEnvironment:anEnvironment |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2524 |
"given a partial selector, return an array consisting of |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2525 |
2 entries: 1st: the longest match |
10071 | 2526 |
2nd: collection consisting of matching implemented selectors" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2527 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2528 |
^ DoWhatIMeanSupport selectorCompletion:aPartialSymbolName inEnvironment:anEnvironment |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2529 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2530 |
" |
10071 | 2531 |
Smalltalk selectorCompletion:'at:p' |
2532 |
Smalltalk selectorCompletion:'nextP' |
|
2533 |
Smalltalk selectorCompletion:'nextp' |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2534 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2535 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2536 |
"Modified: / 7.6.1996 / 08:44:33 / stefan" |
3565
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
2537 |
"Modified: / 14.6.1998 / 15:54:03 / cg" |
453 | 2538 |
! ! |
2539 |
||
4431 | 2540 |
!Smalltalk class methodsFor:'queries-system'! |
2541 |
||
7563 | 2542 |
dialectName |
8736 | 2543 |
^ #SmalltalkX |
7563 | 2544 |
|
2545 |
" |
|
2546 |
Smalltalk dialectName |
|
2547 |
" |
|
2548 |
! |
|
2549 |
||
2550 |
dialectReleaseVersion |
|
7348 | 2551 |
^ self versionString |
2552 |
||
2553 |
" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2554 |
Smalltalk dialectReleaseVersion |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2555 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2556 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2557 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2558 |
isDolphinSmalltalk |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2559 |
"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
|
2560 |
applications - add #isDolphinSmalltalk to your dolphin, |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2561 |
returning true there." |
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 |
^ false |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2564 |
! |
4970 | 2565 |
|
7563 | 2566 |
isSmalltalkMT |
2567 |
"return false here - this may be useful to write portable |
|
2568 |
applications - add #isSmalltalkMT to your smalltalk-MT, |
|
4970 | 2569 |
returning true there." |
2570 |
||
2571 |
^ false |
|
2572 |
! |
|
2573 |
||
7563 | 2574 |
isSmalltalkV |
2575 |
"return false here - this may be useful to write portable |
|
2576 |
applications - add #isSmalltalkV to your smalltalkV, |
|
4431 | 2577 |
returning true there." |
2578 |
||
2579 |
^ false |
|
2580 |
! |
|
2581 |
||
7563 | 2582 |
isSmalltalkX |
2583 |
"return true here - this may be useful to write portable |
|
2584 |
applications - add #isSmalltalkX to your other smalltalks, |
|
4431 | 2585 |
returning false there." |
2586 |
||
2587 |
^ true |
|
2588 |
! |
|
2589 |
||
7563 | 2590 |
isSqueak |
2591 |
"return false here - this may be useful to write portable |
|
2592 |
applications - add #isSqueak to your squeak, |
|
4431 | 2593 |
returning true there." |
2594 |
||
2595 |
^ false |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2596 |
! |
4431 | 2597 |
|
7563 | 2598 |
isVisualAge |
2599 |
"return false here - this may be useful to write portable |
|
2600 |
applications - add #isVisualAge to your visualAge, |
|
4431 | 2601 |
returning true there." |
2602 |
||
2603 |
^ false |
|
2604 |
! |
|
2605 |
||
7563 | 2606 |
isVisualWorks |
2607 |
"return false here - this may be useful to write portable |
|
2608 |
applications - add #isVisualWorks to your visualWorks, |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2609 |
returning true there." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2610 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2611 |
^ false |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2612 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2613 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2614 |
!Smalltalk class methodsFor:'startup'! |
1 | 2615 |
|
9032 | 2616 |
browserWindowStartup |
2617 |
|windowIDString numericWindowID windowID params idx process| |
|
2618 |
||
2619 |
idx := CommandLineArguments indexOf:'--browserWindow:'. |
|
2620 |
windowIDString := CommandLineArguments at:idx+1. |
|
2621 |
numericWindowID := Integer fromString:windowIDString. |
|
2622 |
windowID := ExternalAddress newAddress:numericWindowID. |
|
2623 |
||
2624 |
idx := CommandLineArguments indexOf:'--browserParameters:'. |
|
2625 |
idx ~~ 0 ifTrue:[ |
|
10071 | 2626 |
params := Dictionary new. |
2627 |
(CommandLineArguments copyFrom:idx+1) pairWiseDo:[:key :value | |
|
2628 |
params at:key put:value. |
|
2629 |
]. |
|
9032 | 2630 |
]. |
2631 |
||
2632 |
'browserWindow is: ' errorPrint. windowID errorPrintCR. |
|
2633 |
'browserParameters are: ' errorPrint. params errorPrintCR. |
|
2634 |
'Display is: ' errorPrint. Display errorPrintCR. |
|
2635 |
||
2636 |
process := [ |
|
10071 | 2637 |
PluginSupport |
2638 |
startInBrowserWithWindowID:windowID |
|
2639 |
parameters:params. |
|
9032 | 2640 |
] newProcess. |
9043
e6106f500263
do not use numeric process prios
Claus Gittinger <cg@exept.de>
parents:
9036
diff
changeset
|
2641 |
process priority:(Processor userSchedulingPriority). |
9032 | 2642 |
process name:'browser start handler'. |
2643 |
process beGroupLeader. |
|
2644 |
process resume. |
|
2645 |
process := nil. |
|
2646 |
||
2647 |
Processor dispatchLoop. |
|
2648 |
Smalltalk exit. |
|
2649 |
! |
|
2650 |
||
7563 | 2651 |
displayInitializationDone |
2652 |
"inform the restart, that the display has been initialized" |
|
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2653 |
|
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2654 |
CallbackSignal raiseRequest. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2655 |
! |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2656 |
|
7563 | 2657 |
mainStartup:graphicalMode |
2658 |
"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
|
2659 |
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
|
2660 |
|
9012 | 2661 |
|process imageName thisIsARestart idx| |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2662 |
|
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2663 |
imageName := ObjectMemory imageName. |
2249
cdb6c87f0707
send returnFromSnapshot notification later -
Claus Gittinger <cg@exept.de>
parents:
2212
diff
changeset
|
2664 |
thisIsARestart := imageName notNil. |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2665 |
|
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2666 |
" |
10071 | 2667 |
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
|
2668 |
" |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2669 |
Display notNil ifTrue:[ |
10071 | 2670 |
Display deviceIOTimeoutErrorSignal handlerBlock:[:ex | |
2671 |
SaveEmergencyImage == true ifTrue:[ |
|
2672 |
'Display [warning]: broken display connection - emergency save in ''crash.img''.' infoPrintCR. |
|
2673 |
ObjectMemory primSnapShotOn:'crash.img'. |
|
2674 |
]. |
|
2675 |
'Display [warning]: broken display connection - exit.' infoPrintCR. |
|
2676 |
self exit. |
|
2677 |
]. |
|
2678 |
Display startDispatch. |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2679 |
]. |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2680 |
|
9016 | 2681 |
idx := CommandLineArguments indexOf:'--browserWindow:'. |
9029 | 2682 |
IsPlugin := (idx ~~ 0). |
2683 |
IsPlugin ifTrue:[ |
|
10071 | 2684 |
self browserWindowStartup. |
2685 |
"/ not reached |
|
9012 | 2686 |
]. |
2687 |
||
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2688 |
Initializing := false. |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2689 |
|
2074
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
2690 |
"/ 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
|
2691 |
"/ 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
|
2692 |
"/ 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
|
2693 |
"/ 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
|
2694 |
|
7043
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
2695 |
process := [ |
10071 | 2696 |
StartBlocks notNil ifTrue:[ |
2697 |
StartBlocks do:[:aBlock| |
|
2698 |
aBlock value |
|
2699 |
]. |
|
2700 |
StartBlocks := nil. |
|
2701 |
]. |
|
2702 |
ImageStartBlocks notNil ifTrue:[ |
|
2703 |
ImageStartBlocks do:[:aBlock| |
|
2704 |
aBlock value |
|
2705 |
]. |
|
2706 |
]. |
|
2707 |
StandAlone ifFalse:[ |
|
2708 |
(SilentLoading == true) ifFalse:[ "i.e. undefined counts as false" |
|
2709 |
thisIsARestart ifTrue:[ |
|
2710 |
Transcript cr. |
|
2711 |
Transcript showCR:('Smalltalk restarted from:' |
|
2712 |
, imageName |
|
2713 |
, ' (saved ' |
|
2714 |
, ObjectMemory imageSaveTime printString |
|
2715 |
, ')' ). |
|
2716 |
] ifFalse:[ |
|
2717 |
Transcript showCR:(self hello). |
|
2718 |
Transcript showCR:(self copyrightString). |
|
2719 |
Transcript cr. |
|
2720 |
]. |
|
2721 |
Transcript cr. |
|
2722 |
]. |
|
2723 |
||
2724 |
DemoMode==true ifTrue:[ |
|
2725 |
Transcript showCR:'*** Restricted use: ***'. |
|
2726 |
Transcript showCR:'*** This program may be used for education only. ***'. |
|
2727 |
Transcript showCR:'*** Please read the files COPYRIGHT and LICENSE ***'. |
|
2728 |
Transcript showCR:'*** for more details. ***'. |
|
2729 |
Transcript cr. |
|
2730 |
]. |
|
2731 |
]. |
|
2732 |
||
2733 |
thisIsARestart ifTrue:[ |
|
2734 |
"/ |
|
2735 |
"/ the final late notification - users can now assume that |
|
2736 |
"/ views, forms etc. have been recreated. |
|
2737 |
||
2738 |
ObjectMemory changed:#returnFromSnapshot. |
|
2739 |
] |
|
7039
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
2740 |
|
7040 | 2741 |
] newProcess. |
2742 |
||
9043
e6106f500263
do not use numeric process prios
Claus Gittinger <cg@exept.de>
parents:
9036
diff
changeset
|
2743 |
process priority:(Processor userSchedulingPriority). |
7043
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
2744 |
process name:'start block handler'. |
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
2745 |
process beGroupLeader. |
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
2746 |
process resume. |
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
2747 |
process := nil. |
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
2748 |
|
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
2749 |
|
2074
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
2750 |
"/ 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
|
2751 |
"/ message. |
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
2752 |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2753 |
(StartupClass notNil and:[StartupSelector notNil]) ifTrue:[ |
10071 | 2754 |
" |
2755 |
allow more customization by reading an image specific rc-file |
|
2756 |
" |
|
2757 |
thisIsARestart ifTrue:[ |
|
2758 |
(imageName asFilename hasSuffix:'img') ifTrue:[ |
|
2759 |
imageName := imageName copyWithoutLast:4 |
|
2760 |
]. |
|
2761 |
self fileIn:(imageName , '.rc') |
|
2762 |
]. |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2763 |
|
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2764 |
"/ Display notNil ifTrue:[ |
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2765 |
"/ Display exitOnLastClose:true. |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2766 |
"/ ]. |
2086 | 2767 |
"/ Processor exitWhenNoMoreUserProcesses:true. |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2768 |
|
10071 | 2769 |
process := [ |
2770 |
StandAlone ifTrue:[ |
|
2771 |
AbortOperationRequest handle:[:ex | |
|
2772 |
'Smalltalk [info]: aborted - exit.' infoPrintCR. |
|
2773 |
OperatingSystem exit:1 |
|
2774 |
] do:[ |
|
2775 |
StartupClass perform:StartupSelector withArguments:StartupArguments. |
|
2776 |
] |
|
2777 |
] ifFalse:[ |
|
2778 |
StartupClass perform:StartupSelector withArguments:StartupArguments. |
|
2779 |
]. |
|
2780 |
||
2781 |
"/ |
|
2782 |
"/ non-GUI apps exit after the startup; |
|
2783 |
"/ assume that GUI apps have created & opened some view ... |
|
2784 |
"/ |
|
2785 |
Display isNil ifTrue:[ |
|
2786 |
'Smalltalk [info]: no Display - exit.' infoPrintCR. |
|
2787 |
Smalltalk exit. |
|
2788 |
]. |
|
2789 |
"/ |
|
2790 |
"/ GUI apps exit after the last user process has finished |
|
2791 |
"/ |
|
2792 |
Display exitOnLastClose:true. |
|
2793 |
Processor exitWhenNoMoreUserProcesses:true. |
|
2794 |
] newProcess. |
|
2795 |
process priority:(Processor userSchedulingPriority). |
|
2796 |
process name:'main'. |
|
2797 |
process beGroupLeader. |
|
2798 |
process resume. |
|
2799 |
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
|
2800 |
]. |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2801 |
|
9201 | 2802 |
StandAlone ifTrue:[ |
10071 | 2803 |
Display notNil ifTrue:[ |
2804 |
FlyByHelp notNil ifTrue:[ |
|
2805 |
FlyByHelp start |
|
2806 |
]. |
|
2807 |
]. |
|
9201 | 2808 |
]. |
2809 |
||
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2810 |
" |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2811 |
if view-classes exist, start dispatching; |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2812 |
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
|
2813 |
" |
10071 | 2814 |
((Display notNil and:[graphicalMode]) |
7043
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
2815 |
or:[process notNil |
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2816 |
or:[HeadlessOperation]]) ifTrue:[ |
10071 | 2817 |
Processor dispatchLoop. |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2818 |
] ifFalse:[ |
10071 | 2819 |
StandAlone ifFalse:[ |
2820 |
self readEvalPrint |
|
2821 |
] |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2822 |
]. |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2823 |
|
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2824 |
"done - the last process finished" |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2825 |
|
8786 | 2826 |
'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
|
2827 |
self exit |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2828 |
|
3062
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
2829 |
"Created: / 18.7.1996 / 21:07:39 / cg" |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
2830 |
"Modified: / 9.9.1996 / 17:42:50 / stefan" |
3483 | 2831 |
"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
|
2832 |
! |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2833 |
|
7563 | 2834 |
readEvalPrint |
2835 |
"{ Pragma: +optSpace }" |
|
2836 |
||
2837 |
"simple read-eval-print loop for non-graphical Minitalk" |
|
453 | 2838 |
|
2839 |
|text| |
|
2840 |
||
2841 |
'ST- ' print. |
|
2842 |
Stdin skipSeparators. |
|
2843 |
Stdin atEnd ifFalse:[ |
|
10071 | 2844 |
text := Stdin nextChunk. |
2845 |
[text notNil] whileTrue:[ |
|
2846 |
AbortAllOperationRequest handle:[:ex | |
|
2847 |
'evaluation aborted' printCR |
|
2848 |
] do:[ |
|
2849 |
Compiler isNil ifTrue:[ |
|
2850 |
'No evaluator class available (Compiler == nil)' printCR. |
|
2851 |
^ self |
|
2852 |
]. |
|
2853 |
(Compiler evaluate:text) printCR. |
|
2854 |
]. |
|
2855 |
'ST- ' print. |
|
2856 |
text := Stdin nextChunk |
|
2857 |
]. |
|
453 | 2858 |
]. |
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
2859 |
'' printCR |
453 | 2860 |
! |
2861 |
||
7563 | 2862 |
restart |
2863 |
"startup after an image has been loaded; |
|
2864 |
there are three change-notifications made to dependents of ObjectMemory, |
|
10 | 2865 |
which allow a stepwise re-init: #earlyRestart, #restarted and #returnFromSnapshot. |
335 | 2866 |
|
3096
881660d6e997
added #earlySystemInitialization change message (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3092
diff
changeset
|
2867 |
#earlySystemInstallation is sent for ST80 compatibility |
881660d6e997
added #earlySystemInitialization change message (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3092
diff
changeset
|
2868 |
|
10 | 2869 |
#earlyRestart is send first, nothing has been setup yet. |
10071 | 2870 |
(should be used to flush all device dependent entries) |
335 | 2871 |
|
10 | 2872 |
#restarted is send right after. |
10071 | 2873 |
(should be used to recreate external resources (fds, bitmaps etc) |
335 | 2874 |
|
10 | 2875 |
#returnFromSnapshot is sent last |
10071 | 2876 |
(should be used to restart processes, reOpen Streams which cannot |
2877 |
be automatically be reopened (i.e. Sockets, Pipes) and so on. |
|
2878 |
(Notice that positionable fileStreams are already reopened and repositioned) |
|
1 | 2879 |
" |
10 | 2880 |
|
4503
99718971ba26
Redirect Transcript to Stderr during restart-initialization.
Stefan Vogel <sv@exept.de>
parents:
4490
diff
changeset
|
2881 |
|deb insp transcript idx| |
1 | 2882 |
|
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2883 |
"/ |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2884 |
"/ when we arrive here, all objects from our previous life |
3971 | 2885 |
"/ have been reloaded - however, some may still contain invalid device |
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2886 |
"/ handles, display information etc. |
3971 | 2887 |
"/ also, dynamically loaded modules have not yet been reloaded yet. |
2888 |
"/ and the concrete OS, concrete FileName etc. are still refering to |
|
2889 |
"/ the previous classes. |
|
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2890 |
|
1 | 2891 |
Initializing := true. |
3499 | 2892 |
AbstractOperatingSystem initializeConcreteClass. |
2893 |
||
8251
97520a99bcc6
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8115
diff
changeset
|
2894 |
ImageRestartTime := Timestamp now. |
335 | 2895 |
|
1580
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2896 |
CommandLine := CommandLineArguments copy. |
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2897 |
CommandLineArguments := CommandLineArguments asOrderedCollection. |
6842 | 2898 |
CommandName := CommandLineArguments removeFirst. "/ the command |
1580
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2899 |
|
1582 | 2900 |
idx := CommandLineArguments indexOf:'-q'. |
6881 | 2901 |
idx == 0 ifTrue:[ |
10071 | 2902 |
idx := CommandLineArguments indexOf:'--silent'. |
6881 | 2903 |
]. |
1582 | 2904 |
idx ~~ 0 ifTrue:[ |
10071 | 2905 |
Object infoPrinting:false. |
2906 |
ObjectMemory infoPrinting:false. |
|
2907 |
CommandLineArguments removeAtIndex:idx. |
|
1582 | 2908 |
]. |
2909 |
||
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2910 |
"/ |
3971 | 2911 |
"/ start catching SIGSEGV and SIGBUS |
2912 |
||
2913 |
OperatingSystem enableHardSignalInterrupts. |
|
2914 |
||
2907 | 2915 |
"/ reinit Filename |
2916 |
Filename reinitialize. |
|
2917 |
||
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2918 |
"/ |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2919 |
"/ flush cached path directories (may have changed in the meanwhile) |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2920 |
|
329 | 2921 |
self flushPathCaches. |
1 | 2922 |
|
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2923 |
"/ |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2924 |
"/ reinit the default streams: Stdin, Stdout and Stderr |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2925 |
"/ after that, we can write to stderr. |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2926 |
|
477
8710aba7876b
oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents:
457
diff
changeset
|
2927 |
self reinitStandardStreams. |
8710aba7876b
oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents:
457
diff
changeset
|
2928 |
|
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2929 |
"/ |
10071 | 2930 |
"/ redirect Transcript to Stderr during startup |
2931 |
||
2932 |
transcript := Transcript. |
|
4503
99718971ba26
Redirect Transcript to Stderr during restart-initialization.
Stefan Vogel <sv@exept.de>
parents:
4490
diff
changeset
|
2933 |
Transcript := Stderr. |
99718971ba26
Redirect Transcript to Stderr during restart-initialization.
Stefan Vogel <sv@exept.de>
parents:
4490
diff
changeset
|
2934 |
|
99718971ba26
Redirect Transcript to Stderr during restart-initialization.
Stefan Vogel <sv@exept.de>
parents:
4490
diff
changeset
|
2935 |
"/ |
10071 | 2936 |
"/ temporary switch back to dumb interface - |
4503
99718971ba26
Redirect Transcript to Stderr during restart-initialization.
Stefan Vogel <sv@exept.de>
parents:
4490
diff
changeset
|
2937 |
"/ to handle errors while view-stuff is not yet reinitialized |
1 | 2938 |
|
2939 |
insp := Inspector. |
|
2940 |
deb := Debugger. |
|
684
3e0b5a8ec381
invalidate display connection during early startup
Claus Gittinger <cg@exept.de>
parents:
680
diff
changeset
|
2941 |
deb notNil ifTrue:[ |
10071 | 2942 |
deb reinitialize |
684
3e0b5a8ec381
invalidate display connection during early startup
Claus Gittinger <cg@exept.de>
parents:
680
diff
changeset
|
2943 |
]. |
1 | 2944 |
Inspector := MiniInspector. |
2945 |
Debugger := MiniDebugger. |
|
2946 |
||
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2947 |
"/ reload any dynamically loaded objects. |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2948 |
"/ this must be done before doing anything else below, |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2949 |
"/ because the Processor may restart processes which use |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2950 |
"/ this code. |
3155
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
2951 |
"/ Also, a dynamic object might be registered as dependent of |
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
2952 |
"/ ObjectFileLoader; therefore, must reload before doing any notifications. |
335 | 2953 |
|
1100
eebf3ed54b23
reloadAllObjectFiles now called explicit (its too late via ObjMem changed)
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
2954 |
ObjectFileLoader notNil ifTrue:[ |
10071 | 2955 |
ObjectFileLoader reloadAllRememberedObjectFiles. |
1100
eebf3ed54b23
reloadAllObjectFiles now called explicit (its too late via ObjMem changed)
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
2956 |
]. |
eebf3ed54b23
reloadAllObjectFiles now called explicit (its too late via ObjMem changed)
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
2957 |
|
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2958 |
"/ |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2959 |
"/ invalidate all display connections. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2960 |
"/ This is required to avoid trouble if someone accesses |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2961 |
"/ a display during early startup. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2962 |
|
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2963 |
Screen notNil ifTrue:[ |
10071 | 2964 |
Screen allScreens do:[:aDisplay | |
2965 |
aDisplay invalidateConnection |
|
2966 |
]. |
|
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2967 |
]. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
2968 |
|
3155
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
2969 |
ObjectMemory changed:#earlySystemInstallation. |
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
2970 |
|
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2971 |
"/ |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2972 |
"/ reinitialize the Processor - restartable processes |
4109 | 2973 |
"/ are now restarted here (but not yet scheduled). |
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2974 |
"/ |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2975 |
Processor reinitialize. |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2976 |
|
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2977 |
"/ |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2978 |
"/ flush device handles & recreate OS resources (if possible) |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2979 |
"/ (mostly view/GC/color & font stuff) |
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2980 |
|
3022 | 2981 |
ObjectMemory |
10071 | 2982 |
changed:#earlyRestart; changed:#restarted. |
1 | 2983 |
|
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2984 |
"/ |
3526
78245608c0b8
no need for last change (restarting processes).
Claus Gittinger <cg@exept.de>
parents:
3523
diff
changeset
|
2985 |
"/ start catching SIGINT and SIGQUIT |
78245608c0b8
no need for last change (restarting processes).
Claus Gittinger <cg@exept.de>
parents:
3523
diff
changeset
|
2986 |
|
78245608c0b8
no need for last change (restarting processes).
Claus Gittinger <cg@exept.de>
parents:
3523
diff
changeset
|
2987 |
OperatingSystem enableUserInterrupts. |
6390
41d5c47c33f0
Catch sigPWR and sigHUP on restart
Stefan Vogel <sv@exept.de>
parents:
6366
diff
changeset
|
2988 |
OperatingSystem enableCrashSignalInterrupts. |
3526
78245608c0b8
no need for last change (restarting processes).
Claus Gittinger <cg@exept.de>
parents:
3523
diff
changeset
|
2989 |
|
8958 | 2990 |
"/ give user a chance to re-customize things in smalltalk_r.rc. |
8957 | 2991 |
"/ reading if smalltalk_r.rc may be suppressed by the --faststart argument. |
1455
970b79688f56
reload object modules earlier - some comments what is going on in #restart
Claus Gittinger <cg@exept.de>
parents:
1451
diff
changeset
|
2992 |
|
6881 | 2993 |
idx := CommandLineArguments indexOf:'--faststart'. |
8957 | 2994 |
idx == 0 ifTrue:[ |
10071 | 2995 |
idx := CommandLineArguments indexOf:'--fastStart'. |
8957 | 2996 |
]. |
1580
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2997 |
idx ~~ 0 ifTrue:[ |
10071 | 2998 |
CommandLineArguments removeAtIndex:idx. |
1580
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
2999 |
] ifFalse:[ |
10071 | 3000 |
CallbackSignal := QuerySignal new. |
3001 |
[ |
|
3002 |
Class withoutUpdatingChangesDo:[ |
|
3003 |
(self fileIn:(self commandName , '_r.rc')) ifFalse:[ |
|
3004 |
"no _r.rc file where executable is; try default smalltalk_r.rc" |
|
3005 |
self fileIn:'smalltalk_r.rc' |
|
3006 |
]. |
|
3007 |
] |
|
3008 |
] on:CallbackSignal do:[:ex| |
|
3009 |
"/ now, display and view-stuff works; |
|
3010 |
"/ back to the previous debugging interface |
|
3011 |
||
3012 |
Inspector := insp. |
|
3013 |
Debugger := deb. |
|
3014 |
||
3015 |
"/ reinstall Transcript, if not changed during restart. |
|
3016 |
"/ if there was no Transcript, go to stderr |
|
3017 |
||
3018 |
(transcript notNil and:[Transcript == Stderr]) ifTrue:[ |
|
3019 |
Transcript := transcript. |
|
3020 |
]. |
|
3021 |
Initializing := false. |
|
3022 |
ex proceed. |
|
3023 |
]. |
|
3024 |
CallbackSignal := nil. |
|
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3025 |
]. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3026 |
|
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3027 |
"/ reinitialization (restart) of Display is normally performed |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3028 |
"/ in the restart script. If this has not been run for some reason, |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3029 |
"/ do in now. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3030 |
Initializing ifTrue:[ |
10071 | 3031 |
Display notNil ifTrue:[ |
3032 |
[ |
|
3033 |
Display reinitializeFor:Screen defaultDisplayName. |
|
3034 |
] on:Screen deviceOpenErrorSignal do:[ |
|
3035 |
'Smalltalk [error]: Cannot restart connection to: ' errorPrint. |
|
3036 |
Screen defaultDisplayName errorPrintCR. |
|
3037 |
OperatingSystem exit:1. |
|
3038 |
]. |
|
3039 |
]. |
|
3040 |
"/ now, display and view-stuff works; |
|
3041 |
"/ back to the previous debugging interface |
|
3042 |
||
3043 |
Inspector := insp. |
|
3044 |
Debugger := deb. |
|
3045 |
||
3046 |
"/ reinstall Transcript, if not changed during restart. |
|
3047 |
"/ if there was no Transcript, go to stderr |
|
3048 |
||
3049 |
(transcript notNil and:[Transcript == Stderr]) ifTrue:[ |
|
3050 |
Transcript := transcript. |
|
3051 |
]. |
|
3052 |
Initializing := false. |
|
7 | 3053 |
]. |
8522
09b3ac13da48
release resources of secondary displays on snapshot restart
Stefan Vogel <sv@exept.de>
parents:
8473
diff
changeset
|
3054 |
Screen notNil ifTrue:[ |
10071 | 3055 |
"clean up leftover screens (and views) that haven't been reopened. |
3056 |
Operate on a copy, since brokenConnection removes us from AllScreens" |
|
3057 |
Screen allScreens copy do:[:eachDisplay | |
|
3058 |
eachDisplay isOpen ifFalse:[ |
|
3059 |
'Smalltalk [info]: cannot reopen secondary display: ' errorPrint. |
|
3060 |
eachDisplay errorPrintCR. |
|
3061 |
eachDisplay cleanupAfterDispatch; brokenConnection. |
|
3062 |
] |
|
3063 |
]. |
|
3064 |
]. |
|
3065 |
||
3066 |
deb := insp := transcript := nil. "avoid dangling refs" |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3067 |
self mainStartup:true |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3068 |
|
3526
78245608c0b8
no need for last change (restarting processes).
Claus Gittinger <cg@exept.de>
parents:
3523
diff
changeset
|
3069 |
"Modified: / 7.6.1998 / 02:48:00 / cg" |
4503
99718971ba26
Redirect Transcript to Stderr during restart-initialization.
Stefan Vogel <sv@exept.de>
parents:
4490
diff
changeset
|
3070 |
"Modified: / 3.8.1999 / 09:42:21 / stefan" |
1 | 3071 |
! |
3072 |
||
7563 | 3073 |
start |
3074 |
"main startup, if there is a Display, initialize it |
|
3075 |
and start dispatching; otherwise go into a read-eval-print loop." |
|
617 | 3076 |
|
9012 | 3077 |
|idx graphicalMode arg didReadRCFile| |
960
e3b75f50d0cd
changes for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3078 |
|
e3b75f50d0cd
changes for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3079 |
graphicalMode := true. |
617 | 3080 |
Initializing := true. |
3081 |
||
3082 |
" |
|
3083 |
while reading patches- and rc-file, do not add things into change-file |
|
3084 |
" |
|
3085 |
Class withoutUpdatingChangesDo:[ |
|
10071 | 3086 |
|myName defaultRC prevCatchSetting| |
3087 |
||
3088 |
"/ |
|
3089 |
"/ look for any '-q', '-e' or '-f' command line arguments |
|
3090 |
"/ and handle them; |
|
3091 |
"/ read startup and patches file |
|
3092 |
"/ |
|
3093 |
idx := CommandLineArguments indexOf:'-q'. |
|
3094 |
idx == 0 ifTrue:[ |
|
3095 |
idx := CommandLineArguments indexOf:'--silent'. |
|
3096 |
]. |
|
3097 |
idx ~~ 0 ifTrue:[ |
|
3098 |
Object infoPrinting:false. |
|
3099 |
ObjectMemory infoPrinting:false. |
|
3100 |
CommandLineArguments removeAtIndex:idx. |
|
3101 |
]. |
|
3102 |
||
3103 |
StandAlone ifFalse:[ |
|
3104 |
"/ look for a '-e filename' or '--execute filename' argument |
|
3105 |
"/ this will force fileIn of filename only, no standard startup. |
|
3106 |
||
3107 |
idx := CommandLineArguments indexOf:'-e'. |
|
3108 |
idx == 0 ifTrue:[ |
|
3109 |
idx := CommandLineArguments indexOf:'--execute'. |
|
3110 |
]. |
|
3111 |
idx ~~ 0 ifTrue:[ |
|
3112 |
arg := CommandLineArguments at:idx + 1. |
|
3113 |
||
3114 |
CommandLineArguments |
|
3115 |
removeAtIndex:idx+1; removeAtIndex:idx. |
|
3116 |
||
3117 |
arg = '-' ifTrue:[ |
|
3118 |
self fileInStream:Stdin |
|
3119 |
lazy:nil |
|
3120 |
silent:nil |
|
3121 |
logged:false |
|
3122 |
addPath:nil |
|
3123 |
] ifFalse:[ |
|
3124 |
self fileIn:arg. |
|
3125 |
]. |
|
3126 |
self exit |
|
3127 |
]. |
|
3128 |
||
3129 |
"/ look for a '-E expr' or '--eval expr' argument |
|
3130 |
"/ this will force evaluation of expr only, no standard startup |
|
3131 |
idx := CommandLineArguments indexOf:'-E'. |
|
3132 |
idx == 0 ifTrue:[ |
|
3133 |
idx := CommandLineArguments indexOf:'--eval'. |
|
3134 |
]. |
|
3135 |
idx ~~ 0 ifTrue:[ |
|
3136 |
arg := CommandLineArguments at:idx + 1. |
|
3137 |
||
3138 |
CommandLineArguments |
|
3139 |
removeAtIndex:idx+1; removeAtIndex:idx. |
|
3140 |
||
3141 |
self |
|
3142 |
fileInStream:arg readStream |
|
3143 |
lazy:nil |
|
3144 |
silent:nil |
|
3145 |
logged:false |
|
3146 |
addPath:nil. |
|
3147 |
||
3148 |
self exit |
|
3149 |
]. |
|
3150 |
]. |
|
3151 |
||
3152 |
"look for a '-f filename' or '--file filename' argument |
|
3153 |
this will force evaluation of filename instead of smalltalk.rc" |
|
9205 | 3154 |
|
3155 |
"/ "If there is only one argument, which does not start with a '-', |
|
3156 |
"/ this is the same as -f filename" |
|
10071 | 3157 |
"/ (CommandLineArguments size == 1 |
9205 | 3158 |
"/ and:[(CommandLineArguments first startsWith:$-) not]) ifTrue:[ |
3159 |
"/ myName := CommandLineArguments removeFirst. |
|
3160 |
"/ ]. |
|
3161 |
||
10071 | 3162 |
myName isNil ifTrue:[ |
3163 |
idx := CommandLineArguments indexOf:'-f'. |
|
3164 |
idx == 0 ifTrue:[ |
|
3165 |
idx := CommandLineArguments indexOf:'--file'. |
|
3166 |
]. |
|
3167 |
idx ~~ 0 ifTrue:[ |
|
3168 |
myName := CommandLineArguments at:idx+1. |
|
3169 |
CommandLineArguments removeAtIndex:idx+1; removeAtIndex:idx. |
|
3170 |
]. |
|
3171 |
]. |
|
3172 |
myName notNil ifTrue:[ |
|
3173 |
CommandName := myName. |
|
3174 |
(self secureFileIn:myName) ifFalse:[ |
|
3175 |
('Smalltalk [error]: startup file ', myName, ' not found.') errorPrintCR. |
|
3176 |
OperatingSystem exit:1. |
|
3177 |
]. |
|
3178 |
] ifFalse:[ |
|
3179 |
"/ look for <command>.rc |
|
3180 |
"/ if not found, read smalltalk.rc (or stxapp.rc for standAlone operation) |
|
3181 |
||
3182 |
didReadRCFile := false. |
|
3183 |
||
3184 |
myName := self commandName asFilename withSuffix:'rc'. |
|
3185 |
(didReadRCFile := self secureFileIn:myName) ifFalse:[ |
|
3186 |
StandAlone ifFalse:[ |
|
3187 |
defaultRC := 'smalltalk.rc' |
|
3188 |
] ifTrue:[ |
|
3189 |
defaultRC := 'stxapp.rc' |
|
3190 |
]. |
|
3191 |
||
3192 |
didReadRCFile := self secureFileIn:defaultRC. |
|
3193 |
didReadRCFile ifFalse:[ |
|
3194 |
StandAlone ifFalse:[ |
|
3195 |
'Smalltalk [warning]: no startup rc-file found. Going into line-by-line interpreter.' infoPrintCR. |
|
3196 |
graphicalMode := false. |
|
3197 |
] |
|
3198 |
] |
|
3199 |
]. |
|
3200 |
||
3201 |
"/ ('StandAlone is %1' bindWith:StandAlone) printCR. |
|
3202 |
"/ ('Headless is %1' bindWith:HeadlessOperation) printCR. |
|
3203 |
"/ ('Display is %1' bindWith:Display) printCR. |
|
3204 |
"/ ('Screen is %1' bindWith:Screen) printCR. |
|
3205 |
||
3206 |
didReadRCFile ifFalse:[ |
|
3207 |
"/ |
|
3208 |
"/ No RC file found; |
|
3209 |
"/ Setup more default stuff |
|
3210 |
"/ |
|
3211 |
StandAlone ifFalse:[ |
|
3212 |
"/ its a smalltalk - proceed in interpreter. |
|
3213 |
'Smalltalk [warning]: no startup rc-file found. Going into line-by-line interpreter.' infoPrintCR. |
|
3214 |
graphicalMode := false. |
|
3215 |
] ifTrue:[ |
|
3216 |
"/ its an application - try harder |
|
3217 |
||
3218 |
Screen notNil ifTrue:[ |
|
3219 |
[ |
|
3220 |
Screen openDefaultDisplay:nil. |
|
3221 |
] on:Screen deviceOpenErrorSignal do:[:ex| |
|
3222 |
('Smalltalk [error]: No Display connection to: ', ex parameter printString) errorPrintCR. |
|
3223 |
'Smalltalk [info]: Either set the DISPLAY environment variable,' infoPrintCR. |
|
3224 |
'Smalltalk [info]: or start smalltalk with a -display argument.' infoPrintCR. |
|
3225 |
HeadlessOperation == true ifFalse:[ |
|
3226 |
OperatingSystem exit:1. |
|
3227 |
]. |
|
3228 |
]. |
|
3229 |
||
3230 |
Display notNil ifTrue:[ |
|
3231 |
(self secureFileIn:'display.rc') ifFalse:[ |
|
3232 |
"/ 'Smalltalk [warning]: no display.rc found; screen setting might be wrong.' errorPrintCR. |
|
3233 |
(self secureFileIn:'keyboard.rc') ifFalse:[ |
|
3234 |
"/ 'Smalltalk [warning]: no keyboard.rc found; shortkey setting might be wrong.' errorPrintCR. |
|
3235 |
] |
|
3236 |
] |
|
3237 |
]. |
|
3238 |
] |
|
3239 |
]. |
|
3240 |
||
3241 |
"/ setup more defaults... |
|
3242 |
ObjectMemory startBackgroundCollectorAt:5. |
|
3243 |
ObjectMemory startBackgroundFinalizationAt:5. |
|
3244 |
self addStartBlock:[ |
|
3245 |
Processor startTimeSlicing. |
|
3246 |
Processor supportDynamicPriorities:true. |
|
3247 |
ObjectMemory backgroundCollectProcess priorityRange:(4 to:9). |
|
3248 |
ObjectMemory backgroundFinalizationProcess priorityRange:(4 to:9). |
|
3249 |
]. |
|
3250 |
]. |
|
3251 |
]. |
|
617 | 3252 |
]. |
3253 |
||
6841
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
3254 |
StandAlone ifFalse:[ |
10071 | 3255 |
" |
3256 |
enable the graphical debugger/inspector |
|
3257 |
(they could have been (re)defined as autoloaded in the patches file) |
|
3258 |
" |
|
3259 |
self initStandardTools. |
|
963
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
3260 |
]. |
617 | 3261 |
|
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3262 |
(Display isNil or:[HeadlessOperation]) ifTrue:[ |
10071 | 3263 |
graphicalMode := false. |
2074
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
3264 |
]. |
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
3265 |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3266 |
self mainStartup:graphicalMode |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3267 |
|
5146 | 3268 |
"Modified: / 24.12.1999 / 00:26:54 / cg" |
1097 | 3269 |
! ! |
3270 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
3271 |
!Smalltalk class methodsFor:'startup queries'! |
1097 | 3272 |
|
7563 | 3273 |
commandLine |
3274 |
"return the full command line arguments (with which ST/X was started)" |
|
1580
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
3275 |
|
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
3276 |
^ CommandLine |
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
3277 |
|
9029 | 3278 |
" |
10071 | 3279 |
Smalltalk commandLine |
9029 | 3280 |
" |
3281 |
||
1580
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
3282 |
"Created: 19.7.1996 / 11:09:06 / cg" |
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
3283 |
! |
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
3284 |
|
7563 | 3285 |
commandLineArgumentNamed:aString |
3286 |
"extract a named argument from the command line arguments." |
|
6806 | 3287 |
|
3288 |
|args index| |
|
3289 |
||
3290 |
args := self commandLineArguments. |
|
3291 |
index := args indexOf:aString. |
|
3292 |
(index between:1 and:(args size - 1)) ifTrue:[ |
|
10071 | 3293 |
^ args at:index+1 |
6806 | 3294 |
]. |
3295 |
^ nil. |
|
3296 |
||
3297 |
" |
|
3298 |
self commandLineArgumentNamed:'-display' |
|
3299 |
" |
|
3300 |
! |
|
3301 |
||
7563 | 3302 |
commandLineArguments |
3303 |
"return the user command line arguments; |
|
3304 |
This is a collection of strings (separated command line words), |
|
1580
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
3305 |
from which the internal startup arguments have already been removed. |
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
3306 |
I.e. if started with: 'smalltalk -I -f xxx foo bar baz', |
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
3307 |
the commandLineArguments will be #('foo' 'bar' 'baz'). |
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
3308 |
In contrast, the value returned by #commandLine will be the full set of words." |
1097 | 3309 |
|
3310 |
^ CommandLineArguments |
|
1580
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
3311 |
|
fa0156475cc2
remove internal args from the CommandLineArguments.
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
3312 |
"Modified: 19.7.1996 / 11:11:03 / cg" |
1097 | 3313 |
! |
3314 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3315 |
commandName |
10071 | 3316 |
"return the excutables name - this is normally 'stx', |
9029 | 3317 |
but can be something else for standAlone apps." |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3318 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3319 |
^ CommandName. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3320 |
|
9029 | 3321 |
" |
3322 |
Smalltalk commandName |
|
3323 |
" |
|
3324 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3325 |
"Modified: 19.7.1996 / 11:11:16 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3326 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3327 |
|
9054 | 3328 |
hasNoConsole |
3329 |
"return true, if this is a console-less application (i.e. I am winstx) |
|
3330 |
i.e. there should be no writing to stdout/stderr" |
|
3331 |
||
3332 |
^ HasNoConsole ? false |
|
3333 |
||
3334 |
" |
|
10071 | 3335 |
Smalltalk hasNoConsole |
9054 | 3336 |
" |
3337 |
! |
|
3338 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3339 |
isHeadless |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3340 |
"return true, if this is a headless application |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3341 |
i.e. no default Display connection is required/used" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3342 |
|
9029 | 3343 |
^ HeadlessOperation ? false |
3344 |
||
3345 |
" |
|
10071 | 3346 |
Smalltalk isHeadless |
9029 | 3347 |
" |
3348 |
! |
|
3349 |
||
3350 |
isPlugin |
|
3351 |
"return true, if this is a plugin application |
|
3352 |
i.e. running in a browserWindow" |
|
3353 |
||
3354 |
^ IsPlugin ? false |
|
3355 |
||
3356 |
" |
|
10071 | 3357 |
Smalltalk isPlugin |
9029 | 3358 |
" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3359 |
! |
4957 | 3360 |
|
9510 | 3361 |
isSharedLibraryComponent |
3362 |
"return true, if this is a shared library component of another application |
|
3363 |
i.e. a dll within another app." |
|
3364 |
||
3365 |
^ IsSharedLibraryComponent ? false |
|
3366 |
||
3367 |
" |
|
10071 | 3368 |
Smalltalk isSharedLibraryComponent |
9510 | 3369 |
" |
3370 |
||
3371 |
"Created: / 10-08-2006 / 13:09:34 / cg" |
|
3372 |
! |
|
3373 |
||
3374 |
isSmalltalkDevelopmentSystem |
|
3375 |
"return true, if this is a real smalltalk system |
|
3376 |
i.e. NOT a stripped & linked application (such as the webServer) |
|
3377 |
and NOT a plugIn (i.e. running in a browser) |
|
3378 |
and NOT a sharedLibrary component (i.e. a dll in another app)." |
|
3379 |
||
3380 |
^ self isPlugin not |
|
10071 | 3381 |
and:[ self isSharedLibraryComponent not |
9510 | 3382 |
and:[ self isStandAloneApp not ]] |
3383 |
||
3384 |
" |
|
10071 | 3385 |
Smalltalk isSmalltalkDevelopmentSystem |
9510 | 3386 |
" |
3387 |
||
3388 |
"Created: / 10-08-2006 / 13:12:49 / cg" |
|
3389 |
! |
|
3390 |
||
7563 | 3391 |
isStandAloneApp |
3392 |
"return true, if this is a standAlone application |
|
9029 | 3393 |
i.e. a stripped & linked application (such as the webServer) |
3394 |
in contrast to a full smalltalk (development) system." |
|
3395 |
||
3396 |
^ StandAlone ? false |
|
3397 |
||
3398 |
" |
|
10071 | 3399 |
Smalltalk isStandAloneApp |
9029 | 3400 |
" |
617 | 3401 |
! |
3402 |
||
7563 | 3403 |
startupArguments |
9029 | 3404 |
"return the arguments passed to StartupClass when stx gets started. |
10071 | 3405 |
Usually these are nil, |
9029 | 3406 |
but saving an image with a non-nil StartupClass/StartupSelector/StartupArgs allows for |
3407 |
a simple way to configure and create stand-alone applications" |
|
7563 | 3408 |
|
3409 |
^ StartupArguments |
|
9029 | 3410 |
|
3411 |
" |
|
10071 | 3412 |
Smalltalk startupArguments |
9029 | 3413 |
" |
7563 | 3414 |
! |
3415 |
||
3416 |
startupClass |
|
3417 |
"return the class, that will get the start message when smalltalk |
|
10071 | 3418 |
starts and its non-nil. Usually this is nil, |
9029 | 3419 |
but saving an image with a non-nil StartupClass/StartupSelector/StartupArgs allows for |
3420 |
a simple way to configure and create stand-alone applications" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3421 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3422 |
^ StartupClass |
9029 | 3423 |
|
3424 |
" |
|
10071 | 3425 |
Smalltalk startupClass |
9029 | 3426 |
" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3427 |
! |
8570 | 3428 |
|
7563 | 3429 |
startupClass:aClass selector:aSymbol arguments:anArrayOrNil |
3430 |
"{ Pragma: +optSpace }" |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
3431 |
|
617 | 3432 |
"set the class, selector and arguments to be performed when smalltalk |
3433 |
starts. Setting those before saving a snapshot, will make the saved |
|
3434 |
image come up executing your application (instead of the normal mainloop)" |
|
3435 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3436 |
StartupClass := aClass. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3437 |
StartupSelector := aSymbol. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3438 |
StartupArguments := anArrayOrNil |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3439 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3440 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3441 |
startupSelector |
9029 | 3442 |
"return the selector, that will be sent to StartupClass. |
10071 | 3443 |
Usually this is nil, |
9029 | 3444 |
but saving an image with a non-nil StartupClass/StartupSelector allows for |
3445 |
a simple way to configure and create stand-alone applications" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3446 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3447 |
^ StartupSelector |
9029 | 3448 |
|
3449 |
" |
|
10071 | 3450 |
Smalltalk startupSelector |
9029 | 3451 |
" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3452 |
! |
7811 | 3453 |
|
3454 |
wasStartedFromImage |
|
10071 | 3455 |
"return true, if this smalltalk was started from an image, |
9029 | 3456 |
as opposed to a fresh and clean startup" |
3457 |
||
7819 | 3458 |
^ ImageRestartTime notNil |
7811 | 3459 |
|
3460 |
" |
|
3461 |
Smalltalk wasStartedFromImage |
|
3462 |
" |
|
70 | 3463 |
! ! |
3464 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
3465 |
!Smalltalk class methodsFor:'system environment'! |
1069 | 3466 |
|
7563 | 3467 |
language |
3468 |
"return the language setting" |
|
3469 |
||
3470 |
^ Language |
|
3471 |
||
3472 |
" |
|
3473 |
Smalltalk language |
|
1307 | 3474 |
" |
3475 |
||
3476 |
"Modified: 26.4.1996 / 17:10:05 / cg" |
|
3477 |
! |
|
3478 |
||
7563 | 3479 |
language:aLanguageSymbol |
3480 |
"set the language" |
|
3481 |
||
3482 |
Language := aLanguageSymbol. |
|
1307 | 3483 |
self changed:#Language |
3484 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3485 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3486 |
Smalltalk language:#de |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3487 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3488 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3489 |
"Modified: 26.4.1996 / 17:13:34 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3490 |
! |
1069 | 3491 |
|
7563 | 3492 |
languageTerritory |
3493 |
"return the language territory setting" |
|
3494 |
||
3495 |
^ LanguageTerritory |
|
3496 |
! |
|
3497 |
||
3498 |
languageTerritory:aTerritorySymbol |
|
3499 |
"set the language territory" |
|
3500 |
||
3501 |
LanguageTerritory := aTerritorySymbol. |
|
1307 | 3502 |
self changed:#LanguageTerritory |
3503 |
||
3504 |
" |
|
3505 |
Time now |
|
3506 |
||
3507 |
Smalltalk languageTerritory:#us. |
|
3508 |
Time now |
|
3509 |
||
3510 |
Smalltalk languageTerritory:#de. |
|
10071 | 3511 |
Time now |
1307 | 3512 |
" |
3513 |
||
3514 |
"Modified: 26.4.1996 / 17:12:39 / cg" |
|
7992 | 3515 |
! |
3516 |
||
3517 |
setLanguage:aLanguageSymbol |
|
3518 |
"set the language withotu change notifications" |
|
3519 |
||
3520 |
Language := aLanguageSymbol. |
|
1069 | 3521 |
! ! |
3522 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
3523 |
!Smalltalk class methodsFor:'system management'! |
70 | 3524 |
|
7563 | 3525 |
compressSources |
3526 |
"{ Pragma: +optSpace }" |
|
3527 |
||
3528 |
"compress the sources file, and remove all method source strings |
|
617 | 3529 |
from the system and replace them by refs to a string in the source file. |
3530 |
This is a bit different in ST/X than in other smalltalks, |
|
3531 |
since we use per-class sourcefiles for the compiled classes, |
|
3532 |
and a mix of in-memory strings and one-for-all sourceFile for |
|
3533 |
incremental compiled methods. |
|
3534 |
Therefore, only those sources which are not coming from compiled |
|
3535 |
methods are put into the 'st.src' file - all others are untouched. |
|
3536 |
This is being automated - so dont care for now." |
|
3537 |
||
7105
44c02807ca41
More openErrorSignal change preparations
Stefan Vogel <sv@exept.de>
parents:
7085
diff
changeset
|
3538 |
|newStream table source pos fileName| |
44c02807ca41
More openErrorSignal change preparations
Stefan Vogel <sv@exept.de>
parents:
7085
diff
changeset
|
3539 |
|
617 | 3540 |
" |
3541 |
first, find all methods which contain either a string-ref |
|
3542 |
or an external string in the 'st.src' file |
|
3543 |
" |
|
3544 |
newStream := 'src.tmp' asFilename writeStream. |
|
3545 |
||
3546 |
table := IdentityDictionary new:100. |
|
3547 |
||
3548 |
Method allSubInstancesDo:[:aMethod | |
|
10071 | 3549 |
source := nil. |
3550 |
aMethod sourcePosition notNil ifTrue:[ |
|
3551 |
aMethod sourceFilename = 'st.src' ifTrue:[ |
|
3552 |
source := aMethod source. |
|
3553 |
] |
|
3554 |
] ifFalse:[ |
|
3555 |
source := aMethod source |
|
3556 |
]. |
|
3557 |
||
3558 |
source notNil ifTrue:[ |
|
3559 |
pos := newStream position1Based. |
|
3560 |
newStream nextChunkPut:source. |
|
3561 |
||
3562 |
" |
|
3563 |
dont change the methods info - maybe some write error |
|
3564 |
occurs later, in that case we abort and leave everything |
|
3565 |
untouched. |
|
3566 |
" |
|
3567 |
table at:aMethod put:pos |
|
3568 |
] |
|
617 | 3569 |
]. |
3570 |
||
3571 |
newStream close. |
|
3572 |
||
3573 |
" |
|
3574 |
now, rename the new source file, |
|
3575 |
" |
|
3576 |
fileName := (ObjectMemory nameForSources). |
|
1693 | 3577 |
'src.tmp' asFilename renameTo:fileName. |
617 | 3578 |
|
3579 |
"good - now go over all changed methods, and change their |
|
3580 |
source reference" |
|
3581 |
||
3582 |
table keysAndValuesDo:[:aMethod :pos | |
|
10071 | 3583 |
aMethod localSourceFilename:fileName position:pos. |
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
3584 |
"/ aMethod printCR. |
617 | 3585 |
]. |
3586 |
||
3587 |
" |
|
3588 |
Smalltalk compressSources |
|
3589 |
" |
|
1693 | 3590 |
|
2176
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2170
diff
changeset
|
3591 |
"Modified: 16.1.1997 / 01:25:58 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3592 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3593 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3594 |
generateSingleSourceFile |
7563 | 3595 |
"{ Pragma: +optSpace }" |
3596 |
||
3597 |
"generate the sources file, and remove all method source strings |
|
3044 | 3598 |
from the system and replace them by refs to a string in the source file. |
3599 |
This makes the image independent from the per-class source files |
|
3600 |
and makes transportation of endUser applications easier, since |
|
10071 | 3601 |
only 3 files (executable, image and sourceFile) need to be |
3044 | 3602 |
transported." |
3603 |
||
3604 |
|newStream table source pos fileName| |
|
3605 |
||
3606 |
newStream := 'src.tmp' asFilename writeStream. |
|
3607 |
||
3608 |
table := IdentityDictionary new:100. |
|
3609 |
||
3610 |
Method allSubInstancesDo:[:aMethod | |
|
10071 | 3611 |
source := aMethod source. |
3612 |
source notNil ifTrue:[ |
|
3613 |
pos := newStream position1Based. |
|
3614 |
newStream nextChunkPut:source. |
|
3615 |
||
3616 |
" |
|
3617 |
dont change the methods info - maybe some write error |
|
3618 |
occurs later, in that case we abort and leave everything |
|
3619 |
untouched. |
|
3620 |
" |
|
3621 |
table at:aMethod put:pos |
|
3622 |
] |
|
3044 | 3623 |
]. |
3624 |
||
3625 |
newStream close. |
|
3626 |
||
3627 |
" |
|
3628 |
now, rename the new source file, |
|
3629 |
" |
|
3630 |
fileName := (ObjectMemory nameForSources). |
|
3631 |
'src.tmp' asFilename renameTo:fileName. |
|
3632 |
||
3633 |
"good - now go over all changed methods, and change their |
|
3634 |
source reference" |
|
3635 |
||
3636 |
table keysAndValuesDo:[:aMethod :pos | |
|
10071 | 3637 |
aMethod localSourceFilename:fileName position:pos. |
3044 | 3638 |
"/ aMethod printCR. |
3639 |
]. |
|
3640 |
||
3641 |
" |
|
3642 |
Smalltalk generateSingleSourceFile |
|
3643 |
" |
|
3644 |
||
3645 |
"Modified: 16.1.1997 / 01:25:58 / cg" |
|
3646 |
"Created: 17.10.1997 / 13:00:56 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3647 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3648 |
|
10071 | 3649 |
installAutoloadedClassNamed:clsName category:cat package:package revision:revisionOrNil |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3650 |
"create & install an autoload stub for a class named: clsName, |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3651 |
to be loaded from package. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3652 |
If revisionOrNil is non-nil, set it up to load exactly that revision |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3653 |
(otherwise, the newest revision will be loaded" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3654 |
|
10071 | 3655 |
^ self |
3656 |
installAutoloadedClassNamed:clsName |
|
3657 |
category:cat |
|
3658 |
package:package |
|
3659 |
revision:revisionOrNil |
|
3660 |
numClassInstVars:nil. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3661 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3662 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3663 |
installAutoloadedClassNamed:clsName category:cat package:package revision:revisionOrNil numClassInstVars:numClassInstVarsOrNil |
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3664 |
"create & install an autoload stub for a class named: clsName, |
3915
e32e63ee0d79
extracted autoload-class generation into extra method
Claus Gittinger <cg@exept.de>
parents:
3866
diff
changeset
|
3665 |
to be loaded from package. |
e32e63ee0d79
extracted autoload-class generation into extra method
Claus Gittinger <cg@exept.de>
parents:
3866
diff
changeset
|
3666 |
If revisionOrNil is non-nil, set it up to load exactly that revision |
e32e63ee0d79
extracted autoload-class generation into extra method
Claus Gittinger <cg@exept.de>
parents:
3866
diff
changeset
|
3667 |
(otherwise, the newest revision will be loaded" |
e32e63ee0d79
extracted autoload-class generation into extra method
Claus Gittinger <cg@exept.de>
parents:
3866
diff
changeset
|
3668 |
|
7565 | 3669 |
|clsSym cls| |
3670 |
||
3671 |
clsSym := clsName asSymbol. |
|
3672 |
||
3673 |
"/ install if not already compiled-in |
|
3674 |
(cls := self at:clsSym) isNil ifTrue:[ |
|
10071 | 3675 |
Autoload subclass:clsSym |
3676 |
instanceVariableNames:'' |
|
3677 |
classVariableNames:'' |
|
3678 |
poolDictionaries:'' |
|
3679 |
category:cat |
|
3680 |
inEnvironment:Smalltalk. |
|
3681 |
||
3682 |
cls := self at:clsSym. |
|
3683 |
cls isNil ifTrue:[ |
|
3684 |
('Smalltalk [warning]: failed to install ' , clsName , ' as autoloaded.') infoPrintCR. |
|
3685 |
] ifFalse:[ |
|
3686 |
cls package:package asSymbol. |
|
3687 |
revisionOrNil notNil ifTrue:[ |
|
3688 |
cls setBinaryRevision:revisionOrNil |
|
3689 |
] |
|
3690 |
] |
|
7565 | 3691 |
] ifFalse:[ |
10071 | 3692 |
"/ class already present - however, check for category/package change |
3693 |
package ~= cls package ifTrue:[ |
|
3694 |
cls package:package asSymbol. |
|
3695 |
]. |
|
3696 |
cat ~= cls category ifTrue:[ |
|
3697 |
cls category:cat. |
|
3698 |
]. |
|
8845
17288e4e99eb
remember, where autoload decl came from
Claus Gittinger <cg@exept.de>
parents:
8821
diff
changeset
|
3699 |
]. |
17288e4e99eb
remember, where autoload decl came from
Claus Gittinger <cg@exept.de>
parents:
8821
diff
changeset
|
3700 |
^ cls. |
7565 | 3701 |
|
3702 |
"Created: / 5.11.1998 / 15:10:25 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3703 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3704 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3705 |
installAutoloadedClasses |
7563 | 3706 |
"read the standard abbreviation file; install all classes found there as |
3044 | 3707 |
autoloaded. This takes some time ..." |
3708 |
||
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3709 |
|dirsConsulted p| |
4458 | 3710 |
|
3711 |
"/ new scheme: look for a directory called 'packages' |
|
3712 |
"/ and enumerate its abbrev.stc files... |
|
5067
335c866e150c
walk packagePath when reading abbrevs & autoloaded classes.
Claus Gittinger <cg@exept.de>
parents:
5065
diff
changeset
|
3713 |
dirsConsulted := Set new. |
5162 | 3714 |
|
3715 |
"/ along the package-path |
|
5788 | 3716 |
(p := self packagePath) do:[:aPath | |
10071 | 3717 |
(dirsConsulted includes:aPath) ifFalse:[ |
3718 |
('Smalltalk [info]: installing autoloaded classes found under ''' , aPath ,'''') infoPrintCR. |
|
3719 |
self |
|
3720 |
recursiveInstallAutoloadedClassesFrom:aPath |
|
3721 |
rememberIn:dirsConsulted |
|
3722 |
maxLevels:15 |
|
3723 |
noAutoload:false |
|
3724 |
packageTop:aPath. |
|
3725 |
] |
|
5788 | 3726 |
]. |
3727 |
p size == 0 ifTrue:[ |
|
10071 | 3728 |
'../../../stx' asFilename exists ifTrue:[ |
3729 |
('Smalltalk [info]: installing autoloaded classes found under ''../../..''') infoPrintCR. |
|
3730 |
self |
|
3731 |
recursiveInstallAutoloadedClassesFrom:'../../..' |
|
3732 |
rememberIn:dirsConsulted |
|
3733 |
maxLevels:15 |
|
3734 |
noAutoload:false |
|
3735 |
packageTop:'../../..'. |
|
3736 |
]. |
|
5788 | 3737 |
]. |
3738 |
||
3044 | 3739 |
" |
3740 |
Smalltalk installAutoloadedClasses |
|
3741 |
" |
|
3742 |
||
5096 | 3743 |
"Created: / 14.2.1997 / 17:32:57 / cg" |
3744 |
"Modified: / 13.12.1999 / 11:56:50 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3745 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3746 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3747 |
installAutoloadedClassesFrom:anAbbrevFilePath |
7758 | 3748 |
"read the given abbreviation file; install all classes found there as |
3749 |
autoloaded. This takes some time ..." |
|
3750 |
||
3751 |
|f s| |
|
3752 |
||
3753 |
f := self getSystemFileName:anAbbrevFilePath. |
|
3754 |
f isNil ifTrue:[f := self getPackageFileName:anAbbrevFilePath]. |
|
3755 |
||
3756 |
f notNil ifTrue:[ |
|
10071 | 3757 |
f := f asFilename. |
3758 |
f isDirectory ifTrue:[ |
|
3759 |
f := f construct:'abbrev.stc' |
|
3760 |
]. |
|
3761 |
[ |
|
3762 |
s := f readStream. |
|
3763 |
self installAutoloadedClassesFromStream:s. |
|
3764 |
s close. |
|
3765 |
] on:FileStream openErrorSignal do:[:ex| "do nothing"]. |
|
7758 | 3766 |
] |
3767 |
||
3768 |
" |
|
3769 |
Smalltalk installAutoloadedClassesFrom:'include/abbrev.stc' |
|
3770 |
" |
|
3771 |
||
3772 |
"Modified: / 5.11.1998 / 15:10:51 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3773 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3774 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3775 |
installAutoloadedClassesFromStream:anAbbrevFileStream |
10071 | 3776 |
"read the given abbreviation file; |
7758 | 3777 |
install all classes found there as autoloaded, and also update the |
3778 |
abbreviation (className-to-fileName mapping) table. |
|
3779 |
This takes some time ..." |
|
3780 |
||
8846 | 3781 |
|s2 l abbrevFileName info clsName cls abbrev package cat numClassInstVars words w| |
8845
17288e4e99eb
remember, where autoload decl came from
Claus Gittinger <cg@exept.de>
parents:
8821
diff
changeset
|
3782 |
|
17288e4e99eb
remember, where autoload decl came from
Claus Gittinger <cg@exept.de>
parents:
8821
diff
changeset
|
3783 |
anAbbrevFileStream isFileStream ifTrue:[ |
10071 | 3784 |
abbrevFileName := anAbbrevFileStream pathName. |
3785 |
info := 'declared from: ', abbrevFileName. |
|
8845
17288e4e99eb
remember, where autoload decl came from
Claus Gittinger <cg@exept.de>
parents:
8821
diff
changeset
|
3786 |
]. |
7758 | 3787 |
|
3788 |
KnownPackages isNil ifTrue:[ |
|
10071 | 3789 |
KnownPackages := Set new. |
7758 | 3790 |
]. |
3791 |
||
3792 |
"/ yes, create any required nameSpace, without asking user. |
|
3793 |
Class createNameSpaceQuerySignal answer:true do:[ |
|
3794 |
||
10071 | 3795 |
[anAbbrevFileStream atEnd] whileFalse:[ |
3796 |
l := anAbbrevFileStream nextLine withoutSeparators. |
|
3797 |
l notEmpty ifTrue:[ |
|
3798 |
"/ must do it manually, caring for quoted strings. |
|
7758 | 3799 |
"/ words := line asCollectionOfWords. |
3800 |
||
10071 | 3801 |
words := OrderedCollection new. |
3802 |
s2 := l readStream. |
|
3803 |
[s2 atEnd] whileFalse:[ |
|
3804 |
s2 skipSeparators. |
|
3805 |
s2 peek == $' ifTrue:[ |
|
3806 |
s2 next. |
|
3807 |
w := s2 upTo:$'. |
|
3808 |
s2 skipSeparators. |
|
3809 |
] ifFalse:[ |
|
3810 |
w := s2 upToSeparator |
|
3811 |
]. |
|
3812 |
words add:w |
|
3813 |
]. |
|
3814 |
words size < 3 ifTrue:[ |
|
3815 |
'Smalltalk [warning]: bad abbrev entry' errorPrint. |
|
3816 |
anAbbrevFileStream isFileStream ifTrue:[ |
|
3817 |
' (in ''' errorPrint. |
|
3818 |
anAbbrevFileStream pathName errorPrint. |
|
3819 |
''')' errorPrint |
|
3820 |
]. |
|
3821 |
': ' errorPrint. l errorPrintCR |
|
3822 |
] ifFalse:[ |
|
3823 |
clsName := (words at:1) asSymbol. |
|
3824 |
abbrev := (words at:2). |
|
3825 |
package := (words at:3) asSymbol. |
|
3826 |
cat := words at:4 ifAbsent:nil. |
|
3827 |
numClassInstVars := words at:5 ifAbsent:'0'. |
|
3828 |
numClassInstVars := Integer readFrom:numClassInstVars onError:[0]. |
|
7758 | 3829 |
|
3830 |
"/ KnownPackages add:package. |
|
3831 |
||
10071 | 3832 |
(cat size == 0) ifTrue:[ |
3833 |
cat := 'autoloaded' |
|
3834 |
]. |
|
3835 |
||
3836 |
"/ on the fly, update the abbreviations |
|
3837 |
self setFilename:abbrev forClass:clsName package:package. |
|
3838 |
||
3839 |
"/ ' autoloaded: ' print. clsName print. ' in ' print. cat printCR. |
|
3840 |
||
3841 |
cls := self |
|
3842 |
installAutoloadedClassNamed:clsName |
|
3843 |
category:cat |
|
3844 |
package:package |
|
3845 |
revision:nil |
|
3846 |
numClassInstVars:numClassInstVars. |
|
8845
17288e4e99eb
remember, where autoload decl came from
Claus Gittinger <cg@exept.de>
parents:
8821
diff
changeset
|
3847 |
|
8847 | 3848 |
"/ info notNil ifTrue:[ |
3849 |
"/ cls setComment:info. |
|
3850 |
"/ ]. |
|
10071 | 3851 |
] |
3852 |
] |
|
3853 |
] |
|
4458 | 3854 |
] |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3855 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3856 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3857 |
loadBinaries |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3858 |
"return true, if binaries should be loaded into the system, |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3859 |
false if this should be suppressed. The default is false (for now)." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3860 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3861 |
^ LoadBinaries |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3862 |
! |
3044 | 3863 |
|
7758 | 3864 |
loadBinaries:aBoolean |
3865 |
"{ Pragma: +optSpace }" |
|
3866 |
||
3867 |
"turn on/off loading of binary objects" |
|
3044 | 3868 |
|
3869 |
aBoolean ifTrue:[ |
|
10071 | 3870 |
(ObjectFileLoader notNil and:[ObjectFileLoader canLoadObjectFiles]) ifTrue:[ |
3871 |
LoadBinaries := true. |
|
3872 |
^ self |
|
3873 |
]. |
|
3874 |
'Smalltalk [info]: this system does not support binary loading' infoPrintCR. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3875 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3876 |
LoadBinaries := false |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3877 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3878 |
"Modified: 10.1.1997 / 15:11:00 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3879 |
! |
3044 | 3880 |
|
7758 | 3881 |
logDoits |
3882 |
"return true if doits should go into the changes file |
|
3883 |
as well as changes - by default, this is off, since |
|
3884 |
it can blow up the changes file enormously ... |
|
3885 |
" |
|
3886 |
||
3887 |
^ LogDoits |
|
3888 |
||
3889 |
" |
|
3890 |
LogDoits := false |
|
3044 | 3891 |
LogDoits := true |
3892 |
" |
|
3893 |
! |
|
3894 |
||
7758 | 3895 |
logDoits:aBoolean |
3896 |
"{ Pragma: +optSpace }" |
|
3897 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3898 |
"turn on/off logging of doits in the changes file. |
10071 | 3899 |
By default, this is off, since it can blow up the |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3900 |
changes file enormously ... |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3901 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3902 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3903 |
LogDoits := aBoolean |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3904 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3905 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3906 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3907 |
makeBytecodeMethods |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3908 |
"{ Pragma: +optSpace }" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3909 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3910 |
"walk over all methods and make each a bytecode method |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3911 |
iff it does not contain primitive C code. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3912 |
Experimental and not yet used." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3913 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3914 |
Method allSubInstancesDo:[:aMethod | |
10071 | 3915 |
|newMethod| |
3916 |
||
3917 |
aMethod hasPrimitiveCode ifFalse:[ |
|
3918 |
newMethod := aMethod asByteCodeMethod. |
|
3919 |
newMethod ~~ aMethod ifTrue:[ |
|
3920 |
aMethod becomeSameAs:newMethod |
|
3921 |
] |
|
3922 |
]. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3923 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3924 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3925 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3926 |
Smalltalk makeBytecodeMethods |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3927 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3928 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3929 |
"Modified: 16.1.1997 / 01:25:58 / cg" |
7758 | 3930 |
"Created: 17.10.1997 / 13:52:19 / cg" |
3931 |
! |
|
3932 |
||
3933 |
recursiveInstallAutoloadedClassesFrom:aDirectory rememberIn:dirsConsulted maxLevels:maxLevels noAutoload:noAutoloadIn packageTop:packageTopPath |
|
3934 |
"read all abbrev.stc files from and under aDirectory |
|
3935 |
and install autoloaded classes. |
|
3936 |
If a file called NOAUTOLOAD is found, no classes there and below are installed as autoloaded |
|
3937 |
(however, the directories are searched for packages) |
|
3938 |
If a file called NOPACKAGES is found, no further searching is done in that directory or below." |
|
3939 |
||
3940 |
|abbrevStream dir noAutoloadHere dirName pkgName directoryContents| |
|
3941 |
||
3942 |
maxLevels == 0 ifTrue:[ |
|
3943 |
"/ 'Smalltalk [warning]: max directory nesting reached.' infoPrintCR. |
|
10071 | 3944 |
^ self |
7758 | 3945 |
]. |
3946 |
||
3947 |
dir := aDirectory asFilename. |
|
3948 |
||
3949 |
(dirsConsulted includes:dir pathName) ifTrue:[ |
|
10071 | 3950 |
^ self |
7758 | 3951 |
]. |
3952 |
dirsConsulted add:dir pathName. |
|
3953 |
||
3954 |
(dir construct:'NOPACKAGES') exists ifTrue:[ |
|
10071 | 3955 |
^ self. |
7758 | 3956 |
]. |
3957 |
(dir construct:'NOSUBAUTOLOAD') exists ifTrue:[ |
|
10071 | 3958 |
^ self. |
7758 | 3959 |
]. |
3960 |
noAutoloadHere := noAutoloadIn. |
|
3961 |
noAutoloadHere ifFalse:[ |
|
10071 | 3962 |
(dir construct:'NOAUTOLOAD') exists ifTrue:[ |
3963 |
noAutoloadHere := true. |
|
3964 |
]. |
|
7758 | 3965 |
] ifTrue:[ |
10071 | 3966 |
(dir construct:'AUTOLOAD') exists ifTrue:[ |
3967 |
noAutoloadHere := false. |
|
3968 |
]. |
|
7758 | 3969 |
]. |
3970 |
||
3971 |
((dir construct:'loadAll') exists |
|
3972 |
or:[(dir construct:'abbrev.stc') exists |
|
3973 |
or:[(dir construct:(dir baseName , '.prj')) exists]]) ifTrue:[ |
|
10071 | 3974 |
KnownPackages isNil ifTrue:[ |
3975 |
KnownPackages := Set new. |
|
3976 |
]. |
|
3977 |
dirName := dir pathName. |
|
3978 |
pkgName := dirName copyFrom:(packageTopPath asFilename pathName) size + 1 + 1. |
|
3979 |
KnownPackages add:pkgName |
|
7758 | 3980 |
]. |
3981 |
||
3982 |
"/ |
|
3983 |
"/ suppress installation as autoloaded in this and everything |
|
3984 |
"/ below; however, still traverse the directories to find packages ... |
|
3985 |
"/ |
|
3986 |
noAutoloadHere ifFalse:[ |
|
10071 | 3987 |
[ |
3988 |
abbrevStream := (dir construct:'abbrev.stc') asFilename readStream. |
|
3989 |
self installAutoloadedClassesFromStream:abbrevStream. |
|
3990 |
abbrevStream close. |
|
3991 |
] on:FileStream openErrorSignal do:[:ex| "ignore this file"]. |
|
7085
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3992 |
]. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3993 |
|
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3994 |
[ |
10071 | 3995 |
directoryContents := dir directoryContents. |
7085
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3996 |
] on:FileStream openErrorSignal do:[:ex| |
10071 | 3997 |
"non-accessable directory: we are done" |
3998 |
^ self |
|
7085
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
3999 |
]. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
4000 |
|
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
4001 |
directoryContents do:[:aFilename | |
10071 | 4002 |
|f| |
4003 |
||
4004 |
(#( |
|
4005 |
'objbc' |
|
4006 |
'doc' |
|
4007 |
'CVS' |
|
4008 |
'bitmaps' |
|
4009 |
'resources' |
|
4010 |
'source' |
|
4011 |
'not_delivered' |
|
4012 |
'not_ported' |
|
4013 |
) includes:aFilename) ifFalse:[ |
|
4014 |
((dir baseName ~= 'stx') |
|
4015 |
or:[ |
|
4016 |
(#( |
|
4017 |
'configurations' |
|
4018 |
'include' |
|
4019 |
'rules' |
|
4020 |
'stc' |
|
4021 |
'support' |
|
4022 |
) includes:aFilename) not]) |
|
4023 |
ifTrue:[ |
|
4024 |
f := dir construct:aFilename. |
|
4025 |
f isDirectory ifTrue:[ |
|
4026 |
self |
|
4027 |
recursiveInstallAutoloadedClassesFrom:f |
|
4028 |
rememberIn:dirsConsulted |
|
4029 |
maxLevels:maxLevels-1 |
|
4030 |
noAutoload:noAutoloadHere |
|
4031 |
packageTop:packageTopPath. |
|
4032 |
] |
|
4033 |
] |
|
4034 |
]. |
|
4458 | 4035 |
]. |
4036 |
||
5117 | 4037 |
" |
4038 |
Smalltalk installAutoloadedClasses |
|
4039 |
" |
|
9550 | 4040 |
|
9565 | 4041 |
"Modified: / 17-08-2006 / 16:48:43 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4042 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4043 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4044 |
replaceReferencesTo:anObject with:newRef |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4045 |
|toAdd| |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4046 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4047 |
toAdd := OrderedCollection new. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4048 |
self keysAndValuesDo:[:key :val | |
10071 | 4049 |
(key == anObject) ifTrue:[ |
4050 |
self shouldImplement. |
|
4051 |
]. |
|
4052 |
(val == anObject ) ifTrue:[ |
|
4053 |
toAdd add:(key -> newRef) |
|
4054 |
]. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4055 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4056 |
toAdd do:[:each | |
10071 | 4057 |
self at:(each key) put:(each value) |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4058 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4059 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4060 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4061 |
saveEmergencyImage:aBoolean |
7758 | 4062 |
"set/clear the flag which controls if ST/X should save an |
4063 |
emergency image in case of a broken display connection. |
|
4064 |
The default is true. |
|
4065 |
This may be useful, if you work with an unsecure display |
|
4066 |
(serial line), and want to have a chance of proceeding after |
|
10071 | 4067 |
a crash. In multiheaded applications, this only affects |
7758 | 4068 |
crashes of the master Display connection (the initial connection); |
4069 |
errors on other displays are reported to the views and treated |
|
4070 |
like window destroy from the windowManager." |
|
3062
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
4071 |
|
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
4072 |
SaveEmergencyImage := aBoolean |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
4073 |
|
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
4074 |
"Modified: / 24.10.1997 / 18:22:26 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4075 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4076 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4077 |
systemOrganization |
7758 | 4078 |
"for partial ST80 compatibility; |
4079 |
In ST80, Smalltalk organization returns a systemOrganizer, which |
|
4080 |
keeps track of class-categories, while all classes return a classOrganizer |
|
4081 |
from #organization, which keeps track of method categories of that class. |
|
4082 |
Since in ST/X, Smalltalk is a class, there is now a conflict. |
|
4083 |
To make a workaround possible, use #systemOrganization when porting |
|
4084 |
VW apps to ST/X to get the class-categories. |
|
4085 |
Read the documentation in SystemOrganizer for more info." |
|
3626
5a69787e857c
added hook make apps VW compatible w.r.t. system-organizaton.
Claus Gittinger <cg@exept.de>
parents:
3624
diff
changeset
|
4086 |
|
5a69787e857c
added hook make apps VW compatible w.r.t. system-organizaton.
Claus Gittinger <cg@exept.de>
parents:
3624
diff
changeset
|
4087 |
^ SystemOrganizer for:nil |
5a69787e857c
added hook make apps VW compatible w.r.t. system-organizaton.
Claus Gittinger <cg@exept.de>
parents:
3624
diff
changeset
|
4088 |
|
5a69787e857c
added hook make apps VW compatible w.r.t. system-organizaton.
Claus Gittinger <cg@exept.de>
parents:
3624
diff
changeset
|
4089 |
"Created: / 20.6.1998 / 12:24:02 / cg" |
5a69787e857c
added hook make apps VW compatible w.r.t. system-organizaton.
Claus Gittinger <cg@exept.de>
parents:
3624
diff
changeset
|
4090 |
"Modified: / 20.6.1998 / 12:41:34 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4091 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4092 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4093 |
!Smalltalk class methodsFor:'system management-fileIn'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4094 |
|
7758 | 4095 |
fileIn:aFileName |
4096 |
"read in the named file - look for it in some standard places; |
|
4097 |
return true if ok, false if failed. |
|
4098 |
This method can load almost anything which makes sense: |
|
10071 | 4099 |
.st - source files |
4100 |
.cls - binary smalltalk bytecode files |
|
4101 |
.so - binary compiled machine code class libraries |
|
4102 |
[.class - java bytecode -- soon to come]" |
|
4103 |
||
4104 |
^ self fileIn:aFileName lazy:nil silent:nil logged:false |
|
3044 | 4105 |
|
4106 |
" |
|
4107 |
Smalltalk fileIn:'source/TicTacToe.st' |
|
4712 | 4108 |
Smalltalk fileIn:'binary/TicTacToe.cls' |
4109 |
Smalltalk fileIn:'binary/TicTacToe.so' |
|
3044 | 4110 |
" |
4111 |
||
4112 |
"Created: 28.10.1995 / 17:06:28 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4113 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4114 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4115 |
fileIn:aFileName inPackage:aPackageID |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4116 |
"read in the named file in a packages directory." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4117 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4118 |
|dir| |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4119 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4120 |
dir := self getPackageDirectoryForPackage:aPackageID. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4121 |
dir isNil ifTrue:[^ false]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4122 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4123 |
dir := dir asFilename. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4124 |
^ (self fileIn:(dir construct:aFileName)) |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4125 |
or:[ self fileIn:((dir construct:'source') construct:aFileName) ] |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4126 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4127 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4128 |
fileIn:aFileName lazy:lazy |
7758 | 4129 |
"read in the named file - look for it in some standard places; |
4130 |
return true if ok, false if failed. |
|
4131 |
If lazy is true, no code is generated for methods, instead stubs |
|
4132 |
are created which compile themself when first executed. This allows |
|
4133 |
for much faster fileIn (but slows down the first execution later). |
|
4134 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
4135 |
code which is known to be syntactically correct." |
|
4136 |
||
10071 | 4137 |
^ self fileIn:aFileName lazy:lazy silent:nil logged:false |
7758 | 4138 |
|
4139 |
" |
|
4140 |
Smalltalk fileIn:'source/TicTacToe.st' lazy:true |
|
3044 | 4141 |
" |
4142 |
||
4143 |
"Created: 28.10.1995 / 17:06:36 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4144 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4145 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4146 |
fileIn:aFileName lazy:lazy silent:silent |
7758 | 4147 |
"read in the named file - look for it in some standard places; |
4148 |
return true if ok, false if failed. |
|
4149 |
If lazy is true, no code is generated for methods, instead stubs |
|
4150 |
are created which compile themself when first executed. This allows |
|
4151 |
for much faster fileIn (but slows down the first execution later). |
|
4152 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
4153 |
code which is known to be syntactically correct. |
|
4154 |
If silent is true, no compiler messages are output to the transcript. |
|
4155 |
Giving nil for silent/lazy will use the current settings." |
|
4156 |
||
4157 |
^ self fileIn:aFileName lazy:lazy silent:silent logged:false |
|
4158 |
||
4159 |
"Created: 28.10.1995 / 17:06:41 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4160 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4161 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4162 |
fileIn:aFileNameOrString lazy:lazy silent:silent logged:logged |
7758 | 4163 |
"read in the named file - look for it in some standard places; |
4164 |
return true if ok, false if failed. |
|
4165 |
If lazy is true, no code is generated for methods, instead stubs |
|
4166 |
are created which compile themself when first executed. This allows |
|
4167 |
for much faster fileIn (but slows down the first execution later). |
|
4168 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
4169 |
code which is known to be syntactically correct. |
|
4170 |
If silent is true, no compiler messages are output to the transcript. |
|
4171 |
Giving nil for silent/lazy will use the current settings. |
|
4172 |
This method can load almost anything which makes sense: |
|
10071 | 4173 |
.st - source files |
4174 |
.cls - binary smalltalk bytecode files |
|
4175 |
.so - binary compiled machine code class libraries |
|
4176 |
[.class - java bytecode -- soon to come]" |
|
7758 | 4177 |
|
4178 |
|fileNameString aStream path morePath bos| |
|
4179 |
||
4180 |
fileNameString := aFileNameOrString asString. |
|
4181 |
||
4182 |
" |
|
4183 |
an object or shared object ? |
|
4184 |
" |
|
4185 |
(ObjectFileLoader notNil |
|
4186 |
and:[ObjectFileLoader hasValidBinaryExtension:fileNameString]) ifTrue:[ |
|
10071 | 4187 |
"/ LoadBinaries ifFalse:[^ false]. |
4188 |
path := self getBinaryFileName:fileNameString. |
|
4189 |
path isNil ifTrue:[ |
|
4190 |
path := self getSystemFileName:fileNameString. |
|
4191 |
]. |
|
4192 |
path isNil ifTrue:[^ false]. |
|
4193 |
^ (ObjectFileLoader loadObjectFile:path) notNil |
|
7758 | 4194 |
]. |
4195 |
||
4196 |
(fileNameString asFilename hasSuffix:'cls') ifTrue:[ |
|
10071 | 4197 |
BinaryObjectStorage notNil ifTrue:[ |
4198 |
aStream := self systemFileStreamFor:fileNameString. |
|
7758 | 4199 |
"/ path := self getBinaryFileName:fileNameString. |
4200 |
"/ path isNil ifTrue:[^ false]. |
|
4201 |
"/ aStream := path asFilename readStream. |
|
10071 | 4202 |
aStream notNil ifTrue:[ |
4203 |
aStream binary. |
|
4204 |
bos := BinaryObjectStorage onOld:aStream. |
|
4205 |
bos next. |
|
4206 |
bos close. |
|
4207 |
^ true |
|
4208 |
]. |
|
4209 |
^ false |
|
4210 |
] |
|
7758 | 4211 |
]. |
4212 |
||
9837 | 4213 |
aStream := self systemFileStreamFor:fileNameString. |
3044 | 4214 |
aStream isNil ifTrue:[^ false]. |
9837 | 4215 |
|
4216 |
(fileNameString includes:$/) ifTrue:[ |
|
10071 | 4217 |
"/ temporarily prepend the files directory |
4218 |
"/ to the searchPath. |
|
4219 |
"/ This allows fileIn-driver files to refer to local |
|
4220 |
"/ files via a relative path, and drivers to fileIn other |
|
4221 |
"/ drivers ... |
|
4222 |
morePath := aStream pathName asFilename directoryName. |
|
9837 | 4223 |
]. |
3044 | 4224 |
^ self fileInStream:aStream lazy:lazy silent:silent logged:logged addPath:morePath |
4225 |
||
4226 |
" |
|
4227 |
Smalltalk fileIn:'source/TicTacToe.st' lazy:true silent:true |
|
4228 |
" |
|
4229 |
||
9837 | 4230 |
"Modified: / 08-09-2006 / 19:21:16 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4231 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4232 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4233 |
fileIn:aFileName logged:logged |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4234 |
"read in the named file - look for it in some standard places; |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4235 |
return true if ok, false if failed. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4236 |
The argument logged controls, if the changefile is to be updated." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4237 |
|
10071 | 4238 |
^ self fileIn:aFileName lazy:nil silent:nil logged:logged |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4239 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4240 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4241 |
Smalltalk fileIn:'source/TicTacToe.st' logged:false |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4242 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4243 |
! |
7758 | 4244 |
|
4245 |
fileInChanges |
|
4246 |
"read in the last changes file - bringing the system to the state it |
|
70 | 4247 |
had when left the last time. |
4248 |
WARNING: this method is rubbish: it should only read things after the |
|
10071 | 4249 |
last '**snapshot**' - entry |
4250 |
(instead of the complete changes file)." |
|
1 | 4251 |
|
70 | 4252 |
" |
400 | 4253 |
do NOT update the changes file now ... |
70 | 4254 |
" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4255 |
self fileIn:ChangeFileName logged:false |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4256 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4257 |
" |
10071 | 4258 |
Smalltalk fileInChanges |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4259 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4260 |
! |
1 | 4261 |
|
7758 | 4262 |
fileInClass:aClassName |
4263 |
"find a source/object file for aClassName and -if found - load it. |
|
10071 | 4264 |
search is in some standard places trying driver-file (.ld), object-file (.o) and |
7758 | 4265 |
finally source file (.st) in that order. |
4266 |
The file is first searched for using the class name, then the abbreviated name." |
|
4267 |
||
10071 | 4268 |
^ self |
4269 |
fileInClass:aClassName |
|
4270 |
package:nil |
|
4271 |
initialize:true |
|
4272 |
lazy:false |
|
4273 |
silent:nil |
|
7758 | 4274 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4275 |
"Modified: / 9.1.1998 / 14:41:46 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4276 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4277 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4278 |
fileInClass:aClassName fromObject:aFileName |
7758 | 4279 |
"read in the named object file and dynamic-link it into the system |
3044 | 4280 |
- look for it in some standard places. |
4281 |
Only install the named class from this object file. |
|
4282 |
Return true if ok, false if failed." |
|
4283 |
||
4284 |
|path ok| |
|
4285 |
||
4286 |
" |
|
4287 |
check if the dynamic loader class is in |
|
4288 |
" |
|
4289 |
(LoadBinaries not or:[ObjectFileLoader isNil]) ifTrue:[^ false]. |
|
4290 |
||
4291 |
(path := self getBinaryFileName:aFileName) isNil ifTrue:[^ false]. |
|
4292 |
ok := (ObjectFileLoader loadClass:aClassName fromObjectFile:path) notNil. |
|
4293 |
ok ifTrue:[ |
|
10071 | 4294 |
SilentLoading ifFalse:[ |
4295 |
Transcript show:' loaded ' , aClassName , ' from ' ; showCR:aFileName. |
|
4296 |
] |
|
3044 | 4297 |
]. |
4298 |
^ ok |
|
4299 |
||
4300 |
" |
|
10071 | 4301 |
Smalltalk fileInClass:'AbstractPath' fromObject:'../../goodies/Paths/AbstrPath.so' |
4302 |
Smalltalk fileInClass:'ClockView' fromObject:'../../libwidg3/libwidg3.so' |
|
3044 | 4303 |
" |
4304 |
||
4305 |
"Modified: 10.9.1996 / 20:43:52 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4306 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4307 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4308 |
fileInClass:aClassName initialize:doInit |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4309 |
"find a source/object file for aClassName and -if found - load it. |
10071 | 4310 |
search is in some standard places trying driver-file (.ld), object-file (.o) and |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4311 |
finally source file (.st) in that order. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4312 |
The file is first searched for using the class name, then the abbreviated name." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4313 |
|
10071 | 4314 |
^ self |
4315 |
fileInClass:aClassName |
|
4316 |
package:nil |
|
4317 |
initialize:doInit |
|
4318 |
lazy:false |
|
4319 |
silent:nil |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4320 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4321 |
"Modified: / 9.1.1998 / 14:42:02 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4322 |
! |
3044 | 4323 |
|
7758 | 4324 |
fileInClass:aClassName initialize:doInit lazy:loadLazy |
4325 |
"find a source/object file for aClassName and -if found - load it. |
|
10071 | 4326 |
search is in some standard places trying driver-file (.ld), object-file (.o) and |
7758 | 4327 |
finally source file (.st) in that order. |
4328 |
The file is first searched for using the class name, then the abbreviated name." |
|
4329 |
||
10071 | 4330 |
^ self |
4331 |
fileInClass:aClassName |
|
4332 |
package:nil |
|
4333 |
initialize:doInit |
|
4334 |
lazy:loadLazy |
|
4335 |
silent:nil |
|
7758 | 4336 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4337 |
"Modified: / 9.1.1998 / 14:42:19 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4338 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4339 |
|
10071 | 4340 |
fileInClass:aClassName initialize:doInit lazy:loadLazy silent:beSilent |
7563 | 4341 |
"find a source/object file for aClassName and -if found - load it. |
10071 | 4342 |
Search is in some standard places, trying driver-file (.ld), object-file (.so / .o) and |
3155
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
4343 |
finally source file (.st), in that order. |
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
4344 |
The file is first searched for using the class name, then the abbreviated name. |
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
4345 |
The argument doInit controlls if the class should be sent a #initialize after the |
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
4346 |
load; loadLazy tells if it should be loaded lazyly. beSilent tells if the compiler |
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
4347 |
should not send notes to the transcript; it can be true, false or nil, where |
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
4348 |
nil uses the value from SilentLoading." |
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
4349 |
|
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
4350 |
^ self |
10071 | 4351 |
fileInClass:aClassName |
4352 |
package:nil |
|
4353 |
initialize:doInit |
|
4354 |
lazy:loadLazy |
|
4355 |
silent:beSilent |
|
3155
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
4356 |
|
35befc38f4f1
added package-argument to fileIn methods.
Claus Gittinger <cg@exept.de>
parents:
3096
diff
changeset
|
4357 |
"Modified: / 9.1.1998 / 14:42:28 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4358 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4359 |
|
10071 | 4360 |
fileInClass:aClassName package:package initialize:doInit lazy:loadLazy silent:beSilent |
7758 | 4361 |
"find a source/object file for aClassName and -if found - load it. |
4362 |
This is the workhorse for autoloading. |
|
10071 | 4363 |
Search is in some standard places, trying driver-file (.ld), object-file (.so / .o) and |
7758 | 4364 |
finally source file (.st), in that order. |
4365 |
The file is first searched for using the class name, then the abbreviated name. |
|
4366 |
The argument doInit controlls if the class should be sent a #initialize after the |
|
4367 |
load; loadLazy tells if it should be loaded lazyly. beSilent tells if the compiler |
|
4368 |
should not send notes to the transcript; it can be true, false or nil, where |
|
4369 |
nil uses the value from SilentLoading." |
|
4370 |
||
10071 | 4371 |
|classFileName alternativeClassFileName libName newClass ok wasLazy wasSilent sharedLibExtension inStream mgr |
10051 | 4372 |
fn packageDir packageFile bos hasSuffix classFilenameWithSuffix classFilenameWithoutSuffix| |
7758 | 4373 |
|
4374 |
wasLazy := Compiler compileLazy:loadLazy. |
|
4375 |
beSilent notNil ifTrue:[ |
|
10071 | 4376 |
wasSilent := self silentLoading:beSilent. |
7763 | 4377 |
]. |
4378 |
||
4379 |
classFileName := Smalltalk fileNameForClass:aClassName. |
|
4380 |
(classFileName = aClassName) ifTrue:[ |
|
10071 | 4381 |
"/ no abbrev.stc translation for className |
4382 |
(aClassName includes:$:) ifTrue:[ |
|
4383 |
"/ a nameSpace name |
|
4384 |
alternativeClassFileName := classFileName copyFrom:(classFileName lastIndexOf:$:)+1 |
|
4385 |
]. |
|
7763 | 4386 |
]. |
4387 |
||
10051 | 4388 |
hasSuffix := classFileName asFilename suffix notEmptyOrNil. |
4389 |
hasSuffix ifTrue:[ |
|
10071 | 4390 |
classFilenameWithoutSuffix := classFileName asFilename withoutSuffix name. |
4391 |
classFilenameWithSuffix := classFileName. |
|
10051 | 4392 |
] ifFalse:[ |
10071 | 4393 |
classFilenameWithoutSuffix := classFileName. |
4394 |
classFilenameWithSuffix := classFileName,'.st'. |
|
10051 | 4395 |
]. |
4396 |
||
9598 | 4397 |
classFileName asFilename isAbsolute ifTrue:[ |
10071 | 4398 |
ok := self fileIn:classFilenameWithSuffix lazy:loadLazy silent:beSilent. |
9598 | 4399 |
] ifFalse:[ |
4400 |
||
10071 | 4401 |
classFileName := classFileName copyReplaceAll:$: with:$_. |
4402 |
||
4403 |
[ |
|
4404 |
Class withoutUpdatingChangesDo: |
|
4405 |
[ |
|
4406 |
|zarFn zar entry| |
|
4407 |
||
4408 |
ok := false. |
|
4409 |
||
4410 |
package notNil ifTrue:[ |
|
4411 |
packageDir := package asString. |
|
4412 |
packageDir := packageDir copyReplaceAll:$: with:$/. |
|
4413 |
]. |
|
4414 |
||
4415 |
Class packageQuerySignal answer:package |
|
4416 |
do:[ |
|
4417 |
||
4418 |
" |
|
4419 |
then, if dynamic linking is available, |
|
4420 |
" |
|
4421 |
(LoadBinaries and:[ObjectFileLoader notNil]) ifTrue:[ |
|
4422 |
sharedLibExtension := ObjectFileLoader sharedLibraryExtension. |
|
4423 |
||
4424 |
" |
|
4425 |
first look for a class packages shared binary in binary/xxx.o |
|
4426 |
" |
|
4427 |
libName := self libraryFileNameOfClass:aClassName. |
|
4428 |
libName notNil ifTrue:[ |
|
4429 |
(ok := self fileInClass:aClassName fromObject:(libName, sharedLibExtension)) |
|
4430 |
ifFalse:[ |
|
4431 |
sharedLibExtension ~= '.o' ifTrue:[ |
|
4432 |
ok := self fileInClass:aClassName fromObject:(libName, '.o') |
|
4433 |
] |
|
4434 |
]. |
|
4435 |
]. |
|
4436 |
||
4437 |
" |
|
4438 |
then, look for a shared binary in binary/xxx.o |
|
4439 |
" |
|
4440 |
ok ifFalse:[ |
|
4441 |
(ok := self fileInClass:aClassName fromObject:(classFilenameWithoutSuffix, sharedLibExtension)) |
|
4442 |
ifFalse:[ |
|
4443 |
sharedLibExtension ~= '.o' ifTrue:[ |
|
4444 |
ok := self fileInClass:aClassName fromObject:(classFilenameWithoutSuffix, '.o') |
|
4445 |
]. |
|
4446 |
ok ifFalse:[ |
|
4447 |
alternativeClassFileName notNil ifTrue:[ |
|
4448 |
(ok := self fileInClass:aClassName fromObject:(alternativeClassFileName, sharedLibExtension)) |
|
4449 |
ifFalse:[ |
|
4450 |
sharedLibExtension ~= '.o' ifTrue:[ |
|
4451 |
ok := self fileInClass:aClassName fromObject:(alternativeClassFileName, '.o') |
|
4452 |
] |
|
4453 |
] |
|
4454 |
]. |
|
4455 |
]. |
|
4456 |
]. |
|
4457 |
]. |
|
4458 |
]. |
|
4459 |
||
4460 |
" |
|
4461 |
if that did not work, look for a compiled-bytecode file ... |
|
4462 |
" |
|
4463 |
ok ifFalse:[ |
|
4464 |
(ok := self fileIn:(classFilenameWithoutSuffix , '.cls') lazy:loadLazy silent:beSilent) |
|
4465 |
ifFalse:[ |
|
4466 |
alternativeClassFileName notNil ifTrue:[ |
|
4467 |
ok := self fileIn:(alternativeClassFileName , '.cls') lazy:loadLazy silent:beSilent |
|
4468 |
] |
|
4469 |
] |
|
4470 |
]. |
|
4471 |
" |
|
4472 |
if that did not work, and the classes package is known, |
|
4473 |
look for an st-cls file |
|
4474 |
in a package subdir of the source-directory ... |
|
4475 |
" |
|
4476 |
ok ifFalse:[ |
|
4477 |
(packageDir notNil and:[BinaryObjectStorage notNil]) ifTrue:[ |
|
4478 |
packageFile := self getPackageFileName:(packageDir , '/classes/' , classFilenameWithoutSuffix , '.cls'). |
|
4479 |
packageFile isNil ifTrue:[ |
|
4480 |
packageFile := (packageDir , '/classes/' , classFilenameWithoutSuffix , '.cls'). |
|
4481 |
]. |
|
4482 |
(ok := self fileIn:packageFile lazy:loadLazy silent:beSilent) |
|
4483 |
ifFalse:[ |
|
4484 |
alternativeClassFileName notNil ifTrue:[ |
|
4485 |
packageFile := self getPackageFileName:(packageDir , '/classes/' , alternativeClassFileName , '.cls'). |
|
4486 |
packageFile isNil ifTrue:[ |
|
4487 |
packageFile := (packageDir , '/classes/' , alternativeClassFileName , '.cls'). |
|
4488 |
]. |
|
4489 |
ok := self fileIn:packageFile lazy:loadLazy silent:beSilent |
|
4490 |
] |
|
4491 |
]. |
|
4492 |
||
4493 |
zarFn := self getPackageFileName:(packageDir , '/classes.zip'). |
|
4494 |
zarFn notNil ifTrue:[ |
|
4495 |
zar := ZipArchive oldFileNamed:zarFn. |
|
4496 |
zar notNil ifTrue:[ |
|
4497 |
entry := zar extract:(classFilenameWithoutSuffix , '.cls'). |
|
4498 |
(entry isNil and:[alternativeClassFileName notNil]) ifTrue:[ |
|
4499 |
entry := zar extract:(alternativeClassFileName , '.cls'). |
|
4500 |
]. |
|
4501 |
entry notNil ifTrue:[ |
|
4502 |
bos := BinaryObjectStorage onOld:(entry asByteArray readStream). |
|
4503 |
bos next. |
|
4504 |
bos close. |
|
4505 |
ok := true |
|
4506 |
]. |
|
4507 |
] |
|
4508 |
] |
|
4509 |
] |
|
4510 |
]. |
|
4511 |
||
4512 |
" |
|
4513 |
if that did not work, look for an st-source file ... |
|
4514 |
" |
|
4515 |
ok ifFalse:[ |
|
4516 |
fn := classFilenameWithoutSuffix , '.st'. |
|
4517 |
(ok := self fileIn:fn lazy:loadLazy silent:beSilent) |
|
4518 |
ifFalse:[ |
|
4519 |
alternativeClassFileName notNil ifTrue:[ |
|
4520 |
fn := alternativeClassFileName , '.st'. |
|
4521 |
ok := self fileIn:fn lazy:loadLazy silent:beSilent |
|
4522 |
]. |
|
4523 |
ok ifFalse:[ |
|
4524 |
" |
|
4525 |
... and in the standard source-directory |
|
4526 |
" |
|
4527 |
fn := 'source/' , classFilenameWithoutSuffix , '.st'. |
|
4528 |
(ok := self fileIn:fn lazy:loadLazy silent:beSilent) |
|
4529 |
ifFalse:[ |
|
4530 |
alternativeClassFileName notNil ifTrue:[ |
|
4531 |
fn := 'source/' , alternativeClassFileName , '.st'. |
|
4532 |
ok := self fileIn:fn lazy:loadLazy silent:beSilent |
|
4533 |
] |
|
4534 |
] |
|
4535 |
] |
|
4536 |
]. |
|
4537 |
" |
|
4538 |
if that did not work, and the classes package is known, |
|
4539 |
look for an st-source file |
|
4540 |
in a package subdir of the source-directory ... |
|
4541 |
" |
|
4542 |
ok ifFalse:[ |
|
4543 |
packageDir notNil ifTrue:[ |
|
4544 |
packageFile := self getPackageFileName:(packageDir , '/source/' , classFilenameWithoutSuffix , '.st'). |
|
4545 |
packageFile isNil ifTrue:[ |
|
4546 |
packageFile := (packageDir , '/source/' , classFilenameWithoutSuffix , '.st'). |
|
4547 |
]. |
|
4548 |
fn := packageFile. |
|
4549 |
(ok := self fileIn:packageFile lazy:loadLazy silent:beSilent) |
|
4550 |
ifFalse:[ |
|
4551 |
alternativeClassFileName notNil ifTrue:[ |
|
4552 |
packageFile := self getPackageFileName:(packageDir , '/source/' , alternativeClassFileName , '.st'). |
|
4553 |
packageFile isNil ifTrue:[ |
|
4554 |
packageFile := (packageDir , '/source/' , alternativeClassFileName , '.st'). |
|
4555 |
]. |
|
4556 |
fn := packageFile. |
|
4557 |
ok := self fileIn:packageFile lazy:loadLazy silent:beSilent |
|
4558 |
]. |
|
4559 |
ok ifFalse:[ |
|
4560 |
||
4561 |
packageFile := self getPackageFileName:(packageDir , '/' , classFilenameWithoutSuffix , '.st'). |
|
4562 |
packageFile isNil ifTrue:[ |
|
4563 |
packageFile := (packageDir , '/' , classFilenameWithoutSuffix , '.st'). |
|
4564 |
]. |
|
4565 |
fn := packageFile. |
|
4566 |
(ok := self fileIn:packageFile lazy:loadLazy silent:beSilent) |
|
4567 |
ifFalse:[ |
|
4568 |
alternativeClassFileName notNil ifTrue:[ |
|
4569 |
packageFile := self getPackageFileName:(packageDir , '/' , alternativeClassFileName , '.st'). |
|
4570 |
packageFile isNil ifTrue:[ |
|
4571 |
packageFile := (packageDir , '/' , alternativeClassFileName , '.st'). |
|
4572 |
]. |
|
4573 |
fn := packageFile. |
|
4574 |
ok := self fileIn:packageFile lazy:loadLazy silent:beSilent |
|
4575 |
]. |
|
4576 |
ok ifFalse:[ |
|
4577 |
" |
|
4578 |
... and in the standard source-directory |
|
4579 |
" |
|
4580 |
fn := 'source/' , packageDir , '/' , classFilenameWithoutSuffix , '.st'. |
|
4581 |
(ok := self fileIn:fn lazy:loadLazy silent:beSilent) |
|
4582 |
ifFalse:[ |
|
4583 |
alternativeClassFileName notNil ifTrue:[ |
|
4584 |
fn := 'source/' , packageDir , '/' , alternativeClassFileName , '.st'. |
|
4585 |
ok := self fileIn:fn lazy:loadLazy silent:beSilent |
|
4586 |
] |
|
4587 |
] |
|
4588 |
] |
|
4589 |
]. |
|
4590 |
]. |
|
4591 |
]. |
|
4592 |
] |
|
4593 |
]. |
|
4594 |
" |
|
4595 |
if that did not work, and the classes package is known, |
|
4596 |
look for a zipArchive containing a class entry. |
|
4597 |
" |
|
4598 |
ok ifFalse:[ |
|
4599 |
packageDir notNil ifTrue:[ |
|
4600 |
zarFn := self getPackageFileName:(packageDir , '/source.zip'). |
|
4601 |
zarFn isNil ifTrue:[ |
|
4602 |
zarFn := packageDir asFilename withSuffix:'zip'. |
|
4603 |
zarFn := self getSourceFileName:zarFn. |
|
4604 |
]. |
|
4605 |
zarFn notNil ifTrue:[ |
|
4606 |
zar := ZipArchive oldFileNamed:zarFn. |
|
4607 |
zar notNil ifTrue:[ |
|
4608 |
entry := zar extract:(classFilenameWithoutSuffix , '.st'). |
|
4609 |
(entry isNil and:[alternativeClassFileName notNil]) ifTrue:[ |
|
4610 |
entry := zar extract:(alternativeClassFileName , '.st'). |
|
4611 |
]. |
|
4612 |
entry notNil ifTrue:[ |
|
4613 |
fn := zarFn. |
|
4614 |
ok := self |
|
4615 |
fileInStream:(entry asString readStream) |
|
4616 |
lazy:loadLazy |
|
4617 |
silent:beSilent |
|
4618 |
logged:false |
|
4619 |
addPath:nil |
|
4620 |
]. |
|
4621 |
] |
|
4622 |
] |
|
4623 |
] |
|
4624 |
]. |
|
4625 |
||
4626 |
" |
|
4627 |
if that did not work, |
|
4628 |
look for a zipArchive containing a class entry. |
|
4629 |
" |
|
4630 |
ok ifFalse:[ |
|
4631 |
zarFn := self getSourceFileName:'source.zip'. |
|
4632 |
zarFn notNil ifTrue:[ |
|
4633 |
zar := ZipArchive oldFileNamed:zarFn. |
|
4634 |
zar notNil ifTrue:[ |
|
4635 |
entry := zar extract:(zarFn := classFilenameWithoutSuffix , '.st'). |
|
4636 |
(entry isNil and:[alternativeClassFileName notNil]) ifTrue:[ |
|
4637 |
entry := zar extract:(zarFn := alternativeClassFileName , '.st'). |
|
4638 |
]. |
|
4639 |
entry notNil ifTrue:[ |
|
4640 |
fn := zarFn. |
|
4641 |
ok := self |
|
4642 |
fileInStream:(entry asString readStream) |
|
4643 |
lazy:loadLazy |
|
4644 |
silent:beSilent |
|
4645 |
logged:false |
|
4646 |
addPath:nil |
|
4647 |
]. |
|
4648 |
] |
|
4649 |
] |
|
4650 |
]. |
|
4651 |
ok ifFalse:[ |
|
4652 |
" |
|
4653 |
if there is a sourceCodeManager, ask it for the classes sourceCode |
|
4654 |
" |
|
4655 |
(mgr := Smalltalk at:#SourceCodeManager) notNil ifTrue:[ |
|
4656 |
inStream := mgr getMostRecentSourceStreamForClassNamed:aClassName. |
|
4657 |
inStream notNil ifTrue:[ |
|
4658 |
fn := nil. |
|
4659 |
ok := self fileInStream:inStream lazy:loadLazy silent:beSilent logged:false addPath:nil. |
|
4660 |
] |
|
4661 |
]. |
|
4662 |
]. |
|
4663 |
]. |
|
4664 |
] |
|
4665 |
]. |
|
4666 |
] ensure:[ |
|
4667 |
Compiler compileLazy:wasLazy. |
|
4668 |
wasSilent notNil ifTrue:[ |
|
4669 |
self silentLoading:wasSilent |
|
4670 |
] |
|
4671 |
]. |
|
7763 | 4672 |
|
9598 | 4673 |
]. |
4674 |
||
4675 |
ok ifTrue:[ |
|
10071 | 4676 |
newClass := self at:(aClassName asSymbol). |
4677 |
newClass notNil ifTrue:[ |
|
4678 |
fn notNil ifTrue:[ |
|
4679 |
newClass getClassFilename isNil ifTrue:[ |
|
4680 |
newClass setClassFilename:fn |
|
4681 |
]. |
|
4682 |
]. |
|
4683 |
||
4684 |
doInit ifTrue:[ |
|
4685 |
newClass initialize |
|
4686 |
] |
|
4687 |
] |
|
3044 | 4688 |
]. |
4689 |
||
4690 |
^ newClass |
|
4691 |
||
10049 | 4692 |
"Created: / 09-01-1998 / 14:40:32 / cg" |
4693 |
"Modified: / 06-10-2006 / 13:25:50 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4694 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4695 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4696 |
fileInClassLibrary:aClassLibraryName |
7758 | 4697 |
"find an object file containing a binary class library in some standard places |
4698 |
and load it. This install all of its contained classes. |
|
4712 | 4699 |
Return true if ok, false if not. |
4700 |
Notice: the argument may not have an extension (by purpose); |
|
10071 | 4701 |
the sharedLib extension (.dll / .so / .sl) is added here, to |
4702 |
make the caller independent of the underlying operatingSystem." |
|
4712 | 4703 |
|
4704 |
|path fn| |
|
3044 | 4705 |
|
4706 |
ObjectFileLoader isNil ifTrue:[^ false]. |
|
4712 | 4707 |
|
6837 | 4708 |
fn := aClassLibraryName asFilename withSuffix:(ObjectFileLoader sharedLibrarySuffix). |
6836 | 4709 |
fn := fn pathName. |
4712 | 4710 |
|
4711 |
path := self getBinaryFileName:fn. |
|
4712 |
path isNil ifTrue:[ |
|
10071 | 4713 |
path := self getSystemFileName:fn. |
4712 | 4714 |
]. |
4715 |
path isNil ifTrue:[^ false]. |
|
4716 |
||
4714 | 4717 |
^ (ObjectFileLoader loadObjectFile:path) notNil |
3044 | 4718 |
|
4719 |
" |
|
4720 |
Smalltalk fileInClassLibrary:'libtable' |
|
4721 |
Smalltalk fileInClassLibrary:'binary/libwidg3' |
|
4722 |
" |
|
4723 |
||
4724 |
"Modified: 8.1.1997 / 17:58:56 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4725 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4726 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4727 |
fileInClassLibrary:aClassLibraryName inPackage:packageID |
7758 | 4728 |
"find an object file containing a binary class library in some standard places |
4729 |
and load it. This install all of its contained classes. |
|
4730 |
Return true if ok, false if not. |
|
4731 |
Notice: the argument may not have an extension (by purpose); |
|
10071 | 4732 |
the sharedLib extension (.dll / .so / .sl) is added here, to |
4733 |
make the caller independent of the underlying operatingSystem." |
|
6025 | 4734 |
|
4735 |
|path fn| |
|
4736 |
||
4737 |
ObjectFileLoader isNil ifTrue:[^ false]. |
|
4738 |
||
6837 | 4739 |
fn := aClassLibraryName asFilename withSuffix:(ObjectFileLoader sharedLibrarySuffix). |
4740 |
fn := fn pathName. |
|
6025 | 4741 |
|
4742 |
path := self getPackageDirectoryForPackage:packageID. |
|
4743 |
path isNil ifTrue:[^ false]. |
|
4744 |
path := path asFilename construct:fn. |
|
4745 |
path exists ifFalse:[^ false]. |
|
4746 |
||
4747 |
^ (ObjectFileLoader loadObjectFile:path pathName) notNil |
|
4748 |
||
4749 |
" |
|
4750 |
Smalltalk fileInClassLibrary:'libtable' |
|
4751 |
Smalltalk fileInClassLibrary:'binary/libwidg3' |
|
4752 |
Smalltalk fileInClassLibrary:'refactoryBrowser' inPackage:'stx:goodies/refactoryBrowser' |
|
4753 |
" |
|
4754 |
||
4755 |
"Modified: 8.1.1997 / 17:58:56 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4756 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4757 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4758 |
fileInStream:streamArg |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4759 |
^ self fileInStream:streamArg lazy:nil silent:nil logged:false addPath:nil |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4760 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4761 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4762 |
fileInStream:streamArg lazy:lazy silent:silent logged:logged addPath:morePath |
7758 | 4763 |
"read sourceCode from aStream; |
4764 |
return true if ok, false if failed. |
|
4765 |
If lazy is true, no code is generated for methods, instead stubs |
|
4766 |
are created which compile themself when first executed. This allows |
|
4767 |
for much faster fileIn (but slows down the first execution later). |
|
4768 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
4769 |
code which is known to be syntactically correct. |
|
4770 |
If silent is true, no compiler messages are output to the transcript. |
|
4771 |
Giving nil for silent/lazy will use the current settings. |
|
4772 |
If morePath is nonNil, it is prepended to the systemPath temporarily during the |
|
4773 |
fileIn. This allows for st-expressions to refer to more files (i.e. fileIn more) |
|
4774 |
using a relative path." |
|
4775 |
||
8445
b6c4e1aa13af
care for encoding when filing in
Claus Gittinger <cg@exept.de>
parents:
8405
diff
changeset
|
4776 |
|inStream decoder wasLazy wasSilent oldSystemPath oldRealPath encoding| |
b6c4e1aa13af
care for encoding when filing in
Claus Gittinger <cg@exept.de>
parents:
8405
diff
changeset
|
4777 |
|
b6c4e1aa13af
care for encoding when filing in
Claus Gittinger <cg@exept.de>
parents:
8405
diff
changeset
|
4778 |
inStream := streamArg. |
b6c4e1aa13af
care for encoding when filing in
Claus Gittinger <cg@exept.de>
parents:
8405
diff
changeset
|
4779 |
inStream isNil ifTrue:[^ false]. |
b6c4e1aa13af
care for encoding when filing in
Claus Gittinger <cg@exept.de>
parents:
8405
diff
changeset
|
4780 |
|
8711
c5f28b4c719d
guessEncoding now implemented in CharacterEncoder
Claus Gittinger <cg@exept.de>
parents:
8695
diff
changeset
|
4781 |
encoding := CharacterEncoder guessEncodingOfStream:inStream. |
8445
b6c4e1aa13af
care for encoding when filing in
Claus Gittinger <cg@exept.de>
parents:
8405
diff
changeset
|
4782 |
encoding notNil ifTrue:[ |
10071 | 4783 |
decoder := CharacterEncoder encoderFor:encoding. |
4784 |
inStream := EncodedStream stream:inStream encoder:decoder. |
|
4785 |
inStream skipEncodingChunk. |
|
8445
b6c4e1aa13af
care for encoding when filing in
Claus Gittinger <cg@exept.de>
parents:
8405
diff
changeset
|
4786 |
]. |
7758 | 4787 |
|
4788 |
lazy notNil ifTrue:[wasLazy := Compiler compileLazy:lazy]. |
|
4789 |
silent notNil ifTrue:[wasSilent := self silentLoading:silent]. |
|
8317
af17d81a91f5
Fix when fileIn changes SystemPath
Stefan Vogel <sv@exept.de>
parents:
8278
diff
changeset
|
4790 |
morePath notNil ifTrue:[ |
10071 | 4791 |
oldSystemPath := SystemPath copy. |
4792 |
SystemPath addFirst:morePath. |
|
4793 |
oldRealPath := RealSystemPath. |
|
4794 |
RealSystemPath := nil. |
|
8317
af17d81a91f5
Fix when fileIn changes SystemPath
Stefan Vogel <sv@exept.de>
parents:
8278
diff
changeset
|
4795 |
]. |
617 | 4796 |
[ |
10071 | 4797 |
(Class updateChangeFileQuerySignal , Class updateChangeListQuerySignal) answer:logged do:[ |
4798 |
inStream fileIn. |
|
4799 |
] |
|
6421
58dca33cf0fc
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
6403
diff
changeset
|
4800 |
] ensure:[ |
10071 | 4801 |
morePath notNil ifTrue:[ |
4802 |
"take care, someone could have changed SystemPath during fileIn!!" |
|
4803 |
(SystemPath copyFrom:2) = oldSystemPath ifTrue:[ |
|
4804 |
SystemPath := oldSystemPath. |
|
4805 |
RealSystemPath := oldRealPath. |
|
4806 |
] ifFalse:[ |
|
4807 |
(oldSystemPath includes:morePath) ifFalse:[ |
|
4808 |
SystemPath remove:morePath ifAbsent:[]. |
|
4809 |
]. |
|
4810 |
RealSystemPath := nil. |
|
4811 |
]. |
|
4812 |
]. |
|
4813 |
lazy notNil ifTrue:[Compiler compileLazy:wasLazy]. |
|
4814 |
silent notNil ifTrue:[self silentLoading:wasSilent]. |
|
4815 |
inStream close |
|
617 | 4816 |
]. |
4817 |
^ true |
|
4818 |
||
4819 |
" |
|
4820 |
Smalltalk fileInStream:('source/TicTacToe.st' asFilename readStream) lazy:true silent:true |
|
4821 |
" |
|
1896 | 4822 |
|
4823 |
"Modified: 5.11.1996 / 20:03:35 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4824 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4825 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4826 |
isClassLibraryLoaded:name |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4827 |
"return true, if a particular class library is already loaded" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4828 |
|
10071 | 4829 |
ObjectMemory |
4830 |
binaryModuleInfo |
|
4831 |
do:[:entry | |
|
4832 |
entry type == #classLibrary ifTrue:[ |
|
4833 |
entry libraryName = name ifTrue:[ |
|
4834 |
^ true "/ already loaded |
|
4835 |
] |
|
4836 |
]. |
|
4837 |
]. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4838 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4839 |
^ false |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4840 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4841 |
" |
10071 | 4842 |
Smalltalk isClassLibraryLoaded:'libstx_libbasic' |
4843 |
Smalltalk isClassLibraryLoaded:'libstx_libwidg3' |
|
4844 |
Smalltalk isClassLibraryLoaded:'libstx_libboss' |
|
9638 | 4845 |
" |
4846 |
||
4847 |
"Modified: / 23-08-2006 / 15:54:46 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4848 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4849 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4850 |
loadClassLibraryIfAbsent:name |
7758 | 4851 |
"dynamically load a classLibrary, if not already loaded |
4852 |
and the system supports dynamic loading. |
|
4853 |
Return true, if the library is loaded, false if not. |
|
4854 |
This entry is called without system specific filename |
|
3044 | 4855 |
extensions - it is portable among different architectures |
10071 | 4856 |
as long as corresponding files (x.so / x.dll / x.sl / x.o) |
3044 | 4857 |
are be present ..." |
4858 |
||
5881
81a349eab73c
added #isClassLibraryLoaded:
Claus Gittinger <cg@exept.de>
parents:
5878
diff
changeset
|
4859 |
(self isClassLibraryLoaded:name) ifTrue:[ ^ true ]. "/ already loaded |
3044 | 4860 |
^ self fileInClassLibrary:name |
4861 |
||
4862 |
" |
|
4863 |
Smalltalk loadClassLibraryIfAbsent:'libbasic' |
|
4864 |
Smalltalk loadClassLibraryIfAbsent:'libwidg3' |
|
4865 |
" |
|
4866 |
||
4867 |
"Modified: 31.10.1996 / 16:57:24 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4868 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4869 |
|
10071 | 4870 |
secureFileIn:aFileName |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4871 |
"read in the named file, looking for it at standard places. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4872 |
Catch any error during fileIn. Return true if ok, false if failed" |
10071 | 4873 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4874 |
|retVal| |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4875 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4876 |
retVal := false. |
10071 | 4877 |
(SignalSet with:AbortOperationRequest with:TerminateProcessRequest) |
4878 |
handle:[:ex | ex return ] |
|
4879 |
do:[ retVal := self fileIn:aFileName ]. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4880 |
^ retVal |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4881 |
! |
7758 | 4882 |
|
4883 |
silentFileIn:aFilename |
|
4884 |
"same as fileIn:, but do not output 'compiled...'-messages on Transcript. |
|
4885 |
Main use is during startup." |
|
4886 |
||
4887 |
|wasSilent| |
|
4888 |
||
4889 |
wasSilent := self silentLoading:true. |
|
4890 |
[ |
|
10071 | 4891 |
self fileIn:aFilename |
7758 | 4892 |
] ensure:[ |
10071 | 4893 |
self silentLoading:wasSilent |
7758 | 4894 |
] |
3044 | 4895 |
! ! |
4896 |
||
4897 |
!Smalltalk class methodsFor:'system management-files'! |
|
4898 |
||
7758 | 4899 |
bitmapFileStreamFor:aFileName |
4900 |
"search aFileName in some standard places; |
|
4901 |
return a readonly fileStream or nil if not found. |
|
4902 |
Searches in subdirectories named 'bitmaps' in the SystemPath. |
|
4903 |
Notice: this does not look in the package-specific bitmaps directories." |
|
4904 |
||
4905 |
|aString| |
|
4906 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4907 |
aString := self getBitmapFileName:aFileName. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4908 |
aString notNil ifTrue:[ |
10071 | 4909 |
^ aString asFilename readStreamOrNil |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4910 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4911 |
^ nil |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4912 |
! |
7758 | 4913 |
|
4914 |
bitmapFromFileNamed:aFileName forClass:aClass |
|
10069
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
4915 |
"backward compatibility: |
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
4916 |
search aFileName in some standard places: |
10071 | 4917 |
first in the redefinable bitmaps path, |
5089 | 4918 |
then in the classes own package directory if existing. |
5040 | 4919 |
Return an image or nil." |
4920 |
||
10069
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
4921 |
^ self imageFromFileNamed:aFileName forClass:aClass |
5040 | 4922 |
|
4923 |
" |
|
4924 |
Smalltalk bitmapFromFileNamed:'SmalltalkX.xbm' forClass:View |
|
4925 |
" |
|
4926 |
! |
|
4927 |
||
7758 | 4928 |
bitmapFromFileNamed:aFileName inPackage:aPackage |
10069
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
4929 |
"backward compatibility: |
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
4930 |
search aFileName in some standard places: |
10071 | 4931 |
first in the redefinable bitmaps path, |
7758 | 4932 |
then in the package directory if existing. |
4933 |
Return an image or nil." |
|
4934 |
||
4935 |
^ self imageFromFileNamed:aFileName inPackage:aPackage |
|
4936 |
||
4937 |
" |
|
4938 |
Smalltalk bitmapFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libview' |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4939 |
Smalltalk bitmapFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libtool' |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4940 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4941 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4942 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4943 |
classNameForFile:aFileName |
7758 | 4944 |
"return the className which corresponds to an abbreviated fileName, |
4945 |
or nil if no special translation applies. The given filename arg may |
|
4946 |
include a '.st' suffix (but no other)." |
|
4947 |
||
4948 |
|fn| |
|
4949 |
||
4950 |
(aFileName asFilename hasSuffix:'st') ifTrue:[ |
|
10071 | 4951 |
fn := aFileName copyWithoutLast:3 |
3044 | 4952 |
] ifFalse:[ |
10071 | 4953 |
fn := aFileName |
3044 | 4954 |
]. |
4955 |
^ self filenameAbbreviations keyAtEqualValue:fn ifAbsent:[fn]. |
|
4956 |
||
4957 |
" |
|
10071 | 4958 |
Smalltalk classNameForFile:'DrawObj' |
4959 |
Smalltalk classNameForFile:'DrawObj.st' |
|
4960 |
Smalltalk classNameForFile:'ArrColl.st' |
|
4961 |
Smalltalk classNameForFile:'ArrColl.chg' |
|
3044 | 4962 |
" |
4963 |
||
4964 |
"Modified: 11.12.1995 / 14:51:10 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4965 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4966 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4967 |
constructPathFor:aDirectoryName |
10071 | 4968 |
"search for aDirectory in SystemPath; |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4969 |
return a collection of pathes which include that directory." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4970 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4971 |
^ self realSystemPath select:[:dirName | |
10071 | 4972 |
|fullPath| |
4973 |
||
4974 |
fullPath := dirName asFilename construct:aDirectoryName. |
|
4975 |
"/ fullPath exists and:[fullPath isDirectory and:[fullPath isReadable]] |
|
4976 |
fullPath isDirectory and:[fullPath isReadable] |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4977 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4978 |
! |
7758 | 4979 |
|
4980 |
fileInFileStreamFor:aFileName |
|
10069
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
4981 |
"obsolete |
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
4982 |
search aFileName in some standard places; |
7758 | 4983 |
return a readonly fileStream or nil if not found. |
4984 |
Searches in subdirectories named 'fileIn' in SystemPath" |
|
4985 |
||
4986 |
|aString| |
|
4987 |
||
4988 |
aString := self getFileInFileName:aFileName. |
|
4989 |
aString notNil ifTrue:[ |
|
10071 | 4990 |
^ aString asFilename readStreamOrNil |
7758 | 4991 |
]. |
4992 |
^ nil |
|
4993 |
! |
|
4994 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4995 |
fileNameForClass:aClassOrClassName |
7758 | 4996 |
"return a filename for aClassOrClassName" |
4997 |
||
10051 | 4998 |
|cls nonMetaclass nm nm1 nm2| |
7758 | 4999 |
|
5000 |
aClassOrClassName isBehavior ifTrue:[ |
|
10071 | 5001 |
nonMetaclass := aClassOrClassName theNonMetaclass. |
5002 |
nm1 := nonMetaclass name. |
|
5003 |
nm2 := nonMetaclass nameWithoutPrefix. |
|
7758 | 5004 |
] ifFalse:[ |
10071 | 5005 |
cls := Smalltalk classNamed:aClassOrClassName. |
5006 |
cls notNil ifTrue:[ |
|
5007 |
nonMetaclass := cls theNonMetaclass. |
|
5008 |
nm := nonMetaclass getClassFilename. |
|
5009 |
nm notNil ifTrue:[^ nm asFilename withoutSuffix baseName]. |
|
5010 |
nm1 := nonMetaclass name. |
|
5011 |
nm2 := nonMetaclass nameWithoutPrefix. |
|
5012 |
] ifFalse:[ |
|
5013 |
nm1 := aClassOrClassName. |
|
5014 |
nm2 := (aClassOrClassName copyFrom:(aClassOrClassName lastIndexOf:$:)+1). |
|
5015 |
]. |
|
7758 | 5016 |
]. |
5017 |
nm1 := nm1 asSymbol. |
|
5018 |
nm2 := nm2 asSymbol. |
|
5019 |
||
5020 |
CachedAbbreviations notNil ifTrue:[ |
|
10071 | 5021 |
(CachedAbbreviations includesKey:nm1) ifTrue:[ |
5022 |
^ (CachedAbbreviations at:nm1) asFilename baseName |
|
5023 |
]. |
|
5024 |
(CachedAbbreviations includesKey:nm2) ifTrue:[ |
|
5025 |
^ (CachedAbbreviations at:nm2) asFilename baseName |
|
5026 |
]. |
|
8084
88bccdc5943d
fileNameForClass (when checking in): repl. colons by underlines
Claus Gittinger <cg@exept.de>
parents:
7999
diff
changeset
|
5027 |
]. |
88bccdc5943d
fileNameForClass (when checking in): repl. colons by underlines
Claus Gittinger <cg@exept.de>
parents:
7999
diff
changeset
|
5028 |
^ nm1 copyReplaceAll:$: with:$_ |
88bccdc5943d
fileNameForClass (when checking in): repl. colons by underlines
Claus Gittinger <cg@exept.de>
parents:
7999
diff
changeset
|
5029 |
|
617 | 5030 |
" |
10071 | 5031 |
Smalltalk fileNameForClass:#Complex |
5032 |
Smalltalk fileNameForClass:'SmallInteger' |
|
5033 |
Smalltalk fileNameForClass:'UnixOperatingSystem' |
|
5034 |
Smalltalk fileNameForClass:'Launcher' |
|
5035 |
Smalltalk fileNameForClass:'SomeUnknownClass' |
|
5036 |
Smalltalk fileNameForClass:OSI::FTAMOperation |
|
5037 |
Smalltalk fileNameForClass:'OSI::Foobar' |
|
617 | 5038 |
" |
5039 |
||
10054 | 5040 |
"Modified: / 06-10-2006 / 16:16:01 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5041 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5042 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5043 |
filenameAbbreviations |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5044 |
"return a dictionary containing the classname-to-filename |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5045 |
mappings. (needed for sys5.3 users, where filenames are limited |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5046 |
to 14 chars)" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5047 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5048 |
CachedAbbreviations isNil ifTrue:[ |
10071 | 5049 |
self readAbbreviations |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5050 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5051 |
^ CachedAbbreviations |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5052 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5053 |
"flush with: |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5054 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5055 |
CachedAbbreviations := nil |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5056 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5057 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5058 |
Smalltalk filenameAbbreviations |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5059 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5060 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5061 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5062 |
flushPathCaches |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5063 |
"{ Pragma: +optSpace }" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5064 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5065 |
"forget pathCaches - these are collections containing valid directory names, |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5066 |
where system files (resource, bitmaps etc.) are found. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5067 |
A flush is only required, if a new system directory has been created while |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5068 |
the system is active, and those files should override the others |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5069 |
(for example, if you created a private resource directory)" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5070 |
|
10071 | 5071 |
RealSystemPath := ResourcePath := SourcePath := |
10069
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5072 |
BinaryPath := FileInPath := nil |
2378 | 5073 |
|
5074 |
" |
|
5075 |
Smalltalk flushPathCaches |
|
5076 |
" |
|
617 | 5077 |
! |
5078 |
||
7758 | 5079 |
getBinaryFileName:aFileName |
10069
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5080 |
"obsolete |
10071 | 5081 |
search aFileName in some standard places |
7758 | 5082 |
(subdirectories named 'binary' in SystemPath); |
5083 |
return the absolute filename or nil if none is found." |
|
5084 |
||
5085 |
BinaryPath isNil ifTrue:[ |
|
10071 | 5086 |
BinaryPath := self constructPathFor:BinaryDirName |
617 | 5087 |
]. |
5088 |
||
2928 | 5089 |
^ self searchPath:BinaryPath for:aFileName in:BinaryDirName |
1562
850a88ecff97
searchPath: dont use it, if fileName starts with "./" or "../"
Claus Gittinger <cg@exept.de>
parents:
1553
diff
changeset
|
5090 |
|
850a88ecff97
searchPath: dont use it, if fileName starts with "./" or "../"
Claus Gittinger <cg@exept.de>
parents:
1553
diff
changeset
|
5091 |
"Modified: 18.7.1996 / 15:53:49 / cg" |
453 | 5092 |
! |
5093 |
||
7758 | 5094 |
getBitmapFileName:aFileName |
10069
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5095 |
"for backward compatibility: |
10071 | 5096 |
search aFileName in some standard places |
7758 | 5097 |
(subdirectories named 'bitmaps' in SystemPath); |
10069
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5098 |
Return the pathName or nil if none is found." |
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5099 |
|
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5100 |
^ self getBitmapFileName:aFileName forPackage:nil |
617 | 5101 |
|
5102 |
" |
|
5103 |
Smalltalk getBitmapFileName:'SBrowser.xbm' |
|
5104 |
" |
|
1562
850a88ecff97
searchPath: dont use it, if fileName starts with "./" or "../"
Claus Gittinger <cg@exept.de>
parents:
1553
diff
changeset
|
5105 |
|
850a88ecff97
searchPath: dont use it, if fileName starts with "./" or "../"
Claus Gittinger <cg@exept.de>
parents:
1553
diff
changeset
|
5106 |
"Modified: 18.7.1996 / 15:53:55 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5107 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5108 |
|
9836 | 5109 |
getBitmapFileName:aFileName forPackage:aPackageIDOrNil |
10069
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5110 |
"for backward compatibility. |
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5111 |
search aFileName in some standard places: |
10071 | 5112 |
first in the redefinable bitmaps path, |
10069
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5113 |
then in the package directory if existing. |
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5114 |
Return a path or nil. |
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5115 |
Search order is: |
10072 | 5116 |
bitmaps/<pkg>/file |
5117 |
resources/<pkg>/bitmaps/file |
|
5118 |
<pkg>/bitmaps/file |
|
10069
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5119 |
" |
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5120 |
|
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5121 |
|f dir packageDir pF| |
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5122 |
|
10072 | 5123 |
((f := aFileName asString) startsWith:'bitmaps/') ifTrue:[ |
5124 |
f := aFileName copyFrom:('bitmaps/' size + 1). |
|
5125 |
]. |
|
5126 |
||
10069
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5127 |
aPackageIDOrNil isNil ifTrue:[ |
10072 | 5128 |
"/ this will be an error in the future |
5129 |
"/ 'Smalltalk [warning]: bitmap file access without package: ' infoPrint. aFileName infoPrintCR. |
|
5130 |
"/ self halt. |
|
5131 |
||
5132 |
pF := self searchPath:(self realSystemPath) for:aFileName in:('bitmaps'). |
|
5133 |
pF notNil ifTrue:[ |
|
5134 |
^ pF. |
|
5135 |
]. |
|
5136 |
f ~= aFileName ifTrue:[ |
|
5137 |
pF := self searchPath:(self realSystemPath) for:f in:('bitmaps'). |
|
5138 |
pF notNil ifTrue:[ |
|
5139 |
^ pF. |
|
5140 |
]. |
|
5141 |
]. |
|
5142 |
^ nil |
|
10069
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5143 |
]. |
9836 | 5144 |
|
5145 |
packageDir := aPackageIDOrNil copyReplaceAll:$: with:$/. |
|
10069
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5146 |
|
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5147 |
pF := self searchPath:(self realSystemPath) for:aFileName in:('bitmaps/',packageDir). |
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5148 |
pF notNil ifTrue:[ |
10072 | 5149 |
^ pF. |
10069
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5150 |
]. |
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5151 |
pF := self searchPath:(self realSystemPath) for:aFileName in:('resources/',packageDir,'/bitmaps'). |
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5152 |
pF notNil ifTrue:[ |
10072 | 5153 |
^ pF. |
10069
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5154 |
]. |
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5155 |
|
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5156 |
dir := self projectDirectoryForPackage:aPackageIDOrNil. |
9836 | 5157 |
dir notNil ifTrue:[ |
10072 | 5158 |
pF := (dir asFilename construct:'bitmaps') constructString:f. |
5159 |
pF asFilename exists ifTrue:[ |
|
5160 |
^ pF. |
|
5161 |
]. |
|
9836 | 5162 |
]. |
10069
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5163 |
^ nil |
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5164 |
|
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5165 |
" |
10071 | 5166 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libview' |
5167 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libtool' |
|
5168 |
Smalltalk imageFromFileNamed:'bitmaps/gifImages/garfield.gif' inPackage:'stx:goodies' |
|
5169 |
Smalltalk imageFromFileNamed:'CheckOn10_xp.xpm' inPackage:'stx:libwidg' |
|
10069
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5170 |
" |
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5171 |
|
10072 | 5172 |
"Modified: / 11-10-2006 / 13:53:18 / cg" |
9836 | 5173 |
! |
5174 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5175 |
getFileInFileName:aFileName |
10069
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5176 |
"obsolete |
10071 | 5177 |
search aFileName in some standard places |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5178 |
(subdirectories named 'fileIn' in SystemPath); |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5179 |
return the absolute filename or nil if none is found." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5180 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5181 |
FileInPath isNil ifTrue:[ |
10071 | 5182 |
FileInPath := self constructPathFor:FileInDirName |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5183 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5184 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5185 |
^ self searchPath:FileInPath for:aFileName in:FileInDirName |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5186 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5187 |
"Modified: 18.7.1996 / 15:53:59 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5188 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5189 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5190 |
getPackageDirectoryForPackage:aPackageID |
10069
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5191 |
"search for a particular package; return its directory, or nil. |
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5192 |
Stand alone applications might get nil, if there are only binaries installed." |
5550
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
5193 |
|
10041
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
5194 |
|checkForPackageDirectory module packageSubDirectory| |
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
5195 |
|
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
5196 |
module := aPackageID asPackageId module. |
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
5197 |
packageSubDirectory := aPackageID asPackageId directory. |
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
5198 |
|
10071 | 5199 |
checkForPackageDirectory := |
5200 |
[:moduleDir | |
|
5201 |
|packageDir| |
|
5202 |
||
5203 |
(moduleDir exists and:[moduleDir isDirectory]) ifTrue:[ |
|
5204 |
packageDir := moduleDir construct:packageSubDirectory. |
|
5205 |
(packageDir exists and:[packageDir isDirectory]) ifTrue:[ |
|
5206 |
^ packageDir |
|
5207 |
] |
|
5208 |
]. |
|
5209 |
]. |
|
10041
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
5210 |
|
5550
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
5211 |
self packagePath do:[:aPath | |
10071 | 5212 |
|moduleDir| |
5213 |
||
5214 |
moduleDir := aPath asFilename construct:module. |
|
5215 |
checkForPackageDirectory value:moduleDir. |
|
10041
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
5216 |
]. |
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
5217 |
|
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
5218 |
"/ not found - special case for the stx package... |
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
5219 |
module = 'stx' ifTrue:[ |
10071 | 5220 |
checkForPackageDirectory value:('../../' asFilename). |
10041
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
5221 |
]. |
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
5222 |
|
5550
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
5223 |
^ nil |
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
5224 |
|
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
5225 |
" |
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
5226 |
Smalltalk getPackageDirectoryForPackage:(Array package) |
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
5227 |
Smalltalk getPackageDirectoryForPackage:'stx:goodies/bitmaps' |
5785
872483483444
oops - getPackageDirectoryForPackage now cares for the case
Claus Gittinger <cg@exept.de>
parents:
5781
diff
changeset
|
5228 |
Smalltalk getPackageDirectoryForPackage:'stx:libview' |
5550
01ad51c71b0e
added #getPackageDirectoryForPackage:
Claus Gittinger <cg@exept.de>
parents:
5518
diff
changeset
|
5229 |
" |
10041
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
5230 |
|
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
5231 |
"Modified: / 06-10-2006 / 11:49:27 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5232 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5233 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5234 |
getPackageFileName:aFileName |
10071 | 5235 |
"search aFileName in some standard places |
7758 | 5236 |
(packagePath and subdirectories named 'packages' in SystemPath); |
5237 |
return the absolute filename or nil if none is found." |
|
5238 |
||
5239 |
|f| |
|
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5240 |
|
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5241 |
"/ search along packagePath ... |
5052 | 5242 |
f := self searchPath:self packagePath for:aFileName in:nil. |
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5243 |
f isNil ifTrue:[ |
10071 | 5244 |
"/ search under packages-directory along systemPath ... |
5245 |
f := self searchPath:self realSystemPath for:aFileName in:PackageDirName. |
|
5246 |
"/ kludge - allow for stx-directory to be named differently |
|
5247 |
f isNil ifTrue:[ |
|
5248 |
(aFileName startsWith:'stx') ifTrue:[ |
|
5249 |
(aFileName startsWith:'stx' , Filename separator) ifTrue:[ |
|
5250 |
f := '../..' asFilename construct:(aFileName copyFrom:5). |
|
5251 |
f exists ifTrue:[ |
|
5252 |
^ f pathName |
|
5253 |
]. |
|
5254 |
] |
|
5255 |
]. |
|
5256 |
]. |
|
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5257 |
]. |
5878
b89d789e1705
always return a string from #getPackageFileName
Claus Gittinger <cg@exept.de>
parents:
5860
diff
changeset
|
5258 |
(f notNil and:[(f := f asFilename) exists]) ifTrue:[ |
10071 | 5259 |
^ f pathName |
5878
b89d789e1705
always return a string from #getPackageFileName
Claus Gittinger <cg@exept.de>
parents:
5860
diff
changeset
|
5260 |
]. |
b89d789e1705
always return a string from #getPackageFileName
Claus Gittinger <cg@exept.de>
parents:
5860
diff
changeset
|
5261 |
^ nil |
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5262 |
|
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5263 |
" |
10071 | 5264 |
Smalltalk getPackageFileName:'stx/libview/resources/normal.style' |
5265 |
Smalltalk getPackageFileName:'stx/libview/source.zip' |
|
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5266 |
" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5267 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5268 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5269 |
getResourceFileName:aFileName |
10071 | 5270 |
"search aFileName in some standard places |
8945 | 5271 |
(subdirectories named 'resources' in SystemPath); |
7758 | 5272 |
return the absolute filename or nil if none is found." |
5273 |
||
10069
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5274 |
^ self getResourceFileName:aFileName forPackage:nil |
617 | 5275 |
|
5276 |
" |
|
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5277 |
Smalltalk getResourceFileName:'SystemBrowser.rs' |
617 | 5278 |
" |
1562
850a88ecff97
searchPath: dont use it, if fileName starts with "./" or "../"
Claus Gittinger <cg@exept.de>
parents:
1553
diff
changeset
|
5279 |
|
850a88ecff97
searchPath: dont use it, if fileName starts with "./" or "../"
Claus Gittinger <cg@exept.de>
parents:
1553
diff
changeset
|
5280 |
"Modified: 18.7.1996 / 15:54:03 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5281 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5282 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5283 |
getResourceFileName:aFileName forClass:aClassOrNil |
10071 | 5284 |
"search aFileName in some standard places |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5285 |
(subdirectories named 'resource' in SystemPath); |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5286 |
and in aClasses package directory. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5287 |
Return the absolute filename or nil if none is found." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5288 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5289 |
|pkgOrNil| |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5290 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5291 |
aClassOrNil notNil ifTrue:[ |
10071 | 5292 |
pkgOrNil := aClassOrNil package. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5293 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5294 |
^ self getResourceFileName:aFileName forPackage:pkgOrNil. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5295 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5296 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5297 |
Smalltalk getResourceFileName:'SystemBrowser.rs' forClass:SystemBrowser |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5298 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5299 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5300 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5301 |
getResourceFileName:aFileName forPackage:aPackageIDOrNil |
10071 | 5302 |
"search aFileName in some standard places |
7758 | 5303 |
(subdirectories named 'resource' in SystemPath); |
5304 |
and in a packages directory. |
|
10069
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5305 |
Return the absolute filename or nil if none is found. |
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5306 |
Search order is: |
10072 | 5307 |
resources/<pkg>/file |
5308 |
<pkg>/resources/file |
|
10069
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5309 |
" |
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5310 |
|
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5311 |
|pF f dir packageDir| |
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5312 |
|
10072 | 5313 |
((f := aFileName asString) startsWith:'resources/') ifTrue:[ |
5314 |
f := aFileName copyFrom:('resources/' size + 1). |
|
5315 |
]. |
|
5316 |
||
10069
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5317 |
aPackageIDOrNil isNil ifTrue:[ |
10072 | 5318 |
"/ this will be an error in the future |
5319 |
"/ 'Smalltalk [warning]: resource file access without package: ' infoPrint. aFileName infoPrintCR. |
|
5320 |
"/ self halt. |
|
5321 |
||
5322 |
pF := self searchPath:(self realSystemPath) for:aFileName in:('resources'). |
|
5323 |
pF notNil ifTrue:[ |
|
5324 |
^ pF. |
|
5325 |
]. |
|
5326 |
f ~= aFileName ifTrue:[ |
|
5327 |
pF := self searchPath:(self realSystemPath) for:f in:('resources'). |
|
5328 |
pF notNil ifTrue:[ |
|
5329 |
^ pF. |
|
5330 |
]. |
|
5331 |
]. |
|
5332 |
^ nil |
|
10069
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5333 |
]. |
8945 | 5334 |
|
5335 |
packageDir := aPackageIDOrNil copyReplaceAll:$: with:$/. |
|
10069
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5336 |
|
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5337 |
pF := self searchPath:(self realSystemPath) for:aFileName in:('resources/',packageDir). |
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5338 |
pF notNil ifTrue:[ |
10072 | 5339 |
^ pF. |
10069
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5340 |
]. |
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5341 |
|
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5342 |
dir := self projectDirectoryForPackage:aPackageIDOrNil. |
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5343 |
dir notNil ifTrue:[ |
10072 | 5344 |
pF := (dir asFilename construct:'resources') constructString:f. |
5345 |
pF asFilename exists ifTrue:[ |
|
5346 |
^ pF. |
|
5347 |
]. |
|
5348 |
pF := (dir asFilename construct:'styles') constructString:f. |
|
5349 |
pF asFilename exists ifTrue:[ |
|
5350 |
^ pF. |
|
5351 |
]. |
|
10069
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5352 |
]. |
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5353 |
^ nil |
5043 | 5354 |
|
5355 |
" |
|
5065 | 5356 |
Smalltalk getResourceFileName:'SystemBrowser.rs' forPackage:'stx:libtool' |
5080 | 5357 |
Smalltalk getResourceFileName:'normal.style' forPackage:'stx:libview' |
10069
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5358 |
Smalltalk getResourceFileName:'mswindowsXP.style' forPackage:'stx:libview' |
8945 | 5359 |
Smalltalk getResourceFileName:'Foo.rs' forPackage:'stx:libview' |
5043 | 5360 |
" |
10072 | 5361 |
|
5362 |
"Modified: / 11-10-2006 / 13:53:43 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5363 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5364 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5365 |
getSourceFileName:aFileName |
10071 | 5366 |
"search aFileName in some standard places |
7563 | 5367 |
(subdirectories named 'source' in SystemPath); |
736 | 5368 |
return the absolute filename or nil if none is found. |
5369 |
This is used to find a sourceFile for a methods source, |
|
5370 |
if no sourceCodeManager is available." |
|
617 | 5371 |
|
2959 | 5372 |
|f| |
5373 |
||
617 | 5374 |
SourcePath isNil ifTrue:[ |
10071 | 5375 |
SourcePath := self constructPathFor:SourceDirName |
617 | 5376 |
]. |
5377 |
||
2959 | 5378 |
"/ first, try a source subdir along the path. |
4770 | 5379 |
SourcePath notNil ifTrue:[ |
10071 | 5380 |
f := self searchPath:SourcePath for:aFileName in:SourceDirName. |
4770 | 5381 |
]. |
2959 | 5382 |
f isNil ifTrue:[ |
10071 | 5383 |
"/ then, try it itself along the path. |
5384 |
f := self searchPath:self realSystemPath for:aFileName in:nil |
|
2959 | 5385 |
]. |
5386 |
^ f |
|
191 | 5387 |
|
5388 |
" |
|
10071 | 5389 |
Smalltalk getSourceFileName:'Smalltalk.st' |
5390 |
Smalltalk getSourceFileName:'ArrColl.st' |
|
191 | 5391 |
" |
1562
850a88ecff97
searchPath: dont use it, if fileName starts with "./" or "../"
Claus Gittinger <cg@exept.de>
parents:
1553
diff
changeset
|
5392 |
|
850a88ecff97
searchPath: dont use it, if fileName starts with "./" or "../"
Claus Gittinger <cg@exept.de>
parents:
1553
diff
changeset
|
5393 |
"Modified: 18.7.1996 / 15:54:07 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5394 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5395 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5396 |
getSystemFileName:aFileNameOrString |
7758 | 5397 |
"search aFileNameOrString in some standard places; |
5398 |
return the absolute filename or nil if none is found. |
|
5399 |
see comment in Smalltalk>>initSystemPath. |
|
5400 |
This should be used to access resources such as bitmaps, doc-files, |
|
5401 |
and other help files. |
|
5402 |
" |
|
5403 |
||
5404 |
"credits for this method go to Markus ...." |
|
5405 |
||
5406 |
|fn nameString| |
|
5407 |
||
5408 |
fn := aFileNameOrString asFilename. |
|
2933 | 5409 |
nameString := fn name. |
2896 | 5410 |
fn isAbsolute ifTrue:[ |
10071 | 5411 |
"dont use path for absolute file names" |
5412 |
||
5413 |
^ nameString |
|
191 | 5414 |
]. |
5415 |
||
617 | 5416 |
self realSystemPath do:[:dirName | |
10071 | 5417 |
|realName| |
5418 |
||
5419 |
realName := dirName asFilename construct:nameString. |
|
5420 |
"/ |
|
5421 |
"/ here, we also return true if its a directory |
|
5422 |
"/ (Even if unreadable). |
|
5423 |
"/ It could be that the file itself is still readable. |
|
5424 |
"/ |
|
5425 |
(realName isDirectory or:[realName isReadable]) ifTrue: [ |
|
5426 |
^ realName name |
|
5427 |
] |
|
191 | 5428 |
]. |
617 | 5429 |
^ nil |
4150 | 5430 |
|
5431 |
" |
|
5432 |
Smalltalk getSystemFileName:'doc/online/english/TOP.html' |
|
5433 |
Smalltalk getSystemFileName:'bitmaps/SBrowser.xbm' |
|
10071 | 5434 |
Smalltalk getSystemFileName:'bitmaps/foo' |
5435 |
Smalltalk getSystemFileName:'resources/View.rs' |
|
5436 |
Smalltalk getSystemFileName:'resources/iris.style' |
|
4150 | 5437 |
" |
5438 |
||
5439 |
"Modified: / 6.5.1999 / 10:40:37 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5440 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5441 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5442 |
imageFromFileNamed:aFileName forClass:aClass |
7758 | 5443 |
"search aFileName in some standard places: |
5444 |
first in the redefinable bitmaps path, then in the classes |
|
5445 |
own package directory if existing. |
|
5089 | 5446 |
Return an image or nil." |
5447 |
||
10069
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5448 |
|classPackage img| |
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5449 |
|
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5450 |
classPackage := aClass package. |
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5451 |
img := self imageFromFileNamed:aFileName inPackage:classPackage. |
5113 | 5452 |
img isNil ifTrue:[ |
10071 | 5453 |
"/ try under the goodies package ... |
5454 |
classPackage ~= 'stx:goodies' ifTrue:[ |
|
5455 |
img := self imageFromFileNamed:aFileName inPackage:'stx:goodies'. |
|
5456 |
] |
|
5113 | 5457 |
]. |
5458 |
^ img |
|
5089 | 5459 |
|
5460 |
" |
|
5461 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' forClass:View |
|
5462 |
" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5463 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5464 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5465 |
imageFromFileNamed:aFileName inPackage:aPackage |
7758 | 5466 |
"search aFileName in some standard places: |
10071 | 5467 |
first in the redefinable bitmaps path, |
10069
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5468 |
then in the package directory if existing. |
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5469 |
Return an image or nil. |
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5470 |
Search order is: |
10071 | 5471 |
bitmaps/<pkg>/file |
5472 |
resources/<pkg>/bitmaps/file |
|
5473 |
<pkg>/bitmaps/file |
|
10069
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5474 |
" |
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5475 |
|
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5476 |
|path| |
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5477 |
|
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5478 |
path := self getBitmapFileName:aFileName forPackage:aPackage. |
15c0cdb1e9e9
bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents:
10065
diff
changeset
|
5479 |
path notNil ifTrue:[ |
10071 | 5480 |
^ Image fromFile:path. |
9199 | 5481 |
]. |
5482 |
^ nil |
|
5089 | 5483 |
|
5484 |
" |
|
10071 | 5485 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libview' |
5486 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libtool' |
|
5487 |
Smalltalk imageFromFileNamed:'bitmaps/gifImages/garfield.gif' inPackage:'stx:goodies' |
|
5488 |
Smalltalk imageFromFileNamed:'CheckOn10_xp.xpm' inPackage:'stx:libwidg' |
|
5489 |
Smalltalk imageFromFileNamed:'ComboDn_xp.xpm' inPackage:'stx:libwidg' |
|
5089 | 5490 |
" |
9836 | 5491 |
|
5492 |
"Modified: / 08-09-2006 / 18:02:04 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5493 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5494 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5495 |
libraryFileNameOfClass:aClassOrClassName |
7758 | 5496 |
"for a given class, return the name of a classLibrary which contains |
5497 |
binary code for it. |
|
5498 |
Read the libinfo file 'liblist.stc' (which is created during the compilation process) |
|
5499 |
for an entry for aClassOrClassName. |
|
5500 |
Search for the className in the first col, and return the value found in |
|
5501 |
the 2nd col. |
|
5502 |
Return nil if no entry is found. |
|
5503 |
||
5504 |
A nil returns means that this class is either built-in or not present |
|
5505 |
in a package-class library (i.e. either as separate .o or separate .st file). |
|
5506 |
Otherwise, the returned name is the classLibrary object of that class. |
|
5507 |
The classes code can be loaded from that file if binary loading is supported." |
|
5508 |
||
5509 |
|aStream line words n aClassName| |
|
5510 |
||
5511 |
aClassOrClassName isBehavior ifTrue:[ |
|
10071 | 5512 |
aClassName := aClassOrClassName name |
7758 | 5513 |
] ifFalse:[ |
10071 | 5514 |
aClassName := aClassOrClassName |
617 | 5515 |
]. |
5516 |
aClassName := aClassName asString. |
|
5517 |
||
5518 |
#('include/liblist.stc') "/ filenames |
|
5519 |
with:#(2) "/ column |
|
5520 |
do:[:fileName :col | |
|
5521 |
||
10071 | 5522 |
aStream := self systemFileStreamFor:fileName. |
5523 |
aStream notNil ifTrue:[ |
|
5524 |
[aStream atEnd] whileFalse:[ |
|
5525 |
line := aStream nextLine. |
|
5526 |
line notNil ifTrue:[ |
|
5527 |
(line startsWith:'#') ifFalse:[ |
|
5528 |
words := line asCollectionOfWords. |
|
5529 |
(n := words size) > 1 ifTrue:[ |
|
5530 |
(words at:1) = aClassName ifTrue:[ |
|
5531 |
n >= col ifTrue:[ |
|
5532 |
aStream close. |
|
5533 |
^ (words at:col) withoutSeparators |
|
5534 |
] |
|
5535 |
] |
|
5536 |
] |
|
5537 |
] |
|
5538 |
] |
|
5539 |
]. |
|
5540 |
aStream close |
|
5541 |
]. |
|
617 | 5542 |
]. |
5543 |
||
5544 |
^ nil |
|
5545 |
||
5546 |
" |
|
10071 | 5547 |
Smalltalk libraryFileNameOfClass:'ClockView' |
5548 |
Smalltalk libraryFileNameOfClass:'Bag' |
|
617 | 5549 |
" |
5550 |
||
5551 |
"Modified: 6.11.1995 / 15:41:39 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5552 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5553 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5554 |
packagePath |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5555 |
"return a collection of additional directorynames, where smalltalk |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5556 |
looks for package directories. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5557 |
Notice, that directories named 'packages' under the systemPath are |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5558 |
always consulted - even if not in the packagePath" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5559 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5560 |
^ PackagePath |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5561 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5562 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5563 |
Smalltalk packagePath |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5564 |
Smalltalk packagePath addLast:'/opt/smalltalk' |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5565 |
Smalltalk packagePath addFirst:'/usr/local/otherPackages' |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5566 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5567 |
! |
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
5568 |
|
7758 | 5569 |
packagePath:aPath |
5570 |
"set the packagePath; |
|
5571 |
a collection of additional directorynames, where smalltalk |
|
5572 |
looks for package directories. |
|
5573 |
Notice, that directories named 'packages' under the systemPath are |
|
5574 |
always consulted - even if not in the packagePath" |
|
5575 |
||
5576 |
PackagePath := aPath asOrderedCollection |
|
5577 |
||
5578 |
" |
|
5579 |
Smalltalk packagePath:#( '.' '/opt/stx' '/opt/smalltalk' '/usr/local/otherPackages') |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5580 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5581 |
! |
7758 | 5582 |
|
5583 |
projectDirectoryForClass:aClass |
|
5584 |
"given a class, return the path to its package directory; |
|
5585 |
nil if not found." |
|
5586 |
||
5587 |
|pkg| |
|
5588 |
||
5589 |
pkg := aClass package. |
|
5590 |
pkg isNil ifTrue:[^ nil]. |
|
5038
d74e7c71ae75
added package directory handling
Claus Gittinger <cg@exept.de>
parents:
5037
diff
changeset
|
5591 |
|
5040 | 5592 |
^ self projectDirectoryForPackage:pkg. |
5593 |
||
5594 |
" |
|
10071 | 5595 |
Smalltalk projectDirectoryForClass:Array |
5040 | 5596 |
Smalltalk projectDirectoryForClass:View |
5597 |
" |
|
5598 |
! |
|
5599 |
||
7758 | 5600 |
projectDirectoryForPackage:aPackage |
5601 |
"given a packageID, return the path to its package directory; |
|
5602 |
nil if not found." |
|
5603 |
||
5604 |
|prj prjDir| |
|
5605 |
||
5606 |
"/ there might be a package specific resource directory ... |
|
5607 |
"/ in the directory, from which the project was loaded |
|
5608 |
prj := Project projectWithId:aPackage. |
|
5609 |
prj notNil ifTrue:[ |
|
10071 | 5610 |
prjDir := prj directory. |
7758 | 5611 |
]. |
5612 |
(prjDir notNil and:[prjDir asFilename exists]) ifFalse:[ |
|
10071 | 5613 |
prjDir := Smalltalk getPackageFileName:(aPackage copyReplaceAll:$: with:$/). |
7758 | 5614 |
]. |
5615 |
^ prjDir |
|
5616 |
||
5617 |
" |
|
10071 | 5618 |
Smalltalk projectDirectoryForPackage:'stx:libbasic' |
7758 | 5619 |
Smalltalk projectDirectoryForPackage:'exept:smartcard' |
10071 | 5620 |
Smalltalk projectDirectoryForPackage:'stx' |
5621 |
Smalltalk projectDirectoryForPackage:'bosch' |
|
10057 | 5622 |
" |
5623 |
||
5624 |
"Modified: / 07-10-2006 / 17:45:58 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5625 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5626 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5627 |
readAbbreviations |
7758 | 5628 |
"read classname to filename mappings from include/abbrev.stc. |
5629 |
sigh - all for those poor sys5.3 or MSDOS people with short filenames ..." |
|
5630 |
||
5631 |
"since installAutoloadedClasses also reads all abbreviations, use it" |
|
5632 |
||
5633 |
CachedAbbreviations := IdentityDictionary new. |
|
5634 |
self installAutoloadedClasses. |
|
5635 |
^ CachedAbbreviations. |
|
5636 |
||
5637 |
"/ |aStream f dirsConsulted| |
|
5638 |
"/ |
|
5639 |
"/ CachedAbbreviations := IdentityDictionary new. |
|
5640 |
"/ |
|
5641 |
"/ "/ new scheme: look for a directory called 'packages' |
|
5642 |
"/ "/ and enumerate its abbrev.stc files... |
|
5643 |
"/ dirsConsulted := Set new. |
|
5644 |
"/ f := Smalltalk getSystemFileName:'packages'. |
|
5645 |
"/ f notNil ifTrue:[ |
|
5646 |
"/ f := f asFilename. |
|
5647 |
"/ f isDirectory ifTrue:[ |
|
5648 |
"/ ('Smalltalk [info]: reading all class abbreviations found under ''' , f pathName ,'''') infoPrintCR. |
|
5649 |
"/ self recursiveReadAllAbbreviationsFrom:f. |
|
5650 |
"/ dirsConsulted add:f pathName. |
|
5651 |
"/ ]. |
|
5652 |
"/ ]. |
|
5653 |
"/ |
|
5654 |
"/ "/ and along the package-path |
|
5655 |
"/ self packagePath do:[:aPath | |
|
5656 |
"/ (dirsConsulted includes:aPath) ifFalse:[ |
|
5657 |
"/ ('Smalltalk [info]: reading all class abbreviations found under ''' , aPath ,'''') infoPrintCR. |
|
7613 | 5658 |
"/ self recursiveReadAllAbbreviationsFrom:aPath. |
5659 |
"/ dirsConsulted add:aPath |
|
5660 |
"/ ] |
|
5661 |
"/ ]. |
|
5662 |
"/ |
|
5663 |
"/ "/ old scheme: look for a single file called 'abbrev.stc' in the |
|
5664 |
"/ "/ include directory. This will vanish. |
|
5665 |
"/ |
|
5666 |
"/ aStream := self systemFileStreamFor:'include/abbrev.stc'. |
|
5667 |
"/ aStream notNil ifTrue:[ |
|
5668 |
"/ ('Smalltalk [info]: reading additional abbreviations from ''' , aStream pathName ,'''') infoPrintCR. |
|
5669 |
"/ self readAbbreviationsFromStream:aStream. |
|
5670 |
"/ aStream close. |
|
5671 |
"/"/ ] ifFalse:[ |
|
5672 |
"/"/ ('Smalltalk [warning]: no global''include/abbrev.stc'' file found') infoPrintCR |
|
5673 |
"/ ]. |
|
5674 |
"/ ^ CachedAbbreviations |
|
191 | 5675 |
|
5676 |
" |
|
617 | 5677 |
Smalltalk readAbbreviations |
191 | 5678 |
" |
617 | 5679 |
|
5091 | 5680 |
"Modified: / 10.12.1999 / 17:48:53 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5681 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5682 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5683 |
readAbbreviationsFromStream:aStream |
7758 | 5684 |
"read classname to filename mappings from aStream. |
5685 |
sigh - all for those poor sys5.3 or MSDOS people with short filenames ..." |
|
5686 |
||
8470
d79e917d4f36
Define #setFilename:forClass:package: to define an abbreviation.
Stefan Vogel <sv@exept.de>
parents:
8445
diff
changeset
|
5687 |
|line words nm abbrev pkg s w| |
7758 | 5688 |
|
5689 |
[aStream atEnd] whileFalse:[ |
|
10071 | 5690 |
line := aStream nextLine. |
5691 |
line notNil ifTrue:[ |
|
5692 |
(line startsWith:'#') ifFalse:[ |
|
5693 |
||
5694 |
"/ must do it manually, caring for quoted strings. |
|
7758 | 5695 |
"/ words := line asCollectionOfWords. |
5696 |
||
10071 | 5697 |
words := OrderedCollection new. |
5698 |
s := line readStream. |
|
5699 |
[s atEnd] whileFalse:[ |
|
5700 |
s skipSeparators. |
|
5701 |
s peek == $' ifTrue:[ |
|
5702 |
s next. |
|
5703 |
w := s upTo:$'. |
|
5704 |
s skipSeparators. |
|
5705 |
] ifFalse:[ |
|
5706 |
w := s upToSeparator |
|
5707 |
]. |
|
5708 |
words add:w |
|
5709 |
]. |
|
5710 |
words size >= 3 ifTrue:[ |
|
5711 |
nm := (words at:1) withoutSeparators. |
|
5712 |
abbrev := (words at:2) withoutSeparators. |
|
5713 |
pkg := (words at:3) withoutSeparators. |
|
5714 |
self setFilename:abbrev forClass:nm package:pkg. |
|
5715 |
] ifFalse:[ |
|
5716 |
('Smalltalk [warning]: malformed line in ' , (aStream pathName)) infoPrintCR. |
|
5717 |
] |
|
5718 |
] |
|
5719 |
] |
|
4420 | 5720 |
]. |
5091 | 5721 |
|
5095
9bbf3cf594e5
no warning for same-abbrev, if packages differ.
Claus Gittinger <cg@exept.de>
parents:
5093
diff
changeset
|
5722 |
"Modified: / 13.12.1999 / 11:54:17 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5723 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5724 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5725 |
realSystemPath |
7758 | 5726 |
"return the realSystemPath - thats the directorynames from |
5727 |
SystemPath which exist and are readable" |
|
5728 |
||
5729 |
|nP| |
|
5730 |
||
5731 |
RealSystemPath isNil ifTrue:[ |
|
10071 | 5732 |
OperatingSystem isVMSlike ifTrue:[ |
5733 |
"/ temporary kludge: since we cannot currently |
|
5734 |
"/ check for existance of a name like 'volume:', |
|
5735 |
"/ leave those in the Path without a check. |
|
5736 |
RealSystemPath := SystemPath select:[:dirName | |
|
5737 |
|f| |
|
5738 |
||
5739 |
f := dirName asFilename. |
|
5740 |
f isVolumeOnly ifTrue:[ |
|
5741 |
true |
|
5742 |
] ifFalse:[ |
|
5743 |
(f isDirectory) and:[f isReadable] |
|
5744 |
] |
|
5745 |
] |
|
5746 |
] ifFalse:[ |
|
5747 |
RealSystemPath := SystemPath select:[:dirName | |
|
5748 |
|f| |
|
5749 |
||
5750 |
f := dirName asFilename. |
|
5751 |
(f isDirectory) and:[f isReadable] |
|
5752 |
]. |
|
5753 |
RealSystemPath := RealSystemPath collect:[:dirName | |
|
5754 |
|f| |
|
5755 |
||
5756 |
f := dirName asFilename pathName. |
|
5757 |
]. |
|
5758 |
"/ remove duplicates (but keep order) |
|
5759 |
nP := OrderedCollection new. |
|
5760 |
RealSystemPath do:[:p | |
|
5761 |
(nP includes:p) ifFalse:[ |
|
5762 |
nP add:p |
|
5763 |
] |
|
5764 |
]. |
|
5765 |
RealSystemPath := nP. |
|
5766 |
]. |
|
617 | 5767 |
]. |
5768 |
^ RealSystemPath |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5769 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5770 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5771 |
recursiveReadAllAbbreviationsFrom:aDirectory |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5772 |
self recursiveReadAllAbbreviationsFrom:aDirectory maxLevels:15 |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5773 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5774 |
|
7758 | 5775 |
recursiveReadAllAbbreviationsFrom:aDirectory maxLevels:maxLevels |
5776 |
"read all abbreviations from and under aDirectory." |
|
5777 |
||
5778 |
|abbrevStream dir directoryContents| |
|
5779 |
||
5780 |
maxLevels == 0 ifTrue:[ |
|
5781 |
"/ 'Smalltalk [warning]: max directory nesting reached.' infoPrintCR. |
|
10071 | 5782 |
^ self |
5075 | 5783 |
]. |
4957 | 5784 |
|
4458 | 5785 |
dir := aDirectory asFilename. |
5057 | 5786 |
dir exists ifFalse:[^ self]. |
4458 | 5787 |
|
7085
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5788 |
[ |
10071 | 5789 |
abbrevStream := (dir construct:'abbrev.stc') asFilename readStream. |
5790 |
self readAbbreviationsFromStream:abbrevStream. |
|
5791 |
abbrevStream close. |
|
7085
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5792 |
] on:FileStream openErrorSignal do:[:ex| "ignore this file"]. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5793 |
|
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5794 |
[ |
10071 | 5795 |
directoryContents := dir directoryContents. |
7085
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5796 |
] on:FileStream openErrorSignal do:[:ex| |
10071 | 5797 |
"non-accessable directory: we are done" |
5798 |
^ self |
|
7085
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5799 |
]. |
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5800 |
|
71d0e451114d
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
5801 |
directoryContents do:[:aFilename | |
10071 | 5802 |
|f| |
5803 |
||
5804 |
(#( |
|
5805 |
'doc' |
|
5806 |
'CVS' |
|
5807 |
'bitmaps' |
|
5808 |
'resources' |
|
5809 |
'source' |
|
5810 |
) includes:aFilename) ifFalse:[ |
|
5811 |
f := dir construct:aFilename. |
|
5812 |
f isDirectory ifTrue:[ |
|
5813 |
self recursiveReadAllAbbreviationsFrom:f maxLevels:maxLevels-1 |
|
5814 |
] |
|
5815 |
]. |
|
4458 | 5816 |
]. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5817 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5818 |
|
8952 | 5819 |
resourceDirectoryForPackage:aPackage |
5820 |
"given a packageID, return the path to its resource directory; |
|
5821 |
nil if not found." |
|
5822 |
||
5823 |
|prjDir rsrcDir| |
|
5824 |
||
5825 |
prjDir := self projectDirectoryForPackage:aPackage. |
|
5826 |
||
5827 |
(prjDir notNil |
|
5828 |
and:[(prjDir := prjDir asFilename) exists |
|
5829 |
and:[(rsrcDir := prjDir construct:'resources') exists]]) ifTrue:[ |
|
10071 | 5830 |
^ rsrcDir |
8952 | 5831 |
]. |
8953 | 5832 |
rsrcDir := self getSystemFileName:('resources/' , (aPackage copyReplaceAll:$: with:$/)). |
5833 |
rsrcDir notNil ifTrue:[ |
|
10071 | 5834 |
^ rsrcDir asFilename |
5835 |
]. |
|
5836 |
^ nil |
|
5837 |
||
5838 |
" |
|
5839 |
Smalltalk resourceDirectoryForPackage:'stx:libbasic' |
|
5840 |
Smalltalk resourceDirectoryForPackage:'exept:expecco' |
|
8952 | 5841 |
Smalltalk resourceDirectoryForPackage:'exept:smartcard' |
5842 |
" |
|
5843 |
! |
|
5844 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5845 |
resourceFileStreamFor:aFileName |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5846 |
"search aFileName in some standard places; |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5847 |
return a readonly fileStream or nil if not found. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5848 |
Searches in subdirectories named 'resource' in SystemPath" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5849 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5850 |
^ self resourceFileStreamFor:aFileName forClass:nil |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5851 |
! |
7758 | 5852 |
|
5853 |
resourceFileStreamFor:aFileName forClass:aClassOrNil |
|
5854 |
"search aFileName in some standard places and in the classes |
|
5855 |
package-resource directory. |
|
5856 |
Return a readonly fileStream or nil if not found. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5857 |
Searches in subdirectories named 'resource' in SystemPath" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5858 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5859 |
|aString| |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5860 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5861 |
aString := self getResourceFileName:aFileName forClass:aClassOrNil. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5862 |
aString notNil ifTrue:[ |
10071 | 5863 |
^ aString asFilename readStreamOrNil |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5864 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5865 |
^ nil |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5866 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5867 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5868 |
searchPath:aPath for:aFileName in:aDirName |
7758 | 5869 |
"search aPath for a subdirectory named aDirectory with a file |
5870 |
named aFileName" |
|
5871 |
||
5872 |
|f| |
|
5873 |
||
10071 | 5874 |
((f := aFileName asFilename) isAbsolute |
7758 | 5875 |
or:[f isExplicitRelative]) ifTrue:[ |
10071 | 5876 |
"/ |
5877 |
"/ dont use path for absolute or explicit .-relative file names |
|
5878 |
"/ |
|
5879 |
^ aFileName |
|
7758 | 5880 |
]. |
5881 |
||
5882 |
aPath notNil ifTrue:[ |
|
10071 | 5883 |
aPath do:[:dirName | |
5884 |
|realName dir| |
|
5885 |
||
5886 |
dir := dirName asFilename. |
|
5887 |
aDirName notNil ifTrue:[ |
|
5888 |
realName := (dir construct:aDirName) construct:aFileName. |
|
5889 |
] ifFalse:[ |
|
5890 |
realName := dir construct:aFileName. |
|
5891 |
]. |
|
5892 |
(realName isReadable) ifTrue:[ |
|
5893 |
^ realName name |
|
5894 |
] |
|
5895 |
]. |
|
7758 | 5896 |
]. |
5897 |
||
5898 |
^ nil. |
|
5899 |
||
5900 |
"Modified: / 29.4.1999 / 15:06:43 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5901 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5902 |
|
10071 | 5903 |
setFilename:aFileNameString forClass:aClassNameString package:aPackageNameString |
9905
625e0c143984
abbrev conflict check was too harsh
Claus Gittinger <cg@exept.de>
parents:
9838
diff
changeset
|
5904 |
|classNameSymbol oldAbbrev oldPath newPath cls abbrevs| |
8470
d79e917d4f36
Define #setFilename:forClass:package: to define an abbreviation.
Stefan Vogel <sv@exept.de>
parents:
8445
diff
changeset
|
5905 |
|
d79e917d4f36
Define #setFilename:forClass:package: to define an abbreviation.
Stefan Vogel <sv@exept.de>
parents:
8445
diff
changeset
|
5906 |
CachedAbbreviations isNil ifTrue:[ |
10071 | 5907 |
CachedAbbreviations := IdentityDictionary new. |
8470
d79e917d4f36
Define #setFilename:forClass:package: to define an abbreviation.
Stefan Vogel <sv@exept.de>
parents:
8445
diff
changeset
|
5908 |
]. |
d79e917d4f36
Define #setFilename:forClass:package: to define an abbreviation.
Stefan Vogel <sv@exept.de>
parents:
8445
diff
changeset
|
5909 |
|
d79e917d4f36
Define #setFilename:forClass:package: to define an abbreviation.
Stefan Vogel <sv@exept.de>
parents:
8445
diff
changeset
|
5910 |
abbrevs := CachedAbbreviations. |
d79e917d4f36
Define #setFilename:forClass:package: to define an abbreviation.
Stefan Vogel <sv@exept.de>
parents:
8445
diff
changeset
|
5911 |
aClassNameString ~= aFileNameString ifTrue:[ |
10071 | 5912 |
classNameSymbol := aClassNameString asSymbol. |
5913 |
oldAbbrev := abbrevs at:classNameSymbol ifAbsent:nil. |
|
5914 |
oldAbbrev notNil ifTrue:[ |
|
5915 |
oldAbbrev ~= aFileNameString ifTrue:[ |
|
5916 |
oldAbbrev asFilename isAbsolute |
|
5917 |
ifTrue:[ oldPath := oldAbbrev ] |
|
5918 |
ifFalse:[ oldPath := (self projectDirectoryForPackage:aPackageNameString) asFilename constructString: oldAbbrev ]. |
|
5919 |
aFileNameString asFilename isAbsolute |
|
5920 |
ifTrue:[ newPath := aFileNameString ] |
|
5921 |
ifFalse:[ newPath := (self projectDirectoryForPackage:aPackageNameString) asFilename constructString: aFileNameString ]. |
|
5922 |
||
5923 |
oldPath ~= newPath ifTrue:[ |
|
5924 |
StandAlone ifFalse:[ |
|
5925 |
('Smalltalk [warning]: autoload path change for: ',aClassNameString,' in package ',aPackageNameString) infoPrintCR. |
|
5926 |
('Smalltalk [info]: old: ',oldPath) infoPrintCR. |
|
5927 |
('Smalltalk [info]: new: ',newPath) infoPrintCR. |
|
5928 |
] |
|
5929 |
] |
|
5930 |
]. |
|
5931 |
"overwrite old abbreviation with new one, |
|
5932 |
to allow fixing of bad abbrev files" |
|
5933 |
]. |
|
5934 |
||
5935 |
cls := self classNamed:aFileNameString. |
|
5936 |
cls notNil ifTrue:[ |
|
5937 |
cls name ~= aClassNameString ifTrue:[ |
|
5938 |
"/ ok, there is a class named after this abbrev ... |
|
5939 |
"/ this is only a conflict, if the other class has no |
|
5940 |
"/ abbreviation (or the same). |
|
5941 |
(abbrevs at:(cls name asSymbol) ifAbsent:cls name) = aFileNameString ifTrue:[ |
|
5942 |
cls isNameSpace ifFalse:[ |
|
5943 |
aPackageNameString = cls package ifTrue:[ |
|
5944 |
StandAlone ifFalse:[ |
|
5945 |
('Smalltalk [warning]: conflict for: ' , cls name , |
|
5946 |
' in package ' , aPackageNameString) infoPrintCR. |
|
5947 |
('Smalltalk [warning]: (' , aClassNameString , ' -> ' , aFileNameString |
|
5948 |
, ')') infoPrintCR |
|
5949 |
] |
|
5950 |
] |
|
5951 |
] |
|
5952 |
] |
|
5953 |
] |
|
5954 |
]. |
|
5955 |
abbrevs at:classNameSymbol put:aFileNameString. |
|
8470
d79e917d4f36
Define #setFilename:forClass:package: to define an abbreviation.
Stefan Vogel <sv@exept.de>
parents:
8445
diff
changeset
|
5956 |
] |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5957 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5958 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5959 |
sourceDirectoryNameOfClass:aClassOrClassName |
7758 | 5960 |
"for a given class, return the pathname relative to TOP of the classes source code. |
5961 |
Read the files 'abbrev.stc' and 'liblist.stc' (which are created during the compilation process) |
|
5962 |
for an entry for aClassOrClassName. |
|
5963 |
Search for the className in the first col, and return the value found in |
|
5964 |
the 3rd col. |
|
5965 |
Return nil if no entry is found." |
|
5966 |
||
5967 |
|aStream line words n aClassName| |
|
5968 |
||
5969 |
aClassOrClassName isBehavior ifTrue:[ |
|
10071 | 5970 |
aClassName := aClassOrClassName name |
7758 | 5971 |
] ifFalse:[ |
10071 | 5972 |
aClassName := aClassOrClassName |
7758 | 5973 |
]. |
5974 |
aClassName := aClassName asString. |
|
5975 |
||
5976 |
#('include/abbrev.stc' 'include/liblist.stc') "/ filenames |
|
5977 |
with:#(3 2) "/ column |
|
5978 |
do:[:fileName :col | |
|
5979 |
||
10071 | 5980 |
aStream := self systemFileStreamFor:fileName. |
5981 |
aStream notNil ifTrue:[ |
|
5982 |
[aStream atEnd] whileFalse:[ |
|
5983 |
line := aStream nextLine. |
|
5984 |
line notNil ifTrue:[ |
|
5985 |
(line startsWith:'#') ifFalse:[ |
|
5986 |
words := line asCollectionOfWords. |
|
5987 |
(n := words size) > 1 ifTrue:[ |
|
5988 |
(words at:1) = aClassName ifTrue:[ |
|
5989 |
n >= col ifTrue:[ |
|
5990 |
aStream close. |
|
5991 |
^ (words at:col) withoutSeparators |
|
5992 |
] |
|
5993 |
] |
|
5994 |
] |
|
5995 |
] |
|
5996 |
] |
|
5997 |
]. |
|
5998 |
aStream close |
|
5999 |
]. |
|
617 | 6000 |
]. |
6001 |
||
6002 |
^ nil |
|
191 | 6003 |
|
6004 |
" |
|
10071 | 6005 |
Smalltalk sourceDirectoryNameOfClass:'ClockView' |
6006 |
Smalltalk sourceDirectoryNameOfClass:'Bag' |
|
6007 |
Smalltalk sourceDirectoryNameOfClass:'GLWireCubeDemoView' |
|
6008 |
Smalltalk sourceDirectoryNameOfClass:'SomeNonExistingClass' |
|
617 | 6009 |
" |
6010 |
||
6011 |
"Created: 6.11.1995 / 15:43:30 / cg" |
|
728
50cf1c907c28
again search liblist for a classes source directory
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
6012 |
"Modified: 9.12.1995 / 23:54:14 / cg" |
2033 | 6013 |
"Modified: 3.1.1997 / 11:26:44 / stefan" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6014 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6015 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6016 |
sourceFileStreamFor:aFileName |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6017 |
"search aFileName in some standard places; |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6018 |
return a readonly fileStream or nil if not found. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6019 |
Searches in subdirectories named 'source' in SystemPath" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6020 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6021 |
|aString| |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6022 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6023 |
aString := self getSourceFileName:aFileName. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6024 |
aString notNil ifTrue:[ |
10071 | 6025 |
^ aString asFilename readStreamOrNil |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6026 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6027 |
^ nil |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6028 |
! |
7758 | 6029 |
|
6030 |
systemFileStreamFor:aFileName |
|
6031 |
"search aFileName in some standard places; |
|
6032 |
return a readonly fileStream or nil if not found. |
|
6033 |
see comment in Smalltalk>>initSystemPath" |
|
6034 |
||
6035 |
|aString| |
|
6036 |
||
6037 |
aString := self getSystemFileName:aFileName. |
|
6038 |
aString notNil ifTrue:[ |
|
10071 | 6039 |
^ aString asFilename readStreamOrNil |
617 | 6040 |
]. |
6041 |
^ nil |
|
6042 |
! |
|
6043 |
||
7758 | 6044 |
systemPath |
6045 |
"return a collection of directorynames, where smalltalk |
|
10071 | 6046 |
looks for system files |
617 | 6047 |
(usually in subdirs such as resources, bitmaps, source etc.) |
6048 |
see comment in Smalltalk>>initSystemPath." |
|
6049 |
||
6050 |
^ SystemPath |
|
6051 |
||
6052 |
" |
|
6053 |
Smalltalk systemPath |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6054 |
Smalltalk systemPath addLast:'someOtherDirectoryPath' |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6055 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6056 |
! |
617 | 6057 |
|
7758 | 6058 |
systemPath:aPath |
6059 |
"set the collection of directorynames, where smalltalk |
|
10071 | 6060 |
looks for system files |
7758 | 6061 |
(usually in subdirs such as resources, bitmaps, source etc.) |
6062 |
see comment in Smalltalk>>initSystemPath." |
|
6063 |
||
6064 |
SystemPath := aPath. |
|
6065 |
self flushPathCaches |
|
6066 |
||
6067 |
" |
|
6068 |
Smalltalk systemPath |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6069 |
Smalltalk systemPath:(Smalltalk systemPath copy addLast:'someOtherDirectoryPath') |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6070 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6071 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6072 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6073 |
!Smalltalk class methodsFor:'system management-packages'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6074 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6075 |
knownPackages |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6076 |
^ KnownPackages ? #() |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6077 |
! |
7758 | 6078 |
|
6079 |
loadExtensionsForPackage:aPackageId |
|
9600 | 6080 |
|mgr packageDirName inStream| |
6081 |
||
6082 |
" |
|
6083 |
if there is a sourceCodeManager, ask it first for the extensions |
|
6084 |
" |
|
6085 |
(mgr := Smalltalk at:#SourceCodeManager) notNil ifTrue:[ |
|
10071 | 6086 |
inStream := mgr getMostRecentSourceStreamForFile:'extensions.st' inPackage:aPackageId. |
6087 |
inStream notNil ifTrue:[ |
|
6088 |
Class withoutUpdatingChangeSetDo:[ |
|
6089 |
inStream fileIn. |
|
6090 |
]. |
|
6091 |
inStream close. |
|
6092 |
SilentLoading ifFalse:[ |
|
6093 |
Transcript showCR:('loaded extensions for ',aPackageId,' from repository'). |
|
6094 |
]. |
|
6095 |
^ true |
|
6096 |
] |
|
9600 | 6097 |
]. |
7758 | 6098 |
|
6099 |
packageDirName := aPackageId copyReplaceAll:$: with:$/. |
|
6100 |
packageDirName := self getPackageFileName:packageDirName. |
|
9600 | 6101 |
packageDirName notNil ifTrue:[ |
10071 | 6102 |
^ self loadExtensionsFromDirectory:packageDirName |
9600 | 6103 |
]. |
6104 |
^ false |
|
7758 | 6105 |
! |
6106 |
||
6107 |
loadExtensionsFromDirectory:packageDirOrString |
|
6108 |
|packageDir f| |
|
6109 |
||
6110 |
packageDir := packageDirOrString asFilename. |
|
6111 |
||
6112 |
f := packageDir construct:'extensions.st'. |
|
6113 |
f exists ifTrue:[ |
|
10071 | 6114 |
Class withoutUpdatingChangeSetDo:[ |
6115 |
f fileIn. |
|
6116 |
]. |
|
6117 |
SilentLoading ifFalse:[ |
|
6118 |
Transcript showCR:('loaded extensions: ' , f pathName). |
|
6119 |
]. |
|
6120 |
^ true |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6121 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6122 |
^ false |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6123 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6124 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6125 |
loadPackage:aPackageIdOrPackage |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6126 |
"make certain, that some particular package is loaded into the system. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6127 |
Experimental." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6128 |
|
10046 | 6129 |
(aPackageIdOrPackage isString) ifTrue:[ |
10071 | 6130 |
^ self loadPackageWithId:aPackageIdOrPackage asAutoloaded:false |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6131 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6132 |
self shouldImplement. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6133 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6134 |
" |
10071 | 6135 |
Smalltalk loadPackage:'stx:libbasic' |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6136 |
Smalltalk loadPackage:'stx:goodies/persistency' |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6137 |
Smalltalk loadPackage:'cg:cparser' |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6138 |
Smalltalk loadPackage:'cg:rose' |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6139 |
" |
7758 | 6140 |
! |
6141 |
||
6142 |
loadPackage:packageId fromAllSourceFilesInDirectory:aDirectory |
|
6143 |
"load all source files found in aDirectory and treat them like |
|
6144 |
a package. Allows for initial import of alien ST-code as a new package. |
|
6145 |
Experimental." |
|
6146 |
||
9028 | 6147 |
|p t new anyFail repeatCount| |
7758 | 6148 |
|
6149 |
"/ problem: dependencies. |
|
6150 |
"/ solution: repeat twice, so that superclasses are present the second time |
|
6151 |
||
6152 |
Class packageQuerySignal answer:packageId asSymbol do:[ |
|
10071 | 6153 |
|any| |
6154 |
||
6155 |
repeatCount := 0. |
|
6156 |
[ |
|
6157 |
repeatCount := repeatCount + 1. |
|
6158 |
anyFail := false. |
|
6159 |
aDirectory directoryContents do:[:file | |
|
6160 |
|fn| |
|
6161 |
||
6162 |
fn := aDirectory construct:file. |
|
6163 |
(fn hasSuffix:'st') ifTrue:[ |
|
6164 |
Metaclass confirmationQuerySignal answer:false |
|
6165 |
do:[ |
|
6166 |
Error |
|
6167 |
handle:[:ex | |
|
6168 |
anyFail := true |
|
6169 |
] |
|
6170 |
do:[ |
|
6171 |
(self fileIn:fn) ifFalse:[ |
|
6172 |
anyFail := true |
|
6173 |
] ifTrue:[ |
|
6174 |
any := true. |
|
6175 |
] |
|
6176 |
] |
|
6177 |
] |
|
6178 |
] |
|
6179 |
]. |
|
6180 |
any ifFalse:[ |
|
6181 |
^ false "/ no file found |
|
6182 |
] |
|
6183 |
] doWhile:[anyFail and:[repeatCount<2]]. |
|
6184 |
]. |
|
6185 |
||
4718 | 6186 |
new := (p := Project projectWithId:packageId) isNil. |
6187 |
new ifTrue:[ p := Project new]. |
|
6188 |
||
6189 |
p name:packageId. |
|
6190 |
p directory:aDirectory. |
|
4726 | 6191 |
p package:packageId. |
4718 | 6192 |
t := packageId asCollectionOfSubstringsSeparatedByAny:'/\:'. |
6193 |
p repositoryModule:(t first). |
|
6194 |
p repositoryDirectory:(packageId copyFrom:t first size + 2). |
|
6195 |
p isLoaded:true. |
|
6196 |
||
6197 |
new ifTrue:[Project addLoadedProject:p]. |
|
6198 |
^ anyFail not |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6199 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6200 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6201 |
loadPackage:packageId fromClassLibrary:aFilename |
7758 | 6202 |
"load a package from a compiled classLib. |
6203 |
Experimental." |
|
6204 |
||
6205 |
|p t new| |
|
6206 |
||
6207 |
(self fileIn:aFilename) ifFalse:[ |
|
10071 | 6208 |
(self fileInClassLibrary:aFilename) ifFalse:[ |
6209 |
self warn:'Failed to load the package ', packageId printString. |
|
6210 |
^ false. |
|
6211 |
] |
|
7758 | 6212 |
]. |
6213 |
||
6214 |
new := (p := Project projectWithId:packageId) isNil. |
|
6215 |
new ifTrue:[ p := Project new]. |
|
6216 |
||
6217 |
p name:packageId. |
|
6218 |
p directory:aFilename directory. |
|
6219 |
p package:packageId. |
|
6220 |
t := packageId asCollectionOfSubstringsSeparatedByAny:'/\:'. |
|
6221 |
p repositoryModule:(t first). |
|
6222 |
p repositoryDirectory:(packageId copyFrom:t first size + 2). |
|
6223 |
p isLoaded:true. |
|
4723 | 6224 |
|
6225 |
new ifTrue:[Project addLoadedProject:p]. |
|
6226 |
^ true |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6227 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6228 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6229 |
loadPackage:packageId fromLoadAllFile:aFilename |
7758 | 6230 |
"load a package from a loadAll - loader script. |
6231 |
Experimental." |
|
6232 |
||
6233 |
|p t new| |
|
6234 |
||
6235 |
Metaclass confirmationQuerySignal answer:false |
|
6236 |
do:[ |
|
10071 | 6237 |
(self fileIn:aFilename) ifFalse:[ |
6238 |
self warn:'Failed to load the package ', packageId printString. |
|
6239 |
^ false. |
|
6240 |
] |
|
7758 | 6241 |
]. |
6242 |
||
6243 |
new := (p := Project projectWithId:packageId) isNil. |
|
6244 |
new ifTrue:[ p := Project new]. |
|
6245 |
||
6246 |
p name:packageId. |
|
6247 |
p directory:aFilename directory. |
|
6248 |
p package:packageId. |
|
6249 |
t := packageId asCollectionOfSubstringsSeparatedByAny:'/\:'. |
|
6250 |
p repositoryModule:(t first). |
|
6251 |
p repositoryDirectory:(packageId copyFrom:t first size + 2). |
|
6252 |
p isLoaded:true. |
|
6253 |
||
6254 |
new ifTrue:[Project addLoadedProject:p]. |
|
6255 |
^ true |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6256 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6257 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6258 |
loadPackage:aPackageId fromZIPArchive:f asAutoloaded:doLoadAsAutoloaded |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6259 |
"load a package from a .zip delivery file. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6260 |
Experimental." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6261 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6262 |
"/ not yet implemented ... |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6263 |
^ false |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6264 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6265 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6266 |
loadPackageFromAbbrevFile:aPackageId asAutoloaded:doLoadAsAutoloaded |
8378 | 6267 |
|abbrevFile packageDir| |
6268 |
||
6269 |
packageDir := self packageDirectoryForPackageId:aPackageId. |
|
8380 | 6270 |
packageDir isNil ifTrue:[^ false]. |
8378 | 6271 |
|
6272 |
"/ abbrev.stc ? |
|
6273 |
abbrevFile := packageDir construct:'abbrev.stc'. |
|
6274 |
abbrevFile exists ifFalse:[^ false]. |
|
6275 |
||
6276 |
Smalltalk installAutoloadedClassesFrom:abbrevFile pathName. |
|
6277 |
||
6278 |
doLoadAsAutoloaded ifFalse:[ |
|
10071 | 6279 |
"/ force autoloading... |
6280 |
Smalltalk allClassesInPackage:aPackageId do:[:eachClass | eachClass autoload]. |
|
8378 | 6281 |
]. |
6282 |
||
6283 |
self loadExtensionsFromDirectory:packageDir. |
|
6284 |
SilentLoading ifFalse:[ |
|
10071 | 6285 |
Transcript showCR:('loaded package: ' , aPackageId , ' from abbrev file: ' , abbrevFile pathName). |
8378 | 6286 |
]. |
6287 |
^ true |
|
9506 | 6288 |
|
6289 |
"Modified: / 10-08-2006 / 12:17:57 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6290 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6291 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6292 |
loadPackageWithId:aPackageId |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6293 |
"make certain, that some particular package is loaded into the system. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6294 |
Experimental." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6295 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6296 |
^ self loadPackageWithId:aPackageId asAutoloaded:false |
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 |
" |
10071 | 6299 |
Smalltalk loadPackageWithId:'stx:libbasic' |
7758 | 6300 |
Smalltalk loadPackageWithId:'stx:goodies/persistency' |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6301 |
Smalltalk loadPackageWithId:'cg:cparser' |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6302 |
Smalltalk loadPackageWithId:'cg:rose' |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6303 |
Smalltalk loadPackageWithId:'detemobil:smc' |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6304 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6305 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6306 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6307 |
loadPackageWithId:aPackageId asAutoloaded:doLoadAsAutoloaded |
7758 | 6308 |
"make certain, that some particular package is loaded into the system. |
6309 |
Experimental." |
|
6310 |
||
8379 | 6311 |
|pkg packageDir| |
7758 | 6312 |
|
6313 |
pkg := Project projectWithId:aPackageId. |
|
10071 | 6314 |
(pkg notNil and:[pkg isLoaded]) ifTrue:[ |
6315 |
"/ ('Smalltalk [info]: Package ' , aPackageId , ' already loaded.') infoPrintCR. |
|
6316 |
(doLoadAsAutoloaded |
|
6317 |
or:[pkg areAllClassesLoaded]) ifTrue:[ |
|
6318 |
^ true |
|
6319 |
]. |
|
7758 | 6320 |
]. |
6321 |
||
6322 |
"/ ok; not yet loaded. |
|
6323 |
"/ try to locate the package; try the following: |
|
6324 |
"/ $(packagePath)/<packageDir>/... |
|
6325 |
"/ $(SYSPATH)/packages/<packageDir> |
|
8378 | 6326 |
packageDir := self packageDirectoryForPackageId:aPackageId. |
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
6327 |
packageDir isNil ifTrue:[ |
10071 | 6328 |
(aPackageId includes:$:) ifFalse:[ |
6329 |
"/ assume stx |
|
6330 |
packageDir := self packageDirectoryForPackageId:('stx:',aPackageId). |
|
6331 |
]. |
|
9028 | 6332 |
]. |
6333 |
packageDir isNil ifTrue:[ |
|
10071 | 6334 |
('Smalltalk [warning]: cannot find packageDirectory for: ' , aPackageId) errorPrintCR. |
6335 |
^ false |
|
4718 | 6336 |
]. |
6337 |
||
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
6338 |
^ self |
10071 | 6339 |
loadPackageWithId:aPackageId |
6340 |
fromDirectory:packageDir |
|
6341 |
asAutoloaded:doLoadAsAutoloaded |
|
6342 |
||
6343 |
" |
|
6344 |
Smalltalk loadPackageWithId:'stx:libbasic' |
|
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
6345 |
Smalltalk loadPackageWithId:'stx:goodies/persistency' |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
6346 |
Smalltalk loadPackageWithId:'exept:ctypes' |
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
6347 |
" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6348 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6349 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6350 |
loadPackageWithId:aPackageId fromDirectory:packageDirOrString asAutoloaded:doLoadAsAutoloaded |
9819
39b29e0666bf
load from projectDefinition. if there is one
Claus Gittinger <cg@exept.de>
parents:
9805
diff
changeset
|
6351 |
|f packageDir packageName shLibName defClass| |
7758 | 6352 |
|
6353 |
packageDir := packageDirOrString asFilename. |
|
6354 |
||
9819
39b29e0666bf
load from projectDefinition. if there is one
Claus Gittinger <cg@exept.de>
parents:
9805
diff
changeset
|
6355 |
"/ if there is a project definiton, use that one to pull in the rest. |
39b29e0666bf
load from projectDefinition. if there is one
Claus Gittinger <cg@exept.de>
parents:
9805
diff
changeset
|
6356 |
defClass := ProjectDefinition definitionClassForPackage:aPackageId. |
39b29e0666bf
load from projectDefinition. if there is one
Claus Gittinger <cg@exept.de>
parents:
9805
diff
changeset
|
6357 |
defClass notNil ifTrue:[ |
10071 | 6358 |
defClass autoload. |
6359 |
defClass load. |
|
6360 |
^ true. |
|
10046 | 6361 |
]. |
6362 |
||
6363 |
"/ try to load the project definition class |
|
6364 |
f := (packageDir construct:(ProjectDefinition initialClassNameForDefinitionOf:aPackageId)) withSuffix:'st'. |
|
7758 | 6365 |
f exists ifTrue:[ |
10071 | 6366 |
f fileIn. |
6367 |
defClass := ProjectDefinition definitionClassForPackage:aPackageId. |
|
6368 |
defClass notNil ifTrue:[ |
|
6369 |
defClass load. |
|
6370 |
SilentLoading ifFalse:[ |
|
6371 |
Transcript showCR:('Smalltalk [info]: loaded package: ' , aPackageId , ' from project file: ' , f pathName). |
|
6372 |
]. |
|
6373 |
^ true |
|
6374 |
]. |
|
6375 |
]. |
|
6376 |
||
6377 |
"/ loadAll ? - well be soon obsolete |
|
7758 | 6378 |
f := packageDir construct:'loadAll'. |
8370
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
6379 |
f exists ifFalse:[ |
10071 | 6380 |
f := packageDir construct:'loadall'. |
8370
27cf91058821
look for both loadAll- and loadall-files when loading apackage
Claus Gittinger <cg@exept.de>
parents:
8358
diff
changeset
|
6381 |
]. |
7758 | 6382 |
f exists ifTrue:[ |
10071 | 6383 |
(self loadPackage:aPackageId fromLoadAllFile:f) ifTrue:[ |
6384 |
SilentLoading ifFalse:[ |
|
6385 |
Transcript showCR:('loaded package: ' , aPackageId , ' from loadAll file: ' , f pathName). |
|
6386 |
]. |
|
6387 |
^ true |
|
6388 |
] |
|
7758 | 6389 |
]. |
10046 | 6390 |
|
6391 |
packageName := packageDir baseName. |
|
6392 |
||
7758 | 6393 |
"/ .zip ? |
6394 |
f := (packageDir construct:packageName) withSuffix:'zip'. |
|
6395 |
f exists ifTrue:[ |
|
10071 | 6396 |
(self loadPackage:aPackageId fromZIPArchive:f asAutoloaded:doLoadAsAutoloaded) ifTrue:[ |
6397 |
SilentLoading ifFalse:[ |
|
6398 |
Transcript showCR:('loaded package: ' , aPackageId , ' from zip file: ' , f pathName). |
|
6399 |
]. |
|
6400 |
^ true |
|
6401 |
] |
|
7758 | 6402 |
]. |
6403 |
||
6404 |
shLibName := packageName , ObjectFileLoader sharedLibraryExtension. |
|
6405 |
||
6406 |
"/ .so ? |
|
6407 |
f := packageDir construct:shLibName. |
|
6408 |
f exists ifTrue:[ |
|
10071 | 6409 |
(self loadPackage:aPackageId fromClassLibrary:f) ifTrue:[ |
6410 |
SilentLoading ifFalse:[ |
|
6411 |
Transcript showCR:('loaded package: ' , aPackageId , ' from binary classLib file: ' , f pathName). |
|
6412 |
]. |
|
6413 |
doLoadAsAutoloaded ifFalse:[ |
|
6414 |
"/ force autoloading... |
|
6415 |
Smalltalk allClassesDo:[:eachClass | |
|
6416 |
eachClass package == aPackageId ifTrue:[ eachClass autoload]. |
|
6417 |
]. |
|
6418 |
]. |
|
6419 |
^ true |
|
6420 |
] |
|
7758 | 6421 |
]. |
6422 |
||
6423 |
"/ abbrev.stc ? |
|
8378 | 6424 |
(self loadPackageFromAbbrevFile:aPackageId asAutoloaded:doLoadAsAutoloaded) ifTrue:[ |
10071 | 6425 |
^ true |
7758 | 6426 |
]. |
6427 |
||
6428 |
"/ any .so ? -> load the first one found (maybe not a good idea) |
|
6429 |
packageDir directoryContentsAsFilenamesDo:[:aFilename | |
|
10071 | 6430 |
(aFilename hasSuffix:ObjectFileLoader sharedLibrarySuffix) ifTrue:[ |
6431 |
(self loadPackage:aPackageId fromClassLibrary:aFilename) ifTrue:[ |
|
6432 |
SilentLoading ifFalse:[ |
|
6433 |
Transcript showCR:('loaded package: ' , aPackageId , ' from binary classLib file: ' , aFilename pathName). |
|
6434 |
]. |
|
6435 |
doLoadAsAutoloaded ifFalse:[ |
|
6436 |
"/ force autoloading... |
|
6437 |
Smalltalk allClassesDo:[:eachClass | |
|
6438 |
eachClass package == aPackageId ifTrue:[ eachClass autoload]. |
|
6439 |
]. |
|
6440 |
]. |
|
6441 |
^ true |
|
6442 |
] |
|
6443 |
] |
|
5175
c3e71ead8e06
when loading a package, and a .so file could not be found
Claus Gittinger <cg@exept.de>
parents:
5168
diff
changeset
|
6444 |
]. |
5807
019d25b669e5
in loadPackage, if there is no loadAll file and no
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
6445 |
|
5051
81d5b5985154
package search fixed/improved
Claus Gittinger <cg@exept.de>
parents:
5047
diff
changeset
|
6446 |
"/ source files |
4737 | 6447 |
(self loadPackage:aPackageId fromAllSourceFilesInDirectory:packageDir) ifTrue:[ |
10071 | 6448 |
SilentLoading ifFalse:[ |
6449 |
Transcript showCR:('loaded package: ' , aPackageId , ' from source files in:' , packageDir pathName). |
|
6450 |
]. |
|
6451 |
^ true |
|
4737 | 6452 |
]. |
6453 |
^ false |
|
6454 |
||
4718 | 6455 |
" |
10071 | 6456 |
Smalltalk loadPackageWithId:'stx:libbasic' |
4718 | 6457 |
Smalltalk loadPackageWithId:'stx:goodies/persistency' |
4722 | 6458 |
Smalltalk loadPackageWithId:'exept:ctypes' |
4718 | 6459 |
" |
9819
39b29e0666bf
load from projectDefinition. if there is one
Claus Gittinger <cg@exept.de>
parents:
9805
diff
changeset
|
6460 |
|
39b29e0666bf
load from projectDefinition. if there is one
Claus Gittinger <cg@exept.de>
parents:
9805
diff
changeset
|
6461 |
"Modified: / 30-08-2006 / 18:29:20 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6462 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6463 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6464 |
packageDirectoryForPackageId:aPackageId |
8378 | 6465 |
|packageDirName packageDir| |
6466 |
||
6467 |
packageDirName := aPackageId copyReplaceAll:$: with:$/. |
|
6468 |
||
6469 |
packageDir := self getPackageFileName:packageDirName. |
|
6470 |
packageDir isNil ifTrue:[ |
|
10071 | 6471 |
"/ for convenience: try ../../.. as well |
6472 |
"/ (when executing in thedevelopment environment) |
|
6473 |
packageDir := '../../..' asFilename construct:packageDirName. |
|
6474 |
packageDir exists ifFalse:[ ^ nil]. |
|
8379 | 6475 |
]. |
6476 |
^ packageDir asFilename |
|
8378 | 6477 |
|
6478 |
" |
|
10071 | 6479 |
Smalltalk packageDirectoryForPackageId:'stx:libbasic' |
8378 | 6480 |
Smalltalk packageDirectoryForPackageId:'stx:goodies/persistency' |
6481 |
Smalltalk packageDirectoryForPackageId:'exept:ctypes' |
|
6482 |
" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6483 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6484 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6485 |
!Smalltalk class methodsFor:'system management-undeclared variables'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6486 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6487 |
clearUndeclaredVariables |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6488 |
"remove all undeclared variables" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6489 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6490 |
(Smalltalk at:#Undeclared) do:[:eachKey | |
10071 | 6491 |
Smalltalk removeKey:(self undeclaredPrefix , eachKey) asSymbol. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6492 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6493 |
(Smalltalk at:#Undeclared) removeAll. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6494 |
Smalltalk removeKey:#Undeclared. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6495 |
! |
7758 | 6496 |
|
6497 |
undeclaredPrefix |
|
7563 | 6498 |
"the prefix used for undeclared variables" |
6499 |
||
6500 |
^ 'Undeclared:::' |
|
6711 | 6501 |
|
6502 |
"Created: / 31.10.1997 / 01:13:10 / cg" |
|
7758 | 6503 |
! ! |
6504 |
||
6505 |
!Smalltalk class methodsFor:'time-versions'! |
|
6506 |
||
6507 |
configuration |
|
6508 |
"{ Pragma: +optSpace }" |
|
6509 |
||
6510 |
"for developers only: return the configuration, with which |
|
6511 |
this smalltalk was compiled." |
|
6512 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6513 |
%{ /* NOCONTEXT */ |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6514 |
extern char *__getConfigurationString(); |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6515 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6516 |
RETURN (__MKSTRING(__getConfigurationString() COMMA_SND)); |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6517 |
%}. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6518 |
^ 'unknownOS/unknownCONF:unknownPACK' |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6519 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6520 |
" |
10071 | 6521 |
Smalltalk configuration |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6522 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6523 |
! |
453 | 6524 |
|
7758 | 6525 |
copyrightString |
6526 |
"{ Pragma: +optSpace }" |
|
6527 |
||
6528 |
"return a copyright string" |
|
6529 |
||
6530 |
%{ /* NOCONTEXT */ |
|
6531 |
#ifndef __getCopyrightString |
|
6532 |
extern OBJ __getCopyrightString(); |
|
6533 |
#endif |
|
6534 |
||
6535 |
RETURN (__getCopyrightString()); |
|
6536 |
%}. |
|
6537 |
^ self primitiveFailed |
|
6538 |
||
6539 |
" |
|
6540 |
Smalltalk copyrightString |
|
6541 |
" |
|
6542 |
! |
|
6543 |
||
6544 |
distributorString |
|
6545 |
"{ Pragma: +optSpace }" |
|
7563 | 6546 |
|
6547 |
"return a string describing the distributor of this software" |
|
567 | 6548 |
|
6549 |
%{ /* NOCONTEXT */ |
|
829
fc386319f41c
removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents:
822
diff
changeset
|
6550 |
#ifndef __getDistributorString |
fc386319f41c
removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents:
822
diff
changeset
|
6551 |
extern OBJ __getDistributorString(); |
568 | 6552 |
#endif |
6553 |
||
829
fc386319f41c
removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents:
822
diff
changeset
|
6554 |
RETURN (__getDistributorString()); |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6555 |
%}. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6556 |
^ 'eXept Software AG, Germany' |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6557 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6558 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6559 |
Smalltalk distributorString |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6560 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6561 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6562 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6563 |
expirationTime |
7758 | 6564 |
"{ Pragma: +optSpace }" |
6565 |
||
6566 |
"for developers only: return the time when the system will expire. |
|
6567 |
after this time it will not run any longer. |
|
6568 |
It returns nil, if no expiration time has been set (system runs forever :-))" |
|
6569 |
||
6570 |
|exp| |
|
6571 |
||
10071 | 6572 |
%{ |
7758 | 6573 |
extern unsigned int __getExpirationTime(); |
6574 |
||
6575 |
exp = __MKUINT(__getExpirationTime()); |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6576 |
%}. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6577 |
exp == 0 ifTrue:[ |
10071 | 6578 |
^ nil |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6579 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6580 |
^ Timestamp new fromOSTime:(exp * 1000). "OSTime is ms since 1970" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6581 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6582 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6583 |
Smalltalk expirationTime |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6584 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6585 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6586 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6587 |
fullVersionString |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6588 |
"{ Pragma: +optSpace }" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6589 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6590 |
"return a full version string" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6591 |
|
10071 | 6592 |
^ 'Smalltalk/X release ' , self versionString , ' of ' , self versionDate |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6593 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6594 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6595 |
Smalltalk fullVersionString |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6596 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6597 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6598 |
"Created: / 27.10.1997 / 17:03:09 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6599 |
"Modified: / 27.10.1997 / 17:04:02 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6600 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6601 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6602 |
hello |
7758 | 6603 |
"{ Pragma: +optSpace }" |
6604 |
||
6605 |
"return a greeting string" |
|
6606 |
||
6607 |
"stupid: this should come from a resource file ... |
|
6608 |
but I dont use it here, to allow mini-systems without |
|
6609 |
Resource-stuff." |
|
6610 |
||
6611 |
|proto lang| |
|
6612 |
||
6613 |
lang := Language. |
|
6614 |
(lang == #de) ifTrue:[ |
|
10071 | 6615 |
proto := 'Willkommen bei %1 (Version %2 von %3)' |
7758 | 6616 |
] ifFalse:[ (lang == #fr) ifTrue:[ |
10071 | 6617 |
proto := 'Salut, Bienvenue à %1 (version %2 de %3)' |
7758 | 6618 |
] ifFalse:[ (lang == #it) ifTrue:[ |
10071 | 6619 |
proto := 'Ciao, benvenuto al %1 (versione %2 di %3)' |
7758 | 6620 |
] ifFalse:[ (lang == #es) ifTrue:[ |
8084
88bccdc5943d
fileNameForClass (when checking in): repl. colons by underlines
Claus Gittinger <cg@exept.de>
parents:
7999
diff
changeset
|
6621 |
"/ proto := 'Hola, bienvenida a %1 (versión %2 de %3)' |
5641 | 6622 |
] ifFalse:[ (lang == #es) ifTrue:[ |
8084
88bccdc5943d
fileNameForClass (when checking in): repl. colons by underlines
Claus Gittinger <cg@exept.de>
parents:
7999
diff
changeset
|
6623 |
"/ proto := 'Oi, benvindo a %1 (versão %2 de %3)' |
5641 | 6624 |
] ifFalse:[ (lang == #no) ifTrue:[ |
10071 | 6625 |
proto := 'Hei, verdenmottakelse til %1 (versjon %2 av %3)' |
5641 | 6626 |
]]]]]]. |
1307 | 6627 |
|
6628 |
"/ ... more needed here ... |
|
6629 |
||
6630 |
proto isNil ifTrue:[ |
|
10071 | 6631 |
proto := 'Hello World - here is %1 version %2 of %3'. |
453 | 6632 |
]. |
1307 | 6633 |
|
6187 | 6634 |
^ proto bindWith:('SmallTalk/X' allBold) |
10071 | 6635 |
with:(self versionString) |
6636 |
with:(self versionDate) |
|
6637 |
||
6638 |
" |
|
6639 |
Smalltalk language:#us. |
|
6640 |
Smalltalk hello |
|
6641 |
||
6642 |
Smalltalk language:#de. |
|
6643 |
Smalltalk hello |
|
6644 |
||
6645 |
Smalltalk language:#no. |
|
6646 |
Smalltalk hello |
|
5641 | 6647 |
|
1422 | 6648 |
Transcript showCR:(Smalltalk hello) |
6649 |
Stdout showCR:(Smalltalk hello) |
|
453 | 6650 |
" |
1307 | 6651 |
|
1412 | 6652 |
"Modified: 18.5.1996 / 14:25:13 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6653 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6654 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6655 |
imageRestartTime |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6656 |
"return a timestamp for the moment when this image was restarted. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6657 |
If we do not execute from an image (i.e. fresh start), return nil." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6658 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6659 |
^ ImageRestartTime |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6660 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6661 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6662 |
Smalltalk imageStartTime |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6663 |
Smalltalk imageRestartTime |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6664 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6665 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6666 |
"Created: 13.12.1995 / 17:44:20 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6667 |
"Modified: 6.3.1996 / 11:56:35 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6668 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6669 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6670 |
imageSaveTime |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6671 |
"{ Pragma: +optSpace }" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6672 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6673 |
"return a timestamp for the moment when this image was saved" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6674 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6675 |
^ ObjectMemory imageSaveTime |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6676 |
! |
7758 | 6677 |
|
6678 |
imageStartTime |
|
6679 |
"{ Pragma: +optSpace }" |
|
6680 |
||
6681 |
"return a timestamp for the moment when this system started the first time |
|
6682 |
(i.e. the first initial start without an image)" |
|
6683 |
||
6684 |
^ ImageStartTime |
|
6685 |
||
6686 |
" |
|
6687 |
Smalltalk imageStartTime |
|
6688 |
Smalltalk imageRestartTime |
|
6689 |
" |
|
6690 |
||
6691 |
"Created: 13.12.1995 / 17:44:14 / cg" |
|
6692 |
"Modified: 13.12.1995 / 17:45:47 / cg" |
|
6693 |
! |
|
6694 |
||
6695 |
majorVersionNr |
|
6696 |
"{ Pragma: +optSpace }" |
|
7563 | 6697 |
|
6698 |
"return the major version number. |
|
617 | 6699 |
This is only incremented for very fundamental changes, |
6700 |
which make old object files totally incompatible |
|
6701 |
(for example, if the layout/representation of fundamental |
|
3382 | 6702 |
classes changes). |
6703 |
||
3988 | 6704 |
ST/X revision Naming is: |
10071 | 6705 |
<major>.<minor>.<revision>.<release>" |
7362
1af5f648cdb2
major version bumb (due to class-layout change)
Claus Gittinger <cg@exept.de>
parents:
7348
diff
changeset
|
6706 |
|
1af5f648cdb2
major version bumb (due to class-layout change)
Claus Gittinger <cg@exept.de>
parents:
7348
diff
changeset
|
6707 |
^ 5 |
617 | 6708 |
|
6709 |
" |
|
6710 |
Smalltalk majorVersionNr |
|
6711 |
" |
|
1941
51332fe23542
bumped version to 3 (I guess, nameSpaces are a major step)
Claus Gittinger <cg@exept.de>
parents:
1917
diff
changeset
|
6712 |
|
51332fe23542
bumped version to 3 (I guess, nameSpaces are a major step)
Claus Gittinger <cg@exept.de>
parents:
1917
diff
changeset
|
6713 |
"Modified: 8.11.1996 / 19:59:21 / cg" |
617 | 6714 |
! |
6715 |
||
7758 | 6716 |
minorVersionNr |
6717 |
"{ Pragma: +optSpace }" |
|
6718 |
||
6719 |
"return the minor version number. |
|
6720 |
This is incremented for changes which make some old object |
|
6721 |
files incompatible, or the protocol changes such that some |
|
6722 |
classes need rework. |
|
6723 |
||
6724 |
ST/X revision Naming is: |
|
10071 | 6725 |
<major>.<minor>.<revision>.<release>" |
7981 | 6726 |
|
9531 | 6727 |
^ 3 |
7758 | 6728 |
|
6729 |
" |
|
6730 |
Smalltalk minorVersionNr |
|
6731 |
" |
|
6732 |
||
9531 | 6733 |
"Modified: / 16-08-2006 / 09:37:25 / cg" |
7758 | 6734 |
! |
6735 |
||
6736 |
releaseIdentification |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6737 |
"{ Pragma: +optSpace }" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6738 |
|
10071 | 6739 |
"for developers only: return the release |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6740 |
(to further identify the version in case of errors)" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6741 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6742 |
%{ /* NOCONTEXT */ |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6743 |
extern OBJ __getRel(); |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6744 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6745 |
RETURN (__getRel()); |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6746 |
%}. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6747 |
^ 'ST/X_experimental' |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6748 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6749 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6750 |
Smalltalk releaseIdentification |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6751 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6752 |
! |
7758 | 6753 |
|
6754 |
releaseNr |
|
7563 | 6755 |
"{ Pragma: +optSpace }" |
6756 |
||
6757 |
"return the revision number. |
|
7758 | 6758 |
Incremented for releases which fix bugs/add features but did not find |
6759 |
their way to the outside world. |
|
3988 | 6760 |
|
6761 |
ST/X revision Naming is: |
|
10071 | 6762 |
<major>.<minor>.<revision>.<release>" |
8663 | 6763 |
|
10065 | 6764 |
^ 2 |
617 | 6765 |
|
10071 | 6766 |
" |
6767 |
Smalltalk releaseNr |
|
617 | 6768 |
" |
732
29a49feab799
release bump - that seems to be a good one
Claus Gittinger <cg@exept.de>
parents:
728
diff
changeset
|
6769 |
|
10065 | 6770 |
"Created: / 10-12-1995 / 01:42:19 / cg" |
6771 |
"Modified: / 10-10-2006 / 22:27:53 / cg" |
|
617 | 6772 |
! |
6773 |
||
7758 | 6774 |
revisionNr |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6775 |
"{ Pragma: +optSpace }" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6776 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6777 |
"return the revision number. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6778 |
Incremented for releases which fix bugs/add features |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6779 |
and represent a stable workable version which got published |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6780 |
to the outside world. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6781 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6782 |
ST/X revision Naming is: |
10071 | 6783 |
<major>.<minor>.<revision>.<release>" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6784 |
|
9531 | 6785 |
^ 1 |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6786 |
|
10071 | 6787 |
" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6788 |
Smalltalk revisionNr |
10071 | 6789 |
Smalltalk hello |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6790 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6791 |
|
9531 | 6792 |
"Modified: / 16-08-2006 / 09:37:29 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6793 |
! |
617 | 6794 |
|
7758 | 6795 |
timeStamp |
6796 |
"return a string useful for timestamping a file. |
|
6797 |
The returned string is padded with spaces for a constant |
|
6798 |
length (to avoid changing a files size in fileOut with unchanged |
|
6799 |
class)." |
|
6800 |
||
6801 |
^ ('''' , self timeStampString , '''') paddedTo:80 with:(Character space) |
|
6802 |
! |
|
6803 |
||
6804 |
timeStamp:aStream |
|
6805 |
"write a string useful for timestamping a file onto aStream. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6806 |
ST80 compatibility" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6807 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6808 |
aStream nextPutAll:(self timeStamp). |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6809 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6810 |
"Created: / 18.6.1998 / 17:22:58 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6811 |
! |
7758 | 6812 |
|
6813 |
timeStampString |
|
6814 |
"return a string useful for timestamping a file." |
|
6815 |
||
7962 | 6816 |
|dateString| |
6817 |
||
8115 | 6818 |
dateString := String streamContents:[:s | Date today printOn:s language:#en]. "/ MUST be english !!!! |
7962 | 6819 |
|
7758 | 6820 |
^ ('From Smalltalk/X, Version:' , (Smalltalk versionString) , ' on ' |
7962 | 6821 |
, dateString , ' at ' , Time now printString |
7758 | 6822 |
) |
6823 |
! |
|
6824 |
||
6825 |
versionDate |
|
6826 |
"{ Pragma: +optSpace }" |
|
6827 |
||
6828 |
"return the executables build date - thats the date when the smalltalk |
|
6829 |
executable was built" |
|
6830 |
||
6831 |
%{ /* NOCONTEXT */ |
|
6832 |
extern char *__getBuildDateString(); |
|
6833 |
||
6834 |
RETURN (__MKSTRING(__getBuildDateString() COMMA_SND) ); |
|
6835 |
%}. |
|
6836 |
^ 'today' |
|
6837 |
||
6838 |
" |
|
10071 | 6839 |
Smalltalk versionDate |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6840 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6841 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6842 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6843 |
versionString |
7758 | 6844 |
"{ Pragma: +optSpace }" |
6845 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6846 |
"return the version string" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6847 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6848 |
^ (self majorVersionNr printString , |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6849 |
'.', |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6850 |
self minorVersionNr printString , |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6851 |
'.', |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6852 |
self revisionNr printString) |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6853 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6854 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6855 |
Smalltalk versionString |
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 |
! |
7758 | 6858 |
|
6859 |
vmMajorVersionNr |
|
6860 |
"{ Pragma: +optSpace }" |
|
6861 |
||
6862 |
"return the VMs major version number." |
|
6863 |
%{ |
|
8913 | 6864 |
RETURN (__mkSmallInteger(4)); |
7758 | 6865 |
%}. |
6866 |
^ 4 |
|
6867 |
||
6868 |
" |
|
6869 |
Smalltalk vmMajorVersionNr |
|
6870 |
" |
|
2 | 6871 |
! ! |
453 | 6872 |
|
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
6873 |
!Smalltalk class methodsFor:'documentation'! |
630 | 6874 |
|
1568
2ed24cca3dac
oops -checked in corrupt version
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6875 |
version |
10072 | 6876 |
^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.766 2006-10-11 11:53:50 cg Exp $' |
630 | 6877 |
! ! |