author | Claus Gittinger <cg@exept.de> |
Fri, 28 Jun 2019 08:49:56 +0200 | |
changeset 24385 | dd84e4dfb5cc |
parent 24376 | 746ce8c19ac4 |
child 24405 | 1cd295707fd7 |
permissions | -rw-r--r-- |
24136 | 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: |
23628 | 239 |
this is NOT called when an image is restarted; in this |
240 |
case the show starts in Smalltalk>>restart." |
|
241 |
||
23670 | 242 |
"/ 'basicInitializeSystem' infoPrintCR. |
23628 | 243 |
|
19992 | 244 |
OrderedCollection initialize. |
22791 | 245 |
|
20615 | 246 |
Smalltalk at:#Compiler put:ByteCodeCompiler. |
13771 | 247 |
Compiler isNil ifTrue:[ |
23628 | 248 |
" |
249 |
ByteCodeCompiler is not in the system (i.e. has not been linked in) |
|
250 |
this allows at least immediate evaluations for runtime systems without compiler |
|
251 |
NOTICE: a parser is always needed, otherwise we cannot read resource files etc. |
|
252 |
" |
|
253 |
Smalltalk at:#Compiler put:Parser |
|
16164 | 254 |
]. |
13771 | 255 |
|
11057 | 256 |
"/ |
257 |
"/ start catching SIGSEGV and SIGBUS |
|
258 |
"/ |
|
259 |
OperatingSystem enableHardSignalInterrupts. |
|
260 |
||
261 |
self initGlobalsFromEnvironment. |
|
262 |
||
263 |
"/ |
|
264 |
"/ sorry - there are some, which MUST be initialized before .. |
|
265 |
"/ reason: if any error happens during init, we need Signals, Stdout etc. to be there |
|
266 |
"/ |
|
15265 | 267 |
SmallInteger initialize. |
11057 | 268 |
Object initialize. |
18283 | 269 |
UninterpretedBytes initialize. |
21599 | 270 |
ProcessorScheduler initialize. "make sure Processor exists (RecursionLock needs it)" |
16691 | 271 |
OperatingSystem initialize. |
11057 | 272 |
Stream initialize. |
273 |
PositionableStream initialize. |
|
274 |
Filename initialize. |
|
275 |
ObjectMemory initialize. |
|
276 |
ExternalStream initialize. |
|
277 |
||
278 |
self initStandardStreams. "/ setup Stdin, Stdout etc. |
|
279 |
||
280 |
"/ |
|
281 |
"/ sorry, path must be set before ... |
|
282 |
"/ reason: some classes need it during initialize (they might need resources, bitmaps etc) |
|
283 |
"/ |
|
17534 | 284 |
"/ but, on OSX we need the CharacterEncoder to be initialized |
285 |
CharacterEncoder initialize. |
|
11057 | 286 |
self initSystemPath. |
287 |
||
288 |
"/ |
|
14427 | 289 |
"/ in case, someone needs the objectFileLoader early |
290 |
"/ |
|
16675 | 291 |
ObjectFileLoader notNil ifTrue:[ |
23628 | 292 |
ObjectFileLoader initialize. |
16675 | 293 |
]. |
14427 | 294 |
|
295 |
"/ |
|
11057 | 296 |
"/ now, finally, initialize all other classes |
297 |
"/ |
|
298 |
self initializeModules. |
|
299 |
||
300 |
ImageStartTime := Timestamp now. |
|
301 |
||
302 |
self initInterrupts. |
|
303 |
self initUserPreferences. |
|
304 |
||
16668
b88318df967d
flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents:
16666
diff
changeset
|
305 |
"/ 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
|
306 |
"/ 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
|
307 |
"/ required for some apps, for example to show the menu correctly (see launcher's help menu) |
16675 | 308 |
ApplicationModel notNil ifTrue:[ |
23628 | 309 |
ApplicationModel flushAllClassResources. |
16675 | 310 |
]. |
16668
b88318df967d
flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents:
16666
diff
changeset
|
311 |
|
11057 | 312 |
"/ |
313 |
"/ give classes a chance to perform 2nd-level initialization |
|
314 |
"/ now, we are certain, that all other classes have been initialized |
|
315 |
"/ (especially: streams and signals can now be used) |
|
316 |
"/ |
|
317 |
ObjectMemory changed:#initialized. |
|
318 |
||
319 |
"Modified: / 05-12-2006 / 21:48:58 / cg" |
|
14427 | 320 |
"Modified: / 24-10-2012 / 18:45:15 / sr" |
21599 | 321 |
"Modified: / 27-02-2017 / 20:39:14 / stefan" |
23670 | 322 |
"Modified: / 06-02-2019 / 18:01:17 / Claus Gittinger" |
11057 | 323 |
! |
324 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
325 |
initGlobalsFromEnvironment |
617 | 326 |
"setup globals from the shell-environment" |
327 |
||
328 |
|envString i langString terrString| |
|
329 |
||
5406 | 330 |
StandAlone isNil ifTrue:[ |
22791 | 331 |
StandAlone := false. |
5406 | 332 |
]. |
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
333 |
HeadlessOperation isNil ifTrue:[ |
22791 | 334 |
HeadlessOperation := false. |
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
335 |
]. |
5406 | 336 |
|
617 | 337 |
" |
338 |
extract Language and LanguageTerritory from LANG variable. |
|
5846 | 339 |
valid are for example: |
22791 | 340 |
en_en / en |
341 |
en_us |
|
342 |
en_gb |
|
343 |
de_de / de |
|
344 |
de_at (for Austria) |
|
5846 | 345 |
" |
346 |
||
347 |
Language := #en. |
|
994
6163ae7aaf9b
territory defaults to #us (instead of #usa)
Claus Gittinger <cg@exept.de>
parents:
977
diff
changeset
|
348 |
LanguageTerritory := #us. |
617 | 349 |
|
5846 | 350 |
|
351 |
"Format of LANG is: language[_territory][.codeset][@modifier] |
|
22791 | 352 |
language ISO-639 Language code |
353 |
territory ISO-3166 Contry code" |
|
7779
6d88d32bdd64
Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents:
7763
diff
changeset
|
354 |
|
6d88d32bdd64
Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents:
7763
diff
changeset
|
355 |
envString := OperatingSystem getLanguage. |
21928 | 356 |
envString notEmptyOrNil ifTrue:[ |
22791 | 357 |
i := envString indexOf:$@. |
358 |
(i ~~ 0) ifTrue:[ |
|
359 |
LanguageModifier := (envString copyFrom:(i + 1)) asLowercase asSymbol. |
|
360 |
envString := envString copyTo:(i - 1). |
|
361 |
] ifFalse:[ |
|
362 |
LanguageModifier := nil. |
|
363 |
]. |
|
364 |
i := envString indexOf:$.. |
|
365 |
(i ~~ 0) ifTrue:[ |
|
366 |
LanguageCodeset := (envString copyFrom:(i + 1)) asLowercase asSymbol. |
|
367 |
envString := envString copyTo:(i - 1). |
|
368 |
] ifFalse:[ |
|
369 |
LanguageCodeset := #'iso8859-1'. |
|
370 |
]. |
|
371 |
i := envString indexOf:$_. |
|
372 |
(i == 0) ifTrue:[ |
|
373 |
langString := envString. |
|
374 |
terrString := envString |
|
375 |
] ifFalse:[ |
|
376 |
langString := envString copyTo:(i - 1). |
|
377 |
terrString := envString copyFrom:(i + 1) |
|
378 |
]. |
|
379 |
langString := langString asLowercase. |
|
380 |
terrString := terrString asLowercase. |
|
381 |
(langString = 'c' or:[terrString = 'c']) ifTrue:[ |
|
382 |
('Smalltalk [info]: ignoring wrong LANG setting (',langString,'_',terrString,') - using english') infoPrintCR. |
|
383 |
] ifFalse:[ |
|
384 |
Language := langString asSymbol. |
|
385 |
LanguageTerritory := terrString asSymbol |
|
386 |
] |
|
617 | 387 |
]. |
388 |
||
389 |
" |
|
390 |
Smalltalk initGlobalsFromEnvironment |
|
391 |
" |
|
994
6163ae7aaf9b
territory defaults to #us (instead of #usa)
Claus Gittinger <cg@exept.de>
parents:
977
diff
changeset
|
392 |
|
14011
d33d2c6497f4
changed: #initGlobalsFromEnvironment
Claus Gittinger <cg@exept.de>
parents:
13998
diff
changeset
|
393 |
"Modified: / 14-02-2012 / 15:25:08 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
394 |
! |
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 |
initInterrupts |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
397 |
"initialize interrupts" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
398 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
399 |
OperatingSystem enableUserInterrupts. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
400 |
OperatingSystem enableHardSignalInterrupts. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
401 |
OperatingSystem enableCrashSignalInterrupts. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
402 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
403 |
ObjectMemory userInterruptHandler:self. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
404 |
ObjectMemory signalInterruptHandler:self. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
405 |
ObjectMemory recursionInterruptHandler:self. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
406 |
|
14805 | 407 |
OperatingSystem isOSXlike ifTrue:[ |
18668 | 408 |
"/ OSX sends SIGABRT for NSExceptions |
409 |
OperatingSystem operatingSystemSignal:(OperatingSystem sigABRT) install:NSException. |
|
410 |
OperatingSystem enableAbortInterrupts. |
|
14805 | 411 |
]. |
412 |
||
8583
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 |
Smalltalk initInterrupts |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
415 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
416 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
417 |
"Modified: 20.8.1997 / 09:35:49 / stefan" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
418 |
! |
617 | 419 |
|
420 |
initStandardStreams |
|
421 |
"initialize some well-known streams" |
|
422 |
||
423 |
Stdout := NonPositionableExternalStream forStdout. |
|
424 |
Stderr := NonPositionableExternalStream forStderr. |
|
425 |
Stdin := NonPositionableExternalStream forStdin. |
|
10145
cca90547778e
allow for different OS's to initialize the Printer differently
Claus Gittinger <cg@exept.de>
parents:
10143
diff
changeset
|
426 |
PrinterStream notNil ifTrue:[ |
18668 | 427 |
Printer := PrinterStream defaultPrinter. |
10145
cca90547778e
allow for different OS's to initialize the Printer differently
Claus Gittinger <cg@exept.de>
parents:
10143
diff
changeset
|
428 |
]. |
617 | 429 |
Transcript := Stderr |
430 |
||
963
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
431 |
" |
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
432 |
Smalltalk initStandardStreams |
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
433 |
" |
10145
cca90547778e
allow for different OS's to initialize the Printer differently
Claus Gittinger <cg@exept.de>
parents:
10143
diff
changeset
|
434 |
|
cca90547778e
allow for different OS's to initialize the Printer differently
Claus Gittinger <cg@exept.de>
parents:
10143
diff
changeset
|
435 |
"Modified: / 25-10-2006 / 17:36:46 / cg" |
617 | 436 |
! |
437 |
||
438 |
initStandardTools |
|
10646 | 439 |
"predefine some tools which we might need later |
617 | 440 |
- if the view-classes exist, |
441 |
they will redefine Inspector and Debugger for graphical interfaces" |
|
442 |
||
443 |
Display notNil ifTrue:[ |
|
24062 | 444 |
InspectorView notNil ifTrue:[ |
445 |
Inspector := InspectorView |
|
446 |
]. |
|
447 |
DebugView notNil ifTrue:[ |
|
448 |
Debugger := DebugView |
|
449 |
]. |
|
450 |
"/ Display initialize |
|
13303
1aa90c41dd35
changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents:
13212
diff
changeset
|
451 |
]. |
1aa90c41dd35
changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents:
13212
diff
changeset
|
452 |
|
1aa90c41dd35
changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents:
13212
diff
changeset
|
453 |
"/ make the changeFilePath an absolute one, |
1aa90c41dd35
changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents:
13212
diff
changeset
|
454 |
"/ in case some stupid windows fileDialog changes the current directory... |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
455 |
ObjectMemory |
24062 | 456 |
nameForChanges:(Filename currentDirectory / ObjectMemory nameForChangesLocal) pathName |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
457 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
458 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
459 |
Smalltalk initStandardTools |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
460 |
" |
13303
1aa90c41dd35
changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents:
13212
diff
changeset
|
461 |
|
1aa90c41dd35
changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents:
13212
diff
changeset
|
462 |
"Modified: / 09-02-2011 / 20:44:47 / cg" |
24062 | 463 |
"Modified: / 11-04-2019 / 18:07:24 / Stefan Vogel" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
464 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
465 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
466 |
initSystemPath |
617 | 467 |
"setup path where system files are searched for. |
468 |
the default path is set to: |
|
23433 | 469 |
. |
470 |
<directory of exe> (WIN32 only) |
|
471 |
$HOME (if defined) |
|
472 |
$HOME/.smalltalk (if defined & existing) |
|
473 |
$SMALLTALK_LIBDIR (if defined & existing) |
|
474 |
$STX_LIBDIR (if defined & existing) |
|
475 |
$STX_TOPDIR (if defined & existing) |
|
476 |
REGISTRY('HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X\<CurrentVersion>\LibDir') (WIN32 only) |
|
477 |
REGISTRY('HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X\LibDir') (WIN32 only) |
|
478 |
<standard places> |
|
9021 | 479 |
|
480 |
standard places (unix): |
|
23433 | 481 |
/opt/smalltalk/<release> (if existing) |
482 |
/opt/smalltalk (if existing) |
|
483 |
/usr/local/lib/smalltalk (if existing) |
|
484 |
/usr/lib/smalltalk (if existing) |
|
485 |
/lib/smalltalk (if existing) |
|
4001
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
486 |
|
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
487 |
win32: |
23433 | 488 |
\programs\exept\smalltalk (if existing) |
489 |
\programs\smalltalk (if existing) |
|
490 |
\smalltalk (if existing) |
|
4001
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
491 |
|
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
492 |
vms: |
23433 | 493 |
$stx:lib (if existing) |
494 |
$stx:root (if existing) |
|
617 | 495 |
|
496 |
of course, it is possible to add entries from the 'smalltalk.rc' |
|
497 |
startup file; add expressions such as: |
|
23433 | 498 |
Smalltalk systemPath addFirst:'/foo/bar/baz'. |
499 |
or: |
|
500 |
Smalltalk systemPath addLast:'/fee/foe/foo'. |
|
4001
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
501 |
|
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
502 |
However, smalltalk.rc itself must be found along the above path. |
617 | 503 |
" |
504 |
||
2928 | 505 |
ChangeFileName := 'changes'. |
506 |
OperatingSystem isVMSlike ifTrue:[ |
|
23433 | 507 |
BitmapDirName := 'bitmaps.dir'. |
508 |
BinaryDirName := 'binary.dir'. |
|
509 |
SourceDirName := 'source.dir'. |
|
510 |
ResourceDirName := 'resources.dir'. |
|
511 |
FileInDirName := 'filein.dir'. |
|
512 |
PackageDirName := 'packages.dir'. |
|
2928 | 513 |
] ifFalse:[ |
23433 | 514 |
BitmapDirName := 'bitmaps'. |
515 |
BinaryDirName := 'binary'. |
|
516 |
SourceDirName := 'source'. |
|
23450 | 517 |
"/ ResourceDirName := 'resources'. |
23433 | 518 |
ResourceDirName := '.resources'. |
519 |
FileInDirName := 'fileIn'. |
|
520 |
PackageDirName := 'packages'. |
|
23450 | 521 |
OperatingSystem isOSXlike ifTrue:[ |
522 |
PackageDirName := 'Packages'. |
|
23470 | 523 |
ResourceDirName := '../Resources'. |
23450 | 524 |
]. |
23462 | 525 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
526 |
ResourceDirName := 'resources'. |
|
527 |
]. |
|
16234 | 528 |
]. |
529 |
||
530 |
SystemPath isEmptyOrNil ifTrue:[ |
|
23433 | 531 |
SystemPath := OperatingSystem defaultSystemPath. |
532 |
self flushPathCaches |
|
16234 | 533 |
]. |
534 |
||
535 |
PackagePath isEmptyOrNil ifTrue:[ |
|
23433 | 536 |
PackagePath := OperatingSystem defaultPackagePath. |
18868 | 537 |
]. |
538 |
self addWorkspaceDirectoryToPackagePath. |
|
20663 | 539 |
self addIdeTopDirectoryToPackagePath. |
617 | 540 |
|
541 |
" |
|
542 |
Smalltalk initSystemPath |
|
543 |
Smalltalk systemPath |
|
11679
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
544 |
|
20640 | 545 |
SystemPath := nil. |
546 |
PackagePath := nil. |
|
11679
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
547 |
OperatingSystem defaultSystemPath |
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
548 |
OperatingSystem defaultPackagePath |
617 | 549 |
" |
5139 | 550 |
|
23462 | 551 |
"Modified: / 24-12-1999 / 00:23:35 / cg" |
23470 | 552 |
"Modified: / 25-10-2018 / 23:51:35 / Claus Gittinger" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
553 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
554 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
555 |
initUserPreferences |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
556 |
"setup other stuff" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
557 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
558 |
LogDoits := false. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
559 |
LoadBinaries := false. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
560 |
SaveEmergencyImage := (StandAlone ~~ true). |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
561 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
562 |
"Modified: / 24.10.1997 / 18:22:47 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
563 |
! |
617 | 564 |
|
7526 | 565 |
initializeClass:aClass |
566 |
"sent from VM via #initializeModules" |
|
567 |
||
7527 | 568 |
Error handle:[:ex | |
22791 | 569 |
ObjectMemory printStackBacktrace. |
570 |
ClassesFailedToInitialize isNil ifTrue:[ |
|
571 |
ClassesFailedToInitialize := IdentitySet new. |
|
572 |
]. |
|
573 |
ClassesFailedToInitialize add:aClass. |
|
574 |
('Smalltalk [warning]: error during initialize of ' , aClass name,': ', ex description printString) errorPrintCR. |
|
575 |
ex suspendedContext fullPrintAll. |
|
576 |
'------------------------------------------------' errorPrintCR. |
|
577 |
(Debugging == true) ifTrue:[ |
|
578 |
ex reject |
|
579 |
]. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
580 |
] do:[ |
22791 | 581 |
aClass initialize |
13675 | 582 |
]. |
583 |
||
584 |
"Modified: / 11-09-2011 / 17:01:32 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
585 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
586 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
587 |
initializeModules |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
588 |
"perform module specific initialization and |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
589 |
send #initialize to all classes. |
16180 | 590 |
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
|
591 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
592 |
self initializeModulesOnce. |
23773 | 593 |
ClassesFailedToInitialize notEmptyOrNil ifTrue:[ |
594 |
('Smalltalk [info]: retry initialization of failed class(es)...') infoPrintCR. |
|
595 |
ClassesFailedToInitialize := nil. |
|
596 |
self initializeModulesOnce. |
|
597 |
ClassesFailedToInitialize notEmptyOrNil ifTrue:[ |
|
598 |
('Smalltalk [error]: class(es) persist to fail during initialize') errorPrintCR. |
|
599 |
] |
|
10122 | 600 |
]. |
601 |
||
602 |
ProjectDefinition initializeAllProjectDefinitions. |
|
603 |
||
604 |
"Modified: / 23-10-2006 / 16:40:39 / cg" |
|
23773 | 605 |
"Modified: / 22-02-2019 / 16:36:52 / Stefan Vogel" |
7527 | 606 |
! |
607 |
||
7563 | 608 |
initializeModulesOnce |
609 |
"perform module specific initialization and |
|
610 |
send #initialize to all classes. |
|
7527 | 611 |
Notice: this is not called when an image is restarted" |
4963 | 612 |
|
617 | 613 |
%{ |
18349 | 614 |
#ifdef __SCHTEAM__ |
615 |
STClass.initializeAllClasses(__c__); |
|
616 |
return __c__._RETURN_self(); |
|
617 |
#else |
|
1688
8a42db1eea60
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1682
diff
changeset
|
618 |
__init_registered_modules__(3); |
4963 | 619 |
|
1481 | 620 |
@global(DemoMode) = __getDemoMode() ? true : false; |
5410 | 621 |
RETURN (self); |
18349 | 622 |
#endif /* not SCHTEAM */ |
5410 | 623 |
%}. |
624 |
^ self primitiveFailed |
|
617 | 625 |
! |
626 |
||
7563 | 627 |
initializeSystem |
16655 | 628 |
"initialize all classes; setup dispatcher processes etc. |
3499 | 629 |
This one is the very first entry into the smalltalk world, |
16655 | 630 |
right after startup, usually immediately followed by Smalltalk>>start. |
631 |
Here, a few specific initializations are done, then the actual initialization is |
|
632 |
done inside an error handler in basicInitializeSystem. |
|
10071 | 633 |
Notice: |
22791 | 634 |
this is called by the VM's main entry. You will not find senders from Smalltalk. |
18385 | 635 |
Also Notice: |
22791 | 636 |
this is NOT called when an image is restarted; |
637 |
in this case the show starts in Smalltalk>>restart." |
|
211 | 638 |
|
19510 | 639 |
|idx shellArgs| |
6841
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
640 |
|
12861 | 641 |
NumberOfClassesHint := 10000. |
8964
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
642 |
|
3499 | 643 |
Initializing := true. |
644 |
AbstractOperatingSystem initializeConcreteClass. |
|
645 |
||
18307
c1d97d109f88
also care for empty cmd-line args (could be empty OrderedCollection)
Claus Gittinger <cg@exept.de>
parents:
18293
diff
changeset
|
646 |
CommandLineArguments isEmptyOrNil ifTrue:[ |
22791 | 647 |
CommandLineArguments := #('stx') asOrderedCollection. |
5400 | 648 |
]. |
4006
c7ad38c52eb9
must set CommandLineArguments earlier (to be available in initializeSystem)
Claus Gittinger <cg@exept.de>
parents:
4001
diff
changeset
|
649 |
CommandLine := CommandLineArguments copy. |
c7ad38c52eb9
must set CommandLineArguments earlier (to be available in initializeSystem)
Claus Gittinger <cg@exept.de>
parents:
4001
diff
changeset
|
650 |
CommandLineArguments := CommandLineArguments asOrderedCollection. |
6842 | 651 |
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
|
652 |
|
21021 | 653 |
SilentLoading := Silent := false. |
654 |
VerboseLoading := VerboseStartup := Verbose := false. |
|
19427 | 655 |
DebuggingStandAlone := Debugging := false. |
19510 | 656 |
|
657 |
"/ if no argument was given, look for an environment variable named |
|
658 |
"/ STX_DEFAULT_ARGS. If set, take that. |
|
659 |
"/ if any argument was given, unless a --noShellArgs argument is given, |
|
660 |
"/ slice in the value from "STX_MORE_ARGS" at the beginning. |
|
661 |
"/ |
|
662 |
"/ These allow for args like "--quick --infoPrint" to be automatically prepended |
|
19511 | 663 |
idx := CommandLineArguments indexOfAny:#('--noShellArgs' '--noshellargs'). |
19510 | 664 |
(idx ~~ 0) ifTrue:[ |
22791 | 665 |
CommandLineArguments removeIndex:idx. |
666 |
] ifFalse:[ |
|
667 |
CommandLineArguments isEmpty ifTrue:[ |
|
668 |
shellArgs := OperatingSystem getEnvironment:'STX_DEFAULT_ARGS'. |
|
669 |
shellArgs notEmptyOrNil ifTrue:[ |
|
670 |
shellArgs := shellArgs asCollectionOfWords. |
|
671 |
CommandLineArguments addAll:shellArgs. |
|
672 |
]. |
|
673 |
] ifFalse:[ |
|
674 |
"/ prepend shell environment args from "STX_ARGS" |
|
675 |
shellArgs := OperatingSystem getEnvironment:'STX_MORE_ARGS'. |
|
676 |
shellArgs notEmptyOrNil ifTrue:[ |
|
677 |
shellArgs := shellArgs asCollectionOfWords. |
|
678 |
CommandLineArguments addAllFirst:shellArgs. |
|
679 |
]. |
|
680 |
]. |
|
681 |
]. |
|
682 |
||
683 |
self initializeVerboseFlags. |
|
14432 | 684 |
|
11057 | 685 |
Error handle:[:ex | |
22791 | 686 |
StandAlone ifTrue:[ |
687 |
DebuggingStandAlone ifFalse:[ |
|
688 |
'Startup Error - use "--debug" command line argument for more info' errorPrintCR. |
|
689 |
Smalltalk exit:1. |
|
690 |
]. |
|
691 |
'Smalltalk [error]: Error during early initialization:' errorPrintCR. |
|
692 |
thisContext fullPrintAll. |
|
693 |
]. |
|
694 |
ex reject. |
|
11057 | 695 |
] do:[ |
22791 | 696 |
self basicInitializeSystem |
14432 | 697 |
]. |
13091
bc840cd6f1ae
--verboseLoading command line arg (shlib loading trace)
Claus Gittinger <cg@exept.de>
parents:
13061
diff
changeset
|
698 |
|
bc840cd6f1ae
--verboseLoading command line arg (shlib loading trace)
Claus Gittinger <cg@exept.de>
parents:
13061
diff
changeset
|
699 |
"Modified: / 12-10-2010 / 11:27:47 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
700 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
701 |
|
18669 | 702 |
initializeVerboseFlags |
703 |
|idx| |
|
704 |
||
21021 | 705 |
StandAlone ifTrue:[ |
23677 | 706 |
InfoPrinting := Verbose := false. |
23628 | 707 |
ObjectMemory infoPrinting:false. |
708 |
IgnoreAssertions := true. |
|
21021 | 709 |
] ifFalse:[ |
23628 | 710 |
IgnoreAssertions := false. |
22791 | 711 |
]. |
712 |
||
19430 | 713 |
(idx := CommandLineArguments indexOf:'--ignoreHalt') ~~ 0 ifTrue:[ |
23628 | 714 |
CommandLineArguments removeIndex:idx. |
715 |
IgnoreHalt := true. |
|
19430 | 716 |
]. |
20855 | 717 |
(idx := CommandLineArguments indexOf:'--noIgnoreHalt') ~~ 0 ifTrue:[ |
23628 | 718 |
CommandLineArguments removeIndex:idx. |
719 |
IgnoreHalt := false. |
|
20855 | 720 |
]. |
721 |
(idx := CommandLineArguments indexOf:'--ignoreAssert') ~~ 0 ifTrue:[ |
|
23628 | 722 |
CommandLineArguments removeIndex:idx. |
723 |
IgnoreAssertions := true. |
|
20855 | 724 |
]. |
725 |
(idx := CommandLineArguments indexOf:'--noIgnoreAssert') ~~ 0 ifTrue:[ |
|
23628 | 726 |
CommandLineArguments removeIndex:idx. |
727 |
IgnoreAssertions := false. |
|
20855 | 728 |
]. |
22314 | 729 |
(idx := CommandLineArguments indexOf:'--assert') ~~ 0 ifTrue:[ |
23628 | 730 |
CommandLineArguments removeIndex:idx. |
731 |
IgnoreAssertions := false. |
|
22314 | 732 |
]. |
18669 | 733 |
(idx := CommandLineArguments indexOf:'--silentStartup') ~~ 0 ifTrue:[ |
23628 | 734 |
CommandLineArguments removeIndex:idx. |
735 |
SilentLoading := true. |
|
18669 | 736 |
]. |
737 |
(idx := CommandLineArguments indexOf:'--verboseLoading') ~~ 0 ifTrue:[ |
|
23628 | 738 |
CommandLineArguments removeIndex:idx. |
739 |
VerboseLoading := true. |
|
18669 | 740 |
]. |
741 |
(idx := CommandLineArguments indexOf:'--verboseStartup') ~~ 0 ifTrue:[ |
|
23628 | 742 |
CommandLineArguments removeIndex:idx. |
743 |
VerboseLoading := true. |
|
744 |
VerboseStartup := true. |
|
18669 | 745 |
]. |
20855 | 746 |
|
747 |
"/ reinterpret those, in case given after the VM options. |
|
748 |
(idx := CommandLineArguments indexOf:'--debugPrint') ~~ 0 ifTrue:[ |
|
23628 | 749 |
CommandLineArguments removeIndex:idx. |
750 |
ObjectMemory debugPrinting:true. |
|
20855 | 751 |
]. |
752 |
(idx := CommandLineArguments indexOf:'--infoPrint') ~~ 0 ifTrue:[ |
|
23628 | 753 |
CommandLineArguments removeIndex:idx. |
754 |
ObjectMemory infoPrinting:true. |
|
23679 | 755 |
Object infoPrinting:true. |
20855 | 756 |
]. |
757 |
||
18669 | 758 |
(idx := CommandLineArguments indexOf:'--verbose') ~~ 0 ifTrue:[ |
23679 | 759 |
StandAlone ifFalse:[ CommandLineArguments removeIndex:idx ]. |
23628 | 760 |
Object infoPrinting:true. |
761 |
Verbose := true. |
|
762 |
VerboseLoading := true. |
|
763 |
VerboseStartup := true. |
|
764 |
Logger notNil ifTrue:[ |
|
765 |
Logger loggingThreshold: Logger severityALL. |
|
766 |
]. |
|
21020 | 767 |
]. |
768 |
||
769 |
Silent := false. |
|
770 |
(idx := CommandLineArguments indexOf:'--silent') ~~ 0 ifTrue:[ |
|
23679 | 771 |
StandAlone ifFalse:[ CommandLineArguments removeIndex:idx ]. |
23628 | 772 |
Silent := SilentLoading := true. |
773 |
Object infoPrinting:false. |
|
774 |
ObjectMemory infoPrinting:false. |
|
775 |
ObjectMemory debugPrinting:false. |
|
776 |
Verbose := VerboseLoading := VerboseStartup := false. |
|
777 |
Logger notNil ifTrue:[ |
|
778 |
Logger loggingThreshold: Logger severityNONE |
|
779 |
]. |
|
18669 | 780 |
]. |
21021 | 781 |
|
782 |
idx := CommandLineArguments indexOf:'--debug'. |
|
783 |
Debugging := (idx ~~ 0). |
|
784 |
||
785 |
StandAlone ifTrue:[ |
|
23628 | 786 |
DebuggingStandAlone := Debugging. |
787 |
DebuggingStandAlone ifTrue:[ |
|
788 |
Inspector := MiniInspector. |
|
789 |
Debugger := MiniDebugger. |
|
790 |
IgnoreAssertions := false. |
|
791 |
]. |
|
21021 | 792 |
] ifFalse:[ |
23628 | 793 |
"/ |
794 |
"/ define low-level debugging tools - graphical classes are not prepared yet |
|
795 |
"/ to handle things. |
|
796 |
"/ This will bring us into the MiniDebugger when an error occurs during startup. |
|
797 |
"/ |
|
798 |
Inspector := MiniInspector. |
|
799 |
Debugger := MiniDebugger. |
|
21021 | 800 |
]. |
22314 | 801 |
|
802 |
"Modified: / 12-10-2017 / 17:48:11 / cg" |
|
23679 | 803 |
"Modified: / 06-02-2019 / 21:15:30 / Claus Gittinger" |
18669 | 804 |
! |
805 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
806 |
isInitialized |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
807 |
"this returns true, if the system is properly initialized; |
16170
ca4d03def070
endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents:
16164
diff
changeset
|
808 |
i.e. false during startup. |
15980 | 809 |
Especially, the whole display/viewing stuff and process escheduling |
810 |
is not working correctly until initialized." |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
811 |
|
18251
9b7f8e531a16
isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents:
18248
diff
changeset
|
812 |
Initializing isNil ifTrue:[^ false]. "/ if called very early |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
813 |
^ Initializing not |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
814 |
! |
1 | 815 |
|
7563 | 816 |
reinitStandardStreams |
817 |
"reinitialize some well-known streams. |
|
818 |
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
|
819 |
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
|
820 |
(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
|
821 |
|
8710aba7876b
oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents:
457
diff
changeset
|
822 |
Stdout reOpen. Stderr reOpen. Stdin reOpen. |
161 | 823 |
! ! |
824 |
||
24376 | 825 |
|
16593 | 826 |
!Smalltalk class methodsFor:'Compatibility-GNU'! |
827 |
||
828 |
system:command |
|
829 |
"GNU-Smalltalk compatibility: execute an OS command" |
|
830 |
||
23714 | 831 |
^ OperatingSystem executeCommand:command |
16593 | 832 |
|
833 |
" |
|
834 |
Smalltalk system:'ls' |
|
835 |
" |
|
23714 | 836 |
|
837 |
"Modified: / 10-02-2019 / 22:49:39 / Claus Gittinger" |
|
16593 | 838 |
! ! |
839 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
840 |
!Smalltalk class methodsFor:'Compatibility-Squeak'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
841 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
842 |
beep |
17343 | 843 |
"output an audible beep or bell" |
844 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
845 |
Screen current beep |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
846 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
847 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
848 |
garbageCollect |
15009 | 849 |
"for Squeak compatibility" |
850 |
||
851 |
ObjectMemory garbageCollect |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
852 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
853 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
854 |
garbageCollectMost |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
855 |
"collect recently created garbage; return the amount of freeSpace. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
856 |
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
|
857 |
newSpace + freeListSpace is returned." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
858 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
859 |
ObjectMemory scavenge. |
15009 | 860 |
^ ObjectMemory freeSpace + (ObjectMemory newSpaceSize - ObjectMemory newSpaceUsed) |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
861 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
862 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
863 |
isMorphic |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
864 |
^ false |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
865 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
866 |
|
10844 | 867 |
platformName |
868 |
"not yet fully implemented (I have to figure out, what squeak returns in each case...)" |
|
869 |
||
870 |
^ OperatingSystem platformName asUppercaseFirst |
|
871 |
||
872 |
" |
|
873 |
Smalltalk platformName -> 'Win32' |
|
874 |
" |
|
875 |
! |
|
876 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
877 |
registerExternalObject: anObject |
7563 | 878 |
"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
|
879 |
If it is already there, just return its index. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
880 |
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
|
881 |
primitive code (via the global Smalltalk:SpecialObjectArray)" |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
882 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
883 |
| objects firstEmptyIndex obj sz newObjects | |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
884 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
885 |
objects := SpecialObjectArray. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
886 |
objects isNil ifTrue:[ |
18668 | 887 |
objects := Array new:5. |
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
888 |
]. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
889 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
890 |
"find the first empty slot and look if already registered" |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
891 |
firstEmptyIndex := 0. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
892 |
1 to: objects size do: [:i | |
18668 | 893 |
obj := objects at: i. |
894 |
obj == anObject ifTrue: [^ i]. "object already there, just return its index" |
|
895 |
(obj == nil and: [firstEmptyIndex = 0]) ifTrue: [ |
|
896 |
firstEmptyIndex := i |
|
897 |
] |
|
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
898 |
]. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
899 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
900 |
"if no empty slots, expand the array" |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
901 |
firstEmptyIndex = 0 ifTrue: [ |
18668 | 902 |
sz := objects size. |
903 |
newObjects := objects species new: sz + 20. "grow linearly" |
|
904 |
newObjects replaceFrom: 1 to: sz with: objects startingAt: 1. |
|
905 |
firstEmptyIndex := sz + 1. |
|
906 |
SpecialObjectArray := newObjects. |
|
907 |
objects := newObjects |
|
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
908 |
]. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
909 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
910 |
objects at: firstEmptyIndex put: anObject. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
911 |
^ firstEmptyIndex |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
912 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
913 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
914 |
|
12358 | 915 |
removeClassNamed: aName |
17576 | 916 |
"Invoked from fileouts: if there is currently a class in the system named aName, then remove it. |
917 |
Also needed by the refactory browser. |
|
918 |
If anything untoward happens, report it in the Transcript." |
|
12358 | 919 |
|
920 |
| oldClass | |
|
921 |
||
922 |
(oldClass := self at: aName asSymbol ifAbsent: [nil]) isNil ifTrue:[ |
|
18668 | 923 |
Transcript showCR: 'Removal of class named ', aName, ' ignored because it does not exist.'. |
924 |
^ self |
|
12358 | 925 |
]. |
926 |
oldClass removeFromSystem |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
927 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
928 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
929 |
!Smalltalk class methodsFor:'Compatibility-V''Age'! |
6722
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
930 |
|
7563 | 931 |
allClassesImplementing:aSelector |
12304
b0dc1c58de1a
changed: #allClassesImplementing:
Claus Gittinger <cg@exept.de>
parents:
12301
diff
changeset
|
932 |
^ self allClassesForWhich:[:cls | cls includesSelector:aSelector]. |
9506 | 933 |
|
934 |
"Modified: / 10-08-2006 / 12:12:17 / cg" |
|
9090 | 935 |
! |
936 |
||
16459 | 937 |
declareConstant:constantName poolName:poolNameArg value:value |
938 |
"visualAge compatible pool variable declaration. |
|
16562 | 939 |
called when a V'age application is filed in |
16459 | 940 |
(or one of its changes is accepted via the change browser)" |
941 |
||
942 |
|ns poolName pool| |
|
943 |
||
944 |
"/ when coming from the change-browser, |
|
945 |
"/ a namespace override may be given... |
|
946 |
ns := Class nameSpaceQuerySignal query. |
|
947 |
(ns isNil or:[ns == Smalltalk]) ifTrue:[ |
|
18668 | 948 |
poolName := poolNameArg asSymbol |
16459 | 949 |
] ifFalse:[ |
18668 | 950 |
poolName := (ns name,'::',poolNameArg) asSymbol |
16459 | 951 |
]. |
9090 | 952 |
pool := self classNamed:poolName. |
953 |
pool declareConstant:constantName value:value |
|
954 |
! |
|
955 |
||
16459 | 956 |
declarePoolDictionary:poolDictionaryNameArg |
957 |
"visualAge compatible pool declaration. |
|
16562 | 958 |
called when a V'age application is filed in |
16459 | 959 |
(or one of its changes is accepted via the change browser)" |
960 |
||
961 |
|ns poolName| |
|
962 |
||
963 |
poolName := poolDictionaryNameArg asSymbol. |
|
964 |
||
965 |
"/ "/ when coming from the change-browser, |
|
966 |
"/ "/ a namespace override may be given... |
|
967 |
"/ ns := Class nameSpaceQuerySignal query. |
|
968 |
"/ (ns isNil or:[ns == Smalltalk]) ifTrue:[ |
|
969 |
"/ poolName := poolDictionaryNameArg asSymbol |
|
970 |
"/ ] ifFalse:[ |
|
971 |
"/ poolName := (ns name,'::',poolDictionaryNameArg) asSymbol |
|
972 |
"/ ]. |
|
973 |
^ SharedPool subclass:(poolName asSymbol) |
|
18668 | 974 |
instanceVariableNames:'' |
975 |
classVariableNames:'' |
|
976 |
poolDictionaries:'' |
|
977 |
category:'* VAST Pools' |
|
13998
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
978 |
|
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
979 |
"Modified: / 07-02-2012 / 15:56:16 / cg" |
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
980 |
! |
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
981 |
|
16459 | 982 |
declareVariable:varName poolName:poolNameArg |
983 |
"visualAge compatible pool declaration. |
|
16562 | 984 |
called when a V'age application is filed in |
16459 | 985 |
(or one of its changes is accepted via the change browser)" |
986 |
||
987 |
|ns poolName pool| |
|
988 |
||
989 |
"/ when coming from the change-browser, |
|
990 |
"/ a namespace override may be given... |
|
991 |
ns := Class nameSpaceQuerySignal query. |
|
992 |
(ns isNil or:[ns == Smalltalk]) ifTrue:[ |
|
18668 | 993 |
poolName := poolNameArg asSymbol |
16459 | 994 |
] ifFalse:[ |
18668 | 995 |
poolName := (ns name,'::',poolNameArg) asSymbol |
16459 | 996 |
]. |
13998
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
997 |
pool := self classNamed:poolName. |
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
998 |
pool declareVariable:varName |
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
999 |
|
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
1000 |
"Created: / 07-02-2012 / 15:57:05 / cg" |
6722
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
1001 |
! ! |
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
1002 |
|
20755 | 1003 |
!Smalltalk class methodsFor:'Compatibility-VW'! |
6094
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
1004 |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1005 |
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
|
1006 |
^ self |
18668 | 1007 |
defineClass:nameSymbol |
1008 |
superclass:superclass |
|
1009 |
indexedType:indexed |
|
1010 |
private:private |
|
1011 |
instanceVariableNames:instVars |
|
1012 |
classInstanceVariableNames:classInstVars |
|
1013 |
imports:imports |
|
1014 |
category:category |
|
1015 |
attributes:nil |
|
12033 | 1016 |
! |
1017 |
||
7563 | 1018 |
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
|
1019 |
|newClass| |
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
1020 |
|
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
1021 |
indexed == #none ifTrue:[ |
23789 | 1022 |
newClass := superclass |
1023 |
subclass:nameSymbol |
|
1024 |
instanceVariableNames:instVars |
|
1025 |
classVariableNames:'' |
|
1026 |
poolDictionaries:'' |
|
1027 |
category:category |
|
1028 |
inEnvironment:self. |
|
1029 |
classInstVars size ~~ 0 ifTrue:[ |
|
1030 |
newClass class instanceVariableNames:classInstVars. |
|
1031 |
]. |
|
1032 |
^ newClass |
|
6851 | 1033 |
]. |
1034 |
self shouldImplement. |
|
23789 | 1035 |
|
1036 |
"Modified: / 01-03-2019 / 16:11:54 / Claus Gittinger" |
|
12033 | 1037 |
! |
1038 |
||
1039 |
defineNameSpace:nameSymbol private:private imports:imports category:category |
|
1040 |
|newNameSpace| |
|
1041 |
||
1042 |
private ifTrue:[self halt]. "/ what to do ? |
|
1043 |
imports withoutSeparators notEmpty ifTrue:[self halt]. "/ what to do ? |
|
1044 |
newNameSpace := NameSpace name:nameSymbol. |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1045 |
newNameSpace setCategory:category. |
12033 | 1046 |
^ newNameSpace |
20755 | 1047 |
! |
1048 |
||
1049 |
dialectName |
|
1050 |
^ #SmalltalkX |
|
1051 |
||
1052 |
" |
|
1053 |
Smalltalk dialectName |
|
1054 |
" |
|
1055 |
! |
|
1056 |
||
1057 |
dialectReleaseVersion |
|
1058 |
^ self versionString |
|
1059 |
||
1060 |
" |
|
1061 |
Smalltalk dialectReleaseVersion |
|
1062 |
" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1063 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1064 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1065 |
!Smalltalk class methodsFor:'accessing'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1066 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1067 |
associationAt:aKey |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1068 |
"return a key-value association for aKey. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1069 |
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
|
1070 |
simulated here." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1071 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1072 |
|val| |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1073 |
|
20161 | 1074 |
val := self at:aKey ifAbsent:[^ nil]. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1075 |
^ Association key:aKey value:val |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1076 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1077 |
"Created: / 1.11.1997 / 13:27:20 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1078 |
! |
3083 | 1079 |
|
7563 | 1080 |
associationAt:aKey ifAbsent:exceptionBlock |
1081 |
"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
|
1082 |
from exceptionBlock, if no such key is present. |
14973 | 1083 |
Since ST/X's Smalltalk as no real dictionary, this is simulated here. |
20161 | 1084 |
Warning: this is a compatibility interface only, with a different semantic as |
22791 | 1085 |
the original ST80 implementation. The returned assoc is created on the fly, |
1086 |
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
|
1087 |
|
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
1088 |
|val| |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
1089 |
|
20161 | 1090 |
val := self at:aKey ifAbsent:[^ exceptionBlock value]. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1091 |
^ Association key:aKey value:val |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1092 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1093 |
"Created: / 18.6.1998 / 17:05:24 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1094 |
! |
3610
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
1095 |
|
7563 | 1096 |
at:aKey |
10071 | 1097 |
"retrieve the value stored under aKey, a symbol. |
1098 |
Return nil if not present |
|
1956 | 1099 |
(this will be changed to trigger an error - better use #at:ifAbsent:)" |
453 | 1100 |
|
16831 | 1101 |
aKey class == Symbol ifFalse:[self error:'expected symbol']. |
6080
15ea3cbf6003
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
6074
diff
changeset
|
1102 |
|
453 | 1103 |
%{ /* NOCONTEXT */ |
18287 | 1104 |
#ifdef __SCHTEAM__ |
1105 |
{ |
|
18668 | 1106 |
STSymbol keySymbol = aKey.asSTSymbol(); |
1107 |
STObject val = STSmalltalkEnvironment.GetResolvedBindingOrNull(keySymbol); |
|
1108 |
||
1109 |
return context._RETURN( val == null ? Nil : val ); |
|
18287 | 1110 |
} |
1111 |
/* NOT REACHED */ |
|
1112 |
#else |
|
453 | 1113 |
RETURN ( __GLOBAL_GET(aKey) ); |
18287 | 1114 |
#endif |
5406 | 1115 |
%}. |
5410 | 1116 |
^ self primitiveFailed |
453 | 1117 |
! |
1118 |
||
7563 | 1119 |
at:aKey ifAbsent:aBlock |
1120 |
"retrieve the value stored at aKey. |
|
7565 | 1121 |
If there is nothing stored under this key, return the value of |
1122 |
the evaluation of aBlock." |
|
453 | 1123 |
|
20161 | 1124 |
|val| |
1125 |
||
1126 |
val := self at:aKey. |
|
1127 |
(val notNil or:[self includesKey:aKey]) ifTrue:[ |
|
22791 | 1128 |
^ val |
453 | 1129 |
]. |
1130 |
^ aBlock value |
|
1131 |
||
1132 |
" |
|
20161 | 1133 |
Smalltalk removeKey:#fooBar. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1134 |
Smalltalk at:#fooBar <- returns nil |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1135 |
Smalltalk at:#fooBar ifAbsent:['sorry'] <- no error |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1136 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1137 |
! |
453 | 1138 |
|
15068 | 1139 |
at:aKey ifAbsentPut:aBlock |
1140 |
"return the element indexed by aKey if present, |
|
1141 |
if not present, store the result of evaluating valueBlock |
|
1142 |
under aKey and return it." |
|
1143 |
||
1144 |
^ self at:aKey ifAbsent:[ self at:aKey put:aBlock value ]. |
|
1145 |
||
1146 |
"Created: / 29-05-2007 / 12:41:12 / cg" |
|
1147 |
! |
|
1148 |
||
7563 | 1149 |
at:aKey ifPresent:aBlock |
1150 |
"try to retrieve the value stored at aKey. |
|
1151 |
If there is nothing stored under this key, do nothing. |
|
4870 | 1152 |
Otherwise, evaluate aBlock, passing the retrieved value as argument." |
1153 |
||
13883 | 1154 |
|val| |
1155 |
||
20161 | 1156 |
val := self at:aKey. |
1157 |
(val notNil or:[self includesKey:aKey]) ifTrue:[ |
|
22791 | 1158 |
^ aBlock value:val. |
4870 | 1159 |
]. |
1160 |
^ nil |
|
1161 |
||
1162 |
" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1163 |
Smalltalk at:#fooBar ifPresent:[:what | Transcript showCR:what]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1164 |
Smalltalk at:#Object ifPresent:[:what | Transcript showCR:what]. |
20161 | 1165 |
|
1166 |
Smalltalk at:#fooBar put:nil. |
|
1167 |
Smalltalk at:#fooBar ifPresent:[:what | Transcript showCR:what]. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1168 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1169 |
|
13883 | 1170 |
"Modified: / 27-12-2011 / 10:14:30 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1171 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1172 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1173 |
at:aKey put:aValue |
7563 | 1174 |
"store the argument aValue under aKey, a symbol. |
1175 |
Return aValue (sigh)." |
|
453 | 1176 |
|
1177 |
|oldValue| |
|
1178 |
||
1179 |
%{ |
|
18287 | 1180 |
#ifdef __SCHTEAM__ |
1181 |
{ |
|
18668 | 1182 |
STSymbol keySymbol = aKey.asSTSymbol(); |
1183 |
oldValue = STSmalltalkEnvironment.SetBinding(keySymbol, aValue); |
|
18287 | 1184 |
} |
1185 |
#else |
|
453 | 1186 |
oldValue = __GLOBAL_SET(aKey, aValue, (OBJ *)0); |
18287 | 1187 |
#endif |
453 | 1188 |
%}. |
1189 |
CachedClasses notNil ifTrue:[ |
|
18668 | 1190 |
oldValue isBehavior ifTrue:[ |
1191 |
oldValue name == aKey ifTrue:[ |
|
1192 |
CachedClasses remove:oldValue ifAbsent:[] |
|
1193 |
] |
|
1194 |
]. |
|
1195 |
aValue isBehavior ifTrue:[ |
|
1196 |
aValue name == aKey ifTrue:[ |
|
1197 |
CachedClasses add:aValue |
|
1198 |
] ifFalse:[ |
|
1199 |
CachedClasses := nil |
|
1200 |
] |
|
1201 |
]. |
|
453 | 1202 |
]. |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
1203 |
^ aValue. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1204 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1205 |
"Modified: 19.4.1996 / 11:31:49 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1206 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1207 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1208 |
includesKey:aKey |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1209 |
"return true, if the key is known" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1210 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1211 |
"/ for debugging - this is a common mistake, |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1212 |
"/ to try to access a class by nameString, instead |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1213 |
"/ of by symbol. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1214 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1215 |
"/ aKey class == String ifTrue:[self halt]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1216 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1217 |
%{ /* NOCONTEXT */ |
18287 | 1218 |
#ifdef __SCHTEAM__ |
1219 |
STSymbol keySymbol = aKey.asSTSymbol(); |
|
18668 | 1220 |
return __c__._RETURN( STSmalltalkEnvironment.HasBinding(keySymbol) ? STObject.True : STObject.False); |
18287 | 1221 |
/* NOT REACHED */ |
1222 |
#else |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1223 |
RETURN ( __GLOBAL_KEYKNOWN(aKey) ); |
18287 | 1224 |
#endif |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1225 |
%}. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1226 |
^ self primitiveFailed |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1227 |
! |
453 | 1228 |
|
7563 | 1229 |
keyAtValue:anObject |
21365 | 1230 |
"return the symbol under which anObject is stored - or nil. |
1231 |
This is a slow access, since the receiver is searched sequentially. |
|
1232 |
NOTICE: |
|
22791 | 1233 |
The value is searched using identity compare" |
453 | 1234 |
|
1235 |
self keysDo:[:aKey | |
|
22791 | 1236 |
(self at:aKey) == anObject ifTrue:[^ aKey] |
453 | 1237 |
]. |
1238 |
^ nil |
|
1239 |
||
1240 |
"Smalltalk keyAtValue:Object" |
|
21365 | 1241 |
|
1242 |
"Modified (comment): / 07-02-2017 / 11:06:21 / cg" |
|
453 | 1243 |
! |
1244 |
||
21363 | 1245 |
keyAtValue:anObject ifAbsent:exceptionValue |
21365 | 1246 |
"return the symbol under which anObject is stored - or the value from exceptionValue. |
1247 |
This is a slow access, since the receiver is searched sequentially. |
|
1248 |
NOTICE: |
|
22791 | 1249 |
The value is searched using identity compare" |
21363 | 1250 |
|
1251 |
self keysDo:[:aKey | |
|
22791 | 1252 |
(self at:aKey) == anObject ifTrue:[^ aKey] |
21363 | 1253 |
]. |
1254 |
^ exceptionValue value |
|
1255 |
||
1256 |
" |
|
1257 |
Smalltalk keyAtValue:Object ifAbsent:#foo |
|
1258 |
Smalltalk keyAtValue:1234 ifAbsent:#foo |
|
1259 |
" |
|
1260 |
||
1261 |
"Created: / 07-02-2017 / 10:58:51 / cg" |
|
1262 |
! |
|
1263 |
||
7563 | 1264 |
keys |
1265 |
"return a collection with all keys in the Smalltalk dictionary" |
|
1266 |
||
1267 |
|keys| |
|
453 | 1268 |
|
1269 |
keys := IdentitySet new. |
|
1270 |
self keysDo:[:k | keys add:k]. |
|
1271 |
^ keys |
|
617 | 1272 |
! |
1273 |
||
7563 | 1274 |
removeKey:aKey |
1275 |
"remove the association stored under the key-argument from the globals dictionary. |
|
10071 | 1276 |
WARNING: |
18668 | 1277 |
this is somewhat dangerous: conceptionally, the association is removed, |
1278 |
to which machine & byte compiled code refers if it accesses a global. |
|
1279 |
If there are still global accesses in some literalArray or from machine-compiled code, |
|
1280 |
it continues to reference the globals value via that obsolete association and gets a nil |
|
1281 |
value. (which is correct) |
|
1282 |
However, if that global is later reintroduced, a new association will be created and |
|
1283 |
the new global now referenced via the new association. |
|
1284 |
The old accesses will still see nil, although the globals value is actually non-nil |
|
1285 |
(this is questionable). |
|
1286 |
To avoid this problem, the #removeClass: method never removed the key." |
|
617 | 1287 |
|
1288 |
CachedClasses := nil. |
|
1289 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1290 |
%{ /* NOCONTEXT */ |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1291 |
RETURN ( __GLOBAL_REMOVE(aKey) ); |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1292 |
%}. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1293 |
^ self primitiveFailed |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1294 |
|
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 |
|
10538 | 1297 |
startBlocks |
1298 |
^ StartBlocks |
|
1299 |
! |
|
1300 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1301 |
values |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1302 |
"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
|
1303 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1304 |
|values| |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1305 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1306 |
values := OrderedCollection new. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1307 |
self do:[:v | values add:v]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1308 |
^ values |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1309 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1310 |
"Created: 20.6.1997 / 16:58:28 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1311 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1312 |
|
13540 | 1313 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1314 |
!Smalltalk class methodsFor:'browsing'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1315 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1316 |
browseAllCallsOn:aSelectorSymbol |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1317 |
"{ Pragma: +optSpace }" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1318 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1319 |
"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
|
1320 |
|
22241 | 1321 |
SystemBrowser default browseAllCallsOn:aSelectorSymbol |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1322 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1323 |
" |
10071 | 1324 |
Smalltalk browseAllCallsOn:#at:put: |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1325 |
" |
22241 | 1326 |
|
1327 |
"Modified: / 01-09-2017 / 14:21:31 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1328 |
! |
617 | 1329 |
|
7563 | 1330 |
browseAllSelect:aBlock |
1331 |
"{ Pragma: +optSpace }" |
|
1332 |
||
1333 |
"startup a browser for all methods for which aBlock returns true" |
|
617 | 1334 |
|
22241 | 1335 |
SystemBrowser default browseAllSelect:aBlock |
617 | 1336 |
|
1337 |
" |
|
1338 |
Smalltalk browseAllSelect:[:m | m literals isNil] |
|
1339 |
" |
|
22241 | 1340 |
|
1341 |
"Modified: / 01-09-2017 / 14:21:34 / cg" |
|
617 | 1342 |
! |
1343 |
||
7563 | 1344 |
browseChanges |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1345 |
"{ Pragma: +optSpace }" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1346 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1347 |
"startup a changes browser" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1348 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1349 |
ChangesBrowser notNil ifTrue:[ |
18668 | 1350 |
ChangesBrowser open |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1351 |
] ifFalse:[ |
18668 | 1352 |
self warn:'no ChangesBrowser built in' |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1353 |
] |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1354 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1355 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1356 |
Smalltalk browseChanges |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1357 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1358 |
! |
453 | 1359 |
|
7563 | 1360 |
browseClass:aClass |
1361 |
"{ Pragma: +optSpace }" |
|
1362 |
||
11375 | 1363 |
"startup a browser on aClass. |
11150 | 1364 |
The broser will only show that class (i.e. be a singleClass-browser). |
1365 |
See browseInClass: for a full browser, which has aClass selected initially." |
|
6970 | 1366 |
|
22241 | 1367 |
SystemBrowser default browseClass:aClass |
6970 | 1368 |
|
1369 |
" |
|
10071 | 1370 |
Smalltalk browseClass:Array |
6970 | 1371 |
" |
22241 | 1372 |
|
1373 |
"Modified: / 01-09-2017 / 14:21:37 / cg" |
|
6970 | 1374 |
! |
1375 |
||
7563 | 1376 |
browseImplementorsMatching:aSelectorSymbolOrMatchPattern |
1377 |
"{ Pragma: +optSpace }" |
|
6819 | 1378 |
|
1379 |
"startup a browser for all methods implementing a message matching" |
|
1380 |
||
22241 | 1381 |
SystemBrowser default browseImplementorsMatching:aSelectorSymbolOrMatchPattern |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1382 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1383 |
" |
10071 | 1384 |
Smalltalk browseImplementorsOf:#'at:put:' |
1385 |
Smalltalk browseImplementorsMatching:#'at:*' |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1386 |
" |
22241 | 1387 |
|
1388 |
"Modified: / 01-09-2017 / 14:21:39 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1389 |
! |
6819 | 1390 |
|
7563 | 1391 |
browseImplementorsOf:aSelectorSymbol |
1392 |
"{ Pragma: +optSpace }" |
|
1393 |
||
1394 |
"startup a browser for all methods implementing a particular message" |
|
453 | 1395 |
|
22241 | 1396 |
SystemBrowser default browseImplementorsOf:aSelectorSymbol |
453 | 1397 |
|
1398 |
" |
|
10071 | 1399 |
Smalltalk browseImplementorsOf:#at:put: |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1400 |
" |
22241 | 1401 |
|
1402 |
"Modified: / 01-09-2017 / 14:21:42 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1403 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1404 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1405 |
browseInClass:aClass |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1406 |
"{ Pragma: +optSpace }" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1407 |
|
11150 | 1408 |
"startup a full browser showing aClass. |
20207 | 1409 |
The browser will be a full browser with aClass initially selected. |
11150 | 1410 |
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
|
1411 |
|
22241 | 1412 |
SystemBrowser default openInClass:aClass |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1413 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1414 |
" |
10071 | 1415 |
Smalltalk browseInClass:Array |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1416 |
" |
22241 | 1417 |
|
1418 |
"Modified: / 01-09-2017 / 14:21:46 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1419 |
! |
6970 | 1420 |
|
7563 | 1421 |
browseInClass:aClass selector:selector |
1422 |
"{ Pragma: +optSpace }" |
|
1423 |
||
11150 | 1424 |
"startup a full browser showing aClass>>selector. |
20207 | 1425 |
The browser will be a full browser with aClass initially selected. |
11150 | 1426 |
See browseClass: for a singleClass browser, which shows only a single class." |
6970 | 1427 |
|
22241 | 1428 |
SystemBrowser default openInClass:aClass selector:selector |
6970 | 1429 |
|
1430 |
" |
|
1431 |
Smalltalk browseInClass:Array selector:#at: |
|
1432 |
" |
|
22241 | 1433 |
|
1434 |
"Modified: / 01-09-2017 / 14:21:49 / cg" |
|
453 | 1435 |
! ! |
1436 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1437 |
!Smalltalk class methodsFor:'class management'! |
453 | 1438 |
|
18732 | 1439 |
basicRemoveClass:aClass |
1440 |
"remove the argument, aClass from the smalltalk dictionary; |
|
1441 |
we have to flush the caches since these methods are now void. |
|
1442 |
Also, class variables of aClass are removed." |
|
1443 |
||
1444 |
|sym cSym names oldName oldNameSym actualName wrongName| |
|
1445 |
||
1446 |
aClass isNil ifTrue:[^ self]. |
|
1447 |
||
1448 |
oldName := aClass name. |
|
1449 |
sym := oldNameSym := oldName asSymbol. |
|
1450 |
((self at:oldNameSym) == aClass) ifFalse:[ |
|
22791 | 1451 |
"check other name ..." |
1452 |
(self includes:aClass) ifFalse:[ |
|
1453 |
'Smalltalk [warning]: no such class: ' errorPrint. oldName errorPrintCR. |
|
1454 |
^ self |
|
1455 |
]. |
|
1456 |
" |
|
1457 |
the class has changed its name - without telling me ... |
|
1458 |
what should be done in this case ? |
|
1459 |
" |
|
1460 |
'Smalltalk [warning]: class ' errorPrint. oldName errorPrint. |
|
1461 |
' has changed its name' errorPrintCR. |
|
1462 |
||
1463 |
"/ |
|
1464 |
"/ might be an alias (i.e. removing a compatibility name) |
|
1465 |
"/ |
|
1466 |
actualName := self keyAtValue:aClass. |
|
1467 |
('Smalltalk [info]: ' , oldName , ' is actually stored as ' , actualName , '.') infoPrintCR. |
|
1468 |
sym := actualName asSymbol. |
|
1469 |
oldName := actualName asString. |
|
1470 |
wrongName := true. |
|
18732 | 1471 |
]. |
1472 |
||
1473 |
self at:sym put:nil. "nil it out for compiled accesses" |
|
1474 |
||
1475 |
"/ |
|
20811 | 1476 |
"/ see comment in removeKey: on why we don't remove it here |
18732 | 1477 |
"/ |
1478 |
"/ self removeKey:sym. "/ remove key - this actually fails, if there are |
|
22791 | 1479 |
"/ still compiled code references." |
18732 | 1480 |
|
1481 |
"remove private classes" |
|
1482 |
||
1483 |
aClass privateClassesSorted do:[:somePrivateClass | |
|
22791 | 1484 |
aClass privateClassesAt:(somePrivateClass nameWithoutPrefix) asSymbol put:nil. |
18732 | 1485 |
]. |
1486 |
||
1487 |
"remove class variables" |
|
1488 |
||
1489 |
names := aClass classVariableString asCollectionOfWords. |
|
1490 |
names do:[:name | |
|
22791 | 1491 |
cSym := aClass globalKeyForClassVar:name. |
1492 |
self at:cSym asSymbol put:nil. |
|
1493 |
||
1494 |
"/ |
|
1495 |
"/ see comment in removeKey: on why we dont remove it here |
|
1496 |
"/ |
|
1497 |
"/ self removeKey:cSym |
|
18732 | 1498 |
]. |
1499 |
||
1500 |
||
1501 |
"/ actually could get along with less flushing |
|
1502 |
"/ (entries for aClass and subclasses only) |
|
1503 |
"/ but we have to delay this, until we have the set of subclasses |
|
1504 |
"/ at hand - for now, searching for all subclasses is way more |
|
1505 |
"/ expensive then cache flushing. |
|
1506 |
"/ |
|
1507 |
"/ aClass allSubclassesDo:[:aSubclass | |
|
1508 |
"/ ObjectMemory flushInlineCachesForClass:aSubclass. |
|
1509 |
"/ ObjectMemory flushMethodCacheFor:aSubclass |
|
1510 |
"/ ]. |
|
1511 |
"/ ObjectMemory flushInlineCachesForClass:aClass. |
|
1512 |
"/ ObjectMemory flushMethodCacheFor:aClass |
|
1513 |
||
1514 |
ObjectMemory flushInlineCaches. |
|
1515 |
ObjectMemory flushMethodCache. |
|
1516 |
||
1517 |
aClass addChangeRecordForClassRemove. |
|
1518 |
self changed:#classRemove with:aClass. |
|
1519 |
||
1520 |
aClass setCategory:#'* removed *'. |
|
1521 |
||
1522 |
"/ self flushCachedClasses. |
|
1523 |
"/ Class flushSubclassInfo. |
|
1524 |
self flushCachedClass:aClass. |
|
1525 |
Class flushSubclassInfoFor:aClass superclass. |
|
1526 |
Class flushSubclassInfoFor:aClass. |
|
1527 |
||
1528 |
wrongName == true ifTrue:[ |
|
22791 | 1529 |
"/ |
1530 |
"/ an alias (i.e. removing a compatibility name) |
|
1531 |
"/ |
|
1532 |
"/ check if there are more refs to it ... |
|
1533 |
[self includes:aClass] whileTrue:[ |
|
1534 |
actualName := self keyAtValue:aClass. |
|
1535 |
('Smalltalk [info]: ' , aClass name , ' is also registered under the name ' , actualName |
|
1536 |
, ' - remove that binding too.') infoPrintCR. |
|
1537 |
self at:actualName put:nil. |
|
1538 |
]. |
|
18732 | 1539 |
]. |
1540 |
||
1541 |
"Modified: / 18-11-2006 / 17:16:31 / cg" |
|
1542 |
! |
|
1543 |
||
7563 | 1544 |
changeCategoryOf:aClass to:newCategory |
1545 |
"change a classes category, add a change record, |
|
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1546 |
send change notifications" |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1547 |
|
8405 | 1548 |
|ns oldCategory| |
1549 |
||
1550 |
oldCategory := aClass category. |
|
1551 |
oldCategory ~= newCategory ifTrue:[ |
|
18668 | 1552 |
aClass category:(newCategory withoutSeparators asSymbol). |
1553 |
||
1554 |
"notify change of category" |
|
1555 |
ns := aClass environment ? self. |
|
1556 |
ns changed:#organization with:(aClass -> oldCategory). |
|
1557 |
ns ~~ self ifTrue:[ |
|
1558 |
self changed:#organization with:(aClass -> oldCategory). |
|
1559 |
] |
|
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1560 |
]. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1561 |
|
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1562 |
" |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1563 |
Smalltalk changeCategoryOf:NewApplication to:#myApplications |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1564 |
" |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1565 |
|
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1566 |
"Modified: / 11.2.2000 / 11:36:27 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1567 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1568 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1569 |
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
|
1570 |
NameSpace name:name |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1571 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1572 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1573 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1574 |
flushCachedClass:aClass |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1575 |
CachedClasses notNil ifTrue:[ |
18668 | 1576 |
CachedClasses remove:aClass ifAbsent:[]. |
12700 | 1577 |
]. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1578 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1579 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1580 |
flushCachedClasses |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1581 |
CachedClasses := nil. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1582 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1583 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1584 |
Smalltalk flushCachedClasses |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1585 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1586 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1587 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1588 |
removeClass:aClass |
7563 | 1589 |
"remove the argument, aClass from the smalltalk dictionary; |
453 | 1590 |
we have to flush the caches since these methods are now void. |
18732 | 1591 |
Also, class variables of aClass are removed. |
1592 |
Recompile accessors to aClass." |
|
1593 |
||
1594 |
|oldNameSym ns ons| |
|
1595 |
||
1596 |
oldNameSym := aClass name asSymbol. |
|
4781 | 1597 |
ns := aClass nameSpace. |
1598 |
aClass topOwningClass notNil ifTrue:[ |
|
22791 | 1599 |
ons := aClass topOwningClass nameSpace |
18732 | 1600 |
]. |
1601 |
||
1602 |
self basicRemoveClass:aClass. |
|
4724
44793fe70787
recompile ns classes after a class remove
Claus Gittinger <cg@exept.de>
parents:
4723
diff
changeset
|
1603 |
|
4781 | 1604 |
ns ~~ Smalltalk ifTrue:[ |
22791 | 1605 |
ons notNil ifTrue:[ |
1606 |
ClassBuilder |
|
1607 |
recompileGlobalAccessorsTo:oldNameSym |
|
1608 |
in:ons |
|
1609 |
except:nil |
|
1610 |
]. |
|
1611 |
(ns notNil and:[ns ~~ ons]) ifTrue:[ |
|
1612 |
ClassBuilder |
|
1613 |
recompileGlobalAccessorsTo:oldNameSym |
|
1614 |
in:ns |
|
1615 |
except:nil |
|
1616 |
]. |
|
18732 | 1617 |
]. |
1618 |
! |
|
1619 |
||
1620 |
removeClasses:aCollectionOfClasses |
|
1621 |
"remove aCollectionOfClasses from the smalltalk dictionary; |
|
1622 |
we have to flush the caches since these methods are now void. |
|
1623 |
Also, class variables of aClass are removed. |
|
1624 |
Recompile accessors to the classes - after all classes in the collection have been removed." |
|
1625 |
||
1626 |
|tuples| |
|
1627 |
||
1628 |
tuples := aCollectionOfClasses collect:[:eachClass| |
|
22791 | 1629 |
Array |
1630 |
with:eachClass name asSymbol |
|
1631 |
with:eachClass nameSpace |
|
1632 |
with:( |
|
1633 |
eachClass topOwningClass notNil ifTrue:[ |
|
1634 |
eachClass topOwningClass nameSpace |
|
1635 |
] ifFalse:[nil]) |
|
1636 |
]. |
|
18732 | 1637 |
|
1638 |
aCollectionOfClasses do:[:eachClass| |
|
22791 | 1639 |
self basicRemoveClass:eachClass. |
18732 | 1640 |
]. |
1641 |
||
1642 |
tuples do:[:eachClssymNsOnsTuple| |
|
22791 | 1643 |
|oldNameSym ns ons| |
1644 |
||
1645 |
oldNameSym := eachClssymNsOnsTuple at:1. |
|
1646 |
ns := eachClssymNsOnsTuple at:2. |
|
1647 |
ons := eachClssymNsOnsTuple at:3. |
|
1648 |
||
1649 |
ns ~~ Smalltalk ifTrue:[ |
|
1650 |
ons notNil ifTrue:[ |
|
1651 |
ClassBuilder |
|
1652 |
recompileGlobalAccessorsTo:oldNameSym |
|
1653 |
in:ons |
|
1654 |
except:nil |
|
1655 |
]. |
|
1656 |
(ns notNil and:[ns ~~ ons]) ifTrue:[ |
|
1657 |
ClassBuilder |
|
1658 |
recompileGlobalAccessorsTo:oldNameSym |
|
1659 |
in:ns |
|
1660 |
except:nil |
|
1661 |
]. |
|
1662 |
] |
|
18732 | 1663 |
]. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1664 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1665 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1666 |
renameClass:aClass to:newName |
7563 | 1667 |
"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
|
1668 |
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
|
1669 |
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
|
1670 |
|
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1671 |
|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
|
1672 |
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
|
1673 |
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
|
1674 |
oldMetaclass newMetaclass newCategory| |
5610
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1675 |
|
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1676 |
"/ check for all intermediate namespaces / owning classes |
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1677 |
i1 := 1. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1678 |
i2 := 1. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1679 |
ns := self. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1680 |
[i2 ~~ 0] whileTrue:[ |
23789 | 1681 |
i2 := newName indexOfSubCollection:'::' startingAt:i1. |
1682 |
i2 ~~ 0 ifTrue:[ |
|
1683 |
nm := newName copyFrom:i1 to:i2-1. |
|
1684 |
ns isNameSpace ifTrue:[ |
|
1685 |
subns := ns at:nm asSymbol ifAbsent:nil. |
|
1686 |
subns isNil ifTrue:[ |
|
1687 |
self error:'Nonexisting namespace: ',nm. |
|
1688 |
^ nil. |
|
1689 |
]. |
|
1690 |
] ifFalse:[ |
|
1691 |
subns := ns privateClassesAt:nm asSymbol. |
|
1692 |
subns isNil ifTrue:[ |
|
1693 |
self error:'Cannot create a namespace below a class' |
|
1694 |
] |
|
1695 |
]. |
|
1696 |
ns := subns. |
|
1697 |
i1 := i2 + 2. |
|
1698 |
]. |
|
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1699 |
]. |
617 | 1700 |
|
1701 |
oldName := aClass name. |
|
6734 | 1702 |
oldNameSpace := aClass topNameSpace. |
2319
640bb389f90a
recompile when moving classes across namespaces
Claus Gittinger <cg@exept.de>
parents:
2317
diff
changeset
|
1703 |
oldBaseName := aClass nameWithoutNameSpacePrefix. |
3698
8bce45214d24
fixed renaming of a private class (must recompile owner)
Claus Gittinger <cg@exept.de>
parents:
3678
diff
changeset
|
1704 |
oldBaseNameWithoutPrefix := aClass nameWithoutPrefix. |
617 | 1705 |
oldSym := oldName asSymbol. |
2485
9f4a11a4521f
new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents:
2476
diff
changeset
|
1706 |
privateClasses := aClass privateClassesSorted. |
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1707 |
|
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1708 |
((self at:oldSym) ~~ aClass) ifTrue:[ |
23789 | 1709 |
'Smalltalk [warning]: rename failed - name is different from key' errorPrintCR. |
1710 |
^ self |
|
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1711 |
]. |
617 | 1712 |
|
1525
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1713 |
"/ rename the class |
617 | 1714 |
|
1847
6e567214b167
care for className being a symbol, when renaming classes
Claus Gittinger <cg@exept.de>
parents:
1758
diff
changeset
|
1715 |
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
|
1716 |
|
5610
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1717 |
"/ change the owning class |
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1718 |
ns isNameSpace ifFalse:[ |
23789 | 1719 |
aClass isPrivate ifTrue:[ |
1720 |
aClass class setOwningClass:ns. |
|
1721 |
] ifFalse:[ |
|
1722 |
"/ sigh - must make a PrivateMetaclass from Metaclass |
|
1723 |
oldMetaclass := aClass class. |
|
1724 |
newMetaclass := PrivateMetaclass new. |
|
1725 |
newMetaclass flags:(oldMetaclass flags). |
|
1726 |
newMetaclass setSuperclass:(oldMetaclass superclass). |
|
1727 |
newMetaclass instSize:(oldMetaclass instSize). |
|
1728 |
newMetaclass setInstanceVariableString:(oldMetaclass instanceVariableString). |
|
1729 |
newMetaclass setMethodDictionary:(oldMetaclass methodDictionary). |
|
1730 |
newMetaclass setSoleInstance:aClass. |
|
1731 |
newMetaclass setOwningClass:ns. |
|
1732 |
||
1733 |
aClass changeClassTo:newMetaclass. |
|
1734 |
ObjectMemory flushCaches. |
|
1735 |
] |
|
5610
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1736 |
] ifTrue:[ |
23789 | 1737 |
aClass isPrivate ifTrue:[ |
1738 |
newCategory := aClass topOwningClass category. |
|
1739 |
||
1740 |
"/ sigh - must make a Metaclass from PrivateMetaclass |
|
1741 |
oldMetaclass := aClass class. |
|
1742 |
||
1743 |
newMetaclass := Metaclass new. |
|
1744 |
newMetaclass flags:(oldMetaclass flags). |
|
1745 |
newMetaclass setSuperclass:(oldMetaclass superclass). |
|
1746 |
newMetaclass instSize:(oldMetaclass instSize). |
|
1747 |
newMetaclass setInstanceVariableString:(oldMetaclass instanceVariableString). |
|
1748 |
newMetaclass setMethodDictionary:(oldMetaclass methodDictionary). |
|
1749 |
newMetaclass setSoleInstance:aClass. |
|
1750 |
||
1751 |
aClass category:newCategory. |
|
1752 |
aClass changeClassTo:newMetaclass. |
|
1753 |
ObjectMemory flushCaches. |
|
1754 |
] |
|
5610
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1755 |
]. |
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1756 |
|
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1757 |
aClass setName:newSym. |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1758 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1759 |
"/ store it in Smalltalk |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1760 |
self at:oldSym put:nil. |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1761 |
|
878
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1762 |
"/ |
20811 | 1763 |
"/ 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
|
1764 |
"/ |
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1765 |
"/ self removeKey:oldSym. |
617 | 1766 |
self at:newSym put:aClass. |
1767 |
||
1525
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1768 |
"/ 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
|
1769 |
|
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1770 |
oldNameToNewName := IdentityDictionary new. |
617 | 1771 |
|
1772 |
names := aClass classVariableString asCollectionOfWords. |
|
1773 |
names do:[:name | |
|
23789 | 1774 |
oldCVSym := (oldSym , ':' , name) asSymbol. |
1775 |
value := self at:oldCVSym. |
|
1776 |
self at:oldCVSym put:nil. |
|
1777 |
||
1778 |
"/ |
|
1779 |
"/ see comment in #removeKey: on why we dont remove it it here |
|
1780 |
"/ |
|
1781 |
"/ self removeKey:cSym. |
|
1782 |
||
1783 |
newCVSym := (newSym , ':' , name) asSymbol. |
|
1784 |
self at:newCVSym put:value. |
|
1785 |
||
1786 |
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
|
1787 |
]. |
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1788 |
|
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1789 |
"/ 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
|
1790 |
|
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1791 |
oldNameToNewName keysAndValuesDo:[:oldNameSym :newNameSym | |
23789 | 1792 |
aClass withAllSubclasses do:[:aSubClass | |
1793 |
Transcript showCR:'changing global accesses from ''' , oldNameSym , ''' into ''' , newNameSym , ''' in class: ''' , aSubClass name , ''' ...'. |
|
1794 |
aSubClass instAndClassSelectorsAndMethodsDo:[:sel :aMethod | |
|
1795 |
aMethod changeLiteral:oldNameSym to:newNameSym |
|
1796 |
]. |
|
1797 |
]. |
|
1798 |
||
1799 |
"/ and also in privateClasses ? ... |
|
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1800 |
|
2485
9f4a11a4521f
new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents:
2476
diff
changeset
|
1801 |
"/ privateClasses size > 0 ifTrue:[ |
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1802 |
"/ privateClasses do:[:aPrivateClass | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1803 |
"/ aPrivateClass withAllSubclasses do:[:aSubClass | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1804 |
"/ aSubClass class methodDictionary do:[:aMethod | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1805 |
"/ aMethod changeLiteral:oldNameSym to:newNameSym |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1806 |
"/ ]. |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1807 |
"/ aSubClass methodDictionary do:[:aMethod | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1808 |
"/ aMethod changeLiteral:oldNameSym to:newNameSym |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1809 |
"/ ] |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1810 |
"/ ]. |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1811 |
"/ ] |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1812 |
"/ ] |
617 | 1813 |
]. |
1814 |
||
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1815 |
aClass addChangeRecordForClassRename:oldSym to:newSym. |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1816 |
|
5333
d80386e06d21
rename into other namespace did not work
Claus Gittinger <cg@exept.de>
parents:
5328
diff
changeset
|
1817 |
"/ 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
|
1818 |
aClass setEnvironment:nil. |
6734 | 1819 |
newNameSpace := aClass topNameSpace. |
2405
939f4e751ef3
dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents:
2379
diff
changeset
|
1820 |
|
23789 | 1821 |
privateClasses size ~~ 0 ifTrue:[ |
1822 |
"/ must rename privateClasses as well |
|
1823 |
Class withoutUpdatingChangesDo:[ |
|
1824 |
privateClasses do:[:aPrivateClass | |
|
1825 |
self renameClass:aPrivateClass |
|
1826 |
to:(newSym , '::' , aPrivateClass nameWithoutPrefix). |
|
1827 |
||
1828 |
Transcript showCR:'recompiling methods in ''' , newNameSpace name , ''' accessing ''' , oldName , '::' , aPrivateClass nameWithoutPrefix , ''' ...'. |
|
1829 |
aClass theNonMetaclass recompileMethodsAccessingGlobal:(oldName , '::' , aPrivateClass nameWithoutPrefix) asSymbol. |
|
1830 |
aClass theMetaclass recompileMethodsAccessingGlobal:(oldName , '::' , aPrivateClass nameWithoutPrefix) asSymbol. |
|
1831 |
aClass theNonMetaclass recompileMethodsAccessingGlobal:(aPrivateClass nameWithoutPrefix) asSymbol. |
|
1832 |
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
|
1833 |
"/ ClassBuilder |
10071 | 1834 |
"/ recompileGlobalAccessorsTo:(oldName , '::' , aPrivateClass nameWithoutPrefix) asSymbol |
1835 |
"/ in:newNameSpace |
|
9822
38acd1c5eeab
recompile methods which access private classes when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
9819
diff
changeset
|
1836 |
"/ except:nil. |
23789 | 1837 |
] |
1838 |
] |
|
2405
939f4e751ef3
dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents:
2379
diff
changeset
|
1839 |
]. |
939f4e751ef3
dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents:
2379
diff
changeset
|
1840 |
|
2319
640bb389f90a
recompile when moving classes across namespaces
Claus Gittinger <cg@exept.de>
parents:
2317
diff
changeset
|
1841 |
oldNameSpace ~~ newNameSpace ifTrue:[ |
5246
2ca7b20c4108
create namespaces as requried, when renaming a class
Claus Gittinger <cg@exept.de>
parents:
5214
diff
changeset
|
1842 |
|
23789 | 1843 |
"/ all those referencing the class from the old nameSpace |
1844 |
"/ must be recompiled ... |
|
1845 |
"/ (to now access the global from smalltalk) |
|
1846 |
||
1847 |
oldNameSpace ~~ Smalltalk ifTrue:[ |
|
1848 |
Transcript showCR:'recompiling methods in ''' , oldNameSpace name , ''' accessing ''' , oldName , ''' ...'. |
|
1849 |
||
1850 |
ClassBuilder |
|
1851 |
recompileGlobalAccessorsTo:oldName asSymbol |
|
1852 |
in:oldNameSpace |
|
1853 |
except:nil. |
|
1854 |
]. |
|
1855 |
||
1856 |
"/ all referencing the class in the new namespace |
|
1857 |
"/ as well; to now access the new class. |
|
1858 |
||
1859 |
(newNameSpace notNil and:[newNameSpace ~~ Smalltalk]) ifTrue:[ |
|
1860 |
Transcript showCR:'recompiling methods in ''' , newNameSpace name , ''' accessing ''' , oldBaseName , ''' ...'. |
|
1861 |
||
1862 |
ClassBuilder |
|
1863 |
recompileGlobalAccessorsTo:oldBaseName asSymbol |
|
1864 |
in:newNameSpace |
|
1865 |
except:nil. |
|
1866 |
]. |
|
3698
8bce45214d24
fixed renaming of a private class (must recompile owner)
Claus Gittinger <cg@exept.de>
parents:
3678
diff
changeset
|
1867 |
] ifFalse:[ |
23789 | 1868 |
"/ all references to a global with my new name in my owning class |
1869 |
"/ must now be redirected to myself. |
|
1870 |
||
1871 |
aClass isPrivate ifTrue:[ |
|
1872 |
newBaseName := aClass nameWithoutNameSpacePrefix. |
|
1873 |
newBaseNameWithoutPrefix := aClass nameWithoutPrefix. |
|
1874 |
||
1875 |
Transcript showCR:'recompiling methods accessing ''' , oldBaseNameWithoutPrefix , ''' in: ''' , aClass owningClass name , ''' ...'. |
|
1876 |
aClass owningClass recompileMethodsAccessingGlobal:oldBaseNameWithoutPrefix. |
|
1877 |
aClass owningClass class recompileMethodsAccessingGlobal:oldBaseNameWithoutPrefix. |
|
1878 |
||
1879 |
Transcript showCR:'recompiling methods accessing ''' , oldBaseName , ''' in: ''' , aClass owningClass name , ''' ...'. |
|
1880 |
aClass owningClass recompileMethodsAccessingGlobal:oldBaseName. |
|
1881 |
aClass owningClass class recompileMethodsAccessingGlobal:oldBaseName. |
|
1882 |
||
1883 |
Transcript showCR:'recompiling methods accessing ''' , newBaseNameWithoutPrefix , ''' in: ''' , aClass owningClass name , ''' ...'. |
|
1884 |
aClass owningClass recompileMethodsAccessingGlobal:newBaseNameWithoutPrefix. |
|
1885 |
aClass owningClass class recompileMethodsAccessingGlobal:newBaseNameWithoutPrefix. |
|
1886 |
||
1887 |
Transcript showCR:'recompiling methods accessing ''' , newBaseName , ''' in: ''' , aClass owningClass name , ''' ...'. |
|
1888 |
aClass owningClass recompileMethodsAccessingGlobal:newBaseName. |
|
1889 |
aClass owningClass class recompileMethodsAccessingGlobal:newBaseName. |
|
1890 |
] |
|
4040
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1891 |
]. |
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1892 |
|
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1893 |
aClass changed:#definition. |
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1894 |
"/ 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
|
1895 |
aClass allSubclassesDo:[:subClass | |
23789 | 1896 |
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
|
1897 |
]. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1898 |
"/ 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
|
1899 |
aClass subclassesDo:[:subClass | |
23789 | 1900 |
subClass addChangeRecordForClass:subClass. |
4040
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1901 |
]. |
5613
b534e427f028
change message when renaming a class
Claus Gittinger <cg@exept.de>
parents:
5611
diff
changeset
|
1902 |
self changed:#definition. |
14611 | 1903 |
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
|
1904 |
|
9822
38acd1c5eeab
recompile methods which access private classes when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
9819
diff
changeset
|
1905 |
"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
|
1906 |
"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
|
1907 |
"Modified: / 05-09-2006 / 12:52:25 / cg" |
23789 | 1908 |
"Modified: / 01-03-2019 / 16:12:03 / Claus Gittinger" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1909 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1910 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1911 |
!Smalltalk class methodsFor:'copying'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1912 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1913 |
deepCopy |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1914 |
"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
|
1915 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1916 |
^ self |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1917 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1918 |
"Modified: 18.5.1996 / 12:13:33 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1919 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1920 |
|
10952 | 1921 |
deepCopyUsing:aDictionary postCopySelector:postCopySelector |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1922 |
"return a deep copy of the receiver. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1923 |
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
|
1924 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1925 |
^ self |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1926 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1927 |
"Modified: 18.5.1996 / 12:13:36 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1928 |
! |
453 | 1929 |
|
7563 | 1930 |
shallowCopy |
1931 |
"redefined to return self - there is only one Smalltalk dictionary" |
|
617 | 1932 |
|
1933 |
^ self |
|
1410 | 1934 |
|
1935 |
"Modified: 18.5.1996 / 12:13:39 / cg" |
|
617 | 1936 |
! |
1937 |
||
7563 | 1938 |
simpleDeepCopy |
1939 |
"redefined to return self - there is only one Smalltalk dictionary" |
|
453 | 1940 |
|
1941 |
^ self |
|
1410 | 1942 |
|
1943 |
"Modified: 18.5.1996 / 12:13:42 / cg" |
|
453 | 1944 |
! ! |
1945 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1946 |
!Smalltalk class methodsFor:'debugging ST/X'! |
453 | 1947 |
|
7563 | 1948 |
compileTrace:aBoolean |
1949 |
"dump generated inline code (NOOP if VM was compiled without the trace-debug option)" |
|
7325 | 1950 |
%{ |
1951 |
extern char __compileTrace__; |
|
1952 |
||
1953 |
__compileTrace__ = (aBoolean == true) ? 1 : 0; |
|
1954 |
%} |
|
1955 |
" |
|
1956 |
Smalltalk compileTrace:true |
|
1957 |
Smalltalk compileTrace:false |
|
1958 |
" |
|
1959 |
! |
|
1960 |
||
7563 | 1961 |
debugBreakPoint |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1962 |
"{ Pragma: +optSpace }" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1963 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1964 |
"call the dummy debug function, on which a breakpoint |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1965 |
can be put in adb, sdb, dbx or gdb. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1966 |
WARNING: this method is for debugging only |
18668 | 1967 |
it will be removed without notice." |
453 | 1968 |
%{ |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1969 |
__PATCHUPCONTEXTS(__context); |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1970 |
__debugBreakPoint__(); |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1971 |
%}. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1972 |
^ self |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1973 |
! |
453 | 1974 |
|
7563 | 1975 |
exitWithCoreDump |
1976 |
"{ Pragma: +optSpace }" |
|
1977 |
||
20755 | 1978 |
"abort the program and dump core" |
7563 | 1979 |
|
1980 |
OperatingSystem exitWithCoreDump |
|
4096
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1981 |
"/ never returns |
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1982 |
|
20755 | 1983 |
"Be careful evaluating this: |
4096
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1984 |
Smalltalk exitWithCoreDump |
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1985 |
" |
617 | 1986 |
! |
1987 |
||
7563 | 1988 |
fatalAbort |
1989 |
"{ Pragma: +optSpace }" |
|
1990 |
||
1991 |
"report a fatal-error, print a stack backtrace and exit with core dump. |
|
617 | 1992 |
(You may turn off the stack print with debugPrinting:false)" |
18287 | 1993 |
|
1994 |
self fatalAbort:'fatalAbort' |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1995 |
! |
617 | 1996 |
|
7563 | 1997 |
fatalAbort:aMessage |
1998 |
"{ Pragma: +optSpace }" |
|
1999 |
||
2000 |
"report a fatal-error; print a stack backtrace and exit with core dump |
|
617 | 2001 |
(You may turn off the stack print with debugPrinting:false)" |
2002 |
||
2003 |
%{ |
|
18287 | 2004 |
#ifdef __SCHTEAM__ |
2005 |
STMain.fatalAbort( aMessage ); |
|
2006 |
/* NOT REACHED */ |
|
2007 |
#else |
|
617 | 2008 |
char *msg; |
2009 |
||
12481
805176d238d2
change __isString() to __isStringLike() in primitive code
Stefan Vogel <sv@exept.de>
parents:
12413
diff
changeset
|
2010 |
if (__isStringLike(aMessage)) |
18668 | 2011 |
msg = (char *) __stringVal(aMessage); |
617 | 2012 |
else |
18668 | 2013 |
msg = "fatalAbort"; |
617 | 2014 |
|
2015 |
__fatal0(__context, msg); |
|
2016 |
/* NEVER RETURNS */ |
|
18287 | 2017 |
#endif |
5410 | 2018 |
%}. |
2019 |
^ self primitiveFailed |
|
5441 | 2020 |
! |
2021 |
||
13135
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2022 |
ignoreHalt |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2023 |
"return true, if halts are ignored. |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2024 |
Usually, this is done in standAlone applications" |
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 |
IgnoreHalt isNil ifTrue:[ |
23678 | 2027 |
^ self isStandAloneApp |
13135
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2028 |
]. |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2029 |
^ IgnoreHalt |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2030 |
|
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2031 |
"Created: / 18-11-2010 / 11:20:16 / cg" |
23678 | 2032 |
"Modified: / 06-02-2019 / 20:39:16 / Claus Gittinger" |
13135
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2033 |
! |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2034 |
|
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2035 |
ignoreHalt:aBoolean |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2036 |
"control if halts are to be ignored; |
13135
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2037 |
usually, this is done in standAlone applications" |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2038 |
|
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2039 |
IgnoreHalt := aBoolean |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2040 |
|
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2041 |
" |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2042 |
Smalltalk ignoreHalt:true. |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2043 |
self halt. |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2044 |
Smalltalk ignoreHalt:false. |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2045 |
self halt. |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2046 |
" |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2047 |
|
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2048 |
"Created: / 18-11-2010 / 11:20:27 / cg" |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2049 |
! |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2050 |
|
23678 | 2051 |
silent |
2052 |
"returns the Silent class variable." |
|
2053 |
||
2054 |
^ Silent ? false |
|
2055 |
||
2056 |
"Created: / 06-02-2019 / 20:36:51 / Claus Gittinger" |
|
2057 |
! |
|
2058 |
||
18329 | 2059 |
verbose |
23678 | 2060 |
^ Verbose ? false |
2061 |
||
2062 |
"Modified: / 06-02-2019 / 20:38:44 / Claus Gittinger" |
|
18329 | 2063 |
! |
2064 |
||
2065 |
verbose:aBoolean |
|
2066 |
Verbose := aBoolean |
|
2067 |
! |
|
2068 |
||
7563 | 2069 |
vmInstructionTrace:aBoolean |
13947 | 2070 |
self halt:'not yet implemented' |
2071 |
||
2072 |
"Modified: / 19-01-2012 / 10:15:35 / cg" |
|
7563 | 2073 |
! ! |
2074 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2075 |
!Smalltalk class methodsFor:'enumerating'! |
7563 | 2076 |
|
453 | 2077 |
allBehaviorsDo:aBlock |
5580
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
2078 |
"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
|
2079 |
|
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
2080 |
self allClassesAndMetaclassesDo:aBlock |
453 | 2081 |
|
2082 |
" |
|
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
2083 |
Smalltalk allBehaviorsDo:[:aClass | aClass name printCR] |
453 | 2084 |
" |
7563 | 2085 |
! |
2086 |
||
2087 |
allClassCategories |
|
2088 |
"return a set of all class categories in the system" |
|
2089 |
||
2090 |
|allCategories| |
|
6217
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2091 |
|
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2092 |
allCategories := Set new. |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2093 |
Smalltalk allClassesDo:[:cls | |
18668 | 2094 |
|category| |
2095 |
||
2096 |
category := cls category. |
|
2097 |
category notNil ifTrue:[ |
|
2098 |
allCategories add:category. |
|
2099 |
]. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2100 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2101 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2102 |
^ allCategories. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2103 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2104 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2105 |
Smalltalk allClassCategories |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2106 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2107 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2108 |
"Created: / 17.11.2001 / 12:13:09 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2109 |
! |
6217
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2110 |
|
7563 | 2111 |
allClassesAndMetaclassesDo:aBlock |
2112 |
"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
|
2113 |
|
21108 | 2114 |
|already numClassesHintTimes2| |
2115 |
||
2116 |
numClassesHintTimes2 := NumberOfClassesHint*2. |
|
2117 |
already := IdentitySet new:numClassesHintTimes2. |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2118 |
self allClassesDo:[:eachClass | |
22791 | 2119 |
|theNonMeta theMeta| |
2120 |
||
2121 |
theNonMeta := eachClass theNonMetaclass. |
|
2122 |
(already includes:theNonMeta) ifFalse:[ |
|
2123 |
aBlock value:theNonMeta. |
|
2124 |
already add:theNonMeta. |
|
2125 |
]. |
|
2126 |
theMeta := theNonMeta class. |
|
2127 |
(already includes:theMeta) ifFalse:[ |
|
2128 |
aBlock value:theMeta. |
|
2129 |
already add:theMeta. |
|
2130 |
]. |
|
2131 |
already size > numClassesHintTimes2 ifTrue:[ |
|
2132 |
NumberOfClassesHint := (already size // 2) + 10 |
|
2133 |
]. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2134 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2135 |
! |
5579
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
2136 |
|
7563 | 2137 |
allClassesDo:aBlock |
21489 | 2138 |
"evaluate the argument, aBlock for all classes in the system. |
2139 |
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
|
2140 |
|
5765 | 2141 |
self allClasses do:aBlock |
453 | 2142 |
|
2143 |
" |
|
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
2144 |
Smalltalk allClassesDo:[:aClass | aClass name printCR] |
453 | 2145 |
" |
21489 | 2146 |
|
2147 |
"Modified (comment): / 19-02-2017 / 12:38:17 / cg" |
|
453 | 2148 |
! |
2149 |
||
9506 | 2150 |
allClassesForWhich:filter |
10071 | 2151 |
"return a collection with all classes in the system, |
21489 | 2152 |
for which filter evaluates to true. |
2153 |
Enumerates non-meta classes only - not metaclasses" |
|
9506 | 2154 |
|
2155 |
|collectedClasses| |
|
2156 |
||
2157 |
collectedClasses := OrderedCollection new. |
|
2158 |
self allClassesForWhich:filter do:[:cls | |
|
22791 | 2159 |
collectedClasses add:cls |
9506 | 2160 |
]. |
2161 |
^ collectedClasses |
|
2162 |
||
2163 |
" |
|
10071 | 2164 |
Smalltalk |
22791 | 2165 |
allClassesForWhich:[:cls | cls name startsWith:'Po'] |
9506 | 2166 |
" |
2167 |
||
2168 |
"Created: / 10-08-2006 / 12:11:31 / cg" |
|
21489 | 2169 |
"Modified (comment): / 19-02-2017 / 12:37:49 / cg" |
9506 | 2170 |
! |
2171 |
||
9292 | 2172 |
allClassesForWhich:filter do:aBlock |
21489 | 2173 |
"evaluate the argument, aBlock for all classes in the system, for which filter evaluates to true. |
2174 |
Enumerates non-meta classes only - not metaclasses" |
|
9292 | 2175 |
|
2176 |
self allClassesDo:[:cls | |
|
22791 | 2177 |
(filter value:cls) ifTrue:[ aBlock value:cls ]. |
10071 | 2178 |
]. |
2179 |
||
2180 |
" |
|
2181 |
Smalltalk |
|
22791 | 2182 |
allClassesForWhich:[:cls | cls name startsWith:'Po'] |
2183 |
do:[:aClass | Transcript showCR:aClass name] |
|
21489 | 2184 |
" |
2185 |
||
2186 |
"Modified (comment): / 19-02-2017 / 12:37:59 / cg" |
|
9292 | 2187 |
! |
2188 |
||
7563 | 2189 |
allClassesInCategory:aCategory |
2190 |
"return a collection of for all classes in aCategory; |
|
1299 | 2191 |
The order of the classes is not defined." |
2192 |
||
9506 | 2193 |
^ self allClassesForWhich:[:cls | cls category = aCategory] |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2194 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2195 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2196 |
Smalltalk allClassesInCategory:'Views-Basic' |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2197 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2198 |
|
9506 | 2199 |
"Modified: / 10-08-2006 / 12:13:32 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2200 |
! |
1299 | 2201 |
|
7563 | 2202 |
allClassesInCategory:aCategory do:aBlock |
2203 |
"evaluate the argument, aBlock for all classes in the aCategory; |
|
453 | 2204 |
The order of the classes is not defined." |
2205 |
||
2206 |
aCategory notNil ifTrue:[ |
|
18668 | 2207 |
self allClassesForWhich:[:cls | cls category = aCategory] do:aBlock |
453 | 2208 |
] |
2209 |
||
2210 |
" |
|
9490 | 2211 |
Smalltalk allClassesInCategory:'Views-Basic' do:[:aClass | Transcript showCR:aClass] |
2212 |
" |
|
2213 |
||
2214 |
"Modified: / 09-08-2006 / 17:18:50 / fm" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2215 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2216 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2217 |
allClassesInCategory:aCategory inOrderDo:aBlock |
7563 | 2218 |
"evaluate the argument, aBlock for all classes in aCategory; |
453 | 2219 |
superclasses come first - then subclasses" |
2220 |
||
2221 |
|classes| |
|
2222 |
||
2223 |
aCategory notNil ifTrue:[ |
|
18668 | 2224 |
classes := OrderedCollection new. |
2225 |
self allClassesInCategory:aCategory do:[:aClass | |
|
2226 |
classes add:aClass |
|
2227 |
]. |
|
2228 |
classes topologicalSort:[:a :b | b isSubclassOf:a]. |
|
2229 |
classes do:aBlock |
|
453 | 2230 |
] |
2231 |
||
2232 |
" |
|
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
2233 |
Smalltalk allClassesInCategory:'Views-Basic' inOrderDo:[:aClass | aClass name printCR] |
453 | 2234 |
" |
6217
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2235 |
|
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2236 |
"Modified: / 17.11.2001 / 12:18:15 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2237 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2238 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2239 |
allClassesInOrderDo:aBlock |
7563 | 2240 |
"evaluate the argument, aBlock for all classes in the system; |
5406 | 2241 |
Evaluation order is by inheritance: superclasses come first." |
2242 |
||
2243 |
|already| |
|
2244 |
||
8964
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
2245 |
already := IdentitySet new:NumberOfClassesHint. |
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
2246 |
self allClassesDo:[:eachClass | |
18668 | 2247 |
(already includes:eachClass) ifFalse:[ |
2248 |
eachClass allSuperclasses reverseDo:[:eachSuperClass | |
|
2249 |
(already includes:eachSuperClass) ifFalse:[ |
|
2250 |
already add:eachSuperClass. |
|
2251 |
aBlock value:eachSuperClass. |
|
2252 |
]. |
|
2253 |
]. |
|
2254 |
already add:eachClass. |
|
2255 |
aBlock value:eachClass. |
|
2256 |
] |
|
8964
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
2257 |
]. |
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
2258 |
|
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
2259 |
" |
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
2260 |
Smalltalk allClassesInOrderDo:[:aClass | Transcript showCR:aClass name] |
5406 | 2261 |
" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2262 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2263 |
|
9506 | 2264 |
allClassesInPackage:aPackageID |
24112 | 2265 |
"evaluate the argument, aBlock for all classes in a package; |
10087 | 2266 |
The order of the classes is not defined. |
2267 |
The returned collection may include private classes" |
|
9506 | 2268 |
|
2269 |
^ self allClassesForWhich:[:cls | cls package = aPackageID] |
|
2270 |
||
2271 |
" |
|
10071 | 2272 |
Smalltalk allClassesInPackage:'bosch:dapasx' |
9506 | 2273 |
" |
2274 |
||
2275 |
"Created: / 10-08-2006 / 12:14:10 / cg" |
|
10087 | 2276 |
"Modified: / 12-10-2006 / 23:48:43 / cg" |
24112 | 2277 |
"Modified (comment): / 08-05-2019 / 10:56:53 / Claus Gittinger" |
9506 | 2278 |
! |
2279 |
||
9490 | 2280 |
allClassesInPackage:aPackageID do:aBlock |
24112 | 2281 |
"evaluate the argument, aBlock for all classes in a package; |
9490 | 2282 |
The order of the classes is not defined." |
2283 |
||
2284 |
^ self allClassesForWhich:[:cls | cls package = aPackageID] do:aBlock |
|
2285 |
||
2286 |
" |
|
10071 | 2287 |
Smalltalk allClassesInPackage:'bosch:dapasx' do:[:aClass | Transcript showCR:aClass] |
9490 | 2288 |
" |
2289 |
||
2290 |
"Created: / 09-08-2006 / 17:14:17 / fm" |
|
24112 | 2291 |
"Modified (comment): / 08-05-2019 / 10:56:50 / Claus Gittinger" |
2292 |
! |
|
2293 |
||
2294 |
allClassesMatchingCategory:aCategoryPattern |
|
2295 |
"return a collection of for all classes matching aCategoryPattern; |
|
2296 |
The order of the classes is not defined." |
|
2297 |
||
2298 |
^ self allClassesForWhich:[:cls | aCategoryPattern match:cls category] |
|
2299 |
||
2300 |
" |
|
2301 |
Smalltalk allClassesInCategory:'Collections-Arrayed' |
|
2302 |
Smalltalk allClassesMatchingCategory:'Collections-*' |
|
2303 |
" |
|
2304 |
||
2305 |
"Created: / 08-05-2019 / 10:54:47 / Claus Gittinger" |
|
2306 |
! |
|
2307 |
||
2308 |
allClassesMatchingPackage:aPackageIDPattern |
|
2309 |
"evaluate the argument, aBlock for all classes matching packagePattern; |
|
2310 |
The order of the classes is not defined. |
|
2311 |
The returned collection may include private classes" |
|
2312 |
||
2313 |
^ self allClassesForWhich:[:cls | aPackageIDPattern match:cls package] |
|
2314 |
||
2315 |
" |
|
2316 |
Smalltalk allClassesInPackage:'exept:bridgeFramework' |
|
2317 |
Smalltalk allClassesMatchingPackage:'exept:bridgeFramework*' |
|
2318 |
" |
|
2319 |
||
2320 |
"Created: / 08-05-2019 / 10:56:10 / Claus Gittinger" |
|
9490 | 2321 |
! |
2322 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2323 |
allKeysDo:aBlock |
20988 | 2324 |
<resource: #obsolete> |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2325 |
"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
|
2326 |
|
21265 | 2327 |
self obsoleteMethodWarning:'please use #keysDo:'. |
17385 | 2328 |
self keysDo:aBlock |
21265 | 2329 |
|
2330 |
"Modified: / 20-01-2017 / 17:52:40 / stefan" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2331 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2332 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2333 |
allMethodCategories |
12298 | 2334 |
"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
|
2335 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2336 |
|allCategories| |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2337 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2338 |
allCategories := Set new. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2339 |
Smalltalk allClassesDo:[:cls | |
22791 | 2340 |
allCategories addAll:cls methodCategories. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2341 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2342 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2343 |
^ allCategories. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2344 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2345 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2346 |
Smalltalk allMethodCategories |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2347 |
" |
21980 | 2348 |
|
2349 |
"Modified: / 05-07-2017 / 10:51:50 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2350 |
! |
6722
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
2351 |
|
9259 | 2352 |
allMethodsDo:aBlock |
12298 | 2353 |
"enumerate all methods in all classes" |
12000 | 2354 |
|
9259 | 2355 |
Smalltalk allClassesDo:[:eachClass | |
18668 | 2356 |
eachClass instAndClassSelectorsAndMethodsDo:[:sel :mthd | |
2357 |
aBlock value:mthd |
|
2358 |
] |
|
12298 | 2359 |
]. |
2360 |
! |
|
2361 |
||
14933 | 2362 |
allMethodsForWhich:aBlock |
2363 |
"return a collection of methods for which aBlock returns true" |
|
2364 |
||
2365 |
|coll| |
|
2366 |
||
2367 |
coll := OrderedCollection new. |
|
22015 | 2368 |
self allMethodsForWhich:aBlock do:[:mthd | coll add:mthd]. |
2369 |
^ coll |
|
2370 |
||
2371 |
" |
|
2372 |
Smalltalk allMethodsForWhich:[:m | m isObsolete]. |
|
2373 |
||
2374 |
Smalltalk allMethodsForWhich:#isObsolete. |
|
2375 |
" |
|
2376 |
||
2377 |
"Modified (comment): / 14-07-2017 / 10:52:54 / cg" |
|
2378 |
! |
|
2379 |
||
2380 |
allMethodsForWhich:aCheckBlock do:actionBlock |
|
2381 |
"enumerate methods for which aCheckBlock returns true" |
|
2382 |
||
14933 | 2383 |
Smalltalk allClassesDo:[:eachClass | |
22791 | 2384 |
eachClass instAndClassSelectorsAndMethodsDo:[:sel :mthd | |
2385 |
(aCheckBlock value:mthd) ifTrue:[ |
|
2386 |
actionBlock value:mthd |
|
2387 |
]. |
|
2388 |
] |
|
22015 | 2389 |
]. |
2390 |
||
2391 |
" |
|
2392 |
Smalltalk allMethodsForWhich:[:m | m isObsolete] do:[:m | Transcript showCR:m]. |
|
2393 |
||
2394 |
Smalltalk allMethodsForWhich:#isObsolete do:[:m | Transcript showCR:m]. |
|
2395 |
" |
|
2396 |
||
2397 |
"Created: / 14-07-2017 / 10:51:53 / cg" |
|
14933 | 2398 |
! |
2399 |
||
12300
e72e90ea410f
changed: #allMethodsWithSelectorDo:
Claus Gittinger <cg@exept.de>
parents:
12299
diff
changeset
|
2400 |
allMethodsWithSelectorDo:aTwoArgBlock |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2401 |
"enumerate all methods in all classes and evaluate aBlock |
12300
e72e90ea410f
changed: #allMethodsWithSelectorDo:
Claus Gittinger <cg@exept.de>
parents:
12299
diff
changeset
|
2402 |
with method and selector as arguments." |
12299
3ed13f5685b9
added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents:
12298
diff
changeset
|
2403 |
|
3ed13f5685b9
added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents:
12298
diff
changeset
|
2404 |
Smalltalk allClassesDo:[:eachClass | |
18668 | 2405 |
eachClass instAndClassSelectorsAndMethodsDo:[:sel :mthd | |
2406 |
aTwoArgBlock value:mthd value:sel |
|
2407 |
] |
|
12299
3ed13f5685b9
added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents:
12298
diff
changeset
|
2408 |
]. |
3ed13f5685b9
added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents:
12298
diff
changeset
|
2409 |
! |
3ed13f5685b9
added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents:
12298
diff
changeset
|
2410 |
|
7563 | 2411 |
associationsDo:aBlock |
10071 | 2412 |
"evaluate the argument, aBlock for all key/value pairs |
617 | 2413 |
in the Smalltalk dictionary" |
2414 |
||
2415 |
self keysDo:[:aKey | |
|
18668 | 2416 |
aBlock value:(aKey -> (self at:aKey)) |
617 | 2417 |
] |
2418 |
||
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
2419 |
"Smalltalk associationsDo:[:assoc | assoc printCR]" |
617 | 2420 |
! |
2421 |
||
7563 | 2422 |
basicKeys |
2423 |
"for rel > 5 only" |
|
2424 |
||
18349 | 2425 |
%{ |
2426 |
#ifdef __SCHTEAM__ |
|
18668 | 2427 |
STObject[] keys = STSmalltalkEnvironment.GetKeyVector(); |
18349 | 2428 |
return __c__._RETURN( new STVector(keys) ); |
2429 |
#endif |
|
2430 |
%}. |
|
7563 | 2431 |
self primitiveFailed |
2432 |
! |
|
2433 |
||
2434 |
do:aBlock |
|
2435 |
"evaluate the argument, aBlock for all values in the Smalltalk dictionary" |
|
617 | 2436 |
|
2437 |
|work| |
|
2438 |
||
2439 |
%{ /* 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
|
2440 |
__GLOBALS_DO(&aBlock, &work); |
5406 | 2441 |
RETURN (self); |
2442 |
%}. |
|
2443 |
self keysDo:[:aKey | |
|
18668 | 2444 |
aBlock value:(self at:aKey) |
5406 | 2445 |
] |
617 | 2446 |
! |
2447 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2448 |
keysAndValuesDo:aBlock |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2449 |
"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
|
2450 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2451 |
self keysDo:[:aKey | |
18668 | 2452 |
aBlock value:aKey value:(self at:aKey) |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2453 |
] |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2454 |
! |
617 | 2455 |
|
9077
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2456 |
keysAndValuesSelect:selectBlockWith2Args thenCollect:collectBlockWith2Args |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2457 |
|collected| |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2458 |
|
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2459 |
collected := OrderedCollection new. |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2460 |
self keysAndValuesDo:[:eachKey :eachValue | |
18668 | 2461 |
(selectBlockWith2Args value:eachKey value:eachValue) ifTrue:[ |
2462 |
collected add:(collectBlockWith2Args value:eachKey value:eachValue) |
|
2463 |
]. |
|
9077
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2464 |
]. |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2465 |
^ collected |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2466 |
|
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2467 |
" |
10071 | 2468 |
Smalltalk |
18668 | 2469 |
keysAndValuesSelect:[:nm :val | (nm startsWith:'Ab') and:[val notNil]] |
2470 |
thenCollect:[:nm :val | nm] |
|
9077
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2471 |
" |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2472 |
! |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2473 |
|
7563 | 2474 |
keysDo:aBlock |
2475 |
"evaluate the argument, aBlock for all keys in the Smalltalk dictionary" |
|
617 | 2476 |
|work| |
2477 |
||
2478 |
%{ /* 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
|
2479 |
__GLOBALKEYS_DO(&aBlock, &work); |
5406 | 2480 |
RETURN (self); |
2481 |
%}. |
|
2482 |
self basicKeys do:[:aKey | |
|
18668 | 2483 |
aBlock value:aKey |
5406 | 2484 |
] |
453 | 2485 |
! ! |
2486 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2487 |
!Smalltalk class methodsFor:'message control'! |
453 | 2488 |
|
7563 | 2489 |
silentLoading |
12408 | 2490 |
"returns the Silentloading class variable, which globally controls if compilation |
2491 |
messages are shown on the transcript during a fileIn." |
|
7563 | 2492 |
|
10355
b1cb807fd03c
Make sure, that #silentLoading does not return nil
Stefan Vogel <sv@exept.de>
parents:
10329
diff
changeset
|
2493 |
^ SilentLoading ? false |
7563 | 2494 |
! |
2495 |
||
2496 |
silentLoading:aBoolean |
|
2497 |
"{ Pragma: +optSpace }" |
|
2498 |
||
2499 |
"allows access to the Silentloading class variable, which controls |
|
12408 | 2500 |
messages (especially during fileIn) onto the transcript. |
453 | 2501 |
You can save a snapshot with this flag set to true, which makes |
2502 |
the image come up silent. Can also be set, to read in files unlogged." |
|
2503 |
||
2504 |
|prev| |
|
2505 |
||
2506 |
prev := SilentLoading. |
|
2507 |
SilentLoading := aBoolean. |
|
2508 |
^ prev |
|
12409 | 2509 |
! |
2510 |
||
2511 |
silentlyLoadingDo:aBlock |
|
2512 |
"evaluates aBlock with silent loading on - no compilation messages (except errors) |
|
2513 |
are shown on the transcript" |
|
2514 |
||
2515 |
|sav| |
|
2516 |
||
20719 | 2517 |
Smalltalk verbose ifTrue:[ |
22791 | 2518 |
^ aBlock value. |
2519 |
]. |
|
2520 |
||
12409 | 2521 |
sav := SilentLoading. |
2522 |
SilentLoading := true. |
|
22691 | 2523 |
^ aBlock ensure:[ SilentLoading := sav ]. |
2524 |
||
2525 |
"Modified: / 23-04-2018 / 16:56:40 / stefan" |
|
453 | 2526 |
! ! |
2527 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2528 |
!Smalltalk class methodsFor:'misc accessing'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2529 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2530 |
beHeadless:aBoolean |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2531 |
"set/clear the headlessOperation flag." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2532 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2533 |
HeadlessOperation := aBoolean |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2534 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2535 |
|
10231 | 2536 |
beSTScript:aBoolean |
2537 |
"set/clear the isSTScript flag." |
|
2538 |
||
2539 |
IsSTScript := aBoolean |
|
2540 |
||
2541 |
"Created: / 06-12-2006 / 16:43:36 / cg" |
|
2542 |
! |
|
2543 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2544 |
standAloneApp:aBoolean |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2545 |
"set/clear the StandAlone flag." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2546 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2547 |
StandAlone := aBoolean |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2548 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2549 |
|
18197 | 2550 |
|
12250 | 2551 |
!Smalltalk class methodsFor:'private-system management-packages'! |
2552 |
||
17324 | 2553 |
basicLoadPackage:aPackageString fromDirectory:packageDirOrStringOrNil asAutoloaded:doLoadAsAutoloaded |
2554 |
"load a package referenced by aPackageString - a string like 'stx:libbasic'. |
|
2555 |
The package is either located in packageDirOrStringOrNil, or in the current directory (if nil). |
|
2556 |
Answer true, if the load succeeded, false if it failed" |
|
2557 |
||
22791 | 2558 |
|packageDirOrNil binaryClassLibraryFilename projectDefinitionFilename |
19589 | 2559 |
projectDefinitionClass projectDefinitionClassName silent somethingHasBeenLoaded |
2560 |
loadOK errorInInitialize| |
|
17324 | 2561 |
|
2562 |
packageDirOrStringOrNil notNil ifTrue:[ |
|
23747 | 2563 |
packageDirOrNil := packageDirOrStringOrNil asFilename. |
22791 | 2564 |
]. |
2565 |
silent := VerboseLoading not |
|
23747 | 2566 |
and:[SilentLoading or:[StandAlone or:[InfoPrinting not]]]. |
17324 | 2567 |
|
2568 |
"For now: have to read the project definition first!! |
|
2569 |
The class library may contain subclasses of classes in prerequisite packages - |
|
19589 | 2570 |
so the prerequisite packages have to be loaded first. |
2571 |
Normally there is a project definiton, use that one to pull in the rest" |
|
17324 | 2572 |
|
2573 |
"maybe, it is already in the image" |
|
2574 |
projectDefinitionClass := ProjectDefinition definitionClassForPackage:aPackageString. |
|
19906 | 2575 |
projectDefinitionClass notNil ifTrue:[ |
23747 | 2576 |
projectDefinitionClass checkForLoad. |
17324 | 2577 |
]. |
2578 |
||
2579 |
"Is there a shared library (.dll or .so) ?" |
|
17439
1928276a394c
added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents:
17438
diff
changeset
|
2580 |
binaryClassLibraryFilename := ObjectFileLoader |
23747 | 2581 |
binaryClassFilenameForPackage:aPackageString |
2582 |
inDirectory:packageDirOrNil. |
|
17324 | 2583 |
|
24123 | 2584 |
errorInInitialize := false. |
17324 | 2585 |
(binaryClassLibraryFilename notNil and:[binaryClassLibraryFilename exists]) ifTrue:[ |
23873 | 2586 |
|loadErrorOccurred| |
2587 |
||
2588 |
loadErrorOccurred := loadOK := false. |
|
2589 |
||
2590 |
[ |
|
2591 |
loadOK := (ObjectFileLoader loadObjectFile:binaryClassLibraryFilename) notNil. |
|
2592 |
"/ loadOK := self loadPackage:aPackageString fromClassLibrary:binaryClassLibraryFilename. |
|
2593 |
] on:PackageNotCompatibleError do:[:ex| |
|
2594 |
ex reject. |
|
2595 |
] on:ObjectFileLoader objectFileLoadErrorNotification do:[:ex| |
|
2596 |
loadErrorOccurred := true. |
|
2597 |
ex proceedWith:true. |
|
23747 | 2598 |
]. |
23873 | 2599 |
|
23747 | 2600 |
(loadOK and:[loadErrorOccurred not]) ifTrue:[ |
2601 |
"now, all compiled classes have been loaded. |
|
2602 |
keep classes in the package which are autoloaded as autoloaded." |
|
2603 |
^ true |
|
2604 |
]. |
|
2605 |
||
2606 |
loadErrorOccurred ifTrue:[ |
|
2607 |
self breakPoint:#cg. |
|
23873 | 2608 |
projectDefinitionClass := ProjectDefinition definitionClassForPackage:aPackageString. |
2609 |
projectDefinitionClass notNil ifTrue:[ |
|
2610 |
projectDefinitionClass |
|
2611 |
checkForLoad; |
|
2612 |
loadPreRequisitesAsAutoloaded:doLoadAsAutoloaded. |
|
2613 |
]. |
|
23747 | 2614 |
]. |
17324 | 2615 |
]. |
2616 |
packageDirOrNil isNil ifTrue:[ |
|
23747 | 2617 |
^ PackageNotFoundError raiseRequestWith:aPackageString. |
17324 | 2618 |
]. |
2619 |
||
23748 | 2620 |
"fallback - go through the project definition, |
2621 |
loading that from source, if available" |
|
17324 | 2622 |
projectDefinitionClass isNil ifTrue:[ |
23747 | 2623 |
projectDefinitionClassName := ProjectDefinition projectDefinitionClassNameForDefinitionOf:aPackageString. |
2624 |
"/ try to load the project definition class |
|
2625 |
projectDefinitionFilename := (packageDirOrNil / projectDefinitionClassName) withSuffix:'st'. |
|
2626 |
projectDefinitionFilename exists ifFalse:[ |
|
2627 |
projectDefinitionFilename := (packageDirOrNil / 'source' / projectDefinitionClassName) withSuffix:'st'. |
|
2628 |
]. |
|
2629 |
projectDefinitionFilename exists ifTrue:[ |
|
2630 |
Class withoutUpdatingChangesDo:[ |
|
2631 |
Smalltalk silentlyLoadingDo:[ |
|
2632 |
Error handle:[:ex | |
|
2633 |
"/ catch error during initialization; |
|
2634 |
ex suspendedContext withAllSendersDo:[:sender | |
|
2635 |
(sender selector == #initialize |
|
2636 |
and:[sender receiver isBehavior |
|
2637 |
and:[sender receiver name = projectDefinitionClassName]] |
|
2638 |
) ifTrue:[ |
|
2639 |
errorInInitialize := true |
|
2640 |
]. |
|
2641 |
]. |
|
2642 |
errorInInitialize ifFalse:[ ex reject ]. |
|
2643 |
] do:[ |
|
2644 |
projectDefinitionFilename fileIn. |
|
2645 |
]. |
|
2646 |
]. |
|
2647 |
]. |
|
2648 |
errorInInitialize ifTrue:[ |
|
2649 |
Transcript showCR:'Smalltalk [warning]: an error happened in #initialize - retry after loading package.'. |
|
2650 |
]. |
|
2651 |
projectDefinitionClass := ProjectDefinition definitionClassForPackage:aPackageString. |
|
2652 |
]. |
|
17324 | 2653 |
]. |
2654 |
projectDefinitionClass notNil ifTrue:[ |
|
23747 | 2655 |
projectDefinitionClass |
2656 |
autoload; |
|
2657 |
checkForLoad; |
|
2658 |
loadPreRequisitesAsAutoloaded:doLoadAsAutoloaded. |
|
2659 |
||
2660 |
somethingHasBeenLoaded := projectDefinitionClass loadAsAutoloaded:doLoadAsAutoloaded. |
|
2661 |
errorInInitialize ifTrue:[ |
|
2662 |
Transcript showCR:('Smalltalk [info]: retrying #initialize'). |
|
2663 |
projectDefinitionClass initialize. |
|
2664 |
]. |
|
2665 |
(silent not and:[somethingHasBeenLoaded]) ifTrue:[ |
|
2666 |
Transcript showCR:('Smalltalk [info]: loaded package: ' , aPackageString , ' from project definition'). |
|
2667 |
]. |
|
2668 |
^ true. |
|
17324 | 2669 |
]. |
2670 |
||
2671 |
"/ source files-file loading no longer supported |
|
2672 |
"/ however, allow for autoload-stub loaded |
|
2673 |
doLoadAsAutoloaded ifTrue:[ |
|
23747 | 2674 |
self |
2675 |
recursiveInstallAutoloadedClassesFrom:packageDirOrNil |
|
2676 |
rememberIn:Set new |
|
2677 |
maxLevels:2 |
|
2678 |
noAutoload:false |
|
2679 |
packageTop:packageDirOrNil |
|
2680 |
showSplashInLevels:0. |
|
2681 |
^ true |
|
17324 | 2682 |
]. |
2683 |
||
2684 |
^ PackageNotFoundError raiseRequestWith:aPackageString errorString:' - no projectDef, dll or loadAll found'. |
|
2685 |
||
2686 |
" |
|
2687 |
Smalltalk loadPackageWithId:'stx:libbasic' |
|
2688 |
Smalltalk loadPackageWithId:'stx:goodies/persistency' |
|
2689 |
Smalltalk loadPackageWithId:'exept:ctypes' |
|
2690 |
" |
|
2691 |
||
2692 |
"Modified: / 29-07-2011 / 19:55:35 / cg" |
|
23873 | 2693 |
"Modified: / 12-03-2019 / 18:44:50 / Stefan Vogel" |
24123 | 2694 |
"Modified: / 15-05-2019 / 17:03:09 / Claus Gittinger" |
17324 | 2695 |
! |
2696 |
||
12250 | 2697 |
loadExtensionsForPackage:aPackageId |
13415 | 2698 |
| extensionsLoaded | |
13621
85297bc6cfa8
comment/format in: #loadExtensionsForPackage:
Claus Gittinger <cg@exept.de>
parents:
13602
diff
changeset
|
2699 |
|
13415 | 2700 |
extensionsLoaded := false. |
18924 | 2701 |
ProgrammingLanguage allDo:[:programmingLanguage| |
22791 | 2702 |
"/ evaluating or here - want all extensions to be loaded |
2703 |
extensionsLoaded := extensionsLoaded | (self loadExtensionsForPackage:aPackageId language: programmingLanguage) |
|
13621
85297bc6cfa8
comment/format in: #loadExtensionsForPackage:
Claus Gittinger <cg@exept.de>
parents:
13602
diff
changeset
|
2704 |
]. |
85297bc6cfa8
comment/format in: #loadExtensionsForPackage:
Claus Gittinger <cg@exept.de>
parents:
13602
diff
changeset
|
2705 |
^ extensionsLoaded |
13415 | 2706 |
|
2707 |
"Modified: / 18-02-2007 / 11:03:26 / cg" |
|
2708 |
"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
|
2709 |
"Modified (format): / 04-09-2011 / 09:19:24 / cg" |
13415 | 2710 |
! |
2711 |
||
18924 | 2712 |
loadExtensionsForPackage:aPackageId language: programmingLanguage |
13771 | 2713 |
|mgr packageDirName inStream projectDefinition extensionsFilename mod dir |
13621
85297bc6cfa8
comment/format in: #loadExtensionsForPackage:
Claus Gittinger <cg@exept.de>
parents:
13602
diff
changeset
|
2714 |
extensionsRevisionString extensionsRevisionInfo| |
12250 | 2715 |
|
18924 | 2716 |
programmingLanguage supportsExtensionMethods ifFalse:[^false]. |
13415 | 2717 |
|
12250 | 2718 |
packageDirName := aPackageId copyReplaceAll:$: with:$/. |
2719 |
packageDirName := self getPackageFileName:packageDirName. |
|
2720 |
||
2721 |
(packageDirName notNil and:[Class tryLocalSourceFirst]) ifTrue:[ |
|
22791 | 2722 |
(self loadExtensionsFromDirectory:packageDirName language: programmingLanguage) ifTrue:[ |
2723 |
^ true. |
|
2724 |
]. |
|
2725 |
packageDirName := nil. "do not try again" |
|
12250 | 2726 |
]. |
2727 |
||
2728 |
" |
|
2729 |
if there is a sourceCodeManager, ask it first for the extensions |
|
2730 |
" |
|
15958 | 2731 |
(Smalltalk at:#AbstractSourceCodeManager) notNil ifTrue:[ |
22791 | 2732 |
mgr := AbstractSourceCodeManager managerForPackage: aPackageId |
15958 | 2733 |
]. |
12250 | 2734 |
mgr notNil ifTrue:[ |
22791 | 2735 |
extensionsFilename := 'extensions.' , programmingLanguage sourceFileSuffix. |
2736 |
||
2737 |
projectDefinition := ProjectDefinition definitionClassForPackage:aPackageId. |
|
2738 |
projectDefinition notNil ifTrue:[ |
|
2739 |
mod := aPackageId asPackageId module. |
|
2740 |
dir := aPackageId asPackageId directory. |
|
2741 |
extensionsRevisionString := projectDefinition perform:(mgr nameOfVersionMethodForExtensions) ifNotUnderstood:nil. |
|
2742 |
extensionsRevisionString notNil ifTrue:[ |
|
2743 |
extensionsRevisionInfo := mgr revisionInfoFromString:extensionsRevisionString inClass:nil. |
|
2744 |
extensionsRevisionInfo notNil ifTrue:[ |
|
2745 |
extensionsRevisionInfo fileName = extensionsFilename ifFalse:[ |
|
2746 |
"JV@2011-10-23: following condition is never satisfied for |
|
2747 |
filed-in packages. The whole scheme of extensionVersion_XXX |
|
2748 |
works ONLY for compiled packages as it depends on fact, that |
|
2749 |
extension Init() routine is called AFTER all classes are inited, |
|
2750 |
therefore the extensionVersion_XXX methods from extensions.st |
|
2751 |
overwrites methods coming from package definition class. All this |
|
2752 |
is so tricky and error prone, that we have to come up with better |
|
2753 |
solution!!" |
|
2754 |
packageDirName notNil ifTrue:[ |
|
2755 |
^ self loadExtensionsFromDirectory:packageDirName language: programmingLanguage |
|
2756 |
] ifFalse:[ |
|
2757 |
^ false |
|
2758 |
] |
|
2759 |
] |
|
2760 |
] |
|
2761 |
]. |
|
2762 |
SourceCodeManagerError handle:[:ex | |
|
2763 |
] do:[ |
|
2764 |
inStream := mgr streamForExtensionFile:extensionsFilename package:aPackageId directory:dir module:mod cache:true. |
|
2765 |
]. |
|
2766 |
]. |
|
2767 |
inStream isNil ifTrue:[ |
|
2768 |
SourceCodeManagerError handle:[:ex | |
|
2769 |
] do:[ |
|
2770 |
inStream := mgr getMostRecentSourceStreamForFile:extensionsFilename inPackage:aPackageId. |
|
2771 |
]. |
|
2772 |
]. |
|
2773 |
inStream notNil ifTrue:[ |
|
2774 |
Class withoutUpdatingChangeSetDo:[ |
|
2775 |
inStream fileIn. |
|
2776 |
]. |
|
2777 |
inStream close. |
|
2778 |
VerboseLoading ifTrue:[ |
|
2779 |
Transcript showCR:('loaded extensions for ',aPackageId,' from repository'). |
|
2780 |
]. |
|
2781 |
^ true |
|
2782 |
] |
|
12250 | 2783 |
]. |
2784 |
||
2785 |
packageDirName notNil ifTrue:[ |
|
22791 | 2786 |
^ self loadExtensionsFromDirectory:packageDirName language: programmingLanguage |
12250 | 2787 |
]. |
2788 |
^ false |
|
2789 |
||
13415 | 2790 |
"Created: / 02-01-2010 / 10:41:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2791 |
"Modified: / 19-03-2011 / 10:03:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13814 | 2792 |
"Modified: / 04-11-2011 / 13:41:29 / cg" |
15958 | 2793 |
"Modified: / 23-10-2011 / 19:35:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
12250 | 2794 |
! |
2795 |
||
2796 |
loadExtensionsFromDirectory:packageDirOrString |
|
13415 | 2797 |
| extensionsLoaded | |
18924 | 2798 |
|
13415 | 2799 |
extensionsLoaded := false. |
18924 | 2800 |
ProgrammingLanguage allDo:[:programmingLanguage| |
22791 | 2801 |
"/ evaluating or here - want all extensions to be loaded |
2802 |
extensionsLoaded := extensionsLoaded | (self loadExtensionsFromDirectory: packageDirOrString language: programmingLanguage) |
|
18924 | 2803 |
]. |
2804 |
^ extensionsLoaded |
|
13415 | 2805 |
|
2806 |
"Modified: / 02-01-2010 / 10:40:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2807 |
! |
|
2808 |
||
2809 |
loadExtensionsFromDirectory:packageDirOrString language: language |
|
12250 | 2810 |
|packageDir f| |
2811 |
||
2812 |
packageDir := packageDirOrString asFilename. |
|
2813 |
||
13415 | 2814 |
f := packageDir / ('extensions.' , language sourceFileSuffix). |
12250 | 2815 |
f exists ifTrue:[ |
18668 | 2816 |
Class withoutUpdatingChangeSetDo:[ |
2817 |
f fileIn. |
|
2818 |
]. |
|
2819 |
VerboseLoading ifTrue:[ |
|
2820 |
Transcript showCR:('loaded extensions: ' , f pathName). |
|
2821 |
]. |
|
2822 |
^ true |
|
15958 | 2823 |
]. |
2824 |
^ true"/false |
|
13415 | 2825 |
|
2826 |
"Created: / 02-01-2010 / 10:38:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13814 | 2827 |
"Modified: / 04-11-2011 / 13:41:19 / cg" |
15958 | 2828 |
"Modified: / 31-01-2013 / 11:33:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
12250 | 2829 |
! |
2830 |
||
14589 | 2831 |
loadPackage:aPackageStringArg asAutoloaded:doLoadAsAutoloaded |
12782 | 2832 |
"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
|
2833 |
Return true on success, false otherwise." |
12782 | 2834 |
|
14589 | 2835 |
|packageId packageString packageDir def sourceCodeManager| |
2836 |
||
17588 | 2837 |
packageString := aPackageStringArg. |
2838 |
||
2839 |
"/ a little convenience: so you can stx packages with loadPackage:'goodies/soap' |
|
2840 |
(packageString includes:$:) ifFalse:[ |
|
22791 | 2841 |
packageString := 'stx:',packageString. |
17588 | 2842 |
]. |
12782 | 2843 |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2844 |
"if I am here, so must my package" |
14892 | 2845 |
packageString = self package ifTrue:[^ true]. |
13129
0ac3f6a28aaf
changed: #loadPackage:asAutoloaded:
Claus Gittinger <cg@exept.de>
parents:
13120
diff
changeset
|
2846 |
|
17588 | 2847 |
packageId := aPackageStringArg asPackageId. |
2848 |
||
12782 | 2849 |
"/ if there is a projectDefinition, let it load itself... |
14589 | 2850 |
def := packageId projectDefinitionClass. |
14833 | 2851 |
(def notNil and:[def isLoaded]) ifTrue:[ |
22791 | 2852 |
def loadAsAutoloaded:doLoadAsAutoloaded. |
2853 |
^ true. |
|
14589 | 2854 |
]. |
2855 |
||
2856 |
packageDir := self packageDirectoryForPackageId:packageId. |
|
16144 | 2857 |
|
2858 |
[ |
|
22791 | 2859 |
self |
2860 |
loadPackage:packageString |
|
2861 |
fromDirectory:packageDir |
|
2862 |
asAutoloaded:doLoadAsAutoloaded. |
|
16144 | 2863 |
] on:PackageLoadError do:[:ex| |
22791 | 2864 |
ex creator ~~ PackageNotCompatibleError ifTrue:[ |
2865 |
AbstractSourceCodeManager notNil ifTrue:[ |
|
2866 |
sourceCodeManager := AbstractSourceCodeManager sourceCodeManagerForPackage:packageString. |
|
2867 |
sourceCodeManager notNil ifTrue:[ |
|
2868 |
PackageLoadError handle:[:ex2 | |
|
2869 |
ex reject |
|
2870 |
] do:[ |
|
2871 |
^ sourceCodeManager loadPackageWithId:packageString fromRepositoryAsAutoloaded:doLoadAsAutoloaded |
|
2872 |
]. |
|
2873 |
]. |
|
2874 |
]. |
|
2875 |
]. |
|
2876 |
ex reject. |
|
16144 | 2877 |
]. |
2878 |
||
2879 |
^ true |
|
12782 | 2880 |
|
2881 |
" |
|
2882 |
Smalltalk loadPackageWithId:'stx:libbasic' |
|
2883 |
Smalltalk loadPackageWithId:'stx:goodies/persistency' |
|
2884 |
Smalltalk loadPackageWithId:'exept:ctypes' |
|
2885 |
" |
|
2886 |
||
13129
0ac3f6a28aaf
changed: #loadPackage:asAutoloaded:
Claus Gittinger <cg@exept.de>
parents:
13120
diff
changeset
|
2887 |
"Modified: / 16-11-2010 / 17:42:49 / cg" |
12782 | 2888 |
! |
2889 |
||
12250 | 2890 |
loadPackage:packageId fromAllSourceFilesInDirectory:aDirectory |
2891 |
"load all source files found in aDirectory and treat them like |
|
2892 |
a package. Allows for initial import of alien ST-code as a new package. |
|
2893 |
Experimental." |
|
2894 |
||
2895 |
|p t new anyFail repeatCount| |
|
2896 |
||
2897 |
"/ problem: dependencies. |
|
2898 |
"/ solution: repeat twice, so that superclasses are present the second time |
|
2899 |
||
2900 |
Class packageQuerySignal answer:packageId asSymbol do:[ |
|
18668 | 2901 |
|any| |
2902 |
||
2903 |
repeatCount := 0. |
|
2904 |
[ |
|
2905 |
repeatCount := repeatCount + 1. |
|
2906 |
anyFail := false. |
|
2907 |
aDirectory directoryContents do:[:file | |
|
2908 |
|fn| |
|
2909 |
||
2910 |
fn := aDirectory / file. |
|
2911 |
(fn hasSuffix:'st') ifTrue:[ |
|
2912 |
Metaclass confirmationQuerySignal answer:false |
|
2913 |
do:[ |
|
2914 |
Error |
|
2915 |
handle:[:ex | |
|
2916 |
anyFail := true |
|
2917 |
] |
|
2918 |
do:[ |
|
2919 |
(self fileIn:fn) ifFalse:[ |
|
2920 |
anyFail := true |
|
2921 |
] ifTrue:[ |
|
2922 |
any := true. |
|
2923 |
] |
|
2924 |
] |
|
2925 |
] |
|
2926 |
] |
|
2927 |
]. |
|
2928 |
any ifFalse:[ |
|
2929 |
^ false "/ no file found |
|
2930 |
] |
|
2931 |
] doWhile:[anyFail and:[repeatCount<2]]. |
|
12250 | 2932 |
]. |
2933 |
||
2934 |
new := (p := Project projectWithId:packageId) isNil. |
|
2935 |
new ifTrue:[ p := Project new]. |
|
2936 |
||
2937 |
p name:packageId. |
|
2938 |
p directory:aDirectory. |
|
2939 |
p package:packageId. |
|
2940 |
t := packageId asCollectionOfSubstringsSeparatedByAny:'/\:'. |
|
2941 |
p repositoryModule:(t first). |
|
2942 |
p repositoryDirectory:(packageId copyFrom:t first size + 2). |
|
2943 |
p isLoaded:true. |
|
2944 |
||
2945 |
new ifTrue:[Project addLoadedProject:p]. |
|
16144 | 2946 |
anyFail ifTrue:[ |
18668 | 2947 |
^ PackageLoadError raiseRequestWith:packageId. |
16144 | 2948 |
]. |
2949 |
^ true |
|
12250 | 2950 |
! |
2951 |
||
2952 |
loadPackage:packageId fromClassLibrary:aFilename |
|
2953 |
"load a package from a compiled classLib. |
|
2954 |
Experimental." |
|
2955 |
||
2956 |
|p t new| |
|
2957 |
||
2958 |
(self fileIn:aFilename) ifFalse:[ |
|
18668 | 2959 |
(self fileInClassLibrary:aFilename) ifFalse:[ |
2960 |
^ false. |
|
2961 |
] |
|
12250 | 2962 |
]. |
2963 |
||
2964 |
new := (p := Project projectWithId:packageId) isNil. |
|
2965 |
new ifTrue:[ p := Project new]. |
|
2966 |
||
2967 |
p name:packageId. |
|
2968 |
p directory:aFilename directory. |
|
2969 |
p package:packageId. |
|
2970 |
t := packageId asCollectionOfSubstringsSeparatedByAny:'/\:'. |
|
2971 |
p repositoryModule:(t first). |
|
2972 |
p repositoryDirectory:(packageId copyFrom:t first size + 2). |
|
2973 |
p isLoaded:true. |
|
2974 |
||
2975 |
new ifTrue:[Project addLoadedProject:p]. |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2976 |
|
12250 | 2977 |
^ true |
2978 |
! |
|
2979 |
||
12782 | 2980 |
loadPackage:aPackageString fromDirectory:packageDirOrStringOrNil asAutoloaded:doLoadAsAutoloaded |
2981 |
"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
|
2982 |
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
|
2983 |
Answer true, if the load succeeded, false if it failed" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2984 |
|
23873 | 2985 |
^ PackageLoadInProgressQuery |
2986 |
answerNotifyLoading:aPackageString asSymbol |
|
2987 |
do:[ |
|
2988 |
self basicLoadPackage:aPackageString fromDirectory:packageDirOrStringOrNil asAutoloaded:doLoadAsAutoloaded |
|
2989 |
]. |
|
17350 | 2990 |
|
2991 |
" |
|
2992 |
Smalltalk loadPackage:'stx:goodies/communication' |
|
2993 |
" |
|
23873 | 2994 |
|
2995 |
"Modified: / 12-03-2019 / 17:51:58 / Stefan Vogel" |
|
12782 | 2996 |
! |
2997 |
||
12250 | 2998 |
loadPackage:packageId fromLoadAllFile:aFilename |
12782 | 2999 |
<resource: #obsolete> |
12250 | 3000 |
"load a package from a loadAll - loader script. |
3001 |
Experimental." |
|
3002 |
||
3003 |
|p t new| |
|
3004 |
||
3005 |
Metaclass confirmationQuerySignal answer:false |
|
3006 |
do:[ |
|
18668 | 3007 |
(self fileIn:aFilename) ifFalse:[ |
3008 |
self warn:'Failed to load the package ', packageId printString. |
|
3009 |
^ false. |
|
3010 |
] |
|
12250 | 3011 |
]. |
3012 |
||
3013 |
new := (p := Project projectWithId:packageId) isNil. |
|
3014 |
new ifTrue:[ p := Project new]. |
|
3015 |
||
3016 |
p name:packageId. |
|
3017 |
p directory:aFilename directory. |
|
3018 |
p package:packageId. |
|
3019 |
t := packageId asCollectionOfSubstringsSeparatedByAny:'/\:'. |
|
3020 |
p repositoryModule:(t first). |
|
3021 |
p repositoryDirectory:(packageId copyFrom:t first size + 2). |
|
3022 |
p isLoaded:true. |
|
3023 |
||
3024 |
new ifTrue:[Project addLoadedProject:p]. |
|
3025 |
^ true |
|
3026 |
! |
|
3027 |
||
3028 |
loadPackage:aPackageId fromZIPArchive:f asAutoloaded:doLoadAsAutoloaded |
|
3029 |
"load a package from a .zip delivery file. |
|
3030 |
Experimental." |
|
3031 |
||
19906 | 3032 |
PackageLoadError |
22791 | 3033 |
raiseWith:aPackageId |
3034 |
errorString:' - package loading from zip is not yet implemented'. |
|
12250 | 3035 |
! |
3036 |
||
3037 |
loadPackageFromAbbrevFile:aPackageId asAutoloaded:doLoadAsAutoloaded |
|
12782 | 3038 |
<resource: #obsolete> |
12250 | 3039 |
|abbrevFile packageDir| |
3040 |
||
3041 |
packageDir := self packageDirectoryForPackageId:aPackageId. |
|
3042 |
packageDir isNil ifTrue:[^ false]. |
|
3043 |
||
3044 |
"/ abbrev.stc ? |
|
12377 | 3045 |
abbrevFile := packageDir / 'abbrev.stc'. |
12250 | 3046 |
abbrevFile exists ifFalse:[^ false]. |
3047 |
||
3048 |
Smalltalk installAutoloadedClassesFrom:abbrevFile pathName. |
|
3049 |
||
3050 |
doLoadAsAutoloaded ifFalse:[ |
|
18668 | 3051 |
"/ force autoloading... |
3052 |
Smalltalk allClassesInPackage:aPackageId do:[:eachClass | eachClass autoload]. |
|
12250 | 3053 |
]. |
3054 |
||
3055 |
self loadExtensionsFromDirectory:packageDir. |
|
13814 | 3056 |
VerboseLoading ifTrue:[ |
18668 | 3057 |
Transcript showCR:('Smalltalk [info]: loaded package: ' , aPackageId , ' from abbrev file: ' , abbrevFile pathName). |
12250 | 3058 |
]. |
3059 |
^ true |
|
3060 |
||
13814 | 3061 |
"Modified: / 04-11-2011 / 13:43:29 / cg" |
12250 | 3062 |
! ! |
3063 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3064 |
!Smalltalk class methodsFor:'queries'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3065 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3066 |
allClasses |
7563 | 3067 |
"return an unordered collection of all classes in the system. |
10071 | 3068 |
Only globally anchored classes are returned |
21489 | 3069 |
(i.e. anonymous ones have to be acquired by Behavior allSubInstances). |
3070 |
Enumerates non-meta classes only - not metaclasses" |
|
453 | 3071 |
|
3072 |
|classes| |
|
3073 |
||
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
3074 |
"/ you may wonder, what this while is for, here ... |
453 | 3075 |
"/ the reason is that if we modify the class hierarchy in |
4067 | 3076 |
"/ another view (background fileIn), while building up the |
453 | 3077 |
"/ cachedClasses set, this may be flushed (invalidated) by the |
3078 |
"/ other process in the meanwhile. |
|
3079 |
"/ If that happens, we restart the set-building here |
|
3080 |
"/ |
|
3081 |
[(classes := CachedClasses) isNil] whileTrue:[ |
|
22791 | 3082 |
CachedClasses := classes := IdentitySet new:NumberOfClassesHint. |
3083 |
self keysAndValuesDo:[:eachName :eachGlobal | |
|
3084 |
(eachGlobal notNil and:[eachGlobal isBehavior]) ifTrue:[ |
|
3085 |
"/ sigh - would like to skip over aliases |
|
3086 |
"/ but this cannot be done simply by comparing |
|
3087 |
"/ the classes name against the store-key |
|
3088 |
"/ i.e. cannot do: |
|
3089 |
"/ anObject name == sym ifTrue:[ |
|
3090 |
"/ classes add:anObject |
|
3091 |
"/ ] |
|
3092 |
"/ because that would lead to ignore all java |
|
3093 |
"/ classes, which are stored under a different |
|
3094 |
"/ key. |
|
3095 |
||
3096 |
(eachGlobal name == eachName |
|
3097 |
or:[eachGlobal isJavaClass]) ifTrue:[ |
|
3098 |
classes add:eachGlobal |
|
3099 |
]. |
|
3100 |
] |
|
3101 |
]. |
|
3102 |
NumberOfClassesHint := classes size. |
|
453 | 3103 |
]. |
3104 |
^ classes |
|
3105 |
||
8964
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
3106 |
" |
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
3107 |
CachedClasses := nil. |
453 | 3108 |
Smalltalk allClasses |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
3109 |
|
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
3110 |
to get the list sorted by name: |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
3111 |
|
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
3112 |
Smalltalk allClasses asSortedCollection:[:a :b | a name < b name] |
453 | 3113 |
" |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
3114 |
|
13851
5ab434e0a636
changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents:
13850
diff
changeset
|
3115 |
"Modified: / 06-12-2011 / 12:41:42 / cg" |
21489 | 3116 |
"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
|
3117 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3118 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3119 |
allClassesAndMetaclasses |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3120 |
"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
|
3121 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3122 |
|classes| |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3123 |
|
8964
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
3124 |
classes := IdentitySet new:NumberOfClassesHint*2. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3125 |
self allClassesDo:[:eachClass | |
18668 | 3126 |
classes add:(eachClass theNonMetaclass). |
3127 |
classes add:(eachClass theMetaclass). |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3128 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3129 |
^ classes |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3130 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3131 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3132 |
allClassesWithAllPrivateClasses |
7563 | 3133 |
"return an unordered collection of all classes in the Smalltalk namespace. |
10173
765b385fd1b8
changed #listAtCategoryNamed:
Claus Gittinger <cg@exept.de>
parents:
10169
diff
changeset
|
3134 |
Only globally anchored classes are returned; Namespaces are not included. |
20122 | 3135 |
(i.e. anonymous ones have to be acquired by Behavior allSubInstances)" |
4642 | 3136 |
|
10071 | 3137 |
^ self allClasses select:[:aClass | |
22791 | 3138 |
|owner| |
3139 |
||
3140 |
(aClass isRealNameSpace not) |
|
3141 |
and:[ |
|
3142 |
owner := aClass topOwningClass. |
|
3143 |
(owner ? aClass) nameSpace == Smalltalk |
|
3144 |
] |
|
4642 | 3145 |
] |
3146 |
||
3147 |
" |
|
3148 |
Smalltalk allClassesWithAllPrivateClasses |
|
3149 |
" |
|
10173
765b385fd1b8
changed #listAtCategoryNamed:
Claus Gittinger <cg@exept.de>
parents:
10169
diff
changeset
|
3150 |
|
765b385fd1b8
changed #listAtCategoryNamed:
Claus Gittinger <cg@exept.de>
parents:
10169
diff
changeset
|
3151 |
"Modified: / 10-11-2006 / 17:24:00 / cg" |
4642 | 3152 |
! |
3153 |
||
15068 | 3154 |
allExtensions |
3155 |
"return a collection of all extension methods (methods added from another package)" |
|
3156 |
||
3157 |
|methods| |
|
3158 |
||
3159 |
methods := OrderedCollection new. |
|
3160 |
self allClassesDo:[:eachClass | |
|
18668 | 3161 |
|classPackage| |
3162 |
||
3163 |
classPackage := eachClass package. |
|
3164 |
eachClass instAndClassMethodsDo:[:mthd | |
|
3165 |
mthd package ~= classPackage ifTrue:[ methods add:mthd ]. |
|
3166 |
]. |
|
15068 | 3167 |
]. |
3168 |
^ methods |
|
3169 |
||
3170 |
" |
|
3171 |
Smalltalk allExtensions |
|
3172 |
" |
|
3173 |
! |
|
3174 |
||
11153 | 3175 |
allExtensionsForPackage:aProjectID |
14890 | 3176 |
"return a collection of all extension methods for a given projectID" |
3177 |
||
11153 | 3178 |
|methods| |
3179 |
||
3180 |
methods := OrderedCollection new. |
|
3181 |
self allClassesDo:[:eachClass | |
|
18668 | 3182 |
methods addAll:(eachClass extensionsFrom:aProjectID). |
11153 | 3183 |
]. |
3184 |
^ methods |
|
3185 |
! |
|
3186 |
||
9227 | 3187 |
allImplementorsOf:aSelector |
12919
a7ea070197c9
comment/format in: #allImplementorsOf:
Claus Gittinger <cg@exept.de>
parents:
12911
diff
changeset
|
3188 |
"return a collection of classes which implement the given selector" |
a7ea070197c9
comment/format in: #allImplementorsOf:
Claus Gittinger <cg@exept.de>
parents:
12911
diff
changeset
|
3189 |
|
9227 | 3190 |
|implementors| |
3191 |
||
3192 |
implementors := OrderedCollection new. |
|
19681 | 3193 |
self allImplementorsOf:aSelector do:[:cls | implementors add:cls]. |
3194 |
^ implementors |
|
3195 |
||
3196 |
" |
|
22791 | 3197 |
Smalltalk allImplementorsOf:#isNil |
3198 |
(Smalltalk allImplementorsOf:#add:) size |
|
19681 | 3199 |
" |
3200 |
||
3201 |
"Modified: / 30-04-2016 / 17:37:39 / cg" |
|
3202 |
! |
|
3203 |
||
3204 |
allImplementorsOf:aSelector do:aBlock |
|
3205 |
"enumerate all classes which implement the given selector" |
|
3206 |
||
9227 | 3207 |
self allClassesDo:[:cls | |
22791 | 3208 |
(cls includesSelector:aSelector) ifTrue:[ |
3209 |
aBlock value:cls. |
|
3210 |
]. |
|
3211 |
(cls class includesSelector:aSelector) ifTrue:[ |
|
3212 |
aBlock value:cls class. |
|
3213 |
]. |
|
19681 | 3214 |
]. |
3215 |
||
3216 |
" |
|
3217 |
Smalltalk allImplementorsOf:#isNil do:[:cls | Transcript showCR:cls] |
|
3218 |
Smalltalk allImplementorsOf:#add: do:[:cls | Transcript showCR:cls] |
|
3219 |
" |
|
3220 |
||
3221 |
"Created: / 30-04-2016 / 17:36:45 / cg" |
|
9227 | 3222 |
! |
3223 |
||
19475 | 3224 |
allLoadedPackageIDs |
3225 |
||
3226 |
^ self allPackageIdsIncludingUnloadedClasses: false |
|
3227 |
||
3228 |
||
3229 |
" |
|
3230 |
Smalltalk allLoadedPackageIDs |
|
3231 |
" |
|
3232 |
! |
|
3233 |
||
12376 | 3234 |
allLoadedProjectIDs |
19475 | 3235 |
<resource: #obsolete> |
3236 |
self obsoleteMethodWarning:'use allLoadedPackageIDs'. |
|
3237 |
^ self allPackageIdsIncludingUnloadedClasses: false |
|
12376 | 3238 |
|
3239 |
||
3240 |
" |
|
3241 |
Smalltalk allLoadedProjectIDs |
|
3242 |
" |
|
3243 |
! |
|
3244 |
||
19475 | 3245 |
allPackageIDs |
3246 |
||
3247 |
^ self allPackageIdsIncludingUnloadedClasses: true |
|
3248 |
||
3249 |
" |
|
3250 |
Smalltalk allPackageIDs |
|
3251 |
" |
|
3252 |
! |
|
3253 |
||
3254 |
allPackageIdsIncludingUnloadedClasses: includeUnloadedClasses |
|
3255 |
"Returns all package ids. |
|
3256 |
Excludes packages coming from unloaded classes if includeUnloadedClasses is false. |
|
3257 |
" |
|
3258 |
||
3259 |
|allProjects| |
|
3260 |
||
3261 |
allProjects := Set new. |
|
3262 |
self allClassesDo:[:eachClass | |
|
23789 | 3263 |
|cls pkg| |
3264 |
||
3265 |
eachClass isRealNameSpace ifFalse:[ |
|
3266 |
(includeUnloadedClasses or:[eachClass isLoaded]) ifTrue:[ |
|
3267 |
cls := eachClass theNonMetaclass. |
|
3268 |
cls isPrivate ifTrue:[ |
|
3269 |
cls := cls topOwningClass |
|
3270 |
]. |
|
3271 |
pkg := cls package. |
|
3272 |
pkg size ~~ 0 ifTrue:[ |
|
3273 |
allProjects add:pkg. |
|
3274 |
] ifFalse:[ |
|
3275 |
"/ for now, nameSpaces are not in any package; |
|
3276 |
"/ this might change. Then, 0-sized packages are |
|
3277 |
"/ illegal, and the following should be enabled. |
|
3278 |
"/ self halt |
|
3279 |
]. |
|
3280 |
cls isJavaClass ifFalse:[ |
|
3281 |
cls instAndClassSelectorsAndMethodsDo:[:sel :mthd | |
|
3282 |
allProjects add:mthd package asSymbol. |
|
3283 |
]. |
|
3284 |
]. |
|
3285 |
]. |
|
3286 |
]. |
|
19475 | 3287 |
]. |
3288 |
allProjects := allProjects asOrderedCollection sort. |
|
3289 |
^ allProjects |
|
3290 |
||
3291 |
" |
|
3292 |
Smalltalk allProjectsIdsIncludingUnloadedClasses: true |
|
3293 |
Smalltalk allProjectsIdsIncludingUnloadedClasses: false |
|
3294 |
" |
|
23789 | 3295 |
|
3296 |
"Modified: / 01-03-2019 / 16:11:49 / Claus Gittinger" |
|
19475 | 3297 |
! |
3298 |
||
9254 | 3299 |
allProjectIDs |
19475 | 3300 |
<resource: #obsolete> |
3301 |
self obsoleteMethodWarning:'use allPackageIDs'. |
|
3302 |
^ self allPackageIDs |
|
12376 | 3303 |
|
3304 |
" |
|
3305 |
Smalltalk allProjectIDs |
|
3306 |
" |
|
3307 |
! |
|
3308 |
||
3309 |
allProjectsIdsIncludingUnloadedClasses: includeUnloadedClasses |
|
19475 | 3310 |
<resource: #obsolete> |
12376 | 3311 |
"Returns all projects ids. |
3312 |
Excludes projects coming from unloaded classes if includeUnloadedClasses is false. |
|
3313 |
" |
|
3314 |
||
19475 | 3315 |
self obsoleteMethodWarning:'use allPackageIdsIncludingUnloadedClasses:'. |
3316 |
^ self allPackageIdsIncludingUnloadedClasses: includeUnloadedClasses |
|
9254 | 3317 |
|
3318 |
" |
|
12376 | 3319 |
Smalltalk allProjectsIdsIncludingUnloadedClasses: true |
3320 |
Smalltalk allProjectsIdsIncludingUnloadedClasses: false |
|
9254 | 3321 |
" |
3322 |
! |
|
3323 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3324 |
cellAt:aName |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3325 |
"{ Pragma: +optSpace }" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3326 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3327 |
"return the address of a global cell |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3328 |
- used internally for compiler only" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3329 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3330 |
%{ /* NOCONTEXT */ |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3331 |
RETURN ( __GLOBAL_GETCELL(aName) ); |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3332 |
%}. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3333 |
^ self primitiveFailed |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3334 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3335 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3336 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3337 |
classCategoryCompletion:aPartialCategory |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3338 |
"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
|
3339 |
2 entries: 1st: the best (longest) match |
18668 | 3340 |
2nd: collection consisting of matching categories" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3341 |
|
9508 | 3342 |
^ DoWhatIMeanSupport classCategoryCompletion:aPartialCategory inEnvironment:self |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3343 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3344 |
" |
10071 | 3345 |
Smalltalk classCategoryCompletion:'Sys' |
3346 |
Smalltalk classCategoryCompletion:'System' |
|
3347 |
Smalltalk classCategoryCompletion:'System-BinaryStorage' |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3348 |
" |
9508 | 3349 |
|
3350 |
"Modified: / 10-08-2006 / 13:06:34 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3351 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3352 |
|
8570 | 3353 |
classNamed:aString |
3354 |
"return the class with name aString, or nil if absent. |
|
3355 |
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
|
3356 |
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
|
3357 |
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
|
3358 |
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
|
3359 |
|
10127 | 3360 |
|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
|
3361 |
|
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3362 |
"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
|
3363 |
But be careful, to not invent new symbols ..." |
453 | 3364 |
sym := aString asSymbolIfInterned. |
22650 | 3365 |
sym isSymbol ifTrue:[ |
22791 | 3366 |
cls := self at:sym ifAbsent:nil. |
3367 |
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
|
3368 |
]. |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3369 |
|
1480
df0bea6285f8
Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
3370 |
(aString endsWith:' class') ifTrue:[ |
22791 | 3371 |
nonMeta := self classNamed:(aString copyButLast:6). |
3372 |
nonMeta notNil ifTrue:[ |
|
3373 |
^ nonMeta theMetaclass |
|
3374 |
]. |
|
3375 |
^ nil. |
|
13602
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3376 |
]. |
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3377 |
|
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3378 |
"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
|
3379 |
cls isNil ifTrue:[ |
22791 | 3380 |
idx := aString indexOfSubCollection:'::'. |
3381 |
idx ~~ 0 ifTrue:[ |
|
3382 |
prefix := aString copyTo:idx-1. |
|
3383 |
nsNameSymbol := prefix asSymbolIfInterned. |
|
3384 |
nsNameSymbol notNil ifTrue:[ |
|
3385 |
rest := aString copyFrom:idx+2. |
|
3386 |
namespace := self at:prefix asSymbolIfInterned ifAbsent:nil. |
|
3387 |
"namespace may be the owner of a private class. |
|
3388 |
NameSpaces and Behaviors have the same protocol" |
|
3389 |
[namespace isBehavior] whileTrue:[ |
|
3390 |
idx := rest indexOfSubCollection:'::'. |
|
3391 |
idx ~~ 0 ifTrue:[ |
|
3392 |
prefix := rest copyTo:idx-1. |
|
3393 |
rest := rest copyFrom:idx+2. |
|
3394 |
"this does an implicit autoload if required" |
|
3395 |
namespace := namespace privateClassesAt:prefix. |
|
3396 |
] ifFalse:[ |
|
3397 |
namespace isLoaded ifTrue:[ |
|
3398 |
cls := namespace privateClassesAt:rest. |
|
3399 |
cls isBehavior ifTrue:[^ cls]. |
|
3400 |
]. |
|
3401 |
namespace := nil. "force exit of loop" |
|
3402 |
]. |
|
3403 |
]. |
|
3404 |
]. |
|
3405 |
]. |
|
9374
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3406 |
]. |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3407 |
|
453 | 3408 |
^ nil |
3409 |
||
3410 |
" |
|
10071 | 3411 |
Smalltalk classNamed:'Object' |
3412 |
Smalltalk classNamed:'Authentication::BasicAuthenticator::BasicAuthenticationData' |
|
3413 |
Smalltalk classNamed:'Authentication::BasicAuthenticator::BasicAuthenticationData class' |
|
3414 |
Smalltalk classNamed:'Authentication::BasicAuthenticator' |
|
3415 |
Smalltalk classNamed:'fooBar' |
|
3416 |
Smalltalk classNamed:'true' |
|
3417 |
Smalltalk classNamed:'Object class' |
|
3418 |
Smalltalk classNamed:'Metaclass' |
|
3419 |
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
|
3420 |
Smalltalk classNamed:'Array class' |
453 | 3421 |
" |
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
3422 |
|
9468 | 3423 |
"Created: / 24-11-1995 / 17:30:22 / cg" |
3424 |
"Modified: / 19-06-1996 / 14:22:21 / stefan" |
|
10127 | 3425 |
"Modified: / 23-10-2006 / 18:06:53 / cg" |
13602
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3426 |
"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
|
3427 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3428 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3429 |
classNames |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3430 |
"return a collection of all classNames in the system" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3431 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3432 |
^ self allClasses collect:[:aClass | aClass name] |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3433 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3434 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3435 |
Smalltalk classNames |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3436 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3437 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3438 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3439 |
classnameCompletion:aPartialClassName |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3440 |
"given a partial classname, return an array consisting of |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3441 |
2 entries: 1st: the best (longest) match |
18668 | 3442 |
2nd: collection consisting of matching names" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3443 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3444 |
^ DoWhatIMeanSupport classnameCompletion:aPartialClassName inEnvironment:self |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3445 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3446 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3447 |
classnameCompletion:aPartialClassName inEnvironment:anEnvironment |
7563 | 3448 |
"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
|
3449 |
2 entries: 1st: the best (longest) match |
18668 | 3450 |
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
|
3451 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3452 |
^ DoWhatIMeanSupport classnameCompletion:aPartialClassName inEnvironment:anEnvironment |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3453 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3454 |
" |
10071 | 3455 |
Smalltalk classnameCompletion:'Arr' |
3456 |
Smalltalk classnameCompletion:'Arra' |
|
3457 |
Smalltalk classnameCompletion:'arra' |
|
3458 |
Smalltalk classnameCompletion:'*rray' |
|
3459 |
||
3460 |
Smalltalk classnameCompletion:'Arr cl' |
|
3461 |
Smalltalk classnameCompletion:'*rray cl' |
|
453 | 3462 |
" |
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
3463 |
|
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
3464 |
"Created: 24.11.1995 / 17:24:45 / cg" |
2523
04db1fd74e0d
try ignoring case in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
2514
diff
changeset
|
3465 |
"Modified: 3.4.1997 / 18:25:01 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3466 |
! |
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 |
defaultNameSpace |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3469 |
"return the default namespace, where new classes are installed, |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3470 |
if NO special nameSpace handler is present" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3471 |
|
9562
7d36dbb02bb3
code cleanup - remove old obsolete Project code
Claus Gittinger <cg@exept.de>
parents:
9550
diff
changeset
|
3472 |
^ Project defaultNameSpace. |
7d36dbb02bb3
code cleanup - remove old obsolete Project code
Claus Gittinger <cg@exept.de>
parents:
9550
diff
changeset
|
3473 |
|
7d36dbb02bb3
code cleanup - remove old obsolete Project code
Claus Gittinger <cg@exept.de>
parents:
9550
diff
changeset
|
3474 |
"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
|
3475 |
"Modified: / 17-08-2006 / 14:01:22 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3476 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3477 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3478 |
globalNameCompletion:aPartialGlobalName |
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3479 |
"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
|
3480 |
2 entries: 1st: the best (longest) match |
18668 | 3481 |
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
|
3482 |
|
12614
b8fca618dcb6
changed: #globalNameCompletion:
Claus Gittinger <cg@exept.de>
parents:
12613
diff
changeset
|
3483 |
^ 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
|
3484 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3485 |
" |
10071 | 3486 |
Smalltalk globalnameCompletion:'Arr' |
3487 |
Smalltalk globalnameCompletion:'Arra' |
|
3488 |
Smalltalk globalnameCompletion:'arra' |
|
3489 |
Smalltalk globalnameCompletion:'*rray' |
|
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3490 |
" |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3491 |
|
9508 | 3492 |
"Created: / 24-11-1995 / 17:24:45 / cg" |
3493 |
"Modified: / 10-08-2006 / 13:05:39 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3494 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3495 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3496 |
globalnameCompletion:aPartialGlobalName |
7563 | 3497 |
"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
|
3498 |
2 entries: 1st: the best (longest) match |
18668 | 3499 |
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
|
3500 |
|
8358 | 3501 |
<resource:#obsolete> |
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3502 |
self obsoleteMethodWarning:'use #globalNameCompletion:'. |
9508 | 3503 |
^ 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
|
3504 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3505 |
" |
10071 | 3506 |
Smalltalk globalnameCompletion:'Arr' |
3507 |
Smalltalk globalnameCompletion:'Arra' |
|
3508 |
Smalltalk globalnameCompletion:'arra' |
|
3509 |
Smalltalk globalnameCompletion:'*rray' |
|
5736 | 3510 |
" |
3511 |
||
9508 | 3512 |
"Created: / 24-11-1995 / 17:24:45 / cg" |
3513 |
"Modified: / 10-08-2006 / 13:05:48 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3514 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3515 |
|
13771 | 3516 |
hasClassNamed:aString |
3517 |
Symbol |
|
18668 | 3518 |
hasInterned:aString |
3519 |
ifTrue:[:aSymbol | ^ (self at:aSymbol ifAbsent:[ nil ]) isClass ]. |
|
13602
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3520 |
^ false |
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3521 |
|
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3522 |
"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
|
3523 |
"Modified: / 20-08-2011 / 16:41:31 / cg" |
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3524 |
! |
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3525 |
|
9290 | 3526 |
hasNameSpaces |
3527 |
"can be redefined by dummy namespaces/environments, to suppress |
|
3528 |
the namespace display in a browser (PocketSmalltalk)" |
|
3529 |
||
3530 |
^ true |
|
3531 |
! |
|
3532 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3533 |
hasNamespaces |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3534 |
"can be redefined by dummy namespaces/environments, to suppress |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3535 |
the namespace display in a browser (PocketSmalltalk)" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3536 |
|
9290 | 3537 |
<resource:#obsolete> |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3538 |
^ true |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3539 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3540 |
|
10432
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3541 |
hasSelectorNameSpaces |
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3542 |
"for now return false |
10999 | 3543 |
Selector namespaces are being implemented and supported by the VM, |
10432
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3544 |
but not yet fully supported by all tools... |
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3545 |
Therefore, for now, do not generate code which uses this feature." |
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3546 |
|
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3547 |
^ false |
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3548 |
|
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3549 |
"Created: / 05-03-2007 / 13:26:28 / cg" |
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3550 |
! |
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3551 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3552 |
includes:something |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3553 |
"this should come from Collection. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3554 |
will change the inheritance - Smalltalk is actually a collection" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3555 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3556 |
self do:[:element | element = something ifTrue:[^ true]]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3557 |
^ false |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3558 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3559 |
|
14987 | 3560 |
includesIdentical:something |
3561 |
"this should come from Collection. |
|
3562 |
will change the inheritance - Smalltalk is actually a collection" |
|
3563 |
||
3564 |
self do:[:element | element == something ifTrue:[^ true]]. |
|
3565 |
^ false |
|
3566 |
! |
|
3567 |
||
10041
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
3568 |
isBrowserStartable |
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
3569 |
^ false. |
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
3570 |
|
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
3571 |
"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
|
3572 |
! |
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
3573 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3574 |
isNameSpace |
9227 | 3575 |
"return true, if the receiver is a nameSpace." |
3576 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3577 |
^ true |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3578 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3579 |
"Created: 11.10.1996 / 18:10:43 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3580 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3581 |
|
10169 | 3582 |
isRealNameSpace |
3583 |
"return true, if the receiver is a nameSpace, but not Smalltalk (which is also a class)." |
|
3584 |
||
3585 |
^ false |
|
3586 |
||
3587 |
"Created: / 10-11-2006 / 17:02:19 / cg" |
|
3588 |
! |
|
3589 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3590 |
isTopLevelNameSpace |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3591 |
^ true |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3592 |
! |
7563 | 3593 |
|
3594 |
isTopLevelNamespace |
|
3595 |
"obsolete - use isTopLevelNameSpace" |
|
5365 | 3596 |
|
7432 | 3597 |
<resource:#obsolete> |
3598 |
||
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3599 |
self obsoleteMethodWarning:'use #isTopLevelNameSpace'. |
4458 | 3600 |
^ true |
3601 |
||
3602 |
"Created: 11.10.1996 / 18:10:43 / cg" |
|
3603 |
! |
|
3604 |
||
9081 | 3605 |
keyIsClassVariableNameKey:aKey |
3606 |
|i| |
|
3607 |
||
3608 |
i := aKey lastIndexOf:$:. |
|
3609 |
i ~~ 0 ifTrue:[ |
|
18668 | 3610 |
i > 1 ifTrue:[ |
3611 |
(aKey at:(i-1)) == $: ifFalse:[ |
|
3612 |
^ true. |
|
3613 |
]. |
|
3614 |
]. |
|
9081 | 3615 |
]. |
3616 |
^ false. |
|
3617 |
||
3618 |
" |
|
10071 | 3619 |
self keyIsClassVariableNameKey:'foo::bar' |
3620 |
self keyIsClassVariableNameKey:'foo:bar' |
|
3621 |
self keyIsClassVariableNameKey:':bar' |
|
3622 |
self keyIsClassVariableNameKey:'::bar' |
|
9081 | 3623 |
" |
3624 |
! |
|
3625 |
||
9374
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3626 |
loadedClassNamed:aString |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3627 |
"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
|
3628 |
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
|
3629 |
|
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3630 |
|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
|
3631 |
|
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3632 |
"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
|
3633 |
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
|
3634 |
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
|
3635 |
sym notNil ifTrue:[ |
18668 | 3636 |
cls := self at:sym ifAbsent:nil. |
3637 |
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
|
3638 |
]. |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3639 |
|
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3640 |
(aString endsWith:' class') ifTrue:[ |
18668 | 3641 |
nonMeta := self loadedClassNamed:(aString copyButLast:6). |
3642 |
nonMeta notNil ifTrue:[ |
|
3643 |
^ nonMeta theMetaclass |
|
3644 |
]. |
|
9374
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3645 |
]. |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3646 |
^ nil |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3647 |
|
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3648 |
" |
10071 | 3649 |
Smalltalk loadedClassNamed:'Object' |
3650 |
Smalltalk loadedClassNamed:'Authentication::BasicAuthenticator::BasicAuthenticationData' |
|
3651 |
Smalltalk loadedClassNamed:'Authentication::BasicAuthenticator::BasicAuthenticationData class' |
|
3652 |
Smalltalk loadedClassNamed:'Authentication::BasicAuthenticator' |
|
3653 |
Smalltalk loadedClassNamed:'fooBar' |
|
3654 |
Smalltalk loadedClassNamed:'true' |
|
3655 |
Smalltalk loadedClassNamed:'Object class' |
|
3656 |
Smalltalk loadedClassNamed:'Metaclass' |
|
3657 |
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
|
3658 |
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
|
3659 |
" |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3660 |
! |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3661 |
|
7563 | 3662 |
methodProtocolCompletion:aPartialProtocolName |
3663 |
"given a partial method protocol name, return an array consisting of |
|
10071 | 3664 |
2 entries: 1st: the best (longest) match |
18668 | 3665 |
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
|
3666 |
|
9508 | 3667 |
^ DoWhatIMeanSupport methodProtocolCompletion:aPartialProtocolName inEnvironment:self |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3668 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3669 |
" |
10071 | 3670 |
Smalltalk methodProtocolCompletion:'doc' |
3671 |
Smalltalk methodProtocolCompletion:'docu' |
|
3672 |
Smalltalk methodProtocolCompletion:'documenta' |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3673 |
" |
9508 | 3674 |
|
3675 |
"Modified: / 10-08-2006 / 13:05:20 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3676 |
! |
5505
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
3677 |
|
7563 | 3678 |
numberOfGlobals |
3679 |
"return the number of global variables in the system" |
|
3680 |
||
3681 |
|tally "{ Class: SmallInteger }" | |
|
617 | 3682 |
|
3683 |
tally := 0. |
|
3684 |
self do:[:obj | tally := tally + 1]. |
|
3685 |
^ tally |
|
3686 |
||
3687 |
"Smalltalk numberOfGlobals" |
|
3688 |
! |
|
3689 |
||
7563 | 3690 |
referencesAny:aCollection |
3691 |
"redefined, since the references are only kept in the VM's symbol table" |
|
3260 | 3692 |
|
3693 |
self keysAndValuesDo:[:key :val | |
|
18668 | 3694 |
aCollection do:[:anObject | |
3695 |
(key == anObject) ifTrue:[^ true]. |
|
3696 |
(val == anObject ) ifTrue:[^ true]. |
|
3697 |
] |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3698 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3699 |
^ super referencesAny:aCollection |
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 |
"Created: / 2.2.1998 / 16:01:20 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3702 |
! |
3260 | 3703 |
|
7563 | 3704 |
referencesDerivedInstanceOf:aClass |
3705 |
"redefined, since the references are only kept in the VM's symbol table" |
|
617 | 3706 |
|
3707 |
self keysAndValuesDo:[:key :val | |
|
18668 | 3708 |
(key isKindOf:aClass) ifTrue:[^ true]. |
3709 |
(val isKindOf:aClass) ifTrue:[^ true]. |
|
617 | 3710 |
]. |
3711 |
^ super referencesDerivedInstanceOf:aClass |
|
3712 |
! |
|
3713 |
||
7563 | 3714 |
referencesInstanceOf:aClass |
3715 |
"redefined, since the references are only kept in the VM's symbol table" |
|
617 | 3716 |
|
3717 |
self keysAndValuesDo:[:key :val | |
|
18668 | 3718 |
(key isMemberOf:aClass) ifTrue:[^ true]. |
3719 |
(val isMemberOf:aClass) ifTrue:[^ true]. |
|
617 | 3720 |
]. |
3721 |
^ super referencesInstanceOf:aClass |
|
3722 |
! |
|
3723 |
||
7563 | 3724 |
referencesObject:anObject |
3725 |
"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
|
3726 |
|
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
3727 |
self keysAndValuesDo:[:key :val | |
18668 | 3728 |
(key == anObject) ifTrue:[^ true]. |
3729 |
(val == anObject ) ifTrue:[^ true]. |
|
6074
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
3730 |
]. |
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
3731 |
^ super referencesObject:anObject |
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
3732 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3733 |
"Modified: / 3.2.1998 / 14:22:46 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3734 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3735 |
|
15766 | 3736 |
resolveName:aName inClass:aClass |
7563 | 3737 |
"resolve aName as if compiled within aClass; |
3026 | 3738 |
i.e. if it has a private class with this name, return it; |
3739 |
if aName is known within the classes namespace, return that. |
|
3740 |
Otherwise, return a global with that name. |
|
3741 |
This should be used whereever Smalltalk>>at: used to be used, |
|
3742 |
to resolve a global by name." |
|
3743 |
||
15766 | 3744 |
|nameUsed sym cls ns| |
3745 |
||
3746 |
aName isNil ifTrue:[^ nil]. |
|
3747 |
aName isBehavior ifTrue:[^ aName]. "/ already resolved |
|
3748 |
nameUsed := aName. |
|
3749 |
||
3750 |
(nameUsed startsWith:'Smalltalk::') ifTrue:[ |
|
18668 | 3751 |
nameUsed := nameUsed copyFrom:12. |
3752 |
^ self at:(nameUsed asSymbol) ifAbsent:nil. |
|
15766 | 3753 |
]. |
3754 |
||
3755 |
sym := nameUsed asSymbol. |
|
3026 | 3756 |
|
3757 |
cls := aClass privateClassesAt:sym. |
|
3758 |
cls notNil ifTrue:[^ cls]. |
|
3759 |
||
3760 |
ns := aClass nameSpace. |
|
3761 |
(ns notNil and:[ns ~~ Smalltalk]) ifTrue:[ |
|
18668 | 3762 |
ns isNameSpace ifTrue:[ |
3763 |
cls := ns at:sym ifAbsent:nil. |
|
3764 |
] ifFalse:[ |
|
3765 |
cls := ns privateClassesAt:sym |
|
3766 |
]. |
|
3767 |
cls notNil ifTrue:[^ cls]. |
|
3025 | 3768 |
]. |
3026 | 3769 |
^ self at:sym ifAbsent:nil. |
4356 | 3770 |
|
3771 |
"Modified: / 9.7.1999 / 01:18:07 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3772 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3773 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3774 |
selectorCompletion:aPartialSymbolName |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3775 |
"given a partial selector, return an array consisting of |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3776 |
2 entries: 1st: the longest match |
18668 | 3777 |
2nd: collection consisting of matching implemented selectors" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3778 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3779 |
^ DoWhatIMeanSupport selectorCompletion:aPartialSymbolName inEnvironment:self |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3780 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3781 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3782 |
selectorCompletion:aPartialSymbolName inEnvironment:anEnvironment |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3783 |
"given a partial selector, return an array consisting of |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3784 |
2 entries: 1st: the longest match |
18668 | 3785 |
2nd: collection consisting of matching implemented selectors" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3786 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3787 |
^ DoWhatIMeanSupport selectorCompletion:aPartialSymbolName inEnvironment:anEnvironment |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3788 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3789 |
" |
10071 | 3790 |
Smalltalk selectorCompletion:'at:p' |
3791 |
Smalltalk selectorCompletion:'nextP' |
|
3792 |
Smalltalk selectorCompletion:'nextp' |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3793 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3794 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3795 |
"Modified: / 7.6.1996 / 08:44:33 / stefan" |
3565
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
3796 |
"Modified: / 14.6.1998 / 15:54:03 / cg" |
19681 | 3797 |
! |
3798 |
||
3799 |
someImplementorOf:aSelector |
|
3800 |
"return any class, which implement the given selector. Nil if there is none. |
|
3801 |
(useful to search, if there is one at all)" |
|
3802 |
||
3803 |
self allImplementorsOf:aSelector do:[:cls | ^ cls]. |
|
3804 |
^ nil. |
|
3805 |
||
3806 |
" |
|
3807 |
Smalltalk someImplementorOf:#isNil |
|
3808 |
Smalltalk someImplementorOf:#add: |
|
3809 |
" |
|
3810 |
||
3811 |
"Created: / 30-04-2016 / 17:39:19 / cg" |
|
453 | 3812 |
! ! |
3813 |
||
4431 | 3814 |
!Smalltalk class methodsFor:'queries-system'! |
3815 |
||
15958 | 3816 |
isAmber |
15980 | 3817 |
"is this an Amber Smalltalk system ? |
3818 |
Return false here - this may be useful to write portable |
|
15958 | 3819 |
applications - add #isAmber to your Amber Smalltalk, |
3820 |
returning true there." |
|
3821 |
||
3822 |
^ false |
|
3823 |
||
3824 |
"Created: / 18-12-2013 / 15:43:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3825 |
! |
|
3826 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3827 |
isDolphinSmalltalk |
16803 | 3828 |
"is this a Dolphin Smalltalk system ? |
15980 | 3829 |
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
|
3830 |
applications - add #isDolphinSmalltalk to your dolphin, |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3831 |
returning true there." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3832 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3833 |
^ false |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3834 |
! |
4970 | 3835 |
|
15958 | 3836 |
isGemStone |
15980 | 3837 |
"is this a GemStone Smalltalk system ? |
3838 |
Return false here - this may be useful to write portable |
|
15958 | 3839 |
applications - add #isGemStone to your GemStone/S, |
3840 |
returning true there." |
|
3841 |
||
3842 |
^ false |
|
3843 |
||
3844 |
"Created: / 18-12-2013 / 15:43:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3845 |
! |
|
3846 |
||
3847 |
isPharo |
|
15980 | 3848 |
"is this a Pharo Smalltalk system ? |
3849 |
Return false here - this may be useful to write portable |
|
15958 | 3850 |
applications - add #isPharo to your Pharo, |
3851 |
returning true there." |
|
3852 |
||
3853 |
^ false |
|
3854 |
||
3855 |
"Created: / 18-12-2013 / 15:42:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3856 |
! |
|
3857 |
||
7563 | 3858 |
isSmalltalkMT |
15980 | 3859 |
"is this a Smalltalk-MT system ? |
3860 |
Return false here - this may be useful to write portable |
|
7563 | 3861 |
applications - add #isSmalltalkMT to your smalltalk-MT, |
4970 | 3862 |
returning true there." |
3863 |
||
3864 |
^ false |
|
3865 |
! |
|
3866 |
||
7563 | 3867 |
isSmalltalkV |
15980 | 3868 |
"is this a Smalltalk/V system ? |
3869 |
Return false here - this may be useful to write portable |
|
7563 | 3870 |
applications - add #isSmalltalkV to your smalltalkV, |
4431 | 3871 |
returning true there." |
3872 |
||
3873 |
^ false |
|
3874 |
! |
|
3875 |
||
7563 | 3876 |
isSmalltalkX |
16803 | 3877 |
"is this a Smalltalk/X system ? |
15980 | 3878 |
Return true here - this may be useful to write portable |
22799 | 3879 |
applications. |
3880 |
Add #isSmalltalkX to your other smalltalks, returning false there. |
|
3881 |
Notice: the ST/X compilers know about this, and inline the code |
|
3882 |
(not generating code for the false branch). |
|
3883 |
So in ST/X, this check costs you absolutely nothing." |
|
4431 | 3884 |
|
3885 |
^ true |
|
3886 |
! |
|
3887 |
||
7563 | 3888 |
isSqueak |
15980 | 3889 |
"is this a SqueakSmalltalk system ? |
3890 |
Return false here - this may be useful to write portable |
|
7563 | 3891 |
applications - add #isSqueak to your squeak, |
4431 | 3892 |
returning true there." |
3893 |
||
3894 |
^ false |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3895 |
! |
4431 | 3896 |
|
16013 | 3897 |
isSqueakLike |
3898 |
"is this a Squeak, Pharo, Cuis or similar Smalltalk system ? |
|
3899 |
Return false here - this may be useful to write portable |
|
3900 |
applications - add #isSqueakLike to your squeak, pharo,... |
|
3901 |
returning true there." |
|
3902 |
||
3903 |
^ false |
|
3904 |
! |
|
3905 |
||
7563 | 3906 |
isVisualAge |
15980 | 3907 |
"is this a VisualAge Smalltalk system ? |
3908 |
Return false here - this may be useful to write portable |
|
7563 | 3909 |
applications - add #isVisualAge to your visualAge, |
4431 | 3910 |
returning true there." |
3911 |
||
3912 |
^ false |
|
3913 |
! |
|
3914 |
||
17369 | 3915 |
isVisualSmalltalkEnterprise |
16843 | 3916 |
"is this a VSE Smalltalk system ? |
3917 |
Return false here - this may be useful to write portable |
|
3918 |
applications - add #isVisualSmallalkEnterprise to your VSE, |
|
3919 |
returning true there." |
|
3920 |
||
3921 |
^ false |
|
3922 |
! |
|
3923 |
||
7563 | 3924 |
isVisualWorks |
15980 | 3925 |
"is this a VisualWorks Smalltalk system ? |
3926 |
Return false here - this may be useful to write portable |
|
7563 | 3927 |
applications - add #isVisualWorks to your visualWorks, |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3928 |
returning true there." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3929 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3930 |
^ false |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3931 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3932 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3933 |
!Smalltalk class methodsFor:'startup'! |
1 | 3934 |
|
9032 | 3935 |
browserWindowStartup |
13056
1fa92a4cd9cc
comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
3936 |
"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
|
3937 |
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
|
3938 |
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
|
3939 |
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
|
3940 |
multiwindow application. |
1fa92a4cd9cc
comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
3941 |
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
|
3942 |
|
9032 | 3943 |
|windowIDString numericWindowID windowID params idx process| |
3944 |
||
3945 |
idx := CommandLineArguments indexOf:'--browserWindow:'. |
|
3946 |
windowIDString := CommandLineArguments at:idx+1. |
|
3947 |
numericWindowID := Integer fromString:windowIDString. |
|
3948 |
windowID := ExternalAddress newAddress:numericWindowID. |
|
3949 |
||
3950 |
idx := CommandLineArguments indexOf:'--browserParameters:'. |
|
3951 |
idx ~~ 0 ifTrue:[ |
|
18668 | 3952 |
params := Dictionary new. |
3953 |
(CommandLineArguments copyFrom:idx+1) pairWiseDo:[:key :value | |
|
3954 |
params at:key put:value. |
|
3955 |
]. |
|
9032 | 3956 |
]. |
3957 |
||
3958 |
'browserWindow is: ' errorPrint. windowID errorPrintCR. |
|
3959 |
'browserParameters are: ' errorPrint. params errorPrintCR. |
|
3960 |
'Display is: ' errorPrint. Display errorPrintCR. |
|
3961 |
||
3962 |
process := [ |
|
18668 | 3963 |
PluginSupport |
3964 |
startInBrowserWithWindowID:windowID |
|
3965 |
parameters:params. |
|
9032 | 3966 |
] newProcess. |
9043
e6106f500263
do not use numeric process prios
Claus Gittinger <cg@exept.de>
parents:
9036
diff
changeset
|
3967 |
process priority:(Processor userSchedulingPriority). |
9032 | 3968 |
process name:'browser start handler'. |
3969 |
process beGroupLeader. |
|
3970 |
process resume. |
|
3971 |
process := nil. |
|
3972 |
||
3973 |
Processor dispatchLoop. |
|
3974 |
Smalltalk exit. |
|
13056
1fa92a4cd9cc
comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
3975 |
|
1fa92a4cd9cc
comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
3976 |
"Modified: / 11-09-2010 / 14:06:59 / cg" |
9032 | 3977 |
! |
3978 |
||
20856 | 3979 |
defineCommandLineAsWorkspaceVariablesForScripts |
3980 |
"/ enable this, so we can provide _$1.._$n in the script |
|
20858 | 3981 |
ParserFlags allowUnderscoreInIdentifier:true. |
20856 | 3982 |
ParserFlags allowDollarInIdentifier:true. |
3983 |
ParserFlags warnDollarInIdentifier:false. |
|
20858 | 3984 |
ParserFlags warnUnderscoreInIdentifier:false. |
20859 | 3985 |
ParserFlags allowOldStyleAssignment:false. |
22791 | 3986 |
|
20856 | 3987 |
"/ add bindings for arguments |
3988 |
Workspace workspaceVariableAt:('_$0') put:CommandName. |
|
20857 | 3989 |
Workspace workspaceVariableAt:('_$n') put:CommandLineArguments size. |
20860 | 3990 |
Workspace workspaceVariableAt:('_$$') put:CommandLineArguments. |
20856 | 3991 |
CommandLineArguments doWithIndex:[:arg :i | |
22791 | 3992 |
Workspace workspaceVariableAt:('_$',i printString) put:arg. |
20856 | 3993 |
]. |
3994 |
! |
|
3995 |
||
7563 | 3996 |
displayInitializationDone |
3997 |
"inform the restart, that the display has been initialized" |
|
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3998 |
|
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3999 |
CallbackSignal raiseRequest. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
4000 |
! |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
4001 |
|
13893 | 4002 |
executeStartBlocks |
4003 |
|startBlocks| |
|
4004 |
||
4005 |
startBlocks := self startBlocks. |
|
4006 |
startBlocks notNil ifTrue:[ |
|
18668 | 4007 |
'Smalltalk [info]: execute startBlocks...' infoPrintCR. |
4008 |
startBlocks do:[:aBlock| |
|
4009 |
Error handle:[:ex | |
|
4010 |
InfoPrinting == true ifTrue:[ |
|
4011 |
'Smalltalk [warning]: error caught in startBlock: ' infoPrint. |
|
4012 |
ex description infoPrintCR. |
|
4013 |
ex infoPrintCR. |
|
4014 |
thisContext fullPrintAll. |
|
4015 |
]. |
|
4016 |
] do: aBlock |
|
4017 |
]. |
|
4018 |
startBlocks removeAll. |
|
13893 | 4019 |
]. |
4020 |
||
4021 |
"Created: / 07-01-2012 / 12:58:39 / cg" |
|
4022 |
! |
|
4023 |
||
11375 | 4024 |
hideSplashWindow |
4025 |
%{ |
|
4026 |
#ifdef WIN32 |
|
4027 |
extern void __win32_hideSplashScreen(); |
|
4028 |
||
4029 |
__win32_hideSplashScreen(); |
|
4030 |
#endif |
|
4031 |
%} |
|
4032 |
! |
|
4033 |
||
20720 | 4034 |
lateOpenDisplay |
20737 | 4035 |
"this is called when a view is opened without a display being already opened." |
22791 | 4036 |
|
22636 | 4037 |
|display| |
4038 |
||
4039 |
display := Smalltalk openDisplay. |
|
22791 | 4040 |
display notNil ifTrue:[ |
4041 |
IsRepl ifFalse:[ |
|
4042 |
display exitOnLastClose:true. |
|
4043 |
]. |
|
4044 |
"/ Processor exitWhenNoMoreUserProcesses:true. |
|
22636 | 4045 |
]. |
4046 |
^ display |
|
4047 |
||
4048 |
"Modified: / 20-03-2018 / 12:43:29 / stefan" |
|
20720 | 4049 |
! |
4050 |
||
7563 | 4051 |
mainStartup:graphicalMode |
4052 |
"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
|
4053 |
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
|
4054 |
|
9012 | 4055 |
|process imageName thisIsARestart idx| |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
4056 |
|
23628 | 4057 |
VerboseStartup ifTrue:['mainStartup...' infoPrintCR]. |
4058 |
||
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
4059 |
imageName := ObjectMemory imageName. |
2249
cdb6c87f0707
send returnFromSnapshot notification later -
Claus Gittinger <cg@exept.de>
parents:
2212
diff
changeset
|
4060 |
thisIsARestart := imageName notNil. |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
4061 |
|
19788 | 4062 |
true "graphicalMode" ifTrue:[ |
23628 | 4063 |
Display isNil ifTrue:[ |
4064 |
(StartupClass notNil |
|
4065 |
and:[ (StartupClass perform:#isHeadless ifNotUnderstood:false) ]) ifFalse:[ |
|
4066 |
self openDisplay. |
|
4067 |
]. |
|
4068 |
]. |
|
10644 | 4069 |
]. |
4070 |
||
10645 | 4071 |
StandAlone ifFalse:[ |
23628 | 4072 |
" |
4073 |
enable the graphical debugger/inspector |
|
4074 |
(they could have been (re)defined as autoloaded in the patches file) |
|
4075 |
" |
|
4076 |
VerboseStartup ifTrue:['initStandardTools...' infoPrintCR]. |
|
4077 |
self initStandardTools. |
|
10645 | 4078 |
]. |
4079 |
||
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
4080 |
" |
10071 | 4081 |
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
|
4082 |
" |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
4083 |
Display notNil ifTrue:[ |
23628 | 4084 |
Display deviceIOTimeoutErrorSignal handlerBlock:[:ex | |
4085 |
SaveEmergencyImage == true ifTrue:[ |
|
4086 |
'Display [warning]: broken display connection - emergency save in ''crash.img''.' infoPrintCR. |
|
4087 |
ObjectMemory primSnapShotOn:'crash.img'. |
|
4088 |
]. |
|
4089 |
'Display [warning]: broken display connection - exit.' infoPrintCR. |
|
4090 |
self exit:11. |
|
4091 |
]. |
|
4092 |
VerboseStartup ifTrue:['display-dispatch...' infoPrintCR]. |
|
4093 |
Display startDispatch. |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
4094 |
]. |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
4095 |
|
9016 | 4096 |
idx := CommandLineArguments indexOf:'--browserWindow:'. |
9029 | 4097 |
IsPlugin := (idx ~~ 0). |
4098 |
IsPlugin ifTrue:[ |
|
23628 | 4099 |
'Smalltalk [info]: startup browser window...' infoPrintCR. |
4100 |
self browserWindowStartup. |
|
4101 |
"/ not reached |
|
9012 | 4102 |
]. |
4103 |
||
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
4104 |
Initializing := false. |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
4105 |
|
2074
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
4106 |
"/ 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
|
4107 |
"/ 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
|
4108 |
"/ 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
|
4109 |
"/ 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
|
4110 |
|
7043
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
4111 |
process := [ |
23628 | 4112 |
VerboseStartup ifTrue:[ 'Smalltalk [info]: startup process 1 active.' infoPrintCR]. |
4113 |
StartBlocks notNil ifTrue:[ |
|
4114 |
self executeStartBlocks. |
|
4115 |
StartBlocks := nil. |
|
4116 |
]. |
|
4117 |
ImageStartBlocks notNil ifTrue:[ |
|
4118 |
VerboseStartup ifTrue:[ 'Smalltalk [info]: execute imageStartBlocks...' infoPrintCR]. |
|
4119 |
ImageStartBlocks do:[:aBlock| |
|
4120 |
VerboseStartup ifTrue:[ ('Smalltalk [info]: startBlock: %1...' bindWith:aBlock) infoPrintCR]. |
|
4121 |
aBlock value |
|
4122 |
]. |
|
4123 |
]. |
|
4124 |
StandAlone ifFalse:[ |
|
4125 |
(SilentLoading == true) ifFalse:[ "i.e. undefined counts as false" |
|
4126 |
thisIsARestart ifTrue:[ |
|
4127 |
Transcript cr. |
|
4128 |
Transcript showCR:('Smalltalk restarted from:' |
|
4129 |
, imageName |
|
4130 |
, ' (saved ' |
|
4131 |
, ObjectMemory imageSaveTime printString |
|
4132 |
, ')' ). |
|
4133 |
] ifFalse:[ |
|
4134 |
Transcript showCR:(self hello). |
|
4135 |
Transcript showCR:(self copyrightString). |
|
4136 |
]. |
|
4137 |
Transcript cr. |
|
4138 |
]. |
|
4139 |
||
4140 |
DemoMode==true ifTrue:[ |
|
4141 |
Transcript showCR:'*** Restricted use: ***'. |
|
4142 |
Transcript showCR:'*** This program may be used for education only. ***'. |
|
4143 |
Transcript showCR:'*** Please read the files COPYRIGHT and LICENSE ***'. |
|
4144 |
Transcript showCR:'*** for more details. ***'. |
|
4145 |
Transcript cr. |
|
4146 |
]. |
|
4147 |
]. |
|
4148 |
||
4149 |
thisIsARestart ifTrue:[ |
|
4150 |
"/ |
|
4151 |
"/ the final late notification - users can now assume that |
|
4152 |
"/ views, forms etc. have been recreated. |
|
4153 |
||
4154 |
ObjectMemory changed:#returnFromSnapshot. |
|
4155 |
] |
|
7039
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
4156 |
|
7040 | 4157 |
] newProcess. |
4158 |
||
9043
e6106f500263
do not use numeric process prios
Claus Gittinger <cg@exept.de>
parents:
9036
diff
changeset
|
4159 |
process priority:(Processor userSchedulingPriority). |
7043
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
4160 |
process name:'start block handler'. |
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
4161 |
process beGroupLeader. |
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
4162 |
process resume. |
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
4163 |
process := nil. |
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
4164 |
|
10139
a3f6265978ad
Start bachgroundCollector and -Finalizer in mainStartup
Stefan Vogel <sv@exept.de>
parents:
10131
diff
changeset
|
4165 |
ObjectMemory startBackgroundCollectorAt:5. |
a3f6265978ad
Start bachgroundCollector and -Finalizer in mainStartup
Stefan Vogel <sv@exept.de>
parents:
10131
diff
changeset
|
4166 |
ObjectMemory startBackgroundFinalizationAt:5. |
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
4167 |
|
2074
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
4168 |
"/ 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
|
4169 |
"/ message. |
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
4170 |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
4171 |
(StartupClass notNil and:[StartupSelector notNil]) ifTrue:[ |
23628 | 4172 |
" |
4173 |
allow more customization by reading an image specific rc-file |
|
4174 |
" |
|
4175 |
thisIsARestart ifTrue:[ |
|
4176 |
(imageName asFilename hasSuffix:'img') ifTrue:[ |
|
4177 |
imageName := imageName copyButLast:4 |
|
4178 |
]. |
|
4179 |
self fileIn:(imageName , '.rc') |
|
4180 |
]. |
|
4181 |
||
4182 |
Display notNil ifTrue:[ |
|
4183 |
Display exitOnLastClose:true. |
|
4184 |
]. |
|
4185 |
Processor exitWhenNoMoreUserProcesses:true. |
|
4186 |
||
4187 |
process := [ |
|
4188 |
'Smalltalk [info]: startup process 2 active.' infoPrintCR. |
|
4189 |
StandAlone ifTrue:[ |
|
4190 |
AbortOperationRequest handle:[:ex | |
|
4191 |
'Smalltalk [info]: aborted - exit.' infoPrintCR. |
|
4192 |
OperatingSystem exit:1 |
|
4193 |
] do:[ |
|
4194 |
('Smalltalk [info]: call ',StartupSelector,' of ',StartupClass name,' (1)') infoPrintCR. |
|
4195 |
StartupClass perform:StartupSelector withArguments:StartupArguments. |
|
4196 |
] |
|
4197 |
] ifFalse:[ |
|
4198 |
('Smalltalk [info]: call ',StartupSelector,' of ',StartupClass name,' (2)') infoPrintCR. |
|
4199 |
StartupClass perform:StartupSelector withArguments:StartupArguments. |
|
4200 |
]. |
|
4201 |
||
4202 |
"/ |
|
4203 |
"/ non-GUI apps exit after the startup; |
|
4204 |
"/ assume that GUI apps have created & opened some view ... |
|
4205 |
"/ |
|
4206 |
Display isNil ifTrue:[ |
|
24136 | 4207 |
(StartupClass perform:#isHeadless ifNotUnderstood:false) ifTrue:[ |
24094 | 4208 |
Smalltalk exit:0. |
4209 |
]. |
|
23628 | 4210 |
'Smalltalk [info]: no Display - exit.' infoPrintCR. |
4211 |
Smalltalk exit:11. |
|
4212 |
]. |
|
16666 | 4213 |
"/ "/ |
4214 |
"/ "/ GUI apps exit after the last user process has finished |
|
4215 |
"/ "/ |
|
4216 |
"/ Display exitOnLastClose:true. |
|
23628 | 4217 |
Processor exitWhenNoMoreUserProcesses:true. |
4218 |
] newProcess. |
|
4219 |
process priority:(Processor userSchedulingPriority). |
|
4220 |
process name:'main'. |
|
4221 |
process beGroupLeader. |
|
4222 |
process resume. |
|
4223 |
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
|
4224 |
]. |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4225 |
|
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4226 |
StandAlone ifTrue:[ |
23628 | 4227 |
Display notNil ifTrue:[ |
4228 |
FlyByHelp notNil ifTrue:[ |
|
4229 |
FlyByHelp start |
|
4230 |
]. |
|
4231 |
]. |
|
16211 | 4232 |
]. |
4233 |
||
20746 | 4234 |
"/ Display notNil ifTrue:[ |
4235 |
"/ Display exitOnLastClose:true. |
|
4236 |
"/ ]. |
|
21592 | 4237 |
OperatingSystem finishLaunching. |
22791 | 4238 |
|
11681
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4239 |
" |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4240 |
if view-classes exist, start dispatching; |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4241 |
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
|
4242 |
" |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4243 |
((Display notNil and:[graphicalMode]) |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4244 |
or:[process notNil |
13851
5ab434e0a636
changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents:
13850
diff
changeset
|
4245 |
or:[HeadlessOperation |
20827 | 4246 |
or:[StandAlone]]] |
4247 |
) ifTrue:[ |
|
23628 | 4248 |
Processor exitWhenNoMoreUserProcesses:true. |
4249 |
Processor dispatchLoop. |
|
4250 |
"done - the last process finished" |
|
4251 |
'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
|
4252 |
] ifFalse:[ |
23628 | 4253 |
StandAlone ifFalse:[ |
4254 |
self readEvalPrintLoop |
|
4255 |
] |
|
11681
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4256 |
]. |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4257 |
|
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4258 |
self exit |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4259 |
|
13526 | 4260 |
"Created: / 18-07-1996 / 21:07:39 / cg" |
4261 |
"Modified: / 09-09-1996 / 17:42:50 / stefan" |
|
21592 | 4262 |
"Modified: / 28-02-2017 / 10:59:43 / cg" |
24136 | 4263 |
"Modified: / 23-05-2019 / 11:24:37 / Claus Gittinger" |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
4264 |
! |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
4265 |
|
10641 | 4266 |
openDisplay |
4267 |
"try to open a display connection. |
|
4268 |
If so, also read display- and keyboard.rc" |
|
4269 |
||
13385 | 4270 |
|commandName| |
4271 |
||
4272 |
commandName := Smalltalk commandName. |
|
4273 |
(commandName, ' [info]: opening display...') infoPrintCR. |
|
10649 | 4274 |
|
10641 | 4275 |
Display isNil ifTrue:[ |
22791 | 4276 |
Screen notNil ifTrue:[ |
4277 |
[ |
|
4278 |
Screen openDefaultDisplay:nil. |
|
4279 |
] on:Screen deviceOpenErrorSignal do:[:ex| |
|
4280 |
"do not use #errorPrintCR, it is no error, when an app supports display and no display. |
|
4281 |
in case shell exec 'app --version' we do not want this error string as part of the output" |
|
4282 |
('%1 [error]: No display connection to: %2' bindWith:commandName with:ex parameter) infoPrintCR. |
|
19984 | 4283 |
"/ ('%1 [error]: No display connection to: %2' bindWith:commandName with:ex parameter) errorPrintCR. |
22791 | 4284 |
(commandName, ' [info]: Either set the DISPLAY environment variable,') infoPrintCR. |
4285 |
(commandName, ' [info]: or start smalltalk with a -display argument.') infoPrintCR. |
|
4286 |
HeadlessOperation == true ifFalse:[ |
|
4287 |
OperatingSystem exit:1. |
|
4288 |
]. |
|
4289 |
]. |
|
4290 |
||
4291 |
Display notNil ifTrue:[ |
|
4292 |
(self secureFileIn:'display.rc') ifFalse:[ |
|
4293 |
"/ 'Smalltalk [warning]: no display.rc found; screen setting might be wrong.' errorPrintCR. |
|
4294 |
(self secureFileIn:'keyboard.rc') ifFalse:[ |
|
4295 |
"/ 'Smalltalk [warning]: no keyboard.rc found; shortkey setting might be wrong.' errorPrintCR. |
|
4296 |
] |
|
4297 |
] |
|
4298 |
]. |
|
4299 |
] |
|
22636 | 4300 |
]. |
4301 |
||
4302 |
^ Display |
|
10641 | 4303 |
|
4304 |
"Created: / 06-12-2006 / 15:38:17 / cg" |
|
22636 | 4305 |
"Modified: / 20-03-2018 / 12:39:55 / stefan" |
10641 | 4306 |
! |
4307 |
||
20757 | 4308 |
providingDisplayDo:aBlock |
4309 |
"/ provide a Display, if needed |
|
4310 |
(Smalltalk at:#Screen) currentScreenQuerySignal handle:[:ex | |
|
22791 | 4311 |
Display isNil ifTrue:[ self lateOpenDisplay ]. |
4312 |
ex proceedWith:Display. |
|
4313 |
] do:aBlock |
|
20757 | 4314 |
! |
4315 |
||
20832 | 4316 |
readEvalPrintLoop |
4317 |
"say hello, then go into a read-eval-print loop" |
|
22791 | 4318 |
|
10641 | 4319 |
"{ Pragma: +optSpace }" |
4320 |
||
22791 | 4321 |
|repl| |
4322 |
||
4323 |
repl := ReadEvalPrintLoop new. |
|
4324 |
||
4325 |
SilentLoading == true ifTrue:[ |
|
22792 | 4326 |
repl answerPrompt:''. |
4327 |
repl prompt:''. |
|
22791 | 4328 |
] ifFalse:[ |
22792 | 4329 |
Transcript showCR:(self hello). |
4330 |
Transcript showCR:(self copyrightString). |
|
4331 |
Transcript cr. |
|
22793 | 4332 |
Transcript showCR:'Read-eval-print loop.'. |
4333 |
Transcript showCR:'(exit with "#exit" or EOF; help with "?"; expressions are terminated with ".")'. |
|
22792 | 4334 |
repl prompt:'STX> '. |
22791 | 4335 |
]. |
4336 |
||
4337 |
repl |
|
22792 | 4338 |
doChunkFormat:false; |
22831 | 4339 |
errorStream:Stderr; |
22792 | 4340 |
readEvalPrintLoop |
10641 | 4341 |
! |
4342 |
||
4343 |
restart |
|
4344 |
"startup after an image has been loaded; |
|
18385 | 4345 |
This is called by the VM's main entry - you should not find senders from Smalltalk. |
4346 |
||
10641 | 4347 |
there are three change-notifications made to dependents of ObjectMemory, |
4348 |
which allow a stepwise re-init: #earlyRestart, #restarted and #returnFromSnapshot. |
|
4349 |
||
4350 |
#earlySystemInstallation is sent for ST80 compatibility |
|
4351 |
||
4352 |
#earlyRestart is send first, nothing has been setup yet. |
|
18668 | 4353 |
(should be used to flush all device dependent entries) |
10641 | 4354 |
|
4355 |
#restarted is send right after. |
|
18668 | 4356 |
(should be used to recreate external resources (fds, bitmaps etc) |
10641 | 4357 |
|
4358 |
#returnFromSnapshot is sent last |
|
18668 | 4359 |
(should be used to restart processes, reOpen Streams which cannot |
4360 |
be automatically be reopened (i.e. Sockets, Pipes) and so on. |
|
4361 |
(Notice that positionable fileStreams are already reopened and repositioned) |
|
10641 | 4362 |
" |
4363 |
||
4364 |
|deb insp transcript idx| |
|
4365 |
||
4366 |
"/ |
|
4367 |
"/ when we arrive here, all objects from our previous life |
|
4368 |
"/ have been reloaded - however, some may still contain invalid device |
|
4369 |
"/ handles, display information etc. |
|
4370 |
"/ also, dynamically loaded modules have not yet been reloaded yet. |
|
4371 |
"/ and the concrete OS, concrete FileName etc. are still refering to |
|
4372 |
"/ the previous classes. |
|
4373 |
||
4374 |
Initializing := true. |
|
4375 |
AbstractOperatingSystem initializeConcreteClass. |
|
4376 |
||
4377 |
ImageRestartTime := Timestamp now. |
|
4378 |
||
4379 |
CommandLine := CommandLineArguments copy. |
|
4380 |
CommandLineArguments := CommandLineArguments asOrderedCollection. |
|
4381 |
CommandName := CommandLineArguments removeFirst. "/ the command |
|
4382 |
||
4383 |
idx := CommandLineArguments indexOf:'-q'. |
|
4384 |
idx == 0 ifTrue:[ |
|
18668 | 4385 |
idx := CommandLineArguments indexOf:'--silent'. |
10641 | 4386 |
]. |
4387 |
idx ~~ 0 ifTrue:[ |
|
18668 | 4388 |
Object infoPrinting:false. |
4389 |
ObjectMemory infoPrinting:false. |
|
4390 |
CommandLineArguments removeAtIndex:idx. |
|
16269 | 4391 |
]. |
4392 |
||
10641 | 4393 |
"/ start catching SIGSEGV and SIGBUS |
4394 |
OperatingSystem enableHardSignalInterrupts. |
|
4395 |
||
4396 |
"/ reinit Filename |
|
4397 |
Filename reinitialize. |
|
4398 |
||
4399 |
"/ flush cached path directories (may have changed in the meanwhile) |
|
4400 |
self flushPathCaches. |
|
15334 | 4401 |
self reinitializePackagePath. |
10641 | 4402 |
|
4403 |
"/ reinit the default streams: Stdin, Stdout and Stderr |
|
4404 |
"/ after that, we can write to stderr. |
|
4405 |
self reinitStandardStreams. |
|
4406 |
||
4407 |
"/ redirect Transcript to Stderr during startup |
|
4408 |
transcript := Transcript. |
|
4409 |
Transcript := Stderr. |
|
4410 |
||
4411 |
"/ temporary switch back to dumb interface - |
|
4412 |
"/ to handle errors while view-stuff is not yet reinitialized |
|
4413 |
insp := Inspector. |
|
4414 |
deb := Debugger. |
|
4415 |
deb notNil ifTrue:[ |
|
18668 | 4416 |
deb reinitialize |
10641 | 4417 |
]. |
4418 |
Inspector := MiniInspector. |
|
4419 |
Debugger := MiniDebugger. |
|
4420 |
||
4421 |
"/ reload any dynamically loaded objects. |
|
4422 |
"/ this must be done before doing anything else below, |
|
4423 |
"/ because the Processor may restart processes which use |
|
4424 |
"/ this code. |
|
4425 |
"/ Also, a dynamic object might be registered as dependent of |
|
4426 |
"/ ObjectFileLoader; therefore, must reload before doing any notifications. |
|
4427 |
||
4428 |
ObjectFileLoader notNil ifTrue:[ |
|
18668 | 4429 |
ObjectFileLoader reloadAllRememberedObjectFiles. |
16269 | 4430 |
]. |
4431 |
||
10641 | 4432 |
"/ invalidate all display connections. |
4433 |
"/ This is required to avoid trouble if someone accesses |
|
4434 |
"/ a display during early startup. |
|
4435 |
Screen notNil ifTrue:[ |
|
18668 | 4436 |
Screen allScreens do:[:eachDisplay | |
4437 |
eachDisplay invalidateConnection. |
|
4438 |
]. |
|
10641 | 4439 |
]. |
4440 |
||
4441 |
ObjectMemory changed:#earlySystemInstallation. |
|
4442 |
||
4443 |
"/ reinitialize the Processor - restartable processes |
|
4444 |
"/ are now restarted here (but not yet scheduled). |
|
4445 |
Processor reinitialize. |
|
4446 |
||
4447 |
"/ flush device handles & recreate OS resources (if possible) |
|
4448 |
"/ (mostly view/GC/color & font stuff) |
|
4449 |
ObjectMemory |
|
18668 | 4450 |
changed:#earlyRestart; changed:#restarted. |
16269 | 4451 |
|
10641 | 4452 |
"/ start catching SIGINT and SIGQUIT |
4453 |
OperatingSystem enableUserInterrupts. |
|
4454 |
OperatingSystem enableCrashSignalInterrupts. |
|
12782 | 4455 |
ObjectMemory restoreGarbageCollectorSettings. |
10641 | 4456 |
|
4457 |
"/ give user a chance to re-customize things in smalltalk_r.rc. |
|
4458 |
"/ reading if smalltalk_r.rc may be suppressed by the --faststart argument. |
|
4459 |
idx := CommandLineArguments indexOf:'--faststart'. |
|
4460 |
idx == 0 ifTrue:[ |
|
18668 | 4461 |
idx := CommandLineArguments indexOf:'--fastStart'. |
10641 | 4462 |
]. |
4463 |
idx ~~ 0 ifTrue:[ |
|
18668 | 4464 |
CommandLineArguments removeAtIndex:idx. |
10641 | 4465 |
] ifFalse:[ |
18668 | 4466 |
CallbackSignal := QuerySignal new. |
4467 |
[ |
|
4468 |
Class withoutUpdatingChangesDo:[ |
|
4469 |
(self fileIn:(self commandName , '_r.rc')) ifFalse:[ |
|
4470 |
"no _r.rc file where executable is; try default smalltalk_r.rc" |
|
4471 |
self fileIn:'smalltalk_r.rc' |
|
4472 |
]. |
|
4473 |
] |
|
4474 |
] on:CallbackSignal do:[:ex| |
|
4475 |
"/ now, display and view-stuff works; |
|
4476 |
"/ back to the previous debugging interface |
|
4477 |
Inspector := insp. |
|
4478 |
Debugger := deb. |
|
4479 |
||
4480 |
"/ reinstall Transcript, if not changed during restart. |
|
4481 |
"/ if there was no Transcript, go to stderr |
|
4482 |
(transcript notNil and:[Transcript == Stderr]) ifTrue:[ |
|
4483 |
Transcript := transcript. |
|
4484 |
]. |
|
4485 |
Initializing := false. |
|
4486 |
ex proceed. |
|
4487 |
]. |
|
4488 |
CallbackSignal := nil. |
|
10641 | 4489 |
]. |
4490 |
||
4491 |
"/ reinitialization (restart) of Display is normally performed |
|
4492 |
"/ in the restart script. If this has not been run for some reason, |
|
4493 |
"/ do in now. |
|
4494 |
Initializing ifTrue:[ |
|
18668 | 4495 |
Display notNil ifTrue:[ |
4496 |
[ |
|
4497 |
Display reinitializeFor:Screen defaultDisplayName. |
|
4498 |
] on:Screen deviceOpenErrorSignal do:[ |
|
4499 |
'Smalltalk [error]: Cannot restart connection to: ' errorPrint. |
|
4500 |
Screen defaultDisplayName errorPrintCR. |
|
4501 |
OperatingSystem exit:1. |
|
4502 |
]. |
|
4503 |
]. |
|
4504 |
"/ now, display and view-stuff works; |
|
4505 |
"/ back to the previous debugging interface |
|
4506 |
||
4507 |
Inspector := insp. |
|
4508 |
Debugger := deb. |
|
4509 |
||
4510 |
"/ reinstall Transcript, if not changed during restart. |
|
4511 |
"/ if there was no Transcript, go to stderr |
|
4512 |
||
4513 |
(transcript notNil and:[Transcript == Stderr]) ifTrue:[ |
|
4514 |
Transcript := transcript. |
|
4515 |
]. |
|
4516 |
Initializing := false. |
|
10641 | 4517 |
]. |
4518 |
Screen notNil ifTrue:[ |
|
18668 | 4519 |
"clean up leftover screens (and views) that haven't been reopened. |
4520 |
Operate on a copy, since brokenConnection removes us from AllScreens" |
|
4521 |
Screen allScreens copy do:[:eachDisplay | |
|
4522 |
eachDisplay isOpen ifFalse:[ |
|
4523 |
'Smalltalk [info]: cannot reopen secondary display: ' errorPrint. |
|
4524 |
eachDisplay errorPrintCR. |
|
4525 |
eachDisplay cleanupAfterDispatch; brokenConnection. |
|
4526 |
] |
|
4527 |
]. |
|
10641 | 4528 |
]. |
4529 |
||
4530 |
deb := insp := transcript := nil. "avoid dangling refs" |
|
13526 | 4531 |
(StartupClass perform:#keepSplashWindowOpen ifNotUnderstood:[false]) ifFalse:[ |
18668 | 4532 |
self hideSplashWindow. "/ if there is one, it's now time to hide it |
13526 | 4533 |
]. |
10641 | 4534 |
self mainStartup:true |
4535 |
||
13526 | 4536 |
"Modified: / 03-08-1999 / 09:42:21 / stefan" |
4537 |
"Modified: / 29-07-2011 / 17:58:23 / cg" |
|
1 | 4538 |
! |
4539 |
||
11399 | 4540 |
showSplashMessage:aString |
4541 |
"put the message into the splash screen (if there is one). |
|
4542 |
Use this for messages during startup" |
|
4543 |
||
4544 |
self showSplashMessage:aString color:nil. |
|
4545 |
! |
|
4546 |
||
11388 | 4547 |
showSplashMessage:aMessageStringOrNil color:rgbValueOrNil |
11389 | 4548 |
"put the message into the splash screen (if there is one)." |
4549 |
||
11388 | 4550 |
%{ |
4551 |
#ifdef WIN32 |
|
4552 |
extern void __win32_splashMessage(); |
|
4553 |
char *msg = (char *)0; |
|
4554 |
int clr = 0; |
|
4555 |
||
12481
805176d238d2
change __isString() to __isStringLike() in primitive code
Stefan Vogel <sv@exept.de>
parents:
12413
diff
changeset
|
4556 |
if (__isStringLike(aMessageStringOrNil)) { |
18668 | 4557 |
msg = __stringVal(aMessageStringOrNil); |
11388 | 4558 |
} |
4559 |
if (__isSmallInteger(rgbValueOrNil)) { |
|
18668 | 4560 |
clr = __intVal(rgbValueOrNil); |
4561 |
__win32_splashMessageColor(clr); |
|
11388 | 4562 |
} |
4563 |
__win32_splashMessage(msg); |
|
4564 |
#endif |
|
4565 |
%} |
|
4566 |
! |
|
4567 |
||
4568 |
splashInfo:aString |
|
11389 | 4569 |
"like infoPrintCR, |
4570 |
but in addition put the message into the splash screen (if there is one). |
|
4571 |
Use this for info messages during startup" |
|
4572 |
||
12883 | 4573 |
aString notNil ifTrue:[ aString infoPrintCR ]. |
11388 | 4574 |
self showSplashMessage:aString color:nil. |
4575 |
! |
|
4576 |
||
7563 | 4577 |
start |
20831 | 4578 |
"low level entry from the VM's main. |
4579 |
After initializeSystem, this is the very first real entry into the Smalltalk world. |
|
22791 | 4580 |
Analyzes the command line and checks what to do |
20831 | 4581 |
(i.e. script/repl/eval or full blown IDE). |
4582 |
Also handles --load and various debug options. |
|
22791 | 4583 |
Caveat: |
23628 | 4584 |
this has become too complicated and desperately needs a rewrite. |
21020 | 4585 |
|
4586 |
Also: |
|
23628 | 4587 |
Be very careful when changing things here; |
4588 |
especially be careful to ensure that the scripting options are robust against any |
|
4589 |
missing packages; so the error handlers should not depend on any stream, logger etc. features. |
|
21020 | 4590 |
" |
617 | 4591 |
|
15872 | 4592 |
|idx graphicalMode arg didReadRCFile keepSplashWindow| |
960
e3b75f50d0cd
changes for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
4593 |
|
23628 | 4594 |
VerboseStartup ifTrue:['start...' infoPrintCR]. |
4595 |
||
19597 | 4596 |
graphicalMode := Smalltalk isSmalltalkDevelopmentSystem. |
617 | 4597 |
Initializing := true. |
4598 |
||
15872 | 4599 |
keepSplashWindow := StartupClass perform:#keepSplashWindowOpen ifNotUnderstood:[false]. |
13526 | 4600 |
|
23628 | 4601 |
"/ remove possibly leftover --debug arg (not removed in initVerboseFlags, for whatever reason) |
21016 | 4602 |
idx := CommandLineArguments indexOf:'--debug'. |
4603 |
(idx ~~ 0) ifTrue:[ |
|
23628 | 4604 |
CommandLineArguments removeAtIndex:idx. |
22791 | 4605 |
]. |
21016 | 4606 |
|
617 | 4607 |
" |
4608 |
while reading patches- and rc-file, do not add things into change-file |
|
4609 |
" |
|
4610 |
Class withoutUpdatingChangesDo:[ |
|
23628 | 4611 |
|commandFiles rcFile defaultRC prevCatchSetting |
4612 |
isEval isPrint isFilter isRepl isRunMain idxFileArg process| |
|
4613 |
||
4614 |
isEval := isPrint := isFilter := isRepl := isRunMain := false. |
|
4615 |
didReadRCFile := false. |
|
4616 |
||
4617 |
StandAlone ifFalse:[ |
|
4618 |
"/ self initializeVerboseFlags. |
|
4619 |
||
4620 |
"/ |
|
4621 |
"/ look for any '-q', '-e', '-l' or '-f' command line arguments |
|
4622 |
"/ and handle them; |
|
4623 |
"/ read startup and patches file |
|
4624 |
"/ |
|
4625 |
idx := CommandLineArguments indexOfAny:#('-R' '--repl'). |
|
4626 |
isRepl := IsRepl := (idx ~~ 0). |
|
4627 |
||
4628 |
idx := CommandLineArguments indexOfAny:#('-q' '--silent'). |
|
4629 |
idx ~~ 0 ifTrue:[ |
|
4630 |
Object infoPrinting:false. |
|
4631 |
ObjectMemory infoPrinting:false. |
|
4632 |
CommandLineArguments removeAtIndex:idx. |
|
4633 |
SilentLoading := true. |
|
4634 |
]. |
|
4635 |
||
4636 |
[ |
|
4637 |
idx := CommandLineArguments indexOfAny:#('-pp' '--packagePath'). |
|
4638 |
idx ~~ 0 |
|
4639 |
] whileTrue:[ |
|
4640 |
arg := CommandLineArguments at:idx + 1. |
|
4641 |
CommandLineArguments removeAtIndex:idx+1; removeAtIndex:idx. |
|
4642 |
(arg asCollectionOfSubstringsSeparatedByAny:',;') do:[:each | |
|
4643 |
self packagePath addLast:each. |
|
4644 |
VerboseStartup ifTrue:[ |
|
4645 |
('Smalltalk [info]: add to packagePath: "', arg, '".') infoPrintCR. |
|
4646 |
]. |
|
4647 |
]. |
|
4648 |
]. |
|
4649 |
||
4650 |
[ |
|
4651 |
idx := CommandLineArguments indexOfAny:#('-l' '--load'). |
|
4652 |
idx ~~ 0 |
|
4653 |
] whileTrue:[ |
|
4654 |
arg := CommandLineArguments at:idx + 1. |
|
4655 |
CommandLineArguments removeAtIndex:idx+1; removeAtIndex:idx. |
|
4656 |
Smalltalk silentlyLoadingDo:[ |
|
4657 |
(arg asCollectionOfSubstringsSeparatedByAny:',;') do:[:each | |
|
4658 |
each asFilename exists ifTrue:[ |
|
4659 |
(VerboseStartup | VerboseLoading) ifTrue:[ |
|
4660 |
('Smalltalk [info]: loading file: "', each, '".') infoPrintCR. |
|
4661 |
]. |
|
4662 |
Smalltalk fileIn:each |
|
4663 |
] ifFalse:[ |
|
4664 |
(VerboseStartup | VerboseLoading) ifTrue:[ |
|
4665 |
('Smalltalk [info]: loading package: "', each, '".') infoPrintCR. |
|
4666 |
]. |
|
4667 |
Smalltalk loadPackage:each |
|
4668 |
]. |
|
4669 |
]. |
|
4670 |
]. |
|
4671 |
]. |
|
4672 |
||
4673 |
"/ look for a '-e filename' or '--execute filename' or '--script filename' argument |
|
4674 |
"/ this will force fileIn of filename only, no standard startup. |
|
4675 |
||
4676 |
idx := CommandLineArguments indexOfAny:#('-e' '--execute' '--script'). |
|
4677 |
idx ~~ 0 ifTrue:[ |
|
4678 |
SilentLoading := true. |
|
4679 |
CommandName := arg := CommandLineArguments at:idx + 1. |
|
4680 |
||
4681 |
CommandLineArguments |
|
4682 |
removeAtIndex:idx+1; removeAtIndex:idx. |
|
4683 |
||
4684 |
self startSchedulerAndBackgroundCollector. |
|
4685 |
keepSplashWindow ifFalse:[ self hideSplashWindow ]. |
|
4686 |
Initializing := false. |
|
4687 |
||
4688 |
process := [ |
|
4689 |
Processor exitWhenNoMoreUserProcesses:true. |
|
4690 |
||
4691 |
"/ set workspace variables |
|
4692 |
self defineCommandLineAsWorkspaceVariablesForScripts. |
|
4693 |
||
4694 |
"/ provide a Display, if needed |
|
4695 |
self providingDisplayDo:[ |
|
4696 |
VerboseStartup ifTrue:[ |
|
4697 |
('Smalltalk [info]: reading script from: "', arg, '".') infoPrintCR. |
|
4698 |
]. |
|
4699 |
NoHandlerError handle:[:ex | |
|
4700 |
Debugging == true ifTrue:[ |
|
4701 |
MiniDebugger enterException:ex. |
|
4702 |
] ifFalse:[ |
|
4703 |
Silent ifFalse:[ |
|
4704 |
'Smalltalk [error]: ' _errorPrint. ex exception description _errorPrintCR. |
|
4705 |
]. |
|
4706 |
(VerboseStartup or:[ObjectMemory debugPrinting]) ifTrue:[ |
|
4707 |
ex suspendedContext fullPrintAll. |
|
4708 |
]. |
|
4709 |
self exit:1. |
|
4710 |
]. |
|
4711 |
self exit:1. |
|
4712 |
"/ ex reject. |
|
4713 |
] do:[ |
|
4714 |
UserInterrupt handle:[:ex | |
|
4715 |
Debugging == true ifTrue:[ |
|
4716 |
'user interrupt (type "c" to continue; "x" to exit; "?" for help).' errorPrintCR. |
|
4717 |
"/ thisContext fullPrintAll. |
|
4718 |
MiniDebugger enterException:ex. |
|
4719 |
ex proceed. |
|
4720 |
]. |
|
4721 |
Silent ifFalse:[ 'user interrupt.' errorPrintCR ]. |
|
4722 |
self exit:128+(OperatingSystem sigINT). |
|
4723 |
] do:[ |
|
4724 |
|cmdStream result| |
|
4725 |
||
4726 |
arg = '-' ifTrue:[ |
|
4727 |
cmdStream := Stdin. |
|
4728 |
] ifFalse:[ |
|
4729 |
IsSTScript := true. |
|
4730 |
cmdStream := arg asFilename readStream. |
|
4731 |
]. |
|
4732 |
result := [ |
|
4733 |
self fileInStream:cmdStream |
|
4734 |
lazy:nil |
|
4735 |
silent:self verbose not |
|
4736 |
logged:false |
|
4737 |
addPath:nil |
|
4738 |
] ensure:[ |
|
4739 |
IsSTScript ifTrue:[ |
|
4740 |
"/ do not close Stdin |
|
4741 |
cmdStream close. |
|
4742 |
]. |
|
4743 |
]. |
|
4744 |
result ifFalse:[ |
|
4745 |
self exit:1. |
|
4746 |
]. |
|
4747 |
]. |
|
4748 |
]. |
|
4749 |
]. |
|
4750 |
||
4751 |
"/ after the script, if Screen has been opened and there are any open windows, |
|
4752 |
"/ then do not exit |
|
20758 | 4753 |
false ifTrue:[ |
23628 | 4754 |
Display notNil ifTrue:[ |
4755 |
Processor exitWhenNoMoreUserProcesses:true. |
|
4756 |
"/ Display exitOnLastClose:true. |
|
4757 |
"/ Display checkForEndOfDispatch. |
|
4758 |
] ifFalse:[ |
|
4759 |
self exit. |
|
4760 |
]. |
|
20758 | 4761 |
]. |
23628 | 4762 |
] newProcess. |
4763 |
process priority:(Processor userSchedulingPriority). |
|
4764 |
process name:'main'. |
|
4765 |
process beGroupLeader. |
|
4766 |
process resume. |
|
4767 |
||
4768 |
Processor dispatchLoop. |
|
4769 |
self exit |
|
4770 |
]. |
|
4771 |
||
4772 |
"look for a '-f filename' or '--file filename' argument |
|
4773 |
if scripting, these are loaded before -P, -E or -R action. |
|
4774 |
if not scripting, this will force evaluation of filename instead of smalltalk.rc" |
|
4775 |
[ |
|
4776 |
idxFileArg := CommandLineArguments indexOfAny:#('-f' '--file'). |
|
4777 |
(idxFileArg ~~ 0) |
|
4778 |
] whileTrue:[ |
|
4779 |
commandFiles isNil ifTrue:[ commandFiles := OrderedCollection new ]. |
|
4780 |
commandFiles add:(CommandLineArguments at:idxFileArg+1). |
|
4781 |
CommandLineArguments removeAtIndex:idxFileArg+1; removeAtIndex:idxFileArg. |
|
4782 |
]. |
|
4783 |
||
4784 |
"/ look for a '-E expr' or '--eval expr' argument (-P or --print to print the result of evaluation) |
|
4785 |
"/ or -F/--filter or a '--repl' argument |
|
4786 |
"/ E, P and F this will force evaluation of expr only, no standard startup |
|
4787 |
"/ repl go into an interactive loop. |
|
4788 |
idx := CommandLineArguments indexOfAny:#('-E' '--eval'). |
|
4789 |
(isEval := (idx ~~ 0)) ifFalse:[ |
|
4790 |
idx := CommandLineArguments indexOfAny:#('-P' '--print'). |
|
4791 |
(isPrint := (idx ~~ 0)) ifFalse:[ |
|
4792 |
idx := CommandLineArguments indexOfAny:#('-F' '--filter'). |
|
4793 |
(isFilter := (idx ~~ 0)) ifFalse:[ |
|
4794 |
idx := CommandLineArguments indexOfAny:#('-R' '--repl'). |
|
4795 |
(isRepl := (idx ~~ 0)) ifFalse:[ |
|
4796 |
idx := CommandLineArguments indexOfAny:#('--run'). |
|
4797 |
isRunMain := (idx ~~ 0) |
|
4798 |
]. |
|
4799 |
]. |
|
4800 |
]. |
|
4801 |
]. |
|
4802 |
||
4803 |
(isEval | isPrint | isFilter | isRepl | isRunMain) ifTrue:[ |
|
4804 |
|args| |
|
4805 |
||
4806 |
VerboseStartup ifTrue:[ |
|
4807 |
('Smalltalk [info]: eval/filter/print or repl') infoPrintCR. |
|
4808 |
]. |
|
4809 |
isRepl ifFalse:[ |
|
4810 |
CommandLineArguments size <= idx ifTrue:[ |
|
4811 |
StandAlone := true. |
|
4812 |
self exitWithErrorMessage:'missing argument after -E/-P/-F/--run.'. |
|
4813 |
]. |
|
4814 |
isFilter ifTrue:[ |
|
4815 |
args := CommandLineArguments copyFrom:idx + 1. |
|
4816 |
CommandLineArguments removeFromIndex:idx+1. |
|
4817 |
VerboseStartup ifTrue:[ |
|
4818 |
('Smalltalk [info]: filter expression(s): ') infoPrint. |
|
4819 |
args infoPrintCR. |
|
4820 |
]. |
|
4821 |
] ifFalse:[ |
|
4822 |
arg := CommandLineArguments at:idx + 1. |
|
4823 |
CommandLineArguments removeAtIndex:idx+1. |
|
4824 |
VerboseStartup ifTrue:[ |
|
4825 |
('Smalltalk [info]: eval expression: ') infoPrint. |
|
4826 |
arg infoPrintCR. |
|
4827 |
]. |
|
4828 |
]. |
|
4829 |
]. |
|
4830 |
CommandLineArguments removeAtIndex:idx. |
|
4831 |
||
4832 |
self startSchedulerAndBackgroundCollector. |
|
4833 |
||
4834 |
keepSplashWindow ifFalse:[ self hideSplashWindow ]. |
|
4835 |
Initializing := false. |
|
4836 |
||
4837 |
"/ set workspace variables |
|
4838 |
self defineCommandLineAsWorkspaceVariablesForScripts. |
|
4839 |
||
4840 |
"/ all of the above allow for a -f file to be loaded before any other action |
|
4841 |
(commandFiles notEmptyOrNil) ifTrue:[ |
|
4842 |
commandFiles do:[:commandFile | |
|
4843 |
(VerboseStartup | VerboseLoading) ifTrue:[ |
|
4844 |
('Smalltalk [info]: reading command file from: "', commandFile, '".') infoPrintCR. |
|
4845 |
]. |
|
4846 |
Smalltalk silentlyLoadingDo:[ |
|
4847 |
(self secureFileIn:commandFile) ifFalse:[ |
|
4848 |
StandAlone := true. |
|
4849 |
self exitWithErrorMessage:('"', commandFile, '" not found.'). |
|
4850 |
] |
|
4851 |
] |
|
4852 |
] |
|
4853 |
]. |
|
4854 |
||
4855 |
isRepl ifFalse:[ |
|
4856 |
Debugging == true ifFalse:[ |
|
4857 |
"/ remove the Debugger |
|
4858 |
Debugger := nil. |
|
4859 |
]. |
|
4860 |
]. |
|
4861 |
||
4862 |
process := [ |
|
4863 |
self providingDisplayDo:[ |
|
4864 |
isRepl ifTrue:[ |
|
4865 |
Processor exitWhenNoMoreUserProcesses:false. |
|
4866 |
Processor activeProcess name:'repl'. |
|
4867 |
self readEvalPrintLoop. |
|
4868 |
self exit. |
|
4869 |
]. |
|
4870 |
||
4871 |
Processor exitWhenNoMoreUserProcesses:true. |
|
4872 |
||
4873 |
NoHandlerError handle:[:ex | |
|
4874 |
Debugging == true ifTrue:[ |
|
4875 |
MiniDebugger enterException:ex. |
|
4876 |
] ifFalse:[ |
|
4877 |
Silent ifFalse:[ |
|
4878 |
'Smalltalk [error]: ' _errorPrint. ex description _errorPrintCR. |
|
4879 |
]. |
|
4880 |
(VerboseStartup or:[ObjectMemory debugPrinting]) ifTrue:[ |
|
4881 |
ex suspendedContext fullPrintAll. |
|
4882 |
]. |
|
4883 |
self exit:1. |
|
4884 |
]. |
|
4885 |
self exit:1. |
|
4886 |
"/ ex reject. |
|
4887 |
] do:[ |
|
4888 |
UserInterrupt handle:[:ex | |
|
4889 |
Debugging == true ifTrue:[ |
|
4890 |
'user interrupt (type "c" to continue; "x" to exit; "?" for help).' errorPrintCR. |
|
4891 |
"/ thisContext fullPrintAll. |
|
4892 |
MiniDebugger enterException:ex. |
|
4893 |
ex proceed. |
|
4894 |
]. |
|
4895 |
Silent ifFalse:[ 'user interrupt.' errorPrintCR ]. |
|
4896 |
self exit:128+(OperatingSystem sigINT). |
|
4897 |
] do:[ |
|
4898 |
|filterCode filterStart filterEnd| |
|
4899 |
||
4900 |
isFilter ifTrue:[ |
|
4901 |
"/ --filter - apply code to each input line. |
|
4902 |
"/ compile code only once |
|
4903 |
(args size == 1) ifTrue:[ |
|
4904 |
VerboseStartup ifTrue:[ |
|
4905 |
'Smalltalk [info]: filter 1-arg' infoPrintCR. |
|
4906 |
]. |
|
4907 |
filterCode := args at:1. |
|
4908 |
] ifFalse:[ |
|
4909 |
(args size == 3) ifTrue:[ |
|
4910 |
VerboseStartup ifTrue:[ |
|
4911 |
'Smalltalk [info]: filter 3-arg' infoPrintCR. |
|
4912 |
]. |
|
4913 |
filterStart := args at:1. |
|
4914 |
filterCode := args at:2. |
|
4915 |
filterEnd := args at:3. |
|
4916 |
] ifFalse:[ |
|
4917 |
StandAlone := true. |
|
4918 |
self exitWithErrorMessage:'--filter must be followed by 1 or 3 expression arg(s)' |
|
4919 |
]. |
|
4920 |
]. |
|
4921 |
filterStart notEmptyOrNil ifTrue:[ |
|
4922 |
VerboseStartup ifTrue:[ |
|
4923 |
('Smalltalk [info]: eval: "', filterStart, '"...') infoPrintCR. |
|
4924 |
]. |
|
4925 |
Compiler evaluate:filterStart notifying:(EvalScriptingErrorHandler new source:filterStart) |
|
4926 |
]. |
|
4927 |
VerboseStartup ifTrue:[ |
|
4928 |
('Smalltalk [info]: compile: "', filterCode, '"...') infoPrintCR. |
|
4929 |
]. |
|
4930 |
Compiler |
|
4931 |
compile:'doIt:line ',filterCode |
|
4932 |
forClass:String |
|
4933 |
notifying:(EvalScriptingErrorHandler new source:filterCode). |
|
4934 |
||
4935 |
[Stdin atEnd] whileFalse:[ |
|
4936 |
|line| |
|
4937 |
||
4938 |
line := Stdin nextLine. |
|
4939 |
line doIt:line. |
|
4940 |
]. |
|
4941 |
filterEnd notEmptyOrNil ifTrue:[ |
|
4942 |
VerboseStartup ifTrue:[ |
|
4943 |
('Smalltalk [info]: eval: "', filterEnd, '"...') infoPrintCR. |
|
4944 |
]. |
|
4945 |
Compiler evaluate:filterEnd notifying:(EvalScriptingErrorHandler new source:filterEnd) |
|
4946 |
]. |
|
4947 |
] ifFalse:[ |
|
4948 |
(isPrint | isEval) ifTrue:[ |
|
4949 |
"/ --print or --eval |
|
4950 |
|rslt| |
|
4951 |
||
4952 |
rslt := Parser new |
|
4953 |
evaluate:arg |
|
4954 |
notifying:(EvalScriptingErrorHandler new source:arg) |
|
4955 |
compile:true. |
|
4956 |
isPrint ifTrue:[ |
|
4957 |
rslt printCR. |
|
4958 |
]. |
|
4959 |
] ifFalse:[ |
|
4960 |
"/ --run <className> |
|
4961 |
|className class| |
|
4962 |
||
4963 |
className := arg. |
|
4964 |
class := Smalltalk classNamed:className. |
|
4965 |
class isNil ifTrue:[ |
|
4966 |
StandAlone := true. |
|
4967 |
self exitWithErrorMessage:'no such class: "', className, '".' |
|
4968 |
]. |
|
4969 |
(class respondsTo:#main:) ifTrue:[ |
|
4970 |
class main:CommandLineArguments. |
|
4971 |
] ifFalse:[ |
|
4972 |
(class respondsTo:#main) ifTrue:[ |
|
4973 |
class main. |
|
4974 |
] ifFalse:[ |
|
4975 |
(class respondsTo:#start) ifTrue:[ |
|
4976 |
class start. |
|
4977 |
] ifFalse:[ |
|
4978 |
StandAlone := true. |
|
4979 |
self exitWithErrorMessage:'class has no "main:", "main" or "start" method.' |
|
4980 |
]. |
|
4981 |
]. |
|
4982 |
]. |
|
4983 |
]. |
|
4984 |
]. |
|
4985 |
]. |
|
4986 |
]. |
|
4987 |
]. |
|
4988 |
||
4989 |
"/ after the script, if Screen has been opened and there are any open windows, |
|
4990 |
"/ then do not exit |
|
20758 | 4991 |
false ifTrue:[ |
23628 | 4992 |
Display notNil ifTrue:[ |
4993 |
Processor exitWhenNoMoreUserProcesses:true. |
|
4994 |
"/ Display exitOnLastClose:true. |
|
4995 |
"/ Display checkForEndOfDispatch. |
|
4996 |
VerboseStartup ifTrue:[ |
|
4997 |
('Smalltalk [info]: display opened.') infoPrintCR. |
|
4998 |
]. |
|
4999 |
] ifFalse:[ |
|
5000 |
VerboseStartup ifTrue:[ |
|
5001 |
('Smalltalk [info]: no display - exit after script.') infoPrintCR. |
|
5002 |
]. |
|
5003 |
self exit. |
|
5004 |
]. |
|
20758 | 5005 |
]. |
23628 | 5006 |
VerboseStartup ifTrue:[ |
5007 |
('Smalltalk [info]: script/repl/eval finished.') infoPrintCR. |
|
5008 |
]. |
|
5009 |
||
5010 |
] newProcess. |
|
5011 |
process priority:(Processor userSchedulingPriority). |
|
5012 |
process name:'main'. |
|
5013 |
process beGroupLeader. |
|
5014 |
process resume. |
|
5015 |
||
5016 |
Processor dispatchLoop. |
|
5017 |
VerboseStartup ifTrue:[ |
|
5018 |
('Smalltalk [info]: exit normally.') infoPrintCR. |
|
5019 |
]. |
|
5020 |
self exit |
|
5021 |
]. |
|
5022 |
]. |
|
5023 |
||
5024 |
commandFiles notNil ifTrue:[ |
|
5025 |
SilentLoading := true. "/ suppress the hello & copyright messages |
|
5026 |
self addStartBlock: |
|
5027 |
[ |
|
5028 |
commandFiles do:[:commandFile | |
|
5029 |
VerboseStartup ifTrue:[('filing in %1' bindWith:commandFile) infoPrintCR]. |
|
5030 |
(self secureFileIn:commandFile) ifFalse:[ |
|
5031 |
self exitWithErrorMessage:('startup file "', commandFile, '" not found.'). |
|
5032 |
]. |
|
5033 |
]. |
|
5034 |
]. |
|
16091 | 5035 |
|
5036 |
"/ self startSchedulerAndBackgroundCollector. |
|
5037 |
"/ keepSplashWindow ifFalse:[ self hideSplashWindow ]. |
|
5038 |
"/ Initializing := false. |
|
5039 |
"/ |
|
5040 |
"/ (self secureFileIn:commandFile) ifFalse:[ |
|
5041 |
"/ ('Smalltalk [error]: startup file "', commandFile, '" not found.') errorPrintCR. |
|
5042 |
"/ OperatingSystem exit:1. |
|
5043 |
"/ ]. |
|
23628 | 5044 |
] ifFalse:[ |
5045 |
"/ look for <command>.rc |
|
5046 |
"/ if not found, read smalltalk.rc (or stxapp.rc for standAlone operation) |
|
5047 |
||
5048 |
rcFile := self commandName asFilename withSuffix:'rc'. |
|
5049 |
VerboseStartup ifTrue:[('filing in %1' bindWith:rcFile) infoPrintCR]. |
|
5050 |
(didReadRCFile := rcFile exists and:[self secureFileIn:rcFile]) ifFalse:[ |
|
5051 |
StandAlone ifFalse:[ |
|
5052 |
defaultRC := 'smalltalk.rc' "/asFilename |
|
5053 |
] ifTrue:[ |
|
5054 |
defaultRC := 'stxapp.rc' "/asFilename |
|
5055 |
]. |
|
5056 |
"JV@2011-11-01: DO NOT check defaultRC exist - this prevents smalltalk to |
|
5057 |
to be started with different working directory than stx/projects/smalltalk !!!!!!" |
|
5058 |
||
5059 |
"/didReadRCFile := defaultRC exists and:[self secureFileIn:defaultRC]. |
|
5060 |
VerboseStartup ifTrue:[('filing in %1' bindWith:defaultRC) infoPrintCR]. |
|
5061 |
didReadRCFile := (self getSystemFileName:defaultRC) notNil |
|
5062 |
and:[self secureFileIn:defaultRC]. |
|
5063 |
didReadRCFile ifFalse:[ |
|
5064 |
StandAlone ifFalse:[ |
|
5065 |
'Smalltalk [warning]: no startup rc-file found. Going into line-by-line interpreter.' infoPrintCR. |
|
5066 |
graphicalMode := false. |
|
5067 |
] |
|
5068 |
] |
|
5069 |
]. |
|
5070 |
||
5071 |
"/ ('StandAlone is %1' bindWith:StandAlone) printCR. |
|
5072 |
"/ ('Headless is %1' bindWith:HeadlessOperation) printCR. |
|
5073 |
"/ ('Display is %1' bindWith:Display) printCR. |
|
5074 |
"/ ('Screen is %1' bindWith:Screen) printCR. |
|
5075 |
||
5076 |
keepSplashWindow ifFalse:[ self hideSplashWindow ]. |
|
5077 |
didReadRCFile ifFalse:[ |
|
5078 |
'private.rc' asFilename exists ifTrue:[ |
|
5079 |
VerboseStartup ifTrue:[('filing in private.rc') infoPrintCR]. |
|
5080 |
self secureFileIn:'private.rc' |
|
5081 |
]. |
|
5082 |
||
5083 |
"/ |
|
5084 |
"/ No RC file found; |
|
5085 |
"/ Setup more default stuff |
|
5086 |
"/ |
|
5087 |
StandAlone ifFalse:[ |
|
5088 |
"/ its a smalltalk - proceed in interpreter. |
|
5089 |
'Smalltalk [warning]: no startup rc-file found. Going into line-by-line interpreter.' infoPrintCR. |
|
5090 |
graphicalMode := false. |
|
5091 |
]. |
|
5092 |
||
5093 |
"/ setup more defaults... |
|
13537 | 5094 |
"/ ObjectMemory startBackgroundCollectorAt:5. |
5095 |
"/ ObjectMemory startBackgroundFinalizationAt:5. |
|
23628 | 5096 |
self addStartBlock:[ |
5097 |
self startSchedulerAndBackgroundCollector |
|
5098 |
]. |
|
5099 |
]. |
|
5100 |
]. |
|
5101 |
(CommandLineArguments includes:'--scripting') ifTrue:[ |
|
5102 |
self addStartBlock:[ |
|
5103 |
StandaloneStartup handleScriptingOptionsFromArguments:CommandLineArguments. |
|
5104 |
]. |
|
5105 |
]. |
|
617 | 5106 |
]. |
5107 |
||
10644 | 5108 |
HeadlessOperation ifTrue:[ |
23628 | 5109 |
graphicalMode := false. |
15872 | 5110 |
]. |
5111 |
||
5112 |
keepSplashWindow ifFalse:[ self hideSplashWindow ]. |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
5113 |
self mainStartup:graphicalMode |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
5114 |
|
15872 | 5115 |
"Modified: / 17-12-2013 / 16:44:40 / cg" |
22147 | 5116 |
"Modified: / 01-08-2017 / 11:08:47 / stefan" |
23628 | 5117 |
"Modified: / 22-01-2019 / 14:01:44 / Claus Gittinger" |
13536
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
5118 |
! |
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
5119 |
|
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
5120 |
startSchedulerAndBackgroundCollector |
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
5121 |
Processor startTimeSlicing. |
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
5122 |
Processor supportDynamicPriorities:true. |
13537 | 5123 |
|
5124 |
ObjectMemory startBackgroundCollectorAt:5. |
|
5125 |
ObjectMemory startBackgroundFinalizationAt:5. |
|
13536
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
5126 |
ObjectMemory backgroundCollectProcess priorityRange:(4 to:9). |
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
5127 |
ObjectMemory backgroundFinalizationProcess priorityRange:(4 to:9). |
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
5128 |
|
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
5129 |
"Created: / 31-07-2011 / 20:01:33 / cg" |
11808
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
5130 |
! |
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
5131 |
|
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
5132 |
startStartBlockProcess |
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
5133 |
"at the end of the smalltalk initialization, start all actions that |
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
5134 |
were delayed until the ProcessorScheduler is running in a separate process" |
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
5135 |
|
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
5136 |
|p| |
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
5137 |
|
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
5138 |
p := |
18668 | 5139 |
[ |
5140 |
self executeStartBlocks. |
|
5141 |
] newProcess. |
|
12022 | 5142 |
|
5143 |
p |
|
18668 | 5144 |
priority:(Processor userSchedulingPriority); |
5145 |
name:'start block handler'; |
|
5146 |
beGroupLeader; |
|
5147 |
resume. |
|
13892 | 5148 |
|
13893 | 5149 |
"Modified: / 07-01-2012 / 12:59:01 / cg" |
1097 | 5150 |
! ! |
5151 |
||
13947 | 5152 |
!Smalltalk class methodsFor:'startup and exit'! |
5153 |
||
5154 |
addExitBlock:aBlock |
|
5155 |
"{ Pragma: +optSpace }" |
|
5156 |
||
5157 |
"add a block to be executed when Smalltalk finishes. |
|
5158 |
This feature is currently not used anywhere - but could be useful for |
|
5159 |
cleanup in stand alone applications. |
|
5160 |
||
5161 |
Better use: ObjectMemory>>#addDependent: and handle the change message |
|
5162 |
#aboutToQuit." |
|
5163 |
||
5164 |
ExitBlocks isNil ifTrue:[ |
|
18668 | 5165 |
ExitBlocks := OrderedCollection with:aBlock |
13947 | 5166 |
] ifFalse:[ |
18668 | 5167 |
ExitBlocks add:aBlock |
13947 | 5168 |
] |
5169 |
! |
|
5170 |
||
5171 |
addImageStartBlock:aBlock |
|
5172 |
"{ Pragma: +optSpace }" |
|
5173 |
||
5174 |
"add a blocks to be executed in a separate process after |
|
5175 |
everything has been initialized. |
|
5176 |
These blocks will be executed after an image restart." |
|
5177 |
||
5178 |
ImageStartBlocks isNil ifTrue:[ |
|
18668 | 5179 |
ImageStartBlocks := OrderedCollection with:aBlock |
13947 | 5180 |
] ifFalse:[ |
18668 | 5181 |
ImageStartBlocks add:aBlock |
13947 | 5182 |
] |
5183 |
||
5184 |
"Created: 9.9.1996 / 16:48:20 / stefan" |
|
5185 |
! |
|
5186 |
||
5187 |
addStartBlock:aBlock |
|
15980 | 5188 |
"to be called ONLY during very early startup (before the process scheduler |
5189 |
is started) to add a block to be executed in a separate process after |
|
5190 |
everything has been initialized. |
|
5191 |
Used to allow a startup script (which is executed BEFORE the scheduler and |
|
5192 |
UI display is startup up) to add actions which require those subsystems to |
|
5193 |
be operating. |
|
5194 |
These blocks will be executed only once and not be executed after an image restart. |
|
13947 | 5195 |
Initial processes such as the launcher are usually started here |
15980 | 5196 |
(see smalltalk.rc / private.rc). |
5197 |
ONLY to be called from such an rc file." |
|
13947 | 5198 |
|
5199 |
"{ Pragma: +optSpace }" |
|
5200 |
||
15980 | 5201 |
"/ to protect against "mis-users" of this mehtod... |
5202 |
Initializing ifFalse:[ |
|
18668 | 5203 |
aBlock value |
16170
ca4d03def070
endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents:
16164
diff
changeset
|
5204 |
] ifTrue:[ |
18668 | 5205 |
StartBlocks isNil ifTrue:[ |
5206 |
StartBlocks := OrderedCollection with:aBlock |
|
5207 |
] ifFalse:[ |
|
5208 |
StartBlocks add:aBlock |
|
5209 |
] |
|
15980 | 5210 |
]. |
13947 | 5211 |
|
5212 |
"Created: / 09-09-1996 / 16:46:53 / stefan" |
|
5213 |
"Modified (comment): / 18-08-2011 / 09:18:42 / cg" |
|
5214 |
! |
|
5215 |
||
5216 |
exit |
|
5217 |
"{ Pragma: +optSpace }" |
|
5218 |
||
5219 |
"finish the Smalltalk system" |
|
5220 |
||
5221 |
self exit:0 |
|
5222 |
"not reached" |
|
5223 |
||
5224 |
"Be careful evaluating this |
|
5225 |
Smalltalk exit |
|
5226 |
" |
|
5227 |
! |
|
5228 |
||
5229 |
exit:statusInteger |
|
5230 |
"{ Pragma: +optSpace }" |
|
5231 |
||
5232 |
"finish the Smalltalk system" |
|
5233 |
||
5234 |
ObjectMemory changed:#aboutToExit. "/ for ST/X backward compatibility |
|
5235 |
ObjectMemory changed:#aboutToQuit. "/ for ST-80 compatibility |
|
5236 |
ExitBlocks notNil ifTrue:[ |
|
22791 | 5237 |
ExitBlocks do:[:aBlock | |
5238 |
aBlock value |
|
5239 |
] |
|
21782 | 5240 |
]. |
5241 |
Display notNil ifTrue:[ Display closeConnection ]. |
|
5242 |
||
13947 | 5243 |
OperatingSystem exit:statusInteger |
5244 |
"not reached" |
|
5245 |
||
5246 |
"Be careful evaluating this |
|
5247 |
Smalltalk exit:1 |
|
5248 |
" |
|
21782 | 5249 |
|
5250 |
"Modified: / 30-05-2017 / 21:36:35 / cg" |
|
19014 | 5251 |
! |
5252 |
||
19958 | 5253 |
exitIfStandalone |
5254 |
"if this is a standalone application, exit. |
|
5255 |
Otherwise give a warning and abort. |
|
5256 |
Call this in your code instead of Smalltalk exit, |
|
5257 |
so the code can be tested in the IDE without danger of shuttong down ST/X" |
|
5258 |
||
5259 |
"{ Pragma: +optSpace }" |
|
5260 |
||
5261 |
self exitIfStandalone:0 |
|
5262 |
||
5263 |
"Created: / 06-06-2016 / 14:56:49 / cg" |
|
5264 |
! |
|
5265 |
||
5266 |
exitIfStandalone:statusInteger |
|
5267 |
"if this is a standalone application, exit. |
|
5268 |
Otherwise give a warning and abort. |
|
5269 |
Call this in your code instead of Smalltalk exit, |
|
5270 |
so the code can be tested in the IDE without danger of shuttong down ST/X" |
|
5271 |
||
5272 |
"{ Pragma: +optSpace }" |
|
5273 |
||
5274 |
Smalltalk isStandAloneApp ifTrue:[ |
|
22791 | 5275 |
self exit:statusInteger |
19958 | 5276 |
] ifFalse:[ |
22791 | 5277 |
self warn:'Application asks Smalltalk to exit (this is suppressed in IDE).'. |
5278 |
AbortOperationRequest raise. |
|
19958 | 5279 |
] |
5280 |
||
5281 |
" |
|
5282 |
Smalltalk exitIfStandalone:1 |
|
5283 |
" |
|
5284 |
||
5285 |
"Created: / 06-06-2016 / 14:56:00 / cg" |
|
5286 |
! |
|
5287 |
||
19014 | 5288 |
exitOrError:exitCode |
5289 |
"exit only if running as standalone application. |
|
5290 |
Raise an error in the development system. |
|
5291 |
Useful for testing standalone apps which should not kill |
|
5292 |
your development system." |
|
5293 |
||
5294 |
self isStandAloneApp ifTrue:[ |
|
22791 | 5295 |
self exit:exitCode. |
19014 | 5296 |
]. |
5297 |
self error:'standalone smalltalk would exit here with exit code: ', exitCode printString. |
|
5298 |
||
5299 |
" |
|
5300 |
self exitOrError:0 |
|
5301 |
" |
|
20715 | 5302 |
! |
5303 |
||
5304 |
exitWithErrorMessage:msg |
|
5305 |
('Smalltalk [error]: ',msg) errorPrintCR. |
|
5306 |
self exitOrError:1 |
|
13947 | 5307 |
! ! |
5308 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
5309 |
!Smalltalk class methodsFor:'startup queries'! |
1097 | 5310 |
|
10641 | 5311 |
commandLine |
5312 |
"return the full command line arguments (with which ST/X was started)" |
|
5313 |
||
5314 |
^ CommandLine |
|
5315 |
||
5316 |
" |
|
5317 |
Smalltalk commandLine |
|
5318 |
" |
|
5319 |
||
5320 |
"Created: 19.7.1996 / 11:09:06 / cg" |
|
5321 |
! |
|
5322 |
||
5323 |
commandLineArgumentNamed:aString |
|
16110 | 5324 |
"extract a named argument from the command line arguments. |
5325 |
This searches for the given string in the command line and returns the next argument after it." |
|
10641 | 5326 |
|
5327 |
|args index| |
|
5328 |
||
5329 |
args := self commandLineArguments. |
|
5330 |
index := args indexOf:aString. |
|
5331 |
(index between:1 and:(args size - 1)) ifTrue:[ |
|
18668 | 5332 |
^ args at:index+1 |
10641 | 5333 |
]. |
5334 |
^ nil. |
|
5335 |
||
5336 |
" |
|
5337 |
self commandLineArgumentNamed:'-display' |
|
5338 |
" |
|
5339 |
! |
|
5340 |
||
5341 |
commandLineArguments |
|
5342 |
"return the user command line arguments; |
|
5343 |
This is a collection of strings (separated command line words), |
|
5344 |
from which the internal startup arguments have already been removed. |
|
5345 |
I.e. if started with: 'smalltalk -I -f xxx foo bar baz', |
|
5346 |
the commandLineArguments will be #('foo' 'bar' 'baz'). |
|
5347 |
In contrast, the value returned by #commandLine will be the full set of words." |
|
5348 |
||
5349 |
^ CommandLineArguments |
|
5350 |
||
5351 |
"Modified: 19.7.1996 / 11:11:03 / cg" |
|
5352 |
! |
|
5353 |
||
5354 |
commandName |
|
5355 |
"return the excutables name - this is normally 'stx', |
|
5356 |
but can be something else for standAlone apps." |
|
5357 |
||
5358 |
^ CommandName. |
|
5359 |
||
5360 |
" |
|
5361 |
Smalltalk commandName |
|
5362 |
" |
|
5363 |
||
5364 |
"Modified: 19.7.1996 / 11:11:16 / cg" |
|
5365 |
! |
|
5366 |
||
5367 |
hasNoConsole |
|
5368 |
"return true, if this is a console-less application (i.e. I am winstx) |
|
5369 |
i.e. there should be no writing to stdout/stderr" |
|
5370 |
||
5371 |
^ HasNoConsole ? false |
|
5372 |
||
5373 |
" |
|
10071 | 5374 |
Smalltalk hasNoConsole |
9054 | 5375 |
" |
5376 |
! |
|
5377 |
||
17435 | 5378 |
ignoreAssertions |
5379 |
"return true, if assertions are to be ignored (i.e. not executed). |
|
5380 |
This is false by default in an IDE (i.e. full smalltalk), |
|
5381 |
but can be set to true for standAlone applications |
|
5382 |
(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
|
5383 |
However, it may make the app a little faster, if assertions are compatational |
17435 | 5384 |
expensive, as they are skipped (the stc compiler is generatig code which skips those)." |
5385 |
||
17439
1928276a394c
added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents:
17438
diff
changeset
|
5386 |
^ IgnoreAssertions ? false |
17435 | 5387 |
! |
5388 |
||
17438 | 5389 |
ignoreAssertions:aBoolean |
5390 |
"set to true, if assertions are to be ignored (i.e. not executed). |
|
5391 |
This is false by default in an IDE (i.e. full smalltalk), |
|
5392 |
but can be set to true for standAlone applications |
|
5393 |
(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
|
5394 |
However, it may make the app a little faster, if assertions are compatational |
17438 | 5395 |
expensive, as they are skipped (the stc compiler is generatig code which skips those)." |
5396 |
||
17439
1928276a394c
added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents:
17438
diff
changeset
|
5397 |
IgnoreAssertions := aBoolean |
17438 | 5398 |
! |
5399 |
||
22679 | 5400 |
isDebuggableApp |
5401 |
"return true, if we want to see a Debugger, MiniDebugger or extended debugging output |
|
5402 |
in some situations." |
|
5403 |
||
5404 |
^ self isStandAloneApp not or:[self isStandAloneDebug]. |
|
5405 |
||
5406 |
" |
|
5407 |
Smalltalk isDebuggableApp |
|
5408 |
" |
|
5409 |
||
5410 |
"Created: / 19-04-2018 / 10:30:17 / stefan" |
|
5411 |
! |
|
5412 |
||
10641 | 5413 |
isHeadless |
5414 |
"return true, if this is a headless application |
|
5415 |
i.e. no default Display connection is required/used" |
|
5416 |
||
5417 |
^ HeadlessOperation ? false |
|
5418 |
||
5419 |
" |
|
10071 | 5420 |
Smalltalk isHeadless |
9029 | 5421 |
" |
5422 |
! |
|
5423 |
||
10641 | 5424 |
isPlugin |
5425 |
"return true, if this is a plugin application |
|
5426 |
i.e. running in a browserWindow" |
|
5427 |
||
5428 |
^ IsPlugin ? false |
|
5429 |
||
5430 |
" |
|
10071 | 5431 |
Smalltalk isPlugin |
9029 | 5432 |
" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5433 |
! |
4957 | 5434 |
|
10641 | 5435 |
isSTScript |
5436 |
"return true, if this is stscript. i.e. the stx scripting engine." |
|
5437 |
||
5438 |
^ IsSTScript ? false |
|
5439 |
||
5440 |
" |
|
5441 |
Smalltalk isSTScript |
|
5442 |
" |
|
5443 |
||
5444 |
"Created: / 06-12-2006 / 16:41:21 / cg" |
|
5445 |
! |
|
5446 |
||
5447 |
isSharedLibraryComponent |
|
5448 |
"return true, if this is a shared library component of another application |
|
5449 |
i.e. a dll within another app." |
|
5450 |
||
5451 |
^ IsSharedLibraryComponent ? false |
|
5452 |
||
5453 |
" |
|
5454 |
Smalltalk isSharedLibraryComponent |
|
5455 |
" |
|
5456 |
||
5457 |
"Created: / 10-08-2006 / 13:09:34 / cg" |
|
5458 |
! |
|
5459 |
||
5460 |
isSmalltalkDevelopmentSystem |
|
5461 |
"return true, if this is a real smalltalk system |
|
17421 | 5462 |
i.e. NOT a stripped or a linked standAlone application (such as the webServer) |
10641 | 5463 |
and NOT a plugIn (i.e. running in a browser) |
5464 |
and NOT a sharedLibrary component (i.e. a dll in another app). |
|
17421 | 5465 |
This is used to determine, whether debugging is possible/desired or not." |
10641 | 5466 |
|
5467 |
self isPlugin ifTrue:[^ false]. "/ I am a browser-plugin |
|
5468 |
self isSharedLibraryComponent ifTrue:[^ false]. "/ I am a COM-ponent |
|
5469 |
self isSTScript ifTrue:[^ true ]. "/ I am stScript |
|
10999 | 5470 |
^ self isStandAloneApp not. |
10641 | 5471 |
|
5472 |
" |
|
5473 |
Smalltalk isSmalltalkDevelopmentSystem |
|
5474 |
" |
|
5475 |
||
5476 |
"Created: / 10-08-2006 / 13:12:49 / cg" |
|
5477 |
"Modified: / 06-12-2006 / 16:42:56 / cg" |
|
15565 | 5478 |
"Modified (comment): / 27-07-2013 / 15:36:20 / cg" |
10641 | 5479 |
! |
5480 |
||
5481 |
isStandAloneApp |
|
5482 |
"return true, if this is a standAlone application |
|
5483 |
i.e. a stripped & linked application (such as the webServer) |
|
5484 |
in contrast to a full smalltalk (development) system." |
|
5485 |
||
5486 |
^ StandAlone ? false |
|
5487 |
||
5488 |
" |
|
10071 | 5489 |
Smalltalk isStandAloneApp |
9029 | 5490 |
" |
617 | 5491 |
! |
5492 |
||
13947 | 5493 |
isStandAloneDebug |
5494 |
"return true, if this is a standAlone application which |
|
5495 |
was started with the -debug option." |
|
5496 |
||
5497 |
^ DebuggingStandAlone ? false |
|
5498 |
||
5499 |
" |
|
5500 |
Smalltalk isStandAloneDebug |
|
5501 |
" |
|
5502 |
||
5503 |
"Created: / 19-01-2012 / 10:17:41 / cg" |
|
5504 |
! |
|
5505 |
||
10641 | 5506 |
startupArguments |
5507 |
"return the arguments passed to StartupClass when stx gets started. |
|
5508 |
Usually these are nil, |
|
5509 |
but saving an image with a non-nil StartupClass/StartupSelector/StartupArgs allows for |
|
5510 |
a simple way to configure and create stand-alone applications" |
|
5511 |
||
5512 |
^ StartupArguments |
|
5513 |
||
5514 |
" |
|
10071 | 5515 |
Smalltalk startupArguments |
9029 | 5516 |
" |
7563 | 5517 |
! |
5518 |
||
10641 | 5519 |
startupClass |
5520 |
"return the class, that will get the start message when smalltalk |
|
5521 |
starts and its non-nil. Usually this is nil, |
|
5522 |
but saving an image with a non-nil StartupClass/StartupSelector/StartupArgs allows for |
|
5523 |
a simple way to configure and create stand-alone applications" |
|
5524 |
||
5525 |
^ StartupClass |
|
5526 |
||
5527 |
" |
|
10071 | 5528 |
Smalltalk startupClass |
9029 | 5529 |
" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5530 |
! |
8570 | 5531 |
|
10641 | 5532 |
startupClass:aClass selector:aSymbol arguments:anArrayOrNil |
5533 |
"{ Pragma: +optSpace }" |
|
5534 |
||
5535 |
"set the class, selector and arguments to be performed when smalltalk |
|
5536 |
starts. Setting those before saving a snapshot, will make the saved |
|
5537 |
image come up executing your application (instead of the normal mainloop)" |
|
5538 |
||
5539 |
StartupClass := aClass. |
|
5540 |
StartupSelector := aSymbol. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5541 |
StartupArguments := anArrayOrNil |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5542 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5543 |
|
10641 | 5544 |
startupSelector |
5545 |
"return the selector, that will be sent to StartupClass. |
|
5546 |
Usually this is nil, |
|
5547 |
but saving an image with a non-nil StartupClass/StartupSelector allows for |
|
5548 |
a simple way to configure and create stand-alone applications" |
|
5549 |
||
5550 |
^ StartupSelector |
|
5551 |
||
5552 |
" |
|
10071 | 5553 |
Smalltalk startupSelector |
9029 | 5554 |
" |
10641 | 5555 |
! |
5556 |
||
5557 |
wasStartedFromImage |
|
5558 |
"return true, if this smalltalk was started from an image, |
|
5559 |
as opposed to a fresh and clean startup" |
|
5560 |
||
5561 |
^ ImageRestartTime notNil |
|
5562 |
||
5563 |
" |
|
5564 |
Smalltalk wasStartedFromImage |
|
5565 |
" |
|
70 | 5566 |
! ! |
5567 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
5568 |
!Smalltalk class methodsFor:'system environment'! |
1069 | 5569 |
|
10641 | 5570 |
language |
5571 |
"return the language setting" |
|
5572 |
||
5573 |
^ Language |
|
5574 |
||
5575 |
" |
|
5576 |
Smalltalk language |
|
5577 |
" |
|
5578 |
||
5579 |
"Modified: 26.4.1996 / 17:10:05 / cg" |
|
5580 |
! |
|
5581 |
||
5582 |
language:aLanguageSymbol |
|
10991 | 5583 |
"set the language - send out change notifications" |
10641 | 5584 |
|
18733 | 5585 |
aLanguageSymbol ~= Language ifTrue:[ |
22791 | 5586 |
Language := aLanguageSymbol asSymbol. |
5587 |
self changed:#Language |
|
18733 | 5588 |
]. |
10641 | 5589 |
|
5590 |
" |
|
5591 |
Smalltalk language:#de |
|
5592 |
" |
|
5593 |
||
5594 |
"Modified: / 19-10-2006 / 23:17:29 / cg" |
|
21928 | 5595 |
"Modified: / 29-06-2017 / 15:05:04 / stefan" |
10641 | 5596 |
! |
5597 |
||
5598 |
language:aLanguageSymbol territory:aTerritorySymbol |
|
10991 | 5599 |
"set the language & territory - send out change notifications" |
10641 | 5600 |
|
18733 | 5601 |
((Language ~= aLanguageSymbol) or:[ LanguageTerritory ~= aTerritorySymbol]) ifTrue:[ |
22791 | 5602 |
Language := aLanguageSymbol asSymbol. |
5603 |
LanguageTerritory := aTerritorySymbol asSymbol. |
|
5604 |
self changed:#Language |
|
18733 | 5605 |
]. |
10641 | 5606 |
|
5607 |
" |
|
5608 |
Smalltalk language:#de territory:#de |
|
5609 |
" |
|
5610 |
||
5611 |
"Created: / 19-10-2006 / 22:16:22 / cg" |
|
5612 |
"Modified: / 19-10-2006 / 23:17:36 / cg" |
|
5613 |
! |
|
5614 |
||
13212
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5615 |
languageAndTerritory |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5616 |
"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
|
5617 |
|
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5618 |
^ Language , '-' , (LanguageTerritory ? Language) |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5619 |
|
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5620 |
" |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5621 |
Smalltalk languageAndTerritory |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5622 |
" |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5623 |
|
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5624 |
"Created: / 16-01-2011 / 10:19:42 / cg" |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5625 |
! |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5626 |
|
20615 | 5627 |
languageCodeset |
5628 |
^ LanguageCodeset |
|
5629 |
! |
|
5630 |
||
5631 |
languageModifier |
|
5632 |
^ LanguageModifier |
|
5633 |
! |
|
5634 |
||
10641 | 5635 |
languageTerritory |
5636 |
"return the language territory setting" |
|
7563 | 5637 |
|
5638 |
^ LanguageTerritory |
|
5639 |
! |
|
5640 |
||
10641 | 5641 |
languageTerritory:aTerritorySymbol |
10991 | 5642 |
"set the language territory - send out change notifications" |
10641 | 5643 |
|
18924 | 5644 |
aTerritorySymbol ~= LanguageTerritory ifTrue:[ |
22791 | 5645 |
LanguageTerritory := aTerritorySymbol asSymbol. |
5646 |
self changed:#LanguageTerritory |
|
5647 |
]. |
|
5648 |
||
10641 | 5649 |
" |
5650 |
Time now |
|
5651 |
||
5652 |
Smalltalk languageTerritory:#us. |
|
5653 |
Time now |
|
5654 |
||
5655 |
Smalltalk languageTerritory:#de. |
|
5656 |
Time now |
|
5657 |
" |
|
5658 |
||
5659 |
"Modified: / 19-10-2006 / 23:17:40 / cg" |
|
5660 |
! |
|
5661 |
||
5662 |
setLanguage:aLanguageSymbol |
|
10991 | 5663 |
"set the language without change notification" |
10641 | 5664 |
|
5665 |
Language := aLanguageSymbol. |
|
10991 | 5666 |
! |
5667 |
||
5668 |
setLanguage:aLanguageSymbol territory:aTerritorySymbol |
|
5669 |
"set the language & territory - no change notification" |
|
5670 |
||
5671 |
Language := aLanguageSymbol asSymbol. |
|
5672 |
LanguageTerritory := aTerritorySymbol asSymbol. |
|
1069 | 5673 |
! ! |
5674 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
5675 |
!Smalltalk class methodsFor:'system management'! |
70 | 5676 |
|
10641 | 5677 |
compressSources |
5678 |
"{ Pragma: +optSpace }" |
|
5679 |
||
5680 |
"compress the sources file, and remove all method source strings |
|
5681 |
from the system and replace them by refs to a string in the source file. |
|
5682 |
This is a bit different in ST/X than in other smalltalks, |
|
5683 |
since we use per-class sourcefiles for the compiled classes, |
|
5684 |
and a mix of in-memory strings and one-for-all sourceFile for |
|
5685 |
incremental compiled methods. |
|
5686 |
Therefore, only those sources which are not coming from compiled |
|
5687 |
methods are put into the 'st.src' file - all others are untouched. |
|
20811 | 5688 |
This is being automated - so don't care for now." |
10641 | 5689 |
|
5690 |
|newStream table source pos fileName| |
|
5691 |
||
5692 |
" |
|
5693 |
first, find all methods which contain either a string-ref |
|
5694 |
or an external string in the 'st.src' file |
|
5695 |
" |
|
5696 |
newStream := 'src.tmp' asFilename writeStream. |
|
5697 |
||
5698 |
table := IdentityDictionary new:100. |
|
5699 |
||
5700 |
Method allSubInstancesDo:[:aMethod | |
|
22791 | 5701 |
source := nil. |
5702 |
aMethod sourcePosition notNil ifTrue:[ |
|
5703 |
aMethod sourceFilename = 'st.src' ifTrue:[ |
|
5704 |
source := aMethod source. |
|
5705 |
] |
|
5706 |
] ifFalse:[ |
|
5707 |
source := aMethod source |
|
5708 |
]. |
|
5709 |
||
5710 |
source notNil ifTrue:[ |
|
5711 |
pos := newStream position + 1. |
|
5712 |
newStream nextChunkPut:source. |
|
5713 |
||
5714 |
" |
|
5715 |
dont change the methods info - maybe some write error |
|
5716 |
occurs later, in that case we abort and leave everything |
|
5717 |
untouched. |
|
5718 |
" |
|
5719 |
table at:aMethod put:pos |
|
5720 |
] |
|
11655
4306fb61b9f8
sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents:
11624
diff
changeset
|
5721 |
]. |
4306fb61b9f8
sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents:
11624
diff
changeset
|
5722 |
|
4306fb61b9f8
sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents:
11624
diff
changeset
|
5723 |
newStream syncData; close. |
10641 | 5724 |
|
5725 |
" |
|
5726 |
now, rename the new source file, |
|
5727 |
" |
|
5728 |
fileName := (ObjectMemory nameForSources). |
|
5729 |
'src.tmp' asFilename renameTo:fileName. |
|
5730 |
||
5731 |
"good - now go over all changed methods, and change their |
|
5732 |
source reference" |
|
5733 |
||
5734 |
table keysAndValuesDo:[:aMethod :pos | |
|
22791 | 5735 |
aMethod localSourceFilename:fileName position:pos. |
10641 | 5736 |
"/ aMethod printCR. |
5737 |
]. |
|
5738 |
||
5739 |
" |
|
5740 |
Smalltalk compressSources |
|
5741 |
" |
|
5742 |
||
5743 |
"Modified: 16.1.1997 / 01:25:58 / cg" |
|
5744 |
! |
|
5745 |
||
5746 |
generateSingleSourceFile |
|
5747 |
"{ Pragma: +optSpace }" |
|
5748 |
||
5749 |
"generate the sources file, and remove all method source strings |
|
5750 |
from the system and replace them by refs to a string in the source file. |
|
5751 |
This makes the image independent from the per-class source files |
|
5752 |
and makes transportation of endUser applications easier, since |
|
5753 |
only 3 files (executable, image and sourceFile) need to be |
|
5754 |
transported." |
|
5755 |
||
5756 |
|newStream table source pos fileName| |
|
5757 |
||
5758 |
newStream := 'src.tmp' asFilename writeStream. |
|
5759 |
||
5760 |
table := IdentityDictionary new:100. |
|
5761 |
||
5762 |
Method allSubInstancesDo:[:aMethod | |
|
22791 | 5763 |
source := aMethod source. |
5764 |
source notNil ifTrue:[ |
|
5765 |
pos := newStream position + 1. |
|
5766 |
newStream nextChunkPut:source. |
|
5767 |
||
5768 |
" |
|
5769 |
don't change the method's info - maybe some write error |
|
5770 |
occurs later, in that case we abort and leave everything |
|
5771 |
untouched. |
|
5772 |
" |
|
5773 |
table at:aMethod put:pos |
|
5774 |
] |
|
11655
4306fb61b9f8
sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents:
11624
diff
changeset
|
5775 |
]. |
4306fb61b9f8
sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents:
11624
diff
changeset
|
5776 |
|
4306fb61b9f8
sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents:
11624
diff
changeset
|
5777 |
newStream syncData; close. |
10641 | 5778 |
|
5779 |
" |
|
5780 |
now, rename the new source file, |
|
5781 |
" |
|
5782 |
fileName := (ObjectMemory nameForSources). |
|
5783 |
'src.tmp' asFilename renameTo:fileName. |
|
5784 |
||
5785 |
"good - now go over all changed methods, and change their |
|
5786 |
source reference" |
|
5787 |
||
5788 |
table keysAndValuesDo:[:aMethod :pos | |
|
22791 | 5789 |
aMethod localSourceFilename:fileName position:pos. |
10641 | 5790 |
"/ aMethod printCR. |
5791 |
]. |
|
5792 |
||
5793 |
" |
|
5794 |
Smalltalk generateSingleSourceFile |
|
5795 |
" |
|
5796 |
||
22373 | 5797 |
"Modified: / 16-01-1997 / 01:25:58 / cg" |
5798 |
"Created: / 17-10-1997 / 13:00:56 / cg" |
|
5799 |
"Modified (comment): / 21-11-2017 / 13:08:41 / cg" |
|
10641 | 5800 |
! |
5801 |
||
15596 | 5802 |
installAutoloadedClassFromSourceFile:aFilename |
5803 |
"install aFilename (which must be a smalltalk source file) as autoloaded class |
|
5804 |
(extract the class definition chunk from the file and create an autoloaded |
|
5805 |
class stub for it)" |
|
5806 |
||
5807 |
|chunks filename| |
|
5808 |
||
5809 |
filename := aFilename asFilename. |
|
5810 |
||
5811 |
ChangeSet::InvalidChangeChunkError handle:[:ex | |
|
18668 | 5812 |
^ self |
15596 | 5813 |
] do:[ |
18668 | 5814 |
filename readingFileDo:[:s| |
5815 |
chunks := ChangeSet fromStream:s while:[:chunk | chunk isMethodChange not]. |
|
5816 |
]. |
|
16170
ca4d03def070
endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents:
16164
diff
changeset
|
5817 |
]. |
ca4d03def070
endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents:
16164
diff
changeset
|
5818 |
|
ca4d03def070
endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents:
16164
diff
changeset
|
5819 |
chunks |
18668 | 5820 |
select:[:eachChunk | eachChunk isClassDefinitionChange] |
5821 |
thenDo:[:eachClassChunk | |
|
5822 |
eachClassChunk installAsAutoloadedClassIfPublicWithFilename:filename asAbsoluteFilename "withoutSuffix" name "baseName" |
|
5823 |
]. |
|
15596 | 5824 |
|
5825 |
"Created: / 01-08-2013 / 16:57:26 / cg" |
|
5826 |
! |
|
5827 |
||
10641 | 5828 |
installAutoloadedClassNamed:clsName category:cat package:package revision:revisionOrNil |
5829 |
"create & install an autoload stub for a class named: clsName, |
|
5830 |
to be loaded from package. |
|
5831 |
If revisionOrNil is non-nil, set it up to load exactly that revision |
|
5832 |
(otherwise, the newest revision will be loaded" |
|
5833 |
||
5834 |
^ self |
|
18668 | 5835 |
installAutoloadedClassNamed:clsName |
5836 |
category:cat |
|
5837 |
package:package |
|
5838 |
revision:revisionOrNil |
|
5839 |
numClassInstVars:nil. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5840 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5841 |
|
10641 | 5842 |
installAutoloadedClassNamed:clsName category:cat package:package revision:revisionOrNil numClassInstVars:numClassInstVarsOrNil |
5843 |
"create & install an autoload stub for a class named: clsName, |
|
5844 |
to be loaded from package. |
|
5845 |
If revisionOrNil is non-nil, set it up to load exactly that revision |
|
5846 |
(otherwise, the newest revision will be loaded" |
|
5847 |
||
5848 |
|clsSym cls| |
|
5849 |
||
5850 |
clsSym := clsName asSymbol. |
|
5851 |
||
5852 |
"/ install if not already compiled-in |
|
5853 |
(cls := self at:clsSym) isNil ifTrue:[ |
|
18668 | 5854 |
Autoload subclass:clsSym |
5855 |
instanceVariableNames:'' |
|
5856 |
classVariableNames:'' |
|
5857 |
poolDictionaries:'' |
|
5858 |
category:cat |
|
5859 |
inEnvironment:Smalltalk. |
|
5860 |
||
5861 |
cls := self at:clsSym. |
|
5862 |
cls isNil ifTrue:[ |
|
5863 |
('Smalltalk [warning]: failed to install ' , clsName , ' as autoloaded.') infoPrintCR. |
|
5864 |
] ifFalse:[ |
|
5865 |
cls package:package asSymbol. |
|
5866 |
revisionOrNil notNil ifTrue:[ |
|
5867 |
cls setBinaryRevision:revisionOrNil |
|
5868 |
] |
|
5869 |
] |
|
10641 | 5870 |
] ifFalse:[ |
18668 | 5871 |
"/ class already present - however, if unloaded, check for category/package change |
5872 |
cls isLoaded ifFalse:[ |
|
5873 |
package ~= cls package ifTrue:[ |
|
5874 |
cls withoutUpdatingChangesDo:[ |
|
5875 |
cls package:package asSymbol. |
|
5876 |
]. |
|
5877 |
]. |
|
5878 |
cat ~= cls category ifTrue:[ |
|
5879 |
cls withoutUpdatingChangesDo:[ |
|
5880 |
cls category:cat. |
|
5881 |
]. |
|
5882 |
]. |
|
5883 |
]. |
|
10641 | 5884 |
]. |
5885 |
^ cls. |
|
5886 |
||
5887 |
"Created: / 05-11-1998 / 15:10:25 / cg" |
|
5888 |
"Modified: / 16-01-2007 / 12:56:18 / cg" |
|
11169
32fda240ee57
#installAutoloadedClassNamed:category:package:revision:numClassInstVars:
Stefan Vogel <sv@exept.de>
parents:
11153
diff
changeset
|
5889 |
|
10641 | 5890 |
! |
5891 |
||
5892 |
installAutoloadedClasses |
|
11679
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
5893 |
"scan all packages and install all classes found there as |
10641 | 5894 |
autoloaded. This takes some time ..." |
5895 |
||
11679
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
5896 |
|dirsConsulted| |
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
5897 |
|
17588 | 5898 |
LoadInProgressQuery answerNotifyLoadingDo:[ |
18668 | 5899 |
dirsConsulted := Set new. |
5900 |
||
5901 |
"/ along the package-path |
|
5902 |
self packagePath do:[:eachPathComponent | |
|
5903 |
(dirsConsulted includes:eachPathComponent) ifFalse:[ |
|
5904 |
self |
|
5905 |
recursiveInstallAutoloadedClassesFrom:eachPathComponent |
|
5906 |
rememberIn:dirsConsulted |
|
5907 |
maxLevels:15 |
|
5908 |
noAutoload:false |
|
5909 |
packageTop:eachPathComponent |
|
5910 |
showSplashInLevels:2. |
|
5911 |
] |
|
5912 |
]. |
|
5913 |
self splashInfo:nil. |
|
17548 | 5914 |
]. |
10641 | 5915 |
|
5916 |
" |
|
5917 |
Smalltalk installAutoloadedClasses |
|
5918 |
" |
|
5919 |
||
5920 |
"Created: / 14.2.1997 / 17:32:57 / cg" |
|
5921 |
"Modified: / 13.12.1999 / 11:56:50 / cg" |
|
5922 |
! |
|
5923 |
||
5924 |
installAutoloadedClassesFrom:anAbbrevFilePath |
|
5925 |
"read the given abbreviation file; install all classes found there as |
|
5926 |
autoloaded. This takes some time ..." |
|
5927 |
||
5928 |
|f s| |
|
5929 |
||
5930 |
f := self getSystemFileName:anAbbrevFilePath. |
|
5931 |
f isNil ifTrue:[f := self getPackageFileName:anAbbrevFilePath]. |
|
5932 |
||
5933 |
f notNil ifTrue:[ |
|
22791 | 5934 |
f := f asFilename. |
5935 |
f isDirectory ifTrue:[ |
|
5936 |
f := f construct:'abbrev.stc' |
|
5937 |
]. |
|
5938 |
[ |
|
5939 |
s := f readStream. |
|
5940 |
self installAutoloadedClassesFromStream:s. |
|
5941 |
s close. |
|
5942 |
] on:FileStream openErrorSignal |
|
5943 |
do:[:ex| "do nothing"]. |
|
10641 | 5944 |
] |
5945 |
||
5946 |
" |
|
5947 |
Smalltalk installAutoloadedClassesFrom:'include/abbrev.stc' |
|
19911 | 5948 |
Smalltalk installAutoloadedClassesFrom:'../../goodies/communication/abbrev.stc' |
10641 | 5949 |
" |
5950 |
||
5951 |
"Modified: / 5.11.1998 / 15:10:51 / cg" |
|
5952 |
! |
|
5953 |
||
13531
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
5954 |
installAutoloadedClassesFromAbbrevFile:aFilename |
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
5955 |
aFilename readingFileDo:[:abbrevStream | |
22791 | 5956 |
self installAutoloadedClassesFromStream:abbrevStream. |
13531
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
5957 |
] |
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
5958 |
|
19911 | 5959 |
" |
5960 |
self installAutoloadedClassesFromAbbrevFile:('../../goodies/communication/abbrev.stc' asFilename) |
|
5961 |
" |
|
22791 | 5962 |
|
13531
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
5963 |
"Created: / 29-07-2011 / 20:39:21 / cg" |
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
5964 |
! |
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
5965 |
|
10641 | 5966 |
installAutoloadedClassesFromStream:anAbbrevFileStream |
5967 |
"read the given abbreviation file; |
|
5968 |
install all classes found there as autoloaded, and also update the |
|
5969 |
abbreviation (className-to-fileName mapping) table. |
|
5970 |
This takes some time ..." |
|
5971 |
||
5972 |
|s2 l abbrevFileName info clsName cls abbrev package cat numClassInstVars words w| |
|
5973 |
||
5974 |
anAbbrevFileStream isFileStream ifTrue:[ |
|
22791 | 5975 |
abbrevFileName := anAbbrevFileStream pathName. |
5976 |
info := 'declared from: ', abbrevFileName. |
|
10641 | 5977 |
]. |
5978 |
||
5979 |
"/ yes, create any required nameSpace, without asking user. |
|
5980 |
Class createNameSpaceQuerySignal answer:true do:[ |
|
5981 |
||
22791 | 5982 |
[anAbbrevFileStream atEnd] whileFalse:[ |
5983 |
l := anAbbrevFileStream nextLine withoutSeparators. |
|
5984 |
"Skip empty lines and comments" |
|
5985 |
(l notEmpty and:[l first ~= $#]) ifTrue:[ |
|
5986 |
"/ must do it manually, caring for quoted strings. |
|
10641 | 5987 |
"/ words := line asCollectionOfWords. |
5988 |
||
22791 | 5989 |
words := OrderedCollection new. |
5990 |
s2 := l readStream. |
|
5991 |
[s2 atEnd] whileFalse:[ |
|
5992 |
s2 skipSeparators. |
|
5993 |
s2 peek == $' ifTrue:[ |
|
5994 |
s2 next. |
|
5995 |
w := s2 upTo:$'. |
|
5996 |
s2 skipSeparators. |
|
5997 |
] ifFalse:[ |
|
5998 |
w := s2 upToSeparator |
|
5999 |
]. |
|
6000 |
words add:w |
|
6001 |
]. |
|
6002 |
words size < 3 ifTrue:[ |
|
6003 |
'Smalltalk [warning]: bad abbrev entry' errorPrint. |
|
6004 |
anAbbrevFileStream isFileStream ifTrue:[ |
|
6005 |
' (in ''' errorPrint. |
|
6006 |
anAbbrevFileStream pathName errorPrint. |
|
6007 |
''')' errorPrint |
|
6008 |
]. |
|
6009 |
': ' errorPrint. l errorPrintCR |
|
6010 |
] ifFalse:[ |
|
6011 |
clsName := (words at:1) asSymbol. |
|
6012 |
abbrev := (words at:2). |
|
6013 |
package := (words at:3) asSymbol. |
|
6014 |
cat := words at:4 ifAbsent:nil. |
|
6015 |
numClassInstVars := words at:5 ifAbsent:'0'. |
|
6016 |
numClassInstVars := Integer readFrom:numClassInstVars onError:[0]. |
|
6017 |
||
6018 |
(cat size == 0) ifTrue:[ |
|
6019 |
cat := 'autoloaded' |
|
6020 |
]. |
|
6021 |
||
6022 |
"/ on the fly, update the abbreviations |
|
6023 |
self setFilename:abbrev forClass:clsName package:package. |
|
6024 |
||
6025 |
"/ ' autoloaded: ' print. clsName print. ' in ' print. cat printCR. |
|
6026 |
||
6027 |
cls := self |
|
6028 |
installAutoloadedClassNamed:clsName |
|
6029 |
category:cat |
|
6030 |
package:package |
|
6031 |
revision:nil |
|
6032 |
numClassInstVars:numClassInstVars. |
|
10641 | 6033 |
|
6034 |
"/ info notNil ifTrue:[ |
|
6035 |
"/ cls setComment:info. |
|
6036 |
"/ ]. |
|
22791 | 6037 |
] |
6038 |
] |
|
6039 |
] |
|
4458 | 6040 |
] |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6041 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6042 |
|
10641 | 6043 |
loadBinaries |
6044 |
"return true, if binaries should be loaded into the system, |
|
6045 |
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
|
6046 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6047 |
^ LoadBinaries |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6048 |
! |
3044 | 6049 |
|
10641 | 6050 |
loadBinaries:aBoolean |
6051 |
"{ Pragma: +optSpace }" |
|
6052 |
||
6053 |
"turn on/off loading of binary objects" |
|
6054 |
||
6055 |
aBoolean ifTrue:[ |
|
18668 | 6056 |
(ObjectFileLoader notNil and:[ObjectFileLoader canLoadObjectFiles]) ifTrue:[ |
6057 |
LoadBinaries := true. |
|
6058 |
^ self |
|
6059 |
]. |
|
6060 |
'Smalltalk [info]: this system does not support binary loading' infoPrintCR. |
|
10641 | 6061 |
]. |
6062 |
LoadBinaries := false |
|
6063 |
||
6064 |
"Modified: 10.1.1997 / 15:11:00 / cg" |
|
6065 |
! |
|
6066 |
||
6067 |
logDoits |
|
6068 |
"return true if doits should go into the changes file |
|
6069 |
as well as changes - by default, this is off, since |
|
6070 |
it can blow up the changes file enormously ... |
|
6071 |
" |
|
6072 |
||
6073 |
^ LogDoits |
|
6074 |
||
6075 |
" |
|
6076 |
LogDoits := false |
|
3044 | 6077 |
LogDoits := true |
6078 |
" |
|
6079 |
! |
|
6080 |
||
10641 | 6081 |
logDoits:aBoolean |
6082 |
"{ Pragma: +optSpace }" |
|
6083 |
||
6084 |
"turn on/off logging of doits in the changes file. |
|
6085 |
By default, this is off, since it can blow up the |
|
6086 |
changes file enormously ... |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6087 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6088 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6089 |
LogDoits := aBoolean |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6090 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6091 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6092 |
|
10641 | 6093 |
makeBytecodeMethods |
6094 |
"{ Pragma: +optSpace }" |
|
6095 |
||
6096 |
"walk over all methods and make each a bytecode method |
|
6097 |
iff it does not contain primitive C code. |
|
6098 |
Experimental and not yet used." |
|
6099 |
||
6100 |
Method allSubInstancesDo:[:aMethod | |
|
22791 | 6101 |
|newMethod| |
6102 |
||
6103 |
aMethod hasPrimitiveCode ifFalse:[ |
|
18707 | 6104 |
"/ aMethod errorPrintCR. |
22791 | 6105 |
newMethod := aMethod asByteCodeMethod. |
6106 |
newMethod ~~ aMethod ifTrue:[ |
|
6107 |
newMethod isNil ifTrue:[ |
|
6108 |
'Smalltalk>>makeBytecodeMethods could nor recompile: ' errorPrint. aMethod errorPrintCR. |
|
6109 |
] ifFalse:[ |
|
6110 |
aMethod becomeSameAs:newMethod |
|
6111 |
]. |
|
6112 |
] |
|
6113 |
]. |
|
10641 | 6114 |
]. |
6115 |
||
6116 |
" |
|
6117 |
Smalltalk makeBytecodeMethods |
|
6118 |
" |
|
6119 |
||
6120 |
"Modified: 16.1.1997 / 01:25:58 / cg" |
|
6121 |
"Created: 17.10.1997 / 13:52:19 / cg" |
|
6122 |
! |
|
6123 |
||
14269
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6124 |
recursiveInstallAutoloadedClassesFrom:aTopDirectory |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6125 |
"scan all packages and install all classes found there as |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6126 |
autoloaded. This takes some time ..." |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6127 |
|
23408 | 6128 |
self recursiveInstallAutoloadedClassesFrom:aTopDirectory maxLevels:15 |
14269
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6129 |
|
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6130 |
" |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6131 |
Smalltalk recursiveInstallAutoloadedClassesFrom:'..\..\..\cg\private\euler' |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6132 |
" |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6133 |
|
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6134 |
"Created: / 31-07-2012 / 15:27:40 / cg" |
23408 | 6135 |
"Modified: / 09-10-2018 / 11:10:25 / Claus Gittinger" |
6136 |
! |
|
6137 |
||
6138 |
recursiveInstallAutoloadedClassesFrom:aTopDirectory maxLevels:maxLevels |
|
6139 |
"scan all packages and install all classes found there as |
|
6140 |
autoloaded. This takes some time ..." |
|
6141 |
||
6142 |
|dirsConsulted| |
|
6143 |
||
6144 |
dirsConsulted := Set new. |
|
6145 |
||
6146 |
self |
|
6147 |
recursiveInstallAutoloadedClassesFrom:aTopDirectory |
|
6148 |
rememberIn:dirsConsulted |
|
6149 |
maxLevels:maxLevels |
|
6150 |
noAutoload:false |
|
6151 |
packageTop:nil |
|
6152 |
showSplashInLevels:-1. |
|
6153 |
||
6154 |
" |
|
6155 |
Smalltalk recursiveInstallAutoloadedClassesFrom:'..\..\..\cg\private\euler' |
|
6156 |
" |
|
6157 |
||
6158 |
"Created: / 09-10-2018 / 11:10:06 / Claus Gittinger" |
|
14269
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6159 |
! |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6160 |
|
10641 | 6161 |
recursiveInstallAutoloadedClassesFrom:aDirectory rememberIn:dirsConsulted maxLevels:maxLevels noAutoload:noAutoloadIn packageTop:packageTopPath |
6162 |
"read all abbrev.stc files from and under aDirectory |
|
6163 |
and install autoloaded classes. |
|
15783 | 6164 |
If a file called NOAUTOLOAD is found, no classes there are installed as autoloaded, |
6165 |
but classes in subdirectories are installed, if the subdirectory contains a file |
|
6166 |
named AUTOLOAD. |
|
6167 |
If a file called NOSUBAUTOLOAD is found, no classes there and below are installed as autoloaded. |
|
10641 | 6168 |
If a file called NOPACKAGES is found, no further searching is done in that directory or below." |
6169 |
||
11391 | 6170 |
self |
18668 | 6171 |
recursiveInstallAutoloadedClassesFrom:aDirectory rememberIn:dirsConsulted |
6172 |
maxLevels:maxLevels noAutoload:noAutoloadIn packageTop:packageTopPath |
|
6173 |
showSplashInLevels:0. |
|
11391 | 6174 |
|
6175 |
" |
|
6176 |
Smalltalk installAutoloadedClasses |
|
6177 |
" |
|
6178 |
||
6179 |
"Modified: / 17-08-2006 / 16:48:43 / cg" |
|
6180 |
! |
|
6181 |
||
12022 | 6182 |
recursiveInstallAutoloadedClassesFrom:aDirectory rememberIn:dirsConsulted |
11391 | 6183 |
maxLevels:maxLevels noAutoload:noAutoloadIn packageTop:packageTopPath |
6184 |
showSplashInLevels:showSplashInLevels |
|
6185 |
"read all abbrev.stc files from and under aDirectory |
|
6186 |
and install autoloaded classes. |
|
15783 | 6187 |
If a file called NOAUTOLOAD is found, no classes there are installed as autoloaded, |
6188 |
but classes in subdirectories are installed, if the subdirectory contains a file |
|
6189 |
named AUTOLOAD. |
|
6190 |
If a file called NOSUBAUTOLOAD is found, no classes there and below are installed as autoloaded. |
|
11391 | 6191 |
If a file called NOPACKAGES is found, no further searching is done in that directory or below." |
6192 |
||
15783 | 6193 |
|dir noAutoloadHere dirName directoryContents haveAbbrevDotSTC| |
10641 | 6194 |
|
6195 |
dir := aDirectory asFilename. |
|
15958 | 6196 |
|
6197 |
"/ Care for non-existent directories" |
|
6198 |
dir exists ifFalse:[ ^ self ]. |
|
6199 |
||
15783 | 6200 |
dirName := dir physicalPathName. "take care of symbolic links" |
11392 | 6201 |
|
6202 |
(dirsConsulted includes:dirName) ifTrue:[ |
|
22791 | 6203 |
^ self |
10641 | 6204 |
]. |
6205 |
||
12377 | 6206 |
(dir / 'NOPACKAGES') exists ifTrue:[ |
22791 | 6207 |
^ self. |
10641 | 6208 |
]. |
12377 | 6209 |
(dir / 'NOSUBAUTOLOAD') exists ifTrue:[ |
22791 | 6210 |
^ self. |
10641 | 6211 |
]. |
11392 | 6212 |
|
15783 | 6213 |
maxLevels == 0 ifTrue:[ |
22791 | 6214 |
Transcript showCR:('Autoload: max directory nesting reached in %1' bindWith:dir pathName). |
6215 |
^ self |
|
15783 | 6216 |
]. |
6217 |
||
6218 |
dirsConsulted add:dirName. |
|
10641 | 6219 |
noAutoloadHere := noAutoloadIn. |
6220 |
noAutoloadHere ifFalse:[ |
|
22791 | 6221 |
(dir / 'NOAUTOLOAD') exists ifTrue:[ |
6222 |
noAutoloadHere := true. |
|
6223 |
]. |
|
10641 | 6224 |
] ifTrue:[ |
22791 | 6225 |
(dir / 'AUTOLOAD') exists ifTrue:[ |
6226 |
noAutoloadHere := false. |
|
6227 |
]. |
|
10641 | 6228 |
]. |
6229 |
||
11393 | 6230 |
showSplashInLevels >= 0 ifTrue:[ |
22791 | 6231 |
self showSplashMessage:('Smalltalk [info]: installing autoloaded classes found under "%1"...' |
6232 |
bindWith:(dirName contractAtBeginningTo:35)). |
|
11392 | 6233 |
]. |
6234 |
||
10641 | 6235 |
"/ |
6236 |
"/ suppress installation as autoloaded in this and everything |
|
6237 |
"/ below; however, still traverse the directories to find packages ... |
|
6238 |
"/ |
|
15596 | 6239 |
haveAbbrevDotSTC := false. |
10641 | 6240 |
noAutoloadHere ifFalse:[ |
22791 | 6241 |
[ |
6242 |
self installAutoloadedClassesFromAbbrevFile:(dir / 'abbrev.stc'). |
|
6243 |
haveAbbrevDotSTC := true. |
|
6244 |
] on:FileStream openErrorSignal |
|
6245 |
do:[:ex| |
|
6246 |
"ignore this file" |
|
6247 |
]. |
|
10641 | 6248 |
]. |
6249 |
||
6250 |
[ |
|
22791 | 6251 |
directoryContents := dir directoryContents. |
10641 | 6252 |
] on:FileStream openErrorSignal do:[:ex| |
22791 | 6253 |
"non-accessible directory: we are done" |
6254 |
^ self |
|
16199 | 6255 |
]. |
6256 |
||
6257 |
directoryContents := directoryContents select:[:fn | (fn startsWith:'.') not] as:Set. |
|
10641 | 6258 |
|
12911
0822e257daeb
comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents:
12883
diff
changeset
|
6259 |
directoryContents removeAllFoundIn:#( |
22791 | 6260 |
'objbc' 'objvc' 'objmingw' |
6261 |
'doc' |
|
6262 |
'CVS' |
|
6263 |
'bitmaps' |
|
6264 |
'resources' |
|
6265 |
'source' |
|
6266 |
'not_delivered' |
|
6267 |
'not_ported' |
|
6268 |
). |
|
12911
0822e257daeb
comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents:
12883
diff
changeset
|
6269 |
dir baseName = 'stx' ifTrue:[ |
22791 | 6270 |
directoryContents removeAllFoundIn:#( |
6271 |
'configurations' |
|
6272 |
'include' |
|
6273 |
'rules' |
|
6274 |
'stc' |
|
6275 |
'support' |
|
6276 |
). |
|
12911
0822e257daeb
comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents:
12883
diff
changeset
|
6277 |
]. |
0822e257daeb
comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents:
12883
diff
changeset
|
6278 |
|
0822e257daeb
comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents:
12883
diff
changeset
|
6279 |
directoryContents do:[:eachFilenameString | |
22791 | 6280 |
|f| |
6281 |
||
6282 |
f := dir / eachFilenameString. |
|
6283 |
f isDirectory ifTrue:[ |
|
6284 |
self |
|
6285 |
recursiveInstallAutoloadedClassesFrom:f |
|
6286 |
rememberIn:dirsConsulted |
|
6287 |
maxLevels:maxLevels-1 |
|
6288 |
noAutoload:noAutoloadHere |
|
6289 |
packageTop:packageTopPath |
|
6290 |
showSplashInLevels:showSplashInLevels - 1. |
|
6291 |
] ifFalse:[ |
|
6292 |
(noAutoloadHere not and:[haveAbbrevDotSTC not]) ifTrue:[ |
|
6293 |
f suffix = 'st' ifTrue:[ |
|
6294 |
[ |
|
6295 |
self installAutoloadedClassFromSourceFile:f. |
|
6296 |
f directory baseName = 'libbasic' ifTrue:[self halt]. |
|
6297 |
] on:FileStream openErrorSignal do:[:ex| |
|
6298 |
"ignore this file, but write a warning" |
|
6299 |
Transcript showCR:('Autoload: cannot install %1. (%2)' bindWith:f pathName with:ex description). |
|
6300 |
]. |
|
6301 |
] |
|
6302 |
]. |
|
6303 |
] |
|
10641 | 6304 |
]. |
6305 |
||
11393 | 6306 |
showSplashInLevels >= 0 ifTrue:[ |
22791 | 6307 |
self showSplashMessage:('Smalltalk [info]: installing autoloaded classes from "%1"...' |
6308 |
bindWith:(dirName contractAtBeginningTo:35)). |
|
11392 | 6309 |
]. |
6310 |
||
10641 | 6311 |
" |
6312 |
Smalltalk installAutoloadedClasses |
|
6313 |
" |
|
6314 |
||
15596 | 6315 |
"Modified: / 01-08-2013 / 16:57:49 / cg" |
10641 | 6316 |
! |
6317 |
||
6318 |
replaceReferencesTo:anObject with:newRef |
|
12194
208afdcf182b
comment/format in: #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
12172
diff
changeset
|
6319 |
"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
|
6320 |
Return true, if any reference was changed. |
208afdcf182b
comment/format in: #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
12172
diff
changeset
|
6321 |
Notice: this does not change the class-reference." |
208afdcf182b
comment/format in: #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
12172
diff
changeset
|
6322 |
|
10641 | 6323 |
|toAdd| |
6324 |
||
6325 |
toAdd := OrderedCollection new. |
|
6326 |
self keysAndValuesDo:[:key :val | |
|
18668 | 6327 |
(key == anObject) ifTrue:[ |
6328 |
self shouldImplement. |
|
6329 |
]. |
|
6330 |
(val == anObject ) ifTrue:[ |
|
6331 |
toAdd add:(key -> newRef) |
|
6332 |
]. |
|
10641 | 6333 |
]. |
6334 |
toAdd do:[:each | |
|
18668 | 6335 |
self at:(each key) put:(each value) |
10641 | 6336 |
]. |
6337 |
! |
|
6338 |
||
6339 |
saveEmergencyImage:aBoolean |
|
6340 |
"set/clear the flag which controls if ST/X should save an |
|
6341 |
emergency image in case of a broken display connection. |
|
6342 |
The default is true. |
|
6343 |
This may be useful, if you work with an unsecure display |
|
6344 |
(serial line), and want to have a chance of proceeding after |
|
6345 |
a crash. In multiheaded applications, this only affects |
|
6346 |
crashes of the master Display connection (the initial connection); |
|
6347 |
errors on other displays are reported to the views and treated |
|
6348 |
like window destroy from the windowManager." |
|
6349 |
||
6350 |
SaveEmergencyImage := aBoolean |
|
6351 |
||
6352 |
"Modified: / 24.10.1997 / 18:22:26 / cg" |
|
6353 |
! |
|
6354 |
||
6355 |
systemOrganization |
|
6356 |
"for partial ST80 compatibility; |
|
6357 |
In ST80, Smalltalk organization returns a systemOrganizer, which |
|
6358 |
keeps track of class-categories, while all classes return a classOrganizer |
|
6359 |
from #organization, which keeps track of method categories of that class. |
|
6360 |
Since in ST/X, Smalltalk is a class, there is now a conflict. |
|
6361 |
To make a workaround possible, use #systemOrganization when porting |
|
6362 |
VW apps to ST/X to get the class-categories. |
|
6363 |
Read the documentation in SystemOrganizer for more info." |
|
6364 |
||
6365 |
^ SystemOrganizer for:nil |
|
6366 |
||
6367 |
"Created: / 20.6.1998 / 12:24:02 / cg" |
|
6368 |
"Modified: / 20.6.1998 / 12:41:34 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6369 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6370 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6371 |
!Smalltalk class methodsFor:'system management-fileIn'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6372 |
|
23419 | 6373 |
fileIn:aFileNameOrString |
10641 | 6374 |
"read in the named file - look for it in some standard places; |
6375 |
return true if ok, false if failed. |
|
6376 |
This method can load almost anything which makes sense: |
|
23419 | 6377 |
.st - source files |
6378 |
.cls - binary smalltalk bytecode files |
|
6379 |
.so - binary compiled machine code class libraries |
|
6380 |
[.class - java bytecode -- soon to come]" |
|
6381 |
||
6382 |
^ self fileIn:aFileNameOrString lazy:nil silent:nil logged:false |
|
10641 | 6383 |
|
6384 |
" |
|
6385 |
Smalltalk fileIn:'source/TicTacToe.st' |
|
6386 |
Smalltalk fileIn:'binary/TicTacToe.cls' |
|
6387 |
Smalltalk fileIn:'binary/TicTacToe.so' |
|
6388 |
" |
|
6389 |
||
6390 |
"Created: 28.10.1995 / 17:06:28 / cg" |
|
6391 |
! |
|
6392 |
||
6393 |
fileIn:aFileName inPackage:aPackageID |
|
6394 |
"read in the named file in a packages directory." |
|
6395 |
||
6396 |
|dir| |
|
6397 |
||
6398 |
dir := self getPackageDirectoryForPackage:aPackageID. |
|
6399 |
dir isNil ifTrue:[^ false]. |
|
6400 |
||
6401 |
dir := dir asFilename. |
|
6402 |
^ (self fileIn:(dir construct:aFileName)) |
|
6403 |
or:[ self fileIn:((dir construct:'source') construct:aFileName) ] |
|
6404 |
! |
|
6405 |
||
6406 |
fileIn:aFileName lazy:lazy |
|
6407 |
"read in the named file - look for it in some standard places; |
|
6408 |
return true if ok, false if failed. |
|
6409 |
If lazy is true, no code is generated for methods, instead stubs |
|
6410 |
are created which compile themself when first executed. This allows |
|
6411 |
for much faster fileIn (but slows down the first execution later). |
|
6412 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
6413 |
code which is known to be syntactically correct." |
|
6414 |
||
6415 |
^ self fileIn:aFileName lazy:lazy silent:nil logged:false |
|
6416 |
||
6417 |
" |
|
6418 |
Smalltalk fileIn:'source/TicTacToe.st' lazy:true |
|
6419 |
" |
|
6420 |
||
6421 |
"Created: 28.10.1995 / 17:06:36 / cg" |
|
6422 |
! |
|
6423 |
||
6424 |
fileIn:aFileName lazy:lazy silent:silent |
|
6425 |
"read in the named file - look for it in some standard places; |
|
6426 |
return true if ok, false if failed. |
|
6427 |
If lazy is true, no code is generated for methods, instead stubs |
|
6428 |
are created which compile themself when first executed. This allows |
|
6429 |
for much faster fileIn (but slows down the first execution later). |
|
6430 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
6431 |
code which is known to be syntactically correct. |
|
6432 |
If silent is true, no compiler messages are output to the transcript. |
|
6433 |
Giving nil for silent/lazy will use the current settings." |
|
6434 |
||
6435 |
^ self fileIn:aFileName lazy:lazy silent:silent logged:false |
|
6436 |
||
6437 |
"Created: 28.10.1995 / 17:06:41 / cg" |
|
6438 |
! |
|
6439 |
||
6440 |
fileIn:aFileNameOrString lazy:lazy silent:silent logged:logged |
|
6441 |
"read in the named file - look for it in some standard places; |
|
6442 |
return true if ok, false if failed. |
|
6443 |
If lazy is true, no code is generated for methods, instead stubs |
|
6444 |
are created which compile themself when first executed. This allows |
|
6445 |
for much faster fileIn (but slows down the first execution later). |
|
6446 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
6447 |
code which is known to be syntactically correct. |
|
6448 |
If silent is true, no compiler messages are output to the transcript. |
|
6449 |
Giving nil for silent/lazy will use the current settings. |
|
6450 |
This method can load almost anything which makes sense: |
|
22791 | 6451 |
.st - source files |
6452 |
.cls - binary smalltalk bytecode files |
|
6453 |
.so - binary compiled machine code class libraries |
|
6454 |
[.class - java bytecode -- soon to come]" |
|
15594 | 6455 |
|
15665 | 6456 |
|fileNameString inStream path morePath bos| |
10641 | 6457 |
|
6458 |
fileNameString := aFileNameOrString asString. |
|
6459 |
||
6460 |
" |
|
6461 |
an object or shared object ? |
|
6462 |
" |
|
6463 |
(ObjectFileLoader notNil |
|
22691 | 6464 |
and:[ObjectFileLoader hasValidBinaryExtension:fileNameString]) ifTrue:[ |
22791 | 6465 |
"/ LoadBinaries ifFalse:[^ false]. |
6466 |
path := self getBinaryFileName:fileNameString. |
|
6467 |
path isNil ifTrue:[ |
|
6468 |
path := self getSystemFileName:fileNameString. |
|
6469 |
path isNil ifTrue:[ |
|
6470 |
^ false |
|
6471 |
]. |
|
6472 |
]. |
|
6473 |
^ (ObjectFileLoader loadObjectFile:path) notNil |
|
15594 | 6474 |
]. |
6475 |
||
6476 |
inStream := self systemFileStreamFor:fileNameString. |
|
6477 |
inStream isNil ifTrue:[^ false]. |
|
10641 | 6478 |
|
22691 | 6479 |
(aFileNameOrString asFilename hasSuffix:'cls') ifTrue:[ |
22791 | 6480 |
BinaryObjectStorage isNil ifTrue:[ |
6481 |
^ false. |
|
6482 |
]. |
|
6483 |
[ |
|
6484 |
inStream binary. |
|
6485 |
bos := BinaryObjectStorage onOld:inStream. |
|
6486 |
bos next. |
|
6487 |
] ensure:[ |
|
6488 |
bos close. |
|
6489 |
]. |
|
6490 |
^ true |
|
15594 | 6491 |
]. |
10641 | 6492 |
|
6493 |
(fileNameString includes:$/) ifTrue:[ |
|
22791 | 6494 |
"/ temporarily prepend the file's directory |
6495 |
"/ to the searchPath. |
|
6496 |
"/ This allows fileIn-driver files to refer to local |
|
6497 |
"/ files via a relative path, and drivers to fileIn other |
|
6498 |
"/ drivers ... |
|
6499 |
morePath := inStream fileName directoryName. |
|
15594 | 6500 |
]. |
15665 | 6501 |
^ self fileInStream:inStream lazy:lazy silent:silent logged:logged addPath:morePath |
15594 | 6502 |
|
6503 |
" |
|
6504 |
Smalltalk fileIn:'clients/TicTacToe/TicTacToe.st' lazy:true silent:true |
|
6505 |
Smalltalk fileIn:'keyboard.rc' |
|
10641 | 6506 |
" |
6507 |
||
6508 |
"Modified: / 08-09-2006 / 19:21:16 / cg" |
|
22691 | 6509 |
"Modified: / 23-04-2018 / 17:05:33 / stefan" |
10641 | 6510 |
! |
6511 |
||
6512 |
fileIn:aFileName logged:logged |
|
6513 |
"read in the named file - look for it in some standard places; |
|
6514 |
return true if ok, false if failed. |
|
6515 |
The argument logged controls, if the changefile is to be updated." |
|
6516 |
||
6517 |
^ self fileIn:aFileName lazy:nil silent:nil logged:logged |
|
6518 |
||
6519 |
" |
|
6520 |
Smalltalk fileIn:'source/TicTacToe.st' logged:false |
|
6521 |
" |
|
6522 |
! |
|
6523 |
||
6524 |
fileIn:aFileName silent:silent |
|
6525 |
"read in the named file - look for it in some standard places; |
|
6526 |
return true if ok, false if failed. |
|
6527 |
If silent is true, no compiler messages are output to the transcript." |
|
6528 |
||
6529 |
^ self fileIn:aFileName lazy:nil silent:silent logged:false |
|
6530 |
||
6531 |
" |
|
6532 |
Smalltalk fileIn:'source/TicTacToe.st' silent:true |
|
6533 |
" |
|
6534 |
||
6535 |
"Created: 28.10.1995 / 17:06:36 / cg" |
|
6536 |
! |
|
6537 |
||
6538 |
fileInChanges |
|
6539 |
"read in the last changes file - bringing the system to the state it |
|
6540 |
had when left the last time. |
|
6541 |
WARNING: this method is rubbish: it should only read things after the |
|
18668 | 6542 |
last '**snapshot**' - entry |
6543 |
(instead of the complete changes file)." |
|
10641 | 6544 |
|
6545 |
" |
|
6546 |
do NOT update the changes file now ... |
|
6547 |
" |
|
6548 |
self fileIn:ChangeFileName logged:false |
|
6549 |
||
6550 |
" |
|
10071 | 6551 |
Smalltalk fileInChanges |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6552 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6553 |
! |
1 | 6554 |
|
10641 | 6555 |
fileInClass:aClassName |
6556 |
"find a source/object file for aClassName and -if found - load it. |
|
6557 |
search is in some standard places trying driver-file (.ld), object-file (.o) and |
|
6558 |
finally source file (.st) in that order. |
|
6559 |
The file is first searched for using the class name, then the abbreviated name." |
|
6560 |
||
6561 |
^ self |
|
18668 | 6562 |
fileInClass:aClassName |
6563 |
package:nil |
|
6564 |
initialize:true |
|
6565 |
lazy:false |
|
6566 |
silent:nil |
|
10641 | 6567 |
|
6568 |
"Modified: / 9.1.1998 / 14:41:46 / cg" |
|
6569 |
! |
|
6570 |
||
6571 |
fileInClass:aClassName fromObject:aFileName |
|
6572 |
"read in the named object file and dynamic-link it into the system |
|
6573 |
- look for it in some standard places. |
|
6574 |
Only install the named class from this object file. |
|
6575 |
Return true if ok, false if failed." |
|
6576 |
||
6577 |
|path ok| |
|
6578 |
||
6579 |
" |
|
6580 |
check if the dynamic loader class is in |
|
6581 |
" |
|
6582 |
(LoadBinaries not or:[ObjectFileLoader isNil]) ifTrue:[^ false]. |
|
6583 |
||
6584 |
(path := self getBinaryFileName:aFileName) isNil ifTrue:[^ false]. |
|
6585 |
ok := (ObjectFileLoader loadClass:aClassName fromObjectFile:path) notNil. |
|
6586 |
ok ifTrue:[ |
|
18668 | 6587 |
VerboseLoading ifTrue:[ |
6588 |
Transcript show:' loaded ' , aClassName , ' from ' ; showCR:aFileName. |
|
6589 |
] |
|
10641 | 6590 |
]. |
6591 |
^ ok |
|
6592 |
||
6593 |
" |
|
6594 |
Smalltalk fileInClass:'AbstractPath' fromObject:'../../goodies/Paths/AbstrPath.so' |
|
6595 |
Smalltalk fileInClass:'ClockView' fromObject:'../../libwidg3/libwidg3.so' |
|
6596 |
" |
|
6597 |
||
13814 | 6598 |
"Modified: / 04-11-2011 / 13:42:24 / cg" |
10641 | 6599 |
! |
6600 |
||
6601 |
fileInClass:aClassName initialize:doInit |
|
6602 |
"find a source/object file for aClassName and -if found - load it. |
|
6603 |
search is in some standard places trying driver-file (.ld), object-file (.o) and |
|
6604 |
finally source file (.st) in that order. |
|
6605 |
The file is first searched for using the class name, then the abbreviated name." |
|
6606 |
||
6607 |
^ self |
|
18668 | 6608 |
fileInClass:aClassName |
6609 |
package:nil |
|
6610 |
initialize:doInit |
|
6611 |
lazy:false |
|
6612 |
silent:nil |
|
10641 | 6613 |
|
6614 |
"Modified: / 9.1.1998 / 14:42:02 / cg" |
|
6615 |
! |
|
6616 |
||
6617 |
fileInClass:aClassName initialize:doInit lazy:loadLazy |
|
6618 |
"find a source/object file for aClassName and -if found - load it. |
|
6619 |
search is in some standard places trying driver-file (.ld), object-file (.o) and |
|
6620 |
finally source file (.st) in that order. |
|
6621 |
The file is first searched for using the class name, then the abbreviated name." |
|
6622 |
||
6623 |
^ self |
|
18668 | 6624 |
fileInClass:aClassName |
6625 |
package:nil |
|
6626 |
initialize:doInit |
|
6627 |
lazy:loadLazy |
|
6628 |
silent:nil |
|
10641 | 6629 |
|
6630 |
"Modified: / 9.1.1998 / 14:42:19 / cg" |
|
6631 |
! |
|
6632 |
||
6633 |
fileInClass:aClassName initialize:doInit lazy:loadLazy silent:beSilent |
|
6634 |
"find a source/object file for aClassName and -if found - load it. |
|
6635 |
Search is in some standard places, trying driver-file (.ld), object-file (.so / .o) and |
|
6636 |
finally source file (.st), in that order. |
|
6637 |
The file is first searched for using the class name, then the abbreviated name. |
|
6638 |
The argument doInit controlls if the class should be sent a #initialize after the |
|
19867 | 6639 |
load; loadLazy tells if it should be loaded lazily. beSilent tells if the compiler |
10641 | 6640 |
should not send notes to the transcript; it can be true, false or nil, where |
6641 |
nil uses the value from SilentLoading." |
|
6642 |
||
6643 |
^ self |
|
22791 | 6644 |
fileInClass:aClassName |
6645 |
package:nil |
|
6646 |
initialize:doInit |
|
6647 |
lazy:loadLazy |
|
6648 |
silent:beSilent |
|
10641 | 6649 |
|
6650 |
"Modified: / 9.1.1998 / 14:42:28 / cg" |
|
6651 |
! |
|
6652 |
||
6653 |
fileInClass:aClassName package:package |
|
6654 |
"find a source/object file for aClassName and -if found - load it. |
|
6655 |
search is in some standard places trying driver-file (.ld), object-file (.o) and |
|
6656 |
finally source file (.st) in that order. |
|
6657 |
The file is first searched for using the class name, then the abbreviated name." |
|
6658 |
||
6659 |
^ self |
|
18668 | 6660 |
fileInClass:aClassName |
6661 |
package:package |
|
6662 |
initialize:true |
|
6663 |
lazy:false |
|
6664 |
silent:nil |
|
10641 | 6665 |
|
6666 |
"Created: / 08-01-2007 / 10:06:09 / cg" |
|
6667 |
! |
|
6668 |
||
10999 | 6669 |
fileInClass:aClassName package:package initialize:doInit lazy:loadLazy silent:beSilent |
10641 | 6670 |
"find a source/object file for aClassName and -if found - load it. |
6671 |
This is the workhorse for autoloading. |
|
10999 | 6672 |
Search is in some standard places, trying driver-file (.ld), object-file (.so / .o) and |
10641 | 6673 |
finally source file (.st), in that order. |
6674 |
The file is first searched for using the class name, then the abbreviated name. |
|
6675 |
The argument doInit controlls if the class should be sent a #initialize after the |
|
19867 | 6676 |
load; loadLazy tells if it should be loaded lazily. beSilent tells if the compiler |
10641 | 6677 |
should not send notes to the transcript; it can be true, false or nil, where |
6678 |
nil uses the value from SilentLoading." |
|
6679 |
||
22955 | 6680 |
|classFileName alternativeClassFileName libName newClass ok wasLazy wasSilent sharedLibSuffix inStream mgr |
10641 | 6681 |
filenameToSet packageDir packageFile bos| |
6682 |
||
17588 | 6683 |
ClassLoadInProgressQuery answerNotifyLoading:aClassName do:[ |
17582 | 6684 |
|
22955 | 6685 |
wasLazy := Compiler compileLazy:loadLazy. |
6686 |
beSilent notNil ifTrue:[ |
|
6687 |
wasSilent := self silentLoading:beSilent. |
|
6688 |
]. |
|
6689 |
||
6690 |
classFileName := Smalltalk fileNameForClass:aClassName. |
|
6691 |
(classFileName = aClassName) ifTrue:[ |
|
6692 |
"/ no abbrev.stc translation for className |
|
6693 |
(aClassName includes:$:) ifTrue:[ |
|
6694 |
"/ a nameSpace name |
|
6695 |
alternativeClassFileName := classFileName copyFrom:(classFileName lastIndexOf:$:)+1 |
|
6696 |
]. |
|
6697 |
]. |
|
6698 |
||
6699 |
classFileName asFilename isAbsolute ifTrue:[ |
|
6700 |
classFileName asFilename suffix notEmptyOrNil ifTrue:[ |
|
6701 |
ok := self fileIn:classFileName lazy:loadLazy silent:beSilent. |
|
6702 |
] ifFalse:[ |
|
6703 |
ok := self fileInSourceFile:classFileName lazy:loadLazy silent:beSilent. |
|
6704 |
] |
|
6705 |
] ifFalse:[ |
|
6706 |
classFileName := classFileName copyReplaceAll:$: with:$_ ifNone:classFileName. |
|
6707 |
[ |
|
6708 |
Class withoutUpdatingChangesDo:[ |
|
6709 |
|zarFn zar entry| |
|
6710 |
||
6711 |
ok := false. |
|
6712 |
||
6713 |
package notNil ifTrue:[ |
|
6714 |
packageDir := package asPackageId packageDirectory. |
|
6715 |
"/ packageDir := package asString. |
|
6716 |
"/ packageDir := packageDir copyReplaceAll:$: with:$/. |
|
6717 |
packageDir isNil ifTrue:[ |
|
6718 |
packageDir := self packageDirectoryForPackageId:package |
|
6719 |
]. |
|
6720 |
packageDir notNil ifTrue:[ |
|
6721 |
packageDir := packageDir asFilename. |
|
6722 |
]. |
|
6723 |
]. |
|
6724 |
||
6725 |
Class packageQuerySignal answer:package do:[ |
|
6726 |
" |
|
6727 |
then, if dynamic linking is available, |
|
6728 |
" |
|
6729 |
(LoadBinaries and:[ObjectFileLoader notNil]) ifTrue:[ |
|
6730 |
sharedLibSuffix := ObjectFileLoader sharedLibrarySuffix. |
|
6731 |
" |
|
6732 |
first look for a class packages shared binary in binary/xxx.o |
|
6733 |
" |
|
6734 |
libName := self libraryFileNameOfClass:aClassName. |
|
6735 |
libName notNil ifTrue:[ |
|
6736 |
(ok := self fileInClass:aClassName fromObject:(libName asFilename withSuffix:sharedLibSuffix) name) |
|
6737 |
ifFalse:[ |
|
6738 |
sharedLibSuffix ~= 'o' ifTrue:[ |
|
6739 |
ok := self fileInClass:aClassName fromObject:(libName, '.o') |
|
6740 |
] |
|
6741 |
]. |
|
6742 |
]. |
|
6743 |
" |
|
6744 |
then, look for a shared binary in binary/xxx.o |
|
6745 |
" |
|
6746 |
ok ifFalse:[ |
|
6747 |
(ok := self fileInClass:aClassName fromObject:(classFileName asFilename withSuffix:sharedLibSuffix) name) |
|
6748 |
ifFalse:[ |
|
6749 |
sharedLibSuffix ~= 'o' ifTrue:[ |
|
6750 |
ok := self fileInClass:aClassName fromObject:(classFileName, '.o') |
|
6751 |
]. |
|
6752 |
ok ifFalse:[ |
|
6753 |
alternativeClassFileName notNil ifTrue:[ |
|
6754 |
(ok := self fileInClass:aClassName fromObject:(alternativeClassFileName asFilename withSuffix:sharedLibSuffix) name) |
|
6755 |
ifFalse:[ |
|
6756 |
sharedLibSuffix ~= 'o' ifTrue:[ |
|
6757 |
ok := self fileInClass:aClassName fromObject:(alternativeClassFileName, '.o') |
|
6758 |
] |
|
6759 |
] |
|
6760 |
]. |
|
6761 |
]. |
|
6762 |
]. |
|
6763 |
]. |
|
6764 |
]. |
|
6765 |
||
6766 |
" |
|
6767 |
if that did not work, look for a compiled-bytecode file ... |
|
6768 |
" |
|
6769 |
ok ifFalse:[ |
|
6770 |
(ok := self fileIn:(classFileName , '.cls') lazy:loadLazy silent:beSilent) |
|
6771 |
ifFalse:[ |
|
6772 |
alternativeClassFileName notNil ifTrue:[ |
|
6773 |
ok := self fileIn:(alternativeClassFileName , '.cls') lazy:loadLazy silent:beSilent |
|
6774 |
] |
|
6775 |
] |
|
6776 |
]. |
|
6777 |
" |
|
6778 |
if that did not work, and the classes package is known, |
|
6779 |
look for an st-cls file |
|
6780 |
in a package subdir of the source-directory ... |
|
6781 |
" |
|
6782 |
ok ifFalse:[ |
|
6783 |
(packageDir notNil and:[BinaryObjectStorage notNil]) ifTrue:[ |
|
6784 |
packageFile := self getPackageFileName:((packageDir / 'classes' / classFileName) addSuffix:'cls'). |
|
6785 |
packageFile isNil ifTrue:[ |
|
6786 |
packageFile := (packageDir / 'classes' / classFileName) addSuffix:'cls'. |
|
6787 |
]. |
|
6788 |
(ok := self fileIn:packageFile lazy:loadLazy silent:beSilent) |
|
6789 |
ifFalse:[ |
|
6790 |
alternativeClassFileName notNil ifTrue:[ |
|
6791 |
packageFile := self getPackageFileName:((packageDir / 'classes' / alternativeClassFileName) addSuffix:'cls'). |
|
6792 |
packageFile isNil ifTrue:[ |
|
6793 |
packageFile := ((packageDir / 'classes' / alternativeClassFileName) addSuffix:'cls'). |
|
6794 |
]. |
|
6795 |
ok := self fileIn:packageFile lazy:loadLazy silent:beSilent |
|
6796 |
] |
|
6797 |
]. |
|
6798 |
||
6799 |
zarFn := self getPackageFileName:(packageDir / 'classes.zip'). |
|
6800 |
zarFn notNil ifTrue:[ |
|
6801 |
zar := ZipArchive oldFileNamed:zarFn. |
|
6802 |
zar notNil ifTrue:[ |
|
6803 |
entry := zar extract:(classFileName , '.cls'). |
|
6804 |
(entry isNil and:[alternativeClassFileName notNil]) ifTrue:[ |
|
6805 |
entry := zar extract:(alternativeClassFileName , '.cls'). |
|
6806 |
]. |
|
6807 |
entry notNil ifTrue:[ |
|
6808 |
bos := BinaryObjectStorage onOld:(entry asByteArray readStream). |
|
6809 |
bos next. |
|
6810 |
bos close. |
|
6811 |
ok := true |
|
6812 |
]. |
|
6813 |
] |
|
6814 |
] |
|
6815 |
] |
|
6816 |
]. |
|
6817 |
||
6818 |
" |
|
6819 |
if that did not work, look for an st-source file ... |
|
6820 |
" |
|
6821 |
ok ifFalse:[ |
|
6822 |
filenameToSet := classFileName. |
|
6823 |
(ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent) |
|
6824 |
ifFalse:[ |
|
6825 |
alternativeClassFileName notNil ifTrue:[ |
|
6826 |
filenameToSet := alternativeClassFileName. |
|
6827 |
ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent |
|
6828 |
]. |
|
6829 |
ok ifFalse:[ |
|
6830 |
" |
|
6831 |
... and in the standard source-directory |
|
6832 |
" |
|
6833 |
filenameToSet := 'source' asFilename / classFileName. |
|
6834 |
(ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent) |
|
6835 |
ifFalse:[ |
|
6836 |
alternativeClassFileName notNil ifTrue:[ |
|
6837 |
filenameToSet := 'source' asFilename / alternativeClassFileName. |
|
6838 |
ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent |
|
6839 |
] |
|
6840 |
] |
|
6841 |
] |
|
6842 |
]. |
|
6843 |
" |
|
6844 |
if that did not work, and the classes package is known, |
|
6845 |
look for an st-source file |
|
6846 |
in a package subdir of the source-directory ... |
|
6847 |
" |
|
6848 |
ok ifFalse:[ |
|
6849 |
packageDir notNil ifTrue:[ |
|
6850 |
packageFile := self getPackageSourceFileName:(packageDir / 'source' / classFileName). |
|
6851 |
packageFile isNil ifTrue:[ |
|
6852 |
packageFile := (packageDir / 'source' / classFileName). |
|
6853 |
]. |
|
6854 |
filenameToSet := packageFile. |
|
6855 |
(ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent) |
|
6856 |
ifFalse:[ |
|
6857 |
alternativeClassFileName notNil ifTrue:[ |
|
6858 |
packageFile := self getPackageSourceFileName:(packageDir / 'source' / alternativeClassFileName). |
|
6859 |
packageFile isNil ifTrue:[ |
|
6860 |
packageFile := (packageDir / 'source' / alternativeClassFileName). |
|
6861 |
]. |
|
6862 |
filenameToSet := packageFile. |
|
6863 |
ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent |
|
6864 |
]. |
|
6865 |
ok ifFalse:[ |
|
6866 |
packageFile := self getPackageSourceFileName:(packageDir / classFileName). |
|
6867 |
packageFile isNil ifTrue:[ |
|
6868 |
packageFile := (packageDir / classFileName). |
|
6869 |
]. |
|
6870 |
filenameToSet := packageFile. |
|
6871 |
(ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent) |
|
6872 |
ifFalse:[ |
|
6873 |
alternativeClassFileName notNil ifTrue:[ |
|
6874 |
packageFile := self getPackageFileName:(packageDir / alternativeClassFileName). |
|
6875 |
packageFile isNil ifTrue:[ |
|
6876 |
packageFile := packageDir / alternativeClassFileName. |
|
6877 |
]. |
|
6878 |
filenameToSet := packageFile. |
|
6879 |
ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent |
|
6880 |
]. |
|
6881 |
ok ifFalse:[ |
|
6882 |
" |
|
6883 |
... and in the standard source-directory |
|
6884 |
" |
|
6885 |
filenameToSet := 'source' asFilename / packageDir / classFileName. |
|
6886 |
(ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent) |
|
6887 |
ifFalse:[ |
|
6888 |
alternativeClassFileName notNil ifTrue:[ |
|
6889 |
filenameToSet := 'source' asFilename / packageDir / alternativeClassFileName. |
|
6890 |
ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent |
|
6891 |
] |
|
6892 |
] |
|
6893 |
] |
|
6894 |
]. |
|
6895 |
]. |
|
6896 |
]. |
|
6897 |
] |
|
6898 |
]. |
|
6899 |
" |
|
6900 |
if that did not work, and the classes package is known, |
|
6901 |
look for a zipArchive containing a class entry. |
|
6902 |
" |
|
6903 |
ok ifFalse:[ |
|
6904 |
packageDir notNil ifTrue:[ |
|
6905 |
zarFn := self getPackageFileName:(packageDir / 'source.zip'). |
|
6906 |
zarFn isNil ifTrue:[ |
|
6907 |
zarFn := packageDir withSuffix:'zip'. |
|
6908 |
zarFn := self getSourceFileName:zarFn. |
|
6909 |
]. |
|
6910 |
(zarFn notNil and:[zarFn asFilename exists]) ifTrue:[ |
|
6911 |
zar := ZipArchive oldFileNamed:zarFn. |
|
6912 |
zar notNil ifTrue:[ |
|
6913 |
entry := zar extract:(classFileName , '.st'). |
|
6914 |
(entry isNil and:[alternativeClassFileName notNil]) ifTrue:[ |
|
6915 |
entry := zar extract:(alternativeClassFileName , '.st'). |
|
6916 |
]. |
|
6917 |
entry notNil ifTrue:[ |
|
6918 |
filenameToSet := zarFn. |
|
6919 |
ok := self |
|
6920 |
fileInStream:(entry asString readStream) |
|
6921 |
lazy:loadLazy |
|
6922 |
silent:beSilent |
|
6923 |
logged:false |
|
6924 |
addPath:nil |
|
6925 |
]. |
|
6926 |
] |
|
6927 |
] |
|
6928 |
] |
|
6929 |
]. |
|
6930 |
||
6931 |
" |
|
6932 |
if that did not work, |
|
6933 |
look for a zipArchive containing a class entry. |
|
6934 |
" |
|
6935 |
ok ifFalse:[ |
|
6936 |
zarFn := self getSourceFileName:'source.zip'. |
|
6937 |
zarFn notNil ifTrue:[ |
|
6938 |
zar := ZipArchive oldFileNamed:zarFn. |
|
6939 |
zar notNil ifTrue:[ |
|
6940 |
entry := zar extract:(zarFn := classFileName , '.st'). |
|
6941 |
(entry isNil and:[alternativeClassFileName notNil]) ifTrue:[ |
|
6942 |
entry := zar extract:(zarFn := alternativeClassFileName , '.st'). |
|
6943 |
]. |
|
6944 |
entry notNil ifTrue:[ |
|
6945 |
filenameToSet := zarFn. |
|
6946 |
ok := self |
|
6947 |
fileInStream:(entry asString readStream) |
|
6948 |
lazy:loadLazy |
|
6949 |
silent:beSilent |
|
6950 |
logged:false |
|
6951 |
addPath:nil |
|
6952 |
]. |
|
6953 |
] |
|
6954 |
] |
|
6955 |
]. |
|
6956 |
ok ifFalse:[ |
|
6957 |
" |
|
6958 |
if there is a sourceCodeManager, ask it for the classes sourceCode |
|
6959 |
" |
|
6960 |
(mgr := Smalltalk at:#SourceCodeManager) notNil ifTrue:[ |
|
6961 |
inStream := mgr getMostRecentSourceStreamForClassNamed:aClassName inPackage:package. |
|
6962 |
inStream notNil ifTrue:[ |
|
6963 |
filenameToSet := nil. |
|
6964 |
ok := self fileInStream:inStream lazy:loadLazy silent:beSilent logged:false addPath:nil. |
|
6965 |
] |
|
6966 |
]. |
|
6967 |
]. |
|
6968 |
]. |
|
6969 |
] |
|
6970 |
]. |
|
6971 |
] ensure:[ |
|
6972 |
Compiler compileLazy:wasLazy. |
|
6973 |
wasSilent notNil ifTrue:[ |
|
6974 |
self silentLoading:wasSilent |
|
6975 |
] |
|
6976 |
]. |
|
6977 |
]. |
|
6978 |
||
6979 |
ok ifTrue:[ |
|
6980 |
newClass := self at:(aClassName asSymbol). |
|
6981 |
newClass notNil ifTrue:[ |
|
6982 |
"set the classes name - but do not change if already set" |
|
6983 |
filenameToSet notNil ifTrue:[ |
|
6984 |
newClass getClassFilename isNil ifTrue:[ |
|
6985 |
newClass setClassFilename:(filenameToSet asFilename baseName) |
|
6986 |
]. |
|
6987 |
]. |
|
6988 |
||
6989 |
doInit ifTrue:[ |
|
6990 |
newClass initialize |
|
6991 |
] |
|
6992 |
] |
|
6993 |
]. |
|
10641 | 6994 |
]. |
6995 |
||
6996 |
^ newClass |
|
6997 |
||
13415 | 6998 |
"Created: / 09-01-1998 / 14:40:32 / cg" |
6999 |
"Modified: / 05-06-1999 / 14:53:01 / cg" |
|
7000 |
"Modified: / 16-08-2009 / 14:52:53 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
10641 | 7001 |
! |
7002 |
||
7003 |
fileInClassLibrary:aClassLibraryName |
|
7004 |
"find an object file containing a binary class library in some standard places |
|
7005 |
and load it. This install all of its contained classes. |
|
7006 |
Return true if ok, false if not. |
|
7007 |
Notice: the argument may not have an extension (by purpose); |
|
18668 | 7008 |
the sharedLib extension (.dll / .so / .sl) is added here, to |
7009 |
make the caller independent of the underlying operatingSystem." |
|
10641 | 7010 |
|
7011 |
|path fn| |
|
7012 |
||
16144 | 7013 |
ObjectFileLoader isNil ifTrue:[ |
18668 | 7014 |
^ PackageLoadError raiseRequestWith:aClassLibraryName errorString:' - no ObjectFileLoader'. |
16144 | 7015 |
]. |
10641 | 7016 |
|
7017 |
fn := aClassLibraryName asFilename withSuffix:(ObjectFileLoader sharedLibrarySuffix). |
|
7018 |
fn := fn pathName. |
|
7019 |
||
7020 |
path := self getBinaryFileName:fn. |
|
7021 |
path isNil ifTrue:[ |
|
18668 | 7022 |
path := self getSystemFileName:fn. |
16144 | 7023 |
]. |
7024 |
path isNil ifTrue:[ |
|
18668 | 7025 |
^ PackageNotFoundError raiseRequestWith:aClassLibraryName. |
16144 | 7026 |
]. |
7027 |
||
7028 |
(ObjectFileLoader loadObjectFile:path) isNil ifTrue:[ |
|
18668 | 7029 |
^ PackageLoadError raiseRequestWith:aClassLibraryName. |
16144 | 7030 |
]. |
7031 |
^ true. |
|
7032 |
||
10641 | 7033 |
|
7034 |
" |
|
7035 |
Smalltalk fileInClassLibrary:'libtable' |
|
7036 |
Smalltalk fileInClassLibrary:'binary/libwidg3' |
|
7037 |
" |
|
7038 |
||
7039 |
"Modified: 8.1.1997 / 17:58:56 / cg" |
|
7040 |
! |
|
7041 |
||
7042 |
fileInClassLibrary:aClassLibraryName inPackage:packageID |
|
7043 |
"find an object file containing a binary class library in some standard places |
|
7044 |
and load it. This installs all of its contained classes. |
|
7045 |
Return true if ok, false if not. |
|
7046 |
Notice: the argument may not have an extension (by purpose); |
|
23177 | 7047 |
the sharedLib extension (.dll / .so / .sl) is added here, to |
7048 |
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
|
7049 |
|
11690 | 7050 |
|baseName handle libraryFilename packagePath| |
10641 | 7051 |
|
16144 | 7052 |
ObjectFileLoader isNil ifTrue:[ |
23177 | 7053 |
^ PackageLoadError raiseRequestWith:packageID errorString:' - no ObjectFileLoader' |
16144 | 7054 |
]. |
10641 | 7055 |
|
7056 |
baseName := aClassLibraryName asFilename withSuffix:(ObjectFileLoader sharedLibrarySuffix). |
|
7057 |
baseName exists ifTrue:[ |
|
23177 | 7058 |
"/ load local file first... |
7059 |
handle := ObjectFileLoader loadObjectFile:baseName. |
|
12744
80f6da0fee57
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
12700
diff
changeset
|
7060 |
]. |
80f6da0fee57
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
12700
diff
changeset
|
7061 |
handle isNil ifTrue:[ |
23177 | 7062 |
packagePath := self getPackageDirectoryForPackage:packageID. |
7063 |
packagePath isNil ifTrue:[ |
|
7064 |
^ PackageNotFoundError raiseRequestWith:packageID. |
|
7065 |
]. |
|
7066 |
libraryFilename := ObjectFileLoader binaryClassFilenameForPackage:packageID inDirectory:packagePath. |
|
7067 |
(libraryFilename notNil and:[libraryFilename exists]) ifTrue:[ |
|
7068 |
handle := ObjectFileLoader loadObjectFile:libraryFilename pathName. |
|
7069 |
]. |
|
16144 | 7070 |
]. |
7071 |
||
7072 |
handle isNil ifTrue:[ |
|
23177 | 7073 |
^ PackageNotFoundError raiseRequestWith:packageID. |
16144 | 7074 |
]. |
12744
80f6da0fee57
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
12700
diff
changeset
|
7075 |
"/ handle notNil ifTrue:[ |
80f6da0fee57
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
12700
diff
changeset
|
7076 |
"/ Transcript showCR:(' Smalltalk: loaded %1.' bindWith:libraryFilename pathName). |
80f6da0fee57
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
12700
diff
changeset
|
7077 |
"/ ]. |
16144 | 7078 |
^ true. |
10641 | 7079 |
|
7080 |
" |
|
7081 |
Smalltalk fileInClassLibrary:'libtable' |
|
7082 |
Smalltalk fileInClassLibrary:'binary/libwidg3' |
|
7083 |
Smalltalk fileInClassLibrary:'refactoryBrowser' inPackage:'stx:goodies/refactoryBrowser' |
|
7084 |
" |
|
7085 |
||
13787
1695a24d0fa7
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
13785
diff
changeset
|
7086 |
"Modified: / 08-10-2011 / 00:08:51 / cg" |
23177 | 7087 |
"Modified: / 02-07-2018 / 14:19:16 / Stefan Vogel" |
10641 | 7088 |
! |
7089 |
||
15073 | 7090 |
fileInSourceFile:filenameArg lazy:loadLazy silent:beSilent |
18560 | 7091 |
"Try all available programming languages for a matching suffix" |
13415 | 7092 |
|
15073 | 7093 |
|filename| |
7094 |
||
7095 |
filename := filenameArg asFilename. |
|
18668 | 7096 |
"/ 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
|
7097 |
"/ | f | |
b088a44b9681
\"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents:
18560
diff
changeset
|
7098 |
"/ |
21338 | 7099 |
"/ "/ 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
|
7100 |
"/ "/ 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
|
7101 |
"/ (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
|
7102 |
"/ (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
|
7103 |
"/ ^ true |
b088a44b9681
\"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents:
18560
diff
changeset
|
7104 |
"/ ]. |
b088a44b9681
\"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents:
18560
diff
changeset
|
7105 |
"/ ] |
b088a44b9681
\"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents:
18560
diff
changeset
|
7106 |
"/ ]. |
b088a44b9681
\"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents:
18560
diff
changeset
|
7107 |
"/ 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
|
7108 |
ProgrammingLanguage allDo:[:lang| | f | |
22791 | 7109 |
f := (filename hasSuffix:lang sourceFileSuffix) |
7110 |
ifTrue:[filename] |
|
7111 |
ifFalse:[filename addSuffix:lang sourceFileSuffix]. |
|
7112 |
(self fileIn:f lazy:loadLazy silent:beSilent) |
|
7113 |
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
|
7114 |
]. |
b088a44b9681
\"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents:
18560
diff
changeset
|
7115 |
|
15073 | 7116 |
^ false |
13415 | 7117 |
|
7118 |
"Created: / 16-08-2009 / 14:45:41 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
7119 |
! |
|
7120 |
||
10641 | 7121 |
fileInStream:streamArg |
7122 |
^ self fileInStream:streamArg lazy:nil silent:nil logged:false addPath:nil |
|
7123 |
! |
|
7124 |
||
7125 |
fileInStream:streamArg lazy:lazy silent:silent logged:logged addPath:morePath |
|
7126 |
"read sourceCode from aStream; |
|
7127 |
return true if ok, false if failed. |
|
7128 |
If lazy is true, no code is generated for methods, instead stubs |
|
7129 |
are created which compile themself when first executed. This allows |
|
7130 |
for much faster fileIn (but slows down the first execution later). |
|
7131 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
7132 |
code which is known to be syntactically correct. |
|
7133 |
If silent is true, no compiler messages are output to the transcript. |
|
7134 |
Giving nil for silent/lazy will use the current settings. |
|
7135 |
If morePath is nonNil, it is prepended to the systemPath temporarily during the |
|
7136 |
fileIn. This allows for st-expressions to refer to more files (i.e. fileIn more) |
|
7137 |
using a relative path." |
|
7138 |
||
11427 | 7139 |
|inStream wasLazy wasSilent oldSystemPath oldRealPath| |
10641 | 7140 |
|
7141 |
inStream := streamArg. |
|
7142 |
inStream isNil ifTrue:[^ false]. |
|
19385 | 7143 |
inStream isLineNumberReadStream ifFalse:[ |
22791 | 7144 |
LineNumberReadStream notNil ifTrue:[ |
7145 |
"/ sigh - is in libbasic2, which is not always present |
|
7146 |
inStream := LineNumberReadStream on:inStream. |
|
7147 |
]. |
|
19385 | 7148 |
]. |
21458 | 7149 |
inStream := EncodedStream decodedStreamFor:inStream. |
10641 | 7150 |
|
7151 |
lazy notNil ifTrue:[wasLazy := Compiler compileLazy:lazy]. |
|
7152 |
silent notNil ifTrue:[wasSilent := self silentLoading:silent]. |
|
7153 |
morePath notNil ifTrue:[ |
|
22791 | 7154 |
oldSystemPath := SystemPath copy. |
7155 |
SystemPath addFirst:morePath. |
|
7156 |
oldRealPath := RealSystemPath. |
|
7157 |
RealSystemPath := nil. |
|
7158 |
]. |
|
7159 |
||
22703 | 7160 |
^ [ |
22791 | 7161 |
(Class updateChangeFileQuerySignal , Class updateChangeListQuerySignal) answer:logged do:[ |
7162 |
"JV: Changed to give ProgrammingLanguage to choose |
|
7163 |
proper reader" |
|
7164 |
((ProgrammingLanguage forStream: inStream) fileInStream: inStream) ~~ #Error |
|
7165 |
] |
|
10641 | 7166 |
] ensure:[ |
22791 | 7167 |
morePath notNil ifTrue:[ |
7168 |
"take care, someone could have changed SystemPath during fileIn!!" |
|
7169 |
(SystemPath copyFrom:2) = oldSystemPath ifTrue:[ |
|
7170 |
SystemPath := oldSystemPath. |
|
7171 |
RealSystemPath := oldRealPath. |
|
7172 |
] ifFalse:[ |
|
7173 |
(oldSystemPath includes:morePath) ifFalse:[ |
|
7174 |
SystemPath remove:morePath ifAbsent:[]. |
|
7175 |
]. |
|
7176 |
RealSystemPath := nil. |
|
7177 |
]. |
|
7178 |
]. |
|
7179 |
lazy notNil ifTrue:[Compiler compileLazy:wasLazy]. |
|
7180 |
silent notNil ifTrue:[self silentLoading:wasSilent]. |
|
7181 |
inStream close |
|
10641 | 7182 |
]. |
7183 |
||
7184 |
" |
|
7185 |
Smalltalk fileInStream:('source/TicTacToe.st' asFilename readStream) lazy:true silent:true |
|
7186 |
" |
|
7187 |
||
13415 | 7188 |
"Modified: / 05-11-1996 / 20:03:35 / cg" |
7189 |
"Modified: / 16-08-2009 / 11:06:05 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
22706 | 7190 |
"Modified: / 24-04-2018 / 23:50:22 / stefan" |
10641 | 7191 |
! |
7192 |
||
7193 |
isClassLibraryLoaded:name |
|
7194 |
"return true, if a particular class library is already loaded" |
|
7195 |
||
7196 |
ObjectMemory |
|
18668 | 7197 |
binaryModuleInfo |
7198 |
do:[:entry | |
|
7199 |
entry type == #classLibrary ifTrue:[ |
|
7200 |
entry libraryName = name ifTrue:[ |
|
7201 |
^ true "/ already loaded |
|
7202 |
] |
|
7203 |
]. |
|
7204 |
]. |
|
10641 | 7205 |
|
7206 |
^ false |
|
7207 |
||
7208 |
" |
|
7209 |
Smalltalk isClassLibraryLoaded:'libstx_libbasic' |
|
7210 |
Smalltalk isClassLibraryLoaded:'libstx_libwidg3' |
|
7211 |
Smalltalk isClassLibraryLoaded:'libstx_libboss' |
|
7212 |
" |
|
7213 |
||
7214 |
"Modified: / 23-08-2006 / 15:54:46 / cg" |
|
7215 |
! |
|
7216 |
||
7217 |
loadClassLibraryIfAbsent:name |
|
7218 |
"dynamically load a classLibrary, if not already loaded |
|
7219 |
and the system supports dynamic loading. |
|
7220 |
Return true, if the library is loaded, false if not. |
|
7221 |
This entry is called without system specific filename |
|
7222 |
extensions - it is portable among different architectures |
|
7223 |
as long as corresponding files (x.so / x.dll / x.sl / x.o) |
|
7224 |
are be present ..." |
|
7225 |
||
7226 |
(self isClassLibraryLoaded:name) ifTrue:[ ^ true ]. "/ already loaded |
|
7227 |
^ self fileInClassLibrary:name |
|
7228 |
||
7229 |
" |
|
7230 |
Smalltalk loadClassLibraryIfAbsent:'libbasic' |
|
7231 |
Smalltalk loadClassLibraryIfAbsent:'libwidg3' |
|
7232 |
" |
|
7233 |
||
7234 |
"Modified: 31.10.1996 / 16:57:24 / cg" |
|
7235 |
! |
|
7236 |
||
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7237 |
secureFileIn:aFileName |
10641 | 7238 |
"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
|
7239 |
Catch various errors during fileIn. |
13000 | 7240 |
Return true if ok, false if failed" |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7241 |
|
22691 | 7242 |
Parser isNil ifTrue:[ |
23588 | 7243 |
^ false "/ for small stand alone apps. |
22791 | 7244 |
]. |
22691 | 7245 |
|
7246 |
^ (SignalSet |
|
23588 | 7247 |
with:AbortOperationRequest |
7248 |
with:TerminateProcessRequest |
|
7249 |
with:ParseError) |
|
7250 |
handle:[:ex | |
|
7251 |
ex creator == ParseError ifTrue:[ |
|
7252 |
Logger info:'ParseError in line %1: %2' with:ex lineNumber with:ex description. |
|
7253 |
]. |
|
7254 |
ex return:false |
|
7255 |
] |
|
7256 |
do:[ self fileIn:aFileName ]. |
|
22691 | 7257 |
|
7258 |
"Modified: / 23-04-2018 / 16:53:29 / stefan" |
|
23588 | 7259 |
"Modified: / 25-12-2018 / 10:23:40 / Claus Gittinger" |
10641 | 7260 |
! |
7261 |
||
7262 |
silentFileIn:aFilename |
|
7263 |
"same as fileIn:, but do not output 'compiled...'-messages on Transcript. |
|
7264 |
Main use is during startup." |
|
7265 |
||
22691 | 7266 |
^ self silentlyLoadingDo:[ |
22791 | 7267 |
self fileIn:aFilename |
22691 | 7268 |
]. |
7269 |
||
7270 |
"Modified: / 23-04-2018 / 16:57:17 / stefan" |
|
3044 | 7271 |
! ! |
7272 |
||
7273 |
!Smalltalk class methodsFor:'system management-files'! |
|
7274 |
||
20663 | 7275 |
addIdeTopDirectoryToPackagePath |
7276 |
"{ Pragma: +optSpace }" |
|
7277 |
||
7278 |
|topDirectory| |
|
22791 | 7279 |
|
20663 | 7280 |
(topDirectory := OperatingSystem pathOfSTXExecutable) notNil ifTrue:[ |
22791 | 7281 |
topDirectory := topDirectory asFilename. |
7282 |
(topDirectory directory / 'stc') exists ifTrue:[ |
|
7283 |
topDirectory := topDirectory directory. |
|
7284 |
] ifFalse:[ |
|
7285 |
(topDirectory directory directory / 'stc') exists ifTrue:[ |
|
7286 |
topDirectory := topDirectory directory directory. |
|
7287 |
] ifFalse:[ |
|
7288 |
(topDirectory directory directory directory / 'stc') exists ifTrue:[ |
|
7289 |
topDirectory := topDirectory directory directory directory. |
|
7290 |
] ifFalse:[ |
|
7291 |
topDirectory := nil |
|
7292 |
]. |
|
7293 |
]. |
|
7294 |
]. |
|
7295 |
topDirectory notNil ifTrue:[ |
|
7296 |
"/ one above "stx" |
|
7297 |
topDirectory := topDirectory directory pathName. |
|
7298 |
(PackagePath includes:topDirectory) ifFalse:[ |
|
7299 |
PackagePath add:topDirectory |
|
7300 |
] |
|
7301 |
] |
|
20663 | 7302 |
]. |
7303 |
! |
|
7304 |
||
18868 | 7305 |
addWorkspaceDirectoryToPackagePath |
7306 |
"{ Pragma: +optSpace }" |
|
7307 |
||
7308 |
|workspaceDirectory| |
|
22791 | 7309 |
|
18868 | 7310 |
(workspaceDirectory := UserPreferences current workspaceDirectory) notNil ifTrue:[ |
22791 | 7311 |
(workspaceDirectory := workspaceDirectory asFilename) exists ifTrue:[ |
7312 |
workspaceDirectory := workspaceDirectory pathName. |
|
7313 |
(PackagePath includes:workspaceDirectory) ifFalse:[ |
|
7314 |
PackagePath addFirst:workspaceDirectory |
|
7315 |
] |
|
7316 |
] |
|
18868 | 7317 |
]. |
7318 |
! |
|
7319 |
||
10641 | 7320 |
bitmapFileStreamFor:aFileName |
7321 |
"search aFileName in some standard places; |
|
7322 |
return a readonly fileStream or nil if not found. |
|
7323 |
Searches in subdirectories named 'bitmaps' in the SystemPath. |
|
7324 |
Notice: this does not look in the package-specific bitmaps directories." |
|
7325 |
||
7326 |
|aString| |
|
7327 |
||
7328 |
aString := self getBitmapFileName:aFileName. |
|
7329 |
aString notNil ifTrue:[ |
|
18668 | 7330 |
^ aString asFilename readStreamOrNil |
10641 | 7331 |
]. |
7332 |
^ nil |
|
7333 |
! |
|
7334 |
||
7335 |
bitmapFromFileNamed:aFileName forClass:aClass |
|
7336 |
"backward compatibility: |
|
7337 |
search aFileName in some standard places: |
|
7338 |
first in the redefinable bitmaps path, |
|
7339 |
then in the classes own package directory if existing. |
|
7340 |
Return an image or nil." |
|
7341 |
||
7342 |
^ self imageFromFileNamed:aFileName forClass:aClass |
|
7343 |
||
7344 |
" |
|
7345 |
Smalltalk bitmapFromFileNamed:'SmalltalkX.xbm' forClass:View |
|
7346 |
" |
|
7347 |
! |
|
7348 |
||
7349 |
bitmapFromFileNamed:aFileName inPackage:aPackage |
|
7350 |
"backward compatibility: |
|
7351 |
search aFileName in some standard places: |
|
7352 |
first in the redefinable bitmaps path, |
|
7353 |
then in the package directory if existing. |
|
7354 |
Return an image or nil." |
|
7355 |
||
7356 |
^ self imageFromFileNamed:aFileName inPackage:aPackage |
|
7357 |
||
7358 |
" |
|
7359 |
Smalltalk bitmapFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libview' |
|
7360 |
Smalltalk bitmapFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libtool' |
|
7361 |
" |
|
7362 |
! |
|
7363 |
||
7364 |
classNameForFile:aFileName |
|
7365 |
"return the className which corresponds to an abbreviated fileName, |
|
7366 |
or nil if no special translation applies. The given filename arg may |
|
7367 |
include a '.st' suffix (but no other)." |
|
7368 |
||
7369 |
|fn| |
|
7370 |
||
7371 |
(aFileName asFilename hasSuffix:'st') ifTrue:[ |
|
18668 | 7372 |
fn := aFileName copyButLast:3 |
10641 | 7373 |
] ifFalse:[ |
18668 | 7374 |
fn := aFileName |
10641 | 7375 |
]. |
7376 |
^ self filenameAbbreviations keyAtEqualValue:fn ifAbsent:[fn]. |
|
7377 |
||
7378 |
" |
|
7379 |
Smalltalk classNameForFile:'DrawObj' |
|
7380 |
Smalltalk classNameForFile:'DrawObj.st' |
|
7381 |
Smalltalk classNameForFile:'ArrColl.st' |
|
7382 |
Smalltalk classNameForFile:'ArrColl.chg' |
|
7383 |
" |
|
7384 |
||
7385 |
"Modified: 11.12.1995 / 14:51:10 / cg" |
|
7386 |
! |
|
7387 |
||
7388 |
constructPathFor:aDirectoryName |
|
7389 |
"search for aDirectory in SystemPath; |
|
20294 | 7390 |
return a collection of paths which include that directory." |
10641 | 7391 |
|
7392 |
^ self realSystemPath select:[:dirName | |
|
22791 | 7393 |
|fullPath| |
7394 |
||
7395 |
fullPath := dirName asFilename construct:aDirectoryName. |
|
7396 |
"/ fullPath exists and:[fullPath isDirectory and:[fullPath isReadable]] |
|
7397 |
fullPath isDirectory and:[fullPath isReadable] |
|
10641 | 7398 |
]. |
7399 |
! |
|
7400 |
||
7401 |
fileInFileStreamFor:aFileName |
|
7402 |
"obsolete |
|
7403 |
search aFileName in some standard places; |
|
7404 |
return a readonly fileStream or nil if not found. |
|
7405 |
Searches in subdirectories named 'fileIn' in SystemPath" |
|
7406 |
||
7407 |
|aString| |
|
7408 |
||
7409 |
aString := self getFileInFileName:aFileName. |
|
7410 |
aString notNil ifTrue:[ |
|
18668 | 7411 |
^ aString asFilename readStreamOrNil |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7412 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7413 |
^ nil |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7414 |
! |
7758 | 7415 |
|
12022 | 7416 |
fileNameForClass:aClassOrClassName |
7417 |
"return a actual or expected (or most wanted) filename for aClassOrClassName |
|
7418 |
- only the base name (without directory part) and without suffix." |
|
7419 |
||
15958 | 7420 |
|cls nonMetaclass nm nameWithPrefix nameWithoutPrefix compatQuery compatPkg | |
12022 | 7421 |
|
12301 | 7422 |
"/ This was added as an extension of libsvn - should be no longer needed |
15958 | 7423 |
"/ JV@2012-09-25: but it actually is. The problem is that class filename |
7424 |
"/ is stored in the class itself and used to generate abbrev.stc and |
|
7425 |
"/ prerequisites in makefiles. But if you renamed such a stc-compiled class, |
|
7426 |
"/ the filename remains the same, but SVN __ALWAYS__ keep container name |
|
7427 |
"/ and class name in sync. Therefore build files gets messed up. Indeed, this |
|
7428 |
"/ should be fixed in code that files-out the package and generates build files. |
|
7429 |
"/ Certainly a hack, but do not remove this until fixed elsewhere |
|
7430 |
||
23414 | 7431 |
compatQuery := #'SVN::CompatModeQuery' asClassIfAbsent:nil. |
15958 | 7432 |
(compatQuery notNil |
7433 |
and:[compatQuery isLoaded |
|
23414 | 7434 |
and:[compatQuery query not]]) ifTrue:[ |
7435 |
nm := aClassOrClassName isBehavior |
|
7436 |
ifTrue:[aClassOrClassName name] |
|
7437 |
ifFalse:[aClassOrClassName]. |
|
7438 |
nm := nm copyReplaceAll:$: with:$_ ifNone:nm. |
|
7439 |
^nm |
|
15958 | 7440 |
]. |
7441 |
||
16122
18c865388947
Fix in Smalltalk>>#fileNameForClass: - required by libscm to support nested packages.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16117
diff
changeset
|
7442 |
"/ 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
|
7443 |
"/ 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
|
7444 |
"/ 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
|
7445 |
"/ of classes OUTSIDE filed-out package when generating makefile dependencies. |
23414 | 7446 |
compatQuery := #'SCMCompatModeQuery' asClassIfAbsent:nil. |
15958 | 7447 |
(compatQuery notNil |
7448 |
and:[compatQuery isLoaded |
|
23414 | 7449 |
and:[(compatPkg := compatQuery query) notNil]]) ifTrue:[ |
7450 |
| compatPkgs | |
|
7451 |
"/ Originally libscm could only fileout one package at time so |
|
7452 |
"/ the query answered one package name. However, to support nested |
|
7453 |
"/ packages, libscm is being rewritten to commit multiple packages |
|
7454 |
"/ at once, so query answers a collection of packages. The code below |
|
7455 |
"/ makes sure it works for both. |
|
7456 |
compatPkgs := compatPkg isString ifTrue:[ Array with: compatPkg] ifFalse:[ compatPkg ]. |
|
7457 |
nm := aClassOrClassName isBehavior |
|
7458 |
ifTrue:[aClassOrClassName name] |
|
7459 |
ifFalse:[aClassOrClassName]. |
|
7460 |
cls := Smalltalk at: nm asSymbol. |
|
7461 |
(cls notNil and:[compatPkgs includes: cls package]) ifTrue:[ |
|
7462 |
nm := nm copyReplaceAll:$: with:$_. |
|
7463 |
^nm |
|
7464 |
]. |
|
15958 | 7465 |
]. |
12301 | 7466 |
|
12022 | 7467 |
aClassOrClassName isBehavior ifTrue:[ |
23414 | 7468 |
cls := aClassOrClassName. |
12022 | 7469 |
] ifFalse:[ |
23414 | 7470 |
cls := Smalltalk classNamed:aClassOrClassName. |
7471 |
cls isNil ifTrue:[ |
|
7472 |
nameWithPrefix := aClassOrClassName. |
|
7473 |
nameWithoutPrefix := (aClassOrClassName copyFrom:(aClassOrClassName lastIndexOf:$:)+1). |
|
7474 |
]. |
|
12022 | 7475 |
]. |
7476 |
||
7477 |
cls notNil ifTrue:[ |
|
23414 | 7478 |
nonMetaclass := cls theNonMetaclass. |
7479 |
nm := nonMetaclass getClassFilename. |
|
7480 |
nm isNil ifTrue:[ |
|
7481 |
|revisionInfo| |
|
7482 |
||
7483 |
(revisionInfo := cls revisionInfo) notNil ifTrue:[ |
|
7484 |
nm := revisionInfo fileName. |
|
7485 |
]. |
|
7486 |
]. |
|
7487 |
nm notNil ifTrue:[ |
|
7488 |
^ nm asFilename withoutSuffix baseName |
|
7489 |
]. |
|
7490 |
nameWithPrefix := nonMetaclass name. |
|
7491 |
nameWithoutPrefix := nonMetaclass nameWithoutPrefix. |
|
12022 | 7492 |
]. |
7493 |
||
7494 |
CachedAbbreviations notNil ifTrue:[ |
|
23414 | 7495 |
nameWithPrefix := nameWithPrefix asSymbol. |
7496 |
(CachedAbbreviations includesKey:nameWithPrefix) ifTrue:[ |
|
7497 |
^ (CachedAbbreviations at:nameWithPrefix) asFilename baseName |
|
7498 |
]. |
|
7499 |
nameWithoutPrefix := nameWithoutPrefix asSymbol. |
|
7500 |
(CachedAbbreviations includesKey:nameWithoutPrefix) ifTrue:[ |
|
7501 |
^ (CachedAbbreviations at:nameWithoutPrefix) asFilename baseName |
|
7502 |
]. |
|
12022 | 7503 |
]. |
7504 |
||
7505 |
^ nameWithPrefix copyReplaceAll:$: with:$_ |
|
7506 |
||
7507 |
" |
|
7508 |
Smalltalk fileNameForClass:#Complex |
|
7509 |
Smalltalk fileNameForClass:'SmallInteger' |
|
7510 |
Smalltalk fileNameForClass:'UnixOperatingSystem' |
|
7511 |
Smalltalk fileNameForClass:'Launcher' |
|
7512 |
Smalltalk fileNameForClass:'SomeUnknownClass' |
|
7513 |
||
7514 |
Smalltalk fileNameForClass:HTML::Encoder |
|
7515 |
Smalltalk fileNameForClass:OSI::FTAMOperation |
|
7516 |
Smalltalk fileNameForClass:'OSI::Foobar' |
|
7517 |
Smalltalk fileNameForClass:(Workflow::UnsuccessfulFinishReasons) |
|
7518 |
Workflow::UnsuccessfulFinishReasons classFilename |
|
7519 |
" |
|
7520 |
||
7521 |
"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
|
7522 |
"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
|
7523 |
"Modified (comment): / 23-02-2014 / 12:39:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
23414 | 7524 |
"Modified: / 10-10-2018 / 00:44:07 / Claus Gittinger" |
12022 | 7525 |
! |
7526 |
||
10641 | 7527 |
filenameAbbreviations |
7528 |
"return a dictionary containing the classname-to-filename |
|
7529 |
mappings. (needed for sys5.3 users, where filenames are limited |
|
7530 |
to 14 chars)" |
|
7531 |
||
7532 |
CachedAbbreviations isNil ifTrue:[ |
|
18668 | 7533 |
self readAbbreviations |
10641 | 7534 |
]. |
7535 |
^ CachedAbbreviations |
|
7536 |
||
7537 |
"flush with: |
|
7538 |
||
7539 |
CachedAbbreviations := nil |
|
7540 |
" |
|
7541 |
" |
|
7542 |
Smalltalk filenameAbbreviations |
|
7543 |
" |
|
7544 |
! |
|
7545 |
||
13368 | 7546 |
findPackageDirectoryForPackage:aPackage |
7547 |
"find a packages directory along a number of standard places" |
|
7548 |
||
7549 |
|relDir| |
|
7550 |
||
7551 |
relDir := Smalltalk relativePackagePathForPackage:aPackage. |
|
7552 |
relDir asFilename isAbsolute ifTrue:[^ relDir]. |
|
7553 |
||
7554 |
^ Smalltalk getPackageFileName:relDir. |
|
7555 |
||
7556 |
" |
|
7557 |
Smalltalk findPackageDirectoryForPackage:'stx:libview/resources' |
|
7558 |
Smalltalk findPackageDirectoryForPackage:'stx:libview' |
|
7559 |
" |
|
7560 |
! |
|
7561 |
||
10641 | 7562 |
flushPathCaches |
7563 |
"{ Pragma: +optSpace }" |
|
7564 |
||
7565 |
"forget pathCaches - these are collections containing valid directory names, |
|
7566 |
where system files (resource, bitmaps etc.) are found. |
|
7567 |
A flush is only required, if a new system directory has been created while |
|
7568 |
the system is active, and those files should override the others |
|
7569 |
(for example, if you created a private resource directory)" |
|
7570 |
||
7571 |
RealSystemPath := ResourcePath := SourcePath := |
|
15332 | 7572 |
BinaryPath := FileInPath := nil. |
7573 |
||
10641 | 7574 |
" |
7575 |
Smalltalk flushPathCaches |
|
7576 |
" |
|
7577 |
! |
|
7578 |
||
7579 |
getBinaryFileName:aFileName |
|
7580 |
"obsolete |
|
7581 |
search aFileName in some standard places |
|
7582 |
(subdirectories named 'binary' in SystemPath); |
|
7583 |
return the absolute filename or nil if none is found." |
|
7584 |
||
7585 |
BinaryPath isNil ifTrue:[ |
|
18668 | 7586 |
BinaryPath := self constructPathFor:BinaryDirName |
10641 | 7587 |
]. |
7588 |
||
7589 |
^ self searchPath:BinaryPath for:aFileName in:BinaryDirName |
|
7590 |
||
7591 |
"Modified: 18.7.1996 / 15:53:49 / cg" |
|
7592 |
! |
|
7593 |
||
7594 |
getBitmapFileName:aFileName |
|
7595 |
"for backward compatibility: |
|
7596 |
search aFileName in some standard places |
|
7597 |
(subdirectories named 'bitmaps' in SystemPath); |
|
7598 |
Return the pathName or nil if none is found." |
|
7599 |
||
7600 |
^ self getBitmapFileName:aFileName forPackage:nil |
|
7601 |
||
7602 |
" |
|
7603 |
Smalltalk getBitmapFileName:'SBrowser.xbm' |
|
7604 |
" |
|
7605 |
||
7606 |
"Modified: 18.7.1996 / 15:53:55 / cg" |
|
7607 |
! |
|
7608 |
||
7609 |
getBitmapFileName:aFileName forPackage:aPackageIDOrNil |
|
7610 |
"for backward compatibility. |
|
7611 |
search aFileName in some standard places: |
|
7612 |
first in the redefinable bitmaps path, |
|
7613 |
then in the package directory if existing. |
|
7614 |
Return a path or nil. |
|
7615 |
Search order is: |
|
23433 | 7616 |
bitmaps/<pkg>/file |
7617 |
resources/<pkg>/bitmaps/file |
|
7618 |
<pkg>/bitmaps/file |
|
10641 | 7619 |
" |
7620 |
||
7621 |
|f dir packageDir pF| |
|
7622 |
||
15225 | 7623 |
f := aFileName asString withoutPrefix:'bitmaps/'. |
10641 | 7624 |
|
7625 |
aPackageIDOrNil isNil ifTrue:[ |
|
23433 | 7626 |
"/ this will be an error in the future |
10641 | 7627 |
"/ 'Smalltalk [warning]: bitmap file access without package: ' infoPrint. aFileName infoPrintCR. |
7628 |
"/ self halt. |
|
7629 |
||
23433 | 7630 |
pF := self searchPath:(self realSystemPath) for:aFileName in:('bitmaps'). |
7631 |
pF notNil ifTrue:[ |
|
7632 |
^ pF. |
|
7633 |
]. |
|
7634 |
f ~= aFileName ifTrue:[ |
|
7635 |
pF := self searchPath:(self realSystemPath) for:f in:('bitmaps'). |
|
7636 |
pF notNil ifTrue:[ |
|
7637 |
^ pF. |
|
7638 |
]. |
|
7639 |
]. |
|
7640 |
^ nil |
|
11077
14df4640ed89
image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents:
11057
diff
changeset
|
7641 |
]. |
14df4640ed89
image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents:
11057
diff
changeset
|
7642 |
|
14df4640ed89
image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents:
11057
diff
changeset
|
7643 |
dir := self projectDirectoryForPackage:aPackageIDOrNil. |
14df4640ed89
image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents:
11057
diff
changeset
|
7644 |
dir notNil ifTrue:[ |
23433 | 7645 |
pF := dir asFilename / f. |
7646 |
pF exists ifTrue:[ |
|
7647 |
^ pF. |
|
7648 |
]. |
|
7649 |
pF := dir asFilename / 'bitmaps' /f. |
|
7650 |
pF exists ifTrue:[ |
|
7651 |
^ pF. |
|
7652 |
]. |
|
10641 | 7653 |
]. |
7654 |
||
7655 |
packageDir := aPackageIDOrNil copyReplaceAll:$: with:$/. |
|
7656 |
||
7657 |
pF := self searchPath:(self realSystemPath) for:aFileName in:('bitmaps/',packageDir). |
|
7658 |
pF notNil ifTrue:[ |
|
23433 | 7659 |
^ pF. |
7660 |
]. |
|
23446 | 7661 |
#('../Resources' '.resources' 'resources') do:[:eachPossibleRsrcDir | |
7662 |
pF := self searchPath:(self realSystemPath) |
|
7663 |
for:aFileName |
|
7664 |
in:(eachPossibleRsrcDir,'/',packageDir,'/bitmaps'). |
|
7665 |
pF notNil ifTrue:[ |
|
7666 |
^ pF. |
|
7667 |
]. |
|
7668 |
]. |
|
10641 | 7669 |
^ nil |
7670 |
||
7671 |
" |
|
7672 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libview' |
|
7673 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libtool' |
|
7674 |
Smalltalk imageFromFileNamed:'bitmaps/gifImages/garfield.gif' inPackage:'stx:goodies' |
|
7675 |
Smalltalk imageFromFileNamed:'CheckOn10_xp.xpm' inPackage:'stx:libwidg' |
|
7676 |
" |
|
7677 |
||
7678 |
"Modified: / 11-10-2006 / 13:53:18 / cg" |
|
7679 |
! |
|
7680 |
||
7681 |
getFileInFileName:aFileName |
|
7682 |
"obsolete |
|
7683 |
search aFileName in some standard places |
|
7684 |
(subdirectories named 'fileIn' in SystemPath); |
|
7685 |
return the absolute filename or nil if none is found." |
|
7686 |
||
7687 |
FileInPath isNil ifTrue:[ |
|
18668 | 7688 |
FileInPath := self constructPathFor:FileInDirName |
10641 | 7689 |
]. |
7690 |
||
7691 |
^ self searchPath:FileInPath for:aFileName in:FileInDirName |
|
7692 |
||
7693 |
"Modified: 18.7.1996 / 15:53:59 / cg" |
|
7694 |
! |
|
7695 |
||
7696 |
getPackageDirectoryForPackage:aPackageID |
|
7697 |
"search for a particular package; return its directory, or nil. |
|
7698 |
Stand alone applications might get nil, if there are only binaries installed." |
|
7699 |
||
19121 | 7700 |
|packageId checkForPackageDirectory module packageSubDirectory| |
7701 |
||
7702 |
packageId := aPackageID asPackageId. |
|
7703 |
module := packageId module. |
|
7704 |
packageSubDirectory := packageId directory. |
|
10641 | 7705 |
|
7706 |
checkForPackageDirectory := |
|
22791 | 7707 |
[:moduleDir | |
7708 |
|packageDir| |
|
7709 |
||
7710 |
moduleDir isDirectory ifTrue:[ |
|
7711 |
packageDir := moduleDir / packageSubDirectory. |
|
7712 |
packageDir isDirectory ifTrue:[ |
|
7713 |
^ packageDir |
|
7714 |
] |
|
7715 |
]. |
|
7716 |
]. |
|
10641 | 7717 |
|
7718 |
self packagePath do:[:aPath | |
|
22791 | 7719 |
|moduleDir| |
7720 |
||
7721 |
moduleDir := aPath asFilename / module. |
|
7722 |
checkForPackageDirectory value:moduleDir. |
|
10641 | 7723 |
]. |
7724 |
||
7725 |
^ nil |
|
7726 |
||
7727 |
" |
|
7728 |
Smalltalk getPackageDirectoryForPackage:(Array package) |
|
7729 |
Smalltalk getPackageDirectoryForPackage:'stx:goodies/bitmaps' |
|
7730 |
Smalltalk getPackageDirectoryForPackage:'stx:libview' |
|
7731 |
" |
|
7732 |
||
7733 |
"Modified: / 06-10-2006 / 11:49:27 / cg" |
|
7734 |
! |
|
7735 |
||
7736 |
getPackageFileName:aFileName |
|
7737 |
"search aFileName in some standard places |
|
7738 |
(packagePath and subdirectories named 'packages' in SystemPath); |
|
7739 |
return the absolute filename or nil if none is found." |
|
7740 |
||
7741 |
|f| |
|
7742 |
||
7743 |
"/ search along packagePath ... |
|
7744 |
f := self searchPath:self packagePath for:aFileName in:nil. |
|
7745 |
f isNil ifTrue:[ |
|
23450 | 7746 |
"/ search under packages-directory along systemPath ... |
7747 |
f := self searchPath:self realSystemPath for:aFileName in:PackageDirName. |
|
7748 |
"/ kludge - allow for stx-directory to be named differently |
|
7749 |
f isNil ifTrue:[ |
|
7750 |
(aFileName asString startsWith:('stx' , Filename separator)) ifTrue:[ |
|
7751 |
f := '..' asFilename / '..' / (aFileName copyFrom:5). |
|
7752 |
] |
|
7753 |
]. |
|
10641 | 7754 |
]. |
7755 |
(f notNil and:[(f := f asFilename) exists]) ifTrue:[ |
|
23450 | 7756 |
^ f pathName |
7758 | 7757 |
]. |
7758 |
^ nil |
|
10641 | 7759 |
|
7760 |
" |
|
16668
b88318df967d
flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents:
16666
diff
changeset
|
7761 |
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
|
7762 |
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
|
7763 |
Smalltalk getPackageFileName:'stx/libview/source.zip' |
10641 | 7764 |
" |
7765 |
! |
|
7766 |
||
15074 | 7767 |
getPackageSourceFileName:filenameWithoutSuffixArg |
13415 | 7768 |
"search aFileName in some standard places and try all available languages" |
7769 |
||
15074 | 7770 |
|filenameWithoutSuffix| |
7771 |
||
7772 |
filenameWithoutSuffix:= filenameWithoutSuffixArg asFilename. |
|
7773 |
||
16170
ca4d03def070
endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents:
16164
diff
changeset
|
7774 |
ProgrammingLanguage |
24376 | 7775 |
allDo:[:lang | |
7776 |
|file| |
|
7777 |
||
7778 |
file := self getPackageFileName:(filenameWithoutSuffix addSuffix:lang sourceFileSuffix). |
|
7779 |
file notNil ifTrue:[ ^ file ] |
|
7780 |
]. |
|
15074 | 7781 |
^ nil |
13415 | 7782 |
|
7783 |
"Created: / 16-08-2009 / 14:44:58 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
24376 | 7784 |
"Modified (format): / 27-06-2019 / 12:32:39 / Claus Gittinger" |
13415 | 7785 |
! |
7786 |
||
10641 | 7787 |
getResourceFileName:aFileName |
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7788 |
<resource: #obsolete> |
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7789 |
|
10641 | 7790 |
"search aFileName in some standard places |
7791 |
(subdirectories named 'resources' in SystemPath); |
|
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7792 |
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
|
7793 |
Obsolete: you must now provide a package argument." |
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7794 |
|
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7795 |
self obsoleteMethodWarning:'use getResourceFileName:forPackage:'. |
10641 | 7796 |
^ self getResourceFileName:aFileName forPackage:nil |
7797 |
||
7798 |
" |
|
7799 |
Smalltalk getResourceFileName:'SystemBrowser.rs' |
|
7800 |
" |
|
7801 |
||
7802 |
"Modified: 18.7.1996 / 15:54:03 / cg" |
|
7803 |
! |
|
7804 |
||
7805 |
getResourceFileName:aFileName forClass:aClassOrNil |
|
7806 |
"search aFileName in some standard places |
|
7807 |
(subdirectories named 'resource' in SystemPath); |
|
7808 |
and in aClasses package directory. |
|
7809 |
Return the absolute filename or nil if none is found." |
|
7810 |
||
7811 |
|pkgOrNil| |
|
7812 |
||
7813 |
aClassOrNil notNil ifTrue:[ |
|
18668 | 7814 |
pkgOrNil := aClassOrNil package. |
10641 | 7815 |
]. |
7816 |
^ self getResourceFileName:aFileName forPackage:pkgOrNil. |
|
7817 |
||
7818 |
" |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7819 |
Smalltalk getResourceFileName:'de.rs' forClass:SystemBrowser |
10641 | 7820 |
" |
7821 |
! |
|
7822 |
||
7823 |
getResourceFileName:aFileName forPackage:aPackageIDOrNil |
|
7824 |
"search aFileName in some standard places |
|
7825 |
(subdirectories named 'resource' in SystemPath); |
|
7826 |
and in a packages directory. |
|
7827 |
Return the absolute filename or nil if none is found. |
|
7828 |
Search order is: |
|
23433 | 7829 |
resources/<pkg>/file |
7830 |
<pkg>/resources/file |
|
10641 | 7831 |
" |
7832 |
||
23467 | 7833 |
|pF f dir packageDir possibleResourceDirs| |
10641 | 7834 |
|
15225 | 7835 |
f := aFileName asString withoutPrefix:'resources/'. |
10641 | 7836 |
|
23467 | 7837 |
OperatingSystem isOSXlike ifTrue:[ |
7838 |
possibleResourceDirs := #('../Resources' '.resources' 'resources'). |
|
7839 |
] ifFalse:[ |
|
7840 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
7841 |
possibleResourceDirs := #('resources'). |
|
7842 |
] ifFalse:[ |
|
7843 |
possibleResourceDirs := #('.resources' 'resources'). |
|
7844 |
]. |
|
7845 |
]. |
|
7846 |
||
10641 | 7847 |
aPackageIDOrNil isNil ifTrue:[ |
23433 | 7848 |
"/ this will be an error in the future |
10641 | 7849 |
"/ 'Smalltalk [warning]: resource file access without package: ' infoPrint. aFileName infoPrintCR. |
7850 |
"/ self halt. |
|
7851 |
||
23467 | 7852 |
possibleResourceDirs do:[:eachPossibleRsrcDir | |
23446 | 7853 |
pF := self searchPath:(self realSystemPath) |
7854 |
for:aFileName |
|
7855 |
in:(eachPossibleRsrcDir). |
|
7856 |
pF notNil ifTrue:[ |
|
7857 |
^ pF. |
|
7858 |
]. |
|
23449 | 7859 |
f ~= aFileName ifTrue:[ |
23446 | 7860 |
pF := self searchPath:(self realSystemPath) |
7861 |
for:f |
|
7862 |
in:(eachPossibleRsrcDir). |
|
7863 |
pF notNil ifTrue:[ |
|
7864 |
^ pF. |
|
7865 |
]. |
|
23433 | 7866 |
]. |
7867 |
]. |
|
7868 |
^ nil |
|
10641 | 7869 |
]. |
7870 |
||
7871 |
packageDir := aPackageIDOrNil copyReplaceAll:$: with:$/. |
|
7872 |
||
23450 | 7873 |
"/ search under resources-directory along systemPath ... |
7874 |
pF := self |
|
7875 |
searchPath:(self realSystemPath) |
|
7876 |
for:(packageDir asFilename / 'resources' / f) |
|
7877 |
in:ResourceDirName. |
|
7878 |
pF notNil ifTrue:[ |
|
7879 |
^ pF. |
|
7880 |
]. |
|
7881 |
||
23467 | 7882 |
possibleResourceDirs do:[:eachPossibleRsrcDir | |
23446 | 7883 |
pF := self searchPath:(self realSystemPath) |
7884 |
for:aFileName |
|
7885 |
in:(eachPossibleRsrcDir,'/',packageDir). |
|
7886 |
pF notNil ifTrue:[ |
|
7887 |
^ pF. |
|
7888 |
]. |
|
10641 | 7889 |
]. |
7890 |
||
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7891 |
"/ the following code finds the file within the IDE's own hierarchy |
10641 | 7892 |
dir := self projectDirectoryForPackage:aPackageIDOrNil. |
7893 |
dir notNil ifTrue:[ |
|
23433 | 7894 |
dir := dir asFilename. |
7895 |
||
7896 |
(pF := dir / 'resources' / f) exists ifTrue:[ ^ pF name ]. |
|
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7897 |
"/ (pF := dir / 'styles' / f) exists ifTrue:[ ^ pF name ]. |
12377 | 7898 |
|
23433 | 7899 |
"resolve something like: 'ASN/definition.asn1'" |
7900 |
(pF := dir / f) exists ifTrue:[ ^ pF name ]. |
|
12377 | 7901 |
]. |
7902 |
||
10641 | 7903 |
^ nil |
7904 |
||
7905 |
" |
|
23449 | 7906 |
Smalltalk projectDirectoryForPackage:'stx:libtool' |
7907 |
||
10641 | 7908 |
Smalltalk getResourceFileName:'SystemBrowser.rs' forPackage:'stx:libtool' |
7909 |
Smalltalk getResourceFileName:'normal.style' forPackage:'stx:libview' |
|
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7910 |
Smalltalk getResourceFileName:'styles/normal.style' forPackage:'stx:libview' |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7911 |
Smalltalk getResourceFileName:'styles/mswindowsXP.style' forPackage:'stx:libview' |
10641 | 7912 |
Smalltalk getResourceFileName:'Foo.rs' forPackage:'stx:libview' |
7913 |
" |
|
7914 |
||
7915 |
"Modified: / 11-10-2006 / 13:53:43 / cg" |
|
23467 | 7916 |
"Modified: / 25-10-2018 / 10:00:30 / Claus Gittinger" |
10641 | 7917 |
! |
7918 |
||
7919 |
getSourceFileName:aFileName |
|
7920 |
"search aFileName in some standard places |
|
7921 |
(subdirectories named 'source' in SystemPath); |
|
7922 |
return the absolute filename or nil if none is found. |
|
7923 |
This is used to find a sourceFile for a methods source, |
|
7924 |
if no sourceCodeManager is available." |
|
7925 |
||
7926 |
|f| |
|
7927 |
||
7928 |
SourcePath isNil ifTrue:[ |
|
23470 | 7929 |
SourcePath := self constructPathFor:SourceDirName |
10641 | 7930 |
]. |
7931 |
||
7932 |
"/ first, try a source subdir along the path. |
|
7933 |
SourcePath notNil ifTrue:[ |
|
23470 | 7934 |
f := self searchPath:SourcePath for:aFileName in:SourceDirName. |
10641 | 7935 |
]. |
7936 |
f isNil ifTrue:[ |
|
23470 | 7937 |
"/ then, try it itself along the path. |
7938 |
f := self searchPath:self realSystemPath for:aFileName in:nil |
|
10641 | 7939 |
]. |
7940 |
^ f |
|
7941 |
||
7942 |
" |
|
7943 |
Smalltalk getSourceFileName:'Smalltalk.st' |
|
23470 | 7944 |
Smalltalk getSourceFileName:'stx/libbasic/ArrayedCollection.st' |
7945 |
" |
|
7946 |
||
7947 |
"Modified: / 18-07-1996 / 15:54:07 / cg" |
|
7948 |
"Modified (comment): / 25-10-2018 / 23:29:01 / Claus Gittinger" |
|
10641 | 7949 |
! |
7950 |
||
7951 |
getSystemFileName:aFileNameOrString |
|
7952 |
"search aFileNameOrString in some standard places; |
|
7953 |
return the absolute filename or nil if none is found. |
|
7954 |
see comment in Smalltalk>>initSystemPath. |
|
7955 |
This should be used to access resources such as bitmaps, doc-files, |
|
7956 |
and other help files. |
|
7957 |
" |
|
7958 |
||
7959 |
"credits for this method go to Markus ...." |
|
7960 |
||
7961 |
|fn nameString| |
|
7962 |
||
7963 |
fn := aFileNameOrString asFilename. |
|
7964 |
nameString := fn name. |
|
7965 |
fn isAbsolute ifTrue:[ |
|
22791 | 7966 |
"don't use path for absolute file names" |
7967 |
||
7968 |
^ nameString |
|
10641 | 7969 |
]. |
7970 |
||
7971 |
self realSystemPath do:[:dirName | |
|
22791 | 7972 |
|realName| |
7973 |
||
7974 |
realName := dirName asFilename / nameString. |
|
7975 |
"/ |
|
7976 |
"/ here, we also return true if it's a directory |
|
7977 |
"/ (Even if unreadable). |
|
7978 |
"/ It could be that the file itself is still readable. |
|
7979 |
"/ |
|
7980 |
(realName isDirectory or:[realName isReadable]) ifTrue: [ |
|
7981 |
^ realName name |
|
7982 |
] |
|
10641 | 7983 |
]. |
7984 |
^ nil |
|
7985 |
||
7986 |
" |
|
7987 |
Smalltalk getSystemFileName:'doc/online/english/TOP.html' |
|
7988 |
Smalltalk getSystemFileName:'bitmaps/SBrowser.xbm' |
|
7989 |
Smalltalk getSystemFileName:'bitmaps/foo' |
|
7990 |
Smalltalk getSystemFileName:'resources/View.rs' |
|
7991 |
Smalltalk getSystemFileName:'resources/iris.style' |
|
7992 |
" |
|
7993 |
||
21443 | 7994 |
"Modified: / 06-05-1999 / 10:40:37 / cg" |
7995 |
"Modified (comment): / 13-02-2017 / 20:30:51 / cg" |
|
10641 | 7996 |
! |
7997 |
||
7998 |
imageFromFileNamed:aFileName forClass:aClass |
|
7999 |
"search aFileName in some standard places: |
|
8000 |
first in the redefinable bitmaps path, then in the classes |
|
8001 |
own package directory if existing. |
|
8002 |
Return an image or nil." |
|
8003 |
||
8004 |
|classPackage img| |
|
8005 |
||
8006 |
classPackage := aClass package. |
|
8007 |
img := self imageFromFileNamed:aFileName inPackage:classPackage. |
|
8008 |
img isNil ifTrue:[ |
|
18668 | 8009 |
"/ try under the goodies package ... |
8010 |
classPackage ~= 'stx:goodies' ifTrue:[ |
|
8011 |
img := self imageFromFileNamed:aFileName inPackage:'stx:goodies'. |
|
8012 |
] |
|
10641 | 8013 |
]. |
8014 |
^ img |
|
8015 |
||
8016 |
" |
|
8017 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' forClass:View |
|
8018 |
" |
|
8019 |
! |
|
8020 |
||
8021 |
imageFromFileNamed:aFileName inPackage:aPackage |
|
8022 |
"search aFileName in some standard places: |
|
8023 |
first in the redefinable bitmaps path, |
|
8024 |
then in the package directory if existing. |
|
8025 |
Return an image or nil. |
|
8026 |
Search order is: |
|
18668 | 8027 |
bitmaps/<pkg>/file |
8028 |
resources/<pkg>/bitmaps/file |
|
8029 |
<pkg>/bitmaps/file |
|
10641 | 8030 |
" |
8031 |
||
8032 |
|path| |
|
8033 |
||
8034 |
path := self getBitmapFileName:aFileName forPackage:aPackage. |
|
8035 |
path notNil ifTrue:[ |
|
18668 | 8036 |
^ Image fromFile:path. |
10641 | 8037 |
]. |
8038 |
^ nil |
|
8039 |
||
8040 |
" |
|
8041 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libview' |
|
8042 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libtool' |
|
8043 |
Smalltalk imageFromFileNamed:'bitmaps/gifImages/garfield.gif' inPackage:'stx:goodies' |
|
8044 |
Smalltalk imageFromFileNamed:'CheckOn10_xp.xpm' inPackage:'stx:libwidg' |
|
8045 |
Smalltalk imageFromFileNamed:'ComboDn_xp.xpm' inPackage:'stx:libwidg' |
|
8046 |
" |
|
8047 |
||
8048 |
"Modified: / 08-09-2006 / 18:02:04 / cg" |
|
8049 |
! |
|
8050 |
||
8051 |
libraryFileNameOfClass:aClassOrClassName |
|
8052 |
"for a given class, return the name of a classLibrary which contains |
|
8053 |
binary code for it. |
|
8054 |
Read the libinfo file 'liblist.stc' (which is created during the compilation process) |
|
8055 |
for an entry for aClassOrClassName. |
|
8056 |
Search for the className in the first col, and return the value found in |
|
8057 |
the 2nd col. |
|
8058 |
Return nil if no entry is found. |
|
8059 |
||
8060 |
A nil returns means that this class is either built-in or not present |
|
8061 |
in a package-class library (i.e. either as separate .o or separate .st file). |
|
8062 |
Otherwise, the returned name is the classLibrary object of that class. |
|
8063 |
The classes code can be loaded from that file if binary loading is supported." |
|
8064 |
||
8065 |
|aStream line words n aClassName| |
|
8066 |
||
8067 |
aClassOrClassName isBehavior ifTrue:[ |
|
18668 | 8068 |
aClassName := aClassOrClassName name |
10641 | 8069 |
] ifFalse:[ |
18668 | 8070 |
aClassName := aClassOrClassName |
10641 | 8071 |
]. |
8072 |
aClassName := aClassName asString. |
|
8073 |
||
8074 |
#('include/liblist.stc') "/ filenames |
|
8075 |
with:#(2) "/ column |
|
8076 |
do:[:fileName :col | |
|
8077 |
||
18668 | 8078 |
aStream := self systemFileStreamFor:fileName. |
8079 |
aStream notNil ifTrue:[ |
|
8080 |
[aStream atEnd] whileFalse:[ |
|
8081 |
line := aStream nextLine. |
|
8082 |
line notNil ifTrue:[ |
|
8083 |
(line startsWith:'#') ifFalse:[ |
|
8084 |
words := line asCollectionOfWords. |
|
8085 |
(n := words size) > 1 ifTrue:[ |
|
8086 |
(words at:1) = aClassName ifTrue:[ |
|
8087 |
n >= col ifTrue:[ |
|
8088 |
aStream close. |
|
8089 |
^ (words at:col) withoutSeparators |
|
8090 |
] |
|
8091 |
] |
|
8092 |
] |
|
8093 |
] |
|
8094 |
] |
|
8095 |
]. |
|
8096 |
aStream close |
|
8097 |
]. |
|
10641 | 8098 |
]. |
8099 |
||
8100 |
^ nil |
|
8101 |
||
8102 |
" |
|
8103 |
Smalltalk libraryFileNameOfClass:'ClockView' |
|
8104 |
Smalltalk libraryFileNameOfClass:'Bag' |
|
8105 |
" |
|
8106 |
||
8107 |
"Modified: 6.11.1995 / 15:41:39 / cg" |
|
8108 |
! |
|
8109 |
||
8110 |
packagePath |
|
15781 | 8111 |
"return a collection of additional directory names, where smalltalk |
10641 | 8112 |
looks for package directories. |
8113 |
Notice, that directories named 'packages' under the systemPath are |
|
8114 |
always consulted - even if not in the packagePath" |
|
8115 |
||
20640 | 8116 |
^ PackagePath ? #() |
10641 | 8117 |
|
8118 |
" |
|
8119 |
Smalltalk packagePath |
|
8120 |
Smalltalk packagePath addLast:'/opt/smalltalk' |
|
8121 |
Smalltalk packagePath addFirst:'/usr/local/otherPackages' |
|
8122 |
" |
|
8123 |
! |
|
8124 |
||
8125 |
packagePath:aPath |
|
8126 |
"set the packagePath; |
|
8127 |
a collection of additional directorynames, where smalltalk |
|
8128 |
looks for package directories. |
|
8129 |
Notice, that directories named 'packages' under the systemPath are |
|
8130 |
always consulted - even if not in the packagePath" |
|
8131 |
||
8132 |
PackagePath := aPath asOrderedCollection |
|
8133 |
||
8134 |
" |
|
8135 |
Smalltalk packagePath:#( '.' '/opt/stx' '/opt/smalltalk' '/usr/local/otherPackages') |
|
8136 |
" |
|
8137 |
! |
|
8138 |
||
8139 |
projectDirectoryForClass:aClass |
|
8140 |
"given a class, return the path to its package directory; |
|
8141 |
nil if not found." |
|
8142 |
||
8143 |
|pkg| |
|
8144 |
||
8145 |
pkg := aClass package. |
|
8146 |
pkg isNil ifTrue:[^ nil]. |
|
8147 |
||
8148 |
^ self projectDirectoryForPackage:pkg. |
|
8149 |
||
8150 |
" |
|
8151 |
Smalltalk projectDirectoryForClass:Array |
|
8152 |
Smalltalk projectDirectoryForClass:View |
|
8153 |
" |
|
8154 |
! |
|
8155 |
||
8156 |
projectDirectoryForPackage:aPackage |
|
8157 |
"given a packageID, return the path to its package directory; |
|
8158 |
nil if not found." |
|
8159 |
||
16642 | 8160 |
^ aPackage asPackageId packageDirectory. |
8161 |
||
23449 | 8162 |
"/ |prj prjDir| |
8163 |
"/ |
|
23448 | 8164 |
"/ "/ there might be a package specific resource directory ... |
8165 |
"/ "/ in the directory, from which the project was loaded |
|
8166 |
"/ prj := Project projectWithId:aPackage. |
|
8167 |
"/ prj notNil ifTrue:[ |
|
8168 |
"/ prjDir := prj directory. |
|
8169 |
"/ ]. |
|
8170 |
"/ (prjDir notNil and:[prjDir asFilename exists]) ifFalse:[ |
|
8171 |
"/ prjDir := Smalltalk getPackageFileName:(aPackage copyReplaceAll:$: with:$/). |
|
8172 |
"/ ]. |
|
8173 |
"/ ^ prjDir |
|
10641 | 8174 |
|
8175 |
" |
|
16668
b88318df967d
flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents:
16666
diff
changeset
|
8176 |
Smalltalk projectDirectoryForPackage:'stx:libbasic' |
10641 | 8177 |
Smalltalk projectDirectoryForPackage:'exept:smartcard' |
16668
b88318df967d
flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents:
16666
diff
changeset
|
8178 |
Smalltalk projectDirectoryForPackage:'stx' |
b88318df967d
flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents:
16666
diff
changeset
|
8179 |
Smalltalk projectDirectoryForPackage:'bosch' |
b88318df967d
flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents:
16666
diff
changeset
|
8180 |
Smalltalk projectDirectoryForPackage:'bosch:foo' |
10641 | 8181 |
" |
8182 |
||
8183 |
"Modified: / 07-10-2006 / 17:45:58 / cg" |
|
8184 |
! |
|
8185 |
||
8186 |
readAbbreviations |
|
8187 |
"read classname to filename mappings from include/abbrev.stc. |
|
8188 |
sigh - all for those poor sys5.3 or MSDOS people with short filenames ..." |
|
8189 |
||
8190 |
"since installAutoloadedClasses also reads all abbreviations, use it" |
|
8191 |
||
8192 |
CachedAbbreviations := IdentityDictionary new. |
|
8193 |
self installAutoloadedClasses. |
|
8194 |
^ CachedAbbreviations. |
|
8195 |
||
8196 |
" |
|
8197 |
Smalltalk readAbbreviations |
|
8198 |
" |
|
8199 |
||
8200 |
"Modified: / 10.12.1999 / 17:48:53 / cg" |
|
8201 |
! |
|
8202 |
||
8203 |
readAbbreviationsFromStream:aStream |
|
8204 |
"read classname to filename mappings from aStream. |
|
8205 |
sigh - all for those poor sys5.3 or MSDOS people with short filenames ..." |
|
8206 |
||
11375 | 8207 |
self |
18668 | 8208 |
withAbbreviationsFromStream:aStream |
8209 |
do:[:className :abbrev :pkg | |
|
8210 |
self setFilename:abbrev forClass:className package:pkg. |
|
8211 |
]. |
|
10641 | 8212 |
|
8213 |
"Modified: / 13.12.1999 / 11:54:17 / cg" |
|
8214 |
! |
|
8215 |
||
8216 |
realSystemPath |
|
16642 | 8217 |
"return the realSystemPath - that's the directory names from |
10641 | 8218 |
SystemPath which exist and are readable" |
8219 |
||
8220 |
|nP| |
|
8221 |
||
8222 |
RealSystemPath isNil ifTrue:[ |
|
18668 | 8223 |
OperatingSystem isVMSlike ifTrue:[ |
8224 |
"/ temporary kludge: since we cannot currently |
|
8225 |
"/ check for existence of a name like 'volume:', |
|
8226 |
"/ leave those in the Path without a check. |
|
8227 |
RealSystemPath := SystemPath select:[:dirName | |f| |
|
8228 |
f := dirName asFilename. |
|
8229 |
f isVolumeOnly or:[(f isDirectory) and:[f isReadable]] |
|
8230 |
] |
|
8231 |
] ifFalse:[ |
|
8232 |
RealSystemPath := SystemPath |
|
8233 |
select:[:eachDirectoryName | |f| |
|
8234 |
f := eachDirectoryName asFilename. |
|
8235 |
(f isDirectory) and:[f isReadable] |
|
8236 |
] thenCollect:[:eachDirectoryName| |
|
8237 |
eachDirectoryName asFilename pathName. |
|
8238 |
]. |
|
8239 |
||
8240 |
"/ remove duplicates (but keep order) |
|
8241 |
nP := OrderedCollection new. |
|
8242 |
RealSystemPath do:[:p | |
|
8243 |
(nP includes:p) ifFalse:[ |
|
8244 |
nP add:p |
|
8245 |
] |
|
8246 |
]. |
|
8247 |
(nP includes:'.') ifFalse:[ |
|
8248 |
nP add:'.' |
|
8249 |
]. |
|
8250 |
RealSystemPath := nP. |
|
8251 |
]. |
|
617 | 8252 |
]. |
8253 |
^ RealSystemPath |
|
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 |
|
10641 | 8256 |
recursiveReadAllAbbreviationsFrom:aDirectory |
8257 |
self recursiveReadAllAbbreviationsFrom:aDirectory maxLevels:15 |
|
8258 |
! |
|
8259 |
||
8260 |
recursiveReadAllAbbreviationsFrom:aDirectory maxLevels:maxLevels |
|
8261 |
"read all abbreviations from and under aDirectory." |
|
8262 |
||
8263 |
|abbrevStream dir directoryContents| |
|
8264 |
||
8265 |
maxLevels == 0 ifTrue:[ |
|
8266 |
"/ 'Smalltalk [warning]: max directory nesting reached.' infoPrintCR. |
|
22791 | 8267 |
^ self |
10641 | 8268 |
]. |
8269 |
||
8270 |
dir := aDirectory asFilename. |
|
8271 |
dir exists ifFalse:[^ self]. |
|
8272 |
||
8273 |
[ |
|
22791 | 8274 |
abbrevStream := (dir / 'abbrev.stc') asFilename readStream. |
8275 |
self readAbbreviationsFromStream:abbrevStream. |
|
8276 |
abbrevStream close. |
|
10641 | 8277 |
] on:FileStream openErrorSignal do:[:ex| "ignore this file"]. |
8278 |
||
8279 |
[ |
|
22791 | 8280 |
directoryContents := dir directoryContents. |
10641 | 8281 |
] on:FileStream openErrorSignal do:[:ex| |
22791 | 8282 |
"non-accessible directory: we are done" |
8283 |
^ self |
|
10641 | 8284 |
]. |
8285 |
||
8286 |
directoryContents do:[:aFilename | |
|
22791 | 8287 |
|f| |
8288 |
||
8289 |
(#( |
|
8290 |
'doc' |
|
8291 |
'CVS' |
|
8292 |
'bitmaps' |
|
8293 |
'resources' |
|
8294 |
'source' |
|
8295 |
) includes:aFilename) ifFalse:[ |
|
8296 |
f := dir / aFilename. |
|
8297 |
f isDirectory ifTrue:[ |
|
8298 |
self recursiveReadAllAbbreviationsFrom:f maxLevels:maxLevels-1 |
|
8299 |
] |
|
8300 |
]. |
|
4458 | 8301 |
]. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8302 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8303 |
|
15334 | 8304 |
reinitializePackagePath |
8305 |
"{ Pragma: +optSpace }" |
|
20207 | 8306 |
|
15334 | 8307 |
PackagePath notNil ifTrue:[ |
22791 | 8308 |
PackagePath := PackagePath select:[:p | p asFilename exists]. |
15334 | 8309 |
]. |
8310 |
PackagePath isEmptyOrNil ifTrue:[ |
|
22791 | 8311 |
PackagePath := OperatingSystem defaultPackagePath |
18868 | 8312 |
]. |
8313 |
self addWorkspaceDirectoryToPackagePath. |
|
15334 | 8314 |
! |
8315 |
||
13368 | 8316 |
relativePackagePathForPackage:aPackage |
8317 |
|path| |
|
8318 |
||
8319 |
PackageToPathMapping notNil ifTrue:[ |
|
18668 | 8320 |
path := PackageToPathMapping at:aPackage ifAbsent:nil. |
8321 |
PackageToPathMapping notNil ifTrue:[^ path]. |
|
13370 | 8322 |
]. |
8323 |
^ aPackage copyReplaceAll:$: with:$/. |
|
13368 | 8324 |
|
8325 |
" |
|
8326 |
PackageToPathMapping := Dictionary new. |
|
8327 |
PackageToPathMapping at:'expeccoNET:server' put:'expeccoNET_oldVersion/server'. |
|
8328 |
PackageToPathMapping at:'expeccoNET:server/ui' put:'expeccoNET_oldVersion/server/ui'. |
|
8329 |
||
8330 |
Smalltalk relativePackagePathForPackage:'stx:libview/resources' |
|
8331 |
Smalltalk relativePackagePathForPackage:'stx:libview' |
|
8332 |
" |
|
8333 |
! |
|
8334 |
||
10641 | 8335 |
resourceDirectoryForPackage:aPackage |
8336 |
"given a packageID, return the path to its resource directory; |
|
8337 |
nil if not found." |
|
8338 |
||
8339 |
|prjDir rsrcDir| |
|
8340 |
||
11183
9a4e7475a655
care for nil project when asked for a resource directory
Claus Gittinger <cg@exept.de>
parents:
11174
diff
changeset
|
8341 |
aPackage notNil ifTrue:[ |
23433 | 8342 |
prjDir := self projectDirectoryForPackage:aPackage. |
8343 |
(prjDir notNil |
|
8344 |
and:[(prjDir := prjDir asFilename) exists |
|
8345 |
and:[(rsrcDir := prjDir / 'resources') exists]]) ifTrue:[ |
|
8346 |
^ rsrcDir |
|
8347 |
]. |
|
23445 | 8348 |
|
8349 |
#( '../Resources' '.resources' 'resources' ) do:[:eachPossibleRsrcDir | |
|
8350 |
rsrcDir := self getSystemFileName:(eachPossibleRsrcDir,'/',(aPackage copyReplaceAll:$: with:$/)). |
|
8351 |
rsrcDir notNil ifTrue:[ |
|
8352 |
^ rsrcDir asFilename |
|
8353 |
]. |
|
23433 | 8354 |
]. |
10641 | 8355 |
]. |
8356 |
^ nil |
|
8357 |
||
8358 |
" |
|
8359 |
Smalltalk resourceDirectoryForPackage:'stx:libbasic' |
|
8360 |
Smalltalk resourceDirectoryForPackage:'exept:expecco' |
|
8361 |
Smalltalk resourceDirectoryForPackage:'exept:smartcard' |
|
8362 |
" |
|
8363 |
! |
|
8364 |
||
8365 |
resourceFileStreamFor:aFileName |
|
8366 |
"search aFileName in some standard places; |
|
8367 |
return a readonly fileStream or nil if not found. |
|
8368 |
Searches in subdirectories named 'resource' in SystemPath" |
|
8369 |
||
8370 |
^ self resourceFileStreamFor:aFileName forClass:nil |
|
8371 |
! |
|
8372 |
||
8373 |
resourceFileStreamFor:aFileName forClass:aClassOrNil |
|
8374 |
"search aFileName in some standard places and in the classes |
|
8375 |
package-resource directory. |
|
8376 |
Return a readonly fileStream or nil if not found. |
|
8377 |
Searches in subdirectories named 'resource' in SystemPath" |
|
8378 |
||
8379 |
|aString| |
|
8380 |
||
8381 |
aString := self getResourceFileName:aFileName forClass:aClassOrNil. |
|
8382 |
aString notNil ifTrue:[ |
|
18668 | 8383 |
^ aString asFilename readStreamOrNil |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8384 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8385 |
^ nil |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8386 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8387 |
|
10641 | 8388 |
searchPath:aPath for:aFileName in:aDirName |
8389 |
"search aPath for a subdirectory named aDirectory with a file |
|
8390 |
named aFileName" |
|
8391 |
||
8392 |
|f| |
|
8393 |
||
8394 |
((f := aFileName asFilename) isAbsolute |
|
8395 |
or:[f isExplicitRelative]) ifTrue:[ |
|
22791 | 8396 |
"/ |
8397 |
"/ don't use path for absolute or explicit .-relative file names |
|
8398 |
"/ |
|
8399 |
^ aFileName |
|
10641 | 8400 |
]. |
8401 |
||
8402 |
aPath notNil ifTrue:[ |
|
22791 | 8403 |
aPath do:[:dirName | |
8404 |
|realName dir| |
|
8405 |
||
8406 |
dir := dirName asFilename. |
|
8407 |
aDirName notNil ifTrue:[ |
|
8408 |
realName := dir / aDirName / aFileName. |
|
8409 |
] ifFalse:[ |
|
8410 |
realName := dir / aFileName. |
|
8411 |
]. |
|
8412 |
(realName isReadable) ifTrue:[ |
|
8413 |
^ realName name |
|
8414 |
] |
|
8415 |
]. |
|
11108 | 8416 |
]. |
8417 |
||
8418 |
"/ not needed - executing dir is always in SearchPath |
|
12377 | 8419 |
"/ realName := Filename currentDirectory / aFileName. |
11108 | 8420 |
"/ (realName isReadable) ifTrue:[ |
8421 |
"/ ^ realName name |
|
8422 |
"/ ]. |
|
10641 | 8423 |
^ nil. |
8424 |
||
8425 |
"Modified: / 29.4.1999 / 15:06:43 / cg" |
|
8426 |
! |
|
8427 |
||
8428 |
setFilename:aFileNameString forClass:aClassNameString package:aPackageNameString |
|
8429 |
|classNameSymbol oldAbbrev oldPath newPath cls abbrevs| |
|
8430 |
||
8431 |
CachedAbbreviations isNil ifTrue:[ |
|
18668 | 8432 |
CachedAbbreviations := IdentityDictionary new. |
10641 | 8433 |
]. |
8434 |
||
8435 |
abbrevs := CachedAbbreviations. |
|
8436 |
aClassNameString ~= aFileNameString ifTrue:[ |
|
18668 | 8437 |
classNameSymbol := aClassNameString asSymbol. |
8438 |
oldAbbrev := abbrevs at:classNameSymbol ifAbsent:nil. |
|
8439 |
oldAbbrev notNil ifTrue:[ |
|
8440 |
oldAbbrev ~= aFileNameString ifTrue:[ |
|
8441 |
oldAbbrev asFilename isAbsolute |
|
8442 |
ifTrue:[ oldPath := oldAbbrev ] |
|
8443 |
ifFalse:[ oldPath := (self projectDirectoryForPackage:aPackageNameString) asFilename constructString: oldAbbrev ]. |
|
8444 |
aFileNameString asFilename isAbsolute |
|
8445 |
ifTrue:[ newPath := aFileNameString ] |
|
8446 |
ifFalse:[ newPath := (self projectDirectoryForPackage:aPackageNameString) asFilename constructString: aFileNameString ]. |
|
8447 |
||
8448 |
oldPath ~= newPath ifTrue:[ |
|
8449 |
StandAlone ifFalse:[ |
|
8450 |
('Smalltalk [warning]: autoload path change for: ',aClassNameString,' in package ',aPackageNameString) infoPrintCR. |
|
8451 |
('Smalltalk [info]: old: ',oldPath) infoPrintCR. |
|
8452 |
('Smalltalk [info]: new: ',newPath) infoPrintCR. |
|
8453 |
] |
|
8454 |
] |
|
8455 |
]. |
|
8456 |
"overwrite old abbreviation with new one, |
|
8457 |
to allow fixing of bad abbrev files" |
|
8458 |
]. |
|
8459 |
||
8460 |
cls := self classNamed:aFileNameString. |
|
8461 |
cls notNil ifTrue:[ |
|
8462 |
cls name ~= aClassNameString ifTrue:[ |
|
8463 |
"/ ok, there is a class named after this abbrev ... |
|
8464 |
"/ this is only a conflict, if the other class has no |
|
8465 |
"/ abbreviation (or the same). |
|
8466 |
(abbrevs at:(cls name asSymbol) ifAbsent:cls name) = aFileNameString ifTrue:[ |
|
8467 |
cls isNameSpace ifFalse:[ |
|
8468 |
aPackageNameString = cls package ifTrue:[ |
|
8469 |
StandAlone ifFalse:[ |
|
8470 |
('Smalltalk [warning]: conflict for: ' , cls name , |
|
8471 |
' in package ' , aPackageNameString) infoPrintCR. |
|
8472 |
('Smalltalk [warning]: (' , aClassNameString , ' -> ' , aFileNameString |
|
8473 |
, ')') infoPrintCR |
|
8474 |
] |
|
8475 |
] |
|
8476 |
] |
|
8477 |
] |
|
8478 |
] |
|
8479 |
]. |
|
8480 |
abbrevs at:classNameSymbol put:aFileNameString. |
|
8470
d79e917d4f36
Define #setFilename:forClass:package: to define an abbreviation.
Stefan Vogel <sv@exept.de>
parents:
8445
diff
changeset
|
8481 |
] |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8482 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8483 |
|
10641 | 8484 |
sourceDirectoryNameOfClass:aClassOrClassName |
8485 |
"for a given class, return the pathname relative to TOP of the classes source code. |
|
8486 |
Read the files 'abbrev.stc' and 'liblist.stc' (which are created during the compilation process) |
|
8487 |
for an entry for aClassOrClassName. |
|
8488 |
Search for the className in the first col, and return the value found in |
|
8489 |
the 3rd col. |
|
8490 |
Return nil if no entry is found." |
|
8491 |
||
8492 |
|aStream line words n aClassName| |
|
8493 |
||
8494 |
aClassOrClassName isBehavior ifTrue:[ |
|
18668 | 8495 |
aClassName := aClassOrClassName name |
10641 | 8496 |
] ifFalse:[ |
18668 | 8497 |
aClassName := aClassOrClassName |
10641 | 8498 |
]. |
8499 |
aClassName := aClassName asString. |
|
8500 |
||
8501 |
#('include/abbrev.stc' 'include/liblist.stc') "/ filenames |
|
8502 |
with:#(3 2) "/ column |
|
8503 |
do:[:fileName :col | |
|
8504 |
||
18668 | 8505 |
aStream := self systemFileStreamFor:fileName. |
8506 |
aStream notNil ifTrue:[ |
|
8507 |
[aStream atEnd] whileFalse:[ |
|
8508 |
line := aStream nextLine. |
|
8509 |
line notNil ifTrue:[ |
|
8510 |
(line startsWith:'#') ifFalse:[ |
|
8511 |
words := line asCollectionOfWords. |
|
8512 |
(n := words size) > 1 ifTrue:[ |
|
8513 |
(words at:1) = aClassName ifTrue:[ |
|
8514 |
n >= col ifTrue:[ |
|
8515 |
aStream close. |
|
8516 |
^ (words at:col) withoutSeparators |
|
8517 |
] |
|
8518 |
] |
|
8519 |
] |
|
8520 |
] |
|
8521 |
] |
|
8522 |
]. |
|
8523 |
aStream close |
|
8524 |
]. |
|
10641 | 8525 |
]. |
8526 |
||
8527 |
^ nil |
|
8528 |
||
8529 |
" |
|
8530 |
Smalltalk sourceDirectoryNameOfClass:'ClockView' |
|
8531 |
Smalltalk sourceDirectoryNameOfClass:'Bag' |
|
8532 |
Smalltalk sourceDirectoryNameOfClass:'GLWireCubeDemoView' |
|
8533 |
Smalltalk sourceDirectoryNameOfClass:'SomeNonExistingClass' |
|
8534 |
" |
|
8535 |
||
8536 |
"Created: 6.11.1995 / 15:43:30 / cg" |
|
8537 |
"Modified: 9.12.1995 / 23:54:14 / cg" |
|
8538 |
"Modified: 3.1.1997 / 11:26:44 / stefan" |
|
8539 |
! |
|
8540 |
||
8541 |
sourceFileStreamFor:aFileName |
|
8542 |
"search aFileName in some standard places; |
|
8543 |
return a readonly fileStream or nil if not found. |
|
8544 |
Searches in subdirectories named 'source' in SystemPath" |
|
8545 |
||
8546 |
|aString| |
|
8547 |
||
8548 |
aString := self getSourceFileName:aFileName. |
|
8549 |
aString notNil ifTrue:[ |
|
18668 | 8550 |
^ aString asFilename readStreamOrNil |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8551 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8552 |
^ nil |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8553 |
! |
7758 | 8554 |
|
10641 | 8555 |
systemFileStreamFor:aFileName |
8556 |
"search aFileName in some standard places; |
|
8557 |
return a readonly fileStream or nil if not found. |
|
8558 |
see comment in Smalltalk>>initSystemPath" |
|
8559 |
||
8560 |
|aString| |
|
8561 |
||
8562 |
aString := self getSystemFileName:aFileName. |
|
8563 |
aString notNil ifTrue:[ |
|
18668 | 8564 |
^ aString asFilename readStreamOrNil |
617 | 8565 |
]. |
8566 |
^ nil |
|
8567 |
! |
|
8568 |
||
10641 | 8569 |
systemPath |
8570 |
"return a collection of directorynames, where smalltalk |
|
8571 |
looks for system files |
|
8572 |
(usually in subdirs such as resources, bitmaps, source etc.) |
|
8573 |
see comment in Smalltalk>>initSystemPath." |
|
8574 |
||
20640 | 8575 |
^ SystemPath ? #() |
10641 | 8576 |
|
8577 |
" |
|
8578 |
Smalltalk systemPath |
|
8579 |
Smalltalk systemPath addLast:'someOtherDirectoryPath' |
|
8580 |
" |
|
8581 |
! |
|
8582 |
||
8583 |
systemPath:aPath |
|
8584 |
"set the collection of directorynames, where smalltalk |
|
8585 |
looks for system files |
|
8586 |
(usually in subdirs such as resources, bitmaps, source etc.) |
|
8587 |
see comment in Smalltalk>>initSystemPath." |
|
8588 |
||
8589 |
SystemPath := aPath. |
|
8590 |
self flushPathCaches |
|
8591 |
||
8592 |
" |
|
8593 |
Smalltalk systemPath |
|
8594 |
Smalltalk systemPath:(Smalltalk systemPath copy addLast:'someOtherDirectoryPath') |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8595 |
" |
11301
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
8596 |
! |
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
8597 |
|
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
8598 |
withAbbreviationsFromStream:aStream do:aBlock |
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
8599 |
"read classname to filename mappings from aStream. |
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
8600 |
Evaluate aBlock for each tuple: |
18668 | 8601 |
class-name , abbrev-name, package |
11301
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
8602 |
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
|
8603 |
|
13415 | 8604 |
|line lineNo words nm abbrev pkg category size s w| |
8605 |
||
8606 |
lineNo := 0. |
|
11301
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
8607 |
[aStream atEnd] whileFalse:[ |
18668 | 8608 |
line := aStream nextLine. |
8609 |
lineNo := lineNo + 1. |
|
8610 |
line notEmptyOrNil ifTrue:[ |
|
8611 |
(line startsWith:'#') ifFalse:[ |
|
8612 |
||
8613 |
"/ must do it manually, caring for quoted strings. |
|
11301
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
8614 |
"/ words := line asCollectionOfWords. |
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
8615 |
|
18668 | 8616 |
words := OrderedCollection new. |
8617 |
s := line readStream. |
|
8618 |
[s atEnd] whileFalse:[ |
|
8619 |
s skipSeparators. |
|
8620 |
s peek == $' ifTrue:[ |
|
8621 |
s next. |
|
8622 |
w := s upTo:$'. |
|
8623 |
s skipSeparators. |
|
8624 |
] ifFalse:[ |
|
8625 |
w := s upToSeparator |
|
8626 |
]. |
|
8627 |
words add:w |
|
8628 |
]. |
|
8629 |
words size >= 3 ifTrue:[ |
|
8630 |
nm := (words at:1) withoutSeparators. |
|
8631 |
abbrev := (words at:2) withoutSeparators. |
|
8632 |
pkg := (words at:3) withoutSeparators. |
|
8633 |
aBlock argumentCount = 3 ifTrue:[ |
|
8634 |
aBlock value:nm value:abbrev value:pkg. |
|
8635 |
] ifFalse:[ |
|
8636 |
words size >= 4 ifTrue:[ |
|
8637 |
category := words at:4. |
|
8638 |
]. |
|
8639 |
words size = 5 ifTrue:[ |
|
8640 |
size := (words at:5) asNumber |
|
8641 |
]. |
|
8642 |
aBlock value:nm value:abbrev value:pkg value: category value: size |
|
8643 |
] |
|
8644 |
] ifFalse:[ |
|
8645 |
('Smalltalk [warning]: malformed line ', lineNo printString , ' in ' , (aStream pathName)) infoPrintCR. |
|
8646 |
] |
|
8647 |
] |
|
8648 |
] |
|
13518
b81bc64782b1
not ifTrue -> ifFalse (trying the rewrite tool ;-)
Claus Gittinger <cg@exept.de>
parents:
13506
diff
changeset
|
8649 |
]. |
b81bc64782b1
not ifTrue -> ifFalse (trying the rewrite tool ;-)
Claus Gittinger <cg@exept.de>
parents:
13506
diff
changeset
|
8650 |
|
13415 | 8651 |
"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
|
8652 |
"Modified: / 04-08-2011 / 21:35:00 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8653 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8654 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8655 |
!Smalltalk class methodsFor:'system management-packages'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8656 |
|
16159 | 8657 |
isPackageLoaded:aPackageIdOrPackage |
8658 |
|projectDefinition| |
|
8659 |
||
8660 |
projectDefinition := aPackageIdOrPackage asPackageId projectDefinitionClass. |
|
16161 | 8661 |
^ projectDefinition notNil and:[projectDefinition isLoaded and:[projectDefinition isFullyLoaded]] |
16159 | 8662 |
|
8663 |
" |
|
8664 |
Smalltalk isPackageLoaded:'stx:goodies/persistency' |
|
16170
ca4d03def070
endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents:
16164
diff
changeset
|
8665 |
Smalltalk isPackageLoaded:'stx:goodies/refactoryBrowser/lint' |
ca4d03def070
endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents:
16164
diff
changeset
|
8666 |
Smalltalk isPackageLoaded:'stx:goodies/refactoryBrowser/lint/spelling' |
16159 | 8667 |
" |
8668 |
! |
|
8669 |
||
20898 | 8670 |
knownLoadablePackagesDo:aBlock |
8671 |
"enumerate loadable packages from the packages folder." |
|
8672 |
||
8673 |
Smalltalk realSystemPath do:[:dirName | |
|
22791 | 8674 |
|packageDir| |
8675 |
||
8676 |
packageDir := dirName asFilename / 'packages'. |
|
8677 |
(packageDir exists and:[packageDir isDirectory]) ifTrue:[ |
|
8678 |
packageDir directoryContentsAsFilenames sort do:[:fn | |
|
8679 |
|item base nm path parentPath parent isLibrary isApplication isAlreadyLoaded |
|
8680 |
defClass target type nameComponents packageName packageID| |
|
8681 |
||
8682 |
((fn suffix = 'mcz') |
|
8683 |
or:[ fn isDirectory |
|
8684 |
or:[ (fn baseName startsWith:'.') |
|
8685 |
or:[ (fn baseName = 'README') ]]]) ifFalse:[ |
|
8686 |
base := fn withoutSuffix baseName. |
|
8687 |
(base startsWith:'lib') ifTrue:[ |
|
8688 |
nm := (base copyFrom:4). |
|
8689 |
fn suffix notEmptyOrNil ifTrue:[ |
|
8690 |
type := #library. |
|
8691 |
] ifFalse:[ |
|
8692 |
type := #application. |
|
8693 |
] |
|
8694 |
] ifFalse:[ |
|
8695 |
nm := base. |
|
8696 |
type := #application. |
|
8697 |
]. |
|
8698 |
||
8699 |
(base ~= 'librun') ifTrue:[ |
|
8700 |
(fn suffix = 'mcz') ifTrue:[ |
|
8701 |
packageName := fn withoutSuffix. |
|
8702 |
target := fn. |
|
8703 |
] ifFalse:[ |
|
8704 |
( #('dll' 'so' 'sl' 'dylib') includes:(fn suffix)) ifTrue:[ |
|
8705 |
(base startsWith:'lib') ifTrue:[ |
|
8706 |
nm := base copyFrom:4. |
|
8707 |
] ifFalse:[ |
|
8708 |
nm := base. |
|
8709 |
]. |
|
8710 |
]. |
|
8711 |
nameComponents := nm asCollectionOfSubstringsSeparatedBy:$_. |
|
8712 |
packageName := nameComponents first. |
|
8713 |
nameComponents size > 1 ifTrue:[ |
|
8714 |
packageName := packageName,':',((nameComponents copyFrom:2) asStringWith:'/') |
|
8715 |
]. |
|
8716 |
]. |
|
8717 |
packageName notNil ifTrue:[ |
|
8718 |
aBlock value:packageName value:type value:fn . |
|
8719 |
] |
|
8720 |
] |
|
8721 |
] |
|
8722 |
] |
|
8723 |
] |
|
20898 | 8724 |
] |
8725 |
||
8726 |
" |
|
8727 |
Smalltalk knownLoadablePackagesDo:[:packageID :type :path | |
|
22791 | 8728 |
Transcript showCR:'%1 (%2) in %3' with:packageID with:type with:path. |
20898 | 8729 |
] |
8730 |
" |
|
8731 |
! |
|
8732 |
||
10641 | 8733 |
loadPackage:aPackageIdOrPackage |
12250 | 8734 |
"make certain, that some particular package is loaded into the system. |
8735 |
Return true if loaded, false otherwise." |
|
11668 | 8736 |
|
8737 |
^ self loadPackage:aPackageIdOrPackage asAutoloaded:false |
|
8738 |
||
8739 |
" |
|
8740 |
Smalltalk loadPackage:'stx:libbasic' |
|
8741 |
Smalltalk loadPackage:'stx:goodies/persistency' |
|
8742 |
Smalltalk loadPackage:'cg:cparser' |
|
8743 |
Smalltalk loadPackage:'cg:rose' |
|
8744 |
" |
|
8745 |
! |
|
8746 |
||
10641 | 8747 |
packageDirectoryForPackageId:aPackageId |
12250 | 8748 |
"used by classes to find the location of their resource- and bitmap directories. |
8749 |
||
8750 |
Notice that the directory structure is different between the development |
|
8751 |
environment (top for packages is ../../../stx) and delivered stand alone executables, |
|
8752 |
where the top is specified via a shell environment variable, and is typically ../lib. |
|
8753 |
At runtime, Smalltalk knows about the systemPath setting." |
|
8754 |
||
10641 | 8755 |
|packageDirName packageDir| |
8756 |
||
14589 | 8757 |
packageDirName := aPackageId asPackageId string copyReplaceAll:$: with:$/. |
10641 | 8758 |
|
8759 |
packageDir := self getPackageFileName:packageDirName. |
|
8760 |
packageDir isNil ifTrue:[ |
|
23450 | 8761 |
^ nil. |
10641 | 8762 |
]. |
8763 |
^ packageDir asFilename |
|
8764 |
||
8765 |
" |
|
11375 | 8766 |
Smalltalk packageDirectoryForPackageId:'stx:libbasic' |
10641 | 8767 |
Smalltalk packageDirectoryForPackageId:'stx:goodies/persistency' |
8768 |
Smalltalk packageDirectoryForPackageId:'exept:ctypes' |
|
23450 | 8769 |
Smalltalk getPackageFileName:'stx/libview' |
10641 | 8770 |
" |
12250 | 8771 |
! |
8772 |
||
18794 | 8773 |
requirePackage:aPackageIdOrPackage |
8774 |
"make certain, that some particular package is loaded into the system. |
|
8775 |
Return true if loaded, false otherwise. |
|
8776 |
Just an alias which is easier to remember" |
|
8777 |
||
8778 |
^ self loadPackage:aPackageIdOrPackage |
|
8779 |
||
8780 |
" |
|
8781 |
Smalltalk loadPackage:'stx:libbasic' |
|
8782 |
Smalltalk loadPackage:'stx:goodies/persistency' |
|
8783 |
Smalltalk loadPackage:'cg:cparser' |
|
8784 |
Smalltalk loadPackage:'cg:rose' |
|
8785 |
" |
|
8786 |
! |
|
8787 |
||
12250 | 8788 |
unloadPackage:aPackageIdOrPackage |
8789 |
|projectDefinition| |
|
8790 |
||
8791 |
projectDefinition := aPackageIdOrPackage. |
|
8792 |
projectDefinition isProjectDefinition ifFalse:[ |
|
22791 | 8793 |
projectDefinition := projectDefinition asPackageId projectDefinitionClass. |
8794 |
projectDefinition isNil ifTrue:[ |
|
8795 |
Logger warning:'trying to unload non-existing package: %1' with:aPackageIdOrPackage. |
|
8796 |
^ self. |
|
8797 |
]. |
|
12250 | 8798 |
]. |
8799 |
projectDefinition unloadPackage. |
|
8800 |
||
8801 |
" |
|
8802 |
Smalltalk loadPackage:'stx:goodies/persistency' |
|
8803 |
Smalltalk unloadPackage:'stx:goodies/persistency' |
|
8804 |
" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8805 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8806 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8807 |
!Smalltalk class methodsFor:'system management-undeclared variables'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8808 |
|
10641 | 8809 |
clearUndeclaredVariables |
8810 |
"remove all undeclared variables" |
|
8811 |
||
8812 |
(Smalltalk at:#Undeclared) do:[:eachKey | |
|
18668 | 8813 |
Smalltalk removeKey:(self undeclaredPrefix , eachKey) asSymbol. |
10641 | 8814 |
]. |
8815 |
(Smalltalk at:#Undeclared) removeAll. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8816 |
Smalltalk removeKey:#Undeclared. |
10641 | 8817 |
! |
8818 |
||
8819 |
undeclaredPrefix |
|
8820 |
"the prefix used for undeclared variables" |
|
8821 |
||
8822 |
^ 'Undeclared:::' |
|
8823 |
||
8824 |
"Created: / 31.10.1997 / 01:13:10 / cg" |
|
7758 | 8825 |
! ! |
8826 |
||
8827 |
!Smalltalk class methodsFor:'time-versions'! |
|
8828 |
||
10641 | 8829 |
configuration |
8830 |
"{ Pragma: +optSpace }" |
|
8831 |
||
8832 |
"for developers only: return the configuration, with which |
|
8833 |
this smalltalk was compiled." |
|
8834 |
||
8835 |
%{ /* NOCONTEXT */ |
|
8836 |
extern char *__getConfigurationString(); |
|
8837 |
||
8838 |
RETURN (__MKSTRING(__getConfigurationString() COMMA_SND)); |
|
8839 |
%}. |
|
8840 |
^ 'unknownOS/unknownCONF:unknownPACK' |
|
8841 |
||
8842 |
" |
|
10071 | 8843 |
Smalltalk configuration |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8844 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8845 |
! |
453 | 8846 |
|
10641 | 8847 |
copyrightString |
8848 |
"{ Pragma: +optSpace }" |
|
8849 |
||
8850 |
"return a copyright string" |
|
8851 |
||
8852 |
%{ /* NOCONTEXT */ |
|
8853 |
#ifndef __getCopyrightString |
|
8854 |
extern OBJ __getCopyrightString(); |
|
8855 |
#endif |
|
8856 |
||
8857 |
RETURN (__getCopyrightString()); |
|
8858 |
%}. |
|
8859 |
^ self primitiveFailed |
|
8860 |
||
8861 |
" |
|
7758 | 8862 |
Smalltalk copyrightString |
8863 |
" |
|
8864 |
! |
|
8865 |
||
10641 | 8866 |
distributorString |
8867 |
"{ Pragma: +optSpace }" |
|
8868 |
||
8869 |
"return a string describing the distributor of this software" |
|
8870 |
||
8871 |
%{ /* NOCONTEXT */ |
|
8872 |
#ifndef __getDistributorString |
|
8873 |
extern OBJ __getDistributorString(); |
|
8874 |
#endif |
|
8875 |
||
8876 |
RETURN (__getDistributorString()); |
|
8877 |
%}. |
|
8878 |
^ 'eXept Software AG, Germany' |
|
8879 |
||
8880 |
" |
|
8881 |
Smalltalk distributorString |
|
8882 |
" |
|
8883 |
! |
|
8884 |
||
8885 |
expirationTime |
|
8886 |
"{ Pragma: +optSpace }" |
|
8887 |
||
8888 |
"for developers only: return the time when the system will expire. |
|
8889 |
after this time it will not run any longer. |
|
8890 |
It returns nil, if no expiration time has been set (system runs forever :-))" |
|
8891 |
||
8892 |
|exp| |
|
8893 |
||
8894 |
%{ |
|
8895 |
extern unsigned int __getExpirationTime(); |
|
8896 |
||
8897 |
exp = __MKUINT(__getExpirationTime()); |
|
8898 |
%}. |
|
8899 |
exp == 0 ifTrue:[ |
|
18668 | 8900 |
^ nil |
10641 | 8901 |
]. |
8902 |
^ Timestamp new fromOSTime:(exp * 1000). "OSTime is ms since 1970" |
|
8903 |
||
8904 |
" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8905 |
Smalltalk expirationTime |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8906 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8907 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8908 |
|
10641 | 8909 |
fullVersionString |
8910 |
"{ Pragma: +optSpace }" |
|
8911 |
||
8912 |
"return a full version string" |
|
8913 |
||
19516 | 8914 |
^ 'Smalltalk/X release %1%2 of %3' |
22900 | 8915 |
bindWith:(self versionString) |
8916 |
with:((ExternalBytes sizeofPointer == 8) |
|
8917 |
ifTrue:[' (64bit)'] |
|
8918 |
ifFalse:['']) |
|
8919 |
with:(self versionDate) |
|
22791 | 8920 |
|
8921 |
" |
|
8922 |
Smalltalk fullVersionString |
|
10641 | 8923 |
" |
8924 |
||
8925 |
"Created: / 27.10.1997 / 17:03:09 / cg" |
|
8926 |
"Modified: / 27.10.1997 / 17:04:02 / cg" |
|
8927 |
! |
|
8928 |
||
8929 |
hello |
|
8930 |
"{ Pragma: +optSpace }" |
|
8931 |
||
8932 |
"return a greeting string" |
|
8933 |
||
8934 |
"stupid: this should come from a resource file ... |
|
18924 | 8935 |
but I don't use it here, to allow mini-systems without |
10641 | 8936 |
Resource-stuff." |
8937 |
||
19187 | 8938 |
|proto lang bit bitsPerWordString| |
10641 | 8939 |
|
8940 |
lang := Language. |
|
19187 | 8941 |
bit := 'bit'. |
8942 |
||
10641 | 8943 |
(lang == #de) ifTrue:[ |
22900 | 8944 |
proto := 'Willkommen bei %1 (%4Version %2 von %3)'. bit := 'Bit'. |
10641 | 8945 |
] ifFalse:[ (lang == #fr) ifTrue:[ |
24136 | 8946 |
proto := 'Salut, Bienvenue à%1 (%4version %2 de %3)' |
10641 | 8947 |
] ifFalse:[ (lang == #it) ifTrue:[ |
22900 | 8948 |
proto := 'Ciao, benvenuto al %1 (%4versione %2 di %3)' |
10641 | 8949 |
] ifFalse:[ (lang == #es) ifTrue:[ |
22900 | 8950 |
proto := 'Hola, bienvenida a %1 (%4version %2 de %3)' |
18924 | 8951 |
] ifFalse:[ (lang == #pt) ifTrue:[ |
24136 | 8952 |
proto := 'Olá!!, mem-vindo a %1 (%4version %2 de %3)' |
10641 | 8953 |
] ifFalse:[ (lang == #no) ifTrue:[ |
22900 | 8954 |
proto := 'Hei, verdenmottakelse til %1 (%4versjon %2 av %3)' |
10641 | 8955 |
]]]]]]. |
8956 |
||
8957 |
"/ ... more needed here ... |
|
8958 |
||
8959 |
proto isNil ifTrue:[ |
|
22900 | 8960 |
proto := 'Hello World - welcome to %1 (%4version %2 of %3)'. |
8961 |
]. |
|
8962 |
ExternalBytes sizeofPointer ~~ 4 ifTrue:[ |
|
8963 |
bitsPerWordString := (ExternalBytes sizeofPointer * 8) printString,bit,' '. |
|
19187 | 8964 |
] ifFalse:[ |
22900 | 8965 |
bitsPerWordString := '' |
22791 | 8966 |
]. |
10641 | 8967 |
|
8968 |
^ proto bindWith:('SmallTalk/X' allBold) |
|
22900 | 8969 |
with:(self versionString) |
8970 |
with:(self versionDate) |
|
8971 |
with:bitsPerWordString |
|
10641 | 8972 |
|
8973 |
" |
|
8974 |
Smalltalk language:#us. |
|
22791 | 8975 |
Smalltalk hello |
10641 | 8976 |
|
8977 |
Smalltalk language:#de. |
|
8978 |
Smalltalk hello |
|
8979 |
||
8980 |
Smalltalk language:#no. |
|
8981 |
Smalltalk hello |
|
8982 |
||
8983 |
Transcript showCR:(Smalltalk hello) |
|
8984 |
Stdout showCR:(Smalltalk hello) |
|
8985 |
" |
|
8986 |
||
8987 |
"Modified: 18.5.1996 / 14:25:13 / cg" |
|
8988 |
! |
|
8989 |
||
8990 |
imageRestartTime |
|
8991 |
"return a timestamp for the moment when this image was restarted. |
|
8992 |
If we do not execute from an image (i.e. fresh start), return nil." |
|
8993 |
||
8994 |
^ ImageRestartTime |
|
8995 |
||
8996 |
" |
|
8997 |
Smalltalk imageStartTime |
|
8998 |
Smalltalk imageRestartTime |
|
8999 |
" |
|
9000 |
||
9001 |
"Created: 13.12.1995 / 17:44:20 / cg" |
|
9002 |
"Modified: 6.3.1996 / 11:56:35 / cg" |
|
9003 |
! |
|
9004 |
||
9005 |
imageSaveTime |
|
9006 |
"{ Pragma: +optSpace }" |
|
9007 |
||
9008 |
"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
|
9009 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
9010 |
^ ObjectMemory imageSaveTime |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
9011 |
! |
7758 | 9012 |
|
10641 | 9013 |
imageStartTime |
9014 |
"{ Pragma: +optSpace }" |
|
9015 |
||
9016 |
"return a timestamp for the moment when this system started the first time |
|
9017 |
(i.e. the first initial start without an image)" |
|
9018 |
||
9019 |
^ ImageStartTime |
|
9020 |
||
9021 |
" |
|
9022 |
Smalltalk imageStartTime |
|
9023 |
Smalltalk imageRestartTime |
|
9024 |
" |
|
9025 |
||
9026 |
"Created: 13.12.1995 / 17:44:14 / cg" |
|
9027 |
"Modified: 13.12.1995 / 17:45:47 / cg" |
|
9028 |
! |
|
9029 |
||
9030 |
majorVersionNr |
|
9031 |
"{ Pragma: +optSpace }" |
|
9032 |
||
9033 |
"return the major version number. |
|
9034 |
This is only incremented for very fundamental changes, |
|
9035 |
which make old object files totally incompatible |
|
9036 |
(for example, if the layout/representation of fundamental |
|
9037 |
classes changes). |
|
9038 |
||
9039 |
ST/X revision Naming is: |
|
22791 | 9040 |
<major>.<minor>.<revision>.<release>" |
19974 | 9041 |
|
9042 |
^ 7 |
|
10641 | 9043 |
|
9044 |
" |
|
9045 |
Smalltalk majorVersionNr |
|
9046 |
" |
|
9047 |
||
19974 | 9048 |
"Modified: / 09-06-2016 / 16:28:40 / cg" |
10641 | 9049 |
! |
9050 |
||
9051 |
minorVersionNr |
|
9052 |
"{ Pragma: +optSpace }" |
|
9053 |
||
9054 |
"return the minor version number. |
|
9055 |
This is incremented for changes which make some old object |
|
9056 |
files incompatible, or the protocol changes such that some |
|
9057 |
classes need rework. |
|
9058 |
||
9059 |
ST/X revision Naming is: |
|
23683 | 9060 |
<major>.<minor>.<revision>.<release>" |
9061 |
||
9062 |
^ 2 |
|
10641 | 9063 |
|
9064 |
" |
|
9065 |
Smalltalk minorVersionNr |
|
9066 |
" |
|
9067 |
||
19974 | 9068 |
"Modified: / 09-06-2016 / 16:28:45 / cg" |
23683 | 9069 |
"Modified: / 08-02-2019 / 22:36:33 / Claus Gittinger" |
10641 | 9070 |
! |
9071 |
||
9072 |
releaseIdentification |
|
9073 |
"{ Pragma: +optSpace }" |
|
9074 |
||
9075 |
"for developers only: return the release |
|
9076 |
(to further identify the version in case of errors)" |
|
9077 |
||
9078 |
%{ /* NOCONTEXT */ |
|
9079 |
extern OBJ __getRel(); |
|
9080 |
||
9081 |
RETURN (__getRel()); |
|
9082 |
%}. |
|
9083 |
^ 'ST/X_experimental' |
|
9084 |
||
9085 |
" |
|
9086 |
Smalltalk releaseIdentification |
|
9087 |
" |
|
9088 |
! |
|
9089 |
||
9090 |
releaseNr |
|
9091 |
"{ Pragma: +optSpace }" |
|
9092 |
||
14542 | 9093 |
"return the release number. |
9094 |
Now releaseNr is the build number (BUILD_NUMBER from Jenkins) |
|
10641 | 9095 |
|
9096 |
ST/X revision Naming is: |
|
18668 | 9097 |
<major>.<minor>.<revision>.<release>" |
14529 | 9098 |
|
9099 |
|releaseNumber| |
|
9100 |
||
9101 |
releaseNumber := Smalltalk versionBuildNumber. |
|
9102 |
releaseNumber isEmpty ifTrue:[ |
|
18668 | 9103 |
^ 0. |
14529 | 9104 |
]. |
9105 |
^ releaseNumber |
|
10641 | 9106 |
|
9107 |
" |
|
9108 |
Smalltalk releaseNr |
|
12867
2b9cbcea983b
version bump - layout of Class, Method and Context changed.
Claus Gittinger <cg@exept.de>
parents:
12861
diff
changeset
|
9109 |
Smalltalk versionString |
10641 | 9110 |
" |
9111 |
||
9112 |
"Created: / 10-12-1995 / 01:42:19 / cg" |
|
9113 |
"Modified: / 10-02-2007 / 14:49:51 / cg" |
|
9114 |
! |
|
9115 |
||
9116 |
revisionNr |
|
9117 |
"{ Pragma: +optSpace }" |
|
9118 |
||
9119 |
"return the revision number. |
|
9120 |
Incremented for releases which fix bugs/add features |
|
9121 |
and represent a stable workable version which got published |
|
9122 |
to the outside world. |
|
9123 |
||
9124 |
ST/X revision Naming is: |
|
22791 | 9125 |
<major>.<minor>.<revision>.<release>" |
19974 | 9126 |
|
9127 |
^ 0 |
|
10641 | 9128 |
|
9129 |
" |
|
9130 |
Smalltalk revisionNr |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
9131 |
Smalltalk hello string |
13014 | 9132 |
" |
9133 |
||
14898 | 9134 |
"Modified: / 19-03-2013 / 10:48:59 / az" |
19974 | 9135 |
"Modified: / 09-06-2016 / 16:28:57 / cg" |
10641 | 9136 |
! |
9137 |
||
9138 |
timeStamp |
|
9139 |
"return a string useful for timestamping a file. |
|
9140 |
The returned string is padded with spaces for a constant |
|
9141 |
length (to avoid changing a files size in fileOut with unchanged |
|
9142 |
class)." |
|
9143 |
||
9144 |
^ ('''' , self timeStampString , '''') paddedTo:80 with:(Character space) |
|
9145 |
! |
|
9146 |
||
9147 |
timeStamp:aStream |
|
9148 |
"write a string useful for timestamping a file onto aStream. |
|
9149 |
ST80 compatibility" |
|
9150 |
||
9151 |
aStream nextPutAll:(self timeStamp). |
|
9152 |
||
9153 |
"Created: / 18.6.1998 / 17:22:58 / cg" |
|
9154 |
! |
|
9155 |
||
9156 |
timeStampString |
|
9157 |
"return a string useful for timestamping a file." |
|
9158 |
||
9159 |
|dateString| |
|
9160 |
||
9161 |
dateString := String streamContents:[:s | Date today printOn:s language:#en]. "/ MUST be english !!!! |
|
9162 |
||
9163 |
^ ('From Smalltalk/X, Version:' , (Smalltalk versionString) , ' on ' |
|
9164 |
, dateString , ' at ' , Time now printString |
|
7758 | 9165 |
) |
9166 |
! |
|
9167 |
||
14529 | 9168 |
versionBuildNumber |
9169 |
"{ Pragma: +optSpace }" |
|
9170 |
||
9171 |
"return the executables build number - that's the jenkins build #. |
|
9172 |
Empty if not built by jenkins" |
|
9173 |
||
9174 |
%{ /* NOCONTEXT */ |
|
9175 |
extern char *__getBuildNumberString(); |
|
9176 |
||
9177 |
RETURN (__MKSTRING(__getBuildNumberString() COMMA_SND) ); |
|
9178 |
%}. |
|
9179 |
^ '' |
|
9180 |
||
9181 |
" |
|
9182 |
Smalltalk versionBuildNumber |
|
9183 |
" |
|
9184 |
! |
|
9185 |
||
10641 | 9186 |
versionDate |
9187 |
"{ Pragma: +optSpace }" |
|
9188 |
||
14522 | 9189 |
"return the executables build date - that's the date when the smalltalk |
10641 | 9190 |
executable was built" |
9191 |
||
9192 |
%{ /* NOCONTEXT */ |
|
9193 |
extern char *__getBuildDateString(); |
|
9194 |
||
9195 |
RETURN (__MKSTRING(__getBuildDateString() COMMA_SND) ); |
|
9196 |
%}. |
|
9197 |
^ 'today' |
|
9198 |
||
9199 |
" |
|
10071 | 9200 |
Smalltalk versionDate |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
9201 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
9202 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
9203 |
|
10641 | 9204 |
versionString |
9205 |
"{ Pragma: +optSpace }" |
|
9206 |
||
9207 |
"return the version string" |
|
9208 |
||
9209 |
^ (self majorVersionNr printString , |
|
9210 |
'.', |
|
9211 |
self minorVersionNr printString , |
|
9212 |
'.', |
|
14529 | 9213 |
self revisionNr printString, |
9214 |
'.', |
|
9215 |
self releaseNr printString) |
|
13771 | 9216 |
|
10641 | 9217 |
|
9218 |
" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
9219 |
Smalltalk versionString |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
9220 |
" |
10641 | 9221 |
! |
9222 |
||
9223 |
vmMajorVersionNr |
|
9224 |
"{ Pragma: +optSpace }" |
|
9225 |
||
9226 |
"return the VMs major version number." |
|
9227 |
%{ |
|
9228 |
RETURN (__mkSmallInteger(4)); |
|
9229 |
%}. |
|
9230 |
^ 4 |
|
9231 |
||
9232 |
" |
|
9233 |
Smalltalk vmMajorVersionNr |
|
9234 |
" |
|
2 | 9235 |
! ! |
453 | 9236 |
|
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
9237 |
!Smalltalk class methodsFor:'documentation'! |
630 | 9238 |
|
13532
638f9bfab880
changed: #recursiveInstallAutoloadedClassesFrom:rememberIn:maxLevels:noAutoload:packageTop:showSplashInLevels:
Claus Gittinger <cg@exept.de>
parents:
13531
diff
changeset
|
9239 |
version |
18560 | 9240 |
^ '$Header$' |
13532
638f9bfab880
changed: #recursiveInstallAutoloadedClassesFrom:rememberIn:maxLevels:noAutoload:packageTop:showSplashInLevels:
Claus Gittinger <cg@exept.de>
parents:
13531
diff
changeset
|
9241 |
! |
638f9bfab880
changed: #recursiveInstallAutoloadedClassesFrom:rememberIn:maxLevels:noAutoload:packageTop:showSplashInLevels:
Claus Gittinger <cg@exept.de>
parents:
13531
diff
changeset
|
9242 |
|
12172
d90a72004f43
changed: #fileNameForClass:
Claus Gittinger <cg@exept.de>
parents:
12033
diff
changeset
|
9243 |
version_CVS |
18560 | 9244 |
^ '$Header$' |
13415 | 9245 |
! |
9246 |
||
9247 |
version_SVN |
|
15225 | 9248 |
^ '$ Id: Smalltalk.st 10648 2011-06-23 15:55:10Z vranyj1 $' |
630 | 9249 |
! ! |
22792 | 9250 |