author | convert-repo |
Thu, 05 Jul 2018 03:33:35 +0000 | |
changeset 23197 | 823c765c176d |
parent 23177 | 1f49ca31ecc8 |
child 23408 | 559e80ba680d |
permissions | -rw-r--r-- |
1 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1988 by Claus Gittinger |
18668 | 3 |
All Rights Reserved |
1 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
5363 | 12 |
"{ Package: 'stx:libbasic' }" |
13 |
||
17279 | 14 |
"{ NameSpace: Smalltalk }" |
15 |
||
1 | 16 |
Object subclass:#Smalltalk |
18668 | 17 |
instanceVariableNames:'' |
18 |
classVariableNames:'StartBlocks ImageStartBlocks ExitBlocks CachedClasses |
|
19 |
NumberOfClassesHint SystemPath StartupClass StartupSelector |
|
20 |
StartupArguments CommandLine CommandName CommandLineArguments |
|
21 |
CachedAbbreviations VerboseStartup VerboseLoading Verbose |
|
22 |
SilentLoading Initializing StandAlone HeadlessOperation IsPlugin |
|
20831 | 23 |
IsSharedLibraryComponent IsSTScript IsRepl DebuggingStandAlone |
21020 | 24 |
Silent Debugging LogDoits LoadBinaries RealSystemPath |
25 |
ResourcePath SourcePath BinaryPath FileInPath PackagePath |
|
26 |
BinaryDirName ResourceDirName SourceDirName BitmapDirName |
|
27 |
PackageDirName FileInDirName ChangeFileName ImageStartTime |
|
28 |
ImageRestartTime DemoMode SaveEmergencyImage SpecialObjectArray |
|
29 |
CallbackSignal ClassesFailedToInitialize HasNoConsole IgnoreHalt |
|
20615 | 30 |
PackageToPathMapping IgnoreAssertions LanguageModifier |
31 |
LanguageCodeset' |
|
18668 | 32 |
poolDictionaries:'' |
33 |
category:'System-Support' |
|
1 | 34 |
! |
35 |
||
20832 | 36 |
Smalltalk comment:'' |
8845
17288e4e99eb
remember, where autoload decl came from
Claus Gittinger <cg@exept.de>
parents:
8821
diff
changeset
|
37 |
! |
17288e4e99eb
remember, where autoload decl came from
Claus Gittinger <cg@exept.de>
parents:
8821
diff
changeset
|
38 |
|
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
39 |
!Smalltalk class methodsFor:'documentation'! |
70 | 40 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
41 |
copyright |
617 | 42 |
" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
43 |
COPYRIGHT (c) 1988 by Claus Gittinger |
18668 | 44 |
All Rights Reserved |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
45 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
46 |
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
|
47 |
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
|
48 |
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
|
49 |
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
|
50 |
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
|
51 |
hereby transferred. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
52 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
53 |
! |
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 |
documentation |
70 | 56 |
" |
57 |
This is one of the central classes in the system; |
|
58 |
it provides all system-startup, shutdown and maintenance support. |
|
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
59 |
Also global variables are (conceptionally) kept here. |
70 | 60 |
|
61 |
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
|
62 |
- my implementation of globals is totally different |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
63 |
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
|
64 |
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
|
65 |
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
|
66 |
functions found there. |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
67 |
|
70 | 68 |
However, it provides the known enumeration protocol. |
3062
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
69 |
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
|
70 |
to inherit more collection stuff ... |
70 | 71 |
|
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
72 |
|
1286 | 73 |
[Instance variables:] |
18668 | 74 |
none - all handling is done in the VM |
1286 | 75 |
|
76 |
[Class variables:] |
|
77 |
||
18668 | 78 |
StartBlocks <Collection> blocks to be executed in a separate process after |
79 |
everything has been initialized. These blocks will |
|
80 |
be deleted after execution and therefore not be |
|
81 |
executed after an image restart. Initial processes |
|
82 |
(such as the Launcher) are usually started here. |
|
83 |
These blocks are added by smalltalk.rc/private.rc etc. |
|
84 |
via #addStartBlock during early initialization. |
|
85 |
||
86 |
ImageStartBlocks |
|
87 |
<Collection> blocks to be executed in a separate process after |
|
88 |
everything has been initialized. These blocks will be |
|
89 |
executed after an image restart. |
|
90 |
These blocks are usually added by smalltalk_r.rc etc. |
|
91 |
||
92 |
ExitBlocks <Collection> blocks to evaluate before system is |
|
93 |
left. Not currently used (GNU-ST compatibility). |
|
94 |
||
95 |
SystemPath <Collection> path to search for system files (sources, bitmaps etc) |
|
96 |
Set to a default here, but typically changed from some |
|
97 |
startup.rc file |
|
98 |
||
99 |
PackagePath <Collection> path to search for package. |
|
100 |
This is going to replace the above systemPath, and a classes |
|
101 |
resources will eventually searched in its package directory. |
|
102 |
This list defines the path, where packages are searched for, |
|
103 |
initially this is something like /opt/smalltalk/packages. |
|
104 |
Set to a default here, but typically changed from some |
|
105 |
startup.rc file |
|
106 |
||
107 |
StartupClass <Class> class and selector, where the system starts up |
|
108 |
StartupSelector <Symbol> (right after VM initialization) |
|
109 |
StartupArguments <Array> If an image is saved while those being nonNil, |
|
110 |
the image will come up there. |
|
111 |
Allows for customized images to be generated from a standard ST/X. |
|
112 |
StandAlone programs also set those during initialization. |
|
113 |
||
114 |
CommandLine <String> Unix (OS-) command line |
|
115 |
||
116 |
CommandName <String> the command (i.e. argv[0]) |
|
117 |
||
118 |
CommandLineArguments <Array> Unix (OS-) command line arguments broken into words |
|
119 |
CommandName has been stripped off. |
|
120 |
(initially set by the VM) |
|
121 |
||
122 |
SilentLoading <Boolean> OBSOLETE: |
|
123 |
suppresses messages during fileIn and in compiler |
|
124 |
(can be set to true from a customized main.c) |
|
125 |
||
126 |
VerboseLoading <Boolean> generate messages during fileIn and in compiler |
|
127 |
(can be set to true from a customized main.c) |
|
128 |
||
129 |
Initializing <Boolean> true while (re-)initializing |
|
130 |
Controls the behavior of certain error |
|
131 |
reporters (for example: suppress dialogBoxes) |
|
132 |
while the system is not yet fit for full operation. |
|
133 |
||
134 |
StandAlone <Boolean> true, if this is a standalone app; |
|
135 |
if true the process scheduler watches for |
|
136 |
which processes are still running, and |
|
137 |
exits ST/X, when the last non-background |
|
138 |
and non-system process exits. |
|
139 |
Can be set in an application-specific startup script, |
|
140 |
or, for standAlone programs, by C-code during initialization. |
|
141 |
||
142 |
HeadlessOperation if true, a non-existing Display connection |
|
143 |
<Boolean> will NOT lead to an error-exit during startup. |
|
144 |
Default is false. |
|
145 |
Can be set in an application-specific startup script, |
|
146 |
or, for standAlone programs, by C-code during initialization. |
|
147 |
||
148 |
LogDoits <Boolean> if true, doits are also logged in the changes |
|
149 |
file. Default is false, since the changes file |
|
150 |
may become huge if every tiny doIt is saved there ... |
|
151 |
||
152 |
LoadBinaries <Boolean> if true, we attempt to load classes rom a binary |
|
153 |
file, if present. If false, this is always suppressed. |
|
154 |
||
155 |
SaveEmergencyImage <Boolean> if true (the default), an emergency image |
|
156 |
is saved, if the main Display looses its |
|
157 |
connection. This is useful if you have a |
|
158 |
flaky display connection (serial line) |
|
159 |
and want to have your stuff saved automatically |
|
160 |
in case of a broken connection. |
|
161 |
||
162 |
IgnoreAssertions <Boolean> if true, assertions are ignored (i.e. no errors reported). |
|
163 |
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
|
164 |
|
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
165 |
strictly private classVariables (helpers): |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
166 |
|
18668 | 167 |
CachedClasses <Collection> known classes (cached for faster class enumeration) |
168 |
||
169 |
CachedAbbreviations |
|
170 |
<Dictionary> className to filename mappings |
|
171 |
||
172 |
RealSystemPath <Collection> cached collection of directories along the path |
|
173 |
which really exist. Caching avoids long checks |
|
174 |
for existing directories on broken NFS volumes. |
|
175 |
||
176 |
SourcePath <Collection> cached names of really existing directories |
|
177 |
These are remembered, as in NFS systems, |
|
178 |
ResourcePath the time to lookup files may become long |
|
179 |
BinaryPath (especially, if some directories are on machines |
|
180 |
FileInPath which are not up ...). |
|
181 |
Therefore, the set of really |
|
182 |
existing directories is cached when the SystemPath |
|
183 |
is walked the first time. |
|
184 |
A consequence is that you have to invoke |
|
185 |
flushSystemPath, when you create any of those |
|
186 |
directories while running |
|
187 |
(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
|
188 |
|
1286 | 189 |
|
190 |
[author:] |
|
18668 | 191 |
Claus Gittinger |
3062
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
192 |
|
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
193 |
[see also:] |
18668 | 194 |
ObjectMemory |
195 |
StandaloneStartup |
|
196 |
GetOpt |
|
197 |
ReadEvalPrintLoop |
|
70 | 198 |
" |
8945 | 199 |
! |
200 |
||
201 |
readme_resources |
|
202 |
" |
|
203 |
What is a resource file: |
|
18668 | 204 |
resource files contain language transformation and sometimes |
205 |
UI-look specifics such as icons etc. |
|
8945 | 206 |
|
207 |
Where are resources stored in the image: |
|
18668 | 208 |
Resource files are only read on demand (i.e. when needed) and only read once |
209 |
i.e. they are cached in the image). |
|
210 |
The cached data is held in a per-class class-instVar named 'ClassResources'. |
|
211 |
With only a few exceptions, the only classes which need resources are the GUI |
|
212 |
classes under the SimpleView hierarchy. |
|
8945 | 213 |
|
214 |
How does the system find resources: |
|
18668 | 215 |
The idea is that the system-provided resource files can be overwritten |
216 |
by the user or an application configuration. |
|
217 |
This works via a hierarchy of directories where resources are searched for, |
|
218 |
with the systems standard resource-files being at the end of that chain. |
|
219 |
||
220 |
When searching for a resource file for class X, the following files are searched |
|
221 |
in order: |
|
222 |
{ResourcePath} / resources / X.rs |
|
223 |
{SystemPath} / (CLASSES-PACKAGE-PATH) / X.rs |
|
224 |
{ResourcePath} / (CLASSES-PACKAGE-PATH) / X.rs |
|
8945 | 225 |
" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
226 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
227 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
228 |
!Smalltalk class methodsFor:'initialization'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
229 |
|
11057 | 230 |
basicInitializeSystem |
16180 | 231 |
"initialize all other classes. |
16655 | 232 |
This one is the very first entry into the smalltalk world |
233 |
[with error handling, via the initializeSystem], |
|
234 |
right after startup, usually immediately followed by Smalltalk>>start. |
|
235 |
||
11057 | 236 |
Notice: |
22791 | 237 |
this is NOT called when an image is restarted; in this |
238 |
case the show starts in Smalltalk>>restart." |
|
19992 | 239 |
|
240 |
OrderedCollection initialize. |
|
22791 | 241 |
|
20615 | 242 |
Smalltalk at:#Compiler put:ByteCodeCompiler. |
13771 | 243 |
Compiler isNil ifTrue:[ |
22791 | 244 |
" |
245 |
ByteCodeCompiler is not in the system (i.e. has not been linked in) |
|
246 |
this allows at least immediate evaluations for runtime systems without compiler |
|
247 |
NOTICE: a parser is always needed, otherwise we cannot read resource files etc. |
|
248 |
" |
|
249 |
Smalltalk at:#Compiler put:Parser |
|
16164 | 250 |
]. |
13771 | 251 |
|
11057 | 252 |
"/ |
253 |
"/ start catching SIGSEGV and SIGBUS |
|
254 |
"/ |
|
255 |
OperatingSystem enableHardSignalInterrupts. |
|
256 |
||
257 |
self initGlobalsFromEnvironment. |
|
258 |
||
259 |
"/ |
|
260 |
"/ sorry - there are some, which MUST be initialized before .. |
|
261 |
"/ reason: if any error happens during init, we need Signals, Stdout etc. to be there |
|
262 |
"/ |
|
15265 | 263 |
SmallInteger initialize. |
11057 | 264 |
Object initialize. |
18283 | 265 |
UninterpretedBytes initialize. |
21599 | 266 |
ProcessorScheduler initialize. "make sure Processor exists (RecursionLock needs it)" |
16691 | 267 |
OperatingSystem initialize. |
11057 | 268 |
Stream initialize. |
269 |
PositionableStream initialize. |
|
270 |
Filename initialize. |
|
271 |
ObjectMemory initialize. |
|
272 |
ExternalStream initialize. |
|
273 |
||
274 |
self initStandardStreams. "/ setup Stdin, Stdout etc. |
|
275 |
||
276 |
"/ |
|
277 |
"/ sorry, path must be set before ... |
|
278 |
"/ reason: some classes need it during initialize (they might need resources, bitmaps etc) |
|
279 |
"/ |
|
17534 | 280 |
"/ but, on OSX we need the CharacterEncoder to be initialized |
281 |
CharacterEncoder initialize. |
|
11057 | 282 |
self initSystemPath. |
283 |
||
284 |
"/ |
|
14427 | 285 |
"/ in case, someone needs the objectFileLoader early |
286 |
"/ |
|
16675 | 287 |
ObjectFileLoader notNil ifTrue:[ |
22791 | 288 |
ObjectFileLoader initialize. |
16675 | 289 |
]. |
14427 | 290 |
|
291 |
"/ |
|
11057 | 292 |
"/ now, finally, initialize all other classes |
293 |
"/ |
|
294 |
self initializeModules. |
|
295 |
||
296 |
ImageStartTime := Timestamp now. |
|
297 |
||
298 |
self initInterrupts. |
|
299 |
self initUserPreferences. |
|
300 |
||
16668
b88318df967d
flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents:
16666
diff
changeset
|
301 |
"/ 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
|
302 |
"/ 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
|
303 |
"/ required for some apps, for example to show the menu correctly (see launcher's help menu) |
16675 | 304 |
ApplicationModel notNil ifTrue:[ |
22791 | 305 |
ApplicationModel flushAllClassResources. |
16675 | 306 |
]. |
16668
b88318df967d
flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents:
16666
diff
changeset
|
307 |
|
11057 | 308 |
"/ |
309 |
"/ give classes a chance to perform 2nd-level initialization |
|
310 |
"/ now, we are certain, that all other classes have been initialized |
|
311 |
"/ (especially: streams and signals can now be used) |
|
312 |
"/ |
|
313 |
ObjectMemory changed:#initialized. |
|
314 |
||
315 |
"Modified: / 05-12-2006 / 21:48:58 / cg" |
|
14427 | 316 |
"Modified: / 24-10-2012 / 18:45:15 / sr" |
21599 | 317 |
"Modified: / 27-02-2017 / 20:39:14 / stefan" |
11057 | 318 |
! |
319 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
320 |
initGlobalsFromEnvironment |
617 | 321 |
"setup globals from the shell-environment" |
322 |
||
323 |
|envString i langString terrString| |
|
324 |
||
5406 | 325 |
StandAlone isNil ifTrue:[ |
22791 | 326 |
StandAlone := false. |
5406 | 327 |
]. |
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
328 |
HeadlessOperation isNil ifTrue:[ |
22791 | 329 |
HeadlessOperation := false. |
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
330 |
]. |
5406 | 331 |
|
617 | 332 |
" |
333 |
extract Language and LanguageTerritory from LANG variable. |
|
5846 | 334 |
valid are for example: |
22791 | 335 |
en_en / en |
336 |
en_us |
|
337 |
en_gb |
|
338 |
de_de / de |
|
339 |
de_at (for Austria) |
|
5846 | 340 |
" |
341 |
||
342 |
Language := #en. |
|
994
6163ae7aaf9b
territory defaults to #us (instead of #usa)
Claus Gittinger <cg@exept.de>
parents:
977
diff
changeset
|
343 |
LanguageTerritory := #us. |
617 | 344 |
|
5846 | 345 |
|
346 |
"Format of LANG is: language[_territory][.codeset][@modifier] |
|
22791 | 347 |
language ISO-639 Language code |
348 |
territory ISO-3166 Contry code" |
|
7779
6d88d32bdd64
Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents:
7763
diff
changeset
|
349 |
|
6d88d32bdd64
Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents:
7763
diff
changeset
|
350 |
envString := OperatingSystem getLanguage. |
21928 | 351 |
envString notEmptyOrNil ifTrue:[ |
22791 | 352 |
i := envString indexOf:$@. |
353 |
(i ~~ 0) ifTrue:[ |
|
354 |
LanguageModifier := (envString copyFrom:(i + 1)) asLowercase asSymbol. |
|
355 |
envString := envString copyTo:(i - 1). |
|
356 |
] ifFalse:[ |
|
357 |
LanguageModifier := nil. |
|
358 |
]. |
|
359 |
i := envString indexOf:$.. |
|
360 |
(i ~~ 0) ifTrue:[ |
|
361 |
LanguageCodeset := (envString copyFrom:(i + 1)) asLowercase asSymbol. |
|
362 |
envString := envString copyTo:(i - 1). |
|
363 |
] ifFalse:[ |
|
364 |
LanguageCodeset := #'iso8859-1'. |
|
365 |
]. |
|
366 |
i := envString indexOf:$_. |
|
367 |
(i == 0) ifTrue:[ |
|
368 |
langString := envString. |
|
369 |
terrString := envString |
|
370 |
] ifFalse:[ |
|
371 |
langString := envString copyTo:(i - 1). |
|
372 |
terrString := envString copyFrom:(i + 1) |
|
373 |
]. |
|
374 |
langString := langString asLowercase. |
|
375 |
terrString := terrString asLowercase. |
|
376 |
(langString = 'c' or:[terrString = 'c']) ifTrue:[ |
|
377 |
('Smalltalk [info]: ignoring wrong LANG setting (',langString,'_',terrString,') - using english') infoPrintCR. |
|
378 |
] ifFalse:[ |
|
379 |
Language := langString asSymbol. |
|
380 |
LanguageTerritory := terrString asSymbol |
|
381 |
] |
|
617 | 382 |
]. |
383 |
||
384 |
" |
|
385 |
Smalltalk initGlobalsFromEnvironment |
|
386 |
" |
|
994
6163ae7aaf9b
territory defaults to #us (instead of #usa)
Claus Gittinger <cg@exept.de>
parents:
977
diff
changeset
|
387 |
|
14011
d33d2c6497f4
changed: #initGlobalsFromEnvironment
Claus Gittinger <cg@exept.de>
parents:
13998
diff
changeset
|
388 |
"Modified: / 14-02-2012 / 15:25:08 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
389 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
390 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
391 |
initInterrupts |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
392 |
"initialize interrupts" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
393 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
394 |
OperatingSystem enableUserInterrupts. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
395 |
OperatingSystem enableHardSignalInterrupts. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
396 |
OperatingSystem enableCrashSignalInterrupts. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
397 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
398 |
ObjectMemory userInterruptHandler:self. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
399 |
ObjectMemory signalInterruptHandler:self. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
400 |
ObjectMemory recursionInterruptHandler:self. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
401 |
|
14805 | 402 |
OperatingSystem isOSXlike ifTrue:[ |
18668 | 403 |
"/ OSX sends SIGABRT for NSExceptions |
404 |
OperatingSystem operatingSystemSignal:(OperatingSystem sigABRT) install:NSException. |
|
405 |
OperatingSystem enableAbortInterrupts. |
|
14805 | 406 |
]. |
407 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
408 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
409 |
Smalltalk initInterrupts |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
410 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
411 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
412 |
"Modified: 20.8.1997 / 09:35:49 / stefan" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
413 |
! |
617 | 414 |
|
415 |
initStandardStreams |
|
416 |
"initialize some well-known streams" |
|
417 |
||
418 |
Stdout := NonPositionableExternalStream forStdout. |
|
419 |
Stderr := NonPositionableExternalStream forStderr. |
|
420 |
Stdin := NonPositionableExternalStream forStdin. |
|
10145
cca90547778e
allow for different OS's to initialize the Printer differently
Claus Gittinger <cg@exept.de>
parents:
10143
diff
changeset
|
421 |
PrinterStream notNil ifTrue:[ |
18668 | 422 |
Printer := PrinterStream defaultPrinter. |
10145
cca90547778e
allow for different OS's to initialize the Printer differently
Claus Gittinger <cg@exept.de>
parents:
10143
diff
changeset
|
423 |
]. |
617 | 424 |
Transcript := Stderr |
425 |
||
963
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
426 |
" |
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
427 |
Smalltalk initStandardStreams |
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
428 |
" |
10145
cca90547778e
allow for different OS's to initialize the Printer differently
Claus Gittinger <cg@exept.de>
parents:
10143
diff
changeset
|
429 |
|
cca90547778e
allow for different OS's to initialize the Printer differently
Claus Gittinger <cg@exept.de>
parents:
10143
diff
changeset
|
430 |
"Modified: / 25-10-2006 / 17:36:46 / cg" |
617 | 431 |
! |
432 |
||
433 |
initStandardTools |
|
10646 | 434 |
"predefine some tools which we might need later |
617 | 435 |
- if the view-classes exist, |
436 |
they will redefine Inspector and Debugger for graphical interfaces" |
|
437 |
||
438 |
Display notNil ifTrue:[ |
|
18668 | 439 |
InspectorView notNil ifTrue:[ |
440 |
Inspector := InspectorView |
|
441 |
]. |
|
442 |
DebugView notNil ifTrue:[ |
|
443 |
Debugger := DebugView |
|
444 |
]. |
|
445 |
"/ Display initialize |
|
13303
1aa90c41dd35
changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents:
13212
diff
changeset
|
446 |
]. |
1aa90c41dd35
changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents:
13212
diff
changeset
|
447 |
|
1aa90c41dd35
changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents:
13212
diff
changeset
|
448 |
"/ make the changeFilePath an absolute one, |
1aa90c41dd35
changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents:
13212
diff
changeset
|
449 |
"/ in case some stupid windows fileDialog changes the current directory... |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
450 |
ObjectMemory |
18668 | 451 |
nameForChanges:(Filename currentDirectory / ObjectMemory nameForChangesLocal) |
452 |
asAbsoluteFilename pathName |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
453 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
454 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
455 |
Smalltalk initStandardTools |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
456 |
" |
13303
1aa90c41dd35
changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents:
13212
diff
changeset
|
457 |
|
1aa90c41dd35
changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents:
13212
diff
changeset
|
458 |
"Modified: / 09-02-2011 / 20:44:47 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
459 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
460 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
461 |
initSystemPath |
617 | 462 |
"setup path where system files are searched for. |
463 |
the default path is set to: |
|
22791 | 464 |
. |
465 |
<directory of exe> (WIN32 only) |
|
466 |
$HOME (if defined) |
|
467 |
$HOME/.smalltalk (if defined & existing) |
|
468 |
$SMALLTALK_LIBDIR (if defined & existing) |
|
469 |
$STX_LIBDIR (if defined & existing) |
|
470 |
$STX_TOPDIR (if defined & existing) |
|
471 |
REGISTRY('HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X\<CurrentVersion>\LibDir') (WIN32 only) |
|
472 |
REGISTRY('HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X\LibDir') (WIN32 only) |
|
473 |
<standard places> |
|
9021 | 474 |
|
475 |
standard places (unix): |
|
22791 | 476 |
/opt/smalltalk/<release> (if existing) |
477 |
/opt/smalltalk (if existing) |
|
478 |
/usr/local/lib/smalltalk (if existing) |
|
479 |
/usr/lib/smalltalk (if existing) |
|
480 |
/lib/smalltalk (if existing) |
|
4001
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
481 |
|
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
482 |
win32: |
22791 | 483 |
\programs\exept\smalltalk (if existing) |
484 |
\programs\smalltalk (if existing) |
|
485 |
\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 |
vms: |
22791 | 488 |
$stx:lib (if existing) |
489 |
$stx:root (if existing) |
|
617 | 490 |
|
491 |
of course, it is possible to add entries from the 'smalltalk.rc' |
|
492 |
startup file; add expressions such as: |
|
22791 | 493 |
Smalltalk systemPath addFirst:'/foo/bar/baz'. |
494 |
or: |
|
495 |
Smalltalk systemPath addLast:'/fee/foe/foo'. |
|
4001
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
496 |
|
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
497 |
However, smalltalk.rc itself must be found along the above path. |
617 | 498 |
" |
499 |
||
2928 | 500 |
ChangeFileName := 'changes'. |
501 |
OperatingSystem isVMSlike ifTrue:[ |
|
22791 | 502 |
BitmapDirName := 'bitmaps.dir'. |
503 |
BinaryDirName := 'binary.dir'. |
|
504 |
SourceDirName := 'source.dir'. |
|
505 |
ResourceDirName := 'resources.dir'. |
|
506 |
FileInDirName := 'filein.dir'. |
|
507 |
PackageDirName := 'packages.dir'. |
|
2928 | 508 |
] ifFalse:[ |
22791 | 509 |
BitmapDirName := 'bitmaps'. |
510 |
BinaryDirName := 'binary'. |
|
511 |
SourceDirName := 'source'. |
|
512 |
ResourceDirName := 'resources'. |
|
513 |
FileInDirName := 'fileIn'. |
|
514 |
PackageDirName := 'packages'. |
|
16234 | 515 |
]. |
516 |
||
517 |
SystemPath isEmptyOrNil ifTrue:[ |
|
22791 | 518 |
SystemPath := OperatingSystem defaultSystemPath. |
519 |
self flushPathCaches |
|
16234 | 520 |
]. |
521 |
||
522 |
PackagePath isEmptyOrNil ifTrue:[ |
|
22791 | 523 |
PackagePath := OperatingSystem defaultPackagePath. |
18868 | 524 |
]. |
525 |
self addWorkspaceDirectoryToPackagePath. |
|
20663 | 526 |
self addIdeTopDirectoryToPackagePath. |
617 | 527 |
|
528 |
" |
|
529 |
Smalltalk initSystemPath |
|
530 |
Smalltalk systemPath |
|
11679
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
531 |
|
20640 | 532 |
SystemPath := nil. |
533 |
PackagePath := nil. |
|
11679
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
534 |
OperatingSystem defaultSystemPath |
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
535 |
OperatingSystem defaultPackagePath |
617 | 536 |
" |
5139 | 537 |
|
5145 | 538 |
"Modified: / 24.12.1999 / 00:23:35 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
539 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
540 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
541 |
initUserPreferences |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
542 |
"setup other stuff" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
543 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
544 |
LogDoits := false. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
545 |
LoadBinaries := false. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
546 |
SaveEmergencyImage := (StandAlone ~~ true). |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
547 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
548 |
"Modified: / 24.10.1997 / 18:22:47 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
549 |
! |
617 | 550 |
|
7526 | 551 |
initializeClass:aClass |
552 |
"sent from VM via #initializeModules" |
|
553 |
||
7527 | 554 |
Error handle:[:ex | |
22791 | 555 |
ObjectMemory printStackBacktrace. |
556 |
ClassesFailedToInitialize isNil ifTrue:[ |
|
557 |
ClassesFailedToInitialize := IdentitySet new. |
|
558 |
]. |
|
559 |
ClassesFailedToInitialize add:aClass. |
|
560 |
('Smalltalk [warning]: error during initialize of ' , aClass name,': ', ex description printString) errorPrintCR. |
|
561 |
ex suspendedContext fullPrintAll. |
|
562 |
'------------------------------------------------' errorPrintCR. |
|
563 |
(Debugging == true) ifTrue:[ |
|
564 |
ex reject |
|
565 |
]. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
566 |
] do:[ |
22791 | 567 |
aClass initialize |
13675 | 568 |
]. |
569 |
||
570 |
"Modified: / 11-09-2011 / 17:01:32 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
571 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
572 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
573 |
initializeModules |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
574 |
"perform module specific initialization and |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
575 |
send #initialize to all classes. |
16180 | 576 |
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
|
577 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
578 |
self initializeModulesOnce. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
579 |
ClassesFailedToInitialize size > 0 ifTrue:[ |
18668 | 580 |
('Smalltalk [info]: retry initialization of failed class(es)...') infoPrintCR. |
581 |
ClassesFailedToInitialize := nil. |
|
582 |
self initializeModulesOnce. |
|
583 |
ClassesFailedToInitialize size > 0 ifTrue:[ |
|
584 |
('Smalltalk [error]: class(es) persist to fail during initialize') errorPrintCR. |
|
585 |
] |
|
10122 | 586 |
]. |
587 |
||
588 |
ProjectDefinition initializeAllProjectDefinitions. |
|
589 |
||
590 |
"Modified: / 23-10-2006 / 16:40:39 / cg" |
|
7527 | 591 |
! |
592 |
||
7563 | 593 |
initializeModulesOnce |
594 |
"perform module specific initialization and |
|
595 |
send #initialize to all classes. |
|
7527 | 596 |
Notice: this is not called when an image is restarted" |
4963 | 597 |
|
617 | 598 |
%{ |
18349 | 599 |
#ifdef __SCHTEAM__ |
600 |
STClass.initializeAllClasses(__c__); |
|
601 |
return __c__._RETURN_self(); |
|
602 |
#else |
|
1688
8a42db1eea60
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1682
diff
changeset
|
603 |
__init_registered_modules__(3); |
4963 | 604 |
|
1481 | 605 |
@global(DemoMode) = __getDemoMode() ? true : false; |
5410 | 606 |
RETURN (self); |
18349 | 607 |
#endif /* not SCHTEAM */ |
5410 | 608 |
%}. |
609 |
^ self primitiveFailed |
|
617 | 610 |
! |
611 |
||
7563 | 612 |
initializeSystem |
16655 | 613 |
"initialize all classes; setup dispatcher processes etc. |
3499 | 614 |
This one is the very first entry into the smalltalk world, |
16655 | 615 |
right after startup, usually immediately followed by Smalltalk>>start. |
616 |
Here, a few specific initializations are done, then the actual initialization is |
|
617 |
done inside an error handler in basicInitializeSystem. |
|
10071 | 618 |
Notice: |
22791 | 619 |
this is called by the VM's main entry. You will not find senders from Smalltalk. |
18385 | 620 |
Also Notice: |
22791 | 621 |
this is NOT called when an image is restarted; |
622 |
in this case the show starts in Smalltalk>>restart." |
|
211 | 623 |
|
19510 | 624 |
|idx shellArgs| |
6841
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
625 |
|
12861 | 626 |
NumberOfClassesHint := 10000. |
8964
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
627 |
|
3499 | 628 |
Initializing := true. |
629 |
AbstractOperatingSystem initializeConcreteClass. |
|
630 |
||
18307
c1d97d109f88
also care for empty cmd-line args (could be empty OrderedCollection)
Claus Gittinger <cg@exept.de>
parents:
18293
diff
changeset
|
631 |
CommandLineArguments isEmptyOrNil ifTrue:[ |
22791 | 632 |
CommandLineArguments := #('stx') asOrderedCollection. |
5400 | 633 |
]. |
4006
c7ad38c52eb9
must set CommandLineArguments earlier (to be available in initializeSystem)
Claus Gittinger <cg@exept.de>
parents:
4001
diff
changeset
|
634 |
CommandLine := CommandLineArguments copy. |
c7ad38c52eb9
must set CommandLineArguments earlier (to be available in initializeSystem)
Claus Gittinger <cg@exept.de>
parents:
4001
diff
changeset
|
635 |
CommandLineArguments := CommandLineArguments asOrderedCollection. |
6842 | 636 |
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
|
637 |
|
21021 | 638 |
SilentLoading := Silent := false. |
639 |
VerboseLoading := VerboseStartup := Verbose := false. |
|
19427 | 640 |
DebuggingStandAlone := Debugging := false. |
19510 | 641 |
|
642 |
"/ if no argument was given, look for an environment variable named |
|
643 |
"/ STX_DEFAULT_ARGS. If set, take that. |
|
644 |
"/ if any argument was given, unless a --noShellArgs argument is given, |
|
645 |
"/ slice in the value from "STX_MORE_ARGS" at the beginning. |
|
646 |
"/ |
|
647 |
"/ These allow for args like "--quick --infoPrint" to be automatically prepended |
|
19511 | 648 |
idx := CommandLineArguments indexOfAny:#('--noShellArgs' '--noshellargs'). |
19510 | 649 |
(idx ~~ 0) ifTrue:[ |
22791 | 650 |
CommandLineArguments removeIndex:idx. |
651 |
] ifFalse:[ |
|
652 |
CommandLineArguments isEmpty ifTrue:[ |
|
653 |
shellArgs := OperatingSystem getEnvironment:'STX_DEFAULT_ARGS'. |
|
654 |
shellArgs notEmptyOrNil ifTrue:[ |
|
655 |
shellArgs := shellArgs asCollectionOfWords. |
|
656 |
CommandLineArguments addAll:shellArgs. |
|
657 |
]. |
|
658 |
] ifFalse:[ |
|
659 |
"/ prepend shell environment args from "STX_ARGS" |
|
660 |
shellArgs := OperatingSystem getEnvironment:'STX_MORE_ARGS'. |
|
661 |
shellArgs notEmptyOrNil ifTrue:[ |
|
662 |
shellArgs := shellArgs asCollectionOfWords. |
|
663 |
CommandLineArguments addAllFirst:shellArgs. |
|
664 |
]. |
|
665 |
]. |
|
666 |
]. |
|
667 |
||
668 |
self initializeVerboseFlags. |
|
14432 | 669 |
|
11057 | 670 |
Error handle:[:ex | |
22791 | 671 |
StandAlone ifTrue:[ |
672 |
DebuggingStandAlone ifFalse:[ |
|
673 |
'Startup Error - use "--debug" command line argument for more info' errorPrintCR. |
|
674 |
Smalltalk exit:1. |
|
675 |
]. |
|
676 |
'Smalltalk [error]: Error during early initialization:' errorPrintCR. |
|
677 |
thisContext fullPrintAll. |
|
678 |
]. |
|
679 |
ex reject. |
|
11057 | 680 |
] do:[ |
22791 | 681 |
self basicInitializeSystem |
14432 | 682 |
]. |
13091
bc840cd6f1ae
--verboseLoading command line arg (shlib loading trace)
Claus Gittinger <cg@exept.de>
parents:
13061
diff
changeset
|
683 |
|
bc840cd6f1ae
--verboseLoading command line arg (shlib loading trace)
Claus Gittinger <cg@exept.de>
parents:
13061
diff
changeset
|
684 |
"Modified: / 12-10-2010 / 11:27:47 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
685 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
686 |
|
18669 | 687 |
initializeVerboseFlags |
688 |
|idx| |
|
689 |
||
21021 | 690 |
StandAlone ifTrue:[ |
22791 | 691 |
InfoPrinting := false. |
692 |
ObjectMemory infoPrinting:false. |
|
693 |
IgnoreAssertions := true. |
|
21021 | 694 |
] ifFalse:[ |
22791 | 695 |
IgnoreAssertions := false. |
696 |
]. |
|
697 |
||
19430 | 698 |
(idx := CommandLineArguments indexOf:'--ignoreHalt') ~~ 0 ifTrue:[ |
22791 | 699 |
IgnoreHalt := true. |
700 |
CommandLineArguments removeIndex:idx |
|
19430 | 701 |
]. |
20855 | 702 |
(idx := CommandLineArguments indexOf:'--noIgnoreHalt') ~~ 0 ifTrue:[ |
22791 | 703 |
IgnoreHalt := false. |
704 |
CommandLineArguments removeIndex:idx |
|
20855 | 705 |
]. |
706 |
(idx := CommandLineArguments indexOf:'--ignoreAssert') ~~ 0 ifTrue:[ |
|
22791 | 707 |
IgnoreAssertions := true. |
708 |
CommandLineArguments removeIndex:idx |
|
20855 | 709 |
]. |
710 |
(idx := CommandLineArguments indexOf:'--noIgnoreAssert') ~~ 0 ifTrue:[ |
|
22791 | 711 |
IgnoreAssertions := false. |
712 |
CommandLineArguments removeIndex:idx |
|
20855 | 713 |
]. |
22314 | 714 |
(idx := CommandLineArguments indexOf:'--assert') ~~ 0 ifTrue:[ |
22791 | 715 |
IgnoreAssertions := false. |
716 |
CommandLineArguments removeIndex:idx |
|
22314 | 717 |
]. |
18669 | 718 |
(idx := CommandLineArguments indexOf:'--silentStartup') ~~ 0 ifTrue:[ |
22791 | 719 |
SilentLoading := true. |
720 |
CommandLineArguments removeIndex:idx |
|
18669 | 721 |
]. |
722 |
(idx := CommandLineArguments indexOf:'--verboseLoading') ~~ 0 ifTrue:[ |
|
22791 | 723 |
VerboseLoading := true. |
724 |
CommandLineArguments removeIndex:idx |
|
18669 | 725 |
]. |
726 |
(idx := CommandLineArguments indexOf:'--verboseStartup') ~~ 0 ifTrue:[ |
|
22791 | 727 |
VerboseLoading := true. |
728 |
VerboseStartup := true. |
|
729 |
CommandLineArguments removeIndex:idx |
|
18669 | 730 |
]. |
20855 | 731 |
|
732 |
"/ reinterpret those, in case given after the VM options. |
|
733 |
(idx := CommandLineArguments indexOf:'--debugPrint') ~~ 0 ifTrue:[ |
|
22791 | 734 |
ObjectMemory debugPrinting:true. |
735 |
CommandLineArguments removeIndex:idx |
|
20855 | 736 |
]. |
737 |
(idx := CommandLineArguments indexOf:'--infoPrint') ~~ 0 ifTrue:[ |
|
22791 | 738 |
ObjectMemory infoPrinting:true. |
739 |
CommandLineArguments removeIndex:idx |
|
20855 | 740 |
]. |
741 |
||
18669 | 742 |
(idx := CommandLineArguments indexOf:'--verbose') ~~ 0 ifTrue:[ |
22791 | 743 |
Object infoPrinting:true. |
744 |
Verbose := true. |
|
745 |
VerboseLoading := true. |
|
746 |
VerboseStartup := true. |
|
747 |
Logger notNil ifTrue:[ |
|
748 |
Logger loggingThreshold: Logger severityALL. |
|
749 |
]. |
|
750 |
CommandLineArguments removeIndex:idx. |
|
21020 | 751 |
]. |
752 |
||
753 |
Silent := false. |
|
754 |
(idx := CommandLineArguments indexOf:'--silent') ~~ 0 ifTrue:[ |
|
22791 | 755 |
CommandLineArguments removeIndex:idx. |
756 |
Silent := SilentLoading := true. |
|
757 |
Object infoPrinting:false. |
|
758 |
ObjectMemory infoPrinting:false. |
|
759 |
ObjectMemory debugPrinting:false. |
|
760 |
Verbose := VerboseLoading := VerboseStartup := false. |
|
761 |
Logger notNil ifTrue:[ |
|
762 |
Logger loggingThreshold: Logger severityNONE |
|
763 |
]. |
|
18669 | 764 |
]. |
21021 | 765 |
|
766 |
idx := CommandLineArguments indexOf:'--debug'. |
|
767 |
Debugging := (idx ~~ 0). |
|
768 |
||
769 |
StandAlone ifTrue:[ |
|
22791 | 770 |
DebuggingStandAlone := Debugging. |
771 |
DebuggingStandAlone ifTrue:[ |
|
772 |
Inspector := MiniInspector. |
|
773 |
Debugger := MiniDebugger. |
|
774 |
IgnoreAssertions := false. |
|
775 |
]. |
|
21021 | 776 |
] ifFalse:[ |
22791 | 777 |
"/ |
778 |
"/ define low-level debugging tools - graphical classes are not prepared yet |
|
779 |
"/ to handle things. |
|
780 |
"/ This will bring us into the MiniDebugger when an error occurs during startup. |
|
781 |
"/ |
|
782 |
Inspector := MiniInspector. |
|
783 |
Debugger := MiniDebugger. |
|
21021 | 784 |
]. |
22314 | 785 |
|
786 |
"Modified: / 12-10-2017 / 17:48:11 / cg" |
|
18669 | 787 |
! |
788 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
789 |
isInitialized |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
790 |
"this returns true, if the system is properly initialized; |
16170
ca4d03def070
endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents:
16164
diff
changeset
|
791 |
i.e. false during startup. |
15980 | 792 |
Especially, the whole display/viewing stuff and process escheduling |
793 |
is not working correctly until initialized." |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
794 |
|
18251
9b7f8e531a16
isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents:
18248
diff
changeset
|
795 |
Initializing isNil ifTrue:[^ false]. "/ if called very early |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
796 |
^ Initializing not |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
797 |
! |
1 | 798 |
|
7563 | 799 |
reinitStandardStreams |
800 |
"reinitialize some well-known streams. |
|
801 |
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
|
802 |
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
|
803 |
(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
|
804 |
|
8710aba7876b
oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents:
457
diff
changeset
|
805 |
Stdout reOpen. Stderr reOpen. Stdin reOpen. |
161 | 806 |
! ! |
807 |
||
16593 | 808 |
!Smalltalk class methodsFor:'Compatibility-GNU'! |
809 |
||
810 |
system:command |
|
811 |
"GNU-Smalltalk compatibility: execute an OS command" |
|
812 |
||
813 |
OperatingSystem executeCommand:command |
|
814 |
||
815 |
" |
|
816 |
Smalltalk system:'ls' |
|
817 |
" |
|
818 |
! ! |
|
819 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
820 |
!Smalltalk class methodsFor:'Compatibility-Squeak'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
821 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
822 |
beep |
17343 | 823 |
"output an audible beep or bell" |
824 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
825 |
Screen current beep |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
826 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
827 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
828 |
garbageCollect |
15009 | 829 |
"for Squeak compatibility" |
830 |
||
831 |
ObjectMemory garbageCollect |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
832 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
833 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
834 |
garbageCollectMost |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
835 |
"collect recently created garbage; return the amount of freeSpace. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
836 |
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
|
837 |
newSpace + freeListSpace is returned." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
838 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
839 |
ObjectMemory scavenge. |
15009 | 840 |
^ ObjectMemory freeSpace + (ObjectMemory newSpaceSize - ObjectMemory newSpaceUsed) |
8583
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 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
843 |
isMorphic |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
844 |
^ false |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
845 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
846 |
|
10844 | 847 |
platformName |
848 |
"not yet fully implemented (I have to figure out, what squeak returns in each case...)" |
|
849 |
||
850 |
^ OperatingSystem platformName asUppercaseFirst |
|
851 |
||
852 |
" |
|
853 |
Smalltalk platformName -> 'Win32' |
|
854 |
" |
|
855 |
! |
|
856 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
857 |
registerExternalObject: anObject |
7563 | 858 |
"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
|
859 |
If it is already there, just return its index. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
860 |
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
|
861 |
primitive code (via the global Smalltalk:SpecialObjectArray)" |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
862 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
863 |
| objects firstEmptyIndex obj sz newObjects | |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
864 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
865 |
objects := SpecialObjectArray. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
866 |
objects isNil ifTrue:[ |
18668 | 867 |
objects := Array new:5. |
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
868 |
]. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
869 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
870 |
"find the first empty slot and look if already registered" |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
871 |
firstEmptyIndex := 0. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
872 |
1 to: objects size do: [:i | |
18668 | 873 |
obj := objects at: i. |
874 |
obj == anObject ifTrue: [^ i]. "object already there, just return its index" |
|
875 |
(obj == nil and: [firstEmptyIndex = 0]) ifTrue: [ |
|
876 |
firstEmptyIndex := i |
|
877 |
] |
|
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
878 |
]. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
879 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
880 |
"if no empty slots, expand the array" |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
881 |
firstEmptyIndex = 0 ifTrue: [ |
18668 | 882 |
sz := objects size. |
883 |
newObjects := objects species new: sz + 20. "grow linearly" |
|
884 |
newObjects replaceFrom: 1 to: sz with: objects startingAt: 1. |
|
885 |
firstEmptyIndex := sz + 1. |
|
886 |
SpecialObjectArray := newObjects. |
|
887 |
objects := newObjects |
|
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 |
objects at: firstEmptyIndex put: anObject. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
891 |
^ firstEmptyIndex |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
892 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
893 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
894 |
|
12358 | 895 |
removeClassNamed: aName |
17576 | 896 |
"Invoked from fileouts: if there is currently a class in the system named aName, then remove it. |
897 |
Also needed by the refactory browser. |
|
898 |
If anything untoward happens, report it in the Transcript." |
|
12358 | 899 |
|
900 |
| oldClass | |
|
901 |
||
902 |
(oldClass := self at: aName asSymbol ifAbsent: [nil]) isNil ifTrue:[ |
|
18668 | 903 |
Transcript showCR: 'Removal of class named ', aName, ' ignored because it does not exist.'. |
904 |
^ self |
|
12358 | 905 |
]. |
906 |
oldClass removeFromSystem |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
907 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
908 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
909 |
!Smalltalk class methodsFor:'Compatibility-V''Age'! |
6722
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
910 |
|
7563 | 911 |
allClassesImplementing:aSelector |
12304
b0dc1c58de1a
changed: #allClassesImplementing:
Claus Gittinger <cg@exept.de>
parents:
12301
diff
changeset
|
912 |
^ self allClassesForWhich:[:cls | cls includesSelector:aSelector]. |
9506 | 913 |
|
914 |
"Modified: / 10-08-2006 / 12:12:17 / cg" |
|
9090 | 915 |
! |
916 |
||
16459 | 917 |
declareConstant:constantName poolName:poolNameArg value:value |
918 |
"visualAge compatible pool variable declaration. |
|
16562 | 919 |
called when a V'age application is filed in |
16459 | 920 |
(or one of its changes is accepted via the change browser)" |
921 |
||
922 |
|ns poolName pool| |
|
923 |
||
924 |
"/ when coming from the change-browser, |
|
925 |
"/ a namespace override may be given... |
|
926 |
ns := Class nameSpaceQuerySignal query. |
|
927 |
(ns isNil or:[ns == Smalltalk]) ifTrue:[ |
|
18668 | 928 |
poolName := poolNameArg asSymbol |
16459 | 929 |
] ifFalse:[ |
18668 | 930 |
poolName := (ns name,'::',poolNameArg) asSymbol |
16459 | 931 |
]. |
9090 | 932 |
pool := self classNamed:poolName. |
933 |
pool declareConstant:constantName value:value |
|
934 |
! |
|
935 |
||
16459 | 936 |
declarePoolDictionary:poolDictionaryNameArg |
937 |
"visualAge compatible pool declaration. |
|
16562 | 938 |
called when a V'age application is filed in |
16459 | 939 |
(or one of its changes is accepted via the change browser)" |
940 |
||
941 |
|ns poolName| |
|
942 |
||
943 |
poolName := poolDictionaryNameArg asSymbol. |
|
944 |
||
945 |
"/ "/ when coming from the change-browser, |
|
946 |
"/ "/ a namespace override may be given... |
|
947 |
"/ ns := Class nameSpaceQuerySignal query. |
|
948 |
"/ (ns isNil or:[ns == Smalltalk]) ifTrue:[ |
|
949 |
"/ poolName := poolDictionaryNameArg asSymbol |
|
950 |
"/ ] ifFalse:[ |
|
951 |
"/ poolName := (ns name,'::',poolDictionaryNameArg) asSymbol |
|
952 |
"/ ]. |
|
953 |
^ SharedPool subclass:(poolName asSymbol) |
|
18668 | 954 |
instanceVariableNames:'' |
955 |
classVariableNames:'' |
|
956 |
poolDictionaries:'' |
|
957 |
category:'* VAST Pools' |
|
13998
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
958 |
|
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
959 |
"Modified: / 07-02-2012 / 15:56:16 / cg" |
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
960 |
! |
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
961 |
|
16459 | 962 |
declareVariable:varName poolName:poolNameArg |
963 |
"visualAge compatible pool declaration. |
|
16562 | 964 |
called when a V'age application is filed in |
16459 | 965 |
(or one of its changes is accepted via the change browser)" |
966 |
||
967 |
|ns poolName pool| |
|
968 |
||
969 |
"/ when coming from the change-browser, |
|
970 |
"/ a namespace override may be given... |
|
971 |
ns := Class nameSpaceQuerySignal query. |
|
972 |
(ns isNil or:[ns == Smalltalk]) ifTrue:[ |
|
18668 | 973 |
poolName := poolNameArg asSymbol |
16459 | 974 |
] ifFalse:[ |
18668 | 975 |
poolName := (ns name,'::',poolNameArg) asSymbol |
16459 | 976 |
]. |
13998
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
977 |
pool := self classNamed:poolName. |
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
978 |
pool declareVariable:varName |
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
979 |
|
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
980 |
"Created: / 07-02-2012 / 15:57:05 / cg" |
6722
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
981 |
! ! |
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
982 |
|
20755 | 983 |
!Smalltalk class methodsFor:'Compatibility-VW'! |
6094
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
984 |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
985 |
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
|
986 |
^ self |
18668 | 987 |
defineClass:nameSymbol |
988 |
superclass:superclass |
|
989 |
indexedType:indexed |
|
990 |
private:private |
|
991 |
instanceVariableNames:instVars |
|
992 |
classInstanceVariableNames:classInstVars |
|
993 |
imports:imports |
|
994 |
category:category |
|
995 |
attributes:nil |
|
12033 | 996 |
! |
997 |
||
7563 | 998 |
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
|
999 |
|newClass| |
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
1000 |
|
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
1001 |
indexed == #none ifTrue:[ |
18668 | 1002 |
newClass := superclass |
1003 |
subclass:nameSymbol |
|
1004 |
instanceVariableNames:instVars |
|
1005 |
classVariableNames:'' |
|
1006 |
poolDictionaries:'' |
|
1007 |
category:category |
|
1008 |
inEnvironment:self. |
|
1009 |
classInstVars size > 0 ifTrue:[ |
|
1010 |
newClass class instanceVariableNames:classInstVars. |
|
1011 |
]. |
|
1012 |
^ newClass |
|
6851 | 1013 |
]. |
1014 |
self shouldImplement. |
|
12033 | 1015 |
! |
1016 |
||
1017 |
defineNameSpace:nameSymbol private:private imports:imports category:category |
|
1018 |
|newNameSpace| |
|
1019 |
||
1020 |
private ifTrue:[self halt]. "/ what to do ? |
|
1021 |
imports withoutSeparators notEmpty ifTrue:[self halt]. "/ what to do ? |
|
1022 |
newNameSpace := NameSpace name:nameSymbol. |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1023 |
newNameSpace setCategory:category. |
12033 | 1024 |
^ newNameSpace |
20755 | 1025 |
! |
1026 |
||
1027 |
dialectName |
|
1028 |
^ #SmalltalkX |
|
1029 |
||
1030 |
" |
|
1031 |
Smalltalk dialectName |
|
1032 |
" |
|
1033 |
! |
|
1034 |
||
1035 |
dialectReleaseVersion |
|
1036 |
^ self versionString |
|
1037 |
||
1038 |
" |
|
1039 |
Smalltalk dialectReleaseVersion |
|
1040 |
" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1041 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1042 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1043 |
!Smalltalk class methodsFor:'accessing'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1044 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1045 |
associationAt:aKey |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1046 |
"return a key-value association for aKey. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1047 |
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
|
1048 |
simulated here." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1049 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1050 |
|val| |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1051 |
|
20161 | 1052 |
val := self at:aKey ifAbsent:[^ nil]. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1053 |
^ Association key:aKey value:val |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1054 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1055 |
"Created: / 1.11.1997 / 13:27:20 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1056 |
! |
3083 | 1057 |
|
7563 | 1058 |
associationAt:aKey ifAbsent:exceptionBlock |
1059 |
"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
|
1060 |
from exceptionBlock, if no such key is present. |
14973 | 1061 |
Since ST/X's Smalltalk as no real dictionary, this is simulated here. |
20161 | 1062 |
Warning: this is a compatibility interface only, with a different semantic as |
22791 | 1063 |
the original ST80 implementation. The returned assoc is created on the fly, |
1064 |
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
|
1065 |
|
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
1066 |
|val| |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
1067 |
|
20161 | 1068 |
val := self at:aKey ifAbsent:[^ exceptionBlock value]. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1069 |
^ Association key:aKey value:val |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1070 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1071 |
"Created: / 18.6.1998 / 17:05:24 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1072 |
! |
3610
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
1073 |
|
7563 | 1074 |
at:aKey |
10071 | 1075 |
"retrieve the value stored under aKey, a symbol. |
1076 |
Return nil if not present |
|
1956 | 1077 |
(this will be changed to trigger an error - better use #at:ifAbsent:)" |
453 | 1078 |
|
16831 | 1079 |
aKey class == Symbol ifFalse:[self error:'expected symbol']. |
6080
15ea3cbf6003
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
6074
diff
changeset
|
1080 |
|
453 | 1081 |
%{ /* NOCONTEXT */ |
18287 | 1082 |
#ifdef __SCHTEAM__ |
1083 |
{ |
|
18668 | 1084 |
STSymbol keySymbol = aKey.asSTSymbol(); |
1085 |
STObject val = STSmalltalkEnvironment.GetResolvedBindingOrNull(keySymbol); |
|
1086 |
||
1087 |
return context._RETURN( val == null ? Nil : val ); |
|
18287 | 1088 |
} |
1089 |
/* NOT REACHED */ |
|
1090 |
#else |
|
453 | 1091 |
RETURN ( __GLOBAL_GET(aKey) ); |
18287 | 1092 |
#endif |
5406 | 1093 |
%}. |
5410 | 1094 |
^ self primitiveFailed |
453 | 1095 |
! |
1096 |
||
7563 | 1097 |
at:aKey ifAbsent:aBlock |
1098 |
"retrieve the value stored at aKey. |
|
7565 | 1099 |
If there is nothing stored under this key, return the value of |
1100 |
the evaluation of aBlock." |
|
453 | 1101 |
|
20161 | 1102 |
|val| |
1103 |
||
1104 |
val := self at:aKey. |
|
1105 |
(val notNil or:[self includesKey:aKey]) ifTrue:[ |
|
22791 | 1106 |
^ val |
453 | 1107 |
]. |
1108 |
^ aBlock value |
|
1109 |
||
1110 |
" |
|
20161 | 1111 |
Smalltalk removeKey:#fooBar. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1112 |
Smalltalk at:#fooBar <- returns nil |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1113 |
Smalltalk at:#fooBar ifAbsent:['sorry'] <- no error |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1114 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1115 |
! |
453 | 1116 |
|
15068 | 1117 |
at:aKey ifAbsentPut:aBlock |
1118 |
"return the element indexed by aKey if present, |
|
1119 |
if not present, store the result of evaluating valueBlock |
|
1120 |
under aKey and return it." |
|
1121 |
||
1122 |
^ self at:aKey ifAbsent:[ self at:aKey put:aBlock value ]. |
|
1123 |
||
1124 |
"Created: / 29-05-2007 / 12:41:12 / cg" |
|
1125 |
! |
|
1126 |
||
7563 | 1127 |
at:aKey ifPresent:aBlock |
1128 |
"try to retrieve the value stored at aKey. |
|
1129 |
If there is nothing stored under this key, do nothing. |
|
4870 | 1130 |
Otherwise, evaluate aBlock, passing the retrieved value as argument." |
1131 |
||
13883 | 1132 |
|val| |
1133 |
||
20161 | 1134 |
val := self at:aKey. |
1135 |
(val notNil or:[self includesKey:aKey]) ifTrue:[ |
|
22791 | 1136 |
^ aBlock value:val. |
4870 | 1137 |
]. |
1138 |
^ nil |
|
1139 |
||
1140 |
" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1141 |
Smalltalk at:#fooBar ifPresent:[:what | Transcript showCR:what]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1142 |
Smalltalk at:#Object ifPresent:[:what | Transcript showCR:what]. |
20161 | 1143 |
|
1144 |
Smalltalk at:#fooBar put:nil. |
|
1145 |
Smalltalk at:#fooBar ifPresent:[:what | Transcript showCR:what]. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1146 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1147 |
|
13883 | 1148 |
"Modified: / 27-12-2011 / 10:14:30 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1149 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1150 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1151 |
at:aKey put:aValue |
7563 | 1152 |
"store the argument aValue under aKey, a symbol. |
1153 |
Return aValue (sigh)." |
|
453 | 1154 |
|
1155 |
|oldValue| |
|
1156 |
||
1157 |
%{ |
|
18287 | 1158 |
#ifdef __SCHTEAM__ |
1159 |
{ |
|
18668 | 1160 |
STSymbol keySymbol = aKey.asSTSymbol(); |
1161 |
oldValue = STSmalltalkEnvironment.SetBinding(keySymbol, aValue); |
|
18287 | 1162 |
} |
1163 |
#else |
|
453 | 1164 |
oldValue = __GLOBAL_SET(aKey, aValue, (OBJ *)0); |
18287 | 1165 |
#endif |
453 | 1166 |
%}. |
1167 |
CachedClasses notNil ifTrue:[ |
|
18668 | 1168 |
oldValue isBehavior ifTrue:[ |
1169 |
oldValue name == aKey ifTrue:[ |
|
1170 |
CachedClasses remove:oldValue ifAbsent:[] |
|
1171 |
] |
|
1172 |
]. |
|
1173 |
aValue isBehavior ifTrue:[ |
|
1174 |
aValue name == aKey ifTrue:[ |
|
1175 |
CachedClasses add:aValue |
|
1176 |
] ifFalse:[ |
|
1177 |
CachedClasses := nil |
|
1178 |
] |
|
1179 |
]. |
|
453 | 1180 |
]. |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
1181 |
^ aValue. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1182 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1183 |
"Modified: 19.4.1996 / 11:31:49 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1184 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1185 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1186 |
includesKey:aKey |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1187 |
"return true, if the key is known" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1188 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1189 |
"/ for debugging - this is a common mistake, |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1190 |
"/ to try to access a class by nameString, instead |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1191 |
"/ of by symbol. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1192 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1193 |
"/ aKey class == String ifTrue:[self halt]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1194 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1195 |
%{ /* NOCONTEXT */ |
18287 | 1196 |
#ifdef __SCHTEAM__ |
1197 |
STSymbol keySymbol = aKey.asSTSymbol(); |
|
18668 | 1198 |
return __c__._RETURN( STSmalltalkEnvironment.HasBinding(keySymbol) ? STObject.True : STObject.False); |
18287 | 1199 |
/* NOT REACHED */ |
1200 |
#else |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1201 |
RETURN ( __GLOBAL_KEYKNOWN(aKey) ); |
18287 | 1202 |
#endif |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1203 |
%}. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1204 |
^ self primitiveFailed |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1205 |
! |
453 | 1206 |
|
7563 | 1207 |
keyAtValue:anObject |
21365 | 1208 |
"return the symbol under which anObject is stored - or nil. |
1209 |
This is a slow access, since the receiver is searched sequentially. |
|
1210 |
NOTICE: |
|
22791 | 1211 |
The value is searched using identity compare" |
453 | 1212 |
|
1213 |
self keysDo:[:aKey | |
|
22791 | 1214 |
(self at:aKey) == anObject ifTrue:[^ aKey] |
453 | 1215 |
]. |
1216 |
^ nil |
|
1217 |
||
1218 |
"Smalltalk keyAtValue:Object" |
|
21365 | 1219 |
|
1220 |
"Modified (comment): / 07-02-2017 / 11:06:21 / cg" |
|
453 | 1221 |
! |
1222 |
||
21363 | 1223 |
keyAtValue:anObject ifAbsent:exceptionValue |
21365 | 1224 |
"return the symbol under which anObject is stored - or the value from exceptionValue. |
1225 |
This is a slow access, since the receiver is searched sequentially. |
|
1226 |
NOTICE: |
|
22791 | 1227 |
The value is searched using identity compare" |
21363 | 1228 |
|
1229 |
self keysDo:[:aKey | |
|
22791 | 1230 |
(self at:aKey) == anObject ifTrue:[^ aKey] |
21363 | 1231 |
]. |
1232 |
^ exceptionValue value |
|
1233 |
||
1234 |
" |
|
1235 |
Smalltalk keyAtValue:Object ifAbsent:#foo |
|
1236 |
Smalltalk keyAtValue:1234 ifAbsent:#foo |
|
1237 |
" |
|
1238 |
||
1239 |
"Created: / 07-02-2017 / 10:58:51 / cg" |
|
1240 |
! |
|
1241 |
||
7563 | 1242 |
keys |
1243 |
"return a collection with all keys in the Smalltalk dictionary" |
|
1244 |
||
1245 |
|keys| |
|
453 | 1246 |
|
1247 |
keys := IdentitySet new. |
|
1248 |
self keysDo:[:k | keys add:k]. |
|
1249 |
^ keys |
|
617 | 1250 |
! |
1251 |
||
7563 | 1252 |
removeKey:aKey |
1253 |
"remove the association stored under the key-argument from the globals dictionary. |
|
10071 | 1254 |
WARNING: |
18668 | 1255 |
this is somewhat dangerous: conceptionally, the association is removed, |
1256 |
to which machine & byte compiled code refers if it accesses a global. |
|
1257 |
If there are still global accesses in some literalArray or from machine-compiled code, |
|
1258 |
it continues to reference the globals value via that obsolete association and gets a nil |
|
1259 |
value. (which is correct) |
|
1260 |
However, if that global is later reintroduced, a new association will be created and |
|
1261 |
the new global now referenced via the new association. |
|
1262 |
The old accesses will still see nil, although the globals value is actually non-nil |
|
1263 |
(this is questionable). |
|
1264 |
To avoid this problem, the #removeClass: method never removed the key." |
|
617 | 1265 |
|
1266 |
CachedClasses := nil. |
|
1267 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1268 |
%{ /* NOCONTEXT */ |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1269 |
RETURN ( __GLOBAL_REMOVE(aKey) ); |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1270 |
%}. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1271 |
^ self primitiveFailed |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1272 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1273 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1274 |
|
10538 | 1275 |
startBlocks |
1276 |
^ StartBlocks |
|
1277 |
! |
|
1278 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1279 |
values |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1280 |
"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
|
1281 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1282 |
|values| |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1283 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1284 |
values := OrderedCollection new. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1285 |
self do:[:v | values add:v]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1286 |
^ values |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1287 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1288 |
"Created: 20.6.1997 / 16:58:28 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1289 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1290 |
|
13540 | 1291 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1292 |
!Smalltalk class methodsFor:'browsing'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1293 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1294 |
browseAllCallsOn:aSelectorSymbol |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1295 |
"{ Pragma: +optSpace }" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1296 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1297 |
"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
|
1298 |
|
22241 | 1299 |
SystemBrowser default browseAllCallsOn:aSelectorSymbol |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1300 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1301 |
" |
10071 | 1302 |
Smalltalk browseAllCallsOn:#at:put: |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1303 |
" |
22241 | 1304 |
|
1305 |
"Modified: / 01-09-2017 / 14:21:31 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1306 |
! |
617 | 1307 |
|
7563 | 1308 |
browseAllSelect:aBlock |
1309 |
"{ Pragma: +optSpace }" |
|
1310 |
||
1311 |
"startup a browser for all methods for which aBlock returns true" |
|
617 | 1312 |
|
22241 | 1313 |
SystemBrowser default browseAllSelect:aBlock |
617 | 1314 |
|
1315 |
" |
|
1316 |
Smalltalk browseAllSelect:[:m | m literals isNil] |
|
1317 |
" |
|
22241 | 1318 |
|
1319 |
"Modified: / 01-09-2017 / 14:21:34 / cg" |
|
617 | 1320 |
! |
1321 |
||
7563 | 1322 |
browseChanges |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1323 |
"{ Pragma: +optSpace }" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1324 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1325 |
"startup a changes browser" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1326 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1327 |
ChangesBrowser notNil ifTrue:[ |
18668 | 1328 |
ChangesBrowser open |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1329 |
] ifFalse:[ |
18668 | 1330 |
self warn:'no ChangesBrowser built in' |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1331 |
] |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1332 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1333 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1334 |
Smalltalk browseChanges |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1335 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1336 |
! |
453 | 1337 |
|
7563 | 1338 |
browseClass:aClass |
1339 |
"{ Pragma: +optSpace }" |
|
1340 |
||
11375 | 1341 |
"startup a browser on aClass. |
11150 | 1342 |
The broser will only show that class (i.e. be a singleClass-browser). |
1343 |
See browseInClass: for a full browser, which has aClass selected initially." |
|
6970 | 1344 |
|
22241 | 1345 |
SystemBrowser default browseClass:aClass |
6970 | 1346 |
|
1347 |
" |
|
10071 | 1348 |
Smalltalk browseClass:Array |
6970 | 1349 |
" |
22241 | 1350 |
|
1351 |
"Modified: / 01-09-2017 / 14:21:37 / cg" |
|
6970 | 1352 |
! |
1353 |
||
7563 | 1354 |
browseImplementorsMatching:aSelectorSymbolOrMatchPattern |
1355 |
"{ Pragma: +optSpace }" |
|
6819 | 1356 |
|
1357 |
"startup a browser for all methods implementing a message matching" |
|
1358 |
||
22241 | 1359 |
SystemBrowser default browseImplementorsMatching:aSelectorSymbolOrMatchPattern |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1360 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1361 |
" |
10071 | 1362 |
Smalltalk browseImplementorsOf:#'at:put:' |
1363 |
Smalltalk browseImplementorsMatching:#'at:*' |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1364 |
" |
22241 | 1365 |
|
1366 |
"Modified: / 01-09-2017 / 14:21:39 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1367 |
! |
6819 | 1368 |
|
7563 | 1369 |
browseImplementorsOf:aSelectorSymbol |
1370 |
"{ Pragma: +optSpace }" |
|
1371 |
||
1372 |
"startup a browser for all methods implementing a particular message" |
|
453 | 1373 |
|
22241 | 1374 |
SystemBrowser default browseImplementorsOf:aSelectorSymbol |
453 | 1375 |
|
1376 |
" |
|
10071 | 1377 |
Smalltalk browseImplementorsOf:#at:put: |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1378 |
" |
22241 | 1379 |
|
1380 |
"Modified: / 01-09-2017 / 14:21:42 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1381 |
! |
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 |
browseInClass:aClass |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1384 |
"{ Pragma: +optSpace }" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1385 |
|
11150 | 1386 |
"startup a full browser showing aClass. |
20207 | 1387 |
The browser will be a full browser with aClass initially selected. |
11150 | 1388 |
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
|
1389 |
|
22241 | 1390 |
SystemBrowser default openInClass:aClass |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1391 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1392 |
" |
10071 | 1393 |
Smalltalk browseInClass:Array |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1394 |
" |
22241 | 1395 |
|
1396 |
"Modified: / 01-09-2017 / 14:21:46 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1397 |
! |
6970 | 1398 |
|
7563 | 1399 |
browseInClass:aClass selector:selector |
1400 |
"{ Pragma: +optSpace }" |
|
1401 |
||
11150 | 1402 |
"startup a full browser showing aClass>>selector. |
20207 | 1403 |
The browser will be a full browser with aClass initially selected. |
11150 | 1404 |
See browseClass: for a singleClass browser, which shows only a single class." |
6970 | 1405 |
|
22241 | 1406 |
SystemBrowser default openInClass:aClass selector:selector |
6970 | 1407 |
|
1408 |
" |
|
1409 |
Smalltalk browseInClass:Array selector:#at: |
|
1410 |
" |
|
22241 | 1411 |
|
1412 |
"Modified: / 01-09-2017 / 14:21:49 / cg" |
|
453 | 1413 |
! ! |
1414 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1415 |
!Smalltalk class methodsFor:'class management'! |
453 | 1416 |
|
18732 | 1417 |
basicRemoveClass:aClass |
1418 |
"remove the argument, aClass from the smalltalk dictionary; |
|
1419 |
we have to flush the caches since these methods are now void. |
|
1420 |
Also, class variables of aClass are removed." |
|
1421 |
||
1422 |
|sym cSym names oldName oldNameSym actualName wrongName| |
|
1423 |
||
1424 |
aClass isNil ifTrue:[^ self]. |
|
1425 |
||
1426 |
oldName := aClass name. |
|
1427 |
sym := oldNameSym := oldName asSymbol. |
|
1428 |
((self at:oldNameSym) == aClass) ifFalse:[ |
|
22791 | 1429 |
"check other name ..." |
1430 |
(self includes:aClass) ifFalse:[ |
|
1431 |
'Smalltalk [warning]: no such class: ' errorPrint. oldName errorPrintCR. |
|
1432 |
^ self |
|
1433 |
]. |
|
1434 |
" |
|
1435 |
the class has changed its name - without telling me ... |
|
1436 |
what should be done in this case ? |
|
1437 |
" |
|
1438 |
'Smalltalk [warning]: class ' errorPrint. oldName errorPrint. |
|
1439 |
' has changed its name' errorPrintCR. |
|
1440 |
||
1441 |
"/ |
|
1442 |
"/ might be an alias (i.e. removing a compatibility name) |
|
1443 |
"/ |
|
1444 |
actualName := self keyAtValue:aClass. |
|
1445 |
('Smalltalk [info]: ' , oldName , ' is actually stored as ' , actualName , '.') infoPrintCR. |
|
1446 |
sym := actualName asSymbol. |
|
1447 |
oldName := actualName asString. |
|
1448 |
wrongName := true. |
|
18732 | 1449 |
]. |
1450 |
||
1451 |
self at:sym put:nil. "nil it out for compiled accesses" |
|
1452 |
||
1453 |
"/ |
|
20811 | 1454 |
"/ see comment in removeKey: on why we don't remove it here |
18732 | 1455 |
"/ |
1456 |
"/ self removeKey:sym. "/ remove key - this actually fails, if there are |
|
22791 | 1457 |
"/ still compiled code references." |
18732 | 1458 |
|
1459 |
"remove private classes" |
|
1460 |
||
1461 |
aClass privateClassesSorted do:[:somePrivateClass | |
|
22791 | 1462 |
aClass privateClassesAt:(somePrivateClass nameWithoutPrefix) asSymbol put:nil. |
18732 | 1463 |
]. |
1464 |
||
1465 |
"remove class variables" |
|
1466 |
||
1467 |
names := aClass classVariableString asCollectionOfWords. |
|
1468 |
names do:[:name | |
|
22791 | 1469 |
cSym := aClass globalKeyForClassVar:name. |
1470 |
self at:cSym asSymbol put:nil. |
|
1471 |
||
1472 |
"/ |
|
1473 |
"/ see comment in removeKey: on why we dont remove it here |
|
1474 |
"/ |
|
1475 |
"/ self removeKey:cSym |
|
18732 | 1476 |
]. |
1477 |
||
1478 |
||
1479 |
"/ actually could get along with less flushing |
|
1480 |
"/ (entries for aClass and subclasses only) |
|
1481 |
"/ but we have to delay this, until we have the set of subclasses |
|
1482 |
"/ at hand - for now, searching for all subclasses is way more |
|
1483 |
"/ expensive then cache flushing. |
|
1484 |
"/ |
|
1485 |
"/ aClass allSubclassesDo:[:aSubclass | |
|
1486 |
"/ ObjectMemory flushInlineCachesForClass:aSubclass. |
|
1487 |
"/ ObjectMemory flushMethodCacheFor:aSubclass |
|
1488 |
"/ ]. |
|
1489 |
"/ ObjectMemory flushInlineCachesForClass:aClass. |
|
1490 |
"/ ObjectMemory flushMethodCacheFor:aClass |
|
1491 |
||
1492 |
ObjectMemory flushInlineCaches. |
|
1493 |
ObjectMemory flushMethodCache. |
|
1494 |
||
1495 |
aClass addChangeRecordForClassRemove. |
|
1496 |
self changed:#classRemove with:aClass. |
|
1497 |
||
1498 |
aClass setCategory:#'* removed *'. |
|
1499 |
||
1500 |
"/ self flushCachedClasses. |
|
1501 |
"/ Class flushSubclassInfo. |
|
1502 |
self flushCachedClass:aClass. |
|
1503 |
Class flushSubclassInfoFor:aClass superclass. |
|
1504 |
Class flushSubclassInfoFor:aClass. |
|
1505 |
||
1506 |
wrongName == true ifTrue:[ |
|
22791 | 1507 |
"/ |
1508 |
"/ an alias (i.e. removing a compatibility name) |
|
1509 |
"/ |
|
1510 |
"/ check if there are more refs to it ... |
|
1511 |
[self includes:aClass] whileTrue:[ |
|
1512 |
actualName := self keyAtValue:aClass. |
|
1513 |
('Smalltalk [info]: ' , aClass name , ' is also registered under the name ' , actualName |
|
1514 |
, ' - remove that binding too.') infoPrintCR. |
|
1515 |
self at:actualName put:nil. |
|
1516 |
]. |
|
18732 | 1517 |
]. |
1518 |
||
1519 |
"Modified: / 18-11-2006 / 17:16:31 / cg" |
|
1520 |
! |
|
1521 |
||
7563 | 1522 |
changeCategoryOf:aClass to:newCategory |
1523 |
"change a classes category, add a change record, |
|
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1524 |
send change notifications" |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1525 |
|
8405 | 1526 |
|ns oldCategory| |
1527 |
||
1528 |
oldCategory := aClass category. |
|
1529 |
oldCategory ~= newCategory ifTrue:[ |
|
18668 | 1530 |
aClass category:(newCategory withoutSeparators asSymbol). |
1531 |
||
1532 |
"notify change of category" |
|
1533 |
ns := aClass environment ? self. |
|
1534 |
ns changed:#organization with:(aClass -> oldCategory). |
|
1535 |
ns ~~ self ifTrue:[ |
|
1536 |
self changed:#organization with:(aClass -> oldCategory). |
|
1537 |
] |
|
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1538 |
]. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1539 |
|
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1540 |
" |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1541 |
Smalltalk changeCategoryOf:NewApplication to:#myApplications |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1542 |
" |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1543 |
|
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1544 |
"Modified: / 11.2.2000 / 11:36:27 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1545 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1546 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1547 |
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
|
1548 |
NameSpace name:name |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1549 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1550 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1551 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1552 |
flushCachedClass:aClass |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1553 |
CachedClasses notNil ifTrue:[ |
18668 | 1554 |
CachedClasses remove:aClass ifAbsent:[]. |
12700 | 1555 |
]. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1556 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1557 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1558 |
flushCachedClasses |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1559 |
CachedClasses := nil. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1560 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1561 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1562 |
Smalltalk flushCachedClasses |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1563 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1564 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1565 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1566 |
removeClass:aClass |
7563 | 1567 |
"remove the argument, aClass from the smalltalk dictionary; |
453 | 1568 |
we have to flush the caches since these methods are now void. |
18732 | 1569 |
Also, class variables of aClass are removed. |
1570 |
Recompile accessors to aClass." |
|
1571 |
||
1572 |
|oldNameSym ns ons| |
|
1573 |
||
1574 |
oldNameSym := aClass name asSymbol. |
|
4781 | 1575 |
ns := aClass nameSpace. |
1576 |
aClass topOwningClass notNil ifTrue:[ |
|
22791 | 1577 |
ons := aClass topOwningClass nameSpace |
18732 | 1578 |
]. |
1579 |
||
1580 |
self basicRemoveClass:aClass. |
|
4724
44793fe70787
recompile ns classes after a class remove
Claus Gittinger <cg@exept.de>
parents:
4723
diff
changeset
|
1581 |
|
4781 | 1582 |
ns ~~ Smalltalk ifTrue:[ |
22791 | 1583 |
ons notNil ifTrue:[ |
1584 |
ClassBuilder |
|
1585 |
recompileGlobalAccessorsTo:oldNameSym |
|
1586 |
in:ons |
|
1587 |
except:nil |
|
1588 |
]. |
|
1589 |
(ns notNil and:[ns ~~ ons]) ifTrue:[ |
|
1590 |
ClassBuilder |
|
1591 |
recompileGlobalAccessorsTo:oldNameSym |
|
1592 |
in:ns |
|
1593 |
except:nil |
|
1594 |
]. |
|
18732 | 1595 |
]. |
1596 |
! |
|
1597 |
||
1598 |
removeClasses:aCollectionOfClasses |
|
1599 |
"remove aCollectionOfClasses from the smalltalk dictionary; |
|
1600 |
we have to flush the caches since these methods are now void. |
|
1601 |
Also, class variables of aClass are removed. |
|
1602 |
Recompile accessors to the classes - after all classes in the collection have been removed." |
|
1603 |
||
1604 |
|tuples| |
|
1605 |
||
1606 |
tuples := aCollectionOfClasses collect:[:eachClass| |
|
22791 | 1607 |
Array |
1608 |
with:eachClass name asSymbol |
|
1609 |
with:eachClass nameSpace |
|
1610 |
with:( |
|
1611 |
eachClass topOwningClass notNil ifTrue:[ |
|
1612 |
eachClass topOwningClass nameSpace |
|
1613 |
] ifFalse:[nil]) |
|
1614 |
]. |
|
18732 | 1615 |
|
1616 |
aCollectionOfClasses do:[:eachClass| |
|
22791 | 1617 |
self basicRemoveClass:eachClass. |
18732 | 1618 |
]. |
1619 |
||
1620 |
tuples do:[:eachClssymNsOnsTuple| |
|
22791 | 1621 |
|oldNameSym ns ons| |
1622 |
||
1623 |
oldNameSym := eachClssymNsOnsTuple at:1. |
|
1624 |
ns := eachClssymNsOnsTuple at:2. |
|
1625 |
ons := eachClssymNsOnsTuple at:3. |
|
1626 |
||
1627 |
ns ~~ Smalltalk ifTrue:[ |
|
1628 |
ons notNil ifTrue:[ |
|
1629 |
ClassBuilder |
|
1630 |
recompileGlobalAccessorsTo:oldNameSym |
|
1631 |
in:ons |
|
1632 |
except:nil |
|
1633 |
]. |
|
1634 |
(ns notNil and:[ns ~~ ons]) ifTrue:[ |
|
1635 |
ClassBuilder |
|
1636 |
recompileGlobalAccessorsTo:oldNameSym |
|
1637 |
in:ns |
|
1638 |
except:nil |
|
1639 |
]. |
|
1640 |
] |
|
18732 | 1641 |
]. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1642 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1643 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1644 |
renameClass:aClass to:newName |
7563 | 1645 |
"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
|
1646 |
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
|
1647 |
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
|
1648 |
|
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1649 |
|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
|
1650 |
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
|
1651 |
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
|
1652 |
oldMetaclass newMetaclass newCategory| |
5610
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1653 |
|
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1654 |
"/ check for all intermediate namespaces / owning classes |
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1655 |
i1 := 1. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1656 |
i2 := 1. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1657 |
ns := self. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1658 |
[i2 ~~ 0] whileTrue:[ |
22791 | 1659 |
i2 := newName indexOfSubCollection:'::' startingAt:i1. |
1660 |
i2 ~~ 0 ifTrue:[ |
|
1661 |
nm := newName copyFrom:i1 to:i2-1. |
|
1662 |
ns isNameSpace ifTrue:[ |
|
1663 |
subns := ns at:nm asSymbol ifAbsent:nil. |
|
1664 |
subns isNil ifTrue:[ |
|
1665 |
self error:'Nonexisting namespace: ',nm. |
|
1666 |
^ nil. |
|
1667 |
]. |
|
1668 |
] ifFalse:[ |
|
1669 |
subns := ns privateClassesAt:nm asSymbol. |
|
1670 |
subns isNil ifTrue:[ |
|
1671 |
self error:'Cannot create a namespace below a class' |
|
1672 |
] |
|
1673 |
]. |
|
1674 |
ns := subns. |
|
1675 |
i1 := i2 + 2. |
|
1676 |
]. |
|
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1677 |
]. |
617 | 1678 |
|
1679 |
oldName := aClass name. |
|
6734 | 1680 |
oldNameSpace := aClass topNameSpace. |
2319
640bb389f90a
recompile when moving classes across namespaces
Claus Gittinger <cg@exept.de>
parents:
2317
diff
changeset
|
1681 |
oldBaseName := aClass nameWithoutNameSpacePrefix. |
3698
8bce45214d24
fixed renaming of a private class (must recompile owner)
Claus Gittinger <cg@exept.de>
parents:
3678
diff
changeset
|
1682 |
oldBaseNameWithoutPrefix := aClass nameWithoutPrefix. |
617 | 1683 |
oldSym := oldName asSymbol. |
2485
9f4a11a4521f
new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents:
2476
diff
changeset
|
1684 |
privateClasses := aClass privateClassesSorted. |
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1685 |
|
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1686 |
((self at:oldSym) ~~ aClass) ifTrue:[ |
22791 | 1687 |
'Smalltalk [warning]: rename failed - name is different from key' errorPrintCR. |
1688 |
^ self |
|
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1689 |
]. |
617 | 1690 |
|
1525
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1691 |
"/ rename the class |
617 | 1692 |
|
1847
6e567214b167
care for className being a symbol, when renaming classes
Claus Gittinger <cg@exept.de>
parents:
1758
diff
changeset
|
1693 |
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
|
1694 |
|
5610
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1695 |
"/ change the owning class |
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1696 |
ns isNameSpace ifFalse:[ |
22791 | 1697 |
aClass isPrivate ifTrue:[ |
1698 |
aClass class setOwningClass:ns. |
|
1699 |
] ifFalse:[ |
|
1700 |
"/ sigh - must make a PrivateMetaclass from Metaclass |
|
1701 |
oldMetaclass := aClass class. |
|
1702 |
newMetaclass := PrivateMetaclass new. |
|
1703 |
newMetaclass flags:(oldMetaclass flags). |
|
1704 |
newMetaclass setSuperclass:(oldMetaclass superclass). |
|
1705 |
newMetaclass instSize:(oldMetaclass instSize). |
|
1706 |
newMetaclass setInstanceVariableString:(oldMetaclass instanceVariableString). |
|
1707 |
newMetaclass setMethodDictionary:(oldMetaclass methodDictionary). |
|
1708 |
newMetaclass setSoleInstance:aClass. |
|
1709 |
newMetaclass setOwningClass:ns. |
|
1710 |
||
1711 |
aClass changeClassTo:newMetaclass. |
|
1712 |
ObjectMemory flushCaches. |
|
1713 |
] |
|
5610
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1714 |
] ifTrue:[ |
22791 | 1715 |
aClass isPrivate ifTrue:[ |
1716 |
newCategory := aClass topOwningClass category. |
|
1717 |
||
1718 |
"/ sigh - must make a Metaclass from PrivateMetaclass |
|
1719 |
oldMetaclass := aClass class. |
|
1720 |
||
1721 |
newMetaclass := Metaclass new. |
|
1722 |
newMetaclass flags:(oldMetaclass flags). |
|
1723 |
newMetaclass setSuperclass:(oldMetaclass superclass). |
|
1724 |
newMetaclass instSize:(oldMetaclass instSize). |
|
1725 |
newMetaclass setInstanceVariableString:(oldMetaclass instanceVariableString). |
|
1726 |
newMetaclass setMethodDictionary:(oldMetaclass methodDictionary). |
|
1727 |
newMetaclass setSoleInstance:aClass. |
|
1728 |
||
1729 |
aClass category:newCategory. |
|
1730 |
aClass changeClassTo:newMetaclass. |
|
1731 |
ObjectMemory flushCaches. |
|
1732 |
] |
|
5610
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1733 |
]. |
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1734 |
|
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1735 |
aClass setName:newSym. |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1736 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1737 |
"/ store it in Smalltalk |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1738 |
self at:oldSym put:nil. |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1739 |
|
878
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1740 |
"/ |
20811 | 1741 |
"/ 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
|
1742 |
"/ |
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1743 |
"/ self removeKey:oldSym. |
617 | 1744 |
self at:newSym put:aClass. |
1745 |
||
1525
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1746 |
"/ 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
|
1747 |
|
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1748 |
oldNameToNewName := IdentityDictionary new. |
617 | 1749 |
|
1750 |
names := aClass classVariableString asCollectionOfWords. |
|
1751 |
names do:[:name | |
|
22791 | 1752 |
oldCVSym := (oldSym , ':' , name) asSymbol. |
1753 |
value := self at:oldCVSym. |
|
1754 |
self at:oldCVSym put:nil. |
|
1755 |
||
1756 |
"/ |
|
1757 |
"/ see comment in #removeKey: on why we dont remove it it here |
|
1758 |
"/ |
|
1759 |
"/ self removeKey:cSym. |
|
1760 |
||
1761 |
newCVSym := (newSym , ':' , name) asSymbol. |
|
1762 |
self at:newCVSym put:value. |
|
1763 |
||
1764 |
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
|
1765 |
]. |
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1766 |
|
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1767 |
"/ 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
|
1768 |
|
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1769 |
oldNameToNewName keysAndValuesDo:[:oldNameSym :newNameSym | |
22791 | 1770 |
aClass withAllSubclasses do:[:aSubClass | |
1771 |
Transcript showCR:'changing global accesses from ''' , oldNameSym , ''' into ''' , newNameSym , ''' in class: ''' , aSubClass name , ''' ...'. |
|
1772 |
aSubClass instAndClassSelectorsAndMethodsDo:[:sel :aMethod | |
|
1773 |
aMethod changeLiteral:oldNameSym to:newNameSym |
|
1774 |
]. |
|
1775 |
]. |
|
1776 |
||
1777 |
"/ and also in privateClasses ? ... |
|
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1778 |
|
2485
9f4a11a4521f
new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents:
2476
diff
changeset
|
1779 |
"/ privateClasses size > 0 ifTrue:[ |
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1780 |
"/ privateClasses do:[:aPrivateClass | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1781 |
"/ aPrivateClass withAllSubclasses do:[:aSubClass | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1782 |
"/ aSubClass class methodDictionary do:[:aMethod | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1783 |
"/ aMethod changeLiteral:oldNameSym to:newNameSym |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1784 |
"/ ]. |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1785 |
"/ aSubClass methodDictionary do:[:aMethod | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1786 |
"/ aMethod changeLiteral:oldNameSym to:newNameSym |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1787 |
"/ ] |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1788 |
"/ ]. |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1789 |
"/ ] |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1790 |
"/ ] |
617 | 1791 |
]. |
1792 |
||
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1793 |
aClass addChangeRecordForClassRename:oldSym to:newSym. |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1794 |
|
5333
d80386e06d21
rename into other namespace did not work
Claus Gittinger <cg@exept.de>
parents:
5328
diff
changeset
|
1795 |
"/ 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
|
1796 |
aClass setEnvironment:nil. |
6734 | 1797 |
newNameSpace := aClass topNameSpace. |
2405
939f4e751ef3
dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents:
2379
diff
changeset
|
1798 |
|
2485
9f4a11a4521f
new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents:
2476
diff
changeset
|
1799 |
privateClasses size > 0 ifTrue:[ |
22791 | 1800 |
"/ must rename privateClasses as well |
1801 |
Class withoutUpdatingChangesDo:[ |
|
1802 |
privateClasses do:[:aPrivateClass | |
|
1803 |
self renameClass:aPrivateClass |
|
1804 |
to:(newSym , '::' , aPrivateClass nameWithoutPrefix). |
|
1805 |
||
1806 |
Transcript showCR:'recompiling methods in ''' , newNameSpace name , ''' accessing ''' , oldName , '::' , aPrivateClass nameWithoutPrefix , ''' ...'. |
|
1807 |
aClass theNonMetaclass recompileMethodsAccessingGlobal:(oldName , '::' , aPrivateClass nameWithoutPrefix) asSymbol. |
|
1808 |
aClass theMetaclass recompileMethodsAccessingGlobal:(oldName , '::' , aPrivateClass nameWithoutPrefix) asSymbol. |
|
1809 |
aClass theNonMetaclass recompileMethodsAccessingGlobal:(aPrivateClass nameWithoutPrefix) asSymbol. |
|
1810 |
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
|
1811 |
"/ ClassBuilder |
10071 | 1812 |
"/ recompileGlobalAccessorsTo:(oldName , '::' , aPrivateClass nameWithoutPrefix) asSymbol |
1813 |
"/ in:newNameSpace |
|
9822
38acd1c5eeab
recompile methods which access private classes when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
9819
diff
changeset
|
1814 |
"/ except:nil. |
22791 | 1815 |
] |
1816 |
] |
|
2405
939f4e751ef3
dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents:
2379
diff
changeset
|
1817 |
]. |
939f4e751ef3
dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents:
2379
diff
changeset
|
1818 |
|
2319
640bb389f90a
recompile when moving classes across namespaces
Claus Gittinger <cg@exept.de>
parents:
2317
diff
changeset
|
1819 |
oldNameSpace ~~ newNameSpace ifTrue:[ |
5246
2ca7b20c4108
create namespaces as requried, when renaming a class
Claus Gittinger <cg@exept.de>
parents:
5214
diff
changeset
|
1820 |
|
22791 | 1821 |
"/ all those referencing the class from the old nameSpace |
1822 |
"/ must be recompiled ... |
|
1823 |
"/ (to now access the global from smalltalk) |
|
1824 |
||
1825 |
oldNameSpace ~~ Smalltalk ifTrue:[ |
|
1826 |
Transcript showCR:'recompiling methods in ''' , oldNameSpace name , ''' accessing ''' , oldName , ''' ...'. |
|
1827 |
||
1828 |
ClassBuilder |
|
1829 |
recompileGlobalAccessorsTo:oldName asSymbol |
|
1830 |
in:oldNameSpace |
|
1831 |
except:nil. |
|
1832 |
]. |
|
1833 |
||
1834 |
"/ all referencing the class in the new namespace |
|
1835 |
"/ as well; to now access the new class. |
|
1836 |
||
1837 |
(newNameSpace notNil and:[newNameSpace ~~ Smalltalk]) ifTrue:[ |
|
1838 |
Transcript showCR:'recompiling methods in ''' , newNameSpace name , ''' accessing ''' , oldBaseName , ''' ...'. |
|
1839 |
||
1840 |
ClassBuilder |
|
1841 |
recompileGlobalAccessorsTo:oldBaseName asSymbol |
|
1842 |
in:newNameSpace |
|
1843 |
except:nil. |
|
1844 |
]. |
|
3698
8bce45214d24
fixed renaming of a private class (must recompile owner)
Claus Gittinger <cg@exept.de>
parents:
3678
diff
changeset
|
1845 |
] ifFalse:[ |
22791 | 1846 |
"/ all references to a global with my new name in my owning class |
1847 |
"/ must now be redirected to myself. |
|
1848 |
||
1849 |
aClass isPrivate ifTrue:[ |
|
1850 |
newBaseName := aClass nameWithoutNameSpacePrefix. |
|
1851 |
newBaseNameWithoutPrefix := aClass nameWithoutPrefix. |
|
1852 |
||
1853 |
Transcript showCR:'recompiling methods accessing ''' , oldBaseNameWithoutPrefix , ''' in: ''' , aClass owningClass name , ''' ...'. |
|
1854 |
aClass owningClass recompileMethodsAccessingGlobal:oldBaseNameWithoutPrefix. |
|
1855 |
aClass owningClass class recompileMethodsAccessingGlobal:oldBaseNameWithoutPrefix. |
|
1856 |
||
1857 |
Transcript showCR:'recompiling methods accessing ''' , oldBaseName , ''' in: ''' , aClass owningClass name , ''' ...'. |
|
1858 |
aClass owningClass recompileMethodsAccessingGlobal:oldBaseName. |
|
1859 |
aClass owningClass class recompileMethodsAccessingGlobal:oldBaseName. |
|
1860 |
||
1861 |
Transcript showCR:'recompiling methods accessing ''' , newBaseNameWithoutPrefix , ''' in: ''' , aClass owningClass name , ''' ...'. |
|
1862 |
aClass owningClass recompileMethodsAccessingGlobal:newBaseNameWithoutPrefix. |
|
1863 |
aClass owningClass class recompileMethodsAccessingGlobal:newBaseNameWithoutPrefix. |
|
1864 |
||
1865 |
Transcript showCR:'recompiling methods accessing ''' , newBaseName , ''' in: ''' , aClass owningClass name , ''' ...'. |
|
1866 |
aClass owningClass recompileMethodsAccessingGlobal:newBaseName. |
|
1867 |
aClass owningClass class recompileMethodsAccessingGlobal:newBaseName. |
|
1868 |
] |
|
4040
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1869 |
]. |
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1870 |
|
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1871 |
aClass changed:#definition. |
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1872 |
"/ 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
|
1873 |
aClass allSubclassesDo:[:subClass | |
22791 | 1874 |
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
|
1875 |
]. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1876 |
"/ 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
|
1877 |
aClass subclassesDo:[:subClass | |
22791 | 1878 |
subClass addChangeRecordForClass:subClass. |
4040
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1879 |
]. |
5613
b534e427f028
change message when renaming a class
Claus Gittinger <cg@exept.de>
parents:
5611
diff
changeset
|
1880 |
self changed:#definition. |
14611 | 1881 |
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
|
1882 |
|
9822
38acd1c5eeab
recompile methods which access private classes when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
9819
diff
changeset
|
1883 |
"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
|
1884 |
"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
|
1885 |
"Modified: / 05-09-2006 / 12:52:25 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1886 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1887 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1888 |
!Smalltalk class methodsFor:'copying'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1889 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1890 |
deepCopy |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1891 |
"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
|
1892 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1893 |
^ self |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1894 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1895 |
"Modified: 18.5.1996 / 12:13:33 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1896 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1897 |
|
10952 | 1898 |
deepCopyUsing:aDictionary postCopySelector:postCopySelector |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1899 |
"return a deep copy of the receiver. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1900 |
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
|
1901 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1902 |
^ self |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1903 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1904 |
"Modified: 18.5.1996 / 12:13:36 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1905 |
! |
453 | 1906 |
|
7563 | 1907 |
shallowCopy |
1908 |
"redefined to return self - there is only one Smalltalk dictionary" |
|
617 | 1909 |
|
1910 |
^ self |
|
1410 | 1911 |
|
1912 |
"Modified: 18.5.1996 / 12:13:39 / cg" |
|
617 | 1913 |
! |
1914 |
||
7563 | 1915 |
simpleDeepCopy |
1916 |
"redefined to return self - there is only one Smalltalk dictionary" |
|
453 | 1917 |
|
1918 |
^ self |
|
1410 | 1919 |
|
1920 |
"Modified: 18.5.1996 / 12:13:42 / cg" |
|
453 | 1921 |
! ! |
1922 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1923 |
!Smalltalk class methodsFor:'debugging ST/X'! |
453 | 1924 |
|
7563 | 1925 |
compileTrace:aBoolean |
1926 |
"dump generated inline code (NOOP if VM was compiled without the trace-debug option)" |
|
7325 | 1927 |
%{ |
1928 |
extern char __compileTrace__; |
|
1929 |
||
1930 |
__compileTrace__ = (aBoolean == true) ? 1 : 0; |
|
1931 |
%} |
|
1932 |
" |
|
1933 |
Smalltalk compileTrace:true |
|
1934 |
Smalltalk compileTrace:false |
|
1935 |
" |
|
1936 |
! |
|
1937 |
||
7563 | 1938 |
debugBreakPoint |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1939 |
"{ Pragma: +optSpace }" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1940 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1941 |
"call the dummy debug function, on which a breakpoint |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1942 |
can be put in adb, sdb, dbx or gdb. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1943 |
WARNING: this method is for debugging only |
18668 | 1944 |
it will be removed without notice." |
453 | 1945 |
%{ |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1946 |
__PATCHUPCONTEXTS(__context); |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1947 |
__debugBreakPoint__(); |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1948 |
%}. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1949 |
^ self |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1950 |
! |
453 | 1951 |
|
7563 | 1952 |
exitWithCoreDump |
1953 |
"{ Pragma: +optSpace }" |
|
1954 |
||
20755 | 1955 |
"abort the program and dump core" |
7563 | 1956 |
|
1957 |
OperatingSystem exitWithCoreDump |
|
4096
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1958 |
"/ never returns |
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1959 |
|
20755 | 1960 |
"Be careful evaluating this: |
4096
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1961 |
Smalltalk exitWithCoreDump |
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1962 |
" |
617 | 1963 |
! |
1964 |
||
7563 | 1965 |
fatalAbort |
1966 |
"{ Pragma: +optSpace }" |
|
1967 |
||
1968 |
"report a fatal-error, print a stack backtrace and exit with core dump. |
|
617 | 1969 |
(You may turn off the stack print with debugPrinting:false)" |
18287 | 1970 |
|
1971 |
self fatalAbort:'fatalAbort' |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1972 |
! |
617 | 1973 |
|
7563 | 1974 |
fatalAbort:aMessage |
1975 |
"{ Pragma: +optSpace }" |
|
1976 |
||
1977 |
"report a fatal-error; print a stack backtrace and exit with core dump |
|
617 | 1978 |
(You may turn off the stack print with debugPrinting:false)" |
1979 |
||
1980 |
%{ |
|
18287 | 1981 |
#ifdef __SCHTEAM__ |
1982 |
STMain.fatalAbort( aMessage ); |
|
1983 |
/* NOT REACHED */ |
|
1984 |
#else |
|
617 | 1985 |
char *msg; |
1986 |
||
12481
805176d238d2
change __isString() to __isStringLike() in primitive code
Stefan Vogel <sv@exept.de>
parents:
12413
diff
changeset
|
1987 |
if (__isStringLike(aMessage)) |
18668 | 1988 |
msg = (char *) __stringVal(aMessage); |
617 | 1989 |
else |
18668 | 1990 |
msg = "fatalAbort"; |
617 | 1991 |
|
1992 |
__fatal0(__context, msg); |
|
1993 |
/* NEVER RETURNS */ |
|
18287 | 1994 |
#endif |
5410 | 1995 |
%}. |
1996 |
^ self primitiveFailed |
|
5441 | 1997 |
! |
1998 |
||
13135
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1999 |
ignoreHalt |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2000 |
"return true, if halts are ignored. |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2001 |
Usually, this is done in standAlone applications" |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2002 |
|
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2003 |
IgnoreHalt isNil ifTrue:[ |
18668 | 2004 |
^ self isStandAloneApp |
13135
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2005 |
]. |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2006 |
^ IgnoreHalt |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2007 |
|
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2008 |
"Created: / 18-11-2010 / 11:20:16 / cg" |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2009 |
! |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2010 |
|
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2011 |
ignoreHalt:aBoolean |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2012 |
"control if halts are to be ignored; |
13135
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2013 |
usually, this is done in standAlone applications" |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2014 |
|
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2015 |
IgnoreHalt := aBoolean |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2016 |
|
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2017 |
" |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2018 |
Smalltalk ignoreHalt:true. |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2019 |
self halt. |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2020 |
Smalltalk ignoreHalt:false. |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2021 |
self halt. |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2022 |
" |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2023 |
|
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
2024 |
"Created: / 18-11-2010 / 11:20:27 / cg" |
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 |
|
18329 | 2027 |
verbose |
2028 |
^ Verbose |
|
2029 |
! |
|
2030 |
||
2031 |
verbose:aBoolean |
|
2032 |
Verbose := aBoolean |
|
2033 |
! |
|
2034 |
||
7563 | 2035 |
vmInstructionTrace:aBoolean |
13947 | 2036 |
self halt:'not yet implemented' |
2037 |
||
2038 |
"Modified: / 19-01-2012 / 10:15:35 / cg" |
|
7563 | 2039 |
! ! |
2040 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2041 |
!Smalltalk class methodsFor:'enumerating'! |
7563 | 2042 |
|
453 | 2043 |
allBehaviorsDo:aBlock |
5580
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
2044 |
"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
|
2045 |
|
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
2046 |
self allClassesAndMetaclassesDo:aBlock |
453 | 2047 |
|
2048 |
" |
|
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
2049 |
Smalltalk allBehaviorsDo:[:aClass | aClass name printCR] |
453 | 2050 |
" |
7563 | 2051 |
! |
2052 |
||
2053 |
allClassCategories |
|
2054 |
"return a set of all class categories in the system" |
|
2055 |
||
2056 |
|allCategories| |
|
6217
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2057 |
|
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2058 |
allCategories := Set new. |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2059 |
Smalltalk allClassesDo:[:cls | |
18668 | 2060 |
|category| |
2061 |
||
2062 |
category := cls category. |
|
2063 |
category notNil ifTrue:[ |
|
2064 |
allCategories add:category. |
|
2065 |
]. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2066 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2067 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2068 |
^ allCategories. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2069 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2070 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2071 |
Smalltalk allClassCategories |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2072 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2073 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2074 |
"Created: / 17.11.2001 / 12:13:09 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2075 |
! |
6217
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2076 |
|
7563 | 2077 |
allClassesAndMetaclassesDo:aBlock |
2078 |
"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
|
2079 |
|
21108 | 2080 |
|already numClassesHintTimes2| |
2081 |
||
2082 |
numClassesHintTimes2 := NumberOfClassesHint*2. |
|
2083 |
already := IdentitySet new:numClassesHintTimes2. |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2084 |
self allClassesDo:[:eachClass | |
22791 | 2085 |
|theNonMeta theMeta| |
2086 |
||
2087 |
theNonMeta := eachClass theNonMetaclass. |
|
2088 |
(already includes:theNonMeta) ifFalse:[ |
|
2089 |
aBlock value:theNonMeta. |
|
2090 |
already add:theNonMeta. |
|
2091 |
]. |
|
2092 |
theMeta := theNonMeta class. |
|
2093 |
(already includes:theMeta) ifFalse:[ |
|
2094 |
aBlock value:theMeta. |
|
2095 |
already add:theMeta. |
|
2096 |
]. |
|
2097 |
already size > numClassesHintTimes2 ifTrue:[ |
|
2098 |
NumberOfClassesHint := (already size // 2) + 10 |
|
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 |
! |
5579
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
2102 |
|
7563 | 2103 |
allClassesDo:aBlock |
21489 | 2104 |
"evaluate the argument, aBlock for all classes in the system. |
2105 |
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
|
2106 |
|
5765 | 2107 |
self allClasses do:aBlock |
453 | 2108 |
|
2109 |
" |
|
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
2110 |
Smalltalk allClassesDo:[:aClass | aClass name printCR] |
453 | 2111 |
" |
21489 | 2112 |
|
2113 |
"Modified (comment): / 19-02-2017 / 12:38:17 / cg" |
|
453 | 2114 |
! |
2115 |
||
9506 | 2116 |
allClassesForWhich:filter |
10071 | 2117 |
"return a collection with all classes in the system, |
21489 | 2118 |
for which filter evaluates to true. |
2119 |
Enumerates non-meta classes only - not metaclasses" |
|
9506 | 2120 |
|
2121 |
|collectedClasses| |
|
2122 |
||
2123 |
collectedClasses := OrderedCollection new. |
|
2124 |
self allClassesForWhich:filter do:[:cls | |
|
22791 | 2125 |
collectedClasses add:cls |
9506 | 2126 |
]. |
2127 |
^ collectedClasses |
|
2128 |
||
2129 |
" |
|
10071 | 2130 |
Smalltalk |
22791 | 2131 |
allClassesForWhich:[:cls | cls name startsWith:'Po'] |
9506 | 2132 |
" |
2133 |
||
2134 |
"Created: / 10-08-2006 / 12:11:31 / cg" |
|
21489 | 2135 |
"Modified (comment): / 19-02-2017 / 12:37:49 / cg" |
9506 | 2136 |
! |
2137 |
||
9292 | 2138 |
allClassesForWhich:filter do:aBlock |
21489 | 2139 |
"evaluate the argument, aBlock for all classes in the system, for which filter evaluates to true. |
2140 |
Enumerates non-meta classes only - not metaclasses" |
|
9292 | 2141 |
|
2142 |
self allClassesDo:[:cls | |
|
22791 | 2143 |
(filter value:cls) ifTrue:[ aBlock value:cls ]. |
10071 | 2144 |
]. |
2145 |
||
2146 |
" |
|
2147 |
Smalltalk |
|
22791 | 2148 |
allClassesForWhich:[:cls | cls name startsWith:'Po'] |
2149 |
do:[:aClass | Transcript showCR:aClass name] |
|
21489 | 2150 |
" |
2151 |
||
2152 |
"Modified (comment): / 19-02-2017 / 12:37:59 / cg" |
|
9292 | 2153 |
! |
2154 |
||
7563 | 2155 |
allClassesInCategory:aCategory |
2156 |
"return a collection of for all classes in aCategory; |
|
1299 | 2157 |
The order of the classes is not defined." |
2158 |
||
9506 | 2159 |
^ self allClassesForWhich:[:cls | cls category = aCategory] |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2160 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2161 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2162 |
Smalltalk allClassesInCategory:'Views-Basic' |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2163 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2164 |
|
9506 | 2165 |
"Modified: / 10-08-2006 / 12:13:32 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2166 |
! |
1299 | 2167 |
|
7563 | 2168 |
allClassesInCategory:aCategory do:aBlock |
2169 |
"evaluate the argument, aBlock for all classes in the aCategory; |
|
453 | 2170 |
The order of the classes is not defined." |
2171 |
||
2172 |
aCategory notNil ifTrue:[ |
|
18668 | 2173 |
self allClassesForWhich:[:cls | cls category = aCategory] do:aBlock |
453 | 2174 |
] |
2175 |
||
2176 |
" |
|
9490 | 2177 |
Smalltalk allClassesInCategory:'Views-Basic' do:[:aClass | Transcript showCR:aClass] |
2178 |
" |
|
2179 |
||
2180 |
"Modified: / 09-08-2006 / 17:18:50 / fm" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2181 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2182 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2183 |
allClassesInCategory:aCategory inOrderDo:aBlock |
7563 | 2184 |
"evaluate the argument, aBlock for all classes in aCategory; |
453 | 2185 |
superclasses come first - then subclasses" |
2186 |
||
2187 |
|classes| |
|
2188 |
||
2189 |
aCategory notNil ifTrue:[ |
|
18668 | 2190 |
classes := OrderedCollection new. |
2191 |
self allClassesInCategory:aCategory do:[:aClass | |
|
2192 |
classes add:aClass |
|
2193 |
]. |
|
2194 |
classes topologicalSort:[:a :b | b isSubclassOf:a]. |
|
2195 |
classes do:aBlock |
|
453 | 2196 |
] |
2197 |
||
2198 |
" |
|
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
2199 |
Smalltalk allClassesInCategory:'Views-Basic' inOrderDo:[:aClass | aClass name printCR] |
453 | 2200 |
" |
6217
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2201 |
|
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2202 |
"Modified: / 17.11.2001 / 12:18:15 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2203 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2204 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2205 |
allClassesInOrderDo:aBlock |
7563 | 2206 |
"evaluate the argument, aBlock for all classes in the system; |
5406 | 2207 |
Evaluation order is by inheritance: superclasses come first." |
2208 |
||
2209 |
|already| |
|
2210 |
||
8964
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
2211 |
already := IdentitySet new:NumberOfClassesHint. |
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
2212 |
self allClassesDo:[:eachClass | |
18668 | 2213 |
(already includes:eachClass) ifFalse:[ |
2214 |
eachClass allSuperclasses reverseDo:[:eachSuperClass | |
|
2215 |
(already includes:eachSuperClass) ifFalse:[ |
|
2216 |
already add:eachSuperClass. |
|
2217 |
aBlock value:eachSuperClass. |
|
2218 |
]. |
|
2219 |
]. |
|
2220 |
already add:eachClass. |
|
2221 |
aBlock value:eachClass. |
|
2222 |
] |
|
8964
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
2223 |
]. |
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
2224 |
|
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
2225 |
" |
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
2226 |
Smalltalk allClassesInOrderDo:[:aClass | Transcript showCR:aClass name] |
5406 | 2227 |
" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2228 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2229 |
|
9506 | 2230 |
allClassesInPackage:aPackageID |
2231 |
"evaluate the argument, aBlock for all classes a package; |
|
10087 | 2232 |
The order of the classes is not defined. |
2233 |
The returned collection may include private classes" |
|
9506 | 2234 |
|
2235 |
^ self allClassesForWhich:[:cls | cls package = aPackageID] |
|
2236 |
||
2237 |
" |
|
10071 | 2238 |
Smalltalk allClassesInPackage:'bosch:dapasx' |
9506 | 2239 |
" |
2240 |
||
2241 |
"Created: / 10-08-2006 / 12:14:10 / cg" |
|
10087 | 2242 |
"Modified: / 12-10-2006 / 23:48:43 / cg" |
9506 | 2243 |
! |
2244 |
||
9490 | 2245 |
allClassesInPackage:aPackageID do:aBlock |
2246 |
"evaluate the argument, aBlock for all classes a package; |
|
2247 |
The order of the classes is not defined." |
|
2248 |
||
2249 |
^ self allClassesForWhich:[:cls | cls package = aPackageID] do:aBlock |
|
2250 |
||
2251 |
" |
|
10071 | 2252 |
Smalltalk allClassesInPackage:'bosch:dapasx' do:[:aClass | Transcript showCR:aClass] |
9490 | 2253 |
" |
2254 |
||
2255 |
"Created: / 09-08-2006 / 17:14:17 / fm" |
|
2256 |
! |
|
2257 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2258 |
allKeysDo:aBlock |
20988 | 2259 |
<resource: #obsolete> |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2260 |
"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
|
2261 |
|
21265 | 2262 |
self obsoleteMethodWarning:'please use #keysDo:'. |
17385 | 2263 |
self keysDo:aBlock |
21265 | 2264 |
|
2265 |
"Modified: / 20-01-2017 / 17:52:40 / stefan" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2266 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2267 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2268 |
allMethodCategories |
12298 | 2269 |
"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
|
2270 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2271 |
|allCategories| |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2272 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2273 |
allCategories := Set new. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2274 |
Smalltalk allClassesDo:[:cls | |
22791 | 2275 |
allCategories addAll:cls methodCategories. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2276 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2277 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2278 |
^ allCategories. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2279 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2280 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2281 |
Smalltalk allMethodCategories |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2282 |
" |
21980 | 2283 |
|
2284 |
"Modified: / 05-07-2017 / 10:51:50 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2285 |
! |
6722
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
2286 |
|
9259 | 2287 |
allMethodsDo:aBlock |
12298 | 2288 |
"enumerate all methods in all classes" |
12000 | 2289 |
|
9259 | 2290 |
Smalltalk allClassesDo:[:eachClass | |
18668 | 2291 |
eachClass instAndClassSelectorsAndMethodsDo:[:sel :mthd | |
2292 |
aBlock value:mthd |
|
2293 |
] |
|
12298 | 2294 |
]. |
2295 |
! |
|
2296 |
||
14933 | 2297 |
allMethodsForWhich:aBlock |
2298 |
"return a collection of methods for which aBlock returns true" |
|
2299 |
||
2300 |
|coll| |
|
2301 |
||
2302 |
coll := OrderedCollection new. |
|
22015 | 2303 |
self allMethodsForWhich:aBlock do:[:mthd | coll add:mthd]. |
2304 |
^ coll |
|
2305 |
||
2306 |
" |
|
2307 |
Smalltalk allMethodsForWhich:[:m | m isObsolete]. |
|
2308 |
||
2309 |
Smalltalk allMethodsForWhich:#isObsolete. |
|
2310 |
" |
|
2311 |
||
2312 |
"Modified (comment): / 14-07-2017 / 10:52:54 / cg" |
|
2313 |
! |
|
2314 |
||
2315 |
allMethodsForWhich:aCheckBlock do:actionBlock |
|
2316 |
"enumerate methods for which aCheckBlock returns true" |
|
2317 |
||
14933 | 2318 |
Smalltalk allClassesDo:[:eachClass | |
22791 | 2319 |
eachClass instAndClassSelectorsAndMethodsDo:[:sel :mthd | |
2320 |
(aCheckBlock value:mthd) ifTrue:[ |
|
2321 |
actionBlock value:mthd |
|
2322 |
]. |
|
2323 |
] |
|
22015 | 2324 |
]. |
2325 |
||
2326 |
" |
|
2327 |
Smalltalk allMethodsForWhich:[:m | m isObsolete] do:[:m | Transcript showCR:m]. |
|
2328 |
||
2329 |
Smalltalk allMethodsForWhich:#isObsolete do:[:m | Transcript showCR:m]. |
|
2330 |
" |
|
2331 |
||
2332 |
"Created: / 14-07-2017 / 10:51:53 / cg" |
|
14933 | 2333 |
! |
2334 |
||
12300
e72e90ea410f
changed: #allMethodsWithSelectorDo:
Claus Gittinger <cg@exept.de>
parents:
12299
diff
changeset
|
2335 |
allMethodsWithSelectorDo:aTwoArgBlock |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2336 |
"enumerate all methods in all classes and evaluate aBlock |
12300
e72e90ea410f
changed: #allMethodsWithSelectorDo:
Claus Gittinger <cg@exept.de>
parents:
12299
diff
changeset
|
2337 |
with method and selector as arguments." |
12299
3ed13f5685b9
added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents:
12298
diff
changeset
|
2338 |
|
3ed13f5685b9
added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents:
12298
diff
changeset
|
2339 |
Smalltalk allClassesDo:[:eachClass | |
18668 | 2340 |
eachClass instAndClassSelectorsAndMethodsDo:[:sel :mthd | |
2341 |
aTwoArgBlock value:mthd value:sel |
|
2342 |
] |
|
12299
3ed13f5685b9
added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents:
12298
diff
changeset
|
2343 |
]. |
3ed13f5685b9
added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents:
12298
diff
changeset
|
2344 |
! |
3ed13f5685b9
added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents:
12298
diff
changeset
|
2345 |
|
7563 | 2346 |
associationsDo:aBlock |
10071 | 2347 |
"evaluate the argument, aBlock for all key/value pairs |
617 | 2348 |
in the Smalltalk dictionary" |
2349 |
||
2350 |
self keysDo:[:aKey | |
|
18668 | 2351 |
aBlock value:(aKey -> (self at:aKey)) |
617 | 2352 |
] |
2353 |
||
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
2354 |
"Smalltalk associationsDo:[:assoc | assoc printCR]" |
617 | 2355 |
! |
2356 |
||
7563 | 2357 |
basicKeys |
2358 |
"for rel > 5 only" |
|
2359 |
||
18349 | 2360 |
%{ |
2361 |
#ifdef __SCHTEAM__ |
|
18668 | 2362 |
STObject[] keys = STSmalltalkEnvironment.GetKeyVector(); |
18349 | 2363 |
return __c__._RETURN( new STVector(keys) ); |
2364 |
#endif |
|
2365 |
%}. |
|
7563 | 2366 |
self primitiveFailed |
2367 |
! |
|
2368 |
||
2369 |
do:aBlock |
|
2370 |
"evaluate the argument, aBlock for all values in the Smalltalk dictionary" |
|
617 | 2371 |
|
2372 |
|work| |
|
2373 |
||
2374 |
%{ /* 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
|
2375 |
__GLOBALS_DO(&aBlock, &work); |
5406 | 2376 |
RETURN (self); |
2377 |
%}. |
|
2378 |
self keysDo:[:aKey | |
|
18668 | 2379 |
aBlock value:(self at:aKey) |
5406 | 2380 |
] |
617 | 2381 |
! |
2382 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2383 |
keysAndValuesDo:aBlock |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2384 |
"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
|
2385 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2386 |
self keysDo:[:aKey | |
18668 | 2387 |
aBlock value:aKey value:(self at:aKey) |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2388 |
] |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2389 |
! |
617 | 2390 |
|
9077
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2391 |
keysAndValuesSelect:selectBlockWith2Args thenCollect:collectBlockWith2Args |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2392 |
|collected| |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2393 |
|
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2394 |
collected := OrderedCollection new. |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2395 |
self keysAndValuesDo:[:eachKey :eachValue | |
18668 | 2396 |
(selectBlockWith2Args value:eachKey value:eachValue) ifTrue:[ |
2397 |
collected add:(collectBlockWith2Args value:eachKey value:eachValue) |
|
2398 |
]. |
|
9077
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2399 |
]. |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2400 |
^ collected |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2401 |
|
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2402 |
" |
10071 | 2403 |
Smalltalk |
18668 | 2404 |
keysAndValuesSelect:[:nm :val | (nm startsWith:'Ab') and:[val notNil]] |
2405 |
thenCollect:[:nm :val | nm] |
|
9077
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2406 |
" |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2407 |
! |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2408 |
|
7563 | 2409 |
keysDo:aBlock |
2410 |
"evaluate the argument, aBlock for all keys in the Smalltalk dictionary" |
|
617 | 2411 |
|work| |
2412 |
||
2413 |
%{ /* 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
|
2414 |
__GLOBALKEYS_DO(&aBlock, &work); |
5406 | 2415 |
RETURN (self); |
2416 |
%}. |
|
2417 |
self basicKeys do:[:aKey | |
|
18668 | 2418 |
aBlock value:aKey |
5406 | 2419 |
] |
453 | 2420 |
! ! |
2421 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2422 |
!Smalltalk class methodsFor:'message control'! |
453 | 2423 |
|
7563 | 2424 |
silentLoading |
12408 | 2425 |
"returns the Silentloading class variable, which globally controls if compilation |
2426 |
messages are shown on the transcript during a fileIn." |
|
7563 | 2427 |
|
10355
b1cb807fd03c
Make sure, that #silentLoading does not return nil
Stefan Vogel <sv@exept.de>
parents:
10329
diff
changeset
|
2428 |
^ SilentLoading ? false |
7563 | 2429 |
! |
2430 |
||
2431 |
silentLoading:aBoolean |
|
2432 |
"{ Pragma: +optSpace }" |
|
2433 |
||
2434 |
"allows access to the Silentloading class variable, which controls |
|
12408 | 2435 |
messages (especially during fileIn) onto the transcript. |
453 | 2436 |
You can save a snapshot with this flag set to true, which makes |
2437 |
the image come up silent. Can also be set, to read in files unlogged." |
|
2438 |
||
2439 |
|prev| |
|
2440 |
||
2441 |
prev := SilentLoading. |
|
2442 |
SilentLoading := aBoolean. |
|
2443 |
^ prev |
|
12409 | 2444 |
! |
2445 |
||
2446 |
silentlyLoadingDo:aBlock |
|
2447 |
"evaluates aBlock with silent loading on - no compilation messages (except errors) |
|
2448 |
are shown on the transcript" |
|
2449 |
||
2450 |
|sav| |
|
2451 |
||
20719 | 2452 |
Smalltalk verbose ifTrue:[ |
22791 | 2453 |
^ aBlock value. |
2454 |
]. |
|
2455 |
||
12409 | 2456 |
sav := SilentLoading. |
2457 |
SilentLoading := true. |
|
22691 | 2458 |
^ aBlock ensure:[ SilentLoading := sav ]. |
2459 |
||
2460 |
"Modified: / 23-04-2018 / 16:56:40 / stefan" |
|
453 | 2461 |
! ! |
2462 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2463 |
!Smalltalk class methodsFor:'misc accessing'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2464 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2465 |
beHeadless:aBoolean |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2466 |
"set/clear the headlessOperation flag." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2467 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2468 |
HeadlessOperation := aBoolean |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2469 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2470 |
|
10231 | 2471 |
beSTScript:aBoolean |
2472 |
"set/clear the isSTScript flag." |
|
2473 |
||
2474 |
IsSTScript := aBoolean |
|
2475 |
||
2476 |
"Created: / 06-12-2006 / 16:43:36 / cg" |
|
2477 |
! |
|
2478 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2479 |
standAloneApp:aBoolean |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2480 |
"set/clear the StandAlone flag." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2481 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2482 |
StandAlone := aBoolean |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2483 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2484 |
|
18197 | 2485 |
|
12250 | 2486 |
!Smalltalk class methodsFor:'private-system management-packages'! |
2487 |
||
17324 | 2488 |
basicLoadPackage:aPackageString fromDirectory:packageDirOrStringOrNil asAutoloaded:doLoadAsAutoloaded |
2489 |
"load a package referenced by aPackageString - a string like 'stx:libbasic'. |
|
2490 |
The package is either located in packageDirOrStringOrNil, or in the current directory (if nil). |
|
2491 |
Answer true, if the load succeeded, false if it failed" |
|
2492 |
||
22791 | 2493 |
|packageDirOrNil binaryClassLibraryFilename projectDefinitionFilename |
19589 | 2494 |
projectDefinitionClass projectDefinitionClassName silent somethingHasBeenLoaded |
2495 |
loadOK errorInInitialize| |
|
17324 | 2496 |
|
2497 |
packageDirOrStringOrNil notNil ifTrue:[ |
|
22791 | 2498 |
packageDirOrNil := packageDirOrStringOrNil asFilename. |
2499 |
]. |
|
2500 |
silent := VerboseLoading not |
|
2501 |
and:[SilentLoading or:[StandAlone or:[InfoPrinting not]]]. |
|
17324 | 2502 |
|
2503 |
"For now: have to read the project definition first!! |
|
2504 |
The class library may contain subclasses of classes in prerequisite packages - |
|
19589 | 2505 |
so the prerequisite packages have to be loaded first. |
2506 |
Normally there is a project definiton, use that one to pull in the rest" |
|
17324 | 2507 |
|
2508 |
"maybe, it is already in the image" |
|
2509 |
projectDefinitionClass := ProjectDefinition definitionClassForPackage:aPackageString. |
|
19906 | 2510 |
projectDefinitionClass notNil ifTrue:[ |
22791 | 2511 |
projectDefinitionClass checkForLoad. |
17324 | 2512 |
]. |
2513 |
||
2514 |
"Is there a shared library (.dll or .so) ?" |
|
17439
1928276a394c
added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents:
17438
diff
changeset
|
2515 |
binaryClassLibraryFilename := ObjectFileLoader |
22791 | 2516 |
binaryClassFilenameForPackage:aPackageString |
2517 |
inDirectory:packageDirOrNil. |
|
17324 | 2518 |
|
2519 |
(binaryClassLibraryFilename notNil and:[binaryClassLibraryFilename exists]) ifTrue:[ |
|
22791 | 2520 |
|loadErrorOccurred| |
2521 |
||
2522 |
loadErrorOccurred := false. |
|
2523 |
ObjectFileLoader objectFileLoadErrorNotification handle:[:ex | |
|
2524 |
loadErrorOccurred := true. |
|
2525 |
ex proceedWith:true. |
|
2526 |
] do:[ |
|
2527 |
loadOK := (ObjectFileLoader loadObjectFile:binaryClassLibraryFilename) notNil. |
|
2528 |
"/ loadOK := self loadPackage:aPackageString fromClassLibrary:binaryClassLibraryFilename. |
|
2529 |
]. |
|
2530 |
(loadOK and:[loadErrorOccurred not]) ifTrue:[ |
|
2531 |
"now, all compiled classes have been loaded. |
|
2532 |
keep classes in the package which are autoloaded as autoloaded." |
|
2533 |
^ true |
|
2534 |
]. |
|
2535 |
||
2536 |
loadErrorOccurred ifTrue:[ |
|
2537 |
self breakPoint:#cg. |
|
2538 |
projectDefinitionClass := ProjectDefinition definitionClassForPackage:aPackageString. |
|
2539 |
projectDefinitionClass notNil ifTrue:[ |
|
2540 |
projectDefinitionClass |
|
2541 |
checkForLoad; |
|
2542 |
loadPreRequisitesAsAutoloaded:doLoadAsAutoloaded. |
|
2543 |
]. |
|
2544 |
]. |
|
17324 | 2545 |
]. |
2546 |
packageDirOrNil isNil ifTrue:[ |
|
22791 | 2547 |
^ PackageNotFoundError raiseRequestWith:aPackageString. |
17324 | 2548 |
]. |
2549 |
||
2550 |
"fallback - go through the project definition" |
|
2551 |
projectDefinitionClass isNil ifTrue:[ |
|
22791 | 2552 |
projectDefinitionClassName := ProjectDefinition projectDefinitionClassNameForDefinitionOf:aPackageString. |
2553 |
"/ try to load the project definition class |
|
2554 |
projectDefinitionFilename := (packageDirOrNil / projectDefinitionClassName) withSuffix:'st'. |
|
2555 |
projectDefinitionFilename exists ifFalse:[ |
|
2556 |
projectDefinitionFilename := (packageDirOrNil / 'source' / projectDefinitionClassName) withSuffix:'st'. |
|
2557 |
]. |
|
2558 |
projectDefinitionFilename exists ifTrue:[ |
|
2559 |
Class withoutUpdatingChangesDo:[ |
|
2560 |
Smalltalk silentlyLoadingDo:[ |
|
2561 |
Error handle:[:ex | |
|
2562 |
"/ catch error during initialization; |
|
2563 |
ex suspendedContext withAllSendersDo:[:sender | |
|
2564 |
(sender selector == #initialize |
|
2565 |
and:[sender receiver isBehavior |
|
2566 |
and:[sender receiver name = projectDefinitionClassName]] |
|
2567 |
) ifTrue:[ |
|
2568 |
errorInInitialize := true |
|
2569 |
]. |
|
2570 |
]. |
|
2571 |
errorInInitialize ifFalse:[ ex reject ]. |
|
2572 |
] do:[ |
|
2573 |
projectDefinitionFilename fileIn. |
|
2574 |
]. |
|
2575 |
]. |
|
2576 |
]. |
|
2577 |
errorInInitialize ifTrue:[ |
|
2578 |
Transcript showCR:'Smalltalk [warning]: an error happened in #initialize - retry after loading package.'. |
|
2579 |
]. |
|
2580 |
projectDefinitionClass := ProjectDefinition definitionClassForPackage:aPackageString. |
|
2581 |
]. |
|
17324 | 2582 |
]. |
2583 |
projectDefinitionClass notNil ifTrue:[ |
|
22791 | 2584 |
projectDefinitionClass |
2585 |
autoload; |
|
2586 |
checkForLoad; |
|
2587 |
loadPreRequisitesAsAutoloaded:doLoadAsAutoloaded. |
|
2588 |
||
2589 |
somethingHasBeenLoaded := projectDefinitionClass loadAsAutoloaded:doLoadAsAutoloaded. |
|
2590 |
errorInInitialize ifTrue:[ |
|
2591 |
Transcript showCR:('Smalltalk [info]: retrying #initialize'). |
|
2592 |
projectDefinitionClass initialize. |
|
2593 |
]. |
|
2594 |
(silent not and:[somethingHasBeenLoaded]) ifTrue:[ |
|
2595 |
Transcript showCR:('Smalltalk [info]: loaded package: ' , aPackageString , ' from project definition'). |
|
2596 |
]. |
|
2597 |
^ true. |
|
17324 | 2598 |
]. |
2599 |
||
2600 |
"/ source files-file loading no longer supported |
|
2601 |
"/ however, allow for autoload-stub loaded |
|
2602 |
doLoadAsAutoloaded ifTrue:[ |
|
22791 | 2603 |
self |
2604 |
recursiveInstallAutoloadedClassesFrom:packageDirOrNil |
|
2605 |
rememberIn:Set new |
|
2606 |
maxLevels:2 |
|
2607 |
noAutoload:false |
|
2608 |
packageTop:packageDirOrNil |
|
2609 |
showSplashInLevels:0. |
|
2610 |
^ true |
|
17324 | 2611 |
]. |
2612 |
||
2613 |
^ PackageNotFoundError raiseRequestWith:aPackageString errorString:' - no projectDef, dll or loadAll found'. |
|
2614 |
||
2615 |
" |
|
2616 |
Smalltalk loadPackageWithId:'stx:libbasic' |
|
2617 |
Smalltalk loadPackageWithId:'stx:goodies/persistency' |
|
2618 |
Smalltalk loadPackageWithId:'exept:ctypes' |
|
2619 |
" |
|
2620 |
||
2621 |
"Modified: / 29-07-2011 / 19:55:35 / cg" |
|
2622 |
! |
|
2623 |
||
12250 | 2624 |
loadExtensionsForPackage:aPackageId |
13415 | 2625 |
| extensionsLoaded | |
13621
85297bc6cfa8
comment/format in: #loadExtensionsForPackage:
Claus Gittinger <cg@exept.de>
parents:
13602
diff
changeset
|
2626 |
|
13415 | 2627 |
extensionsLoaded := false. |
18924 | 2628 |
ProgrammingLanguage allDo:[:programmingLanguage| |
22791 | 2629 |
"/ evaluating or here - want all extensions to be loaded |
2630 |
extensionsLoaded := extensionsLoaded | (self loadExtensionsForPackage:aPackageId language: programmingLanguage) |
|
13621
85297bc6cfa8
comment/format in: #loadExtensionsForPackage:
Claus Gittinger <cg@exept.de>
parents:
13602
diff
changeset
|
2631 |
]. |
85297bc6cfa8
comment/format in: #loadExtensionsForPackage:
Claus Gittinger <cg@exept.de>
parents:
13602
diff
changeset
|
2632 |
^ extensionsLoaded |
13415 | 2633 |
|
2634 |
"Modified: / 18-02-2007 / 11:03:26 / cg" |
|
2635 |
"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
|
2636 |
"Modified (format): / 04-09-2011 / 09:19:24 / cg" |
13415 | 2637 |
! |
2638 |
||
18924 | 2639 |
loadExtensionsForPackage:aPackageId language: programmingLanguage |
13771 | 2640 |
|mgr packageDirName inStream projectDefinition extensionsFilename mod dir |
13621
85297bc6cfa8
comment/format in: #loadExtensionsForPackage:
Claus Gittinger <cg@exept.de>
parents:
13602
diff
changeset
|
2641 |
extensionsRevisionString extensionsRevisionInfo| |
12250 | 2642 |
|
18924 | 2643 |
programmingLanguage supportsExtensionMethods ifFalse:[^false]. |
13415 | 2644 |
|
12250 | 2645 |
packageDirName := aPackageId copyReplaceAll:$: with:$/. |
2646 |
packageDirName := self getPackageFileName:packageDirName. |
|
2647 |
||
2648 |
(packageDirName notNil and:[Class tryLocalSourceFirst]) ifTrue:[ |
|
22791 | 2649 |
(self loadExtensionsFromDirectory:packageDirName language: programmingLanguage) ifTrue:[ |
2650 |
^ true. |
|
2651 |
]. |
|
2652 |
packageDirName := nil. "do not try again" |
|
12250 | 2653 |
]. |
2654 |
||
2655 |
" |
|
2656 |
if there is a sourceCodeManager, ask it first for the extensions |
|
2657 |
" |
|
15958 | 2658 |
(Smalltalk at:#AbstractSourceCodeManager) notNil ifTrue:[ |
22791 | 2659 |
mgr := AbstractSourceCodeManager managerForPackage: aPackageId |
15958 | 2660 |
]. |
12250 | 2661 |
mgr notNil ifTrue:[ |
22791 | 2662 |
extensionsFilename := 'extensions.' , programmingLanguage sourceFileSuffix. |
2663 |
||
2664 |
projectDefinition := ProjectDefinition definitionClassForPackage:aPackageId. |
|
2665 |
projectDefinition notNil ifTrue:[ |
|
2666 |
mod := aPackageId asPackageId module. |
|
2667 |
dir := aPackageId asPackageId directory. |
|
2668 |
extensionsRevisionString := projectDefinition perform:(mgr nameOfVersionMethodForExtensions) ifNotUnderstood:nil. |
|
2669 |
extensionsRevisionString notNil ifTrue:[ |
|
2670 |
extensionsRevisionInfo := mgr revisionInfoFromString:extensionsRevisionString inClass:nil. |
|
2671 |
extensionsRevisionInfo notNil ifTrue:[ |
|
2672 |
extensionsRevisionInfo fileName = extensionsFilename ifFalse:[ |
|
2673 |
"JV@2011-10-23: following condition is never satisfied for |
|
2674 |
filed-in packages. The whole scheme of extensionVersion_XXX |
|
2675 |
works ONLY for compiled packages as it depends on fact, that |
|
2676 |
extension Init() routine is called AFTER all classes are inited, |
|
2677 |
therefore the extensionVersion_XXX methods from extensions.st |
|
2678 |
overwrites methods coming from package definition class. All this |
|
2679 |
is so tricky and error prone, that we have to come up with better |
|
2680 |
solution!!" |
|
2681 |
packageDirName notNil ifTrue:[ |
|
2682 |
^ self loadExtensionsFromDirectory:packageDirName language: programmingLanguage |
|
2683 |
] ifFalse:[ |
|
2684 |
^ false |
|
2685 |
] |
|
2686 |
] |
|
2687 |
] |
|
2688 |
]. |
|
2689 |
SourceCodeManagerError handle:[:ex | |
|
2690 |
] do:[ |
|
2691 |
inStream := mgr streamForExtensionFile:extensionsFilename package:aPackageId directory:dir module:mod cache:true. |
|
2692 |
]. |
|
2693 |
]. |
|
2694 |
inStream isNil ifTrue:[ |
|
2695 |
SourceCodeManagerError handle:[:ex | |
|
2696 |
] do:[ |
|
2697 |
inStream := mgr getMostRecentSourceStreamForFile:extensionsFilename inPackage:aPackageId. |
|
2698 |
]. |
|
2699 |
]. |
|
2700 |
inStream notNil ifTrue:[ |
|
2701 |
Class withoutUpdatingChangeSetDo:[ |
|
2702 |
inStream fileIn. |
|
2703 |
]. |
|
2704 |
inStream close. |
|
2705 |
VerboseLoading ifTrue:[ |
|
2706 |
Transcript showCR:('loaded extensions for ',aPackageId,' from repository'). |
|
2707 |
]. |
|
2708 |
^ true |
|
2709 |
] |
|
12250 | 2710 |
]. |
2711 |
||
2712 |
packageDirName notNil ifTrue:[ |
|
22791 | 2713 |
^ self loadExtensionsFromDirectory:packageDirName language: programmingLanguage |
12250 | 2714 |
]. |
2715 |
^ false |
|
2716 |
||
13415 | 2717 |
"Created: / 02-01-2010 / 10:41:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2718 |
"Modified: / 19-03-2011 / 10:03:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13814 | 2719 |
"Modified: / 04-11-2011 / 13:41:29 / cg" |
15958 | 2720 |
"Modified: / 23-10-2011 / 19:35:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
12250 | 2721 |
! |
2722 |
||
2723 |
loadExtensionsFromDirectory:packageDirOrString |
|
13415 | 2724 |
| extensionsLoaded | |
18924 | 2725 |
|
13415 | 2726 |
extensionsLoaded := false. |
18924 | 2727 |
ProgrammingLanguage allDo:[:programmingLanguage| |
22791 | 2728 |
"/ evaluating or here - want all extensions to be loaded |
2729 |
extensionsLoaded := extensionsLoaded | (self loadExtensionsFromDirectory: packageDirOrString language: programmingLanguage) |
|
18924 | 2730 |
]. |
2731 |
^ extensionsLoaded |
|
13415 | 2732 |
|
2733 |
"Modified: / 02-01-2010 / 10:40:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2734 |
! |
|
2735 |
||
2736 |
loadExtensionsFromDirectory:packageDirOrString language: language |
|
12250 | 2737 |
|packageDir f| |
2738 |
||
2739 |
packageDir := packageDirOrString asFilename. |
|
2740 |
||
13415 | 2741 |
f := packageDir / ('extensions.' , language sourceFileSuffix). |
12250 | 2742 |
f exists ifTrue:[ |
18668 | 2743 |
Class withoutUpdatingChangeSetDo:[ |
2744 |
f fileIn. |
|
2745 |
]. |
|
2746 |
VerboseLoading ifTrue:[ |
|
2747 |
Transcript showCR:('loaded extensions: ' , f pathName). |
|
2748 |
]. |
|
2749 |
^ true |
|
15958 | 2750 |
]. |
2751 |
^ true"/false |
|
13415 | 2752 |
|
2753 |
"Created: / 02-01-2010 / 10:38:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13814 | 2754 |
"Modified: / 04-11-2011 / 13:41:19 / cg" |
15958 | 2755 |
"Modified: / 31-01-2013 / 11:33:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
12250 | 2756 |
! |
2757 |
||
14589 | 2758 |
loadPackage:aPackageStringArg asAutoloaded:doLoadAsAutoloaded |
12782 | 2759 |
"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
|
2760 |
Return true on success, false otherwise." |
12782 | 2761 |
|
14589 | 2762 |
|packageId packageString packageDir def sourceCodeManager| |
2763 |
||
17588 | 2764 |
packageString := aPackageStringArg. |
2765 |
||
2766 |
"/ a little convenience: so you can stx packages with loadPackage:'goodies/soap' |
|
2767 |
(packageString includes:$:) ifFalse:[ |
|
22791 | 2768 |
packageString := 'stx:',packageString. |
17588 | 2769 |
]. |
12782 | 2770 |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2771 |
"if I am here, so must my package" |
14892 | 2772 |
packageString = self package ifTrue:[^ true]. |
13129
0ac3f6a28aaf
changed: #loadPackage:asAutoloaded:
Claus Gittinger <cg@exept.de>
parents:
13120
diff
changeset
|
2773 |
|
17588 | 2774 |
packageId := aPackageStringArg asPackageId. |
2775 |
||
12782 | 2776 |
"/ if there is a projectDefinition, let it load itself... |
14589 | 2777 |
def := packageId projectDefinitionClass. |
14833 | 2778 |
(def notNil and:[def isLoaded]) ifTrue:[ |
22791 | 2779 |
def loadAsAutoloaded:doLoadAsAutoloaded. |
2780 |
^ true. |
|
14589 | 2781 |
]. |
2782 |
||
2783 |
packageDir := self packageDirectoryForPackageId:packageId. |
|
16144 | 2784 |
|
2785 |
[ |
|
22791 | 2786 |
self |
2787 |
loadPackage:packageString |
|
2788 |
fromDirectory:packageDir |
|
2789 |
asAutoloaded:doLoadAsAutoloaded. |
|
16144 | 2790 |
] on:PackageLoadError do:[:ex| |
22791 | 2791 |
ex creator ~~ PackageNotCompatibleError ifTrue:[ |
2792 |
AbstractSourceCodeManager notNil ifTrue:[ |
|
2793 |
sourceCodeManager := AbstractSourceCodeManager sourceCodeManagerForPackage:packageString. |
|
2794 |
sourceCodeManager notNil ifTrue:[ |
|
2795 |
PackageLoadError handle:[:ex2 | |
|
2796 |
ex reject |
|
2797 |
] do:[ |
|
2798 |
^ sourceCodeManager loadPackageWithId:packageString fromRepositoryAsAutoloaded:doLoadAsAutoloaded |
|
2799 |
]. |
|
2800 |
]. |
|
2801 |
]. |
|
2802 |
]. |
|
2803 |
ex reject. |
|
16144 | 2804 |
]. |
2805 |
||
2806 |
^ true |
|
12782 | 2807 |
|
2808 |
" |
|
2809 |
Smalltalk loadPackageWithId:'stx:libbasic' |
|
2810 |
Smalltalk loadPackageWithId:'stx:goodies/persistency' |
|
2811 |
Smalltalk loadPackageWithId:'exept:ctypes' |
|
2812 |
" |
|
2813 |
||
13129
0ac3f6a28aaf
changed: #loadPackage:asAutoloaded:
Claus Gittinger <cg@exept.de>
parents:
13120
diff
changeset
|
2814 |
"Modified: / 16-11-2010 / 17:42:49 / cg" |
12782 | 2815 |
! |
2816 |
||
12250 | 2817 |
loadPackage:packageId fromAllSourceFilesInDirectory:aDirectory |
2818 |
"load all source files found in aDirectory and treat them like |
|
2819 |
a package. Allows for initial import of alien ST-code as a new package. |
|
2820 |
Experimental." |
|
2821 |
||
2822 |
|p t new anyFail repeatCount| |
|
2823 |
||
2824 |
"/ problem: dependencies. |
|
2825 |
"/ solution: repeat twice, so that superclasses are present the second time |
|
2826 |
||
2827 |
Class packageQuerySignal answer:packageId asSymbol do:[ |
|
18668 | 2828 |
|any| |
2829 |
||
2830 |
repeatCount := 0. |
|
2831 |
[ |
|
2832 |
repeatCount := repeatCount + 1. |
|
2833 |
anyFail := false. |
|
2834 |
aDirectory directoryContents do:[:file | |
|
2835 |
|fn| |
|
2836 |
||
2837 |
fn := aDirectory / file. |
|
2838 |
(fn hasSuffix:'st') ifTrue:[ |
|
2839 |
Metaclass confirmationQuerySignal answer:false |
|
2840 |
do:[ |
|
2841 |
Error |
|
2842 |
handle:[:ex | |
|
2843 |
anyFail := true |
|
2844 |
] |
|
2845 |
do:[ |
|
2846 |
(self fileIn:fn) ifFalse:[ |
|
2847 |
anyFail := true |
|
2848 |
] ifTrue:[ |
|
2849 |
any := true. |
|
2850 |
] |
|
2851 |
] |
|
2852 |
] |
|
2853 |
] |
|
2854 |
]. |
|
2855 |
any ifFalse:[ |
|
2856 |
^ false "/ no file found |
|
2857 |
] |
|
2858 |
] doWhile:[anyFail and:[repeatCount<2]]. |
|
12250 | 2859 |
]. |
2860 |
||
2861 |
new := (p := Project projectWithId:packageId) isNil. |
|
2862 |
new ifTrue:[ p := Project new]. |
|
2863 |
||
2864 |
p name:packageId. |
|
2865 |
p directory:aDirectory. |
|
2866 |
p package:packageId. |
|
2867 |
t := packageId asCollectionOfSubstringsSeparatedByAny:'/\:'. |
|
2868 |
p repositoryModule:(t first). |
|
2869 |
p repositoryDirectory:(packageId copyFrom:t first size + 2). |
|
2870 |
p isLoaded:true. |
|
2871 |
||
2872 |
new ifTrue:[Project addLoadedProject:p]. |
|
16144 | 2873 |
anyFail ifTrue:[ |
18668 | 2874 |
^ PackageLoadError raiseRequestWith:packageId. |
16144 | 2875 |
]. |
2876 |
^ true |
|
12250 | 2877 |
! |
2878 |
||
2879 |
loadPackage:packageId fromClassLibrary:aFilename |
|
2880 |
"load a package from a compiled classLib. |
|
2881 |
Experimental." |
|
2882 |
||
2883 |
|p t new| |
|
2884 |
||
2885 |
(self fileIn:aFilename) ifFalse:[ |
|
18668 | 2886 |
(self fileInClassLibrary:aFilename) ifFalse:[ |
2887 |
^ false. |
|
2888 |
] |
|
12250 | 2889 |
]. |
2890 |
||
2891 |
new := (p := Project projectWithId:packageId) isNil. |
|
2892 |
new ifTrue:[ p := Project new]. |
|
2893 |
||
2894 |
p name:packageId. |
|
2895 |
p directory:aFilename directory. |
|
2896 |
p package:packageId. |
|
2897 |
t := packageId asCollectionOfSubstringsSeparatedByAny:'/\:'. |
|
2898 |
p repositoryModule:(t first). |
|
2899 |
p repositoryDirectory:(packageId copyFrom:t first size + 2). |
|
2900 |
p isLoaded:true. |
|
2901 |
||
2902 |
new ifTrue:[Project addLoadedProject:p]. |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2903 |
|
12250 | 2904 |
^ true |
2905 |
! |
|
2906 |
||
12782 | 2907 |
loadPackage:aPackageString fromDirectory:packageDirOrStringOrNil asAutoloaded:doLoadAsAutoloaded |
2908 |
"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
|
2909 |
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
|
2910 |
Answer true, if the load succeeded, false if it failed" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2911 |
|
17324 | 2912 |
|ret| |
2913 |
||
17439
1928276a394c
added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents:
17438
diff
changeset
|
2914 |
PackageLoadInProgressQuery |
18668 | 2915 |
answerNotifyLoading:aPackageString asSymbol |
2916 |
do:[ |
|
2917 |
ret := self basicLoadPackage:aPackageString fromDirectory:packageDirOrStringOrNil asAutoloaded:doLoadAsAutoloaded |
|
2918 |
]. |
|
17324 | 2919 |
^ ret |
17350 | 2920 |
|
2921 |
" |
|
2922 |
Smalltalk loadPackage:'stx:goodies/communication' |
|
2923 |
" |
|
12782 | 2924 |
! |
2925 |
||
12250 | 2926 |
loadPackage:packageId fromLoadAllFile:aFilename |
12782 | 2927 |
<resource: #obsolete> |
12250 | 2928 |
"load a package from a loadAll - loader script. |
2929 |
Experimental." |
|
2930 |
||
2931 |
|p t new| |
|
2932 |
||
2933 |
Metaclass confirmationQuerySignal answer:false |
|
2934 |
do:[ |
|
18668 | 2935 |
(self fileIn:aFilename) ifFalse:[ |
2936 |
self warn:'Failed to load the package ', packageId printString. |
|
2937 |
^ false. |
|
2938 |
] |
|
12250 | 2939 |
]. |
2940 |
||
2941 |
new := (p := Project projectWithId:packageId) isNil. |
|
2942 |
new ifTrue:[ p := Project new]. |
|
2943 |
||
2944 |
p name:packageId. |
|
2945 |
p directory:aFilename directory. |
|
2946 |
p package:packageId. |
|
2947 |
t := packageId asCollectionOfSubstringsSeparatedByAny:'/\:'. |
|
2948 |
p repositoryModule:(t first). |
|
2949 |
p repositoryDirectory:(packageId copyFrom:t first size + 2). |
|
2950 |
p isLoaded:true. |
|
2951 |
||
2952 |
new ifTrue:[Project addLoadedProject:p]. |
|
2953 |
^ true |
|
2954 |
! |
|
2955 |
||
2956 |
loadPackage:aPackageId fromZIPArchive:f asAutoloaded:doLoadAsAutoloaded |
|
2957 |
"load a package from a .zip delivery file. |
|
2958 |
Experimental." |
|
2959 |
||
19906 | 2960 |
PackageLoadError |
22791 | 2961 |
raiseWith:aPackageId |
2962 |
errorString:' - package loading from zip is not yet implemented'. |
|
12250 | 2963 |
! |
2964 |
||
2965 |
loadPackageFromAbbrevFile:aPackageId asAutoloaded:doLoadAsAutoloaded |
|
12782 | 2966 |
<resource: #obsolete> |
12250 | 2967 |
|abbrevFile packageDir| |
2968 |
||
2969 |
packageDir := self packageDirectoryForPackageId:aPackageId. |
|
2970 |
packageDir isNil ifTrue:[^ false]. |
|
2971 |
||
2972 |
"/ abbrev.stc ? |
|
12377 | 2973 |
abbrevFile := packageDir / 'abbrev.stc'. |
12250 | 2974 |
abbrevFile exists ifFalse:[^ false]. |
2975 |
||
2976 |
Smalltalk installAutoloadedClassesFrom:abbrevFile pathName. |
|
2977 |
||
2978 |
doLoadAsAutoloaded ifFalse:[ |
|
18668 | 2979 |
"/ force autoloading... |
2980 |
Smalltalk allClassesInPackage:aPackageId do:[:eachClass | eachClass autoload]. |
|
12250 | 2981 |
]. |
2982 |
||
2983 |
self loadExtensionsFromDirectory:packageDir. |
|
13814 | 2984 |
VerboseLoading ifTrue:[ |
18668 | 2985 |
Transcript showCR:('Smalltalk [info]: loaded package: ' , aPackageId , ' from abbrev file: ' , abbrevFile pathName). |
12250 | 2986 |
]. |
2987 |
^ true |
|
2988 |
||
13814 | 2989 |
"Modified: / 04-11-2011 / 13:43:29 / cg" |
12250 | 2990 |
! ! |
2991 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2992 |
!Smalltalk class methodsFor:'queries'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2993 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2994 |
allClasses |
7563 | 2995 |
"return an unordered collection of all classes in the system. |
10071 | 2996 |
Only globally anchored classes are returned |
21489 | 2997 |
(i.e. anonymous ones have to be acquired by Behavior allSubInstances). |
2998 |
Enumerates non-meta classes only - not metaclasses" |
|
453 | 2999 |
|
3000 |
|classes| |
|
3001 |
||
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
3002 |
"/ you may wonder, what this while is for, here ... |
453 | 3003 |
"/ the reason is that if we modify the class hierarchy in |
4067 | 3004 |
"/ another view (background fileIn), while building up the |
453 | 3005 |
"/ cachedClasses set, this may be flushed (invalidated) by the |
3006 |
"/ other process in the meanwhile. |
|
3007 |
"/ If that happens, we restart the set-building here |
|
3008 |
"/ |
|
3009 |
[(classes := CachedClasses) isNil] whileTrue:[ |
|
22791 | 3010 |
CachedClasses := classes := IdentitySet new:NumberOfClassesHint. |
3011 |
self keysAndValuesDo:[:eachName :eachGlobal | |
|
3012 |
(eachGlobal notNil and:[eachGlobal isBehavior]) ifTrue:[ |
|
3013 |
"/ sigh - would like to skip over aliases |
|
3014 |
"/ but this cannot be done simply by comparing |
|
3015 |
"/ the classes name against the store-key |
|
3016 |
"/ i.e. cannot do: |
|
3017 |
"/ anObject name == sym ifTrue:[ |
|
3018 |
"/ classes add:anObject |
|
3019 |
"/ ] |
|
3020 |
"/ because that would lead to ignore all java |
|
3021 |
"/ classes, which are stored under a different |
|
3022 |
"/ key. |
|
3023 |
||
3024 |
(eachGlobal name == eachName |
|
3025 |
or:[eachGlobal isJavaClass]) ifTrue:[ |
|
3026 |
classes add:eachGlobal |
|
3027 |
]. |
|
3028 |
] |
|
3029 |
]. |
|
3030 |
NumberOfClassesHint := classes size. |
|
453 | 3031 |
]. |
3032 |
^ classes |
|
3033 |
||
8964
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
3034 |
" |
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
3035 |
CachedClasses := nil. |
453 | 3036 |
Smalltalk allClasses |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
3037 |
|
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
3038 |
to get the list sorted by name: |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
3039 |
|
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
3040 |
Smalltalk allClasses asSortedCollection:[:a :b | a name < b name] |
453 | 3041 |
" |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
3042 |
|
13851
5ab434e0a636
changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents:
13850
diff
changeset
|
3043 |
"Modified: / 06-12-2011 / 12:41:42 / cg" |
21489 | 3044 |
"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
|
3045 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3046 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3047 |
allClassesAndMetaclasses |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3048 |
"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
|
3049 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3050 |
|classes| |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3051 |
|
8964
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
3052 |
classes := IdentitySet new:NumberOfClassesHint*2. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3053 |
self allClassesDo:[:eachClass | |
18668 | 3054 |
classes add:(eachClass theNonMetaclass). |
3055 |
classes add:(eachClass theMetaclass). |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3056 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3057 |
^ classes |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3058 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3059 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3060 |
allClassesWithAllPrivateClasses |
7563 | 3061 |
"return an unordered collection of all classes in the Smalltalk namespace. |
10173
765b385fd1b8
changed #listAtCategoryNamed:
Claus Gittinger <cg@exept.de>
parents:
10169
diff
changeset
|
3062 |
Only globally anchored classes are returned; Namespaces are not included. |
20122 | 3063 |
(i.e. anonymous ones have to be acquired by Behavior allSubInstances)" |
4642 | 3064 |
|
10071 | 3065 |
^ self allClasses select:[:aClass | |
22791 | 3066 |
|owner| |
3067 |
||
3068 |
(aClass isRealNameSpace not) |
|
3069 |
and:[ |
|
3070 |
owner := aClass topOwningClass. |
|
3071 |
(owner ? aClass) nameSpace == Smalltalk |
|
3072 |
] |
|
4642 | 3073 |
] |
3074 |
||
3075 |
" |
|
3076 |
Smalltalk allClassesWithAllPrivateClasses |
|
3077 |
" |
|
10173
765b385fd1b8
changed #listAtCategoryNamed:
Claus Gittinger <cg@exept.de>
parents:
10169
diff
changeset
|
3078 |
|
765b385fd1b8
changed #listAtCategoryNamed:
Claus Gittinger <cg@exept.de>
parents:
10169
diff
changeset
|
3079 |
"Modified: / 10-11-2006 / 17:24:00 / cg" |
4642 | 3080 |
! |
3081 |
||
15068 | 3082 |
allExtensions |
3083 |
"return a collection of all extension methods (methods added from another package)" |
|
3084 |
||
3085 |
|methods| |
|
3086 |
||
3087 |
methods := OrderedCollection new. |
|
3088 |
self allClassesDo:[:eachClass | |
|
18668 | 3089 |
|classPackage| |
3090 |
||
3091 |
classPackage := eachClass package. |
|
3092 |
eachClass instAndClassMethodsDo:[:mthd | |
|
3093 |
mthd package ~= classPackage ifTrue:[ methods add:mthd ]. |
|
3094 |
]. |
|
15068 | 3095 |
]. |
3096 |
^ methods |
|
3097 |
||
3098 |
" |
|
3099 |
Smalltalk allExtensions |
|
3100 |
" |
|
3101 |
! |
|
3102 |
||
11153 | 3103 |
allExtensionsForPackage:aProjectID |
14890 | 3104 |
"return a collection of all extension methods for a given projectID" |
3105 |
||
11153 | 3106 |
|methods| |
3107 |
||
3108 |
methods := OrderedCollection new. |
|
3109 |
self allClassesDo:[:eachClass | |
|
18668 | 3110 |
methods addAll:(eachClass extensionsFrom:aProjectID). |
11153 | 3111 |
]. |
3112 |
^ methods |
|
3113 |
! |
|
3114 |
||
9227 | 3115 |
allImplementorsOf:aSelector |
12919
a7ea070197c9
comment/format in: #allImplementorsOf:
Claus Gittinger <cg@exept.de>
parents:
12911
diff
changeset
|
3116 |
"return a collection of classes which implement the given selector" |
a7ea070197c9
comment/format in: #allImplementorsOf:
Claus Gittinger <cg@exept.de>
parents:
12911
diff
changeset
|
3117 |
|
9227 | 3118 |
|implementors| |
3119 |
||
3120 |
implementors := OrderedCollection new. |
|
19681 | 3121 |
self allImplementorsOf:aSelector do:[:cls | implementors add:cls]. |
3122 |
^ implementors |
|
3123 |
||
3124 |
" |
|
22791 | 3125 |
Smalltalk allImplementorsOf:#isNil |
3126 |
(Smalltalk allImplementorsOf:#add:) size |
|
19681 | 3127 |
" |
3128 |
||
3129 |
"Modified: / 30-04-2016 / 17:37:39 / cg" |
|
3130 |
! |
|
3131 |
||
3132 |
allImplementorsOf:aSelector do:aBlock |
|
3133 |
"enumerate all classes which implement the given selector" |
|
3134 |
||
9227 | 3135 |
self allClassesDo:[:cls | |
22791 | 3136 |
(cls includesSelector:aSelector) ifTrue:[ |
3137 |
aBlock value:cls. |
|
3138 |
]. |
|
3139 |
(cls class includesSelector:aSelector) ifTrue:[ |
|
3140 |
aBlock value:cls class. |
|
3141 |
]. |
|
19681 | 3142 |
]. |
3143 |
||
3144 |
" |
|
3145 |
Smalltalk allImplementorsOf:#isNil do:[:cls | Transcript showCR:cls] |
|
3146 |
Smalltalk allImplementorsOf:#add: do:[:cls | Transcript showCR:cls] |
|
3147 |
" |
|
3148 |
||
3149 |
"Created: / 30-04-2016 / 17:36:45 / cg" |
|
9227 | 3150 |
! |
3151 |
||
19475 | 3152 |
allLoadedPackageIDs |
3153 |
||
3154 |
^ self allPackageIdsIncludingUnloadedClasses: false |
|
3155 |
||
3156 |
||
3157 |
" |
|
3158 |
Smalltalk allLoadedPackageIDs |
|
3159 |
" |
|
3160 |
! |
|
3161 |
||
12376 | 3162 |
allLoadedProjectIDs |
19475 | 3163 |
<resource: #obsolete> |
3164 |
self obsoleteMethodWarning:'use allLoadedPackageIDs'. |
|
3165 |
^ self allPackageIdsIncludingUnloadedClasses: false |
|
12376 | 3166 |
|
3167 |
||
3168 |
" |
|
3169 |
Smalltalk allLoadedProjectIDs |
|
3170 |
" |
|
3171 |
! |
|
3172 |
||
19475 | 3173 |
allPackageIDs |
3174 |
||
3175 |
^ self allPackageIdsIncludingUnloadedClasses: true |
|
3176 |
||
3177 |
" |
|
3178 |
Smalltalk allPackageIDs |
|
3179 |
" |
|
3180 |
! |
|
3181 |
||
3182 |
allPackageIdsIncludingUnloadedClasses: includeUnloadedClasses |
|
3183 |
"Returns all package ids. |
|
3184 |
Excludes packages coming from unloaded classes if includeUnloadedClasses is false. |
|
3185 |
" |
|
3186 |
||
3187 |
|allProjects| |
|
3188 |
||
3189 |
allProjects := Set new. |
|
3190 |
self allClassesDo:[:eachClass | |
|
22791 | 3191 |
|cls pkg| |
3192 |
||
3193 |
eachClass isRealNameSpace ifFalse:[ |
|
3194 |
(includeUnloadedClasses or:[eachClass isLoaded]) ifTrue:[ |
|
3195 |
cls := eachClass theNonMetaclass. |
|
3196 |
cls isPrivate ifTrue:[ |
|
3197 |
cls := cls topOwningClass |
|
3198 |
]. |
|
3199 |
pkg := cls package. |
|
3200 |
pkg size > 0 ifTrue:[ |
|
3201 |
allProjects add:pkg. |
|
3202 |
] ifFalse:[ |
|
3203 |
"/ for now, nameSpaces are not in any package; |
|
3204 |
"/ this might change. Then, 0-sized packages are |
|
3205 |
"/ illegal, and the following should be enabled. |
|
3206 |
"/ self halt |
|
3207 |
]. |
|
3208 |
cls isJavaClass ifFalse:[ |
|
3209 |
cls instAndClassSelectorsAndMethodsDo:[:sel :mthd | |
|
3210 |
allProjects add:mthd package asSymbol. |
|
3211 |
]. |
|
3212 |
]. |
|
3213 |
]. |
|
3214 |
]. |
|
19475 | 3215 |
]. |
3216 |
allProjects := allProjects asOrderedCollection sort. |
|
3217 |
^ allProjects |
|
3218 |
||
3219 |
" |
|
3220 |
Smalltalk allProjectsIdsIncludingUnloadedClasses: true |
|
3221 |
Smalltalk allProjectsIdsIncludingUnloadedClasses: false |
|
3222 |
" |
|
3223 |
! |
|
3224 |
||
9254 | 3225 |
allProjectIDs |
19475 | 3226 |
<resource: #obsolete> |
3227 |
self obsoleteMethodWarning:'use allPackageIDs'. |
|
3228 |
^ self allPackageIDs |
|
12376 | 3229 |
|
3230 |
" |
|
3231 |
Smalltalk allProjectIDs |
|
3232 |
" |
|
3233 |
! |
|
3234 |
||
3235 |
allProjectsIdsIncludingUnloadedClasses: includeUnloadedClasses |
|
19475 | 3236 |
<resource: #obsolete> |
12376 | 3237 |
"Returns all projects ids. |
3238 |
Excludes projects coming from unloaded classes if includeUnloadedClasses is false. |
|
3239 |
" |
|
3240 |
||
19475 | 3241 |
self obsoleteMethodWarning:'use allPackageIdsIncludingUnloadedClasses:'. |
3242 |
^ self allPackageIdsIncludingUnloadedClasses: includeUnloadedClasses |
|
9254 | 3243 |
|
3244 |
" |
|
12376 | 3245 |
Smalltalk allProjectsIdsIncludingUnloadedClasses: true |
3246 |
Smalltalk allProjectsIdsIncludingUnloadedClasses: false |
|
9254 | 3247 |
" |
3248 |
! |
|
3249 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3250 |
cellAt:aName |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3251 |
"{ Pragma: +optSpace }" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3252 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3253 |
"return the address of a global cell |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3254 |
- used internally for compiler only" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3255 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3256 |
%{ /* NOCONTEXT */ |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3257 |
RETURN ( __GLOBAL_GETCELL(aName) ); |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3258 |
%}. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3259 |
^ self primitiveFailed |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3260 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3261 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3262 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3263 |
classCategoryCompletion:aPartialCategory |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3264 |
"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
|
3265 |
2 entries: 1st: the best (longest) match |
18668 | 3266 |
2nd: collection consisting of matching categories" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3267 |
|
9508 | 3268 |
^ DoWhatIMeanSupport classCategoryCompletion:aPartialCategory inEnvironment:self |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3269 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3270 |
" |
10071 | 3271 |
Smalltalk classCategoryCompletion:'Sys' |
3272 |
Smalltalk classCategoryCompletion:'System' |
|
3273 |
Smalltalk classCategoryCompletion:'System-BinaryStorage' |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3274 |
" |
9508 | 3275 |
|
3276 |
"Modified: / 10-08-2006 / 13:06:34 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3277 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3278 |
|
8570 | 3279 |
classNamed:aString |
3280 |
"return the class with name aString, or nil if absent. |
|
3281 |
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
|
3282 |
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
|
3283 |
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
|
3284 |
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
|
3285 |
|
10127 | 3286 |
|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
|
3287 |
|
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3288 |
"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
|
3289 |
But be careful, to not invent new symbols ..." |
453 | 3290 |
sym := aString asSymbolIfInterned. |
22650 | 3291 |
sym isSymbol ifTrue:[ |
22791 | 3292 |
cls := self at:sym ifAbsent:nil. |
3293 |
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
|
3294 |
]. |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3295 |
|
1480
df0bea6285f8
Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
3296 |
(aString endsWith:' class') ifTrue:[ |
22791 | 3297 |
nonMeta := self classNamed:(aString copyButLast:6). |
3298 |
nonMeta notNil ifTrue:[ |
|
3299 |
^ nonMeta theMetaclass |
|
3300 |
]. |
|
3301 |
^ nil. |
|
13602
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3302 |
]. |
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3303 |
|
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3304 |
"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
|
3305 |
cls isNil ifTrue:[ |
22791 | 3306 |
idx := aString indexOfSubCollection:'::'. |
3307 |
idx ~~ 0 ifTrue:[ |
|
3308 |
prefix := aString copyTo:idx-1. |
|
3309 |
nsNameSymbol := prefix asSymbolIfInterned. |
|
3310 |
nsNameSymbol notNil ifTrue:[ |
|
3311 |
rest := aString copyFrom:idx+2. |
|
3312 |
namespace := self at:prefix asSymbolIfInterned ifAbsent:nil. |
|
3313 |
"namespace may be the owner of a private class. |
|
3314 |
NameSpaces and Behaviors have the same protocol" |
|
3315 |
[namespace isBehavior] whileTrue:[ |
|
3316 |
idx := rest indexOfSubCollection:'::'. |
|
3317 |
idx ~~ 0 ifTrue:[ |
|
3318 |
prefix := rest copyTo:idx-1. |
|
3319 |
rest := rest copyFrom:idx+2. |
|
3320 |
"this does an implicit autoload if required" |
|
3321 |
namespace := namespace privateClassesAt:prefix. |
|
3322 |
] ifFalse:[ |
|
3323 |
namespace isLoaded ifTrue:[ |
|
3324 |
cls := namespace privateClassesAt:rest. |
|
3325 |
cls isBehavior ifTrue:[^ cls]. |
|
3326 |
]. |
|
3327 |
namespace := nil. "force exit of loop" |
|
3328 |
]. |
|
3329 |
]. |
|
3330 |
]. |
|
3331 |
]. |
|
9374
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3332 |
]. |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3333 |
|
453 | 3334 |
^ nil |
3335 |
||
3336 |
" |
|
10071 | 3337 |
Smalltalk classNamed:'Object' |
3338 |
Smalltalk classNamed:'Authentication::BasicAuthenticator::BasicAuthenticationData' |
|
3339 |
Smalltalk classNamed:'Authentication::BasicAuthenticator::BasicAuthenticationData class' |
|
3340 |
Smalltalk classNamed:'Authentication::BasicAuthenticator' |
|
3341 |
Smalltalk classNamed:'fooBar' |
|
3342 |
Smalltalk classNamed:'true' |
|
3343 |
Smalltalk classNamed:'Object class' |
|
3344 |
Smalltalk classNamed:'Metaclass' |
|
3345 |
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
|
3346 |
Smalltalk classNamed:'Array class' |
453 | 3347 |
" |
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
3348 |
|
9468 | 3349 |
"Created: / 24-11-1995 / 17:30:22 / cg" |
3350 |
"Modified: / 19-06-1996 / 14:22:21 / stefan" |
|
10127 | 3351 |
"Modified: / 23-10-2006 / 18:06:53 / cg" |
13602
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3352 |
"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
|
3353 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3354 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3355 |
classNames |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3356 |
"return a collection of all classNames in the system" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3357 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3358 |
^ self allClasses collect:[:aClass | aClass name] |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3359 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3360 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3361 |
Smalltalk classNames |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3362 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3363 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3364 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3365 |
classnameCompletion:aPartialClassName |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3366 |
"given a partial classname, return an array consisting of |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3367 |
2 entries: 1st: the best (longest) match |
18668 | 3368 |
2nd: collection consisting of matching names" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3369 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3370 |
^ DoWhatIMeanSupport classnameCompletion:aPartialClassName inEnvironment:self |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3371 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3372 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3373 |
classnameCompletion:aPartialClassName inEnvironment:anEnvironment |
7563 | 3374 |
"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
|
3375 |
2 entries: 1st: the best (longest) match |
18668 | 3376 |
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
|
3377 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3378 |
^ DoWhatIMeanSupport classnameCompletion:aPartialClassName inEnvironment:anEnvironment |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3379 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3380 |
" |
10071 | 3381 |
Smalltalk classnameCompletion:'Arr' |
3382 |
Smalltalk classnameCompletion:'Arra' |
|
3383 |
Smalltalk classnameCompletion:'arra' |
|
3384 |
Smalltalk classnameCompletion:'*rray' |
|
3385 |
||
3386 |
Smalltalk classnameCompletion:'Arr cl' |
|
3387 |
Smalltalk classnameCompletion:'*rray cl' |
|
453 | 3388 |
" |
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
3389 |
|
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
3390 |
"Created: 24.11.1995 / 17:24:45 / cg" |
2523
04db1fd74e0d
try ignoring case in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
2514
diff
changeset
|
3391 |
"Modified: 3.4.1997 / 18:25:01 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3392 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3393 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3394 |
defaultNameSpace |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3395 |
"return the default namespace, where new classes are installed, |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3396 |
if NO special nameSpace handler is present" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3397 |
|
9562
7d36dbb02bb3
code cleanup - remove old obsolete Project code
Claus Gittinger <cg@exept.de>
parents:
9550
diff
changeset
|
3398 |
^ Project defaultNameSpace. |
7d36dbb02bb3
code cleanup - remove old obsolete Project code
Claus Gittinger <cg@exept.de>
parents:
9550
diff
changeset
|
3399 |
|
7d36dbb02bb3
code cleanup - remove old obsolete Project code
Claus Gittinger <cg@exept.de>
parents:
9550
diff
changeset
|
3400 |
"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
|
3401 |
"Modified: / 17-08-2006 / 14:01:22 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3402 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3403 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3404 |
globalNameCompletion:aPartialGlobalName |
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3405 |
"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
|
3406 |
2 entries: 1st: the best (longest) match |
18668 | 3407 |
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
|
3408 |
|
12614
b8fca618dcb6
changed: #globalNameCompletion:
Claus Gittinger <cg@exept.de>
parents:
12613
diff
changeset
|
3409 |
^ 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
|
3410 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3411 |
" |
10071 | 3412 |
Smalltalk globalnameCompletion:'Arr' |
3413 |
Smalltalk globalnameCompletion:'Arra' |
|
3414 |
Smalltalk globalnameCompletion:'arra' |
|
3415 |
Smalltalk globalnameCompletion:'*rray' |
|
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3416 |
" |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3417 |
|
9508 | 3418 |
"Created: / 24-11-1995 / 17:24:45 / cg" |
3419 |
"Modified: / 10-08-2006 / 13:05:39 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3420 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3421 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3422 |
globalnameCompletion:aPartialGlobalName |
7563 | 3423 |
"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
|
3424 |
2 entries: 1st: the best (longest) match |
18668 | 3425 |
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
|
3426 |
|
8358 | 3427 |
<resource:#obsolete> |
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3428 |
self obsoleteMethodWarning:'use #globalNameCompletion:'. |
9508 | 3429 |
^ 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
|
3430 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3431 |
" |
10071 | 3432 |
Smalltalk globalnameCompletion:'Arr' |
3433 |
Smalltalk globalnameCompletion:'Arra' |
|
3434 |
Smalltalk globalnameCompletion:'arra' |
|
3435 |
Smalltalk globalnameCompletion:'*rray' |
|
5736 | 3436 |
" |
3437 |
||
9508 | 3438 |
"Created: / 24-11-1995 / 17:24:45 / cg" |
3439 |
"Modified: / 10-08-2006 / 13:05:48 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3440 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3441 |
|
13771 | 3442 |
hasClassNamed:aString |
3443 |
Symbol |
|
18668 | 3444 |
hasInterned:aString |
3445 |
ifTrue:[:aSymbol | ^ (self at:aSymbol ifAbsent:[ nil ]) isClass ]. |
|
13602
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3446 |
^ false |
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3447 |
|
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3448 |
"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
|
3449 |
"Modified: / 20-08-2011 / 16:41:31 / cg" |
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3450 |
! |
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3451 |
|
9290 | 3452 |
hasNameSpaces |
3453 |
"can be redefined by dummy namespaces/environments, to suppress |
|
3454 |
the namespace display in a browser (PocketSmalltalk)" |
|
3455 |
||
3456 |
^ true |
|
3457 |
! |
|
3458 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3459 |
hasNamespaces |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3460 |
"can be redefined by dummy namespaces/environments, to suppress |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3461 |
the namespace display in a browser (PocketSmalltalk)" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3462 |
|
9290 | 3463 |
<resource:#obsolete> |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3464 |
^ true |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3465 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3466 |
|
10432
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3467 |
hasSelectorNameSpaces |
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3468 |
"for now return false |
10999 | 3469 |
Selector namespaces are being implemented and supported by the VM, |
10432
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3470 |
but not yet fully supported by all tools... |
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3471 |
Therefore, for now, do not generate code which uses this feature." |
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3472 |
|
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3473 |
^ false |
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3474 |
|
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3475 |
"Created: / 05-03-2007 / 13:26:28 / cg" |
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3476 |
! |
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3477 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3478 |
includes:something |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3479 |
"this should come from Collection. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3480 |
will change the inheritance - Smalltalk is actually a collection" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3481 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3482 |
self do:[:element | element = something ifTrue:[^ true]]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3483 |
^ false |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3484 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3485 |
|
14987 | 3486 |
includesIdentical:something |
3487 |
"this should come from Collection. |
|
3488 |
will change the inheritance - Smalltalk is actually a collection" |
|
3489 |
||
3490 |
self do:[:element | element == something ifTrue:[^ true]]. |
|
3491 |
^ false |
|
3492 |
! |
|
3493 |
||
10041
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
3494 |
isBrowserStartable |
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
3495 |
^ false. |
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
3496 |
|
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
3497 |
"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
|
3498 |
! |
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
3499 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3500 |
isNameSpace |
9227 | 3501 |
"return true, if the receiver is a nameSpace." |
3502 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3503 |
^ true |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3504 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3505 |
"Created: 11.10.1996 / 18:10:43 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3506 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3507 |
|
10169 | 3508 |
isRealNameSpace |
3509 |
"return true, if the receiver is a nameSpace, but not Smalltalk (which is also a class)." |
|
3510 |
||
3511 |
^ false |
|
3512 |
||
3513 |
"Created: / 10-11-2006 / 17:02:19 / cg" |
|
3514 |
! |
|
3515 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3516 |
isTopLevelNameSpace |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3517 |
^ true |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3518 |
! |
7563 | 3519 |
|
3520 |
isTopLevelNamespace |
|
3521 |
"obsolete - use isTopLevelNameSpace" |
|
5365 | 3522 |
|
7432 | 3523 |
<resource:#obsolete> |
3524 |
||
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3525 |
self obsoleteMethodWarning:'use #isTopLevelNameSpace'. |
4458 | 3526 |
^ true |
3527 |
||
3528 |
"Created: 11.10.1996 / 18:10:43 / cg" |
|
3529 |
! |
|
3530 |
||
9081 | 3531 |
keyIsClassVariableNameKey:aKey |
3532 |
|i| |
|
3533 |
||
3534 |
i := aKey lastIndexOf:$:. |
|
3535 |
i ~~ 0 ifTrue:[ |
|
18668 | 3536 |
i > 1 ifTrue:[ |
3537 |
(aKey at:(i-1)) == $: ifFalse:[ |
|
3538 |
^ true. |
|
3539 |
]. |
|
3540 |
]. |
|
9081 | 3541 |
]. |
3542 |
^ false. |
|
3543 |
||
3544 |
" |
|
10071 | 3545 |
self keyIsClassVariableNameKey:'foo::bar' |
3546 |
self keyIsClassVariableNameKey:'foo:bar' |
|
3547 |
self keyIsClassVariableNameKey:':bar' |
|
3548 |
self keyIsClassVariableNameKey:'::bar' |
|
9081 | 3549 |
" |
3550 |
! |
|
3551 |
||
9374
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3552 |
loadedClassNamed:aString |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3553 |
"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
|
3554 |
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
|
3555 |
|
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3556 |
|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
|
3557 |
|
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3558 |
"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
|
3559 |
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
|
3560 |
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
|
3561 |
sym notNil ifTrue:[ |
18668 | 3562 |
cls := self at:sym ifAbsent:nil. |
3563 |
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
|
3564 |
]. |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3565 |
|
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3566 |
(aString endsWith:' class') ifTrue:[ |
18668 | 3567 |
nonMeta := self loadedClassNamed:(aString copyButLast:6). |
3568 |
nonMeta notNil ifTrue:[ |
|
3569 |
^ nonMeta theMetaclass |
|
3570 |
]. |
|
9374
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3571 |
]. |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3572 |
^ nil |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3573 |
|
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3574 |
" |
10071 | 3575 |
Smalltalk loadedClassNamed:'Object' |
3576 |
Smalltalk loadedClassNamed:'Authentication::BasicAuthenticator::BasicAuthenticationData' |
|
3577 |
Smalltalk loadedClassNamed:'Authentication::BasicAuthenticator::BasicAuthenticationData class' |
|
3578 |
Smalltalk loadedClassNamed:'Authentication::BasicAuthenticator' |
|
3579 |
Smalltalk loadedClassNamed:'fooBar' |
|
3580 |
Smalltalk loadedClassNamed:'true' |
|
3581 |
Smalltalk loadedClassNamed:'Object class' |
|
3582 |
Smalltalk loadedClassNamed:'Metaclass' |
|
3583 |
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
|
3584 |
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
|
3585 |
" |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3586 |
! |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3587 |
|
7563 | 3588 |
methodProtocolCompletion:aPartialProtocolName |
3589 |
"given a partial method protocol name, return an array consisting of |
|
10071 | 3590 |
2 entries: 1st: the best (longest) match |
18668 | 3591 |
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
|
3592 |
|
9508 | 3593 |
^ DoWhatIMeanSupport methodProtocolCompletion:aPartialProtocolName inEnvironment:self |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3594 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3595 |
" |
10071 | 3596 |
Smalltalk methodProtocolCompletion:'doc' |
3597 |
Smalltalk methodProtocolCompletion:'docu' |
|
3598 |
Smalltalk methodProtocolCompletion:'documenta' |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3599 |
" |
9508 | 3600 |
|
3601 |
"Modified: / 10-08-2006 / 13:05:20 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3602 |
! |
5505
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
3603 |
|
7563 | 3604 |
numberOfGlobals |
3605 |
"return the number of global variables in the system" |
|
3606 |
||
3607 |
|tally "{ Class: SmallInteger }" | |
|
617 | 3608 |
|
3609 |
tally := 0. |
|
3610 |
self do:[:obj | tally := tally + 1]. |
|
3611 |
^ tally |
|
3612 |
||
3613 |
"Smalltalk numberOfGlobals" |
|
3614 |
! |
|
3615 |
||
7563 | 3616 |
referencesAny:aCollection |
3617 |
"redefined, since the references are only kept in the VM's symbol table" |
|
3260 | 3618 |
|
3619 |
self keysAndValuesDo:[:key :val | |
|
18668 | 3620 |
aCollection do:[:anObject | |
3621 |
(key == anObject) ifTrue:[^ true]. |
|
3622 |
(val == anObject ) ifTrue:[^ true]. |
|
3623 |
] |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3624 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3625 |
^ super referencesAny:aCollection |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3626 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3627 |
"Created: / 2.2.1998 / 16:01:20 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3628 |
! |
3260 | 3629 |
|
7563 | 3630 |
referencesDerivedInstanceOf:aClass |
3631 |
"redefined, since the references are only kept in the VM's symbol table" |
|
617 | 3632 |
|
3633 |
self keysAndValuesDo:[:key :val | |
|
18668 | 3634 |
(key isKindOf:aClass) ifTrue:[^ true]. |
3635 |
(val isKindOf:aClass) ifTrue:[^ true]. |
|
617 | 3636 |
]. |
3637 |
^ super referencesDerivedInstanceOf:aClass |
|
3638 |
! |
|
3639 |
||
7563 | 3640 |
referencesInstanceOf:aClass |
3641 |
"redefined, since the references are only kept in the VM's symbol table" |
|
617 | 3642 |
|
3643 |
self keysAndValuesDo:[:key :val | |
|
18668 | 3644 |
(key isMemberOf:aClass) ifTrue:[^ true]. |
3645 |
(val isMemberOf:aClass) ifTrue:[^ true]. |
|
617 | 3646 |
]. |
3647 |
^ super referencesInstanceOf:aClass |
|
3648 |
! |
|
3649 |
||
7563 | 3650 |
referencesObject:anObject |
3651 |
"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
|
3652 |
|
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
3653 |
self keysAndValuesDo:[:key :val | |
18668 | 3654 |
(key == anObject) ifTrue:[^ true]. |
3655 |
(val == anObject ) ifTrue:[^ true]. |
|
6074
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
3656 |
]. |
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
3657 |
^ super referencesObject:anObject |
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
3658 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3659 |
"Modified: / 3.2.1998 / 14:22:46 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3660 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3661 |
|
15766 | 3662 |
resolveName:aName inClass:aClass |
7563 | 3663 |
"resolve aName as if compiled within aClass; |
3026 | 3664 |
i.e. if it has a private class with this name, return it; |
3665 |
if aName is known within the classes namespace, return that. |
|
3666 |
Otherwise, return a global with that name. |
|
3667 |
This should be used whereever Smalltalk>>at: used to be used, |
|
3668 |
to resolve a global by name." |
|
3669 |
||
15766 | 3670 |
|nameUsed sym cls ns| |
3671 |
||
3672 |
aName isNil ifTrue:[^ nil]. |
|
3673 |
aName isBehavior ifTrue:[^ aName]. "/ already resolved |
|
3674 |
nameUsed := aName. |
|
3675 |
||
3676 |
(nameUsed startsWith:'Smalltalk::') ifTrue:[ |
|
18668 | 3677 |
nameUsed := nameUsed copyFrom:12. |
3678 |
^ self at:(nameUsed asSymbol) ifAbsent:nil. |
|
15766 | 3679 |
]. |
3680 |
||
3681 |
sym := nameUsed asSymbol. |
|
3026 | 3682 |
|
3683 |
cls := aClass privateClassesAt:sym. |
|
3684 |
cls notNil ifTrue:[^ cls]. |
|
3685 |
||
3686 |
ns := aClass nameSpace. |
|
3687 |
(ns notNil and:[ns ~~ Smalltalk]) ifTrue:[ |
|
18668 | 3688 |
ns isNameSpace ifTrue:[ |
3689 |
cls := ns at:sym ifAbsent:nil. |
|
3690 |
] ifFalse:[ |
|
3691 |
cls := ns privateClassesAt:sym |
|
3692 |
]. |
|
3693 |
cls notNil ifTrue:[^ cls]. |
|
3025 | 3694 |
]. |
3026 | 3695 |
^ self at:sym ifAbsent:nil. |
4356 | 3696 |
|
3697 |
"Modified: / 9.7.1999 / 01:18:07 / cg" |
|
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 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3700 |
selectorCompletion:aPartialSymbolName |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3701 |
"given a partial selector, return an array consisting of |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3702 |
2 entries: 1st: the longest match |
18668 | 3703 |
2nd: collection consisting of matching implemented selectors" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3704 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3705 |
^ DoWhatIMeanSupport selectorCompletion:aPartialSymbolName inEnvironment:self |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3706 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3707 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3708 |
selectorCompletion:aPartialSymbolName inEnvironment:anEnvironment |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3709 |
"given a partial selector, return an array consisting of |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3710 |
2 entries: 1st: the longest match |
18668 | 3711 |
2nd: collection consisting of matching implemented selectors" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3712 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3713 |
^ DoWhatIMeanSupport selectorCompletion:aPartialSymbolName inEnvironment:anEnvironment |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3714 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3715 |
" |
10071 | 3716 |
Smalltalk selectorCompletion:'at:p' |
3717 |
Smalltalk selectorCompletion:'nextP' |
|
3718 |
Smalltalk selectorCompletion:'nextp' |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3719 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3720 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3721 |
"Modified: / 7.6.1996 / 08:44:33 / stefan" |
3565
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
3722 |
"Modified: / 14.6.1998 / 15:54:03 / cg" |
19681 | 3723 |
! |
3724 |
||
3725 |
someImplementorOf:aSelector |
|
3726 |
"return any class, which implement the given selector. Nil if there is none. |
|
3727 |
(useful to search, if there is one at all)" |
|
3728 |
||
3729 |
self allImplementorsOf:aSelector do:[:cls | ^ cls]. |
|
3730 |
^ nil. |
|
3731 |
||
3732 |
" |
|
3733 |
Smalltalk someImplementorOf:#isNil |
|
3734 |
Smalltalk someImplementorOf:#add: |
|
3735 |
" |
|
3736 |
||
3737 |
"Created: / 30-04-2016 / 17:39:19 / cg" |
|
453 | 3738 |
! ! |
3739 |
||
4431 | 3740 |
!Smalltalk class methodsFor:'queries-system'! |
3741 |
||
15958 | 3742 |
isAmber |
15980 | 3743 |
"is this an Amber Smalltalk system ? |
3744 |
Return false here - this may be useful to write portable |
|
15958 | 3745 |
applications - add #isAmber to your Amber Smalltalk, |
3746 |
returning true there." |
|
3747 |
||
3748 |
^ false |
|
3749 |
||
3750 |
"Created: / 18-12-2013 / 15:43:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3751 |
! |
|
3752 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3753 |
isDolphinSmalltalk |
16803 | 3754 |
"is this a Dolphin Smalltalk system ? |
15980 | 3755 |
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
|
3756 |
applications - add #isDolphinSmalltalk to your dolphin, |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3757 |
returning true there." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3758 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3759 |
^ false |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3760 |
! |
4970 | 3761 |
|
15958 | 3762 |
isGemStone |
15980 | 3763 |
"is this a GemStone Smalltalk system ? |
3764 |
Return false here - this may be useful to write portable |
|
15958 | 3765 |
applications - add #isGemStone to your GemStone/S, |
3766 |
returning true there." |
|
3767 |
||
3768 |
^ false |
|
3769 |
||
3770 |
"Created: / 18-12-2013 / 15:43:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3771 |
! |
|
3772 |
||
3773 |
isPharo |
|
15980 | 3774 |
"is this a Pharo Smalltalk system ? |
3775 |
Return false here - this may be useful to write portable |
|
15958 | 3776 |
applications - add #isPharo to your Pharo, |
3777 |
returning true there." |
|
3778 |
||
3779 |
^ false |
|
3780 |
||
3781 |
"Created: / 18-12-2013 / 15:42:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3782 |
! |
|
3783 |
||
7563 | 3784 |
isSmalltalkMT |
15980 | 3785 |
"is this a Smalltalk-MT system ? |
3786 |
Return false here - this may be useful to write portable |
|
7563 | 3787 |
applications - add #isSmalltalkMT to your smalltalk-MT, |
4970 | 3788 |
returning true there." |
3789 |
||
3790 |
^ false |
|
3791 |
! |
|
3792 |
||
7563 | 3793 |
isSmalltalkV |
15980 | 3794 |
"is this a Smalltalk/V system ? |
3795 |
Return false here - this may be useful to write portable |
|
7563 | 3796 |
applications - add #isSmalltalkV to your smalltalkV, |
4431 | 3797 |
returning true there." |
3798 |
||
3799 |
^ false |
|
3800 |
! |
|
3801 |
||
7563 | 3802 |
isSmalltalkX |
16803 | 3803 |
"is this a Smalltalk/X system ? |
15980 | 3804 |
Return true here - this may be useful to write portable |
22799 | 3805 |
applications. |
3806 |
Add #isSmalltalkX to your other smalltalks, returning false there. |
|
3807 |
Notice: the ST/X compilers know about this, and inline the code |
|
3808 |
(not generating code for the false branch). |
|
3809 |
So in ST/X, this check costs you absolutely nothing." |
|
4431 | 3810 |
|
3811 |
^ true |
|
3812 |
! |
|
3813 |
||
7563 | 3814 |
isSqueak |
15980 | 3815 |
"is this a SqueakSmalltalk system ? |
3816 |
Return false here - this may be useful to write portable |
|
7563 | 3817 |
applications - add #isSqueak to your squeak, |
4431 | 3818 |
returning true there." |
3819 |
||
3820 |
^ false |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3821 |
! |
4431 | 3822 |
|
16013 | 3823 |
isSqueakLike |
3824 |
"is this a Squeak, Pharo, Cuis or similar Smalltalk system ? |
|
3825 |
Return false here - this may be useful to write portable |
|
3826 |
applications - add #isSqueakLike to your squeak, pharo,... |
|
3827 |
returning true there." |
|
3828 |
||
3829 |
^ false |
|
3830 |
! |
|
3831 |
||
7563 | 3832 |
isVisualAge |
15980 | 3833 |
"is this a VisualAge Smalltalk system ? |
3834 |
Return false here - this may be useful to write portable |
|
7563 | 3835 |
applications - add #isVisualAge to your visualAge, |
4431 | 3836 |
returning true there." |
3837 |
||
3838 |
^ false |
|
3839 |
! |
|
3840 |
||
17369 | 3841 |
isVisualSmalltalkEnterprise |
16843 | 3842 |
"is this a VSE Smalltalk system ? |
3843 |
Return false here - this may be useful to write portable |
|
3844 |
applications - add #isVisualSmallalkEnterprise to your VSE, |
|
3845 |
returning true there." |
|
3846 |
||
3847 |
^ false |
|
3848 |
! |
|
3849 |
||
7563 | 3850 |
isVisualWorks |
15980 | 3851 |
"is this a VisualWorks Smalltalk system ? |
3852 |
Return false here - this may be useful to write portable |
|
7563 | 3853 |
applications - add #isVisualWorks to your visualWorks, |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3854 |
returning true there." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3855 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3856 |
^ false |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3857 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3858 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3859 |
!Smalltalk class methodsFor:'startup'! |
1 | 3860 |
|
9032 | 3861 |
browserWindowStartup |
13056
1fa92a4cd9cc
comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
3862 |
"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
|
3863 |
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
|
3864 |
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
|
3865 |
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
|
3866 |
multiwindow application. |
1fa92a4cd9cc
comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
3867 |
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
|
3868 |
|
9032 | 3869 |
|windowIDString numericWindowID windowID params idx process| |
3870 |
||
3871 |
idx := CommandLineArguments indexOf:'--browserWindow:'. |
|
3872 |
windowIDString := CommandLineArguments at:idx+1. |
|
3873 |
numericWindowID := Integer fromString:windowIDString. |
|
3874 |
windowID := ExternalAddress newAddress:numericWindowID. |
|
3875 |
||
3876 |
idx := CommandLineArguments indexOf:'--browserParameters:'. |
|
3877 |
idx ~~ 0 ifTrue:[ |
|
18668 | 3878 |
params := Dictionary new. |
3879 |
(CommandLineArguments copyFrom:idx+1) pairWiseDo:[:key :value | |
|
3880 |
params at:key put:value. |
|
3881 |
]. |
|
9032 | 3882 |
]. |
3883 |
||
3884 |
'browserWindow is: ' errorPrint. windowID errorPrintCR. |
|
3885 |
'browserParameters are: ' errorPrint. params errorPrintCR. |
|
3886 |
'Display is: ' errorPrint. Display errorPrintCR. |
|
3887 |
||
3888 |
process := [ |
|
18668 | 3889 |
PluginSupport |
3890 |
startInBrowserWithWindowID:windowID |
|
3891 |
parameters:params. |
|
9032 | 3892 |
] newProcess. |
9043
e6106f500263
do not use numeric process prios
Claus Gittinger <cg@exept.de>
parents:
9036
diff
changeset
|
3893 |
process priority:(Processor userSchedulingPriority). |
9032 | 3894 |
process name:'browser start handler'. |
3895 |
process beGroupLeader. |
|
3896 |
process resume. |
|
3897 |
process := nil. |
|
3898 |
||
3899 |
Processor dispatchLoop. |
|
3900 |
Smalltalk exit. |
|
13056
1fa92a4cd9cc
comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
3901 |
|
1fa92a4cd9cc
comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
3902 |
"Modified: / 11-09-2010 / 14:06:59 / cg" |
9032 | 3903 |
! |
3904 |
||
20856 | 3905 |
defineCommandLineAsWorkspaceVariablesForScripts |
3906 |
"/ enable this, so we can provide _$1.._$n in the script |
|
20858 | 3907 |
ParserFlags allowUnderscoreInIdentifier:true. |
20856 | 3908 |
ParserFlags allowDollarInIdentifier:true. |
3909 |
ParserFlags warnDollarInIdentifier:false. |
|
20858 | 3910 |
ParserFlags warnUnderscoreInIdentifier:false. |
20859 | 3911 |
ParserFlags allowOldStyleAssignment:false. |
22791 | 3912 |
|
20856 | 3913 |
"/ add bindings for arguments |
3914 |
Workspace workspaceVariableAt:('_$0') put:CommandName. |
|
20857 | 3915 |
Workspace workspaceVariableAt:('_$n') put:CommandLineArguments size. |
20860 | 3916 |
Workspace workspaceVariableAt:('_$$') put:CommandLineArguments. |
20856 | 3917 |
CommandLineArguments doWithIndex:[:arg :i | |
22791 | 3918 |
Workspace workspaceVariableAt:('_$',i printString) put:arg. |
20856 | 3919 |
]. |
3920 |
! |
|
3921 |
||
7563 | 3922 |
displayInitializationDone |
3923 |
"inform the restart, that the display has been initialized" |
|
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3924 |
|
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3925 |
CallbackSignal raiseRequest. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3926 |
! |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3927 |
|
13893 | 3928 |
executeStartBlocks |
3929 |
|startBlocks| |
|
3930 |
||
3931 |
startBlocks := self startBlocks. |
|
3932 |
startBlocks notNil ifTrue:[ |
|
18668 | 3933 |
'Smalltalk [info]: execute startBlocks...' infoPrintCR. |
3934 |
startBlocks do:[:aBlock| |
|
3935 |
Error handle:[:ex | |
|
3936 |
InfoPrinting == true ifTrue:[ |
|
3937 |
'Smalltalk [warning]: error caught in startBlock: ' infoPrint. |
|
3938 |
ex description infoPrintCR. |
|
3939 |
ex infoPrintCR. |
|
3940 |
thisContext fullPrintAll. |
|
3941 |
]. |
|
3942 |
] do: aBlock |
|
3943 |
]. |
|
3944 |
startBlocks removeAll. |
|
13893 | 3945 |
]. |
3946 |
||
3947 |
"Created: / 07-01-2012 / 12:58:39 / cg" |
|
3948 |
! |
|
3949 |
||
11375 | 3950 |
hideSplashWindow |
3951 |
%{ |
|
3952 |
#ifdef WIN32 |
|
3953 |
extern void __win32_hideSplashScreen(); |
|
3954 |
||
3955 |
__win32_hideSplashScreen(); |
|
3956 |
#endif |
|
3957 |
%} |
|
3958 |
! |
|
3959 |
||
20720 | 3960 |
lateOpenDisplay |
20737 | 3961 |
"this is called when a view is opened without a display being already opened." |
22791 | 3962 |
|
22636 | 3963 |
|display| |
3964 |
||
3965 |
display := Smalltalk openDisplay. |
|
22791 | 3966 |
display notNil ifTrue:[ |
3967 |
IsRepl ifFalse:[ |
|
3968 |
display exitOnLastClose:true. |
|
3969 |
]. |
|
3970 |
"/ Processor exitWhenNoMoreUserProcesses:true. |
|
22636 | 3971 |
]. |
3972 |
^ display |
|
3973 |
||
3974 |
"Modified: / 20-03-2018 / 12:43:29 / stefan" |
|
20720 | 3975 |
! |
3976 |
||
7563 | 3977 |
mainStartup:graphicalMode |
3978 |
"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
|
3979 |
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
|
3980 |
|
9012 | 3981 |
|process imageName thisIsARestart idx| |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3982 |
|
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3983 |
imageName := ObjectMemory imageName. |
2249
cdb6c87f0707
send returnFromSnapshot notification later -
Claus Gittinger <cg@exept.de>
parents:
2212
diff
changeset
|
3984 |
thisIsARestart := imageName notNil. |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3985 |
|
19788 | 3986 |
true "graphicalMode" ifTrue:[ |
22791 | 3987 |
Display isNil ifTrue:[ |
3988 |
(StartupClass notNil |
|
3989 |
and:[ (StartupClass perform:#isHeadless ifNotUnderstood:false) ]) ifFalse:[ |
|
3990 |
self openDisplay. |
|
3991 |
]. |
|
3992 |
]. |
|
10644 | 3993 |
]. |
3994 |
||
10645 | 3995 |
StandAlone ifFalse:[ |
22791 | 3996 |
" |
3997 |
enable the graphical debugger/inspector |
|
3998 |
(they could have been (re)defined as autoloaded in the patches file) |
|
3999 |
" |
|
4000 |
self initStandardTools. |
|
10645 | 4001 |
]. |
4002 |
||
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
4003 |
" |
10071 | 4004 |
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
|
4005 |
" |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
4006 |
Display notNil ifTrue:[ |
22791 | 4007 |
Display deviceIOTimeoutErrorSignal handlerBlock:[:ex | |
4008 |
SaveEmergencyImage == true ifTrue:[ |
|
4009 |
'Display [warning]: broken display connection - emergency save in ''crash.img''.' infoPrintCR. |
|
4010 |
ObjectMemory primSnapShotOn:'crash.img'. |
|
4011 |
]. |
|
4012 |
'Display [warning]: broken display connection - exit.' infoPrintCR. |
|
4013 |
self exit:11. |
|
4014 |
]. |
|
4015 |
Display startDispatch. |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
4016 |
]. |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
4017 |
|
9016 | 4018 |
idx := CommandLineArguments indexOf:'--browserWindow:'. |
9029 | 4019 |
IsPlugin := (idx ~~ 0). |
4020 |
IsPlugin ifTrue:[ |
|
22791 | 4021 |
'Smalltalk [info]: startup browser window...' infoPrintCR. |
4022 |
self browserWindowStartup. |
|
4023 |
"/ not reached |
|
9012 | 4024 |
]. |
4025 |
||
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
4026 |
Initializing := false. |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
4027 |
|
2074
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
4028 |
"/ 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
|
4029 |
"/ 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
|
4030 |
"/ 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
|
4031 |
"/ 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
|
4032 |
|
7043
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
4033 |
process := [ |
22791 | 4034 |
'Smalltalk [info]: startup process 1 active.' infoPrintCR. |
4035 |
StartBlocks notNil ifTrue:[ |
|
4036 |
self executeStartBlocks. |
|
4037 |
StartBlocks := nil. |
|
4038 |
]. |
|
4039 |
ImageStartBlocks notNil ifTrue:[ |
|
4040 |
'Smalltalk [info]: execute imageStartBlocks...' infoPrintCR. |
|
4041 |
ImageStartBlocks do:[:aBlock| |
|
4042 |
aBlock value |
|
4043 |
]. |
|
4044 |
]. |
|
4045 |
StandAlone ifFalse:[ |
|
4046 |
(SilentLoading == true) ifFalse:[ "i.e. undefined counts as false" |
|
4047 |
thisIsARestart ifTrue:[ |
|
4048 |
Transcript cr. |
|
4049 |
Transcript showCR:('Smalltalk restarted from:' |
|
4050 |
, imageName |
|
4051 |
, ' (saved ' |
|
4052 |
, ObjectMemory imageSaveTime printString |
|
4053 |
, ')' ). |
|
4054 |
] ifFalse:[ |
|
4055 |
Transcript showCR:(self hello). |
|
4056 |
Transcript showCR:(self copyrightString). |
|
4057 |
]. |
|
4058 |
Transcript cr. |
|
4059 |
]. |
|
4060 |
||
4061 |
DemoMode==true ifTrue:[ |
|
4062 |
Transcript showCR:'*** Restricted use: ***'. |
|
4063 |
Transcript showCR:'*** This program may be used for education only. ***'. |
|
4064 |
Transcript showCR:'*** Please read the files COPYRIGHT and LICENSE ***'. |
|
4065 |
Transcript showCR:'*** for more details. ***'. |
|
4066 |
Transcript cr. |
|
4067 |
]. |
|
4068 |
]. |
|
4069 |
||
4070 |
thisIsARestart ifTrue:[ |
|
4071 |
"/ |
|
4072 |
"/ the final late notification - users can now assume that |
|
4073 |
"/ views, forms etc. have been recreated. |
|
4074 |
||
4075 |
ObjectMemory changed:#returnFromSnapshot. |
|
4076 |
] |
|
7039
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
4077 |
|
7040 | 4078 |
] newProcess. |
4079 |
||
9043
e6106f500263
do not use numeric process prios
Claus Gittinger <cg@exept.de>
parents:
9036
diff
changeset
|
4080 |
process priority:(Processor userSchedulingPriority). |
7043
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
4081 |
process name:'start block handler'. |
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
4082 |
process beGroupLeader. |
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
4083 |
process resume. |
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
4084 |
process := nil. |
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
4085 |
|
10139
a3f6265978ad
Start bachgroundCollector and -Finalizer in mainStartup
Stefan Vogel <sv@exept.de>
parents:
10131
diff
changeset
|
4086 |
ObjectMemory startBackgroundCollectorAt:5. |
a3f6265978ad
Start bachgroundCollector and -Finalizer in mainStartup
Stefan Vogel <sv@exept.de>
parents:
10131
diff
changeset
|
4087 |
ObjectMemory startBackgroundFinalizationAt:5. |
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
4088 |
|
2074
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
4089 |
"/ 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
|
4090 |
"/ message. |
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
4091 |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
4092 |
(StartupClass notNil and:[StartupSelector notNil]) ifTrue:[ |
22791 | 4093 |
" |
4094 |
allow more customization by reading an image specific rc-file |
|
4095 |
" |
|
4096 |
thisIsARestart ifTrue:[ |
|
4097 |
(imageName asFilename hasSuffix:'img') ifTrue:[ |
|
4098 |
imageName := imageName copyButLast:4 |
|
4099 |
]. |
|
4100 |
self fileIn:(imageName , '.rc') |
|
4101 |
]. |
|
4102 |
||
4103 |
Display notNil ifTrue:[ |
|
4104 |
Display exitOnLastClose:true. |
|
4105 |
]. |
|
4106 |
Processor exitWhenNoMoreUserProcesses:true. |
|
4107 |
||
4108 |
process := [ |
|
4109 |
'Smalltalk [info]: startup process 2 active.' infoPrintCR. |
|
4110 |
StandAlone ifTrue:[ |
|
4111 |
AbortOperationRequest handle:[:ex | |
|
4112 |
'Smalltalk [info]: aborted - exit.' infoPrintCR. |
|
4113 |
OperatingSystem exit:1 |
|
4114 |
] do:[ |
|
4115 |
('Smalltalk [info]: call ',StartupSelector,' of ',StartupClass name,' (1)') infoPrintCR. |
|
4116 |
StartupClass perform:StartupSelector withArguments:StartupArguments. |
|
4117 |
] |
|
4118 |
] ifFalse:[ |
|
4119 |
('Smalltalk [info]: call ',StartupSelector,' of ',StartupClass name,' (2)') infoPrintCR. |
|
4120 |
StartupClass perform:StartupSelector withArguments:StartupArguments. |
|
4121 |
]. |
|
4122 |
||
4123 |
"/ |
|
4124 |
"/ non-GUI apps exit after the startup; |
|
4125 |
"/ assume that GUI apps have created & opened some view ... |
|
4126 |
"/ |
|
4127 |
Display isNil ifTrue:[ |
|
4128 |
'Smalltalk [info]: no Display - exit.' infoPrintCR. |
|
4129 |
Smalltalk exit:11. |
|
4130 |
]. |
|
16666 | 4131 |
"/ "/ |
4132 |
"/ "/ GUI apps exit after the last user process has finished |
|
4133 |
"/ "/ |
|
4134 |
"/ Display exitOnLastClose:true. |
|
22791 | 4135 |
Processor exitWhenNoMoreUserProcesses:true. |
4136 |
] newProcess. |
|
4137 |
process priority:(Processor userSchedulingPriority). |
|
4138 |
process name:'main'. |
|
4139 |
process beGroupLeader. |
|
4140 |
process resume. |
|
4141 |
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
|
4142 |
]. |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4143 |
|
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4144 |
StandAlone ifTrue:[ |
22791 | 4145 |
Display notNil ifTrue:[ |
4146 |
FlyByHelp notNil ifTrue:[ |
|
4147 |
FlyByHelp start |
|
4148 |
]. |
|
4149 |
]. |
|
16211 | 4150 |
]. |
4151 |
||
20746 | 4152 |
"/ Display notNil ifTrue:[ |
4153 |
"/ Display exitOnLastClose:true. |
|
4154 |
"/ ]. |
|
21592 | 4155 |
OperatingSystem finishLaunching. |
22791 | 4156 |
|
11681
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4157 |
" |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4158 |
if view-classes exist, start dispatching; |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4159 |
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
|
4160 |
" |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4161 |
((Display notNil and:[graphicalMode]) |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4162 |
or:[process notNil |
13851
5ab434e0a636
changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents:
13850
diff
changeset
|
4163 |
or:[HeadlessOperation |
20827 | 4164 |
or:[StandAlone]]] |
4165 |
) ifTrue:[ |
|
22791 | 4166 |
Processor exitWhenNoMoreUserProcesses:true. |
4167 |
Processor dispatchLoop. |
|
4168 |
"done - the last process finished" |
|
4169 |
'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
|
4170 |
] ifFalse:[ |
22791 | 4171 |
StandAlone ifFalse:[ |
4172 |
self readEvalPrintLoop |
|
4173 |
] |
|
11681
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4174 |
]. |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4175 |
|
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4176 |
self exit |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4177 |
|
13526 | 4178 |
"Created: / 18-07-1996 / 21:07:39 / cg" |
4179 |
"Modified: / 09-09-1996 / 17:42:50 / stefan" |
|
21592 | 4180 |
"Modified: / 28-02-2017 / 10:59:43 / cg" |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
4181 |
! |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
4182 |
|
10641 | 4183 |
openDisplay |
4184 |
"try to open a display connection. |
|
4185 |
If so, also read display- and keyboard.rc" |
|
4186 |
||
13385 | 4187 |
|commandName| |
4188 |
||
4189 |
commandName := Smalltalk commandName. |
|
4190 |
(commandName, ' [info]: opening display...') infoPrintCR. |
|
10649 | 4191 |
|
10641 | 4192 |
Display isNil ifTrue:[ |
22791 | 4193 |
Screen notNil ifTrue:[ |
4194 |
[ |
|
4195 |
Screen openDefaultDisplay:nil. |
|
4196 |
] on:Screen deviceOpenErrorSignal do:[:ex| |
|
4197 |
"do not use #errorPrintCR, it is no error, when an app supports display and no display. |
|
4198 |
in case shell exec 'app --version' we do not want this error string as part of the output" |
|
4199 |
('%1 [error]: No display connection to: %2' bindWith:commandName with:ex parameter) infoPrintCR. |
|
19984 | 4200 |
"/ ('%1 [error]: No display connection to: %2' bindWith:commandName with:ex parameter) errorPrintCR. |
22791 | 4201 |
(commandName, ' [info]: Either set the DISPLAY environment variable,') infoPrintCR. |
4202 |
(commandName, ' [info]: or start smalltalk with a -display argument.') infoPrintCR. |
|
4203 |
HeadlessOperation == true ifFalse:[ |
|
4204 |
OperatingSystem exit:1. |
|
4205 |
]. |
|
4206 |
]. |
|
4207 |
||
4208 |
Display notNil ifTrue:[ |
|
4209 |
(self secureFileIn:'display.rc') ifFalse:[ |
|
4210 |
"/ 'Smalltalk [warning]: no display.rc found; screen setting might be wrong.' errorPrintCR. |
|
4211 |
(self secureFileIn:'keyboard.rc') ifFalse:[ |
|
4212 |
"/ 'Smalltalk [warning]: no keyboard.rc found; shortkey setting might be wrong.' errorPrintCR. |
|
4213 |
] |
|
4214 |
] |
|
4215 |
]. |
|
4216 |
] |
|
22636 | 4217 |
]. |
4218 |
||
4219 |
^ Display |
|
10641 | 4220 |
|
4221 |
"Created: / 06-12-2006 / 15:38:17 / cg" |
|
22636 | 4222 |
"Modified: / 20-03-2018 / 12:39:55 / stefan" |
10641 | 4223 |
! |
4224 |
||
20757 | 4225 |
providingDisplayDo:aBlock |
4226 |
"/ provide a Display, if needed |
|
4227 |
(Smalltalk at:#Screen) currentScreenQuerySignal handle:[:ex | |
|
22791 | 4228 |
Display isNil ifTrue:[ self lateOpenDisplay ]. |
4229 |
ex proceedWith:Display. |
|
4230 |
] do:aBlock |
|
20757 | 4231 |
! |
4232 |
||
20832 | 4233 |
readEvalPrintLoop |
4234 |
"say hello, then go into a read-eval-print loop" |
|
22791 | 4235 |
|
10641 | 4236 |
"{ Pragma: +optSpace }" |
4237 |
||
22791 | 4238 |
|repl| |
4239 |
||
4240 |
repl := ReadEvalPrintLoop new. |
|
4241 |
||
4242 |
SilentLoading == true ifTrue:[ |
|
22792 | 4243 |
repl answerPrompt:''. |
4244 |
repl prompt:''. |
|
22791 | 4245 |
] ifFalse:[ |
22792 | 4246 |
Transcript showCR:(self hello). |
4247 |
Transcript showCR:(self copyrightString). |
|
4248 |
Transcript cr. |
|
22793 | 4249 |
Transcript showCR:'Read-eval-print loop.'. |
4250 |
Transcript showCR:'(exit with "#exit" or EOF; help with "?"; expressions are terminated with ".")'. |
|
22792 | 4251 |
repl prompt:'STX> '. |
22791 | 4252 |
]. |
4253 |
||
4254 |
repl |
|
22792 | 4255 |
doChunkFormat:false; |
22831 | 4256 |
errorStream:Stderr; |
22792 | 4257 |
readEvalPrintLoop |
10641 | 4258 |
! |
4259 |
||
4260 |
restart |
|
4261 |
"startup after an image has been loaded; |
|
18385 | 4262 |
This is called by the VM's main entry - you should not find senders from Smalltalk. |
4263 |
||
10641 | 4264 |
there are three change-notifications made to dependents of ObjectMemory, |
4265 |
which allow a stepwise re-init: #earlyRestart, #restarted and #returnFromSnapshot. |
|
4266 |
||
4267 |
#earlySystemInstallation is sent for ST80 compatibility |
|
4268 |
||
4269 |
#earlyRestart is send first, nothing has been setup yet. |
|
18668 | 4270 |
(should be used to flush all device dependent entries) |
10641 | 4271 |
|
4272 |
#restarted is send right after. |
|
18668 | 4273 |
(should be used to recreate external resources (fds, bitmaps etc) |
10641 | 4274 |
|
4275 |
#returnFromSnapshot is sent last |
|
18668 | 4276 |
(should be used to restart processes, reOpen Streams which cannot |
4277 |
be automatically be reopened (i.e. Sockets, Pipes) and so on. |
|
4278 |
(Notice that positionable fileStreams are already reopened and repositioned) |
|
10641 | 4279 |
" |
4280 |
||
4281 |
|deb insp transcript idx| |
|
4282 |
||
4283 |
"/ |
|
4284 |
"/ when we arrive here, all objects from our previous life |
|
4285 |
"/ have been reloaded - however, some may still contain invalid device |
|
4286 |
"/ handles, display information etc. |
|
4287 |
"/ also, dynamically loaded modules have not yet been reloaded yet. |
|
4288 |
"/ and the concrete OS, concrete FileName etc. are still refering to |
|
4289 |
"/ the previous classes. |
|
4290 |
||
4291 |
Initializing := true. |
|
4292 |
AbstractOperatingSystem initializeConcreteClass. |
|
4293 |
||
4294 |
ImageRestartTime := Timestamp now. |
|
4295 |
||
4296 |
CommandLine := CommandLineArguments copy. |
|
4297 |
CommandLineArguments := CommandLineArguments asOrderedCollection. |
|
4298 |
CommandName := CommandLineArguments removeFirst. "/ the command |
|
4299 |
||
4300 |
idx := CommandLineArguments indexOf:'-q'. |
|
4301 |
idx == 0 ifTrue:[ |
|
18668 | 4302 |
idx := CommandLineArguments indexOf:'--silent'. |
10641 | 4303 |
]. |
4304 |
idx ~~ 0 ifTrue:[ |
|
18668 | 4305 |
Object infoPrinting:false. |
4306 |
ObjectMemory infoPrinting:false. |
|
4307 |
CommandLineArguments removeAtIndex:idx. |
|
16269 | 4308 |
]. |
4309 |
||
10641 | 4310 |
"/ start catching SIGSEGV and SIGBUS |
4311 |
OperatingSystem enableHardSignalInterrupts. |
|
4312 |
||
4313 |
"/ reinit Filename |
|
4314 |
Filename reinitialize. |
|
4315 |
||
4316 |
"/ flush cached path directories (may have changed in the meanwhile) |
|
4317 |
self flushPathCaches. |
|
15334 | 4318 |
self reinitializePackagePath. |
10641 | 4319 |
|
4320 |
"/ reinit the default streams: Stdin, Stdout and Stderr |
|
4321 |
"/ after that, we can write to stderr. |
|
4322 |
self reinitStandardStreams. |
|
4323 |
||
4324 |
"/ redirect Transcript to Stderr during startup |
|
4325 |
transcript := Transcript. |
|
4326 |
Transcript := Stderr. |
|
4327 |
||
4328 |
"/ temporary switch back to dumb interface - |
|
4329 |
"/ to handle errors while view-stuff is not yet reinitialized |
|
4330 |
insp := Inspector. |
|
4331 |
deb := Debugger. |
|
4332 |
deb notNil ifTrue:[ |
|
18668 | 4333 |
deb reinitialize |
10641 | 4334 |
]. |
4335 |
Inspector := MiniInspector. |
|
4336 |
Debugger := MiniDebugger. |
|
4337 |
||
4338 |
"/ reload any dynamically loaded objects. |
|
4339 |
"/ this must be done before doing anything else below, |
|
4340 |
"/ because the Processor may restart processes which use |
|
4341 |
"/ this code. |
|
4342 |
"/ Also, a dynamic object might be registered as dependent of |
|
4343 |
"/ ObjectFileLoader; therefore, must reload before doing any notifications. |
|
4344 |
||
4345 |
ObjectFileLoader notNil ifTrue:[ |
|
18668 | 4346 |
ObjectFileLoader reloadAllRememberedObjectFiles. |
16269 | 4347 |
]. |
4348 |
||
10641 | 4349 |
"/ invalidate all display connections. |
4350 |
"/ This is required to avoid trouble if someone accesses |
|
4351 |
"/ a display during early startup. |
|
4352 |
Screen notNil ifTrue:[ |
|
18668 | 4353 |
Screen allScreens do:[:eachDisplay | |
4354 |
eachDisplay invalidateConnection. |
|
4355 |
]. |
|
10641 | 4356 |
]. |
4357 |
||
4358 |
ObjectMemory changed:#earlySystemInstallation. |
|
4359 |
||
4360 |
"/ reinitialize the Processor - restartable processes |
|
4361 |
"/ are now restarted here (but not yet scheduled). |
|
4362 |
Processor reinitialize. |
|
4363 |
||
4364 |
"/ flush device handles & recreate OS resources (if possible) |
|
4365 |
"/ (mostly view/GC/color & font stuff) |
|
4366 |
ObjectMemory |
|
18668 | 4367 |
changed:#earlyRestart; changed:#restarted. |
16269 | 4368 |
|
10641 | 4369 |
"/ start catching SIGINT and SIGQUIT |
4370 |
OperatingSystem enableUserInterrupts. |
|
4371 |
OperatingSystem enableCrashSignalInterrupts. |
|
12782 | 4372 |
ObjectMemory restoreGarbageCollectorSettings. |
10641 | 4373 |
|
4374 |
"/ give user a chance to re-customize things in smalltalk_r.rc. |
|
4375 |
"/ reading if smalltalk_r.rc may be suppressed by the --faststart argument. |
|
4376 |
idx := CommandLineArguments indexOf:'--faststart'. |
|
4377 |
idx == 0 ifTrue:[ |
|
18668 | 4378 |
idx := CommandLineArguments indexOf:'--fastStart'. |
10641 | 4379 |
]. |
4380 |
idx ~~ 0 ifTrue:[ |
|
18668 | 4381 |
CommandLineArguments removeAtIndex:idx. |
10641 | 4382 |
] ifFalse:[ |
18668 | 4383 |
CallbackSignal := QuerySignal new. |
4384 |
[ |
|
4385 |
Class withoutUpdatingChangesDo:[ |
|
4386 |
(self fileIn:(self commandName , '_r.rc')) ifFalse:[ |
|
4387 |
"no _r.rc file where executable is; try default smalltalk_r.rc" |
|
4388 |
self fileIn:'smalltalk_r.rc' |
|
4389 |
]. |
|
4390 |
] |
|
4391 |
] on:CallbackSignal do:[:ex| |
|
4392 |
"/ now, display and view-stuff works; |
|
4393 |
"/ back to the previous debugging interface |
|
4394 |
Inspector := insp. |
|
4395 |
Debugger := deb. |
|
4396 |
||
4397 |
"/ reinstall Transcript, if not changed during restart. |
|
4398 |
"/ if there was no Transcript, go to stderr |
|
4399 |
(transcript notNil and:[Transcript == Stderr]) ifTrue:[ |
|
4400 |
Transcript := transcript. |
|
4401 |
]. |
|
4402 |
Initializing := false. |
|
4403 |
ex proceed. |
|
4404 |
]. |
|
4405 |
CallbackSignal := nil. |
|
10641 | 4406 |
]. |
4407 |
||
4408 |
"/ reinitialization (restart) of Display is normally performed |
|
4409 |
"/ in the restart script. If this has not been run for some reason, |
|
4410 |
"/ do in now. |
|
4411 |
Initializing ifTrue:[ |
|
18668 | 4412 |
Display notNil ifTrue:[ |
4413 |
[ |
|
4414 |
Display reinitializeFor:Screen defaultDisplayName. |
|
4415 |
] on:Screen deviceOpenErrorSignal do:[ |
|
4416 |
'Smalltalk [error]: Cannot restart connection to: ' errorPrint. |
|
4417 |
Screen defaultDisplayName errorPrintCR. |
|
4418 |
OperatingSystem exit:1. |
|
4419 |
]. |
|
4420 |
]. |
|
4421 |
"/ now, display and view-stuff works; |
|
4422 |
"/ back to the previous debugging interface |
|
4423 |
||
4424 |
Inspector := insp. |
|
4425 |
Debugger := deb. |
|
4426 |
||
4427 |
"/ reinstall Transcript, if not changed during restart. |
|
4428 |
"/ if there was no Transcript, go to stderr |
|
4429 |
||
4430 |
(transcript notNil and:[Transcript == Stderr]) ifTrue:[ |
|
4431 |
Transcript := transcript. |
|
4432 |
]. |
|
4433 |
Initializing := false. |
|
10641 | 4434 |
]. |
4435 |
Screen notNil ifTrue:[ |
|
18668 | 4436 |
"clean up leftover screens (and views) that haven't been reopened. |
4437 |
Operate on a copy, since brokenConnection removes us from AllScreens" |
|
4438 |
Screen allScreens copy do:[:eachDisplay | |
|
4439 |
eachDisplay isOpen ifFalse:[ |
|
4440 |
'Smalltalk [info]: cannot reopen secondary display: ' errorPrint. |
|
4441 |
eachDisplay errorPrintCR. |
|
4442 |
eachDisplay cleanupAfterDispatch; brokenConnection. |
|
4443 |
] |
|
4444 |
]. |
|
10641 | 4445 |
]. |
4446 |
||
4447 |
deb := insp := transcript := nil. "avoid dangling refs" |
|
13526 | 4448 |
(StartupClass perform:#keepSplashWindowOpen ifNotUnderstood:[false]) ifFalse:[ |
18668 | 4449 |
self hideSplashWindow. "/ if there is one, it's now time to hide it |
13526 | 4450 |
]. |
10641 | 4451 |
self mainStartup:true |
4452 |
||
13526 | 4453 |
"Modified: / 03-08-1999 / 09:42:21 / stefan" |
4454 |
"Modified: / 29-07-2011 / 17:58:23 / cg" |
|
1 | 4455 |
! |
4456 |
||
11399 | 4457 |
showSplashMessage:aString |
4458 |
"put the message into the splash screen (if there is one). |
|
4459 |
Use this for messages during startup" |
|
4460 |
||
4461 |
self showSplashMessage:aString color:nil. |
|
4462 |
! |
|
4463 |
||
11388 | 4464 |
showSplashMessage:aMessageStringOrNil color:rgbValueOrNil |
11389 | 4465 |
"put the message into the splash screen (if there is one)." |
4466 |
||
11388 | 4467 |
%{ |
4468 |
#ifdef WIN32 |
|
4469 |
extern void __win32_splashMessage(); |
|
4470 |
char *msg = (char *)0; |
|
4471 |
int clr = 0; |
|
4472 |
||
12481
805176d238d2
change __isString() to __isStringLike() in primitive code
Stefan Vogel <sv@exept.de>
parents:
12413
diff
changeset
|
4473 |
if (__isStringLike(aMessageStringOrNil)) { |
18668 | 4474 |
msg = __stringVal(aMessageStringOrNil); |
11388 | 4475 |
} |
4476 |
if (__isSmallInteger(rgbValueOrNil)) { |
|
18668 | 4477 |
clr = __intVal(rgbValueOrNil); |
4478 |
__win32_splashMessageColor(clr); |
|
11388 | 4479 |
} |
4480 |
__win32_splashMessage(msg); |
|
4481 |
#endif |
|
4482 |
%} |
|
4483 |
! |
|
4484 |
||
4485 |
splashInfo:aString |
|
11389 | 4486 |
"like infoPrintCR, |
4487 |
but in addition put the message into the splash screen (if there is one). |
|
4488 |
Use this for info messages during startup" |
|
4489 |
||
12883 | 4490 |
aString notNil ifTrue:[ aString infoPrintCR ]. |
11388 | 4491 |
self showSplashMessage:aString color:nil. |
4492 |
! |
|
4493 |
||
7563 | 4494 |
start |
20831 | 4495 |
"low level entry from the VM's main. |
4496 |
After initializeSystem, this is the very first real entry into the Smalltalk world. |
|
22791 | 4497 |
Analyzes the command line and checks what to do |
20831 | 4498 |
(i.e. script/repl/eval or full blown IDE). |
4499 |
Also handles --load and various debug options. |
|
22791 | 4500 |
Caveat: |
4501 |
this has become too complicated and desperately needs a rewrite. |
|
21020 | 4502 |
|
4503 |
Also: |
|
22791 | 4504 |
Be very careful when changing things here; |
4505 |
especially be careful to ensure that the scripting options are robust against any |
|
4506 |
missing packages; so the error handlers should not depend on any stream, logger etc. features. |
|
21020 | 4507 |
" |
617 | 4508 |
|
15872 | 4509 |
|idx graphicalMode arg didReadRCFile keepSplashWindow| |
960
e3b75f50d0cd
changes for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
4510 |
|
19597 | 4511 |
graphicalMode := Smalltalk isSmalltalkDevelopmentSystem. |
617 | 4512 |
Initializing := true. |
4513 |
||
15872 | 4514 |
keepSplashWindow := StartupClass perform:#keepSplashWindowOpen ifNotUnderstood:[false]. |
13526 | 4515 |
|
21016 | 4516 |
idx := CommandLineArguments indexOf:'--debug'. |
4517 |
(idx ~~ 0) ifTrue:[ |
|
22791 | 4518 |
CommandLineArguments removeAtIndex:idx. |
4519 |
]. |
|
21016 | 4520 |
|
617 | 4521 |
" |
4522 |
while reading patches- and rc-file, do not add things into change-file |
|
4523 |
" |
|
4524 |
Class withoutUpdatingChangesDo:[ |
|
22791 | 4525 |
|commandFiles rcFile defaultRC prevCatchSetting |
4526 |
isEval isPrint isFilter isRepl isRunMain idxFileArg process| |
|
4527 |
||
4528 |
isEval := isPrint := isFilter := isRepl := isRunMain := false. |
|
4529 |
didReadRCFile := false. |
|
4530 |
||
4531 |
StandAlone ifFalse:[ |
|
4532 |
"/ self initializeVerboseFlags. |
|
4533 |
||
4534 |
"/ |
|
4535 |
"/ look for any '-q', '-e', '-l' or '-f' command line arguments |
|
4536 |
"/ and handle them; |
|
4537 |
"/ read startup and patches file |
|
4538 |
"/ |
|
4539 |
idx := CommandLineArguments indexOfAny:#('-R' '--repl'). |
|
4540 |
isRepl := IsRepl := (idx ~~ 0). |
|
4541 |
||
4542 |
idx := CommandLineArguments indexOfAny:#('-q' '--silent'). |
|
4543 |
idx ~~ 0 ifTrue:[ |
|
4544 |
Object infoPrinting:false. |
|
4545 |
ObjectMemory infoPrinting:false. |
|
4546 |
CommandLineArguments removeAtIndex:idx. |
|
4547 |
SilentLoading := true. |
|
4548 |
]. |
|
4549 |
||
4550 |
[ |
|
4551 |
idx := CommandLineArguments indexOfAny:#('-pp' '--packagePath'). |
|
4552 |
idx ~~ 0 |
|
4553 |
] whileTrue:[ |
|
4554 |
arg := CommandLineArguments at:idx + 1. |
|
4555 |
CommandLineArguments removeAtIndex:idx+1; removeAtIndex:idx. |
|
4556 |
(arg asCollectionOfSubstringsSeparatedByAny:',;') do:[:each | |
|
4557 |
self packagePath addLast:each. |
|
4558 |
VerboseStartup ifTrue:[ |
|
4559 |
('Smalltalk [info]: add to packagePath: "', arg, '".') infoPrintCR. |
|
4560 |
]. |
|
4561 |
]. |
|
4562 |
]. |
|
4563 |
||
4564 |
[ |
|
4565 |
idx := CommandLineArguments indexOfAny:#('-l' '--load'). |
|
4566 |
idx ~~ 0 |
|
4567 |
] whileTrue:[ |
|
4568 |
arg := CommandLineArguments at:idx + 1. |
|
4569 |
CommandLineArguments removeAtIndex:idx+1; removeAtIndex:idx. |
|
4570 |
Smalltalk silentlyLoadingDo:[ |
|
4571 |
(arg asCollectionOfSubstringsSeparatedByAny:',;') do:[:each | |
|
4572 |
each asFilename exists ifTrue:[ |
|
4573 |
(VerboseStartup | VerboseLoading) ifTrue:[ |
|
4574 |
('Smalltalk [info]: loading file: "', each, '".') infoPrintCR. |
|
4575 |
]. |
|
4576 |
Smalltalk fileIn:each |
|
4577 |
] ifFalse:[ |
|
4578 |
(VerboseStartup | VerboseLoading) ifTrue:[ |
|
4579 |
('Smalltalk [info]: loading package: "', each, '".') infoPrintCR. |
|
4580 |
]. |
|
4581 |
Smalltalk loadPackage:each |
|
4582 |
]. |
|
4583 |
]. |
|
4584 |
]. |
|
4585 |
]. |
|
4586 |
||
4587 |
"/ look for a '-e filename' or '--execute filename' or '--script filename' argument |
|
4588 |
"/ this will force fileIn of filename only, no standard startup. |
|
4589 |
||
4590 |
idx := CommandLineArguments indexOfAny:#('-e' '--execute' '--script'). |
|
4591 |
idx ~~ 0 ifTrue:[ |
|
4592 |
SilentLoading := true. |
|
4593 |
CommandName := arg := CommandLineArguments at:idx + 1. |
|
4594 |
||
4595 |
CommandLineArguments |
|
4596 |
removeAtIndex:idx+1; removeAtIndex:idx. |
|
4597 |
||
4598 |
self startSchedulerAndBackgroundCollector. |
|
4599 |
keepSplashWindow ifFalse:[ self hideSplashWindow ]. |
|
4600 |
Initializing := false. |
|
4601 |
||
4602 |
process := [ |
|
4603 |
Processor exitWhenNoMoreUserProcesses:true. |
|
4604 |
||
4605 |
"/ set workspace variables |
|
4606 |
self defineCommandLineAsWorkspaceVariablesForScripts. |
|
4607 |
||
4608 |
"/ provide a Display, if needed |
|
4609 |
self providingDisplayDo:[ |
|
4610 |
VerboseStartup ifTrue:[ |
|
4611 |
('Smalltalk [info]: reading script from: "', arg, '".') infoPrintCR. |
|
4612 |
]. |
|
4613 |
NoHandlerError handle:[:ex | |
|
4614 |
Debugging == true ifTrue:[ |
|
4615 |
MiniDebugger enterException:ex. |
|
4616 |
] ifFalse:[ |
|
4617 |
Silent ifFalse:[ |
|
4618 |
'Smalltalk [error]: ' _errorPrint. ex exception description _errorPrintCR. |
|
4619 |
]. |
|
4620 |
(VerboseStartup or:[ObjectMemory debugPrinting]) ifTrue:[ |
|
4621 |
ex suspendedContext fullPrintAll. |
|
4622 |
]. |
|
4623 |
self exit:1. |
|
4624 |
]. |
|
4625 |
self exit:1. |
|
4626 |
"/ ex reject. |
|
4627 |
] do:[ |
|
4628 |
UserInterrupt handle:[:ex | |
|
4629 |
Debugging == true ifTrue:[ |
|
4630 |
'user interrupt (type "c" to continue; "x" to exit; "?" for help).' errorPrintCR. |
|
4631 |
"/ thisContext fullPrintAll. |
|
4632 |
MiniDebugger enterException:ex. |
|
4633 |
ex proceed. |
|
4634 |
]. |
|
4635 |
Silent ifFalse:[ 'user interrupt.' errorPrintCR ]. |
|
4636 |
self exit:128+(OperatingSystem sigINT). |
|
4637 |
] do:[ |
|
4638 |
|cmdStream result| |
|
4639 |
||
4640 |
arg = '-' ifTrue:[ |
|
4641 |
cmdStream := Stdin. |
|
4642 |
] ifFalse:[ |
|
4643 |
IsSTScript := true. |
|
4644 |
cmdStream := arg asFilename readStream. |
|
4645 |
]. |
|
4646 |
result := [ |
|
4647 |
self fileInStream:cmdStream |
|
4648 |
lazy:nil |
|
4649 |
silent:self verbose not |
|
4650 |
logged:false |
|
4651 |
addPath:nil |
|
4652 |
] ensure:[ |
|
4653 |
IsSTScript ifTrue:[ |
|
4654 |
"/ do not close Stdin |
|
4655 |
cmdStream close. |
|
4656 |
]. |
|
4657 |
]. |
|
4658 |
result ifFalse:[ |
|
4659 |
self exit:1. |
|
4660 |
]. |
|
4661 |
]. |
|
4662 |
]. |
|
4663 |
]. |
|
4664 |
||
4665 |
"/ after the script, if Screen has been opened and there are any open windows, |
|
4666 |
"/ then do not exit |
|
20758 | 4667 |
false ifTrue:[ |
22791 | 4668 |
Display notNil ifTrue:[ |
4669 |
Processor exitWhenNoMoreUserProcesses:true. |
|
4670 |
"/ Display exitOnLastClose:true. |
|
4671 |
"/ Display checkForEndOfDispatch. |
|
4672 |
] ifFalse:[ |
|
4673 |
self exit. |
|
4674 |
]. |
|
20758 | 4675 |
]. |
22791 | 4676 |
] newProcess. |
4677 |
process priority:(Processor userSchedulingPriority). |
|
4678 |
process name:'main'. |
|
4679 |
process beGroupLeader. |
|
4680 |
process resume. |
|
4681 |
||
4682 |
Processor dispatchLoop. |
|
4683 |
self exit |
|
4684 |
]. |
|
4685 |
||
4686 |
"look for a '-f filename' or '--file filename' argument |
|
4687 |
if scripting, these are loaded before -P, -E or -R action. |
|
4688 |
if not scripting, this will force evaluation of filename instead of smalltalk.rc" |
|
4689 |
[ |
|
4690 |
idxFileArg := CommandLineArguments indexOfAny:#('-f' '--file'). |
|
4691 |
(idxFileArg ~~ 0) |
|
4692 |
] whileTrue:[ |
|
4693 |
commandFiles isNil ifTrue:[ commandFiles := OrderedCollection new ]. |
|
4694 |
commandFiles add:(CommandLineArguments at:idxFileArg+1). |
|
4695 |
CommandLineArguments removeAtIndex:idxFileArg+1; removeAtIndex:idxFileArg. |
|
4696 |
]. |
|
4697 |
||
4698 |
"/ look for a '-E expr' or '--eval expr' argument (-P or --print to print the result of evaluation) |
|
4699 |
"/ or -F/--filter or a '--repl' argument |
|
4700 |
"/ E, P and F this will force evaluation of expr only, no standard startup |
|
4701 |
"/ repl go into an interactive loop. |
|
4702 |
idx := CommandLineArguments indexOfAny:#('-E' '--eval'). |
|
4703 |
(isEval := (idx ~~ 0)) ifFalse:[ |
|
4704 |
idx := CommandLineArguments indexOfAny:#('-P' '--print'). |
|
4705 |
(isPrint := (idx ~~ 0)) ifFalse:[ |
|
4706 |
idx := CommandLineArguments indexOfAny:#('-F' '--filter'). |
|
4707 |
(isFilter := (idx ~~ 0)) ifFalse:[ |
|
4708 |
idx := CommandLineArguments indexOfAny:#('-R' '--repl'). |
|
4709 |
(isRepl := (idx ~~ 0)) ifFalse:[ |
|
4710 |
idx := CommandLineArguments indexOfAny:#('--run'). |
|
4711 |
isRunMain := (idx ~~ 0) |
|
4712 |
]. |
|
4713 |
]. |
|
4714 |
]. |
|
4715 |
]. |
|
4716 |
||
4717 |
(isEval | isPrint | isFilter | isRepl | isRunMain) ifTrue:[ |
|
4718 |
|args| |
|
4719 |
||
4720 |
VerboseStartup ifTrue:[ |
|
4721 |
('Smalltalk [info]: eval/filter/print or repl') infoPrintCR. |
|
4722 |
]. |
|
4723 |
isRepl ifFalse:[ |
|
4724 |
CommandLineArguments size <= idx ifTrue:[ |
|
4725 |
StandAlone := true. |
|
4726 |
self exitWithErrorMessage:'missing argument after -E/-P/-F/--run.'. |
|
4727 |
]. |
|
4728 |
isFilter ifTrue:[ |
|
4729 |
args := CommandLineArguments copyFrom:idx + 1. |
|
4730 |
CommandLineArguments removeFromIndex:idx+1. |
|
4731 |
VerboseStartup ifTrue:[ |
|
4732 |
('Smalltalk [info]: filter expression(s): ') infoPrint. |
|
4733 |
args infoPrintCR. |
|
4734 |
]. |
|
4735 |
] ifFalse:[ |
|
4736 |
arg := CommandLineArguments at:idx + 1. |
|
4737 |
CommandLineArguments removeAtIndex:idx+1. |
|
4738 |
VerboseStartup ifTrue:[ |
|
4739 |
('Smalltalk [info]: eval expression: ') infoPrint. |
|
4740 |
arg infoPrintCR. |
|
4741 |
]. |
|
4742 |
]. |
|
4743 |
]. |
|
4744 |
CommandLineArguments removeAtIndex:idx. |
|
4745 |
||
4746 |
self startSchedulerAndBackgroundCollector. |
|
4747 |
||
4748 |
keepSplashWindow ifFalse:[ self hideSplashWindow ]. |
|
4749 |
Initializing := false. |
|
4750 |
||
4751 |
"/ set workspace variables |
|
4752 |
self defineCommandLineAsWorkspaceVariablesForScripts. |
|
4753 |
||
4754 |
"/ all of the above allow for a -f file to be loaded before any other action |
|
4755 |
(commandFiles notEmptyOrNil) ifTrue:[ |
|
4756 |
commandFiles do:[:commandFile | |
|
4757 |
(VerboseStartup | VerboseLoading) ifTrue:[ |
|
4758 |
('Smalltalk [info]: reading command file from: "', commandFile, '".') infoPrintCR. |
|
4759 |
]. |
|
4760 |
Smalltalk silentlyLoadingDo:[ |
|
4761 |
(self secureFileIn:commandFile) ifFalse:[ |
|
4762 |
StandAlone := true. |
|
4763 |
self exitWithErrorMessage:('"', commandFile, '" not found.'). |
|
4764 |
] |
|
4765 |
] |
|
4766 |
] |
|
4767 |
]. |
|
4768 |
||
4769 |
isRepl ifFalse:[ |
|
4770 |
Debugging == true ifFalse:[ |
|
4771 |
"/ remove the Debugger |
|
4772 |
Debugger := nil. |
|
4773 |
]. |
|
4774 |
]. |
|
4775 |
||
4776 |
process := [ |
|
4777 |
self providingDisplayDo:[ |
|
4778 |
isRepl ifTrue:[ |
|
4779 |
Processor exitWhenNoMoreUserProcesses:false. |
|
4780 |
Processor activeProcess name:'repl'. |
|
4781 |
self readEvalPrintLoop. |
|
4782 |
self exit. |
|
4783 |
]. |
|
4784 |
||
4785 |
Processor exitWhenNoMoreUserProcesses:true. |
|
4786 |
||
4787 |
NoHandlerError handle:[:ex | |
|
4788 |
Debugging == true ifTrue:[ |
|
4789 |
MiniDebugger enterException:ex. |
|
4790 |
] ifFalse:[ |
|
4791 |
Silent ifFalse:[ |
|
4792 |
'Smalltalk [error]: ' _errorPrint. ex description _errorPrintCR. |
|
4793 |
]. |
|
4794 |
(VerboseStartup or:[ObjectMemory debugPrinting]) ifTrue:[ |
|
4795 |
ex suspendedContext fullPrintAll. |
|
4796 |
]. |
|
4797 |
self exit:1. |
|
4798 |
]. |
|
4799 |
self exit:1. |
|
4800 |
"/ ex reject. |
|
4801 |
] do:[ |
|
4802 |
UserInterrupt handle:[:ex | |
|
4803 |
Debugging == true ifTrue:[ |
|
4804 |
'user interrupt (type "c" to continue; "x" to exit; "?" for help).' errorPrintCR. |
|
4805 |
"/ thisContext fullPrintAll. |
|
4806 |
MiniDebugger enterException:ex. |
|
4807 |
ex proceed. |
|
4808 |
]. |
|
4809 |
Silent ifFalse:[ 'user interrupt.' errorPrintCR ]. |
|
4810 |
self exit:128+(OperatingSystem sigINT). |
|
4811 |
] do:[ |
|
4812 |
|filterCode filterStart filterEnd| |
|
4813 |
||
4814 |
isFilter ifTrue:[ |
|
4815 |
"/ --filter - apply code to each input line. |
|
4816 |
"/ compile code only once |
|
4817 |
(args size == 1) ifTrue:[ |
|
4818 |
VerboseStartup ifTrue:[ |
|
4819 |
'Smalltalk [info]: filter 1-arg' infoPrintCR. |
|
4820 |
]. |
|
4821 |
filterCode := args at:1. |
|
4822 |
] ifFalse:[ |
|
4823 |
(args size == 3) ifTrue:[ |
|
4824 |
VerboseStartup ifTrue:[ |
|
4825 |
'Smalltalk [info]: filter 3-arg' infoPrintCR. |
|
4826 |
]. |
|
4827 |
filterStart := args at:1. |
|
4828 |
filterCode := args at:2. |
|
4829 |
filterEnd := args at:3. |
|
4830 |
] ifFalse:[ |
|
4831 |
StandAlone := true. |
|
4832 |
self exitWithErrorMessage:'--filter must be followed by 1 or 3 expression arg(s)' |
|
4833 |
]. |
|
4834 |
]. |
|
4835 |
filterStart notEmptyOrNil ifTrue:[ |
|
4836 |
VerboseStartup ifTrue:[ |
|
4837 |
('Smalltalk [info]: eval: "', filterStart, '"...') infoPrintCR. |
|
4838 |
]. |
|
4839 |
Compiler evaluate:filterStart notifying:(EvalScriptingErrorHandler new source:filterStart) |
|
4840 |
]. |
|
4841 |
VerboseStartup ifTrue:[ |
|
4842 |
('Smalltalk [info]: compile: "', filterCode, '"...') infoPrintCR. |
|
4843 |
]. |
|
4844 |
Compiler |
|
4845 |
compile:'doIt:line ',filterCode |
|
4846 |
forClass:String |
|
4847 |
notifying:(EvalScriptingErrorHandler new source:filterCode). |
|
4848 |
||
4849 |
[Stdin atEnd] whileFalse:[ |
|
4850 |
|line| |
|
4851 |
||
4852 |
line := Stdin nextLine. |
|
4853 |
line doIt:line. |
|
4854 |
]. |
|
4855 |
filterEnd notEmptyOrNil ifTrue:[ |
|
4856 |
VerboseStartup ifTrue:[ |
|
4857 |
('Smalltalk [info]: eval: "', filterEnd, '"...') infoPrintCR. |
|
4858 |
]. |
|
4859 |
Compiler evaluate:filterEnd notifying:(EvalScriptingErrorHandler new source:filterEnd) |
|
4860 |
]. |
|
4861 |
] ifFalse:[ |
|
4862 |
(isPrint | isEval) ifTrue:[ |
|
4863 |
"/ --print or --eval |
|
4864 |
|rslt| |
|
4865 |
||
4866 |
rslt := Parser new |
|
4867 |
evaluate:arg |
|
4868 |
notifying:(EvalScriptingErrorHandler new source:arg) |
|
4869 |
compile:true. |
|
4870 |
isPrint ifTrue:[ |
|
4871 |
rslt printCR. |
|
4872 |
]. |
|
4873 |
] ifFalse:[ |
|
4874 |
"/ --run <className> |
|
4875 |
|className class| |
|
4876 |
||
4877 |
className := arg. |
|
4878 |
class := Smalltalk classNamed:className. |
|
4879 |
class isNil ifTrue:[ |
|
4880 |
StandAlone := true. |
|
4881 |
self exitWithErrorMessage:'no such class: "', className, '".' |
|
4882 |
]. |
|
4883 |
(class respondsTo:#main:) ifTrue:[ |
|
4884 |
class main:CommandLineArguments. |
|
4885 |
] ifFalse:[ |
|
4886 |
(class respondsTo:#main) ifTrue:[ |
|
4887 |
class main. |
|
4888 |
] ifFalse:[ |
|
4889 |
(class respondsTo:#start) ifTrue:[ |
|
4890 |
class start. |
|
4891 |
] ifFalse:[ |
|
4892 |
StandAlone := true. |
|
4893 |
self exitWithErrorMessage:'class has no "main:", "main" or "start" method.' |
|
4894 |
]. |
|
4895 |
]. |
|
4896 |
]. |
|
4897 |
]. |
|
4898 |
]. |
|
4899 |
]. |
|
4900 |
]. |
|
4901 |
]. |
|
4902 |
||
4903 |
"/ after the script, if Screen has been opened and there are any open windows, |
|
4904 |
"/ then do not exit |
|
20758 | 4905 |
false ifTrue:[ |
22791 | 4906 |
Display notNil ifTrue:[ |
4907 |
Processor exitWhenNoMoreUserProcesses:true. |
|
4908 |
"/ Display exitOnLastClose:true. |
|
4909 |
"/ Display checkForEndOfDispatch. |
|
4910 |
VerboseStartup ifTrue:[ |
|
4911 |
('Smalltalk [info]: display opened.') infoPrintCR. |
|
4912 |
]. |
|
4913 |
] ifFalse:[ |
|
4914 |
VerboseStartup ifTrue:[ |
|
4915 |
('Smalltalk [info]: no display - exit after script.') infoPrintCR. |
|
4916 |
]. |
|
4917 |
self exit. |
|
4918 |
]. |
|
20758 | 4919 |
]. |
22791 | 4920 |
VerboseStartup ifTrue:[ |
4921 |
('Smalltalk [info]: script/repl/eval finished.') infoPrintCR. |
|
4922 |
]. |
|
4923 |
||
4924 |
] newProcess. |
|
4925 |
process priority:(Processor userSchedulingPriority). |
|
4926 |
process name:'main'. |
|
4927 |
process beGroupLeader. |
|
4928 |
process resume. |
|
4929 |
||
4930 |
Processor dispatchLoop. |
|
4931 |
VerboseStartup ifTrue:[ |
|
4932 |
('Smalltalk [info]: exit normally.') infoPrintCR. |
|
4933 |
]. |
|
4934 |
self exit |
|
4935 |
]. |
|
4936 |
]. |
|
4937 |
||
4938 |
commandFiles notNil ifTrue:[ |
|
4939 |
SilentLoading := true. "/ suppress the hello & copyright messages |
|
4940 |
self addStartBlock: |
|
4941 |
[ |
|
4942 |
commandFiles do:[:commandFile | |
|
4943 |
(self secureFileIn:commandFile) ifFalse:[ |
|
4944 |
self exitWithErrorMessage:('startup file "', commandFile, '" not found.'). |
|
4945 |
]. |
|
4946 |
]. |
|
4947 |
]. |
|
16091 | 4948 |
|
4949 |
"/ self startSchedulerAndBackgroundCollector. |
|
4950 |
"/ keepSplashWindow ifFalse:[ self hideSplashWindow ]. |
|
4951 |
"/ Initializing := false. |
|
4952 |
"/ |
|
4953 |
"/ (self secureFileIn:commandFile) ifFalse:[ |
|
4954 |
"/ ('Smalltalk [error]: startup file "', commandFile, '" not found.') errorPrintCR. |
|
4955 |
"/ OperatingSystem exit:1. |
|
4956 |
"/ ]. |
|
22791 | 4957 |
] ifFalse:[ |
4958 |
"/ look for <command>.rc |
|
4959 |
"/ if not found, read smalltalk.rc (or stxapp.rc for standAlone operation) |
|
4960 |
||
4961 |
rcFile := self commandName asFilename withSuffix:'rc'. |
|
4962 |
(didReadRCFile := rcFile exists and:[self secureFileIn:rcFile]) ifFalse:[ |
|
4963 |
StandAlone ifFalse:[ |
|
4964 |
defaultRC := 'smalltalk.rc' "/asFilename |
|
4965 |
] ifTrue:[ |
|
4966 |
defaultRC := 'stxapp.rc' "/asFilename |
|
4967 |
]. |
|
4968 |
"JV@2011-11-01: DO NOT check defaultRC exist - this prevents smalltalk to |
|
4969 |
to be started with different working directory than stx/projects/smalltalk !!!!!!" |
|
4970 |
||
4971 |
"/didReadRCFile := defaultRC exists and:[self secureFileIn:defaultRC]. |
|
4972 |
didReadRCFile := (self getSystemFileName:defaultRC) notNil |
|
4973 |
and:[self secureFileIn:defaultRC]. |
|
4974 |
didReadRCFile ifFalse:[ |
|
4975 |
StandAlone ifFalse:[ |
|
4976 |
'Smalltalk [warning]: no startup rc-file found. Going into line-by-line interpreter.' infoPrintCR. |
|
4977 |
graphicalMode := false. |
|
4978 |
] |
|
4979 |
] |
|
4980 |
]. |
|
4981 |
||
4982 |
"/ ('StandAlone is %1' bindWith:StandAlone) printCR. |
|
4983 |
"/ ('Headless is %1' bindWith:HeadlessOperation) printCR. |
|
4984 |
"/ ('Display is %1' bindWith:Display) printCR. |
|
4985 |
"/ ('Screen is %1' bindWith:Screen) printCR. |
|
4986 |
||
4987 |
keepSplashWindow ifFalse:[ self hideSplashWindow ]. |
|
4988 |
didReadRCFile ifFalse:[ |
|
4989 |
'private.rc' asFilename exists ifTrue:[ self secureFileIn:'private.rc' ]. |
|
4990 |
||
4991 |
"/ |
|
4992 |
"/ No RC file found; |
|
4993 |
"/ Setup more default stuff |
|
4994 |
"/ |
|
4995 |
StandAlone ifFalse:[ |
|
4996 |
"/ its a smalltalk - proceed in interpreter. |
|
4997 |
'Smalltalk [warning]: no startup rc-file found. Going into line-by-line interpreter.' infoPrintCR. |
|
4998 |
graphicalMode := false. |
|
4999 |
]. |
|
5000 |
||
5001 |
"/ setup more defaults... |
|
13537 | 5002 |
"/ ObjectMemory startBackgroundCollectorAt:5. |
5003 |
"/ ObjectMemory startBackgroundFinalizationAt:5. |
|
22791 | 5004 |
self addStartBlock:[ |
5005 |
self startSchedulerAndBackgroundCollector |
|
5006 |
]. |
|
5007 |
]. |
|
5008 |
]. |
|
5009 |
(CommandLineArguments includes:'--scripting') ifTrue:[ |
|
5010 |
self addStartBlock:[ |
|
5011 |
StandaloneStartup handleScriptingOptionsFromArguments:CommandLineArguments. |
|
5012 |
]. |
|
5013 |
]. |
|
617 | 5014 |
]. |
5015 |
||
10644 | 5016 |
HeadlessOperation ifTrue:[ |
22791 | 5017 |
graphicalMode := false. |
15872 | 5018 |
]. |
5019 |
||
5020 |
keepSplashWindow ifFalse:[ self hideSplashWindow ]. |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
5021 |
self mainStartup:graphicalMode |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
5022 |
|
15872 | 5023 |
"Modified: / 17-12-2013 / 16:44:40 / cg" |
22147 | 5024 |
"Modified: / 01-08-2017 / 11:08:47 / stefan" |
13536
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
5025 |
! |
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
5026 |
|
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
5027 |
startSchedulerAndBackgroundCollector |
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
5028 |
Processor startTimeSlicing. |
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
5029 |
Processor supportDynamicPriorities:true. |
13537 | 5030 |
|
5031 |
ObjectMemory startBackgroundCollectorAt:5. |
|
5032 |
ObjectMemory startBackgroundFinalizationAt:5. |
|
13536
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
5033 |
ObjectMemory backgroundCollectProcess priorityRange:(4 to:9). |
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
5034 |
ObjectMemory backgroundFinalizationProcess priorityRange:(4 to:9). |
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
5035 |
|
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
5036 |
"Created: / 31-07-2011 / 20:01:33 / cg" |
11808
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
5037 |
! |
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
5038 |
|
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
5039 |
startStartBlockProcess |
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
5040 |
"at the end of the smalltalk initialization, start all actions that |
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
5041 |
were delayed until the ProcessorScheduler is running in a separate process" |
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
5042 |
|
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
5043 |
|p| |
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
5044 |
|
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
5045 |
p := |
18668 | 5046 |
[ |
5047 |
self executeStartBlocks. |
|
5048 |
] newProcess. |
|
12022 | 5049 |
|
5050 |
p |
|
18668 | 5051 |
priority:(Processor userSchedulingPriority); |
5052 |
name:'start block handler'; |
|
5053 |
beGroupLeader; |
|
5054 |
resume. |
|
13892 | 5055 |
|
13893 | 5056 |
"Modified: / 07-01-2012 / 12:59:01 / cg" |
1097 | 5057 |
! ! |
5058 |
||
13947 | 5059 |
!Smalltalk class methodsFor:'startup and exit'! |
5060 |
||
5061 |
addExitBlock:aBlock |
|
5062 |
"{ Pragma: +optSpace }" |
|
5063 |
||
5064 |
"add a block to be executed when Smalltalk finishes. |
|
5065 |
This feature is currently not used anywhere - but could be useful for |
|
5066 |
cleanup in stand alone applications. |
|
5067 |
||
5068 |
Better use: ObjectMemory>>#addDependent: and handle the change message |
|
5069 |
#aboutToQuit." |
|
5070 |
||
5071 |
ExitBlocks isNil ifTrue:[ |
|
18668 | 5072 |
ExitBlocks := OrderedCollection with:aBlock |
13947 | 5073 |
] ifFalse:[ |
18668 | 5074 |
ExitBlocks add:aBlock |
13947 | 5075 |
] |
5076 |
! |
|
5077 |
||
5078 |
addImageStartBlock:aBlock |
|
5079 |
"{ Pragma: +optSpace }" |
|
5080 |
||
5081 |
"add a blocks to be executed in a separate process after |
|
5082 |
everything has been initialized. |
|
5083 |
These blocks will be executed after an image restart." |
|
5084 |
||
5085 |
ImageStartBlocks isNil ifTrue:[ |
|
18668 | 5086 |
ImageStartBlocks := OrderedCollection with:aBlock |
13947 | 5087 |
] ifFalse:[ |
18668 | 5088 |
ImageStartBlocks add:aBlock |
13947 | 5089 |
] |
5090 |
||
5091 |
"Created: 9.9.1996 / 16:48:20 / stefan" |
|
5092 |
! |
|
5093 |
||
5094 |
addStartBlock:aBlock |
|
15980 | 5095 |
"to be called ONLY during very early startup (before the process scheduler |
5096 |
is started) to add a block to be executed in a separate process after |
|
5097 |
everything has been initialized. |
|
5098 |
Used to allow a startup script (which is executed BEFORE the scheduler and |
|
5099 |
UI display is startup up) to add actions which require those subsystems to |
|
5100 |
be operating. |
|
5101 |
These blocks will be executed only once and not be executed after an image restart. |
|
13947 | 5102 |
Initial processes such as the launcher are usually started here |
15980 | 5103 |
(see smalltalk.rc / private.rc). |
5104 |
ONLY to be called from such an rc file." |
|
13947 | 5105 |
|
5106 |
"{ Pragma: +optSpace }" |
|
5107 |
||
15980 | 5108 |
"/ to protect against "mis-users" of this mehtod... |
5109 |
Initializing ifFalse:[ |
|
18668 | 5110 |
aBlock value |
16170
ca4d03def070
endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents:
16164
diff
changeset
|
5111 |
] ifTrue:[ |
18668 | 5112 |
StartBlocks isNil ifTrue:[ |
5113 |
StartBlocks := OrderedCollection with:aBlock |
|
5114 |
] ifFalse:[ |
|
5115 |
StartBlocks add:aBlock |
|
5116 |
] |
|
15980 | 5117 |
]. |
13947 | 5118 |
|
5119 |
"Created: / 09-09-1996 / 16:46:53 / stefan" |
|
5120 |
"Modified (comment): / 18-08-2011 / 09:18:42 / cg" |
|
5121 |
! |
|
5122 |
||
5123 |
exit |
|
5124 |
"{ Pragma: +optSpace }" |
|
5125 |
||
5126 |
"finish the Smalltalk system" |
|
5127 |
||
5128 |
self exit:0 |
|
5129 |
"not reached" |
|
5130 |
||
5131 |
"Be careful evaluating this |
|
5132 |
Smalltalk exit |
|
5133 |
" |
|
5134 |
! |
|
5135 |
||
5136 |
exit:statusInteger |
|
5137 |
"{ Pragma: +optSpace }" |
|
5138 |
||
5139 |
"finish the Smalltalk system" |
|
5140 |
||
5141 |
ObjectMemory changed:#aboutToExit. "/ for ST/X backward compatibility |
|
5142 |
ObjectMemory changed:#aboutToQuit. "/ for ST-80 compatibility |
|
5143 |
ExitBlocks notNil ifTrue:[ |
|
22791 | 5144 |
ExitBlocks do:[:aBlock | |
5145 |
aBlock value |
|
5146 |
] |
|
21782 | 5147 |
]. |
5148 |
Display notNil ifTrue:[ Display closeConnection ]. |
|
5149 |
||
13947 | 5150 |
OperatingSystem exit:statusInteger |
5151 |
"not reached" |
|
5152 |
||
5153 |
"Be careful evaluating this |
|
5154 |
Smalltalk exit:1 |
|
5155 |
" |
|
21782 | 5156 |
|
5157 |
"Modified: / 30-05-2017 / 21:36:35 / cg" |
|
19014 | 5158 |
! |
5159 |
||
19958 | 5160 |
exitIfStandalone |
5161 |
"if this is a standalone application, exit. |
|
5162 |
Otherwise give a warning and abort. |
|
5163 |
Call this in your code instead of Smalltalk exit, |
|
5164 |
so the code can be tested in the IDE without danger of shuttong down ST/X" |
|
5165 |
||
5166 |
"{ Pragma: +optSpace }" |
|
5167 |
||
5168 |
self exitIfStandalone:0 |
|
5169 |
||
5170 |
"Created: / 06-06-2016 / 14:56:49 / cg" |
|
5171 |
! |
|
5172 |
||
5173 |
exitIfStandalone:statusInteger |
|
5174 |
"if this is a standalone application, exit. |
|
5175 |
Otherwise give a warning and abort. |
|
5176 |
Call this in your code instead of Smalltalk exit, |
|
5177 |
so the code can be tested in the IDE without danger of shuttong down ST/X" |
|
5178 |
||
5179 |
"{ Pragma: +optSpace }" |
|
5180 |
||
5181 |
Smalltalk isStandAloneApp ifTrue:[ |
|
22791 | 5182 |
self exit:statusInteger |
19958 | 5183 |
] ifFalse:[ |
22791 | 5184 |
self warn:'Application asks Smalltalk to exit (this is suppressed in IDE).'. |
5185 |
AbortOperationRequest raise. |
|
19958 | 5186 |
] |
5187 |
||
5188 |
" |
|
5189 |
Smalltalk exitIfStandalone:1 |
|
5190 |
" |
|
5191 |
||
5192 |
"Created: / 06-06-2016 / 14:56:00 / cg" |
|
5193 |
! |
|
5194 |
||
19014 | 5195 |
exitOrError:exitCode |
5196 |
"exit only if running as standalone application. |
|
5197 |
Raise an error in the development system. |
|
5198 |
Useful for testing standalone apps which should not kill |
|
5199 |
your development system." |
|
5200 |
||
5201 |
self isStandAloneApp ifTrue:[ |
|
22791 | 5202 |
self exit:exitCode. |
19014 | 5203 |
]. |
5204 |
self error:'standalone smalltalk would exit here with exit code: ', exitCode printString. |
|
5205 |
||
5206 |
" |
|
5207 |
self exitOrError:0 |
|
5208 |
" |
|
20715 | 5209 |
! |
5210 |
||
5211 |
exitWithErrorMessage:msg |
|
5212 |
('Smalltalk [error]: ',msg) errorPrintCR. |
|
5213 |
self exitOrError:1 |
|
13947 | 5214 |
! ! |
5215 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
5216 |
!Smalltalk class methodsFor:'startup queries'! |
1097 | 5217 |
|
10641 | 5218 |
commandLine |
5219 |
"return the full command line arguments (with which ST/X was started)" |
|
5220 |
||
5221 |
^ CommandLine |
|
5222 |
||
5223 |
" |
|
5224 |
Smalltalk commandLine |
|
5225 |
" |
|
5226 |
||
5227 |
"Created: 19.7.1996 / 11:09:06 / cg" |
|
5228 |
! |
|
5229 |
||
5230 |
commandLineArgumentNamed:aString |
|
16110 | 5231 |
"extract a named argument from the command line arguments. |
5232 |
This searches for the given string in the command line and returns the next argument after it." |
|
10641 | 5233 |
|
5234 |
|args index| |
|
5235 |
||
5236 |
args := self commandLineArguments. |
|
5237 |
index := args indexOf:aString. |
|
5238 |
(index between:1 and:(args size - 1)) ifTrue:[ |
|
18668 | 5239 |
^ args at:index+1 |
10641 | 5240 |
]. |
5241 |
^ nil. |
|
5242 |
||
5243 |
" |
|
5244 |
self commandLineArgumentNamed:'-display' |
|
5245 |
" |
|
5246 |
! |
|
5247 |
||
5248 |
commandLineArguments |
|
5249 |
"return the user command line arguments; |
|
5250 |
This is a collection of strings (separated command line words), |
|
5251 |
from which the internal startup arguments have already been removed. |
|
5252 |
I.e. if started with: 'smalltalk -I -f xxx foo bar baz', |
|
5253 |
the commandLineArguments will be #('foo' 'bar' 'baz'). |
|
5254 |
In contrast, the value returned by #commandLine will be the full set of words." |
|
5255 |
||
5256 |
^ CommandLineArguments |
|
5257 |
||
5258 |
"Modified: 19.7.1996 / 11:11:03 / cg" |
|
5259 |
! |
|
5260 |
||
5261 |
commandName |
|
5262 |
"return the excutables name - this is normally 'stx', |
|
5263 |
but can be something else for standAlone apps." |
|
5264 |
||
5265 |
^ CommandName. |
|
5266 |
||
5267 |
" |
|
5268 |
Smalltalk commandName |
|
5269 |
" |
|
5270 |
||
5271 |
"Modified: 19.7.1996 / 11:11:16 / cg" |
|
5272 |
! |
|
5273 |
||
5274 |
hasNoConsole |
|
5275 |
"return true, if this is a console-less application (i.e. I am winstx) |
|
5276 |
i.e. there should be no writing to stdout/stderr" |
|
5277 |
||
5278 |
^ HasNoConsole ? false |
|
5279 |
||
5280 |
" |
|
10071 | 5281 |
Smalltalk hasNoConsole |
9054 | 5282 |
" |
5283 |
! |
|
5284 |
||
17435 | 5285 |
ignoreAssertions |
5286 |
"return true, if assertions are to be ignored (i.e. not executed). |
|
5287 |
This is false by default in an IDE (i.e. full smalltalk), |
|
5288 |
but can be set to true for standAlone applications |
|
5289 |
(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
|
5290 |
However, it may make the app a little faster, if assertions are compatational |
17435 | 5291 |
expensive, as they are skipped (the stc compiler is generatig code which skips those)." |
5292 |
||
17439
1928276a394c
added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents:
17438
diff
changeset
|
5293 |
^ IgnoreAssertions ? false |
17435 | 5294 |
! |
5295 |
||
17438 | 5296 |
ignoreAssertions:aBoolean |
5297 |
"set to true, if assertions are to be ignored (i.e. not executed). |
|
5298 |
This is false by default in an IDE (i.e. full smalltalk), |
|
5299 |
but can be set to true for standAlone applications |
|
5300 |
(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
|
5301 |
However, it may make the app a little faster, if assertions are compatational |
17438 | 5302 |
expensive, as they are skipped (the stc compiler is generatig code which skips those)." |
5303 |
||
17439
1928276a394c
added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents:
17438
diff
changeset
|
5304 |
IgnoreAssertions := aBoolean |
17438 | 5305 |
! |
5306 |
||
22679 | 5307 |
isDebuggableApp |
5308 |
"return true, if we want to see a Debugger, MiniDebugger or extended debugging output |
|
5309 |
in some situations." |
|
5310 |
||
5311 |
^ self isStandAloneApp not or:[self isStandAloneDebug]. |
|
5312 |
||
5313 |
" |
|
5314 |
Smalltalk isDebuggableApp |
|
5315 |
" |
|
5316 |
||
5317 |
"Created: / 19-04-2018 / 10:30:17 / stefan" |
|
5318 |
! |
|
5319 |
||
10641 | 5320 |
isHeadless |
5321 |
"return true, if this is a headless application |
|
5322 |
i.e. no default Display connection is required/used" |
|
5323 |
||
5324 |
^ HeadlessOperation ? false |
|
5325 |
||
5326 |
" |
|
10071 | 5327 |
Smalltalk isHeadless |
9029 | 5328 |
" |
5329 |
! |
|
5330 |
||
10641 | 5331 |
isPlugin |
5332 |
"return true, if this is a plugin application |
|
5333 |
i.e. running in a browserWindow" |
|
5334 |
||
5335 |
^ IsPlugin ? false |
|
5336 |
||
5337 |
" |
|
10071 | 5338 |
Smalltalk isPlugin |
9029 | 5339 |
" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5340 |
! |
4957 | 5341 |
|
10641 | 5342 |
isSTScript |
5343 |
"return true, if this is stscript. i.e. the stx scripting engine." |
|
5344 |
||
5345 |
^ IsSTScript ? false |
|
5346 |
||
5347 |
" |
|
5348 |
Smalltalk isSTScript |
|
5349 |
" |
|
5350 |
||
5351 |
"Created: / 06-12-2006 / 16:41:21 / cg" |
|
5352 |
! |
|
5353 |
||
5354 |
isSharedLibraryComponent |
|
5355 |
"return true, if this is a shared library component of another application |
|
5356 |
i.e. a dll within another app." |
|
5357 |
||
5358 |
^ IsSharedLibraryComponent ? false |
|
5359 |
||
5360 |
" |
|
5361 |
Smalltalk isSharedLibraryComponent |
|
5362 |
" |
|
5363 |
||
5364 |
"Created: / 10-08-2006 / 13:09:34 / cg" |
|
5365 |
! |
|
5366 |
||
5367 |
isSmalltalkDevelopmentSystem |
|
5368 |
"return true, if this is a real smalltalk system |
|
17421 | 5369 |
i.e. NOT a stripped or a linked standAlone application (such as the webServer) |
10641 | 5370 |
and NOT a plugIn (i.e. running in a browser) |
5371 |
and NOT a sharedLibrary component (i.e. a dll in another app). |
|
17421 | 5372 |
This is used to determine, whether debugging is possible/desired or not." |
10641 | 5373 |
|
5374 |
self isPlugin ifTrue:[^ false]. "/ I am a browser-plugin |
|
5375 |
self isSharedLibraryComponent ifTrue:[^ false]. "/ I am a COM-ponent |
|
5376 |
self isSTScript ifTrue:[^ true ]. "/ I am stScript |
|
10999 | 5377 |
^ self isStandAloneApp not. |
10641 | 5378 |
|
5379 |
" |
|
5380 |
Smalltalk isSmalltalkDevelopmentSystem |
|
5381 |
" |
|
5382 |
||
5383 |
"Created: / 10-08-2006 / 13:12:49 / cg" |
|
5384 |
"Modified: / 06-12-2006 / 16:42:56 / cg" |
|
15565 | 5385 |
"Modified (comment): / 27-07-2013 / 15:36:20 / cg" |
10641 | 5386 |
! |
5387 |
||
5388 |
isStandAloneApp |
|
5389 |
"return true, if this is a standAlone application |
|
5390 |
i.e. a stripped & linked application (such as the webServer) |
|
5391 |
in contrast to a full smalltalk (development) system." |
|
5392 |
||
5393 |
^ StandAlone ? false |
|
5394 |
||
5395 |
" |
|
10071 | 5396 |
Smalltalk isStandAloneApp |
9029 | 5397 |
" |
617 | 5398 |
! |
5399 |
||
13947 | 5400 |
isStandAloneDebug |
5401 |
"return true, if this is a standAlone application which |
|
5402 |
was started with the -debug option." |
|
5403 |
||
5404 |
^ DebuggingStandAlone ? false |
|
5405 |
||
5406 |
" |
|
5407 |
Smalltalk isStandAloneDebug |
|
5408 |
" |
|
5409 |
||
5410 |
"Created: / 19-01-2012 / 10:17:41 / cg" |
|
5411 |
! |
|
5412 |
||
10641 | 5413 |
startupArguments |
5414 |
"return the arguments passed to StartupClass when stx gets started. |
|
5415 |
Usually these are nil, |
|
5416 |
but saving an image with a non-nil StartupClass/StartupSelector/StartupArgs allows for |
|
5417 |
a simple way to configure and create stand-alone applications" |
|
5418 |
||
5419 |
^ StartupArguments |
|
5420 |
||
5421 |
" |
|
10071 | 5422 |
Smalltalk startupArguments |
9029 | 5423 |
" |
7563 | 5424 |
! |
5425 |
||
10641 | 5426 |
startupClass |
5427 |
"return the class, that will get the start message when smalltalk |
|
5428 |
starts and its non-nil. Usually this is nil, |
|
5429 |
but saving an image with a non-nil StartupClass/StartupSelector/StartupArgs allows for |
|
5430 |
a simple way to configure and create stand-alone applications" |
|
5431 |
||
5432 |
^ StartupClass |
|
5433 |
||
5434 |
" |
|
10071 | 5435 |
Smalltalk startupClass |
9029 | 5436 |
" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5437 |
! |
8570 | 5438 |
|
10641 | 5439 |
startupClass:aClass selector:aSymbol arguments:anArrayOrNil |
5440 |
"{ Pragma: +optSpace }" |
|
5441 |
||
5442 |
"set the class, selector and arguments to be performed when smalltalk |
|
5443 |
starts. Setting those before saving a snapshot, will make the saved |
|
5444 |
image come up executing your application (instead of the normal mainloop)" |
|
5445 |
||
5446 |
StartupClass := aClass. |
|
5447 |
StartupSelector := aSymbol. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5448 |
StartupArguments := anArrayOrNil |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5449 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5450 |
|
10641 | 5451 |
startupSelector |
5452 |
"return the selector, that will be sent to StartupClass. |
|
5453 |
Usually this is nil, |
|
5454 |
but saving an image with a non-nil StartupClass/StartupSelector allows for |
|
5455 |
a simple way to configure and create stand-alone applications" |
|
5456 |
||
5457 |
^ StartupSelector |
|
5458 |
||
5459 |
" |
|
10071 | 5460 |
Smalltalk startupSelector |
9029 | 5461 |
" |
10641 | 5462 |
! |
5463 |
||
5464 |
wasStartedFromImage |
|
5465 |
"return true, if this smalltalk was started from an image, |
|
5466 |
as opposed to a fresh and clean startup" |
|
5467 |
||
5468 |
^ ImageRestartTime notNil |
|
5469 |
||
5470 |
" |
|
5471 |
Smalltalk wasStartedFromImage |
|
5472 |
" |
|
70 | 5473 |
! ! |
5474 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
5475 |
!Smalltalk class methodsFor:'system environment'! |
1069 | 5476 |
|
10641 | 5477 |
language |
5478 |
"return the language setting" |
|
5479 |
||
5480 |
^ Language |
|
5481 |
||
5482 |
" |
|
5483 |
Smalltalk language |
|
5484 |
" |
|
5485 |
||
5486 |
"Modified: 26.4.1996 / 17:10:05 / cg" |
|
5487 |
! |
|
5488 |
||
5489 |
language:aLanguageSymbol |
|
10991 | 5490 |
"set the language - send out change notifications" |
10641 | 5491 |
|
18733 | 5492 |
aLanguageSymbol ~= Language ifTrue:[ |
22791 | 5493 |
Language := aLanguageSymbol asSymbol. |
5494 |
self changed:#Language |
|
18733 | 5495 |
]. |
10641 | 5496 |
|
5497 |
" |
|
5498 |
Smalltalk language:#de |
|
5499 |
" |
|
5500 |
||
5501 |
"Modified: / 19-10-2006 / 23:17:29 / cg" |
|
21928 | 5502 |
"Modified: / 29-06-2017 / 15:05:04 / stefan" |
10641 | 5503 |
! |
5504 |
||
5505 |
language:aLanguageSymbol territory:aTerritorySymbol |
|
10991 | 5506 |
"set the language & territory - send out change notifications" |
10641 | 5507 |
|
18733 | 5508 |
((Language ~= aLanguageSymbol) or:[ LanguageTerritory ~= aTerritorySymbol]) ifTrue:[ |
22791 | 5509 |
Language := aLanguageSymbol asSymbol. |
5510 |
LanguageTerritory := aTerritorySymbol asSymbol. |
|
5511 |
self changed:#Language |
|
18733 | 5512 |
]. |
10641 | 5513 |
|
5514 |
" |
|
5515 |
Smalltalk language:#de territory:#de |
|
5516 |
" |
|
5517 |
||
5518 |
"Created: / 19-10-2006 / 22:16:22 / cg" |
|
5519 |
"Modified: / 19-10-2006 / 23:17:36 / cg" |
|
5520 |
! |
|
5521 |
||
13212
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5522 |
languageAndTerritory |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5523 |
"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
|
5524 |
|
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5525 |
^ Language , '-' , (LanguageTerritory ? Language) |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5526 |
|
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5527 |
" |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5528 |
Smalltalk languageAndTerritory |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5529 |
" |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5530 |
|
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5531 |
"Created: / 16-01-2011 / 10:19:42 / cg" |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5532 |
! |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5533 |
|
20615 | 5534 |
languageCodeset |
5535 |
^ LanguageCodeset |
|
5536 |
! |
|
5537 |
||
5538 |
languageModifier |
|
5539 |
^ LanguageModifier |
|
5540 |
! |
|
5541 |
||
10641 | 5542 |
languageTerritory |
5543 |
"return the language territory setting" |
|
7563 | 5544 |
|
5545 |
^ LanguageTerritory |
|
5546 |
! |
|
5547 |
||
10641 | 5548 |
languageTerritory:aTerritorySymbol |
10991 | 5549 |
"set the language territory - send out change notifications" |
10641 | 5550 |
|
18924 | 5551 |
aTerritorySymbol ~= LanguageTerritory ifTrue:[ |
22791 | 5552 |
LanguageTerritory := aTerritorySymbol asSymbol. |
5553 |
self changed:#LanguageTerritory |
|
5554 |
]. |
|
5555 |
||
10641 | 5556 |
" |
5557 |
Time now |
|
5558 |
||
5559 |
Smalltalk languageTerritory:#us. |
|
5560 |
Time now |
|
5561 |
||
5562 |
Smalltalk languageTerritory:#de. |
|
5563 |
Time now |
|
5564 |
" |
|
5565 |
||
5566 |
"Modified: / 19-10-2006 / 23:17:40 / cg" |
|
5567 |
! |
|
5568 |
||
5569 |
setLanguage:aLanguageSymbol |
|
10991 | 5570 |
"set the language without change notification" |
10641 | 5571 |
|
5572 |
Language := aLanguageSymbol. |
|
10991 | 5573 |
! |
5574 |
||
5575 |
setLanguage:aLanguageSymbol territory:aTerritorySymbol |
|
5576 |
"set the language & territory - no change notification" |
|
5577 |
||
5578 |
Language := aLanguageSymbol asSymbol. |
|
5579 |
LanguageTerritory := aTerritorySymbol asSymbol. |
|
1069 | 5580 |
! ! |
5581 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
5582 |
!Smalltalk class methodsFor:'system management'! |
70 | 5583 |
|
10641 | 5584 |
compressSources |
5585 |
"{ Pragma: +optSpace }" |
|
5586 |
||
5587 |
"compress the sources file, and remove all method source strings |
|
5588 |
from the system and replace them by refs to a string in the source file. |
|
5589 |
This is a bit different in ST/X than in other smalltalks, |
|
5590 |
since we use per-class sourcefiles for the compiled classes, |
|
5591 |
and a mix of in-memory strings and one-for-all sourceFile for |
|
5592 |
incremental compiled methods. |
|
5593 |
Therefore, only those sources which are not coming from compiled |
|
5594 |
methods are put into the 'st.src' file - all others are untouched. |
|
20811 | 5595 |
This is being automated - so don't care for now." |
10641 | 5596 |
|
5597 |
|newStream table source pos fileName| |
|
5598 |
||
5599 |
" |
|
5600 |
first, find all methods which contain either a string-ref |
|
5601 |
or an external string in the 'st.src' file |
|
5602 |
" |
|
5603 |
newStream := 'src.tmp' asFilename writeStream. |
|
5604 |
||
5605 |
table := IdentityDictionary new:100. |
|
5606 |
||
5607 |
Method allSubInstancesDo:[:aMethod | |
|
22791 | 5608 |
source := nil. |
5609 |
aMethod sourcePosition notNil ifTrue:[ |
|
5610 |
aMethod sourceFilename = 'st.src' ifTrue:[ |
|
5611 |
source := aMethod source. |
|
5612 |
] |
|
5613 |
] ifFalse:[ |
|
5614 |
source := aMethod source |
|
5615 |
]. |
|
5616 |
||
5617 |
source notNil ifTrue:[ |
|
5618 |
pos := newStream position + 1. |
|
5619 |
newStream nextChunkPut:source. |
|
5620 |
||
5621 |
" |
|
5622 |
dont change the methods info - maybe some write error |
|
5623 |
occurs later, in that case we abort and leave everything |
|
5624 |
untouched. |
|
5625 |
" |
|
5626 |
table at:aMethod put:pos |
|
5627 |
] |
|
11655
4306fb61b9f8
sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents:
11624
diff
changeset
|
5628 |
]. |
4306fb61b9f8
sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents:
11624
diff
changeset
|
5629 |
|
4306fb61b9f8
sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents:
11624
diff
changeset
|
5630 |
newStream syncData; close. |
10641 | 5631 |
|
5632 |
" |
|
5633 |
now, rename the new source file, |
|
5634 |
" |
|
5635 |
fileName := (ObjectMemory nameForSources). |
|
5636 |
'src.tmp' asFilename renameTo:fileName. |
|
5637 |
||
5638 |
"good - now go over all changed methods, and change their |
|
5639 |
source reference" |
|
5640 |
||
5641 |
table keysAndValuesDo:[:aMethod :pos | |
|
22791 | 5642 |
aMethod localSourceFilename:fileName position:pos. |
10641 | 5643 |
"/ aMethod printCR. |
5644 |
]. |
|
5645 |
||
5646 |
" |
|
5647 |
Smalltalk compressSources |
|
5648 |
" |
|
5649 |
||
5650 |
"Modified: 16.1.1997 / 01:25:58 / cg" |
|
5651 |
! |
|
5652 |
||
5653 |
generateSingleSourceFile |
|
5654 |
"{ Pragma: +optSpace }" |
|
5655 |
||
5656 |
"generate the sources file, and remove all method source strings |
|
5657 |
from the system and replace them by refs to a string in the source file. |
|
5658 |
This makes the image independent from the per-class source files |
|
5659 |
and makes transportation of endUser applications easier, since |
|
5660 |
only 3 files (executable, image and sourceFile) need to be |
|
5661 |
transported." |
|
5662 |
||
5663 |
|newStream table source pos fileName| |
|
5664 |
||
5665 |
newStream := 'src.tmp' asFilename writeStream. |
|
5666 |
||
5667 |
table := IdentityDictionary new:100. |
|
5668 |
||
5669 |
Method allSubInstancesDo:[:aMethod | |
|
22791 | 5670 |
source := aMethod source. |
5671 |
source notNil ifTrue:[ |
|
5672 |
pos := newStream position + 1. |
|
5673 |
newStream nextChunkPut:source. |
|
5674 |
||
5675 |
" |
|
5676 |
don't change the method's info - maybe some write error |
|
5677 |
occurs later, in that case we abort and leave everything |
|
5678 |
untouched. |
|
5679 |
" |
|
5680 |
table at:aMethod put:pos |
|
5681 |
] |
|
11655
4306fb61b9f8
sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents:
11624
diff
changeset
|
5682 |
]. |
4306fb61b9f8
sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents:
11624
diff
changeset
|
5683 |
|
4306fb61b9f8
sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents:
11624
diff
changeset
|
5684 |
newStream syncData; close. |
10641 | 5685 |
|
5686 |
" |
|
5687 |
now, rename the new source file, |
|
5688 |
" |
|
5689 |
fileName := (ObjectMemory nameForSources). |
|
5690 |
'src.tmp' asFilename renameTo:fileName. |
|
5691 |
||
5692 |
"good - now go over all changed methods, and change their |
|
5693 |
source reference" |
|
5694 |
||
5695 |
table keysAndValuesDo:[:aMethod :pos | |
|
22791 | 5696 |
aMethod localSourceFilename:fileName position:pos. |
10641 | 5697 |
"/ aMethod printCR. |
5698 |
]. |
|
5699 |
||
5700 |
" |
|
5701 |
Smalltalk generateSingleSourceFile |
|
5702 |
" |
|
5703 |
||
22373 | 5704 |
"Modified: / 16-01-1997 / 01:25:58 / cg" |
5705 |
"Created: / 17-10-1997 / 13:00:56 / cg" |
|
5706 |
"Modified (comment): / 21-11-2017 / 13:08:41 / cg" |
|
10641 | 5707 |
! |
5708 |
||
15596 | 5709 |
installAutoloadedClassFromSourceFile:aFilename |
5710 |
"install aFilename (which must be a smalltalk source file) as autoloaded class |
|
5711 |
(extract the class definition chunk from the file and create an autoloaded |
|
5712 |
class stub for it)" |
|
5713 |
||
5714 |
|chunks filename| |
|
5715 |
||
5716 |
filename := aFilename asFilename. |
|
5717 |
||
5718 |
ChangeSet::InvalidChangeChunkError handle:[:ex | |
|
18668 | 5719 |
^ self |
15596 | 5720 |
] do:[ |
18668 | 5721 |
filename readingFileDo:[:s| |
5722 |
chunks := ChangeSet fromStream:s while:[:chunk | chunk isMethodChange not]. |
|
5723 |
]. |
|
16170
ca4d03def070
endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents:
16164
diff
changeset
|
5724 |
]. |
ca4d03def070
endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents:
16164
diff
changeset
|
5725 |
|
ca4d03def070
endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents:
16164
diff
changeset
|
5726 |
chunks |
18668 | 5727 |
select:[:eachChunk | eachChunk isClassDefinitionChange] |
5728 |
thenDo:[:eachClassChunk | |
|
5729 |
eachClassChunk installAsAutoloadedClassIfPublicWithFilename:filename asAbsoluteFilename "withoutSuffix" name "baseName" |
|
5730 |
]. |
|
15596 | 5731 |
|
5732 |
"Created: / 01-08-2013 / 16:57:26 / cg" |
|
5733 |
! |
|
5734 |
||
10641 | 5735 |
installAutoloadedClassNamed:clsName category:cat package:package revision:revisionOrNil |
5736 |
"create & install an autoload stub for a class named: clsName, |
|
5737 |
to be loaded from package. |
|
5738 |
If revisionOrNil is non-nil, set it up to load exactly that revision |
|
5739 |
(otherwise, the newest revision will be loaded" |
|
5740 |
||
5741 |
^ self |
|
18668 | 5742 |
installAutoloadedClassNamed:clsName |
5743 |
category:cat |
|
5744 |
package:package |
|
5745 |
revision:revisionOrNil |
|
5746 |
numClassInstVars:nil. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5747 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5748 |
|
10641 | 5749 |
installAutoloadedClassNamed:clsName category:cat package:package revision:revisionOrNil numClassInstVars:numClassInstVarsOrNil |
5750 |
"create & install an autoload stub for a class named: clsName, |
|
5751 |
to be loaded from package. |
|
5752 |
If revisionOrNil is non-nil, set it up to load exactly that revision |
|
5753 |
(otherwise, the newest revision will be loaded" |
|
5754 |
||
5755 |
|clsSym cls| |
|
5756 |
||
5757 |
clsSym := clsName asSymbol. |
|
5758 |
||
5759 |
"/ install if not already compiled-in |
|
5760 |
(cls := self at:clsSym) isNil ifTrue:[ |
|
18668 | 5761 |
Autoload subclass:clsSym |
5762 |
instanceVariableNames:'' |
|
5763 |
classVariableNames:'' |
|
5764 |
poolDictionaries:'' |
|
5765 |
category:cat |
|
5766 |
inEnvironment:Smalltalk. |
|
5767 |
||
5768 |
cls := self at:clsSym. |
|
5769 |
cls isNil ifTrue:[ |
|
5770 |
('Smalltalk [warning]: failed to install ' , clsName , ' as autoloaded.') infoPrintCR. |
|
5771 |
] ifFalse:[ |
|
5772 |
cls package:package asSymbol. |
|
5773 |
revisionOrNil notNil ifTrue:[ |
|
5774 |
cls setBinaryRevision:revisionOrNil |
|
5775 |
] |
|
5776 |
] |
|
10641 | 5777 |
] ifFalse:[ |
18668 | 5778 |
"/ class already present - however, if unloaded, check for category/package change |
5779 |
cls isLoaded ifFalse:[ |
|
5780 |
package ~= cls package ifTrue:[ |
|
5781 |
cls withoutUpdatingChangesDo:[ |
|
5782 |
cls package:package asSymbol. |
|
5783 |
]. |
|
5784 |
]. |
|
5785 |
cat ~= cls category ifTrue:[ |
|
5786 |
cls withoutUpdatingChangesDo:[ |
|
5787 |
cls category:cat. |
|
5788 |
]. |
|
5789 |
]. |
|
5790 |
]. |
|
10641 | 5791 |
]. |
5792 |
^ cls. |
|
5793 |
||
5794 |
"Created: / 05-11-1998 / 15:10:25 / cg" |
|
5795 |
"Modified: / 16-01-2007 / 12:56:18 / cg" |
|
11169
32fda240ee57
#installAutoloadedClassNamed:category:package:revision:numClassInstVars:
Stefan Vogel <sv@exept.de>
parents:
11153
diff
changeset
|
5796 |
|
10641 | 5797 |
! |
5798 |
||
5799 |
installAutoloadedClasses |
|
11679
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
5800 |
"scan all packages and install all classes found there as |
10641 | 5801 |
autoloaded. This takes some time ..." |
5802 |
||
11679
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
5803 |
|dirsConsulted| |
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
5804 |
|
17588 | 5805 |
LoadInProgressQuery answerNotifyLoadingDo:[ |
18668 | 5806 |
dirsConsulted := Set new. |
5807 |
||
5808 |
"/ along the package-path |
|
5809 |
self packagePath do:[:eachPathComponent | |
|
5810 |
(dirsConsulted includes:eachPathComponent) ifFalse:[ |
|
5811 |
self |
|
5812 |
recursiveInstallAutoloadedClassesFrom:eachPathComponent |
|
5813 |
rememberIn:dirsConsulted |
|
5814 |
maxLevels:15 |
|
5815 |
noAutoload:false |
|
5816 |
packageTop:eachPathComponent |
|
5817 |
showSplashInLevels:2. |
|
5818 |
] |
|
5819 |
]. |
|
5820 |
self splashInfo:nil. |
|
17548 | 5821 |
]. |
10641 | 5822 |
|
5823 |
" |
|
5824 |
Smalltalk installAutoloadedClasses |
|
5825 |
" |
|
5826 |
||
5827 |
"Created: / 14.2.1997 / 17:32:57 / cg" |
|
5828 |
"Modified: / 13.12.1999 / 11:56:50 / cg" |
|
5829 |
! |
|
5830 |
||
5831 |
installAutoloadedClassesFrom:anAbbrevFilePath |
|
5832 |
"read the given abbreviation file; install all classes found there as |
|
5833 |
autoloaded. This takes some time ..." |
|
5834 |
||
5835 |
|f s| |
|
5836 |
||
5837 |
f := self getSystemFileName:anAbbrevFilePath. |
|
5838 |
f isNil ifTrue:[f := self getPackageFileName:anAbbrevFilePath]. |
|
5839 |
||
5840 |
f notNil ifTrue:[ |
|
22791 | 5841 |
f := f asFilename. |
5842 |
f isDirectory ifTrue:[ |
|
5843 |
f := f construct:'abbrev.stc' |
|
5844 |
]. |
|
5845 |
[ |
|
5846 |
s := f readStream. |
|
5847 |
self installAutoloadedClassesFromStream:s. |
|
5848 |
s close. |
|
5849 |
] on:FileStream openErrorSignal |
|
5850 |
do:[:ex| "do nothing"]. |
|
10641 | 5851 |
] |
5852 |
||
5853 |
" |
|
5854 |
Smalltalk installAutoloadedClassesFrom:'include/abbrev.stc' |
|
19911 | 5855 |
Smalltalk installAutoloadedClassesFrom:'../../goodies/communication/abbrev.stc' |
10641 | 5856 |
" |
5857 |
||
5858 |
"Modified: / 5.11.1998 / 15:10:51 / cg" |
|
5859 |
! |
|
5860 |
||
13531
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
5861 |
installAutoloadedClassesFromAbbrevFile:aFilename |
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
5862 |
aFilename readingFileDo:[:abbrevStream | |
22791 | 5863 |
self installAutoloadedClassesFromStream:abbrevStream. |
13531
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
5864 |
] |
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
5865 |
|
19911 | 5866 |
" |
5867 |
self installAutoloadedClassesFromAbbrevFile:('../../goodies/communication/abbrev.stc' asFilename) |
|
5868 |
" |
|
22791 | 5869 |
|
13531
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
5870 |
"Created: / 29-07-2011 / 20:39:21 / cg" |
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
5871 |
! |
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
5872 |
|
10641 | 5873 |
installAutoloadedClassesFromStream:anAbbrevFileStream |
5874 |
"read the given abbreviation file; |
|
5875 |
install all classes found there as autoloaded, and also update the |
|
5876 |
abbreviation (className-to-fileName mapping) table. |
|
5877 |
This takes some time ..." |
|
5878 |
||
5879 |
|s2 l abbrevFileName info clsName cls abbrev package cat numClassInstVars words w| |
|
5880 |
||
5881 |
anAbbrevFileStream isFileStream ifTrue:[ |
|
22791 | 5882 |
abbrevFileName := anAbbrevFileStream pathName. |
5883 |
info := 'declared from: ', abbrevFileName. |
|
10641 | 5884 |
]. |
5885 |
||
5886 |
"/ yes, create any required nameSpace, without asking user. |
|
5887 |
Class createNameSpaceQuerySignal answer:true do:[ |
|
5888 |
||
22791 | 5889 |
[anAbbrevFileStream atEnd] whileFalse:[ |
5890 |
l := anAbbrevFileStream nextLine withoutSeparators. |
|
5891 |
"Skip empty lines and comments" |
|
5892 |
(l notEmpty and:[l first ~= $#]) ifTrue:[ |
|
5893 |
"/ must do it manually, caring for quoted strings. |
|
10641 | 5894 |
"/ words := line asCollectionOfWords. |
5895 |
||
22791 | 5896 |
words := OrderedCollection new. |
5897 |
s2 := l readStream. |
|
5898 |
[s2 atEnd] whileFalse:[ |
|
5899 |
s2 skipSeparators. |
|
5900 |
s2 peek == $' ifTrue:[ |
|
5901 |
s2 next. |
|
5902 |
w := s2 upTo:$'. |
|
5903 |
s2 skipSeparators. |
|
5904 |
] ifFalse:[ |
|
5905 |
w := s2 upToSeparator |
|
5906 |
]. |
|
5907 |
words add:w |
|
5908 |
]. |
|
5909 |
words size < 3 ifTrue:[ |
|
5910 |
'Smalltalk [warning]: bad abbrev entry' errorPrint. |
|
5911 |
anAbbrevFileStream isFileStream ifTrue:[ |
|
5912 |
' (in ''' errorPrint. |
|
5913 |
anAbbrevFileStream pathName errorPrint. |
|
5914 |
''')' errorPrint |
|
5915 |
]. |
|
5916 |
': ' errorPrint. l errorPrintCR |
|
5917 |
] ifFalse:[ |
|
5918 |
clsName := (words at:1) asSymbol. |
|
5919 |
abbrev := (words at:2). |
|
5920 |
package := (words at:3) asSymbol. |
|
5921 |
cat := words at:4 ifAbsent:nil. |
|
5922 |
numClassInstVars := words at:5 ifAbsent:'0'. |
|
5923 |
numClassInstVars := Integer readFrom:numClassInstVars onError:[0]. |
|
5924 |
||
5925 |
(cat size == 0) ifTrue:[ |
|
5926 |
cat := 'autoloaded' |
|
5927 |
]. |
|
5928 |
||
5929 |
"/ on the fly, update the abbreviations |
|
5930 |
self setFilename:abbrev forClass:clsName package:package. |
|
5931 |
||
5932 |
"/ ' autoloaded: ' print. clsName print. ' in ' print. cat printCR. |
|
5933 |
||
5934 |
cls := self |
|
5935 |
installAutoloadedClassNamed:clsName |
|
5936 |
category:cat |
|
5937 |
package:package |
|
5938 |
revision:nil |
|
5939 |
numClassInstVars:numClassInstVars. |
|
10641 | 5940 |
|
5941 |
"/ info notNil ifTrue:[ |
|
5942 |
"/ cls setComment:info. |
|
5943 |
"/ ]. |
|
22791 | 5944 |
] |
5945 |
] |
|
5946 |
] |
|
4458 | 5947 |
] |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5948 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5949 |
|
10641 | 5950 |
loadBinaries |
5951 |
"return true, if binaries should be loaded into the system, |
|
5952 |
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
|
5953 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5954 |
^ LoadBinaries |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5955 |
! |
3044 | 5956 |
|
10641 | 5957 |
loadBinaries:aBoolean |
5958 |
"{ Pragma: +optSpace }" |
|
5959 |
||
5960 |
"turn on/off loading of binary objects" |
|
5961 |
||
5962 |
aBoolean ifTrue:[ |
|
18668 | 5963 |
(ObjectFileLoader notNil and:[ObjectFileLoader canLoadObjectFiles]) ifTrue:[ |
5964 |
LoadBinaries := true. |
|
5965 |
^ self |
|
5966 |
]. |
|
5967 |
'Smalltalk [info]: this system does not support binary loading' infoPrintCR. |
|
10641 | 5968 |
]. |
5969 |
LoadBinaries := false |
|
5970 |
||
5971 |
"Modified: 10.1.1997 / 15:11:00 / cg" |
|
5972 |
! |
|
5973 |
||
5974 |
logDoits |
|
5975 |
"return true if doits should go into the changes file |
|
5976 |
as well as changes - by default, this is off, since |
|
5977 |
it can blow up the changes file enormously ... |
|
5978 |
" |
|
5979 |
||
5980 |
^ LogDoits |
|
5981 |
||
5982 |
" |
|
5983 |
LogDoits := false |
|
3044 | 5984 |
LogDoits := true |
5985 |
" |
|
5986 |
! |
|
5987 |
||
10641 | 5988 |
logDoits:aBoolean |
5989 |
"{ Pragma: +optSpace }" |
|
5990 |
||
5991 |
"turn on/off logging of doits in the changes file. |
|
5992 |
By default, this is off, since it can blow up the |
|
5993 |
changes file enormously ... |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5994 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5995 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5996 |
LogDoits := aBoolean |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5997 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5998 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5999 |
|
10641 | 6000 |
makeBytecodeMethods |
6001 |
"{ Pragma: +optSpace }" |
|
6002 |
||
6003 |
"walk over all methods and make each a bytecode method |
|
6004 |
iff it does not contain primitive C code. |
|
6005 |
Experimental and not yet used." |
|
6006 |
||
6007 |
Method allSubInstancesDo:[:aMethod | |
|
22791 | 6008 |
|newMethod| |
6009 |
||
6010 |
aMethod hasPrimitiveCode ifFalse:[ |
|
18707 | 6011 |
"/ aMethod errorPrintCR. |
22791 | 6012 |
newMethod := aMethod asByteCodeMethod. |
6013 |
newMethod ~~ aMethod ifTrue:[ |
|
6014 |
newMethod isNil ifTrue:[ |
|
6015 |
'Smalltalk>>makeBytecodeMethods could nor recompile: ' errorPrint. aMethod errorPrintCR. |
|
6016 |
] ifFalse:[ |
|
6017 |
aMethod becomeSameAs:newMethod |
|
6018 |
]. |
|
6019 |
] |
|
6020 |
]. |
|
10641 | 6021 |
]. |
6022 |
||
6023 |
" |
|
6024 |
Smalltalk makeBytecodeMethods |
|
6025 |
" |
|
6026 |
||
6027 |
"Modified: 16.1.1997 / 01:25:58 / cg" |
|
6028 |
"Created: 17.10.1997 / 13:52:19 / cg" |
|
6029 |
! |
|
6030 |
||
14269
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6031 |
recursiveInstallAutoloadedClassesFrom:aTopDirectory |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6032 |
"scan all packages and install all classes found there as |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6033 |
autoloaded. This takes some time ..." |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6034 |
|
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6035 |
|dirsConsulted| |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6036 |
|
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6037 |
dirsConsulted := Set new. |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6038 |
|
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6039 |
self |
22791 | 6040 |
recursiveInstallAutoloadedClassesFrom:aTopDirectory |
6041 |
rememberIn:dirsConsulted |
|
6042 |
maxLevels:15 |
|
6043 |
noAutoload:false |
|
6044 |
packageTop:nil |
|
6045 |
showSplashInLevels:-1. |
|
14269
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6046 |
|
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6047 |
|
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6048 |
" |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6049 |
Smalltalk recursiveInstallAutoloadedClassesFrom:'..\..\..\cg\private\euler' |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6050 |
" |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6051 |
|
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6052 |
"Created: / 31-07-2012 / 15:27:40 / cg" |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6053 |
! |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
6054 |
|
10641 | 6055 |
recursiveInstallAutoloadedClassesFrom:aDirectory rememberIn:dirsConsulted maxLevels:maxLevels noAutoload:noAutoloadIn packageTop:packageTopPath |
6056 |
"read all abbrev.stc files from and under aDirectory |
|
6057 |
and install autoloaded classes. |
|
15783 | 6058 |
If a file called NOAUTOLOAD is found, no classes there are installed as autoloaded, |
6059 |
but classes in subdirectories are installed, if the subdirectory contains a file |
|
6060 |
named AUTOLOAD. |
|
6061 |
If a file called NOSUBAUTOLOAD is found, no classes there and below are installed as autoloaded. |
|
10641 | 6062 |
If a file called NOPACKAGES is found, no further searching is done in that directory or below." |
6063 |
||
11391 | 6064 |
self |
18668 | 6065 |
recursiveInstallAutoloadedClassesFrom:aDirectory rememberIn:dirsConsulted |
6066 |
maxLevels:maxLevels noAutoload:noAutoloadIn packageTop:packageTopPath |
|
6067 |
showSplashInLevels:0. |
|
11391 | 6068 |
|
6069 |
" |
|
6070 |
Smalltalk installAutoloadedClasses |
|
6071 |
" |
|
6072 |
||
6073 |
"Modified: / 17-08-2006 / 16:48:43 / cg" |
|
6074 |
! |
|
6075 |
||
12022 | 6076 |
recursiveInstallAutoloadedClassesFrom:aDirectory rememberIn:dirsConsulted |
11391 | 6077 |
maxLevels:maxLevels noAutoload:noAutoloadIn packageTop:packageTopPath |
6078 |
showSplashInLevels:showSplashInLevels |
|
6079 |
"read all abbrev.stc files from and under aDirectory |
|
6080 |
and install autoloaded classes. |
|
15783 | 6081 |
If a file called NOAUTOLOAD is found, no classes there are installed as autoloaded, |
6082 |
but classes in subdirectories are installed, if the subdirectory contains a file |
|
6083 |
named AUTOLOAD. |
|
6084 |
If a file called NOSUBAUTOLOAD is found, no classes there and below are installed as autoloaded. |
|
11391 | 6085 |
If a file called NOPACKAGES is found, no further searching is done in that directory or below." |
6086 |
||
15783 | 6087 |
|dir noAutoloadHere dirName directoryContents haveAbbrevDotSTC| |
10641 | 6088 |
|
6089 |
dir := aDirectory asFilename. |
|
15958 | 6090 |
|
6091 |
"/ Care for non-existent directories" |
|
6092 |
dir exists ifFalse:[ ^ self ]. |
|
6093 |
||
15783 | 6094 |
dirName := dir physicalPathName. "take care of symbolic links" |
11392 | 6095 |
|
6096 |
(dirsConsulted includes:dirName) ifTrue:[ |
|
22791 | 6097 |
^ self |
10641 | 6098 |
]. |
6099 |
||
12377 | 6100 |
(dir / 'NOPACKAGES') exists ifTrue:[ |
22791 | 6101 |
^ self. |
10641 | 6102 |
]. |
12377 | 6103 |
(dir / 'NOSUBAUTOLOAD') exists ifTrue:[ |
22791 | 6104 |
^ self. |
10641 | 6105 |
]. |
11392 | 6106 |
|
15783 | 6107 |
maxLevels == 0 ifTrue:[ |
22791 | 6108 |
Transcript showCR:('Autoload: max directory nesting reached in %1' bindWith:dir pathName). |
6109 |
^ self |
|
15783 | 6110 |
]. |
6111 |
||
6112 |
dirsConsulted add:dirName. |
|
10641 | 6113 |
noAutoloadHere := noAutoloadIn. |
6114 |
noAutoloadHere ifFalse:[ |
|
22791 | 6115 |
(dir / 'NOAUTOLOAD') exists ifTrue:[ |
6116 |
noAutoloadHere := true. |
|
6117 |
]. |
|
10641 | 6118 |
] ifTrue:[ |
22791 | 6119 |
(dir / 'AUTOLOAD') exists ifTrue:[ |
6120 |
noAutoloadHere := false. |
|
6121 |
]. |
|
10641 | 6122 |
]. |
6123 |
||
11393 | 6124 |
showSplashInLevels >= 0 ifTrue:[ |
22791 | 6125 |
self showSplashMessage:('Smalltalk [info]: installing autoloaded classes found under "%1"...' |
6126 |
bindWith:(dirName contractAtBeginningTo:35)). |
|
11392 | 6127 |
]. |
6128 |
||
10641 | 6129 |
"/ |
6130 |
"/ suppress installation as autoloaded in this and everything |
|
6131 |
"/ below; however, still traverse the directories to find packages ... |
|
6132 |
"/ |
|
15596 | 6133 |
haveAbbrevDotSTC := false. |
10641 | 6134 |
noAutoloadHere ifFalse:[ |
22791 | 6135 |
[ |
6136 |
self installAutoloadedClassesFromAbbrevFile:(dir / 'abbrev.stc'). |
|
6137 |
haveAbbrevDotSTC := true. |
|
6138 |
] on:FileStream openErrorSignal |
|
6139 |
do:[:ex| |
|
6140 |
"ignore this file" |
|
6141 |
]. |
|
10641 | 6142 |
]. |
6143 |
||
6144 |
[ |
|
22791 | 6145 |
directoryContents := dir directoryContents. |
10641 | 6146 |
] on:FileStream openErrorSignal do:[:ex| |
22791 | 6147 |
"non-accessible directory: we are done" |
6148 |
^ self |
|
16199 | 6149 |
]. |
6150 |
||
6151 |
directoryContents := directoryContents select:[:fn | (fn startsWith:'.') not] as:Set. |
|
10641 | 6152 |
|
12911
0822e257daeb
comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents:
12883
diff
changeset
|
6153 |
directoryContents removeAllFoundIn:#( |
22791 | 6154 |
'objbc' 'objvc' 'objmingw' |
6155 |
'doc' |
|
6156 |
'CVS' |
|
6157 |
'bitmaps' |
|
6158 |
'resources' |
|
6159 |
'source' |
|
6160 |
'not_delivered' |
|
6161 |
'not_ported' |
|
6162 |
). |
|
12911
0822e257daeb
comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents:
12883
diff
changeset
|
6163 |
dir baseName = 'stx' ifTrue:[ |
22791 | 6164 |
directoryContents removeAllFoundIn:#( |
6165 |
'configurations' |
|
6166 |
'include' |
|
6167 |
'rules' |
|
6168 |
'stc' |
|
6169 |
'support' |
|
6170 |
). |
|
12911
0822e257daeb
comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents:
12883
diff
changeset
|
6171 |
]. |
0822e257daeb
comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents:
12883
diff
changeset
|
6172 |
|
0822e257daeb
comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents:
12883
diff
changeset
|
6173 |
directoryContents do:[:eachFilenameString | |
22791 | 6174 |
|f| |
6175 |
||
6176 |
f := dir / eachFilenameString. |
|
6177 |
f isDirectory ifTrue:[ |
|
6178 |
self |
|
6179 |
recursiveInstallAutoloadedClassesFrom:f |
|
6180 |
rememberIn:dirsConsulted |
|
6181 |
maxLevels:maxLevels-1 |
|
6182 |
noAutoload:noAutoloadHere |
|
6183 |
packageTop:packageTopPath |
|
6184 |
showSplashInLevels:showSplashInLevels - 1. |
|
6185 |
] ifFalse:[ |
|
6186 |
(noAutoloadHere not and:[haveAbbrevDotSTC not]) ifTrue:[ |
|
6187 |
f suffix = 'st' ifTrue:[ |
|
6188 |
[ |
|
6189 |
self installAutoloadedClassFromSourceFile:f. |
|
6190 |
f directory baseName = 'libbasic' ifTrue:[self halt]. |
|
6191 |
] on:FileStream openErrorSignal do:[:ex| |
|
6192 |
"ignore this file, but write a warning" |
|
6193 |
Transcript showCR:('Autoload: cannot install %1. (%2)' bindWith:f pathName with:ex description). |
|
6194 |
]. |
|
6195 |
] |
|
6196 |
]. |
|
6197 |
] |
|
10641 | 6198 |
]. |
6199 |
||
11393 | 6200 |
showSplashInLevels >= 0 ifTrue:[ |
22791 | 6201 |
self showSplashMessage:('Smalltalk [info]: installing autoloaded classes from "%1"...' |
6202 |
bindWith:(dirName contractAtBeginningTo:35)). |
|
11392 | 6203 |
]. |
6204 |
||
10641 | 6205 |
" |
6206 |
Smalltalk installAutoloadedClasses |
|
6207 |
" |
|
6208 |
||
15596 | 6209 |
"Modified: / 01-08-2013 / 16:57:49 / cg" |
10641 | 6210 |
! |
6211 |
||
6212 |
replaceReferencesTo:anObject with:newRef |
|
12194
208afdcf182b
comment/format in: #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
12172
diff
changeset
|
6213 |
"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
|
6214 |
Return true, if any reference was changed. |
208afdcf182b
comment/format in: #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
12172
diff
changeset
|
6215 |
Notice: this does not change the class-reference." |
208afdcf182b
comment/format in: #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
12172
diff
changeset
|
6216 |
|
10641 | 6217 |
|toAdd| |
6218 |
||
6219 |
toAdd := OrderedCollection new. |
|
6220 |
self keysAndValuesDo:[:key :val | |
|
18668 | 6221 |
(key == anObject) ifTrue:[ |
6222 |
self shouldImplement. |
|
6223 |
]. |
|
6224 |
(val == anObject ) ifTrue:[ |
|
6225 |
toAdd add:(key -> newRef) |
|
6226 |
]. |
|
10641 | 6227 |
]. |
6228 |
toAdd do:[:each | |
|
18668 | 6229 |
self at:(each key) put:(each value) |
10641 | 6230 |
]. |
6231 |
! |
|
6232 |
||
6233 |
saveEmergencyImage:aBoolean |
|
6234 |
"set/clear the flag which controls if ST/X should save an |
|
6235 |
emergency image in case of a broken display connection. |
|
6236 |
The default is true. |
|
6237 |
This may be useful, if you work with an unsecure display |
|
6238 |
(serial line), and want to have a chance of proceeding after |
|
6239 |
a crash. In multiheaded applications, this only affects |
|
6240 |
crashes of the master Display connection (the initial connection); |
|
6241 |
errors on other displays are reported to the views and treated |
|
6242 |
like window destroy from the windowManager." |
|
6243 |
||
6244 |
SaveEmergencyImage := aBoolean |
|
6245 |
||
6246 |
"Modified: / 24.10.1997 / 18:22:26 / cg" |
|
6247 |
! |
|
6248 |
||
6249 |
systemOrganization |
|
6250 |
"for partial ST80 compatibility; |
|
6251 |
In ST80, Smalltalk organization returns a systemOrganizer, which |
|
6252 |
keeps track of class-categories, while all classes return a classOrganizer |
|
6253 |
from #organization, which keeps track of method categories of that class. |
|
6254 |
Since in ST/X, Smalltalk is a class, there is now a conflict. |
|
6255 |
To make a workaround possible, use #systemOrganization when porting |
|
6256 |
VW apps to ST/X to get the class-categories. |
|
6257 |
Read the documentation in SystemOrganizer for more info." |
|
6258 |
||
6259 |
^ SystemOrganizer for:nil |
|
6260 |
||
6261 |
"Created: / 20.6.1998 / 12:24:02 / cg" |
|
6262 |
"Modified: / 20.6.1998 / 12:41:34 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6263 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6264 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6265 |
!Smalltalk class methodsFor:'system management-fileIn'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6266 |
|
10641 | 6267 |
fileIn:aFileName |
6268 |
"read in the named file - look for it in some standard places; |
|
6269 |
return true if ok, false if failed. |
|
6270 |
This method can load almost anything which makes sense: |
|
18668 | 6271 |
.st - source files |
6272 |
.cls - binary smalltalk bytecode files |
|
6273 |
.so - binary compiled machine code class libraries |
|
6274 |
[.class - java bytecode -- soon to come]" |
|
10641 | 6275 |
|
6276 |
^ self fileIn:aFileName lazy:nil silent:nil logged:false |
|
6277 |
||
6278 |
" |
|
6279 |
Smalltalk fileIn:'source/TicTacToe.st' |
|
6280 |
Smalltalk fileIn:'binary/TicTacToe.cls' |
|
6281 |
Smalltalk fileIn:'binary/TicTacToe.so' |
|
6282 |
" |
|
6283 |
||
6284 |
"Created: 28.10.1995 / 17:06:28 / cg" |
|
6285 |
! |
|
6286 |
||
6287 |
fileIn:aFileName inPackage:aPackageID |
|
6288 |
"read in the named file in a packages directory." |
|
6289 |
||
6290 |
|dir| |
|
6291 |
||
6292 |
dir := self getPackageDirectoryForPackage:aPackageID. |
|
6293 |
dir isNil ifTrue:[^ false]. |
|
6294 |
||
6295 |
dir := dir asFilename. |
|
6296 |
^ (self fileIn:(dir construct:aFileName)) |
|
6297 |
or:[ self fileIn:((dir construct:'source') construct:aFileName) ] |
|
6298 |
! |
|
6299 |
||
6300 |
fileIn:aFileName lazy:lazy |
|
6301 |
"read in the named file - look for it in some standard places; |
|
6302 |
return true if ok, false if failed. |
|
6303 |
If lazy is true, no code is generated for methods, instead stubs |
|
6304 |
are created which compile themself when first executed. This allows |
|
6305 |
for much faster fileIn (but slows down the first execution later). |
|
6306 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
6307 |
code which is known to be syntactically correct." |
|
6308 |
||
6309 |
^ self fileIn:aFileName lazy:lazy silent:nil logged:false |
|
6310 |
||
6311 |
" |
|
6312 |
Smalltalk fileIn:'source/TicTacToe.st' lazy:true |
|
6313 |
" |
|
6314 |
||
6315 |
"Created: 28.10.1995 / 17:06:36 / cg" |
|
6316 |
! |
|
6317 |
||
6318 |
fileIn:aFileName lazy:lazy silent:silent |
|
6319 |
"read in the named file - look for it in some standard places; |
|
6320 |
return true if ok, false if failed. |
|
6321 |
If lazy is true, no code is generated for methods, instead stubs |
|
6322 |
are created which compile themself when first executed. This allows |
|
6323 |
for much faster fileIn (but slows down the first execution later). |
|
6324 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
6325 |
code which is known to be syntactically correct. |
|
6326 |
If silent is true, no compiler messages are output to the transcript. |
|
6327 |
Giving nil for silent/lazy will use the current settings." |
|
6328 |
||
6329 |
^ self fileIn:aFileName lazy:lazy silent:silent logged:false |
|
6330 |
||
6331 |
"Created: 28.10.1995 / 17:06:41 / cg" |
|
6332 |
! |
|
6333 |
||
6334 |
fileIn:aFileNameOrString lazy:lazy silent:silent logged:logged |
|
6335 |
"read in the named file - look for it in some standard places; |
|
6336 |
return true if ok, false if failed. |
|
6337 |
If lazy is true, no code is generated for methods, instead stubs |
|
6338 |
are created which compile themself when first executed. This allows |
|
6339 |
for much faster fileIn (but slows down the first execution later). |
|
6340 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
6341 |
code which is known to be syntactically correct. |
|
6342 |
If silent is true, no compiler messages are output to the transcript. |
|
6343 |
Giving nil for silent/lazy will use the current settings. |
|
6344 |
This method can load almost anything which makes sense: |
|
22791 | 6345 |
.st - source files |
6346 |
.cls - binary smalltalk bytecode files |
|
6347 |
.so - binary compiled machine code class libraries |
|
6348 |
[.class - java bytecode -- soon to come]" |
|
15594 | 6349 |
|
15665 | 6350 |
|fileNameString inStream path morePath bos| |
10641 | 6351 |
|
6352 |
fileNameString := aFileNameOrString asString. |
|
6353 |
||
6354 |
" |
|
6355 |
an object or shared object ? |
|
6356 |
" |
|
6357 |
(ObjectFileLoader notNil |
|
22691 | 6358 |
and:[ObjectFileLoader hasValidBinaryExtension:fileNameString]) ifTrue:[ |
22791 | 6359 |
"/ LoadBinaries ifFalse:[^ false]. |
6360 |
path := self getBinaryFileName:fileNameString. |
|
6361 |
path isNil ifTrue:[ |
|
6362 |
path := self getSystemFileName:fileNameString. |
|
6363 |
path isNil ifTrue:[ |
|
6364 |
^ false |
|
6365 |
]. |
|
6366 |
]. |
|
6367 |
^ (ObjectFileLoader loadObjectFile:path) notNil |
|
15594 | 6368 |
]. |
6369 |
||
6370 |
inStream := self systemFileStreamFor:fileNameString. |
|
6371 |
inStream isNil ifTrue:[^ false]. |
|
10641 | 6372 |
|
22691 | 6373 |
(aFileNameOrString asFilename hasSuffix:'cls') ifTrue:[ |
22791 | 6374 |
BinaryObjectStorage isNil ifTrue:[ |
6375 |
^ false. |
|
6376 |
]. |
|
6377 |
[ |
|
6378 |
inStream binary. |
|
6379 |
bos := BinaryObjectStorage onOld:inStream. |
|
6380 |
bos next. |
|
6381 |
] ensure:[ |
|
6382 |
bos close. |
|
6383 |
]. |
|
6384 |
^ true |
|
15594 | 6385 |
]. |
10641 | 6386 |
|
6387 |
(fileNameString includes:$/) ifTrue:[ |
|
22791 | 6388 |
"/ temporarily prepend the file's directory |
6389 |
"/ to the searchPath. |
|
6390 |
"/ This allows fileIn-driver files to refer to local |
|
6391 |
"/ files via a relative path, and drivers to fileIn other |
|
6392 |
"/ drivers ... |
|
6393 |
morePath := inStream fileName directoryName. |
|
15594 | 6394 |
]. |
15665 | 6395 |
^ self fileInStream:inStream lazy:lazy silent:silent logged:logged addPath:morePath |
15594 | 6396 |
|
6397 |
" |
|
6398 |
Smalltalk fileIn:'clients/TicTacToe/TicTacToe.st' lazy:true silent:true |
|
6399 |
Smalltalk fileIn:'keyboard.rc' |
|
10641 | 6400 |
" |
6401 |
||
6402 |
"Modified: / 08-09-2006 / 19:21:16 / cg" |
|
22691 | 6403 |
"Modified: / 23-04-2018 / 17:05:33 / stefan" |
10641 | 6404 |
! |
6405 |
||
6406 |
fileIn:aFileName logged:logged |
|
6407 |
"read in the named file - look for it in some standard places; |
|
6408 |
return true if ok, false if failed. |
|
6409 |
The argument logged controls, if the changefile is to be updated." |
|
6410 |
||
6411 |
^ self fileIn:aFileName lazy:nil silent:nil logged:logged |
|
6412 |
||
6413 |
" |
|
6414 |
Smalltalk fileIn:'source/TicTacToe.st' logged:false |
|
6415 |
" |
|
6416 |
! |
|
6417 |
||
6418 |
fileIn:aFileName silent:silent |
|
6419 |
"read in the named file - look for it in some standard places; |
|
6420 |
return true if ok, false if failed. |
|
6421 |
If silent is true, no compiler messages are output to the transcript." |
|
6422 |
||
6423 |
^ self fileIn:aFileName lazy:nil silent:silent logged:false |
|
6424 |
||
6425 |
" |
|
6426 |
Smalltalk fileIn:'source/TicTacToe.st' silent:true |
|
6427 |
" |
|
6428 |
||
6429 |
"Created: 28.10.1995 / 17:06:36 / cg" |
|
6430 |
! |
|
6431 |
||
6432 |
fileInChanges |
|
6433 |
"read in the last changes file - bringing the system to the state it |
|
6434 |
had when left the last time. |
|
6435 |
WARNING: this method is rubbish: it should only read things after the |
|
18668 | 6436 |
last '**snapshot**' - entry |
6437 |
(instead of the complete changes file)." |
|
10641 | 6438 |
|
6439 |
" |
|
6440 |
do NOT update the changes file now ... |
|
6441 |
" |
|
6442 |
self fileIn:ChangeFileName logged:false |
|
6443 |
||
6444 |
" |
|
10071 | 6445 |
Smalltalk fileInChanges |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6446 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6447 |
! |
1 | 6448 |
|
10641 | 6449 |
fileInClass:aClassName |
6450 |
"find a source/object file for aClassName and -if found - load it. |
|
6451 |
search is in some standard places trying driver-file (.ld), object-file (.o) and |
|
6452 |
finally source file (.st) in that order. |
|
6453 |
The file is first searched for using the class name, then the abbreviated name." |
|
6454 |
||
6455 |
^ self |
|
18668 | 6456 |
fileInClass:aClassName |
6457 |
package:nil |
|
6458 |
initialize:true |
|
6459 |
lazy:false |
|
6460 |
silent:nil |
|
10641 | 6461 |
|
6462 |
"Modified: / 9.1.1998 / 14:41:46 / cg" |
|
6463 |
! |
|
6464 |
||
6465 |
fileInClass:aClassName fromObject:aFileName |
|
6466 |
"read in the named object file and dynamic-link it into the system |
|
6467 |
- look for it in some standard places. |
|
6468 |
Only install the named class from this object file. |
|
6469 |
Return true if ok, false if failed." |
|
6470 |
||
6471 |
|path ok| |
|
6472 |
||
6473 |
" |
|
6474 |
check if the dynamic loader class is in |
|
6475 |
" |
|
6476 |
(LoadBinaries not or:[ObjectFileLoader isNil]) ifTrue:[^ false]. |
|
6477 |
||
6478 |
(path := self getBinaryFileName:aFileName) isNil ifTrue:[^ false]. |
|
6479 |
ok := (ObjectFileLoader loadClass:aClassName fromObjectFile:path) notNil. |
|
6480 |
ok ifTrue:[ |
|
18668 | 6481 |
VerboseLoading ifTrue:[ |
6482 |
Transcript show:' loaded ' , aClassName , ' from ' ; showCR:aFileName. |
|
6483 |
] |
|
10641 | 6484 |
]. |
6485 |
^ ok |
|
6486 |
||
6487 |
" |
|
6488 |
Smalltalk fileInClass:'AbstractPath' fromObject:'../../goodies/Paths/AbstrPath.so' |
|
6489 |
Smalltalk fileInClass:'ClockView' fromObject:'../../libwidg3/libwidg3.so' |
|
6490 |
" |
|
6491 |
||
13814 | 6492 |
"Modified: / 04-11-2011 / 13:42:24 / cg" |
10641 | 6493 |
! |
6494 |
||
6495 |
fileInClass:aClassName initialize:doInit |
|
6496 |
"find a source/object file for aClassName and -if found - load it. |
|
6497 |
search is in some standard places trying driver-file (.ld), object-file (.o) and |
|
6498 |
finally source file (.st) in that order. |
|
6499 |
The file is first searched for using the class name, then the abbreviated name." |
|
6500 |
||
6501 |
^ self |
|
18668 | 6502 |
fileInClass:aClassName |
6503 |
package:nil |
|
6504 |
initialize:doInit |
|
6505 |
lazy:false |
|
6506 |
silent:nil |
|
10641 | 6507 |
|
6508 |
"Modified: / 9.1.1998 / 14:42:02 / cg" |
|
6509 |
! |
|
6510 |
||
6511 |
fileInClass:aClassName initialize:doInit lazy:loadLazy |
|
6512 |
"find a source/object file for aClassName and -if found - load it. |
|
6513 |
search is in some standard places trying driver-file (.ld), object-file (.o) and |
|
6514 |
finally source file (.st) in that order. |
|
6515 |
The file is first searched for using the class name, then the abbreviated name." |
|
6516 |
||
6517 |
^ self |
|
18668 | 6518 |
fileInClass:aClassName |
6519 |
package:nil |
|
6520 |
initialize:doInit |
|
6521 |
lazy:loadLazy |
|
6522 |
silent:nil |
|
10641 | 6523 |
|
6524 |
"Modified: / 9.1.1998 / 14:42:19 / cg" |
|
6525 |
! |
|
6526 |
||
6527 |
fileInClass:aClassName initialize:doInit lazy:loadLazy silent:beSilent |
|
6528 |
"find a source/object file for aClassName and -if found - load it. |
|
6529 |
Search is in some standard places, trying driver-file (.ld), object-file (.so / .o) and |
|
6530 |
finally source file (.st), in that order. |
|
6531 |
The file is first searched for using the class name, then the abbreviated name. |
|
6532 |
The argument doInit controlls if the class should be sent a #initialize after the |
|
19867 | 6533 |
load; loadLazy tells if it should be loaded lazily. beSilent tells if the compiler |
10641 | 6534 |
should not send notes to the transcript; it can be true, false or nil, where |
6535 |
nil uses the value from SilentLoading." |
|
6536 |
||
6537 |
^ self |
|
22791 | 6538 |
fileInClass:aClassName |
6539 |
package:nil |
|
6540 |
initialize:doInit |
|
6541 |
lazy:loadLazy |
|
6542 |
silent:beSilent |
|
10641 | 6543 |
|
6544 |
"Modified: / 9.1.1998 / 14:42:28 / cg" |
|
6545 |
! |
|
6546 |
||
6547 |
fileInClass:aClassName package:package |
|
6548 |
"find a source/object file for aClassName and -if found - load it. |
|
6549 |
search is in some standard places trying driver-file (.ld), object-file (.o) and |
|
6550 |
finally source file (.st) in that order. |
|
6551 |
The file is first searched for using the class name, then the abbreviated name." |
|
6552 |
||
6553 |
^ self |
|
18668 | 6554 |
fileInClass:aClassName |
6555 |
package:package |
|
6556 |
initialize:true |
|
6557 |
lazy:false |
|
6558 |
silent:nil |
|
10641 | 6559 |
|
6560 |
"Created: / 08-01-2007 / 10:06:09 / cg" |
|
6561 |
! |
|
6562 |
||
10999 | 6563 |
fileInClass:aClassName package:package initialize:doInit lazy:loadLazy silent:beSilent |
10641 | 6564 |
"find a source/object file for aClassName and -if found - load it. |
6565 |
This is the workhorse for autoloading. |
|
10999 | 6566 |
Search is in some standard places, trying driver-file (.ld), object-file (.so / .o) and |
10641 | 6567 |
finally source file (.st), in that order. |
6568 |
The file is first searched for using the class name, then the abbreviated name. |
|
6569 |
The argument doInit controlls if the class should be sent a #initialize after the |
|
19867 | 6570 |
load; loadLazy tells if it should be loaded lazily. beSilent tells if the compiler |
10641 | 6571 |
should not send notes to the transcript; it can be true, false or nil, where |
6572 |
nil uses the value from SilentLoading." |
|
6573 |
||
22955 | 6574 |
|classFileName alternativeClassFileName libName newClass ok wasLazy wasSilent sharedLibSuffix inStream mgr |
10641 | 6575 |
filenameToSet packageDir packageFile bos| |
6576 |
||
17588 | 6577 |
ClassLoadInProgressQuery answerNotifyLoading:aClassName do:[ |
17582 | 6578 |
|
22955 | 6579 |
wasLazy := Compiler compileLazy:loadLazy. |
6580 |
beSilent notNil ifTrue:[ |
|
6581 |
wasSilent := self silentLoading:beSilent. |
|
6582 |
]. |
|
6583 |
||
6584 |
classFileName := Smalltalk fileNameForClass:aClassName. |
|
6585 |
(classFileName = aClassName) ifTrue:[ |
|
6586 |
"/ no abbrev.stc translation for className |
|
6587 |
(aClassName includes:$:) ifTrue:[ |
|
6588 |
"/ a nameSpace name |
|
6589 |
alternativeClassFileName := classFileName copyFrom:(classFileName lastIndexOf:$:)+1 |
|
6590 |
]. |
|
6591 |
]. |
|
6592 |
||
6593 |
classFileName asFilename isAbsolute ifTrue:[ |
|
6594 |
classFileName asFilename suffix notEmptyOrNil ifTrue:[ |
|
6595 |
ok := self fileIn:classFileName lazy:loadLazy silent:beSilent. |
|
6596 |
] ifFalse:[ |
|
6597 |
ok := self fileInSourceFile:classFileName lazy:loadLazy silent:beSilent. |
|
6598 |
] |
|
6599 |
] ifFalse:[ |
|
6600 |
classFileName := classFileName copyReplaceAll:$: with:$_ ifNone:classFileName. |
|
6601 |
[ |
|
6602 |
Class withoutUpdatingChangesDo:[ |
|
6603 |
|zarFn zar entry| |
|
6604 |
||
6605 |
ok := false. |
|
6606 |
||
6607 |
package notNil ifTrue:[ |
|
6608 |
packageDir := package asPackageId packageDirectory. |
|
6609 |
"/ packageDir := package asString. |
|
6610 |
"/ packageDir := packageDir copyReplaceAll:$: with:$/. |
|
6611 |
packageDir isNil ifTrue:[ |
|
6612 |
packageDir := self packageDirectoryForPackageId:package |
|
6613 |
]. |
|
6614 |
packageDir notNil ifTrue:[ |
|
6615 |
packageDir := packageDir asFilename. |
|
6616 |
]. |
|
6617 |
]. |
|
6618 |
||
6619 |
Class packageQuerySignal answer:package do:[ |
|
6620 |
" |
|
6621 |
then, if dynamic linking is available, |
|
6622 |
" |
|
6623 |
(LoadBinaries and:[ObjectFileLoader notNil]) ifTrue:[ |
|
6624 |
sharedLibSuffix := ObjectFileLoader sharedLibrarySuffix. |
|
6625 |
" |
|
6626 |
first look for a class packages shared binary in binary/xxx.o |
|
6627 |
" |
|
6628 |
libName := self libraryFileNameOfClass:aClassName. |
|
6629 |
libName notNil ifTrue:[ |
|
6630 |
(ok := self fileInClass:aClassName fromObject:(libName asFilename withSuffix:sharedLibSuffix) name) |
|
6631 |
ifFalse:[ |
|
6632 |
sharedLibSuffix ~= 'o' ifTrue:[ |
|
6633 |
ok := self fileInClass:aClassName fromObject:(libName, '.o') |
|
6634 |
] |
|
6635 |
]. |
|
6636 |
]. |
|
6637 |
" |
|
6638 |
then, look for a shared binary in binary/xxx.o |
|
6639 |
" |
|
6640 |
ok ifFalse:[ |
|
6641 |
(ok := self fileInClass:aClassName fromObject:(classFileName asFilename withSuffix:sharedLibSuffix) name) |
|
6642 |
ifFalse:[ |
|
6643 |
sharedLibSuffix ~= 'o' ifTrue:[ |
|
6644 |
ok := self fileInClass:aClassName fromObject:(classFileName, '.o') |
|
6645 |
]. |
|
6646 |
ok ifFalse:[ |
|
6647 |
alternativeClassFileName notNil ifTrue:[ |
|
6648 |
(ok := self fileInClass:aClassName fromObject:(alternativeClassFileName asFilename withSuffix:sharedLibSuffix) name) |
|
6649 |
ifFalse:[ |
|
6650 |
sharedLibSuffix ~= 'o' ifTrue:[ |
|
6651 |
ok := self fileInClass:aClassName fromObject:(alternativeClassFileName, '.o') |
|
6652 |
] |
|
6653 |
] |
|
6654 |
]. |
|
6655 |
]. |
|
6656 |
]. |
|
6657 |
]. |
|
6658 |
]. |
|
6659 |
||
6660 |
" |
|
6661 |
if that did not work, look for a compiled-bytecode file ... |
|
6662 |
" |
|
6663 |
ok ifFalse:[ |
|
6664 |
(ok := self fileIn:(classFileName , '.cls') lazy:loadLazy silent:beSilent) |
|
6665 |
ifFalse:[ |
|
6666 |
alternativeClassFileName notNil ifTrue:[ |
|
6667 |
ok := self fileIn:(alternativeClassFileName , '.cls') lazy:loadLazy silent:beSilent |
|
6668 |
] |
|
6669 |
] |
|
6670 |
]. |
|
6671 |
" |
|
6672 |
if that did not work, and the classes package is known, |
|
6673 |
look for an st-cls file |
|
6674 |
in a package subdir of the source-directory ... |
|
6675 |
" |
|
6676 |
ok ifFalse:[ |
|
6677 |
(packageDir notNil and:[BinaryObjectStorage notNil]) ifTrue:[ |
|
6678 |
packageFile := self getPackageFileName:((packageDir / 'classes' / classFileName) addSuffix:'cls'). |
|
6679 |
packageFile isNil ifTrue:[ |
|
6680 |
packageFile := (packageDir / 'classes' / classFileName) addSuffix:'cls'. |
|
6681 |
]. |
|
6682 |
(ok := self fileIn:packageFile lazy:loadLazy silent:beSilent) |
|
6683 |
ifFalse:[ |
|
6684 |
alternativeClassFileName notNil ifTrue:[ |
|
6685 |
packageFile := self getPackageFileName:((packageDir / 'classes' / alternativeClassFileName) addSuffix:'cls'). |
|
6686 |
packageFile isNil ifTrue:[ |
|
6687 |
packageFile := ((packageDir / 'classes' / alternativeClassFileName) addSuffix:'cls'). |
|
6688 |
]. |
|
6689 |
ok := self fileIn:packageFile lazy:loadLazy silent:beSilent |
|
6690 |
] |
|
6691 |
]. |
|
6692 |
||
6693 |
zarFn := self getPackageFileName:(packageDir / 'classes.zip'). |
|
6694 |
zarFn notNil ifTrue:[ |
|
6695 |
zar := ZipArchive oldFileNamed:zarFn. |
|
6696 |
zar notNil ifTrue:[ |
|
6697 |
entry := zar extract:(classFileName , '.cls'). |
|
6698 |
(entry isNil and:[alternativeClassFileName notNil]) ifTrue:[ |
|
6699 |
entry := zar extract:(alternativeClassFileName , '.cls'). |
|
6700 |
]. |
|
6701 |
entry notNil ifTrue:[ |
|
6702 |
bos := BinaryObjectStorage onOld:(entry asByteArray readStream). |
|
6703 |
bos next. |
|
6704 |
bos close. |
|
6705 |
ok := true |
|
6706 |
]. |
|
6707 |
] |
|
6708 |
] |
|
6709 |
] |
|
6710 |
]. |
|
6711 |
||
6712 |
" |
|
6713 |
if that did not work, look for an st-source file ... |
|
6714 |
" |
|
6715 |
ok ifFalse:[ |
|
6716 |
filenameToSet := classFileName. |
|
6717 |
(ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent) |
|
6718 |
ifFalse:[ |
|
6719 |
alternativeClassFileName notNil ifTrue:[ |
|
6720 |
filenameToSet := alternativeClassFileName. |
|
6721 |
ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent |
|
6722 |
]. |
|
6723 |
ok ifFalse:[ |
|
6724 |
" |
|
6725 |
... and in the standard source-directory |
|
6726 |
" |
|
6727 |
filenameToSet := 'source' asFilename / classFileName. |
|
6728 |
(ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent) |
|
6729 |
ifFalse:[ |
|
6730 |
alternativeClassFileName notNil ifTrue:[ |
|
6731 |
filenameToSet := 'source' asFilename / alternativeClassFileName. |
|
6732 |
ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent |
|
6733 |
] |
|
6734 |
] |
|
6735 |
] |
|
6736 |
]. |
|
6737 |
" |
|
6738 |
if that did not work, and the classes package is known, |
|
6739 |
look for an st-source file |
|
6740 |
in a package subdir of the source-directory ... |
|
6741 |
" |
|
6742 |
ok ifFalse:[ |
|
6743 |
packageDir notNil ifTrue:[ |
|
6744 |
packageFile := self getPackageSourceFileName:(packageDir / 'source' / classFileName). |
|
6745 |
packageFile isNil ifTrue:[ |
|
6746 |
packageFile := (packageDir / 'source' / classFileName). |
|
6747 |
]. |
|
6748 |
filenameToSet := packageFile. |
|
6749 |
(ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent) |
|
6750 |
ifFalse:[ |
|
6751 |
alternativeClassFileName notNil ifTrue:[ |
|
6752 |
packageFile := self getPackageSourceFileName:(packageDir / 'source' / alternativeClassFileName). |
|
6753 |
packageFile isNil ifTrue:[ |
|
6754 |
packageFile := (packageDir / 'source' / alternativeClassFileName). |
|
6755 |
]. |
|
6756 |
filenameToSet := packageFile. |
|
6757 |
ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent |
|
6758 |
]. |
|
6759 |
ok ifFalse:[ |
|
6760 |
packageFile := self getPackageSourceFileName:(packageDir / classFileName). |
|
6761 |
packageFile isNil ifTrue:[ |
|
6762 |
packageFile := (packageDir / classFileName). |
|
6763 |
]. |
|
6764 |
filenameToSet := packageFile. |
|
6765 |
(ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent) |
|
6766 |
ifFalse:[ |
|
6767 |
alternativeClassFileName notNil ifTrue:[ |
|
6768 |
packageFile := self getPackageFileName:(packageDir / alternativeClassFileName). |
|
6769 |
packageFile isNil ifTrue:[ |
|
6770 |
packageFile := packageDir / alternativeClassFileName. |
|
6771 |
]. |
|
6772 |
filenameToSet := packageFile. |
|
6773 |
ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent |
|
6774 |
]. |
|
6775 |
ok ifFalse:[ |
|
6776 |
" |
|
6777 |
... and in the standard source-directory |
|
6778 |
" |
|
6779 |
filenameToSet := 'source' asFilename / packageDir / classFileName. |
|
6780 |
(ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent) |
|
6781 |
ifFalse:[ |
|
6782 |
alternativeClassFileName notNil ifTrue:[ |
|
6783 |
filenameToSet := 'source' asFilename / packageDir / alternativeClassFileName. |
|
6784 |
ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent |
|
6785 |
] |
|
6786 |
] |
|
6787 |
] |
|
6788 |
]. |
|
6789 |
]. |
|
6790 |
]. |
|
6791 |
] |
|
6792 |
]. |
|
6793 |
" |
|
6794 |
if that did not work, and the classes package is known, |
|
6795 |
look for a zipArchive containing a class entry. |
|
6796 |
" |
|
6797 |
ok ifFalse:[ |
|
6798 |
packageDir notNil ifTrue:[ |
|
6799 |
zarFn := self getPackageFileName:(packageDir / 'source.zip'). |
|
6800 |
zarFn isNil ifTrue:[ |
|
6801 |
zarFn := packageDir withSuffix:'zip'. |
|
6802 |
zarFn := self getSourceFileName:zarFn. |
|
6803 |
]. |
|
6804 |
(zarFn notNil and:[zarFn asFilename exists]) ifTrue:[ |
|
6805 |
zar := ZipArchive oldFileNamed:zarFn. |
|
6806 |
zar notNil ifTrue:[ |
|
6807 |
entry := zar extract:(classFileName , '.st'). |
|
6808 |
(entry isNil and:[alternativeClassFileName notNil]) ifTrue:[ |
|
6809 |
entry := zar extract:(alternativeClassFileName , '.st'). |
|
6810 |
]. |
|
6811 |
entry notNil ifTrue:[ |
|
6812 |
filenameToSet := zarFn. |
|
6813 |
ok := self |
|
6814 |
fileInStream:(entry asString readStream) |
|
6815 |
lazy:loadLazy |
|
6816 |
silent:beSilent |
|
6817 |
logged:false |
|
6818 |
addPath:nil |
|
6819 |
]. |
|
6820 |
] |
|
6821 |
] |
|
6822 |
] |
|
6823 |
]. |
|
6824 |
||
6825 |
" |
|
6826 |
if that did not work, |
|
6827 |
look for a zipArchive containing a class entry. |
|
6828 |
" |
|
6829 |
ok ifFalse:[ |
|
6830 |
zarFn := self getSourceFileName:'source.zip'. |
|
6831 |
zarFn notNil ifTrue:[ |
|
6832 |
zar := ZipArchive oldFileNamed:zarFn. |
|
6833 |
zar notNil ifTrue:[ |
|
6834 |
entry := zar extract:(zarFn := classFileName , '.st'). |
|
6835 |
(entry isNil and:[alternativeClassFileName notNil]) ifTrue:[ |
|
6836 |
entry := zar extract:(zarFn := alternativeClassFileName , '.st'). |
|
6837 |
]. |
|
6838 |
entry notNil ifTrue:[ |
|
6839 |
filenameToSet := zarFn. |
|
6840 |
ok := self |
|
6841 |
fileInStream:(entry asString readStream) |
|
6842 |
lazy:loadLazy |
|
6843 |
silent:beSilent |
|
6844 |
logged:false |
|
6845 |
addPath:nil |
|
6846 |
]. |
|
6847 |
] |
|
6848 |
] |
|
6849 |
]. |
|
6850 |
ok ifFalse:[ |
|
6851 |
" |
|
6852 |
if there is a sourceCodeManager, ask it for the classes sourceCode |
|
6853 |
" |
|
6854 |
(mgr := Smalltalk at:#SourceCodeManager) notNil ifTrue:[ |
|
6855 |
inStream := mgr getMostRecentSourceStreamForClassNamed:aClassName inPackage:package. |
|
6856 |
inStream notNil ifTrue:[ |
|
6857 |
filenameToSet := nil. |
|
6858 |
ok := self fileInStream:inStream lazy:loadLazy silent:beSilent logged:false addPath:nil. |
|
6859 |
] |
|
6860 |
]. |
|
6861 |
]. |
|
6862 |
]. |
|
6863 |
] |
|
6864 |
]. |
|
6865 |
] ensure:[ |
|
6866 |
Compiler compileLazy:wasLazy. |
|
6867 |
wasSilent notNil ifTrue:[ |
|
6868 |
self silentLoading:wasSilent |
|
6869 |
] |
|
6870 |
]. |
|
6871 |
]. |
|
6872 |
||
6873 |
ok ifTrue:[ |
|
6874 |
newClass := self at:(aClassName asSymbol). |
|
6875 |
newClass notNil ifTrue:[ |
|
6876 |
"set the classes name - but do not change if already set" |
|
6877 |
filenameToSet notNil ifTrue:[ |
|
6878 |
newClass getClassFilename isNil ifTrue:[ |
|
6879 |
newClass setClassFilename:(filenameToSet asFilename baseName) |
|
6880 |
]. |
|
6881 |
]. |
|
6882 |
||
6883 |
doInit ifTrue:[ |
|
6884 |
newClass initialize |
|
6885 |
] |
|
6886 |
] |
|
6887 |
]. |
|
10641 | 6888 |
]. |
6889 |
||
6890 |
^ newClass |
|
6891 |
||
13415 | 6892 |
"Created: / 09-01-1998 / 14:40:32 / cg" |
6893 |
"Modified: / 05-06-1999 / 14:53:01 / cg" |
|
6894 |
"Modified: / 16-08-2009 / 14:52:53 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
10641 | 6895 |
! |
6896 |
||
6897 |
fileInClassLibrary:aClassLibraryName |
|
6898 |
"find an object file containing a binary class library in some standard places |
|
6899 |
and load it. This install all of its contained classes. |
|
6900 |
Return true if ok, false if not. |
|
6901 |
Notice: the argument may not have an extension (by purpose); |
|
18668 | 6902 |
the sharedLib extension (.dll / .so / .sl) is added here, to |
6903 |
make the caller independent of the underlying operatingSystem." |
|
10641 | 6904 |
|
6905 |
|path fn| |
|
6906 |
||
16144 | 6907 |
ObjectFileLoader isNil ifTrue:[ |
18668 | 6908 |
^ PackageLoadError raiseRequestWith:aClassLibraryName errorString:' - no ObjectFileLoader'. |
16144 | 6909 |
]. |
10641 | 6910 |
|
6911 |
fn := aClassLibraryName asFilename withSuffix:(ObjectFileLoader sharedLibrarySuffix). |
|
6912 |
fn := fn pathName. |
|
6913 |
||
6914 |
path := self getBinaryFileName:fn. |
|
6915 |
path isNil ifTrue:[ |
|
18668 | 6916 |
path := self getSystemFileName:fn. |
16144 | 6917 |
]. |
6918 |
path isNil ifTrue:[ |
|
18668 | 6919 |
^ PackageNotFoundError raiseRequestWith:aClassLibraryName. |
16144 | 6920 |
]. |
6921 |
||
6922 |
(ObjectFileLoader loadObjectFile:path) isNil ifTrue:[ |
|
18668 | 6923 |
^ PackageLoadError raiseRequestWith:aClassLibraryName. |
16144 | 6924 |
]. |
6925 |
^ true. |
|
6926 |
||
10641 | 6927 |
|
6928 |
" |
|
6929 |
Smalltalk fileInClassLibrary:'libtable' |
|
6930 |
Smalltalk fileInClassLibrary:'binary/libwidg3' |
|
6931 |
" |
|
6932 |
||
6933 |
"Modified: 8.1.1997 / 17:58:56 / cg" |
|
6934 |
! |
|
6935 |
||
6936 |
fileInClassLibrary:aClassLibraryName inPackage:packageID |
|
6937 |
"find an object file containing a binary class library in some standard places |
|
6938 |
and load it. This installs all of its contained classes. |
|
6939 |
Return true if ok, false if not. |
|
6940 |
Notice: the argument may not have an extension (by purpose); |
|
23177 | 6941 |
the sharedLib extension (.dll / .so / .sl) is added here, to |
6942 |
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
|
6943 |
|
11690 | 6944 |
|baseName handle libraryFilename packagePath| |
10641 | 6945 |
|
16144 | 6946 |
ObjectFileLoader isNil ifTrue:[ |
23177 | 6947 |
^ PackageLoadError raiseRequestWith:packageID errorString:' - no ObjectFileLoader' |
16144 | 6948 |
]. |
10641 | 6949 |
|
6950 |
baseName := aClassLibraryName asFilename withSuffix:(ObjectFileLoader sharedLibrarySuffix). |
|
6951 |
baseName exists ifTrue:[ |
|
23177 | 6952 |
"/ load local file first... |
6953 |
handle := ObjectFileLoader loadObjectFile:baseName. |
|
12744
80f6da0fee57
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
12700
diff
changeset
|
6954 |
]. |
80f6da0fee57
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
12700
diff
changeset
|
6955 |
handle isNil ifTrue:[ |
23177 | 6956 |
packagePath := self getPackageDirectoryForPackage:packageID. |
6957 |
packagePath isNil ifTrue:[ |
|
6958 |
^ PackageNotFoundError raiseRequestWith:packageID. |
|
6959 |
]. |
|
6960 |
libraryFilename := ObjectFileLoader binaryClassFilenameForPackage:packageID inDirectory:packagePath. |
|
6961 |
(libraryFilename notNil and:[libraryFilename exists]) ifTrue:[ |
|
6962 |
handle := ObjectFileLoader loadObjectFile:libraryFilename pathName. |
|
6963 |
]. |
|
16144 | 6964 |
]. |
6965 |
||
6966 |
handle isNil ifTrue:[ |
|
23177 | 6967 |
^ PackageNotFoundError raiseRequestWith:packageID. |
16144 | 6968 |
]. |
12744
80f6da0fee57
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
12700
diff
changeset
|
6969 |
"/ handle notNil ifTrue:[ |
80f6da0fee57
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
12700
diff
changeset
|
6970 |
"/ Transcript showCR:(' Smalltalk: loaded %1.' bindWith:libraryFilename pathName). |
80f6da0fee57
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
12700
diff
changeset
|
6971 |
"/ ]. |
16144 | 6972 |
^ true. |
10641 | 6973 |
|
6974 |
" |
|
6975 |
Smalltalk fileInClassLibrary:'libtable' |
|
6976 |
Smalltalk fileInClassLibrary:'binary/libwidg3' |
|
6977 |
Smalltalk fileInClassLibrary:'refactoryBrowser' inPackage:'stx:goodies/refactoryBrowser' |
|
6978 |
" |
|
6979 |
||
13787
1695a24d0fa7
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
13785
diff
changeset
|
6980 |
"Modified: / 08-10-2011 / 00:08:51 / cg" |
23177 | 6981 |
"Modified: / 02-07-2018 / 14:19:16 / Stefan Vogel" |
10641 | 6982 |
! |
6983 |
||
15073 | 6984 |
fileInSourceFile:filenameArg lazy:loadLazy silent:beSilent |
18560 | 6985 |
"Try all available programming languages for a matching suffix" |
13415 | 6986 |
|
15073 | 6987 |
|filename| |
6988 |
||
6989 |
filename := filenameArg asFilename. |
|
18668 | 6990 |
"/ 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
|
6991 |
"/ | f | |
b088a44b9681
\"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents:
18560
diff
changeset
|
6992 |
"/ |
21338 | 6993 |
"/ "/ 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
|
6994 |
"/ "/ 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
|
6995 |
"/ (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
|
6996 |
"/ (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
|
6997 |
"/ ^ true |
b088a44b9681
\"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents:
18560
diff
changeset
|
6998 |
"/ ]. |
b088a44b9681
\"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents:
18560
diff
changeset
|
6999 |
"/ ] |
b088a44b9681
\"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents:
18560
diff
changeset
|
7000 |
"/ ]. |
b088a44b9681
\"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents:
18560
diff
changeset
|
7001 |
"/ 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
|
7002 |
ProgrammingLanguage allDo:[:lang| | f | |
22791 | 7003 |
f := (filename hasSuffix:lang sourceFileSuffix) |
7004 |
ifTrue:[filename] |
|
7005 |
ifFalse:[filename addSuffix:lang sourceFileSuffix]. |
|
7006 |
(self fileIn:f lazy:loadLazy silent:beSilent) |
|
7007 |
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
|
7008 |
]. |
b088a44b9681
\"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents:
18560
diff
changeset
|
7009 |
|
15073 | 7010 |
^ false |
13415 | 7011 |
|
7012 |
"Created: / 16-08-2009 / 14:45:41 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
7013 |
! |
|
7014 |
||
10641 | 7015 |
fileInStream:streamArg |
7016 |
^ self fileInStream:streamArg lazy:nil silent:nil logged:false addPath:nil |
|
7017 |
! |
|
7018 |
||
7019 |
fileInStream:streamArg lazy:lazy silent:silent logged:logged addPath:morePath |
|
7020 |
"read sourceCode from aStream; |
|
7021 |
return true if ok, false if failed. |
|
7022 |
If lazy is true, no code is generated for methods, instead stubs |
|
7023 |
are created which compile themself when first executed. This allows |
|
7024 |
for much faster fileIn (but slows down the first execution later). |
|
7025 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
7026 |
code which is known to be syntactically correct. |
|
7027 |
If silent is true, no compiler messages are output to the transcript. |
|
7028 |
Giving nil for silent/lazy will use the current settings. |
|
7029 |
If morePath is nonNil, it is prepended to the systemPath temporarily during the |
|
7030 |
fileIn. This allows for st-expressions to refer to more files (i.e. fileIn more) |
|
7031 |
using a relative path." |
|
7032 |
||
11427 | 7033 |
|inStream wasLazy wasSilent oldSystemPath oldRealPath| |
10641 | 7034 |
|
7035 |
inStream := streamArg. |
|
7036 |
inStream isNil ifTrue:[^ false]. |
|
19385 | 7037 |
inStream isLineNumberReadStream ifFalse:[ |
22791 | 7038 |
LineNumberReadStream notNil ifTrue:[ |
7039 |
"/ sigh - is in libbasic2, which is not always present |
|
7040 |
inStream := LineNumberReadStream on:inStream. |
|
7041 |
]. |
|
19385 | 7042 |
]. |
21458 | 7043 |
inStream := EncodedStream decodedStreamFor:inStream. |
10641 | 7044 |
|
7045 |
lazy notNil ifTrue:[wasLazy := Compiler compileLazy:lazy]. |
|
7046 |
silent notNil ifTrue:[wasSilent := self silentLoading:silent]. |
|
7047 |
morePath notNil ifTrue:[ |
|
22791 | 7048 |
oldSystemPath := SystemPath copy. |
7049 |
SystemPath addFirst:morePath. |
|
7050 |
oldRealPath := RealSystemPath. |
|
7051 |
RealSystemPath := nil. |
|
7052 |
]. |
|
7053 |
||
22703 | 7054 |
^ [ |
22791 | 7055 |
(Class updateChangeFileQuerySignal , Class updateChangeListQuerySignal) answer:logged do:[ |
7056 |
"JV: Changed to give ProgrammingLanguage to choose |
|
7057 |
proper reader" |
|
7058 |
((ProgrammingLanguage forStream: inStream) fileInStream: inStream) ~~ #Error |
|
7059 |
] |
|
10641 | 7060 |
] ensure:[ |
22791 | 7061 |
morePath notNil ifTrue:[ |
7062 |
"take care, someone could have changed SystemPath during fileIn!!" |
|
7063 |
(SystemPath copyFrom:2) = oldSystemPath ifTrue:[ |
|
7064 |
SystemPath := oldSystemPath. |
|
7065 |
RealSystemPath := oldRealPath. |
|
7066 |
] ifFalse:[ |
|
7067 |
(oldSystemPath includes:morePath) ifFalse:[ |
|
7068 |
SystemPath remove:morePath ifAbsent:[]. |
|
7069 |
]. |
|
7070 |
RealSystemPath := nil. |
|
7071 |
]. |
|
7072 |
]. |
|
7073 |
lazy notNil ifTrue:[Compiler compileLazy:wasLazy]. |
|
7074 |
silent notNil ifTrue:[self silentLoading:wasSilent]. |
|
7075 |
inStream close |
|
10641 | 7076 |
]. |
7077 |
||
7078 |
" |
|
7079 |
Smalltalk fileInStream:('source/TicTacToe.st' asFilename readStream) lazy:true silent:true |
|
7080 |
" |
|
7081 |
||
13415 | 7082 |
"Modified: / 05-11-1996 / 20:03:35 / cg" |
7083 |
"Modified: / 16-08-2009 / 11:06:05 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
22706 | 7084 |
"Modified: / 24-04-2018 / 23:50:22 / stefan" |
10641 | 7085 |
! |
7086 |
||
7087 |
isClassLibraryLoaded:name |
|
7088 |
"return true, if a particular class library is already loaded" |
|
7089 |
||
7090 |
ObjectMemory |
|
18668 | 7091 |
binaryModuleInfo |
7092 |
do:[:entry | |
|
7093 |
entry type == #classLibrary ifTrue:[ |
|
7094 |
entry libraryName = name ifTrue:[ |
|
7095 |
^ true "/ already loaded |
|
7096 |
] |
|
7097 |
]. |
|
7098 |
]. |
|
10641 | 7099 |
|
7100 |
^ false |
|
7101 |
||
7102 |
" |
|
7103 |
Smalltalk isClassLibraryLoaded:'libstx_libbasic' |
|
7104 |
Smalltalk isClassLibraryLoaded:'libstx_libwidg3' |
|
7105 |
Smalltalk isClassLibraryLoaded:'libstx_libboss' |
|
7106 |
" |
|
7107 |
||
7108 |
"Modified: / 23-08-2006 / 15:54:46 / cg" |
|
7109 |
! |
|
7110 |
||
7111 |
loadClassLibraryIfAbsent:name |
|
7112 |
"dynamically load a classLibrary, if not already loaded |
|
7113 |
and the system supports dynamic loading. |
|
7114 |
Return true, if the library is loaded, false if not. |
|
7115 |
This entry is called without system specific filename |
|
7116 |
extensions - it is portable among different architectures |
|
7117 |
as long as corresponding files (x.so / x.dll / x.sl / x.o) |
|
7118 |
are be present ..." |
|
7119 |
||
7120 |
(self isClassLibraryLoaded:name) ifTrue:[ ^ true ]. "/ already loaded |
|
7121 |
^ self fileInClassLibrary:name |
|
7122 |
||
7123 |
" |
|
7124 |
Smalltalk loadClassLibraryIfAbsent:'libbasic' |
|
7125 |
Smalltalk loadClassLibraryIfAbsent:'libwidg3' |
|
7126 |
" |
|
7127 |
||
7128 |
"Modified: 31.10.1996 / 16:57:24 / cg" |
|
7129 |
! |
|
7130 |
||
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7131 |
secureFileIn:aFileName |
10641 | 7132 |
"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
|
7133 |
Catch various errors during fileIn. |
13000 | 7134 |
Return true if ok, false if failed" |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7135 |
|
22691 | 7136 |
Parser isNil ifTrue:[ |
22791 | 7137 |
^ false "/ for small stand alone apps. |
7138 |
]. |
|
22691 | 7139 |
|
7140 |
^ (SignalSet |
|
22791 | 7141 |
with:AbortOperationRequest |
7142 |
with:TerminateProcessRequest |
|
7143 |
with:ParseError) |
|
7144 |
handle:[:ex | ex return:false ] |
|
7145 |
do:[ self fileIn:aFileName ]. |
|
22691 | 7146 |
|
7147 |
"Modified: / 23-04-2018 / 16:53:29 / stefan" |
|
10641 | 7148 |
! |
7149 |
||
7150 |
silentFileIn:aFilename |
|
7151 |
"same as fileIn:, but do not output 'compiled...'-messages on Transcript. |
|
7152 |
Main use is during startup." |
|
7153 |
||
22691 | 7154 |
^ self silentlyLoadingDo:[ |
22791 | 7155 |
self fileIn:aFilename |
22691 | 7156 |
]. |
7157 |
||
7158 |
"Modified: / 23-04-2018 / 16:57:17 / stefan" |
|
3044 | 7159 |
! ! |
7160 |
||
7161 |
!Smalltalk class methodsFor:'system management-files'! |
|
7162 |
||
20663 | 7163 |
addIdeTopDirectoryToPackagePath |
7164 |
"{ Pragma: +optSpace }" |
|
7165 |
||
7166 |
|topDirectory| |
|
22791 | 7167 |
|
20663 | 7168 |
(topDirectory := OperatingSystem pathOfSTXExecutable) notNil ifTrue:[ |
22791 | 7169 |
topDirectory := topDirectory asFilename. |
7170 |
(topDirectory directory / 'stc') exists ifTrue:[ |
|
7171 |
topDirectory := topDirectory directory. |
|
7172 |
] ifFalse:[ |
|
7173 |
(topDirectory directory directory / 'stc') exists ifTrue:[ |
|
7174 |
topDirectory := topDirectory directory directory. |
|
7175 |
] ifFalse:[ |
|
7176 |
(topDirectory directory directory directory / 'stc') exists ifTrue:[ |
|
7177 |
topDirectory := topDirectory directory directory directory. |
|
7178 |
] ifFalse:[ |
|
7179 |
topDirectory := nil |
|
7180 |
]. |
|
7181 |
]. |
|
7182 |
]. |
|
7183 |
topDirectory notNil ifTrue:[ |
|
7184 |
"/ one above "stx" |
|
7185 |
topDirectory := topDirectory directory pathName. |
|
7186 |
(PackagePath includes:topDirectory) ifFalse:[ |
|
7187 |
PackagePath add:topDirectory |
|
7188 |
] |
|
7189 |
] |
|
20663 | 7190 |
]. |
7191 |
! |
|
7192 |
||
18868 | 7193 |
addWorkspaceDirectoryToPackagePath |
7194 |
"{ Pragma: +optSpace }" |
|
7195 |
||
7196 |
|workspaceDirectory| |
|
22791 | 7197 |
|
18868 | 7198 |
(workspaceDirectory := UserPreferences current workspaceDirectory) notNil ifTrue:[ |
22791 | 7199 |
(workspaceDirectory := workspaceDirectory asFilename) exists ifTrue:[ |
7200 |
workspaceDirectory := workspaceDirectory pathName. |
|
7201 |
(PackagePath includes:workspaceDirectory) ifFalse:[ |
|
7202 |
PackagePath addFirst:workspaceDirectory |
|
7203 |
] |
|
7204 |
] |
|
18868 | 7205 |
]. |
7206 |
! |
|
7207 |
||
10641 | 7208 |
bitmapFileStreamFor:aFileName |
7209 |
"search aFileName in some standard places; |
|
7210 |
return a readonly fileStream or nil if not found. |
|
7211 |
Searches in subdirectories named 'bitmaps' in the SystemPath. |
|
7212 |
Notice: this does not look in the package-specific bitmaps directories." |
|
7213 |
||
7214 |
|aString| |
|
7215 |
||
7216 |
aString := self getBitmapFileName:aFileName. |
|
7217 |
aString notNil ifTrue:[ |
|
18668 | 7218 |
^ aString asFilename readStreamOrNil |
10641 | 7219 |
]. |
7220 |
^ nil |
|
7221 |
! |
|
7222 |
||
7223 |
bitmapFromFileNamed:aFileName forClass:aClass |
|
7224 |
"backward compatibility: |
|
7225 |
search aFileName in some standard places: |
|
7226 |
first in the redefinable bitmaps path, |
|
7227 |
then in the classes own package directory if existing. |
|
7228 |
Return an image or nil." |
|
7229 |
||
7230 |
^ self imageFromFileNamed:aFileName forClass:aClass |
|
7231 |
||
7232 |
" |
|
7233 |
Smalltalk bitmapFromFileNamed:'SmalltalkX.xbm' forClass:View |
|
7234 |
" |
|
7235 |
! |
|
7236 |
||
7237 |
bitmapFromFileNamed:aFileName inPackage:aPackage |
|
7238 |
"backward compatibility: |
|
7239 |
search aFileName in some standard places: |
|
7240 |
first in the redefinable bitmaps path, |
|
7241 |
then in the package directory if existing. |
|
7242 |
Return an image or nil." |
|
7243 |
||
7244 |
^ self imageFromFileNamed:aFileName inPackage:aPackage |
|
7245 |
||
7246 |
" |
|
7247 |
Smalltalk bitmapFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libview' |
|
7248 |
Smalltalk bitmapFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libtool' |
|
7249 |
" |
|
7250 |
! |
|
7251 |
||
7252 |
classNameForFile:aFileName |
|
7253 |
"return the className which corresponds to an abbreviated fileName, |
|
7254 |
or nil if no special translation applies. The given filename arg may |
|
7255 |
include a '.st' suffix (but no other)." |
|
7256 |
||
7257 |
|fn| |
|
7258 |
||
7259 |
(aFileName asFilename hasSuffix:'st') ifTrue:[ |
|
18668 | 7260 |
fn := aFileName copyButLast:3 |
10641 | 7261 |
] ifFalse:[ |
18668 | 7262 |
fn := aFileName |
10641 | 7263 |
]. |
7264 |
^ self filenameAbbreviations keyAtEqualValue:fn ifAbsent:[fn]. |
|
7265 |
||
7266 |
" |
|
7267 |
Smalltalk classNameForFile:'DrawObj' |
|
7268 |
Smalltalk classNameForFile:'DrawObj.st' |
|
7269 |
Smalltalk classNameForFile:'ArrColl.st' |
|
7270 |
Smalltalk classNameForFile:'ArrColl.chg' |
|
7271 |
" |
|
7272 |
||
7273 |
"Modified: 11.12.1995 / 14:51:10 / cg" |
|
7274 |
! |
|
7275 |
||
7276 |
constructPathFor:aDirectoryName |
|
7277 |
"search for aDirectory in SystemPath; |
|
20294 | 7278 |
return a collection of paths which include that directory." |
10641 | 7279 |
|
7280 |
^ self realSystemPath select:[:dirName | |
|
22791 | 7281 |
|fullPath| |
7282 |
||
7283 |
fullPath := dirName asFilename construct:aDirectoryName. |
|
7284 |
"/ fullPath exists and:[fullPath isDirectory and:[fullPath isReadable]] |
|
7285 |
fullPath isDirectory and:[fullPath isReadable] |
|
10641 | 7286 |
]. |
7287 |
! |
|
7288 |
||
7289 |
fileInFileStreamFor:aFileName |
|
7290 |
"obsolete |
|
7291 |
search aFileName in some standard places; |
|
7292 |
return a readonly fileStream or nil if not found. |
|
7293 |
Searches in subdirectories named 'fileIn' in SystemPath" |
|
7294 |
||
7295 |
|aString| |
|
7296 |
||
7297 |
aString := self getFileInFileName:aFileName. |
|
7298 |
aString notNil ifTrue:[ |
|
18668 | 7299 |
^ aString asFilename readStreamOrNil |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7300 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7301 |
^ nil |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7302 |
! |
7758 | 7303 |
|
12022 | 7304 |
fileNameForClass:aClassOrClassName |
7305 |
"return a actual or expected (or most wanted) filename for aClassOrClassName |
|
7306 |
- only the base name (without directory part) and without suffix." |
|
7307 |
||
15958 | 7308 |
|cls nonMetaclass nm nameWithPrefix nameWithoutPrefix compatQuery compatPkg | |
12022 | 7309 |
|
12301 | 7310 |
"/ This was added as an extension of libsvn - should be no longer needed |
15958 | 7311 |
"/ JV@2012-09-25: but it actually is. The problem is that class filename |
7312 |
"/ is stored in the class itself and used to generate abbrev.stc and |
|
7313 |
"/ prerequisites in makefiles. But if you renamed such a stc-compiled class, |
|
7314 |
"/ the filename remains the same, but SVN __ALWAYS__ keep container name |
|
7315 |
"/ and class name in sync. Therefore build files gets messed up. Indeed, this |
|
7316 |
"/ should be fixed in code that files-out the package and generates build files. |
|
7317 |
"/ Certainly a hack, but do not remove this until fixed elsewhere |
|
7318 |
||
7319 |
compatQuery := Smalltalk classNamed: 'SVN::CompatModeQuery'. |
|
7320 |
(compatQuery notNil |
|
7321 |
and:[compatQuery isLoaded |
|
18668 | 7322 |
and:[compatQuery query not]]) ifTrue:[ |
7323 |
nm := aClassOrClassName isBehavior |
|
7324 |
ifTrue:[aClassOrClassName name] |
|
7325 |
ifFalse:[aClassOrClassName]. |
|
7326 |
nm := nm copyReplaceAll:$: with:$_ ifNone:nm. |
|
7327 |
^nm |
|
15958 | 7328 |
]. |
7329 |
||
16122
18c865388947
Fix in Smalltalk>>#fileNameForClass: - required by libscm to support nested packages.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16117
diff
changeset
|
7330 |
"/ 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
|
7331 |
"/ 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
|
7332 |
"/ 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
|
7333 |
"/ of classes OUTSIDE filed-out package when generating makefile dependencies. |
15958 | 7334 |
compatQuery := Smalltalk classNamed: 'SCMCompatModeQuery'. |
7335 |
(compatQuery notNil |
|
7336 |
and:[compatQuery isLoaded |
|
18668 | 7337 |
and:[(compatPkg := compatQuery query) notNil]]) ifTrue:[ |
7338 |
| compatPkgs | |
|
7339 |
"/ Originally libscm could only fileout one package at time so |
|
7340 |
"/ the query answered one package name. However, to support nested |
|
7341 |
"/ packages, libscm is being rewritten to commit multiple packages |
|
7342 |
"/ at once, so query answers a collection of packages. The code below |
|
7343 |
"/ makes sure it works for both. |
|
7344 |
compatPkgs := compatPkg isString ifTrue:[ Array with: compatPkg] ifFalse:[ compatPkg ]. |
|
7345 |
nm := aClassOrClassName isBehavior |
|
7346 |
ifTrue:[aClassOrClassName name] |
|
7347 |
ifFalse:[aClassOrClassName]. |
|
7348 |
cls := Smalltalk at: nm asSymbol. |
|
7349 |
(cls notNil and:[compatPkgs includes: cls package]) ifTrue:[ |
|
7350 |
nm := nm copyReplaceAll:$: with:$_. |
|
7351 |
^nm |
|
7352 |
]. |
|
15958 | 7353 |
]. |
12301 | 7354 |
|
12022 | 7355 |
aClassOrClassName isBehavior ifTrue:[ |
18668 | 7356 |
cls := aClassOrClassName. |
12022 | 7357 |
] ifFalse:[ |
18668 | 7358 |
cls := Smalltalk classNamed:aClassOrClassName. |
7359 |
cls isNil ifTrue:[ |
|
7360 |
nameWithPrefix := aClassOrClassName. |
|
7361 |
nameWithoutPrefix := (aClassOrClassName copyFrom:(aClassOrClassName lastIndexOf:$:)+1). |
|
7362 |
]. |
|
12022 | 7363 |
]. |
7364 |
||
7365 |
cls notNil ifTrue:[ |
|
18668 | 7366 |
nonMetaclass := cls theNonMetaclass. |
7367 |
nm := nonMetaclass getClassFilename. |
|
7368 |
nm isNil ifTrue:[ |
|
7369 |
|revisionInfo| |
|
7370 |
||
7371 |
(revisionInfo := cls revisionInfo) notNil ifTrue:[ |
|
7372 |
nm := revisionInfo fileName. |
|
7373 |
]. |
|
7374 |
]. |
|
7375 |
nm notNil ifTrue:[ |
|
7376 |
^ nm asFilename withoutSuffix baseName |
|
7377 |
]. |
|
7378 |
nameWithPrefix := nonMetaclass name. |
|
7379 |
nameWithoutPrefix := nonMetaclass nameWithoutPrefix. |
|
12022 | 7380 |
]. |
7381 |
||
7382 |
CachedAbbreviations notNil ifTrue:[ |
|
18668 | 7383 |
nameWithPrefix := nameWithPrefix asSymbol. |
7384 |
(CachedAbbreviations includesKey:nameWithPrefix) ifTrue:[ |
|
7385 |
^ (CachedAbbreviations at:nameWithPrefix) asFilename baseName |
|
7386 |
]. |
|
7387 |
nameWithoutPrefix := nameWithoutPrefix asSymbol. |
|
7388 |
(CachedAbbreviations includesKey:nameWithoutPrefix) ifTrue:[ |
|
7389 |
^ (CachedAbbreviations at:nameWithoutPrefix) asFilename baseName |
|
7390 |
]. |
|
12022 | 7391 |
]. |
7392 |
||
7393 |
^ nameWithPrefix copyReplaceAll:$: with:$_ |
|
7394 |
||
7395 |
" |
|
7396 |
Smalltalk fileNameForClass:#Complex |
|
7397 |
Smalltalk fileNameForClass:'SmallInteger' |
|
7398 |
Smalltalk fileNameForClass:'UnixOperatingSystem' |
|
7399 |
Smalltalk fileNameForClass:'Launcher' |
|
7400 |
Smalltalk fileNameForClass:'SomeUnknownClass' |
|
7401 |
||
7402 |
Smalltalk fileNameForClass:HTML::Encoder |
|
7403 |
Smalltalk fileNameForClass:OSI::FTAMOperation |
|
7404 |
Smalltalk fileNameForClass:'OSI::Foobar' |
|
7405 |
Smalltalk fileNameForClass:(Workflow::UnsuccessfulFinishReasons) |
|
7406 |
Workflow::UnsuccessfulFinishReasons classFilename |
|
7407 |
" |
|
7408 |
||
7409 |
"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
|
7410 |
"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
|
7411 |
"Modified (comment): / 23-02-2014 / 12:39:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
12022 | 7412 |
! |
7413 |
||
10641 | 7414 |
filenameAbbreviations |
7415 |
"return a dictionary containing the classname-to-filename |
|
7416 |
mappings. (needed for sys5.3 users, where filenames are limited |
|
7417 |
to 14 chars)" |
|
7418 |
||
7419 |
CachedAbbreviations isNil ifTrue:[ |
|
18668 | 7420 |
self readAbbreviations |
10641 | 7421 |
]. |
7422 |
^ CachedAbbreviations |
|
7423 |
||
7424 |
"flush with: |
|
7425 |
||
7426 |
CachedAbbreviations := nil |
|
7427 |
" |
|
7428 |
" |
|
7429 |
Smalltalk filenameAbbreviations |
|
7430 |
" |
|
7431 |
! |
|
7432 |
||
13368 | 7433 |
findPackageDirectoryForPackage:aPackage |
7434 |
"find a packages directory along a number of standard places" |
|
7435 |
||
7436 |
|relDir| |
|
7437 |
||
7438 |
relDir := Smalltalk relativePackagePathForPackage:aPackage. |
|
7439 |
relDir asFilename isAbsolute ifTrue:[^ relDir]. |
|
7440 |
||
7441 |
^ Smalltalk getPackageFileName:relDir. |
|
7442 |
||
7443 |
" |
|
7444 |
Smalltalk findPackageDirectoryForPackage:'stx:libview/resources' |
|
7445 |
Smalltalk findPackageDirectoryForPackage:'stx:libview' |
|
7446 |
" |
|
7447 |
! |
|
7448 |
||
10641 | 7449 |
flushPathCaches |
7450 |
"{ Pragma: +optSpace }" |
|
7451 |
||
7452 |
"forget pathCaches - these are collections containing valid directory names, |
|
7453 |
where system files (resource, bitmaps etc.) are found. |
|
7454 |
A flush is only required, if a new system directory has been created while |
|
7455 |
the system is active, and those files should override the others |
|
7456 |
(for example, if you created a private resource directory)" |
|
7457 |
||
7458 |
RealSystemPath := ResourcePath := SourcePath := |
|
15332 | 7459 |
BinaryPath := FileInPath := nil. |
7460 |
||
10641 | 7461 |
" |
7462 |
Smalltalk flushPathCaches |
|
7463 |
" |
|
7464 |
! |
|
7465 |
||
7466 |
getBinaryFileName:aFileName |
|
7467 |
"obsolete |
|
7468 |
search aFileName in some standard places |
|
7469 |
(subdirectories named 'binary' in SystemPath); |
|
7470 |
return the absolute filename or nil if none is found." |
|
7471 |
||
7472 |
BinaryPath isNil ifTrue:[ |
|
18668 | 7473 |
BinaryPath := self constructPathFor:BinaryDirName |
10641 | 7474 |
]. |
7475 |
||
7476 |
^ self searchPath:BinaryPath for:aFileName in:BinaryDirName |
|
7477 |
||
7478 |
"Modified: 18.7.1996 / 15:53:49 / cg" |
|
7479 |
! |
|
7480 |
||
7481 |
getBitmapFileName:aFileName |
|
7482 |
"for backward compatibility: |
|
7483 |
search aFileName in some standard places |
|
7484 |
(subdirectories named 'bitmaps' in SystemPath); |
|
7485 |
Return the pathName or nil if none is found." |
|
7486 |
||
7487 |
^ self getBitmapFileName:aFileName forPackage:nil |
|
7488 |
||
7489 |
" |
|
7490 |
Smalltalk getBitmapFileName:'SBrowser.xbm' |
|
7491 |
" |
|
7492 |
||
7493 |
"Modified: 18.7.1996 / 15:53:55 / cg" |
|
7494 |
! |
|
7495 |
||
7496 |
getBitmapFileName:aFileName forPackage:aPackageIDOrNil |
|
7497 |
"for backward compatibility. |
|
7498 |
search aFileName in some standard places: |
|
7499 |
first in the redefinable bitmaps path, |
|
7500 |
then in the package directory if existing. |
|
7501 |
Return a path or nil. |
|
7502 |
Search order is: |
|
18668 | 7503 |
bitmaps/<pkg>/file |
7504 |
resources/<pkg>/bitmaps/file |
|
7505 |
<pkg>/bitmaps/file |
|
10641 | 7506 |
" |
7507 |
||
7508 |
|f dir packageDir pF| |
|
7509 |
||
15225 | 7510 |
f := aFileName asString withoutPrefix:'bitmaps/'. |
10641 | 7511 |
|
7512 |
aPackageIDOrNil isNil ifTrue:[ |
|
18668 | 7513 |
"/ this will be an error in the future |
10641 | 7514 |
"/ 'Smalltalk [warning]: bitmap file access without package: ' infoPrint. aFileName infoPrintCR. |
7515 |
"/ self halt. |
|
7516 |
||
18668 | 7517 |
pF := self searchPath:(self realSystemPath) for:aFileName in:('bitmaps'). |
7518 |
pF notNil ifTrue:[ |
|
7519 |
^ pF. |
|
7520 |
]. |
|
7521 |
f ~= aFileName ifTrue:[ |
|
7522 |
pF := self searchPath:(self realSystemPath) for:f in:('bitmaps'). |
|
7523 |
pF notNil ifTrue:[ |
|
7524 |
^ pF. |
|
7525 |
]. |
|
7526 |
]. |
|
7527 |
^ nil |
|
11077
14df4640ed89
image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents:
11057
diff
changeset
|
7528 |
]. |
14df4640ed89
image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents:
11057
diff
changeset
|
7529 |
|
14df4640ed89
image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents:
11057
diff
changeset
|
7530 |
dir := self projectDirectoryForPackage:aPackageIDOrNil. |
14df4640ed89
image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents:
11057
diff
changeset
|
7531 |
dir notNil ifTrue:[ |
18668 | 7532 |
pF := dir asFilename / f. |
7533 |
pF exists ifTrue:[ |
|
7534 |
^ pF. |
|
7535 |
]. |
|
7536 |
pF := dir asFilename / 'bitmaps' /f. |
|
7537 |
pF exists ifTrue:[ |
|
7538 |
^ pF. |
|
7539 |
]. |
|
10641 | 7540 |
]. |
7541 |
||
7542 |
packageDir := aPackageIDOrNil copyReplaceAll:$: with:$/. |
|
7543 |
||
7544 |
pF := self searchPath:(self realSystemPath) for:aFileName in:('bitmaps/',packageDir). |
|
7545 |
pF notNil ifTrue:[ |
|
18668 | 7546 |
^ pF. |
10641 | 7547 |
]. |
7548 |
pF := self searchPath:(self realSystemPath) for:aFileName in:('resources/',packageDir,'/bitmaps'). |
|
7549 |
pF notNil ifTrue:[ |
|
18668 | 7550 |
^ pF. |
11077
14df4640ed89
image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents:
11057
diff
changeset
|
7551 |
]. |
14df4640ed89
image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents:
11057
diff
changeset
|
7552 |
|
10641 | 7553 |
^ nil |
7554 |
||
7555 |
" |
|
7556 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libview' |
|
7557 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libtool' |
|
7558 |
Smalltalk imageFromFileNamed:'bitmaps/gifImages/garfield.gif' inPackage:'stx:goodies' |
|
7559 |
Smalltalk imageFromFileNamed:'CheckOn10_xp.xpm' inPackage:'stx:libwidg' |
|
7560 |
" |
|
7561 |
||
7562 |
"Modified: / 11-10-2006 / 13:53:18 / cg" |
|
7563 |
! |
|
7564 |
||
7565 |
getFileInFileName:aFileName |
|
7566 |
"obsolete |
|
7567 |
search aFileName in some standard places |
|
7568 |
(subdirectories named 'fileIn' in SystemPath); |
|
7569 |
return the absolute filename or nil if none is found." |
|
7570 |
||
7571 |
FileInPath isNil ifTrue:[ |
|
18668 | 7572 |
FileInPath := self constructPathFor:FileInDirName |
10641 | 7573 |
]. |
7574 |
||
7575 |
^ self searchPath:FileInPath for:aFileName in:FileInDirName |
|
7576 |
||
7577 |
"Modified: 18.7.1996 / 15:53:59 / cg" |
|
7578 |
! |
|
7579 |
||
7580 |
getPackageDirectoryForPackage:aPackageID |
|
7581 |
"search for a particular package; return its directory, or nil. |
|
7582 |
Stand alone applications might get nil, if there are only binaries installed." |
|
7583 |
||
19121 | 7584 |
|packageId checkForPackageDirectory module packageSubDirectory| |
7585 |
||
7586 |
packageId := aPackageID asPackageId. |
|
7587 |
module := packageId module. |
|
7588 |
packageSubDirectory := packageId directory. |
|
10641 | 7589 |
|
7590 |
checkForPackageDirectory := |
|
22791 | 7591 |
[:moduleDir | |
7592 |
|packageDir| |
|
7593 |
||
7594 |
moduleDir isDirectory ifTrue:[ |
|
7595 |
packageDir := moduleDir / packageSubDirectory. |
|
7596 |
packageDir isDirectory ifTrue:[ |
|
7597 |
^ packageDir |
|
7598 |
] |
|
7599 |
]. |
|
7600 |
]. |
|
10641 | 7601 |
|
7602 |
self packagePath do:[:aPath | |
|
22791 | 7603 |
|moduleDir| |
7604 |
||
7605 |
moduleDir := aPath asFilename / module. |
|
7606 |
checkForPackageDirectory value:moduleDir. |
|
10641 | 7607 |
]. |
7608 |
||
7609 |
^ nil |
|
7610 |
||
7611 |
" |
|
7612 |
Smalltalk getPackageDirectoryForPackage:(Array package) |
|
7613 |
Smalltalk getPackageDirectoryForPackage:'stx:goodies/bitmaps' |
|
7614 |
Smalltalk getPackageDirectoryForPackage:'stx:libview' |
|
7615 |
" |
|
7616 |
||
7617 |
"Modified: / 06-10-2006 / 11:49:27 / cg" |
|
7618 |
! |
|
7619 |
||
7620 |
getPackageFileName:aFileName |
|
7621 |
"search aFileName in some standard places |
|
7622 |
(packagePath and subdirectories named 'packages' in SystemPath); |
|
7623 |
return the absolute filename or nil if none is found." |
|
7624 |
||
7625 |
|f| |
|
7626 |
||
7627 |
"/ search along packagePath ... |
|
7628 |
f := self searchPath:self packagePath for:aFileName in:nil. |
|
7629 |
f isNil ifTrue:[ |
|
18668 | 7630 |
"/ search under packages-directory along systemPath ... |
7631 |
f := self searchPath:self realSystemPath for:aFileName in:PackageDirName. |
|
7632 |
"/ kludge - allow for stx-directory to be named differently |
|
7633 |
f isNil ifTrue:[ |
|
7634 |
(aFileName asString startsWith:('stx' , Filename separator)) ifTrue:[ |
|
7635 |
f := '..' asFilename / '..' / (aFileName copyFrom:5). |
|
7636 |
] |
|
7637 |
]. |
|
10641 | 7638 |
]. |
7639 |
(f notNil and:[(f := f asFilename) exists]) ifTrue:[ |
|
18668 | 7640 |
^ f pathName |
7758 | 7641 |
]. |
7642 |
^ nil |
|
10641 | 7643 |
|
7644 |
" |
|
16668
b88318df967d
flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents:
16666
diff
changeset
|
7645 |
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
|
7646 |
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
|
7647 |
Smalltalk getPackageFileName:'stx/libview/source.zip' |
10641 | 7648 |
" |
7649 |
! |
|
7650 |
||
15074 | 7651 |
getPackageSourceFileName:filenameWithoutSuffixArg |
13415 | 7652 |
"search aFileName in some standard places and try all available languages" |
7653 |
||
15074 | 7654 |
|filenameWithoutSuffix| |
7655 |
||
7656 |
filenameWithoutSuffix:= filenameWithoutSuffixArg asFilename. |
|
7657 |
||
16170
ca4d03def070
endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents:
16164
diff
changeset
|
7658 |
ProgrammingLanguage |
18668 | 7659 |
allDo:[:lang | |
7660 |
|file| |
|
7661 |
||
7662 |
file := self |
|
7663 |
getPackageFileName:(filenameWithoutSuffix addSuffix:lang sourceFileSuffix). |
|
7664 |
file notNil ifTrue:[ ^ file ] |
|
7665 |
]. |
|
15074 | 7666 |
^ nil |
13415 | 7667 |
|
7668 |
"Created: / 16-08-2009 / 14:44:58 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
7669 |
! |
|
7670 |
||
10641 | 7671 |
getResourceFileName:aFileName |
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7672 |
<resource: #obsolete> |
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7673 |
|
10641 | 7674 |
"search aFileName in some standard places |
7675 |
(subdirectories named 'resources' in SystemPath); |
|
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7676 |
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
|
7677 |
Obsolete: you must now provide a package argument." |
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7678 |
|
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7679 |
self obsoleteMethodWarning:'use getResourceFileName:forPackage:'. |
10641 | 7680 |
^ self getResourceFileName:aFileName forPackage:nil |
7681 |
||
7682 |
" |
|
7683 |
Smalltalk getResourceFileName:'SystemBrowser.rs' |
|
7684 |
" |
|
7685 |
||
7686 |
"Modified: 18.7.1996 / 15:54:03 / cg" |
|
7687 |
! |
|
7688 |
||
7689 |
getResourceFileName:aFileName forClass:aClassOrNil |
|
7690 |
"search aFileName in some standard places |
|
7691 |
(subdirectories named 'resource' in SystemPath); |
|
7692 |
and in aClasses package directory. |
|
7693 |
Return the absolute filename or nil if none is found." |
|
7694 |
||
7695 |
|pkgOrNil| |
|
7696 |
||
7697 |
aClassOrNil notNil ifTrue:[ |
|
18668 | 7698 |
pkgOrNil := aClassOrNil package. |
10641 | 7699 |
]. |
7700 |
^ self getResourceFileName:aFileName forPackage:pkgOrNil. |
|
7701 |
||
7702 |
" |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7703 |
Smalltalk getResourceFileName:'de.rs' forClass:SystemBrowser |
10641 | 7704 |
" |
7705 |
! |
|
7706 |
||
7707 |
getResourceFileName:aFileName forPackage:aPackageIDOrNil |
|
7708 |
"search aFileName in some standard places |
|
7709 |
(subdirectories named 'resource' in SystemPath); |
|
7710 |
and in a packages directory. |
|
7711 |
Return the absolute filename or nil if none is found. |
|
7712 |
Search order is: |
|
18668 | 7713 |
resources/<pkg>/file |
7714 |
<pkg>/resources/file |
|
10641 | 7715 |
" |
7716 |
||
7717 |
|pF f dir packageDir| |
|
7718 |
||
15225 | 7719 |
f := aFileName asString withoutPrefix:'resources/'. |
10641 | 7720 |
|
7721 |
aPackageIDOrNil isNil ifTrue:[ |
|
18668 | 7722 |
"/ this will be an error in the future |
10641 | 7723 |
"/ 'Smalltalk [warning]: resource file access without package: ' infoPrint. aFileName infoPrintCR. |
7724 |
"/ self halt. |
|
7725 |
||
18668 | 7726 |
pF := self searchPath:(self realSystemPath) for:aFileName in:('resources'). |
7727 |
pF notNil ifTrue:[ |
|
7728 |
^ pF. |
|
7729 |
]. |
|
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7730 |
"/ pF := self searchPath:(self realSystemPath) for:aFileName in:('resources/styles'). |
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7731 |
"/ pF notNil ifTrue:[ |
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7732 |
"/ ^ pF. |
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7733 |
"/ ]. |
18668 | 7734 |
f ~= aFileName ifTrue:[ |
7735 |
pF := self searchPath:(self realSystemPath) for:f in:('resources'). |
|
7736 |
pF notNil ifTrue:[ |
|
7737 |
^ pF. |
|
7738 |
]. |
|
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7739 |
"/ pF := self searchPath:(self realSystemPath) for:f in:('resources/styles'). |
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7740 |
"/ pF notNil ifTrue:[ |
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7741 |
"/ ^ pF. |
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7742 |
"/ ]. |
18668 | 7743 |
]. |
7744 |
^ nil |
|
10641 | 7745 |
]. |
7746 |
||
7747 |
packageDir := aPackageIDOrNil copyReplaceAll:$: with:$/. |
|
7748 |
||
7749 |
pF := self searchPath:(self realSystemPath) for:aFileName in:('resources/',packageDir). |
|
7750 |
pF notNil ifTrue:[ |
|
18668 | 7751 |
^ pF. |
10641 | 7752 |
]. |
7753 |
||
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7754 |
"/ the following code finds the file within the IDE's own hierarchy |
10641 | 7755 |
dir := self projectDirectoryForPackage:aPackageIDOrNil. |
7756 |
dir notNil ifTrue:[ |
|
18668 | 7757 |
dir := dir asFilename. |
7758 |
||
7759 |
(pF := dir / 'resources' / f) exists ifTrue:[ ^ pF name ]. |
|
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7760 |
"/ (pF := dir / 'styles' / f) exists ifTrue:[ ^ pF name ]. |
12377 | 7761 |
|
18668 | 7762 |
"resolve something like: 'ASN/definition.asn1'" |
7763 |
(pF := dir / f) exists ifTrue:[ ^ pF name ]. |
|
12377 | 7764 |
]. |
7765 |
||
10641 | 7766 |
^ nil |
7767 |
||
7768 |
" |
|
7769 |
Smalltalk getResourceFileName:'SystemBrowser.rs' forPackage:'stx:libtool' |
|
7770 |
Smalltalk getResourceFileName:'normal.style' forPackage:'stx:libview' |
|
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7771 |
Smalltalk getResourceFileName:'styles/normal.style' forPackage:'stx:libview' |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7772 |
Smalltalk getResourceFileName:'styles/mswindowsXP.style' forPackage:'stx:libview' |
10641 | 7773 |
Smalltalk getResourceFileName:'Foo.rs' forPackage:'stx:libview' |
7774 |
" |
|
7775 |
||
7776 |
"Modified: / 11-10-2006 / 13:53:43 / cg" |
|
7777 |
! |
|
7778 |
||
7779 |
getSourceFileName:aFileName |
|
7780 |
"search aFileName in some standard places |
|
7781 |
(subdirectories named 'source' in SystemPath); |
|
7782 |
return the absolute filename or nil if none is found. |
|
7783 |
This is used to find a sourceFile for a methods source, |
|
7784 |
if no sourceCodeManager is available." |
|
7785 |
||
7786 |
|f| |
|
7787 |
||
7788 |
SourcePath isNil ifTrue:[ |
|
18668 | 7789 |
SourcePath := self constructPathFor:SourceDirName |
10641 | 7790 |
]. |
7791 |
||
7792 |
"/ first, try a source subdir along the path. |
|
7793 |
SourcePath notNil ifTrue:[ |
|
18668 | 7794 |
f := self searchPath:SourcePath for:aFileName in:SourceDirName. |
10641 | 7795 |
]. |
7796 |
f isNil ifTrue:[ |
|
18668 | 7797 |
"/ then, try it itself along the path. |
7798 |
f := self searchPath:self realSystemPath for:aFileName in:nil |
|
10641 | 7799 |
]. |
7800 |
^ f |
|
7801 |
||
7802 |
" |
|
7803 |
Smalltalk getSourceFileName:'Smalltalk.st' |
|
7804 |
Smalltalk getSourceFileName:'ArrColl.st' |
|
7805 |
" |
|
7806 |
||
7807 |
"Modified: 18.7.1996 / 15:54:07 / cg" |
|
7808 |
! |
|
7809 |
||
7810 |
getSystemFileName:aFileNameOrString |
|
7811 |
"search aFileNameOrString in some standard places; |
|
7812 |
return the absolute filename or nil if none is found. |
|
7813 |
see comment in Smalltalk>>initSystemPath. |
|
7814 |
This should be used to access resources such as bitmaps, doc-files, |
|
7815 |
and other help files. |
|
7816 |
" |
|
7817 |
||
7818 |
"credits for this method go to Markus ...." |
|
7819 |
||
7820 |
|fn nameString| |
|
7821 |
||
7822 |
fn := aFileNameOrString asFilename. |
|
7823 |
nameString := fn name. |
|
7824 |
fn isAbsolute ifTrue:[ |
|
22791 | 7825 |
"don't use path for absolute file names" |
7826 |
||
7827 |
^ nameString |
|
10641 | 7828 |
]. |
7829 |
||
7830 |
self realSystemPath do:[:dirName | |
|
22791 | 7831 |
|realName| |
7832 |
||
7833 |
realName := dirName asFilename / nameString. |
|
7834 |
"/ |
|
7835 |
"/ here, we also return true if it's a directory |
|
7836 |
"/ (Even if unreadable). |
|
7837 |
"/ It could be that the file itself is still readable. |
|
7838 |
"/ |
|
7839 |
(realName isDirectory or:[realName isReadable]) ifTrue: [ |
|
7840 |
^ realName name |
|
7841 |
] |
|
10641 | 7842 |
]. |
7843 |
^ nil |
|
7844 |
||
7845 |
" |
|
7846 |
Smalltalk getSystemFileName:'doc/online/english/TOP.html' |
|
7847 |
Smalltalk getSystemFileName:'bitmaps/SBrowser.xbm' |
|
7848 |
Smalltalk getSystemFileName:'bitmaps/foo' |
|
7849 |
Smalltalk getSystemFileName:'resources/View.rs' |
|
7850 |
Smalltalk getSystemFileName:'resources/iris.style' |
|
7851 |
" |
|
7852 |
||
21443 | 7853 |
"Modified: / 06-05-1999 / 10:40:37 / cg" |
7854 |
"Modified (comment): / 13-02-2017 / 20:30:51 / cg" |
|
10641 | 7855 |
! |
7856 |
||
7857 |
imageFromFileNamed:aFileName forClass:aClass |
|
7858 |
"search aFileName in some standard places: |
|
7859 |
first in the redefinable bitmaps path, then in the classes |
|
7860 |
own package directory if existing. |
|
7861 |
Return an image or nil." |
|
7862 |
||
7863 |
|classPackage img| |
|
7864 |
||
7865 |
classPackage := aClass package. |
|
7866 |
img := self imageFromFileNamed:aFileName inPackage:classPackage. |
|
7867 |
img isNil ifTrue:[ |
|
18668 | 7868 |
"/ try under the goodies package ... |
7869 |
classPackage ~= 'stx:goodies' ifTrue:[ |
|
7870 |
img := self imageFromFileNamed:aFileName inPackage:'stx:goodies'. |
|
7871 |
] |
|
10641 | 7872 |
]. |
7873 |
^ img |
|
7874 |
||
7875 |
" |
|
7876 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' forClass:View |
|
7877 |
" |
|
7878 |
! |
|
7879 |
||
7880 |
imageFromFileNamed:aFileName inPackage:aPackage |
|
7881 |
"search aFileName in some standard places: |
|
7882 |
first in the redefinable bitmaps path, |
|
7883 |
then in the package directory if existing. |
|
7884 |
Return an image or nil. |
|
7885 |
Search order is: |
|
18668 | 7886 |
bitmaps/<pkg>/file |
7887 |
resources/<pkg>/bitmaps/file |
|
7888 |
<pkg>/bitmaps/file |
|
10641 | 7889 |
" |
7890 |
||
7891 |
|path| |
|
7892 |
||
7893 |
path := self getBitmapFileName:aFileName forPackage:aPackage. |
|
7894 |
path notNil ifTrue:[ |
|
18668 | 7895 |
^ Image fromFile:path. |
10641 | 7896 |
]. |
7897 |
^ nil |
|
7898 |
||
7899 |
" |
|
7900 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libview' |
|
7901 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libtool' |
|
7902 |
Smalltalk imageFromFileNamed:'bitmaps/gifImages/garfield.gif' inPackage:'stx:goodies' |
|
7903 |
Smalltalk imageFromFileNamed:'CheckOn10_xp.xpm' inPackage:'stx:libwidg' |
|
7904 |
Smalltalk imageFromFileNamed:'ComboDn_xp.xpm' inPackage:'stx:libwidg' |
|
7905 |
" |
|
7906 |
||
7907 |
"Modified: / 08-09-2006 / 18:02:04 / cg" |
|
7908 |
! |
|
7909 |
||
7910 |
libraryFileNameOfClass:aClassOrClassName |
|
7911 |
"for a given class, return the name of a classLibrary which contains |
|
7912 |
binary code for it. |
|
7913 |
Read the libinfo file 'liblist.stc' (which is created during the compilation process) |
|
7914 |
for an entry for aClassOrClassName. |
|
7915 |
Search for the className in the first col, and return the value found in |
|
7916 |
the 2nd col. |
|
7917 |
Return nil if no entry is found. |
|
7918 |
||
7919 |
A nil returns means that this class is either built-in or not present |
|
7920 |
in a package-class library (i.e. either as separate .o or separate .st file). |
|
7921 |
Otherwise, the returned name is the classLibrary object of that class. |
|
7922 |
The classes code can be loaded from that file if binary loading is supported." |
|
7923 |
||
7924 |
|aStream line words n aClassName| |
|
7925 |
||
7926 |
aClassOrClassName isBehavior ifTrue:[ |
|
18668 | 7927 |
aClassName := aClassOrClassName name |
10641 | 7928 |
] ifFalse:[ |
18668 | 7929 |
aClassName := aClassOrClassName |
10641 | 7930 |
]. |
7931 |
aClassName := aClassName asString. |
|
7932 |
||
7933 |
#('include/liblist.stc') "/ filenames |
|
7934 |
with:#(2) "/ column |
|
7935 |
do:[:fileName :col | |
|
7936 |
||
18668 | 7937 |
aStream := self systemFileStreamFor:fileName. |
7938 |
aStream notNil ifTrue:[ |
|
7939 |
[aStream atEnd] whileFalse:[ |
|
7940 |
line := aStream nextLine. |
|
7941 |
line notNil ifTrue:[ |
|
7942 |
(line startsWith:'#') ifFalse:[ |
|
7943 |
words := line asCollectionOfWords. |
|
7944 |
(n := words size) > 1 ifTrue:[ |
|
7945 |
(words at:1) = aClassName ifTrue:[ |
|
7946 |
n >= col ifTrue:[ |
|
7947 |
aStream close. |
|
7948 |
^ (words at:col) withoutSeparators |
|
7949 |
] |
|
7950 |
] |
|
7951 |
] |
|
7952 |
] |
|
7953 |
] |
|
7954 |
]. |
|
7955 |
aStream close |
|
7956 |
]. |
|
10641 | 7957 |
]. |
7958 |
||
7959 |
^ nil |
|
7960 |
||
7961 |
" |
|
7962 |
Smalltalk libraryFileNameOfClass:'ClockView' |
|
7963 |
Smalltalk libraryFileNameOfClass:'Bag' |
|
7964 |
" |
|
7965 |
||
7966 |
"Modified: 6.11.1995 / 15:41:39 / cg" |
|
7967 |
! |
|
7968 |
||
7969 |
packagePath |
|
15781 | 7970 |
"return a collection of additional directory names, where smalltalk |
10641 | 7971 |
looks for package directories. |
7972 |
Notice, that directories named 'packages' under the systemPath are |
|
7973 |
always consulted - even if not in the packagePath" |
|
7974 |
||
20640 | 7975 |
^ PackagePath ? #() |
10641 | 7976 |
|
7977 |
" |
|
7978 |
Smalltalk packagePath |
|
7979 |
Smalltalk packagePath addLast:'/opt/smalltalk' |
|
7980 |
Smalltalk packagePath addFirst:'/usr/local/otherPackages' |
|
7981 |
" |
|
7982 |
! |
|
7983 |
||
7984 |
packagePath:aPath |
|
7985 |
"set the packagePath; |
|
7986 |
a collection of additional directorynames, where smalltalk |
|
7987 |
looks for package directories. |
|
7988 |
Notice, that directories named 'packages' under the systemPath are |
|
7989 |
always consulted - even if not in the packagePath" |
|
7990 |
||
7991 |
PackagePath := aPath asOrderedCollection |
|
7992 |
||
7993 |
" |
|
7994 |
Smalltalk packagePath:#( '.' '/opt/stx' '/opt/smalltalk' '/usr/local/otherPackages') |
|
7995 |
" |
|
7996 |
! |
|
7997 |
||
7998 |
projectDirectoryForClass:aClass |
|
7999 |
"given a class, return the path to its package directory; |
|
8000 |
nil if not found." |
|
8001 |
||
8002 |
|pkg| |
|
8003 |
||
8004 |
pkg := aClass package. |
|
8005 |
pkg isNil ifTrue:[^ nil]. |
|
8006 |
||
8007 |
^ self projectDirectoryForPackage:pkg. |
|
8008 |
||
8009 |
" |
|
8010 |
Smalltalk projectDirectoryForClass:Array |
|
8011 |
Smalltalk projectDirectoryForClass:View |
|
8012 |
" |
|
8013 |
! |
|
8014 |
||
8015 |
projectDirectoryForPackage:aPackage |
|
8016 |
"given a packageID, return the path to its package directory; |
|
8017 |
nil if not found." |
|
8018 |
||
8019 |
|prj prjDir| |
|
8020 |
||
16642 | 8021 |
^ aPackage asPackageId packageDirectory. |
8022 |
||
10641 | 8023 |
"/ there might be a package specific resource directory ... |
8024 |
"/ in the directory, from which the project was loaded |
|
8025 |
prj := Project projectWithId:aPackage. |
|
8026 |
prj notNil ifTrue:[ |
|
18668 | 8027 |
prjDir := prj directory. |
10641 | 8028 |
]. |
8029 |
(prjDir notNil and:[prjDir asFilename exists]) ifFalse:[ |
|
18668 | 8030 |
prjDir := Smalltalk getPackageFileName:(aPackage copyReplaceAll:$: with:$/). |
10641 | 8031 |
]. |
8032 |
^ prjDir |
|
8033 |
||
8034 |
" |
|
16668
b88318df967d
flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents:
16666
diff
changeset
|
8035 |
Smalltalk projectDirectoryForPackage:'stx:libbasic' |
10641 | 8036 |
Smalltalk projectDirectoryForPackage:'exept:smartcard' |
16668
b88318df967d
flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents:
16666
diff
changeset
|
8037 |
Smalltalk projectDirectoryForPackage:'stx' |
b88318df967d
flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents:
16666
diff
changeset
|
8038 |
Smalltalk projectDirectoryForPackage:'bosch' |
b88318df967d
flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents:
16666
diff
changeset
|
8039 |
Smalltalk projectDirectoryForPackage:'bosch:foo' |
10641 | 8040 |
" |
8041 |
||
8042 |
"Modified: / 07-10-2006 / 17:45:58 / cg" |
|
8043 |
! |
|
8044 |
||
8045 |
readAbbreviations |
|
8046 |
"read classname to filename mappings from include/abbrev.stc. |
|
8047 |
sigh - all for those poor sys5.3 or MSDOS people with short filenames ..." |
|
8048 |
||
8049 |
"since installAutoloadedClasses also reads all abbreviations, use it" |
|
8050 |
||
8051 |
CachedAbbreviations := IdentityDictionary new. |
|
8052 |
self installAutoloadedClasses. |
|
8053 |
^ CachedAbbreviations. |
|
8054 |
||
8055 |
" |
|
8056 |
Smalltalk readAbbreviations |
|
8057 |
" |
|
8058 |
||
8059 |
"Modified: / 10.12.1999 / 17:48:53 / cg" |
|
8060 |
! |
|
8061 |
||
8062 |
readAbbreviationsFromStream:aStream |
|
8063 |
"read classname to filename mappings from aStream. |
|
8064 |
sigh - all for those poor sys5.3 or MSDOS people with short filenames ..." |
|
8065 |
||
11375 | 8066 |
self |
18668 | 8067 |
withAbbreviationsFromStream:aStream |
8068 |
do:[:className :abbrev :pkg | |
|
8069 |
self setFilename:abbrev forClass:className package:pkg. |
|
8070 |
]. |
|
10641 | 8071 |
|
8072 |
"Modified: / 13.12.1999 / 11:54:17 / cg" |
|
8073 |
! |
|
8074 |
||
8075 |
realSystemPath |
|
16642 | 8076 |
"return the realSystemPath - that's the directory names from |
10641 | 8077 |
SystemPath which exist and are readable" |
8078 |
||
8079 |
|nP| |
|
8080 |
||
8081 |
RealSystemPath isNil ifTrue:[ |
|
18668 | 8082 |
OperatingSystem isVMSlike ifTrue:[ |
8083 |
"/ temporary kludge: since we cannot currently |
|
8084 |
"/ check for existence of a name like 'volume:', |
|
8085 |
"/ leave those in the Path without a check. |
|
8086 |
RealSystemPath := SystemPath select:[:dirName | |f| |
|
8087 |
f := dirName asFilename. |
|
8088 |
f isVolumeOnly or:[(f isDirectory) and:[f isReadable]] |
|
8089 |
] |
|
8090 |
] ifFalse:[ |
|
8091 |
RealSystemPath := SystemPath |
|
8092 |
select:[:eachDirectoryName | |f| |
|
8093 |
f := eachDirectoryName asFilename. |
|
8094 |
(f isDirectory) and:[f isReadable] |
|
8095 |
] thenCollect:[:eachDirectoryName| |
|
8096 |
eachDirectoryName asFilename pathName. |
|
8097 |
]. |
|
8098 |
||
8099 |
"/ remove duplicates (but keep order) |
|
8100 |
nP := OrderedCollection new. |
|
8101 |
RealSystemPath do:[:p | |
|
8102 |
(nP includes:p) ifFalse:[ |
|
8103 |
nP add:p |
|
8104 |
] |
|
8105 |
]. |
|
8106 |
(nP includes:'.') ifFalse:[ |
|
8107 |
nP add:'.' |
|
8108 |
]. |
|
8109 |
RealSystemPath := nP. |
|
8110 |
]. |
|
617 | 8111 |
]. |
8112 |
^ RealSystemPath |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8113 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8114 |
|
10641 | 8115 |
recursiveReadAllAbbreviationsFrom:aDirectory |
8116 |
self recursiveReadAllAbbreviationsFrom:aDirectory maxLevels:15 |
|
8117 |
! |
|
8118 |
||
8119 |
recursiveReadAllAbbreviationsFrom:aDirectory maxLevels:maxLevels |
|
8120 |
"read all abbreviations from and under aDirectory." |
|
8121 |
||
8122 |
|abbrevStream dir directoryContents| |
|
8123 |
||
8124 |
maxLevels == 0 ifTrue:[ |
|
8125 |
"/ 'Smalltalk [warning]: max directory nesting reached.' infoPrintCR. |
|
22791 | 8126 |
^ self |
10641 | 8127 |
]. |
8128 |
||
8129 |
dir := aDirectory asFilename. |
|
8130 |
dir exists ifFalse:[^ self]. |
|
8131 |
||
8132 |
[ |
|
22791 | 8133 |
abbrevStream := (dir / 'abbrev.stc') asFilename readStream. |
8134 |
self readAbbreviationsFromStream:abbrevStream. |
|
8135 |
abbrevStream close. |
|
10641 | 8136 |
] on:FileStream openErrorSignal do:[:ex| "ignore this file"]. |
8137 |
||
8138 |
[ |
|
22791 | 8139 |
directoryContents := dir directoryContents. |
10641 | 8140 |
] on:FileStream openErrorSignal do:[:ex| |
22791 | 8141 |
"non-accessible directory: we are done" |
8142 |
^ self |
|
10641 | 8143 |
]. |
8144 |
||
8145 |
directoryContents do:[:aFilename | |
|
22791 | 8146 |
|f| |
8147 |
||
8148 |
(#( |
|
8149 |
'doc' |
|
8150 |
'CVS' |
|
8151 |
'bitmaps' |
|
8152 |
'resources' |
|
8153 |
'source' |
|
8154 |
) includes:aFilename) ifFalse:[ |
|
8155 |
f := dir / aFilename. |
|
8156 |
f isDirectory ifTrue:[ |
|
8157 |
self recursiveReadAllAbbreviationsFrom:f maxLevels:maxLevels-1 |
|
8158 |
] |
|
8159 |
]. |
|
4458 | 8160 |
]. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8161 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8162 |
|
15334 | 8163 |
reinitializePackagePath |
8164 |
"{ Pragma: +optSpace }" |
|
20207 | 8165 |
|
15334 | 8166 |
PackagePath notNil ifTrue:[ |
22791 | 8167 |
PackagePath := PackagePath select:[:p | p asFilename exists]. |
15334 | 8168 |
]. |
8169 |
PackagePath isEmptyOrNil ifTrue:[ |
|
22791 | 8170 |
PackagePath := OperatingSystem defaultPackagePath |
18868 | 8171 |
]. |
8172 |
self addWorkspaceDirectoryToPackagePath. |
|
15334 | 8173 |
! |
8174 |
||
13368 | 8175 |
relativePackagePathForPackage:aPackage |
8176 |
|path| |
|
8177 |
||
8178 |
PackageToPathMapping notNil ifTrue:[ |
|
18668 | 8179 |
path := PackageToPathMapping at:aPackage ifAbsent:nil. |
8180 |
PackageToPathMapping notNil ifTrue:[^ path]. |
|
13370 | 8181 |
]. |
8182 |
^ aPackage copyReplaceAll:$: with:$/. |
|
13368 | 8183 |
|
8184 |
" |
|
8185 |
PackageToPathMapping := Dictionary new. |
|
8186 |
PackageToPathMapping at:'expeccoNET:server' put:'expeccoNET_oldVersion/server'. |
|
8187 |
PackageToPathMapping at:'expeccoNET:server/ui' put:'expeccoNET_oldVersion/server/ui'. |
|
8188 |
||
8189 |
Smalltalk relativePackagePathForPackage:'stx:libview/resources' |
|
8190 |
Smalltalk relativePackagePathForPackage:'stx:libview' |
|
8191 |
" |
|
8192 |
! |
|
8193 |
||
10641 | 8194 |
resourceDirectoryForPackage:aPackage |
8195 |
"given a packageID, return the path to its resource directory; |
|
8196 |
nil if not found." |
|
8197 |
||
8198 |
|prjDir rsrcDir| |
|
8199 |
||
11183
9a4e7475a655
care for nil project when asked for a resource directory
Claus Gittinger <cg@exept.de>
parents:
11174
diff
changeset
|
8200 |
aPackage notNil ifTrue:[ |
18668 | 8201 |
prjDir := self projectDirectoryForPackage:aPackage. |
8202 |
||
8203 |
(prjDir notNil |
|
8204 |
and:[(prjDir := prjDir asFilename) exists |
|
8205 |
and:[(rsrcDir := prjDir / 'resources') exists]]) ifTrue:[ |
|
8206 |
^ rsrcDir |
|
8207 |
]. |
|
8208 |
rsrcDir := self getSystemFileName:('resources/' , (aPackage copyReplaceAll:$: with:$/)). |
|
8209 |
rsrcDir notNil ifTrue:[ |
|
8210 |
^ rsrcDir asFilename |
|
8211 |
]. |
|
10641 | 8212 |
]. |
8213 |
^ nil |
|
8214 |
||
8215 |
" |
|
8216 |
Smalltalk resourceDirectoryForPackage:'stx:libbasic' |
|
8217 |
Smalltalk resourceDirectoryForPackage:'exept:expecco' |
|
8218 |
Smalltalk resourceDirectoryForPackage:'exept:smartcard' |
|
8219 |
" |
|
8220 |
! |
|
8221 |
||
8222 |
resourceFileStreamFor:aFileName |
|
8223 |
"search aFileName in some standard places; |
|
8224 |
return a readonly fileStream or nil if not found. |
|
8225 |
Searches in subdirectories named 'resource' in SystemPath" |
|
8226 |
||
8227 |
^ self resourceFileStreamFor:aFileName forClass:nil |
|
8228 |
! |
|
8229 |
||
8230 |
resourceFileStreamFor:aFileName forClass:aClassOrNil |
|
8231 |
"search aFileName in some standard places and in the classes |
|
8232 |
package-resource directory. |
|
8233 |
Return a readonly fileStream or nil if not found. |
|
8234 |
Searches in subdirectories named 'resource' in SystemPath" |
|
8235 |
||
8236 |
|aString| |
|
8237 |
||
8238 |
aString := self getResourceFileName:aFileName forClass:aClassOrNil. |
|
8239 |
aString notNil ifTrue:[ |
|
18668 | 8240 |
^ aString asFilename readStreamOrNil |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8241 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8242 |
^ nil |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8243 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8244 |
|
10641 | 8245 |
searchPath:aPath for:aFileName in:aDirName |
8246 |
"search aPath for a subdirectory named aDirectory with a file |
|
8247 |
named aFileName" |
|
8248 |
||
8249 |
|f| |
|
8250 |
||
8251 |
((f := aFileName asFilename) isAbsolute |
|
8252 |
or:[f isExplicitRelative]) ifTrue:[ |
|
22791 | 8253 |
"/ |
8254 |
"/ don't use path for absolute or explicit .-relative file names |
|
8255 |
"/ |
|
8256 |
^ aFileName |
|
10641 | 8257 |
]. |
8258 |
||
8259 |
aPath notNil ifTrue:[ |
|
22791 | 8260 |
aPath do:[:dirName | |
8261 |
|realName dir| |
|
8262 |
||
8263 |
dir := dirName asFilename. |
|
8264 |
aDirName notNil ifTrue:[ |
|
8265 |
realName := dir / aDirName / aFileName. |
|
8266 |
] ifFalse:[ |
|
8267 |
realName := dir / aFileName. |
|
8268 |
]. |
|
8269 |
(realName isReadable) ifTrue:[ |
|
8270 |
^ realName name |
|
8271 |
] |
|
8272 |
]. |
|
11108 | 8273 |
]. |
8274 |
||
8275 |
"/ not needed - executing dir is always in SearchPath |
|
12377 | 8276 |
"/ realName := Filename currentDirectory / aFileName. |
11108 | 8277 |
"/ (realName isReadable) ifTrue:[ |
8278 |
"/ ^ realName name |
|
8279 |
"/ ]. |
|
10641 | 8280 |
^ nil. |
8281 |
||
8282 |
"Modified: / 29.4.1999 / 15:06:43 / cg" |
|
8283 |
! |
|
8284 |
||
8285 |
setFilename:aFileNameString forClass:aClassNameString package:aPackageNameString |
|
8286 |
|classNameSymbol oldAbbrev oldPath newPath cls abbrevs| |
|
8287 |
||
8288 |
CachedAbbreviations isNil ifTrue:[ |
|
18668 | 8289 |
CachedAbbreviations := IdentityDictionary new. |
10641 | 8290 |
]. |
8291 |
||
8292 |
abbrevs := CachedAbbreviations. |
|
8293 |
aClassNameString ~= aFileNameString ifTrue:[ |
|
18668 | 8294 |
classNameSymbol := aClassNameString asSymbol. |
8295 |
oldAbbrev := abbrevs at:classNameSymbol ifAbsent:nil. |
|
8296 |
oldAbbrev notNil ifTrue:[ |
|
8297 |
oldAbbrev ~= aFileNameString ifTrue:[ |
|
8298 |
oldAbbrev asFilename isAbsolute |
|
8299 |
ifTrue:[ oldPath := oldAbbrev ] |
|
8300 |
ifFalse:[ oldPath := (self projectDirectoryForPackage:aPackageNameString) asFilename constructString: oldAbbrev ]. |
|
8301 |
aFileNameString asFilename isAbsolute |
|
8302 |
ifTrue:[ newPath := aFileNameString ] |
|
8303 |
ifFalse:[ newPath := (self projectDirectoryForPackage:aPackageNameString) asFilename constructString: aFileNameString ]. |
|
8304 |
||
8305 |
oldPath ~= newPath ifTrue:[ |
|
8306 |
StandAlone ifFalse:[ |
|
8307 |
('Smalltalk [warning]: autoload path change for: ',aClassNameString,' in package ',aPackageNameString) infoPrintCR. |
|
8308 |
('Smalltalk [info]: old: ',oldPath) infoPrintCR. |
|
8309 |
('Smalltalk [info]: new: ',newPath) infoPrintCR. |
|
8310 |
] |
|
8311 |
] |
|
8312 |
]. |
|
8313 |
"overwrite old abbreviation with new one, |
|
8314 |
to allow fixing of bad abbrev files" |
|
8315 |
]. |
|
8316 |
||
8317 |
cls := self classNamed:aFileNameString. |
|
8318 |
cls notNil ifTrue:[ |
|
8319 |
cls name ~= aClassNameString ifTrue:[ |
|
8320 |
"/ ok, there is a class named after this abbrev ... |
|
8321 |
"/ this is only a conflict, if the other class has no |
|
8322 |
"/ abbreviation (or the same). |
|
8323 |
(abbrevs at:(cls name asSymbol) ifAbsent:cls name) = aFileNameString ifTrue:[ |
|
8324 |
cls isNameSpace ifFalse:[ |
|
8325 |
aPackageNameString = cls package ifTrue:[ |
|
8326 |
StandAlone ifFalse:[ |
|
8327 |
('Smalltalk [warning]: conflict for: ' , cls name , |
|
8328 |
' in package ' , aPackageNameString) infoPrintCR. |
|
8329 |
('Smalltalk [warning]: (' , aClassNameString , ' -> ' , aFileNameString |
|
8330 |
, ')') infoPrintCR |
|
8331 |
] |
|
8332 |
] |
|
8333 |
] |
|
8334 |
] |
|
8335 |
] |
|
8336 |
]. |
|
8337 |
abbrevs at:classNameSymbol put:aFileNameString. |
|
8470
d79e917d4f36
Define #setFilename:forClass:package: to define an abbreviation.
Stefan Vogel <sv@exept.de>
parents:
8445
diff
changeset
|
8338 |
] |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8339 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8340 |
|
10641 | 8341 |
sourceDirectoryNameOfClass:aClassOrClassName |
8342 |
"for a given class, return the pathname relative to TOP of the classes source code. |
|
8343 |
Read the files 'abbrev.stc' and 'liblist.stc' (which are created during the compilation process) |
|
8344 |
for an entry for aClassOrClassName. |
|
8345 |
Search for the className in the first col, and return the value found in |
|
8346 |
the 3rd col. |
|
8347 |
Return nil if no entry is found." |
|
8348 |
||
8349 |
|aStream line words n aClassName| |
|
8350 |
||
8351 |
aClassOrClassName isBehavior ifTrue:[ |
|
18668 | 8352 |
aClassName := aClassOrClassName name |
10641 | 8353 |
] ifFalse:[ |
18668 | 8354 |
aClassName := aClassOrClassName |
10641 | 8355 |
]. |
8356 |
aClassName := aClassName asString. |
|
8357 |
||
8358 |
#('include/abbrev.stc' 'include/liblist.stc') "/ filenames |
|
8359 |
with:#(3 2) "/ column |
|
8360 |
do:[:fileName :col | |
|
8361 |
||
18668 | 8362 |
aStream := self systemFileStreamFor:fileName. |
8363 |
aStream notNil ifTrue:[ |
|
8364 |
[aStream atEnd] whileFalse:[ |
|
8365 |
line := aStream nextLine. |
|
8366 |
line notNil ifTrue:[ |
|
8367 |
(line startsWith:'#') ifFalse:[ |
|
8368 |
words := line asCollectionOfWords. |
|
8369 |
(n := words size) > 1 ifTrue:[ |
|
8370 |
(words at:1) = aClassName ifTrue:[ |
|
8371 |
n >= col ifTrue:[ |
|
8372 |
aStream close. |
|
8373 |
^ (words at:col) withoutSeparators |
|
8374 |
] |
|
8375 |
] |
|
8376 |
] |
|
8377 |
] |
|
8378 |
] |
|
8379 |
]. |
|
8380 |
aStream close |
|
8381 |
]. |
|
10641 | 8382 |
]. |
8383 |
||
8384 |
^ nil |
|
8385 |
||
8386 |
" |
|
8387 |
Smalltalk sourceDirectoryNameOfClass:'ClockView' |
|
8388 |
Smalltalk sourceDirectoryNameOfClass:'Bag' |
|
8389 |
Smalltalk sourceDirectoryNameOfClass:'GLWireCubeDemoView' |
|
8390 |
Smalltalk sourceDirectoryNameOfClass:'SomeNonExistingClass' |
|
8391 |
" |
|
8392 |
||
8393 |
"Created: 6.11.1995 / 15:43:30 / cg" |
|
8394 |
"Modified: 9.12.1995 / 23:54:14 / cg" |
|
8395 |
"Modified: 3.1.1997 / 11:26:44 / stefan" |
|
8396 |
! |
|
8397 |
||
8398 |
sourceFileStreamFor:aFileName |
|
8399 |
"search aFileName in some standard places; |
|
8400 |
return a readonly fileStream or nil if not found. |
|
8401 |
Searches in subdirectories named 'source' in SystemPath" |
|
8402 |
||
8403 |
|aString| |
|
8404 |
||
8405 |
aString := self getSourceFileName:aFileName. |
|
8406 |
aString notNil ifTrue:[ |
|
18668 | 8407 |
^ aString asFilename readStreamOrNil |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8408 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8409 |
^ nil |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8410 |
! |
7758 | 8411 |
|
10641 | 8412 |
systemFileStreamFor:aFileName |
8413 |
"search aFileName in some standard places; |
|
8414 |
return a readonly fileStream or nil if not found. |
|
8415 |
see comment in Smalltalk>>initSystemPath" |
|
8416 |
||
8417 |
|aString| |
|
8418 |
||
8419 |
aString := self getSystemFileName:aFileName. |
|
8420 |
aString notNil ifTrue:[ |
|
18668 | 8421 |
^ aString asFilename readStreamOrNil |
617 | 8422 |
]. |
8423 |
^ nil |
|
8424 |
! |
|
8425 |
||
10641 | 8426 |
systemPath |
8427 |
"return a collection of directorynames, where smalltalk |
|
8428 |
looks for system files |
|
8429 |
(usually in subdirs such as resources, bitmaps, source etc.) |
|
8430 |
see comment in Smalltalk>>initSystemPath." |
|
8431 |
||
20640 | 8432 |
^ SystemPath ? #() |
10641 | 8433 |
|
8434 |
" |
|
8435 |
Smalltalk systemPath |
|
8436 |
Smalltalk systemPath addLast:'someOtherDirectoryPath' |
|
8437 |
" |
|
8438 |
! |
|
8439 |
||
8440 |
systemPath:aPath |
|
8441 |
"set the collection of directorynames, where smalltalk |
|
8442 |
looks for system files |
|
8443 |
(usually in subdirs such as resources, bitmaps, source etc.) |
|
8444 |
see comment in Smalltalk>>initSystemPath." |
|
8445 |
||
8446 |
SystemPath := aPath. |
|
8447 |
self flushPathCaches |
|
8448 |
||
8449 |
" |
|
8450 |
Smalltalk systemPath |
|
8451 |
Smalltalk systemPath:(Smalltalk systemPath copy addLast:'someOtherDirectoryPath') |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8452 |
" |
11301
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
8453 |
! |
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
8454 |
|
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
8455 |
withAbbreviationsFromStream:aStream do:aBlock |
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
8456 |
"read classname to filename mappings from aStream. |
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
8457 |
Evaluate aBlock for each tuple: |
18668 | 8458 |
class-name , abbrev-name, package |
11301
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
8459 |
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
|
8460 |
|
13415 | 8461 |
|line lineNo words nm abbrev pkg category size s w| |
8462 |
||
8463 |
lineNo := 0. |
|
11301
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
8464 |
[aStream atEnd] whileFalse:[ |
18668 | 8465 |
line := aStream nextLine. |
8466 |
lineNo := lineNo + 1. |
|
8467 |
line notEmptyOrNil ifTrue:[ |
|
8468 |
(line startsWith:'#') ifFalse:[ |
|
8469 |
||
8470 |
"/ must do it manually, caring for quoted strings. |
|
11301
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
8471 |
"/ words := line asCollectionOfWords. |
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
8472 |
|
18668 | 8473 |
words := OrderedCollection new. |
8474 |
s := line readStream. |
|
8475 |
[s atEnd] whileFalse:[ |
|
8476 |
s skipSeparators. |
|
8477 |
s peek == $' ifTrue:[ |
|
8478 |
s next. |
|
8479 |
w := s upTo:$'. |
|
8480 |
s skipSeparators. |
|
8481 |
] ifFalse:[ |
|
8482 |
w := s upToSeparator |
|
8483 |
]. |
|
8484 |
words add:w |
|
8485 |
]. |
|
8486 |
words size >= 3 ifTrue:[ |
|
8487 |
nm := (words at:1) withoutSeparators. |
|
8488 |
abbrev := (words at:2) withoutSeparators. |
|
8489 |
pkg := (words at:3) withoutSeparators. |
|
8490 |
aBlock argumentCount = 3 ifTrue:[ |
|
8491 |
aBlock value:nm value:abbrev value:pkg. |
|
8492 |
] ifFalse:[ |
|
8493 |
words size >= 4 ifTrue:[ |
|
8494 |
category := words at:4. |
|
8495 |
]. |
|
8496 |
words size = 5 ifTrue:[ |
|
8497 |
size := (words at:5) asNumber |
|
8498 |
]. |
|
8499 |
aBlock value:nm value:abbrev value:pkg value: category value: size |
|
8500 |
] |
|
8501 |
] ifFalse:[ |
|
8502 |
('Smalltalk [warning]: malformed line ', lineNo printString , ' in ' , (aStream pathName)) infoPrintCR. |
|
8503 |
] |
|
8504 |
] |
|
8505 |
] |
|
13518
b81bc64782b1
not ifTrue -> ifFalse (trying the rewrite tool ;-)
Claus Gittinger <cg@exept.de>
parents:
13506
diff
changeset
|
8506 |
]. |
b81bc64782b1
not ifTrue -> ifFalse (trying the rewrite tool ;-)
Claus Gittinger <cg@exept.de>
parents:
13506
diff
changeset
|
8507 |
|
13415 | 8508 |
"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
|
8509 |
"Modified: / 04-08-2011 / 21:35:00 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8510 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8511 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8512 |
!Smalltalk class methodsFor:'system management-packages'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8513 |
|
16159 | 8514 |
isPackageLoaded:aPackageIdOrPackage |
8515 |
|projectDefinition| |
|
8516 |
||
8517 |
projectDefinition := aPackageIdOrPackage asPackageId projectDefinitionClass. |
|
16161 | 8518 |
^ projectDefinition notNil and:[projectDefinition isLoaded and:[projectDefinition isFullyLoaded]] |
16159 | 8519 |
|
8520 |
" |
|
8521 |
Smalltalk isPackageLoaded:'stx:goodies/persistency' |
|
16170
ca4d03def070
endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents:
16164
diff
changeset
|
8522 |
Smalltalk isPackageLoaded:'stx:goodies/refactoryBrowser/lint' |
ca4d03def070
endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents:
16164
diff
changeset
|
8523 |
Smalltalk isPackageLoaded:'stx:goodies/refactoryBrowser/lint/spelling' |
16159 | 8524 |
" |
8525 |
! |
|
8526 |
||
20898 | 8527 |
knownLoadablePackagesDo:aBlock |
8528 |
"enumerate loadable packages from the packages folder." |
|
8529 |
||
8530 |
Smalltalk realSystemPath do:[:dirName | |
|
22791 | 8531 |
|packageDir| |
8532 |
||
8533 |
packageDir := dirName asFilename / 'packages'. |
|
8534 |
(packageDir exists and:[packageDir isDirectory]) ifTrue:[ |
|
8535 |
packageDir directoryContentsAsFilenames sort do:[:fn | |
|
8536 |
|item base nm path parentPath parent isLibrary isApplication isAlreadyLoaded |
|
8537 |
defClass target type nameComponents packageName packageID| |
|
8538 |
||
8539 |
((fn suffix = 'mcz') |
|
8540 |
or:[ fn isDirectory |
|
8541 |
or:[ (fn baseName startsWith:'.') |
|
8542 |
or:[ (fn baseName = 'README') ]]]) ifFalse:[ |
|
8543 |
base := fn withoutSuffix baseName. |
|
8544 |
(base startsWith:'lib') ifTrue:[ |
|
8545 |
nm := (base copyFrom:4). |
|
8546 |
fn suffix notEmptyOrNil ifTrue:[ |
|
8547 |
type := #library. |
|
8548 |
] ifFalse:[ |
|
8549 |
type := #application. |
|
8550 |
] |
|
8551 |
] ifFalse:[ |
|
8552 |
nm := base. |
|
8553 |
type := #application. |
|
8554 |
]. |
|
8555 |
||
8556 |
(base ~= 'librun') ifTrue:[ |
|
8557 |
(fn suffix = 'mcz') ifTrue:[ |
|
8558 |
packageName := fn withoutSuffix. |
|
8559 |
target := fn. |
|
8560 |
] ifFalse:[ |
|
8561 |
( #('dll' 'so' 'sl' 'dylib') includes:(fn suffix)) ifTrue:[ |
|
8562 |
(base startsWith:'lib') ifTrue:[ |
|
8563 |
nm := base copyFrom:4. |
|
8564 |
] ifFalse:[ |
|
8565 |
nm := base. |
|
8566 |
]. |
|
8567 |
]. |
|
8568 |
nameComponents := nm asCollectionOfSubstringsSeparatedBy:$_. |
|
8569 |
packageName := nameComponents first. |
|
8570 |
nameComponents size > 1 ifTrue:[ |
|
8571 |
packageName := packageName,':',((nameComponents copyFrom:2) asStringWith:'/') |
|
8572 |
]. |
|
8573 |
]. |
|
8574 |
packageName notNil ifTrue:[ |
|
8575 |
aBlock value:packageName value:type value:fn . |
|
8576 |
] |
|
8577 |
] |
|
8578 |
] |
|
8579 |
] |
|
8580 |
] |
|
20898 | 8581 |
] |
8582 |
||
8583 |
" |
|
8584 |
Smalltalk knownLoadablePackagesDo:[:packageID :type :path | |
|
22791 | 8585 |
Transcript showCR:'%1 (%2) in %3' with:packageID with:type with:path. |
20898 | 8586 |
] |
8587 |
" |
|
8588 |
! |
|
8589 |
||
10641 | 8590 |
loadPackage:aPackageIdOrPackage |
12250 | 8591 |
"make certain, that some particular package is loaded into the system. |
8592 |
Return true if loaded, false otherwise." |
|
11668 | 8593 |
|
8594 |
^ self loadPackage:aPackageIdOrPackage asAutoloaded:false |
|
8595 |
||
8596 |
" |
|
8597 |
Smalltalk loadPackage:'stx:libbasic' |
|
8598 |
Smalltalk loadPackage:'stx:goodies/persistency' |
|
8599 |
Smalltalk loadPackage:'cg:cparser' |
|
8600 |
Smalltalk loadPackage:'cg:rose' |
|
8601 |
" |
|
8602 |
! |
|
8603 |
||
10641 | 8604 |
packageDirectoryForPackageId:aPackageId |
12250 | 8605 |
"used by classes to find the location of their resource- and bitmap directories. |
8606 |
||
8607 |
Notice that the directory structure is different between the development |
|
8608 |
environment (top for packages is ../../../stx) and delivered stand alone executables, |
|
8609 |
where the top is specified via a shell environment variable, and is typically ../lib. |
|
8610 |
At runtime, Smalltalk knows about the systemPath setting." |
|
8611 |
||
10641 | 8612 |
|packageDirName packageDir| |
8613 |
||
14589 | 8614 |
packageDirName := aPackageId asPackageId string copyReplaceAll:$: with:$/. |
10641 | 8615 |
|
8616 |
packageDir := self getPackageFileName:packageDirName. |
|
8617 |
packageDir isNil ifTrue:[ |
|
18668 | 8618 |
^ nil. |
10641 | 8619 |
]. |
8620 |
^ packageDir asFilename |
|
8621 |
||
8622 |
" |
|
11375 | 8623 |
Smalltalk packageDirectoryForPackageId:'stx:libbasic' |
10641 | 8624 |
Smalltalk packageDirectoryForPackageId:'stx:goodies/persistency' |
8625 |
Smalltalk packageDirectoryForPackageId:'exept:ctypes' |
|
8626 |
" |
|
12250 | 8627 |
! |
8628 |
||
18794 | 8629 |
requirePackage:aPackageIdOrPackage |
8630 |
"make certain, that some particular package is loaded into the system. |
|
8631 |
Return true if loaded, false otherwise. |
|
8632 |
Just an alias which is easier to remember" |
|
8633 |
||
8634 |
^ self loadPackage:aPackageIdOrPackage |
|
8635 |
||
8636 |
" |
|
8637 |
Smalltalk loadPackage:'stx:libbasic' |
|
8638 |
Smalltalk loadPackage:'stx:goodies/persistency' |
|
8639 |
Smalltalk loadPackage:'cg:cparser' |
|
8640 |
Smalltalk loadPackage:'cg:rose' |
|
8641 |
" |
|
8642 |
! |
|
8643 |
||
12250 | 8644 |
unloadPackage:aPackageIdOrPackage |
8645 |
|projectDefinition| |
|
8646 |
||
8647 |
projectDefinition := aPackageIdOrPackage. |
|
8648 |
projectDefinition isProjectDefinition ifFalse:[ |
|
22791 | 8649 |
projectDefinition := projectDefinition asPackageId projectDefinitionClass. |
8650 |
projectDefinition isNil ifTrue:[ |
|
8651 |
Logger warning:'trying to unload non-existing package: %1' with:aPackageIdOrPackage. |
|
8652 |
^ self. |
|
8653 |
]. |
|
12250 | 8654 |
]. |
8655 |
projectDefinition unloadPackage. |
|
8656 |
||
8657 |
" |
|
8658 |
Smalltalk loadPackage:'stx:goodies/persistency' |
|
8659 |
Smalltalk unloadPackage:'stx:goodies/persistency' |
|
8660 |
" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8661 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8662 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8663 |
!Smalltalk class methodsFor:'system management-undeclared variables'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8664 |
|
10641 | 8665 |
clearUndeclaredVariables |
8666 |
"remove all undeclared variables" |
|
8667 |
||
8668 |
(Smalltalk at:#Undeclared) do:[:eachKey | |
|
18668 | 8669 |
Smalltalk removeKey:(self undeclaredPrefix , eachKey) asSymbol. |
10641 | 8670 |
]. |
8671 |
(Smalltalk at:#Undeclared) removeAll. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8672 |
Smalltalk removeKey:#Undeclared. |
10641 | 8673 |
! |
8674 |
||
8675 |
undeclaredPrefix |
|
8676 |
"the prefix used for undeclared variables" |
|
8677 |
||
8678 |
^ 'Undeclared:::' |
|
8679 |
||
8680 |
"Created: / 31.10.1997 / 01:13:10 / cg" |
|
7758 | 8681 |
! ! |
8682 |
||
8683 |
!Smalltalk class methodsFor:'time-versions'! |
|
8684 |
||
10641 | 8685 |
configuration |
8686 |
"{ Pragma: +optSpace }" |
|
8687 |
||
8688 |
"for developers only: return the configuration, with which |
|
8689 |
this smalltalk was compiled." |
|
8690 |
||
8691 |
%{ /* NOCONTEXT */ |
|
8692 |
extern char *__getConfigurationString(); |
|
8693 |
||
8694 |
RETURN (__MKSTRING(__getConfigurationString() COMMA_SND)); |
|
8695 |
%}. |
|
8696 |
^ 'unknownOS/unknownCONF:unknownPACK' |
|
8697 |
||
8698 |
" |
|
10071 | 8699 |
Smalltalk configuration |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8700 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8701 |
! |
453 | 8702 |
|
10641 | 8703 |
copyrightString |
8704 |
"{ Pragma: +optSpace }" |
|
8705 |
||
8706 |
"return a copyright string" |
|
8707 |
||
8708 |
%{ /* NOCONTEXT */ |
|
8709 |
#ifndef __getCopyrightString |
|
8710 |
extern OBJ __getCopyrightString(); |
|
8711 |
#endif |
|
8712 |
||
8713 |
RETURN (__getCopyrightString()); |
|
8714 |
%}. |
|
8715 |
^ self primitiveFailed |
|
8716 |
||
8717 |
" |
|
7758 | 8718 |
Smalltalk copyrightString |
8719 |
" |
|
8720 |
! |
|
8721 |
||
10641 | 8722 |
distributorString |
8723 |
"{ Pragma: +optSpace }" |
|
8724 |
||
8725 |
"return a string describing the distributor of this software" |
|
8726 |
||
8727 |
%{ /* NOCONTEXT */ |
|
8728 |
#ifndef __getDistributorString |
|
8729 |
extern OBJ __getDistributorString(); |
|
8730 |
#endif |
|
8731 |
||
8732 |
RETURN (__getDistributorString()); |
|
8733 |
%}. |
|
8734 |
^ 'eXept Software AG, Germany' |
|
8735 |
||
8736 |
" |
|
8737 |
Smalltalk distributorString |
|
8738 |
" |
|
8739 |
! |
|
8740 |
||
8741 |
expirationTime |
|
8742 |
"{ Pragma: +optSpace }" |
|
8743 |
||
8744 |
"for developers only: return the time when the system will expire. |
|
8745 |
after this time it will not run any longer. |
|
8746 |
It returns nil, if no expiration time has been set (system runs forever :-))" |
|
8747 |
||
8748 |
|exp| |
|
8749 |
||
8750 |
%{ |
|
8751 |
extern unsigned int __getExpirationTime(); |
|
8752 |
||
8753 |
exp = __MKUINT(__getExpirationTime()); |
|
8754 |
%}. |
|
8755 |
exp == 0 ifTrue:[ |
|
18668 | 8756 |
^ nil |
10641 | 8757 |
]. |
8758 |
^ Timestamp new fromOSTime:(exp * 1000). "OSTime is ms since 1970" |
|
8759 |
||
8760 |
" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8761 |
Smalltalk expirationTime |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8762 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8763 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8764 |
|
10641 | 8765 |
fullVersionString |
8766 |
"{ Pragma: +optSpace }" |
|
8767 |
||
8768 |
"return a full version string" |
|
8769 |
||
19516 | 8770 |
^ 'Smalltalk/X release %1%2 of %3' |
22900 | 8771 |
bindWith:(self versionString) |
8772 |
with:((ExternalBytes sizeofPointer == 8) |
|
8773 |
ifTrue:[' (64bit)'] |
|
8774 |
ifFalse:['']) |
|
8775 |
with:(self versionDate) |
|
22791 | 8776 |
|
8777 |
" |
|
8778 |
Smalltalk fullVersionString |
|
10641 | 8779 |
" |
8780 |
||
8781 |
"Created: / 27.10.1997 / 17:03:09 / cg" |
|
8782 |
"Modified: / 27.10.1997 / 17:04:02 / cg" |
|
8783 |
! |
|
8784 |
||
8785 |
hello |
|
8786 |
"{ Pragma: +optSpace }" |
|
8787 |
||
8788 |
"return a greeting string" |
|
8789 |
||
8790 |
"stupid: this should come from a resource file ... |
|
18924 | 8791 |
but I don't use it here, to allow mini-systems without |
10641 | 8792 |
Resource-stuff." |
8793 |
||
19187 | 8794 |
|proto lang bit bitsPerWordString| |
10641 | 8795 |
|
8796 |
lang := Language. |
|
19187 | 8797 |
bit := 'bit'. |
8798 |
||
10641 | 8799 |
(lang == #de) ifTrue:[ |
22900 | 8800 |
proto := 'Willkommen bei %1 (%4Version %2 von %3)'. bit := 'Bit'. |
10641 | 8801 |
] ifFalse:[ (lang == #fr) ifTrue:[ |
22955 | 8802 |
proto := 'Salut, Bienvenue à %1 (%4version %2 de %3)' |
10641 | 8803 |
] ifFalse:[ (lang == #it) ifTrue:[ |
22900 | 8804 |
proto := 'Ciao, benvenuto al %1 (%4versione %2 di %3)' |
10641 | 8805 |
] ifFalse:[ (lang == #es) ifTrue:[ |
22900 | 8806 |
proto := 'Hola, bienvenida a %1 (%4version %2 de %3)' |
18924 | 8807 |
] ifFalse:[ (lang == #pt) ifTrue:[ |
22955 | 8808 |
proto := 'Olá!!, mem-vindo a %1 (%4version %2 de %3)' |
10641 | 8809 |
] ifFalse:[ (lang == #no) ifTrue:[ |
22900 | 8810 |
proto := 'Hei, verdenmottakelse til %1 (%4versjon %2 av %3)' |
10641 | 8811 |
]]]]]]. |
8812 |
||
8813 |
"/ ... more needed here ... |
|
8814 |
||
8815 |
proto isNil ifTrue:[ |
|
22900 | 8816 |
proto := 'Hello World - welcome to %1 (%4version %2 of %3)'. |
8817 |
]. |
|
8818 |
ExternalBytes sizeofPointer ~~ 4 ifTrue:[ |
|
8819 |
bitsPerWordString := (ExternalBytes sizeofPointer * 8) printString,bit,' '. |
|
19187 | 8820 |
] ifFalse:[ |
22900 | 8821 |
bitsPerWordString := '' |
22791 | 8822 |
]. |
10641 | 8823 |
|
8824 |
^ proto bindWith:('SmallTalk/X' allBold) |
|
22900 | 8825 |
with:(self versionString) |
8826 |
with:(self versionDate) |
|
8827 |
with:bitsPerWordString |
|
10641 | 8828 |
|
8829 |
" |
|
8830 |
Smalltalk language:#us. |
|
22791 | 8831 |
Smalltalk hello |
10641 | 8832 |
|
8833 |
Smalltalk language:#de. |
|
8834 |
Smalltalk hello |
|
8835 |
||
8836 |
Smalltalk language:#no. |
|
8837 |
Smalltalk hello |
|
8838 |
||
8839 |
Transcript showCR:(Smalltalk hello) |
|
8840 |
Stdout showCR:(Smalltalk hello) |
|
8841 |
" |
|
8842 |
||
8843 |
"Modified: 18.5.1996 / 14:25:13 / cg" |
|
8844 |
! |
|
8845 |
||
8846 |
imageRestartTime |
|
8847 |
"return a timestamp for the moment when this image was restarted. |
|
8848 |
If we do not execute from an image (i.e. fresh start), return nil." |
|
8849 |
||
8850 |
^ ImageRestartTime |
|
8851 |
||
8852 |
" |
|
8853 |
Smalltalk imageStartTime |
|
8854 |
Smalltalk imageRestartTime |
|
8855 |
" |
|
8856 |
||
8857 |
"Created: 13.12.1995 / 17:44:20 / cg" |
|
8858 |
"Modified: 6.3.1996 / 11:56:35 / cg" |
|
8859 |
! |
|
8860 |
||
8861 |
imageSaveTime |
|
8862 |
"{ Pragma: +optSpace }" |
|
8863 |
||
8864 |
"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
|
8865 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8866 |
^ ObjectMemory imageSaveTime |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8867 |
! |
7758 | 8868 |
|
10641 | 8869 |
imageStartTime |
8870 |
"{ Pragma: +optSpace }" |
|
8871 |
||
8872 |
"return a timestamp for the moment when this system started the first time |
|
8873 |
(i.e. the first initial start without an image)" |
|
8874 |
||
8875 |
^ ImageStartTime |
|
8876 |
||
8877 |
" |
|
8878 |
Smalltalk imageStartTime |
|
8879 |
Smalltalk imageRestartTime |
|
8880 |
" |
|
8881 |
||
8882 |
"Created: 13.12.1995 / 17:44:14 / cg" |
|
8883 |
"Modified: 13.12.1995 / 17:45:47 / cg" |
|
8884 |
! |
|
8885 |
||
8886 |
majorVersionNr |
|
8887 |
"{ Pragma: +optSpace }" |
|
8888 |
||
8889 |
"return the major version number. |
|
8890 |
This is only incremented for very fundamental changes, |
|
8891 |
which make old object files totally incompatible |
|
8892 |
(for example, if the layout/representation of fundamental |
|
8893 |
classes changes). |
|
8894 |
||
8895 |
ST/X revision Naming is: |
|
22791 | 8896 |
<major>.<minor>.<revision>.<release>" |
19974 | 8897 |
|
8898 |
^ 7 |
|
10641 | 8899 |
|
8900 |
" |
|
8901 |
Smalltalk majorVersionNr |
|
8902 |
" |
|
8903 |
||
19974 | 8904 |
"Modified: / 09-06-2016 / 16:28:40 / cg" |
10641 | 8905 |
! |
8906 |
||
8907 |
minorVersionNr |
|
8908 |
"{ Pragma: +optSpace }" |
|
8909 |
||
8910 |
"return the minor version number. |
|
8911 |
This is incremented for changes which make some old object |
|
8912 |
files incompatible, or the protocol changes such that some |
|
8913 |
classes need rework. |
|
8914 |
||
8915 |
ST/X revision Naming is: |
|
22791 | 8916 |
<major>.<minor>.<revision>.<release>" |
19974 | 8917 |
|
8918 |
^ 1 |
|
10641 | 8919 |
|
8920 |
" |
|
8921 |
Smalltalk minorVersionNr |
|
8922 |
" |
|
8923 |
||
19974 | 8924 |
"Modified: / 09-06-2016 / 16:28:45 / cg" |
10641 | 8925 |
! |
8926 |
||
8927 |
releaseIdentification |
|
8928 |
"{ Pragma: +optSpace }" |
|
8929 |
||
8930 |
"for developers only: return the release |
|
8931 |
(to further identify the version in case of errors)" |
|
8932 |
||
8933 |
%{ /* NOCONTEXT */ |
|
8934 |
extern OBJ __getRel(); |
|
8935 |
||
8936 |
RETURN (__getRel()); |
|
8937 |
%}. |
|
8938 |
^ 'ST/X_experimental' |
|
8939 |
||
8940 |
" |
|
8941 |
Smalltalk releaseIdentification |
|
8942 |
" |
|
8943 |
! |
|
8944 |
||
8945 |
releaseNr |
|
8946 |
"{ Pragma: +optSpace }" |
|
8947 |
||
14542 | 8948 |
"return the release number. |
8949 |
Now releaseNr is the build number (BUILD_NUMBER from Jenkins) |
|
10641 | 8950 |
|
8951 |
ST/X revision Naming is: |
|
18668 | 8952 |
<major>.<minor>.<revision>.<release>" |
14529 | 8953 |
|
8954 |
|releaseNumber| |
|
8955 |
||
8956 |
releaseNumber := Smalltalk versionBuildNumber. |
|
8957 |
releaseNumber isEmpty ifTrue:[ |
|
18668 | 8958 |
^ 0. |
14529 | 8959 |
]. |
8960 |
^ releaseNumber |
|
10641 | 8961 |
|
8962 |
" |
|
8963 |
Smalltalk releaseNr |
|
12867
2b9cbcea983b
version bump - layout of Class, Method and Context changed.
Claus Gittinger <cg@exept.de>
parents:
12861
diff
changeset
|
8964 |
Smalltalk versionString |
10641 | 8965 |
" |
8966 |
||
8967 |
"Created: / 10-12-1995 / 01:42:19 / cg" |
|
8968 |
"Modified: / 10-02-2007 / 14:49:51 / cg" |
|
8969 |
! |
|
8970 |
||
8971 |
revisionNr |
|
8972 |
"{ Pragma: +optSpace }" |
|
8973 |
||
8974 |
"return the revision number. |
|
8975 |
Incremented for releases which fix bugs/add features |
|
8976 |
and represent a stable workable version which got published |
|
8977 |
to the outside world. |
|
8978 |
||
8979 |
ST/X revision Naming is: |
|
22791 | 8980 |
<major>.<minor>.<revision>.<release>" |
19974 | 8981 |
|
8982 |
^ 0 |
|
10641 | 8983 |
|
8984 |
" |
|
8985 |
Smalltalk revisionNr |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
8986 |
Smalltalk hello string |
13014 | 8987 |
" |
8988 |
||
14898 | 8989 |
"Modified: / 19-03-2013 / 10:48:59 / az" |
19974 | 8990 |
"Modified: / 09-06-2016 / 16:28:57 / cg" |
10641 | 8991 |
! |
8992 |
||
8993 |
timeStamp |
|
8994 |
"return a string useful for timestamping a file. |
|
8995 |
The returned string is padded with spaces for a constant |
|
8996 |
length (to avoid changing a files size in fileOut with unchanged |
|
8997 |
class)." |
|
8998 |
||
8999 |
^ ('''' , self timeStampString , '''') paddedTo:80 with:(Character space) |
|
9000 |
! |
|
9001 |
||
9002 |
timeStamp:aStream |
|
9003 |
"write a string useful for timestamping a file onto aStream. |
|
9004 |
ST80 compatibility" |
|
9005 |
||
9006 |
aStream nextPutAll:(self timeStamp). |
|
9007 |
||
9008 |
"Created: / 18.6.1998 / 17:22:58 / cg" |
|
9009 |
! |
|
9010 |
||
9011 |
timeStampString |
|
9012 |
"return a string useful for timestamping a file." |
|
9013 |
||
9014 |
|dateString| |
|
9015 |
||
9016 |
dateString := String streamContents:[:s | Date today printOn:s language:#en]. "/ MUST be english !!!! |
|
9017 |
||
9018 |
^ ('From Smalltalk/X, Version:' , (Smalltalk versionString) , ' on ' |
|
9019 |
, dateString , ' at ' , Time now printString |
|
7758 | 9020 |
) |
9021 |
! |
|
9022 |
||
14529 | 9023 |
versionBuildNumber |
9024 |
"{ Pragma: +optSpace }" |
|
9025 |
||
9026 |
"return the executables build number - that's the jenkins build #. |
|
9027 |
Empty if not built by jenkins" |
|
9028 |
||
9029 |
%{ /* NOCONTEXT */ |
|
9030 |
extern char *__getBuildNumberString(); |
|
9031 |
||
9032 |
RETURN (__MKSTRING(__getBuildNumberString() COMMA_SND) ); |
|
9033 |
%}. |
|
9034 |
^ '' |
|
9035 |
||
9036 |
" |
|
9037 |
Smalltalk versionBuildNumber |
|
9038 |
" |
|
9039 |
! |
|
9040 |
||
10641 | 9041 |
versionDate |
9042 |
"{ Pragma: +optSpace }" |
|
9043 |
||
14522 | 9044 |
"return the executables build date - that's the date when the smalltalk |
10641 | 9045 |
executable was built" |
9046 |
||
9047 |
%{ /* NOCONTEXT */ |
|
9048 |
extern char *__getBuildDateString(); |
|
9049 |
||
9050 |
RETURN (__MKSTRING(__getBuildDateString() COMMA_SND) ); |
|
9051 |
%}. |
|
9052 |
^ 'today' |
|
9053 |
||
9054 |
" |
|
10071 | 9055 |
Smalltalk versionDate |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
9056 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
9057 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
9058 |
|
10641 | 9059 |
versionString |
9060 |
"{ Pragma: +optSpace }" |
|
9061 |
||
9062 |
"return the version string" |
|
9063 |
||
9064 |
^ (self majorVersionNr printString , |
|
9065 |
'.', |
|
9066 |
self minorVersionNr printString , |
|
9067 |
'.', |
|
14529 | 9068 |
self revisionNr printString, |
9069 |
'.', |
|
9070 |
self releaseNr printString) |
|
13771 | 9071 |
|
10641 | 9072 |
|
9073 |
" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
9074 |
Smalltalk versionString |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
9075 |
" |
10641 | 9076 |
! |
9077 |
||
9078 |
vmMajorVersionNr |
|
9079 |
"{ Pragma: +optSpace }" |
|
9080 |
||
9081 |
"return the VMs major version number." |
|
9082 |
%{ |
|
9083 |
RETURN (__mkSmallInteger(4)); |
|
9084 |
%}. |
|
9085 |
^ 4 |
|
9086 |
||
9087 |
" |
|
9088 |
Smalltalk vmMajorVersionNr |
|
9089 |
" |
|
2 | 9090 |
! ! |
453 | 9091 |
|
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
9092 |
!Smalltalk class methodsFor:'documentation'! |
630 | 9093 |
|
13532
638f9bfab880
changed: #recursiveInstallAutoloadedClassesFrom:rememberIn:maxLevels:noAutoload:packageTop:showSplashInLevels:
Claus Gittinger <cg@exept.de>
parents:
13531
diff
changeset
|
9094 |
version |
18560 | 9095 |
^ '$Header$' |
13532
638f9bfab880
changed: #recursiveInstallAutoloadedClassesFrom:rememberIn:maxLevels:noAutoload:packageTop:showSplashInLevels:
Claus Gittinger <cg@exept.de>
parents:
13531
diff
changeset
|
9096 |
! |
638f9bfab880
changed: #recursiveInstallAutoloadedClassesFrom:rememberIn:maxLevels:noAutoload:packageTop:showSplashInLevels:
Claus Gittinger <cg@exept.de>
parents:
13531
diff
changeset
|
9097 |
|
12172
d90a72004f43
changed: #fileNameForClass:
Claus Gittinger <cg@exept.de>
parents:
12033
diff
changeset
|
9098 |
version_CVS |
18560 | 9099 |
^ '$Header$' |
13415 | 9100 |
! |
9101 |
||
9102 |
version_SVN |
|
15225 | 9103 |
^ '$ Id: Smalltalk.st 10648 2011-06-23 15:55:10Z vranyj1 $' |
630 | 9104 |
! ! |
22792 | 9105 |