author | Claus Gittinger <cg@exept.de> |
Sun, 14 Oct 2018 22:40:22 +0200 | |
changeset 23445 | 2f2ca1a7aaac |
parent 23433 | 247788b989f6 |
child 23446 | 994a3426acdb |
permissions | -rw-r--r-- |
23408 | 1 |
"{ Encoding: utf8 }" |
2 |
||
1 | 3 |
" |
5 | 4 |
COPYRIGHT (c) 1988 by Claus Gittinger |
18668 | 5 |
All Rights Reserved |
1 | 6 |
|
7 |
This software is furnished under a license and may be used |
|
8 |
only in accordance with the terms of that license and with the |
|
9 |
inclusion of the above copyright notice. This software may not |
|
10 |
be provided or otherwise made available to, or used by, any |
|
11 |
other person. No title to or ownership of the software is |
|
12 |
hereby transferred. |
|
13 |
" |
|
5363 | 14 |
"{ Package: 'stx:libbasic' }" |
15 |
||
17279 | 16 |
"{ NameSpace: Smalltalk }" |
17 |
||
1 | 18 |
Object subclass:#Smalltalk |
18668 | 19 |
instanceVariableNames:'' |
20 |
classVariableNames:'StartBlocks ImageStartBlocks ExitBlocks CachedClasses |
|
21 |
NumberOfClassesHint SystemPath StartupClass StartupSelector |
|
22 |
StartupArguments CommandLine CommandName CommandLineArguments |
|
23 |
CachedAbbreviations VerboseStartup VerboseLoading Verbose |
|
24 |
SilentLoading Initializing StandAlone HeadlessOperation IsPlugin |
|
20831 | 25 |
IsSharedLibraryComponent IsSTScript IsRepl DebuggingStandAlone |
21020 | 26 |
Silent Debugging LogDoits LoadBinaries RealSystemPath |
27 |
ResourcePath SourcePath BinaryPath FileInPath PackagePath |
|
28 |
BinaryDirName ResourceDirName SourceDirName BitmapDirName |
|
29 |
PackageDirName FileInDirName ChangeFileName ImageStartTime |
|
30 |
ImageRestartTime DemoMode SaveEmergencyImage SpecialObjectArray |
|
31 |
CallbackSignal ClassesFailedToInitialize HasNoConsole IgnoreHalt |
|
20615 | 32 |
PackageToPathMapping IgnoreAssertions LanguageModifier |
33 |
LanguageCodeset' |
|
18668 | 34 |
poolDictionaries:'' |
35 |
category:'System-Support' |
|
1 | 36 |
! |
37 |
||
20832 | 38 |
Smalltalk comment:'' |
8845
17288e4e99eb
remember, where autoload decl came from
Claus Gittinger <cg@exept.de>
parents:
8821
diff
changeset
|
39 |
! |
17288e4e99eb
remember, where autoload decl came from
Claus Gittinger <cg@exept.de>
parents:
8821
diff
changeset
|
40 |
|
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
41 |
!Smalltalk class methodsFor:'documentation'! |
70 | 42 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
43 |
copyright |
617 | 44 |
" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
45 |
COPYRIGHT (c) 1988 by Claus Gittinger |
18668 | 46 |
All Rights Reserved |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
47 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
48 |
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
|
49 |
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
|
50 |
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
|
51 |
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
|
52 |
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
|
53 |
hereby transferred. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
54 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
55 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
56 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
57 |
documentation |
70 | 58 |
" |
59 |
This is one of the central classes in the system; |
|
60 |
it provides all system-startup, shutdown and maintenance support. |
|
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
61 |
Also global variables are (conceptionally) kept here. |
70 | 62 |
|
63 |
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
|
64 |
- my implementation of globals is totally different |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
65 |
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
|
66 |
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
|
67 |
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
|
68 |
functions found there. |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
69 |
|
70 | 70 |
However, it provides the known enumeration protocol. |
3062
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
71 |
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
|
72 |
to inherit more collection stuff ... |
70 | 73 |
|
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
74 |
|
1286 | 75 |
[Instance variables:] |
18668 | 76 |
none - all handling is done in the VM |
1286 | 77 |
|
78 |
[Class variables:] |
|
79 |
||
18668 | 80 |
StartBlocks <Collection> blocks to be executed in a separate process after |
81 |
everything has been initialized. These blocks will |
|
82 |
be deleted after execution and therefore not be |
|
83 |
executed after an image restart. Initial processes |
|
84 |
(such as the Launcher) are usually started here. |
|
85 |
These blocks are added by smalltalk.rc/private.rc etc. |
|
86 |
via #addStartBlock during early initialization. |
|
87 |
||
88 |
ImageStartBlocks |
|
89 |
<Collection> blocks to be executed in a separate process after |
|
90 |
everything has been initialized. These blocks will be |
|
91 |
executed after an image restart. |
|
92 |
These blocks are usually added by smalltalk_r.rc etc. |
|
93 |
||
94 |
ExitBlocks <Collection> blocks to evaluate before system is |
|
95 |
left. Not currently used (GNU-ST compatibility). |
|
96 |
||
97 |
SystemPath <Collection> path to search for system files (sources, bitmaps etc) |
|
98 |
Set to a default here, but typically changed from some |
|
99 |
startup.rc file |
|
100 |
||
101 |
PackagePath <Collection> path to search for package. |
|
102 |
This is going to replace the above systemPath, and a classes |
|
103 |
resources will eventually searched in its package directory. |
|
104 |
This list defines the path, where packages are searched for, |
|
105 |
initially this is something like /opt/smalltalk/packages. |
|
106 |
Set to a default here, but typically changed from some |
|
107 |
startup.rc file |
|
108 |
||
109 |
StartupClass <Class> class and selector, where the system starts up |
|
110 |
StartupSelector <Symbol> (right after VM initialization) |
|
111 |
StartupArguments <Array> If an image is saved while those being nonNil, |
|
112 |
the image will come up there. |
|
113 |
Allows for customized images to be generated from a standard ST/X. |
|
114 |
StandAlone programs also set those during initialization. |
|
115 |
||
116 |
CommandLine <String> Unix (OS-) command line |
|
117 |
||
118 |
CommandName <String> the command (i.e. argv[0]) |
|
119 |
||
120 |
CommandLineArguments <Array> Unix (OS-) command line arguments broken into words |
|
121 |
CommandName has been stripped off. |
|
122 |
(initially set by the VM) |
|
123 |
||
124 |
SilentLoading <Boolean> OBSOLETE: |
|
125 |
suppresses messages during fileIn and in compiler |
|
126 |
(can be set to true from a customized main.c) |
|
127 |
||
128 |
VerboseLoading <Boolean> generate messages during fileIn and in compiler |
|
129 |
(can be set to true from a customized main.c) |
|
130 |
||
131 |
Initializing <Boolean> true while (re-)initializing |
|
132 |
Controls the behavior of certain error |
|
133 |
reporters (for example: suppress dialogBoxes) |
|
134 |
while the system is not yet fit for full operation. |
|
135 |
||
136 |
StandAlone <Boolean> true, if this is a standalone app; |
|
137 |
if true the process scheduler watches for |
|
138 |
which processes are still running, and |
|
139 |
exits ST/X, when the last non-background |
|
140 |
and non-system process exits. |
|
141 |
Can be set in an application-specific startup script, |
|
142 |
or, for standAlone programs, by C-code during initialization. |
|
143 |
||
144 |
HeadlessOperation if true, a non-existing Display connection |
|
145 |
<Boolean> will NOT lead to an error-exit during startup. |
|
146 |
Default is false. |
|
147 |
Can be set in an application-specific startup script, |
|
148 |
or, for standAlone programs, by C-code during initialization. |
|
149 |
||
150 |
LogDoits <Boolean> if true, doits are also logged in the changes |
|
151 |
file. Default is false, since the changes file |
|
152 |
may become huge if every tiny doIt is saved there ... |
|
153 |
||
154 |
LoadBinaries <Boolean> if true, we attempt to load classes rom a binary |
|
155 |
file, if present. If false, this is always suppressed. |
|
156 |
||
157 |
SaveEmergencyImage <Boolean> if true (the default), an emergency image |
|
158 |
is saved, if the main Display looses its |
|
159 |
connection. This is useful if you have a |
|
160 |
flaky display connection (serial line) |
|
161 |
and want to have your stuff saved automatically |
|
162 |
in case of a broken connection. |
|
163 |
||
164 |
IgnoreAssertions <Boolean> if true, assertions are ignored (i.e. no errors reported). |
|
165 |
Usually false in the development system, true in a standalone deployed app. |
|
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
166 |
|
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
167 |
strictly private classVariables (helpers): |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
168 |
|
18668 | 169 |
CachedClasses <Collection> known classes (cached for faster class enumeration) |
170 |
||
171 |
CachedAbbreviations |
|
172 |
<Dictionary> className to filename mappings |
|
173 |
||
174 |
RealSystemPath <Collection> cached collection of directories along the path |
|
175 |
which really exist. Caching avoids long checks |
|
176 |
for existing directories on broken NFS volumes. |
|
177 |
||
178 |
SourcePath <Collection> cached names of really existing directories |
|
179 |
These are remembered, as in NFS systems, |
|
180 |
ResourcePath the time to lookup files may become long |
|
181 |
BinaryPath (especially, if some directories are on machines |
|
182 |
FileInPath which are not up ...). |
|
183 |
Therefore, the set of really |
|
184 |
existing directories is cached when the SystemPath |
|
185 |
is walked the first time. |
|
186 |
A consequence is that you have to invoke |
|
187 |
flushSystemPath, when you create any of those |
|
188 |
directories while running |
|
189 |
(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
|
190 |
|
1286 | 191 |
|
192 |
[author:] |
|
18668 | 193 |
Claus Gittinger |
3062
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
194 |
|
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
195 |
[see also:] |
18668 | 196 |
ObjectMemory |
197 |
StandaloneStartup |
|
198 |
GetOpt |
|
199 |
ReadEvalPrintLoop |
|
70 | 200 |
" |
8945 | 201 |
! |
202 |
||
203 |
readme_resources |
|
204 |
" |
|
205 |
What is a resource file: |
|
18668 | 206 |
resource files contain language transformation and sometimes |
207 |
UI-look specifics such as icons etc. |
|
8945 | 208 |
|
209 |
Where are resources stored in the image: |
|
18668 | 210 |
Resource files are only read on demand (i.e. when needed) and only read once |
211 |
i.e. they are cached in the image). |
|
212 |
The cached data is held in a per-class class-instVar named 'ClassResources'. |
|
213 |
With only a few exceptions, the only classes which need resources are the GUI |
|
214 |
classes under the SimpleView hierarchy. |
|
8945 | 215 |
|
216 |
How does the system find resources: |
|
18668 | 217 |
The idea is that the system-provided resource files can be overwritten |
218 |
by the user or an application configuration. |
|
219 |
This works via a hierarchy of directories where resources are searched for, |
|
220 |
with the systems standard resource-files being at the end of that chain. |
|
221 |
||
222 |
When searching for a resource file for class X, the following files are searched |
|
223 |
in order: |
|
224 |
{ResourcePath} / resources / X.rs |
|
225 |
{SystemPath} / (CLASSES-PACKAGE-PATH) / X.rs |
|
226 |
{ResourcePath} / (CLASSES-PACKAGE-PATH) / X.rs |
|
8945 | 227 |
" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
228 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
229 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
230 |
!Smalltalk class methodsFor:'initialization'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
231 |
|
11057 | 232 |
basicInitializeSystem |
16180 | 233 |
"initialize all other classes. |
16655 | 234 |
This one is the very first entry into the smalltalk world |
235 |
[with error handling, via the initializeSystem], |
|
236 |
right after startup, usually immediately followed by Smalltalk>>start. |
|
237 |
||
11057 | 238 |
Notice: |
22791 | 239 |
this is NOT called when an image is restarted; in this |
240 |
case the show starts in Smalltalk>>restart." |
|
19992 | 241 |
|
242 |
OrderedCollection initialize. |
|
22791 | 243 |
|
20615 | 244 |
Smalltalk at:#Compiler put:ByteCodeCompiler. |
13771 | 245 |
Compiler isNil ifTrue:[ |
22791 | 246 |
" |
247 |
ByteCodeCompiler is not in the system (i.e. has not been linked in) |
|
248 |
this allows at least immediate evaluations for runtime systems without compiler |
|
249 |
NOTICE: a parser is always needed, otherwise we cannot read resource files etc. |
|
250 |
" |
|
251 |
Smalltalk at:#Compiler put:Parser |
|
16164 | 252 |
]. |
13771 | 253 |
|
11057 | 254 |
"/ |
255 |
"/ start catching SIGSEGV and SIGBUS |
|
256 |
"/ |
|
257 |
OperatingSystem enableHardSignalInterrupts. |
|
258 |
||
259 |
self initGlobalsFromEnvironment. |
|
260 |
||
261 |
"/ |
|
262 |
"/ sorry - there are some, which MUST be initialized before .. |
|
263 |
"/ reason: if any error happens during init, we need Signals, Stdout etc. to be there |
|
264 |
"/ |
|
15265 | 265 |
SmallInteger initialize. |
11057 | 266 |
Object initialize. |
18283 | 267 |
UninterpretedBytes initialize. |
21599 | 268 |
ProcessorScheduler initialize. "make sure Processor exists (RecursionLock needs it)" |
16691 | 269 |
OperatingSystem initialize. |
11057 | 270 |
Stream initialize. |
271 |
PositionableStream initialize. |
|
272 |
Filename initialize. |
|
273 |
ObjectMemory initialize. |
|
274 |
ExternalStream initialize. |
|
275 |
||
276 |
self initStandardStreams. "/ setup Stdin, Stdout etc. |
|
277 |
||
278 |
"/ |
|
279 |
"/ sorry, path must be set before ... |
|
280 |
"/ reason: some classes need it during initialize (they might need resources, bitmaps etc) |
|
281 |
"/ |
|
17534 | 282 |
"/ but, on OSX we need the CharacterEncoder to be initialized |
283 |
CharacterEncoder initialize. |
|
11057 | 284 |
self initSystemPath. |
285 |
||
286 |
"/ |
|
14427 | 287 |
"/ in case, someone needs the objectFileLoader early |
288 |
"/ |
|
16675 | 289 |
ObjectFileLoader notNil ifTrue:[ |
22791 | 290 |
ObjectFileLoader initialize. |
16675 | 291 |
]. |
14427 | 292 |
|
293 |
"/ |
|
11057 | 294 |
"/ now, finally, initialize all other classes |
295 |
"/ |
|
296 |
self initializeModules. |
|
297 |
||
298 |
ImageStartTime := Timestamp now. |
|
299 |
||
300 |
self initInterrupts. |
|
301 |
self initUserPreferences. |
|
302 |
||
16668
b88318df967d
flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents:
16666
diff
changeset
|
303 |
"/ just to make sure: if any prefs affect any resources, |
b88318df967d
flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents:
16666
diff
changeset
|
304 |
"/ flush them here, so they are reread in any case. |
b88318df967d
flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents:
16666
diff
changeset
|
305 |
"/ required for some apps, for example to show the menu correctly (see launcher's help menu) |
16675 | 306 |
ApplicationModel notNil ifTrue:[ |
22791 | 307 |
ApplicationModel flushAllClassResources. |
16675 | 308 |
]. |
16668
b88318df967d
flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents:
16666
diff
changeset
|
309 |
|
11057 | 310 |
"/ |
311 |
"/ give classes a chance to perform 2nd-level initialization |
|
312 |
"/ now, we are certain, that all other classes have been initialized |
|
313 |
"/ (especially: streams and signals can now be used) |
|
314 |
"/ |
|
315 |
ObjectMemory changed:#initialized. |
|
316 |
||
317 |
"Modified: / 05-12-2006 / 21:48:58 / cg" |
|
14427 | 318 |
"Modified: / 24-10-2012 / 18:45:15 / sr" |
21599 | 319 |
"Modified: / 27-02-2017 / 20:39:14 / stefan" |
11057 | 320 |
! |
321 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
322 |
initGlobalsFromEnvironment |
617 | 323 |
"setup globals from the shell-environment" |
324 |
||
325 |
|envString i langString terrString| |
|
326 |
||
5406 | 327 |
StandAlone isNil ifTrue:[ |
22791 | 328 |
StandAlone := false. |
5406 | 329 |
]. |
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
330 |
HeadlessOperation isNil ifTrue:[ |
22791 | 331 |
HeadlessOperation := false. |
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
332 |
]. |
5406 | 333 |
|
617 | 334 |
" |
335 |
extract Language and LanguageTerritory from LANG variable. |
|
5846 | 336 |
valid are for example: |
22791 | 337 |
en_en / en |
338 |
en_us |
|
339 |
en_gb |
|
340 |
de_de / de |
|
341 |
de_at (for Austria) |
|
5846 | 342 |
" |
343 |
||
344 |
Language := #en. |
|
994
6163ae7aaf9b
territory defaults to #us (instead of #usa)
Claus Gittinger <cg@exept.de>
parents:
977
diff
changeset
|
345 |
LanguageTerritory := #us. |
617 | 346 |
|
5846 | 347 |
|
348 |
"Format of LANG is: language[_territory][.codeset][@modifier] |
|
22791 | 349 |
language ISO-639 Language code |
350 |
territory ISO-3166 Contry code" |
|
7779
6d88d32bdd64
Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents:
7763
diff
changeset
|
351 |
|
6d88d32bdd64
Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents:
7763
diff
changeset
|
352 |
envString := OperatingSystem getLanguage. |
21928 | 353 |
envString notEmptyOrNil ifTrue:[ |
22791 | 354 |
i := envString indexOf:$@. |
355 |
(i ~~ 0) ifTrue:[ |
|
356 |
LanguageModifier := (envString copyFrom:(i + 1)) asLowercase asSymbol. |
|
357 |
envString := envString copyTo:(i - 1). |
|
358 |
] ifFalse:[ |
|
359 |
LanguageModifier := nil. |
|
360 |
]. |
|
361 |
i := envString indexOf:$.. |
|
362 |
(i ~~ 0) ifTrue:[ |
|
363 |
LanguageCodeset := (envString copyFrom:(i + 1)) asLowercase asSymbol. |
|
364 |
envString := envString copyTo:(i - 1). |
|
365 |
] ifFalse:[ |
|
366 |
LanguageCodeset := #'iso8859-1'. |
|
367 |
]. |
|
368 |
i := envString indexOf:$_. |
|
369 |
(i == 0) ifTrue:[ |
|
370 |
langString := envString. |
|
371 |
terrString := envString |
|
372 |
] ifFalse:[ |
|
373 |
langString := envString copyTo:(i - 1). |
|
374 |
terrString := envString copyFrom:(i + 1) |
|
375 |
]. |
|
376 |
langString := langString asLowercase. |
|
377 |
terrString := terrString asLowercase. |
|
378 |
(langString = 'c' or:[terrString = 'c']) ifTrue:[ |
|
379 |
('Smalltalk [info]: ignoring wrong LANG setting (',langString,'_',terrString,') - using english') infoPrintCR. |
|
380 |
] ifFalse:[ |
|
381 |
Language := langString asSymbol. |
|
382 |
LanguageTerritory := terrString asSymbol |
|
383 |
] |
|
617 | 384 |
]. |
385 |
||
386 |
" |
|
387 |
Smalltalk initGlobalsFromEnvironment |
|
388 |
" |
|
994
6163ae7aaf9b
territory defaults to #us (instead of #usa)
Claus Gittinger <cg@exept.de>
parents:
977
diff
changeset
|
389 |
|
14011
d33d2c6497f4
changed: #initGlobalsFromEnvironment
Claus Gittinger <cg@exept.de>
parents:
13998
diff
changeset
|
390 |
"Modified: / 14-02-2012 / 15:25:08 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
391 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
392 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
393 |
initInterrupts |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
394 |
"initialize interrupts" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
395 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
396 |
OperatingSystem enableUserInterrupts. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
397 |
OperatingSystem enableHardSignalInterrupts. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
398 |
OperatingSystem enableCrashSignalInterrupts. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
399 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
400 |
ObjectMemory userInterruptHandler:self. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
401 |
ObjectMemory signalInterruptHandler:self. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
402 |
ObjectMemory recursionInterruptHandler:self. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
403 |
|
14805 | 404 |
OperatingSystem isOSXlike ifTrue:[ |
18668 | 405 |
"/ OSX sends SIGABRT for NSExceptions |
406 |
OperatingSystem operatingSystemSignal:(OperatingSystem sigABRT) install:NSException. |
|
407 |
OperatingSystem enableAbortInterrupts. |
|
14805 | 408 |
]. |
409 |
||
8583
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 |
Smalltalk initInterrupts |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
412 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
413 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
414 |
"Modified: 20.8.1997 / 09:35:49 / stefan" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
415 |
! |
617 | 416 |
|
417 |
initStandardStreams |
|
418 |
"initialize some well-known streams" |
|
419 |
||
420 |
Stdout := NonPositionableExternalStream forStdout. |
|
421 |
Stderr := NonPositionableExternalStream forStderr. |
|
422 |
Stdin := NonPositionableExternalStream forStdin. |
|
10145
cca90547778e
allow for different OS's to initialize the Printer differently
Claus Gittinger <cg@exept.de>
parents:
10143
diff
changeset
|
423 |
PrinterStream notNil ifTrue:[ |
18668 | 424 |
Printer := PrinterStream defaultPrinter. |
10145
cca90547778e
allow for different OS's to initialize the Printer differently
Claus Gittinger <cg@exept.de>
parents:
10143
diff
changeset
|
425 |
]. |
617 | 426 |
Transcript := Stderr |
427 |
||
963
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
428 |
" |
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
429 |
Smalltalk initStandardStreams |
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
430 |
" |
10145
cca90547778e
allow for different OS's to initialize the Printer differently
Claus Gittinger <cg@exept.de>
parents:
10143
diff
changeset
|
431 |
|
cca90547778e
allow for different OS's to initialize the Printer differently
Claus Gittinger <cg@exept.de>
parents:
10143
diff
changeset
|
432 |
"Modified: / 25-10-2006 / 17:36:46 / cg" |
617 | 433 |
! |
434 |
||
435 |
initStandardTools |
|
10646 | 436 |
"predefine some tools which we might need later |
617 | 437 |
- if the view-classes exist, |
438 |
they will redefine Inspector and Debugger for graphical interfaces" |
|
439 |
||
440 |
Display notNil ifTrue:[ |
|
18668 | 441 |
InspectorView notNil ifTrue:[ |
442 |
Inspector := InspectorView |
|
443 |
]. |
|
444 |
DebugView notNil ifTrue:[ |
|
445 |
Debugger := DebugView |
|
446 |
]. |
|
447 |
"/ Display initialize |
|
13303
1aa90c41dd35
changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents:
13212
diff
changeset
|
448 |
]. |
1aa90c41dd35
changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents:
13212
diff
changeset
|
449 |
|
1aa90c41dd35
changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents:
13212
diff
changeset
|
450 |
"/ make the changeFilePath an absolute one, |
1aa90c41dd35
changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents:
13212
diff
changeset
|
451 |
"/ in case some stupid windows fileDialog changes the current directory... |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
452 |
ObjectMemory |
18668 | 453 |
nameForChanges:(Filename currentDirectory / ObjectMemory nameForChangesLocal) |
454 |
asAbsoluteFilename pathName |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
455 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
456 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
457 |
Smalltalk initStandardTools |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
458 |
" |
13303
1aa90c41dd35
changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents:
13212
diff
changeset
|
459 |
|
1aa90c41dd35
changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents:
13212
diff
changeset
|
460 |
"Modified: / 09-02-2011 / 20:44:47 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
461 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
462 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
463 |
initSystemPath |
617 | 464 |
"setup path where system files are searched for. |
465 |
the default path is set to: |
|
23433 | 466 |
. |
467 |
<directory of exe> (WIN32 only) |
|
468 |
$HOME (if defined) |
|
469 |
$HOME/.smalltalk (if defined & existing) |
|
470 |
$SMALLTALK_LIBDIR (if defined & existing) |
|
471 |
$STX_LIBDIR (if defined & existing) |
|
472 |
$STX_TOPDIR (if defined & existing) |
|
473 |
REGISTRY('HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X\<CurrentVersion>\LibDir') (WIN32 only) |
|
474 |
REGISTRY('HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X\LibDir') (WIN32 only) |
|
475 |
<standard places> |
|
9021 | 476 |
|
477 |
standard places (unix): |
|
23433 | 478 |
/opt/smalltalk/<release> (if existing) |
479 |
/opt/smalltalk (if existing) |
|
480 |
/usr/local/lib/smalltalk (if existing) |
|
481 |
/usr/lib/smalltalk (if existing) |
|
482 |
/lib/smalltalk (if existing) |
|
4001
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
483 |
|
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
484 |
win32: |
23433 | 485 |
\programs\exept\smalltalk (if existing) |
486 |
\programs\smalltalk (if existing) |
|
487 |
\smalltalk (if existing) |
|
4001
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
488 |
|
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
489 |
vms: |
23433 | 490 |
$stx:lib (if existing) |
491 |
$stx:root (if existing) |
|
617 | 492 |
|
493 |
of course, it is possible to add entries from the 'smalltalk.rc' |
|
494 |
startup file; add expressions such as: |
|
23433 | 495 |
Smalltalk systemPath addFirst:'/foo/bar/baz'. |
496 |
or: |
|
497 |
Smalltalk systemPath addLast:'/fee/foe/foo'. |
|
4001
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
498 |
|
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
499 |
However, smalltalk.rc itself must be found along the above path. |
617 | 500 |
" |
501 |
||
2928 | 502 |
ChangeFileName := 'changes'. |
503 |
OperatingSystem isVMSlike ifTrue:[ |
|
23433 | 504 |
BitmapDirName := 'bitmaps.dir'. |
505 |
BinaryDirName := 'binary.dir'. |
|
506 |
SourceDirName := 'source.dir'. |
|
507 |
ResourceDirName := 'resources.dir'. |
|
508 |
FileInDirName := 'filein.dir'. |
|
509 |
PackageDirName := 'packages.dir'. |
|
2928 | 510 |
] ifFalse:[ |
23433 | 511 |
BitmapDirName := 'bitmaps'. |
512 |
BinaryDirName := 'binary'. |
|
513 |
SourceDirName := 'source'. |
|
514 |
ResourceDirName := 'resources'. |
|
515 |
ResourceDirName := '.resources'. |
|
516 |
FileInDirName := 'fileIn'. |
|
517 |
PackageDirName := 'packages'. |
|
16234 | 518 |
]. |
519 |
||
520 |
SystemPath isEmptyOrNil ifTrue:[ |
|
23433 | 521 |
SystemPath := OperatingSystem defaultSystemPath. |
522 |
self flushPathCaches |
|
16234 | 523 |
]. |
524 |
||
525 |
PackagePath isEmptyOrNil ifTrue:[ |
|
23433 | 526 |
PackagePath := OperatingSystem defaultPackagePath. |
18868 | 527 |
]. |
528 |
self addWorkspaceDirectoryToPackagePath. |
|
20663 | 529 |
self addIdeTopDirectoryToPackagePath. |
617 | 530 |
|
531 |
" |
|
532 |
Smalltalk initSystemPath |
|
533 |
Smalltalk systemPath |
|
11679
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
534 |
|
20640 | 535 |
SystemPath := nil. |
536 |
PackagePath := nil. |
|
11679
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
537 |
OperatingSystem defaultSystemPath |
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
538 |
OperatingSystem defaultPackagePath |
617 | 539 |
" |
5139 | 540 |
|
5145 | 541 |
"Modified: / 24.12.1999 / 00:23:35 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
542 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
543 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
544 |
initUserPreferences |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
545 |
"setup other stuff" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
546 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
547 |
LogDoits := false. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
548 |
LoadBinaries := false. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
549 |
SaveEmergencyImage := (StandAlone ~~ true). |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
550 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
551 |
"Modified: / 24.10.1997 / 18:22:47 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
552 |
! |
617 | 553 |
|
7526 | 554 |
initializeClass:aClass |
555 |
"sent from VM via #initializeModules" |
|
556 |
||
7527 | 557 |
Error handle:[:ex | |
22791 | 558 |
ObjectMemory printStackBacktrace. |
559 |
ClassesFailedToInitialize isNil ifTrue:[ |
|
560 |
ClassesFailedToInitialize := IdentitySet new. |
|
561 |
]. |
|
562 |
ClassesFailedToInitialize add:aClass. |
|
563 |
('Smalltalk [warning]: error during initialize of ' , aClass name,': ', ex description printString) errorPrintCR. |
|
564 |
ex suspendedContext fullPrintAll. |
|
565 |
'------------------------------------------------' errorPrintCR. |
|
566 |
(Debugging == true) ifTrue:[ |
|
567 |
ex reject |
|
568 |
]. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
569 |
] do:[ |
22791 | 570 |
aClass initialize |
13675 | 571 |
]. |
572 |
||
573 |
"Modified: / 11-09-2011 / 17:01:32 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
574 |
! |
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 |
initializeModules |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
577 |
"perform module specific initialization and |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
578 |
send #initialize to all classes. |
16180 | 579 |
Notice: this is NOT called when an image is restarted" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
580 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
581 |
self initializeModulesOnce. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
582 |
ClassesFailedToInitialize size > 0 ifTrue:[ |
18668 | 583 |
('Smalltalk [info]: retry initialization of failed class(es)...') infoPrintCR. |
584 |
ClassesFailedToInitialize := nil. |
|
585 |
self initializeModulesOnce. |
|
586 |
ClassesFailedToInitialize size > 0 ifTrue:[ |
|
587 |
('Smalltalk [error]: class(es) persist to fail during initialize') errorPrintCR. |
|
588 |
] |
|
10122 | 589 |
]. |
590 |
||
591 |
ProjectDefinition initializeAllProjectDefinitions. |
|
592 |
||
593 |
"Modified: / 23-10-2006 / 16:40:39 / cg" |
|
7527 | 594 |
! |
595 |
||
7563 | 596 |
initializeModulesOnce |
597 |
"perform module specific initialization and |
|
598 |
send #initialize to all classes. |
|
7527 | 599 |
Notice: this is not called when an image is restarted" |
4963 | 600 |
|
617 | 601 |
%{ |
18349 | 602 |
#ifdef __SCHTEAM__ |
603 |
STClass.initializeAllClasses(__c__); |
|
604 |
return __c__._RETURN_self(); |
|
605 |
#else |
|
1688
8a42db1eea60
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1682
diff
changeset
|
606 |
__init_registered_modules__(3); |
4963 | 607 |
|
1481 | 608 |
@global(DemoMode) = __getDemoMode() ? true : false; |
5410 | 609 |
RETURN (self); |
18349 | 610 |
#endif /* not SCHTEAM */ |
5410 | 611 |
%}. |
612 |
^ self primitiveFailed |
|
617 | 613 |
! |
614 |
||
7563 | 615 |
initializeSystem |
16655 | 616 |
"initialize all classes; setup dispatcher processes etc. |
3499 | 617 |
This one is the very first entry into the smalltalk world, |
16655 | 618 |
right after startup, usually immediately followed by Smalltalk>>start. |
619 |
Here, a few specific initializations are done, then the actual initialization is |
|
620 |
done inside an error handler in basicInitializeSystem. |
|
10071 | 621 |
Notice: |
22791 | 622 |
this is called by the VM's main entry. You will not find senders from Smalltalk. |
18385 | 623 |
Also Notice: |
22791 | 624 |
this is NOT called when an image is restarted; |
625 |
in this case the show starts in Smalltalk>>restart." |
|
211 | 626 |
|
19510 | 627 |
|idx shellArgs| |
6841
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
628 |
|
12861 | 629 |
NumberOfClassesHint := 10000. |
8964
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
630 |
|
3499 | 631 |
Initializing := true. |
632 |
AbstractOperatingSystem initializeConcreteClass. |
|
633 |
||
18307
c1d97d109f88
also care for empty cmd-line args (could be empty OrderedCollection)
Claus Gittinger <cg@exept.de>
parents:
18293
diff
changeset
|
634 |
CommandLineArguments isEmptyOrNil ifTrue:[ |
22791 | 635 |
CommandLineArguments := #('stx') asOrderedCollection. |
5400 | 636 |
]. |
4006
c7ad38c52eb9
must set CommandLineArguments earlier (to be available in initializeSystem)
Claus Gittinger <cg@exept.de>
parents:
4001
diff
changeset
|
637 |
CommandLine := CommandLineArguments copy. |
c7ad38c52eb9
must set CommandLineArguments earlier (to be available in initializeSystem)
Claus Gittinger <cg@exept.de>
parents:
4001
diff
changeset
|
638 |
CommandLineArguments := CommandLineArguments asOrderedCollection. |
6842 | 639 |
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
|
640 |
|
21021 | 641 |
SilentLoading := Silent := false. |
642 |
VerboseLoading := VerboseStartup := Verbose := false. |
|
19427 | 643 |
DebuggingStandAlone := Debugging := false. |
19510 | 644 |
|
645 |
"/ if no argument was given, look for an environment variable named |
|
646 |
"/ STX_DEFAULT_ARGS. If set, take that. |
|
647 |
"/ if any argument was given, unless a --noShellArgs argument is given, |
|
648 |
"/ slice in the value from "STX_MORE_ARGS" at the beginning. |
|
649 |
"/ |
|
650 |
"/ These allow for args like "--quick --infoPrint" to be automatically prepended |
|
19511 | 651 |
idx := CommandLineArguments indexOfAny:#('--noShellArgs' '--noshellargs'). |
19510 | 652 |
(idx ~~ 0) ifTrue:[ |
22791 | 653 |
CommandLineArguments removeIndex:idx. |
654 |
] ifFalse:[ |
|
655 |
CommandLineArguments isEmpty ifTrue:[ |
|
656 |
shellArgs := OperatingSystem getEnvironment:'STX_DEFAULT_ARGS'. |
|
657 |
shellArgs notEmptyOrNil ifTrue:[ |
|
658 |
shellArgs := shellArgs asCollectionOfWords. |
|
659 |
CommandLineArguments addAll:shellArgs. |
|
660 |
]. |
|
661 |
] ifFalse:[ |
|
662 |
"/ prepend shell environment args from "STX_ARGS" |
|
663 |
shellArgs := OperatingSystem getEnvironment:'STX_MORE_ARGS'. |
|
664 |
shellArgs notEmptyOrNil ifTrue:[ |
|
665 |
shellArgs := shellArgs asCollectionOfWords. |
|
666 |
CommandLineArguments addAllFirst:shellArgs. |
|
667 |
]. |
|
668 |
]. |
|
669 |
]. |
|
670 |
||
671 |
self initializeVerboseFlags. |
|
14432 | 672 |
|
11057 | 673 |
Error handle:[:ex | |
22791 | 674 |
StandAlone ifTrue:[ |
675 |
DebuggingStandAlone ifFalse:[ |
|
676 |
'Startup Error - use "--debug" command line argument for more info' errorPrintCR. |
|
677 |
Smalltalk exit:1. |
|
678 |
]. |
|
679 |
'Smalltalk [error]: Error during early initialization:' errorPrintCR. |
|
680 |
thisContext fullPrintAll. |
|
681 |
]. |
|
682 |
ex reject. |
|
11057 | 683 |
] do:[ |
22791 | 684 |
self basicInitializeSystem |
14432 | 685 |
]. |
13091
bc840cd6f1ae
--verboseLoading command line arg (shlib loading trace)
Claus Gittinger <cg@exept.de>
parents:
13061
diff
changeset
|
686 |
|
bc840cd6f1ae
--verboseLoading command line arg (shlib loading trace)
Claus Gittinger <cg@exept.de>
parents:
13061
diff
changeset
|
687 |
"Modified: / 12-10-2010 / 11:27:47 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
688 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
689 |
|
18669 | 690 |
initializeVerboseFlags |
691 |
|idx| |
|
692 |
||
21021 | 693 |
StandAlone ifTrue:[ |
22791 | 694 |
InfoPrinting := false. |
695 |
ObjectMemory infoPrinting:false. |
|
696 |
IgnoreAssertions := true. |
|
21021 | 697 |
] ifFalse:[ |
22791 | 698 |
IgnoreAssertions := false. |
699 |
]. |
|
700 |
||
19430 | 701 |
(idx := CommandLineArguments indexOf:'--ignoreHalt') ~~ 0 ifTrue:[ |
22791 | 702 |
IgnoreHalt := true. |
703 |
CommandLineArguments removeIndex:idx |
|
19430 | 704 |
]. |
20855 | 705 |
(idx := CommandLineArguments indexOf:'--noIgnoreHalt') ~~ 0 ifTrue:[ |
22791 | 706 |
IgnoreHalt := false. |
707 |
CommandLineArguments removeIndex:idx |
|
20855 | 708 |
]. |
709 |
(idx := CommandLineArguments indexOf:'--ignoreAssert') ~~ 0 ifTrue:[ |
|
22791 | 710 |
IgnoreAssertions := true. |
711 |
CommandLineArguments removeIndex:idx |
|
20855 | 712 |
]. |
713 |
(idx := CommandLineArguments indexOf:'--noIgnoreAssert') ~~ 0 ifTrue:[ |
|
22791 | 714 |
IgnoreAssertions := false. |
715 |
CommandLineArguments removeIndex:idx |
|
20855 | 716 |
]. |
22314 | 717 |
(idx := CommandLineArguments indexOf:'--assert') ~~ 0 ifTrue:[ |
22791 | 718 |
IgnoreAssertions := false. |
719 |
CommandLineArguments removeIndex:idx |
|
22314 | 720 |
]. |
18669 | 721 |
(idx := CommandLineArguments indexOf:'--silentStartup') ~~ 0 ifTrue:[ |
22791 | 722 |
SilentLoading := true. |
723 |
CommandLineArguments removeIndex:idx |
|
18669 | 724 |
]. |
725 |
(idx := CommandLineArguments indexOf:'--verboseLoading') ~~ 0 ifTrue:[ |
|
22791 | 726 |
VerboseLoading := true. |
727 |
CommandLineArguments removeIndex:idx |
|
18669 | 728 |
]. |
729 |
(idx := CommandLineArguments indexOf:'--verboseStartup') ~~ 0 ifTrue:[ |
|
22791 | 730 |
VerboseLoading := true. |
731 |
VerboseStartup := true. |
|
732 |
CommandLineArguments removeIndex:idx |
|
18669 | 733 |
]. |
20855 | 734 |
|
735 |
"/ reinterpret those, in case given after the VM options. |
|
736 |
(idx := CommandLineArguments indexOf:'--debugPrint') ~~ 0 ifTrue:[ |
|
22791 | 737 |
ObjectMemory debugPrinting:true. |
738 |
CommandLineArguments removeIndex:idx |
|
20855 | 739 |
]. |
740 |
(idx := CommandLineArguments indexOf:'--infoPrint') ~~ 0 ifTrue:[ |
|
22791 | 741 |
ObjectMemory infoPrinting:true. |
742 |
CommandLineArguments removeIndex:idx |
|
20855 | 743 |
]. |
744 |
||
18669 | 745 |
(idx := CommandLineArguments indexOf:'--verbose') ~~ 0 ifTrue:[ |
22791 | 746 |
Object infoPrinting:true. |
747 |
Verbose := true. |
|
748 |
VerboseLoading := true. |
|
749 |
VerboseStartup := true. |
|
750 |
Logger notNil ifTrue:[ |
|
751 |
Logger loggingThreshold: Logger severityALL. |
|
752 |
]. |
|
753 |
CommandLineArguments removeIndex:idx. |
|
21020 | 754 |
]. |
755 |
||
756 |
Silent := false. |
|
757 |
(idx := CommandLineArguments indexOf:'--silent') ~~ 0 ifTrue:[ |
|
22791 | 758 |
CommandLineArguments removeIndex:idx. |
759 |
Silent := SilentLoading := true. |
|
760 |
Object infoPrinting:false. |
|
761 |
ObjectMemory infoPrinting:false. |
|
762 |
ObjectMemory debugPrinting:false. |
|
763 |
Verbose := VerboseLoading := VerboseStartup := false. |
|
764 |
Logger notNil ifTrue:[ |
|
765 |
Logger loggingThreshold: Logger severityNONE |
|
766 |
]. |
|
18669 | 767 |
]. |
21021 | 768 |
|
769 |
idx := CommandLineArguments indexOf:'--debug'. |
|
770 |
Debugging := (idx ~~ 0). |
|
771 |
||
772 |
StandAlone ifTrue:[ |
|
22791 | 773 |
DebuggingStandAlone := Debugging. |
774 |
DebuggingStandAlone ifTrue:[ |
|
775 |
Inspector := MiniInspector. |
|
776 |
Debugger := MiniDebugger. |
|
777 |
IgnoreAssertions := false. |
|
778 |
]. |
|
21021 | 779 |
] ifFalse:[ |
22791 | 780 |
"/ |
781 |
"/ define low-level debugging tools - graphical classes are not prepared yet |
|
782 |
"/ to handle things. |
|
783 |
"/ This will bring us into the MiniDebugger when an error occurs during startup. |
|
784 |
"/ |
|
785 |
Inspector := MiniInspector. |
|
786 |
Debugger := MiniDebugger. |
|
21021 | 787 |
]. |
22314 | 788 |
|
789 |
"Modified: / 12-10-2017 / 17:48:11 / cg" |
|
18669 | 790 |
! |
791 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
792 |
isInitialized |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
793 |
"this returns true, if the system is properly initialized; |
16170
ca4d03def070
endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents:
16164
diff
changeset
|
794 |
i.e. false during startup. |
15980 | 795 |
Especially, the whole display/viewing stuff and process escheduling |
796 |
is not working correctly until initialized." |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
797 |
|
18251
9b7f8e531a16
isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents:
18248
diff
changeset
|
798 |
Initializing isNil ifTrue:[^ false]. "/ if called very early |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
799 |
^ Initializing not |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
800 |
! |
1 | 801 |
|
7563 | 802 |
reinitStandardStreams |
803 |
"reinitialize some well-known streams. |
|
804 |
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
|
805 |
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
|
806 |
(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
|
807 |
|
8710aba7876b
oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents:
457
diff
changeset
|
808 |
Stdout reOpen. Stderr reOpen. Stdin reOpen. |
161 | 809 |
! ! |
810 |
||
16593 | 811 |
!Smalltalk class methodsFor:'Compatibility-GNU'! |
812 |
||
813 |
system:command |
|
814 |
"GNU-Smalltalk compatibility: execute an OS command" |
|
815 |
||
816 |
OperatingSystem executeCommand:command |
|
817 |
||
818 |
" |
|
819 |
Smalltalk system:'ls' |
|
820 |
" |
|
821 |
! ! |
|
822 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
823 |
!Smalltalk class methodsFor:'Compatibility-Squeak'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
824 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
825 |
beep |
17343 | 826 |
"output an audible beep or bell" |
827 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
828 |
Screen current beep |
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 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
831 |
garbageCollect |
15009 | 832 |
"for Squeak compatibility" |
833 |
||
834 |
ObjectMemory garbageCollect |
|
8583
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 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
837 |
garbageCollectMost |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
838 |
"collect recently created garbage; return the amount of freeSpace. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
839 |
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
|
840 |
newSpace + freeListSpace is returned." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
841 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
842 |
ObjectMemory scavenge. |
15009 | 843 |
^ ObjectMemory freeSpace + (ObjectMemory newSpaceSize - ObjectMemory newSpaceUsed) |
8583
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 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
846 |
isMorphic |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
847 |
^ false |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
848 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
849 |
|
10844 | 850 |
platformName |
851 |
"not yet fully implemented (I have to figure out, what squeak returns in each case...)" |
|
852 |
||
853 |
^ OperatingSystem platformName asUppercaseFirst |
|
854 |
||
855 |
" |
|
856 |
Smalltalk platformName -> 'Win32' |
|
857 |
" |
|
858 |
! |
|
859 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
860 |
registerExternalObject: anObject |
7563 | 861 |
"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
|
862 |
If it is already there, just return its index. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
863 |
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
|
864 |
primitive code (via the global Smalltalk:SpecialObjectArray)" |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
865 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
866 |
| objects firstEmptyIndex obj sz newObjects | |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
867 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
868 |
objects := SpecialObjectArray. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
869 |
objects isNil ifTrue:[ |
18668 | 870 |
objects := Array new:5. |
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
871 |
]. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
872 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
873 |
"find the first empty slot and look if already registered" |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
874 |
firstEmptyIndex := 0. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
875 |
1 to: objects size do: [:i | |
18668 | 876 |
obj := objects at: i. |
877 |
obj == anObject ifTrue: [^ i]. "object already there, just return its index" |
|
878 |
(obj == nil and: [firstEmptyIndex = 0]) ifTrue: [ |
|
879 |
firstEmptyIndex := i |
|
880 |
] |
|
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
881 |
]. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
882 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
883 |
"if no empty slots, expand the array" |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
884 |
firstEmptyIndex = 0 ifTrue: [ |
18668 | 885 |
sz := objects size. |
886 |
newObjects := objects species new: sz + 20. "grow linearly" |
|
887 |
newObjects replaceFrom: 1 to: sz with: objects startingAt: 1. |
|
888 |
firstEmptyIndex := sz + 1. |
|
889 |
SpecialObjectArray := newObjects. |
|
890 |
objects := newObjects |
|
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
891 |
]. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
892 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
893 |
objects at: firstEmptyIndex put: anObject. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
894 |
^ firstEmptyIndex |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
895 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
896 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
897 |
|
12358 | 898 |
removeClassNamed: aName |
17576 | 899 |
"Invoked from fileouts: if there is currently a class in the system named aName, then remove it. |
900 |
Also needed by the refactory browser. |
|
901 |
If anything untoward happens, report it in the Transcript." |
|
12358 | 902 |
|
903 |
| oldClass | |
|
904 |
||
905 |
(oldClass := self at: aName asSymbol ifAbsent: [nil]) isNil ifTrue:[ |
|
18668 | 906 |
Transcript showCR: 'Removal of class named ', aName, ' ignored because it does not exist.'. |
907 |
^ self |
|
12358 | 908 |
]. |
909 |
oldClass removeFromSystem |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
910 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
911 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
912 |
!Smalltalk class methodsFor:'Compatibility-V''Age'! |
6722
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
913 |
|
7563 | 914 |
allClassesImplementing:aSelector |
12304
b0dc1c58de1a
changed: #allClassesImplementing:
Claus Gittinger <cg@exept.de>
parents:
12301
diff
changeset
|
915 |
^ self allClassesForWhich:[:cls | cls includesSelector:aSelector]. |
9506 | 916 |
|
917 |
"Modified: / 10-08-2006 / 12:12:17 / cg" |
|
9090 | 918 |
! |
919 |
||
16459 | 920 |
declareConstant:constantName poolName:poolNameArg value:value |
921 |
"visualAge compatible pool variable declaration. |
|
16562 | 922 |
called when a V'age application is filed in |
16459 | 923 |
(or one of its changes is accepted via the change browser)" |
924 |
||
925 |
|ns poolName pool| |
|
926 |
||
927 |
"/ when coming from the change-browser, |
|
928 |
"/ a namespace override may be given... |
|
929 |
ns := Class nameSpaceQuerySignal query. |
|
930 |
(ns isNil or:[ns == Smalltalk]) ifTrue:[ |
|
18668 | 931 |
poolName := poolNameArg asSymbol |
16459 | 932 |
] ifFalse:[ |
18668 | 933 |
poolName := (ns name,'::',poolNameArg) asSymbol |
16459 | 934 |
]. |
9090 | 935 |
pool := self classNamed:poolName. |
936 |
pool declareConstant:constantName value:value |
|
937 |
! |
|
938 |
||
16459 | 939 |
declarePoolDictionary:poolDictionaryNameArg |
940 |
"visualAge compatible pool declaration. |
|
16562 | 941 |
called when a V'age application is filed in |
16459 | 942 |
(or one of its changes is accepted via the change browser)" |
943 |
||
944 |
|ns poolName| |
|
945 |
||
946 |
poolName := poolDictionaryNameArg asSymbol. |
|
947 |
||
948 |
"/ "/ when coming from the change-browser, |
|
949 |
"/ "/ a namespace override may be given... |
|
950 |
"/ ns := Class nameSpaceQuerySignal query. |
|
951 |
"/ (ns isNil or:[ns == Smalltalk]) ifTrue:[ |
|
952 |
"/ poolName := poolDictionaryNameArg asSymbol |
|
953 |
"/ ] ifFalse:[ |
|
954 |
"/ poolName := (ns name,'::',poolDictionaryNameArg) asSymbol |
|
955 |
"/ ]. |
|
956 |
^ SharedPool subclass:(poolName asSymbol) |
|
18668 | 957 |
instanceVariableNames:'' |
958 |
classVariableNames:'' |
|
959 |
poolDictionaries:'' |
|
960 |
category:'* VAST Pools' |
|
13998
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
961 |
|
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
962 |
"Modified: / 07-02-2012 / 15:56:16 / cg" |
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
963 |
! |
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
964 |
|
16459 | 965 |
declareVariable:varName poolName:poolNameArg |
966 |
"visualAge compatible pool declaration. |
|
16562 | 967 |
called when a V'age application is filed in |
16459 | 968 |
(or one of its changes is accepted via the change browser)" |
969 |
||
970 |
|ns poolName pool| |
|
971 |
||
972 |
"/ when coming from the change-browser, |
|
973 |
"/ a namespace override may be given... |
|
974 |
ns := Class nameSpaceQuerySignal query. |
|
975 |
(ns isNil or:[ns == Smalltalk]) ifTrue:[ |
|
18668 | 976 |
poolName := poolNameArg asSymbol |
16459 | 977 |
] ifFalse:[ |
18668 | 978 |
poolName := (ns name,'::',poolNameArg) asSymbol |
16459 | 979 |
]. |
13998
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
980 |
pool := self classNamed:poolName. |
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
981 |
pool declareVariable:varName |
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
982 |
|
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
983 |
"Created: / 07-02-2012 / 15:57:05 / cg" |
6722
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
984 |
! ! |
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
985 |
|
20755 | 986 |
!Smalltalk class methodsFor:'Compatibility-VW'! |
6094
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
987 |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
988 |
defineClass:nameSymbol superclass:superclass indexedType:indexed private:private instanceVariableNames:instVars classInstanceVariableNames:classInstVars imports:imports category:category |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
989 |
^ self |
18668 | 990 |
defineClass:nameSymbol |
991 |
superclass:superclass |
|
992 |
indexedType:indexed |
|
993 |
private:private |
|
994 |
instanceVariableNames:instVars |
|
995 |
classInstanceVariableNames:classInstVars |
|
996 |
imports:imports |
|
997 |
category:category |
|
998 |
attributes:nil |
|
12033 | 999 |
! |
1000 |
||
7563 | 1001 |
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
|
1002 |
|newClass| |
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
1003 |
|
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
1004 |
indexed == #none ifTrue:[ |
18668 | 1005 |
newClass := superclass |
1006 |
subclass:nameSymbol |
|
1007 |
instanceVariableNames:instVars |
|
1008 |
classVariableNames:'' |
|
1009 |
poolDictionaries:'' |
|
1010 |
category:category |
|
1011 |
inEnvironment:self. |
|
1012 |
classInstVars size > 0 ifTrue:[ |
|
1013 |
newClass class instanceVariableNames:classInstVars. |
|
1014 |
]. |
|
1015 |
^ newClass |
|
6851 | 1016 |
]. |
1017 |
self shouldImplement. |
|
12033 | 1018 |
! |
1019 |
||
1020 |
defineNameSpace:nameSymbol private:private imports:imports category:category |
|
1021 |
|newNameSpace| |
|
1022 |
||
1023 |
private ifTrue:[self halt]. "/ what to do ? |
|
1024 |
imports withoutSeparators notEmpty ifTrue:[self halt]. "/ what to do ? |
|
1025 |
newNameSpace := NameSpace name:nameSymbol. |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1026 |
newNameSpace setCategory:category. |
12033 | 1027 |
^ newNameSpace |
20755 | 1028 |
! |
1029 |
||
1030 |
dialectName |
|
1031 |
^ #SmalltalkX |
|
1032 |
||
1033 |
" |
|
1034 |
Smalltalk dialectName |
|
1035 |
" |
|
1036 |
! |
|
1037 |
||
1038 |
dialectReleaseVersion |
|
1039 |
^ self versionString |
|
1040 |
||
1041 |
" |
|
1042 |
Smalltalk dialectReleaseVersion |
|
1043 |
" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1044 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1045 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1046 |
!Smalltalk class methodsFor:'accessing'! |
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 |
associationAt:aKey |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1049 |
"return a key-value association for aKey. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1050 |
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
|
1051 |
simulated here." |
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 |
|val| |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1054 |
|
20161 | 1055 |
val := self at:aKey ifAbsent:[^ nil]. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1056 |
^ Association key:aKey value:val |
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 |
"Created: / 1.11.1997 / 13:27:20 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1059 |
! |
3083 | 1060 |
|
7563 | 1061 |
associationAt:aKey ifAbsent:exceptionBlock |
1062 |
"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
|
1063 |
from exceptionBlock, if no such key is present. |
14973 | 1064 |
Since ST/X's Smalltalk as no real dictionary, this is simulated here. |
20161 | 1065 |
Warning: this is a compatibility interface only, with a different semantic as |
22791 | 1066 |
the original ST80 implementation. The returned assoc is created on the fly, |
1067 |
and not the one stored in the receiver (there are not assocs there)" |
|
3610
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
1068 |
|
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
1069 |
|val| |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
1070 |
|
20161 | 1071 |
val := self at:aKey ifAbsent:[^ exceptionBlock value]. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1072 |
^ Association key:aKey value:val |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1073 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1074 |
"Created: / 18.6.1998 / 17:05:24 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1075 |
! |
3610
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
1076 |
|
7563 | 1077 |
at:aKey |
10071 | 1078 |
"retrieve the value stored under aKey, a symbol. |
1079 |
Return nil if not present |
|
1956 | 1080 |
(this will be changed to trigger an error - better use #at:ifAbsent:)" |
453 | 1081 |
|
16831 | 1082 |
aKey class == Symbol ifFalse:[self error:'expected symbol']. |
6080
15ea3cbf6003
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
6074
diff
changeset
|
1083 |
|
453 | 1084 |
%{ /* NOCONTEXT */ |
18287 | 1085 |
#ifdef __SCHTEAM__ |
1086 |
{ |
|
18668 | 1087 |
STSymbol keySymbol = aKey.asSTSymbol(); |
1088 |
STObject val = STSmalltalkEnvironment.GetResolvedBindingOrNull(keySymbol); |
|
1089 |
||
1090 |
return context._RETURN( val == null ? Nil : val ); |
|
18287 | 1091 |
} |
1092 |
/* NOT REACHED */ |
|
1093 |
#else |
|
453 | 1094 |
RETURN ( __GLOBAL_GET(aKey) ); |
18287 | 1095 |
#endif |
5406 | 1096 |
%}. |
5410 | 1097 |
^ self primitiveFailed |
453 | 1098 |
! |
1099 |
||
7563 | 1100 |
at:aKey ifAbsent:aBlock |
1101 |
"retrieve the value stored at aKey. |
|
7565 | 1102 |
If there is nothing stored under this key, return the value of |
1103 |
the evaluation of aBlock." |
|
453 | 1104 |
|
20161 | 1105 |
|val| |
1106 |
||
1107 |
val := self at:aKey. |
|
1108 |
(val notNil or:[self includesKey:aKey]) ifTrue:[ |
|
22791 | 1109 |
^ val |
453 | 1110 |
]. |
1111 |
^ aBlock value |
|
1112 |
||
1113 |
" |
|
20161 | 1114 |
Smalltalk removeKey:#fooBar. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1115 |
Smalltalk at:#fooBar <- returns nil |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1116 |
Smalltalk at:#fooBar ifAbsent:['sorry'] <- no error |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1117 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1118 |
! |
453 | 1119 |
|
15068 | 1120 |
at:aKey ifAbsentPut:aBlock |
1121 |
"return the element indexed by aKey if present, |
|
1122 |
if not present, store the result of evaluating valueBlock |
|
1123 |
under aKey and return it." |
|
1124 |
||
1125 |
^ self at:aKey ifAbsent:[ self at:aKey put:aBlock value ]. |
|
1126 |
||
1127 |
"Created: / 29-05-2007 / 12:41:12 / cg" |
|
1128 |
! |
|
1129 |
||
7563 | 1130 |
at:aKey ifPresent:aBlock |
1131 |
"try to retrieve the value stored at aKey. |
|
1132 |
If there is nothing stored under this key, do nothing. |
|
4870 | 1133 |
Otherwise, evaluate aBlock, passing the retrieved value as argument." |
1134 |
||
13883 | 1135 |
|val| |
1136 |
||
20161 | 1137 |
val := self at:aKey. |
1138 |
(val notNil or:[self includesKey:aKey]) ifTrue:[ |
|
22791 | 1139 |
^ aBlock value:val. |
4870 | 1140 |
]. |
1141 |
^ nil |
|
1142 |
||
1143 |
" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1144 |
Smalltalk at:#fooBar ifPresent:[:what | Transcript showCR:what]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1145 |
Smalltalk at:#Object ifPresent:[:what | Transcript showCR:what]. |
20161 | 1146 |
|
1147 |
Smalltalk at:#fooBar put:nil. |
|
1148 |
Smalltalk at:#fooBar ifPresent:[:what | Transcript showCR:what]. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1149 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1150 |
|
13883 | 1151 |
"Modified: / 27-12-2011 / 10:14:30 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1152 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1153 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1154 |
at:aKey put:aValue |
7563 | 1155 |
"store the argument aValue under aKey, a symbol. |
1156 |
Return aValue (sigh)." |
|
453 | 1157 |
|
1158 |
|oldValue| |
|
1159 |
||
1160 |
%{ |
|
18287 | 1161 |
#ifdef __SCHTEAM__ |
1162 |
{ |
|
18668 | 1163 |
STSymbol keySymbol = aKey.asSTSymbol(); |
1164 |
oldValue = STSmalltalkEnvironment.SetBinding(keySymbol, aValue); |
|
18287 | 1165 |
} |
1166 |
#else |
|
453 | 1167 |
oldValue = __GLOBAL_SET(aKey, aValue, (OBJ *)0); |
18287 | 1168 |
#endif |
453 | 1169 |
%}. |
1170 |
CachedClasses notNil ifTrue:[ |
|
18668 | 1171 |
oldValue isBehavior ifTrue:[ |
1172 |
oldValue name == aKey ifTrue:[ |
|
1173 |
CachedClasses remove:oldValue ifAbsent:[] |
|
1174 |
] |
|
1175 |
]. |
|
1176 |
aValue isBehavior ifTrue:[ |
|
1177 |
aValue name == aKey ifTrue:[ |
|
1178 |
CachedClasses add:aValue |
|
1179 |
] ifFalse:[ |
|
1180 |
CachedClasses := nil |
|
1181 |
] |
|
1182 |
]. |
|
453 | 1183 |
]. |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
1184 |
^ aValue. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1185 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1186 |
"Modified: 19.4.1996 / 11:31:49 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1187 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1188 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1189 |
includesKey:aKey |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1190 |
"return true, if the key is known" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1191 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1192 |
"/ for debugging - this is a common mistake, |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1193 |
"/ to try to access a class by nameString, instead |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1194 |
"/ of by symbol. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1195 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1196 |
"/ aKey class == String ifTrue:[self halt]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1197 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1198 |
%{ /* NOCONTEXT */ |
18287 | 1199 |
#ifdef __SCHTEAM__ |
1200 |
STSymbol keySymbol = aKey.asSTSymbol(); |
|
18668 | 1201 |
return __c__._RETURN( STSmalltalkEnvironment.HasBinding(keySymbol) ? STObject.True : STObject.False); |
18287 | 1202 |
/* NOT REACHED */ |
1203 |
#else |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1204 |
RETURN ( __GLOBAL_KEYKNOWN(aKey) ); |
18287 | 1205 |
#endif |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1206 |
%}. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1207 |
^ self primitiveFailed |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1208 |
! |
453 | 1209 |
|
7563 | 1210 |
keyAtValue:anObject |
21365 | 1211 |
"return the symbol under which anObject is stored - or nil. |
1212 |
This is a slow access, since the receiver is searched sequentially. |
|
1213 |
NOTICE: |
|
22791 | 1214 |
The value is searched using identity compare" |
453 | 1215 |
|
1216 |
self keysDo:[:aKey | |
|
22791 | 1217 |
(self at:aKey) == anObject ifTrue:[^ aKey] |
453 | 1218 |
]. |
1219 |
^ nil |
|
1220 |
||
1221 |
"Smalltalk keyAtValue:Object" |
|
21365 | 1222 |
|
1223 |
"Modified (comment): / 07-02-2017 / 11:06:21 / cg" |
|
453 | 1224 |
! |
1225 |
||
21363 | 1226 |
keyAtValue:anObject ifAbsent:exceptionValue |
21365 | 1227 |
"return the symbol under which anObject is stored - or the value from exceptionValue. |
1228 |
This is a slow access, since the receiver is searched sequentially. |
|
1229 |
NOTICE: |
|
22791 | 1230 |
The value is searched using identity compare" |
21363 | 1231 |
|
1232 |
self keysDo:[:aKey | |
|
22791 | 1233 |
(self at:aKey) == anObject ifTrue:[^ aKey] |
21363 | 1234 |
]. |
1235 |
^ exceptionValue value |
|
1236 |
||
1237 |
" |
|
1238 |
Smalltalk keyAtValue:Object ifAbsent:#foo |
|
1239 |
Smalltalk keyAtValue:1234 ifAbsent:#foo |
|
1240 |
" |
|
1241 |
||
1242 |
"Created: / 07-02-2017 / 10:58:51 / cg" |
|
1243 |
! |
|
1244 |
||
7563 | 1245 |
keys |
1246 |
"return a collection with all keys in the Smalltalk dictionary" |
|
1247 |
||
1248 |
|keys| |
|
453 | 1249 |
|
1250 |
keys := IdentitySet new. |
|
1251 |
self keysDo:[:k | keys add:k]. |
|
1252 |
^ keys |
|
617 | 1253 |
! |
1254 |
||
7563 | 1255 |
removeKey:aKey |
1256 |
"remove the association stored under the key-argument from the globals dictionary. |
|
10071 | 1257 |
WARNING: |
18668 | 1258 |
this is somewhat dangerous: conceptionally, the association is removed, |
1259 |
to which machine & byte compiled code refers if it accesses a global. |
|
1260 |
If there are still global accesses in some literalArray or from machine-compiled code, |
|
1261 |
it continues to reference the globals value via that obsolete association and gets a nil |
|
1262 |
value. (which is correct) |
|
1263 |
However, if that global is later reintroduced, a new association will be created and |
|
1264 |
the new global now referenced via the new association. |
|
1265 |
The old accesses will still see nil, although the globals value is actually non-nil |
|
1266 |
(this is questionable). |
|
1267 |
To avoid this problem, the #removeClass: method never removed the key." |
|
617 | 1268 |
|
1269 |
CachedClasses := nil. |
|
1270 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1271 |
%{ /* NOCONTEXT */ |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1272 |
RETURN ( __GLOBAL_REMOVE(aKey) ); |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1273 |
%}. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1274 |
^ self primitiveFailed |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1275 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1276 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1277 |
|
10538 | 1278 |
startBlocks |
1279 |
^ StartBlocks |
|
1280 |
! |
|
1281 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1282 |
values |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1283 |
"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
|
1284 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1285 |
|values| |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1286 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1287 |
values := OrderedCollection new. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1288 |
self do:[:v | values add:v]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1289 |
^ values |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1290 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1291 |
"Created: 20.6.1997 / 16:58:28 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1292 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1293 |
|
13540 | 1294 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1295 |
!Smalltalk class methodsFor:'browsing'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1296 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1297 |
browseAllCallsOn:aSelectorSymbol |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1298 |
"{ Pragma: +optSpace }" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1299 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1300 |
"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
|
1301 |
|
22241 | 1302 |
SystemBrowser default browseAllCallsOn:aSelectorSymbol |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1303 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1304 |
" |
10071 | 1305 |
Smalltalk browseAllCallsOn:#at:put: |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1306 |
" |
22241 | 1307 |
|
1308 |
"Modified: / 01-09-2017 / 14:21:31 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1309 |
! |
617 | 1310 |
|
7563 | 1311 |
browseAllSelect:aBlock |
1312 |
"{ Pragma: +optSpace }" |
|
1313 |
||
1314 |
"startup a browser for all methods for which aBlock returns true" |
|
617 | 1315 |
|
22241 | 1316 |
SystemBrowser default browseAllSelect:aBlock |
617 | 1317 |
|
1318 |
" |
|
1319 |
Smalltalk browseAllSelect:[:m | m literals isNil] |
|
1320 |
" |
|
22241 | 1321 |
|
1322 |
"Modified: / 01-09-2017 / 14:21:34 / cg" |
|
617 | 1323 |
! |
1324 |
||
7563 | 1325 |
browseChanges |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1326 |
"{ Pragma: +optSpace }" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1327 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1328 |
"startup a changes browser" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1329 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1330 |
ChangesBrowser notNil ifTrue:[ |
18668 | 1331 |
ChangesBrowser open |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1332 |
] ifFalse:[ |
18668 | 1333 |
self warn:'no ChangesBrowser built in' |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1334 |
] |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1335 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1336 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1337 |
Smalltalk browseChanges |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1338 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1339 |
! |
453 | 1340 |
|
7563 | 1341 |
browseClass:aClass |
1342 |
"{ Pragma: +optSpace }" |
|
1343 |
||
11375 | 1344 |
"startup a browser on aClass. |
11150 | 1345 |
The broser will only show that class (i.e. be a singleClass-browser). |
1346 |
See browseInClass: for a full browser, which has aClass selected initially." |
|
6970 | 1347 |
|
22241 | 1348 |
SystemBrowser default browseClass:aClass |
6970 | 1349 |
|
1350 |
" |
|
10071 | 1351 |
Smalltalk browseClass:Array |
6970 | 1352 |
" |
22241 | 1353 |
|
1354 |
"Modified: / 01-09-2017 / 14:21:37 / cg" |
|
6970 | 1355 |
! |
1356 |
||
7563 | 1357 |
browseImplementorsMatching:aSelectorSymbolOrMatchPattern |
1358 |
"{ Pragma: +optSpace }" |
|
6819 | 1359 |
|
1360 |
"startup a browser for all methods implementing a message matching" |
|
1361 |
||
22241 | 1362 |
SystemBrowser default browseImplementorsMatching:aSelectorSymbolOrMatchPattern |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1363 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1364 |
" |
10071 | 1365 |
Smalltalk browseImplementorsOf:#'at:put:' |
1366 |
Smalltalk browseImplementorsMatching:#'at:*' |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1367 |
" |
22241 | 1368 |
|
1369 |
"Modified: / 01-09-2017 / 14:21:39 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1370 |
! |
6819 | 1371 |
|
7563 | 1372 |
browseImplementorsOf:aSelectorSymbol |
1373 |
"{ Pragma: +optSpace }" |
|
1374 |
||
1375 |
"startup a browser for all methods implementing a particular message" |
|
453 | 1376 |
|
22241 | 1377 |
SystemBrowser default browseImplementorsOf:aSelectorSymbol |
453 | 1378 |
|
1379 |
" |
|
10071 | 1380 |
Smalltalk browseImplementorsOf:#at:put: |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1381 |
" |
22241 | 1382 |
|
1383 |
"Modified: / 01-09-2017 / 14:21:42 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1384 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1385 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1386 |
browseInClass:aClass |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1387 |
"{ Pragma: +optSpace }" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1388 |
|
11150 | 1389 |
"startup a full browser showing aClass. |
20207 | 1390 |
The browser will be a full browser with aClass initially selected. |
11150 | 1391 |
See browseClass: for a singleClass browser, which shows only a single class." |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1392 |
|
22241 | 1393 |
SystemBrowser default openInClass:aClass |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1394 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1395 |
" |
10071 | 1396 |
Smalltalk browseInClass:Array |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1397 |
" |
22241 | 1398 |
|
1399 |
"Modified: / 01-09-2017 / 14:21:46 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1400 |
! |
6970 | 1401 |
|
7563 | 1402 |
browseInClass:aClass selector:selector |
1403 |
"{ Pragma: +optSpace }" |
|
1404 |
||
11150 | 1405 |
"startup a full browser showing aClass>>selector. |
20207 | 1406 |
The browser will be a full browser with aClass initially selected. |
11150 | 1407 |
See browseClass: for a singleClass browser, which shows only a single class." |
6970 | 1408 |
|
22241 | 1409 |
SystemBrowser default openInClass:aClass selector:selector |
6970 | 1410 |
|
1411 |
" |
|
1412 |
Smalltalk browseInClass:Array selector:#at: |
|
1413 |
" |
|
22241 | 1414 |
|
1415 |
"Modified: / 01-09-2017 / 14:21:49 / cg" |
|
453 | 1416 |
! ! |
1417 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1418 |
!Smalltalk class methodsFor:'class management'! |
453 | 1419 |
|
18732 | 1420 |
basicRemoveClass:aClass |
1421 |
"remove the argument, aClass from the smalltalk dictionary; |
|
1422 |
we have to flush the caches since these methods are now void. |
|
1423 |
Also, class variables of aClass are removed." |
|
1424 |
||
1425 |
|sym cSym names oldName oldNameSym actualName wrongName| |
|
1426 |
||
1427 |
aClass isNil ifTrue:[^ self]. |
|
1428 |
||
1429 |
oldName := aClass name. |
|
1430 |
sym := oldNameSym := oldName asSymbol. |
|
1431 |
((self at:oldNameSym) == aClass) ifFalse:[ |
|
22791 | 1432 |
"check other name ..." |
1433 |
(self includes:aClass) ifFalse:[ |
|
1434 |
'Smalltalk [warning]: no such class: ' errorPrint. oldName errorPrintCR. |
|
1435 |
^ self |
|
1436 |
]. |
|
1437 |
" |
|
1438 |
the class has changed its name - without telling me ... |
|
1439 |
what should be done in this case ? |
|
1440 |
" |
|
1441 |
'Smalltalk [warning]: class ' errorPrint. oldName errorPrint. |
|
1442 |
' has changed its name' errorPrintCR. |
|
1443 |
||
1444 |
"/ |
|
1445 |
"/ might be an alias (i.e. removing a compatibility name) |
|
1446 |
"/ |
|
1447 |
actualName := self keyAtValue:aClass. |
|
1448 |
('Smalltalk [info]: ' , oldName , ' is actually stored as ' , actualName , '.') infoPrintCR. |
|
1449 |
sym := actualName asSymbol. |
|
1450 |
oldName := actualName asString. |
|
1451 |
wrongName := true. |
|
18732 | 1452 |
]. |
1453 |
||
1454 |
self at:sym put:nil. "nil it out for compiled accesses" |
|
1455 |
||
1456 |
"/ |
|
20811 | 1457 |
"/ see comment in removeKey: on why we don't remove it here |
18732 | 1458 |
"/ |
1459 |
"/ self removeKey:sym. "/ remove key - this actually fails, if there are |
|
22791 | 1460 |
"/ still compiled code references." |
18732 | 1461 |
|
1462 |
"remove private classes" |
|
1463 |
||
1464 |
aClass privateClassesSorted do:[:somePrivateClass | |
|
22791 | 1465 |
aClass privateClassesAt:(somePrivateClass nameWithoutPrefix) asSymbol put:nil. |
18732 | 1466 |
]. |
1467 |
||
1468 |
"remove class variables" |
|
1469 |
||
1470 |
names := aClass classVariableString asCollectionOfWords. |
|
1471 |
names do:[:name | |
|
22791 | 1472 |
cSym := aClass globalKeyForClassVar:name. |
1473 |
self at:cSym asSymbol put:nil. |
|
1474 |
||
1475 |
"/ |
|
1476 |
"/ see comment in removeKey: on why we dont remove it here |
|
1477 |
"/ |
|
1478 |
"/ self removeKey:cSym |
|
18732 | 1479 |
]. |
1480 |
||
1481 |
||
1482 |
"/ actually could get along with less flushing |
|
1483 |
"/ (entries for aClass and subclasses only) |
|
1484 |
"/ but we have to delay this, until we have the set of subclasses |
|
1485 |
"/ at hand - for now, searching for all subclasses is way more |
|
1486 |
"/ expensive then cache flushing. |
|
1487 |
"/ |
|
1488 |
"/ aClass allSubclassesDo:[:aSubclass | |
|
1489 |
"/ ObjectMemory flushInlineCachesForClass:aSubclass. |
|
1490 |
"/ ObjectMemory flushMethodCacheFor:aSubclass |
|
1491 |
"/ ]. |
|
1492 |
"/ ObjectMemory flushInlineCachesForClass:aClass. |
|
1493 |
"/ ObjectMemory flushMethodCacheFor:aClass |
|
1494 |
||
1495 |
ObjectMemory flushInlineCaches. |
|
1496 |
ObjectMemory flushMethodCache. |
|
1497 |
||
1498 |
aClass addChangeRecordForClassRemove. |
|
1499 |
self changed:#classRemove with:aClass. |
|
1500 |
||
1501 |
aClass setCategory:#'* removed *'. |
|
1502 |
||
1503 |
"/ self flushCachedClasses. |
|
1504 |
"/ Class flushSubclassInfo. |
|
1505 |
self flushCachedClass:aClass. |
|
1506 |
Class flushSubclassInfoFor:aClass superclass. |
|
1507 |
Class flushSubclassInfoFor:aClass. |
|
1508 |
||
1509 |
wrongName == true ifTrue:[ |
|
22791 | 1510 |
"/ |
1511 |
"/ an alias (i.e. removing a compatibility name) |
|
1512 |
"/ |
|
1513 |
"/ check if there are more refs to it ... |
|
1514 |
[self includes:aClass] whileTrue:[ |
|
1515 |
actualName := self keyAtValue:aClass. |
|
1516 |
('Smalltalk [info]: ' , aClass name , ' is also registered under the name ' , actualName |
|
1517 |
, ' - remove that binding too.') infoPrintCR. |
|
1518 |
self at:actualName put:nil. |
|
1519 |
]. |
|
18732 | 1520 |
]. |
1521 |
||
1522 |
"Modified: / 18-11-2006 / 17:16:31 / cg" |
|
1523 |
! |
|
1524 |
||
7563 | 1525 |
changeCategoryOf:aClass to:newCategory |
1526 |
"change a classes category, add a change record, |
|
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1527 |
send change notifications" |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1528 |
|
8405 | 1529 |
|ns oldCategory| |
1530 |
||
1531 |
oldCategory := aClass category. |
|
1532 |
oldCategory ~= newCategory ifTrue:[ |
|
18668 | 1533 |
aClass category:(newCategory withoutSeparators asSymbol). |
1534 |
||
1535 |
"notify change of category" |
|
1536 |
ns := aClass environment ? self. |
|
1537 |
ns changed:#organization with:(aClass -> oldCategory). |
|
1538 |
ns ~~ self ifTrue:[ |
|
1539 |
self changed:#organization with:(aClass -> oldCategory). |
|
1540 |
] |
|
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1541 |
]. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1542 |
|
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1543 |
" |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1544 |
Smalltalk changeCategoryOf:NewApplication to:#myApplications |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1545 |
" |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1546 |
|
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1547 |
"Modified: / 11.2.2000 / 11:36:27 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1548 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1549 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1550 |
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
|
1551 |
NameSpace name:name |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1552 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1553 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1554 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1555 |
flushCachedClass:aClass |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1556 |
CachedClasses notNil ifTrue:[ |
18668 | 1557 |
CachedClasses remove:aClass ifAbsent:[]. |
12700 | 1558 |
]. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1559 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1560 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1561 |
flushCachedClasses |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1562 |
CachedClasses := nil. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1563 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1564 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1565 |
Smalltalk flushCachedClasses |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1566 |
" |
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 |
removeClass:aClass |
7563 | 1570 |
"remove the argument, aClass from the smalltalk dictionary; |
453 | 1571 |
we have to flush the caches since these methods are now void. |
18732 | 1572 |
Also, class variables of aClass are removed. |
1573 |
Recompile accessors to aClass." |
|
1574 |
||
1575 |
|oldNameSym ns ons| |
|
1576 |
||
1577 |
oldNameSym := aClass name asSymbol. |
|
4781 | 1578 |
ns := aClass nameSpace. |
1579 |
aClass topOwningClass notNil ifTrue:[ |
|
22791 | 1580 |
ons := aClass topOwningClass nameSpace |
18732 | 1581 |
]. |
1582 |
||
1583 |
self basicRemoveClass:aClass. |
|
4724
44793fe70787
recompile ns classes after a class remove
Claus Gittinger <cg@exept.de>
parents:
4723
diff
changeset
|
1584 |
|
4781 | 1585 |
ns ~~ Smalltalk ifTrue:[ |
22791 | 1586 |
ons notNil ifTrue:[ |
1587 |
ClassBuilder |
|
1588 |
recompileGlobalAccessorsTo:oldNameSym |
|
1589 |
in:ons |
|
1590 |
except:nil |
|
1591 |
]. |
|
1592 |
(ns notNil and:[ns ~~ ons]) ifTrue:[ |
|
1593 |
ClassBuilder |
|
1594 |
recompileGlobalAccessorsTo:oldNameSym |
|
1595 |
in:ns |
|
1596 |
except:nil |
|
1597 |
]. |
|
18732 | 1598 |
]. |
1599 |
! |
|
1600 |
||
1601 |
removeClasses:aCollectionOfClasses |
|
1602 |
"remove aCollectionOfClasses from the smalltalk dictionary; |
|
1603 |
we have to flush the caches since these methods are now void. |
|
1604 |
Also, class variables of aClass are removed. |
|
1605 |
Recompile accessors to the classes - after all classes in the collection have been removed." |
|
1606 |
||
1607 |
|tuples| |
|
1608 |
||
1609 |
tuples := aCollectionOfClasses collect:[:eachClass| |
|
22791 | 1610 |
Array |
1611 |
with:eachClass name asSymbol |
|
1612 |
with:eachClass nameSpace |
|
1613 |
with:( |
|
1614 |
eachClass topOwningClass notNil ifTrue:[ |
|
1615 |
eachClass topOwningClass nameSpace |
|
1616 |
] ifFalse:[nil]) |
|
1617 |
]. |
|
18732 | 1618 |
|
1619 |
aCollectionOfClasses do:[:eachClass| |
|
22791 | 1620 |
self basicRemoveClass:eachClass. |
18732 | 1621 |
]. |
1622 |
||
1623 |
tuples do:[:eachClssymNsOnsTuple| |
|
22791 | 1624 |
|oldNameSym ns ons| |
1625 |
||
1626 |
oldNameSym := eachClssymNsOnsTuple at:1. |
|
1627 |
ns := eachClssymNsOnsTuple at:2. |
|
1628 |
ons := eachClssymNsOnsTuple at:3. |
|
1629 |
||
1630 |
ns ~~ Smalltalk ifTrue:[ |
|
1631 |
ons notNil ifTrue:[ |
|
1632 |
ClassBuilder |
|
1633 |
recompileGlobalAccessorsTo:oldNameSym |
|
1634 |
in:ons |
|
1635 |
except:nil |
|
1636 |
]. |
|
1637 |
(ns notNil and:[ns ~~ ons]) ifTrue:[ |
|
1638 |
ClassBuilder |
|
1639 |
recompileGlobalAccessorsTo:oldNameSym |
|
1640 |
in:ns |
|
1641 |
except:nil |
|
1642 |
]. |
|
1643 |
] |
|
18732 | 1644 |
]. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1645 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1646 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1647 |
renameClass:aClass to:newName |
7563 | 1648 |
"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
|
1649 |
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
|
1650 |
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
|
1651 |
|
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1652 |
|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
|
1653 |
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
|
1654 |
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
|
1655 |
oldMetaclass newMetaclass newCategory| |
5610
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1656 |
|
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1657 |
"/ check for all intermediate namespaces / owning classes |
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1658 |
i1 := 1. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1659 |
i2 := 1. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1660 |
ns := self. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1661 |
[i2 ~~ 0] whileTrue:[ |
22791 | 1662 |
i2 := newName indexOfSubCollection:'::' startingAt:i1. |
1663 |
i2 ~~ 0 ifTrue:[ |
|
1664 |
nm := newName copyFrom:i1 to:i2-1. |
|
1665 |
ns isNameSpace ifTrue:[ |
|
1666 |
subns := ns at:nm asSymbol ifAbsent:nil. |
|
1667 |
subns isNil ifTrue:[ |
|
1668 |
self error:'Nonexisting namespace: ',nm. |
|
1669 |
^ nil. |
|
1670 |
]. |
|
1671 |
] ifFalse:[ |
|
1672 |
subns := ns privateClassesAt:nm asSymbol. |
|
1673 |
subns isNil ifTrue:[ |
|
1674 |
self error:'Cannot create a namespace below a class' |
|
1675 |
] |
|
1676 |
]. |
|
1677 |
ns := subns. |
|
1678 |
i1 := i2 + 2. |
|
1679 |
]. |
|
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1680 |
]. |
617 | 1681 |
|
1682 |
oldName := aClass name. |
|
6734 | 1683 |
oldNameSpace := aClass topNameSpace. |
2319
640bb389f90a
recompile when moving classes across namespaces
Claus Gittinger <cg@exept.de>
parents:
2317
diff
changeset
|
1684 |
oldBaseName := aClass nameWithoutNameSpacePrefix. |
3698
8bce45214d24
fixed renaming of a private class (must recompile owner)
Claus Gittinger <cg@exept.de>
parents:
3678
diff
changeset
|
1685 |
oldBaseNameWithoutPrefix := aClass nameWithoutPrefix. |
617 | 1686 |
oldSym := oldName asSymbol. |
2485
9f4a11a4521f
new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents:
2476
diff
changeset
|
1687 |
privateClasses := aClass privateClassesSorted. |
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1688 |
|
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1689 |
((self at:oldSym) ~~ aClass) ifTrue:[ |
22791 | 1690 |
'Smalltalk [warning]: rename failed - name is different from key' errorPrintCR. |
1691 |
^ self |
|
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1692 |
]. |
617 | 1693 |
|
1525
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1694 |
"/ rename the class |
617 | 1695 |
|
1847
6e567214b167
care for className being a symbol, when renaming classes
Claus Gittinger <cg@exept.de>
parents:
1758
diff
changeset
|
1696 |
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
|
1697 |
|
5610
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1698 |
"/ change the owning class |
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1699 |
ns isNameSpace ifFalse:[ |
22791 | 1700 |
aClass isPrivate ifTrue:[ |
1701 |
aClass class setOwningClass:ns. |
|
1702 |
] ifFalse:[ |
|
1703 |
"/ sigh - must make a PrivateMetaclass from Metaclass |
|
1704 |
oldMetaclass := aClass class. |
|
1705 |
newMetaclass := PrivateMetaclass new. |
|
1706 |
newMetaclass flags:(oldMetaclass flags). |
|
1707 |
newMetaclass setSuperclass:(oldMetaclass superclass). |
|
1708 |
newMetaclass instSize:(oldMetaclass instSize). |
|
1709 |
newMetaclass setInstanceVariableString:(oldMetaclass instanceVariableString). |
|
1710 |
newMetaclass setMethodDictionary:(oldMetaclass methodDictionary). |
|
1711 |
newMetaclass setSoleInstance:aClass. |
|
1712 |
newMetaclass setOwningClass:ns. |
|
1713 |
||
1714 |
aClass changeClassTo:newMetaclass. |
|
1715 |
ObjectMemory flushCaches. |
|
1716 |
] |
|
5610
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1717 |
] ifTrue:[ |
22791 | 1718 |
aClass isPrivate ifTrue:[ |
1719 |
newCategory := aClass topOwningClass category. |
|
1720 |
||
1721 |
"/ sigh - must make a Metaclass from PrivateMetaclass |
|
1722 |
oldMetaclass := aClass class. |
|
1723 |
||
1724 |
newMetaclass := Metaclass new. |
|
1725 |
newMetaclass flags:(oldMetaclass flags). |
|
1726 |
newMetaclass setSuperclass:(oldMetaclass superclass). |
|
1727 |
newMetaclass instSize:(oldMetaclass instSize). |
|
1728 |
newMetaclass setInstanceVariableString:(oldMetaclass instanceVariableString). |
|
1729 |
newMetaclass setMethodDictionary:(oldMetaclass methodDictionary). |
|
1730 |
newMetaclass setSoleInstance:aClass. |
|
1731 |
||
1732 |
aClass category:newCategory. |
|
1733 |
aClass changeClassTo:newMetaclass. |
|
1734 |
ObjectMemory flushCaches. |
|
1735 |
] |
|
5610
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1736 |
]. |
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1737 |
|
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1738 |
aClass setName:newSym. |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1739 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1740 |
"/ store it in Smalltalk |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1741 |
self at:oldSym put:nil. |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1742 |
|
878
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1743 |
"/ |
20811 | 1744 |
"/ see comment in #removeKey: on why we don't 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
|
1745 |
"/ |
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1746 |
"/ self removeKey:oldSym. |
617 | 1747 |
self at:newSym put:aClass. |
1748 |
||
1525
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1749 |
"/ 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
|
1750 |
|
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1751 |
oldNameToNewName := IdentityDictionary new. |
617 | 1752 |
|
1753 |
names := aClass classVariableString asCollectionOfWords. |
|
1754 |
names do:[:name | |
|
22791 | 1755 |
oldCVSym := (oldSym , ':' , name) asSymbol. |
1756 |
value := self at:oldCVSym. |
|
1757 |
self at:oldCVSym put:nil. |
|
1758 |
||
1759 |
"/ |
|
1760 |
"/ see comment in #removeKey: on why we dont remove it it here |
|
1761 |
"/ |
|
1762 |
"/ self removeKey:cSym. |
|
1763 |
||
1764 |
newCVSym := (newSym , ':' , name) asSymbol. |
|
1765 |
self at:newCVSym put:value. |
|
1766 |
||
1767 |
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
|
1768 |
]. |
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1769 |
|
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1770 |
"/ 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
|
1771 |
|
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1772 |
oldNameToNewName keysAndValuesDo:[:oldNameSym :newNameSym | |
22791 | 1773 |
aClass withAllSubclasses do:[:aSubClass | |
1774 |
Transcript showCR:'changing global accesses from ''' , oldNameSym , ''' into ''' , newNameSym , ''' in class: ''' , aSubClass name , ''' ...'. |
|
1775 |
aSubClass instAndClassSelectorsAndMethodsDo:[:sel :aMethod | |
|
1776 |
aMethod changeLiteral:oldNameSym to:newNameSym |
|
1777 |
]. |
|
1778 |
]. |
|
1779 |
||
1780 |
"/ and also in privateClasses ? ... |
|
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1781 |
|
2485
9f4a11a4521f
new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents:
2476
diff
changeset
|
1782 |
"/ privateClasses size > 0 ifTrue:[ |
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1783 |
"/ privateClasses do:[:aPrivateClass | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1784 |
"/ aPrivateClass withAllSubclasses do:[:aSubClass | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1785 |
"/ aSubClass class methodDictionary do:[:aMethod | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1786 |
"/ aMethod changeLiteral:oldNameSym to:newNameSym |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1787 |
"/ ]. |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1788 |
"/ aSubClass methodDictionary do:[:aMethod | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1789 |
"/ aMethod changeLiteral:oldNameSym to:newNameSym |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1790 |
"/ ] |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1791 |
"/ ]. |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1792 |
"/ ] |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1793 |
"/ ] |
617 | 1794 |
]. |
1795 |
||
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1796 |
aClass addChangeRecordForClassRename:oldSym to:newSym. |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1797 |
|
5333
d80386e06d21
rename into other namespace did not work
Claus Gittinger <cg@exept.de>
parents:
5328
diff
changeset
|
1798 |
"/ 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
|
1799 |
aClass setEnvironment:nil. |
6734 | 1800 |
newNameSpace := aClass topNameSpace. |
2405
939f4e751ef3
dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents:
2379
diff
changeset
|
1801 |
|
2485
9f4a11a4521f
new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents:
2476
diff
changeset
|
1802 |
privateClasses size > 0 ifTrue:[ |
22791 | 1803 |
"/ must rename privateClasses as well |
1804 |
Class withoutUpdatingChangesDo:[ |
|
1805 |
privateClasses do:[:aPrivateClass | |
|
1806 |
self renameClass:aPrivateClass |
|
1807 |
to:(newSym , '::' , aPrivateClass nameWithoutPrefix). |
|
1808 |
||
1809 |
Transcript showCR:'recompiling methods in ''' , newNameSpace name , ''' accessing ''' , oldName , '::' , aPrivateClass nameWithoutPrefix , ''' ...'. |
|
1810 |
aClass theNonMetaclass recompileMethodsAccessingGlobal:(oldName , '::' , aPrivateClass nameWithoutPrefix) asSymbol. |
|
1811 |
aClass theMetaclass recompileMethodsAccessingGlobal:(oldName , '::' , aPrivateClass nameWithoutPrefix) asSymbol. |
|
1812 |
aClass theNonMetaclass recompileMethodsAccessingGlobal:(aPrivateClass nameWithoutPrefix) asSymbol. |
|
1813 |
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
|
1814 |
"/ ClassBuilder |
10071 | 1815 |
"/ recompileGlobalAccessorsTo:(oldName , '::' , aPrivateClass nameWithoutPrefix) asSymbol |
1816 |
"/ in:newNameSpace |
|
9822
38acd1c5eeab
recompile methods which access private classes when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
9819
diff
changeset
|
1817 |
"/ except:nil. |
22791 | 1818 |
] |
1819 |
] |
|
2405
939f4e751ef3
dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents:
2379
diff
changeset
|
1820 |
]. |
939f4e751ef3
dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents:
2379
diff
changeset
|
1821 |
|
2319
640bb389f90a
recompile when moving classes across namespaces
Claus Gittinger <cg@exept.de>
parents:
2317
diff
changeset
|
1822 |
oldNameSpace ~~ newNameSpace ifTrue:[ |
5246
2ca7b20c4108
create namespaces as requried, when renaming a class
Claus Gittinger <cg@exept.de>
parents:
5214
diff
changeset
|
1823 |
|
22791 | 1824 |
"/ all those referencing the class from the old nameSpace |
1825 |
"/ must be recompiled ... |
|
1826 |
"/ (to now access the global from smalltalk) |
|
1827 |
||
1828 |
oldNameSpace ~~ Smalltalk ifTrue:[ |
|
1829 |
Transcript showCR:'recompiling methods in ''' , oldNameSpace name , ''' accessing ''' , oldName , ''' ...'. |
|
1830 |
||
1831 |
ClassBuilder |
|
1832 |
recompileGlobalAccessorsTo:oldName asSymbol |
|
1833 |
in:oldNameSpace |
|
1834 |
except:nil. |
|
1835 |
]. |
|
1836 |
||
1837 |
"/ all referencing the class in the new namespace |
|
1838 |
"/ as well; to now access the new class. |
|
1839 |
||
1840 |
(newNameSpace notNil and:[newNameSpace ~~ Smalltalk]) ifTrue:[ |
|
1841 |
Transcript showCR:'recompiling methods in ''' , newNameSpace name , ''' accessing ''' , oldBaseName , ''' ...'. |
|
1842 |
||
1843 |
ClassBuilder |
|
1844 |
recompileGlobalAccessorsTo:oldBaseName asSymbol |
|
1845 |
in:newNameSpace |
|
1846 |
except:nil. |
|
1847 |
]. |
|
3698
8bce45214d24
fixed renaming of a private class (must recompile owner)
Claus Gittinger <cg@exept.de>
parents:
3678
diff
changeset
|
1848 |
] ifFalse:[ |
22791 | 1849 |
"/ all references to a global with my new name in my owning class |
1850 |
"/ must now be redirected to myself. |
|
1851 |
||
1852 |
aClass isPrivate ifTrue:[ |
|
1853 |
newBaseName := aClass nameWithoutNameSpacePrefix. |
|
1854 |
newBaseNameWithoutPrefix := aClass nameWithoutPrefix. |
|
1855 |
||
1856 |
Transcript showCR:'recompiling methods accessing ''' , oldBaseNameWithoutPrefix , ''' in: ''' , aClass owningClass name , ''' ...'. |
|
1857 |
aClass owningClass recompileMethodsAccessingGlobal:oldBaseNameWithoutPrefix. |
|
1858 |
aClass owningClass class recompileMethodsAccessingGlobal:oldBaseNameWithoutPrefix. |
|
1859 |
||
1860 |
Transcript showCR:'recompiling methods accessing ''' , oldBaseName , ''' in: ''' , aClass owningClass name , ''' ...'. |
|
1861 |
aClass owningClass recompileMethodsAccessingGlobal:oldBaseName. |
|
1862 |
aClass owningClass class recompileMethodsAccessingGlobal:oldBaseName. |
|
1863 |
||
1864 |
Transcript showCR:'recompiling methods accessing ''' , newBaseNameWithoutPrefix , ''' in: ''' , aClass owningClass name , ''' ...'. |
|
1865 |
aClass owningClass recompileMethodsAccessingGlobal:newBaseNameWithoutPrefix. |
|
1866 |
aClass owningClass class recompileMethodsAccessingGlobal:newBaseNameWithoutPrefix. |
|
1867 |
||
1868 |
Transcript showCR:'recompiling methods accessing ''' , newBaseName , ''' in: ''' , aClass owningClass name , ''' ...'. |
|
1869 |
aClass owningClass recompileMethodsAccessingGlobal:newBaseName. |
|
1870 |
aClass owningClass class recompileMethodsAccessingGlobal:newBaseName. |
|
1871 |
] |
|
4040
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1872 |
]. |
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1873 |
|
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1874 |
aClass changed:#definition. |
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1875 |
"/ 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
|
1876 |
aClass allSubclassesDo:[:subClass | |
22791 | 1877 |
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
|
1878 |
]. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1879 |
"/ 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
|
1880 |
aClass subclassesDo:[:subClass | |
22791 | 1881 |
subClass addChangeRecordForClass:subClass. |
4040
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1882 |
]. |
5613
b534e427f028
change message when renaming a class
Claus Gittinger <cg@exept.de>
parents:
5611
diff
changeset
|
1883 |
self changed:#definition. |
14611 | 1884 |
self 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
|
1885 |
|
9822
38acd1c5eeab
recompile methods which access private classes when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
9819
diff
changeset
|
1886 |
"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
|
1887 |
"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
|
1888 |
"Modified: / 05-09-2006 / 12:52:25 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1889 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1890 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1891 |
!Smalltalk class methodsFor:'copying'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1892 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1893 |
deepCopy |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1894 |
"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
|
1895 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1896 |
^ self |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1897 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1898 |
"Modified: 18.5.1996 / 12:13:33 / cg" |
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 |
|
10952 | 1901 |
deepCopyUsing:aDictionary postCopySelector:postCopySelector |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1902 |
"return a deep copy of the receiver. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1903 |
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
|
1904 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1905 |
^ self |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1906 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1907 |
"Modified: 18.5.1996 / 12:13:36 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1908 |
! |
453 | 1909 |
|
7563 | 1910 |
shallowCopy |
1911 |
"redefined to return self - there is only one Smalltalk dictionary" |
|
617 | 1912 |
|
1913 |
^ self |
|
1410 | 1914 |
|
1915 |
"Modified: 18.5.1996 / 12:13:39 / cg" |
|
617 | 1916 |
! |
1917 |
||
7563 | 1918 |
simpleDeepCopy |
1919 |
"redefined to return self - there is only one Smalltalk dictionary" |
|
453 | 1920 |
|
1921 |
^ self |
|
1410 | 1922 |
|
1923 |
"Modified: 18.5.1996 / 12:13:42 / cg" |
|
453 | 1924 |
! ! |
1925 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1926 |
!Smalltalk class methodsFor:'debugging ST/X'! |
453 | 1927 |
|
7563 | 1928 |
compileTrace:aBoolean |
1929 |
"dump generated inline code (NOOP if VM was compiled without the trace-debug option)" |
|
7325 | 1930 |
%{ |
1931 |
extern char __compileTrace__; |
|
1932 |
||
1933 |
__compileTrace__ = (aBoolean == true) ? 1 : 0; |
|
1934 |
%} |
|
1935 |
" |
|
1936 |
Smalltalk compileTrace:true |
|
1937 |
Smalltalk compileTrace:false |
|
1938 |
" |
|
1939 |
! |
|
1940 |
||
7563 | 1941 |
debugBreakPoint |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1942 |
"{ Pragma: +optSpace }" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1943 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1944 |
"call the dummy debug function, on which a breakpoint |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1945 |
can be put in adb, sdb, dbx or gdb. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1946 |
WARNING: this method is for debugging only |
18668 | 1947 |
it will be removed without notice." |
453 | 1948 |
%{ |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1949 |
__PATCHUPCONTEXTS(__context); |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1950 |
__debugBreakPoint__(); |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1951 |
%}. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1952 |
^ self |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1953 |
! |
453 | 1954 |
|
7563 | 1955 |
exitWithCoreDump |
1956 |
"{ Pragma: +optSpace }" |
|
1957 |
||
20755 | 1958 |
"abort the program and dump core" |
7563 | 1959 |
|
1960 |
OperatingSystem exitWithCoreDump |
|
4096
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1961 |
"/ never returns |
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1962 |
|
20755 | 1963 |
"Be careful evaluating this: |
4096
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1964 |
Smalltalk exitWithCoreDump |
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1965 |
" |
617 | 1966 |
! |
1967 |
||
7563 | 1968 |
fatalAbort |
1969 |
"{ Pragma: +optSpace }" |
|
1970 |
||
1971 |
"report a fatal-error, print a stack backtrace and exit with core dump. |
|
617 | 1972 |
(You may turn off the stack print with debugPrinting:false)" |
18287 | 1973 |
|
1974 |
self fatalAbort:'fatalAbort' |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1975 |
! |
617 | 1976 |
|
7563 | 1977 |
fatalAbort:aMessage |
1978 |
"{ Pragma: +optSpace }" |
|
1979 |
||
1980 |
"report a fatal-error; print a stack backtrace and exit with core dump |
|
617 | 1981 |
(You may turn off the stack print with debugPrinting:false)" |
1982 |
||
1983 |
%{ |
|
18287 | 1984 |
#ifdef __SCHTEAM__ |
1985 |
STMain.fatalAbort( aMessage ); |
|
1986 |
/* NOT REACHED */ |
|
1987 |
#else |
|
617 | 1988 |
char *msg; |
1989 |
||
12481
805176d238d2
change __isString() to __isStringLike() in primitive code
Stefan Vogel <sv@exept.de>
parents:
12413
diff
changeset
|
1990 |
if (__isStringLike(aMessage)) |
18668 | 1991 |
msg = (char *) __stringVal(aMessage); |
617 | 1992 |
else |
18668 | 1993 |
msg = "fatalAbort"; |
617 | 1994 |
|
1995 |
__fatal0(__context, msg); |
|
1996 |
/* NEVER RETURNS */ |
|
18287 | 1997 |
#endif |
5410 | 1998 |
%}. |
1999 |
^ self primitiveFailed |
|
5441 | 2000 |
! |
2001 |
||
13135
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2002 |
ignoreHalt |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2003 |
"return true, if halts are ignored. |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2004 |
Usually, this is done in standAlone applications" |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2005 |
|
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2006 |
IgnoreHalt isNil ifTrue:[ |
18668 | 2007 |
^ self isStandAloneApp |
13135
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2008 |
]. |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2009 |
^ IgnoreHalt |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2010 |
|
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2011 |
"Created: / 18-11-2010 / 11:20:16 / cg" |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2012 |
! |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2013 |
|
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2014 |
ignoreHalt:aBoolean |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2015 |
"control if halts are to be ignored; |
13135
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2016 |
usually, this is done in standAlone applications" |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2017 |
|
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2018 |
IgnoreHalt := aBoolean |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2019 |
|
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2020 |
" |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2021 |
Smalltalk ignoreHalt:true. |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2022 |
self halt. |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2023 |
Smalltalk ignoreHalt:false. |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2024 |
self halt. |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2025 |
" |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2026 |
|
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2027 |
"Created: / 18-11-2010 / 11:20:27 / cg" |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2028 |
! |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2029 |
|
18329 | 2030 |
verbose |
2031 |
^ Verbose |
|
2032 |
! |
|
2033 |
||
2034 |
verbose:aBoolean |
|
2035 |
Verbose := aBoolean |
|
2036 |
! |
|
2037 |
||
7563 | 2038 |
vmInstructionTrace:aBoolean |
13947 | 2039 |
self halt:'not yet implemented' |
2040 |
||
2041 |
"Modified: / 19-01-2012 / 10:15:35 / cg" |
|
7563 | 2042 |
! ! |
2043 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2044 |
!Smalltalk class methodsFor:'enumerating'! |
7563 | 2045 |
|
453 | 2046 |
allBehaviorsDo:aBlock |
5580
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
2047 |
"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
|
2048 |
|
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
2049 |
self allClassesAndMetaclassesDo:aBlock |
453 | 2050 |
|
2051 |
" |
|
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
2052 |
Smalltalk allBehaviorsDo:[:aClass | aClass name printCR] |
453 | 2053 |
" |
7563 | 2054 |
! |
2055 |
||
2056 |
allClassCategories |
|
2057 |
"return a set of all class categories in the system" |
|
2058 |
||
2059 |
|allCategories| |
|
6217
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2060 |
|
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2061 |
allCategories := Set new. |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2062 |
Smalltalk allClassesDo:[:cls | |
18668 | 2063 |
|category| |
2064 |
||
2065 |
category := cls category. |
|
2066 |
category notNil ifTrue:[ |
|
2067 |
allCategories add:category. |
|
2068 |
]. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2069 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2070 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2071 |
^ allCategories. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2072 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2073 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2074 |
Smalltalk allClassCategories |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2075 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2076 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2077 |
"Created: / 17.11.2001 / 12:13:09 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2078 |
! |
6217
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2079 |
|
7563 | 2080 |
allClassesAndMetaclassesDo:aBlock |
2081 |
"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
|
2082 |
|
21108 | 2083 |
|already numClassesHintTimes2| |
2084 |
||
2085 |
numClassesHintTimes2 := NumberOfClassesHint*2. |
|
2086 |
already := IdentitySet new:numClassesHintTimes2. |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2087 |
self allClassesDo:[:eachClass | |
22791 | 2088 |
|theNonMeta theMeta| |
2089 |
||
2090 |
theNonMeta := eachClass theNonMetaclass. |
|
2091 |
(already includes:theNonMeta) ifFalse:[ |
|
2092 |
aBlock value:theNonMeta. |
|
2093 |
already add:theNonMeta. |
|
2094 |
]. |
|
2095 |
theMeta := theNonMeta class. |
|
2096 |
(already includes:theMeta) ifFalse:[ |
|
2097 |
aBlock value:theMeta. |
|
2098 |
already add:theMeta. |
|
2099 |
]. |
|
2100 |
already size > numClassesHintTimes2 ifTrue:[ |
|
2101 |
NumberOfClassesHint := (already size // 2) + 10 |
|
2102 |
]. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2103 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2104 |
! |
5579
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
2105 |
|
7563 | 2106 |
allClassesDo:aBlock |
21489 | 2107 |
"evaluate the argument, aBlock for all classes in the system. |
2108 |
Enumerates non-meta classes only - not metaclasses" |
|
5580
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
2109 |
|
5765 | 2110 |
self allClasses do:aBlock |
453 | 2111 |
|
2112 |
" |
|
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
2113 |
Smalltalk allClassesDo:[:aClass | aClass name printCR] |
453 | 2114 |
" |
21489 | 2115 |
|
2116 |
"Modified (comment): / 19-02-2017 / 12:38:17 / cg" |
|
453 | 2117 |
! |
2118 |
||
9506 | 2119 |
allClassesForWhich:filter |
10071 | 2120 |
"return a collection with all classes in the system, |
21489 | 2121 |
for which filter evaluates to true. |
2122 |
Enumerates non-meta classes only - not metaclasses" |
|
9506 | 2123 |
|
2124 |
|collectedClasses| |
|
2125 |
||
2126 |
collectedClasses := OrderedCollection new. |
|
2127 |
self allClassesForWhich:filter do:[:cls | |
|
22791 | 2128 |
collectedClasses add:cls |
9506 | 2129 |
]. |
2130 |
^ collectedClasses |
|
2131 |
||
2132 |
" |
|
10071 | 2133 |
Smalltalk |
22791 | 2134 |
allClassesForWhich:[:cls | cls name startsWith:'Po'] |
9506 | 2135 |
" |
2136 |
||
2137 |
"Created: / 10-08-2006 / 12:11:31 / cg" |
|
21489 | 2138 |
"Modified (comment): / 19-02-2017 / 12:37:49 / cg" |
9506 | 2139 |
! |
2140 |
||
9292 | 2141 |
allClassesForWhich:filter do:aBlock |
21489 | 2142 |
"evaluate the argument, aBlock for all classes in the system, for which filter evaluates to true. |
2143 |
Enumerates non-meta classes only - not metaclasses" |
|
9292 | 2144 |
|
2145 |
self allClassesDo:[:cls | |
|
22791 | 2146 |
(filter value:cls) ifTrue:[ aBlock value:cls ]. |
10071 | 2147 |
]. |
2148 |
||
2149 |
" |
|
2150 |
Smalltalk |
|
22791 | 2151 |
allClassesForWhich:[:cls | cls name startsWith:'Po'] |
2152 |
do:[:aClass | Transcript showCR:aClass name] |
|
21489 | 2153 |
" |
2154 |
||
2155 |
"Modified (comment): / 19-02-2017 / 12:37:59 / cg" |
|
9292 | 2156 |
! |
2157 |
||
7563 | 2158 |
allClassesInCategory:aCategory |
2159 |
"return a collection of for all classes in aCategory; |
|
1299 | 2160 |
The order of the classes is not defined." |
2161 |
||
9506 | 2162 |
^ self allClassesForWhich:[:cls | cls category = aCategory] |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2163 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2164 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2165 |
Smalltalk allClassesInCategory:'Views-Basic' |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2166 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2167 |
|
9506 | 2168 |
"Modified: / 10-08-2006 / 12:13:32 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2169 |
! |
1299 | 2170 |
|
7563 | 2171 |
allClassesInCategory:aCategory do:aBlock |
2172 |
"evaluate the argument, aBlock for all classes in the aCategory; |
|
453 | 2173 |
The order of the classes is not defined." |
2174 |
||
2175 |
aCategory notNil ifTrue:[ |
|
18668 | 2176 |
self allClassesForWhich:[:cls | cls category = aCategory] do:aBlock |
453 | 2177 |
] |
2178 |
||
2179 |
" |
|
9490 | 2180 |
Smalltalk allClassesInCategory:'Views-Basic' do:[:aClass | Transcript showCR:aClass] |
2181 |
" |
|
2182 |
||
2183 |
"Modified: / 09-08-2006 / 17:18:50 / fm" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2184 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2185 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2186 |
allClassesInCategory:aCategory inOrderDo:aBlock |
7563 | 2187 |
"evaluate the argument, aBlock for all classes in aCategory; |
453 | 2188 |
superclasses come first - then subclasses" |
2189 |
||
2190 |
|classes| |
|
2191 |
||
2192 |
aCategory notNil ifTrue:[ |
|
18668 | 2193 |
classes := OrderedCollection new. |
2194 |
self allClassesInCategory:aCategory do:[:aClass | |
|
2195 |
classes add:aClass |
|
2196 |
]. |
|
2197 |
classes topologicalSort:[:a :b | b isSubclassOf:a]. |
|
2198 |
classes do:aBlock |
|
453 | 2199 |
] |
2200 |
||
2201 |
" |
|
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
2202 |
Smalltalk allClassesInCategory:'Views-Basic' inOrderDo:[:aClass | aClass name printCR] |
453 | 2203 |
" |
6217
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2204 |
|
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2205 |
"Modified: / 17.11.2001 / 12:18:15 / cg" |
8583
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 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2208 |
allClassesInOrderDo:aBlock |
7563 | 2209 |
"evaluate the argument, aBlock for all classes in the system; |
5406 | 2210 |
Evaluation order is by inheritance: superclasses come first." |
2211 |
||
2212 |
|already| |
|
2213 |
||
8964
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
2214 |
already := IdentitySet new:NumberOfClassesHint. |
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
2215 |
self allClassesDo:[:eachClass | |
18668 | 2216 |
(already includes:eachClass) ifFalse:[ |
2217 |
eachClass allSuperclasses reverseDo:[:eachSuperClass | |
|
2218 |
(already includes:eachSuperClass) ifFalse:[ |
|
2219 |
already add:eachSuperClass. |
|
2220 |
aBlock value:eachSuperClass. |
|
2221 |
]. |
|
2222 |
]. |
|
2223 |
already add:eachClass. |
|
2224 |
aBlock value:eachClass. |
|
2225 |
] |
|
8964
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
2226 |
]. |
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
2227 |
|
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
2228 |
" |
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
2229 |
Smalltalk allClassesInOrderDo:[:aClass | Transcript showCR:aClass name] |
5406 | 2230 |
" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2231 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2232 |
|
9506 | 2233 |
allClassesInPackage:aPackageID |
2234 |
"evaluate the argument, aBlock for all classes a package; |
|
10087 | 2235 |
The order of the classes is not defined. |
2236 |
The returned collection may include private classes" |
|
9506 | 2237 |
|
2238 |
^ self allClassesForWhich:[:cls | cls package = aPackageID] |
|
2239 |
||
2240 |
" |
|
10071 | 2241 |
Smalltalk allClassesInPackage:'bosch:dapasx' |
9506 | 2242 |
" |
2243 |
||
2244 |
"Created: / 10-08-2006 / 12:14:10 / cg" |
|
10087 | 2245 |
"Modified: / 12-10-2006 / 23:48:43 / cg" |
9506 | 2246 |
! |
2247 |
||
9490 | 2248 |
allClassesInPackage:aPackageID do:aBlock |
2249 |
"evaluate the argument, aBlock for all classes a package; |
|
2250 |
The order of the classes is not defined." |
|
2251 |
||
2252 |
^ self allClassesForWhich:[:cls | cls package = aPackageID] do:aBlock |
|
2253 |
||
2254 |
" |
|
10071 | 2255 |
Smalltalk allClassesInPackage:'bosch:dapasx' do:[:aClass | Transcript showCR:aClass] |
9490 | 2256 |
" |
2257 |
||
2258 |
"Created: / 09-08-2006 / 17:14:17 / fm" |
|
2259 |
! |
|
2260 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2261 |
allKeysDo:aBlock |
20988 | 2262 |
<resource: #obsolete> |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2263 |
"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
|
2264 |
|
21265 | 2265 |
self obsoleteMethodWarning:'please use #keysDo:'. |
17385 | 2266 |
self keysDo:aBlock |
21265 | 2267 |
|
2268 |
"Modified: / 20-01-2017 / 17:52:40 / stefan" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2269 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2270 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2271 |
allMethodCategories |
12298 | 2272 |
"return a set of all method-categories (protocols) in the system" |
8583
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 |
|allCategories| |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2275 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2276 |
allCategories := Set new. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2277 |
Smalltalk allClassesDo:[:cls | |
22791 | 2278 |
allCategories addAll:cls methodCategories. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2279 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2280 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2281 |
^ allCategories. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2282 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2283 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2284 |
Smalltalk allMethodCategories |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2285 |
" |
21980 | 2286 |
|
2287 |
"Modified: / 05-07-2017 / 10:51:50 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2288 |
! |
6722
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
2289 |
|
9259 | 2290 |
allMethodsDo:aBlock |
12298 | 2291 |
"enumerate all methods in all classes" |
12000 | 2292 |
|
9259 | 2293 |
Smalltalk allClassesDo:[:eachClass | |
18668 | 2294 |
eachClass instAndClassSelectorsAndMethodsDo:[:sel :mthd | |
2295 |
aBlock value:mthd |
|
2296 |
] |
|
12298 | 2297 |
]. |
2298 |
! |
|
2299 |
||
14933 | 2300 |
allMethodsForWhich:aBlock |
2301 |
"return a collection of methods for which aBlock returns true" |
|
2302 |
||
2303 |
|coll| |
|
2304 |
||
2305 |
coll := OrderedCollection new. |
|
22015 | 2306 |
self allMethodsForWhich:aBlock do:[:mthd | coll add:mthd]. |
2307 |
^ coll |
|
2308 |
||
2309 |
" |
|
2310 |
Smalltalk allMethodsForWhich:[:m | m isObsolete]. |
|
2311 |
||
2312 |
Smalltalk allMethodsForWhich:#isObsolete. |
|
2313 |
" |
|
2314 |
||
2315 |
"Modified (comment): / 14-07-2017 / 10:52:54 / cg" |
|
2316 |
! |
|
2317 |
||
2318 |
allMethodsForWhich:aCheckBlock do:actionBlock |
|
2319 |
"enumerate methods for which aCheckBlock returns true" |
|
2320 |
||
14933 | 2321 |
Smalltalk allClassesDo:[:eachClass | |
22791 | 2322 |
eachClass instAndClassSelectorsAndMethodsDo:[:sel :mthd | |
2323 |
(aCheckBlock value:mthd) ifTrue:[ |
|
2324 |
actionBlock value:mthd |
|
2325 |
]. |
|
2326 |
] |
|
22015 | 2327 |
]. |
2328 |
||
2329 |
" |
|
2330 |
Smalltalk allMethodsForWhich:[:m | m isObsolete] do:[:m | Transcript showCR:m]. |
|
2331 |
||
2332 |
Smalltalk allMethodsForWhich:#isObsolete do:[:m | Transcript showCR:m]. |
|
2333 |
" |
|
2334 |
||
2335 |
"Created: / 14-07-2017 / 10:51:53 / cg" |
|
14933 | 2336 |
! |
2337 |
||
12300
e72e90ea410f
changed: #allMethodsWithSelectorDo:
Claus Gittinger <cg@exept.de>
parents:
12299
diff
changeset
|
2338 |
allMethodsWithSelectorDo:aTwoArgBlock |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2339 |
"enumerate all methods in all classes and evaluate aBlock |
12300
e72e90ea410f
changed: #allMethodsWithSelectorDo:
Claus Gittinger <cg@exept.de>
parents:
12299
diff
changeset
|
2340 |
with method and selector as arguments." |
12299
3ed13f5685b9
added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents:
12298
diff
changeset
|
2341 |
|
3ed13f5685b9
added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents:
12298
diff
changeset
|
2342 |
Smalltalk allClassesDo:[:eachClass | |
18668 | 2343 |
eachClass instAndClassSelectorsAndMethodsDo:[:sel :mthd | |
2344 |
aTwoArgBlock value:mthd value:sel |
|
2345 |
] |
|
12299
3ed13f5685b9
added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents:
12298
diff
changeset
|
2346 |
]. |
3ed13f5685b9
added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents:
12298
diff
changeset
|
2347 |
! |
3ed13f5685b9
added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents:
12298
diff
changeset
|
2348 |
|
7563 | 2349 |
associationsDo:aBlock |
10071 | 2350 |
"evaluate the argument, aBlock for all key/value pairs |
617 | 2351 |
in the Smalltalk dictionary" |
2352 |
||
2353 |
self keysDo:[:aKey | |
|
18668 | 2354 |
aBlock value:(aKey -> (self at:aKey)) |
617 | 2355 |
] |
2356 |
||
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
2357 |
"Smalltalk associationsDo:[:assoc | assoc printCR]" |
617 | 2358 |
! |
2359 |
||
7563 | 2360 |
basicKeys |
2361 |
"for rel > 5 only" |
|
2362 |
||
18349 | 2363 |
%{ |
2364 |
#ifdef __SCHTEAM__ |
|
18668 | 2365 |
STObject[] keys = STSmalltalkEnvironment.GetKeyVector(); |
18349 | 2366 |
return __c__._RETURN( new STVector(keys) ); |
2367 |
#endif |
|
2368 |
%}. |
|
7563 | 2369 |
self primitiveFailed |
2370 |
! |
|
2371 |
||
2372 |
do:aBlock |
|
2373 |
"evaluate the argument, aBlock for all values in the Smalltalk dictionary" |
|
617 | 2374 |
|
2375 |
|work| |
|
2376 |
||
2377 |
%{ /* 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
|
2378 |
__GLOBALS_DO(&aBlock, &work); |
5406 | 2379 |
RETURN (self); |
2380 |
%}. |
|
2381 |
self keysDo:[:aKey | |
|
18668 | 2382 |
aBlock value:(self at:aKey) |
5406 | 2383 |
] |
617 | 2384 |
! |
2385 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2386 |
keysAndValuesDo:aBlock |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2387 |
"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
|
2388 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2389 |
self keysDo:[:aKey | |
18668 | 2390 |
aBlock value:aKey value:(self at:aKey) |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2391 |
] |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2392 |
! |
617 | 2393 |
|
9077
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2394 |
keysAndValuesSelect:selectBlockWith2Args thenCollect:collectBlockWith2Args |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2395 |
|collected| |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2396 |
|
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2397 |
collected := OrderedCollection new. |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2398 |
self keysAndValuesDo:[:eachKey :eachValue | |
18668 | 2399 |
(selectBlockWith2Args value:eachKey value:eachValue) ifTrue:[ |
2400 |
collected add:(collectBlockWith2Args value:eachKey value:eachValue) |
|
2401 |
]. |
|
9077
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2402 |
]. |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2403 |
^ collected |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2404 |
|
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2405 |
" |
10071 | 2406 |
Smalltalk |
18668 | 2407 |
keysAndValuesSelect:[:nm :val | (nm startsWith:'Ab') and:[val notNil]] |
2408 |
thenCollect:[:nm :val | nm] |
|
9077
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2409 |
" |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2410 |
! |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2411 |
|
7563 | 2412 |
keysDo:aBlock |
2413 |
"evaluate the argument, aBlock for all keys in the Smalltalk dictionary" |
|
617 | 2414 |
|work| |
2415 |
||
2416 |
%{ /* 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
|
2417 |
__GLOBALKEYS_DO(&aBlock, &work); |
5406 | 2418 |
RETURN (self); |
2419 |
%}. |
|
2420 |
self basicKeys do:[:aKey | |
|
18668 | 2421 |
aBlock value:aKey |
5406 | 2422 |
] |
453 | 2423 |
! ! |
2424 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2425 |
!Smalltalk class methodsFor:'message control'! |
453 | 2426 |
|
7563 | 2427 |
silentLoading |
12408 | 2428 |
"returns the Silentloading class variable, which globally controls if compilation |
2429 |
messages are shown on the transcript during a fileIn." |
|
7563 | 2430 |
|
10355
b1cb807fd03c
Make sure, that #silentLoading does not return nil
Stefan Vogel <sv@exept.de>
parents:
10329
diff
changeset
|
2431 |
^ SilentLoading ? false |
7563 | 2432 |
! |
2433 |
||
2434 |
silentLoading:aBoolean |
|
2435 |
"{ Pragma: +optSpace }" |
|
2436 |
||
2437 |
"allows access to the Silentloading class variable, which controls |
|
12408 | 2438 |
messages (especially during fileIn) onto the transcript. |
453 | 2439 |
You can save a snapshot with this flag set to true, which makes |
2440 |
the image come up silent. Can also be set, to read in files unlogged." |
|
2441 |
||
2442 |
|prev| |
|
2443 |
||
2444 |
prev := SilentLoading. |
|
2445 |
SilentLoading := aBoolean. |
|
2446 |
^ prev |
|
12409 | 2447 |
! |
2448 |
||
2449 |
silentlyLoadingDo:aBlock |
|
2450 |
"evaluates aBlock with silent loading on - no compilation messages (except errors) |
|
2451 |
are shown on the transcript" |
|
2452 |
||
2453 |
|sav| |
|
2454 |
||
20719 | 2455 |
Smalltalk verbose ifTrue:[ |
22791 | 2456 |
^ aBlock value. |
2457 |
]. |
|
2458 |
||
12409 | 2459 |
sav := SilentLoading. |
2460 |
SilentLoading := true. |
|
22691 | 2461 |
^ aBlock ensure:[ SilentLoading := sav ]. |
2462 |
||
2463 |
"Modified: / 23-04-2018 / 16:56:40 / stefan" |
|
453 | 2464 |
! ! |
2465 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2466 |
!Smalltalk class methodsFor:'misc accessing'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2467 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2468 |
beHeadless:aBoolean |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2469 |
"set/clear the headlessOperation flag." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2470 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2471 |
HeadlessOperation := aBoolean |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2472 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2473 |
|
10231 | 2474 |
beSTScript:aBoolean |
2475 |
"set/clear the isSTScript flag." |
|
2476 |
||
2477 |
IsSTScript := aBoolean |
|
2478 |
||
2479 |
"Created: / 06-12-2006 / 16:43:36 / cg" |
|
2480 |
! |
|
2481 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2482 |
standAloneApp:aBoolean |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2483 |
"set/clear the StandAlone flag." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2484 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2485 |
StandAlone := aBoolean |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2486 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2487 |
|
18197 | 2488 |
|
12250 | 2489 |
!Smalltalk class methodsFor:'private-system management-packages'! |
2490 |
||
17324 | 2491 |
basicLoadPackage:aPackageString fromDirectory:packageDirOrStringOrNil asAutoloaded:doLoadAsAutoloaded |
2492 |
"load a package referenced by aPackageString - a string like 'stx:libbasic'. |
|
2493 |
The package is either located in packageDirOrStringOrNil, or in the current directory (if nil). |
|
2494 |
Answer true, if the load succeeded, false if it failed" |
|
2495 |
||
22791 | 2496 |
|packageDirOrNil binaryClassLibraryFilename projectDefinitionFilename |
19589 | 2497 |
projectDefinitionClass projectDefinitionClassName silent somethingHasBeenLoaded |
2498 |
loadOK errorInInitialize| |
|
17324 | 2499 |
|
2500 |
packageDirOrStringOrNil notNil ifTrue:[ |
|
22791 | 2501 |
packageDirOrNil := packageDirOrStringOrNil asFilename. |
2502 |
]. |
|
2503 |
silent := VerboseLoading not |
|
2504 |
and:[SilentLoading or:[StandAlone or:[InfoPrinting not]]]. |
|
17324 | 2505 |
|
2506 |
"For now: have to read the project definition first!! |
|
2507 |
The class library may contain subclasses of classes in prerequisite packages - |
|
19589 | 2508 |
so the prerequisite packages have to be loaded first. |
2509 |
Normally there is a project definiton, use that one to pull in the rest" |
|
17324 | 2510 |
|
2511 |
"maybe, it is already in the image" |
|
2512 |
projectDefinitionClass := ProjectDefinition definitionClassForPackage:aPackageString. |
|
19906 | 2513 |
projectDefinitionClass notNil ifTrue:[ |
22791 | 2514 |
projectDefinitionClass checkForLoad. |
17324 | 2515 |
]. |
2516 |
||
2517 |
"Is there a shared library (.dll or .so) ?" |
|
17439
1928276a394c
added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents:
17438
diff
changeset
|
2518 |
binaryClassLibraryFilename := ObjectFileLoader |
22791 | 2519 |
binaryClassFilenameForPackage:aPackageString |
2520 |
inDirectory:packageDirOrNil. |
|
17324 | 2521 |
|
2522 |
(binaryClassLibraryFilename notNil and:[binaryClassLibraryFilename exists]) ifTrue:[ |
|
22791 | 2523 |
|loadErrorOccurred| |
2524 |
||
2525 |
loadErrorOccurred := false. |
|
2526 |
ObjectFileLoader objectFileLoadErrorNotification handle:[:ex | |
|
2527 |
loadErrorOccurred := true. |
|
2528 |
ex proceedWith:true. |
|
2529 |
] do:[ |
|
2530 |
loadOK := (ObjectFileLoader loadObjectFile:binaryClassLibraryFilename) notNil. |
|
2531 |
"/ loadOK := self loadPackage:aPackageString fromClassLibrary:binaryClassLibraryFilename. |
|
2532 |
]. |
|
2533 |
(loadOK and:[loadErrorOccurred not]) ifTrue:[ |
|
2534 |
"now, all compiled classes have been loaded. |
|
2535 |
keep classes in the package which are autoloaded as autoloaded." |
|
2536 |
^ true |
|
2537 |
]. |
|
2538 |
||
2539 |
loadErrorOccurred ifTrue:[ |
|
2540 |
self breakPoint:#cg. |
|
2541 |
projectDefinitionClass := ProjectDefinition definitionClassForPackage:aPackageString. |
|
2542 |
projectDefinitionClass notNil ifTrue:[ |
|
2543 |
projectDefinitionClass |
|
2544 |
checkForLoad; |
|
2545 |
loadPreRequisitesAsAutoloaded:doLoadAsAutoloaded. |
|
2546 |
]. |
|
2547 |
]. |
|
17324 | 2548 |
]. |
2549 |
packageDirOrNil isNil ifTrue:[ |
|
22791 | 2550 |
^ PackageNotFoundError raiseRequestWith:aPackageString. |
17324 | 2551 |
]. |
2552 |
||
2553 |
"fallback - go through the project definition" |
|
2554 |
projectDefinitionClass isNil ifTrue:[ |
|
22791 | 2555 |
projectDefinitionClassName := ProjectDefinition projectDefinitionClassNameForDefinitionOf:aPackageString. |
2556 |
"/ try to load the project definition class |
|
2557 |
projectDefinitionFilename := (packageDirOrNil / projectDefinitionClassName) withSuffix:'st'. |
|
2558 |
projectDefinitionFilename exists ifFalse:[ |
|
2559 |
projectDefinitionFilename := (packageDirOrNil / 'source' / projectDefinitionClassName) withSuffix:'st'. |
|
2560 |
]. |
|
2561 |
projectDefinitionFilename exists ifTrue:[ |
|
2562 |
Class withoutUpdatingChangesDo:[ |
|
2563 |
Smalltalk silentlyLoadingDo:[ |
|
2564 |
Error handle:[:ex | |
|
2565 |
"/ catch error during initialization; |
|
2566 |
ex suspendedContext withAllSendersDo:[:sender | |
|
2567 |
(sender selector == #initialize |
|
2568 |
and:[sender receiver isBehavior |
|
2569 |
and:[sender receiver name = projectDefinitionClassName]] |
|
2570 |
) ifTrue:[ |
|
2571 |
errorInInitialize := true |
|
2572 |
]. |
|
2573 |
]. |
|
2574 |
errorInInitialize ifFalse:[ ex reject ]. |
|
2575 |
] do:[ |
|
2576 |
projectDefinitionFilename fileIn. |
|
2577 |
]. |
|
2578 |
]. |
|
2579 |
]. |
|
2580 |
errorInInitialize ifTrue:[ |
|
2581 |
Transcript showCR:'Smalltalk [warning]: an error happened in #initialize - retry after loading package.'. |
|
2582 |
]. |
|
2583 |
projectDefinitionClass := ProjectDefinition definitionClassForPackage:aPackageString. |
|
2584 |
]. |
|
17324 | 2585 |
]. |
2586 |
projectDefinitionClass notNil ifTrue:[ |
|
22791 | 2587 |
projectDefinitionClass |
2588 |
autoload; |
|
2589 |
checkForLoad; |
|
2590 |
loadPreRequisitesAsAutoloaded:doLoadAsAutoloaded. |
|
2591 |
||
2592 |
somethingHasBeenLoaded := projectDefinitionClass loadAsAutoloaded:doLoadAsAutoloaded. |
|
2593 |
errorInInitialize ifTrue:[ |
|
2594 |
Transcript showCR:('Smalltalk [info]: retrying #initialize'). |
|
2595 |
projectDefinitionClass initialize. |
|
2596 |
]. |
|
2597 |
(silent not and:[somethingHasBeenLoaded]) ifTrue:[ |
|
2598 |
Transcript showCR:('Smalltalk [info]: loaded package: ' , aPackageString , ' from project definition'). |
|
2599 |
]. |
|
2600 |
^ true. |
|
17324 | 2601 |
]. |
2602 |
||
2603 |
"/ source files-file loading no longer supported |
|
2604 |
"/ however, allow for autoload-stub loaded |
|
2605 |
doLoadAsAutoloaded ifTrue:[ |
|
22791 | 2606 |
self |
2607 |
recursiveInstallAutoloadedClassesFrom:packageDirOrNil |
|
2608 |
rememberIn:Set new |
|
2609 |
maxLevels:2 |
|
2610 |
noAutoload:false |
|
2611 |
packageTop:packageDirOrNil |
|
2612 |
showSplashInLevels:0. |
|
2613 |
^ true |
|
17324 | 2614 |
]. |
2615 |
||
2616 |
^ PackageNotFoundError raiseRequestWith:aPackageString errorString:' - no projectDef, dll or loadAll found'. |
|
2617 |
||
2618 |
" |
|
2619 |
Smalltalk loadPackageWithId:'stx:libbasic' |
|
2620 |
Smalltalk loadPackageWithId:'stx:goodies/persistency' |
|
2621 |
Smalltalk loadPackageWithId:'exept:ctypes' |
|
2622 |
" |
|
2623 |
||
2624 |
"Modified: / 29-07-2011 / 19:55:35 / cg" |
|
2625 |
! |
|
2626 |
||
12250 | 2627 |
loadExtensionsForPackage:aPackageId |
13415 | 2628 |
| extensionsLoaded | |
13621
85297bc6cfa8
comment/format in: #loadExtensionsForPackage:
Claus Gittinger <cg@exept.de>
parents:
13602
diff
changeset
|
2629 |
|
13415 | 2630 |
extensionsLoaded := false. |
18924 | 2631 |
ProgrammingLanguage allDo:[:programmingLanguage| |
22791 | 2632 |
"/ evaluating or here - want all extensions to be loaded |
2633 |
extensionsLoaded := extensionsLoaded | (self loadExtensionsForPackage:aPackageId language: programmingLanguage) |
|
13621
85297bc6cfa8
comment/format in: #loadExtensionsForPackage:
Claus Gittinger <cg@exept.de>
parents:
13602
diff
changeset
|
2634 |
]. |
85297bc6cfa8
comment/format in: #loadExtensionsForPackage:
Claus Gittinger <cg@exept.de>
parents:
13602
diff
changeset
|
2635 |
^ extensionsLoaded |
13415 | 2636 |
|
2637 |
"Modified: / 18-02-2007 / 11:03:26 / cg" |
|
2638 |
"Modified: / 02-01-2010 / 10:43:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13621
85297bc6cfa8
comment/format in: #loadExtensionsForPackage:
Claus Gittinger <cg@exept.de>
parents:
13602
diff
changeset
|
2639 |
"Modified (format): / 04-09-2011 / 09:19:24 / cg" |
13415 | 2640 |
! |
2641 |
||
18924 | 2642 |
loadExtensionsForPackage:aPackageId language: programmingLanguage |
13771 | 2643 |
|mgr packageDirName inStream projectDefinition extensionsFilename mod dir |
13621
85297bc6cfa8
comment/format in: #loadExtensionsForPackage:
Claus Gittinger <cg@exept.de>
parents:
13602
diff
changeset
|
2644 |
extensionsRevisionString extensionsRevisionInfo| |
12250 | 2645 |
|
18924 | 2646 |
programmingLanguage supportsExtensionMethods ifFalse:[^false]. |
13415 | 2647 |
|
12250 | 2648 |
packageDirName := aPackageId copyReplaceAll:$: with:$/. |
2649 |
packageDirName := self getPackageFileName:packageDirName. |
|
2650 |
||
2651 |
(packageDirName notNil and:[Class tryLocalSourceFirst]) ifTrue:[ |
|
22791 | 2652 |
(self loadExtensionsFromDirectory:packageDirName language: programmingLanguage) ifTrue:[ |
2653 |
^ true. |
|
2654 |
]. |
|
2655 |
packageDirName := nil. "do not try again" |
|
12250 | 2656 |
]. |
2657 |
||
2658 |
" |
|
2659 |
if there is a sourceCodeManager, ask it first for the extensions |
|
2660 |
" |
|
15958 | 2661 |
(Smalltalk at:#AbstractSourceCodeManager) notNil ifTrue:[ |
22791 | 2662 |
mgr := AbstractSourceCodeManager managerForPackage: aPackageId |
15958 | 2663 |
]. |
12250 | 2664 |
mgr notNil ifTrue:[ |
22791 | 2665 |
extensionsFilename := 'extensions.' , programmingLanguage sourceFileSuffix. |
2666 |
||
2667 |
projectDefinition := ProjectDefinition definitionClassForPackage:aPackageId. |
|
2668 |
projectDefinition notNil ifTrue:[ |
|
2669 |
mod := aPackageId asPackageId module. |
|
2670 |
dir := aPackageId asPackageId directory. |
|
2671 |
extensionsRevisionString := projectDefinition perform:(mgr nameOfVersionMethodForExtensions) ifNotUnderstood:nil. |
|
2672 |
extensionsRevisionString notNil ifTrue:[ |
|
2673 |
extensionsRevisionInfo := mgr revisionInfoFromString:extensionsRevisionString inClass:nil. |
|
2674 |
extensionsRevisionInfo notNil ifTrue:[ |
|
2675 |
extensionsRevisionInfo fileName = extensionsFilename ifFalse:[ |
|
2676 |
"JV@2011-10-23: following condition is never satisfied for |
|
2677 |
filed-in packages. The whole scheme of extensionVersion_XXX |
|
2678 |
works ONLY for compiled packages as it depends on fact, that |
|
2679 |
extension Init() routine is called AFTER all classes are inited, |
|
2680 |
therefore the extensionVersion_XXX methods from extensions.st |
|
2681 |
overwrites methods coming from package definition class. All this |
|
2682 |
is so tricky and error prone, that we have to come up with better |
|
2683 |
solution!!" |
|
2684 |
packageDirName notNil ifTrue:[ |
|
2685 |
^ self loadExtensionsFromDirectory:packageDirName language: programmingLanguage |
|
2686 |
] ifFalse:[ |
|
2687 |
^ false |
|
2688 |
] |
|
2689 |
] |
|
2690 |
] |
|
2691 |
]. |
|
2692 |
SourceCodeManagerError handle:[:ex | |
|
2693 |
] do:[ |
|
2694 |
inStream := mgr streamForExtensionFile:extensionsFilename package:aPackageId directory:dir module:mod cache:true. |
|
2695 |
]. |
|
2696 |
]. |
|
2697 |
inStream isNil ifTrue:[ |
|
2698 |
SourceCodeManagerError handle:[:ex | |
|
2699 |
] do:[ |
|
2700 |
inStream := mgr getMostRecentSourceStreamForFile:extensionsFilename inPackage:aPackageId. |
|
2701 |
]. |
|
2702 |
]. |
|
2703 |
inStream notNil ifTrue:[ |
|
2704 |
Class withoutUpdatingChangeSetDo:[ |
|
2705 |
inStream fileIn. |
|
2706 |
]. |
|
2707 |
inStream close. |
|
2708 |
VerboseLoading ifTrue:[ |
|
2709 |
Transcript showCR:('loaded extensions for ',aPackageId,' from repository'). |
|
2710 |
]. |
|
2711 |
^ true |
|
2712 |
] |
|
12250 | 2713 |
]. |
2714 |
||
2715 |
packageDirName notNil ifTrue:[ |
|
22791 | 2716 |
^ self loadExtensionsFromDirectory:packageDirName language: programmingLanguage |
12250 | 2717 |
]. |
2718 |
^ false |
|
2719 |
||
13415 | 2720 |
"Created: / 02-01-2010 / 10:41:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2721 |
"Modified: / 19-03-2011 / 10:03:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13814 | 2722 |
"Modified: / 04-11-2011 / 13:41:29 / cg" |
15958 | 2723 |
"Modified: / 23-10-2011 / 19:35:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
12250 | 2724 |
! |
2725 |
||
2726 |
loadExtensionsFromDirectory:packageDirOrString |
|
13415 | 2727 |
| extensionsLoaded | |
18924 | 2728 |
|
13415 | 2729 |
extensionsLoaded := false. |
18924 | 2730 |
ProgrammingLanguage allDo:[:programmingLanguage| |
22791 | 2731 |
"/ evaluating or here - want all extensions to be loaded |
2732 |
extensionsLoaded := extensionsLoaded | (self loadExtensionsFromDirectory: packageDirOrString language: programmingLanguage) |
|
18924 | 2733 |
]. |
2734 |
^ extensionsLoaded |
|
13415 | 2735 |
|
2736 |
"Modified: / 02-01-2010 / 10:40:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2737 |
! |
|
2738 |
||
2739 |
loadExtensionsFromDirectory:packageDirOrString language: language |
|
12250 | 2740 |
|packageDir f| |
2741 |
||
2742 |
packageDir := packageDirOrString asFilename. |
|
2743 |
||
13415 | 2744 |
f := packageDir / ('extensions.' , language sourceFileSuffix). |
12250 | 2745 |
f exists ifTrue:[ |
18668 | 2746 |
Class withoutUpdatingChangeSetDo:[ |
2747 |
f fileIn. |
|
2748 |
]. |
|
2749 |
VerboseLoading ifTrue:[ |
|
2750 |
Transcript showCR:('loaded extensions: ' , f pathName). |
|
2751 |
]. |
|
2752 |
^ true |
|
15958 | 2753 |
]. |
2754 |
^ true"/false |
|
13415 | 2755 |
|
2756 |
"Created: / 02-01-2010 / 10:38:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13814 | 2757 |
"Modified: / 04-11-2011 / 13:41:19 / cg" |
15958 | 2758 |
"Modified: / 31-01-2013 / 11:33:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
12250 | 2759 |
! |
2760 |
||
14589 | 2761 |
loadPackage:aPackageStringArg asAutoloaded:doLoadAsAutoloaded |
12782 | 2762 |
"make certain, that some particular package is loaded into the system. |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2763 |
Return true on success, false otherwise." |
12782 | 2764 |
|
14589 | 2765 |
|packageId packageString packageDir def sourceCodeManager| |
2766 |
||
17588 | 2767 |
packageString := aPackageStringArg. |
2768 |
||
2769 |
"/ a little convenience: so you can stx packages with loadPackage:'goodies/soap' |
|
2770 |
(packageString includes:$:) ifFalse:[ |
|
22791 | 2771 |
packageString := 'stx:',packageString. |
17588 | 2772 |
]. |
12782 | 2773 |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2774 |
"if I am here, so must my package" |
14892 | 2775 |
packageString = self package ifTrue:[^ true]. |
13129
0ac3f6a28aaf
changed: #loadPackage:asAutoloaded:
Claus Gittinger <cg@exept.de>
parents:
13120
diff
changeset
|
2776 |
|
17588 | 2777 |
packageId := aPackageStringArg asPackageId. |
2778 |
||
12782 | 2779 |
"/ if there is a projectDefinition, let it load itself... |
14589 | 2780 |
def := packageId projectDefinitionClass. |
14833 | 2781 |
(def notNil and:[def isLoaded]) ifTrue:[ |
22791 | 2782 |
def loadAsAutoloaded:doLoadAsAutoloaded. |
2783 |
^ true. |
|
14589 | 2784 |
]. |
2785 |
||
2786 |
packageDir := self packageDirectoryForPackageId:packageId. |
|
16144 | 2787 |
|
2788 |
[ |
|
22791 | 2789 |
self |
2790 |
loadPackage:packageString |
|
2791 |
fromDirectory:packageDir |
|
2792 |
asAutoloaded:doLoadAsAutoloaded. |
|
16144 | 2793 |
] on:PackageLoadError do:[:ex| |
22791 | 2794 |
ex creator ~~ PackageNotCompatibleError ifTrue:[ |
2795 |
AbstractSourceCodeManager notNil ifTrue:[ |
|
2796 |
sourceCodeManager := AbstractSourceCodeManager sourceCodeManagerForPackage:packageString. |
|
2797 |
sourceCodeManager notNil ifTrue:[ |
|
2798 |
PackageLoadError handle:[:ex2 | |
|
2799 |
ex reject |
|
2800 |
] do:[ |
|
2801 |
^ sourceCodeManager loadPackageWithId:packageString fromRepositoryAsAutoloaded:doLoadAsAutoloaded |
|
2802 |
]. |
|
2803 |
]. |
|
2804 |
]. |
|
2805 |
]. |
|
2806 |
ex reject. |
|
16144 | 2807 |
]. |
2808 |
||
2809 |
^ true |
|
12782 | 2810 |
|
2811 |
" |
|
2812 |
Smalltalk loadPackageWithId:'stx:libbasic' |
|
2813 |
Smalltalk loadPackageWithId:'stx:goodies/persistency' |
|
2814 |
Smalltalk loadPackageWithId:'exept:ctypes' |
|
2815 |
" |
|
2816 |
||
13129
0ac3f6a28aaf
changed: #loadPackage:asAutoloaded:
Claus Gittinger <cg@exept.de>
parents:
13120
diff
changeset
|
2817 |
"Modified: / 16-11-2010 / 17:42:49 / cg" |
12782 | 2818 |
! |
2819 |
||
12250 | 2820 |
loadPackage:packageId fromAllSourceFilesInDirectory:aDirectory |
2821 |
"load all source files found in aDirectory and treat them like |
|
2822 |
a package. Allows for initial import of alien ST-code as a new package. |
|
2823 |
Experimental." |
|
2824 |
||
2825 |
|p t new anyFail repeatCount| |
|
2826 |
||
2827 |
"/ problem: dependencies. |
|
2828 |
"/ solution: repeat twice, so that superclasses are present the second time |
|
2829 |
||
2830 |
Class packageQuerySignal answer:packageId asSymbol do:[ |
|
18668 | 2831 |
|any| |
2832 |
||
2833 |
repeatCount := 0. |
|
2834 |
[ |
|
2835 |
repeatCount := repeatCount + 1. |
|
2836 |
anyFail := false. |
|
2837 |
aDirectory directoryContents do:[:file | |
|
2838 |
|fn| |
|
2839 |
||
2840 |
fn := aDirectory / file. |
|
2841 |
(fn hasSuffix:'st') ifTrue:[ |
|
2842 |
Metaclass confirmationQuerySignal answer:false |
|
2843 |
do:[ |
|
2844 |
Error |
|
2845 |
handle:[:ex | |
|
2846 |
anyFail := true |
|
2847 |
] |
|
2848 |
do:[ |
|
2849 |
(self fileIn:fn) ifFalse:[ |
|
2850 |
anyFail := true |
|
2851 |
] ifTrue:[ |
|
2852 |
any := true. |
|
2853 |
] |
|
2854 |
] |
|
2855 |
] |
|
2856 |
] |
|
2857 |
]. |
|
2858 |
any ifFalse:[ |
|
2859 |
^ false "/ no file found |
|
2860 |
] |
|
2861 |
] doWhile:[anyFail and:[repeatCount<2]]. |
|
12250 | 2862 |
]. |
2863 |
||
2864 |
new := (p := Project projectWithId:packageId) isNil. |
|
2865 |
new ifTrue:[ p := Project new]. |
|
2866 |
||
2867 |
p name:packageId. |
|
2868 |
p directory:aDirectory. |
|
2869 |
p package:packageId. |
|
2870 |
t := packageId asCollectionOfSubstringsSeparatedByAny:'/\:'. |
|
2871 |
p repositoryModule:(t first). |
|
2872 |
p repositoryDirectory:(packageId copyFrom:t first size + 2). |
|
2873 |
p isLoaded:true. |
|
2874 |
||
2875 |
new ifTrue:[Project addLoadedProject:p]. |
|
16144 | 2876 |
anyFail ifTrue:[ |
18668 | 2877 |
^ PackageLoadError raiseRequestWith:packageId. |
16144 | 2878 |
]. |
2879 |
^ true |
|
12250 | 2880 |
! |
2881 |
||
2882 |
loadPackage:packageId fromClassLibrary:aFilename |
|
2883 |
"load a package from a compiled classLib. |
|
2884 |
Experimental." |
|
2885 |
||
2886 |
|p t new| |
|
2887 |
||
2888 |
(self fileIn:aFilename) ifFalse:[ |
|
18668 | 2889 |
(self fileInClassLibrary:aFilename) ifFalse:[ |
2890 |
^ false. |
|
2891 |
] |
|
12250 | 2892 |
]. |
2893 |
||
2894 |
new := (p := Project projectWithId:packageId) isNil. |
|
2895 |
new ifTrue:[ p := Project new]. |
|
2896 |
||
2897 |
p name:packageId. |
|
2898 |
p directory:aFilename directory. |
|
2899 |
p package:packageId. |
|
2900 |
t := packageId asCollectionOfSubstringsSeparatedByAny:'/\:'. |
|
2901 |
p repositoryModule:(t first). |
|
2902 |
p repositoryDirectory:(packageId copyFrom:t first size + 2). |
|
2903 |
p isLoaded:true. |
|
2904 |
||
2905 |
new ifTrue:[Project addLoadedProject:p]. |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2906 |
|
12250 | 2907 |
^ true |
2908 |
! |
|
2909 |
||
12782 | 2910 |
loadPackage:aPackageString fromDirectory:packageDirOrStringOrNil asAutoloaded:doLoadAsAutoloaded |
2911 |
"load a package referenced by aPackageString - a string like 'stx:libbasic'. |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2912 |
The package is either located in packageDirOrStringOrNil, or in the current directory (if nil). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2913 |
Answer true, if the load succeeded, false if it failed" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2914 |
|
17324 | 2915 |
|ret| |
2916 |
||
17439
1928276a394c
added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents:
17438
diff
changeset
|
2917 |
PackageLoadInProgressQuery |
18668 | 2918 |
answerNotifyLoading:aPackageString asSymbol |
2919 |
do:[ |
|
2920 |
ret := self basicLoadPackage:aPackageString fromDirectory:packageDirOrStringOrNil asAutoloaded:doLoadAsAutoloaded |
|
2921 |
]. |
|
17324 | 2922 |
^ ret |
17350 | 2923 |
|
2924 |
" |
|
2925 |
Smalltalk loadPackage:'stx:goodies/communication' |
|
2926 |
" |
|
12782 | 2927 |
! |
2928 |
||
12250 | 2929 |
loadPackage:packageId fromLoadAllFile:aFilename |
12782 | 2930 |
<resource: #obsolete> |
12250 | 2931 |
"load a package from a loadAll - loader script. |
2932 |
Experimental." |
|
2933 |
||
2934 |
|p t new| |
|
2935 |
||
2936 |
Metaclass confirmationQuerySignal answer:false |
|
2937 |
do:[ |
|
18668 | 2938 |
(self fileIn:aFilename) ifFalse:[ |
2939 |
self warn:'Failed to load the package ', packageId printString. |
|
2940 |
^ false. |
|
2941 |
] |
|
12250 | 2942 |
]. |
2943 |
||
2944 |
new := (p := Project projectWithId:packageId) isNil. |
|
2945 |
new ifTrue:[ p := Project new]. |
|
2946 |
||
2947 |
p name:packageId. |
|
2948 |
p directory:aFilename directory. |
|
2949 |
p package:packageId. |
|
2950 |
t := packageId asCollectionOfSubstringsSeparatedByAny:'/\:'. |
|
2951 |
p repositoryModule:(t first). |
|
2952 |
p repositoryDirectory:(packageId copyFrom:t first size + 2). |
|
2953 |
p isLoaded:true. |
|
2954 |
||
2955 |
new ifTrue:[Project addLoadedProject:p]. |
|
2956 |
^ true |
|
2957 |
! |
|
2958 |
||
2959 |
loadPackage:aPackageId fromZIPArchive:f asAutoloaded:doLoadAsAutoloaded |
|
2960 |
"load a package from a .zip delivery file. |
|
2961 |
Experimental." |
|
2962 |
||
19906 | 2963 |
PackageLoadError |
22791 | 2964 |
raiseWith:aPackageId |
2965 |
errorString:' - package loading from zip is not yet implemented'. |
|
12250 | 2966 |
! |
2967 |
||
2968 |
loadPackageFromAbbrevFile:aPackageId asAutoloaded:doLoadAsAutoloaded |
|
12782 | 2969 |
<resource: #obsolete> |
12250 | 2970 |
|abbrevFile packageDir| |
2971 |
||
2972 |
packageDir := self packageDirectoryForPackageId:aPackageId. |
|
2973 |
packageDir isNil ifTrue:[^ false]. |
|
2974 |
||
2975 |
"/ abbrev.stc ? |
|
12377 | 2976 |
abbrevFile := packageDir / 'abbrev.stc'. |
12250 | 2977 |
abbrevFile exists ifFalse:[^ false]. |
2978 |
||
2979 |
Smalltalk installAutoloadedClassesFrom:abbrevFile pathName. |
|
2980 |
||
2981 |
doLoadAsAutoloaded ifFalse:[ |
|
18668 | 2982 |
"/ force autoloading... |
2983 |
Smalltalk allClassesInPackage:aPackageId do:[:eachClass | eachClass autoload]. |
|
12250 | 2984 |
]. |
2985 |
||
2986 |
self loadExtensionsFromDirectory:packageDir. |
|
13814 | 2987 |
VerboseLoading ifTrue:[ |
18668 | 2988 |
Transcript showCR:('Smalltalk [info]: loaded package: ' , aPackageId , ' from abbrev file: ' , abbrevFile pathName). |
12250 | 2989 |
]. |
2990 |
^ true |
|
2991 |
||
13814 | 2992 |
"Modified: / 04-11-2011 / 13:43:29 / cg" |
12250 | 2993 |
! ! |
2994 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2995 |
!Smalltalk class methodsFor:'queries'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2996 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2997 |
allClasses |
7563 | 2998 |
"return an unordered collection of all classes in the system. |
10071 | 2999 |
Only globally anchored classes are returned |
21489 | 3000 |
(i.e. anonymous ones have to be acquired by Behavior allSubInstances). |
3001 |
Enumerates non-meta classes only - not metaclasses" |
|
453 | 3002 |
|
3003 |
|classes| |
|
3004 |
||
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
3005 |
"/ you may wonder, what this while is for, here ... |
453 | 3006 |
"/ the reason is that if we modify the class hierarchy in |
4067 | 3007 |
"/ another view (background fileIn), while building up the |
453 | 3008 |
"/ cachedClasses set, this may be flushed (invalidated) by the |
3009 |
"/ other process in the meanwhile. |
|
3010 |
"/ If that happens, we restart the set-building here |
|
3011 |
"/ |
|
3012 |
[(classes := CachedClasses) isNil] whileTrue:[ |
|
22791 | 3013 |
CachedClasses := classes := IdentitySet new:NumberOfClassesHint. |
3014 |
self keysAndValuesDo:[:eachName :eachGlobal | |
|
3015 |
(eachGlobal notNil and:[eachGlobal isBehavior]) ifTrue:[ |
|
3016 |
"/ sigh - would like to skip over aliases |
|
3017 |
"/ but this cannot be done simply by comparing |
|
3018 |
"/ the classes name against the store-key |
|
3019 |
"/ i.e. cannot do: |
|
3020 |
"/ anObject name == sym ifTrue:[ |
|
3021 |
"/ classes add:anObject |
|
3022 |
"/ ] |
|
3023 |
"/ because that would lead to ignore all java |
|
3024 |
"/ classes, which are stored under a different |
|
3025 |
"/ key. |
|
3026 |
||
3027 |
(eachGlobal name == eachName |
|
3028 |
or:[eachGlobal isJavaClass]) ifTrue:[ |
|
3029 |
classes add:eachGlobal |
|
3030 |
]. |
|
3031 |
] |
|
3032 |
]. |
|
3033 |
NumberOfClassesHint := classes size. |
|
453 | 3034 |
]. |
3035 |
^ classes |
|
3036 |
||
8964
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
3037 |
" |
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
3038 |
CachedClasses := nil. |
453 | 3039 |
Smalltalk allClasses |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
3040 |
|
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
3041 |
to get the list sorted by name: |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
3042 |
|
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
3043 |
Smalltalk allClasses asSortedCollection:[:a :b | a name < b name] |
453 | 3044 |
" |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
3045 |
|
13851
5ab434e0a636
changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents:
13850
diff
changeset
|
3046 |
"Modified: / 06-12-2011 / 12:41:42 / cg" |
21489 | 3047 |
"Modified (comment): / 19-02-2017 / 12:38:42 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3048 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3049 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3050 |
allClassesAndMetaclasses |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3051 |
"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
|
3052 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3053 |
|classes| |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3054 |
|
8964
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
3055 |
classes := IdentitySet new:NumberOfClassesHint*2. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3056 |
self allClassesDo:[:eachClass | |
18668 | 3057 |
classes add:(eachClass theNonMetaclass). |
3058 |
classes add:(eachClass theMetaclass). |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3059 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3060 |
^ classes |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3061 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3062 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3063 |
allClassesWithAllPrivateClasses |
7563 | 3064 |
"return an unordered collection of all classes in the Smalltalk namespace. |
10173
765b385fd1b8
changed #listAtCategoryNamed:
Claus Gittinger <cg@exept.de>
parents:
10169
diff
changeset
|
3065 |
Only globally anchored classes are returned; Namespaces are not included. |
20122 | 3066 |
(i.e. anonymous ones have to be acquired by Behavior allSubInstances)" |
4642 | 3067 |
|
10071 | 3068 |
^ self allClasses select:[:aClass | |
22791 | 3069 |
|owner| |
3070 |
||
3071 |
(aClass isRealNameSpace not) |
|
3072 |
and:[ |
|
3073 |
owner := aClass topOwningClass. |
|
3074 |
(owner ? aClass) nameSpace == Smalltalk |
|
3075 |
] |
|
4642 | 3076 |
] |
3077 |
||
3078 |
" |
|
3079 |
Smalltalk allClassesWithAllPrivateClasses |
|
3080 |
" |
|
10173
765b385fd1b8
changed #listAtCategoryNamed:
Claus Gittinger <cg@exept.de>
parents:
10169
diff
changeset
|
3081 |
|
765b385fd1b8
changed #listAtCategoryNamed:
Claus Gittinger <cg@exept.de>
parents:
10169
diff
changeset
|
3082 |
"Modified: / 10-11-2006 / 17:24:00 / cg" |
4642 | 3083 |
! |
3084 |
||
15068 | 3085 |
allExtensions |
3086 |
"return a collection of all extension methods (methods added from another package)" |
|
3087 |
||
3088 |
|methods| |
|
3089 |
||
3090 |
methods := OrderedCollection new. |
|
3091 |
self allClassesDo:[:eachClass | |
|
18668 | 3092 |
|classPackage| |
3093 |
||
3094 |
classPackage := eachClass package. |
|
3095 |
eachClass instAndClassMethodsDo:[:mthd | |
|
3096 |
mthd package ~= classPackage ifTrue:[ methods add:mthd ]. |
|
3097 |
]. |
|
15068 | 3098 |
]. |
3099 |
^ methods |
|
3100 |
||
3101 |
" |
|
3102 |
Smalltalk allExtensions |
|
3103 |
" |
|
3104 |
! |
|
3105 |
||
11153 | 3106 |
allExtensionsForPackage:aProjectID |
14890 | 3107 |
"return a collection of all extension methods for a given projectID" |
3108 |
||
11153 | 3109 |
|methods| |
3110 |
||
3111 |
methods := OrderedCollection new. |
|
3112 |
self allClassesDo:[:eachClass | |
|
18668 | 3113 |
methods addAll:(eachClass extensionsFrom:aProjectID). |
11153 | 3114 |
]. |
3115 |
^ methods |
|
3116 |
! |
|
3117 |
||
9227 | 3118 |
allImplementorsOf:aSelector |
12919
a7ea070197c9
comment/format in: #allImplementorsOf:
Claus Gittinger <cg@exept.de>
parents:
12911
diff
changeset
|
3119 |
"return a collection of classes which implement the given selector" |
a7ea070197c9
comment/format in: #allImplementorsOf:
Claus Gittinger <cg@exept.de>
parents:
12911
diff
changeset
|
3120 |
|
9227 | 3121 |
|implementors| |
3122 |
||
3123 |
implementors := OrderedCollection new. |
|
19681 | 3124 |
self allImplementorsOf:aSelector do:[:cls | implementors add:cls]. |
3125 |
^ implementors |
|
3126 |
||
3127 |
" |
|
22791 | 3128 |
Smalltalk allImplementorsOf:#isNil |
3129 |
(Smalltalk allImplementorsOf:#add:) size |
|
19681 | 3130 |
" |
3131 |
||
3132 |
"Modified: / 30-04-2016 / 17:37:39 / cg" |
|
3133 |
! |
|
3134 |
||
3135 |
allImplementorsOf:aSelector do:aBlock |
|
3136 |
"enumerate all classes which implement the given selector" |
|
3137 |
||
9227 | 3138 |
self allClassesDo:[:cls | |
22791 | 3139 |
(cls includesSelector:aSelector) ifTrue:[ |
3140 |
aBlock value:cls. |
|
3141 |
]. |
|
3142 |
(cls class includesSelector:aSelector) ifTrue:[ |
|
3143 |
aBlock value:cls class. |
|
3144 |
]. |
|
19681 | 3145 |
]. |
3146 |
||
3147 |
" |
|
3148 |
Smalltalk allImplementorsOf:#isNil do:[:cls | Transcript showCR:cls] |
|
3149 |
Smalltalk allImplementorsOf:#add: do:[:cls | Transcript showCR:cls] |
|
3150 |
" |
|
3151 |
||
3152 |
"Created: / 30-04-2016 / 17:36:45 / cg" |
|
9227 | 3153 |
! |
3154 |
||
19475 | 3155 |
allLoadedPackageIDs |
3156 |
||
3157 |
^ self allPackageIdsIncludingUnloadedClasses: false |
|
3158 |
||
3159 |
||
3160 |
" |
|
3161 |
Smalltalk allLoadedPackageIDs |
|
3162 |
" |
|
3163 |
! |
|
3164 |
||
12376 | 3165 |
allLoadedProjectIDs |
19475 | 3166 |
<resource: #obsolete> |
3167 |
self obsoleteMethodWarning:'use allLoadedPackageIDs'. |
|
3168 |
^ self allPackageIdsIncludingUnloadedClasses: false |
|
12376 | 3169 |
|
3170 |
||
3171 |
" |
|
3172 |
Smalltalk allLoadedProjectIDs |
|
3173 |
" |
|
3174 |
! |
|
3175 |
||
19475 | 3176 |
allPackageIDs |
3177 |
||
3178 |
^ self allPackageIdsIncludingUnloadedClasses: true |
|
3179 |
||
3180 |
" |
|
3181 |
Smalltalk allPackageIDs |
|
3182 |
" |
|
3183 |
! |
|
3184 |
||
3185 |
allPackageIdsIncludingUnloadedClasses: includeUnloadedClasses |
|
3186 |
"Returns all package ids. |
|
3187 |
Excludes packages coming from unloaded classes if includeUnloadedClasses is false. |
|
3188 |
" |
|
3189 |
||
3190 |
|allProjects| |
|
3191 |
||
3192 |
allProjects := Set new. |
|
3193 |
self allClassesDo:[:eachClass | |
|
22791 | 3194 |
|cls pkg| |
3195 |
||
3196 |
eachClass isRealNameSpace ifFalse:[ |
|
3197 |
(includeUnloadedClasses or:[eachClass isLoaded]) ifTrue:[ |
|
3198 |
cls := eachClass theNonMetaclass. |
|
3199 |
cls isPrivate ifTrue:[ |
|
3200 |
cls := cls topOwningClass |
|
3201 |
]. |
|
3202 |
pkg := cls package. |
|
3203 |
pkg size > 0 ifTrue:[ |
|
3204 |
allProjects add:pkg. |
|
3205 |
] ifFalse:[ |
|
3206 |
"/ for now, nameSpaces are not in any package; |
|
3207 |
"/ this might change. Then, 0-sized packages are |
|
3208 |
"/ illegal, and the following should be enabled. |
|
3209 |
"/ self halt |
|
3210 |
]. |
|
3211 |
cls isJavaClass ifFalse:[ |
|
3212 |
cls instAndClassSelectorsAndMethodsDo:[:sel :mthd | |
|
3213 |
allProjects add:mthd package asSymbol. |
|
3214 |
]. |
|
3215 |
]. |
|
3216 |
]. |
|
3217 |
]. |
|
19475 | 3218 |
]. |
3219 |
allProjects := allProjects asOrderedCollection sort. |
|
3220 |
^ allProjects |
|
3221 |
||
3222 |
" |
|
3223 |
Smalltalk allProjectsIdsIncludingUnloadedClasses: true |
|
3224 |
Smalltalk allProjectsIdsIncludingUnloadedClasses: false |
|
3225 |
" |
|
3226 |
! |
|
3227 |
||
9254 | 3228 |
allProjectIDs |
19475 | 3229 |
<resource: #obsolete> |
3230 |
self obsoleteMethodWarning:'use allPackageIDs'. |
|
3231 |
^ self allPackageIDs |
|
12376 | 3232 |
|
3233 |
" |
|
3234 |
Smalltalk allProjectIDs |
|
3235 |
" |
|
3236 |
! |
|
3237 |
||
3238 |
allProjectsIdsIncludingUnloadedClasses: includeUnloadedClasses |
|
19475 | 3239 |
<resource: #obsolete> |
12376 | 3240 |
"Returns all projects ids. |
3241 |
Excludes projects coming from unloaded classes if includeUnloadedClasses is false. |
|
3242 |
" |
|
3243 |
||
19475 | 3244 |
self obsoleteMethodWarning:'use allPackageIdsIncludingUnloadedClasses:'. |
3245 |
^ self allPackageIdsIncludingUnloadedClasses: includeUnloadedClasses |
|
9254 | 3246 |
|
3247 |
" |
|
12376 | 3248 |
Smalltalk allProjectsIdsIncludingUnloadedClasses: true |
3249 |
Smalltalk allProjectsIdsIncludingUnloadedClasses: false |
|
9254 | 3250 |
" |
3251 |
! |
|
3252 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3253 |
cellAt:aName |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3254 |
"{ Pragma: +optSpace }" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3255 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3256 |
"return the address of a global cell |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3257 |
- used internally for compiler only" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3258 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3259 |
%{ /* NOCONTEXT */ |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3260 |
RETURN ( __GLOBAL_GETCELL(aName) ); |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3261 |
%}. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3262 |
^ self primitiveFailed |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3263 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3264 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3265 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3266 |
classCategoryCompletion:aPartialCategory |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3267 |
"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
|
3268 |
2 entries: 1st: the best (longest) match |
18668 | 3269 |
2nd: collection consisting of matching categories" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3270 |
|
9508 | 3271 |
^ DoWhatIMeanSupport classCategoryCompletion:aPartialCategory inEnvironment:self |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3272 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3273 |
" |
10071 | 3274 |
Smalltalk classCategoryCompletion:'Sys' |
3275 |
Smalltalk classCategoryCompletion:'System' |
|
3276 |
Smalltalk classCategoryCompletion:'System-BinaryStorage' |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3277 |
" |
9508 | 3278 |
|
3279 |
"Modified: / 10-08-2006 / 13:06:34 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3280 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3281 |
|
8570 | 3282 |
classNamed:aString |
3283 |
"return the class with name aString, or nil if absent. |
|
3284 |
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
|
3285 |
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
|
3286 |
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
|
3287 |
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
|
3288 |
|
10127 | 3289 |
|cls sym nonMeta idx prefix rest namespace nsNameSymbol| |
9374
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3290 |
|
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3291 |
"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
|
3292 |
But be careful, to not invent new symbols ..." |
453 | 3293 |
sym := aString asSymbolIfInterned. |
22650 | 3294 |
sym isSymbol ifTrue:[ |
22791 | 3295 |
cls := self at:sym ifAbsent:nil. |
3296 |
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
|
3297 |
]. |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3298 |
|
1480
df0bea6285f8
Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
3299 |
(aString endsWith:' class') ifTrue:[ |
22791 | 3300 |
nonMeta := self classNamed:(aString copyButLast:6). |
3301 |
nonMeta notNil ifTrue:[ |
|
3302 |
^ nonMeta theMetaclass |
|
3303 |
]. |
|
3304 |
^ nil. |
|
13602
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3305 |
]. |
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3306 |
|
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3307 |
"no success yet. Try if this is a private class of an autoloaded class" |
9374
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3308 |
cls isNil ifTrue:[ |
22791 | 3309 |
idx := aString indexOfSubCollection:'::'. |
3310 |
idx ~~ 0 ifTrue:[ |
|
3311 |
prefix := aString copyTo:idx-1. |
|
3312 |
nsNameSymbol := prefix asSymbolIfInterned. |
|
3313 |
nsNameSymbol notNil ifTrue:[ |
|
3314 |
rest := aString copyFrom:idx+2. |
|
3315 |
namespace := self at:prefix asSymbolIfInterned ifAbsent:nil. |
|
3316 |
"namespace may be the owner of a private class. |
|
3317 |
NameSpaces and Behaviors have the same protocol" |
|
3318 |
[namespace isBehavior] whileTrue:[ |
|
3319 |
idx := rest indexOfSubCollection:'::'. |
|
3320 |
idx ~~ 0 ifTrue:[ |
|
3321 |
prefix := rest copyTo:idx-1. |
|
3322 |
rest := rest copyFrom:idx+2. |
|
3323 |
"this does an implicit autoload if required" |
|
3324 |
namespace := namespace privateClassesAt:prefix. |
|
3325 |
] ifFalse:[ |
|
3326 |
namespace isLoaded ifTrue:[ |
|
3327 |
cls := namespace privateClassesAt:rest. |
|
3328 |
cls isBehavior ifTrue:[^ cls]. |
|
3329 |
]. |
|
3330 |
namespace := nil. "force exit of loop" |
|
3331 |
]. |
|
3332 |
]. |
|
3333 |
]. |
|
3334 |
]. |
|
9374
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3335 |
]. |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3336 |
|
453 | 3337 |
^ nil |
3338 |
||
3339 |
" |
|
10071 | 3340 |
Smalltalk classNamed:'Object' |
3341 |
Smalltalk classNamed:'Authentication::BasicAuthenticator::BasicAuthenticationData' |
|
3342 |
Smalltalk classNamed:'Authentication::BasicAuthenticator::BasicAuthenticationData class' |
|
3343 |
Smalltalk classNamed:'Authentication::BasicAuthenticator' |
|
3344 |
Smalltalk classNamed:'fooBar' |
|
3345 |
Smalltalk classNamed:'true' |
|
3346 |
Smalltalk classNamed:'Object class' |
|
3347 |
Smalltalk classNamed:'Metaclass' |
|
3348 |
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
|
3349 |
Smalltalk classNamed:'Array class' |
453 | 3350 |
" |
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
3351 |
|
9468 | 3352 |
"Created: / 24-11-1995 / 17:30:22 / cg" |
3353 |
"Modified: / 19-06-1996 / 14:22:21 / stefan" |
|
10127 | 3354 |
"Modified: / 23-10-2006 / 18:06:53 / cg" |
13602
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3355 |
"Modified (comment): / 20-08-2011 / 16:43:07 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3356 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3357 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3358 |
classNames |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3359 |
"return a collection of all classNames in the system" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3360 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3361 |
^ self allClasses collect:[:aClass | aClass name] |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3362 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3363 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3364 |
Smalltalk classNames |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3365 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3366 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3367 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3368 |
classnameCompletion:aPartialClassName |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3369 |
"given a partial classname, return an array consisting of |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3370 |
2 entries: 1st: the best (longest) match |
18668 | 3371 |
2nd: collection consisting of matching names" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3372 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3373 |
^ DoWhatIMeanSupport classnameCompletion:aPartialClassName inEnvironment:self |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3374 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3375 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3376 |
classnameCompletion:aPartialClassName inEnvironment:anEnvironment |
7563 | 3377 |
"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
|
3378 |
2 entries: 1st: the best (longest) match |
18668 | 3379 |
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
|
3380 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3381 |
^ DoWhatIMeanSupport classnameCompletion:aPartialClassName inEnvironment:anEnvironment |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3382 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3383 |
" |
10071 | 3384 |
Smalltalk classnameCompletion:'Arr' |
3385 |
Smalltalk classnameCompletion:'Arra' |
|
3386 |
Smalltalk classnameCompletion:'arra' |
|
3387 |
Smalltalk classnameCompletion:'*rray' |
|
3388 |
||
3389 |
Smalltalk classnameCompletion:'Arr cl' |
|
3390 |
Smalltalk classnameCompletion:'*rray cl' |
|
453 | 3391 |
" |
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
3392 |
|
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
3393 |
"Created: 24.11.1995 / 17:24:45 / cg" |
2523
04db1fd74e0d
try ignoring case in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
2514
diff
changeset
|
3394 |
"Modified: 3.4.1997 / 18:25:01 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3395 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3396 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3397 |
defaultNameSpace |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3398 |
"return the default namespace, where new classes are installed, |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3399 |
if NO special nameSpace handler is present" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3400 |
|
9562
7d36dbb02bb3
code cleanup - remove old obsolete Project code
Claus Gittinger <cg@exept.de>
parents:
9550
diff
changeset
|
3401 |
^ Project defaultNameSpace. |
7d36dbb02bb3
code cleanup - remove old obsolete Project code
Claus Gittinger <cg@exept.de>
parents:
9550
diff
changeset
|
3402 |
|
7d36dbb02bb3
code cleanup - remove old obsolete Project code
Claus Gittinger <cg@exept.de>
parents:
9550
diff
changeset
|
3403 |
"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
|
3404 |
"Modified: / 17-08-2006 / 14:01:22 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3405 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3406 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3407 |
globalNameCompletion:aPartialGlobalName |
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3408 |
"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
|
3409 |
2 entries: 1st: the best (longest) match |
18668 | 3410 |
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
|
3411 |
|
12614
b8fca618dcb6
changed: #globalNameCompletion:
Claus Gittinger <cg@exept.de>
parents:
12613
diff
changeset
|
3412 |
^ DoWhatIMeanSupport globalNameCompletion:aPartialGlobalName inEnvironment:self match:true |
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3413 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3414 |
" |
10071 | 3415 |
Smalltalk globalnameCompletion:'Arr' |
3416 |
Smalltalk globalnameCompletion:'Arra' |
|
3417 |
Smalltalk globalnameCompletion:'arra' |
|
3418 |
Smalltalk globalnameCompletion:'*rray' |
|
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3419 |
" |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3420 |
|
9508 | 3421 |
"Created: / 24-11-1995 / 17:24:45 / cg" |
3422 |
"Modified: / 10-08-2006 / 13:05:39 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3423 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3424 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3425 |
globalnameCompletion:aPartialGlobalName |
7563 | 3426 |
"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
|
3427 |
2 entries: 1st: the best (longest) match |
18668 | 3428 |
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
|
3429 |
|
8358 | 3430 |
<resource:#obsolete> |
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3431 |
self obsoleteMethodWarning:'use #globalNameCompletion:'. |
9508 | 3432 |
^ 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
|
3433 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3434 |
" |
10071 | 3435 |
Smalltalk globalnameCompletion:'Arr' |
3436 |
Smalltalk globalnameCompletion:'Arra' |
|
3437 |
Smalltalk globalnameCompletion:'arra' |
|
3438 |
Smalltalk globalnameCompletion:'*rray' |
|
5736 | 3439 |
" |
3440 |
||
9508 | 3441 |
"Created: / 24-11-1995 / 17:24:45 / cg" |
3442 |
"Modified: / 10-08-2006 / 13:05:48 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3443 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3444 |
|
13771 | 3445 |
hasClassNamed:aString |
3446 |
Symbol |
|
18668 | 3447 |
hasInterned:aString |
3448 |
ifTrue:[:aSymbol | ^ (self at:aSymbol ifAbsent:[ nil ]) isClass ]. |
|
13602
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3449 |
^ false |
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3450 |
|
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3451 |
"Created: / 26-08-2009 / 11:43:03 / Jaroslav Havlin <havlij6@fel.cvut.cz>" |
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3452 |
"Modified: / 20-08-2011 / 16:41:31 / cg" |
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3453 |
! |
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3454 |
|
9290 | 3455 |
hasNameSpaces |
3456 |
"can be redefined by dummy namespaces/environments, to suppress |
|
3457 |
the namespace display in a browser (PocketSmalltalk)" |
|
3458 |
||
3459 |
^ true |
|
3460 |
! |
|
3461 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3462 |
hasNamespaces |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3463 |
"can be redefined by dummy namespaces/environments, to suppress |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3464 |
the namespace display in a browser (PocketSmalltalk)" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3465 |
|
9290 | 3466 |
<resource:#obsolete> |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3467 |
^ true |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3468 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3469 |
|
10432
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3470 |
hasSelectorNameSpaces |
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3471 |
"for now return false |
10999 | 3472 |
Selector namespaces are being implemented and supported by the VM, |
10432
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3473 |
but not yet fully supported by all tools... |
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3474 |
Therefore, for now, do not generate code which uses this feature." |
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3475 |
|
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3476 |
^ false |
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3477 |
|
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3478 |
"Created: / 05-03-2007 / 13:26:28 / cg" |
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3479 |
! |
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3480 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3481 |
includes:something |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3482 |
"this should come from Collection. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3483 |
will change the inheritance - Smalltalk is actually a collection" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3484 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3485 |
self do:[:element | element = something ifTrue:[^ true]]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3486 |
^ false |
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 |
|
14987 | 3489 |
includesIdentical:something |
3490 |
"this should come from Collection. |
|
3491 |
will change the inheritance - Smalltalk is actually a collection" |
|
3492 |
||
3493 |
self do:[:element | element == something ifTrue:[^ true]]. |
|
3494 |
^ false |
|
3495 |
! |
|
3496 |
||
10041
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
3497 |
isBrowserStartable |
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
3498 |
^ false. |
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
3499 |
|
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
3500 |
"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
|
3501 |
! |
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
3502 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3503 |
isNameSpace |
9227 | 3504 |
"return true, if the receiver is a nameSpace." |
3505 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3506 |
^ true |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3507 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3508 |
"Created: 11.10.1996 / 18:10:43 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3509 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3510 |
|
10169 | 3511 |
isRealNameSpace |
3512 |
"return true, if the receiver is a nameSpace, but not Smalltalk (which is also a class)." |
|
3513 |
||
3514 |
^ false |
|
3515 |
||
3516 |
"Created: / 10-11-2006 / 17:02:19 / cg" |
|
3517 |
! |
|
3518 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3519 |
isTopLevelNameSpace |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3520 |
^ true |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3521 |
! |
7563 | 3522 |
|
3523 |
isTopLevelNamespace |
|
3524 |
"obsolete - use isTopLevelNameSpace" |
|
5365 | 3525 |
|
7432 | 3526 |
<resource:#obsolete> |
3527 |
||
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3528 |
self obsoleteMethodWarning:'use #isTopLevelNameSpace'. |
4458 | 3529 |
^ true |
3530 |
||
3531 |
"Created: 11.10.1996 / 18:10:43 / cg" |
|
3532 |
! |
|
3533 |
||
9081 | 3534 |
keyIsClassVariableNameKey:aKey |
3535 |
|i| |
|
3536 |
||
3537 |
i := aKey lastIndexOf:$:. |
|
3538 |
i ~~ 0 ifTrue:[ |
|
18668 | 3539 |
i > 1 ifTrue:[ |
3540 |
(aKey at:(i-1)) == $: ifFalse:[ |
|
3541 |
^ true. |
|
3542 |
]. |
|
3543 |
]. |
|
9081 | 3544 |
]. |
3545 |
^ false. |
|
3546 |
||
3547 |
" |
|
10071 | 3548 |
self keyIsClassVariableNameKey:'foo::bar' |
3549 |
self keyIsClassVariableNameKey:'foo:bar' |
|
3550 |
self keyIsClassVariableNameKey:':bar' |
|
3551 |
self keyIsClassVariableNameKey:'::bar' |
|
9081 | 3552 |
" |
3553 |
! |
|
3554 |
||
9374
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3555 |
loadedClassNamed:aString |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3556 |
"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
|
3557 |
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
|
3558 |
|
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3559 |
|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
|
3560 |
|
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3561 |
"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
|
3562 |
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
|
3563 |
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
|
3564 |
sym notNil ifTrue:[ |
18668 | 3565 |
cls := self at:sym ifAbsent:nil. |
3566 |
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
|
3567 |
]. |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3568 |
|
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3569 |
(aString endsWith:' class') ifTrue:[ |
18668 | 3570 |
nonMeta := self loadedClassNamed:(aString copyButLast:6). |
3571 |
nonMeta notNil ifTrue:[ |
|
3572 |
^ nonMeta theMetaclass |
|
3573 |
]. |
|
9374
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3574 |
]. |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3575 |
^ nil |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3576 |
|
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3577 |
" |
10071 | 3578 |
Smalltalk loadedClassNamed:'Object' |
3579 |
Smalltalk loadedClassNamed:'Authentication::BasicAuthenticator::BasicAuthenticationData' |
|
3580 |
Smalltalk loadedClassNamed:'Authentication::BasicAuthenticator::BasicAuthenticationData class' |
|
3581 |
Smalltalk loadedClassNamed:'Authentication::BasicAuthenticator' |
|
3582 |
Smalltalk loadedClassNamed:'fooBar' |
|
3583 |
Smalltalk loadedClassNamed:'true' |
|
3584 |
Smalltalk loadedClassNamed:'Object class' |
|
3585 |
Smalltalk loadedClassNamed:'Metaclass' |
|
3586 |
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
|
3587 |
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
|
3588 |
" |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3589 |
! |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3590 |
|
7563 | 3591 |
methodProtocolCompletion:aPartialProtocolName |
3592 |
"given a partial method protocol name, return an array consisting of |
|
10071 | 3593 |
2 entries: 1st: the best (longest) match |
18668 | 3594 |
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
|
3595 |
|
9508 | 3596 |
^ DoWhatIMeanSupport methodProtocolCompletion:aPartialProtocolName inEnvironment:self |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3597 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3598 |
" |
10071 | 3599 |
Smalltalk methodProtocolCompletion:'doc' |
3600 |
Smalltalk methodProtocolCompletion:'docu' |
|
3601 |
Smalltalk methodProtocolCompletion:'documenta' |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3602 |
" |
9508 | 3603 |
|
3604 |
"Modified: / 10-08-2006 / 13:05:20 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3605 |
! |
5505
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
3606 |
|
7563 | 3607 |
numberOfGlobals |
3608 |
"return the number of global variables in the system" |
|
3609 |
||
3610 |
|tally "{ Class: SmallInteger }" | |
|
617 | 3611 |
|
3612 |
tally := 0. |
|
3613 |
self do:[:obj | tally := tally + 1]. |
|
3614 |
^ tally |
|
3615 |
||
3616 |
"Smalltalk numberOfGlobals" |
|
3617 |
! |
|
3618 |
||
7563 | 3619 |
referencesAny:aCollection |
3620 |
"redefined, since the references are only kept in the VM's symbol table" |
|
3260 | 3621 |
|
3622 |
self keysAndValuesDo:[:key :val | |
|
18668 | 3623 |
aCollection do:[:anObject | |
3624 |
(key == anObject) ifTrue:[^ true]. |
|
3625 |
(val == anObject ) ifTrue:[^ true]. |
|
3626 |
] |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3627 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3628 |
^ super referencesAny:aCollection |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3629 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3630 |
"Created: / 2.2.1998 / 16:01:20 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3631 |
! |
3260 | 3632 |
|
7563 | 3633 |
referencesDerivedInstanceOf:aClass |
3634 |
"redefined, since the references are only kept in the VM's symbol table" |
|
617 | 3635 |
|
3636 |
self keysAndValuesDo:[:key :val | |
|
18668 | 3637 |
(key isKindOf:aClass) ifTrue:[^ true]. |
3638 |
(val isKindOf:aClass) ifTrue:[^ true]. |
|
617 | 3639 |
]. |
3640 |
^ super referencesDerivedInstanceOf:aClass |
|
3641 |
! |
|
3642 |
||
7563 | 3643 |
referencesInstanceOf:aClass |
3644 |
"redefined, since the references are only kept in the VM's symbol table" |
|
617 | 3645 |
|
3646 |
self keysAndValuesDo:[:key :val | |
|
18668 | 3647 |
(key isMemberOf:aClass) ifTrue:[^ true]. |
3648 |
(val isMemberOf:aClass) ifTrue:[^ true]. |
|
617 | 3649 |
]. |
3650 |
^ super referencesInstanceOf:aClass |
|
3651 |
! |
|
3652 |
||
7563 | 3653 |
referencesObject:anObject |
3654 |
"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
|
3655 |
|
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
3656 |
self keysAndValuesDo:[:key :val | |
18668 | 3657 |
(key == anObject) ifTrue:[^ true]. |
3658 |
(val == anObject ) ifTrue:[^ true]. |
|
6074
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
3659 |
]. |
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
3660 |
^ super referencesObject:anObject |
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
3661 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3662 |
"Modified: / 3.2.1998 / 14:22:46 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3663 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3664 |
|
15766 | 3665 |
resolveName:aName inClass:aClass |
7563 | 3666 |
"resolve aName as if compiled within aClass; |
3026 | 3667 |
i.e. if it has a private class with this name, return it; |
3668 |
if aName is known within the classes namespace, return that. |
|
3669 |
Otherwise, return a global with that name. |
|
3670 |
This should be used whereever Smalltalk>>at: used to be used, |
|
3671 |
to resolve a global by name." |
|
3672 |
||
15766 | 3673 |
|nameUsed sym cls ns| |
3674 |
||
3675 |
aName isNil ifTrue:[^ nil]. |
|
3676 |
aName isBehavior ifTrue:[^ aName]. "/ already resolved |
|
3677 |
nameUsed := aName. |
|
3678 |
||
3679 |
(nameUsed startsWith:'Smalltalk::') ifTrue:[ |
|
18668 | 3680 |
nameUsed := nameUsed copyFrom:12. |
3681 |
^ self at:(nameUsed asSymbol) ifAbsent:nil. |
|
15766 | 3682 |
]. |
3683 |
||
3684 |
sym := nameUsed asSymbol. |
|
3026 | 3685 |
|
3686 |
cls := aClass privateClassesAt:sym. |
|
3687 |
cls notNil ifTrue:[^ cls]. |
|
3688 |
||
3689 |
ns := aClass nameSpace. |
|
3690 |
(ns notNil and:[ns ~~ Smalltalk]) ifTrue:[ |
|
18668 | 3691 |
ns isNameSpace ifTrue:[ |
3692 |
cls := ns at:sym ifAbsent:nil. |
|
3693 |
] ifFalse:[ |
|
3694 |
cls := ns privateClassesAt:sym |
|
3695 |
]. |
|
3696 |
cls notNil ifTrue:[^ cls]. |
|
3025 | 3697 |
]. |
3026 | 3698 |
^ self at:sym ifAbsent:nil. |
4356 | 3699 |
|
3700 |
"Modified: / 9.7.1999 / 01:18:07 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3701 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3702 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3703 |
selectorCompletion:aPartialSymbolName |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3704 |
"given a partial selector, return an array consisting of |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3705 |
2 entries: 1st: the longest match |
18668 | 3706 |
2nd: collection consisting of matching implemented selectors" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3707 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3708 |
^ DoWhatIMeanSupport selectorCompletion:aPartialSymbolName inEnvironment:self |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3709 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3710 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3711 |
selectorCompletion:aPartialSymbolName inEnvironment:anEnvironment |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3712 |
"given a partial selector, return an array consisting of |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3713 |
2 entries: 1st: the longest match |
18668 | 3714 |
2nd: collection consisting of matching implemented selectors" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3715 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3716 |
^ DoWhatIMeanSupport selectorCompletion:aPartialSymbolName inEnvironment:anEnvironment |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3717 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3718 |
" |
10071 | 3719 |
Smalltalk selectorCompletion:'at:p' |
3720 |
Smalltalk selectorCompletion:'nextP' |
|
3721 |
Smalltalk selectorCompletion:'nextp' |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3722 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3723 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3724 |
"Modified: / 7.6.1996 / 08:44:33 / stefan" |
3565
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
3725 |
"Modified: / 14.6.1998 / 15:54:03 / cg" |
19681 | 3726 |
! |
3727 |
||
3728 |
someImplementorOf:aSelector |
|
3729 |
"return any class, which implement the given selector. Nil if there is none. |
|
3730 |
(useful to search, if there is one at all)" |
|
3731 |
||
3732 |
self allImplementorsOf:aSelector do:[:cls | ^ cls]. |
|
3733 |
^ nil. |
|
3734 |
||
3735 |
" |
|
3736 |
Smalltalk someImplementorOf:#isNil |
|
3737 |
Smalltalk someImplementorOf:#add: |
|
3738 |
" |
|
3739 |
||
3740 |
"Created: / 30-04-2016 / 17:39:19 / cg" |
|
453 | 3741 |
! ! |
3742 |
||
4431 | 3743 |
!Smalltalk class methodsFor:'queries-system'! |
3744 |
||
15958 | 3745 |
isAmber |
15980 | 3746 |
"is this an Amber Smalltalk system ? |
3747 |
Return false here - this may be useful to write portable |
|
15958 | 3748 |
applications - add #isAmber to your Amber Smalltalk, |
3749 |
returning true there." |
|
3750 |
||
3751 |
^ false |
|
3752 |
||
3753 |
"Created: / 18-12-2013 / 15:43:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3754 |
! |
|
3755 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3756 |
isDolphinSmalltalk |
16803 | 3757 |
"is this a Dolphin Smalltalk system ? |
15980 | 3758 |
Return false here - this may be useful to write portable |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3759 |
applications - add #isDolphinSmalltalk to your dolphin, |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3760 |
returning true there." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3761 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3762 |
^ false |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3763 |
! |
4970 | 3764 |
|
15958 | 3765 |
isGemStone |
15980 | 3766 |
"is this a GemStone Smalltalk system ? |
3767 |
Return false here - this may be useful to write portable |
|
15958 | 3768 |
applications - add #isGemStone to your GemStone/S, |
3769 |
returning true there." |
|
3770 |
||
3771 |
^ false |
|
3772 |
||
3773 |
"Created: / 18-12-2013 / 15:43:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3774 |
! |
|
3775 |
||
3776 |
isPharo |
|
15980 | 3777 |
"is this a Pharo Smalltalk system ? |
3778 |
Return false here - this may be useful to write portable |
|
15958 | 3779 |
applications - add #isPharo to your Pharo, |
3780 |
returning true there." |
|
3781 |
||
3782 |
^ false |
|
3783 |
||
3784 |
"Created: / 18-12-2013 / 15:42:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3785 |
! |
|
3786 |
||
7563 | 3787 |
isSmalltalkMT |
15980 | 3788 |
"is this a Smalltalk-MT system ? |
3789 |
Return false here - this may be useful to write portable |
|
7563 | 3790 |
applications - add #isSmalltalkMT to your smalltalk-MT, |
4970 | 3791 |
returning true there." |
3792 |
||
3793 |
^ false |
|
3794 |
! |
|
3795 |
||
7563 | 3796 |
isSmalltalkV |
15980 | 3797 |
"is this a Smalltalk/V system ? |
3798 |
Return false here - this may be useful to write portable |
|
7563 | 3799 |
applications - add #isSmalltalkV to your smalltalkV, |
4431 | 3800 |
returning true there." |
3801 |
||
3802 |
^ false |
|
3803 |
! |
|
3804 |
||
7563 | 3805 |
isSmalltalkX |
16803 | 3806 |
"is this a Smalltalk/X system ? |
15980 | 3807 |
Return true here - this may be useful to write portable |
22799 | 3808 |
applications. |
3809 |
Add #isSmalltalkX to your other smalltalks, returning false there. |
|
3810 |
Notice: the ST/X compilers know about this, and inline the code |
|
3811 |
(not generating code for the false branch). |
|
3812 |
So in ST/X, this check costs you absolutely nothing." |
|
4431 | 3813 |
|
3814 |
^ true |
|
3815 |
! |
|
3816 |
||
7563 | 3817 |
isSqueak |
15980 | 3818 |
"is this a SqueakSmalltalk system ? |
3819 |
Return false here - this may be useful to write portable |
|
7563 | 3820 |
applications - add #isSqueak to your squeak, |
4431 | 3821 |
returning true there." |
3822 |
||
3823 |
^ false |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3824 |
! |
4431 | 3825 |
|
16013 | 3826 |
isSqueakLike |
3827 |
"is this a Squeak, Pharo, Cuis or similar Smalltalk system ? |
|
3828 |
Return false here - this may be useful to write portable |
|
3829 |
applications - add #isSqueakLike to your squeak, pharo,... |
|
3830 |
returning true there." |
|
3831 |
||
3832 |
^ false |
|
3833 |
! |
|
3834 |
||
7563 | 3835 |
isVisualAge |
15980 | 3836 |
"is this a VisualAge Smalltalk system ? |
3837 |
Return false here - this may be useful to write portable |
|
7563 | 3838 |
applications - add #isVisualAge to your visualAge, |
4431 | 3839 |
returning true there." |
3840 |
||
3841 |
^ false |
|
3842 |
! |
|
3843 |
||
17369 | 3844 |
isVisualSmalltalkEnterprise |
16843 | 3845 |
"is this a VSE Smalltalk system ? |
3846 |
Return false here - this may be useful to write portable |
|
3847 |
applications - add #isVisualSmallalkEnterprise to your VSE, |
|
3848 |
returning true there." |
|
3849 |
||
3850 |
^ false |
|
3851 |
! |
|
3852 |
||
7563 | 3853 |
isVisualWorks |
15980 | 3854 |
"is this a VisualWorks Smalltalk system ? |
3855 |
Return false here - this may be useful to write portable |
|
7563 | 3856 |
applications - add #isVisualWorks to your visualWorks, |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3857 |
returning true there." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3858 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3859 |
^ false |
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 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3862 |
!Smalltalk class methodsFor:'startup'! |
1 | 3863 |
|
9032 | 3864 |
browserWindowStartup |
13056
1fa92a4cd9cc
comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
3865 |
"invoked, when st/x is started as a plugin in a (currently firefox) browser. |
1fa92a4cd9cc
comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
3866 |
In contrast to squeak (where a single window is used to show the display bitmap), |
1fa92a4cd9cc
comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
3867 |
the browser window is used as a pseudo root-window for a single aplication window. |
1fa92a4cd9cc
comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
3868 |
If required, that app must ensure that multiple apps (if any) are setup as a |
1fa92a4cd9cc
comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
3869 |
multiwindow application. |
1fa92a4cd9cc
comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
3870 |
Actually, control is transferred to PluginSupport, which is suppoesed to know what to do" |
1fa92a4cd9cc
comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
3871 |
|
9032 | 3872 |
|windowIDString numericWindowID windowID params idx process| |
3873 |
||
3874 |
idx := CommandLineArguments indexOf:'--browserWindow:'. |
|
3875 |
windowIDString := CommandLineArguments at:idx+1. |
|
3876 |
numericWindowID := Integer fromString:windowIDString. |
|
3877 |
windowID := ExternalAddress newAddress:numericWindowID. |
|
3878 |
||
3879 |
idx := CommandLineArguments indexOf:'--browserParameters:'. |
|
3880 |
idx ~~ 0 ifTrue:[ |
|
18668 | 3881 |
params := Dictionary new. |
3882 |
(CommandLineArguments copyFrom:idx+1) pairWiseDo:[:key :value | |
|
3883 |
params at:key put:value. |
|
3884 |
]. |
|
9032 | 3885 |
]. |
3886 |
||
3887 |
'browserWindow is: ' errorPrint. windowID errorPrintCR. |
|
3888 |
'browserParameters are: ' errorPrint. params errorPrintCR. |
|
3889 |
'Display is: ' errorPrint. Display errorPrintCR. |
|
3890 |
||
3891 |
process := [ |
|
18668 | 3892 |
PluginSupport |
3893 |
startInBrowserWithWindowID:windowID |
|
3894 |
parameters:params. |
|
9032 | 3895 |
] newProcess. |
9043
e6106f500263
do not use numeric process prios
Claus Gittinger <cg@exept.de>
parents:
9036
diff
changeset
|
3896 |
process priority:(Processor userSchedulingPriority). |
9032 | 3897 |
process name:'browser start handler'. |
3898 |
process beGroupLeader. |
|
3899 |
process resume. |
|
3900 |
process := nil. |
|
3901 |
||
3902 |
Processor dispatchLoop. |
|
3903 |
Smalltalk exit. |
|
13056
1fa92a4cd9cc
comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
3904 |
|
1fa92a4cd9cc
comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
3905 |
"Modified: / 11-09-2010 / 14:06:59 / cg" |
9032 | 3906 |
! |
3907 |
||
20856 | 3908 |
defineCommandLineAsWorkspaceVariablesForScripts |
3909 |
"/ enable this, so we can provide _$1.._$n in the script |
|
20858 | 3910 |
ParserFlags allowUnderscoreInIdentifier:true. |
20856 | 3911 |
ParserFlags allowDollarInIdentifier:true. |
3912 |
ParserFlags warnDollarInIdentifier:false. |
|
20858 | 3913 |
ParserFlags warnUnderscoreInIdentifier:false. |
20859 | 3914 |
ParserFlags allowOldStyleAssignment:false. |
22791 | 3915 |
|
20856 | 3916 |
"/ add bindings for arguments |
3917 |
Workspace workspaceVariableAt:('_$0') put:CommandName. |
|
20857 | 3918 |
Workspace workspaceVariableAt:('_$n') put:CommandLineArguments size. |
20860 | 3919 |
Workspace workspaceVariableAt:('_$$') put:CommandLineArguments. |
20856 | 3920 |
CommandLineArguments doWithIndex:[:arg :i | |
22791 | 3921 |
Workspace workspaceVariableAt:('_$',i printString) put:arg. |
20856 | 3922 |
]. |
3923 |
! |
|
3924 |
||
7563 | 3925 |
displayInitializationDone |
3926 |
"inform the restart, that the display has been initialized" |
|
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3927 |
|
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3928 |
CallbackSignal raiseRequest. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3929 |
! |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3930 |
|
13893 | 3931 |
executeStartBlocks |
3932 |
|startBlocks| |
|
3933 |
||
3934 |
startBlocks := self startBlocks. |
|
3935 |
startBlocks notNil ifTrue:[ |
|
18668 | 3936 |
'Smalltalk [info]: execute startBlocks...' infoPrintCR. |
3937 |
startBlocks do:[:aBlock| |
|
3938 |
Error handle:[:ex | |
|
3939 |
InfoPrinting == true ifTrue:[ |
|
3940 |
'Smalltalk [warning]: error caught in startBlock: ' infoPrint. |
|
3941 |
ex description infoPrintCR. |
|
3942 |
ex infoPrintCR. |
|
3943 |
thisContext fullPrintAll. |
|
3944 |
]. |
|
3945 |
] do: aBlock |
|
3946 |
]. |
|
3947 |
startBlocks removeAll. |
|
13893 | 3948 |
]. |
3949 |
||
3950 |
"Created: / 07-01-2012 / 12:58:39 / cg" |
|
3951 |
! |
|
3952 |
||
11375 | 3953 |
hideSplashWindow |
3954 |
%{ |
|
3955 |
#ifdef WIN32 |
|
3956 |
extern void __win32_hideSplashScreen(); |
|
3957 |
||
3958 |
__win32_hideSplashScreen(); |
|
3959 |
#endif |
|
3960 |
%} |
|
3961 |
! |
|
3962 |
||
20720 | 3963 |
lateOpenDisplay |
20737 | 3964 |
"this is called when a view is opened without a display being already opened." |
22791 | 3965 |
|
22636 | 3966 |
|display| |
3967 |
||
3968 |
display := Smalltalk openDisplay. |
|
22791 | 3969 |
display notNil ifTrue:[ |
3970 |
IsRepl ifFalse:[ |
|
3971 |
display exitOnLastClose:true. |
|
3972 |
]. |
|
3973 |
"/ Processor exitWhenNoMoreUserProcesses:true. |
|
22636 | 3974 |
]. |
3975 |
^ display |
|
3976 |
||
3977 |
"Modified: / 20-03-2018 / 12:43:29 / stefan" |
|
20720 | 3978 |
! |
3979 |
||
7563 | 3980 |
mainStartup:graphicalMode |
3981 |
"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
|
3982 |
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
|
3983 |
|
9012 | 3984 |
|process imageName thisIsARestart idx| |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3985 |
|
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3986 |
imageName := ObjectMemory imageName. |
2249
cdb6c87f0707
send returnFromSnapshot notification later -
Claus Gittinger <cg@exept.de>
parents:
2212
diff
changeset
|
3987 |
thisIsARestart := imageName notNil. |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3988 |
|
19788 | 3989 |
true "graphicalMode" ifTrue:[ |
22791 | 3990 |
Display isNil ifTrue:[ |
3991 |
(StartupClass notNil |
|
3992 |
and:[ (StartupClass perform:#isHeadless ifNotUnderstood:false) ]) ifFalse:[ |
|
3993 |
self openDisplay. |
|
3994 |
]. |
|
3995 |
]. |
|
10644 | 3996 |
]. |
3997 |
||
10645 | 3998 |
StandAlone ifFalse:[ |
22791 | 3999 |
" |
4000 |
enable the graphical debugger/inspector |
|
4001 |
(they could have been (re)defined as autoloaded in the patches file) |
|
4002 |
" |
|
4003 |
self initStandardTools. |
|
10645 | 4004 |
]. |
4005 |
||
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
4006 |
" |
10071 | 4007 |
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
|
4008 |
" |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
4009 |
Display notNil ifTrue:[ |
22791 | 4010 |
Display deviceIOTimeoutErrorSignal handlerBlock:[:ex | |
4011 |
SaveEmergencyImage == true ifTrue:[ |
|
4012 |
'Display [warning]: broken display connection - emergency save in ''crash.img''.' infoPrintCR. |
|
4013 |
ObjectMemory primSnapShotOn:'crash.img'. |
|
4014 |
]. |
|
4015 |
'Display [warning]: broken display connection - exit.' infoPrintCR. |
|
4016 |
self exit:11. |
|
4017 |
]. |
|
4018 |
Display startDispatch. |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
4019 |
]. |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
4020 |
|
9016 | 4021 |
idx := CommandLineArguments indexOf:'--browserWindow:'. |
9029 | 4022 |
IsPlugin := (idx ~~ 0). |
4023 |
IsPlugin ifTrue:[ |
|
22791 | 4024 |
'Smalltalk [info]: startup browser window...' infoPrintCR. |
4025 |
self browserWindowStartup. |
|
4026 |
"/ not reached |
|
9012 | 4027 |
]. |
4028 |
||
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
4029 |
Initializing := false. |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
4030 |
|
2074
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
4031 |
"/ 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
|
4032 |
"/ 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
|
4033 |
"/ 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
|
4034 |
"/ 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
|
4035 |
|
7043
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
4036 |
process := [ |
22791 | 4037 |
'Smalltalk [info]: startup process 1 active.' infoPrintCR. |
4038 |
StartBlocks notNil ifTrue:[ |
|
4039 |
self executeStartBlocks. |
|
4040 |
StartBlocks := nil. |
|
4041 |
]. |
|
4042 |
ImageStartBlocks notNil ifTrue:[ |
|
4043 |
'Smalltalk [info]: execute imageStartBlocks...' infoPrintCR. |
|
4044 |
ImageStartBlocks do:[:aBlock| |
|
4045 |
aBlock value |
|
4046 |
]. |
|
4047 |
]. |
|
4048 |
StandAlone ifFalse:[ |
|
4049 |
(SilentLoading == true) ifFalse:[ "i.e. undefined counts as false" |
|
4050 |
thisIsARestart ifTrue:[ |
|
4051 |
Transcript cr. |
|
4052 |
Transcript showCR:('Smalltalk restarted from:' |
|
4053 |
, imageName |
|
4054 |
, ' (saved ' |
|
4055 |
, ObjectMemory imageSaveTime printString |
|
4056 |
, ')' ). |
|
4057 |
] ifFalse:[ |
|
4058 |
Transcript showCR:(self hello). |
|
4059 |
Transcript showCR:(self copyrightString). |
|
4060 |
]. |
|
4061 |
Transcript cr. |
|
4062 |
]. |
|
4063 |
||
4064 |
DemoMode==true ifTrue:[ |
|
4065 |
Transcript showCR:'*** Restricted use: ***'. |
|
4066 |
Transcript showCR:'*** This program may be used for education only. ***'. |
|
4067 |
Transcript showCR:'*** Please read the files COPYRIGHT and LICENSE ***'. |
|
4068 |
Transcript showCR:'*** for more details. ***'. |
|
4069 |
Transcript cr. |
|
4070 |
]. |
|
4071 |
]. |
|
4072 |
||
4073 |
thisIsARestart ifTrue:[ |
|
4074 |
"/ |
|
4075 |
"/ the final late notification - users can now assume that |
|
4076 |
"/ views, forms etc. have been recreated. |
|
4077 |
||
4078 |
ObjectMemory changed:#returnFromSnapshot. |
|
4079 |
] |
|
7039
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
4080 |
|
7040 | 4081 |
] newProcess. |
4082 |
||
9043
e6106f500263
do not use numeric process prios
Claus Gittinger <cg@exept.de>
parents:
9036
diff
changeset
|
4083 |
process priority:(Processor userSchedulingPriority). |
7043
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
4084 |
process name:'start block handler'. |
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
4085 |
process beGroupLeader. |
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
4086 |
process resume. |
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
4087 |
process := nil. |
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
4088 |
|
10139
a3f6265978ad
Start bachgroundCollector and -Finalizer in mainStartup
Stefan Vogel <sv@exept.de>
parents:
10131
diff
changeset
|
4089 |
ObjectMemory startBackgroundCollectorAt:5. |
a3f6265978ad
Start bachgroundCollector and -Finalizer in mainStartup
Stefan Vogel <sv@exept.de>
parents:
10131
diff
changeset
|
4090 |
ObjectMemory startBackgroundFinalizationAt:5. |
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
4091 |
|
2074
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
4092 |
"/ 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
|
4093 |
"/ message. |
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
4094 |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
4095 |
(StartupClass notNil and:[StartupSelector notNil]) ifTrue:[ |
22791 | 4096 |
" |
4097 |
allow more customization by reading an image specific rc-file |
|
4098 |
" |
|
4099 |
thisIsARestart ifTrue:[ |
|
4100 |
(imageName asFilename hasSuffix:'img') ifTrue:[ |
|
4101 |
imageName := imageName copyButLast:4 |
|
4102 |
]. |
|
4103 |
self fileIn:(imageName , '.rc') |
|
4104 |
]. |
|
4105 |
||
4106 |
Display notNil ifTrue:[ |
|
4107 |
Display exitOnLastClose:true. |
|
4108 |
]. |
|
4109 |
Processor exitWhenNoMoreUserProcesses:true. |
|
4110 |
||
4111 |
process := [ |
|
4112 |
'Smalltalk [info]: startup process 2 active.' infoPrintCR. |
|
4113 |
StandAlone ifTrue:[ |
|
4114 |
AbortOperationRequest handle:[:ex | |
|
4115 |
'Smalltalk [info]: aborted - exit.' infoPrintCR. |
|
4116 |
OperatingSystem exit:1 |
|
4117 |
] do:[ |
|
4118 |
('Smalltalk [info]: call ',StartupSelector,' of ',StartupClass name,' (1)') infoPrintCR. |
|
4119 |
StartupClass perform:StartupSelector withArguments:StartupArguments. |
|
4120 |
] |
|
4121 |
] ifFalse:[ |
|
4122 |
('Smalltalk [info]: call ',StartupSelector,' of ',StartupClass name,' (2)') infoPrintCR. |
|
4123 |
StartupClass perform:StartupSelector withArguments:StartupArguments. |
|
4124 |
]. |
|
4125 |
||
4126 |
"/ |
|
4127 |
"/ non-GUI apps exit after the startup; |
|
4128 |
"/ assume that GUI apps have created & opened some view ... |
|
4129 |
"/ |
|
4130 |
Display isNil ifTrue:[ |
|
4131 |
'Smalltalk [info]: no Display - exit.' infoPrintCR. |
|
4132 |
Smalltalk exit:11. |
|
4133 |
]. |
|
16666 | 4134 |
"/ "/ |
4135 |
"/ "/ GUI apps exit after the last user process has finished |
|
4136 |
"/ "/ |
|
4137 |
"/ Display exitOnLastClose:true. |
|
22791 | 4138 |
Processor exitWhenNoMoreUserProcesses:true. |
4139 |
] newProcess. |
|
4140 |
process priority:(Processor userSchedulingPriority). |
|
4141 |
process name:'main'. |
|
4142 |
process beGroupLeader. |
|
4143 |
process resume. |
|
4144 |
process := nil. "do not refer to process" |
|
11681
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4145 |
]. |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4146 |
|
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4147 |
StandAlone ifTrue:[ |
22791 | 4148 |
Display notNil ifTrue:[ |
4149 |
FlyByHelp notNil ifTrue:[ |
|
4150 |
FlyByHelp start |
|
4151 |
]. |
|
4152 |
]. |
|
16211 | 4153 |
]. |
4154 |
||
20746 | 4155 |
"/ Display notNil ifTrue:[ |
4156 |
"/ Display exitOnLastClose:true. |
|
4157 |
"/ ]. |
|
21592 | 4158 |
OperatingSystem finishLaunching. |
22791 | 4159 |
|
11681
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4160 |
" |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4161 |
if view-classes exist, start dispatching; |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4162 |
otherwise go into a read-eval-print loop |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4163 |
" |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4164 |
((Display notNil and:[graphicalMode]) |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4165 |
or:[process notNil |
13851
5ab434e0a636
changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents:
13850
diff
changeset
|
4166 |
or:[HeadlessOperation |
20827 | 4167 |
or:[StandAlone]]] |
4168 |
) ifTrue:[ |
|
22791 | 4169 |
Processor exitWhenNoMoreUserProcesses:true. |
4170 |
Processor dispatchLoop. |
|
4171 |
"done - the last process finished" |
|
4172 |
'Smalltalk [info]: last process finished - exit.' infoPrintCR. |
|
11681
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4173 |
] ifFalse:[ |
22791 | 4174 |
StandAlone ifFalse:[ |
4175 |
self readEvalPrintLoop |
|
4176 |
] |
|
11681
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4177 |
]. |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4178 |
|
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4179 |
self exit |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4180 |
|
13526 | 4181 |
"Created: / 18-07-1996 / 21:07:39 / cg" |
4182 |
"Modified: / 09-09-1996 / 17:42:50 / stefan" |
|
21592 | 4183 |
"Modified: / 28-02-2017 / 10:59:43 / cg" |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
4184 |
! |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
4185 |
|
10641 | 4186 |
openDisplay |
4187 |
"try to open a display connection. |
|
4188 |
If so, also read display- and keyboard.rc" |
|
4189 |
||
13385 | 4190 |
|commandName| |
4191 |
||
4192 |
commandName := Smalltalk commandName. |
|
4193 |
(commandName, ' [info]: opening display...') infoPrintCR. |
|
10649 | 4194 |
|
10641 | 4195 |
Display isNil ifTrue:[ |
22791 | 4196 |
Screen notNil ifTrue:[ |
4197 |
[ |
|
4198 |
Screen openDefaultDisplay:nil. |
|
4199 |
] on:Screen deviceOpenErrorSignal do:[:ex| |
|
4200 |
"do not use #errorPrintCR, it is no error, when an app supports display and no display. |
|
4201 |
in case shell exec 'app --version' we do not want this error string as part of the output" |
|
4202 |
('%1 [error]: No display connection to: %2' bindWith:commandName with:ex parameter) infoPrintCR. |
|
19984 | 4203 |
"/ ('%1 [error]: No display connection to: %2' bindWith:commandName with:ex parameter) errorPrintCR. |
22791 | 4204 |
(commandName, ' [info]: Either set the DISPLAY environment variable,') infoPrintCR. |
4205 |
(commandName, ' [info]: or start smalltalk with a -display argument.') infoPrintCR. |
|
4206 |
HeadlessOperation == true ifFalse:[ |
|
4207 |
OperatingSystem exit:1. |
|
4208 |
]. |
|
4209 |
]. |
|
4210 |
||
4211 |
Display notNil ifTrue:[ |
|
4212 |
(self secureFileIn:'display.rc') ifFalse:[ |
|
4213 |
"/ 'Smalltalk [warning]: no display.rc found; screen setting might be wrong.' errorPrintCR. |
|
4214 |
(self secureFileIn:'keyboard.rc') ifFalse:[ |
|
4215 |
"/ 'Smalltalk [warning]: no keyboard.rc found; shortkey setting might be wrong.' errorPrintCR. |
|
4216 |
] |
|
4217 |
] |
|
4218 |
]. |
|
4219 |
] |
|
22636 | 4220 |
]. |
4221 |
||
4222 |
^ Display |
|
10641 | 4223 |
|
4224 |
"Created: / 06-12-2006 / 15:38:17 / cg" |
|
22636 | 4225 |
"Modified: / 20-03-2018 / 12:39:55 / stefan" |
10641 | 4226 |
! |
4227 |
||
20757 | 4228 |
providingDisplayDo:aBlock |
4229 |
"/ provide a Display, if needed |
|
4230 |
(Smalltalk at:#Screen) currentScreenQuerySignal handle:[:ex | |
|
22791 | 4231 |
Display isNil ifTrue:[ self lateOpenDisplay ]. |
4232 |
ex proceedWith:Display. |
|
4233 |
] do:aBlock |
|
20757 | 4234 |
! |
4235 |
||
20832 | 4236 |
readEvalPrintLoop |
4237 |
"say hello, then go into a read-eval-print loop" |
|
22791 | 4238 |
|
10641 | 4239 |
"{ Pragma: +optSpace }" |
4240 |
||
22791 | 4241 |
|repl| |
4242 |
||
4243 |
repl := ReadEvalPrintLoop new. |
|
4244 |
||
4245 |
SilentLoading == true ifTrue:[ |
|
22792 | 4246 |
repl answerPrompt:''. |
4247 |
repl prompt:''. |
|
22791 | 4248 |
] ifFalse:[ |
22792 | 4249 |
Transcript showCR:(self hello). |
4250 |
Transcript showCR:(self copyrightString). |
|
4251 |
Transcript cr. |
|
22793 | 4252 |
Transcript showCR:'Read-eval-print loop.'. |
4253 |
Transcript showCR:'(exit with "#exit" or EOF; help with "?"; expressions are terminated with ".")'. |
|
22792 | 4254 |
repl prompt:'STX> '. |
22791 | 4255 |
]. |
4256 |
||
4257 |
repl |
|
22792 | 4258 |
doChunkFormat:false; |
22831 | 4259 |
errorStream:Stderr; |
22792 | 4260 |
readEvalPrintLoop |
10641 | 4261 |
! |
4262 |
||
4263 |
restart |
|
4264 |
"startup after an image has been loaded; |
|
18385 | 4265 |
This is called by the VM's main entry - you should not find senders from Smalltalk. |
4266 |
||
10641 | 4267 |
there are three change-notifications made to dependents of ObjectMemory, |
4268 |
which allow a stepwise re-init: #earlyRestart, #restarted and #returnFromSnapshot. |
|
4269 |
||
4270 |
#earlySystemInstallation is sent for ST80 compatibility |
|
4271 |
||
4272 |
#earlyRestart is send first, nothing has been setup yet. |
|
18668 | 4273 |
(should be used to flush all device dependent entries) |
10641 | 4274 |
|
4275 |
#restarted is send right after. |
|
18668 | 4276 |
(should be used to recreate external resources (fds, bitmaps etc) |
10641 | 4277 |
|
4278 |
#returnFromSnapshot is sent last |
|
18668 | 4279 |
(should be used to restart processes, reOpen Streams which cannot |
4280 |
be automatically be reopened (i.e. Sockets, Pipes) and so on. |
|
4281 |
(Notice that positionable fileStreams are already reopened and repositioned) |
|
10641 | 4282 |
" |
4283 |
||
4284 |
|deb insp transcript idx| |
|
4285 |
||
4286 |
"/ |
|
4287 |
"/ when we arrive here, all objects from our previous life |
|
4288 |
"/ have been reloaded - however, some may still contain invalid device |
|
4289 |
"/ handles, display information etc. |
|
4290 |
"/ also, dynamically loaded modules have not yet been reloaded yet. |
|
4291 |
"/ and the concrete OS, concrete FileName etc. are still refering to |
|
4292 |
"/ the previous classes. |
|
4293 |
||
4294 |
Initializing := true. |
|
4295 |
AbstractOperatingSystem initializeConcreteClass. |
|
4296 |
||
4297 |
ImageRestartTime := Timestamp now. |
|
4298 |
||
4299 |
CommandLine := CommandLineArguments copy. |
|
4300 |
CommandLineArguments := CommandLineArguments asOrderedCollection. |
|
4301 |
CommandName := CommandLineArguments removeFirst. "/ the command |
|
4302 |
||
4303 |
idx := CommandLineArguments indexOf:'-q'. |
|
4304 |
idx == 0 ifTrue:[ |
|
18668 | 4305 |
idx := CommandLineArguments indexOf:'--silent'. |
10641 | 4306 |
]. |
4307 |
idx ~~ 0 ifTrue:[ |
|
18668 | 4308 |
Object infoPrinting:false. |
4309 |
ObjectMemory infoPrinting:false. |
|
4310 |
CommandLineArguments removeAtIndex:idx. |
|
16269 | 4311 |
]. |
4312 |
||
10641 | 4313 |
"/ start catching SIGSEGV and SIGBUS |
4314 |
OperatingSystem enableHardSignalInterrupts. |
|
4315 |
||
4316 |
"/ reinit Filename |
|
4317 |
Filename reinitialize. |
|
4318 |
||
4319 |
"/ flush cached path directories (may have changed in the meanwhile) |
|
4320 |
self flushPathCaches. |
|
15334 | 4321 |
self reinitializePackagePath. |
10641 | 4322 |
|
4323 |
"/ reinit the default streams: Stdin, Stdout and Stderr |
|
4324 |
"/ after that, we can write to stderr. |
|
4325 |
self reinitStandardStreams. |
|
4326 |
||
4327 |
"/ redirect Transcript to Stderr during startup |
|
4328 |
transcript := Transcript. |
|
4329 |
Transcript := Stderr. |
|
4330 |
||
4331 |
"/ temporary switch back to dumb interface - |
|
4332 |
"/ to handle errors while view-stuff is not yet reinitialized |
|
4333 |
insp := Inspector. |
|
4334 |
deb := Debugger. |
|
4335 |
deb notNil ifTrue:[ |
|
18668 | 4336 |
deb reinitialize |
10641 | 4337 |
]. |
4338 |
Inspector := MiniInspector. |
|
4339 |
Debugger := MiniDebugger. |
|
4340 |
||
4341 |
"/ reload any dynamically loaded objects. |
|
4342 |
"/ this must be done before doing anything else below, |
|
4343 |
"/ because the Processor may restart processes which use |
|
4344 |
"/ this code. |
|
4345 |
"/ Also, a dynamic object might be registered as dependent of |
|
4346 |
"/ ObjectFileLoader; therefore, must reload before doing any notifications. |
|
4347 |
||
4348 |
ObjectFileLoader notNil ifTrue:[ |
|
18668 | 4349 |
ObjectFileLoader reloadAllRememberedObjectFiles. |
16269 | 4350 |
]. |
4351 |
||
10641 | 4352 |
"/ invalidate all display connections. |
4353 |
"/ This is required to avoid trouble if someone accesses |
|
4354 |
"/ a display during early startup. |
|
4355 |
Screen notNil ifTrue:[ |
|
18668 | 4356 |
Screen allScreens do:[:eachDisplay | |
4357 |
eachDisplay invalidateConnection. |
|
4358 |
]. |
|
10641 | 4359 |
]. |
4360 |
||
4361 |
ObjectMemory changed:#earlySystemInstallation. |
|
4362 |
||
4363 |
"/ reinitialize the Processor - restartable processes |
|
4364 |
"/ are now restarted here (but not yet scheduled). |
|
4365 |
Processor reinitialize. |
|
4366 |
||
4367 |
"/ flush device handles & recreate OS resources (if possible) |
|
4368 |
"/ (mostly view/GC/color & font stuff) |
|
4369 |
ObjectMemory |
|
18668 | 4370 |
changed:#earlyRestart; changed:#restarted. |
16269 | 4371 |
|
10641 | 4372 |
"/ start catching SIGINT and SIGQUIT |
4373 |
OperatingSystem enableUserInterrupts. |
|
4374 |
OperatingSystem enableCrashSignalInterrupts. |
|
12782 | 4375 |
ObjectMemory restoreGarbageCollectorSettings. |
10641 | 4376 |
|
4377 |
"/ give user a chance to re-customize things in smalltalk_r.rc. |
|
4378 |
"/ reading if smalltalk_r.rc may be suppressed by the --faststart argument. |
|
4379 |
idx := CommandLineArguments indexOf:'--faststart'. |
|
4380 |
idx == 0 ifTrue:[ |
|
18668 | 4381 |
idx := CommandLineArguments indexOf:'--fastStart'. |
10641 | 4382 |
]. |
4383 |
idx ~~ 0 ifTrue:[ |
|
18668 | 4384 |
CommandLineArguments removeAtIndex:idx. |
10641 | 4385 |
] ifFalse:[ |
18668 | 4386 |
CallbackSignal := QuerySignal new. |
4387 |
[ |
|
4388 |
Class withoutUpdatingChangesDo:[ |
|
4389 |
(self fileIn:(self commandName , '_r.rc')) ifFalse:[ |
|
4390 |
"no _r.rc file where executable is; try default smalltalk_r.rc" |
|
4391 |
self fileIn:'smalltalk_r.rc' |
|
4392 |
]. |
|
4393 |
] |
|
4394 |
] on:CallbackSignal do:[:ex| |
|
4395 |
"/ now, display and view-stuff works; |
|
4396 |
"/ back to the previous debugging interface |
|
4397 |
Inspector := insp. |
|
4398 |
Debugger := deb. |
|
4399 |
||
4400 |
"/ reinstall Transcript, if not changed during restart. |
|
4401 |
"/ if there was no Transcript, go to stderr |
|
4402 |
(transcript notNil and:[Transcript == Stderr]) ifTrue:[ |
|
4403 |
Transcript := transcript. |
|
4404 |
]. |
|
4405 |
Initializing := false. |
|
4406 |
ex proceed. |
|
4407 |
]. |
|
4408 |
CallbackSignal := nil. |
|
10641 | 4409 |
]. |
4410 |
||
4411 |
"/ reinitialization (restart) of Display is normally performed |
|
4412 |
"/ in the restart script. If this has not been run for some reason, |
|
4413 |
"/ do in now. |
|
4414 |
Initializing ifTrue:[ |
|
18668 | 4415 |
Display notNil ifTrue:[ |
4416 |
[ |
|
4417 |
Display reinitializeFor:Screen defaultDisplayName. |
|
4418 |
] on:Screen deviceOpenErrorSignal do:[ |
|
4419 |
'Smalltalk [error]: Cannot restart connection to: ' errorPrint. |
|
4420 |
Screen defaultDisplayName errorPrintCR. |
|
4421 |
OperatingSystem exit:1. |
|
4422 |
]. |
|
4423 |
]. |
|
4424 |
"/ now, display and view-stuff works; |
|
4425 |
"/ back to the previous debugging interface |
|
4426 |
||
4427 |
Inspector := insp. |
|
4428 |
Debugger := deb. |
|
4429 |
||
4430 |
"/ reinstall Transcript, if not changed during restart. |
|
4431 |
"/ if there was no Transcript, go to stderr |
|
4432 |
||
4433 |
(transcript notNil and:[Transcript == Stderr]) ifTrue:[ |
|
4434 |
Transcript := transcript. |
|
4435 |
]. |
|
4436 |
Initializing := false. |
|
10641 | 4437 |
]. |
4438 |
Screen notNil ifTrue:[ |
|
18668 | 4439 |
"clean up leftover screens (and views) that haven't been reopened. |
4440 |
Operate on a copy, since brokenConnection removes us from AllScreens" |
|
4441 |
Screen allScreens copy do:[:eachDisplay | |
|
4442 |
eachDisplay isOpen ifFalse:[ |
|
4443 |
'Smalltalk [info]: cannot reopen secondary display: ' errorPrint. |
|
4444 |
eachDisplay errorPrintCR. |
|
4445 |
eachDisplay cleanupAfterDispatch; brokenConnection. |
|
4446 |
] |
|
4447 |
]. |
|
10641 | 4448 |
]. |
4449 |
||
4450 |
deb := insp := transcript := nil. "avoid dangling refs" |
|
13526 | 4451 |
(StartupClass perform:#keepSplashWindowOpen ifNotUnderstood:[false]) ifFalse:[ |
18668 | 4452 |
self hideSplashWindow. "/ if there is one, it's now time to hide it |
13526 | 4453 |
]. |
10641 | 4454 |
self mainStartup:true |
4455 |
||
13526 | 4456 |
"Modified: / 03-08-1999 / 09:42:21 / stefan" |
4457 |
"Modified: / 29-07-2011 / 17:58:23 / cg" |
|
1 | 4458 |
! |
4459 |
||
11399 | 4460 |
showSplashMessage:aString |
4461 |
"put the message into the splash screen (if there is one). |
|
4462 |
Use this for messages during startup" |
|
4463 |
||
4464 |
self showSplashMessage:aString color:nil. |
|
4465 |
! |
|
4466 |
||
11388 | 4467 |
showSplashMessage:aMessageStringOrNil color:rgbValueOrNil |
11389 | 4468 |
"put the message into the splash screen (if there is one)." |
4469 |
||
11388 | 4470 |
%{ |
4471 |
#ifdef WIN32 |
|
4472 |
extern void __win32_splashMessage(); |
|
4473 |
char *msg = (char *)0; |
|
4474 |
int clr = 0; |
|
4475 |
||
12481
805176d238d2
change __isString() to __isStringLike() in primitive code
Stefan Vogel <sv@exept.de>
parents:
12413
diff
changeset
|
4476 |
if (__isStringLike(aMessageStringOrNil)) { |
18668 | 4477 |
msg = __stringVal(aMessageStringOrNil); |
11388 | 4478 |
} |
4479 |
if (__isSmallInteger(rgbValueOrNil)) { |
|
18668 | 4480 |
clr = __intVal(rgbValueOrNil); |
4481 |
__win32_splashMessageColor(clr); |
|
11388 | 4482 |
} |
4483 |
__win32_splashMessage(msg); |
|
4484 |
#endif |
|
4485 |
%} |
|
4486 |
! |
|
4487 |
||
4488 |
splashInfo:aString |
|
11389 | 4489 |
"like infoPrintCR, |
4490 |
but in addition put the message into the splash screen (if there is one). |
|
4491 |
Use this for info messages during startup" |
|
4492 |
||
12883 | 4493 |
aString notNil ifTrue:[ aString infoPrintCR ]. |
11388 | 4494 |
self showSplashMessage:aString color:nil. |
4495 |
! |
|
4496 |
||
7563 | 4497 |
start |
20831 | 4498 |
"low level entry from the VM's main. |
4499 |
After initializeSystem, this is the very first real entry into the Smalltalk world. |
|
22791 | 4500 |
Analyzes the command line and checks what to do |
20831 | 4501 |
(i.e. script/repl/eval or full blown IDE). |
4502 |
Also handles --load and various debug options. |
|
22791 | 4503 |
Caveat: |
4504 |
this has become too complicated and desperately needs a rewrite. |
|
21020 | 4505 |
|
4506 |
Also: |
|
22791 | 4507 |
Be very careful when changing things here; |
4508 |
especially be careful to ensure that the scripting options are robust against any |
|
4509 |
missing packages; so the error handlers should not depend on any stream, logger etc. features. |
|
21020 | 4510 |
" |
617 | 4511 |
|
15872 | 4512 |
|idx graphicalMode arg didReadRCFile keepSplashWindow| |
960
e3b75f50d0cd
changes for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
4513 |
|
19597 | 4514 |
graphicalMode := Smalltalk isSmalltalkDevelopmentSystem. |
617 | 4515 |
Initializing := true. |
4516 |
||
15872 | 4517 |
keepSplashWindow := StartupClass perform:#keepSplashWindowOpen ifNotUnderstood:[false]. |
13526 | 4518 |
|
21016 | 4519 |
idx := CommandLineArguments indexOf:'--debug'. |
4520 |
(idx ~~ 0) ifTrue:[ |
|
22791 | 4521 |
CommandLineArguments removeAtIndex:idx. |
4522 |
]. |
|
21016 | 4523 |
|
617 | 4524 |
" |
4525 |
while reading patches- and rc-file, do not add things into change-file |
|
4526 |
" |
|
4527 |
Class withoutUpdatingChangesDo:[ |
|
22791 | 4528 |
|commandFiles rcFile defaultRC prevCatchSetting |
4529 |
isEval isPrint isFilter isRepl isRunMain idxFileArg process| |
|
4530 |
||
4531 |
isEval := isPrint := isFilter := isRepl := isRunMain := false. |
|
4532 |
didReadRCFile := false. |
|
4533 |
||
4534 |
StandAlone ifFalse:[ |
|
4535 |
"/ self initializeVerboseFlags. |
|
4536 |
||
4537 |
"/ |
|
4538 |
"/ look for any '-q', '-e', '-l' or '-f' command line arguments |
|
4539 |
"/ and handle them; |
|
4540 |
"/ read startup and patches file |
|
4541 |
"/ |
|
4542 |
idx := CommandLineArguments indexOfAny:#('-R' '--repl'). |
|
4543 |
isRepl := IsRepl := (idx ~~ 0). |
|
4544 |
||
4545 |
idx := CommandLineArguments indexOfAny:#('-q' '--silent'). |
|
4546 |
idx ~~ 0 ifTrue:[ |
|
4547 |
Object infoPrinting:false. |
|
4548 |
ObjectMemory infoPrinting:false. |
|
4549 |
CommandLineArguments removeAtIndex:idx. |
|
4550 |
SilentLoading := true. |
|
4551 |
]. |
|
4552 |
||
4553 |
[ |
|
4554 |
idx := CommandLineArguments indexOfAny:#('-pp' '--packagePath'). |
|
4555 |
idx ~~ 0 |
|
4556 |
] whileTrue:[ |
|
4557 |
arg := CommandLineArguments at:idx + 1. |
|
4558 |
CommandLineArguments removeAtIndex:idx+1; removeAtIndex:idx. |
|
4559 |
(arg asCollectionOfSubstringsSeparatedByAny:',;') do:[:each | |
|
4560 |
self packagePath addLast:each. |
|
4561 |
VerboseStartup ifTrue:[ |
|
4562 |
('Smalltalk [info]: add to packagePath: "', arg, '".') infoPrintCR. |
|
4563 |
]. |
|
4564 |
]. |
|
4565 |
]. |
|
4566 |
||
4567 |
[ |
|
4568 |
idx := CommandLineArguments indexOfAny:#('-l' '--load'). |
|
4569 |
idx ~~ 0 |
|
4570 |
] whileTrue:[ |
|
4571 |
arg := CommandLineArguments at:idx + 1. |
|
4572 |
CommandLineArguments removeAtIndex:idx+1; removeAtIndex:idx. |
|
4573 |
Smalltalk silentlyLoadingDo:[ |
|
4574 |
(arg asCollectionOfSubstringsSeparatedByAny:',;') do:[:each | |
|
4575 |
each asFilename exists ifTrue:[ |
|
4576 |
(VerboseStartup | VerboseLoading) ifTrue:[ |
|
4577 |
('Smalltalk [info]: loading file: "', each, '".') infoPrintCR. |
|
4578 |
]. |
|
4579 |
Smalltalk fileIn:each |
|
4580 |
] ifFalse:[ |
|
4581 |
(VerboseStartup | VerboseLoading) ifTrue:[ |
|
4582 |
('Smalltalk [info]: loading package: "', each, '".') infoPrintCR. |
|
4583 |
]. |
|
4584 |
Smalltalk loadPackage:each |
|
4585 |
]. |
|
4586 |
]. |
|
4587 |
]. |
|
4588 |
]. |
|
4589 |
||
4590 |
"/ look for a '-e filename' or '--execute filename' or '--script filename' argument |
|
4591 |
"/ this will force fileIn of filename only, no standard startup. |
|
4592 |
||
4593 |
idx := CommandLineArguments indexOfAny:#('-e' '--execute' '--script'). |
|
4594 |
idx ~~ 0 ifTrue:[ |
|
4595 |
SilentLoading := true. |
|
4596 |
CommandName := arg := CommandLineArguments at:idx + 1. |
|
4597 |
||
4598 |
CommandLineArguments |
|
4599 |
removeAtIndex:idx+1; removeAtIndex:idx. |
|
4600 |
||
4601 |
self startSchedulerAndBackgroundCollector. |
|
4602 |
keepSplashWindow ifFalse:[ self hideSplashWindow ]. |
|
4603 |
Initializing := false. |
|
4604 |
||
4605 |
process := [ |
|
4606 |
Processor exitWhenNoMoreUserProcesses:true. |
|
4607 |
||
4608 |
"/ set workspace variables |
|
4609 |
self defineCommandLineAsWorkspaceVariablesForScripts. |
|
4610 |
||
4611 |
"/ provide a Display, if needed |
|
4612 |
self providingDisplayDo:[ |
|
4613 |
VerboseStartup ifTrue:[ |
|
4614 |
('Smalltalk [info]: reading script from: "', arg, '".') infoPrintCR. |
|
4615 |
]. |
|
4616 |
NoHandlerError handle:[:ex | |
|
4617 |
Debugging == true ifTrue:[ |
|
4618 |
MiniDebugger enterException:ex. |
|
4619 |
] ifFalse:[ |
|
4620 |
Silent ifFalse:[ |
|
4621 |
'Smalltalk [error]: ' _errorPrint. ex exception description _errorPrintCR. |
|
4622 |
]. |
|
4623 |
(VerboseStartup or:[ObjectMemory debugPrinting]) ifTrue:[ |
|
4624 |
ex suspendedContext fullPrintAll. |
|
4625 |
]. |
|
4626 |
self exit:1. |
|
4627 |
]. |
|
4628 |
self exit:1. |
|
4629 |
"/ ex reject. |
|
4630 |
] do:[ |
|
4631 |
UserInterrupt handle:[:ex | |
|
4632 |
Debugging == true ifTrue:[ |
|
4633 |
'user interrupt (type "c" to continue; "x" to exit; "?" for help).' errorPrintCR. |
|
4634 |
"/ thisContext fullPrintAll. |
|
4635 |
MiniDebugger enterException:ex. |
|
4636 |
ex proceed. |
|
4637 |
]. |
|
4638 |
Silent ifFalse:[ 'user interrupt.' errorPrintCR ]. |
|
4639 |
self exit:128+(OperatingSystem sigINT). |
|
4640 |
] do:[ |
|
4641 |
|cmdStream result| |
|
4642 |
||
4643 |
arg = '-' ifTrue:[ |
|
4644 |
cmdStream := Stdin. |
|
4645 |
] ifFalse:[ |
|
4646 |
IsSTScript := true. |
|
4647 |
cmdStream := arg asFilename readStream. |
|
4648 |
]. |
|
4649 |
result := [ |
|
4650 |
self fileInStream:cmdStream |
|
4651 |
lazy:nil |
|
4652 |
silent:self verbose not |
|
4653 |
logged:false |
|
4654 |
addPath:nil |
|
4655 |
] ensure:[ |
|
4656 |
IsSTScript ifTrue:[ |
|
4657 |
"/ do not close Stdin |
|
4658 |
cmdStream close. |
|
4659 |
]. |
|
4660 |
]. |
|
4661 |
result ifFalse:[ |
|
4662 |
self exit:1. |
|
4663 |
]. |
|
4664 |
]. |
|
4665 |
]. |
|
4666 |
]. |
|
4667 |
||
4668 |
"/ after the script, if Screen has been opened and there are any open windows, |
|
4669 |
"/ then do not exit |
|
20758 | 4670 |
false ifTrue:[ |
22791 | 4671 |
Display notNil ifTrue:[ |
4672 |
Processor exitWhenNoMoreUserProcesses:true. |
|
4673 |
"/ Display exitOnLastClose:true. |
|
4674 |
"/ Display checkForEndOfDispatch. |
|
4675 |
] ifFalse:[ |
|
4676 |
self exit. |
|
4677 |
]. |
|
20758 | 4678 |
]. |
22791 | 4679 |
] newProcess. |
4680 |
process priority:(Processor userSchedulingPriority). |
|
4681 |
process name:'main'. |
|
4682 |
process beGroupLeader. |
|
4683 |
process resume. |
|
4684 |
||
4685 |
Processor dispatchLoop. |
|
4686 |
self exit |
|
4687 |
]. |
|
4688 |
||
4689 |
"look for a '-f filename' or '--file filename' argument |
|
4690 |
if scripting, these are loaded before -P, -E or -R action. |
|
4691 |
if not scripting, this will force evaluation of filename instead of smalltalk.rc" |
|
4692 |
[ |
|
4693 |
idxFileArg := CommandLineArguments indexOfAny:#('-f' '--file'). |
|
4694 |
(idxFileArg ~~ 0) |
|
4695 |
] whileTrue:[ |
|
4696 |
commandFiles isNil ifTrue:[ commandFiles := OrderedCollection new ]. |
|
4697 |
commandFiles add:(CommandLineArguments at:idxFileArg+1). |
|
4698 |
CommandLineArguments removeAtIndex:idxFileArg+1; removeAtIndex:idxFileArg. |
|
4699 |
]. |
|
4700 |
||
4701 |
"/ look for a '-E expr' or '--eval expr' argument (-P or --print to print the result of evaluation) |
|
4702 |
"/ or -F/--filter or a '--repl' argument |
|
4703 |
"/ E, P and F this will force evaluation of expr only, no standard startup |
|
4704 |
"/ repl go into an interactive loop. |
|
4705 |
idx := CommandLineArguments indexOfAny:#('-E' '--eval'). |
|
4706 |
(isEval := (idx ~~ 0)) ifFalse:[ |
|
4707 |
idx := CommandLineArguments indexOfAny:#('-P' '--print'). |
|
4708 |
(isPrint := (idx ~~ 0)) ifFalse:[ |
|
4709 |
idx := CommandLineArguments indexOfAny:#('-F' '--filter'). |
|
4710 |
(isFilter := (idx ~~ 0)) ifFalse:[ |
|
4711 |
idx := CommandLineArguments indexOfAny:#('-R' '--repl'). |
|
4712 |
(isRepl := (idx ~~ 0)) ifFalse:[ |
|
4713 |
idx := CommandLineArguments indexOfAny:#('--run'). |
|
4714 |
isRunMain := (idx ~~ 0) |
|
4715 |
]. |
|
4716 |
]. |
|
4717 |
]. |
|
4718 |
]. |
|
4719 |
||
4720 |
(isEval | isPrint | isFilter | isRepl | isRunMain) ifTrue:[ |
|
4721 |
|args| |
|
4722 |
||
4723 |
VerboseStartup ifTrue:[ |
|
4724 |
('Smalltalk [info]: eval/filter/print or repl') infoPrintCR. |
|
4725 |
]. |
|
4726 |
isRepl ifFalse:[ |
|
4727 |
CommandLineArguments size <= idx ifTrue:[ |
|
4728 |
StandAlone := true. |
|
4729 |
self exitWithErrorMessage:'missing argument after -E/-P/-F/--run.'. |
|
4730 |
]. |
|
4731 |
isFilter ifTrue:[ |
|
4732 |
args := CommandLineArguments copyFrom:idx + 1. |
|
4733 |
CommandLineArguments removeFromIndex:idx+1. |
|
4734 |
VerboseStartup ifTrue:[ |
|
4735 |
('Smalltalk [info]: filter expression(s): ') infoPrint. |
|
4736 |
args infoPrintCR. |
|
4737 |
]. |
|
4738 |
] ifFalse:[ |
|
4739 |
arg := CommandLineArguments at:idx + 1. |
|
4740 |
CommandLineArguments removeAtIndex:idx+1. |
|
4741 |
VerboseStartup ifTrue:[ |
|
4742 |
('Smalltalk [info]: eval expression: ') infoPrint. |
|
4743 |
arg infoPrintCR. |
|
4744 |
]. |
|
4745 |
]. |
|
4746 |
]. |
|
4747 |
CommandLineArguments removeAtIndex:idx. |
|
4748 |
||
4749 |
self startSchedulerAndBackgroundCollector. |
|
4750 |
||
4751 |
keepSplashWindow ifFalse:[ self hideSplashWindow ]. |
|
4752 |
Initializing := false. |
|
4753 |
||
4754 |
"/ set workspace variables |
|
4755 |
self defineCommandLineAsWorkspaceVariablesForScripts. |
|
4756 |
||
4757 |
"/ all of the above allow for a -f file to be loaded before any other action |
|
4758 |
(commandFiles notEmptyOrNil) ifTrue:[ |
|
4759 |
commandFiles do:[:commandFile | |
|
4760 |
(VerboseStartup | VerboseLoading) ifTrue:[ |
|
4761 |
('Smalltalk [info]: reading command file from: "', commandFile, '".') infoPrintCR. |
|
4762 |
]. |
|
4763 |
Smalltalk silentlyLoadingDo:[ |
|
4764 |
(self secureFileIn:commandFile) ifFalse:[ |
|
4765 |
StandAlone := true. |
|
4766 |
self exitWithErrorMessage:('"', commandFile, '" not found.'). |
|
4767 |
] |
|
4768 |
] |
|
4769 |
] |
|
4770 |
]. |
|
4771 |
||
4772 |
isRepl ifFalse:[ |
|
4773 |
Debugging == true ifFalse:[ |
|
4774 |
"/ remove the Debugger |
|
4775 |
Debugger := nil. |
|
4776 |
]. |
|
4777 |
]. |
|
4778 |
||
4779 |
process := [ |
|
4780 |
self providingDisplayDo:[ |
|
4781 |
isRepl ifTrue:[ |
|
4782 |
Processor exitWhenNoMoreUserProcesses:false. |
|
4783 |
Processor activeProcess name:'repl'. |
|
4784 |
self readEvalPrintLoop. |
|
4785 |
self exit. |
|
4786 |
]. |
|
4787 |
||
4788 |
Processor exitWhenNoMoreUserProcesses:true. |
|
4789 |
||
4790 |
NoHandlerError handle:[:ex | |
|
4791 |
Debugging == true ifTrue:[ |
|
4792 |
MiniDebugger enterException:ex. |
|
4793 |
] ifFalse:[ |
|
4794 |
Silent ifFalse:[ |
|
4795 |
'Smalltalk [error]: ' _errorPrint. ex description _errorPrintCR. |
|
4796 |
]. |
|
4797 |
(VerboseStartup or:[ObjectMemory debugPrinting]) ifTrue:[ |
|
4798 |
ex suspendedContext fullPrintAll. |
|
4799 |
]. |
|
4800 |
self exit:1. |
|
4801 |
]. |
|
4802 |
self exit:1. |
|
4803 |
"/ ex reject. |
|
4804 |
] do:[ |
|
4805 |
UserInterrupt handle:[:ex | |
|
4806 |
Debugging == true ifTrue:[ |
|
4807 |
'user interrupt (type "c" to continue; "x" to exit; "?" for help).' errorPrintCR. |
|
4808 |
"/ thisContext fullPrintAll. |
|
4809 |
MiniDebugger enterException:ex. |
|
4810 |
ex proceed. |
|
4811 |
]. |
|
4812 |
Silent ifFalse:[ 'user interrupt.' errorPrintCR ]. |
|
4813 |
self exit:128+(OperatingSystem sigINT). |
|
4814 |
] do:[ |
|
4815 |
|filterCode filterStart filterEnd| |
|
4816 |
||
4817 |
isFilter ifTrue:[ |
|
4818 |
"/ --filter - apply code to each input line. |
|
4819 |
"/ compile code only once |
|
4820 |
(args size == 1) ifTrue:[ |
|
4821 |
VerboseStartup ifTrue:[ |
|
4822 |
'Smalltalk [info]: filter 1-arg' infoPrintCR. |
|
4823 |
]. |
|
4824 |
filterCode := args at:1. |
|
4825 |
] ifFalse:[ |
|
4826 |
(args size == 3) ifTrue:[ |
|
4827 |
VerboseStartup ifTrue:[ |
|
4828 |
'Smalltalk [info]: filter 3-arg' infoPrintCR. |
|
4829 |
]. |
|
4830 |
filterStart := args at:1. |
|
4831 |
filterCode := args at:2. |
|
4832 |
filterEnd := args at:3. |
|
4833 |
] ifFalse:[ |
|
4834 |
StandAlone := true. |
|
4835 |
self exitWithErrorMessage:'--filter must be followed by 1 or 3 expression arg(s)' |
|
4836 |
]. |
|
4837 |
]. |
|
4838 |
filterStart notEmptyOrNil ifTrue:[ |
|
4839 |
VerboseStartup ifTrue:[ |
|
4840 |
('Smalltalk [info]: eval: "', filterStart, '"...') infoPrintCR. |
|
4841 |
]. |
|
4842 |
Compiler evaluate:filterStart notifying:(EvalScriptingErrorHandler new source:filterStart) |
|
4843 |
]. |
|
4844 |
VerboseStartup ifTrue:[ |
|
4845 |
('Smalltalk [info]: compile: "', filterCode, '"...') infoPrintCR. |
|
4846 |
]. |
|
4847 |
Compiler |
|
4848 |
compile:'doIt:line ',filterCode |
|
4849 |
forClass:String |
|
4850 |
notifying:(EvalScriptingErrorHandler new source:filterCode). |
|
4851 |
||
4852 |
[Stdin atEnd] whileFalse:[ |
|
4853 |
|line| |
|
4854 |
||
4855 |
line := Stdin nextLine. |
|
4856 |
line doIt:line. |
|
4857 |
]. |
|
4858 |
filterEnd notEmptyOrNil ifTrue:[ |
|
4859 |
VerboseStartup ifTrue:[ |
|
4860 |
('Smalltalk [info]: eval: "', filterEnd, '"...') infoPrintCR. |
|
4861 |
]. |
|
4862 |
Compiler evaluate:filterEnd notifying:(EvalScriptingErrorHandler new source:filterEnd) |
|
4863 |
]. |
|
4864 |
] ifFalse:[ |
|
4865 |
(isPrint | isEval) ifTrue:[ |
|
4866 |
"/ --print or --eval |
|
4867 |
|rslt| |
|
4868 |
||
4869 |
rslt := Parser new |
|
4870 |
evaluate:arg |
|
4871 |
notifying:(EvalScriptingErrorHandler new source:arg) |
|
4872 |
compile:true. |
|
4873 |
isPrint ifTrue:[ |
|
4874 |
rslt printCR. |
|
4875 |
]. |
|
4876 |
] ifFalse:[ |
|
4877 |
"/ --run <className> |
|
4878 |
|className class| |
|
4879 |
||
4880 |
className := arg. |
|
4881 |
class := Smalltalk classNamed:className. |
|
4882 |
class isNil ifTrue:[ |
|
4883 |
StandAlone := true. |
|
4884 |
self exitWithErrorMessage:'no such class: "', className, '".' |
|
4885 |
]. |
|
4886 |
(class respondsTo:#main:) ifTrue:[ |
|
4887 |
class main:CommandLineArguments. |
|
4888 |
] ifFalse:[ |
|
4889 |
(class respondsTo:#main) ifTrue:[ |
|
4890 |
class main. |
|
4891 |
] ifFalse:[ |
|
4892 |
(class respondsTo:#start) ifTrue:[ |
|
4893 |
class start. |
|
4894 |
] ifFalse:[ |
|
4895 |
StandAlone := true. |
|
4896 |
self exitWithErrorMessage:'class has no "main:", "main" or "start" method.' |
|
4897 |
]. |
|
4898 |
]. |
|
4899 |
]. |
|
4900 |
]. |
|
4901 |
]. |
|
4902 |
]. |
|
4903 |
]. |
|
4904 |
]. |
|
4905 |
||
4906 |
"/ after the script, if Screen has been opened and there are any open windows, |
|
4907 |
"/ then do not exit |
|
20758 | 4908 |
false ifTrue:[ |
22791 | 4909 |
Display notNil ifTrue:[ |
4910 |
Processor exitWhenNoMoreUserProcesses:true. |
|
4911 |
"/ Display exitOnLastClose:true. |
|
4912 |
"/ Display checkForEndOfDispatch. |
|
4913 |
VerboseStartup ifTrue:[ |
|
4914 |
('Smalltalk [info]: display opened.') infoPrintCR. |
|
4915 |
]. |
|
4916 |
] ifFalse:[ |
|
4917 |
VerboseStartup ifTrue:[ |
|
4918 |
('Smalltalk [info]: no display - exit after script.') infoPrintCR. |
|
4919 |
]. |
|
4920 |
self exit. |
|
4921 |
]. |
|
20758 | 4922 |
]. |
22791 | 4923 |
VerboseStartup ifTrue:[ |
4924 |
('Smalltalk [info]: script/repl/eval finished.') infoPrintCR. |
|
4925 |
]. |
|
4926 |
||
4927 |
] newProcess. |
|
4928 |
process priority:(Processor userSchedulingPriority). |
|
4929 |
process name:'main'. |
|
4930 |
process beGroupLeader. |
|
4931 |
process resume. |
|
4932 |
||
4933 |
Processor dispatchLoop. |
|
4934 |
VerboseStartup ifTrue:[ |
|
4935 |
('Smalltalk [info]: exit normally.') infoPrintCR. |
|
4936 |
]. |
|
4937 |
self exit |
|
4938 |
]. |
|
4939 |
]. |
|
4940 |
||
4941 |
commandFiles notNil ifTrue:[ |
|
4942 |
SilentLoading := true. "/ suppress the hello & copyright messages |
|
4943 |
self addStartBlock: |
|
4944 |
[ |
|
4945 |
commandFiles do:[:commandFile | |
|
4946 |
(self secureFileIn:commandFile) ifFalse:[ |
|
4947 |
self exitWithErrorMessage:('startup file "', commandFile, '" not found.'). |
|
4948 |
]. |
|
4949 |
]. |
|
4950 |
]. |
|
16091 | 4951 |
|
4952 |
"/ self startSchedulerAndBackgroundCollector. |
|
4953 |
"/ keepSplashWindow ifFalse:[ self hideSplashWindow ]. |
|
4954 |
"/ Initializing := false. |
|
4955 |
"/ |
|
4956 |
"/ (self secureFileIn:commandFile) ifFalse:[ |
|
4957 |
"/ ('Smalltalk [error]: startup file "', commandFile, '" not found.') errorPrintCR. |
|
4958 |
"/ OperatingSystem exit:1. |
|
4959 |
"/ ]. |
|
22791 | 4960 |
] ifFalse:[ |
4961 |
"/ look for <command>.rc |
|
4962 |
"/ if not found, read smalltalk.rc (or stxapp.rc for standAlone operation) |
|
4963 |
||
4964 |
rcFile := self commandName asFilename withSuffix:'rc'. |
|
4965 |
(didReadRCFile := rcFile exists and:[self secureFileIn:rcFile]) ifFalse:[ |
|
4966 |
StandAlone ifFalse:[ |
|
4967 |
defaultRC := 'smalltalk.rc' "/asFilename |
|
4968 |
] ifTrue:[ |
|
4969 |
defaultRC := 'stxapp.rc' "/asFilename |
|
4970 |
]. |
|
4971 |
"JV@2011-11-01: DO NOT check defaultRC exist - this prevents smalltalk to |
|
4972 |
to be started with different working directory than stx/projects/smalltalk !!!!!!" |
|
4973 |
||
4974 |
"/didReadRCFile := defaultRC exists and:[self secureFileIn:defaultRC]. |
|
4975 |
didReadRCFile := (self getSystemFileName:defaultRC) notNil |
|
4976 |
and:[self secureFileIn:defaultRC]. |
|
4977 |
didReadRCFile ifFalse:[ |
|
4978 |
StandAlone ifFalse:[ |
|
4979 |
'Smalltalk [warning]: no startup rc-file found. Going into line-by-line interpreter.' infoPrintCR. |
|
4980 |
graphicalMode := false. |
|
4981 |
] |
|
4982 |
] |
|
4983 |
]. |
|
4984 |
||
4985 |
"/ ('StandAlone is %1' bindWith:StandAlone) printCR. |
|
4986 |
"/ ('Headless is %1' bindWith:HeadlessOperation) printCR. |
|
4987 |
"/ ('Display is %1' bindWith:Display) printCR. |
|
4988 |
"/ ('Screen is %1' bindWith:Screen) printCR. |
|
4989 |
||
4990 |
keepSplashWindow ifFalse:[ self hideSplashWindow ]. |
|
4991 |
didReadRCFile ifFalse:[ |
|
4992 |
'private.rc' asFilename exists ifTrue:[ self secureFileIn:'private.rc' ]. |
|
4993 |
||
4994 |
"/ |
|
4995 |
"/ No RC file found; |
|
4996 |
"/ Setup more default stuff |
|
4997 |
"/ |
|
4998 |
StandAlone ifFalse:[ |
|
4999 |
"/ its a smalltalk - proceed in interpreter. |
|
5000 |
'Smalltalk [warning]: no startup rc-file found. Going into line-by-line interpreter.' infoPrintCR. |
|
5001 |
graphicalMode := false. |
|
5002 |
]. |
|
5003 |
||
5004 |
"/ setup more defaults... |
|
13537 | 5005 |
"/ ObjectMemory startBackgroundCollectorAt:5. |
5006 |
"/ ObjectMemory startBackgroundFinalizationAt:5. |
|
22791 | 5007 |
self addStartBlock:[ |
5008 |
self startSchedulerAndBackgroundCollector |
|
5009 |
]. |
|
5010 |
]. |
|
5011 |
]. |
|
5012 |
(CommandLineArguments includes:'--scripting') ifTrue:[ |
|
5013 |
self addStartBlock:[ |
|
5014 |
StandaloneStartup handleScriptingOptionsFromArguments:CommandLineArguments. |
|
5015 |
]. |
|
5016 |
]. |
|
617 | 5017 |
]. |
5018 |
||
10644 | 5019 |
HeadlessOperation ifTrue:[ |
22791 | 5020 |
graphicalMode := false. |
15872 | 5021 |
]. |
5022 |
||
5023 |
keepSplashWindow ifFalse:[ self hideSplashWindow ]. |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
5024 |
self mainStartup:graphicalMode |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
5025 |
|
15872 | 5026 |
"Modified: / 17-12-2013 / 16:44:40 / cg" |
22147 | 5027 |
"Modified: / 01-08-2017 / 11:08:47 / stefan" |
13536
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
5028 |
! |
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
5029 |
|
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
5030 |
startSchedulerAndBackgroundCollector |
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
5031 |
Processor startTimeSlicing. |
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
5032 |
Processor supportDynamicPriorities:true. |
13537 | 5033 |
|
5034 |
ObjectMemory startBackgroundCollectorAt:5. |
|
5035 |
ObjectMemory startBackgroundFinalizationAt:5. |
|
13536
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
5036 |
ObjectMemory backgroundCollectProcess priorityRange:(4 to:9). |
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
5037 |
ObjectMemory backgroundFinalizationProcess priorityRange:(4 to:9). |
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
5038 |
|
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
5039 |
"Created: / 31-07-2011 / 20:01:33 / cg" |
11808
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
5040 |
! |
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
5041 |
|
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
5042 |
startStartBlockProcess |
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
5043 |
"at the end of the smalltalk initialization, start all actions that |
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
5044 |
were delayed until the ProcessorScheduler is running in a separate process" |
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
5045 |
|
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
5046 |
|p| |
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
5047 |
|
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
5048 |
p := |
18668 | 5049 |
[ |
5050 |
self executeStartBlocks. |
|
5051 |
] newProcess. |
|
12022 | 5052 |
|
5053 |
p |
|
18668 | 5054 |
priority:(Processor userSchedulingPriority); |
5055 |
name:'start block handler'; |
|
5056 |
beGroupLeader; |
|
5057 |
resume. |
|
13892 | 5058 |
|
13893 | 5059 |
"Modified: / 07-01-2012 / 12:59:01 / cg" |
1097 | 5060 |
! ! |
5061 |
||
13947 | 5062 |
!Smalltalk class methodsFor:'startup and exit'! |
5063 |
||
5064 |
addExitBlock:aBlock |
|
5065 |
"{ Pragma: +optSpace }" |
|
5066 |
||
5067 |
"add a block to be executed when Smalltalk finishes. |
|
5068 |
This feature is currently not used anywhere - but could be useful for |
|
5069 |
cleanup in stand alone applications. |
|
5070 |
||
5071 |
Better use: ObjectMemory>>#addDependent: and handle the change message |
|
5072 |
#aboutToQuit." |
|
5073 |
||
5074 |
ExitBlocks isNil ifTrue:[ |
|
18668 | 5075 |
ExitBlocks := OrderedCollection with:aBlock |
13947 | 5076 |
] ifFalse:[ |
18668 | 5077 |
ExitBlocks add:aBlock |
13947 | 5078 |
] |
5079 |
! |
|
5080 |
||
5081 |
addImageStartBlock:aBlock |
|
5082 |
"{ Pragma: +optSpace }" |
|
5083 |
||
5084 |
"add a blocks to be executed in a separate process after |
|
5085 |
everything has been initialized. |
|
5086 |
These blocks will be executed after an image restart." |
|
5087 |
||
5088 |
ImageStartBlocks isNil ifTrue:[ |
|
18668 | 5089 |
ImageStartBlocks := OrderedCollection with:aBlock |
13947 | 5090 |
] ifFalse:[ |
18668 | 5091 |
ImageStartBlocks add:aBlock |
13947 | 5092 |
] |
5093 |
||
5094 |
"Created: 9.9.1996 / 16:48:20 / stefan" |
|
5095 |
! |
|
5096 |
||
5097 |
addStartBlock:aBlock |
|
15980 | 5098 |
"to be called ONLY during very early startup (before the process scheduler |
5099 |
is started) to add a block to be executed in a separate process after |
|
5100 |
everything has been initialized. |
|
5101 |
Used to allow a startup script (which is executed BEFORE the scheduler and |
|
5102 |
UI display is startup up) to add actions which require those subsystems to |
|
5103 |
be operating. |
|
5104 |
These blocks will be executed only once and not be executed after an image restart. |
|
13947 | 5105 |
Initial processes such as the launcher are usually started here |
15980 | 5106 |
(see smalltalk.rc / private.rc). |
5107 |
ONLY to be called from such an rc file." |
|
13947 | 5108 |
|
5109 |
"{ Pragma: +optSpace }" |
|
5110 |
||
15980 | 5111 |
"/ to protect against "mis-users" of this mehtod... |
5112 |
Initializing ifFalse:[ |
|
18668 | 5113 |
aBlock value |
16170
ca4d03def070
endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents:
16164
diff
changeset
|
5114 |
] ifTrue:[ |
18668 | 5115 |
StartBlocks isNil ifTrue:[ |
5116 |
StartBlocks := OrderedCollection with:aBlock |
|
5117 |
] ifFalse:[ |
|
5118 |
StartBlocks add:aBlock |
|
5119 |
] |
|
15980 | 5120 |
]. |
13947 | 5121 |
|
5122 |
"Created: / 09-09-1996 / 16:46:53 / stefan" |
|
5123 |
"Modified (comment): / 18-08-2011 / 09:18:42 / cg" |
|
5124 |
! |
|
5125 |
||
5126 |
exit |
|
5127 |
"{ Pragma: +optSpace }" |
|
5128 |
||
5129 |
"finish the Smalltalk system" |
|
5130 |
||
5131 |
self exit:0 |
|
5132 |
"not reached" |
|
5133 |
||
5134 |
"Be careful evaluating this |
|
5135 |
Smalltalk exit |
|
5136 |
" |
|
5137 |
! |
|
5138 |
||
5139 |
exit:statusInteger |
|
5140 |
"{ Pragma: +optSpace }" |
|
5141 |
||
5142 |
"finish the Smalltalk system" |
|
5143 |
||
5144 |
ObjectMemory changed:#aboutToExit. "/ for ST/X backward compatibility |
|
5145 |
ObjectMemory changed:#aboutToQuit. "/ for ST-80 compatibility |
|
5146 |
ExitBlocks notNil ifTrue:[ |
|
22791 | 5147 |
ExitBlocks do:[:aBlock | |
5148 |
aBlock value |
|
5149 |
] |
|
21782 | 5150 |
]. |
5151 |
Display notNil ifTrue:[ Display closeConnection ]. |
|
5152 |
||
13947 | 5153 |
OperatingSystem exit:statusInteger |
5154 |
"not reached" |
|
5155 |
||
5156 |
"Be careful evaluating this |
|
5157 |
Smalltalk exit:1 |
|
5158 |
" |
|
21782 | 5159 |
|
5160 |
"Modified: / 30-05-2017 / 21:36:35 / cg" |
|
19014 | 5161 |
! |
5162 |
||
19958 | 5163 |
exitIfStandalone |
5164 |
"if this is a standalone application, exit. |
|
5165 |
Otherwise give a warning and abort. |
|
5166 |
Call this in your code instead of Smalltalk exit, |
|
5167 |
so the code can be tested in the IDE without danger of shuttong down ST/X" |
|
5168 |
||
5169 |
"{ Pragma: +optSpace }" |
|
5170 |
||
5171 |
self exitIfStandalone:0 |
|
5172 |
||
5173 |
"Created: / 06-06-2016 / 14:56:49 / cg" |
|
5174 |
! |
|
5175 |
||
5176 |
exitIfStandalone:statusInteger |
|
5177 |
"if this is a standalone application, exit. |
|
5178 |
Otherwise give a warning and abort. |
|
5179 |
Call this in your code instead of Smalltalk exit, |
|
5180 |
so the code can be tested in the IDE without danger of shuttong down ST/X" |
|
5181 |
||
5182 |
"{ Pragma: +optSpace }" |
|
5183 |
||
5184 |
Smalltalk isStandAloneApp ifTrue:[ |
|
22791 | 5185 |
self exit:statusInteger |
19958 | 5186 |
] ifFalse:[ |
22791 | 5187 |
self warn:'Application asks Smalltalk to exit (this is suppressed in IDE).'. |
5188 |
AbortOperationRequest raise. |
|
19958 | 5189 |
] |
5190 |
||
5191 |
" |
|
5192 |
Smalltalk exitIfStandalone:1 |
|
5193 |
" |
|
5194 |
||
5195 |
"Created: / 06-06-2016 / 14:56:00 / cg" |
|
5196 |
! |
|
5197 |
||
19014 | 5198 |
exitOrError:exitCode |
5199 |
"exit only if running as standalone application. |
|
5200 |
Raise an error in the development system. |
|
5201 |
Useful for testing standalone apps which should not kill |
|
5202 |
your development system." |
|
5203 |
||
5204 |
self isStandAloneApp ifTrue:[ |
|
22791 | 5205 |
self exit:exitCode. |
19014 | 5206 |
]. |
5207 |
self error:'standalone smalltalk would exit here with exit code: ', exitCode printString. |
|
5208 |
||
5209 |
" |
|
5210 |
self exitOrError:0 |
|
5211 |
" |
|
20715 | 5212 |
! |
5213 |
||
5214 |
exitWithErrorMessage:msg |
|
5215 |
('Smalltalk [error]: ',msg) errorPrintCR. |
|
5216 |
self exitOrError:1 |
|
13947 | 5217 |
! ! |
5218 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
5219 |
!Smalltalk class methodsFor:'startup queries'! |
1097 | 5220 |
|
10641 | 5221 |
commandLine |
5222 |
"return the full command line arguments (with which ST/X was started)" |
|
5223 |
||
5224 |
^ CommandLine |
|
5225 |
||
5226 |
" |
|
5227 |
Smalltalk commandLine |
|
5228 |
" |
|
5229 |
||
5230 |
"Created: 19.7.1996 / 11:09:06 / cg" |
|
5231 |
! |
|
5232 |
||
5233 |
commandLineArgumentNamed:aString |
|
16110 | 5234 |
"extract a named argument from the command line arguments. |
5235 |
This searches for the given string in the command line and returns the next argument after it." |
|
10641 | 5236 |
|
5237 |
|args index| |
|
5238 |
||
5239 |
args := self commandLineArguments. |
|
5240 |
index := args indexOf:aString. |
|
5241 |
(index between:1 and:(args size - 1)) ifTrue:[ |
|
18668 | 5242 |
^ args at:index+1 |
10641 | 5243 |
]. |
5244 |
^ nil. |
|
5245 |
||
5246 |
" |
|
5247 |
self commandLineArgumentNamed:'-display' |
|
5248 |
" |
|
5249 |
! |
|
5250 |
||
5251 |
commandLineArguments |
|
5252 |
"return the user command line arguments; |
|
5253 |
This is a collection of strings (separated command line words), |
|
5254 |
from which the internal startup arguments have already been removed. |
|
5255 |
I.e. if started with: 'smalltalk -I -f xxx foo bar baz', |
|
5256 |
the commandLineArguments will be #('foo' 'bar' 'baz'). |
|
5257 |
In contrast, the value returned by #commandLine will be the full set of words." |
|
5258 |
||
5259 |
^ CommandLineArguments |
|
5260 |
||
5261 |
"Modified: 19.7.1996 / 11:11:03 / cg" |
|
5262 |
! |
|
5263 |
||
5264 |
commandName |
|
5265 |
"return the excutables name - this is normally 'stx', |
|
5266 |
but can be something else for standAlone apps." |
|
5267 |
||
5268 |
^ CommandName. |
|
5269 |
||
5270 |
" |
|
5271 |
Smalltalk commandName |
|
5272 |
" |
|
5273 |
||
5274 |
"Modified: 19.7.1996 / 11:11:16 / cg" |
|
5275 |
! |
|
5276 |
||
5277 |
hasNoConsole |
|
5278 |
"return true, if this is a console-less application (i.e. I am winstx) |
|
5279 |
i.e. there should be no writing to stdout/stderr" |
|
5280 |
||
5281 |
^ HasNoConsole ? false |
|
5282 |
||
5283 |
" |
|
10071 | 5284 |
Smalltalk hasNoConsole |
9054 | 5285 |
" |
5286 |
! |
|
5287 |
||
17435 | 5288 |
ignoreAssertions |
5289 |
"return true, if assertions are to be ignored (i.e. not executed). |
|
5290 |
This is false by default in an IDE (i.e. full smalltalk), |
|
5291 |
but can be set to true for standAlone applications |
|
5292 |
(whether that is a good idea and helps, is another question) |
|
17439
1928276a394c
added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents:
17438
diff
changeset
|
5293 |
However, it may make the app a little faster, if assertions are compatational |
17435 | 5294 |
expensive, as they are skipped (the stc compiler is generatig code which skips those)." |
5295 |
||
17439
1928276a394c
added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents:
17438
diff
changeset
|
5296 |
^ IgnoreAssertions ? false |
17435 | 5297 |
! |
5298 |
||
17438 | 5299 |
ignoreAssertions:aBoolean |
5300 |
"set to true, if assertions are to be ignored (i.e. not executed). |
|
5301 |
This is false by default in an IDE (i.e. full smalltalk), |
|
5302 |
but can be set to true for standAlone applications |
|
5303 |
(whether that is a good idea and helps, is another question) |
|
17439
1928276a394c
added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents:
17438
diff
changeset
|
5304 |
However, it may make the app a little faster, if assertions are compatational |
17438 | 5305 |
expensive, as they are skipped (the stc compiler is generatig code which skips those)." |
5306 |
||
17439
1928276a394c
added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents:
17438
diff
changeset
|
5307 |
IgnoreAssertions := aBoolean |
17438 | 5308 |
! |
5309 |
||
22679 | 5310 |
isDebuggableApp |
5311 |
"return true, if we want to see a Debugger, MiniDebugger or extended debugging output |
|
5312 |
in some situations." |
|
5313 |
||
5314 |
^ self isStandAloneApp not or:[self isStandAloneDebug]. |
|
5315 |
||
5316 |
" |
|
5317 |
Smalltalk isDebuggableApp |
|
5318 |
" |
|
5319 |
||
5320 |
"Created: / 19-04-2018 / 10:30:17 / stefan" |
|
5321 |
! |
|
5322 |
||
10641 | 5323 |
isHeadless |
5324 |
"return true, if this is a headless application |
|
5325 |
i.e. no default Display connection is required/used" |
|
5326 |
||
5327 |
^ HeadlessOperation ? false |
|
5328 |
||
5329 |
" |
|
10071 | 5330 |
Smalltalk isHeadless |
9029 | 5331 |
" |
5332 |
! |
|
5333 |
||
10641 | 5334 |
isPlugin |
5335 |
"return true, if this is a plugin application |
|
5336 |
i.e. running in a browserWindow" |
|
5337 |
||
5338 |
^ IsPlugin ? false |
|
5339 |
||
5340 |
" |
|
10071 | 5341 |
Smalltalk isPlugin |
9029 | 5342 |
" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5343 |
! |
4957 | 5344 |
|
10641 | 5345 |
isSTScript |
5346 |
"return true, if this is stscript. i.e. the stx scripting engine." |
|
5347 |
||
5348 |
^ IsSTScript ? false |
|
5349 |
||
5350 |
" |
|
5351 |
Smalltalk isSTScript |
|
5352 |
" |
|
5353 |
||
5354 |
"Created: / 06-12-2006 / 16:41:21 / cg" |
|
5355 |
! |
|
5356 |
||
5357 |
isSharedLibraryComponent |
|
5358 |
"return true, if this is a shared library component of another application |
|
5359 |
i.e. a dll within another app." |
|
5360 |
||
5361 |
^ IsSharedLibraryComponent ? false |
|
5362 |
||
5363 |
" |
|
5364 |
Smalltalk isSharedLibraryComponent |
|
5365 |
" |
|
5366 |
||
5367 |
"Created: / 10-08-2006 / 13:09:34 / cg" |
|
5368 |
! |
|
5369 |
||
5370 |
isSmalltalkDevelopmentSystem |
|
5371 |
"return true, if this is a real smalltalk system |
|
17421 | 5372 |
i.e. NOT a stripped or a linked standAlone application (such as the webServer) |
10641 | 5373 |
and NOT a plugIn (i.e. running in a browser) |
5374 |
and NOT a sharedLibrary component (i.e. a dll in another app). |
|
17421 | 5375 |
This is used to determine, whether debugging is possible/desired or not." |
10641 | 5376 |
|
5377 |
self isPlugin ifTrue:[^ false]. "/ I am a browser-plugin |
|
5378 |
self isSharedLibraryComponent ifTrue:[^ false]. "/ I am a COM-ponent |
|
5379 |
self isSTScript ifTrue:[^ true ]. "/ I am stScript |
|
10999 | 5380 |
^ self isStandAloneApp not. |
10641 | 5381 |
|
5382 |
" |
|
5383 |
Smalltalk isSmalltalkDevelopmentSystem |
|
5384 |
" |
|
5385 |
||
5386 |
"Created: / 10-08-2006 / 13:12:49 / cg" |
|
5387 |
"Modified: / 06-12-2006 / 16:42:56 / cg" |
|
15565 | 5388 |
"Modified (comment): / 27-07-2013 / 15:36:20 / cg" |
10641 | 5389 |
! |
5390 |
||
5391 |
isStandAloneApp |
|
5392 |
"return true, if this is a standAlone application |
|
5393 |
i.e. a stripped & linked application (such as the webServer) |
|
5394 |
in contrast to a full smalltalk (development) system." |
|
5395 |
||
5396 |
^ StandAlone ? false |
|
5397 |
||
5398 |
" |
|
10071 | 5399 |
Smalltalk isStandAloneApp |
9029 | 5400 |
" |
617 | 5401 |
! |
5402 |
||
13947 | 5403 |
isStandAloneDebug |
5404 |
"return true, if this is a standAlone application which |
|
5405 |
was started with the -debug option." |
|
5406 |
||
5407 |
^ DebuggingStandAlone ? false |
|
5408 |
||
5409 |
" |
|
5410 |
Smalltalk isStandAloneDebug |
|
5411 |
" |
|
5412 |
||
5413 |
"Created: / 19-01-2012 / 10:17:41 / cg" |
|
5414 |
! |
|
5415 |
||
10641 | 5416 |
startupArguments |
5417 |
"return the arguments passed to StartupClass when stx gets started. |
|
5418 |
Usually these are nil, |
|
5419 |
but saving an image with a non-nil StartupClass/StartupSelector/StartupArgs allows for |
|
5420 |
a simple way to configure and create stand-alone applications" |
|
5421 |
||
5422 |
^ StartupArguments |
|
5423 |
||
5424 |
" |
|
10071 | 5425 |
Smalltalk startupArguments |
9029 | 5426 |
" |
7563 | 5427 |
! |
5428 |
||
10641 | 5429 |
startupClass |
5430 |
"return the class, that will get the start message when smalltalk |
|
5431 |
starts and its non-nil. Usually this is nil, |
|
5432 |
but saving an image with a non-nil StartupClass/StartupSelector/StartupArgs allows for |
|
5433 |
a simple way to configure and create stand-alone applications" |
|
5434 |
||
5435 |
^ StartupClass |
|
5436 |
||
5437 |
" |
|
10071 | 5438 |
Smalltalk startupClass |
9029 | 5439 |
" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5440 |
! |
8570 | 5441 |
|
10641 | 5442 |
startupClass:aClass selector:aSymbol arguments:anArrayOrNil |
5443 |
"{ Pragma: +optSpace }" |
|
5444 |
||
5445 |
"set the class, selector and arguments to be performed when smalltalk |
|
5446 |
starts. Setting those before saving a snapshot, will make the saved |
|
5447 |
image come up executing your application (instead of the normal mainloop)" |
|
5448 |
||
5449 |
StartupClass := aClass. |
|
5450 |
StartupSelector := aSymbol. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5451 |
StartupArguments := anArrayOrNil |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5452 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5453 |
|
10641 | 5454 |
startupSelector |
5455 |
"return the selector, that will be sent to StartupClass. |
|
5456 |
Usually this is nil, |
|
5457 |
but saving an image with a non-nil StartupClass/StartupSelector allows for |
|
5458 |
a simple way to configure and create stand-alone applications" |
|
5459 |
||
5460 |
^ StartupSelector |
|
5461 |
||
5462 |
" |
|
10071 | 5463 |
Smalltalk startupSelector |
9029 | 5464 |
" |
10641 | 5465 |
! |
5466 |
||
5467 |
wasStartedFromImage |
|
5468 |
"return true, if this smalltalk was started from an image, |
|
5469 |
as opposed to a fresh and clean startup" |
|
5470 |
||
5471 |
^ ImageRestartTime notNil |
|
5472 |
||
5473 |
" |
|
5474 |
Smalltalk wasStartedFromImage |
|
5475 |
" |
|
70 | 5476 |
! ! |
5477 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
5478 |
!Smalltalk class methodsFor:'system environment'! |
1069 | 5479 |
|
10641 | 5480 |
language |
5481 |
"return the language setting" |
|
5482 |
||
5483 |
^ Language |
|
5484 |
||
5485 |
" |
|
5486 |
Smalltalk language |
|
5487 |
" |
|
5488 |
||
5489 |
"Modified: 26.4.1996 / 17:10:05 / cg" |
|
5490 |
! |
|
5491 |
||
5492 |
language:aLanguageSymbol |
|
10991 | 5493 |
"set the language - send out change notifications" |
10641 | 5494 |
|
18733 | 5495 |
aLanguageSymbol ~= Language ifTrue:[ |
22791 | 5496 |
Language := aLanguageSymbol asSymbol. |
5497 |
self changed:#Language |
|
18733 | 5498 |
]. |
10641 | 5499 |
|
5500 |
" |
|
5501 |
Smalltalk language:#de |
|
5502 |
" |
|
5503 |
||
5504 |
"Modified: / 19-10-2006 / 23:17:29 / cg" |
|
21928 | 5505 |
"Modified: / 29-06-2017 / 15:05:04 / stefan" |
10641 | 5506 |
! |
5507 |
||
5508 |
language:aLanguageSymbol territory:aTerritorySymbol |
|
10991 | 5509 |
"set the language & territory - send out change notifications" |
10641 | 5510 |
|
18733 | 5511 |
((Language ~= aLanguageSymbol) or:[ LanguageTerritory ~= aTerritorySymbol]) ifTrue:[ |
22791 | 5512 |
Language := aLanguageSymbol asSymbol. |
5513 |
LanguageTerritory := aTerritorySymbol asSymbol. |
|
5514 |
self changed:#Language |
|
18733 | 5515 |
]. |
10641 | 5516 |
|
5517 |
" |
|
5518 |
Smalltalk language:#de territory:#de |
|
5519 |
" |
|
5520 |
||
5521 |
"Created: / 19-10-2006 / 22:16:22 / cg" |
|
5522 |
"Modified: / 19-10-2006 / 23:17:36 / cg" |
|
5523 |
! |
|
5524 |
||
13212
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5525 |
languageAndTerritory |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5526 |
"return the language and territory in the format lang-terr (i.e. de-de, en-us)" |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5527 |
|
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5528 |
^ Language , '-' , (LanguageTerritory ? Language) |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5529 |
|
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5530 |
" |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5531 |
Smalltalk languageAndTerritory |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5532 |
" |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5533 |
|
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5534 |
"Created: / 16-01-2011 / 10:19:42 / cg" |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5535 |
! |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5536 |
|
20615 | 5537 |
languageCodeset |
5538 |
^ LanguageCodeset |
|
5539 |
! |
|
5540 |
||
5541 |
languageModifier |
|
5542 |
^ LanguageModifier |
|
5543 |
! |
|
5544 |
||
10641 | 5545 |
languageTerritory |
5546 |
"return the language territory setting" |
|
7563 | 5547 |
|
5548 |
^ LanguageTerritory |
|
5549 |
! |
|
5550 |
||
10641 | 5551 |
languageTerritory:aTerritorySymbol |
10991 | 5552 |
"set the language territory - send out change notifications" |
10641 | 5553 |
|
18924 | 5554 |
aTerritorySymbol ~= LanguageTerritory ifTrue:[ |
22791 | 5555 |
LanguageTerritory := aTerritorySymbol asSymbol. |
5556 |
self changed:#LanguageTerritory |
|
5557 |
]. |
|
5558 |
||
10641 | 5559 |
" |
5560 |
Time now |
|
5561 |
||
5562 |
Smalltalk languageTerritory:#us. |
|
5563 |
Time now |
|
5564 |
||
5565 |
Smalltalk languageTerritory:#de. |
|
5566 |
Time now |
|
5567 |
" |
|
5568 |
||
5569 |
"Modified: / 19-10-2006 / 23:17:40 / cg" |
|
5570 |
! |
|
5571 |
||
5572 |
setLanguage:aLanguageSymbol |
|
10991 | 5573 |
"set the language without change notification" |
10641 | 5574 |
|
5575 |
Language := aLanguageSymbol. |
|
10991 | 5576 |
! |
5577 |
||
5578 |
setLanguage:aLanguageSymbol territory:aTerritorySymbol |
|
5579 |
"set the language & territory - no change notification" |
|
5580 |
||
5581 |
Language := aLanguageSymbol asSymbol. |
|
5582 |
LanguageTerritory := aTerritorySymbol asSymbol. |
|
1069 | 5583 |
! ! |
5584 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
5585 |
!Smalltalk class methodsFor:'system management'! |
70 | 5586 |
|
10641 | 5587 |
compressSources |
5588 |
"{ Pragma: +optSpace }" |
|
5589 |
||
5590 |
"compress the sources file, and remove all method source strings |
|
5591 |
from the system and replace them by refs to a string in the source file. |
|
5592 |
This is a bit different in ST/X than in other smalltalks, |
|
5593 |
since we use per-class sourcefiles for the compiled classes, |
|
5594 |
and a mix of in-memory strings and one-for-all sourceFile for |
|
5595 |
incremental compiled methods. |
|
5596 |
Therefore, only those sources which are not coming from compiled |
|
5597 |
methods are put into the 'st.src' file - all others are untouched. |
|
20811 | 5598 |
This is being automated - so don't care for now." |
10641 | 5599 |
|
5600 |
|newStream table source pos fileName| |
|
5601 |
||
5602 |
" |
|
5603 |
first, find all methods which contain either a string-ref |
|
5604 |
or an external string in the 'st.src' file |
|
5605 |
" |
|
5606 |
newStream := 'src.tmp' asFilename writeStream. |
|
5607 |
||
5608 |
table := IdentityDictionary new:100. |
|
5609 |
||
5610 |
Method allSubInstancesDo:[:aMethod | |
|
22791 | 5611 |
source := nil. |
5612 |
aMethod sourcePosition notNil ifTrue:[ |
|
5613 |
aMethod sourceFilename = 'st.src' ifTrue:[ |
|
5614 |
source := aMethod source. |
|
5615 |
] |
|
5616 |
] ifFalse:[ |
|
5617 |
source := aMethod source |
|
5618 |
]. |
|
5619 |
||
5620 |
source notNil ifTrue:[ |
|
5621 |
pos := newStream position + 1. |
|
5622 |
newStream nextChunkPut:source. |
|
5623 |
||
5624 |
" |
|
5625 |
dont change the methods info - maybe some write error |
|
5626 |
occurs later, in that case we abort and leave everything |
|
5627 |
untouched. |
|
5628 |
" |
|
5629 |
table at:aMethod put:pos |
|
5630 |
] |
|
11655
4306fb61b9f8
sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents:
11624
diff
changeset
|
5631 |
]. |
4306fb61b9f8
sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents:
11624
diff
changeset
|
5632 |
|
4306fb61b9f8
sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents:
11624
diff
changeset
|
5633 |
newStream syncData; close. |
10641 | 5634 |
|
5635 |
" |
|
5636 |
now, rename the new source file, |
|
5637 |
" |
|
5638 |
fileName := (ObjectMemory nameForSources). |
|
5639 |
'src.tmp' asFilename renameTo:fileName. |
|
5640 |
||
5641 |
"good - now go over all changed methods, and change their |
|
5642 |
source reference" |
|
5643 |
||
5644 |
table keysAndValuesDo:[:aMethod :pos | |
|
22791 | 5645 |
aMethod localSourceFilename:fileName position:pos. |
10641 | 5646 |
"/ aMethod printCR. |
5647 |
]. |
|
5648 |
||
5649 |
" |
|
5650 |
Smalltalk compressSources |
|
5651 |
" |
|
5652 |
||
5653 |
"Modified: 16.1.1997 / 01:25:58 / cg" |
|
5654 |
! |
|
5655 |
||
5656 |
generateSingleSourceFile |
|
5657 |
"{ Pragma: +optSpace }" |
|
5658 |
||
5659 |
"generate the sources file, and remove all method source strings |
|
5660 |
from the system and replace them by refs to a string in the source file. |
|
5661 |
This makes the image independent from the per-class source files |
|
5662 |
and makes transportation of endUser applications easier, since |
|
5663 |
only 3 files (executable, image and sourceFile) need to be |
|
5664 |
transported." |
|
5665 |
||
5666 |
|newStream table source pos fileName| |
|
5667 |
||
5668 |
newStream := 'src.tmp' asFilename writeStream. |
|
5669 |
||
5670 |
table := IdentityDictionary new:100. |
|
5671 |
||
5672 |
Method allSubInstancesDo:[:aMethod | |
|
22791 | 5673 |
source := aMethod source. |
5674 |
source notNil ifTrue:[ |
|
5675 |
pos := newStream position + 1. |
|
5676 |
newStream nextChunkPut:source. |
|
5677 |
||
5678 |
" |
|
5679 |
don't change the method's info - maybe some write error |
|
5680 |
occurs later, in that case we abort and leave everything |
|
5681 |
untouched. |
|
5682 |
" |
|
5683 |
table at:aMethod put:pos |
|
5684 |
] |
|
11655
4306fb61b9f8
sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents:
11624
diff
changeset
|
5685 |
]. |
4306fb61b9f8
sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents:
11624
diff
changeset
|
5686 |
|
4306fb61b9f8
sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents:
11624
diff
changeset
|
5687 |
newStream syncData; close. |
10641 | 5688 |
|
5689 |
" |
|
5690 |
now, rename the new source file, |
|
5691 |
" |
|
5692 |
fileName := (ObjectMemory nameForSources). |
|
5693 |
'src.tmp' asFilename renameTo:fileName. |
|
5694 |
||
5695 |
"good - now go over all changed methods, and change their |
|
5696 |
source reference" |
|
5697 |
||
5698 |
table keysAndValuesDo:[:aMethod :pos | |
|
22791 | 5699 |
aMethod localSourceFilename:fileName position:pos. |
10641 | 5700 |
"/ aMethod printCR. |
5701 |
]. |
|
5702 |
||
5703 |
" |
|
5704 |
Smalltalk generateSingleSourceFile |
|
5705 |
" |
|
5706 |
||
22373 | 5707 |
"Modified: / 16-01-1997 / 01:25:58 / cg" |
5708 |
"Created: / 17-10-1997 / 13:00:56 / cg" |
|
5709 |
"Modified (comment): / 21-11-2017 / 13:08:41 / cg" |
|
10641 | 5710 |
! |
5711 |
||
15596 | 5712 |
installAutoloadedClassFromSourceFile:aFilename |
5713 |
"install aFilename (which must be a smalltalk source file) as autoloaded class |
|
5714 |
(extract the class definition chunk from the file and create an autoloaded |
|
5715 |
class stub for it)" |
|
5716 |
||
5717 |
|chunks filename| |
|
5718 |
||
5719 |
filename := aFilename asFilename. |
|
5720 |
||
5721 |
ChangeSet::InvalidChangeChunkError handle:[:ex | |
|
18668 | 5722 |
^ self |
15596 | 5723 |
] do:[ |
18668 | 5724 |
filename readingFileDo:[:s| |
5725 |
chunks := ChangeSet fromStream:s while:[:chunk | chunk isMethodChange not]. |
|
5726 |
]. |
|
16170
ca4d03def070
endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents:
16164
diff
changeset
|
5727 |
]. |
ca4d03def070
endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents:
16164
diff
changeset
|
5728 |
|
ca4d03def070
endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents:
16164
diff
changeset
|
5729 |
chunks |
18668 | 5730 |
select:[:eachChunk | eachChunk isClassDefinitionChange] |
5731 |
thenDo:[:eachClassChunk | |
|
5732 |
eachClassChunk installAsAutoloadedClassIfPublicWithFilename:filename asAbsoluteFilename "withoutSuffix" name "baseName" |
|
5733 |
]. |
|
15596 | 5734 |
|
5735 |
"Created: / 01-08-2013 / 16:57:26 / cg" |
|
5736 |
! |
|
5737 |
||
10641 | 5738 |
installAutoloadedClassNamed:clsName category:cat package:package revision:revisionOrNil |
5739 |
"create & install an autoload stub for a class named: clsName, |
|
5740 |
to be loaded from package. |
|
5741 |
If revisionOrNil is non-nil, set it up to load exactly that revision |
|
5742 |
(otherwise, the newest revision will be loaded" |
|
5743 |
||
5744 |
^ self |
|
18668 | 5745 |
installAutoloadedClassNamed:clsName |
5746 |
category:cat |
|
5747 |
package:package |
|
5748 |
revision:revisionOrNil |
|
5749 |
numClassInstVars:nil. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5750 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5751 |
|
10641 | 5752 |
installAutoloadedClassNamed:clsName category:cat package:package revision:revisionOrNil numClassInstVars:numClassInstVarsOrNil |
5753 |
"create & install an autoload stub for a class named: clsName, |
|
5754 |
to be loaded from package. |
|
5755 |
If revisionOrNil is non-nil, set it up to load exactly that revision |
|
5756 |
(otherwise, the newest revision will be loaded" |
|
5757 |
||
5758 |
|clsSym cls| |
|
5759 |
||
5760 |
clsSym := clsName asSymbol. |
|
5761 |
||
5762 |
"/ install if not already compiled-in |
|
5763 |
(cls := self at:clsSym) isNil ifTrue:[ |
|
18668 | 5764 |
Autoload subclass:clsSym |
5765 |
instanceVariableNames:'' |
|
5766 |
classVariableNames:'' |
|
5767 |
poolDictionaries:'' |
|
5768 |
category:cat |
|
5769 |
inEnvironment:Smalltalk. |
|
5770 |
||
5771 |
cls := self at:clsSym. |
|
5772 |
cls isNil ifTrue:[ |
|
5773 |
('Smalltalk [warning]: failed to install ' , clsName , ' as autoloaded.') infoPrintCR. |
|
5774 |
] ifFalse:[ |
|
5775 |
cls package:package asSymbol. |
|
5776 |
revisionOrNil notNil ifTrue:[ |
|
5777 |
cls setBinaryRevision:revisionOrNil |
|
5778 |
] |
|
5779 |
] |
|
10641 | 5780 |
] ifFalse:[ |
18668 | 5781 |
"/ class already present - however, if unloaded, check for category/package change |
5782 |
cls isLoaded ifFalse:[ |
|
5783 |
package ~= cls package ifTrue:[ |
|
5784 |
cls withoutUpdatingChangesDo:[ |
|
5785 |
cls package:package asSymbol. |
|
5786 |
]. |
|
5787 |
]. |
|
5788 |
cat ~= cls category ifTrue:[ |
|
5789 |
cls withoutUpdatingChangesDo:[ |
|
5790 |
cls category:cat. |
|
5791 |
]. |
|
5792 |
]. |
|
5793 |
]. |
|
10641 | 5794 |
]. |
5795 |
^ cls. |
|
5796 |
||
5797 |
"Created: / 05-11-1998 / 15:10:25 / cg" |
|
5798 |
"Modified: / 16-01-2007 / 12:56:18 / cg" |
|
11169
32fda240ee57
#installAutoloadedClassNamed:category:package:revision:numClassInstVars:
Stefan Vogel <sv@exept.de>
parents:
11153
diff
changeset
|
5799 |
|
10641 | 5800 |
! |
5801 |
||
5802 |
installAutoloadedClasses |
|
11679
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
5803 |
"scan all packages and install all classes found there as |
10641 | 5804 |
autoloaded. This takes some time ..." |
5805 |
||
11679
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
5806 |
|dirsConsulted| |
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
5807 |
|
17588 | 5808 |
LoadInProgressQuery answerNotifyLoadingDo:[ |
18668 | 5809 |
dirsConsulted := Set new. |
5810 |
||
5811 |
"/ along the package-path |
|
5812 |
self packagePath do:[:eachPathComponent | |
|
5813 |
(dirsConsulted includes:eachPathComponent) ifFalse:[ |
|
5814 |
self |
|
5815 |
recursiveInstallAutoloadedClassesFrom:eachPathComponent |
|
5816 |
rememberIn:dirsConsulted |
|
5817 |
maxLevels:15 |
|
5818 |
noAutoload:false |
|
5819 |
packageTop:eachPathComponent |
|
5820 |
showSplashInLevels:2. |
|
5821 |
] |
|
5822 |
]. |
|
5823 |
self splashInfo:nil. |
|
17548 | 5824 |
]. |
10641 | 5825 |
|
5826 |
" |
|
5827 |
Smalltalk installAutoloadedClasses |
|
5828 |
" |
|
5829 |
||
5830 |
"Created: / 14.2.1997 / 17:32:57 / cg" |
|
5831 |
"Modified: / 13.12.1999 / 11:56:50 / cg" |
|
5832 |
! |
|
5833 |
||
5834 |
installAutoloadedClassesFrom:anAbbrevFilePath |
|
5835 |
"read the given abbreviation file; install all classes found there as |
|
5836 |
autoloaded. This takes some time ..." |
|
5837 |
||
5838 |
|f s| |
|
5839 |
||
5840 |
f := self getSystemFileName:anAbbrevFilePath. |
|
5841 |
f isNil ifTrue:[f := self getPackageFileName:anAbbrevFilePath]. |
|
5842 |
||
5843 |
f notNil ifTrue:[ |
|
22791 | 5844 |
f := f asFilename. |
5845 |
f isDirectory ifTrue:[ |
|
5846 |
f := f construct:'abbrev.stc' |
|
5847 |
]. |
|
5848 |
[ |
|
5849 |
s := f readStream. |
|
5850 |
self installAutoloadedClassesFromStream:s. |
|
5851 |
s close. |
|
5852 |
] on:FileStream openErrorSignal |
|
5853 |
do:[:ex| "do nothing"]. |
|
10641 | 5854 |
] |
5855 |
||
5856 |
" |
|
5857 |
Smalltalk installAutoloadedClassesFrom:'include/abbrev.stc' |
|
19911 | 5858 |
Smalltalk installAutoloadedClassesFrom:'../../goodies/communication/abbrev.stc' |
10641 | 5859 |
" |
5860 |
||
5861 |
"Modified: / 5.11.1998 / 15:10:51 / cg" |
|
5862 |
! |
|
5863 |
||
13531
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
5864 |
installAutoloadedClassesFromAbbrevFile:aFilename |
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
5865 |
aFilename readingFileDo:[:abbrevStream | |
22791 | 5866 |
self installAutoloadedClassesFromStream:abbrevStream. |
13531
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
5867 |
] |
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
5868 |
|
19911 | 5869 |
" |
5870 |
self installAutoloadedClassesFromAbbrevFile:('../../goodies/communication/abbrev.stc' asFilename) |
|
5871 |
" |
|
22791 | 5872 |
|
13531
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
5873 |
"Created: / 29-07-2011 / 20:39:21 / cg" |
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
5874 |
! |
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
5875 |
|
10641 | 5876 |
installAutoloadedClassesFromStream:anAbbrevFileStream |
5877 |
"read the given abbreviation file; |
|
5878 |
install all classes found there as autoloaded, and also update the |
|
5879 |
abbreviation (className-to-fileName mapping) table. |
|
5880 |
This takes some time ..." |
|
5881 |
||
5882 |
|s2 l abbrevFileName info clsName cls abbrev package cat numClassInstVars words w| |
|
5883 |
||
5884 |
anAbbrevFileStream isFileStream ifTrue:[ |
|
22791 | 5885 |
abbrevFileName := anAbbrevFileStream pathName. |
5886 |
info := 'declared from: ', abbrevFileName. |
|
10641 | 5887 |
]. |
5888 |
||
5889 |
"/ yes, create any required nameSpace, without asking user. |
|
5890 |
Class createNameSpaceQuerySignal answer:true do:[ |
|
5891 |
||
22791 | 5892 |
[anAbbrevFileStream atEnd] whileFalse:[ |
5893 |
l := anAbbrevFileStream nextLine withoutSeparators. |
|
5894 |
"Skip empty lines and comments" |
|
5895 |
(l notEmpty and:[l first ~= $#]) ifTrue:[ |
|
5896 |
"/ must do it manually, caring for quoted strings. |
|
10641 | 5897 |
"/ words := line asCollectionOfWords. |
5898 |
||
22791 | 5899 |
words := OrderedCollection new. |
5900 |
s2 := l readStream. |
|
5901 |
[s2 atEnd] whileFalse:[ |
|
5902 |
s2 skipSeparators. |
|
5903 |
s2 peek == $' ifTrue:[ |
|
5904 |
s2 next. |
|
5905 |
w := s2 upTo:$'. |
|
5906 |
s2 skipSeparators. |
|
5907 |
] ifFalse:[ |
|
5908 |
w := s2 upToSeparator |
|
5909 |
]. |
|
5910 |
words add:w |
|
5911 |
]. |
|
5912 |
words size < 3 ifTrue:[ |
|
5913 |
'Smalltalk [warning]: bad abbrev entry' errorPrint. |
|
5914 |
anAbbrevFileStream isFileStream ifTrue:[ |
|
5915 |
' (in ''' errorPrint. |
|
5916 |
anAbbrevFileStream pathName errorPrint. |
|
5917 |
''')' errorPrint |
|
5918 |
]. |
|
5919 |
': ' errorPrint. l errorPrintCR |
|
5920 |
] ifFalse:[ |
|
5921 |
clsName := (words at:1) asSymbol. |
|
5922 |
abbrev := (words at:2). |
|
5923 |
package := (words at:3) asSymbol. |
|
5924 |
cat := words at:4 ifAbsent:nil. |
|
5925 |
numClassInstVars := words at:5 ifAbsent:'0'. |
|
5926 |
numClassInstVars := Integer readFrom:numClassInstVars onError:[0]. |
|
5927 |
||
5928 |
(cat size == 0) ifTrue:[ |
|
5929 |
cat := 'autoloaded' |
|
5930 |
]. |
|
5931 |
||
5932 |
"/ on the fly, update the abbreviations |
|
5933 |
self setFilename:abbrev forClass:clsName package:package. |
|
5934 |
||
5935 |
"/ ' autoloaded: ' print. clsName print. ' in ' print. cat printCR. |
|
5936 |
||
5937 |
cls := self |
|
5938 |
installAutoloadedClassNamed:clsName |
|
5939 |
category:cat |
|
5940 |
package:package |
|
5941 |
revision:nil |
|
5942 |
numClassInstVars:numClassInstVars. |
|
10641 | 5943 |
|
5944 |
"/ info notNil ifTrue:[ |
|
5945 |
"/ cls setComment:info. |
|
5946 |
"/ ]. |
|
22791 | 5947 |
] |
5948 |
] |
|
5949 |
] |
|
4458 | 5950 |
] |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5951 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5952 |
|
10641 | 5953 |
loadBinaries |
5954 |
"return true, if binaries should be loaded into the system, |
|
5955 |
false if this should be suppressed. The default is false (for now)." |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5956 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5957 |
^ LoadBinaries |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5958 |
! |
3044 | 5959 |
|
10641 | 5960 |
loadBinaries:aBoolean |
5961 |
"{ Pragma: +optSpace }" |
|
5962 |
||
5963 |
"turn on/off loading of binary objects" |
|
5964 |
||
5965 |
aBoolean ifTrue:[ |
|
18668 | 5966 |
(ObjectFileLoader notNil and:[ObjectFileLoader canLoadObjectFiles]) ifTrue:[ |
5967 |
LoadBinaries := true. |
|
5968 |
^ self |
|
5969 |
]. |
|
5970 |
'Smalltalk [info]: this system does not support binary loading' infoPrintCR. |
|
10641 | 5971 |
]. |
5972 |
LoadBinaries := false |
|
5973 |
||
5974 |
"Modified: 10.1.1997 / 15:11:00 / cg" |
|
5975 |
! |
|
5976 |
||
5977 |
logDoits |
|
5978 |
"return true if doits should go into the changes file |
|
5979 |
as well as changes - by default, this is off, since |
|
5980 |
it can blow up the changes file enormously ... |
|
5981 |
" |
|
5982 |
||
5983 |
^ LogDoits |
|
5984 |
||
5985 |
" |
|
5986 |
LogDoits := false |
|
3044 | 5987 |
LogDoits := true |
5988 |
" |
|
5989 |
! |
|
5990 |
||
10641 | 5991 |
logDoits:aBoolean |
5992 |
"{ Pragma: +optSpace }" |
|
5993 |
||
5994 |
"turn on/off logging of doits in the changes file. |
|
5995 |
By default, this is off, since it can blow up the |
|
5996 |
changes file enormously ... |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5997 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5998 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5999 |
LogDoits := aBoolean |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6000 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6001 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6002 |
|
10641 | 6003 |
makeBytecodeMethods |
6004 |
"{ Pragma: +optSpace }" |
|
6005 |
||
6006 |
"walk over all methods and make each a bytecode method |
|
6007 |
iff it does not contain primitive C code. |
|
6008 |
Experimental and not yet used." |
|
6009 |
||
6010 |
Method allSubInstancesDo:[:aMethod | |
|
22791 | 6011 |
|newMethod| |
6012 |
||
6013 |
aMethod hasPrimitiveCode ifFalse:[ |
|
18707 | 6014 |
"/ aMethod errorPrintCR. |
22791 | 6015 |
newMethod := aMethod asByteCodeMethod. |
6016 |
newMethod ~~ aMethod ifTrue:[ |
|
6017 |
newMethod isNil ifTrue:[ |
|
6018 |
'Smalltalk>>makeBytecodeMethods could nor recompile: ' errorPrint. aMethod errorPrintCR. |
|
6019 |
] ifFalse:[ |
|
6020 |
aMethod becomeSameAs:newMethod |
|
6021 |
]. |
|
6022 |
] |
|
6023 |
]. |
|
10641 | 6024 |
]. |
6025 |
||
6026 |
" |
|
6027 |
Smalltalk makeBytecodeMethods |
|
6028 |
" |
|
6029 |
||
6030 |
"Modified: 16.1.1997 / 01:25:58 / cg" |
|
6031 |
"Created: 17.10.1997 / 13:52:19 / cg" |
|
6032 |
! |
|
6033 |
||
14269
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6034 |
recursiveInstallAutoloadedClassesFrom:aTopDirectory |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6035 |
"scan all packages and install all classes found there as |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6036 |
autoloaded. This takes some time ..." |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6037 |
|
23408 | 6038 |
self recursiveInstallAutoloadedClassesFrom:aTopDirectory maxLevels:15 |
14269
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6039 |
|
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6040 |
" |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6041 |
Smalltalk recursiveInstallAutoloadedClassesFrom:'..\..\..\cg\private\euler' |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6042 |
" |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6043 |
|
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6044 |
"Created: / 31-07-2012 / 15:27:40 / cg" |
23408 | 6045 |
"Modified: / 09-10-2018 / 11:10:25 / Claus Gittinger" |
6046 |
! |
|
6047 |
||
6048 |
recursiveInstallAutoloadedClassesFrom:aTopDirectory maxLevels:maxLevels |
|
6049 |
"scan all packages and install all classes found there as |
|
6050 |
autoloaded. This takes some time ..." |
|
6051 |
||
6052 |
|dirsConsulted| |
|
6053 |
||
6054 |
dirsConsulted := Set new. |
|
6055 |
||
6056 |
self |
|
6057 |
recursiveInstallAutoloadedClassesFrom:aTopDirectory |
|
6058 |
rememberIn:dirsConsulted |
|
6059 |
maxLevels:maxLevels |
|
6060 |
noAutoload:false |
|
6061 |
packageTop:nil |
|
6062 |
showSplashInLevels:-1. |
|
6063 |
||
6064 |
" |
|
6065 |
Smalltalk recursiveInstallAutoloadedClassesFrom:'..\..\..\cg\private\euler' |
|
6066 |
" |
|
6067 |
||
6068 |
"Created: / 09-10-2018 / 11:10:06 / Claus Gittinger" |
|
14269
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6069 |
! |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6070 |
|
10641 | 6071 |
recursiveInstallAutoloadedClassesFrom:aDirectory rememberIn:dirsConsulted maxLevels:maxLevels noAutoload:noAutoloadIn packageTop:packageTopPath |
6072 |
"read all abbrev.stc files from and under aDirectory |
|
6073 |
and install autoloaded classes. |
|
15783 | 6074 |
If a file called NOAUTOLOAD is found, no classes there are installed as autoloaded, |
6075 |
but classes in subdirectories are installed, if the subdirectory contains a file |
|
6076 |
named AUTOLOAD. |
|
6077 |
If a file called NOSUBAUTOLOAD is found, no classes there and below are installed as autoloaded. |
|
10641 | 6078 |
If a file called NOPACKAGES is found, no further searching is done in that directory or below." |
6079 |
||
11391 | 6080 |
self |
18668 | 6081 |
recursiveInstallAutoloadedClassesFrom:aDirectory rememberIn:dirsConsulted |
6082 |
maxLevels:maxLevels noAutoload:noAutoloadIn packageTop:packageTopPath |
|
6083 |
showSplashInLevels:0. |
|
11391 | 6084 |
|
6085 |
" |
|
6086 |
Smalltalk installAutoloadedClasses |
|
6087 |
" |
|
6088 |
||
6089 |
"Modified: / 17-08-2006 / 16:48:43 / cg" |
|
6090 |
! |
|
6091 |
||
12022 | 6092 |
recursiveInstallAutoloadedClassesFrom:aDirectory rememberIn:dirsConsulted |
11391 | 6093 |
maxLevels:maxLevels noAutoload:noAutoloadIn packageTop:packageTopPath |
6094 |
showSplashInLevels:showSplashInLevels |
|
6095 |
"read all abbrev.stc files from and under aDirectory |
|
6096 |
and install autoloaded classes. |
|
15783 | 6097 |
If a file called NOAUTOLOAD is found, no classes there are installed as autoloaded, |
6098 |
but classes in subdirectories are installed, if the subdirectory contains a file |
|
6099 |
named AUTOLOAD. |
|
6100 |
If a file called NOSUBAUTOLOAD is found, no classes there and below are installed as autoloaded. |
|
11391 | 6101 |
If a file called NOPACKAGES is found, no further searching is done in that directory or below." |
6102 |
||
15783 | 6103 |
|dir noAutoloadHere dirName directoryContents haveAbbrevDotSTC| |
10641 | 6104 |
|
6105 |
dir := aDirectory asFilename. |
|
15958 | 6106 |
|
6107 |
"/ Care for non-existent directories" |
|
6108 |
dir exists ifFalse:[ ^ self ]. |
|
6109 |
||
15783 | 6110 |
dirName := dir physicalPathName. "take care of symbolic links" |
11392 | 6111 |
|
6112 |
(dirsConsulted includes:dirName) ifTrue:[ |
|
22791 | 6113 |
^ self |
10641 | 6114 |
]. |
6115 |
||
12377 | 6116 |
(dir / 'NOPACKAGES') exists ifTrue:[ |
22791 | 6117 |
^ self. |
10641 | 6118 |
]. |
12377 | 6119 |
(dir / 'NOSUBAUTOLOAD') exists ifTrue:[ |
22791 | 6120 |
^ self. |
10641 | 6121 |
]. |
11392 | 6122 |
|
15783 | 6123 |
maxLevels == 0 ifTrue:[ |
22791 | 6124 |
Transcript showCR:('Autoload: max directory nesting reached in %1' bindWith:dir pathName). |
6125 |
^ self |
|
15783 | 6126 |
]. |
6127 |
||
6128 |
dirsConsulted add:dirName. |
|
10641 | 6129 |
noAutoloadHere := noAutoloadIn. |
6130 |
noAutoloadHere ifFalse:[ |
|
22791 | 6131 |
(dir / 'NOAUTOLOAD') exists ifTrue:[ |
6132 |
noAutoloadHere := true. |
|
6133 |
]. |
|
10641 | 6134 |
] ifTrue:[ |
22791 | 6135 |
(dir / 'AUTOLOAD') exists ifTrue:[ |
6136 |
noAutoloadHere := false. |
|
6137 |
]. |
|
10641 | 6138 |
]. |
6139 |
||
11393 | 6140 |
showSplashInLevels >= 0 ifTrue:[ |
22791 | 6141 |
self showSplashMessage:('Smalltalk [info]: installing autoloaded classes found under "%1"...' |
6142 |
bindWith:(dirName contractAtBeginningTo:35)). |
|
11392 | 6143 |
]. |
6144 |
||
10641 | 6145 |
"/ |
6146 |
"/ suppress installation as autoloaded in this and everything |
|
6147 |
"/ below; however, still traverse the directories to find packages ... |
|
6148 |
"/ |
|
15596 | 6149 |
haveAbbrevDotSTC := false. |
10641 | 6150 |
noAutoloadHere ifFalse:[ |
22791 | 6151 |
[ |
6152 |
self installAutoloadedClassesFromAbbrevFile:(dir / 'abbrev.stc'). |
|
6153 |
haveAbbrevDotSTC := true. |
|
6154 |
] on:FileStream openErrorSignal |
|
6155 |
do:[:ex| |
|
6156 |
"ignore this file" |
|
6157 |
]. |
|
10641 | 6158 |
]. |
6159 |
||
6160 |
[ |
|
22791 | 6161 |
directoryContents := dir directoryContents. |
10641 | 6162 |
] on:FileStream openErrorSignal do:[:ex| |
22791 | 6163 |
"non-accessible directory: we are done" |
6164 |
^ self |
|
16199 | 6165 |
]. |
6166 |
||
6167 |
directoryContents := directoryContents select:[:fn | (fn startsWith:'.') not] as:Set. |
|
10641 | 6168 |
|
12911
0822e257daeb
comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents:
12883
diff
changeset
|
6169 |
directoryContents removeAllFoundIn:#( |
22791 | 6170 |
'objbc' 'objvc' 'objmingw' |
6171 |
'doc' |
|
6172 |
'CVS' |
|
6173 |
'bitmaps' |
|
6174 |
'resources' |
|
6175 |
'source' |
|
6176 |
'not_delivered' |
|
6177 |
'not_ported' |
|
6178 |
). |
|
12911
0822e257daeb
comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents:
12883
diff
changeset
|
6179 |
dir baseName = 'stx' ifTrue:[ |
22791 | 6180 |
directoryContents removeAllFoundIn:#( |
6181 |
'configurations' |
|
6182 |
'include' |
|
6183 |
'rules' |
|
6184 |
'stc' |
|
6185 |
'support' |
|
6186 |
). |
|
12911
0822e257daeb
comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents:
12883
diff
changeset
|
6187 |
]. |
0822e257daeb
comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents:
12883
diff
changeset
|
6188 |
|
0822e257daeb
comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents:
12883
diff
changeset
|
6189 |
directoryContents do:[:eachFilenameString | |
22791 | 6190 |
|f| |
6191 |
||
6192 |
f := dir / eachFilenameString. |
|
6193 |
f isDirectory ifTrue:[ |
|
6194 |
self |
|
6195 |
recursiveInstallAutoloadedClassesFrom:f |
|
6196 |
rememberIn:dirsConsulted |
|
6197 |
maxLevels:maxLevels-1 |
|
6198 |
noAutoload:noAutoloadHere |
|
6199 |
packageTop:packageTopPath |
|
6200 |
showSplashInLevels:showSplashInLevels - 1. |
|
6201 |
] ifFalse:[ |
|
6202 |
(noAutoloadHere not and:[haveAbbrevDotSTC not]) ifTrue:[ |
|
6203 |
f suffix = 'st' ifTrue:[ |
|
6204 |
[ |
|
6205 |
self installAutoloadedClassFromSourceFile:f. |
|
6206 |
f directory baseName = 'libbasic' ifTrue:[self halt]. |
|
6207 |
] on:FileStream openErrorSignal do:[:ex| |
|
6208 |
"ignore this file, but write a warning" |
|
6209 |
Transcript showCR:('Autoload: cannot install %1. (%2)' bindWith:f pathName with:ex description). |
|
6210 |
]. |
|
6211 |
] |
|
6212 |
]. |
|
6213 |
] |
|
10641 | 6214 |
]. |
6215 |
||
11393 | 6216 |
showSplashInLevels >= 0 ifTrue:[ |
22791 | 6217 |
self showSplashMessage:('Smalltalk [info]: installing autoloaded classes from "%1"...' |
6218 |
bindWith:(dirName contractAtBeginningTo:35)). |
|
11392 | 6219 |
]. |
6220 |
||
10641 | 6221 |
" |
6222 |
Smalltalk installAutoloadedClasses |
|
6223 |
" |
|
6224 |
||
15596 | 6225 |
"Modified: / 01-08-2013 / 16:57:49 / cg" |
10641 | 6226 |
! |
6227 |
||
6228 |
replaceReferencesTo:anObject with:newRef |
|
12194
208afdcf182b
comment/format in: #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
12172
diff
changeset
|
6229 |
"if the receiver refers to the argument, anObject, replace this reference with newRef. |
208afdcf182b
comment/format in: #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
12172
diff
changeset
|
6230 |
Return true, if any reference was changed. |
208afdcf182b
comment/format in: #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
12172
diff
changeset
|
6231 |
Notice: this does not change the class-reference." |
208afdcf182b
comment/format in: #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
12172
diff
changeset
|
6232 |
|
10641 | 6233 |
|toAdd| |
6234 |
||
6235 |
toAdd := OrderedCollection new. |
|
6236 |
self keysAndValuesDo:[:key :val | |
|
18668 | 6237 |
(key == anObject) ifTrue:[ |
6238 |
self shouldImplement. |
|
6239 |
]. |
|
6240 |
(val == anObject ) ifTrue:[ |
|
6241 |
toAdd add:(key -> newRef) |
|
6242 |
]. |
|
10641 | 6243 |
]. |
6244 |
toAdd do:[:each | |
|
18668 | 6245 |
self at:(each key) put:(each value) |
10641 | 6246 |
]. |
6247 |
! |
|
6248 |
||
6249 |
saveEmergencyImage:aBoolean |
|
6250 |
"set/clear the flag which controls if ST/X should save an |
|
6251 |
emergency image in case of a broken display connection. |
|
6252 |
The default is true. |
|
6253 |
This may be useful, if you work with an unsecure display |
|
6254 |
(serial line), and want to have a chance of proceeding after |
|
6255 |
a crash. In multiheaded applications, this only affects |
|
6256 |
crashes of the master Display connection (the initial connection); |
|
6257 |
errors on other displays are reported to the views and treated |
|
6258 |
like window destroy from the windowManager." |
|
6259 |
||
6260 |
SaveEmergencyImage := aBoolean |
|
6261 |
||
6262 |
"Modified: / 24.10.1997 / 18:22:26 / cg" |
|
6263 |
! |
|
6264 |
||
6265 |
systemOrganization |
|
6266 |
"for partial ST80 compatibility; |
|
6267 |
In ST80, Smalltalk organization returns a systemOrganizer, which |
|
6268 |
keeps track of class-categories, while all classes return a classOrganizer |
|
6269 |
from #organization, which keeps track of method categories of that class. |
|
6270 |
Since in ST/X, Smalltalk is a class, there is now a conflict. |
|
6271 |
To make a workaround possible, use #systemOrganization when porting |
|
6272 |
VW apps to ST/X to get the class-categories. |
|
6273 |
Read the documentation in SystemOrganizer for more info." |
|
6274 |
||
6275 |
^ SystemOrganizer for:nil |
|
6276 |
||
6277 |
"Created: / 20.6.1998 / 12:24:02 / cg" |
|
6278 |
"Modified: / 20.6.1998 / 12:41:34 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6279 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6280 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6281 |
!Smalltalk class methodsFor:'system management-fileIn'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6282 |
|
23419 | 6283 |
fileIn:aFileNameOrString |
10641 | 6284 |
"read in the named file - look for it in some standard places; |
6285 |
return true if ok, false if failed. |
|
6286 |
This method can load almost anything which makes sense: |
|
23419 | 6287 |
.st - source files |
6288 |
.cls - binary smalltalk bytecode files |
|
6289 |
.so - binary compiled machine code class libraries |
|
6290 |
[.class - java bytecode -- soon to come]" |
|
6291 |
||
6292 |
^ self fileIn:aFileNameOrString lazy:nil silent:nil logged:false |
|
10641 | 6293 |
|
6294 |
" |
|
6295 |
Smalltalk fileIn:'source/TicTacToe.st' |
|
6296 |
Smalltalk fileIn:'binary/TicTacToe.cls' |
|
6297 |
Smalltalk fileIn:'binary/TicTacToe.so' |
|
6298 |
" |
|
6299 |
||
6300 |
"Created: 28.10.1995 / 17:06:28 / cg" |
|
6301 |
! |
|
6302 |
||
6303 |
fileIn:aFileName inPackage:aPackageID |
|
6304 |
"read in the named file in a packages directory." |
|
6305 |
||
6306 |
|dir| |
|
6307 |
||
6308 |
dir := self getPackageDirectoryForPackage:aPackageID. |
|
6309 |
dir isNil ifTrue:[^ false]. |
|
6310 |
||
6311 |
dir := dir asFilename. |
|
6312 |
^ (self fileIn:(dir construct:aFileName)) |
|
6313 |
or:[ self fileIn:((dir construct:'source') construct:aFileName) ] |
|
6314 |
! |
|
6315 |
||
6316 |
fileIn:aFileName lazy:lazy |
|
6317 |
"read in the named file - look for it in some standard places; |
|
6318 |
return true if ok, false if failed. |
|
6319 |
If lazy is true, no code is generated for methods, instead stubs |
|
6320 |
are created which compile themself when first executed. This allows |
|
6321 |
for much faster fileIn (but slows down the first execution later). |
|
6322 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
6323 |
code which is known to be syntactically correct." |
|
6324 |
||
6325 |
^ self fileIn:aFileName lazy:lazy silent:nil logged:false |
|
6326 |
||
6327 |
" |
|
6328 |
Smalltalk fileIn:'source/TicTacToe.st' lazy:true |
|
6329 |
" |
|
6330 |
||
6331 |
"Created: 28.10.1995 / 17:06:36 / cg" |
|
6332 |
! |
|
6333 |
||
6334 |
fileIn:aFileName lazy:lazy silent:silent |
|
6335 |
"read in the named file - look for it in some standard places; |
|
6336 |
return true if ok, false if failed. |
|
6337 |
If lazy is true, no code is generated for methods, instead stubs |
|
6338 |
are created which compile themself when first executed. This allows |
|
6339 |
for much faster fileIn (but slows down the first execution later). |
|
6340 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
6341 |
code which is known to be syntactically correct. |
|
6342 |
If silent is true, no compiler messages are output to the transcript. |
|
6343 |
Giving nil for silent/lazy will use the current settings." |
|
6344 |
||
6345 |
^ self fileIn:aFileName lazy:lazy silent:silent logged:false |
|
6346 |
||
6347 |
"Created: 28.10.1995 / 17:06:41 / cg" |
|
6348 |
! |
|
6349 |
||
6350 |
fileIn:aFileNameOrString lazy:lazy silent:silent logged:logged |
|
6351 |
"read in the named file - look for it in some standard places; |
|
6352 |
return true if ok, false if failed. |
|
6353 |
If lazy is true, no code is generated for methods, instead stubs |
|
6354 |
are created which compile themself when first executed. This allows |
|
6355 |
for much faster fileIn (but slows down the first execution later). |
|
6356 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
6357 |
code which is known to be syntactically correct. |
|
6358 |
If silent is true, no compiler messages are output to the transcript. |
|
6359 |
Giving nil for silent/lazy will use the current settings. |
|
6360 |
This method can load almost anything which makes sense: |
|
22791 | 6361 |
.st - source files |
6362 |
.cls - binary smalltalk bytecode files |
|
6363 |
.so - binary compiled machine code class libraries |
|
6364 |
[.class - java bytecode -- soon to come]" |
|
15594 | 6365 |
|
15665 | 6366 |
|fileNameString inStream path morePath bos| |
10641 | 6367 |
|
6368 |
fileNameString := aFileNameOrString asString. |
|
6369 |
||
6370 |
" |
|
6371 |
an object or shared object ? |
|
6372 |
" |
|
6373 |
(ObjectFileLoader notNil |
|
22691 | 6374 |
and:[ObjectFileLoader hasValidBinaryExtension:fileNameString]) ifTrue:[ |
22791 | 6375 |
"/ LoadBinaries ifFalse:[^ false]. |
6376 |
path := self getBinaryFileName:fileNameString. |
|
6377 |
path isNil ifTrue:[ |
|
6378 |
path := self getSystemFileName:fileNameString. |
|
6379 |
path isNil ifTrue:[ |
|
6380 |
^ false |
|
6381 |
]. |
|
6382 |
]. |
|
6383 |
^ (ObjectFileLoader loadObjectFile:path) notNil |
|
15594 | 6384 |
]. |
6385 |
||
6386 |
inStream := self systemFileStreamFor:fileNameString. |
|
6387 |
inStream isNil ifTrue:[^ false]. |
|
10641 | 6388 |
|
22691 | 6389 |
(aFileNameOrString asFilename hasSuffix:'cls') ifTrue:[ |
22791 | 6390 |
BinaryObjectStorage isNil ifTrue:[ |
6391 |
^ false. |
|
6392 |
]. |
|
6393 |
[ |
|
6394 |
inStream binary. |
|
6395 |
bos := BinaryObjectStorage onOld:inStream. |
|
6396 |
bos next. |
|
6397 |
] ensure:[ |
|
6398 |
bos close. |
|
6399 |
]. |
|
6400 |
^ true |
|
15594 | 6401 |
]. |
10641 | 6402 |
|
6403 |
(fileNameString includes:$/) ifTrue:[ |
|
22791 | 6404 |
"/ temporarily prepend the file's directory |
6405 |
"/ to the searchPath. |
|
6406 |
"/ This allows fileIn-driver files to refer to local |
|
6407 |
"/ files via a relative path, and drivers to fileIn other |
|
6408 |
"/ drivers ... |
|
6409 |
morePath := inStream fileName directoryName. |
|
15594 | 6410 |
]. |
15665 | 6411 |
^ self fileInStream:inStream lazy:lazy silent:silent logged:logged addPath:morePath |
15594 | 6412 |
|
6413 |
" |
|
6414 |
Smalltalk fileIn:'clients/TicTacToe/TicTacToe.st' lazy:true silent:true |
|
6415 |
Smalltalk fileIn:'keyboard.rc' |
|
10641 | 6416 |
" |
6417 |
||
6418 |
"Modified: / 08-09-2006 / 19:21:16 / cg" |
|
22691 | 6419 |
"Modified: / 23-04-2018 / 17:05:33 / stefan" |
10641 | 6420 |
! |
6421 |
||
6422 |
fileIn:aFileName logged:logged |
|
6423 |
"read in the named file - look for it in some standard places; |
|
6424 |
return true if ok, false if failed. |
|
6425 |
The argument logged controls, if the changefile is to be updated." |
|
6426 |
||
6427 |
^ self fileIn:aFileName lazy:nil silent:nil logged:logged |
|
6428 |
||
6429 |
" |
|
6430 |
Smalltalk fileIn:'source/TicTacToe.st' logged:false |
|
6431 |
" |
|
6432 |
! |
|
6433 |
||
6434 |
fileIn:aFileName silent:silent |
|
6435 |
"read in the named file - look for it in some standard places; |
|
6436 |
return true if ok, false if failed. |
|
6437 |
If silent is true, no compiler messages are output to the transcript." |
|
6438 |
||
6439 |
^ self fileIn:aFileName lazy:nil silent:silent logged:false |
|
6440 |
||
6441 |
" |
|
6442 |
Smalltalk fileIn:'source/TicTacToe.st' silent:true |
|
6443 |
" |
|
6444 |
||
6445 |
"Created: 28.10.1995 / 17:06:36 / cg" |
|
6446 |
! |
|
6447 |
||
6448 |
fileInChanges |
|
6449 |
"read in the last changes file - bringing the system to the state it |
|
6450 |
had when left the last time. |
|
6451 |
WARNING: this method is rubbish: it should only read things after the |
|
18668 | 6452 |
last '**snapshot**' - entry |
6453 |
(instead of the complete changes file)." |
|
10641 | 6454 |
|
6455 |
" |
|
6456 |
do NOT update the changes file now ... |
|
6457 |
" |
|
6458 |
self fileIn:ChangeFileName logged:false |
|
6459 |
||
6460 |
" |
|
10071 | 6461 |
Smalltalk fileInChanges |
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 |
! |
1 | 6464 |
|
10641 | 6465 |
fileInClass:aClassName |
6466 |
"find a source/object file for aClassName and -if found - load it. |
|
6467 |
search is in some standard places trying driver-file (.ld), object-file (.o) and |
|
6468 |
finally source file (.st) in that order. |
|
6469 |
The file is first searched for using the class name, then the abbreviated name." |
|
6470 |
||
6471 |
^ self |
|
18668 | 6472 |
fileInClass:aClassName |
6473 |
package:nil |
|
6474 |
initialize:true |
|
6475 |
lazy:false |
|
6476 |
silent:nil |
|
10641 | 6477 |
|
6478 |
"Modified: / 9.1.1998 / 14:41:46 / cg" |
|
6479 |
! |
|
6480 |
||
6481 |
fileInClass:aClassName fromObject:aFileName |
|
6482 |
"read in the named object file and dynamic-link it into the system |
|
6483 |
- look for it in some standard places. |
|
6484 |
Only install the named class from this object file. |
|
6485 |
Return true if ok, false if failed." |
|
6486 |
||
6487 |
|path ok| |
|
6488 |
||
6489 |
" |
|
6490 |
check if the dynamic loader class is in |
|
6491 |
" |
|
6492 |
(LoadBinaries not or:[ObjectFileLoader isNil]) ifTrue:[^ false]. |
|
6493 |
||
6494 |
(path := self getBinaryFileName:aFileName) isNil ifTrue:[^ false]. |
|
6495 |
ok := (ObjectFileLoader loadClass:aClassName fromObjectFile:path) notNil. |
|
6496 |
ok ifTrue:[ |
|
18668 | 6497 |
VerboseLoading ifTrue:[ |
6498 |
Transcript show:' loaded ' , aClassName , ' from ' ; showCR:aFileName. |
|
6499 |
] |
|
10641 | 6500 |
]. |
6501 |
^ ok |
|
6502 |
||
6503 |
" |
|
6504 |
Smalltalk fileInClass:'AbstractPath' fromObject:'../../goodies/Paths/AbstrPath.so' |
|
6505 |
Smalltalk fileInClass:'ClockView' fromObject:'../../libwidg3/libwidg3.so' |
|
6506 |
" |
|
6507 |
||
13814 | 6508 |
"Modified: / 04-11-2011 / 13:42:24 / cg" |
10641 | 6509 |
! |
6510 |
||
6511 |
fileInClass:aClassName initialize:doInit |
|
6512 |
"find a source/object file for aClassName and -if found - load it. |
|
6513 |
search is in some standard places trying driver-file (.ld), object-file (.o) and |
|
6514 |
finally source file (.st) in that order. |
|
6515 |
The file is first searched for using the class name, then the abbreviated name." |
|
6516 |
||
6517 |
^ self |
|
18668 | 6518 |
fileInClass:aClassName |
6519 |
package:nil |
|
6520 |
initialize:doInit |
|
6521 |
lazy:false |
|
6522 |
silent:nil |
|
10641 | 6523 |
|
6524 |
"Modified: / 9.1.1998 / 14:42:02 / cg" |
|
6525 |
! |
|
6526 |
||
6527 |
fileInClass:aClassName initialize:doInit lazy:loadLazy |
|
6528 |
"find a source/object file for aClassName and -if found - load it. |
|
6529 |
search is in some standard places trying driver-file (.ld), object-file (.o) and |
|
6530 |
finally source file (.st) in that order. |
|
6531 |
The file is first searched for using the class name, then the abbreviated name." |
|
6532 |
||
6533 |
^ self |
|
18668 | 6534 |
fileInClass:aClassName |
6535 |
package:nil |
|
6536 |
initialize:doInit |
|
6537 |
lazy:loadLazy |
|
6538 |
silent:nil |
|
10641 | 6539 |
|
6540 |
"Modified: / 9.1.1998 / 14:42:19 / cg" |
|
6541 |
! |
|
6542 |
||
6543 |
fileInClass:aClassName initialize:doInit lazy:loadLazy silent:beSilent |
|
6544 |
"find a source/object file for aClassName and -if found - load it. |
|
6545 |
Search is in some standard places, trying driver-file (.ld), object-file (.so / .o) and |
|
6546 |
finally source file (.st), in that order. |
|
6547 |
The file is first searched for using the class name, then the abbreviated name. |
|
6548 |
The argument doInit controlls if the class should be sent a #initialize after the |
|
19867 | 6549 |
load; loadLazy tells if it should be loaded lazily. beSilent tells if the compiler |
10641 | 6550 |
should not send notes to the transcript; it can be true, false or nil, where |
6551 |
nil uses the value from SilentLoading." |
|
6552 |
||
6553 |
^ self |
|
22791 | 6554 |
fileInClass:aClassName |
6555 |
package:nil |
|
6556 |
initialize:doInit |
|
6557 |
lazy:loadLazy |
|
6558 |
silent:beSilent |
|
10641 | 6559 |
|
6560 |
"Modified: / 9.1.1998 / 14:42:28 / cg" |
|
6561 |
! |
|
6562 |
||
6563 |
fileInClass:aClassName package:package |
|
6564 |
"find a source/object file for aClassName and -if found - load it. |
|
6565 |
search is in some standard places trying driver-file (.ld), object-file (.o) and |
|
6566 |
finally source file (.st) in that order. |
|
6567 |
The file is first searched for using the class name, then the abbreviated name." |
|
6568 |
||
6569 |
^ self |
|
18668 | 6570 |
fileInClass:aClassName |
6571 |
package:package |
|
6572 |
initialize:true |
|
6573 |
lazy:false |
|
6574 |
silent:nil |
|
10641 | 6575 |
|
6576 |
"Created: / 08-01-2007 / 10:06:09 / cg" |
|
6577 |
! |
|
6578 |
||
10999 | 6579 |
fileInClass:aClassName package:package initialize:doInit lazy:loadLazy silent:beSilent |
10641 | 6580 |
"find a source/object file for aClassName and -if found - load it. |
6581 |
This is the workhorse for autoloading. |
|
10999 | 6582 |
Search is in some standard places, trying driver-file (.ld), object-file (.so / .o) and |
10641 | 6583 |
finally source file (.st), in that order. |
6584 |
The file is first searched for using the class name, then the abbreviated name. |
|
6585 |
The argument doInit controlls if the class should be sent a #initialize after the |
|
19867 | 6586 |
load; loadLazy tells if it should be loaded lazily. beSilent tells if the compiler |
10641 | 6587 |
should not send notes to the transcript; it can be true, false or nil, where |
6588 |
nil uses the value from SilentLoading." |
|
6589 |
||
22955 | 6590 |
|classFileName alternativeClassFileName libName newClass ok wasLazy wasSilent sharedLibSuffix inStream mgr |
10641 | 6591 |
filenameToSet packageDir packageFile bos| |
6592 |
||
17588 | 6593 |
ClassLoadInProgressQuery answerNotifyLoading:aClassName do:[ |
17582 | 6594 |
|
22955 | 6595 |
wasLazy := Compiler compileLazy:loadLazy. |
6596 |
beSilent notNil ifTrue:[ |
|
6597 |
wasSilent := self silentLoading:beSilent. |
|
6598 |
]. |
|
6599 |
||
6600 |
classFileName := Smalltalk fileNameForClass:aClassName. |
|
6601 |
(classFileName = aClassName) ifTrue:[ |
|
6602 |
"/ no abbrev.stc translation for className |
|
6603 |
(aClassName includes:$:) ifTrue:[ |
|
6604 |
"/ a nameSpace name |
|
6605 |
alternativeClassFileName := classFileName copyFrom:(classFileName lastIndexOf:$:)+1 |
|
6606 |
]. |
|
6607 |
]. |
|
6608 |
||
6609 |
classFileName asFilename isAbsolute ifTrue:[ |
|
6610 |
classFileName asFilename suffix notEmptyOrNil ifTrue:[ |
|
6611 |
ok := self fileIn:classFileName lazy:loadLazy silent:beSilent. |
|
6612 |
] ifFalse:[ |
|
6613 |
ok := self fileInSourceFile:classFileName lazy:loadLazy silent:beSilent. |
|
6614 |
] |
|
6615 |
] ifFalse:[ |
|
6616 |
classFileName := classFileName copyReplaceAll:$: with:$_ ifNone:classFileName. |
|
6617 |
[ |
|
6618 |
Class withoutUpdatingChangesDo:[ |
|
6619 |
|zarFn zar entry| |
|
6620 |
||
6621 |
ok := false. |
|
6622 |
||
6623 |
package notNil ifTrue:[ |
|
6624 |
packageDir := package asPackageId packageDirectory. |
|
6625 |
"/ packageDir := package asString. |
|
6626 |
"/ packageDir := packageDir copyReplaceAll:$: with:$/. |
|
6627 |
packageDir isNil ifTrue:[ |
|
6628 |
packageDir := self packageDirectoryForPackageId:package |
|
6629 |
]. |
|
6630 |
packageDir notNil ifTrue:[ |
|
6631 |
packageDir := packageDir asFilename. |
|
6632 |
]. |
|
6633 |
]. |
|
6634 |
||
6635 |
Class packageQuerySignal answer:package do:[ |
|
6636 |
" |
|
6637 |
then, if dynamic linking is available, |
|
6638 |
" |
|
6639 |
(LoadBinaries and:[ObjectFileLoader notNil]) ifTrue:[ |
|
6640 |
sharedLibSuffix := ObjectFileLoader sharedLibrarySuffix. |
|
6641 |
" |
|
6642 |
first look for a class packages shared binary in binary/xxx.o |
|
6643 |
" |
|
6644 |
libName := self libraryFileNameOfClass:aClassName. |
|
6645 |
libName notNil ifTrue:[ |
|
6646 |
(ok := self fileInClass:aClassName fromObject:(libName asFilename withSuffix:sharedLibSuffix) name) |
|
6647 |
ifFalse:[ |
|
6648 |
sharedLibSuffix ~= 'o' ifTrue:[ |
|
6649 |
ok := self fileInClass:aClassName fromObject:(libName, '.o') |
|
6650 |
] |
|
6651 |
]. |
|
6652 |
]. |
|
6653 |
" |
|
6654 |
then, look for a shared binary in binary/xxx.o |
|
6655 |
" |
|
6656 |
ok ifFalse:[ |
|
6657 |
(ok := self fileInClass:aClassName fromObject:(classFileName asFilename withSuffix:sharedLibSuffix) name) |
|
6658 |
ifFalse:[ |
|
6659 |
sharedLibSuffix ~= 'o' ifTrue:[ |
|
6660 |
ok := self fileInClass:aClassName fromObject:(classFileName, '.o') |
|
6661 |
]. |
|
6662 |
ok ifFalse:[ |
|
6663 |
alternativeClassFileName notNil ifTrue:[ |
|
6664 |
(ok := self fileInClass:aClassName fromObject:(alternativeClassFileName asFilename withSuffix:sharedLibSuffix) name) |
|
6665 |
ifFalse:[ |
|
6666 |
sharedLibSuffix ~= 'o' ifTrue:[ |
|
6667 |
ok := self fileInClass:aClassName fromObject:(alternativeClassFileName, '.o') |
|
6668 |
] |
|
6669 |
] |
|
6670 |
]. |
|
6671 |
]. |
|
6672 |
]. |
|
6673 |
]. |
|
6674 |
]. |
|
6675 |
||
6676 |
" |
|
6677 |
if that did not work, look for a compiled-bytecode file ... |
|
6678 |
" |
|
6679 |
ok ifFalse:[ |
|
6680 |
(ok := self fileIn:(classFileName , '.cls') lazy:loadLazy silent:beSilent) |
|
6681 |
ifFalse:[ |
|
6682 |
alternativeClassFileName notNil ifTrue:[ |
|
6683 |
ok := self fileIn:(alternativeClassFileName , '.cls') lazy:loadLazy silent:beSilent |
|
6684 |
] |
|
6685 |
] |
|
6686 |
]. |
|
6687 |
" |
|
6688 |
if that did not work, and the classes package is known, |
|
6689 |
look for an st-cls file |
|
6690 |
in a package subdir of the source-directory ... |
|
6691 |
" |
|
6692 |
ok ifFalse:[ |
|
6693 |
(packageDir notNil and:[BinaryObjectStorage notNil]) ifTrue:[ |
|
6694 |
packageFile := self getPackageFileName:((packageDir / 'classes' / classFileName) addSuffix:'cls'). |
|
6695 |
packageFile isNil ifTrue:[ |
|
6696 |
packageFile := (packageDir / 'classes' / classFileName) addSuffix:'cls'. |
|
6697 |
]. |
|
6698 |
(ok := self fileIn:packageFile lazy:loadLazy silent:beSilent) |
|
6699 |
ifFalse:[ |
|
6700 |
alternativeClassFileName notNil ifTrue:[ |
|
6701 |
packageFile := self getPackageFileName:((packageDir / 'classes' / alternativeClassFileName) addSuffix:'cls'). |
|
6702 |
packageFile isNil ifTrue:[ |
|
6703 |
packageFile := ((packageDir / 'classes' / alternativeClassFileName) addSuffix:'cls'). |
|
6704 |
]. |
|
6705 |
ok := self fileIn:packageFile lazy:loadLazy silent:beSilent |
|
6706 |
] |
|
6707 |
]. |
|
6708 |
||
6709 |
zarFn := self getPackageFileName:(packageDir / 'classes.zip'). |
|
6710 |
zarFn notNil ifTrue:[ |
|
6711 |
zar := ZipArchive oldFileNamed:zarFn. |
|
6712 |
zar notNil ifTrue:[ |
|
6713 |
entry := zar extract:(classFileName , '.cls'). |
|
6714 |
(entry isNil and:[alternativeClassFileName notNil]) ifTrue:[ |
|
6715 |
entry := zar extract:(alternativeClassFileName , '.cls'). |
|
6716 |
]. |
|
6717 |
entry notNil ifTrue:[ |
|
6718 |
bos := BinaryObjectStorage onOld:(entry asByteArray readStream). |
|
6719 |
bos next. |
|
6720 |
bos close. |
|
6721 |
ok := true |
|
6722 |
]. |
|
6723 |
] |
|
6724 |
] |
|
6725 |
] |
|
6726 |
]. |
|
6727 |
||
6728 |
" |
|
6729 |
if that did not work, look for an st-source file ... |
|
6730 |
" |
|
6731 |
ok ifFalse:[ |
|
6732 |
filenameToSet := classFileName. |
|
6733 |
(ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent) |
|
6734 |
ifFalse:[ |
|
6735 |
alternativeClassFileName notNil ifTrue:[ |
|
6736 |
filenameToSet := alternativeClassFileName. |
|
6737 |
ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent |
|
6738 |
]. |
|
6739 |
ok ifFalse:[ |
|
6740 |
" |
|
6741 |
... and in the standard source-directory |
|
6742 |
" |
|
6743 |
filenameToSet := 'source' asFilename / classFileName. |
|
6744 |
(ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent) |
|
6745 |
ifFalse:[ |
|
6746 |
alternativeClassFileName notNil ifTrue:[ |
|
6747 |
filenameToSet := 'source' asFilename / alternativeClassFileName. |
|
6748 |
ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent |
|
6749 |
] |
|
6750 |
] |
|
6751 |
] |
|
6752 |
]. |
|
6753 |
" |
|
6754 |
if that did not work, and the classes package is known, |
|
6755 |
look for an st-source file |
|
6756 |
in a package subdir of the source-directory ... |
|
6757 |
" |
|
6758 |
ok ifFalse:[ |
|
6759 |
packageDir notNil ifTrue:[ |
|
6760 |
packageFile := self getPackageSourceFileName:(packageDir / 'source' / classFileName). |
|
6761 |
packageFile isNil ifTrue:[ |
|
6762 |
packageFile := (packageDir / 'source' / classFileName). |
|
6763 |
]. |
|
6764 |
filenameToSet := packageFile. |
|
6765 |
(ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent) |
|
6766 |
ifFalse:[ |
|
6767 |
alternativeClassFileName notNil ifTrue:[ |
|
6768 |
packageFile := self getPackageSourceFileName:(packageDir / 'source' / alternativeClassFileName). |
|
6769 |
packageFile isNil ifTrue:[ |
|
6770 |
packageFile := (packageDir / 'source' / alternativeClassFileName). |
|
6771 |
]. |
|
6772 |
filenameToSet := packageFile. |
|
6773 |
ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent |
|
6774 |
]. |
|
6775 |
ok ifFalse:[ |
|
6776 |
packageFile := self getPackageSourceFileName:(packageDir / classFileName). |
|
6777 |
packageFile isNil ifTrue:[ |
|
6778 |
packageFile := (packageDir / classFileName). |
|
6779 |
]. |
|
6780 |
filenameToSet := packageFile. |
|
6781 |
(ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent) |
|
6782 |
ifFalse:[ |
|
6783 |
alternativeClassFileName notNil ifTrue:[ |
|
6784 |
packageFile := self getPackageFileName:(packageDir / alternativeClassFileName). |
|
6785 |
packageFile isNil ifTrue:[ |
|
6786 |
packageFile := packageDir / alternativeClassFileName. |
|
6787 |
]. |
|
6788 |
filenameToSet := packageFile. |
|
6789 |
ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent |
|
6790 |
]. |
|
6791 |
ok ifFalse:[ |
|
6792 |
" |
|
6793 |
... and in the standard source-directory |
|
6794 |
" |
|
6795 |
filenameToSet := 'source' asFilename / packageDir / classFileName. |
|
6796 |
(ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent) |
|
6797 |
ifFalse:[ |
|
6798 |
alternativeClassFileName notNil ifTrue:[ |
|
6799 |
filenameToSet := 'source' asFilename / packageDir / alternativeClassFileName. |
|
6800 |
ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent |
|
6801 |
] |
|
6802 |
] |
|
6803 |
] |
|
6804 |
]. |
|
6805 |
]. |
|
6806 |
]. |
|
6807 |
] |
|
6808 |
]. |
|
6809 |
" |
|
6810 |
if that did not work, and the classes package is known, |
|
6811 |
look for a zipArchive containing a class entry. |
|
6812 |
" |
|
6813 |
ok ifFalse:[ |
|
6814 |
packageDir notNil ifTrue:[ |
|
6815 |
zarFn := self getPackageFileName:(packageDir / 'source.zip'). |
|
6816 |
zarFn isNil ifTrue:[ |
|
6817 |
zarFn := packageDir withSuffix:'zip'. |
|
6818 |
zarFn := self getSourceFileName:zarFn. |
|
6819 |
]. |
|
6820 |
(zarFn notNil and:[zarFn asFilename exists]) ifTrue:[ |
|
6821 |
zar := ZipArchive oldFileNamed:zarFn. |
|
6822 |
zar notNil ifTrue:[ |
|
6823 |
entry := zar extract:(classFileName , '.st'). |
|
6824 |
(entry isNil and:[alternativeClassFileName notNil]) ifTrue:[ |
|
6825 |
entry := zar extract:(alternativeClassFileName , '.st'). |
|
6826 |
]. |
|
6827 |
entry notNil ifTrue:[ |
|
6828 |
filenameToSet := zarFn. |
|
6829 |
ok := self |
|
6830 |
fileInStream:(entry asString readStream) |
|
6831 |
lazy:loadLazy |
|
6832 |
silent:beSilent |
|
6833 |
logged:false |
|
6834 |
addPath:nil |
|
6835 |
]. |
|
6836 |
] |
|
6837 |
] |
|
6838 |
] |
|
6839 |
]. |
|
6840 |
||
6841 |
" |
|
6842 |
if that did not work, |
|
6843 |
look for a zipArchive containing a class entry. |
|
6844 |
" |
|
6845 |
ok ifFalse:[ |
|
6846 |
zarFn := self getSourceFileName:'source.zip'. |
|
6847 |
zarFn notNil ifTrue:[ |
|
6848 |
zar := ZipArchive oldFileNamed:zarFn. |
|
6849 |
zar notNil ifTrue:[ |
|
6850 |
entry := zar extract:(zarFn := classFileName , '.st'). |
|
6851 |
(entry isNil and:[alternativeClassFileName notNil]) ifTrue:[ |
|
6852 |
entry := zar extract:(zarFn := alternativeClassFileName , '.st'). |
|
6853 |
]. |
|
6854 |
entry notNil ifTrue:[ |
|
6855 |
filenameToSet := zarFn. |
|
6856 |
ok := self |
|
6857 |
fileInStream:(entry asString readStream) |
|
6858 |
lazy:loadLazy |
|
6859 |
silent:beSilent |
|
6860 |
logged:false |
|
6861 |
addPath:nil |
|
6862 |
]. |
|
6863 |
] |
|
6864 |
] |
|
6865 |
]. |
|
6866 |
ok ifFalse:[ |
|
6867 |
" |
|
6868 |
if there is a sourceCodeManager, ask it for the classes sourceCode |
|
6869 |
" |
|
6870 |
(mgr := Smalltalk at:#SourceCodeManager) notNil ifTrue:[ |
|
6871 |
inStream := mgr getMostRecentSourceStreamForClassNamed:aClassName inPackage:package. |
|
6872 |
inStream notNil ifTrue:[ |
|
6873 |
filenameToSet := nil. |
|
6874 |
ok := self fileInStream:inStream lazy:loadLazy silent:beSilent logged:false addPath:nil. |
|
6875 |
] |
|
6876 |
]. |
|
6877 |
]. |
|
6878 |
]. |
|
6879 |
] |
|
6880 |
]. |
|
6881 |
] ensure:[ |
|
6882 |
Compiler compileLazy:wasLazy. |
|
6883 |
wasSilent notNil ifTrue:[ |
|
6884 |
self silentLoading:wasSilent |
|
6885 |
] |
|
6886 |
]. |
|
6887 |
]. |
|
6888 |
||
6889 |
ok ifTrue:[ |
|
6890 |
newClass := self at:(aClassName asSymbol). |
|
6891 |
newClass notNil ifTrue:[ |
|
6892 |
"set the classes name - but do not change if already set" |
|
6893 |
filenameToSet notNil ifTrue:[ |
|
6894 |
newClass getClassFilename isNil ifTrue:[ |
|
6895 |
newClass setClassFilename:(filenameToSet asFilename baseName) |
|
6896 |
]. |
|
6897 |
]. |
|
6898 |
||
6899 |
doInit ifTrue:[ |
|
6900 |
newClass initialize |
|
6901 |
] |
|
6902 |
] |
|
6903 |
]. |
|
10641 | 6904 |
]. |
6905 |
||
6906 |
^ newClass |
|
6907 |
||
13415 | 6908 |
"Created: / 09-01-1998 / 14:40:32 / cg" |
6909 |
"Modified: / 05-06-1999 / 14:53:01 / cg" |
|
6910 |
"Modified: / 16-08-2009 / 14:52:53 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
10641 | 6911 |
! |
6912 |
||
6913 |
fileInClassLibrary:aClassLibraryName |
|
6914 |
"find an object file containing a binary class library in some standard places |
|
6915 |
and load it. This install all of its contained classes. |
|
6916 |
Return true if ok, false if not. |
|
6917 |
Notice: the argument may not have an extension (by purpose); |
|
18668 | 6918 |
the sharedLib extension (.dll / .so / .sl) is added here, to |
6919 |
make the caller independent of the underlying operatingSystem." |
|
10641 | 6920 |
|
6921 |
|path fn| |
|
6922 |
||
16144 | 6923 |
ObjectFileLoader isNil ifTrue:[ |
18668 | 6924 |
^ PackageLoadError raiseRequestWith:aClassLibraryName errorString:' - no ObjectFileLoader'. |
16144 | 6925 |
]. |
10641 | 6926 |
|
6927 |
fn := aClassLibraryName asFilename withSuffix:(ObjectFileLoader sharedLibrarySuffix). |
|
6928 |
fn := fn pathName. |
|
6929 |
||
6930 |
path := self getBinaryFileName:fn. |
|
6931 |
path isNil ifTrue:[ |
|
18668 | 6932 |
path := self getSystemFileName:fn. |
16144 | 6933 |
]. |
6934 |
path isNil ifTrue:[ |
|
18668 | 6935 |
^ PackageNotFoundError raiseRequestWith:aClassLibraryName. |
16144 | 6936 |
]. |
6937 |
||
6938 |
(ObjectFileLoader loadObjectFile:path) isNil ifTrue:[ |
|
18668 | 6939 |
^ PackageLoadError raiseRequestWith:aClassLibraryName. |
16144 | 6940 |
]. |
6941 |
^ true. |
|
6942 |
||
10641 | 6943 |
|
6944 |
" |
|
6945 |
Smalltalk fileInClassLibrary:'libtable' |
|
6946 |
Smalltalk fileInClassLibrary:'binary/libwidg3' |
|
6947 |
" |
|
6948 |
||
6949 |
"Modified: 8.1.1997 / 17:58:56 / cg" |
|
6950 |
! |
|
6951 |
||
6952 |
fileInClassLibrary:aClassLibraryName inPackage:packageID |
|
6953 |
"find an object file containing a binary class library in some standard places |
|
6954 |
and load it. This installs all of its contained classes. |
|
6955 |
Return true if ok, false if not. |
|
6956 |
Notice: the argument may not have an extension (by purpose); |
|
23177 | 6957 |
the sharedLib extension (.dll / .so / .sl) is added here, to |
6958 |
make the caller independent of the underlying operatingSystem." |
|
11689
d08d5db473c5
Find windows DLLs under package\objbc in development environment
Stefan Vogel <sv@exept.de>
parents:
11681
diff
changeset
|
6959 |
|
11690 | 6960 |
|baseName handle libraryFilename packagePath| |
10641 | 6961 |
|
16144 | 6962 |
ObjectFileLoader isNil ifTrue:[ |
23177 | 6963 |
^ PackageLoadError raiseRequestWith:packageID errorString:' - no ObjectFileLoader' |
16144 | 6964 |
]. |
10641 | 6965 |
|
6966 |
baseName := aClassLibraryName asFilename withSuffix:(ObjectFileLoader sharedLibrarySuffix). |
|
6967 |
baseName exists ifTrue:[ |
|
23177 | 6968 |
"/ load local file first... |
6969 |
handle := ObjectFileLoader loadObjectFile:baseName. |
|
12744
80f6da0fee57
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
12700
diff
changeset
|
6970 |
]. |
80f6da0fee57
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
12700
diff
changeset
|
6971 |
handle isNil ifTrue:[ |
23177 | 6972 |
packagePath := self getPackageDirectoryForPackage:packageID. |
6973 |
packagePath isNil ifTrue:[ |
|
6974 |
^ PackageNotFoundError raiseRequestWith:packageID. |
|
6975 |
]. |
|
6976 |
libraryFilename := ObjectFileLoader binaryClassFilenameForPackage:packageID inDirectory:packagePath. |
|
6977 |
(libraryFilename notNil and:[libraryFilename exists]) ifTrue:[ |
|
6978 |
handle := ObjectFileLoader loadObjectFile:libraryFilename pathName. |
|
6979 |
]. |
|
16144 | 6980 |
]. |
6981 |
||
6982 |
handle isNil ifTrue:[ |
|
23177 | 6983 |
^ PackageNotFoundError raiseRequestWith:packageID. |
16144 | 6984 |
]. |
12744
80f6da0fee57
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
12700
diff
changeset
|
6985 |
"/ handle notNil ifTrue:[ |
80f6da0fee57
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
12700
diff
changeset
|
6986 |
"/ Transcript showCR:(' Smalltalk: loaded %1.' bindWith:libraryFilename pathName). |
80f6da0fee57
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
12700
diff
changeset
|
6987 |
"/ ]. |
16144 | 6988 |
^ true. |
10641 | 6989 |
|
6990 |
" |
|
6991 |
Smalltalk fileInClassLibrary:'libtable' |
|
6992 |
Smalltalk fileInClassLibrary:'binary/libwidg3' |
|
6993 |
Smalltalk fileInClassLibrary:'refactoryBrowser' inPackage:'stx:goodies/refactoryBrowser' |
|
6994 |
" |
|
6995 |
||
13787
1695a24d0fa7
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
13785
diff
changeset
|
6996 |
"Modified: / 08-10-2011 / 00:08:51 / cg" |
23177 | 6997 |
"Modified: / 02-07-2018 / 14:19:16 / Stefan Vogel" |
10641 | 6998 |
! |
6999 |
||
15073 | 7000 |
fileInSourceFile:filenameArg lazy:loadLazy silent:beSilent |
18560 | 7001 |
"Try all available programming languages for a matching suffix" |
13415 | 7002 |
|
15073 | 7003 |
|filename| |
7004 |
||
7005 |
filename := filenameArg asFilename. |
|
18668 | 7006 |
"/ ProgrammingLanguage allDo:[:lang| |
18572
b088a44b9681
\"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents:
18560
diff
changeset
|
7007 |
"/ | f | |
b088a44b9681
\"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents:
18560
diff
changeset
|
7008 |
"/ |
21338 | 7009 |
"/ "/ cg: changed: did try all languages to load (eg. whether suffix matched or not. |
18572
b088a44b9681
\"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents:
18560
diff
changeset
|
7010 |
"/ "/ I don't think, that is a good idea, as all of them languages might start parsing... |
b088a44b9681
\"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents:
18560
diff
changeset
|
7011 |
"/ (filename hasSuffix:lang sourceFileSuffix) ifTrue:[ |
b088a44b9681
\"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents:
18560
diff
changeset
|
7012 |
"/ (self fileIn:f lazy:loadLazy silent:beSilent) ifTrue:[ |
b088a44b9681
\"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents:
18560
diff
changeset
|
7013 |
"/ ^ true |
b088a44b9681
\"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents:
18560
diff
changeset
|
7014 |
"/ ]. |
b088a44b9681
\"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents:
18560
diff
changeset
|
7015 |
"/ ] |
b088a44b9681
\"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents:
18560
diff
changeset
|
7016 |
"/ ]. |
b088a44b9681
\"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents:
18560
diff
changeset
|
7017 |
"/ revert to old code to get stuff running again- please review - (autoload problems) |
b088a44b9681
\"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents:
18560
diff
changeset
|
7018 |
ProgrammingLanguage allDo:[:lang| | f | |
22791 | 7019 |
f := (filename hasSuffix:lang sourceFileSuffix) |
7020 |
ifTrue:[filename] |
|
7021 |
ifFalse:[filename addSuffix:lang sourceFileSuffix]. |
|
7022 |
(self fileIn:f lazy:loadLazy silent:beSilent) |
|
7023 |
ifTrue:[^ true] |
|
18572
b088a44b9681
\"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents:
18560
diff
changeset
|
7024 |
]. |
b088a44b9681
\"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents:
18560
diff
changeset
|
7025 |
|
15073 | 7026 |
^ false |
13415 | 7027 |
|
7028 |
"Created: / 16-08-2009 / 14:45:41 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
7029 |
! |
|
7030 |
||
10641 | 7031 |
fileInStream:streamArg |
7032 |
^ self fileInStream:streamArg lazy:nil silent:nil logged:false addPath:nil |
|
7033 |
! |
|
7034 |
||
7035 |
fileInStream:streamArg lazy:lazy silent:silent logged:logged addPath:morePath |
|
7036 |
"read sourceCode from aStream; |
|
7037 |
return true if ok, false if failed. |
|
7038 |
If lazy is true, no code is generated for methods, instead stubs |
|
7039 |
are created which compile themself when first executed. This allows |
|
7040 |
for much faster fileIn (but slows down the first execution later). |
|
7041 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
7042 |
code which is known to be syntactically correct. |
|
7043 |
If silent is true, no compiler messages are output to the transcript. |
|
7044 |
Giving nil for silent/lazy will use the current settings. |
|
7045 |
If morePath is nonNil, it is prepended to the systemPath temporarily during the |
|
7046 |
fileIn. This allows for st-expressions to refer to more files (i.e. fileIn more) |
|
7047 |
using a relative path." |
|
7048 |
||
11427 | 7049 |
|inStream wasLazy wasSilent oldSystemPath oldRealPath| |
10641 | 7050 |
|
7051 |
inStream := streamArg. |
|
7052 |
inStream isNil ifTrue:[^ false]. |
|
19385 | 7053 |
inStream isLineNumberReadStream ifFalse:[ |
22791 | 7054 |
LineNumberReadStream notNil ifTrue:[ |
7055 |
"/ sigh - is in libbasic2, which is not always present |
|
7056 |
inStream := LineNumberReadStream on:inStream. |
|
7057 |
]. |
|
19385 | 7058 |
]. |
21458 | 7059 |
inStream := EncodedStream decodedStreamFor:inStream. |
10641 | 7060 |
|
7061 |
lazy notNil ifTrue:[wasLazy := Compiler compileLazy:lazy]. |
|
7062 |
silent notNil ifTrue:[wasSilent := self silentLoading:silent]. |
|
7063 |
morePath notNil ifTrue:[ |
|
22791 | 7064 |
oldSystemPath := SystemPath copy. |
7065 |
SystemPath addFirst:morePath. |
|
7066 |
oldRealPath := RealSystemPath. |
|
7067 |
RealSystemPath := nil. |
|
7068 |
]. |
|
7069 |
||
22703 | 7070 |
^ [ |
22791 | 7071 |
(Class updateChangeFileQuerySignal , Class updateChangeListQuerySignal) answer:logged do:[ |
7072 |
"JV: Changed to give ProgrammingLanguage to choose |
|
7073 |
proper reader" |
|
7074 |
((ProgrammingLanguage forStream: inStream) fileInStream: inStream) ~~ #Error |
|
7075 |
] |
|
10641 | 7076 |
] ensure:[ |
22791 | 7077 |
morePath notNil ifTrue:[ |
7078 |
"take care, someone could have changed SystemPath during fileIn!!" |
|
7079 |
(SystemPath copyFrom:2) = oldSystemPath ifTrue:[ |
|
7080 |
SystemPath := oldSystemPath. |
|
7081 |
RealSystemPath := oldRealPath. |
|
7082 |
] ifFalse:[ |
|
7083 |
(oldSystemPath includes:morePath) ifFalse:[ |
|
7084 |
SystemPath remove:morePath ifAbsent:[]. |
|
7085 |
]. |
|
7086 |
RealSystemPath := nil. |
|
7087 |
]. |
|
7088 |
]. |
|
7089 |
lazy notNil ifTrue:[Compiler compileLazy:wasLazy]. |
|
7090 |
silent notNil ifTrue:[self silentLoading:wasSilent]. |
|
7091 |
inStream close |
|
10641 | 7092 |
]. |
7093 |
||
7094 |
" |
|
7095 |
Smalltalk fileInStream:('source/TicTacToe.st' asFilename readStream) lazy:true silent:true |
|
7096 |
" |
|
7097 |
||
13415 | 7098 |
"Modified: / 05-11-1996 / 20:03:35 / cg" |
7099 |
"Modified: / 16-08-2009 / 11:06:05 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
22706 | 7100 |
"Modified: / 24-04-2018 / 23:50:22 / stefan" |
10641 | 7101 |
! |
7102 |
||
7103 |
isClassLibraryLoaded:name |
|
7104 |
"return true, if a particular class library is already loaded" |
|
7105 |
||
7106 |
ObjectMemory |
|
18668 | 7107 |
binaryModuleInfo |
7108 |
do:[:entry | |
|
7109 |
entry type == #classLibrary ifTrue:[ |
|
7110 |
entry libraryName = name ifTrue:[ |
|
7111 |
^ true "/ already loaded |
|
7112 |
] |
|
7113 |
]. |
|
7114 |
]. |
|
10641 | 7115 |
|
7116 |
^ false |
|
7117 |
||
7118 |
" |
|
7119 |
Smalltalk isClassLibraryLoaded:'libstx_libbasic' |
|
7120 |
Smalltalk isClassLibraryLoaded:'libstx_libwidg3' |
|
7121 |
Smalltalk isClassLibraryLoaded:'libstx_libboss' |
|
7122 |
" |
|
7123 |
||
7124 |
"Modified: / 23-08-2006 / 15:54:46 / cg" |
|
7125 |
! |
|
7126 |
||
7127 |
loadClassLibraryIfAbsent:name |
|
7128 |
"dynamically load a classLibrary, if not already loaded |
|
7129 |
and the system supports dynamic loading. |
|
7130 |
Return true, if the library is loaded, false if not. |
|
7131 |
This entry is called without system specific filename |
|
7132 |
extensions - it is portable among different architectures |
|
7133 |
as long as corresponding files (x.so / x.dll / x.sl / x.o) |
|
7134 |
are be present ..." |
|
7135 |
||
7136 |
(self isClassLibraryLoaded:name) ifTrue:[ ^ true ]. "/ already loaded |
|
7137 |
^ self fileInClassLibrary:name |
|
7138 |
||
7139 |
" |
|
7140 |
Smalltalk loadClassLibraryIfAbsent:'libbasic' |
|
7141 |
Smalltalk loadClassLibraryIfAbsent:'libwidg3' |
|
7142 |
" |
|
7143 |
||
7144 |
"Modified: 31.10.1996 / 16:57:24 / cg" |
|
7145 |
! |
|
7146 |
||
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7147 |
secureFileIn:aFileName |
10641 | 7148 |
"read in the named file, looking for it at standard places. |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7149 |
Catch various errors during fileIn. |
13000 | 7150 |
Return true if ok, false if failed" |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7151 |
|
22691 | 7152 |
Parser isNil ifTrue:[ |
22791 | 7153 |
^ false "/ for small stand alone apps. |
7154 |
]. |
|
22691 | 7155 |
|
7156 |
^ (SignalSet |
|
22791 | 7157 |
with:AbortOperationRequest |
7158 |
with:TerminateProcessRequest |
|
7159 |
with:ParseError) |
|
7160 |
handle:[:ex | ex return:false ] |
|
7161 |
do:[ self fileIn:aFileName ]. |
|
22691 | 7162 |
|
7163 |
"Modified: / 23-04-2018 / 16:53:29 / stefan" |
|
10641 | 7164 |
! |
7165 |
||
7166 |
silentFileIn:aFilename |
|
7167 |
"same as fileIn:, but do not output 'compiled...'-messages on Transcript. |
|
7168 |
Main use is during startup." |
|
7169 |
||
22691 | 7170 |
^ self silentlyLoadingDo:[ |
22791 | 7171 |
self fileIn:aFilename |
22691 | 7172 |
]. |
7173 |
||
7174 |
"Modified: / 23-04-2018 / 16:57:17 / stefan" |
|
3044 | 7175 |
! ! |
7176 |
||
7177 |
!Smalltalk class methodsFor:'system management-files'! |
|
7178 |
||
20663 | 7179 |
addIdeTopDirectoryToPackagePath |
7180 |
"{ Pragma: +optSpace }" |
|
7181 |
||
7182 |
|topDirectory| |
|
22791 | 7183 |
|
20663 | 7184 |
(topDirectory := OperatingSystem pathOfSTXExecutable) notNil ifTrue:[ |
22791 | 7185 |
topDirectory := topDirectory asFilename. |
7186 |
(topDirectory directory / 'stc') exists ifTrue:[ |
|
7187 |
topDirectory := topDirectory directory. |
|
7188 |
] ifFalse:[ |
|
7189 |
(topDirectory directory directory / 'stc') exists ifTrue:[ |
|
7190 |
topDirectory := topDirectory directory directory. |
|
7191 |
] ifFalse:[ |
|
7192 |
(topDirectory directory directory directory / 'stc') exists ifTrue:[ |
|
7193 |
topDirectory := topDirectory directory directory directory. |
|
7194 |
] ifFalse:[ |
|
7195 |
topDirectory := nil |
|
7196 |
]. |
|
7197 |
]. |
|
7198 |
]. |
|
7199 |
topDirectory notNil ifTrue:[ |
|
7200 |
"/ one above "stx" |
|
7201 |
topDirectory := topDirectory directory pathName. |
|
7202 |
(PackagePath includes:topDirectory) ifFalse:[ |
|
7203 |
PackagePath add:topDirectory |
|
7204 |
] |
|
7205 |
] |
|
20663 | 7206 |
]. |
7207 |
! |
|
7208 |
||
18868 | 7209 |
addWorkspaceDirectoryToPackagePath |
7210 |
"{ Pragma: +optSpace }" |
|
7211 |
||
7212 |
|workspaceDirectory| |
|
22791 | 7213 |
|
18868 | 7214 |
(workspaceDirectory := UserPreferences current workspaceDirectory) notNil ifTrue:[ |
22791 | 7215 |
(workspaceDirectory := workspaceDirectory asFilename) exists ifTrue:[ |
7216 |
workspaceDirectory := workspaceDirectory pathName. |
|
7217 |
(PackagePath includes:workspaceDirectory) ifFalse:[ |
|
7218 |
PackagePath addFirst:workspaceDirectory |
|
7219 |
] |
|
7220 |
] |
|
18868 | 7221 |
]. |
7222 |
! |
|
7223 |
||
10641 | 7224 |
bitmapFileStreamFor:aFileName |
7225 |
"search aFileName in some standard places; |
|
7226 |
return a readonly fileStream or nil if not found. |
|
7227 |
Searches in subdirectories named 'bitmaps' in the SystemPath. |
|
7228 |
Notice: this does not look in the package-specific bitmaps directories." |
|
7229 |
||
7230 |
|aString| |
|
7231 |
||
7232 |
aString := self getBitmapFileName:aFileName. |
|
7233 |
aString notNil ifTrue:[ |
|
18668 | 7234 |
^ aString asFilename readStreamOrNil |
10641 | 7235 |
]. |
7236 |
^ nil |
|
7237 |
! |
|
7238 |
||
7239 |
bitmapFromFileNamed:aFileName forClass:aClass |
|
7240 |
"backward compatibility: |
|
7241 |
search aFileName in some standard places: |
|
7242 |
first in the redefinable bitmaps path, |
|
7243 |
then in the classes own package directory if existing. |
|
7244 |
Return an image or nil." |
|
7245 |
||
7246 |
^ self imageFromFileNamed:aFileName forClass:aClass |
|
7247 |
||
7248 |
" |
|
7249 |
Smalltalk bitmapFromFileNamed:'SmalltalkX.xbm' forClass:View |
|
7250 |
" |
|
7251 |
! |
|
7252 |
||
7253 |
bitmapFromFileNamed:aFileName inPackage:aPackage |
|
7254 |
"backward compatibility: |
|
7255 |
search aFileName in some standard places: |
|
7256 |
first in the redefinable bitmaps path, |
|
7257 |
then in the package directory if existing. |
|
7258 |
Return an image or nil." |
|
7259 |
||
7260 |
^ self imageFromFileNamed:aFileName inPackage:aPackage |
|
7261 |
||
7262 |
" |
|
7263 |
Smalltalk bitmapFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libview' |
|
7264 |
Smalltalk bitmapFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libtool' |
|
7265 |
" |
|
7266 |
! |
|
7267 |
||
7268 |
classNameForFile:aFileName |
|
7269 |
"return the className which corresponds to an abbreviated fileName, |
|
7270 |
or nil if no special translation applies. The given filename arg may |
|
7271 |
include a '.st' suffix (but no other)." |
|
7272 |
||
7273 |
|fn| |
|
7274 |
||
7275 |
(aFileName asFilename hasSuffix:'st') ifTrue:[ |
|
18668 | 7276 |
fn := aFileName copyButLast:3 |
10641 | 7277 |
] ifFalse:[ |
18668 | 7278 |
fn := aFileName |
10641 | 7279 |
]. |
7280 |
^ self filenameAbbreviations keyAtEqualValue:fn ifAbsent:[fn]. |
|
7281 |
||
7282 |
" |
|
7283 |
Smalltalk classNameForFile:'DrawObj' |
|
7284 |
Smalltalk classNameForFile:'DrawObj.st' |
|
7285 |
Smalltalk classNameForFile:'ArrColl.st' |
|
7286 |
Smalltalk classNameForFile:'ArrColl.chg' |
|
7287 |
" |
|
7288 |
||
7289 |
"Modified: 11.12.1995 / 14:51:10 / cg" |
|
7290 |
! |
|
7291 |
||
7292 |
constructPathFor:aDirectoryName |
|
7293 |
"search for aDirectory in SystemPath; |
|
20294 | 7294 |
return a collection of paths which include that directory." |
10641 | 7295 |
|
7296 |
^ self realSystemPath select:[:dirName | |
|
22791 | 7297 |
|fullPath| |
7298 |
||
7299 |
fullPath := dirName asFilename construct:aDirectoryName. |
|
7300 |
"/ fullPath exists and:[fullPath isDirectory and:[fullPath isReadable]] |
|
7301 |
fullPath isDirectory and:[fullPath isReadable] |
|
10641 | 7302 |
]. |
7303 |
! |
|
7304 |
||
7305 |
fileInFileStreamFor:aFileName |
|
7306 |
"obsolete |
|
7307 |
search aFileName in some standard places; |
|
7308 |
return a readonly fileStream or nil if not found. |
|
7309 |
Searches in subdirectories named 'fileIn' in SystemPath" |
|
7310 |
||
7311 |
|aString| |
|
7312 |
||
7313 |
aString := self getFileInFileName:aFileName. |
|
7314 |
aString notNil ifTrue:[ |
|
18668 | 7315 |
^ aString asFilename readStreamOrNil |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7316 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7317 |
^ nil |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7318 |
! |
7758 | 7319 |
|
12022 | 7320 |
fileNameForClass:aClassOrClassName |
7321 |
"return a actual or expected (or most wanted) filename for aClassOrClassName |
|
7322 |
- only the base name (without directory part) and without suffix." |
|
7323 |
||
15958 | 7324 |
|cls nonMetaclass nm nameWithPrefix nameWithoutPrefix compatQuery compatPkg | |
12022 | 7325 |
|
12301 | 7326 |
"/ This was added as an extension of libsvn - should be no longer needed |
15958 | 7327 |
"/ JV@2012-09-25: but it actually is. The problem is that class filename |
7328 |
"/ is stored in the class itself and used to generate abbrev.stc and |
|
7329 |
"/ prerequisites in makefiles. But if you renamed such a stc-compiled class, |
|
7330 |
"/ the filename remains the same, but SVN __ALWAYS__ keep container name |
|
7331 |
"/ and class name in sync. Therefore build files gets messed up. Indeed, this |
|
7332 |
"/ should be fixed in code that files-out the package and generates build files. |
|
7333 |
"/ Certainly a hack, but do not remove this until fixed elsewhere |
|
7334 |
||
23414 | 7335 |
compatQuery := #'SVN::CompatModeQuery' asClassIfAbsent:nil. |
15958 | 7336 |
(compatQuery notNil |
7337 |
and:[compatQuery isLoaded |
|
23414 | 7338 |
and:[compatQuery query not]]) ifTrue:[ |
7339 |
nm := aClassOrClassName isBehavior |
|
7340 |
ifTrue:[aClassOrClassName name] |
|
7341 |
ifFalse:[aClassOrClassName]. |
|
7342 |
nm := nm copyReplaceAll:$: with:$_ ifNone:nm. |
|
7343 |
^nm |
|
15958 | 7344 |
]. |
7345 |
||
16122
18c865388947
Fix in Smalltalk>>#fileNameForClass: - required by libscm to support nested packages.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16117
diff
changeset
|
7346 |
"/ Same for another query for new libscm. Here we have to do |
18c865388947
Fix in Smalltalk>>#fileNameForClass: - required by libscm to support nested packages.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16117
diff
changeset
|
7347 |
"/ this only for packages that are being filed out and NOT for others. |
18c865388947
Fix in Smalltalk>>#fileNameForClass: - required by libscm to support nested packages.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16117
diff
changeset
|
7348 |
"/ The problem is that this method is also used for getting filenames |
18c865388947
Fix in Smalltalk>>#fileNameForClass: - required by libscm to support nested packages.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16117
diff
changeset
|
7349 |
"/ of classes OUTSIDE filed-out package when generating makefile dependencies. |
23414 | 7350 |
compatQuery := #'SCMCompatModeQuery' asClassIfAbsent:nil. |
15958 | 7351 |
(compatQuery notNil |
7352 |
and:[compatQuery isLoaded |
|
23414 | 7353 |
and:[(compatPkg := compatQuery query) notNil]]) ifTrue:[ |
7354 |
| compatPkgs | |
|
7355 |
"/ Originally libscm could only fileout one package at time so |
|
7356 |
"/ the query answered one package name. However, to support nested |
|
7357 |
"/ packages, libscm is being rewritten to commit multiple packages |
|
7358 |
"/ at once, so query answers a collection of packages. The code below |
|
7359 |
"/ makes sure it works for both. |
|
7360 |
compatPkgs := compatPkg isString ifTrue:[ Array with: compatPkg] ifFalse:[ compatPkg ]. |
|
7361 |
nm := aClassOrClassName isBehavior |
|
7362 |
ifTrue:[aClassOrClassName name] |
|
7363 |
ifFalse:[aClassOrClassName]. |
|
7364 |
cls := Smalltalk at: nm asSymbol. |
|
7365 |
(cls notNil and:[compatPkgs includes: cls package]) ifTrue:[ |
|
7366 |
nm := nm copyReplaceAll:$: with:$_. |
|
7367 |
^nm |
|
7368 |
]. |
|
15958 | 7369 |
]. |
12301 | 7370 |
|
12022 | 7371 |
aClassOrClassName isBehavior ifTrue:[ |
23414 | 7372 |
cls := aClassOrClassName. |
12022 | 7373 |
] ifFalse:[ |
23414 | 7374 |
cls := Smalltalk classNamed:aClassOrClassName. |
7375 |
cls isNil ifTrue:[ |
|
7376 |
nameWithPrefix := aClassOrClassName. |
|
7377 |
nameWithoutPrefix := (aClassOrClassName copyFrom:(aClassOrClassName lastIndexOf:$:)+1). |
|
7378 |
]. |
|
12022 | 7379 |
]. |
7380 |
||
7381 |
cls notNil ifTrue:[ |
|
23414 | 7382 |
nonMetaclass := cls theNonMetaclass. |
7383 |
nm := nonMetaclass getClassFilename. |
|
7384 |
nm isNil ifTrue:[ |
|
7385 |
|revisionInfo| |
|
7386 |
||
7387 |
(revisionInfo := cls revisionInfo) notNil ifTrue:[ |
|
7388 |
nm := revisionInfo fileName. |
|
7389 |
]. |
|
7390 |
]. |
|
7391 |
nm notNil ifTrue:[ |
|
7392 |
^ nm asFilename withoutSuffix baseName |
|
7393 |
]. |
|
7394 |
nameWithPrefix := nonMetaclass name. |
|
7395 |
nameWithoutPrefix := nonMetaclass nameWithoutPrefix. |
|
12022 | 7396 |
]. |
7397 |
||
7398 |
CachedAbbreviations notNil ifTrue:[ |
|
23414 | 7399 |
nameWithPrefix := nameWithPrefix asSymbol. |
7400 |
(CachedAbbreviations includesKey:nameWithPrefix) ifTrue:[ |
|
7401 |
^ (CachedAbbreviations at:nameWithPrefix) asFilename baseName |
|
7402 |
]. |
|
7403 |
nameWithoutPrefix := nameWithoutPrefix asSymbol. |
|
7404 |
(CachedAbbreviations includesKey:nameWithoutPrefix) ifTrue:[ |
|
7405 |
^ (CachedAbbreviations at:nameWithoutPrefix) asFilename baseName |
|
7406 |
]. |
|
12022 | 7407 |
]. |
7408 |
||
7409 |
^ nameWithPrefix copyReplaceAll:$: with:$_ |
|
7410 |
||
7411 |
" |
|
7412 |
Smalltalk fileNameForClass:#Complex |
|
7413 |
Smalltalk fileNameForClass:'SmallInteger' |
|
7414 |
Smalltalk fileNameForClass:'UnixOperatingSystem' |
|
7415 |
Smalltalk fileNameForClass:'Launcher' |
|
7416 |
Smalltalk fileNameForClass:'SomeUnknownClass' |
|
7417 |
||
7418 |
Smalltalk fileNameForClass:HTML::Encoder |
|
7419 |
Smalltalk fileNameForClass:OSI::FTAMOperation |
|
7420 |
Smalltalk fileNameForClass:'OSI::Foobar' |
|
7421 |
Smalltalk fileNameForClass:(Workflow::UnsuccessfulFinishReasons) |
|
7422 |
Workflow::UnsuccessfulFinishReasons classFilename |
|
7423 |
" |
|
7424 |
||
7425 |
"Modified: / 06-10-2006 / 16:16:01 / cg" |
|
16122
18c865388947
Fix in Smalltalk>>#fileNameForClass: - required by libscm to support nested packages.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16117
diff
changeset
|
7426 |
"Modified: / 23-02-2014 / 10:39:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
18c865388947
Fix in Smalltalk>>#fileNameForClass: - required by libscm to support nested packages.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16117
diff
changeset
|
7427 |
"Modified (comment): / 23-02-2014 / 12:39:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
23414 | 7428 |
"Modified: / 10-10-2018 / 00:44:07 / Claus Gittinger" |
12022 | 7429 |
! |
7430 |
||
10641 | 7431 |
filenameAbbreviations |
7432 |
"return a dictionary containing the classname-to-filename |
|
7433 |
mappings. (needed for sys5.3 users, where filenames are limited |
|
7434 |
to 14 chars)" |
|
7435 |
||
7436 |
CachedAbbreviations isNil ifTrue:[ |
|
18668 | 7437 |
self readAbbreviations |
10641 | 7438 |
]. |
7439 |
^ CachedAbbreviations |
|
7440 |
||
7441 |
"flush with: |
|
7442 |
||
7443 |
CachedAbbreviations := nil |
|
7444 |
" |
|
7445 |
" |
|
7446 |
Smalltalk filenameAbbreviations |
|
7447 |
" |
|
7448 |
! |
|
7449 |
||
13368 | 7450 |
findPackageDirectoryForPackage:aPackage |
7451 |
"find a packages directory along a number of standard places" |
|
7452 |
||
7453 |
|relDir| |
|
7454 |
||
7455 |
relDir := Smalltalk relativePackagePathForPackage:aPackage. |
|
7456 |
relDir asFilename isAbsolute ifTrue:[^ relDir]. |
|
7457 |
||
7458 |
^ Smalltalk getPackageFileName:relDir. |
|
7459 |
||
7460 |
" |
|
7461 |
Smalltalk findPackageDirectoryForPackage:'stx:libview/resources' |
|
7462 |
Smalltalk findPackageDirectoryForPackage:'stx:libview' |
|
7463 |
" |
|
7464 |
! |
|
7465 |
||
10641 | 7466 |
flushPathCaches |
7467 |
"{ Pragma: +optSpace }" |
|
7468 |
||
7469 |
"forget pathCaches - these are collections containing valid directory names, |
|
7470 |
where system files (resource, bitmaps etc.) are found. |
|
7471 |
A flush is only required, if a new system directory has been created while |
|
7472 |
the system is active, and those files should override the others |
|
7473 |
(for example, if you created a private resource directory)" |
|
7474 |
||
7475 |
RealSystemPath := ResourcePath := SourcePath := |
|
15332 | 7476 |
BinaryPath := FileInPath := nil. |
7477 |
||
10641 | 7478 |
" |
7479 |
Smalltalk flushPathCaches |
|
7480 |
" |
|
7481 |
! |
|
7482 |
||
7483 |
getBinaryFileName:aFileName |
|
7484 |
"obsolete |
|
7485 |
search aFileName in some standard places |
|
7486 |
(subdirectories named 'binary' in SystemPath); |
|
7487 |
return the absolute filename or nil if none is found." |
|
7488 |
||
7489 |
BinaryPath isNil ifTrue:[ |
|
18668 | 7490 |
BinaryPath := self constructPathFor:BinaryDirName |
10641 | 7491 |
]. |
7492 |
||
7493 |
^ self searchPath:BinaryPath for:aFileName in:BinaryDirName |
|
7494 |
||
7495 |
"Modified: 18.7.1996 / 15:53:49 / cg" |
|
7496 |
! |
|
7497 |
||
7498 |
getBitmapFileName:aFileName |
|
7499 |
"for backward compatibility: |
|
7500 |
search aFileName in some standard places |
|
7501 |
(subdirectories named 'bitmaps' in SystemPath); |
|
7502 |
Return the pathName or nil if none is found." |
|
7503 |
||
7504 |
^ self getBitmapFileName:aFileName forPackage:nil |
|
7505 |
||
7506 |
" |
|
7507 |
Smalltalk getBitmapFileName:'SBrowser.xbm' |
|
7508 |
" |
|
7509 |
||
7510 |
"Modified: 18.7.1996 / 15:53:55 / cg" |
|
7511 |
! |
|
7512 |
||
7513 |
getBitmapFileName:aFileName forPackage:aPackageIDOrNil |
|
7514 |
"for backward compatibility. |
|
7515 |
search aFileName in some standard places: |
|
7516 |
first in the redefinable bitmaps path, |
|
7517 |
then in the package directory if existing. |
|
7518 |
Return a path or nil. |
|
7519 |
Search order is: |
|
23433 | 7520 |
bitmaps/<pkg>/file |
7521 |
resources/<pkg>/bitmaps/file |
|
7522 |
<pkg>/bitmaps/file |
|
10641 | 7523 |
" |
7524 |
||
7525 |
|f dir packageDir pF| |
|
7526 |
||
15225 | 7527 |
f := aFileName asString withoutPrefix:'bitmaps/'. |
10641 | 7528 |
|
7529 |
aPackageIDOrNil isNil ifTrue:[ |
|
23433 | 7530 |
"/ this will be an error in the future |
10641 | 7531 |
"/ 'Smalltalk [warning]: bitmap file access without package: ' infoPrint. aFileName infoPrintCR. |
7532 |
"/ self halt. |
|
7533 |
||
23433 | 7534 |
pF := self searchPath:(self realSystemPath) for:aFileName in:('bitmaps'). |
7535 |
pF notNil ifTrue:[ |
|
7536 |
^ pF. |
|
7537 |
]. |
|
7538 |
f ~= aFileName ifTrue:[ |
|
7539 |
pF := self searchPath:(self realSystemPath) for:f in:('bitmaps'). |
|
7540 |
pF notNil ifTrue:[ |
|
7541 |
^ pF. |
|
7542 |
]. |
|
7543 |
]. |
|
7544 |
^ nil |
|
11077
14df4640ed89
image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents:
11057
diff
changeset
|
7545 |
]. |
14df4640ed89
image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents:
11057
diff
changeset
|
7546 |
|
14df4640ed89
image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents:
11057
diff
changeset
|
7547 |
dir := self projectDirectoryForPackage:aPackageIDOrNil. |
14df4640ed89
image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents:
11057
diff
changeset
|
7548 |
dir notNil ifTrue:[ |
23433 | 7549 |
pF := dir asFilename / f. |
7550 |
pF exists ifTrue:[ |
|
7551 |
^ pF. |
|
7552 |
]. |
|
7553 |
pF := dir asFilename / 'bitmaps' /f. |
|
7554 |
pF exists ifTrue:[ |
|
7555 |
^ pF. |
|
7556 |
]. |
|
10641 | 7557 |
]. |
7558 |
||
7559 |
packageDir := aPackageIDOrNil copyReplaceAll:$: with:$/. |
|
7560 |
||
7561 |
pF := self searchPath:(self realSystemPath) for:aFileName in:('bitmaps/',packageDir). |
|
7562 |
pF notNil ifTrue:[ |
|
23433 | 7563 |
^ pF. |
7564 |
]. |
|
7565 |
pF := self searchPath:(self realSystemPath) for:aFileName in:('.resources/',packageDir,'/bitmaps'). |
|
7566 |
pF notNil ifTrue:[ |
|
7567 |
^ pF. |
|
10641 | 7568 |
]. |
7569 |
pF := self searchPath:(self realSystemPath) for:aFileName in:('resources/',packageDir,'/bitmaps'). |
|
7570 |
pF notNil ifTrue:[ |
|
23433 | 7571 |
^ pF. |
11077
14df4640ed89
image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents:
11057
diff
changeset
|
7572 |
]. |
14df4640ed89
image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents:
11057
diff
changeset
|
7573 |
|
10641 | 7574 |
^ nil |
7575 |
||
7576 |
" |
|
7577 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libview' |
|
7578 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libtool' |
|
7579 |
Smalltalk imageFromFileNamed:'bitmaps/gifImages/garfield.gif' inPackage:'stx:goodies' |
|
7580 |
Smalltalk imageFromFileNamed:'CheckOn10_xp.xpm' inPackage:'stx:libwidg' |
|
7581 |
" |
|
7582 |
||
7583 |
"Modified: / 11-10-2006 / 13:53:18 / cg" |
|
7584 |
! |
|
7585 |
||
7586 |
getFileInFileName:aFileName |
|
7587 |
"obsolete |
|
7588 |
search aFileName in some standard places |
|
7589 |
(subdirectories named 'fileIn' in SystemPath); |
|
7590 |
return the absolute filename or nil if none is found." |
|
7591 |
||
7592 |
FileInPath isNil ifTrue:[ |
|
18668 | 7593 |
FileInPath := self constructPathFor:FileInDirName |
10641 | 7594 |
]. |
7595 |
||
7596 |
^ self searchPath:FileInPath for:aFileName in:FileInDirName |
|
7597 |
||
7598 |
"Modified: 18.7.1996 / 15:53:59 / cg" |
|
7599 |
! |
|
7600 |
||
7601 |
getPackageDirectoryForPackage:aPackageID |
|
7602 |
"search for a particular package; return its directory, or nil. |
|
7603 |
Stand alone applications might get nil, if there are only binaries installed." |
|
7604 |
||
19121 | 7605 |
|packageId checkForPackageDirectory module packageSubDirectory| |
7606 |
||
7607 |
packageId := aPackageID asPackageId. |
|
7608 |
module := packageId module. |
|
7609 |
packageSubDirectory := packageId directory. |
|
10641 | 7610 |
|
7611 |
checkForPackageDirectory := |
|
22791 | 7612 |
[:moduleDir | |
7613 |
|packageDir| |
|
7614 |
||
7615 |
moduleDir isDirectory ifTrue:[ |
|
7616 |
packageDir := moduleDir / packageSubDirectory. |
|
7617 |
packageDir isDirectory ifTrue:[ |
|
7618 |
^ packageDir |
|
7619 |
] |
|
7620 |
]. |
|
7621 |
]. |
|
10641 | 7622 |
|
7623 |
self packagePath do:[:aPath | |
|
22791 | 7624 |
|moduleDir| |
7625 |
||
7626 |
moduleDir := aPath asFilename / module. |
|
7627 |
checkForPackageDirectory value:moduleDir. |
|
10641 | 7628 |
]. |
7629 |
||
7630 |
^ nil |
|
7631 |
||
7632 |
" |
|
7633 |
Smalltalk getPackageDirectoryForPackage:(Array package) |
|
7634 |
Smalltalk getPackageDirectoryForPackage:'stx:goodies/bitmaps' |
|
7635 |
Smalltalk getPackageDirectoryForPackage:'stx:libview' |
|
7636 |
" |
|
7637 |
||
7638 |
"Modified: / 06-10-2006 / 11:49:27 / cg" |
|
7639 |
! |
|
7640 |
||
7641 |
getPackageFileName:aFileName |
|
7642 |
"search aFileName in some standard places |
|
7643 |
(packagePath and subdirectories named 'packages' in SystemPath); |
|
7644 |
return the absolute filename or nil if none is found." |
|
7645 |
||
7646 |
|f| |
|
7647 |
||
7648 |
"/ search along packagePath ... |
|
7649 |
f := self searchPath:self packagePath for:aFileName in:nil. |
|
7650 |
f isNil ifTrue:[ |
|
18668 | 7651 |
"/ search under packages-directory along systemPath ... |
7652 |
f := self searchPath:self realSystemPath for:aFileName in:PackageDirName. |
|
7653 |
"/ kludge - allow for stx-directory to be named differently |
|
7654 |
f isNil ifTrue:[ |
|
7655 |
(aFileName asString startsWith:('stx' , Filename separator)) ifTrue:[ |
|
7656 |
f := '..' asFilename / '..' / (aFileName copyFrom:5). |
|
7657 |
] |
|
7658 |
]. |
|
10641 | 7659 |
]. |
7660 |
(f notNil and:[(f := f asFilename) exists]) ifTrue:[ |
|
18668 | 7661 |
^ f pathName |
7758 | 7662 |
]. |
7663 |
^ nil |
|
10641 | 7664 |
|
7665 |
" |
|
16668
b88318df967d
flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents:
16666
diff
changeset
|
7666 |
Smalltalk getPackageFileName:'stx/libview/resources/normal.style' |
b88318df967d
flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents:
16666
diff
changeset
|
7667 |
Smalltalk getPackageFileName:'stx/libview/styles/normal.style' |
b88318df967d
flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents:
16666
diff
changeset
|
7668 |
Smalltalk getPackageFileName:'stx/libview/source.zip' |
10641 | 7669 |
" |
7670 |
! |
|
7671 |
||
15074 | 7672 |
getPackageSourceFileName:filenameWithoutSuffixArg |
13415 | 7673 |
"search aFileName in some standard places and try all available languages" |
7674 |
||
15074 | 7675 |
|filenameWithoutSuffix| |
7676 |
||
7677 |
filenameWithoutSuffix:= filenameWithoutSuffixArg asFilename. |
|
7678 |
||
16170
ca4d03def070
endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents:
16164
diff
changeset
|
7679 |
ProgrammingLanguage |
18668 | 7680 |
allDo:[:lang | |
7681 |
|file| |
|
7682 |
||
7683 |
file := self |
|
7684 |
getPackageFileName:(filenameWithoutSuffix addSuffix:lang sourceFileSuffix). |
|
7685 |
file notNil ifTrue:[ ^ file ] |
|
7686 |
]. |
|
15074 | 7687 |
^ nil |
13415 | 7688 |
|
7689 |
"Created: / 16-08-2009 / 14:44:58 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
7690 |
! |
|
7691 |
||
10641 | 7692 |
getResourceFileName:aFileName |
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7693 |
<resource: #obsolete> |
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7694 |
|
10641 | 7695 |
"search aFileName in some standard places |
7696 |
(subdirectories named 'resources' in SystemPath); |
|
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7697 |
return the absolute filename or nil if none is found. |
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7698 |
Obsolete: you must now provide a package argument." |
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7699 |
|
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7700 |
self obsoleteMethodWarning:'use getResourceFileName:forPackage:'. |
10641 | 7701 |
^ self getResourceFileName:aFileName forPackage:nil |
7702 |
||
7703 |
" |
|
7704 |
Smalltalk getResourceFileName:'SystemBrowser.rs' |
|
7705 |
" |
|
7706 |
||
7707 |
"Modified: 18.7.1996 / 15:54:03 / cg" |
|
7708 |
! |
|
7709 |
||
7710 |
getResourceFileName:aFileName forClass:aClassOrNil |
|
7711 |
"search aFileName in some standard places |
|
7712 |
(subdirectories named 'resource' in SystemPath); |
|
7713 |
and in aClasses package directory. |
|
7714 |
Return the absolute filename or nil if none is found." |
|
7715 |
||
7716 |
|pkgOrNil| |
|
7717 |
||
7718 |
aClassOrNil notNil ifTrue:[ |
|
18668 | 7719 |
pkgOrNil := aClassOrNil package. |
10641 | 7720 |
]. |
7721 |
^ self getResourceFileName:aFileName forPackage:pkgOrNil. |
|
7722 |
||
7723 |
" |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7724 |
Smalltalk getResourceFileName:'de.rs' forClass:SystemBrowser |
10641 | 7725 |
" |
7726 |
! |
|
7727 |
||
7728 |
getResourceFileName:aFileName forPackage:aPackageIDOrNil |
|
7729 |
"search aFileName in some standard places |
|
7730 |
(subdirectories named 'resource' in SystemPath); |
|
7731 |
and in a packages directory. |
|
7732 |
Return the absolute filename or nil if none is found. |
|
7733 |
Search order is: |
|
23433 | 7734 |
resources/<pkg>/file |
7735 |
<pkg>/resources/file |
|
10641 | 7736 |
" |
7737 |
||
7738 |
|pF f dir packageDir| |
|
7739 |
||
15225 | 7740 |
f := aFileName asString withoutPrefix:'resources/'. |
10641 | 7741 |
|
7742 |
aPackageIDOrNil isNil ifTrue:[ |
|
23433 | 7743 |
"/ this will be an error in the future |
10641 | 7744 |
"/ 'Smalltalk [warning]: resource file access without package: ' infoPrint. aFileName infoPrintCR. |
7745 |
"/ self halt. |
|
7746 |
||
23433 | 7747 |
pF := self searchPath:(self realSystemPath) for:aFileName in:('.resources'). |
7748 |
pF notNil ifTrue:[ |
|
7749 |
^ pF. |
|
7750 |
]. |
|
7751 |
pF := self searchPath:(self realSystemPath) for:aFileName in:('resources'). |
|
7752 |
pF notNil ifTrue:[ |
|
7753 |
^ pF. |
|
7754 |
]. |
|
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7755 |
"/ pF := self searchPath:(self realSystemPath) for:aFileName in:('resources/styles'). |
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7756 |
"/ pF notNil ifTrue:[ |
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7757 |
"/ ^ pF. |
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7758 |
"/ ]. |
23433 | 7759 |
f ~= aFileName ifTrue:[ |
7760 |
pF := self searchPath:(self realSystemPath) for:f in:('.resources'). |
|
7761 |
pF notNil ifTrue:[ |
|
7762 |
^ pF. |
|
7763 |
]. |
|
7764 |
pF := self searchPath:(self realSystemPath) for:f in:('resources'). |
|
7765 |
pF notNil ifTrue:[ |
|
7766 |
^ pF. |
|
7767 |
]. |
|
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7768 |
"/ pF := self searchPath:(self realSystemPath) for:f in:('resources/styles'). |
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7769 |
"/ pF notNil ifTrue:[ |
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7770 |
"/ ^ pF. |
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7771 |
"/ ]. |
23433 | 7772 |
]. |
7773 |
^ nil |
|
10641 | 7774 |
]. |
7775 |
||
7776 |
packageDir := aPackageIDOrNil copyReplaceAll:$: with:$/. |
|
7777 |
||
23433 | 7778 |
pF := self searchPath:(self realSystemPath) for:aFileName in:('.resources/',packageDir). |
7779 |
pF notNil ifTrue:[ |
|
7780 |
^ pF. |
|
7781 |
]. |
|
10641 | 7782 |
pF := self searchPath:(self realSystemPath) for:aFileName in:('resources/',packageDir). |
7783 |
pF notNil ifTrue:[ |
|
23433 | 7784 |
^ pF. |
10641 | 7785 |
]. |
7786 |
||
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7787 |
"/ the following code finds the file within the IDE's own hierarchy |
10641 | 7788 |
dir := self projectDirectoryForPackage:aPackageIDOrNil. |
7789 |
dir notNil ifTrue:[ |
|
23433 | 7790 |
dir := dir asFilename. |
7791 |
||
7792 |
(pF := dir / 'resources' / f) exists ifTrue:[ ^ pF name ]. |
|
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7793 |
"/ (pF := dir / 'styles' / f) exists ifTrue:[ ^ pF name ]. |
12377 | 7794 |
|
23433 | 7795 |
"resolve something like: 'ASN/definition.asn1'" |
7796 |
(pF := dir / f) exists ifTrue:[ ^ pF name ]. |
|
12377 | 7797 |
]. |
7798 |
||
10641 | 7799 |
^ nil |
7800 |
||
7801 |
" |
|
7802 |
Smalltalk getResourceFileName:'SystemBrowser.rs' forPackage:'stx:libtool' |
|
7803 |
Smalltalk getResourceFileName:'normal.style' forPackage:'stx:libview' |
|
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7804 |
Smalltalk getResourceFileName:'styles/normal.style' forPackage:'stx:libview' |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7805 |
Smalltalk getResourceFileName:'styles/mswindowsXP.style' forPackage:'stx:libview' |
10641 | 7806 |
Smalltalk getResourceFileName:'Foo.rs' forPackage:'stx:libview' |
7807 |
" |
|
7808 |
||
7809 |
"Modified: / 11-10-2006 / 13:53:43 / cg" |
|
7810 |
! |
|
7811 |
||
7812 |
getSourceFileName:aFileName |
|
7813 |
"search aFileName in some standard places |
|
7814 |
(subdirectories named 'source' in SystemPath); |
|
7815 |
return the absolute filename or nil if none is found. |
|
7816 |
This is used to find a sourceFile for a methods source, |
|
7817 |
if no sourceCodeManager is available." |
|
7818 |
||
7819 |
|f| |
|
7820 |
||
7821 |
SourcePath isNil ifTrue:[ |
|
18668 | 7822 |
SourcePath := self constructPathFor:SourceDirName |
10641 | 7823 |
]. |
7824 |
||
7825 |
"/ first, try a source subdir along the path. |
|
7826 |
SourcePath notNil ifTrue:[ |
|
18668 | 7827 |
f := self searchPath:SourcePath for:aFileName in:SourceDirName. |
10641 | 7828 |
]. |
7829 |
f isNil ifTrue:[ |
|
18668 | 7830 |
"/ then, try it itself along the path. |
7831 |
f := self searchPath:self realSystemPath for:aFileName in:nil |
|
10641 | 7832 |
]. |
7833 |
^ f |
|
7834 |
||
7835 |
" |
|
7836 |
Smalltalk getSourceFileName:'Smalltalk.st' |
|
7837 |
Smalltalk getSourceFileName:'ArrColl.st' |
|
7838 |
" |
|
7839 |
||
7840 |
"Modified: 18.7.1996 / 15:54:07 / cg" |
|
7841 |
! |
|
7842 |
||
7843 |
getSystemFileName:aFileNameOrString |
|
7844 |
"search aFileNameOrString in some standard places; |
|
7845 |
return the absolute filename or nil if none is found. |
|
7846 |
see comment in Smalltalk>>initSystemPath. |
|
7847 |
This should be used to access resources such as bitmaps, doc-files, |
|
7848 |
and other help files. |
|
7849 |
" |
|
7850 |
||
7851 |
"credits for this method go to Markus ...." |
|
7852 |
||
7853 |
|fn nameString| |
|
7854 |
||
7855 |
fn := aFileNameOrString asFilename. |
|
7856 |
nameString := fn name. |
|
7857 |
fn isAbsolute ifTrue:[ |
|
22791 | 7858 |
"don't use path for absolute file names" |
7859 |
||
7860 |
^ nameString |
|
10641 | 7861 |
]. |
7862 |
||
7863 |
self realSystemPath do:[:dirName | |
|
22791 | 7864 |
|realName| |
7865 |
||
7866 |
realName := dirName asFilename / nameString. |
|
7867 |
"/ |
|
7868 |
"/ here, we also return true if it's a directory |
|
7869 |
"/ (Even if unreadable). |
|
7870 |
"/ It could be that the file itself is still readable. |
|
7871 |
"/ |
|
7872 |
(realName isDirectory or:[realName isReadable]) ifTrue: [ |
|
7873 |
^ realName name |
|
7874 |
] |
|
10641 | 7875 |
]. |
7876 |
^ nil |
|
7877 |
||
7878 |
" |
|
7879 |
Smalltalk getSystemFileName:'doc/online/english/TOP.html' |
|
7880 |
Smalltalk getSystemFileName:'bitmaps/SBrowser.xbm' |
|
7881 |
Smalltalk getSystemFileName:'bitmaps/foo' |
|
7882 |
Smalltalk getSystemFileName:'resources/View.rs' |
|
7883 |
Smalltalk getSystemFileName:'resources/iris.style' |
|
7884 |
" |
|
7885 |
||
21443 | 7886 |
"Modified: / 06-05-1999 / 10:40:37 / cg" |
7887 |
"Modified (comment): / 13-02-2017 / 20:30:51 / cg" |
|
10641 | 7888 |
! |
7889 |
||
7890 |
imageFromFileNamed:aFileName forClass:aClass |
|
7891 |
"search aFileName in some standard places: |
|
7892 |
first in the redefinable bitmaps path, then in the classes |
|
7893 |
own package directory if existing. |
|
7894 |
Return an image or nil." |
|
7895 |
||
7896 |
|classPackage img| |
|
7897 |
||
7898 |
classPackage := aClass package. |
|
7899 |
img := self imageFromFileNamed:aFileName inPackage:classPackage. |
|
7900 |
img isNil ifTrue:[ |
|
18668 | 7901 |
"/ try under the goodies package ... |
7902 |
classPackage ~= 'stx:goodies' ifTrue:[ |
|
7903 |
img := self imageFromFileNamed:aFileName inPackage:'stx:goodies'. |
|
7904 |
] |
|
10641 | 7905 |
]. |
7906 |
^ img |
|
7907 |
||
7908 |
" |
|
7909 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' forClass:View |
|
7910 |
" |
|
7911 |
! |
|
7912 |
||
7913 |
imageFromFileNamed:aFileName inPackage:aPackage |
|
7914 |
"search aFileName in some standard places: |
|
7915 |
first in the redefinable bitmaps path, |
|
7916 |
then in the package directory if existing. |
|
7917 |
Return an image or nil. |
|
7918 |
Search order is: |
|
18668 | 7919 |
bitmaps/<pkg>/file |
7920 |
resources/<pkg>/bitmaps/file |
|
7921 |
<pkg>/bitmaps/file |
|
10641 | 7922 |
" |
7923 |
||
7924 |
|path| |
|
7925 |
||
7926 |
path := self getBitmapFileName:aFileName forPackage:aPackage. |
|
7927 |
path notNil ifTrue:[ |
|
18668 | 7928 |
^ Image fromFile:path. |
10641 | 7929 |
]. |
7930 |
^ nil |
|
7931 |
||
7932 |
" |
|
7933 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libview' |
|
7934 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libtool' |
|
7935 |
Smalltalk imageFromFileNamed:'bitmaps/gifImages/garfield.gif' inPackage:'stx:goodies' |
|
7936 |
Smalltalk imageFromFileNamed:'CheckOn10_xp.xpm' inPackage:'stx:libwidg' |
|
7937 |
Smalltalk imageFromFileNamed:'ComboDn_xp.xpm' inPackage:'stx:libwidg' |
|
7938 |
" |
|
7939 |
||
7940 |
"Modified: / 08-09-2006 / 18:02:04 / cg" |
|
7941 |
! |
|
7942 |
||
7943 |
libraryFileNameOfClass:aClassOrClassName |
|
7944 |
"for a given class, return the name of a classLibrary which contains |
|
7945 |
binary code for it. |
|
7946 |
Read the libinfo file 'liblist.stc' (which is created during the compilation process) |
|
7947 |
for an entry for aClassOrClassName. |
|
7948 |
Search for the className in the first col, and return the value found in |
|
7949 |
the 2nd col. |
|
7950 |
Return nil if no entry is found. |
|
7951 |
||
7952 |
A nil returns means that this class is either built-in or not present |
|
7953 |
in a package-class library (i.e. either as separate .o or separate .st file). |
|
7954 |
Otherwise, the returned name is the classLibrary object of that class. |
|
7955 |
The classes code can be loaded from that file if binary loading is supported." |
|
7956 |
||
7957 |
|aStream line words n aClassName| |
|
7958 |
||
7959 |
aClassOrClassName isBehavior ifTrue:[ |
|
18668 | 7960 |
aClassName := aClassOrClassName name |
10641 | 7961 |
] ifFalse:[ |
18668 | 7962 |
aClassName := aClassOrClassName |
10641 | 7963 |
]. |
7964 |
aClassName := aClassName asString. |
|
7965 |
||
7966 |
#('include/liblist.stc') "/ filenames |
|
7967 |
with:#(2) "/ column |
|
7968 |
do:[:fileName :col | |
|
7969 |
||
18668 | 7970 |
aStream := self systemFileStreamFor:fileName. |
7971 |
aStream notNil ifTrue:[ |
|
7972 |
[aStream atEnd] whileFalse:[ |
|
7973 |
line := aStream nextLine. |
|
7974 |
line notNil ifTrue:[ |
|
7975 |
(line startsWith:'#') ifFalse:[ |
|
7976 |
words := line asCollectionOfWords. |
|
7977 |
(n := words size) > 1 ifTrue:[ |
|
7978 |
(words at:1) = aClassName ifTrue:[ |
|
7979 |
n >= col ifTrue:[ |
|
7980 |
aStream close. |
|
7981 |
^ (words at:col) withoutSeparators |
|
7982 |
] |
|
7983 |
] |
|
7984 |
] |
|
7985 |
] |
|
7986 |
] |
|
7987 |
]. |
|
7988 |
aStream close |
|
7989 |
]. |
|
10641 | 7990 |
]. |
7991 |
||
7992 |
^ nil |
|
7993 |
||
7994 |
" |
|
7995 |
Smalltalk libraryFileNameOfClass:'ClockView' |
|
7996 |
Smalltalk libraryFileNameOfClass:'Bag' |
|
7997 |
" |
|
7998 |
||
7999 |
"Modified: 6.11.1995 / 15:41:39 / cg" |
|
8000 |
! |
|
8001 |
||
8002 |
packagePath |
|
15781 | 8003 |
"return a collection of additional directory names, where smalltalk |
10641 | 8004 |
looks for package directories. |
8005 |
Notice, that directories named 'packages' under the systemPath are |
|
8006 |
always consulted - even if not in the packagePath" |
|
8007 |
||
20640 | 8008 |
^ PackagePath ? #() |
10641 | 8009 |
|
8010 |
" |
|
8011 |
Smalltalk packagePath |
|
8012 |
Smalltalk packagePath addLast:'/opt/smalltalk' |
|
8013 |
Smalltalk packagePath addFirst:'/usr/local/otherPackages' |
|
8014 |
" |
|
8015 |
! |
|
8016 |
||
8017 |
packagePath:aPath |
|
8018 |
"set the packagePath; |
|
8019 |
a collection of additional directorynames, where smalltalk |
|
8020 |
looks for package directories. |
|
8021 |
Notice, that directories named 'packages' under the systemPath are |
|
8022 |
always consulted - even if not in the packagePath" |
|
8023 |
||
8024 |
PackagePath := aPath asOrderedCollection |
|
8025 |
||
8026 |
" |
|
8027 |
Smalltalk packagePath:#( '.' '/opt/stx' '/opt/smalltalk' '/usr/local/otherPackages') |
|
8028 |
" |
|
8029 |
! |
|
8030 |
||
8031 |
projectDirectoryForClass:aClass |
|
8032 |
"given a class, return the path to its package directory; |
|
8033 |
nil if not found." |
|
8034 |
||
8035 |
|pkg| |
|
8036 |
||
8037 |
pkg := aClass package. |
|
8038 |
pkg isNil ifTrue:[^ nil]. |
|
8039 |
||
8040 |
^ self projectDirectoryForPackage:pkg. |
|
8041 |
||
8042 |
" |
|
8043 |
Smalltalk projectDirectoryForClass:Array |
|
8044 |
Smalltalk projectDirectoryForClass:View |
|
8045 |
" |
|
8046 |
! |
|
8047 |
||
8048 |
projectDirectoryForPackage:aPackage |
|
8049 |
"given a packageID, return the path to its package directory; |
|
8050 |
nil if not found." |
|
8051 |
||
8052 |
|prj prjDir| |
|
8053 |
||
16642 | 8054 |
^ aPackage asPackageId packageDirectory. |
8055 |
||
10641 | 8056 |
"/ there might be a package specific resource directory ... |
8057 |
"/ in the directory, from which the project was loaded |
|
8058 |
prj := Project projectWithId:aPackage. |
|
8059 |
prj notNil ifTrue:[ |
|
18668 | 8060 |
prjDir := prj directory. |
10641 | 8061 |
]. |
8062 |
(prjDir notNil and:[prjDir asFilename exists]) ifFalse:[ |
|
18668 | 8063 |
prjDir := Smalltalk getPackageFileName:(aPackage copyReplaceAll:$: with:$/). |
10641 | 8064 |
]. |
8065 |
^ prjDir |
|
8066 |
||
8067 |
" |
|
16668
b88318df967d
flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents:
16666
diff
changeset
|
8068 |
Smalltalk projectDirectoryForPackage:'stx:libbasic' |
10641 | 8069 |
Smalltalk projectDirectoryForPackage:'exept:smartcard' |
16668
b88318df967d
flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents:
16666
diff
changeset
|
8070 |
Smalltalk projectDirectoryForPackage:'stx' |
b88318df967d
flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents:
16666
diff
changeset
|
8071 |
Smalltalk projectDirectoryForPackage:'bosch' |
b88318df967d
flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents:
16666
diff
changeset
|
8072 |
Smalltalk projectDirectoryForPackage:'bosch:foo' |
10641 | 8073 |
" |
8074 |
||
8075 |
"Modified: / 07-10-2006 / 17:45:58 / cg" |
|
8076 |
! |
|
8077 |
||
8078 |
readAbbreviations |
|
8079 |
"read classname to filename mappings from include/abbrev.stc. |
|
8080 |
sigh - all for those poor sys5.3 or MSDOS people with short filenames ..." |
|
8081 |
||
8082 |
"since installAutoloadedClasses also reads all abbreviations, use it" |
|
8083 |
||
8084 |
CachedAbbreviations := IdentityDictionary new. |
|
8085 |
self installAutoloadedClasses. |
|
8086 |
^ CachedAbbreviations. |
|
8087 |
||
8088 |
" |
|
8089 |
Smalltalk readAbbreviations |
|
8090 |
" |
|
8091 |
||
8092 |
"Modified: / 10.12.1999 / 17:48:53 / cg" |
|
8093 |
! |
|
8094 |
||
8095 |
readAbbreviationsFromStream:aStream |
|
8096 |
"read classname to filename mappings from aStream. |
|
8097 |
sigh - all for those poor sys5.3 or MSDOS people with short filenames ..." |
|
8098 |
||
11375 | 8099 |
self |
18668 | 8100 |
withAbbreviationsFromStream:aStream |
8101 |
do:[:className :abbrev :pkg | |
|
8102 |
self setFilename:abbrev forClass:className package:pkg. |
|
8103 |
]. |
|
10641 | 8104 |
|
8105 |
"Modified: / 13.12.1999 / 11:54:17 / cg" |
|
8106 |
! |
|
8107 |
||
8108 |
realSystemPath |
|
16642 | 8109 |
"return the realSystemPath - that's the directory names from |
10641 | 8110 |
SystemPath which exist and are readable" |
8111 |
||
8112 |
|nP| |
|
8113 |
||
8114 |
RealSystemPath isNil ifTrue:[ |
|
18668 | 8115 |
OperatingSystem isVMSlike ifTrue:[ |
8116 |
"/ temporary kludge: since we cannot currently |
|
8117 |
"/ check for existence of a name like 'volume:', |
|
8118 |
"/ leave those in the Path without a check. |
|
8119 |
RealSystemPath := SystemPath select:[:dirName | |f| |
|
8120 |
f := dirName asFilename. |
|
8121 |
f isVolumeOnly or:[(f isDirectory) and:[f isReadable]] |
|
8122 |
] |
|
8123 |
] ifFalse:[ |
|
8124 |
RealSystemPath := SystemPath |
|
8125 |
select:[:eachDirectoryName | |f| |
|
8126 |
f := eachDirectoryName asFilename. |
|
8127 |
(f isDirectory) and:[f isReadable] |
|
8128 |
] thenCollect:[:eachDirectoryName| |
|
8129 |
eachDirectoryName asFilename pathName. |
|
8130 |
]. |
|
8131 |
||
8132 |
"/ remove duplicates (but keep order) |
|
8133 |
nP := OrderedCollection new. |
|
8134 |
RealSystemPath do:[:p | |
|
8135 |
(nP includes:p) ifFalse:[ |
|
8136 |
nP add:p |
|
8137 |
] |
|
8138 |
]. |
|
8139 |
(nP includes:'.') ifFalse:[ |
|
8140 |
nP add:'.' |
|
8141 |
]. |
|
8142 |
RealSystemPath := nP. |
|
8143 |
]. |
|
617 | 8144 |
]. |
8145 |
^ RealSystemPath |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8146 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8147 |
|
10641 | 8148 |
recursiveReadAllAbbreviationsFrom:aDirectory |
8149 |
self recursiveReadAllAbbreviationsFrom:aDirectory maxLevels:15 |
|
8150 |
! |
|
8151 |
||
8152 |
recursiveReadAllAbbreviationsFrom:aDirectory maxLevels:maxLevels |
|
8153 |
"read all abbreviations from and under aDirectory." |
|
8154 |
||
8155 |
|abbrevStream dir directoryContents| |
|
8156 |
||
8157 |
maxLevels == 0 ifTrue:[ |
|
8158 |
"/ 'Smalltalk [warning]: max directory nesting reached.' infoPrintCR. |
|
22791 | 8159 |
^ self |
10641 | 8160 |
]. |
8161 |
||
8162 |
dir := aDirectory asFilename. |
|
8163 |
dir exists ifFalse:[^ self]. |
|
8164 |
||
8165 |
[ |
|
22791 | 8166 |
abbrevStream := (dir / 'abbrev.stc') asFilename readStream. |
8167 |
self readAbbreviationsFromStream:abbrevStream. |
|
8168 |
abbrevStream close. |
|
10641 | 8169 |
] on:FileStream openErrorSignal do:[:ex| "ignore this file"]. |
8170 |
||
8171 |
[ |
|
22791 | 8172 |
directoryContents := dir directoryContents. |
10641 | 8173 |
] on:FileStream openErrorSignal do:[:ex| |
22791 | 8174 |
"non-accessible directory: we are done" |
8175 |
^ self |
|
10641 | 8176 |
]. |
8177 |
||
8178 |
directoryContents do:[:aFilename | |
|
22791 | 8179 |
|f| |
8180 |
||
8181 |
(#( |
|
8182 |
'doc' |
|
8183 |
'CVS' |
|
8184 |
'bitmaps' |
|
8185 |
'resources' |
|
8186 |
'source' |
|
8187 |
) includes:aFilename) ifFalse:[ |
|
8188 |
f := dir / aFilename. |
|
8189 |
f isDirectory ifTrue:[ |
|
8190 |
self recursiveReadAllAbbreviationsFrom:f maxLevels:maxLevels-1 |
|
8191 |
] |
|
8192 |
]. |
|
4458 | 8193 |
]. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8194 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8195 |
|
15334 | 8196 |
reinitializePackagePath |
8197 |
"{ Pragma: +optSpace }" |
|
20207 | 8198 |
|
15334 | 8199 |
PackagePath notNil ifTrue:[ |
22791 | 8200 |
PackagePath := PackagePath select:[:p | p asFilename exists]. |
15334 | 8201 |
]. |
8202 |
PackagePath isEmptyOrNil ifTrue:[ |
|
22791 | 8203 |
PackagePath := OperatingSystem defaultPackagePath |
18868 | 8204 |
]. |
8205 |
self addWorkspaceDirectoryToPackagePath. |
|
15334 | 8206 |
! |
8207 |
||
13368 | 8208 |
relativePackagePathForPackage:aPackage |
8209 |
|path| |
|
8210 |
||
8211 |
PackageToPathMapping notNil ifTrue:[ |
|
18668 | 8212 |
path := PackageToPathMapping at:aPackage ifAbsent:nil. |
8213 |
PackageToPathMapping notNil ifTrue:[^ path]. |
|
13370 | 8214 |
]. |
8215 |
^ aPackage copyReplaceAll:$: with:$/. |
|
13368 | 8216 |
|
8217 |
" |
|
8218 |
PackageToPathMapping := Dictionary new. |
|
8219 |
PackageToPathMapping at:'expeccoNET:server' put:'expeccoNET_oldVersion/server'. |
|
8220 |
PackageToPathMapping at:'expeccoNET:server/ui' put:'expeccoNET_oldVersion/server/ui'. |
|
8221 |
||
8222 |
Smalltalk relativePackagePathForPackage:'stx:libview/resources' |
|
8223 |
Smalltalk relativePackagePathForPackage:'stx:libview' |
|
8224 |
" |
|
8225 |
! |
|
8226 |
||
10641 | 8227 |
resourceDirectoryForPackage:aPackage |
8228 |
"given a packageID, return the path to its resource directory; |
|
8229 |
nil if not found." |
|
8230 |
||
8231 |
|prjDir rsrcDir| |
|
8232 |
||
11183
9a4e7475a655
care for nil project when asked for a resource directory
Claus Gittinger <cg@exept.de>
parents:
11174
diff
changeset
|
8233 |
aPackage notNil ifTrue:[ |
23433 | 8234 |
prjDir := self projectDirectoryForPackage:aPackage. |
8235 |
(prjDir notNil |
|
8236 |
and:[(prjDir := prjDir asFilename) exists |
|
8237 |
and:[(rsrcDir := prjDir / 'resources') exists]]) ifTrue:[ |
|
8238 |
^ rsrcDir |
|
8239 |
]. |
|
23445 | 8240 |
|
8241 |
#( '../Resources' '.resources' 'resources' ) do:[:eachPossibleRsrcDir | |
|
8242 |
rsrcDir := self getSystemFileName:(eachPossibleRsrcDir,'/',(aPackage copyReplaceAll:$: with:$/)). |
|
8243 |
rsrcDir notNil ifTrue:[ |
|
8244 |
^ rsrcDir asFilename |
|
8245 |
]. |
|
23433 | 8246 |
]. |
10641 | 8247 |
]. |
8248 |
^ nil |
|
8249 |
||
8250 |
" |
|
8251 |
Smalltalk resourceDirectoryForPackage:'stx:libbasic' |
|
8252 |
Smalltalk resourceDirectoryForPackage:'exept:expecco' |
|
8253 |
Smalltalk resourceDirectoryForPackage:'exept:smartcard' |
|
8254 |
" |
|
8255 |
! |
|
8256 |
||
8257 |
resourceFileStreamFor:aFileName |
|
8258 |
"search aFileName in some standard places; |
|
8259 |
return a readonly fileStream or nil if not found. |
|
8260 |
Searches in subdirectories named 'resource' in SystemPath" |
|
8261 |
||
8262 |
^ self resourceFileStreamFor:aFileName forClass:nil |
|
8263 |
! |
|
8264 |
||
8265 |
resourceFileStreamFor:aFileName forClass:aClassOrNil |
|
8266 |
"search aFileName in some standard places and in the classes |
|
8267 |
package-resource directory. |
|
8268 |
Return a readonly fileStream or nil if not found. |
|
8269 |
Searches in subdirectories named 'resource' in SystemPath" |
|
8270 |
||
8271 |
|aString| |
|
8272 |
||
8273 |
aString := self getResourceFileName:aFileName forClass:aClassOrNil. |
|
8274 |
aString notNil ifTrue:[ |
|
18668 | 8275 |
^ aString asFilename readStreamOrNil |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8276 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8277 |
^ nil |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8278 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8279 |
|
10641 | 8280 |
searchPath:aPath for:aFileName in:aDirName |
8281 |
"search aPath for a subdirectory named aDirectory with a file |
|
8282 |
named aFileName" |
|
8283 |
||
8284 |
|f| |
|
8285 |
||
8286 |
((f := aFileName asFilename) isAbsolute |
|
8287 |
or:[f isExplicitRelative]) ifTrue:[ |
|
22791 | 8288 |
"/ |
8289 |
"/ don't use path for absolute or explicit .-relative file names |
|
8290 |
"/ |
|
8291 |
^ aFileName |
|
10641 | 8292 |
]. |
8293 |
||
8294 |
aPath notNil ifTrue:[ |
|
22791 | 8295 |
aPath do:[:dirName | |
8296 |
|realName dir| |
|
8297 |
||
8298 |
dir := dirName asFilename. |
|
8299 |
aDirName notNil ifTrue:[ |
|
8300 |
realName := dir / aDirName / aFileName. |
|
8301 |
] ifFalse:[ |
|
8302 |
realName := dir / aFileName. |
|
8303 |
]. |
|
8304 |
(realName isReadable) ifTrue:[ |
|
8305 |
^ realName name |
|
8306 |
] |
|
8307 |
]. |
|
11108 | 8308 |
]. |
8309 |
||
8310 |
"/ not needed - executing dir is always in SearchPath |
|
12377 | 8311 |
"/ realName := Filename currentDirectory / aFileName. |
11108 | 8312 |
"/ (realName isReadable) ifTrue:[ |
8313 |
"/ ^ realName name |
|
8314 |
"/ ]. |
|
10641 | 8315 |
^ nil. |
8316 |
||
8317 |
"Modified: / 29.4.1999 / 15:06:43 / cg" |
|
8318 |
! |
|
8319 |
||
8320 |
setFilename:aFileNameString forClass:aClassNameString package:aPackageNameString |
|
8321 |
|classNameSymbol oldAbbrev oldPath newPath cls abbrevs| |
|
8322 |
||
8323 |
CachedAbbreviations isNil ifTrue:[ |
|
18668 | 8324 |
CachedAbbreviations := IdentityDictionary new. |
10641 | 8325 |
]. |
8326 |
||
8327 |
abbrevs := CachedAbbreviations. |
|
8328 |
aClassNameString ~= aFileNameString ifTrue:[ |
|
18668 | 8329 |
classNameSymbol := aClassNameString asSymbol. |
8330 |
oldAbbrev := abbrevs at:classNameSymbol ifAbsent:nil. |
|
8331 |
oldAbbrev notNil ifTrue:[ |
|
8332 |
oldAbbrev ~= aFileNameString ifTrue:[ |
|
8333 |
oldAbbrev asFilename isAbsolute |
|
8334 |
ifTrue:[ oldPath := oldAbbrev ] |
|
8335 |
ifFalse:[ oldPath := (self projectDirectoryForPackage:aPackageNameString) asFilename constructString: oldAbbrev ]. |
|
8336 |
aFileNameString asFilename isAbsolute |
|
8337 |
ifTrue:[ newPath := aFileNameString ] |
|
8338 |
ifFalse:[ newPath := (self projectDirectoryForPackage:aPackageNameString) asFilename constructString: aFileNameString ]. |
|
8339 |
||
8340 |
oldPath ~= newPath ifTrue:[ |
|
8341 |
StandAlone ifFalse:[ |
|
8342 |
('Smalltalk [warning]: autoload path change for: ',aClassNameString,' in package ',aPackageNameString) infoPrintCR. |
|
8343 |
('Smalltalk [info]: old: ',oldPath) infoPrintCR. |
|
8344 |
('Smalltalk [info]: new: ',newPath) infoPrintCR. |
|
8345 |
] |
|
8346 |
] |
|
8347 |
]. |
|
8348 |
"overwrite old abbreviation with new one, |
|
8349 |
to allow fixing of bad abbrev files" |
|
8350 |
]. |
|
8351 |
||
8352 |
cls := self classNamed:aFileNameString. |
|
8353 |
cls notNil ifTrue:[ |
|
8354 |
cls name ~= aClassNameString ifTrue:[ |
|
8355 |
"/ ok, there is a class named after this abbrev ... |
|
8356 |
"/ this is only a conflict, if the other class has no |
|
8357 |
"/ abbreviation (or the same). |
|
8358 |
(abbrevs at:(cls name asSymbol) ifAbsent:cls name) = aFileNameString ifTrue:[ |
|
8359 |
cls isNameSpace ifFalse:[ |
|
8360 |
aPackageNameString = cls package ifTrue:[ |
|
8361 |
StandAlone ifFalse:[ |
|
8362 |
('Smalltalk [warning]: conflict for: ' , cls name , |
|
8363 |
' in package ' , aPackageNameString) infoPrintCR. |
|
8364 |
('Smalltalk [warning]: (' , aClassNameString , ' -> ' , aFileNameString |
|
8365 |
, ')') infoPrintCR |
|
8366 |
] |
|
8367 |
] |
|
8368 |
] |
|
8369 |
] |
|
8370 |
] |
|
8371 |
]. |
|
8372 |
abbrevs at:classNameSymbol put:aFileNameString. |
|
8470
d79e917d4f36
Define #setFilename:forClass:package: to define an abbreviation.
Stefan Vogel <sv@exept.de>
parents:
8445
diff
changeset
|
8373 |
] |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8374 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8375 |
|
10641 | 8376 |
sourceDirectoryNameOfClass:aClassOrClassName |
8377 |
"for a given class, return the pathname relative to TOP of the classes source code. |
|
8378 |
Read the files 'abbrev.stc' and 'liblist.stc' (which are created during the compilation process) |
|
8379 |
for an entry for aClassOrClassName. |
|
8380 |
Search for the className in the first col, and return the value found in |
|
8381 |
the 3rd col. |
|
8382 |
Return nil if no entry is found." |
|
8383 |
||
8384 |
|aStream line words n aClassName| |
|
8385 |
||
8386 |
aClassOrClassName isBehavior ifTrue:[ |
|
18668 | 8387 |
aClassName := aClassOrClassName name |
10641 | 8388 |
] ifFalse:[ |
18668 | 8389 |
aClassName := aClassOrClassName |
10641 | 8390 |
]. |
8391 |
aClassName := aClassName asString. |
|
8392 |
||
8393 |
#('include/abbrev.stc' 'include/liblist.stc') "/ filenames |
|
8394 |
with:#(3 2) "/ column |
|
8395 |
do:[:fileName :col | |
|
8396 |
||
18668 | 8397 |
aStream := self systemFileStreamFor:fileName. |
8398 |
aStream notNil ifTrue:[ |
|
8399 |
[aStream atEnd] whileFalse:[ |
|
8400 |
line := aStream nextLine. |
|
8401 |
line notNil ifTrue:[ |
|
8402 |
(line startsWith:'#') ifFalse:[ |
|
8403 |
words := line asCollectionOfWords. |
|
8404 |
(n := words size) > 1 ifTrue:[ |
|
8405 |
(words at:1) = aClassName ifTrue:[ |
|
8406 |
n >= col ifTrue:[ |
|
8407 |
aStream close. |
|
8408 |
^ (words at:col) withoutSeparators |
|
8409 |
] |
|
8410 |
] |
|
8411 |
] |
|
8412 |
] |
|
8413 |
] |
|
8414 |
]. |
|
8415 |
aStream close |
|
8416 |
]. |
|
10641 | 8417 |
]. |
8418 |
||
8419 |
^ nil |
|
8420 |
||
8421 |
" |
|
8422 |
Smalltalk sourceDirectoryNameOfClass:'ClockView' |
|
8423 |
Smalltalk sourceDirectoryNameOfClass:'Bag' |
|
8424 |
Smalltalk sourceDirectoryNameOfClass:'GLWireCubeDemoView' |
|
8425 |
Smalltalk sourceDirectoryNameOfClass:'SomeNonExistingClass' |
|
8426 |
" |
|
8427 |
||
8428 |
"Created: 6.11.1995 / 15:43:30 / cg" |
|
8429 |
"Modified: 9.12.1995 / 23:54:14 / cg" |
|
8430 |
"Modified: 3.1.1997 / 11:26:44 / stefan" |
|
8431 |
! |
|
8432 |
||
8433 |
sourceFileStreamFor:aFileName |
|
8434 |
"search aFileName in some standard places; |
|
8435 |
return a readonly fileStream or nil if not found. |
|
8436 |
Searches in subdirectories named 'source' in SystemPath" |
|
8437 |
||
8438 |
|aString| |
|
8439 |
||
8440 |
aString := self getSourceFileName:aFileName. |
|
8441 |
aString notNil ifTrue:[ |
|
18668 | 8442 |
^ aString asFilename readStreamOrNil |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8443 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8444 |
^ nil |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8445 |
! |
7758 | 8446 |
|
10641 | 8447 |
systemFileStreamFor:aFileName |
8448 |
"search aFileName in some standard places; |
|
8449 |
return a readonly fileStream or nil if not found. |
|
8450 |
see comment in Smalltalk>>initSystemPath" |
|
8451 |
||
8452 |
|aString| |
|
8453 |
||
8454 |
aString := self getSystemFileName:aFileName. |
|
8455 |
aString notNil ifTrue:[ |
|
18668 | 8456 |
^ aString asFilename readStreamOrNil |
617 | 8457 |
]. |
8458 |
^ nil |
|
8459 |
! |
|
8460 |
||
10641 | 8461 |
systemPath |
8462 |
"return a collection of directorynames, where smalltalk |
|
8463 |
looks for system files |
|
8464 |
(usually in subdirs such as resources, bitmaps, source etc.) |
|
8465 |
see comment in Smalltalk>>initSystemPath." |
|
8466 |
||
20640 | 8467 |
^ SystemPath ? #() |
10641 | 8468 |
|
8469 |
" |
|
8470 |
Smalltalk systemPath |
|
8471 |
Smalltalk systemPath addLast:'someOtherDirectoryPath' |
|
8472 |
" |
|
8473 |
! |
|
8474 |
||
8475 |
systemPath:aPath |
|
8476 |
"set the collection of directorynames, where smalltalk |
|
8477 |
looks for system files |
|
8478 |
(usually in subdirs such as resources, bitmaps, source etc.) |
|
8479 |
see comment in Smalltalk>>initSystemPath." |
|
8480 |
||
8481 |
SystemPath := aPath. |
|
8482 |
self flushPathCaches |
|
8483 |
||
8484 |
" |
|
8485 |
Smalltalk systemPath |
|
8486 |
Smalltalk systemPath:(Smalltalk systemPath copy addLast:'someOtherDirectoryPath') |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8487 |
" |
11301
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
8488 |
! |
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
8489 |
|
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
8490 |
withAbbreviationsFromStream:aStream do:aBlock |
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
8491 |
"read classname to filename mappings from aStream. |
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
8492 |
Evaluate aBlock for each tuple: |
18668 | 8493 |
class-name , abbrev-name, package |
11301
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
8494 |
Sigh - all for those poor sys5.3 or MSDOS people with short filenames..." |
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
8495 |
|
13415 | 8496 |
|line lineNo words nm abbrev pkg category size s w| |
8497 |
||
8498 |
lineNo := 0. |
|
11301
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
8499 |
[aStream atEnd] whileFalse:[ |
18668 | 8500 |
line := aStream nextLine. |
8501 |
lineNo := lineNo + 1. |
|
8502 |
line notEmptyOrNil ifTrue:[ |
|
8503 |
(line startsWith:'#') ifFalse:[ |
|
8504 |
||
8505 |
"/ must do it manually, caring for quoted strings. |
|
11301
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
8506 |
"/ words := line asCollectionOfWords. |
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
8507 |
|
18668 | 8508 |
words := OrderedCollection new. |
8509 |
s := line readStream. |
|
8510 |
[s atEnd] whileFalse:[ |
|
8511 |
s skipSeparators. |
|
8512 |
s peek == $' ifTrue:[ |
|
8513 |
s next. |
|
8514 |
w := s upTo:$'. |
|
8515 |
s skipSeparators. |
|
8516 |
] ifFalse:[ |
|
8517 |
w := s upToSeparator |
|
8518 |
]. |
|
8519 |
words add:w |
|
8520 |
]. |
|
8521 |
words size >= 3 ifTrue:[ |
|
8522 |
nm := (words at:1) withoutSeparators. |
|
8523 |
abbrev := (words at:2) withoutSeparators. |
|
8524 |
pkg := (words at:3) withoutSeparators. |
|
8525 |
aBlock argumentCount = 3 ifTrue:[ |
|
8526 |
aBlock value:nm value:abbrev value:pkg. |
|
8527 |
] ifFalse:[ |
|
8528 |
words size >= 4 ifTrue:[ |
|
8529 |
category := words at:4. |
|
8530 |
]. |
|
8531 |
words size = 5 ifTrue:[ |
|
8532 |
size := (words at:5) asNumber |
|
8533 |
]. |
|
8534 |
aBlock value:nm value:abbrev value:pkg value: category value: size |
|
8535 |
] |
|
8536 |
] ifFalse:[ |
|
8537 |
('Smalltalk [warning]: malformed line ', lineNo printString , ' in ' , (aStream pathName)) infoPrintCR. |
|
8538 |
] |
|
8539 |
] |
|
8540 |
] |
|
13518
b81bc64782b1
not ifTrue -> ifFalse (trying the rewrite tool ;-)
Claus Gittinger <cg@exept.de>
parents:
13506
diff
changeset
|
8541 |
]. |
b81bc64782b1
not ifTrue -> ifFalse (trying the rewrite tool ;-)
Claus Gittinger <cg@exept.de>
parents:
13506
diff
changeset
|
8542 |
|
13415 | 8543 |
"Modified: / 06-03-2011 / 18:17:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
13546
8993c10243a2
changed: #withAbbreviationsFromStream:do:
Claus Gittinger <cg@exept.de>
parents:
13540
diff
changeset
|
8544 |
"Modified: / 04-08-2011 / 21:35:00 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8545 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8546 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8547 |
!Smalltalk class methodsFor:'system management-packages'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8548 |
|
16159 | 8549 |
isPackageLoaded:aPackageIdOrPackage |
8550 |
|projectDefinition| |
|
8551 |
||
8552 |
projectDefinition := aPackageIdOrPackage asPackageId projectDefinitionClass. |
|
16161 | 8553 |
^ projectDefinition notNil and:[projectDefinition isLoaded and:[projectDefinition isFullyLoaded]] |
16159 | 8554 |
|
8555 |
" |
|
8556 |
Smalltalk isPackageLoaded:'stx:goodies/persistency' |
|
16170
ca4d03def070
endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents:
16164
diff
changeset
|
8557 |
Smalltalk isPackageLoaded:'stx:goodies/refactoryBrowser/lint' |
ca4d03def070
endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents:
16164
diff
changeset
|
8558 |
Smalltalk isPackageLoaded:'stx:goodies/refactoryBrowser/lint/spelling' |
16159 | 8559 |
" |
8560 |
! |
|
8561 |
||
20898 | 8562 |
knownLoadablePackagesDo:aBlock |
8563 |
"enumerate loadable packages from the packages folder." |
|
8564 |
||
8565 |
Smalltalk realSystemPath do:[:dirName | |
|
22791 | 8566 |
|packageDir| |
8567 |
||
8568 |
packageDir := dirName asFilename / 'packages'. |
|
8569 |
(packageDir exists and:[packageDir isDirectory]) ifTrue:[ |
|
8570 |
packageDir directoryContentsAsFilenames sort do:[:fn | |
|
8571 |
|item base nm path parentPath parent isLibrary isApplication isAlreadyLoaded |
|
8572 |
defClass target type nameComponents packageName packageID| |
|
8573 |
||
8574 |
((fn suffix = 'mcz') |
|
8575 |
or:[ fn isDirectory |
|
8576 |
or:[ (fn baseName startsWith:'.') |
|
8577 |
or:[ (fn baseName = 'README') ]]]) ifFalse:[ |
|
8578 |
base := fn withoutSuffix baseName. |
|
8579 |
(base startsWith:'lib') ifTrue:[ |
|
8580 |
nm := (base copyFrom:4). |
|
8581 |
fn suffix notEmptyOrNil ifTrue:[ |
|
8582 |
type := #library. |
|
8583 |
] ifFalse:[ |
|
8584 |
type := #application. |
|
8585 |
] |
|
8586 |
] ifFalse:[ |
|
8587 |
nm := base. |
|
8588 |
type := #application. |
|
8589 |
]. |
|
8590 |
||
8591 |
(base ~= 'librun') ifTrue:[ |
|
8592 |
(fn suffix = 'mcz') ifTrue:[ |
|
8593 |
packageName := fn withoutSuffix. |
|
8594 |
target := fn. |
|
8595 |
] ifFalse:[ |
|
8596 |
( #('dll' 'so' 'sl' 'dylib') includes:(fn suffix)) ifTrue:[ |
|
8597 |
(base startsWith:'lib') ifTrue:[ |
|
8598 |
nm := base copyFrom:4. |
|
8599 |
] ifFalse:[ |
|
8600 |
nm := base. |
|
8601 |
]. |
|
8602 |
]. |
|
8603 |
nameComponents := nm asCollectionOfSubstringsSeparatedBy:$_. |
|
8604 |
packageName := nameComponents first. |
|
8605 |
nameComponents size > 1 ifTrue:[ |
|
8606 |
packageName := packageName,':',((nameComponents copyFrom:2) asStringWith:'/') |
|
8607 |
]. |
|
8608 |
]. |
|
8609 |
packageName notNil ifTrue:[ |
|
8610 |
aBlock value:packageName value:type value:fn . |
|
8611 |
] |
|
8612 |
] |
|
8613 |
] |
|
8614 |
] |
|
8615 |
] |
|
20898 | 8616 |
] |
8617 |
||
8618 |
" |
|
8619 |
Smalltalk knownLoadablePackagesDo:[:packageID :type :path | |
|
22791 | 8620 |
Transcript showCR:'%1 (%2) in %3' with:packageID with:type with:path. |
20898 | 8621 |
] |
8622 |
" |
|
8623 |
! |
|
8624 |
||
10641 | 8625 |
loadPackage:aPackageIdOrPackage |
12250 | 8626 |
"make certain, that some particular package is loaded into the system. |
8627 |
Return true if loaded, false otherwise." |
|
11668 | 8628 |
|
8629 |
^ self loadPackage:aPackageIdOrPackage asAutoloaded:false |
|
8630 |
||
8631 |
" |
|
8632 |
Smalltalk loadPackage:'stx:libbasic' |
|
8633 |
Smalltalk loadPackage:'stx:goodies/persistency' |
|
8634 |
Smalltalk loadPackage:'cg:cparser' |
|
8635 |
Smalltalk loadPackage:'cg:rose' |
|
8636 |
" |
|
8637 |
! |
|
8638 |
||
10641 | 8639 |
packageDirectoryForPackageId:aPackageId |
12250 | 8640 |
"used by classes to find the location of their resource- and bitmap directories. |
8641 |
||
8642 |
Notice that the directory structure is different between the development |
|
8643 |
environment (top for packages is ../../../stx) and delivered stand alone executables, |
|
8644 |
where the top is specified via a shell environment variable, and is typically ../lib. |
|
8645 |
At runtime, Smalltalk knows about the systemPath setting." |
|
8646 |
||
10641 | 8647 |
|packageDirName packageDir| |
8648 |
||
14589 | 8649 |
packageDirName := aPackageId asPackageId string copyReplaceAll:$: with:$/. |
10641 | 8650 |
|
8651 |
packageDir := self getPackageFileName:packageDirName. |
|
8652 |
packageDir isNil ifTrue:[ |
|
18668 | 8653 |
^ nil. |
10641 | 8654 |
]. |
8655 |
^ packageDir asFilename |
|
8656 |
||
8657 |
" |
|
11375 | 8658 |
Smalltalk packageDirectoryForPackageId:'stx:libbasic' |
10641 | 8659 |
Smalltalk packageDirectoryForPackageId:'stx:goodies/persistency' |
8660 |
Smalltalk packageDirectoryForPackageId:'exept:ctypes' |
|
8661 |
" |
|
12250 | 8662 |
! |
8663 |
||
18794 | 8664 |
requirePackage:aPackageIdOrPackage |
8665 |
"make certain, that some particular package is loaded into the system. |
|
8666 |
Return true if loaded, false otherwise. |
|
8667 |
Just an alias which is easier to remember" |
|
8668 |
||
8669 |
^ self loadPackage:aPackageIdOrPackage |
|
8670 |
||
8671 |
" |
|
8672 |
Smalltalk loadPackage:'stx:libbasic' |
|
8673 |
Smalltalk loadPackage:'stx:goodies/persistency' |
|
8674 |
Smalltalk loadPackage:'cg:cparser' |
|
8675 |
Smalltalk loadPackage:'cg:rose' |
|
8676 |
" |
|
8677 |
! |
|
8678 |
||
12250 | 8679 |
unloadPackage:aPackageIdOrPackage |
8680 |
|projectDefinition| |
|
8681 |
||
8682 |
projectDefinition := aPackageIdOrPackage. |
|
8683 |
projectDefinition isProjectDefinition ifFalse:[ |
|
22791 | 8684 |
projectDefinition := projectDefinition asPackageId projectDefinitionClass. |
8685 |
projectDefinition isNil ifTrue:[ |
|
8686 |
Logger warning:'trying to unload non-existing package: %1' with:aPackageIdOrPackage. |
|
8687 |
^ self. |
|
8688 |
]. |
|
12250 | 8689 |
]. |
8690 |
projectDefinition unloadPackage. |
|
8691 |
||
8692 |
" |
|
8693 |
Smalltalk loadPackage:'stx:goodies/persistency' |
|
8694 |
Smalltalk unloadPackage:'stx:goodies/persistency' |
|
8695 |
" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8696 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8697 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8698 |
!Smalltalk class methodsFor:'system management-undeclared variables'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8699 |
|
10641 | 8700 |
clearUndeclaredVariables |
8701 |
"remove all undeclared variables" |
|
8702 |
||
8703 |
(Smalltalk at:#Undeclared) do:[:eachKey | |
|
18668 | 8704 |
Smalltalk removeKey:(self undeclaredPrefix , eachKey) asSymbol. |
10641 | 8705 |
]. |
8706 |
(Smalltalk at:#Undeclared) removeAll. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8707 |
Smalltalk removeKey:#Undeclared. |
10641 | 8708 |
! |
8709 |
||
8710 |
undeclaredPrefix |
|
8711 |
"the prefix used for undeclared variables" |
|
8712 |
||
8713 |
^ 'Undeclared:::' |
|
8714 |
||
8715 |
"Created: / 31.10.1997 / 01:13:10 / cg" |
|
7758 | 8716 |
! ! |
8717 |
||
8718 |
!Smalltalk class methodsFor:'time-versions'! |
|
8719 |
||
10641 | 8720 |
configuration |
8721 |
"{ Pragma: +optSpace }" |
|
8722 |
||
8723 |
"for developers only: return the configuration, with which |
|
8724 |
this smalltalk was compiled." |
|
8725 |
||
8726 |
%{ /* NOCONTEXT */ |
|
8727 |
extern char *__getConfigurationString(); |
|
8728 |
||
8729 |
RETURN (__MKSTRING(__getConfigurationString() COMMA_SND)); |
|
8730 |
%}. |
|
8731 |
^ 'unknownOS/unknownCONF:unknownPACK' |
|
8732 |
||
8733 |
" |
|
10071 | 8734 |
Smalltalk configuration |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8735 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8736 |
! |
453 | 8737 |
|
10641 | 8738 |
copyrightString |
8739 |
"{ Pragma: +optSpace }" |
|
8740 |
||
8741 |
"return a copyright string" |
|
8742 |
||
8743 |
%{ /* NOCONTEXT */ |
|
8744 |
#ifndef __getCopyrightString |
|
8745 |
extern OBJ __getCopyrightString(); |
|
8746 |
#endif |
|
8747 |
||
8748 |
RETURN (__getCopyrightString()); |
|
8749 |
%}. |
|
8750 |
^ self primitiveFailed |
|
8751 |
||
8752 |
" |
|
7758 | 8753 |
Smalltalk copyrightString |
8754 |
" |
|
8755 |
! |
|
8756 |
||
10641 | 8757 |
distributorString |
8758 |
"{ Pragma: +optSpace }" |
|
8759 |
||
8760 |
"return a string describing the distributor of this software" |
|
8761 |
||
8762 |
%{ /* NOCONTEXT */ |
|
8763 |
#ifndef __getDistributorString |
|
8764 |
extern OBJ __getDistributorString(); |
|
8765 |
#endif |
|
8766 |
||
8767 |
RETURN (__getDistributorString()); |
|
8768 |
%}. |
|
8769 |
^ 'eXept Software AG, Germany' |
|
8770 |
||
8771 |
" |
|
8772 |
Smalltalk distributorString |
|
8773 |
" |
|
8774 |
! |
|
8775 |
||
8776 |
expirationTime |
|
8777 |
"{ Pragma: +optSpace }" |
|
8778 |
||
8779 |
"for developers only: return the time when the system will expire. |
|
8780 |
after this time it will not run any longer. |
|
8781 |
It returns nil, if no expiration time has been set (system runs forever :-))" |
|
8782 |
||
8783 |
|exp| |
|
8784 |
||
8785 |
%{ |
|
8786 |
extern unsigned int __getExpirationTime(); |
|
8787 |
||
8788 |
exp = __MKUINT(__getExpirationTime()); |
|
8789 |
%}. |
|
8790 |
exp == 0 ifTrue:[ |
|
18668 | 8791 |
^ nil |
10641 | 8792 |
]. |
8793 |
^ Timestamp new fromOSTime:(exp * 1000). "OSTime is ms since 1970" |
|
8794 |
||
8795 |
" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8796 |
Smalltalk expirationTime |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8797 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8798 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8799 |
|
10641 | 8800 |
fullVersionString |
8801 |
"{ Pragma: +optSpace }" |
|
8802 |
||
8803 |
"return a full version string" |
|
8804 |
||
19516 | 8805 |
^ 'Smalltalk/X release %1%2 of %3' |
22900 | 8806 |
bindWith:(self versionString) |
8807 |
with:((ExternalBytes sizeofPointer == 8) |
|
8808 |
ifTrue:[' (64bit)'] |
|
8809 |
ifFalse:['']) |
|
8810 |
with:(self versionDate) |
|
22791 | 8811 |
|
8812 |
" |
|
8813 |
Smalltalk fullVersionString |
|
10641 | 8814 |
" |
8815 |
||
8816 |
"Created: / 27.10.1997 / 17:03:09 / cg" |
|
8817 |
"Modified: / 27.10.1997 / 17:04:02 / cg" |
|
8818 |
! |
|
8819 |
||
8820 |
hello |
|
8821 |
"{ Pragma: +optSpace }" |
|
8822 |
||
8823 |
"return a greeting string" |
|
8824 |
||
8825 |
"stupid: this should come from a resource file ... |
|
18924 | 8826 |
but I don't use it here, to allow mini-systems without |
10641 | 8827 |
Resource-stuff." |
8828 |
||
19187 | 8829 |
|proto lang bit bitsPerWordString| |
10641 | 8830 |
|
8831 |
lang := Language. |
|
19187 | 8832 |
bit := 'bit'. |
8833 |
||
10641 | 8834 |
(lang == #de) ifTrue:[ |
22900 | 8835 |
proto := 'Willkommen bei %1 (%4Version %2 von %3)'. bit := 'Bit'. |
10641 | 8836 |
] ifFalse:[ (lang == #fr) ifTrue:[ |
23408 | 8837 |
proto := 'Salut, Bienvenue à%1 (%4version %2 de %3)' |
10641 | 8838 |
] ifFalse:[ (lang == #it) ifTrue:[ |
22900 | 8839 |
proto := 'Ciao, benvenuto al %1 (%4versione %2 di %3)' |
10641 | 8840 |
] ifFalse:[ (lang == #es) ifTrue:[ |
22900 | 8841 |
proto := 'Hola, bienvenida a %1 (%4version %2 de %3)' |
18924 | 8842 |
] ifFalse:[ (lang == #pt) ifTrue:[ |
23408 | 8843 |
proto := 'Olá!!, mem-vindo a %1 (%4version %2 de %3)' |
10641 | 8844 |
] ifFalse:[ (lang == #no) ifTrue:[ |
22900 | 8845 |
proto := 'Hei, verdenmottakelse til %1 (%4versjon %2 av %3)' |
10641 | 8846 |
]]]]]]. |
8847 |
||
8848 |
"/ ... more needed here ... |
|
8849 |
||
8850 |
proto isNil ifTrue:[ |
|
22900 | 8851 |
proto := 'Hello World - welcome to %1 (%4version %2 of %3)'. |
8852 |
]. |
|
8853 |
ExternalBytes sizeofPointer ~~ 4 ifTrue:[ |
|
8854 |
bitsPerWordString := (ExternalBytes sizeofPointer * 8) printString,bit,' '. |
|
19187 | 8855 |
] ifFalse:[ |
22900 | 8856 |
bitsPerWordString := '' |
22791 | 8857 |
]. |
10641 | 8858 |
|
8859 |
^ proto bindWith:('SmallTalk/X' allBold) |
|
22900 | 8860 |
with:(self versionString) |
8861 |
with:(self versionDate) |
|
8862 |
with:bitsPerWordString |
|
10641 | 8863 |
|
8864 |
" |
|
8865 |
Smalltalk language:#us. |
|
22791 | 8866 |
Smalltalk hello |
10641 | 8867 |
|
8868 |
Smalltalk language:#de. |
|
8869 |
Smalltalk hello |
|
8870 |
||
8871 |
Smalltalk language:#no. |
|
8872 |
Smalltalk hello |
|
8873 |
||
8874 |
Transcript showCR:(Smalltalk hello) |
|
8875 |
Stdout showCR:(Smalltalk hello) |
|
8876 |
" |
|
8877 |
||
8878 |
"Modified: 18.5.1996 / 14:25:13 / cg" |
|
8879 |
! |
|
8880 |
||
8881 |
imageRestartTime |
|
8882 |
"return a timestamp for the moment when this image was restarted. |
|
8883 |
If we do not execute from an image (i.e. fresh start), return nil." |
|
8884 |
||
8885 |
^ ImageRestartTime |
|
8886 |
||
8887 |
" |
|
8888 |
Smalltalk imageStartTime |
|
8889 |
Smalltalk imageRestartTime |
|
8890 |
" |
|
8891 |
||
8892 |
"Created: 13.12.1995 / 17:44:20 / cg" |
|
8893 |
"Modified: 6.3.1996 / 11:56:35 / cg" |
|
8894 |
! |
|
8895 |
||
8896 |
imageSaveTime |
|
8897 |
"{ Pragma: +optSpace }" |
|
8898 |
||
8899 |
"return a timestamp for the moment when this image was saved" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8900 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8901 |
^ ObjectMemory imageSaveTime |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8902 |
! |
7758 | 8903 |
|
10641 | 8904 |
imageStartTime |
8905 |
"{ Pragma: +optSpace }" |
|
8906 |
||
8907 |
"return a timestamp for the moment when this system started the first time |
|
8908 |
(i.e. the first initial start without an image)" |
|
8909 |
||
8910 |
^ ImageStartTime |
|
8911 |
||
8912 |
" |
|
8913 |
Smalltalk imageStartTime |
|
8914 |
Smalltalk imageRestartTime |
|
8915 |
" |
|
8916 |
||
8917 |
"Created: 13.12.1995 / 17:44:14 / cg" |
|
8918 |
"Modified: 13.12.1995 / 17:45:47 / cg" |
|
8919 |
! |
|
8920 |
||
8921 |
majorVersionNr |
|
8922 |
"{ Pragma: +optSpace }" |
|
8923 |
||
8924 |
"return the major version number. |
|
8925 |
This is only incremented for very fundamental changes, |
|
8926 |
which make old object files totally incompatible |
|
8927 |
(for example, if the layout/representation of fundamental |
|
8928 |
classes changes). |
|
8929 |
||
8930 |
ST/X revision Naming is: |
|
22791 | 8931 |
<major>.<minor>.<revision>.<release>" |
19974 | 8932 |
|
8933 |
^ 7 |
|
10641 | 8934 |
|
8935 |
" |
|
8936 |
Smalltalk majorVersionNr |
|
8937 |
" |
|
8938 |
||
19974 | 8939 |
"Modified: / 09-06-2016 / 16:28:40 / cg" |
10641 | 8940 |
! |
8941 |
||
8942 |
minorVersionNr |
|
8943 |
"{ Pragma: +optSpace }" |
|
8944 |
||
8945 |
"return the minor version number. |
|
8946 |
This is incremented for changes which make some old object |
|
8947 |
files incompatible, or the protocol changes such that some |
|
8948 |
classes need rework. |
|
8949 |
||
8950 |
ST/X revision Naming is: |
|
22791 | 8951 |
<major>.<minor>.<revision>.<release>" |
19974 | 8952 |
|
8953 |
^ 1 |
|
10641 | 8954 |
|
8955 |
" |
|
8956 |
Smalltalk minorVersionNr |
|
8957 |
" |
|
8958 |
||
19974 | 8959 |
"Modified: / 09-06-2016 / 16:28:45 / cg" |
10641 | 8960 |
! |
8961 |
||
8962 |
releaseIdentification |
|
8963 |
"{ Pragma: +optSpace }" |
|
8964 |
||
8965 |
"for developers only: return the release |
|
8966 |
(to further identify the version in case of errors)" |
|
8967 |
||
8968 |
%{ /* NOCONTEXT */ |
|
8969 |
extern OBJ __getRel(); |
|
8970 |
||
8971 |
RETURN (__getRel()); |
|
8972 |
%}. |
|
8973 |
^ 'ST/X_experimental' |
|
8974 |
||
8975 |
" |
|
8976 |
Smalltalk releaseIdentification |
|
8977 |
" |
|
8978 |
! |
|
8979 |
||
8980 |
releaseNr |
|
8981 |
"{ Pragma: +optSpace }" |
|
8982 |
||
14542 | 8983 |
"return the release number. |
8984 |
Now releaseNr is the build number (BUILD_NUMBER from Jenkins) |
|
10641 | 8985 |
|
8986 |
ST/X revision Naming is: |
|
18668 | 8987 |
<major>.<minor>.<revision>.<release>" |
14529 | 8988 |
|
8989 |
|releaseNumber| |
|
8990 |
||
8991 |
releaseNumber := Smalltalk versionBuildNumber. |
|
8992 |
releaseNumber isEmpty ifTrue:[ |
|
18668 | 8993 |
^ 0. |
14529 | 8994 |
]. |
8995 |
^ releaseNumber |
|
10641 | 8996 |
|
8997 |
" |
|
8998 |
Smalltalk releaseNr |
|
12867
2b9cbcea983b
version bump - layout of Class, Method and Context changed.
Claus Gittinger <cg@exept.de>
parents:
12861
diff
changeset
|
8999 |
Smalltalk versionString |
10641 | 9000 |
" |
9001 |
||
9002 |
"Created: / 10-12-1995 / 01:42:19 / cg" |
|
9003 |
"Modified: / 10-02-2007 / 14:49:51 / cg" |
|
9004 |
! |
|
9005 |
||
9006 |
revisionNr |
|
9007 |
"{ Pragma: +optSpace }" |
|
9008 |
||
9009 |
"return the revision number. |
|
9010 |
Incremented for releases which fix bugs/add features |
|
9011 |
and represent a stable workable version which got published |
|
9012 |
to the outside world. |
|
9013 |
||
9014 |
ST/X revision Naming is: |
|
22791 | 9015 |
<major>.<minor>.<revision>.<release>" |
19974 | 9016 |
|
9017 |
^ 0 |
|
10641 | 9018 |
|
9019 |
" |
|
9020 |
Smalltalk revisionNr |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
9021 |
Smalltalk hello string |
13014 | 9022 |
" |
9023 |
||
14898 | 9024 |
"Modified: / 19-03-2013 / 10:48:59 / az" |
19974 | 9025 |
"Modified: / 09-06-2016 / 16:28:57 / cg" |
10641 | 9026 |
! |
9027 |
||
9028 |
timeStamp |
|
9029 |
"return a string useful for timestamping a file. |
|
9030 |
The returned string is padded with spaces for a constant |
|
9031 |
length (to avoid changing a files size in fileOut with unchanged |
|
9032 |
class)." |
|
9033 |
||
9034 |
^ ('''' , self timeStampString , '''') paddedTo:80 with:(Character space) |
|
9035 |
! |
|
9036 |
||
9037 |
timeStamp:aStream |
|
9038 |
"write a string useful for timestamping a file onto aStream. |
|
9039 |
ST80 compatibility" |
|
9040 |
||
9041 |
aStream nextPutAll:(self timeStamp). |
|
9042 |
||
9043 |
"Created: / 18.6.1998 / 17:22:58 / cg" |
|
9044 |
! |
|
9045 |
||
9046 |
timeStampString |
|
9047 |
"return a string useful for timestamping a file." |
|
9048 |
||
9049 |
|dateString| |
|
9050 |
||
9051 |
dateString := String streamContents:[:s | Date today printOn:s language:#en]. "/ MUST be english !!!! |
|
9052 |
||
9053 |
^ ('From Smalltalk/X, Version:' , (Smalltalk versionString) , ' on ' |
|
9054 |
, dateString , ' at ' , Time now printString |
|
7758 | 9055 |
) |
9056 |
! |
|
9057 |
||
14529 | 9058 |
versionBuildNumber |
9059 |
"{ Pragma: +optSpace }" |
|
9060 |
||
9061 |
"return the executables build number - that's the jenkins build #. |
|
9062 |
Empty if not built by jenkins" |
|
9063 |
||
9064 |
%{ /* NOCONTEXT */ |
|
9065 |
extern char *__getBuildNumberString(); |
|
9066 |
||
9067 |
RETURN (__MKSTRING(__getBuildNumberString() COMMA_SND) ); |
|
9068 |
%}. |
|
9069 |
^ '' |
|
9070 |
||
9071 |
" |
|
9072 |
Smalltalk versionBuildNumber |
|
9073 |
" |
|
9074 |
! |
|
9075 |
||
10641 | 9076 |
versionDate |
9077 |
"{ Pragma: +optSpace }" |
|
9078 |
||
14522 | 9079 |
"return the executables build date - that's the date when the smalltalk |
10641 | 9080 |
executable was built" |
9081 |
||
9082 |
%{ /* NOCONTEXT */ |
|
9083 |
extern char *__getBuildDateString(); |
|
9084 |
||
9085 |
RETURN (__MKSTRING(__getBuildDateString() COMMA_SND) ); |
|
9086 |
%}. |
|
9087 |
^ 'today' |
|
9088 |
||
9089 |
" |
|
10071 | 9090 |
Smalltalk versionDate |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
9091 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
9092 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
9093 |
|
10641 | 9094 |
versionString |
9095 |
"{ Pragma: +optSpace }" |
|
9096 |
||
9097 |
"return the version string" |
|
9098 |
||
9099 |
^ (self majorVersionNr printString , |
|
9100 |
'.', |
|
9101 |
self minorVersionNr printString , |
|
9102 |
'.', |
|
14529 | 9103 |
self revisionNr printString, |
9104 |
'.', |
|
9105 |
self releaseNr printString) |
|
13771 | 9106 |
|
10641 | 9107 |
|
9108 |
" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
9109 |
Smalltalk versionString |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
9110 |
" |
10641 | 9111 |
! |
9112 |
||
9113 |
vmMajorVersionNr |
|
9114 |
"{ Pragma: +optSpace }" |
|
9115 |
||
9116 |
"return the VMs major version number." |
|
9117 |
%{ |
|
9118 |
RETURN (__mkSmallInteger(4)); |
|
9119 |
%}. |
|
9120 |
^ 4 |
|
9121 |
||
9122 |
" |
|
9123 |
Smalltalk vmMajorVersionNr |
|
9124 |
" |
|
2 | 9125 |
! ! |
453 | 9126 |
|
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
9127 |
!Smalltalk class methodsFor:'documentation'! |
630 | 9128 |
|
13532
638f9bfab880
changed: #recursiveInstallAutoloadedClassesFrom:rememberIn:maxLevels:noAutoload:packageTop:showSplashInLevels:
Claus Gittinger <cg@exept.de>
parents:
13531
diff
changeset
|
9129 |
version |
18560 | 9130 |
^ '$Header$' |
13532
638f9bfab880
changed: #recursiveInstallAutoloadedClassesFrom:rememberIn:maxLevels:noAutoload:packageTop:showSplashInLevels:
Claus Gittinger <cg@exept.de>
parents:
13531
diff
changeset
|
9131 |
! |
638f9bfab880
changed: #recursiveInstallAutoloadedClassesFrom:rememberIn:maxLevels:noAutoload:packageTop:showSplashInLevels:
Claus Gittinger <cg@exept.de>
parents:
13531
diff
changeset
|
9132 |
|
12172
d90a72004f43
changed: #fileNameForClass:
Claus Gittinger <cg@exept.de>
parents:
12033
diff
changeset
|
9133 |
version_CVS |
18560 | 9134 |
^ '$Header$' |
13415 | 9135 |
! |
9136 |
||
9137 |
version_SVN |
|
15225 | 9138 |
^ '$ Id: Smalltalk.st 10648 2011-06-23 15:55:10Z vranyj1 $' |
630 | 9139 |
! ! |
22792 | 9140 |