author | Claus Gittinger <cg@exept.de> |
Wed, 09 May 2018 14:33:34 +0200 | |
changeset 22831 | 754ac658dc28 |
parent 22799 | 5cc8b7ebdd62 |
child 22900 | 8d0aedd02702 |
permissions | -rw-r--r-- |
22831 | 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: |
|
22791 | 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): |
|
22791 | 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: |
22791 | 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: |
22791 | 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: |
|
22791 | 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:[ |
|
22791 | 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:[ |
22791 | 511 |
BitmapDirName := 'bitmaps'. |
512 |
BinaryDirName := 'binary'. |
|
513 |
SourceDirName := 'source'. |
|
514 |
ResourceDirName := 'resources'. |
|
515 |
FileInDirName := 'fileIn'. |
|
516 |
PackageDirName := 'packages'. |
|
16234 | 517 |
]. |
518 |
||
519 |
SystemPath isEmptyOrNil ifTrue:[ |
|
22791 | 520 |
SystemPath := OperatingSystem defaultSystemPath. |
521 |
self flushPathCaches |
|
16234 | 522 |
]. |
523 |
||
524 |
PackagePath isEmptyOrNil ifTrue:[ |
|
22791 | 525 |
PackagePath := OperatingSystem defaultPackagePath. |
18868 | 526 |
]. |
527 |
self addWorkspaceDirectoryToPackagePath. |
|
20663 | 528 |
self addIdeTopDirectoryToPackagePath. |
617 | 529 |
|
530 |
" |
|
531 |
Smalltalk initSystemPath |
|
532 |
Smalltalk systemPath |
|
11679
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
533 |
|
20640 | 534 |
SystemPath := nil. |
535 |
PackagePath := nil. |
|
11679
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
536 |
OperatingSystem defaultSystemPath |
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
537 |
OperatingSystem defaultPackagePath |
617 | 538 |
" |
5139 | 539 |
|
5145 | 540 |
"Modified: / 24.12.1999 / 00:23:35 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
541 |
! |
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 |
initUserPreferences |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
544 |
"setup other stuff" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
545 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
546 |
LogDoits := false. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
547 |
LoadBinaries := false. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
548 |
SaveEmergencyImage := (StandAlone ~~ true). |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
549 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
550 |
"Modified: / 24.10.1997 / 18:22:47 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
551 |
! |
617 | 552 |
|
7526 | 553 |
initializeClass:aClass |
554 |
"sent from VM via #initializeModules" |
|
555 |
||
7527 | 556 |
Error handle:[:ex | |
22791 | 557 |
ObjectMemory printStackBacktrace. |
558 |
ClassesFailedToInitialize isNil ifTrue:[ |
|
559 |
ClassesFailedToInitialize := IdentitySet new. |
|
560 |
]. |
|
561 |
ClassesFailedToInitialize add:aClass. |
|
562 |
('Smalltalk [warning]: error during initialize of ' , aClass name,': ', ex description printString) errorPrintCR. |
|
563 |
ex suspendedContext fullPrintAll. |
|
564 |
'------------------------------------------------' errorPrintCR. |
|
565 |
(Debugging == true) ifTrue:[ |
|
566 |
ex reject |
|
567 |
]. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
568 |
] do:[ |
22791 | 569 |
aClass initialize |
13675 | 570 |
]. |
571 |
||
572 |
"Modified: / 11-09-2011 / 17:01:32 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
573 |
! |
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 |
initializeModules |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
576 |
"perform module specific initialization and |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
577 |
send #initialize to all classes. |
16180 | 578 |
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
|
579 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
580 |
self initializeModulesOnce. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
581 |
ClassesFailedToInitialize size > 0 ifTrue:[ |
18668 | 582 |
('Smalltalk [info]: retry initialization of failed class(es)...') infoPrintCR. |
583 |
ClassesFailedToInitialize := nil. |
|
584 |
self initializeModulesOnce. |
|
585 |
ClassesFailedToInitialize size > 0 ifTrue:[ |
|
586 |
('Smalltalk [error]: class(es) persist to fail during initialize') errorPrintCR. |
|
587 |
] |
|
10122 | 588 |
]. |
589 |
||
590 |
ProjectDefinition initializeAllProjectDefinitions. |
|
591 |
||
592 |
"Modified: / 23-10-2006 / 16:40:39 / cg" |
|
7527 | 593 |
! |
594 |
||
7563 | 595 |
initializeModulesOnce |
596 |
"perform module specific initialization and |
|
597 |
send #initialize to all classes. |
|
7527 | 598 |
Notice: this is not called when an image is restarted" |
4963 | 599 |
|
617 | 600 |
%{ |
18349 | 601 |
#ifdef __SCHTEAM__ |
602 |
STClass.initializeAllClasses(__c__); |
|
603 |
return __c__._RETURN_self(); |
|
604 |
#else |
|
1688
8a42db1eea60
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1682
diff
changeset
|
605 |
__init_registered_modules__(3); |
4963 | 606 |
|
1481 | 607 |
@global(DemoMode) = __getDemoMode() ? true : false; |
5410 | 608 |
RETURN (self); |
18349 | 609 |
#endif /* not SCHTEAM */ |
5410 | 610 |
%}. |
611 |
^ self primitiveFailed |
|
617 | 612 |
! |
613 |
||
7563 | 614 |
initializeSystem |
16655 | 615 |
"initialize all classes; setup dispatcher processes etc. |
3499 | 616 |
This one is the very first entry into the smalltalk world, |
16655 | 617 |
right after startup, usually immediately followed by Smalltalk>>start. |
618 |
Here, a few specific initializations are done, then the actual initialization is |
|
619 |
done inside an error handler in basicInitializeSystem. |
|
10071 | 620 |
Notice: |
22791 | 621 |
this is called by the VM's main entry. You will not find senders from Smalltalk. |
18385 | 622 |
Also Notice: |
22791 | 623 |
this is NOT called when an image is restarted; |
624 |
in this case the show starts in Smalltalk>>restart." |
|
211 | 625 |
|
19510 | 626 |
|idx shellArgs| |
6841
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
627 |
|
12861 | 628 |
NumberOfClassesHint := 10000. |
8964
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
629 |
|
3499 | 630 |
Initializing := true. |
631 |
AbstractOperatingSystem initializeConcreteClass. |
|
632 |
||
18307
c1d97d109f88
also care for empty cmd-line args (could be empty OrderedCollection)
Claus Gittinger <cg@exept.de>
parents:
18293
diff
changeset
|
633 |
CommandLineArguments isEmptyOrNil ifTrue:[ |
22791 | 634 |
CommandLineArguments := #('stx') asOrderedCollection. |
5400 | 635 |
]. |
4006
c7ad38c52eb9
must set CommandLineArguments earlier (to be available in initializeSystem)
Claus Gittinger <cg@exept.de>
parents:
4001
diff
changeset
|
636 |
CommandLine := CommandLineArguments copy. |
c7ad38c52eb9
must set CommandLineArguments earlier (to be available in initializeSystem)
Claus Gittinger <cg@exept.de>
parents:
4001
diff
changeset
|
637 |
CommandLineArguments := CommandLineArguments asOrderedCollection. |
6842 | 638 |
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
|
639 |
|
21021 | 640 |
SilentLoading := Silent := false. |
641 |
VerboseLoading := VerboseStartup := Verbose := false. |
|
19427 | 642 |
DebuggingStandAlone := Debugging := false. |
19510 | 643 |
|
644 |
"/ if no argument was given, look for an environment variable named |
|
645 |
"/ STX_DEFAULT_ARGS. If set, take that. |
|
646 |
"/ if any argument was given, unless a --noShellArgs argument is given, |
|
647 |
"/ slice in the value from "STX_MORE_ARGS" at the beginning. |
|
648 |
"/ |
|
649 |
"/ These allow for args like "--quick --infoPrint" to be automatically prepended |
|
19511 | 650 |
idx := CommandLineArguments indexOfAny:#('--noShellArgs' '--noshellargs'). |
19510 | 651 |
(idx ~~ 0) ifTrue:[ |
22791 | 652 |
CommandLineArguments removeIndex:idx. |
653 |
] ifFalse:[ |
|
654 |
CommandLineArguments isEmpty ifTrue:[ |
|
655 |
shellArgs := OperatingSystem getEnvironment:'STX_DEFAULT_ARGS'. |
|
656 |
shellArgs notEmptyOrNil ifTrue:[ |
|
657 |
shellArgs := shellArgs asCollectionOfWords. |
|
658 |
CommandLineArguments addAll:shellArgs. |
|
659 |
]. |
|
660 |
] ifFalse:[ |
|
661 |
"/ prepend shell environment args from "STX_ARGS" |
|
662 |
shellArgs := OperatingSystem getEnvironment:'STX_MORE_ARGS'. |
|
663 |
shellArgs notEmptyOrNil ifTrue:[ |
|
664 |
shellArgs := shellArgs asCollectionOfWords. |
|
665 |
CommandLineArguments addAllFirst:shellArgs. |
|
666 |
]. |
|
667 |
]. |
|
668 |
]. |
|
669 |
||
670 |
self initializeVerboseFlags. |
|
14432 | 671 |
|
11057 | 672 |
Error handle:[:ex | |
22791 | 673 |
StandAlone ifTrue:[ |
674 |
DebuggingStandAlone ifFalse:[ |
|
675 |
'Startup Error - use "--debug" command line argument for more info' errorPrintCR. |
|
676 |
Smalltalk exit:1. |
|
677 |
]. |
|
678 |
'Smalltalk [error]: Error during early initialization:' errorPrintCR. |
|
679 |
thisContext fullPrintAll. |
|
680 |
]. |
|
681 |
ex reject. |
|
11057 | 682 |
] do:[ |
22791 | 683 |
self basicInitializeSystem |
14432 | 684 |
]. |
13091
bc840cd6f1ae
--verboseLoading command line arg (shlib loading trace)
Claus Gittinger <cg@exept.de>
parents:
13061
diff
changeset
|
685 |
|
bc840cd6f1ae
--verboseLoading command line arg (shlib loading trace)
Claus Gittinger <cg@exept.de>
parents:
13061
diff
changeset
|
686 |
"Modified: / 12-10-2010 / 11:27:47 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
687 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
688 |
|
18669 | 689 |
initializeVerboseFlags |
690 |
|idx| |
|
691 |
||
21021 | 692 |
StandAlone ifTrue:[ |
22791 | 693 |
InfoPrinting := false. |
694 |
ObjectMemory infoPrinting:false. |
|
695 |
IgnoreAssertions := true. |
|
21021 | 696 |
] ifFalse:[ |
22791 | 697 |
IgnoreAssertions := false. |
698 |
]. |
|
699 |
||
19430 | 700 |
(idx := CommandLineArguments indexOf:'--ignoreHalt') ~~ 0 ifTrue:[ |
22791 | 701 |
IgnoreHalt := true. |
702 |
CommandLineArguments removeIndex:idx |
|
19430 | 703 |
]. |
20855 | 704 |
(idx := CommandLineArguments indexOf:'--noIgnoreHalt') ~~ 0 ifTrue:[ |
22791 | 705 |
IgnoreHalt := false. |
706 |
CommandLineArguments removeIndex:idx |
|
20855 | 707 |
]. |
708 |
(idx := CommandLineArguments indexOf:'--ignoreAssert') ~~ 0 ifTrue:[ |
|
22791 | 709 |
IgnoreAssertions := true. |
710 |
CommandLineArguments removeIndex:idx |
|
20855 | 711 |
]. |
712 |
(idx := CommandLineArguments indexOf:'--noIgnoreAssert') ~~ 0 ifTrue:[ |
|
22791 | 713 |
IgnoreAssertions := false. |
714 |
CommandLineArguments removeIndex:idx |
|
20855 | 715 |
]. |
22314 | 716 |
(idx := CommandLineArguments indexOf:'--assert') ~~ 0 ifTrue:[ |
22791 | 717 |
IgnoreAssertions := false. |
718 |
CommandLineArguments removeIndex:idx |
|
22314 | 719 |
]. |
18669 | 720 |
(idx := CommandLineArguments indexOf:'--silentStartup') ~~ 0 ifTrue:[ |
22791 | 721 |
SilentLoading := true. |
722 |
CommandLineArguments removeIndex:idx |
|
18669 | 723 |
]. |
724 |
(idx := CommandLineArguments indexOf:'--verboseLoading') ~~ 0 ifTrue:[ |
|
22791 | 725 |
VerboseLoading := true. |
726 |
CommandLineArguments removeIndex:idx |
|
18669 | 727 |
]. |
728 |
(idx := CommandLineArguments indexOf:'--verboseStartup') ~~ 0 ifTrue:[ |
|
22791 | 729 |
VerboseLoading := true. |
730 |
VerboseStartup := true. |
|
731 |
CommandLineArguments removeIndex:idx |
|
18669 | 732 |
]. |
20855 | 733 |
|
734 |
"/ reinterpret those, in case given after the VM options. |
|
735 |
(idx := CommandLineArguments indexOf:'--debugPrint') ~~ 0 ifTrue:[ |
|
22791 | 736 |
ObjectMemory debugPrinting:true. |
737 |
CommandLineArguments removeIndex:idx |
|
20855 | 738 |
]. |
739 |
(idx := CommandLineArguments indexOf:'--infoPrint') ~~ 0 ifTrue:[ |
|
22791 | 740 |
ObjectMemory infoPrinting:true. |
741 |
CommandLineArguments removeIndex:idx |
|
20855 | 742 |
]. |
743 |
||
18669 | 744 |
(idx := CommandLineArguments indexOf:'--verbose') ~~ 0 ifTrue:[ |
22791 | 745 |
Object infoPrinting:true. |
746 |
Verbose := true. |
|
747 |
VerboseLoading := true. |
|
748 |
VerboseStartup := true. |
|
749 |
Logger notNil ifTrue:[ |
|
750 |
Logger loggingThreshold: Logger severityALL. |
|
751 |
]. |
|
752 |
CommandLineArguments removeIndex:idx. |
|
21020 | 753 |
]. |
754 |
||
755 |
Silent := false. |
|
756 |
(idx := CommandLineArguments indexOf:'--silent') ~~ 0 ifTrue:[ |
|
22791 | 757 |
CommandLineArguments removeIndex:idx. |
758 |
Silent := SilentLoading := true. |
|
759 |
Object infoPrinting:false. |
|
760 |
ObjectMemory infoPrinting:false. |
|
761 |
ObjectMemory debugPrinting:false. |
|
762 |
Verbose := VerboseLoading := VerboseStartup := false. |
|
763 |
Logger notNil ifTrue:[ |
|
764 |
Logger loggingThreshold: Logger severityNONE |
|
765 |
]. |
|
18669 | 766 |
]. |
21021 | 767 |
|
768 |
idx := CommandLineArguments indexOf:'--debug'. |
|
769 |
Debugging := (idx ~~ 0). |
|
770 |
||
771 |
StandAlone ifTrue:[ |
|
22791 | 772 |
DebuggingStandAlone := Debugging. |
773 |
DebuggingStandAlone ifTrue:[ |
|
774 |
Inspector := MiniInspector. |
|
775 |
Debugger := MiniDebugger. |
|
776 |
IgnoreAssertions := false. |
|
777 |
]. |
|
21021 | 778 |
] ifFalse:[ |
22791 | 779 |
"/ |
780 |
"/ define low-level debugging tools - graphical classes are not prepared yet |
|
781 |
"/ to handle things. |
|
782 |
"/ This will bring us into the MiniDebugger when an error occurs during startup. |
|
783 |
"/ |
|
784 |
Inspector := MiniInspector. |
|
785 |
Debugger := MiniDebugger. |
|
21021 | 786 |
]. |
22314 | 787 |
|
788 |
"Modified: / 12-10-2017 / 17:48:11 / cg" |
|
18669 | 789 |
! |
790 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
791 |
isInitialized |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
792 |
"this returns true, if the system is properly initialized; |
16170
ca4d03def070
endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents:
16164
diff
changeset
|
793 |
i.e. false during startup. |
15980 | 794 |
Especially, the whole display/viewing stuff and process escheduling |
795 |
is not working correctly until initialized." |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
796 |
|
18251
9b7f8e531a16
isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents:
18248
diff
changeset
|
797 |
Initializing isNil ifTrue:[^ false]. "/ if called very early |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
798 |
^ Initializing not |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
799 |
! |
1 | 800 |
|
7563 | 801 |
reinitStandardStreams |
802 |
"reinitialize some well-known streams. |
|
803 |
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
|
804 |
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
|
805 |
(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
|
806 |
|
8710aba7876b
oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents:
457
diff
changeset
|
807 |
Stdout reOpen. Stderr reOpen. Stdin reOpen. |
161 | 808 |
! ! |
809 |
||
16593 | 810 |
!Smalltalk class methodsFor:'Compatibility-GNU'! |
811 |
||
812 |
system:command |
|
813 |
"GNU-Smalltalk compatibility: execute an OS command" |
|
814 |
||
815 |
OperatingSystem executeCommand:command |
|
816 |
||
817 |
" |
|
818 |
Smalltalk system:'ls' |
|
819 |
" |
|
820 |
! ! |
|
821 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
822 |
!Smalltalk class methodsFor:'Compatibility-Squeak'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
823 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
824 |
beep |
17343 | 825 |
"output an audible beep or bell" |
826 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
827 |
Screen current beep |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
828 |
! |
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 |
garbageCollect |
15009 | 831 |
"for Squeak compatibility" |
832 |
||
833 |
ObjectMemory garbageCollect |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
834 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
835 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
836 |
garbageCollectMost |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
837 |
"collect recently created garbage; return the amount of freeSpace. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
838 |
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
|
839 |
newSpace + freeListSpace is returned." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
840 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
841 |
ObjectMemory scavenge. |
15009 | 842 |
^ ObjectMemory freeSpace + (ObjectMemory newSpaceSize - ObjectMemory newSpaceUsed) |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
843 |
! |
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 |
isMorphic |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
846 |
^ false |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
847 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
848 |
|
10844 | 849 |
platformName |
850 |
"not yet fully implemented (I have to figure out, what squeak returns in each case...)" |
|
851 |
||
852 |
^ OperatingSystem platformName asUppercaseFirst |
|
853 |
||
854 |
" |
|
855 |
Smalltalk platformName -> 'Win32' |
|
856 |
" |
|
857 |
! |
|
858 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
859 |
registerExternalObject: anObject |
7563 | 860 |
"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
|
861 |
If it is already there, just return its index. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
862 |
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
|
863 |
primitive code (via the global Smalltalk:SpecialObjectArray)" |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
864 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
865 |
| objects firstEmptyIndex obj sz newObjects | |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
866 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
867 |
objects := SpecialObjectArray. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
868 |
objects isNil ifTrue:[ |
18668 | 869 |
objects := Array new:5. |
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
870 |
]. |
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 |
"find the first empty slot and look if already registered" |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
873 |
firstEmptyIndex := 0. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
874 |
1 to: objects size do: [:i | |
18668 | 875 |
obj := objects at: i. |
876 |
obj == anObject ifTrue: [^ i]. "object already there, just return its index" |
|
877 |
(obj == nil and: [firstEmptyIndex = 0]) ifTrue: [ |
|
878 |
firstEmptyIndex := i |
|
879 |
] |
|
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
880 |
]. |
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 |
"if no empty slots, expand the array" |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
883 |
firstEmptyIndex = 0 ifTrue: [ |
18668 | 884 |
sz := objects size. |
885 |
newObjects := objects species new: sz + 20. "grow linearly" |
|
886 |
newObjects replaceFrom: 1 to: sz with: objects startingAt: 1. |
|
887 |
firstEmptyIndex := sz + 1. |
|
888 |
SpecialObjectArray := newObjects. |
|
889 |
objects := newObjects |
|
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
890 |
]. |
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 |
objects at: firstEmptyIndex put: anObject. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
893 |
^ firstEmptyIndex |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
894 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
895 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
896 |
|
12358 | 897 |
removeClassNamed: aName |
17576 | 898 |
"Invoked from fileouts: if there is currently a class in the system named aName, then remove it. |
899 |
Also needed by the refactory browser. |
|
900 |
If anything untoward happens, report it in the Transcript." |
|
12358 | 901 |
|
902 |
| oldClass | |
|
903 |
||
904 |
(oldClass := self at: aName asSymbol ifAbsent: [nil]) isNil ifTrue:[ |
|
18668 | 905 |
Transcript showCR: 'Removal of class named ', aName, ' ignored because it does not exist.'. |
906 |
^ self |
|
12358 | 907 |
]. |
908 |
oldClass removeFromSystem |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
909 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
910 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
911 |
!Smalltalk class methodsFor:'Compatibility-V''Age'! |
6722
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
912 |
|
7563 | 913 |
allClassesImplementing:aSelector |
12304
b0dc1c58de1a
changed: #allClassesImplementing:
Claus Gittinger <cg@exept.de>
parents:
12301
diff
changeset
|
914 |
^ self allClassesForWhich:[:cls | cls includesSelector:aSelector]. |
9506 | 915 |
|
916 |
"Modified: / 10-08-2006 / 12:12:17 / cg" |
|
9090 | 917 |
! |
918 |
||
16459 | 919 |
declareConstant:constantName poolName:poolNameArg value:value |
920 |
"visualAge compatible pool variable declaration. |
|
16562 | 921 |
called when a V'age application is filed in |
16459 | 922 |
(or one of its changes is accepted via the change browser)" |
923 |
||
924 |
|ns poolName pool| |
|
925 |
||
926 |
"/ when coming from the change-browser, |
|
927 |
"/ a namespace override may be given... |
|
928 |
ns := Class nameSpaceQuerySignal query. |
|
929 |
(ns isNil or:[ns == Smalltalk]) ifTrue:[ |
|
18668 | 930 |
poolName := poolNameArg asSymbol |
16459 | 931 |
] ifFalse:[ |
18668 | 932 |
poolName := (ns name,'::',poolNameArg) asSymbol |
16459 | 933 |
]. |
9090 | 934 |
pool := self classNamed:poolName. |
935 |
pool declareConstant:constantName value:value |
|
936 |
! |
|
937 |
||
16459 | 938 |
declarePoolDictionary:poolDictionaryNameArg |
939 |
"visualAge compatible pool declaration. |
|
16562 | 940 |
called when a V'age application is filed in |
16459 | 941 |
(or one of its changes is accepted via the change browser)" |
942 |
||
943 |
|ns poolName| |
|
944 |
||
945 |
poolName := poolDictionaryNameArg asSymbol. |
|
946 |
||
947 |
"/ "/ when coming from the change-browser, |
|
948 |
"/ "/ a namespace override may be given... |
|
949 |
"/ ns := Class nameSpaceQuerySignal query. |
|
950 |
"/ (ns isNil or:[ns == Smalltalk]) ifTrue:[ |
|
951 |
"/ poolName := poolDictionaryNameArg asSymbol |
|
952 |
"/ ] ifFalse:[ |
|
953 |
"/ poolName := (ns name,'::',poolDictionaryNameArg) asSymbol |
|
954 |
"/ ]. |
|
955 |
^ SharedPool subclass:(poolName asSymbol) |
|
18668 | 956 |
instanceVariableNames:'' |
957 |
classVariableNames:'' |
|
958 |
poolDictionaries:'' |
|
959 |
category:'* VAST Pools' |
|
13998
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
960 |
|
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
961 |
"Modified: / 07-02-2012 / 15:56:16 / cg" |
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
962 |
! |
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
963 |
|
16459 | 964 |
declareVariable:varName poolName:poolNameArg |
965 |
"visualAge compatible pool declaration. |
|
16562 | 966 |
called when a V'age application is filed in |
16459 | 967 |
(or one of its changes is accepted via the change browser)" |
968 |
||
969 |
|ns poolName pool| |
|
970 |
||
971 |
"/ when coming from the change-browser, |
|
972 |
"/ a namespace override may be given... |
|
973 |
ns := Class nameSpaceQuerySignal query. |
|
974 |
(ns isNil or:[ns == Smalltalk]) ifTrue:[ |
|
18668 | 975 |
poolName := poolNameArg asSymbol |
16459 | 976 |
] ifFalse:[ |
18668 | 977 |
poolName := (ns name,'::',poolNameArg) asSymbol |
16459 | 978 |
]. |
13998
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
979 |
pool := self classNamed:poolName. |
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
980 |
pool declareVariable:varName |
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
981 |
|
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
982 |
"Created: / 07-02-2012 / 15:57:05 / cg" |
6722
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
983 |
! ! |
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
984 |
|
20755 | 985 |
!Smalltalk class methodsFor:'Compatibility-VW'! |
6094
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
986 |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
987 |
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
|
988 |
^ self |
18668 | 989 |
defineClass:nameSymbol |
990 |
superclass:superclass |
|
991 |
indexedType:indexed |
|
992 |
private:private |
|
993 |
instanceVariableNames:instVars |
|
994 |
classInstanceVariableNames:classInstVars |
|
995 |
imports:imports |
|
996 |
category:category |
|
997 |
attributes:nil |
|
12033 | 998 |
! |
999 |
||
7563 | 1000 |
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
|
1001 |
|newClass| |
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
1002 |
|
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
1003 |
indexed == #none ifTrue:[ |
18668 | 1004 |
newClass := superclass |
1005 |
subclass:nameSymbol |
|
1006 |
instanceVariableNames:instVars |
|
1007 |
classVariableNames:'' |
|
1008 |
poolDictionaries:'' |
|
1009 |
category:category |
|
1010 |
inEnvironment:self. |
|
1011 |
classInstVars size > 0 ifTrue:[ |
|
1012 |
newClass class instanceVariableNames:classInstVars. |
|
1013 |
]. |
|
1014 |
^ newClass |
|
6851 | 1015 |
]. |
1016 |
self shouldImplement. |
|
12033 | 1017 |
! |
1018 |
||
1019 |
defineNameSpace:nameSymbol private:private imports:imports category:category |
|
1020 |
|newNameSpace| |
|
1021 |
||
1022 |
private ifTrue:[self halt]. "/ what to do ? |
|
1023 |
imports withoutSeparators notEmpty ifTrue:[self halt]. "/ what to do ? |
|
1024 |
newNameSpace := NameSpace name:nameSymbol. |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1025 |
newNameSpace setCategory:category. |
12033 | 1026 |
^ newNameSpace |
20755 | 1027 |
! |
1028 |
||
1029 |
dialectName |
|
1030 |
^ #SmalltalkX |
|
1031 |
||
1032 |
" |
|
1033 |
Smalltalk dialectName |
|
1034 |
" |
|
1035 |
! |
|
1036 |
||
1037 |
dialectReleaseVersion |
|
1038 |
^ self versionString |
|
1039 |
||
1040 |
" |
|
1041 |
Smalltalk dialectReleaseVersion |
|
1042 |
" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1043 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1044 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1045 |
!Smalltalk class methodsFor:'accessing'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1046 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1047 |
associationAt:aKey |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1048 |
"return a key-value association for aKey. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1049 |
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
|
1050 |
simulated here." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1051 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1052 |
|val| |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1053 |
|
20161 | 1054 |
val := self at:aKey ifAbsent:[^ nil]. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1055 |
^ Association key:aKey value:val |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1056 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1057 |
"Created: / 1.11.1997 / 13:27:20 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1058 |
! |
3083 | 1059 |
|
7563 | 1060 |
associationAt:aKey ifAbsent:exceptionBlock |
1061 |
"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
|
1062 |
from exceptionBlock, if no such key is present. |
14973 | 1063 |
Since ST/X's Smalltalk as no real dictionary, this is simulated here. |
20161 | 1064 |
Warning: this is a compatibility interface only, with a different semantic as |
22791 | 1065 |
the original ST80 implementation. The returned assoc is created on the fly, |
1066 |
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
|
1067 |
|
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
1068 |
|val| |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
1069 |
|
20161 | 1070 |
val := self at:aKey ifAbsent:[^ exceptionBlock value]. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1071 |
^ Association key:aKey value:val |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1072 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1073 |
"Created: / 18.6.1998 / 17:05:24 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1074 |
! |
3610
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
1075 |
|
7563 | 1076 |
at:aKey |
10071 | 1077 |
"retrieve the value stored under aKey, a symbol. |
1078 |
Return nil if not present |
|
1956 | 1079 |
(this will be changed to trigger an error - better use #at:ifAbsent:)" |
453 | 1080 |
|
16831 | 1081 |
aKey class == Symbol ifFalse:[self error:'expected symbol']. |
6080
15ea3cbf6003
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
6074
diff
changeset
|
1082 |
|
453 | 1083 |
%{ /* NOCONTEXT */ |
18287 | 1084 |
#ifdef __SCHTEAM__ |
1085 |
{ |
|
18668 | 1086 |
STSymbol keySymbol = aKey.asSTSymbol(); |
1087 |
STObject val = STSmalltalkEnvironment.GetResolvedBindingOrNull(keySymbol); |
|
1088 |
||
1089 |
return context._RETURN( val == null ? Nil : val ); |
|
18287 | 1090 |
} |
1091 |
/* NOT REACHED */ |
|
1092 |
#else |
|
453 | 1093 |
RETURN ( __GLOBAL_GET(aKey) ); |
18287 | 1094 |
#endif |
5406 | 1095 |
%}. |
5410 | 1096 |
^ self primitiveFailed |
453 | 1097 |
! |
1098 |
||
7563 | 1099 |
at:aKey ifAbsent:aBlock |
1100 |
"retrieve the value stored at aKey. |
|
7565 | 1101 |
If there is nothing stored under this key, return the value of |
1102 |
the evaluation of aBlock." |
|
453 | 1103 |
|
20161 | 1104 |
|val| |
1105 |
||
1106 |
val := self at:aKey. |
|
1107 |
(val notNil or:[self includesKey:aKey]) ifTrue:[ |
|
22791 | 1108 |
^ val |
453 | 1109 |
]. |
1110 |
^ aBlock value |
|
1111 |
||
1112 |
" |
|
20161 | 1113 |
Smalltalk removeKey:#fooBar. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1114 |
Smalltalk at:#fooBar <- returns nil |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1115 |
Smalltalk at:#fooBar ifAbsent:['sorry'] <- no error |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1116 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1117 |
! |
453 | 1118 |
|
15068 | 1119 |
at:aKey ifAbsentPut:aBlock |
1120 |
"return the element indexed by aKey if present, |
|
1121 |
if not present, store the result of evaluating valueBlock |
|
1122 |
under aKey and return it." |
|
1123 |
||
1124 |
^ self at:aKey ifAbsent:[ self at:aKey put:aBlock value ]. |
|
1125 |
||
1126 |
"Created: / 29-05-2007 / 12:41:12 / cg" |
|
1127 |
! |
|
1128 |
||
7563 | 1129 |
at:aKey ifPresent:aBlock |
1130 |
"try to retrieve the value stored at aKey. |
|
1131 |
If there is nothing stored under this key, do nothing. |
|
4870 | 1132 |
Otherwise, evaluate aBlock, passing the retrieved value as argument." |
1133 |
||
13883 | 1134 |
|val| |
1135 |
||
20161 | 1136 |
val := self at:aKey. |
1137 |
(val notNil or:[self includesKey:aKey]) ifTrue:[ |
|
22791 | 1138 |
^ aBlock value:val. |
4870 | 1139 |
]. |
1140 |
^ nil |
|
1141 |
||
1142 |
" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1143 |
Smalltalk at:#fooBar ifPresent:[:what | Transcript showCR:what]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1144 |
Smalltalk at:#Object ifPresent:[:what | Transcript showCR:what]. |
20161 | 1145 |
|
1146 |
Smalltalk at:#fooBar put:nil. |
|
1147 |
Smalltalk at:#fooBar ifPresent:[:what | Transcript showCR:what]. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1148 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1149 |
|
13883 | 1150 |
"Modified: / 27-12-2011 / 10:14:30 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1151 |
! |
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 |
at:aKey put:aValue |
7563 | 1154 |
"store the argument aValue under aKey, a symbol. |
1155 |
Return aValue (sigh)." |
|
453 | 1156 |
|
1157 |
|oldValue| |
|
1158 |
||
1159 |
%{ |
|
18287 | 1160 |
#ifdef __SCHTEAM__ |
1161 |
{ |
|
18668 | 1162 |
STSymbol keySymbol = aKey.asSTSymbol(); |
1163 |
oldValue = STSmalltalkEnvironment.SetBinding(keySymbol, aValue); |
|
18287 | 1164 |
} |
1165 |
#else |
|
453 | 1166 |
oldValue = __GLOBAL_SET(aKey, aValue, (OBJ *)0); |
18287 | 1167 |
#endif |
453 | 1168 |
%}. |
1169 |
CachedClasses notNil ifTrue:[ |
|
18668 | 1170 |
oldValue isBehavior ifTrue:[ |
1171 |
oldValue name == aKey ifTrue:[ |
|
1172 |
CachedClasses remove:oldValue ifAbsent:[] |
|
1173 |
] |
|
1174 |
]. |
|
1175 |
aValue isBehavior ifTrue:[ |
|
1176 |
aValue name == aKey ifTrue:[ |
|
1177 |
CachedClasses add:aValue |
|
1178 |
] ifFalse:[ |
|
1179 |
CachedClasses := nil |
|
1180 |
] |
|
1181 |
]. |
|
453 | 1182 |
]. |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
1183 |
^ aValue. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1184 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1185 |
"Modified: 19.4.1996 / 11:31:49 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1186 |
! |
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 |
includesKey:aKey |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1189 |
"return true, if the key is known" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1190 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1191 |
"/ for debugging - this is a common mistake, |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1192 |
"/ to try to access a class by nameString, instead |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1193 |
"/ of by symbol. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1194 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1195 |
"/ aKey class == String ifTrue:[self halt]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1196 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1197 |
%{ /* NOCONTEXT */ |
18287 | 1198 |
#ifdef __SCHTEAM__ |
1199 |
STSymbol keySymbol = aKey.asSTSymbol(); |
|
18668 | 1200 |
return __c__._RETURN( STSmalltalkEnvironment.HasBinding(keySymbol) ? STObject.True : STObject.False); |
18287 | 1201 |
/* NOT REACHED */ |
1202 |
#else |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1203 |
RETURN ( __GLOBAL_KEYKNOWN(aKey) ); |
18287 | 1204 |
#endif |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1205 |
%}. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1206 |
^ self primitiveFailed |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1207 |
! |
453 | 1208 |
|
7563 | 1209 |
keyAtValue:anObject |
21365 | 1210 |
"return the symbol under which anObject is stored - or nil. |
1211 |
This is a slow access, since the receiver is searched sequentially. |
|
1212 |
NOTICE: |
|
22791 | 1213 |
The value is searched using identity compare" |
453 | 1214 |
|
1215 |
self keysDo:[:aKey | |
|
22791 | 1216 |
(self at:aKey) == anObject ifTrue:[^ aKey] |
453 | 1217 |
]. |
1218 |
^ nil |
|
1219 |
||
1220 |
"Smalltalk keyAtValue:Object" |
|
21365 | 1221 |
|
1222 |
"Modified (comment): / 07-02-2017 / 11:06:21 / cg" |
|
453 | 1223 |
! |
1224 |
||
21363 | 1225 |
keyAtValue:anObject ifAbsent:exceptionValue |
21365 | 1226 |
"return the symbol under which anObject is stored - or the value from exceptionValue. |
1227 |
This is a slow access, since the receiver is searched sequentially. |
|
1228 |
NOTICE: |
|
22791 | 1229 |
The value is searched using identity compare" |
21363 | 1230 |
|
1231 |
self keysDo:[:aKey | |
|
22791 | 1232 |
(self at:aKey) == anObject ifTrue:[^ aKey] |
21363 | 1233 |
]. |
1234 |
^ exceptionValue value |
|
1235 |
||
1236 |
" |
|
1237 |
Smalltalk keyAtValue:Object ifAbsent:#foo |
|
1238 |
Smalltalk keyAtValue:1234 ifAbsent:#foo |
|
1239 |
" |
|
1240 |
||
1241 |
"Created: / 07-02-2017 / 10:58:51 / cg" |
|
1242 |
! |
|
1243 |
||
7563 | 1244 |
keys |
1245 |
"return a collection with all keys in the Smalltalk dictionary" |
|
1246 |
||
1247 |
|keys| |
|
453 | 1248 |
|
1249 |
keys := IdentitySet new. |
|
1250 |
self keysDo:[:k | keys add:k]. |
|
1251 |
^ keys |
|
617 | 1252 |
! |
1253 |
||
7563 | 1254 |
removeKey:aKey |
1255 |
"remove the association stored under the key-argument from the globals dictionary. |
|
10071 | 1256 |
WARNING: |
18668 | 1257 |
this is somewhat dangerous: conceptionally, the association is removed, |
1258 |
to which machine & byte compiled code refers if it accesses a global. |
|
1259 |
If there are still global accesses in some literalArray or from machine-compiled code, |
|
1260 |
it continues to reference the globals value via that obsolete association and gets a nil |
|
1261 |
value. (which is correct) |
|
1262 |
However, if that global is later reintroduced, a new association will be created and |
|
1263 |
the new global now referenced via the new association. |
|
1264 |
The old accesses will still see nil, although the globals value is actually non-nil |
|
1265 |
(this is questionable). |
|
1266 |
To avoid this problem, the #removeClass: method never removed the key." |
|
617 | 1267 |
|
1268 |
CachedClasses := nil. |
|
1269 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1270 |
%{ /* NOCONTEXT */ |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1271 |
RETURN ( __GLOBAL_REMOVE(aKey) ); |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1272 |
%}. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1273 |
^ self primitiveFailed |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1274 |
|
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 |
|
10538 | 1277 |
startBlocks |
1278 |
^ StartBlocks |
|
1279 |
! |
|
1280 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1281 |
values |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1282 |
"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
|
1283 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1284 |
|values| |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1285 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1286 |
values := OrderedCollection new. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1287 |
self do:[:v | values add:v]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1288 |
^ values |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1289 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1290 |
"Created: 20.6.1997 / 16:58:28 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1291 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1292 |
|
13540 | 1293 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1294 |
!Smalltalk class methodsFor:'browsing'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1295 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1296 |
browseAllCallsOn:aSelectorSymbol |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1297 |
"{ Pragma: +optSpace }" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1298 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1299 |
"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
|
1300 |
|
22241 | 1301 |
SystemBrowser default browseAllCallsOn:aSelectorSymbol |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1302 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1303 |
" |
10071 | 1304 |
Smalltalk browseAllCallsOn:#at:put: |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1305 |
" |
22241 | 1306 |
|
1307 |
"Modified: / 01-09-2017 / 14:21:31 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1308 |
! |
617 | 1309 |
|
7563 | 1310 |
browseAllSelect:aBlock |
1311 |
"{ Pragma: +optSpace }" |
|
1312 |
||
1313 |
"startup a browser for all methods for which aBlock returns true" |
|
617 | 1314 |
|
22241 | 1315 |
SystemBrowser default browseAllSelect:aBlock |
617 | 1316 |
|
1317 |
" |
|
1318 |
Smalltalk browseAllSelect:[:m | m literals isNil] |
|
1319 |
" |
|
22241 | 1320 |
|
1321 |
"Modified: / 01-09-2017 / 14:21:34 / cg" |
|
617 | 1322 |
! |
1323 |
||
7563 | 1324 |
browseChanges |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1325 |
"{ Pragma: +optSpace }" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1326 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1327 |
"startup a changes browser" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1328 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1329 |
ChangesBrowser notNil ifTrue:[ |
18668 | 1330 |
ChangesBrowser open |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1331 |
] ifFalse:[ |
18668 | 1332 |
self warn:'no ChangesBrowser built in' |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1333 |
] |
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 |
Smalltalk browseChanges |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1337 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1338 |
! |
453 | 1339 |
|
7563 | 1340 |
browseClass:aClass |
1341 |
"{ Pragma: +optSpace }" |
|
1342 |
||
11375 | 1343 |
"startup a browser on aClass. |
11150 | 1344 |
The broser will only show that class (i.e. be a singleClass-browser). |
1345 |
See browseInClass: for a full browser, which has aClass selected initially." |
|
6970 | 1346 |
|
22241 | 1347 |
SystemBrowser default browseClass:aClass |
6970 | 1348 |
|
1349 |
" |
|
10071 | 1350 |
Smalltalk browseClass:Array |
6970 | 1351 |
" |
22241 | 1352 |
|
1353 |
"Modified: / 01-09-2017 / 14:21:37 / cg" |
|
6970 | 1354 |
! |
1355 |
||
7563 | 1356 |
browseImplementorsMatching:aSelectorSymbolOrMatchPattern |
1357 |
"{ Pragma: +optSpace }" |
|
6819 | 1358 |
|
1359 |
"startup a browser for all methods implementing a message matching" |
|
1360 |
||
22241 | 1361 |
SystemBrowser default browseImplementorsMatching:aSelectorSymbolOrMatchPattern |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1362 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1363 |
" |
10071 | 1364 |
Smalltalk browseImplementorsOf:#'at:put:' |
1365 |
Smalltalk browseImplementorsMatching:#'at:*' |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1366 |
" |
22241 | 1367 |
|
1368 |
"Modified: / 01-09-2017 / 14:21:39 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1369 |
! |
6819 | 1370 |
|
7563 | 1371 |
browseImplementorsOf:aSelectorSymbol |
1372 |
"{ Pragma: +optSpace }" |
|
1373 |
||
1374 |
"startup a browser for all methods implementing a particular message" |
|
453 | 1375 |
|
22241 | 1376 |
SystemBrowser default browseImplementorsOf:aSelectorSymbol |
453 | 1377 |
|
1378 |
" |
|
10071 | 1379 |
Smalltalk browseImplementorsOf:#at:put: |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1380 |
" |
22241 | 1381 |
|
1382 |
"Modified: / 01-09-2017 / 14:21:42 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1383 |
! |
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 |
browseInClass:aClass |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1386 |
"{ Pragma: +optSpace }" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1387 |
|
11150 | 1388 |
"startup a full browser showing aClass. |
20207 | 1389 |
The browser will be a full browser with aClass initially selected. |
11150 | 1390 |
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
|
1391 |
|
22241 | 1392 |
SystemBrowser default openInClass:aClass |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1393 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1394 |
" |
10071 | 1395 |
Smalltalk browseInClass:Array |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1396 |
" |
22241 | 1397 |
|
1398 |
"Modified: / 01-09-2017 / 14:21:46 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1399 |
! |
6970 | 1400 |
|
7563 | 1401 |
browseInClass:aClass selector:selector |
1402 |
"{ Pragma: +optSpace }" |
|
1403 |
||
11150 | 1404 |
"startup a full browser showing aClass>>selector. |
20207 | 1405 |
The browser will be a full browser with aClass initially selected. |
11150 | 1406 |
See browseClass: for a singleClass browser, which shows only a single class." |
6970 | 1407 |
|
22241 | 1408 |
SystemBrowser default openInClass:aClass selector:selector |
6970 | 1409 |
|
1410 |
" |
|
1411 |
Smalltalk browseInClass:Array selector:#at: |
|
1412 |
" |
|
22241 | 1413 |
|
1414 |
"Modified: / 01-09-2017 / 14:21:49 / cg" |
|
453 | 1415 |
! ! |
1416 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1417 |
!Smalltalk class methodsFor:'class management'! |
453 | 1418 |
|
18732 | 1419 |
basicRemoveClass:aClass |
1420 |
"remove the argument, aClass from the smalltalk dictionary; |
|
1421 |
we have to flush the caches since these methods are now void. |
|
1422 |
Also, class variables of aClass are removed." |
|
1423 |
||
1424 |
|sym cSym names oldName oldNameSym actualName wrongName| |
|
1425 |
||
1426 |
aClass isNil ifTrue:[^ self]. |
|
1427 |
||
1428 |
oldName := aClass name. |
|
1429 |
sym := oldNameSym := oldName asSymbol. |
|
1430 |
((self at:oldNameSym) == aClass) ifFalse:[ |
|
22791 | 1431 |
"check other name ..." |
1432 |
(self includes:aClass) ifFalse:[ |
|
1433 |
'Smalltalk [warning]: no such class: ' errorPrint. oldName errorPrintCR. |
|
1434 |
^ self |
|
1435 |
]. |
|
1436 |
" |
|
1437 |
the class has changed its name - without telling me ... |
|
1438 |
what should be done in this case ? |
|
1439 |
" |
|
1440 |
'Smalltalk [warning]: class ' errorPrint. oldName errorPrint. |
|
1441 |
' has changed its name' errorPrintCR. |
|
1442 |
||
1443 |
"/ |
|
1444 |
"/ might be an alias (i.e. removing a compatibility name) |
|
1445 |
"/ |
|
1446 |
actualName := self keyAtValue:aClass. |
|
1447 |
('Smalltalk [info]: ' , oldName , ' is actually stored as ' , actualName , '.') infoPrintCR. |
|
1448 |
sym := actualName asSymbol. |
|
1449 |
oldName := actualName asString. |
|
1450 |
wrongName := true. |
|
18732 | 1451 |
]. |
1452 |
||
1453 |
self at:sym put:nil. "nil it out for compiled accesses" |
|
1454 |
||
1455 |
"/ |
|
20811 | 1456 |
"/ see comment in removeKey: on why we don't remove it here |
18732 | 1457 |
"/ |
1458 |
"/ self removeKey:sym. "/ remove key - this actually fails, if there are |
|
22791 | 1459 |
"/ still compiled code references." |
18732 | 1460 |
|
1461 |
"remove private classes" |
|
1462 |
||
1463 |
aClass privateClassesSorted do:[:somePrivateClass | |
|
22791 | 1464 |
aClass privateClassesAt:(somePrivateClass nameWithoutPrefix) asSymbol put:nil. |
18732 | 1465 |
]. |
1466 |
||
1467 |
"remove class variables" |
|
1468 |
||
1469 |
names := aClass classVariableString asCollectionOfWords. |
|
1470 |
names do:[:name | |
|
22791 | 1471 |
cSym := aClass globalKeyForClassVar:name. |
1472 |
self at:cSym asSymbol put:nil. |
|
1473 |
||
1474 |
"/ |
|
1475 |
"/ see comment in removeKey: on why we dont remove it here |
|
1476 |
"/ |
|
1477 |
"/ self removeKey:cSym |
|
18732 | 1478 |
]. |
1479 |
||
1480 |
||
1481 |
"/ actually could get along with less flushing |
|
1482 |
"/ (entries for aClass and subclasses only) |
|
1483 |
"/ but we have to delay this, until we have the set of subclasses |
|
1484 |
"/ at hand - for now, searching for all subclasses is way more |
|
1485 |
"/ expensive then cache flushing. |
|
1486 |
"/ |
|
1487 |
"/ aClass allSubclassesDo:[:aSubclass | |
|
1488 |
"/ ObjectMemory flushInlineCachesForClass:aSubclass. |
|
1489 |
"/ ObjectMemory flushMethodCacheFor:aSubclass |
|
1490 |
"/ ]. |
|
1491 |
"/ ObjectMemory flushInlineCachesForClass:aClass. |
|
1492 |
"/ ObjectMemory flushMethodCacheFor:aClass |
|
1493 |
||
1494 |
ObjectMemory flushInlineCaches. |
|
1495 |
ObjectMemory flushMethodCache. |
|
1496 |
||
1497 |
aClass addChangeRecordForClassRemove. |
|
1498 |
self changed:#classRemove with:aClass. |
|
1499 |
||
1500 |
aClass setCategory:#'* removed *'. |
|
1501 |
||
1502 |
"/ self flushCachedClasses. |
|
1503 |
"/ Class flushSubclassInfo. |
|
1504 |
self flushCachedClass:aClass. |
|
1505 |
Class flushSubclassInfoFor:aClass superclass. |
|
1506 |
Class flushSubclassInfoFor:aClass. |
|
1507 |
||
1508 |
wrongName == true ifTrue:[ |
|
22791 | 1509 |
"/ |
1510 |
"/ an alias (i.e. removing a compatibility name) |
|
1511 |
"/ |
|
1512 |
"/ check if there are more refs to it ... |
|
1513 |
[self includes:aClass] whileTrue:[ |
|
1514 |
actualName := self keyAtValue:aClass. |
|
1515 |
('Smalltalk [info]: ' , aClass name , ' is also registered under the name ' , actualName |
|
1516 |
, ' - remove that binding too.') infoPrintCR. |
|
1517 |
self at:actualName put:nil. |
|
1518 |
]. |
|
18732 | 1519 |
]. |
1520 |
||
1521 |
"Modified: / 18-11-2006 / 17:16:31 / cg" |
|
1522 |
! |
|
1523 |
||
7563 | 1524 |
changeCategoryOf:aClass to:newCategory |
1525 |
"change a classes category, add a change record, |
|
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1526 |
send change notifications" |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1527 |
|
8405 | 1528 |
|ns oldCategory| |
1529 |
||
1530 |
oldCategory := aClass category. |
|
1531 |
oldCategory ~= newCategory ifTrue:[ |
|
18668 | 1532 |
aClass category:(newCategory withoutSeparators asSymbol). |
1533 |
||
1534 |
"notify change of category" |
|
1535 |
ns := aClass environment ? self. |
|
1536 |
ns changed:#organization with:(aClass -> oldCategory). |
|
1537 |
ns ~~ self ifTrue:[ |
|
1538 |
self changed:#organization with:(aClass -> oldCategory). |
|
1539 |
] |
|
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1540 |
]. |
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 |
Smalltalk changeCategoryOf:NewApplication to:#myApplications |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1544 |
" |
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 |
"Modified: / 11.2.2000 / 11:36:27 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1547 |
! |
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 |
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
|
1550 |
NameSpace name:name |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1551 |
|
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 |
flushCachedClass:aClass |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1555 |
CachedClasses notNil ifTrue:[ |
18668 | 1556 |
CachedClasses remove:aClass ifAbsent:[]. |
12700 | 1557 |
]. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1558 |
! |
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 |
flushCachedClasses |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1561 |
CachedClasses := nil. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1562 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1563 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1564 |
Smalltalk flushCachedClasses |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1565 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1566 |
! |
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 |
removeClass:aClass |
7563 | 1569 |
"remove the argument, aClass from the smalltalk dictionary; |
453 | 1570 |
we have to flush the caches since these methods are now void. |
18732 | 1571 |
Also, class variables of aClass are removed. |
1572 |
Recompile accessors to aClass." |
|
1573 |
||
1574 |
|oldNameSym ns ons| |
|
1575 |
||
1576 |
oldNameSym := aClass name asSymbol. |
|
4781 | 1577 |
ns := aClass nameSpace. |
1578 |
aClass topOwningClass notNil ifTrue:[ |
|
22791 | 1579 |
ons := aClass topOwningClass nameSpace |
18732 | 1580 |
]. |
1581 |
||
1582 |
self basicRemoveClass:aClass. |
|
4724
44793fe70787
recompile ns classes after a class remove
Claus Gittinger <cg@exept.de>
parents:
4723
diff
changeset
|
1583 |
|
4781 | 1584 |
ns ~~ Smalltalk ifTrue:[ |
22791 | 1585 |
ons notNil ifTrue:[ |
1586 |
ClassBuilder |
|
1587 |
recompileGlobalAccessorsTo:oldNameSym |
|
1588 |
in:ons |
|
1589 |
except:nil |
|
1590 |
]. |
|
1591 |
(ns notNil and:[ns ~~ ons]) ifTrue:[ |
|
1592 |
ClassBuilder |
|
1593 |
recompileGlobalAccessorsTo:oldNameSym |
|
1594 |
in:ns |
|
1595 |
except:nil |
|
1596 |
]. |
|
18732 | 1597 |
]. |
1598 |
! |
|
1599 |
||
1600 |
removeClasses:aCollectionOfClasses |
|
1601 |
"remove aCollectionOfClasses from the smalltalk dictionary; |
|
1602 |
we have to flush the caches since these methods are now void. |
|
1603 |
Also, class variables of aClass are removed. |
|
1604 |
Recompile accessors to the classes - after all classes in the collection have been removed." |
|
1605 |
||
1606 |
|tuples| |
|
1607 |
||
1608 |
tuples := aCollectionOfClasses collect:[:eachClass| |
|
22791 | 1609 |
Array |
1610 |
with:eachClass name asSymbol |
|
1611 |
with:eachClass nameSpace |
|
1612 |
with:( |
|
1613 |
eachClass topOwningClass notNil ifTrue:[ |
|
1614 |
eachClass topOwningClass nameSpace |
|
1615 |
] ifFalse:[nil]) |
|
1616 |
]. |
|
18732 | 1617 |
|
1618 |
aCollectionOfClasses do:[:eachClass| |
|
22791 | 1619 |
self basicRemoveClass:eachClass. |
18732 | 1620 |
]. |
1621 |
||
1622 |
tuples do:[:eachClssymNsOnsTuple| |
|
22791 | 1623 |
|oldNameSym ns ons| |
1624 |
||
1625 |
oldNameSym := eachClssymNsOnsTuple at:1. |
|
1626 |
ns := eachClssymNsOnsTuple at:2. |
|
1627 |
ons := eachClssymNsOnsTuple at:3. |
|
1628 |
||
1629 |
ns ~~ Smalltalk ifTrue:[ |
|
1630 |
ons notNil ifTrue:[ |
|
1631 |
ClassBuilder |
|
1632 |
recompileGlobalAccessorsTo:oldNameSym |
|
1633 |
in:ons |
|
1634 |
except:nil |
|
1635 |
]. |
|
1636 |
(ns notNil and:[ns ~~ ons]) ifTrue:[ |
|
1637 |
ClassBuilder |
|
1638 |
recompileGlobalAccessorsTo:oldNameSym |
|
1639 |
in:ns |
|
1640 |
except:nil |
|
1641 |
]. |
|
1642 |
] |
|
18732 | 1643 |
]. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1644 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1645 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1646 |
renameClass:aClass to:newName |
7563 | 1647 |
"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
|
1648 |
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
|
1649 |
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
|
1650 |
|
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1651 |
|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
|
1652 |
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
|
1653 |
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
|
1654 |
oldMetaclass newMetaclass newCategory| |
5610
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1655 |
|
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1656 |
"/ check for all intermediate namespaces / owning classes |
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1657 |
i1 := 1. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1658 |
i2 := 1. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1659 |
ns := self. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1660 |
[i2 ~~ 0] whileTrue:[ |
22791 | 1661 |
i2 := newName indexOfSubCollection:'::' startingAt:i1. |
1662 |
i2 ~~ 0 ifTrue:[ |
|
1663 |
nm := newName copyFrom:i1 to:i2-1. |
|
1664 |
ns isNameSpace ifTrue:[ |
|
1665 |
subns := ns at:nm asSymbol ifAbsent:nil. |
|
1666 |
subns isNil ifTrue:[ |
|
1667 |
self error:'Nonexisting namespace: ',nm. |
|
1668 |
^ nil. |
|
1669 |
]. |
|
1670 |
] ifFalse:[ |
|
1671 |
subns := ns privateClassesAt:nm asSymbol. |
|
1672 |
subns isNil ifTrue:[ |
|
1673 |
self error:'Cannot create a namespace below a class' |
|
1674 |
] |
|
1675 |
]. |
|
1676 |
ns := subns. |
|
1677 |
i1 := i2 + 2. |
|
1678 |
]. |
|
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1679 |
]. |
617 | 1680 |
|
1681 |
oldName := aClass name. |
|
6734 | 1682 |
oldNameSpace := aClass topNameSpace. |
2319
640bb389f90a
recompile when moving classes across namespaces
Claus Gittinger <cg@exept.de>
parents:
2317
diff
changeset
|
1683 |
oldBaseName := aClass nameWithoutNameSpacePrefix. |
3698
8bce45214d24
fixed renaming of a private class (must recompile owner)
Claus Gittinger <cg@exept.de>
parents:
3678
diff
changeset
|
1684 |
oldBaseNameWithoutPrefix := aClass nameWithoutPrefix. |
617 | 1685 |
oldSym := oldName asSymbol. |
2485
9f4a11a4521f
new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents:
2476
diff
changeset
|
1686 |
privateClasses := aClass privateClassesSorted. |
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1687 |
|
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1688 |
((self at:oldSym) ~~ aClass) ifTrue:[ |
22791 | 1689 |
'Smalltalk [warning]: rename failed - name is different from key' errorPrintCR. |
1690 |
^ self |
|
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1691 |
]. |
617 | 1692 |
|
1525
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1693 |
"/ rename the class |
617 | 1694 |
|
1847
6e567214b167
care for className being a symbol, when renaming classes
Claus Gittinger <cg@exept.de>
parents:
1758
diff
changeset
|
1695 |
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
|
1696 |
|
5610
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1697 |
"/ change the owning class |
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1698 |
ns isNameSpace ifFalse:[ |
22791 | 1699 |
aClass isPrivate ifTrue:[ |
1700 |
aClass class setOwningClass:ns. |
|
1701 |
] ifFalse:[ |
|
1702 |
"/ sigh - must make a PrivateMetaclass from Metaclass |
|
1703 |
oldMetaclass := aClass class. |
|
1704 |
newMetaclass := PrivateMetaclass new. |
|
1705 |
newMetaclass flags:(oldMetaclass flags). |
|
1706 |
newMetaclass setSuperclass:(oldMetaclass superclass). |
|
1707 |
newMetaclass instSize:(oldMetaclass instSize). |
|
1708 |
newMetaclass setInstanceVariableString:(oldMetaclass instanceVariableString). |
|
1709 |
newMetaclass setMethodDictionary:(oldMetaclass methodDictionary). |
|
1710 |
newMetaclass setSoleInstance:aClass. |
|
1711 |
newMetaclass setOwningClass:ns. |
|
1712 |
||
1713 |
aClass changeClassTo:newMetaclass. |
|
1714 |
ObjectMemory flushCaches. |
|
1715 |
] |
|
5610
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1716 |
] ifTrue:[ |
22791 | 1717 |
aClass isPrivate ifTrue:[ |
1718 |
newCategory := aClass topOwningClass category. |
|
1719 |
||
1720 |
"/ sigh - must make a Metaclass from PrivateMetaclass |
|
1721 |
oldMetaclass := aClass class. |
|
1722 |
||
1723 |
newMetaclass := Metaclass new. |
|
1724 |
newMetaclass flags:(oldMetaclass flags). |
|
1725 |
newMetaclass setSuperclass:(oldMetaclass superclass). |
|
1726 |
newMetaclass instSize:(oldMetaclass instSize). |
|
1727 |
newMetaclass setInstanceVariableString:(oldMetaclass instanceVariableString). |
|
1728 |
newMetaclass setMethodDictionary:(oldMetaclass methodDictionary). |
|
1729 |
newMetaclass setSoleInstance:aClass. |
|
1730 |
||
1731 |
aClass category:newCategory. |
|
1732 |
aClass changeClassTo:newMetaclass. |
|
1733 |
ObjectMemory flushCaches. |
|
1734 |
] |
|
5610
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1735 |
]. |
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1736 |
|
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1737 |
aClass setName:newSym. |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1738 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1739 |
"/ store it in Smalltalk |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1740 |
self at:oldSym put:nil. |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1741 |
|
878
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1742 |
"/ |
20811 | 1743 |
"/ 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
|
1744 |
"/ |
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1745 |
"/ self removeKey:oldSym. |
617 | 1746 |
self at:newSym put:aClass. |
1747 |
||
1525
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1748 |
"/ 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
|
1749 |
|
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1750 |
oldNameToNewName := IdentityDictionary new. |
617 | 1751 |
|
1752 |
names := aClass classVariableString asCollectionOfWords. |
|
1753 |
names do:[:name | |
|
22791 | 1754 |
oldCVSym := (oldSym , ':' , name) asSymbol. |
1755 |
value := self at:oldCVSym. |
|
1756 |
self at:oldCVSym put:nil. |
|
1757 |
||
1758 |
"/ |
|
1759 |
"/ see comment in #removeKey: on why we dont remove it it here |
|
1760 |
"/ |
|
1761 |
"/ self removeKey:cSym. |
|
1762 |
||
1763 |
newCVSym := (newSym , ':' , name) asSymbol. |
|
1764 |
self at:newCVSym put:value. |
|
1765 |
||
1766 |
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
|
1767 |
]. |
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 |
"/ 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
|
1770 |
|
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1771 |
oldNameToNewName keysAndValuesDo:[:oldNameSym :newNameSym | |
22791 | 1772 |
aClass withAllSubclasses do:[:aSubClass | |
1773 |
Transcript showCR:'changing global accesses from ''' , oldNameSym , ''' into ''' , newNameSym , ''' in class: ''' , aSubClass name , ''' ...'. |
|
1774 |
aSubClass instAndClassSelectorsAndMethodsDo:[:sel :aMethod | |
|
1775 |
aMethod changeLiteral:oldNameSym to:newNameSym |
|
1776 |
]. |
|
1777 |
]. |
|
1778 |
||
1779 |
"/ and also in privateClasses ? ... |
|
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1780 |
|
2485
9f4a11a4521f
new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents:
2476
diff
changeset
|
1781 |
"/ privateClasses size > 0 ifTrue:[ |
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1782 |
"/ privateClasses do:[:aPrivateClass | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1783 |
"/ aPrivateClass withAllSubclasses do:[:aSubClass | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1784 |
"/ aSubClass class methodDictionary do:[:aMethod | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1785 |
"/ aMethod changeLiteral:oldNameSym to:newNameSym |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1786 |
"/ ]. |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1787 |
"/ aSubClass methodDictionary do:[:aMethod | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1788 |
"/ aMethod changeLiteral:oldNameSym to:newNameSym |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1789 |
"/ ] |
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 |
"/ ] |
617 | 1793 |
]. |
1794 |
||
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1795 |
aClass addChangeRecordForClassRename:oldSym to:newSym. |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1796 |
|
5333
d80386e06d21
rename into other namespace did not work
Claus Gittinger <cg@exept.de>
parents:
5328
diff
changeset
|
1797 |
"/ 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
|
1798 |
aClass setEnvironment:nil. |
6734 | 1799 |
newNameSpace := aClass topNameSpace. |
2405
939f4e751ef3
dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents:
2379
diff
changeset
|
1800 |
|
2485
9f4a11a4521f
new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents:
2476
diff
changeset
|
1801 |
privateClasses size > 0 ifTrue:[ |
22791 | 1802 |
"/ must rename privateClasses as well |
1803 |
Class withoutUpdatingChangesDo:[ |
|
1804 |
privateClasses do:[:aPrivateClass | |
|
1805 |
self renameClass:aPrivateClass |
|
1806 |
to:(newSym , '::' , aPrivateClass nameWithoutPrefix). |
|
1807 |
||
1808 |
Transcript showCR:'recompiling methods in ''' , newNameSpace name , ''' accessing ''' , oldName , '::' , aPrivateClass nameWithoutPrefix , ''' ...'. |
|
1809 |
aClass theNonMetaclass recompileMethodsAccessingGlobal:(oldName , '::' , aPrivateClass nameWithoutPrefix) asSymbol. |
|
1810 |
aClass theMetaclass recompileMethodsAccessingGlobal:(oldName , '::' , aPrivateClass nameWithoutPrefix) asSymbol. |
|
1811 |
aClass theNonMetaclass recompileMethodsAccessingGlobal:(aPrivateClass nameWithoutPrefix) asSymbol. |
|
1812 |
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
|
1813 |
"/ ClassBuilder |
10071 | 1814 |
"/ recompileGlobalAccessorsTo:(oldName , '::' , aPrivateClass nameWithoutPrefix) asSymbol |
1815 |
"/ in:newNameSpace |
|
9822
38acd1c5eeab
recompile methods which access private classes when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
9819
diff
changeset
|
1816 |
"/ except:nil. |
22791 | 1817 |
] |
1818 |
] |
|
2405
939f4e751ef3
dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents:
2379
diff
changeset
|
1819 |
]. |
939f4e751ef3
dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents:
2379
diff
changeset
|
1820 |
|
2319
640bb389f90a
recompile when moving classes across namespaces
Claus Gittinger <cg@exept.de>
parents:
2317
diff
changeset
|
1821 |
oldNameSpace ~~ newNameSpace ifTrue:[ |
5246
2ca7b20c4108
create namespaces as requried, when renaming a class
Claus Gittinger <cg@exept.de>
parents:
5214
diff
changeset
|
1822 |
|
22791 | 1823 |
"/ all those referencing the class from the old nameSpace |
1824 |
"/ must be recompiled ... |
|
1825 |
"/ (to now access the global from smalltalk) |
|
1826 |
||
1827 |
oldNameSpace ~~ Smalltalk ifTrue:[ |
|
1828 |
Transcript showCR:'recompiling methods in ''' , oldNameSpace name , ''' accessing ''' , oldName , ''' ...'. |
|
1829 |
||
1830 |
ClassBuilder |
|
1831 |
recompileGlobalAccessorsTo:oldName asSymbol |
|
1832 |
in:oldNameSpace |
|
1833 |
except:nil. |
|
1834 |
]. |
|
1835 |
||
1836 |
"/ all referencing the class in the new namespace |
|
1837 |
"/ as well; to now access the new class. |
|
1838 |
||
1839 |
(newNameSpace notNil and:[newNameSpace ~~ Smalltalk]) ifTrue:[ |
|
1840 |
Transcript showCR:'recompiling methods in ''' , newNameSpace name , ''' accessing ''' , oldBaseName , ''' ...'. |
|
1841 |
||
1842 |
ClassBuilder |
|
1843 |
recompileGlobalAccessorsTo:oldBaseName asSymbol |
|
1844 |
in:newNameSpace |
|
1845 |
except:nil. |
|
1846 |
]. |
|
3698
8bce45214d24
fixed renaming of a private class (must recompile owner)
Claus Gittinger <cg@exept.de>
parents:
3678
diff
changeset
|
1847 |
] ifFalse:[ |
22791 | 1848 |
"/ all references to a global with my new name in my owning class |
1849 |
"/ must now be redirected to myself. |
|
1850 |
||
1851 |
aClass isPrivate ifTrue:[ |
|
1852 |
newBaseName := aClass nameWithoutNameSpacePrefix. |
|
1853 |
newBaseNameWithoutPrefix := aClass nameWithoutPrefix. |
|
1854 |
||
1855 |
Transcript showCR:'recompiling methods accessing ''' , oldBaseNameWithoutPrefix , ''' in: ''' , aClass owningClass name , ''' ...'. |
|
1856 |
aClass owningClass recompileMethodsAccessingGlobal:oldBaseNameWithoutPrefix. |
|
1857 |
aClass owningClass class recompileMethodsAccessingGlobal:oldBaseNameWithoutPrefix. |
|
1858 |
||
1859 |
Transcript showCR:'recompiling methods accessing ''' , oldBaseName , ''' in: ''' , aClass owningClass name , ''' ...'. |
|
1860 |
aClass owningClass recompileMethodsAccessingGlobal:oldBaseName. |
|
1861 |
aClass owningClass class recompileMethodsAccessingGlobal:oldBaseName. |
|
1862 |
||
1863 |
Transcript showCR:'recompiling methods accessing ''' , newBaseNameWithoutPrefix , ''' in: ''' , aClass owningClass name , ''' ...'. |
|
1864 |
aClass owningClass recompileMethodsAccessingGlobal:newBaseNameWithoutPrefix. |
|
1865 |
aClass owningClass class recompileMethodsAccessingGlobal:newBaseNameWithoutPrefix. |
|
1866 |
||
1867 |
Transcript showCR:'recompiling methods accessing ''' , newBaseName , ''' in: ''' , aClass owningClass name , ''' ...'. |
|
1868 |
aClass owningClass recompileMethodsAccessingGlobal:newBaseName. |
|
1869 |
aClass owningClass class recompileMethodsAccessingGlobal:newBaseName. |
|
1870 |
] |
|
4040
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1871 |
]. |
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 |
aClass changed:#definition. |
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1874 |
"/ 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
|
1875 |
aClass allSubclassesDo:[:subClass | |
22791 | 1876 |
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
|
1877 |
]. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1878 |
"/ 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
|
1879 |
aClass subclassesDo:[:subClass | |
22791 | 1880 |
subClass addChangeRecordForClass:subClass. |
4040
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1881 |
]. |
5613
b534e427f028
change message when renaming a class
Claus Gittinger <cg@exept.de>
parents:
5611
diff
changeset
|
1882 |
self changed:#definition. |
14611 | 1883 |
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
|
1884 |
|
9822
38acd1c5eeab
recompile methods which access private classes when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
9819
diff
changeset
|
1885 |
"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
|
1886 |
"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
|
1887 |
"Modified: / 05-09-2006 / 12:52:25 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1888 |
! ! |
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 |
!Smalltalk class methodsFor:'copying'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1891 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1892 |
deepCopy |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1893 |
"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
|
1894 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1895 |
^ self |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1896 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1897 |
"Modified: 18.5.1996 / 12:13:33 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1898 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1899 |
|
10952 | 1900 |
deepCopyUsing:aDictionary postCopySelector:postCopySelector |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1901 |
"return a deep copy of the receiver. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1902 |
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
|
1903 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1904 |
^ self |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1905 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1906 |
"Modified: 18.5.1996 / 12:13:36 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1907 |
! |
453 | 1908 |
|
7563 | 1909 |
shallowCopy |
1910 |
"redefined to return self - there is only one Smalltalk dictionary" |
|
617 | 1911 |
|
1912 |
^ self |
|
1410 | 1913 |
|
1914 |
"Modified: 18.5.1996 / 12:13:39 / cg" |
|
617 | 1915 |
! |
1916 |
||
7563 | 1917 |
simpleDeepCopy |
1918 |
"redefined to return self - there is only one Smalltalk dictionary" |
|
453 | 1919 |
|
1920 |
^ self |
|
1410 | 1921 |
|
1922 |
"Modified: 18.5.1996 / 12:13:42 / cg" |
|
453 | 1923 |
! ! |
1924 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1925 |
!Smalltalk class methodsFor:'debugging ST/X'! |
453 | 1926 |
|
7563 | 1927 |
compileTrace:aBoolean |
1928 |
"dump generated inline code (NOOP if VM was compiled without the trace-debug option)" |
|
7325 | 1929 |
%{ |
1930 |
extern char __compileTrace__; |
|
1931 |
||
1932 |
__compileTrace__ = (aBoolean == true) ? 1 : 0; |
|
1933 |
%} |
|
1934 |
" |
|
1935 |
Smalltalk compileTrace:true |
|
1936 |
Smalltalk compileTrace:false |
|
1937 |
" |
|
1938 |
! |
|
1939 |
||
7563 | 1940 |
debugBreakPoint |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1941 |
"{ Pragma: +optSpace }" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1942 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1943 |
"call the dummy debug function, on which a breakpoint |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1944 |
can be put in adb, sdb, dbx or gdb. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1945 |
WARNING: this method is for debugging only |
18668 | 1946 |
it will be removed without notice." |
453 | 1947 |
%{ |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1948 |
__PATCHUPCONTEXTS(__context); |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1949 |
__debugBreakPoint__(); |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1950 |
%}. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1951 |
^ self |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1952 |
! |
453 | 1953 |
|
7563 | 1954 |
exitWithCoreDump |
1955 |
"{ Pragma: +optSpace }" |
|
1956 |
||
20755 | 1957 |
"abort the program and dump core" |
7563 | 1958 |
|
1959 |
OperatingSystem exitWithCoreDump |
|
4096
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1960 |
"/ never returns |
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1961 |
|
20755 | 1962 |
"Be careful evaluating this: |
4096
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1963 |
Smalltalk exitWithCoreDump |
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1964 |
" |
617 | 1965 |
! |
1966 |
||
7563 | 1967 |
fatalAbort |
1968 |
"{ Pragma: +optSpace }" |
|
1969 |
||
1970 |
"report a fatal-error, print a stack backtrace and exit with core dump. |
|
617 | 1971 |
(You may turn off the stack print with debugPrinting:false)" |
18287 | 1972 |
|
1973 |
self fatalAbort:'fatalAbort' |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1974 |
! |
617 | 1975 |
|
7563 | 1976 |
fatalAbort:aMessage |
1977 |
"{ Pragma: +optSpace }" |
|
1978 |
||
1979 |
"report a fatal-error; print a stack backtrace and exit with core dump |
|
617 | 1980 |
(You may turn off the stack print with debugPrinting:false)" |
1981 |
||
1982 |
%{ |
|
18287 | 1983 |
#ifdef __SCHTEAM__ |
1984 |
STMain.fatalAbort( aMessage ); |
|
1985 |
/* NOT REACHED */ |
|
1986 |
#else |
|
617 | 1987 |
char *msg; |
1988 |
||
12481
805176d238d2
change __isString() to __isStringLike() in primitive code
Stefan Vogel <sv@exept.de>
parents:
12413
diff
changeset
|
1989 |
if (__isStringLike(aMessage)) |
18668 | 1990 |
msg = (char *) __stringVal(aMessage); |
617 | 1991 |
else |
18668 | 1992 |
msg = "fatalAbort"; |
617 | 1993 |
|
1994 |
__fatal0(__context, msg); |
|
1995 |
/* NEVER RETURNS */ |
|
18287 | 1996 |
#endif |
5410 | 1997 |
%}. |
1998 |
^ self primitiveFailed |
|
5441 | 1999 |
! |
2000 |
||
13135
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2001 |
ignoreHalt |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2002 |
"return true, if halts are ignored. |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2003 |
Usually, this is done in standAlone applications" |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2004 |
|
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2005 |
IgnoreHalt isNil ifTrue:[ |
18668 | 2006 |
^ self isStandAloneApp |
13135
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2007 |
]. |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2008 |
^ IgnoreHalt |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2009 |
|
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2010 |
"Created: / 18-11-2010 / 11:20:16 / cg" |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2011 |
! |
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 |
ignoreHalt:aBoolean |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2014 |
"control if halts are to be ignored; |
13135
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2015 |
usually, this is done in standAlone applications" |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2016 |
|
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2017 |
IgnoreHalt := aBoolean |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2018 |
|
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 |
Smalltalk ignoreHalt:true. |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2021 |
self halt. |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2022 |
Smalltalk ignoreHalt:false. |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2023 |
self halt. |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2024 |
" |
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 |
"Created: / 18-11-2010 / 11:20:27 / cg" |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2027 |
! |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2028 |
|
18329 | 2029 |
verbose |
2030 |
^ Verbose |
|
2031 |
! |
|
2032 |
||
2033 |
verbose:aBoolean |
|
2034 |
Verbose := aBoolean |
|
2035 |
! |
|
2036 |
||
7563 | 2037 |
vmInstructionTrace:aBoolean |
13947 | 2038 |
self halt:'not yet implemented' |
2039 |
||
2040 |
"Modified: / 19-01-2012 / 10:15:35 / cg" |
|
7563 | 2041 |
! ! |
2042 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2043 |
!Smalltalk class methodsFor:'enumerating'! |
7563 | 2044 |
|
453 | 2045 |
allBehaviorsDo:aBlock |
5580
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
2046 |
"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
|
2047 |
|
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
2048 |
self allClassesAndMetaclassesDo:aBlock |
453 | 2049 |
|
2050 |
" |
|
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
2051 |
Smalltalk allBehaviorsDo:[:aClass | aClass name printCR] |
453 | 2052 |
" |
7563 | 2053 |
! |
2054 |
||
2055 |
allClassCategories |
|
2056 |
"return a set of all class categories in the system" |
|
2057 |
||
2058 |
|allCategories| |
|
6217
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2059 |
|
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2060 |
allCategories := Set new. |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2061 |
Smalltalk allClassesDo:[:cls | |
18668 | 2062 |
|category| |
2063 |
||
2064 |
category := cls category. |
|
2065 |
category notNil ifTrue:[ |
|
2066 |
allCategories add:category. |
|
2067 |
]. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2068 |
]. |
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 |
^ allCategories. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2071 |
|
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 |
Smalltalk allClassCategories |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2074 |
" |
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 |
"Created: / 17.11.2001 / 12:13:09 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2077 |
! |
6217
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2078 |
|
7563 | 2079 |
allClassesAndMetaclassesDo:aBlock |
2080 |
"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
|
2081 |
|
21108 | 2082 |
|already numClassesHintTimes2| |
2083 |
||
2084 |
numClassesHintTimes2 := NumberOfClassesHint*2. |
|
2085 |
already := IdentitySet new:numClassesHintTimes2. |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2086 |
self allClassesDo:[:eachClass | |
22791 | 2087 |
|theNonMeta theMeta| |
2088 |
||
2089 |
theNonMeta := eachClass theNonMetaclass. |
|
2090 |
(already includes:theNonMeta) ifFalse:[ |
|
2091 |
aBlock value:theNonMeta. |
|
2092 |
already add:theNonMeta. |
|
2093 |
]. |
|
2094 |
theMeta := theNonMeta class. |
|
2095 |
(already includes:theMeta) ifFalse:[ |
|
2096 |
aBlock value:theMeta. |
|
2097 |
already add:theMeta. |
|
2098 |
]. |
|
2099 |
already size > numClassesHintTimes2 ifTrue:[ |
|
2100 |
NumberOfClassesHint := (already size // 2) + 10 |
|
2101 |
]. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2102 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2103 |
! |
5579
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
2104 |
|
7563 | 2105 |
allClassesDo:aBlock |
21489 | 2106 |
"evaluate the argument, aBlock for all classes in the system. |
2107 |
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
|
2108 |
|
5765 | 2109 |
self allClasses do:aBlock |
453 | 2110 |
|
2111 |
" |
|
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
2112 |
Smalltalk allClassesDo:[:aClass | aClass name printCR] |
453 | 2113 |
" |
21489 | 2114 |
|
2115 |
"Modified (comment): / 19-02-2017 / 12:38:17 / cg" |
|
453 | 2116 |
! |
2117 |
||
9506 | 2118 |
allClassesForWhich:filter |
10071 | 2119 |
"return a collection with all classes in the system, |
21489 | 2120 |
for which filter evaluates to true. |
2121 |
Enumerates non-meta classes only - not metaclasses" |
|
9506 | 2122 |
|
2123 |
|collectedClasses| |
|
2124 |
||
2125 |
collectedClasses := OrderedCollection new. |
|
2126 |
self allClassesForWhich:filter do:[:cls | |
|
22791 | 2127 |
collectedClasses add:cls |
9506 | 2128 |
]. |
2129 |
^ collectedClasses |
|
2130 |
||
2131 |
" |
|
10071 | 2132 |
Smalltalk |
22791 | 2133 |
allClassesForWhich:[:cls | cls name startsWith:'Po'] |
9506 | 2134 |
" |
2135 |
||
2136 |
"Created: / 10-08-2006 / 12:11:31 / cg" |
|
21489 | 2137 |
"Modified (comment): / 19-02-2017 / 12:37:49 / cg" |
9506 | 2138 |
! |
2139 |
||
9292 | 2140 |
allClassesForWhich:filter do:aBlock |
21489 | 2141 |
"evaluate the argument, aBlock for all classes in the system, for which filter evaluates to true. |
2142 |
Enumerates non-meta classes only - not metaclasses" |
|
9292 | 2143 |
|
2144 |
self allClassesDo:[:cls | |
|
22791 | 2145 |
(filter value:cls) ifTrue:[ aBlock value:cls ]. |
10071 | 2146 |
]. |
2147 |
||
2148 |
" |
|
2149 |
Smalltalk |
|
22791 | 2150 |
allClassesForWhich:[:cls | cls name startsWith:'Po'] |
2151 |
do:[:aClass | Transcript showCR:aClass name] |
|
21489 | 2152 |
" |
2153 |
||
2154 |
"Modified (comment): / 19-02-2017 / 12:37:59 / cg" |
|
9292 | 2155 |
! |
2156 |
||
7563 | 2157 |
allClassesInCategory:aCategory |
2158 |
"return a collection of for all classes in aCategory; |
|
1299 | 2159 |
The order of the classes is not defined." |
2160 |
||
9506 | 2161 |
^ self allClassesForWhich:[:cls | cls category = aCategory] |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2162 |
|
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 |
Smalltalk allClassesInCategory:'Views-Basic' |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2165 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2166 |
|
9506 | 2167 |
"Modified: / 10-08-2006 / 12:13:32 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2168 |
! |
1299 | 2169 |
|
7563 | 2170 |
allClassesInCategory:aCategory do:aBlock |
2171 |
"evaluate the argument, aBlock for all classes in the aCategory; |
|
453 | 2172 |
The order of the classes is not defined." |
2173 |
||
2174 |
aCategory notNil ifTrue:[ |
|
18668 | 2175 |
self allClassesForWhich:[:cls | cls category = aCategory] do:aBlock |
453 | 2176 |
] |
2177 |
||
2178 |
" |
|
9490 | 2179 |
Smalltalk allClassesInCategory:'Views-Basic' do:[:aClass | Transcript showCR:aClass] |
2180 |
" |
|
2181 |
||
2182 |
"Modified: / 09-08-2006 / 17:18:50 / fm" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2183 |
! |
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 |
allClassesInCategory:aCategory inOrderDo:aBlock |
7563 | 2186 |
"evaluate the argument, aBlock for all classes in aCategory; |
453 | 2187 |
superclasses come first - then subclasses" |
2188 |
||
2189 |
|classes| |
|
2190 |
||
2191 |
aCategory notNil ifTrue:[ |
|
18668 | 2192 |
classes := OrderedCollection new. |
2193 |
self allClassesInCategory:aCategory do:[:aClass | |
|
2194 |
classes add:aClass |
|
2195 |
]. |
|
2196 |
classes topologicalSort:[:a :b | b isSubclassOf:a]. |
|
2197 |
classes do:aBlock |
|
453 | 2198 |
] |
2199 |
||
2200 |
" |
|
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
2201 |
Smalltalk allClassesInCategory:'Views-Basic' inOrderDo:[:aClass | aClass name printCR] |
453 | 2202 |
" |
6217
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2203 |
|
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2204 |
"Modified: / 17.11.2001 / 12:18:15 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2205 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2206 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2207 |
allClassesInOrderDo:aBlock |
7563 | 2208 |
"evaluate the argument, aBlock for all classes in the system; |
5406 | 2209 |
Evaluation order is by inheritance: superclasses come first." |
2210 |
||
2211 |
|already| |
|
2212 |
||
8964
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
2213 |
already := IdentitySet new:NumberOfClassesHint. |
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
2214 |
self allClassesDo:[:eachClass | |
18668 | 2215 |
(already includes:eachClass) ifFalse:[ |
2216 |
eachClass allSuperclasses reverseDo:[:eachSuperClass | |
|
2217 |
(already includes:eachSuperClass) ifFalse:[ |
|
2218 |
already add:eachSuperClass. |
|
2219 |
aBlock value:eachSuperClass. |
|
2220 |
]. |
|
2221 |
]. |
|
2222 |
already add:eachClass. |
|
2223 |
aBlock value:eachClass. |
|
2224 |
] |
|
8964
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
2225 |
]. |
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 |
Smalltalk allClassesInOrderDo:[:aClass | Transcript showCR:aClass name] |
5406 | 2229 |
" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2230 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2231 |
|
9506 | 2232 |
allClassesInPackage:aPackageID |
2233 |
"evaluate the argument, aBlock for all classes a package; |
|
10087 | 2234 |
The order of the classes is not defined. |
2235 |
The returned collection may include private classes" |
|
9506 | 2236 |
|
2237 |
^ self allClassesForWhich:[:cls | cls package = aPackageID] |
|
2238 |
||
2239 |
" |
|
10071 | 2240 |
Smalltalk allClassesInPackage:'bosch:dapasx' |
9506 | 2241 |
" |
2242 |
||
2243 |
"Created: / 10-08-2006 / 12:14:10 / cg" |
|
10087 | 2244 |
"Modified: / 12-10-2006 / 23:48:43 / cg" |
9506 | 2245 |
! |
2246 |
||
9490 | 2247 |
allClassesInPackage:aPackageID do:aBlock |
2248 |
"evaluate the argument, aBlock for all classes a package; |
|
2249 |
The order of the classes is not defined." |
|
2250 |
||
2251 |
^ self allClassesForWhich:[:cls | cls package = aPackageID] do:aBlock |
|
2252 |
||
2253 |
" |
|
10071 | 2254 |
Smalltalk allClassesInPackage:'bosch:dapasx' do:[:aClass | Transcript showCR:aClass] |
9490 | 2255 |
" |
2256 |
||
2257 |
"Created: / 09-08-2006 / 17:14:17 / fm" |
|
2258 |
! |
|
2259 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2260 |
allKeysDo:aBlock |
20988 | 2261 |
<resource: #obsolete> |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2262 |
"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
|
2263 |
|
21265 | 2264 |
self obsoleteMethodWarning:'please use #keysDo:'. |
17385 | 2265 |
self keysDo:aBlock |
21265 | 2266 |
|
2267 |
"Modified: / 20-01-2017 / 17:52:40 / stefan" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2268 |
! |
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 |
allMethodCategories |
12298 | 2271 |
"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
|
2272 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2273 |
|allCategories| |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2274 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2275 |
allCategories := Set new. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2276 |
Smalltalk allClassesDo:[:cls | |
22791 | 2277 |
allCategories addAll:cls methodCategories. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2278 |
]. |
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 |
^ allCategories. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2281 |
|
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 |
Smalltalk allMethodCategories |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2284 |
" |
21980 | 2285 |
|
2286 |
"Modified: / 05-07-2017 / 10:51:50 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2287 |
! |
6722
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
2288 |
|
9259 | 2289 |
allMethodsDo:aBlock |
12298 | 2290 |
"enumerate all methods in all classes" |
12000 | 2291 |
|
9259 | 2292 |
Smalltalk allClassesDo:[:eachClass | |
18668 | 2293 |
eachClass instAndClassSelectorsAndMethodsDo:[:sel :mthd | |
2294 |
aBlock value:mthd |
|
2295 |
] |
|
12298 | 2296 |
]. |
2297 |
! |
|
2298 |
||
14933 | 2299 |
allMethodsForWhich:aBlock |
2300 |
"return a collection of methods for which aBlock returns true" |
|
2301 |
||
2302 |
|coll| |
|
2303 |
||
2304 |
coll := OrderedCollection new. |
|
22015 | 2305 |
self allMethodsForWhich:aBlock do:[:mthd | coll add:mthd]. |
2306 |
^ coll |
|
2307 |
||
2308 |
" |
|
2309 |
Smalltalk allMethodsForWhich:[:m | m isObsolete]. |
|
2310 |
||
2311 |
Smalltalk allMethodsForWhich:#isObsolete. |
|
2312 |
" |
|
2313 |
||
2314 |
"Modified (comment): / 14-07-2017 / 10:52:54 / cg" |
|
2315 |
! |
|
2316 |
||
2317 |
allMethodsForWhich:aCheckBlock do:actionBlock |
|
2318 |
"enumerate methods for which aCheckBlock returns true" |
|
2319 |
||
14933 | 2320 |
Smalltalk allClassesDo:[:eachClass | |
22791 | 2321 |
eachClass instAndClassSelectorsAndMethodsDo:[:sel :mthd | |
2322 |
(aCheckBlock value:mthd) ifTrue:[ |
|
2323 |
actionBlock value:mthd |
|
2324 |
]. |
|
2325 |
] |
|
22015 | 2326 |
]. |
2327 |
||
2328 |
" |
|
2329 |
Smalltalk allMethodsForWhich:[:m | m isObsolete] do:[:m | Transcript showCR:m]. |
|
2330 |
||
2331 |
Smalltalk allMethodsForWhich:#isObsolete do:[:m | Transcript showCR:m]. |
|
2332 |
" |
|
2333 |
||
2334 |
"Created: / 14-07-2017 / 10:51:53 / cg" |
|
14933 | 2335 |
! |
2336 |
||
12300
e72e90ea410f
changed: #allMethodsWithSelectorDo:
Claus Gittinger <cg@exept.de>
parents:
12299
diff
changeset
|
2337 |
allMethodsWithSelectorDo:aTwoArgBlock |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2338 |
"enumerate all methods in all classes and evaluate aBlock |
12300
e72e90ea410f
changed: #allMethodsWithSelectorDo:
Claus Gittinger <cg@exept.de>
parents:
12299
diff
changeset
|
2339 |
with method and selector as arguments." |
12299
3ed13f5685b9
added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents:
12298
diff
changeset
|
2340 |
|
3ed13f5685b9
added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents:
12298
diff
changeset
|
2341 |
Smalltalk allClassesDo:[:eachClass | |
18668 | 2342 |
eachClass instAndClassSelectorsAndMethodsDo:[:sel :mthd | |
2343 |
aTwoArgBlock value:mthd value:sel |
|
2344 |
] |
|
12299
3ed13f5685b9
added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents:
12298
diff
changeset
|
2345 |
]. |
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 |
|
7563 | 2348 |
associationsDo:aBlock |
10071 | 2349 |
"evaluate the argument, aBlock for all key/value pairs |
617 | 2350 |
in the Smalltalk dictionary" |
2351 |
||
2352 |
self keysDo:[:aKey | |
|
18668 | 2353 |
aBlock value:(aKey -> (self at:aKey)) |
617 | 2354 |
] |
2355 |
||
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
2356 |
"Smalltalk associationsDo:[:assoc | assoc printCR]" |
617 | 2357 |
! |
2358 |
||
7563 | 2359 |
basicKeys |
2360 |
"for rel > 5 only" |
|
2361 |
||
18349 | 2362 |
%{ |
2363 |
#ifdef __SCHTEAM__ |
|
18668 | 2364 |
STObject[] keys = STSmalltalkEnvironment.GetKeyVector(); |
18349 | 2365 |
return __c__._RETURN( new STVector(keys) ); |
2366 |
#endif |
|
2367 |
%}. |
|
7563 | 2368 |
self primitiveFailed |
2369 |
! |
|
2370 |
||
2371 |
do:aBlock |
|
2372 |
"evaluate the argument, aBlock for all values in the Smalltalk dictionary" |
|
617 | 2373 |
|
2374 |
|work| |
|
2375 |
||
2376 |
%{ /* 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
|
2377 |
__GLOBALS_DO(&aBlock, &work); |
5406 | 2378 |
RETURN (self); |
2379 |
%}. |
|
2380 |
self keysDo:[:aKey | |
|
18668 | 2381 |
aBlock value:(self at:aKey) |
5406 | 2382 |
] |
617 | 2383 |
! |
2384 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2385 |
keysAndValuesDo:aBlock |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2386 |
"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
|
2387 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2388 |
self keysDo:[:aKey | |
18668 | 2389 |
aBlock value:aKey value:(self at:aKey) |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2390 |
] |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2391 |
! |
617 | 2392 |
|
9077
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2393 |
keysAndValuesSelect:selectBlockWith2Args thenCollect:collectBlockWith2Args |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2394 |
|collected| |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2395 |
|
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2396 |
collected := OrderedCollection new. |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2397 |
self keysAndValuesDo:[:eachKey :eachValue | |
18668 | 2398 |
(selectBlockWith2Args value:eachKey value:eachValue) ifTrue:[ |
2399 |
collected add:(collectBlockWith2Args value:eachKey value:eachValue) |
|
2400 |
]. |
|
9077
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2401 |
]. |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2402 |
^ collected |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2403 |
|
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2404 |
" |
10071 | 2405 |
Smalltalk |
18668 | 2406 |
keysAndValuesSelect:[:nm :val | (nm startsWith:'Ab') and:[val notNil]] |
2407 |
thenCollect:[:nm :val | nm] |
|
9077
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2408 |
" |
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 |
|
7563 | 2411 |
keysDo:aBlock |
2412 |
"evaluate the argument, aBlock for all keys in the Smalltalk dictionary" |
|
617 | 2413 |
|work| |
2414 |
||
2415 |
%{ /* 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
|
2416 |
__GLOBALKEYS_DO(&aBlock, &work); |
5406 | 2417 |
RETURN (self); |
2418 |
%}. |
|
2419 |
self basicKeys do:[:aKey | |
|
18668 | 2420 |
aBlock value:aKey |
5406 | 2421 |
] |
453 | 2422 |
! ! |
2423 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2424 |
!Smalltalk class methodsFor:'message control'! |
453 | 2425 |
|
7563 | 2426 |
silentLoading |
12408 | 2427 |
"returns the Silentloading class variable, which globally controls if compilation |
2428 |
messages are shown on the transcript during a fileIn." |
|
7563 | 2429 |
|
10355
b1cb807fd03c
Make sure, that #silentLoading does not return nil
Stefan Vogel <sv@exept.de>
parents:
10329
diff
changeset
|
2430 |
^ SilentLoading ? false |
7563 | 2431 |
! |
2432 |
||
2433 |
silentLoading:aBoolean |
|
2434 |
"{ Pragma: +optSpace }" |
|
2435 |
||
2436 |
"allows access to the Silentloading class variable, which controls |
|
12408 | 2437 |
messages (especially during fileIn) onto the transcript. |
453 | 2438 |
You can save a snapshot with this flag set to true, which makes |
2439 |
the image come up silent. Can also be set, to read in files unlogged." |
|
2440 |
||
2441 |
|prev| |
|
2442 |
||
2443 |
prev := SilentLoading. |
|
2444 |
SilentLoading := aBoolean. |
|
2445 |
^ prev |
|
12409 | 2446 |
! |
2447 |
||
2448 |
silentlyLoadingDo:aBlock |
|
2449 |
"evaluates aBlock with silent loading on - no compilation messages (except errors) |
|
2450 |
are shown on the transcript" |
|
2451 |
||
2452 |
|sav| |
|
2453 |
||
20719 | 2454 |
Smalltalk verbose ifTrue:[ |
22791 | 2455 |
^ aBlock value. |
2456 |
]. |
|
2457 |
||
12409 | 2458 |
sav := SilentLoading. |
2459 |
SilentLoading := true. |
|
22691 | 2460 |
^ aBlock ensure:[ SilentLoading := sav ]. |
2461 |
||
2462 |
"Modified: / 23-04-2018 / 16:56:40 / stefan" |
|
453 | 2463 |
! ! |
2464 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2465 |
!Smalltalk class methodsFor:'misc accessing'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2466 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2467 |
beHeadless:aBoolean |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2468 |
"set/clear the headlessOperation flag." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2469 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2470 |
HeadlessOperation := aBoolean |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2471 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2472 |
|
10231 | 2473 |
beSTScript:aBoolean |
2474 |
"set/clear the isSTScript flag." |
|
2475 |
||
2476 |
IsSTScript := aBoolean |
|
2477 |
||
2478 |
"Created: / 06-12-2006 / 16:43:36 / cg" |
|
2479 |
! |
|
2480 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2481 |
standAloneApp:aBoolean |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2482 |
"set/clear the StandAlone flag." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2483 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2484 |
StandAlone := aBoolean |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2485 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2486 |
|
18197 | 2487 |
|
12250 | 2488 |
!Smalltalk class methodsFor:'private-system management-packages'! |
2489 |
||
17324 | 2490 |
basicLoadPackage:aPackageString fromDirectory:packageDirOrStringOrNil asAutoloaded:doLoadAsAutoloaded |
2491 |
"load a package referenced by aPackageString - a string like 'stx:libbasic'. |
|
2492 |
The package is either located in packageDirOrStringOrNil, or in the current directory (if nil). |
|
2493 |
Answer true, if the load succeeded, false if it failed" |
|
2494 |
||
22791 | 2495 |
|packageDirOrNil binaryClassLibraryFilename projectDefinitionFilename |
19589 | 2496 |
projectDefinitionClass projectDefinitionClassName silent somethingHasBeenLoaded |
2497 |
loadOK errorInInitialize| |
|
17324 | 2498 |
|
2499 |
packageDirOrStringOrNil notNil ifTrue:[ |
|
22791 | 2500 |
packageDirOrNil := packageDirOrStringOrNil asFilename. |
2501 |
]. |
|
2502 |
silent := VerboseLoading not |
|
2503 |
and:[SilentLoading or:[StandAlone or:[InfoPrinting not]]]. |
|
17324 | 2504 |
|
2505 |
"For now: have to read the project definition first!! |
|
2506 |
The class library may contain subclasses of classes in prerequisite packages - |
|
19589 | 2507 |
so the prerequisite packages have to be loaded first. |
2508 |
Normally there is a project definiton, use that one to pull in the rest" |
|
17324 | 2509 |
|
2510 |
"maybe, it is already in the image" |
|
2511 |
projectDefinitionClass := ProjectDefinition definitionClassForPackage:aPackageString. |
|
19906 | 2512 |
projectDefinitionClass notNil ifTrue:[ |
22791 | 2513 |
projectDefinitionClass checkForLoad. |
17324 | 2514 |
]. |
2515 |
||
2516 |
"Is there a shared library (.dll or .so) ?" |
|
17439
1928276a394c
added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents:
17438
diff
changeset
|
2517 |
binaryClassLibraryFilename := ObjectFileLoader |
22791 | 2518 |
binaryClassFilenameForPackage:aPackageString |
2519 |
inDirectory:packageDirOrNil. |
|
17324 | 2520 |
|
2521 |
(binaryClassLibraryFilename notNil and:[binaryClassLibraryFilename exists]) ifTrue:[ |
|
22791 | 2522 |
|loadErrorOccurred| |
2523 |
||
2524 |
loadErrorOccurred := false. |
|
2525 |
ObjectFileLoader objectFileLoadErrorNotification handle:[:ex | |
|
2526 |
loadErrorOccurred := true. |
|
2527 |
ex proceedWith:true. |
|
2528 |
] do:[ |
|
2529 |
loadOK := (ObjectFileLoader loadObjectFile:binaryClassLibraryFilename) notNil. |
|
2530 |
"/ loadOK := self loadPackage:aPackageString fromClassLibrary:binaryClassLibraryFilename. |
|
2531 |
]. |
|
2532 |
(loadOK and:[loadErrorOccurred not]) ifTrue:[ |
|
2533 |
"now, all compiled classes have been loaded. |
|
2534 |
keep classes in the package which are autoloaded as autoloaded." |
|
2535 |
^ true |
|
2536 |
]. |
|
2537 |
||
2538 |
loadErrorOccurred ifTrue:[ |
|
2539 |
self breakPoint:#cg. |
|
2540 |
projectDefinitionClass := ProjectDefinition definitionClassForPackage:aPackageString. |
|
2541 |
projectDefinitionClass notNil ifTrue:[ |
|
2542 |
projectDefinitionClass |
|
2543 |
checkForLoad; |
|
2544 |
loadPreRequisitesAsAutoloaded:doLoadAsAutoloaded. |
|
2545 |
]. |
|
2546 |
]. |
|
17324 | 2547 |
]. |
2548 |
packageDirOrNil isNil ifTrue:[ |
|
22791 | 2549 |
^ PackageNotFoundError raiseRequestWith:aPackageString. |
17324 | 2550 |
]. |
2551 |
||
2552 |
"fallback - go through the project definition" |
|
2553 |
projectDefinitionClass isNil ifTrue:[ |
|
22791 | 2554 |
projectDefinitionClassName := ProjectDefinition projectDefinitionClassNameForDefinitionOf:aPackageString. |
2555 |
"/ try to load the project definition class |
|
2556 |
projectDefinitionFilename := (packageDirOrNil / projectDefinitionClassName) withSuffix:'st'. |
|
2557 |
projectDefinitionFilename exists ifFalse:[ |
|
2558 |
projectDefinitionFilename := (packageDirOrNil / 'source' / projectDefinitionClassName) withSuffix:'st'. |
|
2559 |
]. |
|
2560 |
projectDefinitionFilename exists ifTrue:[ |
|
2561 |
Class withoutUpdatingChangesDo:[ |
|
2562 |
Smalltalk silentlyLoadingDo:[ |
|
2563 |
Error handle:[:ex | |
|
2564 |
"/ catch error during initialization; |
|
2565 |
ex suspendedContext withAllSendersDo:[:sender | |
|
2566 |
(sender selector == #initialize |
|
2567 |
and:[sender receiver isBehavior |
|
2568 |
and:[sender receiver name = projectDefinitionClassName]] |
|
2569 |
) ifTrue:[ |
|
2570 |
errorInInitialize := true |
|
2571 |
]. |
|
2572 |
]. |
|
2573 |
errorInInitialize ifFalse:[ ex reject ]. |
|
2574 |
] do:[ |
|
2575 |
projectDefinitionFilename fileIn. |
|
2576 |
]. |
|
2577 |
]. |
|
2578 |
]. |
|
2579 |
errorInInitialize ifTrue:[ |
|
2580 |
Transcript showCR:'Smalltalk [warning]: an error happened in #initialize - retry after loading package.'. |
|
2581 |
]. |
|
2582 |
projectDefinitionClass := ProjectDefinition definitionClassForPackage:aPackageString. |
|
2583 |
]. |
|
17324 | 2584 |
]. |
2585 |
projectDefinitionClass notNil ifTrue:[ |
|
22791 | 2586 |
projectDefinitionClass |
2587 |
autoload; |
|
2588 |
checkForLoad; |
|
2589 |
loadPreRequisitesAsAutoloaded:doLoadAsAutoloaded. |
|
2590 |
||
2591 |
somethingHasBeenLoaded := projectDefinitionClass loadAsAutoloaded:doLoadAsAutoloaded. |
|
2592 |
errorInInitialize ifTrue:[ |
|
2593 |
Transcript showCR:('Smalltalk [info]: retrying #initialize'). |
|
2594 |
projectDefinitionClass initialize. |
|
2595 |
]. |
|
2596 |
(silent not and:[somethingHasBeenLoaded]) ifTrue:[ |
|
2597 |
Transcript showCR:('Smalltalk [info]: loaded package: ' , aPackageString , ' from project definition'). |
|
2598 |
]. |
|
2599 |
^ true. |
|
17324 | 2600 |
]. |
2601 |
||
2602 |
"/ source files-file loading no longer supported |
|
2603 |
"/ however, allow for autoload-stub loaded |
|
2604 |
doLoadAsAutoloaded ifTrue:[ |
|
22791 | 2605 |
self |
2606 |
recursiveInstallAutoloadedClassesFrom:packageDirOrNil |
|
2607 |
rememberIn:Set new |
|
2608 |
maxLevels:2 |
|
2609 |
noAutoload:false |
|
2610 |
packageTop:packageDirOrNil |
|
2611 |
showSplashInLevels:0. |
|
2612 |
^ true |
|
17324 | 2613 |
]. |
2614 |
||
2615 |
^ PackageNotFoundError raiseRequestWith:aPackageString errorString:' - no projectDef, dll or loadAll found'. |
|
2616 |
||
2617 |
" |
|
2618 |
Smalltalk loadPackageWithId:'stx:libbasic' |
|
2619 |
Smalltalk loadPackageWithId:'stx:goodies/persistency' |
|
2620 |
Smalltalk loadPackageWithId:'exept:ctypes' |
|
2621 |
" |
|
2622 |
||
2623 |
"Modified: / 29-07-2011 / 19:55:35 / cg" |
|
2624 |
! |
|
2625 |
||
12250 | 2626 |
loadExtensionsForPackage:aPackageId |
13415 | 2627 |
| extensionsLoaded | |
13621
85297bc6cfa8
comment/format in: #loadExtensionsForPackage:
Claus Gittinger <cg@exept.de>
parents:
13602
diff
changeset
|
2628 |
|
13415 | 2629 |
extensionsLoaded := false. |
18924 | 2630 |
ProgrammingLanguage allDo:[:programmingLanguage| |
22791 | 2631 |
"/ evaluating or here - want all extensions to be loaded |
2632 |
extensionsLoaded := extensionsLoaded | (self loadExtensionsForPackage:aPackageId language: programmingLanguage) |
|
13621
85297bc6cfa8
comment/format in: #loadExtensionsForPackage:
Claus Gittinger <cg@exept.de>
parents:
13602
diff
changeset
|
2633 |
]. |
85297bc6cfa8
comment/format in: #loadExtensionsForPackage:
Claus Gittinger <cg@exept.de>
parents:
13602
diff
changeset
|
2634 |
^ extensionsLoaded |
13415 | 2635 |
|
2636 |
"Modified: / 18-02-2007 / 11:03:26 / cg" |
|
2637 |
"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
|
2638 |
"Modified (format): / 04-09-2011 / 09:19:24 / cg" |
13415 | 2639 |
! |
2640 |
||
18924 | 2641 |
loadExtensionsForPackage:aPackageId language: programmingLanguage |
13771 | 2642 |
|mgr packageDirName inStream projectDefinition extensionsFilename mod dir |
13621
85297bc6cfa8
comment/format in: #loadExtensionsForPackage:
Claus Gittinger <cg@exept.de>
parents:
13602
diff
changeset
|
2643 |
extensionsRevisionString extensionsRevisionInfo| |
12250 | 2644 |
|
18924 | 2645 |
programmingLanguage supportsExtensionMethods ifFalse:[^false]. |
13415 | 2646 |
|
12250 | 2647 |
packageDirName := aPackageId copyReplaceAll:$: with:$/. |
2648 |
packageDirName := self getPackageFileName:packageDirName. |
|
2649 |
||
2650 |
(packageDirName notNil and:[Class tryLocalSourceFirst]) ifTrue:[ |
|
22791 | 2651 |
(self loadExtensionsFromDirectory:packageDirName language: programmingLanguage) ifTrue:[ |
2652 |
^ true. |
|
2653 |
]. |
|
2654 |
packageDirName := nil. "do not try again" |
|
12250 | 2655 |
]. |
2656 |
||
2657 |
" |
|
2658 |
if there is a sourceCodeManager, ask it first for the extensions |
|
2659 |
" |
|
15958 | 2660 |
(Smalltalk at:#AbstractSourceCodeManager) notNil ifTrue:[ |
22791 | 2661 |
mgr := AbstractSourceCodeManager managerForPackage: aPackageId |
15958 | 2662 |
]. |
12250 | 2663 |
mgr notNil ifTrue:[ |
22791 | 2664 |
extensionsFilename := 'extensions.' , programmingLanguage sourceFileSuffix. |
2665 |
||
2666 |
projectDefinition := ProjectDefinition definitionClassForPackage:aPackageId. |
|
2667 |
projectDefinition notNil ifTrue:[ |
|
2668 |
mod := aPackageId asPackageId module. |
|
2669 |
dir := aPackageId asPackageId directory. |
|
2670 |
extensionsRevisionString := projectDefinition perform:(mgr nameOfVersionMethodForExtensions) ifNotUnderstood:nil. |
|
2671 |
extensionsRevisionString notNil ifTrue:[ |
|
2672 |
extensionsRevisionInfo := mgr revisionInfoFromString:extensionsRevisionString inClass:nil. |
|
2673 |
extensionsRevisionInfo notNil ifTrue:[ |
|
2674 |
extensionsRevisionInfo fileName = extensionsFilename ifFalse:[ |
|
2675 |
"JV@2011-10-23: following condition is never satisfied for |
|
2676 |
filed-in packages. The whole scheme of extensionVersion_XXX |
|
2677 |
works ONLY for compiled packages as it depends on fact, that |
|
2678 |
extension Init() routine is called AFTER all classes are inited, |
|
2679 |
therefore the extensionVersion_XXX methods from extensions.st |
|
2680 |
overwrites methods coming from package definition class. All this |
|
2681 |
is so tricky and error prone, that we have to come up with better |
|
2682 |
solution!!" |
|
2683 |
packageDirName notNil ifTrue:[ |
|
2684 |
^ self loadExtensionsFromDirectory:packageDirName language: programmingLanguage |
|
2685 |
] ifFalse:[ |
|
2686 |
^ false |
|
2687 |
] |
|
2688 |
] |
|
2689 |
] |
|
2690 |
]. |
|
2691 |
SourceCodeManagerError handle:[:ex | |
|
2692 |
] do:[ |
|
2693 |
inStream := mgr streamForExtensionFile:extensionsFilename package:aPackageId directory:dir module:mod cache:true. |
|
2694 |
]. |
|
2695 |
]. |
|
2696 |
inStream isNil ifTrue:[ |
|
2697 |
SourceCodeManagerError handle:[:ex | |
|
2698 |
] do:[ |
|
2699 |
inStream := mgr getMostRecentSourceStreamForFile:extensionsFilename inPackage:aPackageId. |
|
2700 |
]. |
|
2701 |
]. |
|
2702 |
inStream notNil ifTrue:[ |
|
2703 |
Class withoutUpdatingChangeSetDo:[ |
|
2704 |
inStream fileIn. |
|
2705 |
]. |
|
2706 |
inStream close. |
|
2707 |
VerboseLoading ifTrue:[ |
|
2708 |
Transcript showCR:('loaded extensions for ',aPackageId,' from repository'). |
|
2709 |
]. |
|
2710 |
^ true |
|
2711 |
] |
|
12250 | 2712 |
]. |
2713 |
||
2714 |
packageDirName notNil ifTrue:[ |
|
22791 | 2715 |
^ self loadExtensionsFromDirectory:packageDirName language: programmingLanguage |
12250 | 2716 |
]. |
2717 |
^ false |
|
2718 |
||
13415 | 2719 |
"Created: / 02-01-2010 / 10:41:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2720 |
"Modified: / 19-03-2011 / 10:03:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13814 | 2721 |
"Modified: / 04-11-2011 / 13:41:29 / cg" |
15958 | 2722 |
"Modified: / 23-10-2011 / 19:35:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
12250 | 2723 |
! |
2724 |
||
2725 |
loadExtensionsFromDirectory:packageDirOrString |
|
13415 | 2726 |
| extensionsLoaded | |
18924 | 2727 |
|
13415 | 2728 |
extensionsLoaded := false. |
18924 | 2729 |
ProgrammingLanguage allDo:[:programmingLanguage| |
22791 | 2730 |
"/ evaluating or here - want all extensions to be loaded |
2731 |
extensionsLoaded := extensionsLoaded | (self loadExtensionsFromDirectory: packageDirOrString language: programmingLanguage) |
|
18924 | 2732 |
]. |
2733 |
^ extensionsLoaded |
|
13415 | 2734 |
|
2735 |
"Modified: / 02-01-2010 / 10:40:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2736 |
! |
|
2737 |
||
2738 |
loadExtensionsFromDirectory:packageDirOrString language: language |
|
12250 | 2739 |
|packageDir f| |
2740 |
||
2741 |
packageDir := packageDirOrString asFilename. |
|
2742 |
||
13415 | 2743 |
f := packageDir / ('extensions.' , language sourceFileSuffix). |
12250 | 2744 |
f exists ifTrue:[ |
18668 | 2745 |
Class withoutUpdatingChangeSetDo:[ |
2746 |
f fileIn. |
|
2747 |
]. |
|
2748 |
VerboseLoading ifTrue:[ |
|
2749 |
Transcript showCR:('loaded extensions: ' , f pathName). |
|
2750 |
]. |
|
2751 |
^ true |
|
15958 | 2752 |
]. |
2753 |
^ true"/false |
|
13415 | 2754 |
|
2755 |
"Created: / 02-01-2010 / 10:38:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13814 | 2756 |
"Modified: / 04-11-2011 / 13:41:19 / cg" |
15958 | 2757 |
"Modified: / 31-01-2013 / 11:33:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
12250 | 2758 |
! |
2759 |
||
14589 | 2760 |
loadPackage:aPackageStringArg asAutoloaded:doLoadAsAutoloaded |
12782 | 2761 |
"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
|
2762 |
Return true on success, false otherwise." |
12782 | 2763 |
|
14589 | 2764 |
|packageId packageString packageDir def sourceCodeManager| |
2765 |
||
17588 | 2766 |
packageString := aPackageStringArg. |
2767 |
||
2768 |
"/ a little convenience: so you can stx packages with loadPackage:'goodies/soap' |
|
2769 |
(packageString includes:$:) ifFalse:[ |
|
22791 | 2770 |
packageString := 'stx:',packageString. |
17588 | 2771 |
]. |
12782 | 2772 |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2773 |
"if I am here, so must my package" |
14892 | 2774 |
packageString = self package ifTrue:[^ true]. |
13129
0ac3f6a28aaf
changed: #loadPackage:asAutoloaded:
Claus Gittinger <cg@exept.de>
parents:
13120
diff
changeset
|
2775 |
|
17588 | 2776 |
packageId := aPackageStringArg asPackageId. |
2777 |
||
12782 | 2778 |
"/ if there is a projectDefinition, let it load itself... |
14589 | 2779 |
def := packageId projectDefinitionClass. |
14833 | 2780 |
(def notNil and:[def isLoaded]) ifTrue:[ |
22791 | 2781 |
def loadAsAutoloaded:doLoadAsAutoloaded. |
2782 |
^ true. |
|
14589 | 2783 |
]. |
2784 |
||
2785 |
packageDir := self packageDirectoryForPackageId:packageId. |
|
16144 | 2786 |
|
2787 |
[ |
|
22791 | 2788 |
self |
2789 |
loadPackage:packageString |
|
2790 |
fromDirectory:packageDir |
|
2791 |
asAutoloaded:doLoadAsAutoloaded. |
|
16144 | 2792 |
] on:PackageLoadError do:[:ex| |
22791 | 2793 |
ex creator ~~ PackageNotCompatibleError ifTrue:[ |
2794 |
AbstractSourceCodeManager notNil ifTrue:[ |
|
2795 |
sourceCodeManager := AbstractSourceCodeManager sourceCodeManagerForPackage:packageString. |
|
2796 |
sourceCodeManager notNil ifTrue:[ |
|
2797 |
PackageLoadError handle:[:ex2 | |
|
2798 |
ex reject |
|
2799 |
] do:[ |
|
2800 |
^ sourceCodeManager loadPackageWithId:packageString fromRepositoryAsAutoloaded:doLoadAsAutoloaded |
|
2801 |
]. |
|
2802 |
]. |
|
2803 |
]. |
|
2804 |
]. |
|
2805 |
ex reject. |
|
16144 | 2806 |
]. |
2807 |
||
2808 |
^ true |
|
12782 | 2809 |
|
2810 |
" |
|
2811 |
Smalltalk loadPackageWithId:'stx:libbasic' |
|
2812 |
Smalltalk loadPackageWithId:'stx:goodies/persistency' |
|
2813 |
Smalltalk loadPackageWithId:'exept:ctypes' |
|
2814 |
" |
|
2815 |
||
13129
0ac3f6a28aaf
changed: #loadPackage:asAutoloaded:
Claus Gittinger <cg@exept.de>
parents:
13120
diff
changeset
|
2816 |
"Modified: / 16-11-2010 / 17:42:49 / cg" |
12782 | 2817 |
! |
2818 |
||
12250 | 2819 |
loadPackage:packageId fromAllSourceFilesInDirectory:aDirectory |
2820 |
"load all source files found in aDirectory and treat them like |
|
2821 |
a package. Allows for initial import of alien ST-code as a new package. |
|
2822 |
Experimental." |
|
2823 |
||
2824 |
|p t new anyFail repeatCount| |
|
2825 |
||
2826 |
"/ problem: dependencies. |
|
2827 |
"/ solution: repeat twice, so that superclasses are present the second time |
|
2828 |
||
2829 |
Class packageQuerySignal answer:packageId asSymbol do:[ |
|
18668 | 2830 |
|any| |
2831 |
||
2832 |
repeatCount := 0. |
|
2833 |
[ |
|
2834 |
repeatCount := repeatCount + 1. |
|
2835 |
anyFail := false. |
|
2836 |
aDirectory directoryContents do:[:file | |
|
2837 |
|fn| |
|
2838 |
||
2839 |
fn := aDirectory / file. |
|
2840 |
(fn hasSuffix:'st') ifTrue:[ |
|
2841 |
Metaclass confirmationQuerySignal answer:false |
|
2842 |
do:[ |
|
2843 |
Error |
|
2844 |
handle:[:ex | |
|
2845 |
anyFail := true |
|
2846 |
] |
|
2847 |
do:[ |
|
2848 |
(self fileIn:fn) ifFalse:[ |
|
2849 |
anyFail := true |
|
2850 |
] ifTrue:[ |
|
2851 |
any := true. |
|
2852 |
] |
|
2853 |
] |
|
2854 |
] |
|
2855 |
] |
|
2856 |
]. |
|
2857 |
any ifFalse:[ |
|
2858 |
^ false "/ no file found |
|
2859 |
] |
|
2860 |
] doWhile:[anyFail and:[repeatCount<2]]. |
|
12250 | 2861 |
]. |
2862 |
||
2863 |
new := (p := Project projectWithId:packageId) isNil. |
|
2864 |
new ifTrue:[ p := Project new]. |
|
2865 |
||
2866 |
p name:packageId. |
|
2867 |
p directory:aDirectory. |
|
2868 |
p package:packageId. |
|
2869 |
t := packageId asCollectionOfSubstringsSeparatedByAny:'/\:'. |
|
2870 |
p repositoryModule:(t first). |
|
2871 |
p repositoryDirectory:(packageId copyFrom:t first size + 2). |
|
2872 |
p isLoaded:true. |
|
2873 |
||
2874 |
new ifTrue:[Project addLoadedProject:p]. |
|
16144 | 2875 |
anyFail ifTrue:[ |
18668 | 2876 |
^ PackageLoadError raiseRequestWith:packageId. |
16144 | 2877 |
]. |
2878 |
^ true |
|
12250 | 2879 |
! |
2880 |
||
2881 |
loadPackage:packageId fromClassLibrary:aFilename |
|
2882 |
"load a package from a compiled classLib. |
|
2883 |
Experimental." |
|
2884 |
||
2885 |
|p t new| |
|
2886 |
||
2887 |
(self fileIn:aFilename) ifFalse:[ |
|
18668 | 2888 |
(self fileInClassLibrary:aFilename) ifFalse:[ |
2889 |
^ false. |
|
2890 |
] |
|
12250 | 2891 |
]. |
2892 |
||
2893 |
new := (p := Project projectWithId:packageId) isNil. |
|
2894 |
new ifTrue:[ p := Project new]. |
|
2895 |
||
2896 |
p name:packageId. |
|
2897 |
p directory:aFilename directory. |
|
2898 |
p package:packageId. |
|
2899 |
t := packageId asCollectionOfSubstringsSeparatedByAny:'/\:'. |
|
2900 |
p repositoryModule:(t first). |
|
2901 |
p repositoryDirectory:(packageId copyFrom:t first size + 2). |
|
2902 |
p isLoaded:true. |
|
2903 |
||
2904 |
new ifTrue:[Project addLoadedProject:p]. |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2905 |
|
12250 | 2906 |
^ true |
2907 |
! |
|
2908 |
||
12782 | 2909 |
loadPackage:aPackageString fromDirectory:packageDirOrStringOrNil asAutoloaded:doLoadAsAutoloaded |
2910 |
"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
|
2911 |
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
|
2912 |
Answer true, if the load succeeded, false if it failed" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2913 |
|
17324 | 2914 |
|ret| |
2915 |
||
17439
1928276a394c
added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents:
17438
diff
changeset
|
2916 |
PackageLoadInProgressQuery |
18668 | 2917 |
answerNotifyLoading:aPackageString asSymbol |
2918 |
do:[ |
|
2919 |
ret := self basicLoadPackage:aPackageString fromDirectory:packageDirOrStringOrNil asAutoloaded:doLoadAsAutoloaded |
|
2920 |
]. |
|
17324 | 2921 |
^ ret |
17350 | 2922 |
|
2923 |
" |
|
2924 |
Smalltalk loadPackage:'stx:goodies/communication' |
|
2925 |
" |
|
12782 | 2926 |
! |
2927 |
||
12250 | 2928 |
loadPackage:packageId fromLoadAllFile:aFilename |
12782 | 2929 |
<resource: #obsolete> |
12250 | 2930 |
"load a package from a loadAll - loader script. |
2931 |
Experimental." |
|
2932 |
||
2933 |
|p t new| |
|
2934 |
||
2935 |
Metaclass confirmationQuerySignal answer:false |
|
2936 |
do:[ |
|
18668 | 2937 |
(self fileIn:aFilename) ifFalse:[ |
2938 |
self warn:'Failed to load the package ', packageId printString. |
|
2939 |
^ false. |
|
2940 |
] |
|
12250 | 2941 |
]. |
2942 |
||
2943 |
new := (p := Project projectWithId:packageId) isNil. |
|
2944 |
new ifTrue:[ p := Project new]. |
|
2945 |
||
2946 |
p name:packageId. |
|
2947 |
p directory:aFilename directory. |
|
2948 |
p package:packageId. |
|
2949 |
t := packageId asCollectionOfSubstringsSeparatedByAny:'/\:'. |
|
2950 |
p repositoryModule:(t first). |
|
2951 |
p repositoryDirectory:(packageId copyFrom:t first size + 2). |
|
2952 |
p isLoaded:true. |
|
2953 |
||
2954 |
new ifTrue:[Project addLoadedProject:p]. |
|
2955 |
^ true |
|
2956 |
! |
|
2957 |
||
2958 |
loadPackage:aPackageId fromZIPArchive:f asAutoloaded:doLoadAsAutoloaded |
|
2959 |
"load a package from a .zip delivery file. |
|
2960 |
Experimental." |
|
2961 |
||
19906 | 2962 |
PackageLoadError |
22791 | 2963 |
raiseWith:aPackageId |
2964 |
errorString:' - package loading from zip is not yet implemented'. |
|
12250 | 2965 |
! |
2966 |
||
2967 |
loadPackageFromAbbrevFile:aPackageId asAutoloaded:doLoadAsAutoloaded |
|
12782 | 2968 |
<resource: #obsolete> |
12250 | 2969 |
|abbrevFile packageDir| |
2970 |
||
2971 |
packageDir := self packageDirectoryForPackageId:aPackageId. |
|
2972 |
packageDir isNil ifTrue:[^ false]. |
|
2973 |
||
2974 |
"/ abbrev.stc ? |
|
12377 | 2975 |
abbrevFile := packageDir / 'abbrev.stc'. |
12250 | 2976 |
abbrevFile exists ifFalse:[^ false]. |
2977 |
||
2978 |
Smalltalk installAutoloadedClassesFrom:abbrevFile pathName. |
|
2979 |
||
2980 |
doLoadAsAutoloaded ifFalse:[ |
|
18668 | 2981 |
"/ force autoloading... |
2982 |
Smalltalk allClassesInPackage:aPackageId do:[:eachClass | eachClass autoload]. |
|
12250 | 2983 |
]. |
2984 |
||
2985 |
self loadExtensionsFromDirectory:packageDir. |
|
13814 | 2986 |
VerboseLoading ifTrue:[ |
18668 | 2987 |
Transcript showCR:('Smalltalk [info]: loaded package: ' , aPackageId , ' from abbrev file: ' , abbrevFile pathName). |
12250 | 2988 |
]. |
2989 |
^ true |
|
2990 |
||
13814 | 2991 |
"Modified: / 04-11-2011 / 13:43:29 / cg" |
12250 | 2992 |
! ! |
2993 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2994 |
!Smalltalk class methodsFor:'queries'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2995 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2996 |
allClasses |
7563 | 2997 |
"return an unordered collection of all classes in the system. |
10071 | 2998 |
Only globally anchored classes are returned |
21489 | 2999 |
(i.e. anonymous ones have to be acquired by Behavior allSubInstances). |
3000 |
Enumerates non-meta classes only - not metaclasses" |
|
453 | 3001 |
|
3002 |
|classes| |
|
3003 |
||
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
3004 |
"/ you may wonder, what this while is for, here ... |
453 | 3005 |
"/ the reason is that if we modify the class hierarchy in |
4067 | 3006 |
"/ another view (background fileIn), while building up the |
453 | 3007 |
"/ cachedClasses set, this may be flushed (invalidated) by the |
3008 |
"/ other process in the meanwhile. |
|
3009 |
"/ If that happens, we restart the set-building here |
|
3010 |
"/ |
|
3011 |
[(classes := CachedClasses) isNil] whileTrue:[ |
|
22791 | 3012 |
CachedClasses := classes := IdentitySet new:NumberOfClassesHint. |
3013 |
self keysAndValuesDo:[:eachName :eachGlobal | |
|
3014 |
(eachGlobal notNil and:[eachGlobal isBehavior]) ifTrue:[ |
|
3015 |
"/ sigh - would like to skip over aliases |
|
3016 |
"/ but this cannot be done simply by comparing |
|
3017 |
"/ the classes name against the store-key |
|
3018 |
"/ i.e. cannot do: |
|
3019 |
"/ anObject name == sym ifTrue:[ |
|
3020 |
"/ classes add:anObject |
|
3021 |
"/ ] |
|
3022 |
"/ because that would lead to ignore all java |
|
3023 |
"/ classes, which are stored under a different |
|
3024 |
"/ key. |
|
3025 |
||
3026 |
(eachGlobal name == eachName |
|
3027 |
or:[eachGlobal isJavaClass]) ifTrue:[ |
|
3028 |
classes add:eachGlobal |
|
3029 |
]. |
|
3030 |
] |
|
3031 |
]. |
|
3032 |
NumberOfClassesHint := classes size. |
|
453 | 3033 |
]. |
3034 |
^ classes |
|
3035 |
||
8964
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
3036 |
" |
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
3037 |
CachedClasses := nil. |
453 | 3038 |
Smalltalk allClasses |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
3039 |
|
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
3040 |
to get the list sorted by name: |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
3041 |
|
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
3042 |
Smalltalk allClasses asSortedCollection:[:a :b | a name < b name] |
453 | 3043 |
" |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
3044 |
|
13851
5ab434e0a636
changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents:
13850
diff
changeset
|
3045 |
"Modified: / 06-12-2011 / 12:41:42 / cg" |
21489 | 3046 |
"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
|
3047 |
! |
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 |
allClassesAndMetaclasses |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3050 |
"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
|
3051 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3052 |
|classes| |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3053 |
|
8964
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
3054 |
classes := IdentitySet new:NumberOfClassesHint*2. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3055 |
self allClassesDo:[:eachClass | |
18668 | 3056 |
classes add:(eachClass theNonMetaclass). |
3057 |
classes add:(eachClass theMetaclass). |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3058 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3059 |
^ classes |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3060 |
! |
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 |
allClassesWithAllPrivateClasses |
7563 | 3063 |
"return an unordered collection of all classes in the Smalltalk namespace. |
10173
765b385fd1b8
changed #listAtCategoryNamed:
Claus Gittinger <cg@exept.de>
parents:
10169
diff
changeset
|
3064 |
Only globally anchored classes are returned; Namespaces are not included. |
20122 | 3065 |
(i.e. anonymous ones have to be acquired by Behavior allSubInstances)" |
4642 | 3066 |
|
10071 | 3067 |
^ self allClasses select:[:aClass | |
22791 | 3068 |
|owner| |
3069 |
||
3070 |
(aClass isRealNameSpace not) |
|
3071 |
and:[ |
|
3072 |
owner := aClass topOwningClass. |
|
3073 |
(owner ? aClass) nameSpace == Smalltalk |
|
3074 |
] |
|
4642 | 3075 |
] |
3076 |
||
3077 |
" |
|
3078 |
Smalltalk allClassesWithAllPrivateClasses |
|
3079 |
" |
|
10173
765b385fd1b8
changed #listAtCategoryNamed:
Claus Gittinger <cg@exept.de>
parents:
10169
diff
changeset
|
3080 |
|
765b385fd1b8
changed #listAtCategoryNamed:
Claus Gittinger <cg@exept.de>
parents:
10169
diff
changeset
|
3081 |
"Modified: / 10-11-2006 / 17:24:00 / cg" |
4642 | 3082 |
! |
3083 |
||
15068 | 3084 |
allExtensions |
3085 |
"return a collection of all extension methods (methods added from another package)" |
|
3086 |
||
3087 |
|methods| |
|
3088 |
||
3089 |
methods := OrderedCollection new. |
|
3090 |
self allClassesDo:[:eachClass | |
|
18668 | 3091 |
|classPackage| |
3092 |
||
3093 |
classPackage := eachClass package. |
|
3094 |
eachClass instAndClassMethodsDo:[:mthd | |
|
3095 |
mthd package ~= classPackage ifTrue:[ methods add:mthd ]. |
|
3096 |
]. |
|
15068 | 3097 |
]. |
3098 |
^ methods |
|
3099 |
||
3100 |
" |
|
3101 |
Smalltalk allExtensions |
|
3102 |
" |
|
3103 |
! |
|
3104 |
||
11153 | 3105 |
allExtensionsForPackage:aProjectID |
14890 | 3106 |
"return a collection of all extension methods for a given projectID" |
3107 |
||
11153 | 3108 |
|methods| |
3109 |
||
3110 |
methods := OrderedCollection new. |
|
3111 |
self allClassesDo:[:eachClass | |
|
18668 | 3112 |
methods addAll:(eachClass extensionsFrom:aProjectID). |
11153 | 3113 |
]. |
3114 |
^ methods |
|
3115 |
! |
|
3116 |
||
9227 | 3117 |
allImplementorsOf:aSelector |
12919
a7ea070197c9
comment/format in: #allImplementorsOf:
Claus Gittinger <cg@exept.de>
parents:
12911
diff
changeset
|
3118 |
"return a collection of classes which implement the given selector" |
a7ea070197c9
comment/format in: #allImplementorsOf:
Claus Gittinger <cg@exept.de>
parents:
12911
diff
changeset
|
3119 |
|
9227 | 3120 |
|implementors| |
3121 |
||
3122 |
implementors := OrderedCollection new. |
|
19681 | 3123 |
self allImplementorsOf:aSelector do:[:cls | implementors add:cls]. |
3124 |
^ implementors |
|
3125 |
||
3126 |
" |
|
22791 | 3127 |
Smalltalk allImplementorsOf:#isNil |
3128 |
(Smalltalk allImplementorsOf:#add:) size |
|
19681 | 3129 |
" |
3130 |
||
3131 |
"Modified: / 30-04-2016 / 17:37:39 / cg" |
|
3132 |
! |
|
3133 |
||
3134 |
allImplementorsOf:aSelector do:aBlock |
|
3135 |
"enumerate all classes which implement the given selector" |
|
3136 |
||
9227 | 3137 |
self allClassesDo:[:cls | |
22791 | 3138 |
(cls includesSelector:aSelector) ifTrue:[ |
3139 |
aBlock value:cls. |
|
3140 |
]. |
|
3141 |
(cls class includesSelector:aSelector) ifTrue:[ |
|
3142 |
aBlock value:cls class. |
|
3143 |
]. |
|
19681 | 3144 |
]. |
3145 |
||
3146 |
" |
|
3147 |
Smalltalk allImplementorsOf:#isNil do:[:cls | Transcript showCR:cls] |
|
3148 |
Smalltalk allImplementorsOf:#add: do:[:cls | Transcript showCR:cls] |
|
3149 |
" |
|
3150 |
||
3151 |
"Created: / 30-04-2016 / 17:36:45 / cg" |
|
9227 | 3152 |
! |
3153 |
||
19475 | 3154 |
allLoadedPackageIDs |
3155 |
||
3156 |
^ self allPackageIdsIncludingUnloadedClasses: false |
|
3157 |
||
3158 |
||
3159 |
" |
|
3160 |
Smalltalk allLoadedPackageIDs |
|
3161 |
" |
|
3162 |
! |
|
3163 |
||
12376 | 3164 |
allLoadedProjectIDs |
19475 | 3165 |
<resource: #obsolete> |
3166 |
self obsoleteMethodWarning:'use allLoadedPackageIDs'. |
|
3167 |
^ self allPackageIdsIncludingUnloadedClasses: false |
|
12376 | 3168 |
|
3169 |
||
3170 |
" |
|
3171 |
Smalltalk allLoadedProjectIDs |
|
3172 |
" |
|
3173 |
! |
|
3174 |
||
19475 | 3175 |
allPackageIDs |
3176 |
||
3177 |
^ self allPackageIdsIncludingUnloadedClasses: true |
|
3178 |
||
3179 |
" |
|
3180 |
Smalltalk allPackageIDs |
|
3181 |
" |
|
3182 |
! |
|
3183 |
||
3184 |
allPackageIdsIncludingUnloadedClasses: includeUnloadedClasses |
|
3185 |
"Returns all package ids. |
|
3186 |
Excludes packages coming from unloaded classes if includeUnloadedClasses is false. |
|
3187 |
" |
|
3188 |
||
3189 |
|allProjects| |
|
3190 |
||
3191 |
allProjects := Set new. |
|
3192 |
self allClassesDo:[:eachClass | |
|
22791 | 3193 |
|cls pkg| |
3194 |
||
3195 |
eachClass isRealNameSpace ifFalse:[ |
|
3196 |
(includeUnloadedClasses or:[eachClass isLoaded]) ifTrue:[ |
|
3197 |
cls := eachClass theNonMetaclass. |
|
3198 |
cls isPrivate ifTrue:[ |
|
3199 |
cls := cls topOwningClass |
|
3200 |
]. |
|
3201 |
pkg := cls package. |
|
3202 |
pkg size > 0 ifTrue:[ |
|
3203 |
allProjects add:pkg. |
|
3204 |
] ifFalse:[ |
|
3205 |
"/ for now, nameSpaces are not in any package; |
|
3206 |
"/ this might change. Then, 0-sized packages are |
|
3207 |
"/ illegal, and the following should be enabled. |
|
3208 |
"/ self halt |
|
3209 |
]. |
|
3210 |
cls isJavaClass ifFalse:[ |
|
3211 |
cls instAndClassSelectorsAndMethodsDo:[:sel :mthd | |
|
3212 |
allProjects add:mthd package asSymbol. |
|
3213 |
]. |
|
3214 |
]. |
|
3215 |
]. |
|
3216 |
]. |
|
19475 | 3217 |
]. |
3218 |
allProjects := allProjects asOrderedCollection sort. |
|
3219 |
^ allProjects |
|
3220 |
||
3221 |
" |
|
3222 |
Smalltalk allProjectsIdsIncludingUnloadedClasses: true |
|
3223 |
Smalltalk allProjectsIdsIncludingUnloadedClasses: false |
|
3224 |
" |
|
3225 |
! |
|
3226 |
||
9254 | 3227 |
allProjectIDs |
19475 | 3228 |
<resource: #obsolete> |
3229 |
self obsoleteMethodWarning:'use allPackageIDs'. |
|
3230 |
^ self allPackageIDs |
|
12376 | 3231 |
|
3232 |
" |
|
3233 |
Smalltalk allProjectIDs |
|
3234 |
" |
|
3235 |
! |
|
3236 |
||
3237 |
allProjectsIdsIncludingUnloadedClasses: includeUnloadedClasses |
|
19475 | 3238 |
<resource: #obsolete> |
12376 | 3239 |
"Returns all projects ids. |
3240 |
Excludes projects coming from unloaded classes if includeUnloadedClasses is false. |
|
3241 |
" |
|
3242 |
||
19475 | 3243 |
self obsoleteMethodWarning:'use allPackageIdsIncludingUnloadedClasses:'. |
3244 |
^ self allPackageIdsIncludingUnloadedClasses: includeUnloadedClasses |
|
9254 | 3245 |
|
3246 |
" |
|
12376 | 3247 |
Smalltalk allProjectsIdsIncludingUnloadedClasses: true |
3248 |
Smalltalk allProjectsIdsIncludingUnloadedClasses: false |
|
9254 | 3249 |
" |
3250 |
! |
|
3251 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3252 |
cellAt:aName |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3253 |
"{ Pragma: +optSpace }" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3254 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3255 |
"return the address of a global cell |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3256 |
- used internally for compiler only" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3257 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3258 |
%{ /* NOCONTEXT */ |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3259 |
RETURN ( __GLOBAL_GETCELL(aName) ); |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3260 |
%}. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3261 |
^ self primitiveFailed |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3262 |
|
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 |
classCategoryCompletion:aPartialCategory |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3266 |
"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
|
3267 |
2 entries: 1st: the best (longest) match |
18668 | 3268 |
2nd: collection consisting of matching categories" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3269 |
|
9508 | 3270 |
^ DoWhatIMeanSupport classCategoryCompletion:aPartialCategory inEnvironment:self |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3271 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3272 |
" |
10071 | 3273 |
Smalltalk classCategoryCompletion:'Sys' |
3274 |
Smalltalk classCategoryCompletion:'System' |
|
3275 |
Smalltalk classCategoryCompletion:'System-BinaryStorage' |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3276 |
" |
9508 | 3277 |
|
3278 |
"Modified: / 10-08-2006 / 13:06:34 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3279 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3280 |
|
8570 | 3281 |
classNamed:aString |
3282 |
"return the class with name aString, or nil if absent. |
|
3283 |
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
|
3284 |
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
|
3285 |
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
|
3286 |
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
|
3287 |
|
10127 | 3288 |
|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
|
3289 |
|
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3290 |
"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
|
3291 |
But be careful, to not invent new symbols ..." |
453 | 3292 |
sym := aString asSymbolIfInterned. |
22650 | 3293 |
sym isSymbol ifTrue:[ |
22791 | 3294 |
cls := self at:sym ifAbsent:nil. |
3295 |
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
|
3296 |
]. |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3297 |
|
1480
df0bea6285f8
Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
3298 |
(aString endsWith:' class') ifTrue:[ |
22791 | 3299 |
nonMeta := self classNamed:(aString copyButLast:6). |
3300 |
nonMeta notNil ifTrue:[ |
|
3301 |
^ nonMeta theMetaclass |
|
3302 |
]. |
|
3303 |
^ nil. |
|
13602
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3304 |
]. |
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 |
"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
|
3307 |
cls isNil ifTrue:[ |
22791 | 3308 |
idx := aString indexOfSubCollection:'::'. |
3309 |
idx ~~ 0 ifTrue:[ |
|
3310 |
prefix := aString copyTo:idx-1. |
|
3311 |
nsNameSymbol := prefix asSymbolIfInterned. |
|
3312 |
nsNameSymbol notNil ifTrue:[ |
|
3313 |
rest := aString copyFrom:idx+2. |
|
3314 |
namespace := self at:prefix asSymbolIfInterned ifAbsent:nil. |
|
3315 |
"namespace may be the owner of a private class. |
|
3316 |
NameSpaces and Behaviors have the same protocol" |
|
3317 |
[namespace isBehavior] whileTrue:[ |
|
3318 |
idx := rest indexOfSubCollection:'::'. |
|
3319 |
idx ~~ 0 ifTrue:[ |
|
3320 |
prefix := rest copyTo:idx-1. |
|
3321 |
rest := rest copyFrom:idx+2. |
|
3322 |
"this does an implicit autoload if required" |
|
3323 |
namespace := namespace privateClassesAt:prefix. |
|
3324 |
] ifFalse:[ |
|
3325 |
namespace isLoaded ifTrue:[ |
|
3326 |
cls := namespace privateClassesAt:rest. |
|
3327 |
cls isBehavior ifTrue:[^ cls]. |
|
3328 |
]. |
|
3329 |
namespace := nil. "force exit of loop" |
|
3330 |
]. |
|
3331 |
]. |
|
3332 |
]. |
|
3333 |
]. |
|
9374
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3334 |
]. |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3335 |
|
453 | 3336 |
^ nil |
3337 |
||
3338 |
" |
|
10071 | 3339 |
Smalltalk classNamed:'Object' |
3340 |
Smalltalk classNamed:'Authentication::BasicAuthenticator::BasicAuthenticationData' |
|
3341 |
Smalltalk classNamed:'Authentication::BasicAuthenticator::BasicAuthenticationData class' |
|
3342 |
Smalltalk classNamed:'Authentication::BasicAuthenticator' |
|
3343 |
Smalltalk classNamed:'fooBar' |
|
3344 |
Smalltalk classNamed:'true' |
|
3345 |
Smalltalk classNamed:'Object class' |
|
3346 |
Smalltalk classNamed:'Metaclass' |
|
3347 |
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
|
3348 |
Smalltalk classNamed:'Array class' |
453 | 3349 |
" |
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
3350 |
|
9468 | 3351 |
"Created: / 24-11-1995 / 17:30:22 / cg" |
3352 |
"Modified: / 19-06-1996 / 14:22:21 / stefan" |
|
10127 | 3353 |
"Modified: / 23-10-2006 / 18:06:53 / cg" |
13602
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3354 |
"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
|
3355 |
! |
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 |
classNames |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3358 |
"return a collection of all classNames in the system" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3359 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3360 |
^ self allClasses collect:[:aClass | aClass name] |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3361 |
|
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 |
Smalltalk classNames |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3364 |
" |
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 |
classnameCompletion:aPartialClassName |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3368 |
"given a partial classname, return an array consisting of |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3369 |
2 entries: 1st: the best (longest) match |
18668 | 3370 |
2nd: collection consisting of matching names" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3371 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3372 |
^ DoWhatIMeanSupport classnameCompletion:aPartialClassName inEnvironment:self |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3373 |
! |
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 |
classnameCompletion:aPartialClassName inEnvironment:anEnvironment |
7563 | 3376 |
"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
|
3377 |
2 entries: 1st: the best (longest) match |
18668 | 3378 |
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
|
3379 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3380 |
^ DoWhatIMeanSupport classnameCompletion:aPartialClassName inEnvironment:anEnvironment |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3381 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3382 |
" |
10071 | 3383 |
Smalltalk classnameCompletion:'Arr' |
3384 |
Smalltalk classnameCompletion:'Arra' |
|
3385 |
Smalltalk classnameCompletion:'arra' |
|
3386 |
Smalltalk classnameCompletion:'*rray' |
|
3387 |
||
3388 |
Smalltalk classnameCompletion:'Arr cl' |
|
3389 |
Smalltalk classnameCompletion:'*rray cl' |
|
453 | 3390 |
" |
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
3391 |
|
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
3392 |
"Created: 24.11.1995 / 17:24:45 / cg" |
2523
04db1fd74e0d
try ignoring case in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
2514
diff
changeset
|
3393 |
"Modified: 3.4.1997 / 18:25:01 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3394 |
! |
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 |
defaultNameSpace |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3397 |
"return the default namespace, where new classes are installed, |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3398 |
if NO special nameSpace handler is present" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3399 |
|
9562
7d36dbb02bb3
code cleanup - remove old obsolete Project code
Claus Gittinger <cg@exept.de>
parents:
9550
diff
changeset
|
3400 |
^ Project defaultNameSpace. |
7d36dbb02bb3
code cleanup - remove old obsolete Project code
Claus Gittinger <cg@exept.de>
parents:
9550
diff
changeset
|
3401 |
|
7d36dbb02bb3
code cleanup - remove old obsolete Project code
Claus Gittinger <cg@exept.de>
parents:
9550
diff
changeset
|
3402 |
"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
|
3403 |
"Modified: / 17-08-2006 / 14:01:22 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3404 |
! |
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 |
globalNameCompletion:aPartialGlobalName |
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3407 |
"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
|
3408 |
2 entries: 1st: the best (longest) match |
18668 | 3409 |
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
|
3410 |
|
12614
b8fca618dcb6
changed: #globalNameCompletion:
Claus Gittinger <cg@exept.de>
parents:
12613
diff
changeset
|
3411 |
^ 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
|
3412 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3413 |
" |
10071 | 3414 |
Smalltalk globalnameCompletion:'Arr' |
3415 |
Smalltalk globalnameCompletion:'Arra' |
|
3416 |
Smalltalk globalnameCompletion:'arra' |
|
3417 |
Smalltalk globalnameCompletion:'*rray' |
|
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3418 |
" |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3419 |
|
9508 | 3420 |
"Created: / 24-11-1995 / 17:24:45 / cg" |
3421 |
"Modified: / 10-08-2006 / 13:05:39 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3422 |
! |
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 |
globalnameCompletion:aPartialGlobalName |
7563 | 3425 |
"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
|
3426 |
2 entries: 1st: the best (longest) match |
18668 | 3427 |
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
|
3428 |
|
8358 | 3429 |
<resource:#obsolete> |
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3430 |
self obsoleteMethodWarning:'use #globalNameCompletion:'. |
9508 | 3431 |
^ 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
|
3432 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3433 |
" |
10071 | 3434 |
Smalltalk globalnameCompletion:'Arr' |
3435 |
Smalltalk globalnameCompletion:'Arra' |
|
3436 |
Smalltalk globalnameCompletion:'arra' |
|
3437 |
Smalltalk globalnameCompletion:'*rray' |
|
5736 | 3438 |
" |
3439 |
||
9508 | 3440 |
"Created: / 24-11-1995 / 17:24:45 / cg" |
3441 |
"Modified: / 10-08-2006 / 13:05:48 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3442 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3443 |
|
13771 | 3444 |
hasClassNamed:aString |
3445 |
Symbol |
|
18668 | 3446 |
hasInterned:aString |
3447 |
ifTrue:[:aSymbol | ^ (self at:aSymbol ifAbsent:[ nil ]) isClass ]. |
|
13602
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3448 |
^ false |
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3449 |
|
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3450 |
"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
|
3451 |
"Modified: / 20-08-2011 / 16:41:31 / cg" |
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3452 |
! |
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3453 |
|
9290 | 3454 |
hasNameSpaces |
3455 |
"can be redefined by dummy namespaces/environments, to suppress |
|
3456 |
the namespace display in a browser (PocketSmalltalk)" |
|
3457 |
||
3458 |
^ true |
|
3459 |
! |
|
3460 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3461 |
hasNamespaces |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3462 |
"can be redefined by dummy namespaces/environments, to suppress |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3463 |
the namespace display in a browser (PocketSmalltalk)" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3464 |
|
9290 | 3465 |
<resource:#obsolete> |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3466 |
^ true |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3467 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3468 |
|
10432
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3469 |
hasSelectorNameSpaces |
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3470 |
"for now return false |
10999 | 3471 |
Selector namespaces are being implemented and supported by the VM, |
10432
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3472 |
but not yet fully supported by all tools... |
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3473 |
Therefore, for now, do not generate code which uses this feature." |
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3474 |
|
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3475 |
^ false |
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3476 |
|
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3477 |
"Created: / 05-03-2007 / 13:26:28 / cg" |
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3478 |
! |
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3479 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3480 |
includes:something |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3481 |
"this should come from Collection. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3482 |
will change the inheritance - Smalltalk is actually a collection" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3483 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3484 |
self do:[:element | element = something ifTrue:[^ true]]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3485 |
^ false |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3486 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3487 |
|
14987 | 3488 |
includesIdentical:something |
3489 |
"this should come from Collection. |
|
3490 |
will change the inheritance - Smalltalk is actually a collection" |
|
3491 |
||
3492 |
self do:[:element | element == something ifTrue:[^ true]]. |
|
3493 |
^ false |
|
3494 |
! |
|
3495 |
||
10041
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
3496 |
isBrowserStartable |
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
3497 |
^ false. |
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
3498 |
|
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
3499 |
"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
|
3500 |
! |
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
3501 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3502 |
isNameSpace |
9227 | 3503 |
"return true, if the receiver is a nameSpace." |
3504 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3505 |
^ true |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3506 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3507 |
"Created: 11.10.1996 / 18:10:43 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3508 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3509 |
|
10169 | 3510 |
isRealNameSpace |
3511 |
"return true, if the receiver is a nameSpace, but not Smalltalk (which is also a class)." |
|
3512 |
||
3513 |
^ false |
|
3514 |
||
3515 |
"Created: / 10-11-2006 / 17:02:19 / cg" |
|
3516 |
! |
|
3517 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3518 |
isTopLevelNameSpace |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3519 |
^ true |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3520 |
! |
7563 | 3521 |
|
3522 |
isTopLevelNamespace |
|
3523 |
"obsolete - use isTopLevelNameSpace" |
|
5365 | 3524 |
|
7432 | 3525 |
<resource:#obsolete> |
3526 |
||
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3527 |
self obsoleteMethodWarning:'use #isTopLevelNameSpace'. |
4458 | 3528 |
^ true |
3529 |
||
3530 |
"Created: 11.10.1996 / 18:10:43 / cg" |
|
3531 |
! |
|
3532 |
||
9081 | 3533 |
keyIsClassVariableNameKey:aKey |
3534 |
|i| |
|
3535 |
||
3536 |
i := aKey lastIndexOf:$:. |
|
3537 |
i ~~ 0 ifTrue:[ |
|
18668 | 3538 |
i > 1 ifTrue:[ |
3539 |
(aKey at:(i-1)) == $: ifFalse:[ |
|
3540 |
^ true. |
|
3541 |
]. |
|
3542 |
]. |
|
9081 | 3543 |
]. |
3544 |
^ false. |
|
3545 |
||
3546 |
" |
|
10071 | 3547 |
self keyIsClassVariableNameKey:'foo::bar' |
3548 |
self keyIsClassVariableNameKey:'foo:bar' |
|
3549 |
self keyIsClassVariableNameKey:':bar' |
|
3550 |
self keyIsClassVariableNameKey:'::bar' |
|
9081 | 3551 |
" |
3552 |
! |
|
3553 |
||
9374
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3554 |
loadedClassNamed:aString |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3555 |
"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
|
3556 |
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
|
3557 |
|
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3558 |
|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
|
3559 |
|
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3560 |
"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
|
3561 |
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
|
3562 |
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
|
3563 |
sym notNil ifTrue:[ |
18668 | 3564 |
cls := self at:sym ifAbsent:nil. |
3565 |
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
|
3566 |
]. |
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 |
(aString endsWith:' class') ifTrue:[ |
18668 | 3569 |
nonMeta := self loadedClassNamed:(aString copyButLast:6). |
3570 |
nonMeta notNil ifTrue:[ |
|
3571 |
^ nonMeta theMetaclass |
|
3572 |
]. |
|
9374
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3573 |
]. |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3574 |
^ nil |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3575 |
|
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3576 |
" |
10071 | 3577 |
Smalltalk loadedClassNamed:'Object' |
3578 |
Smalltalk loadedClassNamed:'Authentication::BasicAuthenticator::BasicAuthenticationData' |
|
3579 |
Smalltalk loadedClassNamed:'Authentication::BasicAuthenticator::BasicAuthenticationData class' |
|
3580 |
Smalltalk loadedClassNamed:'Authentication::BasicAuthenticator' |
|
3581 |
Smalltalk loadedClassNamed:'fooBar' |
|
3582 |
Smalltalk loadedClassNamed:'true' |
|
3583 |
Smalltalk loadedClassNamed:'Object class' |
|
3584 |
Smalltalk loadedClassNamed:'Metaclass' |
|
3585 |
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
|
3586 |
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
|
3587 |
" |
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 |
|
7563 | 3590 |
methodProtocolCompletion:aPartialProtocolName |
3591 |
"given a partial method protocol name, return an array consisting of |
|
10071 | 3592 |
2 entries: 1st: the best (longest) match |
18668 | 3593 |
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
|
3594 |
|
9508 | 3595 |
^ DoWhatIMeanSupport methodProtocolCompletion:aPartialProtocolName inEnvironment:self |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3596 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3597 |
" |
10071 | 3598 |
Smalltalk methodProtocolCompletion:'doc' |
3599 |
Smalltalk methodProtocolCompletion:'docu' |
|
3600 |
Smalltalk methodProtocolCompletion:'documenta' |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3601 |
" |
9508 | 3602 |
|
3603 |
"Modified: / 10-08-2006 / 13:05:20 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3604 |
! |
5505
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
3605 |
|
7563 | 3606 |
numberOfGlobals |
3607 |
"return the number of global variables in the system" |
|
3608 |
||
3609 |
|tally "{ Class: SmallInteger }" | |
|
617 | 3610 |
|
3611 |
tally := 0. |
|
3612 |
self do:[:obj | tally := tally + 1]. |
|
3613 |
^ tally |
|
3614 |
||
3615 |
"Smalltalk numberOfGlobals" |
|
3616 |
! |
|
3617 |
||
7563 | 3618 |
referencesAny:aCollection |
3619 |
"redefined, since the references are only kept in the VM's symbol table" |
|
3260 | 3620 |
|
3621 |
self keysAndValuesDo:[:key :val | |
|
18668 | 3622 |
aCollection do:[:anObject | |
3623 |
(key == anObject) ifTrue:[^ true]. |
|
3624 |
(val == anObject ) ifTrue:[^ true]. |
|
3625 |
] |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3626 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3627 |
^ super referencesAny:aCollection |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3628 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3629 |
"Created: / 2.2.1998 / 16:01:20 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3630 |
! |
3260 | 3631 |
|
7563 | 3632 |
referencesDerivedInstanceOf:aClass |
3633 |
"redefined, since the references are only kept in the VM's symbol table" |
|
617 | 3634 |
|
3635 |
self keysAndValuesDo:[:key :val | |
|
18668 | 3636 |
(key isKindOf:aClass) ifTrue:[^ true]. |
3637 |
(val isKindOf:aClass) ifTrue:[^ true]. |
|
617 | 3638 |
]. |
3639 |
^ super referencesDerivedInstanceOf:aClass |
|
3640 |
! |
|
3641 |
||
7563 | 3642 |
referencesInstanceOf:aClass |
3643 |
"redefined, since the references are only kept in the VM's symbol table" |
|
617 | 3644 |
|
3645 |
self keysAndValuesDo:[:key :val | |
|
18668 | 3646 |
(key isMemberOf:aClass) ifTrue:[^ true]. |
3647 |
(val isMemberOf:aClass) ifTrue:[^ true]. |
|
617 | 3648 |
]. |
3649 |
^ super referencesInstanceOf:aClass |
|
3650 |
! |
|
3651 |
||
7563 | 3652 |
referencesObject:anObject |
3653 |
"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
|
3654 |
|
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
3655 |
self keysAndValuesDo:[:key :val | |
18668 | 3656 |
(key == anObject) ifTrue:[^ true]. |
3657 |
(val == anObject ) ifTrue:[^ true]. |
|
6074
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
3658 |
]. |
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
3659 |
^ super referencesObject:anObject |
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
3660 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3661 |
"Modified: / 3.2.1998 / 14:22:46 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3662 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3663 |
|
15766 | 3664 |
resolveName:aName inClass:aClass |
7563 | 3665 |
"resolve aName as if compiled within aClass; |
3026 | 3666 |
i.e. if it has a private class with this name, return it; |
3667 |
if aName is known within the classes namespace, return that. |
|
3668 |
Otherwise, return a global with that name. |
|
3669 |
This should be used whereever Smalltalk>>at: used to be used, |
|
3670 |
to resolve a global by name." |
|
3671 |
||
15766 | 3672 |
|nameUsed sym cls ns| |
3673 |
||
3674 |
aName isNil ifTrue:[^ nil]. |
|
3675 |
aName isBehavior ifTrue:[^ aName]. "/ already resolved |
|
3676 |
nameUsed := aName. |
|
3677 |
||
3678 |
(nameUsed startsWith:'Smalltalk::') ifTrue:[ |
|
18668 | 3679 |
nameUsed := nameUsed copyFrom:12. |
3680 |
^ self at:(nameUsed asSymbol) ifAbsent:nil. |
|
15766 | 3681 |
]. |
3682 |
||
3683 |
sym := nameUsed asSymbol. |
|
3026 | 3684 |
|
3685 |
cls := aClass privateClassesAt:sym. |
|
3686 |
cls notNil ifTrue:[^ cls]. |
|
3687 |
||
3688 |
ns := aClass nameSpace. |
|
3689 |
(ns notNil and:[ns ~~ Smalltalk]) ifTrue:[ |
|
18668 | 3690 |
ns isNameSpace ifTrue:[ |
3691 |
cls := ns at:sym ifAbsent:nil. |
|
3692 |
] ifFalse:[ |
|
3693 |
cls := ns privateClassesAt:sym |
|
3694 |
]. |
|
3695 |
cls notNil ifTrue:[^ cls]. |
|
3025 | 3696 |
]. |
3026 | 3697 |
^ self at:sym ifAbsent:nil. |
4356 | 3698 |
|
3699 |
"Modified: / 9.7.1999 / 01:18:07 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3700 |
! |
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 |
selectorCompletion:aPartialSymbolName |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3703 |
"given a partial selector, return an array consisting of |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3704 |
2 entries: 1st: the longest match |
18668 | 3705 |
2nd: collection consisting of matching implemented selectors" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3706 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3707 |
^ DoWhatIMeanSupport selectorCompletion:aPartialSymbolName inEnvironment:self |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3708 |
! |
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 |
selectorCompletion:aPartialSymbolName inEnvironment:anEnvironment |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3711 |
"given a partial selector, return an array consisting of |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3712 |
2 entries: 1st: the longest match |
18668 | 3713 |
2nd: collection consisting of matching implemented selectors" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3714 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3715 |
^ DoWhatIMeanSupport selectorCompletion:aPartialSymbolName inEnvironment:anEnvironment |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3716 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3717 |
" |
10071 | 3718 |
Smalltalk selectorCompletion:'at:p' |
3719 |
Smalltalk selectorCompletion:'nextP' |
|
3720 |
Smalltalk selectorCompletion:'nextp' |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3721 |
" |
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 |
"Modified: / 7.6.1996 / 08:44:33 / stefan" |
3565
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
3724 |
"Modified: / 14.6.1998 / 15:54:03 / cg" |
19681 | 3725 |
! |
3726 |
||
3727 |
someImplementorOf:aSelector |
|
3728 |
"return any class, which implement the given selector. Nil if there is none. |
|
3729 |
(useful to search, if there is one at all)" |
|
3730 |
||
3731 |
self allImplementorsOf:aSelector do:[:cls | ^ cls]. |
|
3732 |
^ nil. |
|
3733 |
||
3734 |
" |
|
3735 |
Smalltalk someImplementorOf:#isNil |
|
3736 |
Smalltalk someImplementorOf:#add: |
|
3737 |
" |
|
3738 |
||
3739 |
"Created: / 30-04-2016 / 17:39:19 / cg" |
|
453 | 3740 |
! ! |
3741 |
||
4431 | 3742 |
!Smalltalk class methodsFor:'queries-system'! |
3743 |
||
15958 | 3744 |
isAmber |
15980 | 3745 |
"is this an Amber Smalltalk system ? |
3746 |
Return false here - this may be useful to write portable |
|
15958 | 3747 |
applications - add #isAmber to your Amber Smalltalk, |
3748 |
returning true there." |
|
3749 |
||
3750 |
^ false |
|
3751 |
||
3752 |
"Created: / 18-12-2013 / 15:43:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3753 |
! |
|
3754 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3755 |
isDolphinSmalltalk |
16803 | 3756 |
"is this a Dolphin Smalltalk system ? |
15980 | 3757 |
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
|
3758 |
applications - add #isDolphinSmalltalk to your dolphin, |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3759 |
returning true there." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3760 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3761 |
^ false |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3762 |
! |
4970 | 3763 |
|
15958 | 3764 |
isGemStone |
15980 | 3765 |
"is this a GemStone Smalltalk system ? |
3766 |
Return false here - this may be useful to write portable |
|
15958 | 3767 |
applications - add #isGemStone to your GemStone/S, |
3768 |
returning true there." |
|
3769 |
||
3770 |
^ false |
|
3771 |
||
3772 |
"Created: / 18-12-2013 / 15:43:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3773 |
! |
|
3774 |
||
3775 |
isPharo |
|
15980 | 3776 |
"is this a Pharo Smalltalk system ? |
3777 |
Return false here - this may be useful to write portable |
|
15958 | 3778 |
applications - add #isPharo to your Pharo, |
3779 |
returning true there." |
|
3780 |
||
3781 |
^ false |
|
3782 |
||
3783 |
"Created: / 18-12-2013 / 15:42:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3784 |
! |
|
3785 |
||
7563 | 3786 |
isSmalltalkMT |
15980 | 3787 |
"is this a Smalltalk-MT system ? |
3788 |
Return false here - this may be useful to write portable |
|
7563 | 3789 |
applications - add #isSmalltalkMT to your smalltalk-MT, |
4970 | 3790 |
returning true there." |
3791 |
||
3792 |
^ false |
|
3793 |
! |
|
3794 |
||
7563 | 3795 |
isSmalltalkV |
15980 | 3796 |
"is this a Smalltalk/V system ? |
3797 |
Return false here - this may be useful to write portable |
|
7563 | 3798 |
applications - add #isSmalltalkV to your smalltalkV, |
4431 | 3799 |
returning true there." |
3800 |
||
3801 |
^ false |
|
3802 |
! |
|
3803 |
||
7563 | 3804 |
isSmalltalkX |
16803 | 3805 |
"is this a Smalltalk/X system ? |
15980 | 3806 |
Return true here - this may be useful to write portable |
22799 | 3807 |
applications. |
3808 |
Add #isSmalltalkX to your other smalltalks, returning false there. |
|
3809 |
Notice: the ST/X compilers know about this, and inline the code |
|
3810 |
(not generating code for the false branch). |
|
3811 |
So in ST/X, this check costs you absolutely nothing." |
|
4431 | 3812 |
|
3813 |
^ true |
|
3814 |
! |
|
3815 |
||
7563 | 3816 |
isSqueak |
15980 | 3817 |
"is this a SqueakSmalltalk system ? |
3818 |
Return false here - this may be useful to write portable |
|
7563 | 3819 |
applications - add #isSqueak to your squeak, |
4431 | 3820 |
returning true there." |
3821 |
||
3822 |
^ false |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3823 |
! |
4431 | 3824 |
|
16013 | 3825 |
isSqueakLike |
3826 |
"is this a Squeak, Pharo, Cuis or similar Smalltalk system ? |
|
3827 |
Return false here - this may be useful to write portable |
|
3828 |
applications - add #isSqueakLike to your squeak, pharo,... |
|
3829 |
returning true there." |
|
3830 |
||
3831 |
^ false |
|
3832 |
! |
|
3833 |
||
7563 | 3834 |
isVisualAge |
15980 | 3835 |
"is this a VisualAge Smalltalk system ? |
3836 |
Return false here - this may be useful to write portable |
|
7563 | 3837 |
applications - add #isVisualAge to your visualAge, |
4431 | 3838 |
returning true there." |
3839 |
||
3840 |
^ false |
|
3841 |
! |
|
3842 |
||
17369 | 3843 |
isVisualSmalltalkEnterprise |
16843 | 3844 |
"is this a VSE Smalltalk system ? |
3845 |
Return false here - this may be useful to write portable |
|
3846 |
applications - add #isVisualSmallalkEnterprise to your VSE, |
|
3847 |
returning true there." |
|
3848 |
||
3849 |
^ false |
|
3850 |
! |
|
3851 |
||
7563 | 3852 |
isVisualWorks |
15980 | 3853 |
"is this a VisualWorks Smalltalk system ? |
3854 |
Return false here - this may be useful to write portable |
|
7563 | 3855 |
applications - add #isVisualWorks to your visualWorks, |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3856 |
returning true there." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3857 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3858 |
^ false |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3859 |
! ! |
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 |
!Smalltalk class methodsFor:'startup'! |
1 | 3862 |
|
9032 | 3863 |
browserWindowStartup |
13056
1fa92a4cd9cc
comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
3864 |
"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
|
3865 |
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
|
3866 |
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
|
3867 |
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
|
3868 |
multiwindow application. |
1fa92a4cd9cc
comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
3869 |
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
|
3870 |
|
9032 | 3871 |
|windowIDString numericWindowID windowID params idx process| |
3872 |
||
3873 |
idx := CommandLineArguments indexOf:'--browserWindow:'. |
|
3874 |
windowIDString := CommandLineArguments at:idx+1. |
|
3875 |
numericWindowID := Integer fromString:windowIDString. |
|
3876 |
windowID := ExternalAddress newAddress:numericWindowID. |
|
3877 |
||
3878 |
idx := CommandLineArguments indexOf:'--browserParameters:'. |
|
3879 |
idx ~~ 0 ifTrue:[ |
|
18668 | 3880 |
params := Dictionary new. |
3881 |
(CommandLineArguments copyFrom:idx+1) pairWiseDo:[:key :value | |
|
3882 |
params at:key put:value. |
|
3883 |
]. |
|
9032 | 3884 |
]. |
3885 |
||
3886 |
'browserWindow is: ' errorPrint. windowID errorPrintCR. |
|
3887 |
'browserParameters are: ' errorPrint. params errorPrintCR. |
|
3888 |
'Display is: ' errorPrint. Display errorPrintCR. |
|
3889 |
||
3890 |
process := [ |
|
18668 | 3891 |
PluginSupport |
3892 |
startInBrowserWithWindowID:windowID |
|
3893 |
parameters:params. |
|
9032 | 3894 |
] newProcess. |
9043
e6106f500263
do not use numeric process prios
Claus Gittinger <cg@exept.de>
parents:
9036
diff
changeset
|
3895 |
process priority:(Processor userSchedulingPriority). |
9032 | 3896 |
process name:'browser start handler'. |
3897 |
process beGroupLeader. |
|
3898 |
process resume. |
|
3899 |
process := nil. |
|
3900 |
||
3901 |
Processor dispatchLoop. |
|
3902 |
Smalltalk exit. |
|
13056
1fa92a4cd9cc
comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
3903 |
|
1fa92a4cd9cc
comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
3904 |
"Modified: / 11-09-2010 / 14:06:59 / cg" |
9032 | 3905 |
! |
3906 |
||
20856 | 3907 |
defineCommandLineAsWorkspaceVariablesForScripts |
3908 |
"/ enable this, so we can provide _$1.._$n in the script |
|
20858 | 3909 |
ParserFlags allowUnderscoreInIdentifier:true. |
20856 | 3910 |
ParserFlags allowDollarInIdentifier:true. |
3911 |
ParserFlags warnDollarInIdentifier:false. |
|
20858 | 3912 |
ParserFlags warnUnderscoreInIdentifier:false. |
20859 | 3913 |
ParserFlags allowOldStyleAssignment:false. |
22791 | 3914 |
|
20856 | 3915 |
"/ add bindings for arguments |
3916 |
Workspace workspaceVariableAt:('_$0') put:CommandName. |
|
20857 | 3917 |
Workspace workspaceVariableAt:('_$n') put:CommandLineArguments size. |
20860 | 3918 |
Workspace workspaceVariableAt:('_$$') put:CommandLineArguments. |
20856 | 3919 |
CommandLineArguments doWithIndex:[:arg :i | |
22791 | 3920 |
Workspace workspaceVariableAt:('_$',i printString) put:arg. |
20856 | 3921 |
]. |
3922 |
! |
|
3923 |
||
7563 | 3924 |
displayInitializationDone |
3925 |
"inform the restart, that the display has been initialized" |
|
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3926 |
|
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3927 |
CallbackSignal raiseRequest. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3928 |
! |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3929 |
|
13893 | 3930 |
executeStartBlocks |
3931 |
|startBlocks| |
|
3932 |
||
3933 |
startBlocks := self startBlocks. |
|
3934 |
startBlocks notNil ifTrue:[ |
|
18668 | 3935 |
'Smalltalk [info]: execute startBlocks...' infoPrintCR. |
3936 |
startBlocks do:[:aBlock| |
|
3937 |
Error handle:[:ex | |
|
3938 |
InfoPrinting == true ifTrue:[ |
|
3939 |
'Smalltalk [warning]: error caught in startBlock: ' infoPrint. |
|
3940 |
ex description infoPrintCR. |
|
3941 |
ex infoPrintCR. |
|
3942 |
thisContext fullPrintAll. |
|
3943 |
]. |
|
3944 |
] do: aBlock |
|
3945 |
]. |
|
3946 |
startBlocks removeAll. |
|
13893 | 3947 |
]. |
3948 |
||
3949 |
"Created: / 07-01-2012 / 12:58:39 / cg" |
|
3950 |
! |
|
3951 |
||
11375 | 3952 |
hideSplashWindow |
3953 |
%{ |
|
3954 |
#ifdef WIN32 |
|
3955 |
extern void __win32_hideSplashScreen(); |
|
3956 |
||
3957 |
__win32_hideSplashScreen(); |
|
3958 |
#endif |
|
3959 |
%} |
|
3960 |
! |
|
3961 |
||
20720 | 3962 |
lateOpenDisplay |
20737 | 3963 |
"this is called when a view is opened without a display being already opened." |
22791 | 3964 |
|
22636 | 3965 |
|display| |
3966 |
||
3967 |
display := Smalltalk openDisplay. |
|
22791 | 3968 |
display notNil ifTrue:[ |
3969 |
IsRepl ifFalse:[ |
|
3970 |
display exitOnLastClose:true. |
|
3971 |
]. |
|
3972 |
"/ Processor exitWhenNoMoreUserProcesses:true. |
|
22636 | 3973 |
]. |
3974 |
^ display |
|
3975 |
||
3976 |
"Modified: / 20-03-2018 / 12:43:29 / stefan" |
|
20720 | 3977 |
! |
3978 |
||
7563 | 3979 |
mainStartup:graphicalMode |
3980 |
"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
|
3981 |
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
|
3982 |
|
9012 | 3983 |
|process imageName thisIsARestart idx| |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3984 |
|
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3985 |
imageName := ObjectMemory imageName. |
2249
cdb6c87f0707
send returnFromSnapshot notification later -
Claus Gittinger <cg@exept.de>
parents:
2212
diff
changeset
|
3986 |
thisIsARestart := imageName notNil. |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3987 |
|
19788 | 3988 |
true "graphicalMode" ifTrue:[ |
22791 | 3989 |
Display isNil ifTrue:[ |
3990 |
(StartupClass notNil |
|
3991 |
and:[ (StartupClass perform:#isHeadless ifNotUnderstood:false) ]) ifFalse:[ |
|
3992 |
self openDisplay. |
|
3993 |
]. |
|
3994 |
]. |
|
10644 | 3995 |
]. |
3996 |
||
10645 | 3997 |
StandAlone ifFalse:[ |
22791 | 3998 |
" |
3999 |
enable the graphical debugger/inspector |
|
4000 |
(they could have been (re)defined as autoloaded in the patches file) |
|
4001 |
" |
|
4002 |
self initStandardTools. |
|
10645 | 4003 |
]. |
4004 |
||
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
4005 |
" |
10071 | 4006 |
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
|
4007 |
" |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
4008 |
Display notNil ifTrue:[ |
22791 | 4009 |
Display deviceIOTimeoutErrorSignal handlerBlock:[:ex | |
4010 |
SaveEmergencyImage == true ifTrue:[ |
|
4011 |
'Display [warning]: broken display connection - emergency save in ''crash.img''.' infoPrintCR. |
|
4012 |
ObjectMemory primSnapShotOn:'crash.img'. |
|
4013 |
]. |
|
4014 |
'Display [warning]: broken display connection - exit.' infoPrintCR. |
|
4015 |
self exit:11. |
|
4016 |
]. |
|
4017 |
Display startDispatch. |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
4018 |
]. |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
4019 |
|
9016 | 4020 |
idx := CommandLineArguments indexOf:'--browserWindow:'. |
9029 | 4021 |
IsPlugin := (idx ~~ 0). |
4022 |
IsPlugin ifTrue:[ |
|
22791 | 4023 |
'Smalltalk [info]: startup browser window...' infoPrintCR. |
4024 |
self browserWindowStartup. |
|
4025 |
"/ not reached |
|
9012 | 4026 |
]. |
4027 |
||
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
4028 |
Initializing := false. |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
4029 |
|
2074
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
4030 |
"/ 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
|
4031 |
"/ 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
|
4032 |
"/ 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
|
4033 |
"/ 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
|
4034 |
|
7043
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
4035 |
process := [ |
22791 | 4036 |
'Smalltalk [info]: startup process 1 active.' infoPrintCR. |
4037 |
StartBlocks notNil ifTrue:[ |
|
4038 |
self executeStartBlocks. |
|
4039 |
StartBlocks := nil. |
|
4040 |
]. |
|
4041 |
ImageStartBlocks notNil ifTrue:[ |
|
4042 |
'Smalltalk [info]: execute imageStartBlocks...' infoPrintCR. |
|
4043 |
ImageStartBlocks do:[:aBlock| |
|
4044 |
aBlock value |
|
4045 |
]. |
|
4046 |
]. |
|
4047 |
StandAlone ifFalse:[ |
|
4048 |
(SilentLoading == true) ifFalse:[ "i.e. undefined counts as false" |
|
4049 |
thisIsARestart ifTrue:[ |
|
4050 |
Transcript cr. |
|
4051 |
Transcript showCR:('Smalltalk restarted from:' |
|
4052 |
, imageName |
|
4053 |
, ' (saved ' |
|
4054 |
, ObjectMemory imageSaveTime printString |
|
4055 |
, ')' ). |
|
4056 |
] ifFalse:[ |
|
4057 |
Transcript showCR:(self hello). |
|
4058 |
Transcript showCR:(self copyrightString). |
|
4059 |
]. |
|
4060 |
Transcript cr. |
|
4061 |
]. |
|
4062 |
||
4063 |
DemoMode==true ifTrue:[ |
|
4064 |
Transcript showCR:'*** Restricted use: ***'. |
|
4065 |
Transcript showCR:'*** This program may be used for education only. ***'. |
|
4066 |
Transcript showCR:'*** Please read the files COPYRIGHT and LICENSE ***'. |
|
4067 |
Transcript showCR:'*** for more details. ***'. |
|
4068 |
Transcript cr. |
|
4069 |
]. |
|
4070 |
]. |
|
4071 |
||
4072 |
thisIsARestart ifTrue:[ |
|
4073 |
"/ |
|
4074 |
"/ the final late notification - users can now assume that |
|
4075 |
"/ views, forms etc. have been recreated. |
|
4076 |
||
4077 |
ObjectMemory changed:#returnFromSnapshot. |
|
4078 |
] |
|
7039
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
4079 |
|
7040 | 4080 |
] newProcess. |
4081 |
||
9043
e6106f500263
do not use numeric process prios
Claus Gittinger <cg@exept.de>
parents:
9036
diff
changeset
|
4082 |
process priority:(Processor userSchedulingPriority). |
7043
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
4083 |
process name:'start block handler'. |
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
4084 |
process beGroupLeader. |
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
4085 |
process resume. |
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
4086 |
process := nil. |
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
4087 |
|
10139
a3f6265978ad
Start bachgroundCollector and -Finalizer in mainStartup
Stefan Vogel <sv@exept.de>
parents:
10131
diff
changeset
|
4088 |
ObjectMemory startBackgroundCollectorAt:5. |
a3f6265978ad
Start bachgroundCollector and -Finalizer in mainStartup
Stefan Vogel <sv@exept.de>
parents:
10131
diff
changeset
|
4089 |
ObjectMemory startBackgroundFinalizationAt:5. |
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
4090 |
|
2074
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
4091 |
"/ 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
|
4092 |
"/ message. |
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
4093 |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
4094 |
(StartupClass notNil and:[StartupSelector notNil]) ifTrue:[ |
22791 | 4095 |
" |
4096 |
allow more customization by reading an image specific rc-file |
|
4097 |
" |
|
4098 |
thisIsARestart ifTrue:[ |
|
4099 |
(imageName asFilename hasSuffix:'img') ifTrue:[ |
|
4100 |
imageName := imageName copyButLast:4 |
|
4101 |
]. |
|
4102 |
self fileIn:(imageName , '.rc') |
|
4103 |
]. |
|
4104 |
||
4105 |
Display notNil ifTrue:[ |
|
4106 |
Display exitOnLastClose:true. |
|
4107 |
]. |
|
4108 |
Processor exitWhenNoMoreUserProcesses:true. |
|
4109 |
||
4110 |
process := [ |
|
4111 |
'Smalltalk [info]: startup process 2 active.' infoPrintCR. |
|
4112 |
StandAlone ifTrue:[ |
|
4113 |
AbortOperationRequest handle:[:ex | |
|
4114 |
'Smalltalk [info]: aborted - exit.' infoPrintCR. |
|
4115 |
OperatingSystem exit:1 |
|
4116 |
] do:[ |
|
4117 |
('Smalltalk [info]: call ',StartupSelector,' of ',StartupClass name,' (1)') infoPrintCR. |
|
4118 |
StartupClass perform:StartupSelector withArguments:StartupArguments. |
|
4119 |
] |
|
4120 |
] ifFalse:[ |
|
4121 |
('Smalltalk [info]: call ',StartupSelector,' of ',StartupClass name,' (2)') infoPrintCR. |
|
4122 |
StartupClass perform:StartupSelector withArguments:StartupArguments. |
|
4123 |
]. |
|
4124 |
||
4125 |
"/ |
|
4126 |
"/ non-GUI apps exit after the startup; |
|
4127 |
"/ assume that GUI apps have created & opened some view ... |
|
4128 |
"/ |
|
4129 |
Display isNil ifTrue:[ |
|
4130 |
'Smalltalk [info]: no Display - exit.' infoPrintCR. |
|
4131 |
Smalltalk exit:11. |
|
4132 |
]. |
|
16666 | 4133 |
"/ "/ |
4134 |
"/ "/ GUI apps exit after the last user process has finished |
|
4135 |
"/ "/ |
|
4136 |
"/ Display exitOnLastClose:true. |
|
22791 | 4137 |
Processor exitWhenNoMoreUserProcesses:true. |
4138 |
] newProcess. |
|
4139 |
process priority:(Processor userSchedulingPriority). |
|
4140 |
process name:'main'. |
|
4141 |
process beGroupLeader. |
|
4142 |
process resume. |
|
4143 |
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
|
4144 |
]. |
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 |
StandAlone ifTrue:[ |
22791 | 4147 |
Display notNil ifTrue:[ |
4148 |
FlyByHelp notNil ifTrue:[ |
|
4149 |
FlyByHelp start |
|
4150 |
]. |
|
4151 |
]. |
|
16211 | 4152 |
]. |
4153 |
||
20746 | 4154 |
"/ Display notNil ifTrue:[ |
4155 |
"/ Display exitOnLastClose:true. |
|
4156 |
"/ ]. |
|
21592 | 4157 |
OperatingSystem finishLaunching. |
22791 | 4158 |
|
11681
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4159 |
" |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4160 |
if view-classes exist, start dispatching; |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4161 |
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
|
4162 |
" |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4163 |
((Display notNil and:[graphicalMode]) |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4164 |
or:[process notNil |
13851
5ab434e0a636
changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents:
13850
diff
changeset
|
4165 |
or:[HeadlessOperation |
20827 | 4166 |
or:[StandAlone]]] |
4167 |
) ifTrue:[ |
|
22791 | 4168 |
Processor exitWhenNoMoreUserProcesses:true. |
4169 |
Processor dispatchLoop. |
|
4170 |
"done - the last process finished" |
|
4171 |
'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
|
4172 |
] ifFalse:[ |
22791 | 4173 |
StandAlone ifFalse:[ |
4174 |
self readEvalPrintLoop |
|
4175 |
] |
|
11681
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4176 |
]. |
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 |
self exit |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4179 |
|
13526 | 4180 |
"Created: / 18-07-1996 / 21:07:39 / cg" |
4181 |
"Modified: / 09-09-1996 / 17:42:50 / stefan" |
|
21592 | 4182 |
"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
|
4183 |
! |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
4184 |
|
10641 | 4185 |
openDisplay |
4186 |
"try to open a display connection. |
|
4187 |
If so, also read display- and keyboard.rc" |
|
4188 |
||
13385 | 4189 |
|commandName| |
4190 |
||
4191 |
commandName := Smalltalk commandName. |
|
4192 |
(commandName, ' [info]: opening display...') infoPrintCR. |
|
10649 | 4193 |
|
10641 | 4194 |
Display isNil ifTrue:[ |
22791 | 4195 |
Screen notNil ifTrue:[ |
4196 |
[ |
|
4197 |
Screen openDefaultDisplay:nil. |
|
4198 |
] on:Screen deviceOpenErrorSignal do:[:ex| |
|
4199 |
"do not use #errorPrintCR, it is no error, when an app supports display and no display. |
|
4200 |
in case shell exec 'app --version' we do not want this error string as part of the output" |
|
4201 |
('%1 [error]: No display connection to: %2' bindWith:commandName with:ex parameter) infoPrintCR. |
|
19984 | 4202 |
"/ ('%1 [error]: No display connection to: %2' bindWith:commandName with:ex parameter) errorPrintCR. |
22791 | 4203 |
(commandName, ' [info]: Either set the DISPLAY environment variable,') infoPrintCR. |
4204 |
(commandName, ' [info]: or start smalltalk with a -display argument.') infoPrintCR. |
|
4205 |
HeadlessOperation == true ifFalse:[ |
|
4206 |
OperatingSystem exit:1. |
|
4207 |
]. |
|
4208 |
]. |
|
4209 |
||
4210 |
Display notNil ifTrue:[ |
|
4211 |
(self secureFileIn:'display.rc') ifFalse:[ |
|
4212 |
"/ 'Smalltalk [warning]: no display.rc found; screen setting might be wrong.' errorPrintCR. |
|
4213 |
(self secureFileIn:'keyboard.rc') ifFalse:[ |
|
4214 |
"/ 'Smalltalk [warning]: no keyboard.rc found; shortkey setting might be wrong.' errorPrintCR. |
|
4215 |
] |
|
4216 |
] |
|
4217 |
]. |
|
4218 |
] |
|
22636 | 4219 |
]. |
4220 |
||
4221 |
^ Display |
|
10641 | 4222 |
|
4223 |
"Created: / 06-12-2006 / 15:38:17 / cg" |
|
22636 | 4224 |
"Modified: / 20-03-2018 / 12:39:55 / stefan" |
10641 | 4225 |
! |
4226 |
||
20757 | 4227 |
providingDisplayDo:aBlock |
4228 |
"/ provide a Display, if needed |
|
4229 |
(Smalltalk at:#Screen) currentScreenQuerySignal handle:[:ex | |
|
22791 | 4230 |
Display isNil ifTrue:[ self lateOpenDisplay ]. |
4231 |
ex proceedWith:Display. |
|
4232 |
] do:aBlock |
|
20757 | 4233 |
! |
4234 |
||
20832 | 4235 |
readEvalPrintLoop |
4236 |
"say hello, then go into a read-eval-print loop" |
|
22791 | 4237 |
|
10641 | 4238 |
"{ Pragma: +optSpace }" |
4239 |
||
22791 | 4240 |
|repl| |
4241 |
||
4242 |
repl := ReadEvalPrintLoop new. |
|
4243 |
||
4244 |
SilentLoading == true ifTrue:[ |
|
22792 | 4245 |
repl answerPrompt:''. |
4246 |
repl prompt:''. |
|
22791 | 4247 |
] ifFalse:[ |
22792 | 4248 |
Transcript showCR:(self hello). |
4249 |
Transcript showCR:(self copyrightString). |
|
4250 |
Transcript cr. |
|
22793 | 4251 |
Transcript showCR:'Read-eval-print loop.'. |
4252 |
Transcript showCR:'(exit with "#exit" or EOF; help with "?"; expressions are terminated with ".")'. |
|
22792 | 4253 |
repl prompt:'STX> '. |
22791 | 4254 |
]. |
4255 |
||
4256 |
repl |
|
22792 | 4257 |
doChunkFormat:false; |
22831 | 4258 |
errorStream:Stderr; |
22792 | 4259 |
readEvalPrintLoop |
10641 | 4260 |
! |
4261 |
||
4262 |
restart |
|
4263 |
"startup after an image has been loaded; |
|
18385 | 4264 |
This is called by the VM's main entry - you should not find senders from Smalltalk. |
4265 |
||
10641 | 4266 |
there are three change-notifications made to dependents of ObjectMemory, |
4267 |
which allow a stepwise re-init: #earlyRestart, #restarted and #returnFromSnapshot. |
|
4268 |
||
4269 |
#earlySystemInstallation is sent for ST80 compatibility |
|
4270 |
||
4271 |
#earlyRestart is send first, nothing has been setup yet. |
|
18668 | 4272 |
(should be used to flush all device dependent entries) |
10641 | 4273 |
|
4274 |
#restarted is send right after. |
|
18668 | 4275 |
(should be used to recreate external resources (fds, bitmaps etc) |
10641 | 4276 |
|
4277 |
#returnFromSnapshot is sent last |
|
18668 | 4278 |
(should be used to restart processes, reOpen Streams which cannot |
4279 |
be automatically be reopened (i.e. Sockets, Pipes) and so on. |
|
4280 |
(Notice that positionable fileStreams are already reopened and repositioned) |
|
10641 | 4281 |
" |
4282 |
||
4283 |
|deb insp transcript idx| |
|
4284 |
||
4285 |
"/ |
|
4286 |
"/ when we arrive here, all objects from our previous life |
|
4287 |
"/ have been reloaded - however, some may still contain invalid device |
|
4288 |
"/ handles, display information etc. |
|
4289 |
"/ also, dynamically loaded modules have not yet been reloaded yet. |
|
4290 |
"/ and the concrete OS, concrete FileName etc. are still refering to |
|
4291 |
"/ the previous classes. |
|
4292 |
||
4293 |
Initializing := true. |
|
4294 |
AbstractOperatingSystem initializeConcreteClass. |
|
4295 |
||
4296 |
ImageRestartTime := Timestamp now. |
|
4297 |
||
4298 |
CommandLine := CommandLineArguments copy. |
|
4299 |
CommandLineArguments := CommandLineArguments asOrderedCollection. |
|
4300 |
CommandName := CommandLineArguments removeFirst. "/ the command |
|
4301 |
||
4302 |
idx := CommandLineArguments indexOf:'-q'. |
|
4303 |
idx == 0 ifTrue:[ |
|
18668 | 4304 |
idx := CommandLineArguments indexOf:'--silent'. |
10641 | 4305 |
]. |
4306 |
idx ~~ 0 ifTrue:[ |
|
18668 | 4307 |
Object infoPrinting:false. |
4308 |
ObjectMemory infoPrinting:false. |
|
4309 |
CommandLineArguments removeAtIndex:idx. |
|
16269 | 4310 |
]. |
4311 |
||
10641 | 4312 |
"/ start catching SIGSEGV and SIGBUS |
4313 |
OperatingSystem enableHardSignalInterrupts. |
|
4314 |
||
4315 |
"/ reinit Filename |
|
4316 |
Filename reinitialize. |
|
4317 |
||
4318 |
"/ flush cached path directories (may have changed in the meanwhile) |
|
4319 |
self flushPathCaches. |
|
15334 | 4320 |
self reinitializePackagePath. |
10641 | 4321 |
|
4322 |
"/ reinit the default streams: Stdin, Stdout and Stderr |
|
4323 |
"/ after that, we can write to stderr. |
|
4324 |
self reinitStandardStreams. |
|
4325 |
||
4326 |
"/ redirect Transcript to Stderr during startup |
|
4327 |
transcript := Transcript. |
|
4328 |
Transcript := Stderr. |
|
4329 |
||
4330 |
"/ temporary switch back to dumb interface - |
|
4331 |
"/ to handle errors while view-stuff is not yet reinitialized |
|
4332 |
insp := Inspector. |
|
4333 |
deb := Debugger. |
|
4334 |
deb notNil ifTrue:[ |
|
18668 | 4335 |
deb reinitialize |
10641 | 4336 |
]. |
4337 |
Inspector := MiniInspector. |
|
4338 |
Debugger := MiniDebugger. |
|
4339 |
||
4340 |
"/ reload any dynamically loaded objects. |
|
4341 |
"/ this must be done before doing anything else below, |
|
4342 |
"/ because the Processor may restart processes which use |
|
4343 |
"/ this code. |
|
4344 |
"/ Also, a dynamic object might be registered as dependent of |
|
4345 |
"/ ObjectFileLoader; therefore, must reload before doing any notifications. |
|
4346 |
||
4347 |
ObjectFileLoader notNil ifTrue:[ |
|
18668 | 4348 |
ObjectFileLoader reloadAllRememberedObjectFiles. |
16269 | 4349 |
]. |
4350 |
||
10641 | 4351 |
"/ invalidate all display connections. |
4352 |
"/ This is required to avoid trouble if someone accesses |
|
4353 |
"/ a display during early startup. |
|
4354 |
Screen notNil ifTrue:[ |
|
18668 | 4355 |
Screen allScreens do:[:eachDisplay | |
4356 |
eachDisplay invalidateConnection. |
|
4357 |
]. |
|
10641 | 4358 |
]. |
4359 |
||
4360 |
ObjectMemory changed:#earlySystemInstallation. |
|
4361 |
||
4362 |
"/ reinitialize the Processor - restartable processes |
|
4363 |
"/ are now restarted here (but not yet scheduled). |
|
4364 |
Processor reinitialize. |
|
4365 |
||
4366 |
"/ flush device handles & recreate OS resources (if possible) |
|
4367 |
"/ (mostly view/GC/color & font stuff) |
|
4368 |
ObjectMemory |
|
18668 | 4369 |
changed:#earlyRestart; changed:#restarted. |
16269 | 4370 |
|
10641 | 4371 |
"/ start catching SIGINT and SIGQUIT |
4372 |
OperatingSystem enableUserInterrupts. |
|
4373 |
OperatingSystem enableCrashSignalInterrupts. |
|
12782 | 4374 |
ObjectMemory restoreGarbageCollectorSettings. |
10641 | 4375 |
|
4376 |
"/ give user a chance to re-customize things in smalltalk_r.rc. |
|
4377 |
"/ reading if smalltalk_r.rc may be suppressed by the --faststart argument. |
|
4378 |
idx := CommandLineArguments indexOf:'--faststart'. |
|
4379 |
idx == 0 ifTrue:[ |
|
18668 | 4380 |
idx := CommandLineArguments indexOf:'--fastStart'. |
10641 | 4381 |
]. |
4382 |
idx ~~ 0 ifTrue:[ |
|
18668 | 4383 |
CommandLineArguments removeAtIndex:idx. |
10641 | 4384 |
] ifFalse:[ |
18668 | 4385 |
CallbackSignal := QuerySignal new. |
4386 |
[ |
|
4387 |
Class withoutUpdatingChangesDo:[ |
|
4388 |
(self fileIn:(self commandName , '_r.rc')) ifFalse:[ |
|
4389 |
"no _r.rc file where executable is; try default smalltalk_r.rc" |
|
4390 |
self fileIn:'smalltalk_r.rc' |
|
4391 |
]. |
|
4392 |
] |
|
4393 |
] on:CallbackSignal do:[:ex| |
|
4394 |
"/ now, display and view-stuff works; |
|
4395 |
"/ back to the previous debugging interface |
|
4396 |
Inspector := insp. |
|
4397 |
Debugger := deb. |
|
4398 |
||
4399 |
"/ reinstall Transcript, if not changed during restart. |
|
4400 |
"/ if there was no Transcript, go to stderr |
|
4401 |
(transcript notNil and:[Transcript == Stderr]) ifTrue:[ |
|
4402 |
Transcript := transcript. |
|
4403 |
]. |
|
4404 |
Initializing := false. |
|
4405 |
ex proceed. |
|
4406 |
]. |
|
4407 |
CallbackSignal := nil. |
|
10641 | 4408 |
]. |
4409 |
||
4410 |
"/ reinitialization (restart) of Display is normally performed |
|
4411 |
"/ in the restart script. If this has not been run for some reason, |
|
4412 |
"/ do in now. |
|
4413 |
Initializing ifTrue:[ |
|
18668 | 4414 |
Display notNil ifTrue:[ |
4415 |
[ |
|
4416 |
Display reinitializeFor:Screen defaultDisplayName. |
|
4417 |
] on:Screen deviceOpenErrorSignal do:[ |
|
4418 |
'Smalltalk [error]: Cannot restart connection to: ' errorPrint. |
|
4419 |
Screen defaultDisplayName errorPrintCR. |
|
4420 |
OperatingSystem exit:1. |
|
4421 |
]. |
|
4422 |
]. |
|
4423 |
"/ now, display and view-stuff works; |
|
4424 |
"/ back to the previous debugging interface |
|
4425 |
||
4426 |
Inspector := insp. |
|
4427 |
Debugger := deb. |
|
4428 |
||
4429 |
"/ reinstall Transcript, if not changed during restart. |
|
4430 |
"/ if there was no Transcript, go to stderr |
|
4431 |
||
4432 |
(transcript notNil and:[Transcript == Stderr]) ifTrue:[ |
|
4433 |
Transcript := transcript. |
|
4434 |
]. |
|
4435 |
Initializing := false. |
|
10641 | 4436 |
]. |
4437 |
Screen notNil ifTrue:[ |
|
18668 | 4438 |
"clean up leftover screens (and views) that haven't been reopened. |
4439 |
Operate on a copy, since brokenConnection removes us from AllScreens" |
|
4440 |
Screen allScreens copy do:[:eachDisplay | |
|
4441 |
eachDisplay isOpen ifFalse:[ |
|
4442 |
'Smalltalk [info]: cannot reopen secondary display: ' errorPrint. |
|
4443 |
eachDisplay errorPrintCR. |
|
4444 |
eachDisplay cleanupAfterDispatch; brokenConnection. |
|
4445 |
] |
|
4446 |
]. |
|
10641 | 4447 |
]. |
4448 |
||
4449 |
deb := insp := transcript := nil. "avoid dangling refs" |
|
13526 | 4450 |
(StartupClass perform:#keepSplashWindowOpen ifNotUnderstood:[false]) ifFalse:[ |
18668 | 4451 |
self hideSplashWindow. "/ if there is one, it's now time to hide it |
13526 | 4452 |
]. |
10641 | 4453 |
self mainStartup:true |
4454 |
||
13526 | 4455 |
"Modified: / 03-08-1999 / 09:42:21 / stefan" |
4456 |
"Modified: / 29-07-2011 / 17:58:23 / cg" |
|
1 | 4457 |
! |
4458 |
||
11399 | 4459 |
showSplashMessage:aString |
4460 |
"put the message into the splash screen (if there is one). |
|
4461 |
Use this for messages during startup" |
|
4462 |
||
4463 |
self showSplashMessage:aString color:nil. |
|
4464 |
! |
|
4465 |
||
11388 | 4466 |
showSplashMessage:aMessageStringOrNil color:rgbValueOrNil |
11389 | 4467 |
"put the message into the splash screen (if there is one)." |
4468 |
||
11388 | 4469 |
%{ |
4470 |
#ifdef WIN32 |
|
4471 |
extern void __win32_splashMessage(); |
|
4472 |
char *msg = (char *)0; |
|
4473 |
int clr = 0; |
|
4474 |
||
12481
805176d238d2
change __isString() to __isStringLike() in primitive code
Stefan Vogel <sv@exept.de>
parents:
12413
diff
changeset
|
4475 |
if (__isStringLike(aMessageStringOrNil)) { |
18668 | 4476 |
msg = __stringVal(aMessageStringOrNil); |
11388 | 4477 |
} |
4478 |
if (__isSmallInteger(rgbValueOrNil)) { |
|
18668 | 4479 |
clr = __intVal(rgbValueOrNil); |
4480 |
__win32_splashMessageColor(clr); |
|
11388 | 4481 |
} |
4482 |
__win32_splashMessage(msg); |
|
4483 |
#endif |
|
4484 |
%} |
|
4485 |
! |
|
4486 |
||
4487 |
splashInfo:aString |
|
11389 | 4488 |
"like infoPrintCR, |
4489 |
but in addition put the message into the splash screen (if there is one). |
|
4490 |
Use this for info messages during startup" |
|
4491 |
||
12883 | 4492 |
aString notNil ifTrue:[ aString infoPrintCR ]. |
11388 | 4493 |
self showSplashMessage:aString color:nil. |
4494 |
! |
|
4495 |
||
7563 | 4496 |
start |
20831 | 4497 |
"low level entry from the VM's main. |
4498 |
After initializeSystem, this is the very first real entry into the Smalltalk world. |
|
22791 | 4499 |
Analyzes the command line and checks what to do |
20831 | 4500 |
(i.e. script/repl/eval or full blown IDE). |
4501 |
Also handles --load and various debug options. |
|
22791 | 4502 |
Caveat: |
4503 |
this has become too complicated and desperately needs a rewrite. |
|
21020 | 4504 |
|
4505 |
Also: |
|
22791 | 4506 |
Be very careful when changing things here; |
4507 |
especially be careful to ensure that the scripting options are robust against any |
|
4508 |
missing packages; so the error handlers should not depend on any stream, logger etc. features. |
|
21020 | 4509 |
" |
617 | 4510 |
|
15872 | 4511 |
|idx graphicalMode arg didReadRCFile keepSplashWindow| |
960
e3b75f50d0cd
changes for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
4512 |
|
19597 | 4513 |
graphicalMode := Smalltalk isSmalltalkDevelopmentSystem. |
617 | 4514 |
Initializing := true. |
4515 |
||
15872 | 4516 |
keepSplashWindow := StartupClass perform:#keepSplashWindowOpen ifNotUnderstood:[false]. |
13526 | 4517 |
|
21016 | 4518 |
idx := CommandLineArguments indexOf:'--debug'. |
4519 |
(idx ~~ 0) ifTrue:[ |
|
22791 | 4520 |
CommandLineArguments removeAtIndex:idx. |
4521 |
]. |
|
21016 | 4522 |
|
617 | 4523 |
" |
4524 |
while reading patches- and rc-file, do not add things into change-file |
|
4525 |
" |
|
4526 |
Class withoutUpdatingChangesDo:[ |
|
22791 | 4527 |
|commandFiles rcFile defaultRC prevCatchSetting |
4528 |
isEval isPrint isFilter isRepl isRunMain idxFileArg process| |
|
4529 |
||
4530 |
isEval := isPrint := isFilter := isRepl := isRunMain := false. |
|
4531 |
didReadRCFile := false. |
|
4532 |
||
4533 |
StandAlone ifFalse:[ |
|
4534 |
"/ self initializeVerboseFlags. |
|
4535 |
||
4536 |
"/ |
|
4537 |
"/ look for any '-q', '-e', '-l' or '-f' command line arguments |
|
4538 |
"/ and handle them; |
|
4539 |
"/ read startup and patches file |
|
4540 |
"/ |
|
4541 |
idx := CommandLineArguments indexOfAny:#('-R' '--repl'). |
|
4542 |
isRepl := IsRepl := (idx ~~ 0). |
|
4543 |
||
4544 |
idx := CommandLineArguments indexOfAny:#('-q' '--silent'). |
|
4545 |
idx ~~ 0 ifTrue:[ |
|
4546 |
Object infoPrinting:false. |
|
4547 |
ObjectMemory infoPrinting:false. |
|
4548 |
CommandLineArguments removeAtIndex:idx. |
|
4549 |
SilentLoading := true. |
|
4550 |
]. |
|
4551 |
||
4552 |
[ |
|
4553 |
idx := CommandLineArguments indexOfAny:#('-pp' '--packagePath'). |
|
4554 |
idx ~~ 0 |
|
4555 |
] whileTrue:[ |
|
4556 |
arg := CommandLineArguments at:idx + 1. |
|
4557 |
CommandLineArguments removeAtIndex:idx+1; removeAtIndex:idx. |
|
4558 |
(arg asCollectionOfSubstringsSeparatedByAny:',;') do:[:each | |
|
4559 |
self packagePath addLast:each. |
|
4560 |
VerboseStartup ifTrue:[ |
|
4561 |
('Smalltalk [info]: add to packagePath: "', arg, '".') infoPrintCR. |
|
4562 |
]. |
|
4563 |
]. |
|
4564 |
]. |
|
4565 |
||
4566 |
[ |
|
4567 |
idx := CommandLineArguments indexOfAny:#('-l' '--load'). |
|
4568 |
idx ~~ 0 |
|
4569 |
] whileTrue:[ |
|
4570 |
arg := CommandLineArguments at:idx + 1. |
|
4571 |
CommandLineArguments removeAtIndex:idx+1; removeAtIndex:idx. |
|
4572 |
Smalltalk silentlyLoadingDo:[ |
|
4573 |
(arg asCollectionOfSubstringsSeparatedByAny:',;') do:[:each | |
|
4574 |
each asFilename exists ifTrue:[ |
|
4575 |
(VerboseStartup | VerboseLoading) ifTrue:[ |
|
4576 |
('Smalltalk [info]: loading file: "', each, '".') infoPrintCR. |
|
4577 |
]. |
|
4578 |
Smalltalk fileIn:each |
|
4579 |
] ifFalse:[ |
|
4580 |
(VerboseStartup | VerboseLoading) ifTrue:[ |
|
4581 |
('Smalltalk [info]: loading package: "', each, '".') infoPrintCR. |
|
4582 |
]. |
|
4583 |
Smalltalk loadPackage:each |
|
4584 |
]. |
|
4585 |
]. |
|
4586 |
]. |
|
4587 |
]. |
|
4588 |
||
4589 |
"/ look for a '-e filename' or '--execute filename' or '--script filename' argument |
|
4590 |
"/ this will force fileIn of filename only, no standard startup. |
|
4591 |
||
4592 |
idx := CommandLineArguments indexOfAny:#('-e' '--execute' '--script'). |
|
4593 |
idx ~~ 0 ifTrue:[ |
|
4594 |
SilentLoading := true. |
|
4595 |
CommandName := arg := CommandLineArguments at:idx + 1. |
|
4596 |
||
4597 |
CommandLineArguments |
|
4598 |
removeAtIndex:idx+1; removeAtIndex:idx. |
|
4599 |
||
4600 |
self startSchedulerAndBackgroundCollector. |
|
4601 |
keepSplashWindow ifFalse:[ self hideSplashWindow ]. |
|
4602 |
Initializing := false. |
|
4603 |
||
4604 |
process := [ |
|
4605 |
Processor exitWhenNoMoreUserProcesses:true. |
|
4606 |
||
4607 |
"/ set workspace variables |
|
4608 |
self defineCommandLineAsWorkspaceVariablesForScripts. |
|
4609 |
||
4610 |
"/ provide a Display, if needed |
|
4611 |
self providingDisplayDo:[ |
|
4612 |
VerboseStartup ifTrue:[ |
|
4613 |
('Smalltalk [info]: reading script from: "', arg, '".') infoPrintCR. |
|
4614 |
]. |
|
4615 |
NoHandlerError handle:[:ex | |
|
4616 |
Debugging == true ifTrue:[ |
|
4617 |
MiniDebugger enterException:ex. |
|
4618 |
] ifFalse:[ |
|
4619 |
Silent ifFalse:[ |
|
4620 |
'Smalltalk [error]: ' _errorPrint. ex exception description _errorPrintCR. |
|
4621 |
]. |
|
4622 |
(VerboseStartup or:[ObjectMemory debugPrinting]) ifTrue:[ |
|
4623 |
ex suspendedContext fullPrintAll. |
|
4624 |
]. |
|
4625 |
self exit:1. |
|
4626 |
]. |
|
4627 |
self exit:1. |
|
4628 |
"/ ex reject. |
|
4629 |
] do:[ |
|
4630 |
UserInterrupt handle:[:ex | |
|
4631 |
Debugging == true ifTrue:[ |
|
4632 |
'user interrupt (type "c" to continue; "x" to exit; "?" for help).' errorPrintCR. |
|
4633 |
"/ thisContext fullPrintAll. |
|
4634 |
MiniDebugger enterException:ex. |
|
4635 |
ex proceed. |
|
4636 |
]. |
|
4637 |
Silent ifFalse:[ 'user interrupt.' errorPrintCR ]. |
|
4638 |
self exit:128+(OperatingSystem sigINT). |
|
4639 |
] do:[ |
|
4640 |
|cmdStream result| |
|
4641 |
||
4642 |
arg = '-' ifTrue:[ |
|
4643 |
cmdStream := Stdin. |
|
4644 |
] ifFalse:[ |
|
4645 |
IsSTScript := true. |
|
4646 |
cmdStream := arg asFilename readStream. |
|
4647 |
]. |
|
4648 |
result := [ |
|
4649 |
self fileInStream:cmdStream |
|
4650 |
lazy:nil |
|
4651 |
silent:self verbose not |
|
4652 |
logged:false |
|
4653 |
addPath:nil |
|
4654 |
] ensure:[ |
|
4655 |
IsSTScript ifTrue:[ |
|
4656 |
"/ do not close Stdin |
|
4657 |
cmdStream close. |
|
4658 |
]. |
|
4659 |
]. |
|
4660 |
result ifFalse:[ |
|
4661 |
self exit:1. |
|
4662 |
]. |
|
4663 |
]. |
|
4664 |
]. |
|
4665 |
]. |
|
4666 |
||
4667 |
"/ after the script, if Screen has been opened and there are any open windows, |
|
4668 |
"/ then do not exit |
|
20758 | 4669 |
false ifTrue:[ |
22791 | 4670 |
Display notNil ifTrue:[ |
4671 |
Processor exitWhenNoMoreUserProcesses:true. |
|
4672 |
"/ Display exitOnLastClose:true. |
|
4673 |
"/ Display checkForEndOfDispatch. |
|
4674 |
] ifFalse:[ |
|
4675 |
self exit. |
|
4676 |
]. |
|
20758 | 4677 |
]. |
22791 | 4678 |
] newProcess. |
4679 |
process priority:(Processor userSchedulingPriority). |
|
4680 |
process name:'main'. |
|
4681 |
process beGroupLeader. |
|
4682 |
process resume. |
|
4683 |
||
4684 |
Processor dispatchLoop. |
|
4685 |
self exit |
|
4686 |
]. |
|
4687 |
||
4688 |
"look for a '-f filename' or '--file filename' argument |
|
4689 |
if scripting, these are loaded before -P, -E or -R action. |
|
4690 |
if not scripting, this will force evaluation of filename instead of smalltalk.rc" |
|
4691 |
[ |
|
4692 |
idxFileArg := CommandLineArguments indexOfAny:#('-f' '--file'). |
|
4693 |
(idxFileArg ~~ 0) |
|
4694 |
] whileTrue:[ |
|
4695 |
commandFiles isNil ifTrue:[ commandFiles := OrderedCollection new ]. |
|
4696 |
commandFiles add:(CommandLineArguments at:idxFileArg+1). |
|
4697 |
CommandLineArguments removeAtIndex:idxFileArg+1; removeAtIndex:idxFileArg. |
|
4698 |
]. |
|
4699 |
||
4700 |
"/ look for a '-E expr' or '--eval expr' argument (-P or --print to print the result of evaluation) |
|
4701 |
"/ or -F/--filter or a '--repl' argument |
|
4702 |
"/ E, P and F this will force evaluation of expr only, no standard startup |
|
4703 |
"/ repl go into an interactive loop. |
|
4704 |
idx := CommandLineArguments indexOfAny:#('-E' '--eval'). |
|
4705 |
(isEval := (idx ~~ 0)) ifFalse:[ |
|
4706 |
idx := CommandLineArguments indexOfAny:#('-P' '--print'). |
|
4707 |
(isPrint := (idx ~~ 0)) ifFalse:[ |
|
4708 |
idx := CommandLineArguments indexOfAny:#('-F' '--filter'). |
|
4709 |
(isFilter := (idx ~~ 0)) ifFalse:[ |
|
4710 |
idx := CommandLineArguments indexOfAny:#('-R' '--repl'). |
|
4711 |
(isRepl := (idx ~~ 0)) ifFalse:[ |
|
4712 |
idx := CommandLineArguments indexOfAny:#('--run'). |
|
4713 |
isRunMain := (idx ~~ 0) |
|
4714 |
]. |
|
4715 |
]. |
|
4716 |
]. |
|
4717 |
]. |
|
4718 |
||
4719 |
(isEval | isPrint | isFilter | isRepl | isRunMain) ifTrue:[ |
|
4720 |
|args| |
|
4721 |
||
4722 |
VerboseStartup ifTrue:[ |
|
4723 |
('Smalltalk [info]: eval/filter/print or repl') infoPrintCR. |
|
4724 |
]. |
|
4725 |
isRepl ifFalse:[ |
|
4726 |
CommandLineArguments size <= idx ifTrue:[ |
|
4727 |
StandAlone := true. |
|
4728 |
self exitWithErrorMessage:'missing argument after -E/-P/-F/--run.'. |
|
4729 |
]. |
|
4730 |
isFilter ifTrue:[ |
|
4731 |
args := CommandLineArguments copyFrom:idx + 1. |
|
4732 |
CommandLineArguments removeFromIndex:idx+1. |
|
4733 |
VerboseStartup ifTrue:[ |
|
4734 |
('Smalltalk [info]: filter expression(s): ') infoPrint. |
|
4735 |
args infoPrintCR. |
|
4736 |
]. |
|
4737 |
] ifFalse:[ |
|
4738 |
arg := CommandLineArguments at:idx + 1. |
|
4739 |
CommandLineArguments removeAtIndex:idx+1. |
|
4740 |
VerboseStartup ifTrue:[ |
|
4741 |
('Smalltalk [info]: eval expression: ') infoPrint. |
|
4742 |
arg infoPrintCR. |
|
4743 |
]. |
|
4744 |
]. |
|
4745 |
]. |
|
4746 |
CommandLineArguments removeAtIndex:idx. |
|
4747 |
||
4748 |
self startSchedulerAndBackgroundCollector. |
|
4749 |
||
4750 |
keepSplashWindow ifFalse:[ self hideSplashWindow ]. |
|
4751 |
Initializing := false. |
|
4752 |
||
4753 |
"/ set workspace variables |
|
4754 |
self defineCommandLineAsWorkspaceVariablesForScripts. |
|
4755 |
||
4756 |
"/ all of the above allow for a -f file to be loaded before any other action |
|
4757 |
(commandFiles notEmptyOrNil) ifTrue:[ |
|
4758 |
commandFiles do:[:commandFile | |
|
4759 |
(VerboseStartup | VerboseLoading) ifTrue:[ |
|
4760 |
('Smalltalk [info]: reading command file from: "', commandFile, '".') infoPrintCR. |
|
4761 |
]. |
|
4762 |
Smalltalk silentlyLoadingDo:[ |
|
4763 |
(self secureFileIn:commandFile) ifFalse:[ |
|
4764 |
StandAlone := true. |
|
4765 |
self exitWithErrorMessage:('"', commandFile, '" not found.'). |
|
4766 |
] |
|
4767 |
] |
|
4768 |
] |
|
4769 |
]. |
|
4770 |
||
4771 |
isRepl ifFalse:[ |
|
4772 |
Debugging == true ifFalse:[ |
|
4773 |
"/ remove the Debugger |
|
4774 |
Debugger := nil. |
|
4775 |
]. |
|
4776 |
]. |
|
4777 |
||
4778 |
process := [ |
|
4779 |
self providingDisplayDo:[ |
|
4780 |
isRepl ifTrue:[ |
|
4781 |
Processor exitWhenNoMoreUserProcesses:false. |
|
4782 |
Processor activeProcess name:'repl'. |
|
4783 |
self readEvalPrintLoop. |
|
4784 |
self exit. |
|
4785 |
]. |
|
4786 |
||
4787 |
Processor exitWhenNoMoreUserProcesses:true. |
|
4788 |
||
4789 |
NoHandlerError handle:[:ex | |
|
4790 |
Debugging == true ifTrue:[ |
|
4791 |
MiniDebugger enterException:ex. |
|
4792 |
] ifFalse:[ |
|
4793 |
Silent ifFalse:[ |
|
4794 |
'Smalltalk [error]: ' _errorPrint. ex description _errorPrintCR. |
|
4795 |
]. |
|
4796 |
(VerboseStartup or:[ObjectMemory debugPrinting]) ifTrue:[ |
|
4797 |
ex suspendedContext fullPrintAll. |
|
4798 |
]. |
|
4799 |
self exit:1. |
|
4800 |
]. |
|
4801 |
self exit:1. |
|
4802 |
"/ ex reject. |
|
4803 |
] do:[ |
|
4804 |
UserInterrupt handle:[:ex | |
|
4805 |
Debugging == true ifTrue:[ |
|
4806 |
'user interrupt (type "c" to continue; "x" to exit; "?" for help).' errorPrintCR. |
|
4807 |
"/ thisContext fullPrintAll. |
|
4808 |
MiniDebugger enterException:ex. |
|
4809 |
ex proceed. |
|
4810 |
]. |
|
4811 |
Silent ifFalse:[ 'user interrupt.' errorPrintCR ]. |
|
4812 |
self exit:128+(OperatingSystem sigINT). |
|
4813 |
] do:[ |
|
4814 |
|filterCode filterStart filterEnd| |
|
4815 |
||
4816 |
isFilter ifTrue:[ |
|
4817 |
"/ --filter - apply code to each input line. |
|
4818 |
"/ compile code only once |
|
4819 |
(args size == 1) ifTrue:[ |
|
4820 |
VerboseStartup ifTrue:[ |
|
4821 |
'Smalltalk [info]: filter 1-arg' infoPrintCR. |
|
4822 |
]. |
|
4823 |
filterCode := args at:1. |
|
4824 |
] ifFalse:[ |
|
4825 |
(args size == 3) ifTrue:[ |
|
4826 |
VerboseStartup ifTrue:[ |
|
4827 |
'Smalltalk [info]: filter 3-arg' infoPrintCR. |
|
4828 |
]. |
|
4829 |
filterStart := args at:1. |
|
4830 |
filterCode := args at:2. |
|
4831 |
filterEnd := args at:3. |
|
4832 |
] ifFalse:[ |
|
4833 |
StandAlone := true. |
|
4834 |
self exitWithErrorMessage:'--filter must be followed by 1 or 3 expression arg(s)' |
|
4835 |
]. |
|
4836 |
]. |
|
4837 |
filterStart notEmptyOrNil ifTrue:[ |
|
4838 |
VerboseStartup ifTrue:[ |
|
4839 |
('Smalltalk [info]: eval: "', filterStart, '"...') infoPrintCR. |
|
4840 |
]. |
|
4841 |
Compiler evaluate:filterStart notifying:(EvalScriptingErrorHandler new source:filterStart) |
|
4842 |
]. |
|
4843 |
VerboseStartup ifTrue:[ |
|
4844 |
('Smalltalk [info]: compile: "', filterCode, '"...') infoPrintCR. |
|
4845 |
]. |
|
4846 |
Compiler |
|
4847 |
compile:'doIt:line ',filterCode |
|
4848 |
forClass:String |
|
4849 |
notifying:(EvalScriptingErrorHandler new source:filterCode). |
|
4850 |
||
4851 |
[Stdin atEnd] whileFalse:[ |
|
4852 |
|line| |
|
4853 |
||
4854 |
line := Stdin nextLine. |
|
4855 |
line doIt:line. |
|
4856 |
]. |
|
4857 |
filterEnd notEmptyOrNil ifTrue:[ |
|
4858 |
VerboseStartup ifTrue:[ |
|
4859 |
('Smalltalk [info]: eval: "', filterEnd, '"...') infoPrintCR. |
|
4860 |
]. |
|
4861 |
Compiler evaluate:filterEnd notifying:(EvalScriptingErrorHandler new source:filterEnd) |
|
4862 |
]. |
|
4863 |
] ifFalse:[ |
|
4864 |
(isPrint | isEval) ifTrue:[ |
|
4865 |
"/ --print or --eval |
|
4866 |
|rslt| |
|
4867 |
||
4868 |
rslt := Parser new |
|
4869 |
evaluate:arg |
|
4870 |
notifying:(EvalScriptingErrorHandler new source:arg) |
|
4871 |
compile:true. |
|
4872 |
isPrint ifTrue:[ |
|
4873 |
rslt printCR. |
|
4874 |
]. |
|
4875 |
] ifFalse:[ |
|
4876 |
"/ --run <className> |
|
4877 |
|className class| |
|
4878 |
||
4879 |
className := arg. |
|
4880 |
class := Smalltalk classNamed:className. |
|
4881 |
class isNil ifTrue:[ |
|
4882 |
StandAlone := true. |
|
4883 |
self exitWithErrorMessage:'no such class: "', className, '".' |
|
4884 |
]. |
|
4885 |
(class respondsTo:#main:) ifTrue:[ |
|
4886 |
class main:CommandLineArguments. |
|
4887 |
] ifFalse:[ |
|
4888 |
(class respondsTo:#main) ifTrue:[ |
|
4889 |
class main. |
|
4890 |
] ifFalse:[ |
|
4891 |
(class respondsTo:#start) ifTrue:[ |
|
4892 |
class start. |
|
4893 |
] ifFalse:[ |
|
4894 |
StandAlone := true. |
|
4895 |
self exitWithErrorMessage:'class has no "main:", "main" or "start" method.' |
|
4896 |
]. |
|
4897 |
]. |
|
4898 |
]. |
|
4899 |
]. |
|
4900 |
]. |
|
4901 |
]. |
|
4902 |
]. |
|
4903 |
]. |
|
4904 |
||
4905 |
"/ after the script, if Screen has been opened and there are any open windows, |
|
4906 |
"/ then do not exit |
|
20758 | 4907 |
false ifTrue:[ |
22791 | 4908 |
Display notNil ifTrue:[ |
4909 |
Processor exitWhenNoMoreUserProcesses:true. |
|
4910 |
"/ Display exitOnLastClose:true. |
|
4911 |
"/ Display checkForEndOfDispatch. |
|
4912 |
VerboseStartup ifTrue:[ |
|
4913 |
('Smalltalk [info]: display opened.') infoPrintCR. |
|
4914 |
]. |
|
4915 |
] ifFalse:[ |
|
4916 |
VerboseStartup ifTrue:[ |
|
4917 |
('Smalltalk [info]: no display - exit after script.') infoPrintCR. |
|
4918 |
]. |
|
4919 |
self exit. |
|
4920 |
]. |
|
20758 | 4921 |
]. |
22791 | 4922 |
VerboseStartup ifTrue:[ |
4923 |
('Smalltalk [info]: script/repl/eval finished.') infoPrintCR. |
|
4924 |
]. |
|
4925 |
||
4926 |
] newProcess. |
|
4927 |
process priority:(Processor userSchedulingPriority). |
|
4928 |
process name:'main'. |
|
4929 |
process beGroupLeader. |
|
4930 |
process resume. |
|
4931 |
||
4932 |
Processor dispatchLoop. |
|
4933 |
VerboseStartup ifTrue:[ |
|
4934 |
('Smalltalk [info]: exit normally.') infoPrintCR. |
|
4935 |
]. |
|
4936 |
self exit |
|
4937 |
]. |
|
4938 |
]. |
|
4939 |
||
4940 |
commandFiles notNil ifTrue:[ |
|
4941 |
SilentLoading := true. "/ suppress the hello & copyright messages |
|
4942 |
self addStartBlock: |
|
4943 |
[ |
|
4944 |
commandFiles do:[:commandFile | |
|
4945 |
(self secureFileIn:commandFile) ifFalse:[ |
|
4946 |
self exitWithErrorMessage:('startup file "', commandFile, '" not found.'). |
|
4947 |
]. |
|
4948 |
]. |
|
4949 |
]. |
|
16091 | 4950 |
|
4951 |
"/ self startSchedulerAndBackgroundCollector. |
|
4952 |
"/ keepSplashWindow ifFalse:[ self hideSplashWindow ]. |
|
4953 |
"/ Initializing := false. |
|
4954 |
"/ |
|
4955 |
"/ (self secureFileIn:commandFile) ifFalse:[ |
|
4956 |
"/ ('Smalltalk [error]: startup file "', commandFile, '" not found.') errorPrintCR. |
|
4957 |
"/ OperatingSystem exit:1. |
|
4958 |
"/ ]. |
|
22791 | 4959 |
] ifFalse:[ |
4960 |
"/ look for <command>.rc |
|
4961 |
"/ if not found, read smalltalk.rc (or stxapp.rc for standAlone operation) |
|
4962 |
||
4963 |
rcFile := self commandName asFilename withSuffix:'rc'. |
|
4964 |
(didReadRCFile := rcFile exists and:[self secureFileIn:rcFile]) ifFalse:[ |
|
4965 |
StandAlone ifFalse:[ |
|
4966 |
defaultRC := 'smalltalk.rc' "/asFilename |
|
4967 |
] ifTrue:[ |
|
4968 |
defaultRC := 'stxapp.rc' "/asFilename |
|
4969 |
]. |
|
4970 |
"JV@2011-11-01: DO NOT check defaultRC exist - this prevents smalltalk to |
|
4971 |
to be started with different working directory than stx/projects/smalltalk !!!!!!" |
|
4972 |
||
4973 |
"/didReadRCFile := defaultRC exists and:[self secureFileIn:defaultRC]. |
|
4974 |
didReadRCFile := (self getSystemFileName:defaultRC) notNil |
|
4975 |
and:[self secureFileIn:defaultRC]. |
|
4976 |
didReadRCFile ifFalse:[ |
|
4977 |
StandAlone ifFalse:[ |
|
4978 |
'Smalltalk [warning]: no startup rc-file found. Going into line-by-line interpreter.' infoPrintCR. |
|
4979 |
graphicalMode := false. |
|
4980 |
] |
|
4981 |
] |
|
4982 |
]. |
|
4983 |
||
4984 |
"/ ('StandAlone is %1' bindWith:StandAlone) printCR. |
|
4985 |
"/ ('Headless is %1' bindWith:HeadlessOperation) printCR. |
|
4986 |
"/ ('Display is %1' bindWith:Display) printCR. |
|
4987 |
"/ ('Screen is %1' bindWith:Screen) printCR. |
|
4988 |
||
4989 |
keepSplashWindow ifFalse:[ self hideSplashWindow ]. |
|
4990 |
didReadRCFile ifFalse:[ |
|
4991 |
'private.rc' asFilename exists ifTrue:[ self secureFileIn:'private.rc' ]. |
|
4992 |
||
4993 |
"/ |
|
4994 |
"/ No RC file found; |
|
4995 |
"/ Setup more default stuff |
|
4996 |
"/ |
|
4997 |
StandAlone ifFalse:[ |
|
4998 |
"/ its a smalltalk - proceed in interpreter. |
|
4999 |
'Smalltalk [warning]: no startup rc-file found. Going into line-by-line interpreter.' infoPrintCR. |
|
5000 |
graphicalMode := false. |
|
5001 |
]. |
|
5002 |
||
5003 |
"/ setup more defaults... |
|
13537 | 5004 |
"/ ObjectMemory startBackgroundCollectorAt:5. |
5005 |
"/ ObjectMemory startBackgroundFinalizationAt:5. |
|
22791 | 5006 |
self addStartBlock:[ |
5007 |
self startSchedulerAndBackgroundCollector |
|
5008 |
]. |
|
5009 |
]. |
|
5010 |
]. |
|
5011 |
(CommandLineArguments includes:'--scripting') ifTrue:[ |
|
5012 |
self addStartBlock:[ |
|
5013 |
StandaloneStartup handleScriptingOptionsFromArguments:CommandLineArguments. |
|
5014 |
]. |
|
5015 |
]. |
|
617 | 5016 |
]. |
5017 |
||
10644 | 5018 |
HeadlessOperation ifTrue:[ |
22791 | 5019 |
graphicalMode := false. |
15872 | 5020 |
]. |
5021 |
||
5022 |
keepSplashWindow ifFalse:[ self hideSplashWindow ]. |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
5023 |
self mainStartup:graphicalMode |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
5024 |
|
15872 | 5025 |
"Modified: / 17-12-2013 / 16:44:40 / cg" |
22147 | 5026 |
"Modified: / 01-08-2017 / 11:08:47 / stefan" |
13536
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
5027 |
! |
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 |
startSchedulerAndBackgroundCollector |
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
5030 |
Processor startTimeSlicing. |
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
5031 |
Processor supportDynamicPriorities:true. |
13537 | 5032 |
|
5033 |
ObjectMemory startBackgroundCollectorAt:5. |
|
5034 |
ObjectMemory startBackgroundFinalizationAt:5. |
|
13536
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
5035 |
ObjectMemory backgroundCollectProcess priorityRange:(4 to:9). |
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
5036 |
ObjectMemory backgroundFinalizationProcess priorityRange:(4 to:9). |
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
5037 |
|
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
5038 |
"Created: / 31-07-2011 / 20:01:33 / cg" |
11808
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
5039 |
! |
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 |
startStartBlockProcess |
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
5042 |
"at the end of the smalltalk initialization, start all actions that |
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
5043 |
were delayed until the ProcessorScheduler is running in a separate process" |
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
5044 |
|
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
5045 |
|p| |
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
5046 |
|
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
5047 |
p := |
18668 | 5048 |
[ |
5049 |
self executeStartBlocks. |
|
5050 |
] newProcess. |
|
12022 | 5051 |
|
5052 |
p |
|
18668 | 5053 |
priority:(Processor userSchedulingPriority); |
5054 |
name:'start block handler'; |
|
5055 |
beGroupLeader; |
|
5056 |
resume. |
|
13892 | 5057 |
|
13893 | 5058 |
"Modified: / 07-01-2012 / 12:59:01 / cg" |
1097 | 5059 |
! ! |
5060 |
||
13947 | 5061 |
!Smalltalk class methodsFor:'startup and exit'! |
5062 |
||
5063 |
addExitBlock:aBlock |
|
5064 |
"{ Pragma: +optSpace }" |
|
5065 |
||
5066 |
"add a block to be executed when Smalltalk finishes. |
|
5067 |
This feature is currently not used anywhere - but could be useful for |
|
5068 |
cleanup in stand alone applications. |
|
5069 |
||
5070 |
Better use: ObjectMemory>>#addDependent: and handle the change message |
|
5071 |
#aboutToQuit." |
|
5072 |
||
5073 |
ExitBlocks isNil ifTrue:[ |
|
18668 | 5074 |
ExitBlocks := OrderedCollection with:aBlock |
13947 | 5075 |
] ifFalse:[ |
18668 | 5076 |
ExitBlocks add:aBlock |
13947 | 5077 |
] |
5078 |
! |
|
5079 |
||
5080 |
addImageStartBlock:aBlock |
|
5081 |
"{ Pragma: +optSpace }" |
|
5082 |
||
5083 |
"add a blocks to be executed in a separate process after |
|
5084 |
everything has been initialized. |
|
5085 |
These blocks will be executed after an image restart." |
|
5086 |
||
5087 |
ImageStartBlocks isNil ifTrue:[ |
|
18668 | 5088 |
ImageStartBlocks := OrderedCollection with:aBlock |
13947 | 5089 |
] ifFalse:[ |
18668 | 5090 |
ImageStartBlocks add:aBlock |
13947 | 5091 |
] |
5092 |
||
5093 |
"Created: 9.9.1996 / 16:48:20 / stefan" |
|
5094 |
! |
|
5095 |
||
5096 |
addStartBlock:aBlock |
|
15980 | 5097 |
"to be called ONLY during very early startup (before the process scheduler |
5098 |
is started) to add a block to be executed in a separate process after |
|
5099 |
everything has been initialized. |
|
5100 |
Used to allow a startup script (which is executed BEFORE the scheduler and |
|
5101 |
UI display is startup up) to add actions which require those subsystems to |
|
5102 |
be operating. |
|
5103 |
These blocks will be executed only once and not be executed after an image restart. |
|
13947 | 5104 |
Initial processes such as the launcher are usually started here |
15980 | 5105 |
(see smalltalk.rc / private.rc). |
5106 |
ONLY to be called from such an rc file." |
|
13947 | 5107 |
|
5108 |
"{ Pragma: +optSpace }" |
|
5109 |
||
15980 | 5110 |
"/ to protect against "mis-users" of this mehtod... |
5111 |
Initializing ifFalse:[ |
|
18668 | 5112 |
aBlock value |
16170
ca4d03def070
endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents:
16164
diff
changeset
|
5113 |
] ifTrue:[ |
18668 | 5114 |
StartBlocks isNil ifTrue:[ |
5115 |
StartBlocks := OrderedCollection with:aBlock |
|
5116 |
] ifFalse:[ |
|
5117 |
StartBlocks add:aBlock |
|
5118 |
] |
|
15980 | 5119 |
]. |
13947 | 5120 |
|
5121 |
"Created: / 09-09-1996 / 16:46:53 / stefan" |
|
5122 |
"Modified (comment): / 18-08-2011 / 09:18:42 / cg" |
|
5123 |
! |
|
5124 |
||
5125 |
exit |
|
5126 |
"{ Pragma: +optSpace }" |
|
5127 |
||
5128 |
"finish the Smalltalk system" |
|
5129 |
||
5130 |
self exit:0 |
|
5131 |
"not reached" |
|
5132 |
||
5133 |
"Be careful evaluating this |
|
5134 |
Smalltalk exit |
|
5135 |
" |
|
5136 |
! |
|
5137 |
||
5138 |
exit:statusInteger |
|
5139 |
"{ Pragma: +optSpace }" |
|
5140 |
||
5141 |
"finish the Smalltalk system" |
|
5142 |
||
5143 |
ObjectMemory changed:#aboutToExit. "/ for ST/X backward compatibility |
|
5144 |
ObjectMemory changed:#aboutToQuit. "/ for ST-80 compatibility |
|
5145 |
ExitBlocks notNil ifTrue:[ |
|
22791 | 5146 |
ExitBlocks do:[:aBlock | |
5147 |
aBlock value |
|
5148 |
] |
|
21782 | 5149 |
]. |
5150 |
Display notNil ifTrue:[ Display closeConnection ]. |
|
5151 |
||
13947 | 5152 |
OperatingSystem exit:statusInteger |
5153 |
"not reached" |
|
5154 |
||
5155 |
"Be careful evaluating this |
|
5156 |
Smalltalk exit:1 |
|
5157 |
" |
|
21782 | 5158 |
|
5159 |
"Modified: / 30-05-2017 / 21:36:35 / cg" |
|
19014 | 5160 |
! |
5161 |
||
19958 | 5162 |
exitIfStandalone |
5163 |
"if this is a standalone application, exit. |
|
5164 |
Otherwise give a warning and abort. |
|
5165 |
Call this in your code instead of Smalltalk exit, |
|
5166 |
so the code can be tested in the IDE without danger of shuttong down ST/X" |
|
5167 |
||
5168 |
"{ Pragma: +optSpace }" |
|
5169 |
||
5170 |
self exitIfStandalone:0 |
|
5171 |
||
5172 |
"Created: / 06-06-2016 / 14:56:49 / cg" |
|
5173 |
! |
|
5174 |
||
5175 |
exitIfStandalone:statusInteger |
|
5176 |
"if this is a standalone application, exit. |
|
5177 |
Otherwise give a warning and abort. |
|
5178 |
Call this in your code instead of Smalltalk exit, |
|
5179 |
so the code can be tested in the IDE without danger of shuttong down ST/X" |
|
5180 |
||
5181 |
"{ Pragma: +optSpace }" |
|
5182 |
||
5183 |
Smalltalk isStandAloneApp ifTrue:[ |
|
22791 | 5184 |
self exit:statusInteger |
19958 | 5185 |
] ifFalse:[ |
22791 | 5186 |
self warn:'Application asks Smalltalk to exit (this is suppressed in IDE).'. |
5187 |
AbortOperationRequest raise. |
|
19958 | 5188 |
] |
5189 |
||
5190 |
" |
|
5191 |
Smalltalk exitIfStandalone:1 |
|
5192 |
" |
|
5193 |
||
5194 |
"Created: / 06-06-2016 / 14:56:00 / cg" |
|
5195 |
! |
|
5196 |
||
19014 | 5197 |
exitOrError:exitCode |
5198 |
"exit only if running as standalone application. |
|
5199 |
Raise an error in the development system. |
|
5200 |
Useful for testing standalone apps which should not kill |
|
5201 |
your development system." |
|
5202 |
||
5203 |
self isStandAloneApp ifTrue:[ |
|
22791 | 5204 |
self exit:exitCode. |
19014 | 5205 |
]. |
5206 |
self error:'standalone smalltalk would exit here with exit code: ', exitCode printString. |
|
5207 |
||
5208 |
" |
|
5209 |
self exitOrError:0 |
|
5210 |
" |
|
20715 | 5211 |
! |
5212 |
||
5213 |
exitWithErrorMessage:msg |
|
5214 |
('Smalltalk [error]: ',msg) errorPrintCR. |
|
5215 |
self exitOrError:1 |
|
13947 | 5216 |
! ! |
5217 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
5218 |
!Smalltalk class methodsFor:'startup queries'! |
1097 | 5219 |
|
10641 | 5220 |
commandLine |
5221 |
"return the full command line arguments (with which ST/X was started)" |
|
5222 |
||
5223 |
^ CommandLine |
|
5224 |
||
5225 |
" |
|
5226 |
Smalltalk commandLine |
|
5227 |
" |
|
5228 |
||
5229 |
"Created: 19.7.1996 / 11:09:06 / cg" |
|
5230 |
! |
|
5231 |
||
5232 |
commandLineArgumentNamed:aString |
|
16110 | 5233 |
"extract a named argument from the command line arguments. |
5234 |
This searches for the given string in the command line and returns the next argument after it." |
|
10641 | 5235 |
|
5236 |
|args index| |
|
5237 |
||
5238 |
args := self commandLineArguments. |
|
5239 |
index := args indexOf:aString. |
|
5240 |
(index between:1 and:(args size - 1)) ifTrue:[ |
|
18668 | 5241 |
^ args at:index+1 |
10641 | 5242 |
]. |
5243 |
^ nil. |
|
5244 |
||
5245 |
" |
|
5246 |
self commandLineArgumentNamed:'-display' |
|
5247 |
" |
|
5248 |
! |
|
5249 |
||
5250 |
commandLineArguments |
|
5251 |
"return the user command line arguments; |
|
5252 |
This is a collection of strings (separated command line words), |
|
5253 |
from which the internal startup arguments have already been removed. |
|
5254 |
I.e. if started with: 'smalltalk -I -f xxx foo bar baz', |
|
5255 |
the commandLineArguments will be #('foo' 'bar' 'baz'). |
|
5256 |
In contrast, the value returned by #commandLine will be the full set of words." |
|
5257 |
||
5258 |
^ CommandLineArguments |
|
5259 |
||
5260 |
"Modified: 19.7.1996 / 11:11:03 / cg" |
|
5261 |
! |
|
5262 |
||
5263 |
commandName |
|
5264 |
"return the excutables name - this is normally 'stx', |
|
5265 |
but can be something else for standAlone apps." |
|
5266 |
||
5267 |
^ CommandName. |
|
5268 |
||
5269 |
" |
|
5270 |
Smalltalk commandName |
|
5271 |
" |
|
5272 |
||
5273 |
"Modified: 19.7.1996 / 11:11:16 / cg" |
|
5274 |
! |
|
5275 |
||
5276 |
hasNoConsole |
|
5277 |
"return true, if this is a console-less application (i.e. I am winstx) |
|
5278 |
i.e. there should be no writing to stdout/stderr" |
|
5279 |
||
5280 |
^ HasNoConsole ? false |
|
5281 |
||
5282 |
" |
|
10071 | 5283 |
Smalltalk hasNoConsole |
9054 | 5284 |
" |
5285 |
! |
|
5286 |
||
17435 | 5287 |
ignoreAssertions |
5288 |
"return true, if assertions are to be ignored (i.e. not executed). |
|
5289 |
This is false by default in an IDE (i.e. full smalltalk), |
|
5290 |
but can be set to true for standAlone applications |
|
5291 |
(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
|
5292 |
However, it may make the app a little faster, if assertions are compatational |
17435 | 5293 |
expensive, as they are skipped (the stc compiler is generatig code which skips those)." |
5294 |
||
17439
1928276a394c
added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents:
17438
diff
changeset
|
5295 |
^ IgnoreAssertions ? false |
17435 | 5296 |
! |
5297 |
||
17438 | 5298 |
ignoreAssertions:aBoolean |
5299 |
"set to true, if assertions are to be ignored (i.e. not executed). |
|
5300 |
This is false by default in an IDE (i.e. full smalltalk), |
|
5301 |
but can be set to true for standAlone applications |
|
5302 |
(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
|
5303 |
However, it may make the app a little faster, if assertions are compatational |
17438 | 5304 |
expensive, as they are skipped (the stc compiler is generatig code which skips those)." |
5305 |
||
17439
1928276a394c
added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents:
17438
diff
changeset
|
5306 |
IgnoreAssertions := aBoolean |
17438 | 5307 |
! |
5308 |
||
22679 | 5309 |
isDebuggableApp |
5310 |
"return true, if we want to see a Debugger, MiniDebugger or extended debugging output |
|
5311 |
in some situations." |
|
5312 |
||
5313 |
^ self isStandAloneApp not or:[self isStandAloneDebug]. |
|
5314 |
||
5315 |
" |
|
5316 |
Smalltalk isDebuggableApp |
|
5317 |
" |
|
5318 |
||
5319 |
"Created: / 19-04-2018 / 10:30:17 / stefan" |
|
5320 |
! |
|
5321 |
||
10641 | 5322 |
isHeadless |
5323 |
"return true, if this is a headless application |
|
5324 |
i.e. no default Display connection is required/used" |
|
5325 |
||
5326 |
^ HeadlessOperation ? false |
|
5327 |
||
5328 |
" |
|
10071 | 5329 |
Smalltalk isHeadless |
9029 | 5330 |
" |
5331 |
! |
|
5332 |
||
10641 | 5333 |
isPlugin |
5334 |
"return true, if this is a plugin application |
|
5335 |
i.e. running in a browserWindow" |
|
5336 |
||
5337 |
^ IsPlugin ? false |
|
5338 |
||
5339 |
" |
|
10071 | 5340 |
Smalltalk isPlugin |
9029 | 5341 |
" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5342 |
! |
4957 | 5343 |
|
10641 | 5344 |
isSTScript |
5345 |
"return true, if this is stscript. i.e. the stx scripting engine." |
|
5346 |
||
5347 |
^ IsSTScript ? false |
|
5348 |
||
5349 |
" |
|
5350 |
Smalltalk isSTScript |
|
5351 |
" |
|
5352 |
||
5353 |
"Created: / 06-12-2006 / 16:41:21 / cg" |
|
5354 |
! |
|
5355 |
||
5356 |
isSharedLibraryComponent |
|
5357 |
"return true, if this is a shared library component of another application |
|
5358 |
i.e. a dll within another app." |
|
5359 |
||
5360 |
^ IsSharedLibraryComponent ? false |
|
5361 |
||
5362 |
" |
|
5363 |
Smalltalk isSharedLibraryComponent |
|
5364 |
" |
|
5365 |
||
5366 |
"Created: / 10-08-2006 / 13:09:34 / cg" |
|
5367 |
! |
|
5368 |
||
5369 |
isSmalltalkDevelopmentSystem |
|
5370 |
"return true, if this is a real smalltalk system |
|
17421 | 5371 |
i.e. NOT a stripped or a linked standAlone application (such as the webServer) |
10641 | 5372 |
and NOT a plugIn (i.e. running in a browser) |
5373 |
and NOT a sharedLibrary component (i.e. a dll in another app). |
|
17421 | 5374 |
This is used to determine, whether debugging is possible/desired or not." |
10641 | 5375 |
|
5376 |
self isPlugin ifTrue:[^ false]. "/ I am a browser-plugin |
|
5377 |
self isSharedLibraryComponent ifTrue:[^ false]. "/ I am a COM-ponent |
|
5378 |
self isSTScript ifTrue:[^ true ]. "/ I am stScript |
|
10999 | 5379 |
^ self isStandAloneApp not. |
10641 | 5380 |
|
5381 |
" |
|
5382 |
Smalltalk isSmalltalkDevelopmentSystem |
|
5383 |
" |
|
5384 |
||
5385 |
"Created: / 10-08-2006 / 13:12:49 / cg" |
|
5386 |
"Modified: / 06-12-2006 / 16:42:56 / cg" |
|
15565 | 5387 |
"Modified (comment): / 27-07-2013 / 15:36:20 / cg" |
10641 | 5388 |
! |
5389 |
||
5390 |
isStandAloneApp |
|
5391 |
"return true, if this is a standAlone application |
|
5392 |
i.e. a stripped & linked application (such as the webServer) |
|
5393 |
in contrast to a full smalltalk (development) system." |
|
5394 |
||
5395 |
^ StandAlone ? false |
|
5396 |
||
5397 |
" |
|
10071 | 5398 |
Smalltalk isStandAloneApp |
9029 | 5399 |
" |
617 | 5400 |
! |
5401 |
||
13947 | 5402 |
isStandAloneDebug |
5403 |
"return true, if this is a standAlone application which |
|
5404 |
was started with the -debug option." |
|
5405 |
||
5406 |
^ DebuggingStandAlone ? false |
|
5407 |
||
5408 |
" |
|
5409 |
Smalltalk isStandAloneDebug |
|
5410 |
" |
|
5411 |
||
5412 |
"Created: / 19-01-2012 / 10:17:41 / cg" |
|
5413 |
! |
|
5414 |
||
10641 | 5415 |
startupArguments |
5416 |
"return the arguments passed to StartupClass when stx gets started. |
|
5417 |
Usually these are nil, |
|
5418 |
but saving an image with a non-nil StartupClass/StartupSelector/StartupArgs allows for |
|
5419 |
a simple way to configure and create stand-alone applications" |
|
5420 |
||
5421 |
^ StartupArguments |
|
5422 |
||
5423 |
" |
|
10071 | 5424 |
Smalltalk startupArguments |
9029 | 5425 |
" |
7563 | 5426 |
! |
5427 |
||
10641 | 5428 |
startupClass |
5429 |
"return the class, that will get the start message when smalltalk |
|
5430 |
starts and its non-nil. Usually this is nil, |
|
5431 |
but saving an image with a non-nil StartupClass/StartupSelector/StartupArgs allows for |
|
5432 |
a simple way to configure and create stand-alone applications" |
|
5433 |
||
5434 |
^ StartupClass |
|
5435 |
||
5436 |
" |
|
10071 | 5437 |
Smalltalk startupClass |
9029 | 5438 |
" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5439 |
! |
8570 | 5440 |
|
10641 | 5441 |
startupClass:aClass selector:aSymbol arguments:anArrayOrNil |
5442 |
"{ Pragma: +optSpace }" |
|
5443 |
||
5444 |
"set the class, selector and arguments to be performed when smalltalk |
|
5445 |
starts. Setting those before saving a snapshot, will make the saved |
|
5446 |
image come up executing your application (instead of the normal mainloop)" |
|
5447 |
||
5448 |
StartupClass := aClass. |
|
5449 |
StartupSelector := aSymbol. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5450 |
StartupArguments := anArrayOrNil |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5451 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5452 |
|
10641 | 5453 |
startupSelector |
5454 |
"return the selector, that will be sent to StartupClass. |
|
5455 |
Usually this is nil, |
|
5456 |
but saving an image with a non-nil StartupClass/StartupSelector allows for |
|
5457 |
a simple way to configure and create stand-alone applications" |
|
5458 |
||
5459 |
^ StartupSelector |
|
5460 |
||
5461 |
" |
|
10071 | 5462 |
Smalltalk startupSelector |
9029 | 5463 |
" |
10641 | 5464 |
! |
5465 |
||
5466 |
wasStartedFromImage |
|
5467 |
"return true, if this smalltalk was started from an image, |
|
5468 |
as opposed to a fresh and clean startup" |
|
5469 |
||
5470 |
^ ImageRestartTime notNil |
|
5471 |
||
5472 |
" |
|
5473 |
Smalltalk wasStartedFromImage |
|
5474 |
" |
|
70 | 5475 |
! ! |
5476 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
5477 |
!Smalltalk class methodsFor:'system environment'! |
1069 | 5478 |
|
10641 | 5479 |
language |
5480 |
"return the language setting" |
|
5481 |
||
5482 |
^ Language |
|
5483 |
||
5484 |
" |
|
5485 |
Smalltalk language |
|
5486 |
" |
|
5487 |
||
5488 |
"Modified: 26.4.1996 / 17:10:05 / cg" |
|
5489 |
! |
|
5490 |
||
5491 |
language:aLanguageSymbol |
|
10991 | 5492 |
"set the language - send out change notifications" |
10641 | 5493 |
|
18733 | 5494 |
aLanguageSymbol ~= Language ifTrue:[ |
22791 | 5495 |
Language := aLanguageSymbol asSymbol. |
5496 |
self changed:#Language |
|
18733 | 5497 |
]. |
10641 | 5498 |
|
5499 |
" |
|
5500 |
Smalltalk language:#de |
|
5501 |
" |
|
5502 |
||
5503 |
"Modified: / 19-10-2006 / 23:17:29 / cg" |
|
21928 | 5504 |
"Modified: / 29-06-2017 / 15:05:04 / stefan" |
10641 | 5505 |
! |
5506 |
||
5507 |
language:aLanguageSymbol territory:aTerritorySymbol |
|
10991 | 5508 |
"set the language & territory - send out change notifications" |
10641 | 5509 |
|
18733 | 5510 |
((Language ~= aLanguageSymbol) or:[ LanguageTerritory ~= aTerritorySymbol]) ifTrue:[ |
22791 | 5511 |
Language := aLanguageSymbol asSymbol. |
5512 |
LanguageTerritory := aTerritorySymbol asSymbol. |
|
5513 |
self changed:#Language |
|
18733 | 5514 |
]. |
10641 | 5515 |
|
5516 |
" |
|
5517 |
Smalltalk language:#de territory:#de |
|
5518 |
" |
|
5519 |
||
5520 |
"Created: / 19-10-2006 / 22:16:22 / cg" |
|
5521 |
"Modified: / 19-10-2006 / 23:17:36 / cg" |
|
5522 |
! |
|
5523 |
||
13212
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5524 |
languageAndTerritory |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5525 |
"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
|
5526 |
|
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5527 |
^ Language , '-' , (LanguageTerritory ? Language) |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5528 |
|
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 |
Smalltalk languageAndTerritory |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5531 |
" |
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 |
"Created: / 16-01-2011 / 10:19:42 / cg" |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5534 |
! |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5535 |
|
20615 | 5536 |
languageCodeset |
5537 |
^ LanguageCodeset |
|
5538 |
! |
|
5539 |
||
5540 |
languageModifier |
|
5541 |
^ LanguageModifier |
|
5542 |
! |
|
5543 |
||
10641 | 5544 |
languageTerritory |
5545 |
"return the language territory setting" |
|
7563 | 5546 |
|
5547 |
^ LanguageTerritory |
|
5548 |
! |
|
5549 |
||
10641 | 5550 |
languageTerritory:aTerritorySymbol |
10991 | 5551 |
"set the language territory - send out change notifications" |
10641 | 5552 |
|
18924 | 5553 |
aTerritorySymbol ~= LanguageTerritory ifTrue:[ |
22791 | 5554 |
LanguageTerritory := aTerritorySymbol asSymbol. |
5555 |
self changed:#LanguageTerritory |
|
5556 |
]. |
|
5557 |
||
10641 | 5558 |
" |
5559 |
Time now |
|
5560 |
||
5561 |
Smalltalk languageTerritory:#us. |
|
5562 |
Time now |
|
5563 |
||
5564 |
Smalltalk languageTerritory:#de. |
|
5565 |
Time now |
|
5566 |
" |
|
5567 |
||
5568 |
"Modified: / 19-10-2006 / 23:17:40 / cg" |
|
5569 |
! |
|
5570 |
||
5571 |
setLanguage:aLanguageSymbol |
|
10991 | 5572 |
"set the language without change notification" |
10641 | 5573 |
|
5574 |
Language := aLanguageSymbol. |
|
10991 | 5575 |
! |
5576 |
||
5577 |
setLanguage:aLanguageSymbol territory:aTerritorySymbol |
|
5578 |
"set the language & territory - no change notification" |
|
5579 |
||
5580 |
Language := aLanguageSymbol asSymbol. |
|
5581 |
LanguageTerritory := aTerritorySymbol asSymbol. |
|
1069 | 5582 |
! ! |
5583 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
5584 |
!Smalltalk class methodsFor:'system management'! |
70 | 5585 |
|
10641 | 5586 |
compressSources |
5587 |
"{ Pragma: +optSpace }" |
|
5588 |
||
5589 |
"compress the sources file, and remove all method source strings |
|
5590 |
from the system and replace them by refs to a string in the source file. |
|
5591 |
This is a bit different in ST/X than in other smalltalks, |
|
5592 |
since we use per-class sourcefiles for the compiled classes, |
|
5593 |
and a mix of in-memory strings and one-for-all sourceFile for |
|
5594 |
incremental compiled methods. |
|
5595 |
Therefore, only those sources which are not coming from compiled |
|
5596 |
methods are put into the 'st.src' file - all others are untouched. |
|
20811 | 5597 |
This is being automated - so don't care for now." |
10641 | 5598 |
|
5599 |
|newStream table source pos fileName| |
|
5600 |
||
5601 |
" |
|
5602 |
first, find all methods which contain either a string-ref |
|
5603 |
or an external string in the 'st.src' file |
|
5604 |
" |
|
5605 |
newStream := 'src.tmp' asFilename writeStream. |
|
5606 |
||
5607 |
table := IdentityDictionary new:100. |
|
5608 |
||
5609 |
Method allSubInstancesDo:[:aMethod | |
|
22791 | 5610 |
source := nil. |
5611 |
aMethod sourcePosition notNil ifTrue:[ |
|
5612 |
aMethod sourceFilename = 'st.src' ifTrue:[ |
|
5613 |
source := aMethod source. |
|
5614 |
] |
|
5615 |
] ifFalse:[ |
|
5616 |
source := aMethod source |
|
5617 |
]. |
|
5618 |
||
5619 |
source notNil ifTrue:[ |
|
5620 |
pos := newStream position + 1. |
|
5621 |
newStream nextChunkPut:source. |
|
5622 |
||
5623 |
" |
|
5624 |
dont change the methods info - maybe some write error |
|
5625 |
occurs later, in that case we abort and leave everything |
|
5626 |
untouched. |
|
5627 |
" |
|
5628 |
table at:aMethod put:pos |
|
5629 |
] |
|
11655
4306fb61b9f8
sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents:
11624
diff
changeset
|
5630 |
]. |
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 |
newStream syncData; close. |
10641 | 5633 |
|
5634 |
" |
|
5635 |
now, rename the new source file, |
|
5636 |
" |
|
5637 |
fileName := (ObjectMemory nameForSources). |
|
5638 |
'src.tmp' asFilename renameTo:fileName. |
|
5639 |
||
5640 |
"good - now go over all changed methods, and change their |
|
5641 |
source reference" |
|
5642 |
||
5643 |
table keysAndValuesDo:[:aMethod :pos | |
|
22791 | 5644 |
aMethod localSourceFilename:fileName position:pos. |
10641 | 5645 |
"/ aMethod printCR. |
5646 |
]. |
|
5647 |
||
5648 |
" |
|
5649 |
Smalltalk compressSources |
|
5650 |
" |
|
5651 |
||
5652 |
"Modified: 16.1.1997 / 01:25:58 / cg" |
|
5653 |
! |
|
5654 |
||
5655 |
generateSingleSourceFile |
|
5656 |
"{ Pragma: +optSpace }" |
|
5657 |
||
5658 |
"generate the sources file, and remove all method source strings |
|
5659 |
from the system and replace them by refs to a string in the source file. |
|
5660 |
This makes the image independent from the per-class source files |
|
5661 |
and makes transportation of endUser applications easier, since |
|
5662 |
only 3 files (executable, image and sourceFile) need to be |
|
5663 |
transported." |
|
5664 |
||
5665 |
|newStream table source pos fileName| |
|
5666 |
||
5667 |
newStream := 'src.tmp' asFilename writeStream. |
|
5668 |
||
5669 |
table := IdentityDictionary new:100. |
|
5670 |
||
5671 |
Method allSubInstancesDo:[:aMethod | |
|
22791 | 5672 |
source := aMethod source. |
5673 |
source notNil ifTrue:[ |
|
5674 |
pos := newStream position + 1. |
|
5675 |
newStream nextChunkPut:source. |
|
5676 |
||
5677 |
" |
|
5678 |
don't change the method's info - maybe some write error |
|
5679 |
occurs later, in that case we abort and leave everything |
|
5680 |
untouched. |
|
5681 |
" |
|
5682 |
table at:aMethod put:pos |
|
5683 |
] |
|
11655
4306fb61b9f8
sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents:
11624
diff
changeset
|
5684 |
]. |
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 |
newStream syncData; close. |
10641 | 5687 |
|
5688 |
" |
|
5689 |
now, rename the new source file, |
|
5690 |
" |
|
5691 |
fileName := (ObjectMemory nameForSources). |
|
5692 |
'src.tmp' asFilename renameTo:fileName. |
|
5693 |
||
5694 |
"good - now go over all changed methods, and change their |
|
5695 |
source reference" |
|
5696 |
||
5697 |
table keysAndValuesDo:[:aMethod :pos | |
|
22791 | 5698 |
aMethod localSourceFilename:fileName position:pos. |
10641 | 5699 |
"/ aMethod printCR. |
5700 |
]. |
|
5701 |
||
5702 |
" |
|
5703 |
Smalltalk generateSingleSourceFile |
|
5704 |
" |
|
5705 |
||
22373 | 5706 |
"Modified: / 16-01-1997 / 01:25:58 / cg" |
5707 |
"Created: / 17-10-1997 / 13:00:56 / cg" |
|
5708 |
"Modified (comment): / 21-11-2017 / 13:08:41 / cg" |
|
10641 | 5709 |
! |
5710 |
||
15596 | 5711 |
installAutoloadedClassFromSourceFile:aFilename |
5712 |
"install aFilename (which must be a smalltalk source file) as autoloaded class |
|
5713 |
(extract the class definition chunk from the file and create an autoloaded |
|
5714 |
class stub for it)" |
|
5715 |
||
5716 |
|chunks filename| |
|
5717 |
||
5718 |
filename := aFilename asFilename. |
|
5719 |
||
5720 |
ChangeSet::InvalidChangeChunkError handle:[:ex | |
|
18668 | 5721 |
^ self |
15596 | 5722 |
] do:[ |
18668 | 5723 |
filename readingFileDo:[:s| |
5724 |
chunks := ChangeSet fromStream:s while:[:chunk | chunk isMethodChange not]. |
|
5725 |
]. |
|
16170
ca4d03def070
endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents:
16164
diff
changeset
|
5726 |
]. |
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 |
chunks |
18668 | 5729 |
select:[:eachChunk | eachChunk isClassDefinitionChange] |
5730 |
thenDo:[:eachClassChunk | |
|
5731 |
eachClassChunk installAsAutoloadedClassIfPublicWithFilename:filename asAbsoluteFilename "withoutSuffix" name "baseName" |
|
5732 |
]. |
|
15596 | 5733 |
|
5734 |
"Created: / 01-08-2013 / 16:57:26 / cg" |
|
5735 |
! |
|
5736 |
||
10641 | 5737 |
installAutoloadedClassNamed:clsName category:cat package:package revision:revisionOrNil |
5738 |
"create & install an autoload stub for a class named: clsName, |
|
5739 |
to be loaded from package. |
|
5740 |
If revisionOrNil is non-nil, set it up to load exactly that revision |
|
5741 |
(otherwise, the newest revision will be loaded" |
|
5742 |
||
5743 |
^ self |
|
18668 | 5744 |
installAutoloadedClassNamed:clsName |
5745 |
category:cat |
|
5746 |
package:package |
|
5747 |
revision:revisionOrNil |
|
5748 |
numClassInstVars:nil. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5749 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5750 |
|
10641 | 5751 |
installAutoloadedClassNamed:clsName category:cat package:package revision:revisionOrNil numClassInstVars:numClassInstVarsOrNil |
5752 |
"create & install an autoload stub for a class named: clsName, |
|
5753 |
to be loaded from package. |
|
5754 |
If revisionOrNil is non-nil, set it up to load exactly that revision |
|
5755 |
(otherwise, the newest revision will be loaded" |
|
5756 |
||
5757 |
|clsSym cls| |
|
5758 |
||
5759 |
clsSym := clsName asSymbol. |
|
5760 |
||
5761 |
"/ install if not already compiled-in |
|
5762 |
(cls := self at:clsSym) isNil ifTrue:[ |
|
18668 | 5763 |
Autoload subclass:clsSym |
5764 |
instanceVariableNames:'' |
|
5765 |
classVariableNames:'' |
|
5766 |
poolDictionaries:'' |
|
5767 |
category:cat |
|
5768 |
inEnvironment:Smalltalk. |
|
5769 |
||
5770 |
cls := self at:clsSym. |
|
5771 |
cls isNil ifTrue:[ |
|
5772 |
('Smalltalk [warning]: failed to install ' , clsName , ' as autoloaded.') infoPrintCR. |
|
5773 |
] ifFalse:[ |
|
5774 |
cls package:package asSymbol. |
|
5775 |
revisionOrNil notNil ifTrue:[ |
|
5776 |
cls setBinaryRevision:revisionOrNil |
|
5777 |
] |
|
5778 |
] |
|
10641 | 5779 |
] ifFalse:[ |
18668 | 5780 |
"/ class already present - however, if unloaded, check for category/package change |
5781 |
cls isLoaded ifFalse:[ |
|
5782 |
package ~= cls package ifTrue:[ |
|
5783 |
cls withoutUpdatingChangesDo:[ |
|
5784 |
cls package:package asSymbol. |
|
5785 |
]. |
|
5786 |
]. |
|
5787 |
cat ~= cls category ifTrue:[ |
|
5788 |
cls withoutUpdatingChangesDo:[ |
|
5789 |
cls category:cat. |
|
5790 |
]. |
|
5791 |
]. |
|
5792 |
]. |
|
10641 | 5793 |
]. |
5794 |
^ cls. |
|
5795 |
||
5796 |
"Created: / 05-11-1998 / 15:10:25 / cg" |
|
5797 |
"Modified: / 16-01-2007 / 12:56:18 / cg" |
|
11169
32fda240ee57
#installAutoloadedClassNamed:category:package:revision:numClassInstVars:
Stefan Vogel <sv@exept.de>
parents:
11153
diff
changeset
|
5798 |
|
10641 | 5799 |
! |
5800 |
||
5801 |
installAutoloadedClasses |
|
11679
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
5802 |
"scan all packages and install all classes found there as |
10641 | 5803 |
autoloaded. This takes some time ..." |
5804 |
||
11679
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
5805 |
|dirsConsulted| |
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
5806 |
|
17588 | 5807 |
LoadInProgressQuery answerNotifyLoadingDo:[ |
18668 | 5808 |
dirsConsulted := Set new. |
5809 |
||
5810 |
"/ along the package-path |
|
5811 |
self packagePath do:[:eachPathComponent | |
|
5812 |
(dirsConsulted includes:eachPathComponent) ifFalse:[ |
|
5813 |
self |
|
5814 |
recursiveInstallAutoloadedClassesFrom:eachPathComponent |
|
5815 |
rememberIn:dirsConsulted |
|
5816 |
maxLevels:15 |
|
5817 |
noAutoload:false |
|
5818 |
packageTop:eachPathComponent |
|
5819 |
showSplashInLevels:2. |
|
5820 |
] |
|
5821 |
]. |
|
5822 |
self splashInfo:nil. |
|
17548 | 5823 |
]. |
10641 | 5824 |
|
5825 |
" |
|
5826 |
Smalltalk installAutoloadedClasses |
|
5827 |
" |
|
5828 |
||
5829 |
"Created: / 14.2.1997 / 17:32:57 / cg" |
|
5830 |
"Modified: / 13.12.1999 / 11:56:50 / cg" |
|
5831 |
! |
|
5832 |
||
5833 |
installAutoloadedClassesFrom:anAbbrevFilePath |
|
5834 |
"read the given abbreviation file; install all classes found there as |
|
5835 |
autoloaded. This takes some time ..." |
|
5836 |
||
5837 |
|f s| |
|
5838 |
||
5839 |
f := self getSystemFileName:anAbbrevFilePath. |
|
5840 |
f isNil ifTrue:[f := self getPackageFileName:anAbbrevFilePath]. |
|
5841 |
||
5842 |
f notNil ifTrue:[ |
|
22791 | 5843 |
f := f asFilename. |
5844 |
f isDirectory ifTrue:[ |
|
5845 |
f := f construct:'abbrev.stc' |
|
5846 |
]. |
|
5847 |
[ |
|
5848 |
s := f readStream. |
|
5849 |
self installAutoloadedClassesFromStream:s. |
|
5850 |
s close. |
|
5851 |
] on:FileStream openErrorSignal |
|
5852 |
do:[:ex| "do nothing"]. |
|
10641 | 5853 |
] |
5854 |
||
5855 |
" |
|
5856 |
Smalltalk installAutoloadedClassesFrom:'include/abbrev.stc' |
|
19911 | 5857 |
Smalltalk installAutoloadedClassesFrom:'../../goodies/communication/abbrev.stc' |
10641 | 5858 |
" |
5859 |
||
5860 |
"Modified: / 5.11.1998 / 15:10:51 / cg" |
|
5861 |
! |
|
5862 |
||
13531
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
5863 |
installAutoloadedClassesFromAbbrevFile:aFilename |
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
5864 |
aFilename readingFileDo:[:abbrevStream | |
22791 | 5865 |
self installAutoloadedClassesFromStream:abbrevStream. |
13531
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
5866 |
] |
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
5867 |
|
19911 | 5868 |
" |
5869 |
self installAutoloadedClassesFromAbbrevFile:('../../goodies/communication/abbrev.stc' asFilename) |
|
5870 |
" |
|
22791 | 5871 |
|
13531
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
5872 |
"Created: / 29-07-2011 / 20:39:21 / cg" |
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
5873 |
! |
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
5874 |
|
10641 | 5875 |
installAutoloadedClassesFromStream:anAbbrevFileStream |
5876 |
"read the given abbreviation file; |
|
5877 |
install all classes found there as autoloaded, and also update the |
|
5878 |
abbreviation (className-to-fileName mapping) table. |
|
5879 |
This takes some time ..." |
|
5880 |
||
5881 |
|s2 l abbrevFileName info clsName cls abbrev package cat numClassInstVars words w| |
|
5882 |
||
5883 |
anAbbrevFileStream isFileStream ifTrue:[ |
|
22791 | 5884 |
abbrevFileName := anAbbrevFileStream pathName. |
5885 |
info := 'declared from: ', abbrevFileName. |
|
10641 | 5886 |
]. |
5887 |
||
5888 |
"/ yes, create any required nameSpace, without asking user. |
|
5889 |
Class createNameSpaceQuerySignal answer:true do:[ |
|
5890 |
||
22791 | 5891 |
[anAbbrevFileStream atEnd] whileFalse:[ |
5892 |
l := anAbbrevFileStream nextLine withoutSeparators. |
|
5893 |
"Skip empty lines and comments" |
|
5894 |
(l notEmpty and:[l first ~= $#]) ifTrue:[ |
|
5895 |
"/ must do it manually, caring for quoted strings. |
|
10641 | 5896 |
"/ words := line asCollectionOfWords. |
5897 |
||
22791 | 5898 |
words := OrderedCollection new. |
5899 |
s2 := l readStream. |
|
5900 |
[s2 atEnd] whileFalse:[ |
|
5901 |
s2 skipSeparators. |
|
5902 |
s2 peek == $' ifTrue:[ |
|
5903 |
s2 next. |
|
5904 |
w := s2 upTo:$'. |
|
5905 |
s2 skipSeparators. |
|
5906 |
] ifFalse:[ |
|
5907 |
w := s2 upToSeparator |
|
5908 |
]. |
|
5909 |
words add:w |
|
5910 |
]. |
|
5911 |
words size < 3 ifTrue:[ |
|
5912 |
'Smalltalk [warning]: bad abbrev entry' errorPrint. |
|
5913 |
anAbbrevFileStream isFileStream ifTrue:[ |
|
5914 |
' (in ''' errorPrint. |
|
5915 |
anAbbrevFileStream pathName errorPrint. |
|
5916 |
''')' errorPrint |
|
5917 |
]. |
|
5918 |
': ' errorPrint. l errorPrintCR |
|
5919 |
] ifFalse:[ |
|
5920 |
clsName := (words at:1) asSymbol. |
|
5921 |
abbrev := (words at:2). |
|
5922 |
package := (words at:3) asSymbol. |
|
5923 |
cat := words at:4 ifAbsent:nil. |
|
5924 |
numClassInstVars := words at:5 ifAbsent:'0'. |
|
5925 |
numClassInstVars := Integer readFrom:numClassInstVars onError:[0]. |
|
5926 |
||
5927 |
(cat size == 0) ifTrue:[ |
|
5928 |
cat := 'autoloaded' |
|
5929 |
]. |
|
5930 |
||
5931 |
"/ on the fly, update the abbreviations |
|
5932 |
self setFilename:abbrev forClass:clsName package:package. |
|
5933 |
||
5934 |
"/ ' autoloaded: ' print. clsName print. ' in ' print. cat printCR. |
|
5935 |
||
5936 |
cls := self |
|
5937 |
installAutoloadedClassNamed:clsName |
|
5938 |
category:cat |
|
5939 |
package:package |
|
5940 |
revision:nil |
|
5941 |
numClassInstVars:numClassInstVars. |
|
10641 | 5942 |
|
5943 |
"/ info notNil ifTrue:[ |
|
5944 |
"/ cls setComment:info. |
|
5945 |
"/ ]. |
|
22791 | 5946 |
] |
5947 |
] |
|
5948 |
] |
|
4458 | 5949 |
] |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5950 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5951 |
|
10641 | 5952 |
loadBinaries |
5953 |
"return true, if binaries should be loaded into the system, |
|
5954 |
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
|
5955 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5956 |
^ LoadBinaries |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5957 |
! |
3044 | 5958 |
|
10641 | 5959 |
loadBinaries:aBoolean |
5960 |
"{ Pragma: +optSpace }" |
|
5961 |
||
5962 |
"turn on/off loading of binary objects" |
|
5963 |
||
5964 |
aBoolean ifTrue:[ |
|
18668 | 5965 |
(ObjectFileLoader notNil and:[ObjectFileLoader canLoadObjectFiles]) ifTrue:[ |
5966 |
LoadBinaries := true. |
|
5967 |
^ self |
|
5968 |
]. |
|
5969 |
'Smalltalk [info]: this system does not support binary loading' infoPrintCR. |
|
10641 | 5970 |
]. |
5971 |
LoadBinaries := false |
|
5972 |
||
5973 |
"Modified: 10.1.1997 / 15:11:00 / cg" |
|
5974 |
! |
|
5975 |
||
5976 |
logDoits |
|
5977 |
"return true if doits should go into the changes file |
|
5978 |
as well as changes - by default, this is off, since |
|
5979 |
it can blow up the changes file enormously ... |
|
5980 |
" |
|
5981 |
||
5982 |
^ LogDoits |
|
5983 |
||
5984 |
" |
|
5985 |
LogDoits := false |
|
3044 | 5986 |
LogDoits := true |
5987 |
" |
|
5988 |
! |
|
5989 |
||
10641 | 5990 |
logDoits:aBoolean |
5991 |
"{ Pragma: +optSpace }" |
|
5992 |
||
5993 |
"turn on/off logging of doits in the changes file. |
|
5994 |
By default, this is off, since it can blow up the |
|
5995 |
changes file enormously ... |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5996 |
" |
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 |
LogDoits := aBoolean |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5999 |
|
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 |
|
10641 | 6002 |
makeBytecodeMethods |
6003 |
"{ Pragma: +optSpace }" |
|
6004 |
||
6005 |
"walk over all methods and make each a bytecode method |
|
6006 |
iff it does not contain primitive C code. |
|
6007 |
Experimental and not yet used." |
|
6008 |
||
6009 |
Method allSubInstancesDo:[:aMethod | |
|
22791 | 6010 |
|newMethod| |
6011 |
||
6012 |
aMethod hasPrimitiveCode ifFalse:[ |
|
18707 | 6013 |
"/ aMethod errorPrintCR. |
22791 | 6014 |
newMethod := aMethod asByteCodeMethod. |
6015 |
newMethod ~~ aMethod ifTrue:[ |
|
6016 |
newMethod isNil ifTrue:[ |
|
6017 |
'Smalltalk>>makeBytecodeMethods could nor recompile: ' errorPrint. aMethod errorPrintCR. |
|
6018 |
] ifFalse:[ |
|
6019 |
aMethod becomeSameAs:newMethod |
|
6020 |
]. |
|
6021 |
] |
|
6022 |
]. |
|
10641 | 6023 |
]. |
6024 |
||
6025 |
" |
|
6026 |
Smalltalk makeBytecodeMethods |
|
6027 |
" |
|
6028 |
||
6029 |
"Modified: 16.1.1997 / 01:25:58 / cg" |
|
6030 |
"Created: 17.10.1997 / 13:52:19 / cg" |
|
6031 |
! |
|
6032 |
||
14269
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6033 |
recursiveInstallAutoloadedClassesFrom:aTopDirectory |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6034 |
"scan all packages and install all classes found there as |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6035 |
autoloaded. This takes some time ..." |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6036 |
|
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6037 |
|dirsConsulted| |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6038 |
|
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6039 |
dirsConsulted := Set new. |
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 |
self |
22791 | 6042 |
recursiveInstallAutoloadedClassesFrom:aTopDirectory |
6043 |
rememberIn:dirsConsulted |
|
6044 |
maxLevels:15 |
|
6045 |
noAutoload:false |
|
6046 |
packageTop:nil |
|
6047 |
showSplashInLevels:-1. |
|
14269
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6048 |
|
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6049 |
|
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6050 |
" |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6051 |
Smalltalk recursiveInstallAutoloadedClassesFrom:'..\..\..\cg\private\euler' |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6052 |
" |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6053 |
|
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6054 |
"Created: / 31-07-2012 / 15:27:40 / cg" |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6055 |
! |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6056 |
|
10641 | 6057 |
recursiveInstallAutoloadedClassesFrom:aDirectory rememberIn:dirsConsulted maxLevels:maxLevels noAutoload:noAutoloadIn packageTop:packageTopPath |
6058 |
"read all abbrev.stc files from and under aDirectory |
|
6059 |
and install autoloaded classes. |
|
15783 | 6060 |
If a file called NOAUTOLOAD is found, no classes there are installed as autoloaded, |
6061 |
but classes in subdirectories are installed, if the subdirectory contains a file |
|
6062 |
named AUTOLOAD. |
|
6063 |
If a file called NOSUBAUTOLOAD is found, no classes there and below are installed as autoloaded. |
|
10641 | 6064 |
If a file called NOPACKAGES is found, no further searching is done in that directory or below." |
6065 |
||
11391 | 6066 |
self |
18668 | 6067 |
recursiveInstallAutoloadedClassesFrom:aDirectory rememberIn:dirsConsulted |
6068 |
maxLevels:maxLevels noAutoload:noAutoloadIn packageTop:packageTopPath |
|
6069 |
showSplashInLevels:0. |
|
11391 | 6070 |
|
6071 |
" |
|
6072 |
Smalltalk installAutoloadedClasses |
|
6073 |
" |
|
6074 |
||
6075 |
"Modified: / 17-08-2006 / 16:48:43 / cg" |
|
6076 |
! |
|
6077 |
||
12022 | 6078 |
recursiveInstallAutoloadedClassesFrom:aDirectory rememberIn:dirsConsulted |
11391 | 6079 |
maxLevels:maxLevels noAutoload:noAutoloadIn packageTop:packageTopPath |
6080 |
showSplashInLevels:showSplashInLevels |
|
6081 |
"read all abbrev.stc files from and under aDirectory |
|
6082 |
and install autoloaded classes. |
|
15783 | 6083 |
If a file called NOAUTOLOAD is found, no classes there are installed as autoloaded, |
6084 |
but classes in subdirectories are installed, if the subdirectory contains a file |
|
6085 |
named AUTOLOAD. |
|
6086 |
If a file called NOSUBAUTOLOAD is found, no classes there and below are installed as autoloaded. |
|
11391 | 6087 |
If a file called NOPACKAGES is found, no further searching is done in that directory or below." |
6088 |
||
15783 | 6089 |
|dir noAutoloadHere dirName directoryContents haveAbbrevDotSTC| |
10641 | 6090 |
|
6091 |
dir := aDirectory asFilename. |
|
15958 | 6092 |
|
6093 |
"/ Care for non-existent directories" |
|
6094 |
dir exists ifFalse:[ ^ self ]. |
|
6095 |
||
15783 | 6096 |
dirName := dir physicalPathName. "take care of symbolic links" |
11392 | 6097 |
|
6098 |
(dirsConsulted includes:dirName) ifTrue:[ |
|
22791 | 6099 |
^ self |
10641 | 6100 |
]. |
6101 |
||
12377 | 6102 |
(dir / 'NOPACKAGES') exists ifTrue:[ |
22791 | 6103 |
^ self. |
10641 | 6104 |
]. |
12377 | 6105 |
(dir / 'NOSUBAUTOLOAD') exists ifTrue:[ |
22791 | 6106 |
^ self. |
10641 | 6107 |
]. |
11392 | 6108 |
|
15783 | 6109 |
maxLevels == 0 ifTrue:[ |
22791 | 6110 |
Transcript showCR:('Autoload: max directory nesting reached in %1' bindWith:dir pathName). |
6111 |
^ self |
|
15783 | 6112 |
]. |
6113 |
||
6114 |
dirsConsulted add:dirName. |
|
10641 | 6115 |
noAutoloadHere := noAutoloadIn. |
6116 |
noAutoloadHere ifFalse:[ |
|
22791 | 6117 |
(dir / 'NOAUTOLOAD') exists ifTrue:[ |
6118 |
noAutoloadHere := true. |
|
6119 |
]. |
|
10641 | 6120 |
] ifTrue:[ |
22791 | 6121 |
(dir / 'AUTOLOAD') exists ifTrue:[ |
6122 |
noAutoloadHere := false. |
|
6123 |
]. |
|
10641 | 6124 |
]. |
6125 |
||
11393 | 6126 |
showSplashInLevels >= 0 ifTrue:[ |
22791 | 6127 |
self showSplashMessage:('Smalltalk [info]: installing autoloaded classes found under "%1"...' |
6128 |
bindWith:(dirName contractAtBeginningTo:35)). |
|
11392 | 6129 |
]. |
6130 |
||
10641 | 6131 |
"/ |
6132 |
"/ suppress installation as autoloaded in this and everything |
|
6133 |
"/ below; however, still traverse the directories to find packages ... |
|
6134 |
"/ |
|
15596 | 6135 |
haveAbbrevDotSTC := false. |
10641 | 6136 |
noAutoloadHere ifFalse:[ |
22791 | 6137 |
[ |
6138 |
self installAutoloadedClassesFromAbbrevFile:(dir / 'abbrev.stc'). |
|
6139 |
haveAbbrevDotSTC := true. |
|
6140 |
] on:FileStream openErrorSignal |
|
6141 |
do:[:ex| |
|
6142 |
"ignore this file" |
|
6143 |
]. |
|
10641 | 6144 |
]. |
6145 |
||
6146 |
[ |
|
22791 | 6147 |
directoryContents := dir directoryContents. |
10641 | 6148 |
] on:FileStream openErrorSignal do:[:ex| |
22791 | 6149 |
"non-accessible directory: we are done" |
6150 |
^ self |
|
16199 | 6151 |
]. |
6152 |
||
6153 |
directoryContents := directoryContents select:[:fn | (fn startsWith:'.') not] as:Set. |
|
10641 | 6154 |
|
12911
0822e257daeb
comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents:
12883
diff
changeset
|
6155 |
directoryContents removeAllFoundIn:#( |
22791 | 6156 |
'objbc' 'objvc' 'objmingw' |
6157 |
'doc' |
|
6158 |
'CVS' |
|
6159 |
'bitmaps' |
|
6160 |
'resources' |
|
6161 |
'source' |
|
6162 |
'not_delivered' |
|
6163 |
'not_ported' |
|
6164 |
). |
|
12911
0822e257daeb
comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents:
12883
diff
changeset
|
6165 |
dir baseName = 'stx' ifTrue:[ |
22791 | 6166 |
directoryContents removeAllFoundIn:#( |
6167 |
'configurations' |
|
6168 |
'include' |
|
6169 |
'rules' |
|
6170 |
'stc' |
|
6171 |
'support' |
|
6172 |
). |
|
12911
0822e257daeb
comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents:
12883
diff
changeset
|
6173 |
]. |
0822e257daeb
comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents:
12883
diff
changeset
|
6174 |
|
0822e257daeb
comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents:
12883
diff
changeset
|
6175 |
directoryContents do:[:eachFilenameString | |
22791 | 6176 |
|f| |
6177 |
||
6178 |
f := dir / eachFilenameString. |
|
6179 |
f isDirectory ifTrue:[ |
|
6180 |
self |
|
6181 |
recursiveInstallAutoloadedClassesFrom:f |
|
6182 |
rememberIn:dirsConsulted |
|
6183 |
maxLevels:maxLevels-1 |
|
6184 |
noAutoload:noAutoloadHere |
|
6185 |
packageTop:packageTopPath |
|
6186 |
showSplashInLevels:showSplashInLevels - 1. |
|
6187 |
] ifFalse:[ |
|
6188 |
(noAutoloadHere not and:[haveAbbrevDotSTC not]) ifTrue:[ |
|
6189 |
f suffix = 'st' ifTrue:[ |
|
6190 |
[ |
|
6191 |
self installAutoloadedClassFromSourceFile:f. |
|
6192 |
f directory baseName = 'libbasic' ifTrue:[self halt]. |
|
6193 |
] on:FileStream openErrorSignal do:[:ex| |
|
6194 |
"ignore this file, but write a warning" |
|
6195 |
Transcript showCR:('Autoload: cannot install %1. (%2)' bindWith:f pathName with:ex description). |
|
6196 |
]. |
|
6197 |
] |
|
6198 |
]. |
|
6199 |
] |
|
10641 | 6200 |
]. |
6201 |
||
11393 | 6202 |
showSplashInLevels >= 0 ifTrue:[ |
22791 | 6203 |
self showSplashMessage:('Smalltalk [info]: installing autoloaded classes from "%1"...' |
6204 |
bindWith:(dirName contractAtBeginningTo:35)). |
|
11392 | 6205 |
]. |
6206 |
||
10641 | 6207 |
" |
6208 |
Smalltalk installAutoloadedClasses |
|
6209 |
" |
|
6210 |
||
15596 | 6211 |
"Modified: / 01-08-2013 / 16:57:49 / cg" |
10641 | 6212 |
! |
6213 |
||
6214 |
replaceReferencesTo:anObject with:newRef |
|
12194
208afdcf182b
comment/format in: #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
12172
diff
changeset
|
6215 |
"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
|
6216 |
Return true, if any reference was changed. |
208afdcf182b
comment/format in: #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
12172
diff
changeset
|
6217 |
Notice: this does not change the class-reference." |
208afdcf182b
comment/format in: #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
12172
diff
changeset
|
6218 |
|
10641 | 6219 |
|toAdd| |
6220 |
||
6221 |
toAdd := OrderedCollection new. |
|
6222 |
self keysAndValuesDo:[:key :val | |
|
18668 | 6223 |
(key == anObject) ifTrue:[ |
6224 |
self shouldImplement. |
|
6225 |
]. |
|
6226 |
(val == anObject ) ifTrue:[ |
|
6227 |
toAdd add:(key -> newRef) |
|
6228 |
]. |
|
10641 | 6229 |
]. |
6230 |
toAdd do:[:each | |
|
18668 | 6231 |
self at:(each key) put:(each value) |
10641 | 6232 |
]. |
6233 |
! |
|
6234 |
||
6235 |
saveEmergencyImage:aBoolean |
|
6236 |
"set/clear the flag which controls if ST/X should save an |
|
6237 |
emergency image in case of a broken display connection. |
|
6238 |
The default is true. |
|
6239 |
This may be useful, if you work with an unsecure display |
|
6240 |
(serial line), and want to have a chance of proceeding after |
|
6241 |
a crash. In multiheaded applications, this only affects |
|
6242 |
crashes of the master Display connection (the initial connection); |
|
6243 |
errors on other displays are reported to the views and treated |
|
6244 |
like window destroy from the windowManager." |
|
6245 |
||
6246 |
SaveEmergencyImage := aBoolean |
|
6247 |
||
6248 |
"Modified: / 24.10.1997 / 18:22:26 / cg" |
|
6249 |
! |
|
6250 |
||
6251 |
systemOrganization |
|
6252 |
"for partial ST80 compatibility; |
|
6253 |
In ST80, Smalltalk organization returns a systemOrganizer, which |
|
6254 |
keeps track of class-categories, while all classes return a classOrganizer |
|
6255 |
from #organization, which keeps track of method categories of that class. |
|
6256 |
Since in ST/X, Smalltalk is a class, there is now a conflict. |
|
6257 |
To make a workaround possible, use #systemOrganization when porting |
|
6258 |
VW apps to ST/X to get the class-categories. |
|
6259 |
Read the documentation in SystemOrganizer for more info." |
|
6260 |
||
6261 |
^ SystemOrganizer for:nil |
|
6262 |
||
6263 |
"Created: / 20.6.1998 / 12:24:02 / cg" |
|
6264 |
"Modified: / 20.6.1998 / 12:41:34 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6265 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6266 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6267 |
!Smalltalk class methodsFor:'system management-fileIn'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6268 |
|
10641 | 6269 |
fileIn:aFileName |
6270 |
"read in the named file - look for it in some standard places; |
|
6271 |
return true if ok, false if failed. |
|
6272 |
This method can load almost anything which makes sense: |
|
18668 | 6273 |
.st - source files |
6274 |
.cls - binary smalltalk bytecode files |
|
6275 |
.so - binary compiled machine code class libraries |
|
6276 |
[.class - java bytecode -- soon to come]" |
|
10641 | 6277 |
|
6278 |
^ self fileIn:aFileName lazy:nil silent:nil logged:false |
|
6279 |
||
6280 |
" |
|
6281 |
Smalltalk fileIn:'source/TicTacToe.st' |
|
6282 |
Smalltalk fileIn:'binary/TicTacToe.cls' |
|
6283 |
Smalltalk fileIn:'binary/TicTacToe.so' |
|
6284 |
" |
|
6285 |
||
6286 |
"Created: 28.10.1995 / 17:06:28 / cg" |
|
6287 |
! |
|
6288 |
||
6289 |
fileIn:aFileName inPackage:aPackageID |
|
6290 |
"read in the named file in a packages directory." |
|
6291 |
||
6292 |
|dir| |
|
6293 |
||
6294 |
dir := self getPackageDirectoryForPackage:aPackageID. |
|
6295 |
dir isNil ifTrue:[^ false]. |
|
6296 |
||
6297 |
dir := dir asFilename. |
|
6298 |
^ (self fileIn:(dir construct:aFileName)) |
|
6299 |
or:[ self fileIn:((dir construct:'source') construct:aFileName) ] |
|
6300 |
! |
|
6301 |
||
6302 |
fileIn:aFileName lazy:lazy |
|
6303 |
"read in the named file - look for it in some standard places; |
|
6304 |
return true if ok, false if failed. |
|
6305 |
If lazy is true, no code is generated for methods, instead stubs |
|
6306 |
are created which compile themself when first executed. This allows |
|
6307 |
for much faster fileIn (but slows down the first execution later). |
|
6308 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
6309 |
code which is known to be syntactically correct." |
|
6310 |
||
6311 |
^ self fileIn:aFileName lazy:lazy silent:nil logged:false |
|
6312 |
||
6313 |
" |
|
6314 |
Smalltalk fileIn:'source/TicTacToe.st' lazy:true |
|
6315 |
" |
|
6316 |
||
6317 |
"Created: 28.10.1995 / 17:06:36 / cg" |
|
6318 |
! |
|
6319 |
||
6320 |
fileIn:aFileName lazy:lazy silent:silent |
|
6321 |
"read in the named file - look for it in some standard places; |
|
6322 |
return true if ok, false if failed. |
|
6323 |
If lazy is true, no code is generated for methods, instead stubs |
|
6324 |
are created which compile themself when first executed. This allows |
|
6325 |
for much faster fileIn (but slows down the first execution later). |
|
6326 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
6327 |
code which is known to be syntactically correct. |
|
6328 |
If silent is true, no compiler messages are output to the transcript. |
|
6329 |
Giving nil for silent/lazy will use the current settings." |
|
6330 |
||
6331 |
^ self fileIn:aFileName lazy:lazy silent:silent logged:false |
|
6332 |
||
6333 |
"Created: 28.10.1995 / 17:06:41 / cg" |
|
6334 |
! |
|
6335 |
||
6336 |
fileIn:aFileNameOrString lazy:lazy silent:silent logged:logged |
|
6337 |
"read in the named file - look for it in some standard places; |
|
6338 |
return true if ok, false if failed. |
|
6339 |
If lazy is true, no code is generated for methods, instead stubs |
|
6340 |
are created which compile themself when first executed. This allows |
|
6341 |
for much faster fileIn (but slows down the first execution later). |
|
6342 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
6343 |
code which is known to be syntactically correct. |
|
6344 |
If silent is true, no compiler messages are output to the transcript. |
|
6345 |
Giving nil for silent/lazy will use the current settings. |
|
6346 |
This method can load almost anything which makes sense: |
|
22791 | 6347 |
.st - source files |
6348 |
.cls - binary smalltalk bytecode files |
|
6349 |
.so - binary compiled machine code class libraries |
|
6350 |
[.class - java bytecode -- soon to come]" |
|
15594 | 6351 |
|
15665 | 6352 |
|fileNameString inStream path morePath bos| |
10641 | 6353 |
|
6354 |
fileNameString := aFileNameOrString asString. |
|
6355 |
||
6356 |
" |
|
6357 |
an object or shared object ? |
|
6358 |
" |
|
6359 |
(ObjectFileLoader notNil |
|
22691 | 6360 |
and:[ObjectFileLoader hasValidBinaryExtension:fileNameString]) ifTrue:[ |
22791 | 6361 |
"/ LoadBinaries ifFalse:[^ false]. |
6362 |
path := self getBinaryFileName:fileNameString. |
|
6363 |
path isNil ifTrue:[ |
|
6364 |
path := self getSystemFileName:fileNameString. |
|
6365 |
path isNil ifTrue:[ |
|
6366 |
^ false |
|
6367 |
]. |
|
6368 |
]. |
|
6369 |
^ (ObjectFileLoader loadObjectFile:path) notNil |
|
15594 | 6370 |
]. |
6371 |
||
6372 |
inStream := self systemFileStreamFor:fileNameString. |
|
6373 |
inStream isNil ifTrue:[^ false]. |
|
10641 | 6374 |
|
22691 | 6375 |
(aFileNameOrString asFilename hasSuffix:'cls') ifTrue:[ |
22791 | 6376 |
BinaryObjectStorage isNil ifTrue:[ |
6377 |
^ false. |
|
6378 |
]. |
|
6379 |
[ |
|
6380 |
inStream binary. |
|
6381 |
bos := BinaryObjectStorage onOld:inStream. |
|
6382 |
bos next. |
|
6383 |
] ensure:[ |
|
6384 |
bos close. |
|
6385 |
]. |
|
6386 |
^ true |
|
15594 | 6387 |
]. |
10641 | 6388 |
|
6389 |
(fileNameString includes:$/) ifTrue:[ |
|
22791 | 6390 |
"/ temporarily prepend the file's directory |
6391 |
"/ to the searchPath. |
|
6392 |
"/ This allows fileIn-driver files to refer to local |
|
6393 |
"/ files via a relative path, and drivers to fileIn other |
|
6394 |
"/ drivers ... |
|
6395 |
morePath := inStream fileName directoryName. |
|
15594 | 6396 |
]. |
15665 | 6397 |
^ self fileInStream:inStream lazy:lazy silent:silent logged:logged addPath:morePath |
15594 | 6398 |
|
6399 |
" |
|
6400 |
Smalltalk fileIn:'clients/TicTacToe/TicTacToe.st' lazy:true silent:true |
|
6401 |
Smalltalk fileIn:'keyboard.rc' |
|
10641 | 6402 |
" |
6403 |
||
6404 |
"Modified: / 08-09-2006 / 19:21:16 / cg" |
|
22691 | 6405 |
"Modified: / 23-04-2018 / 17:05:33 / stefan" |
10641 | 6406 |
! |
6407 |
||
6408 |
fileIn:aFileName logged:logged |
|
6409 |
"read in the named file - look for it in some standard places; |
|
6410 |
return true if ok, false if failed. |
|
6411 |
The argument logged controls, if the changefile is to be updated." |
|
6412 |
||
6413 |
^ self fileIn:aFileName lazy:nil silent:nil logged:logged |
|
6414 |
||
6415 |
" |
|
6416 |
Smalltalk fileIn:'source/TicTacToe.st' logged:false |
|
6417 |
" |
|
6418 |
! |
|
6419 |
||
6420 |
fileIn:aFileName silent:silent |
|
6421 |
"read in the named file - look for it in some standard places; |
|
6422 |
return true if ok, false if failed. |
|
6423 |
If silent is true, no compiler messages are output to the transcript." |
|
6424 |
||
6425 |
^ self fileIn:aFileName lazy:nil silent:silent logged:false |
|
6426 |
||
6427 |
" |
|
6428 |
Smalltalk fileIn:'source/TicTacToe.st' silent:true |
|
6429 |
" |
|
6430 |
||
6431 |
"Created: 28.10.1995 / 17:06:36 / cg" |
|
6432 |
! |
|
6433 |
||
6434 |
fileInChanges |
|
6435 |
"read in the last changes file - bringing the system to the state it |
|
6436 |
had when left the last time. |
|
6437 |
WARNING: this method is rubbish: it should only read things after the |
|
18668 | 6438 |
last '**snapshot**' - entry |
6439 |
(instead of the complete changes file)." |
|
10641 | 6440 |
|
6441 |
" |
|
6442 |
do NOT update the changes file now ... |
|
6443 |
" |
|
6444 |
self fileIn:ChangeFileName logged:false |
|
6445 |
||
6446 |
" |
|
10071 | 6447 |
Smalltalk fileInChanges |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6448 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6449 |
! |
1 | 6450 |
|
10641 | 6451 |
fileInClass:aClassName |
6452 |
"find a source/object file for aClassName and -if found - load it. |
|
6453 |
search is in some standard places trying driver-file (.ld), object-file (.o) and |
|
6454 |
finally source file (.st) in that order. |
|
6455 |
The file is first searched for using the class name, then the abbreviated name." |
|
6456 |
||
6457 |
^ self |
|
18668 | 6458 |
fileInClass:aClassName |
6459 |
package:nil |
|
6460 |
initialize:true |
|
6461 |
lazy:false |
|
6462 |
silent:nil |
|
10641 | 6463 |
|
6464 |
"Modified: / 9.1.1998 / 14:41:46 / cg" |
|
6465 |
! |
|
6466 |
||
6467 |
fileInClass:aClassName fromObject:aFileName |
|
6468 |
"read in the named object file and dynamic-link it into the system |
|
6469 |
- look for it in some standard places. |
|
6470 |
Only install the named class from this object file. |
|
6471 |
Return true if ok, false if failed." |
|
6472 |
||
6473 |
|path ok| |
|
6474 |
||
6475 |
" |
|
6476 |
check if the dynamic loader class is in |
|
6477 |
" |
|
6478 |
(LoadBinaries not or:[ObjectFileLoader isNil]) ifTrue:[^ false]. |
|
6479 |
||
6480 |
(path := self getBinaryFileName:aFileName) isNil ifTrue:[^ false]. |
|
6481 |
ok := (ObjectFileLoader loadClass:aClassName fromObjectFile:path) notNil. |
|
6482 |
ok ifTrue:[ |
|
18668 | 6483 |
VerboseLoading ifTrue:[ |
6484 |
Transcript show:' loaded ' , aClassName , ' from ' ; showCR:aFileName. |
|
6485 |
] |
|
10641 | 6486 |
]. |
6487 |
^ ok |
|
6488 |
||
6489 |
" |
|
6490 |
Smalltalk fileInClass:'AbstractPath' fromObject:'../../goodies/Paths/AbstrPath.so' |
|
6491 |
Smalltalk fileInClass:'ClockView' fromObject:'../../libwidg3/libwidg3.so' |
|
6492 |
" |
|
6493 |
||
13814 | 6494 |
"Modified: / 04-11-2011 / 13:42:24 / cg" |
10641 | 6495 |
! |
6496 |
||
6497 |
fileInClass:aClassName initialize:doInit |
|
6498 |
"find a source/object file for aClassName and -if found - load it. |
|
6499 |
search is in some standard places trying driver-file (.ld), object-file (.o) and |
|
6500 |
finally source file (.st) in that order. |
|
6501 |
The file is first searched for using the class name, then the abbreviated name." |
|
6502 |
||
6503 |
^ self |
|
18668 | 6504 |
fileInClass:aClassName |
6505 |
package:nil |
|
6506 |
initialize:doInit |
|
6507 |
lazy:false |
|
6508 |
silent:nil |
|
10641 | 6509 |
|
6510 |
"Modified: / 9.1.1998 / 14:42:02 / cg" |
|
6511 |
! |
|
6512 |
||
6513 |
fileInClass:aClassName initialize:doInit lazy:loadLazy |
|
6514 |
"find a source/object file for aClassName and -if found - load it. |
|
6515 |
search is in some standard places trying driver-file (.ld), object-file (.o) and |
|
6516 |
finally source file (.st) in that order. |
|
6517 |
The file is first searched for using the class name, then the abbreviated name." |
|
6518 |
||
6519 |
^ self |
|
18668 | 6520 |
fileInClass:aClassName |
6521 |
package:nil |
|
6522 |
initialize:doInit |
|
6523 |
lazy:loadLazy |
|
6524 |
silent:nil |
|
10641 | 6525 |
|
6526 |
"Modified: / 9.1.1998 / 14:42:19 / cg" |
|
6527 |
! |
|
6528 |
||
6529 |
fileInClass:aClassName initialize:doInit lazy:loadLazy silent:beSilent |
|
6530 |
"find a source/object file for aClassName and -if found - load it. |
|
6531 |
Search is in some standard places, trying driver-file (.ld), object-file (.so / .o) and |
|
6532 |
finally source file (.st), in that order. |
|
6533 |
The file is first searched for using the class name, then the abbreviated name. |
|
6534 |
The argument doInit controlls if the class should be sent a #initialize after the |
|
19867 | 6535 |
load; loadLazy tells if it should be loaded lazily. beSilent tells if the compiler |
10641 | 6536 |
should not send notes to the transcript; it can be true, false or nil, where |
6537 |
nil uses the value from SilentLoading." |
|
6538 |
||
6539 |
^ self |
|
22791 | 6540 |
fileInClass:aClassName |
6541 |
package:nil |
|
6542 |
initialize:doInit |
|
6543 |
lazy:loadLazy |
|
6544 |
silent:beSilent |
|
10641 | 6545 |
|
6546 |
"Modified: / 9.1.1998 / 14:42:28 / cg" |
|
6547 |
! |
|
6548 |
||
6549 |
fileInClass:aClassName package:package |
|
6550 |
"find a source/object file for aClassName and -if found - load it. |
|
6551 |
search is in some standard places trying driver-file (.ld), object-file (.o) and |
|
6552 |
finally source file (.st) in that order. |
|
6553 |
The file is first searched for using the class name, then the abbreviated name." |
|
6554 |
||
6555 |
^ self |
|
18668 | 6556 |
fileInClass:aClassName |
6557 |
package:package |
|
6558 |
initialize:true |
|
6559 |
lazy:false |
|
6560 |
silent:nil |
|
10641 | 6561 |
|
6562 |
"Created: / 08-01-2007 / 10:06:09 / cg" |
|
6563 |
! |
|
6564 |
||
10999 | 6565 |
fileInClass:aClassName package:package initialize:doInit lazy:loadLazy silent:beSilent |
10641 | 6566 |
"find a source/object file for aClassName and -if found - load it. |
6567 |
This is the workhorse for autoloading. |
|
10999 | 6568 |
Search is in some standard places, trying driver-file (.ld), object-file (.so / .o) and |
10641 | 6569 |
finally source file (.st), in that order. |
6570 |
The file is first searched for using the class name, then the abbreviated name. |
|
6571 |
The argument doInit controlls if the class should be sent a #initialize after the |
|
19867 | 6572 |
load; loadLazy tells if it should be loaded lazily. beSilent tells if the compiler |
10641 | 6573 |
should not send notes to the transcript; it can be true, false or nil, where |
6574 |
nil uses the value from SilentLoading." |
|
6575 |
||
10999 | 6576 |
|classFileName alternativeClassFileName libName newClass ok wasLazy wasSilent sharedLibExtension inStream mgr |
10641 | 6577 |
filenameToSet packageDir packageFile bos| |
6578 |
||
17588 | 6579 |
ClassLoadInProgressQuery answerNotifyLoading:aClassName do:[ |
17582 | 6580 |
|
22791 | 6581 |
wasLazy := Compiler compileLazy:loadLazy. |
6582 |
beSilent notNil ifTrue:[ |
|
6583 |
wasSilent := self silentLoading:beSilent. |
|
6584 |
]. |
|
6585 |
||
6586 |
classFileName := Smalltalk fileNameForClass:aClassName. |
|
6587 |
(classFileName = aClassName) ifTrue:[ |
|
6588 |
"/ no abbrev.stc translation for className |
|
6589 |
(aClassName includes:$:) ifTrue:[ |
|
6590 |
"/ a nameSpace name |
|
6591 |
alternativeClassFileName := classFileName copyFrom:(classFileName lastIndexOf:$:)+1 |
|
6592 |
]. |
|
6593 |
]. |
|
6594 |
||
6595 |
classFileName asFilename isAbsolute ifTrue:[ |
|
6596 |
classFileName asFilename suffix notEmptyOrNil ifTrue:[ |
|
6597 |
ok := self fileIn:classFileName lazy:loadLazy silent:beSilent. |
|
6598 |
] ifFalse:[ |
|
6599 |
ok := self fileInSourceFile:classFileName lazy:loadLazy silent:beSilent. |
|
6600 |
] |
|
6601 |
] ifFalse:[ |
|
6602 |
classFileName := classFileName copyReplaceAll:$: with:$_ ifNone:classFileName. |
|
6603 |
[ |
|
6604 |
Class withoutUpdatingChangesDo:[ |
|
6605 |
|zarFn zar entry| |
|
6606 |
||
6607 |
ok := false. |
|
6608 |
||
6609 |
package notNil ifTrue:[ |
|
6610 |
packageDir := package asPackageId packageDirectory. |
|
6611 |
"/ packageDir := package asString. |
|
6612 |
"/ packageDir := packageDir copyReplaceAll:$: with:$/. |
|
6613 |
packageDir isNil ifTrue:[ |
|
6614 |
packageDir := self packageDirectoryForPackageId:package |
|
6615 |
]. |
|
6616 |
packageDir notNil ifTrue:[ |
|
6617 |
packageDir := packageDir asFilename. |
|
6618 |
]. |
|
6619 |
]. |
|
6620 |
||
6621 |
Class packageQuerySignal answer:package do:[ |
|
6622 |
" |
|
6623 |
then, if dynamic linking is available, |
|
6624 |
" |
|
6625 |
(LoadBinaries and:[ObjectFileLoader notNil]) ifTrue:[ |
|
6626 |
sharedLibExtension := ObjectFileLoader sharedLibraryExtension. |
|
6627 |
" |
|
6628 |
first look for a class packages shared binary in binary/xxx.o |
|
6629 |
" |
|
6630 |
libName := self libraryFileNameOfClass:aClassName. |
|
6631 |
libName notNil ifTrue:[ |
|
6632 |
(ok := self fileInClass:aClassName fromObject:(libName, sharedLibExtension)) |
|
6633 |
ifFalse:[ |
|
6634 |
sharedLibExtension ~= '.o' ifTrue:[ |
|
6635 |
ok := self fileInClass:aClassName fromObject:(libName, '.o') |
|
6636 |
] |
|
6637 |
]. |
|
6638 |
]. |
|
6639 |
" |
|
6640 |
then, look for a shared binary in binary/xxx.o |
|
6641 |
" |
|
6642 |
ok ifFalse:[ |
|
6643 |
(ok := self fileInClass:aClassName fromObject:(classFileName, sharedLibExtension)) |
|
6644 |
ifFalse:[ |
|
6645 |
sharedLibExtension ~= '.o' ifTrue:[ |
|
6646 |
ok := self fileInClass:aClassName fromObject:(classFileName, '.o') |
|
6647 |
]. |
|
6648 |
ok ifFalse:[ |
|
6649 |
alternativeClassFileName notNil ifTrue:[ |
|
6650 |
(ok := self fileInClass:aClassName fromObject:(alternativeClassFileName, sharedLibExtension)) |
|
6651 |
ifFalse:[ |
|
6652 |
sharedLibExtension ~= '.o' ifTrue:[ |
|
6653 |
ok := self fileInClass:aClassName fromObject:(alternativeClassFileName, '.o') |
|
6654 |
] |
|
6655 |
] |
|
6656 |
]. |
|
6657 |
]. |
|
6658 |
]. |
|
6659 |
]. |
|
6660 |
]. |
|
6661 |
||
6662 |
" |
|
6663 |
if that did not work, look for a compiled-bytecode file ... |
|
6664 |
" |
|
6665 |
ok ifFalse:[ |
|
6666 |
(ok := self fileIn:(classFileName , '.cls') lazy:loadLazy silent:beSilent) |
|
6667 |
ifFalse:[ |
|
6668 |
alternativeClassFileName notNil ifTrue:[ |
|
6669 |
ok := self fileIn:(alternativeClassFileName , '.cls') lazy:loadLazy silent:beSilent |
|
6670 |
] |
|
6671 |
] |
|
6672 |
]. |
|
6673 |
" |
|
6674 |
if that did not work, and the classes package is known, |
|
6675 |
look for an st-cls file |
|
6676 |
in a package subdir of the source-directory ... |
|
6677 |
" |
|
6678 |
ok ifFalse:[ |
|
6679 |
(packageDir notNil and:[BinaryObjectStorage notNil]) ifTrue:[ |
|
6680 |
packageFile := self getPackageFileName:((packageDir / 'classes' / classFileName) addSuffix:'cls'). |
|
6681 |
packageFile isNil ifTrue:[ |
|
6682 |
packageFile := (packageDir / 'classes' / classFileName) addSuffix:'cls'. |
|
6683 |
]. |
|
6684 |
(ok := self fileIn:packageFile lazy:loadLazy silent:beSilent) |
|
6685 |
ifFalse:[ |
|
6686 |
alternativeClassFileName notNil ifTrue:[ |
|
6687 |
packageFile := self getPackageFileName:((packageDir / 'classes' / alternativeClassFileName) addSuffix:'cls'). |
|
6688 |
packageFile isNil ifTrue:[ |
|
6689 |
packageFile := ((packageDir / 'classes' / alternativeClassFileName) addSuffix:'cls'). |
|
6690 |
]. |
|
6691 |
ok := self fileIn:packageFile lazy:loadLazy silent:beSilent |
|
6692 |
] |
|
6693 |
]. |
|
6694 |
||
6695 |
zarFn := self getPackageFileName:(packageDir / 'classes.zip'). |
|
6696 |
zarFn notNil ifTrue:[ |
|
6697 |
zar := ZipArchive oldFileNamed:zarFn. |
|
6698 |
zar notNil ifTrue:[ |
|
6699 |
entry := zar extract:(classFileName , '.cls'). |
|
6700 |
(entry isNil and:[alternativeClassFileName notNil]) ifTrue:[ |
|
6701 |
entry := zar extract:(alternativeClassFileName , '.cls'). |
|
6702 |
]. |
|
6703 |
entry notNil ifTrue:[ |
|
6704 |
bos := BinaryObjectStorage onOld:(entry asByteArray readStream). |
|
6705 |
bos next. |
|
6706 |
bos close. |
|
6707 |
ok := true |
|
6708 |
]. |
|
6709 |
] |
|
6710 |
] |
|
6711 |
] |
|
6712 |
]. |
|
6713 |
||
6714 |
" |
|
6715 |
if that did not work, look for an st-source file ... |
|
6716 |
" |
|
6717 |
ok ifFalse:[ |
|
6718 |
filenameToSet := classFileName. |
|
6719 |
(ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent) |
|
6720 |
ifFalse:[ |
|
6721 |
alternativeClassFileName notNil ifTrue:[ |
|
6722 |
filenameToSet := alternativeClassFileName. |
|
6723 |
ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent |
|
6724 |
]. |
|
6725 |
ok ifFalse:[ |
|
6726 |
" |
|
6727 |
... and in the standard source-directory |
|
6728 |
" |
|
6729 |
filenameToSet := 'source' asFilename / classFileName. |
|
6730 |
(ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent) |
|
6731 |
ifFalse:[ |
|
6732 |
alternativeClassFileName notNil ifTrue:[ |
|
6733 |
filenameToSet := 'source' asFilename / alternativeClassFileName. |
|
6734 |
ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent |
|
6735 |
] |
|
6736 |
] |
|
6737 |
] |
|
6738 |
]. |
|
6739 |
" |
|
6740 |
if that did not work, and the classes package is known, |
|
6741 |
look for an st-source file |
|
6742 |
in a package subdir of the source-directory ... |
|
6743 |
" |
|
6744 |
ok ifFalse:[ |
|
6745 |
packageDir notNil ifTrue:[ |
|
6746 |
packageFile := self getPackageSourceFileName:(packageDir / 'source' / classFileName). |
|
6747 |
packageFile isNil ifTrue:[ |
|
6748 |
packageFile := (packageDir / 'source' / classFileName). |
|
6749 |
]. |
|
6750 |
filenameToSet := packageFile. |
|
6751 |
(ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent) |
|
6752 |
ifFalse:[ |
|
6753 |
alternativeClassFileName notNil ifTrue:[ |
|
6754 |
packageFile := self getPackageSourceFileName:(packageDir / 'source' / alternativeClassFileName). |
|
6755 |
packageFile isNil ifTrue:[ |
|
6756 |
packageFile := (packageDir / 'source' / alternativeClassFileName). |
|
6757 |
]. |
|
6758 |
filenameToSet := packageFile. |
|
6759 |
ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent |
|
6760 |
]. |
|
6761 |
ok ifFalse:[ |
|
6762 |
packageFile := self getPackageSourceFileName:(packageDir / classFileName). |
|
6763 |
packageFile isNil ifTrue:[ |
|
6764 |
packageFile := (packageDir / classFileName). |
|
6765 |
]. |
|
6766 |
filenameToSet := packageFile. |
|
6767 |
(ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent) |
|
6768 |
ifFalse:[ |
|
6769 |
alternativeClassFileName notNil ifTrue:[ |
|
6770 |
packageFile := self getPackageFileName:(packageDir / alternativeClassFileName). |
|
6771 |
packageFile isNil ifTrue:[ |
|
6772 |
packageFile := packageDir / alternativeClassFileName. |
|
6773 |
]. |
|
6774 |
filenameToSet := packageFile. |
|
6775 |
ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent |
|
6776 |
]. |
|
6777 |
ok ifFalse:[ |
|
6778 |
" |
|
6779 |
... and in the standard source-directory |
|
6780 |
" |
|
6781 |
filenameToSet := 'source' asFilename / packageDir / classFileName. |
|
6782 |
(ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent) |
|
6783 |
ifFalse:[ |
|
6784 |
alternativeClassFileName notNil ifTrue:[ |
|
6785 |
filenameToSet := 'source' asFilename / packageDir / alternativeClassFileName. |
|
6786 |
ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent |
|
6787 |
] |
|
6788 |
] |
|
6789 |
] |
|
6790 |
]. |
|
6791 |
]. |
|
6792 |
]. |
|
6793 |
] |
|
6794 |
]. |
|
6795 |
" |
|
6796 |
if that did not work, and the classes package is known, |
|
6797 |
look for a zipArchive containing a class entry. |
|
6798 |
" |
|
6799 |
ok ifFalse:[ |
|
6800 |
packageDir notNil ifTrue:[ |
|
6801 |
zarFn := self getPackageFileName:(packageDir / 'source.zip'). |
|
6802 |
zarFn isNil ifTrue:[ |
|
6803 |
zarFn := packageDir withSuffix:'zip'. |
|
6804 |
zarFn := self getSourceFileName:zarFn. |
|
6805 |
]. |
|
6806 |
(zarFn notNil and:[zarFn asFilename exists]) ifTrue:[ |
|
6807 |
zar := ZipArchive oldFileNamed:zarFn. |
|
6808 |
zar notNil ifTrue:[ |
|
6809 |
entry := zar extract:(classFileName , '.st'). |
|
6810 |
(entry isNil and:[alternativeClassFileName notNil]) ifTrue:[ |
|
6811 |
entry := zar extract:(alternativeClassFileName , '.st'). |
|
6812 |
]. |
|
6813 |
entry notNil ifTrue:[ |
|
6814 |
filenameToSet := zarFn. |
|
6815 |
ok := self |
|
6816 |
fileInStream:(entry asString readStream) |
|
6817 |
lazy:loadLazy |
|
6818 |
silent:beSilent |
|
6819 |
logged:false |
|
6820 |
addPath:nil |
|
6821 |
]. |
|
6822 |
] |
|
6823 |
] |
|
6824 |
] |
|
6825 |
]. |
|
6826 |
||
6827 |
" |
|
6828 |
if that did not work, |
|
6829 |
look for a zipArchive containing a class entry. |
|
6830 |
" |
|
6831 |
ok ifFalse:[ |
|
6832 |
zarFn := self getSourceFileName:'source.zip'. |
|
6833 |
zarFn notNil ifTrue:[ |
|
6834 |
zar := ZipArchive oldFileNamed:zarFn. |
|
6835 |
zar notNil ifTrue:[ |
|
6836 |
entry := zar extract:(zarFn := classFileName , '.st'). |
|
6837 |
(entry isNil and:[alternativeClassFileName notNil]) ifTrue:[ |
|
6838 |
entry := zar extract:(zarFn := alternativeClassFileName , '.st'). |
|
6839 |
]. |
|
6840 |
entry notNil ifTrue:[ |
|
6841 |
filenameToSet := zarFn. |
|
6842 |
ok := self |
|
6843 |
fileInStream:(entry asString readStream) |
|
6844 |
lazy:loadLazy |
|
6845 |
silent:beSilent |
|
6846 |
logged:false |
|
6847 |
addPath:nil |
|
6848 |
]. |
|
6849 |
] |
|
6850 |
] |
|
6851 |
]. |
|
6852 |
ok ifFalse:[ |
|
6853 |
" |
|
6854 |
if there is a sourceCodeManager, ask it for the classes sourceCode |
|
6855 |
" |
|
6856 |
(mgr := Smalltalk at:#SourceCodeManager) notNil ifTrue:[ |
|
6857 |
inStream := mgr getMostRecentSourceStreamForClassNamed:aClassName inPackage:package. |
|
6858 |
inStream notNil ifTrue:[ |
|
6859 |
filenameToSet := nil. |
|
6860 |
ok := self fileInStream:inStream lazy:loadLazy silent:beSilent logged:false addPath:nil. |
|
6861 |
] |
|
6862 |
]. |
|
6863 |
]. |
|
6864 |
]. |
|
6865 |
] |
|
6866 |
]. |
|
6867 |
] ensure:[ |
|
6868 |
Compiler compileLazy:wasLazy. |
|
6869 |
wasSilent notNil ifTrue:[ |
|
6870 |
self silentLoading:wasSilent |
|
6871 |
] |
|
6872 |
]. |
|
6873 |
]. |
|
6874 |
||
6875 |
ok ifTrue:[ |
|
6876 |
newClass := self at:(aClassName asSymbol). |
|
6877 |
newClass notNil ifTrue:[ |
|
6878 |
"set the classes name - but do not change if already set" |
|
6879 |
filenameToSet notNil ifTrue:[ |
|
6880 |
newClass getClassFilename isNil ifTrue:[ |
|
6881 |
newClass setClassFilename:(filenameToSet asFilename baseName) |
|
6882 |
]. |
|
6883 |
]. |
|
6884 |
||
6885 |
doInit ifTrue:[ |
|
6886 |
newClass initialize |
|
6887 |
] |
|
6888 |
] |
|
6889 |
]. |
|
10641 | 6890 |
]. |
6891 |
||
6892 |
^ newClass |
|
6893 |
||
13415 | 6894 |
"Created: / 09-01-1998 / 14:40:32 / cg" |
6895 |
"Modified: / 05-06-1999 / 14:53:01 / cg" |
|
6896 |
"Modified: / 16-08-2009 / 14:52:53 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
10641 | 6897 |
! |
6898 |
||
6899 |
fileInClassLibrary:aClassLibraryName |
|
6900 |
"find an object file containing a binary class library in some standard places |
|
6901 |
and load it. This install all of its contained classes. |
|
6902 |
Return true if ok, false if not. |
|
6903 |
Notice: the argument may not have an extension (by purpose); |
|
18668 | 6904 |
the sharedLib extension (.dll / .so / .sl) is added here, to |
6905 |
make the caller independent of the underlying operatingSystem." |
|
10641 | 6906 |
|
6907 |
|path fn| |
|
6908 |
||
16144 | 6909 |
ObjectFileLoader isNil ifTrue:[ |
18668 | 6910 |
^ PackageLoadError raiseRequestWith:aClassLibraryName errorString:' - no ObjectFileLoader'. |
16144 | 6911 |
]. |
10641 | 6912 |
|
6913 |
fn := aClassLibraryName asFilename withSuffix:(ObjectFileLoader sharedLibrarySuffix). |
|
6914 |
fn := fn pathName. |
|
6915 |
||
6916 |
path := self getBinaryFileName:fn. |
|
6917 |
path isNil ifTrue:[ |
|
18668 | 6918 |
path := self getSystemFileName:fn. |
16144 | 6919 |
]. |
6920 |
path isNil ifTrue:[ |
|
18668 | 6921 |
^ PackageNotFoundError raiseRequestWith:aClassLibraryName. |
16144 | 6922 |
]. |
6923 |
||
6924 |
(ObjectFileLoader loadObjectFile:path) isNil ifTrue:[ |
|
18668 | 6925 |
^ PackageLoadError raiseRequestWith:aClassLibraryName. |
16144 | 6926 |
]. |
6927 |
^ true. |
|
6928 |
||
10641 | 6929 |
|
6930 |
" |
|
6931 |
Smalltalk fileInClassLibrary:'libtable' |
|
6932 |
Smalltalk fileInClassLibrary:'binary/libwidg3' |
|
6933 |
" |
|
6934 |
||
6935 |
"Modified: 8.1.1997 / 17:58:56 / cg" |
|
6936 |
! |
|
6937 |
||
6938 |
fileInClassLibrary:aClassLibraryName inPackage:packageID |
|
6939 |
"find an object file containing a binary class library in some standard places |
|
6940 |
and load it. This installs all of its contained classes. |
|
6941 |
Return true if ok, false if not. |
|
6942 |
Notice: the argument may not have an extension (by purpose); |
|
18668 | 6943 |
the sharedLib extension (.dll / .so / .sl) is added here, to |
6944 |
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
|
6945 |
|
11690 | 6946 |
|baseName handle libraryFilename packagePath| |
10641 | 6947 |
|
16144 | 6948 |
ObjectFileLoader isNil ifTrue:[ |
18668 | 6949 |
^ PackageLoadError raiseRequestWith:packageID errorString:' - no ObjectFileLoader' |
16144 | 6950 |
]. |
10641 | 6951 |
|
6952 |
baseName := aClassLibraryName asFilename withSuffix:(ObjectFileLoader sharedLibrarySuffix). |
|
6953 |
baseName exists ifTrue:[ |
|
18668 | 6954 |
"/ load local file first... |
6955 |
handle := ObjectFileLoader loadObjectFile:baseName. |
|
12744
80f6da0fee57
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
12700
diff
changeset
|
6956 |
]. |
80f6da0fee57
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
12700
diff
changeset
|
6957 |
handle isNil ifTrue:[ |
18668 | 6958 |
packagePath := self getPackageDirectoryForPackage:packageID. |
6959 |
packagePath isNil ifTrue:[ |
|
6960 |
^ PackageNotFoundError raiseRequestWith:packageID. |
|
6961 |
]. |
|
6962 |
packagePath := packagePath asFilename. |
|
6963 |
libraryFilename := packagePath / baseName. |
|
6964 |
libraryFilename exists ifFalse:[ |
|
6965 |
libraryFilename := nil. |
|
6966 |
#('objbc' 'objvc') do:[:eachPossibleCompiledCodeDir | |
|
6967 |
"in windows, with Borland compiler, DLLs in development environment are under objbc; |
|
6968 |
with MSVC, they are under objvc" |
|
6969 |
libraryFilename isNil ifTrue:[ |
|
6970 |
libraryFilename := packagePath / eachPossibleCompiledCodeDir / baseName. |
|
6971 |
libraryFilename exists ifFalse:[ libraryFilename := nil ] |
|
6972 |
]. |
|
6973 |
]. |
|
6974 |
]. |
|
6975 |
(libraryFilename notNil and:[libraryFilename exists]) ifTrue:[ |
|
6976 |
handle := ObjectFileLoader loadObjectFile:libraryFilename pathName. |
|
6977 |
]. |
|
16144 | 6978 |
]. |
6979 |
||
6980 |
handle isNil ifTrue:[ |
|
18668 | 6981 |
^ PackageNotFoundError raiseRequestWith:packageID. |
16144 | 6982 |
]. |
12744
80f6da0fee57
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
12700
diff
changeset
|
6983 |
"/ handle notNil ifTrue:[ |
80f6da0fee57
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
12700
diff
changeset
|
6984 |
"/ Transcript showCR:(' Smalltalk: loaded %1.' bindWith:libraryFilename pathName). |
80f6da0fee57
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
12700
diff
changeset
|
6985 |
"/ ]. |
16144 | 6986 |
^ true. |
10641 | 6987 |
|
6988 |
" |
|
6989 |
Smalltalk fileInClassLibrary:'libtable' |
|
6990 |
Smalltalk fileInClassLibrary:'binary/libwidg3' |
|
6991 |
Smalltalk fileInClassLibrary:'refactoryBrowser' inPackage:'stx:goodies/refactoryBrowser' |
|
6992 |
" |
|
6993 |
||
13787
1695a24d0fa7
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
13785
diff
changeset
|
6994 |
"Modified: / 08-10-2011 / 00:08:51 / cg" |
10641 | 6995 |
! |
6996 |
||
15073 | 6997 |
fileInSourceFile:filenameArg lazy:loadLazy silent:beSilent |
18560 | 6998 |
"Try all available programming languages for a matching suffix" |
13415 | 6999 |
|
15073 | 7000 |
|filename| |
7001 |
||
7002 |
filename := filenameArg asFilename. |
|
18668 | 7003 |
"/ 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
|
7004 |
"/ | f | |
b088a44b9681
\"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents:
18560
diff
changeset
|
7005 |
"/ |
21338 | 7006 |
"/ "/ 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
|
7007 |
"/ "/ 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
|
7008 |
"/ (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
|
7009 |
"/ (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
|
7010 |
"/ ^ true |
b088a44b9681
\"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents:
18560
diff
changeset
|
7011 |
"/ ]. |
b088a44b9681
\"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents:
18560
diff
changeset
|
7012 |
"/ ] |
b088a44b9681
\"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents:
18560
diff
changeset
|
7013 |
"/ ]. |
b088a44b9681
\"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents:
18560
diff
changeset
|
7014 |
"/ 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
|
7015 |
ProgrammingLanguage allDo:[:lang| | f | |
22791 | 7016 |
f := (filename hasSuffix:lang sourceFileSuffix) |
7017 |
ifTrue:[filename] |
|
7018 |
ifFalse:[filename addSuffix:lang sourceFileSuffix]. |
|
7019 |
(self fileIn:f lazy:loadLazy silent:beSilent) |
|
7020 |
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
|
7021 |
]. |
b088a44b9681
\"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents:
18560
diff
changeset
|
7022 |
|
15073 | 7023 |
^ false |
13415 | 7024 |
|
7025 |
"Created: / 16-08-2009 / 14:45:41 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
7026 |
! |
|
7027 |
||
10641 | 7028 |
fileInStream:streamArg |
7029 |
^ self fileInStream:streamArg lazy:nil silent:nil logged:false addPath:nil |
|
7030 |
! |
|
7031 |
||
7032 |
fileInStream:streamArg lazy:lazy silent:silent logged:logged addPath:morePath |
|
7033 |
"read sourceCode from aStream; |
|
7034 |
return true if ok, false if failed. |
|
7035 |
If lazy is true, no code is generated for methods, instead stubs |
|
7036 |
are created which compile themself when first executed. This allows |
|
7037 |
for much faster fileIn (but slows down the first execution later). |
|
7038 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
7039 |
code which is known to be syntactically correct. |
|
7040 |
If silent is true, no compiler messages are output to the transcript. |
|
7041 |
Giving nil for silent/lazy will use the current settings. |
|
7042 |
If morePath is nonNil, it is prepended to the systemPath temporarily during the |
|
7043 |
fileIn. This allows for st-expressions to refer to more files (i.e. fileIn more) |
|
7044 |
using a relative path." |
|
7045 |
||
11427 | 7046 |
|inStream wasLazy wasSilent oldSystemPath oldRealPath| |
10641 | 7047 |
|
7048 |
inStream := streamArg. |
|
7049 |
inStream isNil ifTrue:[^ false]. |
|
19385 | 7050 |
inStream isLineNumberReadStream ifFalse:[ |
22791 | 7051 |
LineNumberReadStream notNil ifTrue:[ |
7052 |
"/ sigh - is in libbasic2, which is not always present |
|
7053 |
inStream := LineNumberReadStream on:inStream. |
|
7054 |
]. |
|
19385 | 7055 |
]. |
21458 | 7056 |
inStream := EncodedStream decodedStreamFor:inStream. |
10641 | 7057 |
|
7058 |
lazy notNil ifTrue:[wasLazy := Compiler compileLazy:lazy]. |
|
7059 |
silent notNil ifTrue:[wasSilent := self silentLoading:silent]. |
|
7060 |
morePath notNil ifTrue:[ |
|
22791 | 7061 |
oldSystemPath := SystemPath copy. |
7062 |
SystemPath addFirst:morePath. |
|
7063 |
oldRealPath := RealSystemPath. |
|
7064 |
RealSystemPath := nil. |
|
7065 |
]. |
|
7066 |
||
22703 | 7067 |
^ [ |
22791 | 7068 |
(Class updateChangeFileQuerySignal , Class updateChangeListQuerySignal) answer:logged do:[ |
7069 |
"JV: Changed to give ProgrammingLanguage to choose |
|
7070 |
proper reader" |
|
7071 |
((ProgrammingLanguage forStream: inStream) fileInStream: inStream) ~~ #Error |
|
7072 |
] |
|
10641 | 7073 |
] ensure:[ |
22791 | 7074 |
morePath notNil ifTrue:[ |
7075 |
"take care, someone could have changed SystemPath during fileIn!!" |
|
7076 |
(SystemPath copyFrom:2) = oldSystemPath ifTrue:[ |
|
7077 |
SystemPath := oldSystemPath. |
|
7078 |
RealSystemPath := oldRealPath. |
|
7079 |
] ifFalse:[ |
|
7080 |
(oldSystemPath includes:morePath) ifFalse:[ |
|
7081 |
SystemPath remove:morePath ifAbsent:[]. |
|
7082 |
]. |
|
7083 |
RealSystemPath := nil. |
|
7084 |
]. |
|
7085 |
]. |
|
7086 |
lazy notNil ifTrue:[Compiler compileLazy:wasLazy]. |
|
7087 |
silent notNil ifTrue:[self silentLoading:wasSilent]. |
|
7088 |
inStream close |
|
10641 | 7089 |
]. |
7090 |
||
7091 |
" |
|
7092 |
Smalltalk fileInStream:('source/TicTacToe.st' asFilename readStream) lazy:true silent:true |
|
7093 |
" |
|
7094 |
||
13415 | 7095 |
"Modified: / 05-11-1996 / 20:03:35 / cg" |
7096 |
"Modified: / 16-08-2009 / 11:06:05 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
22706 | 7097 |
"Modified: / 24-04-2018 / 23:50:22 / stefan" |
10641 | 7098 |
! |
7099 |
||
7100 |
isClassLibraryLoaded:name |
|
7101 |
"return true, if a particular class library is already loaded" |
|
7102 |
||
7103 |
ObjectMemory |
|
18668 | 7104 |
binaryModuleInfo |
7105 |
do:[:entry | |
|
7106 |
entry type == #classLibrary ifTrue:[ |
|
7107 |
entry libraryName = name ifTrue:[ |
|
7108 |
^ true "/ already loaded |
|
7109 |
] |
|
7110 |
]. |
|
7111 |
]. |
|
10641 | 7112 |
|
7113 |
^ false |
|
7114 |
||
7115 |
" |
|
7116 |
Smalltalk isClassLibraryLoaded:'libstx_libbasic' |
|
7117 |
Smalltalk isClassLibraryLoaded:'libstx_libwidg3' |
|
7118 |
Smalltalk isClassLibraryLoaded:'libstx_libboss' |
|
7119 |
" |
|
7120 |
||
7121 |
"Modified: / 23-08-2006 / 15:54:46 / cg" |
|
7122 |
! |
|
7123 |
||
7124 |
loadClassLibraryIfAbsent:name |
|
7125 |
"dynamically load a classLibrary, if not already loaded |
|
7126 |
and the system supports dynamic loading. |
|
7127 |
Return true, if the library is loaded, false if not. |
|
7128 |
This entry is called without system specific filename |
|
7129 |
extensions - it is portable among different architectures |
|
7130 |
as long as corresponding files (x.so / x.dll / x.sl / x.o) |
|
7131 |
are be present ..." |
|
7132 |
||
7133 |
(self isClassLibraryLoaded:name) ifTrue:[ ^ true ]. "/ already loaded |
|
7134 |
^ self fileInClassLibrary:name |
|
7135 |
||
7136 |
" |
|
7137 |
Smalltalk loadClassLibraryIfAbsent:'libbasic' |
|
7138 |
Smalltalk loadClassLibraryIfAbsent:'libwidg3' |
|
7139 |
" |
|
7140 |
||
7141 |
"Modified: 31.10.1996 / 16:57:24 / cg" |
|
7142 |
! |
|
7143 |
||
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7144 |
secureFileIn:aFileName |
10641 | 7145 |
"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
|
7146 |
Catch various errors during fileIn. |
13000 | 7147 |
Return true if ok, false if failed" |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7148 |
|
22691 | 7149 |
Parser isNil ifTrue:[ |
22791 | 7150 |
^ false "/ for small stand alone apps. |
7151 |
]. |
|
22691 | 7152 |
|
7153 |
^ (SignalSet |
|
22791 | 7154 |
with:AbortOperationRequest |
7155 |
with:TerminateProcessRequest |
|
7156 |
with:ParseError) |
|
7157 |
handle:[:ex | ex return:false ] |
|
7158 |
do:[ self fileIn:aFileName ]. |
|
22691 | 7159 |
|
7160 |
"Modified: / 23-04-2018 / 16:53:29 / stefan" |
|
10641 | 7161 |
! |
7162 |
||
7163 |
silentFileIn:aFilename |
|
7164 |
"same as fileIn:, but do not output 'compiled...'-messages on Transcript. |
|
7165 |
Main use is during startup." |
|
7166 |
||
22691 | 7167 |
^ self silentlyLoadingDo:[ |
22791 | 7168 |
self fileIn:aFilename |
22691 | 7169 |
]. |
7170 |
||
7171 |
"Modified: / 23-04-2018 / 16:57:17 / stefan" |
|
3044 | 7172 |
! ! |
7173 |
||
7174 |
!Smalltalk class methodsFor:'system management-files'! |
|
7175 |
||
20663 | 7176 |
addIdeTopDirectoryToPackagePath |
7177 |
"{ Pragma: +optSpace }" |
|
7178 |
||
7179 |
|topDirectory| |
|
22791 | 7180 |
|
20663 | 7181 |
(topDirectory := OperatingSystem pathOfSTXExecutable) notNil ifTrue:[ |
22791 | 7182 |
topDirectory := topDirectory asFilename. |
7183 |
(topDirectory directory / 'stc') exists ifTrue:[ |
|
7184 |
topDirectory := topDirectory directory. |
|
7185 |
] ifFalse:[ |
|
7186 |
(topDirectory directory directory / 'stc') exists ifTrue:[ |
|
7187 |
topDirectory := topDirectory directory directory. |
|
7188 |
] ifFalse:[ |
|
7189 |
(topDirectory directory directory directory / 'stc') exists ifTrue:[ |
|
7190 |
topDirectory := topDirectory directory directory directory. |
|
7191 |
] ifFalse:[ |
|
7192 |
topDirectory := nil |
|
7193 |
]. |
|
7194 |
]. |
|
7195 |
]. |
|
7196 |
topDirectory notNil ifTrue:[ |
|
7197 |
"/ one above "stx" |
|
7198 |
topDirectory := topDirectory directory pathName. |
|
7199 |
(PackagePath includes:topDirectory) ifFalse:[ |
|
7200 |
PackagePath add:topDirectory |
|
7201 |
] |
|
7202 |
] |
|
20663 | 7203 |
]. |
7204 |
! |
|
7205 |
||
18868 | 7206 |
addWorkspaceDirectoryToPackagePath |
7207 |
"{ Pragma: +optSpace }" |
|
7208 |
||
7209 |
|workspaceDirectory| |
|
22791 | 7210 |
|
18868 | 7211 |
(workspaceDirectory := UserPreferences current workspaceDirectory) notNil ifTrue:[ |
22791 | 7212 |
(workspaceDirectory := workspaceDirectory asFilename) exists ifTrue:[ |
7213 |
workspaceDirectory := workspaceDirectory pathName. |
|
7214 |
(PackagePath includes:workspaceDirectory) ifFalse:[ |
|
7215 |
PackagePath addFirst:workspaceDirectory |
|
7216 |
] |
|
7217 |
] |
|
18868 | 7218 |
]. |
7219 |
! |
|
7220 |
||
10641 | 7221 |
bitmapFileStreamFor:aFileName |
7222 |
"search aFileName in some standard places; |
|
7223 |
return a readonly fileStream or nil if not found. |
|
7224 |
Searches in subdirectories named 'bitmaps' in the SystemPath. |
|
7225 |
Notice: this does not look in the package-specific bitmaps directories." |
|
7226 |
||
7227 |
|aString| |
|
7228 |
||
7229 |
aString := self getBitmapFileName:aFileName. |
|
7230 |
aString notNil ifTrue:[ |
|
18668 | 7231 |
^ aString asFilename readStreamOrNil |
10641 | 7232 |
]. |
7233 |
^ nil |
|
7234 |
! |
|
7235 |
||
7236 |
bitmapFromFileNamed:aFileName forClass:aClass |
|
7237 |
"backward compatibility: |
|
7238 |
search aFileName in some standard places: |
|
7239 |
first in the redefinable bitmaps path, |
|
7240 |
then in the classes own package directory if existing. |
|
7241 |
Return an image or nil." |
|
7242 |
||
7243 |
^ self imageFromFileNamed:aFileName forClass:aClass |
|
7244 |
||
7245 |
" |
|
7246 |
Smalltalk bitmapFromFileNamed:'SmalltalkX.xbm' forClass:View |
|
7247 |
" |
|
7248 |
! |
|
7249 |
||
7250 |
bitmapFromFileNamed:aFileName inPackage:aPackage |
|
7251 |
"backward compatibility: |
|
7252 |
search aFileName in some standard places: |
|
7253 |
first in the redefinable bitmaps path, |
|
7254 |
then in the package directory if existing. |
|
7255 |
Return an image or nil." |
|
7256 |
||
7257 |
^ self imageFromFileNamed:aFileName inPackage:aPackage |
|
7258 |
||
7259 |
" |
|
7260 |
Smalltalk bitmapFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libview' |
|
7261 |
Smalltalk bitmapFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libtool' |
|
7262 |
" |
|
7263 |
! |
|
7264 |
||
7265 |
classNameForFile:aFileName |
|
7266 |
"return the className which corresponds to an abbreviated fileName, |
|
7267 |
or nil if no special translation applies. The given filename arg may |
|
7268 |
include a '.st' suffix (but no other)." |
|
7269 |
||
7270 |
|fn| |
|
7271 |
||
7272 |
(aFileName asFilename hasSuffix:'st') ifTrue:[ |
|
18668 | 7273 |
fn := aFileName copyButLast:3 |
10641 | 7274 |
] ifFalse:[ |
18668 | 7275 |
fn := aFileName |
10641 | 7276 |
]. |
7277 |
^ self filenameAbbreviations keyAtEqualValue:fn ifAbsent:[fn]. |
|
7278 |
||
7279 |
" |
|
7280 |
Smalltalk classNameForFile:'DrawObj' |
|
7281 |
Smalltalk classNameForFile:'DrawObj.st' |
|
7282 |
Smalltalk classNameForFile:'ArrColl.st' |
|
7283 |
Smalltalk classNameForFile:'ArrColl.chg' |
|
7284 |
" |
|
7285 |
||
7286 |
"Modified: 11.12.1995 / 14:51:10 / cg" |
|
7287 |
! |
|
7288 |
||
7289 |
constructPathFor:aDirectoryName |
|
7290 |
"search for aDirectory in SystemPath; |
|
20294 | 7291 |
return a collection of paths which include that directory." |
10641 | 7292 |
|
7293 |
^ self realSystemPath select:[:dirName | |
|
22791 | 7294 |
|fullPath| |
7295 |
||
7296 |
fullPath := dirName asFilename construct:aDirectoryName. |
|
7297 |
"/ fullPath exists and:[fullPath isDirectory and:[fullPath isReadable]] |
|
7298 |
fullPath isDirectory and:[fullPath isReadable] |
|
10641 | 7299 |
]. |
7300 |
! |
|
7301 |
||
7302 |
fileInFileStreamFor:aFileName |
|
7303 |
"obsolete |
|
7304 |
search aFileName in some standard places; |
|
7305 |
return a readonly fileStream or nil if not found. |
|
7306 |
Searches in subdirectories named 'fileIn' in SystemPath" |
|
7307 |
||
7308 |
|aString| |
|
7309 |
||
7310 |
aString := self getFileInFileName:aFileName. |
|
7311 |
aString notNil ifTrue:[ |
|
18668 | 7312 |
^ aString asFilename readStreamOrNil |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7313 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7314 |
^ nil |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7315 |
! |
7758 | 7316 |
|
12022 | 7317 |
fileNameForClass:aClassOrClassName |
7318 |
"return a actual or expected (or most wanted) filename for aClassOrClassName |
|
7319 |
- only the base name (without directory part) and without suffix." |
|
7320 |
||
15958 | 7321 |
|cls nonMetaclass nm nameWithPrefix nameWithoutPrefix compatQuery compatPkg | |
12022 | 7322 |
|
12301 | 7323 |
"/ This was added as an extension of libsvn - should be no longer needed |
15958 | 7324 |
"/ JV@2012-09-25: but it actually is. The problem is that class filename |
7325 |
"/ is stored in the class itself and used to generate abbrev.stc and |
|
7326 |
"/ prerequisites in makefiles. But if you renamed such a stc-compiled class, |
|
7327 |
"/ the filename remains the same, but SVN __ALWAYS__ keep container name |
|
7328 |
"/ and class name in sync. Therefore build files gets messed up. Indeed, this |
|
7329 |
"/ should be fixed in code that files-out the package and generates build files. |
|
7330 |
"/ Certainly a hack, but do not remove this until fixed elsewhere |
|
7331 |
||
7332 |
compatQuery := Smalltalk classNamed: 'SVN::CompatModeQuery'. |
|
7333 |
(compatQuery notNil |
|
7334 |
and:[compatQuery isLoaded |
|
18668 | 7335 |
and:[compatQuery query not]]) ifTrue:[ |
7336 |
nm := aClassOrClassName isBehavior |
|
7337 |
ifTrue:[aClassOrClassName name] |
|
7338 |
ifFalse:[aClassOrClassName]. |
|
7339 |
nm := nm copyReplaceAll:$: with:$_ ifNone:nm. |
|
7340 |
^nm |
|
15958 | 7341 |
]. |
7342 |
||
16122
18c865388947
Fix in Smalltalk>>#fileNameForClass: - required by libscm to support nested packages.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16117
diff
changeset
|
7343 |
"/ 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
|
7344 |
"/ 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
|
7345 |
"/ 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
|
7346 |
"/ of classes OUTSIDE filed-out package when generating makefile dependencies. |
15958 | 7347 |
compatQuery := Smalltalk classNamed: 'SCMCompatModeQuery'. |
7348 |
(compatQuery notNil |
|
7349 |
and:[compatQuery isLoaded |
|
18668 | 7350 |
and:[(compatPkg := compatQuery query) notNil]]) ifTrue:[ |
7351 |
| compatPkgs | |
|
7352 |
"/ Originally libscm could only fileout one package at time so |
|
7353 |
"/ the query answered one package name. However, to support nested |
|
7354 |
"/ packages, libscm is being rewritten to commit multiple packages |
|
7355 |
"/ at once, so query answers a collection of packages. The code below |
|
7356 |
"/ makes sure it works for both. |
|
7357 |
compatPkgs := compatPkg isString ifTrue:[ Array with: compatPkg] ifFalse:[ compatPkg ]. |
|
7358 |
nm := aClassOrClassName isBehavior |
|
7359 |
ifTrue:[aClassOrClassName name] |
|
7360 |
ifFalse:[aClassOrClassName]. |
|
7361 |
cls := Smalltalk at: nm asSymbol. |
|
7362 |
(cls notNil and:[compatPkgs includes: cls package]) ifTrue:[ |
|
7363 |
nm := nm copyReplaceAll:$: with:$_. |
|
7364 |
^nm |
|
7365 |
]. |
|
15958 | 7366 |
]. |
12301 | 7367 |
|
12022 | 7368 |
aClassOrClassName isBehavior ifTrue:[ |
18668 | 7369 |
cls := aClassOrClassName. |
12022 | 7370 |
] ifFalse:[ |
18668 | 7371 |
cls := Smalltalk classNamed:aClassOrClassName. |
7372 |
cls isNil ifTrue:[ |
|
7373 |
nameWithPrefix := aClassOrClassName. |
|
7374 |
nameWithoutPrefix := (aClassOrClassName copyFrom:(aClassOrClassName lastIndexOf:$:)+1). |
|
7375 |
]. |
|
12022 | 7376 |
]. |
7377 |
||
7378 |
cls notNil ifTrue:[ |
|
18668 | 7379 |
nonMetaclass := cls theNonMetaclass. |
7380 |
nm := nonMetaclass getClassFilename. |
|
7381 |
nm isNil ifTrue:[ |
|
7382 |
|revisionInfo| |
|
7383 |
||
7384 |
(revisionInfo := cls revisionInfo) notNil ifTrue:[ |
|
7385 |
nm := revisionInfo fileName. |
|
7386 |
]. |
|
7387 |
]. |
|
7388 |
nm notNil ifTrue:[ |
|
7389 |
^ nm asFilename withoutSuffix baseName |
|
7390 |
]. |
|
7391 |
nameWithPrefix := nonMetaclass name. |
|
7392 |
nameWithoutPrefix := nonMetaclass nameWithoutPrefix. |
|
12022 | 7393 |
]. |
7394 |
||
7395 |
CachedAbbreviations notNil ifTrue:[ |
|
18668 | 7396 |
nameWithPrefix := nameWithPrefix asSymbol. |
7397 |
(CachedAbbreviations includesKey:nameWithPrefix) ifTrue:[ |
|
7398 |
^ (CachedAbbreviations at:nameWithPrefix) asFilename baseName |
|
7399 |
]. |
|
7400 |
nameWithoutPrefix := nameWithoutPrefix asSymbol. |
|
7401 |
(CachedAbbreviations includesKey:nameWithoutPrefix) ifTrue:[ |
|
7402 |
^ (CachedAbbreviations at:nameWithoutPrefix) asFilename baseName |
|
7403 |
]. |
|
12022 | 7404 |
]. |
7405 |
||
7406 |
^ nameWithPrefix copyReplaceAll:$: with:$_ |
|
7407 |
||
7408 |
" |
|
7409 |
Smalltalk fileNameForClass:#Complex |
|
7410 |
Smalltalk fileNameForClass:'SmallInteger' |
|
7411 |
Smalltalk fileNameForClass:'UnixOperatingSystem' |
|
7412 |
Smalltalk fileNameForClass:'Launcher' |
|
7413 |
Smalltalk fileNameForClass:'SomeUnknownClass' |
|
7414 |
||
7415 |
Smalltalk fileNameForClass:HTML::Encoder |
|
7416 |
Smalltalk fileNameForClass:OSI::FTAMOperation |
|
7417 |
Smalltalk fileNameForClass:'OSI::Foobar' |
|
7418 |
Smalltalk fileNameForClass:(Workflow::UnsuccessfulFinishReasons) |
|
7419 |
Workflow::UnsuccessfulFinishReasons classFilename |
|
7420 |
" |
|
7421 |
||
7422 |
"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
|
7423 |
"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
|
7424 |
"Modified (comment): / 23-02-2014 / 12:39:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
12022 | 7425 |
! |
7426 |
||
10641 | 7427 |
filenameAbbreviations |
7428 |
"return a dictionary containing the classname-to-filename |
|
7429 |
mappings. (needed for sys5.3 users, where filenames are limited |
|
7430 |
to 14 chars)" |
|
7431 |
||
7432 |
CachedAbbreviations isNil ifTrue:[ |
|
18668 | 7433 |
self readAbbreviations |
10641 | 7434 |
]. |
7435 |
^ CachedAbbreviations |
|
7436 |
||
7437 |
"flush with: |
|
7438 |
||
7439 |
CachedAbbreviations := nil |
|
7440 |
" |
|
7441 |
" |
|
7442 |
Smalltalk filenameAbbreviations |
|
7443 |
" |
|
7444 |
! |
|
7445 |
||
13368 | 7446 |
findPackageDirectoryForPackage:aPackage |
7447 |
"find a packages directory along a number of standard places" |
|
7448 |
||
7449 |
|relDir| |
|
7450 |
||
7451 |
relDir := Smalltalk relativePackagePathForPackage:aPackage. |
|
7452 |
relDir asFilename isAbsolute ifTrue:[^ relDir]. |
|
7453 |
||
7454 |
^ Smalltalk getPackageFileName:relDir. |
|
7455 |
||
7456 |
" |
|
7457 |
Smalltalk findPackageDirectoryForPackage:'stx:libview/resources' |
|
7458 |
Smalltalk findPackageDirectoryForPackage:'stx:libview' |
|
7459 |
" |
|
7460 |
! |
|
7461 |
||
10641 | 7462 |
flushPathCaches |
7463 |
"{ Pragma: +optSpace }" |
|
7464 |
||
7465 |
"forget pathCaches - these are collections containing valid directory names, |
|
7466 |
where system files (resource, bitmaps etc.) are found. |
|
7467 |
A flush is only required, if a new system directory has been created while |
|
7468 |
the system is active, and those files should override the others |
|
7469 |
(for example, if you created a private resource directory)" |
|
7470 |
||
7471 |
RealSystemPath := ResourcePath := SourcePath := |
|
15332 | 7472 |
BinaryPath := FileInPath := nil. |
7473 |
||
10641 | 7474 |
" |
7475 |
Smalltalk flushPathCaches |
|
7476 |
" |
|
7477 |
! |
|
7478 |
||
7479 |
getBinaryFileName:aFileName |
|
7480 |
"obsolete |
|
7481 |
search aFileName in some standard places |
|
7482 |
(subdirectories named 'binary' in SystemPath); |
|
7483 |
return the absolute filename or nil if none is found." |
|
7484 |
||
7485 |
BinaryPath isNil ifTrue:[ |
|
18668 | 7486 |
BinaryPath := self constructPathFor:BinaryDirName |
10641 | 7487 |
]. |
7488 |
||
7489 |
^ self searchPath:BinaryPath for:aFileName in:BinaryDirName |
|
7490 |
||
7491 |
"Modified: 18.7.1996 / 15:53:49 / cg" |
|
7492 |
! |
|
7493 |
||
7494 |
getBitmapFileName:aFileName |
|
7495 |
"for backward compatibility: |
|
7496 |
search aFileName in some standard places |
|
7497 |
(subdirectories named 'bitmaps' in SystemPath); |
|
7498 |
Return the pathName or nil if none is found." |
|
7499 |
||
7500 |
^ self getBitmapFileName:aFileName forPackage:nil |
|
7501 |
||
7502 |
" |
|
7503 |
Smalltalk getBitmapFileName:'SBrowser.xbm' |
|
7504 |
" |
|
7505 |
||
7506 |
"Modified: 18.7.1996 / 15:53:55 / cg" |
|
7507 |
! |
|
7508 |
||
7509 |
getBitmapFileName:aFileName forPackage:aPackageIDOrNil |
|
7510 |
"for backward compatibility. |
|
7511 |
search aFileName in some standard places: |
|
7512 |
first in the redefinable bitmaps path, |
|
7513 |
then in the package directory if existing. |
|
7514 |
Return a path or nil. |
|
7515 |
Search order is: |
|
18668 | 7516 |
bitmaps/<pkg>/file |
7517 |
resources/<pkg>/bitmaps/file |
|
7518 |
<pkg>/bitmaps/file |
|
10641 | 7519 |
" |
7520 |
||
7521 |
|f dir packageDir pF| |
|
7522 |
||
15225 | 7523 |
f := aFileName asString withoutPrefix:'bitmaps/'. |
10641 | 7524 |
|
7525 |
aPackageIDOrNil isNil ifTrue:[ |
|
18668 | 7526 |
"/ this will be an error in the future |
10641 | 7527 |
"/ 'Smalltalk [warning]: bitmap file access without package: ' infoPrint. aFileName infoPrintCR. |
7528 |
"/ self halt. |
|
7529 |
||
18668 | 7530 |
pF := self searchPath:(self realSystemPath) for:aFileName in:('bitmaps'). |
7531 |
pF notNil ifTrue:[ |
|
7532 |
^ pF. |
|
7533 |
]. |
|
7534 |
f ~= aFileName ifTrue:[ |
|
7535 |
pF := self searchPath:(self realSystemPath) for:f in:('bitmaps'). |
|
7536 |
pF notNil ifTrue:[ |
|
7537 |
^ pF. |
|
7538 |
]. |
|
7539 |
]. |
|
7540 |
^ nil |
|
11077
14df4640ed89
image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents:
11057
diff
changeset
|
7541 |
]. |
14df4640ed89
image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents:
11057
diff
changeset
|
7542 |
|
14df4640ed89
image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents:
11057
diff
changeset
|
7543 |
dir := self projectDirectoryForPackage:aPackageIDOrNil. |
14df4640ed89
image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents:
11057
diff
changeset
|
7544 |
dir notNil ifTrue:[ |
18668 | 7545 |
pF := dir asFilename / f. |
7546 |
pF exists ifTrue:[ |
|
7547 |
^ pF. |
|
7548 |
]. |
|
7549 |
pF := dir asFilename / 'bitmaps' /f. |
|
7550 |
pF exists ifTrue:[ |
|
7551 |
^ pF. |
|
7552 |
]. |
|
10641 | 7553 |
]. |
7554 |
||
7555 |
packageDir := aPackageIDOrNil copyReplaceAll:$: with:$/. |
|
7556 |
||
7557 |
pF := self searchPath:(self realSystemPath) for:aFileName in:('bitmaps/',packageDir). |
|
7558 |
pF notNil ifTrue:[ |
|
18668 | 7559 |
^ pF. |
10641 | 7560 |
]. |
7561 |
pF := self searchPath:(self realSystemPath) for:aFileName in:('resources/',packageDir,'/bitmaps'). |
|
7562 |
pF notNil ifTrue:[ |
|
18668 | 7563 |
^ pF. |
11077
14df4640ed89
image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents:
11057
diff
changeset
|
7564 |
]. |
14df4640ed89
image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents:
11057
diff
changeset
|
7565 |
|
10641 | 7566 |
^ nil |
7567 |
||
7568 |
" |
|
7569 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libview' |
|
7570 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libtool' |
|
7571 |
Smalltalk imageFromFileNamed:'bitmaps/gifImages/garfield.gif' inPackage:'stx:goodies' |
|
7572 |
Smalltalk imageFromFileNamed:'CheckOn10_xp.xpm' inPackage:'stx:libwidg' |
|
7573 |
" |
|
7574 |
||
7575 |
"Modified: / 11-10-2006 / 13:53:18 / cg" |
|
7576 |
! |
|
7577 |
||
7578 |
getFileInFileName:aFileName |
|
7579 |
"obsolete |
|
7580 |
search aFileName in some standard places |
|
7581 |
(subdirectories named 'fileIn' in SystemPath); |
|
7582 |
return the absolute filename or nil if none is found." |
|
7583 |
||
7584 |
FileInPath isNil ifTrue:[ |
|
18668 | 7585 |
FileInPath := self constructPathFor:FileInDirName |
10641 | 7586 |
]. |
7587 |
||
7588 |
^ self searchPath:FileInPath for:aFileName in:FileInDirName |
|
7589 |
||
7590 |
"Modified: 18.7.1996 / 15:53:59 / cg" |
|
7591 |
! |
|
7592 |
||
7593 |
getPackageDirectoryForPackage:aPackageID |
|
7594 |
"search for a particular package; return its directory, or nil. |
|
7595 |
Stand alone applications might get nil, if there are only binaries installed." |
|
7596 |
||
19121 | 7597 |
|packageId checkForPackageDirectory module packageSubDirectory| |
7598 |
||
7599 |
packageId := aPackageID asPackageId. |
|
7600 |
module := packageId module. |
|
7601 |
packageSubDirectory := packageId directory. |
|
10641 | 7602 |
|
7603 |
checkForPackageDirectory := |
|
22791 | 7604 |
[:moduleDir | |
7605 |
|packageDir| |
|
7606 |
||
7607 |
moduleDir isDirectory ifTrue:[ |
|
7608 |
packageDir := moduleDir / packageSubDirectory. |
|
7609 |
packageDir isDirectory ifTrue:[ |
|
7610 |
^ packageDir |
|
7611 |
] |
|
7612 |
]. |
|
7613 |
]. |
|
10641 | 7614 |
|
7615 |
self packagePath do:[:aPath | |
|
22791 | 7616 |
|moduleDir| |
7617 |
||
7618 |
moduleDir := aPath asFilename / module. |
|
7619 |
checkForPackageDirectory value:moduleDir. |
|
10641 | 7620 |
]. |
7621 |
||
7622 |
^ nil |
|
7623 |
||
7624 |
" |
|
7625 |
Smalltalk getPackageDirectoryForPackage:(Array package) |
|
7626 |
Smalltalk getPackageDirectoryForPackage:'stx:goodies/bitmaps' |
|
7627 |
Smalltalk getPackageDirectoryForPackage:'stx:libview' |
|
7628 |
" |
|
7629 |
||
7630 |
"Modified: / 06-10-2006 / 11:49:27 / cg" |
|
7631 |
! |
|
7632 |
||
7633 |
getPackageFileName:aFileName |
|
7634 |
"search aFileName in some standard places |
|
7635 |
(packagePath and subdirectories named 'packages' in SystemPath); |
|
7636 |
return the absolute filename or nil if none is found." |
|
7637 |
||
7638 |
|f| |
|
7639 |
||
7640 |
"/ search along packagePath ... |
|
7641 |
f := self searchPath:self packagePath for:aFileName in:nil. |
|
7642 |
f isNil ifTrue:[ |
|
18668 | 7643 |
"/ search under packages-directory along systemPath ... |
7644 |
f := self searchPath:self realSystemPath for:aFileName in:PackageDirName. |
|
7645 |
"/ kludge - allow for stx-directory to be named differently |
|
7646 |
f isNil ifTrue:[ |
|
7647 |
(aFileName asString startsWith:('stx' , Filename separator)) ifTrue:[ |
|
7648 |
f := '..' asFilename / '..' / (aFileName copyFrom:5). |
|
7649 |
] |
|
7650 |
]. |
|
10641 | 7651 |
]. |
7652 |
(f notNil and:[(f := f asFilename) exists]) ifTrue:[ |
|
18668 | 7653 |
^ f pathName |
7758 | 7654 |
]. |
7655 |
^ nil |
|
10641 | 7656 |
|
7657 |
" |
|
16668
b88318df967d
flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents:
16666
diff
changeset
|
7658 |
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
|
7659 |
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
|
7660 |
Smalltalk getPackageFileName:'stx/libview/source.zip' |
10641 | 7661 |
" |
7662 |
! |
|
7663 |
||
15074 | 7664 |
getPackageSourceFileName:filenameWithoutSuffixArg |
13415 | 7665 |
"search aFileName in some standard places and try all available languages" |
7666 |
||
15074 | 7667 |
|filenameWithoutSuffix| |
7668 |
||
7669 |
filenameWithoutSuffix:= filenameWithoutSuffixArg asFilename. |
|
7670 |
||
16170
ca4d03def070
endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents:
16164
diff
changeset
|
7671 |
ProgrammingLanguage |
18668 | 7672 |
allDo:[:lang | |
7673 |
|file| |
|
7674 |
||
7675 |
file := self |
|
7676 |
getPackageFileName:(filenameWithoutSuffix addSuffix:lang sourceFileSuffix). |
|
7677 |
file notNil ifTrue:[ ^ file ] |
|
7678 |
]. |
|
15074 | 7679 |
^ nil |
13415 | 7680 |
|
7681 |
"Created: / 16-08-2009 / 14:44:58 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
7682 |
! |
|
7683 |
||
10641 | 7684 |
getResourceFileName:aFileName |
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7685 |
<resource: #obsolete> |
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7686 |
|
10641 | 7687 |
"search aFileName in some standard places |
7688 |
(subdirectories named 'resources' in SystemPath); |
|
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7689 |
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
|
7690 |
Obsolete: you must now provide a package argument." |
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7691 |
|
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7692 |
self obsoleteMethodWarning:'use getResourceFileName:forPackage:'. |
10641 | 7693 |
^ self getResourceFileName:aFileName forPackage:nil |
7694 |
||
7695 |
" |
|
7696 |
Smalltalk getResourceFileName:'SystemBrowser.rs' |
|
7697 |
" |
|
7698 |
||
7699 |
"Modified: 18.7.1996 / 15:54:03 / cg" |
|
7700 |
! |
|
7701 |
||
7702 |
getResourceFileName:aFileName forClass:aClassOrNil |
|
7703 |
"search aFileName in some standard places |
|
7704 |
(subdirectories named 'resource' in SystemPath); |
|
7705 |
and in aClasses package directory. |
|
7706 |
Return the absolute filename or nil if none is found." |
|
7707 |
||
7708 |
|pkgOrNil| |
|
7709 |
||
7710 |
aClassOrNil notNil ifTrue:[ |
|
18668 | 7711 |
pkgOrNil := aClassOrNil package. |
10641 | 7712 |
]. |
7713 |
^ self getResourceFileName:aFileName forPackage:pkgOrNil. |
|
7714 |
||
7715 |
" |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7716 |
Smalltalk getResourceFileName:'de.rs' forClass:SystemBrowser |
10641 | 7717 |
" |
7718 |
! |
|
7719 |
||
7720 |
getResourceFileName:aFileName forPackage:aPackageIDOrNil |
|
7721 |
"search aFileName in some standard places |
|
7722 |
(subdirectories named 'resource' in SystemPath); |
|
7723 |
and in a packages directory. |
|
7724 |
Return the absolute filename or nil if none is found. |
|
7725 |
Search order is: |
|
18668 | 7726 |
resources/<pkg>/file |
7727 |
<pkg>/resources/file |
|
10641 | 7728 |
" |
7729 |
||
7730 |
|pF f dir packageDir| |
|
7731 |
||
15225 | 7732 |
f := aFileName asString withoutPrefix:'resources/'. |
10641 | 7733 |
|
7734 |
aPackageIDOrNil isNil ifTrue:[ |
|
18668 | 7735 |
"/ this will be an error in the future |
10641 | 7736 |
"/ 'Smalltalk [warning]: resource file access without package: ' infoPrint. aFileName infoPrintCR. |
7737 |
"/ self halt. |
|
7738 |
||
18668 | 7739 |
pF := self searchPath:(self realSystemPath) for:aFileName in:('resources'). |
7740 |
pF notNil ifTrue:[ |
|
7741 |
^ pF. |
|
7742 |
]. |
|
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7743 |
"/ 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
|
7744 |
"/ pF notNil ifTrue:[ |
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7745 |
"/ ^ pF. |
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7746 |
"/ ]. |
18668 | 7747 |
f ~= aFileName ifTrue:[ |
7748 |
pF := self searchPath:(self realSystemPath) for:f in:('resources'). |
|
7749 |
pF notNil ifTrue:[ |
|
7750 |
^ pF. |
|
7751 |
]. |
|
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7752 |
"/ 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
|
7753 |
"/ pF notNil ifTrue:[ |
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7754 |
"/ ^ pF. |
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7755 |
"/ ]. |
18668 | 7756 |
]. |
7757 |
^ nil |
|
10641 | 7758 |
]. |
7759 |
||
7760 |
packageDir := aPackageIDOrNil copyReplaceAll:$: with:$/. |
|
7761 |
||
7762 |
pF := self searchPath:(self realSystemPath) for:aFileName in:('resources/',packageDir). |
|
7763 |
pF notNil ifTrue:[ |
|
18668 | 7764 |
^ pF. |
10641 | 7765 |
]. |
7766 |
||
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7767 |
"/ the following code finds the file within the IDE's own hierarchy |
10641 | 7768 |
dir := self projectDirectoryForPackage:aPackageIDOrNil. |
7769 |
dir notNil ifTrue:[ |
|
18668 | 7770 |
dir := dir asFilename. |
7771 |
||
7772 |
(pF := dir / 'resources' / f) exists ifTrue:[ ^ pF name ]. |
|
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7773 |
"/ (pF := dir / 'styles' / f) exists ifTrue:[ ^ pF name ]. |
12377 | 7774 |
|
18668 | 7775 |
"resolve something like: 'ASN/definition.asn1'" |
7776 |
(pF := dir / f) exists ifTrue:[ ^ pF name ]. |
|
12377 | 7777 |
]. |
7778 |
||
10641 | 7779 |
^ nil |
7780 |
||
7781 |
" |
|
7782 |
Smalltalk getResourceFileName:'SystemBrowser.rs' forPackage:'stx:libtool' |
|
7783 |
Smalltalk getResourceFileName:'normal.style' forPackage:'stx:libview' |
|
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7784 |
Smalltalk getResourceFileName:'styles/normal.style' forPackage:'stx:libview' |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7785 |
Smalltalk getResourceFileName:'styles/mswindowsXP.style' forPackage:'stx:libview' |
10641 | 7786 |
Smalltalk getResourceFileName:'Foo.rs' forPackage:'stx:libview' |
7787 |
" |
|
7788 |
||
7789 |
"Modified: / 11-10-2006 / 13:53:43 / cg" |
|
7790 |
! |
|
7791 |
||
7792 |
getSourceFileName:aFileName |
|
7793 |
"search aFileName in some standard places |
|
7794 |
(subdirectories named 'source' in SystemPath); |
|
7795 |
return the absolute filename or nil if none is found. |
|
7796 |
This is used to find a sourceFile for a methods source, |
|
7797 |
if no sourceCodeManager is available." |
|
7798 |
||
7799 |
|f| |
|
7800 |
||
7801 |
SourcePath isNil ifTrue:[ |
|
18668 | 7802 |
SourcePath := self constructPathFor:SourceDirName |
10641 | 7803 |
]. |
7804 |
||
7805 |
"/ first, try a source subdir along the path. |
|
7806 |
SourcePath notNil ifTrue:[ |
|
18668 | 7807 |
f := self searchPath:SourcePath for:aFileName in:SourceDirName. |
10641 | 7808 |
]. |
7809 |
f isNil ifTrue:[ |
|
18668 | 7810 |
"/ then, try it itself along the path. |
7811 |
f := self searchPath:self realSystemPath for:aFileName in:nil |
|
10641 | 7812 |
]. |
7813 |
^ f |
|
7814 |
||
7815 |
" |
|
7816 |
Smalltalk getSourceFileName:'Smalltalk.st' |
|
7817 |
Smalltalk getSourceFileName:'ArrColl.st' |
|
7818 |
" |
|
7819 |
||
7820 |
"Modified: 18.7.1996 / 15:54:07 / cg" |
|
7821 |
! |
|
7822 |
||
7823 |
getSystemFileName:aFileNameOrString |
|
7824 |
"search aFileNameOrString in some standard places; |
|
7825 |
return the absolute filename or nil if none is found. |
|
7826 |
see comment in Smalltalk>>initSystemPath. |
|
7827 |
This should be used to access resources such as bitmaps, doc-files, |
|
7828 |
and other help files. |
|
7829 |
" |
|
7830 |
||
7831 |
"credits for this method go to Markus ...." |
|
7832 |
||
7833 |
|fn nameString| |
|
7834 |
||
7835 |
fn := aFileNameOrString asFilename. |
|
7836 |
nameString := fn name. |
|
7837 |
fn isAbsolute ifTrue:[ |
|
22791 | 7838 |
"don't use path for absolute file names" |
7839 |
||
7840 |
^ nameString |
|
10641 | 7841 |
]. |
7842 |
||
7843 |
self realSystemPath do:[:dirName | |
|
22791 | 7844 |
|realName| |
7845 |
||
7846 |
realName := dirName asFilename / nameString. |
|
7847 |
"/ |
|
7848 |
"/ here, we also return true if it's a directory |
|
7849 |
"/ (Even if unreadable). |
|
7850 |
"/ It could be that the file itself is still readable. |
|
7851 |
"/ |
|
7852 |
(realName isDirectory or:[realName isReadable]) ifTrue: [ |
|
7853 |
^ realName name |
|
7854 |
] |
|
10641 | 7855 |
]. |
7856 |
^ nil |
|
7857 |
||
7858 |
" |
|
7859 |
Smalltalk getSystemFileName:'doc/online/english/TOP.html' |
|
7860 |
Smalltalk getSystemFileName:'bitmaps/SBrowser.xbm' |
|
7861 |
Smalltalk getSystemFileName:'bitmaps/foo' |
|
7862 |
Smalltalk getSystemFileName:'resources/View.rs' |
|
7863 |
Smalltalk getSystemFileName:'resources/iris.style' |
|
7864 |
" |
|
7865 |
||
21443 | 7866 |
"Modified: / 06-05-1999 / 10:40:37 / cg" |
7867 |
"Modified (comment): / 13-02-2017 / 20:30:51 / cg" |
|
10641 | 7868 |
! |
7869 |
||
7870 |
imageFromFileNamed:aFileName forClass:aClass |
|
7871 |
"search aFileName in some standard places: |
|
7872 |
first in the redefinable bitmaps path, then in the classes |
|
7873 |
own package directory if existing. |
|
7874 |
Return an image or nil." |
|
7875 |
||
7876 |
|classPackage img| |
|
7877 |
||
7878 |
classPackage := aClass package. |
|
7879 |
img := self imageFromFileNamed:aFileName inPackage:classPackage. |
|
7880 |
img isNil ifTrue:[ |
|
18668 | 7881 |
"/ try under the goodies package ... |
7882 |
classPackage ~= 'stx:goodies' ifTrue:[ |
|
7883 |
img := self imageFromFileNamed:aFileName inPackage:'stx:goodies'. |
|
7884 |
] |
|
10641 | 7885 |
]. |
7886 |
^ img |
|
7887 |
||
7888 |
" |
|
7889 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' forClass:View |
|
7890 |
" |
|
7891 |
! |
|
7892 |
||
7893 |
imageFromFileNamed:aFileName inPackage:aPackage |
|
7894 |
"search aFileName in some standard places: |
|
7895 |
first in the redefinable bitmaps path, |
|
7896 |
then in the package directory if existing. |
|
7897 |
Return an image or nil. |
|
7898 |
Search order is: |
|
18668 | 7899 |
bitmaps/<pkg>/file |
7900 |
resources/<pkg>/bitmaps/file |
|
7901 |
<pkg>/bitmaps/file |
|
10641 | 7902 |
" |
7903 |
||
7904 |
|path| |
|
7905 |
||
7906 |
path := self getBitmapFileName:aFileName forPackage:aPackage. |
|
7907 |
path notNil ifTrue:[ |
|
18668 | 7908 |
^ Image fromFile:path. |
10641 | 7909 |
]. |
7910 |
^ nil |
|
7911 |
||
7912 |
" |
|
7913 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libview' |
|
7914 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libtool' |
|
7915 |
Smalltalk imageFromFileNamed:'bitmaps/gifImages/garfield.gif' inPackage:'stx:goodies' |
|
7916 |
Smalltalk imageFromFileNamed:'CheckOn10_xp.xpm' inPackage:'stx:libwidg' |
|
7917 |
Smalltalk imageFromFileNamed:'ComboDn_xp.xpm' inPackage:'stx:libwidg' |
|
7918 |
" |
|
7919 |
||
7920 |
"Modified: / 08-09-2006 / 18:02:04 / cg" |
|
7921 |
! |
|
7922 |
||
7923 |
libraryFileNameOfClass:aClassOrClassName |
|
7924 |
"for a given class, return the name of a classLibrary which contains |
|
7925 |
binary code for it. |
|
7926 |
Read the libinfo file 'liblist.stc' (which is created during the compilation process) |
|
7927 |
for an entry for aClassOrClassName. |
|
7928 |
Search for the className in the first col, and return the value found in |
|
7929 |
the 2nd col. |
|
7930 |
Return nil if no entry is found. |
|
7931 |
||
7932 |
A nil returns means that this class is either built-in or not present |
|
7933 |
in a package-class library (i.e. either as separate .o or separate .st file). |
|
7934 |
Otherwise, the returned name is the classLibrary object of that class. |
|
7935 |
The classes code can be loaded from that file if binary loading is supported." |
|
7936 |
||
7937 |
|aStream line words n aClassName| |
|
7938 |
||
7939 |
aClassOrClassName isBehavior ifTrue:[ |
|
18668 | 7940 |
aClassName := aClassOrClassName name |
10641 | 7941 |
] ifFalse:[ |
18668 | 7942 |
aClassName := aClassOrClassName |
10641 | 7943 |
]. |
7944 |
aClassName := aClassName asString. |
|
7945 |
||
7946 |
#('include/liblist.stc') "/ filenames |
|
7947 |
with:#(2) "/ column |
|
7948 |
do:[:fileName :col | |
|
7949 |
||
18668 | 7950 |
aStream := self systemFileStreamFor:fileName. |
7951 |
aStream notNil ifTrue:[ |
|
7952 |
[aStream atEnd] whileFalse:[ |
|
7953 |
line := aStream nextLine. |
|
7954 |
line notNil ifTrue:[ |
|
7955 |
(line startsWith:'#') ifFalse:[ |
|
7956 |
words := line asCollectionOfWords. |
|
7957 |
(n := words size) > 1 ifTrue:[ |
|
7958 |
(words at:1) = aClassName ifTrue:[ |
|
7959 |
n >= col ifTrue:[ |
|
7960 |
aStream close. |
|
7961 |
^ (words at:col) withoutSeparators |
|
7962 |
] |
|
7963 |
] |
|
7964 |
] |
|
7965 |
] |
|
7966 |
] |
|
7967 |
]. |
|
7968 |
aStream close |
|
7969 |
]. |
|
10641 | 7970 |
]. |
7971 |
||
7972 |
^ nil |
|
7973 |
||
7974 |
" |
|
7975 |
Smalltalk libraryFileNameOfClass:'ClockView' |
|
7976 |
Smalltalk libraryFileNameOfClass:'Bag' |
|
7977 |
" |
|
7978 |
||
7979 |
"Modified: 6.11.1995 / 15:41:39 / cg" |
|
7980 |
! |
|
7981 |
||
7982 |
packagePath |
|
15781 | 7983 |
"return a collection of additional directory names, where smalltalk |
10641 | 7984 |
looks for package directories. |
7985 |
Notice, that directories named 'packages' under the systemPath are |
|
7986 |
always consulted - even if not in the packagePath" |
|
7987 |
||
20640 | 7988 |
^ PackagePath ? #() |
10641 | 7989 |
|
7990 |
" |
|
7991 |
Smalltalk packagePath |
|
7992 |
Smalltalk packagePath addLast:'/opt/smalltalk' |
|
7993 |
Smalltalk packagePath addFirst:'/usr/local/otherPackages' |
|
7994 |
" |
|
7995 |
! |
|
7996 |
||
7997 |
packagePath:aPath |
|
7998 |
"set the packagePath; |
|
7999 |
a collection of additional directorynames, where smalltalk |
|
8000 |
looks for package directories. |
|
8001 |
Notice, that directories named 'packages' under the systemPath are |
|
8002 |
always consulted - even if not in the packagePath" |
|
8003 |
||
8004 |
PackagePath := aPath asOrderedCollection |
|
8005 |
||
8006 |
" |
|
8007 |
Smalltalk packagePath:#( '.' '/opt/stx' '/opt/smalltalk' '/usr/local/otherPackages') |
|
8008 |
" |
|
8009 |
! |
|
8010 |
||
8011 |
projectDirectoryForClass:aClass |
|
8012 |
"given a class, return the path to its package directory; |
|
8013 |
nil if not found." |
|
8014 |
||
8015 |
|pkg| |
|
8016 |
||
8017 |
pkg := aClass package. |
|
8018 |
pkg isNil ifTrue:[^ nil]. |
|
8019 |
||
8020 |
^ self projectDirectoryForPackage:pkg. |
|
8021 |
||
8022 |
" |
|
8023 |
Smalltalk projectDirectoryForClass:Array |
|
8024 |
Smalltalk projectDirectoryForClass:View |
|
8025 |
" |
|
8026 |
! |
|
8027 |
||
8028 |
projectDirectoryForPackage:aPackage |
|
8029 |
"given a packageID, return the path to its package directory; |
|
8030 |
nil if not found." |
|
8031 |
||
8032 |
|prj prjDir| |
|
8033 |
||
16642 | 8034 |
^ aPackage asPackageId packageDirectory. |
8035 |
||
10641 | 8036 |
"/ there might be a package specific resource directory ... |
8037 |
"/ in the directory, from which the project was loaded |
|
8038 |
prj := Project projectWithId:aPackage. |
|
8039 |
prj notNil ifTrue:[ |
|
18668 | 8040 |
prjDir := prj directory. |
10641 | 8041 |
]. |
8042 |
(prjDir notNil and:[prjDir asFilename exists]) ifFalse:[ |
|
18668 | 8043 |
prjDir := Smalltalk getPackageFileName:(aPackage copyReplaceAll:$: with:$/). |
10641 | 8044 |
]. |
8045 |
^ prjDir |
|
8046 |
||
8047 |
" |
|
16668
b88318df967d
flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents:
16666
diff
changeset
|
8048 |
Smalltalk projectDirectoryForPackage:'stx:libbasic' |
10641 | 8049 |
Smalltalk projectDirectoryForPackage:'exept:smartcard' |
16668
b88318df967d
flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents:
16666
diff
changeset
|
8050 |
Smalltalk projectDirectoryForPackage:'stx' |
b88318df967d
flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents:
16666
diff
changeset
|
8051 |
Smalltalk projectDirectoryForPackage:'bosch' |
b88318df967d
flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents:
16666
diff
changeset
|
8052 |
Smalltalk projectDirectoryForPackage:'bosch:foo' |
10641 | 8053 |
" |
8054 |
||
8055 |
"Modified: / 07-10-2006 / 17:45:58 / cg" |
|
8056 |
! |
|
8057 |
||
8058 |
readAbbreviations |
|
8059 |
"read classname to filename mappings from include/abbrev.stc. |
|
8060 |
sigh - all for those poor sys5.3 or MSDOS people with short filenames ..." |
|
8061 |
||
8062 |
"since installAutoloadedClasses also reads all abbreviations, use it" |
|
8063 |
||
8064 |
CachedAbbreviations := IdentityDictionary new. |
|
8065 |
self installAutoloadedClasses. |
|
8066 |
^ CachedAbbreviations. |
|
8067 |
||
8068 |
" |
|
8069 |
Smalltalk readAbbreviations |
|
8070 |
" |
|
8071 |
||
8072 |
"Modified: / 10.12.1999 / 17:48:53 / cg" |
|
8073 |
! |
|
8074 |
||
8075 |
readAbbreviationsFromStream:aStream |
|
8076 |
"read classname to filename mappings from aStream. |
|
8077 |
sigh - all for those poor sys5.3 or MSDOS people with short filenames ..." |
|
8078 |
||
11375 | 8079 |
self |
18668 | 8080 |
withAbbreviationsFromStream:aStream |
8081 |
do:[:className :abbrev :pkg | |
|
8082 |
self setFilename:abbrev forClass:className package:pkg. |
|
8083 |
]. |
|
10641 | 8084 |
|
8085 |
"Modified: / 13.12.1999 / 11:54:17 / cg" |
|
8086 |
! |
|
8087 |
||
8088 |
realSystemPath |
|
16642 | 8089 |
"return the realSystemPath - that's the directory names from |
10641 | 8090 |
SystemPath which exist and are readable" |
8091 |
||
8092 |
|nP| |
|
8093 |
||
8094 |
RealSystemPath isNil ifTrue:[ |
|
18668 | 8095 |
OperatingSystem isVMSlike ifTrue:[ |
8096 |
"/ temporary kludge: since we cannot currently |
|
8097 |
"/ check for existence of a name like 'volume:', |
|
8098 |
"/ leave those in the Path without a check. |
|
8099 |
RealSystemPath := SystemPath select:[:dirName | |f| |
|
8100 |
f := dirName asFilename. |
|
8101 |
f isVolumeOnly or:[(f isDirectory) and:[f isReadable]] |
|
8102 |
] |
|
8103 |
] ifFalse:[ |
|
8104 |
RealSystemPath := SystemPath |
|
8105 |
select:[:eachDirectoryName | |f| |
|
8106 |
f := eachDirectoryName asFilename. |
|
8107 |
(f isDirectory) and:[f isReadable] |
|
8108 |
] thenCollect:[:eachDirectoryName| |
|
8109 |
eachDirectoryName asFilename pathName. |
|
8110 |
]. |
|
8111 |
||
8112 |
"/ remove duplicates (but keep order) |
|
8113 |
nP := OrderedCollection new. |
|
8114 |
RealSystemPath do:[:p | |
|
8115 |
(nP includes:p) ifFalse:[ |
|
8116 |
nP add:p |
|
8117 |
] |
|
8118 |
]. |
|
8119 |
(nP includes:'.') ifFalse:[ |
|
8120 |
nP add:'.' |
|
8121 |
]. |
|
8122 |
RealSystemPath := nP. |
|
8123 |
]. |
|
617 | 8124 |
]. |
8125 |
^ RealSystemPath |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8126 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8127 |
|
10641 | 8128 |
recursiveReadAllAbbreviationsFrom:aDirectory |
8129 |
self recursiveReadAllAbbreviationsFrom:aDirectory maxLevels:15 |
|
8130 |
! |
|
8131 |
||
8132 |
recursiveReadAllAbbreviationsFrom:aDirectory maxLevels:maxLevels |
|
8133 |
"read all abbreviations from and under aDirectory." |
|
8134 |
||
8135 |
|abbrevStream dir directoryContents| |
|
8136 |
||
8137 |
maxLevels == 0 ifTrue:[ |
|
8138 |
"/ 'Smalltalk [warning]: max directory nesting reached.' infoPrintCR. |
|
22791 | 8139 |
^ self |
10641 | 8140 |
]. |
8141 |
||
8142 |
dir := aDirectory asFilename. |
|
8143 |
dir exists ifFalse:[^ self]. |
|
8144 |
||
8145 |
[ |
|
22791 | 8146 |
abbrevStream := (dir / 'abbrev.stc') asFilename readStream. |
8147 |
self readAbbreviationsFromStream:abbrevStream. |
|
8148 |
abbrevStream close. |
|
10641 | 8149 |
] on:FileStream openErrorSignal do:[:ex| "ignore this file"]. |
8150 |
||
8151 |
[ |
|
22791 | 8152 |
directoryContents := dir directoryContents. |
10641 | 8153 |
] on:FileStream openErrorSignal do:[:ex| |
22791 | 8154 |
"non-accessible directory: we are done" |
8155 |
^ self |
|
10641 | 8156 |
]. |
8157 |
||
8158 |
directoryContents do:[:aFilename | |
|
22791 | 8159 |
|f| |
8160 |
||
8161 |
(#( |
|
8162 |
'doc' |
|
8163 |
'CVS' |
|
8164 |
'bitmaps' |
|
8165 |
'resources' |
|
8166 |
'source' |
|
8167 |
) includes:aFilename) ifFalse:[ |
|
8168 |
f := dir / aFilename. |
|
8169 |
f isDirectory ifTrue:[ |
|
8170 |
self recursiveReadAllAbbreviationsFrom:f maxLevels:maxLevels-1 |
|
8171 |
] |
|
8172 |
]. |
|
4458 | 8173 |
]. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8174 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8175 |
|
15334 | 8176 |
reinitializePackagePath |
8177 |
"{ Pragma: +optSpace }" |
|
20207 | 8178 |
|
15334 | 8179 |
PackagePath notNil ifTrue:[ |
22791 | 8180 |
PackagePath := PackagePath select:[:p | p asFilename exists]. |
15334 | 8181 |
]. |
8182 |
PackagePath isEmptyOrNil ifTrue:[ |
|
22791 | 8183 |
PackagePath := OperatingSystem defaultPackagePath |
18868 | 8184 |
]. |
8185 |
self addWorkspaceDirectoryToPackagePath. |
|
15334 | 8186 |
! |
8187 |
||
13368 | 8188 |
relativePackagePathForPackage:aPackage |
8189 |
|path| |
|
8190 |
||
8191 |
PackageToPathMapping notNil ifTrue:[ |
|
18668 | 8192 |
path := PackageToPathMapping at:aPackage ifAbsent:nil. |
8193 |
PackageToPathMapping notNil ifTrue:[^ path]. |
|
13370 | 8194 |
]. |
8195 |
^ aPackage copyReplaceAll:$: with:$/. |
|
13368 | 8196 |
|
8197 |
" |
|
8198 |
PackageToPathMapping := Dictionary new. |
|
8199 |
PackageToPathMapping at:'expeccoNET:server' put:'expeccoNET_oldVersion/server'. |
|
8200 |
PackageToPathMapping at:'expeccoNET:server/ui' put:'expeccoNET_oldVersion/server/ui'. |
|
8201 |
||
8202 |
Smalltalk relativePackagePathForPackage:'stx:libview/resources' |
|
8203 |
Smalltalk relativePackagePathForPackage:'stx:libview' |
|
8204 |
" |
|
8205 |
! |
|
8206 |
||
10641 | 8207 |
resourceDirectoryForPackage:aPackage |
8208 |
"given a packageID, return the path to its resource directory; |
|
8209 |
nil if not found." |
|
8210 |
||
8211 |
|prjDir rsrcDir| |
|
8212 |
||
11183
9a4e7475a655
care for nil project when asked for a resource directory
Claus Gittinger <cg@exept.de>
parents:
11174
diff
changeset
|
8213 |
aPackage notNil ifTrue:[ |
18668 | 8214 |
prjDir := self projectDirectoryForPackage:aPackage. |
8215 |
||
8216 |
(prjDir notNil |
|
8217 |
and:[(prjDir := prjDir asFilename) exists |
|
8218 |
and:[(rsrcDir := prjDir / 'resources') exists]]) ifTrue:[ |
|
8219 |
^ rsrcDir |
|
8220 |
]. |
|
8221 |
rsrcDir := self getSystemFileName:('resources/' , (aPackage copyReplaceAll:$: with:$/)). |
|
8222 |
rsrcDir notNil ifTrue:[ |
|
8223 |
^ rsrcDir asFilename |
|
8224 |
]. |
|
10641 | 8225 |
]. |
8226 |
^ nil |
|
8227 |
||
8228 |
" |
|
8229 |
Smalltalk resourceDirectoryForPackage:'stx:libbasic' |
|
8230 |
Smalltalk resourceDirectoryForPackage:'exept:expecco' |
|
8231 |
Smalltalk resourceDirectoryForPackage:'exept:smartcard' |
|
8232 |
" |
|
8233 |
! |
|
8234 |
||
8235 |
resourceFileStreamFor:aFileName |
|
8236 |
"search aFileName in some standard places; |
|
8237 |
return a readonly fileStream or nil if not found. |
|
8238 |
Searches in subdirectories named 'resource' in SystemPath" |
|
8239 |
||
8240 |
^ self resourceFileStreamFor:aFileName forClass:nil |
|
8241 |
! |
|
8242 |
||
8243 |
resourceFileStreamFor:aFileName forClass:aClassOrNil |
|
8244 |
"search aFileName in some standard places and in the classes |
|
8245 |
package-resource directory. |
|
8246 |
Return a readonly fileStream or nil if not found. |
|
8247 |
Searches in subdirectories named 'resource' in SystemPath" |
|
8248 |
||
8249 |
|aString| |
|
8250 |
||
8251 |
aString := self getResourceFileName:aFileName forClass:aClassOrNil. |
|
8252 |
aString notNil ifTrue:[ |
|
18668 | 8253 |
^ aString asFilename readStreamOrNil |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8254 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8255 |
^ nil |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8256 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8257 |
|
10641 | 8258 |
searchPath:aPath for:aFileName in:aDirName |
8259 |
"search aPath for a subdirectory named aDirectory with a file |
|
8260 |
named aFileName" |
|
8261 |
||
8262 |
|f| |
|
8263 |
||
8264 |
((f := aFileName asFilename) isAbsolute |
|
8265 |
or:[f isExplicitRelative]) ifTrue:[ |
|
22791 | 8266 |
"/ |
8267 |
"/ don't use path for absolute or explicit .-relative file names |
|
8268 |
"/ |
|
8269 |
^ aFileName |
|
10641 | 8270 |
]. |
8271 |
||
8272 |
aPath notNil ifTrue:[ |
|
22791 | 8273 |
aPath do:[:dirName | |
8274 |
|realName dir| |
|
8275 |
||
8276 |
dir := dirName asFilename. |
|
8277 |
aDirName notNil ifTrue:[ |
|
8278 |
realName := dir / aDirName / aFileName. |
|
8279 |
] ifFalse:[ |
|
8280 |
realName := dir / aFileName. |
|
8281 |
]. |
|
8282 |
(realName isReadable) ifTrue:[ |
|
8283 |
^ realName name |
|
8284 |
] |
|
8285 |
]. |
|
11108 | 8286 |
]. |
8287 |
||
8288 |
"/ not needed - executing dir is always in SearchPath |
|
12377 | 8289 |
"/ realName := Filename currentDirectory / aFileName. |
11108 | 8290 |
"/ (realName isReadable) ifTrue:[ |
8291 |
"/ ^ realName name |
|
8292 |
"/ ]. |
|
10641 | 8293 |
^ nil. |
8294 |
||
8295 |
"Modified: / 29.4.1999 / 15:06:43 / cg" |
|
8296 |
! |
|
8297 |
||
8298 |
setFilename:aFileNameString forClass:aClassNameString package:aPackageNameString |
|
8299 |
|classNameSymbol oldAbbrev oldPath newPath cls abbrevs| |
|
8300 |
||
8301 |
CachedAbbreviations isNil ifTrue:[ |
|
18668 | 8302 |
CachedAbbreviations := IdentityDictionary new. |
10641 | 8303 |
]. |
8304 |
||
8305 |
abbrevs := CachedAbbreviations. |
|
8306 |
aClassNameString ~= aFileNameString ifTrue:[ |
|
18668 | 8307 |
classNameSymbol := aClassNameString asSymbol. |
8308 |
oldAbbrev := abbrevs at:classNameSymbol ifAbsent:nil. |
|
8309 |
oldAbbrev notNil ifTrue:[ |
|
8310 |
oldAbbrev ~= aFileNameString ifTrue:[ |
|
8311 |
oldAbbrev asFilename isAbsolute |
|
8312 |
ifTrue:[ oldPath := oldAbbrev ] |
|
8313 |
ifFalse:[ oldPath := (self projectDirectoryForPackage:aPackageNameString) asFilename constructString: oldAbbrev ]. |
|
8314 |
aFileNameString asFilename isAbsolute |
|
8315 |
ifTrue:[ newPath := aFileNameString ] |
|
8316 |
ifFalse:[ newPath := (self projectDirectoryForPackage:aPackageNameString) asFilename constructString: aFileNameString ]. |
|
8317 |
||
8318 |
oldPath ~= newPath ifTrue:[ |
|
8319 |
StandAlone ifFalse:[ |
|
8320 |
('Smalltalk [warning]: autoload path change for: ',aClassNameString,' in package ',aPackageNameString) infoPrintCR. |
|
8321 |
('Smalltalk [info]: old: ',oldPath) infoPrintCR. |
|
8322 |
('Smalltalk [info]: new: ',newPath) infoPrintCR. |
|
8323 |
] |
|
8324 |
] |
|
8325 |
]. |
|
8326 |
"overwrite old abbreviation with new one, |
|
8327 |
to allow fixing of bad abbrev files" |
|
8328 |
]. |
|
8329 |
||
8330 |
cls := self classNamed:aFileNameString. |
|
8331 |
cls notNil ifTrue:[ |
|
8332 |
cls name ~= aClassNameString ifTrue:[ |
|
8333 |
"/ ok, there is a class named after this abbrev ... |
|
8334 |
"/ this is only a conflict, if the other class has no |
|
8335 |
"/ abbreviation (or the same). |
|
8336 |
(abbrevs at:(cls name asSymbol) ifAbsent:cls name) = aFileNameString ifTrue:[ |
|
8337 |
cls isNameSpace ifFalse:[ |
|
8338 |
aPackageNameString = cls package ifTrue:[ |
|
8339 |
StandAlone ifFalse:[ |
|
8340 |
('Smalltalk [warning]: conflict for: ' , cls name , |
|
8341 |
' in package ' , aPackageNameString) infoPrintCR. |
|
8342 |
('Smalltalk [warning]: (' , aClassNameString , ' -> ' , aFileNameString |
|
8343 |
, ')') infoPrintCR |
|
8344 |
] |
|
8345 |
] |
|
8346 |
] |
|
8347 |
] |
|
8348 |
] |
|
8349 |
]. |
|
8350 |
abbrevs at:classNameSymbol put:aFileNameString. |
|
8470
d79e917d4f36
Define #setFilename:forClass:package: to define an abbreviation.
Stefan Vogel <sv@exept.de>
parents:
8445
diff
changeset
|
8351 |
] |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8352 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8353 |
|
10641 | 8354 |
sourceDirectoryNameOfClass:aClassOrClassName |
8355 |
"for a given class, return the pathname relative to TOP of the classes source code. |
|
8356 |
Read the files 'abbrev.stc' and 'liblist.stc' (which are created during the compilation process) |
|
8357 |
for an entry for aClassOrClassName. |
|
8358 |
Search for the className in the first col, and return the value found in |
|
8359 |
the 3rd col. |
|
8360 |
Return nil if no entry is found." |
|
8361 |
||
8362 |
|aStream line words n aClassName| |
|
8363 |
||
8364 |
aClassOrClassName isBehavior ifTrue:[ |
|
18668 | 8365 |
aClassName := aClassOrClassName name |
10641 | 8366 |
] ifFalse:[ |
18668 | 8367 |
aClassName := aClassOrClassName |
10641 | 8368 |
]. |
8369 |
aClassName := aClassName asString. |
|
8370 |
||
8371 |
#('include/abbrev.stc' 'include/liblist.stc') "/ filenames |
|
8372 |
with:#(3 2) "/ column |
|
8373 |
do:[:fileName :col | |
|
8374 |
||
18668 | 8375 |
aStream := self systemFileStreamFor:fileName. |
8376 |
aStream notNil ifTrue:[ |
|
8377 |
[aStream atEnd] whileFalse:[ |
|
8378 |
line := aStream nextLine. |
|
8379 |
line notNil ifTrue:[ |
|
8380 |
(line startsWith:'#') ifFalse:[ |
|
8381 |
words := line asCollectionOfWords. |
|
8382 |
(n := words size) > 1 ifTrue:[ |
|
8383 |
(words at:1) = aClassName ifTrue:[ |
|
8384 |
n >= col ifTrue:[ |
|
8385 |
aStream close. |
|
8386 |
^ (words at:col) withoutSeparators |
|
8387 |
] |
|
8388 |
] |
|
8389 |
] |
|
8390 |
] |
|
8391 |
] |
|
8392 |
]. |
|
8393 |
aStream close |
|
8394 |
]. |
|
10641 | 8395 |
]. |
8396 |
||
8397 |
^ nil |
|
8398 |
||
8399 |
" |
|
8400 |
Smalltalk sourceDirectoryNameOfClass:'ClockView' |
|
8401 |
Smalltalk sourceDirectoryNameOfClass:'Bag' |
|
8402 |
Smalltalk sourceDirectoryNameOfClass:'GLWireCubeDemoView' |
|
8403 |
Smalltalk sourceDirectoryNameOfClass:'SomeNonExistingClass' |
|
8404 |
" |
|
8405 |
||
8406 |
"Created: 6.11.1995 / 15:43:30 / cg" |
|
8407 |
"Modified: 9.12.1995 / 23:54:14 / cg" |
|
8408 |
"Modified: 3.1.1997 / 11:26:44 / stefan" |
|
8409 |
! |
|
8410 |
||
8411 |
sourceFileStreamFor:aFileName |
|
8412 |
"search aFileName in some standard places; |
|
8413 |
return a readonly fileStream or nil if not found. |
|
8414 |
Searches in subdirectories named 'source' in SystemPath" |
|
8415 |
||
8416 |
|aString| |
|
8417 |
||
8418 |
aString := self getSourceFileName:aFileName. |
|
8419 |
aString notNil ifTrue:[ |
|
18668 | 8420 |
^ aString asFilename readStreamOrNil |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8421 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8422 |
^ nil |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8423 |
! |
7758 | 8424 |
|
10641 | 8425 |
systemFileStreamFor:aFileName |
8426 |
"search aFileName in some standard places; |
|
8427 |
return a readonly fileStream or nil if not found. |
|
8428 |
see comment in Smalltalk>>initSystemPath" |
|
8429 |
||
8430 |
|aString| |
|
8431 |
||
8432 |
aString := self getSystemFileName:aFileName. |
|
8433 |
aString notNil ifTrue:[ |
|
18668 | 8434 |
^ aString asFilename readStreamOrNil |
617 | 8435 |
]. |
8436 |
^ nil |
|
8437 |
! |
|
8438 |
||
10641 | 8439 |
systemPath |
8440 |
"return a collection of directorynames, where smalltalk |
|
8441 |
looks for system files |
|
8442 |
(usually in subdirs such as resources, bitmaps, source etc.) |
|
8443 |
see comment in Smalltalk>>initSystemPath." |
|
8444 |
||
20640 | 8445 |
^ SystemPath ? #() |
10641 | 8446 |
|
8447 |
" |
|
8448 |
Smalltalk systemPath |
|
8449 |
Smalltalk systemPath addLast:'someOtherDirectoryPath' |
|
8450 |
" |
|
8451 |
! |
|
8452 |
||
8453 |
systemPath:aPath |
|
8454 |
"set the collection of directorynames, where smalltalk |
|
8455 |
looks for system files |
|
8456 |
(usually in subdirs such as resources, bitmaps, source etc.) |
|
8457 |
see comment in Smalltalk>>initSystemPath." |
|
8458 |
||
8459 |
SystemPath := aPath. |
|
8460 |
self flushPathCaches |
|
8461 |
||
8462 |
" |
|
8463 |
Smalltalk systemPath |
|
8464 |
Smalltalk systemPath:(Smalltalk systemPath copy addLast:'someOtherDirectoryPath') |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8465 |
" |
11301
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
8466 |
! |
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
8467 |
|
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
8468 |
withAbbreviationsFromStream:aStream do:aBlock |
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
8469 |
"read classname to filename mappings from aStream. |
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
8470 |
Evaluate aBlock for each tuple: |
18668 | 8471 |
class-name , abbrev-name, package |
11301
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
8472 |
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
|
8473 |
|
13415 | 8474 |
|line lineNo words nm abbrev pkg category size s w| |
8475 |
||
8476 |
lineNo := 0. |
|
11301
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
8477 |
[aStream atEnd] whileFalse:[ |
18668 | 8478 |
line := aStream nextLine. |
8479 |
lineNo := lineNo + 1. |
|
8480 |
line notEmptyOrNil ifTrue:[ |
|
8481 |
(line startsWith:'#') ifFalse:[ |
|
8482 |
||
8483 |
"/ must do it manually, caring for quoted strings. |
|
11301
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
8484 |
"/ words := line asCollectionOfWords. |
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
8485 |
|
18668 | 8486 |
words := OrderedCollection new. |
8487 |
s := line readStream. |
|
8488 |
[s atEnd] whileFalse:[ |
|
8489 |
s skipSeparators. |
|
8490 |
s peek == $' ifTrue:[ |
|
8491 |
s next. |
|
8492 |
w := s upTo:$'. |
|
8493 |
s skipSeparators. |
|
8494 |
] ifFalse:[ |
|
8495 |
w := s upToSeparator |
|
8496 |
]. |
|
8497 |
words add:w |
|
8498 |
]. |
|
8499 |
words size >= 3 ifTrue:[ |
|
8500 |
nm := (words at:1) withoutSeparators. |
|
8501 |
abbrev := (words at:2) withoutSeparators. |
|
8502 |
pkg := (words at:3) withoutSeparators. |
|
8503 |
aBlock argumentCount = 3 ifTrue:[ |
|
8504 |
aBlock value:nm value:abbrev value:pkg. |
|
8505 |
] ifFalse:[ |
|
8506 |
words size >= 4 ifTrue:[ |
|
8507 |
category := words at:4. |
|
8508 |
]. |
|
8509 |
words size = 5 ifTrue:[ |
|
8510 |
size := (words at:5) asNumber |
|
8511 |
]. |
|
8512 |
aBlock value:nm value:abbrev value:pkg value: category value: size |
|
8513 |
] |
|
8514 |
] ifFalse:[ |
|
8515 |
('Smalltalk [warning]: malformed line ', lineNo printString , ' in ' , (aStream pathName)) infoPrintCR. |
|
8516 |
] |
|
8517 |
] |
|
8518 |
] |
|
13518
b81bc64782b1
not ifTrue -> ifFalse (trying the rewrite tool ;-)
Claus Gittinger <cg@exept.de>
parents:
13506
diff
changeset
|
8519 |
]. |
b81bc64782b1
not ifTrue -> ifFalse (trying the rewrite tool ;-)
Claus Gittinger <cg@exept.de>
parents:
13506
diff
changeset
|
8520 |
|
13415 | 8521 |
"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
|
8522 |
"Modified: / 04-08-2011 / 21:35:00 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8523 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8524 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8525 |
!Smalltalk class methodsFor:'system management-packages'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8526 |
|
16159 | 8527 |
isPackageLoaded:aPackageIdOrPackage |
8528 |
|projectDefinition| |
|
8529 |
||
8530 |
projectDefinition := aPackageIdOrPackage asPackageId projectDefinitionClass. |
|
16161 | 8531 |
^ projectDefinition notNil and:[projectDefinition isLoaded and:[projectDefinition isFullyLoaded]] |
16159 | 8532 |
|
8533 |
" |
|
8534 |
Smalltalk isPackageLoaded:'stx:goodies/persistency' |
|
16170
ca4d03def070
endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents:
16164
diff
changeset
|
8535 |
Smalltalk isPackageLoaded:'stx:goodies/refactoryBrowser/lint' |
ca4d03def070
endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents:
16164
diff
changeset
|
8536 |
Smalltalk isPackageLoaded:'stx:goodies/refactoryBrowser/lint/spelling' |
16159 | 8537 |
" |
8538 |
! |
|
8539 |
||
20898 | 8540 |
knownLoadablePackagesDo:aBlock |
8541 |
"enumerate loadable packages from the packages folder." |
|
8542 |
||
8543 |
Smalltalk realSystemPath do:[:dirName | |
|
22791 | 8544 |
|packageDir| |
8545 |
||
8546 |
packageDir := dirName asFilename / 'packages'. |
|
8547 |
(packageDir exists and:[packageDir isDirectory]) ifTrue:[ |
|
8548 |
packageDir directoryContentsAsFilenames sort do:[:fn | |
|
8549 |
|item base nm path parentPath parent isLibrary isApplication isAlreadyLoaded |
|
8550 |
defClass target type nameComponents packageName packageID| |
|
8551 |
||
8552 |
((fn suffix = 'mcz') |
|
8553 |
or:[ fn isDirectory |
|
8554 |
or:[ (fn baseName startsWith:'.') |
|
8555 |
or:[ (fn baseName = 'README') ]]]) ifFalse:[ |
|
8556 |
base := fn withoutSuffix baseName. |
|
8557 |
(base startsWith:'lib') ifTrue:[ |
|
8558 |
nm := (base copyFrom:4). |
|
8559 |
fn suffix notEmptyOrNil ifTrue:[ |
|
8560 |
type := #library. |
|
8561 |
] ifFalse:[ |
|
8562 |
type := #application. |
|
8563 |
] |
|
8564 |
] ifFalse:[ |
|
8565 |
nm := base. |
|
8566 |
type := #application. |
|
8567 |
]. |
|
8568 |
||
8569 |
(base ~= 'librun') ifTrue:[ |
|
8570 |
(fn suffix = 'mcz') ifTrue:[ |
|
8571 |
packageName := fn withoutSuffix. |
|
8572 |
target := fn. |
|
8573 |
] ifFalse:[ |
|
8574 |
( #('dll' 'so' 'sl' 'dylib') includes:(fn suffix)) ifTrue:[ |
|
8575 |
(base startsWith:'lib') ifTrue:[ |
|
8576 |
nm := base copyFrom:4. |
|
8577 |
] ifFalse:[ |
|
8578 |
nm := base. |
|
8579 |
]. |
|
8580 |
]. |
|
8581 |
nameComponents := nm asCollectionOfSubstringsSeparatedBy:$_. |
|
8582 |
packageName := nameComponents first. |
|
8583 |
nameComponents size > 1 ifTrue:[ |
|
8584 |
packageName := packageName,':',((nameComponents copyFrom:2) asStringWith:'/') |
|
8585 |
]. |
|
8586 |
]. |
|
8587 |
packageName notNil ifTrue:[ |
|
8588 |
aBlock value:packageName value:type value:fn . |
|
8589 |
] |
|
8590 |
] |
|
8591 |
] |
|
8592 |
] |
|
8593 |
] |
|
20898 | 8594 |
] |
8595 |
||
8596 |
" |
|
8597 |
Smalltalk knownLoadablePackagesDo:[:packageID :type :path | |
|
22791 | 8598 |
Transcript showCR:'%1 (%2) in %3' with:packageID with:type with:path. |
20898 | 8599 |
] |
8600 |
" |
|
8601 |
! |
|
8602 |
||
10641 | 8603 |
loadPackage:aPackageIdOrPackage |
12250 | 8604 |
"make certain, that some particular package is loaded into the system. |
8605 |
Return true if loaded, false otherwise." |
|
11668 | 8606 |
|
8607 |
^ self loadPackage:aPackageIdOrPackage asAutoloaded:false |
|
8608 |
||
8609 |
" |
|
8610 |
Smalltalk loadPackage:'stx:libbasic' |
|
8611 |
Smalltalk loadPackage:'stx:goodies/persistency' |
|
8612 |
Smalltalk loadPackage:'cg:cparser' |
|
8613 |
Smalltalk loadPackage:'cg:rose' |
|
8614 |
" |
|
8615 |
! |
|
8616 |
||
10641 | 8617 |
packageDirectoryForPackageId:aPackageId |
12250 | 8618 |
"used by classes to find the location of their resource- and bitmap directories. |
8619 |
||
8620 |
Notice that the directory structure is different between the development |
|
8621 |
environment (top for packages is ../../../stx) and delivered stand alone executables, |
|
8622 |
where the top is specified via a shell environment variable, and is typically ../lib. |
|
8623 |
At runtime, Smalltalk knows about the systemPath setting." |
|
8624 |
||
10641 | 8625 |
|packageDirName packageDir| |
8626 |
||
14589 | 8627 |
packageDirName := aPackageId asPackageId string copyReplaceAll:$: with:$/. |
10641 | 8628 |
|
8629 |
packageDir := self getPackageFileName:packageDirName. |
|
8630 |
packageDir isNil ifTrue:[ |
|
18668 | 8631 |
^ nil. |
10641 | 8632 |
]. |
8633 |
^ packageDir asFilename |
|
8634 |
||
8635 |
" |
|
11375 | 8636 |
Smalltalk packageDirectoryForPackageId:'stx:libbasic' |
10641 | 8637 |
Smalltalk packageDirectoryForPackageId:'stx:goodies/persistency' |
8638 |
Smalltalk packageDirectoryForPackageId:'exept:ctypes' |
|
8639 |
" |
|
12250 | 8640 |
! |
8641 |
||
18794 | 8642 |
requirePackage:aPackageIdOrPackage |
8643 |
"make certain, that some particular package is loaded into the system. |
|
8644 |
Return true if loaded, false otherwise. |
|
8645 |
Just an alias which is easier to remember" |
|
8646 |
||
8647 |
^ self loadPackage:aPackageIdOrPackage |
|
8648 |
||
8649 |
" |
|
8650 |
Smalltalk loadPackage:'stx:libbasic' |
|
8651 |
Smalltalk loadPackage:'stx:goodies/persistency' |
|
8652 |
Smalltalk loadPackage:'cg:cparser' |
|
8653 |
Smalltalk loadPackage:'cg:rose' |
|
8654 |
" |
|
8655 |
! |
|
8656 |
||
12250 | 8657 |
unloadPackage:aPackageIdOrPackage |
8658 |
|projectDefinition| |
|
8659 |
||
8660 |
projectDefinition := aPackageIdOrPackage. |
|
8661 |
projectDefinition isProjectDefinition ifFalse:[ |
|
22791 | 8662 |
projectDefinition := projectDefinition asPackageId projectDefinitionClass. |
8663 |
projectDefinition isNil ifTrue:[ |
|
8664 |
Logger warning:'trying to unload non-existing package: %1' with:aPackageIdOrPackage. |
|
8665 |
^ self. |
|
8666 |
]. |
|
12250 | 8667 |
]. |
8668 |
projectDefinition unloadPackage. |
|
8669 |
||
8670 |
" |
|
8671 |
Smalltalk loadPackage:'stx:goodies/persistency' |
|
8672 |
Smalltalk unloadPackage:'stx:goodies/persistency' |
|
8673 |
" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8674 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8675 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8676 |
!Smalltalk class methodsFor:'system management-undeclared variables'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8677 |
|
10641 | 8678 |
clearUndeclaredVariables |
8679 |
"remove all undeclared variables" |
|
8680 |
||
8681 |
(Smalltalk at:#Undeclared) do:[:eachKey | |
|
18668 | 8682 |
Smalltalk removeKey:(self undeclaredPrefix , eachKey) asSymbol. |
10641 | 8683 |
]. |
8684 |
(Smalltalk at:#Undeclared) removeAll. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8685 |
Smalltalk removeKey:#Undeclared. |
10641 | 8686 |
! |
8687 |
||
8688 |
undeclaredPrefix |
|
8689 |
"the prefix used for undeclared variables" |
|
8690 |
||
8691 |
^ 'Undeclared:::' |
|
8692 |
||
8693 |
"Created: / 31.10.1997 / 01:13:10 / cg" |
|
7758 | 8694 |
! ! |
8695 |
||
8696 |
!Smalltalk class methodsFor:'time-versions'! |
|
8697 |
||
10641 | 8698 |
configuration |
8699 |
"{ Pragma: +optSpace }" |
|
8700 |
||
8701 |
"for developers only: return the configuration, with which |
|
8702 |
this smalltalk was compiled." |
|
8703 |
||
8704 |
%{ /* NOCONTEXT */ |
|
8705 |
extern char *__getConfigurationString(); |
|
8706 |
||
8707 |
RETURN (__MKSTRING(__getConfigurationString() COMMA_SND)); |
|
8708 |
%}. |
|
8709 |
^ 'unknownOS/unknownCONF:unknownPACK' |
|
8710 |
||
8711 |
" |
|
10071 | 8712 |
Smalltalk configuration |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8713 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8714 |
! |
453 | 8715 |
|
10641 | 8716 |
copyrightString |
8717 |
"{ Pragma: +optSpace }" |
|
8718 |
||
8719 |
"return a copyright string" |
|
8720 |
||
8721 |
%{ /* NOCONTEXT */ |
|
8722 |
#ifndef __getCopyrightString |
|
8723 |
extern OBJ __getCopyrightString(); |
|
8724 |
#endif |
|
8725 |
||
8726 |
RETURN (__getCopyrightString()); |
|
8727 |
%}. |
|
8728 |
^ self primitiveFailed |
|
8729 |
||
8730 |
" |
|
7758 | 8731 |
Smalltalk copyrightString |
8732 |
" |
|
8733 |
! |
|
8734 |
||
10641 | 8735 |
distributorString |
8736 |
"{ Pragma: +optSpace }" |
|
8737 |
||
8738 |
"return a string describing the distributor of this software" |
|
8739 |
||
8740 |
%{ /* NOCONTEXT */ |
|
8741 |
#ifndef __getDistributorString |
|
8742 |
extern OBJ __getDistributorString(); |
|
8743 |
#endif |
|
8744 |
||
8745 |
RETURN (__getDistributorString()); |
|
8746 |
%}. |
|
8747 |
^ 'eXept Software AG, Germany' |
|
8748 |
||
8749 |
" |
|
8750 |
Smalltalk distributorString |
|
8751 |
" |
|
8752 |
! |
|
8753 |
||
8754 |
expirationTime |
|
8755 |
"{ Pragma: +optSpace }" |
|
8756 |
||
8757 |
"for developers only: return the time when the system will expire. |
|
8758 |
after this time it will not run any longer. |
|
8759 |
It returns nil, if no expiration time has been set (system runs forever :-))" |
|
8760 |
||
8761 |
|exp| |
|
8762 |
||
8763 |
%{ |
|
8764 |
extern unsigned int __getExpirationTime(); |
|
8765 |
||
8766 |
exp = __MKUINT(__getExpirationTime()); |
|
8767 |
%}. |
|
8768 |
exp == 0 ifTrue:[ |
|
18668 | 8769 |
^ nil |
10641 | 8770 |
]. |
8771 |
^ Timestamp new fromOSTime:(exp * 1000). "OSTime is ms since 1970" |
|
8772 |
||
8773 |
" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8774 |
Smalltalk expirationTime |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8775 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8776 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8777 |
|
10641 | 8778 |
fullVersionString |
8779 |
"{ Pragma: +optSpace }" |
|
8780 |
||
8781 |
"return a full version string" |
|
8782 |
||
19516 | 8783 |
^ 'Smalltalk/X release %1%2 of %3' |
22791 | 8784 |
bindWith:(self versionString) |
8785 |
with:((ExternalAddress pointerSize == 8) |
|
8786 |
ifTrue:[' (64bit)'] |
|
8787 |
ifFalse:['']) |
|
8788 |
with:(self versionDate) |
|
8789 |
||
8790 |
" |
|
8791 |
Smalltalk fullVersionString |
|
10641 | 8792 |
" |
8793 |
||
8794 |
"Created: / 27.10.1997 / 17:03:09 / cg" |
|
8795 |
"Modified: / 27.10.1997 / 17:04:02 / cg" |
|
8796 |
! |
|
8797 |
||
8798 |
hello |
|
8799 |
"{ Pragma: +optSpace }" |
|
8800 |
||
8801 |
"return a greeting string" |
|
8802 |
||
8803 |
"stupid: this should come from a resource file ... |
|
18924 | 8804 |
but I don't use it here, to allow mini-systems without |
10641 | 8805 |
Resource-stuff." |
8806 |
||
19187 | 8807 |
|proto lang bit bitsPerWordString| |
10641 | 8808 |
|
8809 |
lang := Language. |
|
19187 | 8810 |
bit := 'bit'. |
8811 |
||
10641 | 8812 |
(lang == #de) ifTrue:[ |
22791 | 8813 |
proto := 'Willkommen bei %1 (%4Version %2 von %3)'. bit := 'Bit'. |
10641 | 8814 |
] ifFalse:[ (lang == #fr) ifTrue:[ |
22831 | 8815 |
proto := 'Salut, Bienvenue à%1 (%4version %2 de %3)' |
10641 | 8816 |
] ifFalse:[ (lang == #it) ifTrue:[ |
22791 | 8817 |
proto := 'Ciao, benvenuto al %1 (%4versione %2 di %3)' |
10641 | 8818 |
] ifFalse:[ (lang == #es) ifTrue:[ |
22791 | 8819 |
proto := 'Hola, bienvenida a %1 (%4version %2 de %3)' |
18924 | 8820 |
] ifFalse:[ (lang == #pt) ifTrue:[ |
22831 | 8821 |
proto := 'Olá!!, mem-vindo a %1 (%4version %2 de %3)' |
10641 | 8822 |
] ifFalse:[ (lang == #no) ifTrue:[ |
22791 | 8823 |
proto := 'Hei, verdenmottakelse til %1 (%4versjon %2 av %3)' |
10641 | 8824 |
]]]]]]. |
8825 |
||
8826 |
"/ ... more needed here ... |
|
8827 |
||
8828 |
proto isNil ifTrue:[ |
|
22791 | 8829 |
proto := 'Hello World - welcome to %1 (%4version %2 of %3)'. |
19187 | 8830 |
]. |
19492 | 8831 |
ExternalAddress pointerSize ~~ 4 ifTrue:[ |
22791 | 8832 |
bitsPerWordString := (ExternalAddress pointerSize * 8) printString,bit,' '. |
19187 | 8833 |
] ifFalse:[ |
22791 | 8834 |
bitsPerWordString := '' |
8835 |
]. |
|
10641 | 8836 |
|
8837 |
^ proto bindWith:('SmallTalk/X' allBold) |
|
22791 | 8838 |
with:(self versionString) |
8839 |
with:(self versionDate) |
|
8840 |
with:bitsPerWordString |
|
10641 | 8841 |
|
8842 |
" |
|
8843 |
Smalltalk language:#us. |
|
22791 | 8844 |
Smalltalk hello |
10641 | 8845 |
|
8846 |
Smalltalk language:#de. |
|
8847 |
Smalltalk hello |
|
8848 |
||
8849 |
Smalltalk language:#no. |
|
8850 |
Smalltalk hello |
|
8851 |
||
8852 |
Transcript showCR:(Smalltalk hello) |
|
8853 |
Stdout showCR:(Smalltalk hello) |
|
8854 |
" |
|
8855 |
||
8856 |
"Modified: 18.5.1996 / 14:25:13 / cg" |
|
8857 |
! |
|
8858 |
||
8859 |
imageRestartTime |
|
8860 |
"return a timestamp for the moment when this image was restarted. |
|
8861 |
If we do not execute from an image (i.e. fresh start), return nil." |
|
8862 |
||
8863 |
^ ImageRestartTime |
|
8864 |
||
8865 |
" |
|
8866 |
Smalltalk imageStartTime |
|
8867 |
Smalltalk imageRestartTime |
|
8868 |
" |
|
8869 |
||
8870 |
"Created: 13.12.1995 / 17:44:20 / cg" |
|
8871 |
"Modified: 6.3.1996 / 11:56:35 / cg" |
|
8872 |
! |
|
8873 |
||
8874 |
imageSaveTime |
|
8875 |
"{ Pragma: +optSpace }" |
|
8876 |
||
8877 |
"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
|
8878 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8879 |
^ ObjectMemory imageSaveTime |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8880 |
! |
7758 | 8881 |
|
10641 | 8882 |
imageStartTime |
8883 |
"{ Pragma: +optSpace }" |
|
8884 |
||
8885 |
"return a timestamp for the moment when this system started the first time |
|
8886 |
(i.e. the first initial start without an image)" |
|
8887 |
||
8888 |
^ ImageStartTime |
|
8889 |
||
8890 |
" |
|
8891 |
Smalltalk imageStartTime |
|
8892 |
Smalltalk imageRestartTime |
|
8893 |
" |
|
8894 |
||
8895 |
"Created: 13.12.1995 / 17:44:14 / cg" |
|
8896 |
"Modified: 13.12.1995 / 17:45:47 / cg" |
|
8897 |
! |
|
8898 |
||
8899 |
majorVersionNr |
|
8900 |
"{ Pragma: +optSpace }" |
|
8901 |
||
8902 |
"return the major version number. |
|
8903 |
This is only incremented for very fundamental changes, |
|
8904 |
which make old object files totally incompatible |
|
8905 |
(for example, if the layout/representation of fundamental |
|
8906 |
classes changes). |
|
8907 |
||
8908 |
ST/X revision Naming is: |
|
22791 | 8909 |
<major>.<minor>.<revision>.<release>" |
19974 | 8910 |
|
8911 |
^ 7 |
|
10641 | 8912 |
|
8913 |
" |
|
8914 |
Smalltalk majorVersionNr |
|
8915 |
" |
|
8916 |
||
19974 | 8917 |
"Modified: / 09-06-2016 / 16:28:40 / cg" |
10641 | 8918 |
! |
8919 |
||
8920 |
minorVersionNr |
|
8921 |
"{ Pragma: +optSpace }" |
|
8922 |
||
8923 |
"return the minor version number. |
|
8924 |
This is incremented for changes which make some old object |
|
8925 |
files incompatible, or the protocol changes such that some |
|
8926 |
classes need rework. |
|
8927 |
||
8928 |
ST/X revision Naming is: |
|
22791 | 8929 |
<major>.<minor>.<revision>.<release>" |
19974 | 8930 |
|
8931 |
^ 1 |
|
10641 | 8932 |
|
8933 |
" |
|
8934 |
Smalltalk minorVersionNr |
|
8935 |
" |
|
8936 |
||
19974 | 8937 |
"Modified: / 09-06-2016 / 16:28:45 / cg" |
10641 | 8938 |
! |
8939 |
||
8940 |
releaseIdentification |
|
8941 |
"{ Pragma: +optSpace }" |
|
8942 |
||
8943 |
"for developers only: return the release |
|
8944 |
(to further identify the version in case of errors)" |
|
8945 |
||
8946 |
%{ /* NOCONTEXT */ |
|
8947 |
extern OBJ __getRel(); |
|
8948 |
||
8949 |
RETURN (__getRel()); |
|
8950 |
%}. |
|
8951 |
^ 'ST/X_experimental' |
|
8952 |
||
8953 |
" |
|
8954 |
Smalltalk releaseIdentification |
|
8955 |
" |
|
8956 |
! |
|
8957 |
||
8958 |
releaseNr |
|
8959 |
"{ Pragma: +optSpace }" |
|
8960 |
||
14542 | 8961 |
"return the release number. |
8962 |
Now releaseNr is the build number (BUILD_NUMBER from Jenkins) |
|
10641 | 8963 |
|
8964 |
ST/X revision Naming is: |
|
18668 | 8965 |
<major>.<minor>.<revision>.<release>" |
14529 | 8966 |
|
8967 |
|releaseNumber| |
|
8968 |
||
8969 |
releaseNumber := Smalltalk versionBuildNumber. |
|
8970 |
releaseNumber isEmpty ifTrue:[ |
|
18668 | 8971 |
^ 0. |
14529 | 8972 |
]. |
8973 |
^ releaseNumber |
|
10641 | 8974 |
|
8975 |
" |
|
8976 |
Smalltalk releaseNr |
|
12867
2b9cbcea983b
version bump - layout of Class, Method and Context changed.
Claus Gittinger <cg@exept.de>
parents:
12861
diff
changeset
|
8977 |
Smalltalk versionString |
10641 | 8978 |
" |
8979 |
||
8980 |
"Created: / 10-12-1995 / 01:42:19 / cg" |
|
8981 |
"Modified: / 10-02-2007 / 14:49:51 / cg" |
|
8982 |
! |
|
8983 |
||
8984 |
revisionNr |
|
8985 |
"{ Pragma: +optSpace }" |
|
8986 |
||
8987 |
"return the revision number. |
|
8988 |
Incremented for releases which fix bugs/add features |
|
8989 |
and represent a stable workable version which got published |
|
8990 |
to the outside world. |
|
8991 |
||
8992 |
ST/X revision Naming is: |
|
22791 | 8993 |
<major>.<minor>.<revision>.<release>" |
19974 | 8994 |
|
8995 |
^ 0 |
|
10641 | 8996 |
|
8997 |
" |
|
8998 |
Smalltalk revisionNr |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
8999 |
Smalltalk hello string |
13014 | 9000 |
" |
9001 |
||
14898 | 9002 |
"Modified: / 19-03-2013 / 10:48:59 / az" |
19974 | 9003 |
"Modified: / 09-06-2016 / 16:28:57 / cg" |
10641 | 9004 |
! |
9005 |
||
9006 |
timeStamp |
|
9007 |
"return a string useful for timestamping a file. |
|
9008 |
The returned string is padded with spaces for a constant |
|
9009 |
length (to avoid changing a files size in fileOut with unchanged |
|
9010 |
class)." |
|
9011 |
||
9012 |
^ ('''' , self timeStampString , '''') paddedTo:80 with:(Character space) |
|
9013 |
! |
|
9014 |
||
9015 |
timeStamp:aStream |
|
9016 |
"write a string useful for timestamping a file onto aStream. |
|
9017 |
ST80 compatibility" |
|
9018 |
||
9019 |
aStream nextPutAll:(self timeStamp). |
|
9020 |
||
9021 |
"Created: / 18.6.1998 / 17:22:58 / cg" |
|
9022 |
! |
|
9023 |
||
9024 |
timeStampString |
|
9025 |
"return a string useful for timestamping a file." |
|
9026 |
||
9027 |
|dateString| |
|
9028 |
||
9029 |
dateString := String streamContents:[:s | Date today printOn:s language:#en]. "/ MUST be english !!!! |
|
9030 |
||
9031 |
^ ('From Smalltalk/X, Version:' , (Smalltalk versionString) , ' on ' |
|
9032 |
, dateString , ' at ' , Time now printString |
|
7758 | 9033 |
) |
9034 |
! |
|
9035 |
||
14529 | 9036 |
versionBuildNumber |
9037 |
"{ Pragma: +optSpace }" |
|
9038 |
||
9039 |
"return the executables build number - that's the jenkins build #. |
|
9040 |
Empty if not built by jenkins" |
|
9041 |
||
9042 |
%{ /* NOCONTEXT */ |
|
9043 |
extern char *__getBuildNumberString(); |
|
9044 |
||
9045 |
RETURN (__MKSTRING(__getBuildNumberString() COMMA_SND) ); |
|
9046 |
%}. |
|
9047 |
^ '' |
|
9048 |
||
9049 |
" |
|
9050 |
Smalltalk versionBuildNumber |
|
9051 |
" |
|
9052 |
! |
|
9053 |
||
10641 | 9054 |
versionDate |
9055 |
"{ Pragma: +optSpace }" |
|
9056 |
||
14522 | 9057 |
"return the executables build date - that's the date when the smalltalk |
10641 | 9058 |
executable was built" |
9059 |
||
9060 |
%{ /* NOCONTEXT */ |
|
9061 |
extern char *__getBuildDateString(); |
|
9062 |
||
9063 |
RETURN (__MKSTRING(__getBuildDateString() COMMA_SND) ); |
|
9064 |
%}. |
|
9065 |
^ 'today' |
|
9066 |
||
9067 |
" |
|
10071 | 9068 |
Smalltalk versionDate |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
9069 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
9070 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
9071 |
|
10641 | 9072 |
versionString |
9073 |
"{ Pragma: +optSpace }" |
|
9074 |
||
9075 |
"return the version string" |
|
9076 |
||
9077 |
^ (self majorVersionNr printString , |
|
9078 |
'.', |
|
9079 |
self minorVersionNr printString , |
|
9080 |
'.', |
|
14529 | 9081 |
self revisionNr printString, |
9082 |
'.', |
|
9083 |
self releaseNr printString) |
|
13771 | 9084 |
|
10641 | 9085 |
|
9086 |
" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
9087 |
Smalltalk versionString |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
9088 |
" |
10641 | 9089 |
! |
9090 |
||
9091 |
vmMajorVersionNr |
|
9092 |
"{ Pragma: +optSpace }" |
|
9093 |
||
9094 |
"return the VMs major version number." |
|
9095 |
%{ |
|
9096 |
RETURN (__mkSmallInteger(4)); |
|
9097 |
%}. |
|
9098 |
^ 4 |
|
9099 |
||
9100 |
" |
|
9101 |
Smalltalk vmMajorVersionNr |
|
9102 |
" |
|
2 | 9103 |
! ! |
453 | 9104 |
|
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
9105 |
!Smalltalk class methodsFor:'documentation'! |
630 | 9106 |
|
13532
638f9bfab880
changed: #recursiveInstallAutoloadedClassesFrom:rememberIn:maxLevels:noAutoload:packageTop:showSplashInLevels:
Claus Gittinger <cg@exept.de>
parents:
13531
diff
changeset
|
9107 |
version |
18560 | 9108 |
^ '$Header$' |
13532
638f9bfab880
changed: #recursiveInstallAutoloadedClassesFrom:rememberIn:maxLevels:noAutoload:packageTop:showSplashInLevels:
Claus Gittinger <cg@exept.de>
parents:
13531
diff
changeset
|
9109 |
! |
638f9bfab880
changed: #recursiveInstallAutoloadedClassesFrom:rememberIn:maxLevels:noAutoload:packageTop:showSplashInLevels:
Claus Gittinger <cg@exept.de>
parents:
13531
diff
changeset
|
9110 |
|
12172
d90a72004f43
changed: #fileNameForClass:
Claus Gittinger <cg@exept.de>
parents:
12033
diff
changeset
|
9111 |
version_CVS |
18560 | 9112 |
^ '$Header$' |
13415 | 9113 |
! |
9114 |
||
9115 |
version_SVN |
|
15225 | 9116 |
^ '$ Id: Smalltalk.st 10648 2011-06-23 15:55:10Z vranyj1 $' |
630 | 9117 |
! ! |
22792 | 9118 |